include/vcl/field.hxx | 103 ------------------------------------------ include/vcl/longcurr.hxx | 2 include/vcl/toolkit/field.hxx | 100 ++++++++++++++++++++++++++++++++++++++++ vcl/qa/cppunit/lifecycle.cxx | 4 - 4 files changed, 103 insertions(+), 106 deletions(-)
New commits: commit 85528c15cf9ad125acd347733ca788acda299c2f Author: Caolán McNamara <[email protected]> AuthorDate: Fri Mar 27 21:13:11 2020 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Mon Apr 6 21:26:42 2020 +0200 move MetricField, MetricBox and MetricFormatter to be toolkit only Change-Id: I80d3f5896f4e3b985ab1563a0a8306e5ff7183ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91337 Tested-by: Caolán McNamara <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx index 467c515f73f1..6546854db005 100644 --- a/include/vcl/field.hxx +++ b/include/vcl/field.hxx @@ -27,7 +27,6 @@ #include <tools/date.hxx> #include <tools/time.hxx> #include <vcl/spinfld.hxx> -#include <vcl/combobox.hxx> #include <tools/fldunit.hxx> namespace com { namespace sun { namespace star { namespace lang { struct Locale; } } } } @@ -184,51 +183,6 @@ private: }; - -class VCL_DLLPUBLIC MetricFormatter : public NumericFormatter -{ -public: - virtual ~MetricFormatter() override; - - virtual void Reformat() override; - - virtual void SetUnit( FieldUnit meUnit ); - FieldUnit GetUnit() const { return meUnit; } - void SetCustomUnitText( const OUString& rStr ); - const OUString& GetCustomUnitText() const { return maCustomUnitText; } - - using NumericFormatter::SetMax; - void SetMax( sal_Int64 nNewMax, FieldUnit eInUnit ); - using NumericFormatter::GetMax; - sal_Int64 GetMax( FieldUnit eOutUnit ) const; - using NumericFormatter::SetMin; - void SetMin( sal_Int64 nNewMin, FieldUnit eInUnit ); - using NumericFormatter::GetMin; - sal_Int64 GetMin( FieldUnit eOutUnit ) const; - - void SetValue( sal_Int64 nNewValue, FieldUnit eInUnit ); - virtual void SetValue( sal_Int64 nValue ) override; - using NumericFormatter::SetUserValue; - void SetUserValue( sal_Int64 nNewValue, FieldUnit eInUnit ); - using NumericFormatter::GetValue; - sal_Int64 GetValue( FieldUnit eOutUnit ) const; - virtual OUString CreateFieldText( sal_Int64 nValue ) const override; - sal_Int64 GetCorrectedValue( FieldUnit eOutUnit ) const; - -protected: - FieldUnit meUnit; - - MetricFormatter(Edit* pEdit); - - SAL_DLLPRIVATE void ImplMetricReformat( const OUString& rStr, double& rValue, OUString& rOutStr ); - - virtual sal_Int64 GetValueFromString(const OUString& rStr) const override; - sal_Int64 GetValueFromStringUnit(const OUString& rStr, FieldUnit eOutUnit) const; - -private: - OUString maCustomUnitText; -}; - class UNLESS_MERGELIBS(VCL_DLLPUBLIC) DateFormatter : public FormatterBase { private: @@ -377,7 +331,6 @@ public: bool IsEnforceValidValue( ) const { return mbEnforceValidValue; } }; - class UNLESS_MERGELIBS(VCL_DLLPUBLIC) PatternField final : public SpinField, public PatternFormatter { public: @@ -413,38 +366,6 @@ public: virtual boost::property_tree::ptree DumpAsPropertyTree() override; }; - -class VCL_DLLPUBLIC MetricField : public SpinField, public MetricFormatter -{ -public: - explicit MetricField( vcl::Window* pParent, WinBits nWinStyle ); - - virtual bool PreNotify( NotifyEvent& rNEvt ) override; - virtual bool EventNotify( NotifyEvent& rNEvt ) override; - virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; - - virtual Size CalcMinimumSize() const override; - - virtual void Modify() override; - - virtual void Up() override; - virtual void Down() override; - virtual void First() override; - virtual void Last() override; - - virtual void SetUnit( FieldUnit meUnit ) override; - - void SetFirst( sal_Int64 nNewFirst, FieldUnit eInUnit ); - sal_Int64 GetFirst( FieldUnit eOutUnit ) const; - void SetLast( sal_Int64 nNewLast, FieldUnit eInUnit ); - sal_Int64 GetLast( FieldUnit eOutUnit ) const; - - virtual bool set_property(const OString &rKey, const OUString &rValue) override; - virtual void dispose() override; - - virtual boost::property_tree::ptree DumpAsPropertyTree() override; -}; - class UNLESS_MERGELIBS(VCL_DLLPUBLIC) DateField : public SpinField, public DateFormatter { private: @@ -506,30 +427,6 @@ public: virtual void dispose() override; }; -class VCL_DLLPUBLIC MetricBox : public ComboBox, public MetricFormatter -{ -public: - explicit MetricBox( vcl::Window* pParent, WinBits nWinStyle ); - - virtual bool PreNotify( NotifyEvent& rNEvt ) override; - virtual bool EventNotify( NotifyEvent& rNEvt ) override; - virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; - - virtual Size CalcMinimumSize() const override; - - virtual void Modify() override; - - virtual void ReformatAll() override; - - void InsertValue( sal_Int64 nValue, FieldUnit eInUnit = FieldUnit::NONE, - sal_Int32 nPos = COMBOBOX_APPEND ); - - // Needed, because GetValue() with nPos hide these functions - using MetricFormatter::GetValue; - - virtual void dispose() override; -}; - #endif // INCLUDED_VCL_FIELD_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/longcurr.hxx b/include/vcl/longcurr.hxx index ddc05fa904ae..b139517dd0b8 100644 --- a/include/vcl/longcurr.hxx +++ b/include/vcl/longcurr.hxx @@ -23,11 +23,11 @@ #include <config_options.h> #include <vcl/dllapi.h> #include <tools/bigint.hxx> +#include <vcl/combobox.hxx> #include <vcl/field.hxx> class LocaleDataWrapper; - class UNLESS_MERGELIBS(VCL_DLLPUBLIC) LongCurrencyFormatter : public FormatterBase { public: diff --git a/include/vcl/toolkit/field.hxx b/include/vcl/toolkit/field.hxx index 47156bc8c388..f0b0a8b3521a 100644 --- a/include/vcl/toolkit/field.hxx +++ b/include/vcl/toolkit/field.hxx @@ -25,8 +25,108 @@ #endif #include <config_options.h> +#include <vcl/combobox.hxx> #include <vcl/field.hxx> +class VCL_DLLPUBLIC MetricFormatter : public NumericFormatter +{ +public: + virtual ~MetricFormatter() override; + + virtual void Reformat() override; + + virtual void SetUnit( FieldUnit meUnit ); + FieldUnit GetUnit() const { return meUnit; } + void SetCustomUnitText( const OUString& rStr ); + const OUString& GetCustomUnitText() const { return maCustomUnitText; } + + using NumericFormatter::SetMax; + void SetMax( sal_Int64 nNewMax, FieldUnit eInUnit ); + using NumericFormatter::GetMax; + sal_Int64 GetMax( FieldUnit eOutUnit ) const; + using NumericFormatter::SetMin; + void SetMin( sal_Int64 nNewMin, FieldUnit eInUnit ); + using NumericFormatter::GetMin; + sal_Int64 GetMin( FieldUnit eOutUnit ) const; + + void SetValue( sal_Int64 nNewValue, FieldUnit eInUnit ); + virtual void SetValue( sal_Int64 nValue ) override; + using NumericFormatter::SetUserValue; + void SetUserValue( sal_Int64 nNewValue, FieldUnit eInUnit ); + using NumericFormatter::GetValue; + sal_Int64 GetValue( FieldUnit eOutUnit ) const; + virtual OUString CreateFieldText( sal_Int64 nValue ) const override; + sal_Int64 GetCorrectedValue( FieldUnit eOutUnit ) const; + +protected: + FieldUnit meUnit; + + MetricFormatter(Edit* pEdit); + + SAL_DLLPRIVATE void ImplMetricReformat( const OUString& rStr, double& rValue, OUString& rOutStr ); + + virtual sal_Int64 GetValueFromString(const OUString& rStr) const override; + sal_Int64 GetValueFromStringUnit(const OUString& rStr, FieldUnit eOutUnit) const; + +private: + OUString maCustomUnitText; +}; + +class VCL_DLLPUBLIC MetricField : public SpinField, public MetricFormatter +{ +public: + explicit MetricField( vcl::Window* pParent, WinBits nWinStyle ); + + virtual bool PreNotify( NotifyEvent& rNEvt ) override; + virtual bool EventNotify( NotifyEvent& rNEvt ) override; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + + virtual Size CalcMinimumSize() const override; + + virtual void Modify() override; + + virtual void Up() override; + virtual void Down() override; + virtual void First() override; + virtual void Last() override; + + virtual void SetUnit( FieldUnit meUnit ) override; + + void SetFirst( sal_Int64 nNewFirst, FieldUnit eInUnit ); + sal_Int64 GetFirst( FieldUnit eOutUnit ) const; + void SetLast( sal_Int64 nNewLast, FieldUnit eInUnit ); + sal_Int64 GetLast( FieldUnit eOutUnit ) const; + + virtual bool set_property(const OString &rKey, const OUString &rValue) override; + virtual void dispose() override; + + virtual boost::property_tree::ptree DumpAsPropertyTree() override; +}; + +class VCL_DLLPUBLIC MetricBox : public ComboBox, public MetricFormatter +{ +public: + explicit MetricBox( vcl::Window* pParent, WinBits nWinStyle ); + + virtual bool PreNotify( NotifyEvent& rNEvt ) override; + virtual bool EventNotify( NotifyEvent& rNEvt ) override; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + + virtual Size CalcMinimumSize() const override; + + virtual void Modify() override; + + virtual void ReformatAll() override; + + void InsertValue( sal_Int64 nValue, FieldUnit eInUnit = FieldUnit::NONE, + sal_Int32 nPos = COMBOBOX_APPEND ); + + // Needed, because GetValue() with nPos hide these functions + using MetricFormatter::GetValue; + + virtual void dispose() override; +}; + class UNLESS_MERGELIBS(VCL_DLLPUBLIC) CurrencyFormatter : public NumericFormatter { protected: diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx index faf009a01f0e..caa309f4bc84 100644 --- a/vcl/qa/cppunit/lifecycle.cxx +++ b/vcl/qa/cppunit/lifecycle.cxx @@ -13,10 +13,10 @@ #include <vcl/button.hxx> #include <vcl/edit.hxx> #include <vcl/combobox.hxx> -#include <vcl/field.hxx> +#include <vcl/toolkit/dialog.hxx> +#include <vcl/toolkit/field.hxx> #include <vcl/virdev.hxx> #include <vcl/tabctrl.hxx> -#include <vcl/toolkit/dialog.hxx> #include <vcl/layout.hxx> #include <vcl/scheduler.hxx> #include <com/sun/star/awt/XWindow.hpp> _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
