summaryrefslogtreecommitdiff
path: root/fpdfsdk/include
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-11-30 12:39:54 -0800
committerTom Sepez <tsepez@chromium.org>2015-11-30 12:39:54 -0800
commit40e9ff30b7f22b37c071dc9751f489d4cc22b0ee (patch)
tree33f50b65518fcb32bc197adc94bb0073244113e1 /fpdfsdk/include
parentd029d934e1a23aadc07cc99753a55b308f20ef2b (diff)
downloadpdfium-40e9ff30b7f22b37c071dc9751f489d4cc22b0ee.tar.xz
Tidy PDF_ENABLE_XFA #ifdefs in fpdfsdk.
-- label matching #endifs -- prefer #ifdef over #ifndef -- consolidate some blocks. R=ochang@chromium.org Review URL: https://codereview.chromium.org/1484843002 .
Diffstat (limited to 'fpdfsdk/include')
-rw-r--r--fpdfsdk/include/formfiller/FFL_ComboBox.h2
-rw-r--r--fpdfsdk/include/formfiller/FFL_FormFiller.h2
-rw-r--r--fpdfsdk/include/formfiller/FFL_IFormFiller.h9
-rw-r--r--fpdfsdk/include/formfiller/FFL_TextField.h2
-rw-r--r--fpdfsdk/include/fsdk_annothandler.h17
-rw-r--r--fpdfsdk/include/fsdk_baseannot.h14
-rw-r--r--fpdfsdk/include/fsdk_baseform.h44
-rw-r--r--fpdfsdk/include/fsdk_define.h31
-rw-r--r--fpdfsdk/include/fsdk_mgr.h77
-rw-r--r--fpdfsdk/include/javascript/IJavaScript.h9
-rw-r--r--fpdfsdk/include/jsapi/fxjs_v8.h10
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_Edit.h3
12 files changed, 106 insertions, 114 deletions
diff --git a/fpdfsdk/include/formfiller/FFL_ComboBox.h b/fpdfsdk/include/formfiller/FFL_ComboBox.h
index f8f5c3c191..5c36779df7 100644
--- a/fpdfsdk/include/formfiller/FFL_ComboBox.h
+++ b/fpdfsdk/include/formfiller/FFL_ComboBox.h
@@ -58,8 +58,8 @@ class CFFL_ComboBox : public CFFL_FormFiller,
#ifdef PDF_ENABLE_XFA
// CFFL_FormFiller:
FX_BOOL IsFieldFull(CPDFSDK_PageView* pPageView) override;
+#endif // PDF_ENABLE_XFA
-#endif
private:
CFX_WideString GetSelectExportText();
diff --git a/fpdfsdk/include/formfiller/FFL_FormFiller.h b/fpdfsdk/include/formfiller/FFL_FormFiller.h
index 83b9902aa5..989d17e00a 100644
--- a/fpdfsdk/include/formfiller/FFL_FormFiller.h
+++ b/fpdfsdk/include/formfiller/FFL_FormFiller.h
@@ -122,8 +122,8 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler {
#ifdef PDF_ENABLE_XFA
virtual FX_BOOL IsFieldFull(CPDFSDK_PageView* pPageView);
+#endif // PDF_ENABLE_XFA
-#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 bfdce10f59..dbd8b868e7 100644
--- a/fpdfsdk/include/formfiller/FFL_IFormFiller.h
+++ b/fpdfsdk/include/formfiller/FFL_IFormFiller.h
@@ -133,7 +133,7 @@ class CFFL_IFormFiller : public IPWL_Filler_Notify {
FX_BOOL& bReset,
FX_BOOL& bExit,
FX_UINT nFlag);
-#endif
+#endif // PDF_ENABLE_XFA
private:
using CFFL_Widget2Filler = std::map<CPDFSDK_Annot*, CFFL_FormFiller*>;
@@ -160,14 +160,11 @@ class CFFL_IFormFiller : public IPWL_Filler_Notify {
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
+#endif // PDF_ENABLE_XFA
+ void UnRegisterFormFiller(CPDFSDK_Annot* pAnnot);
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 a6065fe992..12ac15abb8 100644
--- a/fpdfsdk/include/formfiller/FFL_TextField.h
+++ b/fpdfsdk/include/formfiller/FFL_TextField.h
@@ -59,8 +59,8 @@ class CFFL_TextField : public CFFL_FormFiller,
#ifdef PDF_ENABLE_XFA
// CFFL_FormFiller:
FX_BOOL IsFieldFull(CPDFSDK_PageView* pPageView) override;
+#endif // PDF_ENABLE_XFA
-#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 d43bc7b7e9..9040f40271 100644
--- a/fpdfsdk/include/fsdk_annothandler.h
+++ b/fpdfsdk/include/fsdk_annothandler.h
@@ -14,8 +14,8 @@
#ifdef PDF_ENABLE_XFA
#define FSDK_XFAWIDGET_TYPENAME "XFAWidget"
+#endif // PDF_ENABLE_XFA
-#endif
class CFFL_IFormFiller;
class CFX_RenderDevice;
class CPDFDoc_Environment;
@@ -42,8 +42,8 @@ class IPDFSDK_AnnotHandler {
#ifdef PDF_ENABLE_XFA
virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* hWidget,
CPDFSDK_PageView* pPage) = 0;
+#endif // PDF_ENABLE_XFA
-#endif
virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot) = 0;
virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) = 0;
@@ -131,7 +131,7 @@ class IPDFSDK_AnnotHandler {
#ifdef PDF_ENABLE_XFA
virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot,
CPDFSDK_Annot* pNewAnnot) = 0;
-#endif
+#endif // PDF_ENABLE_XFA
};
class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler {
@@ -148,7 +148,7 @@ class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler {
#ifdef PDF_ENABLE_XFA
CPDFSDK_Annot* NewAnnot(IXFA_Widget* hWidget,
CPDFSDK_PageView* pPage) override;
-#endif
+#endif // PDF_ENABLE_XFA
void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override;
void DeleteAnnot(CPDFSDK_Annot* pAnnot) override {}
CPDF_Rect GetViewBBox(CPDFSDK_PageView* pPageView,
@@ -226,7 +226,7 @@ class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler {
CPDFSDK_Annot* pNewAnnot) override {
return TRUE;
}
-#endif
+#endif // PDF_ENABLE_XFA
void SetFormFiller(CFFL_IFormFiller* pFiller) { m_pFormFiller = pFiller; }
CFFL_IFormFiller* GetFormFiller() { return m_pFormFiller; }
@@ -349,8 +349,8 @@ class CPDFSDK_XFAAnnotHandler : public IPDFSDK_AnnotHandler {
private:
CPDFDoc_Environment* m_pApp;
};
+#endif // PDF_ENABLE_XFA
-#endif
#define CBA_AnnotHandlerArray CFX_ArrayTemplate<IPDFSDK_AnnotHandler*>
class CPDFSDK_AnnotHandlerMgr {
public:
@@ -367,7 +367,7 @@ class CPDFSDK_AnnotHandlerMgr {
#ifdef PDF_ENABLE_XFA
virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* pAnnot,
CPDFSDK_PageView* pPageView);
-#endif
+#endif // PDF_ENABLE_XFA
virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot);
virtual void Annot_OnCreate(CPDFSDK_Annot* pAnnot);
@@ -429,10 +429,11 @@ 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
+#endif // PDF_ENABLE_XFA
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 ce65383e6b..59c9c79b4d 100644
--- a/fpdfsdk/include/fsdk_baseannot.h
+++ b/fpdfsdk/include/fsdk_baseannot.h
@@ -16,11 +16,7 @@
#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;
@@ -78,17 +74,18 @@ class CPDFSDK_Annot {
#ifdef PDF_ENABLE_XFA
virtual FX_BOOL IsXFAField() { return FALSE; }
+#endif // PDF_ENABLE_XFA
-#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
+#endif // PDF_ENABLE_XFA
virtual CFX_ByteString GetType() const { return ""; }
virtual CFX_ByteString GetSubType() const { return ""; }
@@ -104,7 +101,7 @@ class CPDFSDK_Annot {
CPDF_Page* GetPDFPage();
#ifdef PDF_ENABLE_XFA
CPDFXFA_Page* GetPDFXFAPage();
-#endif
+#endif // PDF_ENABLE_XFA
void SetPage(CPDFSDK_PageView* pPageView) { m_pPageView = pPageView; }
CPDFSDK_PageView* GetPageView() const { return m_pPageView; }
@@ -130,7 +127,8 @@ class CPDFSDK_BAAnnot : public CPDFSDK_Annot {
#ifdef PDF_ENABLE_XFA
FX_BOOL IsXFAField() override;
-#endif
+#endif // PDF_ENABLE_XFA
+
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 0b6a04eb52..cc21a1041d 100644
--- a/fpdfsdk/include/fsdk_baseform.h
+++ b/fpdfsdk/include/fsdk_baseform.h
@@ -38,8 +38,8 @@ typedef enum _PDFSDK_XFAAActionType {
PDFSDK_XFA_PreOpen,
PDFSDK_XFA_PostOpen
} PDFSDK_XFAAActionType;
+#endif // PDF_ENABLE_XFA
-#endif
typedef struct _PDFSDK_FieldAction {
_PDFSDK_FieldAction() {
bModifier = FALSE;
@@ -90,8 +90,8 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
IXFA_Widget* hWidget,
CPDF_FormField* pFormField,
CPDF_FormControl* pFormControl);
+#endif // PDF_ENABLE_XFA
-#endif
CPDFSDK_Widget(CPDF_Annot* pAnnot,
CPDFSDK_PageView* pPageView,
CPDFSDK_InterForm* pInterForm);
@@ -123,7 +123,7 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
CFX_WideString GetValue() const;
#else
CFX_WideString GetValue(FX_BOOL bDisplay = TRUE) const;
-#endif
+#endif // PDF_ENABLE_XFA
CFX_WideString GetDefaultValue() const;
CFX_WideString GetOptionLabel(int nIndex) const;
int CountOptions() const;
@@ -139,7 +139,7 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
int GetMaxLen() const;
#ifdef PDF_ENABLE_XFA
CFX_WideString GetName() const;
-#endif
+#endif // PDF_ENABLE_XFA
CFX_WideString GetAlternateName() const;
// Set Properties.
@@ -152,7 +152,7 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
#ifdef PDF_ENABLE_XFA
void ResetAppearance(FX_BOOL bValueChanged);
-#endif
+#endif // PDF_ENABLE_XFA
void ResetAppearance(const FX_WCHAR* sValue, FX_BOOL bValueChanged);
void ResetFieldAppearance(FX_BOOL bValueChanged);
void UpdateField();
@@ -211,16 +211,16 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
#ifndef PDF_ENABLE_XFA
private:
-#endif
+#endif // PDF_ENABLE_XFA
CPDFSDK_InterForm* m_pInterForm;
FX_BOOL m_bAppModified;
int32_t m_nAppAge;
int32_t m_nValueAge;
-#ifdef PDF_ENABLE_XFA
+#ifdef PDF_ENABLE_XFA
mutable IXFA_Widget* m_hMixXFAWidget;
mutable IXFA_WidgetHandler* m_pWidgetHandler;
-#endif
+#endif // PDF_ENABLE_XFA
};
#ifdef PDF_ENABLE_XFA
@@ -243,12 +243,11 @@ class CPDFSDK_XFAWidget : public CPDFSDK_Annot {
CPDFSDK_InterForm* m_pInterForm;
IXFA_Widget* m_hXFAWidget;
};
-
#define CPDFSDK_XFAWidgetMap \
CFX_MapPtrTemplate<IXFA_Widget*, CPDFSDK_XFAWidget*>
#define CPDFSDK_FieldSynchronizeMap CFX_MapPtrTemplate<CPDF_FormField*, int>
+#endif // PDF_ENABLE_XFA
-#endif
class CPDFSDK_InterForm : public CPDF_FormNotify {
public:
explicit CPDFSDK_InterForm(CPDFSDK_Document* pDocument);
@@ -269,23 +268,19 @@ 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 AddXFAMap(IXFA_Widget* hWidget, CPDFSDK_XFAWidget* pWidget);
+ void RemoveXFAMap(IXFA_Widget* hWidget);
+ CPDFSDK_XFAWidget* GetXFAWidget(IXFA_Widget* hWidget);
void XfaEnableCalculate(FX_BOOL bEnabled);
FX_BOOL IsXfaCalculateEnabled() const;
-
FX_BOOL IsXfaValidationsEnabled();
void XfaSetValidationsEnabled(FX_BOOL bEnabled);
+#endif // PDF_ENABLE_XFA
-#endif
#ifdef _WIN32
CPDF_Stream* LoadImageFromFile(const CFX_WideString& sFile);
#endif
@@ -325,8 +320,8 @@ class CPDFSDK_InterForm : public CPDF_FormNotify {
#ifdef PDF_ENABLE_XFA
void SynchronizeField(CPDF_FormField* pFormField, FX_BOOL bSynchronizeElse);
+#endif // PDF_ENABLE_XFA
-#endif
private:
// CPDF_FormNotify
int BeforeValueChange(const CPDF_FormField* pField,
@@ -356,12 +351,10 @@ class CPDFSDK_InterForm : public CPDF_FormNotify {
#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
+#endif // PDF_ENABLE_XFA
+ FX_BOOL m_bCalculate;
FX_BOOL m_bBusy;
public:
@@ -375,9 +368,10 @@ class CPDFSDK_InterForm : public CPDF_FormNotify {
private:
#ifndef PDF_ENABLE_XFA
static const int kNumFieldTypes = 6;
-#else
+#else // PDF_ENABLE_XFA
static const int kNumFieldTypes = 7;
-#endif
+#endif // PDF_ENABLE_XFA
+
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 4dfe5c2840..0d63b642d4 100644
--- a/fpdfsdk/include/fsdk_define.h
+++ b/fpdfsdk/include/fsdk_define.h
@@ -7,32 +7,27 @@
#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"
+#include "public/fpdfview.h"
+
#ifdef PDF_ENABLE_XFA
+#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"
#include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h"
#include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h"
-#endif
-#include "public/fpdfview.h"
+#endif // PDF_ENABLE_XFA
#ifdef _WIN32
#include <tchar.h>
@@ -67,15 +62,17 @@ class CPDF_CustomAccess final : public IFX_FileRead {
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 // PDF_ENABLE_XFA
-#endif
private:
FPDF_FILEACCESS m_FileAccess;
#ifdef PDF_ENABLE_XFA
uint8_t m_Buffer[512];
FX_DWORD m_BufferOffset;
+#endif // PDF_ENABLE_XFA
};
+#ifdef PDF_ENABLE_XFA
class CFPDF_FileStream : public IFX_FileStream {
public:
CFPDF_FileStream(FPDF_FILEHANDLER* pFS);
@@ -98,8 +95,8 @@ class CFPDF_FileStream : public IFX_FileStream {
protected:
FPDF_FILEHANDLER* m_pFS;
FX_FILESIZE m_nCurPos;
-#endif
};
+#endif // PDF_ENABLE_XFA
// 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
@@ -107,10 +104,10 @@ class CFPDF_FileStream : public IFX_FileStream {
#ifndef PDF_ENABLE_XFA
using UnderlyingDocumentType = CPDF_Document;
using UnderlyingPageType = CPDF_Page;
-#else
+#else // PDF_ENABLE_XFA
using UnderlyingDocumentType = CPDFXFA_Document;
using UnderlyingPageType = CPDFXFA_Page;
-#endif
+#endif // PDF_ENABLE_XFA
// 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 4b217f1ad3..385cfdbbff 100644
--- a/fpdfsdk/include/fsdk_mgr.h
+++ b/fpdfsdk/include/fsdk_mgr.h
@@ -10,10 +10,6 @@
#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"
@@ -26,6 +22,11 @@
#include "public/fpdf_fwlevent.h" // cross platform keycode and events define.
#include "third_party/base/nonstd_unique_ptr.h"
+#ifdef PDF_ENABLE_XFA
+#include "fpdfxfa/fpdfxfa_doc.h"
+#include "fpdfxfa/fpdfxfa_page.h"
+#endif // PDF_ENABLE_XFA
+
class CFFL_IFormFiller;
class CPDFSDK_ActionHandler;
class CPDFSDK_Annot;
@@ -46,8 +47,8 @@ class CPDFDoc_Environment final {
m_pInfo->Release(m_pInfo);
delete this;
}
+#endif // PDF_ENABLE_XFA
-#endif
void FFI_Invalidate(FPDF_PAGE page,
double left,
double top,
@@ -450,8 +451,8 @@ class CPDFDoc_Environment final {
}
return L"";
}
+#endif // PDF_ENABLE_XFA
-#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; }
@@ -488,29 +489,30 @@ 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
+#ifdef PDF_ENABLE_XFA
return GetXFADocument();
-#endif
+#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.
-#ifndef PDF_ENABLE_XFA
- CPDF_Document* GetPDFDocument() const { return m_pDoc; }
-#else
CPDF_Document* GetPDFDocument() const {
+#ifdef PDF_ENABLE_XFA
return m_pDoc ? m_pDoc->GetPDFDoc() : nullptr;
+#else // PDF_ENABLE_XFA
+ return m_pDoc;
+#endif // PDF_ENABLE_XFA
}
+#ifdef PDF_ENABLE_XFA
// 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
+#endif // PDF_ENABLE_XFA
+
CPDFSDK_PageView* GetPageView(UnderlyingPageType* pPage,
FX_BOOL ReNew = TRUE);
CPDFSDK_PageView* GetPageView(int nIndex);
@@ -562,14 +564,18 @@ class CPDFSDK_PageView final {
public:
CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc, UnderlyingPageType* page);
~CPDFSDK_PageView();
+
+#ifdef PDF_ENABLE_XFA
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
+#else // PDF_ENABLE_XFA
+ void PageView_OnDraw(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ CPDF_RenderOptions* pOptions);
+#endif // PDF_ENABLE_XFA
+
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);
@@ -587,20 +593,21 @@ 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
+
+#ifdef PDF_ENABLE_XFA
+ CPDFSDK_Annot* AddAnnot(IXFA_Widget* pPDFAnnot);
CPDFSDK_Annot* GetAnnotByXFAWidget(IXFA_Widget* hWidget);
CPDFXFA_Page* GetPDFXFAPage() { return m_page; }
CPDF_Page* GetPDFPage();
-#endif
+#else
+ CPDF_Page* GetPDFPage() { return m_page; }
+#endif // PDF_ENABLE_XFA
+
CPDF_Document* GetPDFDocument();
CPDFSDK_Document* GetSDKDocument() { return m_pSDKDoc; }
FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_UINT nFlag);
@@ -608,7 +615,7 @@ class CPDFSDK_PageView final {
#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
+#endif // PDF_ENABLE_XFA
FX_BOOL OnChar(int nChar, FX_UINT nFlag);
FX_BOOL OnKeyDown(int nKeyCode, int nFlag);
FX_BOOL OnKeyUp(int nKeyCode, int nFlag);
@@ -634,7 +641,7 @@ class CPDFSDK_PageView final {
FX_BOOL IsLocked() { return m_bLocked; }
#ifndef PDF_ENABLE_XFA
void TakeOverPage() { m_bTakeOverPage = TRUE; }
-#endif
+#endif // PDF_ENABLE_XFA
private:
void PageView_OnHighlightFormFields(CFX_RenderDevice* pDevice,
@@ -645,19 +652,17 @@ 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
+#ifdef PDF_ENABLE_XFA
CPDFSDK_Annot* m_CaptureWidget;
-#endif
+#else // PDF_ENABLE_XFA
+ CPDFSDK_Widget* m_CaptureWidget;
+ FX_BOOL m_bTakeOverPage;
+#endif // PDF_ENABLE_XFA
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 7eab25fe88..0ce866c85f 100644
--- a/fpdfsdk/include/javascript/IJavaScript.h
+++ b/fpdfsdk/include/javascript/IJavaScript.h
@@ -7,12 +7,13 @@
#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"
+#ifdef PDF_ENABLE_XFA
+#include "../../../xfa/include/fxjse/fxjse.h"
+#endif // PDF_ENABLE_XFA
+
class CPDFDoc_Environment;
class CPDFSDK_Annot;
class CPDFSDK_Document;
@@ -156,8 +157,8 @@ class IJS_Runtime {
FXJSE_HVALUE hValue) = 0;
virtual FX_BOOL SetHValueByName(const CFX_ByteStringC& utf8Name,
FXJSE_HVALUE hValue) = 0;
+#endif // PDF_ENABLE_XFA
-#endif
protected:
IJS_Runtime() {}
};
diff --git a/fpdfsdk/include/jsapi/fxjs_v8.h b/fpdfsdk/include/jsapi/fxjs_v8.h
index 992721e90a..b0845a396f 100644
--- a/fpdfsdk/include/jsapi/fxjs_v8.h
+++ b/fpdfsdk/include/jsapi/fxjs_v8.h
@@ -31,8 +31,8 @@ class IJS_Runtime; // A native runtime, typically owns the v8::Context.
// FXJS_V8 places no interpreation on this calass; it merely passes it
// along to XFA.
class CFXJSE_RuntimeData;
+#endif // PDF_ENABLE_XFA
-#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.
@@ -53,14 +53,14 @@ class FXJS_PerIsolateData {
std::vector<CFXJS_ObjDefinition*> m_ObjectDefnArray;
#ifdef PDF_ENABLE_XFA
CFXJSE_RuntimeData* m_pFXJSERuntimeData;
-#endif
+#endif // PDF_ENABLE_XFA
protected:
#ifndef PDF_ENABLE_XFA
FXJS_PerIsolateData() {}
-#else
+#else // PDF_ENABLE_XFA
FXJS_PerIsolateData() : m_pFXJSERuntimeData(nullptr) {}
-#endif
+#endif // PDF_ENABLE_XFA
};
extern const wchar_t kFXJSValueNameString[];
@@ -150,8 +150,8 @@ IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate);
// own contexts compatible with XFA or vice versa.
void FXJS_SetRuntimeForV8Context(v8::Local<v8::Context> v8Context,
IJS_Runtime* pIRuntime);
+#endif // PDF_ENABLE_XFA
-#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 edb605c07e..72e60a7707 100644
--- a/fpdfsdk/include/pdfwindow/PWL_Edit.h
+++ b/fpdfsdk/include/pdfwindow/PWL_Edit.h
@@ -34,14 +34,13 @@ class IPWL_Filler_Notify {
FX_BOOL& bExit,
FX_DWORD nFlag) = 0;
#ifdef PDF_ENABLE_XFA
-
virtual void OnPopupPreOpen(void* pPrivateData,
FX_BOOL& bExit,
FX_DWORD nFlag) = 0;
virtual void OnPopupPostOpen(void* pPrivateData,
FX_BOOL& bExit,
FX_DWORD nFlag) = 0;
-#endif
+#endif // PDF_ENABLE_XFA
};
class CPWL_Edit : public CPWL_EditCtrl, public IFX_Edit_OprNotify {