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

Side by Side Diff: fpdfsdk/fpdfxfa/cpdfxfa_document.cpp

Issue 2397473006: Remove ownership of CPDFSDK_Document from CPDFXFA_Document (Closed)
Patch Set: Rebase to master Created 4 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 | « fpdfsdk/fpdfxfa/cpdfxfa_document.h ('k') | samples/pdfium_test.cc » ('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 "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
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_pXFADocView(nullptr), 37 m_pXFADocView(nullptr),
37 m_pApp(pProvider), 38 m_pApp(pProvider),
38 m_nLoadStatus(FXFA_LOADSTATUS_PRELOAD), 39 m_nLoadStatus(FXFA_LOADSTATUS_PRELOAD),
39 m_nPageCount(0), 40 m_nPageCount(0),
40 m_DocEnv(this) {} 41 m_DocEnv(this) {}
41 42
42 CPDFXFA_Document::~CPDFXFA_Document() { 43 CPDFXFA_Document::~CPDFXFA_Document() {
43 m_nLoadStatus = FXFA_LOADSTATUS_CLOSING; 44 m_nLoadStatus = FXFA_LOADSTATUS_CLOSING;
44 45
46 if (m_pSDKDoc) {
47 m_pSDKDoc->ClearAllFocusedAnnots();
48 m_pSDKDoc = nullptr;
49 }
50
45 if (m_pXFADoc) { 51 if (m_pXFADoc) {
46 CXFA_FFApp* pApp = m_pApp->GetXFAApp(); 52 CXFA_FFApp* pApp = m_pApp->GetXFAApp();
47 if (pApp) { 53 if (pApp) {
48 CXFA_FFDocHandler* pDocHandler = pApp->GetDocHandler(); 54 CXFA_FFDocHandler* pDocHandler = pApp->GetDocHandler();
49 if (pDocHandler) 55 if (pDocHandler)
50 CloseXFADoc(pDocHandler); 56 CloseXFADoc(pDocHandler);
51 } 57 }
52 m_pXFADoc.reset(); 58 m_pXFADoc.reset();
53 } 59 }
54 60
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 return; 190 return;
185 191
186 if (CPDFXFA_Page* pPage = m_XFAPageList.GetAt(page_index)) 192 if (CPDFXFA_Page* pPage = m_XFAPageList.GetAt(page_index))
187 pPage->Release(); 193 pPage->Release();
188 } 194 }
189 195
190 void CPDFXFA_Document::RemovePage(CPDFXFA_Page* page) { 196 void CPDFXFA_Document::RemovePage(CPDFXFA_Page* page) {
191 m_XFAPageList.SetAt(page->GetPageIndex(), nullptr); 197 m_XFAPageList.SetAt(page->GetPageIndex(), nullptr);
192 } 198 }
193 199
194 void CPDFXFA_Document::SetSDKDoc(std::unique_ptr<CPDFSDK_Document> pSDKDoc) {
195 m_pSDKDoc.reset(pSDKDoc.release());
196 }
197
198 void CPDFXFA_Document::ClearChangeMark() { 200 void CPDFXFA_Document::ClearChangeMark() {
199 if (m_pSDKDoc) 201 if (m_pSDKDoc)
200 m_pSDKDoc->ClearChangeMark(); 202 m_pSDKDoc->ClearChangeMark();
201 } 203 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfxfa/cpdfxfa_document.h ('k') | samples/pdfium_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698