summaryrefslogtreecommitdiff
path: root/fpdfsdk/include
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2015-08-04 13:00:21 -0700
committerNico Weber <thakis@chromium.org>2015-08-04 13:00:21 -0700
commit9d8ec5a6e37e8d1d4d4edca9040de234e2d4728f (patch)
treec97037f398d714665aefccb6eb54d0969ad7030c /fpdfsdk/include
parent780cee82236d1b3b0f9b01a22424e4b8ec9a6f12 (diff)
downloadpdfium-9d8ec5a6e37e8d1d4d4edca9040de234e2d4728f.tar.xz
XFA: clang-format all pdfium code.
No behavior change. Generated by: find . -name '*.cpp' -o -name '*.h' | \ grep -E -v 'third_party|thirdparties|lpng_v163|tiff_v403' | \ xargs ../../buildtools/mac/clang-format -i Then manually merged https://codereview.chromium.org/1269223002/ See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion. BUG=none
Diffstat (limited to 'fpdfsdk/include')
-rw-r--r--fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h70
-rw-r--r--fpdfsdk/include/formfiller/FFL_CheckBox.h34
-rw-r--r--fpdfsdk/include/formfiller/FFL_ComboBox.h115
-rw-r--r--fpdfsdk/include/formfiller/FFL_FormFiller.h324
-rw-r--r--fpdfsdk/include/formfiller/FFL_IFormFiller.h294
-rw-r--r--fpdfsdk/include/formfiller/FFL_ListBox.h71
-rw-r--r--fpdfsdk/include/formfiller/FFL_Notify.h95
-rw-r--r--fpdfsdk/include/formfiller/FFL_PushButton.h22
-rw-r--r--fpdfsdk/include/formfiller/FFL_RadioButton.h27
-rw-r--r--fpdfsdk/include/formfiller/FFL_TextField.h115
-rw-r--r--fpdfsdk/include/formfiller/FFL_Utils.h15
-rw-r--r--fpdfsdk/include/fpdfxfa/fpdfxfa_app.h148
-rw-r--r--fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h351
-rw-r--r--fpdfsdk/include/fpdfxfa/fpdfxfa_page.h91
-rw-r--r--fpdfsdk/include/fpdfxfa/fpdfxfa_util.h58
-rw-r--r--fpdfsdk/include/fsdk_actionhandler.h149
-rw-r--r--fpdfsdk/include/fsdk_annothandler.h761
-rw-r--r--fpdfsdk/include/fsdk_baseannot.h298
-rw-r--r--fpdfsdk/include/fsdk_baseform.h623
-rw-r--r--fpdfsdk/include/fsdk_common.h60
-rw-r--r--fpdfsdk/include/fsdk_define.h97
-rw-r--r--fpdfsdk/include/fsdk_mgr.h1240
-rw-r--r--fpdfsdk/include/fsdk_rendercontext.h42
-rw-r--r--fpdfsdk/include/fx_systemhandler.h151
-rw-r--r--fpdfsdk/include/fxedit/fx_edit.h936
-rw-r--r--fpdfsdk/include/fxedit/fxet_edit.h1430
-rw-r--r--fpdfsdk/include/fxedit/fxet_list.h624
-rw-r--r--fpdfsdk/include/javascript/Consts.h119
-rw-r--r--fpdfsdk/include/javascript/Document.h592
-rw-r--r--fpdfsdk/include/javascript/Field.h929
-rw-r--r--fpdfsdk/include/javascript/IJavaScript.h230
-rw-r--r--fpdfsdk/include/javascript/Icon.h42
-rw-r--r--fpdfsdk/include/javascript/JS_Context.h210
-rw-r--r--fpdfsdk/include/javascript/JS_Define.h635
-rw-r--r--fpdfsdk/include/javascript/JS_EventHandler.h345
-rw-r--r--fpdfsdk/include/javascript/JS_GlobalData.h145
-rw-r--r--fpdfsdk/include/javascript/JS_Object.h461
-rw-r--r--fpdfsdk/include/javascript/JS_Runtime.h86
-rw-r--r--fpdfsdk/include/javascript/JS_Value.h304
-rw-r--r--fpdfsdk/include/javascript/PublicMethods.h240
-rw-r--r--fpdfsdk/include/javascript/app.h349
-rw-r--r--fpdfsdk/include/javascript/color.h117
-rw-r--r--fpdfsdk/include/javascript/console.h52
-rw-r--r--fpdfsdk/include/javascript/event.h123
-rw-r--r--fpdfsdk/include/javascript/global.h133
-rw-r--r--fpdfsdk/include/javascript/report.h40
-rw-r--r--fpdfsdk/include/javascript/resource.h36
-rw-r--r--fpdfsdk/include/javascript/util.h76
-rw-r--r--fpdfsdk/include/jsapi/fxjs_v8.h293
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_Button.h21
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_Caret.h72
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_ComboBox.h148
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_Edit.h286
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_EditCtrl.h315
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_FontMap.h207
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_Icon.h73
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_IconList.h202
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_Label.h58
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_ListBox.h180
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_ListCtrl.h66
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_Note.h585
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_ScrollBar.h273
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_Signature.h74
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_SpecialButton.h61
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_Utils.h598
-rw-r--r--fpdfsdk/include/pdfwindow/PWL_Wnd.h831
66 files changed, 9822 insertions, 8026 deletions
diff --git a/fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h b/fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h
index 3be49fc2de..7978150736 100644
--- a/fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h
+++ b/fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h
@@ -12,39 +12,43 @@
class CPDF_Dictionary;
class CPDFSDK_Annot;
-class CBA_FontMap : public CPWL_FontMap
-{
-public:
- CBA_FontMap(CPDFSDK_Annot* pAnnot, IFX_SystemHandler* pSystemHandler);
- CBA_FontMap(CPDF_Document* pDocument, CPDF_Dictionary* pAnnotDict, IFX_SystemHandler* pSystemHandler);
-
- virtual ~CBA_FontMap();
-
- virtual void Initial(const FX_CHAR* fontname = NULL);
-
-public:
- void SetDefaultFont(CPDF_Font * pFont, const CFX_ByteString & sFontName);
-
- void Reset();
- void SetAPType(const CFX_ByteString& sAPType);
-
-protected:
- virtual CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias, int32_t nCharset);
- virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias);
- virtual CPDF_Document* GetDocument();
-private:
- CPDF_Font* FindResFontSameCharset(CPDF_Dictionary* pResDict, CFX_ByteString& sFontAlias,
- int32_t nCharset);
- CPDF_Font* GetAnnotDefaultFont(CFX_ByteString &csNameTag);
- void AddFontToAnnotDict(CPDF_Font* pFont, const CFX_ByteString& sAlias);
-
-private:
- CPDF_Document* m_pDocument;
- CPDF_Dictionary* m_pAnnotDict;
- CPDF_Font* m_pDefaultFont;
- CFX_ByteString m_sDefaultFontName;
-
- CFX_ByteString m_sAPType;
+class CBA_FontMap : public CPWL_FontMap {
+ public:
+ CBA_FontMap(CPDFSDK_Annot* pAnnot, IFX_SystemHandler* pSystemHandler);
+ CBA_FontMap(CPDF_Document* pDocument,
+ CPDF_Dictionary* pAnnotDict,
+ IFX_SystemHandler* pSystemHandler);
+
+ virtual ~CBA_FontMap();
+
+ virtual void Initial(const FX_CHAR* fontname = NULL);
+
+ public:
+ void SetDefaultFont(CPDF_Font* pFont, const CFX_ByteString& sFontName);
+
+ void Reset();
+ void SetAPType(const CFX_ByteString& sAPType);
+
+ protected:
+ virtual CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias,
+ int32_t nCharset);
+ virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias);
+ virtual CPDF_Document* GetDocument();
+
+ private:
+ CPDF_Font* FindResFontSameCharset(CPDF_Dictionary* pResDict,
+ CFX_ByteString& sFontAlias,
+ int32_t nCharset);
+ CPDF_Font* GetAnnotDefaultFont(CFX_ByteString& csNameTag);
+ void AddFontToAnnotDict(CPDF_Font* pFont, const CFX_ByteString& sAlias);
+
+ private:
+ CPDF_Document* m_pDocument;
+ CPDF_Dictionary* m_pAnnotDict;
+ CPDF_Font* m_pDefaultFont;
+ CFX_ByteString m_sDefaultFontName;
+
+ CFX_ByteString m_sAPType;
};
#endif // FPDFSDK_INCLUDE_FORMFILLER_FFL_CBA_FONTMAP_H_
diff --git a/fpdfsdk/include/formfiller/FFL_CheckBox.h b/fpdfsdk/include/formfiller/FFL_CheckBox.h
index 3deeae8aa7..0ac7170a16 100644
--- a/fpdfsdk/include/formfiller/FFL_CheckBox.h
+++ b/fpdfsdk/include/formfiller/FFL_CheckBox.h
@@ -9,21 +9,25 @@
#include "FFL_FormFiller.h"
-class CFFL_CheckBox : public CFFL_Button
-{
-public:
- CFFL_CheckBox(CPDFDoc_Environment* pApp, CPDFSDK_Widget* pWidget);
- virtual ~CFFL_CheckBox();
-
- virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
-
- virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
- virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
-
- virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
- virtual void SaveData(CPDFSDK_PageView* pPageView);
+class CFFL_CheckBox : public CFFL_Button {
+ public:
+ CFFL_CheckBox(CPDFDoc_Environment* pApp, CPDFSDK_Widget* pWidget);
+ virtual ~CFFL_CheckBox();
+
+ virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp,
+ CPDFSDK_PageView* pPageView);
+
+ virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot,
+ FX_UINT nKeyCode,
+ FX_UINT nFlags);
+ virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+ virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point);
+
+ virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
+ virtual void SaveData(CPDFSDK_PageView* pPageView);
};
#endif // FPDFSDK_INCLUDE_FORMFILLER_FFL_CHECKBOX_H_
-
diff --git a/fpdfsdk/include/formfiller/FFL_ComboBox.h b/fpdfsdk/include/formfiller/FFL_ComboBox.h
index 0ade1bcdb0..1a3c20c94c 100644
--- a/fpdfsdk/include/formfiller/FFL_ComboBox.h
+++ b/fpdfsdk/include/formfiller/FFL_ComboBox.h
@@ -13,62 +13,69 @@
class CBA_FontMap;
class CPDFSDK_Document;
-struct FFL_ComboBoxState
-{
- int nIndex;
- int nStart;
- int nEnd;
- CFX_WideString sValue;
+struct FFL_ComboBoxState {
+ int nIndex;
+ int nStart;
+ int nEnd;
+ CFX_WideString sValue;
};
-class CFFL_ComboBox : public CFFL_FormFiller, public IPWL_FocusHandler, public IPWL_Edit_Notify
-{
-public:
- CFFL_ComboBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget);
- virtual ~CFFL_ComboBox();
-
- virtual PWL_CREATEPARAM GetCreateParam();
- virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
-
-
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
-
- virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
- virtual void SaveData(CPDFSDK_PageView* pPageView);
-
- virtual void GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, PDFSDK_FieldAction& fa);
- virtual void SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, const PDFSDK_FieldAction& fa);
- virtual FX_BOOL IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, const PDFSDK_FieldAction& faNew);
- virtual void SaveState(CPDFSDK_PageView* pPageView);
- virtual void RestoreState(CPDFSDK_PageView* pPageView);
-
- virtual CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);
- virtual void OnKeyStroke(FX_BOOL bKeyDown, FX_UINT nFlag);
-
- virtual FX_BOOL IsFieldFull(CPDFSDK_PageView* pPageView);
-
-public:
- virtual void OnSetFocus(CPWL_Wnd* pWnd);
- virtual void OnKillFocus(CPWL_Wnd* pWnd);
-
-public:
- virtual void OnAddUndo(CPWL_Edit* pEdit);
-
-public:
- virtual FX_BOOL CanCopy(CPDFSDK_Document* pDocument);
- virtual FX_BOOL CanCut(CPDFSDK_Document* pDocument);
- virtual FX_BOOL CanPaste(CPDFSDK_Document* pDocument);
-
- virtual void DoCopy(CPDFSDK_Document* pDocument);
- virtual void DoCut(CPDFSDK_Document* pDocument);
- virtual void DoPaste(CPDFSDK_Document* pDocument);
-
-private:
- CFX_WideString GetSelectExportText();
-
-private:
- CBA_FontMap* m_pFontMap;
- FFL_ComboBoxState m_State;
+class CFFL_ComboBox : public CFFL_FormFiller,
+ public IPWL_FocusHandler,
+ public IPWL_Edit_Notify {
+ public:
+ CFFL_ComboBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget);
+ virtual ~CFFL_ComboBox();
+
+ virtual PWL_CREATEPARAM GetCreateParam();
+ virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp,
+ CPDFSDK_PageView* pPageView);
+
+ virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+
+ virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
+ virtual void SaveData(CPDFSDK_PageView* pPageView);
+
+ virtual void GetActionData(CPDFSDK_PageView* pPageView,
+ CPDF_AAction::AActionType type,
+ PDFSDK_FieldAction& fa);
+ virtual void SetActionData(CPDFSDK_PageView* pPageView,
+ CPDF_AAction::AActionType type,
+ const PDFSDK_FieldAction& fa);
+ virtual FX_BOOL IsActionDataChanged(CPDF_AAction::AActionType type,
+ const PDFSDK_FieldAction& faOld,
+ const PDFSDK_FieldAction& faNew);
+ virtual void SaveState(CPDFSDK_PageView* pPageView);
+ virtual void RestoreState(CPDFSDK_PageView* pPageView);
+
+ virtual CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView,
+ FX_BOOL bRestoreValue);
+ virtual void OnKeyStroke(FX_BOOL bKeyDown, FX_UINT nFlag);
+
+ virtual FX_BOOL IsFieldFull(CPDFSDK_PageView* pPageView);
+
+ public:
+ virtual void OnSetFocus(CPWL_Wnd* pWnd);
+ virtual void OnKillFocus(CPWL_Wnd* pWnd);
+
+ public:
+ virtual void OnAddUndo(CPWL_Edit* pEdit);
+
+ public:
+ virtual FX_BOOL CanCopy(CPDFSDK_Document* pDocument);
+ virtual FX_BOOL CanCut(CPDFSDK_Document* pDocument);
+ virtual FX_BOOL CanPaste(CPDFSDK_Document* pDocument);
+
+ virtual void DoCopy(CPDFSDK_Document* pDocument);
+ virtual void DoCut(CPDFSDK_Document* pDocument);
+ virtual void DoPaste(CPDFSDK_Document* pDocument);
+
+ private:
+ CFX_WideString GetSelectExportText();
+
+ private:
+ CBA_FontMap* m_pFontMap;
+ FFL_ComboBoxState m_State;
};
#endif // FPDFSDK_INCLUDE_FORMFILLER_FFL_COMBOBOX_H_
diff --git a/fpdfsdk/include/formfiller/FFL_FormFiller.h b/fpdfsdk/include/formfiller/FFL_FormFiller.h
index 215bba9a04..fab989c14a 100644
--- a/fpdfsdk/include/formfiller/FFL_FormFiller.h
+++ b/fpdfsdk/include/formfiller/FFL_FormFiller.h
@@ -18,144 +18,196 @@ class CPDFSDK_PageView;
class CPDFSDK_Document;
class CPDFSDK_Widget;
-class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler
-{
-public:
- CFFL_FormFiller(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
- virtual ~CFFL_FormFiller();
-
- virtual FX_RECT GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
- virtual void OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- FX_DWORD dwFlags);
- virtual void OnDrawDeactive(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- FX_DWORD dwFlags);
-
- virtual void OnCreate(CPDFSDK_Annot* pAnnot);
- virtual void OnLoad(CPDFSDK_Annot* pAnnot);
- virtual void OnDelete(CPDFSDK_Annot* pAnnot);
-
- virtual void OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
- virtual void OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
-
- virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point);
- virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
-
- virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
-
- virtual void OnDeSelected(CPDFSDK_Annot* pAnnot);
- virtual void OnSelected(CPDFSDK_Annot* pAnnot);
-
- virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
- virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
-
- virtual FX_BOOL CanCopy(CPDFSDK_Document* pDocument);
- virtual FX_BOOL CanCut(CPDFSDK_Document* pDocument);
- virtual FX_BOOL CanPaste(CPDFSDK_Document* pDocument);
-
- virtual void DoCopy(CPDFSDK_Document* pDocument);
- virtual void DoCut(CPDFSDK_Document* pDocument);
- virtual void DoPaste(CPDFSDK_Document* pDocument);
-
- // CPWL_TimerHandler
- virtual void TimerProc();
- virtual IFX_SystemHandler* GetSystemHandler() const;
-
- virtual CPDF_Matrix GetWindowMatrix(void* pAttachedData);
- virtual CFX_WideString LoadPopupMenuString(int nIndex);
-
- virtual void GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
- PDFSDK_FieldAction& fa);
- virtual void SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
- const PDFSDK_FieldAction& fa);
- virtual FX_BOOL IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld,
- const PDFSDK_FieldAction& faNew);
-
- virtual void SaveState(CPDFSDK_PageView* pPageView);
- virtual void RestoreState(CPDFSDK_PageView* pPageView);
-
- virtual CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);
-
- virtual void OnKeyStroke(FX_BOOL bKeyDown);
-
- CPDF_Matrix GetCurMatrix();
-
- CPDF_Rect FFLtoPWL(const CPDF_Rect& rect);
- CPDF_Rect PWLtoFFL(const CPDF_Rect& rect);
- CPDF_Point FFLtoPWL(const CPDF_Point& point);
- CPDF_Point PWLtoFFL(const CPDF_Point& point);
-
- CPDF_Point WndtoPWL(CPDFSDK_PageView* pPageView, const CPDF_Point& pt);
- CPDF_Rect FFLtoWnd(CPDFSDK_PageView* pPageView, const CPDF_Rect& rect);
-
- void SetWindowRect(CPDFSDK_PageView* pPageView, const CPDF_Rect& rcWindow);
- CPDF_Rect GetWindowRect(CPDFSDK_PageView* pPageView);
-
- FX_BOOL CommitData(CPDFSDK_PageView* pPageView, FX_UINT nFlag);
- virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
- virtual void SaveData(CPDFSDK_PageView* pPageView);
-
- virtual FX_BOOL IsFieldFull(CPDFSDK_PageView* pPageView);
-
- CPWL_Wnd* GetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bNew);
- void DestroyPDFWindow(CPDFSDK_PageView* pPageView);
- void EscapeFiller(CPDFSDK_PageView* pPageView, FX_BOOL bDestroyPDFWindow);
-
- virtual PWL_CREATEPARAM GetCreateParam();
- virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView) = 0;
- virtual CPDF_Rect GetFocusBox(CPDFSDK_PageView* pPageView);
-
- FX_BOOL IsValid() const;
- CPDF_Rect GetPDFWindowRect() const;
-
- CPDFSDK_PageView* GetCurPageView();
- void SetChangeMark();
-
- virtual void InvalidateRect(double left, double top, double right, double bottom);
- CPDFDoc_Environment* GetApp(){return m_pApp;}
- CPDFSDK_Annot* GetSDKAnnot() {return m_pAnnot;}
-
-protected:
- using CFFL_PageView2PDFWindow = std::map<CPDFSDK_PageView*, CPWL_Wnd*>;
-
- CPDFDoc_Environment* m_pApp;
- CPDFSDK_Widget* m_pWidget;
- CPDFSDK_Annot* m_pAnnot;
-
- FX_BOOL m_bValid;
- CFFL_PageView2PDFWindow m_Maps;
- CPDF_Point m_ptOldPos;
+class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler {
+ public:
+ CFFL_FormFiller(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
+ virtual ~CFFL_FormFiller();
+
+ virtual FX_RECT GetViewBBox(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot);
+ virtual void OnDraw(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ FX_DWORD dwFlags);
+ virtual void OnDrawDeactive(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ FX_DWORD dwFlags);
+
+ virtual void OnCreate(CPDFSDK_Annot* pAnnot);
+ virtual void OnLoad(CPDFSDK_Annot* pAnnot);
+ virtual void OnDelete(CPDFSDK_Annot* pAnnot);
+
+ virtual void OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot);
+ virtual void OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot);
+
+ virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ short zDelta,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point);
+
+ virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot,
+ FX_UINT nKeyCode,
+ FX_UINT nFlags);
+ virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+
+ virtual void OnDeSelected(CPDFSDK_Annot* pAnnot);
+ virtual void OnSelected(CPDFSDK_Annot* pAnnot);
+
+ virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
+ virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
+
+ virtual FX_BOOL CanCopy(CPDFSDK_Document* pDocument);
+ virtual FX_BOOL CanCut(CPDFSDK_Document* pDocument);
+ virtual FX_BOOL CanPaste(CPDFSDK_Document* pDocument);
+
+ virtual void DoCopy(CPDFSDK_Document* pDocument);
+ virtual void DoCut(CPDFSDK_Document* pDocument);
+ virtual void DoPaste(CPDFSDK_Document* pDocument);
+
+ // CPWL_TimerHandler
+ virtual void TimerProc();
+ virtual IFX_SystemHandler* GetSystemHandler() const;
+
+ virtual CPDF_Matrix GetWindowMatrix(void* pAttachedData);
+ virtual CFX_WideString LoadPopupMenuString(int nIndex);
+
+ virtual void GetActionData(CPDFSDK_PageView* pPageView,
+ CPDF_AAction::AActionType type,
+ PDFSDK_FieldAction& fa);
+ virtual void SetActionData(CPDFSDK_PageView* pPageView,
+ CPDF_AAction::AActionType type,
+ const PDFSDK_FieldAction& fa);
+ virtual FX_BOOL IsActionDataChanged(CPDF_AAction::AActionType type,
+ const PDFSDK_FieldAction& faOld,
+ const PDFSDK_FieldAction& faNew);
+
+ virtual void SaveState(CPDFSDK_PageView* pPageView);
+ virtual void RestoreState(CPDFSDK_PageView* pPageView);
+
+ virtual CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView,
+ FX_BOOL bRestoreValue);
+
+ virtual void OnKeyStroke(FX_BOOL bKeyDown);
+
+ CPDF_Matrix GetCurMatrix();
+
+ CPDF_Rect FFLtoPWL(const CPDF_Rect& rect);
+ CPDF_Rect PWLtoFFL(const CPDF_Rect& rect);
+ CPDF_Point FFLtoPWL(const CPDF_Point& point);
+ CPDF_Point PWLtoFFL(const CPDF_Point& point);
+
+ CPDF_Point WndtoPWL(CPDFSDK_PageView* pPageView, const CPDF_Point& pt);
+ CPDF_Rect FFLtoWnd(CPDFSDK_PageView* pPageView, const CPDF_Rect& rect);
+
+ void SetWindowRect(CPDFSDK_PageView* pPageView, const CPDF_Rect& rcWindow);
+ CPDF_Rect GetWindowRect(CPDFSDK_PageView* pPageView);
+
+ FX_BOOL CommitData(CPDFSDK_PageView* pPageView, FX_UINT nFlag);
+ virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
+ virtual void SaveData(CPDFSDK_PageView* pPageView);
+
+ virtual FX_BOOL IsFieldFull(CPDFSDK_PageView* pPageView);
+
+ CPWL_Wnd* GetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bNew);
+ void DestroyPDFWindow(CPDFSDK_PageView* pPageView);
+ void EscapeFiller(CPDFSDK_PageView* pPageView, FX_BOOL bDestroyPDFWindow);
+
+ virtual PWL_CREATEPARAM GetCreateParam();
+ virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp,
+ CPDFSDK_PageView* pPageView) = 0;
+ virtual CPDF_Rect GetFocusBox(CPDFSDK_PageView* pPageView);
+
+ FX_BOOL IsValid() const;
+ CPDF_Rect GetPDFWindowRect() const;
+
+ CPDFSDK_PageView* GetCurPageView();
+ void SetChangeMark();
+
+ virtual void InvalidateRect(double left,
+ double top,
+ double right,
+ double bottom);
+ CPDFDoc_Environment* GetApp() { return m_pApp; }
+ CPDFSDK_Annot* GetSDKAnnot() { return m_pAnnot; }
+
+ protected:
+ using CFFL_PageView2PDFWindow = std::map<CPDFSDK_PageView*, CPWL_Wnd*>;
+
+ CPDFDoc_Environment* m_pApp;
+ CPDFSDK_Widget* m_pWidget;
+ CPDFSDK_Annot* m_pAnnot;
+
+ FX_BOOL m_bValid;
+ CFFL_PageView2PDFWindow m_Maps;
+ CPDF_Point m_ptOldPos;
};
-class CFFL_Button : public CFFL_FormFiller
-{
-public:
- CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget);
- virtual ~CFFL_Button();
-
- virtual void OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
- virtual void OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
- virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual void OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- FX_DWORD dwFlags);
-
- virtual void OnDrawDeactive(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- FX_DWORD dwFlags);
-protected:
- FX_BOOL m_bMouseIn;
- FX_BOOL m_bMouseDown;
+class CFFL_Button : public CFFL_FormFiller {
+ public:
+ CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget);
+ virtual ~CFFL_Button();
+
+ virtual void OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot);
+ virtual void OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot);
+ virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point);
+ virtual void OnDraw(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ FX_DWORD dwFlags);
+
+ virtual void OnDrawDeactive(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ FX_DWORD dwFlags);
+
+ protected:
+ FX_BOOL m_bMouseIn;
+ FX_BOOL m_bMouseDown;
};
#endif // FPDFSDK_INCLUDE_FORMFILLER_FFL_FORMFILLER_H_
diff --git a/fpdfsdk/include/formfiller/FFL_IFormFiller.h b/fpdfsdk/include/formfiller/FFL_IFormFiller.h
index 7096170476..ece8e4a4a6 100644
--- a/fpdfsdk/include/formfiller/FFL_IFormFiller.h
+++ b/fpdfsdk/include/formfiller/FFL_IFormFiller.h
@@ -14,109 +14,201 @@
class CFFL_FormFiller;
class CFFL_PrivateData;
-class CFFL_IFormFiller : public IPWL_Filler_Notify
-{
-public:
- CFFL_IFormFiller(CPDFDoc_Environment* pApp);
- virtual ~CFFL_IFormFiller();
-
- virtual FX_BOOL Annot_HitTest(CPDFSDK_PageView* pPageView,CPDFSDK_Annot* pAnnot, CPDF_Point point);
- virtual FX_RECT GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
- virtual void OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- /*const CRect& rcWindow,*/ FX_DWORD dwFlags);
-
-
- virtual void OnCreate(CPDFSDK_Annot* pAnnot);
- virtual void OnLoad(CPDFSDK_Annot* pAnnot);
- virtual void OnDelete(CPDFSDK_Annot* pAnnot);
-
- virtual void OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
- virtual void OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
-
- virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point);
- virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
-
- virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
-
- virtual void OnDeSelected(CPDFSDK_Annot* pAnnot);
- virtual void OnSelected(CPDFSDK_Annot* pAnnot);
-
- virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag);
- virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
-
- virtual void QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX_FLOAT fPopupMax, int32_t & nRet, FX_FLOAT & fPopupRet);
- virtual void OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, int32_t nKeyCode,
- CFX_WideString & strChange, const CFX_WideString& strChangeEx,
- int nSelStart, int nSelEnd,
- FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag);
- virtual void OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_BOOL & bExit, FX_DWORD nFlag) ;
-
- virtual void OnSetWindowRect(void* pPrivateData, const CPDF_Rect & rcWindow);
- virtual void OnKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, int32_t nKeyCode, CFX_WideString & strChange,
- const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit);
- virtual void OnPopupPreOpen(void* pPrivateData, FX_BOOL& bExit, FX_DWORD nFlag);
- virtual void OnPopupPostOpen(void* pPrivateData, FX_BOOL& bExit, FX_DWORD nFlag);
-
- virtual void BeforeUndo(CPDFSDK_Document* pDocument);
- virtual void BeforeRedo(CPDFSDK_Document* pDocument);
- virtual void AfterUndo(CPDFSDK_Document* pDocument);
- virtual void AfterRedo(CPDFSDK_Document* pDocument);
-
- virtual FX_BOOL CanCopy(CPDFSDK_Document* pDocument);
- virtual FX_BOOL CanCut(CPDFSDK_Document* pDocument);
- virtual FX_BOOL CanPaste(CPDFSDK_Document* pDocument);
-
- virtual void DoCopy(CPDFSDK_Document* pDocument);
- virtual void DoCut(CPDFSDK_Document* pDocument);
- virtual void DoPaste(CPDFSDK_Document* pDocument);
-
- CFFL_FormFiller* GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL bRegister);
- void RemoveFormFiller(CPDFSDK_Annot* pAnnot);
-
- static FX_BOOL IsVisible(CPDFSDK_Widget* pWidget);
- static FX_BOOL IsReadOnly(CPDFSDK_Widget* pWidget);
- static FX_BOOL IsFillingAllowed(CPDFSDK_Widget* pWidget);
- static FX_BOOL IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot);
-
- void OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag);
- void OnValidate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag);
-
- void OnCalculate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bExit, FX_DWORD nFlag);
- void OnFormat(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bExit, FX_DWORD nFlag);
- void OnButtonUp(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bReset, FX_BOOL& bExit,FX_UINT nFlag);
- void OnClick(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bReset, FX_BOOL& bExit, FX_UINT nFlag);
- void OnFull(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bReset, FX_BOOL& bExit, FX_UINT nFlag);
- void OnPreOpen(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bReset, FX_BOOL& bExit, FX_UINT nFlag);
- void OnPostOpen(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bReset, FX_BOOL& bExit, FX_UINT nFlag);
-
-private:
- using CFFL_Widget2Filler = std::map<CPDFSDK_Annot*, CFFL_FormFiller*>;
-
- void UnRegisterFormFiller(CPDFSDK_Annot* pAnnot);
- void SetFocusAnnotTab(CPDFSDK_Annot* pWidget, FX_BOOL bSameField,
- FX_BOOL bNext);
-
- CPDFDoc_Environment* m_pApp;
- CFFL_Widget2Filler m_Maps;
- FX_BOOL m_bNotifying;
+class CFFL_IFormFiller : public IPWL_Filler_Notify {
+ public:
+ CFFL_IFormFiller(CPDFDoc_Environment* pApp);
+ virtual ~CFFL_IFormFiller();
+
+ virtual FX_BOOL Annot_HitTest(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CPDF_Point point);
+ virtual FX_RECT GetViewBBox(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot);
+ virtual void OnDraw(CPDFSDK_PageView* pPageView,
+ /*HDC hDC,*/ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ /*const CRect& rcWindow,*/ FX_DWORD dwFlags);
+
+ virtual void OnCreate(CPDFSDK_Annot* pAnnot);
+ virtual void OnLoad(CPDFSDK_Annot* pAnnot);
+ virtual void OnDelete(CPDFSDK_Annot* pAnnot);
+
+ virtual void OnMouseEnter(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlag);
+ virtual void OnMouseExit(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlag);
+
+ virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ short zDelta,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point);
+
+ virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot,
+ FX_UINT nKeyCode,
+ FX_UINT nFlags);
+ virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+
+ virtual void OnDeSelected(CPDFSDK_Annot* pAnnot);
+ virtual void OnSelected(CPDFSDK_Annot* pAnnot);
+
+ virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
+ virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
+
+ virtual void QueryWherePopup(void* pPrivateData,
+ FX_FLOAT fPopupMin,
+ FX_FLOAT fPopupMax,
+ int32_t& nRet,
+ FX_FLOAT& fPopupRet);
+ virtual void OnBeforeKeyStroke(FX_BOOL bEditOrList,
+ void* pPrivateData,
+ int32_t nKeyCode,
+ CFX_WideString& strChange,
+ const CFX_WideString& strChangeEx,
+ int nSelStart,
+ int nSelEnd,
+ FX_BOOL bKeyDown,
+ FX_BOOL& bRC,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag);
+ virtual void OnAfterKeyStroke(FX_BOOL bEditOrList,
+ void* pPrivateData,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag);
+
+ virtual void OnSetWindowRect(void* pPrivateData, const CPDF_Rect& rcWindow);
+ virtual void OnKeyStroke(FX_BOOL bEditOrList,
+ void* pPrivateData,
+ int32_t nKeyCode,
+ CFX_WideString& strChange,
+ const CFX_WideString& strChangeEx,
+ FX_BOOL bKeyDown,
+ FX_BOOL& bRC,
+ FX_BOOL& bExit);
+ virtual void OnPopupPreOpen(void* pPrivateData,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag);
+ virtual void OnPopupPostOpen(void* pPrivateData,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag);
+
+ virtual void BeforeUndo(CPDFSDK_Document* pDocument);
+ virtual void BeforeRedo(CPDFSDK_Document* pDocument);
+ virtual void AfterUndo(CPDFSDK_Document* pDocument);
+ virtual void AfterRedo(CPDFSDK_Document* pDocument);
+
+ virtual FX_BOOL CanCopy(CPDFSDK_Document* pDocument);
+ virtual FX_BOOL CanCut(CPDFSDK_Document* pDocument);
+ virtual FX_BOOL CanPaste(CPDFSDK_Document* pDocument);
+
+ virtual void DoCopy(CPDFSDK_Document* pDocument);
+ virtual void DoCut(CPDFSDK_Document* pDocument);
+ virtual void DoPaste(CPDFSDK_Document* pDocument);
+
+ CFFL_FormFiller* GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL bRegister);
+ void RemoveFormFiller(CPDFSDK_Annot* pAnnot);
+
+ static FX_BOOL IsVisible(CPDFSDK_Widget* pWidget);
+ static FX_BOOL IsReadOnly(CPDFSDK_Widget* pWidget);
+ static FX_BOOL IsFillingAllowed(CPDFSDK_Widget* pWidget);
+ static FX_BOOL IsValidAnnot(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot);
+
+ void OnKeyStrokeCommit(CPDFSDK_Widget* pWidget,
+ CPDFSDK_PageView* pPageView,
+ FX_BOOL& bRC,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag);
+ void OnValidate(CPDFSDK_Widget* pWidget,
+ CPDFSDK_PageView* pPageView,
+ FX_BOOL& bRC,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag);
+
+ void OnCalculate(CPDFSDK_Widget* pWidget,
+ CPDFSDK_PageView* pPageView,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag);
+ void OnFormat(CPDFSDK_Widget* pWidget,
+ CPDFSDK_PageView* pPageView,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag);
+ void OnButtonUp(CPDFSDK_Widget* pWidget,
+ CPDFSDK_PageView* pPageView,
+ FX_BOOL& bReset,
+ FX_BOOL& bExit,
+ FX_UINT nFlag);
+ void OnClick(CPDFSDK_Widget* pWidget,
+ CPDFSDK_PageView* pPageView,
+ FX_BOOL& bReset,
+ FX_BOOL& bExit,
+ FX_UINT nFlag);
+ void OnFull(CPDFSDK_Widget* pWidget,
+ CPDFSDK_PageView* pPageView,
+ FX_BOOL& bReset,
+ FX_BOOL& bExit,
+ FX_UINT nFlag);
+ void OnPreOpen(CPDFSDK_Widget* pWidget,
+ CPDFSDK_PageView* pPageView,
+ FX_BOOL& bReset,
+ FX_BOOL& bExit,
+ FX_UINT nFlag);
+ void OnPostOpen(CPDFSDK_Widget* pWidget,
+ CPDFSDK_PageView* pPageView,
+ FX_BOOL& bReset,
+ FX_BOOL& bExit,
+ FX_UINT nFlag);
+
+ private:
+ using CFFL_Widget2Filler = std::map<CPDFSDK_Annot*, CFFL_FormFiller*>;
+
+ void UnRegisterFormFiller(CPDFSDK_Annot* pAnnot);
+ void SetFocusAnnotTab(CPDFSDK_Annot* pWidget,
+ FX_BOOL bSameField,
+ FX_BOOL bNext);
+
+ CPDFDoc_Environment* m_pApp;
+ CFFL_Widget2Filler m_Maps;
+ FX_BOOL m_bNotifying;
};
-class CFFL_PrivateData
-{
-public:
- CPDFSDK_Widget* pWidget;
- CPDFSDK_PageView* pPageView;
- int nWidgetAge;
- int nValueAge;
+class CFFL_PrivateData {
+ public:
+ CPDFSDK_Widget* pWidget;
+ CPDFSDK_PageView* pPageView;
+ int nWidgetAge;
+ int nValueAge;
};
#endif // FPDFSDK_INCLUDE_FORMFILLER_FFL_IFORMFILLER_H_
-
diff --git a/fpdfsdk/include/formfiller/FFL_ListBox.h b/fpdfsdk/include/formfiller/FFL_ListBox.h
index 4c0813f5c8..2e26069e2c 100644
--- a/fpdfsdk/include/formfiller/FFL_ListBox.h
+++ b/fpdfsdk/include/formfiller/FFL_ListBox.h
@@ -11,43 +11,40 @@
#include "FFL_FormFiller.h"
-class CBA_FontMap;
-
-class CFFL_ListBox : public CFFL_FormFiller
-{
-public:
- CFFL_ListBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget);
- virtual ~CFFL_ListBox();
-
- virtual PWL_CREATEPARAM GetCreateParam();
- virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp,
- CPDFSDK_PageView* pPageView);
-
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar,
- FX_UINT nFlags);
-
- virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
- virtual void SaveData(CPDFSDK_PageView* pPageView);
-
- virtual void GetActionData(CPDFSDK_PageView* pPageView,
- CPDF_AAction::AActionType type,
- PDFSDK_FieldAction& fa);
- virtual void SetActionData(CPDFSDK_PageView* pPageView,
- CPDF_AAction::AActionType type,
- const PDFSDK_FieldAction& fa);
-
- virtual void SaveState(CPDFSDK_PageView* pPageView);
- virtual void RestoreState(CPDFSDK_PageView* pPageView);
-
- virtual CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView,
- FX_BOOL bRestoreValue);
- virtual void OnKeyStroke(FX_BOOL bKeyDown, FX_DWORD nFlag);
-
-private:
- CBA_FontMap* m_pFontMap;
- std::set<int> m_OriginSelections;
- CFX_ArrayTemplate<int> m_State;
-};
+class CBA_FontMap;
+
+class CFFL_ListBox : public CFFL_FormFiller {
+ public:
+ CFFL_ListBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget);
+ virtual ~CFFL_ListBox();
+
+ virtual PWL_CREATEPARAM GetCreateParam();
+ virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp,
+ CPDFSDK_PageView* pPageView);
+
+ virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+
+ virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
+ virtual void SaveData(CPDFSDK_PageView* pPageView);
+ virtual void GetActionData(CPDFSDK_PageView* pPageView,
+ CPDF_AAction::AActionType type,
+ PDFSDK_FieldAction& fa);
+ virtual void SetActionData(CPDFSDK_PageView* pPageView,
+ CPDF_AAction::AActionType type,
+ const PDFSDK_FieldAction& fa);
+
+ virtual void SaveState(CPDFSDK_PageView* pPageView);
+ virtual void RestoreState(CPDFSDK_PageView* pPageView);
+
+ virtual CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView,
+ FX_BOOL bRestoreValue);
+ virtual void OnKeyStroke(FX_BOOL bKeyDown, FX_DWORD nFlag);
+
+ private:
+ CBA_FontMap* m_pFontMap;
+ std::set<int> m_OriginSelections;
+ CFX_ArrayTemplate<int> m_State;
+};
#endif // FPDFSDK_INCLUDE_FORMFILLER_FFL_LISTBOX_H_
diff --git a/fpdfsdk/include/formfiller/FFL_Notify.h b/fpdfsdk/include/formfiller/FFL_Notify.h
index 051a25069f..b051df86cf 100644
--- a/fpdfsdk/include/formfiller/FFL_Notify.h
+++ b/fpdfsdk/include/formfiller/FFL_Notify.h
@@ -13,44 +13,63 @@
class CFFL_FormFiller;
class CPDF_FormField;
-class CFFL_Notify
-{
-public:
- CFFL_Notify(CFFL_FormFiller * pFormFiller);
- virtual ~CFFL_Notify();
-
-public:
- FX_BOOL OnSetFocus(FX_BOOL & bExit);
- FX_BOOL OnMouseEnter(FX_BOOL & bExit);
- FX_BOOL OnMouseDown(FX_BOOL & bExit);
- FX_BOOL OnMouseUp(FX_BOOL & bExit);
- FX_BOOL OnMouseExit(FX_BOOL & bExit);
- FX_BOOL OnKillFocus(FX_BOOL & bExit);
-
- FX_BOOL OnCalculate();
- FX_BOOL OnFormat(int iCommitKey);
- FX_BOOL OnValidate(CPDF_FormField* pFormField, CFX_WideString& strValue, CFX_WideString & strChange,
- const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier,
- FX_BOOL bShift, FX_BOOL & bRC);
- FX_BOOL OnKeyStroke(CPDF_FormField* pFormField, int nCommitKey, CFX_WideString& strValue, CFX_WideString& strChange,
- const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier,
- FX_BOOL bShift, FX_BOOL bWillCommit, FX_BOOL bFieldFull,
- int& nSelStart, int& nSelEnd, FX_BOOL& bRC);
-
- void BeforeNotify();
- void AfterNotify();
- FX_BOOL IsNotifying() const {return m_nNotifyFlag > 0;}
-
-private:
- FX_BOOL DoAAction(CPDF_AAction::AActionType eAAT, FX_BOOL & bExit);
- FX_BOOL FindAAction(CPDF_AAction::AActionType eAAT,CPDF_Action & action);
- FX_BOOL FindAAction(CPDF_AAction aaction,CPDF_AAction::AActionType eAAT,CPDF_Action & action);
- FX_BOOL ExecuteActionTree(CPDF_AAction::AActionType eAAT, CPDF_Action & action, FX_BOOL& bExit);
- FX_BOOL ExecuteAction(CPDF_AAction::AActionType eAAT,CPDF_Action & action,FX_BOOL& bExit);
-
- CFFL_FormFiller * m_pFormFiller;
- FX_BOOL m_bDoActioning;
- int32_t m_nNotifyFlag;
+class CFFL_Notify {
+ public:
+ CFFL_Notify(CFFL_FormFiller* pFormFiller);
+ virtual ~CFFL_Notify();
+
+ public:
+ FX_BOOL OnSetFocus(FX_BOOL& bExit);
+ FX_BOOL OnMouseEnter(FX_BOOL& bExit);
+ FX_BOOL OnMouseDown(FX_BOOL& bExit);
+ FX_BOOL OnMouseUp(FX_BOOL& bExit);
+ FX_BOOL OnMouseExit(FX_BOOL& bExit);
+ FX_BOOL OnKillFocus(FX_BOOL& bExit);
+
+ FX_BOOL OnCalculate();
+ FX_BOOL OnFormat(int iCommitKey);
+ FX_BOOL OnValidate(CPDF_FormField* pFormField,
+ CFX_WideString& strValue,
+ CFX_WideString& strChange,
+ const CFX_WideString& strChangeEx,
+ FX_BOOL bKeyDown,
+ FX_BOOL bModifier,
+ FX_BOOL bShift,
+ FX_BOOL& bRC);
+ FX_BOOL OnKeyStroke(CPDF_FormField* pFormField,
+ int nCommitKey,
+ CFX_WideString& strValue,
+ CFX_WideString& strChange,
+ const CFX_WideString& strChangeEx,
+ FX_BOOL bKeyDown,
+ FX_BOOL bModifier,
+ FX_BOOL bShift,
+ FX_BOOL bWillCommit,
+ FX_BOOL bFieldFull,
+ int& nSelStart,
+ int& nSelEnd,
+ FX_BOOL& bRC);
+
+ void BeforeNotify();
+ void AfterNotify();
+ FX_BOOL IsNotifying() const { return m_nNotifyFlag > 0; }
+
+ private:
+ FX_BOOL DoAAction(CPDF_AAction::AActionType eAAT, FX_BOOL& bExit);
+ FX_BOOL FindAAction(CPDF_AAction::AActionType eAAT, CPDF_Action& action);
+ FX_BOOL FindAAction(CPDF_AAction aaction,
+ CPDF_AAction::AActionType eAAT,
+ CPDF_Action& action);
+ FX_BOOL ExecuteActionTree(CPDF_AAction::AActionType eAAT,
+ CPDF_Action& action,
+ FX_BOOL& bExit);
+ FX_BOOL ExecuteAction(CPDF_AAction::AActionType eAAT,
+ CPDF_Action& action,
+ FX_BOOL& bExit);
+
+ CFFL_FormFiller* m_pFormFiller;
+ FX_BOOL m_bDoActioning;
+ int32_t m_nNotifyFlag;
};
#endif // FPDFSDK_INCLUDE_FORMFILLER_FFL_NOTIFY_H_
diff --git a/fpdfsdk/include/formfiller/FFL_PushButton.h b/fpdfsdk/include/formfiller/FFL_PushButton.h
index 3cfaefb9bd..5c4819400d 100644
--- a/fpdfsdk/include/formfiller/FFL_PushButton.h
+++ b/fpdfsdk/include/formfiller/FFL_PushButton.h
@@ -9,18 +9,20 @@
#include "FFL_FormFiller.h"
-class CFFL_PushButton : public CFFL_Button
-{
-public:
- CFFL_PushButton(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
- virtual ~CFFL_PushButton();
+class CFFL_PushButton : public CFFL_Button {
+ public:
+ CFFL_PushButton(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
+ virtual ~CFFL_PushButton();
- virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
+ virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp,
+ CPDFSDK_PageView* pPageView);
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
- virtual void OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- FX_DWORD dwFlags);
+ virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+ virtual void OnDraw(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ FX_DWORD dwFlags);
};
#endif // FPDFSDK_INCLUDE_FORMFILLER_FFL_PUSHBUTTON_H_
diff --git a/fpdfsdk/include/formfiller/FFL_RadioButton.h b/fpdfsdk/include/formfiller/FFL_RadioButton.h
index 46332e07fd..ba7bff4629 100644
--- a/fpdfsdk/include/formfiller/FFL_RadioButton.h
+++ b/fpdfsdk/include/formfiller/FFL_RadioButton.h
@@ -9,18 +9,23 @@
#include "FFL_FormFiller.h"
-class CFFL_RadioButton : public CFFL_Button
-{
-public:
- CFFL_RadioButton(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
- virtual ~CFFL_RadioButton();
+class CFFL_RadioButton : public CFFL_Button {
+ public:
+ CFFL_RadioButton(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
+ virtual ~CFFL_RadioButton();
- virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
- virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
- virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
- virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
- virtual void SaveData(CPDFSDK_PageView* pPageView);
+ virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp,
+ CPDFSDK_PageView* pPageView);
+ virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot,
+ FX_UINT nKeyCode,
+ FX_UINT nFlags);
+ virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+ virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_UINT nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
+ virtual void SaveData(CPDFSDK_PageView* pPageView);
};
#endif // FPDFSDK_INCLUDE_FORMFILLER_FFL_RADIOBUTTON_H_
diff --git a/fpdfsdk/include/formfiller/FFL_TextField.h b/fpdfsdk/include/formfiller/FFL_TextField.h
index cb8df3f9c4..20f478b4e2 100644
--- a/fpdfsdk/include/formfiller/FFL_TextField.h
+++ b/fpdfsdk/include/formfiller/FFL_TextField.h
@@ -9,67 +9,70 @@
#include "FFL_FormFiller.h"
-#define BF_ALIGN_LEFT 0
-#define BF_ALIGN_MIDDLE 1
-#define BF_ALIGN_RIGHT 2
+#define BF_ALIGN_LEFT 0
+#define BF_ALIGN_MIDDLE 1
+#define BF_ALIGN_RIGHT 2
class CBA_FontMap;
-struct FFL_TextFieldState
-{
- int nStart;
- int nEnd;
- CFX_WideString sValue;
+struct FFL_TextFieldState {
+ int nStart;
+ int nEnd;
+ CFX_WideString sValue;
};
-class CFFL_TextField : public CFFL_FormFiller, public IPWL_FocusHandler, public IPWL_Edit_Notify
-{
-public:
- CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
- virtual ~CFFL_TextField();
-
- virtual PWL_CREATEPARAM GetCreateParam();
- virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
-
-
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
-
- virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
- virtual void SaveData(CPDFSDK_PageView* pPageView);
-
- virtual void GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
- PDFSDK_FieldAction& fa);
- virtual void SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
- const PDFSDK_FieldAction& fa);
- virtual FX_BOOL IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld,
- const PDFSDK_FieldAction& faNew);
- virtual void SaveState(CPDFSDK_PageView* pPageView);
- virtual void RestoreState(CPDFSDK_PageView* pPageView);
-
- virtual CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);
-
- virtual FX_BOOL IsFieldFull(CPDFSDK_PageView* pPageView);
-
-public:
- virtual void OnSetFocus(CPWL_Wnd* pWnd);
- virtual void OnKillFocus(CPWL_Wnd* pWnd);
-
-public:
- virtual void OnAddUndo(CPWL_Edit* pEdit);
-
-public:
- virtual FX_BOOL CanCopy(CPDFSDK_Document* pDocument);
- virtual FX_BOOL CanCut(CPDFSDK_Document* pDocument);
- virtual FX_BOOL CanPaste(CPDFSDK_Document* pDocument);
-
- virtual void DoCopy(CPDFSDK_Document* pDocument);
- virtual void DoCut(CPDFSDK_Document* pDocument);
- virtual void DoPaste(CPDFSDK_Document* pDocument);
-
-private:
- CBA_FontMap* m_pFontMap;
- FFL_TextFieldState m_State;
-
+class CFFL_TextField : public CFFL_FormFiller,
+ public IPWL_FocusHandler,
+ public IPWL_Edit_Notify {
+ public:
+ CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
+ virtual ~CFFL_TextField();
+
+ virtual PWL_CREATEPARAM GetCreateParam();
+ virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp,
+ CPDFSDK_PageView* pPageView);
+
+ virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+
+ virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
+ virtual void SaveData(CPDFSDK_PageView* pPageView);
+
+ virtual void GetActionData(CPDFSDK_PageView* pPageView,
+ CPDF_AAction::AActionType type,
+ PDFSDK_FieldAction& fa);
+ virtual void SetActionData(CPDFSDK_PageView* pPageView,
+ CPDF_AAction::AActionType type,
+ const PDFSDK_FieldAction& fa);
+ virtual FX_BOOL IsActionDataChanged(CPDF_AAction::AActionType type,
+ const PDFSDK_FieldAction& faOld,
+ const PDFSDK_FieldAction& faNew);
+ virtual void SaveState(CPDFSDK_PageView* pPageView);
+ virtual void RestoreState(CPDFSDK_PageView* pPageView);
+
+ virtual CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView,
+ FX_BOOL bRestoreValue);
+
+ virtual FX_BOOL IsFieldFull(CPDFSDK_PageView* pPageView);
+
+ public:
+ virtual void OnSetFocus(CPWL_Wnd* pWnd);
+ virtual void OnKillFocus(CPWL_Wnd* pWnd);
+
+ public:
+ virtual void OnAddUndo(CPWL_Edit* pEdit);
+
+ public:
+ virtual FX_BOOL CanCopy(CPDFSDK_Document* pDocument);
+ virtual FX_BOOL CanCut(CPDFSDK_Document* pDocument);
+ virtual FX_BOOL CanPaste(CPDFSDK_Document* pDocument);
+
+ virtual void DoCopy(CPDFSDK_Document* pDocument);
+ virtual void DoCut(CPDFSDK_Document* pDocument);
+ virtual void DoPaste(CPDFSDK_Document* pDocument);
+
+ private:
+ CBA_FontMap* m_pFontMap;
+ FFL_TextFieldState m_State;
};
#endif // FPDFSDK_INCLUDE_FORMFILLER_FFL_TEXTFIELD_H_
diff --git a/fpdfsdk/include/formfiller/FFL_Utils.h b/fpdfsdk/include/formfiller/FFL_Utils.h
index fe025eca4b..372a2b6837 100644
--- a/fpdfsdk/include/formfiller/FFL_Utils.h
+++ b/fpdfsdk/include/formfiller/FFL_Utils.h
@@ -9,15 +9,12 @@
#include "../../../core/include/fpdfapi/fpdf_parser.h"
-class CFFL_Utils
-{
-public:
- static CPDF_Rect MaxRect(const CPDF_Rect& rect1,const CPDF_Rect& rect2);
- static CPDF_Rect InflateRect(const CPDF_Rect& crRect,
- const FX_FLOAT& fSize);
- static CPDF_Rect DeflateRect(const CPDF_Rect& crRect,
- const FX_FLOAT& fSize);
- static FX_BOOL TraceObject(CPDF_Object* pObj);
+class CFFL_Utils {
+ public:
+ static CPDF_Rect MaxRect(const CPDF_Rect& rect1, const CPDF_Rect& rect2);
+ static CPDF_Rect InflateRect(const CPDF_Rect& crRect, const FX_FLOAT& fSize);
+ static CPDF_Rect DeflateRect(const CPDF_Rect& crRect, const FX_FLOAT& fSize);
+ static FX_BOOL TraceObject(CPDF_Object* pObj);
};
#endif // FPDFSDK_INCLUDE_FORMFILLER_FFL_UTILS_H_
diff --git a/fpdfsdk/include/fpdfxfa/fpdfxfa_app.h b/fpdfsdk/include/fpdfxfa/fpdfxfa_app.h
index e650c6235b..bf96993bd3 100644
--- a/fpdfsdk/include/fpdfxfa/fpdfxfa_app.h
+++ b/fpdfsdk/include/fpdfxfa/fpdfxfa_app.h
@@ -10,73 +10,87 @@
class IFXJS_Runtime;
class CJS_RuntimeFactory;
-class CPDFXFA_App : public IXFA_AppProvider
-{
-public:
- static CPDFXFA_App* GetInstance();
- static void ReleaseInstance();
-
- CPDFXFA_App();
- ~CPDFXFA_App() override;
-
- FX_BOOL Initialize();
- IXFA_App* GetXFAApp() { return m_pXFAApp; }
-
- FX_BOOL AddFormFillEnv(CPDFDoc_Environment* pEnv);
- FX_BOOL RemoveFormFillEnv(CPDFDoc_Environment* pEnv);
-
- FXJSE_HRUNTIME GetJSERuntime() { return m_hJSERuntime; }
- void ReleaseRuntime();
- FX_BOOL InitRuntime(FX_BOOL bReset=FALSE);
-
- CJS_RuntimeFactory* GetRuntimeFactory() { return m_pJSRuntimeFactory; }
-
- // IFXA_AppProvider:
- void GetAppType(CFX_WideString &wsAppType) override;
- void SetAppType(const CFX_WideStringC& wsAppType) override;
-
- void GetLanguage(CFX_WideString &wsLanguage) override;
- void GetPlatform(CFX_WideString &wsPlatform) override;
- void GetVariation(CFX_WideString &wsVariation) override;
- void GetVersion(CFX_WideString &wsVersion) override;
- void GetFoxitVersion(CFX_WideString &wsFoxitVersion) override {
- wsFoxitVersion = L"7.0";
- }
-
- void GetAppName(CFX_WideString& wsName) override;
- void GetFoxitAppName(CFX_WideString& wsFoxitName) override {
- wsFoxitName = L"Foxit";
- }
-
- void Beep(FX_DWORD dwType) override;
- int32_t MsgBox(const CFX_WideStringC& wsMessage, const CFX_WideStringC& wsTitle, FX_DWORD dwIconType, FX_DWORD dwButtonType) override;
- void Response(CFX_WideString &wsAnswer, const CFX_WideStringC& wsQuestion, const CFX_WideStringC& wsTitle,
- const CFX_WideStringC& wsDefaultAnswer, FX_BOOL bMark) override;
-
- int32_t GetDocumentCountInBatch() override;
- int32_t GetCurDocumentInBatch() override;
-
- IFX_FileRead* DownloadURL(const CFX_WideStringC& wsURL) override;
- FX_BOOL PostRequestURL(const CFX_WideStringC& wsURL, const CFX_WideStringC& wsData, const CFX_WideStringC& wsContentType,
- const CFX_WideStringC& wsEncode, const CFX_WideStringC& wsHeader, CFX_WideString &wsResponse) override;
- FX_BOOL PutRequestURL(const CFX_WideStringC& wsURL, const CFX_WideStringC& wsData, const CFX_WideStringC& wsEncode) override;
-
- void LoadString(int32_t iStringID, CFX_WideString &wsString) override;
- FX_BOOL ShowFileDialog(const CFX_WideStringC& wsTitle, const CFX_WideStringC& wsFilter, CFX_WideStringArray &wsPathArr, FX_BOOL bOpen) override;
- IFWL_AdapterTimerMgr* GetTimerMgr() override;
-
- CFX_ArrayTemplate<CPDFDoc_Environment*> m_pEnvList;
-
-protected:
- static CPDFXFA_App* g_pApp;
-
- FX_BOOL m_bInitRuntime;
- IXFA_App* m_pXFAApp;
- IXFA_FontMgr* m_pFontMgr;
- FXJSE_HRUNTIME m_hJSERuntime;
- IFXJS_Runtime* m_pJSRuntime;
- CJS_RuntimeFactory* m_pJSRuntimeFactory;
- CFX_WideString m_csAppType;
+class CPDFXFA_App : public IXFA_AppProvider {
+ public:
+ static CPDFXFA_App* GetInstance();
+ static void ReleaseInstance();
+
+ CPDFXFA_App();
+ ~CPDFXFA_App() override;
+
+ FX_BOOL Initialize();
+ IXFA_App* GetXFAApp() { return m_pXFAApp; }
+
+ FX_BOOL AddFormFillEnv(CPDFDoc_Environment* pEnv);
+ FX_BOOL RemoveFormFillEnv(CPDFDoc_Environment* pEnv);
+
+ FXJSE_HRUNTIME GetJSERuntime() { return m_hJSERuntime; }
+ void ReleaseRuntime();
+ FX_BOOL InitRuntime(FX_BOOL bReset = FALSE);
+
+ CJS_RuntimeFactory* GetRuntimeFactory() { return m_pJSRuntimeFactory; }
+
+ // IFXA_AppProvider:
+ void GetAppType(CFX_WideString& wsAppType) override;
+ void SetAppType(const CFX_WideStringC& wsAppType) override;
+
+ void GetLanguage(CFX_WideString& wsLanguage) override;
+ void GetPlatform(CFX_WideString& wsPlatform) override;
+ void GetVariation(CFX_WideString& wsVariation) override;
+ void GetVersion(CFX_WideString& wsVersion) override;
+ void GetFoxitVersion(CFX_WideString& wsFoxitVersion) override {
+ wsFoxitVersion = L"7.0";
+ }
+
+ void GetAppName(CFX_WideString& wsName) override;
+ void GetFoxitAppName(CFX_WideString& wsFoxitName) override {
+ wsFoxitName = L"Foxit";
+ }
+
+ void Beep(FX_DWORD dwType) override;
+ int32_t MsgBox(const CFX_WideStringC& wsMessage,
+ const CFX_WideStringC& wsTitle,
+ FX_DWORD dwIconType,
+ FX_DWORD dwButtonType) override;
+ void Response(CFX_WideString& wsAnswer,
+ const CFX_WideStringC& wsQuestion,
+ const CFX_WideStringC& wsTitle,
+ const CFX_WideStringC& wsDefaultAnswer,
+ FX_BOOL bMark) override;
+
+ int32_t GetDocumentCountInBatch() override;
+ int32_t GetCurDocumentInBatch() override;
+
+ IFX_FileRead* DownloadURL(const CFX_WideStringC& wsURL) override;
+ FX_BOOL PostRequestURL(const CFX_WideStringC& wsURL,
+ const CFX_WideStringC& wsData,
+ const CFX_WideStringC& wsContentType,
+ const CFX_WideStringC& wsEncode,
+ const CFX_WideStringC& wsHeader,
+ CFX_WideString& wsResponse) override;
+ FX_BOOL PutRequestURL(const CFX_WideStringC& wsURL,
+ const CFX_WideStringC& wsData,
+ const CFX_WideStringC& wsEncode) override;
+
+ void LoadString(int32_t iStringID, CFX_WideString& wsString) override;
+ FX_BOOL ShowFileDialog(const CFX_WideStringC& wsTitle,
+ const CFX_WideStringC& wsFilter,
+ CFX_WideStringArray& wsPathArr,
+ FX_BOOL bOpen) override;
+ IFWL_AdapterTimerMgr* GetTimerMgr() override;
+
+ CFX_ArrayTemplate<CPDFDoc_Environment*> m_pEnvList;
+
+ protected:
+ static CPDFXFA_App* g_pApp;
+
+ FX_BOOL m_bInitRuntime;
+ IXFA_App* m_pXFAApp;
+ IXFA_FontMgr* m_pFontMgr;
+ FXJSE_HRUNTIME m_hJSERuntime;
+ IFXJS_Runtime* m_pJSRuntime;
+ CJS_RuntimeFactory* m_pJSRuntimeFactory;
+ CFX_WideString m_csAppType;
};
#endif // FPDFXFA_APP_H_
diff --git a/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h b/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h
index f8d691ebfa..27e7a91cd5 100644
--- a/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h
+++ b/fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h
@@ -1,7 +1,7 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef FPDFXFA_DOC_H_
@@ -18,142 +18,219 @@ class IFXJS_Runtime;
class IFXJS_Context;
class IXFA_DocHandler;
-class CPDFXFA_Document : public IXFA_DocProvider
-{
-public:
- CPDFXFA_Document(CPDF_Document* pPDFDoc, CPDFXFA_App* pProvider);
- ~CPDFXFA_Document();
-
- FX_BOOL LoadXFADoc();
- CPDFXFA_App* GetApp() {return m_pApp;}
- CPDF_Document* GetPDFDoc() { return m_pPDFDoc; }
- IXFA_Doc* GetXFADoc() { return m_pXFADoc; }
- IXFA_DocView* GetXFADocView() { return m_pXFADocView; }
-
- int GetPageCount();
- CPDFXFA_Page* GetPage(int page_index);
- CPDFXFA_Page* GetPage(IXFA_PageView* pPage);
- void RemovePage(CPDFXFA_Page* page);
- int GetDocType(){ return m_iDocType; }
-
- CPDFSDK_Document* GetSDKDocument(CPDFDoc_Environment* pFormFillEnv);
- void ReleaseSDKDoc();
-
- void FXRect2PDFRect(const CFX_RectF& fxRectF, CPDF_Rect& pdfRect);
-
-public:
- virtual void SetChangeMark(IXFA_Doc* hDoc);
- virtual FX_BOOL GetChangeMark(IXFA_Doc* hDoc);
- //used in dynamic xfa, dwFlags refer to XFA_INVALIDATE_XXX macros.
- virtual void InvalidateRect(IXFA_PageView* pPageView, const CFX_RectF& rt, FX_DWORD dwFlags = 0);
- //used in static xfa, dwFlags refer to XFA_INVALIDATE_XXX macros.
- virtual void InvalidateRect(IXFA_Widget* hWidget, FX_DWORD dwFlags = 0);
- //show or hide caret
- virtual void DisplayCaret(IXFA_Widget* hWidget, FX_BOOL bVisible, const CFX_RectF* pRtAnchor);
- //dwPos: (0:bottom 1:top)
- virtual FX_BOOL GetPopupPos(IXFA_Widget* hWidget, FX_FLOAT fMinPopup, FX_FLOAT fMaxPopup,
- const CFX_RectF &rtAnchor, CFX_RectF &rtPopup);
- virtual FX_BOOL PopupMenu(IXFA_Widget* hWidget, CFX_PointF ptPopup, const CFX_RectF* pRectExclude = NULL);
-
- //dwFlags XFA_PAGEVIEWEVENT_Added, XFA_PAGEVIEWEVENT_Removing
- virtual void PageViewEvent(IXFA_PageView* pPageView, FX_DWORD dwFlags);
- //dwEvent refer to XFA_WIDGETEVENT_XXX
- virtual void WidgetEvent(IXFA_Widget* hWidget, CXFA_WidgetAcc* pWidgetData, FX_DWORD dwEvent, void* pParam = NULL, void* pAdditional = NULL);
-
- //return true if render it.
- virtual FX_BOOL RenderCustomWidget(IXFA_Widget* hWidget, CFX_Graphics* pGS, CFX_Matrix* pMatrix, const CFX_RectF& rtUI){return FALSE;}
-
- //host method
- virtual int32_t CountPages(IXFA_Doc* hDoc);
- virtual int32_t GetCurrentPage(IXFA_Doc* hDoc);
- virtual void SetCurrentPage(IXFA_Doc* hDoc, int32_t iCurPage);
- virtual FX_BOOL IsCalculationsEnabled(IXFA_Doc* hDoc);
- virtual void SetCalculationsEnabled(IXFA_Doc* hDoc, FX_BOOL bEnabled);
- virtual void GetTitle(IXFA_Doc* hDoc, CFX_WideString &wsTitle);
- virtual void SetTitle(IXFA_Doc* hDoc, const CFX_WideStringC& wsTitle);
- virtual void ExportData(IXFA_Doc* hDoc, const CFX_WideStringC& wsFilePath, FX_BOOL bXDP = TRUE);
- virtual void ImportData(IXFA_Doc* hDoc, const CFX_WideStringC& wsFilePath);
- virtual void GotoURL(IXFA_Doc* hDoc, const CFX_WideStringC& bsURL, FX_BOOL bAppend = TRUE);
- virtual FX_BOOL IsValidationsEnabled(IXFA_Doc* hDoc);
- virtual void SetValidationsEnabled(IXFA_Doc* hDoc, FX_BOOL bEnabled);
- virtual void SetFocusWidget(IXFA_Doc* hDoc, IXFA_Widget* hWidget);
- virtual void Print(IXFA_Doc* hDoc, int32_t nStartPage, int32_t nEndPage, FX_DWORD dwOptions);
-
- //LayoutPseudo method
- virtual int32_t AbsPageCountInBatch(IXFA_Doc* hDoc){return 0;}
- virtual int32_t AbsPageInBatch(IXFA_Doc* hDoc, IXFA_Widget* hWidget){return 0;}
- virtual int32_t SheetCountInBatch(IXFA_Doc* hDoc){return 0;}
- virtual int32_t SheetInBatch(IXFA_Doc* hDoc, IXFA_Widget* hWidget){return 0;}
-
- //SignaturePseudoModel method
- //TODO:
- virtual int32_t Verify(IXFA_Doc* hDoc, CXFA_Node* pSigNode, FX_BOOL bUsed = TRUE/*, SecurityHandler* pHandler, SignatureInfo &info*/) {return 0;}
- virtual FX_BOOL Sign(IXFA_Doc* hDoc, CXFA_NodeList* pNodeList, const CFX_WideStringC& wsExpression, const CFX_WideStringC& wsXMLIdent, const CFX_WideStringC& wsValue = FX_WSTRC(L"open"), FX_BOOL bUsed = TRUE/*, SecurityHandler* pHandler = NULL, SignatureInfo &info*/) {return 0;}
- virtual CXFA_NodeList* Enumerate(IXFA_Doc* hDoc) {return 0;}
- virtual FX_BOOL Clear(IXFA_Doc* hDoc, CXFA_Node* pSigNode, FX_BOOL bCleared = TRUE) {return 0;}
-
- //Get document path
- virtual void GetURL(IXFA_Doc* hDoc, CFX_WideString &wsDocURL);
- virtual FX_ARGB GetHighlightColor(IXFA_Doc* hDoc);
- virtual void AddDoRecord(IXFA_Widget* hWidget);
- /**
- *Submit data to email, http, ftp.
- * @param[in] hDoc The document handler.
- * @param[in] eFormat Determines the format in which the data will be submitted. XFA_ATTRIBUTEENUM_Xdp, XFA_ATTRIBUTEENUM_Xml...
- * @param[in] wsTarget The URL to which the data will be submitted.
- * @param[in] eEncoding The encoding of text content.
- * @param[in] pXDPContent Controls what subset of the data is submitted, used only when the format property is xdp.
- * @param[in] bEmbedPDF, specifies whether PDF is embedded in the submitted content or not.
- */
- virtual FX_BOOL SubmitData(IXFA_Doc* hDoc, CXFA_Submit submit);
-
- virtual FX_BOOL CheckWord(IXFA_Doc* hDoc, const CFX_ByteStringC& sWord){return FALSE;}
- virtual FX_BOOL GetSuggestWords(IXFA_Doc* hDoc, const CFX_ByteStringC& sWord, CFX_ByteStringArray& sSuggest){return FALSE;}
-
- //Get PDF javascript object, set the object to hValue.
- virtual FX_BOOL GetPDFScriptObject(IXFA_Doc* hDoc, const CFX_ByteStringC& utf8Name, FXJSE_HVALUE hValue);
-
- virtual FX_BOOL GetGlobalProperty(IXFA_Doc* hDoc, const CFX_ByteStringC& szPropName, FXJSE_HVALUE hValue);
- virtual FX_BOOL SetGlobalProperty(IXFA_Doc* hDoc, const CFX_ByteStringC& szPropName, FXJSE_HVALUE hValue);
- virtual CPDF_Document* OpenPDF(IXFA_Doc* hDoc, IFX_FileRead* pFile, FX_BOOL bTakeOverFile){return NULL;}
-
- virtual IFX_FileRead* OpenLinkedFile(IXFA_Doc* hDoc, const CFX_WideString& wsLink);
-
- FX_BOOL _GetHValueByName(const CFX_ByteStringC& utf8Name, FXJSE_HVALUE hValue, IFXJS_Runtime* runTime);
- FX_BOOL _OnBeforeNotifySumbit();
- void _OnAfterNotifySumbit();
- FX_BOOL _NotifySubmit(FX_BOOL bPrevOrPost);
- FX_BOOL _SubmitData(IXFA_Doc* hDoc, CXFA_Submit submit);
- FX_BOOL _MailToInfo(CFX_WideString& csURL, CFX_WideString& csToAddress, CFX_WideString& csCCAddress, CFX_WideString& csBCCAddress, CFX_WideString& csSubject, CFX_WideString& csMsg);
- FX_BOOL _ExportSubmitFile(FPDF_FILEHANDLER* ppFileHandler, int fileType, FPDF_DWORD encodeType, FPDF_DWORD flag = 0x01111111);
- void _ToXFAContentFlags(CFX_WideString csSrcContent, FPDF_DWORD& flag);
- void _ClearChangeMark();
-
-private:
- void CloseXFADoc(IXFA_DocHandler* pDoc) {
- if (pDoc) {
- pDoc->CloseDoc(m_pXFADoc);
- pDoc->ReleaseDoc(m_pXFADoc);
- m_pXFADoc = NULL;
- m_pXFADocView = NULL;
- }
- }
-
- CPDF_Document* m_pPDFDoc;
- IXFA_Doc* m_pXFADoc;
- IXFA_DocView* m_pXFADocView;
- CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList;
-
- CPDFSDK_Document* m_pSDKDoc;
- CPDFXFA_App* m_pApp;
-
- CFX_MapByteStringToPtr m_XfaGlobalProperty;
-
- CFX_MapByteStringToPtr m_ValueMap;
-
- IFXJS_Context* m_pJSContext;
-
- int m_iDocType;
+class CPDFXFA_Document : public IXFA_DocProvider {
+ public:
+ CPDFXFA_Document(CPDF_Document* pPDFDoc, CPDFXFA_App* pProvider);
+ ~CPDFXFA_Document();
+
+ FX_BOOL LoadXFADoc();
+ CPDFXFA_App* GetApp() { return m_pApp; }
+ CPDF_Document* GetPDFDoc() { return m_pPDFDoc; }
+ IXFA_Doc* GetXFADoc() { return m_pXFADoc; }
+ IXFA_DocView* GetXFADocView() { return m_pXFADocView; }
+
+ int GetPageCount();
+ CPDFXFA_Page* GetPage(int page_index);
+ CPDFXFA_Page* GetPage(IXFA_PageView* pPage);
+ void RemovePage(CPDFXFA_Page* page);
+ int GetDocType() { return m_iDocType; }
+
+ CPDFSDK_Document* GetSDKDocument(CPDFDoc_Environment* pFormFillEnv);
+ void ReleaseSDKDoc();
+
+ void FXRect2PDFRect(const CFX_RectF& fxRectF, CPDF_Rect& pdfRect);
+
+ public:
+ virtual void SetChangeMark(IXFA_Doc* hDoc);
+ virtual FX_BOOL GetChangeMark(IXFA_Doc* hDoc);
+ // used in dynamic xfa, dwFlags refer to XFA_INVALIDATE_XXX macros.
+ virtual void InvalidateRect(IXFA_PageView* pPageView,
+ const CFX_RectF& rt,
+ FX_DWORD dwFlags = 0);
+ // used in static xfa, dwFlags refer to XFA_INVALIDATE_XXX macros.
+ virtual void InvalidateRect(IXFA_Widget* hWidget, FX_DWORD dwFlags = 0);
+ // show or hide caret
+ virtual void DisplayCaret(IXFA_Widget* hWidget,
+ FX_BOOL bVisible,
+ const CFX_RectF* pRtAnchor);
+ // dwPos: (0:bottom 1:top)
+ virtual FX_BOOL GetPopupPos(IXFA_Widget* hWidget,
+ FX_FLOAT fMinPopup,
+ FX_FLOAT fMaxPopup,
+ const CFX_RectF& rtAnchor,
+ CFX_RectF& rtPopup);
+ virtual FX_BOOL PopupMenu(IXFA_Widget* hWidget,
+ CFX_PointF ptPopup,
+ const CFX_RectF* pRectExclude = NULL);
+
+ // dwFlags XFA_PAGEVIEWEVENT_Added, XFA_PAGEVIEWEVENT_Removing
+ virtual void PageViewEvent(IXFA_PageView* pPageView, FX_DWORD dwFlags);
+ // dwEvent refer to XFA_WIDGETEVENT_XXX
+ virtual void WidgetEvent(IXFA_Widget* hWidget,
+ CXFA_WidgetAcc* pWidgetData,
+ FX_DWORD dwEvent,
+ void* pParam = NULL,
+ void* pAdditional = NULL);
+
+ // return true if render it.
+ virtual FX_BOOL RenderCustomWidget(IXFA_Widget* hWidget,
+ CFX_Graphics* pGS,
+ CFX_Matrix* pMatrix,
+ const CFX_RectF& rtUI) {
+ return FALSE;
+ }
+
+ // host method
+ virtual int32_t CountPages(IXFA_Doc* hDoc);
+ virtual int32_t GetCurrentPage(IXFA_Doc* hDoc);
+ virtual void SetCurrentPage(IXFA_Doc* hDoc, int32_t iCurPage);
+ virtual FX_BOOL IsCalculationsEnabled(IXFA_Doc* hDoc);
+ virtual void SetCalculationsEnabled(IXFA_Doc* hDoc, FX_BOOL bEnabled);
+ virtual void GetTitle(IXFA_Doc* hDoc, CFX_WideString& wsTitle);
+ virtual void SetTitle(IXFA_Doc* hDoc, const CFX_WideStringC& wsTitle);
+ virtual void ExportData(IXFA_Doc* hDoc,
+ const CFX_WideStringC& wsFilePath,
+ FX_BOOL bXDP = TRUE);
+ virtual void ImportData(IXFA_Doc* hDoc, const CFX_WideStringC& wsFilePath);
+ virtual void GotoURL(IXFA_Doc* hDoc,
+ const CFX_WideStringC& bsURL,
+ FX_BOOL bAppend = TRUE);
+ virtual FX_BOOL IsValidationsEnabled(IXFA_Doc* hDoc);
+ virtual void SetValidationsEnabled(IXFA_Doc* hDoc, FX_BOOL bEnabled);
+ virtual void SetFocusWidget(IXFA_Doc* hDoc, IXFA_Widget* hWidget);
+ virtual void Print(IXFA_Doc* hDoc,
+ int32_t nStartPage,
+ int32_t nEndPage,
+ FX_DWORD dwOptions);
+
+ // LayoutPseudo method
+ virtual int32_t AbsPageCountInBatch(IXFA_Doc* hDoc) { return 0; }
+ virtual int32_t AbsPageInBatch(IXFA_Doc* hDoc, IXFA_Widget* hWidget) {
+ return 0;
+ }
+ virtual int32_t SheetCountInBatch(IXFA_Doc* hDoc) { return 0; }
+ virtual int32_t SheetInBatch(IXFA_Doc* hDoc, IXFA_Widget* hWidget) {
+ return 0;
+ }
+
+ // SignaturePseudoModel method
+ // TODO:
+ virtual int32_t Verify(
+ IXFA_Doc* hDoc,
+ CXFA_Node* pSigNode,
+ FX_BOOL
+ bUsed = TRUE /*, SecurityHandler* pHandler, SignatureInfo &info*/) {
+ return 0;
+ }
+ virtual FX_BOOL Sign(
+ IXFA_Doc* hDoc,
+ CXFA_NodeList* pNodeList,
+ const CFX_WideStringC& wsExpression,
+ const CFX_WideStringC& wsXMLIdent,
+ const CFX_WideStringC& wsValue = FX_WSTRC(L"open"),
+ FX_BOOL
+ bUsed = TRUE /*, SecurityHandler* pHandler = NULL, SignatureInfo &info*/) {
+ return 0;
+ }
+ virtual CXFA_NodeList* Enumerate(IXFA_Doc* hDoc) { return 0; }
+ virtual FX_BOOL Clear(IXFA_Doc* hDoc,
+ CXFA_Node* pSigNode,
+ FX_BOOL bCleared = TRUE) {
+ return 0;
+ }
+
+ // Get document path
+ virtual void GetURL(IXFA_Doc* hDoc, CFX_WideString& wsDocURL);
+ virtual FX_ARGB GetHighlightColor(IXFA_Doc* hDoc);
+ virtual void AddDoRecord(IXFA_Widget* hWidget);
+ /**
+ *Submit data to email, http, ftp.
+ * @param[in] hDoc The document handler.
+ * @param[in] eFormat Determines the format in which the data will be
+ *submitted. XFA_ATTRIBUTEENUM_Xdp, XFA_ATTRIBUTEENUM_Xml...
+ * @param[in] wsTarget The URL to which the data will be submitted.
+ * @param[in] eEncoding The encoding of text content.
+ * @param[in] pXDPContent Controls what subset of the data is submitted, used
+ *only when the format property is xdp.
+ * @param[in] bEmbedPDF, specifies whether PDF is embedded in the submitted
+ *content or not.
+ */
+ virtual FX_BOOL SubmitData(IXFA_Doc* hDoc, CXFA_Submit submit);
+
+ virtual FX_BOOL CheckWord(IXFA_Doc* hDoc, const CFX_ByteStringC& sWord) {
+ return FALSE;
+ }
+ virtual FX_BOOL GetSuggestWords(IXFA_Doc* hDoc,
+ const CFX_ByteStringC& sWord,
+ CFX_ByteStringArray& sSuggest) {
+ return FALSE;
+ }
+
+ // Get PDF javascript object, set the object to hValue.
+ virtual FX_BOOL GetPDFScriptObject(IXFA_Doc* hDoc,
+ const CFX_ByteStringC& utf8Name,
+ FXJSE_HVALUE hValue);
+
+ virtual FX_BOOL GetGlobalProperty(IXFA_Doc* hDoc,
+ const CFX_ByteStringC& szPropName,
+ FXJSE_HVALUE hValue);
+ virtual FX_BOOL SetGlobalProperty(IXFA_Doc* hDoc,
+ const CFX_ByteStringC& szPropName,
+ FXJSE_HVALUE hValue);
+ virtual CPDF_Document* OpenPDF(IXFA_Doc* hDoc,
+ IFX_FileRead* pFile,
+ FX_BOOL bTakeOverFile) {
+ return NULL;
+ }
+
+ virtual IFX_FileRead* OpenLinkedFile(IXFA_Doc* hDoc,
+ const CFX_WideString& wsLink);
+
+ FX_BOOL _GetHValueByName(const CFX_ByteStringC& utf8Name,
+ FXJSE_HVALUE hValue,
+ IFXJS_Runtime* runTime);
+ FX_BOOL _OnBeforeNotifySumbit();
+ void _OnAfterNotifySumbit();
+ FX_BOOL _NotifySubmit(FX_BOOL bPrevOrPost);
+ FX_BOOL _SubmitData(IXFA_Doc* hDoc, CXFA_Submit submit);
+ FX_BOOL _MailToInfo(CFX_WideString& csURL,
+ CFX_WideString& csToAddress,
+ CFX_WideString& csCCAddress,
+ CFX_WideString& csBCCAddress,
+ CFX_WideString& csSubject,
+ CFX_WideString& csMsg);
+ FX_BOOL _ExportSubmitFile(FPDF_FILEHANDLER* ppFileHandler,
+ int fileType,
+ FPDF_DWORD encodeType,
+ FPDF_DWORD flag = 0x01111111);
+ void _ToXFAContentFlags(CFX_WideString csSrcContent, FPDF_DWORD& flag);
+ void _ClearChangeMark();
+
+ private:
+ void CloseXFADoc(IXFA_DocHandler* pDoc) {
+ if (pDoc) {
+ pDoc->CloseDoc(m_pXFADoc);
+ pDoc->ReleaseDoc(m_pXFADoc);
+ m_pXFADoc = NULL;
+ m_pXFADocView = NULL;
+ }
+ }
+
+ CPDF_Document* m_pPDFDoc;
+ IXFA_Doc* m_pXFADoc;
+ IXFA_DocView* m_pXFADocView;
+ CFX_ArrayTemplate<CPDFXFA_Page*> m_XFAPageList;
+
+ CPDFSDK_Document* m_pSDKDoc;
+ CPDFXFA_App* m_pApp;
+
+ CFX_MapByteStringToPtr m_XfaGlobalProperty;
+
+ CFX_MapByteStringToPtr m_ValueMap;
+
+ IFXJS_Context* m_pJSContext;
+
+ int m_iDocType;
};
#endif // FPDFXFA_DOC_H_
diff --git a/fpdfsdk/include/fpdfxfa/fpdfxfa_page.h b/fpdfsdk/include/fpdfxfa/fpdfxfa_page.h
index f55a42496d..1a97fe4a5a 100644
--- a/fpdfsdk/include/fpdfxfa/fpdfxfa_page.h
+++ b/fpdfsdk/include/fpdfxfa/fpdfxfa_page.h
@@ -1,48 +1,65 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef _FPDFXFA_PAGEVIEW_H_
#define _FPDFXFA_PAGEVIEW_H_
-class CPDFXFA_Page
-{
-public:
- CPDFXFA_Page(CPDFXFA_Document* pDoc, int page_index);
- ~CPDFXFA_Page();
-
- void Release();
- void AddRef(){ m_iRef ++; }
- FX_BOOL LoadPage();
- FX_BOOL LoadPDFPage(CPDF_Dictionary* pageDict);
- CPDFXFA_Document* GetDocument() { return m_pDocument; }
- int GetPageIndex() { return m_iPageIndex; }
- CPDF_Page* GetPDFPage() { return m_pPDFPage; }
- IXFA_PageView* GetXFAPageView() { return m_pXFAPageView; }
-
- FX_FLOAT GetPageWidth();
- FX_FLOAT GetPageHeight();
-
- void DeviceToPage(int start_x, int start_y, int size_x, int size_y,
- int rotate, int device_x, int device_y, double* page_x, double* page_y);
- void PageToDevice(int start_x, int start_y, int size_x, int size_y,
- int rotate, double page_x, double page_y, int* device_x, int* device_y);
-
- void GetDisplayMatrix(CFX_AffineMatrix& matrix, int xPos, int yPos,
- int xSize, int ySize, int iRotate) const;
-
-protected:
- FX_BOOL LoadPDFPage();
- FX_BOOL LoadXFAPageView();
-
-private:
- CPDF_Page* m_pPDFPage;
- IXFA_PageView* m_pXFAPageView;
- int m_iPageIndex;
- CPDFXFA_Document* m_pDocument;
- int m_iRef;
+class CPDFXFA_Page {
+ public:
+ CPDFXFA_Page(CPDFXFA_Document* pDoc, int page_index);
+ ~CPDFXFA_Page();
+
+ void Release();
+ void AddRef() { m_iRef++; }
+ FX_BOOL LoadPage();
+ FX_BOOL LoadPDFPage(CPDF_Dictionary* pageDict);
+ CPDFXFA_Document* GetDocument() { return m_pDocument; }
+ int GetPageIndex() { return m_iPageIndex; }
+ CPDF_Page* GetPDFPage() { return m_pPDFPage; }
+ IXFA_PageView* GetXFAPageView() { return m_pXFAPageView; }
+
+ FX_FLOAT GetPageWidth();
+ FX_FLOAT GetPageHeight();
+
+ void DeviceToPage(int start_x,
+ int start_y,
+ int size_x,
+ int size_y,
+ int rotate,
+ int device_x,
+ int device_y,
+ double* page_x,
+ double* page_y);
+ void PageToDevice(int start_x,
+ int start_y,
+ int size_x,
+ int size_y,
+ int rotate,
+ double page_x,
+ double page_y,
+ int* device_x,
+ int* device_y);
+
+ void GetDisplayMatrix(CFX_AffineMatrix& matrix,
+ int xPos,
+ int yPos,
+ int xSize,
+ int ySize,
+ int iRotate) const;
+
+ protected:
+ FX_BOOL LoadPDFPage();
+ FX_BOOL LoadXFAPageView();
+
+ private:
+ CPDF_Page* m_pPDFPage;
+ IXFA_PageView* m_pXFAPageView;
+ int m_iPageIndex;
+ CPDFXFA_Document* m_pDocument;
+ int m_iRef;
};
#endif
diff --git a/fpdfsdk/include/fpdfxfa/fpdfxfa_util.h b/fpdfsdk/include/fpdfxfa/fpdfxfa_util.h
index 9676b1399f..a6f327a201 100644
--- a/fpdfsdk/include/fpdfxfa/fpdfxfa_util.h
+++ b/fpdfsdk/include/fpdfxfa/fpdfxfa_util.h
@@ -1,44 +1,38 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef _FPDFXFA_UTIL_H_
#define _FPDFXFA_UTIL_H_
-#define JS_STR_VIEWERTYPE_STANDARD L"Exchange"
-#define JS_STR_LANGUANGE L"ENU"
-#define JS_STR_VIEWERVARIATION L"Full"
-#define JS_STR_VIEWERVERSION_XFA L"11"
-
-class CXFA_FWLAdapterTimerMgr : public IFWL_AdapterTimerMgr
-{
-public:
- CXFA_FWLAdapterTimerMgr(CPDFDoc_Environment* pEnv) : m_pEnv(pEnv)
- {
-
- }
- virtual FWL_ERR Start(IFWL_Timer *pTimer, FX_DWORD dwElapse, FWL_HTIMER &hTimer, FX_BOOL bImmediately = TRUE);
- virtual FWL_ERR Stop(FWL_HTIMER hTimer);
-
-protected:
- static void TimerProc(int32_t idEvent);
-
- static CFX_PtrArray ms_timerArray;
- CPDFDoc_Environment* m_pEnv;
+#define JS_STR_VIEWERTYPE_STANDARD L"Exchange"
+#define JS_STR_LANGUANGE L"ENU"
+#define JS_STR_VIEWERVARIATION L"Full"
+#define JS_STR_VIEWERVERSION_XFA L"11"
+
+class CXFA_FWLAdapterTimerMgr : public IFWL_AdapterTimerMgr {
+ public:
+ CXFA_FWLAdapterTimerMgr(CPDFDoc_Environment* pEnv) : m_pEnv(pEnv) {}
+ virtual FWL_ERR Start(IFWL_Timer* pTimer,
+ FX_DWORD dwElapse,
+ FWL_HTIMER& hTimer,
+ FX_BOOL bImmediately = TRUE);
+ virtual FWL_ERR Stop(FWL_HTIMER hTimer);
+
+ protected:
+ static void TimerProc(int32_t idEvent);
+
+ static CFX_PtrArray ms_timerArray;
+ CPDFDoc_Environment* m_pEnv;
};
-class CFWL_TimerInfo
-{
-public:
- CFWL_TimerInfo()
- : pTimer(NULL)
- {
-
- }
- uint32_t uIDEvent;
- IFWL_Timer *pTimer;
+class CFWL_TimerInfo {
+ public:
+ CFWL_TimerInfo() : pTimer(NULL) {}
+ uint32_t uIDEvent;
+ IFWL_Timer* pTimer;
};
-#endif
+#endif
diff --git a/fpdfsdk/include/fsdk_actionhandler.h b/fpdfsdk/include/fsdk_actionhandler.h
index 39ec4f41af..dfb7d488c2 100644
--- a/fpdfsdk/include/fsdk_actionhandler.h
+++ b/fpdfsdk/include/fsdk_actionhandler.h
@@ -20,65 +20,118 @@ class CPDF_Bookmark;
class CPDF_Dictionary;
class IFXJS_Runtime;
-class CPDFSDK_FormActionHandler
-{
-public:
- FX_BOOL DoAction_Hide(const CPDF_Action& action, CPDFSDK_Document* pDocument);
- FX_BOOL DoAction_SubmitForm(const CPDF_Action& action, CPDFSDK_Document* pDocument);
- FX_BOOL DoAction_ResetForm(const CPDF_Action& action, CPDFSDK_Document* pDocument);
- FX_BOOL DoAction_ImportData(const CPDF_Action& action, CPDFSDK_Document* pDocument);
+class CPDFSDK_FormActionHandler {
+ public:
+ FX_BOOL DoAction_Hide(const CPDF_Action& action, CPDFSDK_Document* pDocument);
+ FX_BOOL DoAction_SubmitForm(const CPDF_Action& action,
+ CPDFSDK_Document* pDocument);
+ FX_BOOL DoAction_ResetForm(const CPDF_Action& action,
+ CPDFSDK_Document* pDocument);
+ FX_BOOL DoAction_ImportData(const CPDF_Action& action,
+ CPDFSDK_Document* pDocument);
};
-class CPDFSDK_MediaActionHandler
-{
-public:
- FX_BOOL DoAction_Rendition(const CPDF_Action& action, CPDFSDK_Document* pDocument);
- FX_BOOL DoAction_Sound(const CPDF_Action& action, CPDFSDK_Document* pDocument);
- FX_BOOL DoAction_Movie(const CPDF_Action& action, CPDFSDK_Document* pDocument);
+class CPDFSDK_MediaActionHandler {
+ public:
+ FX_BOOL DoAction_Rendition(const CPDF_Action& action,
+ CPDFSDK_Document* pDocument);
+ FX_BOOL DoAction_Sound(const CPDF_Action& action,
+ CPDFSDK_Document* pDocument);
+ FX_BOOL DoAction_Movie(const CPDF_Action& action,
+ CPDFSDK_Document* pDocument);
};
-class CPDFSDK_ActionHandler
-{
-public:
- CPDFSDK_ActionHandler(CPDFDoc_Environment* pEvi);
+class CPDFSDK_ActionHandler {
+ public:
+ CPDFSDK_ActionHandler(CPDFDoc_Environment* pEvi);
- void SetMediaActionHandler(CPDFSDK_MediaActionHandler* pHandler);
+ void SetMediaActionHandler(CPDFSDK_MediaActionHandler* pHandler);
- FX_BOOL DoAction_DocOpen(const CPDF_Action& action, CPDFSDK_Document* pDocument);
- FX_BOOL DoAction_JavaScript(const CPDF_Action& JsAction,CFX_WideString csJSName, CPDFSDK_Document* pDocument);
- FX_BOOL DoAction_Page(const CPDF_Action& action, enum CPDF_AAction::AActionType eType, CPDFSDK_Document* pDocument);
- FX_BOOL DoAction_Document(const CPDF_Action& action, enum CPDF_AAction::AActionType eType, CPDFSDK_Document* pDocument);
- FX_BOOL DoAction_BookMark(CPDF_Bookmark *pBookMark, const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument);
- FX_BOOL DoAction_Screen(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CPDFSDK_Annot* pScreen);
- FX_BOOL DoAction_Link(const CPDF_Action& action, CPDFSDK_Document* pDocument);
- FX_BOOL DoAction_Field(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, PDFSDK_FieldAction& data);
- FX_BOOL DoAction_FieldJavaScript(const CPDF_Action& JsAction, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, PDFSDK_FieldAction& data);
+ FX_BOOL DoAction_DocOpen(const CPDF_Action& action,
+ CPDFSDK_Document* pDocument);
+ FX_BOOL DoAction_JavaScript(const CPDF_Action& JsAction,
+ CFX_WideString csJSName,
+ CPDFSDK_Document* pDocument);
+ FX_BOOL DoAction_Page(const CPDF_Action& action,
+ enum CPDF_AAction::AActionType eType,
+ CPDFSDK_Document* pDocument);
+ FX_BOOL DoAction_Document(const CPDF_Action& action,
+ enum CPDF_AAction::AActionType eType,
+ CPDFSDK_Document* pDocument);
+ FX_BOOL DoAction_BookMark(CPDF_Bookmark* pBookMark,
+ const CPDF_Action& action,
+ CPDF_AAction::AActionType type,
+ CPDFSDK_Document* pDocument);
+ FX_BOOL DoAction_Screen(const CPDF_Action& action,
+ CPDF_AAction::AActionType type,
+ CPDFSDK_Document* pDocument,
+ CPDFSDK_Annot* pScreen);
+ FX_BOOL DoAction_Link(const CPDF_Action& action, CPDFSDK_Document* pDocument);
+ FX_BOOL DoAction_Field(const CPDF_Action& action,
+ CPDF_AAction::AActionType type,
+ CPDFSDK_Document* pDocument,
+ CPDF_FormField* pFormField,
+ PDFSDK_FieldAction& data);
+ FX_BOOL DoAction_FieldJavaScript(const CPDF_Action& JsAction,
+ CPDF_AAction::AActionType type,
+ CPDFSDK_Document* pDocument,
+ CPDF_FormField* pFormField,
+ PDFSDK_FieldAction& data);
-private:
- FX_BOOL ExecuteDocumentOpenAction(const CPDF_Action& action, CPDFSDK_Document* pDocument, CFX_PtrList& list);
- FX_BOOL ExecuteDocumentPageAction(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CFX_PtrList& list);
- FX_BOOL ExecuteFieldAction(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, PDFSDK_FieldAction& data, CFX_PtrList& list);
- FX_BOOL ExecuteScreenAction(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CPDFSDK_Annot* pScreen, CFX_PtrList& list);
- FX_BOOL ExecuteBookMark(const CPDF_Action& action, CPDFSDK_Document* pDocument, CPDF_Bookmark* pBookmark, CFX_PtrList& list);
- FX_BOOL ExecuteLinkAction(const CPDF_Action& action, CPDFSDK_Document* pDocument, CFX_PtrList& list);
+ private:
+ FX_BOOL ExecuteDocumentOpenAction(const CPDF_Action& action,
+ CPDFSDK_Document* pDocument,
+ CFX_PtrList& list);
+ FX_BOOL ExecuteDocumentPageAction(const CPDF_Action& action,
+ CPDF_AAction::AActionType type,
+ CPDFSDK_Document* pDocument,
+ CFX_PtrList& list);
+ FX_BOOL ExecuteFieldAction(const CPDF_Action& action,
+ CPDF_AAction::AActionType type,
+ CPDFSDK_Document* pDocument,
+ CPDF_FormField* pFormField,
+ PDFSDK_FieldAction& data,
+ CFX_PtrList& list);
+ FX_BOOL ExecuteScreenAction(const CPDF_Action& action,
+ CPDF_AAction::AActionType type,
+ CPDFSDK_Document* pDocument,
+ CPDFSDK_Annot* pScreen,
+ CFX_PtrList& list);
+ FX_BOOL ExecuteBookMark(const CPDF_Action& action,
+ CPDFSDK_Document* pDocument,
+ CPDF_Bookmark* pBookmark,
+ CFX_PtrList& list);
+ FX_BOOL ExecuteLinkAction(const CPDF_Action& action,
+ CPDFSDK_Document* pDocument,
+ CFX_PtrList& list);
- void DoAction_NoJs(const CPDF_Action& action, CPDFSDK_Document* pDocument);
- void RunDocumentPageJavaScript(CPDFSDK_Document* pDocument, CPDF_AAction::AActionType type, const CFX_WideString& script);
- void RunDocumentOpenJavaScript(CPDFSDK_Document* pDocument, const CFX_WideString& sScriptName, const CFX_WideString& script);
- void RunFieldJavaScript(CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, CPDF_AAction::AActionType type, PDFSDK_FieldAction& data, const CFX_WideString& script);
+ void DoAction_NoJs(const CPDF_Action& action, CPDFSDK_Document* pDocument);
+ void RunDocumentPageJavaScript(CPDFSDK_Document* pDocument,
+ CPDF_AAction::AActionType type,
+ const CFX_WideString& script);
+ void RunDocumentOpenJavaScript(CPDFSDK_Document* pDocument,
+ const CFX_WideString& sScriptName,
+ const CFX_WideString& script);
+ void RunFieldJavaScript(CPDFSDK_Document* pDocument,
+ CPDF_FormField* pFormField,
+ CPDF_AAction::AActionType type,
+ PDFSDK_FieldAction& data,
+ const CFX_WideString& script);
- FX_BOOL IsValidField(CPDFSDK_Document* pDocument, CPDF_Dictionary* pFieldDict);
- FX_BOOL IsValidDocView(CPDFSDK_Document* pDocument);
+ FX_BOOL IsValidField(CPDFSDK_Document* pDocument,
+ CPDF_Dictionary* pFieldDict);
+ FX_BOOL IsValidDocView(CPDFSDK_Document* pDocument);
- void DoAction_GoTo(CPDFSDK_Document* pDocument, const CPDF_Action& action);
- void DoAction_GoToR(CPDFSDK_Document* pDocument, const CPDF_Action& action);
- void DoAction_Launch(CPDFSDK_Document* pDocument, const CPDF_Action& action);
- void DoAction_URI(CPDFSDK_Document* pDocument, const CPDF_Action& action);
- void DoAction_Named(CPDFSDK_Document* pDocument, const CPDF_Action& action);
- void DoAction_SetOCGState(CPDFSDK_Document* pDocument, const CPDF_Action& action);
+ void DoAction_GoTo(CPDFSDK_Document* pDocument, const CPDF_Action& action);
+ void DoAction_GoToR(CPDFSDK_Document* pDocument, const CPDF_Action& action);
+ void DoAction_Launch(CPDFSDK_Document* pDocument, const CPDF_Action& action);
+ void DoAction_URI(CPDFSDK_Document* pDocument, const CPDF_Action& action);
+ void DoAction_Named(CPDFSDK_Document* pDocument, const CPDF_Action& action);
+ void DoAction_SetOCGState(CPDFSDK_Document* pDocument,
+ const CPDF_Action& action);
- nonstd::unique_ptr<CPDFSDK_FormActionHandler> m_pFormActionHandler;
- CPDFSDK_MediaActionHandler* m_pMediaActionHandler;
+ nonstd::unique_ptr<CPDFSDK_FormActionHandler> m_pFormActionHandler;
+ CPDFSDK_MediaActionHandler* m_pMediaActionHandler;
};
#endif // FPDFSDK_INCLUDE_FSDK_ACTIONHANDLER_H_
diff --git a/fpdfsdk/include/fsdk_annothandler.h b/fpdfsdk/include/fsdk_annothandler.h
index b46aae2b23..b755e7ec3f 100644
--- a/fpdfsdk/include/fsdk_annothandler.h
+++ b/fpdfsdk/include/fsdk_annothandler.h
@@ -21,323 +21,468 @@ class CPDF_Matrix;
class CPDF_Point;
class CPDF_Rect;
-class IPDFSDK_AnnotHandler
-{
-
-public:
- virtual ~IPDFSDK_AnnotHandler() {};
-
- virtual CFX_ByteString GetType() = 0;
-
- virtual CFX_ByteString GetName() = 0;
-
- virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) = 0;
-
-
- virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) = 0;
-
- virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* hWidget, CPDFSDK_PageView* pPage) = 0;
-
- virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot) = 0;
-
- virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) = 0;
-
-
- virtual CPDF_Rect GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot) = 0;
-
- virtual FX_BOOL HitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, const CPDF_Point& point) = 0;
-
-
- virtual void OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- FX_DWORD dwFlags) = 0;
-
- virtual void OnDrawSleep(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- const CPDF_Rect& rcWindow, FX_DWORD dwFlags) = 0;
-
-
-
-
- virtual void OnCreate(CPDFSDK_Annot* pAnnot) = 0;
-
- virtual void OnLoad(CPDFSDK_Annot* pAnnot) = 0;
-
- virtual void OnDelete(CPDFSDK_Annot* pAnnot) = 0;
-
- virtual void OnRelease(CPDFSDK_Annot* pAnnot) = 0;
-
-
- virtual void OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0;
- virtual void OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0;
-
-
- virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
- virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
- virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
- virtual FX_BOOL OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
- virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) = 0;
- virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
- virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
- virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) = 0;
-//by wjm.
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX_DWORD nFlags) = 0;
- virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0;
- virtual FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) =0 ;
-
- virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) = 0;
- virtual void OnSelected(CPDFSDK_Annot* pAnnot) = 0;
-
- virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0;
- virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0;
- virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, CPDFSDK_Annot* pNewAnnot) = 0;
-
+class IPDFSDK_AnnotHandler {
+ public:
+ virtual ~IPDFSDK_AnnotHandler(){};
+
+ virtual CFX_ByteString GetType() = 0;
+
+ virtual CFX_ByteString GetName() = 0;
+
+ virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) = 0;
+
+ virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot,
+ CPDFSDK_PageView* pPage) = 0;
+
+ virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* hWidget,
+ CPDFSDK_PageView* pPage) = 0;
+
+ virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot) = 0;
+
+ virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) = 0;
+
+ virtual CPDF_Rect GetViewBBox(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot) = 0;
+
+ virtual FX_BOOL HitTest(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ const CPDF_Point& point) = 0;
+
+ virtual void OnDraw(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ FX_DWORD dwFlags) = 0;
+
+ virtual void OnDrawSleep(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ const CPDF_Rect& rcWindow,
+ FX_DWORD dwFlags) = 0;
+
+ virtual void OnCreate(CPDFSDK_Annot* pAnnot) = 0;
+
+ virtual void OnLoad(CPDFSDK_Annot* pAnnot) = 0;
+
+ virtual void OnDelete(CPDFSDK_Annot* pAnnot) = 0;
+
+ virtual void OnRelease(CPDFSDK_Annot* pAnnot) = 0;
+
+ virtual void OnMouseEnter(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlag) = 0;
+ virtual void OnMouseExit(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlag) = 0;
+
+ virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point) = 0;
+ virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point) = 0;
+ virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point) = 0;
+ virtual FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point) = 0;
+ virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ short zDelta,
+ const CPDF_Point& point) = 0;
+ virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point) = 0;
+ virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point) = 0;
+ virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point) = 0;
+ // by wjm.
+ virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot,
+ FX_DWORD nChar,
+ FX_DWORD nFlags) = 0;
+ virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0;
+ virtual FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0;
+
+ virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) = 0;
+ virtual void OnSelected(CPDFSDK_Annot* pAnnot) = 0;
+
+ virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0;
+ virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) = 0;
+ virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot,
+ CPDFSDK_Annot* pNewAnnot) = 0;
};
-
-class CPDFSDK_BFAnnotHandler:public IPDFSDK_AnnotHandler
-{
-public:
- CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp) : m_pApp(pApp), m_pFormFiller(NULL) {}
- virtual ~CPDFSDK_BFAnnotHandler() {}
-public:
-
- virtual CFX_ByteString GetType() {return CFX_ByteString("Widget");}
-
- virtual CFX_ByteString GetName() {return CFX_ByteString("WidgetHandler");}
-
- virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot);
-
- virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage);
-
- virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* hWidget, CPDFSDK_PageView* pPage);
-
- virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot) ;
-
- virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) {}
-
-
- virtual CPDF_Rect GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot) ;
-
- virtual FX_BOOL HitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, const CPDF_Point& point);
-
-
- virtual void OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- FX_DWORD dwFlags) ;
-
- virtual void OnDrawSleep(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- const CPDF_Rect& rcWindow, FX_DWORD dwFlags) {}
-
-
- virtual void OnCreate(CPDFSDK_Annot* pAnnot) ;
-
- virtual void OnLoad(CPDFSDK_Annot* pAnnot) ;
-
- virtual void OnDelete(CPDFSDK_Annot* pAnnot) {}
-
- virtual void OnRelease(CPDFSDK_Annot* pAnnot) {}
-
-
- virtual void OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) ;
- virtual void OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) ;
-
-
- virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
- virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
- virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
- virtual FX_BOOL OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
- virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) ;
- virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
- virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
- virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) {return FALSE;}
-
-//by wjm.
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX_DWORD nFlags);
- virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
- virtual FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
-
- virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) {}
- virtual void OnSelected(CPDFSDK_Annot* pAnnot) {}
-
- virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
- virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
- virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, CPDFSDK_Annot* pNewAnnot){ return TRUE; }
-
- void SetFormFiller(CFFL_IFormFiller* pFiller){m_pFormFiller = pFiller;}
- CFFL_IFormFiller* GetFormFiller() {return m_pFormFiller;}
-private:
-
- CPDFDoc_Environment* m_pApp;
- CFFL_IFormFiller* m_pFormFiller;
+class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler {
+ public:
+ CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp)
+ : m_pApp(pApp), m_pFormFiller(NULL) {}
+ virtual ~CPDFSDK_BFAnnotHandler() {}
+
+ public:
+ virtual CFX_ByteString GetType() { return CFX_ByteString("Widget"); }
+
+ virtual CFX_ByteString GetName() { return CFX_ByteString("WidgetHandler"); }
+
+ virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot);
+
+ virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage);
+
+ virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* hWidget,
+ CPDFSDK_PageView* pPage);
+
+ virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot);
+
+ virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) {}
+
+ virtual CPDF_Rect GetViewBBox(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot);
+
+ virtual FX_BOOL HitTest(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ const CPDF_Point& point);
+
+ virtual void OnDraw(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ FX_DWORD dwFlags);
+
+ virtual void OnDrawSleep(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ const CPDF_Rect& rcWindow,
+ FX_DWORD dwFlags) {}
+
+ virtual void OnCreate(CPDFSDK_Annot* pAnnot);
+
+ virtual void OnLoad(CPDFSDK_Annot* pAnnot);
+
+ virtual void OnDelete(CPDFSDK_Annot* pAnnot) {}
+
+ virtual void OnRelease(CPDFSDK_Annot* pAnnot) {}
+
+ virtual void OnMouseEnter(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlag);
+ virtual void OnMouseExit(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlag);
+
+ virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ short zDelta,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point) {
+ return FALSE;
+ }
+
+ // by wjm.
+ virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot,
+ FX_DWORD nChar,
+ FX_DWORD nFlags);
+ virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
+ virtual FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
+
+ virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) {}
+ virtual void OnSelected(CPDFSDK_Annot* pAnnot) {}
+
+ virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
+ virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
+ virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot,
+ CPDFSDK_Annot* pNewAnnot) {
+ return TRUE;
+ }
+
+ void SetFormFiller(CFFL_IFormFiller* pFiller) { m_pFormFiller = pFiller; }
+ CFFL_IFormFiller* GetFormFiller() { return m_pFormFiller; }
+
+ private:
+ CPDFDoc_Environment* m_pApp;
+ CFFL_IFormFiller* m_pFormFiller;
};
-class CPDFSDK_XFAAnnotHandler : public IPDFSDK_AnnotHandler
-{
-public:
- CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp);
- ~CPDFSDK_XFAAnnotHandler(){}
-
-public:
- virtual CFX_ByteString GetType() { return FSDK_XFAWIDGET_TYPENAME; }
-
- virtual CFX_ByteString GetName() { return "XFAWidgetHandler"; }
-
- virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot);
-
-
- virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) { return NULL; }
-
- virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* pAnnot, CPDFSDK_PageView* pPage);
-
- virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot);
-
- virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) {}
-
-
- virtual CPDF_Rect GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
-
- virtual FX_BOOL HitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, const CPDF_Point& point);
-
-
- virtual void OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- FX_DWORD dwFlags);
-
- virtual void OnDrawSleep(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- const CPDF_Rect& rcWindow, FX_DWORD dwFlags) {}
-
-
-
-
- virtual void OnCreate(CPDFSDK_Annot* pAnnot) {}
-
- virtual void OnLoad(CPDFSDK_Annot* pAnnot) {}
-
- virtual void OnDelete(CPDFSDK_Annot* pAnnot) {}
-
- virtual void OnRelease(CPDFSDK_Annot* pAnnot) {}
-
-
- virtual void OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
- virtual void OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
-
-
- virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
- virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
- virtual FX_BOOL OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) ;
- virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
- virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
- virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) ;
- //by wjm.
- virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX_DWORD nFlags);
- virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
- virtual FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
-
- virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) {}
- virtual void OnSelected(CPDFSDK_Annot* pAnnot) {}
-
- virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
- virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) ;
- virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, CPDFSDK_Annot* pNewAnnot);
-
-private:
- IXFA_WidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot);
- FX_DWORD GetFWLFlags(FX_DWORD dwFlag);
-
-private:
- CPDFDoc_Environment* m_pApp;
+class CPDFSDK_XFAAnnotHandler : public IPDFSDK_AnnotHandler {
+ public:
+ CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp);
+ ~CPDFSDK_XFAAnnotHandler() {}
+
+ public:
+ virtual CFX_ByteString GetType() { return FSDK_XFAWIDGET_TYPENAME; }
+
+ virtual CFX_ByteString GetName() { return "XFAWidgetHandler"; }
+
+ virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot);
+
+ virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) {
+ return NULL;
+ }
+
+ virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* pAnnot, CPDFSDK_PageView* pPage);
+
+ virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot);
+
+ virtual void DeleteAnnot(CPDFSDK_Annot* pAnnot) {}
+
+ virtual CPDF_Rect GetViewBBox(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot);
+
+ virtual FX_BOOL HitTest(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ const CPDF_Point& point);
+
+ virtual void OnDraw(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ FX_DWORD dwFlags);
+
+ virtual void OnDrawSleep(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ const CPDF_Rect& rcWindow,
+ FX_DWORD dwFlags) {}
+
+ virtual void OnCreate(CPDFSDK_Annot* pAnnot) {}
+
+ virtual void OnLoad(CPDFSDK_Annot* pAnnot) {}
+
+ virtual void OnDelete(CPDFSDK_Annot* pAnnot) {}
+
+ virtual void OnRelease(CPDFSDK_Annot* pAnnot) {}
+
+ virtual void OnMouseEnter(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlag);
+ virtual void OnMouseExit(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlag);
+
+ virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ short zDelta,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point);
+ // by wjm.
+ virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot,
+ FX_DWORD nChar,
+ FX_DWORD nFlags);
+ virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
+ virtual FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
+
+ virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) {}
+ virtual void OnSelected(CPDFSDK_Annot* pAnnot) {}
+
+ virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
+ virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
+ virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot,
+ CPDFSDK_Annot* pNewAnnot);
+
+ private:
+ IXFA_WidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot);
+ FX_DWORD GetFWLFlags(FX_DWORD dwFlag);
+
+ private:
+ CPDFDoc_Environment* m_pApp;
};
#define CBA_AnnotHandlerArray CFX_ArrayTemplate<IPDFSDK_AnnotHandler*>
-class CPDFSDK_AnnotHandlerMgr
-{
-public:
- // Destroy the handler
- CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp);
- virtual ~CPDFSDK_AnnotHandlerMgr() ;
-
-public:
- void RegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler);
- void UnRegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler);
-
- virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot * pAnnot, CPDFSDK_PageView *pPageView);
- virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* pAnnot, CPDFSDK_PageView* pPageView);
- virtual void ReleaseAnnot(CPDFSDK_Annot * pAnnot);
-
- virtual void Annot_OnCreate(CPDFSDK_Annot* pAnnot);
- virtual void Annot_OnLoad(CPDFSDK_Annot* pAnnot);
-public:
- IPDFSDK_AnnotHandler* GetAnnotHandler(CPDFSDK_Annot* pAnnot) const;
- virtual void Annot_OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot,
- CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,FX_DWORD dwFlags);
-
- virtual void Annot_OnMouseEnter(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags);
- virtual void Annot_OnMouseExit(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags);
-
- virtual FX_BOOL Annot_OnLButtonDown(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
- virtual FX_BOOL Annot_OnLButtonUp(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
- virtual FX_BOOL Annot_OnLButtonDblClk(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
-
- virtual FX_BOOL Annot_OnMouseMove(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
- virtual FX_BOOL Annot_OnMouseWheel(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point);
- virtual FX_BOOL Annot_OnRButtonDown(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
- virtual FX_BOOL Annot_OnRButtonUp(CPDFSDK_PageView * pPageView, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point);
-
-
- virtual FX_BOOL Annot_OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX_DWORD nFlags);
- virtual FX_BOOL Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
- virtual FX_BOOL Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
-
- virtual FX_BOOL Annot_OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
- virtual FX_BOOL Annot_OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
- virtual FX_BOOL Annot_OnChangeFocus(CPDFSDK_Annot* pSetAnnot,CPDFSDK_Annot* pKillAnnot);
-
- virtual CPDF_Rect Annot_OnGetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
- virtual FX_BOOL Annot_OnHitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, const CPDF_Point& point);
-
-private:
- IPDFSDK_AnnotHandler* GetAnnotHandler(const CFX_ByteString& sType) const;
- CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pSDKAnnot,FX_BOOL bNext);
-private:
- CBA_AnnotHandlerArray m_Handlers;
- CFX_MapByteStringToPtr m_mapType2Handler;
- CPDFDoc_Environment* m_pApp;
+class CPDFSDK_AnnotHandlerMgr {
+ public:
+ // Destroy the handler
+ CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp);
+ virtual ~CPDFSDK_AnnotHandlerMgr();
+
+ public:
+ void RegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler);
+ void UnRegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnnotHandler);
+
+ virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot,
+ CPDFSDK_PageView* pPageView);
+ virtual CPDFSDK_Annot* NewAnnot(IXFA_Widget* pAnnot,
+ CPDFSDK_PageView* pPageView);
+ virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot);
+
+ virtual void Annot_OnCreate(CPDFSDK_Annot* pAnnot);
+ virtual void Annot_OnLoad(CPDFSDK_Annot* pAnnot);
+
+ public:
+ IPDFSDK_AnnotHandler* GetAnnotHandler(CPDFSDK_Annot* pAnnot) const;
+ virtual void Annot_OnDraw(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ FX_DWORD dwFlags);
+
+ virtual void Annot_OnMouseEnter(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags);
+ virtual void Annot_OnMouseExit(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags);
+
+ virtual FX_BOOL Annot_OnLButtonDown(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL Annot_OnLButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL Annot_OnLButtonDblClk(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point);
+
+ virtual FX_BOOL Annot_OnMouseMove(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL Annot_OnMouseWheel(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ short zDelta,
+ const CPDF_Point& point);
+ virtual FX_BOOL Annot_OnRButtonDown(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point);
+ virtual FX_BOOL Annot_OnRButtonUp(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ FX_DWORD nFlags,
+ const CPDF_Point& point);
+
+ virtual FX_BOOL Annot_OnChar(CPDFSDK_Annot* pAnnot,
+ FX_DWORD nChar,
+ FX_DWORD nFlags);
+ virtual FX_BOOL Annot_OnKeyDown(CPDFSDK_Annot* pAnnot,
+ int nKeyCode,
+ int nFlag);
+ virtual FX_BOOL Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
+
+ virtual FX_BOOL Annot_OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
+ virtual FX_BOOL Annot_OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag);
+ virtual FX_BOOL Annot_OnChangeFocus(CPDFSDK_Annot* pSetAnnot,
+ CPDFSDK_Annot* pKillAnnot);
+
+ virtual CPDF_Rect Annot_OnGetViewBBox(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot);
+ virtual FX_BOOL Annot_OnHitTest(CPDFSDK_PageView* pPageView,
+ CPDFSDK_Annot* pAnnot,
+ const CPDF_Point& point);
+
+ private:
+ IPDFSDK_AnnotHandler* GetAnnotHandler(const CFX_ByteString& sType) const;
+ CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pSDKAnnot, FX_BOOL bNext);
+
+ private:
+ CBA_AnnotHandlerArray m_Handlers;
+ CFX_MapByteStringToPtr m_mapType2Handler;
+ CPDFDoc_Environment* m_pApp;
};
-typedef int (*AI_COMPARE) (CPDFSDK_Annot* p1, CPDFSDK_Annot* p2);
-
-class CPDFSDK_AnnotIterator
-{
-public:
- CPDFSDK_AnnotIterator(CPDFSDK_PageView * pPageView, FX_BOOL bReverse,
- FX_BOOL bIgnoreTopmost=FALSE,FX_BOOL bCircle=FALSE,CFX_PtrArray* pList=NULL);
- virtual ~CPDFSDK_AnnotIterator() { }
-
- virtual CPDFSDK_Annot* Next (const CPDFSDK_Annot* pCurrent) ;
- virtual CPDFSDK_Annot* Prev (const CPDFSDK_Annot* pCurrent) ;
- virtual CPDFSDK_Annot* Next(int& index ) ;
- virtual CPDFSDK_Annot* Prev(int& index ) ;
- virtual int Count(){return m_pIteratorAnnotList.GetSize();}
-
- virtual FX_BOOL InitIteratorAnnotList(CPDFSDK_PageView * pPageView,CFX_PtrArray* pList=NULL);
-
- void InsertSort(CFX_PtrArray &arrayList, AI_COMPARE pCompare);
-
-protected:
- CPDFSDK_Annot* NextAnnot (const CPDFSDK_Annot* pCurrent) ;
- CPDFSDK_Annot* PrevAnnot (const CPDFSDK_Annot* pCurrent) ;
- CPDFSDK_Annot* NextAnnot(int& index ) ;
- CPDFSDK_Annot* PrevAnnot(int& index ) ;
-
- CFX_PtrArray m_pIteratorAnnotList;
- FX_BOOL m_bReverse;
- FX_BOOL m_bIgnoreTopmost;
- FX_BOOL m_bCircle;
+typedef int (*AI_COMPARE)(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2);
+
+class CPDFSDK_AnnotIterator {
+ public:
+ CPDFSDK_AnnotIterator(CPDFSDK_PageView* pPageView,
+ FX_BOOL bReverse,
+ FX_BOOL bIgnoreTopmost = FALSE,
+ FX_BOOL bCircle = FALSE,
+ CFX_PtrArray* pList = NULL);
+ virtual ~CPDFSDK_AnnotIterator() {}
+
+ virtual CPDFSDK_Annot* Next(const CPDFSDK_Annot* pCurrent);
+ virtual CPDFSDK_Annot* Prev(const CPDFSDK_Annot* pCurrent);
+ virtual CPDFSDK_Annot* Next(int& index);
+ virtual CPDFSDK_Annot* Prev(int& index);
+ virtual int Count() { return m_pIteratorAnnotList.GetSize(); }
+
+ virtual FX_BOOL InitIteratorAnnotList(CPDFSDK_PageView* pPageView,
+ CFX_PtrArray* pList = NULL);
+
+ void InsertSort(CFX_PtrArray& arrayList, AI_COMPARE pCompare);
+
+ protected:
+ CPDFSDK_Annot* NextAnnot(const CPDFSDK_Annot* pCurrent);
+ CPDFSDK_Annot* PrevAnnot(const CPDFSDK_Annot* pCurrent);
+ CPDFSDK_Annot* NextAnnot(int& index);
+ CPDFSDK_Annot* PrevAnnot(int& index);
+
+ CFX_PtrArray m_pIteratorAnnotList;
+ FX_BOOL m_bReverse;
+ FX_BOOL m_bIgnoreTopmost;
+ FX_BOOL m_bCircle;
};
#endif // FPDFSDK_INCLUDE_FSDK_ANNOTHANDLER_H_
diff --git a/fpdfsdk/include/fsdk_baseannot.h b/fpdfsdk/include/fsdk_baseannot.h
index b71e128cfb..706e96435e 100644
--- a/fpdfsdk/include/fsdk_baseannot.h
+++ b/fpdfsdk/include/fsdk_baseannot.h
@@ -25,192 +25,198 @@ class CPDF_Matrix;
class CPDF_RenderOptions;
class CFX_RenderDevice;
-#define CFX_IntArray CFX_ArrayTemplate<int>
-
-class CPDFSDK_DateTime
-{
-public:
- CPDFSDK_DateTime();
- CPDFSDK_DateTime(const CFX_ByteString& dtStr);
- CPDFSDK_DateTime(const CPDFSDK_DateTime& datetime);
- CPDFSDK_DateTime(const FX_SYSTEMTIME& st);
-
-
- CPDFSDK_DateTime& operator = (const CPDFSDK_DateTime& datetime);
- CPDFSDK_DateTime& operator = (const FX_SYSTEMTIME& st);
- FX_BOOL operator == (CPDFSDK_DateTime& datetime);
- FX_BOOL operator != (CPDFSDK_DateTime& datetime);
- FX_BOOL operator > (CPDFSDK_DateTime& datetime);
- FX_BOOL operator >= (CPDFSDK_DateTime& datetime);
- FX_BOOL operator < (CPDFSDK_DateTime& datetime);
- FX_BOOL operator <= (CPDFSDK_DateTime& datetime);
- operator time_t();
-
- CPDFSDK_DateTime& FromPDFDateTimeString(const CFX_ByteString& dtStr);
- CFX_ByteString ToCommonDateTimeString();
- CFX_ByteString ToPDFDateTimeString();
- void ToSystemTime(FX_SYSTEMTIME& st);
- CPDFSDK_DateTime ToGMT();
- CPDFSDK_DateTime& AddDays(short days);
- CPDFSDK_DateTime& AddSeconds(int seconds);
-
- void ResetDateTime();
-
- struct FX_DATETIME
- {
- int16_t year;
- uint8_t month;
- uint8_t day;
- uint8_t hour;
- uint8_t minute;
- uint8_t second;
- int8_t tzHour;
- uint8_t tzMinute;
- }dt;
+#define CFX_IntArray CFX_ArrayTemplate<int>
+
+class CPDFSDK_DateTime {
+ public:
+ CPDFSDK_DateTime();
+ CPDFSDK_DateTime(const CFX_ByteString& dtStr);
+ CPDFSDK_DateTime(const CPDFSDK_DateTime& datetime);
+ CPDFSDK_DateTime(const FX_SYSTEMTIME& st);
+
+ CPDFSDK_DateTime& operator=(const CPDFSDK_DateTime& datetime);
+ CPDFSDK_DateTime& operator=(const FX_SYSTEMTIME& st);
+ FX_BOOL operator==(CPDFSDK_DateTime& datetime);
+ FX_BOOL operator!=(CPDFSDK_DateTime& datetime);
+ FX_BOOL operator>(CPDFSDK_DateTime& datetime);
+ FX_BOOL operator>=(CPDFSDK_DateTime& datetime);
+ FX_BOOL operator<(CPDFSDK_DateTime& datetime);
+ FX_BOOL operator<=(CPDFSDK_DateTime& datetime);
+ operator time_t();
+
+ CPDFSDK_DateTime& FromPDFDateTimeString(const CFX_ByteString& dtStr);
+ CFX_ByteString ToCommonDateTimeString();
+ CFX_ByteString ToPDFDateTimeString();
+ void ToSystemTime(FX_SYSTEMTIME& st);
+ CPDFSDK_DateTime ToGMT();
+ CPDFSDK_DateTime& AddDays(short days);
+ CPDFSDK_DateTime& AddSeconds(int seconds);
+
+ void ResetDateTime();
+
+ struct FX_DATETIME {
+ int16_t year;
+ uint8_t month;
+ uint8_t day;
+ uint8_t hour;
+ uint8_t minute;
+ uint8_t second;
+ int8_t tzHour;
+ uint8_t tzMinute;
+ } dt;
};
-class CPDFSDK_Annot
-{
-public:
- CPDFSDK_Annot(CPDFSDK_PageView* pPageView);
- virtual ~CPDFSDK_Annot() {};
-public:
- virtual FX_BOOL IsXFAField() { return FALSE; }
+class CPDFSDK_Annot {
+ public:
+ CPDFSDK_Annot(CPDFSDK_PageView* pPageView);
+ virtual ~CPDFSDK_Annot(){};
- virtual FX_FLOAT GetMinWidth() const;
- virtual FX_FLOAT GetMinHeight() const;
- //define layout order to 5.
- virtual int GetLayoutOrder() const { return 5; }
+ public:
+ virtual FX_BOOL IsXFAField() { return FALSE; }
- virtual CPDF_Annot* GetPDFAnnot() { return NULL; }
- virtual IXFA_Widget* GetXFAWidget() { return NULL; }
+ virtual FX_FLOAT GetMinWidth() const;
+ virtual FX_FLOAT GetMinHeight() const;
+ // define layout order to 5.
+ virtual int GetLayoutOrder() const { return 5; }
- virtual CFX_ByteString GetType() const { return ""; }
- virtual CFX_ByteString GetSubType() const { return ""; }
+ virtual CPDF_Annot* GetPDFAnnot() { return NULL; }
+ virtual IXFA_Widget* GetXFAWidget() { return NULL; }
- virtual void SetRect(const CPDF_Rect& rect) {}
- virtual CPDF_Rect GetRect() const { return CPDF_Rect(); }
+ virtual CFX_ByteString GetType() const { return ""; }
+ virtual CFX_ByteString GetSubType() const { return ""; }
- virtual void Annot_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,CPDF_RenderOptions* pOptions) {}
+ virtual void SetRect(const CPDF_Rect& rect) {}
+ virtual CPDF_Rect GetRect() const { return CPDF_Rect(); }
-public:
- CPDF_Page* GetPDFPage();
- CPDFXFA_Page* GetPDFXFAPage();
+ virtual void Annot_OnDraw(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ CPDF_RenderOptions* pOptions) {}
- void SetPage(CPDFSDK_PageView* pPageView) { m_pPageView = pPageView; }
- CPDFSDK_PageView* GetPageView() { return m_pPageView; }
+ public:
+ CPDF_Page* GetPDFPage();
+ CPDFXFA_Page* GetPDFXFAPage();
- // Tab Order
- int GetTabOrder();
- void SetTabOrder(int iTabOrder);
+ void SetPage(CPDFSDK_PageView* pPageView) { m_pPageView = pPageView; }
+ CPDFSDK_PageView* GetPageView() { return m_pPageView; }
- // Selection
- FX_BOOL IsSelected();
- void SetSelected(FX_BOOL bSelected);
+ // Tab Order
+ int GetTabOrder();
+ void SetTabOrder(int iTabOrder);
-protected:
- CPDF_Annot* m_pAnnot;
- CPDFSDK_PageView* m_pPageView;
- FX_BOOL m_bSelected;
- int m_nTabOrder;
+ // Selection
+ FX_BOOL IsSelected();
+ void SetSelected(FX_BOOL bSelected);
+ protected:
+ CPDF_Annot* m_pAnnot;
+ CPDFSDK_PageView* m_pPageView;
+ FX_BOOL m_bSelected;
+ int m_nTabOrder;
};
-class CPDFSDK_BAAnnot : public CPDFSDK_Annot
-{
-public:
- CPDFSDK_BAAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView);
- virtual ~CPDFSDK_BAAnnot();
+class CPDFSDK_BAAnnot : public CPDFSDK_Annot {
+ public:
+ CPDFSDK_BAAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView);
+ virtual ~CPDFSDK_BAAnnot();
-public:
- virtual FX_BOOL IsXFAField();
+ public:
+ virtual FX_BOOL IsXFAField();
- virtual CFX_ByteString GetType() const;
- virtual CFX_ByteString GetSubType() const;
+ virtual CFX_ByteString GetType() const;
+ virtual CFX_ByteString GetSubType() const;
- virtual void SetRect(const CPDF_Rect& rect);
- virtual CPDF_Rect GetRect() const;
+ virtual void SetRect(const CPDF_Rect& rect);
+ virtual CPDF_Rect GetRect() const;
- virtual CPDF_Annot* GetPDFAnnot();
+ virtual CPDF_Annot* GetPDFAnnot();
- virtual void Annot_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,CPDF_RenderOptions* pOptions);
-public:
- CPDF_Dictionary* GetAnnotDict() const;
+ virtual void Annot_OnDraw(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ CPDF_RenderOptions* pOptions);
- void SetContents(const CFX_WideString& sContents);
- CFX_WideString GetContents() const;
+ public:
+ CPDF_Dictionary* GetAnnotDict() const;
- void SetAnnotName(const CFX_WideString& sName);
- CFX_WideString GetAnnotName() const;
+ void SetContents(const CFX_WideString& sContents);
+ CFX_WideString GetContents() const;
- void SetModifiedDate(const FX_SYSTEMTIME& st);
- FX_SYSTEMTIME GetModifiedDate() const;
+ void SetAnnotName(const CFX_WideString& sName);
+ CFX_WideString GetAnnotName() const;
- void SetFlags(int nFlags);
- int GetFlags() const;
+ void SetModifiedDate(const FX_SYSTEMTIME& st);
+ FX_SYSTEMTIME GetModifiedDate() const;
- void SetAppState(const CFX_ByteString& str);
- CFX_ByteString GetAppState() const;
+ void SetFlags(int nFlags);
+ int GetFlags() const;
- void SetStructParent(int key);
- int GetStructParent() const;
+ void SetAppState(const CFX_ByteString& str);
+ CFX_ByteString GetAppState() const;
- //border
- void SetBorderWidth(int nWidth);
- int GetBorderWidth() const;
+ void SetStructParent(int key);
+ int GetStructParent() const;
- //BBS_SOLID
- //BBS_DASH
- //BBS_BEVELED
- //BBS_INSET
- //BBS_UNDERLINE
+ // border
+ void SetBorderWidth(int nWidth);
+ int GetBorderWidth() const;
- void SetBorderStyle(int nStyle);
- int GetBorderStyle() const;
+ // BBS_SOLID
+ // BBS_DASH
+ // BBS_BEVELED
+ // BBS_INSET
+ // BBS_UNDERLINE
- void SetBorderDash(const CFX_IntArray& array);
- void GetBorderDash(CFX_IntArray& array) const;
+ void SetBorderStyle(int nStyle);
+ int GetBorderStyle() const;
- //The background of the annotation's icon when closed
- //The title bar of the annotation's pop-up window
- //The border of a link annotation
+ void SetBorderDash(const CFX_IntArray& array);
+ void GetBorderDash(CFX_IntArray& array) const;
- void SetColor(FX_COLORREF color);
- void RemoveColor();
- FX_BOOL GetColor(FX_COLORREF& color) const;
+ // The background of the annotation's icon when closed
+ // The title bar of the annotation's pop-up window
+ // The border of a link annotation
- FX_BOOL IsVisible() const;
- //action
+ void SetColor(FX_COLORREF color);
+ void RemoveColor();
+ FX_BOOL GetColor(FX_COLORREF& color) const;
- CPDF_Action GetAction() const;
- void SetAction(const CPDF_Action& a);
- void RemoveAction();
+ FX_BOOL IsVisible() const;
+ // action
- CPDF_AAction GetAAction() const;
- void SetAAction(const CPDF_AAction& aa);
- void RemoveAAction();
+ CPDF_Action GetAction() const;
+ void SetAction(const CPDF_Action& a);
+ void RemoveAction();
- virtual CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT);
+ CPDF_AAction GetAAction() const;
+ void SetAAction(const CPDF_AAction& aa);
+ void RemoveAAction();
-public:
- virtual FX_BOOL IsAppearanceValid();
- virtual FX_BOOL IsAppearanceValid(CPDF_Annot::AppearanceMode mode);
- virtual void DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device,
- CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions);
- void DrawBorder(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device,
- const CPDF_RenderOptions* pOptions);
+ virtual CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT);
- void ClearCachedAP();
+ public:
+ virtual FX_BOOL IsAppearanceValid();
+ virtual FX_BOOL IsAppearanceValid(CPDF_Annot::AppearanceMode mode);
+ virtual void DrawAppearance(CFX_RenderDevice* pDevice,
+ const CPDF_Matrix* pUser2Device,
+ CPDF_Annot::AppearanceMode mode,
+ const CPDF_RenderOptions* pOptions);
+ void DrawBorder(CFX_RenderDevice* pDevice,
+ const CPDF_Matrix* pUser2Device,
+ const CPDF_RenderOptions* pOptions);
- virtual void ResetAppearance();
- void WriteAppearance(const CFX_ByteString& sAPType, const CPDF_Rect& rcBBox,
- const CPDF_Matrix& matrix, const CFX_ByteString& sContents,
- const CFX_ByteString& sAPState = "");
+ void ClearCachedAP();
-private:
- FX_BOOL CreateFormFiller();
-protected:
- CPDF_Annot* m_pAnnot;
+ virtual void ResetAppearance();
+ void WriteAppearance(const CFX_ByteString& sAPType,
+ const CPDF_Rect& rcBBox,
+ const CPDF_Matrix& matrix,
+ const CFX_ByteString& sContents,
+ const CFX_ByteString& sAPState = "");
+
+ private:
+ FX_BOOL CreateFormFiller();
+
+ protected:
+ CPDF_Annot* m_pAnnot;
};
#endif // FPDFSDK_INCLUDE_FSDK_BASEANNOT_H_
diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h
index 8d741380e5..089a34c649 100644
--- a/fpdfsdk/include/fsdk_baseform.h
+++ b/fpdfsdk/include/fsdk_baseform.h
@@ -31,328 +31,357 @@ class CPDF_Action;
class CPDF_FormField;
struct CPWL_Color;
-typedef enum _PDFSDK_XFAAActionType
-{
- PDFSDK_XFA_Click = 0,
- PDFSDK_XFA_Full,
- PDFSDK_XFA_PreOpen,
- PDFSDK_XFA_PostOpen
-}PDFSDK_XFAAActionType;
-
-typedef struct _PDFSDK_FieldAction
-{
- _PDFSDK_FieldAction()
- {
- bModifier = FALSE;
- bShift = FALSE;
- nCommitKey = 0;
- bKeyDown = FALSE;
- nSelEnd = nSelStart = 0;
- bWillCommit = FALSE;
- bFieldFull = FALSE;
- bRC = TRUE;
- }
-
- FX_BOOL bModifier; //in
- FX_BOOL bShift; //in
- int nCommitKey; //in
- CFX_WideString sChange; //in[out]
- CFX_WideString sChangeEx; //in
- FX_BOOL bKeyDown; //in
- int nSelEnd; //in[out]
- int nSelStart; //in[out]
- CFX_WideString sValue; //in[out]
- FX_BOOL bWillCommit; //in
- FX_BOOL bFieldFull; //in
- FX_BOOL bRC; //in[out]
-}PDFSDK_FieldAction;
-class CPDFSDK_Widget : public CPDFSDK_BAAnnot
-{
-public:
- IXFA_Widget* GetMixXFAWidget();
- IXFA_Widget* GetGroupMixXFAWidget();
- IXFA_WidgetHandler* GetXFAWidgetHandler();
-
- FX_BOOL HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT);
- FX_BOOL OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, PDFSDK_FieldAction& data, CPDFSDK_PageView* pPageView);
-
- void Synchronize(FX_BOOL bSynchronizeElse);
- void SynchronizeXFAValue();
- void SynchronizeXFAItems();
-
- static void SynchronizeXFAValue(IXFA_DocView* pXFADocView, IXFA_Widget* hWidget,
- CPDF_FormField* pFormField, CPDF_FormControl* pFormControl);
- static void SynchronizeXFAItems(IXFA_DocView* pXFADocView, IXFA_Widget* hWidget,
- CPDF_FormField* pFormField, CPDF_FormControl* pFormControl);
-
-public:
- CPDFSDK_Widget(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView, CPDFSDK_InterForm* pInterForm);
- virtual ~CPDFSDK_Widget();
-
- virtual CFX_ByteString GetSubType() const;
-
- virtual CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT);
-
- int GetFieldType() const;
- //define layout order to 2.
- virtual int GetLayoutOrder() const {return 2;}
- virtual FX_BOOL IsAppearanceValid();
- /*
- FIELDFLAG_READONLY
- FIELDFLAG_REQUIRED
- FIELDFLAG_NOEXPORT
- */
-
- int GetFieldFlags() const;
- int GetRotate() const;
-
- FX_BOOL GetFillColor(FX_COLORREF& color) const;
- FX_BOOL GetBorderColor(FX_COLORREF& color) const;
- FX_BOOL GetTextColor(FX_COLORREF& color) const;
- FX_FLOAT GetFontSize() const;
-
- int GetSelectedIndex(int nIndex);
- CFX_WideString GetValue(FX_BOOL bDisplay = TRUE);
- CFX_WideString GetDefaultValue() const;
- CFX_WideString GetOptionLabel(int nIndex) const;
- int CountOptions() const;
- FX_BOOL IsOptionSelected(int nIndex);
- int GetTopVisibleIndex() const;
- FX_BOOL IsChecked();
- /*
- BF_ALIGN_LEFT
- BF_ALIGN_MIDDL
- BF_ALIGN_RIGHT
- */
- int GetAlignment() const;
- int GetMaxLen() const;
- CFX_WideString GetName();
- CFX_WideString GetAlternateName() const;
-
-//Set Properties.
- void SetCheck(FX_BOOL bChecked, FX_BOOL bNotify);
- void SetValue(const CFX_WideString& sValue, FX_BOOL bNotify);
- void SetDefaultValue(const CFX_WideString& sValue);
- void SetOptionSelection(int index, FX_BOOL bSelected, FX_BOOL bNotify);
- void ClearSelection(FX_BOOL bNotify);
- void SetTopVisibleIndex(int index);
-
- void ResetAppearance(FX_BOOL bValueChanged);
- void ResetAppearance(const FX_WCHAR* sValue, FX_BOOL bValueChanged);
- void ResetFieldAppearance(FX_BOOL bValueChanged);
- void UpdateField();
- CFX_WideString OnFormat(FX_BOOL& bFormated);
-
-//Message.
- FX_BOOL OnAAction(CPDF_AAction::AActionType type, PDFSDK_FieldAction& data,
- CPDFSDK_PageView* pPageView);
-
- CPDFSDK_InterForm* GetInterForm() const {return m_pInterForm;}
- CPDF_FormField* GetFormField() const;
- CPDF_FormControl* GetFormControl() const;
- static CPDF_FormControl* GetFormControl(CPDF_InterForm* pInterForm, CPDF_Dictionary* pAnnotDict);
-
- void DrawShadow(CFX_RenderDevice* pDevice, CPDFSDK_PageView* pPageView);
-
- void SetAppModified();
- void ClearAppModified();
- FX_BOOL IsAppModified() const;
-
- int32_t GetAppearanceAge() const;
- int32_t GetValueAge() const;
-
-private:
- void ResetAppearance_PushButton();
- void ResetAppearance_CheckBox();
- void ResetAppearance_RadioButton();
- void ResetAppearance_ComboBox(const FX_WCHAR* sValue);
- void ResetAppearance_ListBox();
- void ResetAppearance_TextField(const FX_WCHAR* sValue);
-
- CPDF_Rect GetClientRect() const;
- CPDF_Rect GetRotatedRect() const;
-
- CFX_ByteString GetBackgroundAppStream() const;
- CFX_ByteString GetBorderAppStream() const;
- CPDF_Matrix GetMatrix() const;
-
- CPWL_Color GetTextPWLColor() const;
- CPWL_Color GetBorderPWLColor() const;
- CPWL_Color GetFillPWLColor() const;
-
- void AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_Stream* pImage);
- void RemoveAppearance(const CFX_ByteString& sAPType);
-public:
- FX_BOOL IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode);
- void DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device,
- CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions);
-public:
- FX_BOOL HitTest(FX_FLOAT pageX, FX_FLOAT pageY);
-private:
- CPDFSDK_InterForm* m_pInterForm;
- FX_BOOL m_bAppModified;
- int32_t m_nAppAge;
- int32_t m_nValueAge;
-
- IXFA_Widget* m_hMixXFAWidget;
- IXFA_WidgetHandler* m_pWidgetHandler;
+typedef enum _PDFSDK_XFAAActionType {
+ PDFSDK_XFA_Click = 0,
+ PDFSDK_XFA_Full,
+ PDFSDK_XFA_PreOpen,
+ PDFSDK_XFA_PostOpen
+} PDFSDK_XFAAActionType;
+
+typedef struct _PDFSDK_FieldAction {
+ _PDFSDK_FieldAction() {
+ bModifier = FALSE;
+ bShift = FALSE;
+ nCommitKey = 0;
+ bKeyDown = FALSE;
+ nSelEnd = nSelStart = 0;
+ bWillCommit = FALSE;
+ bFieldFull = FALSE;
+ bRC = TRUE;
+ }
+
+ FX_BOOL bModifier; // in
+ FX_BOOL bShift; // in
+ int nCommitKey; // in
+ CFX_WideString sChange; // in[out]
+ CFX_WideString sChangeEx; // in
+ FX_BOOL bKeyDown; // in
+ int nSelEnd; // in[out]
+ int nSelStart; // in[out]
+ CFX_WideString sValue; // in[out]
+ FX_BOOL bWillCommit; // in
+ FX_BOOL bFieldFull; // in
+ FX_BOOL bRC; // in[out]
+} PDFSDK_FieldAction;
+class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
+ public:
+ IXFA_Widget* GetMixXFAWidget();
+ IXFA_Widget* GetGroupMixXFAWidget();
+ IXFA_WidgetHandler* GetXFAWidgetHandler();
+
+ FX_BOOL HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT);
+ FX_BOOL OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT,
+ PDFSDK_FieldAction& data,
+ CPDFSDK_PageView* pPageView);
+
+ void Synchronize(FX_BOOL bSynchronizeElse);
+ void SynchronizeXFAValue();
+ void SynchronizeXFAItems();
+
+ static void SynchronizeXFAValue(IXFA_DocView* pXFADocView,
+ IXFA_Widget* hWidget,
+ CPDF_FormField* pFormField,
+ CPDF_FormControl* pFormControl);
+ static void SynchronizeXFAItems(IXFA_DocView* pXFADocView,
+ IXFA_Widget* hWidget,
+ CPDF_FormField* pFormField,
+ CPDF_FormControl* pFormControl);
+
+ public:
+ CPDFSDK_Widget(CPDF_Annot* pAnnot,
+ CPDFSDK_PageView* pPageView,
+ CPDFSDK_InterForm* pInterForm);
+ virtual ~CPDFSDK_Widget();
+
+ virtual CFX_ByteString GetSubType() const;
+
+ virtual CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT);
+
+ int GetFieldType() const;
+ // define layout order to 2.
+ virtual int GetLayoutOrder() const { return 2; }
+ virtual FX_BOOL IsAppearanceValid();
+ /*
+ FIELDFLAG_READONLY
+ FIELDFLAG_REQUIRED
+ FIELDFLAG_NOEXPORT
+ */
+
+ int GetFieldFlags() const;
+ int GetRotate() const;
+
+ FX_BOOL GetFillColor(FX_COLORREF& color) const;
+ FX_BOOL GetBorderColor(FX_COLORREF& color) const;
+ FX_BOOL GetTextColor(FX_COLORREF& color) const;
+ FX_FLOAT GetFontSize() const;
+
+ int GetSelectedIndex(int nIndex);
+ CFX_WideString GetValue(FX_BOOL bDisplay = TRUE);
+ CFX_WideString GetDefaultValue() const;
+ CFX_WideString GetOptionLabel(int nIndex) const;
+ int CountOptions() const;
+ FX_BOOL IsOptionSelected(int nIndex);
+ int GetTopVisibleIndex() const;
+ FX_BOOL IsChecked();
+ /*
+ BF_ALIGN_LEFT
+ BF_ALIGN_MIDDL
+ BF_ALIGN_RIGHT
+ */
+ int GetAlignment() const;
+ int GetMaxLen() const;
+ CFX_WideString GetName();
+ CFX_WideString GetAlternateName() const;
+
+ // Set Properties.
+ void SetCheck(FX_BOOL bChecked, FX_BOOL bNotify);
+ void SetValue(const CFX_WideString& sValue, FX_BOOL bNotify);
+ void SetDefaultValue(const CFX_WideString& sValue);
+ void SetOptionSelection(int index, FX_BOOL bSelected, FX_BOOL bNotify);
+ void ClearSelection(FX_BOOL bNotify);
+ void SetTopVisibleIndex(int index);
+
+ void ResetAppearance(FX_BOOL bValueChanged);
+ void ResetAppearance(const FX_WCHAR* sValue, FX_BOOL bValueChanged);
+ void ResetFieldAppearance(FX_BOOL bValueChanged);
+ void UpdateField();
+ CFX_WideString OnFormat(FX_BOOL& bFormated);
+
+ // Message.
+ FX_BOOL OnAAction(CPDF_AAction::AActionType type,
+ PDFSDK_FieldAction& data,
+ CPDFSDK_PageView* pPageView);
+
+ CPDFSDK_InterForm* GetInterForm() const { return m_pInterForm; }
+ CPDF_FormField* GetFormField() const;
+ CPDF_FormControl* GetFormControl() const;
+ static CPDF_FormControl* GetFormControl(CPDF_InterForm* pInterForm,
+ CPDF_Dictionary* pAnnotDict);
+
+ void DrawShadow(CFX_RenderDevice* pDevice, CPDFSDK_PageView* pPageView);
+
+ void SetAppModified();
+ void ClearAppModified();
+ FX_BOOL IsAppModified() const;
+
+ int32_t GetAppearanceAge() const;
+ int32_t GetValueAge() const;
+
+ private:
+ void ResetAppearance_PushButton();
+ void ResetAppearance_CheckBox();
+ void ResetAppearance_RadioButton();
+ void ResetAppearance_ComboBox(const FX_WCHAR* sValue);
+ void ResetAppearance_ListBox();
+ void ResetAppearance_TextField(const FX_WCHAR* sValue);
+
+ CPDF_Rect GetClientRect() const;
+ CPDF_Rect GetRotatedRect() const;
+
+ CFX_ByteString GetBackgroundAppStream() const;
+ CFX_ByteString GetBorderAppStream() const;
+ CPDF_Matrix GetMatrix() const;
+
+ CPWL_Color GetTextPWLColor() const;
+ CPWL_Color GetBorderPWLColor() const;
+ CPWL_Color GetFillPWLColor() const;
+
+ void AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_Stream* pImage);
+ void RemoveAppearance(const CFX_ByteString& sAPType);
+
+ public:
+ FX_BOOL IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode);
+ void DrawAppearance(CFX_RenderDevice* pDevice,
+ const CPDF_Matrix* pUser2Device,
+ CPDF_Annot::AppearanceMode mode,
+ const CPDF_RenderOptions* pOptions);
+
+ public:
+ FX_BOOL HitTest(FX_FLOAT pageX, FX_FLOAT pageY);
+
+ private:
+ CPDFSDK_InterForm* m_pInterForm;
+ FX_BOOL m_bAppModified;
+ int32_t m_nAppAge;
+ int32_t m_nValueAge;
+
+ IXFA_Widget* m_hMixXFAWidget;
+ IXFA_WidgetHandler* m_pWidgetHandler;
};
-class CPDFSDK_XFAWidget : public CPDFSDK_Annot
-{
-public:
- CPDFSDK_XFAWidget(IXFA_Widget* pAnnot, CPDFSDK_PageView* pPageView, CPDFSDK_InterForm* pInterForm);
- virtual ~CPDFSDK_XFAWidget(){}
+class CPDFSDK_XFAWidget : public CPDFSDK_Annot {
+ public:
+ CPDFSDK_XFAWidget(IXFA_Widget* pAnnot,
+ CPDFSDK_PageView* pPageView,
+ CPDFSDK_InterForm* pInterForm);
+ virtual ~CPDFSDK_XFAWidget() {}
-public:
- virtual FX_BOOL IsXFAField();
- virtual IXFA_Widget* GetXFAWidget() { return m_hXFAWidget; }
+ public:
+ virtual FX_BOOL IsXFAField();
+ virtual IXFA_Widget* GetXFAWidget() { return m_hXFAWidget; }
- virtual CFX_ByteString GetType() const ;
- virtual CFX_ByteString GetSubType() const { return ""; }
+ virtual CFX_ByteString GetType() const;
+ virtual CFX_ByteString GetSubType() const { return ""; }
- virtual CFX_FloatRect GetRect();
+ virtual CFX_FloatRect GetRect();
-public:
- CPDFSDK_InterForm* GetInterForm() { return m_pInterForm; }
+ public:
+ CPDFSDK_InterForm* GetInterForm() { return m_pInterForm; }
-private:
- CPDFSDK_InterForm* m_pInterForm;
- IXFA_Widget* m_hXFAWidget;
+ private:
+ CPDFSDK_InterForm* m_pInterForm;
+ IXFA_Widget* m_hXFAWidget;
};
-#define CPDFSDK_XFAWidgetMap CFX_MapPtrTemplate<IXFA_Widget*, CPDFSDK_XFAWidget*>
+#define CPDFSDK_XFAWidgetMap \
+ CFX_MapPtrTemplate<IXFA_Widget*, CPDFSDK_XFAWidget*>
#define CPDFSDK_FieldSynchronizeMap CFX_MapPtrTemplate<CPDF_FormField*, int>
-class CPDFSDK_InterForm : public CPDF_FormNotify
-{
-public:
- explicit CPDFSDK_InterForm(CPDFSDK_Document* pDocument);
- ~CPDFSDK_InterForm() override;
+class CPDFSDK_InterForm : public CPDF_FormNotify {
+ public:
+ explicit CPDFSDK_InterForm(CPDFSDK_Document* pDocument);
+ ~CPDFSDK_InterForm() override;
- CPDF_InterForm* GetInterForm() const { return m_pInterForm; }
- CPDFSDK_Document* GetDocument() const { return m_pDocument; }
+ CPDF_InterForm* GetInterForm() const { return m_pInterForm; }
+ CPDFSDK_Document* GetDocument() const { return m_pDocument; }
- FX_BOOL HighlightWidgets();
+ FX_BOOL HighlightWidgets();
- CPDFSDK_Widget* GetSibling(CPDFSDK_Widget* pWidget, FX_BOOL bNext) const;
- CPDFSDK_Widget* GetWidget(CPDF_FormControl* pControl) const;
- void GetWidgets(const CFX_WideString& sFieldName, CFX_PtrArray& widgets);
- void GetWidgets(CPDF_FormField* pField, CFX_PtrArray& widgets);
+ CPDFSDK_Widget* GetSibling(CPDFSDK_Widget* pWidget, FX_BOOL bNext) const;
+ CPDFSDK_Widget* GetWidget(CPDF_FormControl* pControl) const;
+ void GetWidgets(const CFX_WideString& sFieldName, CFX_PtrArray& widgets);
+ void GetWidgets(CPDF_FormField* pField, CFX_PtrArray& widgets);
- void AddMap(CPDF_FormControl* pControl, CPDFSDK_Widget* pWidget);
- void RemoveMap(CPDF_FormControl* pControl);
+ void AddMap(CPDF_FormControl* pControl, CPDFSDK_Widget* pWidget);
+ void RemoveMap(CPDF_FormControl* pControl);
- void AddXFAMap(IXFA_Widget* hWidget, CPDFSDK_XFAWidget* pWidget);
- void RemoveXFAMap(IXFA_Widget* hWidget);
- CPDFSDK_XFAWidget* GetXFAWidget(IXFA_Widget* hWidget);
+ void AddXFAMap(IXFA_Widget* hWidget, CPDFSDK_XFAWidget* pWidget);
+ void RemoveXFAMap(IXFA_Widget* hWidget);
+ CPDFSDK_XFAWidget* GetXFAWidget(IXFA_Widget* hWidget);
- void EnableCalculate(FX_BOOL bEnabled);
- FX_BOOL IsCalculateEnabled() const;
+ void EnableCalculate(FX_BOOL bEnabled);
+ FX_BOOL IsCalculateEnabled() const;
- void XfaEnableCalculate(FX_BOOL bEnabled);
- FX_BOOL IsXfaCalculateEnabled() const;
+ void XfaEnableCalculate(FX_BOOL bEnabled);
+ FX_BOOL IsXfaCalculateEnabled() const;
- FX_BOOL IsXfaValidationsEnabled();
- void XfaSetValidationsEnabled(FX_BOOL bEnabled);
+ FX_BOOL IsXfaValidationsEnabled();
+ void XfaSetValidationsEnabled(FX_BOOL bEnabled);
#ifdef _WIN32
- CPDF_Stream* LoadImageFromFile(const CFX_WideString& sFile);
+ CPDF_Stream* LoadImageFromFile(const CFX_WideString& sFile);
#endif
- void OnKeyStrokeCommit(CPDF_FormField* pFormField, CFX_WideString& csValue, FX_BOOL& bRC);
- void OnValidate(CPDF_FormField* pFormField, CFX_WideString& csValue, FX_BOOL& bRC);
- void OnCalculate(CPDF_FormField* pFormField = NULL);
- CFX_WideString OnFormat(CPDF_FormField* pFormField, FX_BOOL& bFormated);
-
- void ResetFieldAppearance(CPDF_FormField* pFormField, const FX_WCHAR* sValue, FX_BOOL bValueChanged);
- void UpdateField(CPDF_FormField* pFormField);
-
- FX_BOOL DoAction_Hide(const CPDF_Action& action);
- FX_BOOL DoAction_SubmitForm(const CPDF_Action& action);
- FX_BOOL DoAction_ResetForm(const CPDF_Action& action);
- FX_BOOL DoAction_ImportData(const CPDF_Action& action);
-
- void GetFieldFromObjects(const CFX_PtrArray& objects, CFX_PtrArray& fields);
- FX_BOOL IsValidField(CPDF_Dictionary* pFieldDict);
- FX_BOOL SubmitFields(const CFX_WideString& csDestination, const CFX_PtrArray& fields,
- FX_BOOL bIncludeOrExclude, FX_BOOL bUrlEncoded);
- FX_BOOL SubmitForm(const CFX_WideString& sDestination, FX_BOOL bUrlEncoded);
- FX_BOOL ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf);
- FX_BOOL ExportFieldsToFDFTextBuf(const CFX_PtrArray& fields,FX_BOOL bIncludeOrExclude, CFX_ByteTextBuf& textBuf);
- CFX_WideString GetTemporaryFileName(const CFX_WideString& sFileExt);
-
- void SynchronizeField(CPDF_FormField* pFormField, FX_BOOL bSynchronizeElse);
-
-private:
- virtual int BeforeValueChange(const CPDF_FormField* pField, CFX_WideString& csValue);
- virtual int AfterValueChange(const CPDF_FormField* pField);
- virtual int BeforeSelectionChange(const CPDF_FormField* pField, CFX_WideString& csValue);
- virtual int AfterSelectionChange(const CPDF_FormField* pField);
- virtual int AfterCheckedStatusChange(const CPDF_FormField* pField, const CFX_ByteArray& statusArray);
- virtual int BeforeFormReset(const CPDF_InterForm* pForm);
- virtual int AfterFormReset(const CPDF_InterForm* pForm);
- virtual int BeforeFormImportData(const CPDF_InterForm* pForm);
- virtual int AfterFormImportData(const CPDF_InterForm* pForm);
-
- FX_BOOL FDFToURLEncodedData(CFX_WideString csFDFFile, CFX_WideString csTxtFile);
- FX_BOOL FDFToURLEncodedData(uint8_t*& pBuf, FX_STRSIZE& nBufSize);
- int GetPageIndexByAnnotDict(CPDF_Document* pDocument, CPDF_Dictionary* pAnnotDict) const;
- void DoFDFBuffer(CFX_ByteString sBuffer);
-
- using CPDFSDK_WidgetMap = std::map<CPDF_FormControl*, CPDFSDK_Widget*>;
-
- CPDFSDK_Document* m_pDocument;
- CPDF_InterForm* m_pInterForm;
- CPDFSDK_WidgetMap m_Map;
- CPDFSDK_XFAWidgetMap m_XFAMap;
- CPDFSDK_FieldSynchronizeMap m_FieldSynchronizeMap;
- FX_BOOL m_bCalculate;
- FX_BOOL m_bXfaCalculate;
- FX_BOOL m_bXfaValidationsEnabled;
- FX_BOOL m_bBusy;
-
-public:
- FX_BOOL IsNeedHighLight(int nFieldType);
- void RemoveAllHighLight();
- void SetHighlightAlpha(uint8_t alpha) {m_iHighlightAlpha = alpha;}
- uint8_t GetHighlightAlpha() {return m_iHighlightAlpha;}
- void SetHighlightColor(FX_COLORREF clr, int nFieldType);
- FX_COLORREF GetHighlightColor(int nFieldType);
-private:
- FX_COLORREF m_aHighlightColor[7];
- uint8_t m_iHighlightAlpha;
- FX_BOOL m_bNeedHightlight[7];
+ void OnKeyStrokeCommit(CPDF_FormField* pFormField,
+ CFX_WideString& csValue,
+ FX_BOOL& bRC);
+ void OnValidate(CPDF_FormField* pFormField,
+ CFX_WideString& csValue,
+ FX_BOOL& bRC);
+ void OnCalculate(CPDF_FormField* pFormField = NULL);
+ CFX_WideString OnFormat(CPDF_FormField* pFormField, FX_BOOL& bFormated);
+
+ void ResetFieldAppearance(CPDF_FormField* pFormField,
+ const FX_WCHAR* sValue,
+ FX_BOOL bValueChanged);
+ void UpdateField(CPDF_FormField* pFormField);
+
+ FX_BOOL DoAction_Hide(const CPDF_Action& action);
+ FX_BOOL DoAction_SubmitForm(const CPDF_Action& action);
+ FX_BOOL DoAction_ResetForm(const CPDF_Action& action);
+ FX_BOOL DoAction_ImportData(const CPDF_Action& action);
+
+ void GetFieldFromObjects(const CFX_PtrArray& objects, CFX_PtrArray& fields);
+ FX_BOOL IsValidField(CPDF_Dictionary* pFieldDict);
+ FX_BOOL SubmitFields(const CFX_WideString& csDestination,
+ const CFX_PtrArray& fields,
+ FX_BOOL bIncludeOrExclude,
+ FX_BOOL bUrlEncoded);
+ FX_BOOL SubmitForm(const CFX_WideString& sDestination, FX_BOOL bUrlEncoded);
+ FX_BOOL ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf);
+ FX_BOOL ExportFieldsToFDFTextBuf(const CFX_PtrArray& fields,
+ FX_BOOL bIncludeOrExclude,
+ CFX_ByteTextBuf& textBuf);
+ CFX_WideString GetTemporaryFileName(const CFX_WideString& sFileExt);
+
+ void SynchronizeField(CPDF_FormField* pFormField, FX_BOOL bSynchronizeElse);
+
+ private:
+ virtual int BeforeValueChange(const CPDF_FormField* pField,
+ CFX_WideString& csValue);
+ virtual int AfterValueChange(const CPDF_FormField* pField);
+ virtual int BeforeSelectionChange(const CPDF_FormField* pField,
+ CFX_WideString& csValue);
+ virtual int AfterSelectionChange(const CPDF_FormField* pField);
+ virtual int AfterCheckedStatusChange(const CPDF_FormField* pField,
+ const CFX_ByteArray& statusArray);
+ virtual int BeforeFormReset(const CPDF_InterForm* pForm);
+ virtual int AfterFormReset(const CPDF_InterForm* pForm);
+ virtual int BeforeFormImportData(const CPDF_InterForm* pForm);
+ virtual int AfterFormImportData(const CPDF_InterForm* pForm);
+
+ FX_BOOL FDFToURLEncodedData(CFX_WideString csFDFFile,
+ CFX_WideString csTxtFile);
+ FX_BOOL FDFToURLEncodedData(uint8_t*& pBuf, FX_STRSIZE& nBufSize);
+ int GetPageIndexByAnnotDict(CPDF_Document* pDocument,
+ CPDF_Dictionary* pAnnotDict) const;
+ void DoFDFBuffer(CFX_ByteString sBuffer);
+
+ using CPDFSDK_WidgetMap = std::map<CPDF_FormControl*, CPDFSDK_Widget*>;
+
+ CPDFSDK_Document* m_pDocument;
+ CPDF_InterForm* m_pInterForm;
+ CPDFSDK_WidgetMap m_Map;
+ CPDFSDK_XFAWidgetMap m_XFAMap;
+ CPDFSDK_FieldSynchronizeMap m_FieldSynchronizeMap;
+ FX_BOOL m_bCalculate;
+ FX_BOOL m_bXfaCalculate;
+ FX_BOOL m_bXfaValidationsEnabled;
+ FX_BOOL m_bBusy;
+
+ public:
+ FX_BOOL IsNeedHighLight(int nFieldType);
+ void RemoveAllHighLight();
+ void SetHighlightAlpha(uint8_t alpha) { m_iHighlightAlpha = alpha; }
+ uint8_t GetHighlightAlpha() { return m_iHighlightAlpha; }
+ void SetHighlightColor(FX_COLORREF clr, int nFieldType);
+ FX_COLORREF GetHighlightColor(int nFieldType);
+
+ private:
+ FX_COLORREF m_aHighlightColor[7];
+ uint8_t m_iHighlightAlpha;
+ FX_BOOL m_bNeedHightlight[7];
};
-#define BAI_STRUCTURE 0
-#define BAI_ROW 1
-#define BAI_COLUMN 2
-
-#define CPDFSDK_Annots CFX_ArrayTemplate<CPDFSDK_Annot*>
-#define CPDFSDK_SortAnnots CGW_ArrayTemplate<CPDFSDK_Annot*>
-class CBA_AnnotIterator
-{
-public:
- CBA_AnnotIterator(CPDFSDK_PageView* pPageView, const CFX_ByteString& sType, const CFX_ByteString& sSubType);
- ~CBA_AnnotIterator();
-
- CPDFSDK_Annot* GetFirstAnnot();
- CPDFSDK_Annot* GetLastAnnot();
- CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pAnnot);
- CPDFSDK_Annot* GetPrevAnnot(CPDFSDK_Annot* pAnnot);
-
-private:
- void GenerateResults();
- static int CompareByLeft(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2);
- static int CompareByTop(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2);
- static CPDF_Rect GetAnnotRect(CPDFSDK_Annot* pAnnot);
-
- CPDFSDK_PageView* m_pPageView;
- CFX_ByteString m_sType;
- CFX_ByteString m_sSubType;
- int m_nTabs;
- CPDFSDK_Annots m_Annots;
+#define BAI_STRUCTURE 0
+#define BAI_ROW 1
+#define BAI_COLUMN 2
+
+#define CPDFSDK_Annots CFX_ArrayTemplate<CPDFSDK_Annot*>
+#define CPDFSDK_SortAnnots CGW_ArrayTemplate<CPDFSDK_Annot*>
+class CBA_AnnotIterator {
+ public:
+ CBA_AnnotIterator(CPDFSDK_PageView* pPageView,
+ const CFX_ByteString& sType,
+ const CFX_ByteString& sSubType);
+ ~CBA_AnnotIterator();
+
+ CPDFSDK_Annot* GetFirstAnnot();
+ CPDFSDK_Annot* GetLastAnnot();
+ CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pAnnot);
+ CPDFSDK_Annot* GetPrevAnnot(CPDFSDK_Annot* pAnnot);
+
+ private:
+ void GenerateResults();
+ static int CompareByLeft(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2);
+ static int CompareByTop(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2);
+ static CPDF_Rect GetAnnotRect(CPDFSDK_Annot* pAnnot);
+
+ CPDFSDK_PageView* m_pPageView;
+ CFX_ByteString m_sType;
+ CFX_ByteString m_sSubType;
+ int m_nTabs;
+ CPDFSDK_Annots m_Annots;
};
#endif // FPDFSDK_INCLUDE_FSDK_BASEFORM_H_
diff --git a/fpdfsdk/include/fsdk_common.h b/fpdfsdk/include/fsdk_common.h
index b243cd4ab7..279048b9ac 100644
--- a/fpdfsdk/include/fsdk_common.h
+++ b/fpdfsdk/include/fsdk_common.h
@@ -7,39 +7,39 @@
#ifndef FPDFSDK_INCLUDE_FSDK_COMMON_H_
#define FPDFSDK_INCLUDE_FSDK_COMMON_H_
-#define BFFT_SIGNATURE "Signature"
+#define BFFT_SIGNATURE "Signature"
-//for all fields
-#define FIELDFLAG_READONLY 1
-#define FIELDFLAG_REQUIRED 2
-#define FIELDFLAG_NOEXPORT 4
-//for text fields
-#define FIELDFLAG_MULTILINE (1<<12)
-#define FIELDFLAG_PASSWORD (1<<13)
-#define FIELDFLAG_FILESELECT (1<<20)
-#define FIELDFLAG_DONOTSPELLCHECK (1<<22)
-#define FIELDFLAG_DONOTSCROLL (1<<23)
-#define FIELDFLAG_COMB (1<<24)
-#define FIELDFLAG_RICHTEXT (1<<25)
-//for button fileds
-#define FIELDFLAG_NOTOGGLETOOFF (1<<14)
-#define FIELDFLAG_RADIO (1<<15)
-#define FIELDFLAG_PUSHBUTTON (1<<16)
-#define FIELDFLAG_RADIOSINUNISON (1<<25)
-//for choice fields
-#define FIELDFLAG_COMBO (1<<17)
-#define FIELDFLAG_EDIT (1<<18)
-#define FIELDFLAG_SORT (1<<19)
-#define FIELDFLAG_MULTISELECT (1<<21)
+// for all fields
+#define FIELDFLAG_READONLY 1
+#define FIELDFLAG_REQUIRED 2
+#define FIELDFLAG_NOEXPORT 4
+// for text fields
+#define FIELDFLAG_MULTILINE (1 << 12)
+#define FIELDFLAG_PASSWORD (1 << 13)
+#define FIELDFLAG_FILESELECT (1 << 20)
+#define FIELDFLAG_DONOTSPELLCHECK (1 << 22)
+#define FIELDFLAG_DONOTSCROLL (1 << 23)
+#define FIELDFLAG_COMB (1 << 24)
+#define FIELDFLAG_RICHTEXT (1 << 25)
+// for button fileds
+#define FIELDFLAG_NOTOGGLETOOFF (1 << 14)
+#define FIELDFLAG_RADIO (1 << 15)
+#define FIELDFLAG_PUSHBUTTON (1 << 16)
+#define FIELDFLAG_RADIOSINUNISON (1 << 25)
+// for choice fields
+#define FIELDFLAG_COMBO (1 << 17)
+#define FIELDFLAG_EDIT (1 << 18)
+#define FIELDFLAG_SORT (1 << 19)
+#define FIELDFLAG_MULTISELECT (1 << 21)
#ifndef FIELDFLAG_DONOTSPELLCHECK
-#define FIELDFLAG_DONOTSPELLCHECK (1<<22)
+#define FIELDFLAG_DONOTSPELLCHECK (1 << 22)
#endif
-#define FIELDFLAG_COMMITONSELCHANGE (1<<26)
+#define FIELDFLAG_COMMITONSELCHANGE (1 << 26)
-#define BBS_SOLID 0
-#define BBS_DASH 1
-#define BBS_BEVELED 2
-#define BBS_INSET 3
-#define BBS_UNDERLINE 4
+#define BBS_SOLID 0
+#define BBS_DASH 1
+#define BBS_BEVELED 2
+#define BBS_INSET 3
+#define BBS_UNDERLINE 4
#endif // FPDFSDK_INCLUDE_FSDK_COMMON_H_
diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h
index e1ab1769a7..f208c05dab 100644
--- a/fpdfsdk/include/fsdk_define.h
+++ b/fpdfsdk/include/fsdk_define.h
@@ -31,66 +31,77 @@
#ifndef FX_ARGBTOCOLORREF
/** @brief Convert a #FX_ARGB to a #FX_COLORREF. */
-#define FX_ARGBTOCOLORREF(argb) ((((FX_DWORD)argb & 0x00FF0000) >> 16)|((FX_DWORD)argb & 0x0000FF00)|(((FX_DWORD)argb & 0x000000FF) << 16))
+#define FX_ARGBTOCOLORREF(argb) \
+ ((((FX_DWORD)argb & 0x00FF0000) >> 16) | ((FX_DWORD)argb & 0x0000FF00) | \
+ (((FX_DWORD)argb & 0x000000FF) << 16))
#endif
#ifndef FX_COLORREFTOARGB
/** @brief Convert a #FX_COLORREF to a #FX_ARGB. */
-#define FX_COLORREFTOARGB(rgb) ((FX_DWORD)0xFF000000|(((FX_DWORD)rgb & 0x000000FF) << 16)|((FX_DWORD)rgb & 0x0000FF00)|(((FX_DWORD)rgb & 0x00FF0000) >> 16))
+#define FX_COLORREFTOARGB(rgb) \
+ ((FX_DWORD)0xFF000000 | (((FX_DWORD)rgb & 0x000000FF) << 16) | \
+ ((FX_DWORD)rgb & 0x0000FF00) | (((FX_DWORD)rgb & 0x00FF0000) >> 16))
#endif
typedef unsigned int FX_UINT;
class CRenderContext;
class IFSDK_PAUSE_Adapter;
-class CPDF_CustomAccess final : public IFX_FileRead
-{
-public:
- CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess);
- ~CPDF_CustomAccess() {}
-
-
- virtual CFX_ByteString GetFullPath() { return ""; }
- virtual FX_FILESIZE GetSize() override { return m_FileAccess.m_FileLen; }
- virtual FX_BOOL GetByte(FX_DWORD pos, uint8_t& ch);
- virtual FX_BOOL GetBlock(FX_DWORD pos, uint8_t* pBuf, FX_DWORD size);
- virtual void Release() override { delete this; }
- virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
-
- FPDF_FILEACCESS m_FileAccess;
- uint8_t m_Buffer[512];
- FX_DWORD m_BufferOffset;
+class CPDF_CustomAccess final : public IFX_FileRead {
+ public:
+ CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess);
+ ~CPDF_CustomAccess() {}
+
+ virtual CFX_ByteString GetFullPath() { return ""; }
+ virtual FX_FILESIZE GetSize() override { return m_FileAccess.m_FileLen; }
+ virtual FX_BOOL GetByte(FX_DWORD pos, uint8_t& ch);
+ virtual FX_BOOL GetBlock(FX_DWORD pos, uint8_t* pBuf, FX_DWORD size);
+ virtual void Release() override { delete this; }
+ virtual FX_BOOL ReadBlock(void* buffer,
+ FX_FILESIZE offset,
+ size_t size) override;
+
+ FPDF_FILEACCESS m_FileAccess;
+ uint8_t m_Buffer[512];
+ FX_DWORD m_BufferOffset;
};
-class CFPDF_FileStream : public IFX_FileStream
-{
-public:
- CFPDF_FileStream(FPDF_FILEHANDLER* pFS);
- virtual ~CFPDF_FileStream() {}
-
- virtual IFX_FileStream* Retain();
- virtual void Release();
-
- virtual FX_FILESIZE GetSize();
- virtual FX_BOOL IsEOF();
- virtual FX_FILESIZE GetPosition() {return m_nCurPos;}
- virtual void SetPosition(FX_FILESIZE pos) {m_nCurPos = pos; }
- virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size);
- virtual size_t ReadBlock(void* buffer, size_t size);
- virtual FX_BOOL WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size);
- virtual FX_BOOL Flush();
-
-protected:
- FPDF_FILEHANDLER* m_pFS;
- FX_FILESIZE m_nCurPos;
+class CFPDF_FileStream : public IFX_FileStream {
+ public:
+ CFPDF_FileStream(FPDF_FILEHANDLER* pFS);
+ virtual ~CFPDF_FileStream() {}
+
+ virtual IFX_FileStream* Retain();
+ virtual void Release();
+
+ virtual FX_FILESIZE GetSize();
+ virtual FX_BOOL IsEOF();
+ virtual FX_FILESIZE GetPosition() { return m_nCurPos; }
+ virtual void SetPosition(FX_FILESIZE pos) { m_nCurPos = pos; }
+ virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size);
+ virtual size_t ReadBlock(void* buffer, size_t size);
+ virtual FX_BOOL WriteBlock(const void* buffer,
+ FX_FILESIZE offset,
+ size_t size);
+ virtual FX_BOOL Flush();
+
+ protected:
+ FPDF_FILEHANDLER* m_pFS;
+ FX_FILESIZE m_nCurPos;
};
void DropContext(void* data);
void FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable);
FPDF_BOOL FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy);
-void FPDF_RenderPage_Retail(CRenderContext* pContext, FPDF_PAGE page,
- int start_x, int start_y, int size_x, int size_y,
- int rotate, int flags, FX_BOOL bNeedToRestore,
+void FPDF_RenderPage_Retail(CRenderContext* pContext,
+ FPDF_PAGE page,
+ int start_x,
+ int start_y,
+ int size_x,
+ int size_y,
+ int rotate,
+ int flags,
+ FX_BOOL bNeedToRestore,
IFSDK_PAUSE_Adapter* pause);
#endif // FPDFSDK_INCLUDE_FSDK_DEFINE_H_
diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h
index bd158bc1fe..1e648e9461 100644
--- a/fpdfsdk/include/fsdk_mgr.h
+++ b/fpdfsdk/include/fsdk_mgr.h
@@ -11,7 +11,7 @@
#include "../../core/include/fpdftext/fpdf_text.h"
#include "../../public/fpdf_formfill.h"
-#include "../../public/fpdf_fwlevent.h" // cross platform keycode and events define.
+#include "../../public/fpdf_fwlevent.h" // cross platform keycode and events define.
#include "fsdk_common.h"
#include "fsdk_define.h"
#include "fx_systemhandler.h"
@@ -33,621 +33,655 @@ class CPDFSDK_PageView;
class CPDFSDK_Widget;
class IFX_SystemHandler;
-class CPDFDoc_Environment final
-{
-public:
- CPDFDoc_Environment(CPDFXFA_Document* pDoc, FPDF_FORMFILLINFO* pFFinfo);
- virtual ~CPDFDoc_Environment();
-
- virtual void Release()
- {
- if (m_pInfo && m_pInfo->Release)
- m_pInfo->Release(m_pInfo);
- delete this;
- }
-
- void FFI_Invalidate(FPDF_PAGE page, double left, double top, double right, double bottom)
- {
- if (m_pInfo && m_pInfo->FFI_Invalidate)
- m_pInfo->FFI_Invalidate(m_pInfo, page, left, top, right, bottom);
- }
-
- void FFI_OutputSelectedRect(FPDF_PAGE page, double left, double top, double right, double bottom)
- {
- if (m_pInfo && m_pInfo->FFI_OutputSelectedRect)
- m_pInfo->FFI_OutputSelectedRect(m_pInfo, page, left, top, right, bottom);
- }
-
- void FFI_SetCursor(int nCursorType)
- {
- if (m_pInfo && m_pInfo->FFI_SetCursor)
- m_pInfo->FFI_SetCursor(m_pInfo, nCursorType);
- }
-
- int FFI_SetTimer(int uElapse, TimerCallback lpTimerFunc)
- {
- if (m_pInfo && m_pInfo->FFI_SetTimer)
- return m_pInfo->FFI_SetTimer(m_pInfo, uElapse, lpTimerFunc);
- return -1;
- }
-
- void FFI_KillTimer(int nTimerID)
- {
- if (m_pInfo && m_pInfo->FFI_KillTimer)
- m_pInfo->FFI_KillTimer(m_pInfo, nTimerID);
- }
-
- FX_SYSTEMTIME FFI_GetLocalTime()
- {
- FX_SYSTEMTIME fxtime;
- if(m_pInfo && m_pInfo->FFI_GetLocalTime)
- {
- FPDF_SYSTEMTIME systime = m_pInfo->FFI_GetLocalTime(m_pInfo);
- fxtime.wDay = systime.wDay;
- fxtime.wDayOfWeek = systime.wDayOfWeek;
- fxtime.wHour = systime.wHour;
- fxtime.wMilliseconds = systime.wMilliseconds;
- fxtime.wMinute = systime.wMinute;
- fxtime.wMonth = systime.wMonth;
- fxtime.wSecond = systime.wSecond;
- fxtime.wYear = systime.wYear;
- }
- return fxtime;
- }
-
- void FFI_OnChange()
- {
- if (m_pInfo && m_pInfo->FFI_OnChange)
- m_pInfo->FFI_OnChange(m_pInfo);
- }
-
- FX_BOOL FFI_IsSHIFTKeyDown(FX_DWORD nFlag)
- {
- return (nFlag & FWL_EVENTFLAG_ShiftKey) != 0;
- }
-
- FX_BOOL FFI_IsCTRLKeyDown(FX_DWORD nFlag)
- {
- return (nFlag & FWL_EVENTFLAG_ControlKey) != 0;
- }
-
- FX_BOOL FFI_IsALTKeyDown(FX_DWORD nFlag)
- {
- return (nFlag & FWL_EVENTFLAG_AltKey) != 0;
- }
-
- FX_BOOL FFI_IsINSERTKeyDown(FX_DWORD nFlag)
- {
- return FALSE;
- }
-
- int JS_appAlert(const FX_WCHAR* Msg, const FX_WCHAR* Title, FX_UINT Type, FX_UINT Icon);
- int JS_appResponse(const FX_WCHAR* Question, const FX_WCHAR* Title, const FX_WCHAR* Default,
- const FX_WCHAR* cLabel, FPDF_BOOL bPassword, void* response, int length);
-
- void JS_appBeep(int nType)
- {
- if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_beep)
- m_pInfo->m_pJsPlatform->app_beep(m_pInfo->m_pJsPlatform, nType);
- }
-
- CFX_WideString JS_fieldBrowse();
- CFX_WideString JS_docGetFilePath();
-
- void JS_docSubmitForm(void* formData, int length, const FX_WCHAR* URL);
- void JS_docmailForm(void* mailData, int length, FPDF_BOOL bUI,
- const FX_WCHAR* To, const FX_WCHAR* Subject,
- const FX_WCHAR* CC, const FX_WCHAR* BCC,
- const FX_WCHAR* Msg);
-
- void JS_docprint(FPDF_BOOL bUI, int nStart, int nEnd, FPDF_BOOL bSilent,
- FPDF_BOOL bShrinkToFit, FPDF_BOOL bPrintAsImage,
- FPDF_BOOL bReverse, FPDF_BOOL bAnnotations)
- {
- if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_print)
- m_pInfo->m_pJsPlatform->Doc_print(
- m_pInfo->m_pJsPlatform, bUI, nStart, nEnd, bSilent, bShrinkToFit,
- bPrintAsImage, bReverse, bAnnotations);
- }
-
- void JS_docgotoPage(int nPageNum)
- {
- if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_gotoPage)
- m_pInfo->m_pJsPlatform->Doc_gotoPage(m_pInfo->m_pJsPlatform, nPageNum);
- }
-
- FPDF_PAGE FFI_GetPage(FPDF_DOCUMENT document,int nPageIndex)
- {
- if (m_pInfo && m_pInfo->FFI_GetPage)
- return m_pInfo->FFI_GetPage(m_pInfo, document, nPageIndex);
- return NULL;
- }
-
- FPDF_PAGE FFI_GetCurrentPage(FPDF_DOCUMENT document)
- {
- if (m_pInfo && m_pInfo->FFI_GetCurrentPage)
- return m_pInfo->FFI_GetCurrentPage(m_pInfo, document);
- return NULL;
- }
-
- int FFI_GetRotation(FPDF_PAGE page)
- {
- if (m_pInfo && m_pInfo->FFI_GetRotation)
- return m_pInfo->FFI_GetRotation(m_pInfo, page);
- return 0;
- }
-
- void FFI_ExecuteNamedAction(const FX_CHAR* namedAction)
- {
- if (m_pInfo && m_pInfo->FFI_ExecuteNamedAction)
- m_pInfo->FFI_ExecuteNamedAction(m_pInfo, namedAction);
- }
-
- void FFI_OnSetFieldInputFocus(void* field,FPDF_WIDESTRING focusText, FPDF_DWORD nTextLen, FX_BOOL bFocus)
- {
- if (m_pInfo && m_pInfo->FFI_SetTextFieldFocus)
- m_pInfo->FFI_SetTextFieldFocus(m_pInfo, focusText, nTextLen, bFocus);
- }
-
- void FFI_DoURIAction(const FX_CHAR* bsURI)
- {
- if (m_pInfo && m_pInfo->FFI_DoURIAction)
- m_pInfo->FFI_DoURIAction(m_pInfo, bsURI);
- }
-
- void FFI_DoGoToAction(int nPageIndex, int zoomMode, float* fPosArray, int sizeOfArray)
- {
- if (m_pInfo && m_pInfo->FFI_DoGoToAction)
- m_pInfo->FFI_DoGoToAction(m_pInfo, nPageIndex, zoomMode, fPosArray, sizeOfArray);
- }
-
- void FFI_DisplayCaret(FPDF_PAGE page, FPDF_BOOL bVisible, double left, double top, double right, double bottom)
- {
- if (m_pInfo && m_pInfo->FFI_DisplayCaret)
- m_pInfo->FFI_DisplayCaret(m_pInfo, page, bVisible, left, top, right, bottom);
- }
-
- int FFI_GetCurrentPageIndex(FPDF_DOCUMENT document)
- {
- if (m_pInfo && m_pInfo->FFI_GetCurrentPageIndex)
- m_pInfo->FFI_GetCurrentPageIndex(m_pInfo, document);
- return -1;
- }
-
- int FFI_SetCurrentPage(FPDF_DOCUMENT document, int iCurPage)
- {
- if (m_pInfo && m_pInfo->FFI_SetCurrentPage)
- m_pInfo->FFI_SetCurrentPage(m_pInfo, document, iCurPage);
- return -1;
- }
-
- CFX_WideString FFI_GetAppName() const { return CFX_WideString(L"Acrobat"); }
-
- CFX_WideString FFI_GetPlatform()
- {
- if (m_pInfo && m_pInfo->FFI_GetPlatform)
- {
- int nRequiredLen = m_pInfo->FFI_GetPlatform(m_pInfo, NULL, 0);
- if (nRequiredLen <= 0)
- return L"";
-
- char* pbuff = new char[nRequiredLen];
- if (!pbuff)
- return L"";
-
- memset(pbuff, 0, nRequiredLen);
- int nActualLen = m_pInfo->FFI_GetPlatform(m_pInfo, pbuff, nRequiredLen);
- if (nActualLen <= 0 || nActualLen > nRequiredLen)
- {
- delete[] pbuff;
- return L"";
- }
- CFX_ByteString bsRet = CFX_ByteString(pbuff, nActualLen);
- CFX_WideString wsRet = CFX_WideString::FromUTF16LE((unsigned short*)bsRet.GetBuffer(bsRet.GetLength()), bsRet.GetLength()/sizeof(unsigned short));
- delete[] pbuff;
- return wsRet;
- }
+class CPDFDoc_Environment final {
+ public:
+ CPDFDoc_Environment(CPDFXFA_Document* pDoc, FPDF_FORMFILLINFO* pFFinfo);
+ virtual ~CPDFDoc_Environment();
+
+ virtual void Release() {
+ if (m_pInfo && m_pInfo->Release)
+ m_pInfo->Release(m_pInfo);
+ delete this;
+ }
+
+ void FFI_Invalidate(FPDF_PAGE page,
+ double left,
+ double top,
+ double right,
+ double bottom) {
+ if (m_pInfo && m_pInfo->FFI_Invalidate)
+ m_pInfo->FFI_Invalidate(m_pInfo, page, left, top, right, bottom);
+ }
+
+ void FFI_OutputSelectedRect(FPDF_PAGE page,
+ double left,
+ double top,
+ double right,
+ double bottom) {
+ if (m_pInfo && m_pInfo->FFI_OutputSelectedRect)
+ m_pInfo->FFI_OutputSelectedRect(m_pInfo, page, left, top, right, bottom);
+ }
+
+ void FFI_SetCursor(int nCursorType) {
+ if (m_pInfo && m_pInfo->FFI_SetCursor)
+ m_pInfo->FFI_SetCursor(m_pInfo, nCursorType);
+ }
+
+ int FFI_SetTimer(int uElapse, TimerCallback lpTimerFunc) {
+ if (m_pInfo && m_pInfo->FFI_SetTimer)
+ return m_pInfo->FFI_SetTimer(m_pInfo, uElapse, lpTimerFunc);
+ return -1;
+ }
+
+ void FFI_KillTimer(int nTimerID) {
+ if (m_pInfo && m_pInfo->FFI_KillTimer)
+ m_pInfo->FFI_KillTimer(m_pInfo, nTimerID);
+ }
+
+ FX_SYSTEMTIME FFI_GetLocalTime() {
+ FX_SYSTEMTIME fxtime;
+ if (m_pInfo && m_pInfo->FFI_GetLocalTime) {
+ FPDF_SYSTEMTIME systime = m_pInfo->FFI_GetLocalTime(m_pInfo);
+ fxtime.wDay = systime.wDay;
+ fxtime.wDayOfWeek = systime.wDayOfWeek;
+ fxtime.wHour = systime.wHour;
+ fxtime.wMilliseconds = systime.wMilliseconds;
+ fxtime.wMinute = systime.wMinute;
+ fxtime.wMonth = systime.wMonth;
+ fxtime.wSecond = systime.wSecond;
+ fxtime.wYear = systime.wYear;
+ }
+ return fxtime;
+ }
+
+ void FFI_OnChange() {
+ if (m_pInfo && m_pInfo->FFI_OnChange)
+ m_pInfo->FFI_OnChange(m_pInfo);
+ }
+
+ FX_BOOL FFI_IsSHIFTKeyDown(FX_DWORD nFlag) {
+ return (nFlag & FWL_EVENTFLAG_ShiftKey) != 0;
+ }
+
+ FX_BOOL FFI_IsCTRLKeyDown(FX_DWORD nFlag) {
+ return (nFlag & FWL_EVENTFLAG_ControlKey) != 0;
+ }
+
+ FX_BOOL FFI_IsALTKeyDown(FX_DWORD nFlag) {
+ return (nFlag & FWL_EVENTFLAG_AltKey) != 0;
+ }
+
+ FX_BOOL FFI_IsINSERTKeyDown(FX_DWORD nFlag) { return FALSE; }
+
+ int JS_appAlert(const FX_WCHAR* Msg,
+ const FX_WCHAR* Title,
+ FX_UINT Type,
+ FX_UINT Icon);
+ int JS_appResponse(const FX_WCHAR* Question,
+ const FX_WCHAR* Title,
+ const FX_WCHAR* Default,
+ const FX_WCHAR* cLabel,
+ FPDF_BOOL bPassword,
+ void* response,
+ int length);
+
+ void JS_appBeep(int nType) {
+ if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_beep)
+ m_pInfo->m_pJsPlatform->app_beep(m_pInfo->m_pJsPlatform, nType);
+ }
+
+ CFX_WideString JS_fieldBrowse();
+ CFX_WideString JS_docGetFilePath();
+
+ void JS_docSubmitForm(void* formData, int length, const FX_WCHAR* URL);
+ void JS_docmailForm(void* mailData,
+ int length,
+ FPDF_BOOL bUI,
+ const FX_WCHAR* To,
+ const FX_WCHAR* Subject,
+ const FX_WCHAR* CC,
+ const FX_WCHAR* BCC,
+ const FX_WCHAR* Msg);
+
+ void JS_docprint(FPDF_BOOL bUI,
+ int nStart,
+ int nEnd,
+ FPDF_BOOL bSilent,
+ FPDF_BOOL bShrinkToFit,
+ FPDF_BOOL bPrintAsImage,
+ FPDF_BOOL bReverse,
+ FPDF_BOOL bAnnotations) {
+ if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_print)
+ m_pInfo->m_pJsPlatform->Doc_print(m_pInfo->m_pJsPlatform, bUI, nStart,
+ nEnd, bSilent, bShrinkToFit,
+ bPrintAsImage, bReverse, bAnnotations);
+ }
+
+ void JS_docgotoPage(int nPageNum) {
+ if (m_pInfo && m_pInfo->m_pJsPlatform &&
+ m_pInfo->m_pJsPlatform->Doc_gotoPage)
+ m_pInfo->m_pJsPlatform->Doc_gotoPage(m_pInfo->m_pJsPlatform, nPageNum);
+ }
+
+ FPDF_PAGE FFI_GetPage(FPDF_DOCUMENT document, int nPageIndex) {
+ if (m_pInfo && m_pInfo->FFI_GetPage)
+ return m_pInfo->FFI_GetPage(m_pInfo, document, nPageIndex);
+ return NULL;
+ }
+
+ FPDF_PAGE FFI_GetCurrentPage(FPDF_DOCUMENT document) {
+ if (m_pInfo && m_pInfo->FFI_GetCurrentPage)
+ return m_pInfo->FFI_GetCurrentPage(m_pInfo, document);
+ return NULL;
+ }
+
+ int FFI_GetRotation(FPDF_PAGE page) {
+ if (m_pInfo && m_pInfo->FFI_GetRotation)
+ return m_pInfo->FFI_GetRotation(m_pInfo, page);
+ return 0;
+ }
+
+ void FFI_ExecuteNamedAction(const FX_CHAR* namedAction) {
+ if (m_pInfo && m_pInfo->FFI_ExecuteNamedAction)
+ m_pInfo->FFI_ExecuteNamedAction(m_pInfo, namedAction);
+ }
+
+ void FFI_OnSetFieldInputFocus(void* field,
+ FPDF_WIDESTRING focusText,
+ FPDF_DWORD nTextLen,
+ FX_BOOL bFocus) {
+ if (m_pInfo && m_pInfo->FFI_SetTextFieldFocus)
+ m_pInfo->FFI_SetTextFieldFocus(m_pInfo, focusText, nTextLen, bFocus);
+ }
+
+ void FFI_DoURIAction(const FX_CHAR* bsURI) {
+ if (m_pInfo && m_pInfo->FFI_DoURIAction)
+ m_pInfo->FFI_DoURIAction(m_pInfo, bsURI);
+ }
+
+ void FFI_DoGoToAction(int nPageIndex,
+ int zoomMode,
+ float* fPosArray,
+ int sizeOfArray) {
+ if (m_pInfo && m_pInfo->FFI_DoGoToAction)
+ m_pInfo->FFI_DoGoToAction(m_pInfo, nPageIndex, zoomMode, fPosArray,
+ sizeOfArray);
+ }
+
+ void FFI_DisplayCaret(FPDF_PAGE page,
+ FPDF_BOOL bVisible,
+ double left,
+ double top,
+ double right,
+ double bottom) {
+ if (m_pInfo && m_pInfo->FFI_DisplayCaret)
+ m_pInfo->FFI_DisplayCaret(m_pInfo, page, bVisible, left, top, right,
+ bottom);
+ }
+
+ int FFI_GetCurrentPageIndex(FPDF_DOCUMENT document) {
+ if (m_pInfo && m_pInfo->FFI_GetCurrentPageIndex)
+ m_pInfo->FFI_GetCurrentPageIndex(m_pInfo, document);
+ return -1;
+ }
+
+ int FFI_SetCurrentPage(FPDF_DOCUMENT document, int iCurPage) {
+ if (m_pInfo && m_pInfo->FFI_SetCurrentPage)
+ m_pInfo->FFI_SetCurrentPage(m_pInfo, document, iCurPage);
+ return -1;
+ }
+
+ CFX_WideString FFI_GetAppName() const { return CFX_WideString(L"Acrobat"); }
+
+ CFX_WideString FFI_GetPlatform() {
+ if (m_pInfo && m_pInfo->FFI_GetPlatform) {
+ int nRequiredLen = m_pInfo->FFI_GetPlatform(m_pInfo, NULL, 0);
+ if (nRequiredLen <= 0)
return L"";
- }
-
- void FFI_GotoURL(FPDF_DOCUMENT document, const CFX_WideStringC& wsURL, FX_BOOL bAppend)
- {
- if (m_pInfo && m_pInfo->FFI_GotoURL)
- {
- CFX_ByteString bsTo = CFX_WideString(wsURL).UTF16LE_Encode();
- FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(wsURL.GetLength());
- m_pInfo->FFI_GotoURL(m_pInfo, document, pTo);
- bsTo.ReleaseBuffer();
- }
- }
-
- void FFI_GetURL(FPDF_DOCUMENT document, CFX_WideString& wsURL)
- {
- wsURL = CFX_WideString();
- }
-
- void FFI_AddDoRecord(FPDF_DOCUMENT document, FPDF_WIDGET hWidget) {}
- void FFI_PageEvent(FPDF_PAGE page, FPDF_DWORD flag) {}
-
- void FFI_GetPageViewRect(FPDF_PAGE page, FS_RECTF& dstRect)
- {
- if (m_pInfo && m_pInfo->FFI_GetPageViewRect)
- {
- double left;
- double top;
- double right;
- double bottom;
- m_pInfo->FFI_GetPageViewRect(m_pInfo, page, &left, &top, &right, &bottom);
-
- dstRect.left = static_cast<float>(left);
- dstRect.top = static_cast<float>(top < bottom ? bottom : top);
- dstRect.bottom = static_cast<float>(top < bottom ? top : bottom);
- dstRect.right = static_cast<float>(right);
- }
- }
-
- FX_BOOL FFI_PopupMenu(FPDF_PAGE page, FPDF_WIDGET hWidget, int menuFlag, CFX_PointF ptPopup, const CFX_PointF* pRectExclude)
- {
- if (m_pInfo && m_pInfo->FFI_PopupMenu)
- return m_pInfo->FFI_PopupMenu(m_pInfo, page, hWidget, menuFlag, ptPopup.x, ptPopup.y);
- return FALSE;
- }
-
- void FFI_Alert(FPDF_WIDESTRING Msg, FPDF_WIDESTRING Title, int Type, int Icon)
- {
- if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_alert)
- m_pInfo->m_pJsPlatform->app_alert(m_pInfo->m_pJsPlatform, Msg, Title, Type, Icon);
- }
- void FFI_EmailTo(FPDF_FILEHANDLER* fileHandler, FPDF_WIDESTRING pTo,
- FPDF_WIDESTRING pSubject, FPDF_WIDESTRING pCC,
- FPDF_WIDESTRING pBcc, FPDF_WIDESTRING pMsg)
- {
- if (m_pInfo && m_pInfo->FFI_EmailTo)
- m_pInfo->FFI_EmailTo(m_pInfo, fileHandler, pTo, pSubject, pCC, pBcc, pMsg);
- }
-
- void FFI_UploadTo(FPDF_FILEHANDLER* fileHandler, int fileFlag, FPDF_WIDESTRING uploadTo)
- {
- if (m_pInfo && m_pInfo->FFI_UploadTo)
- m_pInfo->FFI_UploadTo(m_pInfo, fileHandler, fileFlag, uploadTo);
- }
-
- FPDF_FILEHANDLER* FFI_OpenFile(int fileType, FPDF_WIDESTRING wsURL, const char* mode)
- {
- if (m_pInfo && m_pInfo->FFI_OpenFile)
- return m_pInfo->FFI_OpenFile(m_pInfo, fileType, wsURL, mode);
- return NULL;
- }
-
- CFX_WideString FFI_GetFilePath(FPDF_FILEHANDLER* pFileHandler) const
- {
+ char* pbuff = new char[nRequiredLen];
+ if (!pbuff)
return L"";
- }
-
- int FFI_GetDocumentCount() const { return 0; }
- int FFI_GetCurDocument() const { return 0; }
-
- IFX_FileRead* FFI_DownloadFromURL(const FX_WCHAR* url)
- {
- if (m_pInfo && m_pInfo->FFI_DownloadFromURL)
- {
- CFX_ByteString bstrURL = CFX_WideString(url).UTF16LE_Encode();
- FPDF_WIDESTRING wsURL = (FPDF_WIDESTRING)bstrURL.GetBuffer(bstrURL.GetLength());
-
- FPDF_LPFILEHANDLER fileHandler = m_pInfo->FFI_DownloadFromURL(m_pInfo, wsURL);
-
- CFPDF_FileStream* fileStream = FX_NEW CFPDF_FileStream(fileHandler);
- return fileStream;
- }
- return NULL;
- }
- CFX_WideString FFI_PostRequestURL(const FX_WCHAR* wsURL,
- const FX_WCHAR* wsData,
- const FX_WCHAR* wsContentType,
- const FX_WCHAR* wsEncode,
- const FX_WCHAR* wsHeader)
- {
- if (m_pInfo && m_pInfo->FFI_PostRequestURL)
- {
- CFX_ByteString bsURL = CFX_WideString(wsURL).UTF16LE_Encode();
- FPDF_WIDESTRING URL = (FPDF_WIDESTRING)bsURL.GetBuffer(bsURL.GetLength());
-
- CFX_ByteString bsData = CFX_WideString(wsData).UTF16LE_Encode();
- FPDF_WIDESTRING data = (FPDF_WIDESTRING)bsData.GetBuffer(bsData.GetLength());
-
- CFX_ByteString bsContentType = CFX_WideString(wsContentType).UTF16LE_Encode();
- FPDF_WIDESTRING contentType = (FPDF_WIDESTRING)bsContentType.GetBuffer(bsContentType.GetLength());
-
- CFX_ByteString bsEncode = CFX_WideString(wsEncode).UTF16LE_Encode();
- FPDF_WIDESTRING encode = (FPDF_WIDESTRING)bsEncode.GetBuffer(bsEncode.GetLength());
-
- CFX_ByteString bsHeader = CFX_WideString(wsHeader).UTF16LE_Encode();
- FPDF_WIDESTRING header = (FPDF_WIDESTRING)bsHeader.GetBuffer(bsHeader.GetLength());
-
- FPDF_BSTR respone;
- FPDF_BStr_Init(&respone);
- m_pInfo->FFI_PostRequestURL(m_pInfo, URL, data, contentType, encode, header, &respone);
-
- CFX_WideString wsRet = CFX_WideString::FromUTF16LE((unsigned short*)respone.str, respone.len/sizeof(unsigned short));
- FPDF_BStr_Clear(&respone);
-
- return wsRet;
- }
+ memset(pbuff, 0, nRequiredLen);
+ int nActualLen = m_pInfo->FFI_GetPlatform(m_pInfo, pbuff, nRequiredLen);
+ if (nActualLen <= 0 || nActualLen > nRequiredLen) {
+ delete[] pbuff;
+ return L"";
+ }
+ CFX_ByteString bsRet = CFX_ByteString(pbuff, nActualLen);
+ CFX_WideString wsRet = CFX_WideString::FromUTF16LE(
+ (unsigned short*)bsRet.GetBuffer(bsRet.GetLength()),
+ bsRet.GetLength() / sizeof(unsigned short));
+ delete[] pbuff;
+ return wsRet;
+ }
+ return L"";
+ }
+
+ void FFI_GotoURL(FPDF_DOCUMENT document,
+ const CFX_WideStringC& wsURL,
+ FX_BOOL bAppend) {
+ if (m_pInfo && m_pInfo->FFI_GotoURL) {
+ CFX_ByteString bsTo = CFX_WideString(wsURL).UTF16LE_Encode();
+ FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(wsURL.GetLength());
+ m_pInfo->FFI_GotoURL(m_pInfo, document, pTo);
+ bsTo.ReleaseBuffer();
+ }
+ }
+
+ void FFI_GetURL(FPDF_DOCUMENT document, CFX_WideString& wsURL) {
+ wsURL = CFX_WideString();
+ }
+
+ void FFI_AddDoRecord(FPDF_DOCUMENT document, FPDF_WIDGET hWidget) {}
+ void FFI_PageEvent(FPDF_PAGE page, FPDF_DWORD flag) {}
+
+ void FFI_GetPageViewRect(FPDF_PAGE page, FS_RECTF& dstRect) {
+ if (m_pInfo && m_pInfo->FFI_GetPageViewRect) {
+ double left;
+ double top;
+ double right;
+ double bottom;
+ m_pInfo->FFI_GetPageViewRect(m_pInfo, page, &left, &top, &right, &bottom);
+
+ dstRect.left = static_cast<float>(left);
+ dstRect.top = static_cast<float>(top < bottom ? bottom : top);
+ dstRect.bottom = static_cast<float>(top < bottom ? top : bottom);
+ dstRect.right = static_cast<float>(right);
+ }
+ }
+
+ FX_BOOL FFI_PopupMenu(FPDF_PAGE page,
+ FPDF_WIDGET hWidget,
+ int menuFlag,
+ CFX_PointF ptPopup,
+ const CFX_PointF* pRectExclude) {
+ if (m_pInfo && m_pInfo->FFI_PopupMenu)
+ return m_pInfo->FFI_PopupMenu(m_pInfo, page, hWidget, menuFlag, ptPopup.x,
+ ptPopup.y);
+ return FALSE;
+ }
+
+ void FFI_Alert(FPDF_WIDESTRING Msg,
+ FPDF_WIDESTRING Title,
+ int Type,
+ int Icon) {
+ if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_alert)
+ m_pInfo->m_pJsPlatform->app_alert(m_pInfo->m_pJsPlatform, Msg, Title,
+ Type, Icon);
+ }
+
+ void FFI_EmailTo(FPDF_FILEHANDLER* fileHandler,
+ FPDF_WIDESTRING pTo,
+ FPDF_WIDESTRING pSubject,
+ FPDF_WIDESTRING pCC,
+ FPDF_WIDESTRING pBcc,
+ FPDF_WIDESTRING pMsg) {
+ if (m_pInfo && m_pInfo->FFI_EmailTo)
+ m_pInfo->FFI_EmailTo(m_pInfo, fileHandler, pTo, pSubject, pCC, pBcc,
+ pMsg);
+ }
+
+ void FFI_UploadTo(FPDF_FILEHANDLER* fileHandler,
+ int fileFlag,
+ FPDF_WIDESTRING uploadTo) {
+ if (m_pInfo && m_pInfo->FFI_UploadTo)
+ m_pInfo->FFI_UploadTo(m_pInfo, fileHandler, fileFlag, uploadTo);
+ }
+
+ FPDF_FILEHANDLER* FFI_OpenFile(int fileType,
+ FPDF_WIDESTRING wsURL,
+ const char* mode) {
+ if (m_pInfo && m_pInfo->FFI_OpenFile)
+ return m_pInfo->FFI_OpenFile(m_pInfo, fileType, wsURL, mode);
+ return NULL;
+ }
+
+ CFX_WideString FFI_GetFilePath(FPDF_FILEHANDLER* pFileHandler) const {
+ return L"";
+ }
+
+ int FFI_GetDocumentCount() const { return 0; }
+ int FFI_GetCurDocument() const { return 0; }
+
+ IFX_FileRead* FFI_DownloadFromURL(const FX_WCHAR* url) {
+ if (m_pInfo && m_pInfo->FFI_DownloadFromURL) {
+ CFX_ByteString bstrURL = CFX_WideString(url).UTF16LE_Encode();
+ FPDF_WIDESTRING wsURL =
+ (FPDF_WIDESTRING)bstrURL.GetBuffer(bstrURL.GetLength());
+
+ FPDF_LPFILEHANDLER fileHandler =
+ m_pInfo->FFI_DownloadFromURL(m_pInfo, wsURL);
+
+ CFPDF_FileStream* fileStream = FX_NEW CFPDF_FileStream(fileHandler);
+ return fileStream;
+ }
+ return NULL;
+ }
+
+ CFX_WideString FFI_PostRequestURL(const FX_WCHAR* wsURL,
+ const FX_WCHAR* wsData,
+ const FX_WCHAR* wsContentType,
+ const FX_WCHAR* wsEncode,
+ const FX_WCHAR* wsHeader) {
+ if (m_pInfo && m_pInfo->FFI_PostRequestURL) {
+ CFX_ByteString bsURL = CFX_WideString(wsURL).UTF16LE_Encode();
+ FPDF_WIDESTRING URL = (FPDF_WIDESTRING)bsURL.GetBuffer(bsURL.GetLength());
+
+ CFX_ByteString bsData = CFX_WideString(wsData).UTF16LE_Encode();
+ FPDF_WIDESTRING data =
+ (FPDF_WIDESTRING)bsData.GetBuffer(bsData.GetLength());
+
+ CFX_ByteString bsContentType =
+ CFX_WideString(wsContentType).UTF16LE_Encode();
+ FPDF_WIDESTRING contentType =
+ (FPDF_WIDESTRING)bsContentType.GetBuffer(bsContentType.GetLength());
+
+ CFX_ByteString bsEncode = CFX_WideString(wsEncode).UTF16LE_Encode();
+ FPDF_WIDESTRING encode =
+ (FPDF_WIDESTRING)bsEncode.GetBuffer(bsEncode.GetLength());
+
+ CFX_ByteString bsHeader = CFX_WideString(wsHeader).UTF16LE_Encode();
+ FPDF_WIDESTRING header =
+ (FPDF_WIDESTRING)bsHeader.GetBuffer(bsHeader.GetLength());
+
+ FPDF_BSTR respone;
+ FPDF_BStr_Init(&respone);
+ m_pInfo->FFI_PostRequestURL(m_pInfo, URL, data, contentType, encode,
+ header, &respone);
+
+ CFX_WideString wsRet = CFX_WideString::FromUTF16LE(
+ (unsigned short*)respone.str, respone.len / sizeof(unsigned short));
+ FPDF_BStr_Clear(&respone);
+
+ return wsRet;
+ }
+ return L"";
+ }
+
+ FPDF_BOOL FFI_PutRequestURL(const FX_WCHAR* wsURL,
+ const FX_WCHAR* wsData,
+ const FX_WCHAR* wsEncode) {
+ if (m_pInfo && m_pInfo->FFI_PutRequestURL) {
+ CFX_ByteString bsURL = CFX_WideString(wsURL).UTF16LE_Encode();
+ FPDF_WIDESTRING URL = (FPDF_WIDESTRING)bsURL.GetBuffer(bsURL.GetLength());
+
+ CFX_ByteString bsData = CFX_WideString(wsData).UTF16LE_Encode();
+ FPDF_WIDESTRING data =
+ (FPDF_WIDESTRING)bsData.GetBuffer(bsData.GetLength());
+
+ CFX_ByteString bsEncode = CFX_WideString(wsEncode).UTF16LE_Encode();
+ FPDF_WIDESTRING encode =
+ (FPDF_WIDESTRING)bsEncode.GetBuffer(bsEncode.GetLength());
+
+ return m_pInfo->FFI_PutRequestURL(m_pInfo, URL, data, encode);
+ }
+ return FALSE;
+ }
+
+ FPDF_BOOL FFI_ShowFileDialog(const FX_WCHAR* wsTitle,
+ const FX_WCHAR* wsFilter,
+ CFX_WideStringArray& wsPathArr,
+ FX_BOOL bOpen) {
+ return FALSE;
+ }
+
+ CFX_WideString FFI_GetLanguage() {
+ if (m_pInfo && m_pInfo->FFI_GetLanguage) {
+ int nRequiredLen = m_pInfo->FFI_GetLanguage(m_pInfo, NULL, 0);
+ if (nRequiredLen <= 0)
return L"";
- }
-
- FPDF_BOOL FFI_PutRequestURL(const FX_WCHAR* wsURL, const FX_WCHAR* wsData, const FX_WCHAR* wsEncode)
- {
- if (m_pInfo && m_pInfo->FFI_PutRequestURL)
- {
- CFX_ByteString bsURL = CFX_WideString(wsURL).UTF16LE_Encode();
- FPDF_WIDESTRING URL = (FPDF_WIDESTRING)bsURL.GetBuffer(bsURL.GetLength());
-
- CFX_ByteString bsData = CFX_WideString(wsData).UTF16LE_Encode();
- FPDF_WIDESTRING data = (FPDF_WIDESTRING)bsData.GetBuffer(bsData.GetLength());
-
- CFX_ByteString bsEncode = CFX_WideString(wsEncode).UTF16LE_Encode();
- FPDF_WIDESTRING encode = (FPDF_WIDESTRING)bsEncode.GetBuffer(bsEncode.GetLength());
-
- return m_pInfo->FFI_PutRequestURL(m_pInfo, URL, data, encode);
- }
- return FALSE;
- }
-
- FPDF_BOOL FFI_ShowFileDialog(const FX_WCHAR* wsTitle, const FX_WCHAR* wsFilter, CFX_WideStringArray &wsPathArr, FX_BOOL bOpen)
- {
- return FALSE;
- }
- CFX_WideString FFI_GetLanguage()
- {
- if (m_pInfo && m_pInfo->FFI_GetLanguage)
- {
- int nRequiredLen = m_pInfo->FFI_GetLanguage(m_pInfo, NULL, 0);
- if (nRequiredLen <= 0)
- return L"";
-
- char* pbuff = new char[nRequiredLen];
- if (!pbuff)
- return L"";
-
- memset(pbuff, 0, nRequiredLen);
- int nActualLen = m_pInfo->FFI_GetLanguage(m_pInfo, pbuff, nRequiredLen);
- if (nActualLen <= 0 || nActualLen > nRequiredLen)
- {
- delete[] pbuff;
- return L"";
- }
- CFX_ByteString bsRet = CFX_ByteString(pbuff, nActualLen);
- CFX_WideString wsRet = CFX_WideString::FromUTF16LE((unsigned short*)bsRet.GetBuffer(bsRet.GetLength()), bsRet.GetLength()/sizeof(unsigned short));
- delete[] pbuff;
- return wsRet;
- }
+ char* pbuff = new char[nRequiredLen];
+ if (!pbuff)
return L"";
- }
- 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; }
- CFX_ByteString GetAppName() const { return ""; }
- IFX_SystemHandler* GetSysHandler() const { return m_pSysHandler; }
- FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo; }
-
- CFFL_IFormFiller* GetIFormFiller(); // Creates if not present.
- CPDFSDK_AnnotHandlerMgr* GetAnnotHandlerMgr(); // Creates if not present.
- IFXJS_Runtime* GetJSRuntime(); // Creates if not present.
- CPDFSDK_ActionHandler* GetActionHander(); // Creates if not present.
-
-private:
- CPDFSDK_AnnotHandlerMgr* m_pAnnotHandlerMgr;
- CPDFSDK_ActionHandler* m_pActionHandler;
- IFXJS_Runtime* m_pJSRuntime;
- FPDF_FORMFILLINFO* const m_pInfo;
- CPDFSDK_Document* m_pSDKDoc;
- CPDFXFA_Document* const m_pXFADoc;
- CFFL_IFormFiller* m_pIFormFiller;
- IFX_SystemHandler* m_pSysHandler;
+ memset(pbuff, 0, nRequiredLen);
+ int nActualLen = m_pInfo->FFI_GetLanguage(m_pInfo, pbuff, nRequiredLen);
+ if (nActualLen <= 0 || nActualLen > nRequiredLen) {
+ delete[] pbuff;
+ return L"";
+ }
+ CFX_ByteString bsRet = CFX_ByteString(pbuff, nActualLen);
+ CFX_WideString wsRet = CFX_WideString::FromUTF16LE(
+ (unsigned short*)bsRet.GetBuffer(bsRet.GetLength()),
+ bsRet.GetLength() / sizeof(unsigned short));
+ delete[] pbuff;
+ return wsRet;
+ }
+ return L"";
+ }
+
+ 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; }
+ CFX_ByteString GetAppName() const { return ""; }
+ IFX_SystemHandler* GetSysHandler() const { return m_pSysHandler; }
+ FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo; }
+
+ CFFL_IFormFiller* GetIFormFiller(); // Creates if not present.
+ CPDFSDK_AnnotHandlerMgr* GetAnnotHandlerMgr(); // Creates if not present.
+ IFXJS_Runtime* GetJSRuntime(); // Creates if not present.
+ CPDFSDK_ActionHandler* GetActionHander(); // Creates if not present.
+
+ private:
+ CPDFSDK_AnnotHandlerMgr* m_pAnnotHandlerMgr;
+ CPDFSDK_ActionHandler* m_pActionHandler;
+ IFXJS_Runtime* m_pJSRuntime;
+ FPDF_FORMFILLINFO* const m_pInfo;
+ CPDFSDK_Document* m_pSDKDoc;
+ CPDFXFA_Document* const m_pXFADoc;
+ CFFL_IFormFiller* m_pIFormFiller;
+ IFX_SystemHandler* m_pSysHandler;
};
-class CPDFSDK_Document
-{
-public:
- CPDFSDK_Document(CPDFXFA_Document* pDoc, CPDFDoc_Environment* pEnv);
- ~CPDFSDK_Document();
-
- CPDFSDK_InterForm* GetInterForm() ;
- CPDFXFA_Document* GetDocument() {return m_pDoc;}
-
- int GetPageViewCount() const { return m_pageMap.size(); }
- CPDFSDK_PageView* GetPageView(CPDFXFA_Page* pPDFXFAPage, FX_BOOL ReNew = TRUE);
- CPDFSDK_PageView* GetPageView(int nIndex);
- CPDFSDK_PageView* GetCurrentView();
- void ReMovePageView(CPDFXFA_Page* pPDFPage);
- void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot);
-
- CPDFSDK_Annot* GetFocusAnnot();
-
- IFXJS_Runtime * GetJsRuntime();
-
- FX_BOOL SetFocusAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag = 0);
- FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0);
-
- FX_BOOL ExtractPages(const CFX_WordArray &arrExtraPages, CPDF_Document* pDstDoc);
- 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);
-
- void OnCloseDocument();
-
- int GetPageCount() {return m_pDoc->GetPageCount();}
- FX_BOOL GetPermissions(int nFlag);
- FX_BOOL GetChangeMark() {return m_bChangeMask;}
- void SetChangeMark() {m_bChangeMask = TRUE;}
- void ClearChangeMark() {m_bChangeMask= FALSE;}
- CFX_WideString GetPath() ;
- CPDFXFA_Page* GetPage(int nIndex);
- CPDFDoc_Environment * GetEnv() {return m_pEnv; }
- void ProcJavascriptFun();
- FX_BOOL ProcOpenAction();
- CPDF_OCContext* GetOCContext();
-private:
- std::map<CPDFXFA_Page*, CPDFSDK_PageView*> m_pageMap;
- CPDFXFA_Document* m_pDoc;
- CPDFSDK_InterForm* m_pInterForm;
- CPDFSDK_Annot* m_pFocusAnnot;
- CPDFDoc_Environment* m_pEnv;
- CPDF_OCContext* m_pOccontent;
- FX_BOOL m_bChangeMask;
+class CPDFSDK_Document {
+ public:
+ CPDFSDK_Document(CPDFXFA_Document* pDoc, CPDFDoc_Environment* pEnv);
+ ~CPDFSDK_Document();
+
+ CPDFSDK_InterForm* GetInterForm();
+ CPDFXFA_Document* GetDocument() { return m_pDoc; }
+
+ int GetPageViewCount() const { return m_pageMap.size(); }
+ CPDFSDK_PageView* GetPageView(CPDFXFA_Page* pPDFXFAPage,
+ FX_BOOL ReNew = TRUE);
+ CPDFSDK_PageView* GetPageView(int nIndex);
+ CPDFSDK_PageView* GetCurrentView();
+ void ReMovePageView(CPDFXFA_Page* pPDFPage);
+ void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot);
+
+ CPDFSDK_Annot* GetFocusAnnot();
+
+ IFXJS_Runtime* GetJsRuntime();
+
+ FX_BOOL SetFocusAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag = 0);
+ FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0);
+
+ FX_BOOL ExtractPages(const CFX_WordArray& arrExtraPages,
+ CPDF_Document* pDstDoc);
+ 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);
+
+ void OnCloseDocument();
+
+ int GetPageCount() { return m_pDoc->GetPageCount(); }
+ FX_BOOL GetPermissions(int nFlag);
+ FX_BOOL GetChangeMark() { return m_bChangeMask; }
+ void SetChangeMark() { m_bChangeMask = TRUE; }
+ void ClearChangeMark() { m_bChangeMask = FALSE; }
+ CFX_WideString GetPath();
+ CPDFXFA_Page* GetPage(int nIndex);
+ CPDFDoc_Environment* GetEnv() { return m_pEnv; }
+ void ProcJavascriptFun();
+ FX_BOOL ProcOpenAction();
+ CPDF_OCContext* GetOCContext();
+
+ private:
+ std::map<CPDFXFA_Page*, CPDFSDK_PageView*> m_pageMap;
+ CPDFXFA_Document* m_pDoc;
+ CPDFSDK_InterForm* m_pInterForm;
+ CPDFSDK_Annot* m_pFocusAnnot;
+ CPDFDoc_Environment* m_pEnv;
+ CPDF_OCContext* m_pOccontent;
+ FX_BOOL m_bChangeMask;
};
-class CPDFSDK_PageView final
-{
-public:
- CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc,CPDFXFA_Page* page);
- ~CPDFSDK_PageView();
- void PageView_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,CPDF_RenderOptions* pOptions, FX_RECT* pClip = NULL) ;
- CPDF_Annot* GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
- CPDFSDK_Annot* GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
- CPDF_Annot* GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
- CPDFSDK_Annot* GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
- CPDFSDK_Annot* GetFocusAnnot() ;
- void SetFocusAnnot(CPDFSDK_Annot* pSDKAnnot,FX_UINT nFlag = 0) {m_pSDKDoc->SetFocusAnnot(pSDKAnnot, nFlag);}
- FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0) {return m_pSDKDoc->KillFocusAnnot(nFlag);}
- FX_BOOL Annot_HasAppearance(CPDF_Annot* pAnnot);
-
- CPDFSDK_Annot* AddAnnot(CPDF_Dictionary * pDict);
- CPDFSDK_Annot* AddAnnot(const FX_CHAR* lpSubType,CPDF_Dictionary * pDict);
- CPDFSDK_Annot* AddAnnot(CPDF_Annot * pPDFAnnot);
- CPDFSDK_Annot* AddAnnot(IXFA_Widget* pPDFAnnot);
- FX_BOOL DeleteAnnot(CPDFSDK_Annot* pAnnot);
-
- int CountAnnots();
- CPDFSDK_Annot* GetAnnot(int nIndex);
- CPDFSDK_Annot* GetAnnotByDict(CPDF_Dictionary * pDict);
- CPDFSDK_Annot* GetAnnotByXFAWidget(IXFA_Widget* hWidget);
- CPDFXFA_Page* GetPDFXFAPage(){return m_page;}
- CPDF_Page* GetPDFPage();
- 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);
- FX_BOOL OnRButtonDown(const CPDF_Point & point, FX_UINT nFlag);
- FX_BOOL OnRButtonUp(const CPDF_Point & point, FX_UINT nFlag);
- FX_BOOL OnChar(int nChar, FX_UINT nFlag);
- FX_BOOL OnKeyDown(int nKeyCode, int nFlag);
- FX_BOOL OnKeyUp(int nKeyCode, int nFlag);
-
- FX_BOOL OnMouseMove(const CPDF_Point & point, int nFlag);
- FX_BOOL OnMouseWheel(double deltaX, double deltaY,const CPDF_Point& point, int nFlag);
- FX_BOOL IsValidAnnot(void* p);
- void GetCurrentMatrix(CPDF_Matrix& matrix) {matrix = m_curMatrix;}
- void UpdateRects(CFX_RectArray& rects);
- void UpdateView(CPDFSDK_Annot* pAnnot);
- CFX_PtrArray* GetAnnotList(){ return &m_fxAnnotArray; }
-
- int GetPageIndex();
- void LoadFXAnnots();
- void SetValid(FX_BOOL bValid) {m_bValid = bValid;}
- FX_BOOL IsValid() {return m_bValid;}
- void SetLock(FX_BOOL bLocked) {m_bLocked= bLocked;}
- FX_BOOL IsLocked() {return m_bLocked;}
-private:
- void PageView_OnHighlightFormFields(CFX_RenderDevice* pDevice, CPDFSDK_Widget* pWidget);
- CPDF_Matrix m_curMatrix;
- CPDFXFA_Page* m_page;
- CPDF_AnnotList* m_pAnnotList;
- //CPDFSDK_Annot* m_pFocusAnnot;
- CFX_PtrArray m_fxAnnotArray;
- CPDFSDK_Document* m_pSDKDoc;
- CPDFSDK_Annot* m_CaptureWidget;
- FX_BOOL m_bEnterWidget;
- FX_BOOL m_bExitWidget;
- FX_BOOL m_bOnWidget;
- FX_BOOL m_bValid;
- FX_BOOL m_bLocked;
+class CPDFSDK_PageView final {
+ public:
+ CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc, CPDFXFA_Page* page);
+ ~CPDFSDK_PageView();
+ void PageView_OnDraw(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ CPDF_RenderOptions* pOptions,
+ FX_RECT* pClip = NULL);
+ CPDF_Annot* GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
+ CPDFSDK_Annot* GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
+ CPDF_Annot* GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
+ CPDFSDK_Annot* GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
+ CPDFSDK_Annot* GetFocusAnnot();
+ void SetFocusAnnot(CPDFSDK_Annot* pSDKAnnot, FX_UINT nFlag = 0) {
+ m_pSDKDoc->SetFocusAnnot(pSDKAnnot, nFlag);
+ }
+ FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0) {
+ return m_pSDKDoc->KillFocusAnnot(nFlag);
+ }
+ FX_BOOL Annot_HasAppearance(CPDF_Annot* pAnnot);
+
+ CPDFSDK_Annot* AddAnnot(CPDF_Dictionary* pDict);
+ CPDFSDK_Annot* AddAnnot(const FX_CHAR* lpSubType, CPDF_Dictionary* pDict);
+ CPDFSDK_Annot* AddAnnot(CPDF_Annot* pPDFAnnot);
+ CPDFSDK_Annot* AddAnnot(IXFA_Widget* pPDFAnnot);
+ FX_BOOL DeleteAnnot(CPDFSDK_Annot* pAnnot);
+
+ int CountAnnots();
+ CPDFSDK_Annot* GetAnnot(int nIndex);
+ CPDFSDK_Annot* GetAnnotByDict(CPDF_Dictionary* pDict);
+ CPDFSDK_Annot* GetAnnotByXFAWidget(IXFA_Widget* hWidget);
+ CPDFXFA_Page* GetPDFXFAPage() { return m_page; }
+ CPDF_Page* GetPDFPage();
+ 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);
+ FX_BOOL OnRButtonDown(const CPDF_Point& point, FX_UINT nFlag);
+ FX_BOOL OnRButtonUp(const CPDF_Point& point, FX_UINT nFlag);
+ FX_BOOL OnChar(int nChar, FX_UINT nFlag);
+ FX_BOOL OnKeyDown(int nKeyCode, int nFlag);
+ FX_BOOL OnKeyUp(int nKeyCode, int nFlag);
+
+ FX_BOOL OnMouseMove(const CPDF_Point& point, int nFlag);
+ FX_BOOL OnMouseWheel(double deltaX,
+ double deltaY,
+ const CPDF_Point& point,
+ int nFlag);
+ FX_BOOL IsValidAnnot(void* p);
+ void GetCurrentMatrix(CPDF_Matrix& matrix) { matrix = m_curMatrix; }
+ void UpdateRects(CFX_RectArray& rects);
+ void UpdateView(CPDFSDK_Annot* pAnnot);
+ CFX_PtrArray* GetAnnotList() { return &m_fxAnnotArray; }
+
+ int GetPageIndex();
+ void LoadFXAnnots();
+ void SetValid(FX_BOOL bValid) { m_bValid = bValid; }
+ FX_BOOL IsValid() { return m_bValid; }
+ void SetLock(FX_BOOL bLocked) { m_bLocked = bLocked; }
+ FX_BOOL IsLocked() { return m_bLocked; }
+
+ private:
+ void PageView_OnHighlightFormFields(CFX_RenderDevice* pDevice,
+ CPDFSDK_Widget* pWidget);
+ CPDF_Matrix m_curMatrix;
+ CPDFXFA_Page* m_page;
+ CPDF_AnnotList* m_pAnnotList;
+ // CPDFSDK_Annot* m_pFocusAnnot;
+ CFX_PtrArray m_fxAnnotArray;
+ CPDFSDK_Document* m_pSDKDoc;
+ CPDFSDK_Annot* m_CaptureWidget;
+ FX_BOOL m_bEnterWidget;
+ FX_BOOL m_bExitWidget;
+ FX_BOOL m_bOnWidget;
+ FX_BOOL m_bValid;
+ FX_BOOL m_bLocked;
};
-
-template<class TYPE>
-class CGW_ArrayTemplate : public CFX_ArrayTemplate<TYPE>
-{
-public:
- CGW_ArrayTemplate(){}
- virtual ~CGW_ArrayTemplate(){}
-
- typedef int (*LP_COMPARE)(TYPE p1, TYPE p2);
-
- void Sort(LP_COMPARE pCompare, FX_BOOL bAscent = TRUE)
- {
- int nSize = this->GetSize();
- QuickSort(0, nSize -1, bAscent, pCompare);
- }
-
-private:
- void QuickSort(FX_UINT nStartPos, FX_UINT nStopPos, FX_BOOL bAscend, LP_COMPARE pCompare)
- {
- if (nStartPos >= nStopPos) return;
-
- if ((nStopPos - nStartPos) == 1)
- {
- TYPE Value1 = this->GetAt(nStartPos);
- TYPE Value2 = this->GetAt(nStopPos);
-
- int iGreate = (*pCompare)(Value1, Value2);
- if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0))
- {
- this->SetAt(nStartPos, Value2);
- this->SetAt(nStopPos, Value1);
- }
- return;
- }
-
- FX_UINT m = nStartPos + (nStopPos - nStartPos) / 2;
- FX_UINT i = nStartPos;
-
- TYPE Value = this->GetAt(m);
-
- while (i < m)
- {
- TYPE temp = this->GetAt(i);
-
- int iGreate = (*pCompare)(temp, Value);
- if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0))
- {
- this->InsertAt(m+1, temp);
- this->RemoveAt(i);
- m--;
- }
- else
- {
- i++;
- }
- }
-
- FX_UINT j = nStopPos;
-
- while (j > m)
- {
- TYPE temp = this->GetAt(j);
-
- int iGreate = (*pCompare)(temp, Value);
- if ((bAscend && iGreate < 0) || (!bAscend && iGreate > 0))
- {
- this->RemoveAt(j);
- this->InsertAt(m, temp);
- m++;
- }
- else
- {
- j--;
- }
- }
-
- if (nStartPos < m) QuickSort(nStartPos, m, bAscend, pCompare);
- if (nStopPos > m) QuickSort(m, nStopPos, bAscend, pCompare);
- }
+template <class TYPE>
+class CGW_ArrayTemplate : public CFX_ArrayTemplate<TYPE> {
+ public:
+ CGW_ArrayTemplate() {}
+ virtual ~CGW_ArrayTemplate() {}
+
+ typedef int (*LP_COMPARE)(TYPE p1, TYPE p2);
+
+ void Sort(LP_COMPARE pCompare, FX_BOOL bAscent = TRUE) {
+ int nSize = this->GetSize();
+ QuickSort(0, nSize - 1, bAscent, pCompare);
+ }
+
+ private:
+ void QuickSort(FX_UINT nStartPos,
+ FX_UINT nStopPos,
+ FX_BOOL bAscend,
+ LP_COMPARE pCompare) {
+ if (nStartPos >= nStopPos)
+ return;
+
+ if ((nStopPos - nStartPos) == 1) {
+ TYPE Value1 = this->GetAt(nStartPos);
+ TYPE Value2 = this->GetAt(nStopPos);
+
+ int iGreate = (*pCompare)(Value1, Value2);
+ if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0)) {
+ this->SetAt(nStartPos, Value2);
+ this->SetAt(nStopPos, Value1);
+ }
+ return;
+ }
+
+ FX_UINT m = nStartPos + (nStopPos - nStartPos) / 2;
+ FX_UINT i = nStartPos;
+
+ TYPE Value = this->GetAt(m);
+
+ while (i < m) {
+ TYPE temp = this->GetAt(i);
+
+ int iGreate = (*pCompare)(temp, Value);
+ if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0)) {
+ this->InsertAt(m + 1, temp);
+ this->RemoveAt(i);
+ m--;
+ } else {
+ i++;
+ }
+ }
+
+ FX_UINT j = nStopPos;
+
+ while (j > m) {
+ TYPE temp = this->GetAt(j);
+
+ int iGreate = (*pCompare)(temp, Value);
+ if ((bAscend && iGreate < 0) || (!bAscend && iGreate > 0)) {
+ this->RemoveAt(j);
+ this->InsertAt(m, temp);
+ m++;
+ } else {
+ j--;
+ }
+ }
+
+ if (nStartPos < m)
+ QuickSort(nStartPos, m, bAscend, pCompare);
+ if (nStopPos > m)
+ QuickSort(m, nStopPos, bAscend, pCompare);
+ }
};
#endif // FPDFSDK_INCLUDE_FSDK_MGR_H_
diff --git a/fpdfsdk/include/fsdk_rendercontext.h b/fpdfsdk/include/fsdk_rendercontext.h
index b2bc163b49..9d1dabd41c 100644
--- a/fpdfsdk/include/fsdk_rendercontext.h
+++ b/fpdfsdk/include/fsdk_rendercontext.h
@@ -11,33 +11,31 @@
#include "fsdk_define.h"
// Everything about rendering is put here: for OOM recovery
-class CRenderContext
-{
-public:
- CRenderContext() { Clear(); }
- ~CRenderContext();
-
- void Clear();
-
- CFX_RenderDevice* m_pDevice;
- CPDF_RenderContext* m_pContext;
- CPDF_ProgressiveRenderer* m_pRenderer;
- CPDF_AnnotList* m_pAnnots;
- CPDF_RenderOptions* m_pOptions;
+class CRenderContext {
+ public:
+ CRenderContext() { Clear(); }
+ ~CRenderContext();
+
+ void Clear();
+
+ CFX_RenderDevice* m_pDevice;
+ CPDF_RenderContext* m_pContext;
+ CPDF_ProgressiveRenderer* m_pRenderer;
+ CPDF_AnnotList* m_pAnnots;
+ CPDF_RenderOptions* m_pOptions;
#ifdef _WIN32_WCE
- CFX_DIBitmap* m_pBitmap;
- HBITMAP m_hBitmap;
+ CFX_DIBitmap* m_pBitmap;
+ HBITMAP m_hBitmap;
#endif
};
-class IFSDK_PAUSE_Adapter : public IFX_Pause
-{
-public:
- IFSDK_PAUSE_Adapter(IFSDK_PAUSE* IPause );
- FX_BOOL NeedToPauseNow();
+class IFSDK_PAUSE_Adapter : public IFX_Pause {
+ public:
+ IFSDK_PAUSE_Adapter(IFSDK_PAUSE* IPause);
+ FX_BOOL NeedToPauseNow();
-private:
- IFSDK_PAUSE* m_IPause;
+ private:
+ IFSDK_PAUSE* m_IPause;
};
#endif // FPDFSDK_INCLUDE_FSDK_RENDERCONTEXT_H_
diff --git a/fpdfsdk/include/fx_systemhandler.h b/fpdfsdk/include/fx_systemhandler.h
index bf59e452ea..31d3347477 100644
--- a/fpdfsdk/include/fx_systemhandler.h
+++ b/fpdfsdk/include/fx_systemhandler.h
@@ -7,13 +7,12 @@
#ifndef FPDFSDK_INCLUDE_FX_SYSTEMHANDLER_H_
#define FPDFSDK_INCLUDE_FX_SYSTEMHANDLER_H_
-typedef void* FX_HWND;
-typedef void* FX_HMENU;
-typedef void (*TimerCallback)(int32_t idEvent);
+typedef void* FX_HWND;
+typedef void* FX_HMENU;
+typedef void (*TimerCallback)(int32_t idEvent);
-typedef struct _FX_SYSTEMTIME
-{
- _FX_SYSTEMTIME()
+typedef struct _FX_SYSTEMTIME {
+ _FX_SYSTEMTIME()
: wYear(0),
wMonth(0),
wDayOfWeek(0),
@@ -22,72 +21,80 @@ typedef struct _FX_SYSTEMTIME
wMinute(0),
wSecond(0),
wMilliseconds(0) {}
- FX_WORD wYear;
- FX_WORD wMonth;
- FX_WORD wDayOfWeek;
- FX_WORD wDay;
- FX_WORD wHour;
- FX_WORD wMinute;
- FX_WORD wSecond;
- FX_WORD wMilliseconds;
-}FX_SYSTEMTIME;
-
-//cursor style
-#define FXCT_ARROW 0
-#define FXCT_NESW 1
-#define FXCT_NWSE 2
-#define FXCT_VBEAM 3
-#define FXCT_HBEAM 4
-#define FXCT_HAND 5
-
-class IFX_SystemHandler
-{
-public:
- virtual ~IFX_SystemHandler() {}
- virtual void InvalidateRect(FX_HWND hWnd, FX_RECT rect) = 0;
- virtual void OutputSelectedRect(void* pFormFiller, CPDF_Rect&rect) = 0;
-
- virtual FX_BOOL IsSelectionImplemented() = 0;
-
- virtual CFX_WideString GetClipboardText(FX_HWND hWnd) = 0;
- virtual FX_BOOL SetClipboardText(FX_HWND hWnd, CFX_WideString string) = 0;
-
- virtual void ClientToScreen(FX_HWND hWnd, int32_t& x, int32_t& y) = 0;
- virtual void ScreenToClient(FX_HWND hWnd, int32_t& x, int32_t& y) = 0;
-
- /*cursor style
- FXCT_ARROW
- FXCT_NESW
- FXCT_NWSE
- FXCT_VBEAM
- FXCT_HBEAM
- FXCT_HAND
- */
- virtual void SetCursor(int32_t nCursorType) = 0;
-
- virtual FX_HMENU CreatePopupMenu() = 0;
- virtual FX_BOOL AppendMenuItem(FX_HMENU hMenu, int32_t nIDNewItem, CFX_WideString string) = 0;
- virtual FX_BOOL EnableMenuItem(FX_HMENU hMenu, int32_t nIDItem, FX_BOOL bEnabled) = 0;
- virtual int32_t TrackPopupMenu(FX_HMENU hMenu, int32_t x, int32_t y, FX_HWND hParent) = 0;
- virtual void DestroyMenu(FX_HMENU hMenu) = 0;
-
- virtual CFX_ByteString GetNativeTrueTypeFont(int32_t nCharset) = 0;
- virtual FX_BOOL FindNativeTrueTypeFont(int32_t nCharset, CFX_ByteString sFontFaceName) = 0;
- virtual CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, CFX_ByteString sFontFaceName, uint8_t nCharset) = 0;
-
- virtual int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc) = 0;
- virtual void KillTimer(int32_t nID) = 0;
-
-
- virtual FX_BOOL IsSHIFTKeyDown(FX_DWORD nFlag) = 0;
- virtual FX_BOOL IsCTRLKeyDown(FX_DWORD nFlag) = 0;
- virtual FX_BOOL IsALTKeyDown(FX_DWORD nFlag) = 0;
- virtual FX_BOOL IsINSERTKeyDown(FX_DWORD nFlag) = 0;
-
- virtual FX_SYSTEMTIME GetLocalTime() = 0;
-
- virtual int32_t GetCharSet() = 0;
- virtual void SetCharSet(int32_t nCharSet) = 0;
+ FX_WORD wYear;
+ FX_WORD wMonth;
+ FX_WORD wDayOfWeek;
+ FX_WORD wDay;
+ FX_WORD wHour;
+ FX_WORD wMinute;
+ FX_WORD wSecond;
+ FX_WORD wMilliseconds;
+} FX_SYSTEMTIME;
+
+// cursor style
+#define FXCT_ARROW 0
+#define FXCT_NESW 1
+#define FXCT_NWSE 2
+#define FXCT_VBEAM 3
+#define FXCT_HBEAM 4
+#define FXCT_HAND 5
+
+class IFX_SystemHandler {
+ public:
+ virtual ~IFX_SystemHandler() {}
+ virtual void InvalidateRect(FX_HWND hWnd, FX_RECT rect) = 0;
+ virtual void OutputSelectedRect(void* pFormFiller, CPDF_Rect& rect) = 0;
+
+ virtual FX_BOOL IsSelectionImplemented() = 0;
+
+ virtual CFX_WideString GetClipboardText(FX_HWND hWnd) = 0;
+ virtual FX_BOOL SetClipboardText(FX_HWND hWnd, CFX_WideString string) = 0;
+
+ virtual void ClientToScreen(FX_HWND hWnd, int32_t& x, int32_t& y) = 0;
+ virtual void ScreenToClient(FX_HWND hWnd, int32_t& x, int32_t& y) = 0;
+
+ /*cursor style
+ FXCT_ARROW
+ FXCT_NESW
+ FXCT_NWSE
+ FXCT_VBEAM
+ FXCT_HBEAM
+ FXCT_HAND
+ */
+ virtual void SetCursor(int32_t nCursorType) = 0;
+
+ virtual FX_HMENU CreatePopupMenu() = 0;
+ virtual FX_BOOL AppendMenuItem(FX_HMENU hMenu,
+ int32_t nIDNewItem,
+ CFX_WideString string) = 0;
+ virtual FX_BOOL EnableMenuItem(FX_HMENU hMenu,
+ int32_t nIDItem,
+ FX_BOOL bEnabled) = 0;
+ virtual int32_t TrackPopupMenu(FX_HMENU hMenu,
+ int32_t x,
+ int32_t y,
+ FX_HWND hParent) = 0;
+ virtual void DestroyMenu(FX_HMENU hMenu) = 0;
+
+ virtual CFX_ByteString GetNativeTrueTypeFont(int32_t nCharset) = 0;
+ virtual FX_BOOL FindNativeTrueTypeFont(int32_t nCharset,
+ CFX_ByteString sFontFaceName) = 0;
+ virtual CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc,
+ CFX_ByteString sFontFaceName,
+ uint8_t nCharset) = 0;
+
+ virtual int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc) = 0;
+ virtual void KillTimer(int32_t nID) = 0;
+
+ virtual FX_BOOL IsSHIFTKeyDown(FX_DWORD nFlag) = 0;
+ virtual FX_BOOL IsCTRLKeyDown(FX_DWORD nFlag) = 0;
+ virtual FX_BOOL IsALTKeyDown(FX_DWORD nFlag) = 0;
+ virtual FX_BOOL IsINSERTKeyDown(FX_DWORD nFlag) = 0;
+
+ virtual FX_SYSTEMTIME GetLocalTime() = 0;
+
+ virtual int32_t GetCharSet() = 0;
+ virtual void SetCharSet(int32_t nCharSet) = 0;
};
#endif // FPDFSDK_INCLUDE_FX_SYSTEMHANDLER_H_
diff --git a/fpdfsdk/include/fxedit/fx_edit.h b/fpdfsdk/include/fxedit/fx_edit.h
index d154cb2290..bfe6a254ff 100644
--- a/fpdfsdk/include/fxedit/fx_edit.h
+++ b/fpdfsdk/include/fxedit/fx_edit.h
@@ -35,451 +35,535 @@ struct CPVT_WordPlace;
struct CPVT_WordProps;
struct CPVT_WordRange;
-#define PVTWORD_STYLE_NORMAL 0x0000L
-#define PVTWORD_STYLE_HIGHLIGHT 0x0001L
-#define PVTWORD_STYLE_UNDERLINE 0x0002L
-#define PVTWORD_STYLE_CROSSOUT 0x0004L
-#define PVTWORD_STYLE_SQUIGGLY 0x0008L
-#define PVTWORD_STYLE_DUALCROSSOUT 0x0010L
-#define PVTWORD_STYLE_BOLD 0x0020L
-#define PVTWORD_STYLE_ITALIC 0x0040L
-
-#define FX_EDIT_ISLATINWORD(u) (u == 0x2D || (u <= 0x005A && u >= 0x0041) || (u <= 0x007A && u >= 0x0061) || (u <= 0x02AF && u >= 0x00C0))
+#define PVTWORD_STYLE_NORMAL 0x0000L
+#define PVTWORD_STYLE_HIGHLIGHT 0x0001L
+#define PVTWORD_STYLE_UNDERLINE 0x0002L
+#define PVTWORD_STYLE_CROSSOUT 0x0004L
+#define PVTWORD_STYLE_SQUIGGLY 0x0008L
+#define PVTWORD_STYLE_DUALCROSSOUT 0x0010L
+#define PVTWORD_STYLE_BOLD 0x0020L
+#define PVTWORD_STYLE_ITALIC 0x0040L
+
+#define FX_EDIT_ISLATINWORD(u) \
+ (u == 0x2D || (u <= 0x005A && u >= 0x0041) || \
+ (u <= 0x007A && u >= 0x0061) || (u <= 0x02AF && u >= 0x00C0))
#ifndef DEFAULT_CHARSET
-#define DEFAULT_CHARSET 1
+#define DEFAULT_CHARSET 1
#endif
-class IFX_Edit_FontMap
-{
-public:
- virtual ~IFX_Edit_FontMap() { }
- //map a fontindex to pdf font.
- virtual CPDF_Font * GetPDFFont(int32_t nFontIndex) = 0;
- //get the alias of a pdf font.
- virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) = 0;
- //get the index of a font that can show a word.
- virtual int32_t GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex) = 0;
- //get the charcode of word from unicode
- virtual int32_t CharCodeFromUnicode(int32_t nFontIndex, FX_WORD word) = 0;
- //get the charset of unicode
- virtual int32_t CharSetFromUnicode(FX_WORD word, int32_t nOldCharset) = 0;
+class IFX_Edit_FontMap {
+ public:
+ virtual ~IFX_Edit_FontMap() {}
+ // map a fontindex to pdf font.
+ virtual CPDF_Font* GetPDFFont(int32_t nFontIndex) = 0;
+ // get the alias of a pdf font.
+ virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) = 0;
+ // get the index of a font that can show a word.
+ virtual int32_t GetWordFontIndex(FX_WORD word,
+ int32_t charset,
+ int32_t nFontIndex) = 0;
+ // get the charcode of word from unicode
+ virtual int32_t CharCodeFromUnicode(int32_t nFontIndex, FX_WORD word) = 0;
+ // get the charset of unicode
+ virtual int32_t CharSetFromUnicode(FX_WORD word, int32_t nOldCharset) = 0;
};
-class IFX_Edit_Notify
-{
-public:
- virtual ~IFX_Edit_Notify() { }
- //set the horizontal scrollbar information.
- virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin, FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
- //set the vertical scrollbar information.
- virtual void IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin, FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
- //set the position of horizontal scrollbar.
- virtual void IOnSetScrollPosX(FX_FLOAT fx) = 0;
- //set the position of vertical scrollbar.
- virtual void IOnSetScrollPosY(FX_FLOAT fy) = 0;
- //set the caret information.
- virtual void IOnSetCaret(FX_BOOL bVisible,const CPDF_Point & ptHead,const CPDF_Point & ptFoot, const CPVT_WordPlace& place) = 0;
- //if the caret position is changed ,send the information of current postion to user.
- virtual void IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps) = 0;
- //if the text area is changed, send the information to user.
- virtual void IOnContentChange(const CPDF_Rect& rcContent) = 0;
- //Invalidate the rectangle relative to the bounding box of edit.
- virtual void IOnInvalidateRect(CPDF_Rect * pRect) = 0;
+class IFX_Edit_Notify {
+ public:
+ virtual ~IFX_Edit_Notify() {}
+ // set the horizontal scrollbar information.
+ virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin,
+ FX_FLOAT fPlateMax,
+ FX_FLOAT fContentMin,
+ FX_FLOAT fContentMax,
+ FX_FLOAT fSmallStep,
+ FX_FLOAT fBigStep) = 0;
+ // set the vertical scrollbar information.
+ virtual void IOnSetScrollInfoY(FX_FLOAT fPlateMin,
+ FX_FLOAT fPlateMax,
+ FX_FLOAT fContentMin,
+ FX_FLOAT fContentMax,
+ FX_FLOAT fSmallStep,
+ FX_FLOAT fBigStep) = 0;
+ // set the position of horizontal scrollbar.
+ virtual void IOnSetScrollPosX(FX_FLOAT fx) = 0;
+ // set the position of vertical scrollbar.
+ virtual void IOnSetScrollPosY(FX_FLOAT fy) = 0;
+ // set the caret information.
+ virtual void IOnSetCaret(FX_BOOL bVisible,
+ const CPDF_Point& ptHead,
+ const CPDF_Point& ptFoot,
+ const CPVT_WordPlace& place) = 0;
+ // if the caret position is changed ,send the information of current postion
+ // to user.
+ virtual void IOnCaretChange(const CPVT_SecProps& secProps,
+ const CPVT_WordProps& wordProps) = 0;
+ // if the text area is changed, send the information to user.
+ virtual void IOnContentChange(const CPDF_Rect& rcContent) = 0;
+ // Invalidate the rectangle relative to the bounding box of edit.
+ virtual void IOnInvalidateRect(CPDF_Rect* pRect) = 0;
};
-class IFX_Edit_OprNotify
-{
-public:
- virtual ~IFX_Edit_OprNotify() { }
-
- //OprType: 0
- virtual void OnInsertWord(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
- //OprType: 1
- virtual void OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
- //OprType: 2
- virtual void OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
- //OprType: 3
- virtual void OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
- //OprType: 4
- virtual void OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
- //OprType: 5
- virtual void OnInsertText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
- //OprType: 6
- virtual void OnSetText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
- //
- virtual void OnAddUndo(IFX_Edit_UndoItem* pUndoItem) = 0;
+class IFX_Edit_OprNotify {
+ public:
+ virtual ~IFX_Edit_OprNotify() {}
+
+ // OprType: 0
+ virtual void OnInsertWord(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) = 0;
+ // OprType: 1
+ virtual void OnInsertReturn(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) = 0;
+ // OprType: 2
+ virtual void OnBackSpace(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) = 0;
+ // OprType: 3
+ virtual void OnDelete(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) = 0;
+ // OprType: 4
+ virtual void OnClear(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) = 0;
+ // OprType: 5
+ virtual void OnInsertText(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) = 0;
+ // OprType: 6
+ virtual void OnSetText(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) = 0;
+ //
+ virtual void OnAddUndo(IFX_Edit_UndoItem* pUndoItem) = 0;
};
-class IFX_Edit_Iterator
-{
-public:
- virtual ~IFX_Edit_Iterator() {}
-public:
- //move the current position to the next word.
- virtual FX_BOOL NextWord() = 0;
- //move the current position to the next line.
- virtual FX_BOOL NextLine() = 0;
- //move the current position to the next section.
- virtual FX_BOOL NextSection() = 0;
-
- //move the current position to the previous word.
- virtual FX_BOOL PrevWord() = 0;
- //move the current position to the previous line.
- virtual FX_BOOL PrevLine() = 0;
- //move the current position to the previous section.
- virtual FX_BOOL PrevSection() = 0;
-
- //get the information of the current word.
- virtual FX_BOOL GetWord(CPVT_Word & word) const = 0;
- //get the information of the current line.
- virtual FX_BOOL GetLine(CPVT_Line & line) const = 0;
- //get the information of the current section.
- virtual FX_BOOL GetSection(CPVT_Section & section) const = 0;
- //set the current position.
- virtual void SetAt(int32_t nWordIndex) = 0;
- //set the current position.
- virtual void SetAt(const CPVT_WordPlace & place) = 0;
- //get the current position.
- virtual const CPVT_WordPlace & GetAt() const = 0;
-
- //get the edit which this iterator belongs to
- virtual IFX_Edit* GetEdit() const = 0;
+class IFX_Edit_Iterator {
+ public:
+ virtual ~IFX_Edit_Iterator() {}
+
+ public:
+ // move the current position to the next word.
+ virtual FX_BOOL NextWord() = 0;
+ // move the current position to the next line.
+ virtual FX_BOOL NextLine() = 0;
+ // move the current position to the next section.
+ virtual FX_BOOL NextSection() = 0;
+
+ // move the current position to the previous word.
+ virtual FX_BOOL PrevWord() = 0;
+ // move the current position to the previous line.
+ virtual FX_BOOL PrevLine() = 0;
+ // move the current position to the previous section.
+ virtual FX_BOOL PrevSection() = 0;
+
+ // get the information of the current word.
+ virtual FX_BOOL GetWord(CPVT_Word& word) const = 0;
+ // get the information of the current line.
+ virtual FX_BOOL GetLine(CPVT_Line& line) const = 0;
+ // get the information of the current section.
+ virtual FX_BOOL GetSection(CPVT_Section& section) const = 0;
+ // set the current position.
+ virtual void SetAt(int32_t nWordIndex) = 0;
+ // set the current position.
+ virtual void SetAt(const CPVT_WordPlace& place) = 0;
+ // get the current position.
+ virtual const CPVT_WordPlace& GetAt() const = 0;
+
+ // get the edit which this iterator belongs to
+ virtual IFX_Edit* GetEdit() const = 0;
};
-class IFX_Edit_UndoItem
-{
-public:
- virtual ~IFX_Edit_UndoItem() { }
+class IFX_Edit_UndoItem {
+ public:
+ virtual ~IFX_Edit_UndoItem() {}
- virtual void Undo() = 0;
- virtual void Redo() = 0;
- virtual CFX_WideString GetUndoTitle() = 0;
+ virtual void Undo() = 0;
+ virtual void Redo() = 0;
+ virtual CFX_WideString GetUndoTitle() = 0;
};
-class IFX_Edit
-{
-public:
- static IFX_Edit* NewEdit();
- static void DelEdit(IFX_Edit* pEdit);
-
- //set a IFX_Edit_FontMap pointer implemented by user.
- virtual void SetFontMap(IFX_Edit_FontMap* pFontMap) = 0;
- //if user don't like to use FontMap, implement VTProvider and set it directly.
- virtual void SetVTProvider(IPDF_VariableText_Provider* pProvider) = 0;
- //set a IFX_Edit_Notify pointer implemented by user.
- virtual void SetNotify(IFX_Edit_Notify * pNotify) = 0;
- virtual void SetOprNotify(IFX_Edit_OprNotify* pOprNotify) = 0;
- //get a pointer allocated by CPDF_Edit, by this pointer, user can iterate the contents of edit, but don't need to release.
- virtual IFX_Edit_Iterator* GetIterator() = 0;
- //get a VT pointer relative to this edit.
- virtual IPDF_VariableText* GetVariableText() = 0;
- //get the IFX_Edit_FontMap pointer set by user.
- virtual IFX_Edit_FontMap* GetFontMap() = 0;
-
- //initialize the edit.
- virtual void Initialize() = 0;
-
- //set the bounding box of the text area.
- virtual void SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint = TRUE) = 0;
- //set the scroll origin
- virtual void SetScrollPos(const CPDF_Point & point) = 0;
-
- //set the horizontal text alignment in text box, nFormat (0:left 1:middle 2:right).
- virtual void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) = 0;
- //set the vertical text alignment in text box, nFormat (0:top 1:center 2:bottom).
- virtual void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) = 0;
- //if the text is shown in secret , set a character for substitute.
- virtual void SetPasswordChar(FX_WORD wSubWord = '*', FX_BOOL bPaint = TRUE) = 0;
- //set the maximal count of words of the text.
- virtual void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE) = 0;
- //if set the count of charArray , then all words is shown in equal space.
- virtual void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE) = 0;
- //set the space of two characters.
- virtual void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE) = 0;
- //set the horizontal scale of all characters.
- virtual void SetHorzScale(int32_t nHorzScale = 100, FX_BOOL bPaint = TRUE) = 0;
- //set the leading of all lines
- virtual void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE) = 0;
- //if set, CRLF is allowed.
- virtual void SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE) = 0;
- //if set, all words auto fit the width of the bounding box.
- virtual void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
- //if set, a font size is calculated to full fit the bounding box.
- virtual void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
- //is set, the text is allowed to scroll.
- virtual void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
- //set the font size of all words.
- virtual void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) = 0;
- //the text is allowed to auto-scroll, allow the text overflow?
- virtual void SetTextOverflow(FX_BOOL bAllowed = FALSE, FX_BOOL bPaint = TRUE) = 0;
-
- //query if the edit is richedit.
- virtual FX_BOOL IsRichText() const = 0;
- //set the edit is richedit.
- virtual void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE) = 0;
- //set the fontsize of selected text.
- virtual FX_BOOL SetRichFontSize(FX_FLOAT fFontSize) = 0;
- //set the fontindex of selected text, user can change the font of selected text.
- virtual FX_BOOL SetRichFontIndex(int32_t nFontIndex) = 0;
- //set the textcolor of selected text.
- virtual FX_BOOL SetRichTextColor(FX_COLORREF dwColor) = 0;
- //set the text script type of selected text. (0:normal 1:superscript 2:subscript)
- virtual FX_BOOL SetRichTextScript(int32_t nScriptType) = 0;
- //set the bold font style of selected text.
- virtual FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE) = 0;
- //set the italic font style of selected text.
- virtual FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE) = 0;
- //set the underline style of selected text.
- virtual FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE) = 0;
- //set the crossout style of selected text.
- virtual FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE) = 0;
- //set the charspace of selected text, in user coordinate.
- virtual FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace) = 0;
- //set the horizontal scale of selected text, default value is 100.
- virtual FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100) = 0;
- //set the leading of selected section, in user coordinate.
- virtual FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading) = 0;
- //set the indent of selected section, in user coordinate.
- virtual FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent) = 0;
- //set the alignment of selected section, nAlignment(0:left 1:middle 2:right)
- virtual FX_BOOL SetRichTextAlignment(int32_t nAlignment) = 0;
-
- //set the selected range of text.
- //if nStartChar == 0 and nEndChar == -1, select all the text.
- virtual void SetSel(int32_t nStartChar,int32_t nEndChar) = 0;
- //get the selected range of text.
- virtual void GetSel(int32_t & nStartChar, int32_t & nEndChar) const = 0;
- //select all the text.
- virtual void SelectAll() = 0;
- //set text is not selected.
- virtual void SelectNone() = 0;
- //get the caret position.
- virtual int32_t GetCaret() const = 0;
- virtual CPVT_WordPlace GetCaretWordPlace() const = 0;
- //get the string of selected text.
- virtual CFX_WideString GetSelText() const = 0;
- //get the text conent
- virtual CFX_WideString GetText() const = 0;
- //query if any text is selected.
- virtual FX_BOOL IsSelected() const = 0;
- //get the scroll origin
- virtual CPDF_Point GetScrollPos() const = 0;
- //get the bounding box of the text area.
- virtual CPDF_Rect GetPlateRect() const = 0;
- //get the fact area of the text.
- virtual CPDF_Rect GetContentRect() const = 0;
- //get the visible word range
- virtual CPVT_WordRange GetVisibleWordRange() const = 0;
- //get the whole word range
- virtual CPVT_WordRange GetWholeWordRange() const = 0;
- //get the word range of select text
- virtual CPVT_WordRange GetSelectWordRange() const = 0;
-
- //send the mousedown message to edit for response.
- //if Shift key is hold, bShift is TRUE, is Ctrl key is hold, bCtrl is TRUE.
- virtual void OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- //send the mousemove message to edit when mouse down is TRUE.
- virtual void OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- //send the UP key message to edit.
- virtual void OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- //send the DOWN key message to edit.
- virtual void OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- //send the LEFT key message to edit.
- virtual void OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- //send the RIGHT key message to edit.
- virtual void OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- //send the HOME key message to edit.
- virtual void OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- //send the END key message to edit.
- virtual void OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
-
- //put text into edit.
- virtual void SetText(const FX_WCHAR* text,int32_t charset = DEFAULT_CHARSET,
- const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0;
- //insert a word into the edit.
- virtual FX_BOOL InsertWord(FX_WORD word, int32_t charset = DEFAULT_CHARSET, const CPVT_WordProps * pWordProps = NULL) = 0;
- //insert a return into the edit.
- virtual FX_BOOL InsertReturn(const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0;
- //insert text into the edit.
- virtual FX_BOOL InsertText(const FX_WCHAR* text, int32_t charset = DEFAULT_CHARSET,
- const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0;
- //do backspace operation.
- virtual FX_BOOL Backspace() = 0;
- //do delete operation.
- virtual FX_BOOL Delete() = 0;
- //delete the selected text.
- virtual FX_BOOL Clear() = 0;
-
- //do Redo operation.
- virtual FX_BOOL Redo() = 0;
- //do Undo operation.
- virtual FX_BOOL Undo() = 0;
- //move caret
- virtual void SetCaret(int32_t nPos) = 0;
-
- //arrange all words over again
- virtual void Paint() = 0;
-
- //allow to refresh screen?
- virtual void EnableRefresh(FX_BOOL bRefresh) = 0;
-
- virtual void RefreshWordRange(const CPVT_WordRange& wr) = 0;
-
- //allow undo/redo?
- virtual void EnableUndo(FX_BOOL bUndo) = 0;
-
- //allow notify?
- virtual void EnableNotify(FX_BOOL bNotify) = 0;
-
- //allow opr notify?
- virtual void EnableOprNotify(FX_BOOL bNotify) = 0;
-
- //map word place to word index.
- virtual int32_t WordPlaceToWordIndex(const CPVT_WordPlace & place) const = 0;
- //map word index to word place.
- virtual CPVT_WordPlace WordIndexToWordPlace(int32_t index) const = 0;
-
- //get the beginning position of a line
- virtual CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace & place) const = 0;
-
- //get the ending position of a line
- virtual CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace & place) const = 0;
-
- //get the beginning position of a section
- virtual CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace & place) const = 0;
-
- //get the ending position of a section
- virtual CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace & place) const = 0;
-
- //search a wordplace form point
- virtual CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const = 0;
-
- //get the font size of non_rich text or default font size of richtext.
- virtual FX_FLOAT GetFontSize() const = 0;
- //get the mask character.
- virtual FX_WORD GetPasswordChar() const = 0;
- //get the count of charArray
- virtual int32_t GetCharArray() const = 0;
- //get the horizontal scale of all characters
- virtual int32_t GetHorzScale() const = 0;
- //get the space of two characters
- virtual FX_FLOAT GetCharSpace() const = 0;
- //get the latin words of specified range
- virtual CFX_WideString GetRangeText(const CPVT_WordRange & range) const = 0;
- //is the text full in bounding box
- virtual FX_BOOL IsTextFull() const = 0;
- virtual FX_BOOL CanUndo() const = 0;
- virtual FX_BOOL CanRedo() const = 0;
- //if the content is changed after settext?
- virtual FX_BOOL IsModified() const = 0;
- //get the total words in edit
- virtual int32_t GetTotalWords() const = 0;
-
- virtual void AddUndoItem(IFX_Edit_UndoItem* pUndoItem) = 0;
-
- static CFX_ByteString GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset,
- const CPVT_WordRange* pRange = NULL,
- FX_BOOL bContinuous = TRUE, FX_WORD SubWord = 0);
- static CFX_ByteString GetSelectAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange* pRange = NULL);
- static void DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF crTextFill, FX_COLORREF crTextStroke,
- const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, IFX_SystemHandler* pSystemHandler, void* pFFLData);
- static void DrawUnderline(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF color,
- const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange);
- static void DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit,
- const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange);
- static void GeneratePageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,
- const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF crText, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
- static void GenerateRichPageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,
- const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
- static void GenerateUnderlineObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,
- const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF color);
-
-protected:
- ~IFX_Edit() { }
+class IFX_Edit {
+ public:
+ static IFX_Edit* NewEdit();
+ static void DelEdit(IFX_Edit* pEdit);
+
+ // set a IFX_Edit_FontMap pointer implemented by user.
+ virtual void SetFontMap(IFX_Edit_FontMap* pFontMap) = 0;
+ // if user don't like to use FontMap, implement VTProvider and set it
+ // directly.
+ virtual void SetVTProvider(IPDF_VariableText_Provider* pProvider) = 0;
+ // set a IFX_Edit_Notify pointer implemented by user.
+ virtual void SetNotify(IFX_Edit_Notify* pNotify) = 0;
+ virtual void SetOprNotify(IFX_Edit_OprNotify* pOprNotify) = 0;
+ // get a pointer allocated by CPDF_Edit, by this pointer, user can iterate the
+ // contents of edit, but don't need to release.
+ virtual IFX_Edit_Iterator* GetIterator() = 0;
+ // get a VT pointer relative to this edit.
+ virtual IPDF_VariableText* GetVariableText() = 0;
+ // get the IFX_Edit_FontMap pointer set by user.
+ virtual IFX_Edit_FontMap* GetFontMap() = 0;
+
+ // initialize the edit.
+ virtual void Initialize() = 0;
+
+ // set the bounding box of the text area.
+ virtual void SetPlateRect(const CPDF_Rect& rect, FX_BOOL bPaint = TRUE) = 0;
+ // set the scroll origin
+ virtual void SetScrollPos(const CPDF_Point& point) = 0;
+
+ // set the horizontal text alignment in text box, nFormat (0:left 1:middle
+ // 2:right).
+ virtual void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) = 0;
+ // set the vertical text alignment in text box, nFormat (0:top 1:center
+ // 2:bottom).
+ virtual void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) = 0;
+ // if the text is shown in secret , set a character for substitute.
+ virtual void SetPasswordChar(FX_WORD wSubWord = '*',
+ FX_BOOL bPaint = TRUE) = 0;
+ // set the maximal count of words of the text.
+ virtual void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE) = 0;
+ // if set the count of charArray , then all words is shown in equal space.
+ virtual void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE) = 0;
+ // set the space of two characters.
+ virtual void SetCharSpace(FX_FLOAT fCharSpace = 0.0f,
+ FX_BOOL bPaint = TRUE) = 0;
+ // set the horizontal scale of all characters.
+ virtual void SetHorzScale(int32_t nHorzScale = 100,
+ FX_BOOL bPaint = TRUE) = 0;
+ // set the leading of all lines
+ virtual void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE) = 0;
+ // if set, CRLF is allowed.
+ virtual void SetMultiLine(FX_BOOL bMultiLine = TRUE,
+ FX_BOOL bPaint = TRUE) = 0;
+ // if set, all words auto fit the width of the bounding box.
+ virtual void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
+ // if set, a font size is calculated to full fit the bounding box.
+ virtual void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
+ // is set, the text is allowed to scroll.
+ virtual void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
+ // set the font size of all words.
+ virtual void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) = 0;
+ // the text is allowed to auto-scroll, allow the text overflow?
+ virtual void SetTextOverflow(FX_BOOL bAllowed = FALSE,
+ FX_BOOL bPaint = TRUE) = 0;
+
+ // query if the edit is richedit.
+ virtual FX_BOOL IsRichText() const = 0;
+ // set the edit is richedit.
+ virtual void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE) = 0;
+ // set the fontsize of selected text.
+ virtual FX_BOOL SetRichFontSize(FX_FLOAT fFontSize) = 0;
+ // set the fontindex of selected text, user can change the font of selected
+ // text.
+ virtual FX_BOOL SetRichFontIndex(int32_t nFontIndex) = 0;
+ // set the textcolor of selected text.
+ virtual FX_BOOL SetRichTextColor(FX_COLORREF dwColor) = 0;
+ // set the text script type of selected text. (0:normal 1:superscript
+ // 2:subscript)
+ virtual FX_BOOL SetRichTextScript(int32_t nScriptType) = 0;
+ // set the bold font style of selected text.
+ virtual FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE) = 0;
+ // set the italic font style of selected text.
+ virtual FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE) = 0;
+ // set the underline style of selected text.
+ virtual FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE) = 0;
+ // set the crossout style of selected text.
+ virtual FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE) = 0;
+ // set the charspace of selected text, in user coordinate.
+ virtual FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace) = 0;
+ // set the horizontal scale of selected text, default value is 100.
+ virtual FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100) = 0;
+ // set the leading of selected section, in user coordinate.
+ virtual FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading) = 0;
+ // set the indent of selected section, in user coordinate.
+ virtual FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent) = 0;
+ // set the alignment of selected section, nAlignment(0:left 1:middle 2:right)
+ virtual FX_BOOL SetRichTextAlignment(int32_t nAlignment) = 0;
+
+ // set the selected range of text.
+ // if nStartChar == 0 and nEndChar == -1, select all the text.
+ virtual void SetSel(int32_t nStartChar, int32_t nEndChar) = 0;
+ // get the selected range of text.
+ virtual void GetSel(int32_t& nStartChar, int32_t& nEndChar) const = 0;
+ // select all the text.
+ virtual void SelectAll() = 0;
+ // set text is not selected.
+ virtual void SelectNone() = 0;
+ // get the caret position.
+ virtual int32_t GetCaret() const = 0;
+ virtual CPVT_WordPlace GetCaretWordPlace() const = 0;
+ // get the string of selected text.
+ virtual CFX_WideString GetSelText() const = 0;
+ // get the text conent
+ virtual CFX_WideString GetText() const = 0;
+ // query if any text is selected.
+ virtual FX_BOOL IsSelected() const = 0;
+ // get the scroll origin
+ virtual CPDF_Point GetScrollPos() const = 0;
+ // get the bounding box of the text area.
+ virtual CPDF_Rect GetPlateRect() const = 0;
+ // get the fact area of the text.
+ virtual CPDF_Rect GetContentRect() const = 0;
+ // get the visible word range
+ virtual CPVT_WordRange GetVisibleWordRange() const = 0;
+ // get the whole word range
+ virtual CPVT_WordRange GetWholeWordRange() const = 0;
+ // get the word range of select text
+ virtual CPVT_WordRange GetSelectWordRange() const = 0;
+
+ // send the mousedown message to edit for response.
+ // if Shift key is hold, bShift is TRUE, is Ctrl key is hold, bCtrl is TRUE.
+ virtual void OnMouseDown(const CPDF_Point& point,
+ FX_BOOL bShift,
+ FX_BOOL bCtrl) = 0;
+ // send the mousemove message to edit when mouse down is TRUE.
+ virtual void OnMouseMove(const CPDF_Point& point,
+ FX_BOOL bShift,
+ FX_BOOL bCtrl) = 0;
+ // send the UP key message to edit.
+ virtual void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) = 0;
+ // send the DOWN key message to edit.
+ virtual void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) = 0;
+ // send the LEFT key message to edit.
+ virtual void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) = 0;
+ // send the RIGHT key message to edit.
+ virtual void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) = 0;
+ // send the HOME key message to edit.
+ virtual void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) = 0;
+ // send the END key message to edit.
+ virtual void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) = 0;
+
+ // put text into edit.
+ virtual void SetText(const FX_WCHAR* text,
+ int32_t charset = DEFAULT_CHARSET,
+ const CPVT_SecProps* pSecProps = NULL,
+ const CPVT_WordProps* pWordProps = NULL) = 0;
+ // insert a word into the edit.
+ virtual FX_BOOL InsertWord(FX_WORD word,
+ int32_t charset = DEFAULT_CHARSET,
+ const CPVT_WordProps* pWordProps = NULL) = 0;
+ // insert a return into the edit.
+ virtual FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = NULL,
+ const CPVT_WordProps* pWordProps = NULL) = 0;
+ // insert text into the edit.
+ virtual FX_BOOL InsertText(const FX_WCHAR* text,
+ int32_t charset = DEFAULT_CHARSET,
+ const CPVT_SecProps* pSecProps = NULL,
+ const CPVT_WordProps* pWordProps = NULL) = 0;
+ // do backspace operation.
+ virtual FX_BOOL Backspace() = 0;
+ // do delete operation.
+ virtual FX_BOOL Delete() = 0;
+ // delete the selected text.
+ virtual FX_BOOL Clear() = 0;
+
+ // do Redo operation.
+ virtual FX_BOOL Redo() = 0;
+ // do Undo operation.
+ virtual FX_BOOL Undo() = 0;
+ // move caret
+ virtual void SetCaret(int32_t nPos) = 0;
+
+ // arrange all words over again
+ virtual void Paint() = 0;
+
+ // allow to refresh screen?
+ virtual void EnableRefresh(FX_BOOL bRefresh) = 0;
+
+ virtual void RefreshWordRange(const CPVT_WordRange& wr) = 0;
+
+ // allow undo/redo?
+ virtual void EnableUndo(FX_BOOL bUndo) = 0;
+
+ // allow notify?
+ virtual void EnableNotify(FX_BOOL bNotify) = 0;
+
+ // allow opr notify?
+ virtual void EnableOprNotify(FX_BOOL bNotify) = 0;
+
+ // map word place to word index.
+ virtual int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const = 0;
+ // map word index to word place.
+ virtual CPVT_WordPlace WordIndexToWordPlace(int32_t index) const = 0;
+
+ // get the beginning position of a line
+ virtual CPVT_WordPlace GetLineBeginPlace(
+ const CPVT_WordPlace& place) const = 0;
+
+ // get the ending position of a line
+ virtual CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const = 0;
+
+ // get the beginning position of a section
+ virtual CPVT_WordPlace GetSectionBeginPlace(
+ const CPVT_WordPlace& place) const = 0;
+
+ // get the ending position of a section
+ virtual CPVT_WordPlace GetSectionEndPlace(
+ const CPVT_WordPlace& place) const = 0;
+
+ // search a wordplace form point
+ virtual CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const = 0;
+
+ // get the font size of non_rich text or default font size of richtext.
+ virtual FX_FLOAT GetFontSize() const = 0;
+ // get the mask character.
+ virtual FX_WORD GetPasswordChar() const = 0;
+ // get the count of charArray
+ virtual int32_t GetCharArray() const = 0;
+ // get the horizontal scale of all characters
+ virtual int32_t GetHorzScale() const = 0;
+ // get the space of two characters
+ virtual FX_FLOAT GetCharSpace() const = 0;
+ // get the latin words of specified range
+ virtual CFX_WideString GetRangeText(const CPVT_WordRange& range) const = 0;
+ // is the text full in bounding box
+ virtual FX_BOOL IsTextFull() const = 0;
+ virtual FX_BOOL CanUndo() const = 0;
+ virtual FX_BOOL CanRedo() const = 0;
+ // if the content is changed after settext?
+ virtual FX_BOOL IsModified() const = 0;
+ // get the total words in edit
+ virtual int32_t GetTotalWords() const = 0;
+
+ virtual void AddUndoItem(IFX_Edit_UndoItem* pUndoItem) = 0;
+
+ static CFX_ByteString GetEditAppearanceStream(
+ IFX_Edit* pEdit,
+ const CPDF_Point& ptOffset,
+ const CPVT_WordRange* pRange = NULL,
+ FX_BOOL bContinuous = TRUE,
+ FX_WORD SubWord = 0);
+ static CFX_ByteString GetSelectAppearanceStream(
+ IFX_Edit* pEdit,
+ const CPDF_Point& ptOffset,
+ const CPVT_WordRange* pRange = NULL);
+ static void DrawEdit(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ IFX_Edit* pEdit,
+ FX_COLORREF crTextFill,
+ FX_COLORREF crTextStroke,
+ const CPDF_Rect& rcClip,
+ const CPDF_Point& ptOffset,
+ const CPVT_WordRange* pRange,
+ IFX_SystemHandler* pSystemHandler,
+ void* pFFLData);
+ static void DrawUnderline(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ IFX_Edit* pEdit,
+ FX_COLORREF color,
+ const CPDF_Rect& rcClip,
+ const CPDF_Point& ptOffset,
+ const CPVT_WordRange* pRange);
+ static void DrawRichEdit(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ IFX_Edit* pEdit,
+ const CPDF_Rect& rcClip,
+ const CPDF_Point& ptOffset,
+ const CPVT_WordRange* pRange);
+ static void GeneratePageObjects(
+ CPDF_PageObjects* pPageObjects,
+ IFX_Edit* pEdit,
+ const CPDF_Point& ptOffset,
+ const CPVT_WordRange* pRange,
+ FX_COLORREF crText,
+ CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
+ static void GenerateRichPageObjects(
+ CPDF_PageObjects* pPageObjects,
+ IFX_Edit* pEdit,
+ const CPDF_Point& ptOffset,
+ const CPVT_WordRange* pRange,
+ CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
+ static void GenerateUnderlineObjects(CPDF_PageObjects* pPageObjects,
+ IFX_Edit* pEdit,
+ const CPDF_Point& ptOffset,
+ const CPVT_WordRange* pRange,
+ FX_COLORREF color);
+
+ protected:
+ ~IFX_Edit() {}
};
-class IFX_List_Notify
-{
-public:
- virtual ~IFX_List_Notify() { }
- //set the horizontal scrollbar information.
- virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin, FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
- //set the vertical scrollbar information.
- virtual void IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin, FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
- //set the position of horizontal scrollbar.
- virtual void IOnSetScrollPosX(FX_FLOAT fx) = 0;
- //set the position of vertical scrollbar.
- virtual void IOnSetScrollPosY(FX_FLOAT fy) = 0;
- //Invalidate the rectangle relative to the bounding box of edit.
- virtual void IOnInvalidateRect(CPDF_Rect * pRect) = 0;
+class IFX_List_Notify {
+ public:
+ virtual ~IFX_List_Notify() {}
+ // set the horizontal scrollbar information.
+ virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin,
+ FX_FLOAT fPlateMax,
+ FX_FLOAT fContentMin,
+ FX_FLOAT fContentMax,
+ FX_FLOAT fSmallStep,
+ FX_FLOAT fBigStep) = 0;
+ // set the vertical scrollbar information.
+ virtual void IOnSetScrollInfoY(FX_FLOAT fPlateMin,
+ FX_FLOAT fPlateMax,
+ FX_FLOAT fContentMin,
+ FX_FLOAT fContentMax,
+ FX_FLOAT fSmallStep,
+ FX_FLOAT fBigStep) = 0;
+ // set the position of horizontal scrollbar.
+ virtual void IOnSetScrollPosX(FX_FLOAT fx) = 0;
+ // set the position of vertical scrollbar.
+ virtual void IOnSetScrollPosY(FX_FLOAT fy) = 0;
+ // Invalidate the rectangle relative to the bounding box of edit.
+ virtual void IOnInvalidateRect(CPDF_Rect* pRect) = 0;
};
-class IFX_List
-{
-public:
- static IFX_List* NewList();
- static void DelList(IFX_List* pList);
-
- virtual void SetFontMap(IFX_Edit_FontMap * pFontMap) = 0;
- virtual void SetNotify(IFX_List_Notify * pNotify) = 0;
-
- virtual void SetPlateRect(const CPDF_Rect & rect) = 0;
- virtual void SetFontSize(FX_FLOAT fFontSize) = 0;
-
- virtual CPDF_Rect GetPlateRect() const = 0;
- virtual CPDF_Rect GetContentRect() const = 0;
-
- virtual FX_FLOAT GetFontSize() const = 0;
- virtual IFX_Edit* GetItemEdit(int32_t nIndex) const = 0;
- virtual int32_t GetCount() const = 0;
- virtual FX_BOOL IsItemSelected(int32_t nIndex) const = 0;
- virtual FX_FLOAT GetFirstHeight() const = 0;
-
- virtual void SetMultipleSel(FX_BOOL bMultiple) = 0;
- virtual FX_BOOL IsMultipleSel() const = 0;
- virtual FX_BOOL IsValid(int32_t nItemIndex) const = 0;
- virtual int32_t FindNext(int32_t nIndex,FX_WCHAR nChar) const = 0;
-
- virtual void SetScrollPos(const CPDF_Point & point) = 0;
- virtual void ScrollToListItem(int32_t nItemIndex) = 0;
- virtual CPDF_Rect GetItemRect(int32_t nIndex) const = 0;
- virtual int32_t GetCaret() const = 0;
- virtual int32_t GetSelect() const = 0;
- virtual int32_t GetTopItem() const = 0;
- virtual int32_t GetItemIndex(const CPDF_Point & point) const = 0;
- virtual int32_t GetFirstSelected() const = 0;
-
- virtual void AddString(const FX_WCHAR* string) = 0;
- virtual void SetTopItem(int32_t nIndex) = 0;
- virtual void Select(int32_t nItemIndex) = 0;
- virtual void SetCaret(int32_t nItemIndex) = 0;
- virtual void Empty() = 0;
- virtual void Cancel() = 0;
- virtual CFX_WideString GetText() const = 0;
-
-
- virtual void OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- virtual void OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- virtual void OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- virtual void OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- virtual void OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- virtual void OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- virtual void OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- virtual void OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- virtual void OnVK(int32_t nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
- virtual FX_BOOL OnChar(FX_WORD nChar,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
-
-protected:
- ~IFX_List() { }
+class IFX_List {
+ public:
+ static IFX_List* NewList();
+ static void DelList(IFX_List* pList);
+
+ virtual void SetFontMap(IFX_Edit_FontMap* pFontMap) = 0;
+ virtual void SetNotify(IFX_List_Notify* pNotify) = 0;
+
+ virtual void SetPlateRect(const CPDF_Rect& rect) = 0;
+ virtual void SetFontSize(FX_FLOAT fFontSize) = 0;
+
+ virtual CPDF_Rect GetPlateRect() const = 0;
+ virtual CPDF_Rect GetContentRect() const = 0;
+
+ virtual FX_FLOAT GetFontSize() const = 0;
+ virtual IFX_Edit* GetItemEdit(int32_t nIndex) const = 0;
+ virtual int32_t GetCount() const = 0;
+ virtual FX_BOOL IsItemSelected(int32_t nIndex) const = 0;
+ virtual FX_FLOAT GetFirstHeight() const = 0;
+
+ virtual void SetMultipleSel(FX_BOOL bMultiple) = 0;
+ virtual FX_BOOL IsMultipleSel() const = 0;
+ virtual FX_BOOL IsValid(int32_t nItemIndex) const = 0;
+ virtual int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const = 0;
+
+ virtual void SetScrollPos(const CPDF_Point& point) = 0;
+ virtual void ScrollToListItem(int32_t nItemIndex) = 0;
+ virtual CPDF_Rect GetItemRect(int32_t nIndex) const = 0;
+ virtual int32_t GetCaret() const = 0;
+ virtual int32_t GetSelect() const = 0;
+ virtual int32_t GetTopItem() const = 0;
+ virtual int32_t GetItemIndex(const CPDF_Point& point) const = 0;
+ virtual int32_t GetFirstSelected() const = 0;
+
+ virtual void AddString(const FX_WCHAR* string) = 0;
+ virtual void SetTopItem(int32_t nIndex) = 0;
+ virtual void Select(int32_t nItemIndex) = 0;
+ virtual void SetCaret(int32_t nItemIndex) = 0;
+ virtual void Empty() = 0;
+ virtual void Cancel() = 0;
+ virtual CFX_WideString GetText() const = 0;
+
+ virtual void OnMouseDown(const CPDF_Point& point,
+ FX_BOOL bShift,
+ FX_BOOL bCtrl) = 0;
+ virtual void OnMouseMove(const CPDF_Point& point,
+ FX_BOOL bShift,
+ FX_BOOL bCtrl) = 0;
+ virtual void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) = 0;
+ virtual void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) = 0;
+ virtual void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) = 0;
+ virtual void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) = 0;
+ virtual void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) = 0;
+ virtual void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) = 0;
+ virtual void OnVK(int32_t nItemIndex, FX_BOOL bShift, FX_BOOL bCtrl) = 0;
+ virtual FX_BOOL OnChar(FX_WORD nChar, FX_BOOL bShift, FX_BOOL bCtrl) = 0;
+
+ protected:
+ ~IFX_List() {}
};
#endif // FPDFSDK_INCLUDE_FXEDIT_FX_EDIT_H_
diff --git a/fpdfsdk/include/fxedit/fxet_edit.h b/fpdfsdk/include/fxedit/fxet_edit.h
index 7a2742f0ee..d654ebc451 100644
--- a/fpdfsdk/include/fxedit/fxet_edit.h
+++ b/fpdfsdk/include/fxedit/fxet_edit.h
@@ -23,795 +23,801 @@ class CFX_Edit_UndoItem;
class CFX_Edit_Undo;
class CFX_Edit_Provider;
-#define FX_EDIT_IsFloatZero(f) (f < 0.0001 && f > -0.0001)
-#define FX_EDIT_IsFloatEqual(fa,fb) FX_EDIT_IsFloatZero(fa - fb)
-#define FX_EDIT_IsFloatBigger(fa,fb) (fa > fb && !FX_EDIT_IsFloatEqual(fa,fb))
-#define FX_EDIT_IsFloatSmaller(fa,fb) (fa < fb && !FX_EDIT_IsFloatEqual(fa,fb))
+#define FX_EDIT_IsFloatZero(f) (f < 0.0001 && f > -0.0001)
+#define FX_EDIT_IsFloatEqual(fa, fb) FX_EDIT_IsFloatZero(fa - fb)
+#define FX_EDIT_IsFloatBigger(fa, fb) (fa > fb && !FX_EDIT_IsFloatEqual(fa, fb))
+#define FX_EDIT_IsFloatSmaller(fa, fb) \
+ (fa < fb && !FX_EDIT_IsFloatEqual(fa, fb))
+
+template <class T>
+T FX_EDIT_MIN(const T& i, const T& j) {
+ return ((i < j) ? i : j);
+}
+template <class T>
+T FX_EDIT_MAX(const T& i, const T& j) {
+ return ((i > j) ? i : j);
+}
+
+#define FX_EDIT_PI 3.14159265358979f
+#define FX_EDIT_ITALIC_ANGEL 10 * FX_EDIT_PI / 180.0f
-template<class T> T FX_EDIT_MIN (const T & i, const T & j) { return ((i < j) ? i : j); }
-template<class T> T FX_EDIT_MAX (const T & i, const T & j) { return ((i > j) ? i : j); }
+/* ------------------------- CFX_Edit_Refresh ---------------------------- */
-#define FX_EDIT_PI 3.14159265358979f
-#define FX_EDIT_ITALIC_ANGEL 10 * FX_EDIT_PI / 180.0f
+enum REFRESH_PLAN_E { RP_ANALYSE, RP_NOANALYSE, RP_OPTIONAL };
+
+enum EDIT_PROPS_E {
+ EP_LINELEADING,
+ EP_LINEINDENT,
+ EP_ALIGNMENT,
+ EP_FONTINDEX,
+ EP_FONTSIZE,
+ EP_WORDCOLOR,
+ EP_SCRIPTTYPE,
+ EP_UNDERLINE,
+ EP_CROSSOUT,
+ EP_CHARSPACE,
+ EP_HORZSCALE,
+ EP_BOLD,
+ EP_ITALIC
+};
+struct CFX_Edit_LineRect {
+ CFX_Edit_LineRect(const CPVT_WordRange& wrLine, const CPDF_Rect& rcLine)
+ : m_wrLine(wrLine), m_rcLine(rcLine) {}
-/* ------------------------- CFX_Edit_Refresh ---------------------------- */
+ FX_BOOL operator!=(const CFX_Edit_LineRect& linerect) const {
+ return FXSYS_memcmp(this, &linerect, sizeof(CFX_Edit_LineRect)) != 0;
+ }
-enum REFRESH_PLAN_E
-{
- RP_ANALYSE,
- RP_NOANALYSE,
- RP_OPTIONAL
-};
+ FX_BOOL IsSameHeight(const CFX_Edit_LineRect& linerect) const {
+ return FX_EDIT_IsFloatZero(
+ (m_rcLine.top - m_rcLine.bottom) -
+ (linerect.m_rcLine.top - linerect.m_rcLine.bottom));
+ }
-enum EDIT_PROPS_E
-{
- EP_LINELEADING,
- EP_LINEINDENT,
- EP_ALIGNMENT,
- EP_FONTINDEX,
- EP_FONTSIZE,
- EP_WORDCOLOR,
- EP_SCRIPTTYPE,
- EP_UNDERLINE,
- EP_CROSSOUT,
- EP_CHARSPACE,
- EP_HORZSCALE,
- EP_BOLD,
- EP_ITALIC
-};
+ FX_BOOL IsSameTop(const CFX_Edit_LineRect& linerect) const {
+ return FX_EDIT_IsFloatZero(m_rcLine.top - linerect.m_rcLine.top);
+ }
-struct CFX_Edit_LineRect
-{
- CFX_Edit_LineRect(const CPVT_WordRange & wrLine,const CPDF_Rect & rcLine) :
- m_wrLine(wrLine), m_rcLine(rcLine)
- {
- }
-
- FX_BOOL operator != (const CFX_Edit_LineRect & linerect) const
- {
- return FXSYS_memcmp(this, &linerect, sizeof(CFX_Edit_LineRect)) != 0;
- }
-
- FX_BOOL IsSameHeight(const CFX_Edit_LineRect & linerect) const
- {
- return FX_EDIT_IsFloatZero((m_rcLine.top - m_rcLine.bottom) - (linerect.m_rcLine.top -linerect.m_rcLine.bottom));
- }
-
- FX_BOOL IsSameTop(const CFX_Edit_LineRect & linerect) const
- {
- return FX_EDIT_IsFloatZero(m_rcLine.top - linerect.m_rcLine.top);
- }
-
- FX_BOOL IsSameLeft(const CFX_Edit_LineRect & linerect) const
- {
- return FX_EDIT_IsFloatZero(m_rcLine.left - linerect.m_rcLine.left);
- }
-
- FX_BOOL IsSameRight(const CFX_Edit_LineRect & linerect) const
- {
- return FX_EDIT_IsFloatZero(m_rcLine.right - linerect.m_rcLine.right);
- }
-
- CPVT_WordRange m_wrLine;
- CPDF_Rect m_rcLine;
-};
+ FX_BOOL IsSameLeft(const CFX_Edit_LineRect& linerect) const {
+ return FX_EDIT_IsFloatZero(m_rcLine.left - linerect.m_rcLine.left);
+ }
-class CFX_Edit_LineRectArray
-{
-public:
- CFX_Edit_LineRectArray()
- {
- }
-
- virtual ~CFX_Edit_LineRectArray()
- {
- Empty();
- }
-
- void Empty()
- {
- for (int32_t i = 0, sz = m_LineRects.GetSize(); i < sz; i++)
- delete m_LineRects.GetAt(i);
-
- m_LineRects.RemoveAll();
- }
-
- void RemoveAll()
- {
- m_LineRects.RemoveAll();
- }
-
- void operator = (CFX_Edit_LineRectArray & rects)
- {
- Empty();
- for (int32_t i = 0, sz = rects.GetSize(); i < sz; i++)
- m_LineRects.Add(rects.GetAt(i));
-
- rects.RemoveAll();
- }
-
- void Add(const CPVT_WordRange & wrLine,const CPDF_Rect & rcLine)
- {
- if (CFX_Edit_LineRect * pRect = new CFX_Edit_LineRect(wrLine,rcLine))
- m_LineRects.Add(pRect);
- }
-
- int32_t GetSize() const
- {
- return m_LineRects.GetSize();
- }
-
- CFX_Edit_LineRect * GetAt(int32_t nIndex) const
- {
- if (nIndex < 0 || nIndex >= m_LineRects.GetSize())
- return NULL;
-
- return m_LineRects.GetAt(nIndex);
- }
-
- CFX_ArrayTemplate<CFX_Edit_LineRect*> m_LineRects;
-};
+ FX_BOOL IsSameRight(const CFX_Edit_LineRect& linerect) const {
+ return FX_EDIT_IsFloatZero(m_rcLine.right - linerect.m_rcLine.right);
+ }
-class CFX_Edit_RectArray
-{
-public:
- CFX_Edit_RectArray()
- {
- }
-
- virtual ~CFX_Edit_RectArray()
- {
- Empty();
- }
-
- void Empty()
- {
- for (int32_t i = 0, sz = m_Rects.GetSize(); i < sz; i++)
- delete m_Rects.GetAt(i);
-
- m_Rects.RemoveAll();
- }
-
- void Add(const CPDF_Rect & rect)
- {
- //check for overlaped area
- for (int32_t i = 0, sz = m_Rects.GetSize(); i < sz; i++)
- if (CPDF_Rect * pRect = m_Rects.GetAt(i))
- if (pRect->Contains(rect))return;
-
- if (CPDF_Rect * pNewRect = new CPDF_Rect(rect))
- m_Rects.Add(pNewRect);
- }
-
- int32_t GetSize() const
- {
- return m_Rects.GetSize();
- }
-
- CPDF_Rect * GetAt(int32_t nIndex) const
- {
- if (nIndex < 0 || nIndex >= m_Rects.GetSize())
- return NULL;
-
- return m_Rects.GetAt(nIndex);
- }
-
- CFX_ArrayTemplate<CPDF_Rect*> m_Rects;
+ CPVT_WordRange m_wrLine;
+ CPDF_Rect m_rcLine;
};
-class CFX_Edit_Refresh
-{
-public:
- CFX_Edit_Refresh();
- virtual ~CFX_Edit_Refresh();
-
- void BeginRefresh();
- void Push(const CPVT_WordRange & linerange,const CPDF_Rect & rect);
- void NoAnalyse();
- void Analyse(int32_t nAlignment);
- void AddRefresh(const CPDF_Rect & rect);
- const CFX_Edit_RectArray * GetRefreshRects() const;
- void EndRefresh();
-
-private:
- CFX_Edit_LineRectArray m_NewLineRects;
- CFX_Edit_LineRectArray m_OldLineRects;
- CFX_Edit_RectArray m_RefreshRects;
-};
+class CFX_Edit_LineRectArray {
+ public:
+ CFX_Edit_LineRectArray() {}
+ virtual ~CFX_Edit_LineRectArray() { Empty(); }
-/* ------------------------- CFX_Edit_Select ---------------------------- */
+ void Empty() {
+ for (int32_t i = 0, sz = m_LineRects.GetSize(); i < sz; i++)
+ delete m_LineRects.GetAt(i);
+
+ m_LineRects.RemoveAll();
+ }
+
+ void RemoveAll() { m_LineRects.RemoveAll(); }
-class CFX_Edit_Select
-{
-public:
- CFX_Edit_Select()
- {
- }
-
- CFX_Edit_Select(const CPVT_WordPlace & begin,const CPVT_WordPlace & end)
- {
- Set(begin,end);
- }
-
- CFX_Edit_Select(const CPVT_WordRange & range)
- {
- Set(range.BeginPos,range.EndPos);
- }
-
- CPVT_WordRange ConvertToWordRange() const
- {
- return CPVT_WordRange(BeginPos, EndPos);
- }
-
- void Default()
- {
- BeginPos.Default();
- EndPos.Default();
- }
-
- void Set(const CPVT_WordPlace & begin,const CPVT_WordPlace & end)
- {
- BeginPos = begin;
- EndPos = end;
- }
-
- void SetBeginPos(const CPVT_WordPlace & begin)
- {
- BeginPos = begin;
- }
-
- void SetEndPos(const CPVT_WordPlace & end)
- {
- EndPos = end;
- }
-
- FX_BOOL IsExist() const
- {
- return BeginPos != EndPos;
- }
-
- FX_BOOL operator != (const CPVT_WordRange & wr) const
- {
- return wr.BeginPos != BeginPos || wr.EndPos != EndPos;
- }
-
- CPVT_WordPlace BeginPos,EndPos;
+ void operator=(CFX_Edit_LineRectArray& rects) {
+ Empty();
+ for (int32_t i = 0, sz = rects.GetSize(); i < sz; i++)
+ m_LineRects.Add(rects.GetAt(i));
+
+ rects.RemoveAll();
+ }
+
+ void Add(const CPVT_WordRange& wrLine, const CPDF_Rect& rcLine) {
+ if (CFX_Edit_LineRect* pRect = new CFX_Edit_LineRect(wrLine, rcLine))
+ m_LineRects.Add(pRect);
+ }
+
+ int32_t GetSize() const { return m_LineRects.GetSize(); }
+
+ CFX_Edit_LineRect* GetAt(int32_t nIndex) const {
+ if (nIndex < 0 || nIndex >= m_LineRects.GetSize())
+ return NULL;
+
+ return m_LineRects.GetAt(nIndex);
+ }
+
+ CFX_ArrayTemplate<CFX_Edit_LineRect*> m_LineRects;
};
-/* ------------------------- CFX_Edit_Undo ---------------------------- */
+class CFX_Edit_RectArray {
+ public:
+ CFX_Edit_RectArray() {}
-class CFX_Edit_Undo
-{
-public:
- CFX_Edit_Undo(int32_t nBufsize = 10000);
- virtual ~CFX_Edit_Undo();
+ virtual ~CFX_Edit_RectArray() { Empty(); }
- void Undo();
- void Redo();
+ void Empty() {
+ for (int32_t i = 0, sz = m_Rects.GetSize(); i < sz; i++)
+ delete m_Rects.GetAt(i);
- void AddItem(IFX_Edit_UndoItem* pItem);
+ m_Rects.RemoveAll();
+ }
- FX_BOOL CanUndo() const;
- FX_BOOL CanRedo() const;
- FX_BOOL IsModified() const;
- FX_BOOL IsWorking() const;
+ void Add(const CPDF_Rect& rect) {
+ // check for overlaped area
+ for (int32_t i = 0, sz = m_Rects.GetSize(); i < sz; i++)
+ if (CPDF_Rect* pRect = m_Rects.GetAt(i))
+ if (pRect->Contains(rect))
+ return;
- void Reset();
+ if (CPDF_Rect* pNewRect = new CPDF_Rect(rect))
+ m_Rects.Add(pNewRect);
+ }
- IFX_Edit_UndoItem* GetItem(int32_t nIndex);
- int32_t GetItemCount(){return m_UndoItemStack.GetSize();}
- int32_t GetCurUndoPos(){return m_nCurUndoPos;}
+ int32_t GetSize() const { return m_Rects.GetSize(); }
-private:
- void SetBufSize(int32_t nSize){m_nBufSize = nSize;}
- int32_t GetBufSize(){return m_nBufSize;}
+ CPDF_Rect* GetAt(int32_t nIndex) const {
+ if (nIndex < 0 || nIndex >= m_Rects.GetSize())
+ return NULL;
- void RemoveHeads();
- void RemoveTails();
+ return m_Rects.GetAt(nIndex);
+ }
-private:
- CFX_ArrayTemplate<IFX_Edit_UndoItem*> m_UndoItemStack;
+ CFX_ArrayTemplate<CPDF_Rect*> m_Rects;
+};
- int32_t m_nCurUndoPos;
- int32_t m_nBufSize;
- FX_BOOL m_bModified;
- FX_BOOL m_bVirgin;
- FX_BOOL m_bWorking;
+class CFX_Edit_Refresh {
+ public:
+ CFX_Edit_Refresh();
+ virtual ~CFX_Edit_Refresh();
+
+ void BeginRefresh();
+ void Push(const CPVT_WordRange& linerange, const CPDF_Rect& rect);
+ void NoAnalyse();
+ void Analyse(int32_t nAlignment);
+ void AddRefresh(const CPDF_Rect& rect);
+ const CFX_Edit_RectArray* GetRefreshRects() const;
+ void EndRefresh();
+
+ private:
+ CFX_Edit_LineRectArray m_NewLineRects;
+ CFX_Edit_LineRectArray m_OldLineRects;
+ CFX_Edit_RectArray m_RefreshRects;
};
-class CFX_Edit_UndoItem : public IFX_Edit_UndoItem
-{
-public:
- CFX_Edit_UndoItem() : m_bFirst(TRUE), m_bLast(TRUE) {}
+/* ------------------------- CFX_Edit_Select ---------------------------- */
- CFX_WideString GetUndoTitle() override { return L""; }
+class CFX_Edit_Select {
+ public:
+ CFX_Edit_Select() {}
- void SetFirst(FX_BOOL bFirst){m_bFirst = bFirst;}
- FX_BOOL IsFirst(){return m_bFirst;}
- void SetLast(FX_BOOL bLast){m_bLast = bLast;}
- FX_BOOL IsLast(){return m_bLast;}
+ CFX_Edit_Select(const CPVT_WordPlace& begin, const CPVT_WordPlace& end) {
+ Set(begin, end);
+ }
-private:
- FX_BOOL m_bFirst;
- FX_BOOL m_bLast;
-};
+ CFX_Edit_Select(const CPVT_WordRange& range) {
+ Set(range.BeginPos, range.EndPos);
+ }
-class CFX_Edit_GroupUndoItem : public IFX_Edit_UndoItem
-{
-public:
- CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle);
- ~CFX_Edit_GroupUndoItem() override;
+ CPVT_WordRange ConvertToWordRange() const {
+ return CPVT_WordRange(BeginPos, EndPos);
+ }
- void Undo() override;
- void Redo() override;
- CFX_WideString GetUndoTitle() override;
+ void Default() {
+ BeginPos.Default();
+ EndPos.Default();
+ }
- void AddUndoItem(CFX_Edit_UndoItem* pUndoItem);
- void UpdateItems();
+ void Set(const CPVT_WordPlace& begin, const CPVT_WordPlace& end) {
+ BeginPos = begin;
+ EndPos = end;
+ }
-private:
- CFX_WideString m_sTitle;
- CFX_ArrayTemplate<CFX_Edit_UndoItem*> m_Items;
+ void SetBeginPos(const CPVT_WordPlace& begin) { BeginPos = begin; }
+
+ void SetEndPos(const CPVT_WordPlace& end) { EndPos = end; }
+
+ FX_BOOL IsExist() const { return BeginPos != EndPos; }
+
+ FX_BOOL operator!=(const CPVT_WordRange& wr) const {
+ return wr.BeginPos != BeginPos || wr.EndPos != EndPos;
+ }
+
+ CPVT_WordPlace BeginPos, EndPos;
};
-/* ------------------------- CFX_Edit_UndoItem derived classes ---------------------------- */
+/* ------------------------- CFX_Edit_Undo ---------------------------- */
-class CFXEU_InsertWord : public CFX_Edit_UndoItem
-{
-public:
- CFXEU_InsertWord(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
- FX_WORD word, int32_t charset, const CPVT_WordProps * pWordProps);
- virtual ~CFXEU_InsertWord();
+class CFX_Edit_Undo {
+ public:
+ CFX_Edit_Undo(int32_t nBufsize = 10000);
+ virtual ~CFX_Edit_Undo();
- void Redo();
- void Undo();
+ void Undo();
+ void Redo();
-private:
- CFX_Edit* m_pEdit;
+ void AddItem(IFX_Edit_UndoItem* pItem);
- CPVT_WordPlace m_wpOld;
- CPVT_WordPlace m_wpNew;
- FX_WORD m_Word;
- int32_t m_nCharset;
- CPVT_WordProps m_WordProps;
-};
+ FX_BOOL CanUndo() const;
+ FX_BOOL CanRedo() const;
+ FX_BOOL IsModified() const;
+ FX_BOOL IsWorking() const;
-class CFXEU_InsertReturn : public CFX_Edit_UndoItem
-{
-public:
- CFXEU_InsertReturn(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
- const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps);
- virtual ~CFXEU_InsertReturn();
+ void Reset();
- void Redo();
- void Undo();
+ IFX_Edit_UndoItem* GetItem(int32_t nIndex);
+ int32_t GetItemCount() { return m_UndoItemStack.GetSize(); }
+ int32_t GetCurUndoPos() { return m_nCurUndoPos; }
-private:
- CFX_Edit * m_pEdit;
+ private:
+ void SetBufSize(int32_t nSize) { m_nBufSize = nSize; }
+ int32_t GetBufSize() { return m_nBufSize; }
- CPVT_WordPlace m_wpOld;
- CPVT_WordPlace m_wpNew;
- CPVT_SecProps m_SecProps;
- CPVT_WordProps m_WordProps;
-};
+ void RemoveHeads();
+ void RemoveTails();
+
+ private:
+ CFX_ArrayTemplate<IFX_Edit_UndoItem*> m_UndoItemStack;
-class CFXEU_Backspace : public CFX_Edit_UndoItem
-{
-public:
- CFXEU_Backspace(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
- FX_WORD word, int32_t charset,
- const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps);
- virtual ~CFXEU_Backspace();
-
- void Redo();
- void Undo();
-
-private:
- CFX_Edit * m_pEdit;
-
- CPVT_WordPlace m_wpOld;
- CPVT_WordPlace m_wpNew;
- FX_WORD m_Word;
- int32_t m_nCharset;
- CPVT_SecProps m_SecProps;
- CPVT_WordProps m_WordProps;
+ int32_t m_nCurUndoPos;
+ int32_t m_nBufSize;
+ FX_BOOL m_bModified;
+ FX_BOOL m_bVirgin;
+ FX_BOOL m_bWorking;
};
-class CFXEU_Delete : public CFX_Edit_UndoItem
-{
-public:
- CFXEU_Delete(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
- FX_WORD word, int32_t charset,
- const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps, FX_BOOL bSecEnd);
- virtual ~CFXEU_Delete();
-
- void Redo();
- void Undo();
-
-private:
- CFX_Edit * m_pEdit;
-
- CPVT_WordPlace m_wpOld;
- CPVT_WordPlace m_wpNew;
- FX_WORD m_Word;
- int32_t m_nCharset;
- CPVT_SecProps m_SecProps;
- CPVT_WordProps m_WordProps;
- FX_BOOL m_bSecEnd;
+class CFX_Edit_UndoItem : public IFX_Edit_UndoItem {
+ public:
+ CFX_Edit_UndoItem() : m_bFirst(TRUE), m_bLast(TRUE) {}
+
+ CFX_WideString GetUndoTitle() override { return L""; }
+
+ void SetFirst(FX_BOOL bFirst) { m_bFirst = bFirst; }
+ FX_BOOL IsFirst() { return m_bFirst; }
+ void SetLast(FX_BOOL bLast) { m_bLast = bLast; }
+ FX_BOOL IsLast() { return m_bLast; }
+
+ private:
+ FX_BOOL m_bFirst;
+ FX_BOOL m_bLast;
};
-class CFXEU_Clear : public CFX_Edit_UndoItem
-{
-public:
- CFXEU_Clear(CFX_Edit * pEdit, const CPVT_WordRange & wrSel, const CFX_WideString & swText);
- virtual ~CFXEU_Clear();
+class CFX_Edit_GroupUndoItem : public IFX_Edit_UndoItem {
+ public:
+ CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle);
+ ~CFX_Edit_GroupUndoItem() override;
- void Redo();
- void Undo();
+ void Undo() override;
+ void Redo() override;
+ CFX_WideString GetUndoTitle() override;
-private:
- CFX_Edit* m_pEdit;
+ void AddUndoItem(CFX_Edit_UndoItem* pUndoItem);
+ void UpdateItems();
- CPVT_WordRange m_wrSel;
- CFX_WideString m_swText;
+ private:
+ CFX_WideString m_sTitle;
+ CFX_ArrayTemplate<CFX_Edit_UndoItem*> m_Items;
};
-class CFXEU_ClearRich : public CFX_Edit_UndoItem
-{
-public:
- CFXEU_ClearRich(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
- const CPVT_WordRange & wrSel,
- FX_WORD word, int32_t charset,
- const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps);
- virtual ~CFXEU_ClearRich();
-
- void Redo();
- void Undo();
-
-private:
- CFX_Edit * m_pEdit;
-
- CPVT_WordPlace m_wpOld;
- CPVT_WordPlace m_wpNew;
- CPVT_WordRange m_wrSel;
- FX_WORD m_Word;
- int32_t m_nCharset;
- CPVT_SecProps m_SecProps;
- CPVT_WordProps m_WordProps;
+/* ------------------------- CFX_Edit_UndoItem derived classes
+ * ---------------------------- */
+
+class CFXEU_InsertWord : public CFX_Edit_UndoItem {
+ public:
+ CFXEU_InsertWord(CFX_Edit* pEdit,
+ const CPVT_WordPlace& wpOldPlace,
+ const CPVT_WordPlace& wpNewPlace,
+ FX_WORD word,
+ int32_t charset,
+ const CPVT_WordProps* pWordProps);
+ virtual ~CFXEU_InsertWord();
+
+ void Redo();
+ void Undo();
+
+ private:
+ CFX_Edit* m_pEdit;
+
+ CPVT_WordPlace m_wpOld;
+ CPVT_WordPlace m_wpNew;
+ FX_WORD m_Word;
+ int32_t m_nCharset;
+ CPVT_WordProps m_WordProps;
};
-class CFXEU_InsertText : public CFX_Edit_UndoItem
-{
-public:
- CFXEU_InsertText(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
- const CFX_WideString & swText, int32_t charset,
- const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps);
- virtual ~CFXEU_InsertText();
-
- void Redo();
- void Undo();
-
-private:
- CFX_Edit * m_pEdit;
-
- CPVT_WordPlace m_wpOld;
- CPVT_WordPlace m_wpNew;
- CFX_WideString m_swText;
- int32_t m_nCharset;
- CPVT_SecProps m_SecProps;
- CPVT_WordProps m_WordProps;
+class CFXEU_InsertReturn : public CFX_Edit_UndoItem {
+ public:
+ CFXEU_InsertReturn(CFX_Edit* pEdit,
+ const CPVT_WordPlace& wpOldPlace,
+ const CPVT_WordPlace& wpNewPlace,
+ const CPVT_SecProps* pSecProps,
+ const CPVT_WordProps* pWordProps);
+ virtual ~CFXEU_InsertReturn();
+
+ void Redo();
+ void Undo();
+
+ private:
+ CFX_Edit* m_pEdit;
+
+ CPVT_WordPlace m_wpOld;
+ CPVT_WordPlace m_wpNew;
+ CPVT_SecProps m_SecProps;
+ CPVT_WordProps m_WordProps;
};
-class CFXEU_SetSecProps : public CFX_Edit_UndoItem
-{
-public:
- CFXEU_SetSecProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep,
- const CPVT_SecProps & oldsecprops, const CPVT_WordProps & oldwordprops,
- const CPVT_SecProps & newsecprops, const CPVT_WordProps & newwordprops, const CPVT_WordRange & range);
- virtual ~CFXEU_SetSecProps();
-
- void Redo();
- void Undo();
-
-private:
- CFX_Edit * m_pEdit;
- CPVT_WordPlace m_wpPlace;
- CPVT_WordRange m_wrPlace;
- EDIT_PROPS_E m_eProps;
-
- CPVT_SecProps m_OldSecProps;
- CPVT_SecProps m_NewSecProps;
- CPVT_WordProps m_OldWordProps;
- CPVT_WordProps m_NewWordProps;
+class CFXEU_Backspace : public CFX_Edit_UndoItem {
+ public:
+ CFXEU_Backspace(CFX_Edit* pEdit,
+ const CPVT_WordPlace& wpOldPlace,
+ const CPVT_WordPlace& wpNewPlace,
+ FX_WORD word,
+ int32_t charset,
+ const CPVT_SecProps& SecProps,
+ const CPVT_WordProps& WordProps);
+ virtual ~CFXEU_Backspace();
+
+ void Redo();
+ void Undo();
+
+ private:
+ CFX_Edit* m_pEdit;
+
+ CPVT_WordPlace m_wpOld;
+ CPVT_WordPlace m_wpNew;
+ FX_WORD m_Word;
+ int32_t m_nCharset;
+ CPVT_SecProps m_SecProps;
+ CPVT_WordProps m_WordProps;
};
-class CFXEU_SetWordProps : public CFX_Edit_UndoItem
-{
-public:
- CFXEU_SetWordProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep,
- const CPVT_WordProps & oldprops, const CPVT_WordProps & newprops, const CPVT_WordRange & range);
- virtual ~CFXEU_SetWordProps();
+class CFXEU_Delete : public CFX_Edit_UndoItem {
+ public:
+ CFXEU_Delete(CFX_Edit* pEdit,
+ const CPVT_WordPlace& wpOldPlace,
+ const CPVT_WordPlace& wpNewPlace,
+ FX_WORD word,
+ int32_t charset,
+ const CPVT_SecProps& SecProps,
+ const CPVT_WordProps& WordProps,
+ FX_BOOL bSecEnd);
+ virtual ~CFXEU_Delete();
+
+ void Redo();
+ void Undo();
+
+ private:
+ CFX_Edit* m_pEdit;
+
+ CPVT_WordPlace m_wpOld;
+ CPVT_WordPlace m_wpNew;
+ FX_WORD m_Word;
+ int32_t m_nCharset;
+ CPVT_SecProps m_SecProps;
+ CPVT_WordProps m_WordProps;
+ FX_BOOL m_bSecEnd;
+};
+
+class CFXEU_Clear : public CFX_Edit_UndoItem {
+ public:
+ CFXEU_Clear(CFX_Edit* pEdit,
+ const CPVT_WordRange& wrSel,
+ const CFX_WideString& swText);
+ virtual ~CFXEU_Clear();
+
+ void Redo();
+ void Undo();
+
+ private:
+ CFX_Edit* m_pEdit;
+
+ CPVT_WordRange m_wrSel;
+ CFX_WideString m_swText;
+};
- void Redo();
- void Undo();
+class CFXEU_ClearRich : public CFX_Edit_UndoItem {
+ public:
+ CFXEU_ClearRich(CFX_Edit* pEdit,
+ const CPVT_WordPlace& wpOldPlace,
+ const CPVT_WordPlace& wpNewPlace,
+ const CPVT_WordRange& wrSel,
+ FX_WORD word,
+ int32_t charset,
+ const CPVT_SecProps& SecProps,
+ const CPVT_WordProps& WordProps);
+ virtual ~CFXEU_ClearRich();
+
+ void Redo();
+ void Undo();
+
+ private:
+ CFX_Edit* m_pEdit;
+
+ CPVT_WordPlace m_wpOld;
+ CPVT_WordPlace m_wpNew;
+ CPVT_WordRange m_wrSel;
+ FX_WORD m_Word;
+ int32_t m_nCharset;
+ CPVT_SecProps m_SecProps;
+ CPVT_WordProps m_WordProps;
+};
-private:
- CFX_Edit * m_pEdit;
- CPVT_WordPlace m_wpPlace;
- CPVT_WordRange m_wrPlace;
- EDIT_PROPS_E m_eProps;
+class CFXEU_InsertText : public CFX_Edit_UndoItem {
+ public:
+ CFXEU_InsertText(CFX_Edit* pEdit,
+ const CPVT_WordPlace& wpOldPlace,
+ const CPVT_WordPlace& wpNewPlace,
+ const CFX_WideString& swText,
+ int32_t charset,
+ const CPVT_SecProps* pSecProps,
+ const CPVT_WordProps* pWordProps);
+ virtual ~CFXEU_InsertText();
+
+ void Redo();
+ void Undo();
+
+ private:
+ CFX_Edit* m_pEdit;
+
+ CPVT_WordPlace m_wpOld;
+ CPVT_WordPlace m_wpNew;
+ CFX_WideString m_swText;
+ int32_t m_nCharset;
+ CPVT_SecProps m_SecProps;
+ CPVT_WordProps m_WordProps;
+};
+
+class CFXEU_SetSecProps : public CFX_Edit_UndoItem {
+ public:
+ CFXEU_SetSecProps(CFX_Edit* pEdit,
+ const CPVT_WordPlace& place,
+ EDIT_PROPS_E ep,
+ const CPVT_SecProps& oldsecprops,
+ const CPVT_WordProps& oldwordprops,
+ const CPVT_SecProps& newsecprops,
+ const CPVT_WordProps& newwordprops,
+ const CPVT_WordRange& range);
+ virtual ~CFXEU_SetSecProps();
+
+ void Redo();
+ void Undo();
+
+ private:
+ CFX_Edit* m_pEdit;
+ CPVT_WordPlace m_wpPlace;
+ CPVT_WordRange m_wrPlace;
+ EDIT_PROPS_E m_eProps;
+
+ CPVT_SecProps m_OldSecProps;
+ CPVT_SecProps m_NewSecProps;
+ CPVT_WordProps m_OldWordProps;
+ CPVT_WordProps m_NewWordProps;
+};
- CPVT_WordProps m_OldWordProps;
- CPVT_WordProps m_NewWordProps;
+class CFXEU_SetWordProps : public CFX_Edit_UndoItem {
+ public:
+ CFXEU_SetWordProps(CFX_Edit* pEdit,
+ const CPVT_WordPlace& place,
+ EDIT_PROPS_E ep,
+ const CPVT_WordProps& oldprops,
+ const CPVT_WordProps& newprops,
+ const CPVT_WordRange& range);
+ virtual ~CFXEU_SetWordProps();
+
+ void Redo();
+ void Undo();
+
+ private:
+ CFX_Edit* m_pEdit;
+ CPVT_WordPlace m_wpPlace;
+ CPVT_WordRange m_wrPlace;
+ EDIT_PROPS_E m_eProps;
+
+ CPVT_WordProps m_OldWordProps;
+ CPVT_WordProps m_NewWordProps;
};
/* ------------------------- CFX_Edit ---------------------------- */
-class CFX_Edit : public IFX_Edit
-{
- friend class CFX_Edit_Iterator;
- friend class CFXEU_InsertWord;
- friend class CFXEU_InsertReturn;
- friend class CFXEU_Backspace;
- friend class CFXEU_Delete;
- friend class CFXEU_Clear;
- friend class CFXEU_ClearRich;
- friend class CFXEU_SetSecProps;
- friend class CFXEU_SetWordProps;
- friend class CFXEU_InsertText;
-
-public:
- CFX_Edit(IPDF_VariableText * pVT);
- virtual ~CFX_Edit();
-
- void SetFontMap(IFX_Edit_FontMap * pFontMap);
- void SetVTProvider(IPDF_VariableText_Provider* pProvider);
- void SetNotify(IFX_Edit_Notify * pNotify);
- void SetOprNotify(IFX_Edit_OprNotify* pOprNotify);
- IFX_Edit_Iterator* GetIterator();
- IPDF_VariableText * GetVariableText();
- IFX_Edit_FontMap* GetFontMap();
-
- void Initialize();
- void SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint = TRUE);
- void SetScrollPos(const CPDF_Point & point);
-
- void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE);
- void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE);
- void SetPasswordChar(FX_WORD wSubWord = '*', FX_BOOL bPaint = TRUE);
- void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE);
- void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE);
- void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE);
- void SetHorzScale(int32_t nHorzScale = 100, FX_BOOL bPaint = TRUE);
- void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE);
- void SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE);
- void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);
- void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);
- void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);
- void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE);
- void SetTextOverflow(FX_BOOL bAllowed = FALSE, FX_BOOL bPaint = TRUE);
-
- FX_BOOL IsRichText() const;
- void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE);
- FX_BOOL SetRichFontSize(FX_FLOAT fFontSize);
- FX_BOOL SetRichFontIndex(int32_t nFontIndex);
- FX_BOOL SetRichTextColor(FX_COLORREF dwColor);
- FX_BOOL SetRichTextScript(int32_t nScriptType);
- FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE);
- FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE);
- FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE);
- FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE);
- FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace);
- FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100);
- FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading);
- FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent);
- FX_BOOL SetRichTextAlignment(int32_t nAlignment);
-
- void OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl);
- void OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl);
-
- void SetText(const FX_WCHAR* text,int32_t charset = DEFAULT_CHARSET,
- const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL);
- FX_BOOL InsertWord(FX_WORD word, int32_t charset = DEFAULT_CHARSET, const CPVT_WordProps * pWordProps = NULL);
- FX_BOOL InsertReturn(const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL);
- FX_BOOL Backspace();
- FX_BOOL Delete();
- FX_BOOL Clear();
- FX_BOOL Empty();
- FX_BOOL InsertText(const FX_WCHAR* text, int32_t charset = DEFAULT_CHARSET,
- const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL);
- FX_BOOL Redo();
- FX_BOOL Undo();
- CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place, const FX_WCHAR* text, int32_t charset,
- const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps);
- int32_t GetCharSetFromUnicode(FX_WORD word, int32_t nOldCharset);
-
- int32_t WordPlaceToWordIndex(const CPVT_WordPlace & place) const;
- CPVT_WordPlace WordIndexToWordPlace(int32_t index) const;
-
- CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace & place) const;
- CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace & place) const;
- CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace & place) const;
- CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace & place) const;
- CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const;
-
- int32_t GetCaret() const;
- CPVT_WordPlace GetCaretWordPlace() const;
- CFX_WideString GetSelText() const;
- CFX_WideString GetText() const;
- FX_FLOAT GetFontSize() const;
- FX_WORD GetPasswordChar() const;
- CPDF_Point GetScrollPos() const;
- int32_t GetCharArray() const;
- CPDF_Rect GetPlateRect() const;
- CPDF_Rect GetContentRect() const;
- CFX_WideString GetRangeText(const CPVT_WordRange & range) const;
- int32_t GetHorzScale() const;
- FX_FLOAT GetCharSpace() const;
- int32_t GetTotalWords() const;
- int32_t GetTotalLines() const;
-
- void SetSel(int32_t nStartChar,int32_t nEndChar);
- void GetSel(int32_t & nStartChar, int32_t & nEndChar) const;
-
-private:
- void SelectAll();
- void SelectNone();
- void SetSel(const CPVT_WordPlace & begin,const CPVT_WordPlace & end);
- FX_BOOL IsSelected() const;
-
- void RearrangeAll();
- void RearrangePart(const CPVT_WordRange & range);
- void Paint();
- void ScrollToCaret();
- void SetScrollInfo();
- void SetScrollPosX(FX_FLOAT fx);
- void SetScrollPosY(FX_FLOAT fy);
- void SetScrollLimit();
- void SetContentChanged();
- void EnableNotify(FX_BOOL bNotify);
-
- void SetText(const FX_WCHAR* text,int32_t charset,
- const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint);
- FX_BOOL InsertWord(FX_WORD word, int32_t charset, const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint);
- FX_BOOL InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint);
- FX_BOOL Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint);
- FX_BOOL Delete(FX_BOOL bAddUndo, FX_BOOL bPaint);
- FX_BOOL Clear(FX_BOOL bAddUndo, FX_BOOL bPaint);
- FX_BOOL InsertText(const FX_WCHAR* text, int32_t charset,
- const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint);
- FX_BOOL SetRichTextProps(EDIT_PROPS_E eProps,
- const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps);
- FX_BOOL SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place,
- const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps, const CPVT_WordRange & wr, FX_BOOL bAddUndo);
- FX_BOOL SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place,
- const CPVT_WordProps * pWordProps, const CPVT_WordRange & wr, FX_BOOL bAddUndo);
- void PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange & wr);
- void PaintInsertText(const CPVT_WordPlace & wpOld, const CPVT_WordPlace & wpNew);
-
- inline CPDF_Point VTToEdit(const CPDF_Point & point) const;
- inline CPDF_Point EditToVT(const CPDF_Point & point) const;
- inline CPDF_Rect VTToEdit(const CPDF_Rect & rect) const;
- inline CPDF_Rect EditToVT(const CPDF_Rect & rect) const;
-
- void EnableRefresh(FX_BOOL bRefresh);
- void Refresh(REFRESH_PLAN_E ePlan,const CPVT_WordRange * pRange1 = NULL,const CPVT_WordRange * pRange2 = NULL);
- void RefreshPushLineRects(const CPVT_WordRange & wr);
- void RefreshPushRandomRects(const CPVT_WordRange & wr);
- void RefreshWordRange(const CPVT_WordRange& wr);
-
- void SetCaret(int32_t nPos);
- void SetCaret(const CPVT_WordPlace & place);
- void SetCaretInfo();
- void SetCaretOrigin();
- void SetCaretChange();
-
- CPVT_WordRange GetWholeWordRange() const;
- CPVT_WordRange GetVisibleWordRange() const;
- CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace & place) const;
- CPVT_WordRange CombineWordRange(const CPVT_WordRange & wr1, const CPVT_WordRange & wr2);
- CPVT_WordRange GetSelectWordRange() const;
-
- void EnableUndo(FX_BOOL bUndo);
- void EnableOprNotify(FX_BOOL bNotify);
-
- FX_BOOL IsTextFull() const;
- FX_BOOL IsTextOverflow() const;
- FX_BOOL CanUndo() const;
- FX_BOOL CanRedo() const;
- FX_BOOL IsModified() const;
-
- void BeginGroupUndo(const CFX_WideString& sTitle);
- void EndGroupUndo();
- void AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem);
- void AddUndoItem(IFX_Edit_UndoItem* pUndoItem);
-
- void SetPageInfo(const CPVT_WordPlace& place);
- CPVT_WordPlace SearchPageEndPlace(const CPVT_WordPlace& wpPageBegin, const CPDF_Point& point) const;
- FX_FLOAT GetLineTop(const CPVT_WordPlace& place) const;
- FX_FLOAT GetLineBottom(const CPVT_WordPlace& place) const;
-
-private:
- IPDF_VariableText* m_pVT;
- IFX_Edit_Notify* m_pNotify;
- IFX_Edit_OprNotify* m_pOprNotify;
- CFX_Edit_Provider* m_pVTProvide;
-
- CPVT_WordPlace m_wpCaret;
- CPVT_WordPlace m_wpOldCaret;
- CFX_Edit_Select m_SelState;
-
- CPDF_Point m_ptScrollPos;
- CPDF_Point m_ptRefreshScrollPos;
- FX_BOOL m_bEnableScroll;
- IFX_Edit_Iterator * m_pIterator;
- CFX_Edit_Refresh m_Refresh;
- CPDF_Point m_ptCaret;
- CFX_Edit_Undo m_Undo;
- int32_t m_nAlignment;
- FX_BOOL m_bNotifyFlag;
- FX_BOOL m_bEnableOverflow;
- FX_BOOL m_bEnableRefresh;
- CPDF_Rect m_rcOldContent;
- FX_BOOL m_bEnableUndo;
- FX_BOOL m_bNotify;
- FX_BOOL m_bOprNotify;
- CFX_Edit_GroupUndoItem* m_pGroupUndoItem;
+class CFX_Edit : public IFX_Edit {
+ friend class CFX_Edit_Iterator;
+ friend class CFXEU_InsertWord;
+ friend class CFXEU_InsertReturn;
+ friend class CFXEU_Backspace;
+ friend class CFXEU_Delete;
+ friend class CFXEU_Clear;
+ friend class CFXEU_ClearRich;
+ friend class CFXEU_SetSecProps;
+ friend class CFXEU_SetWordProps;
+ friend class CFXEU_InsertText;
+
+ public:
+ CFX_Edit(IPDF_VariableText* pVT);
+ virtual ~CFX_Edit();
+
+ void SetFontMap(IFX_Edit_FontMap* pFontMap);
+ void SetVTProvider(IPDF_VariableText_Provider* pProvider);
+ void SetNotify(IFX_Edit_Notify* pNotify);
+ void SetOprNotify(IFX_Edit_OprNotify* pOprNotify);
+ IFX_Edit_Iterator* GetIterator();
+ IPDF_VariableText* GetVariableText();
+ IFX_Edit_FontMap* GetFontMap();
+
+ void Initialize();
+ void SetPlateRect(const CPDF_Rect& rect, FX_BOOL bPaint = TRUE);
+ void SetScrollPos(const CPDF_Point& point);
+
+ void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE);
+ void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE);
+ void SetPasswordChar(FX_WORD wSubWord = '*', FX_BOOL bPaint = TRUE);
+ void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE);
+ void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE);
+ void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE);
+ void SetHorzScale(int32_t nHorzScale = 100, FX_BOOL bPaint = TRUE);
+ void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE);
+ void SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE);
+ void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);
+ void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);
+ void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);
+ void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE);
+ void SetTextOverflow(FX_BOOL bAllowed = FALSE, FX_BOOL bPaint = TRUE);
+
+ FX_BOOL IsRichText() const;
+ void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE);
+ FX_BOOL SetRichFontSize(FX_FLOAT fFontSize);
+ FX_BOOL SetRichFontIndex(int32_t nFontIndex);
+ FX_BOOL SetRichTextColor(FX_COLORREF dwColor);
+ FX_BOOL SetRichTextScript(int32_t nScriptType);
+ FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE);
+ FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE);
+ FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE);
+ FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE);
+ FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace);
+ FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100);
+ FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading);
+ FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent);
+ FX_BOOL SetRichTextAlignment(int32_t nAlignment);
+
+ void OnMouseDown(const CPDF_Point& point, FX_BOOL bShift, FX_BOOL bCtrl);
+ void OnMouseMove(const CPDF_Point& point, FX_BOOL bShift, FX_BOOL bCtrl);
+ void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl);
+ void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl);
+ void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl);
+ void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl);
+ void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl);
+ void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl);
+
+ void SetText(const FX_WCHAR* text,
+ int32_t charset = DEFAULT_CHARSET,
+ const CPVT_SecProps* pSecProps = NULL,
+ const CPVT_WordProps* pWordProps = NULL);
+ FX_BOOL InsertWord(FX_WORD word,
+ int32_t charset = DEFAULT_CHARSET,
+ const CPVT_WordProps* pWordProps = NULL);
+ FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = NULL,
+ const CPVT_WordProps* pWordProps = NULL);
+ FX_BOOL Backspace();
+ FX_BOOL Delete();
+ FX_BOOL Clear();
+ FX_BOOL Empty();
+ FX_BOOL InsertText(const FX_WCHAR* text,
+ int32_t charset = DEFAULT_CHARSET,
+ const CPVT_SecProps* pSecProps = NULL,
+ const CPVT_WordProps* pWordProps = NULL);
+ FX_BOOL Redo();
+ FX_BOOL Undo();
+ CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place,
+ const FX_WCHAR* text,
+ int32_t charset,
+ const CPVT_SecProps* pSecProps,
+ const CPVT_WordProps* pWordProps);
+ int32_t GetCharSetFromUnicode(FX_WORD word, int32_t nOldCharset);
+
+ int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const;
+ CPVT_WordPlace WordIndexToWordPlace(int32_t index) const;
+
+ CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace& place) const;
+ CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const;
+ CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace& place) const;
+ CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const;
+ CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const;
+
+ int32_t GetCaret() const;
+ CPVT_WordPlace GetCaretWordPlace() const;
+ CFX_WideString GetSelText() const;
+ CFX_WideString GetText() const;
+ FX_FLOAT GetFontSize() const;
+ FX_WORD GetPasswordChar() const;
+ CPDF_Point GetScrollPos() const;
+ int32_t GetCharArray() const;
+ CPDF_Rect GetPlateRect() const;
+ CPDF_Rect GetContentRect() const;
+ CFX_WideString GetRangeText(const CPVT_WordRange& range) const;
+ int32_t GetHorzScale() const;
+ FX_FLOAT GetCharSpace() const;
+ int32_t GetTotalWords() const;
+ int32_t GetTotalLines() const;
+
+ void SetSel(int32_t nStartChar, int32_t nEndChar);
+ void GetSel(int32_t& nStartChar, int32_t& nEndChar) const;
+
+ private:
+ void SelectAll();
+ void SelectNone();
+ void SetSel(const CPVT_WordPlace& begin, const CPVT_WordPlace& end);
+ FX_BOOL IsSelected() const;
+
+ void RearrangeAll();
+ void RearrangePart(const CPVT_WordRange& range);
+ void Paint();
+ void ScrollToCaret();
+ void SetScrollInfo();
+ void SetScrollPosX(FX_FLOAT fx);
+ void SetScrollPosY(FX_FLOAT fy);
+ void SetScrollLimit();
+ void SetContentChanged();
+ void EnableNotify(FX_BOOL bNotify);
+
+ void SetText(const FX_WCHAR* text,
+ int32_t charset,
+ const CPVT_SecProps* pSecProps,
+ const CPVT_WordProps* pWordProps,
+ FX_BOOL bAddUndo,
+ FX_BOOL bPaint);
+ FX_BOOL InsertWord(FX_WORD word,
+ int32_t charset,
+ const CPVT_WordProps* pWordProps,
+ FX_BOOL bAddUndo,
+ FX_BOOL bPaint);
+ FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps,
+ const CPVT_WordProps* pWordProps,
+ FX_BOOL bAddUndo,
+ FX_BOOL bPaint);
+ FX_BOOL Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint);
+ FX_BOOL Delete(FX_BOOL bAddUndo, FX_BOOL bPaint);
+ FX_BOOL Clear(FX_BOOL bAddUndo, FX_BOOL bPaint);
+ FX_BOOL InsertText(const FX_WCHAR* text,
+ int32_t charset,
+ const CPVT_SecProps* pSecProps,
+ const CPVT_WordProps* pWordProps,
+ FX_BOOL bAddUndo,
+ FX_BOOL bPaint);
+ FX_BOOL SetRichTextProps(EDIT_PROPS_E eProps,
+ const CPVT_SecProps* pSecProps,
+ const CPVT_WordProps* pWordProps);
+ FX_BOOL SetSecProps(EDIT_PROPS_E eProps,
+ const CPVT_WordPlace& place,
+ const CPVT_SecProps* pSecProps,
+ const CPVT_WordProps* pWordProps,
+ const CPVT_WordRange& wr,
+ FX_BOOL bAddUndo);
+ FX_BOOL SetWordProps(EDIT_PROPS_E eProps,
+ const CPVT_WordPlace& place,
+ const CPVT_WordProps* pWordProps,
+ const CPVT_WordRange& wr,
+ FX_BOOL bAddUndo);
+ void PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange& wr);
+ void PaintInsertText(const CPVT_WordPlace& wpOld,
+ const CPVT_WordPlace& wpNew);
+
+ inline CPDF_Point VTToEdit(const CPDF_Point& point) const;
+ inline CPDF_Point EditToVT(const CPDF_Point& point) const;
+ inline CPDF_Rect VTToEdit(const CPDF_Rect& rect) const;
+ inline CPDF_Rect EditToVT(const CPDF_Rect& rect) const;
+
+ void EnableRefresh(FX_BOOL bRefresh);
+ void Refresh(REFRESH_PLAN_E ePlan,
+ const CPVT_WordRange* pRange1 = NULL,
+ const CPVT_WordRange* pRange2 = NULL);
+ void RefreshPushLineRects(const CPVT_WordRange& wr);
+ void RefreshPushRandomRects(const CPVT_WordRange& wr);
+ void RefreshWordRange(const CPVT_WordRange& wr);
+
+ void SetCaret(int32_t nPos);
+ void SetCaret(const CPVT_WordPlace& place);
+ void SetCaretInfo();
+ void SetCaretOrigin();
+ void SetCaretChange();
+
+ CPVT_WordRange GetWholeWordRange() const;
+ CPVT_WordRange GetVisibleWordRange() const;
+ CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace& place) const;
+ CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1,
+ const CPVT_WordRange& wr2);
+ CPVT_WordRange GetSelectWordRange() const;
+
+ void EnableUndo(FX_BOOL bUndo);
+ void EnableOprNotify(FX_BOOL bNotify);
+
+ FX_BOOL IsTextFull() const;
+ FX_BOOL IsTextOverflow() const;
+ FX_BOOL CanUndo() const;
+ FX_BOOL CanRedo() const;
+ FX_BOOL IsModified() const;
+
+ void BeginGroupUndo(const CFX_WideString& sTitle);
+ void EndGroupUndo();
+ void AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem);
+ void AddUndoItem(IFX_Edit_UndoItem* pUndoItem);
+
+ void SetPageInfo(const CPVT_WordPlace& place);
+ CPVT_WordPlace SearchPageEndPlace(const CPVT_WordPlace& wpPageBegin,
+ const CPDF_Point& point) const;
+ FX_FLOAT GetLineTop(const CPVT_WordPlace& place) const;
+ FX_FLOAT GetLineBottom(const CPVT_WordPlace& place) const;
+
+ private:
+ IPDF_VariableText* m_pVT;
+ IFX_Edit_Notify* m_pNotify;
+ IFX_Edit_OprNotify* m_pOprNotify;
+ CFX_Edit_Provider* m_pVTProvide;
+
+ CPVT_WordPlace m_wpCaret;
+ CPVT_WordPlace m_wpOldCaret;
+ CFX_Edit_Select m_SelState;
+
+ CPDF_Point m_ptScrollPos;
+ CPDF_Point m_ptRefreshScrollPos;
+ FX_BOOL m_bEnableScroll;
+ IFX_Edit_Iterator* m_pIterator;
+ CFX_Edit_Refresh m_Refresh;
+ CPDF_Point m_ptCaret;
+ CFX_Edit_Undo m_Undo;
+ int32_t m_nAlignment;
+ FX_BOOL m_bNotifyFlag;
+ FX_BOOL m_bEnableOverflow;
+ FX_BOOL m_bEnableRefresh;
+ CPDF_Rect m_rcOldContent;
+ FX_BOOL m_bEnableUndo;
+ FX_BOOL m_bNotify;
+ FX_BOOL m_bOprNotify;
+ CFX_Edit_GroupUndoItem* m_pGroupUndoItem;
};
/* ------------------------- CFX_Edit_Iterator ---------------------------- */
-class CFX_Edit_Iterator : public IFX_Edit_Iterator
-{
-public:
- CFX_Edit_Iterator(CFX_Edit * pEdit,IPDF_VariableText_Iterator * pVTIterator);
- virtual ~CFX_Edit_Iterator();
-
- FX_BOOL NextWord();
- FX_BOOL NextLine();
- FX_BOOL NextSection();
- FX_BOOL PrevWord();
- FX_BOOL PrevLine();
- FX_BOOL PrevSection();
-
- FX_BOOL GetWord(CPVT_Word & word) const;
- FX_BOOL GetLine(CPVT_Line & line) const;
- FX_BOOL GetSection(CPVT_Section & section) const;
- void SetAt(int32_t nWordIndex);
- void SetAt(const CPVT_WordPlace & place);
- const CPVT_WordPlace & GetAt() const;
- IFX_Edit* GetEdit() const;
-
-private:
- CFX_Edit * m_pEdit;
- IPDF_VariableText_Iterator* m_pVTIterator;
+class CFX_Edit_Iterator : public IFX_Edit_Iterator {
+ public:
+ CFX_Edit_Iterator(CFX_Edit* pEdit, IPDF_VariableText_Iterator* pVTIterator);
+ virtual ~CFX_Edit_Iterator();
+
+ FX_BOOL NextWord();
+ FX_BOOL NextLine();
+ FX_BOOL NextSection();
+ FX_BOOL PrevWord();
+ FX_BOOL PrevLine();
+ FX_BOOL PrevSection();
+
+ FX_BOOL GetWord(CPVT_Word& word) const;
+ FX_BOOL GetLine(CPVT_Line& line) const;
+ FX_BOOL GetSection(CPVT_Section& section) const;
+ void SetAt(int32_t nWordIndex);
+ void SetAt(const CPVT_WordPlace& place);
+ const CPVT_WordPlace& GetAt() const;
+ IFX_Edit* GetEdit() const;
+
+ private:
+ CFX_Edit* m_pEdit;
+ IPDF_VariableText_Iterator* m_pVTIterator;
};
-class CFX_Edit_Provider : public IPDF_VariableText_Provider
-{
-public:
- CFX_Edit_Provider(IFX_Edit_FontMap* pFontMap);
- virtual ~CFX_Edit_Provider();
+class CFX_Edit_Provider : public IPDF_VariableText_Provider {
+ public:
+ CFX_Edit_Provider(IFX_Edit_FontMap* pFontMap);
+ virtual ~CFX_Edit_Provider();
- IFX_Edit_FontMap* GetFontMap();
+ IFX_Edit_FontMap* GetFontMap();
- int32_t GetCharWidth(int32_t nFontIndex, FX_WORD word, int32_t nWordStyle);
- int32_t GetTypeAscent(int32_t nFontIndex);
- int32_t GetTypeDescent(int32_t nFontIndex);
- int32_t GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex);
- int32_t GetDefaultFontIndex();
- FX_BOOL IsLatinWord(FX_WORD word);
+ int32_t GetCharWidth(int32_t nFontIndex, FX_WORD word, int32_t nWordStyle);
+ int32_t GetTypeAscent(int32_t nFontIndex);
+ int32_t GetTypeDescent(int32_t nFontIndex);
+ int32_t GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex);
+ int32_t GetDefaultFontIndex();
+ FX_BOOL IsLatinWord(FX_WORD word);
-private:
- IFX_Edit_FontMap* m_pFontMap;
+ private:
+ IFX_Edit_FontMap* m_pFontMap;
};
#endif // FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_
diff --git a/fpdfsdk/include/fxedit/fxet_list.h b/fpdfsdk/include/fxedit/fxet_list.h
index fe75b0fc35..4aa35684cf 100644
--- a/fpdfsdk/include/fxedit/fxet_list.h
+++ b/fpdfsdk/include/fxedit/fxet_list.h
@@ -12,353 +12,337 @@
class IFX_Edit;
-class CLST_Size
-{
-public:
- CLST_Size() : x(0.0f), y(0.0f)
- {
- }
-
- CLST_Size(FX_FLOAT other_x, FX_FLOAT other_y)
- {
- x = other_x;
- y = other_y;
- }
-
- void Default()
- {
- x = 0.0f;
- y = 0.0f;
- }
-
- FX_BOOL operator != (const CLST_Size & size) const
- {
- return FXSYS_memcmp(this, &size, sizeof(CLST_Size)) != 0;
- }
-
- FX_FLOAT x,y;
+class CLST_Size {
+ public:
+ CLST_Size() : x(0.0f), y(0.0f) {}
+
+ CLST_Size(FX_FLOAT other_x, FX_FLOAT other_y) {
+ x = other_x;
+ y = other_y;
+ }
+
+ void Default() {
+ x = 0.0f;
+ y = 0.0f;
+ }
+
+ FX_BOOL operator!=(const CLST_Size& size) const {
+ return FXSYS_memcmp(this, &size, sizeof(CLST_Size)) != 0;
+ }
+
+ FX_FLOAT x, y;
};
-class CLST_Rect : public CPDF_Rect
-{
-public:
- CLST_Rect()
- {
- left = top = right = bottom = 0.0f;
- }
-
- CLST_Rect(FX_FLOAT other_left,
- FX_FLOAT other_top,
- FX_FLOAT other_right,
- FX_FLOAT other_bottom)
- {
- left = other_left;
- top = other_top;
- right = other_right;
- bottom = other_bottom;
- }
-
- CLST_Rect(const CPDF_Rect & rect)
- {
- left = rect.left;
- top = rect.top;
- right = rect.right;
- bottom = rect.bottom;
- }
-
- void Default()
- {
- left = top = right = bottom = 0.0f;
- }
-
- const CLST_Rect operator = (const CPDF_Rect & rect)
- {
- left = rect.left;
- top = rect.top;
- right = rect.right;
- bottom = rect.bottom;
-
- return *this;
- }
-
- FX_BOOL operator == (const CLST_Rect & rect) const
- {
- return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) == 0;
- }
-
- FX_BOOL operator != (const CLST_Rect & rect) const
- {
- return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) != 0;
- }
-
- FX_FLOAT Width() const
- {
- return right - left;
- }
-
- FX_FLOAT Height() const
- {
- if (top > bottom)
- return top - bottom;
- return bottom - top;
- }
-
- CPDF_Point LeftTop() const
- {
- return CPDF_Point(left,top);
- }
-
- CPDF_Point RightBottom() const
- {
- return CPDF_Point(right,bottom);
- }
-
- const CLST_Rect operator += (const CPDF_Point & point)
- {
- left += point.x;
- right += point.x;
- top += point.y;
- bottom += point.y;
-
- return *this;
- }
-
- const CLST_Rect operator -= (const CPDF_Point & point)
- {
- left -= point.x;
- right -= point.x;
- top -= point.y;
- bottom -= point.y;
-
- return *this;
- }
-
- CLST_Rect operator + (const CPDF_Point & point) const
- {
- return CLST_Rect(left + point.x,
- top + point.y,
- right + point.x,
- bottom + point.y);
- }
-
- CLST_Rect operator - (const CPDF_Point & point) const
- {
- return CLST_Rect(left - point.x,
- top - point.y,
- right - point.x,
- bottom - point.y);
- }
+class CLST_Rect : public CPDF_Rect {
+ public:
+ CLST_Rect() { left = top = right = bottom = 0.0f; }
+
+ CLST_Rect(FX_FLOAT other_left,
+ FX_FLOAT other_top,
+ FX_FLOAT other_right,
+ FX_FLOAT other_bottom) {
+ left = other_left;
+ top = other_top;
+ right = other_right;
+ bottom = other_bottom;
+ }
+
+ CLST_Rect(const CPDF_Rect& rect) {
+ left = rect.left;
+ top = rect.top;
+ right = rect.right;
+ bottom = rect.bottom;
+ }
+
+ void Default() { left = top = right = bottom = 0.0f; }
+
+ const CLST_Rect operator=(const CPDF_Rect& rect) {
+ left = rect.left;
+ top = rect.top;
+ right = rect.right;
+ bottom = rect.bottom;
+
+ return *this;
+ }
+
+ FX_BOOL operator==(const CLST_Rect& rect) const {
+ return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) == 0;
+ }
+
+ FX_BOOL operator!=(const CLST_Rect& rect) const {
+ return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) != 0;
+ }
+
+ FX_FLOAT Width() const { return right - left; }
+
+ FX_FLOAT Height() const {
+ if (top > bottom)
+ return top - bottom;
+ return bottom - top;
+ }
+
+ CPDF_Point LeftTop() const { return CPDF_Point(left, top); }
+
+ CPDF_Point RightBottom() const { return CPDF_Point(right, bottom); }
+
+ const CLST_Rect operator+=(const CPDF_Point& point) {
+ left += point.x;
+ right += point.x;
+ top += point.y;
+ bottom += point.y;
+
+ return *this;
+ }
+
+ const CLST_Rect operator-=(const CPDF_Point& point) {
+ left -= point.x;
+ right -= point.x;
+ top -= point.y;
+ bottom -= point.y;
+
+ return *this;
+ }
+
+ CLST_Rect operator+(const CPDF_Point& point) const {
+ return CLST_Rect(left + point.x, top + point.y, right + point.x,
+ bottom + point.y);
+ }
+
+ CLST_Rect operator-(const CPDF_Point& point) const {
+ return CLST_Rect(left - point.x, top - point.y, right - point.x,
+ bottom - point.y);
+ }
};
-class CFX_ListItem
-{
-public:
- CFX_ListItem();
- virtual ~CFX_ListItem();
-
- void SetFontMap(IFX_Edit_FontMap * pFontMap);
- IFX_Edit_Iterator* GetIterator() const;
- IFX_Edit* GetEdit() const;
-
-public:
- void SetRect(const CLST_Rect & rect);
- void SetSelect(FX_BOOL bSelected);
- void SetCaret(FX_BOOL bCaret);
- void SetText(const FX_WCHAR* text);
- void SetFontSize(FX_FLOAT fFontSize);
- CFX_WideString GetText() const;
-
- CLST_Rect GetRect() const;
- FX_BOOL IsSelected() const;
- FX_BOOL IsCaret() const;
- FX_FLOAT GetItemHeight() const;
- FX_WORD GetFirstChar() const;
-
-private:
- IFX_Edit* m_pEdit;
- FX_BOOL m_bSelected;
- FX_BOOL m_bCaret;
- CLST_Rect m_rcListItem;
+class CFX_ListItem {
+ public:
+ CFX_ListItem();
+ virtual ~CFX_ListItem();
+
+ void SetFontMap(IFX_Edit_FontMap* pFontMap);
+ IFX_Edit_Iterator* GetIterator() const;
+ IFX_Edit* GetEdit() const;
+
+ public:
+ void SetRect(const CLST_Rect& rect);
+ void SetSelect(FX_BOOL bSelected);
+ void SetCaret(FX_BOOL bCaret);
+ void SetText(const FX_WCHAR* text);
+ void SetFontSize(FX_FLOAT fFontSize);
+ CFX_WideString GetText() const;
+
+ CLST_Rect GetRect() const;
+ FX_BOOL IsSelected() const;
+ FX_BOOL IsCaret() const;
+ FX_FLOAT GetItemHeight() const;
+ FX_WORD GetFirstChar() const;
+
+ private:
+ IFX_Edit* m_pEdit;
+ FX_BOOL m_bSelected;
+ FX_BOOL m_bCaret;
+ CLST_Rect m_rcListItem;
};
-class CFX_ListContainer
-{
-public:
- CFX_ListContainer() : m_rcPlate(0.0f,0.0f,0.0f,0.0f), m_rcContent(0.0f,0.0f,0.0f,0.0f){}
- virtual ~CFX_ListContainer(){}
- virtual void SetPlateRect(const CPDF_Rect & rect){m_rcPlate = rect;}
- CPDF_Rect GetPlateRect() const{return m_rcPlate;}
- void SetContentRect(const CLST_Rect & rect){m_rcContent = rect;}
- CLST_Rect GetContentRect() const{return m_rcContent;}
- CPDF_Point GetBTPoint() const{return CPDF_Point(m_rcPlate.left,m_rcPlate.top);}
- CPDF_Point GetETPoint() const{return CPDF_Point(m_rcPlate.right,m_rcPlate.bottom);}
-public:
- CPDF_Point InnerToOuter(const CPDF_Point & point) const{return CPDF_Point(point.x + GetBTPoint().x,GetBTPoint().y - point.y);}
- CPDF_Point OuterToInner(const CPDF_Point & point) const{return CPDF_Point(point.x - GetBTPoint().x,GetBTPoint().y - point.y);}
- CPDF_Rect InnerToOuter(const CLST_Rect & rect) const{CPDF_Point ptLeftTop = InnerToOuter(CPDF_Point(rect.left,rect.top));
- CPDF_Point ptRightBottom = InnerToOuter(CPDF_Point(rect.right,rect.bottom));
- return CPDF_Rect(ptLeftTop.x,ptRightBottom.y,ptRightBottom.x,ptLeftTop.y);}
- CLST_Rect OuterToInner(const CPDF_Rect & rect) const{CPDF_Point ptLeftTop = OuterToInner(CPDF_Point(rect.left,rect.top));
- CPDF_Point ptRightBottom = OuterToInner(CPDF_Point(rect.right,rect.bottom));
- return CLST_Rect(ptLeftTop.x,ptLeftTop.y,ptRightBottom.x,ptRightBottom.y);}
-private:
- CPDF_Rect m_rcPlate;
- CLST_Rect m_rcContent; //positive forever!
+class CFX_ListContainer {
+ public:
+ CFX_ListContainer()
+ : m_rcPlate(0.0f, 0.0f, 0.0f, 0.0f),
+ m_rcContent(0.0f, 0.0f, 0.0f, 0.0f) {}
+ virtual ~CFX_ListContainer() {}
+ virtual void SetPlateRect(const CPDF_Rect& rect) { m_rcPlate = rect; }
+ CPDF_Rect GetPlateRect() const { return m_rcPlate; }
+ void SetContentRect(const CLST_Rect& rect) { m_rcContent = rect; }
+ CLST_Rect GetContentRect() const { return m_rcContent; }
+ CPDF_Point GetBTPoint() const {
+ return CPDF_Point(m_rcPlate.left, m_rcPlate.top);
+ }
+ CPDF_Point GetETPoint() const {
+ return CPDF_Point(m_rcPlate.right, m_rcPlate.bottom);
+ }
+
+ public:
+ CPDF_Point InnerToOuter(const CPDF_Point& point) const {
+ return CPDF_Point(point.x + GetBTPoint().x, GetBTPoint().y - point.y);
+ }
+ CPDF_Point OuterToInner(const CPDF_Point& point) const {
+ return CPDF_Point(point.x - GetBTPoint().x, GetBTPoint().y - point.y);
+ }
+ CPDF_Rect InnerToOuter(const CLST_Rect& rect) const {
+ CPDF_Point ptLeftTop = InnerToOuter(CPDF_Point(rect.left, rect.top));
+ CPDF_Point ptRightBottom =
+ InnerToOuter(CPDF_Point(rect.right, rect.bottom));
+ return CPDF_Rect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x,
+ ptLeftTop.y);
+ }
+ CLST_Rect OuterToInner(const CPDF_Rect& rect) const {
+ CPDF_Point ptLeftTop = OuterToInner(CPDF_Point(rect.left, rect.top));
+ CPDF_Point ptRightBottom =
+ OuterToInner(CPDF_Point(rect.right, rect.bottom));
+ return CLST_Rect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x,
+ ptRightBottom.y);
+ }
+
+ private:
+ CPDF_Rect m_rcPlate;
+ CLST_Rect m_rcContent; // positive forever!
};
-template<class TYPE> class CLST_ArrayTemplate : public CFX_ArrayTemplate<TYPE>
-{
-public:
- FX_BOOL IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; }
- TYPE GetAt(int32_t nIndex) const { if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) return CFX_ArrayTemplate<TYPE>::GetAt(nIndex); return NULL;}
- void RemoveAt(int32_t nIndex){if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex);}
+template <class TYPE>
+class CLST_ArrayTemplate : public CFX_ArrayTemplate<TYPE> {
+ public:
+ FX_BOOL IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; }
+ TYPE GetAt(int32_t nIndex) const {
+ if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize())
+ return CFX_ArrayTemplate<TYPE>::GetAt(nIndex);
+ return NULL;
+ }
+ void RemoveAt(int32_t nIndex) {
+ if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize())
+ CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex);
+ }
};
-class CFX_List : protected CFX_ListContainer , public IFX_List
-{
-public:
- CFX_List();
- virtual ~CFX_List();
+class CFX_List : protected CFX_ListContainer, public IFX_List {
+ public:
+ CFX_List();
+ virtual ~CFX_List();
-public:
- virtual void SetFontMap(IFX_Edit_FontMap * pFontMap);
- virtual void SetFontSize(FX_FLOAT fFontSize);
+ public:
+ virtual void SetFontMap(IFX_Edit_FontMap* pFontMap);
+ virtual void SetFontSize(FX_FLOAT fFontSize);
- virtual CPDF_Rect GetPlateRect() const;
- virtual CPDF_Rect GetContentRect() const;
+ virtual CPDF_Rect GetPlateRect() const;
+ virtual CPDF_Rect GetContentRect() const;
- virtual FX_FLOAT GetFontSize() const;
- virtual IFX_Edit* GetItemEdit(int32_t nIndex) const;
- virtual int32_t GetCount() const;
- virtual FX_BOOL IsItemSelected(int32_t nIndex) const;
- virtual FX_FLOAT GetFirstHeight() const;
+ virtual FX_FLOAT GetFontSize() const;
+ virtual IFX_Edit* GetItemEdit(int32_t nIndex) const;
+ virtual int32_t GetCount() const;
+ virtual FX_BOOL IsItemSelected(int32_t nIndex) const;
+ virtual FX_FLOAT GetFirstHeight() const;
- virtual void SetMultipleSel(FX_BOOL bMultiple);
- virtual FX_BOOL IsMultipleSel() const;
- virtual FX_BOOL IsValid(int32_t nItemIndex) const;
- virtual int32_t FindNext(int32_t nIndex,FX_WCHAR nChar) const;
+ virtual void SetMultipleSel(FX_BOOL bMultiple);
+ virtual FX_BOOL IsMultipleSel() const;
+ virtual FX_BOOL IsValid(int32_t nItemIndex) const;
+ virtual int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const;
-protected:
- virtual void Empty();
+ protected:
+ virtual void Empty();
- void AddItem(const FX_WCHAR* str);
- virtual void ReArrange(int32_t nItemIndex);
+ void AddItem(const FX_WCHAR* str);
+ virtual void ReArrange(int32_t nItemIndex);
- virtual CPDF_Rect GetItemRect(int32_t nIndex) const;
- CFX_WideString GetItemText(int32_t nIndex) const;
+ virtual CPDF_Rect GetItemRect(int32_t nIndex) const;
+ CFX_WideString GetItemText(int32_t nIndex) const;
- void SetItemSelect(int32_t nItemIndex, FX_BOOL bSelected);
- void SetItemCaret(int32_t nItemIndex, FX_BOOL bCaret);
+ void SetItemSelect(int32_t nItemIndex, FX_BOOL bSelected);
+ void SetItemCaret(int32_t nItemIndex, FX_BOOL bCaret);
- virtual int32_t GetItemIndex(const CPDF_Point & point) const;
- int32_t GetFirstSelected() const;
- int32_t GetLastSelected() const;
- FX_WCHAR Toupper(FX_WCHAR c) const;
+ virtual int32_t GetItemIndex(const CPDF_Point& point) const;
+ int32_t GetFirstSelected() const;
+ int32_t GetLastSelected() const;
+ FX_WCHAR Toupper(FX_WCHAR c) const;
-private:
- CLST_ArrayTemplate<CFX_ListItem*> m_aListItems;
- FX_FLOAT m_fFontSize;
- IFX_Edit_FontMap* m_pFontMap;
- FX_BOOL m_bMultiple;
+ private:
+ CLST_ArrayTemplate<CFX_ListItem*> m_aListItems;
+ FX_FLOAT m_fFontSize;
+ IFX_Edit_FontMap* m_pFontMap;
+ FX_BOOL m_bMultiple;
};
-struct CPLST_Select_Item
-{
- CPLST_Select_Item(int32_t other_nItemIndex, int32_t other_nState)
- {
- nItemIndex = other_nItemIndex;
- nState = other_nState;
- }
+struct CPLST_Select_Item {
+ CPLST_Select_Item(int32_t other_nItemIndex, int32_t other_nState) {
+ nItemIndex = other_nItemIndex;
+ nState = other_nState;
+ }
- int32_t nItemIndex;
- int32_t nState; //0:normal select -1:to deselect 1: to select
+ int32_t nItemIndex;
+ int32_t nState; // 0:normal select -1:to deselect 1: to select
};
-class CPLST_Select
-{
-public:
- CPLST_Select();
- virtual ~CPLST_Select();
-
-public:
- void Add(int32_t nItemIndex);
- void Add(int32_t nBeginIndex, int32_t nEndIndex);
- void Sub(int32_t nItemIndex);
- void Sub(int32_t nBeginIndex, int32_t nEndIndex);
- FX_BOOL IsExist(int32_t nItemIndex) const;
- int32_t Find(int32_t nItemIndex) const;
- int32_t GetCount() const;
- int32_t GetItemIndex(int32_t nIndex) const;
- int32_t GetState(int32_t nIndex) const;
- void Done();
- void DeselectAll();
-
-private:
- CFX_ArrayTemplate<CPLST_Select_Item*> m_aItems;
+class CPLST_Select {
+ public:
+ CPLST_Select();
+ virtual ~CPLST_Select();
+
+ public:
+ void Add(int32_t nItemIndex);
+ void Add(int32_t nBeginIndex, int32_t nEndIndex);
+ void Sub(int32_t nItemIndex);
+ void Sub(int32_t nBeginIndex, int32_t nEndIndex);
+ FX_BOOL IsExist(int32_t nItemIndex) const;
+ int32_t Find(int32_t nItemIndex) const;
+ int32_t GetCount() const;
+ int32_t GetItemIndex(int32_t nIndex) const;
+ int32_t GetState(int32_t nIndex) const;
+ void Done();
+ void DeselectAll();
+
+ private:
+ CFX_ArrayTemplate<CPLST_Select_Item*> m_aItems;
};
-class CFX_ListCtrl : public CFX_List
-{
-public:
- CFX_ListCtrl();
- virtual ~CFX_ListCtrl();
-
-public:
- void SetNotify(IFX_List_Notify * pNotify);
-
- void OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl);
- void OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl);
- void OnVK(int32_t nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl);
- FX_BOOL OnChar(FX_WORD nChar,FX_BOOL bShift,FX_BOOL bCtrl);
-
- virtual CPDF_Point InToOut(const CPDF_Point & point) const;
- virtual CPDF_Point OutToIn(const CPDF_Point & point) const;
- virtual CPDF_Rect InToOut(const CPDF_Rect & rect) const;
- virtual CPDF_Rect OutToIn(const CPDF_Rect & rect) const;
-
- virtual void SetPlateRect(const CPDF_Rect & rect);
- void SetScrollPos(const CPDF_Point & point);
- void ScrollToListItem(int32_t nItemIndex);
- virtual CPDF_Rect GetItemRect(int32_t nIndex) const;
- int32_t GetCaret() const {return m_nCaretIndex;}
- int32_t GetSelect() const {return m_nSelItem;}
- int32_t GetTopItem() const;
- virtual CPDF_Rect GetContentRect() const;
- virtual int32_t GetItemIndex(const CPDF_Point & point) const;
-
- void AddString(const FX_WCHAR* string);
- void SetTopItem(int32_t nIndex);
- void Select(int32_t nItemIndex);
- virtual void SetCaret(int32_t nItemIndex);
- virtual void Empty();
- virtual void Cancel();
- CFX_WideString GetText() const;
-
-private:
- void SetMultipleSelect(int32_t nItemIndex, FX_BOOL bSelected);
- void SetSingleSelect(int32_t nItemIndex);
- void InvalidateItem(int32_t nItemIndex);
- void SelectItems();
- FX_BOOL IsItemVisible(int32_t nItemIndex) const;
- void SetScrollInfo();
- void SetScrollPosY(FX_FLOAT fy);
- virtual void ReArrange(int32_t nItemIndex);
-
-private:
- IFX_List_Notify* m_pNotify;
- FX_BOOL m_bNotifyFlag;
- CPDF_Point m_ptScrollPos;
- CPLST_Select m_aSelItems; //for multiple
- int32_t m_nSelItem; //for single
- int32_t m_nFootIndex; //for multiple
- FX_BOOL m_bCtrlSel; //for multiple
- int32_t m_nCaretIndex; //for multiple
+class CFX_ListCtrl : public CFX_List {
+ public:
+ CFX_ListCtrl();
+ virtual ~CFX_ListCtrl();
+
+ public:
+ void SetNotify(IFX_List_Notify* pNotify);
+
+ void OnMouseDown(const CPDF_Point& point, FX_BOOL bShift, FX_BOOL bCtrl);
+ void OnMouseMove(const CPDF_Point& point, FX_BOOL bShift, FX_BOOL bCtrl);
+ void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl);
+ void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl);
+ void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl);
+ void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl);
+ void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl);
+ void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl);
+ void OnVK(int32_t nItemIndex, FX_BOOL bShift, FX_BOOL bCtrl);
+ FX_BOOL OnChar(FX_WORD nChar, FX_BOOL bShift, FX_BOOL bCtrl);
+
+ virtual CPDF_Point InToOut(const CPDF_Point& point) const;
+ virtual CPDF_Point OutToIn(const CPDF_Point& point) const;
+ virtual CPDF_Rect InToOut(const CPDF_Rect& rect) const;
+ virtual CPDF_Rect OutToIn(const CPDF_Rect& rect) const;
+
+ virtual void SetPlateRect(const CPDF_Rect& rect);
+ void SetScrollPos(const CPDF_Point& point);
+ void ScrollToListItem(int32_t nItemIndex);
+ virtual CPDF_Rect GetItemRect(int32_t nIndex) const;
+ int32_t GetCaret() const { return m_nCaretIndex; }
+ int32_t GetSelect() const { return m_nSelItem; }
+ int32_t GetTopItem() const;
+ virtual CPDF_Rect GetContentRect() const;
+ virtual int32_t GetItemIndex(const CPDF_Point& point) const;
+
+ void AddString(const FX_WCHAR* string);
+ void SetTopItem(int32_t nIndex);
+ void Select(int32_t nItemIndex);
+ virtual void SetCaret(int32_t nItemIndex);
+ virtual void Empty();
+ virtual void Cancel();
+ CFX_WideString GetText() const;
+
+ private:
+ void SetMultipleSelect(int32_t nItemIndex, FX_BOOL bSelected);
+ void SetSingleSelect(int32_t nItemIndex);
+ void InvalidateItem(int32_t nItemIndex);
+ void SelectItems();
+ FX_BOOL IsItemVisible(int32_t nItemIndex) const;
+ void SetScrollInfo();
+ void SetScrollPosY(FX_FLOAT fy);
+ virtual void ReArrange(int32_t nItemIndex);
+
+ private:
+ IFX_List_Notify* m_pNotify;
+ FX_BOOL m_bNotifyFlag;
+ CPDF_Point m_ptScrollPos;
+ CPLST_Select m_aSelItems; // for multiple
+ int32_t m_nSelItem; // for single
+ int32_t m_nFootIndex; // for multiple
+ FX_BOOL m_bCtrlSel; // for multiple
+ int32_t m_nCaretIndex; // for multiple
};
#endif // FPDFSDK_INCLUDE_FXEDIT_FXET_LIST_H_
diff --git a/fpdfsdk/include/javascript/Consts.h b/fpdfsdk/include/javascript/Consts.h
index d04cc6b54c..c0abe4c7d4 100644
--- a/fpdfsdk/include/javascript/Consts.h
+++ b/fpdfsdk/include/javascript/Consts.h
@@ -11,117 +11,108 @@
/* ------------------------------ border ------------------------------ */
-class CJS_Border : public CJS_Object
-{
-public:
- CJS_Border(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Border(void){};
+class CJS_Border : public CJS_Object {
+ public:
+ CJS_Border(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Border(void){};
- DECLARE_JS_CLASS_CONST();
+ DECLARE_JS_CLASS_CONST();
};
/* ------------------------------ display ------------------------------ */
-class CJS_Display : public CJS_Object
-{
-public:
- CJS_Display(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Display(void){};
+class CJS_Display : public CJS_Object {
+ public:
+ CJS_Display(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Display(void){};
- DECLARE_JS_CLASS_CONST();
+ DECLARE_JS_CLASS_CONST();
};
/* ------------------------------ font ------------------------------ */
-class CJS_Font : public CJS_Object
-{
-public:
- CJS_Font(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Font(void){};
+class CJS_Font : public CJS_Object {
+ public:
+ CJS_Font(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Font(void){};
- DECLARE_JS_CLASS_CONST();
+ DECLARE_JS_CLASS_CONST();
};
/* ------------------------------ highlight ------------------------------ */
-class CJS_Highlight : public CJS_Object
-{
-public:
- CJS_Highlight(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Highlight(void){};
+class CJS_Highlight : public CJS_Object {
+ public:
+ CJS_Highlight(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Highlight(void){};
- DECLARE_JS_CLASS_CONST();
+ DECLARE_JS_CLASS_CONST();
};
/* ------------------------------ position ------------------------------ */
-class CJS_Position : public CJS_Object
-{
-public:
- CJS_Position(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Position(void){};
+class CJS_Position : public CJS_Object {
+ public:
+ CJS_Position(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Position(void){};
- DECLARE_JS_CLASS_CONST();
+ DECLARE_JS_CLASS_CONST();
};
/* ------------------------------ scaleHow ------------------------------ */
-class CJS_ScaleHow : public CJS_Object
-{
-public:
- CJS_ScaleHow(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_ScaleHow(void){};
+class CJS_ScaleHow : public CJS_Object {
+ public:
+ CJS_ScaleHow(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_ScaleHow(void){};
- DECLARE_JS_CLASS_CONST();
+ DECLARE_JS_CLASS_CONST();
};
/* ------------------------------ scaleWhen ------------------------------ */
-class CJS_ScaleWhen : public CJS_Object
-{
-public:
- CJS_ScaleWhen(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_ScaleWhen(void){};
+class CJS_ScaleWhen : public CJS_Object {
+ public:
+ CJS_ScaleWhen(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_ScaleWhen(void){};
- DECLARE_JS_CLASS_CONST();
+ DECLARE_JS_CLASS_CONST();
};
/* ------------------------------ style ------------------------------ */
-class CJS_Style : public CJS_Object
-{
-public:
- CJS_Style(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Style(void){};
+class CJS_Style : public CJS_Object {
+ public:
+ CJS_Style(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Style(void){};
- DECLARE_JS_CLASS_CONST();
+ DECLARE_JS_CLASS_CONST();
};
/* ------------------------------ zoomtype ------------------------------ */
-class CJS_Zoomtype : public CJS_Object
-{
-public:
- CJS_Zoomtype(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Zoomtype(void){};
+class CJS_Zoomtype : public CJS_Object {
+ public:
+ CJS_Zoomtype(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Zoomtype(void){};
- DECLARE_JS_CLASS_CONST();
+ DECLARE_JS_CLASS_CONST();
};
-/* ------------------------------ CJS_GlobalConsts ------------------------------ */
+/* ------------------------------ CJS_GlobalConsts
+ * ------------------------------ */
-class CJS_GlobalConsts : public CJS_Object
-{
-public:
- static int Init(IJS_Runtime* pRuntime);
+class CJS_GlobalConsts : public CJS_Object {
+ public:
+ static int Init(IJS_Runtime* pRuntime);
};
-/* ------------------------------ CJS_GlobalArrays ------------------------------ */
+/* ------------------------------ CJS_GlobalArrays
+ * ------------------------------ */
-class CJS_GlobalArrays : public CJS_Object
-{
-public:
- static int Init(IJS_Runtime* pRuntime);
+class CJS_GlobalArrays : public CJS_Object {
+ public:
+ static int Init(IJS_Runtime* pRuntime);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_CONSTS_H_
diff --git a/fpdfsdk/include/javascript/Document.h b/fpdfsdk/include/javascript/Document.h
index 11642366f4..52a1981b5e 100644
--- a/fpdfsdk/include/javascript/Document.h
+++ b/fpdfsdk/include/javascript/Document.h
@@ -9,267 +9,399 @@
#include "JS_Define.h"
-class PrintParamsObj : public CJS_EmbedObj
-{
-public:
- PrintParamsObj(CJS_Object* pJSObject);
- virtual ~PrintParamsObj(){}
+class PrintParamsObj : public CJS_EmbedObj {
+ public:
+ PrintParamsObj(CJS_Object* pJSObject);
+ virtual ~PrintParamsObj() {}
-public:
- FX_BOOL bUI;
- int nStart;
- int nEnd;
- FX_BOOL bSilent;
- FX_BOOL bShrinkToFit;
- FX_BOOL bPrintAsImage;
- FX_BOOL bReverse;
- FX_BOOL bAnnotations;
+ public:
+ FX_BOOL bUI;
+ int nStart;
+ int nEnd;
+ FX_BOOL bSilent;
+ FX_BOOL bShrinkToFit;
+ FX_BOOL bPrintAsImage;
+ FX_BOOL bReverse;
+ FX_BOOL bAnnotations;
};
-class CJS_PrintParamsObj : public CJS_Object
-{
-public:
- CJS_PrintParamsObj(JSFXObject pObject) : CJS_Object(pObject) {}
- virtual ~CJS_PrintParamsObj(){}
+class CJS_PrintParamsObj : public CJS_Object {
+ public:
+ CJS_PrintParamsObj(JSFXObject pObject) : CJS_Object(pObject) {}
+ virtual ~CJS_PrintParamsObj() {}
- DECLARE_JS_CLASS(CJS_PrintParamsObj);
+ DECLARE_JS_CLASS(CJS_PrintParamsObj);
};
-
class Icon;
class Field;
-struct IconElement
-{
- IconElement() : IconName(L""), NextIcon(NULL), IconStream(NULL) {}
- virtual ~IconElement()
- {
- }
- CFX_WideString IconName;
- IconElement* NextIcon;
- Icon* IconStream;
+struct IconElement {
+ IconElement() : IconName(L""), NextIcon(NULL), IconStream(NULL) {}
+ virtual ~IconElement() {}
+ CFX_WideString IconName;
+ IconElement* NextIcon;
+ Icon* IconStream;
};
-class IconTree
-{
-public:
- IconTree():m_pHead(NULL), m_pEnd(NULL), m_iLength(0)
- {
-
- }
+class IconTree {
+ public:
+ IconTree() : m_pHead(NULL), m_pEnd(NULL), m_iLength(0) {}
- virtual ~IconTree()
- {
- }
+ virtual ~IconTree() {}
-public:
- void InsertIconElement(IconElement* pNewIcon);
- void DeleteIconElement(CFX_WideString swIconName);
- void DeleteIconTree();
- int GetLength();
- IconElement* operator[](int iIndex);
+ public:
+ void InsertIconElement(IconElement* pNewIcon);
+ void DeleteIconElement(CFX_WideString swIconName);
+ void DeleteIconTree();
+ int GetLength();
+ IconElement* operator[](int iIndex);
-private:
- IconElement* m_pHead;
- IconElement* m_pEnd;
- int m_iLength;
+ private:
+ IconElement* m_pHead;
+ IconElement* m_pEnd;
+ int m_iLength;
};
struct CJS_DelayData;
struct CJS_DelayAnnot;
struct CJS_AnnotObj;
-class Document : public CJS_EmbedObj
-{
-public:
- Document(CJS_Object* pJSObject);
- virtual ~Document();
+class Document : public CJS_EmbedObj {
+ public:
+ Document(CJS_Object* pJSObject);
+ virtual ~Document();
-public:
- FX_BOOL ADBE(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL author(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL baseURL(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL bookmarkRoot(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL calculate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL Collab(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL creationDate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL creator(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL dirty(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL documentFileName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL external(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL filesize(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL icons(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL info(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL keywords(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL layout(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL media(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL modDate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL mouseX(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL mouseY(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL numFields(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL numPages(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL pageNum(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL pageWindowRect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL path(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL producer(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL subject(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL title(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL zoom(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL zoomType(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ public:
+ FX_BOOL ADBE(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL author(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL baseURL(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL bookmarkRoot(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL calculate(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL Collab(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL creationDate(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL creator(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL dirty(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL documentFileName(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL external(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL filesize(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL icons(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL info(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL keywords(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL layout(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL media(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL modDate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL mouseX(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL mouseY(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL numFields(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL numPages(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL pageNum(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL pageWindowRect(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL path(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL producer(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL subject(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL title(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL zoom(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL zoomType(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
- FX_BOOL addAnnot(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL addField(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL addLink(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL addIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL calculateNow(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL closeDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL createDataObject(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL deletePages(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL exportAsText(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL exportAsFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL exportAsXFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL extractPages(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getAnnot(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getAnnots(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getAnnot3D(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getAnnots3D(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getField(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getLinks(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getNthFieldName(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getOCGs(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getPageBox(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getPageNthWord(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getPageNthWordQuads(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getPageNumWords(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getPrintParams(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getURL(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL importAnFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL importAnXFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL importTextData(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL insertPages(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL mailForm(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL print(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL removeField(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL replacePages(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL resetForm(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL saveAs(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL submitForm(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL mailDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL removeIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
+ FX_BOOL addAnnot(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL addField(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL addLink(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL addIcon(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL calculateNow(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL closeDoc(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL createDataObject(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL deletePages(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL exportAsText(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL exportAsFDF(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL exportAsXFDF(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL extractPages(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getAnnot(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getAnnots(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getAnnot3D(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getAnnots3D(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getField(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getIcon(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getLinks(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getNthFieldName(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getOCGs(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getPageBox(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getPageNthWord(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getPageNthWordQuads(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getPageNumWords(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getPrintParams(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getURL(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL importAnFDF(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL importAnXFDF(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL importTextData(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL insertPages(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL mailForm(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL print(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL removeField(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL replacePages(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL resetForm(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL saveAs(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL submitForm(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL mailDoc(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL removeIcon(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
-public:
- void AttachDoc(CPDFSDK_Document* pDoc);
- CPDFSDK_Document* GetReaderDoc();
- static FX_BOOL ExtractFileName(CPDFSDK_Document* pDoc, CFX_ByteString& strFileName);
- static FX_BOOL ExtractFolderName(CPDFSDK_Document* pDoc, CFX_ByteString& strFolderName);
- void AddDelayData(CJS_DelayData* pData);
- void DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex);
- void AddDelayAnnotData(CJS_AnnotObj *pData);
- void DoAnnotDelay();
- void SetIsolate(v8::Isolate* isolate) {m_isolate = isolate;}
- CJS_Document* GetCJSDoc() const;
+ public:
+ void AttachDoc(CPDFSDK_Document* pDoc);
+ CPDFSDK_Document* GetReaderDoc();
+ static FX_BOOL ExtractFileName(CPDFSDK_Document* pDoc,
+ CFX_ByteString& strFileName);
+ static FX_BOOL ExtractFolderName(CPDFSDK_Document* pDoc,
+ CFX_ByteString& strFolderName);
+ void AddDelayData(CJS_DelayData* pData);
+ void DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex);
+ void AddDelayAnnotData(CJS_AnnotObj* pData);
+ void DoAnnotDelay();
+ void SetIsolate(v8::Isolate* isolate) { m_isolate = isolate; }
+ CJS_Document* GetCJSDoc() const;
-private:
- CFX_WideString ReversalStr(CFX_WideString cbFrom);
- CFX_WideString CutString(CFX_WideString cbFrom);
- bool IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect);
- int CountWords(CPDF_TextObject* pTextObj);
- CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex);
- FX_BOOL ParserParams(JSObject *pObj,CJS_AnnotObj& annotobj);
+ private:
+ CFX_WideString ReversalStr(CFX_WideString cbFrom);
+ CFX_WideString CutString(CFX_WideString cbFrom);
+ bool IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect);
+ int CountWords(CPDF_TextObject* pTextObj);
+ CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex);
+ FX_BOOL ParserParams(JSObject* pObj, CJS_AnnotObj& annotobj);
- v8::Isolate* m_isolate;
- IconTree* m_pIconTree;
- CPDFSDK_Document* m_pDocument;
- CFX_WideString m_cwBaseURL;
- bool m_bDelay;
- CFX_ArrayTemplate<CJS_DelayData*> m_DelayData;
- CFX_ArrayTemplate<CJS_AnnotObj*> m_DelayAnnotData;
+ v8::Isolate* m_isolate;
+ IconTree* m_pIconTree;
+ CPDFSDK_Document* m_pDocument;
+ CFX_WideString m_cwBaseURL;
+ bool m_bDelay;
+ CFX_ArrayTemplate<CJS_DelayData*> m_DelayData;
+ CFX_ArrayTemplate<CJS_AnnotObj*> m_DelayAnnotData;
};
-class CJS_Document : public CJS_Object
-{
-public:
- CJS_Document(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Document(){};
+class CJS_Document : public CJS_Object {
+ public:
+ CJS_Document(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Document(){};
- virtual FX_BOOL InitInstance(IFXJS_Context* cc);
+ virtual FX_BOOL InitInstance(IFXJS_Context* cc);
- DECLARE_JS_CLASS(CJS_Document);
+ DECLARE_JS_CLASS(CJS_Document);
- JS_STATIC_PROP(ADBE, Document);
- JS_STATIC_PROP(author, Document);
- JS_STATIC_PROP(baseURL, Document);
- JS_STATIC_PROP(bookmarkRoot, Document);
- JS_STATIC_PROP(calculate, Document);
- JS_STATIC_PROP(Collab, Document);
- JS_STATIC_PROP(creationDate, Document);
- JS_STATIC_PROP(creator, Document);
- JS_STATIC_PROP(delay, Document);
- JS_STATIC_PROP(dirty, Document);
- JS_STATIC_PROP(documentFileName, Document);
- JS_STATIC_PROP(external, Document);
- JS_STATIC_PROP(filesize, Document);
- JS_STATIC_PROP(icons, Document);
- JS_STATIC_PROP(info, Document);
- JS_STATIC_PROP(keywords, Document);
- JS_STATIC_PROP(layout, Document);
- JS_STATIC_PROP(media, Document);
- JS_STATIC_PROP(modDate, Document);
- JS_STATIC_PROP(mouseX, Document);
- JS_STATIC_PROP(mouseY, Document);
- JS_STATIC_PROP(numFields, Document);
- JS_STATIC_PROP(numPages, Document);
- JS_STATIC_PROP(pageNum, Document);
- JS_STATIC_PROP(pageWindowRect, Document);
- JS_STATIC_PROP(path, Document);
- JS_STATIC_PROP(producer, Document);
- JS_STATIC_PROP(subject, Document);
- JS_STATIC_PROP(title, Document);
- JS_STATIC_PROP(zoom, Document);
- JS_STATIC_PROP(zoomType, Document);
+ JS_STATIC_PROP(ADBE, Document);
+ JS_STATIC_PROP(author, Document);
+ JS_STATIC_PROP(baseURL, Document);
+ JS_STATIC_PROP(bookmarkRoot, Document);
+ JS_STATIC_PROP(calculate, Document);
+ JS_STATIC_PROP(Collab, Document);
+ JS_STATIC_PROP(creationDate, Document);
+ JS_STATIC_PROP(creator, Document);
+ JS_STATIC_PROP(delay, Document);
+ JS_STATIC_PROP(dirty, Document);
+ JS_STATIC_PROP(documentFileName, Document);
+ JS_STATIC_PROP(external, Document);
+ JS_STATIC_PROP(filesize, Document);
+ JS_STATIC_PROP(icons, Document);
+ JS_STATIC_PROP(info, Document);
+ JS_STATIC_PROP(keywords, Document);
+ JS_STATIC_PROP(layout, Document);
+ JS_STATIC_PROP(media, Document);
+ JS_STATIC_PROP(modDate, Document);
+ JS_STATIC_PROP(mouseX, Document);
+ JS_STATIC_PROP(mouseY, Document);
+ JS_STATIC_PROP(numFields, Document);
+ JS_STATIC_PROP(numPages, Document);
+ JS_STATIC_PROP(pageNum, Document);
+ JS_STATIC_PROP(pageWindowRect, Document);
+ JS_STATIC_PROP(path, Document);
+ JS_STATIC_PROP(producer, Document);
+ JS_STATIC_PROP(subject, Document);
+ JS_STATIC_PROP(title, Document);
+ JS_STATIC_PROP(zoom, Document);
+ JS_STATIC_PROP(zoomType, Document);
- JS_STATIC_METHOD(addAnnot,Document);
- JS_STATIC_METHOD(addField, Document);
- JS_STATIC_METHOD(addLink, Document);
- JS_STATIC_METHOD(addIcon, Document);
- JS_STATIC_METHOD(calculateNow, Document);
- JS_STATIC_METHOD(closeDoc, Document);
- JS_STATIC_METHOD(createDataObject, Document);
- JS_STATIC_METHOD(deletePages, Document);
- JS_STATIC_METHOD(exportAsText, Document);
- JS_STATIC_METHOD(exportAsFDF, Document);
- JS_STATIC_METHOD(exportAsXFDF, Document);
- JS_STATIC_METHOD(extractPages, Document);
- JS_STATIC_METHOD(getAnnot, Document);
- JS_STATIC_METHOD(getAnnots, Document);
- JS_STATIC_METHOD(getAnnot3D, Document);
- JS_STATIC_METHOD(getAnnots3D, Document);
- JS_STATIC_METHOD(getField, Document);
- JS_STATIC_METHOD(getIcon, Document);
- JS_STATIC_METHOD(getLinks, Document);
- JS_STATIC_METHOD(getNthFieldName, Document);
- JS_STATIC_METHOD(getOCGs, Document);
- JS_STATIC_METHOD(getPageBox, Document);
- JS_STATIC_METHOD(getPageNthWord, Document);
- JS_STATIC_METHOD(getPageNthWordQuads, Document);
- JS_STATIC_METHOD(getPageNumWords, Document);
- JS_STATIC_METHOD(getPrintParams, Document);
- JS_STATIC_METHOD(getURL, Document);
- JS_STATIC_METHOD(importAnFDF, Document);
- JS_STATIC_METHOD(importAnXFDF, Document);
- JS_STATIC_METHOD(importTextData, Document);
- JS_STATIC_METHOD(insertPages, Document);
- JS_STATIC_METHOD(mailForm, Document);
- JS_STATIC_METHOD(print, Document);
- JS_STATIC_METHOD(removeField, Document);
- JS_STATIC_METHOD(replacePages, Document);
- JS_STATIC_METHOD(removeIcon, Document);
- JS_STATIC_METHOD(resetForm, Document);
- JS_STATIC_METHOD(saveAs, Document);
- JS_STATIC_METHOD(submitForm, Document);
- JS_STATIC_METHOD(mailDoc, Document);
+ JS_STATIC_METHOD(addAnnot, Document);
+ JS_STATIC_METHOD(addField, Document);
+ JS_STATIC_METHOD(addLink, Document);
+ JS_STATIC_METHOD(addIcon, Document);
+ JS_STATIC_METHOD(calculateNow, Document);
+ JS_STATIC_METHOD(closeDoc, Document);
+ JS_STATIC_METHOD(createDataObject, Document);
+ JS_STATIC_METHOD(deletePages, Document);
+ JS_STATIC_METHOD(exportAsText, Document);
+ JS_STATIC_METHOD(exportAsFDF, Document);
+ JS_STATIC_METHOD(exportAsXFDF, Document);
+ JS_STATIC_METHOD(extractPages, Document);
+ JS_STATIC_METHOD(getAnnot, Document);
+ JS_STATIC_METHOD(getAnnots, Document);
+ JS_STATIC_METHOD(getAnnot3D, Document);
+ JS_STATIC_METHOD(getAnnots3D, Document);
+ JS_STATIC_METHOD(getField, Document);
+ JS_STATIC_METHOD(getIcon, Document);
+ JS_STATIC_METHOD(getLinks, Document);
+ JS_STATIC_METHOD(getNthFieldName, Document);
+ JS_STATIC_METHOD(getOCGs, Document);
+ JS_STATIC_METHOD(getPageBox, Document);
+ JS_STATIC_METHOD(getPageNthWord, Document);
+ JS_STATIC_METHOD(getPageNthWordQuads, Document);
+ JS_STATIC_METHOD(getPageNumWords, Document);
+ JS_STATIC_METHOD(getPrintParams, Document);
+ JS_STATIC_METHOD(getURL, Document);
+ JS_STATIC_METHOD(importAnFDF, Document);
+ JS_STATIC_METHOD(importAnXFDF, Document);
+ JS_STATIC_METHOD(importTextData, Document);
+ JS_STATIC_METHOD(insertPages, Document);
+ JS_STATIC_METHOD(mailForm, Document);
+ JS_STATIC_METHOD(print, Document);
+ JS_STATIC_METHOD(removeField, Document);
+ JS_STATIC_METHOD(replacePages, Document);
+ JS_STATIC_METHOD(removeIcon, Document);
+ JS_STATIC_METHOD(resetForm, Document);
+ JS_STATIC_METHOD(saveAs, Document);
+ JS_STATIC_METHOD(submitForm, Document);
+ JS_STATIC_METHOD(mailDoc, Document);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_DOCUMENT_H_
diff --git a/fpdfsdk/include/javascript/Field.h b/fpdfsdk/include/javascript/Field.h
index 70d1d39b48..afbf783bf2 100644
--- a/fpdfsdk/include/javascript/Field.h
+++ b/fpdfsdk/include/javascript/Field.h
@@ -14,346 +14,611 @@
class Document;
-enum FIELD_PROP
-{
- FP_ALIGNMENT,
- FP_BORDERSTYLE,
- FP_BUTTONALIGNX,
- FP_BUTTONALIGNY,
- FP_BUTTONFITBOUNDS,
- FP_BUTTONPOSITION,
- FP_BUTTONSCALEHOW,
- FP_BUTTONSCALEWHEN,
- FP_CALCORDERINDEX,
- FP_CHARLIMIT,
- FP_COMB,
- FP_COMMITONSELCHANGE,
- FP_CURRENTVALUEINDICES,
- FP_DEFAULTVALUE,
- FP_DONOTSCROLL,
- FP_DISPLAY,
- FP_FILLCOLOR,
- FP_HIDDEN,
- FP_HIGHLIGHT,
- FP_LINEWIDTH,
- FP_MULTILINE,
- FP_MULTIPLESELECTION,
- FP_PASSWORD,
- FP_RECT,
- FP_RICHTEXT,
- FP_RICHVALUE,
- FP_ROTATION,
- FP_STROKECOLOR,
- FP_STYLE,
- FP_TEXTCOLOR,
- FP_TEXTFONT,
- FP_TEXTSIZE,
- FP_USERNAME,
- FP_VALUE
+enum FIELD_PROP {
+ FP_ALIGNMENT,
+ FP_BORDERSTYLE,
+ FP_BUTTONALIGNX,
+ FP_BUTTONALIGNY,
+ FP_BUTTONFITBOUNDS,
+ FP_BUTTONPOSITION,
+ FP_BUTTONSCALEHOW,
+ FP_BUTTONSCALEWHEN,
+ FP_CALCORDERINDEX,
+ FP_CHARLIMIT,
+ FP_COMB,
+ FP_COMMITONSELCHANGE,
+ FP_CURRENTVALUEINDICES,
+ FP_DEFAULTVALUE,
+ FP_DONOTSCROLL,
+ FP_DISPLAY,
+ FP_FILLCOLOR,
+ FP_HIDDEN,
+ FP_HIGHLIGHT,
+ FP_LINEWIDTH,
+ FP_MULTILINE,
+ FP_MULTIPLESELECTION,
+ FP_PASSWORD,
+ FP_RECT,
+ FP_RICHTEXT,
+ FP_RICHVALUE,
+ FP_ROTATION,
+ FP_STROKECOLOR,
+ FP_STYLE,
+ FP_TEXTCOLOR,
+ FP_TEXTFONT,
+ FP_TEXTSIZE,
+ FP_USERNAME,
+ FP_VALUE
};
-class CJS_WideStringArray
-{
-public:
- CJS_WideStringArray(){}
- virtual ~CJS_WideStringArray()
- {
- for (int i=0,sz=m_Data.GetSize(); i<sz; i++)
- delete m_Data.GetAt(i);
- m_Data.RemoveAll();
- }
-
- void Add(const CFX_WideString& string)
- {
- m_Data.Add(new CFX_WideString(string));
- }
-
- int GetSize() const
- {
- return m_Data.GetSize();
- }
-
- CFX_WideString GetAt(int i) const
- {
- return *m_Data.GetAt(i);
- }
-
-private:
- CFX_ArrayTemplate<CFX_WideString*> m_Data;
+class CJS_WideStringArray {
+ public:
+ CJS_WideStringArray() {}
+ virtual ~CJS_WideStringArray() {
+ for (int i = 0, sz = m_Data.GetSize(); i < sz; i++)
+ delete m_Data.GetAt(i);
+ m_Data.RemoveAll();
+ }
+
+ void Add(const CFX_WideString& string) {
+ m_Data.Add(new CFX_WideString(string));
+ }
+
+ int GetSize() const { return m_Data.GetSize(); }
+
+ CFX_WideString GetAt(int i) const { return *m_Data.GetAt(i); }
+
+ private:
+ CFX_ArrayTemplate<CFX_WideString*> m_Data;
};
-struct CJS_DelayData
-{
- CFX_WideString sFieldName;
- int nControlIndex;
- enum FIELD_PROP eProp;
- int32_t num;
- bool b;
- CFX_ByteString string;
- CFX_WideString widestring;
- CPDF_Rect rect;
- CPWL_Color color;
- CFX_DWordArray wordarray;
- CJS_WideStringArray widestringarray;
+struct CJS_DelayData {
+ CFX_WideString sFieldName;
+ int nControlIndex;
+ enum FIELD_PROP eProp;
+ int32_t num;
+ bool b;
+ CFX_ByteString string;
+ CFX_WideString widestring;
+ CPDF_Rect rect;
+ CPWL_Color color;
+ CFX_DWordArray wordarray;
+ CJS_WideStringArray widestringarray;
};
-class Field : public CJS_EmbedObj
-{
-public:
- Field(CJS_Object* pJSObject);
- virtual ~Field(void);
-
- FX_BOOL alignment(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL borderStyle(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL buttonAlignX(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL buttonAlignY(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL buttonFitBounds(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL buttonPosition(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL buttonScaleHow(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL buttonScaleWhen(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL calcOrderIndex(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL charLimit(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL comb(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL commitOnSelChange(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL currentValueIndices(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL defaultStyle(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL defaultValue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL doNotScroll(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL doNotSpellCheck(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL display(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL doc(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL editable(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL exportValues(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL fileSelect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL fillColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL hidden(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL highlight(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL lineWidth(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL multiline(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL multipleSelection(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL numItems(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL page(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL password(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL print(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL radiosInUnison(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL readonly(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL rect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL required(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL richText(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL richValue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL rotation(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL strokeColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL style(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL submitName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL textColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL textFont(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL textSize(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL type(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL userName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL valueAsString(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL source(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
-
- FX_BOOL browseForFileToSubmit(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL buttonGetCaption(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL buttonGetIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL buttonImportIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL buttonSetCaption(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL buttonSetIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL checkThisBox(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL clearItems(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL defaultIsChecked(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL deleteItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getArray(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getLock(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL insertItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL isBoxChecked(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL isDefaultChecked(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL setAction(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL setFocus(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL setItems(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL setLock(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL signatureGetModifications(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL signatureGetSeedValue(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL signatureInfo(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL signatureSetSeedValue(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL signatureSign(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL signatureValidate(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
-
-public:
- static void SetAlignment(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);
- static void SetBorderStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);
- static void SetButtonAlignX(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetButtonAlignY(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetButtonFitBounds(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetButtonPosition(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetButtonScaleHow(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetButtonScaleWhen(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetCalcOrderIndex(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetCharLimit(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetComb(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetCommitOnSelChange(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetCurrentValueIndices(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_DWordArray& array);
- static void SetDefaultStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex);
- static void SetDefaultValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_WideString& string);
- static void SetDoNotScroll(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetDisplay(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetFillColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPWL_Color& color);
- static void SetHidden(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetHighlight(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);
- static void SetLineWidth(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetMultiline(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetMultipleSelection(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetPassword(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetRect(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPDF_Rect& rect);
- static void SetRichText(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetRichValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex);
- static void SetRotation(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetStrokeColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPWL_Color& color);
- static void SetStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);
- static void SetTextColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPWL_Color& color);
- static void SetTextFont(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);
- static void SetTextSize(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetUserName(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_WideString& string);
- static void SetValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CJS_WideStringArray& strArray);
-
-public:
- static void AddField(CPDFSDK_Document* pDocument, int nPageIndex, int nFieldType,
- const CFX_WideString& sName, const CPDF_Rect& rcCoords);
-public:
- static void UpdateFormField(CPDFSDK_Document* pDocument, CPDF_FormField* pFormField,
- FX_BOOL bChangeMark, FX_BOOL bResetAP, FX_BOOL bRefresh);
- static void UpdateFormControl(CPDFSDK_Document* pDocument, CPDF_FormControl* pFormControl,
- FX_BOOL bChangeMark, FX_BOOL bResetAP, FX_BOOL bRefresh);
-
- static CPDFSDK_Widget* GetWidget(CPDFSDK_Document* pDocument, CPDF_FormControl* pFormControl);
- static void GetFormFields(CPDFSDK_Document* pDocument, const CFX_WideString& csFieldName, CFX_PtrArray& FieldsArray);
-
- static void DoDelay(CPDFSDK_Document* pDocument, CJS_DelayData* pData);
-
-public:
- FX_BOOL AttachField(Document* pDocument, const CFX_WideString& csFieldName);
- void SetDelay(FX_BOOL bDelay);
- void SetIsolate(v8::Isolate* isolate) {m_isolate = isolate;}
-protected:
- void ParseFieldName(const std::wstring &strFieldNameParsed,std::wstring &strFieldName,int & iControlNo);
- void GetFormFields(const CFX_WideString& csFieldName, CFX_PtrArray& FieldsArray);
- CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField);
- FX_BOOL ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel);
-
- void AddDelay_Int(enum FIELD_PROP prop, int32_t n);
- void AddDelay_Bool(enum FIELD_PROP prop,bool b);
- void AddDelay_String(enum FIELD_PROP prop, const CFX_ByteString& string);
- void AddDelay_WideString(enum FIELD_PROP prop, const CFX_WideString& string);
- void AddDelay_Rect(enum FIELD_PROP prop, const CPDF_Rect& rect);
- void AddDelay_Color(enum FIELD_PROP prop, const CPWL_Color& color);
- void AddDelay_WordArray(enum FIELD_PROP prop, const CFX_DWordArray& array);
- void AddDelay_WideStringArray(enum FIELD_PROP prop, const CJS_WideStringArray& array);
-
- void DoDelay();
-public:
- Document* m_pJSDoc;
- CPDFSDK_Document* m_pDocument;
- CFX_WideString m_FieldName;
- int m_nFormControlIndex;
- FX_BOOL m_bCanSet;
-
- FX_BOOL m_bDelay;
- v8::Isolate* m_isolate;
+class Field : public CJS_EmbedObj {
+ public:
+ Field(CJS_Object* pJSObject);
+ virtual ~Field(void);
+
+ FX_BOOL alignment(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL borderStyle(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL buttonAlignX(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL buttonAlignY(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL buttonFitBounds(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL buttonPosition(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL buttonScaleHow(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL buttonScaleWhen(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL calcOrderIndex(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL charLimit(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL comb(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL commitOnSelChange(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL currentValueIndices(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL defaultStyle(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL defaultValue(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL doNotScroll(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL doNotSpellCheck(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL display(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL doc(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL editable(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL exportValues(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL fileSelect(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL fillColor(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL hidden(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL highlight(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL lineWidth(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL multiline(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL multipleSelection(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL numItems(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL page(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL password(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL print(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL radiosInUnison(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL readonly(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL rect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL required(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL richText(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL richValue(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL rotation(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL strokeColor(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL style(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL submitName(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL textColor(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL textFont(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL textSize(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL type(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL userName(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL valueAsString(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL source(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+
+ FX_BOOL browseForFileToSubmit(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL buttonGetCaption(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL buttonGetIcon(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL buttonImportIcon(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL buttonSetCaption(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL buttonSetIcon(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL checkThisBox(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL clearItems(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL defaultIsChecked(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL deleteItemAt(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getArray(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getItemAt(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getLock(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL insertItemAt(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL isBoxChecked(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL isDefaultChecked(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL setAction(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL setFocus(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL setItems(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL setLock(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL signatureGetModifications(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL signatureGetSeedValue(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL signatureInfo(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL signatureSetSeedValue(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL signatureSign(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL signatureValidate(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+
+ public:
+ static void SetAlignment(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CFX_ByteString& string);
+ static void SetBorderStyle(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CFX_ByteString& string);
+ static void SetButtonAlignX(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetButtonAlignY(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetButtonFitBounds(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ bool b);
+ static void SetButtonPosition(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetButtonScaleHow(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetButtonScaleWhen(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetCalcOrderIndex(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetCharLimit(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetComb(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ bool b);
+ static void SetCommitOnSelChange(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ bool b);
+ static void SetCurrentValueIndices(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CFX_DWordArray& array);
+ static void SetDefaultStyle(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex);
+ static void SetDefaultValue(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CFX_WideString& string);
+ static void SetDoNotScroll(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ bool b);
+ static void SetDisplay(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetFillColor(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CPWL_Color& color);
+ static void SetHidden(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ bool b);
+ static void SetHighlight(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CFX_ByteString& string);
+ static void SetLineWidth(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetMultiline(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ bool b);
+ static void SetMultipleSelection(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ bool b);
+ static void SetPassword(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ bool b);
+ static void SetRect(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CPDF_Rect& rect);
+ static void SetRichText(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ bool b);
+ static void SetRichValue(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex);
+ static void SetRotation(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetStrokeColor(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CPWL_Color& color);
+ static void SetStyle(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CFX_ByteString& string);
+ static void SetTextColor(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CPWL_Color& color);
+ static void SetTextFont(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CFX_ByteString& string);
+ static void SetTextSize(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetUserName(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CFX_WideString& string);
+ static void SetValue(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CJS_WideStringArray& strArray);
+
+ public:
+ static void AddField(CPDFSDK_Document* pDocument,
+ int nPageIndex,
+ int nFieldType,
+ const CFX_WideString& sName,
+ const CPDF_Rect& rcCoords);
+
+ public:
+ static void UpdateFormField(CPDFSDK_Document* pDocument,
+ CPDF_FormField* pFormField,
+ FX_BOOL bChangeMark,
+ FX_BOOL bResetAP,
+ FX_BOOL bRefresh);
+ static void UpdateFormControl(CPDFSDK_Document* pDocument,
+ CPDF_FormControl* pFormControl,
+ FX_BOOL bChangeMark,
+ FX_BOOL bResetAP,
+ FX_BOOL bRefresh);
+
+ static CPDFSDK_Widget* GetWidget(CPDFSDK_Document* pDocument,
+ CPDF_FormControl* pFormControl);
+ static void GetFormFields(CPDFSDK_Document* pDocument,
+ const CFX_WideString& csFieldName,
+ CFX_PtrArray& FieldsArray);
+
+ static void DoDelay(CPDFSDK_Document* pDocument, CJS_DelayData* pData);
+
+ public:
+ FX_BOOL AttachField(Document* pDocument, const CFX_WideString& csFieldName);
+ void SetDelay(FX_BOOL bDelay);
+ void SetIsolate(v8::Isolate* isolate) { m_isolate = isolate; }
+
+ protected:
+ void ParseFieldName(const std::wstring& strFieldNameParsed,
+ std::wstring& strFieldName,
+ int& iControlNo);
+ void GetFormFields(const CFX_WideString& csFieldName,
+ CFX_PtrArray& FieldsArray);
+ CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField);
+ FX_BOOL ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel);
+
+ void AddDelay_Int(enum FIELD_PROP prop, int32_t n);
+ void AddDelay_Bool(enum FIELD_PROP prop, bool b);
+ void AddDelay_String(enum FIELD_PROP prop, const CFX_ByteString& string);
+ void AddDelay_WideString(enum FIELD_PROP prop, const CFX_WideString& string);
+ void AddDelay_Rect(enum FIELD_PROP prop, const CPDF_Rect& rect);
+ void AddDelay_Color(enum FIELD_PROP prop, const CPWL_Color& color);
+ void AddDelay_WordArray(enum FIELD_PROP prop, const CFX_DWordArray& array);
+ void AddDelay_WideStringArray(enum FIELD_PROP prop,
+ const CJS_WideStringArray& array);
+
+ void DoDelay();
+
+ public:
+ Document* m_pJSDoc;
+ CPDFSDK_Document* m_pDocument;
+ CFX_WideString m_FieldName;
+ int m_nFormControlIndex;
+ FX_BOOL m_bCanSet;
+
+ FX_BOOL m_bDelay;
+ v8::Isolate* m_isolate;
};
-class CJS_Field : public CJS_Object
-{
-public:
- CJS_Field(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Field(void){};
-
- virtual FX_BOOL InitInstance(IFXJS_Context* cc);
-
- DECLARE_JS_CLASS(CJS_Field);
-
- JS_STATIC_PROP(alignment, Field);
- JS_STATIC_PROP(borderStyle, Field);
- JS_STATIC_PROP(buttonAlignX, Field);
- JS_STATIC_PROP(buttonAlignY, Field);
- JS_STATIC_PROP(buttonFitBounds, Field);
- JS_STATIC_PROP(buttonPosition, Field);
- JS_STATIC_PROP(buttonScaleHow, Field);
- JS_STATIC_PROP(buttonScaleWhen, Field);
- JS_STATIC_PROP(calcOrderIndex, Field);
- JS_STATIC_PROP(charLimit, Field);
- JS_STATIC_PROP(comb, Field);
- JS_STATIC_PROP(commitOnSelChange, Field);
- JS_STATIC_PROP(currentValueIndices, Field);
- JS_STATIC_PROP(defaultStyle, Field);
- JS_STATIC_PROP(defaultValue, Field);
- JS_STATIC_PROP(doNotScroll, Field);
- JS_STATIC_PROP(doNotSpellCheck, Field);
- JS_STATIC_PROP(delay, Field);
- JS_STATIC_PROP(display, Field);
- JS_STATIC_PROP(doc, Field);
- JS_STATIC_PROP(editable, Field);
- JS_STATIC_PROP(exportValues, Field);
- JS_STATIC_PROP(fileSelect, Field);
- JS_STATIC_PROP(fillColor, Field);
- JS_STATIC_PROP(hidden, Field);
- JS_STATIC_PROP(highlight, Field);
- JS_STATIC_PROP(lineWidth, Field);
- JS_STATIC_PROP(multiline, Field);
- JS_STATIC_PROP(multipleSelection, Field);
- JS_STATIC_PROP(name, Field);
- JS_STATIC_PROP(numItems, Field);
- JS_STATIC_PROP(page, Field);
- JS_STATIC_PROP(password, Field);
- JS_STATIC_PROP(print, Field);
- JS_STATIC_PROP(radiosInUnison, Field);
- JS_STATIC_PROP(readonly, Field);
- JS_STATIC_PROP(rect, Field);
- JS_STATIC_PROP(required, Field);
- JS_STATIC_PROP(richText, Field);
- JS_STATIC_PROP(richValue, Field);
- JS_STATIC_PROP(rotation, Field);
- JS_STATIC_PROP(strokeColor, Field);
- JS_STATIC_PROP(style, Field);
- JS_STATIC_PROP(submitName, Field);
- JS_STATIC_PROP(textColor, Field);
- JS_STATIC_PROP(textFont, Field);
- JS_STATIC_PROP(textSize, Field);
- JS_STATIC_PROP(type, Field);
- JS_STATIC_PROP(userName, Field);
- JS_STATIC_PROP(value, Field);
- JS_STATIC_PROP(valueAsString, Field);
- JS_STATIC_PROP(source, Field);
-
- JS_STATIC_METHOD(browseForFileToSubmit, Field);
- JS_STATIC_METHOD(buttonGetCaption, Field);
- JS_STATIC_METHOD(buttonGetIcon, Field);
- JS_STATIC_METHOD(buttonImportIcon, Field);
- JS_STATIC_METHOD(buttonSetCaption, Field);
- JS_STATIC_METHOD(buttonSetIcon, Field);
- JS_STATIC_METHOD(checkThisBox, Field);
- JS_STATIC_METHOD(clearItems, Field);
- JS_STATIC_METHOD(defaultIsChecked, Field);
- JS_STATIC_METHOD(deleteItemAt, Field);
- JS_STATIC_METHOD(getArray, Field);
- JS_STATIC_METHOD(getItemAt, Field);
- JS_STATIC_METHOD(getLock, Field);
- JS_STATIC_METHOD(insertItemAt, Field);
- JS_STATIC_METHOD(isBoxChecked, Field);
- JS_STATIC_METHOD(isDefaultChecked, Field);
- JS_STATIC_METHOD(setAction, Field);
- JS_STATIC_METHOD(setFocus, Field);
- JS_STATIC_METHOD(setItems, Field);
- JS_STATIC_METHOD(setLock, Field);
- JS_STATIC_METHOD(signatureGetModifications, Field);
- JS_STATIC_METHOD(signatureGetSeedValue, Field);
- JS_STATIC_METHOD(signatureInfo, Field);
- JS_STATIC_METHOD(signatureSetSeedValue, Field);
- JS_STATIC_METHOD(signatureSign, Field);
- JS_STATIC_METHOD(signatureValidate, Field);
+class CJS_Field : public CJS_Object {
+ public:
+ CJS_Field(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Field(void){};
+
+ virtual FX_BOOL InitInstance(IFXJS_Context* cc);
+
+ DECLARE_JS_CLASS(CJS_Field);
+
+ JS_STATIC_PROP(alignment, Field);
+ JS_STATIC_PROP(borderStyle, Field);
+ JS_STATIC_PROP(buttonAlignX, Field);
+ JS_STATIC_PROP(buttonAlignY, Field);
+ JS_STATIC_PROP(buttonFitBounds, Field);
+ JS_STATIC_PROP(buttonPosition, Field);
+ JS_STATIC_PROP(buttonScaleHow, Field);
+ JS_STATIC_PROP(buttonScaleWhen, Field);
+ JS_STATIC_PROP(calcOrderIndex, Field);
+ JS_STATIC_PROP(charLimit, Field);
+ JS_STATIC_PROP(comb, Field);
+ JS_STATIC_PROP(commitOnSelChange, Field);
+ JS_STATIC_PROP(currentValueIndices, Field);
+ JS_STATIC_PROP(defaultStyle, Field);
+ JS_STATIC_PROP(defaultValue, Field);
+ JS_STATIC_PROP(doNotScroll, Field);
+ JS_STATIC_PROP(doNotSpellCheck, Field);
+ JS_STATIC_PROP(delay, Field);
+ JS_STATIC_PROP(display, Field);
+ JS_STATIC_PROP(doc, Field);
+ JS_STATIC_PROP(editable, Field);
+ JS_STATIC_PROP(exportValues, Field);
+ JS_STATIC_PROP(fileSelect, Field);
+ JS_STATIC_PROP(fillColor, Field);
+ JS_STATIC_PROP(hidden, Field);
+ JS_STATIC_PROP(highlight, Field);
+ JS_STATIC_PROP(lineWidth, Field);
+ JS_STATIC_PROP(multiline, Field);
+ JS_STATIC_PROP(multipleSelection, Field);
+ JS_STATIC_PROP(name, Field);
+ JS_STATIC_PROP(numItems, Field);
+ JS_STATIC_PROP(page, Field);
+ JS_STATIC_PROP(password, Field);
+ JS_STATIC_PROP(print, Field);
+ JS_STATIC_PROP(radiosInUnison, Field);
+ JS_STATIC_PROP(readonly, Field);
+ JS_STATIC_PROP(rect, Field);
+ JS_STATIC_PROP(required, Field);
+ JS_STATIC_PROP(richText, Field);
+ JS_STATIC_PROP(richValue, Field);
+ JS_STATIC_PROP(rotation, Field);
+ JS_STATIC_PROP(strokeColor, Field);
+ JS_STATIC_PROP(style, Field);
+ JS_STATIC_PROP(submitName, Field);
+ JS_STATIC_PROP(textColor, Field);
+ JS_STATIC_PROP(textFont, Field);
+ JS_STATIC_PROP(textSize, Field);
+ JS_STATIC_PROP(type, Field);
+ JS_STATIC_PROP(userName, Field);
+ JS_STATIC_PROP(value, Field);
+ JS_STATIC_PROP(valueAsString, Field);
+ JS_STATIC_PROP(source, Field);
+
+ JS_STATIC_METHOD(browseForFileToSubmit, Field);
+ JS_STATIC_METHOD(buttonGetCaption, Field);
+ JS_STATIC_METHOD(buttonGetIcon, Field);
+ JS_STATIC_METHOD(buttonImportIcon, Field);
+ JS_STATIC_METHOD(buttonSetCaption, Field);
+ JS_STATIC_METHOD(buttonSetIcon, Field);
+ JS_STATIC_METHOD(checkThisBox, Field);
+ JS_STATIC_METHOD(clearItems, Field);
+ JS_STATIC_METHOD(defaultIsChecked, Field);
+ JS_STATIC_METHOD(deleteItemAt, Field);
+ JS_STATIC_METHOD(getArray, Field);
+ JS_STATIC_METHOD(getItemAt, Field);
+ JS_STATIC_METHOD(getLock, Field);
+ JS_STATIC_METHOD(insertItemAt, Field);
+ JS_STATIC_METHOD(isBoxChecked, Field);
+ JS_STATIC_METHOD(isDefaultChecked, Field);
+ JS_STATIC_METHOD(setAction, Field);
+ JS_STATIC_METHOD(setFocus, Field);
+ JS_STATIC_METHOD(setItems, Field);
+ JS_STATIC_METHOD(setLock, Field);
+ JS_STATIC_METHOD(signatureGetModifications, Field);
+ JS_STATIC_METHOD(signatureGetSeedValue, Field);
+ JS_STATIC_METHOD(signatureInfo, Field);
+ JS_STATIC_METHOD(signatureSetSeedValue, Field);
+ JS_STATIC_METHOD(signatureSign, Field);
+ JS_STATIC_METHOD(signatureValidate, Field);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_FIELD_H_
diff --git a/fpdfsdk/include/javascript/IJavaScript.h b/fpdfsdk/include/javascript/IJavaScript.h
index 1d9396fb79..d2cbfb1dd8 100644
--- a/fpdfsdk/include/javascript/IJavaScript.h
+++ b/fpdfsdk/include/javascript/IJavaScript.h
@@ -16,103 +16,161 @@ class CPDF_FormField;
class CPDFSDK_Annot;
class CPDFSDK_Document;
-class IFXJS_Context
-{
-public:
- virtual ~IFXJS_Context() { }
- virtual FX_BOOL Compile(const CFX_WideString& script, CFX_WideString& info) = 0;
- virtual FX_BOOL RunScript(const CFX_WideString& script, CFX_WideString& info) = 0;
-
- virtual void OnApp_Init() = 0;
-
- virtual void OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName) = 0;
- virtual void OnDoc_WillPrint(CPDFSDK_Document* pDoc) = 0;
- virtual void OnDoc_DidPrint(CPDFSDK_Document* pDoc) = 0;
- virtual void OnDoc_WillSave(CPDFSDK_Document* pDoc) = 0;
- virtual void OnDoc_DidSave(CPDFSDK_Document* pDoc) = 0;
- virtual void OnDoc_WillClose(CPDFSDK_Document* pDoc) = 0;
-
- virtual void OnPage_Open(CPDFSDK_Document* pTarget) = 0;
- virtual void OnPage_Close(CPDFSDK_Document* pTarget) = 0;
- virtual void OnPage_InView(CPDFSDK_Document* pTarget) = 0;
- virtual void OnPage_OutView(CPDFSDK_Document* pTarget) = 0;
-
- virtual void OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0;
- virtual void OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0;
- virtual void OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0;
- virtual void OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0;
- virtual void OnField_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) = 0;
- virtual void OnField_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) = 0;
-
- virtual void OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc) = 0;
- virtual void OnField_Format(CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit) = 0;
- virtual void OnField_Keystroke(CFX_WideString& strChange, const CFX_WideString& strChangeEx,
- FX_BOOL KeyDown, FX_BOOL bModifier, int &nSelEnd,int &nSelStart, FX_BOOL bShift,
- CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit,
- FX_BOOL bFieldFull, FX_BOOL &bRc) = 0;
- virtual void OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown,
- FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc) = 0;
-
- virtual void OnScreen_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_Close(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_InView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
-
- virtual void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) = 0;
- virtual void OnLink_MouseUp(CPDFSDK_Document* pTarget) = 0;
-
- virtual void OnMenu_Exec(CPDFSDK_Document* pTarget, const CFX_WideString &) = 0;
- virtual void OnBatchExec(CPDFSDK_Document* pTarget) = 0;
- virtual void OnConsole_Exec() = 0;
- virtual void OnExternal_Exec() = 0;
-
- virtual void EnableMessageBox(FX_BOOL bEnable) = 0;
+class IFXJS_Context {
+ public:
+ virtual ~IFXJS_Context() {}
+ virtual FX_BOOL Compile(const CFX_WideString& script,
+ CFX_WideString& info) = 0;
+ virtual FX_BOOL RunScript(const CFX_WideString& script,
+ CFX_WideString& info) = 0;
+
+ virtual void OnApp_Init() = 0;
+
+ virtual void OnDoc_Open(CPDFSDK_Document* pDoc,
+ const CFX_WideString& strTargetName) = 0;
+ virtual void OnDoc_WillPrint(CPDFSDK_Document* pDoc) = 0;
+ virtual void OnDoc_DidPrint(CPDFSDK_Document* pDoc) = 0;
+ virtual void OnDoc_WillSave(CPDFSDK_Document* pDoc) = 0;
+ virtual void OnDoc_DidSave(CPDFSDK_Document* pDoc) = 0;
+ virtual void OnDoc_WillClose(CPDFSDK_Document* pDoc) = 0;
+
+ virtual void OnPage_Open(CPDFSDK_Document* pTarget) = 0;
+ virtual void OnPage_Close(CPDFSDK_Document* pTarget) = 0;
+ virtual void OnPage_InView(CPDFSDK_Document* pTarget) = 0;
+ virtual void OnPage_OutView(CPDFSDK_Document* pTarget) = 0;
+
+ virtual void OnField_MouseDown(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget) = 0;
+ virtual void OnField_MouseEnter(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget) = 0;
+ virtual void OnField_MouseExit(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget) = 0;
+ virtual void OnField_MouseUp(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget) = 0;
+ virtual void OnField_Focus(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ const CFX_WideString& Value) = 0;
+ virtual void OnField_Blur(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ const CFX_WideString& Value) = 0;
+
+ virtual void OnField_Calculate(CPDF_FormField* pSource,
+ CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL& bRc) = 0;
+ virtual void OnField_Format(CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL bWillCommit) = 0;
+ virtual void OnField_Keystroke(CFX_WideString& strChange,
+ const CFX_WideString& strChangeEx,
+ FX_BOOL KeyDown,
+ FX_BOOL bModifier,
+ int& nSelEnd,
+ int& nSelStart,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL bWillCommit,
+ FX_BOOL bFieldFull,
+ FX_BOOL& bRc) = 0;
+ virtual void OnField_Validate(CFX_WideString& strChange,
+ const CFX_WideString& strChangeEx,
+ FX_BOOL bKeyDown,
+ FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL& bRc) = 0;
+
+ virtual void OnScreen_Focus(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen) = 0;
+ virtual void OnScreen_Blur(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen) = 0;
+ virtual void OnScreen_Open(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen) = 0;
+ virtual void OnScreen_Close(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen) = 0;
+ virtual void OnScreen_MouseDown(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen) = 0;
+ virtual void OnScreen_MouseUp(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen) = 0;
+ virtual void OnScreen_MouseEnter(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen) = 0;
+ virtual void OnScreen_MouseExit(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen) = 0;
+ virtual void OnScreen_InView(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen) = 0;
+ virtual void OnScreen_OutView(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen) = 0;
+
+ virtual void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) = 0;
+ virtual void OnLink_MouseUp(CPDFSDK_Document* pTarget) = 0;
+
+ virtual void OnMenu_Exec(CPDFSDK_Document* pTarget,
+ const CFX_WideString&) = 0;
+ virtual void OnBatchExec(CPDFSDK_Document* pTarget) = 0;
+ virtual void OnConsole_Exec() = 0;
+ virtual void OnExternal_Exec() = 0;
+
+ virtual void EnableMessageBox(FX_BOOL bEnable) = 0;
};
-class IFXJS_Runtime
-{
-public:
- virtual IFXJS_Context* NewContext() = 0;
- virtual void ReleaseContext(IFXJS_Context * pContext) = 0;
- virtual IFXJS_Context* GetCurrentContext() = 0;
+class IFXJS_Runtime {
+ public:
+ virtual IFXJS_Context* NewContext() = 0;
+ virtual void ReleaseContext(IFXJS_Context* pContext) = 0;
+ virtual IFXJS_Context* GetCurrentContext() = 0;
- virtual void SetReaderDocument(CPDFSDK_Document* pReaderDoc) = 0;
+ virtual void SetReaderDocument(CPDFSDK_Document* pReaderDoc) = 0;
- virtual CPDFSDK_Document* GetReaderDocument() = 0;
+ virtual CPDFSDK_Document* GetReaderDocument() = 0;
- virtual FX_BOOL GetHValueByName(const CFX_ByteStringC& utf8Name, FXJSE_HVALUE hValue) = 0;
- virtual FX_BOOL SetHValueByName(const CFX_ByteStringC& utf8Name, FXJSE_HVALUE hValue) = 0;
+ virtual FX_BOOL GetHValueByName(const CFX_ByteStringC& utf8Name,
+ FXJSE_HVALUE hValue) = 0;
+ virtual FX_BOOL SetHValueByName(const CFX_ByteStringC& utf8Name,
+ FXJSE_HVALUE hValue) = 0;
-protected:
- ~IFXJS_Runtime() { }
+ protected:
+ ~IFXJS_Runtime() {}
};
class CPDFDoc_Environment;
class CJS_GlobalData;
-class CJS_RuntimeFactory
-{
-public:
- CJS_RuntimeFactory():m_bInit(FALSE),m_nRef(0),m_pGlobalData(NULL),m_nGlobalDataCount(0) {}
- ~CJS_RuntimeFactory();
- IFXJS_Runtime* NewJSRuntime(CPDFDoc_Environment* pApp);
- void DeleteJSRuntime(IFXJS_Runtime* pRuntime);
- void AddRef();
- void Release();
-
- CJS_GlobalData* NewGlobalData(CPDFDoc_Environment* pApp);
- void ReleaseGlobalData();
-private:
- FX_BOOL m_bInit;
- int m_nRef;
- CJS_GlobalData* m_pGlobalData;
- int32_t m_nGlobalDataCount;
+class CJS_RuntimeFactory {
+ public:
+ CJS_RuntimeFactory()
+ : m_bInit(FALSE), m_nRef(0), m_pGlobalData(NULL), m_nGlobalDataCount(0) {}
+ ~CJS_RuntimeFactory();
+ IFXJS_Runtime* NewJSRuntime(CPDFDoc_Environment* pApp);
+ void DeleteJSRuntime(IFXJS_Runtime* pRuntime);
+ void AddRef();
+ void Release();
+
+ CJS_GlobalData* NewGlobalData(CPDFDoc_Environment* pApp);
+ void ReleaseGlobalData();
+
+ private:
+ FX_BOOL m_bInit;
+ int m_nRef;
+ CJS_GlobalData* m_pGlobalData;
+ int32_t m_nGlobalDataCount;
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_
diff --git a/fpdfsdk/include/javascript/Icon.h b/fpdfsdk/include/javascript/Icon.h
index 0298005f00..0b549ec613 100644
--- a/fpdfsdk/include/javascript/Icon.h
+++ b/fpdfsdk/include/javascript/Icon.h
@@ -9,32 +9,30 @@
#include "JS_Define.h"
-class Icon : public CJS_EmbedObj
-{
-public:
- Icon(CJS_Object* pJSObject);
- virtual ~Icon();
- FX_BOOL name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- void SetStream(CPDF_Stream* pIconStream);
- CPDF_Stream* GetStream();
- void SetIconName(CFX_WideString name);
- CFX_WideString GetIconName();
-
-private:
- CPDF_Stream* m_pIconStream;
- CFX_WideString m_swIconName;
+class Icon : public CJS_EmbedObj {
+ public:
+ Icon(CJS_Object* pJSObject);
+ virtual ~Icon();
+ FX_BOOL name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ void SetStream(CPDF_Stream* pIconStream);
+ CPDF_Stream* GetStream();
+ void SetIconName(CFX_WideString name);
+ CFX_WideString GetIconName();
+
+ private:
+ CPDF_Stream* m_pIconStream;
+ CFX_WideString m_swIconName;
};
-class CJS_Icon : public CJS_Object
-{
-public:
- CJS_Icon(JSFXObject pObject) : CJS_Object(pObject){};
- virtual ~CJS_Icon(){};
+class CJS_Icon : public CJS_Object {
+ public:
+ CJS_Icon(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Icon(){};
-public:
- DECLARE_JS_CLASS(CJS_Icon);
+ public:
+ DECLARE_JS_CLASS(CJS_Icon);
- JS_STATIC_PROP(name, Icon);
+ JS_STATIC_PROP(name, Icon);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_ICON_H_
diff --git a/fpdfsdk/include/javascript/JS_Context.h b/fpdfsdk/include/javascript/JS_Context.h
index 060bb55937..f61f37cdc6 100644
--- a/fpdfsdk/include/javascript/JS_Context.h
+++ b/fpdfsdk/include/javascript/JS_Context.h
@@ -14,84 +14,138 @@
class CJS_EventHandler;
class CJS_Runtime;
-class CJS_Context : public IFXJS_Context
-{
-public:
- CJS_Context(CJS_Runtime* pRuntime);
- virtual ~CJS_Context();
-
-public:
- virtual FX_BOOL Compile(const CFX_WideString& script, CFX_WideString& info);
- virtual FX_BOOL RunScript(const CFX_WideString& script, CFX_WideString& info);
-
-public:
- virtual void OnApp_Init();
-
- virtual void OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName);
- virtual void OnDoc_WillPrint(CPDFSDK_Document* pDoc);
- virtual void OnDoc_DidPrint(CPDFSDK_Document* pDoc);
- virtual void OnDoc_WillSave(CPDFSDK_Document* pDoc);
- virtual void OnDoc_DidSave(CPDFSDK_Document* pDoc);
- virtual void OnDoc_WillClose(CPDFSDK_Document* pDoc);
-
- virtual void OnPage_Open(CPDFSDK_Document* pTarget);
- virtual void OnPage_Close(CPDFSDK_Document* pTarget);
- virtual void OnPage_InView(CPDFSDK_Document* pTarget);
- virtual void OnPage_OutView(CPDFSDK_Document* pTarget);
-
- virtual void OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- virtual void OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- virtual void OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- virtual void OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- virtual void OnField_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value);
- virtual void OnField_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value);
-
- virtual void OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc);
- virtual void OnField_Format(CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit);
- virtual void OnField_Keystroke(CFX_WideString& strChange, const CFX_WideString& strChangeEx,
- FX_BOOL bKeyDown, FX_BOOL bModifier, int &nSelEnd,int &nSelStart, FX_BOOL bShift,
- CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit,
- FX_BOOL bFieldFull, FX_BOOL &bRc);
- virtual void OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown,
- FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc);
-
- virtual void OnScreen_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_Close(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_InView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
-
- virtual void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark);
- virtual void OnLink_MouseUp(CPDFSDK_Document* pTarget);
-
- virtual void OnMenu_Exec(CPDFSDK_Document* pTarget, const CFX_WideString& strTargetName);
- virtual void OnBatchExec(CPDFSDK_Document* pTarget);
- virtual void OnConsole_Exec();
- virtual void OnExternal_Exec();
-
- virtual void EnableMessageBox(FX_BOOL bEnable) {m_bMsgBoxEnable = bEnable;}
- FX_BOOL IsMsgBoxEnabled() const {return m_bMsgBoxEnable;}
-
-public:
- CPDFDoc_Environment* GetReaderApp();
- CJS_Runtime* GetJSRuntime(){return m_pRuntime;}
-
- FX_BOOL DoJob(int nMode, const CFX_WideString& script, CFX_WideString& info);
-
- CJS_EventHandler* GetEventHandler(){return m_pEventHandler;};
- CPDFSDK_Document* GetReaderDocument();
-
-private:
- CJS_Runtime* m_pRuntime;
- CJS_EventHandler* m_pEventHandler;
-
- FX_BOOL m_bBusy;
- FX_BOOL m_bMsgBoxEnable;
+class CJS_Context : public IFXJS_Context {
+ public:
+ CJS_Context(CJS_Runtime* pRuntime);
+ virtual ~CJS_Context();
+
+ public:
+ virtual FX_BOOL Compile(const CFX_WideString& script, CFX_WideString& info);
+ virtual FX_BOOL RunScript(const CFX_WideString& script, CFX_WideString& info);
+
+ public:
+ virtual void OnApp_Init();
+
+ virtual void OnDoc_Open(CPDFSDK_Document* pDoc,
+ const CFX_WideString& strTargetName);
+ virtual void OnDoc_WillPrint(CPDFSDK_Document* pDoc);
+ virtual void OnDoc_DidPrint(CPDFSDK_Document* pDoc);
+ virtual void OnDoc_WillSave(CPDFSDK_Document* pDoc);
+ virtual void OnDoc_DidSave(CPDFSDK_Document* pDoc);
+ virtual void OnDoc_WillClose(CPDFSDK_Document* pDoc);
+
+ virtual void OnPage_Open(CPDFSDK_Document* pTarget);
+ virtual void OnPage_Close(CPDFSDK_Document* pTarget);
+ virtual void OnPage_InView(CPDFSDK_Document* pTarget);
+ virtual void OnPage_OutView(CPDFSDK_Document* pTarget);
+
+ virtual void OnField_MouseDown(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget);
+ virtual void OnField_MouseEnter(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget);
+ virtual void OnField_MouseExit(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget);
+ virtual void OnField_MouseUp(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget);
+ virtual void OnField_Focus(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ const CFX_WideString& Value);
+ virtual void OnField_Blur(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ const CFX_WideString& Value);
+
+ virtual void OnField_Calculate(CPDF_FormField* pSource,
+ CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL& bRc);
+ virtual void OnField_Format(CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL bWillCommit);
+ virtual void OnField_Keystroke(CFX_WideString& strChange,
+ const CFX_WideString& strChangeEx,
+ FX_BOOL bKeyDown,
+ FX_BOOL bModifier,
+ int& nSelEnd,
+ int& nSelStart,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL bWillCommit,
+ FX_BOOL bFieldFull,
+ FX_BOOL& bRc);
+ virtual void OnField_Validate(CFX_WideString& strChange,
+ const CFX_WideString& strChangeEx,
+ FX_BOOL bKeyDown,
+ FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL& bRc);
+
+ virtual void OnScreen_Focus(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ virtual void OnScreen_Blur(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ virtual void OnScreen_Open(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ virtual void OnScreen_Close(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ virtual void OnScreen_MouseDown(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ virtual void OnScreen_MouseUp(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ virtual void OnScreen_MouseEnter(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ virtual void OnScreen_MouseExit(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ virtual void OnScreen_InView(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ virtual void OnScreen_OutView(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+
+ virtual void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark);
+ virtual void OnLink_MouseUp(CPDFSDK_Document* pTarget);
+
+ virtual void OnMenu_Exec(CPDFSDK_Document* pTarget,
+ const CFX_WideString& strTargetName);
+ virtual void OnBatchExec(CPDFSDK_Document* pTarget);
+ virtual void OnConsole_Exec();
+ virtual void OnExternal_Exec();
+
+ virtual void EnableMessageBox(FX_BOOL bEnable) { m_bMsgBoxEnable = bEnable; }
+ FX_BOOL IsMsgBoxEnabled() const { return m_bMsgBoxEnable; }
+
+ public:
+ CPDFDoc_Environment* GetReaderApp();
+ CJS_Runtime* GetJSRuntime() { return m_pRuntime; }
+
+ FX_BOOL DoJob(int nMode, const CFX_WideString& script, CFX_WideString& info);
+
+ CJS_EventHandler* GetEventHandler() { return m_pEventHandler; };
+ CPDFSDK_Document* GetReaderDocument();
+
+ private:
+ CJS_Runtime* m_pRuntime;
+ CJS_EventHandler* m_pEventHandler;
+
+ FX_BOOL m_bBusy;
+ FX_BOOL m_bMsgBoxEnable;
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_CONTEXT_H_
diff --git a/fpdfsdk/include/javascript/JS_Define.h b/fpdfsdk/include/javascript/JS_Define.h
index c480ce30c3..7490a2f636 100644
--- a/fpdfsdk/include/javascript/JS_Define.h
+++ b/fpdfsdk/include/javascript/JS_Define.h
@@ -12,46 +12,68 @@
#include "JS_Object.h"
#include "JS_Value.h"
-struct JSConstSpec
-{
- const wchar_t* pName;
- double number;
- const wchar_t* string;
- uint8_t t; //0:double 1:str
+struct JSConstSpec {
+ const wchar_t* pName;
+ double number;
+ const wchar_t* string;
+ uint8_t t; // 0:double 1:str
};
-struct JSPropertySpec
-{
- const wchar_t* pName;
- v8::AccessorGetterCallback pPropGet;
- v8::AccessorSetterCallback pPropPut;
+struct JSPropertySpec {
+ const wchar_t* pName;
+ v8::AccessorGetterCallback pPropGet;
+ v8::AccessorSetterCallback pPropPut;
};
-struct JSMethodSpec
-{
- const wchar_t* pName;
- v8::FunctionCallback pMethodCall;
+struct JSMethodSpec {
+ const wchar_t* pName;
+ v8::FunctionCallback pMethodCall;
};
-/* ====================================== PUBLIC DEFINE SPEC ============================================== */
-#define JS_WIDESTRING(widestring) L###widestring
-
-#define BEGIN_JS_STATIC_CONST(js_class_name) JSConstSpec js_class_name::JS_Class_Consts[] = {
-#define JS_STATIC_CONST_ENTRY_NUMBER(const_name, pValue) {JS_WIDESTRING(const_name), pValue, L"", 0},
-#define JS_STATIC_CONST_ENTRY_STRING(const_name, pValue) {JS_WIDESTRING(const_name), 0, JS_WIDESTRING(pValue), 1},
-#define END_JS_STATIC_CONST() {0, 0, 0, 0}};
-
-#define BEGIN_JS_STATIC_PROP(js_class_name) JSPropertySpec js_class_name::JS_Class_Properties[] = {
-#define JS_STATIC_PROP_ENTRY(prop_name) {JS_WIDESTRING(prop_name), get_##prop_name##_static, set_##prop_name##_static},
-#define END_JS_STATIC_PROP() {0, 0, 0}};
-
-#define BEGIN_JS_STATIC_METHOD(js_class_name) JSMethodSpec js_class_name::JS_Class_Methods[] = {
-#define JS_STATIC_METHOD_ENTRY(method_name) {JS_WIDESTRING(method_name), method_name##_static},
-#define END_JS_STATIC_METHOD() {0, 0}};
-
-/* ======================================== PROP CALLBACK ============================================ */
-
-template <class C, FX_BOOL (C::*M)(IFXJS_Context*, CJS_PropValue&, CFX_WideString&)>
+/* ====================================== PUBLIC DEFINE SPEC
+ * ============================================== */
+#define JS_WIDESTRING(widestring) L## #widestring
+
+#define BEGIN_JS_STATIC_CONST(js_class_name) \
+ JSConstSpec js_class_name::JS_Class_Consts[] = {
+#define JS_STATIC_CONST_ENTRY_NUMBER(const_name, pValue) \
+ { JS_WIDESTRING(const_name), pValue, L"", 0 } \
+ ,
+#define JS_STATIC_CONST_ENTRY_STRING(const_name, pValue) \
+ { JS_WIDESTRING(const_name), 0, JS_WIDESTRING(pValue), 1 } \
+ ,
+#define END_JS_STATIC_CONST() \
+ { 0, 0, 0, 0 } \
+ } \
+ ;
+
+#define BEGIN_JS_STATIC_PROP(js_class_name) \
+ JSPropertySpec js_class_name::JS_Class_Properties[] = {
+#define JS_STATIC_PROP_ENTRY(prop_name) \
+ { \
+ JS_WIDESTRING(prop_name), get_##prop_name##_static, set_##prop_name##_static \
+ } \
+ ,
+#define END_JS_STATIC_PROP() \
+ { 0, 0, 0 } \
+ } \
+ ;
+
+#define BEGIN_JS_STATIC_METHOD(js_class_name) \
+ JSMethodSpec js_class_name::JS_Class_Methods[] = {
+#define JS_STATIC_METHOD_ENTRY(method_name) \
+ { JS_WIDESTRING(method_name), method_name##_static } \
+ ,
+#define END_JS_STATIC_METHOD() \
+ { 0, 0 } \
+ } \
+ ;
+
+/* ======================================== PROP CALLBACK
+ * ============================================ */
+
+template <class C,
+ FX_BOOL (C::*M)(IFXJS_Context*, CJS_PropValue&, CFX_WideString&)>
void JSPropGetter(const char* prop_name_string,
const char* class_name_string,
v8::Local<v8::String> property,
@@ -61,17 +83,19 @@ void JSPropGetter(const char* prop_name_string,
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
CJS_PropValue value(isolate);
value.StartGetting();
- CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());
+ CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate, info.Holder());
C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject());
CFX_WideString sError;
if (!(pObj->*M)(pRuntimeContext, value, sError)) {
- JS_Error(isolate, JSFormatErrorString(class_name_string, prop_name_string, sError));
+ JS_Error(isolate,
+ JSFormatErrorString(class_name_string, prop_name_string, sError));
return;
}
info.GetReturnValue().Set((v8::Local<v8::Value>)value);
}
-template <class C, FX_BOOL (C::*M)(IFXJS_Context*, CJS_PropValue&, CFX_WideString&)>
+template <class C,
+ FX_BOOL (C::*M)(IFXJS_Context*, CJS_PropValue&, CFX_WideString&)>
void JSPropSetter(const char* prop_name_string,
const char* class_name_string,
v8::Local<v8::String> property,
@@ -82,32 +106,37 @@ void JSPropSetter(const char* prop_name_string,
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
CJS_PropValue propValue(CJS_Value(isolate, value, VT_unknown));
propValue.StartSetting();
- CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());
+ CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate, info.Holder());
C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject());
CFX_WideString sError;
if (!(pObj->*M)(pRuntimeContext, propValue, sError)) {
- JS_Error(isolate, JSFormatErrorString(class_name_string, prop_name_string, sError));
+ JS_Error(isolate,
+ JSFormatErrorString(class_name_string, prop_name_string, sError));
}
}
-#define JS_STATIC_PROP(prop_name, class_name) \
- static void get_##prop_name##_static( \
- v8::Local<v8::String> property, \
- const v8::PropertyCallbackInfo<v8::Value>& info) { \
- JSPropGetter<class_name, &class_name::prop_name>( \
- #prop_name, #class_name, property, info); \
- } \
- static void set_##prop_name##_static( \
- v8::Local<v8::String> property, \
- v8::Local<v8::Value> value, \
- const v8::PropertyCallbackInfo<void>& info) { \
- JSPropSetter<class_name, &class_name::prop_name>( \
- #prop_name, #class_name, property, value, info); \
+#define JS_STATIC_PROP(prop_name, class_name) \
+ static void get_##prop_name##_static( \
+ v8::Local<v8::String> property, \
+ const v8::PropertyCallbackInfo<v8::Value>& info) { \
+ JSPropGetter<class_name, &class_name::prop_name>(#prop_name, #class_name, \
+ property, info); \
+ } \
+ static void set_##prop_name##_static( \
+ v8::Local<v8::String> property, v8::Local<v8::Value> value, \
+ const v8::PropertyCallbackInfo<void>& info) { \
+ JSPropSetter<class_name, &class_name::prop_name>(#prop_name, #class_name, \
+ property, value, info); \
}
-/* ========================================= METHOD CALLBACK =========================================== */
+/* ========================================= METHOD CALLBACK
+ * =========================================== */
-template <class C, FX_BOOL (C::*M)(IFXJS_Context*, const CJS_Parameters&, CJS_Value&, CFX_WideString&)>
+template <class C,
+ FX_BOOL (C::*M)(IFXJS_Context*,
+ const CJS_Parameters&,
+ CJS_Value&,
+ CFX_WideString&)>
void JSMethod(const char* method_name_string,
const char* class_name_string,
const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -115,121 +144,140 @@ void JSMethod(const char* method_name_string,
IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
CJS_Parameters parameters;
- for (unsigned int i = 0; i<(unsigned int)info.Length(); i++) {
+ for (unsigned int i = 0; i < (unsigned int)info.Length(); i++) {
parameters.push_back(CJS_Value(isolate, info[i], VT_unknown));
}
CJS_Value valueRes(isolate);
- CJS_Object* pJSObj = (CJS_Object *)JS_GetPrivate(isolate,info.Holder());
+ CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate, info.Holder());
C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject());
CFX_WideString sError;
if (!(pObj->*M)(pRuntimeContext, parameters, valueRes, sError)) {
- JS_Error(isolate, JSFormatErrorString(class_name_string, method_name_string, sError));
+ JS_Error(isolate, JSFormatErrorString(class_name_string, method_name_string,
+ sError));
return;
}
info.GetReturnValue().Set(valueRes.ToV8Value());
}
-#define JS_STATIC_METHOD(method_name, class_name) \
- static void method_name##_static( \
- const v8::FunctionCallbackInfo<v8::Value>& info) { \
- JSMethod<class_name, &class_name::method_name>( \
- #method_name, #class_name, info); \
+#define JS_STATIC_METHOD(method_name, class_name) \
+ static void method_name##_static( \
+ const v8::FunctionCallbackInfo<v8::Value>& info) { \
+ JSMethod<class_name, &class_name::method_name>(#method_name, #class_name, \
+ info); \
}
#define JS_SPECIAL_STATIC_METHOD(method_name, class_alternate, class_name) \
- static void method_name##_static( \
- const v8::FunctionCallbackInfo<v8::Value>& info) { \
- JSMethod<class_alternate, &class_alternate::method_name>( \
- #method_name, #class_name, info); \
+ static void method_name##_static( \
+ const v8::FunctionCallbackInfo<v8::Value>& info) { \
+ JSMethod<class_alternate, &class_alternate::method_name>( \
+ #method_name, #class_name, info); \
}
-/* ===================================== JS CLASS =============================================== */
-
-#define DECLARE_JS_CLASS(js_class_name) \
- static void JSConstructor(IFXJS_Context* cc, JSFXObject obj,JSFXObject global);\
- static void JSDestructor(JSFXObject obj);\
- static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\
- static JSConstSpec JS_Class_Consts[];\
- static JSPropertySpec JS_Class_Properties[];\
- static JSMethodSpec JS_Class_Methods[];\
- static const wchar_t* m_pClassName
-
-#define IMPLEMENT_JS_CLASS_RICH(js_class_name, class_alternate, class_name) \
-const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name);\
-void js_class_name::JSConstructor(IFXJS_Context* cc, JSFXObject obj, JSFXObject global)\
-{\
- CJS_Object* pObj = FX_NEW js_class_name(obj);\
- pObj->SetEmbedObject(FX_NEW class_alternate(pObj));\
- JS_SetPrivate(NULL,obj,(void*)pObj); \
- pObj->InitInstance(cc);\
-}\
-\
-void js_class_name::JSDestructor(JSFXObject obj) \
-{\
- js_class_name* pObj = (js_class_name*)JS_GetPrivate(NULL,obj);\
- ASSERT(pObj != NULL);\
- pObj->ExitInstance();\
- delete pObj;\
-}\
-\
-int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\
-{\
- int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, eObjType, JSConstructor, JSDestructor);\
- if (nObjDefnID >= 0)\
- {\
- for (int j=0, szj=sizeof(JS_Class_Properties)/sizeof(JSPropertySpec)-1; j<szj; j++)\
- {\
- if (JS_DefineObjProperty(pRuntime, nObjDefnID, JS_Class_Properties[j].pName, JS_Class_Properties[j].pPropGet, JS_Class_Properties[j].pPropPut) < 0) return -1;\
- }\
- for (int k=0, szk=sizeof(JS_Class_Methods)/sizeof(JSMethodSpec)-1; k<szk; k++)\
- {\
- if (JS_DefineObjMethod(pRuntime, nObjDefnID,JS_Class_Methods[k].pName, JS_Class_Methods[k].pMethodCall) < 0) return -1;\
- }\
- return nObjDefnID;\
- }\
- return -1;\
-}
+/* ===================================== JS CLASS
+ * =============================================== */
+
+#define DECLARE_JS_CLASS(js_class_name) \
+ static void JSConstructor(IFXJS_Context* cc, JSFXObject obj, \
+ JSFXObject global); \
+ static void JSDestructor(JSFXObject obj); \
+ static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType); \
+ static JSConstSpec JS_Class_Consts[]; \
+ static JSPropertySpec JS_Class_Properties[]; \
+ static JSMethodSpec JS_Class_Methods[]; \
+ static const wchar_t* m_pClassName
+
+#define IMPLEMENT_JS_CLASS_RICH(js_class_name, class_alternate, class_name) \
+ const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name); \
+ void js_class_name::JSConstructor(IFXJS_Context* cc, JSFXObject obj, \
+ JSFXObject global) { \
+ CJS_Object* pObj = FX_NEW js_class_name(obj); \
+ pObj->SetEmbedObject(FX_NEW class_alternate(pObj)); \
+ JS_SetPrivate(NULL, obj, (void*)pObj); \
+ pObj->InitInstance(cc); \
+ } \
+ \
+ void js_class_name::JSDestructor(JSFXObject obj) { \
+ js_class_name* pObj = (js_class_name*)JS_GetPrivate(NULL, obj); \
+ ASSERT(pObj != NULL); \
+ pObj->ExitInstance(); \
+ delete pObj; \
+ } \
+ \
+ int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType) { \
+ int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, \
+ eObjType, JSConstructor, JSDestructor); \
+ if (nObjDefnID >= 0) { \
+ for (int j = 0, \
+ szj = sizeof(JS_Class_Properties) / sizeof(JSPropertySpec) - 1; \
+ j < szj; j++) { \
+ if (JS_DefineObjProperty(pRuntime, nObjDefnID, \
+ JS_Class_Properties[j].pName, \
+ JS_Class_Properties[j].pPropGet, \
+ JS_Class_Properties[j].pPropPut) < 0) \
+ return -1; \
+ } \
+ for (int k = 0, \
+ szk = sizeof(JS_Class_Methods) / sizeof(JSMethodSpec) - 1; \
+ k < szk; k++) { \
+ if (JS_DefineObjMethod(pRuntime, nObjDefnID, \
+ JS_Class_Methods[k].pName, \
+ JS_Class_Methods[k].pMethodCall) < 0) \
+ return -1; \
+ } \
+ return nObjDefnID; \
+ } \
+ return -1; \
+ }
-#define IMPLEMENT_JS_CLASS(js_class_name, class_name) IMPLEMENT_JS_CLASS_RICH(js_class_name, class_name, class_name)
-
-/* ======================================== CONST CLASS ============================================ */
-
-#define DECLARE_JS_CLASS_CONST() \
- static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\
- static JSConstSpec JS_Class_Consts[];\
- static const wchar_t* m_pClassName
-
-#define IMPLEMENT_JS_CLASS_CONST(js_class_name, class_name) \
-const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name);\
-int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\
-{\
- int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, eObjType, NULL, NULL);\
- if (nObjDefnID >=0)\
- {\
- for (int i=0, sz=sizeof(JS_Class_Consts)/sizeof(JSConstSpec)-1; i<sz; i++)\
- {\
- if (JS_Class_Consts[i].t == 0)\
- {\
- if (JS_DefineObjConst(pRuntime, nObjDefnID, JS_Class_Consts[i].pName, JS_NewNumber(pRuntime,JS_Class_Consts[i].number)) < 0) return -1;\
- }\
- else\
- {\
- if (JS_DefineObjConst(pRuntime, nObjDefnID, JS_Class_Consts[i].pName, JS_NewString(pRuntime,JS_Class_Consts[i].string)) < 0) return -1;\
- }\
- }\
- return nObjDefnID;\
- }\
- return -1;\
-}
+#define IMPLEMENT_JS_CLASS(js_class_name, class_name) \
+ IMPLEMENT_JS_CLASS_RICH(js_class_name, class_name, class_name)
+
+/* ======================================== CONST CLASS
+ * ============================================ */
+
+#define DECLARE_JS_CLASS_CONST() \
+ static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType); \
+ static JSConstSpec JS_Class_Consts[]; \
+ static const wchar_t* m_pClassName
+
+#define IMPLEMENT_JS_CLASS_CONST(js_class_name, class_name) \
+ const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name); \
+ int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType) { \
+ int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, \
+ eObjType, NULL, NULL); \
+ if (nObjDefnID >= 0) { \
+ for (int i = 0, sz = sizeof(JS_Class_Consts) / sizeof(JSConstSpec) - 1; \
+ i < sz; i++) { \
+ if (JS_Class_Consts[i].t == 0) { \
+ if (JS_DefineObjConst( \
+ pRuntime, nObjDefnID, JS_Class_Consts[i].pName, \
+ JS_NewNumber(pRuntime, JS_Class_Consts[i].number)) < 0) \
+ return -1; \
+ } else { \
+ if (JS_DefineObjConst( \
+ pRuntime, nObjDefnID, JS_Class_Consts[i].pName, \
+ JS_NewString(pRuntime, JS_Class_Consts[i].string)) < 0) \
+ return -1; \
+ } \
+ } \
+ return nObjDefnID; \
+ } \
+ return -1; \
+ }
-/* ===================================== SPECIAL JS CLASS =============================================== */
+/* ===================================== SPECIAL JS CLASS
+ * =============================================== */
template <class Alt>
-void JSSpecialPropQuery(const char *, v8::Local<v8::String> property,const v8::PropertyCallbackInfo<v8::Integer>& info) {
+void JSSpecialPropQuery(const char*,
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Integer>& info) {
v8::Isolate* isolate = info.GetIsolate();
v8::String::Utf8Value utf8_value(property);
- CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());
- CJS_Object* pJSObj = reinterpret_cast<CJS_Object*>(JS_GetPrivate(isolate, info.Holder()));
+ CFX_WideString propname =
+ CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());
+ CJS_Object* pJSObj =
+ reinterpret_cast<CJS_Object*>(JS_GetPrivate(isolate, info.Holder()));
Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
FX_BOOL bRet = pObj->QueryProperty(propname.c_str());
info.GetReturnValue().Set(bRet ? 4 : 0);
@@ -243,16 +291,18 @@ void JSSpecialPropGet(const char* class_name,
v8::Local<v8::Context> context = isolate->GetCurrentContext();
IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
- CJS_Object* pJSObj = reinterpret_cast<CJS_Object*>(JS_GetPrivate(isolate, info.Holder()));
+ CJS_Object* pJSObj =
+ reinterpret_cast<CJS_Object*>(JS_GetPrivate(isolate, info.Holder()));
Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
v8::String::Utf8Value utf8_value(property);
- CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());
+ CFX_WideString propname =
+ CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());
CFX_WideString sError;
CJS_PropValue value(isolate);
value.StartGetting();
if (!pObj->DoProperty(pRuntimeContext, propname.c_str(), value, sError)) {
- JS_Error(isolate, JSFormatErrorString(class_name, "GetProperty", sError));
- return;
+ JS_Error(isolate, JSFormatErrorString(class_name, "GetProperty", sError));
+ return;
}
info.GetReturnValue().Set((v8::Local<v8::Value>)value);
}
@@ -266,15 +316,17 @@ void JSSpecialPropPut(const char* class_name,
v8::Local<v8::Context> context = isolate->GetCurrentContext();
IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
- CJS_Object* pJSObj = reinterpret_cast<CJS_Object*>(JS_GetPrivate(isolate, info.Holder()));
+ CJS_Object* pJSObj =
+ reinterpret_cast<CJS_Object*>(JS_GetPrivate(isolate, info.Holder()));
Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
v8::String::Utf8Value utf8_value(property);
- CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());
+ CFX_WideString propname =
+ CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());
CFX_WideString sError;
- CJS_PropValue PropValue(CJS_Value(isolate,value,VT_unknown));
+ CJS_PropValue PropValue(CJS_Value(isolate, value, VT_unknown));
PropValue.StartSetting();
if (!pObj->DoProperty(pRuntimeContext, propname.c_str(), PropValue, sError)) {
- JS_Error(isolate, JSFormatErrorString(class_name, "PutProperty", sError));
+ JS_Error(isolate, JSFormatErrorString(class_name, "PutProperty", sError));
}
}
@@ -286,10 +338,12 @@ void JSSpecialPropDel(const char* class_name,
v8::Local<v8::Context> context = isolate->GetCurrentContext();
IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
- CJS_Object* pJSObj = reinterpret_cast<CJS_Object*>(JS_GetPrivate(isolate, info.Holder()));
+ CJS_Object* pJSObj =
+ reinterpret_cast<CJS_Object*>(JS_GetPrivate(isolate, info.Holder()));
Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
v8::String::Utf8Value utf8_value(property);
- CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());
+ CFX_WideString propname =
+ CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());
CFX_WideString sError;
if (!pObj->DelProperty(pRuntimeContext, propname.c_str(), sError)) {
CFX_ByteString cbName;
@@ -298,83 +352,114 @@ void JSSpecialPropDel(const char* class_name,
}
}
-#define DECLARE_SPECIAL_JS_CLASS(js_class_name) \
- static void JSConstructor(IFXJS_Context* cc, JSFXObject obj, JSFXObject global);\
- static void JSDestructor(JSFXObject obj);\
- static JSConstSpec JS_Class_Consts[];\
- static JSPropertySpec JS_Class_Properties[];\
- static JSMethodSpec JS_Class_Methods[];\
- static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\
- static const wchar_t* m_pClassName;\
- static void queryprop_##js_class_name##_static(v8::Local<v8::String> property,const v8::PropertyCallbackInfo<v8::Integer>& info);\
- static void getprop_##js_class_name##_static(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info);\
- static void putprop_##js_class_name##_static(v8::Local<v8::String> property,v8::Local<v8::Value> value,const v8::PropertyCallbackInfo<v8::Value>& info);\
- static void delprop_##js_class_name##_static(v8::Local<v8::String> property,const v8::PropertyCallbackInfo<v8::Boolean>& info)
+#define DECLARE_SPECIAL_JS_CLASS(js_class_name) \
+ static void JSConstructor(IFXJS_Context* cc, JSFXObject obj, \
+ JSFXObject global); \
+ static void JSDestructor(JSFXObject obj); \
+ static JSConstSpec JS_Class_Consts[]; \
+ static JSPropertySpec JS_Class_Properties[]; \
+ static JSMethodSpec JS_Class_Methods[]; \
+ static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType); \
+ static const wchar_t* m_pClassName; \
+ static void queryprop_##js_class_name##_static( \
+ v8::Local<v8::String> property, \
+ const v8::PropertyCallbackInfo<v8::Integer>& info); \
+ static void getprop_##js_class_name##_static( \
+ v8::Local<v8::String> property, \
+ const v8::PropertyCallbackInfo<v8::Value>& info); \
+ static void putprop_##js_class_name##_static( \
+ v8::Local<v8::String> property, v8::Local<v8::Value> value, \
+ const v8::PropertyCallbackInfo<v8::Value>& info); \
+ static void delprop_##js_class_name##_static( \
+ v8::Local<v8::String> property, \
+ const v8::PropertyCallbackInfo<v8::Boolean>& info)
#define IMPLEMENT_SPECIAL_JS_CLASS(js_class_name, class_alternate, class_name) \
-const wchar_t * js_class_name::m_pClassName = JS_WIDESTRING(class_name);\
-void js_class_name::queryprop_##js_class_name##_static(v8::Local<v8::String> property,const v8::PropertyCallbackInfo<v8::Integer>& info) { \
- JSSpecialPropQuery<class_alternate>(#class_name, property, info); \
-}\
-void js_class_name::getprop_##js_class_name##_static(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info) { \
- JSSpecialPropGet<class_alternate>(#class_name, property, info); \
-} \
-void js_class_name::putprop_##js_class_name##_static(v8::Local<v8::String> property,v8::Local<v8::Value> value,const v8::PropertyCallbackInfo<v8::Value>& info) {\
- JSSpecialPropPut<class_alternate>(#class_name, property, value, info); \
-}\
-void js_class_name::delprop_##js_class_name##_static(v8::Local<v8::String> property,const v8::PropertyCallbackInfo<v8::Boolean>& info) { \
- JSSpecialPropDel<class_alternate>(#class_name, property, info); \
-} \
-void js_class_name::JSConstructor(IFXJS_Context* cc, JSFXObject obj,JSFXObject global)\
-{\
- CJS_Object* pObj = FX_NEW js_class_name(obj);\
- pObj->SetEmbedObject(FX_NEW class_alternate(pObj));\
- JS_SetPrivate(NULL,obj, (void*)pObj); \
- pObj->InitInstance(cc);\
-}\
-\
-void js_class_name::JSDestructor(JSFXObject obj) \
-{\
- js_class_name* pObj = (js_class_name*)JS_GetPrivate(NULL,obj);\
- ASSERT(pObj != NULL);\
- pObj->ExitInstance();\
- delete pObj;\
-}\
-\
-int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\
-{\
-\
- int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, eObjType, JSConstructor, JSDestructor);\
-\
- if (nObjDefnID >= 0)\
- {\
- for (int j=0, szj=sizeof(JS_Class_Properties)/sizeof(JSPropertySpec)-1; j<szj; j++)\
- {\
- if (JS_DefineObjProperty(pRuntime, nObjDefnID, JS_Class_Properties[j].pName, JS_Class_Properties[j].pPropGet,JS_Class_Properties[j].pPropPut)<0)return -1;\
- }\
-\
- for (int k=0, szk=sizeof(JS_Class_Methods)/sizeof(JSMethodSpec)-1; k<szk; k++)\
- {\
- if (JS_DefineObjMethod(pRuntime, nObjDefnID,JS_Class_Methods[k].pName,JS_Class_Methods[k].pMethodCall)<0)return -1;\
- }\
- if (JS_DefineObjAllProperties(pRuntime, nObjDefnID, js_class_name::queryprop_##js_class_name##_static, js_class_name::getprop_##js_class_name##_static,js_class_name::putprop_##js_class_name##_static,js_class_name::delprop_##js_class_name##_static)<0) return -1;\
-\
- return nObjDefnID;\
- }\
-\
- return -1;\
-}
+ const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name); \
+ void js_class_name::queryprop_##js_class_name##_static( \
+ v8::Local<v8::String> property, \
+ const v8::PropertyCallbackInfo<v8::Integer>& info) { \
+ JSSpecialPropQuery<class_alternate>(#class_name, property, info); \
+ } \
+ void js_class_name::getprop_##js_class_name##_static( \
+ v8::Local<v8::String> property, \
+ const v8::PropertyCallbackInfo<v8::Value>& info) { \
+ JSSpecialPropGet<class_alternate>(#class_name, property, info); \
+ } \
+ void js_class_name::putprop_##js_class_name##_static( \
+ v8::Local<v8::String> property, v8::Local<v8::Value> value, \
+ const v8::PropertyCallbackInfo<v8::Value>& info) { \
+ JSSpecialPropPut<class_alternate>(#class_name, property, value, info); \
+ } \
+ void js_class_name::delprop_##js_class_name##_static( \
+ v8::Local<v8::String> property, \
+ const v8::PropertyCallbackInfo<v8::Boolean>& info) { \
+ JSSpecialPropDel<class_alternate>(#class_name, property, info); \
+ } \
+ void js_class_name::JSConstructor(IFXJS_Context* cc, JSFXObject obj, \
+ JSFXObject global) { \
+ CJS_Object* pObj = FX_NEW js_class_name(obj); \
+ pObj->SetEmbedObject(FX_NEW class_alternate(pObj)); \
+ JS_SetPrivate(NULL, obj, (void*)pObj); \
+ pObj->InitInstance(cc); \
+ } \
+ \
+ void js_class_name::JSDestructor(JSFXObject obj) { \
+ js_class_name* pObj = (js_class_name*)JS_GetPrivate(NULL, obj); \
+ ASSERT(pObj != NULL); \
+ pObj->ExitInstance(); \
+ delete pObj; \
+ } \
+ \
+ int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType) { \
+ int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, \
+ eObjType, JSConstructor, JSDestructor); \
+ \
+ if (nObjDefnID >= 0) { \
+ for (int j = 0, \
+ szj = sizeof(JS_Class_Properties) / sizeof(JSPropertySpec) - 1; \
+ j < szj; j++) { \
+ if (JS_DefineObjProperty(pRuntime, nObjDefnID, \
+ JS_Class_Properties[j].pName, \
+ JS_Class_Properties[j].pPropGet, \
+ JS_Class_Properties[j].pPropPut) < 0) \
+ return -1; \
+ } \
+ \
+ for (int k = 0, \
+ szk = sizeof(JS_Class_Methods) / sizeof(JSMethodSpec) - 1; \
+ k < szk; k++) { \
+ if (JS_DefineObjMethod(pRuntime, nObjDefnID, \
+ JS_Class_Methods[k].pName, \
+ JS_Class_Methods[k].pMethodCall) < 0) \
+ return -1; \
+ } \
+ if (JS_DefineObjAllProperties( \
+ pRuntime, nObjDefnID, \
+ js_class_name::queryprop_##js_class_name##_static, \
+ js_class_name::getprop_##js_class_name##_static, \
+ js_class_name::putprop_##js_class_name##_static, \
+ js_class_name::delprop_##js_class_name##_static) < 0) \
+ return -1; \
+ \
+ return nObjDefnID; \
+ } \
+ \
+ return -1; \
+ }
-/* ======================================== GLOBAL METHODS ============================================ */
+/* ======================================== GLOBAL METHODS
+ * ============================================ */
-template <FX_BOOL (*F)(IFXJS_Context*, const CJS_Parameters&, CJS_Value&, CFX_WideString&)>
-void JSGlobalFunc(const char *func_name_string,
+template <FX_BOOL (
+ *F)(IFXJS_Context*, const CJS_Parameters&, CJS_Value&, CFX_WideString&)>
+void JSGlobalFunc(const char* func_name_string,
const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
CJS_Parameters parameters;
- for (unsigned int i = 0; i<(unsigned int)info.Length(); i++) {
+ for (unsigned int i = 0; i < (unsigned int)info.Length(); i++) {
parameters.push_back(CJS_Value(isolate, info[i], VT_unknown));
}
CJS_Value valueRes(isolate);
@@ -386,63 +471,71 @@ void JSGlobalFunc(const char *func_name_string,
info.GetReturnValue().Set(valueRes.ToV8Value());
}
-#define JS_STATIC_GLOBAL_FUN(fun_name) \
- static void fun_name##_static(const v8::FunctionCallbackInfo<v8::Value>& info) { \
- JSGlobalFunc<fun_name>(#fun_name, info); \
+#define JS_STATIC_GLOBAL_FUN(fun_name) \
+ static void fun_name##_static( \
+ const v8::FunctionCallbackInfo<v8::Value>& info) { \
+ JSGlobalFunc<fun_name>(#fun_name, info); \
}
-#define JS_STATIC_DECLARE_GLOBAL_FUN() \
-static JSMethodSpec global_methods[]; \
-static int Init(IJS_Runtime* pRuntime)
+#define JS_STATIC_DECLARE_GLOBAL_FUN() \
+ static JSMethodSpec global_methods[]; \
+ static int Init(IJS_Runtime* pRuntime)
#define BEGIN_JS_STATIC_GLOBAL_FUN(js_class_name) \
-JSMethodSpec js_class_name::global_methods[] = {
-
-#define JS_STATIC_GLOBAL_FUN_ENTRY(method_name) JS_STATIC_METHOD_ENTRY(method_name)
+ JSMethodSpec js_class_name::global_methods[] = {
+#define JS_STATIC_GLOBAL_FUN_ENTRY(method_name) \
+ JS_STATIC_METHOD_ENTRY(method_name)
#define END_JS_STATIC_GLOBAL_FUN() END_JS_STATIC_METHOD()
-#define IMPLEMENT_JS_STATIC_GLOBAL_FUN(js_class_name) \
-int js_class_name::Init(IJS_Runtime* pRuntime)\
-{\
- for (int i=0, sz=sizeof(js_class_name::global_methods)/sizeof(JSMethodSpec)-1; i<sz; i++)\
- {\
- if (JS_DefineGlobalMethod(pRuntime,\
- js_class_name::global_methods[i].pName,\
- js_class_name::global_methods[i].pMethodCall\
- ) < 0\
- )return -1;\
- }\
- return 0;\
-}
-
-/* ======================================== GLOBAL CONSTS ============================================ */
-#define DEFINE_GLOBAL_CONST(pRuntime, const_name , const_value)\
-if (JS_DefineGlobalConst(pRuntime,JS_WIDESTRING(const_name),JS_NewString(pRuntime,JS_WIDESTRING(const_value)))) return -1
-
-/* ======================================== GLOBAL ARRAYS ============================================ */
+#define IMPLEMENT_JS_STATIC_GLOBAL_FUN(js_class_name) \
+ int js_class_name::Init(IJS_Runtime* pRuntime) { \
+ for (int i = 0, sz = sizeof(js_class_name::global_methods) / \
+ sizeof(JSMethodSpec) - \
+ 1; \
+ i < sz; i++) { \
+ if (JS_DefineGlobalMethod( \
+ pRuntime, js_class_name::global_methods[i].pName, \
+ js_class_name::global_methods[i].pMethodCall) < 0) \
+ return -1; \
+ } \
+ return 0; \
+ }
-#define DEFINE_GLOBAL_ARRAY(pRuntime)\
-int size = FX_ArraySize(ArrayContent);\
-\
-CJS_Array array(pRuntime);\
-for (int i=0; i<size; i++) array.SetElement(i,CJS_Value(pRuntime,ArrayContent[i]));\
-\
-CJS_PropValue prop(pRuntime);\
-prop << array;\
-if (JS_DefineGlobalConst(pRuntime, (const wchar_t*)ArrayName, prop.ToV8Value()) < 0)\
- return -1
+/* ======================================== GLOBAL CONSTS
+ * ============================================ */
+#define DEFINE_GLOBAL_CONST(pRuntime, const_name, const_value) \
+ if (JS_DefineGlobalConst( \
+ pRuntime, JS_WIDESTRING(const_name), \
+ JS_NewString(pRuntime, JS_WIDESTRING(const_value)))) \
+ return -1
+
+/* ======================================== GLOBAL ARRAYS
+ * ============================================ */
+
+#define DEFINE_GLOBAL_ARRAY(pRuntime) \
+ int size = FX_ArraySize(ArrayContent); \
+ \
+ CJS_Array array(pRuntime); \
+ for (int i = 0; i < size; i++) \
+ array.SetElement(i, CJS_Value(pRuntime, ArrayContent[i])); \
+ \
+ CJS_PropValue prop(pRuntime); \
+ prop << array; \
+ if (JS_DefineGlobalConst(pRuntime, (const wchar_t*)ArrayName, \
+ prop.ToV8Value()) < 0) \
+ return -1
/* ============================================================ */
-#define VALUE_NAME_STRING L"string"
-#define VALUE_NAME_NUMBER L"number"
-#define VALUE_NAME_BOOLEAN L"boolean"
-#define VALUE_NAME_DATE L"date"
-#define VALUE_NAME_OBJECT L"object"
-#define VALUE_NAME_FXOBJ L"fxobj"
-#define VALUE_NAME_NULL L"null"
-#define VALUE_NAME_UNDEFINED L"undefined"
+#define VALUE_NAME_STRING L"string"
+#define VALUE_NAME_NUMBER L"number"
+#define VALUE_NAME_BOOLEAN L"boolean"
+#define VALUE_NAME_DATE L"date"
+#define VALUE_NAME_OBJECT L"object"
+#define VALUE_NAME_FXOBJ L"fxobj"
+#define VALUE_NAME_NULL L"null"
+#define VALUE_NAME_UNDEFINED L"undefined"
FXJSVALUETYPE GET_VALUE_TYPE(v8::Local<v8::Value> p);
diff --git a/fpdfsdk/include/javascript/JS_EventHandler.h b/fpdfsdk/include/javascript/JS_EventHandler.h
index 62afb829e7..5e4982c1df 100644
--- a/fpdfsdk/include/javascript/JS_EventHandler.h
+++ b/fpdfsdk/include/javascript/JS_EventHandler.h
@@ -17,157 +17,204 @@ class CPDF_Bookmark;
class CPDF_FormField;
class Field;
-enum JS_EVENT_T
-{
- JET_UNKNOWN,
- JET_APP_INIT,
- JET_DOC_OPEN,
- JET_DOC_WILLPRINT,
- JET_DOC_DIDPRINT,
- JET_DOC_WILLSAVE,
- JET_DOC_DIDSAVE,
- JET_DOC_WILLCLOSE,
- JET_PAGE_OPEN,
- JET_PAGE_CLOSE,
- JET_PAGE_INVIEW,
- JET_PAGE_OUTVIEW,
- JET_FIELD_MOUSEDOWN,
- JET_FIELD_MOUSEUP,
- JET_FIELD_MOUSEENTER,
- JET_FIELD_MOUSEEXIT,
- JET_FIELD_FOCUS,
- JET_FIELD_BLUR,
- JET_FIELD_KEYSTROKE,
- JET_FIELD_VALIDATE,
- JET_FIELD_CALCULATE,
- JET_FIELD_FORMAT,
- JET_SCREEN_FOCUS,
- JET_SCREEN_BLUR,
- JET_SCREEN_OPEN,
- JET_SCREEN_CLOSE,
- JET_SCREEN_MOUSEDOWN,
- JET_SCREEN_MOUSEUP,
- JET_SCREEN_MOUSEENTER,
- JET_SCREEN_MOUSEEXIT,
- JET_SCREEN_INVIEW,
- JET_SCREEN_OUTVIEW,
- JET_BATCH_EXEC,
- JET_MENU_EXEC,
- JET_CONSOLE_EXEC,
- JET_EXTERNAL_EXEC,
- JET_BOOKMARK_MOUSEUP,
- JET_LINK_MOUSEUP
+enum JS_EVENT_T {
+ JET_UNKNOWN,
+ JET_APP_INIT,
+ JET_DOC_OPEN,
+ JET_DOC_WILLPRINT,
+ JET_DOC_DIDPRINT,
+ JET_DOC_WILLSAVE,
+ JET_DOC_DIDSAVE,
+ JET_DOC_WILLCLOSE,
+ JET_PAGE_OPEN,
+ JET_PAGE_CLOSE,
+ JET_PAGE_INVIEW,
+ JET_PAGE_OUTVIEW,
+ JET_FIELD_MOUSEDOWN,
+ JET_FIELD_MOUSEUP,
+ JET_FIELD_MOUSEENTER,
+ JET_FIELD_MOUSEEXIT,
+ JET_FIELD_FOCUS,
+ JET_FIELD_BLUR,
+ JET_FIELD_KEYSTROKE,
+ JET_FIELD_VALIDATE,
+ JET_FIELD_CALCULATE,
+ JET_FIELD_FORMAT,
+ JET_SCREEN_FOCUS,
+ JET_SCREEN_BLUR,
+ JET_SCREEN_OPEN,
+ JET_SCREEN_CLOSE,
+ JET_SCREEN_MOUSEDOWN,
+ JET_SCREEN_MOUSEUP,
+ JET_SCREEN_MOUSEENTER,
+ JET_SCREEN_MOUSEEXIT,
+ JET_SCREEN_INVIEW,
+ JET_SCREEN_OUTVIEW,
+ JET_BATCH_EXEC,
+ JET_MENU_EXEC,
+ JET_CONSOLE_EXEC,
+ JET_EXTERNAL_EXEC,
+ JET_BOOKMARK_MOUSEUP,
+ JET_LINK_MOUSEUP
};
-class CJS_EventHandler
-{
-public:
- CJS_EventHandler(CJS_Context * pContext);
- virtual ~CJS_EventHandler();
-
- void OnApp_Init();
-
- void OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName);
- void OnDoc_WillPrint(CPDFSDK_Document* pDoc);
- void OnDoc_DidPrint(CPDFSDK_Document* pDoc);
- void OnDoc_WillSave(CPDFSDK_Document* pDoc);
- void OnDoc_DidSave(CPDFSDK_Document* pDoc);
- void OnDoc_WillClose(CPDFSDK_Document* pDoc);
-
- void OnPage_Open(CPDFSDK_Document* pDoc);
- void OnPage_Close(CPDFSDK_Document* pDoc);
- void OnPage_InView(CPDFSDK_Document* pTarget);
- void OnPage_OutView(CPDFSDK_Document* pTarget);
-
- void OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc);
- void OnField_Format(CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit);
- void OnField_Keystroke(CFX_WideString& strChange, const CFX_WideString& strChangeEx,
- FX_BOOL KeyDown, FX_BOOL bModifier, int &nSelEnd,int &nSelStart, FX_BOOL bShift,
- CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit,
- FX_BOOL bFieldFull, FX_BOOL &bRc);
- void OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown,
- FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc);
-
- void OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- void OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- void OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- void OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- void OnField_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value);
- void OnField_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value);
-
- void OnScreen_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_Close(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_InView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
-
- void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark);
- void OnLink_MouseUp(CPDFSDK_Document* pTarget);
-
- void OnMenu_Exec(CPDFSDK_Document* pTarget, const CFX_WideString& strTargetName);
- void OnBatchExec(CPDFSDK_Document *pTarget);
- void OnConsole_Exec();
- void OnExternal_Exec();
-
-public:
- void Initial(JS_EVENT_T type);
- void Destroy();
- FX_BOOL IsValid();
-
-
- CFX_WideString& Change();
- CFX_WideString ChangeEx();
- int CommitKey();
- FX_BOOL FieldFull();
- FX_BOOL KeyDown();
- FX_BOOL Modifier();
- const FX_WCHAR* Name();
- const FX_WCHAR* Type();
- FX_BOOL& Rc();
- int& SelEnd();
- int& SelStart();
- FX_BOOL Shift();
- Field* Source();
- Field* Target_Field();
- CFX_WideString& Value();
- FX_BOOL WillCommit();
- CFX_WideString TargetName();
-
- JS_EVENT_T EventType() {return m_eEventType;};
-
-public:
- CJS_Context* m_pJSContext;
- JS_EVENT_T m_eEventType;
- FX_BOOL m_bValid;
-
- CFX_WideString m_strTargetName;
- CFX_WideString m_strSourceName;
- CFX_WideString* m_pWideStrChange;
- CFX_WideString m_WideStrChangeDu;
- CFX_WideString m_WideStrChangeEx;
- int m_nCommitKey;
- FX_BOOL m_bKeyDown;
- FX_BOOL m_bModifier;
- FX_BOOL m_bShift;
- int* m_pISelEnd;
- int m_nSelEndDu;
- int* m_pISelStart;
- int m_nSelStartDu;
- FX_BOOL m_bWillCommit;
- CFX_WideString* m_pValue;
- FX_BOOL m_bFieldFull;
- FX_BOOL* m_pbRc;
- FX_BOOL m_bRcDu;
-
- CPDFSDK_Document* m_pSourceDoc;
- CPDF_Bookmark* m_pTargetBookMark;
- CPDFSDK_Document* m_pTargetDoc;
- CPDFSDK_Annot* m_pTargetAnnot;
+class CJS_EventHandler {
+ public:
+ CJS_EventHandler(CJS_Context* pContext);
+ virtual ~CJS_EventHandler();
+
+ void OnApp_Init();
+
+ void OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName);
+ void OnDoc_WillPrint(CPDFSDK_Document* pDoc);
+ void OnDoc_DidPrint(CPDFSDK_Document* pDoc);
+ void OnDoc_WillSave(CPDFSDK_Document* pDoc);
+ void OnDoc_DidSave(CPDFSDK_Document* pDoc);
+ void OnDoc_WillClose(CPDFSDK_Document* pDoc);
+
+ void OnPage_Open(CPDFSDK_Document* pDoc);
+ void OnPage_Close(CPDFSDK_Document* pDoc);
+ void OnPage_InView(CPDFSDK_Document* pTarget);
+ void OnPage_OutView(CPDFSDK_Document* pTarget);
+
+ void OnField_Calculate(CPDF_FormField* pSource,
+ CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL& bRc);
+ void OnField_Format(CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL bWillCommit);
+ void OnField_Keystroke(CFX_WideString& strChange,
+ const CFX_WideString& strChangeEx,
+ FX_BOOL KeyDown,
+ FX_BOOL bModifier,
+ int& nSelEnd,
+ int& nSelStart,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL bWillCommit,
+ FX_BOOL bFieldFull,
+ FX_BOOL& bRc);
+ void OnField_Validate(CFX_WideString& strChange,
+ const CFX_WideString& strChangeEx,
+ FX_BOOL bKeyDown,
+ FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL& bRc);
+
+ void OnField_MouseDown(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget);
+ void OnField_MouseEnter(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget);
+ void OnField_MouseExit(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget);
+ void OnField_MouseUp(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget);
+ void OnField_Blur(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ const CFX_WideString& Value);
+ void OnField_Focus(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ const CFX_WideString& Value);
+
+ void OnScreen_Focus(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ void OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+ void OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+ void OnScreen_Close(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ void OnScreen_MouseDown(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ void OnScreen_MouseUp(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ void OnScreen_MouseEnter(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ void OnScreen_MouseExit(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ void OnScreen_InView(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ void OnScreen_OutView(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+
+ void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark);
+ void OnLink_MouseUp(CPDFSDK_Document* pTarget);
+
+ void OnMenu_Exec(CPDFSDK_Document* pTarget,
+ const CFX_WideString& strTargetName);
+ void OnBatchExec(CPDFSDK_Document* pTarget);
+ void OnConsole_Exec();
+ void OnExternal_Exec();
+
+ public:
+ void Initial(JS_EVENT_T type);
+ void Destroy();
+ FX_BOOL IsValid();
+
+ CFX_WideString& Change();
+ CFX_WideString ChangeEx();
+ int CommitKey();
+ FX_BOOL FieldFull();
+ FX_BOOL KeyDown();
+ FX_BOOL Modifier();
+ const FX_WCHAR* Name();
+ const FX_WCHAR* Type();
+ FX_BOOL& Rc();
+ int& SelEnd();
+ int& SelStart();
+ FX_BOOL Shift();
+ Field* Source();
+ Field* Target_Field();
+ CFX_WideString& Value();
+ FX_BOOL WillCommit();
+ CFX_WideString TargetName();
+
+ JS_EVENT_T EventType() { return m_eEventType; };
+
+ public:
+ CJS_Context* m_pJSContext;
+ JS_EVENT_T m_eEventType;
+ FX_BOOL m_bValid;
+
+ CFX_WideString m_strTargetName;
+ CFX_WideString m_strSourceName;
+ CFX_WideString* m_pWideStrChange;
+ CFX_WideString m_WideStrChangeDu;
+ CFX_WideString m_WideStrChangeEx;
+ int m_nCommitKey;
+ FX_BOOL m_bKeyDown;
+ FX_BOOL m_bModifier;
+ FX_BOOL m_bShift;
+ int* m_pISelEnd;
+ int m_nSelEndDu;
+ int* m_pISelStart;
+ int m_nSelStartDu;
+ FX_BOOL m_bWillCommit;
+ CFX_WideString* m_pValue;
+ FX_BOOL m_bFieldFull;
+ FX_BOOL* m_pbRc;
+ FX_BOOL m_bRcDu;
+
+ CPDFSDK_Document* m_pSourceDoc;
+ CPDF_Bookmark* m_pTargetBookMark;
+ CPDFSDK_Document* m_pTargetDoc;
+ CPDFSDK_Annot* m_pTargetAnnot;
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_EVENTHANDLER_H_
diff --git a/fpdfsdk/include/javascript/JS_GlobalData.h b/fpdfsdk/include/javascript/JS_GlobalData.h
index bbc0b12173..46b94a4dda 100644
--- a/fpdfsdk/include/javascript/JS_GlobalData.h
+++ b/fpdfsdk/include/javascript/JS_GlobalData.h
@@ -9,90 +9,95 @@
#include "../../../core/include/fxcrt/fx_basic.h"
-#define JS_GLOBALDATA_TYPE_NUMBER 0
-#define JS_GLOBALDATA_TYPE_BOOLEAN 1
-#define JS_GLOBALDATA_TYPE_STRING 2
-#define JS_GLOBALDATA_TYPE_OBJECT 3
-#define JS_GLOBALDATA_TYPE_NULL 4
+#define JS_GLOBALDATA_TYPE_NUMBER 0
+#define JS_GLOBALDATA_TYPE_BOOLEAN 1
+#define JS_GLOBALDATA_TYPE_STRING 2
+#define JS_GLOBALDATA_TYPE_OBJECT 3
+#define JS_GLOBALDATA_TYPE_NULL 4
class CJS_KeyValue;
class CPDFDoc_Environment;
-class CJS_GlobalVariableArray
-{
-public:
- CJS_GlobalVariableArray();
- virtual ~CJS_GlobalVariableArray();
+class CJS_GlobalVariableArray {
+ public:
+ CJS_GlobalVariableArray();
+ virtual ~CJS_GlobalVariableArray();
- void Add(CJS_KeyValue* p);
- int Count() const;
- CJS_KeyValue* GetAt(int index) const;
- void Copy(const CJS_GlobalVariableArray& array);
+ void Add(CJS_KeyValue* p);
+ int Count() const;
+ CJS_KeyValue* GetAt(int index) const;
+ void Copy(const CJS_GlobalVariableArray& array);
- void Empty();
+ void Empty();
-private:
- CFX_ArrayTemplate<CJS_KeyValue*> array;
+ private:
+ CFX_ArrayTemplate<CJS_KeyValue*> array;
};
-class CJS_KeyValue
-{
-public:
- CJS_KeyValue(){}
- virtual ~CJS_KeyValue(){}
-
- CFX_ByteString sKey;
- int nType; //0:int 1:bool 2:string 3:obj
- double dData;
- bool bData;
- CFX_ByteString sData;
- CJS_GlobalVariableArray objData;
+class CJS_KeyValue {
+ public:
+ CJS_KeyValue() {}
+ virtual ~CJS_KeyValue() {}
+
+ CFX_ByteString sKey;
+ int nType; // 0:int 1:bool 2:string 3:obj
+ double dData;
+ bool bData;
+ CFX_ByteString sData;
+ CJS_GlobalVariableArray objData;
};
-class CJS_GlobalData_Element
-{
-public:
- CJS_GlobalData_Element(){}
- virtual ~CJS_GlobalData_Element(){}
+class CJS_GlobalData_Element {
+ public:
+ CJS_GlobalData_Element() {}
+ virtual ~CJS_GlobalData_Element() {}
- CJS_KeyValue data;
- FX_BOOL bPersistent;
+ CJS_KeyValue data;
+ FX_BOOL bPersistent;
};
-class CJS_GlobalData
-{
-public:
- CJS_GlobalData(CPDFDoc_Environment* pApp);
- virtual ~CJS_GlobalData();
-
-public:
- void SetGlobalVariableNumber(const FX_CHAR* propname, double dData);
- void SetGlobalVariableBoolean(const FX_CHAR* propname, bool bData);
- void SetGlobalVariableString(const FX_CHAR* propname, const CFX_ByteString& sData);
- void SetGlobalVariableObject(const FX_CHAR* propname, const CJS_GlobalVariableArray& array);
- void SetGlobalVariableNull(const FX_CHAR* propname);
-
- FX_BOOL SetGlobalVariablePersistent(const FX_CHAR* propname, FX_BOOL bPersistent);
- FX_BOOL DeleteGlobalVariable(const FX_CHAR* propname);
-
- int32_t GetSize() const;
- CJS_GlobalData_Element* GetAt(int index) const;
-
-private:
- void LoadGlobalPersistentVariables();
- void SaveGlobalPersisitentVariables();
-
- CJS_GlobalData_Element* GetGlobalVariable(const FX_CHAR* propname);
- int FindGlobalVariable(const FX_CHAR* propname);
-
- void LoadFileBuffer(const FX_WCHAR* sFilePath, uint8_t*& pBuffer, int32_t& nLength);
- void WriteFileBuffer(const FX_WCHAR* sFilePath, const FX_CHAR* pBuffer, int32_t nLength);
- void MakeByteString(const CFX_ByteString& name, CJS_KeyValue* pData, CFX_BinaryBuf& sData);
-
-private:
- CFX_ArrayTemplate<CJS_GlobalData_Element*> m_arrayGlobalData;
- CFX_WideString m_sFilePath;
- CPDFDoc_Environment* m_pApp;
+class CJS_GlobalData {
+ public:
+ CJS_GlobalData(CPDFDoc_Environment* pApp);
+ virtual ~CJS_GlobalData();
+
+ public:
+ void SetGlobalVariableNumber(const FX_CHAR* propname, double dData);
+ void SetGlobalVariableBoolean(const FX_CHAR* propname, bool bData);
+ void SetGlobalVariableString(const FX_CHAR* propname,
+ const CFX_ByteString& sData);
+ void SetGlobalVariableObject(const FX_CHAR* propname,
+ const CJS_GlobalVariableArray& array);
+ void SetGlobalVariableNull(const FX_CHAR* propname);
+
+ FX_BOOL SetGlobalVariablePersistent(const FX_CHAR* propname,
+ FX_BOOL bPersistent);
+ FX_BOOL DeleteGlobalVariable(const FX_CHAR* propname);
+
+ int32_t GetSize() const;
+ CJS_GlobalData_Element* GetAt(int index) const;
+
+ private:
+ void LoadGlobalPersistentVariables();
+ void SaveGlobalPersisitentVariables();
+
+ CJS_GlobalData_Element* GetGlobalVariable(const FX_CHAR* propname);
+ int FindGlobalVariable(const FX_CHAR* propname);
+
+ void LoadFileBuffer(const FX_WCHAR* sFilePath,
+ uint8_t*& pBuffer,
+ int32_t& nLength);
+ void WriteFileBuffer(const FX_WCHAR* sFilePath,
+ const FX_CHAR* pBuffer,
+ int32_t nLength);
+ void MakeByteString(const CFX_ByteString& name,
+ CJS_KeyValue* pData,
+ CFX_BinaryBuf& sData);
+
+ private:
+ CFX_ArrayTemplate<CJS_GlobalData_Element*> m_arrayGlobalData;
+ CFX_WideString m_sFilePath;
+ CPDFDoc_Environment* m_pApp;
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_GLOBALDATA_H_
diff --git a/fpdfsdk/include/javascript/JS_Object.h b/fpdfsdk/include/javascript/JS_Object.h
index abfc818079..fe8a91f471 100644
--- a/fpdfsdk/include/javascript/JS_Object.h
+++ b/fpdfsdk/include/javascript/JS_Object.h
@@ -7,8 +7,8 @@
#ifndef FPDFSDK_INCLUDE_JAVASCRIPT_JS_OBJECT_H_
#define FPDFSDK_INCLUDE_JAVASCRIPT_JS_OBJECT_H_
-#include "../fsdk_define.h" // For FX_UINT
-#include "../fsdk_mgr.h" // For CPDFDoc_Environment
+#include "../fsdk_define.h" // For FX_UINT
+#include "../fsdk_mgr.h" // For CPDFDoc_Environment
#include "../fx_systemhandler.h" // For IFX_SystemHandler
#include "../jsapi/fxjs_v8.h"
@@ -17,284 +17,233 @@ class CJS_Object;
class CJS_Timer;
class CJS_Context;
-class CJS_EmbedObj
-{
-public:
- CJS_EmbedObj(CJS_Object* pJSObject);
- virtual ~CJS_EmbedObj();
+class CJS_EmbedObj {
+ public:
+ CJS_EmbedObj(CJS_Object* pJSObject);
+ virtual ~CJS_EmbedObj();
- virtual void TimerProc(CJS_Timer* pTimer){};
+ virtual void TimerProc(CJS_Timer* pTimer){};
- CJS_Timer* BeginTimer(CPDFDoc_Environment * pApp, FX_UINT nElapse);
- void EndTimer(CJS_Timer* pTimer);
+ CJS_Timer* BeginTimer(CPDFDoc_Environment* pApp, FX_UINT nElapse);
+ void EndTimer(CJS_Timer* pTimer);
- CJS_Object* GetJSObject(){return m_pJSObject;};
- operator CJS_Object* (){return m_pJSObject;};
+ CJS_Object* GetJSObject() { return m_pJSObject; };
+ operator CJS_Object*() { return m_pJSObject; };
- CPDFSDK_PageView * JSGetPageView(IFXJS_Context* cc);
- int MsgBox(CPDFDoc_Environment* pApp, CPDFSDK_PageView* pPageView, const FX_WCHAR* swMsg, const FX_WCHAR* swTitle = NULL, FX_UINT nType = 0, FX_UINT nIcon = 0);
- void Alert(CJS_Context* pContext, const FX_WCHAR* swMsg);
+ CPDFSDK_PageView* JSGetPageView(IFXJS_Context* cc);
+ int MsgBox(CPDFDoc_Environment* pApp,
+ CPDFSDK_PageView* pPageView,
+ const FX_WCHAR* swMsg,
+ const FX_WCHAR* swTitle = NULL,
+ FX_UINT nType = 0,
+ FX_UINT nIcon = 0);
+ void Alert(CJS_Context* pContext, const FX_WCHAR* swMsg);
-protected:
- CJS_Object* m_pJSObject;
+ protected:
+ CJS_Object* m_pJSObject;
};
-class CJS_Object
-{
-public:
- CJS_Object(JSFXObject pObject);
- virtual ~CJS_Object(void);
+class CJS_Object {
+ public:
+ CJS_Object(JSFXObject pObject);
+ virtual ~CJS_Object(void);
- void MakeWeak();
- void Dispose();
+ void MakeWeak();
+ void Dispose();
- virtual FX_BOOL IsType(const FX_CHAR* sClassName){return TRUE;};
- virtual CFX_ByteString GetClassName(){return "";};
+ virtual FX_BOOL IsType(const FX_CHAR* sClassName) { return TRUE; };
+ virtual CFX_ByteString GetClassName() { return ""; };
- virtual FX_BOOL InitInstance(IFXJS_Context* cc){return TRUE;};
- virtual FX_BOOL ExitInstance(){return TRUE;};
+ virtual FX_BOOL InitInstance(IFXJS_Context* cc) { return TRUE; };
+ virtual FX_BOOL ExitInstance() { return TRUE; };
- operator JSFXObject () {return v8::Local<v8::Object>::New(m_pIsolate, m_pObject);}
- operator CJS_EmbedObj* (){return m_pEmbedObj;};
+ operator JSFXObject() {
+ return v8::Local<v8::Object>::New(m_pIsolate, m_pObject);
+ }
+ operator CJS_EmbedObj*() { return m_pEmbedObj; };
- void SetEmbedObject(CJS_EmbedObj* pObj){m_pEmbedObj = pObj;};
- CJS_EmbedObj * GetEmbedObject(){return m_pEmbedObj;};
+ void SetEmbedObject(CJS_EmbedObj* pObj) { m_pEmbedObj = pObj; };
+ CJS_EmbedObj* GetEmbedObject() { return m_pEmbedObj; };
- static CPDFSDK_PageView * JSGetPageView(IFXJS_Context* cc);
- static int MsgBox(CPDFDoc_Environment* pApp, CPDFSDK_PageView* pPageView, const FX_WCHAR* swMsg, const FX_WCHAR* swTitle = NULL, FX_UINT nType = 0,FX_UINT nIcon = 0);
- static void Alert(CJS_Context* pContext, const FX_WCHAR* swMsg);
+ static CPDFSDK_PageView* JSGetPageView(IFXJS_Context* cc);
+ static int MsgBox(CPDFDoc_Environment* pApp,
+ CPDFSDK_PageView* pPageView,
+ const FX_WCHAR* swMsg,
+ const FX_WCHAR* swTitle = NULL,
+ FX_UINT nType = 0,
+ FX_UINT nIcon = 0);
+ static void Alert(CJS_Context* pContext, const FX_WCHAR* swMsg);
- v8::Isolate* GetIsolate() {return m_pIsolate;}
-protected:
- CJS_EmbedObj * m_pEmbedObj;
- v8::Global<v8::Object> m_pObject;
- v8::Isolate* m_pIsolate;
+ v8::Isolate* GetIsolate() { return m_pIsolate; }
+
+ protected:
+ CJS_EmbedObj* m_pEmbedObj;
+ v8::Global<v8::Object> m_pObject;
+ v8::Isolate* m_pIsolate;
};
-struct JS_TIMER_MAP
-{
- FX_UINT nID;
- CJS_Timer * pTimer;
+struct JS_TIMER_MAP {
+ FX_UINT nID;
+ CJS_Timer* pTimer;
};
-typedef CFX_ArrayTemplate<JS_TIMER_MAP*> CTimerMapArray;
-
-struct JS_TIMER_MAPARRAY
-{
-public:
- JS_TIMER_MAPARRAY()
- {
- }
-
- ~JS_TIMER_MAPARRAY()
- {
- Reset();
- }
-
- void Reset()
- {
- for (int i=0,sz=m_Array.GetSize(); i<sz; i++)
- delete m_Array.GetAt(i);
-
- m_Array.RemoveAll();
- }
-
- void SetAt(FX_UINT nIndex,CJS_Timer * pTimer)
- {
- int i = Find(nIndex);
-
- if (i>=0)
- {
- if (JS_TIMER_MAP * pMap = m_Array.GetAt(i))
- pMap->pTimer = pTimer;
- }
- else
- {
- if (JS_TIMER_MAP * pMap = new JS_TIMER_MAP)
- {
- pMap->nID = nIndex;
- pMap->pTimer = pTimer;
- m_Array.Add(pMap);
- }
- }
- }
-
- CJS_Timer * GetAt(FX_UINT nIndex)
- {
- int i = Find(nIndex);
-
- if (i>=0)
- {
- if (JS_TIMER_MAP * pMap = m_Array.GetAt(i))
- return pMap->pTimer;
- }
- return NULL;
- }
-
- void RemoveAt(FX_UINT nIndex)
- {
- int i = Find(nIndex);
-
- if (i>=0)
- {
- delete m_Array.GetAt(i);
- m_Array.RemoveAt(i);
- }
- //To prevent potential fake memory leak reported by vc6.
- if(m_Array.GetSize() == 0)
- m_Array.RemoveAll();
- }
-
- int Find(FX_UINT nIndex)
- {
- for (int i=0,sz=m_Array.GetSize(); i<sz; i++)
- {
- if (JS_TIMER_MAP * pMap = m_Array.GetAt(i))
- {
- if (pMap->nID == nIndex)
- return i;
- }
- }
-
- return -1;
- }
-
- CTimerMapArray m_Array;
+typedef CFX_ArrayTemplate<JS_TIMER_MAP*> CTimerMapArray;
+
+struct JS_TIMER_MAPARRAY {
+ public:
+ JS_TIMER_MAPARRAY() {}
+
+ ~JS_TIMER_MAPARRAY() { Reset(); }
+
+ void Reset() {
+ for (int i = 0, sz = m_Array.GetSize(); i < sz; i++)
+ delete m_Array.GetAt(i);
+
+ m_Array.RemoveAll();
+ }
+
+ void SetAt(FX_UINT nIndex, CJS_Timer* pTimer) {
+ int i = Find(nIndex);
+
+ if (i >= 0) {
+ if (JS_TIMER_MAP* pMap = m_Array.GetAt(i))
+ pMap->pTimer = pTimer;
+ } else {
+ if (JS_TIMER_MAP* pMap = new JS_TIMER_MAP) {
+ pMap->nID = nIndex;
+ pMap->pTimer = pTimer;
+ m_Array.Add(pMap);
+ }
+ }
+ }
+
+ CJS_Timer* GetAt(FX_UINT nIndex) {
+ int i = Find(nIndex);
+
+ if (i >= 0) {
+ if (JS_TIMER_MAP* pMap = m_Array.GetAt(i))
+ return pMap->pTimer;
+ }
+ return NULL;
+ }
+
+ void RemoveAt(FX_UINT nIndex) {
+ int i = Find(nIndex);
+
+ if (i >= 0) {
+ delete m_Array.GetAt(i);
+ m_Array.RemoveAt(i);
+ }
+ // To prevent potential fake memory leak reported by vc6.
+ if (m_Array.GetSize() == 0)
+ m_Array.RemoveAll();
+ }
+
+ int Find(FX_UINT nIndex) {
+ for (int i = 0, sz = m_Array.GetSize(); i < sz; i++) {
+ if (JS_TIMER_MAP* pMap = m_Array.GetAt(i)) {
+ if (pMap->nID == nIndex)
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ CTimerMapArray m_Array;
};
JS_TIMER_MAPARRAY& GetTimeMap();
class CJS_Runtime;
-class CJS_Timer
-{
-public:
- CJS_Timer(CJS_EmbedObj * pObj, CPDFDoc_Environment* pApp):
- m_nTimerID(0),
- m_pEmbedObj(pObj),
- m_bProcessing(FALSE),
- m_dwStartTime(0),
- m_dwTimeOut(0),
- m_dwElapse(0),
- m_pRuntime(NULL),
- m_nType(0),
- m_pApp(pApp)
- {
- }
-
- virtual ~CJS_Timer()
- {
- KillJSTimer();
- }
-
-public:
- FX_UINT SetJSTimer(FX_UINT nElapse)
- {
- if (m_nTimerID)KillJSTimer();
- IFX_SystemHandler* pHandler = m_pApp->GetSysHandler();
- m_nTimerID = pHandler->SetTimer(nElapse,TimerProc);
- GetTimeMap().SetAt(m_nTimerID,this);
- m_dwElapse = nElapse;
- return m_nTimerID;
- };
-
- void KillJSTimer()
- {
- if (m_nTimerID)
- {
- if (m_pApp == NULL) {
- GetTimeMap().RemoveAt(m_nTimerID);
- m_nTimerID = 0;
- return;
- }
- IFX_SystemHandler* pHandler = m_pApp->GetSysHandler();
- pHandler->KillTimer(m_nTimerID);
- GetTimeMap().RemoveAt(m_nTimerID);
- m_nTimerID = 0;
- }
- };
-
- void SetType(int nType)
- {
- m_nType = nType;
- }
-
- int GetType() const
- {
- return m_nType;
- }
-
- void SetStartTime(FX_DWORD dwStartTime)
- {
- m_dwStartTime = dwStartTime;
- }
-
- FX_DWORD GetStartTime() const
- {
- return m_dwStartTime;
- }
-
- void SetTimeOut(FX_DWORD dwTimeOut)
- {
- m_dwTimeOut = dwTimeOut;
- }
-
- FX_DWORD GetTimeOut() const
- {
- return m_dwTimeOut;
- }
-
- void SetRuntime(CJS_Runtime* pRuntime)
- {
- m_pRuntime = pRuntime;
- }
-
- CJS_Runtime* GetRuntime() const
- {
- return m_pRuntime;
- }
-
- void SetJScript(const CFX_WideString& script)
- {
- m_swJScript = script;
- }
-
- CFX_WideString GetJScript() const
- {
- return m_swJScript;
- }
-
- static void TimerProc(int idEvent)
- {
- if (CJS_Timer * pTimer = GetTimeMap().GetAt(idEvent))
- {
- if (!pTimer->m_bProcessing)
- {
- pTimer->m_bProcessing = TRUE;
- if (pTimer->m_pEmbedObj) pTimer->m_pEmbedObj->TimerProc(pTimer);
- pTimer->m_bProcessing = FALSE;
- }
- else
- {
- // TRACE(L"BUSY!\n");
- }
- }
- };
-
-private:
- FX_UINT m_nTimerID;
- CJS_EmbedObj* m_pEmbedObj;
- FX_BOOL m_bProcessing;
-
- //data
- FX_DWORD m_dwStartTime;
- FX_DWORD m_dwTimeOut;
- FX_DWORD m_dwElapse;
- CJS_Runtime* m_pRuntime;
- CFX_WideString m_swJScript;
- int m_nType; //0:Interval; 1:TimeOut
-
- CPDFDoc_Environment* m_pApp;
+class CJS_Timer {
+ public:
+ CJS_Timer(CJS_EmbedObj* pObj, CPDFDoc_Environment* pApp)
+ : m_nTimerID(0),
+ m_pEmbedObj(pObj),
+ m_bProcessing(FALSE),
+ m_dwStartTime(0),
+ m_dwTimeOut(0),
+ m_dwElapse(0),
+ m_pRuntime(NULL),
+ m_nType(0),
+ m_pApp(pApp) {}
+
+ virtual ~CJS_Timer() { KillJSTimer(); }
+
+ public:
+ FX_UINT SetJSTimer(FX_UINT nElapse) {
+ if (m_nTimerID)
+ KillJSTimer();
+ IFX_SystemHandler* pHandler = m_pApp->GetSysHandler();
+ m_nTimerID = pHandler->SetTimer(nElapse, TimerProc);
+ GetTimeMap().SetAt(m_nTimerID, this);
+ m_dwElapse = nElapse;
+ return m_nTimerID;
+ };
+
+ void KillJSTimer() {
+ if (m_nTimerID) {
+ if (m_pApp == NULL) {
+ GetTimeMap().RemoveAt(m_nTimerID);
+ m_nTimerID = 0;
+ return;
+ }
+ IFX_SystemHandler* pHandler = m_pApp->GetSysHandler();
+ pHandler->KillTimer(m_nTimerID);
+ GetTimeMap().RemoveAt(m_nTimerID);
+ m_nTimerID = 0;
+ }
+ };
+
+ void SetType(int nType) { m_nType = nType; }
+
+ int GetType() const { return m_nType; }
+
+ void SetStartTime(FX_DWORD dwStartTime) { m_dwStartTime = dwStartTime; }
+
+ FX_DWORD GetStartTime() const { return m_dwStartTime; }
+
+ void SetTimeOut(FX_DWORD dwTimeOut) { m_dwTimeOut = dwTimeOut; }
+
+ FX_DWORD GetTimeOut() const { return m_dwTimeOut; }
+
+ void SetRuntime(CJS_Runtime* pRuntime) { m_pRuntime = pRuntime; }
+
+ CJS_Runtime* GetRuntime() const { return m_pRuntime; }
+
+ void SetJScript(const CFX_WideString& script) { m_swJScript = script; }
+
+ CFX_WideString GetJScript() const { return m_swJScript; }
+
+ static void TimerProc(int idEvent) {
+ if (CJS_Timer* pTimer = GetTimeMap().GetAt(idEvent)) {
+ if (!pTimer->m_bProcessing) {
+ pTimer->m_bProcessing = TRUE;
+ if (pTimer->m_pEmbedObj)
+ pTimer->m_pEmbedObj->TimerProc(pTimer);
+ pTimer->m_bProcessing = FALSE;
+ } else {
+ // TRACE(L"BUSY!\n");
+ }
+ }
+ };
+
+ private:
+ FX_UINT m_nTimerID;
+ CJS_EmbedObj* m_pEmbedObj;
+ FX_BOOL m_bProcessing;
+
+ // data
+ FX_DWORD m_dwStartTime;
+ FX_DWORD m_dwTimeOut;
+ FX_DWORD m_dwElapse;
+ CJS_Runtime* m_pRuntime;
+ CFX_WideString m_swJScript;
+ int m_nType; // 0:Interval; 1:TimeOut
+
+ CPDFDoc_Environment* m_pApp;
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_OBJECT_H_
diff --git a/fpdfsdk/include/javascript/JS_Runtime.h b/fpdfsdk/include/javascript/JS_Runtime.h
index 20d7d63eff..1fb0348263 100644
--- a/fpdfsdk/include/javascript/JS_Runtime.h
+++ b/fpdfsdk/include/javascript/JS_Runtime.h
@@ -16,63 +16,65 @@
class CJS_Context;
class CJS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
- void* Allocate(size_t length) override;
- void* AllocateUninitialized(size_t length) override;
- void Free(void* data, size_t length) override;
+ void* Allocate(size_t length) override;
+ void* AllocateUninitialized(size_t length) override;
+ void Free(void* data, size_t length) override;
};
-class CJS_FieldEvent
-{
-public:
- CFX_WideString sTargetName;
- JS_EVENT_T eEventType;
- CJS_FieldEvent* pNext;
+class CJS_FieldEvent {
+ public:
+ CFX_WideString sTargetName;
+ JS_EVENT_T eEventType;
+ CJS_FieldEvent* pNext;
};
-class CJS_Runtime : public IFXJS_Runtime
-{
-public:
- CJS_Runtime(CPDFDoc_Environment * pApp);
- virtual ~CJS_Runtime();
+class CJS_Runtime : public IFXJS_Runtime {
+ public:
+ CJS_Runtime(CPDFDoc_Environment* pApp);
+ virtual ~CJS_Runtime();
- virtual IFXJS_Context * NewContext();
- virtual void ReleaseContext(IFXJS_Context * pContext);
- virtual IFXJS_Context* GetCurrentContext();
+ virtual IFXJS_Context* NewContext();
+ virtual void ReleaseContext(IFXJS_Context* pContext);
+ virtual IFXJS_Context* GetCurrentContext();
- virtual void SetReaderDocument(CPDFSDK_Document *pReaderDoc);
- virtual CPDFSDK_Document * GetReaderDocument(){return m_pDocument;}
+ virtual void SetReaderDocument(CPDFSDK_Document* pReaderDoc);
+ virtual CPDFSDK_Document* GetReaderDocument() { return m_pDocument; }
- CPDFDoc_Environment * GetReaderApp(){return m_pApp;}
+ CPDFDoc_Environment* GetReaderApp() { return m_pApp; }
- FX_BOOL InitJSObjects();
+ FX_BOOL InitJSObjects();
- FX_BOOL AddEventToLoop(const CFX_WideString& sTargetName, JS_EVENT_T eEventType);
- void RemoveEventInLoop(const CFX_WideString& sTargetName, JS_EVENT_T eEventType);
- void RemoveEventsInLoop(CJS_FieldEvent* pStart);
+ FX_BOOL AddEventToLoop(const CFX_WideString& sTargetName,
+ JS_EVENT_T eEventType);
+ void RemoveEventInLoop(const CFX_WideString& sTargetName,
+ JS_EVENT_T eEventType);
+ void RemoveEventsInLoop(CJS_FieldEvent* pStart);
- void BeginBlock(){m_bBlocking = TRUE;}
- void EndBlock(){m_bBlocking = FALSE;}
- FX_BOOL IsBlocking(){return m_bBlocking;}
+ void BeginBlock() { m_bBlocking = TRUE; }
+ void EndBlock() { m_bBlocking = FALSE; }
+ FX_BOOL IsBlocking() { return m_bBlocking; }
- operator IJS_Runtime*() {return (IJS_Runtime*)m_isolate;}
- v8::Isolate* GetIsolate(){return m_isolate;};
- void SetIsolate(v8::Isolate* isolate){m_isolate = isolate;}
+ operator IJS_Runtime*() { return (IJS_Runtime*)m_isolate; }
+ v8::Isolate* GetIsolate() { return m_isolate; };
+ void SetIsolate(v8::Isolate* isolate) { m_isolate = isolate; }
- v8::Local<v8::Context> NewJSContext();
+ v8::Local<v8::Context> NewJSContext();
+ virtual FX_BOOL GetHValueByName(const CFX_ByteStringC& utf8Name,
+ FXJSE_HVALUE hValue);
+ virtual FX_BOOL SetHValueByName(const CFX_ByteStringC& utf8Name,
+ FXJSE_HVALUE hValue);
- virtual FX_BOOL GetHValueByName(const CFX_ByteStringC& utf8Name, FXJSE_HVALUE hValue);
- virtual FX_BOOL SetHValueByName(const CFX_ByteStringC& utf8Name, FXJSE_HVALUE hValue);
-protected:
- CFX_ArrayTemplate<CJS_Context*> m_ContextArray;
- CPDFDoc_Environment* m_pApp;
- CPDFSDK_Document* m_pDocument;
- FX_BOOL m_bBlocking;
- CJS_FieldEvent* m_pFieldEventPath;
+ protected:
+ CFX_ArrayTemplate<CJS_Context*> m_ContextArray;
+ CPDFDoc_Environment* m_pApp;
+ CPDFSDK_Document* m_pDocument;
+ FX_BOOL m_bBlocking;
+ CJS_FieldEvent* m_pFieldEventPath;
- v8::Isolate* m_isolate;
- nonstd::unique_ptr<CJS_ArrayBufferAllocator> m_pArrayBufferAllocator;
- v8::Global<v8::Context> m_context;
+ v8::Isolate* m_isolate;
+ nonstd::unique_ptr<CJS_ArrayBufferAllocator> m_pArrayBufferAllocator;
+ v8::Global<v8::Context> m_context;
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_RUNTIME_H_
diff --git a/fpdfsdk/include/javascript/JS_Value.h b/fpdfsdk/include/javascript/JS_Value.h
index 6186817fa5..1606fb5396 100644
--- a/fpdfsdk/include/javascript/JS_Value.h
+++ b/fpdfsdk/include/javascript/JS_Value.h
@@ -15,175 +15,179 @@ class CJS_Date;
class CJS_Document;
class CJS_Object;
-class CJS_Value
-{
-public:
- CJS_Value(v8::Isolate* isolate);
- CJS_Value(v8::Isolate* isolate, v8::Local<v8::Value> pValue,FXJSVALUETYPE t);
- CJS_Value(v8::Isolate* isolate, const int &iValue);
- CJS_Value(v8::Isolate* isolate, const double &dValue);
- CJS_Value(v8::Isolate* isolate, const float &fValue);
- CJS_Value(v8::Isolate* isolate, const bool &bValue);
- CJS_Value(v8::Isolate* isolate, JSFXObject);
- CJS_Value(v8::Isolate* isolate, CJS_Object*);
- CJS_Value(v8::Isolate* isolate, CJS_Document*);
- CJS_Value(v8::Isolate* isolate, const FX_CHAR* pStr);
- CJS_Value(v8::Isolate* isolate, const FX_WCHAR* pWstr);
- CJS_Value(v8::Isolate* isolate, CJS_Array& array);
-
- ~CJS_Value();
-
- void SetNull();
- void Attach(v8::Local<v8::Value> pValue,FXJSVALUETYPE t);
- void Attach(CJS_Value *pValue);
- void Detach();
-
-
- int ToInt() const;
- bool ToBool() const;
- double ToDouble() const;
- float ToFloat() const;
- CJS_Object* ToCJSObject() const;
- CFX_WideString ToCFXWideString() const;
- CFX_ByteString ToCFXByteString() const;
- v8::Local<v8::Object> ToV8Object() const;
- v8::Local<v8::Array> ToV8Array() const;
- v8::Local<v8::Value> ToV8Value() const;
-
- void operator = (int iValue);
- void operator = (bool bValue);
- void operator = (double);
- void operator = (float);
- void operator = (CJS_Object*);
- void operator = (CJS_Document*);
- void operator = (v8::Local<v8::Object>);
- void operator = (CJS_Array &);
- void operator = (CJS_Date &);
- void operator = (const FX_WCHAR* pWstr);
- void operator = (const FX_CHAR* pStr);
- void operator = (CJS_Value value);
-
- FX_BOOL IsArrayObject() const;
- FX_BOOL IsDateObject() const;
- FXJSVALUETYPE GetType() const;
-
- FX_BOOL ConvertToArray(CJS_Array &) const;
- FX_BOOL ConvertToDate(CJS_Date &) const;
-
- v8::Isolate* GetIsolate() {return m_isolate;}
-protected:
- v8::Local<v8::Value> m_pValue;
- FXJSVALUETYPE m_eType;
- v8::Isolate* m_isolate;
+class CJS_Value {
+ public:
+ CJS_Value(v8::Isolate* isolate);
+ CJS_Value(v8::Isolate* isolate, v8::Local<v8::Value> pValue, FXJSVALUETYPE t);
+ CJS_Value(v8::Isolate* isolate, const int& iValue);
+ CJS_Value(v8::Isolate* isolate, const double& dValue);
+ CJS_Value(v8::Isolate* isolate, const float& fValue);
+ CJS_Value(v8::Isolate* isolate, const bool& bValue);
+ CJS_Value(v8::Isolate* isolate, JSFXObject);
+ CJS_Value(v8::Isolate* isolate, CJS_Object*);
+ CJS_Value(v8::Isolate* isolate, CJS_Document*);
+ CJS_Value(v8::Isolate* isolate, const FX_CHAR* pStr);
+ CJS_Value(v8::Isolate* isolate, const FX_WCHAR* pWstr);
+ CJS_Value(v8::Isolate* isolate, CJS_Array& array);
+
+ ~CJS_Value();
+
+ void SetNull();
+ void Attach(v8::Local<v8::Value> pValue, FXJSVALUETYPE t);
+ void Attach(CJS_Value* pValue);
+ void Detach();
+
+ int ToInt() const;
+ bool ToBool() const;
+ double ToDouble() const;
+ float ToFloat() const;
+ CJS_Object* ToCJSObject() const;
+ CFX_WideString ToCFXWideString() const;
+ CFX_ByteString ToCFXByteString() const;
+ v8::Local<v8::Object> ToV8Object() const;
+ v8::Local<v8::Array> ToV8Array() const;
+ v8::Local<v8::Value> ToV8Value() const;
+
+ void operator=(int iValue);
+ void operator=(bool bValue);
+ void operator=(double);
+ void operator=(float);
+ void operator=(CJS_Object*);
+ void operator=(CJS_Document*);
+ void operator=(v8::Local<v8::Object>);
+ void operator=(CJS_Array&);
+ void operator=(CJS_Date&);
+ void operator=(const FX_WCHAR* pWstr);
+ void operator=(const FX_CHAR* pStr);
+ void operator=(CJS_Value value);
+
+ FX_BOOL IsArrayObject() const;
+ FX_BOOL IsDateObject() const;
+ FXJSVALUETYPE GetType() const;
+
+ FX_BOOL ConvertToArray(CJS_Array&) const;
+ FX_BOOL ConvertToDate(CJS_Date&) const;
+
+ v8::Isolate* GetIsolate() { return m_isolate; }
+
+ protected:
+ v8::Local<v8::Value> m_pValue;
+ FXJSVALUETYPE m_eType;
+ v8::Isolate* m_isolate;
};
-class CJS_Parameters : public CFX_ArrayTemplate<CJS_Value>
-{
-public:
- void push_back(const CJS_Value& newElement) {
- CFX_ArrayTemplate<CJS_Value>::Add(newElement);
- }
- int size() const {
- return CFX_ArrayTemplate<CJS_Value>::GetSize();
- }
+class CJS_Parameters : public CFX_ArrayTemplate<CJS_Value> {
+ public:
+ void push_back(const CJS_Value& newElement) {
+ CFX_ArrayTemplate<CJS_Value>::Add(newElement);
+ }
+ int size() const { return CFX_ArrayTemplate<CJS_Value>::GetSize(); }
};
-class CJS_PropValue: public CJS_Value
-{
-public:
- CJS_PropValue(const CJS_Value&);
- CJS_PropValue(v8::Isolate* isolate);
- ~CJS_PropValue();
-public:
- FX_BOOL IsSetting();
- FX_BOOL IsGetting();
- void operator<<(int);
- void operator>>(int&) const;
- void operator<<(bool);
- void operator>>(bool&) const;
- void operator<<(double);
- void operator>>(double&) const;
- void operator<<(CJS_Object* pObj);
- void operator>>(CJS_Object*& ppObj) const;
- void operator<<(CJS_Document* pJsDoc);
- void operator>>(CJS_Document*& ppJsDoc) const;
- void operator<<(CFX_ByteString);
- void operator>>(CFX_ByteString&) const;
- void operator<<(CFX_WideString);
- void operator>>(CFX_WideString&) const;
- void operator<<(const FX_WCHAR* c_string);
- void operator<<(JSFXObject);
- void operator>>(JSFXObject&) const;
- void operator>>(CJS_Array& array) const;
- void operator<<(CJS_Array& array);
- void operator<<(CJS_Date& date);
- void operator>>(CJS_Date& date) const;
- operator v8::Local<v8::Value>() const;
- void StartSetting();
- void StartGetting();
-private:
- FX_BOOL m_bIsSetting;
+class CJS_PropValue : public CJS_Value {
+ public:
+ CJS_PropValue(const CJS_Value&);
+ CJS_PropValue(v8::Isolate* isolate);
+ ~CJS_PropValue();
+
+ public:
+ FX_BOOL IsSetting();
+ FX_BOOL IsGetting();
+ void operator<<(int);
+ void operator>>(int&) const;
+ void operator<<(bool);
+ void operator>>(bool&) const;
+ void operator<<(double);
+ void operator>>(double&) const;
+ void operator<<(CJS_Object* pObj);
+ void operator>>(CJS_Object*& ppObj) const;
+ void operator<<(CJS_Document* pJsDoc);
+ void operator>>(CJS_Document*& ppJsDoc) const;
+ void operator<<(CFX_ByteString);
+ void operator>>(CFX_ByteString&) const;
+ void operator<<(CFX_WideString);
+ void operator>>(CFX_WideString&) const;
+ void operator<<(const FX_WCHAR* c_string);
+ void operator<<(JSFXObject);
+ void operator>>(JSFXObject&) const;
+ void operator>>(CJS_Array& array) const;
+ void operator<<(CJS_Array& array);
+ void operator<<(CJS_Date& date);
+ void operator>>(CJS_Date& date) const;
+ operator v8::Local<v8::Value>() const;
+ void StartSetting();
+ void StartGetting();
+
+ private:
+ FX_BOOL m_bIsSetting;
};
-class CJS_Array
-{
-public:
- CJS_Array(v8::Isolate* isolate);
- virtual ~CJS_Array();
-
- void Attach(v8::Local<v8::Array> pArray);
- void GetElement(unsigned index,CJS_Value &value);
- void SetElement(unsigned index,CJS_Value value);
- int GetLength();
- FX_BOOL IsAttached();
- operator v8::Local<v8::Array>();
-
- v8::Isolate* GetIsolate() {return m_isolate;}
-private:
- v8::Local<v8::Array> m_pArray;
- v8::Isolate* m_isolate;
+class CJS_Array {
+ public:
+ CJS_Array(v8::Isolate* isolate);
+ virtual ~CJS_Array();
+
+ void Attach(v8::Local<v8::Array> pArray);
+ void GetElement(unsigned index, CJS_Value& value);
+ void SetElement(unsigned index, CJS_Value value);
+ int GetLength();
+ FX_BOOL IsAttached();
+ operator v8::Local<v8::Array>();
+
+ v8::Isolate* GetIsolate() { return m_isolate; }
+
+ private:
+ v8::Local<v8::Array> m_pArray;
+ v8::Isolate* m_isolate;
};
-class CJS_Date
-{
-friend class CJS_Value;
-public:
- CJS_Date(v8::Isolate* isolate);
- CJS_Date(v8::Isolate* isolate,double dMsec_time);
- CJS_Date(v8::Isolate* isolate,int year, int mon, int day,int hour, int min, int sec);
- virtual ~CJS_Date();
- void Attach(v8::Local<v8::Value> pDate);
+class CJS_Date {
+ friend class CJS_Value;
+
+ public:
+ CJS_Date(v8::Isolate* isolate);
+ CJS_Date(v8::Isolate* isolate, double dMsec_time);
+ CJS_Date(v8::Isolate* isolate,
+ int year,
+ int mon,
+ int day,
+ int hour,
+ int min,
+ int sec);
+ virtual ~CJS_Date();
+ void Attach(v8::Local<v8::Value> pDate);
- int GetYear();
- void SetYear(int iYear);
+ int GetYear();
+ void SetYear(int iYear);
- int GetMonth();
- void SetMonth(int iMonth);
+ int GetMonth();
+ void SetMonth(int iMonth);
- int GetDay();
- void SetDay(int iDay);
+ int GetDay();
+ void SetDay(int iDay);
- int GetHours();
- void SetHours(int iHours);
+ int GetHours();
+ void SetHours(int iHours);
- int GetMinutes();
- void SetMinutes(int minutes);
+ int GetMinutes();
+ void SetMinutes(int minutes);
- int GetSeconds();
- void SetSeconds(int seconds);
+ int GetSeconds();
+ void SetSeconds(int seconds);
- operator v8::Local<v8::Value>();
- operator double() const;
+ operator v8::Local<v8::Value>();
+ operator double() const;
- CFX_WideString ToString() const;
+ CFX_WideString ToString() const;
- static double MakeDate(int year, int mon, int mday,int hour, int min, int sec,int ms);
+ static double
+ MakeDate(int year, int mon, int mday, int hour, int min, int sec, int ms);
- FX_BOOL IsValidDate();
+ FX_BOOL IsValidDate();
-protected:
- v8::Local<v8::Value> m_pDate;
- v8::Isolate* m_isolate;
+ protected:
+ v8::Local<v8::Value> m_pDate;
+ v8::Isolate* m_isolate;
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_VALUE_H_
diff --git a/fpdfsdk/include/javascript/PublicMethods.h b/fpdfsdk/include/javascript/PublicMethods.h
index cff9e11479..c5d5ea6d46 100644
--- a/fpdfsdk/include/javascript/PublicMethods.h
+++ b/fpdfsdk/include/javascript/PublicMethods.h
@@ -9,95 +9,177 @@
#include "JS_Define.h"
-class CJS_PublicMethods : public CJS_Object
-{
-public:
- CJS_PublicMethods(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_PublicMethods(void){};
+class CJS_PublicMethods : public CJS_Object {
+ public:
+ CJS_PublicMethods(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_PublicMethods(void){};
-public:
- static FX_BOOL AFNumber_Format(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFNumber_Keystroke(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFPercent_Format(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFPercent_Keystroke(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFDate_FormatEx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFDate_KeystrokeEx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFDate_Format(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFDate_Keystroke(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFTime_FormatEx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError); //
- static FX_BOOL AFTime_KeystrokeEx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFTime_Format(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFTime_Keystroke(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFSpecial_Format(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFSpecial_Keystroke(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFSpecial_KeystrokeEx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);//
- static FX_BOOL AFSimple(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFMakeNumber(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFSimple_Calculate(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFRange_Validate(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFMergeChange(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFParseDateEx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFExtractNums(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
+ public:
+ static FX_BOOL AFNumber_Format(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFNumber_Keystroke(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFPercent_Format(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFPercent_Keystroke(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFDate_FormatEx(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFDate_KeystrokeEx(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFDate_Format(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFDate_Keystroke(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFTime_FormatEx(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError); //
+ static FX_BOOL AFTime_KeystrokeEx(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFTime_Format(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFTime_Keystroke(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFSpecial_Format(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFSpecial_Keystroke(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFSpecial_KeystrokeEx(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError); //
+ static FX_BOOL AFSimple(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFMakeNumber(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFSimple_Calculate(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFRange_Validate(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFMergeChange(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFParseDateEx(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFExtractNums(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
-public:
- JS_STATIC_GLOBAL_FUN(AFNumber_Format);
- JS_STATIC_GLOBAL_FUN(AFNumber_Keystroke);
- JS_STATIC_GLOBAL_FUN(AFPercent_Format);
- JS_STATIC_GLOBAL_FUN(AFPercent_Keystroke);
- JS_STATIC_GLOBAL_FUN(AFDate_FormatEx);
- JS_STATIC_GLOBAL_FUN(AFDate_KeystrokeEx);
- JS_STATIC_GLOBAL_FUN(AFDate_Format);
- JS_STATIC_GLOBAL_FUN(AFDate_Keystroke);
- JS_STATIC_GLOBAL_FUN(AFTime_FormatEx);
- JS_STATIC_GLOBAL_FUN(AFTime_KeystrokeEx);
- JS_STATIC_GLOBAL_FUN(AFTime_Format);
- JS_STATIC_GLOBAL_FUN(AFTime_Keystroke);
- JS_STATIC_GLOBAL_FUN(AFSpecial_Format);
- JS_STATIC_GLOBAL_FUN(AFSpecial_Keystroke);
- JS_STATIC_GLOBAL_FUN(AFSpecial_KeystrokeEx);
- JS_STATIC_GLOBAL_FUN(AFSimple);
- JS_STATIC_GLOBAL_FUN(AFMakeNumber);
- JS_STATIC_GLOBAL_FUN(AFSimple_Calculate);
- JS_STATIC_GLOBAL_FUN(AFRange_Validate);
- JS_STATIC_GLOBAL_FUN(AFMergeChange);
- JS_STATIC_GLOBAL_FUN(AFParseDateEx);
- JS_STATIC_GLOBAL_FUN(AFExtractNums);
+ public:
+ JS_STATIC_GLOBAL_FUN(AFNumber_Format);
+ JS_STATIC_GLOBAL_FUN(AFNumber_Keystroke);
+ JS_STATIC_GLOBAL_FUN(AFPercent_Format);
+ JS_STATIC_GLOBAL_FUN(AFPercent_Keystroke);
+ JS_STATIC_GLOBAL_FUN(AFDate_FormatEx);
+ JS_STATIC_GLOBAL_FUN(AFDate_KeystrokeEx);
+ JS_STATIC_GLOBAL_FUN(AFDate_Format);
+ JS_STATIC_GLOBAL_FUN(AFDate_Keystroke);
+ JS_STATIC_GLOBAL_FUN(AFTime_FormatEx);
+ JS_STATIC_GLOBAL_FUN(AFTime_KeystrokeEx);
+ JS_STATIC_GLOBAL_FUN(AFTime_Format);
+ JS_STATIC_GLOBAL_FUN(AFTime_Keystroke);
+ JS_STATIC_GLOBAL_FUN(AFSpecial_Format);
+ JS_STATIC_GLOBAL_FUN(AFSpecial_Keystroke);
+ JS_STATIC_GLOBAL_FUN(AFSpecial_KeystrokeEx);
+ JS_STATIC_GLOBAL_FUN(AFSimple);
+ JS_STATIC_GLOBAL_FUN(AFMakeNumber);
+ JS_STATIC_GLOBAL_FUN(AFSimple_Calculate);
+ JS_STATIC_GLOBAL_FUN(AFRange_Validate);
+ JS_STATIC_GLOBAL_FUN(AFMergeChange);
+ JS_STATIC_GLOBAL_FUN(AFParseDateEx);
+ JS_STATIC_GLOBAL_FUN(AFExtractNums);
- JS_STATIC_DECLARE_GLOBAL_FUN();
+ JS_STATIC_DECLARE_GLOBAL_FUN();
-public:
- static int ParseStringInteger(const CFX_WideString & string,int nStart,int & nSkip, int nMaxStep);
- static CFX_WideString ParseStringString(const CFX_WideString& string, int nStart, int& nSkip);
- static double MakeRegularDate(const CFX_WideString & value,const CFX_WideString & format, FX_BOOL& bWrongFormat);
- static CFX_WideString MakeFormatDate(double dDate,const CFX_WideString & format);
- static FX_BOOL ConvertStringToNumber(const FX_WCHAR* swSource, double & dRet, FX_BOOL & bDot);
- static double ParseStringToNumber(const FX_WCHAR* swSource);
- static double ParseNormalDate(const CFX_WideString & value, FX_BOOL& bWrongFormat);
- static double MakeInterDate(CFX_WideString strValue);
- static double ParseNumber(const FX_WCHAR* swSource, FX_BOOL& bAllDigits, FX_BOOL& bDot, FX_BOOL& bSign, FX_BOOL& bKXJS);
+ public:
+ static int ParseStringInteger(const CFX_WideString& string,
+ int nStart,
+ int& nSkip,
+ int nMaxStep);
+ static CFX_WideString ParseStringString(const CFX_WideString& string,
+ int nStart,
+ int& nSkip);
+ static double MakeRegularDate(const CFX_WideString& value,
+ const CFX_WideString& format,
+ FX_BOOL& bWrongFormat);
+ static CFX_WideString MakeFormatDate(double dDate,
+ const CFX_WideString& format);
+ static FX_BOOL ConvertStringToNumber(const FX_WCHAR* swSource,
+ double& dRet,
+ FX_BOOL& bDot);
+ static double ParseStringToNumber(const FX_WCHAR* swSource);
+ static double ParseNormalDate(const CFX_WideString& value,
+ FX_BOOL& bWrongFormat);
+ static double MakeInterDate(CFX_WideString strValue);
+ static double ParseNumber(const FX_WCHAR* swSource,
+ FX_BOOL& bAllDigits,
+ FX_BOOL& bDot,
+ FX_BOOL& bSign,
+ FX_BOOL& bKXJS);
-public:
- static CFX_WideString StrLTrim(const FX_WCHAR* pStr);
- static CFX_WideString StrRTrim(const FX_WCHAR* pStr);
- static CFX_WideString StrTrim(const FX_WCHAR* pStr);
+ public:
+ static CFX_WideString StrLTrim(const FX_WCHAR* pStr);
+ static CFX_WideString StrRTrim(const FX_WCHAR* pStr);
+ static CFX_WideString StrTrim(const FX_WCHAR* pStr);
- static CFX_ByteString StrLTrim(const FX_CHAR* pStr);
- static CFX_ByteString StrRTrim(const FX_CHAR* pStr);
- static CFX_ByteString StrTrim(const FX_CHAR* pStr);
+ static CFX_ByteString StrLTrim(const FX_CHAR* pStr);
+ static CFX_ByteString StrRTrim(const FX_CHAR* pStr);
+ static CFX_ByteString StrTrim(const FX_CHAR* pStr);
- static FX_BOOL IsNumber(const FX_CHAR* string);
- static FX_BOOL IsNumber(const FX_WCHAR* string);
+ static FX_BOOL IsNumber(const FX_CHAR* string);
+ static FX_BOOL IsNumber(const FX_WCHAR* string);
- static FX_BOOL IsDigit(char ch);
- static FX_BOOL IsDigit(wchar_t ch);
- static FX_BOOL IsAlphabetic(wchar_t ch);
- static FX_BOOL IsAlphaNumeric(wchar_t ch);
+ static FX_BOOL IsDigit(char ch);
+ static FX_BOOL IsDigit(wchar_t ch);
+ static FX_BOOL IsAlphabetic(wchar_t ch);
+ static FX_BOOL IsAlphaNumeric(wchar_t ch);
- static FX_BOOL maskSatisfied(wchar_t c_Change,wchar_t c_Mask);
- static FX_BOOL isReservedMaskChar(wchar_t ch);
+ static FX_BOOL maskSatisfied(wchar_t c_Change, wchar_t c_Mask);
+ static FX_BOOL isReservedMaskChar(wchar_t ch);
- static double AF_Simple(const FX_WCHAR* sFuction, double dValue1, double dValue2);
- static CJS_Array AF_MakeArrayFromList(v8::Isolate* isolate, CJS_Value val);
+ static double AF_Simple(const FX_WCHAR* sFuction,
+ double dValue1,
+ double dValue2);
+ static CJS_Array AF_MakeArrayFromList(v8::Isolate* isolate, CJS_Value val);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_PUBLICMETHODS_H_
diff --git a/fpdfsdk/include/javascript/app.h b/fpdfsdk/include/javascript/app.h
index ac90e62b0d..221a7c1d89 100644
--- a/fpdfsdk/include/javascript/app.h
+++ b/fpdfsdk/include/javascript/app.h
@@ -15,35 +15,33 @@ class CJS_Runtime;
class CJS_Timer;
-class TimerObj : public CJS_EmbedObj
-{
-public:
- TimerObj(CJS_Object* pJSObject);
- virtual ~TimerObj();
-
-public:
- void SetTimer(CJS_Timer* pTimer);
- CJS_Timer* GetTimer() const;
-
-private:
- CJS_Timer* m_pTimer;
-};
+class TimerObj : public CJS_EmbedObj {
+ public:
+ TimerObj(CJS_Object* pJSObject);
+ virtual ~TimerObj();
-class CJS_TimerObj : public CJS_Object
-{
-public:
- CJS_TimerObj(JSFXObject pObject) : CJS_Object(pObject) {}
- virtual ~CJS_TimerObj(){}
+ public:
+ void SetTimer(CJS_Timer* pTimer);
+ CJS_Timer* GetTimer() const;
- DECLARE_JS_CLASS(CJS_TimerObj);
+ private:
+ CJS_Timer* m_pTimer;
};
+class CJS_TimerObj : public CJS_Object {
+ public:
+ CJS_TimerObj(JSFXObject pObject) : CJS_Object(pObject) {}
+ virtual ~CJS_TimerObj() {}
+
+ DECLARE_JS_CLASS(CJS_TimerObj);
+};
// struct APP_MENUITEM_ARRAY;
//
// struct APP_MENUITEM
// {
-// APP_MENUITEM() : oSubMenu(NULL), cName(L""), cReturn(L""), bMarked(false), bEnabled(true)
+// APP_MENUITEM() : oSubMenu(NULL), cName(L""), cReturn(L""),
+// bMarked(false), bEnabled(true)
// {
// }
// CFX_WideString cName;
@@ -103,121 +101,206 @@ public:
// HMENU hMenu;
// };
-class app : public CJS_EmbedObj
-{
-public:
- app(CJS_Object * pJSObject);
- virtual ~app();
-
-public:
- FX_BOOL activeDocs(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL calculate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL formsVersion(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL fs(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL fullscreen(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL language(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL media(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL platform(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL runtimeHighlight(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL viewerType(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL viewerVariation(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL viewerVersion(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
-
-
- FX_BOOL alert(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL beep(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL browseForDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL clearInterval(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL clearTimeOut(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL execDialog(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL execMenuItem(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL findComponent(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL goBack(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL goForward(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL launchURL(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL mailMsg(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL newFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL newDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL openDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL openFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL popUpMenuEx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL popUpMenu(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL response(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL setInterval(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL setTimeOut(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
-
-private:
-// FX_DWORD AppGetTickCount();
- void TimerProc(CJS_Timer* pTimer);
- void RunJsScript(CJS_Runtime * pRuntime,const CFX_WideString & wsScript);
-// void ParsePopupMenuObj(APP_MENUITEM * ppMenuItem,JSObject * pObj);
-// void DeleteMenuItems(APP_MENUITEM_ARRAY * pMenuItems);
-// void AddMenuItem(APP_MENUITEM_ARRAY * pMenuItems, HMENU hMenu, MENUITEMINFO MenuItemInfo);
-// void InitMenuItemInfo(MENUITEMINFO& MenuItemInfo);
-// void DestroyPopUpMenu();
-
-// void ParserMenuItem(APP_MENU* pHead, const CJS_Parameters&params);
-// void AddItemToMenu(APP_MENU* pHead, HMENU hMenu, MENUITEMINFO MenuItemInfo);
-// void DestroyMenuItems(APP_MENU* pHead);
-
-public:
- static CFX_WideString SysPathToPDFPath(const CFX_WideString& sOldPath);
-
-private:
-
- bool m_bCalculate;
- bool m_bRuntimeHighLight;
-
- CFX_ArrayTemplate<CJS_Timer*> m_aTimer;
-// APP_MENU* m_pMenuHead;
-
-public:
-// static CReader_App* s_App;
+class app : public CJS_EmbedObj {
+ public:
+ app(CJS_Object* pJSObject);
+ virtual ~app();
+
+ public:
+ FX_BOOL activeDocs(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL calculate(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL formsVersion(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL fs(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL fullscreen(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL language(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL media(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL platform(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL runtimeHighlight(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL viewerType(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL viewerVariation(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL viewerVersion(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+
+ FX_BOOL alert(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL beep(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL browseForDoc(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL clearInterval(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL clearTimeOut(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL execDialog(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL execMenuItem(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL findComponent(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL goBack(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL goForward(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL launchURL(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL mailMsg(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL newFDF(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL newDoc(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL openDoc(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL openFDF(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL popUpMenuEx(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL popUpMenu(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL response(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL setInterval(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL setTimeOut(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+
+ private:
+ // FX_DWORD AppGetTickCount();
+ void TimerProc(CJS_Timer* pTimer);
+ void RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript);
+ // void ParsePopupMenuObj(APP_MENUITEM *
+ //ppMenuItem,JSObject * pObj);
+ // void DeleteMenuItems(APP_MENUITEM_ARRAY *
+ //pMenuItems);
+ // void AddMenuItem(APP_MENUITEM_ARRAY * pMenuItems, HMENU
+ // hMenu, MENUITEMINFO MenuItemInfo);
+ // void InitMenuItemInfo(MENUITEMINFO&
+ // MenuItemInfo);
+ // void DestroyPopUpMenu();
+
+ // void ParserMenuItem(APP_MENU* pHead, const
+ // CJS_Parameters&params);
+ // void AddItemToMenu(APP_MENU* pHead, HMENU hMenu,
+ // MENUITEMINFO MenuItemInfo);
+ // void DestroyMenuItems(APP_MENU*
+ // pHead);
+
+ public:
+ static CFX_WideString SysPathToPDFPath(const CFX_WideString& sOldPath);
+
+ private:
+ bool m_bCalculate;
+ bool m_bRuntimeHighLight;
+
+ CFX_ArrayTemplate<CJS_Timer*> m_aTimer;
+ // APP_MENU* m_pMenuHead;
+
+ public:
+ // static CReader_App* s_App;
};
-class CJS_App : public CJS_Object
-{
-public:
- CJS_App(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_App(void){};
-
- DECLARE_JS_CLASS(CJS_App);
-
- JS_STATIC_PROP(activeDocs, app);
- JS_STATIC_PROP(calculate, app);
- JS_STATIC_PROP(formsVersion, app);
- JS_STATIC_PROP(fs, app);
- JS_STATIC_PROP(fullscreen, app);
- JS_STATIC_PROP(language, app);
- JS_STATIC_PROP(media, app);
- JS_STATIC_PROP(platform, app);
- JS_STATIC_PROP(runtimeHighlight, app);
- JS_STATIC_PROP(viewerType, app);
- JS_STATIC_PROP(viewerVariation, app);
- JS_STATIC_PROP(viewerVersion, app);
-
- JS_STATIC_METHOD(alert, app);
- JS_STATIC_METHOD(beep, app);
- JS_STATIC_METHOD(browseForDoc, app);
- JS_STATIC_METHOD(clearInterval, app);
- JS_STATIC_METHOD(clearTimeOut, app);
- JS_STATIC_METHOD(execDialog, app);
- JS_STATIC_METHOD(execMenuItem, app);
- JS_STATIC_METHOD(findComponent, app);
- JS_STATIC_METHOD(goBack, app);
- JS_STATIC_METHOD(goForward, app);
- JS_STATIC_METHOD(launchURL, app);
- JS_STATIC_METHOD(mailMsg, app);
- JS_STATIC_METHOD(newFDF, app);
- JS_STATIC_METHOD(newDoc, app);
- JS_STATIC_METHOD(openDoc, app);
- JS_STATIC_METHOD(openFDF, app);
- JS_STATIC_METHOD(popUpMenuEx, app);
- JS_STATIC_METHOD(popUpMenu, app);
- JS_STATIC_METHOD(response, app);
- JS_STATIC_METHOD(setInterval, app);
- JS_STATIC_METHOD(setTimeOut, app);
-
+class CJS_App : public CJS_Object {
+ public:
+ CJS_App(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_App(void){};
+
+ DECLARE_JS_CLASS(CJS_App);
+
+ JS_STATIC_PROP(activeDocs, app);
+ JS_STATIC_PROP(calculate, app);
+ JS_STATIC_PROP(formsVersion, app);
+ JS_STATIC_PROP(fs, app);
+ JS_STATIC_PROP(fullscreen, app);
+ JS_STATIC_PROP(language, app);
+ JS_STATIC_PROP(media, app);
+ JS_STATIC_PROP(platform, app);
+ JS_STATIC_PROP(runtimeHighlight, app);
+ JS_STATIC_PROP(viewerType, app);
+ JS_STATIC_PROP(viewerVariation, app);
+ JS_STATIC_PROP(viewerVersion, app);
+
+ JS_STATIC_METHOD(alert, app);
+ JS_STATIC_METHOD(beep, app);
+ JS_STATIC_METHOD(browseForDoc, app);
+ JS_STATIC_METHOD(clearInterval, app);
+ JS_STATIC_METHOD(clearTimeOut, app);
+ JS_STATIC_METHOD(execDialog, app);
+ JS_STATIC_METHOD(execMenuItem, app);
+ JS_STATIC_METHOD(findComponent, app);
+ JS_STATIC_METHOD(goBack, app);
+ JS_STATIC_METHOD(goForward, app);
+ JS_STATIC_METHOD(launchURL, app);
+ JS_STATIC_METHOD(mailMsg, app);
+ JS_STATIC_METHOD(newFDF, app);
+ JS_STATIC_METHOD(newDoc, app);
+ JS_STATIC_METHOD(openDoc, app);
+ JS_STATIC_METHOD(openFDF, app);
+ JS_STATIC_METHOD(popUpMenuEx, app);
+ JS_STATIC_METHOD(popUpMenu, app);
+ JS_STATIC_METHOD(response, app);
+ JS_STATIC_METHOD(setInterval, app);
+ JS_STATIC_METHOD(setTimeOut, app);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_APP_H_
diff --git a/fpdfsdk/include/javascript/color.h b/fpdfsdk/include/javascript/color.h
index df863b552f..45704efa80 100644
--- a/fpdfsdk/include/javascript/color.h
+++ b/fpdfsdk/include/javascript/color.h
@@ -10,71 +10,76 @@
#include "JS_Define.h"
// TODO(tsepez): include CPWL_Color.h once its own IWYU is fixed.
-class color : public CJS_EmbedObj
-{
-public:
- color(CJS_Object* pJSObject);
- virtual ~color(void);
+class color : public CJS_EmbedObj {
+ public:
+ color(CJS_Object* pJSObject);
+ virtual ~color(void);
- FX_BOOL black(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL blue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL cyan(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL dkGray(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL gray(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL green(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL ltGray(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL magenta(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL red(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL transparent(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL white(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL yellow(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL black(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL blue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL cyan(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL dkGray(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL gray(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL green(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL ltGray(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL magenta(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL red(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL transparent(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL white(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL yellow(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL convert(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL equal(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
+ FX_BOOL convert(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL equal(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
-public:
- static void ConvertPWLColorToArray(const CPWL_Color& color, CJS_Array& array);
- static void ConvertArrayToPWLColor(CJS_Array& array, CPWL_Color& color);
+ public:
+ static void ConvertPWLColorToArray(const CPWL_Color& color, CJS_Array& array);
+ static void ConvertArrayToPWLColor(CJS_Array& array, CPWL_Color& color);
-private:
- CPWL_Color m_crTransparent;
- CPWL_Color m_crBlack;
- CPWL_Color m_crWhite;
- CPWL_Color m_crRed;
- CPWL_Color m_crGreen;
- CPWL_Color m_crBlue;
- CPWL_Color m_crCyan;
- CPWL_Color m_crMagenta;
- CPWL_Color m_crYellow;
- CPWL_Color m_crDKGray;
- CPWL_Color m_crGray;
- CPWL_Color m_crLTGray;
+ private:
+ CPWL_Color m_crTransparent;
+ CPWL_Color m_crBlack;
+ CPWL_Color m_crWhite;
+ CPWL_Color m_crRed;
+ CPWL_Color m_crGreen;
+ CPWL_Color m_crBlue;
+ CPWL_Color m_crCyan;
+ CPWL_Color m_crMagenta;
+ CPWL_Color m_crYellow;
+ CPWL_Color m_crDKGray;
+ CPWL_Color m_crGray;
+ CPWL_Color m_crLTGray;
};
-class CJS_Color : public CJS_Object
-{
-public:
- CJS_Color(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Color(void){};
+class CJS_Color : public CJS_Object {
+ public:
+ CJS_Color(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Color(void){};
- DECLARE_JS_CLASS(CJS_Color);
+ DECLARE_JS_CLASS(CJS_Color);
- JS_STATIC_PROP(black, color);
- JS_STATIC_PROP(blue, color);
- JS_STATIC_PROP(cyan, color);
- JS_STATIC_PROP(dkGray, color);
- JS_STATIC_PROP(gray, color);
- JS_STATIC_PROP(green, color);
- JS_STATIC_PROP(ltGray, color);
- JS_STATIC_PROP(magenta, color);
- JS_STATIC_PROP(red, color);
- JS_STATIC_PROP(transparent, color);
- JS_STATIC_PROP(white, color);
- JS_STATIC_PROP(yellow, color);
-
- JS_STATIC_METHOD(convert,color);
- JS_STATIC_METHOD(equal,color);
+ JS_STATIC_PROP(black, color);
+ JS_STATIC_PROP(blue, color);
+ JS_STATIC_PROP(cyan, color);
+ JS_STATIC_PROP(dkGray, color);
+ JS_STATIC_PROP(gray, color);
+ JS_STATIC_PROP(green, color);
+ JS_STATIC_PROP(ltGray, color);
+ JS_STATIC_PROP(magenta, color);
+ JS_STATIC_PROP(red, color);
+ JS_STATIC_PROP(transparent, color);
+ JS_STATIC_PROP(white, color);
+ JS_STATIC_PROP(yellow, color);
+ JS_STATIC_METHOD(convert, color);
+ JS_STATIC_METHOD(equal, color);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_COLOR_H_
diff --git a/fpdfsdk/include/javascript/console.h b/fpdfsdk/include/javascript/console.h
index 0cbc291b44..a04d87b007 100644
--- a/fpdfsdk/include/javascript/console.h
+++ b/fpdfsdk/include/javascript/console.h
@@ -9,31 +9,41 @@
#include "JS_Define.h"
-class console : public CJS_EmbedObj
-{
-public:
- console(CJS_Object* pJSObject);
- virtual ~console(void);
-
-public:
- FX_BOOL clear(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL hide(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL println(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL show(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
+class console : public CJS_EmbedObj {
+ public:
+ console(CJS_Object* pJSObject);
+ virtual ~console(void);
+
+ public:
+ FX_BOOL clear(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL hide(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL println(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL show(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
};
-class CJS_Console : public CJS_Object
-{
-public:
- CJS_Console(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Console(void){};
+class CJS_Console : public CJS_Object {
+ public:
+ CJS_Console(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Console(void){};
- DECLARE_JS_CLASS(CJS_Console);
+ DECLARE_JS_CLASS(CJS_Console);
- JS_STATIC_METHOD(clear, console);
- JS_STATIC_METHOD(hide, console);
- JS_STATIC_METHOD(println, console);
- JS_STATIC_METHOD(show, console);
+ JS_STATIC_METHOD(clear, console);
+ JS_STATIC_METHOD(hide, console);
+ JS_STATIC_METHOD(println, console);
+ JS_STATIC_METHOD(show, console);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_CONSOLE_H_
diff --git a/fpdfsdk/include/javascript/event.h b/fpdfsdk/include/javascript/event.h
index 91a38ba487..c7c899e69d 100644
--- a/fpdfsdk/include/javascript/event.h
+++ b/fpdfsdk/include/javascript/event.h
@@ -9,64 +9,81 @@
#include "JS_Define.h"
-class event : public CJS_EmbedObj
-{
-public:
- event(CJS_Object * pJSObject);
- virtual ~event(void);
-
-public:
- FX_BOOL change(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL changeEx(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL commitKey(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL fieldFull(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL keyDown(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL modifier(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL rc(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL richChange(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL richChangeEx(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL richValue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL selEnd(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL selStart(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL shift(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL source(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL target(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL targetName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL type(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL willCommit(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+class event : public CJS_EmbedObj {
+ public:
+ event(CJS_Object* pJSObject);
+ virtual ~event(void);
+ public:
+ FX_BOOL change(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL changeEx(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL commitKey(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL fieldFull(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL keyDown(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL modifier(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL rc(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL richChange(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL richChangeEx(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL richValue(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL selEnd(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL selStart(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL shift(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL source(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL target(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL targetName(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL type(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL willCommit(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
};
-class CJS_Event : public CJS_Object
-{
-public:
- CJS_Event(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Event(void){};
+class CJS_Event : public CJS_Object {
+ public:
+ CJS_Event(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Event(void){};
- DECLARE_JS_CLASS(CJS_Event);
+ DECLARE_JS_CLASS(CJS_Event);
- JS_STATIC_PROP(change, event);
- JS_STATIC_PROP(changeEx, event);
- JS_STATIC_PROP(commitKey, event);
- JS_STATIC_PROP(fieldFull, event);
- JS_STATIC_PROP(keyDown, event);
- JS_STATIC_PROP(modifier, event);
- JS_STATIC_PROP(name, event);
- JS_STATIC_PROP(rc, event);
- JS_STATIC_PROP(richChange, event);
- JS_STATIC_PROP(richChangeEx, event);
- JS_STATIC_PROP(richValue, event);
- JS_STATIC_PROP(selEnd, event);
- JS_STATIC_PROP(selStart, event);
- JS_STATIC_PROP(shift, event);
- JS_STATIC_PROP(source, event);
- JS_STATIC_PROP(target, event);
- JS_STATIC_PROP(targetName, event);
- JS_STATIC_PROP(type, event);
- JS_STATIC_PROP(value, event);
- JS_STATIC_PROP(willCommit, event);
+ JS_STATIC_PROP(change, event);
+ JS_STATIC_PROP(changeEx, event);
+ JS_STATIC_PROP(commitKey, event);
+ JS_STATIC_PROP(fieldFull, event);
+ JS_STATIC_PROP(keyDown, event);
+ JS_STATIC_PROP(modifier, event);
+ JS_STATIC_PROP(name, event);
+ JS_STATIC_PROP(rc, event);
+ JS_STATIC_PROP(richChange, event);
+ JS_STATIC_PROP(richChangeEx, event);
+ JS_STATIC_PROP(richValue, event);
+ JS_STATIC_PROP(selEnd, event);
+ JS_STATIC_PROP(selStart, event);
+ JS_STATIC_PROP(shift, event);
+ JS_STATIC_PROP(source, event);
+ JS_STATIC_PROP(target, event);
+ JS_STATIC_PROP(targetName, event);
+ JS_STATIC_PROP(type, event);
+ JS_STATIC_PROP(value, event);
+ JS_STATIC_PROP(willCommit, event);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_EVENT_H_
diff --git a/fpdfsdk/include/javascript/global.h b/fpdfsdk/include/javascript/global.h
index 83e07f67c3..303ac76a3e 100644
--- a/fpdfsdk/include/javascript/global.h
+++ b/fpdfsdk/include/javascript/global.h
@@ -13,77 +13,82 @@ class CJS_GlobalData;
class CJS_GlobalVariableArray;
class CJS_KeyValue;
-struct js_global_data
-{
- js_global_data()
- {
- nType = 0;
- dData = 0;
- bData = FALSE;
- sData = "";
- bPersistent = FALSE;
- bDeleted = FALSE;
- }
-
- ~js_global_data()
- {
- pData.Reset();
- }
- int nType; //0:int 1:bool 2:string 3:obj
- double dData;
- bool bData;
- CFX_ByteString sData;
- v8::Global<v8::Object> pData;
- bool bPersistent;
- bool bDeleted;
+struct js_global_data {
+ js_global_data() {
+ nType = 0;
+ dData = 0;
+ bData = FALSE;
+ sData = "";
+ bPersistent = FALSE;
+ bDeleted = FALSE;
+ }
+
+ ~js_global_data() { pData.Reset(); }
+ int nType; // 0:int 1:bool 2:string 3:obj
+ double dData;
+ bool bData;
+ CFX_ByteString sData;
+ v8::Global<v8::Object> pData;
+ bool bPersistent;
+ bool bDeleted;
};
-class global_alternate : public CJS_EmbedObj
-{
-public:
- global_alternate(CJS_Object* pJSObject);
- virtual ~global_alternate();
-
-public:
- FX_BOOL setPersistent(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
-
-public:
- FX_BOOL QueryProperty(const FX_WCHAR* propname);
- FX_BOOL DoProperty(IFXJS_Context* cc, const FX_WCHAR* propname, CJS_PropValue & vp, CFX_WideString & sError);
- FX_BOOL DelProperty(IFXJS_Context* cc, const FX_WCHAR* propname, CFX_WideString & sError);
-
- void Initial(CPDFDoc_Environment* pApp);
-
-private:
- void UpdateGlobalPersistentVariables();
- void CommitGlobalPersisitentVariables();
- void DestroyGlobalPersisitentVariables();
- FX_BOOL SetGlobalVariables(const FX_CHAR* propname, int nType,
- double dData, bool bData, const CFX_ByteString& sData, JSObject pData, bool bDefaultPersistent);
-
- void ObjectToArray(v8::Local<v8::Object> pObj, CJS_GlobalVariableArray& array);
- void PutObjectProperty(v8::Local<v8::Object> obj, CJS_KeyValue* pData);
-
-private:
- CFX_MapByteStringToPtr m_mapGlobal;
- CFX_WideString m_sFilePath;
- CJS_GlobalData* m_pGlobalData;
- CPDFDoc_Environment* m_pApp;
+class global_alternate : public CJS_EmbedObj {
+ public:
+ global_alternate(CJS_Object* pJSObject);
+ virtual ~global_alternate();
+
+ public:
+ FX_BOOL setPersistent(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+
+ public:
+ FX_BOOL QueryProperty(const FX_WCHAR* propname);
+ FX_BOOL DoProperty(IFXJS_Context* cc,
+ const FX_WCHAR* propname,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL DelProperty(IFXJS_Context* cc,
+ const FX_WCHAR* propname,
+ CFX_WideString& sError);
+
+ void Initial(CPDFDoc_Environment* pApp);
+
+ private:
+ void UpdateGlobalPersistentVariables();
+ void CommitGlobalPersisitentVariables();
+ void DestroyGlobalPersisitentVariables();
+ FX_BOOL SetGlobalVariables(const FX_CHAR* propname,
+ int nType,
+ double dData,
+ bool bData,
+ const CFX_ByteString& sData,
+ JSObject pData,
+ bool bDefaultPersistent);
+
+ void ObjectToArray(v8::Local<v8::Object> pObj,
+ CJS_GlobalVariableArray& array);
+ void PutObjectProperty(v8::Local<v8::Object> obj, CJS_KeyValue* pData);
+
+ private:
+ CFX_MapByteStringToPtr m_mapGlobal;
+ CFX_WideString m_sFilePath;
+ CJS_GlobalData* m_pGlobalData;
+ CPDFDoc_Environment* m_pApp;
};
+class CJS_Global : public CJS_Object {
+ public:
+ CJS_Global(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Global(void){};
-class CJS_Global : public CJS_Object
-{
-public:
- CJS_Global(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Global(void){};
+ virtual FX_BOOL InitInstance(IFXJS_Context* cc);
- virtual FX_BOOL InitInstance(IFXJS_Context* cc);
-
- DECLARE_SPECIAL_JS_CLASS(CJS_Global);
-
- JS_SPECIAL_STATIC_METHOD(setPersistent, global_alternate, global);
+ DECLARE_SPECIAL_JS_CLASS(CJS_Global);
+ JS_SPECIAL_STATIC_METHOD(setPersistent, global_alternate, global);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_GLOBAL_H_
diff --git a/fpdfsdk/include/javascript/report.h b/fpdfsdk/include/javascript/report.h
index 56f742ce08..a9004fd46a 100644
--- a/fpdfsdk/include/javascript/report.h
+++ b/fpdfsdk/include/javascript/report.h
@@ -9,28 +9,32 @@
#include "JS_Define.h"
-class Report : public CJS_EmbedObj
-{
-public:
- Report(CJS_Object * pJSObject);
- virtual ~Report();
-
-public:
- FX_BOOL save(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL writeText(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
+class Report : public CJS_EmbedObj {
+ public:
+ Report(CJS_Object* pJSObject);
+ virtual ~Report();
+
+ public:
+ FX_BOOL save(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL writeText(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
};
-class CJS_Report : public CJS_Object
-{
-public:
- CJS_Report(JSFXObject pObject) : CJS_Object(pObject){};
- virtual ~CJS_Report(){};
+class CJS_Report : public CJS_Object {
+ public:
+ CJS_Report(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Report(){};
-public:
- DECLARE_JS_CLASS(CJS_Report);
+ public:
+ DECLARE_JS_CLASS(CJS_Report);
- JS_STATIC_METHOD(save, Report)
- JS_STATIC_METHOD(writeText, Report);
+ JS_STATIC_METHOD(save, Report)
+ JS_STATIC_METHOD(writeText, Report);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_REPORT_H_
diff --git a/fpdfsdk/include/javascript/resource.h b/fpdfsdk/include/javascript/resource.h
index 433785984d..80629cf2ae 100644
--- a/fpdfsdk/include/javascript/resource.h
+++ b/fpdfsdk/include/javascript/resource.h
@@ -8,28 +8,28 @@
#define FPDFSDK_INCLUDE_JAVASCRIPT_RESOURCE_H_
#include "../../../core/include/fxcrt/fx_string.h" // For CFX_WideString.
-#include "../fsdk_define.h" // For FX_UINT.
+#include "../fsdk_define.h" // For FX_UINT.
class CJS_Context;
-#define IDS_STRING_JSALERT 25613
-#define IDS_STRING_JSPARAMERROR 25614
+#define IDS_STRING_JSALERT 25613
+#define IDS_STRING_JSPARAMERROR 25614
#define IDS_STRING_JSAFNUMBER_KEYSTROKE 25615
-#define IDS_STRING_JSPARAM_TOOLONG 25617
-#define IDS_STRING_JSPARSEDATE 25618
-#define IDS_STRING_JSRANGE1 25619
-#define IDS_STRING_JSRANGE2 25620
-#define IDS_STRING_JSRANGE3 25621
-#define IDS_STRING_NOTSUPPORT 25627
-#define IDS_STRING_JSBUSY 25628
-#define IDS_STRING_JSEVENT 25629
-#define IDS_STRING_RUN 25630
-#define IDS_STRING_JSPRINT1 25632
-#define IDS_STRING_JSPRINT2 25633
-#define IDS_STRING_JSNOGLOBAL 25635
-#define IDS_STRING_JSREADONLY 25636
-#define IDS_STRING_JSTYPEERROR 25637
-#define IDS_STRING_JSVALUEERROR 25638
+#define IDS_STRING_JSPARAM_TOOLONG 25617
+#define IDS_STRING_JSPARSEDATE 25618
+#define IDS_STRING_JSRANGE1 25619
+#define IDS_STRING_JSRANGE2 25620
+#define IDS_STRING_JSRANGE3 25621
+#define IDS_STRING_NOTSUPPORT 25627
+#define IDS_STRING_JSBUSY 25628
+#define IDS_STRING_JSEVENT 25629
+#define IDS_STRING_RUN 25630
+#define IDS_STRING_JSPRINT1 25632
+#define IDS_STRING_JSPRINT2 25633
+#define IDS_STRING_JSNOGLOBAL 25635
+#define IDS_STRING_JSREADONLY 25636
+#define IDS_STRING_JSTYPEERROR 25637
+#define IDS_STRING_JSVALUEERROR 25638
CFX_WideString JSGetStringFromID(CJS_Context* pContext, FX_UINT id);
CFX_WideString JSFormatErrorString(const char* class_name,
diff --git a/fpdfsdk/include/javascript/util.h b/fpdfsdk/include/javascript/util.h
index ca4db349da..2e65bd3f58 100644
--- a/fpdfsdk/include/javascript/util.h
+++ b/fpdfsdk/include/javascript/util.h
@@ -11,40 +11,58 @@
#include "JS_Define.h"
-class util : public CJS_EmbedObj
-{
-public:
- util(CJS_Object * pJSObject);
- virtual ~util(void);
-
-public:
- FX_BOOL printd(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL printf(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL printx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL scand(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL byteToChar(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
-
-public:
- static void printd(const std::wstring &cFormat,CJS_Date Date,bool bXFAPicture, std::wstring &cPurpose);
- static void printx(const std::string &cFormat,const std::string &cSource, std::string &cPurpose);
- static int ParstDataType(std::wstring* sFormat);
+class util : public CJS_EmbedObj {
+ public:
+ util(CJS_Object* pJSObject);
+ virtual ~util(void);
+
+ public:
+ FX_BOOL printd(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL printf(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL printx(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL scand(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL byteToChar(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+
+ public:
+ static void printd(const std::wstring& cFormat,
+ CJS_Date Date,
+ bool bXFAPicture,
+ std::wstring& cPurpose);
+ static void printx(const std::string& cFormat,
+ const std::string& cSource,
+ std::string& cPurpose);
+ static int ParstDataType(std::wstring* sFormat);
};
-class CJS_Util : public CJS_Object
-{
-public:
- CJS_Util(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Util(void){};
+class CJS_Util : public CJS_Object {
+ public:
+ CJS_Util(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Util(void){};
- DECLARE_JS_CLASS(CJS_Util);
+ DECLARE_JS_CLASS(CJS_Util);
- JS_STATIC_METHOD(printd, util);
- JS_STATIC_METHOD(printf, util);
- JS_STATIC_METHOD(printx, util);
- JS_STATIC_METHOD(scand, util);
- JS_STATIC_METHOD(byteToChar, util);
+ JS_STATIC_METHOD(printd, util);
+ JS_STATIC_METHOD(printf, util);
+ JS_STATIC_METHOD(printx, util);
+ JS_STATIC_METHOD(scand, util);
+ JS_STATIC_METHOD(byteToChar, util);
};
-int64_t FX_atoi64(const char *nptr);
+int64_t FX_atoi64(const char* nptr);
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_UTIL_H_
diff --git a/fpdfsdk/include/jsapi/fxjs_v8.h b/fpdfsdk/include/jsapi/fxjs_v8.h
index e291898701..72f2a5de01 100644
--- a/fpdfsdk/include/jsapi/fxjs_v8.h
+++ b/fpdfsdk/include/jsapi/fxjs_v8.h
@@ -13,127 +13,202 @@
#include <v8.h>
#include "../../../core/include/fxcrt/fx_string.h" // For CFX_WideString
-typedef v8::Value JSValue;
-typedef v8::Local<v8::Object> JSObject;
-typedef v8::Local<v8::Object> JSFXObject;
-
-enum FXJSOBJTYPE
-{
- JS_DYNAMIC = 0,
- JS_STATIC = 1,
+typedef v8::Value JSValue;
+typedef v8::Local<v8::Object> JSObject;
+typedef v8::Local<v8::Object> JSFXObject;
+
+enum FXJSOBJTYPE {
+ JS_DYNAMIC = 0,
+ JS_STATIC = 1,
};
-enum FXJSVALUETYPE
-{
- VT_unknown,
- VT_string,
- VT_number,
- VT_boolean,
- VT_date,
- VT_object,
- VT_fxobject,
- VT_null,
- VT_undefined
+enum FXJSVALUETYPE {
+ VT_unknown,
+ VT_string,
+ VT_number,
+ VT_boolean,
+ VT_date,
+ VT_object,
+ VT_fxobject,
+ VT_null,
+ VT_undefined
};
-struct FXJSErr
-{
- const wchar_t* message;
- const wchar_t* srcline;
- unsigned linnum;
+struct FXJSErr {
+ const wchar_t* message;
+ const wchar_t* srcline;
+ unsigned linnum;
};
-/* --------------------------------------------- API --------------------------------------------- */
+/* --------------------------------------------- API
+ * --------------------------------------------- */
typedef v8::Isolate IJS_Runtime;
class IFXJS_Context;
class IFXJS_Runtime;
-typedef void (*LP_CONSTRUCTOR)(IFXJS_Context* cc, v8::Local<v8::Object> obj, v8::Local<v8::Object> global);
+typedef void (*LP_CONSTRUCTOR)(IFXJS_Context* cc,
+ v8::Local<v8::Object> obj,
+ v8::Local<v8::Object> global);
typedef void (*LP_DESTRUCTOR)(v8::Local<v8::Object> obj);
-
-int JS_DefineObj(IJS_Runtime* pJSRuntime, const wchar_t* sObjName, FXJSOBJTYPE eObjType, LP_CONSTRUCTOR pConstructor, LP_DESTRUCTOR pDestructor);
-int JS_DefineObjMethod(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sMethodName, v8::FunctionCallback pMethodCall);
-int JS_DefineObjProperty(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sPropName, v8::AccessorGetterCallback pPropGet, v8::AccessorSetterCallback pPropPut);
-int JS_DefineObjAllProperties(IJS_Runtime* pJSRuntime, int nObjDefnID, v8::NamedPropertyQueryCallback pPropQurey, v8::NamedPropertyGetterCallback pPropGet, v8::NamedPropertySetterCallback pPropPut, v8::NamedPropertyDeleterCallback pPropDel);
-int JS_DefineObjConst(IJS_Runtime* pJSRuntime, int nObjDefnID, const wchar_t* sConstName, v8::Local<v8::Value> pDefault);
-int JS_DefineGlobalMethod(IJS_Runtime* pJSRuntime, const wchar_t* sMethodName, v8::FunctionCallback pMethodCall);
-int JS_DefineGlobalConst(IJS_Runtime* pJSRuntime, const wchar_t* sConstName, v8::Local<v8::Value> pDefault);
-
-void JS_InitialRuntime(IJS_Runtime* pJSRuntime,IFXJS_Runtime* pFXRuntime, IFXJS_Context* context, v8::Global<v8::Context>& v8PersistentContext);
-void JS_ReleaseRuntime(IJS_Runtime* pJSRuntime, v8::Global<v8::Context>& v8PersistentContext);
-void JS_Initial(unsigned int embedderDataSlot);
-void JS_Release();
-int JS_Parse(IJS_Runtime* pJSRuntime, IFXJS_Context* pJSContext, const wchar_t* script, long length, FXJSErr* perror);
-int JS_Execute(IJS_Runtime* pJSRuntime, IFXJS_Context* pJSContext, const wchar_t* script, long length, FXJSErr* perror);
-v8::Local<v8::Object> JS_NewFxDynamicObj(IJS_Runtime* pJSRuntime, IFXJS_Context* pJSContext, int nObjDefnID);
-v8::Local<v8::Object> JS_GetStaticObj(IJS_Runtime* pJSRuntime, int nObjDefnID);
-void JS_SetThisObj(IJS_Runtime* pJSRuntime, int nThisObjID);
-v8::Local<v8::Object> JS_GetThisObj(IJS_Runtime * pJSRuntime);
-int JS_GetObjDefnID(v8::Local<v8::Object> pObj);
-IJS_Runtime* JS_GetRuntime(v8::Local<v8::Object> pObj);
-int JS_GetObjDefnID(IJS_Runtime * pJSRuntime, const wchar_t* pObjName);
-void JS_Error(v8::Isolate* isolate, const CFX_WideString& message);
-unsigned JS_CalcHash(const wchar_t* main, unsigned nLen);
-unsigned JS_CalcHash(const wchar_t* main);
-const wchar_t* JS_GetTypeof(v8::Local<v8::Value> pObj);
-void JS_SetPrivate(IJS_Runtime* pJSRuntime, v8::Local<v8::Object> pObj, void* p);
-void* JS_GetPrivate(IJS_Runtime* pJSRuntime, v8::Local<v8::Object> pObj);
-void JS_SetPrivate(v8::Local<v8::Object> pObj, void* p);
-void* JS_GetPrivate(v8::Local<v8::Object> pObj);
-void JS_FreePrivate(void* p);
-void JS_FreePrivate(v8::Local<v8::Object> pObj);
-v8::Local<v8::Value> JS_GetObjectValue(v8::Local<v8::Object> pObj);
-v8::Local<v8::Value> JS_GetObjectElement(IJS_Runtime* pJSRuntime, v8::Local<v8::Object> pObj,const wchar_t* PropertyName);
-v8::Local<v8::Array> JS_GetObjectElementNames(IJS_Runtime* pJSRuntime, v8::Local<v8::Object> pObj);
-void JS_PutObjectString(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName, const wchar_t* sValue);
-void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName, int nValue);
-void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName, float fValue);
-void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName, double dValue);
-void JS_PutObjectBoolean(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName, bool bValue);
-void JS_PutObjectObject(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName, v8::Local<v8::Object> pPut);
-void JS_PutObjectNull(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj, const wchar_t* PropertyName);
-unsigned JS_PutArrayElement(IJS_Runtime* pJSRuntime, v8::Local<v8::Array> pArray,unsigned index,v8::Local<v8::Value> pValue,FXJSVALUETYPE eType);
-v8::Local<v8::Value> JS_GetArrayElement(IJS_Runtime* pJSRuntime, v8::Local<v8::Array> pArray,unsigned index);
-unsigned JS_GetArrayLength(v8::Local<v8::Array> pArray);
-v8::Local<v8::Value> JS_GetListValue(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pList, int index);
-
-
-v8::Local<v8::Array> JS_NewArray(IJS_Runtime* pJSRuntime);
-v8::Local<v8::Value> JS_NewNumber(IJS_Runtime* pJSRuntime,int number);
-v8::Local<v8::Value> JS_NewNumber(IJS_Runtime* pJSRuntime,double number);
-v8::Local<v8::Value> JS_NewNumber(IJS_Runtime* pJSRuntime,float number);
-v8::Local<v8::Value> JS_NewBoolean(IJS_Runtime* pJSRuntime,bool b);
-v8::Local<v8::Value> JS_NewObject(IJS_Runtime* pJSRuntime,v8::Local<v8::Object> pObj);
-v8::Local<v8::Value> JS_NewObject2(IJS_Runtime* pJSRuntime,v8::Local<v8::Array> pObj);
-v8::Local<v8::Value> JS_NewString(IJS_Runtime* pJSRuntime,const wchar_t* string);
-v8::Local<v8::Value> JS_NewString(IJS_Runtime* pJSRuntime,const wchar_t* string, unsigned nLen);
-v8::Local<v8::Value> JS_NewNull();
-v8::Local<v8::Value> JS_NewDate(IJS_Runtime* pJSRuntime,double d);
-v8::Local<v8::Value> JS_NewValue(IJS_Runtime* pJSRuntime);
-
-
-int JS_ToInt32(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue);
-bool JS_ToBoolean(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue);
-double JS_ToNumber(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue);
-v8::Local<v8::Object> JS_ToObject(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue);
-CFX_WideString JS_ToString(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue);
-v8::Local<v8::Array> JS_ToArray(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue);
-void JS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom);
-
-double JS_GetDateTime();
-int JS_GetYearFromTime(double dt);
-int JS_GetMonthFromTime(double dt);
-int JS_GetDayFromTime(double dt);
-int JS_GetHourFromTime(double dt);
-int JS_GetMinFromTime(double dt);
-int JS_GetSecFromTime(double dt);
-double JS_DateParse(const wchar_t* string);
-double JS_MakeDay(int nYear, int nMonth, int nDay);
-double JS_MakeTime(int nHour, int nMin, int nSec, int nMs);
-double JS_MakeDate(double day, double time);
-bool JS_PortIsNan(double d);
-double JS_LocalTime(double d);
+int JS_DefineObj(IJS_Runtime* pJSRuntime,
+ const wchar_t* sObjName,
+ FXJSOBJTYPE eObjType,
+ LP_CONSTRUCTOR pConstructor,
+ LP_DESTRUCTOR pDestructor);
+int JS_DefineObjMethod(IJS_Runtime* pJSRuntime,
+ int nObjDefnID,
+ const wchar_t* sMethodName,
+ v8::FunctionCallback pMethodCall);
+int JS_DefineObjProperty(IJS_Runtime* pJSRuntime,
+ int nObjDefnID,
+ const wchar_t* sPropName,
+ v8::AccessorGetterCallback pPropGet,
+ v8::AccessorSetterCallback pPropPut);
+int JS_DefineObjAllProperties(IJS_Runtime* pJSRuntime,
+ int nObjDefnID,
+ v8::NamedPropertyQueryCallback pPropQurey,
+ v8::NamedPropertyGetterCallback pPropGet,
+ v8::NamedPropertySetterCallback pPropPut,
+ v8::NamedPropertyDeleterCallback pPropDel);
+int JS_DefineObjConst(IJS_Runtime* pJSRuntime,
+ int nObjDefnID,
+ const wchar_t* sConstName,
+ v8::Local<v8::Value> pDefault);
+int JS_DefineGlobalMethod(IJS_Runtime* pJSRuntime,
+ const wchar_t* sMethodName,
+ v8::FunctionCallback pMethodCall);
+int JS_DefineGlobalConst(IJS_Runtime* pJSRuntime,
+ const wchar_t* sConstName,
+ v8::Local<v8::Value> pDefault);
+
+void JS_InitialRuntime(IJS_Runtime* pJSRuntime,
+ IFXJS_Runtime* pFXRuntime,
+ IFXJS_Context* context,
+ v8::Global<v8::Context>& v8PersistentContext);
+void JS_ReleaseRuntime(IJS_Runtime* pJSRuntime,
+ v8::Global<v8::Context>& v8PersistentContext);
+void JS_Initial(unsigned int embedderDataSlot);
+void JS_Release();
+int JS_Parse(IJS_Runtime* pJSRuntime,
+ IFXJS_Context* pJSContext,
+ const wchar_t* script,
+ long length,
+ FXJSErr* perror);
+int JS_Execute(IJS_Runtime* pJSRuntime,
+ IFXJS_Context* pJSContext,
+ const wchar_t* script,
+ long length,
+ FXJSErr* perror);
+v8::Local<v8::Object> JS_NewFxDynamicObj(IJS_Runtime* pJSRuntime,
+ IFXJS_Context* pJSContext,
+ int nObjDefnID);
+v8::Local<v8::Object> JS_GetStaticObj(IJS_Runtime* pJSRuntime, int nObjDefnID);
+void JS_SetThisObj(IJS_Runtime* pJSRuntime, int nThisObjID);
+v8::Local<v8::Object> JS_GetThisObj(IJS_Runtime* pJSRuntime);
+int JS_GetObjDefnID(v8::Local<v8::Object> pObj);
+IJS_Runtime* JS_GetRuntime(v8::Local<v8::Object> pObj);
+int JS_GetObjDefnID(IJS_Runtime* pJSRuntime, const wchar_t* pObjName);
+void JS_Error(v8::Isolate* isolate, const CFX_WideString& message);
+unsigned JS_CalcHash(const wchar_t* main, unsigned nLen);
+unsigned JS_CalcHash(const wchar_t* main);
+const wchar_t* JS_GetTypeof(v8::Local<v8::Value> pObj);
+void JS_SetPrivate(IJS_Runtime* pJSRuntime,
+ v8::Local<v8::Object> pObj,
+ void* p);
+void* JS_GetPrivate(IJS_Runtime* pJSRuntime, v8::Local<v8::Object> pObj);
+void JS_SetPrivate(v8::Local<v8::Object> pObj, void* p);
+void* JS_GetPrivate(v8::Local<v8::Object> pObj);
+void JS_FreePrivate(void* p);
+void JS_FreePrivate(v8::Local<v8::Object> pObj);
+v8::Local<v8::Value> JS_GetObjectValue(v8::Local<v8::Object> pObj);
+v8::Local<v8::Value> JS_GetObjectElement(IJS_Runtime* pJSRuntime,
+ v8::Local<v8::Object> pObj,
+ const wchar_t* PropertyName);
+v8::Local<v8::Array> JS_GetObjectElementNames(IJS_Runtime* pJSRuntime,
+ v8::Local<v8::Object> pObj);
+void JS_PutObjectString(IJS_Runtime* pJSRuntime,
+ v8::Local<v8::Object> pObj,
+ const wchar_t* PropertyName,
+ const wchar_t* sValue);
+void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,
+ v8::Local<v8::Object> pObj,
+ const wchar_t* PropertyName,
+ int nValue);
+void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,
+ v8::Local<v8::Object> pObj,
+ const wchar_t* PropertyName,
+ float fValue);
+void JS_PutObjectNumber(IJS_Runtime* pJSRuntime,
+ v8::Local<v8::Object> pObj,
+ const wchar_t* PropertyName,
+ double dValue);
+void JS_PutObjectBoolean(IJS_Runtime* pJSRuntime,
+ v8::Local<v8::Object> pObj,
+ const wchar_t* PropertyName,
+ bool bValue);
+void JS_PutObjectObject(IJS_Runtime* pJSRuntime,
+ v8::Local<v8::Object> pObj,
+ const wchar_t* PropertyName,
+ v8::Local<v8::Object> pPut);
+void JS_PutObjectNull(IJS_Runtime* pJSRuntime,
+ v8::Local<v8::Object> pObj,
+ const wchar_t* PropertyName);
+unsigned JS_PutArrayElement(IJS_Runtime* pJSRuntime,
+ v8::Local<v8::Array> pArray,
+ unsigned index,
+ v8::Local<v8::Value> pValue,
+ FXJSVALUETYPE eType);
+v8::Local<v8::Value> JS_GetArrayElement(IJS_Runtime* pJSRuntime,
+ v8::Local<v8::Array> pArray,
+ unsigned index);
+unsigned JS_GetArrayLength(v8::Local<v8::Array> pArray);
+v8::Local<v8::Value> JS_GetListValue(IJS_Runtime* pJSRuntime,
+ v8::Local<v8::Value> pList,
+ int index);
+
+v8::Local<v8::Array> JS_NewArray(IJS_Runtime* pJSRuntime);
+v8::Local<v8::Value> JS_NewNumber(IJS_Runtime* pJSRuntime, int number);
+v8::Local<v8::Value> JS_NewNumber(IJS_Runtime* pJSRuntime, double number);
+v8::Local<v8::Value> JS_NewNumber(IJS_Runtime* pJSRuntime, float number);
+v8::Local<v8::Value> JS_NewBoolean(IJS_Runtime* pJSRuntime, bool b);
+v8::Local<v8::Value> JS_NewObject(IJS_Runtime* pJSRuntime,
+ v8::Local<v8::Object> pObj);
+v8::Local<v8::Value> JS_NewObject2(IJS_Runtime* pJSRuntime,
+ v8::Local<v8::Array> pObj);
+v8::Local<v8::Value> JS_NewString(IJS_Runtime* pJSRuntime,
+ const wchar_t* string);
+v8::Local<v8::Value> JS_NewString(IJS_Runtime* pJSRuntime,
+ const wchar_t* string,
+ unsigned nLen);
+v8::Local<v8::Value> JS_NewNull();
+v8::Local<v8::Value> JS_NewDate(IJS_Runtime* pJSRuntime, double d);
+v8::Local<v8::Value> JS_NewValue(IJS_Runtime* pJSRuntime);
+
+int JS_ToInt32(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue);
+bool JS_ToBoolean(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue);
+double JS_ToNumber(IJS_Runtime* pJSRuntime, v8::Local<v8::Value> pValue);
+v8::Local<v8::Object> JS_ToObject(IJS_Runtime* pJSRuntime,
+ v8::Local<v8::Value> pValue);
+CFX_WideString JS_ToString(IJS_Runtime* pJSRuntime,
+ v8::Local<v8::Value> pValue);
+v8::Local<v8::Array> JS_ToArray(IJS_Runtime* pJSRuntime,
+ v8::Local<v8::Value> pValue);
+void JS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom);
+
+double JS_GetDateTime();
+int JS_GetYearFromTime(double dt);
+int JS_GetMonthFromTime(double dt);
+int JS_GetDayFromTime(double dt);
+int JS_GetHourFromTime(double dt);
+int JS_GetMinFromTime(double dt);
+int JS_GetSecFromTime(double dt);
+double JS_DateParse(const wchar_t* string);
+double JS_MakeDay(int nYear, int nMonth, int nDay);
+double JS_MakeTime(int nHour, int nMin, int nSec, int nMs);
+double JS_MakeDate(double day, double time);
+bool JS_PortIsNan(double d);
+double JS_LocalTime(double d);
#endif // FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_
diff --git a/fpdfsdk/include/pdfwindow/PWL_Button.h b/fpdfsdk/include/pdfwindow/PWL_Button.h
index 4937841819..363556762f 100644
--- a/fpdfsdk/include/pdfwindow/PWL_Button.h
+++ b/fpdfsdk/include/pdfwindow/PWL_Button.h
@@ -9,19 +9,18 @@
#include "PWL_Wnd.h"
-class CPWL_Button : public CPWL_Wnd
-{
-public:
- CPWL_Button();
- virtual ~CPWL_Button();
+class CPWL_Button : public CPWL_Wnd {
+ public:
+ CPWL_Button();
+ virtual ~CPWL_Button();
- virtual CFX_ByteString GetClassName() const;
- virtual void OnCreate(PWL_CREATEPARAM & cp);
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
+ virtual CFX_ByteString GetClassName() const;
+ virtual void OnCreate(PWL_CREATEPARAM& cp);
+ virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag);
-protected:
- FX_BOOL m_bMouseDown;
+ protected:
+ FX_BOOL m_bMouseDown;
};
#endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_BUTTON_H_
diff --git a/fpdfsdk/include/pdfwindow/PWL_Caret.h b/fpdfsdk/include/pdfwindow/PWL_Caret.h
index 6838bc49e7..7e61eeb66e 100644
--- a/fpdfsdk/include/pdfwindow/PWL_Caret.h
+++ b/fpdfsdk/include/pdfwindow/PWL_Caret.h
@@ -9,45 +9,43 @@
#include "PWL_Wnd.h"
-struct PWL_CARET_INFO
-{
-public:
- PWL_CARET_INFO() : bVisible(FALSE), ptHead(0,0), ptFoot(0,0)
- {
- }
-
- FX_BOOL bVisible;
- CPDF_Point ptHead;
- CPDF_Point ptFoot;
-};
+struct PWL_CARET_INFO {
+ public:
+ PWL_CARET_INFO() : bVisible(FALSE), ptHead(0, 0), ptFoot(0, 0) {}
+ FX_BOOL bVisible;
+ CPDF_Point ptHead;
+ CPDF_Point ptFoot;
+};
-class CPWL_Caret : public CPWL_Wnd
-{
-public:
- CPWL_Caret();
- virtual ~CPWL_Caret();
-
- virtual CFX_ByteString GetClassName() const;
- virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
- virtual void InvalidateRect(CPDF_Rect * pRect = NULL);
- virtual void SetVisible(FX_BOOL bVisible) {}
- virtual void TimerProc();
- void SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPDF_Point & ptFoot);
- CFX_ByteString GetCaretAppearanceStream(const CPDF_Point & ptOffset);
- void SetInvalidRect(CPDF_Rect rc) {m_rcInvalid = rc;}
-
-private:
- void GetCaretApp(CFX_ByteTextBuf & sAppStream,const CPDF_Point & ptOffset);
- CPDF_Rect GetCaretRect() const;
-
- FX_BOOL m_bFlash;
- CPDF_Point m_ptHead;
- CPDF_Point m_ptFoot;
- FX_FLOAT m_fWidth;
- int32_t m_nDelay;
- CPDF_Rect m_rcInvalid;
+class CPWL_Caret : public CPWL_Wnd {
+ public:
+ CPWL_Caret();
+ virtual ~CPWL_Caret();
+
+ virtual CFX_ByteString GetClassName() const;
+ virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream);
+ virtual void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device);
+ virtual void InvalidateRect(CPDF_Rect* pRect = NULL);
+ virtual void SetVisible(FX_BOOL bVisible) {}
+ virtual void TimerProc();
+ void SetCaret(FX_BOOL bVisible,
+ const CPDF_Point& ptHead,
+ const CPDF_Point& ptFoot);
+ CFX_ByteString GetCaretAppearanceStream(const CPDF_Point& ptOffset);
+ void SetInvalidRect(CPDF_Rect rc) { m_rcInvalid = rc; }
+
+ private:
+ void GetCaretApp(CFX_ByteTextBuf& sAppStream, const CPDF_Point& ptOffset);
+ CPDF_Rect GetCaretRect() const;
+
+ FX_BOOL m_bFlash;
+ CPDF_Point m_ptHead;
+ CPDF_Point m_ptFoot;
+ FX_FLOAT m_fWidth;
+ int32_t m_nDelay;
+ CPDF_Rect m_rcInvalid;
};
#endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_CARET_H_
diff --git a/fpdfsdk/include/pdfwindow/PWL_ComboBox.h b/fpdfsdk/include/pdfwindow/PWL_ComboBox.h
index 7a86ccd0c2..98ae7ca986 100644
--- a/fpdfsdk/include/pdfwindow/PWL_ComboBox.h
+++ b/fpdfsdk/include/pdfwindow/PWL_ComboBox.h
@@ -11,108 +11,108 @@
#include "PWL_ListBox.h"
#include "PWL_Wnd.h"
-class CPWL_CBEdit : public CPWL_Edit
-{
-public:
- CPWL_CBEdit(){};
- virtual ~CPWL_CBEdit(){};
+class CPWL_CBEdit : public CPWL_Edit {
+ public:
+ CPWL_CBEdit(){};
+ virtual ~CPWL_CBEdit(){};
};
-class CPWL_CBListBox : public CPWL_ListBox
-{
-public:
- CPWL_CBListBox(){};
- virtual ~CPWL_CBListBox(){};
+class CPWL_CBListBox : public CPWL_ListBox {
+ public:
+ CPWL_CBListBox(){};
+ virtual ~CPWL_CBListBox(){};
-public:
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
+ public:
+ virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag);
- FX_BOOL OnKeyDownWithExit(FX_WORD nChar, FX_BOOL & bExit, FX_DWORD nFlag);
- FX_BOOL OnCharWithExit(FX_WORD nChar, FX_BOOL & bExit, FX_DWORD nFlag);
+ FX_BOOL OnKeyDownWithExit(FX_WORD nChar, FX_BOOL& bExit, FX_DWORD nFlag);
+ FX_BOOL OnCharWithExit(FX_WORD nChar, FX_BOOL& bExit, FX_DWORD nFlag);
};
-#define PWL_COMBOBOX_BUTTON_WIDTH 13
+#define PWL_COMBOBOX_BUTTON_WIDTH 13
-class CPWL_CBButton : public CPWL_Wnd
-{
-public:
- CPWL_CBButton(){};
- virtual ~CPWL_CBButton(){};
+class CPWL_CBButton : public CPWL_Wnd {
+ public:
+ CPWL_CBButton(){};
+ virtual ~CPWL_CBButton(){};
-public:
- virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
+ public:
+ virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream);
+ virtual void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device);
+ virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag);
};
-class CPWL_ComboBox : public CPWL_Wnd
-{
-public:
- CPWL_ComboBox();
- operator CPWL_Edit* () {return m_pEdit;}
+class CPWL_ComboBox : public CPWL_Wnd {
+ public:
+ CPWL_ComboBox();
+ operator CPWL_Edit*() { return m_pEdit; }
+
+ public:
+ virtual CFX_ByteString GetClassName() const;
+ virtual void OnCreate(PWL_CREATEPARAM& cp);
-public:
- virtual CFX_ByteString GetClassName() const;
- virtual void OnCreate(PWL_CREATEPARAM & cp);
+ virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
+ virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag);
- virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
- virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag);
+ virtual void OnNotify(CPWL_Wnd* pWnd,
+ FX_DWORD msg,
+ intptr_t wParam = 0,
+ intptr_t lParam = 0);
- virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0);
+ virtual void CreateChildWnd(const PWL_CREATEPARAM& cp);
+ virtual void RePosChildWnd();
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
- virtual void RePosChildWnd();
+ virtual CPDF_Rect GetFocusRect() const;
- virtual CPDF_Rect GetFocusRect() const;
+ virtual void SetFocus();
+ virtual void KillFocus();
- virtual void SetFocus();
- virtual void KillFocus();
+ FX_BOOL IsModified() const;
- FX_BOOL IsModified() const;
+ public:
+ void SetFillerNotify(IPWL_Filler_Notify* pNotify);
-public:
- void SetFillerNotify(IPWL_Filler_Notify* pNotify);
+ CFX_WideString GetText() const;
+ void SetText(const FX_WCHAR* text);
- CFX_WideString GetText() const;
- void SetText(const FX_WCHAR* text);
+ void AddString(const FX_WCHAR* string);
+ int32_t GetSelect() const;
+ void SetSelect(int32_t nItemIndex);
- void AddString(const FX_WCHAR* string);
- int32_t GetSelect() const;
- void SetSelect(int32_t nItemIndex);
+ void SetEditSel(int32_t nStartChar, int32_t nEndChar);
+ void GetEditSel(int32_t& nStartChar, int32_t& nEndChar) const;
+ void Clear();
+ void SelectAll();
+ FX_BOOL IsPopup() const;
- void SetEditSel(int32_t nStartChar,int32_t nEndChar);
- void GetEditSel(int32_t & nStartChar, int32_t & nEndChar ) const;
- void Clear();
- void SelectAll();
- FX_BOOL IsPopup() const;
+ void SetSelectText();
- void SetSelectText();
+ private:
+ void CreateEdit(const PWL_CREATEPARAM& cp);
+ void CreateButton(const PWL_CREATEPARAM& cp);
+ void CreateListBox(const PWL_CREATEPARAM& cp);
-private:
- void CreateEdit(const PWL_CREATEPARAM & cp);
- void CreateButton(const PWL_CREATEPARAM & cp);
- void CreateListBox(const PWL_CREATEPARAM & cp);
+ void SetPopup(FX_BOOL bPopup);
- void SetPopup(FX_BOOL bPopup);
+ private:
+ CPWL_CBEdit* m_pEdit;
+ CPWL_CBButton* m_pButton;
+ CPWL_CBListBox* m_pList;
-private:
- CPWL_CBEdit* m_pEdit;
- CPWL_CBButton* m_pButton;
- CPWL_CBListBox* m_pList;
+ FX_BOOL m_bPopup;
+ CPDF_Rect m_rcOldWindow;
+ int32_t m_nPopupWhere;
+ int32_t m_nSelectItem;
+ IPWL_Filler_Notify* m_pFillerNotify;
- FX_BOOL m_bPopup;
- CPDF_Rect m_rcOldWindow;
- int32_t m_nPopupWhere;
- int32_t m_nSelectItem;
- IPWL_Filler_Notify* m_pFillerNotify;
+ public:
+ void AttachFFLData(void* pData) { m_pFormFiller = pData; }
-public:
- void AttachFFLData(void* pData) {m_pFormFiller = pData;}
-private:
- void* m_pFormFiller;
+ private:
+ void* m_pFormFiller;
};
#endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_COMBOBOX_H_
diff --git a/fpdfsdk/include/pdfwindow/PWL_Edit.h b/fpdfsdk/include/pdfwindow/PWL_Edit.h
index b5debac7fc..0281d37ed7 100644
--- a/fpdfsdk/include/pdfwindow/PWL_Edit.h
+++ b/fpdfsdk/include/pdfwindow/PWL_Edit.h
@@ -15,131 +15,171 @@ class CPWL_Edit;
class IPWL_Filler_Notify;
class IPWL_SpellCheck;
-class IPWL_Filler_Notify
-{
-public:
- virtual ~IPWL_Filler_Notify() { }
- virtual void QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX_FLOAT fPopupMax,
- int32_t & nRet, FX_FLOAT & fPopupRet) = 0; //nRet: (0:bottom 1:top)
- virtual void OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, int32_t nKeyCode,
- CFX_WideString & strChange, const CFX_WideString& strChangeEx,
- int nSelStart, int nSelEnd,
- FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag) = 0;
- virtual void OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_BOOL & bExit, FX_DWORD nFlag) = 0;
-
- virtual void OnPopupPreOpen(void* pPrivateData, FX_BOOL& bExit, FX_DWORD nFlag) = 0;
- virtual void OnPopupPostOpen(void* pPrivateData, FX_BOOL& bExit, FX_DWORD nFlag) = 0;
+class IPWL_Filler_Notify {
+ public:
+ virtual ~IPWL_Filler_Notify() {}
+ virtual void QueryWherePopup(
+ void* pPrivateData,
+ FX_FLOAT fPopupMin,
+ FX_FLOAT fPopupMax,
+ int32_t& nRet,
+ FX_FLOAT& fPopupRet) = 0; // nRet: (0:bottom 1:top)
+ virtual void OnBeforeKeyStroke(FX_BOOL bEditOrList,
+ void* pPrivateData,
+ int32_t nKeyCode,
+ CFX_WideString& strChange,
+ const CFX_WideString& strChangeEx,
+ int nSelStart,
+ int nSelEnd,
+ FX_BOOL bKeyDown,
+ FX_BOOL& bRC,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag) = 0;
+ virtual void OnAfterKeyStroke(FX_BOOL bEditOrList,
+ void* pPrivateData,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag) = 0;
+
+ virtual void OnPopupPreOpen(void* pPrivateData,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag) = 0;
+ virtual void OnPopupPostOpen(void* pPrivateData,
+ FX_BOOL& bExit,
+ FX_DWORD nFlag) = 0;
};
-class CPWL_Edit : public CPWL_EditCtrl, public IFX_Edit_OprNotify
-{
-public:
- CPWL_Edit();
- virtual ~CPWL_Edit();
-
-public:
- virtual CFX_ByteString GetClassName() const;
- virtual void OnDestroy();
- virtual void OnCreated();
- virtual void RePosChildWnd();
- virtual CPDF_Rect GetClientRect() const;
-
- virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);
-
- virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
- virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag);
-
- virtual CPDF_Rect GetFocusRect() const;
-
-public:
- void SetAlignFormatH(PWL_EDIT_ALIGNFORMAT_H nFormat = PEAH_LEFT, FX_BOOL bPaint = TRUE); //0:left 1:right 2:middle
- void SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat = PEAV_TOP, FX_BOOL bPaint = TRUE); //0:top 1:bottom 2:center
-
- void SetCharArray(int32_t nCharArray);
- void SetLimitChar(int32_t nLimitChar);
-
- void SetHorzScale(int32_t nHorzScale, FX_BOOL bPaint = TRUE);
- void SetCharSpace(FX_FLOAT fCharSpace, FX_BOOL bPaint = TRUE);
-
- void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE);
-
- void EnableSpellCheck(FX_BOOL bEnabled);
-
- FX_BOOL CanSelectAll() const;
- FX_BOOL CanClear() const;
- FX_BOOL CanCopy() const;
- FX_BOOL CanCut() const;
- FX_BOOL CanPaste() const;
-
- virtual void CopyText();
- virtual void PasteText();
- virtual void CutText();
-
- virtual void SetText(const FX_WCHAR* csText);
- void ReplaceSel(const FX_WCHAR* csText);
-
- CFX_ByteString GetTextAppearanceStream(const CPDF_Point & ptOffset) const;
- CFX_ByteString GetCaretAppearanceStream(const CPDF_Point & ptOffset) const;
- CFX_ByteString GetSelectAppearanceStream(const CPDF_Point & ptOffset) const;
-
- FX_BOOL IsTextFull() const;
-
- static FX_FLOAT GetCharArrayAutoFontSize(CPDF_Font* pFont, const CPDF_Rect& rcPlate, int32_t nCharArray);
-
- void SetFillerNotify(IPWL_Filler_Notify* pNotify) {m_pFillerNotify = pNotify;}
-
- void GeneratePageObjects(CPDF_PageObjects* pPageObjects,
- const CPDF_Point& ptOffset, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
- void GeneratePageObjects(CPDF_PageObjects* pPageObjects,
- const CPDF_Point& ptOffset);
-
-protected:
- virtual void OnSetFocus();
- virtual void OnKillFocus();
-
-protected:
- virtual void OnInsertWord(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
- virtual void OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
- virtual void OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
- virtual void OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
- virtual void OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
- virtual void OnSetText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
- virtual void OnInsertText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
- virtual void OnAddUndo(IFX_Edit_UndoItem* pUndoItem);
-
-private:
- CPVT_WordRange GetSelectWordRange() const;
- virtual void ShowVScrollBar(FX_BOOL bShow);
- FX_BOOL IsVScrollBarVisible() const;
- void SetParamByFlag();
-
- FX_FLOAT GetCharArrayAutoFontSize(int32_t nCharArray);
- CPDF_Point GetWordRightBottomPoint(const CPVT_WordPlace& wpWord);
-
- CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1, const CPVT_WordRange& wr2);
- CPVT_WordRange GetLatinWordsRange(const CPDF_Point & point) const;
- CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace & place) const;
- CPVT_WordRange GetArabicWordsRange(const CPVT_WordPlace & place) const;
- CPVT_WordRange GetSameWordsRange(const CPVT_WordPlace & place, FX_BOOL bLatin, FX_BOOL bArabic) const;
-
- void AjustArabicWords(const CPVT_WordRange& wr);
-public:
- FX_BOOL IsProceedtoOnChar(FX_WORD nKeyCode, FX_DWORD nFlag);
-private:
- IPWL_Filler_Notify* m_pFillerNotify;
- IPWL_SpellCheck* m_pSpellCheck;
- FX_BOOL m_bFocus;
- CPDF_Rect m_rcOldWindow;
-public:
- void AttachFFLData(void* pData) {m_pFormFiller = pData;}
-private:
- void* m_pFormFiller;
+class CPWL_Edit : public CPWL_EditCtrl, public IFX_Edit_OprNotify {
+ public:
+ CPWL_Edit();
+ virtual ~CPWL_Edit();
+
+ public:
+ virtual CFX_ByteString GetClassName() const;
+ virtual void OnDestroy();
+ virtual void OnCreated();
+ virtual void RePosChildWnd();
+ virtual CPDF_Rect GetClientRect() const;
+
+ virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream);
+ virtual void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device);
+
+ virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnLButtonDblClk(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnRButtonUp(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnMouseWheel(short zDelta,
+ const CPDF_Point& point,
+ FX_DWORD nFlag);
+
+ virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
+ virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag);
+
+ virtual CPDF_Rect GetFocusRect() const;
+
+ public:
+ void SetAlignFormatH(PWL_EDIT_ALIGNFORMAT_H nFormat = PEAH_LEFT,
+ FX_BOOL bPaint = TRUE); // 0:left 1:right 2:middle
+ void SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat = PEAV_TOP,
+ FX_BOOL bPaint = TRUE); // 0:top 1:bottom 2:center
+
+ void SetCharArray(int32_t nCharArray);
+ void SetLimitChar(int32_t nLimitChar);
+
+ void SetHorzScale(int32_t nHorzScale, FX_BOOL bPaint = TRUE);
+ void SetCharSpace(FX_FLOAT fCharSpace, FX_BOOL bPaint = TRUE);
+
+ void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE);
+
+ void EnableSpellCheck(FX_BOOL bEnabled);
+
+ FX_BOOL CanSelectAll() const;
+ FX_BOOL CanClear() const;
+ FX_BOOL CanCopy() const;
+ FX_BOOL CanCut() const;
+ FX_BOOL CanPaste() const;
+
+ virtual void CopyText();
+ virtual void PasteText();
+ virtual void CutText();
+
+ virtual void SetText(const FX_WCHAR* csText);
+ void ReplaceSel(const FX_WCHAR* csText);
+
+ CFX_ByteString GetTextAppearanceStream(const CPDF_Point& ptOffset) const;
+ CFX_ByteString GetCaretAppearanceStream(const CPDF_Point& ptOffset) const;
+ CFX_ByteString GetSelectAppearanceStream(const CPDF_Point& ptOffset) const;
+
+ FX_BOOL IsTextFull() const;
+
+ static FX_FLOAT GetCharArrayAutoFontSize(CPDF_Font* pFont,
+ const CPDF_Rect& rcPlate,
+ int32_t nCharArray);
+
+ void SetFillerNotify(IPWL_Filler_Notify* pNotify) {
+ m_pFillerNotify = pNotify;
+ }
+
+ void GeneratePageObjects(CPDF_PageObjects* pPageObjects,
+ const CPDF_Point& ptOffset,
+ CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
+ void GeneratePageObjects(CPDF_PageObjects* pPageObjects,
+ const CPDF_Point& ptOffset);
+
+ protected:
+ virtual void OnSetFocus();
+ virtual void OnKillFocus();
+
+ protected:
+ virtual void OnInsertWord(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace);
+ virtual void OnInsertReturn(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace);
+ virtual void OnBackSpace(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace);
+ virtual void OnDelete(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace);
+ virtual void OnClear(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace);
+ virtual void OnSetText(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace);
+ virtual void OnInsertText(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace);
+ virtual void OnAddUndo(IFX_Edit_UndoItem* pUndoItem);
+
+ private:
+ CPVT_WordRange GetSelectWordRange() const;
+ virtual void ShowVScrollBar(FX_BOOL bShow);
+ FX_BOOL IsVScrollBarVisible() const;
+ void SetParamByFlag();
+
+ FX_FLOAT GetCharArrayAutoFontSize(int32_t nCharArray);
+ CPDF_Point GetWordRightBottomPoint(const CPVT_WordPlace& wpWord);
+
+ CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1,
+ const CPVT_WordRange& wr2);
+ CPVT_WordRange GetLatinWordsRange(const CPDF_Point& point) const;
+ CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace& place) const;
+ CPVT_WordRange GetArabicWordsRange(const CPVT_WordPlace& place) const;
+ CPVT_WordRange GetSameWordsRange(const CPVT_WordPlace& place,
+ FX_BOOL bLatin,
+ FX_BOOL bArabic) const;
+
+ void AjustArabicWords(const CPVT_WordRange& wr);
+
+ public:
+ FX_BOOL IsProceedtoOnChar(FX_WORD nKeyCode, FX_DWORD nFlag);
+
+ private:
+ IPWL_Filler_Notify* m_pFillerNotify;
+ IPWL_SpellCheck* m_pSpellCheck;
+ FX_BOOL m_bFocus;
+ CPDF_Rect m_rcOldWindow;
+
+ public:
+ void AttachFFLData(void* pData) { m_pFormFiller = pData; }
+
+ private:
+ void* m_pFormFiller;
};
#endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_EDIT_H_
diff --git a/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h b/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h
index 273b3842c8..784ec61140 100644
--- a/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h
+++ b/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h
@@ -18,159 +18,172 @@ class IFX_Edit;
class IPWL_Edit_Notify;
struct CPVT_WordPlace;
-enum PWL_EDIT_ALIGNFORMAT_H
-{
- PEAH_LEFT = 0,
- PEAH_MIDDLE,
- PEAH_RIGHT
+enum PWL_EDIT_ALIGNFORMAT_H { PEAH_LEFT = 0, PEAH_MIDDLE, PEAH_RIGHT };
+
+enum PWL_EDIT_ALIGNFORMAT_V { PEAV_TOP = 0, PEAV_CENTER, PEAV_BOTTOM };
+
+class IPWL_Edit_Notify {
+ public:
+ virtual ~IPWL_Edit_Notify() {}
+ // when the position of caret is changed in edit
+ virtual void OnCaretMove(int32_t x1, int32_t y1, int32_t x2, int32_t y2) {}
+ virtual void OnContentChange(const CPDF_Rect& rcContent) {}
+ // OprType: 0 InsertWord
+ // 1 InsertReturn
+ // 2 BackSpace
+ // 3 Delete
+ // 4 Clear
+ // 5 InsertText
+ // 6 SetText
+ virtual void OnInsertWord(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) {}
+ virtual void OnInsertReturn(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) {}
+ virtual void OnBackSpace(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) {}
+ virtual void OnDelete(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) {}
+ virtual void OnClear(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) {}
+ virtual void OnInsertText(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) {}
+ virtual void OnSetText(const CPVT_WordPlace& place,
+ const CPVT_WordPlace& oldplace) {}
+ virtual void OnAddUndo(CPWL_Edit* pEdit) {}
};
-enum PWL_EDIT_ALIGNFORMAT_V
-{
- PEAV_TOP = 0,
- PEAV_CENTER,
- PEAV_BOTTOM
-};
-
-class IPWL_Edit_Notify
-{
-public:
- virtual ~IPWL_Edit_Notify() { }
- //when the position of caret is changed in edit
- virtual void OnCaretMove(int32_t x1, int32_t y1, int32_t x2, int32_t y2) {}
- virtual void OnContentChange(const CPDF_Rect& rcContent){}
- //OprType: 0 InsertWord
- //1 InsertReturn
- //2 BackSpace
- //3 Delete
- //4 Clear
- //5 InsertText
- //6 SetText
- virtual void OnInsertWord(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
- virtual void OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
- virtual void OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
- virtual void OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
- virtual void OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
- virtual void OnInsertText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
- virtual void OnSetText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace){}
- virtual void OnAddUndo(CPWL_Edit* pEdit) {}
-};
-
-class CPWL_EditCtrl : public CPWL_Wnd, public IFX_Edit_Notify
-{
- friend class CPWL_Edit_Notify;
-
-public:
- CPWL_EditCtrl();
- virtual ~CPWL_EditCtrl();
-
-public:
- virtual void OnCreate(PWL_CREATEPARAM & cp);
- virtual void OnCreated();
-
- virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
- virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag);
- virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0);
-
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
- virtual void RePosChildWnd();
- virtual void SetFontSize(FX_FLOAT fFontSize);
- virtual FX_FLOAT GetFontSize() const;
-
-public:
- virtual void SetText(const FX_WCHAR* csText);
-
- virtual void CopyText();
- virtual void PasteText();
- virtual void CutText();
-
- CPDF_Rect GetContentRect() const;
- void GetCaretPos(int32_t& x, int32_t& y) const;
- FX_BOOL IsModified() const;
-
- CFX_WideString GetText() const;
- void SetSel(int32_t nStartChar,int32_t nEndChar);
- void GetSel(int32_t & nStartChar, int32_t & nEndChar ) const;
- void GetTextRange(const CPDF_Rect& rect, int32_t & nStartChar, int32_t & nEndChar) const;
- CFX_WideString GetText(int32_t & nStartChar, int32_t & nEndChar) const;
- void Clear();
- void SelectAll();
-
- int32_t GetCaret() const;
- void SetCaret(int32_t nPos);
- int32_t GetTotalWords() const;
-
- void Paint();
-
- void EnableRefresh(FX_BOOL bRefresh);
- CPDF_Point GetScrollPos() const;
- void SetScrollPos(const CPDF_Point& point);
-
- void SetEditNotify(IPWL_Edit_Notify* pNotify) {m_pEditNotify = pNotify;}
-
- void SetCharSet(uint8_t nCharSet){m_nCharSet = nCharSet;}
- int32_t GetCharSet() const;
-
- void SetCodePage(int32_t nCodePage){m_nCodePage = nCodePage;}
- int32_t GetCodePage() const {return m_nCodePage;}
-
- CPDF_Font * GetCaretFont() const;
- FX_FLOAT GetCaretFontSize() const;
-
- FX_BOOL CanUndo() const;
- FX_BOOL CanRedo() const;
- void Redo();
- void Undo();
-
- void SetReadyToInput();
-protected:
- virtual void ShowVScrollBar(FX_BOOL bShow);
-
- virtual void InsertWord(FX_WORD word, int32_t nCharset);
- virtual void InsertReturn();
- virtual void InsertText(const FX_WCHAR* csText);
-
- virtual void SetCursor();
- FX_BOOL IsWndHorV();
-
- void Delete();
- void Backspace();
-
-protected:
- void GetCaretInfo(CPDF_Point & ptHead, CPDF_Point & ptFoot) const;
- void SetCaret(FX_BOOL bVisible, const CPDF_Point & ptHead, const CPDF_Point & ptFoot);
-
- void SetEditCaret(FX_BOOL bVisible);
-
-protected:
- virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin, FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep, FX_FLOAT fBigStep){}
- virtual void IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin, FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep, FX_FLOAT fBigStep);
- virtual void IOnSetScrollPosX(FX_FLOAT fx){}
- virtual void IOnSetScrollPosY(FX_FLOAT fy);
- virtual void IOnSetCaret(FX_BOOL bVisible,const CPDF_Point & ptHead,const CPDF_Point & ptFoot, const CPVT_WordPlace& place);
- virtual void IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps);
- virtual void IOnContentChange(const CPDF_Rect& rcContent);
- virtual void IOnInvalidateRect(CPDF_Rect * pRect);
-
-private:
- void CreateEditCaret(const PWL_CREATEPARAM & cp);
-
-protected:
- IFX_Edit* m_pEdit;
- CPWL_Caret* m_pEditCaret;
- FX_BOOL m_bMouseDown;
- IPWL_Edit_Notify* m_pEditNotify;
-
-private:
- int32_t m_nCharSet;
- int32_t m_nCodePage;
+class CPWL_EditCtrl : public CPWL_Wnd, public IFX_Edit_Notify {
+ friend class CPWL_Edit_Notify;
+
+ public:
+ CPWL_EditCtrl();
+ virtual ~CPWL_EditCtrl();
+
+ public:
+ virtual void OnCreate(PWL_CREATEPARAM& cp);
+ virtual void OnCreated();
+
+ virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
+ virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag);
+ virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual void OnNotify(CPWL_Wnd* pWnd,
+ FX_DWORD msg,
+ intptr_t wParam = 0,
+ intptr_t lParam = 0);
+
+ virtual void CreateChildWnd(const PWL_CREATEPARAM& cp);
+ virtual void RePosChildWnd();
+ virtual void SetFontSize(FX_FLOAT fFontSize);
+ virtual FX_FLOAT GetFontSize() const;
+
+ public:
+ virtual void SetText(const FX_WCHAR* csText);
+
+ virtual void CopyText();
+ virtual void PasteText();
+ virtual void CutText();
+
+ CPDF_Rect GetContentRect() const;
+ void GetCaretPos(int32_t& x, int32_t& y) const;
+ FX_BOOL IsModified() const;
+
+ CFX_WideString GetText() const;
+ void SetSel(int32_t nStartChar, int32_t nEndChar);
+ void GetSel(int32_t& nStartChar, int32_t& nEndChar) const;
+ void GetTextRange(const CPDF_Rect& rect,
+ int32_t& nStartChar,
+ int32_t& nEndChar) const;
+ CFX_WideString GetText(int32_t& nStartChar, int32_t& nEndChar) const;
+ void Clear();
+ void SelectAll();
+
+ int32_t GetCaret() const;
+ void SetCaret(int32_t nPos);
+ int32_t GetTotalWords() const;
+
+ void Paint();
+
+ void EnableRefresh(FX_BOOL bRefresh);
+ CPDF_Point GetScrollPos() const;
+ void SetScrollPos(const CPDF_Point& point);
+
+ void SetEditNotify(IPWL_Edit_Notify* pNotify) { m_pEditNotify = pNotify; }
+
+ void SetCharSet(uint8_t nCharSet) { m_nCharSet = nCharSet; }
+ int32_t GetCharSet() const;
+
+ void SetCodePage(int32_t nCodePage) { m_nCodePage = nCodePage; }
+ int32_t GetCodePage() const { return m_nCodePage; }
+
+ CPDF_Font* GetCaretFont() const;
+ FX_FLOAT GetCaretFontSize() const;
+
+ FX_BOOL CanUndo() const;
+ FX_BOOL CanRedo() const;
+ void Redo();
+ void Undo();
+
+ void SetReadyToInput();
+
+ protected:
+ virtual void ShowVScrollBar(FX_BOOL bShow);
+
+ virtual void InsertWord(FX_WORD word, int32_t nCharset);
+ virtual void InsertReturn();
+ virtual void InsertText(const FX_WCHAR* csText);
+
+ virtual void SetCursor();
+ FX_BOOL IsWndHorV();
+
+ void Delete();
+ void Backspace();
+
+ protected:
+ void GetCaretInfo(CPDF_Point& ptHead, CPDF_Point& ptFoot) const;
+ void SetCaret(FX_BOOL bVisible,
+ const CPDF_Point& ptHead,
+ const CPDF_Point& ptFoot);
+
+ void SetEditCaret(FX_BOOL bVisible);
+
+ protected:
+ virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin,
+ FX_FLOAT fPlateMax,
+ FX_FLOAT fContentMin,
+ FX_FLOAT fContentMax,
+ FX_FLOAT fSmallStep,
+ FX_FLOAT fBigStep) {}
+ virtual void IOnSetScrollInfoY(FX_FLOAT fPlateMin,
+ FX_FLOAT fPlateMax,
+ FX_FLOAT fContentMin,
+ FX_FLOAT fContentMax,
+ FX_FLOAT fSmallStep,
+ FX_FLOAT fBigStep);
+ virtual void IOnSetScrollPosX(FX_FLOAT fx) {}
+ virtual void IOnSetScrollPosY(FX_FLOAT fy);
+ virtual void IOnSetCaret(FX_BOOL bVisible,
+ const CPDF_Point& ptHead,
+ const CPDF_Point& ptFoot,
+ const CPVT_WordPlace& place);
+ virtual void IOnCaretChange(const CPVT_SecProps& secProps,
+ const CPVT_WordProps& wordProps);
+ virtual void IOnContentChange(const CPDF_Rect& rcContent);
+ virtual void IOnInvalidateRect(CPDF_Rect* pRect);
+
+ private:
+ void CreateEditCaret(const PWL_CREATEPARAM& cp);
+
+ protected:
+ IFX_Edit* m_pEdit;
+ CPWL_Caret* m_pEditCaret;
+ FX_BOOL m_bMouseDown;
+ IPWL_Edit_Notify* m_pEditNotify;
+
+ private:
+ int32_t m_nCharSet;
+ int32_t m_nCodePage;
};
#endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_EDITCTRL_H_
diff --git a/fpdfsdk/include/pdfwindow/PWL_FontMap.h b/fpdfsdk/include/pdfwindow/PWL_FontMap.h
index 562d5df9c1..0f5124ca02 100644
--- a/fpdfsdk/include/pdfwindow/PWL_FontMap.h
+++ b/fpdfsdk/include/pdfwindow/PWL_FontMap.h
@@ -13,118 +13,127 @@
class CPDF_Document;
class IFX_SystemHandler;
-struct CPWL_FontMap_Data
-{
- CPDF_Font* pFont;
- int32_t nCharset;
- CFX_ByteString sFontName;
+struct CPWL_FontMap_Data {
+ CPDF_Font* pFont;
+ int32_t nCharset;
+ CFX_ByteString sFontName;
};
-struct CPWL_FontMap_Native
-{
- int32_t nCharset;
- CFX_ByteString sFontName;
+struct CPWL_FontMap_Native {
+ int32_t nCharset;
+ CFX_ByteString sFontName;
};
#ifndef ANSI_CHARSET
-#define ANSI_CHARSET 0
-#define DEFAULT_CHARSET 1
-#define SYMBOL_CHARSET 2
-#define SHIFTJIS_CHARSET 128
-#define HANGEUL_CHARSET 129
-#define HANGUL_CHARSET 129
-#define GB2312_CHARSET 134
-#define CHINESEBIG5_CHARSET 136
-#define OEM_CHARSET 255
-#define JOHAB_CHARSET 130
-#define HEBREW_CHARSET 177
-#define ARABIC_CHARSET 178
-#define GREEK_CHARSET 161
-#define TURKISH_CHARSET 162
-#define VIETNAMESE_CHARSET 163
-#define THAI_CHARSET 222
-#define EASTEUROPE_CHARSET 238
-#define RUSSIAN_CHARSET 204
-#define BALTIC_CHARSET 186
+#define ANSI_CHARSET 0
+#define DEFAULT_CHARSET 1
+#define SYMBOL_CHARSET 2
+#define SHIFTJIS_CHARSET 128
+#define HANGEUL_CHARSET 129
+#define HANGUL_CHARSET 129
+#define GB2312_CHARSET 134
+#define CHINESEBIG5_CHARSET 136
+#define OEM_CHARSET 255
+#define JOHAB_CHARSET 130
+#define HEBREW_CHARSET 177
+#define ARABIC_CHARSET 178
+#define GREEK_CHARSET 161
+#define TURKISH_CHARSET 162
+#define VIETNAMESE_CHARSET 163
+#define THAI_CHARSET 222
+#define EASTEUROPE_CHARSET 238
+#define RUSSIAN_CHARSET 204
+#define BALTIC_CHARSET 186
#endif
-class CPWL_FontMap : public IFX_Edit_FontMap
-{
-public:
- CPWL_FontMap(IFX_SystemHandler* pSystemHandler);
- virtual ~CPWL_FontMap();
-
- virtual CPDF_Font* GetPDFFont(int32_t nFontIndex);
- virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex);
- virtual int32_t GetWordFontIndex(FX_WORD word, int32_t nCharset, int32_t nFontIndex);
- virtual int32_t CharCodeFromUnicode(int32_t nFontIndex, FX_WORD word);
- virtual int32_t CharSetFromUnicode(FX_WORD word, int32_t nOldCharset);
-
-public:
- virtual void Initial(const FX_CHAR* fontname = NULL);
- void SetSystemHandler(IFX_SystemHandler* pSystemHandler);
-
- int32_t GetFontMapCount() const;
- const CPWL_FontMap_Data* GetFontMapData(int32_t nIndex) const;
-
-public:
- static int32_t GetNativeCharset();
- CFX_ByteString GetNativeFontName(int32_t nCharset);
-
- static CFX_ByteString GetDefaultFontByCharset(int32_t nCharset);
-
- CPDF_Font* AddFontToDocument(CPDF_Document* pDoc, CFX_ByteString& sFontName, uint8_t nCharset);
- static FX_BOOL IsStandardFont(const CFX_ByteString& sFontName);
- CPDF_Font* AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName);
- CPDF_Font* AddSystemFont(CPDF_Document* pDoc, CFX_ByteString& sFontName,
- uint8_t nCharset);
-
-protected:
- virtual CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias, int32_t nCharset);
- virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias);
- FX_BOOL KnowWord(int32_t nFontIndex, FX_WORD word);
-
- virtual CPDF_Document* GetDocument();
-
- void Empty();
- int32_t GetFontIndex(const CFX_ByteString& sFontName, int32_t nCharset, FX_BOOL bFind);
- int32_t GetPWLFontIndex(FX_WORD word, int32_t nCharset);
- int32_t AddFontData(CPDF_Font* pFont, const CFX_ByteString& sFontAlias, int32_t nCharset = DEFAULT_CHARSET);
-
- CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName, int32_t nCharset);
- CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName);
-
-private:
- CFX_ByteString GetFontName(int32_t nFontIndex);
- int32_t FindFont(const CFX_ByteString& sFontName, int32_t nCharset = DEFAULT_CHARSET);
-
- CFX_ByteString GetNativeFont(int32_t nCharset);
-
-public:
- using CharsetFontMap = FPDF_CharsetFontMap;
- static const CharsetFontMap defaultTTFMap[];
-
-protected:
- CFX_ArrayTemplate<CPWL_FontMap_Data*> m_aData;
- CFX_ArrayTemplate<CPWL_FontMap_Native*> m_aNativeFont;
-
-private:
- CPDF_Document* m_pPDFDoc;
- IFX_SystemHandler* m_pSystemHandler;
+class CPWL_FontMap : public IFX_Edit_FontMap {
+ public:
+ CPWL_FontMap(IFX_SystemHandler* pSystemHandler);
+ virtual ~CPWL_FontMap();
+
+ virtual CPDF_Font* GetPDFFont(int32_t nFontIndex);
+ virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex);
+ virtual int32_t GetWordFontIndex(FX_WORD word,
+ int32_t nCharset,
+ int32_t nFontIndex);
+ virtual int32_t CharCodeFromUnicode(int32_t nFontIndex, FX_WORD word);
+ virtual int32_t CharSetFromUnicode(FX_WORD word, int32_t nOldCharset);
+
+ public:
+ virtual void Initial(const FX_CHAR* fontname = NULL);
+ void SetSystemHandler(IFX_SystemHandler* pSystemHandler);
+
+ int32_t GetFontMapCount() const;
+ const CPWL_FontMap_Data* GetFontMapData(int32_t nIndex) const;
+
+ public:
+ static int32_t GetNativeCharset();
+ CFX_ByteString GetNativeFontName(int32_t nCharset);
+
+ static CFX_ByteString GetDefaultFontByCharset(int32_t nCharset);
+
+ CPDF_Font* AddFontToDocument(CPDF_Document* pDoc,
+ CFX_ByteString& sFontName,
+ uint8_t nCharset);
+ static FX_BOOL IsStandardFont(const CFX_ByteString& sFontName);
+ CPDF_Font* AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName);
+ CPDF_Font* AddSystemFont(CPDF_Document* pDoc,
+ CFX_ByteString& sFontName,
+ uint8_t nCharset);
+
+ protected:
+ virtual CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias,
+ int32_t nCharset);
+ virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias);
+ FX_BOOL KnowWord(int32_t nFontIndex, FX_WORD word);
+
+ virtual CPDF_Document* GetDocument();
+
+ void Empty();
+ int32_t GetFontIndex(const CFX_ByteString& sFontName,
+ int32_t nCharset,
+ FX_BOOL bFind);
+ int32_t GetPWLFontIndex(FX_WORD word, int32_t nCharset);
+ int32_t AddFontData(CPDF_Font* pFont,
+ const CFX_ByteString& sFontAlias,
+ int32_t nCharset = DEFAULT_CHARSET);
+
+ CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName,
+ int32_t nCharset);
+ CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName);
+
+ private:
+ CFX_ByteString GetFontName(int32_t nFontIndex);
+ int32_t FindFont(const CFX_ByteString& sFontName,
+ int32_t nCharset = DEFAULT_CHARSET);
+
+ CFX_ByteString GetNativeFont(int32_t nCharset);
+
+ public:
+ using CharsetFontMap = FPDF_CharsetFontMap;
+ static const CharsetFontMap defaultTTFMap[];
+
+ protected:
+ CFX_ArrayTemplate<CPWL_FontMap_Data*> m_aData;
+ CFX_ArrayTemplate<CPWL_FontMap_Native*> m_aNativeFont;
+
+ private:
+ CPDF_Document* m_pPDFDoc;
+ IFX_SystemHandler* m_pSystemHandler;
};
-class CPWL_DocFontMap : public CPWL_FontMap
-{
-public:
- CPWL_DocFontMap(IFX_SystemHandler* pSystemHandler, CPDF_Document* pAttachedDoc);
- virtual ~CPWL_DocFontMap();
+class CPWL_DocFontMap : public CPWL_FontMap {
+ public:
+ CPWL_DocFontMap(IFX_SystemHandler* pSystemHandler,
+ CPDF_Document* pAttachedDoc);
+ virtual ~CPWL_DocFontMap();
- virtual CPDF_Document* GetDocument();
+ virtual CPDF_Document* GetDocument();
-private:
- CPDF_Document* m_pAttachedDoc;
+ private:
+ CPDF_Document* m_pAttachedDoc;
};
#endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_FONTMAP_H_
diff --git a/fpdfsdk/include/pdfwindow/PWL_Icon.h b/fpdfsdk/include/pdfwindow/PWL_Icon.h
index cff4e8ca69..7183f0245c 100644
--- a/fpdfsdk/include/pdfwindow/PWL_Icon.h
+++ b/fpdfsdk/include/pdfwindow/PWL_Icon.h
@@ -10,51 +10,48 @@
#include "../../../core/include/fxcrt/fx_string.h"
#include "PWL_Wnd.h"
-class CPWL_Image : public CPWL_Wnd
-{
-public:
- CPWL_Image();
- virtual ~CPWL_Image();
-
- virtual CFX_ByteString GetImageAppStream();
-
- virtual void GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale);
- virtual void GetImageOffset(FX_FLOAT & x,FX_FLOAT & y);
- virtual CPDF_Stream * GetPDFStream();
-
-public:
- void SetPDFStream(CPDF_Stream* pStream);
- void GetImageSize(FX_FLOAT & fWidth,FX_FLOAT & fHeight);
- CPDF_Matrix GetImageMatrix();
- CFX_ByteString GetImageAlias();
- void SetImageAlias(const FX_CHAR* sImageAlias);
-
-protected:
- CPDF_Stream* m_pPDFStream;
- CFX_ByteString m_sImageAlias;
+class CPWL_Image : public CPWL_Wnd {
+ public:
+ CPWL_Image();
+ virtual ~CPWL_Image();
+
+ virtual CFX_ByteString GetImageAppStream();
+
+ virtual void GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale);
+ virtual void GetImageOffset(FX_FLOAT& x, FX_FLOAT& y);
+ virtual CPDF_Stream* GetPDFStream();
+
+ public:
+ void SetPDFStream(CPDF_Stream* pStream);
+ void GetImageSize(FX_FLOAT& fWidth, FX_FLOAT& fHeight);
+ CPDF_Matrix GetImageMatrix();
+ CFX_ByteString GetImageAlias();
+ void SetImageAlias(const FX_CHAR* sImageAlias);
+
+ protected:
+ CPDF_Stream* m_pPDFStream;
+ CFX_ByteString m_sImageAlias;
};
-class CPWL_Icon : public CPWL_Image
-{
-public:
- CPWL_Icon();
- virtual ~CPWL_Icon();
+class CPWL_Icon : public CPWL_Image {
+ public:
+ CPWL_Icon();
+ virtual ~CPWL_Icon();
- virtual CPDF_IconFit * GetIconFit(){return m_pIconFit;};
+ virtual CPDF_IconFit* GetIconFit() { return m_pIconFit; };
- virtual void GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale);
- virtual void GetImageOffset(FX_FLOAT & x,FX_FLOAT & y);
+ virtual void GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale);
+ virtual void GetImageOffset(FX_FLOAT& x, FX_FLOAT& y);
- int32_t GetScaleMethod();
- FX_BOOL IsProportionalScale();
- void GetIconPosition(FX_FLOAT & fLeft, FX_FLOAT & fBottom);
- FX_BOOL GetFittingBounds();
+ int32_t GetScaleMethod();
+ FX_BOOL IsProportionalScale();
+ void GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom);
+ FX_BOOL GetFittingBounds();
- void SetIconFit(CPDF_IconFit * pIconFit){m_pIconFit = pIconFit;};
+ void SetIconFit(CPDF_IconFit* pIconFit) { m_pIconFit = pIconFit; };
-private:
- CPDF_IconFit * m_pIconFit;
+ private:
+ CPDF_IconFit* m_pIconFit;
};
-
#endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_ICON_H_
diff --git a/fpdfsdk/include/pdfwindow/PWL_IconList.h b/fpdfsdk/include/pdfwindow/PWL_IconList.h
index b8bc3d2957..30a12dcd9b 100644
--- a/fpdfsdk/include/pdfwindow/PWL_IconList.h
+++ b/fpdfsdk/include/pdfwindow/PWL_IconList.h
@@ -17,112 +17,114 @@ class CPWL_IconList_Content;
class CPWL_IconList;
class CPWL_Label;
-class IPWL_IconList_Notify
-{
-public:
- virtual ~IPWL_IconList_Notify() { }
- virtual void OnNoteListSelChanged(int32_t nItemIndex) = 0;
+class IPWL_IconList_Notify {
+ public:
+ virtual ~IPWL_IconList_Notify() {}
+ virtual void OnNoteListSelChanged(int32_t nItemIndex) = 0;
};
-class CPWL_IconList_Item : public CPWL_Wnd
-{
-public:
- CPWL_IconList_Item();
- virtual ~CPWL_IconList_Item();
-
- virtual CFX_ByteString GetClassName() const;
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
- virtual void RePosChildWnd();
-
- void SetSelect(FX_BOOL bSelected);
- FX_BOOL IsSelected() const;
- void SetData(void* pData);
- void SetIcon(int32_t nIconIndex);
- void SetText(const CFX_WideString& str);
- void SetIconFillColor(const CPWL_Color& color);
- CFX_WideString GetText() const;
-
-protected:
- virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth);
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-
- virtual void OnEnabled();
- virtual void OnDisabled();
-
-private:
- int32_t m_nIconIndex;
- void* m_pData;
- FX_BOOL m_bSelected;
- CPWL_Label* m_pText;
- CPWL_Color m_crIcon;
+class CPWL_IconList_Item : public CPWL_Wnd {
+ public:
+ CPWL_IconList_Item();
+ virtual ~CPWL_IconList_Item();
+
+ virtual CFX_ByteString GetClassName() const;
+ virtual void CreateChildWnd(const PWL_CREATEPARAM& cp);
+ virtual void RePosChildWnd();
+
+ void SetSelect(FX_BOOL bSelected);
+ FX_BOOL IsSelected() const;
+ void SetData(void* pData);
+ void SetIcon(int32_t nIconIndex);
+ void SetText(const CFX_WideString& str);
+ void SetIconFillColor(const CPWL_Color& color);
+ CFX_WideString GetText() const;
+
+ protected:
+ virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth);
+ virtual void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device);
+
+ virtual void OnEnabled();
+ virtual void OnDisabled();
+
+ private:
+ int32_t m_nIconIndex;
+ void* m_pData;
+ FX_BOOL m_bSelected;
+ CPWL_Label* m_pText;
+ CPWL_Color m_crIcon;
};
-class CPWL_IconList_Content : public CPWL_ListCtrl
-{
-public:
- CPWL_IconList_Content(int32_t nListCount);
- virtual ~CPWL_IconList_Content();
-
- void SetSelect(int32_t nIndex);
- int32_t GetSelect() const;
- void SetNotify(IPWL_IconList_Notify* pNotify);
- void EnableNotify(FX_BOOL bNotify);
- void SetListData(int32_t nItemIndex, void* pData);
- void SetListIcon(int32_t nItemIndex, int32_t nIconIndex);
- void SetListString(int32_t nItemIndex, const CFX_WideString& str);
- void SetIconFillColor(const CPWL_Color& color);
- CFX_WideString GetListString(int32_t nItemIndex) const;
- IPWL_IconList_Notify* GetNotify() const;
- void ScrollToItem(int32_t nItemIndex);
-
-protected:
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
-
-private:
- CPWL_IconList_Item* GetListItem(int32_t nItemIndex) const;
- void SelectItem(int32_t nItemIndex, FX_BOOL bSelect);
- int32_t FindItemIndex(const CPDF_Point& point);
-
- int32_t m_nSelectIndex;
- IPWL_IconList_Notify* m_pNotify;
- FX_BOOL m_bEnableNotify;
- FX_BOOL m_bMouseDown;
- int32_t m_nListCount;
+class CPWL_IconList_Content : public CPWL_ListCtrl {
+ public:
+ CPWL_IconList_Content(int32_t nListCount);
+ virtual ~CPWL_IconList_Content();
+
+ void SetSelect(int32_t nIndex);
+ int32_t GetSelect() const;
+ void SetNotify(IPWL_IconList_Notify* pNotify);
+ void EnableNotify(FX_BOOL bNotify);
+ void SetListData(int32_t nItemIndex, void* pData);
+ void SetListIcon(int32_t nItemIndex, int32_t nIconIndex);
+ void SetListString(int32_t nItemIndex, const CFX_WideString& str);
+ void SetIconFillColor(const CPWL_Color& color);
+ CFX_WideString GetListString(int32_t nItemIndex) const;
+ IPWL_IconList_Notify* GetNotify() const;
+ void ScrollToItem(int32_t nItemIndex);
+
+ protected:
+ virtual void CreateChildWnd(const PWL_CREATEPARAM& cp);
+ virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
+
+ private:
+ CPWL_IconList_Item* GetListItem(int32_t nItemIndex) const;
+ void SelectItem(int32_t nItemIndex, FX_BOOL bSelect);
+ int32_t FindItemIndex(const CPDF_Point& point);
+
+ int32_t m_nSelectIndex;
+ IPWL_IconList_Notify* m_pNotify;
+ FX_BOOL m_bEnableNotify;
+ FX_BOOL m_bMouseDown;
+ int32_t m_nListCount;
};
-class CPWL_IconList : public CPWL_Wnd
-{
-public:
- CPWL_IconList(int32_t nListCount);
- virtual ~CPWL_IconList();
-
- virtual FX_BOOL OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);
-
- void SetSelect(int32_t nIndex);
- void SetTopItem(int32_t nIndex);
- int32_t GetSelect() const;
- void SetNotify(IPWL_IconList_Notify* pNotify);
- void EnableNotify(FX_BOOL bNotify);
- void SetListData(int32_t nItemIndex, void* pData);
- void SetListIcon(int32_t nItemIndex, int32_t nIconIndex);
- void SetListString(int32_t nItemIndex, const CFX_WideString& str);
- void SetIconFillColor(const CPWL_Color& color);
- CFX_WideString GetListString(int32_t nItemIndex) const;
-
-protected:
- virtual void OnCreated();
- virtual void RePosChildWnd();
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
-
- virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0);
-
-private:
- CPWL_IconList_Content* m_pListContent;
- int32_t m_nListCount;
+class CPWL_IconList : public CPWL_Wnd {
+ public:
+ CPWL_IconList(int32_t nListCount);
+ virtual ~CPWL_IconList();
+
+ virtual FX_BOOL OnMouseWheel(short zDelta,
+ const CPDF_Point& point,
+ FX_DWORD nFlag);
+
+ void SetSelect(int32_t nIndex);
+ void SetTopItem(int32_t nIndex);
+ int32_t GetSelect() const;
+ void SetNotify(IPWL_IconList_Notify* pNotify);
+ void EnableNotify(FX_BOOL bNotify);
+ void SetListData(int32_t nItemIndex, void* pData);
+ void SetListIcon(int32_t nItemIndex, int32_t nIconIndex);
+ void SetListString(int32_t nItemIndex, const CFX_WideString& str);
+ void SetIconFillColor(const CPWL_Color& color);
+ CFX_WideString GetListString(int32_t nItemIndex) const;
+
+ protected:
+ virtual void OnCreated();
+ virtual void RePosChildWnd();
+ virtual void CreateChildWnd(const PWL_CREATEPARAM& cp);
+
+ virtual void OnNotify(CPWL_Wnd* pWnd,
+ FX_DWORD msg,
+ intptr_t wParam = 0,
+ intptr_t lParam = 0);
+
+ private:
+ CPWL_IconList_Content* m_pListContent;
+ int32_t m_nListCount;
};
#endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_ICONLIST_H_
diff --git a/fpdfsdk/include/pdfwindow/PWL_Label.h b/fpdfsdk/include/pdfwindow/PWL_Label.h
index 3df547e0b2..b6cb7f557c 100644
--- a/fpdfsdk/include/pdfwindow/PWL_Label.h
+++ b/fpdfsdk/include/pdfwindow/PWL_Label.h
@@ -11,35 +11,35 @@
class IFX_Edit;
-class CPWL_Label : public CPWL_Wnd
-{
-public:
- CPWL_Label();
- virtual ~CPWL_Label();
-
- virtual CFX_ByteString GetClassName() const;
- virtual void SetFontSize(FX_FLOAT fFontSize);
- virtual FX_FLOAT GetFontSize() const;
-
- void SetText(const FX_WCHAR* csText);
- CFX_WideString GetText() const;
- void SetLimitChar(int32_t nLimitChar);
- void SetHorzScale(int32_t nHorzScale);
- void SetCharSpace(FX_FLOAT fCharSpace);
- CPDF_Rect GetContentRect() const;
- int32_t GetTotalWords();
- CFX_ByteString GetTextAppearanceStream(const CPDF_Point & ptOffset) const;
-
-protected:
- virtual void OnCreated();
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
- virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
- virtual void RePosChildWnd();
-
-private:
- void SetParamByFlag();
-
- IFX_Edit* m_pEdit;
+class CPWL_Label : public CPWL_Wnd {
+ public:
+ CPWL_Label();
+ virtual ~CPWL_Label();
+
+ virtual CFX_ByteString GetClassName() const;
+ virtual void SetFontSize(FX_FLOAT fFontSize);
+ virtual FX_FLOAT GetFontSize() const;
+
+ void SetText(const FX_WCHAR* csText);
+ CFX_WideString GetText() const;
+ void SetLimitChar(int32_t nLimitChar);
+ void SetHorzScale(int32_t nHorzScale);
+ void SetCharSpace(FX_FLOAT fCharSpace);
+ CPDF_Rect GetContentRect() const;
+ int32_t GetTotalWords();
+ CFX_ByteString GetTextAppearanceStream(const CPDF_Point& ptOffset) const;
+
+ protected:
+ virtual void OnCreated();
+ virtual void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device);
+ virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream);
+ virtual void RePosChildWnd();
+
+ private:
+ void SetParamByFlag();
+
+ IFX_Edit* m_pEdit;
};
#endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_LABEL_H_
diff --git a/fpdfsdk/include/pdfwindow/PWL_ListBox.h b/fpdfsdk/include/pdfwindow/PWL_ListBox.h
index 7c37fb30ef..b9372eff9c 100644
--- a/fpdfsdk/include/pdfwindow/PWL_ListBox.h
+++ b/fpdfsdk/include/pdfwindow/PWL_ListBox.h
@@ -15,89 +15,107 @@ class CPWL_List_Notify;
class CPWL_ListBox;
class IPWL_Filler_Notify;
-class CPWL_List_Notify : public IFX_List_Notify
-{
-public:
- CPWL_List_Notify(CPWL_ListBox * pList);
- virtual ~CPWL_List_Notify();
-
- void IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin, FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep, FX_FLOAT fBigStep){}
- void IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin, FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep, FX_FLOAT fBigStep);
- void IOnSetScrollPosX(FX_FLOAT fx){}
- void IOnSetScrollPosY(FX_FLOAT fy);
- void IOnSetCaret(FX_BOOL bVisible,const CPDF_Point & ptHead,const CPDF_Point & ptFoot, const CPVT_WordPlace& place);
- void IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps);
- void IOnInvalidateRect(CPDF_Rect * pRect);
-
-private:
- CPWL_ListBox* m_pList;
+class CPWL_List_Notify : public IFX_List_Notify {
+ public:
+ CPWL_List_Notify(CPWL_ListBox* pList);
+ virtual ~CPWL_List_Notify();
+
+ void IOnSetScrollInfoX(FX_FLOAT fPlateMin,
+ FX_FLOAT fPlateMax,
+ FX_FLOAT fContentMin,
+ FX_FLOAT fContentMax,
+ FX_FLOAT fSmallStep,
+ FX_FLOAT fBigStep) {}
+ void IOnSetScrollInfoY(FX_FLOAT fPlateMin,
+ FX_FLOAT fPlateMax,
+ FX_FLOAT fContentMin,
+ FX_FLOAT fContentMax,
+ FX_FLOAT fSmallStep,
+ FX_FLOAT fBigStep);
+ void IOnSetScrollPosX(FX_FLOAT fx) {}
+ void IOnSetScrollPosY(FX_FLOAT fy);
+ void IOnSetCaret(FX_BOOL bVisible,
+ const CPDF_Point& ptHead,
+ const CPDF_Point& ptFoot,
+ const CPVT_WordPlace& place);
+ void IOnCaretChange(const CPVT_SecProps& secProps,
+ const CPVT_WordProps& wordProps);
+ void IOnInvalidateRect(CPDF_Rect* pRect);
+
+ private:
+ CPWL_ListBox* m_pList;
};
-class CPWL_ListBox : public CPWL_Wnd
-{
-public:
- CPWL_ListBox();
- virtual ~CPWL_ListBox();
-
- virtual CFX_ByteString GetClassName() const;
- virtual void OnCreated();
- virtual void OnDestroy();
- virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-
- virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
- virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);
- virtual void KillFocus();
-
- virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0);
- virtual void RePosChildWnd();
- virtual CFX_WideString GetText() const;
- virtual CPDF_Rect GetFocusRect() const;
- virtual void SetFontSize(FX_FLOAT fFontSize);
- virtual FX_FLOAT GetFontSize() const;
-
- void OnNotifySelChanged(FX_BOOL bKeyDown, FX_BOOL & bExit , FX_DWORD nFlag);
-
- void AddString(const FX_WCHAR* string);
- void SetTopVisibleIndex(int32_t nItemIndex);
- void ScrollToListItem(int32_t nItemIndex);
- void ResetContent();
- void Reset();
- void Select(int32_t nItemIndex);
- void SetCaret(int32_t nItemIndex);
- void SetHoverSel(FX_BOOL bHoverSel);
-
- int32_t GetCount() const;
- FX_BOOL IsMultipleSel() const;
- int32_t GetCaretIndex() const;
- int32_t GetCurSel() const;
- FX_BOOL IsItemSelected(int32_t nItemIndex) const;
- int32_t GetTopVisibleIndex() const;
- int32_t FindNext(int32_t nIndex,FX_WCHAR nChar) const;
- CPDF_Rect GetContentRect() const;
- FX_FLOAT GetFirstHeight() const;
- CPDF_Rect GetListRect() const;
-
- void SetFillerNotify(IPWL_Filler_Notify* pNotify) {m_pFillerNotify = pNotify;}
-
-protected:
- IFX_List* m_pList;
- CPWL_List_Notify* m_pListNotify;
- FX_BOOL m_bMouseDown;
- FX_BOOL m_bHoverSel;
- IPWL_Filler_Notify* m_pFillerNotify;
-public:
- void AttachFFLData(void* pData) {m_pFormFiller = pData;}
-private:
- void* m_pFormFiller;
+class CPWL_ListBox : public CPWL_Wnd {
+ public:
+ CPWL_ListBox();
+ virtual ~CPWL_ListBox();
+
+ virtual CFX_ByteString GetClassName() const;
+ virtual void OnCreated();
+ virtual void OnDestroy();
+ virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream);
+ virtual void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device);
+
+ virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
+ virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag);
+ virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnMouseWheel(short zDelta,
+ const CPDF_Point& point,
+ FX_DWORD nFlag);
+ virtual void KillFocus();
+
+ virtual void OnNotify(CPWL_Wnd* pWnd,
+ FX_DWORD msg,
+ intptr_t wParam = 0,
+ intptr_t lParam = 0);
+ virtual void RePosChildWnd();
+ virtual CFX_WideString GetText() const;
+ virtual CPDF_Rect GetFocusRect() const;
+ virtual void SetFontSize(FX_FLOAT fFontSize);
+ virtual FX_FLOAT GetFontSize() const;
+
+ void OnNotifySelChanged(FX_BOOL bKeyDown, FX_BOOL& bExit, FX_DWORD nFlag);
+
+ void AddString(const FX_WCHAR* string);
+ void SetTopVisibleIndex(int32_t nItemIndex);
+ void ScrollToListItem(int32_t nItemIndex);
+ void ResetContent();
+ void Reset();
+ void Select(int32_t nItemIndex);
+ void SetCaret(int32_t nItemIndex);
+ void SetHoverSel(FX_BOOL bHoverSel);
+
+ int32_t GetCount() const;
+ FX_BOOL IsMultipleSel() const;
+ int32_t GetCaretIndex() const;
+ int32_t GetCurSel() const;
+ FX_BOOL IsItemSelected(int32_t nItemIndex) const;
+ int32_t GetTopVisibleIndex() const;
+ int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const;
+ CPDF_Rect GetContentRect() const;
+ FX_FLOAT GetFirstHeight() const;
+ CPDF_Rect GetListRect() const;
+
+ void SetFillerNotify(IPWL_Filler_Notify* pNotify) {
+ m_pFillerNotify = pNotify;
+ }
+
+ protected:
+ IFX_List* m_pList;
+ CPWL_List_Notify* m_pListNotify;
+ FX_BOOL m_bMouseDown;
+ FX_BOOL m_bHoverSel;
+ IPWL_Filler_Notify* m_pFillerNotify;
+
+ public:
+ void AttachFFLData(void* pData) { m_pFormFiller = pData; }
+
+ private:
+ void* m_pFormFiller;
};
#endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_LISTBOX_H_
diff --git a/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h b/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h
index c107a0cf5e..cd90692150 100644
--- a/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h
+++ b/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h
@@ -9,39 +9,39 @@
#include "PWL_Wnd.h"
-class CPWL_ListCtrl : public CPWL_Wnd
-{
-public:
- CPWL_ListCtrl();
- virtual ~CPWL_ListCtrl();
-
- void SetScrollPos(const CPDF_Point& point);
- CPDF_Point GetScrollPos() const;
- CPDF_Rect GetScrollArea() const;
- void SetItemSpace(FX_FLOAT fSpace);
- void SetTopSpace(FX_FLOAT fSpace);
- void SetBottomSpace(FX_FLOAT fSpace);
- void ResetFace();
- void ResetContent(int32_t nStart);
- int32_t GetItemIndex(CPWL_Wnd* pItem);
- FX_FLOAT GetContentsHeight(FX_FLOAT fLimitWidth);
- CPDF_Point InToOut(const CPDF_Point& point) const;
- CPDF_Point OutToIn(const CPDF_Point& point) const;
- CPDF_Rect InToOut(const CPDF_Rect& rect) const;
- CPDF_Rect OutToIn(const CPDF_Rect& rect) const;
-
-protected:
- virtual void RePosChildWnd();
- virtual void DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-
-private:
- void ResetAll(FX_BOOL bMove,int32_t nStart);
-
- CPDF_Rect m_rcContent;
- CPDF_Point m_ptScroll;
- FX_FLOAT m_fItemSpace;
- FX_FLOAT m_fTopSpace;
- FX_FLOAT m_fBottomSpace;
+class CPWL_ListCtrl : public CPWL_Wnd {
+ public:
+ CPWL_ListCtrl();
+ virtual ~CPWL_ListCtrl();
+
+ void SetScrollPos(const CPDF_Point& point);
+ CPDF_Point GetScrollPos() const;
+ CPDF_Rect GetScrollArea() const;
+ void SetItemSpace(FX_FLOAT fSpace);
+ void SetTopSpace(FX_FLOAT fSpace);
+ void SetBottomSpace(FX_FLOAT fSpace);
+ void ResetFace();
+ void ResetContent(int32_t nStart);
+ int32_t GetItemIndex(CPWL_Wnd* pItem);
+ FX_FLOAT GetContentsHeight(FX_FLOAT fLimitWidth);
+ CPDF_Point InToOut(const CPDF_Point& point) const;
+ CPDF_Point OutToIn(const CPDF_Point& point) const;
+ CPDF_Rect InToOut(const CPDF_Rect& rect) const;
+ CPDF_Rect OutToIn(const CPDF_Rect& rect) const;
+
+ protected:
+ virtual void RePosChildWnd();
+ virtual void DrawChildAppearance(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device);
+
+ private:
+ void ResetAll(FX_BOOL bMove, int32_t nStart);
+
+ CPDF_Rect m_rcContent;
+ CPDF_Point m_ptScroll;
+ FX_FLOAT m_fItemSpace;
+ FX_FLOAT m_fTopSpace;
+ FX_FLOAT m_fBottomSpace;
};
#endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_LISTCTRL_H_
diff --git a/fpdfsdk/include/pdfwindow/PWL_Note.h b/fpdfsdk/include/pdfwindow/PWL_Note.h
index 29b7857e20..4f18fa20d0 100644
--- a/fpdfsdk/include/pdfwindow/PWL_Note.h
+++ b/fpdfsdk/include/pdfwindow/PWL_Note.h
@@ -28,333 +28,342 @@ class IPWL_NoteItem;
class IPWL_NoteNotify;
class IPopup_Note;
-class IPWL_NoteNotify
-{
-public:
- virtual ~IPWL_NoteNotify() { }
- virtual void OnNoteMove(const FX_RECT& rtWin) = 0;
- virtual void OnNoteShow(FX_BOOL bShow) = 0;
- virtual void OnNoteActivate(FX_BOOL bActive) = 0;
- virtual void OnNoteClose() = 0;
- virtual void OnItemCreate(IPWL_NoteItem* pItem) = 0;
- virtual void OnItemDelete(IPWL_NoteItem* pItem) = 0;
- virtual void OnSetAuthorName(IPWL_NoteItem* pItem) = 0;
- virtual void OnSetBkColor(IPWL_NoteItem* pItem) = 0;
- virtual void OnSetContents(IPWL_NoteItem* pItem) = 0;
- virtual void OnSetDateTime(IPWL_NoteItem* pItem) = 0;
- virtual void OnSetSubjectName(IPWL_NoteItem* pItem) = 0;
- virtual void OnPopupMenu(int32_t x, int32_t y) = 0;
- virtual void OnPopupMenu(IPWL_NoteItem* pItem, int32_t x, int32_t y) = 0;
+class IPWL_NoteNotify {
+ public:
+ virtual ~IPWL_NoteNotify() {}
+ virtual void OnNoteMove(const FX_RECT& rtWin) = 0;
+ virtual void OnNoteShow(FX_BOOL bShow) = 0;
+ virtual void OnNoteActivate(FX_BOOL bActive) = 0;
+ virtual void OnNoteClose() = 0;
+ virtual void OnItemCreate(IPWL_NoteItem* pItem) = 0;
+ virtual void OnItemDelete(IPWL_NoteItem* pItem) = 0;
+ virtual void OnSetAuthorName(IPWL_NoteItem* pItem) = 0;
+ virtual void OnSetBkColor(IPWL_NoteItem* pItem) = 0;
+ virtual void OnSetContents(IPWL_NoteItem* pItem) = 0;
+ virtual void OnSetDateTime(IPWL_NoteItem* pItem) = 0;
+ virtual void OnSetSubjectName(IPWL_NoteItem* pItem) = 0;
+ virtual void OnPopupMenu(int32_t x, int32_t y) = 0;
+ virtual void OnPopupMenu(IPWL_NoteItem* pItem, int32_t x, int32_t y) = 0;
};
-class IPWL_NoteHandler
-{
-public:
- virtual ~IPWL_NoteHandler() { }
- virtual void OnNoteColorChanged(const CPWL_Color& color) = 0;
+class IPWL_NoteHandler {
+ public:
+ virtual ~IPWL_NoteHandler() {}
+ virtual void OnNoteColorChanged(const CPWL_Color& color) = 0;
};
-class IPWL_NoteItem
-{
-public:
- virtual ~IPWL_NoteItem() { }
- virtual void SetPrivateData(void* pData) = 0;
- virtual void SetBkColor(const CPWL_Color& color) = 0;
- virtual void SetSubjectName(const CFX_WideString& sName) = 0;
- virtual void SetAuthorName(const CFX_WideString& sName) = 0;
- virtual void SetDateTime(FX_SYSTEMTIME time) = 0;
- virtual void SetContents(const CFX_WideString& sContents) = 0;
-
- virtual IPWL_NoteItem* CreateSubItem() = 0;
- virtual int32_t CountSubItems() const = 0;
- virtual IPWL_NoteItem* GetSubItems(int32_t index) const = 0;
- virtual void DeleteSubItem(IPWL_NoteItem* pNoteItem) = 0;
- virtual void SetFocus() = 0;
-
- virtual IPWL_NoteItem* GetParentItem() const = 0;
- virtual void* GetPrivateData() const = 0;
- virtual CFX_WideString GetAuthorName() const = 0;
- virtual CPWL_Color GetBkColor() const = 0;
- virtual CFX_WideString GetContents() const = 0;
- virtual FX_SYSTEMTIME GetDateTime() const = 0;
- virtual CFX_WideString GetSubjectName() const = 0;
-
- virtual CPWL_Edit* GetEdit() const = 0;
+class IPWL_NoteItem {
+ public:
+ virtual ~IPWL_NoteItem() {}
+ virtual void SetPrivateData(void* pData) = 0;
+ virtual void SetBkColor(const CPWL_Color& color) = 0;
+ virtual void SetSubjectName(const CFX_WideString& sName) = 0;
+ virtual void SetAuthorName(const CFX_WideString& sName) = 0;
+ virtual void SetDateTime(FX_SYSTEMTIME time) = 0;
+ virtual void SetContents(const CFX_WideString& sContents) = 0;
+
+ virtual IPWL_NoteItem* CreateSubItem() = 0;
+ virtual int32_t CountSubItems() const = 0;
+ virtual IPWL_NoteItem* GetSubItems(int32_t index) const = 0;
+ virtual void DeleteSubItem(IPWL_NoteItem* pNoteItem) = 0;
+ virtual void SetFocus() = 0;
+
+ virtual IPWL_NoteItem* GetParentItem() const = 0;
+ virtual void* GetPrivateData() const = 0;
+ virtual CFX_WideString GetAuthorName() const = 0;
+ virtual CPWL_Color GetBkColor() const = 0;
+ virtual CFX_WideString GetContents() const = 0;
+ virtual FX_SYSTEMTIME GetDateTime() const = 0;
+ virtual CFX_WideString GetSubjectName() const = 0;
+
+ virtual CPWL_Edit* GetEdit() const = 0;
};
-class CPWL_Note_Icon : public CPWL_Wnd
-{
-public:
- CPWL_Note_Icon();
- virtual ~CPWL_Note_Icon();
+class CPWL_Note_Icon : public CPWL_Wnd {
+ public:
+ CPWL_Note_Icon();
+ virtual ~CPWL_Note_Icon();
- void SetIconType(int32_t nType);
+ void SetIconType(int32_t nType);
-public:
+ public:
+ protected:
+ virtual void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device);
-protected:
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-
-private:
- int32_t m_nType;
+ private:
+ int32_t m_nType;
};
-class CPWL_Note_CloseBox : public CPWL_Button
-{
-public:
- CPWL_Note_CloseBox();
- virtual ~CPWL_Note_CloseBox();
+class CPWL_Note_CloseBox : public CPWL_Button {
+ public:
+ CPWL_Note_CloseBox();
+ virtual ~CPWL_Note_CloseBox();
-protected:
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
+ protected:
+ virtual void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device);
+ virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag);
-private:
- FX_BOOL m_bMouseDown;
+ private:
+ FX_BOOL m_bMouseDown;
};
-class CPWL_Note_LBBox : public CPWL_Wnd
-{
-public:
- CPWL_Note_LBBox();
- virtual ~CPWL_Note_LBBox();
+class CPWL_Note_LBBox : public CPWL_Wnd {
+ public:
+ CPWL_Note_LBBox();
+ virtual ~CPWL_Note_LBBox();
-protected:
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+ protected:
+ virtual void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device);
};
-class CPWL_Note_RBBox : public CPWL_Wnd
-{
-public:
- CPWL_Note_RBBox();
- virtual ~CPWL_Note_RBBox();
+class CPWL_Note_RBBox : public CPWL_Wnd {
+ public:
+ CPWL_Note_RBBox();
+ virtual ~CPWL_Note_RBBox();
-protected:
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+ protected:
+ virtual void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device);
};
-class CPWL_Note_Edit : public CPWL_Edit
-{
-public:
- CPWL_Note_Edit();
- virtual ~CPWL_Note_Edit();
-
- void EnableNotify(FX_BOOL bEnable) {m_bEnableNotify = bEnable;}
- virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth);
- FX_FLOAT GetItemLeftMargin();
- FX_FLOAT GetItemRightMargin();
-
- virtual void SetText(const FX_WCHAR* csText);
-
-protected:
- virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0);
- virtual void RePosChildWnd();
- virtual void OnSetFocus();
- virtual void OnKillFocus();
-
-private:
- FX_BOOL m_bEnableNotify;
- FX_FLOAT m_fOldItemHeight;
- FX_BOOL m_bSizeChanged;
- FX_FLOAT m_fOldMin;
- FX_FLOAT m_fOldMax;
+class CPWL_Note_Edit : public CPWL_Edit {
+ public:
+ CPWL_Note_Edit();
+ virtual ~CPWL_Note_Edit();
+
+ void EnableNotify(FX_BOOL bEnable) { m_bEnableNotify = bEnable; }
+ virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth);
+ FX_FLOAT GetItemLeftMargin();
+ FX_FLOAT GetItemRightMargin();
+
+ virtual void SetText(const FX_WCHAR* csText);
+
+ protected:
+ virtual void OnNotify(CPWL_Wnd* pWnd,
+ FX_DWORD msg,
+ intptr_t wParam = 0,
+ intptr_t lParam = 0);
+ virtual void RePosChildWnd();
+ virtual void OnSetFocus();
+ virtual void OnKillFocus();
+
+ private:
+ FX_BOOL m_bEnableNotify;
+ FX_FLOAT m_fOldItemHeight;
+ FX_BOOL m_bSizeChanged;
+ FX_FLOAT m_fOldMin;
+ FX_FLOAT m_fOldMax;
};
-class CPWL_Note_Options : public CPWL_Wnd
-{
-public:
- CPWL_Note_Options();
- virtual ~CPWL_Note_Options();
+class CPWL_Note_Options : public CPWL_Wnd {
+ public:
+ CPWL_Note_Options();
+ virtual ~CPWL_Note_Options();
- CPDF_Rect GetContentRect() const;
- virtual void SetTextColor(const CPWL_Color & color);
- void SetText(const CFX_WideString& sText);
+ CPDF_Rect GetContentRect() const;
+ virtual void SetTextColor(const CPWL_Color& color);
+ void SetText(const CFX_WideString& sText);
-protected:
- virtual void RePosChildWnd();
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+ protected:
+ virtual void RePosChildWnd();
+ virtual void CreateChildWnd(const PWL_CREATEPARAM& cp);
+ virtual void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device);
-private:
- CPWL_Label* m_pText;
+ private:
+ CPWL_Label* m_pText;
};
-class CPWL_Note_Contents : public CPWL_ListCtrl
-{
-public:
- CPWL_Note_Contents();
- virtual ~CPWL_Note_Contents();
+class CPWL_Note_Contents : public CPWL_ListCtrl {
+ public:
+ CPWL_Note_Contents();
+ virtual ~CPWL_Note_Contents();
- virtual CFX_ByteString GetClassName() const;
- virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0);
- virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual CFX_ByteString GetClassName() const;
+ virtual void OnNotify(CPWL_Wnd* pWnd,
+ FX_DWORD msg,
+ intptr_t wParam = 0,
+ intptr_t lParam = 0);
+ virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
- void SetEditFocus(FX_BOOL bLast);
- CPWL_Edit* GetEdit() const;
+ void SetEditFocus(FX_BOOL bLast);
+ CPWL_Edit* GetEdit() const;
-public:
- void SetText(const CFX_WideString& sText);
- CFX_WideString GetText() const;
+ public:
+ void SetText(const CFX_WideString& sText);
+ CFX_WideString GetText() const;
- CPWL_NoteItem* CreateSubItem();
- void DeleteSubItem(IPWL_NoteItem* pNoteItem);
- int32_t CountSubItems() const;
- IPWL_NoteItem* GetSubItems(int32_t index) const;
+ CPWL_NoteItem* CreateSubItem();
+ void DeleteSubItem(IPWL_NoteItem* pNoteItem);
+ int32_t CountSubItems() const;
+ IPWL_NoteItem* GetSubItems(int32_t index) const;
- virtual IPWL_NoteItem* GetHitNoteItem(const CPDF_Point& point);
- void EnableRead(FX_BOOL bEnabled);
- void EnableModify(FX_BOOL bEnabled);
+ virtual IPWL_NoteItem* GetHitNoteItem(const CPDF_Point& point);
+ void EnableRead(FX_BOOL bEnabled);
+ void EnableModify(FX_BOOL bEnabled);
-protected:
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
+ protected:
+ virtual void CreateChildWnd(const PWL_CREATEPARAM& cp);
-private:
- CPWL_Note_Edit* m_pEdit;
+ private:
+ CPWL_Note_Edit* m_pEdit;
};
-class CPWL_NoteItem : public CPWL_Wnd, public IPWL_NoteItem
-{
-public:
- CPWL_NoteItem();
- virtual ~CPWL_NoteItem();
-
-public:
- virtual void SetPrivateData(void* pData);
- virtual void SetBkColor(const CPWL_Color& color);
- virtual void SetSubjectName(const CFX_WideString& sName);
- virtual void SetAuthorName(const CFX_WideString& sName);
- virtual void SetDateTime(FX_SYSTEMTIME time);
- virtual void SetContents(const CFX_WideString& sContents);
-
- virtual IPWL_NoteItem* CreateSubItem();
- virtual int32_t CountSubItems() const;
- virtual IPWL_NoteItem* GetSubItems(int32_t index) const;
- virtual void DeleteSubItem(IPWL_NoteItem* pNoteItem);
- virtual void SetFocus(){SetNoteFocus(FALSE);}
-
- virtual IPWL_NoteItem* GetParentItem() const;
- virtual void* GetPrivateData() const;
- virtual CFX_WideString GetAuthorName() const;
- virtual CPWL_Color GetBkColor() const;
- virtual CFX_WideString GetContents() const;
- virtual FX_SYSTEMTIME GetDateTime() const;
- virtual CFX_WideString GetSubjectName() const;
- virtual FX_BOOL IsTopItem() const { return FALSE;}
- virtual CPWL_Edit* GetEdit() const;
-
-public:
- virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
- virtual FX_BOOL OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual CFX_ByteString GetClassName() const;
- virtual IPWL_NoteItem* GetHitNoteItem(const CPDF_Point& point);
- virtual IPWL_NoteItem* GetFocusedNoteItem() const;
-
- virtual void ResetSubjectName(int32_t nItemIndex);
- void EnableRead(FX_BOOL bEnabled);
- void EnableModify(FX_BOOL bEnabled);
-
-protected:
- virtual void RePosChildWnd();
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
-
- virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0);
-
-public:
- virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth);
- virtual FX_FLOAT GetItemLeftMargin();
- virtual FX_FLOAT GetItemRightMargin();
- CPWL_NoteItem* CreateNoteItem();
- CPWL_NoteItem* GetParentNoteItem() const;
-
- void SetNoteFocus(FX_BOOL bLast);
- void OnContentsValidate();
-
- void OnCreateNoteItem();
-
-protected:
- void PopupNoteItemMenu(const CPDF_Point& point);
-
- virtual const CPWL_Note* GetNote() const;
- virtual IPWL_NoteNotify* GetNoteNotify() const;
-
-protected:
- CPWL_Label* m_pSubject;
- CPWL_Label* m_pDateTime;
- CPWL_Note_Contents* m_pContents;
-
-private:
- void* m_pPrivateData;
- FX_SYSTEMTIME m_dtNote;
- CFX_WideString m_sAuthor;
-
- FX_FLOAT m_fOldItemHeight;
- FX_BOOL m_bSizeChanged;
- FX_BOOL m_bAllowModify;
+class CPWL_NoteItem : public CPWL_Wnd, public IPWL_NoteItem {
+ public:
+ CPWL_NoteItem();
+ virtual ~CPWL_NoteItem();
+
+ public:
+ virtual void SetPrivateData(void* pData);
+ virtual void SetBkColor(const CPWL_Color& color);
+ virtual void SetSubjectName(const CFX_WideString& sName);
+ virtual void SetAuthorName(const CFX_WideString& sName);
+ virtual void SetDateTime(FX_SYSTEMTIME time);
+ virtual void SetContents(const CFX_WideString& sContents);
+
+ virtual IPWL_NoteItem* CreateSubItem();
+ virtual int32_t CountSubItems() const;
+ virtual IPWL_NoteItem* GetSubItems(int32_t index) const;
+ virtual void DeleteSubItem(IPWL_NoteItem* pNoteItem);
+ virtual void SetFocus() { SetNoteFocus(FALSE); }
+
+ virtual IPWL_NoteItem* GetParentItem() const;
+ virtual void* GetPrivateData() const;
+ virtual CFX_WideString GetAuthorName() const;
+ virtual CPWL_Color GetBkColor() const;
+ virtual CFX_WideString GetContents() const;
+ virtual FX_SYSTEMTIME GetDateTime() const;
+ virtual CFX_WideString GetSubjectName() const;
+ virtual FX_BOOL IsTopItem() const { return FALSE; }
+ virtual CPWL_Edit* GetEdit() const;
+
+ public:
+ virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnRButtonUp(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual CFX_ByteString GetClassName() const;
+ virtual IPWL_NoteItem* GetHitNoteItem(const CPDF_Point& point);
+ virtual IPWL_NoteItem* GetFocusedNoteItem() const;
+
+ virtual void ResetSubjectName(int32_t nItemIndex);
+ void EnableRead(FX_BOOL bEnabled);
+ void EnableModify(FX_BOOL bEnabled);
+
+ protected:
+ virtual void RePosChildWnd();
+ virtual void CreateChildWnd(const PWL_CREATEPARAM& cp);
+
+ virtual void OnNotify(CPWL_Wnd* pWnd,
+ FX_DWORD msg,
+ intptr_t wParam = 0,
+ intptr_t lParam = 0);
+
+ public:
+ virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth);
+ virtual FX_FLOAT GetItemLeftMargin();
+ virtual FX_FLOAT GetItemRightMargin();
+ CPWL_NoteItem* CreateNoteItem();
+ CPWL_NoteItem* GetParentNoteItem() const;
+
+ void SetNoteFocus(FX_BOOL bLast);
+ void OnContentsValidate();
+
+ void OnCreateNoteItem();
+
+ protected:
+ void PopupNoteItemMenu(const CPDF_Point& point);
+
+ virtual const CPWL_Note* GetNote() const;
+ virtual IPWL_NoteNotify* GetNoteNotify() const;
+
+ protected:
+ CPWL_Label* m_pSubject;
+ CPWL_Label* m_pDateTime;
+ CPWL_Note_Contents* m_pContents;
+
+ private:
+ void* m_pPrivateData;
+ FX_SYSTEMTIME m_dtNote;
+ CFX_WideString m_sAuthor;
+
+ FX_FLOAT m_fOldItemHeight;
+ FX_BOOL m_bSizeChanged;
+ FX_BOOL m_bAllowModify;
};
-class CPWL_Note : public CPWL_NoteItem
-{
-public:
- CPWL_Note(IPopup_Note* pPopupNote, IPWL_NoteNotify* pNoteNotify, IPWL_NoteHandler* pNoteHandler);
- virtual ~CPWL_Note();
-
-public:
- virtual void SetSubjectName(const CFX_WideString& sName);
- virtual void SetAuthorName(const CFX_WideString& sName);
- virtual CFX_WideString GetAuthorName() const;
- virtual void SetBkColor(const CPWL_Color& color);
- virtual void ResetSubjectName(int32_t nItemIndex){}
- virtual FX_BOOL IsTopItem() const {return TRUE;}
- virtual const CPWL_Note* GetNote() const;
- virtual IPWL_NoteNotify* GetNoteNotify() const;
-
-public:
- IPWL_NoteItem* Reply();
- void EnableNotify(FX_BOOL bEnabled);
- void SetIconType(int32_t nType);
- void SetOptionsText(const CFX_WideString& sText);
- void EnableRead(FX_BOOL bEnabled);
- void EnableModify(FX_BOOL bEnabled);
-
- CFX_WideString GetReplyString() const;
- void SetReplyString(const CFX_WideString& string);
-
- //0-normal / 1-caption / 2-leftbottom corner / 3-rightbottom corner / 4-close / 5-options
- int32_t NoteHitTest(const CPDF_Point& point) const;
- CPDF_Rect GetCaptionRect() const {return m_rcCaption;}
- IPopup_Note* GetPopupNote() const {return m_pPopupNote;}
-
-public:
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);
-
-protected:
- virtual void RePosChildWnd();
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
-
- virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0);
-
- FX_BOOL ResetScrollBar();
- void RePosNoteChildren();
- FX_BOOL ScrollBarShouldVisible();
-
-private:
- CPWL_Label* m_pAuthor;
- CPWL_Note_Icon* m_pIcon;
- CPWL_Note_CloseBox* m_pCloseBox;
- CPWL_Note_LBBox* m_pLBBox;
- CPWL_Note_RBBox* m_pRBBox;
- CPWL_ScrollBar* m_pContentsBar;
- CPWL_Note_Options* m_pOptions;
- IPWL_NoteNotify* m_pNoteNotify;
- FX_BOOL m_bResizing;
- PWL_SCROLL_INFO m_OldScrollInfo;
- CPDF_Rect m_rcCaption;
- FX_BOOL m_bEnalbleNotify;
- IPopup_Note* m_pPopupNote;
- CFX_WideString m_sReplyString;
+class CPWL_Note : public CPWL_NoteItem {
+ public:
+ CPWL_Note(IPopup_Note* pPopupNote,
+ IPWL_NoteNotify* pNoteNotify,
+ IPWL_NoteHandler* pNoteHandler);
+ virtual ~CPWL_Note();
+
+ public:
+ virtual void SetSubjectName(const CFX_WideString& sName);
+ virtual void SetAuthorName(const CFX_WideString& sName);
+ virtual CFX_WideString GetAuthorName() const;
+ virtual void SetBkColor(const CPWL_Color& color);
+ virtual void ResetSubjectName(int32_t nItemIndex) {}
+ virtual FX_BOOL IsTopItem() const { return TRUE; }
+ virtual const CPWL_Note* GetNote() const;
+ virtual IPWL_NoteNotify* GetNoteNotify() const;
+
+ public:
+ IPWL_NoteItem* Reply();
+ void EnableNotify(FX_BOOL bEnabled);
+ void SetIconType(int32_t nType);
+ void SetOptionsText(const CFX_WideString& sText);
+ void EnableRead(FX_BOOL bEnabled);
+ void EnableModify(FX_BOOL bEnabled);
+
+ CFX_WideString GetReplyString() const;
+ void SetReplyString(const CFX_WideString& string);
+
+ // 0-normal / 1-caption / 2-leftbottom corner / 3-rightbottom corner / 4-close
+ // / 5-options
+ int32_t NoteHitTest(const CPDF_Point& point) const;
+ CPDF_Rect GetCaptionRect() const { return m_rcCaption; }
+ IPopup_Note* GetPopupNote() const { return m_pPopupNote; }
+
+ public:
+ virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnRButtonUp(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnMouseWheel(short zDelta,
+ const CPDF_Point& point,
+ FX_DWORD nFlag);
+
+ protected:
+ virtual void RePosChildWnd();
+ virtual void CreateChildWnd(const PWL_CREATEPARAM& cp);
+
+ virtual void OnNotify(CPWL_Wnd* pWnd,
+ FX_DWORD msg,
+ intptr_t wParam = 0,
+ intptr_t lParam = 0);
+
+ FX_BOOL ResetScrollBar();
+ void RePosNoteChildren();
+ FX_BOOL ScrollBarShouldVisible();
+
+ private:
+ CPWL_Label* m_pAuthor;
+ CPWL_Note_Icon* m_pIcon;
+ CPWL_Note_CloseBox* m_pCloseBox;
+ CPWL_Note_LBBox* m_pLBBox;
+ CPWL_Note_RBBox* m_pRBBox;
+ CPWL_ScrollBar* m_pContentsBar;
+ CPWL_Note_Options* m_pOptions;
+ IPWL_NoteNotify* m_pNoteNotify;
+ FX_BOOL m_bResizing;
+ PWL_SCROLL_INFO m_OldScrollInfo;
+ CPDF_Rect m_rcCaption;
+ FX_BOOL m_bEnalbleNotify;
+ IPopup_Note* m_pPopupNote;
+ CFX_WideString m_sReplyString;
};
#endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_NOTE_H_
diff --git a/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h b/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h
index 0390222545..a149a01416 100644
--- a/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h
+++ b/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h
@@ -12,155 +12,150 @@
class CPWL_SBButton;
class CPWL_ScrollBar;
-struct PWL_SCROLL_INFO
-{
-public:
- PWL_SCROLL_INFO() : fContentMin(0.0f), fContentMax(0.0f), fPlateWidth(0.0f), fBigStep(0.0f), fSmallStep(0.0f)
- {
- }
- FX_FLOAT fContentMin;
- FX_FLOAT fContentMax;
- FX_FLOAT fPlateWidth;
- FX_FLOAT fBigStep;
- FX_FLOAT fSmallStep;
+struct PWL_SCROLL_INFO {
+ public:
+ PWL_SCROLL_INFO()
+ : fContentMin(0.0f),
+ fContentMax(0.0f),
+ fPlateWidth(0.0f),
+ fBigStep(0.0f),
+ fSmallStep(0.0f) {}
+ FX_FLOAT fContentMin;
+ FX_FLOAT fContentMax;
+ FX_FLOAT fPlateWidth;
+ FX_FLOAT fBigStep;
+ FX_FLOAT fSmallStep;
};
-enum PWL_SCROLLBAR_TYPE
-{
- SBT_HSCROLL,
- SBT_VSCROLL
-};
+enum PWL_SCROLLBAR_TYPE { SBT_HSCROLL, SBT_VSCROLL };
-enum PWL_SBBUTTON_TYPE
-{
- PSBT_MIN,
- PSBT_MAX,
- PSBT_POS
-};
+enum PWL_SBBUTTON_TYPE { PSBT_MIN, PSBT_MAX, PSBT_POS };
+
+class CPWL_SBButton : public CPWL_Wnd {
+ public:
+ CPWL_SBButton(PWL_SCROLLBAR_TYPE eScrollBarType,
+ PWL_SBBUTTON_TYPE eButtonType);
+ virtual ~CPWL_SBButton();
-class CPWL_SBButton : public CPWL_Wnd
-{
-public:
- CPWL_SBButton(PWL_SCROLLBAR_TYPE eScrollBarType,PWL_SBBUTTON_TYPE eButtonType);
- virtual ~CPWL_SBButton();
-
-public:
- virtual CFX_ByteString GetClassName() const;
- virtual void OnCreate(PWL_CREATEPARAM & cp);
- virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag);
-
-protected:
- PWL_SCROLLBAR_TYPE m_eScrollBarType;
- PWL_SBBUTTON_TYPE m_eSBButtonType;
-
- FX_BOOL m_bMouseDown;
+ public:
+ virtual CFX_ByteString GetClassName() const;
+ virtual void OnCreate(PWL_CREATEPARAM& cp);
+ virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream);
+ virtual void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device);
+ virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag);
+
+ protected:
+ PWL_SCROLLBAR_TYPE m_eScrollBarType;
+ PWL_SBBUTTON_TYPE m_eSBButtonType;
+
+ FX_BOOL m_bMouseDown;
};
-struct PWL_FLOATRANGE
-{
-public:
- PWL_FLOATRANGE();
- PWL_FLOATRANGE(FX_FLOAT min,FX_FLOAT max);
- void Default();
- void Set(FX_FLOAT min,FX_FLOAT max);
- FX_BOOL In(FX_FLOAT x) const;
- FX_FLOAT GetWidth() const;
-
- FX_FLOAT fMin,fMax;
+struct PWL_FLOATRANGE {
+ public:
+ PWL_FLOATRANGE();
+ PWL_FLOATRANGE(FX_FLOAT min, FX_FLOAT max);
+ void Default();
+ void Set(FX_FLOAT min, FX_FLOAT max);
+ FX_BOOL In(FX_FLOAT x) const;
+ FX_FLOAT GetWidth() const;
+
+ FX_FLOAT fMin, fMax;
};
-struct PWL_SCROLL_PRIVATEDATA
-{
-public:
- PWL_SCROLL_PRIVATEDATA();
-
- void Default();
- void SetScrollRange(FX_FLOAT min,FX_FLOAT max);
- void SetClientWidth(FX_FLOAT width);
- void SetSmallStep(FX_FLOAT step);
- void SetBigStep(FX_FLOAT step);
- FX_BOOL SetPos(FX_FLOAT pos);
-
- void AddSmall();
- void SubSmall();
- void AddBig();
- void SubBig();
-
- PWL_FLOATRANGE ScrollRange;
- FX_FLOAT fClientWidth;
- FX_FLOAT fScrollPos;
- FX_FLOAT fBigStep;
- FX_FLOAT fSmallStep;
+struct PWL_SCROLL_PRIVATEDATA {
+ public:
+ PWL_SCROLL_PRIVATEDATA();
+
+ void Default();
+ void SetScrollRange(FX_FLOAT min, FX_FLOAT max);
+ void SetClientWidth(FX_FLOAT width);
+ void SetSmallStep(FX_FLOAT step);
+ void SetBigStep(FX_FLOAT step);
+ FX_BOOL SetPos(FX_FLOAT pos);
+
+ void AddSmall();
+ void SubSmall();
+ void AddBig();
+ void SubBig();
+
+ PWL_FLOATRANGE ScrollRange;
+ FX_FLOAT fClientWidth;
+ FX_FLOAT fScrollPos;
+ FX_FLOAT fBigStep;
+ FX_FLOAT fSmallStep;
};
-class CPWL_ScrollBar : public CPWL_Wnd
-{
-public:
- CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType = SBT_HSCROLL);
- virtual ~CPWL_ScrollBar();
-
-public:
- virtual CFX_ByteString GetClassName() const;
- virtual void OnCreate(PWL_CREATEPARAM & cp);
- virtual void RePosChildWnd();
- virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0);
-
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
-
- FX_FLOAT GetScrollBarWidth() const;
- PWL_SCROLLBAR_TYPE GetScrollBarType() const {return m_sbType;};
-
- void SetNotifyForever(FX_BOOL bForever) {m_bNotifyForever = bForever;}
-
-protected:
- void SetScrollRange(FX_FLOAT fMin,FX_FLOAT fMax,FX_FLOAT fClientWidth);
- void SetScrollPos(FX_FLOAT fPos);
- void MovePosButton(FX_BOOL bRefresh);
- void SetScrollStep(FX_FLOAT fBigStep,FX_FLOAT fSmallStep);
- void NotifyScrollWindow();
- CPDF_Rect GetScrollArea() const;
-
-private:
- void CreateButtons(const PWL_CREATEPARAM & cp);
-
- void OnMinButtonLBDown(const CPDF_Point & point);
- void OnMinButtonLBUp(const CPDF_Point & point);
- void OnMinButtonMouseMove(const CPDF_Point & point);
-
- void OnMaxButtonLBDown(const CPDF_Point & point);
- void OnMaxButtonLBUp(const CPDF_Point & point);
- void OnMaxButtonMouseMove(const CPDF_Point & point);
-
- void OnPosButtonLBDown(const CPDF_Point & point);
- void OnPosButtonLBUp(const CPDF_Point & point);
- void OnPosButtonMouseMove(const CPDF_Point & point);
-
- FX_FLOAT TrueToFace(FX_FLOAT);
- FX_FLOAT FaceToTrue(FX_FLOAT);
-
- virtual void TimerProc();
-
-private:
- PWL_SCROLLBAR_TYPE m_sbType;
- PWL_SCROLL_INFO m_OriginInfo;
- CPWL_SBButton* m_pMinButton;
- CPWL_SBButton* m_pMaxButton;
- CPWL_SBButton* m_pPosButton;
- PWL_SCROLL_PRIVATEDATA m_sData;
- FX_BOOL m_bMouseDown;
- FX_BOOL m_bMinOrMax;
- FX_BOOL m_bNotifyForever;
- FX_FLOAT m_nOldPos;
- FX_FLOAT m_fOldPosButton;
+class CPWL_ScrollBar : public CPWL_Wnd {
+ public:
+ CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType = SBT_HSCROLL);
+ virtual ~CPWL_ScrollBar();
+
+ public:
+ virtual CFX_ByteString GetClassName() const;
+ virtual void OnCreate(PWL_CREATEPARAM& cp);
+ virtual void RePosChildWnd();
+ virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream);
+ virtual void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device);
+
+ virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual void OnNotify(CPWL_Wnd* pWnd,
+ FX_DWORD msg,
+ intptr_t wParam = 0,
+ intptr_t lParam = 0);
+
+ virtual void CreateChildWnd(const PWL_CREATEPARAM& cp);
+
+ FX_FLOAT GetScrollBarWidth() const;
+ PWL_SCROLLBAR_TYPE GetScrollBarType() const { return m_sbType; };
+
+ void SetNotifyForever(FX_BOOL bForever) { m_bNotifyForever = bForever; }
+
+ protected:
+ void SetScrollRange(FX_FLOAT fMin, FX_FLOAT fMax, FX_FLOAT fClientWidth);
+ void SetScrollPos(FX_FLOAT fPos);
+ void MovePosButton(FX_BOOL bRefresh);
+ void SetScrollStep(FX_FLOAT fBigStep, FX_FLOAT fSmallStep);
+ void NotifyScrollWindow();
+ CPDF_Rect GetScrollArea() const;
+
+ private:
+ void CreateButtons(const PWL_CREATEPARAM& cp);
+
+ void OnMinButtonLBDown(const CPDF_Point& point);
+ void OnMinButtonLBUp(const CPDF_Point& point);
+ void OnMinButtonMouseMove(const CPDF_Point& point);
+
+ void OnMaxButtonLBDown(const CPDF_Point& point);
+ void OnMaxButtonLBUp(const CPDF_Point& point);
+ void OnMaxButtonMouseMove(const CPDF_Point& point);
+
+ void OnPosButtonLBDown(const CPDF_Point& point);
+ void OnPosButtonLBUp(const CPDF_Point& point);
+ void OnPosButtonMouseMove(const CPDF_Point& point);
+
+ FX_FLOAT TrueToFace(FX_FLOAT);
+ FX_FLOAT FaceToTrue(FX_FLOAT);
+
+ virtual void TimerProc();
+
+ private:
+ PWL_SCROLLBAR_TYPE m_sbType;
+ PWL_SCROLL_INFO m_OriginInfo;
+ CPWL_SBButton* m_pMinButton;
+ CPWL_SBButton* m_pMaxButton;
+ CPWL_SBButton* m_pPosButton;
+ PWL_SCROLL_PRIVATEDATA m_sData;
+ FX_BOOL m_bMouseDown;
+ FX_BOOL m_bMinOrMax;
+ FX_BOOL m_bNotifyForever;
+ FX_FLOAT m_nOldPos;
+ FX_FLOAT m_fOldPosButton;
};
#endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_SCROLLBAR_H_
diff --git a/fpdfsdk/include/pdfwindow/PWL_Signature.h b/fpdfsdk/include/pdfwindow/PWL_Signature.h
index d9be322a7d..c48d4e9708 100644
--- a/fpdfsdk/include/pdfwindow/PWL_Signature.h
+++ b/fpdfsdk/include/pdfwindow/PWL_Signature.h
@@ -13,55 +13,55 @@
class CFX_DIBSource;
class CPWL_Label;
-class CPWL_Signature_Image : public CPWL_Image
-{
-public:
- CPWL_Signature_Image();
- virtual ~CPWL_Signature_Image();
+class CPWL_Signature_Image : public CPWL_Image {
+ public:
+ CPWL_Signature_Image();
+ virtual ~CPWL_Signature_Image();
- void SetImage(CFX_DIBSource* pImage);
- CFX_DIBSource* GetImage();
+ void SetImage(CFX_DIBSource* pImage);
+ CFX_DIBSource* GetImage();
-protected:
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
- virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
+ protected:
+ virtual void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device);
+ virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream);
- virtual void GetScale(FX_FLOAT & fHScale,FX_FLOAT & fVScale);
+ virtual void GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale);
-private:
- CFX_DIBSource* m_pImage;
+ private:
+ CFX_DIBSource* m_pImage;
};
-class CPWL_Signature : public CPWL_Wnd
-{
-public:
- CPWL_Signature();
- virtual ~CPWL_Signature();
+class CPWL_Signature : public CPWL_Wnd {
+ public:
+ CPWL_Signature();
+ virtual ~CPWL_Signature();
- void SetText(const FX_WCHAR* sText);
- void SetDescription(const FX_WCHAR* string);
- void SetImage(CFX_DIBSource* pImage);
- void SetImageStream(CPDF_Stream * pStream, const FX_CHAR* sImageAlias);
+ void SetText(const FX_WCHAR* sText);
+ void SetDescription(const FX_WCHAR* string);
+ void SetImage(CFX_DIBSource* pImage);
+ void SetImageStream(CPDF_Stream* pStream, const FX_CHAR* sImageAlias);
- void SetTextFlag(FX_BOOL bTextExist);
- void SetImageFlag(FX_BOOL bImageExist);
- void SetFoxitFlag(FX_BOOL bFlagExist);
+ void SetTextFlag(FX_BOOL bTextExist);
+ void SetImageFlag(FX_BOOL bImageExist);
+ void SetFoxitFlag(FX_BOOL bFlagExist);
-protected:
- virtual void RePosChildWnd();
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
+ protected:
+ virtual void RePosChildWnd();
+ virtual void CreateChildWnd(const PWL_CREATEPARAM& cp);
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
- virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
+ virtual void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device);
+ virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream);
-private:
- CPWL_Label* m_pText;
- CPWL_Label* m_pDescription;
- CPWL_Signature_Image* m_pImage;
+ private:
+ CPWL_Label* m_pText;
+ CPWL_Label* m_pDescription;
+ CPWL_Signature_Image* m_pImage;
- FX_BOOL m_bTextExist;
- FX_BOOL m_bImageExist;
- FX_BOOL m_bFlagExist;
+ FX_BOOL m_bTextExist;
+ FX_BOOL m_bImageExist;
+ FX_BOOL m_bFlagExist;
};
#endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_SIGNATURE_H_
diff --git a/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h b/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h
index 31787d79ed..8cfe819a67 100644
--- a/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h
+++ b/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h
@@ -9,48 +9,45 @@
#include "PWL_Button.h"
-class CPWL_PushButton : public CPWL_Button
-{
-public:
- CPWL_PushButton();
- virtual ~CPWL_PushButton();
-
- virtual CFX_ByteString GetClassName() const;
- virtual CPDF_Rect GetFocusRect() const;
+class CPWL_PushButton : public CPWL_Button {
+ public:
+ CPWL_PushButton();
+ virtual ~CPWL_PushButton();
+
+ virtual CFX_ByteString GetClassName() const;
+ virtual CPDF_Rect GetFocusRect() const;
};
-class CPWL_CheckBox : public CPWL_Button
-{
-public:
- CPWL_CheckBox();
- virtual ~CPWL_CheckBox();
+class CPWL_CheckBox : public CPWL_Button {
+ public:
+ CPWL_CheckBox();
+ virtual ~CPWL_CheckBox();
- virtual CFX_ByteString GetClassName() const;
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag);
+ virtual CFX_ByteString GetClassName() const;
+ virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag);
- void SetCheck(FX_BOOL bCheck);
- FX_BOOL IsChecked() const;
+ void SetCheck(FX_BOOL bCheck);
+ FX_BOOL IsChecked() const;
-private:
- FX_BOOL m_bChecked;
+ private:
+ FX_BOOL m_bChecked;
};
-class CPWL_RadioButton : public CPWL_Button
-{
-public:
- CPWL_RadioButton();
- virtual ~CPWL_RadioButton();
+class CPWL_RadioButton : public CPWL_Button {
+ public:
+ CPWL_RadioButton();
+ virtual ~CPWL_RadioButton();
- virtual CFX_ByteString GetClassName() const;
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag);
+ virtual CFX_ByteString GetClassName() const;
+ virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag);
- void SetCheck(FX_BOOL bCheck);
- FX_BOOL IsChecked() const;
+ void SetCheck(FX_BOOL bCheck);
+ FX_BOOL IsChecked() const;
-private:
- FX_BOOL m_bChecked;
+ private:
+ FX_BOOL m_bChecked;
};
#endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_SPECIALBUTTON_H_
diff --git a/fpdfsdk/include/pdfwindow/PWL_Utils.h b/fpdfsdk/include/pdfwindow/PWL_Utils.h
index b58f30e399..e797510d50 100644
--- a/fpdfsdk/include/pdfwindow/PWL_Utils.h
+++ b/fpdfsdk/include/pdfwindow/PWL_Utils.h
@@ -8,236 +8,406 @@
#define FPDFSDK_INCLUDE_PDFWINDOW_PWL_UTILS_H_
#include "../../../core/include/fpdfapi/fpdf_parser.h" // For CPDF_Point.
-#include "../../../core/include/fpdfdoc/fpdf_vt.h" // For CPVT_WordRange.
+#include "../../../core/include/fpdfdoc/fpdf_vt.h" // For CPVT_WordRange.
#include "../fxedit/fx_edit.h"
#include "PWL_Wnd.h"
class CFX_PathData;
struct CPWL_Color;
-template<class T> T PWL_MIN (const T & i, const T & j) { return ((i < j) ? i : j); }
-template<class T> T PWL_MAX (const T & i, const T & j) { return ((i > j) ? i : j); }
-
-#define PWL_PDF2WIN(color) (uint8_t(color*255))
-#define PWL_WIN2PDF(color) ((FX_FLOAT)((FX_FLOAT)color/255.0f))
-
-#define PWL_MAKEDWORD(low,high) ((FX_DWORD)((FX_WORD)(low) | (FX_DWORD)(((FX_WORD)(high))<<16)))
-#define PWL_GETLOWWORD(dword) ((FX_WORD)(dword))
-#define PWL_GETHIGHWORD(dword) ((FX_WORD)(dword>>16))
-
-#define PWL_ICONTYPE_CHECKMARK 0
-#define PWL_ICONTYPE_CIRCLE 1
-#define PWL_ICONTYPE_COMMENT 2
-#define PWL_ICONTYPE_CROSS 3
-#define PWL_ICONTYPE_HELP 4
-#define PWL_ICONTYPE_INSERTTEXT 5
-#define PWL_ICONTYPE_KEY 6
-#define PWL_ICONTYPE_NEWPARAGRAPH 7
-#define PWL_ICONTYPE_TEXTNOTE 8
-#define PWL_ICONTYPE_PARAGRAPH 9
-#define PWL_ICONTYPE_RIGHTARROW 10
-#define PWL_ICONTYPE_RIGHTPOINTER 11
-#define PWL_ICONTYPE_STAR 12
-#define PWL_ICONTYPE_UPARROW 13
-#define PWL_ICONTYPE_UPLEFTARROW 14
-
-#define PWL_ICONTYPE_GRAPH 15
-#define PWL_ICONTYPE_PAPERCLIP 16
-#define PWL_ICONTYPE_ATTACHMENT 17
-#define PWL_ICONTYPE_TAG 18
-
-#define PWL_ICONTYPE_FOXIT 19
-
-#define PWL_ICONTYPE_UNKNOWN -1
-
-//checkbox & radiobutton style
-#define PCS_CHECK 0
-#define PCS_CIRCLE 1
-#define PCS_CROSS 2
-#define PCS_DIAMOND 3
-#define PCS_SQUARE 4
-#define PCS_STAR 5
-
-#define PWL_PI 3.14159265358979f
-#define PWL_BEZIER 0.5522847498308f
-
-//pushbutton layout style
-#define PPBL_LABEL 0
-#define PPBL_ICON 1
-#define PPBL_ICONTOPLABELBOTTOM 2
-#define PPBL_LABELTOPICONBOTTOM 3
-#define PPBL_ICONLEFTLABELRIGHT 4
-#define PPBL_LABELLEFTICONRIGHT 5
-#define PPBL_LABELOVERICON 6
-
-class CPWL_Point : public CPDF_Point
-{
-public:
- CPWL_Point() : CPDF_Point(0.0f,0.0f){}
- CPWL_Point(FX_FLOAT fx, FX_FLOAT fy) : CPDF_Point(fx,fy) {}
- CPWL_Point(const CPWL_Point& point) : CPDF_Point(point.x, point.y) {}
+template <class T>
+T PWL_MIN(const T& i, const T& j) {
+ return ((i < j) ? i : j);
+}
+template <class T>
+T PWL_MAX(const T& i, const T& j) {
+ return ((i > j) ? i : j);
+}
+
+#define PWL_PDF2WIN(color) (uint8_t(color * 255))
+#define PWL_WIN2PDF(color) ((FX_FLOAT)((FX_FLOAT)color / 255.0f))
+
+#define PWL_MAKEDWORD(low, high) \
+ ((FX_DWORD)((FX_WORD)(low) | (FX_DWORD)(((FX_WORD)(high)) << 16)))
+#define PWL_GETLOWWORD(dword) ((FX_WORD)(dword))
+#define PWL_GETHIGHWORD(dword) ((FX_WORD)(dword >> 16))
+
+#define PWL_ICONTYPE_CHECKMARK 0
+#define PWL_ICONTYPE_CIRCLE 1
+#define PWL_ICONTYPE_COMMENT 2
+#define PWL_ICONTYPE_CROSS 3
+#define PWL_ICONTYPE_HELP 4
+#define PWL_ICONTYPE_INSERTTEXT 5
+#define PWL_ICONTYPE_KEY 6
+#define PWL_ICONTYPE_NEWPARAGRAPH 7
+#define PWL_ICONTYPE_TEXTNOTE 8
+#define PWL_ICONTYPE_PARAGRAPH 9
+#define PWL_ICONTYPE_RIGHTARROW 10
+#define PWL_ICONTYPE_RIGHTPOINTER 11
+#define PWL_ICONTYPE_STAR 12
+#define PWL_ICONTYPE_UPARROW 13
+#define PWL_ICONTYPE_UPLEFTARROW 14
+
+#define PWL_ICONTYPE_GRAPH 15
+#define PWL_ICONTYPE_PAPERCLIP 16
+#define PWL_ICONTYPE_ATTACHMENT 17
+#define PWL_ICONTYPE_TAG 18
+
+#define PWL_ICONTYPE_FOXIT 19
+
+#define PWL_ICONTYPE_UNKNOWN -1
+
+// checkbox & radiobutton style
+#define PCS_CHECK 0
+#define PCS_CIRCLE 1
+#define PCS_CROSS 2
+#define PCS_DIAMOND 3
+#define PCS_SQUARE 4
+#define PCS_STAR 5
+
+#define PWL_PI 3.14159265358979f
+#define PWL_BEZIER 0.5522847498308f
+
+// pushbutton layout style
+#define PPBL_LABEL 0
+#define PPBL_ICON 1
+#define PPBL_ICONTOPLABELBOTTOM 2
+#define PPBL_LABELTOPICONBOTTOM 3
+#define PPBL_ICONLEFTLABELRIGHT 4
+#define PPBL_LABELLEFTICONRIGHT 5
+#define PPBL_LABELOVERICON 6
+
+class CPWL_Point : public CPDF_Point {
+ public:
+ CPWL_Point() : CPDF_Point(0.0f, 0.0f) {}
+ CPWL_Point(FX_FLOAT fx, FX_FLOAT fy) : CPDF_Point(fx, fy) {}
+ CPWL_Point(const CPWL_Point& point) : CPDF_Point(point.x, point.y) {}
};
-enum PWL_PATHDATA_TYPE
-{
- PWLPT_MOVETO,
- PWLPT_LINETO,
- PWLPT_BEZIERTO,
- PWLPT_UNKNOWN
+enum PWL_PATHDATA_TYPE {
+ PWLPT_MOVETO,
+ PWLPT_LINETO,
+ PWLPT_BEZIERTO,
+ PWLPT_UNKNOWN
};
-enum PWL_PATH_TYPE
-{
- PWLPT_PATHDATA,
- PWLPT_STREAM
-};
+enum PWL_PATH_TYPE { PWLPT_PATHDATA, PWLPT_STREAM };
-class CPWL_PathData
-{
-public:
- CPWL_PathData() : point(), type(PWLPT_UNKNOWN){}
- CPWL_PathData(const CPWL_Point& pt, PWL_PATHDATA_TYPE tp) : point(pt), type(tp) {}
+class CPWL_PathData {
+ public:
+ CPWL_PathData() : point(), type(PWLPT_UNKNOWN) {}
+ CPWL_PathData(const CPWL_Point& pt, PWL_PATHDATA_TYPE tp)
+ : point(pt), type(tp) {}
- CPWL_Point point;
- PWL_PATHDATA_TYPE type;
+ CPWL_Point point;
+ PWL_PATHDATA_TYPE type;
};
class IPWL_SpellCheck;
-class CPWL_Utils
-{
-public:
- static CPDF_Rect InflateRect(const CPDF_Rect& rcRect, FX_FLOAT fSize);
- static CPDF_Rect DeflateRect(const CPDF_Rect& rcRect, FX_FLOAT fSize);
- static FX_BOOL IntersectRect(const CPDF_Rect& rect1, const CPDF_Rect& rect2);
- static FX_BOOL ContainsRect(const CPDF_Rect& rcParent, const CPDF_Rect& rcChild);
- static CPDF_Rect ScaleRect(const CPDF_Rect& rcRect,FX_FLOAT fScale);
- static CPVT_WordRange OverlapWordRange(const CPVT_WordRange& wr1, const CPVT_WordRange& wr2);
- static CPDF_Rect GetCenterSquare(const CPDF_Rect & rect);
- static CPWL_Color SubstractColor(const CPWL_Color & sColor,FX_FLOAT fColorSub);
- static CPWL_Color DevideColor(const CPWL_Color & sColor,FX_FLOAT fColorDevide);
- static CPDF_Rect MaxRect(const CPDF_Rect & rect1,const CPDF_Rect & rect2);
- static CPDF_Rect OffsetRect(const CPDF_Rect & rect,FX_FLOAT x,FX_FLOAT y);
- static CPDF_Point OffsetPoint(const CPDF_Point & point,FX_FLOAT x,FX_FLOAT y);
- static FX_COLORREF PWLColorToFXColor(const CPWL_Color& color, int32_t nTransparancy = 255);
- static FX_BOOL IsBlackOrWhite(const CPWL_Color& color);
- static CPWL_Color GetReverseColor(const CPWL_Color& color);
-
- static CFX_ByteString GetColorAppStream(const CPWL_Color & color,const FX_BOOL & bFillOrStroke = TRUE);
- static CFX_ByteString GetBorderAppStream(const CPDF_Rect & rect, FX_FLOAT fWidth,
- const CPWL_Color & color, const CPWL_Color & crLeftTop, const CPWL_Color & crRightBottom,
- int32_t nStyle, const CPWL_Dash & dash);
- static CFX_ByteString GetCircleBorderAppStream(const CPDF_Rect & rect, FX_FLOAT fWidth,
- const CPWL_Color & color, const CPWL_Color & crLeftTop, const CPWL_Color & crRightBottom,
- int32_t nStyle, const CPWL_Dash & dash);
- static CFX_ByteString GetRectFillAppStream(const CPDF_Rect & rect,const CPWL_Color & color);
- static CFX_ByteString GetCircleFillAppStream(const CPDF_Rect & rect,const CPWL_Color & color);
-
- static CFX_ByteString GetPushButtonAppStream(const CPDF_Rect & rcBBox,
- IFX_Edit_FontMap * pFontMap,
- CPDF_Stream * pIconStream,
- CPDF_IconFit & IconFit,
- const CFX_WideString & sLabel,
- const CPWL_Color & crText,
- FX_FLOAT fFontSize,
- int32_t nLayOut);
- static CFX_ByteString GetCheckBoxAppStream(const CPDF_Rect & rcBBox,
- int32_t nStyle,
- const CPWL_Color & crText);
- static CFX_ByteString GetRadioButtonAppStream(const CPDF_Rect & rcBBox,
- int32_t nStyle,
- const CPWL_Color & crText);
-
- static CFX_ByteString GetEditAppStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange * pRange = NULL,
- FX_BOOL bContinuous = TRUE, FX_WORD SubWord = 0);
- static CFX_ByteString GetEditSelAppStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset,
- const CPVT_WordRange * pRange = NULL);
- static CFX_ByteString GetSpellCheckAppStream(IFX_Edit* pEdit, IPWL_SpellCheck* pSpellCheck,
- const CPDF_Point & ptOffset,
- const CPVT_WordRange * pRange = NULL);
- static CFX_ByteString GetTextAppStream(const CPDF_Rect & rcBBox,IFX_Edit_FontMap * pFontMap,
- const CFX_WideString & sText, int32_t nAlignmentH, int32_t nAlignmentV,
- FX_FLOAT fFontSize, FX_BOOL bMultiLine, FX_BOOL bAutoReturn, const CPWL_Color & crText);
- static CFX_ByteString GetDropButtonAppStream(const CPDF_Rect & rcBBox);
-
- static void DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,const CPDF_Rect & rect,
- const CPWL_Color & color, int32_t nTransparancy);
- static void DrawFillRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- const CPDF_Rect & rect,const FX_COLORREF & color);
- static void DrawStrokeRect(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,const CPDF_Rect & rect,
- const FX_COLORREF & color, FX_FLOAT fWidth);
- static void DrawStrokeLine(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- const CPDF_Point & ptMoveTo, const CPDF_Point & ptLineTo, const FX_COLORREF & color, FX_FLOAT fWidth);
- static void DrawBorder(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- const CPDF_Rect & rect, FX_FLOAT fWidth,
- const CPWL_Color & color, const CPWL_Color & crLeftTop, const CPWL_Color & crRightBottom,
- int32_t nStyle, const CPWL_Dash & dash, int32_t nTransparancy);
- static void DrawFillArea(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- const CPDF_Point* pPts, int32_t nCount, const FX_COLORREF& color);
- static void DrawShadow(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- FX_BOOL bVertical, FX_BOOL bHorizontal, CPDF_Rect rect,
- int32_t nTransparancy, int32_t nStartGray, int32_t nEndGray);
- static void DrawEditSpellCheck(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit,
- const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange,
- IPWL_SpellCheck* pSpellCheck);
-public:
- static void ConvertCMYK2RGB(FX_FLOAT dC,FX_FLOAT dM,FX_FLOAT dY,FX_FLOAT dK,FX_FLOAT &dR,FX_FLOAT &dG,FX_FLOAT &dB);
- static void ConvertRGB2CMYK(FX_FLOAT dR,FX_FLOAT dG,FX_FLOAT dB,FX_FLOAT &dC,FX_FLOAT &dM,FX_FLOAT &dY,FX_FLOAT &dK);
-
- static void ConvertRGB2GRAY(FX_FLOAT dR,FX_FLOAT dG,FX_FLOAT dB,FX_FLOAT &dGray);
- static void ConvertGRAY2RGB(FX_FLOAT dGray,FX_FLOAT &dR,FX_FLOAT &dG,FX_FLOAT &dB);
-
- static void ConvertCMYK2GRAY(FX_FLOAT dC,FX_FLOAT dM,FX_FLOAT dY,FX_FLOAT dK,FX_FLOAT &dGray);
- static void ConvertGRAY2CMYK(FX_FLOAT dGray,FX_FLOAT &dC,FX_FLOAT &dM,FX_FLOAT &dY,FX_FLOAT &dK);
-
- static void PWLColorToARGB(const CPWL_Color& color, int32_t& alpha, FX_FLOAT& red, FX_FLOAT& green, FX_FLOAT& blue);
-
-public:
- static CFX_ByteString GetIconAppStream(int32_t nType, const CPDF_Rect& rect, const CPWL_Color& crFill,
- const CPWL_Color& crStroke = PWL_DEFAULT_BLACKCOLOR);
- static void DrawIconAppStream(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
- int32_t nType, const CPDF_Rect & rect, const CPWL_Color& crFill,
- const CPWL_Color& crStroke, const int32_t nTransparancy);
-
-private:
- static CFX_ByteString GetAppStreamFromArray(const CPWL_PathData* pPathData, int32_t nCount);
- static void GetPathDataFromArray(CFX_PathData& path, const CPWL_PathData* pPathData, int32_t nCount);
-
- static CFX_ByteString GetAppStream_Check(const CPDF_Rect & rcBBox, const CPWL_Color & crText);
- static CFX_ByteString GetAppStream_Circle(const CPDF_Rect & rcBBox, const CPWL_Color & crText);
- static CFX_ByteString GetAppStream_Cross(const CPDF_Rect & rcBBox, const CPWL_Color & crText);
- static CFX_ByteString GetAppStream_Diamond(const CPDF_Rect & rcBBox, const CPWL_Color & crText);
- static CFX_ByteString GetAppStream_Square(const CPDF_Rect & rcBBox, const CPWL_Color & crText);
- static CFX_ByteString GetAppStream_Star(const CPDF_Rect & rcBBox, const CPWL_Color & crText);
-
- static CFX_ByteString GetAP_Check(const CPDF_Rect & crBBox);
- static CFX_ByteString GetAP_Circle(const CPDF_Rect & crBBox);
- static CFX_ByteString GetAP_Cross(const CPDF_Rect & crBBox);
- static CFX_ByteString GetAP_Diamond(const CPDF_Rect & crBBox);
- static CFX_ByteString GetAP_Square(const CPDF_Rect & crBBox);
- static CFX_ByteString GetAP_Star(const CPDF_Rect & crBBox);
- static CFX_ByteString GetAP_HalfCircle(const CPDF_Rect & crBBox,FX_FLOAT fRotate);
-
- static void GetGraphics_Checkmark(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Circle(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Comment(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Cross(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Help(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_InsertText(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Key(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_NewParagraph(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_TextNote(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Paragraph(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_RightArrow(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_RightPointer(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Star(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_UpArrow(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_UpLeftArrow(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Graph(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Paperclip(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Attachment(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Tag(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
- static void GetGraphics_Foxit(CFX_ByteString& sPathData, CFX_PathData& path, const CPDF_Rect& crBBox, const PWL_PATH_TYPE type);
+class CPWL_Utils {
+ public:
+ static CPDF_Rect InflateRect(const CPDF_Rect& rcRect, FX_FLOAT fSize);
+ static CPDF_Rect DeflateRect(const CPDF_Rect& rcRect, FX_FLOAT fSize);
+ static FX_BOOL IntersectRect(const CPDF_Rect& rect1, const CPDF_Rect& rect2);
+ static FX_BOOL ContainsRect(const CPDF_Rect& rcParent,
+ const CPDF_Rect& rcChild);
+ static CPDF_Rect ScaleRect(const CPDF_Rect& rcRect, FX_FLOAT fScale);
+ static CPVT_WordRange OverlapWordRange(const CPVT_WordRange& wr1,
+ const CPVT_WordRange& wr2);
+ static CPDF_Rect GetCenterSquare(const CPDF_Rect& rect);
+ static CPWL_Color SubstractColor(const CPWL_Color& sColor,
+ FX_FLOAT fColorSub);
+ static CPWL_Color DevideColor(const CPWL_Color& sColor,
+ FX_FLOAT fColorDevide);
+ static CPDF_Rect MaxRect(const CPDF_Rect& rect1, const CPDF_Rect& rect2);
+ static CPDF_Rect OffsetRect(const CPDF_Rect& rect, FX_FLOAT x, FX_FLOAT y);
+ static CPDF_Point OffsetPoint(const CPDF_Point& point,
+ FX_FLOAT x,
+ FX_FLOAT y);
+ static FX_COLORREF PWLColorToFXColor(const CPWL_Color& color,
+ int32_t nTransparancy = 255);
+ static FX_BOOL IsBlackOrWhite(const CPWL_Color& color);
+ static CPWL_Color GetReverseColor(const CPWL_Color& color);
+
+ static CFX_ByteString GetColorAppStream(const CPWL_Color& color,
+ const FX_BOOL& bFillOrStroke = TRUE);
+ static CFX_ByteString GetBorderAppStream(const CPDF_Rect& rect,
+ FX_FLOAT fWidth,
+ const CPWL_Color& color,
+ const CPWL_Color& crLeftTop,
+ const CPWL_Color& crRightBottom,
+ int32_t nStyle,
+ const CPWL_Dash& dash);
+ static CFX_ByteString GetCircleBorderAppStream(
+ const CPDF_Rect& rect,
+ FX_FLOAT fWidth,
+ const CPWL_Color& color,
+ const CPWL_Color& crLeftTop,
+ const CPWL_Color& crRightBottom,
+ int32_t nStyle,
+ const CPWL_Dash& dash);
+ static CFX_ByteString GetRectFillAppStream(const CPDF_Rect& rect,
+ const CPWL_Color& color);
+ static CFX_ByteString GetCircleFillAppStream(const CPDF_Rect& rect,
+ const CPWL_Color& color);
+
+ static CFX_ByteString GetPushButtonAppStream(const CPDF_Rect& rcBBox,
+ IFX_Edit_FontMap* pFontMap,
+ CPDF_Stream* pIconStream,
+ CPDF_IconFit& IconFit,
+ const CFX_WideString& sLabel,
+ const CPWL_Color& crText,
+ FX_FLOAT fFontSize,
+ int32_t nLayOut);
+ static CFX_ByteString GetCheckBoxAppStream(const CPDF_Rect& rcBBox,
+ int32_t nStyle,
+ const CPWL_Color& crText);
+ static CFX_ByteString GetRadioButtonAppStream(const CPDF_Rect& rcBBox,
+ int32_t nStyle,
+ const CPWL_Color& crText);
+
+ static CFX_ByteString GetEditAppStream(IFX_Edit* pEdit,
+ const CPDF_Point& ptOffset,
+ const CPVT_WordRange* pRange = NULL,
+ FX_BOOL bContinuous = TRUE,
+ FX_WORD SubWord = 0);
+ static CFX_ByteString GetEditSelAppStream(
+ IFX_Edit* pEdit,
+ const CPDF_Point& ptOffset,
+ const CPVT_WordRange* pRange = NULL);
+ static CFX_ByteString GetSpellCheckAppStream(
+ IFX_Edit* pEdit,
+ IPWL_SpellCheck* pSpellCheck,
+ const CPDF_Point& ptOffset,
+ const CPVT_WordRange* pRange = NULL);
+ static CFX_ByteString GetTextAppStream(const CPDF_Rect& rcBBox,
+ IFX_Edit_FontMap* pFontMap,
+ const CFX_WideString& sText,
+ int32_t nAlignmentH,
+ int32_t nAlignmentV,
+ FX_FLOAT fFontSize,
+ FX_BOOL bMultiLine,
+ FX_BOOL bAutoReturn,
+ const CPWL_Color& crText);
+ static CFX_ByteString GetDropButtonAppStream(const CPDF_Rect& rcBBox);
+
+ static void DrawFillRect(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ const CPDF_Rect& rect,
+ const CPWL_Color& color,
+ int32_t nTransparancy);
+ static void DrawFillRect(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ const CPDF_Rect& rect,
+ const FX_COLORREF& color);
+ static void DrawStrokeRect(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ const CPDF_Rect& rect,
+ const FX_COLORREF& color,
+ FX_FLOAT fWidth);
+ static void DrawStrokeLine(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ const CPDF_Point& ptMoveTo,
+ const CPDF_Point& ptLineTo,
+ const FX_COLORREF& color,
+ FX_FLOAT fWidth);
+ static void DrawBorder(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ const CPDF_Rect& rect,
+ FX_FLOAT fWidth,
+ const CPWL_Color& color,
+ const CPWL_Color& crLeftTop,
+ const CPWL_Color& crRightBottom,
+ int32_t nStyle,
+ const CPWL_Dash& dash,
+ int32_t nTransparancy);
+ static void DrawFillArea(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ const CPDF_Point* pPts,
+ int32_t nCount,
+ const FX_COLORREF& color);
+ static void DrawShadow(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ FX_BOOL bVertical,
+ FX_BOOL bHorizontal,
+ CPDF_Rect rect,
+ int32_t nTransparancy,
+ int32_t nStartGray,
+ int32_t nEndGray);
+ static void DrawEditSpellCheck(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ IFX_Edit* pEdit,
+ const CPDF_Rect& rcClip,
+ const CPDF_Point& ptOffset,
+ const CPVT_WordRange* pRange,
+ IPWL_SpellCheck* pSpellCheck);
+
+ public:
+ static void ConvertCMYK2RGB(FX_FLOAT dC,
+ FX_FLOAT dM,
+ FX_FLOAT dY,
+ FX_FLOAT dK,
+ FX_FLOAT& dR,
+ FX_FLOAT& dG,
+ FX_FLOAT& dB);
+ static void ConvertRGB2CMYK(FX_FLOAT dR,
+ FX_FLOAT dG,
+ FX_FLOAT dB,
+ FX_FLOAT& dC,
+ FX_FLOAT& dM,
+ FX_FLOAT& dY,
+ FX_FLOAT& dK);
+
+ static void ConvertRGB2GRAY(FX_FLOAT dR,
+ FX_FLOAT dG,
+ FX_FLOAT dB,
+ FX_FLOAT& dGray);
+ static void ConvertGRAY2RGB(FX_FLOAT dGray,
+ FX_FLOAT& dR,
+ FX_FLOAT& dG,
+ FX_FLOAT& dB);
+
+ static void ConvertCMYK2GRAY(FX_FLOAT dC,
+ FX_FLOAT dM,
+ FX_FLOAT dY,
+ FX_FLOAT dK,
+ FX_FLOAT& dGray);
+ static void ConvertGRAY2CMYK(FX_FLOAT dGray,
+ FX_FLOAT& dC,
+ FX_FLOAT& dM,
+ FX_FLOAT& dY,
+ FX_FLOAT& dK);
+
+ static void PWLColorToARGB(const CPWL_Color& color,
+ int32_t& alpha,
+ FX_FLOAT& red,
+ FX_FLOAT& green,
+ FX_FLOAT& blue);
+
+ public:
+ static CFX_ByteString GetIconAppStream(
+ int32_t nType,
+ const CPDF_Rect& rect,
+ const CPWL_Color& crFill,
+ const CPWL_Color& crStroke = PWL_DEFAULT_BLACKCOLOR);
+ static void DrawIconAppStream(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device,
+ int32_t nType,
+ const CPDF_Rect& rect,
+ const CPWL_Color& crFill,
+ const CPWL_Color& crStroke,
+ const int32_t nTransparancy);
+
+ private:
+ static CFX_ByteString GetAppStreamFromArray(const CPWL_PathData* pPathData,
+ int32_t nCount);
+ static void GetPathDataFromArray(CFX_PathData& path,
+ const CPWL_PathData* pPathData,
+ int32_t nCount);
+
+ static CFX_ByteString GetAppStream_Check(const CPDF_Rect& rcBBox,
+ const CPWL_Color& crText);
+ static CFX_ByteString GetAppStream_Circle(const CPDF_Rect& rcBBox,
+ const CPWL_Color& crText);
+ static CFX_ByteString GetAppStream_Cross(const CPDF_Rect& rcBBox,
+ const CPWL_Color& crText);
+ static CFX_ByteString GetAppStream_Diamond(const CPDF_Rect& rcBBox,
+ const CPWL_Color& crText);
+ static CFX_ByteString GetAppStream_Square(const CPDF_Rect& rcBBox,
+ const CPWL_Color& crText);
+ static CFX_ByteString GetAppStream_Star(const CPDF_Rect& rcBBox,
+ const CPWL_Color& crText);
+
+ static CFX_ByteString GetAP_Check(const CPDF_Rect& crBBox);
+ static CFX_ByteString GetAP_Circle(const CPDF_Rect& crBBox);
+ static CFX_ByteString GetAP_Cross(const CPDF_Rect& crBBox);
+ static CFX_ByteString GetAP_Diamond(const CPDF_Rect& crBBox);
+ static CFX_ByteString GetAP_Square(const CPDF_Rect& crBBox);
+ static CFX_ByteString GetAP_Star(const CPDF_Rect& crBBox);
+ static CFX_ByteString GetAP_HalfCircle(const CPDF_Rect& crBBox,
+ FX_FLOAT fRotate);
+
+ static void GetGraphics_Checkmark(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CPDF_Rect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Circle(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CPDF_Rect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Comment(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CPDF_Rect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Cross(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CPDF_Rect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Help(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CPDF_Rect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_InsertText(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CPDF_Rect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Key(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CPDF_Rect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_NewParagraph(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CPDF_Rect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_TextNote(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CPDF_Rect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Paragraph(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CPDF_Rect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_RightArrow(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CPDF_Rect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_RightPointer(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CPDF_Rect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Star(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CPDF_Rect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_UpArrow(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CPDF_Rect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_UpLeftArrow(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CPDF_Rect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Graph(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CPDF_Rect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Paperclip(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CPDF_Rect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Attachment(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CPDF_Rect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Tag(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CPDF_Rect& crBBox,
+ const PWL_PATH_TYPE type);
+ static void GetGraphics_Foxit(CFX_ByteString& sPathData,
+ CFX_PathData& path,
+ const CPDF_Rect& crBBox,
+ const PWL_PATH_TYPE type);
};
#endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_UTILS_H_
diff --git a/fpdfsdk/include/pdfwindow/PWL_Wnd.h b/fpdfsdk/include/pdfwindow/PWL_Wnd.h
index 67b28cf424..235786b1b7 100644
--- a/fpdfsdk/include/pdfwindow/PWL_Wnd.h
+++ b/fpdfsdk/include/pdfwindow/PWL_Wnd.h
@@ -21,444 +21,455 @@ class IFX_SystemHandler;
class IPWL_Provider;
class IPWL_SpellCheck;
-//window styles
-#define PWS_CHILD 0x80000000L
-#define PWS_BORDER 0x40000000L
-#define PWS_BACKGROUND 0x20000000L
-#define PWS_HSCROLL 0x10000000L
-#define PWS_VSCROLL 0x08000000L
-#define PWS_VISIBLE 0x04000000L
-#define PWS_DISABLE 0x02000000L
-#define PWS_READONLY 0x01000000L
-#define PWS_AUTOFONTSIZE 0x00800000L
-#define PWS_AUTOTRANSPARENT 0x00400000L
-#define PWS_NOREFRESHCLIP 0x00200000L
-
-//edit and label styles
-#define PES_MULTILINE 0x0001L
-#define PES_PASSWORD 0x0002L
-#define PES_LEFT 0x0004L
-#define PES_RIGHT 0x0008L
-#define PES_MIDDLE 0x0010L
-#define PES_TOP 0x0020L
-#define PES_BOTTOM 0x0040L
-#define PES_CENTER 0x0080L
-#define PES_CHARARRAY 0x0100L
-#define PES_AUTOSCROLL 0x0200L
-#define PES_AUTORETURN 0x0400L
-#define PES_UNDO 0x0800L
-#define PES_RICH 0x1000L
-#define PES_SPELLCHECK 0x2000L
-#define PES_TEXTOVERFLOW 0x4000L
-#define PES_NOREAD 0x8000L
-
-//listbox styles
-#define PLBS_MULTIPLESEL 0x0001L
-#define PLBS_HOVERSEL 0x0008L
-
-//combobox styles
-#define PCBS_ALLOWCUSTOMTEXT 0x0001L
-
-//richedit styles
-#define PRES_MULTILINE 0x0001L
-#define PRES_AUTORETURN 0x0002L
-#define PRES_AUTOSCROLL 0x0004L
-#define PRES_SPELLCHECK 0x0008L
-#define PRES_UNDO 0x0100L
-#define PRES_MULTIPAGES 0x0200L
-#define PRES_TEXTOVERFLOW 0x0400L
-
-//border style
-#define PBS_SOLID 0
-#define PBS_DASH 1
-#define PBS_BEVELED 2
-#define PBS_INSET 3
-#define PBS_UNDERLINED 4
-#define PBS_SHADOW 5
-
-//notification messages
-#define PNM_ADDCHILD 0x00000000L
-#define PNM_REMOVECHILD 0x00000001L
-#define PNM_SETSCROLLINFO 0x00000002L
-#define PNM_SETSCROLLPOS 0x00000003L
-#define PNM_SCROLLWINDOW 0x00000004L
-#define PNM_LBUTTONDOWN 0x00000005L
-#define PNM_LBUTTONUP 0x00000006L
-#define PNM_MOUSEMOVE 0x00000007L
-#define PNM_NOTERESET 0x00000008L
-#define PNM_SETCARETINFO 0x00000009L
-#define PNM_SELCHANGED 0x0000000AL
-#define PNM_NOTEEDITCHANGED 0x0000000BL
-
-#define PWL_CLASSNAME_EDIT "CPWL_Edit"
-
-struct CPWL_Dash
-{
- CPWL_Dash(int32_t dash, int32_t gap, int32_t phase) : nDash(dash), nGap(gap), nPhase(phase)
- {}
-
- int32_t nDash;
- int32_t nGap;
- int32_t nPhase;
+// window styles
+#define PWS_CHILD 0x80000000L
+#define PWS_BORDER 0x40000000L
+#define PWS_BACKGROUND 0x20000000L
+#define PWS_HSCROLL 0x10000000L
+#define PWS_VSCROLL 0x08000000L
+#define PWS_VISIBLE 0x04000000L
+#define PWS_DISABLE 0x02000000L
+#define PWS_READONLY 0x01000000L
+#define PWS_AUTOFONTSIZE 0x00800000L
+#define PWS_AUTOTRANSPARENT 0x00400000L
+#define PWS_NOREFRESHCLIP 0x00200000L
+
+// edit and label styles
+#define PES_MULTILINE 0x0001L
+#define PES_PASSWORD 0x0002L
+#define PES_LEFT 0x0004L
+#define PES_RIGHT 0x0008L
+#define PES_MIDDLE 0x0010L
+#define PES_TOP 0x0020L
+#define PES_BOTTOM 0x0040L
+#define PES_CENTER 0x0080L
+#define PES_CHARARRAY 0x0100L
+#define PES_AUTOSCROLL 0x0200L
+#define PES_AUTORETURN 0x0400L
+#define PES_UNDO 0x0800L
+#define PES_RICH 0x1000L
+#define PES_SPELLCHECK 0x2000L
+#define PES_TEXTOVERFLOW 0x4000L
+#define PES_NOREAD 0x8000L
+
+// listbox styles
+#define PLBS_MULTIPLESEL 0x0001L
+#define PLBS_HOVERSEL 0x0008L
+
+// combobox styles
+#define PCBS_ALLOWCUSTOMTEXT 0x0001L
+
+// richedit styles
+#define PRES_MULTILINE 0x0001L
+#define PRES_AUTORETURN 0x0002L
+#define PRES_AUTOSCROLL 0x0004L
+#define PRES_SPELLCHECK 0x0008L
+#define PRES_UNDO 0x0100L
+#define PRES_MULTIPAGES 0x0200L
+#define PRES_TEXTOVERFLOW 0x0400L
+
+// border style
+#define PBS_SOLID 0
+#define PBS_DASH 1
+#define PBS_BEVELED 2
+#define PBS_INSET 3
+#define PBS_UNDERLINED 4
+#define PBS_SHADOW 5
+
+// notification messages
+#define PNM_ADDCHILD 0x00000000L
+#define PNM_REMOVECHILD 0x00000001L
+#define PNM_SETSCROLLINFO 0x00000002L
+#define PNM_SETSCROLLPOS 0x00000003L
+#define PNM_SCROLLWINDOW 0x00000004L
+#define PNM_LBUTTONDOWN 0x00000005L
+#define PNM_LBUTTONUP 0x00000006L
+#define PNM_MOUSEMOVE 0x00000007L
+#define PNM_NOTERESET 0x00000008L
+#define PNM_SETCARETINFO 0x00000009L
+#define PNM_SELCHANGED 0x0000000AL
+#define PNM_NOTEEDITCHANGED 0x0000000BL
+
+#define PWL_CLASSNAME_EDIT "CPWL_Edit"
+
+struct CPWL_Dash {
+ CPWL_Dash(int32_t dash, int32_t gap, int32_t phase)
+ : nDash(dash), nGap(gap), nPhase(phase) {}
+
+ int32_t nDash;
+ int32_t nGap;
+ int32_t nPhase;
};
-struct CPWL_Color
-{
- CPWL_Color(int32_t type = COLORTYPE_TRANSPARENT, FX_FLOAT color1 = 0.0f, FX_FLOAT color2 = 0.0f, FX_FLOAT color3 = 0.0f, FX_FLOAT color4 = 0.0f)
- : nColorType(type), fColor1(color1), fColor2(color2), fColor3(color3), fColor4(color4)
- {}
-
- CPWL_Color(int32_t r, int32_t g, int32_t b) :
- nColorType(COLORTYPE_RGB), fColor1(r/255.0f), fColor2(g/255.0f), fColor3(b/255.0f), fColor4(0)
- {}
-
- void ConvertColorType(int32_t other_nColorType);
-
- /*
- COLORTYPE_TRANSPARENT
- COLORTYPE_RGB
- COLORTYPE_CMYK
- COLORTYPE_GRAY
- */
- int32_t nColorType;
- FX_FLOAT fColor1,fColor2,fColor3,fColor4;
+struct CPWL_Color {
+ CPWL_Color(int32_t type = COLORTYPE_TRANSPARENT,
+ FX_FLOAT color1 = 0.0f,
+ FX_FLOAT color2 = 0.0f,
+ FX_FLOAT color3 = 0.0f,
+ FX_FLOAT color4 = 0.0f)
+ : nColorType(type),
+ fColor1(color1),
+ fColor2(color2),
+ fColor3(color3),
+ fColor4(color4) {}
+
+ CPWL_Color(int32_t r, int32_t g, int32_t b)
+ : nColorType(COLORTYPE_RGB),
+ fColor1(r / 255.0f),
+ fColor2(g / 255.0f),
+ fColor3(b / 255.0f),
+ fColor4(0) {}
+
+ void ConvertColorType(int32_t other_nColorType);
+
+ /*
+ COLORTYPE_TRANSPARENT
+ COLORTYPE_RGB
+ COLORTYPE_CMYK
+ COLORTYPE_GRAY
+ */
+ int32_t nColorType;
+ FX_FLOAT fColor1, fColor2, fColor3, fColor4;
};
-inline FX_BOOL operator == (const CPWL_Color &c1, const CPWL_Color &c2)
-{
- return c1.nColorType == c2.nColorType &&
- c1.fColor1 - c2.fColor1 < 0.0001 && c1.fColor1 - c2.fColor1 > -0.0001 &&
- c1.fColor2 - c2.fColor2 < 0.0001 && c1.fColor2 - c2.fColor2 > -0.0001 &&
- c1.fColor3 - c2.fColor3 < 0.0001 && c1.fColor3 - c2.fColor3 > -0.0001 &&
- c1.fColor4 - c2.fColor4 < 0.0001 && c1.fColor4 - c2.fColor4 > -0.0001;
+inline FX_BOOL operator==(const CPWL_Color& c1, const CPWL_Color& c2) {
+ return c1.nColorType == c2.nColorType && c1.fColor1 - c2.fColor1 < 0.0001 &&
+ c1.fColor1 - c2.fColor1 > -0.0001 &&
+ c1.fColor2 - c2.fColor2 < 0.0001 &&
+ c1.fColor2 - c2.fColor2 > -0.0001 &&
+ c1.fColor3 - c2.fColor3 < 0.0001 &&
+ c1.fColor3 - c2.fColor3 > -0.0001 &&
+ c1.fColor4 - c2.fColor4 < 0.0001 && c1.fColor4 - c2.fColor4 > -0.0001;
}
-inline FX_BOOL operator != (const CPWL_Color &c1, const CPWL_Color &c2)
-{
- return !operator == (c1, c2);
+inline FX_BOOL operator!=(const CPWL_Color& c1, const CPWL_Color& c2) {
+ return !operator==(c1, c2);
}
-#define PWL_SCROLLBAR_WIDTH 12.0f
-#define PWL_SCROLLBAR_BUTTON_WIDTH 9.0f
-#define PWL_SCROLLBAR_POSBUTTON_MINWIDTH 2.0f
-#define PWL_SCROLLBAR_TRANSPARANCY 150
-#define PWL_SCROLLBAR_BKCOLOR CPWL_Color(COLORTYPE_RGB,220.0f/255.0f,220.0f/255.0f,220.0f/255.0f)
-#define PWL_DEFAULT_SELTEXTCOLOR CPWL_Color(COLORTYPE_RGB,1,1,1)
-#define PWL_DEFAULT_SELBACKCOLOR CPWL_Color(COLORTYPE_RGB,0,51.0f/255.0f,113.0f/255.0f)
-#define PWL_DEFAULT_BACKCOLOR PWL_DEFAULT_SELTEXTCOLOR
-#define PWL_DEFAULT_TEXTCOLOR CPWL_Color(COLORTYPE_RGB,0,0,0)
-#define PWL_DEFAULT_FONTSIZE 9.0f
-#define PWL_DEFAULT_BLACKCOLOR CPWL_Color(COLORTYPE_GRAY,0)
-#define PWL_DEFAULT_WHITECOLOR CPWL_Color(COLORTYPE_GRAY,1)
-#define PWL_DEFAULT_HEAVYGRAYCOLOR CPWL_Color(COLORTYPE_GRAY,0.50)
-#define PWL_DEFAULT_LIGHTGRAYCOLOR CPWL_Color(COLORTYPE_GRAY,0.75)
-#define PWL_TRIANGLE_HALFLEN 2.0f
-#define PWL_CBBUTTON_TRIANGLE_HALFLEN 3.0f
-#define PWL_INVALIDATE_INFLATE 2
-
-class IPWL_SpellCheck
-{
-public:
- virtual ~IPWL_SpellCheck() { }
- virtual FX_BOOL CheckWord(const FX_CHAR* sWord) = 0;
- virtual void SuggestWords(const FX_CHAR* sWord, CFX_ByteStringArray & sSuggest) = 0;
+#define PWL_SCROLLBAR_WIDTH 12.0f
+#define PWL_SCROLLBAR_BUTTON_WIDTH 9.0f
+#define PWL_SCROLLBAR_POSBUTTON_MINWIDTH 2.0f
+#define PWL_SCROLLBAR_TRANSPARANCY 150
+#define PWL_SCROLLBAR_BKCOLOR \
+ CPWL_Color(COLORTYPE_RGB, 220.0f / 255.0f, 220.0f / 255.0f, 220.0f / 255.0f)
+#define PWL_DEFAULT_SELTEXTCOLOR CPWL_Color(COLORTYPE_RGB, 1, 1, 1)
+#define PWL_DEFAULT_SELBACKCOLOR \
+ CPWL_Color(COLORTYPE_RGB, 0, 51.0f / 255.0f, 113.0f / 255.0f)
+#define PWL_DEFAULT_BACKCOLOR PWL_DEFAULT_SELTEXTCOLOR
+#define PWL_DEFAULT_TEXTCOLOR CPWL_Color(COLORTYPE_RGB, 0, 0, 0)
+#define PWL_DEFAULT_FONTSIZE 9.0f
+#define PWL_DEFAULT_BLACKCOLOR CPWL_Color(COLORTYPE_GRAY, 0)
+#define PWL_DEFAULT_WHITECOLOR CPWL_Color(COLORTYPE_GRAY, 1)
+#define PWL_DEFAULT_HEAVYGRAYCOLOR CPWL_Color(COLORTYPE_GRAY, 0.50)
+#define PWL_DEFAULT_LIGHTGRAYCOLOR CPWL_Color(COLORTYPE_GRAY, 0.75)
+#define PWL_TRIANGLE_HALFLEN 2.0f
+#define PWL_CBBUTTON_TRIANGLE_HALFLEN 3.0f
+#define PWL_INVALIDATE_INFLATE 2
+
+class IPWL_SpellCheck {
+ public:
+ virtual ~IPWL_SpellCheck() {}
+ virtual FX_BOOL CheckWord(const FX_CHAR* sWord) = 0;
+ virtual void SuggestWords(const FX_CHAR* sWord,
+ CFX_ByteStringArray& sSuggest) = 0;
};
-class IPWL_Provider
-{
-public:
- virtual ~IPWL_Provider() { }
-
- //get a matrix which map user space to CWnd client space
- virtual CPDF_Matrix GetWindowMatrix(void* pAttachedData) = 0;
-
- /*
- 0 L"&Undo\tCtrl+Z"
- 1 L"&Redo\tCtrl+Shift+Z"
- 2 L"Cu&t\tCtrl+X"
- 3 L"&Copy\tCtrl+C"
- 4 L"&Paste\tCtrl+V"
- 5 L"&Delete"
- 6 L"&Select All\tCtrl+A"
- */
- virtual CFX_WideString LoadPopupMenuString(int32_t nIndex) = 0;
+class IPWL_Provider {
+ public:
+ virtual ~IPWL_Provider() {}
+
+ // get a matrix which map user space to CWnd client space
+ virtual CPDF_Matrix GetWindowMatrix(void* pAttachedData) = 0;
+
+ /*
+ 0 L"&Undo\tCtrl+Z"
+ 1 L"&Redo\tCtrl+Shift+Z"
+ 2 L"Cu&t\tCtrl+X"
+ 3 L"&Copy\tCtrl+C"
+ 4 L"&Paste\tCtrl+V"
+ 5 L"&Delete"
+ 6 L"&Select All\tCtrl+A"
+ */
+ virtual CFX_WideString LoadPopupMenuString(int32_t nIndex) = 0;
};
-class IPWL_FocusHandler
-{
-public:
- virtual ~IPWL_FocusHandler() { }
- virtual void OnSetFocus(CPWL_Wnd* pWnd) = 0;
- virtual void OnKillFocus(CPWL_Wnd* pWnd) = 0;
+class IPWL_FocusHandler {
+ public:
+ virtual ~IPWL_FocusHandler() {}
+ virtual void OnSetFocus(CPWL_Wnd* pWnd) = 0;
+ virtual void OnKillFocus(CPWL_Wnd* pWnd) = 0;
};
-struct PWL_CREATEPARAM
-{
-public:
- PWL_CREATEPARAM() : rcRectWnd(0,0,0,0),
- pSystemHandler(NULL),
- pFontMap(NULL),
- pProvider(NULL),
- pFocusHandler(NULL),
- dwFlags(0),
- sBackgroundColor(),
- hAttachedWnd(NULL),
- pSpellCheck(NULL),
- nBorderStyle(PBS_SOLID),
- dwBorderWidth(1),
- sBorderColor(),
- sTextColor(),
- sTextStrokeColor(),
- nTransparency(255),
- fFontSize(PWL_DEFAULT_FONTSIZE),
- sDash(3,0,0),
- pAttachedData(NULL),
- pParentWnd(NULL),
- pMsgControl(NULL),
- eCursorType(FXCT_ARROW),
- mtChild(1,0,0,1,0,0)
- {
- }
-
- CPDF_Rect rcRectWnd; //required
- IFX_SystemHandler* pSystemHandler; //required
- IFX_Edit_FontMap* pFontMap; //required for text window
- IPWL_Provider* pProvider; //required for self coordinate
- IPWL_FocusHandler* pFocusHandler; //optional
- FX_DWORD dwFlags; //optional
- CPWL_Color sBackgroundColor; //optional
- FX_HWND hAttachedWnd; //required for no-reader framework
- IPWL_SpellCheck* pSpellCheck; //required for spellchecking
- int32_t nBorderStyle; //optional
- int32_t dwBorderWidth; //optional
- CPWL_Color sBorderColor; //optional
- CPWL_Color sTextColor; //optional
- CPWL_Color sTextStrokeColor; //optional
- int32_t nTransparency; //optional
- FX_FLOAT fFontSize; //optional
- CPWL_Dash sDash; //optional
- void* pAttachedData; //optional
- CPWL_Wnd* pParentWnd; //ignore
- CPWL_MsgControl* pMsgControl; //ignore
- int32_t eCursorType; //ignore
- CPDF_Matrix mtChild; //ignore
+struct PWL_CREATEPARAM {
+ public:
+ PWL_CREATEPARAM()
+ : rcRectWnd(0, 0, 0, 0),
+ pSystemHandler(NULL),
+ pFontMap(NULL),
+ pProvider(NULL),
+ pFocusHandler(NULL),
+ dwFlags(0),
+ sBackgroundColor(),
+ hAttachedWnd(NULL),
+ pSpellCheck(NULL),
+ nBorderStyle(PBS_SOLID),
+ dwBorderWidth(1),
+ sBorderColor(),
+ sTextColor(),
+ sTextStrokeColor(),
+ nTransparency(255),
+ fFontSize(PWL_DEFAULT_FONTSIZE),
+ sDash(3, 0, 0),
+ pAttachedData(NULL),
+ pParentWnd(NULL),
+ pMsgControl(NULL),
+ eCursorType(FXCT_ARROW),
+ mtChild(1, 0, 0, 1, 0, 0) {}
+
+ CPDF_Rect rcRectWnd; // required
+ IFX_SystemHandler* pSystemHandler; // required
+ IFX_Edit_FontMap* pFontMap; // required for text window
+ IPWL_Provider* pProvider; // required for self coordinate
+ IPWL_FocusHandler* pFocusHandler; // optional
+ FX_DWORD dwFlags; // optional
+ CPWL_Color sBackgroundColor; // optional
+ FX_HWND hAttachedWnd; // required for no-reader framework
+ IPWL_SpellCheck* pSpellCheck; // required for spellchecking
+ int32_t nBorderStyle; // optional
+ int32_t dwBorderWidth; // optional
+ CPWL_Color sBorderColor; // optional
+ CPWL_Color sTextColor; // optional
+ CPWL_Color sTextStrokeColor; // optional
+ int32_t nTransparency; // optional
+ FX_FLOAT fFontSize; // optional
+ CPWL_Dash sDash; // optional
+ void* pAttachedData; // optional
+ CPWL_Wnd* pParentWnd; // ignore
+ CPWL_MsgControl* pMsgControl; // ignore
+ int32_t eCursorType; // ignore
+ CPDF_Matrix mtChild; // ignore
};
-class CPWL_Timer
-{
-public:
- CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemHandler);
- virtual ~CPWL_Timer();
+class CPWL_Timer {
+ public:
+ CPWL_Timer(CPWL_TimerHandler* pAttached, IFX_SystemHandler* pSystemHandler);
+ virtual ~CPWL_Timer();
- int32_t SetPWLTimer(int32_t nElapse);
- void KillPWLTimer();
- static void TimerProc(int32_t idEvent);
+ int32_t SetPWLTimer(int32_t nElapse);
+ void KillPWLTimer();
+ static void TimerProc(int32_t idEvent);
-private:
- int32_t m_nTimerID;
- CPWL_TimerHandler* m_pAttached;
- IFX_SystemHandler* m_pSystemHandler;
+ private:
+ int32_t m_nTimerID;
+ CPWL_TimerHandler* m_pAttached;
+ IFX_SystemHandler* m_pSystemHandler;
};
-class CPWL_TimerHandler
-{
-public:
- CPWL_TimerHandler();
- virtual ~CPWL_TimerHandler();
+class CPWL_TimerHandler {
+ public:
+ CPWL_TimerHandler();
+ virtual ~CPWL_TimerHandler();
- void BeginTimer(int32_t nElapse);
- void EndTimer();
- virtual void TimerProc();
- virtual IFX_SystemHandler* GetSystemHandler() const = 0;
+ void BeginTimer(int32_t nElapse);
+ void EndTimer();
+ virtual void TimerProc();
+ virtual IFX_SystemHandler* GetSystemHandler() const = 0;
-private:
- CPWL_Timer* m_pTimer;
+ private:
+ CPWL_Timer* m_pTimer;
};
-class CPWL_Wnd : public CPWL_TimerHandler
-{
- friend class CPWL_MsgControl;
-public:
- CPWL_Wnd();
- virtual ~CPWL_Wnd();
-
- void Create(const PWL_CREATEPARAM & cp);
- virtual CFX_ByteString GetClassName() const;
- void Destroy();
- void Move(const CPDF_Rect & rcNew,FX_BOOL bReset,FX_BOOL bRefresh);
- virtual void InvalidateRect(CPDF_Rect* pRect = NULL);
-
- void GetAppearanceStream(CFX_ByteString & sAppStream);
- void DrawAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-
- virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
- virtual FX_BOOL OnKeyUp(FX_WORD nChar, FX_DWORD nFlag);
- virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnRButtonDblClk(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnRButtonDown(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag);
- virtual FX_BOOL OnMouseWheel(short zDelta, const CPDF_Point & point, FX_DWORD nFlag);
-
- virtual void SetFocus();
- virtual void KillFocus();
- void SetCapture();
- void ReleaseCapture();
-
- virtual void OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam = 0, intptr_t lParam = 0);
- virtual void SetTextColor(const CPWL_Color & color);
- virtual void SetTextStrokeColor(const CPWL_Color & color);
- virtual void SetVisible(FX_BOOL bVisible);
-
- virtual CPDF_Rect GetFocusRect() const;
- virtual CPWL_Color GetBackgroundColor() const;
- virtual CPWL_Color GetBorderColor() const;
- virtual CPWL_Color GetTextColor() const;
- virtual CPWL_Color GetTextStrokeColor() const;
- virtual FX_FLOAT GetFontSize() const;
- virtual int32_t GetInnerBorderWidth() const;
- virtual CPWL_Color GetBorderLeftTopColor(int32_t nBorderStyle) const;
- virtual CPWL_Color GetBorderRightBottomColor(int32_t nBorderStyle) const;
-
- virtual FX_BOOL IsModified() const {return FALSE;}
-
- virtual void SetFontSize(FX_FLOAT fFontSize);
-
- void SetBackgroundColor(const CPWL_Color & color);
- void SetBorderColor(const CPWL_Color & color);
- void SetBorderWidth(int32_t nBorderWidth);
- void SetClipRect(const CPDF_Rect & rect);
- void SetBorderStyle(int32_t eBorderStyle);
- void SetBorderDash(const CPWL_Dash & sDash);
-
- CPDF_Rect GetOriginWindowRect() const;
- virtual CPDF_Rect GetWindowRect() const;
- virtual CPDF_Rect GetClientRect() const;
- CPDF_Point GetCenterPoint() const;
- CPDF_Rect GetClientCenterSquare() const;
- CPDF_Rect GetWindowCenterSquare() const;
- int32_t GetBorderWidth() const;
- FX_BOOL IsVisible() const {return m_bVisible;}
- FX_BOOL HasFlag(FX_DWORD dwFlags) const;
- void AddFlag(FX_DWORD dwFlags);
- void RemoveFlag(FX_DWORD dwFlags);
- CPDF_Rect GetClipRect() const;
- CPWL_Wnd* GetParentWindow() const;
- int32_t GetBorderStyle() const;
- CPWL_Dash GetBorderDash() const;
- void* GetAttachedData() const;
-
- FX_BOOL WndHitTest(const CPDF_Point & point) const;
- FX_BOOL ClientHitTest(const CPDF_Point & point) const;
- FX_BOOL IsCaptureMouse() const;
-
- const CPWL_Wnd* GetFocused() const;
- FX_BOOL IsFocused() const;
- FX_BOOL IsReadOnly() const;
- CPWL_ScrollBar* GetVScrollBar() const;
-
- IFX_Edit_FontMap* GetFontMap() const;
- IPWL_Provider* GetProvider() const;
- virtual IFX_SystemHandler* GetSystemHandler() const;
- IPWL_FocusHandler* GetFocusHandler() const;
-
- int32_t GetTransparency();
- void SetTransparency(int32_t nTransparency);
-
- CPDF_Matrix GetChildToRoot() const;
- CPDF_Matrix GetChildMatrix() const;
- void SetChildMatrix(const CPDF_Matrix& mt);
- CPDF_Matrix GetWindowMatrix() const;
-
- virtual CPDF_Point ChildToParent(const CPDF_Point& point) const;
- virtual CPDF_Rect ChildToParent(const CPDF_Rect& rect) const;
- virtual CPDF_Point ParentToChild(const CPDF_Point& point) const;
- virtual CPDF_Rect ParentToChild(const CPDF_Rect& rect) const;
-
- //those methods only implemented by listctrl item
- virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth) {return 0;}
- virtual FX_FLOAT GetItemLeftMargin() {return 0;}
- virtual FX_FLOAT GetItemRightMargin() {return 0;}
-
- void EnableWindow(FX_BOOL bEnable);
- FX_BOOL IsEnabled();
- virtual void SetCursor();
-
-protected:
- virtual void CreateChildWnd(const PWL_CREATEPARAM & cp);
- virtual void RePosChildWnd();
- void GetAppearanceStream(CFX_ByteTextBuf & sAppStream);
- virtual void GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream);
- virtual void GetChildAppearanceStream(CFX_ByteTextBuf & sAppStream);
-
- virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
- virtual void DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
-
- virtual void OnCreate(PWL_CREATEPARAM & cp);
- virtual void OnCreated();
- virtual void OnDestroy();
-
- virtual void OnSetFocus();
- virtual void OnKillFocus();
-
- virtual void OnEnabled();
- virtual void OnDisabled();
-
- void SetNotifyFlag(FX_BOOL bNotifying = TRUE){m_bNotifying = bNotifying;};
-
- FX_BOOL IsValid() const;
- PWL_CREATEPARAM GetCreationParam() const;
- FX_BOOL IsNotifying() const {return m_bNotifying;}
-
- void InvalidateRectMove(const CPDF_Rect & rcOld, const CPDF_Rect & rcNew);
-
- void PWLtoWnd(const CPDF_Point & point, int32_t& x, int32_t& y) const;
- FX_RECT PWLtoWnd(const CPDF_Rect & rect) const;
- FX_HWND GetAttachedHWnd() const;
-
- FX_BOOL IsWndCaptureMouse(const CPWL_Wnd * pWnd) const;
- FX_BOOL IsWndCaptureKeyboard(const CPWL_Wnd * pWnd) const;
- const CPWL_Wnd* GetRootWnd() const;
-
- FX_BOOL IsCTRLpressed(FX_DWORD nFlag) const;
- FX_BOOL IsSHIFTpressed(FX_DWORD nFlag) const;
- FX_BOOL IsALTpressed(FX_DWORD nFlag) const;
- FX_BOOL IsINSERTpressed(FX_DWORD nFlag) const;
-
-private:
- void AddChild(CPWL_Wnd * pWnd);
- void RemoveChild(CPWL_Wnd * pWnd);
-
- void CreateScrollBar(const PWL_CREATEPARAM & cp);
- void CreateVScrollBar(const PWL_CREATEPARAM & cp);
-
- void AjustStyle();
- void CreateMsgControl();
- void DestroyMsgControl();
-
- CPWL_MsgControl* GetMsgControl() const;
-
-protected:
- CFX_ArrayTemplate<CPWL_Wnd*> m_aChildren;
+class CPWL_Wnd : public CPWL_TimerHandler {
+ friend class CPWL_MsgControl;
+
+ public:
+ CPWL_Wnd();
+ virtual ~CPWL_Wnd();
+
+ void Create(const PWL_CREATEPARAM& cp);
+ virtual CFX_ByteString GetClassName() const;
+ void Destroy();
+ void Move(const CPDF_Rect& rcNew, FX_BOOL bReset, FX_BOOL bRefresh);
+ virtual void InvalidateRect(CPDF_Rect* pRect = NULL);
+
+ void GetAppearanceStream(CFX_ByteString& sAppStream);
+ void DrawAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device);
+
+ virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag);
+ virtual FX_BOOL OnKeyUp(FX_WORD nChar, FX_DWORD nFlag);
+ virtual FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag);
+ virtual FX_BOOL OnLButtonDblClk(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnMButtonDblClk(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnMButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnMButtonUp(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnRButtonDblClk(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnRButtonDown(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnRButtonUp(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag);
+ virtual FX_BOOL OnMouseWheel(short zDelta,
+ const CPDF_Point& point,
+ FX_DWORD nFlag);
+
+ virtual void SetFocus();
+ virtual void KillFocus();
+ void SetCapture();
+ void ReleaseCapture();
+
+ virtual void OnNotify(CPWL_Wnd* pWnd,
+ FX_DWORD msg,
+ intptr_t wParam = 0,
+ intptr_t lParam = 0);
+ virtual void SetTextColor(const CPWL_Color& color);
+ virtual void SetTextStrokeColor(const CPWL_Color& color);
+ virtual void SetVisible(FX_BOOL bVisible);
+
+ virtual CPDF_Rect GetFocusRect() const;
+ virtual CPWL_Color GetBackgroundColor() const;
+ virtual CPWL_Color GetBorderColor() const;
+ virtual CPWL_Color GetTextColor() const;
+ virtual CPWL_Color GetTextStrokeColor() const;
+ virtual FX_FLOAT GetFontSize() const;
+ virtual int32_t GetInnerBorderWidth() const;
+ virtual CPWL_Color GetBorderLeftTopColor(int32_t nBorderStyle) const;
+ virtual CPWL_Color GetBorderRightBottomColor(int32_t nBorderStyle) const;
+
+ virtual FX_BOOL IsModified() const { return FALSE; }
+
+ virtual void SetFontSize(FX_FLOAT fFontSize);
+
+ void SetBackgroundColor(const CPWL_Color& color);
+ void SetBorderColor(const CPWL_Color& color);
+ void SetBorderWidth(int32_t nBorderWidth);
+ void SetClipRect(const CPDF_Rect& rect);
+ void SetBorderStyle(int32_t eBorderStyle);
+ void SetBorderDash(const CPWL_Dash& sDash);
+
+ CPDF_Rect GetOriginWindowRect() const;
+ virtual CPDF_Rect GetWindowRect() const;
+ virtual CPDF_Rect GetClientRect() const;
+ CPDF_Point GetCenterPoint() const;
+ CPDF_Rect GetClientCenterSquare() const;
+ CPDF_Rect GetWindowCenterSquare() const;
+ int32_t GetBorderWidth() const;
+ FX_BOOL IsVisible() const { return m_bVisible; }
+ FX_BOOL HasFlag(FX_DWORD dwFlags) const;
+ void AddFlag(FX_DWORD dwFlags);
+ void RemoveFlag(FX_DWORD dwFlags);
+ CPDF_Rect GetClipRect() const;
+ CPWL_Wnd* GetParentWindow() const;
+ int32_t GetBorderStyle() const;
+ CPWL_Dash GetBorderDash() const;
+ void* GetAttachedData() const;
+
+ FX_BOOL WndHitTest(const CPDF_Point& point) const;
+ FX_BOOL ClientHitTest(const CPDF_Point& point) const;
+ FX_BOOL IsCaptureMouse() const;
+
+ const CPWL_Wnd* GetFocused() const;
+ FX_BOOL IsFocused() const;
+ FX_BOOL IsReadOnly() const;
+ CPWL_ScrollBar* GetVScrollBar() const;
+
+ IFX_Edit_FontMap* GetFontMap() const;
+ IPWL_Provider* GetProvider() const;
+ virtual IFX_SystemHandler* GetSystemHandler() const;
+ IPWL_FocusHandler* GetFocusHandler() const;
+
+ int32_t GetTransparency();
+ void SetTransparency(int32_t nTransparency);
+
+ CPDF_Matrix GetChildToRoot() const;
+ CPDF_Matrix GetChildMatrix() const;
+ void SetChildMatrix(const CPDF_Matrix& mt);
+ CPDF_Matrix GetWindowMatrix() const;
+
+ virtual CPDF_Point ChildToParent(const CPDF_Point& point) const;
+ virtual CPDF_Rect ChildToParent(const CPDF_Rect& rect) const;
+ virtual CPDF_Point ParentToChild(const CPDF_Point& point) const;
+ virtual CPDF_Rect ParentToChild(const CPDF_Rect& rect) const;
+
+ // those methods only implemented by listctrl item
+ virtual FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth) { return 0; }
+ virtual FX_FLOAT GetItemLeftMargin() { return 0; }
+ virtual FX_FLOAT GetItemRightMargin() { return 0; }
+
+ void EnableWindow(FX_BOOL bEnable);
+ FX_BOOL IsEnabled();
+ virtual void SetCursor();
+
+ protected:
+ virtual void CreateChildWnd(const PWL_CREATEPARAM& cp);
+ virtual void RePosChildWnd();
+ void GetAppearanceStream(CFX_ByteTextBuf& sAppStream);
+ virtual void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream);
+ virtual void GetChildAppearanceStream(CFX_ByteTextBuf& sAppStream);
+
+ virtual void DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device);
+ virtual void DrawChildAppearance(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device);
+
+ virtual void OnCreate(PWL_CREATEPARAM& cp);
+ virtual void OnCreated();
+ virtual void OnDestroy();
+
+ virtual void OnSetFocus();
+ virtual void OnKillFocus();
+
+ virtual void OnEnabled();
+ virtual void OnDisabled();
+
+ void SetNotifyFlag(FX_BOOL bNotifying = TRUE) { m_bNotifying = bNotifying; };
+
+ FX_BOOL IsValid() const;
+ PWL_CREATEPARAM GetCreationParam() const;
+ FX_BOOL IsNotifying() const { return m_bNotifying; }
+
+ void InvalidateRectMove(const CPDF_Rect& rcOld, const CPDF_Rect& rcNew);
+
+ void PWLtoWnd(const CPDF_Point& point, int32_t& x, int32_t& y) const;
+ FX_RECT PWLtoWnd(const CPDF_Rect& rect) const;
+ FX_HWND GetAttachedHWnd() const;
+
+ FX_BOOL IsWndCaptureMouse(const CPWL_Wnd* pWnd) const;
+ FX_BOOL IsWndCaptureKeyboard(const CPWL_Wnd* pWnd) const;
+ const CPWL_Wnd* GetRootWnd() const;
+
+ FX_BOOL IsCTRLpressed(FX_DWORD nFlag) const;
+ FX_BOOL IsSHIFTpressed(FX_DWORD nFlag) const;
+ FX_BOOL IsALTpressed(FX_DWORD nFlag) const;
+ FX_BOOL IsINSERTpressed(FX_DWORD nFlag) const;
+
+ private:
+ void AddChild(CPWL_Wnd* pWnd);
+ void RemoveChild(CPWL_Wnd* pWnd);
+
+ void CreateScrollBar(const PWL_CREATEPARAM& cp);
+ void CreateVScrollBar(const PWL_CREATEPARAM& cp);
+
+ void AjustStyle();
+ void CreateMsgControl();
+ void DestroyMsgControl();
+
+ CPWL_MsgControl* GetMsgControl() const;
+
+ protected:
+ CFX_ArrayTemplate<CPWL_Wnd*> m_aChildren;
-private:
- PWL_CREATEPARAM m_sPrivateParam;
+ private:
+ PWL_CREATEPARAM m_sPrivateParam;
- CPWL_ScrollBar* m_pVScrollBar;
+ CPWL_ScrollBar* m_pVScrollBar;
- CPDF_Rect m_rcWindow;
- CPDF_Rect m_rcClip;
+ CPDF_Rect m_rcWindow;
+ CPDF_Rect m_rcClip;
- FX_BOOL m_bCreated;
- FX_BOOL m_bVisible;
- FX_BOOL m_bNotifying;
- FX_BOOL m_bEnabled;
+ FX_BOOL m_bCreated;
+ FX_BOOL m_bVisible;
+ FX_BOOL m_bNotifying;
+ FX_BOOL m_bEnabled;
};
#endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_WND_H_