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

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

Issue 1644633003: Member function name refactoring (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 10 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_formcontrol.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 "core/include/fpdfdoc/fpdf_doc.h" 7 #include "core/include/fpdfdoc/fpdf_doc.h"
8 #include "doc_utils.h" 8 #include "doc_utils.h"
9 9
10 FX_BOOL PDF_FormField_IsUnison(CPDF_FormField* pField) { 10 FX_BOOL PDF_FormField_IsUnison(CPDF_FormField* pField) {
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 if (CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "MaxLen")) 401 if (CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "MaxLen"))
402 return pObj->GetInteger(); 402 return pObj->GetInteger();
403 403
404 for (int i = 0; i < m_ControlList.GetSize(); i++) { 404 for (int i = 0; i < m_ControlList.GetSize(); i++) {
405 CPDF_FormControl* pControl = m_ControlList.GetAt(i); 405 CPDF_FormControl* pControl = m_ControlList.GetAt(i);
406 if (!pControl) 406 if (!pControl)
407 continue; 407 continue;
408 408
409 CPDF_Dictionary* pWidgetDict = pControl->m_pWidgetDict; 409 CPDF_Dictionary* pWidgetDict = pControl->m_pWidgetDict;
410 if (pWidgetDict->KeyExist("MaxLen")) 410 if (pWidgetDict->KeyExist("MaxLen"))
411 return pWidgetDict->GetInteger("MaxLen"); 411 return pWidgetDict->GetIntegerBy("MaxLen");
412 } 412 }
413 return 0; 413 return 0;
414 } 414 }
415 int CPDF_FormField::CountSelectedItems() { 415 int CPDF_FormField::CountSelectedItems() {
416 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V"); 416 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
417 if (!pValue) { 417 if (!pValue) {
418 pValue = FPDF_GetFieldAttr(m_pDict, "I"); 418 pValue = FPDF_GetFieldAttr(m_pDict, "I");
419 if (!pValue) 419 if (!pValue)
420 return 0; 420 return 0;
421 } 421 }
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "I"); 866 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "I");
867 if (!pObj) { 867 if (!pObj) {
868 return -1; 868 return -1;
869 } 869 }
870 CPDF_Array* pArray = pObj->GetArray(); 870 CPDF_Array* pArray = pObj->GetArray();
871 if (!pArray) { 871 if (!pArray) {
872 return -1; 872 return -1;
873 } 873 }
874 int iCount = (int)pArray->GetCount(); 874 int iCount = (int)pArray->GetCount();
875 if (iCount > 0 && index < iCount) { 875 if (iCount > 0 && index < iCount) {
876 return pArray->GetInteger(index); 876 return pArray->GetIntegerAt(index);
877 } 877 }
878 return -1; 878 return -1;
879 } 879 }
880 FX_BOOL CPDF_FormField::IsOptionSelected(int iOptIndex) { 880 FX_BOOL CPDF_FormField::IsOptionSelected(int iOptIndex) {
881 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "I"); 881 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "I");
882 if (!pObj) { 882 if (!pObj) {
883 return FALSE; 883 return FALSE;
884 } 884 }
885 CPDF_Array* pArray = pObj->GetArray(); 885 CPDF_Array* pArray = pObj->GetArray();
886 if (!pArray) { 886 if (!pArray) {
887 return FALSE; 887 return FALSE;
888 } 888 }
889 int iCount = (int)pArray->GetCount(); 889 int iCount = (int)pArray->GetCount();
890 for (int i = 0; i < iCount; i++) { 890 for (int i = 0; i < iCount; i++) {
891 if (pArray->GetInteger(i) == iOptIndex) { 891 if (pArray->GetIntegerAt(i) == iOptIndex) {
892 return TRUE; 892 return TRUE;
893 } 893 }
894 } 894 }
895 return FALSE; 895 return FALSE;
896 } 896 }
897 FX_BOOL CPDF_FormField::SelectOption(int iOptIndex, 897 FX_BOOL CPDF_FormField::SelectOption(int iOptIndex,
898 FX_BOOL bSelected, 898 FX_BOOL bSelected,
899 FX_BOOL bNotify) { 899 FX_BOOL bNotify) {
900 CPDF_Array* pArray = m_pDict->GetArray("I"); 900 CPDF_Array* pArray = m_pDict->GetArrayBy("I");
901 if (!pArray) { 901 if (!pArray) {
902 if (!bSelected) { 902 if (!bSelected) {
903 return TRUE; 903 return TRUE;
904 } 904 }
905 pArray = new CPDF_Array; 905 pArray = new CPDF_Array;
906 m_pDict->SetAt("I", pArray); 906 m_pDict->SetAt("I", pArray);
907 } 907 }
908 FX_BOOL bReturn = FALSE; 908 FX_BOOL bReturn = FALSE;
909 for (int i = 0; i < (int)pArray->GetCount(); i++) { 909 for (int i = 0; i < (int)pArray->GetCount(); i++) {
910 int iFind = pArray->GetInteger(i); 910 int iFind = pArray->GetIntegerAt(i);
911 if (iFind == iOptIndex) { 911 if (iFind == iOptIndex) {
912 if (bSelected) { 912 if (bSelected) {
913 return TRUE; 913 return TRUE;
914 } 914 }
915 if (bNotify && m_pForm->m_pFormNotify) { 915 if (bNotify && m_pForm->m_pFormNotify) {
916 int iRet = 0; 916 int iRet = 0;
917 CFX_WideString csValue = GetOptionLabel(iOptIndex); 917 CFX_WideString csValue = GetOptionLabel(iOptIndex);
918 if (GetType() == ListBox) { 918 if (GetType() == ListBox) {
919 iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csValue); 919 iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csValue);
920 } 920 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 } 999 }
1000 m_pForm->m_bUpdated = TRUE; 1000 m_pForm->m_bUpdated = TRUE;
1001 return TRUE; 1001 return TRUE;
1002 } 1002 }
1003 void CPDF_FormField::LoadDA() { 1003 void CPDF_FormField::LoadDA() {
1004 CFX_ByteString DA; 1004 CFX_ByteString DA;
1005 if (CPDF_Object* pObj_t = FPDF_GetFieldAttr(m_pDict, "DA")) { 1005 if (CPDF_Object* pObj_t = FPDF_GetFieldAttr(m_pDict, "DA")) {
1006 DA = pObj_t->GetString(); 1006 DA = pObj_t->GetString();
1007 } 1007 }
1008 if (DA.IsEmpty() && m_pForm->m_pFormDict) { 1008 if (DA.IsEmpty() && m_pForm->m_pFormDict) {
1009 DA = m_pForm->m_pFormDict->GetString("DA"); 1009 DA = m_pForm->m_pFormDict->GetStringBy("DA");
1010 } 1010 }
1011 if (DA.IsEmpty()) { 1011 if (DA.IsEmpty()) {
1012 return; 1012 return;
1013 } 1013 }
1014 CPDF_SimpleParser syntax(DA); 1014 CPDF_SimpleParser syntax(DA);
1015 syntax.FindTagParam("Tf", 2); 1015 syntax.FindTagParam("Tf", 2);
1016 CFX_ByteString font_name = syntax.GetWord(); 1016 CFX_ByteString font_name = syntax.GetWord();
1017 CPDF_Dictionary* pFontDict = NULL; 1017 CPDF_Dictionary* pFontDict = NULL;
1018 if (m_pForm->m_pFormDict && m_pForm->m_pFormDict->GetDict("DR") && 1018 if (m_pForm->m_pFormDict && m_pForm->m_pFormDict->GetDictBy("DR") &&
1019 m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")) 1019 m_pForm->m_pFormDict->GetDictBy("DR")->GetDictBy("Font"))
1020 pFontDict = m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")->GetDict( 1020 pFontDict = m_pForm->m_pFormDict->GetDictBy("DR")
1021 font_name); 1021 ->GetDictBy("Font")
1022 ->GetDictBy(font_name);
1022 1023
1023 if (!pFontDict) { 1024 if (!pFontDict) {
1024 return; 1025 return;
1025 } 1026 }
1026 m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict); 1027 m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict);
1027 m_FontSize = FX_atof(syntax.GetWord()); 1028 m_FontSize = FX_atof(syntax.GetWord());
1028 } 1029 }
OLDNEW
« no previous file with comments | « core/src/fpdfdoc/doc_formcontrol.cpp ('k') | core/src/fpdfdoc/doc_link.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698