diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-08-19 09:31:35 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-08-19 11:25:18 +0000 |
commit | 396138a6bc7192abe0837b419283860d3331f607 (patch) | |
tree | f80818ba86220abb8db205b402429e3d45aa62d1 /include/svl | |
parent | 8b4705e0e0c76503b1ca61cb567d222f49466fc5 (diff) |
Resolves: coverity#705366 Mixing enum types
and
coverity#705367 Mixing enum types
coverity#705371 Mixing enum types
coverity#982694 Mixing enum types
coverity#1027717 Mixing enum types
coverity#1371228 Mixing enum types
coverity#1371242 Mixing enum types
coverity#1371280 Mixing enum types
coverity#1371310 Mixing enum types
MapUnit and SfxMapUnit share the same values and
are freely cast from one to the other.
Now that
commit d30a4298bdb5ba53cd1fe659f2b742f218a2e527
Date: Thu Aug 11 15:02:19 2016 +0200
loplugin:unusedenumconstants in package..svtools
removed the SfxMapUnit entries that were directly unused, they
don't match anymore and casting from one to the other is dangerous.
Why there was two of these anyway escapes me, get rid of SfxMapUnit
and just use MapUnit universally
Change-Id: I4db5dcd04b59be2f85b62b728f96c90afe00c57e
Reviewed-on: https://gerrit.libreoffice.org/28234
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include/svl')
-rw-r--r-- | include/svl/cenumitm.hxx | 8 | ||||
-rw-r--r-- | include/svl/cintitem.hxx | 24 | ||||
-rw-r--r-- | include/svl/ctypeitm.hxx | 8 | ||||
-rw-r--r-- | include/svl/custritm.hxx | 7 | ||||
-rw-r--r-- | include/svl/eitem.hxx | 2 | ||||
-rw-r--r-- | include/svl/flagitem.hxx | 8 | ||||
-rw-r--r-- | include/svl/int64item.hxx | 2 | ||||
-rw-r--r-- | include/svl/intitem.hxx | 2 | ||||
-rw-r--r-- | include/svl/itempool.hxx | 10 | ||||
-rw-r--r-- | include/svl/macitem.hxx | 8 | ||||
-rw-r--r-- | include/svl/poolitem.hxx | 29 | ||||
-rw-r--r-- | include/svl/ptitem.hxx | 8 | ||||
-rw-r--r-- | include/svl/rectitem.hxx | 8 | ||||
-rw-r--r-- | include/svl/rngitem.hxx | 16 | ||||
-rw-r--r-- | include/svl/slstitm.hxx | 8 | ||||
-rw-r--r-- | include/svl/srchitem.hxx | 6 | ||||
-rw-r--r-- | include/svl/style.hxx | 2 | ||||
-rw-r--r-- | include/svl/szitem.hxx | 8 | ||||
-rw-r--r-- | include/svl/visitem.hxx | 7 |
19 files changed, 76 insertions, 95 deletions
diff --git a/include/svl/cenumitm.hxx b/include/svl/cenumitm.hxx index 6a027b3132c5..2bbe74036c17 100644 --- a/include/svl/cenumitm.hxx +++ b/include/svl/cenumitm.hxx @@ -35,11 +35,9 @@ public: virtual bool operator ==(const SfxPoolItem & rItem) const override; - virtual bool GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - OUString & rText, - const IntlWrapper * = nullptr) - const override; + virtual bool GetPresentation(SfxItemPresentation, MapUnit, MapUnit, + OUString & rText, + const IntlWrapper * = nullptr) const override; virtual bool QueryValue(css::uno::Any & rVal, sal_uInt8 = 0) const override; diff --git a/include/svl/cintitem.hxx b/include/svl/cintitem.hxx index 5f23dd12116c..12d9ce30efa8 100644 --- a/include/svl/cintitem.hxx +++ b/include/svl/cintitem.hxx @@ -42,9 +42,9 @@ public: virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - OUString & rText, - const IntlWrapper * = nullptr) + MapUnit, MapUnit, + OUString & rText, + const IntlWrapper * = nullptr) const override; virtual bool QueryValue(css::uno::Any& rVal, @@ -91,9 +91,9 @@ public: virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - OUString & rText, - const IntlWrapper * = nullptr) + MapUnit, MapUnit, + OUString & rText, + const IntlWrapper * = nullptr) const override; virtual bool QueryValue(css::uno::Any& rVal, @@ -140,9 +140,9 @@ public: virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - OUString & rText, - const IntlWrapper * = nullptr) + MapUnit, MapUnit, + OUString & rText, + const IntlWrapper * = nullptr) const override; virtual bool QueryValue(css::uno::Any& rVal, @@ -189,9 +189,9 @@ public: virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - OUString & rText, - const IntlWrapper * = nullptr) + MapUnit, MapUnit, + OUString & rText, + const IntlWrapper * = nullptr) const override; virtual bool QueryValue(css::uno::Any& rVal, diff --git a/include/svl/ctypeitm.hxx b/include/svl/ctypeitm.hxx index 3f2a712ff79a..17da7e54be71 100644 --- a/include/svl/ctypeitm.hxx +++ b/include/svl/ctypeitm.hxx @@ -47,10 +47,10 @@ public: void SetValue( const OUString& rNewVal ); virtual bool GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - OUString & rText, - const IntlWrapper* pIntlWrapper = nullptr ) const override; + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString & rText, + const IntlWrapper* pIntlWrapper = nullptr ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; diff --git a/include/svl/custritm.hxx b/include/svl/custritm.hxx index aa6d220b381d..e89479aa0e76 100644 --- a/include/svl/custritm.hxx +++ b/include/svl/custritm.hxx @@ -46,10 +46,9 @@ public: virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - OUString & rText, - const IntlWrapper * = nullptr) - const override; + MapUnit, MapUnit, + OUString & rText, + const IntlWrapper * = nullptr) const override; virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; diff --git a/include/svl/eitem.hxx b/include/svl/eitem.hxx index 599a5c1c9635..bed13e458615 100644 --- a/include/svl/eitem.hxx +++ b/include/svl/eitem.hxx @@ -86,7 +86,7 @@ public: virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, + MapUnit, MapUnit, OUString & rText, const IntlWrapper * = nullptr) const override; diff --git a/include/svl/flagitem.hxx b/include/svl/flagitem.hxx index f43d3d05b9aa..ca4864ba3d8b 100644 --- a/include/svl/flagitem.hxx +++ b/include/svl/flagitem.hxx @@ -43,10 +43,10 @@ public: virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - OUString & rText, - const IntlWrapper * = nullptr ) const override; + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString & rText, + const IntlWrapper * = nullptr ) const override; sal_uInt16 GetValue() const { return nVal; } void SetValue( sal_uInt16 nNewVal ) { DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); diff --git a/include/svl/int64item.hxx b/include/svl/int64item.hxx index 3402e1d96d68..fd6827e6d6be 100644 --- a/include/svl/int64item.hxx +++ b/include/svl/int64item.hxx @@ -27,7 +27,7 @@ public: virtual bool operator== ( const SfxPoolItem& rItem ) const override; virtual bool GetPresentation( - SfxItemPresentation, SfxMapUnit, SfxMapUnit, + SfxItemPresentation, MapUnit, MapUnit, OUString& rText, const IntlWrapper* pIntlWrapper = nullptr ) const override; virtual bool QueryValue( diff --git a/include/svl/intitem.hxx b/include/svl/intitem.hxx index 8eceede33e21..dd6b1178b5a9 100644 --- a/include/svl/intitem.hxx +++ b/include/svl/intitem.hxx @@ -60,7 +60,7 @@ public: virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, + MapUnit, MapUnit, OUString & rText, const IntlWrapper * = nullptr) const override; diff --git a/include/svl/itempool.hxx b/include/svl/itempool.hxx index d7b5b73df3e2..8925b98439ef 100644 --- a/include/svl/itempool.hxx +++ b/include/svl/itempool.hxx @@ -111,8 +111,8 @@ public: void ReleaseDefaults( bool bDelete = false ); static void ReleaseDefaults( SfxPoolItem **pDefaults, sal_uInt16 nCount, bool bDelete = false ); - virtual SfxMapUnit GetMetric( sal_uInt16 nWhich ) const; - void SetDefaultMetric( SfxMapUnit eNewMetric ); + virtual MapUnit GetMetric( sal_uInt16 nWhich ) const; + void SetDefaultMetric( MapUnit eNewMetric ); /** Request string representation of pool items. @@ -141,9 +141,9 @@ public: @return true if it has a valid string representation */ virtual bool GetPresentation( const SfxPoolItem& rItem, - SfxMapUnit ePresentationMetric, - OUString& rText, - const IntlWrapper * pIntlWrapper = nullptr ) const; + MapUnit ePresentationMetric, + OUString& rText, + const IntlWrapper * pIntlWrapper = nullptr ) const; virtual SfxItemPool* Clone() const; const OUString& GetName() const; diff --git a/include/svl/macitem.hxx b/include/svl/macitem.hxx index a6d78aa638c5..db601e059783 100644 --- a/include/svl/macitem.hxx +++ b/include/svl/macitem.hxx @@ -126,10 +126,10 @@ public: // "pure virtual methods" of SfxPoolItem virtual bool operator==( const SfxPoolItem& ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - OUString &rText, - const IntlWrapper * = nullptr ) const override; + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper * = nullptr ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const override; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const override; diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx index 2a13b9890017..2faee978ceb0 100644 --- a/include/svl/poolitem.hxx +++ b/include/svl/poolitem.hxx @@ -28,6 +28,7 @@ #include <svl/hint.hxx> #include <svl/svldllapi.h> #include <tools/debug.hxx> +#include <tools/mapunit.hxx> #include <tools/solar.h> class IntlWrapper; @@ -60,22 +61,6 @@ inline bool Any2Bool( const css::uno::Any&rValue ) return bValue; } -enum SfxMapUnit -{ - SFX_MAPUNIT_100TH_MM, - SFX_MAPUNIT_10TH_MM, - SFX_MAPUNIT_MM, - SFX_MAPUNIT_CM, - SFX_MAPUNIT_1000TH_INCH, - SFX_MAPUNIT_100TH_INCH, - SFX_MAPUNIT_10TH_INCH, - SFX_MAPUNIT_INCH, - SFX_MAPUNIT_POINT, - SFX_MAPUNIT_TWIP, - SFX_MAPUNIT_PIXEL, - SFX_MAPUNIT_RELATIVE, -}; - /* * The values of this enum describe the degree of textual * representation of an item after calling the virtual @@ -166,8 +151,8 @@ public: /** @return true if it has a valid string representation */ virtual bool GetPresentation( SfxItemPresentation ePresentation, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresentationMetric, + MapUnit eCoreMetric, + MapUnit ePresentationMetric, OUString &rText, const IntlWrapper * pIntlWrapper = nullptr ) const; @@ -256,8 +241,8 @@ public: virtual bool operator==( const SfxPoolItem& ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, + MapUnit eCoreMetric, + MapUnit ePresMetric, OUString &rText, const IntlWrapper * = nullptr ) const override; @@ -280,8 +265,8 @@ public: virtual bool operator==( const SfxPoolItem& ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, + MapUnit eCoreMetric, + MapUnit ePresMetric, OUString &rText, const IntlWrapper * = nullptr ) const override; diff --git a/include/svl/ptitem.hxx b/include/svl/ptitem.hxx index ad863ea5c284..846bf0ee2681 100644 --- a/include/svl/ptitem.hxx +++ b/include/svl/ptitem.hxx @@ -37,10 +37,10 @@ public: virtual ~SfxPointItem() {} virtual bool GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - OUString &rText, - const IntlWrapper * = nullptr ) const override; + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper * = nullptr ) const override; virtual bool operator==( const SfxPoolItem& ) const override; diff --git a/include/svl/rectitem.hxx b/include/svl/rectitem.hxx index 3d94941f3a4a..af438333dc7f 100644 --- a/include/svl/rectitem.hxx +++ b/include/svl/rectitem.hxx @@ -38,10 +38,10 @@ public: virtual ~SfxRectangleItem() {} virtual bool GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - OUString &rText, - const IntlWrapper * = nullptr ) const override; + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper * = nullptr ) const override; virtual bool operator==( const SfxPoolItem& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; diff --git a/include/svl/rngitem.hxx b/include/svl/rngitem.hxx index 91d9300500f6..8d3422346d70 100644 --- a/include/svl/rngitem.hxx +++ b/include/svl/rngitem.hxx @@ -36,10 +36,10 @@ public: SfxRangeItem( const SfxRangeItem& rItem ); virtual bool operator==( const SfxPoolItem& ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - OUString &rText, - const IntlWrapper * = nullptr ) const override; + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper * = nullptr ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; inline sal_uInt16& From() { return nFrom; } virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nVersion ) const override; @@ -58,10 +58,10 @@ public: virtual ~SfxUShortRangesItem(); virtual bool operator==( const SfxPoolItem& ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - OUString &rText, - const IntlWrapper * = nullptr ) const override; + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper * = nullptr ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nVersion ) const override; virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const override; diff --git a/include/svl/slstitm.hxx b/include/svl/slstitm.hxx index 79f4def0dcf6..b06a7351baaf 100644 --- a/include/svl/slstitm.hxx +++ b/include/svl/slstitm.hxx @@ -55,10 +55,10 @@ public: virtual bool operator==( const SfxPoolItem& ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - OUString &rText, - const IntlWrapper * = nullptr ) const override; + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper * = nullptr ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nVersion ) const override; virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const override; diff --git a/include/svl/srchitem.hxx b/include/svl/srchitem.hxx index d53abbdbd2c1..54c66cbb96d1 100644 --- a/include/svl/srchitem.hxx +++ b/include/svl/srchitem.hxx @@ -103,9 +103,9 @@ public: virtual bool operator == ( const SfxPoolItem& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - OUString &rText, const IntlWrapper * = nullptr ) const override; + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, const IntlWrapper * = nullptr ) const override; // ConfigItem virtual void Notify( const css::uno::Sequence< OUString > &rPropertyNames ) override; diff --git a/include/svl/style.hxx b/include/svl/style.hxx index c82ff8c9b7b0..2b6d586a38cc 100644 --- a/include/svl/style.hxx +++ b/include/svl/style.hxx @@ -122,7 +122,7 @@ public: virtual bool HasParentSupport() const; // Default true virtual bool HasClearParentSupport() const; // Default false virtual bool IsUsed() const; // Default true - virtual OUString GetDescription( SfxMapUnit eMetric ); + virtual OUString GetDescription( MapUnit eMetric ); SfxStyleSheetBasePool& GetPool() { return *pPool; } SfxStyleFamily GetFamily() const { return nFamily; } diff --git a/include/svl/szitem.hxx b/include/svl/szitem.hxx index 1ce7a676abbb..bcca652601a0 100644 --- a/include/svl/szitem.hxx +++ b/include/svl/szitem.hxx @@ -36,10 +36,10 @@ public: virtual ~SfxSizeItem() {} virtual bool GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - OUString &rText, - const IntlWrapper * = nullptr ) const override; + MapUnit eCoreMetric, + MapUnit ePresMetric, + OUString &rText, + const IntlWrapper * = nullptr ) const override; virtual bool operator==( const SfxPoolItem& ) const override; virtual bool QueryValue( css::uno::Any& rVal, diff --git a/include/svl/visitem.hxx b/include/svl/visitem.hxx index 9479f2c737ba..b6c2102cfaa5 100644 --- a/include/svl/visitem.hxx +++ b/include/svl/visitem.hxx @@ -46,10 +46,9 @@ public: virtual bool operator ==(const SfxPoolItem & rItem) const override; - virtual bool GetPresentation(SfxItemPresentation, - SfxMapUnit, SfxMapUnit, - OUString & rText, - const IntlWrapper * = nullptr) + virtual bool GetPresentation(SfxItemPresentation, MapUnit, MapUnit, + OUString & rText, + const IntlWrapper * = nullptr) const override; virtual bool QueryValue( css::uno::Any& rVal, |