Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp

Issue 1377853004: XFA: Remove test for new. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | xfa/include/fxfa/fxfa_widget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 (!pFormFillEnv)
Tom Sepez 2015/10/02 17:12:11 nit: how about just: if (pFormFillEnv && !m_pSDKD
Lei Zhang 2015/10/02 17:21:52 Done.
204 return m_pSDKDoc; 204 return m_pSDKDoc;
205 205
206 if (m_pSDKDoc) 206 if (m_pSDKDoc)
207 return m_pSDKDoc; 207 return m_pSDKDoc;
208 208
209 m_pSDKDoc = new CPDFSDK_Document(this, pFormFillEnv); 209 m_pSDKDoc = new CPDFSDK_Document(this, pFormFillEnv);
210 if (!m_pSDKDoc)
211 return NULL;
212
213 return m_pSDKDoc; 210 return m_pSDKDoc;
214 } 211 }
215 212
216 void CPDFXFA_Document::ReleaseSDKDoc() { 213 void CPDFXFA_Document::ReleaseSDKDoc() {
217 if (m_pSDKDoc) 214 if (m_pSDKDoc)
Lei Zhang 2015/10/02 17:21:52 We'll need to take a pass through these as well.
218 delete m_pSDKDoc; 215 delete m_pSDKDoc;
219 216
220 m_pSDKDoc = NULL; 217 m_pSDKDoc = NULL;
221 } 218 }
222 219
223 void CPDFXFA_Document::FXRect2PDFRect(const CFX_RectF& fxRectF, 220 void CPDFXFA_Document::FXRect2PDFRect(const CFX_RectF& fxRectF,
224 CPDF_Rect& pdfRect) { 221 CPDF_Rect& pdfRect) {
225 pdfRect.left = fxRectF.left; 222 pdfRect.left = fxRectF.left;
226 pdfRect.top = fxRectF.bottom(); 223 pdfRect.top = fxRectF.bottom();
227 pdfRect.right = fxRectF.right(); 224 pdfRect.right = fxRectF.right();
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 if (pEnv == NULL) 989 if (pEnv == NULL)
993 return FALSE; 990 return FALSE;
994 CFX_ByteString bs = wsLink.UTF16LE_Encode(); 991 CFX_ByteString bs = wsLink.UTF16LE_Encode();
995 int len = bs.GetLength() / sizeof(unsigned short); 992 int len = bs.GetLength() / sizeof(unsigned short);
996 FPDF_FILEHANDLER* pFileHandler = pEnv->FFI_OpenFile( 993 FPDF_FILEHANDLER* pFileHandler = pEnv->FFI_OpenFile(
997 0, (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short)), "rb"); 994 0, (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short)), "rb");
998 bs.ReleaseBuffer(len * sizeof(unsigned short)); 995 bs.ReleaseBuffer(len * sizeof(unsigned short));
999 996
1000 if (pFileHandler == NULL) 997 if (pFileHandler == NULL)
1001 return NULL; 998 return NULL;
1002 CFPDF_FileStream* pFileRead = new CFPDF_FileStream(pFileHandler); 999 return new CFPDF_FileStream(pFileHandler);
1003 return pFileRead;
1004 } 1000 }
1005 FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, 1001 FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
1006 int fileType, 1002 int fileType,
1007 FPDF_DWORD encodeType, 1003 FPDF_DWORD encodeType,
1008 FPDF_DWORD flag) { 1004 FPDF_DWORD flag) {
1009 if (NULL == m_pXFADocView) 1005 if (NULL == m_pXFADocView)
1010 return FALSE; 1006 return FALSE;
1011 IXFA_DocHandler* pDocHandler = m_pApp->GetXFAApp()->GetDocHandler(); 1007 IXFA_DocHandler* pDocHandler = m_pApp->GetXFAApp()->GetDocHandler();
1012 CFX_ByteString content; 1008 CFX_ByteString content;
1013 1009
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 } 1339 }
1344 1340
1345 return _GetHValueByName(szPropName, hValue, 1341 return _GetHValueByName(szPropName, hValue,
1346 m_pSDKDoc->GetEnv()->GetJSRuntime()); 1342 m_pSDKDoc->GetEnv()->GetJSRuntime());
1347 } 1343 }
1348 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, 1344 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name,
1349 FXJSE_HVALUE hValue, 1345 FXJSE_HVALUE hValue,
1350 IFXJS_Runtime* runTime) { 1346 IFXJS_Runtime* runTime) {
1351 return runTime->GetHValueByName(utf8Name, hValue); 1347 return runTime->GetHValueByName(utf8Name, hValue);
1352 } 1348 }
OLDNEW
« no previous file with comments | « no previous file | xfa/include/fxfa/fxfa_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698