Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: core/src/fpdfdoc/doc_form.cpp

Issue 1172793002: Merge to XFA: Use stdint.h types throughout PDFium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fpdfdoc/doc_basic.cpp ('k') | core/src/fpdfdoc/doc_link.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 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 "../../include/fpdfdoc/fpdf_doc.h" 7 #include "../../include/fpdfdoc/fpdf_doc.h"
8 #include "../../include/fxcrt/fx_xml.h" 8 #include "../../include/fxcrt/fx_xml.h"
9 #include "doc_utils.h" 9 #include "doc_utils.h"
10 10
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 PDF_FONTDATA fd; 369 PDF_FONTDATA fd;
370 memset(&fd, 0, sizeof(PDF_FONTDATA)); 370 memset(&fd, 0, sizeof(PDF_FONTDATA));
371 HDC hDC = ::GetDC(NULL); 371 HDC hDC = ::GetDC(NULL);
372 EnumFontFamiliesExA(hDC, &lf, (FONTENUMPROCA)EnumFontFamExProc, (LPARAM)&fd, 0); 372 EnumFontFamiliesExA(hDC, &lf, (FONTENUMPROCA)EnumFontFamExProc, (LPARAM)&fd, 0);
373 ::ReleaseDC(NULL, hDC); 373 ::ReleaseDC(NULL, hDC);
374 if (fd.bFind) { 374 if (fd.bFind) {
375 memcpy(&lf, &fd.lf, sizeof(LOGFONTA)); 375 memcpy(&lf, &fd.lf, sizeof(LOGFONTA));
376 } 376 }
377 return fd.bFind; 377 return fd.bFind;
378 } 378 }
379 static FX_BOOL RetrieveSpecificFont(FX_BYTE charSet, FX_BYTE pitchAndFamily, LPC STR pcsFontName, LOGFONTA& lf) 379 static FX_BOOL RetrieveSpecificFont(uint8_t charSet, uint8_t pitchAndFamily, LPC STR pcsFontName, LOGFONTA& lf)
380 { 380 {
381 memset(&lf, 0, sizeof(LOGFONTA)); 381 memset(&lf, 0, sizeof(LOGFONTA));
382 lf.lfCharSet = charSet; 382 lf.lfCharSet = charSet;
383 lf.lfPitchAndFamily = pitchAndFamily; 383 lf.lfPitchAndFamily = pitchAndFamily;
384 if (pcsFontName != NULL) { 384 if (pcsFontName != NULL) {
385 strcpy(lf.lfFaceName, pcsFontName); 385 strcpy(lf.lfFaceName, pcsFontName);
386 } 386 }
387 return RetrieveSpecificFont(lf); 387 return RetrieveSpecificFont(lf);
388 } 388 }
389 static FX_BOOL RetrieveStockFont(int iFontObject, FX_BYTE charSet, LOGFONTA& lf) 389 static FX_BOOL RetrieveStockFont(int iFontObject, uint8_t charSet, LOGFONTA& lf)
390 { 390 {
391 HFONT hFont = (HFONT)::GetStockObject(iFontObject); 391 HFONT hFont = (HFONT)::GetStockObject(iFontObject);
392 if (hFont != NULL) { 392 if (hFont != NULL) {
393 memset(&lf, 0, sizeof(LOGFONTA)); 393 memset(&lf, 0, sizeof(LOGFONTA));
394 int iRet = ::GetObject(hFont, sizeof(LOGFONTA), &lf); 394 int iRet = ::GetObject(hFont, sizeof(LOGFONTA), &lf);
395 if (iRet > 0 && (lf.lfCharSet == charSet || charSet == 255)) { 395 if (iRet > 0 && (lf.lfCharSet == charSet || charSet == 255)) {
396 return RetrieveSpecificFont(lf); 396 return RetrieveSpecificFont(lf);
397 } 397 }
398 } 398 }
399 return FALSE; 399 return FALSE;
(...skipping 11 matching lines...) Expand all
411 bRet = RetrieveStockFont(DEFAULT_GUI_FONT, 255, lf); 411 bRet = RetrieveStockFont(DEFAULT_GUI_FONT, 255, lf);
412 if (!bRet) { 412 if (!bRet) {
413 bRet = RetrieveStockFont(SYSTEM_FONT, 255, lf); 413 bRet = RetrieveStockFont(SYSTEM_FONT, 255, lf);
414 } 414 }
415 if (bRet) { 415 if (bRet) {
416 pFont = ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, FALSE, TRUE); 416 pFont = ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, FALSE, TRUE);
417 } 417 }
418 #endif 418 #endif
419 return pFont; 419 return pFont;
420 } 420 }
421 CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_Byt eString csFontName, FX_BYTE iCharSet) 421 CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_Byt eString csFontName, uint8_t iCharSet)
422 { 422 {
423 if (pDocument == NULL || csFontName.IsEmpty()) { 423 if (pDocument == NULL || csFontName.IsEmpty()) {
424 return NULL; 424 return NULL;
425 } 425 }
426 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 426 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
427 if (iCharSet == 1) { 427 if (iCharSet == 1) {
428 iCharSet = GetNativeCharSet(); 428 iCharSet = GetNativeCharSet();
429 } 429 }
430 HFONT hFont = ::CreateFontA(0, 0, 0, 0, 0, 0, 0, 0, iCharSet, OUT_DEFAULT_PR ECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, csFontN ame.c_str()); 430 HFONT hFont = ::CreateFontA(0, 0, 0, 0, 0, 0, 0, 0, iCharSet, OUT_DEFAULT_PR ECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, csFontN ame.c_str());
431 if (hFont != NULL) { 431 if (hFont != NULL) {
432 LOGFONTA lf; 432 LOGFONTA lf;
433 memset(&lf, 0, sizeof(LOGFONTA)); 433 memset(&lf, 0, sizeof(LOGFONTA));
434 ::GetObjectA(hFont, sizeof(LOGFONTA), &lf); 434 ::GetObjectA(hFont, sizeof(LOGFONTA), &lf);
435 ::DeleteObject(hFont); 435 ::DeleteObject(hFont);
436 if (strlen(lf.lfFaceName) > 0) { 436 if (strlen(lf.lfFaceName) > 0) {
437 return ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, FALSE, TRUE) ; 437 return ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, FALSE, TRUE) ;
438 } 438 }
439 } 439 }
440 #endif 440 #endif
441 return NULL; 441 return NULL;
442 } 442 }
443 CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_Wid eString csFontName, FX_BYTE iCharSet) 443 CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_Wid eString csFontName, uint8_t iCharSet)
444 { 444 {
445 if (pDocument == NULL || csFontName.IsEmpty()) { 445 if (pDocument == NULL || csFontName.IsEmpty()) {
446 return NULL; 446 return NULL;
447 } 447 }
448 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 448 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
449 if (iCharSet == 1) { 449 if (iCharSet == 1) {
450 iCharSet = GetNativeCharSet(); 450 iCharSet = GetNativeCharSet();
451 } 451 }
452 HFONT hFont = ::CreateFontW(0, 0, 0, 0, 0, 0, 0, 0, iCharSet, OUT_DEFAULT_PR ECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, csFontN ame.c_str()); 452 HFONT hFont = ::CreateFontW(0, 0, 0, 0, 0, 0, 0, 0, iCharSet, OUT_DEFAULT_PR ECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, csFontN ame.c_str());
453 if (hFont != NULL) { 453 if (hFont != NULL) {
(...skipping 15 matching lines...) Expand all
469 } 469 }
470 CPDF_Font* pFont = NULL; 470 CPDF_Font* pFont = NULL;
471 if (csFontName == "ZapfDingbats") { 471 if (csFontName == "ZapfDingbats") {
472 pFont = ((CPDF_Document*)pDocument)->AddStandardFont(csFontName, NULL); 472 pFont = ((CPDF_Document*)pDocument)->AddStandardFont(csFontName, NULL);
473 } else { 473 } else {
474 CPDF_FontEncoding encoding(PDFFONT_ENCODING_WINANSI); 474 CPDF_FontEncoding encoding(PDFFONT_ENCODING_WINANSI);
475 pFont = ((CPDF_Document*)pDocument)->AddStandardFont(csFontName, &encodi ng); 475 pFont = ((CPDF_Document*)pDocument)->AddStandardFont(csFontName, &encodi ng);
476 } 476 }
477 return pFont; 477 return pFont;
478 } 478 }
479 CFX_ByteString CPDF_InterForm::GetNativeFont(FX_BYTE charSet, FX_LPVOID pLogFont ) 479 CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, FX_LPVOID pLogFont )
480 { 480 {
481 CFX_ByteString csFontName; 481 CFX_ByteString csFontName;
482 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 482 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
483 LOGFONTA lf; 483 LOGFONTA lf;
484 FX_BOOL bRet; 484 FX_BOOL bRet;
485 if (charSet == ANSI_CHARSET) { 485 if (charSet == ANSI_CHARSET) {
486 csFontName = "Helvetica"; 486 csFontName = "Helvetica";
487 return csFontName; 487 return csFontName;
488 } 488 }
489 bRet = FALSE; 489 bRet = FALSE;
(...skipping 19 matching lines...) Expand all
509 } 509 }
510 csFontName = lf.lfFaceName; 510 csFontName = lf.lfFaceName;
511 return csFontName; 511 return csFontName;
512 } 512 }
513 #endif 513 #endif
514 return csFontName; 514 return csFontName;
515 } 515 }
516 CFX_ByteString CPDF_InterForm::GetNativeFont(FX_LPVOID pLogFont) 516 CFX_ByteString CPDF_InterForm::GetNativeFont(FX_LPVOID pLogFont)
517 { 517 {
518 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 518 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
519 FX_BYTE charSet = GetNativeCharSet(); 519 uint8_t charSet = GetNativeCharSet();
520 return GetNativeFont(charSet, pLogFont); 520 return GetNativeFont(charSet, pLogFont);
521 #else 521 #else
522 return CFX_ByteString(); 522 return CFX_ByteString();
523 #endif 523 #endif
524 } 524 }
525 FX_BYTE CPDF_InterForm::GetNativeCharSet() 525 uint8_t CPDF_InterForm::GetNativeCharSet()
526 { 526 {
527 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 527 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
528 FX_BYTE charSet = ANSI_CHARSET; 528 uint8_t charSet = ANSI_CHARSET;
529 UINT iCodePage = ::GetACP(); 529 UINT iCodePage = ::GetACP();
530 switch (iCodePage) { 530 switch (iCodePage) {
531 case 932: 531 case 932:
532 charSet = SHIFTJIS_CHARSET; 532 charSet = SHIFTJIS_CHARSET;
533 break; 533 break;
534 case 936: 534 case 936:
535 charSet = GB2312_CHARSET; 535 charSet = GB2312_CHARSET;
536 break; 536 break;
537 case 950: 537 case 950:
538 charSet = CHINESEBIG5_CHARSET; 538 charSet = CHINESEBIG5_CHARSET;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 break; 575 break;
576 case 1361: 576 case 1361:
577 charSet = JOHAB_CHARSET; 577 charSet = JOHAB_CHARSET;
578 break; 578 break;
579 } 579 }
580 return charSet; 580 return charSet;
581 #else 581 #else
582 return 0; 582 return 0;
583 #endif 583 #endif
584 } 584 }
585 CPDF_Font* CPDF_InterForm::AddNativeFont(FX_BYTE charSet, const CPDF_Document* p Document) 585 CPDF_Font* CPDF_InterForm::AddNativeFont(uint8_t charSet, const CPDF_Document* p Document)
586 { 586 {
587 if (pDocument == NULL) { 587 if (pDocument == NULL) {
588 return NULL; 588 return NULL;
589 } 589 }
590 CPDF_Font* pFont = NULL; 590 CPDF_Font* pFont = NULL;
591 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 591 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
592 LOGFONTA lf; 592 LOGFONTA lf;
593 CFX_ByteString csFontName = GetNativeFont(charSet, &lf); 593 CFX_ByteString csFontName = GetNativeFont(charSet, &lf);
594 if (!csFontName.IsEmpty()) { 594 if (!csFontName.IsEmpty()) {
595 if (csFontName == "Helvetica") { 595 if (csFontName == "Helvetica") {
596 pFont = AddStandardFont(pDocument, csFontName); 596 pFont = AddStandardFont(pDocument, csFontName);
597 } else { 597 } else {
598 pFont = ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, FALSE, TRUE ); 598 pFont = ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, FALSE, TRUE );
599 } 599 }
600 } 600 }
601 #endif 601 #endif
602 return pFont; 602 return pFont;
603 } 603 }
604 CPDF_Font* CPDF_InterForm::AddNativeFont(const CPDF_Document* pDocument) 604 CPDF_Font* CPDF_InterForm::AddNativeFont(const CPDF_Document* pDocument)
605 { 605 {
606 if (pDocument == NULL) { 606 if (pDocument == NULL) {
607 return NULL; 607 return NULL;
608 } 608 }
609 CPDF_Font* pFont = NULL; 609 CPDF_Font* pFont = NULL;
610 FX_BYTE charSet = GetNativeCharSet(); 610 uint8_t charSet = GetNativeCharSet();
611 pFont = AddNativeFont(charSet, pDocument); 611 pFont = AddNativeFont(charSet, pDocument);
612 return pFont; 612 return pFont;
613 } 613 }
614 FX_BOOL CPDF_InterForm::ValidateFieldName(CFX_WideString& csNewFieldName, int iT ype, const CPDF_FormField* pExcludedField, const CPDF_FormControl* pExcludedCont rol) 614 FX_BOOL CPDF_InterForm::ValidateFieldName(CFX_WideString& csNewFieldName, int iT ype, const CPDF_FormField* pExcludedField, const CPDF_FormControl* pExcludedCont rol)
615 { 615 {
616 if (csNewFieldName.IsEmpty()) { 616 if (csNewFieldName.IsEmpty()) {
617 return FALSE; 617 return FALSE;
618 } 618 }
619 int iPos = 0; 619 int iPos = 0;
620 int iLength = csNewFieldName.GetLength(); 620 int iLength = csNewFieldName.GetLength();
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 return GetInterFormFont(m_pFormDict, m_pDocument, index, csNameTag); 1079 return GetInterFormFont(m_pFormDict, m_pDocument, index, csNameTag);
1080 } 1080 }
1081 CPDF_Font* CPDF_InterForm::GetFormFont(CFX_ByteString csNameTag) 1081 CPDF_Font* CPDF_InterForm::GetFormFont(CFX_ByteString csNameTag)
1082 { 1082 {
1083 return GetInterFormFont(m_pFormDict, m_pDocument, csNameTag); 1083 return GetInterFormFont(m_pFormDict, m_pDocument, csNameTag);
1084 } 1084 }
1085 CPDF_Font* CPDF_InterForm::GetFormFont(CFX_ByteString csFontName, CFX_ByteString & csNameTag) 1085 CPDF_Font* CPDF_InterForm::GetFormFont(CFX_ByteString csFontName, CFX_ByteString & csNameTag)
1086 { 1086 {
1087 return GetInterFormFont(m_pFormDict, m_pDocument, csFontName, csNameTag); 1087 return GetInterFormFont(m_pFormDict, m_pDocument, csFontName, csNameTag);
1088 } 1088 }
1089 CPDF_Font* CPDF_InterForm::GetNativeFormFont(FX_BYTE charSet, CFX_ByteString& cs NameTag) 1089 CPDF_Font* CPDF_InterForm::GetNativeFormFont(uint8_t charSet, CFX_ByteString& cs NameTag)
1090 { 1090 {
1091 return GetNativeInterFormFont(m_pFormDict, m_pDocument, charSet, csNameTag); 1091 return GetNativeInterFormFont(m_pFormDict, m_pDocument, charSet, csNameTag);
1092 } 1092 }
1093 CPDF_Font* CPDF_InterForm::GetNativeFormFont(CFX_ByteString& csNameTag) 1093 CPDF_Font* CPDF_InterForm::GetNativeFormFont(CFX_ByteString& csNameTag)
1094 { 1094 {
1095 return GetNativeInterFormFont(m_pFormDict, m_pDocument, csNameTag); 1095 return GetNativeInterFormFont(m_pFormDict, m_pDocument, csNameTag);
1096 } 1096 }
1097 FX_BOOL CPDF_InterForm::FindFormFont(const CPDF_Font* pFont, CFX_ByteString& csN ameTag) 1097 FX_BOOL CPDF_InterForm::FindFormFont(const CPDF_Font* pFont, CFX_ByteString& csN ameTag)
1098 { 1098 {
1099 return FindInterFormFont(m_pFormDict, pFont, csNameTag); 1099 return FindInterFormFont(m_pFormDict, pFont, csNameTag);
1100 } 1100 }
1101 FX_BOOL CPDF_InterForm::FindFormFont(CFX_ByteString csFontName, CPDF_Font*& pFon t, CFX_ByteString& csNameTag) 1101 FX_BOOL CPDF_InterForm::FindFormFont(CFX_ByteString csFontName, CPDF_Font*& pFon t, CFX_ByteString& csNameTag)
1102 { 1102 {
1103 return FindInterFormFont(m_pFormDict, m_pDocument, csFontName, pFont, csName Tag); 1103 return FindInterFormFont(m_pFormDict, m_pDocument, csFontName, pFont, csName Tag);
1104 } 1104 }
1105 void CPDF_InterForm::AddFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameT ag) 1105 void CPDF_InterForm::AddFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameT ag)
1106 { 1106 {
1107 AddInterFormFont(m_pFormDict, m_pDocument, pFont, csNameTag); 1107 AddInterFormFont(m_pFormDict, m_pDocument, pFont, csNameTag);
1108 m_bUpdated = TRUE; 1108 m_bUpdated = TRUE;
1109 } 1109 }
1110 CPDF_Font* CPDF_InterForm::AddNativeFormFont(FX_BYTE charSet, CFX_ByteString& cs NameTag) 1110 CPDF_Font* CPDF_InterForm::AddNativeFormFont(uint8_t charSet, CFX_ByteString& cs NameTag)
1111 { 1111 {
1112 m_bUpdated = TRUE; 1112 m_bUpdated = TRUE;
1113 return AddNativeInterFormFont(m_pFormDict, m_pDocument, charSet, csNameTag); 1113 return AddNativeInterFormFont(m_pFormDict, m_pDocument, charSet, csNameTag);
1114 } 1114 }
1115 CPDF_Font* CPDF_InterForm::AddNativeFormFont(CFX_ByteString& csNameTag) 1115 CPDF_Font* CPDF_InterForm::AddNativeFormFont(CFX_ByteString& csNameTag)
1116 { 1116 {
1117 m_bUpdated = TRUE; 1117 m_bUpdated = TRUE;
1118 return AddNativeInterFormFont(m_pFormDict, m_pDocument, csNameTag); 1118 return AddNativeInterFormFont(m_pFormDict, m_pDocument, csNameTag);
1119 } 1119 }
1120 void CPDF_InterForm::RemoveFormFont(const CPDF_Font* pFont) 1120 void CPDF_InterForm::RemoveFormFont(const CPDF_Font* pFont)
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 return pControl; 1362 return pControl;
1363 } 1363 }
1364 CPDF_FormField* CPDF_InterForm::CheckRequiredFields(const CFX_PtrArray *fields, FX_BOOL bIncludeOrExclude) const 1364 CPDF_FormField* CPDF_InterForm::CheckRequiredFields(const CFX_PtrArray *fields, FX_BOOL bIncludeOrExclude) const
1365 { 1365 {
1366 int nCount = m_pFieldTree->m_Root.CountFields(); 1366 int nCount = m_pFieldTree->m_Root.CountFields();
1367 for (int i = 0; i < nCount; i++) { 1367 for (int i = 0; i < nCount; i++) {
1368 CPDF_FormField* pField = m_pFieldTree->m_Root.GetField(i); 1368 CPDF_FormField* pField = m_pFieldTree->m_Root.GetField(i);
1369 if (pField == NULL) { 1369 if (pField == NULL) {
1370 continue; 1370 continue;
1371 } 1371 }
1372 FX_INT32 iType = pField->GetType(); 1372 int32_t iType = pField->GetType();
1373 if (iType == CPDF_FormField::PushButton || iType == CPDF_FormField::Chec kBox || iType == CPDF_FormField::ListBox) { 1373 if (iType == CPDF_FormField::PushButton || iType == CPDF_FormField::Chec kBox || iType == CPDF_FormField::ListBox) {
1374 continue; 1374 continue;
1375 } 1375 }
1376 FX_DWORD dwFlags = pField->GetFieldFlags(); 1376 FX_DWORD dwFlags = pField->GetFieldFlags();
1377 if (dwFlags & 0x04) { 1377 if (dwFlags & 0x04) {
1378 continue; 1378 continue;
1379 } 1379 }
1380 FX_BOOL bFind = TRUE; 1380 FX_BOOL bFind = TRUE;
1381 if (fields != NULL) { 1381 if (fields != NULL) {
1382 bFind = fields->Find(pField, 0) >= 0; 1382 bFind = fields->Find(pField, 0) >= 0;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 pFieldDict->SetAt("V", pV->Clone(TRUE)); 1465 pFieldDict->SetAt("V", pV->Clone(TRUE));
1466 } 1466 }
1467 } 1467 }
1468 pFields->Add(pFieldDict); 1468 pFields->Add(pFieldDict);
1469 } 1469 }
1470 } 1470 }
1471 return pDoc; 1471 return pDoc;
1472 } 1472 }
1473 const struct _SupportFieldEncoding { 1473 const struct _SupportFieldEncoding {
1474 FX_LPCSTR m_name; 1474 FX_LPCSTR m_name;
1475 FX_INT32 m_codePage; 1475 int32_t m_codePage;
1476 } g_fieldEncoding[] = { 1476 } g_fieldEncoding[] = {
1477 { "BigFive", 950 }, 1477 { "BigFive", 950 },
1478 { "GBK", 936 }, 1478 { "GBK", 936 },
1479 { "Shift-JIS", 932 }, 1479 { "Shift-JIS", 932 },
1480 { "UHC", 949 }, 1480 { "UHC", 949 },
1481 }; 1481 };
1482 static void FPDFDOC_FDF_GetFieldValue(CPDF_Dictionary *pFieldDict, CFX_WideStrin g &csValue, CFX_ByteString &bsEncoding) 1482 static void FPDFDOC_FDF_GetFieldValue(CPDF_Dictionary *pFieldDict, CFX_WideStrin g &csValue, CFX_ByteString &bsEncoding)
1483 { 1483 {
1484 ASSERT(pFieldDict != NULL); 1484 ASSERT(pFieldDict != NULL);
1485 CFX_ByteString csBValue = pFieldDict->GetString("V"); 1485 CFX_ByteString csBValue = pFieldDict->GetString("V");
1486 FX_INT32 iCount = sizeof(g_fieldEncoding) / sizeof(g_fieldEncoding[0]); 1486 int32_t iCount = sizeof(g_fieldEncoding) / sizeof(g_fieldEncoding[0]);
1487 FX_INT32 i = 0; 1487 int32_t i = 0;
1488 for (; i < iCount; ++i) 1488 for (; i < iCount; ++i)
1489 if (bsEncoding == g_fieldEncoding[i].m_name) { 1489 if (bsEncoding == g_fieldEncoding[i].m_name) {
1490 break; 1490 break;
1491 } 1491 }
1492 if (i < iCount) { 1492 if (i < iCount) {
1493 CFX_CharMap *pCharMap = CFX_CharMap::GetDefaultMapper(g_fieldEncoding[i] .m_codePage); 1493 CFX_CharMap *pCharMap = CFX_CharMap::GetDefaultMapper(g_fieldEncoding[i] .m_codePage);
1494 FXSYS_assert(pCharMap != NULL); 1494 FXSYS_assert(pCharMap != NULL);
1495 csValue.ConvertFrom(csBValue, pCharMap); 1495 csValue.ConvertFrom(csBValue, pCharMap);
1496 return; 1496 return;
1497 } 1497 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 continue; 1637 continue;
1638 } 1638 }
1639 CPDF_FormControl* pControl = NULL; 1639 CPDF_FormControl* pControl = NULL;
1640 if (m_ControlMap.Lookup(pAnnotDict, (void*&)pControl)) { 1640 if (m_ControlMap.Lookup(pAnnotDict, (void*&)pControl)) {
1641 return iNewPage; 1641 return iNewPage;
1642 } 1642 }
1643 } 1643 }
1644 } while (TRUE); 1644 } while (TRUE);
1645 return -1; 1645 return -1;
1646 } 1646 }
OLDNEW
« no previous file with comments | « core/src/fpdfdoc/doc_basic.cpp ('k') | core/src/fpdfdoc/doc_link.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698