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 "fpdfsdk/javascript/Field.h" | 7 #include "fpdfsdk/javascript/Field.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 const CFX_WideString& csFieldName) const { | 206 const CFX_WideString& csFieldName) const { |
207 return Field::GetFormFields(m_pDocument, csFieldName); | 207 return Field::GetFormFields(m_pDocument, csFieldName); |
208 } | 208 } |
209 | 209 |
210 void Field::UpdateFormField(CPDFSDK_Document* pDocument, | 210 void Field::UpdateFormField(CPDFSDK_Document* pDocument, |
211 CPDF_FormField* pFormField, | 211 CPDF_FormField* pFormField, |
212 FX_BOOL bChangeMark, | 212 FX_BOOL bChangeMark, |
213 FX_BOOL bResetAP, | 213 FX_BOOL bResetAP, |
214 FX_BOOL bRefresh) { | 214 FX_BOOL bRefresh) { |
215 std::vector<CPDFSDK_Widget*> widgets; | 215 std::vector<CPDFSDK_Widget*> widgets; |
216 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); | 216 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); |
217 pInterForm->GetWidgets(pFormField, &widgets); | 217 pInterForm->GetWidgets(pFormField, &widgets); |
218 | 218 |
219 if (bResetAP) { | 219 if (bResetAP) { |
220 int nFieldType = pFormField->GetFieldType(); | 220 int nFieldType = pFormField->GetFieldType(); |
221 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXTFIELD) { | 221 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXTFIELD) { |
222 for (CPDFSDK_Widget* pWidget : widgets) { | 222 for (CPDFSDK_Widget* pWidget : widgets) { |
223 FX_BOOL bFormatted = FALSE; | 223 FX_BOOL bFormatted = FALSE; |
224 CFX_WideString sValue = pWidget->OnFormat(bFormatted); | 224 CFX_WideString sValue = pWidget->OnFormat(bFormatted); |
225 pWidget->ResetAppearance(bFormatted ? sValue.c_str() : nullptr, FALSE); | 225 pWidget->ResetAppearance(bFormatted ? sValue.c_str() : nullptr, FALSE); |
226 } | 226 } |
(...skipping 15 matching lines...) Expand all Loading... |
242 pDocument->SetChangeMark(); | 242 pDocument->SetChangeMark(); |
243 } | 243 } |
244 | 244 |
245 void Field::UpdateFormControl(CPDFSDK_Document* pDocument, | 245 void Field::UpdateFormControl(CPDFSDK_Document* pDocument, |
246 CPDF_FormControl* pFormControl, | 246 CPDF_FormControl* pFormControl, |
247 FX_BOOL bChangeMark, | 247 FX_BOOL bChangeMark, |
248 FX_BOOL bResetAP, | 248 FX_BOOL bResetAP, |
249 FX_BOOL bRefresh) { | 249 FX_BOOL bRefresh) { |
250 ASSERT(pFormControl); | 250 ASSERT(pFormControl); |
251 | 251 |
252 CPDFSDK_InterForm* pForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); | 252 CPDFSDK_InterForm* pForm = pDocument->GetInterForm(); |
253 CPDFSDK_Widget* pWidget = pForm->GetWidget(pFormControl); | 253 CPDFSDK_Widget* pWidget = pForm->GetWidget(pFormControl); |
254 | 254 |
255 if (pWidget) { | 255 if (pWidget) { |
256 if (bResetAP) { | 256 if (bResetAP) { |
257 int nFieldType = pWidget->GetFieldType(); | 257 int nFieldType = pWidget->GetFieldType(); |
258 if (nFieldType == FIELDTYPE_COMBOBOX || | 258 if (nFieldType == FIELDTYPE_COMBOBOX || |
259 nFieldType == FIELDTYPE_TEXTFIELD) { | 259 nFieldType == FIELDTYPE_TEXTFIELD) { |
260 FX_BOOL bFormated = FALSE; | 260 FX_BOOL bFormated = FALSE; |
261 CFX_WideString sValue = pWidget->OnFormat(bFormated); | 261 CFX_WideString sValue = pWidget->OnFormat(bFormated); |
262 if (bFormated) | 262 if (bFormated) |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 } else { | 1186 } else { |
1187 Field::SetDisplay(m_pDocument, m_FieldName, m_nFormControlIndex, nVP); | 1187 Field::SetDisplay(m_pDocument, m_FieldName, m_nFormControlIndex, nVP); |
1188 } | 1188 } |
1189 } else { | 1189 } else { |
1190 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); | 1190 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); |
1191 if (FieldArray.empty()) | 1191 if (FieldArray.empty()) |
1192 return FALSE; | 1192 return FALSE; |
1193 | 1193 |
1194 CPDF_FormField* pFormField = FieldArray[0]; | 1194 CPDF_FormField* pFormField = FieldArray[0]; |
1195 ASSERT(pFormField); | 1195 ASSERT(pFormField); |
1196 CPDFSDK_InterForm* pInterForm = | 1196 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); |
1197 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); | |
1198 CPDFSDK_Widget* pWidget = | 1197 CPDFSDK_Widget* pWidget = |
1199 pInterForm->GetWidget(GetSmartFieldControl(pFormField)); | 1198 pInterForm->GetWidget(GetSmartFieldControl(pFormField)); |
1200 if (!pWidget) | 1199 if (!pWidget) |
1201 return FALSE; | 1200 return FALSE; |
1202 | 1201 |
1203 uint32_t dwFlag = pWidget->GetFlags(); | 1202 uint32_t dwFlag = pWidget->GetFlags(); |
1204 | 1203 |
1205 if (ANNOTFLAG_INVISIBLE & dwFlag || ANNOTFLAG_HIDDEN & dwFlag) { | 1204 if (ANNOTFLAG_INVISIBLE & dwFlag || ANNOTFLAG_HIDDEN & dwFlag) { |
1206 vp << (int32_t)1; | 1205 vp << (int32_t)1; |
1207 } else { | 1206 } else { |
1208 if (ANNOTFLAG_PRINT & dwFlag) { | 1207 if (ANNOTFLAG_PRINT & dwFlag) { |
1209 if (ANNOTFLAG_NOVIEW & dwFlag) { | 1208 if (ANNOTFLAG_NOVIEW & dwFlag) { |
1210 vp << (int32_t)3; | 1209 vp << (int32_t)3; |
1211 } else { | 1210 } else { |
1212 vp << (int32_t)0; | 1211 vp << (int32_t)0; |
1213 } | 1212 } |
1214 } else { | 1213 } else { |
1215 vp << (int32_t)2; | 1214 vp << (int32_t)2; |
1216 } | 1215 } |
1217 } | 1216 } |
1218 } | 1217 } |
1219 | 1218 |
1220 return TRUE; | 1219 return TRUE; |
1221 } | 1220 } |
1222 | 1221 |
1223 void Field::SetDisplay(CPDFSDK_Document* pDocument, | 1222 void Field::SetDisplay(CPDFSDK_Document* pDocument, |
1224 const CFX_WideString& swFieldName, | 1223 const CFX_WideString& swFieldName, |
1225 int nControlIndex, | 1224 int nControlIndex, |
1226 int number) { | 1225 int number) { |
1227 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); | 1226 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); |
1228 std::vector<CPDF_FormField*> FieldArray = | 1227 std::vector<CPDF_FormField*> FieldArray = |
1229 GetFormFields(pDocument, swFieldName); | 1228 GetFormFields(pDocument, swFieldName); |
1230 for (CPDF_FormField* pFormField : FieldArray) { | 1229 for (CPDF_FormField* pFormField : FieldArray) { |
1231 if (nControlIndex < 0) { | 1230 if (nControlIndex < 0) { |
1232 FX_BOOL bSet = FALSE; | 1231 FX_BOOL bSet = FALSE; |
1233 for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { | 1232 for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { |
1234 CPDF_FormControl* pFormControl = pFormField->GetControl(i); | 1233 CPDF_FormControl* pFormControl = pFormField->GetControl(i); |
1235 ASSERT(pFormControl); | 1234 ASSERT(pFormControl); |
1236 | 1235 |
1237 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) { | 1236 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) { |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 } else { | 1501 } else { |
1503 Field::SetHidden(m_pDocument, m_FieldName, m_nFormControlIndex, bVP); | 1502 Field::SetHidden(m_pDocument, m_FieldName, m_nFormControlIndex, bVP); |
1504 } | 1503 } |
1505 } else { | 1504 } else { |
1506 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); | 1505 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); |
1507 if (FieldArray.empty()) | 1506 if (FieldArray.empty()) |
1508 return FALSE; | 1507 return FALSE; |
1509 | 1508 |
1510 CPDF_FormField* pFormField = FieldArray[0]; | 1509 CPDF_FormField* pFormField = FieldArray[0]; |
1511 ASSERT(pFormField); | 1510 ASSERT(pFormField); |
1512 CPDFSDK_InterForm* pInterForm = | 1511 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); |
1513 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); | |
1514 CPDFSDK_Widget* pWidget = | 1512 CPDFSDK_Widget* pWidget = |
1515 pInterForm->GetWidget(GetSmartFieldControl(pFormField)); | 1513 pInterForm->GetWidget(GetSmartFieldControl(pFormField)); |
1516 if (!pWidget) | 1514 if (!pWidget) |
1517 return FALSE; | 1515 return FALSE; |
1518 | 1516 |
1519 uint32_t dwFlags = pWidget->GetFlags(); | 1517 uint32_t dwFlags = pWidget->GetFlags(); |
1520 | 1518 |
1521 if (ANNOTFLAG_INVISIBLE & dwFlags || ANNOTFLAG_HIDDEN & dwFlags) | 1519 if (ANNOTFLAG_INVISIBLE & dwFlags || ANNOTFLAG_HIDDEN & dwFlags) |
1522 vp << true; | 1520 vp << true; |
1523 else | 1521 else |
1524 vp << false; | 1522 vp << false; |
1525 } | 1523 } |
1526 | 1524 |
1527 return TRUE; | 1525 return TRUE; |
1528 } | 1526 } |
1529 | 1527 |
1530 void Field::SetHidden(CPDFSDK_Document* pDocument, | 1528 void Field::SetHidden(CPDFSDK_Document* pDocument, |
1531 const CFX_WideString& swFieldName, | 1529 const CFX_WideString& swFieldName, |
1532 int nControlIndex, | 1530 int nControlIndex, |
1533 bool b) { | 1531 bool b) { |
1534 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); | 1532 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); |
1535 std::vector<CPDF_FormField*> FieldArray = | 1533 std::vector<CPDF_FormField*> FieldArray = |
1536 GetFormFields(pDocument, swFieldName); | 1534 GetFormFields(pDocument, swFieldName); |
1537 for (CPDF_FormField* pFormField : FieldArray) { | 1535 for (CPDF_FormField* pFormField : FieldArray) { |
1538 if (nControlIndex < 0) { | 1536 if (nControlIndex < 0) { |
1539 FX_BOOL bSet = FALSE; | 1537 FX_BOOL bSet = FALSE; |
1540 for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { | 1538 for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { |
1541 if (CPDFSDK_Widget* pWidget = | 1539 if (CPDFSDK_Widget* pWidget = |
1542 pInterForm->GetWidget(pFormField->GetControl(i))) { | 1540 pInterForm->GetWidget(pFormField->GetControl(i))) { |
1543 uint32_t dwFlags = pWidget->GetFlags(); | 1541 uint32_t dwFlags = pWidget->GetFlags(); |
1544 | 1542 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1672 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); | 1670 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); |
1673 if (FieldArray.empty()) | 1671 if (FieldArray.empty()) |
1674 return FALSE; | 1672 return FALSE; |
1675 | 1673 |
1676 CPDF_FormField* pFormField = FieldArray[0]; | 1674 CPDF_FormField* pFormField = FieldArray[0]; |
1677 ASSERT(pFormField); | 1675 ASSERT(pFormField); |
1678 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); | 1676 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); |
1679 if (!pFormControl) | 1677 if (!pFormControl) |
1680 return FALSE; | 1678 return FALSE; |
1681 | 1679 |
1682 CPDFSDK_InterForm* pInterForm = | 1680 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); |
1683 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); | |
1684 if (!pFormField->CountControls()) | 1681 if (!pFormField->CountControls()) |
1685 return FALSE; | 1682 return FALSE; |
1686 | 1683 |
1687 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormField->GetControl(0)); | 1684 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormField->GetControl(0)); |
1688 if (!pWidget) | 1685 if (!pWidget) |
1689 return FALSE; | 1686 return FALSE; |
1690 | 1687 |
1691 vp << (int32_t)pWidget->GetBorderWidth(); | 1688 vp << (int32_t)pWidget->GetBorderWidth(); |
1692 } | 1689 } |
1693 | 1690 |
1694 return TRUE; | 1691 return TRUE; |
1695 } | 1692 } |
1696 | 1693 |
1697 void Field::SetLineWidth(CPDFSDK_Document* pDocument, | 1694 void Field::SetLineWidth(CPDFSDK_Document* pDocument, |
1698 const CFX_WideString& swFieldName, | 1695 const CFX_WideString& swFieldName, |
1699 int nControlIndex, | 1696 int nControlIndex, |
1700 int number) { | 1697 int number) { |
1701 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); | 1698 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); |
1702 | |
1703 std::vector<CPDF_FormField*> FieldArray = | 1699 std::vector<CPDF_FormField*> FieldArray = |
1704 GetFormFields(pDocument, swFieldName); | 1700 GetFormFields(pDocument, swFieldName); |
1705 for (CPDF_FormField* pFormField : FieldArray) { | 1701 for (CPDF_FormField* pFormField : FieldArray) { |
1706 if (nControlIndex < 0) { | 1702 if (nControlIndex < 0) { |
1707 FX_BOOL bSet = FALSE; | 1703 FX_BOOL bSet = FALSE; |
1708 for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { | 1704 for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { |
1709 CPDF_FormControl* pFormControl = pFormField->GetControl(i); | 1705 CPDF_FormControl* pFormControl = pFormField->GetControl(i); |
1710 ASSERT(pFormControl); | 1706 ASSERT(pFormControl); |
1711 | 1707 |
1712 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) { | 1708 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) { |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1929 void Field::SetPassword(CPDFSDK_Document* pDocument, | 1925 void Field::SetPassword(CPDFSDK_Document* pDocument, |
1930 const CFX_WideString& swFieldName, | 1926 const CFX_WideString& swFieldName, |
1931 int nControlIndex, | 1927 int nControlIndex, |
1932 bool b) { | 1928 bool b) { |
1933 // Not supported. | 1929 // Not supported. |
1934 } | 1930 } |
1935 | 1931 |
1936 FX_BOOL Field::print(IJS_Context* cc, | 1932 FX_BOOL Field::print(IJS_Context* cc, |
1937 CJS_PropValue& vp, | 1933 CJS_PropValue& vp, |
1938 CFX_WideString& sError) { | 1934 CFX_WideString& sError) { |
1939 CPDFSDK_InterForm* pInterForm = | 1935 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); |
1940 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); | |
1941 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); | 1936 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); |
1942 if (FieldArray.empty()) | 1937 if (FieldArray.empty()) |
1943 return FALSE; | 1938 return FALSE; |
1944 | 1939 |
1945 if (vp.IsSetting()) { | 1940 if (vp.IsSetting()) { |
1946 if (!m_bCanSet) | 1941 if (!m_bCanSet) |
1947 return FALSE; | 1942 return FALSE; |
1948 | 1943 |
1949 bool bVP; | 1944 bool bVP; |
1950 vp >> bVP; | 1945 vp >> bVP; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2094 AddDelay_Rect(FP_RECT, crRect); | 2089 AddDelay_Rect(FP_RECT, crRect); |
2095 } else { | 2090 } else { |
2096 Field::SetRect(m_pDocument, m_FieldName, m_nFormControlIndex, crRect); | 2091 Field::SetRect(m_pDocument, m_FieldName, m_nFormControlIndex, crRect); |
2097 } | 2092 } |
2098 } else { | 2093 } else { |
2099 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); | 2094 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); |
2100 if (FieldArray.empty()) | 2095 if (FieldArray.empty()) |
2101 return FALSE; | 2096 return FALSE; |
2102 | 2097 |
2103 CPDF_FormField* pFormField = FieldArray[0]; | 2098 CPDF_FormField* pFormField = FieldArray[0]; |
2104 CPDFSDK_InterForm* pInterForm = | 2099 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); |
2105 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); | |
2106 CPDFSDK_Widget* pWidget = | 2100 CPDFSDK_Widget* pWidget = |
2107 pInterForm->GetWidget(GetSmartFieldControl(pFormField)); | 2101 pInterForm->GetWidget(GetSmartFieldControl(pFormField)); |
2108 if (!pWidget) | 2102 if (!pWidget) |
2109 return FALSE; | 2103 return FALSE; |
2110 | 2104 |
2111 CFX_FloatRect crRect = pWidget->GetRect(); | 2105 CFX_FloatRect crRect = pWidget->GetRect(); |
2112 Upper_Leftx = (int32_t)crRect.left; | 2106 Upper_Leftx = (int32_t)crRect.left; |
2113 Upper_Lefty = (int32_t)crRect.top; | 2107 Upper_Lefty = (int32_t)crRect.top; |
2114 Lower_Rightx = (int32_t)crRect.right; | 2108 Lower_Rightx = (int32_t)crRect.right; |
2115 Lower_Righty = (int32_t)crRect.bottom; | 2109 Lower_Righty = (int32_t)crRect.bottom; |
2116 | 2110 |
2117 CJS_Array rcArray(pRuntime); | 2111 CJS_Array rcArray(pRuntime); |
2118 rcArray.SetElement(0, Upper_Leftx); | 2112 rcArray.SetElement(0, Upper_Leftx); |
2119 rcArray.SetElement(1, Upper_Lefty); | 2113 rcArray.SetElement(1, Upper_Lefty); |
2120 rcArray.SetElement(2, Lower_Rightx); | 2114 rcArray.SetElement(2, Lower_Rightx); |
2121 rcArray.SetElement(3, Lower_Righty); | 2115 rcArray.SetElement(3, Lower_Righty); |
2122 vp << rcArray; | 2116 vp << rcArray; |
2123 } | 2117 } |
2124 return TRUE; | 2118 return TRUE; |
2125 } | 2119 } |
2126 | 2120 |
2127 void Field::SetRect(CPDFSDK_Document* pDocument, | 2121 void Field::SetRect(CPDFSDK_Document* pDocument, |
2128 const CFX_WideString& swFieldName, | 2122 const CFX_WideString& swFieldName, |
2129 int nControlIndex, | 2123 int nControlIndex, |
2130 const CFX_FloatRect& rect) { | 2124 const CFX_FloatRect& rect) { |
2131 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); | 2125 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); |
2132 | |
2133 std::vector<CPDF_FormField*> FieldArray = | 2126 std::vector<CPDF_FormField*> FieldArray = |
2134 GetFormFields(pDocument, swFieldName); | 2127 GetFormFields(pDocument, swFieldName); |
2135 for (CPDF_FormField* pFormField : FieldArray) { | 2128 for (CPDF_FormField* pFormField : FieldArray) { |
2136 if (nControlIndex < 0) { | 2129 if (nControlIndex < 0) { |
2137 FX_BOOL bSet = FALSE; | 2130 FX_BOOL bSet = FALSE; |
2138 for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { | 2131 for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) { |
2139 CPDF_FormControl* pFormControl = pFormField->GetControl(i); | 2132 CPDF_FormControl* pFormControl = pFormField->GetControl(i); |
2140 ASSERT(pFormControl); | 2133 ASSERT(pFormControl); |
2141 | 2134 |
2142 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) { | 2135 if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) { |
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3245 CFX_WideString& sError) { | 3238 CFX_WideString& sError) { |
3246 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); | 3239 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); |
3247 if (FieldArray.empty()) | 3240 if (FieldArray.empty()) |
3248 return FALSE; | 3241 return FALSE; |
3249 | 3242 |
3250 CPDF_FormField* pFormField = FieldArray[0]; | 3243 CPDF_FormField* pFormField = FieldArray[0]; |
3251 int32_t nCount = pFormField->CountControls(); | 3244 int32_t nCount = pFormField->CountControls(); |
3252 if (nCount < 1) | 3245 if (nCount < 1) |
3253 return FALSE; | 3246 return FALSE; |
3254 | 3247 |
3255 CPDFSDK_InterForm* pInterForm = | 3248 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); |
3256 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); | |
3257 CPDFSDK_Widget* pWidget = nullptr; | 3249 CPDFSDK_Widget* pWidget = nullptr; |
3258 if (nCount == 1) { | 3250 if (nCount == 1) { |
3259 pWidget = pInterForm->GetWidget(pFormField->GetControl(0)); | 3251 pWidget = pInterForm->GetWidget(pFormField->GetControl(0)); |
3260 } else { | 3252 } else { |
3261 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); | 3253 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); |
3262 UnderlyingPageType* pPage = UnderlyingFromFPDFPage( | 3254 UnderlyingPageType* pPage = UnderlyingFromFPDFPage( |
3263 pEnv->FFI_GetCurrentPage(m_pDocument->GetUnderlyingDocument())); | 3255 pEnv->FFI_GetCurrentPage(m_pDocument->GetUnderlyingDocument())); |
3264 if (!pPage) | 3256 if (!pPage) |
3265 return FALSE; | 3257 return FALSE; |
3266 if (CPDFSDK_PageView* pCurPageView = m_pDocument->GetPageView(pPage)) { | 3258 if (CPDFSDK_PageView* pCurPageView = m_pDocument->GetPageView(pPage)) { |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3547 } | 3539 } |
3548 } | 3540 } |
3549 | 3541 |
3550 void Field::AddField(CPDFSDK_Document* pDocument, | 3542 void Field::AddField(CPDFSDK_Document* pDocument, |
3551 int nPageIndex, | 3543 int nPageIndex, |
3552 int nFieldType, | 3544 int nFieldType, |
3553 const CFX_WideString& sName, | 3545 const CFX_WideString& sName, |
3554 const CFX_FloatRect& rcCoords) { | 3546 const CFX_FloatRect& rcCoords) { |
3555 // Not supported. | 3547 // Not supported. |
3556 } | 3548 } |
OLD | NEW |