From 47bcd4c5c56cdc2d63a0c2ed4e7f68e6ccf523f6 Mon Sep 17 00:00:00 2001 From: weili Date: Thu, 16 Jun 2016 08:00:06 -0700 Subject: Make code compile with clang_use_chrome_plugin (part V) This change mainly contains files in xfa/fxfa directory. This is part of the efforts to make PDFium code compilable by Clang chromium style plugins. The changes are mainly the following: -- move inline constructor/destructor of complex class/struct out-of-line; -- add constructor/destructor of complex class/struct if not explicitly defined; -- add explicit out-of-line copy constructor when needed; -- move inline virtual functions out-of-line; -- Properly mark virtual functions with 'override'; -- some minor cleanups; BUG=pdfium:469 Review-Url: https://codereview.chromium.org/2071683002 --- xfa/fxfa/app/xfa_ffapp.cpp | 7 ++ xfa/fxfa/app/xfa_ffbarcode.h | 20 +++--- xfa/fxfa/app/xfa_ffcheckbutton.h | 38 ++++++----- xfa/fxfa/app/xfa_ffchoicelist.h | 106 ++++++++++++++-------------- xfa/fxfa/app/xfa_ffdraw.h | 2 +- xfa/fxfa/app/xfa_ffexclgroup.h | 11 +-- xfa/fxfa/app/xfa_fffield.h | 86 +++++++++++------------ xfa/fxfa/app/xfa_ffimage.h | 18 ++--- xfa/fxfa/app/xfa_ffimageedit.h | 34 ++++----- xfa/fxfa/app/xfa_ffpageview.cpp | 4 ++ xfa/fxfa/app/xfa_ffpath.h | 37 ++++++---- xfa/fxfa/app/xfa_ffpushbutton.h | 29 ++++---- xfa/fxfa/app/xfa_ffsignature.h | 49 ++++++------- xfa/fxfa/app/xfa_ffsubform.h | 2 +- xfa/fxfa/app/xfa_fftext.h | 26 +++---- xfa/fxfa/app/xfa_fftextedit.cpp | 1 - xfa/fxfa/app/xfa_fftextedit.h | 89 ++++++++++++------------ xfa/fxfa/app/xfa_ffwidget.cpp | 66 ++++++++++++++++++ xfa/fxfa/app/xfa_ffwidgetacc.h | 1 + xfa/fxfa/app/xfa_fontmgr.cpp | 2 + xfa/fxfa/app/xfa_fwltheme.cpp | 15 ++++ xfa/fxfa/app/xfa_fwltheme.h | 23 +++---- xfa/fxfa/app/xfa_textlayout.cpp | 144 +++++++++++++++++++++++++++++++++++++++ xfa/fxfa/app/xfa_textlayout.h | 141 ++++++++++---------------------------- 24 files changed, 575 insertions(+), 376 deletions(-) (limited to 'xfa/fxfa/app') diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp index f2a6ad5e0d..5f2f1b9828 100644 --- a/xfa/fxfa/app/xfa_ffapp.cpp +++ b/xfa/fxfa/app/xfa_ffapp.cpp @@ -25,6 +25,9 @@ CXFA_FileRead::CXFA_FileRead(const CFX_ArrayTemplate& streams) { acc.LoadAllData(streams[i]); } } + +CXFA_FileRead::~CXFA_FileRead() {} + FX_FILESIZE CXFA_FileRead::GetSize() { uint32_t dwSize = 0; int32_t iCount = m_Data.GetSize(); @@ -64,6 +67,10 @@ FX_BOOL CXFA_FileRead::ReadBlock(void* buffer, return FALSE; } +void CXFA_FileRead::Release() { + delete this; +} + CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider) : m_pDocHandler(nullptr), m_pFWLTheme(nullptr), diff --git a/xfa/fxfa/app/xfa_ffbarcode.h b/xfa/fxfa/app/xfa_ffbarcode.h index ffa7037839..5a412a6174 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.h +++ b/xfa/fxfa/app/xfa_ffbarcode.h @@ -14,15 +14,17 @@ class CXFA_FFBarcode : public CXFA_FFTextEdit { public: CXFA_FFBarcode(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFBarcode(); - virtual FX_BOOL LoadWidget(); - virtual void RenderWidget(CFX_Graphics* pGS, - CFX_Matrix* pMatrix = NULL, - uint32_t dwStatus = 0, - int32_t iRotate = 0); - virtual void UpdateWidgetProperty(); - virtual FX_BOOL OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); + ~CXFA_FFBarcode() override; + + // CXFA_FFTextEdit + FX_BOOL LoadWidget() override; + void RenderWidget(CFX_Graphics* pGS, + CFX_Matrix* pMatrix = NULL, + uint32_t dwStatus = 0, + int32_t iRotate = 0) override; + void UpdateWidgetProperty() override; + FX_BOOL OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; }; enum XFA_BARCODETYPEENUM { diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.h b/xfa/fxfa/app/xfa_ffcheckbutton.h index c3323b4035..fc219f9e2c 100644 --- a/xfa/fxfa/app/xfa_ffcheckbutton.h +++ b/xfa/fxfa/app/xfa_ffcheckbutton.h @@ -13,26 +13,30 @@ class CXFA_FFCheckButton : public CXFA_FFField { public: CXFA_FFCheckButton(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFCheckButton(); - virtual void RenderWidget(CFX_Graphics* pGS, - CFX_Matrix* pMatrix = NULL, - uint32_t dwStatus = 0, - int32_t iRotate = 0); - - virtual FX_BOOL LoadWidget(); - virtual FX_BOOL PerformLayout(); - virtual FX_BOOL UpdateFWLData(); - virtual void UpdateWidgetProperty(); - virtual FX_BOOL OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); + ~CXFA_FFCheckButton() override; + + // CXFA_FFField + void RenderWidget(CFX_Graphics* pGS, + CFX_Matrix* pMatrix = NULL, + uint32_t dwStatus = 0, + int32_t iRotate = 0) override; + + FX_BOOL LoadWidget() override; + FX_BOOL PerformLayout() override; + FX_BOOL UpdateFWLData() override; + void UpdateWidgetProperty() override; + FX_BOOL OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessEvent(CFWL_Event* pEvent) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; + void SetFWLCheckState(XFA_CHECKSTATE eCheckState); - virtual void OnProcessMessage(CFWL_Message* pMessage); - virtual void OnProcessEvent(CFWL_Event* pEvent); - virtual void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); protected: - virtual FX_BOOL CommitData(); - virtual FX_BOOL IsDataChanged(); + FX_BOOL CommitData() override; + FX_BOOL IsDataChanged() override; + void CapLeftRightPlacement(CXFA_Margin mgCap); void AddUIMargin(int32_t iCapPlacement); XFA_CHECKSTATE FWLState2XFAState(); diff --git a/xfa/fxfa/app/xfa_ffchoicelist.h b/xfa/fxfa/app/xfa_ffchoicelist.h index c59ca647aa..8f87190b77 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.h +++ b/xfa/fxfa/app/xfa_ffchoicelist.h @@ -13,68 +13,68 @@ class CXFA_FFListBox : public CXFA_FFField { public: CXFA_FFListBox(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFListBox(); - virtual FX_BOOL LoadWidget(); - virtual FX_BOOL OnKillFocus(CXFA_FFWidget* pNewWidget); + ~CXFA_FFListBox() override; - protected: - virtual FX_BOOL CommitData(); - virtual FX_BOOL UpdateFWLData(); - virtual FX_BOOL IsDataChanged(); - uint32_t GetAlignment(); + // CXFA_FFField + FX_BOOL LoadWidget() override; + FX_BOOL OnKillFocus(CXFA_FFWidget* pNewWidget) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessEvent(CFWL_Event* pEvent) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; - public: void OnSelectChanged(IFWL_Widget* pWidget, const CFX_Int32Array& arrSels); void SetItemState(int32_t nIndex, FX_BOOL bSelected); void InsertItem(const CFX_WideStringC& wsLabel, int32_t nIndex = -1); void DeleteItem(int32_t nIndex); - virtual void OnProcessMessage(CFWL_Message* pMessage); - virtual void OnProcessEvent(CFWL_Event* pEvent); - virtual void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); protected: + FX_BOOL CommitData() override; + FX_BOOL UpdateFWLData() override; + FX_BOOL IsDataChanged() override; + + uint32_t GetAlignment(); + IFWL_WidgetDelegate* m_pOldDelegate; }; + class CXFA_FFComboBox : public CXFA_FFField { public: CXFA_FFComboBox(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFComboBox(); - virtual FX_BOOL GetBBox(CFX_RectF& rtBox, - uint32_t dwStatus, - FX_BOOL bDrawFocus = FALSE); - virtual FX_BOOL LoadWidget(); - virtual void UpdateWidgetProperty(); - virtual FX_BOOL OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnKillFocus(CXFA_FFWidget* pNewWidget); - virtual FX_BOOL CanUndo(); - virtual FX_BOOL CanRedo(); - virtual FX_BOOL Undo(); - virtual FX_BOOL Redo(); - - virtual FX_BOOL CanCopy(); - virtual FX_BOOL CanCut(); - virtual FX_BOOL CanPaste(); - virtual FX_BOOL CanSelectAll(); - virtual FX_BOOL Copy(CFX_WideString& wsCopy); - virtual FX_BOOL Cut(CFX_WideString& wsCut); - virtual FX_BOOL Paste(const CFX_WideString& wsPaste); - virtual FX_BOOL SelectAll(); - virtual FX_BOOL Delete(); - virtual FX_BOOL DeSelect(); - void OpenDropDownList(); + ~CXFA_FFComboBox() override; - protected: - virtual FX_BOOL PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL CommitData(); - virtual FX_BOOL UpdateFWLData(); - virtual FX_BOOL IsDataChanged(); - uint32_t GetAlignment(); - void FWLEventSelChange(CXFA_EventParam* pParam); + // CXFA_FFField + FX_BOOL GetBBox(CFX_RectF& rtBox, + uint32_t dwStatus, + FX_BOOL bDrawFocus = FALSE) override; + FX_BOOL LoadWidget() override; + void UpdateWidgetProperty() override; + FX_BOOL OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnKillFocus(CXFA_FFWidget* pNewWidget) override; + FX_BOOL CanUndo() override; + FX_BOOL CanRedo() override; + FX_BOOL Undo() override; + FX_BOOL Redo() override; - CFX_WideString m_wsNewValue; + FX_BOOL CanCopy() override; + FX_BOOL CanCut() override; + FX_BOOL CanPaste() override; + FX_BOOL CanSelectAll() override; + FX_BOOL Copy(CFX_WideString& wsCopy) override; + FX_BOOL Cut(CFX_WideString& wsCut) override; + FX_BOOL Paste(const CFX_WideString& wsPaste) override; + FX_BOOL SelectAll() override; + FX_BOOL Delete() override; + FX_BOOL DeSelect() override; + + // IFWL_WidgetDelegate + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessEvent(CFWL_Event* pEvent) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; + + virtual void OpenDropDownList(); - public: void OnTextChanged(IFWL_Widget* pWidget, const CFX_WideString& wsChanged); void OnSelectChanged(IFWL_Widget* pWidget, const CFX_Int32Array& arrSels, @@ -84,12 +84,18 @@ class CXFA_FFComboBox : public CXFA_FFField { void SetItemState(int32_t nIndex, FX_BOOL bSelected); void InsertItem(const CFX_WideStringC& wsLabel, int32_t nIndex = -1); void DeleteItem(int32_t nIndex); - virtual void OnProcessMessage(CFWL_Message* pMessage); - virtual void OnProcessEvent(CFWL_Event* pEvent); - virtual void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); protected: + // CXFA_FFField + FX_BOOL PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL CommitData() override; + FX_BOOL UpdateFWLData() override; + FX_BOOL IsDataChanged() override; + + uint32_t GetAlignment(); + void FWLEventSelChange(CXFA_EventParam* pParam); + + CFX_WideString m_wsNewValue; IFWL_WidgetDelegate* m_pOldDelegate; }; diff --git a/xfa/fxfa/app/xfa_ffdraw.h b/xfa/fxfa/app/xfa_ffdraw.h index c3c1c14445..ee66871217 100644 --- a/xfa/fxfa/app/xfa_ffdraw.h +++ b/xfa/fxfa/app/xfa_ffdraw.h @@ -13,7 +13,7 @@ class CXFA_FFDraw : public CXFA_FFWidget { public: CXFA_FFDraw(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFDraw(); + ~CXFA_FFDraw() override; }; #endif // XFA_FXFA_APP_XFA_FFDRAW_H_ diff --git a/xfa/fxfa/app/xfa_ffexclgroup.h b/xfa/fxfa/app/xfa_ffexclgroup.h index 6b59f05384..52a8e56466 100644 --- a/xfa/fxfa/app/xfa_ffexclgroup.h +++ b/xfa/fxfa/app/xfa_ffexclgroup.h @@ -13,12 +13,13 @@ class CXFA_FFExclGroup : public CXFA_FFWidget { public: CXFA_FFExclGroup(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFExclGroup(); + ~CXFA_FFExclGroup() override; - virtual void RenderWidget(CFX_Graphics* pGS, - CFX_Matrix* pMatrix = NULL, - uint32_t dwStatus = 0, - int32_t iRotate = 0); + // CXFA_FFWidget + void RenderWidget(CFX_Graphics* pGS, + CFX_Matrix* pMatrix = NULL, + uint32_t dwStatus = 0, + int32_t iRotate = 0) override; }; #endif // XFA_FXFA_APP_XFA_FFEXCLGROUP_H_ diff --git a/xfa/fxfa/app/xfa_fffield.h b/xfa/fxfa/app/xfa_fffield.h index fd6661dea2..3aa358758f 100644 --- a/xfa/fxfa/app/xfa_fffield.h +++ b/xfa/fxfa/app/xfa_fffield.h @@ -18,45 +18,54 @@ class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate { public: CXFA_FFField(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFField(); + ~CXFA_FFField() override; - virtual FX_BOOL GetBBox(CFX_RectF& rtBox, - uint32_t dwStatus, - FX_BOOL bDrawFocus = FALSE); - virtual void RenderWidget(CFX_Graphics* pGS, - CFX_Matrix* pMatrix = NULL, - uint32_t dwStatus = 0, - int32_t iRotate = 0); - virtual FX_BOOL IsLoaded(); - virtual FX_BOOL LoadWidget(); - virtual void UnloadWidget(); - virtual FX_BOOL PerformLayout(); - virtual void UpdateFWL(); - uint32_t UpdateUIProperty(); - virtual FX_BOOL OnMouseEnter(); - virtual FX_BOOL OnMouseExit(); - virtual FX_BOOL OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnLButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnMouseWheel(uint32_t dwFlags, - int16_t zDelta, - FX_FLOAT fx, - FX_FLOAT fy); - virtual FX_BOOL OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnRButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); + // CXFA_FFWidget + FX_BOOL GetBBox(CFX_RectF& rtBox, + uint32_t dwStatus, + FX_BOOL bDrawFocus = FALSE) override; + void RenderWidget(CFX_Graphics* pGS, + CFX_Matrix* pMatrix = NULL, + uint32_t dwStatus = 0, + int32_t iRotate = 0) override; + FX_BOOL IsLoaded() override; + FX_BOOL LoadWidget() override; + void UnloadWidget() override; + FX_BOOL PerformLayout() override; + FX_BOOL OnMouseEnter() override; + FX_BOOL OnMouseExit() override; + FX_BOOL OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnLButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnMouseWheel(uint32_t dwFlags, + int16_t zDelta, + FX_FLOAT fx, + FX_FLOAT fy) override; + FX_BOOL OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnRButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + + FX_BOOL OnSetFocus(CXFA_FFWidget* pOldWidget) override; + FX_BOOL OnKillFocus(CXFA_FFWidget* pNewWidget) override; + FX_BOOL OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) override; + FX_BOOL OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) override; + FX_BOOL OnChar(uint32_t dwChar, uint32_t dwFlags) override; + FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) override; - virtual FX_BOOL OnSetFocus(CXFA_FFWidget* pOldWidget); - virtual FX_BOOL OnKillFocus(CXFA_FFWidget* pNewWidget); - virtual FX_BOOL OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags); - virtual FX_BOOL OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags); - virtual FX_BOOL OnChar(uint32_t dwChar, uint32_t dwFlags); - virtual FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnSetCursor(FX_FLOAT fx, FX_FLOAT fy); + // IFWL_WidgetDelegate + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessEvent(CFWL_Event* pEvent) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; + + void UpdateFWL(); + uint32_t UpdateUIProperty(); protected: - virtual FX_BOOL PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy); + FX_BOOL PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) override; + virtual void SetFWLRect(); void SetFWLThemeProvider(); CFWL_Widget* GetNormalWidget() { return m_pNormalWidget; } @@ -84,13 +93,6 @@ class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate { int32_t iCapPlacement); void SetEditScrollOffset(); - public: - virtual void OnProcessMessage(CFWL_Message* pMessage); - virtual void OnProcessEvent(CFWL_Event* pEvent); - virtual void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); - - protected: CFWL_Widget* m_pNormalWidget; CFX_RectF m_rtUI; CFX_RectF m_rtCaption; diff --git a/xfa/fxfa/app/xfa_ffimage.h b/xfa/fxfa/app/xfa_ffimage.h index 7bbeafc1ac..8771bde2fd 100644 --- a/xfa/fxfa/app/xfa_ffimage.h +++ b/xfa/fxfa/app/xfa_ffimage.h @@ -12,14 +12,16 @@ class CXFA_FFImage : public CXFA_FFDraw { public: CXFA_FFImage(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFImage(); - virtual void RenderWidget(CFX_Graphics* pGS, - CFX_Matrix* pMatrix = NULL, - uint32_t dwStatus = 0, - int32_t iRotate = 0); - virtual FX_BOOL IsLoaded(); - virtual FX_BOOL LoadWidget(); - virtual void UnloadWidget(); + ~CXFA_FFImage() override; + + // CXFA_FFWidget + void RenderWidget(CFX_Graphics* pGS, + CFX_Matrix* pMatrix = NULL, + uint32_t dwStatus = 0, + int32_t iRotate = 0) override; + FX_BOOL IsLoaded() override; + FX_BOOL LoadWidget() override; + void UnloadWidget() override; }; #endif // XFA_FXFA_APP_XFA_FFIMAGE_H_ diff --git a/xfa/fxfa/app/xfa_ffimageedit.h b/xfa/fxfa/app/xfa_ffimageedit.h index fb3e21e19f..5749d52c02 100644 --- a/xfa/fxfa/app/xfa_ffimageedit.h +++ b/xfa/fxfa/app/xfa_ffimageedit.h @@ -12,24 +12,26 @@ class CXFA_FFImageEdit : public CXFA_FFField { public: CXFA_FFImageEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFImageEdit(); - - virtual void RenderWidget(CFX_Graphics* pGS, - CFX_Matrix* pMatrix = NULL, - uint32_t dwStatus = 0, - int32_t iRotate = 0); - virtual FX_BOOL LoadWidget(); - virtual void UnloadWidget(); - virtual FX_BOOL OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual void OnProcessMessage(CFWL_Message* pMessage); - virtual void OnProcessEvent(CFWL_Event* pEvent); - virtual void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + ~CXFA_FFImageEdit() override; + + // CXFA_FFField + void RenderWidget(CFX_Graphics* pGS, + CFX_Matrix* pMatrix = NULL, + uint32_t dwStatus = 0, + int32_t iRotate = 0) override; + FX_BOOL LoadWidget() override; + void UnloadWidget() override; + FX_BOOL OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessEvent(CFWL_Event* pEvent) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: - virtual void SetFWLRect(); - virtual FX_BOOL UpdateFWLData(); - virtual FX_BOOL CommitData(); + void SetFWLRect() override; + FX_BOOL UpdateFWLData() override; + FX_BOOL CommitData() override; + IFWL_WidgetDelegate* m_pOldDelegate; }; diff --git a/xfa/fxfa/app/xfa_ffpageview.cpp b/xfa/fxfa/app/xfa_ffpageview.cpp index ce30d199d5..aef7a30226 100644 --- a/xfa/fxfa/app/xfa_ffpageview.cpp +++ b/xfa/fxfa/app/xfa_ffpageview.cpp @@ -432,3 +432,7 @@ CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetWidget( } return NULL; } + +CXFA_TabParam::CXFA_TabParam() : m_pWidget(NULL) {} + +CXFA_TabParam::~CXFA_TabParam() {} diff --git a/xfa/fxfa/app/xfa_ffpath.h b/xfa/fxfa/app/xfa_ffpath.h index 8152810c74..a56843dbdd 100644 --- a/xfa/fxfa/app/xfa_ffpath.h +++ b/xfa/fxfa/app/xfa_ffpath.h @@ -12,11 +12,13 @@ class CXFA_FFLine : public CXFA_FFDraw { public: CXFA_FFLine(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFLine(); - virtual void RenderWidget(CFX_Graphics* pGS, - CFX_Matrix* pMatrix = NULL, - uint32_t dwStatus = 0, - int32_t iRotate = 0); + ~CXFA_FFLine() override; + + // CXFA_FFWidget + void RenderWidget(CFX_Graphics* pGS, + CFX_Matrix* pMatrix = NULL, + uint32_t dwStatus = 0, + int32_t iRotate = 0) override; private: void GetRectFromHand(CFX_RectF& rect, int32_t iHand, FX_FLOAT fLineWidth); @@ -24,20 +26,25 @@ class CXFA_FFLine : public CXFA_FFDraw { class CXFA_FFArc : public CXFA_FFDraw { public: CXFA_FFArc(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFArc(); - virtual void RenderWidget(CFX_Graphics* pGS, - CFX_Matrix* pMatrix = NULL, - uint32_t dwStatus = 0, - int32_t iRotate = 0); + ~CXFA_FFArc() override; + + // CXFA_FFWidget + void RenderWidget(CFX_Graphics* pGS, + CFX_Matrix* pMatrix = NULL, + uint32_t dwStatus = 0, + int32_t iRotate = 0) override; }; + class CXFA_FFRectangle : public CXFA_FFDraw { public: CXFA_FFRectangle(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFRectangle(); - virtual void RenderWidget(CFX_Graphics* pGS, - CFX_Matrix* pMatrix = NULL, - uint32_t dwStatus = 0, - int32_t iRotate = 0); + ~CXFA_FFRectangle() override; + + // CXFA_FFWidget + void RenderWidget(CFX_Graphics* pGS, + CFX_Matrix* pMatrix = NULL, + uint32_t dwStatus = 0, + int32_t iRotate = 0) override; }; #endif // XFA_FXFA_APP_XFA_FFPATH_H_ diff --git a/xfa/fxfa/app/xfa_ffpushbutton.h b/xfa/fxfa/app/xfa_ffpushbutton.h index 96cf785eb0..3bd37df466 100644 --- a/xfa/fxfa/app/xfa_ffpushbutton.h +++ b/xfa/fxfa/app/xfa_ffpushbutton.h @@ -19,19 +19,21 @@ class CXFA_TextProvider; class CXFA_FFPushButton : public CXFA_FFField { public: CXFA_FFPushButton(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFPushButton(); - virtual void RenderWidget(CFX_Graphics* pGS, - CFX_Matrix* pMatrix = NULL, - uint32_t dwStatus = 0, - int32_t iRotate = 0); - virtual FX_BOOL LoadWidget(); - virtual void UnloadWidget(); - virtual FX_BOOL PerformLayout(); - virtual void UpdateWidgetProperty(); - virtual void OnProcessMessage(CFWL_Message* pMessage); - virtual void OnProcessEvent(CFWL_Event* pEvent); - virtual void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + ~CXFA_FFPushButton() override; + + // CXFA_FFField + void RenderWidget(CFX_Graphics* pGS, + CFX_Matrix* pMatrix = NULL, + uint32_t dwStatus = 0, + int32_t iRotate = 0) override; + FX_BOOL LoadWidget() override; + void UnloadWidget() override; + FX_BOOL PerformLayout() override; + void UpdateWidgetProperty() override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessEvent(CFWL_Event* pEvent) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void LoadHighlightCaption(); @@ -40,6 +42,7 @@ class CXFA_FFPushButton : public CXFA_FFField { FX_FLOAT GetLineWidth(); FX_ARGB GetLineColor(); FX_ARGB GetFillColor(); + CXFA_TextLayout* m_pRolloverTextLayout; CXFA_TextLayout* m_pDownTextLayout; CXFA_TextProvider* m_pDownProvider; diff --git a/xfa/fxfa/app/xfa_ffsignature.h b/xfa/fxfa/app/xfa_ffsignature.h index 01ece76c4f..7291b42f0d 100644 --- a/xfa/fxfa/app/xfa_ffsignature.h +++ b/xfa/fxfa/app/xfa_ffsignature.h @@ -12,32 +12,33 @@ class CXFA_FFSignature final : public CXFA_FFField { public: CXFA_FFSignature(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFSignature(); + ~CXFA_FFSignature() override; - virtual void RenderWidget(CFX_Graphics* pGS, - CFX_Matrix* pMatrix = NULL, - uint32_t dwStatus = 0, - int32_t iRotate = 0); - virtual FX_BOOL LoadWidget(); - virtual FX_BOOL OnMouseEnter(); - virtual FX_BOOL OnMouseExit(); - virtual FX_BOOL OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnLButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnMouseWheel(uint32_t dwFlags, - int16_t zDelta, - FX_FLOAT fx, - FX_FLOAT fy); - virtual FX_BOOL OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnRButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); + // CXFA_FFField + void RenderWidget(CFX_Graphics* pGS, + CFX_Matrix* pMatrix = NULL, + uint32_t dwStatus = 0, + int32_t iRotate = 0) override; + FX_BOOL LoadWidget() override; + FX_BOOL OnMouseEnter() override; + FX_BOOL OnMouseExit() override; + FX_BOOL OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnLButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnMouseWheel(uint32_t dwFlags, + int16_t zDelta, + FX_FLOAT fx, + FX_FLOAT fy) override; + FX_BOOL OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnRButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; - virtual FX_BOOL OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags); - virtual FX_BOOL OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags); - virtual FX_BOOL OnChar(uint32_t dwChar, uint32_t dwFlags); - virtual FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnSetCursor(FX_FLOAT fx, FX_FLOAT fy); + FX_BOOL OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) override; + FX_BOOL OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) override; + FX_BOOL OnChar(uint32_t dwChar, uint32_t dwFlags) override; + FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) override; }; #endif // XFA_FXFA_APP_XFA_FFSIGNATURE_H_ diff --git a/xfa/fxfa/app/xfa_ffsubform.h b/xfa/fxfa/app/xfa_ffsubform.h index fd3da98670..6607edf23b 100644 --- a/xfa/fxfa/app/xfa_ffsubform.h +++ b/xfa/fxfa/app/xfa_ffsubform.h @@ -13,7 +13,7 @@ class CXFA_FFSubForm : public CXFA_FFWidget { public: CXFA_FFSubForm(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFSubForm(); + ~CXFA_FFSubForm() override; }; #endif // XFA_FXFA_APP_XFA_FFSUBFORM_H_ diff --git a/xfa/fxfa/app/xfa_fftext.h b/xfa/fxfa/app/xfa_fftext.h index f505ddb30e..f48840f709 100644 --- a/xfa/fxfa/app/xfa_fftext.h +++ b/xfa/fxfa/app/xfa_fftext.h @@ -12,20 +12,22 @@ class CXFA_FFText : public CXFA_FFDraw { public: CXFA_FFText(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFText(); - virtual FX_BOOL OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy); - virtual void RenderWidget(CFX_Graphics* pGS, - CFX_Matrix* pMatrix = NULL, - uint32_t dwStatus = 0, - int32_t iRotate = 0); - virtual FX_BOOL IsLoaded(); - virtual FX_BOOL PerformLayout(); + ~CXFA_FFText() override; + + // CXFA_FFWidget + FX_BOOL OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy) override; + void RenderWidget(CFX_Graphics* pGS, + CFX_Matrix* pMatrix = NULL, + uint32_t dwStatus = 0, + int32_t iRotate = 0) override; + FX_BOOL IsLoaded() override; + FX_BOOL PerformLayout() override; private: - virtual const FX_WCHAR* GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy); + const FX_WCHAR* GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy); void FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy); }; diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index 171fe8dd36..fd2abe7aba 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -8,7 +8,6 @@ #include -#include "xfa/fwl/basewidget/ifwl_datetimepicker.h" #include "xfa/fwl/basewidget/ifwl_edit.h" #include "xfa/fwl/core/cfwl_message.h" #include "xfa/fwl/core/fwl_noteimp.h" diff --git a/xfa/fxfa/app/xfa_fftextedit.h b/xfa/fxfa/app/xfa_fftextedit.h index 9b73577aab..d7c6667435 100644 --- a/xfa/fxfa/app/xfa_fftextedit.h +++ b/xfa/fxfa/app/xfa_fftextedit.h @@ -16,7 +16,7 @@ class CXFA_FFTextEdit : public CXFA_FFField { CXFA_FFTextEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); ~CXFA_FFTextEdit() override; - // CXFA_FFField: + // CXFA_FFField FX_BOOL LoadWidget() override; void UpdateWidgetProperty() override; FX_BOOL OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; @@ -42,8 +42,6 @@ class CXFA_FFTextEdit : public CXFA_FFField { std::vector& sSuggest) override; FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf, const CFX_ByteStringC& bsReplace) override; - - // IFWL_WidgetDelegate: void OnProcessMessage(CFWL_Message* pMessage) override; void OnProcessEvent(CFWL_Event* pEvent) override; void OnDrawWidget(CFX_Graphics* pGraphics, @@ -58,10 +56,11 @@ class CXFA_FFTextEdit : public CXFA_FFField { std::vector& sSuggest); protected: - uint32_t GetAlignment(); FX_BOOL CommitData() override; FX_BOOL UpdateFWLData() override; FX_BOOL IsDataChanged() override; + + uint32_t GetAlignment(); void ValidateNumberField(const CFX_WideString& wsText); IFWL_WidgetDelegate* m_pOldDelegate; @@ -70,69 +69,75 @@ class CXFA_FFTextEdit : public CXFA_FFField { class CXFA_FFNumericEdit : public CXFA_FFTextEdit { public: CXFA_FFNumericEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFNumericEdit(); - virtual FX_BOOL LoadWidget(); - virtual void UpdateWidgetProperty(); - virtual void OnProcessEvent(CFWL_Event* pEvent); + ~CXFA_FFNumericEdit() override; + + // CXFA_FFTextEdit + FX_BOOL LoadWidget() override; + void UpdateWidgetProperty() override; + void OnProcessEvent(CFWL_Event* pEvent) override; public: FX_BOOL OnValidate(IFWL_Widget* pWidget, CFX_WideString& wsText); }; + class CXFA_FFPasswordEdit : public CXFA_FFTextEdit { public: CXFA_FFPasswordEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFPasswordEdit(); - virtual FX_BOOL LoadWidget(); - virtual void UpdateWidgetProperty(); + ~CXFA_FFPasswordEdit() override; + + // CXFA_FFTextEdit + FX_BOOL LoadWidget() override; + void UpdateWidgetProperty() override; protected: }; + enum XFA_DATETIMETYPE { XFA_DATETIMETYPE_Date = 0, XFA_DATETIMETYPE_Time, XFA_DATETIMETYPE_DateAndTime }; + class CXFA_FFDateTimeEdit : public CXFA_FFTextEdit { public: CXFA_FFDateTimeEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFDateTimeEdit(); - - virtual FX_BOOL GetBBox(CFX_RectF& rtBox, - uint32_t dwStatus, - FX_BOOL bDrawFocus = FALSE); - virtual FX_BOOL LoadWidget(); - virtual void UpdateWidgetProperty(); - - virtual FX_BOOL CanUndo(); - virtual FX_BOOL CanRedo(); - virtual FX_BOOL Undo(); - virtual FX_BOOL Redo(); - - virtual FX_BOOL CanCopy(); - virtual FX_BOOL CanCut(); - virtual FX_BOOL CanPaste(); - virtual FX_BOOL CanSelectAll(); - virtual FX_BOOL Copy(CFX_WideString& wsCopy); - virtual FX_BOOL Cut(CFX_WideString& wsCut); - virtual FX_BOOL Paste(const CFX_WideString& wsPaste); - virtual FX_BOOL SelectAll(); - virtual FX_BOOL Delete(); - virtual FX_BOOL DeSelect(); + ~CXFA_FFDateTimeEdit() override; - protected: - uint32_t GetAlignment(); + // CXFA_FFTextEdit + FX_BOOL GetBBox(CFX_RectF& rtBox, + uint32_t dwStatus, + FX_BOOL bDrawFocus = FALSE) override; + FX_BOOL LoadWidget() override; + void UpdateWidgetProperty() override; - virtual FX_BOOL PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL CommitData(); - virtual FX_BOOL UpdateFWLData(); - virtual FX_BOOL IsDataChanged(); + FX_BOOL CanUndo() override; + FX_BOOL CanRedo() override; + FX_BOOL Undo() override; + FX_BOOL Redo() override; + FX_BOOL CanCopy() override; + FX_BOOL CanCut() override; + FX_BOOL CanPaste() override; + FX_BOOL CanSelectAll() override; + FX_BOOL Copy(CFX_WideString& wsCopy) override; + FX_BOOL Cut(CFX_WideString& wsCut) override; + FX_BOOL Paste(const CFX_WideString& wsPaste) override; + FX_BOOL SelectAll() override; + FX_BOOL Delete() override; + FX_BOOL DeSelect() override; + void OnProcessEvent(CFWL_Event* pEvent) override; - public: void OnSelectChanged(IFWL_Widget* pWidget, int32_t iYear, int32_t iMonth, int32_t iDay); - virtual void OnProcessEvent(CFWL_Event* pEvent); + + protected: + FX_BOOL PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL CommitData() override; + FX_BOOL UpdateFWLData() override; + FX_BOOL IsDataChanged() override; + + uint32_t GetAlignment(); }; #endif // XFA_FXFA_APP_XFA_FFTEXTEDIT_H_ diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index fb4dc8ea6b..7d4116933f 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -95,6 +95,7 @@ FX_BOOL CXFA_FFWidget::GetBBox(CFX_RectF& rtBox, CXFA_WidgetAcc* CXFA_FFWidget::GetDataAcc() { return m_pDataAcc; } + FX_BOOL CXFA_FFWidget::GetToolTip(CFX_WideString& wsToolTip) { if (CXFA_Assist assist = m_pDataAcc->GetAssist()) { if (CXFA_ToolTip toolTip = assist.GetToolTip()) { @@ -260,6 +261,62 @@ FWL_WidgetHit CXFA_FFWidget::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { FX_BOOL CXFA_FFWidget::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) { return FALSE; } +FX_BOOL CXFA_FFWidget::CanUndo() { + return FALSE; +} +FX_BOOL CXFA_FFWidget::CanRedo() { + return FALSE; +} +FX_BOOL CXFA_FFWidget::Undo() { + return FALSE; +} +FX_BOOL CXFA_FFWidget::Redo() { + return FALSE; +} +FX_BOOL CXFA_FFWidget::CanCopy() { + return FALSE; +} +FX_BOOL CXFA_FFWidget::CanCut() { + return FALSE; +} +FX_BOOL CXFA_FFWidget::CanPaste() { + return FALSE; +} +FX_BOOL CXFA_FFWidget::CanSelectAll() { + return FALSE; +} +FX_BOOL CXFA_FFWidget::CanDelete() { + return CanCut(); +} +FX_BOOL CXFA_FFWidget::CanDeSelect() { + return CanCopy(); +} +FX_BOOL CXFA_FFWidget::Copy(CFX_WideString& wsCopy) { + return FALSE; +} +FX_BOOL CXFA_FFWidget::Cut(CFX_WideString& wsCut) { + return FALSE; +} +FX_BOOL CXFA_FFWidget::Paste(const CFX_WideString& wsPaste) { + return FALSE; +} +FX_BOOL CXFA_FFWidget::SelectAll() { + return FALSE; +} +FX_BOOL CXFA_FFWidget::Delete() { + return FALSE; +} +FX_BOOL CXFA_FFWidget::DeSelect() { + return FALSE; +} +FX_BOOL CXFA_FFWidget::GetSuggestWords(CFX_PointF pointf, + std::vector& sSuggest) { + return FALSE; +} +FX_BOOL CXFA_FFWidget::ReplaceSpellCheckWord(CFX_PointF pointf, + const CFX_ByteStringC& bsReplace) { + return FALSE; +} void CXFA_FFWidget::Rotate2Normal(FX_FLOAT& fx, FX_FLOAT& fy) { CFX_Matrix mt; GetRotateMatrix(mt); @@ -379,6 +436,9 @@ FX_BOOL CXFA_FFWidget::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) { CXFA_FFDocView* CXFA_FFWidget::GetDocView() { return m_pDocView; } +void CXFA_FFWidget::SetDocView(CXFA_FFDocView* pDocView) { + m_pDocView = pDocView; +} CXFA_FFDoc* CXFA_FFWidget::GetDoc() { return m_pDocView->GetDoc(); } @@ -1986,3 +2046,9 @@ void XFA_DrawBox(CXFA_Box box, XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags); XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags); } + +CXFA_CalcData::CXFA_CalcData() : m_iRefCount(0) {} + +CXFA_CalcData::~CXFA_CalcData() { + m_Globals.RemoveAll(); +} diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.h b/xfa/fxfa/app/xfa_ffwidgetacc.h index 97514b78db..5f7aec72d9 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.h +++ b/xfa/fxfa/app/xfa_ffwidgetacc.h @@ -16,6 +16,7 @@ enum XFA_TEXTPROVIDERTYPE { XFA_TEXTPROVIDERTYPE_Rollover, XFA_TEXTPROVIDERTYPE_Down, }; + class CXFA_TextProvider { public: CXFA_TextProvider(CXFA_WidgetAcc* pWidgetAcc, diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp index f50bf5bf86..67f96c4e18 100644 --- a/xfa/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/fxfa/app/xfa_fontmgr.cpp @@ -1738,6 +1738,8 @@ const XFA_FONTINFO* XFA_GetFontINFOByFontName( return pFontInfo; } +CXFA_DefFontMgr::CXFA_DefFontMgr() {} + CXFA_DefFontMgr::~CXFA_DefFontMgr() { for (int32_t i = 0; i < m_CacheFonts.GetSize(); i++) m_CacheFonts[i]->Release(); diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index e2e1b29c08..0706988de8 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -120,6 +120,16 @@ uint32_t CXFA_FWLTheme::SetThemeID(IFWL_Widget* pWidget, return 0; } +FWL_Error CXFA_FWLTheme::GetThemeMatrix(IFWL_Widget* pWidget, + CFX_Matrix& matrix) { + return FWL_Error::Succeeded; +} + +FWL_Error CXFA_FWLTheme::SetThemeMatrix(IFWL_Widget* pWidget, + const CFX_Matrix& matrix) { + return FWL_Error::Succeeded; +} + FX_BOOL CXFA_FWLTheme::DrawBackground(CFWL_ThemeBackground* pParams) { return GetTheme(pParams->m_pWidget)->DrawBackground(pParams); } @@ -345,6 +355,11 @@ void* CXFA_FWLTheme::GetCapacity(CFWL_ThemePart* pThemePart, FX_BOOL CXFA_FWLTheme::IsCustomizedLayout(IFWL_Widget* pWidget) { return GetTheme(pWidget)->IsCustomizedLayout(pWidget); } + +FWL_Error CXFA_FWLTheme::GetPartRect(CFWL_ThemePart* pThemePart, + CFX_RectF& rtPart) { + return FWL_Error::Succeeded; +} FWL_Error CXFA_FWLTheme::GetPartRect(CFWL_ThemePart* pThemePart) { CFX_RectF rect; return GetTheme(pThemePart->m_pWidget)->GetPartRect(pThemePart, rect); diff --git a/xfa/fxfa/app/xfa_fwltheme.h b/xfa/fxfa/app/xfa_fwltheme.h index fdd12c37ba..63a4247337 100644 --- a/xfa/fxfa/app/xfa_fwltheme.h +++ b/xfa/fxfa/app/xfa_fwltheme.h @@ -42,22 +42,15 @@ class CXFA_FWLTheme final : public IFWL_ThemeProvider { uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID, FX_BOOL bChildren = TRUE) override; - FWL_Error GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) override { - return FWL_Error::Succeeded; - } + FWL_Error GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) override; FWL_Error SetThemeMatrix(IFWL_Widget* pWidget, - const CFX_Matrix& matrix) override { - return FWL_Error::Succeeded; - } + const CFX_Matrix& matrix) override; FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; FX_BOOL DrawText(CFWL_ThemeText* pParams) override; void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) override; FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget) override; - FWL_Error GetPartRect(CFWL_ThemePart* pThemePart, - CFX_RectF& rtPart) override { - return FWL_Error::Succeeded; - } + FWL_Error GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart) override; FX_BOOL IsInPart(CFWL_ThemePart* pThemePart, FX_FLOAT fx, FX_FLOAT fy) override; @@ -90,7 +83,9 @@ class CXFA_FWLTheme final : public IFWL_ThemeProvider { class CXFA_FWLCheckBoxTP : public CFWL_CheckBoxTP { public: CXFA_FWLCheckBoxTP(); - virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); + + // CFWL_CheckBoxTP + FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; protected: void DrawCheckSign(IFWL_Widget* pWidget, @@ -102,10 +97,10 @@ class CXFA_FWLCheckBoxTP : public CFWL_CheckBoxTP { class CXFA_FWLEditTP : public CFWL_EditTP { public: CXFA_FWLEditTP(); - virtual ~CXFA_FWLEditTP(); + ~CXFA_FWLEditTP() override; - public: - virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); + // CFWL_EditTP + FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; }; #endif // XFA_FXFA_APP_XFA_FWLTHEME_H_ diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp index 4e23fc39f9..8b2871e03c 100644 --- a/xfa/fxfa/app/xfa_textlayout.cpp +++ b/xfa/fxfa/app/xfa_textlayout.cpp @@ -21,6 +21,31 @@ #include "xfa/fxfa/include/xfa_ffdoc.h" #include "xfa/fxfa/include/xfa_fontmgr.h" +CXFA_CSSTagProvider::CXFA_CSSTagProvider() + : m_bTagAvailable(FALSE), m_bContent(FALSE) {} + +CXFA_CSSTagProvider::~CXFA_CSSTagProvider() {} + +XFA_TextPiece::XFA_TextPiece() + : pszText(nullptr), pFont(nullptr), pLinkData(nullptr) {} + +XFA_TextPiece::~XFA_TextPiece() { + if (pLinkData) + pLinkData->Release(); +} + +CXFA_TextParseContext::CXFA_TextParseContext() + : m_pParentStyle(nullptr), + m_ppMatchedDecls(nullptr), + m_dwMatchedDecls(0), + m_eDisplay(FDE_CSSDISPLAY_None) {} + +CXFA_TextParseContext::~CXFA_TextParseContext() { + if (m_pParentStyle) + m_pParentStyle->Release(); + FX_Free(m_ppMatchedDecls); +} + void CXFA_TextParseContext::SetDecls(const CFDE_CSSDeclaration** ppDeclArray, int32_t iDeclCount) { if (iDeclCount <= 0 || !ppDeclArray) @@ -85,6 +110,22 @@ void CXFA_TextParser::InitCSSData(CXFA_TextProvider* pTextProvider) { m_pSelector->UpdateStyleIndex(FDE_CSSMEDIATYPE_ALL); } } + +CXFA_LoaderContext::CXFA_LoaderContext() + : m_bSaveLineHeight(FALSE), + m_fWidth(0), + m_fHeight(0), + m_fLastPos(0), + m_fStartLineOffset(0), + m_iChar(0), + m_iTotalLines(-1), + m_pXMLNode(NULL), + m_pNode(NULL), + m_pParentStyle(NULL), + m_dwFlags(0) {} + +CXFA_LoaderContext::~CXFA_LoaderContext() {} + IFDE_CSSStyleSheet* CXFA_TextParser::LoadDefaultSheetStyle() { static const FX_WCHAR s_pStyle[] = L"html,body,ol,p,ul{display:block}" @@ -1945,3 +1986,106 @@ FX_BOOL CXFA_TextLayout::ToRun(const XFA_TextPiece* pPiece, FX_RTFTEXTOBJ& tr) { tr.iHorizontalScale = pPiece->iHorScale; return TRUE; } + +CXFA_LinkUserData::CXFA_LinkUserData(IFX_MemoryAllocator* pAllocator, + FX_WCHAR* pszText) + : m_pAllocator(pAllocator), m_dwRefCount(1), m_wsURLContent(pszText) {} + +CXFA_LinkUserData::~CXFA_LinkUserData() {} + +uint32_t CXFA_LinkUserData::Retain() { + return ++m_dwRefCount; +} + +uint32_t CXFA_LinkUserData::Release() { + uint32_t dwRefCount = --m_dwRefCount; + if (dwRefCount <= 0) + FXTARGET_DeleteWith(CXFA_LinkUserData, m_pAllocator, this); + return dwRefCount; +} + +const FX_WCHAR* CXFA_LinkUserData::GetLinkURL() { + return m_wsURLContent.c_str(); +} + +CXFA_TextUserData::CXFA_TextUserData(IFX_MemoryAllocator* pAllocator, + IFDE_CSSComputedStyle* pStyle) + : m_pStyle(pStyle), + m_pLinkData(nullptr), + m_pAllocator(pAllocator), + m_dwRefCount(0) { + ASSERT(m_pAllocator); + if (m_pStyle) + m_pStyle->Retain(); +} + +CXFA_TextUserData::CXFA_TextUserData(IFX_MemoryAllocator* pAllocator, + IFDE_CSSComputedStyle* pStyle, + CXFA_LinkUserData* pLinkData) + : m_pStyle(pStyle), + m_pLinkData(pLinkData), + m_pAllocator(pAllocator), + m_dwRefCount(0) { + ASSERT(m_pAllocator); + if (m_pStyle) + m_pStyle->Retain(); +} + +CXFA_TextUserData::~CXFA_TextUserData() { + if (m_pStyle) + m_pStyle->Release(); + if (m_pLinkData) + m_pLinkData->Release(); +} + +uint32_t CXFA_TextUserData::Retain() { + return ++m_dwRefCount; +} + +uint32_t CXFA_TextUserData::Release() { + uint32_t dwRefCount = --m_dwRefCount; + if (dwRefCount == 0) + FXTARGET_DeleteWith(CXFA_TextUserData, m_pAllocator, this); + return dwRefCount; +} + +CXFA_PieceLine::CXFA_PieceLine() {} + +CXFA_PieceLine::~CXFA_PieceLine() {} + +CXFA_TextTabstopsContext::CXFA_TextTabstopsContext() + : m_iTabCount(0), + m_iTabIndex(-1), + m_bTabstops(FALSE), + m_fTabWidth(0), + m_fLeft(0) {} + +CXFA_TextTabstopsContext::~CXFA_TextTabstopsContext() {} + +void CXFA_TextTabstopsContext::Append(uint32_t dwAlign, FX_FLOAT fTabstops) { + int32_t i = 0; + for (i = 0; i < m_iTabCount; i++) { + XFA_TABSTOPS* pTabstop = m_tabstops.GetDataPtr(i); + if (fTabstops < pTabstop->fTabstops) { + break; + } + } + m_tabstops.InsertSpaceAt(i, 1); + XFA_TABSTOPS tabstop; + tabstop.dwAlign = dwAlign; + tabstop.fTabstops = fTabstops; + m_tabstops.SetAt(i, tabstop); + m_iTabCount++; +} + +void CXFA_TextTabstopsContext::RemoveAll() { + m_tabstops.RemoveAll(); + m_iTabCount = 0; +} + +void CXFA_TextTabstopsContext::Reset() { + m_iTabIndex = -1; + m_bTabstops = FALSE; + m_fTabWidth = 0; + m_fLeft = 0; +} diff --git a/xfa/fxfa/app/xfa_textlayout.h b/xfa/fxfa/app/xfa_textlayout.h index 842c6ec731..00e7209e97 100644 --- a/xfa/fxfa/app/xfa_textlayout.h +++ b/xfa/fxfa/app/xfa_textlayout.h @@ -12,8 +12,8 @@ #include "xfa/fde/css/fde_css.h" #include "xfa/fde/fde_gedevice.h" -#include "xfa/fgas/layout/fgas_rtfbreak.h" #include "xfa/fxfa/include/xfa_ffdoc.h" +#include "xfa/fgas/layout/fgas_rtfbreak.h" #include "xfa/fxfa/parser/xfa_object.h" #define XFA_LOADERCNTXTFLG_FILTERSPACE 0x001 @@ -26,12 +26,13 @@ class CXFA_TextTabstopsContext; class CXFA_CSSTagProvider { public: - CXFA_CSSTagProvider() : m_bTagAvailable(FALSE), m_bContent(FALSE) {} - ~CXFA_CSSTagProvider() {} + using AttributeMap = std::map; + + CXFA_CSSTagProvider(); + ~CXFA_CSSTagProvider(); CFX_WideString GetTagName() { return m_wsTagName; } - using AttributeMap = std::map; AttributeMap::iterator begin() { return m_Attributes.begin(); } AttributeMap::iterator end() { return m_Attributes.end(); } @@ -53,16 +54,9 @@ class CXFA_CSSTagProvider { class CXFA_TextParseContext : public CFX_Target { public: - CXFA_TextParseContext() - : m_pParentStyle(nullptr), - m_ppMatchedDecls(nullptr), - m_dwMatchedDecls(0), - m_eDisplay(FDE_CSSDISPLAY_None) {} - ~CXFA_TextParseContext() { - if (m_pParentStyle) - m_pParentStyle->Release(); - FX_Free(m_ppMatchedDecls); - } + CXFA_TextParseContext(); + ~CXFA_TextParseContext() override; + void SetDisplay(FDE_CSSDISPLAY eDisplay) { m_eDisplay = eDisplay; } FDE_CSSDISPLAY GetDisplay() const { return m_eDisplay; } void SetDecls(const CFDE_CSSDeclaration** ppDeclArray, int32_t iDeclCount); @@ -70,6 +64,7 @@ class CXFA_TextParseContext : public CFX_Target { return const_cast(m_ppMatchedDecls); } uint32_t CountDecls() const { return m_dwMatchedDecls; } + IFDE_CSSComputedStyle* m_pParentStyle; protected: @@ -82,6 +77,7 @@ class CXFA_TextParser { public: CXFA_TextParser(); virtual ~CXFA_TextParser(); + void Reset(); void DoParse(CFDE_XMLNode* pXMLContainer, CXFA_TextProvider* pTextProvider); IFDE_CSSComputedStyle* CreateRootStyle(CXFA_TextProvider* pTextProvider); @@ -143,18 +139,9 @@ class CXFA_TextParser { class CXFA_LoaderContext { public: - CXFA_LoaderContext() - : m_bSaveLineHeight(FALSE), - m_fWidth(0), - m_fHeight(0), - m_fLastPos(0), - m_fStartLineOffset(0), - m_iChar(0), - m_iTotalLines(-1), - m_pXMLNode(NULL), - m_pNode(NULL), - m_pParentStyle(NULL), - m_dwFlags(0) {} + CXFA_LoaderContext(); + ~CXFA_LoaderContext(); + FX_BOOL m_bSaveLineHeight; FX_FLOAT m_fWidth; FX_FLOAT m_fHeight; @@ -173,21 +160,14 @@ class CXFA_LoaderContext { class CXFA_LinkUserData : public IFX_Retainable, public CFX_Target { public: - CXFA_LinkUserData(IFX_MemoryAllocator* pAllocator, FX_WCHAR* pszText) - : m_pAllocator(pAllocator), m_dwRefCount(1), m_wsURLContent(pszText) {} - - ~CXFA_LinkUserData() override {} + CXFA_LinkUserData(IFX_MemoryAllocator* pAllocator, FX_WCHAR* pszText); + ~CXFA_LinkUserData() override; // IFX_Retainable: - uint32_t Retain() override { return ++m_dwRefCount; } - uint32_t Release() override { - uint32_t dwRefCount = --m_dwRefCount; - if (dwRefCount <= 0) - FXTARGET_DeleteWith(CXFA_LinkUserData, m_pAllocator, this); - return dwRefCount; - } + uint32_t Retain() override; + uint32_t Release() override; - const FX_WCHAR* GetLinkURL() { return m_wsURLContent.c_str(); } + const FX_WCHAR* GetLinkURL(); protected: IFX_MemoryAllocator* m_pAllocator; @@ -198,41 +178,15 @@ class CXFA_LinkUserData : public IFX_Retainable, public CFX_Target { class CXFA_TextUserData : public IFX_Retainable, public CFX_Target { public: CXFA_TextUserData(IFX_MemoryAllocator* pAllocator, - IFDE_CSSComputedStyle* pStyle) - : m_pStyle(pStyle), - m_pLinkData(nullptr), - m_pAllocator(pAllocator), - m_dwRefCount(0) { - ASSERT(m_pAllocator); - if (m_pStyle) - m_pStyle->Retain(); - } + IFDE_CSSComputedStyle* pStyle); CXFA_TextUserData(IFX_MemoryAllocator* pAllocator, IFDE_CSSComputedStyle* pStyle, - CXFA_LinkUserData* pLinkData) - : m_pStyle(pStyle), - m_pLinkData(pLinkData), - m_pAllocator(pAllocator), - m_dwRefCount(0) { - ASSERT(m_pAllocator); - if (m_pStyle) - m_pStyle->Retain(); - } - ~CXFA_TextUserData() override { - if (m_pStyle) - m_pStyle->Release(); - if (m_pLinkData) - m_pLinkData->Release(); - } + CXFA_LinkUserData* pLinkData); + ~CXFA_TextUserData() override; // IFX_Retainable: - uint32_t Retain() override { return ++m_dwRefCount; } - uint32_t Release() override { - uint32_t dwRefCount = --m_dwRefCount; - if (dwRefCount == 0) - FXTARGET_DeleteWith(CXFA_TextUserData, m_pAllocator, this); - return dwRefCount; - } + uint32_t Retain() override; + uint32_t Release() override; IFDE_CSSComputedStyle* m_pStyle; CXFA_LinkUserData* m_pLinkData; @@ -244,11 +198,8 @@ class CXFA_TextUserData : public IFX_Retainable, public CFX_Target { class XFA_TextPiece : public CFX_Target { public: - XFA_TextPiece() : pszText(nullptr), pFont(nullptr), pLinkData(nullptr) {} - ~XFA_TextPiece() override { - if (pLinkData) - pLinkData->Release(); - } + XFA_TextPiece(); + ~XFA_TextPiece() override; FX_WCHAR* pszText; int32_t iChars; @@ -269,7 +220,9 @@ typedef CFX_ArrayTemplate CXFA_PieceArray; class CXFA_PieceLine : public CFX_Target { public: - CXFA_PieceLine() {} + CXFA_PieceLine(); + ~CXFA_PieceLine() override; + CXFA_PieceArray m_textPieces; CFX_Int32Array m_charCounts; }; @@ -282,37 +235,13 @@ struct XFA_TABSTOPS { class CXFA_TextTabstopsContext { public: - CXFA_TextTabstopsContext() - : m_iTabCount(0), - m_iTabIndex(-1), - m_bTabstops(FALSE), - m_fTabWidth(0), - m_fLeft(0) {} - void Append(uint32_t dwAlign, FX_FLOAT fTabstops) { - int32_t i = 0; - for (i = 0; i < m_iTabCount; i++) { - XFA_TABSTOPS* pTabstop = m_tabstops.GetDataPtr(i); - if (fTabstops < pTabstop->fTabstops) { - break; - } - } - m_tabstops.InsertSpaceAt(i, 1); - XFA_TABSTOPS tabstop; - tabstop.dwAlign = dwAlign; - tabstop.fTabstops = fTabstops; - m_tabstops.SetAt(i, tabstop); - m_iTabCount++; - } - void RemoveAll() { - m_tabstops.RemoveAll(); - m_iTabCount = 0; - } - void Reset() { - m_iTabIndex = -1; - m_bTabstops = FALSE; - m_fTabWidth = 0; - m_fLeft = 0; - } + CXFA_TextTabstopsContext(); + ~CXFA_TextTabstopsContext(); + + void Append(uint32_t dwAlign, FX_FLOAT fTabstops); + void RemoveAll(); + void Reset(); + CFX_ArrayTemplate m_tabstops; int32_t m_iTabCount; int32_t m_iTabIndex; -- cgit v1.2.3