diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-11-24 13:31:52 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-11-24 13:31:52 -0800 |
commit | 55dd8546ebc365b3778b40ba9d82879f581503e1 (patch) | |
tree | 7a1b79587122d31fd2ba91c75b7ad1d166116b8c /fpdfsdk/include | |
parent | abea9d857e8e197d0095940f882b0db6a785d825 (diff) | |
download | pdfium-55dd8546ebc365b3778b40ba9d82879f581503e1.tar.xz |
Add "Underlying types" to master.
Change some master code to line up better with XFA, so
that the XFA changes are additive when possible, rather
than replacements.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1468253005 .
Diffstat (limited to 'fpdfsdk/include')
-rw-r--r-- | fpdfsdk/include/fsdk_baseannot.h | 2 | ||||
-rw-r--r-- | fpdfsdk/include/fsdk_define.h | 12 | ||||
-rw-r--r-- | fpdfsdk/include/fsdk_mgr.h | 29 |
3 files changed, 31 insertions, 12 deletions
diff --git a/fpdfsdk/include/fsdk_baseannot.h b/fpdfsdk/include/fsdk_baseannot.h index 2e54096c76..f747f8576b 100644 --- a/fpdfsdk/include/fsdk_baseannot.h +++ b/fpdfsdk/include/fsdk_baseannot.h @@ -15,6 +15,7 @@ #include "core/include/fpdfdoc/fpdf_doc.h" #include "core/include/fxcrt/fx_basic.h" +#include "fpdfsdk/include/fsdk_define.h" #include "fx_systemhandler.h" class CPDFSDK_PageView; @@ -88,6 +89,7 @@ class CPDFSDK_Annot { CPDF_Matrix* pUser2Device, CPDF_RenderOptions* pOptions) {} + UnderlyingPageType* GetUnderlyingPage(); CPDF_Page* GetPDFPage(); void SetPage(CPDFSDK_PageView* pPageView) { m_pPageView = pPageView; } diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h index bca7805226..980411c27b 100644 --- a/fpdfsdk/include/fsdk_define.h +++ b/fpdfsdk/include/fsdk_define.h @@ -52,6 +52,18 @@ class CPDF_CustomAccess final : public IFX_FileRead { FPDF_FILEACCESS m_FileAccess; }; +// Object types for public FPDF_ types; these correspond to next layer down +// from fpdfsdk. For master, these are CPDF_ types, but for XFA, these are +// CPDFXFA_ types. +using UnderlyingDocumentType = CPDF_Document; +using UnderlyingPageType = CPDF_Page; + +// Conversions to/from underlying types. +UnderlyingDocumentType* UnderlyingFromFPDFDocument(FPDF_DOCUMENT doc); +FPDF_DOCUMENT FPDFDocumentFromUnderlying(UnderlyingDocumentType* doc); + +UnderlyingPageType* UnderlyingFromFPDFPage(FPDF_PAGE page); + // Conversions to/from FPDF_ types. CPDF_Document* CPDFDocumentFromFPDFDocument(FPDF_DOCUMENT doc); FPDF_DOCUMENT FPDFDocumentFromCPDFDocument(CPDF_Document* doc); diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h index b7b349197a..a4385be318 100644 --- a/fpdfsdk/include/fsdk_mgr.h +++ b/fpdfsdk/include/fsdk_mgr.h @@ -33,7 +33,7 @@ class IFX_SystemHandler; class CPDFDoc_Environment final { public: - CPDFDoc_Environment(CPDF_Document* pDoc, FPDF_FORMFILLINFO* pFFinfo); + CPDFDoc_Environment(UnderlyingDocumentType* pDoc, FPDF_FORMFILLINFO* pFFinfo); ~CPDFDoc_Environment(); void FFI_Invalidate(FPDF_PAGE page, @@ -203,7 +203,9 @@ class CPDFDoc_Environment final { FX_BOOL IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; } void SetSDKDocument(CPDFSDK_Document* pFXDoc) { m_pSDKDoc = pFXDoc; } CPDFSDK_Document* GetSDKDocument() const { return m_pSDKDoc; } - CPDF_Document* GetPDFDocument() const { return m_pPDFDoc; } + UnderlyingDocumentType* GetUnderlyingDocument() const { + return m_pUnderlyingDoc; + } CFX_ByteString GetAppName() const { return ""; } IFX_SystemHandler* GetSysHandler() const { return m_pSysHandler.get(); } FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo; } @@ -219,30 +221,33 @@ class CPDFDoc_Environment final { nonstd::unique_ptr<IJS_Runtime> m_pJSRuntime; FPDF_FORMFILLINFO* const m_pInfo; CPDFSDK_Document* m_pSDKDoc; - CPDF_Document* const m_pPDFDoc; + UnderlyingDocumentType* const m_pUnderlyingDoc; nonstd::unique_ptr<CFFL_IFormFiller> m_pIFormFiller; nonstd::unique_ptr<IFX_SystemHandler> m_pSysHandler; }; class CPDFSDK_Document { public: - CPDFSDK_Document(CPDF_Document* pDoc, CPDFDoc_Environment* pEnv); + CPDFSDK_Document(UnderlyingDocumentType* pDoc, CPDFDoc_Environment* pEnv); ~CPDFSDK_Document(); CPDFSDK_InterForm* GetInterForm(); // Gets the document object for the next layer down; for master this is // a CPDF_Document, but for XFA it is a CPDFXFA_Document. - CPDF_Document* GetDocument() const { return m_pDoc; } + UnderlyingDocumentType* GetUnderlyingDocument() const { + return GetPDFDocument(); + } // Gets the CPDF_Document, either directly in master, or from the // CPDFXFA_Document for XFA. CPDF_Document* GetPDFDocument() const { return m_pDoc; } - CPDFSDK_PageView* GetPageView(CPDF_Page* pPDFPage, FX_BOOL ReNew = TRUE); + CPDFSDK_PageView* GetPageView(UnderlyingPageType* pPage, + FX_BOOL ReNew = TRUE); CPDFSDK_PageView* GetPageView(int nIndex); CPDFSDK_PageView* GetCurrentView(); - void ReMovePageView(CPDF_Page* pPDFPage); + void RemovePageView(UnderlyingPageType* pPage); void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot); CPDFSDK_Annot* GetFocusAnnot(); @@ -269,15 +274,15 @@ class CPDFSDK_Document { void SetChangeMark() { m_bChangeMask = TRUE; } void ClearChangeMark() { m_bChangeMask = FALSE; } CFX_WideString GetPath(); - CPDF_Page* GetPage(int nIndex); + UnderlyingPageType* GetPage(int nIndex); CPDFDoc_Environment* GetEnv() { return m_pEnv; } void ProcJavascriptFun(); FX_BOOL ProcOpenAction(); CPDF_OCContext* GetOCContext(); private: - std::map<CPDF_Page*, CPDFSDK_PageView*> m_pageMap; - CPDF_Document* m_pDoc; + std::map<UnderlyingPageType*, CPDFSDK_PageView*> m_pageMap; + UnderlyingDocumentType* m_pDoc; nonstd::unique_ptr<CPDFSDK_InterForm> m_pInterForm; CPDFSDK_Annot* m_pFocusAnnot; CPDFDoc_Environment* m_pEnv; @@ -287,7 +292,7 @@ class CPDFSDK_Document { }; class CPDFSDK_PageView final { public: - CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc, CPDF_Page* page); + CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc, UnderlyingPageType* page); ~CPDFSDK_PageView(); void PageView_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, @@ -348,7 +353,7 @@ class CPDFSDK_PageView final { CPDFSDK_Widget* pWidget); CPDF_Matrix m_curMatrix; - CPDF_Page* m_page; + UnderlyingPageType* m_page; nonstd::unique_ptr<CPDF_AnnotList> m_pAnnotList; std::vector<CPDFSDK_Annot*> m_fxAnnotArray; CPDFSDK_Document* m_pSDKDoc; |