diff options
Diffstat (limited to 'fpdfsdk/include')
-rw-r--r-- | fpdfsdk/include/fsdk_baseannot.h | 4 | ||||
-rw-r--r-- | fpdfsdk/include/fsdk_define.h | 14 | ||||
-rw-r--r-- | fpdfsdk/include/fsdk_mgr.h | 23 |
3 files changed, 31 insertions, 10 deletions
diff --git a/fpdfsdk/include/fsdk_baseannot.h b/fpdfsdk/include/fsdk_baseannot.h index e9a33129b0..441036a657 100644 --- a/fpdfsdk/include/fsdk_baseannot.h +++ b/fpdfsdk/include/fsdk_baseannot.h @@ -15,7 +15,8 @@ #include "core/include/fpdfdoc/fpdf_doc.h" #include "core/include/fxcrt/fx_basic.h" -#include "fx_systemhandler.h" +#include "fpdfsdk/include/fsdk_define.h" +#include "fpdfsdk/include/fx_systemhandler.h" class CPDFSDK_PageView; class CPDF_Annot; @@ -91,6 +92,7 @@ class CPDFSDK_Annot { CPDF_Matrix* pUser2Device, CPDF_RenderOptions* pOptions) {} + UnderlyingPageType* GetUnderlyingPage(); CPDF_Page* GetPDFPage(); CPDFXFA_Page* GetPDFXFAPage(); diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h index 389e8e5098..89c8f6ca6a 100644 --- a/fpdfsdk/include/fsdk_define.h +++ b/fpdfsdk/include/fsdk_define.h @@ -22,6 +22,8 @@ #include "core/include/fpdfdoc/fpdf_vt.h" #include "core/include/fxge/fx_ge.h" #include "core/include/fxge/fx_ge_win32.h" +#include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" +#include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h" #include "public/fpdfview.h" #ifdef _WIN32 @@ -87,6 +89,18 @@ class CFPDF_FileStream : public IFX_FileStream { FX_FILESIZE m_nCurPos; }; +// 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 = CPDFXFA_Document; +using UnderlyingPageType = CPDFXFA_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 709a137899..c35d2ff344 100644 --- a/fpdfsdk/include/fsdk_mgr.h +++ b/fpdfsdk/include/fsdk_mgr.h @@ -35,7 +35,7 @@ class IFX_SystemHandler; class CPDFDoc_Environment final { public: - CPDFDoc_Environment(CPDFXFA_Document* pDoc, FPDF_FORMFILLINFO* pFFinfo); + CPDFDoc_Environment(UnderlyingDocumentType* pDoc, FPDF_FORMFILLINFO* pFFinfo); ~CPDFDoc_Environment(); void Release() { @@ -449,7 +449,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; } - CPDFXFA_Document* GetPDFXFADocument() const { return m_pXFADoc; } + 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; } @@ -465,28 +467,32 @@ class CPDFDoc_Environment final { nonstd::unique_ptr<IJS_Runtime> m_pJSRuntime; FPDF_FORMFILLINFO* const m_pInfo; CPDFSDK_Document* m_pSDKDoc; - CPDFXFA_Document* const m_pXFADoc; + UnderlyingDocumentType* const m_pUnderlyingDoc; nonstd::unique_ptr<CFFL_IFormFiller> m_pIFormFiller; nonstd::unique_ptr<IFX_SystemHandler> m_pSysHandler; }; class CPDFSDK_Document { public: - CPDFSDK_Document(CPDFXFA_Document* pDoc, CPDFDoc_Environment* pEnv); + CPDFSDK_Document(UnderlyingDocumentType* pDoc, CPDFDoc_Environment* pEnv); ~CPDFSDK_Document(); CPDFSDK_InterForm* GetInterForm(); - CPDFXFA_Document* GetDocument() const { return m_pDoc; } + + UnderlyingDocumentType* GetUnderlyingDocument() const { + return GetXFADocument(); + } CPDF_Document* GetPDFDocument() const { return m_pDoc ? m_pDoc->GetPDFDoc() : nullptr; } + CPDFXFA_Document* GetXFADocument() const { return m_pDoc; } int GetPageViewCount() const { return m_pageMap.size(); } - CPDFSDK_PageView* GetPageView(CPDFXFA_Page* pPDFXFAPage, + CPDFSDK_PageView* GetPageView(UnderlyingPageType* pPDFXFAPage, FX_BOOL ReNew = TRUE); CPDFSDK_PageView* GetPageView(int nIndex); CPDFSDK_PageView* GetCurrentView(); - void ReMovePageView(CPDFXFA_Page* pPDFPage); + void RemovePageView(UnderlyingPageType* pPDFPage); void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot); CPDFSDK_Annot* GetFocusAnnot(); @@ -501,7 +507,6 @@ class CPDFSDK_Document { FX_BOOL InsertPages(int nInsertAt, const CPDF_Document* pSrcDoc, const CFX_WordArray& arrSrcPages); - FX_BOOL DeletePages(int nStart, int nCount); FX_BOOL ReplacePages(int nPage, const CPDF_Document* pSrcDoc, const CFX_WordArray& arrSrcPages); @@ -522,7 +527,7 @@ class CPDFSDK_Document { private: std::map<CPDFXFA_Page*, CPDFSDK_PageView*> m_pageMap; - CPDFXFA_Document* m_pDoc; + UnderlyingDocumentType* m_pDoc; nonstd::unique_ptr<CPDFSDK_InterForm> m_pInterForm; CPDFSDK_Annot* m_pFocusAnnot; CPDFDoc_Environment* m_pEnv; |