OLD | NEW |
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 CPDF_Object* pRV = FPDF_GetFieldAttr(m_pDict, "RV"); | 177 CPDF_Object* pRV = FPDF_GetFieldAttr(m_pDict, "RV"); |
178 if (!pRV && (csDValue == csValue)) { | 178 if (!pRV && (csDValue == csValue)) { |
179 return FALSE; | 179 return FALSE; |
180 } | 180 } |
181 if (bNotify && m_pForm->m_pFormNotify) { | 181 if (bNotify && m_pForm->m_pFormNotify) { |
182 int iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csDValue); | 182 int iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csDValue); |
183 if (iRet < 0) { | 183 if (iRet < 0) { |
184 return FALSE; | 184 return FALSE; |
185 } | 185 } |
186 } | 186 } |
187 if (pDV == NULL) { | 187 if (pDV) { |
188 m_pDict->RemoveAt("V"); | |
189 m_pDict->RemoveAt("RV"); | |
190 } else { | |
191 CPDF_Object* pClone = pDV->Clone(); | 188 CPDF_Object* pClone = pDV->Clone(); |
192 if (pClone == NULL) { | 189 if (!pClone) { |
193 return FALSE; | 190 return FALSE; |
194 } | 191 } |
195 m_pDict->SetAt("V", pClone); | 192 m_pDict->SetAt("V", pClone); |
196 if (pRV) { | 193 if (pRV) { |
197 CPDF_Object* pCloneR = pDV->Clone(); | 194 CPDF_Object* pCloneR = pDV->Clone(); |
198 m_pDict->SetAt("RV", pCloneR); | 195 m_pDict->SetAt("RV", pCloneR); |
199 } | 196 } |
| 197 } else { |
| 198 m_pDict->RemoveAt("V"); |
| 199 m_pDict->RemoveAt("RV"); |
200 } | 200 } |
201 if (bNotify && m_pForm->m_pFormNotify) { | 201 if (bNotify && m_pForm->m_pFormNotify) { |
202 m_pForm->m_pFormNotify->AfterValueChange(this); | 202 m_pForm->m_pFormNotify->AfterValueChange(this); |
203 } | 203 } |
204 m_pForm->m_bUpdated = TRUE; | 204 m_pForm->m_bUpdated = TRUE; |
205 } break; | 205 } break; |
206 } | 206 } |
207 return TRUE; | 207 return TRUE; |
208 } | 208 } |
209 int CPDF_FormField::GetControlIndex(const CPDF_FormControl* pControl) { | 209 int CPDF_FormField::GetControlIndex(const CPDF_FormControl* pControl) { |
(...skipping 24 matching lines...) Expand all Loading... |
234 return FIELDTYPE_TEXTFIELD; | 234 return FIELDTYPE_TEXTFIELD; |
235 case Sign: | 235 case Sign: |
236 return FIELDTYPE_SIGNATURE; | 236 return FIELDTYPE_SIGNATURE; |
237 default: | 237 default: |
238 break; | 238 break; |
239 } | 239 } |
240 return FIELDTYPE_UNKNOWN; | 240 return FIELDTYPE_UNKNOWN; |
241 } | 241 } |
242 CPDF_AAction CPDF_FormField::GetAdditionalAction() { | 242 CPDF_AAction CPDF_FormField::GetAdditionalAction() { |
243 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "AA"); | 243 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "AA"); |
244 if (pObj == NULL) { | 244 if (!pObj) { |
245 return NULL; | 245 return NULL; |
246 } | 246 } |
247 return pObj->GetDict(); | 247 return pObj->GetDict(); |
248 } | 248 } |
249 CFX_WideString CPDF_FormField::GetAlternateName() { | 249 CFX_WideString CPDF_FormField::GetAlternateName() { |
250 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "TU"); | 250 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "TU"); |
251 if (pObj == NULL) { | 251 if (!pObj) { |
252 return L""; | 252 return L""; |
253 } | 253 } |
254 return pObj->GetUnicodeText(); | 254 return pObj->GetUnicodeText(); |
255 } | 255 } |
256 CFX_WideString CPDF_FormField::GetMappingName() { | 256 CFX_WideString CPDF_FormField::GetMappingName() { |
257 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "TM"); | 257 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "TM"); |
258 if (pObj == NULL) { | 258 if (!pObj) { |
259 return L""; | 259 return L""; |
260 } | 260 } |
261 return pObj->GetUnicodeText(); | 261 return pObj->GetUnicodeText(); |
262 } | 262 } |
263 FX_DWORD CPDF_FormField::GetFieldFlags() { | 263 FX_DWORD CPDF_FormField::GetFieldFlags() { |
264 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "Ff"); | 264 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "Ff"); |
265 if (pObj == NULL) { | 265 if (!pObj) { |
266 return 0; | 266 return 0; |
267 } | 267 } |
268 return pObj->GetInteger(); | 268 return pObj->GetInteger(); |
269 } | 269 } |
270 CFX_ByteString CPDF_FormField::GetDefaultStyle() { | 270 CFX_ByteString CPDF_FormField::GetDefaultStyle() { |
271 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "DS"); | 271 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "DS"); |
272 if (pObj == NULL) { | 272 if (!pObj) { |
273 return ""; | 273 return ""; |
274 } | 274 } |
275 return pObj->GetString(); | 275 return pObj->GetString(); |
276 } | 276 } |
277 CFX_WideString CPDF_FormField::GetRichTextString() { | 277 CFX_WideString CPDF_FormField::GetRichTextString() { |
278 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "RV"); | 278 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "RV"); |
279 if (pObj == NULL) { | 279 if (!pObj) { |
280 return L""; | 280 return L""; |
281 } | 281 } |
282 return pObj->GetUnicodeText(); | 282 return pObj->GetUnicodeText(); |
283 } | 283 } |
284 CFX_WideString CPDF_FormField::GetValue(FX_BOOL bDefault) { | 284 CFX_WideString CPDF_FormField::GetValue(FX_BOOL bDefault) { |
285 if (GetType() == CheckBox || GetType() == RadioButton) { | 285 if (GetType() == CheckBox || GetType() == RadioButton) { |
286 return GetCheckValue(bDefault); | 286 return GetCheckValue(bDefault); |
287 } | 287 } |
288 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, bDefault ? "DV" : "V"); | 288 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, bDefault ? "DV" : "V"); |
289 if (pValue == NULL) { | 289 if (!pValue) { |
290 if (!bDefault) { | 290 if (!bDefault) { |
291 if (m_Type == RichText) { | 291 if (m_Type == RichText) { |
292 pValue = FPDF_GetFieldAttr(m_pDict, "V"); | 292 pValue = FPDF_GetFieldAttr(m_pDict, "V"); |
293 } | 293 } |
294 if (pValue == NULL && m_Type != Text) { | 294 if (!pValue && m_Type != Text) { |
295 pValue = FPDF_GetFieldAttr(m_pDict, "DV"); | 295 pValue = FPDF_GetFieldAttr(m_pDict, "DV"); |
296 } | 296 } |
297 } | 297 } |
298 if (pValue == NULL) { | 298 if (!pValue) { |
299 return CFX_WideString(); | 299 return CFX_WideString(); |
300 } | 300 } |
301 } | 301 } |
302 switch (pValue->GetType()) { | 302 switch (pValue->GetType()) { |
303 case PDFOBJ_STRING: | 303 case PDFOBJ_STRING: |
304 case PDFOBJ_STREAM: | 304 case PDFOBJ_STREAM: |
305 return pValue->GetUnicodeText(); | 305 return pValue->GetUnicodeText(); |
306 case PDFOBJ_ARRAY: | 306 case PDFOBJ_ARRAY: |
307 pValue = pValue->AsArray()->GetElementValue(0); | 307 pValue = pValue->AsArray()->GetElementValue(0); |
308 if (pValue) | 308 if (pValue) |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 FX_BOOL CPDF_FormField::IsItemSelected(int index) { | 500 FX_BOOL CPDF_FormField::IsItemSelected(int index) { |
501 ASSERT(GetType() == ComboBox || GetType() == ListBox); | 501 ASSERT(GetType() == ComboBox || GetType() == ListBox); |
502 if (index < 0 || index >= CountOptions()) { | 502 if (index < 0 || index >= CountOptions()) { |
503 return FALSE; | 503 return FALSE; |
504 } | 504 } |
505 if (IsOptionSelected(index)) { | 505 if (IsOptionSelected(index)) { |
506 return TRUE; | 506 return TRUE; |
507 } | 507 } |
508 CFX_WideString opt_value = GetOptionValue(index); | 508 CFX_WideString opt_value = GetOptionValue(index); |
509 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V"); | 509 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V"); |
510 if (pValue == NULL) { | 510 if (!pValue) { |
511 pValue = FPDF_GetFieldAttr(m_pDict, "I"); | 511 pValue = FPDF_GetFieldAttr(m_pDict, "I"); |
512 if (pValue == NULL) { | 512 if (!pValue) { |
513 return FALSE; | 513 return FALSE; |
514 } | 514 } |
515 } | 515 } |
516 | 516 |
517 if (pValue->IsString()) | 517 if (pValue->IsString()) |
518 return pValue->GetUnicodeText() == opt_value; | 518 return pValue->GetUnicodeText() == opt_value; |
519 | 519 |
520 if (pValue->IsNumber()) { | 520 if (pValue->IsNumber()) { |
521 if (pValue->GetString().IsEmpty()) | 521 if (pValue->GetString().IsEmpty()) |
522 return FALSE; | 522 return FALSE; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 m_pDict->RemoveAt("I"); | 592 m_pDict->RemoveAt("I"); |
593 } | 593 } |
594 } | 594 } |
595 } else { | 595 } else { |
596 if (m_Type == ListBox) { | 596 if (m_Type == ListBox) { |
597 SelectOption(index, TRUE); | 597 SelectOption(index, TRUE); |
598 if (!(m_Flags & FORMLIST_MULTISELECT)) { | 598 if (!(m_Flags & FORMLIST_MULTISELECT)) { |
599 m_pDict->SetAtString("V", PDF_EncodeText(opt_value)); | 599 m_pDict->SetAtString("V", PDF_EncodeText(opt_value)); |
600 } else { | 600 } else { |
601 CPDF_Array* pArray = CPDF_Array::Create(); | 601 CPDF_Array* pArray = CPDF_Array::Create(); |
602 if (pArray == NULL) { | 602 if (!pArray) { |
603 return FALSE; | 603 return FALSE; |
604 } | 604 } |
605 FX_BOOL bSelected; | 605 FX_BOOL bSelected; |
606 int iCount = CountOptions(); | 606 int iCount = CountOptions(); |
607 for (int i = 0; i < iCount; i++) { | 607 for (int i = 0; i < iCount; i++) { |
608 if (i != index) { | 608 if (i != index) { |
609 bSelected = IsItemSelected(i); | 609 bSelected = IsItemSelected(i); |
610 } else { | 610 } else { |
611 bSelected = TRUE; | 611 bSelected = TRUE; |
612 } | 612 } |
613 if (bSelected) { | 613 if (bSelected) { |
614 opt_value = GetOptionValue(i); | 614 opt_value = GetOptionValue(i); |
615 pArray->AddString(PDF_EncodeText(opt_value)); | 615 pArray->AddString(PDF_EncodeText(opt_value)); |
616 } | 616 } |
617 } | 617 } |
618 m_pDict->SetAt("V", pArray); | 618 m_pDict->SetAt("V", pArray); |
619 } | 619 } |
620 } else if (m_Type == ComboBox) { | 620 } else if (m_Type == ComboBox) { |
621 m_pDict->SetAtString("V", PDF_EncodeText(opt_value)); | 621 m_pDict->SetAtString("V", PDF_EncodeText(opt_value)); |
622 CPDF_Array* pI = CPDF_Array::Create(); | 622 CPDF_Array* pI = CPDF_Array::Create(); |
623 if (pI == NULL) { | 623 if (!pI) { |
624 return FALSE; | 624 return FALSE; |
625 } | 625 } |
626 pI->AddInteger(index); | 626 pI->AddInteger(index); |
627 m_pDict->SetAt("I", pI); | 627 m_pDict->SetAt("I", pI); |
628 } | 628 } |
629 } | 629 } |
630 if (bNotify && m_pForm->m_pFormNotify) { | 630 if (bNotify && m_pForm->m_pFormNotify) { |
631 if (GetType() == ListBox) { | 631 if (GetType() == ListBox) { |
632 m_pForm->m_pFormNotify->AfterSelectionChange(this); | 632 m_pForm->m_pFormNotify->AfterSelectionChange(this); |
633 } | 633 } |
(...skipping 14 matching lines...) Expand all Loading... |
648 } | 648 } |
649 int iDVIndex = GetDefaultSelectedItem(); | 649 int iDVIndex = GetDefaultSelectedItem(); |
650 if (iDVIndex < 0) { | 650 if (iDVIndex < 0) { |
651 return FALSE; | 651 return FALSE; |
652 } | 652 } |
653 return (iDVIndex == index); | 653 return (iDVIndex == index); |
654 } | 654 } |
655 int CPDF_FormField::GetDefaultSelectedItem() { | 655 int CPDF_FormField::GetDefaultSelectedItem() { |
656 ASSERT(GetType() == ComboBox || GetType() == ListBox); | 656 ASSERT(GetType() == ComboBox || GetType() == ListBox); |
657 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "DV"); | 657 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "DV"); |
658 if (pValue == NULL) { | 658 if (!pValue) { |
659 return -1; | 659 return -1; |
660 } | 660 } |
661 CFX_WideString csDV = pValue->GetUnicodeText(); | 661 CFX_WideString csDV = pValue->GetUnicodeText(); |
662 if (csDV.IsEmpty()) { | 662 if (csDV.IsEmpty()) { |
663 return -1; | 663 return -1; |
664 } | 664 } |
665 int iCount = CountOptions(); | 665 int iCount = CountOptions(); |
666 for (int i = 0; i < iCount; i++) { | 666 for (int i = 0; i < iCount; i++) { |
667 if (csDV == GetOptionValue(i)) { | 667 if (csDV == GetOptionValue(i)) { |
668 return i; | 668 return i; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 | 810 |
811 m_pForm->m_bUpdated = TRUE; | 811 m_pForm->m_bUpdated = TRUE; |
812 return TRUE; | 812 return TRUE; |
813 } | 813 } |
814 #endif // PDF_ENABLE_XFA | 814 #endif // PDF_ENABLE_XFA |
815 FX_BOOL CPDF_FormField::CheckControl(int iControlIndex, | 815 FX_BOOL CPDF_FormField::CheckControl(int iControlIndex, |
816 FX_BOOL bChecked, | 816 FX_BOOL bChecked, |
817 FX_BOOL bNotify) { | 817 FX_BOOL bNotify) { |
818 ASSERT(GetType() == CheckBox || GetType() == RadioButton); | 818 ASSERT(GetType() == CheckBox || GetType() == RadioButton); |
819 CPDF_FormControl* pControl = GetControl(iControlIndex); | 819 CPDF_FormControl* pControl = GetControl(iControlIndex); |
820 if (pControl == NULL) { | 820 if (!pControl) { |
821 return FALSE; | 821 return FALSE; |
822 } | 822 } |
823 if (!bChecked && pControl->IsChecked() == bChecked) { | 823 if (!bChecked && pControl->IsChecked() == bChecked) { |
824 return FALSE; | 824 return FALSE; |
825 } | 825 } |
826 CFX_ByteArray statusArray; | 826 CFX_ByteArray statusArray; |
827 if (bNotify && m_pForm->m_pFormNotify) { | 827 if (bNotify && m_pForm->m_pFormNotify) { |
828 SaveCheckedFieldStatus(this, statusArray); | 828 SaveCheckedFieldStatus(this, statusArray); |
829 } | 829 } |
830 CFX_WideString csWExport = pControl->GetExportValue(); | 830 CFX_WideString csWExport = pControl->GetExportValue(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 } | 922 } |
923 } | 923 } |
924 if (bNotify && m_pForm->m_pFormNotify) { | 924 if (bNotify && m_pForm->m_pFormNotify) { |
925 m_pForm->m_pFormNotify->AfterCheckedStatusChange(this, statusArray); | 925 m_pForm->m_pFormNotify->AfterCheckedStatusChange(this, statusArray); |
926 } | 926 } |
927 m_pForm->m_bUpdated = TRUE; | 927 m_pForm->m_bUpdated = TRUE; |
928 return TRUE; | 928 return TRUE; |
929 } | 929 } |
930 int CPDF_FormField::GetTopVisibleIndex() { | 930 int CPDF_FormField::GetTopVisibleIndex() { |
931 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "TI"); | 931 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "TI"); |
932 if (pObj == NULL) { | 932 if (!pObj) { |
933 return 0; | 933 return 0; |
934 } | 934 } |
935 return pObj->GetInteger(); | 935 return pObj->GetInteger(); |
936 } | 936 } |
937 int CPDF_FormField::CountSelectedOptions() { | 937 int CPDF_FormField::CountSelectedOptions() { |
938 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "I"); | 938 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "I"); |
939 if (pObj == NULL) { | 939 if (!pObj) { |
940 return 0; | 940 return 0; |
941 } | 941 } |
942 CPDF_Array* pArray = pObj->GetArray(); | 942 CPDF_Array* pArray = pObj->GetArray(); |
943 if (pArray == NULL) { | 943 if (!pArray) { |
944 return 0; | 944 return 0; |
945 } | 945 } |
946 return (int)pArray->GetCount(); | 946 return (int)pArray->GetCount(); |
947 } | 947 } |
948 int CPDF_FormField::GetSelectedOptionIndex(int index) { | 948 int CPDF_FormField::GetSelectedOptionIndex(int index) { |
949 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "I"); | 949 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "I"); |
950 if (pObj == NULL) { | 950 if (!pObj) { |
951 return -1; | 951 return -1; |
952 } | 952 } |
953 CPDF_Array* pArray = pObj->GetArray(); | 953 CPDF_Array* pArray = pObj->GetArray(); |
954 if (pArray == NULL) { | 954 if (!pArray) { |
955 return -1; | 955 return -1; |
956 } | 956 } |
957 int iCount = (int)pArray->GetCount(); | 957 int iCount = (int)pArray->GetCount(); |
958 if (iCount > 0 && index < iCount) { | 958 if (iCount > 0 && index < iCount) { |
959 return pArray->GetInteger(index); | 959 return pArray->GetInteger(index); |
960 } | 960 } |
961 return -1; | 961 return -1; |
962 } | 962 } |
963 FX_BOOL CPDF_FormField::IsOptionSelected(int iOptIndex) { | 963 FX_BOOL CPDF_FormField::IsOptionSelected(int iOptIndex) { |
964 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "I"); | 964 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "I"); |
965 if (pObj == NULL) { | 965 if (!pObj) { |
966 return FALSE; | 966 return FALSE; |
967 } | 967 } |
968 CPDF_Array* pArray = pObj->GetArray(); | 968 CPDF_Array* pArray = pObj->GetArray(); |
969 if (pArray == NULL) { | 969 if (!pArray) { |
970 return FALSE; | 970 return FALSE; |
971 } | 971 } |
972 int iCount = (int)pArray->GetCount(); | 972 int iCount = (int)pArray->GetCount(); |
973 for (int i = 0; i < iCount; i++) { | 973 for (int i = 0; i < iCount; i++) { |
974 if (pArray->GetInteger(i) == iOptIndex) { | 974 if (pArray->GetInteger(i) == iOptIndex) { |
975 return TRUE; | 975 return TRUE; |
976 } | 976 } |
977 } | 977 } |
978 return FALSE; | 978 return FALSE; |
979 } | 979 } |
980 FX_BOOL CPDF_FormField::SelectOption(int iOptIndex, | 980 FX_BOOL CPDF_FormField::SelectOption(int iOptIndex, |
981 FX_BOOL bSelected, | 981 FX_BOOL bSelected, |
982 FX_BOOL bNotify) { | 982 FX_BOOL bNotify) { |
983 CPDF_Array* pArray = m_pDict->GetArray("I"); | 983 CPDF_Array* pArray = m_pDict->GetArray("I"); |
984 if (pArray == NULL) { | 984 if (!pArray) { |
985 if (!bSelected) { | 985 if (!bSelected) { |
986 return TRUE; | 986 return TRUE; |
987 } | 987 } |
988 pArray = CPDF_Array::Create(); | 988 pArray = CPDF_Array::Create(); |
989 if (pArray == NULL) { | 989 if (!pArray) { |
990 return FALSE; | 990 return FALSE; |
991 } | 991 } |
992 m_pDict->SetAt("I", pArray); | 992 m_pDict->SetAt("I", pArray); |
993 } | 993 } |
994 FX_BOOL bReturn = FALSE; | 994 FX_BOOL bReturn = FALSE; |
995 for (int i = 0; i < (int)pArray->GetCount(); i++) { | 995 for (int i = 0; i < (int)pArray->GetCount(); i++) { |
996 int iFind = pArray->GetInteger(i); | 996 int iFind = pArray->GetInteger(i); |
997 if (iFind == iOptIndex) { | 997 if (iFind == iOptIndex) { |
998 if (bSelected) { | 998 if (bSelected) { |
999 return TRUE; | 999 return TRUE; |
(...skipping 25 matching lines...) Expand all Loading... |
1025 iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csValue); | 1025 iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csValue); |
1026 } | 1026 } |
1027 if (GetType() == ComboBox) { | 1027 if (GetType() == ComboBox) { |
1028 iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue); | 1028 iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue); |
1029 } | 1029 } |
1030 if (iRet < 0) { | 1030 if (iRet < 0) { |
1031 return FALSE; | 1031 return FALSE; |
1032 } | 1032 } |
1033 } | 1033 } |
1034 CPDF_Number* pNum = CPDF_Number::Create(iOptIndex); | 1034 CPDF_Number* pNum = CPDF_Number::Create(iOptIndex); |
1035 if (pNum == NULL) { | 1035 if (!pNum) { |
1036 return FALSE; | 1036 return FALSE; |
1037 } | 1037 } |
1038 pArray->InsertAt(i, pNum); | 1038 pArray->InsertAt(i, pNum); |
1039 bReturn = TRUE; | 1039 bReturn = TRUE; |
1040 break; | 1040 break; |
1041 } | 1041 } |
1042 } | 1042 } |
1043 if (!bReturn) { | 1043 if (!bReturn) { |
1044 if (bSelected) { | 1044 if (bSelected) { |
1045 pArray->AddInteger(iOptIndex); | 1045 pArray->AddInteger(iOptIndex); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 } | 1102 } |
1103 CPDF_SimpleParser syntax(DA); | 1103 CPDF_SimpleParser syntax(DA); |
1104 syntax.FindTagParam("Tf", 2); | 1104 syntax.FindTagParam("Tf", 2); |
1105 CFX_ByteString font_name = syntax.GetWord(); | 1105 CFX_ByteString font_name = syntax.GetWord(); |
1106 CPDF_Dictionary* pFontDict = NULL; | 1106 CPDF_Dictionary* pFontDict = NULL; |
1107 if (m_pForm->m_pFormDict && m_pForm->m_pFormDict->GetDict("DR") && | 1107 if (m_pForm->m_pFormDict && m_pForm->m_pFormDict->GetDict("DR") && |
1108 m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")) | 1108 m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")) |
1109 pFontDict = m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")->GetDict( | 1109 pFontDict = m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")->GetDict( |
1110 font_name); | 1110 font_name); |
1111 | 1111 |
1112 if (pFontDict == NULL) { | 1112 if (!pFontDict) { |
1113 return; | 1113 return; |
1114 } | 1114 } |
1115 m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict); | 1115 m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict); |
1116 m_FontSize = FX_atof(syntax.GetWord()); | 1116 m_FontSize = FX_atof(syntax.GetWord()); |
1117 } | 1117 } |
OLD | NEW |