diff options
author | Tom Sepez <tsepez@chromium.org> | 2016-02-17 10:07:21 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2016-02-17 10:07:21 -0800 |
commit | ab27768d235985c0789a10ab490be43e262f48f6 (patch) | |
tree | 692c2707020bee87753c05208c7d0c6f176ff30b /xfa/src/fxfa | |
parent | 32c70815316672091946be88e5941089c359d151 (diff) | |
download | pdfium-ab27768d235985c0789a10ab490be43e262f48f6.tar.xz |
Banish CFX_ByteArray and CFX_WideArray to the XFA side.
Fix IWYU and include paths as we go.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1701883004 .
Diffstat (limited to 'xfa/src/fxfa')
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_fftextedit.cpp | 10 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_fftextedit.h | 88 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffwidget.h | 11 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffwidgethandler.cpp | 11 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffwidgethandler.h | 16 |
5 files changed, 77 insertions, 59 deletions
diff --git a/xfa/src/fxfa/src/app/xfa_fftextedit.cpp b/xfa/src/fxfa/src/app/xfa_fftextedit.cpp index 083769866c..0b5a70170e 100644 --- a/xfa/src/fxfa/src/app/xfa_fftextedit.cpp +++ b/xfa/src/fxfa/src/app/xfa_fftextedit.cpp @@ -320,8 +320,9 @@ FX_BOOL CXFA_FFTextEdit::Delete() { FX_BOOL CXFA_FFTextEdit::DeSelect() { return ((CFWL_Edit*)m_pNormalWidget)->ClearSelections(); } -FX_BOOL CXFA_FFTextEdit::GetSuggestWords(CFX_PointF pointf, - CFX_ByteStringArray& sSuggest) { +FX_BOOL CXFA_FFTextEdit::GetSuggestWords( + CFX_PointF pointf, + std::vector<CFX_ByteString>& sSuggest) { if (m_pDataAcc->GetUIType() != XFA_ELEMENT_TextEdit) { return FALSE; } @@ -377,8 +378,9 @@ FX_BOOL CXFA_FFTextEdit::CheckWord(const CFX_ByteStringC& sWord) { } return GetDoc()->GetDocProvider()->CheckWord(GetDoc(), sWord); } -FX_BOOL CXFA_FFTextEdit::GetSuggestWords(const CFX_ByteStringC& sWord, - CFX_ByteStringArray& sSuggest) { +FX_BOOL CXFA_FFTextEdit::GetSuggestWords( + const CFX_ByteStringC& sWord, + std::vector<CFX_ByteString>& sSuggest) { if (m_pDataAcc->GetUIType() != XFA_ELEMENT_TextEdit) { return FALSE; } diff --git a/xfa/src/fxfa/src/app/xfa_fftextedit.h b/xfa/src/fxfa/src/app/xfa_fftextedit.h index 9694b49f40..0f99a69084 100644 --- a/xfa/src/fxfa/src/app/xfa_fftextedit.h +++ b/xfa/src/fxfa/src/app/xfa_fftextedit.h @@ -4,58 +4,65 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef _FXFA_FORMFILLER_TEXTEDIT_IMP_H -#define _FXFA_FORMFILLER_TEXTEDIT_IMP_H +#ifndef XFA_FFTEXTEDIT_H_ +#define XFA_FFTEXTEDIT_H_ + class CXFA_FFTextEdit : public CXFA_FFField { public: CXFA_FFTextEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); - virtual ~CXFA_FFTextEdit(); - virtual FX_BOOL LoadWidget(); - virtual void UpdateWidgetProperty(); - virtual FX_BOOL OnLButtonDown(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnRButtonDown(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnRButtonUp(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual FX_BOOL OnSetFocus(CXFA_FFWidget* pOldWidget); - 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(); - FX_BOOL GetSuggestWords(CFX_PointF pointf, CFX_ByteStringArray& sSuggest); + ~CXFA_FFTextEdit() override; + + // CXFA_FFField: + FX_BOOL LoadWidget() override; + void UpdateWidgetProperty() override; + FX_BOOL OnLButtonDown(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnRButtonDown(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnRButtonUp(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + FX_BOOL OnSetFocus(CXFA_FFWidget* pOldWidget) override; + FX_BOOL OnKillFocus(CXFA_FFWidget* pNewWidget) override; + 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; + FX_BOOL GetSuggestWords(CFX_PointF pointf, + std::vector<CFX_ByteString>& sSuggest) override; FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf, - const CFX_ByteStringC& bsReplace); + const CFX_ByteStringC& bsReplace) override; - protected: - FX_DWORD GetAlignment(); - virtual FX_BOOL CommitData(); - virtual FX_BOOL UpdateFWLData(); - virtual FX_BOOL IsDataChanged(); - void ValidateNumberField(const CFX_WideString& wsText); - IFWL_WidgetDelegate* m_pOldDelegate; + // IFWL_WidgetDelegate: + int32_t OnProcessMessage(CFWL_Message* pMessage) override; + FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; + FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; - public: void OnTextChanged(IFWL_Widget* pWidget, const CFX_WideString& wsChanged, const CFX_WideString& wsPrevText); void OnTextFull(IFWL_Widget* pWidget); FX_BOOL CheckWord(const CFX_ByteStringC& sWord); FX_BOOL GetSuggestWords(const CFX_ByteStringC& sWord, - CFX_ByteStringArray& sSuggest); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + std::vector<CFX_ByteString>& sSuggest); + + protected: + FX_DWORD GetAlignment(); + FX_BOOL CommitData() override; + FX_BOOL UpdateFWLData() override; + FX_BOOL IsDataChanged() override; + void ValidateNumberField(const CFX_WideString& wsText); + + IFWL_WidgetDelegate* m_pOldDelegate; }; + class CXFA_FFNumericEdit : public CXFA_FFTextEdit { public: CXFA_FFNumericEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); @@ -123,4 +130,5 @@ class CXFA_FFDateTimeEdit : public CXFA_FFTextEdit { int32_t iDay); virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); }; -#endif + +#endif // XFA_FFTEXTEDIT_H_ diff --git a/xfa/src/fxfa/src/app/xfa_ffwidget.h b/xfa/src/fxfa/src/app/xfa_ffwidget.h index f9e4478183..8262be8c13 100644 --- a/xfa/src/fxfa/src/app/xfa_ffwidget.h +++ b/xfa/src/fxfa/src/app/xfa_ffwidget.h @@ -4,8 +4,10 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef _FXFA_FORMFILLER_WIDGET_IMP_H -#define _FXFA_FORMFILLER_WIDGET_IMP_H +#ifndef XFA_FFWIDGET_H_ +#define XFA_FFWIDGET_H_ + +#include <vector> #include "xfa/include/fxfa/fxfa.h" @@ -102,7 +104,7 @@ class CXFA_FFWidget : public IXFA_Widget, virtual FX_BOOL Delete() { return FALSE; } virtual FX_BOOL DeSelect() { return FALSE; } virtual FX_BOOL GetSuggestWords(CFX_PointF pointf, - CFX_ByteStringArray& sSuggest) { + std::vector<CFX_ByteString>& sSuggest) { return FALSE; } virtual FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf, @@ -183,4 +185,5 @@ void XFA_DrawBox(CXFA_Box box, const CFX_RectF& rtWidget, CFX_Matrix* pMatrix, FX_DWORD dwFlags = 0); -#endif + +#endif // XFA_FFWIDGET_H_ diff --git a/xfa/src/fxfa/src/app/xfa_ffwidgethandler.cpp b/xfa/src/fxfa/src/app/xfa_ffwidgethandler.cpp index def79b7962..6d3af0ec37 100644 --- a/xfa/src/fxfa/src/app/xfa_ffwidgethandler.cpp +++ b/xfa/src/fxfa/src/app/xfa_ffwidgethandler.cpp @@ -620,13 +620,10 @@ FX_BOOL CXFA_FFMenuHandler::Undo(IXFA_Widget* hWidget) { FX_BOOL CXFA_FFMenuHandler::Redo(IXFA_Widget* hWidget) { return static_cast<CXFA_FFWidget*>(hWidget)->Redo(); } -#define FX_EDIT_ISLATINWORD(u) \ - (u == 0x2D || (u <= 0x005A && u >= 0x0041) || \ - (u <= 0x007A && u >= 0x0061) || (u <= 0x02AF && u >= 0x00C0) || \ - u == 0x0027) -FX_BOOL CXFA_FFMenuHandler::GetSuggestWords(IXFA_Widget* hWidget, - CFX_PointF pointf, - CFX_ByteStringArray& sSuggest) { +FX_BOOL CXFA_FFMenuHandler::GetSuggestWords( + IXFA_Widget* hWidget, + CFX_PointF pointf, + std::vector<CFX_ByteString>& sSuggest) { return static_cast<CXFA_FFWidget*>(hWidget) ->GetSuggestWords(pointf, sSuggest); } diff --git a/xfa/src/fxfa/src/app/xfa_ffwidgethandler.h b/xfa/src/fxfa/src/app/xfa_ffwidgethandler.h index 26b8850b4e..e6d7721b21 100644 --- a/xfa/src/fxfa/src/app/xfa_ffwidgethandler.h +++ b/xfa/src/fxfa/src/app/xfa_ffwidgethandler.h @@ -4,9 +4,15 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef _FXFA_FORMFILLER_ANNOTHANDLER_IMP_H -#define _FXFA_FORMFILLER_ANNOTHANDLER_IMP_H +#ifndef XFA_FFWIDGETHANDLER_H_ +#define XFA_FFWIDGETHANDLER_H_ + +#include <vector> + +#include "xfa/include/fxfa/fxfa.h" + class CXFA_FFDocView; + class CXFA_FFWidgetHandler : public IXFA_WidgetHandler { public: CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView); @@ -137,6 +143,7 @@ class CXFA_FFWidgetHandler : public IXFA_WidgetHandler { CXFA_FFDocView* m_pDocView; }; + class CXFA_FFMenuHandler : public IXFA_MenuHandler { public: CXFA_FFMenuHandler(); @@ -159,9 +166,10 @@ class CXFA_FFMenuHandler : public IXFA_MenuHandler { virtual FX_BOOL Redo(IXFA_Widget* hWidget); virtual FX_BOOL GetSuggestWords(IXFA_Widget* hWidget, CFX_PointF pointf, - CFX_ByteStringArray& sSuggest); + std::vector<CFX_ByteString>& sSuggest); virtual FX_BOOL ReplaceSpellCheckWord(IXFA_Widget* hWidget, CFX_PointF pointf, const CFX_ByteStringC& bsReplace); }; -#endif + +#endif // XFA_FFWIDGETHANDLER_H_ |