From 47bcd4c5c56cdc2d63a0c2ed4e7f68e6ccf523f6 Mon Sep 17 00:00:00 2001 From: weili Date: Thu, 16 Jun 2016 08:00:06 -0700 Subject: Make code compile with clang_use_chrome_plugin (part V) This change mainly contains files in xfa/fxfa directory. This is part of the efforts to make PDFium code compilable by Clang chromium style plugins. The changes are mainly the following: -- move inline constructor/destructor of complex class/struct out-of-line; -- add constructor/destructor of complex class/struct if not explicitly defined; -- add explicit out-of-line copy constructor when needed; -- move inline virtual functions out-of-line; -- Properly mark virtual functions with 'override'; -- some minor cleanups; BUG=pdfium:469 Review-Url: https://codereview.chromium.org/2071683002 --- xfa/fxfa/include/fxfa.h | 40 +++++--------------- xfa/fxfa/include/xfa_ffapp.h | 9 +++-- xfa/fxfa/include/xfa_ffpageview.h | 6 ++- xfa/fxfa/include/xfa_ffwidget.h | 73 ++++++++++++++++++------------------ xfa/fxfa/include/xfa_fontmgr.h | 2 +- xfa/fxfa/include/xfa_rendercontext.h | 8 ++++ 6 files changed, 65 insertions(+), 73 deletions(-) (limited to 'xfa/fxfa/include') 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& 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 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_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 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& sSuggest) { - return FALSE; - } + std::vector& 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(); -- cgit v1.2.3