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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 return NULL; | 194 return NULL; |
195 } | 195 } |
196 | 196 |
197 void CPDFXFA_Document::RemovePage(CPDFXFA_Page* page) { | 197 void CPDFXFA_Document::RemovePage(CPDFXFA_Page* page) { |
198 m_XFAPageList.SetAt(page->GetPageIndex(), NULL); | 198 m_XFAPageList.SetAt(page->GetPageIndex(), NULL); |
199 } | 199 } |
200 | 200 |
201 CPDFSDK_Document* CPDFXFA_Document::GetSDKDocument( | 201 CPDFSDK_Document* CPDFXFA_Document::GetSDKDocument( |
202 CPDFDoc_Environment* pFormFillEnv) { | 202 CPDFDoc_Environment* pFormFillEnv) { |
203 if (!pFormFillEnv) | 203 if (!m_pSDKDoc && pFormFillEnv) |
204 return m_pSDKDoc; | 204 m_pSDKDoc = new CPDFSDK_Document(this, pFormFillEnv); |
205 | |
206 if (m_pSDKDoc) | |
207 return m_pSDKDoc; | |
208 | |
209 m_pSDKDoc = new CPDFSDK_Document(this, pFormFillEnv); | |
210 if (!m_pSDKDoc) | |
211 return NULL; | |
212 | |
213 return m_pSDKDoc; | 205 return m_pSDKDoc; |
214 } | 206 } |
215 | 207 |
216 void CPDFXFA_Document::ReleaseSDKDoc() { | 208 void CPDFXFA_Document::ReleaseSDKDoc() { |
217 if (m_pSDKDoc) | 209 if (m_pSDKDoc) |
218 delete m_pSDKDoc; | 210 delete m_pSDKDoc; |
219 | 211 |
220 m_pSDKDoc = NULL; | 212 m_pSDKDoc = NULL; |
221 } | 213 } |
222 | 214 |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 if (pEnv == NULL) | 984 if (pEnv == NULL) |
993 return FALSE; | 985 return FALSE; |
994 CFX_ByteString bs = wsLink.UTF16LE_Encode(); | 986 CFX_ByteString bs = wsLink.UTF16LE_Encode(); |
995 int len = bs.GetLength() / sizeof(unsigned short); | 987 int len = bs.GetLength() / sizeof(unsigned short); |
996 FPDF_FILEHANDLER* pFileHandler = pEnv->FFI_OpenFile( | 988 FPDF_FILEHANDLER* pFileHandler = pEnv->FFI_OpenFile( |
997 0, (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short)), "rb"); | 989 0, (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short)), "rb"); |
998 bs.ReleaseBuffer(len * sizeof(unsigned short)); | 990 bs.ReleaseBuffer(len * sizeof(unsigned short)); |
999 | 991 |
1000 if (pFileHandler == NULL) | 992 if (pFileHandler == NULL) |
1001 return NULL; | 993 return NULL; |
1002 CFPDF_FileStream* pFileRead = new CFPDF_FileStream(pFileHandler); | 994 return new CFPDF_FileStream(pFileHandler); |
1003 return pFileRead; | |
1004 } | 995 } |
1005 FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, | 996 FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, |
1006 int fileType, | 997 int fileType, |
1007 FPDF_DWORD encodeType, | 998 FPDF_DWORD encodeType, |
1008 FPDF_DWORD flag) { | 999 FPDF_DWORD flag) { |
1009 if (NULL == m_pXFADocView) | 1000 if (NULL == m_pXFADocView) |
1010 return FALSE; | 1001 return FALSE; |
1011 IXFA_DocHandler* pDocHandler = m_pApp->GetXFAApp()->GetDocHandler(); | 1002 IXFA_DocHandler* pDocHandler = m_pApp->GetXFAApp()->GetDocHandler(); |
1012 CFX_ByteString content; | 1003 CFX_ByteString content; |
1013 | 1004 |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 } | 1334 } |
1344 | 1335 |
1345 return _GetHValueByName(szPropName, hValue, | 1336 return _GetHValueByName(szPropName, hValue, |
1346 m_pSDKDoc->GetEnv()->GetJSRuntime()); | 1337 m_pSDKDoc->GetEnv()->GetJSRuntime()); |
1347 } | 1338 } |
1348 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, | 1339 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, |
1349 FXJSE_HVALUE hValue, | 1340 FXJSE_HVALUE hValue, |
1350 IFXJS_Runtime* runTime) { | 1341 IFXJS_Runtime* runTime) { |
1351 return runTime->GetHValueByName(utf8Name, hValue); | 1342 return runTime->GetHValueByName(utf8Name, hValue); |
1352 } | 1343 } |
OLD | NEW |