diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-06 14:37:23 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-08 12:15:51 +0100 |
commit | 9e0770ea7e0cf094add54ad64bc9ff825d24bbe1 (patch) | |
tree | e897291e44ecb11ca44ba5e5ebefe03ac536862f /include | |
parent | 841ee6fb052fb35467d74b70f575a86c8c0fe3b7 (diff) |
Convert FieldUnit to scoped enum
Change-Id: Id2df31daa596a18c79af5fc6ea162deb6e24d5af
Reviewed-on: https://gerrit.libreoffice.org/62958
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/sfx2/module.hxx | 2 | ||||
-rw-r--r-- | include/svtools/ctrlbox.hxx | 2 | ||||
-rw-r--r-- | include/svtools/ruler.hxx | 18 | ||||
-rw-r--r-- | include/svx/svdtrans.hxx | 8 | ||||
-rw-r--r-- | include/svx/sxmuitm.hxx | 2 | ||||
-rw-r--r-- | include/tools/fldunit.hxx | 30 | ||||
-rw-r--r-- | include/vcl/field.hxx | 8 |
7 files changed, 47 insertions, 23 deletions
diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx index 1eb9ef1f414f..842cab05e4e8 100644 --- a/include/sfx2/module.hxx +++ b/include/sfx2/module.hxx @@ -92,7 +92,7 @@ public: Effectively, this method looks up the SfxViewFrame belonging to the given XFrame, then the SfxModule belonging to the document in this frame, then this module's field unit. - Failures in any of those steps are reported as assertion in non-product builds, and then FUNIT_100TH_MM is returned. + Failures in any of those steps are reported as assertion in non-product builds, and then FieldUnit::MM_100TH is returned. */ static FieldUnit GetModuleFieldUnit( css::uno::Reference< css::frame::XFrame > const & i_frame ); FieldUnit GetFieldUnit() const; diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx index 7849cdfad9ac..d6e8f8f8ae63 100644 --- a/include/svtools/ctrlbox.hxx +++ b/include/svtools/ctrlbox.hxx @@ -54,7 +54,7 @@ All scalar numbers in 1/100 of the corresponding unit. Line1 is the outer, Line2 the inner line, Distance is the distance between these two lines. If Line2 == 0, only Line1 will be shown. Defaults for -source and target unit are FUNIT_POINT. +source and target unit are FieldUnit::POINT. SetColor() sets the line color. diff --git a/include/svtools/ruler.hxx b/include/svtools/ruler.hxx index 8429ea1c74e6..e4baeb882500 100644 --- a/include/svtools/ruler.hxx +++ b/include/svtools/ruler.hxx @@ -111,15 +111,15 @@ The values are computed as described below: SetUnit() and SetZoom() configure which unit is used to display the values on the ruler. The following units are accepted: - FUNIT_MM - FUNIT_CM (Default) - FUNIT_M - FUNIT_KM - FUNIT_INCH - FUNIT_FOOT - FUNIT_MILE - FUNIT_POINT - FUNIT_PICA + FieldUnit::MM + FieldUnit::CM (Default) + FieldUnit::M + FieldUnit::KM + FieldUnit::INCH + FieldUnit::FOOT + FieldUnit::MILE + FieldUnit::POINT + FieldUnit::PICA -------------------------------------------------------------------------- diff --git a/include/svx/svdtrans.hxx b/include/svx/svdtrans.hxx index 644843347a32..a27515e86327 100644 --- a/include/svx/svdtrans.hxx +++ b/include/svx/svdtrans.hxx @@ -265,12 +265,14 @@ inline bool IsInch(MapUnit eU) { } inline bool IsMetric(FieldUnit eU) { - return (eU==FUNIT_MM || eU==FUNIT_CM || eU==FUNIT_M || eU==FUNIT_KM || eU==FUNIT_100TH_MM); + return (eU == FieldUnit::MM || eU == FieldUnit::CM || eU == FieldUnit::M + || eU == FieldUnit::KM || eU == FieldUnit::MM_100TH); } inline bool IsInch(FieldUnit eU) { - return (eU==FUNIT_TWIP || eU==FUNIT_POINT || eU==FUNIT_PICA || - eU==FUNIT_INCH || eU==FUNIT_FOOT || eU==FUNIT_MILE); + return (eU == FieldUnit::TWIP || eU == FieldUnit::POINT + || eU == FieldUnit::PICA || eU == FieldUnit::INCH + || eU == FieldUnit::FOOT || eU == FieldUnit::MILE); } class SVX_DLLPUBLIC SdrFormatter { diff --git a/include/svx/sxmuitm.hxx b/include/svx/sxmuitm.hxx index 996b195f5b07..3d62f15320b5 100644 --- a/include/svx/sxmuitm.hxx +++ b/include/svx/sxmuitm.hxx @@ -28,7 +28,7 @@ // (based on the facts of the MapUnit of the model). This unity is displayed if necessary. class SVX_DLLPUBLIC SdrMeasureUnitItem: public SfxEnumItem<FieldUnit> { public: - SdrMeasureUnitItem(FieldUnit eUnit=FUNIT_NONE): SfxEnumItem(SDRATTR_MEASUREUNIT, eUnit) {} + SdrMeasureUnitItem(FieldUnit eUnit=FieldUnit::NONE): SfxEnumItem(SDRATTR_MEASUREUNIT, eUnit) {} virtual SfxPoolItem* Clone(SfxItemPool* pPool=nullptr) const override; virtual sal_uInt16 GetValueCount() const override; // { return 14; } diff --git a/include/tools/fldunit.hxx b/include/tools/fldunit.hxx index 65beb743a07a..c300ef2ef31f 100644 --- a/include/tools/fldunit.hxx +++ b/include/tools/fldunit.hxx @@ -19,10 +19,32 @@ #ifndef INCLUDED_TOOLS_FLDUNIT_HXX #define INCLUDED_TOOLS_FLDUNIT_HXX -enum FieldUnit { FUNIT_NONE, FUNIT_MM, FUNIT_CM, FUNIT_M, FUNIT_KM, - FUNIT_TWIP, FUNIT_POINT, FUNIT_PICA, - FUNIT_INCH, FUNIT_FOOT, FUNIT_MILE, FUNIT_CHAR, FUNIT_LINE, FUNIT_CUSTOM, - FUNIT_PERCENT, FUNIT_100TH_MM, FUNIT_PIXEL, FUNIT_DEGREE, FUNIT_SECOND, FUNIT_MILLISECOND }; +#include <sal/types.h> + +// Corresponds to offapi/com/sun/star/awt/FieldUnit.idl +enum class FieldUnit : sal_uInt16 +{ + NONE, + MM, + CM, + M, + KM, + TWIP, + POINT, + PICA, + INCH, + FOOT, + MILE, + CHAR, + LINE, + CUSTOM, + PERCENT, + MM_100TH, + PIXEL, + DEGREE, + SECOND, + MILLISECOND, +}; #endif diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx index 33c7ecf4e000..0c0abcd9df55 100644 --- a/include/vcl/field.hxx +++ b/include/vcl/field.hxx @@ -222,7 +222,7 @@ public: void SetMin( sal_Int64 nNewMin, FieldUnit eInUnit ); using NumericFormatter::GetMin; sal_Int64 GetMin( FieldUnit eOutUnit ) const; - void SetBaseValue( sal_Int64 nNewBase, FieldUnit eInUnit = FUNIT_NONE ); + void SetBaseValue( sal_Int64 nNewBase, FieldUnit eInUnit = FieldUnit::NONE ); sal_Int64 GetBaseValue() const; virtual void SetValue( sal_Int64 nNewValue, FieldUnit eInUnit ); @@ -486,10 +486,10 @@ public: virtual void SetUnit( FieldUnit meUnit ) override; void SetFirst( sal_Int64 nNewFirst, FieldUnit eInUnit ); - void SetFirst(sal_Int64 first) { SetFirst(first, FUNIT_NONE); } + void SetFirst(sal_Int64 first) { SetFirst(first, FieldUnit::NONE); } sal_Int64 GetFirst( FieldUnit eOutUnit ) const; void SetLast( sal_Int64 nNewLast, FieldUnit eInUnit ); - void SetLast(sal_Int64 last) { SetLast(last, FUNIT_NONE); } + void SetLast(sal_Int64 last) { SetLast(last, FieldUnit::NONE); } sal_Int64 GetLast( FieldUnit eOutUnit ) const; static void SetDefaultUnit( FieldUnit eDefaultUnit ); @@ -660,7 +660,7 @@ public: virtual void CustomConvert() override; virtual void ReformatAll() override; - void InsertValue( sal_Int64 nValue, FieldUnit eInUnit = FUNIT_NONE, + void InsertValue( sal_Int64 nValue, FieldUnit eInUnit = FieldUnit::NONE, sal_Int32 nPos = COMBOBOX_APPEND ); // Needed, because GetValue() with nPos hide these functions |