diff options
author | Lei Zhang <thestig@chromium.org> | 2015-08-14 22:16:22 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-08-14 22:16:22 -0700 |
commit | 2b1a2d528469cda4e9f3e36d3c7a649e0d476480 (patch) | |
tree | 91eea8ae70b87c632a06fba52ea06c0842e30878 | |
parent | 62b2e912dc2a508972fbf01b25f7449c39ff1543 (diff) | |
download | pdfium-2b1a2d528469cda4e9f3e36d3c7a649e0d476480.tar.xz |
Merge to XFA: Use override in more classes in fpdfsdk/
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1287193005 .
(cherry picked from commit 0f6b51c0fdd14f5762bf3c7412ac59c825443cc3)
Review URL: https://codereview.chromium.org/1288393004 .
60 files changed, 1090 insertions, 1122 deletions
diff --git a/core/include/fxge/fx_font.h b/core/include/fxge/fx_font.h index e0c6e31542..ff664f9532 100644 --- a/core/include/fxge/fx_font.h +++ b/core/include/fxge/fx_font.h @@ -14,13 +14,13 @@ typedef struct FT_FaceRec_* FXFT_Face; typedef void* FXFT_Library; -class IFX_FontEncoding; -class CFX_PathData; -class CFX_SubstFont; +class CFontFileFaceInfo; class CFX_FaceCache; class CFX_FontMapper; +class CFX_PathData; +class CFX_SubstFont; class IFX_SystemFontInfo; -class CFontFileFaceInfo; + #define FXFONT_FIXED_PITCH 0x01 #define FXFONT_SERIF 0x02 #define FXFONT_SYMBOLIC 0x04 @@ -139,6 +139,7 @@ class CFX_Font { }; #define ENCODING_INTERNAL 0 #define ENCODING_UNICODE 1 + class IFX_FontEncoding { public: virtual ~IFX_FontEncoding() {} @@ -149,6 +150,7 @@ class IFX_FontEncoding { virtual FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const = 0; }; + IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont); #define FXFM_ENC_TAG(a, b, c, d) \ (((FX_DWORD)(a) << 24) | ((FX_DWORD)(b) << 16) | ((FX_DWORD)(c) << 8) | \ @@ -262,20 +264,26 @@ class CFX_FontMgr { FXFT_Library m_FTLibrary; FoxitFonts m_ExternalFonts[16]; }; + class IFX_FontEnumerator { public: - virtual ~IFX_FontEnumerator() {} - virtual void HitFont() = 0; virtual void Finish() = 0; + + protected: + virtual ~IFX_FontEnumerator() {} }; + class IFX_AdditionalFontEnum { public: - virtual ~IFX_AdditionalFontEnum() {} virtual int CountFiles() = 0; virtual IFX_FileStream* GetFontFile(int index) = 0; + + protected: + virtual ~IFX_AdditionalFontEnum() {} }; + class CFX_FontMapper { public: explicit CFX_FontMapper(CFX_FontMgr* mgr); @@ -487,11 +495,14 @@ FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, int anti_alias, FX_FLOAT retinaScaleX = 1.0f, FX_FLOAT retinaScaleY = 1.0f); + class IFX_GSUBTable { public: static IFX_GSUBTable* Create(CFX_Font* pFont); - virtual ~IFX_GSUBTable() {} virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; + + protected: + virtual ~IFX_GSUBTable() {} }; #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ diff --git a/fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h b/fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h index 7978150736..3e1331839e 100644 --- a/fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h +++ b/fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h @@ -19,7 +19,7 @@ class CBA_FontMap : public CPWL_FontMap { CPDF_Dictionary* pAnnotDict, IFX_SystemHandler* pSystemHandler); - virtual ~CBA_FontMap(); + ~CBA_FontMap() override; virtual void Initial(const FX_CHAR* fontname = NULL); diff --git a/fpdfsdk/include/formfiller/FFL_CheckBox.h b/fpdfsdk/include/formfiller/FFL_CheckBox.h index 0ac7170a16..27af16be5a 100644 --- a/fpdfsdk/include/formfiller/FFL_CheckBox.h +++ b/fpdfsdk/include/formfiller/FFL_CheckBox.h @@ -12,22 +12,21 @@ 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); + ~CFFL_CheckBox() override; + + // CFFL_Button + CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, + CPDFSDK_PageView* pPageView) override; + FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, + FX_UINT nKeyCode, + FX_UINT nFlags) override; + FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags) override; + FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + FX_UINT nFlags, + const CPDF_Point& point) override; + FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView) override; + void SaveData(CPDFSDK_PageView* pPageView) override; }; #endif // FPDFSDK_INCLUDE_FORMFILLER_FFL_CHECKBOX_H_ diff --git a/fpdfsdk/include/formfiller/FFL_FormFiller.h b/fpdfsdk/include/formfiller/FFL_FormFiller.h index 65e9beba97..a519a17646 100644 --- a/fpdfsdk/include/formfiller/FFL_FormFiller.h +++ b/fpdfsdk/include/formfiller/FFL_FormFiller.h @@ -161,33 +161,34 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { 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, + ~CFFL_Button() override; + + // CFFL_FormFiller + void OnMouseEnter(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot) override; + void OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) override; + FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + FX_UINT nFlags, + const CPDF_Point& point) override; + FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + FX_UINT nFlags, + const CPDF_Point& point) override; + FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + FX_UINT nFlags, + const CPDF_Point& point) override; + void OnDraw(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device, + FX_DWORD dwFlags) override; + void OnDrawDeactive(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); + FX_DWORD dwFlags) override; protected: FX_BOOL m_bMouseIn; diff --git a/fpdfsdk/include/formfiller/FFL_ListBox.h b/fpdfsdk/include/formfiller/FFL_ListBox.h index 2e26069e2c..01ad2218d0 100644 --- a/fpdfsdk/include/formfiller/FFL_ListBox.h +++ b/fpdfsdk/include/formfiller/FFL_ListBox.h @@ -16,30 +16,26 @@ 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); + ~CFFL_ListBox() override; + + // CFFL_FormFiller + PWL_CREATEPARAM GetCreateParam() override; + CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, + CPDFSDK_PageView* pPageView) override; + FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags) override; + FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView) override; + void SaveData(CPDFSDK_PageView* pPageView) override; + void GetActionData(CPDFSDK_PageView* pPageView, + CPDF_AAction::AActionType type, + PDFSDK_FieldAction& fa) override; + void SetActionData(CPDFSDK_PageView* pPageView, + CPDF_AAction::AActionType type, + const PDFSDK_FieldAction& fa) override; + void SaveState(CPDFSDK_PageView* pPageView) override; + void RestoreState(CPDFSDK_PageView* pPageView) override; + CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, + FX_BOOL bRestoreValue) override; + void OnKeyStroke(FX_BOOL bKeyDown, FX_DWORD nFlag) override; private: CBA_FontMap* m_pFontMap; diff --git a/fpdfsdk/include/formfiller/FFL_PushButton.h b/fpdfsdk/include/formfiller/FFL_PushButton.h index 5c4819400d..1bab968c88 100644 --- a/fpdfsdk/include/formfiller/FFL_PushButton.h +++ b/fpdfsdk/include/formfiller/FFL_PushButton.h @@ -12,17 +12,17 @@ class CFFL_PushButton : public CFFL_Button { public: CFFL_PushButton(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot); - virtual ~CFFL_PushButton(); + ~CFFL_PushButton() override; - 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); + // CFFL_Button + CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, + CPDFSDK_PageView* pPageView) override; + FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags) override; + void OnDraw(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device, + FX_DWORD dwFlags) override; }; #endif // FPDFSDK_INCLUDE_FORMFILLER_FFL_PUSHBUTTON_H_ diff --git a/fpdfsdk/include/formfiller/FFL_RadioButton.h b/fpdfsdk/include/formfiller/FFL_RadioButton.h index ba7bff4629..3a8280336a 100644 --- a/fpdfsdk/include/formfiller/FFL_RadioButton.h +++ b/fpdfsdk/include/formfiller/FFL_RadioButton.h @@ -12,20 +12,21 @@ class CFFL_RadioButton : public CFFL_Button { public: CFFL_RadioButton(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot); - virtual ~CFFL_RadioButton(); + ~CFFL_RadioButton() override; - 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); + // CFFL_Button + CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, + CPDFSDK_PageView* pPageView) override; + FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, + FX_UINT nKeyCode, + FX_UINT nFlags) override; + FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags) override; + FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + FX_UINT nFlags, + const CPDF_Point& point) override; + FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView) override; + void SaveData(CPDFSDK_PageView* pPageView) override; }; #endif // FPDFSDK_INCLUDE_FORMFILLER_FFL_RADIOBUTTON_H_ diff --git a/fpdfsdk/include/fsdk_annothandler.h b/fpdfsdk/include/fsdk_annothandler.h index b755e7ec3f..266c4589b0 100644 --- a/fpdfsdk/include/fsdk_annothandler.h +++ b/fpdfsdk/include/fsdk_annothandler.h @@ -23,7 +23,7 @@ class CPDF_Rect; class IPDFSDK_AnnotHandler { public: - virtual ~IPDFSDK_AnnotHandler(){}; + virtual ~IPDFSDK_AnnotHandler() {} virtual CFX_ByteString GetType() = 0; @@ -129,109 +129,89 @@ 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_BFAnnotHandler() override {} + + // IPDFSDK_AnnotHandler + CFX_ByteString GetType() override { return CFX_ByteString("Widget"); } + CFX_ByteString GetName() override { return CFX_ByteString("WidgetHandler"); } + FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override; + CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override; + CPDFSDK_Annot* NewAnnot(IXFA_Widget* hWidget, + CPDFSDK_PageView* pPage) override; + void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override; + void DeleteAnnot(CPDFSDK_Annot* pAnnot) override {} + CPDF_Rect GetViewBBox(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot) override; + FX_BOOL HitTest(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + const CPDF_Point& point) override; + void OnDraw(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device, + FX_DWORD dwFlags) override; + void OnDrawSleep(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device, + const CPDF_Rect& rcWindow, + FX_DWORD dwFlags) override {} + void OnCreate(CPDFSDK_Annot* pAnnot) override; + void OnLoad(CPDFSDK_Annot* pAnnot) override; + void OnDelete(CPDFSDK_Annot* pAnnot) override {} + void OnRelease(CPDFSDK_Annot* pAnnot) override {} + void OnMouseEnter(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + FX_DWORD nFlag) override; + void OnMouseExit(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + FX_DWORD nFlag) override; + FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + FX_DWORD nFlags, + const CPDF_Point& point) override; + FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + FX_DWORD nFlags, + const CPDF_Point& point) override; + FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, - const CPDF_Point& point); - - virtual void OnDraw(CPDFSDK_PageView* pPageView, + FX_DWORD nFlags, + const CPDF_Point& point) override; + FX_BOOL OnMouseMove(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) { + FX_DWORD nFlags, + const CPDF_Point& point) override; + FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + FX_DWORD nFlags, + short zDelta, + const CPDF_Point& point) override; + FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + FX_DWORD nFlags, + const CPDF_Point& point) override; + FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + FX_DWORD nFlags, + const CPDF_Point& point) override; + FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + FX_DWORD nFlags, + const CPDF_Point& point) override { 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) { + FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, + FX_DWORD nChar, + FX_DWORD nFlags) override; + FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; + FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override; + void OnDeSelected(CPDFSDK_Annot* pAnnot) override {} + void OnSelected(CPDFSDK_Annot* pAnnot) override {} + FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) override; + FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) override; + FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, + CPDFSDK_Annot* pNewAnnot) override { return TRUE; } @@ -360,7 +340,7 @@ class CPDFSDK_XFAAnnotHandler : public IPDFSDK_AnnotHandler { class CPDFSDK_AnnotHandlerMgr { public: // Destroy the handler - CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp); + explicit CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp); virtual ~CPDFSDK_AnnotHandlerMgr(); public: diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h index 96617c3f00..da57430397 100644 --- a/fpdfsdk/include/fsdk_baseform.h +++ b/fpdfsdk/include/fsdk_baseform.h @@ -63,6 +63,7 @@ typedef struct _PDFSDK_FieldAction { FX_BOOL bFieldFull; // in FX_BOOL bRC; // in[out] } PDFSDK_FieldAction; + class CPDFSDK_Widget : public CPDFSDK_BAAnnot { public: IXFA_Widget* GetMixXFAWidget(); @@ -87,26 +88,24 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot { CPDF_FormField* pFormField, CPDF_FormControl* pFormControl); - public: CPDFSDK_Widget(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView, CPDFSDK_InterForm* pInterForm); - virtual ~CPDFSDK_Widget(); + ~CPDFSDK_Widget() override; - virtual CFX_ByteString GetSubType() const; + // CPDFSDK_Annot + CFX_ByteString GetSubType() const override; + CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT) override; + FX_BOOL IsAppearanceValid() override; - virtual CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT); + int GetLayoutOrder() const override { return 2; } int GetFieldType() const; - // define layout order to 2. - virtual int GetLayoutOrder() const { return 2; } - virtual FX_BOOL IsAppearanceValid(); - /* - FIELDFLAG_READONLY - FIELDFLAG_REQUIRED - FIELDFLAG_NOEXPORT - */ + // Possible values from PDF 32000-1:2008, table 221. + // FIELDFLAG_READONLY + // FIELDFLAG_REQUIRED + // FIELDFLAG_NOEXPORT int GetFieldFlags() const; int GetRotate() const; diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h index f208c05dab..4057036560 100644 --- a/fpdfsdk/include/fsdk_define.h +++ b/fpdfsdk/include/fsdk_define.h @@ -50,16 +50,16 @@ class IFSDK_PAUSE_Adapter; class CPDF_CustomAccess final : public IFX_FileRead { public: CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess); - ~CPDF_CustomAccess() {} + ~CPDF_CustomAccess() override {} + + // IFX_FileRead + FX_FILESIZE GetSize() override { return m_FileAccess.m_FileLen; } + void Release() override { delete this; } + FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; 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]; diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h index 40ac50489d..c4879aa545 100644 --- a/fpdfsdk/include/fsdk_mgr.h +++ b/fpdfsdk/include/fsdk_mgr.h @@ -615,7 +615,7 @@ template <class TYPE> class CGW_ArrayTemplate : public CFX_ArrayTemplate<TYPE> { public: CGW_ArrayTemplate() {} - virtual ~CGW_ArrayTemplate() {} + ~CGW_ArrayTemplate() {} typedef int (*LP_COMPARE)(TYPE p1, TYPE p2); diff --git a/fpdfsdk/include/fsdk_rendercontext.h b/fpdfsdk/include/fsdk_rendercontext.h index 9d1dabd41c..16f8ff88cf 100644 --- a/fpdfsdk/include/fsdk_rendercontext.h +++ b/fpdfsdk/include/fsdk_rendercontext.h @@ -31,8 +31,10 @@ class CRenderContext { class IFSDK_PAUSE_Adapter : public IFX_Pause { public: - IFSDK_PAUSE_Adapter(IFSDK_PAUSE* IPause); - FX_BOOL NeedToPauseNow(); + explicit IFSDK_PAUSE_Adapter(IFSDK_PAUSE* IPause); + ~IFSDK_PAUSE_Adapter() override; + + FX_BOOL NeedToPauseNow() override; private: IFSDK_PAUSE* m_IPause; diff --git a/fpdfsdk/include/fxedit/fx_edit.h b/fpdfsdk/include/fxedit/fx_edit.h index bfe6a254ff..4f8b2fbd67 100644 --- a/fpdfsdk/include/fxedit/fx_edit.h +++ b/fpdfsdk/include/fxedit/fx_edit.h @@ -477,12 +477,11 @@ class IFX_Edit { FX_COLORREF color); protected: - ~IFX_Edit() {} + virtual ~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, @@ -503,6 +502,9 @@ class IFX_List_Notify { virtual void IOnSetScrollPosY(FX_FLOAT fy) = 0; // Invalidate the rectangle relative to the bounding box of edit. virtual void IOnInvalidateRect(CPDF_Rect* pRect) = 0; + + protected: + virtual ~IFX_List_Notify() {} }; class IFX_List { @@ -563,7 +565,7 @@ class IFX_List { virtual FX_BOOL OnChar(FX_WORD nChar, FX_BOOL bShift, FX_BOOL bCtrl) = 0; protected: - ~IFX_List() {} + virtual ~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 2cb7c99720..c7c17a4378 100644 --- a/fpdfsdk/include/fxedit/fxet_edit.h +++ b/fpdfsdk/include/fxedit/fxet_edit.h @@ -269,6 +269,7 @@ class CFX_Edit_Undo { class CFX_Edit_UndoItem : public IFX_Edit_UndoItem { public: CFX_Edit_UndoItem() : m_bFirst(TRUE), m_bLast(TRUE) {} + ~CFX_Edit_UndoItem() override {} CFX_WideString GetUndoTitle() override { return L""; } @@ -310,10 +311,11 @@ class CFXEU_InsertWord : public CFX_Edit_UndoItem { FX_WORD word, int32_t charset, const CPVT_WordProps* pWordProps); - virtual ~CFXEU_InsertWord(); + ~CFXEU_InsertWord() override; - void Redo(); - void Undo(); + // CFX_Edit_UndoItem + void Redo() override; + void Undo() override; private: CFX_Edit* m_pEdit; @@ -332,10 +334,11 @@ class CFXEU_InsertReturn : public CFX_Edit_UndoItem { const CPVT_WordPlace& wpNewPlace, const CPVT_SecProps* pSecProps, const CPVT_WordProps* pWordProps); - virtual ~CFXEU_InsertReturn(); + ~CFXEU_InsertReturn() override; - void Redo(); - void Undo(); + // CFX_Edit_UndoItem + void Redo() override; + void Undo() override; private: CFX_Edit* m_pEdit; @@ -355,10 +358,11 @@ class CFXEU_Backspace : public CFX_Edit_UndoItem { int32_t charset, const CPVT_SecProps& SecProps, const CPVT_WordProps& WordProps); - virtual ~CFXEU_Backspace(); + ~CFXEU_Backspace() override; - void Redo(); - void Undo(); + // CFX_Edit_UndoItem + void Redo() override; + void Undo() override; private: CFX_Edit* m_pEdit; @@ -381,10 +385,11 @@ class CFXEU_Delete : public CFX_Edit_UndoItem { const CPVT_SecProps& SecProps, const CPVT_WordProps& WordProps, FX_BOOL bSecEnd); - virtual ~CFXEU_Delete(); + ~CFXEU_Delete() override; - void Redo(); - void Undo(); + // CFX_Edit_UndoItem + void Redo() override; + void Undo() override; private: CFX_Edit* m_pEdit; @@ -403,10 +408,11 @@ class CFXEU_Clear : public CFX_Edit_UndoItem { CFXEU_Clear(CFX_Edit* pEdit, const CPVT_WordRange& wrSel, const CFX_WideString& swText); - virtual ~CFXEU_Clear(); + ~CFXEU_Clear() override; - void Redo(); - void Undo(); + // CFX_Edit_UndoItem + void Redo() override; + void Undo() override; private: CFX_Edit* m_pEdit; @@ -425,10 +431,11 @@ class CFXEU_ClearRich : public CFX_Edit_UndoItem { int32_t charset, const CPVT_SecProps& SecProps, const CPVT_WordProps& WordProps); - virtual ~CFXEU_ClearRich(); + ~CFXEU_ClearRich() override; - void Redo(); - void Undo(); + // CFX_Edit_UndoItem + void Redo() override; + void Undo() override; private: CFX_Edit* m_pEdit; @@ -451,10 +458,11 @@ class CFXEU_InsertText : public CFX_Edit_UndoItem { int32_t charset, const CPVT_SecProps* pSecProps, const CPVT_WordProps* pWordProps); - virtual ~CFXEU_InsertText(); + ~CFXEU_InsertText() override; - void Redo(); - void Undo(); + // CFX_Edit_UndoItem + void Redo() override; + void Undo() override; private: CFX_Edit* m_pEdit; @@ -477,10 +485,11 @@ class CFXEU_SetSecProps : public CFX_Edit_UndoItem { const CPVT_SecProps& newsecprops, const CPVT_WordProps& newwordprops, const CPVT_WordRange& range); - virtual ~CFXEU_SetSecProps(); + ~CFXEU_SetSecProps() override; - void Redo(); - void Undo(); + // CFX_Edit_UndoItem + void Redo() override; + void Undo() override; private: CFX_Edit* m_pEdit; @@ -502,10 +511,11 @@ class CFXEU_SetWordProps : public CFX_Edit_UndoItem { const CPVT_WordProps& oldprops, const CPVT_WordProps& newprops, const CPVT_WordRange& range); - virtual ~CFXEU_SetWordProps(); + ~CFXEU_SetWordProps() override; - void Redo(); - void Undo(); + // CFX_Edit_UndoItem + void Redo() override; + void Undo() override; private: CFX_Edit* m_pEdit; @@ -533,79 +543,125 @@ class CFX_Edit : public IFX_Edit { 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); - + ~CFX_Edit() override; + + // IFX_Edit + void SetFontMap(IFX_Edit_FontMap* pFontMap) override; + void SetVTProvider(IPDF_VariableText_Provider* pProvider) override; + void SetNotify(IFX_Edit_Notify* pNotify) override; + void SetOprNotify(IFX_Edit_OprNotify* pOprNotify) override; + IFX_Edit_Iterator* GetIterator() override; + IPDF_VariableText* GetVariableText() override; + IFX_Edit_FontMap* GetFontMap() override; + void Initialize() override; + void SetPlateRect(const CPDF_Rect& rect, FX_BOOL bPaint = TRUE) override; + void SetScrollPos(const CPDF_Point& point) override; + void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) override; + void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) override; + void SetPasswordChar(FX_WORD wSubWord = '*', FX_BOOL bPaint = TRUE) override; + void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE) override; + void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE) override; + void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE) override; + void SetHorzScale(int32_t nHorzScale = 100, FX_BOOL bPaint = TRUE) override; + void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE) override; + void SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE) override; + void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override; + void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override; + void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override; + void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) override; + void SetTextOverflow(FX_BOOL bAllowed = FALSE, + FX_BOOL bPaint = TRUE) override; + FX_BOOL IsRichText() const override; + void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE) override; + FX_BOOL SetRichFontSize(FX_FLOAT fFontSize) override; + FX_BOOL SetRichFontIndex(int32_t nFontIndex) override; + FX_BOOL SetRichTextColor(FX_COLORREF dwColor) override; + FX_BOOL SetRichTextScript(int32_t nScriptType) override; + FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE) override; + FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE) override; + FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE) override; + FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE) override; + FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace) override; + FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100) override; + FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading) override; + FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent) override; + FX_BOOL SetRichTextAlignment(int32_t nAlignment) override; + void OnMouseDown(const CPDF_Point& point, + FX_BOOL bShift, + FX_BOOL bCtrl) override; + void OnMouseMove(const CPDF_Point& point, + FX_BOOL bShift, + FX_BOOL bCtrl) override; + void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) override; + void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) override; + void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) override; + void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) override; + void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) override; + void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) override; void SetText(const FX_WCHAR* text, int32_t charset = DEFAULT_CHARSET, const CPVT_SecProps* pSecProps = NULL, - const CPVT_WordProps* pWordProps = NULL); + const CPVT_WordProps* pWordProps = NULL) override; FX_BOOL InsertWord(FX_WORD word, int32_t charset = DEFAULT_CHARSET, - const CPVT_WordProps* pWordProps = NULL); + const CPVT_WordProps* pWordProps = NULL) override; 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(); + const CPVT_WordProps* pWordProps = NULL) override; + FX_BOOL Backspace() override; + FX_BOOL Delete() override; + FX_BOOL Clear() override; 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(); + const CPVT_WordProps* pWordProps = NULL) override; + FX_BOOL Redo() override; + FX_BOOL Undo() override; + int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const override; + CPVT_WordPlace WordIndexToWordPlace(int32_t index) const override; + CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace& place) const override; + CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const override; + CPVT_WordPlace GetSectionBeginPlace( + const CPVT_WordPlace& place) const override; + CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const override; + CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const override; + int32_t GetCaret() const override; + CPVT_WordPlace GetCaretWordPlace() const override; + CFX_WideString GetSelText() const override; + CFX_WideString GetText() const override; + FX_FLOAT GetFontSize() const override; + FX_WORD GetPasswordChar() const override; + CPDF_Point GetScrollPos() const override; + int32_t GetCharArray() const override; + CPDF_Rect GetPlateRect() const override; + CPDF_Rect GetContentRect() const override; + CFX_WideString GetRangeText(const CPVT_WordRange& range) const override; + int32_t GetHorzScale() const override; + FX_FLOAT GetCharSpace() const override; + int32_t GetTotalWords() const override; + void SetSel(int32_t nStartChar, int32_t nEndChar) override; + void GetSel(int32_t& nStartChar, int32_t& nEndChar) const override; + void SelectAll() override; + void SelectNone() override; + FX_BOOL IsSelected() const override; + void Paint() override; + void EnableNotify(FX_BOOL bNotify) override; + void EnableRefresh(FX_BOOL bRefresh) override; + void RefreshWordRange(const CPVT_WordRange& wr) override; + void SetCaret(int32_t nPos) override; + CPVT_WordRange GetWholeWordRange() const override; + CPVT_WordRange GetSelectWordRange() const override; + void EnableUndo(FX_BOOL bUndo) override; + void EnableOprNotify(FX_BOOL bNotify) override; + FX_BOOL IsTextFull() const override; + FX_BOOL IsTextOverflow() const; + FX_BOOL CanUndo() const override; + FX_BOOL CanRedo() const override; + FX_BOOL IsModified() const override; + CPVT_WordRange GetVisibleWordRange() const override; + void AddUndoItem(IFX_Edit_UndoItem* pUndoItem) override; + + FX_BOOL Empty(); + CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place, const FX_WCHAR* text, int32_t charset, @@ -613,50 +669,19 @@ class CFX_Edit : public IFX_Edit { 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, @@ -705,40 +730,25 @@ class CFX_Edit : public IFX_Edit { 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, @@ -779,22 +789,22 @@ class CFX_Edit : public IFX_Edit { 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; + ~CFX_Edit_Iterator() override; + + // IFX_Edit_Iterator + FX_BOOL NextWord() override; + FX_BOOL NextLine() override; + FX_BOOL NextSection() override; + FX_BOOL PrevWord() override; + FX_BOOL PrevLine() override; + FX_BOOL PrevSection() override; + FX_BOOL GetWord(CPVT_Word& word) const override; + FX_BOOL GetLine(CPVT_Line& line) const override; + FX_BOOL GetSection(CPVT_Section& section) const override; + void SetAt(int32_t nWordIndex) override; + void SetAt(const CPVT_WordPlace& place) override; + const CPVT_WordPlace& GetAt() const override; + IFX_Edit* GetEdit() const override; private: CFX_Edit* m_pEdit; diff --git a/fpdfsdk/include/fxedit/fxet_list.h b/fpdfsdk/include/fxedit/fxet_list.h index 8c5584a118..f032078a1c 100644 --- a/fpdfsdk/include/fxedit/fxet_list.h +++ b/fpdfsdk/include/fxedit/fxet_list.h @@ -54,6 +54,8 @@ class CLST_Rect : public CPDF_Rect { bottom = rect.bottom; } + ~CLST_Rect() {} + void Default() { left = top = right = bottom = 0.0f; } const CLST_Rect operator=(const CPDF_Rect& rect) { @@ -285,45 +287,47 @@ class CPLST_Select { 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); + ~CFX_ListCtrl() override; + + // CFX_List + void SetNotify(IFX_List_Notify* pNotify) override; + void OnMouseDown(const CPDF_Point& point, + FX_BOOL bShift, + FX_BOOL bCtrl) override; + void OnMouseMove(const CPDF_Point& point, + FX_BOOL bShift, + FX_BOOL bCtrl) override; + void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) override; + void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) override; + void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) override; + void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) override; + void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) override; + void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) override; + void OnVK(int32_t nItemIndex, FX_BOOL bShift, FX_BOOL bCtrl) override; + FX_BOOL OnChar(FX_WORD nChar, FX_BOOL bShift, FX_BOOL bCtrl) override; + void SetPlateRect(const CPDF_Rect& rect) override; + void SetScrollPos(const CPDF_Point& point) override; + void ScrollToListItem(int32_t nItemIndex) override; + CPDF_Rect GetItemRect(int32_t nIndex) const override; + int32_t GetCaret() const override { return m_nCaretIndex; } + int32_t GetSelect() const override { return m_nSelItem; } + int32_t GetTopItem() const override; + CPDF_Rect GetContentRect() const override; + int32_t GetItemIndex(const CPDF_Point& point) const override; + void AddString(const FX_WCHAR* string) override; + void SetTopItem(int32_t nIndex) override; + void Select(int32_t nItemIndex) override; + void SetCaret(int32_t nItemIndex) override; + void Empty() override; + void Cancel() override; + CFX_WideString GetText() const override; + void ReArrange(int32_t nItemIndex) override; 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); @@ -332,7 +336,6 @@ class CFX_ListCtrl : public CFX_List { 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; diff --git a/fpdfsdk/include/javascript/Consts.h b/fpdfsdk/include/javascript/Consts.h index c0abe4c7d4..79f85f8002 100644 --- a/fpdfsdk/include/javascript/Consts.h +++ b/fpdfsdk/include/javascript/Consts.h @@ -13,8 +13,8 @@ class CJS_Border : public CJS_Object { public: - CJS_Border(JSFXObject pObject) : CJS_Object(pObject){}; - virtual ~CJS_Border(void){}; + explicit CJS_Border(JSFXObject pObject) : CJS_Object(pObject) {} + ~CJS_Border() override {} DECLARE_JS_CLASS_CONST(); }; @@ -23,8 +23,8 @@ class CJS_Border : public CJS_Object { class CJS_Display : public CJS_Object { public: - CJS_Display(JSFXObject pObject) : CJS_Object(pObject){}; - virtual ~CJS_Display(void){}; + explicit CJS_Display(JSFXObject pObject) : CJS_Object(pObject) {} + ~CJS_Display() override {} DECLARE_JS_CLASS_CONST(); }; @@ -33,8 +33,8 @@ class CJS_Display : public CJS_Object { class CJS_Font : public CJS_Object { public: - CJS_Font(JSFXObject pObject) : CJS_Object(pObject){}; - virtual ~CJS_Font(void){}; + explicit CJS_Font(JSFXObject pObject) : CJS_Object(pObject) {} + ~CJS_Font() override {} DECLARE_JS_CLASS_CONST(); }; @@ -43,8 +43,8 @@ class CJS_Font : public CJS_Object { class CJS_Highlight : public CJS_Object { public: - CJS_Highlight(JSFXObject pObject) : CJS_Object(pObject){}; - virtual ~CJS_Highlight(void){}; + explicit CJS_Highlight(JSFXObject pObject) : CJS_Object(pObject) {} + ~CJS_Highlight() override {} DECLARE_JS_CLASS_CONST(); }; @@ -53,8 +53,8 @@ class CJS_Highlight : public CJS_Object { class CJS_Position : public CJS_Object { public: - CJS_Position(JSFXObject pObject) : CJS_Object(pObject){}; - virtual ~CJS_Position(void){}; + explicit CJS_Position(JSFXObject pObject) : CJS_Object(pObject) {} + ~CJS_Position() override {} DECLARE_JS_CLASS_CONST(); }; @@ -63,8 +63,8 @@ class CJS_Position : public CJS_Object { class CJS_ScaleHow : public CJS_Object { public: - CJS_ScaleHow(JSFXObject pObject) : CJS_Object(pObject){}; - virtual ~CJS_ScaleHow(void){}; + explicit CJS_ScaleHow(JSFXObject pObject) : CJS_Object(pObject) {} + ~CJS_ScaleHow() override {} DECLARE_JS_CLASS_CONST(); }; @@ -73,8 +73,8 @@ class CJS_ScaleHow : public CJS_Object { class CJS_ScaleWhen : public CJS_Object { public: - CJS_ScaleWhen(JSFXObject pObject) : CJS_Object(pObject){}; - virtual ~CJS_ScaleWhen(void){}; + explicit CJS_ScaleWhen(JSFXObject pObject) : CJS_Object(pObject) {} + ~CJS_ScaleWhen() override {} DECLARE_JS_CLASS_CONST(); }; @@ -83,8 +83,8 @@ class CJS_ScaleWhen : public CJS_Object { class CJS_Style : public CJS_Object { public: - CJS_Style(JSFXObject pObject) : CJS_Object(pObject){}; - virtual ~CJS_Style(void){}; + explicit CJS_Style(JSFXObject pObject) : CJS_Object(pObject) {} + ~CJS_Style() override {} DECLARE_JS_CLASS_CONST(); }; @@ -93,8 +93,8 @@ class CJS_Style : public CJS_Object { class CJS_Zoomtype : public CJS_Object { public: - CJS_Zoomtype(JSFXObject pObject) : CJS_Object(pObject){}; - virtual ~CJS_Zoomtype(void){}; + explicit CJS_Zoomtype(JSFXObject pObject) : CJS_Object(pObject) {} + ~CJS_Zoomtype() override {} DECLARE_JS_CLASS_CONST(); }; diff --git a/fpdfsdk/include/javascript/Document.h b/fpdfsdk/include/javascript/Document.h index 52a1981b5e..3b21ba6fc1 100644 --- a/fpdfsdk/include/javascript/Document.h +++ b/fpdfsdk/include/javascript/Document.h @@ -12,7 +12,7 @@ class PrintParamsObj : public CJS_EmbedObj { public: PrintParamsObj(CJS_Object* pJSObject); - virtual ~PrintParamsObj() {} + ~PrintParamsObj() override {} public: FX_BOOL bUI; @@ -28,7 +28,7 @@ class PrintParamsObj : public CJS_EmbedObj { class CJS_PrintParamsObj : public CJS_Object { public: CJS_PrintParamsObj(JSFXObject pObject) : CJS_Object(pObject) {} - virtual ~CJS_PrintParamsObj() {} + ~CJS_PrintParamsObj() override {} DECLARE_JS_CLASS(CJS_PrintParamsObj); }; @@ -70,7 +70,7 @@ struct CJS_AnnotObj; class Document : public CJS_EmbedObj { public: Document(CJS_Object* pJSObject); - virtual ~Document(); + ~Document() override; public: FX_BOOL ADBE(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); @@ -323,10 +323,11 @@ class Document : public CJS_EmbedObj { class CJS_Document : public CJS_Object { public: - CJS_Document(JSFXObject pObject) : CJS_Object(pObject){}; - virtual ~CJS_Document(){}; + explicit CJS_Document(JSFXObject pObject) : CJS_Object(pObject) {} + ~CJS_Document() override {} - virtual FX_BOOL InitInstance(IFXJS_Context* cc); + // CJS_Object + FX_BOOL InitInstance(IFXJS_Context* cc) override; DECLARE_JS_CLASS(CJS_Document); diff --git a/fpdfsdk/include/javascript/Field.h b/fpdfsdk/include/javascript/Field.h index afbf783bf2..ca37ae57bd 100644 --- a/fpdfsdk/include/javascript/Field.h +++ b/fpdfsdk/include/javascript/Field.h @@ -89,7 +89,7 @@ struct CJS_DelayData { class Field : public CJS_EmbedObj { public: Field(CJS_Object* pJSObject); - virtual ~Field(void); + ~Field() override; FX_BOOL alignment(IFXJS_Context* cc, CJS_PropValue& vp, @@ -533,10 +533,10 @@ class Field : public CJS_EmbedObj { class CJS_Field : public CJS_Object { public: - CJS_Field(JSFXObject pObject) : CJS_Object(pObject){}; - virtual ~CJS_Field(void){}; + CJS_Field(JSFXObject pObject) : CJS_Object(pObject) {} + ~CJS_Field(void) override {} - virtual FX_BOOL InitInstance(IFXJS_Context* cc); + FX_BOOL InitInstance(IFXJS_Context* cc) override; DECLARE_JS_CLASS(CJS_Field); diff --git a/fpdfsdk/include/javascript/IJavaScript.h b/fpdfsdk/include/javascript/IJavaScript.h index d2cbfb1dd8..9c232b01fb 100644 --- a/fpdfsdk/include/javascript/IJavaScript.h +++ b/fpdfsdk/include/javascript/IJavaScript.h @@ -18,7 +18,6 @@ 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, @@ -129,6 +128,9 @@ class IFXJS_Context { virtual void OnExternal_Exec() = 0; virtual void EnableMessageBox(FX_BOOL bEnable) = 0; + + protected: + virtual ~IFXJS_Context() {} }; class IFXJS_Runtime { @@ -147,7 +149,7 @@ class IFXJS_Runtime { FXJSE_HVALUE hValue) = 0; protected: - ~IFXJS_Runtime() {} + virtual ~IFXJS_Runtime() {} }; class CPDFDoc_Environment; diff --git a/fpdfsdk/include/javascript/Icon.h b/fpdfsdk/include/javascript/Icon.h index 0b549ec613..6d2f6e4645 100644 --- a/fpdfsdk/include/javascript/Icon.h +++ b/fpdfsdk/include/javascript/Icon.h @@ -12,7 +12,8 @@ class Icon : public CJS_EmbedObj { public: Icon(CJS_Object* pJSObject); - virtual ~Icon(); + ~Icon() override; + FX_BOOL name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); void SetStream(CPDF_Stream* pIconStream); CPDF_Stream* GetStream(); @@ -26,8 +27,8 @@ class Icon : public CJS_EmbedObj { class CJS_Icon : public CJS_Object { public: - CJS_Icon(JSFXObject pObject) : CJS_Object(pObject){}; - virtual ~CJS_Icon(){}; + CJS_Icon(JSFXObject pObject) : CJS_Object(pObject) {} + ~CJS_Icon() override {} public: DECLARE_JS_CLASS(CJS_Icon); diff --git a/fpdfsdk/include/javascript/JS_Context.h b/fpdfsdk/include/javascript/JS_Context.h index f61f37cdc6..a716bc2ccb 100644 --- a/fpdfsdk/include/javascript/JS_Context.h +++ b/fpdfsdk/include/javascript/JS_Context.h @@ -17,121 +17,112 @@ class CJS_Runtime; class CJS_Context : public IFXJS_Context { public: CJS_Context(CJS_Runtime* pRuntime); - virtual ~CJS_Context(); + ~CJS_Context() override; + + // IFXJS_Context + FX_BOOL Compile(const CFX_WideString& script, CFX_WideString& info) override; + FX_BOOL RunScript(const CFX_WideString& script, + CFX_WideString& info) override; + void OnApp_Init() override; + void OnDoc_Open(CPDFSDK_Document* pDoc, + const CFX_WideString& strTargetName) override; + void OnDoc_WillPrint(CPDFSDK_Document* pDoc) override; + void OnDoc_DidPrint(CPDFSDK_Document* pDoc) override; + void OnDoc_WillSave(CPDFSDK_Document* pDoc) override; + void OnDoc_DidSave(CPDFSDK_Document* pDoc) override; + void OnDoc_WillClose(CPDFSDK_Document* pDoc) override; + void OnPage_Open(CPDFSDK_Document* pTarget) override; + void OnPage_Close(CPDFSDK_Document* pTarget) override; + void OnPage_InView(CPDFSDK_Document* pTarget) override; + void OnPage_OutView(CPDFSDK_Document* pTarget) override; + void OnField_MouseDown(FX_BOOL bModifier, + FX_BOOL bShift, + CPDF_FormField* pTarget) override; + void OnField_MouseEnter(FX_BOOL bModifier, + FX_BOOL bShift, + CPDF_FormField* pTarget) override; + void OnField_MouseExit(FX_BOOL bModifier, + FX_BOOL bShift, + CPDF_FormField* pTarget) override; + void OnField_MouseUp(FX_BOOL bModifier, + FX_BOOL bShift, + CPDF_FormField* pTarget) override; + void OnField_Focus(FX_BOOL bModifier, + FX_BOOL bShift, + CPDF_FormField* pTarget, + const CFX_WideString& Value) override; + void OnField_Blur(FX_BOOL bModifier, + FX_BOOL bShift, + CPDF_FormField* pTarget, + const CFX_WideString& Value) override; + void OnField_Calculate(CPDF_FormField* pSource, + CPDF_FormField* pTarget, + CFX_WideString& Value, + FX_BOOL& bRc) override; + void OnField_Format(CPDF_FormField* pTarget, + CFX_WideString& Value, + FX_BOOL bWillCommit) override; + 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) override; + 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) override; + void OnScreen_Focus(FX_BOOL bModifier, + FX_BOOL bShift, + CPDFSDK_Annot* pScreen) override; + void OnScreen_Blur(FX_BOOL bModifier, + FX_BOOL bShift, + CPDFSDK_Annot* pScreen) override; + void OnScreen_Open(FX_BOOL bModifier, + FX_BOOL bShift, + CPDFSDK_Annot* pScreen) override; + void OnScreen_Close(FX_BOOL bModifier, + FX_BOOL bShift, + CPDFSDK_Annot* pScreen) override; + void OnScreen_MouseDown(FX_BOOL bModifier, + FX_BOOL bShift, + CPDFSDK_Annot* pScreen) override; + void OnScreen_MouseUp(FX_BOOL bModifier, + FX_BOOL bShift, + CPDFSDK_Annot* pScreen) override; + void OnScreen_MouseEnter(FX_BOOL bModifier, + FX_BOOL bShift, + CPDFSDK_Annot* pScreen) override; + void OnScreen_MouseExit(FX_BOOL bModifier, + FX_BOOL bShift, + CPDFSDK_Annot* pScreen) override; + void OnScreen_InView(FX_BOOL bModifier, + FX_BOOL bShift, + CPDFSDK_Annot* pScreen) override; + void OnScreen_OutView(FX_BOOL bModifier, + FX_BOOL bShift, + CPDFSDK_Annot* pScreen) override; + void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) override; + void OnLink_MouseUp(CPDFSDK_Document* pTarget) override; + void OnMenu_Exec(CPDFSDK_Document* pTarget, + const CFX_WideString& strTargetName) override; + void OnBatchExec(CPDFSDK_Document* pTarget) override; + void OnConsole_Exec() override; + void OnExternal_Exec() override; + void EnableMessageBox(FX_BOOL bEnable) override { m_bMsgBoxEnable = bEnable; } - 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; } @@ -143,7 +134,6 @@ class CJS_Context : public IFXJS_Context { private: CJS_Runtime* m_pRuntime; CJS_EventHandler* m_pEventHandler; - FX_BOOL m_bBusy; FX_BOOL m_bMsgBoxEnable; }; diff --git a/fpdfsdk/include/javascript/JS_Object.h b/fpdfsdk/include/javascript/JS_Object.h index adcedb837c..9fd7bff3d4 100644 --- a/fpdfsdk/include/javascript/JS_Object.h +++ b/fpdfsdk/include/javascript/JS_Object.h @@ -49,7 +49,7 @@ class CJS_EmbedObj { class CJS_Object { public: explicit CJS_Object(JSFXObject pObject); - virtual ~CJS_Object(void); + virtual ~CJS_Object(); void MakeWeak(); void Dispose(); diff --git a/fpdfsdk/include/javascript/JS_Runtime.h b/fpdfsdk/include/javascript/JS_Runtime.h index 1e9f3a97ac..2e397ea1ef 100644 --- a/fpdfsdk/include/javascript/JS_Runtime.h +++ b/fpdfsdk/include/javascript/JS_Runtime.h @@ -31,14 +31,14 @@ class CJS_FieldEvent { 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 void SetReaderDocument(CPDFSDK_Document* pReaderDoc); - virtual CPDFSDK_Document* GetReaderDocument() { return m_pDocument; } + ~CJS_Runtime() override; + + // IFXJS_Runtime + IFXJS_Context* NewContext() override; + void ReleaseContext(IFXJS_Context* pContext) override; + IFXJS_Context* GetCurrentContext() override; + void SetReaderDocument(CPDFSDK_Document* pReaderDoc) override; + CPDFSDK_Document* GetReaderDocument() override { return m_pDocument; } CPDFDoc_Environment* GetReaderApp() { return m_pApp; } diff --git a/fpdfsdk/include/javascript/PublicMethods.h b/fpdfsdk/include/javascript/PublicMethods.h index c5d5ea6d46..96c5ea5ad0 100644 --- a/fpdfsdk/include/javascript/PublicMethods.h +++ b/fpdfsdk/include/javascript/PublicMethods.h @@ -11,8 +11,8 @@ class CJS_PublicMethods : public CJS_Object { public: - CJS_PublicMethods(JSFXObject pObject) : CJS_Object(pObject){}; - virtual ~CJS_PublicMethods(void){}; + CJS_PublicMethods(JSFXObject pObject) : CJS_Object(pObject) {} + ~CJS_PublicMethods() override {} public: static FX_BOOL AFNumber_Format(IFXJS_Context* cc, diff --git a/fpdfsdk/include/javascript/app.h b/fpdfsdk/include/javascript/app.h index b13121323b..995c2605df 100644 --- a/fpdfsdk/include/javascript/app.h +++ b/fpdfsdk/include/javascript/app.h @@ -18,7 +18,7 @@ class CJS_Timer; class TimerObj : public CJS_EmbedObj { public: TimerObj(CJS_Object* pJSObject); - virtual ~TimerObj(); + ~TimerObj() override; public: void SetTimer(CJS_Timer* pTimer); @@ -31,7 +31,7 @@ class TimerObj : public CJS_EmbedObj { class CJS_TimerObj : public CJS_Object { public: CJS_TimerObj(JSFXObject pObject) : CJS_Object(pObject) {} - virtual ~CJS_TimerObj() {} + ~CJS_TimerObj() override {} DECLARE_JS_CLASS(CJS_TimerObj); }; @@ -39,7 +39,7 @@ class CJS_TimerObj : public CJS_Object { class app : public CJS_EmbedObj { public: app(CJS_Object* pJSObject); - virtual ~app(); + ~app() override; public: FX_BOOL activeDocs(IFXJS_Context* cc, @@ -160,24 +160,22 @@ class app : public CJS_EmbedObj { CJS_Value& vRet, CFX_WideString& sError); - private: - void TimerProc(CJS_Timer* pTimer); - void RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript); - - public: static CFX_WideString SysPathToPDFPath(const CFX_WideString& sOldPath); private: + // CJS_EmbedObj + void TimerProc(CJS_Timer* pTimer) override; + void RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript); + bool m_bCalculate; bool m_bRuntimeHighLight; - CFX_ArrayTemplate<CJS_Timer*> m_aTimer; }; class CJS_App : public CJS_Object { public: - CJS_App(JSFXObject pObject) : CJS_Object(pObject){}; - virtual ~CJS_App(void){}; + explicit CJS_App(JSFXObject pObject) : CJS_Object(pObject) {} + ~CJS_App() override {} DECLARE_JS_CLASS(CJS_App); diff --git a/fpdfsdk/include/javascript/color.h b/fpdfsdk/include/javascript/color.h index 45704efa80..cabd770ee8 100644 --- a/fpdfsdk/include/javascript/color.h +++ b/fpdfsdk/include/javascript/color.h @@ -13,7 +13,7 @@ class color : public CJS_EmbedObj { public: color(CJS_Object* pJSObject); - virtual ~color(void); + ~color() override; FX_BOOL black(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); FX_BOOL blue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); @@ -60,8 +60,8 @@ class color : public CJS_EmbedObj { class CJS_Color : public CJS_Object { public: - CJS_Color(JSFXObject pObject) : CJS_Object(pObject){}; - virtual ~CJS_Color(void){}; + CJS_Color(JSFXObject pObject) : CJS_Object(pObject) {} + ~CJS_Color() override {} DECLARE_JS_CLASS(CJS_Color); diff --git a/fpdfsdk/include/javascript/console.h b/fpdfsdk/include/javascript/console.h index a04d87b007..e001695ebf 100644 --- a/fpdfsdk/include/javascript/console.h +++ b/fpdfsdk/include/javascript/console.h @@ -12,7 +12,7 @@ class console : public CJS_EmbedObj { public: console(CJS_Object* pJSObject); - virtual ~console(void); + ~console() override; public: FX_BOOL clear(IFXJS_Context* cc, @@ -35,8 +35,8 @@ class console : public CJS_EmbedObj { class CJS_Console : public CJS_Object { public: - CJS_Console(JSFXObject pObject) : CJS_Object(pObject){}; - virtual ~CJS_Console(void){}; + CJS_Console(JSFXObject pObject) : CJS_Object(pObject) {} + ~CJS_Console() override {} DECLARE_JS_CLASS(CJS_Console); diff --git a/fpdfsdk/include/javascript/event.h b/fpdfsdk/include/javascript/event.h index c7c899e69d..e48a659fc7 100644 --- a/fpdfsdk/include/javascript/event.h +++ b/fpdfsdk/include/javascript/event.h @@ -12,7 +12,7 @@ class event : public CJS_EmbedObj { public: event(CJS_Object* pJSObject); - virtual ~event(void); + ~event() override; public: FX_BOOL change(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); @@ -59,8 +59,8 @@ class event : public CJS_EmbedObj { class CJS_Event : public CJS_Object { public: - CJS_Event(JSFXObject pObject) : CJS_Object(pObject){}; - virtual ~CJS_Event(void){}; + CJS_Event(JSFXObject pObject) : CJS_Object(pObject) {} + ~CJS_Event() override {} DECLARE_JS_CLASS(CJS_Event); diff --git a/fpdfsdk/include/javascript/global.h b/fpdfsdk/include/javascript/global.h index 303ac76a3e..369956749b 100644 --- a/fpdfsdk/include/javascript/global.h +++ b/fpdfsdk/include/javascript/global.h @@ -36,7 +36,7 @@ struct js_global_data { class global_alternate : public CJS_EmbedObj { public: global_alternate(CJS_Object* pJSObject); - virtual ~global_alternate(); + ~global_alternate() override; public: FX_BOOL setPersistent(IFXJS_Context* cc, @@ -81,10 +81,11 @@ class global_alternate : public CJS_EmbedObj { class CJS_Global : public CJS_Object { public: - CJS_Global(JSFXObject pObject) : CJS_Object(pObject){}; - virtual ~CJS_Global(void){}; + explicit CJS_Global(JSFXObject pObject) : CJS_Object(pObject) {} + ~CJS_Global() override {} - virtual FX_BOOL InitInstance(IFXJS_Context* cc); + // CJS_Object + FX_BOOL InitInstance(IFXJS_Context* cc) override; DECLARE_SPECIAL_JS_CLASS(CJS_Global); diff --git a/fpdfsdk/include/javascript/report.h b/fpdfsdk/include/javascript/report.h index a9004fd46a..52be2f36e2 100644 --- a/fpdfsdk/include/javascript/report.h +++ b/fpdfsdk/include/javascript/report.h @@ -12,7 +12,7 @@ class Report : public CJS_EmbedObj { public: Report(CJS_Object* pJSObject); - virtual ~Report(); + ~Report() override; public: FX_BOOL save(IFXJS_Context* cc, @@ -27,8 +27,8 @@ class Report : public CJS_EmbedObj { class CJS_Report : public CJS_Object { public: - CJS_Report(JSFXObject pObject) : CJS_Object(pObject){}; - virtual ~CJS_Report(){}; + CJS_Report(JSFXObject pObject) : CJS_Object(pObject) {} + ~CJS_Report() override {} public: DECLARE_JS_CLASS(CJS_Report); diff --git a/fpdfsdk/include/javascript/util.h b/fpdfsdk/include/javascript/util.h index 2e65bd3f58..369985673a 100644 --- a/fpdfsdk/include/javascript/util.h +++ b/fpdfsdk/include/javascript/util.h @@ -14,7 +14,7 @@ class util : public CJS_EmbedObj { public: util(CJS_Object* pJSObject); - virtual ~util(void); + ~util() override; public: FX_BOOL printd(IFXJS_Context* cc, @@ -51,8 +51,8 @@ class util : public CJS_EmbedObj { class CJS_Util : public CJS_Object { public: - CJS_Util(JSFXObject pObject) : CJS_Object(pObject){}; - virtual ~CJS_Util(void){}; + CJS_Util(JSFXObject pObject) : CJS_Object(pObject) {} + ~CJS_Util() override {} DECLARE_JS_CLASS(CJS_Util); diff --git a/fpdfsdk/include/pdfwindow/PWL_Button.h b/fpdfsdk/include/pdfwindow/PWL_Button.h index 363556762f..28a026c3bf 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Button.h +++ b/fpdfsdk/include/pdfwindow/PWL_Button.h @@ -12,12 +12,13 @@ class CPWL_Button : public CPWL_Wnd { public: CPWL_Button(); - virtual ~CPWL_Button(); + ~CPWL_Button() override; - 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); + // CPWL_Wnd + CFX_ByteString GetClassName() const override; + void OnCreate(PWL_CREATEPARAM& cp) override; + FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) override; protected: FX_BOOL m_bMouseDown; diff --git a/fpdfsdk/include/pdfwindow/PWL_Caret.h b/fpdfsdk/include/pdfwindow/PWL_Caret.h index 7e61eeb66e..0fe4e89c2e 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Caret.h +++ b/fpdfsdk/include/pdfwindow/PWL_Caret.h @@ -21,15 +21,17 @@ struct PWL_CARET_INFO { 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(); + ~CPWL_Caret() override; + + // CPWL_Wnd + CFX_ByteString GetClassName() const override; + void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; + void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device) override; + void InvalidateRect(CPDF_Rect* pRect = NULL) override; + void SetVisible(FX_BOOL bVisible) override {} + void TimerProc() override; + void SetCaret(FX_BOOL bVisible, const CPDF_Point& ptHead, const CPDF_Point& ptFoot); diff --git a/fpdfsdk/include/pdfwindow/PWL_ComboBox.h b/fpdfsdk/include/pdfwindow/PWL_ComboBox.h index 98ae7ca986..e29752326c 100644 --- a/fpdfsdk/include/pdfwindow/PWL_ComboBox.h +++ b/fpdfsdk/include/pdfwindow/PWL_ComboBox.h @@ -13,17 +13,17 @@ class CPWL_CBEdit : public CPWL_Edit { public: - CPWL_CBEdit(){}; - virtual ~CPWL_CBEdit(){}; + CPWL_CBEdit() {} + ~CPWL_CBEdit() override {} }; class CPWL_CBListBox : public CPWL_ListBox { public: - CPWL_CBListBox(){}; - virtual ~CPWL_CBListBox(){}; + CPWL_CBListBox() {} + ~CPWL_CBListBox() override {} - public: - virtual FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag); + // CPWL_ListBox + FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) override; FX_BOOL OnKeyDownWithExit(FX_WORD nChar, FX_BOOL& bExit, FX_DWORD nFlag); FX_BOOL OnCharWithExit(FX_WORD nChar, FX_BOOL& bExit, FX_DWORD nFlag); @@ -33,46 +33,40 @@ class CPWL_CBListBox : public CPWL_ListBox { 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); + CPWL_CBButton() {} + ~CPWL_CBButton() override {} + + // CPWL_Wnd + void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; + void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device) override; + FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) override; }; 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); - - 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 CreateChildWnd(const PWL_CREATEPARAM& cp); - virtual void RePosChildWnd(); - - virtual CPDF_Rect GetFocusRect() const; + ~CPWL_ComboBox() {} - virtual void SetFocus(); - virtual void KillFocus(); + operator CPWL_Edit*() { return m_pEdit; } - FX_BOOL IsModified() const; + // CPWL_Wnd + CFX_ByteString GetClassName() const override; + void OnCreate(PWL_CREATEPARAM& cp) override; + FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) override; + FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag) override; + void OnNotify(CPWL_Wnd* pWnd, + FX_DWORD msg, + intptr_t wParam = 0, + intptr_t lParam = 0) override; + void CreateChildWnd(const PWL_CREATEPARAM& cp) override; + void RePosChildWnd() override; + CPDF_Rect GetFocusRect() const override; + void SetFocus() override; + void KillFocus() override; + FX_BOOL IsModified() const override; - public: void SetFillerNotify(IPWL_Filler_Notify* pNotify); CFX_WideString GetText() const; @@ -90,28 +84,23 @@ class CPWL_ComboBox : public CPWL_Wnd { void SetSelectText(); + void AttachFFLData(void* pData) { m_pFormFiller = pData; } + private: void CreateEdit(const PWL_CREATEPARAM& cp); void CreateButton(const PWL_CREATEPARAM& cp); void CreateListBox(const PWL_CREATEPARAM& cp); - void SetPopup(FX_BOOL bPopup); - 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; - public: - void AttachFFLData(void* pData) { m_pFormFiller = pData; } - - private: void* m_pFormFiller; }; diff --git a/fpdfsdk/include/pdfwindow/PWL_Edit.h b/fpdfsdk/include/pdfwindow/PWL_Edit.h index c7430e5238..25da59197a 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Edit.h +++ b/fpdfsdk/include/pdfwindow/PWL_Edit.h @@ -51,32 +51,29 @@ class IPWL_Filler_Notify { class CPWL_Edit : public CPWL_EditCtrl, public IFX_Edit_OprNotify { public: CPWL_Edit(); - virtual ~CPWL_Edit(); + ~CPWL_Edit() override; + + // CPWL_EditCtrl + CFX_ByteString GetClassName() const override; + void OnDestroy() override; + void OnCreated() override; + void RePosChildWnd() override; + CPDF_Rect GetClientRect() const override; + void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; + void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device) override; + FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnLButtonDblClk(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnRButtonUp(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnMouseWheel(short zDelta, + const CPDF_Point& point, + FX_DWORD nFlag) override; + FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) override; + FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag) override; + CPDF_Rect GetFocusRect() const override; + void OnSetFocus() override; + void OnKillFocus() override; - 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, @@ -126,25 +123,22 @@ class CPWL_Edit : public CPWL_EditCtrl, public IFX_Edit_OprNotify { 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); + // IFX_Edit_OprNotify + void OnInsertWord(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace) override; + void OnInsertReturn(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace) override; + void OnBackSpace(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace) override; + void OnDelete(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace) override; + void OnClear(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace) override; + void OnSetText(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace) override; + void OnInsertText(const CPVT_WordPlace& place, + const CPVT_WordPlace& oldplace) override; + void OnAddUndo(IFX_Edit_UndoItem* pUndoItem) override; private: CPVT_WordRange GetSelectWordRange() const; diff --git a/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h b/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h index 784ec61140..bd241a3a48 100644 --- a/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h +++ b/fpdfsdk/include/pdfwindow/PWL_EditCtrl.h @@ -57,37 +57,10 @@ class CPWL_EditCtrl : public CPWL_Wnd, public IFX_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(); + ~CPWL_EditCtrl() override; 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); @@ -127,20 +100,64 @@ class CPWL_EditCtrl : public CPWL_Wnd, public IFX_Edit_Notify { void SetReadyToInput(); - protected: - virtual void ShowVScrollBar(FX_BOOL bShow); + // CPWL_Wnd + void OnCreate(PWL_CREATEPARAM& cp) override; + void OnCreated() override; + FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) override; + FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag) override; + FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag) override; + void OnNotify(CPWL_Wnd* pWnd, + FX_DWORD msg, + intptr_t wParam = 0, + intptr_t lParam = 0) override; + void CreateChildWnd(const PWL_CREATEPARAM& cp) override; + void RePosChildWnd() override; + void SetFontSize(FX_FLOAT fFontSize) override; + FX_FLOAT GetFontSize() const override; + void SetCursor() override; + FX_BOOL IsModified() const override; - virtual void InsertWord(FX_WORD word, int32_t nCharset); - virtual void InsertReturn(); - virtual void InsertText(const FX_WCHAR* csText); + protected: + // IFX_Edit_Notify + void IOnSetScrollInfoX(FX_FLOAT fPlateMin, + FX_FLOAT fPlateMax, + FX_FLOAT fContentMin, + FX_FLOAT fContentMax, + FX_FLOAT fSmallStep, + FX_FLOAT fBigStep) override {} + void IOnSetScrollInfoY(FX_FLOAT fPlateMin, + FX_FLOAT fPlateMax, + FX_FLOAT fContentMin, + FX_FLOAT fContentMax, + FX_FLOAT fSmallStep, + FX_FLOAT fBigStep) override; + void IOnSetScrollPosX(FX_FLOAT fx) override {} + void IOnSetScrollPosY(FX_FLOAT fy) override; + void IOnSetCaret(FX_BOOL bVisible, + const CPDF_Point& ptHead, + const CPDF_Point& ptFoot, + const CPVT_WordPlace& place) override; + void IOnCaretChange(const CPVT_SecProps& secProps, + const CPVT_WordProps& wordProps) override; + void IOnContentChange(const CPDF_Rect& rcContent) override; + void IOnInvalidateRect(CPDF_Rect* pRect) override; + + void InsertText(const FX_WCHAR* csText); + void SetText(const FX_WCHAR* csText); + void CopyText(); + void PasteText(); + void CutText(); + void ShowVScrollBar(FX_BOOL bShow); + void InsertWord(FX_WORD word, int32_t nCharset); + void InsertReturn(); - 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, @@ -148,30 +165,6 @@ class CPWL_EditCtrl : public CPWL_Wnd, public IFX_Edit_Notify { 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); diff --git a/fpdfsdk/include/pdfwindow/PWL_FontMap.h b/fpdfsdk/include/pdfwindow/PWL_FontMap.h index 0f5124ca02..f91d7e823f 100644 --- a/fpdfsdk/include/pdfwindow/PWL_FontMap.h +++ b/fpdfsdk/include/pdfwindow/PWL_FontMap.h @@ -51,24 +51,20 @@ struct CPWL_FontMap_Native { class CPWL_FontMap : public IFX_Edit_FontMap { public: CPWL_FontMap(IFX_SystemHandler* pSystemHandler); - virtual ~CPWL_FontMap(); + ~CPWL_FontMap() override; - 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); + // IFX_Edit_FontMap + CPDF_Font* GetPDFFont(int32_t nFontIndex) override; + CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) override; + int32_t GetWordFontIndex(FX_WORD word, + int32_t nCharset, + int32_t nFontIndex) override; + int32_t CharCodeFromUnicode(int32_t nFontIndex, FX_WORD word) override; + int32_t CharSetFromUnicode(FX_WORD word, int32_t nOldCharset) override; - 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); @@ -84,12 +80,12 @@ class CPWL_FontMap : public IFX_Edit_FontMap { 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); + void Initial(const FX_CHAR* fontname = NULL); + CPDF_Document* GetDocument(); + CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias, int32_t nCharset); + void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias); - virtual CPDF_Document* GetDocument(); + FX_BOOL KnowWord(int32_t nFontIndex, FX_WORD word); void Empty(); int32_t GetFontIndex(const CFX_ByteString& sFontName, @@ -128,7 +124,7 @@ class CPWL_DocFontMap : public CPWL_FontMap { public: CPWL_DocFontMap(IFX_SystemHandler* pSystemHandler, CPDF_Document* pAttachedDoc); - virtual ~CPWL_DocFontMap(); + ~CPWL_DocFontMap() override; virtual CPDF_Document* GetDocument(); diff --git a/fpdfsdk/include/pdfwindow/PWL_Icon.h b/fpdfsdk/include/pdfwindow/PWL_Icon.h index 7183f0245c..95157cad1f 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Icon.h +++ b/fpdfsdk/include/pdfwindow/PWL_Icon.h @@ -13,7 +13,7 @@ class CPWL_Image : public CPWL_Wnd { public: CPWL_Image(); - virtual ~CPWL_Image(); + ~CPWL_Image() override; virtual CFX_ByteString GetImageAppStream(); @@ -36,12 +36,13 @@ class CPWL_Image : public CPWL_Wnd { class CPWL_Icon : public CPWL_Image { public: CPWL_Icon(); - virtual ~CPWL_Icon(); + ~CPWL_Icon() override; 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); + // CPWL_Image + void GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) override; + void GetImageOffset(FX_FLOAT& x, FX_FLOAT& y) override; int32_t GetScaleMethod(); FX_BOOL IsProportionalScale(); diff --git a/fpdfsdk/include/pdfwindow/PWL_IconList.h b/fpdfsdk/include/pdfwindow/PWL_IconList.h index 30a12dcd9b..9ffb5ee8f5 100644 --- a/fpdfsdk/include/pdfwindow/PWL_IconList.h +++ b/fpdfsdk/include/pdfwindow/PWL_IconList.h @@ -26,11 +26,7 @@ class IPWL_IconList_Notify { 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(); + ~CPWL_IconList_Item() override; void SetSelect(FX_BOOL bSelected); FX_BOOL IsSelected() const; @@ -41,12 +37,15 @@ class CPWL_IconList_Item : public CPWL_Wnd { 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(); + // CPWL_Wnd + CFX_ByteString GetClassName() const override; + void CreateChildWnd(const PWL_CREATEPARAM& cp) override; + void RePosChildWnd() override; + FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth) override; + void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device) override; + void OnEnabled() override; + void OnDisabled() override; private: int32_t m_nIconIndex; @@ -59,7 +58,7 @@ class CPWL_IconList_Item : public CPWL_Wnd { class CPWL_IconList_Content : public CPWL_ListCtrl { public: CPWL_IconList_Content(int32_t nListCount); - virtual ~CPWL_IconList_Content(); + ~CPWL_IconList_Content() override; void SetSelect(int32_t nIndex); int32_t GetSelect() const; @@ -74,11 +73,12 @@ class CPWL_IconList_Content : public CPWL_ListCtrl { 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); + // CPWL_ListCtrl + void CreateChildWnd(const PWL_CREATEPARAM& cp) override; + FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) override; private: CPWL_IconList_Item* GetListItem(int32_t nItemIndex) const; @@ -95,11 +95,7 @@ class CPWL_IconList_Content : public CPWL_ListCtrl { 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); + ~CPWL_IconList() override; void SetSelect(int32_t nIndex); void SetTopItem(int32_t nIndex); @@ -113,14 +109,17 @@ class CPWL_IconList : public CPWL_Wnd { 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); + // CPWL_Wnd + FX_BOOL OnMouseWheel(short zDelta, + const CPDF_Point& point, + FX_DWORD nFlag) override; + void OnCreated() override; + void RePosChildWnd() override; + void CreateChildWnd(const PWL_CREATEPARAM& cp) override; + void OnNotify(CPWL_Wnd* pWnd, + FX_DWORD msg, + intptr_t wParam = 0, + intptr_t lParam = 0) override; private: CPWL_IconList_Content* m_pListContent; diff --git a/fpdfsdk/include/pdfwindow/PWL_Label.h b/fpdfsdk/include/pdfwindow/PWL_Label.h index b6cb7f557c..0504bb3e0b 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Label.h +++ b/fpdfsdk/include/pdfwindow/PWL_Label.h @@ -14,11 +14,7 @@ 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; + ~CPWL_Label() override; void SetText(const FX_WCHAR* csText); CFX_WideString GetText() const; @@ -30,11 +26,15 @@ class CPWL_Label : public CPWL_Wnd { 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(); + // CPWL_Wnd + CFX_ByteString GetClassName() const override; + void SetFontSize(FX_FLOAT fFontSize) override; + FX_FLOAT GetFontSize() const override; + void OnCreated() override; + void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device) override; + void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; + void RePosChildWnd() override; private: void SetParamByFlag(); diff --git a/fpdfsdk/include/pdfwindow/PWL_ListBox.h b/fpdfsdk/include/pdfwindow/PWL_ListBox.h index b9372eff9c..942a568836 100644 --- a/fpdfsdk/include/pdfwindow/PWL_ListBox.h +++ b/fpdfsdk/include/pdfwindow/PWL_ListBox.h @@ -18,29 +18,31 @@ class IPWL_Filler_Notify; class CPWL_List_Notify : public IFX_List_Notify { public: CPWL_List_Notify(CPWL_ListBox* pList); - virtual ~CPWL_List_Notify(); + ~CPWL_List_Notify() override; + // IFX_List_Notify void IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, FX_FLOAT fContentMin, FX_FLOAT fContentMax, FX_FLOAT fSmallStep, - FX_FLOAT fBigStep) {} + FX_FLOAT fBigStep) override {} 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); + FX_FLOAT fBigStep) override; + void IOnSetScrollPosX(FX_FLOAT fx) override {} + void IOnSetScrollPosY(FX_FLOAT fy) override; + void IOnInvalidateRect(CPDF_Rect* pRect) override; + 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; @@ -49,34 +51,34 @@ class CPWL_List_Notify : public IFX_List_Notify { 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(); + ~CPWL_ListBox() override; + + // CPWL_Wnd + CFX_ByteString GetClassName() const override; + void OnCreated() override; + void OnDestroy() override; + void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; + void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device) override; + FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) override; + FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag) override; + FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnMouseWheel(short zDelta, + const CPDF_Point& point, + FX_DWORD nFlag) override; + void KillFocus() override; + void OnNotify(CPWL_Wnd* pWnd, + FX_DWORD msg, + intptr_t wParam = 0, + intptr_t lParam = 0) override; + void RePosChildWnd() override; + CPDF_Rect GetFocusRect() const override; + void SetFontSize(FX_FLOAT fFontSize) override; + FX_FLOAT GetFontSize() const override; + 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); diff --git a/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h b/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h index cd90692150..dbaffc5b58 100644 --- a/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h +++ b/fpdfsdk/include/pdfwindow/PWL_ListCtrl.h @@ -12,7 +12,7 @@ class CPWL_ListCtrl : public CPWL_Wnd { public: CPWL_ListCtrl(); - virtual ~CPWL_ListCtrl(); + ~CPWL_ListCtrl() override; void SetScrollPos(const CPDF_Point& point); CPDF_Point GetScrollPos() const; @@ -30,9 +30,10 @@ class CPWL_ListCtrl : public CPWL_Wnd { CPDF_Rect OutToIn(const CPDF_Rect& rect) const; protected: - virtual void RePosChildWnd(); - virtual void DrawChildAppearance(CFX_RenderDevice* pDevice, - CPDF_Matrix* pUser2Device); + // CPWL_Wnd + void RePosChildWnd() override; + void DrawChildAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device) override; private: void ResetAll(FX_BOOL bMove, int32_t nStart); diff --git a/fpdfsdk/include/pdfwindow/PWL_Note.h b/fpdfsdk/include/pdfwindow/PWL_Note.h index 4f18fa20d0..b25d989ec7 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Note.h +++ b/fpdfsdk/include/pdfwindow/PWL_Note.h @@ -82,14 +82,14 @@ class IPWL_NoteItem { class CPWL_Note_Icon : public CPWL_Wnd { public: CPWL_Note_Icon(); - virtual ~CPWL_Note_Icon(); + ~CPWL_Note_Icon() override; void SetIconType(int32_t nType); - public: protected: - virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, - CPDF_Matrix* pUser2Device); + // CPWL_Wnd + void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device) override; private: int32_t m_nType; @@ -98,13 +98,14 @@ class CPWL_Note_Icon : public CPWL_Wnd { class CPWL_Note_CloseBox : public CPWL_Button { public: CPWL_Note_CloseBox(); - virtual ~CPWL_Note_CloseBox(); + ~CPWL_Note_CloseBox() override; 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); + // CPWL_Button + void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device) override; + FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) override; private: FX_BOOL m_bMouseDown; @@ -113,43 +114,44 @@ class CPWL_Note_CloseBox : public CPWL_Button { class CPWL_Note_LBBox : public CPWL_Wnd { public: CPWL_Note_LBBox(); - virtual ~CPWL_Note_LBBox(); + ~CPWL_Note_LBBox() override; protected: - virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, - CPDF_Matrix* pUser2Device); + // CPWL_Wnd + void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device) override; }; class CPWL_Note_RBBox : public CPWL_Wnd { public: CPWL_Note_RBBox(); - virtual ~CPWL_Note_RBBox(); + ~CPWL_Note_RBBox() override; protected: - virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, - CPDF_Matrix* pUser2Device); + // CPWL_Wnd + void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device) override; }; class CPWL_Note_Edit : public CPWL_Edit { public: CPWL_Note_Edit(); - virtual ~CPWL_Note_Edit(); + ~CPWL_Note_Edit() override; 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(); + // CPWL_Edit + FX_FLOAT GetItemLeftMargin() override; + FX_FLOAT GetItemRightMargin() override; + FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth) override; + void SetText(const FX_WCHAR* csText) override; + void OnNotify(CPWL_Wnd* pWnd, + FX_DWORD msg, + intptr_t wParam = 0, + intptr_t lParam = 0) override; + void RePosChildWnd() override; + void OnSetFocus() override; + void OnKillFocus() override; private: FX_BOOL m_bEnableNotify; @@ -162,17 +164,17 @@ class CPWL_Note_Edit : public CPWL_Edit { class CPWL_Note_Options : public CPWL_Wnd { public: CPWL_Note_Options(); - virtual ~CPWL_Note_Options(); + ~CPWL_Note_Options() override; 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); + // CPWL_Wnd + void RePosChildWnd() override; + void CreateChildWnd(const PWL_CREATEPARAM& cp) override; + void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device) override; + void SetTextColor(const CPWL_Color& color) override; private: CPWL_Label* m_pText; @@ -181,19 +183,11 @@ class CPWL_Note_Options : public CPWL_Wnd { 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); + ~CPWL_Note_Contents() override; void SetEditFocus(FX_BOOL bLast); CPWL_Edit* GetEdit() const; - public: void SetText(const CFX_WideString& sText); CFX_WideString GetText() const; @@ -206,8 +200,14 @@ class CPWL_Note_Contents : public CPWL_ListCtrl { void EnableRead(FX_BOOL bEnabled); void EnableModify(FX_BOOL bEnabled); - protected: - virtual void CreateChildWnd(const PWL_CREATEPARAM& cp); + // CPWL_ListCtrl + CFX_ByteString GetClassName() const override; + void OnNotify(CPWL_Wnd* pWnd, + FX_DWORD msg, + intptr_t wParam = 0, + intptr_t lParam = 0) override; + FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) override; + void CreateChildWnd(const PWL_CREATEPARAM& cp) override; private: CPWL_Note_Edit* m_pEdit; @@ -216,65 +216,60 @@ class CPWL_Note_Contents : public CPWL_ListCtrl { 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; + ~CPWL_NoteItem() override; - 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 FX_BOOL IsTopItem() const { return FALSE; } + 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); + void OnContentsValidate(); + void OnCreateNoteItem(); - virtual void OnNotify(CPWL_Wnd* pWnd, - FX_DWORD msg, - intptr_t wParam = 0, - intptr_t lParam = 0); + // IPWL_NoteItem + void SetPrivateData(void* pData) override; + void SetBkColor(const CPWL_Color& color) override; + void SetSubjectName(const CFX_WideString& sName) override; + void SetAuthorName(const CFX_WideString& sName) override; + void SetDateTime(FX_SYSTEMTIME time) override; + void SetContents(const CFX_WideString& sContents) override; + IPWL_NoteItem* CreateSubItem() override; + int32_t CountSubItems() const override; + IPWL_NoteItem* GetSubItems(int32_t index) const override; + void DeleteSubItem(IPWL_NoteItem* pNoteItem) override; + void SetFocus() override { SetNoteFocus(FALSE); } + IPWL_NoteItem* GetParentItem() const override; + void* GetPrivateData() const override; + CFX_WideString GetAuthorName() const override; + CPWL_Color GetBkColor() const override; + CFX_WideString GetContents() const override; + FX_SYSTEMTIME GetDateTime() const override; + CFX_WideString GetSubjectName() const override; + CPWL_Edit* GetEdit() const override; + + protected: + // CPWL_Wnd + FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnRButtonUp(const CPDF_Point& point, FX_DWORD nFlag) override; + CFX_ByteString GetClassName() const override; + void RePosChildWnd() override; + void CreateChildWnd(const PWL_CREATEPARAM& cp) override; + void OnNotify(CPWL_Wnd* pWnd, + FX_DWORD msg, + intptr_t wParam = 0, + intptr_t lParam = 0) override; + FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth) override; + FX_FLOAT GetItemLeftMargin() override; + FX_FLOAT GetItemRightMargin() override; - 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; @@ -300,19 +295,8 @@ class CPWL_Note : public CPWL_NoteItem { CPWL_Note(IPopup_Note* pPopupNote, IPWL_NoteNotify* pNoteNotify, IPWL_NoteHandler* pNoteHandler); - virtual ~CPWL_Note(); + ~CPWL_Note() override; - 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); @@ -329,22 +313,28 @@ class CPWL_Note : public CPWL_NoteItem { 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); + // CPWL_NoteItem + void SetSubjectName(const CFX_WideString& sName) override; + void SetAuthorName(const CFX_WideString& sName) override; + CFX_WideString GetAuthorName() const override; + void SetBkColor(const CPWL_Color& color) override; + void ResetSubjectName(int32_t nItemIndex) override {} + FX_BOOL IsTopItem() const override { return TRUE; } + const CPWL_Note* GetNote() const override; + IPWL_NoteNotify* GetNoteNotify() const override; + FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnRButtonUp(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnMouseWheel(short zDelta, + const CPDF_Point& point, + FX_DWORD nFlag) override; + void RePosChildWnd() override; + void CreateChildWnd(const PWL_CREATEPARAM& cp) override; + void OnNotify(CPWL_Wnd* pWnd, + FX_DWORD msg, + intptr_t wParam = 0, + intptr_t lParam = 0) override; 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(); diff --git a/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h b/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h index a149a01416..ec1b78ed5e 100644 --- a/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h +++ b/fpdfsdk/include/pdfwindow/PWL_ScrollBar.h @@ -35,17 +35,17 @@ 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); + ~CPWL_SBButton() override; + + // CPWL_Wnd + CFX_ByteString GetClassName() const override; + void OnCreate(PWL_CREATEPARAM& cp) override; + void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; + void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device) override; + FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnMouseMove(const CPDF_Point& point, FX_DWORD nFlag) override; protected: PWL_SCROLLBAR_TYPE m_eScrollBarType; @@ -92,24 +92,23 @@ struct PWL_SCROLL_PRIVATEDATA { 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); + ~CPWL_ScrollBar() override; + + // CPWL_Wnd + CFX_ByteString GetClassName() const override; + void OnCreate(PWL_CREATEPARAM& cp) override; + void RePosChildWnd() override; + void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; + void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device) override; + FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) override; + void OnNotify(CPWL_Wnd* pWnd, + FX_DWORD msg, + intptr_t wParam = 0, + intptr_t lParam = 0) override; + void CreateChildWnd(const PWL_CREATEPARAM& cp) override; + void TimerProc() override; FX_FLOAT GetScrollBarWidth() const; PWL_SCROLLBAR_TYPE GetScrollBarType() const { return m_sbType; }; @@ -142,9 +141,6 @@ class CPWL_ScrollBar : public CPWL_Wnd { 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; diff --git a/fpdfsdk/include/pdfwindow/PWL_Signature.h b/fpdfsdk/include/pdfwindow/PWL_Signature.h index c48d4e9708..009dd87592 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Signature.h +++ b/fpdfsdk/include/pdfwindow/PWL_Signature.h @@ -16,17 +16,17 @@ class CPWL_Label; class CPWL_Signature_Image : public CPWL_Image { public: CPWL_Signature_Image(); - virtual ~CPWL_Signature_Image(); + ~CPWL_Signature_Image() override; void SetImage(CFX_DIBSource* pImage); CFX_DIBSource* GetImage(); 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); + // CPWL_Image + void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device) override; + void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; + void GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) override; private: CFX_DIBSource* m_pImage; @@ -35,7 +35,7 @@ class CPWL_Signature_Image : public CPWL_Image { class CPWL_Signature : public CPWL_Wnd { public: CPWL_Signature(); - virtual ~CPWL_Signature(); + ~CPWL_Signature() override; void SetText(const FX_WCHAR* sText); void SetDescription(const FX_WCHAR* string); @@ -47,12 +47,12 @@ class CPWL_Signature : public CPWL_Wnd { void SetFoxitFlag(FX_BOOL bFlagExist); 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); + // CPWL_Wnd + void RePosChildWnd() override; + void CreateChildWnd(const PWL_CREATEPARAM& cp) override; + void DrawThisAppearance(CFX_RenderDevice* pDevice, + CPDF_Matrix* pUser2Device) override; + void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; private: CPWL_Label* m_pText; diff --git a/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h b/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h index 8cfe819a67..a62d18d257 100644 --- a/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h +++ b/fpdfsdk/include/pdfwindow/PWL_SpecialButton.h @@ -12,20 +12,22 @@ class CPWL_PushButton : public CPWL_Button { public: CPWL_PushButton(); - virtual ~CPWL_PushButton(); + ~CPWL_PushButton() override; - virtual CFX_ByteString GetClassName() const; - virtual CPDF_Rect GetFocusRect() const; + // CPWL_Button + CFX_ByteString GetClassName() const override; + CPDF_Rect GetFocusRect() const override; }; class CPWL_CheckBox : public CPWL_Button { public: CPWL_CheckBox(); - virtual ~CPWL_CheckBox(); + ~CPWL_CheckBox() override; - 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); + // CPWL_Button + CFX_ByteString GetClassName() const override; + FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag) override; void SetCheck(FX_BOOL bCheck); FX_BOOL IsChecked() const; @@ -37,11 +39,12 @@ class CPWL_CheckBox : public CPWL_Button { class CPWL_RadioButton : public CPWL_Button { public: CPWL_RadioButton(); - virtual ~CPWL_RadioButton(); + ~CPWL_RadioButton() override; - 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); + // CPWL_Button + CFX_ByteString GetClassName() const override; + FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_DWORD nFlag) override; + FX_BOOL OnChar(FX_WORD nChar, FX_DWORD nFlag) override; void SetCheck(FX_BOOL bCheck); FX_BOOL IsChecked() const; diff --git a/fpdfsdk/include/pdfwindow/PWL_Wnd.h b/fpdfsdk/include/pdfwindow/PWL_Wnd.h index e66c15e5e7..37af083835 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/include/pdfwindow/PWL_Wnd.h @@ -284,7 +284,7 @@ class CPWL_Wnd : public CPWL_TimerHandler { public: CPWL_Wnd(); - virtual ~CPWL_Wnd(); + ~CPWL_Wnd() override; void Create(const PWL_CREATEPARAM& cp); virtual CFX_ByteString GetClassName() const; @@ -373,7 +373,6 @@ class CPWL_Wnd : public CPWL_TimerHandler { IFX_Edit_FontMap* GetFontMap() const; IPWL_Provider* GetProvider() const; - virtual IFX_SystemHandler* GetSystemHandler() const; IPWL_FocusHandler* GetFocusHandler() const; int32_t GetTransparency(); @@ -399,6 +398,9 @@ class CPWL_Wnd : public CPWL_TimerHandler { virtual void SetCursor(); protected: + // CPWL_TimerHandler + IFX_SystemHandler* GetSystemHandler() const override; + virtual void CreateChildWnd(const PWL_CREATEPARAM& cp); virtual void RePosChildWnd(); void GetAppearanceStream(CFX_ByteTextBuf& sAppStream); diff --git a/fpdfsdk/src/fpdf_dataavail.cpp b/fpdfsdk/src/fpdf_dataavail.cpp index 4100fe2db9..b9cf69d647 100644 --- a/fpdfsdk/src/fpdf_dataavail.cpp +++ b/fpdfsdk/src/fpdf_dataavail.cpp @@ -14,10 +14,12 @@ extern void ProcessParseError(FX_DWORD err_code); class CFPDF_FileAvailWrap : public IFX_FileAvail { public: CFPDF_FileAvailWrap() { m_pfileAvail = NULL; } + ~CFPDF_FileAvailWrap() override {} void Set(FX_FILEAVAIL* pfileAvail) { m_pfileAvail = pfileAvail; } - virtual FX_BOOL IsDataAvail(FX_FILESIZE offset, FX_DWORD size) { + // IFX_FileAvail + FX_BOOL IsDataAvail(FX_FILESIZE offset, FX_DWORD size) override { return m_pfileAvail->IsDataAvail(m_pfileAvail, offset, size); } @@ -28,17 +30,19 @@ class CFPDF_FileAvailWrap : public IFX_FileAvail { class CFPDF_FileAccessWrap : public IFX_FileRead { public: CFPDF_FileAccessWrap() { m_pFileAccess = NULL; } + ~CFPDF_FileAccessWrap() override {} void Set(FPDF_FILEACCESS* pFile) { m_pFileAccess = pFile; } - virtual FX_FILESIZE GetSize() { return m_pFileAccess->m_FileLen; } + // IFX_FileRead + FX_FILESIZE GetSize() override { return m_pFileAccess->m_FileLen; } - virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) { + FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override { return m_pFileAccess->m_GetBlock(m_pFileAccess->m_Param, offset, (uint8_t*)buffer, size); } - virtual void Release() {} + void Release() override {} private: FPDF_FILEACCESS* m_pFileAccess; @@ -46,12 +50,14 @@ class CFPDF_FileAccessWrap : public IFX_FileRead { class CFPDF_DownloadHintsWrap : public IFX_DownloadHints { public: - CFPDF_DownloadHintsWrap(FX_DOWNLOADHINTS* pDownloadHints) { + explicit CFPDF_DownloadHintsWrap(FX_DOWNLOADHINTS* pDownloadHints) { m_pDownloadHints = pDownloadHints; } + ~CFPDF_DownloadHintsWrap() override {} public: - virtual void AddSegment(FX_FILESIZE offset, FX_DWORD size) { + // IFX_DownloadHints + void AddSegment(FX_FILESIZE offset, FX_DWORD size) override { m_pDownloadHints->AddSegment(m_pDownloadHints, offset, size); } diff --git a/fpdfsdk/src/fpdf_sysfontinfo.cpp b/fpdfsdk/src/fpdf_sysfontinfo.cpp index a0fdb5083d..53610b040e 100644 --- a/fpdfsdk/src/fpdf_sysfontinfo.cpp +++ b/fpdfsdk/src/fpdf_sysfontinfo.cpp @@ -10,15 +10,15 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo { public: - CFX_ExternalFontInfo(FPDF_SYSFONTINFO* pInfo) : m_pInfo(pInfo) {} + explicit CFX_ExternalFontInfo(FPDF_SYSFONTINFO* pInfo) : m_pInfo(pInfo) {} - virtual void Release() override { + void Release() override { if (m_pInfo->Release) m_pInfo->Release(m_pInfo); delete this; } - virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override { + FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override { if (m_pInfo->EnumFonts) { m_pInfo->EnumFonts(m_pInfo, pMapper); return TRUE; @@ -26,34 +26,34 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo { return FALSE; } - virtual void* MapFont(int weight, - FX_BOOL bItalic, - int charset, - int pitch_family, - const FX_CHAR* family, - int& iExact) override { + void* MapFont(int weight, + FX_BOOL bItalic, + int charset, + int pitch_family, + const FX_CHAR* family, + int& iExact) override { if (m_pInfo->MapFont) return m_pInfo->MapFont(m_pInfo, weight, bItalic, charset, pitch_family, family, &iExact); return NULL; } - virtual void* GetFont(const FX_CHAR* family) override { + void* GetFont(const FX_CHAR* family) override { if (m_pInfo->GetFont) return m_pInfo->GetFont(m_pInfo, family); return NULL; } - virtual FX_DWORD GetFontData(void* hFont, - FX_DWORD table, - uint8_t* buffer, - FX_DWORD size) override { + FX_DWORD GetFontData(void* hFont, + FX_DWORD table, + uint8_t* buffer, + FX_DWORD size) override { if (m_pInfo->GetFontData) return m_pInfo->GetFontData(m_pInfo, hFont, table, buffer, size); return 0; } - virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override { + FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override { if (m_pInfo->GetFaceName == NULL) return FALSE; FX_DWORD size = m_pInfo->GetFaceName(m_pInfo, hFont, NULL, 0); @@ -66,7 +66,7 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo { return TRUE; } - virtual FX_BOOL GetFontCharset(void* hFont, int& charset) override { + FX_BOOL GetFontCharset(void* hFont, int& charset) override { if (m_pInfo->GetFontCharset) { charset = m_pInfo->GetFontCharset(m_pInfo, hFont); return TRUE; @@ -74,13 +74,13 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo { return FALSE; } - virtual void DeleteFont(void* hFont) override { + void DeleteFont(void* hFont) override { if (m_pInfo->DeleteFont) m_pInfo->DeleteFont(m_pInfo, hFont); } private: - ~CFX_ExternalFontInfo() {} + ~CFX_ExternalFontInfo() override {} FPDF_SYSFONTINFO* const m_pInfo; }; diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp index f56cc442f0..7a666bceb8 100644 --- a/fpdfsdk/src/fpdfsave.cpp +++ b/fpdfsdk/src/fpdfsave.cpp @@ -22,10 +22,12 @@ class CFX_IFileWrite final : public IFX_StreamWrite { public: CFX_IFileWrite(); FX_BOOL Init(FPDF_FILEWRITE* pFileWriteStruct); - virtual FX_BOOL WriteBlock(const void* pData, size_t size) override; - virtual void Release() override {} + FX_BOOL WriteBlock(const void* pData, size_t size) override; + void Release() override; protected: + ~CFX_IFileWrite() override {} + FPDF_FILEWRITE* m_pFileWriteStruct; }; @@ -49,6 +51,10 @@ FX_BOOL CFX_IFileWrite::WriteBlock(const void* pData, size_t size) { return TRUE; } +void CFX_IFileWrite::Release() { + delete this; +} + #define XFA_DATASETS 0 #define XFA_FORMS 1 @@ -311,7 +317,6 @@ FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document, bRet = FileMaker.Create(pStreamWrite, flags); _SendPostSaveToXFADoc(pDoc); - // pDoc->_ClearChangeMark(); for (int i = 0; i < fileList.GetSize(); i++) { IFX_FileStream* pFile = (IFX_FileStream*)fileList.GetAt(i); @@ -319,7 +324,7 @@ FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document, } fileList.RemoveAll(); - delete pStreamWrite; + pStreamWrite->Release(); return bRet; } diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp index 87b23c31e3..89571a6f9d 100644 --- a/fpdfsdk/src/fpdfview.cpp +++ b/fpdfsdk/src/fpdfview.cpp @@ -323,6 +323,8 @@ class CMemFile final : public IFX_FileRead { } private: + ~CMemFile() override {} + uint8_t* m_pBuf; FX_FILESIZE m_size; }; diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp index d471dc1e83..a119781a46 100644 --- a/fpdfsdk/src/fsdk_mgr.cpp +++ b/fpdfsdk/src/fsdk_mgr.cpp @@ -20,81 +20,64 @@ #include <ctime> #endif -// extern CPDFDoc_Environment* g_pFormFillApp; class CFX_SystemHandler : public IFX_SystemHandler { public: CFX_SystemHandler(CPDFDoc_Environment* pEnv) : m_pEnv(pEnv), m_nCharSet(-1) {} + ~CFX_SystemHandler() override {} public: - virtual void InvalidateRect(FX_HWND hWnd, FX_RECT rect); - virtual void OutputSelectedRect(void* pFormFiller, CPDF_Rect& rect); - - virtual FX_BOOL IsSelectionImplemented(); - - virtual CFX_WideString GetClipboardText(FX_HWND hWnd) { return L""; } - virtual FX_BOOL SetClipboardText(FX_HWND hWnd, CFX_WideString string) { + // IFX_SystemHandler + void InvalidateRect(FX_HWND hWnd, FX_RECT rect) override; + void OutputSelectedRect(void* pFormFiller, CPDF_Rect& rect) override; + FX_BOOL IsSelectionImplemented() override; + CFX_WideString GetClipboardText(FX_HWND hWnd) override { return L""; } + FX_BOOL SetClipboardText(FX_HWND hWnd, CFX_WideString string) override { return FALSE; } - - virtual void ClientToScreen(FX_HWND hWnd, int32_t& x, int32_t& y) {} - virtual void ScreenToClient(FX_HWND hWnd, int32_t& x, int32_t& y) {} - - /*cursor style - FXCT_ARROW - FXCT_NESW - FXCT_NWSE - FXCT_VBEAM - FXCT_HBEAM - FXCT_HAND - */ - virtual void SetCursor(int32_t nCursorType); - - virtual FX_HMENU CreatePopupMenu() { return NULL; } - virtual FX_BOOL AppendMenuItem(FX_HMENU hMenu, - int32_t nIDNewItem, - CFX_WideString string) { + void ClientToScreen(FX_HWND hWnd, int32_t& x, int32_t& y) override {} + void ScreenToClient(FX_HWND hWnd, int32_t& x, int32_t& y) override {} + void SetCursor(int32_t nCursorType) override; + FX_HMENU CreatePopupMenu() override { return NULL; } + FX_BOOL AppendMenuItem(FX_HMENU hMenu, + int32_t nIDNewItem, + CFX_WideString string) override { return FALSE; } - virtual FX_BOOL EnableMenuItem(FX_HMENU hMenu, - int32_t nIDItem, - FX_BOOL bEnabled) { + FX_BOOL EnableMenuItem(FX_HMENU hMenu, + int32_t nIDItem, + FX_BOOL bEnabled) override { return FALSE; } - virtual int32_t TrackPopupMenu(FX_HMENU hMenu, - int32_t x, - int32_t y, - FX_HWND hParent) { + int32_t TrackPopupMenu(FX_HMENU hMenu, + int32_t x, + int32_t y, + FX_HWND hParent) override { return -1; } - virtual void DestroyMenu(FX_HMENU hMenu) {} - - virtual CFX_ByteString GetNativeTrueTypeFont(int32_t nCharset); - virtual FX_BOOL FindNativeTrueTypeFont(int32_t nCharset, - CFX_ByteString sFontFaceName); - virtual CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, - CFX_ByteString sFontFaceName, - uint8_t nCharset); - - virtual int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc); - virtual void KillTimer(int32_t nID); - - virtual FX_BOOL IsSHIFTKeyDown(FX_DWORD nFlag) { + void DestroyMenu(FX_HMENU hMenu) override {} + CFX_ByteString GetNativeTrueTypeFont(int32_t nCharset) override; + FX_BOOL FindNativeTrueTypeFont(int32_t nCharset, + CFX_ByteString sFontFaceName) override; + CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, + CFX_ByteString sFontFaceName, + uint8_t nCharset) override; + int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc) override; + void KillTimer(int32_t nID) override; + FX_BOOL IsSHIFTKeyDown(FX_DWORD nFlag) override { return m_pEnv->FFI_IsSHIFTKeyDown(nFlag); } - virtual FX_BOOL IsCTRLKeyDown(FX_DWORD nFlag) { + FX_BOOL IsCTRLKeyDown(FX_DWORD nFlag) override { return m_pEnv->FFI_IsCTRLKeyDown(nFlag); } - virtual FX_BOOL IsALTKeyDown(FX_DWORD nFlag) { + FX_BOOL IsALTKeyDown(FX_DWORD nFlag) override { return m_pEnv->FFI_IsALTKeyDown(nFlag); } - virtual FX_BOOL IsINSERTKeyDown(FX_DWORD nFlag) { + FX_BOOL IsINSERTKeyDown(FX_DWORD nFlag) override { return m_pEnv->FFI_IsINSERTKeyDown(nFlag); } - - virtual FX_SYSTEMTIME GetLocalTime(); - - virtual int32_t GetCharSet() { return m_nCharSet; } - virtual void SetCharSet(int32_t nCharSet) { m_nCharSet = nCharSet; } + FX_SYSTEMTIME GetLocalTime() override; + int32_t GetCharSet() override { return m_nCharSet; } + void SetCharSet(int32_t nCharSet) override { m_nCharSet = nCharSet; } private: CPDFDoc_Environment* m_pEnv; diff --git a/fpdfsdk/src/fsdk_rendercontext.cpp b/fpdfsdk/src/fsdk_rendercontext.cpp index 1320824236..e282d01db7 100644 --- a/fpdfsdk/src/fsdk_rendercontext.cpp +++ b/fpdfsdk/src/fsdk_rendercontext.cpp @@ -36,6 +36,9 @@ IFSDK_PAUSE_Adapter::IFSDK_PAUSE_Adapter(IFSDK_PAUSE* IPause) { m_IPause = IPause; } +IFSDK_PAUSE_Adapter::~IFSDK_PAUSE_Adapter() { +} + FX_BOOL IFSDK_PAUSE_Adapter::NeedToPauseNow() { if (m_IPause->NeedToPauseNow) { return m_IPause->NeedToPauseNow(m_IPause); diff --git a/fpdfsdk/src/javascript/JS_Context.cpp b/fpdfsdk/src/javascript/JS_Context.cpp index 9c142e6b1e..b51b5aa265 100644 --- a/fpdfsdk/src/javascript/JS_Context.cpp +++ b/fpdfsdk/src/javascript/JS_Context.cpp @@ -19,7 +19,7 @@ CJS_Context::CJS_Context(CJS_Runtime* pRuntime) m_pEventHandler = new CJS_EventHandler(this); } -CJS_Context::~CJS_Context(void) { +CJS_Context::~CJS_Context() { delete m_pEventHandler; } diff --git a/fpdfsdk/src/javascript/JS_Object.cpp b/fpdfsdk/src/javascript/JS_Object.cpp index 96e1d1d564..02978982d8 100644 --- a/fpdfsdk/src/javascript/JS_Object.cpp +++ b/fpdfsdk/src/javascript/JS_Object.cpp @@ -89,7 +89,7 @@ CJS_Object::CJS_Object(JSFXObject pObject) : m_pEmbedObj(NULL) { m_pObject.Reset(m_pIsolate, pObject); }; -CJS_Object::~CJS_Object(void) { +CJS_Object::~CJS_Object() { m_pObject.Reset(); }; diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp index aff491a084..547446861f 100644 --- a/fpdfsdk/src/javascript/app.cpp +++ b/fpdfsdk/src/javascript/app.cpp @@ -112,7 +112,7 @@ IMPLEMENT_JS_CLASS(CJS_App, app) app::app(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject), m_bCalculate(true), m_bRuntimeHighLight(false) {} -app::~app(void) { +app::~app() { for (int i = 0, sz = m_aTimer.GetSize(); i < sz; i++) delete m_aTimer[i]; diff --git a/fpdfsdk/src/javascript/color.cpp b/fpdfsdk/src/javascript/color.cpp index 0659ab94a4..c6d13fc284 100644 --- a/fpdfsdk/src/javascript/color.cpp +++ b/fpdfsdk/src/javascript/color.cpp @@ -65,7 +65,8 @@ color::color(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) { m_crLTGray = CPWL_Color(COLORTYPE_GRAY, 0.75); } -color::~color(void) {} +color::~color() { +} void color::ConvertPWLColorToArray(const CPWL_Color& color, CJS_Array& array) { switch (color.nColorType) { diff --git a/fpdfsdk/src/javascript/event.cpp b/fpdfsdk/src/javascript/event.cpp index 4bcdcce3a0..492f225d18 100644 --- a/fpdfsdk/src/javascript/event.cpp +++ b/fpdfsdk/src/javascript/event.cpp @@ -50,7 +50,8 @@ IMPLEMENT_JS_CLASS(CJS_Event, event) event::event(CJS_Object* pJsObject) : CJS_EmbedObj(pJsObject) {} -event::~event(void) {} +event::~event() { +} FX_BOOL event::change(IFXJS_Context* cc, CJS_PropValue& vp, diff --git a/fpdfsdk/src/javascript/global.cpp b/fpdfsdk/src/javascript/global.cpp index c3bf837727..ff915a8b38 100644 --- a/fpdfsdk/src/javascript/global.cpp +++ b/fpdfsdk/src/javascript/global.cpp @@ -107,7 +107,7 @@ FX_BOOL CJS_Global::InitInstance(IFXJS_Context* cc) { global_alternate::global_alternate(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject), m_pApp(NULL) {} -global_alternate::~global_alternate(void) { +global_alternate::~global_alternate() { DestroyGlobalPersisitentVariables(); CPDFXFA_App::GetInstance()->GetRuntimeFactory()->ReleaseGlobalData(); } diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp index c735b971dc..85092dab17 100644 --- a/fpdfsdk/src/javascript/util.cpp +++ b/fpdfsdk/src/javascript/util.cpp @@ -48,7 +48,8 @@ IMPLEMENT_JS_CLASS(CJS_Util, util) util::util(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {} -util::~util(void) {} +util::~util() { +} struct stru_TbConvert { const FX_WCHAR* lpszJSMark; |