diff options
author | dsinclair <dsinclair@chromium.org> | 2016-11-11 16:36:19 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-11 16:36:19 -0800 |
commit | c40697b24550182898b30de639790eaf82ebf158 (patch) | |
tree | 16a475f270e8961dd3c7ebf83c1da767c9d1adbd /xfa/fwl/core | |
parent | dc40c40f40ed2415605da32f688091a57f53c9e6 (diff) | |
download | pdfium-c40697b24550182898b30de639790eaf82ebf158.tar.xz |
Continue IFWL widget cleanup.
Remove usunsed methods and FWL_Error returns.
Review-Url: https://codereview.chromium.org/2488963005
Diffstat (limited to 'xfa/fwl/core')
-rw-r--r-- | xfa/fwl/core/cfwl_barcode.cpp | 4 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_barcode.h | 3 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_checkbox.cpp | 5 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_checkbox.h | 3 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_combobox.cpp | 6 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_combobox.h | 3 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_datetimepicker.cpp | 105 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_datetimepicker.h | 46 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_listbox.cpp | 4 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_listbox.h | 3 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_picturebox.cpp | 6 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_picturebox.h | 3 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_pushbutton.cpp | 10 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_pushbutton.h | 4 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_noteimp.cpp | 5 | ||||
-rw-r--r-- | xfa/fwl/core/fwl_noteimp.h | 3 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_dataprovider.h | 4 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_datetimeedit.cpp | 2 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_datetimepicker.cpp | 197 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_datetimepicker.h | 97 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_monthcalendar.cpp | 2 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_tooltip.h | 3 |
22 files changed, 139 insertions, 379 deletions
diff --git a/xfa/fwl/core/cfwl_barcode.cpp b/xfa/fwl/core/cfwl_barcode.cpp index 77faefed48..053826d6b7 100644 --- a/xfa/fwl/core/cfwl_barcode.cpp +++ b/xfa/fwl/core/cfwl_barcode.cpp @@ -111,9 +111,7 @@ bool CFWL_Barcode::IsProtectedType() { return GetWidget() ? ToBarcode(GetWidget())->IsProtectedType() : false; } -FWL_Error CFWL_Barcode::GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { - return FWL_Error::Succeeded; +void CFWL_Barcode::GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) { } BC_CHAR_ENCODING CFWL_Barcode::GetCharEncoding() const { diff --git a/xfa/fwl/core/cfwl_barcode.h b/xfa/fwl/core/cfwl_barcode.h index be89318f40..78e5e68c0b 100644 --- a/xfa/fwl/core/cfwl_barcode.h +++ b/xfa/fwl/core/cfwl_barcode.h @@ -37,8 +37,7 @@ class CFWL_Barcode : public CFWL_Edit, public IFWL_BarcodeDP { void ResetBarcodeAttributes(); // IFWL_DataProvider - FWL_Error GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) override; + void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; // IFWL_BarcodeDP BC_CHAR_ENCODING GetCharEncoding() const override; diff --git a/xfa/fwl/core/cfwl_checkbox.cpp b/xfa/fwl/core/cfwl_checkbox.cpp index 5372083b4c..75e85fcabb 100644 --- a/xfa/fwl/core/cfwl_checkbox.cpp +++ b/xfa/fwl/core/cfwl_checkbox.cpp @@ -51,10 +51,9 @@ FWL_Error CFWL_CheckBox::SetCheckState(int32_t iCheck) { return ToCheckBox(GetWidget())->SetCheckState(iCheck); } -FWL_Error CFWL_CheckBox::GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { +void CFWL_CheckBox::GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) { wsCaption = m_wsCaption; - return FWL_Error::Succeeded; } FX_FLOAT CFWL_CheckBox::GetBoxSize(IFWL_Widget* pWidget) { diff --git a/xfa/fwl/core/cfwl_checkbox.h b/xfa/fwl/core/cfwl_checkbox.h index 8ab88854d8..730b906ba4 100644 --- a/xfa/fwl/core/cfwl_checkbox.h +++ b/xfa/fwl/core/cfwl_checkbox.h @@ -23,8 +23,7 @@ class CFWL_CheckBox : public CFWL_Widget, public IFWL_CheckBoxDP { FWL_Error SetCheckState(int32_t iCheck); // IFWL_DataProvider - FWL_Error GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) override; + void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; // IFWL_CheckBoxDP FX_FLOAT GetBoxSize(IFWL_Widget* pWidget) override; diff --git a/xfa/fwl/core/cfwl_combobox.cpp b/xfa/fwl/core/cfwl_combobox.cpp index 1a75927dda..572f4bf949 100644 --- a/xfa/fwl/core/cfwl_combobox.cpp +++ b/xfa/fwl/core/cfwl_combobox.cpp @@ -232,10 +232,8 @@ void CFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, } } -FWL_Error CFWL_ComboBox::GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { - return FWL_Error::Succeeded; -} +void CFWL_ComboBox::GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) {} int32_t CFWL_ComboBox::CountItems(const IFWL_Widget* pWidget) { return m_ItemArray.size(); diff --git a/xfa/fwl/core/cfwl_combobox.h b/xfa/fwl/core/cfwl_combobox.h index 246711983d..1b6f814722 100644 --- a/xfa/fwl/core/cfwl_combobox.h +++ b/xfa/fwl/core/cfwl_combobox.h @@ -63,8 +63,7 @@ class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBoxDP { void EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); // IFWL_DataProvider - FWL_Error GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) override; + void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; // IFWL_ListBoxDP int32_t CountItems(const IFWL_Widget* pWidget) override; diff --git a/xfa/fwl/core/cfwl_datetimepicker.cpp b/xfa/fwl/core/cfwl_datetimepicker.cpp index fb4a39fe35..efc2b62cf7 100644 --- a/xfa/fwl/core/cfwl_datetimepicker.cpp +++ b/xfa/fwl/core/cfwl_datetimepicker.cpp @@ -35,15 +35,6 @@ void CFWL_DateTimePicker::Initialize() { CFWL_Widget::Initialize(); } -FWL_Error CFWL_DateTimePicker::SetToday(int32_t iYear, - int32_t iMonth, - int32_t iDay) { - m_iYear = iYear; - m_iMonth = iMonth; - m_iDay = iDay; - return FWL_Error::Succeeded; -} - int32_t CFWL_DateTimePicker::CountSelRanges() { return ToDateTimePicker(GetWidget())->CountSelRanges(); } @@ -52,100 +43,40 @@ int32_t CFWL_DateTimePicker::GetSelRange(int32_t nIndex, int32_t& nStart) { return ToDateTimePicker(GetWidget())->GetSelRange(nIndex, nStart); } -FWL_Error CFWL_DateTimePicker::GetEditText(CFX_WideString& wsText) { - return ToDateTimePicker(GetWidget())->GetEditText(wsText); -} - -FWL_Error CFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) { - return ToDateTimePicker(GetWidget())->SetEditText(wsText); +void CFWL_DateTimePicker::GetEditText(CFX_WideString& wsText) { + ToDateTimePicker(GetWidget())->GetEditText(wsText); } -FWL_Error CFWL_DateTimePicker::GetCurSel(int32_t& iYear, - int32_t& iMonth, - int32_t& iDay) { - return ToDateTimePicker(GetWidget())->GetCurSel(iYear, iMonth, iDay); +void CFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) { + ToDateTimePicker(GetWidget())->SetEditText(wsText); } -FWL_Error CFWL_DateTimePicker::SetCurSel(int32_t iYear, - int32_t iMonth, - int32_t iDay) { - return ToDateTimePicker(GetWidget())->SetCurSel(iYear, iMonth, iDay); +void CFWL_DateTimePicker::SetCurSel(int32_t iYear, + int32_t iMonth, + int32_t iDay) { + ToDateTimePicker(GetWidget())->SetCurSel(iYear, iMonth, iDay); } -FWL_Error CFWL_DateTimePicker::GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { +void CFWL_DateTimePicker::GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) { wsCaption = m_wsData; - return FWL_Error::Succeeded; } -FWL_Error CFWL_DateTimePicker::GetToday(IFWL_Widget* pWidget, - int32_t& iYear, - int32_t& iMonth, - int32_t& iDay) { +void CFWL_DateTimePicker::GetToday(IFWL_Widget* pWidget, + int32_t& iYear, + int32_t& iMonth, + int32_t& iDay) { iYear = m_iYear; iMonth = m_iMonth; iDay = m_iDay; - return FWL_Error::Succeeded; -} - -bool CFWL_DateTimePicker::CanUndo() { - return ToDateTimePicker(GetWidget())->CanUndo(); -} - -bool CFWL_DateTimePicker::CanRedo() { - return ToDateTimePicker(GetWidget())->CanRedo(); -} - -bool CFWL_DateTimePicker::Undo() { - return ToDateTimePicker(GetWidget())->Undo(); -} - -bool CFWL_DateTimePicker::Redo() { - return ToDateTimePicker(GetWidget())->Redo(); -} - -bool CFWL_DateTimePicker::CanCopy() { - return ToDateTimePicker(GetWidget())->CanCopy(); -} - -bool CFWL_DateTimePicker::CanCut() { - return ToDateTimePicker(GetWidget())->CanCut(); -} - -bool CFWL_DateTimePicker::CanSelectAll() { - return ToDateTimePicker(GetWidget())->CanSelectAll(); -} - -bool CFWL_DateTimePicker::Copy(CFX_WideString& wsCopy) { - return ToDateTimePicker(GetWidget())->Copy(wsCopy); -} - -bool CFWL_DateTimePicker::Cut(CFX_WideString& wsCut) { - return ToDateTimePicker(GetWidget())->Copy(wsCut); -} - -bool CFWL_DateTimePicker::Paste(const CFX_WideString& wsPaste) { - return ToDateTimePicker(GetWidget())->Paste(wsPaste); -} - -bool CFWL_DateTimePicker::SelectAll() { - return ToDateTimePicker(GetWidget())->SelectAll(); -} - -bool CFWL_DateTimePicker::Delete() { - return ToDateTimePicker(GetWidget())->Delete(); -} - -bool CFWL_DateTimePicker::DeSelect() { - return ToDateTimePicker(GetWidget())->DeSelect(); } -FWL_Error CFWL_DateTimePicker::GetBBox(CFX_RectF& rect) { - return ToDateTimePicker(GetWidget())->GetBBox(rect); +void CFWL_DateTimePicker::GetBBox(CFX_RectF& rect) { + ToDateTimePicker(GetWidget())->GetBBox(rect); } -FWL_Error CFWL_DateTimePicker::SetEditLimit(int32_t nLimit) { - return ToDateTimePicker(GetWidget())->SetEditLimit(nLimit); +void CFWL_DateTimePicker::SetEditLimit(int32_t nLimit) { + ToDateTimePicker(GetWidget())->SetEditLimit(nLimit); } void CFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, diff --git a/xfa/fwl/core/cfwl_datetimepicker.h b/xfa/fwl/core/cfwl_datetimepicker.h index 9227c7b889..5003cb2ea5 100644 --- a/xfa/fwl/core/cfwl_datetimepicker.h +++ b/xfa/fwl/core/cfwl_datetimepicker.h @@ -17,39 +17,25 @@ class CFWL_DateTimePicker : public CFWL_Widget, public IFWL_DateTimePickerDP { void Initialize(); - FWL_Error SetToday(int32_t iYear, int32_t iMonth, int32_t iDay); - FWL_Error GetEditText(CFX_WideString& wsText); - FWL_Error SetEditText(const CFX_WideString& wsText); - int32_t CountSelRanges(); - int32_t GetSelRange(int32_t nIndex, int32_t& nStart); - FWL_Error GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); - FWL_Error SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); - bool CanUndo(); - bool CanRedo(); - bool Undo(); - bool Redo(); - bool CanCopy(); - bool CanCut(); - bool CanSelectAll(); - bool Copy(CFX_WideString& wsCopy); - bool Cut(CFX_WideString& wsCut); - bool Paste(const CFX_WideString& wsPaste); - bool SelectAll(); - bool Delete(); - bool DeSelect(); - FWL_Error GetBBox(CFX_RectF& rect); - FWL_Error SetEditLimit(int32_t nLimit); - void ModifyEditStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); - // IFWL_DataProvider - FWL_Error GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) override; + void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; // IFWL_DateTimePickerDP - FWL_Error GetToday(IFWL_Widget* pWidget, - int32_t& iYear, - int32_t& iMonth, - int32_t& iDay) override; + void GetToday(IFWL_Widget* pWidget, + int32_t& iYear, + int32_t& iMonth, + int32_t& iDay) override; + + void GetEditText(CFX_WideString& wsText); + void SetEditText(const CFX_WideString& wsText); + + int32_t CountSelRanges(); + int32_t GetSelRange(int32_t nIndex, int32_t& nStart); + + void SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); + void GetBBox(CFX_RectF& rect); + void SetEditLimit(int32_t nLimit); + void ModifyEditStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); private: int32_t m_iYear; diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp index 9267f59e6f..5827ac4b26 100644 --- a/xfa/fwl/core/cfwl_listbox.cpp +++ b/xfa/fwl/core/cfwl_listbox.cpp @@ -119,10 +119,8 @@ uint32_t CFWL_ListBox::GetItemStates(CFWL_ListItem* pItem) { return pListItem->m_dwStates | pListItem->m_dwCheckState; } -FWL_Error CFWL_ListBox::GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { +void CFWL_ListBox::GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) { wsCaption = L""; - return FWL_Error::Succeeded; } int32_t CFWL_ListBox::CountItems(const IFWL_Widget* pWidget) { diff --git a/xfa/fwl/core/cfwl_listbox.h b/xfa/fwl/core/cfwl_listbox.h index 901f77e894..0f1d35a21b 100644 --- a/xfa/fwl/core/cfwl_listbox.h +++ b/xfa/fwl/core/cfwl_listbox.h @@ -23,8 +23,7 @@ class CFWL_ListBox : public CFWL_Widget, public IFWL_ListBoxDP { void Initialize(); // IFWL_DataProvider: - FWL_Error GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) override; + void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; // IFWL_ListBoxDP: int32_t CountItems(const IFWL_Widget* pWidget) override; diff --git a/xfa/fwl/core/cfwl_picturebox.cpp b/xfa/fwl/core/cfwl_picturebox.cpp index 28d31864c7..8badc999ea 100644 --- a/xfa/fwl/core/cfwl_picturebox.cpp +++ b/xfa/fwl/core/cfwl_picturebox.cpp @@ -95,10 +95,8 @@ FWL_Error CFWL_PictureBox::SetOffset(FX_FLOAT fx, FX_FLOAT fy) { return FWL_Error::Succeeded; } -FWL_Error CFWL_PictureBox::GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { - return FWL_Error::Succeeded; -} +void CFWL_PictureBox::GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) {} CFX_DIBitmap* CFWL_PictureBox::GetPicture(IFWL_Widget* pWidget) { return m_pBitmap; diff --git a/xfa/fwl/core/cfwl_picturebox.h b/xfa/fwl/core/cfwl_picturebox.h index 5cd7c6fffc..1efa0ad151 100644 --- a/xfa/fwl/core/cfwl_picturebox.h +++ b/xfa/fwl/core/cfwl_picturebox.h @@ -32,8 +32,7 @@ class CFWL_PictureBox : public CFWL_Widget, public IFWL_PictureBoxDP { FWL_Error SetOffset(FX_FLOAT fx, FX_FLOAT fy); // IFWL_DataProvider - FWL_Error GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) override; + void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; // IFWL_PictureBoxDP CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget) override; diff --git a/xfa/fwl/core/cfwl_pushbutton.cpp b/xfa/fwl/core/cfwl_pushbutton.cpp index 888c127782..1fc6191d3d 100644 --- a/xfa/fwl/core/cfwl_pushbutton.cpp +++ b/xfa/fwl/core/cfwl_pushbutton.cpp @@ -24,11 +24,6 @@ void CFWL_PushButton::Initialize() { CFWL_Widget::Initialize(); } -FWL_Error CFWL_PushButton::GetCaption(CFX_WideString& wsCaption) { - wsCaption = m_wsCaption; - return FWL_Error::Succeeded; -} - FWL_Error CFWL_PushButton::SetCaption(const CFX_WideStringC& wsCaption) { m_wsCaption = wsCaption; return FWL_Error::Succeeded; @@ -43,10 +38,9 @@ FWL_Error CFWL_PushButton::SetPicture(CFX_DIBitmap* pBitmap) { return FWL_Error::Succeeded; } -FWL_Error CFWL_PushButton::GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { +void CFWL_PushButton::GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) { wsCaption = m_wsCaption; - return FWL_Error::Succeeded; } CFX_DIBitmap* CFWL_PushButton::GetPicture(IFWL_Widget* pWidget) { diff --git a/xfa/fwl/core/cfwl_pushbutton.h b/xfa/fwl/core/cfwl_pushbutton.h index a146efc54e..b6beb14bab 100644 --- a/xfa/fwl/core/cfwl_pushbutton.h +++ b/xfa/fwl/core/cfwl_pushbutton.h @@ -17,14 +17,12 @@ class CFWL_PushButton : public CFWL_Widget, public IFWL_PushButtonDP { void Initialize(); - FWL_Error GetCaption(CFX_WideString& wsCaption); FWL_Error SetCaption(const CFX_WideStringC& wsCaption); CFX_DIBitmap* GetPicture(); FWL_Error SetPicture(CFX_DIBitmap* pBitmap); // IFWL_DataProvider - FWL_Error GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) override; + void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; // IFWL_PushButtonDP CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget) override; diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp index fc7523a8b3..70999d5f85 100644 --- a/xfa/fwl/core/fwl_noteimp.cpp +++ b/xfa/fwl/core/fwl_noteimp.cpp @@ -713,10 +713,9 @@ CFWL_ToolTipContainer::CFWL_ToolTipContainer() CFWL_ToolTipContainer::~CFWL_ToolTipContainer() {} -FWL_Error CFWL_ToolTipContainer::GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { +void CFWL_ToolTipContainer::GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) { wsCaption = m_wsCaption; - return FWL_Error::Succeeded; } int32_t CFWL_ToolTipContainer::GetInitialDelay(IFWL_Widget* pWidget) { diff --git a/xfa/fwl/core/fwl_noteimp.h b/xfa/fwl/core/fwl_noteimp.h index 0b99dba80c..f8f5acbe37 100644 --- a/xfa/fwl/core/fwl_noteimp.h +++ b/xfa/fwl/core/fwl_noteimp.h @@ -133,8 +133,7 @@ class CFWL_ToolTipContainer final : public IFWL_ToolTipDP { static void DeleteInstance(); // IFWL_ToolTipDP - FWL_Error GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) override; + void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; int32_t GetInitialDelay(IFWL_Widget* pWidget) override; int32_t GetAutoPopDelay(IFWL_Widget* pWidget) override; CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget) override; diff --git a/xfa/fwl/core/ifwl_dataprovider.h b/xfa/fwl/core/ifwl_dataprovider.h index 53c6ec4055..c4e1a4ea76 100644 --- a/xfa/fwl/core/ifwl_dataprovider.h +++ b/xfa/fwl/core/ifwl_dataprovider.h @@ -8,7 +8,6 @@ #define XFA_FWL_CORE_IFWL_DATAPROVIDER_H_ #include "core/fxcrt/fx_string.h" -#include "xfa/fwl/core/fwl_error.h" class IFWL_Widget; @@ -16,8 +15,7 @@ class IFWL_DataProvider { public: virtual ~IFWL_DataProvider() {} - virtual FWL_Error GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) = 0; + virtual void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) = 0; }; #endif // XFA_FWL_CORE_IFWL_DATAPROVIDER_H_ diff --git a/xfa/fwl/core/ifwl_datetimeedit.cpp b/xfa/fwl/core/ifwl_datetimeedit.cpp index 492f8f3303..c2aa6e371f 100644 --- a/xfa/fwl/core/ifwl_datetimeedit.cpp +++ b/xfa/fwl/core/ifwl_datetimeedit.cpp @@ -42,7 +42,7 @@ void IFWL_DateTimeEdit::DisForm_OnProcessMessage(CFWL_Message* pMessage) { IFWL_DateTimePicker* pDateTime = static_cast<IFWL_DateTimePicker*>(m_pOuter); - if (pDateTime->IsMonthCalendarShowed()) { + if (pDateTime->IsMonthCalendarVisible()) { CFX_RectF rtInvalidate; pDateTime->GetWidgetRect(rtInvalidate); pDateTime->ShowMonthCalendar(false); diff --git a/xfa/fwl/core/ifwl_datetimepicker.cpp b/xfa/fwl/core/ifwl_datetimepicker.cpp index ff2dbfbc4c..3ecaf68182 100644 --- a/xfa/fwl/core/ifwl_datetimepicker.cpp +++ b/xfa/fwl/core/ifwl_datetimepicker.cpp @@ -31,10 +31,10 @@ IFWL_DateTimePicker::IFWL_DateTimePicker( m_iYear(-1), m_iMonth(-1), m_iDay(-1), - m_bLBtnDown(false), m_iCurYear(2010), m_iCurMonth(3), - m_iCurDay(29) { + m_iCurDay(29), + m_bLBtnDown(false) { m_rtBtn.Set(0, 0, 0, 0); m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat; @@ -106,7 +106,7 @@ void IFWL_DateTimePicker::Update() { rtEdit.Set(m_rtClient.left, m_rtClient.top, m_rtClient.width - fBtn, m_rtClient.height); m_pEdit->SetWidgetRect(rtEdit); - ReSetEditAlignment(); + ResetEditAlignment(); m_pEdit->Update(); if (!(m_pMonthCal->GetThemeProvider())) { m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider); @@ -127,11 +127,11 @@ void IFWL_DateTimePicker::Update() { } int32_t IFWL_DateTimePicker::CountSelRanges() { - return GetDataTimeEdit()->CountSelRanges(); + return m_pEdit->CountSelRanges(); } int32_t IFWL_DateTimePicker::GetSelRange(int32_t nIndex, int32_t& nStart) { - return GetDataTimeEdit()->GetSelRange(nIndex, nStart); + return m_pEdit->GetSelRange(nIndex, nStart); } FWL_WidgetHit IFWL_DateTimePicker::HitTest(FX_FLOAT fx, FX_FLOAT fy) { @@ -139,7 +139,7 @@ FWL_WidgetHit IFWL_DateTimePicker::HitTest(FX_FLOAT fx, FX_FLOAT fy) { return DisForm_HitTest(fx, fy); if (m_rtClient.Contains(fx, fy)) return FWL_WidgetHit::Client; - if (IsMonthCalendarShowed()) { + if (IsMonthCalendarVisible()) { CFX_RectF rect; m_pMonthCal->GetWidgetRect(rect); if (rect.Contains(fx, fy)) @@ -175,131 +175,65 @@ void IFWL_DateTimePicker::SetThemeProvider(IFWL_ThemeProvider* pTP) { m_pMonthCal->SetThemeProvider(pTP); } -FWL_Error IFWL_DateTimePicker::GetCurSel(int32_t& iYear, - int32_t& iMonth, - int32_t& iDay) { +void IFWL_DateTimePicker::GetCurSel(int32_t& iYear, + int32_t& iMonth, + int32_t& iDay) { iYear = m_iYear; iMonth = m_iMonth; iDay = m_iDay; - return FWL_Error::Succeeded; } -FWL_Error IFWL_DateTimePicker::SetCurSel(int32_t iYear, - int32_t iMonth, - int32_t iDay) { +void IFWL_DateTimePicker::SetCurSel(int32_t iYear, + int32_t iMonth, + int32_t iDay) { if (iYear <= 0 || iYear >= 3000) - return FWL_Error::Indefinite; + return; if (iMonth <= 0 || iMonth >= 13) - return FWL_Error::Indefinite; + return; if (iDay <= 0 || iDay >= 32) - return FWL_Error::Indefinite; + return; + m_iYear = iYear; m_iMonth = iMonth; m_iDay = iDay; m_pMonthCal->SetSelect(iYear, iMonth, iDay); - return FWL_Error::Succeeded; } -FWL_Error IFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) { +void IFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) { if (!m_pEdit) - return FWL_Error::Indefinite; + return; m_pEdit->SetText(wsText); Repaint(&m_rtClient); CFWL_Event_DtpEditChanged ev; ev.m_wsText = wsText; DispatchEvent(&ev); - return FWL_Error::Succeeded; } -FWL_Error IFWL_DateTimePicker::GetEditText(CFX_WideString& wsText, - int32_t nStart, - int32_t nCount) const { - if (m_pEdit) { +void IFWL_DateTimePicker::GetEditText(CFX_WideString& wsText, + int32_t nStart, + int32_t nCount) const { + if (m_pEdit) m_pEdit->GetText(wsText, nStart, nCount); - return FWL_Error::Succeeded; - } - return FWL_Error::Indefinite; -} - -bool IFWL_DateTimePicker::CanUndo() { - return m_pEdit->CanUndo(); -} - -bool IFWL_DateTimePicker::CanRedo() { - return m_pEdit->CanRedo(); -} - -bool IFWL_DateTimePicker::Undo() { - return m_pEdit->Undo(); -} - -bool IFWL_DateTimePicker::Redo() { - return m_pEdit->Redo(); -} - -bool IFWL_DateTimePicker::CanCopy() { - int32_t nCount = m_pEdit->CountSelRanges(); - return nCount > 0; -} - -bool IFWL_DateTimePicker::CanCut() { - if (m_pEdit->GetStylesEx() & FWL_STYLEEXT_EDT_ReadOnly) { - return false; - } - int32_t nCount = m_pEdit->CountSelRanges(); - return nCount > 0; -} - -bool IFWL_DateTimePicker::CanSelectAll() { - return m_pEdit->GetTextLength() > 0; -} - -bool IFWL_DateTimePicker::Copy(CFX_WideString& wsCopy) { - return m_pEdit->Copy(wsCopy); -} - -bool IFWL_DateTimePicker::Cut(CFX_WideString& wsCut) { - return m_pEdit->Cut(wsCut); -} - -bool IFWL_DateTimePicker::Paste(const CFX_WideString& wsPaste) { - return m_pEdit->Paste(wsPaste); -} - -bool IFWL_DateTimePicker::SelectAll() { - m_pEdit->AddSelRange(0); - return true; -} - -bool IFWL_DateTimePicker::Delete() { - m_pEdit->ClearText(); - return true; -} - -bool IFWL_DateTimePicker::DeSelect() { - m_pEdit->ClearSelections(); - return true; } -FWL_Error IFWL_DateTimePicker::GetBBox(CFX_RectF& rect) { +void IFWL_DateTimePicker::GetBBox(CFX_RectF& rect) { if (m_pWidgetMgr->IsFormDisabled()) { - return DisForm_GetBBox(rect); + DisForm_GetBBox(rect); + return; } rect = m_pProperties->m_rtWidget; - if (IsMonthCalendarShowed()) { + if (IsMonthCalendarVisible()) { CFX_RectF rtMonth; m_pMonthCal->GetWidgetRect(rtMonth); rtMonth.Offset(m_pProperties->m_rtWidget.left, m_pProperties->m_rtWidget.top); rect.Union(rtMonth); } - return FWL_Error::Succeeded; } -FWL_Error IFWL_DateTimePicker::SetEditLimit(int32_t nLimit) { +void IFWL_DateTimePicker::SetEditLimit(int32_t nLimit) { m_pEdit->SetLimit(nLimit); - return FWL_Error::Succeeded; } void IFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, @@ -346,7 +280,7 @@ void IFWL_DateTimePicker::ShowMonthCalendar(bool bActivate) { if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_ShowMonthCalendar(bActivate); } - if (IsMonthCalendarShowed() == bActivate) { + if (IsMonthCalendarVisible() == bActivate) { return; } if (!m_pForm) { @@ -370,16 +304,16 @@ void IFWL_DateTimePicker::ShowMonthCalendar(bool bActivate) { } } -bool IFWL_DateTimePicker::IsMonthCalendarShowed() { +bool IFWL_DateTimePicker::IsMonthCalendarVisible() { if (m_pWidgetMgr->IsFormDisabled()) { - return DisForm_IsMonthCalendarShowed(); + return DisForm_IsMonthCalendarVisible(); } if (!m_pForm) return false; return !(m_pForm->GetStates() & FWL_WGTSTATE_Invisible); } -void IFWL_DateTimePicker::ReSetEditAlignment() { +void IFWL_DateTimePicker::ResetEditAlignment() { if (!m_pEdit) return; uint32_t dwStylExes = m_pProperties->m_dwStyleExes; @@ -452,56 +386,14 @@ void IFWL_DateTimePicker::InitProxyForm() { m_pMonthCal->SetParent(m_pForm.get()); } -IFWL_DateTimeEdit* IFWL_DateTimePicker::GetDataTimeEdit() { - return m_pEdit.get(); -} - -FWL_Error IFWL_DateTimePicker::DisForm_Initialize() { - m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat; - DisForm_InitMonthCalendar(); - DisForm_InitDateTimeEdit(); - RegisterEventTarget(m_pMonthCal.get()); - RegisterEventTarget(m_pEdit.get()); - return FWL_Error::Succeeded; -} - -void IFWL_DateTimePicker::DisForm_InitMonthCalendar() { - if (m_pMonthCal) - return; - - auto prop = pdfium::MakeUnique<CFWL_WidgetProperties>(this); - prop->m_dwStyles = - FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border | FWL_WGTSTYLE_EdgeSunken; - prop->m_dwStates = FWL_WGTSTATE_Invisible; - prop->m_pParent = this; - prop->m_pThemeProvider = m_pProperties->m_pThemeProvider; - - m_pMonthCal.reset(new IFWL_MonthCalendar(m_pOwnerApp, std::move(prop), this)); - CFX_RectF rtMonthCal; - m_pMonthCal->GetWidgetRect(rtMonthCal, true); - rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height); - m_pMonthCal->SetWidgetRect(rtMonthCal); -} - -void IFWL_DateTimePicker::DisForm_InitDateTimeEdit() { - if (m_pEdit) - return; - - auto prop = pdfium::MakeUnique<CFWL_WidgetProperties>(); - prop->m_pParent = this; - prop->m_pThemeProvider = m_pProperties->m_pThemeProvider; - - m_pEdit.reset(new IFWL_DateTimeEdit(m_pOwnerApp, std::move(prop), this)); -} - -bool IFWL_DateTimePicker::DisForm_IsMonthCalendarShowed() { +bool IFWL_DateTimePicker::DisForm_IsMonthCalendarVisible() { if (!m_pMonthCal) return false; return !(m_pMonthCal->GetStates() & FWL_WGTSTATE_Invisible); } void IFWL_DateTimePicker::DisForm_ShowMonthCalendar(bool bActivate) { - bool bShowed = IsMonthCalendarShowed(); + bool bShowed = IsMonthCalendarVisible(); if (bShowed == bActivate) { return; } @@ -547,7 +439,7 @@ FWL_WidgetHit IFWL_DateTimePicker::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) { rect.width += m_fBtn; if (rect.Contains(fx, fy)) return FWL_WidgetHit::Client; - if (IsMonthCalendarShowed()) { + if (IsMonthCalendarVisible()) { m_pMonthCal->GetWidgetRect(rect); if (rect.Contains(fx, fy)) return FWL_WidgetHit::Client; @@ -571,7 +463,7 @@ void IFWL_DateTimePicker::DisForm_Update() { m_pEdit->SetThemeProvider(m_pProperties->m_pThemeProvider); GetClientRect(m_rtClient); m_pEdit->SetWidgetRect(m_rtClient); - ReSetEditAlignment(); + ResetEditAlignment(); m_pEdit->Update(); if (!m_pMonthCal->GetThemeProvider()) m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider); @@ -604,19 +496,18 @@ void IFWL_DateTimePicker::DisForm_GetWidgetRect(CFX_RectF& rect, } } -FWL_Error IFWL_DateTimePicker::DisForm_GetBBox(CFX_RectF& rect) { +void IFWL_DateTimePicker::DisForm_GetBBox(CFX_RectF& rect) { rect = m_pProperties->m_rtWidget; if (DisForm_IsNeedShowButton()) { rect.width += m_fBtn; } - if (IsMonthCalendarShowed()) { + if (IsMonthCalendarVisible()) { CFX_RectF rtMonth; m_pMonthCal->GetWidgetRect(rtMonth); rtMonth.Offset(m_pProperties->m_rtWidget.left, m_pProperties->m_rtWidget.top); rect.Union(rtMonth); } - return FWL_Error::Succeeded; } void IFWL_DateTimePicker::DisForm_DrawWidget(CFX_Graphics* pGraphics, @@ -633,7 +524,7 @@ void IFWL_DateTimePicker::DisForm_DrawWidget(CFX_Graphics* pGraphics, } m_pEdit->DrawWidget(pGraphics, &mt); } - if (IsMonthCalendarShowed()) { + if (IsMonthCalendarVisible()) { CFX_RectF rtMonth; m_pMonthCal->GetWidgetRect(rtMonth); CFX_Matrix mt; @@ -709,7 +600,7 @@ void IFWL_DateTimePicker::OnFocusChanged(CFWL_Message* pMsg, bool bSet) { m_pProperties->m_dwStates &= ~(FWL_WGTSTATE_Focused); Repaint(&m_rtClient); } - if (pMsg->m_pSrcTarget == m_pMonthCal.get() && IsMonthCalendarShowed()) { + if (pMsg->m_pSrcTarget == m_pMonthCal.get() && IsMonthCalendarVisible()) { ShowMonthCalendar(false); } Repaint(&m_rtClient); @@ -721,7 +612,7 @@ void IFWL_DateTimePicker::OnLButtonDown(CFWL_MsgMouse* pMsg) { if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) SetFocus(true); if (m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) { - if (IsMonthCalendarShowed()) { + if (IsMonthCalendarVisible()) { ShowMonthCalendar(false); CFWL_Event_DtpCloseUp ev; DispatchEvent(&ev); @@ -778,7 +669,7 @@ void IFWL_DateTimePicker::DisForm_OnFocusChanged(CFWL_Message* pMsg, } else { m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; m_rtBtn.Set(0, 0, 0, 0); - if (DisForm_IsMonthCalendarShowed()) + if (DisForm_IsMonthCalendarVisible()) ShowMonthCalendar(false); if (m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { pMsg->m_pSrcTarget = m_pEdit.get(); @@ -789,10 +680,8 @@ void IFWL_DateTimePicker::DisForm_OnFocusChanged(CFWL_Message* pMsg, Repaint(&rtInvalidate); } -FWL_Error IFWL_DateTimePicker::GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { - return FWL_Error::Succeeded; -} +void IFWL_DateTimePicker::GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) {} int32_t IFWL_DateTimePicker::GetCurDay(IFWL_Widget* pWidget) { return m_iCurDay; diff --git a/xfa/fwl/core/ifwl_datetimepicker.h b/xfa/fwl/core/ifwl_datetimepicker.h index f6742838c4..eddb596adc 100644 --- a/xfa/fwl/core/ifwl_datetimepicker.h +++ b/xfa/fwl/core/ifwl_datetimepicker.h @@ -53,10 +53,10 @@ FWL_EVENT_DEF(CFWL_Event_DtpSelectChanged, class IFWL_DateTimePickerDP : public IFWL_DataProvider { public: - virtual FWL_Error GetToday(IFWL_Widget* pWidget, - int32_t& iYear, - int32_t& iMonth, - int32_t& iDay) = 0; + virtual void GetToday(IFWL_Widget* pWidget, + int32_t& iYear, + int32_t& iMonth, + int32_t& iDay) = 0; }; class IFWL_DateTimePicker : public IFWL_Widget, public IFWL_MonthCalendarDP { @@ -78,49 +78,36 @@ class IFWL_DateTimePicker : public IFWL_Widget, public IFWL_MonthCalendarDP { void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; - FWL_Error GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); - FWL_Error SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); - FWL_Error SetEditText(const CFX_WideString& wsText); - FWL_Error GetEditText(CFX_WideString& wsText, - int32_t nStart = 0, - int32_t nCount = -1) const; + // IFWL_DataProvider + void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; + + // IFWL_MonthCalendarDP + int32_t GetCurDay(IFWL_Widget* pWidget) override; + int32_t GetCurMonth(IFWL_Widget* pWidget) override; + int32_t GetCurYear(IFWL_Widget* pWidget) override; + + void GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); + void SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); + + void SetEditText(const CFX_WideString& wsText); + void GetEditText(CFX_WideString& wsText, + int32_t nStart = 0, + int32_t nCount = -1) const; + int32_t CountSelRanges(); int32_t GetSelRange(int32_t nIndex, int32_t& nStart); - bool CanUndo(); - bool CanRedo(); - bool Undo(); - bool Redo(); - bool CanCopy(); - bool CanCut(); - bool CanSelectAll(); - bool Copy(CFX_WideString& wsCopy); - bool Cut(CFX_WideString& wsCut); - bool Paste(const CFX_WideString& wsPaste); - bool SelectAll(); - bool Delete(); - bool DeSelect(); - FWL_Error GetBBox(CFX_RectF& rect); - FWL_Error SetEditLimit(int32_t nLimit); + void GetBBox(CFX_RectF& rect); + void SetEditLimit(int32_t nLimit); void ModifyEditStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); - IFWL_DateTimeEdit* GetDataTimeEdit(); - bool IsMonthCalendarShowed(); + bool IsMonthCalendarVisible(); void ShowMonthCalendar(bool bActivate); void ProcessSelChanged(int32_t iYear, int32_t iMonth, int32_t iDay); IFWL_FormProxy* GetFormProxy() const { return m_pForm.get(); } - // IFWL_DataProvider - FWL_Error GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) override; - - // IFWL_MonthCalendarDP - int32_t GetCurDay(IFWL_Widget* pWidget) override; - int32_t GetCurMonth(IFWL_Widget* pWidget) override; - int32_t GetCurYear(IFWL_Widget* pWidget) override; - - protected: + private: void DrawDropDownButton(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix); @@ -128,45 +115,39 @@ class IFWL_DateTimePicker : public IFWL_Widget, public IFWL_MonthCalendarDP { int32_t iMonth, int32_t iDay, CFX_WideString& wsText); - void ReSetEditAlignment(); + void ResetEditAlignment(); void InitProxyForm(); - CFX_RectF m_rtBtn; - CFX_RectF m_rtClient; - int32_t m_iBtnState; - int32_t m_iYear; - int32_t m_iMonth; - int32_t m_iDay; - bool m_bLBtnDown; - std::unique_ptr<IFWL_DateTimeEdit> m_pEdit; - std::unique_ptr<IFWL_MonthCalendar> m_pMonthCal; - std::unique_ptr<IFWL_FormProxy> m_pForm; - FX_FLOAT m_fBtn; - - private: - FWL_Error DisForm_Initialize(); - void DisForm_InitMonthCalendar(); - void DisForm_InitDateTimeEdit(); - bool DisForm_IsMonthCalendarShowed(); + bool DisForm_IsMonthCalendarVisible(); void DisForm_ShowMonthCalendar(bool bActivate); FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); bool DisForm_IsNeedShowButton(); void DisForm_Update(); void DisForm_GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false); - FWL_Error DisForm_GetBBox(CFX_RectF& rect); + void DisForm_GetBBox(CFX_RectF& rect); void DisForm_DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr); - + void DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet); void OnFocusChanged(CFWL_Message* pMsg, bool bSet); void OnLButtonDown(CFWL_MsgMouse* pMsg); void OnLButtonUp(CFWL_MsgMouse* pMsg); void OnMouseMove(CFWL_MsgMouse* pMsg); void OnMouseLeave(CFWL_MsgMouse* pMsg); - void DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet); + CFX_RectF m_rtBtn; + CFX_RectF m_rtClient; + int32_t m_iBtnState; + int32_t m_iYear; + int32_t m_iMonth; + int32_t m_iDay; int32_t m_iCurYear; int32_t m_iCurMonth; int32_t m_iCurDay; + bool m_bLBtnDown; + std::unique_ptr<IFWL_DateTimeEdit> m_pEdit; + std::unique_ptr<IFWL_MonthCalendar> m_pMonthCal; + std::unique_ptr<IFWL_FormProxy> m_pForm; + FX_FLOAT m_fBtn; }; #endif // XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_ diff --git a/xfa/fwl/core/ifwl_monthcalendar.cpp b/xfa/fwl/core/ifwl_monthcalendar.cpp index e2084872dc..cec6c4ca69 100644 --- a/xfa/fwl/core/ifwl_monthcalendar.cpp +++ b/xfa/fwl/core/ifwl_monthcalendar.cpp @@ -985,7 +985,7 @@ void IFWL_MonthCalendar::OnLButtonDown(CFWL_MsgMouse* pMsg) { } } else { IFWL_DateTimePicker* pIPicker = static_cast<IFWL_DateTimePicker*>(m_pOuter); - if (pIPicker->IsMonthCalendarShowed()) + if (pIPicker->IsMonthCalendarVisible()) m_bFlag = 1; } } diff --git a/xfa/fwl/core/ifwl_tooltip.h b/xfa/fwl/core/ifwl_tooltip.h index a9ef5e27f5..d5e70cd866 100644 --- a/xfa/fwl/core/ifwl_tooltip.h +++ b/xfa/fwl/core/ifwl_tooltip.h @@ -23,8 +23,7 @@ class CFWL_ToolTipImpDelegate; class IFWL_ToolTipDP : public IFWL_DataProvider { public: // IFWL_DataProvider - FWL_Error GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) override = 0; + void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override = 0; virtual int32_t GetInitialDelay(IFWL_Widget* pWidget) = 0; virtual int32_t GetAutoPopDelay(IFWL_Widget* pWidget) = 0; |