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

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

Issue 2173253002: Use smart pointers for class owned pointers (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments Created 4 years, 4 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/include/fpdfxfa_app.h ('k') | fpdfsdk/include/fsdk_mgr.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 #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 <vector> 13 #include <vector>
13 14
14 #include "public/fpdfview.h" 15 #include "public/fpdfview.h"
15 #include "xfa/fxfa/include/fxfa.h" 16 #include "xfa/fxfa/include/fxfa.h"
16 #include "xfa/fxfa/include/xfa_ffdochandler.h" 17 #include "xfa/fxfa/include/xfa_ffdochandler.h"
17 18
18 class CPDFXFA_App; 19 class CPDFXFA_App;
19 class CPDFXFA_Document; 20 class CPDFXFA_Document;
20 class CPDFXFA_Page; 21 class CPDFXFA_Page;
21 class CPDFSDK_Document; 22 class CPDFSDK_Document;
22 class CPDFDoc_Environment; 23 class CPDFDoc_Environment;
23 class IJS_Runtime; 24 class IJS_Runtime;
24 class IJS_Context; 25 class IJS_Context;
25 class CXFA_FFDocHandler; 26 class CXFA_FFDocHandler;
26 27
27 class CPDFXFA_Document : public IXFA_DocProvider { 28 class CPDFXFA_Document : public IXFA_DocProvider {
28 public: 29 public:
29 CPDFXFA_Document(CPDF_Document* pPDFDoc, CPDFXFA_App* pProvider); 30 CPDFXFA_Document(CPDF_Document* pPDFDoc, CPDFXFA_App* pProvider);
30 ~CPDFXFA_Document() override; 31 ~CPDFXFA_Document() override;
31 32
32 FX_BOOL LoadXFADoc(); 33 FX_BOOL LoadXFADoc();
33 CPDFXFA_App* GetApp() { return m_pApp; } 34 CPDFXFA_App* GetApp() { return m_pApp; }
34 CPDF_Document* GetPDFDoc() { return m_pPDFDoc; } 35 CPDF_Document* GetPDFDoc() { return m_pPDFDoc; }
35 CXFA_FFDoc* GetXFADoc() { return m_pXFADoc; } 36 CXFA_FFDoc* GetXFADoc() { return m_pXFADoc.get(); }
36 CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; } 37 CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; }
37 38
38 int GetPageCount(); 39 int GetPageCount();
39 CPDFXFA_Page* GetPage(int page_index); 40 CPDFXFA_Page* GetPage(int page_index);
40 CPDFXFA_Page* GetPage(CXFA_FFPageView* pPage); 41 CPDFXFA_Page* GetPage(CXFA_FFPageView* pPage);
41 42
42 void DeletePage(int page_index); 43 void DeletePage(int page_index);
43 void RemovePage(CPDFXFA_Page* page); 44 void RemovePage(CPDFXFA_Page* page);
44 int GetDocType() { return m_iDocType; } 45 int GetDocType() { return m_iDocType; }
45 46
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 FXFA_LOADSTATUS_PRELOAD = 0, 187 FXFA_LOADSTATUS_PRELOAD = 0,
187 FXFA_LOADSTATUS_LOADING, 188 FXFA_LOADSTATUS_LOADING,
188 FXFA_LOADSTATUS_LOADED, 189 FXFA_LOADSTATUS_LOADED,
189 FXFA_LOADSTATUS_CLOSING, 190 FXFA_LOADSTATUS_CLOSING,
190 FXFA_LOADSTATUS_CLOSED 191 FXFA_LOADSTATUS_CLOSED
191 }; 192 };
192 193
193 void CloseXFADoc(CXFA_FFDocHandler* pDoc) { 194 void CloseXFADoc(CXFA_FFDocHandler* pDoc) {
194 if (pDoc) { 195 if (pDoc) {
195 m_pXFADoc->CloseDoc(); 196 m_pXFADoc->CloseDoc();
196 delete m_pXFADoc; 197 m_pXFADoc.reset();
197 m_pXFADoc = nullptr;
198 m_pXFADocView = nullptr; 198 m_pXFADocView = nullptr;
199 } 199 }
200 } 200 }
201 201
202 int m_iDocType; 202 int m_iDocType;
203 CPDF_Document* m_pPDFDoc; 203 CPDF_Document* m_pPDFDoc;
204 CPDFSDK_Document* m_pSDKDoc; 204 std::unique_ptr<CPDFSDK_Document> m_pSDKDoc;
205 CXFA_FFDoc* m_pXFADoc; 205 std::unique_ptr<CXFA_FFDoc> m_pXFADoc;
206 CXFA_FFDocView* m_pXFADocView; 206 CXFA_FFDocView* m_pXFADocView; // not owned.
207 CPDFXFA_App* m_pApp; 207 CPDFXFA_App* const m_pApp;
208 IJS_Context* m_pJSContext; 208 IJS_Context* m_pJSContext;
209 CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList; 209 CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList;
210 LoadStatus m_nLoadStatus; 210 LoadStatus m_nLoadStatus;
211 int m_nPageCount; 211 int m_nPageCount;
212 }; 212 };
213 213
214 #endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_ 214 #endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_DOC_H_
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfxfa/include/fpdfxfa_app.h ('k') | fpdfsdk/include/fsdk_mgr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698