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

Side by Side Diff: fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h

Issue 2275773003: Flip document and parser ownership (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@private_parser
Patch Set: Rebase to master Created 4 years, 3 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/fpdfxfa_doc.cpp ('k') | fpdfsdk/pdfwindow/PWL_FontMap.cpp » ('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 #ifndef FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ 7 #ifndef FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_
8 #define FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ 8 #define FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_
9 9
10 #include "xfa/fxfa/include/xfa_ffdoc.h" 10 #include "xfa/fxfa/include/xfa_ffdoc.h"
11 11
12 #include <memory> 12 #include <memory>
13 #include <vector> 13 #include <vector>
14 14
15 #include "public/fpdfview.h" 15 #include "public/fpdfview.h"
16 #include "xfa/fxfa/include/fxfa.h" 16 #include "xfa/fxfa/include/fxfa.h"
17 #include "xfa/fxfa/include/xfa_ffdochandler.h" 17 #include "xfa/fxfa/include/xfa_ffdochandler.h"
18 18
19 class CPDFXFA_App; 19 class CPDFXFA_App;
20 class CPDFXFA_Document; 20 class CPDFXFA_Document;
21 class CPDFXFA_Page; 21 class CPDFXFA_Page;
22 class CPDFSDK_Document; 22 class CPDFSDK_Document;
23 class CPDFDoc_Environment; 23 class CPDFDoc_Environment;
24 class IJS_Runtime; 24 class IJS_Runtime;
25 class IJS_Context; 25 class IJS_Context;
26 class CXFA_FFDocHandler; 26 class CXFA_FFDocHandler;
27 27
28 class CPDFXFA_Document : public IXFA_DocProvider { 28 class CPDFXFA_Document : public IXFA_DocProvider {
29 public: 29 public:
30 CPDFXFA_Document(CPDF_Document* pPDFDoc, CPDFXFA_App* pProvider); 30 CPDFXFA_Document(std::unique_ptr<CPDF_Document> pPDFDoc,
31 CPDFXFA_App* pProvider);
31 ~CPDFXFA_Document() override; 32 ~CPDFXFA_Document() override;
32 33
33 FX_BOOL LoadXFADoc(); 34 FX_BOOL LoadXFADoc();
34 CPDFXFA_App* GetApp() { return m_pApp; } 35 CPDFXFA_App* GetApp() { return m_pApp; }
35 CPDF_Document* GetPDFDoc() { return m_pPDFDoc; } 36 CPDF_Document* GetPDFDoc() { return m_pPDFDoc.get(); }
36 CXFA_FFDoc* GetXFADoc() { return m_pXFADoc.get(); } 37 CXFA_FFDoc* GetXFADoc() { return m_pXFADoc.get(); }
37 CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; } 38 CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; }
38 39
39 int GetPageCount(); 40 int GetPageCount();
40 CPDFXFA_Page* GetPage(int page_index); 41 CPDFXFA_Page* GetPage(int page_index);
41 CPDFXFA_Page* GetPage(CXFA_FFPageView* pPage); 42 CPDFXFA_Page* GetPage(CXFA_FFPageView* pPage);
42 43
43 void DeletePage(int page_index); 44 void DeletePage(int page_index);
44 void RemovePage(CPDFXFA_Page* page); 45 void RemovePage(CPDFXFA_Page* page);
45 int GetDocType() { return m_iDocType; } 46 int GetDocType() { return m_iDocType; }
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 194
194 void CloseXFADoc(CXFA_FFDocHandler* pDoc) { 195 void CloseXFADoc(CXFA_FFDocHandler* pDoc) {
195 if (pDoc) { 196 if (pDoc) {
196 m_pXFADoc->CloseDoc(); 197 m_pXFADoc->CloseDoc();
197 m_pXFADoc.reset(); 198 m_pXFADoc.reset();
198 m_pXFADocView = nullptr; 199 m_pXFADocView = nullptr;
199 } 200 }
200 } 201 }
201 202
202 int m_iDocType; 203 int m_iDocType;
203 CPDF_Document* m_pPDFDoc; 204
205 // |m_pSDKDoc| has to be released before |m_pPDFDoc| since it needs to access
206 // it to kill focused annotations.
207 std::unique_ptr<CPDF_Document> m_pPDFDoc;
204 std::unique_ptr<CPDFSDK_Document> m_pSDKDoc; 208 std::unique_ptr<CPDFSDK_Document> m_pSDKDoc;
205 std::unique_ptr<CXFA_FFDoc> m_pXFADoc; 209 std::unique_ptr<CXFA_FFDoc> m_pXFADoc;
206 CXFA_FFDocView* m_pXFADocView; // not owned. 210 CXFA_FFDocView* m_pXFADocView; // not owned.
207 CPDFXFA_App* const m_pApp; 211 CPDFXFA_App* const m_pApp;
208 IJS_Context* m_pJSContext; 212 IJS_Context* m_pJSContext;
209 CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList; 213 CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList;
210 LoadStatus m_nLoadStatus; 214 LoadStatus m_nLoadStatus;
211 int m_nPageCount; 215 int m_nPageCount;
212 }; 216 };
213 217
214 #endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ 218 #endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp ('k') | fpdfsdk/pdfwindow/PWL_FontMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698