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 "../../../public/fpdf_formfill.h" | 7 #include "../../../public/fpdf_formfill.h" |
8 #include "../../include/fsdk_define.h" | 8 #include "../../include/fsdk_define.h" |
9 #include "../../include/fpdfxfa/fpdfxfa_doc.h" | 9 #include "../../include/fpdfxfa/fpdfxfa_doc.h" |
10 #include "../../include/fsdk_mgr.h" | 10 #include "../../include/fsdk_mgr.h" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 if (NULL == pXFAPageView) { | 331 if (NULL == pXFAPageView) { |
332 return FALSE; | 332 return FALSE; |
333 } | 333 } |
334 CPDFXFA_Page* pPage = GetPage(pXFAPageView); | 334 CPDFXFA_Page* pPage = GetPage(pXFAPageView); |
335 if (pPage == NULL) | 335 if (pPage == NULL) |
336 return FALSE; | 336 return FALSE; |
337 | 337 |
338 CXFA_WidgetAcc* pWidgetAcc = | 338 CXFA_WidgetAcc* pWidgetAcc = |
339 m_pXFADocView->GetWidgetHandler()->GetDataAcc(hWidget); | 339 m_pXFADocView->GetWidgetHandler()->GetDataAcc(hWidget); |
340 | 340 |
341 int nRotate = pWidgetAcc->GetRotate(); | 341 int nRotate = 0; |
| 342 #ifdef PDF_ENABLE_XFA |
| 343 nRotate = pWidgetAcc->GetRotate(); |
| 344 #endif |
342 | 345 |
343 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 346 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
344 if (pEnv == NULL) | 347 if (pEnv == NULL) |
345 return FALSE; | 348 return FALSE; |
346 FS_RECTF pageViewRect; | 349 FS_RECTF pageViewRect; |
347 pEnv->FFI_GetPageViewRect(pPage, pageViewRect); | 350 pEnv->FFI_GetPageViewRect(pPage, pageViewRect); |
348 | 351 |
349 CPDF_Rect rcAnchor; | 352 CPDF_Rect rcAnchor; |
350 | 353 |
351 rcAnchor.left = rtAnchor.left; | 354 rcAnchor.left = rtAnchor.left; |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 | 890 |
888 FX_BOOL CPDFXFA_Document::_NotifySubmit(FX_BOOL bPrevOrPost) { | 891 FX_BOOL CPDFXFA_Document::_NotifySubmit(FX_BOOL bPrevOrPost) { |
889 if (bPrevOrPost) | 892 if (bPrevOrPost) |
890 return _OnBeforeNotifySumbit(); | 893 return _OnBeforeNotifySumbit(); |
891 else | 894 else |
892 _OnAfterNotifySumbit(); | 895 _OnAfterNotifySumbit(); |
893 return TRUE; | 896 return TRUE; |
894 } | 897 } |
895 | 898 |
896 FX_BOOL CPDFXFA_Document::_OnBeforeNotifySumbit() { | 899 FX_BOOL CPDFXFA_Document::_OnBeforeNotifySumbit() { |
| 900 #ifdef PDF_ENABLE_XFA |
897 if (m_iDocType != DOCTYPE_DYNIMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA) | 901 if (m_iDocType != DOCTYPE_DYNIMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA) |
898 return TRUE; | 902 return TRUE; |
899 if (m_pXFADocView == NULL) | 903 if (m_pXFADocView == NULL) |
900 return TRUE; | 904 return TRUE; |
901 IXFA_WidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler(); | 905 IXFA_WidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler(); |
902 if (pWidgetHandler == NULL) | 906 if (pWidgetHandler == NULL) |
903 return TRUE; | 907 return TRUE; |
904 IXFA_WidgetAccIterator* pWidgetAccIterator = | 908 IXFA_WidgetAccIterator* pWidgetAccIterator = |
905 m_pXFADocView->CreateWidgetAccIterator(); | 909 m_pXFADocView->CreateWidgetAccIterator(); |
906 if (pWidgetAccIterator) { | 910 if (pWidgetAccIterator) { |
(...skipping 25 matching lines...) Expand all Loading... |
932 (FPDF_WIDESTRING)L"", 0, 1); | 936 (FPDF_WIDESTRING)L"", 0, 1); |
933 bs.ReleaseBuffer(len * sizeof(unsigned short)); | 937 bs.ReleaseBuffer(len * sizeof(unsigned short)); |
934 pWidgetAccIterator->Release(); | 938 pWidgetAccIterator->Release(); |
935 return FALSE; | 939 return FALSE; |
936 } | 940 } |
937 pWidgetAcc = pWidgetAccIterator->MoveToNext(); | 941 pWidgetAcc = pWidgetAccIterator->MoveToNext(); |
938 } | 942 } |
939 pWidgetAccIterator->Release(); | 943 pWidgetAccIterator->Release(); |
940 m_pXFADocView->UpdateDocView(); | 944 m_pXFADocView->UpdateDocView(); |
941 } | 945 } |
942 | 946 #endif |
943 return TRUE; | 947 return TRUE; |
944 } | 948 } |
945 void CPDFXFA_Document::_OnAfterNotifySumbit() { | 949 void CPDFXFA_Document::_OnAfterNotifySumbit() { |
946 if (m_iDocType != DOCTYPE_DYNIMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA) | 950 if (m_iDocType != DOCTYPE_DYNIMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA) |
947 return; | 951 return; |
948 if (m_pXFADocView == NULL) | 952 if (m_pXFADocView == NULL) |
949 return; | 953 return; |
950 IXFA_WidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler(); | 954 IXFA_WidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler(); |
951 if (pWidgetHandler == NULL) | 955 if (pWidgetHandler == NULL) |
952 return; | 956 return; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 else | 1187 else |
1184 srcURL = srcURL.Right(csURL.GetLength() - (pos + 1)); | 1188 srcURL = srcURL.Right(csURL.GetLength() - (pos + 1)); |
1185 } | 1189 } |
1186 csToAddress.Replace(L",", L";"); | 1190 csToAddress.Replace(L",", L";"); |
1187 csCCAddress.Replace(L",", L";"); | 1191 csCCAddress.Replace(L",", L";"); |
1188 csBCCAddress.Replace(L",", L";"); | 1192 csBCCAddress.Replace(L",", L";"); |
1189 return TRUE; | 1193 return TRUE; |
1190 } | 1194 } |
1191 | 1195 |
1192 FX_BOOL CPDFXFA_Document::_SubmitData(IXFA_Doc* hDoc, CXFA_Submit submit) { | 1196 FX_BOOL CPDFXFA_Document::_SubmitData(IXFA_Doc* hDoc, CXFA_Submit submit) { |
| 1197 #ifdef PDF_ENABLE_XFA |
1193 CFX_WideStringC csURLC; | 1198 CFX_WideStringC csURLC; |
1194 submit.GetSubmitTarget(csURLC); | 1199 submit.GetSubmitTarget(csURLC); |
1195 CFX_WideString csURL = csURLC; | 1200 CFX_WideString csURL = csURLC; |
1196 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 1201 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
1197 if (pEnv == NULL) | 1202 if (pEnv == NULL) |
1198 return FALSE; | 1203 return FALSE; |
1199 if (csURL.IsEmpty()) { | 1204 if (csURL.IsEmpty()) { |
1200 CFX_WideString ws; | 1205 CFX_WideString ws; |
1201 ws.FromLocal("Submit cancelled."); | 1206 ws.FromLocal("Submit cancelled."); |
1202 CFX_ByteString bs = ws.UTF16LE_Encode(); | 1207 CFX_ByteString bs = ws.UTF16LE_Encode(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 CFX_WideString ws; | 1288 CFX_WideString ws; |
1284 CFX_ByteString bs = csURL.UTF16LE_Encode(); | 1289 CFX_ByteString bs = csURL.UTF16LE_Encode(); |
1285 int len = bs.GetLength() / sizeof(unsigned short); | 1290 int len = bs.GetLength() / sizeof(unsigned short); |
1286 pEnv->FFI_UploadTo( | 1291 pEnv->FFI_UploadTo( |
1287 pFileHandler, fileFlag, | 1292 pFileHandler, fileFlag, |
1288 (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short))); | 1293 (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short))); |
1289 bs.ReleaseBuffer(len * sizeof(unsigned short)); | 1294 bs.ReleaseBuffer(len * sizeof(unsigned short)); |
1290 } | 1295 } |
1291 | 1296 |
1292 return bRet; | 1297 return bRet; |
| 1298 #else |
| 1299 return TRUE; |
| 1300 #endif |
1293 } | 1301 } |
1294 | 1302 |
1295 FX_BOOL CPDFXFA_Document::SetGlobalProperty(IXFA_Doc* hDoc, | 1303 FX_BOOL CPDFXFA_Document::SetGlobalProperty(IXFA_Doc* hDoc, |
1296 const CFX_ByteStringC& szPropName, | 1304 const CFX_ByteStringC& szPropName, |
1297 FXJSE_HVALUE hValue) { | 1305 FXJSE_HVALUE hValue) { |
1298 if (hDoc != m_pXFADoc) | 1306 if (hDoc != m_pXFADoc) |
1299 return FALSE; | 1307 return FALSE; |
1300 | 1308 |
1301 if (m_pSDKDoc && m_pSDKDoc->GetEnv()->GetJSRuntime()) | 1309 if (m_pSDKDoc && m_pSDKDoc->GetEnv()->GetJSRuntime()) |
1302 return m_pSDKDoc->GetEnv()->GetJSRuntime()->SetHValueByName(szPropName, | 1310 return m_pSDKDoc->GetEnv()->GetJSRuntime()->SetHValueByName(szPropName, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 } | 1342 } |
1335 | 1343 |
1336 return _GetHValueByName(szPropName, hValue, | 1344 return _GetHValueByName(szPropName, hValue, |
1337 m_pSDKDoc->GetEnv()->GetJSRuntime()); | 1345 m_pSDKDoc->GetEnv()->GetJSRuntime()); |
1338 } | 1346 } |
1339 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, | 1347 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, |
1340 FXJSE_HVALUE hValue, | 1348 FXJSE_HVALUE hValue, |
1341 IJS_Runtime* runTime) { | 1349 IJS_Runtime* runTime) { |
1342 return runTime->GetHValueByName(utf8Name, hValue); | 1350 return runTime->GetHValueByName(utf8Name, hValue); |
1343 } | 1351 } |
OLD | NEW |