| 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 "../../include/fsdk_define.h" | 7 #include "../../include/fsdk_define.h" |
| 8 #include "../../include/fpdfxfa/fpdfxfa_doc.h" | 8 #include "../../include/fpdfxfa/fpdfxfa_doc.h" |
| 9 #include "../../include/fpdfformfill.h" | 9 #include "../../include/fpdfformfill.h" |
| 10 #include "../../include/fsdk_mgr.h" | 10 #include "../../include/fsdk_mgr.h" |
| 11 #include "../../include/fpdfxfa/fpdfxfa_app.h" | 11 #include "../../include/fpdfxfa/fpdfxfa_app.h" |
| 12 #include "../../include/fpdfxfa/fpdfxfa_util.h" | 12 #include "../../include/fpdfxfa/fpdfxfa_util.h" |
| 13 #include "../../include/fpdfxfa/fpdfxfa_page.h" | 13 #include "../../include/fpdfxfa/fpdfxfa_page.h" |
| 14 #include "../../include/javascript/IJavaScript.h" | 14 #include "../../include/javascript/IJavaScript.h" |
| 15 | 15 |
| 16 | |
| 17 | |
| 18 #define IDS_XFA_StringMonth_April "April" | |
| 19 #define IDS_XFA_StringMonth_May "May" | |
| 20 #define IDS_XFA_StringMonth_June "June" | |
| 21 #define IDS_XFA_StringMonth_July "July" | |
| 22 #define IDS_XFA_StringMonth_Aug "August" | |
| 23 #define IDS_XFA_StringMonth_Sept "September" | |
| 24 #define IDS_XFA_StringMonth_Oct "October" | |
| 25 #define IDS_XFA_StringMonth_Nov "November" | |
| 26 #define IDS_XFA_StringMonth_Dec "December" | |
| 27 #define IDS_XFA_String_Today "Today" | |
| 28 #define IDS_XFA_ValidateLimit "Message limit exceeded. Remaining %d validation
errors not reported." | |
| 29 #define IDS_XFA_Validate_Input "At least one required field was empty. Please f
ill in the required fields\r\n(highlighted) before continuing." | 16 #define IDS_XFA_Validate_Input "At least one required field was empty. Please f
ill in the required fields\r\n(highlighted) before continuing." |
| 30 | 17 |
| 31 // submit | 18 // submit |
| 32 #define FXFA_CONFIG 0x00000001 | 19 #define FXFA_CONFIG 0x00000001 |
| 33 #define FXFA_TEMPLATE 0x00000010 | 20 #define FXFA_TEMPLATE 0x00000010 |
| 34 #define FXFA_LOCALESET 0x00000100 | 21 #define FXFA_LOCALESET 0x00000100 |
| 35 #define FXFA_DATASETS 0x00001000 | 22 #define FXFA_DATASETS 0x00001000 |
| 36 #define FXFA_XMPMETA 0x00010000 | 23 #define FXFA_XMPMETA 0x00010000 |
| 37 #define FXFA_XFDF 0x00100000 | 24 #define FXFA_XFDF 0x00100000 |
| 38 #define FXFA_FORM 0x01000000 | 25 #define FXFA_FORM 0x01000000 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 m_pPDFDoc = NULL; | 58 m_pPDFDoc = NULL; |
| 72 } | 59 } |
| 73 if (m_pXFADoc) | 60 if (m_pXFADoc) |
| 74 { | 61 { |
| 75 IXFA_App* pApp = m_pApp->GetXFAApp(); | 62 IXFA_App* pApp = m_pApp->GetXFAApp(); |
| 76 if (pApp) | 63 if (pApp) |
| 77 { | 64 { |
| 78 IXFA_DocHandler* pDocHandler = pApp->GetDocHandler(); | 65 IXFA_DocHandler* pDocHandler = pApp->GetDocHandler(); |
| 79 if (pDocHandler) | 66 if (pDocHandler) |
| 80 { | 67 { |
| 81 » » » » pDocHandler->CloseDoc(m_pXFADoc); | 68 » » » » CloseXFADoc(pDocHandler); |
| 82 » » » » pDocHandler->ReleaseDoc(m_pXFADoc); | |
| 83 » » » » m_pXFADoc = NULL; | |
| 84 } | 69 } |
| 85 } | 70 } |
| 86 } | 71 } |
| 87 | 72 |
| 88 if (m_pJSContext) | 73 if (m_pJSContext) |
| 89 { | 74 { |
| 90 if (m_pSDKDoc && m_pSDKDoc->GetEnv()) | 75 if (m_pSDKDoc && m_pSDKDoc->GetEnv()) |
| 91 { | 76 { |
| 92 m_pSDKDoc->GetEnv()->GetJSRuntime()->ReleaseContext(m_pJ
SContext); | 77 m_pSDKDoc->GetEnv()->GetJSRuntime()->ReleaseContext(m_pJ
SContext); |
| 93 m_pJSContext = NULL; | 78 m_pJSContext = NULL; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 122 return FALSE; | 107 return FALSE; |
| 123 } | 108 } |
| 124 | 109 |
| 125 IXFA_DocHandler* pDocHandler = pApp->GetDocHandler(); | 110 IXFA_DocHandler* pDocHandler = pApp->GetDocHandler(); |
| 126 if (pDocHandler) | 111 if (pDocHandler) |
| 127 { | 112 { |
| 128 int iStatus = pDocHandler->StartLoad(m_pXFADoc); | 113 int iStatus = pDocHandler->StartLoad(m_pXFADoc); |
| 129 iStatus = pDocHandler->DoLoad(m_pXFADoc, NULL); | 114 iStatus = pDocHandler->DoLoad(m_pXFADoc, NULL); |
| 130 if (iStatus != 100) | 115 if (iStatus != 100) |
| 131 { | 116 { |
| 132 » » » » » pDocHandler->CloseDoc(m_pXFADoc); | 117 » » » » » CloseXFADoc(pDocHandler); |
| 133 » » » » » pDocHandler->ReleaseDoc(m_pXFADoc); | |
| 134 » » » » » m_pXFADoc = NULL; | |
| 135 | |
| 136 SetLastError(FPDF_ERR_XFALOAD); | 118 SetLastError(FPDF_ERR_XFALOAD); |
| 137 return FALSE; | 119 return FALSE; |
| 138 } | 120 } |
| 139 pDocHandler->StopLoad(m_pXFADoc); | 121 pDocHandler->StopLoad(m_pXFADoc); |
| 140 pDocHandler->SetJSERuntime(m_pXFADoc, m_pApp->Ge
tJSERuntime()); | 122 pDocHandler->SetJSERuntime(m_pXFADoc, m_pApp->Ge
tJSERuntime()); |
| 141 | 123 |
| 142 if (pDocHandler->GetDocType(m_pXFADoc) == XFA_DO
CTYPE_Dynamic) | 124 if (pDocHandler->GetDocType(m_pXFADoc) == XFA_DO
CTYPE_Dynamic) |
| 143 m_iDocType = DOCTYPE_DYNIMIC_XFA; | 125 m_iDocType = DOCTYPE_DYNIMIC_XFA; |
| 144 else | 126 else |
| 145 m_iDocType = DOCTYPE_STATIC_XFA; | 127 m_iDocType = DOCTYPE_STATIC_XFA; |
| 146 | 128 |
| 147 m_pXFADocView = pDocHandler->CreateDocView(m_pXF
ADoc, XFA_DOCVIEW_View); | 129 m_pXFADocView = pDocHandler->CreateDocView(m_pXF
ADoc, XFA_DOCVIEW_View); |
| 148 FXSYS_assert(m_pXFADocView); | 130 FXSYS_assert(m_pXFADocView); |
| 149 | 131 |
| 150 if (m_pXFADocView->StartLayout() < 0) | 132 if (m_pXFADocView->StartLayout() < 0) |
| 151 { | 133 { |
| 152 » » » » » pDocHandler->CloseDoc(m_pXFADoc); | 134 » » » » » CloseXFADoc(pDocHandler); |
| 153 » » » » » pDocHandler->ReleaseDoc(m_pXFADoc); | |
| 154 » » » » » m_pXFADoc = NULL; | |
| 155 | |
| 156 SetLastError(FPDF_ERR_XFALAYOUT); | 135 SetLastError(FPDF_ERR_XFALAYOUT); |
| 157 return FALSE; | 136 return FALSE; |
| 158 } | 137 } |
| 159 else | 138 else |
| 160 { | 139 { |
| 161 m_pXFADocView->DoLayout(NULL); | 140 m_pXFADocView->DoLayout(NULL); |
| 162 m_pXFADocView->StopLayout(); | 141 m_pXFADocView->StopLayout(); |
| 163 | 142 |
| 164 return TRUE; | 143 return TRUE; |
| 165 } | 144 } |
| (...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1467 } | 1446 } |
| 1468 | 1447 |
| 1469 return _GetHValueByName(szPropName, hValue, m_pSDKDoc->GetEnv()->GetJSRu
ntime()); | 1448 return _GetHValueByName(szPropName, hValue, m_pSDKDoc->GetEnv()->GetJSRu
ntime()); |
| 1470 | 1449 |
| 1471 } | 1450 } |
| 1472 FX_BOOL CPDFXFA_Document::_GetHValueByName(FX_BSTR utf8Name, FXJSE_HVALUE hValue
, IFXJS_Runtime* runTime) | 1451 FX_BOOL CPDFXFA_Document::_GetHValueByName(FX_BSTR utf8Name, FXJSE_HVALUE hValue
, IFXJS_Runtime* runTime) |
| 1473 { | 1452 { |
| 1474 return runTime->GetHValueByName(utf8Name, hValue); | 1453 return runTime->GetHValueByName(utf8Name, hValue); |
| 1475 } | 1454 } |
| 1476 | 1455 |
| OLD | NEW |