diff options
author | weili <weili@chromium.org> | 2016-06-16 08:00:06 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-16 08:00:06 -0700 |
commit | 47bcd4c5c56cdc2d63a0c2ed4e7f68e6ccf523f6 (patch) | |
tree | 90675d8541871a71c6cd9c64723464878bd49a90 | |
parent | b63068f04681f7ade9c062a442977c660e3503d0 (diff) | |
download | pdfium-chromium/2770.tar.xz |
Make code compile with clang_use_chrome_plugin (part V)chromium/2770
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
63 files changed, 1009 insertions, 614 deletions
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<CPDF_Stream*>& 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 <vector> -#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<CFX_ByteString>& 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<CFX_ByteString>& 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<CFX_ByteString>& 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<CFX_WideString, CFX_WideString>; + + CXFA_CSSTagProvider(); + ~CXFA_CSSTagProvider(); CFX_WideString GetTagName() { return m_wsTagName; } - using AttributeMap = std::map<CFX_WideString, CFX_WideString>; 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<const CFDE_CSSDeclaration**>(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<XFA_TextPiece*> 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<XFA_TABSTOPS> m_tabstops; int32_t m_iTabCount; int32_t m_iTabIndex; diff --git a/xfa/fxfa/fm2js/xfa_expression.cpp b/xfa/fxfa/fm2js/xfa_expression.cpp index 72020c3f0c..ad6acafd48 100644 --- a/xfa/fxfa/fm2js/xfa_expression.cpp +++ b/xfa/fxfa/fm2js/xfa_expression.cpp @@ -120,6 +120,8 @@ CXFA_FMVarExpression::CXFA_FMVarExpression(uint32_t line, m_wsName(wsName), m_pInit(pInit) {} +CXFA_FMVarExpression::~CXFA_FMVarExpression() {} + void CXFA_FMVarExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << FX_WSTRC(L"var "); CFX_WideString tempName(m_wsName); @@ -170,6 +172,8 @@ CXFA_FMExpExpression::CXFA_FMExpExpression(uint32_t line, CXFA_FMSimpleExpression* pExpression) : CXFA_FMExpression(line, XFA_FM_EXPTYPE_EXP), m_pExpression(pExpression) {} +CXFA_FMExpExpression::~CXFA_FMExpExpression() {} + void CXFA_FMExpExpression::ToJavaScript(CFX_WideTextBuf& javascript) { if (m_pExpression->GetOperatorToken() == TOKassign) { m_pExpression->ToJavaScript(javascript); @@ -246,6 +250,8 @@ CXFA_FMDoExpression::CXFA_FMDoExpression(uint32_t line, CXFA_FMExpression* pList) : CXFA_FMExpression(line), m_pList(pList) {} +CXFA_FMDoExpression::~CXFA_FMDoExpression() {} + void CXFA_FMDoExpression::ToJavaScript(CFX_WideTextBuf& javascript) { m_pList->ToJavaScript(javascript); } @@ -263,6 +269,8 @@ CXFA_FMIfExpression::CXFA_FMIfExpression(uint32_t line, m_pIfExpression(pIfExpression), m_pElseExpression(pElseExpression) {} +CXFA_FMIfExpression::~CXFA_FMIfExpression() {} + void CXFA_FMIfExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << FX_WSTRC(L"if ("); if (m_pExpression) { @@ -329,6 +337,8 @@ CXFA_FMWhileExpression::CXFA_FMWhileExpression( m_pCondition(pCondition), m_pExpression(pExpression) {} +CXFA_FMWhileExpression::~CXFA_FMWhileExpression() {} + void CXFA_FMWhileExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << FX_WSTRC(L"while ("); m_pCondition->ToJavaScript(javascript); @@ -394,6 +404,8 @@ CXFA_FMForExpression::CXFA_FMForExpression(uint32_t line, m_pStep(pStep), m_pList(pList) {} +CXFA_FMForExpression::~CXFA_FMForExpression() {} + void CXFA_FMForExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << FX_WSTRC(L"{\nvar "); CFX_WideString tempVariant; diff --git a/xfa/fxfa/fm2js/xfa_expression.h b/xfa/fxfa/fm2js/xfa_expression.h index ff898a9c41..8134988f4e 100644 --- a/xfa/fxfa/fm2js/xfa_expression.h +++ b/xfa/fxfa/fm2js/xfa_expression.h @@ -63,6 +63,8 @@ class CXFA_FMVarExpression : public CXFA_FMExpression { CXFA_FMVarExpression(uint32_t line, const CFX_WideStringC& wsName, CXFA_FMExpression* pInit); + ~CXFA_FMVarExpression() override; + void ToJavaScript(CFX_WideTextBuf& javascript) override; void ToImpliedReturnJS(CFX_WideTextBuf&) override; @@ -74,6 +76,8 @@ class CXFA_FMVarExpression : public CXFA_FMExpression { class CXFA_FMExpExpression : public CXFA_FMExpression { public: CXFA_FMExpExpression(uint32_t line, CXFA_FMSimpleExpression* pExpression); + ~CXFA_FMExpExpression() override; + void ToJavaScript(CFX_WideTextBuf& javascript) override; void ToImpliedReturnJS(CFX_WideTextBuf&) override; @@ -99,6 +103,8 @@ class CXFA_FMBlockExpression : public CXFA_FMExpression { class CXFA_FMDoExpression : public CXFA_FMExpression { public: CXFA_FMDoExpression(uint32_t line, CXFA_FMExpression* pList); + ~CXFA_FMDoExpression() override; + void ToJavaScript(CFX_WideTextBuf& javascript) override; void ToImpliedReturnJS(CFX_WideTextBuf&) override; @@ -112,6 +118,8 @@ class CXFA_FMIfExpression : public CXFA_FMExpression { CXFA_FMSimpleExpression* pExpression, CXFA_FMExpression* pIfExpression, CXFA_FMExpression* pElseExpression); + ~CXFA_FMIfExpression() override; + void ToJavaScript(CFX_WideTextBuf& javascript) override; void ToImpliedReturnJS(CFX_WideTextBuf&) override; @@ -134,6 +142,8 @@ class CXFA_FMWhileExpression : public CXFA_FMLoopExpression { CXFA_FMWhileExpression(uint32_t line, CXFA_FMSimpleExpression* pCodition, CXFA_FMExpression* pExpression); + ~CXFA_FMWhileExpression() override; + void ToJavaScript(CFX_WideTextBuf& javascript) override; void ToImpliedReturnJS(CFX_WideTextBuf&) override; @@ -167,6 +177,8 @@ class CXFA_FMForExpression : public CXFA_FMLoopExpression { int32_t iDirection, CXFA_FMSimpleExpression* pStep, CXFA_FMExpression* pList); + ~CXFA_FMForExpression() override; + void ToJavaScript(CFX_WideTextBuf& javascript) override; void ToImpliedReturnJS(CFX_WideTextBuf&) override; diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.h b/xfa/fxfa/fm2js/xfa_fm2jscontext.h index eb16435f12..344c4bcda8 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.h +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.h @@ -12,6 +12,11 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { public: + CXFA_FM2JSContext(v8::Isolate* pScriptIsolate, + CFXJSE_Context* pScriptContext, + CXFA_Document* pDoc); + ~CXFA_FM2JSContext() override; + static void Abs(CFXJSE_Value* pThis, const CFX_ByteStringC& szFuncName, CFXJSE_Arguments& args); @@ -439,11 +444,6 @@ class CXFA_FM2JSContext : public CFXJSE_HostObject { CFX_WideTextBuf& wsJavascript, CFX_WideString& wsError); - CXFA_FM2JSContext(v8::Isolate* pScriptIsolate, - CFXJSE_Context* pScriptContext, - CXFA_Document* pDoc); - ~CXFA_FM2JSContext(); - void GlobalPropertyGetter(CFXJSE_Value* pValue); private: diff --git a/xfa/fxfa/fm2js/xfa_fmparse.cpp b/xfa/fxfa/fm2js/xfa_fmparse.cpp index 5fd6c06613..ebe68b9408 100644 --- a/xfa/fxfa/fm2js/xfa_fmparse.cpp +++ b/xfa/fxfa/fm2js/xfa_fmparse.cpp @@ -10,6 +10,8 @@ CXFA_FMParse::CXFA_FMParse() : m_pToken(nullptr), m_pErrorInfo(0) {} +CXFA_FMParse::~CXFA_FMParse() {} + int32_t CXFA_FMParse::Init(const CFX_WideStringC& wsFormcalc, CXFA_FMErrorInfo* pErrorInfo) { m_pErrorInfo = pErrorInfo; diff --git a/xfa/fxfa/fm2js/xfa_fmparse.h b/xfa/fxfa/fm2js/xfa_fmparse.h index 3c11a73572..0283edaed0 100644 --- a/xfa/fxfa/fm2js/xfa_fmparse.h +++ b/xfa/fxfa/fm2js/xfa_fmparse.h @@ -15,6 +15,8 @@ class CXFA_FMParse { public: CXFA_FMParse(); + ~CXFA_FMParse(); + int32_t Init(const CFX_WideStringC& wsFormcalc, CXFA_FMErrorInfo* pErrorInfo); void NextToken(); void Check(XFA_FM_TOKEN op); diff --git a/xfa/fxfa/fm2js/xfa_lexer.cpp b/xfa/fxfa/fm2js/xfa_lexer.cpp index f048f42668..e480b37d4c 100644 --- a/xfa/fxfa/fm2js/xfa_lexer.cpp +++ b/xfa/fxfa/fm2js/xfa_lexer.cpp @@ -167,6 +167,8 @@ CXFA_FMLexer::CXFA_FMLexer(const CFX_WideStringC& wsFormCalc, CXFA_FMErrorInfo* pErrorInfo) : m_ptr(wsFormCalc.c_str()), m_uCurrentLine(1), m_pErrorInfo(pErrorInfo) {} +CXFA_FMLexer::~CXFA_FMLexer() {} + CXFA_FMToken* CXFA_FMLexer::NextToken() { m_pToken.reset(Scan()); return m_pToken.get(); diff --git a/xfa/fxfa/fm2js/xfa_lexer.h b/xfa/fxfa/fm2js/xfa_lexer.h index c21c00255a..a910d1790c 100644 --- a/xfa/fxfa/fm2js/xfa_lexer.h +++ b/xfa/fxfa/fm2js/xfa_lexer.h @@ -104,6 +104,8 @@ class CXFA_FMToken { class CXFA_FMLexer { public: CXFA_FMLexer(const CFX_WideStringC& wsFormcalc, CXFA_FMErrorInfo* pErrorInfo); + ~CXFA_FMLexer(); + CXFA_FMToken* NextToken(); uint32_t Number(CXFA_FMToken* t, const FX_WCHAR* p, const FX_WCHAR*& pEnd); uint32_t String(CXFA_FMToken* t, const FX_WCHAR* p, const FX_WCHAR*& pEnd); diff --git a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp index e77623de3a..47bb9df235 100644 --- a/xfa/fxfa/fm2js/xfa_simpleexpression.cpp +++ b/xfa/fxfa/fm2js/xfa_simpleexpression.cpp @@ -137,6 +137,8 @@ CXFA_FMNumberExpression::CXFA_FMNumberExpression(uint32_t line, CFX_WideStringC wsNumber) : CXFA_FMSimpleExpression(line, TOKnumber), m_wsNumber(wsNumber) {} +CXFA_FMNumberExpression::~CXFA_FMNumberExpression() {} + void CXFA_FMNumberExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << m_wsNumber; } @@ -145,6 +147,8 @@ CXFA_FMStringExpression::CXFA_FMStringExpression(uint32_t line, CFX_WideStringC wsString) : CXFA_FMSimpleExpression(line, TOKstring), m_wsString(wsString) {} +CXFA_FMStringExpression::~CXFA_FMStringExpression() {} + void CXFA_FMStringExpression::ToJavaScript(CFX_WideTextBuf& javascript) { CFX_WideString tempStr(m_wsString); if (tempStr.GetLength() > 2) { @@ -177,6 +181,8 @@ CXFA_FMIdentifierExpressionn::CXFA_FMIdentifierExpressionn( : CXFA_FMSimpleExpression(line, TOKidentifier), m_wsIdentifier(wsIdentifier) {} +CXFA_FMIdentifierExpressionn::~CXFA_FMIdentifierExpressionn() {} + void CXFA_FMIdentifierExpressionn::ToJavaScript(CFX_WideTextBuf& javascript) { CFX_WideString tempStr(m_wsIdentifier); if (tempStr == FX_WSTRC(L"$")) { @@ -206,6 +212,8 @@ CXFA_FMUnaryExpression::CXFA_FMUnaryExpression(uint32_t line, CXFA_FMSimpleExpression* pExp) : CXFA_FMSimpleExpression(line, op), m_pExp(pExp) {} +CXFA_FMUnaryExpression::~CXFA_FMUnaryExpression() {} + void CXFA_FMUnaryExpression::ToJavaScript(CFX_WideTextBuf& javascript) {} CXFA_FMBinExpression::CXFA_FMBinExpression(uint32_t line, @@ -214,6 +222,8 @@ CXFA_FMBinExpression::CXFA_FMBinExpression(uint32_t line, CXFA_FMSimpleExpression* pExp2) : CXFA_FMSimpleExpression(line, op), m_pExp1(pExp1), m_pExp2(pExp2) {} +CXFA_FMBinExpression::~CXFA_FMBinExpression() {} + void CXFA_FMBinExpression::ToJavaScript(CFX_WideTextBuf& javascript) {} CXFA_FMAssignExpression::CXFA_FMAssignExpression(uint32_t line, @@ -616,6 +626,8 @@ CXFA_FMDotAccessorExpression::CXFA_FMDotAccessorExpression( : CXFA_FMBinExpression(line, op, pAccessor, pIndexExp), m_wsIdentifier(wsIdentifier) {} +CXFA_FMDotAccessorExpression::~CXFA_FMDotAccessorExpression() {} + void CXFA_FMDotAccessorExpression::ToJavaScript(CFX_WideTextBuf& javascript) { javascript << gs_lpStrExpFuncName[DOT]; javascript << FX_WSTRC(L"("); @@ -692,6 +704,8 @@ CXFA_FMDotDotAccessorExpression::CXFA_FMDotDotAccessorExpression( : CXFA_FMBinExpression(line, op, pAccessor, pIndexExp), m_wsIdentifier(wsIdentifier) {} +CXFA_FMDotDotAccessorExpression::~CXFA_FMDotDotAccessorExpression() {} + void CXFA_FMDotDotAccessorExpression::ToJavaScript( CFX_WideTextBuf& javascript) { javascript << gs_lpStrExpFuncName[DOTDOT]; diff --git a/xfa/fxfa/fm2js/xfa_simpleexpression.h b/xfa/fxfa/fm2js/xfa_simpleexpression.h index 2530128846..27086f4cc4 100644 --- a/xfa/fxfa/fm2js/xfa_simpleexpression.h +++ b/xfa/fxfa/fm2js/xfa_simpleexpression.h @@ -79,7 +79,7 @@ class CXFA_FMNullExpression : public CXFA_FMSimpleExpression { class CXFA_FMNumberExpression : public CXFA_FMSimpleExpression { public: CXFA_FMNumberExpression(uint32_t line, CFX_WideStringC wsNumber); - ~CXFA_FMNumberExpression() override {} + ~CXFA_FMNumberExpression() override; void ToJavaScript(CFX_WideTextBuf& javascript) override; private: @@ -89,7 +89,7 @@ class CXFA_FMNumberExpression : public CXFA_FMSimpleExpression { class CXFA_FMStringExpression : public CXFA_FMSimpleExpression { public: CXFA_FMStringExpression(uint32_t line, CFX_WideStringC wsString); - ~CXFA_FMStringExpression() override {} + ~CXFA_FMStringExpression() override; void ToJavaScript(CFX_WideTextBuf& javascript) override; private: @@ -99,7 +99,7 @@ class CXFA_FMStringExpression : public CXFA_FMSimpleExpression { class CXFA_FMIdentifierExpressionn : public CXFA_FMSimpleExpression { public: CXFA_FMIdentifierExpressionn(uint32_t line, CFX_WideStringC wsIdentifier); - ~CXFA_FMIdentifierExpressionn() override {} + ~CXFA_FMIdentifierExpressionn() override; void ToJavaScript(CFX_WideTextBuf& javascript) override; private: @@ -111,6 +111,8 @@ class CXFA_FMUnaryExpression : public CXFA_FMSimpleExpression { CXFA_FMUnaryExpression(uint32_t line, XFA_FM_TOKEN op, CXFA_FMSimpleExpression* pExp); + ~CXFA_FMUnaryExpression() override; + void ToJavaScript(CFX_WideTextBuf& javascript) override; protected: @@ -123,6 +125,8 @@ class CXFA_FMBinExpression : public CXFA_FMSimpleExpression { XFA_FM_TOKEN op, CXFA_FMSimpleExpression* pExp1, CXFA_FMSimpleExpression* pExp2); + ~CXFA_FMBinExpression() override; + void ToJavaScript(CFX_WideTextBuf& javascript) override; protected: @@ -246,7 +250,7 @@ class CXFA_FMDotAccessorExpression : public CXFA_FMBinExpression { XFA_FM_TOKEN op, CFX_WideStringC wsIdentifier, CXFA_FMSimpleExpression* pIndexExp); - ~CXFA_FMDotAccessorExpression() override {} + ~CXFA_FMDotAccessorExpression() override; void ToJavaScript(CFX_WideTextBuf& javascript) override; private: @@ -274,7 +278,8 @@ class CXFA_FMDotDotAccessorExpression : public CXFA_FMBinExpression { XFA_FM_TOKEN op, CFX_WideStringC wsIdentifier, CXFA_FMSimpleExpression* pIndexExp); - ~CXFA_FMDotDotAccessorExpression() override {} + ~CXFA_FMDotDotAccessorExpression() override; + void ToJavaScript(CFX_WideTextBuf& javascript) override; private: diff --git a/xfa/fxfa/include/fxfa.h b/xfa/fxfa/include/fxfa.h index c62e916a97..4541cba9c2 100644 --- a/xfa/fxfa/include/fxfa.h +++ b/xfa/fxfa/include/fxfa.h @@ -182,10 +182,8 @@ class IXFA_AppProvider { */ virtual void SetAppType(const CFX_WideStringC& wsAppType) = 0; virtual void GetAppType(CFX_WideString& wsAppType) = 0; - virtual void SetFoxitAppType(const CFX_WideStringC& wsFoxitAppType) {} - virtual void GetFoxitAppType(CFX_WideString& wsFoxitAppType) { - wsFoxitAppType.clear(); - } + virtual void SetFoxitAppType(const CFX_WideStringC& wsFoxitAppType) = 0; + virtual void GetFoxitAppType(CFX_WideString& wsFoxitAppType) = 0; /** * Returns the language of the running host application. Such as zh_CN @@ -207,17 +205,13 @@ class IXFA_AppProvider { * Indicates the version number of the current application. Such as 9 */ virtual void GetVersion(CFX_WideString& wsVersion) = 0; - virtual void GetFoxitVersion(CFX_WideString& wsFoxitVersion) { - wsFoxitVersion.clear(); - } + virtual void GetFoxitVersion(CFX_WideString& wsFoxitVersion) = 0; /** * Get application name, such as Phantom. */ virtual void GetAppName(CFX_WideString& wsName) = 0; - virtual void GetFoxitAppName(CFX_WideString& wsFoxitName) { - wsFoxitName.clear(); - } + virtual void GetFoxitAppName(CFX_WideString& wsFoxitName) = 0; /** * Causes the system to play a sound. @@ -328,9 +322,8 @@ class IXFA_DocProvider { virtual FX_BOOL RenderCustomWidget(CXFA_FFWidget* hWidget, CFX_Graphics* pGS, CFX_Matrix* pMatrix, - const CFX_RectF& rtUI) { - return FALSE; - } + const CFX_RectF& rtUI) = 0; + virtual int32_t CountPages(CXFA_FFDoc* hDoc) = 0; virtual int32_t GetCurrentPage(CXFA_FFDoc* hDoc) = 0; virtual void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) = 0; @@ -359,23 +352,17 @@ class IXFA_DocProvider { virtual int32_t SheetInBatch(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) = 0; virtual int32_t Verify(CXFA_FFDoc* hDoc, CXFA_Node* pSigNode, - FX_BOOL bUsed = TRUE) { - return 0; - } + FX_BOOL bUsed = TRUE) = 0; virtual FX_BOOL Sign(CXFA_FFDoc* hDoc, CXFA_NodeList* pNodeList, const CFX_WideStringC& wsExpression, const CFX_WideStringC& wsXMLIdent, const CFX_WideStringC& wsValue = FX_WSTRC(L"open"), - FX_BOOL bUsed = TRUE) { - return 0; - } - virtual CXFA_NodeList* Enumerate(CXFA_FFDoc* hDoc) { return 0; } + FX_BOOL bUsed = TRUE) = 0; + virtual CXFA_NodeList* Enumerate(CXFA_FFDoc* hDoc) = 0; virtual FX_BOOL Clear(CXFA_FFDoc* hDoc, CXFA_Node* pSigNode, - FX_BOOL bCleared = TRUE) { - return 0; - } + FX_BOOL bCleared = TRUE) = 0; virtual void GetURL(CXFA_FFDoc* hDoc, CFX_WideString& wsDocURL) = 0; virtual FX_ARGB GetHighlightColor(CXFA_FFDoc* hDoc) = 0; @@ -400,13 +387,6 @@ class IXFA_DocProvider { const CFX_WideString& wsLink) = 0; }; -class CXFA_RenderOptions { - public: - CXFA_RenderOptions() : m_bPrint(FALSE), m_bHighlight(TRUE) {} - FX_BOOL m_bPrint; - FX_BOOL m_bHighlight; -}; - class IXFA_WidgetIterator { public: virtual ~IXFA_WidgetIterator() {} diff --git a/xfa/fxfa/include/xfa_ffapp.h b/xfa/fxfa/include/xfa_ffapp.h index 1e8bf5b117..5780859a92 100644 --- a/xfa/fxfa/include/xfa_ffapp.h +++ b/xfa/fxfa/include/xfa_ffapp.h @@ -24,11 +24,12 @@ class IFWL_AdapterTimerMgr; class CXFA_FileRead : public IFX_FileRead { public: explicit CXFA_FileRead(const CFX_ArrayTemplate<CPDF_Stream*>& streams); + ~CXFA_FileRead() override; - virtual FX_FILESIZE GetSize(); - virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size); - - virtual void Release() { delete this; } + // IFX_FileRead + FX_FILESIZE GetSize() override; + FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; + void Release() override; protected: CFX_ObjectArray<CPDF_StreamAcc> m_Data; diff --git a/xfa/fxfa/include/xfa_ffpageview.h b/xfa/fxfa/include/xfa_ffpageview.h index ab98d54e62..2c703b0b00 100644 --- a/xfa/fxfa/include/xfa_ffpageview.h +++ b/xfa/fxfa/include/xfa_ffpageview.h @@ -58,14 +58,16 @@ class CXFA_FFPageWidgetIterator : public IXFA_WidgetIterator { CXFA_LayoutItemIterator m_sIterator; }; typedef CFX_ArrayTemplate<CXFA_FFWidget*> CXFA_WidgetArray; + class CXFA_TabParam { public: - CXFA_TabParam() : m_pWidget(NULL) {} - ~CXFA_TabParam() {} + CXFA_TabParam(); + ~CXFA_TabParam(); CXFA_FFWidget* m_pWidget; CXFA_WidgetArray m_Children; }; + class CXFA_FFTabOrderPageWidgetIterator : public IXFA_WidgetIterator { public: CXFA_FFTabOrderPageWidgetIterator(CXFA_FFPageView* pPageView, diff --git a/xfa/fxfa/include/xfa_ffwidget.h b/xfa/fxfa/include/xfa_ffwidget.h index 0e58a3406a..2dc3b947d4 100644 --- a/xfa/fxfa/include/xfa_ffwidget.h +++ b/xfa/fxfa/include/xfa_ffwidget.h @@ -33,8 +33,8 @@ enum XFA_WIDGETITEM { class CXFA_CalcData { public: - CXFA_CalcData() : m_iRefCount(0) {} - ~CXFA_CalcData() { m_Globals.RemoveAll(); } + CXFA_CalcData(); + ~CXFA_CalcData(); CFX_ArrayTemplate<CXFA_WidgetAcc*> m_Globals; int32_t m_iRefCount; @@ -43,23 +43,15 @@ class CXFA_CalcData { class CXFA_FFWidget : public CXFA_ContentLayoutItem { public: CXFA_FFWidget(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFWidget(); - CXFA_FFPageView* GetPageView(); - void SetPageView(CXFA_FFPageView* pPageView); - void GetWidgetRect(CFX_RectF& rtWidget); - CFX_RectF ReCacheWidgetRect(); - uint32_t GetStatus(); - void ModifyStatus(uint32_t dwAdded, uint32_t dwRemoved); + ~CXFA_FFWidget() override; + virtual FX_BOOL GetBBox(CFX_RectF& rtBox, uint32_t dwStatus, FX_BOOL bDrawFocus = FALSE); - CXFA_WidgetAcc* GetDataAcc(); - FX_BOOL GetToolTip(CFX_WideString& wsToolTip); 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(); @@ -87,32 +79,39 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem { 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); - virtual FX_BOOL CanUndo() { return FALSE; } - virtual FX_BOOL CanRedo() { return FALSE; } - virtual FX_BOOL Undo() { return FALSE; } - virtual FX_BOOL Redo() { return FALSE; } - virtual FX_BOOL CanCopy() { return FALSE; } - virtual FX_BOOL CanCut() { return FALSE; } - virtual FX_BOOL CanPaste() { return FALSE; } - virtual FX_BOOL CanSelectAll() { return FALSE; } - virtual FX_BOOL CanDelete() { return CanCut(); } - virtual FX_BOOL CanDeSelect() { return CanCopy(); } - virtual FX_BOOL Copy(CFX_WideString& wsCopy) { return FALSE; } - virtual FX_BOOL Cut(CFX_WideString& wsCut) { return FALSE; } - virtual FX_BOOL Paste(const CFX_WideString& wsPaste) { return FALSE; } - virtual FX_BOOL SelectAll() { return FALSE; } - virtual FX_BOOL Delete() { return FALSE; } - virtual FX_BOOL DeSelect() { return FALSE; } + 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 CanDelete(); + virtual FX_BOOL CanDeSelect(); + 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(); virtual FX_BOOL GetSuggestWords(CFX_PointF pointf, - std::vector<CFX_ByteString>& sSuggest) { - return FALSE; - } + std::vector<CFX_ByteString>& sSuggest); virtual FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf, - const CFX_ByteStringC& bsReplace) { - return FALSE; - } + const CFX_ByteStringC& bsReplace); + + CXFA_FFPageView* GetPageView(); + void SetPageView(CXFA_FFPageView* pPageView); + void GetWidgetRect(CFX_RectF& rtWidget); + CFX_RectF ReCacheWidgetRect(); + uint32_t GetStatus(); + void ModifyStatus(uint32_t dwAdded, uint32_t dwRemoved); + + CXFA_WidgetAcc* GetDataAcc(); + FX_BOOL GetToolTip(CFX_WideString& wsToolTip); + CXFA_FFDocView* GetDocView(); - void SetDocView(CXFA_FFDocView* pDocView) { m_pDocView = pDocView; } + void SetDocView(CXFA_FFDocView* pDocView); CXFA_FFDoc* GetDoc(); CXFA_FFApp* GetApp(); IXFA_AppProvider* GetAppProvider(); @@ -128,6 +127,7 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem { protected: virtual FX_BOOL PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy); + void DrawBorder(CFX_Graphics* pGS, CXFA_Box box, const CFX_RectF& rtBorder, @@ -137,15 +137,16 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem { void GetMinMaxHeight(FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight); void GetRectWithoutRotate(CFX_RectF& rtWidget); bool IsMatchVisibleStatus(uint32_t dwStatus); - void EventKillFocus(); FX_BOOL IsButtonDown(); void SetButtonDown(FX_BOOL bSet); + CXFA_FFDocView* m_pDocView; CXFA_FFPageView* m_pPageView; CXFA_WidgetAcc* m_pDataAcc; CFX_RectF m_rtWidget; }; + int32_t XFA_StrokeTypeSetLineDash(CFX_Graphics* pGraphics, int32_t iStrokeType, int32_t iCapType); diff --git a/xfa/fxfa/include/xfa_fontmgr.h b/xfa/fxfa/include/xfa_fontmgr.h index 121df588d2..2d2a74f2ba 100644 --- a/xfa/fxfa/include/xfa_fontmgr.h +++ b/xfa/fxfa/include/xfa_fontmgr.h @@ -27,7 +27,7 @@ struct XFA_FONTINFO { class CXFA_DefFontMgr { public: - CXFA_DefFontMgr() {} + CXFA_DefFontMgr(); ~CXFA_DefFontMgr(); CFGAS_GEFont* GetFont(CXFA_FFDoc* hDoc, diff --git a/xfa/fxfa/include/xfa_rendercontext.h b/xfa/fxfa/include/xfa_rendercontext.h index 1154b8c5f4..7716c7140b 100644 --- a/xfa/fxfa/include/xfa_rendercontext.h +++ b/xfa/fxfa/include/xfa_rendercontext.h @@ -11,6 +11,14 @@ #include "xfa/fxfa/include/fxfa.h" +class CXFA_RenderOptions { + public: + CXFA_RenderOptions() : m_bPrint(FALSE), m_bHighlight(TRUE) {} + + FX_BOOL m_bPrint; + FX_BOOL m_bHighlight; +}; + class CXFA_RenderContext { public: CXFA_RenderContext(); diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h index d2054cf145..26f397cb64 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.h +++ b/xfa/fxfa/parser/cxfa_widgetdata.h @@ -61,7 +61,6 @@ class CXFA_WidgetData : public CXFA_Data { CXFA_Validate GetValidate(FX_BOOL bModified = FALSE); CXFA_Bind GetBind(FX_BOOL bModified = FALSE); CXFA_Assist GetAssist(FX_BOOL bModified = FALSE); - uint32_t GetRelevantStatus(); FX_BOOL GetWidth(FX_FLOAT& fWidth); FX_BOOL GetHeight(FX_FLOAT& fHeight); FX_BOOL GetMinWidth(FX_FLOAT& fMinWidth); diff --git a/xfa/fxfa/parser/xfa_basic_imp.cpp b/xfa/fxfa/parser/xfa_basic_imp.cpp index f7c2606501..8367462b60 100644 --- a/xfa/fxfa/parser/xfa_basic_imp.cpp +++ b/xfa/fxfa/parser/xfa_basic_imp.cpp @@ -553,6 +553,9 @@ int32_t CXFA_WideTextRead::GetPosition() { FX_BOOL CXFA_WideTextRead::IsEOF() const { return m_iPosition >= m_wsBuffer.GetLength(); } +int32_t CXFA_WideTextRead::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { + return 0; +} int32_t CXFA_WideTextRead::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, FX_BOOL& bEOS, @@ -566,9 +569,36 @@ int32_t CXFA_WideTextRead::ReadString(FX_WCHAR* pStr, bEOS = IsEOF(); return iMaxLength; } +int32_t CXFA_WideTextRead::WriteData(const uint8_t* pBuffer, + int32_t iBufferSize) { + return 0; +} +int32_t CXFA_WideTextRead::WriteString(const FX_WCHAR* pStr, int32_t iLength) { + return 0; +} +FX_BOOL CXFA_WideTextRead::SetLength(int32_t iLength) { + return FALSE; +} +int32_t CXFA_WideTextRead::GetBOM(uint8_t bom[4]) const { + return 0; +} uint16_t CXFA_WideTextRead::GetCodePage() const { return (sizeof(FX_WCHAR) == 2) ? FX_CODEPAGE_UTF16LE : FX_CODEPAGE_UTF32LE; } uint16_t CXFA_WideTextRead::SetCodePage(uint16_t wCodePage) { return GetCodePage(); } + +IFX_Stream* CXFA_WideTextRead::CreateSharedStream(uint32_t dwAccess, + int32_t iOffset, + int32_t iLength) { + return NULL; +} + +void CXFA_WideTextRead::Lock() {} + +void CXFA_WideTextRead::Unlock() {} + +CFX_WideString CXFA_WideTextRead::GetSrcText() const { + return m_wsBuffer; +} diff --git a/xfa/fxfa/parser/xfa_basic_imp.h b/xfa/fxfa/parser/xfa_basic_imp.h index 108b00d00f..fdb77a9d07 100644 --- a/xfa/fxfa/parser/xfa_basic_imp.h +++ b/xfa/fxfa/parser/xfa_basic_imp.h @@ -24,43 +24,35 @@ const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute( class CXFA_WideTextRead : public IFX_Stream { public: CXFA_WideTextRead(const CFX_WideString& wsBuffer); - virtual void Release(); - virtual IFX_Stream* Retain(); - virtual uint32_t GetAccessModes() const; - virtual int32_t GetLength() const; - virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset); - virtual int32_t GetPosition(); - virtual FX_BOOL IsEOF() const; - - virtual int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) { return 0; } - virtual int32_t ReadString(FX_WCHAR* pStr, - int32_t iMaxLength, - FX_BOOL& bEOS, - int32_t const* pByteSize = NULL); - virtual int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) { - return 0; - } - virtual int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) { - return 0; - } - virtual void Flush() {} - virtual FX_BOOL SetLength(int32_t iLength) { return FALSE; } - - virtual int32_t GetBOM(uint8_t bom[4]) const { return 0; } - virtual uint16_t GetCodePage() const; - virtual uint16_t SetCodePage(uint16_t wCodePage); - - virtual void Lock() {} - virtual void Unlock() {} - - virtual IFX_Stream* CreateSharedStream(uint32_t dwAccess, - int32_t iOffset, - int32_t iLength) { - return NULL; - } - - CFX_WideString GetSrcText() const { return m_wsBuffer; } + // IFX_Stream + void Release() override; + IFX_Stream* Retain() override; + uint32_t GetAccessModes() const override; + int32_t GetLength() const override; + int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override; + int32_t GetPosition() override; + FX_BOOL IsEOF() const override; + int32_t ReadData(uint8_t* pBuffer, int32_t iBufferSize) override; + int32_t ReadString(FX_WCHAR* pStr, + int32_t iMaxLength, + FX_BOOL& bEOS, + int32_t const* pByteSize = NULL) override; + int32_t WriteData(const uint8_t* pBuffer, int32_t iBufferSize) override; + int32_t WriteString(const FX_WCHAR* pStr, int32_t iLength) override; + void Flush() override {} + FX_BOOL SetLength(int32_t iLength) override; + int32_t GetBOM(uint8_t bom[4]) const override; + uint16_t GetCodePage() const override; + uint16_t SetCodePage(uint16_t wCodePage) override; + IFX_Stream* CreateSharedStream(uint32_t dwAccess, + int32_t iOffset, + int32_t iLength) override; + + virtual void Lock(); + virtual void Unlock(); + + CFX_WideString GetSrcText() const; protected: CFX_WideString m_wsBuffer; diff --git a/xfa/fxfa/parser/xfa_doclayout.h b/xfa/fxfa/parser/xfa_doclayout.h index a0b29e5ff8..cc0cf82417 100644 --- a/xfa/fxfa/parser/xfa_doclayout.h +++ b/xfa/fxfa/parser/xfa_doclayout.h @@ -66,7 +66,7 @@ class CXFA_ContainerLayoutItem : public CXFA_LayoutItem { class CXFA_ContentLayoutItem : public CXFA_LayoutItem { public: CXFA_ContentLayoutItem(CXFA_Node* pNode); - virtual ~CXFA_ContentLayoutItem(); + ~CXFA_ContentLayoutItem() override; CXFA_ContentLayoutItem* m_pPrev; CXFA_ContentLayoutItem* m_pNext; diff --git a/xfa/fxfa/parser/xfa_document.h b/xfa/fxfa/parser/xfa_document.h index 2890a6677c..39068c7076 100644 --- a/xfa/fxfa/parser/xfa_document.h +++ b/xfa/fxfa/parser/xfa_document.h @@ -57,10 +57,12 @@ class CScript_HostPseudoModel; class CScript_LogPseudoModel; class CScript_LayoutPseudoModel; class CScript_SignaturePseudoModel; + class CXFA_Document { public: CXFA_Document(CXFA_DocumentParser* pParser); ~CXFA_Document(); + CXFA_Node* GetRoot() const { return m_pRootNode; } CXFA_DocumentParser* GetParser() const { return m_pParser; } CXFA_FFNotify* GetNotify() const; diff --git a/xfa/fxfa/parser/xfa_layout_appadapter.h b/xfa/fxfa/parser/xfa_layout_appadapter.h index 1bae22ee32..d41b90a9c7 100644 --- a/xfa/fxfa/parser/xfa_layout_appadapter.h +++ b/xfa/fxfa/parser/xfa_layout_appadapter.h @@ -27,6 +27,7 @@ class CXFA_TraverseStrategy_PageAreaContainerLayoutItem { return static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem->m_pParent); } }; + class CXFA_TraverseStrategy_ContentAreaContainerLayoutItem { public: static inline CXFA_ContainerLayoutItem* GetFirstChild( @@ -56,6 +57,7 @@ class CXFA_TraverseStrategy_ContentAreaContainerLayoutItem { return static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem->m_pParent); } }; + class CXFA_TraverseStrategy_ContentLayoutItem { public: static inline CXFA_ContentLayoutItem* GetFirstChild( diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp index 509bf630e9..f44435a40f 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp @@ -77,6 +77,9 @@ CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode, m_pOldLayoutItem = (CXFA_ContentLayoutItem*)m_pFormNode->GetUserData(XFA_LAYOUTITEMKEY); } + +CXFA_ItemLayoutProcessor::~CXFA_ItemLayoutProcessor() {} + CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( CXFA_Node* pFormNode) { if (!pFormNode) { diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.h b/xfa/fxfa/parser/xfa_layout_itemlayout.h index f7376d250e..fc279893c8 100644 --- a/xfa/fxfa/parser/xfa_layout_itemlayout.h +++ b/xfa/fxfa/parser/xfa_layout_itemlayout.h @@ -63,6 +63,7 @@ class CXFA_LayoutContext { class CXFA_ItemLayoutProcessor { public: CXFA_ItemLayoutProcessor(CXFA_Node* pNode, CXFA_LayoutPageMgr* pPageMgr); + ~CXFA_ItemLayoutProcessor(); XFA_ItemLayoutProcessorResult DoLayout( FX_BOOL bUseBreakControl, diff --git a/xfa/fxfa/parser/xfa_layout_pagemgr_new.h b/xfa/fxfa/parser/xfa_layout_pagemgr_new.h index a82c152df9..b992a228dd 100644 --- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.h +++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.h @@ -22,10 +22,12 @@ class CXFA_ContainerRecord { CXFA_ContainerLayoutItem* pCurPageArea; CXFA_ContainerLayoutItem* pCurContentArea; }; + class CXFA_LayoutPageMgr { public: CXFA_LayoutPageMgr(CXFA_LayoutProcessor* pLayoutProcessor); ~CXFA_LayoutPageMgr(); + FX_BOOL InitLayoutPage(CXFA_Node* pFormNode); FX_BOOL PrepareFirstPage(CXFA_Node* pRootSubform); FX_FLOAT GetAvailHeight(); diff --git a/xfa/fxfa/parser/xfa_locale.h b/xfa/fxfa/parser/xfa_locale.h index 522df19a82..5a79e20a3f 100644 --- a/xfa/fxfa/parser/xfa_locale.h +++ b/xfa/fxfa/parser/xfa_locale.h @@ -13,32 +13,35 @@ class CXFA_XMLLocale : public IFX_Locale { public: CXFA_XMLLocale(CXML_Element* pLocaleData); - virtual void Release(); - virtual CFX_WideString GetName(); - virtual void GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, - CFX_WideString& wsNumSymbol) const; - - virtual void GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const; - virtual void GetMonthName(int32_t nMonth, - CFX_WideString& wsMonthName, - FX_BOOL bAbbr = TRUE) const; - virtual void GetDayName(int32_t nWeek, - CFX_WideString& wsDayName, - FX_BOOL bAbbr = TRUE) const; - virtual void GetMeridiemName(CFX_WideString& wsMeridiemName, - FX_BOOL bAM = TRUE) const; - virtual void GetTimeZone(FX_TIMEZONE& tz) const; - virtual void GetEraName(CFX_WideString& wsEraName, FX_BOOL bAD = TRUE) const; - - virtual void GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, - CFX_WideString& wsPattern) const; - virtual void GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, - CFX_WideString& wsPattern) const; - virtual void GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, - CFX_WideString& wsPattern) const; + + // IFX_Locale + void Release() override; + CFX_WideString GetName() override; + void GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, + CFX_WideString& wsNumSymbol) const override; + + void GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const override; + void GetMonthName(int32_t nMonth, + CFX_WideString& wsMonthName, + FX_BOOL bAbbr = TRUE) const override; + void GetDayName(int32_t nWeek, + CFX_WideString& wsDayName, + FX_BOOL bAbbr = TRUE) const override; + void GetMeridiemName(CFX_WideString& wsMeridiemName, + FX_BOOL bAM = TRUE) const override; + void GetTimeZone(FX_TIMEZONE& tz) const override; + void GetEraName(CFX_WideString& wsEraName, FX_BOOL bAD = TRUE) const override; + + void GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, + CFX_WideString& wsPattern) const override; + void GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, + CFX_WideString& wsPattern) const override; + void GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, + CFX_WideString& wsPattern) const override; protected: - ~CXFA_XMLLocale(); + ~CXFA_XMLLocale() override; + void GetPattern(CXML_Element* pElement, const CFX_ByteStringC& bsTag, const CFX_WideStringC& wsName, @@ -50,35 +53,39 @@ class CXFA_XMLLocale : public IFX_Locale { private: CXML_Element* m_pLocaleData; }; + class CXFA_NodeLocale : public IFX_Locale { public: CXFA_NodeLocale(CXFA_Node* pLocale); - virtual void Release(); - virtual CFX_WideString GetName(); - virtual void GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, - CFX_WideString& wsNumSymbol) const; - - virtual void GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const; - virtual void GetMonthName(int32_t nMonth, - CFX_WideString& wsMonthName, - FX_BOOL bAbbr = TRUE) const; - virtual void GetDayName(int32_t nWeek, - CFX_WideString& wsDayName, - FX_BOOL bAbbr = TRUE) const; - virtual void GetMeridiemName(CFX_WideString& wsMeridiemName, - FX_BOOL bAM = TRUE) const; - virtual void GetTimeZone(FX_TIMEZONE& tz) const; - virtual void GetEraName(CFX_WideString& wsEraName, FX_BOOL bAD = TRUE) const; - - virtual void GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, - CFX_WideString& wsPattern) const; - virtual void GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, - CFX_WideString& wsPattern) const; - virtual void GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, - CFX_WideString& wsPattern) const; + + // IFX_Locale + void Release() override; + CFX_WideString GetName() override; + void GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, + CFX_WideString& wsNumSymbol) const override; + + void GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const override; + void GetMonthName(int32_t nMonth, + CFX_WideString& wsMonthName, + FX_BOOL bAbbr = TRUE) const override; + void GetDayName(int32_t nWeek, + CFX_WideString& wsDayName, + FX_BOOL bAbbr = TRUE) const override; + void GetMeridiemName(CFX_WideString& wsMeridiemName, + FX_BOOL bAM = TRUE) const override; + void GetTimeZone(FX_TIMEZONE& tz) const override; + void GetEraName(CFX_WideString& wsEraName, FX_BOOL bAD = TRUE) const override; + + void GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, + CFX_WideString& wsPattern) const override; + void GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, + CFX_WideString& wsPattern) const override; + void GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, + CFX_WideString& wsPattern) const override; protected: - ~CXFA_NodeLocale(); + ~CXFA_NodeLocale() override; + CXFA_Node* GetNodeByName(CXFA_Node* pParent, const CFX_WideStringC& wsName) const; CFX_WideString GetSymbol(XFA_ELEMENT eElement, diff --git a/xfa/fxfa/parser/xfa_localemgr.h b/xfa/fxfa/parser/xfa_localemgr.h index a3a1d4c2b9..7051fc9ac3 100644 --- a/xfa/fxfa/parser/xfa_localemgr.h +++ b/xfa/fxfa/parser/xfa_localemgr.h @@ -33,14 +33,15 @@ class IFX_Locale; class CXFA_LocaleMgr : public IFX_LocaleMgr { public: CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid); + ~CXFA_LocaleMgr() override; + // IFX_LocaleMgr void Release() override; uint16_t GetDefLocaleID() override; IFX_Locale* GetDefLocale() override; IFX_Locale* GetLocale(uint16_t lcid) override; IFX_Locale* GetLocaleByName(const CFX_WideString& wsLocaleName) override; - ~CXFA_LocaleMgr(); void SetDefLocale(IFX_Locale* pLocale); CFX_WideStringC GetConfigLocaleName(CXFA_Node* pConfig); diff --git a/xfa/fxfa/parser/xfa_object.h b/xfa/fxfa/parser/xfa_object.h index 2cd09df15c..b5c31cfbb2 100644 --- a/xfa/fxfa/parser/xfa_object.h +++ b/xfa/fxfa/parser/xfa_object.h @@ -45,7 +45,7 @@ enum XFA_OBJECTTYPE { class CXFA_Object : public CFXJSE_HostObject { public: CXFA_Object(CXFA_Document* pDocument, uint32_t uFlags); - virtual ~CXFA_Object() {} + ~CXFA_Object() override; CXFA_Document* GetDocument() const { return m_pDocument; } uint32_t GetFlag() const { return m_uFlags; } @@ -127,6 +127,9 @@ struct XFA_MAPDATABLOCK { }; struct XFA_MAPMODULEDATA { + XFA_MAPMODULEDATA(); + ~XFA_MAPMODULEDATA(); + CFX_MapPtrToPtr m_ValueMap; CFX_MapPtrTemplate<void*, XFA_MAPDATABLOCK*> m_BufferMap; }; @@ -134,6 +137,7 @@ struct XFA_MAPMODULEDATA { #define XFA_CalcRefCount (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'R') #define XFA_CalcData (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'C') #define XFA_LAYOUTITEMKEY (void*)(uintptr_t) FXBSTR_ID('L', 'Y', 'I', 'M') + class CXFA_Node : public CXFA_Object { public: XFA_ELEMENT GetClassID() const { return (XFA_ELEMENT)m_eNodeClass; } @@ -649,42 +653,39 @@ class CXFA_Node : public CXFA_Object { CXFA_Node* m_pAuxNode; XFA_MAPMODULEDATA* m_pMapModuleData; }; + class CXFA_OrdinaryObject : public CXFA_Object { public: - CXFA_OrdinaryObject(CXFA_Document* pDocument, XFA_ELEMENT eElement) - : CXFA_Object(pDocument, XFA_OBJECTTYPE_OrdinaryObject), - m_uScriptHash(0) { - m_eNodeClass = eElement; - } - XFA_ELEMENT GetClassID() const { return (XFA_ELEMENT)m_eNodeClass; } - uint32_t GetScriptObjHash() { return m_uScriptHash; } + CXFA_OrdinaryObject(CXFA_Document* pDocument, XFA_ELEMENT eElement); + ~CXFA_OrdinaryObject() override; + + XFA_ELEMENT GetClassID() const; + uint32_t GetScriptObjHash() const; protected: XFA_ELEMENT m_eNodeClass; uint32_t m_uScriptHash; }; + class CXFA_ThisProxy : public CXFA_Object { public: - CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) - : CXFA_Object(pThisNode->GetDocument(), XFA_OBJECTTYPE_VariablesThis), - m_pThisNode(NULL), - m_pScriptNode(NULL) { - m_pThisNode = pThisNode; - m_pScriptNode = pScriptNode; - } - ~CXFA_ThisProxy() override {} - CXFA_Node* GetThisNode() { return m_pThisNode; } - CXFA_Node* GetScriptNode() { return m_pScriptNode; } + CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode); + ~CXFA_ThisProxy() override; + + CXFA_Node* GetThisNode() const; + CXFA_Node* GetScriptNode() const; private: CXFA_Node* m_pThisNode; CXFA_Node* m_pScriptNode; }; + class CXFA_NodeList : public CXFA_Object { public: explicit CXFA_NodeList(CXFA_Document* pDocument); - virtual ~CXFA_NodeList() {} - XFA_ELEMENT GetClassID() const { return XFA_ELEMENT_NodeList; } + ~CXFA_NodeList() override; + + XFA_ELEMENT GetClassID() const; CXFA_Node* NamedItem(const CFX_WideStringC& wsName); virtual int32_t GetLength() = 0; virtual FX_BOOL Append(CXFA_Node* pNode) = 0; @@ -702,28 +703,35 @@ class CXFA_NodeList : public CXFA_Object { FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute); }; + class CXFA_ArrayNodeList : public CXFA_NodeList { public: explicit CXFA_ArrayNodeList(CXFA_Document* pDocument); + ~CXFA_ArrayNodeList() override; + + // From CXFA_NodeList. + int32_t GetLength() override; + FX_BOOL Append(CXFA_Node* pNode) override; + FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override; + FX_BOOL Remove(CXFA_Node* pNode) override; + CXFA_Node* Item(int32_t iIndex) override; + void SetArrayNodeList(const CXFA_NodeArray& srcArray); - virtual int32_t GetLength(); - virtual FX_BOOL Append(CXFA_Node* pNode); - virtual FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode); - virtual FX_BOOL Remove(CXFA_Node* pNode); - virtual CXFA_Node* Item(int32_t iIndex); protected: CXFA_NodeArray m_array; }; + class CXFA_AttachNodeList : public CXFA_NodeList { public: CXFA_AttachNodeList(CXFA_Document* pDocument, CXFA_Node* pAttachNode); - virtual int32_t GetLength(); - virtual FX_BOOL Append(CXFA_Node* pNode); - virtual FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode); - virtual FX_BOOL Remove(CXFA_Node* pNode); - virtual CXFA_Node* Item(int32_t iIndex); + // From CXFA_NodeList. + int32_t GetLength() override; + FX_BOOL Append(CXFA_Node* pNode) override; + FX_BOOL Insert(CXFA_Node* pNewNode, CXFA_Node* pBeforeNode) override; + FX_BOOL Remove(CXFA_Node* pNode) override; + CXFA_Node* Item(int32_t iIndex) override; protected: CXFA_Node* m_pAttachNode; diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index 0f36d68aa6..02617f14b9 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -59,6 +59,8 @@ XFA_MAPDATABLOCKCALLBACKINFO deleteBindItemCallBack = { CXFA_Object::CXFA_Object(CXFA_Document* pDocument, uint32_t uFlags) : m_pDocument(pDocument), m_uFlags(uFlags) {} +CXFA_Object::~CXFA_Object() {} + void CXFA_Object::GetClassName(CFX_WideStringC& wsName) const { wsName = XFA_GetElementByID(GetClassID())->pName; } @@ -107,6 +109,10 @@ void CXFA_Object::ThrowException(int32_t iStringID, ...) { FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); } +XFA_MAPMODULEDATA::XFA_MAPMODULEDATA() {} + +XFA_MAPMODULEDATA::~XFA_MAPMODULEDATA() {} + CXFA_Node::CXFA_Node(CXFA_Document* pDoc, uint16_t ePacket, XFA_ELEMENT eElement) @@ -5084,11 +5090,50 @@ void CXFA_Node::MoveBufferMapData(CXFA_Node* pSrcModule, } pSrcModule->MoveBufferMapData(pDstModule, pKey); } + +CXFA_OrdinaryObject::CXFA_OrdinaryObject(CXFA_Document* pDocument, + XFA_ELEMENT eElement) + : CXFA_Object(pDocument, XFA_OBJECTTYPE_OrdinaryObject), m_uScriptHash(0) { + m_eNodeClass = eElement; +} + +CXFA_OrdinaryObject::~CXFA_OrdinaryObject() {} + +XFA_ELEMENT CXFA_OrdinaryObject::GetClassID() const { + return m_eNodeClass; +} + +uint32_t CXFA_OrdinaryObject::GetScriptObjHash() const { + return m_uScriptHash; +} + +CXFA_ThisProxy::CXFA_ThisProxy(CXFA_Node* pThisNode, CXFA_Node* pScriptNode) + : CXFA_Object(pThisNode->GetDocument(), XFA_OBJECTTYPE_VariablesThis), + m_pThisNode(NULL), + m_pScriptNode(NULL) { + m_pThisNode = pThisNode; + m_pScriptNode = pScriptNode; +} + +CXFA_ThisProxy::~CXFA_ThisProxy() {} + +CXFA_Node* CXFA_ThisProxy::GetThisNode() const { + return m_pThisNode; +} + +CXFA_Node* CXFA_ThisProxy::GetScriptNode() const { + return m_pScriptNode; +} + CXFA_NodeList::CXFA_NodeList(CXFA_Document* pDocument) : CXFA_Object(pDocument, XFA_OBJECTTYPE_NodeList) { m_pDocument->GetScriptContext()->AddToCacheList( std::unique_ptr<CXFA_NodeList>(this)); } +CXFA_NodeList::~CXFA_NodeList() {} +XFA_ELEMENT CXFA_NodeList::GetClassID() const { + return XFA_ELEMENT_NodeList; +} CXFA_Node* CXFA_NodeList::NamedItem(const CFX_WideStringC& wsName) { uint32_t dwHashCode = FX_HashCode_GetW(wsName, false); int32_t iCount = GetLength(); @@ -5180,6 +5225,9 @@ void CXFA_NodeList::Script_ListClass_Length(CFXJSE_Value* pValue, } CXFA_ArrayNodeList::CXFA_ArrayNodeList(CXFA_Document* pDocument) : CXFA_NodeList(pDocument) {} + +CXFA_ArrayNodeList::~CXFA_ArrayNodeList() {} + void CXFA_ArrayNodeList::SetArrayNodeList(const CXFA_NodeArray& srcArray) { if (srcArray.GetSize() > 0) { m_array.Copy(srcArray); diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp index 748cca5cad..9cc324ae9d 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.cpp +++ b/xfa/fxfa/parser/xfa_parser_imp.cpp @@ -37,6 +37,9 @@ CXFA_SimpleParser::CXFA_SimpleParser(CXFA_Document* pFactory, CXFA_SimpleParser::~CXFA_SimpleParser() { CloseParser(); } +void CXFA_SimpleParser::Release() { + delete this; +} void CXFA_SimpleParser::SetFactory(CXFA_Document* pFactory) { m_pFactory = pFactory; } @@ -191,6 +194,18 @@ void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode, } } +CXFA_Document* CXFA_SimpleParser::GetFactory() const { + return m_pFactory; +} + +CXFA_Node* CXFA_SimpleParser::GetRootNode() const { + return m_pRootNode; +} + +CFDE_XMLDoc* CXFA_SimpleParser::GetXMLDoc() const { + return m_pXMLDoc; +} + FX_BOOL XFA_FDEExtension_ResolveNamespaceQualifier( CFDE_XMLElement* pNode, const CFX_WideStringC& wsQualifier, @@ -1347,6 +1362,10 @@ CXFA_DocumentParser::CXFA_DocumentParser(CXFA_FFNotify* pNotify) CXFA_DocumentParser::~CXFA_DocumentParser() { CloseParser(); } + +void CXFA_DocumentParser::Release() { + delete this; +} int32_t CXFA_DocumentParser::StartParse(IFX_FileRead* pStream, XFA_XDPPACKET ePacketID) { CloseParser(); @@ -1388,6 +1407,26 @@ void CXFA_DocumentParser::ConstructXFANode(CXFA_Node* pXFANode, } } +CXFA_Document* CXFA_DocumentParser::GetFactory() const { + return m_nodeParser.GetFactory(); +} + +CXFA_Node* CXFA_DocumentParser::GetRootNode() const { + return m_nodeParser.GetRootNode(); +} + +CFDE_XMLDoc* CXFA_DocumentParser::GetXMLDoc() const { + return m_nodeParser.GetXMLDoc(); +} + +CXFA_FFNotify* CXFA_DocumentParser::GetNotify() const { + return m_pNotify; +} + +CXFA_Document* CXFA_DocumentParser::GetDocument() const { + return m_pDocument; +} + void CXFA_DocumentParser::CloseParser() { delete m_pDocument; m_pDocument = nullptr; @@ -1410,6 +1449,7 @@ CXFA_XMLParser::CXFA_XMLParser(CFDE_XMLNode* pRoot, IFX_Stream* pStream) m_pParser = new CFDE_XMLSyntaxParser; m_pParser->Init(m_pStream, 32 * 1024, 1024 * 1024); } + CXFA_XMLParser::~CXFA_XMLParser() { if (m_pParser) { m_pParser->Release(); @@ -1418,6 +1458,11 @@ CXFA_XMLParser::~CXFA_XMLParser() { m_ws1.clear(); m_ws2.clear(); } + +void CXFA_XMLParser::Release() { + delete this; +} + int32_t CXFA_XMLParser::DoParser(IFX_Pause* pPause) { if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error) return -1; diff --git a/xfa/fxfa/parser/xfa_parser_imp.h b/xfa/fxfa/parser/xfa_parser_imp.h index 1f117be64e..3a56cc0996 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.h +++ b/xfa/fxfa/parser/xfa_parser_imp.h @@ -17,8 +17,8 @@ class CXFA_SimpleParser : public IXFA_Parser { CXFA_SimpleParser(CXFA_Document* pFactory, FX_BOOL bDocumentParser = FALSE); ~CXFA_SimpleParser() override; - void Release() override { delete this; } - + // IXFA_Parser + void Release() override; int32_t StartParse(IFX_FileRead* pStream, XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override; int32_t DoParse(IFX_Pause* pPause = NULL) override; @@ -26,9 +26,9 @@ class CXFA_SimpleParser : public IXFA_Parser { CFDE_XMLNode*& pXMLNode, IFX_Pause* pPause = NULL) override; void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override; - CXFA_Document* GetFactory() const override { return m_pFactory; } - CXFA_Node* GetRootNode() const override { return m_pRootNode; } - CFDE_XMLDoc* GetXMLDoc() const override { return m_pXMLDoc; } + CXFA_Document* GetFactory() const override; + CXFA_Node* GetRootNode() const override; + CFDE_XMLDoc* GetXMLDoc() const override; void CloseParser() override; protected: @@ -87,7 +87,8 @@ class CXFA_DocumentParser : public IXFA_Parser { CXFA_DocumentParser(CXFA_FFNotify* pNotify); ~CXFA_DocumentParser() override; - void Release() override { delete this; } + // IXFA_Parser + void Release() override; int32_t StartParse(IFX_FileRead* pStream, XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override; int32_t DoParse(IFX_Pause* pPause = NULL) override; @@ -95,13 +96,11 @@ class CXFA_DocumentParser : public IXFA_Parser { CFDE_XMLNode*& pXMLNode, IFX_Pause* pPause = NULL) override; void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override; - CXFA_Document* GetFactory() const override { - return m_nodeParser.GetFactory(); - } - CXFA_Node* GetRootNode() const override { return m_nodeParser.GetRootNode(); } - CFDE_XMLDoc* GetXMLDoc() const override { return m_nodeParser.GetXMLDoc(); } - CXFA_FFNotify* GetNotify() const { return m_pNotify; } - CXFA_Document* GetDocument() const { return m_pDocument; } + CXFA_Document* GetFactory() const override; + CXFA_Node* GetRootNode() const override; + CFDE_XMLDoc* GetXMLDoc() const override; + CXFA_FFNotify* GetNotify() const; + CXFA_Document* GetDocument() const; void CloseParser() override; protected: @@ -113,10 +112,11 @@ class CXFA_DocumentParser : public IXFA_Parser { class CXFA_XMLParser : public CFDE_XMLParser { public: CXFA_XMLParser(CFDE_XMLNode* pRoot, IFX_Stream* pStream); - ~CXFA_XMLParser(); + ~CXFA_XMLParser() override; - virtual void Release() { delete this; } - virtual int32_t DoParser(IFX_Pause* pPause); + // CFDE_XMLParser + void Release() override; + int32_t DoParser(IFX_Pause* pPause) override; FX_FILESIZE m_nStart[2]; size_t m_nSize[2]; diff --git a/xfa/fxfa/parser/xfa_script.h b/xfa/fxfa/parser/xfa_script.h index 646193d2cf..faaaceec78 100644 --- a/xfa/fxfa/parser/xfa_script.h +++ b/xfa/fxfa/parser/xfa_script.h @@ -38,10 +38,8 @@ enum XFA_RESOVENODE_RSTYPE { }; struct XFA_RESOLVENODE_RS { - XFA_RESOLVENODE_RS() - : dwFlags(XFA_RESOVENODE_RSTYPE_Nodes), pScriptAttribute(NULL) {} - - ~XFA_RESOLVENODE_RS() { nodes.RemoveAll(); } + XFA_RESOLVENODE_RS(); + ~XFA_RESOLVENODE_RS(); int32_t GetAttributeResult(CXFA_ValueArray& valueArray) const { if (pScriptAttribute && pScriptAttribute->eValueType == XFA_SCRIPT_Object) { @@ -61,4 +59,10 @@ struct XFA_RESOLVENODE_RS { const XFA_SCRIPTATTRIBUTEINFO* pScriptAttribute; }; +inline XFA_RESOLVENODE_RS::XFA_RESOLVENODE_RS() + : dwFlags(XFA_RESOVENODE_RSTYPE_Nodes), pScriptAttribute(NULL) {} + +inline XFA_RESOLVENODE_RS::~XFA_RESOLVENODE_RS() { + nodes.RemoveAll(); +} #endif // XFA_FXFA_PARSER_XFA_SCRIPT_H_ diff --git a/xfa/fxfa/parser/xfa_script_datawindow.h b/xfa/fxfa/parser/xfa_script_datawindow.h index 7754f049c4..d896a71e70 100644 --- a/xfa/fxfa/parser/xfa_script_datawindow.h +++ b/xfa/fxfa/parser/xfa_script_datawindow.h @@ -13,7 +13,8 @@ class CScript_DataWindow : public CXFA_OrdinaryObject { public: CScript_DataWindow(CXFA_Document* pDocument); - virtual ~CScript_DataWindow(); + ~CScript_DataWindow() override; + void Script_DataWindow_MoveCurrentRecord(CFXJSE_Arguments* pArguments); void Script_DataWindow_Record(CFXJSE_Arguments* pArguments); void Script_DataWindow_GotoRecord(CFXJSE_Arguments* pArguments); diff --git a/xfa/fxfa/parser/xfa_script_eventpseudomodel.h b/xfa/fxfa/parser/xfa_script_eventpseudomodel.h index 378f56f149..3a53b0b05d 100644 --- a/xfa/fxfa/parser/xfa_script_eventpseudomodel.h +++ b/xfa/fxfa/parser/xfa_script_eventpseudomodel.h @@ -33,7 +33,7 @@ enum class XFA_Event { class CScript_EventPseudoModel : public CXFA_OrdinaryObject { public: explicit CScript_EventPseudoModel(CXFA_Document* pDocument); - virtual ~CScript_EventPseudoModel(); + ~CScript_EventPseudoModel() override; void Script_EventPseudoModel_Change(CFXJSE_Value* pValue, FX_BOOL bSetting, diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.h b/xfa/fxfa/parser/xfa_script_hostpseudomodel.h index 8a186fb6fd..0cbe04aadb 100644 --- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.h +++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.h @@ -14,7 +14,7 @@ class CScript_HostPseudoModel : public CXFA_OrdinaryObject { public: CScript_HostPseudoModel(CXFA_Document* pDocument); - virtual ~CScript_HostPseudoModel(); + ~CScript_HostPseudoModel() override; void Script_HostPseudoModel_AppType(CFXJSE_Value* pValue, FX_BOOL bSetting, diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h index 2fb0dba303..02e25b42f5 100644 --- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h +++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h @@ -21,7 +21,7 @@ enum XFA_LAYOUTMODEL_HWXY { class CScript_LayoutPseudoModel : public CXFA_OrdinaryObject { public: explicit CScript_LayoutPseudoModel(CXFA_Document* pDocument); - ~CScript_LayoutPseudoModel(); + ~CScript_LayoutPseudoModel() override; void Script_LayoutPseudoModel_Ready(CFXJSE_Value* pValue, FX_BOOL bSetting, diff --git a/xfa/fxfa/parser/xfa_script_logpseudomodel.h b/xfa/fxfa/parser/xfa_script_logpseudomodel.h index 1e13cd0371..9e30641264 100644 --- a/xfa/fxfa/parser/xfa_script_logpseudomodel.h +++ b/xfa/fxfa/parser/xfa_script_logpseudomodel.h @@ -13,7 +13,7 @@ class CScript_LogPseudoModel : public CXFA_OrdinaryObject { public: explicit CScript_LogPseudoModel(CXFA_Document* pDocument); - virtual ~CScript_LogPseudoModel(); + ~CScript_LogPseudoModel() override; void Script_LogPseudoModel_Message(CFXJSE_Arguments* pArguments); void Script_LogPseudoModel_TraceEnabled(CFXJSE_Arguments* pArguments); diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp index c2101f7719..2e61a06885 100644 --- a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp +++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp @@ -822,3 +822,19 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_SetIndexDataBind( iIndex = iCount - 1; } } + +CXFA_ResolveNodesData::CXFA_ResolveNodesData(CXFA_ScriptContext* pSC) + : m_pSC(pSC), + m_CurNode(NULL), + m_wsName(), + m_uHashName(XFA_HASHCODE_None), + m_wsCondition(), + m_nLevel(0), + m_Nodes(), + m_dwStyles(XFA_RESOLVENODE_Children), + m_pScriptAttribute(NULL), + m_dwFlag(XFA_RESOVENODE_RSTYPE_Nodes) {} + +CXFA_ResolveNodesData::~CXFA_ResolveNodesData() { + m_Nodes.RemoveAll(); +} diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.h b/xfa/fxfa/parser/xfa_script_resolveprocessor.h index 9789ffd7b8..0d932ef815 100644 --- a/xfa/fxfa/parser/xfa_script_resolveprocessor.h +++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.h @@ -15,18 +15,9 @@ class CXFA_ScriptContext; class CXFA_ResolveNodesData { public: - CXFA_ResolveNodesData(CXFA_ScriptContext* pSC = NULL) - : m_pSC(pSC), - m_CurNode(NULL), - m_wsName(), - m_uHashName(XFA_HASHCODE_None), - m_wsCondition(), - m_nLevel(0), - m_Nodes(), - m_dwStyles(XFA_RESOLVENODE_Children), - m_pScriptAttribute(NULL), - m_dwFlag(XFA_RESOVENODE_RSTYPE_Nodes) {} - ~CXFA_ResolveNodesData() { m_Nodes.RemoveAll(); } + CXFA_ResolveNodesData(CXFA_ScriptContext* pSC = NULL); + ~CXFA_ResolveNodesData(); + CXFA_ScriptContext* m_pSC; CXFA_Object* m_CurNode; CFX_WideString m_wsName; diff --git a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.h b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.h index bba0fd5827..3339ff0852 100644 --- a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.h +++ b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.h @@ -13,7 +13,8 @@ class CScript_SignaturePseudoModel : public CXFA_OrdinaryObject { public: CScript_SignaturePseudoModel(CXFA_Document* pDocument); - ~CScript_SignaturePseudoModel(); + ~CScript_SignaturePseudoModel() override; + void Script_SignaturePseudoModel_Verify(CFXJSE_Arguments* pArguments); void Script_SignaturePseudoModel_Sign(CFXJSE_Arguments* pArguments); void Script_SignaturePseudoModel_Enumerate(CFXJSE_Arguments* pArguments); |