diff options
author | Nico Weber <thakis@chromium.org> | 2015-08-04 12:19:10 -0700 |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2015-08-04 12:19:10 -0700 |
commit | b048f791a15f2da781a01eba5b09eb9d389f9c11 (patch) | |
tree | 6850a73c18bbc41eaf4b1fdc6b3c96646d45587b /fpdfsdk/include/formfiller | |
parent | c8eeed31f217d99a706b0cbf5e4ce0bcc12beb64 (diff) | |
download | pdfium-b048f791a15f2da781a01eba5b09eb9d389f9c11.tar.xz |
clang-format all pdfium code.
No behavior change.
Generated by:
find . -name '*.cpp' -o -name '*.h' | \
grep -E -v 'third_party|thirdparties|lpng_v163' | \
xargs ../../buildtools/mac/clang-format -i
See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion.
BUG=none
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1265503005 .
Diffstat (limited to 'fpdfsdk/include/formfiller')
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h | 70 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_CheckBox.h | 34 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_ComboBox.h | 103 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_FormFiller.h | 309 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_IFormFiller.h | 206 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_ListBox.h | 71 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_Notify.h | 93 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_PushButton.h | 22 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_RadioButton.h | 27 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_TextField.h | 103 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_Utils.h | 15 |
11 files changed, 601 insertions, 452 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 e5c65c2715..5be7198918 100644 --- a/fpdfsdk/include/formfiller/FFL_ComboBox.h +++ b/fpdfsdk/include/formfiller/FFL_ComboBox.h @@ -13,56 +13,63 @@ 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); - -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); - -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); + + 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); + + 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 fc858a8822..64c813671a 100644 --- a/fpdfsdk/include/formfiller/FFL_FormFiller.h +++ b/fpdfsdk/include/formfiller/FFL_FormFiller.h @@ -18,138 +18,187 @@ 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 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 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); - - 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 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 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); + + 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 e553723dc3..3acdb237d0 100644 --- a/fpdfsdk/include/formfiller/FFL_IFormFiller.h +++ b/fpdfsdk/include/formfiller/FFL_IFormFiller.h @@ -14,80 +14,142 @@ 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 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 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) ; - - 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); - -private: - using CFFL_Widget2Filler = std::map<CPDFSDK_Annot*, CFFL_FormFiller*>; - - void UnRegisterFormFiller(CPDFSDK_Annot* pAnnot); - - 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 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 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); + + 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); + + private: + using CFFL_Widget2Filler = std::map<CPDFSDK_Annot*, CFFL_FormFiller*>; + + void UnRegisterFormFiller(CPDFSDK_Annot* pAnnot); + + 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 961d4b7a79..ee9e81a18f 100644 --- a/fpdfsdk/include/formfiller/FFL_Notify.h +++ b/fpdfsdk/include/formfiller/FFL_Notify.h @@ -13,43 +13,62 @@ 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); - - 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); + + 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 10bd5c0e43..65da9257ac 100644 --- a/fpdfsdk/include/formfiller/FFL_TextField.h +++ b/fpdfsdk/include/formfiller/FFL_TextField.h @@ -9,61 +9,64 @@ #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); - -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); - -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); + + 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); + + 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_ |