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

Unified Diff: fpdfsdk/cpdfsdk_formfillenvironment.h

Issue 2410893002: Merge CPDFSDK_Document into CPDFSDK_FormFillEnvironment (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 side-by-side diff with in-line comments
Download patch
Index: fpdfsdk/cpdfsdk_formfillenvironment.h
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h
index e5a693288f54256ad47f98c6b791ffc6ae0ce568..dd0e6bffe141973ef370b959cf96b12a4e1d774f 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.h
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.h
@@ -14,6 +14,7 @@
#include "core/fpdfdoc/cpdf_occontext.h"
#include "core/fxcrt/cfx_observable.h"
#include "fpdfsdk/cfx_systemhandler.h"
+#include "fpdfsdk/cpdfsdk_annot.h"
#include "fpdfsdk/fsdk_define.h"
#include "public/fpdf_formfill.h"
#include "public/fpdf_fwlevent.h"
@@ -22,7 +23,8 @@ class CFFL_InteractiveFormFiller;
class CFX_SystemHandler;
class CPDFSDK_ActionHandler;
class CPDFSDK_AnnotHandlerMgr;
-class CPDFSDK_Document;
+class CPDFSDK_InterForm;
+class CPDFSDK_PageView;
class IJS_Runtime;
class CPDFSDK_FormFillEnvironment
@@ -32,6 +34,68 @@ class CPDFSDK_FormFillEnvironment
FPDF_FORMFILLINFO* pFFinfo);
~CPDFSDK_FormFillEnvironment();
+ CPDFSDK_InterForm* GetInterForm();
Tom Sepez 2016/10/12 18:52:59 nit: const method?
dsinclair 2016/10/12 19:44:29 Can't, creates if doesn't exist. Moved down with o
+
+ // Gets the document object for the next layer down; for master this is
+ // a CPDF_Document, but for XFA it is a CPDFXFA_Document.
+ UnderlyingDocumentType* GetUnderlyingDocument() const {
+#ifdef PDF_ENABLE_XFA
+ return GetXFADocument();
+#else // PDF_ENABLE_XFA
+ return GetPDFDocument();
+#endif // PDF_ENABLE_XFA
+ }
+
+ // Gets the CPDF_Document, either directly in master, or from the
+ // CPDFXFA_Document for XFA.
+ CPDF_Document* GetPDFDocument() const {
+#ifdef PDF_ENABLE_XFA
+ return m_pUnderlyingDoc ? m_pUnderlyingDoc->GetPDFDoc() : nullptr;
+#else // PDF_ENABLE_XFA
+ return m_pUnderlyingDoc;
+#endif // PDF_ENABLE_XFA
+ }
+
+#ifdef PDF_ENABLE_XFA
+ // Gets the XFA document directly (XFA-only).
+ CPDFXFA_Document* GetXFADocument() const { return m_pUnderlyingDoc; }
+ void ResetXFADocument() { m_pUnderlyingDoc = nullptr; }
+
+ int GetPageViewCount() const { return m_pageMap.size(); }
+#endif // PDF_ENABLE_XFA
+
+ CPDFSDK_PageView* GetPageView(UnderlyingPageType* pPage, bool ReNew);
+ CPDFSDK_PageView* GetPageView(int nIndex);
+ CPDFSDK_PageView* GetCurrentView();
+ void RemovePageView(UnderlyingPageType* pPage);
+ void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot);
+
+ CPDFSDK_Annot* GetFocusAnnot() { return m_pFocusAnnot.Get(); }
+ FX_BOOL SetFocusAnnot(CPDFSDK_Annot::ObservedPtr* pAnnot);
+ FX_BOOL KillFocusAnnot(uint32_t nFlag);
+ void ClearAllFocusedAnnots();
+
+ FX_BOOL ExtractPages(const std::vector<uint16_t>& arrExtraPages,
+ CPDF_Document* pDstDoc);
+ FX_BOOL InsertPages(int nInsertAt,
+ const CPDF_Document* pSrcDoc,
+ const std::vector<uint16_t>& arrSrcPages);
+ FX_BOOL ReplacePages(int nPage,
+ const CPDF_Document* pSrcDoc,
+ const std::vector<uint16_t>& arrSrcPages);
+
+ int GetPageCount() { return m_pUnderlyingDoc->GetPageCount(); }
+ FX_BOOL GetPermissions(int nFlag);
+
+ FX_BOOL GetChangeMark() { return m_bChangeMask; }
Tom Sepez 2016/10/12 18:52:59 nit: const method.
dsinclair 2016/10/12 19:44:29 Done.
+ void SetChangeMark() { m_bChangeMask = TRUE; }
+ void ClearChangeMark() { m_bChangeMask = FALSE; }
+
+ UnderlyingPageType* GetPage(int nIndex);
+
+ void ProcJavascriptFun();
+ FX_BOOL ProcOpenAction();
+
void Invalidate(FPDF_PAGE page,
double left,
double top,
@@ -148,10 +212,6 @@ class CPDFSDK_FormFillEnvironment
void JS_docgotoPage(int nPageNum);
FX_BOOL IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; }
- CPDFSDK_Document* GetSDKDocument() const { return m_pSDKDoc.get(); }
- UnderlyingDocumentType* GetUnderlyingDocument() const {
- return m_pUnderlyingDoc;
- }
CFX_ByteString GetAppName() const { return ""; }
CFX_SystemHandler* GetSysHandler() const { return m_pSysHandler.get(); }
FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo; }
@@ -167,10 +227,14 @@ class CPDFSDK_FormFillEnvironment
std::unique_ptr<CPDFSDK_ActionHandler> m_pActionHandler;
std::unique_ptr<IJS_Runtime> m_pJSRuntime;
FPDF_FORMFILLINFO* const m_pInfo;
- std::unique_ptr<CPDFSDK_Document> m_pSDKDoc;
- UnderlyingDocumentType* const m_pUnderlyingDoc;
+ std::map<UnderlyingPageType*, CPDFSDK_PageView*> m_pageMap;
+ std::unique_ptr<CPDFSDK_InterForm> m_pInterForm;
+ CPDFSDK_Annot::ObservedPtr m_pFocusAnnot;
+ UnderlyingDocumentType* m_pUnderlyingDoc;
std::unique_ptr<CFFL_InteractiveFormFiller> m_pFormFiller;
std::unique_ptr<CFX_SystemHandler> m_pSysHandler;
+ FX_BOOL m_bChangeMask;
Tom Sepez 2016/10/12 18:53:00 nit: bool (next line too)
dsinclair 2016/10/12 19:44:29 Done.
+ FX_BOOL m_bBeingDestroyed;
};
#endif // FPDFSDK_CPDFSDK_FORMFILLENVIRONMENT_H_

Powered by Google App Engine
This is Rietveld 408576698