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

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

Issue 1177483002: Use stdint.h types throughout PDFium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 PDF_FONTDATA fd; 366 PDF_FONTDATA fd;
367 memset(&fd, 0, sizeof(PDF_FONTDATA)); 367 memset(&fd, 0, sizeof(PDF_FONTDATA));
368 HDC hDC = ::GetDC(NULL); 368 HDC hDC = ::GetDC(NULL);
369 EnumFontFamiliesExA(hDC, &lf, (FONTENUMPROCA)EnumFontFamExProc, (LPARAM)&fd, 0); 369 EnumFontFamiliesExA(hDC, &lf, (FONTENUMPROCA)EnumFontFamExProc, (LPARAM)&fd, 0);
370 ::ReleaseDC(NULL, hDC); 370 ::ReleaseDC(NULL, hDC);
371 if (fd.bFind) { 371 if (fd.bFind) {
372 memcpy(&lf, &fd.lf, sizeof(LOGFONTA)); 372 memcpy(&lf, &fd.lf, sizeof(LOGFONTA));
373 } 373 }
374 return fd.bFind; 374 return fd.bFind;
375 } 375 }
376 static FX_BOOL RetrieveSpecificFont(FX_BYTE charSet, FX_BYTE pitchAndFamily, LPC STR pcsFontName, LOGFONTA& lf) 376 static FX_BOOL RetrieveSpecificFont(uint8_t charSet, uint8_t pitchAndFamily, LPC STR pcsFontName, LOGFONTA& lf)
377 { 377 {
378 memset(&lf, 0, sizeof(LOGFONTA)); 378 memset(&lf, 0, sizeof(LOGFONTA));
379 lf.lfCharSet = charSet; 379 lf.lfCharSet = charSet;
380 lf.lfPitchAndFamily = pitchAndFamily; 380 lf.lfPitchAndFamily = pitchAndFamily;
381 if (pcsFontName != NULL) { 381 if (pcsFontName != NULL) {
382 strcpy(lf.lfFaceName, pcsFontName); 382 strcpy(lf.lfFaceName, pcsFontName);
383 } 383 }
384 return RetrieveSpecificFont(lf); 384 return RetrieveSpecificFont(lf);
385 } 385 }
386 static FX_BOOL RetrieveStockFont(int iFontObject, FX_BYTE charSet, LOGFONTA& lf) 386 static FX_BOOL RetrieveStockFont(int iFontObject, uint8_t charSet, LOGFONTA& lf)
387 { 387 {
388 HFONT hFont = (HFONT)::GetStockObject(iFontObject); 388 HFONT hFont = (HFONT)::GetStockObject(iFontObject);
389 if (hFont != NULL) { 389 if (hFont != NULL) {
390 memset(&lf, 0, sizeof(LOGFONTA)); 390 memset(&lf, 0, sizeof(LOGFONTA));
391 int iRet = ::GetObject(hFont, sizeof(LOGFONTA), &lf); 391 int iRet = ::GetObject(hFont, sizeof(LOGFONTA), &lf);
392 if (iRet > 0 && (lf.lfCharSet == charSet || charSet == 255)) { 392 if (iRet > 0 && (lf.lfCharSet == charSet || charSet == 255)) {
393 return RetrieveSpecificFont(lf); 393 return RetrieveSpecificFont(lf);
394 } 394 }
395 } 395 }
396 return FALSE; 396 return FALSE;
(...skipping 11 matching lines...) Expand all
408 bRet = RetrieveStockFont(DEFAULT_GUI_FONT, 255, lf); 408 bRet = RetrieveStockFont(DEFAULT_GUI_FONT, 255, lf);
409 if (!bRet) { 409 if (!bRet) {
410 bRet = RetrieveStockFont(SYSTEM_FONT, 255, lf); 410 bRet = RetrieveStockFont(SYSTEM_FONT, 255, lf);
411 } 411 }
412 if (bRet) { 412 if (bRet) {
413 pFont = ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, FALSE, TRUE); 413 pFont = ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, FALSE, TRUE);
414 } 414 }
415 #endif 415 #endif
416 return pFont; 416 return pFont;
417 } 417 }
418 CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_Byt eString csFontName, FX_BYTE iCharSet) 418 CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_Byt eString csFontName, uint8_t iCharSet)
419 { 419 {
420 if (pDocument == NULL || csFontName.IsEmpty()) { 420 if (pDocument == NULL || csFontName.IsEmpty()) {
421 return NULL; 421 return NULL;
422 } 422 }
423 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 423 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
424 if (iCharSet == 1) { 424 if (iCharSet == 1) {
425 iCharSet = GetNativeCharSet(); 425 iCharSet = GetNativeCharSet();
426 } 426 }
427 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()); 427 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());
428 if (hFont != NULL) { 428 if (hFont != NULL) {
429 LOGFONTA lf; 429 LOGFONTA lf;
430 memset(&lf, 0, sizeof(LOGFONTA)); 430 memset(&lf, 0, sizeof(LOGFONTA));
431 ::GetObjectA(hFont, sizeof(LOGFONTA), &lf); 431 ::GetObjectA(hFont, sizeof(LOGFONTA), &lf);
432 ::DeleteObject(hFont); 432 ::DeleteObject(hFont);
433 if (strlen(lf.lfFaceName) > 0) { 433 if (strlen(lf.lfFaceName) > 0) {
434 return ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, FALSE, TRUE) ; 434 return ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, FALSE, TRUE) ;
435 } 435 }
436 } 436 }
437 #endif 437 #endif
438 return NULL; 438 return NULL;
439 } 439 }
440 CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_Wid eString csFontName, FX_BYTE iCharSet) 440 CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_Wid eString csFontName, uint8_t iCharSet)
441 { 441 {
442 if (pDocument == NULL || csFontName.IsEmpty()) { 442 if (pDocument == NULL || csFontName.IsEmpty()) {
443 return NULL; 443 return NULL;
444 } 444 }
445 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 445 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
446 if (iCharSet == 1) { 446 if (iCharSet == 1) {
447 iCharSet = GetNativeCharSet(); 447 iCharSet = GetNativeCharSet();
448 } 448 }
449 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()); 449 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());
450 if (hFont != NULL) { 450 if (hFont != NULL) {
(...skipping 15 matching lines...) Expand all
466 } 466 }
467 CPDF_Font* pFont = NULL; 467 CPDF_Font* pFont = NULL;
468 if (csFontName == "ZapfDingbats") { 468 if (csFontName == "ZapfDingbats") {
469 pFont = ((CPDF_Document*)pDocument)->AddStandardFont(csFontName, NULL); 469 pFont = ((CPDF_Document*)pDocument)->AddStandardFont(csFontName, NULL);
470 } else { 470 } else {
471 CPDF_FontEncoding encoding(PDFFONT_ENCODING_WINANSI); 471 CPDF_FontEncoding encoding(PDFFONT_ENCODING_WINANSI);
472 pFont = ((CPDF_Document*)pDocument)->AddStandardFont(csFontName, &encodi ng); 472 pFont = ((CPDF_Document*)pDocument)->AddStandardFont(csFontName, &encodi ng);
473 } 473 }
474 return pFont; 474 return pFont;
475 } 475 }
476 CFX_ByteString CPDF_InterForm::GetNativeFont(FX_BYTE charSet, FX_LPVOID pLogFont ) 476 CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, FX_LPVOID pLogFont )
477 { 477 {
478 CFX_ByteString csFontName; 478 CFX_ByteString csFontName;
479 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 479 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
480 LOGFONTA lf; 480 LOGFONTA lf;
481 FX_BOOL bRet; 481 FX_BOOL bRet;
482 if (charSet == ANSI_CHARSET) { 482 if (charSet == ANSI_CHARSET) {
483 csFontName = "Helvetica"; 483 csFontName = "Helvetica";
484 return csFontName; 484 return csFontName;
485 } 485 }
486 bRet = FALSE; 486 bRet = FALSE;
(...skipping 19 matching lines...) Expand all
506 } 506 }
507 csFontName = lf.lfFaceName; 507 csFontName = lf.lfFaceName;
508 return csFontName; 508 return csFontName;
509 } 509 }
510 #endif 510 #endif
511 return csFontName; 511 return csFontName;
512 } 512 }
513 CFX_ByteString CPDF_InterForm::GetNativeFont(FX_LPVOID pLogFont) 513 CFX_ByteString CPDF_InterForm::GetNativeFont(FX_LPVOID pLogFont)
514 { 514 {
515 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 515 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
516 FX_BYTE charSet = GetNativeCharSet(); 516 uint8_t charSet = GetNativeCharSet();
517 return GetNativeFont(charSet, pLogFont); 517 return GetNativeFont(charSet, pLogFont);
518 #else 518 #else
519 return CFX_ByteString(); 519 return CFX_ByteString();
520 #endif 520 #endif
521 } 521 }
522 FX_BYTE CPDF_InterForm::GetNativeCharSet() 522 uint8_t CPDF_InterForm::GetNativeCharSet()
523 { 523 {
524 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 524 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
525 FX_BYTE charSet = ANSI_CHARSET; 525 uint8_t charSet = ANSI_CHARSET;
526 UINT iCodePage = ::GetACP(); 526 UINT iCodePage = ::GetACP();
527 switch (iCodePage) { 527 switch (iCodePage) {
528 case 932: 528 case 932:
529 charSet = SHIFTJIS_CHARSET; 529 charSet = SHIFTJIS_CHARSET;
530 break; 530 break;
531 case 936: 531 case 936:
532 charSet = GB2312_CHARSET; 532 charSet = GB2312_CHARSET;
533 break; 533 break;
534 case 950: 534 case 950:
535 charSet = CHINESEBIG5_CHARSET; 535 charSet = CHINESEBIG5_CHARSET;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 break; 572 break;
573 case 1361: 573 case 1361:
574 charSet = JOHAB_CHARSET; 574 charSet = JOHAB_CHARSET;
575 break; 575 break;
576 } 576 }
577 return charSet; 577 return charSet;
578 #else 578 #else
579 return 0; 579 return 0;
580 #endif 580 #endif
581 } 581 }
582 CPDF_Font* CPDF_InterForm::AddNativeFont(FX_BYTE charSet, const CPDF_Document* p Document) 582 CPDF_Font* CPDF_InterForm::AddNativeFont(uint8_t charSet, const CPDF_Document* p Document)
583 { 583 {
584 if (pDocument == NULL) { 584 if (pDocument == NULL) {
585 return NULL; 585 return NULL;
586 } 586 }
587 CPDF_Font* pFont = NULL; 587 CPDF_Font* pFont = NULL;
588 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 588 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
589 LOGFONTA lf; 589 LOGFONTA lf;
590 CFX_ByteString csFontName = GetNativeFont(charSet, &lf); 590 CFX_ByteString csFontName = GetNativeFont(charSet, &lf);
591 if (!csFontName.IsEmpty()) { 591 if (!csFontName.IsEmpty()) {
592 if (csFontName == "Helvetica") { 592 if (csFontName == "Helvetica") {
593 pFont = AddStandardFont(pDocument, csFontName); 593 pFont = AddStandardFont(pDocument, csFontName);
594 } else { 594 } else {
595 pFont = ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, FALSE, TRUE ); 595 pFont = ((CPDF_Document*)pDocument)->AddWindowsFont(&lf, FALSE, TRUE );
596 } 596 }
597 } 597 }
598 #endif 598 #endif
599 return pFont; 599 return pFont;
600 } 600 }
601 CPDF_Font* CPDF_InterForm::AddNativeFont(const CPDF_Document* pDocument) 601 CPDF_Font* CPDF_InterForm::AddNativeFont(const CPDF_Document* pDocument)
602 { 602 {
603 if (pDocument == NULL) { 603 if (pDocument == NULL) {
604 return NULL; 604 return NULL;
605 } 605 }
606 CPDF_Font* pFont = NULL; 606 CPDF_Font* pFont = NULL;
607 FX_BYTE charSet = GetNativeCharSet(); 607 uint8_t charSet = GetNativeCharSet();
608 pFont = AddNativeFont(charSet, pDocument); 608 pFont = AddNativeFont(charSet, pDocument);
609 return pFont; 609 return pFont;
610 } 610 }
611 FX_BOOL CPDF_InterForm::ValidateFieldName(CFX_WideString& csNewFieldName, int iT ype, const CPDF_FormField* pExcludedField, const CPDF_FormControl* pExcludedCont rol) 611 FX_BOOL CPDF_InterForm::ValidateFieldName(CFX_WideString& csNewFieldName, int iT ype, const CPDF_FormField* pExcludedField, const CPDF_FormControl* pExcludedCont rol)
612 { 612 {
613 if (csNewFieldName.IsEmpty()) { 613 if (csNewFieldName.IsEmpty()) {
614 return FALSE; 614 return FALSE;
615 } 615 }
616 int iPos = 0; 616 int iPos = 0;
617 int iLength = csNewFieldName.GetLength(); 617 int iLength = csNewFieldName.GetLength();
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 return GetInterFormFont(m_pFormDict, m_pDocument, index, csNameTag); 1076 return GetInterFormFont(m_pFormDict, m_pDocument, index, csNameTag);
1077 } 1077 }
1078 CPDF_Font* CPDF_InterForm::GetFormFont(CFX_ByteString csNameTag) 1078 CPDF_Font* CPDF_InterForm::GetFormFont(CFX_ByteString csNameTag)
1079 { 1079 {
1080 return GetInterFormFont(m_pFormDict, m_pDocument, csNameTag); 1080 return GetInterFormFont(m_pFormDict, m_pDocument, csNameTag);
1081 } 1081 }
1082 CPDF_Font* CPDF_InterForm::GetFormFont(CFX_ByteString csFontName, CFX_ByteString & csNameTag) 1082 CPDF_Font* CPDF_InterForm::GetFormFont(CFX_ByteString csFontName, CFX_ByteString & csNameTag)
1083 { 1083 {
1084 return GetInterFormFont(m_pFormDict, m_pDocument, csFontName, csNameTag); 1084 return GetInterFormFont(m_pFormDict, m_pDocument, csFontName, csNameTag);
1085 } 1085 }
1086 CPDF_Font* CPDF_InterForm::GetNativeFormFont(FX_BYTE charSet, CFX_ByteString& cs NameTag) 1086 CPDF_Font* CPDF_InterForm::GetNativeFormFont(uint8_t charSet, CFX_ByteString& cs NameTag)
1087 { 1087 {
1088 return GetNativeInterFormFont(m_pFormDict, m_pDocument, charSet, csNameTag); 1088 return GetNativeInterFormFont(m_pFormDict, m_pDocument, charSet, csNameTag);
1089 } 1089 }
1090 CPDF_Font* CPDF_InterForm::GetNativeFormFont(CFX_ByteString& csNameTag) 1090 CPDF_Font* CPDF_InterForm::GetNativeFormFont(CFX_ByteString& csNameTag)
1091 { 1091 {
1092 return GetNativeInterFormFont(m_pFormDict, m_pDocument, csNameTag); 1092 return GetNativeInterFormFont(m_pFormDict, m_pDocument, csNameTag);
1093 } 1093 }
1094 FX_BOOL CPDF_InterForm::FindFormFont(const CPDF_Font* pFont, CFX_ByteString& csN ameTag) 1094 FX_BOOL CPDF_InterForm::FindFormFont(const CPDF_Font* pFont, CFX_ByteString& csN ameTag)
1095 { 1095 {
1096 return FindInterFormFont(m_pFormDict, pFont, csNameTag); 1096 return FindInterFormFont(m_pFormDict, pFont, csNameTag);
1097 } 1097 }
1098 FX_BOOL CPDF_InterForm::FindFormFont(CFX_ByteString csFontName, CPDF_Font*& pFon t, CFX_ByteString& csNameTag) 1098 FX_BOOL CPDF_InterForm::FindFormFont(CFX_ByteString csFontName, CPDF_Font*& pFon t, CFX_ByteString& csNameTag)
1099 { 1099 {
1100 return FindInterFormFont(m_pFormDict, m_pDocument, csFontName, pFont, csName Tag); 1100 return FindInterFormFont(m_pFormDict, m_pDocument, csFontName, pFont, csName Tag);
1101 } 1101 }
1102 void CPDF_InterForm::AddFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameT ag) 1102 void CPDF_InterForm::AddFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameT ag)
1103 { 1103 {
1104 AddInterFormFont(m_pFormDict, m_pDocument, pFont, csNameTag); 1104 AddInterFormFont(m_pFormDict, m_pDocument, pFont, csNameTag);
1105 m_bUpdated = TRUE; 1105 m_bUpdated = TRUE;
1106 } 1106 }
1107 CPDF_Font* CPDF_InterForm::AddNativeFormFont(FX_BYTE charSet, CFX_ByteString& cs NameTag) 1107 CPDF_Font* CPDF_InterForm::AddNativeFormFont(uint8_t charSet, CFX_ByteString& cs NameTag)
1108 { 1108 {
1109 m_bUpdated = TRUE; 1109 m_bUpdated = TRUE;
1110 return AddNativeInterFormFont(m_pFormDict, m_pDocument, charSet, csNameTag); 1110 return AddNativeInterFormFont(m_pFormDict, m_pDocument, charSet, csNameTag);
1111 } 1111 }
1112 CPDF_Font* CPDF_InterForm::AddNativeFormFont(CFX_ByteString& csNameTag) 1112 CPDF_Font* CPDF_InterForm::AddNativeFormFont(CFX_ByteString& csNameTag)
1113 { 1113 {
1114 m_bUpdated = TRUE; 1114 m_bUpdated = TRUE;
1115 return AddNativeInterFormFont(m_pFormDict, m_pDocument, csNameTag); 1115 return AddNativeInterFormFont(m_pFormDict, m_pDocument, csNameTag);
1116 } 1116 }
1117 void CPDF_InterForm::RemoveFormFont(const CPDF_Font* pFont) 1117 void CPDF_InterForm::RemoveFormFont(const CPDF_Font* pFont)
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 return pControl; 1356 return pControl;
1357 } 1357 }
1358 CPDF_FormField* CPDF_InterForm::CheckRequiredFields(const CFX_PtrArray *fields, FX_BOOL bIncludeOrExclude) const 1358 CPDF_FormField* CPDF_InterForm::CheckRequiredFields(const CFX_PtrArray *fields, FX_BOOL bIncludeOrExclude) const
1359 { 1359 {
1360 int nCount = m_pFieldTree->m_Root.CountFields(); 1360 int nCount = m_pFieldTree->m_Root.CountFields();
1361 for (int i = 0; i < nCount; i++) { 1361 for (int i = 0; i < nCount; i++) {
1362 CPDF_FormField* pField = m_pFieldTree->m_Root.GetField(i); 1362 CPDF_FormField* pField = m_pFieldTree->m_Root.GetField(i);
1363 if (pField == NULL) { 1363 if (pField == NULL) {
1364 continue; 1364 continue;
1365 } 1365 }
1366 FX_INT32 iType = pField->GetType(); 1366 int32_t iType = pField->GetType();
1367 if (iType == CPDF_FormField::PushButton || iType == CPDF_FormField::Chec kBox || iType == CPDF_FormField::ListBox) { 1367 if (iType == CPDF_FormField::PushButton || iType == CPDF_FormField::Chec kBox || iType == CPDF_FormField::ListBox) {
1368 continue; 1368 continue;
1369 } 1369 }
1370 FX_DWORD dwFlags = pField->GetFieldFlags(); 1370 FX_DWORD dwFlags = pField->GetFieldFlags();
1371 if (dwFlags & 0x04) { 1371 if (dwFlags & 0x04) {
1372 continue; 1372 continue;
1373 } 1373 }
1374 FX_BOOL bFind = TRUE; 1374 FX_BOOL bFind = TRUE;
1375 if (fields != NULL) { 1375 if (fields != NULL) {
1376 bFind = fields->Find(pField, 0) >= 0; 1376 bFind = fields->Find(pField, 0) >= 0;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 pFieldDict->SetAt("V", pV->Clone(TRUE)); 1459 pFieldDict->SetAt("V", pV->Clone(TRUE));
1460 } 1460 }
1461 } 1461 }
1462 pFields->Add(pFieldDict); 1462 pFields->Add(pFieldDict);
1463 } 1463 }
1464 } 1464 }
1465 return pDoc; 1465 return pDoc;
1466 } 1466 }
1467 const struct _SupportFieldEncoding { 1467 const struct _SupportFieldEncoding {
1468 FX_LPCSTR m_name; 1468 FX_LPCSTR m_name;
1469 FX_INT32 m_codePage; 1469 int32_t m_codePage;
1470 } g_fieldEncoding[] = { 1470 } g_fieldEncoding[] = {
1471 { "BigFive", 950 }, 1471 { "BigFive", 950 },
1472 { "GBK", 936 }, 1472 { "GBK", 936 },
1473 { "Shift-JIS", 932 }, 1473 { "Shift-JIS", 932 },
1474 { "UHC", 949 }, 1474 { "UHC", 949 },
1475 }; 1475 };
1476 static void FPDFDOC_FDF_GetFieldValue(CPDF_Dictionary *pFieldDict, CFX_WideStrin g &csValue, CFX_ByteString &bsEncoding) 1476 static void FPDFDOC_FDF_GetFieldValue(CPDF_Dictionary *pFieldDict, CFX_WideStrin g &csValue, CFX_ByteString &bsEncoding)
1477 { 1477 {
1478 ASSERT(pFieldDict != NULL); 1478 ASSERT(pFieldDict != NULL);
1479 CFX_ByteString csBValue = pFieldDict->GetString("V"); 1479 CFX_ByteString csBValue = pFieldDict->GetString("V");
1480 FX_INT32 iCount = sizeof(g_fieldEncoding) / sizeof(g_fieldEncoding[0]); 1480 int32_t iCount = sizeof(g_fieldEncoding) / sizeof(g_fieldEncoding[0]);
1481 FX_INT32 i = 0; 1481 int32_t i = 0;
1482 for (; i < iCount; ++i) 1482 for (; i < iCount; ++i)
1483 if (bsEncoding == g_fieldEncoding[i].m_name) { 1483 if (bsEncoding == g_fieldEncoding[i].m_name) {
1484 break; 1484 break;
1485 } 1485 }
1486 if (i < iCount) { 1486 if (i < iCount) {
1487 CFX_CharMap *pCharMap = CFX_CharMap::GetDefaultMapper(g_fieldEncoding[i] .m_codePage); 1487 CFX_CharMap *pCharMap = CFX_CharMap::GetDefaultMapper(g_fieldEncoding[i] .m_codePage);
1488 FXSYS_assert(pCharMap != NULL); 1488 FXSYS_assert(pCharMap != NULL);
1489 csValue.ConvertFrom(csBValue, pCharMap); 1489 csValue.ConvertFrom(csBValue, pCharMap);
1490 return; 1490 return;
1491 } 1491 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 continue; 1631 continue;
1632 } 1632 }
1633 CPDF_FormControl* pControl = NULL; 1633 CPDF_FormControl* pControl = NULL;
1634 if (m_ControlMap.Lookup(pAnnotDict, (void*&)pControl)) { 1634 if (m_ControlMap.Lookup(pAnnotDict, (void*&)pControl)) {
1635 return iNewPage; 1635 return iNewPage;
1636 } 1636 }
1637 } 1637 }
1638 } while (TRUE); 1638 } while (TRUE);
1639 return -1; 1639 return -1;
1640 } 1640 }
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