summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfxfa/cpdfxfa_document.h
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-01 11:22:37 -0700
committerCommit bot <commit-bot@chromium.org>2016-11-01 11:22:37 -0700
commit8837c91c0db8f9205b7e58db97946e9af7958b39 (patch)
treeaa23430c284fe741685327e4f4704b2846514c54 /fpdfsdk/fpdfxfa/cpdfxfa_document.h
parentfcb1728c35f97a67fa0297f12bb13d3cafb01fe1 (diff)
downloadpdfium-8837c91c0db8f9205b7e58db97946e9af7958b39.tar.xz
Reland: Make the CPDFXFA_App non-globalchromium/2907
This reverts commit a282c7380f3964de41ea93c9980b12c4513d3473. This CL changes CPDFXFA_App from a global object to a child of the CPDFXFA_Document objects. BUG=pdfium:623 Review-Url: https://codereview.chromium.org/2421603002
Diffstat (limited to 'fpdfsdk/fpdfxfa/cpdfxfa_document.h')
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_document.h20
1 files changed, 6 insertions, 14 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_document.h b/fpdfsdk/fpdfxfa/cpdfxfa_document.h
index de997c16f3..00a9f255ff 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_document.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_document.h
@@ -9,11 +9,11 @@
#include <memory>
+#include "fpdfsdk/fpdfxfa/cpdfxfa_app.h"
#include "fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h"
#include "xfa/fxfa/xfa_ffdoc.h"
class CPDFSDK_FormFillEnvironment;
-class CPDFXFA_App;
class CPDFXFA_Page;
class CXFA_FFDocHandler;
class IJS_Runtime;
@@ -29,8 +29,7 @@ enum LoadStatus {
class CPDFXFA_Document {
public:
- CPDFXFA_Document(std::unique_ptr<CPDF_Document> pPDFDoc,
- CPDFXFA_App* pProvider);
+ CPDFXFA_Document(std::unique_ptr<CPDF_Document> pPDFDoc);
~CPDFXFA_Document();
FX_BOOL LoadXFADoc();
@@ -38,11 +37,10 @@ class CPDFXFA_Document {
CXFA_FFDoc* GetXFADoc() { return m_pXFADoc.get(); }
CXFA_FFDocView* GetXFADocView() { return m_pXFADocView; }
int GetDocType() const { return m_iDocType; }
+ CPDFXFA_App* GetApp(); // Creates if needed.
CPDFSDK_FormFillEnvironment* GetFormFillEnv() const { return m_pFormFillEnv; }
- void SetFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv) {
- m_pFormFillEnv = pFormFillEnv;
- }
+ void SetFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv);
void DeletePage(int page_index);
int GetPageCount() const;
@@ -68,13 +66,7 @@ class CPDFXFA_Document {
CFX_ArrayTemplate<CPDFXFA_Page*>* GetXFAPageList() { return &m_XFAPageList; }
private:
- void CloseXFADoc(CXFA_FFDocHandler* pDoc) {
- if (pDoc) {
- m_pXFADoc->CloseDoc();
- m_pXFADoc.reset();
- m_pXFADocView = nullptr;
- }
- }
+ void CloseXFADoc(CXFA_FFDocHandler* pDoc);
int m_iDocType;
@@ -82,7 +74,7 @@ class CPDFXFA_Document {
std::unique_ptr<CXFA_FFDoc> m_pXFADoc;
CPDFSDK_FormFillEnvironment* m_pFormFillEnv; // not owned.
CXFA_FFDocView* m_pXFADocView; // not owned.
- CPDFXFA_App* const m_pApp;
+ std::unique_ptr<CPDFXFA_App> m_pApp;
CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList;
LoadStatus m_nLoadStatus;
int m_nPageCount;