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/fpdfxfa/cpdfxfa_document.h" | 7 #include "fpdfsdk/fpdfxfa/cpdfxfa_document.h" |
8 | 8 |
9 #include "core/fpdfapi/parser/cpdf_document.h" | 9 #include "core/fpdfapi/parser/cpdf_document.h" |
10 #include "fpdfsdk/cpdfsdk_document.h" | 10 #include "fpdfsdk/cpdfsdk_document.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 #ifndef _WIN32 | 27 #ifndef _WIN32 |
28 extern void SetLastError(int err); | 28 extern void SetLastError(int err); |
29 extern int GetLastError(); | 29 extern int GetLastError(); |
30 #endif | 30 #endif |
31 | 31 |
32 CPDFXFA_Document::CPDFXFA_Document(std::unique_ptr<CPDF_Document> pPDFDoc, | 32 CPDFXFA_Document::CPDFXFA_Document(std::unique_ptr<CPDF_Document> pPDFDoc, |
33 CPDFXFA_App* pProvider) | 33 CPDFXFA_App* pProvider) |
34 : m_iDocType(DOCTYPE_PDF), | 34 : m_iDocType(DOCTYPE_PDF), |
35 m_pPDFDoc(std::move(pPDFDoc)), | 35 m_pPDFDoc(std::move(pPDFDoc)), |
36 m_pSDKDoc(nullptr), | 36 m_pFormFillEnv(nullptr), |
37 m_pXFADocView(nullptr), | 37 m_pXFADocView(nullptr), |
38 m_pApp(pProvider), | 38 m_pApp(pProvider), |
39 m_nLoadStatus(FXFA_LOADSTATUS_PRELOAD), | 39 m_nLoadStatus(FXFA_LOADSTATUS_PRELOAD), |
40 m_nPageCount(0), | 40 m_nPageCount(0), |
41 m_DocEnv(this) {} | 41 m_DocEnv(this) {} |
42 | 42 |
43 CPDFXFA_Document::~CPDFXFA_Document() { | 43 CPDFXFA_Document::~CPDFXFA_Document() { |
44 m_nLoadStatus = FXFA_LOADSTATUS_CLOSING; | 44 m_nLoadStatus = FXFA_LOADSTATUS_CLOSING; |
45 | 45 |
46 if (m_pSDKDoc) { | 46 if (m_pFormFillEnv) { |
47 m_pSDKDoc->ClearAllFocusedAnnots(); | 47 m_pFormFillEnv->GetSDKDocument()->ClearAllFocusedAnnots(); |
48 // Once we're deleted the SDKDocument will point at a bad underlying | 48 // Once we're deleted the SDKDocument will point at a bad underlying |
49 // doc so we need to reset it ... | 49 // doc so we need to reset it ... |
50 m_pSDKDoc->ResetXFADocument(); | 50 m_pFormFillEnv->GetSDKDocument()->ResetXFADocument(); |
51 m_pSDKDoc = nullptr; | 51 m_pFormFillEnv = nullptr; |
52 } | 52 } |
53 | 53 |
54 if (m_pXFADoc) { | 54 if (m_pXFADoc) { |
55 CXFA_FFApp* pApp = m_pApp->GetXFAApp(); | 55 CXFA_FFApp* pApp = m_pApp->GetXFAApp(); |
56 if (pApp) { | 56 if (pApp) { |
57 CXFA_FFDocHandler* pDocHandler = pApp->GetDocHandler(); | 57 CXFA_FFDocHandler* pDocHandler = pApp->GetDocHandler(); |
58 if (pDocHandler) | 58 if (pDocHandler) |
59 CloseXFADoc(pDocHandler); | 59 CloseXFADoc(pDocHandler); |
60 } | 60 } |
61 m_pXFADoc.reset(); | 61 m_pXFADoc.reset(); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 194 |
195 if (CPDFXFA_Page* pPage = m_XFAPageList.GetAt(page_index)) | 195 if (CPDFXFA_Page* pPage = m_XFAPageList.GetAt(page_index)) |
196 pPage->Release(); | 196 pPage->Release(); |
197 } | 197 } |
198 | 198 |
199 void CPDFXFA_Document::RemovePage(CPDFXFA_Page* page) { | 199 void CPDFXFA_Document::RemovePage(CPDFXFA_Page* page) { |
200 m_XFAPageList.SetAt(page->GetPageIndex(), nullptr); | 200 m_XFAPageList.SetAt(page->GetPageIndex(), nullptr); |
201 } | 201 } |
202 | 202 |
203 void CPDFXFA_Document::ClearChangeMark() { | 203 void CPDFXFA_Document::ClearChangeMark() { |
204 if (m_pSDKDoc) | 204 if (m_pFormFillEnv) |
205 m_pSDKDoc->ClearChangeMark(); | 205 m_pFormFillEnv->GetSDKDocument()->ClearChangeMark(); |
206 } | 206 } |
OLD | NEW |