| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 continue; | 156 continue; |
| 157 | 157 |
| 158 if (pSubst->m_Charset == (int)charSet) { | 158 if (pSubst->m_Charset == (int)charSet) { |
| 159 csNameTag = csKey; | 159 csNameTag = csKey; |
| 160 return pFind; | 160 return pFind; |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 return nullptr; | 163 return nullptr; |
| 164 } | 164 } |
| 165 | 165 |
| 166 FX_BOOL FindFont(CPDF_Dictionary* pFormDict, | 166 bool FindFont(CPDF_Dictionary* pFormDict, |
| 167 const CPDF_Font* pFont, | 167 const CPDF_Font* pFont, |
| 168 CFX_ByteString& csNameTag) { | 168 CFX_ByteString& csNameTag) { |
| 169 if (!pFormDict || !pFont) | 169 if (!pFormDict || !pFont) |
| 170 return FALSE; | 170 return false; |
| 171 | 171 |
| 172 CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR"); | 172 CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR"); |
| 173 if (!pDR) | 173 if (!pDR) |
| 174 return FALSE; | 174 return false; |
| 175 | 175 |
| 176 CPDF_Dictionary* pFonts = pDR->GetDictFor("Font"); | 176 CPDF_Dictionary* pFonts = pDR->GetDictFor("Font"); |
| 177 if (!pFonts) | 177 if (!pFonts) |
| 178 return FALSE; | 178 return false; |
| 179 | 179 |
| 180 for (const auto& it : *pFonts) { | 180 for (const auto& it : *pFonts) { |
| 181 const CFX_ByteString& csKey = it.first; | 181 const CFX_ByteString& csKey = it.first; |
| 182 CPDF_Object* pObj = it.second; | 182 CPDF_Object* pObj = it.second; |
| 183 if (!pObj) | 183 if (!pObj) |
| 184 continue; | 184 continue; |
| 185 | 185 |
| 186 CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); | 186 CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); |
| 187 if (!pElement) | 187 if (!pElement) |
| 188 continue; | 188 continue; |
| 189 if (pElement->GetStringFor("Type") != "Font") | 189 if (pElement->GetStringFor("Type") != "Font") |
| 190 continue; | 190 continue; |
| 191 if (pFont->GetFontDict() == pElement) { | 191 if (pFont->GetFontDict() == pElement) { |
| 192 csNameTag = csKey; | 192 csNameTag = csKey; |
| 193 return TRUE; | 193 return true; |
| 194 } | 194 } |
| 195 } | 195 } |
| 196 return FALSE; | 196 return false; |
| 197 } | 197 } |
| 198 | 198 |
| 199 FX_BOOL FindFont(CPDF_Dictionary* pFormDict, | 199 bool FindFont(CPDF_Dictionary* pFormDict, |
| 200 CPDF_Document* pDocument, | 200 CPDF_Document* pDocument, |
| 201 CFX_ByteString csFontName, | 201 CFX_ByteString csFontName, |
| 202 CPDF_Font*& pFont, | 202 CPDF_Font*& pFont, |
| 203 CFX_ByteString& csNameTag) { | 203 CFX_ByteString& csNameTag) { |
| 204 if (!pFormDict) | 204 if (!pFormDict) |
| 205 return FALSE; | 205 return false; |
| 206 | 206 |
| 207 CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR"); | 207 CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR"); |
| 208 if (!pDR) | 208 if (!pDR) |
| 209 return FALSE; | 209 return false; |
| 210 | 210 |
| 211 CPDF_Dictionary* pFonts = pDR->GetDictFor("Font"); | 211 CPDF_Dictionary* pFonts = pDR->GetDictFor("Font"); |
| 212 if (!pFonts) | 212 if (!pFonts) |
| 213 return FALSE; | 213 return false; |
| 214 if (csFontName.GetLength() > 0) | 214 if (csFontName.GetLength() > 0) |
| 215 csFontName.Remove(' '); | 215 csFontName.Remove(' '); |
| 216 | 216 |
| 217 for (const auto& it : *pFonts) { | 217 for (const auto& it : *pFonts) { |
| 218 const CFX_ByteString& csKey = it.first; | 218 const CFX_ByteString& csKey = it.first; |
| 219 CPDF_Object* pObj = it.second; | 219 CPDF_Object* pObj = it.second; |
| 220 if (!pObj) | 220 if (!pObj) |
| 221 continue; | 221 continue; |
| 222 | 222 |
| 223 CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); | 223 CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect()); |
| 224 if (!pElement) | 224 if (!pElement) |
| 225 continue; | 225 continue; |
| 226 if (pElement->GetStringFor("Type") != "Font") | 226 if (pElement->GetStringFor("Type") != "Font") |
| 227 continue; | 227 continue; |
| 228 | 228 |
| 229 pFont = pDocument->LoadFont(pElement); | 229 pFont = pDocument->LoadFont(pElement); |
| 230 if (!pFont) | 230 if (!pFont) |
| 231 continue; | 231 continue; |
| 232 | 232 |
| 233 CFX_ByteString csBaseFont; | 233 CFX_ByteString csBaseFont; |
| 234 csBaseFont = pFont->GetBaseFont(); | 234 csBaseFont = pFont->GetBaseFont(); |
| 235 csBaseFont.Remove(' '); | 235 csBaseFont.Remove(' '); |
| 236 if (csBaseFont == csFontName) { | 236 if (csBaseFont == csFontName) { |
| 237 csNameTag = csKey; | 237 csNameTag = csKey; |
| 238 return TRUE; | 238 return true; |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 return FALSE; | 241 return false; |
| 242 } | 242 } |
| 243 | 243 |
| 244 void AddFont(CPDF_Dictionary*& pFormDict, | 244 void AddFont(CPDF_Dictionary*& pFormDict, |
| 245 CPDF_Document* pDocument, | 245 CPDF_Document* pDocument, |
| 246 const CPDF_Font* pFont, | 246 const CPDF_Font* pFont, |
| 247 CFX_ByteString& csNameTag) { | 247 CFX_ByteString& csNameTag) { |
| 248 if (!pFont) | 248 if (!pFont) |
| 249 return; | 249 return; |
| 250 if (!pFormDict) | 250 if (!pFormDict) |
| 251 InitDict(pFormDict, pDocument); | 251 InitDict(pFormDict, pDocument); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 } | 322 } |
| 323 | 323 |
| 324 protected: | 324 protected: |
| 325 CFX_WideString m_FullName; | 325 CFX_WideString m_FullName; |
| 326 const FX_WCHAR* m_pCur; | 326 const FX_WCHAR* m_pCur; |
| 327 const FX_WCHAR* m_pEnd; | 327 const FX_WCHAR* m_pEnd; |
| 328 }; | 328 }; |
| 329 | 329 |
| 330 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 330 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 331 typedef struct { | 331 typedef struct { |
| 332 FX_BOOL bFind; | 332 bool bFind; |
| 333 LOGFONTA lf; | 333 LOGFONTA lf; |
| 334 } PDF_FONTDATA; | 334 } PDF_FONTDATA; |
| 335 | 335 |
| 336 static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEXA* lpelfe, | 336 static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEXA* lpelfe, |
| 337 NEWTEXTMETRICEX* lpntme, | 337 NEWTEXTMETRICEX* lpntme, |
| 338 DWORD FontType, | 338 DWORD FontType, |
| 339 LPARAM lParam) { | 339 LPARAM lParam) { |
| 340 if (FontType != 0x004 || strchr(lpelfe->elfLogFont.lfFaceName, '@')) | 340 if (FontType != 0x004 || strchr(lpelfe->elfLogFont.lfFaceName, '@')) |
| 341 return 1; | 341 return 1; |
| 342 | 342 |
| 343 PDF_FONTDATA* pData = (PDF_FONTDATA*)lParam; | 343 PDF_FONTDATA* pData = (PDF_FONTDATA*)lParam; |
| 344 memcpy(&pData->lf, &lpelfe->elfLogFont, sizeof(LOGFONTA)); | 344 memcpy(&pData->lf, &lpelfe->elfLogFont, sizeof(LOGFONTA)); |
| 345 pData->bFind = TRUE; | 345 pData->bFind = true; |
| 346 return 0; | 346 return 0; |
| 347 } | 347 } |
| 348 | 348 |
| 349 FX_BOOL RetrieveSpecificFont(LOGFONTA& lf) { | 349 bool RetrieveSpecificFont(LOGFONTA& lf) { |
| 350 PDF_FONTDATA fd; | 350 PDF_FONTDATA fd; |
| 351 memset(&fd, 0, sizeof(PDF_FONTDATA)); | 351 memset(&fd, 0, sizeof(PDF_FONTDATA)); |
| 352 HDC hDC = ::GetDC(nullptr); | 352 HDC hDC = ::GetDC(nullptr); |
| 353 EnumFontFamiliesExA(hDC, &lf, (FONTENUMPROCA)EnumFontFamExProc, (LPARAM)&fd, | 353 EnumFontFamiliesExA(hDC, &lf, (FONTENUMPROCA)EnumFontFamExProc, (LPARAM)&fd, |
| 354 0); | 354 0); |
| 355 ::ReleaseDC(nullptr, hDC); | 355 ::ReleaseDC(nullptr, hDC); |
| 356 if (fd.bFind) | 356 if (fd.bFind) |
| 357 memcpy(&lf, &fd.lf, sizeof(LOGFONTA)); | 357 memcpy(&lf, &fd.lf, sizeof(LOGFONTA)); |
| 358 | 358 |
| 359 return fd.bFind; | 359 return fd.bFind; |
| 360 } | 360 } |
| 361 | 361 |
| 362 FX_BOOL RetrieveSpecificFont(uint8_t charSet, | 362 bool RetrieveSpecificFont(uint8_t charSet, |
| 363 uint8_t pitchAndFamily, | 363 uint8_t pitchAndFamily, |
| 364 LPCSTR pcsFontName, | 364 LPCSTR pcsFontName, |
| 365 LOGFONTA& lf) { | 365 LOGFONTA& lf) { |
| 366 memset(&lf, 0, sizeof(LOGFONTA)); | 366 memset(&lf, 0, sizeof(LOGFONTA)); |
| 367 lf.lfCharSet = charSet; | 367 lf.lfCharSet = charSet; |
| 368 lf.lfPitchAndFamily = pitchAndFamily; | 368 lf.lfPitchAndFamily = pitchAndFamily; |
| 369 if (pcsFontName) { | 369 if (pcsFontName) { |
| 370 // TODO(dsinclair): Should this be strncpy? | 370 // TODO(dsinclair): Should this be strncpy? |
| 371 strcpy(lf.lfFaceName, pcsFontName); | 371 strcpy(lf.lfFaceName, pcsFontName); |
| 372 } | 372 } |
| 373 return RetrieveSpecificFont(lf); | 373 return RetrieveSpecificFont(lf); |
| 374 } | 374 } |
| 375 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 375 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 } | 723 } |
| 724 if (!pResDict) | 724 if (!pResDict) |
| 725 return csTmp; | 725 return csTmp; |
| 726 | 726 |
| 727 CPDF_Dictionary* pDict = pResDict->GetDictFor(csType); | 727 CPDF_Dictionary* pDict = pResDict->GetDictFor(csType); |
| 728 if (!pDict) | 728 if (!pDict) |
| 729 return csTmp; | 729 return csTmp; |
| 730 | 730 |
| 731 int num = 0; | 731 int num = 0; |
| 732 CFX_ByteString bsNum; | 732 CFX_ByteString bsNum; |
| 733 while (TRUE) { | 733 while (true) { |
| 734 CFX_ByteString csKey = csTmp + bsNum; | 734 CFX_ByteString csKey = csTmp + bsNum; |
| 735 if (!pDict->KeyExist(csKey)) | 735 if (!pDict->KeyExist(csKey)) |
| 736 return csKey; | 736 return csKey; |
| 737 if (m < iCount) | 737 if (m < iCount) |
| 738 csTmp += csStr[m++]; | 738 csTmp += csStr[m++]; |
| 739 else | 739 else |
| 740 bsNum.Format("%d", num++); | 740 bsNum.Format("%d", num++); |
| 741 | 741 |
| 742 m++; | 742 m++; |
| 743 } | 743 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 757 } | 757 } |
| 758 | 758 |
| 759 CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, void* pLogFont) { | 759 CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, void* pLogFont) { |
| 760 CFX_ByteString csFontName; | 760 CFX_ByteString csFontName; |
| 761 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 761 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 762 LOGFONTA lf = {}; | 762 LOGFONTA lf = {}; |
| 763 if (charSet == FXFONT_ANSI_CHARSET) { | 763 if (charSet == FXFONT_ANSI_CHARSET) { |
| 764 csFontName = "Helvetica"; | 764 csFontName = "Helvetica"; |
| 765 return csFontName; | 765 return csFontName; |
| 766 } | 766 } |
| 767 FX_BOOL bRet = FALSE; | 767 bool bRet = false; |
| 768 if (charSet == FXFONT_SHIFTJIS_CHARSET) { | 768 if (charSet == FXFONT_SHIFTJIS_CHARSET) { |
| 769 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, | 769 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, |
| 770 "MS Mincho", lf); | 770 "MS Mincho", lf); |
| 771 } else if (charSet == FXFONT_GB2312_CHARSET) { | 771 } else if (charSet == FXFONT_GB2312_CHARSET) { |
| 772 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, "SimSun", | 772 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, "SimSun", |
| 773 lf); | 773 lf); |
| 774 } else if (charSet == FXFONT_CHINESEBIG5_CHARSET) { | 774 } else if (charSet == FXFONT_CHINESEBIG5_CHARSET) { |
| 775 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, "MingLiU", | 775 bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, "MingLiU", |
| 776 lf); | 776 lf); |
| 777 } | 777 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 802 CPDF_Document* pDocument) { | 802 CPDF_Document* pDocument) { |
| 803 if (!pDocument) | 803 if (!pDocument) |
| 804 return nullptr; | 804 return nullptr; |
| 805 | 805 |
| 806 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 806 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 807 LOGFONTA lf; | 807 LOGFONTA lf; |
| 808 CFX_ByteString csFontName = GetNativeFont(charSet, &lf); | 808 CFX_ByteString csFontName = GetNativeFont(charSet, &lf); |
| 809 if (!csFontName.IsEmpty()) { | 809 if (!csFontName.IsEmpty()) { |
| 810 if (csFontName == "Helvetica") | 810 if (csFontName == "Helvetica") |
| 811 return AddStandardFont(pDocument, csFontName); | 811 return AddStandardFont(pDocument, csFontName); |
| 812 return pDocument->AddWindowsFont(&lf, FALSE, TRUE); | 812 return pDocument->AddWindowsFont(&lf, false, true); |
| 813 } | 813 } |
| 814 #endif | 814 #endif |
| 815 return nullptr; | 815 return nullptr; |
| 816 } | 816 } |
| 817 | 817 |
| 818 CPDF_Font* CPDF_InterForm::AddNativeFont(CPDF_Document* pDocument) { | 818 CPDF_Font* CPDF_InterForm::AddNativeFont(CPDF_Document* pDocument) { |
| 819 return pDocument ? AddNativeFont(GetNativeCharSet(), pDocument) : nullptr; | 819 return pDocument ? AddNativeFont(GetNativeCharSet(), pDocument) : nullptr; |
| 820 } | 820 } |
| 821 | 821 |
| 822 bool CPDF_InterForm::ValidateFieldName( | 822 bool CPDF_InterForm::ValidateFieldName( |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 } | 933 } |
| 934 return nullptr; | 934 return nullptr; |
| 935 } | 935 } |
| 936 | 936 |
| 937 CPDF_FormControl* CPDF_InterForm::GetControlByDict( | 937 CPDF_FormControl* CPDF_InterForm::GetControlByDict( |
| 938 const CPDF_Dictionary* pWidgetDict) const { | 938 const CPDF_Dictionary* pWidgetDict) const { |
| 939 const auto it = m_ControlMap.find(pWidgetDict); | 939 const auto it = m_ControlMap.find(pWidgetDict); |
| 940 return it != m_ControlMap.end() ? it->second : nullptr; | 940 return it != m_ControlMap.end() ? it->second : nullptr; |
| 941 } | 941 } |
| 942 | 942 |
| 943 FX_BOOL CPDF_InterForm::NeedConstructAP() const { | 943 bool CPDF_InterForm::NeedConstructAP() const { |
| 944 return m_pFormDict && m_pFormDict->GetBooleanFor("NeedAppearances"); | 944 return m_pFormDict && m_pFormDict->GetBooleanFor("NeedAppearances"); |
| 945 } | 945 } |
| 946 | 946 |
| 947 int CPDF_InterForm::CountFieldsInCalculationOrder() { | 947 int CPDF_InterForm::CountFieldsInCalculationOrder() { |
| 948 if (!m_pFormDict) | 948 if (!m_pFormDict) |
| 949 return 0; | 949 return 0; |
| 950 | 950 |
| 951 CPDF_Array* pArray = m_pFormDict->GetArrayFor("CO"); | 951 CPDF_Array* pArray = m_pFormDict->GetArrayFor("CO"); |
| 952 return pArray ? pArray->GetCount() : 0; | 952 return pArray ? pArray->GetCount() : 0; |
| 953 } | 953 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 if (pChildDict) { | 1054 if (pChildDict) { |
| 1055 if (pChildDict->GetObjNum() != dwParentObjNum) | 1055 if (pChildDict->GetObjNum() != dwParentObjNum) |
| 1056 LoadField(pChildDict, nLevel + 1); | 1056 LoadField(pChildDict, nLevel + 1); |
| 1057 } | 1057 } |
| 1058 } | 1058 } |
| 1059 } else { | 1059 } else { |
| 1060 AddTerminalField(pFieldDict); | 1060 AddTerminalField(pFieldDict); |
| 1061 } | 1061 } |
| 1062 } | 1062 } |
| 1063 | 1063 |
| 1064 FX_BOOL CPDF_InterForm::HasXFAForm() const { | 1064 bool CPDF_InterForm::HasXFAForm() const { |
| 1065 return m_pFormDict && m_pFormDict->GetArrayFor("XFA"); | 1065 return m_pFormDict && m_pFormDict->GetArrayFor("XFA"); |
| 1066 } | 1066 } |
| 1067 | 1067 |
| 1068 void CPDF_InterForm::FixPageFields(const CPDF_Page* pPage) { | 1068 void CPDF_InterForm::FixPageFields(const CPDF_Page* pPage) { |
| 1069 CPDF_Dictionary* pPageDict = pPage->m_pFormDict; | 1069 CPDF_Dictionary* pPageDict = pPage->m_pFormDict; |
| 1070 if (!pPageDict) | 1070 if (!pPageDict) |
| 1071 return; | 1071 return; |
| 1072 | 1072 |
| 1073 CPDF_Array* pAnnots = pPageDict->GetArrayFor("Annots"); | 1073 CPDF_Array* pAnnots = pPageDict->GetArrayFor("Annots"); |
| 1074 if (!pAnnots) | 1074 if (!pAnnots) |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1234 if (bIncludeOrExclude == pdfium::ContainsValue(fields, pField)) { | 1234 if (bIncludeOrExclude == pdfium::ContainsValue(fields, pField)) { |
| 1235 if ((dwFlags & 0x02) != 0 && pField->m_pDict->GetStringFor("V").IsEmpty()) | 1235 if ((dwFlags & 0x02) != 0 && pField->m_pDict->GetStringFor("V").IsEmpty()) |
| 1236 continue; | 1236 continue; |
| 1237 | 1237 |
| 1238 CFX_WideString fullname = FPDF_GetFullName(pField->GetFieldDict()); | 1238 CFX_WideString fullname = FPDF_GetFullName(pField->GetFieldDict()); |
| 1239 CPDF_Dictionary* pFieldDict = | 1239 CPDF_Dictionary* pFieldDict = |
| 1240 new CPDF_Dictionary(pDoc->GetByteStringPool()); | 1240 new CPDF_Dictionary(pDoc->GetByteStringPool()); |
| 1241 pFieldDict->SetFor("T", new CPDF_String(fullname)); | 1241 pFieldDict->SetFor("T", new CPDF_String(fullname)); |
| 1242 if (pField->GetType() == CPDF_FormField::CheckBox || | 1242 if (pField->GetType() == CPDF_FormField::CheckBox || |
| 1243 pField->GetType() == CPDF_FormField::RadioButton) { | 1243 pField->GetType() == CPDF_FormField::RadioButton) { |
| 1244 CFX_WideString csExport = pField->GetCheckValue(FALSE); | 1244 CFX_WideString csExport = pField->GetCheckValue(false); |
| 1245 CFX_ByteString csBExport = PDF_EncodeText(csExport); | 1245 CFX_ByteString csBExport = PDF_EncodeText(csExport); |
| 1246 CPDF_Object* pOpt = FPDF_GetFieldAttr(pField->m_pDict, "Opt"); | 1246 CPDF_Object* pOpt = FPDF_GetFieldAttr(pField->m_pDict, "Opt"); |
| 1247 if (pOpt) | 1247 if (pOpt) |
| 1248 pFieldDict->SetStringFor("V", csBExport); | 1248 pFieldDict->SetStringFor("V", csBExport); |
| 1249 else | 1249 else |
| 1250 pFieldDict->SetNameFor("V", csBExport); | 1250 pFieldDict->SetNameFor("V", csBExport); |
| 1251 } else { | 1251 } else { |
| 1252 CPDF_Object* pV = FPDF_GetFieldAttr(pField->m_pDict, "V"); | 1252 CPDF_Object* pV = FPDF_GetFieldAttr(pField->m_pDict, "V"); |
| 1253 if (pV) | 1253 if (pV) |
| 1254 pFieldDict->SetFor("V", pV->CloneDirectObject()); | 1254 pFieldDict->SetFor("V", pV->CloneDirectObject()); |
| 1255 } | 1255 } |
| 1256 pFields->Add(pFieldDict); | 1256 pFields->Add(pFieldDict); |
| 1257 } | 1257 } |
| 1258 } | 1258 } |
| 1259 return pDoc; | 1259 return pDoc; |
| 1260 } | 1260 } |
| 1261 | 1261 |
| 1262 void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict, | 1262 void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict, |
| 1263 const CFX_WideString& parent_name, | 1263 const CFX_WideString& parent_name, |
| 1264 FX_BOOL bNotify, | 1264 bool bNotify, |
| 1265 int nLevel) { | 1265 int nLevel) { |
| 1266 CFX_WideString name; | 1266 CFX_WideString name; |
| 1267 if (!parent_name.IsEmpty()) | 1267 if (!parent_name.IsEmpty()) |
| 1268 name = parent_name + L"."; | 1268 name = parent_name + L"."; |
| 1269 | 1269 |
| 1270 name += pFieldDict->GetUnicodeTextFor("T"); | 1270 name += pFieldDict->GetUnicodeTextFor("T"); |
| 1271 CPDF_Array* pKids = pFieldDict->GetArrayFor("Kids"); | 1271 CPDF_Array* pKids = pFieldDict->GetArrayFor("Kids"); |
| 1272 if (pKids) { | 1272 if (pKids) { |
| 1273 for (size_t i = 0; i < pKids->GetCount(); i++) { | 1273 for (size_t i = 0; i < pKids->GetCount(); i++) { |
| 1274 CPDF_Dictionary* pKid = pKids->GetDictAt(i); | 1274 CPDF_Dictionary* pKid = pKids->GetDictAt(i); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 else if (iType == FIELDTYPE_LISTBOX) | 1313 else if (iType == FIELDTYPE_LISTBOX) |
| 1314 m_pFormNotify->AfterSelectionChange(pField); | 1314 m_pFormNotify->AfterSelectionChange(pField); |
| 1315 else if (iType == FIELDTYPE_COMBOBOX || iType == FIELDTYPE_TEXTFIELD) | 1315 else if (iType == FIELDTYPE_COMBOBOX || iType == FIELDTYPE_TEXTFIELD) |
| 1316 m_pFormNotify->AfterValueChange(pField); | 1316 m_pFormNotify->AfterValueChange(pField); |
| 1317 } | 1317 } |
| 1318 } | 1318 } |
| 1319 | 1319 |
| 1320 void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) { | 1320 void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) { |
| 1321 m_pFormNotify = pNotify; | 1321 m_pFormNotify = pNotify; |
| 1322 } | 1322 } |
| OLD | NEW |