diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-11-25 16:05:49 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-11-25 16:05:49 -0800 |
commit | 51da093564cdfd32a6ac02ad75e981787a0f1b35 (patch) | |
tree | 9885c9445759de43e45db33a975b79de45b8dd8a /fpdfsdk/include | |
parent | 43dd873cb0e92ca777d3ed9d905bc7955556220b (diff) | |
download | pdfium-51da093564cdfd32a6ac02ad75e981787a0f1b35.tar.xz |
Inflict PDF_ENABLE_XFA ifdefs on XFA fpdfsdk/
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1477583002 .
Diffstat (limited to 'fpdfsdk/include')
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_ComboBox.h | 2 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_FormFiller.h | 2 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_IFormFiller.h | 6 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_TextField.h | 2 | ||||
-rw-r--r-- | fpdfsdk/include/fsdk_annothandler.h | 16 | ||||
-rw-r--r-- | fpdfsdk/include/fsdk_baseannot.h | 12 | ||||
-rw-r--r-- | fpdfsdk/include/fsdk_baseform.h | 33 | ||||
-rw-r--r-- | fpdfsdk/include/fsdk_define.h | 17 | ||||
-rw-r--r-- | fpdfsdk/include/fsdk_mgr.h | 38 | ||||
-rw-r--r-- | fpdfsdk/include/javascript/IJavaScript.h | 4 | ||||
-rw-r--r-- | fpdfsdk/include/jsapi/fxjs_v8.h | 10 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_Edit.h | 2 |
12 files changed, 144 insertions, 0 deletions
diff --git a/fpdfsdk/include/formfiller/FFL_ComboBox.h b/fpdfsdk/include/formfiller/FFL_ComboBox.h index ce244d80bb..f8f5c3c191 100644 --- a/fpdfsdk/include/formfiller/FFL_ComboBox.h +++ b/fpdfsdk/include/formfiller/FFL_ComboBox.h @@ -55,9 +55,11 @@ class CFFL_ComboBox : public CFFL_FormFiller, // IPWL_Edit_Notify: void OnAddUndo(CPWL_Edit* pEdit) override; +#ifdef PDF_ENABLE_XFA // CFFL_FormFiller: FX_BOOL IsFieldFull(CPDFSDK_PageView* pPageView) override; +#endif private: CFX_WideString GetSelectExportText(); diff --git a/fpdfsdk/include/formfiller/FFL_FormFiller.h b/fpdfsdk/include/formfiller/FFL_FormFiller.h index 5cfa2b6878..83b9902aa5 100644 --- a/fpdfsdk/include/formfiller/FFL_FormFiller.h +++ b/fpdfsdk/include/formfiller/FFL_FormFiller.h @@ -120,8 +120,10 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView); virtual void SaveData(CPDFSDK_PageView* pPageView); +#ifdef PDF_ENABLE_XFA virtual FX_BOOL IsFieldFull(CPDFSDK_PageView* pPageView); +#endif CPWL_Wnd* GetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bNew); void DestroyPDFWindow(CPDFSDK_PageView* pPageView); void EscapeFiller(CPDFSDK_PageView* pPageView, FX_BOOL bDestroyPDFWindow); diff --git a/fpdfsdk/include/formfiller/FFL_IFormFiller.h b/fpdfsdk/include/formfiller/FFL_IFormFiller.h index 79a8964626..bfdce10f59 100644 --- a/fpdfsdk/include/formfiller/FFL_IFormFiller.h +++ b/fpdfsdk/include/formfiller/FFL_IFormFiller.h @@ -112,6 +112,7 @@ class CFFL_IFormFiller : public IPWL_Filler_Notify { FX_BOOL& bReset, FX_BOOL& bExit, FX_UINT nFlag); +#ifdef PDF_ENABLE_XFA void OnClick(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bReset, @@ -132,6 +133,7 @@ class CFFL_IFormFiller : public IPWL_Filler_Notify { FX_BOOL& bReset, FX_BOOL& bExit, FX_UINT nFlag); +#endif private: using CFFL_Widget2Filler = std::map<CPDFSDK_Annot*, CFFL_FormFiller*>; @@ -151,17 +153,21 @@ class CFFL_IFormFiller : public IPWL_Filler_Notify { FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag) override; +#ifdef PDF_ENABLE_XFA void OnPopupPreOpen(void* pPrivateData, FX_BOOL& bExit, FX_DWORD nFlag) override; void OnPopupPostOpen(void* pPrivateData, FX_BOOL& bExit, FX_DWORD nFlag) override; +#endif void UnRegisterFormFiller(CPDFSDK_Annot* pAnnot); +#ifdef PDF_ENABLE_XFA void SetFocusAnnotTab(CPDFSDK_Annot* pWidget, FX_BOOL bSameField, FX_BOOL bNext); +#endif CPDFDoc_Environment* m_pApp; CFFL_Widget2Filler m_Maps; diff --git a/fpdfsdk/include/formfiller/FFL_TextField.h b/fpdfsdk/include/formfiller/FFL_TextField.h index 49a0f24e16..a6065fe992 100644 --- a/fpdfsdk/include/formfiller/FFL_TextField.h +++ b/fpdfsdk/include/formfiller/FFL_TextField.h @@ -56,9 +56,11 @@ class CFFL_TextField : public CFFL_FormFiller, // IPWL_Edit_Notify: void OnAddUndo(CPWL_Edit* pEdit) override; +#ifdef PDF_ENABLE_XFA // CFFL_FormFiller: FX_BOOL IsFieldFull(CPDFSDK_PageView* pPageView) override; +#endif private: CBA_FontMap* m_pFontMap; FFL_TextFieldState m_State; diff --git a/fpdfsdk/include/fsdk_annothandler.h b/fpdfsdk/include/fsdk_annothandler.h index 19051ee8de..d43bc7b7e9 100644 --- a/fpdfsdk/include/fsdk_annothandler.h +++ b/fpdfsdk/include/fsdk_annothandler.h @@ -12,8 +12,10 @@ #include "core/include/fxcrt/fx_basic.h" +#ifdef PDF_ENABLE_XFA #define FSDK_XFAWIDGET_TYPENAME "XFAWidget" +#endif class CFFL_IFormFiller; class CFX_RenderDevice; class CPDFDoc_Environment; @@ -37,9 +39,11 @@ class IPDFSDK_AnnotHandler { virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) = 0; +#ifdef PDF_ENABLE_XFA virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* hWidget, CPDFSDK_PageView* pPage) = 0; +#endif virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot) = 0; virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) = 0; @@ -124,8 +128,10 @@ class IPDFSDK_AnnotHandler { virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0; virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0; +#ifdef PDF_ENABLE_XFA virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, CPDFSDK_Annot* pNewAnnot) = 0; +#endif }; class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler { @@ -139,8 +145,10 @@ class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler { CFX_ByteString GetName() override { return CFX_ByteString("WidgetHandler"); } FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override; CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override; +#ifdef PDF_ENABLE_XFA CPDFSDK_Annot* NewAnnot(IXFA_Widget* hWidget, CPDFSDK_PageView* pPage) override; +#endif void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override; void DeleteAnnot(CPDFSDK_Annot* pAnnot) override {} CPDF_Rect GetViewBBox(CPDFSDK_PageView* pPageView, @@ -213,10 +221,12 @@ class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler { void OnSelected(CPDFSDK_Annot* pAnnot) override {} FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) override; FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) override; +#ifdef PDF_ENABLE_XFA FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, CPDFSDK_Annot* pNewAnnot) override { return TRUE; } +#endif void SetFormFiller(CFFL_IFormFiller* pFiller) { m_pFormFiller = pFiller; } CFFL_IFormFiller* GetFormFiller() { return m_pFormFiller; } @@ -226,6 +236,7 @@ class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler { CFFL_IFormFiller* m_pFormFiller; }; +#ifdef PDF_ENABLE_XFA class CPDFSDK_XFAAnnotHandler : public IPDFSDK_AnnotHandler { public: explicit CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp); @@ -339,6 +350,7 @@ class CPDFSDK_XFAAnnotHandler : public IPDFSDK_AnnotHandler { CPDFDoc_Environment* m_pApp; }; +#endif #define CBA_AnnotHandlerArray CFX_ArrayTemplate<IPDFSDK_AnnotHandler*> class CPDFSDK_AnnotHandlerMgr { public: @@ -352,8 +364,10 @@ class CPDFSDK_AnnotHandlerMgr { virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView); +#ifdef PDF_ENABLE_XFA virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* pAnnot, CPDFSDK_PageView* pPageView); +#endif virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot); virtual void Annot_OnCreate(CPDFSDK_Annot* pAnnot); @@ -415,8 +429,10 @@ class CPDFSDK_AnnotHandlerMgr { virtual FX_BOOL Annot_OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag); virtual FX_BOOL Annot_OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag); +#ifdef PDF_ENABLE_XFA virtual FX_BOOL Annot_OnChangeFocus(CPDFSDK_Annot* pSetAnnot, CPDFSDK_Annot* pKillAnnot); +#endif virtual CPDF_Rect Annot_OnGetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot); diff --git a/fpdfsdk/include/fsdk_baseannot.h b/fpdfsdk/include/fsdk_baseannot.h index 441036a657..ce65383e6b 100644 --- a/fpdfsdk/include/fsdk_baseannot.h +++ b/fpdfsdk/include/fsdk_baseannot.h @@ -16,7 +16,11 @@ #include "core/include/fpdfdoc/fpdf_doc.h" #include "core/include/fxcrt/fx_basic.h" #include "fpdfsdk/include/fsdk_define.h" +#ifndef PDF_ENABLE_XFA +#include "fx_systemhandler.h" +#else #include "fpdfsdk/include/fx_systemhandler.h" +#endif class CPDFSDK_PageView; class CPDF_Annot; @@ -72,15 +76,19 @@ class CPDFSDK_Annot { explicit CPDFSDK_Annot(CPDFSDK_PageView* pPageView); virtual ~CPDFSDK_Annot() {} +#ifdef PDF_ENABLE_XFA virtual FX_BOOL IsXFAField() { return FALSE; } +#endif virtual FX_FLOAT GetMinWidth() const; virtual FX_FLOAT GetMinHeight() const; // define layout order to 5. virtual int GetLayoutOrder() const { return 5; } virtual CPDF_Annot* GetPDFAnnot() const { return nullptr; } +#ifdef PDF_ENABLE_XFA virtual IXFA_Widget* GetXFAWidget() const { return nullptr; } +#endif virtual CFX_ByteString GetType() const { return ""; } virtual CFX_ByteString GetSubType() const { return ""; } @@ -94,7 +102,9 @@ class CPDFSDK_Annot { UnderlyingPageType* GetUnderlyingPage(); CPDF_Page* GetPDFPage(); +#ifdef PDF_ENABLE_XFA CPDFXFA_Page* GetPDFXFAPage(); +#endif void SetPage(CPDFSDK_PageView* pPageView) { m_pPageView = pPageView; } CPDFSDK_PageView* GetPageView() const { return m_pPageView; } @@ -118,7 +128,9 @@ class CPDFSDK_BAAnnot : public CPDFSDK_Annot { CPDFSDK_BAAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView); ~CPDFSDK_BAAnnot() override {} +#ifdef PDF_ENABLE_XFA FX_BOOL IsXFAField() override; +#endif CFX_ByteString GetType() const override; CFX_ByteString GetSubType() const override; void SetRect(const CPDF_Rect& rect) override; diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h index e648558a3a..0b6a04eb52 100644 --- a/fpdfsdk/include/fsdk_baseform.h +++ b/fpdfsdk/include/fsdk_baseform.h @@ -31,6 +31,7 @@ class CPDF_Action; class CPDF_FormField; struct CPWL_Color; +#ifdef PDF_ENABLE_XFA typedef enum _PDFSDK_XFAAActionType { PDFSDK_XFA_Click = 0, PDFSDK_XFA_Full, @@ -38,6 +39,7 @@ typedef enum _PDFSDK_XFAAActionType { PDFSDK_XFA_PostOpen } PDFSDK_XFAAActionType; +#endif typedef struct _PDFSDK_FieldAction { _PDFSDK_FieldAction() { bModifier = FALSE; @@ -66,6 +68,7 @@ typedef struct _PDFSDK_FieldAction { class CPDFSDK_Widget : public CPDFSDK_BAAnnot { public: +#ifdef PDF_ENABLE_XFA IXFA_Widget* GetMixXFAWidget() const; IXFA_Widget* GetGroupMixXFAWidget(); IXFA_WidgetHandler* GetXFAWidgetHandler() const; @@ -88,6 +91,7 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot { CPDF_FormField* pFormField, CPDF_FormControl* pFormControl); +#endif CPDFSDK_Widget(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView, CPDFSDK_InterForm* pInterForm); @@ -115,7 +119,11 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot { FX_FLOAT GetFontSize() const; int GetSelectedIndex(int nIndex) const; +#ifndef PDF_ENABLE_XFA + CFX_WideString GetValue() const; +#else CFX_WideString GetValue(FX_BOOL bDisplay = TRUE) const; +#endif CFX_WideString GetDefaultValue() const; CFX_WideString GetOptionLabel(int nIndex) const; int CountOptions() const; @@ -129,7 +137,9 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot { */ int GetAlignment() const; int GetMaxLen() const; +#ifdef PDF_ENABLE_XFA CFX_WideString GetName() const; +#endif CFX_WideString GetAlternateName() const; // Set Properties. @@ -140,7 +150,9 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot { void ClearSelection(FX_BOOL bNotify); void SetTopVisibleIndex(int index); +#ifdef PDF_ENABLE_XFA void ResetAppearance(FX_BOOL bValueChanged); +#endif void ResetAppearance(const FX_WCHAR* sValue, FX_BOOL bValueChanged); void ResetFieldAppearance(FX_BOOL bValueChanged); void UpdateField(); @@ -197,15 +209,21 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot { FX_BOOL HitTest(FX_FLOAT pageX, FX_FLOAT pageY); +#ifndef PDF_ENABLE_XFA + private: +#endif CPDFSDK_InterForm* m_pInterForm; FX_BOOL m_bAppModified; int32_t m_nAppAge; int32_t m_nValueAge; +#ifdef PDF_ENABLE_XFA mutable IXFA_Widget* m_hMixXFAWidget; mutable IXFA_WidgetHandler* m_pWidgetHandler; +#endif }; +#ifdef PDF_ENABLE_XFA class CPDFSDK_XFAWidget : public CPDFSDK_Annot { public: CPDFSDK_XFAWidget(IXFA_Widget* pAnnot, @@ -230,6 +248,7 @@ class CPDFSDK_XFAWidget : public CPDFSDK_Annot { CFX_MapPtrTemplate<IXFA_Widget*, CPDFSDK_XFAWidget*> #define CPDFSDK_FieldSynchronizeMap CFX_MapPtrTemplate<CPDF_FormField*, int> +#endif class CPDFSDK_InterForm : public CPDF_FormNotify { public: explicit CPDFSDK_InterForm(CPDFSDK_Document* pDocument); @@ -250,19 +269,23 @@ class CPDFSDK_InterForm : public CPDF_FormNotify { void AddMap(CPDF_FormControl* pControl, CPDFSDK_Widget* pWidget); void RemoveMap(CPDF_FormControl* pControl); +#ifdef PDF_ENABLE_XFA void AddXFAMap(IXFA_Widget* hWidget, CPDFSDK_XFAWidget* pWidget); void RemoveXFAMap(IXFA_Widget* hWidget); CPDFSDK_XFAWidget* GetXFAWidget(IXFA_Widget* hWidget); +#endif void EnableCalculate(FX_BOOL bEnabled); FX_BOOL IsCalculateEnabled() const; +#ifdef PDF_ENABLE_XFA void XfaEnableCalculate(FX_BOOL bEnabled); FX_BOOL IsXfaCalculateEnabled() const; FX_BOOL IsXfaValidationsEnabled(); void XfaSetValidationsEnabled(FX_BOOL bEnabled); +#endif #ifdef _WIN32 CPDF_Stream* LoadImageFromFile(const CFX_WideString& sFile); #endif @@ -300,8 +323,10 @@ class CPDFSDK_InterForm : public CPDF_FormNotify { CFX_ByteTextBuf& textBuf); CFX_WideString GetTemporaryFileName(const CFX_WideString& sFileExt); +#ifdef PDF_ENABLE_XFA void SynchronizeField(CPDF_FormField* pFormField, FX_BOOL bSynchronizeElse); +#endif private: // CPDF_FormNotify int BeforeValueChange(const CPDF_FormField* pField, @@ -328,11 +353,15 @@ class CPDFSDK_InterForm : public CPDF_FormNotify { CPDFSDK_Document* m_pDocument; CPDF_InterForm* m_pInterForm; CPDFSDK_WidgetMap m_Map; +#ifdef PDF_ENABLE_XFA CPDFSDK_XFAWidgetMap m_XFAMap; CPDFSDK_FieldSynchronizeMap m_FieldSynchronizeMap; +#endif FX_BOOL m_bCalculate; +#ifdef PDF_ENABLE_XFA FX_BOOL m_bXfaCalculate; FX_BOOL m_bXfaValidationsEnabled; +#endif FX_BOOL m_bBusy; public: @@ -344,7 +373,11 @@ class CPDFSDK_InterForm : public CPDF_FormNotify { FX_COLORREF GetHighlightColor(int nFieldType); private: +#ifndef PDF_ENABLE_XFA + static const int kNumFieldTypes = 6; +#else static const int kNumFieldTypes = 7; +#endif FX_COLORREF m_aHighlightColor[kNumFieldTypes]; uint8_t m_iHighlightAlpha; FX_BOOL m_bNeedHightlight[kNumFieldTypes]; diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h index 89c8f6ca6a..4dfe5c2840 100644 --- a/fpdfsdk/include/fsdk_define.h +++ b/fpdfsdk/include/fsdk_define.h @@ -7,23 +7,31 @@ #ifndef FPDFSDK_INCLUDE_FSDK_DEFINE_H_ #define FPDFSDK_INCLUDE_FSDK_DEFINE_H_ +#ifndef PDF_ENABLE_XFA +#include "core/include/fpdfapi/fpdfapi.h" +#else #include "../../xfa/include/fwl/adapter/fwl_adaptertimermgr.h" #include "../../xfa/include/fxbarcode/BC_BarCode.h" #include "../../xfa/include/fxfa/fxfa.h" #include "../../xfa/include/fxgraphics/fx_graphics.h" #include "../../xfa/include/fxjse/fxjse.h" +#endif #include "core/include/fpdfapi/fpdf_module.h" #include "core/include/fpdfapi/fpdf_pageobj.h" #include "core/include/fpdfapi/fpdf_parser.h" #include "core/include/fpdfapi/fpdf_render.h" #include "core/include/fpdfapi/fpdf_serial.h" +#ifdef PDF_ENABLE_XFA #include "core/include/fpdfapi/fpdfapi.h" +#endif #include "core/include/fpdfdoc/fpdf_doc.h" #include "core/include/fpdfdoc/fpdf_vt.h" #include "core/include/fxge/fx_ge.h" #include "core/include/fxge/fx_ge_win32.h" +#ifdef PDF_ENABLE_XFA #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h" +#endif #include "public/fpdfview.h" #ifdef _WIN32 @@ -55,12 +63,15 @@ class CPDF_CustomAccess final : public IFX_FileRead { void Release() override { delete this; } FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; +#ifdef PDF_ENABLE_XFA virtual CFX_ByteString GetFullPath() { return ""; } virtual FX_BOOL GetByte(FX_DWORD pos, uint8_t& ch); virtual FX_BOOL GetBlock(FX_DWORD pos, uint8_t* pBuf, FX_DWORD size); +#endif private: FPDF_FILEACCESS m_FileAccess; +#ifdef PDF_ENABLE_XFA uint8_t m_Buffer[512]; FX_DWORD m_BufferOffset; }; @@ -87,13 +98,19 @@ class CFPDF_FileStream : public IFX_FileStream { protected: FPDF_FILEHANDLER* m_pFS; FX_FILESIZE m_nCurPos; +#endif }; // 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. +#ifndef PDF_ENABLE_XFA +using UnderlyingDocumentType = CPDF_Document; +using UnderlyingPageType = CPDF_Page; +#else using UnderlyingDocumentType = CPDFXFA_Document; using UnderlyingPageType = CPDFXFA_Page; +#endif // Conversions to/from underlying types. UnderlyingDocumentType* UnderlyingFromFPDFDocument(FPDF_DOCUMENT doc); diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h index 3fc40ba085..4b217f1ad3 100644 --- a/fpdfsdk/include/fsdk_mgr.h +++ b/fpdfsdk/include/fsdk_mgr.h @@ -10,8 +10,10 @@ #include <map> #include "core/include/fpdftext/fpdf_text.h" +#ifdef PDF_ENABLE_XFA #include "fpdfxfa/fpdfxfa_doc.h" #include "fpdfxfa/fpdfxfa_page.h" +#endif #include "fsdk_actionhandler.h" #include "fsdk_annothandler.h" #include "fsdk_baseannot.h" @@ -38,12 +40,14 @@ class CPDFDoc_Environment final { CPDFDoc_Environment(UnderlyingDocumentType* pDoc, FPDF_FORMFILLINFO* pFFinfo); ~CPDFDoc_Environment(); +#ifdef PDF_ENABLE_XFA void Release() { if (m_pInfo && m_pInfo->Release) m_pInfo->Release(m_pInfo); delete this; } +#endif void FFI_Invalidate(FPDF_PAGE page, double left, double top, @@ -208,6 +212,7 @@ class CPDFDoc_Environment final { sizeOfArray); } +#ifdef PDF_ENABLE_XFA void FFI_DisplayCaret(FPDF_PAGE page, FPDF_BOOL bVisible, double left, @@ -446,6 +451,7 @@ class CPDFDoc_Environment final { return L""; } +#endif 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; } @@ -482,19 +488,29 @@ class CPDFSDK_Document { // 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 { +#ifndef PDF_ENABLE_XFA + return GetPDFDocument(); +#else return GetXFADocument(); +#endif } // Gets the CPDF_Document, either directly in master, or from the // CPDFXFA_Document for XFA. +#ifndef PDF_ENABLE_XFA + CPDF_Document* GetPDFDocument() const { return m_pDoc; } +#else CPDF_Document* GetPDFDocument() const { return m_pDoc ? m_pDoc->GetPDFDoc() : nullptr; } // Gets the XFA document directly (XFA-only). CPDFXFA_Document* GetXFADocument() const { return m_pDoc; } +#endif +#ifdef PDF_ENABLE_XFA int GetPageViewCount() const { return m_pageMap.size(); } +#endif CPDFSDK_PageView* GetPageView(UnderlyingPageType* pPage, FX_BOOL ReNew = TRUE); CPDFSDK_PageView* GetPageView(int nIndex); @@ -548,8 +564,12 @@ class CPDFSDK_PageView final { ~CPDFSDK_PageView(); void PageView_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, +#ifndef PDF_ENABLE_XFA + CPDF_RenderOptions* pOptions); +#else CPDF_RenderOptions* pOptions, const FX_RECT& pClip); +#endif const CPDF_Annot* GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); CPDFSDK_Annot* GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); const CPDF_Annot* GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); @@ -567,20 +587,28 @@ class CPDFSDK_PageView final { CPDFSDK_Annot* AddAnnot(CPDF_Dictionary* pDict); CPDFSDK_Annot* AddAnnot(const FX_CHAR* lpSubType, CPDF_Dictionary* pDict); CPDFSDK_Annot* AddAnnot(CPDF_Annot* pPDFAnnot); +#ifdef PDF_ENABLE_XFA CPDFSDK_Annot* AddAnnot(IXFA_Widget* pPDFAnnot); +#endif FX_BOOL DeleteAnnot(CPDFSDK_Annot* pAnnot); size_t CountAnnots() const; CPDFSDK_Annot* GetAnnot(size_t nIndex); CPDFSDK_Annot* GetAnnotByDict(CPDF_Dictionary* pDict); +#ifndef PDF_ENABLE_XFA + CPDF_Page* GetPDFPage() { return m_page; } +#else CPDFSDK_Annot* GetAnnotByXFAWidget(IXFA_Widget* hWidget); CPDFXFA_Page* GetPDFXFAPage() { return m_page; } CPDF_Page* GetPDFPage(); +#endif CPDF_Document* GetPDFDocument(); CPDFSDK_Document* GetSDKDocument() { return m_pSDKDoc; } FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_UINT nFlag); FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_UINT nFlag); +#ifdef PDF_ENABLE_XFA FX_BOOL OnRButtonDown(const CPDF_Point& point, FX_UINT nFlag); FX_BOOL OnRButtonUp(const CPDF_Point& point, FX_UINT nFlag); +#endif FX_BOOL OnChar(int nChar, FX_UINT nFlag); FX_BOOL OnKeyDown(int nKeyCode, int nFlag); FX_BOOL OnKeyUp(int nKeyCode, int nFlag); @@ -604,6 +632,9 @@ class CPDFSDK_PageView final { FX_BOOL IsValid() { return m_bValid; } void SetLock(FX_BOOL bLocked) { m_bLocked = bLocked; } FX_BOOL IsLocked() { return m_bLocked; } +#ifndef PDF_ENABLE_XFA + void TakeOverPage() { m_bTakeOverPage = TRUE; } +#endif private: void PageView_OnHighlightFormFields(CFX_RenderDevice* pDevice, @@ -614,12 +645,19 @@ class CPDFSDK_PageView final { nonstd::unique_ptr<CPDF_AnnotList> m_pAnnotList; std::vector<CPDFSDK_Annot*> m_fxAnnotArray; CPDFSDK_Document* m_pSDKDoc; +#ifndef PDF_ENABLE_XFA + CPDFSDK_Widget* m_CaptureWidget; +#else CPDFSDK_Annot* m_CaptureWidget; +#endif FX_BOOL m_bEnterWidget; FX_BOOL m_bExitWidget; FX_BOOL m_bOnWidget; FX_BOOL m_bValid; FX_BOOL m_bLocked; +#ifndef PDF_ENABLE_XFA + FX_BOOL m_bTakeOverPage; +#endif }; template <class TYPE> diff --git a/fpdfsdk/include/javascript/IJavaScript.h b/fpdfsdk/include/javascript/IJavaScript.h index f654696fc8..7eab25fe88 100644 --- a/fpdfsdk/include/javascript/IJavaScript.h +++ b/fpdfsdk/include/javascript/IJavaScript.h @@ -7,7 +7,9 @@ #ifndef FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ #define FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ +#ifdef PDF_ENABLE_XFA #include "../../../xfa/include/fxjse/fxjse.h" +#endif #include "core/include/fxcrt/fx_string.h" #include "core/include/fxcrt/fx_system.h" @@ -149,11 +151,13 @@ class IJS_Runtime { const wchar_t* script, CFX_WideString* info) = 0; +#ifdef PDF_ENABLE_XFA virtual FX_BOOL GetHValueByName(const CFX_ByteStringC& utf8Name, FXJSE_HVALUE hValue) = 0; virtual FX_BOOL SetHValueByName(const CFX_ByteStringC& utf8Name, FXJSE_HVALUE hValue) = 0; +#endif protected: IJS_Runtime() {} }; diff --git a/fpdfsdk/include/jsapi/fxjs_v8.h b/fpdfsdk/include/jsapi/fxjs_v8.h index 97f96f6c5f..992721e90a 100644 --- a/fpdfsdk/include/jsapi/fxjs_v8.h +++ b/fpdfsdk/include/jsapi/fxjs_v8.h @@ -27,10 +27,12 @@ class CFXJS_ObjDefinition; class IJS_Context; // A description of the event that caused JS execution. class IJS_Runtime; // A native runtime, typically owns the v8::Context. +#ifdef PDF_ENABLE_XFA // FXJS_V8 places no interpreation on this calass; it merely passes it // along to XFA. class CFXJSE_RuntimeData; +#endif enum FXJSOBJTYPE { FXJSOBJTYPE_DYNAMIC = 0, // Created by native method and returned to JS. FXJSOBJTYPE_STATIC, // Created by init and hung off of global object. @@ -49,10 +51,16 @@ class FXJS_PerIsolateData { static FXJS_PerIsolateData* Get(v8::Isolate* pIsolate); std::vector<CFXJS_ObjDefinition*> m_ObjectDefnArray; +#ifdef PDF_ENABLE_XFA CFXJSE_RuntimeData* m_pFXJSERuntimeData; +#endif protected: +#ifndef PDF_ENABLE_XFA + FXJS_PerIsolateData() {} +#else FXJS_PerIsolateData() : m_pFXJSERuntimeData(nullptr) {} +#endif }; extern const wchar_t kFXJSValueNameString[]; @@ -137,11 +145,13 @@ void FXJS_ReleaseRuntime(v8::Isolate* pIsolate, std::vector<v8::Global<v8::Object>*>* pStaticObjects); IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate); +#ifdef PDF_ENABLE_XFA // Called as part of FXJS_InitializeRuntime, exposed so PDF can make its // own contexts compatible with XFA or vice versa. void FXJS_SetRuntimeForV8Context(v8::Local<v8::Context> v8Context, IJS_Runtime* pIRuntime); +#endif // Called after FXJS_InitializeRuntime call made. int FXJS_Execute(v8::Isolate* pIsolate, IJS_Context* pJSContext, diff --git a/fpdfsdk/include/pdfwindow/PWL_Edit.h b/fpdfsdk/include/pdfwindow/PWL_Edit.h index 1a8db7860c..edb605c07e 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Edit.h +++ b/fpdfsdk/include/pdfwindow/PWL_Edit.h @@ -33,6 +33,7 @@ class IPWL_Filler_Notify { FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag) = 0; +#ifdef PDF_ENABLE_XFA virtual void OnPopupPreOpen(void* pPrivateData, FX_BOOL& bExit, @@ -40,6 +41,7 @@ class IPWL_Filler_Notify { virtual void OnPopupPostOpen(void* pPrivateData, FX_BOOL& bExit, FX_DWORD nFlag) = 0; +#endif }; class CPWL_Edit : public CPWL_EditCtrl, public IFX_Edit_OprNotify { |