| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "core/fpdfapi/font/cpdf_font.h" | 9 #include "core/fpdfapi/font/cpdf_font.h" |
| 10 #include "core/fpdfapi/font/cpdf_fontencoding.h" | 10 #include "core/fpdfapi/font/cpdf_fontencoding.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 void AddFont(CPDF_Dictionary*& pFormDict, | 52 void AddFont(CPDF_Dictionary*& pFormDict, |
| 53 CPDF_Document* pDocument, | 53 CPDF_Document* pDocument, |
| 54 const CPDF_Font* pFont, | 54 const CPDF_Font* pFont, |
| 55 CFX_ByteString& csNameTag); | 55 CFX_ByteString& csNameTag); |
| 56 | 56 |
| 57 void InitDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) { | 57 void InitDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) { |
| 58 if (!pDocument) | 58 if (!pDocument) |
| 59 return; | 59 return; |
| 60 | 60 |
| 61 if (!pFormDict) { | 61 if (!pFormDict) { |
| 62 pFormDict = new CPDF_Dictionary(pDocument->GetByteStringPool()); | 62 pFormDict = |
| 63 pDocument->GetRoot()->SetReferenceFor( | 63 pDocument->NewIndirect<CPDF_Dictionary>(pDocument->GetByteStringPool()); |
| 64 "AcroForm", pDocument, pDocument->AddIndirectObject(pFormDict)); | 64 pDocument->GetRoot()->SetReferenceFor("AcroForm", pDocument, |
| 65 pFormDict->GetObjNum()); |
| 65 } | 66 } |
| 66 | 67 |
| 67 CFX_ByteString csDA; | 68 CFX_ByteString csDA; |
| 68 if (!pFormDict->KeyExist("DR")) { | 69 if (!pFormDict->KeyExist("DR")) { |
| 69 CFX_ByteString csBaseName; | 70 CFX_ByteString csBaseName; |
| 70 CFX_ByteString csDefault; | 71 CFX_ByteString csDefault; |
| 71 uint8_t charSet = CPDF_InterForm::GetNativeCharSet(); | 72 uint8_t charSet = CPDF_InterForm::GetNativeCharSet(); |
| 72 CPDF_Font* pFont = CPDF_InterForm::AddStandardFont(pDocument, "Helvetica"); | 73 CPDF_Font* pFont = CPDF_InterForm::AddStandardFont(pDocument, "Helvetica"); |
| 73 if (pFont) { | 74 if (pFont) { |
| 74 AddFont(pFormDict, pDocument, pFont, csBaseName); | 75 AddFont(pFormDict, pDocument, pFont, csBaseName); |
| (...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 else if (iType == FIELDTYPE_LISTBOX) | 1315 else if (iType == FIELDTYPE_LISTBOX) |
| 1315 m_pFormNotify->AfterSelectionChange(pField); | 1316 m_pFormNotify->AfterSelectionChange(pField); |
| 1316 else if (iType == FIELDTYPE_COMBOBOX || iType == FIELDTYPE_TEXTFIELD) | 1317 else if (iType == FIELDTYPE_COMBOBOX || iType == FIELDTYPE_TEXTFIELD) |
| 1317 m_pFormNotify->AfterValueChange(pField); | 1318 m_pFormNotify->AfterValueChange(pField); |
| 1318 } | 1319 } |
| 1319 } | 1320 } |
| 1320 | 1321 |
| 1321 void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) { | 1322 void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) { |
| 1322 m_pFormNotify = pNotify; | 1323 m_pFormNotify = pNotify; |
| 1323 } | 1324 } |
| OLD | NEW |