diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-01 14:17:08 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-03 06:44:41 +0000 |
commit | f091259ad2ec1590714645839668580cd7b8c7c4 (patch) | |
tree | 3bf6b328637358365848bc98a18cbf82ccd4b2d0 /svx | |
parent | d0cc5fcd5bacd8e5e0fa7fe62a78907c2febb867 (diff) |
convert SfxEnumItem to type-safe template class
and drop the SvxChartTextOrientItem class, unused.
Change-Id: I99100837d1beb953450f57b2cda47d165df1620c
Reviewed-on: https://gerrit.libreoffice.org/34747
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/inc/sxcikitm.hxx | 7 | ||||
-rw-r--r-- | svx/inc/sxmkitm.hxx | 7 | ||||
-rw-r--r-- | svx/source/items/algitem.cxx | 6 | ||||
-rw-r--r-- | svx/source/items/chrtitem.cxx | 27 | ||||
-rw-r--r-- | svx/source/items/rotmodit.cxx | 4 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrattributecreator.cxx | 10 | ||||
-rw-r--r-- | svx/source/svdraw/svdattr.cxx | 24 | ||||
-rw-r--r-- | svx/source/xoutdev/xattr.cxx | 21 | ||||
-rw-r--r-- | svx/source/xoutdev/xattr2.cxx | 10 |
9 files changed, 48 insertions, 68 deletions
diff --git a/svx/inc/sxcikitm.hxx b/svx/inc/sxcikitm.hxx index 4aab9ea5b52a..5f918c28bcd8 100644 --- a/svx/inc/sxcikitm.hxx +++ b/svx/inc/sxcikitm.hxx @@ -27,14 +27,13 @@ enum SdrCircKind {SDRCIRC_FULL, SDRCIRC_CUT, SDRCIRC_ARC}; -class SdrCircKindItem: public SfxEnumItem { +class SdrCircKindItem: public SfxEnumItem<SdrCircKind> { public: - SdrCircKindItem(SdrCircKind eKind=SDRCIRC_FULL): SfxEnumItem(SDRATTR_CIRCKIND,sal::static_int_cast< sal_uInt16 >(eKind)) {} + SdrCircKindItem(SdrCircKind eKind=SDRCIRC_FULL): SfxEnumItem(SDRATTR_CIRCKIND, eKind) {} SdrCircKindItem(SvStream& rIn) : SfxEnumItem(SDRATTR_CIRCKIND,rIn) {} virtual SfxPoolItem* Clone(SfxItemPool* pPool=nullptr) const override; virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const override; - virtual sal_uInt16 GetValueCount() const override; // { return 4; } - SdrCircKind GetValue() const { return (SdrCircKind)SfxEnumItem::GetValue(); } + virtual sal_uInt16 GetValueCount() const override; // { return 4; } virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; diff --git a/svx/inc/sxmkitm.hxx b/svx/inc/sxmkitm.hxx index cbd93c5a4ba4..bf695a4ff83f 100644 --- a/svx/inc/sxmkitm.hxx +++ b/svx/inc/sxmkitm.hxx @@ -27,14 +27,13 @@ enum SdrMeasureKind {SDRMEASURE_STD,SDRMEASURE_RADIUS}; // n.i. // class SdrMeasureKindItem (n.i.) -class SdrMeasureKindItem: public SfxEnumItem { +class SdrMeasureKindItem: public SfxEnumItem<SdrMeasureKind> { public: - SdrMeasureKindItem(SdrMeasureKind eKind=SDRMEASURE_STD): SfxEnumItem(SDRATTR_MEASUREKIND,sal::static_int_cast< sal_uInt16 >(eKind)) {} + SdrMeasureKindItem(SdrMeasureKind eKind=SDRMEASURE_STD): SfxEnumItem(SDRATTR_MEASUREKIND, eKind) {} SdrMeasureKindItem(SvStream& rIn) : SfxEnumItem(SDRATTR_MEASUREKIND,rIn) {} virtual SfxPoolItem* Clone(SfxItemPool* pPool=nullptr) const override; virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const override; - virtual sal_uInt16 GetValueCount() const override; // { return 2; } - SdrMeasureKind GetValue() const { return (SdrMeasureKind)SfxEnumItem::GetValue(); } + virtual sal_uInt16 GetValueCount() const override; // { return 2; } virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; diff --git a/svx/source/items/algitem.cxx b/svx/source/items/algitem.cxx index f7df00afd16e..afef2e6f446c 100644 --- a/svx/source/items/algitem.cxx +++ b/svx/source/items/algitem.cxx @@ -46,12 +46,12 @@ SfxPoolItem* SvxMarginItem::CreateDefault() { return new SvxMarginItem(0) ;} SvxOrientationItem::SvxOrientationItem( const SvxCellOrientation eOrientation, const sal_uInt16 nId): - SfxEnumItem( nId, (sal_uInt16)eOrientation ) + SfxEnumItem( nId, eOrientation ) { } SvxOrientationItem::SvxOrientationItem( sal_Int32 nRotation, bool bStacked, const sal_uInt16 nId ) : - SfxEnumItem( nId ) + SfxEnumItem( nId, SvxCellOrientation::SVX_ORIENTATION_STANDARD ) { if( bStacked ) { @@ -111,7 +111,7 @@ bool SvxOrientationItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ case table::CellOrientation_STACKED: eSvx = SVX_ORIENTATION_STACKED; break; default: ; //prevent warning } - SetValue( (sal_uInt16)eSvx ); + SetValue( eSvx ); return true; } diff --git a/svx/source/items/chrtitem.cxx b/svx/source/items/chrtitem.cxx index 945ed3ef6c57..4680ddefb144 100644 --- a/svx/source/items/chrtitem.cxx +++ b/svx/source/items/chrtitem.cxx @@ -34,7 +34,7 @@ SfxPoolItem* SvxDoubleItem::CreateDefault() { return new SvxDoubleItem(0.0, 0); SvxChartTextOrderItem::SvxChartTextOrderItem(SvxChartTextOrder eOrder, sal_uInt16 nId) : - SfxEnumItem(nId, (sal_uInt16)eOrder) + SfxEnumItem(nId, eOrder) { } @@ -110,28 +110,11 @@ bool SvxChartTextOrderItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMe return false; } - SetValue( (sal_uInt16)eOrder ); + SetValue( eOrder ); return true; } -SvxChartTextOrientItem::SvxChartTextOrientItem(SvStream& rIn, sal_uInt16 nId) : - SfxEnumItem(nId, rIn) -{ -} - - -SfxPoolItem* SvxChartTextOrientItem::Clone(SfxItemPool* /*pPool*/) const -{ - return new SvxChartTextOrientItem(*this); -} - - -SfxPoolItem* SvxChartTextOrientItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const -{ - return new SvxChartTextOrientItem(rIn, Which()); -} - SvxDoubleItem::SvxDoubleItem(double fValue, sal_uInt16 nId) : SfxPoolItem(nId), fVal(fValue) @@ -201,7 +184,7 @@ bool SvxDoubleItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) SvxChartKindErrorItem::SvxChartKindErrorItem(SvxChartKindError eOrient, sal_uInt16 nId) : - SfxEnumItem(nId, (sal_uInt16)eOrient) + SfxEnumItem(nId, eOrient) { } @@ -233,7 +216,7 @@ sal_uInt16 SvxChartKindErrorItem::GetVersion (sal_uInt16 nFileFormatVersion) con SvxChartIndicateItem::SvxChartIndicateItem(SvxChartIndicate eOrient, sal_uInt16 nId) : - SfxEnumItem(nId, (sal_uInt16)eOrient) + SfxEnumItem(nId, eOrient) { } @@ -265,7 +248,7 @@ sal_uInt16 SvxChartIndicateItem::GetVersion (sal_uInt16 nFileFormatVersion) cons SvxChartRegressItem::SvxChartRegressItem(SvxChartRegress eOrient, sal_uInt16 nId) : - SfxEnumItem(nId, (sal_uInt16)eOrient) + SfxEnumItem(nId, eOrient) { } diff --git a/svx/source/items/rotmodit.cxx b/svx/source/items/rotmodit.cxx index 41262a8973d4..52ab4748cb55 100644 --- a/svx/source/items/rotmodit.cxx +++ b/svx/source/items/rotmodit.cxx @@ -44,7 +44,7 @@ SfxPoolItem* SvxRotateModeItem::CreateDefault() { return new SvxRotateModeItem( SvxRotateModeItem::SvxRotateModeItem( SvxRotateMode eMode, sal_uInt16 _nWhich ) - : SfxEnumItem( _nWhich, (sal_uInt16)eMode ) + : SfxEnumItem( _nWhich, eMode ) { } @@ -133,7 +133,7 @@ bool SvxRotateModeItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ case table::CellVertJustify2::BOTTOM: eSvx = SVX_ROTATE_MODE_BOTTOM; break; default: ;//prevent warning } - SetValue( (sal_uInt16)eSvx ); + SetValue( eSvx ); return true; } diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index e150b19469f5..1c5535c9f195 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -23,6 +23,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <svx/xlineit0.hxx> #include <svx/xfillit0.hxx> +#include <svx/xflbmpit.hxx> #include <svx/xlntrit.hxx> #include <svx/xlnwtit.hxx> #include <svx/xlinjoit.hxx> @@ -699,11 +700,10 @@ namespace drawinglayer aSize, aOffset, aOffsetPosition, - RectPointToB2DVector( - (RectPoint)static_cast<const SfxEnumItem&>(rSet.Get(XATTR_FILLBMP_POS)).GetValue()), - static_cast<const SfxBoolItem&>(rSet.Get(XATTR_FILLBMP_TILE)).GetValue(), - static_cast<const SfxBoolItem&>(rSet.Get(XATTR_FILLBMP_STRETCH)).GetValue(), - static_cast<const SfxBoolItem&>(rSet.Get(XATTR_FILLBMP_SIZELOG)).GetValue()); + RectPointToB2DVector(rSet.GetItem<XFillBmpPosItem>(XATTR_FILLBMP_POS)->GetValue()), + static_cast<const SfxBoolItem&>(rSet.Get(XATTR_FILLBMP_TILE)).GetValue(), + static_cast<const SfxBoolItem&>(rSet.Get(XATTR_FILLBMP_STRETCH)).GetValue(), + static_cast<const SfxBoolItem&>(rSet.Get(XATTR_FILLBMP_SIZELOG)).GetValue()); } attribute::SdrShadowTextAttribute createNewSdrShadowTextAttribute( diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index fcf56a6779b6..7320c1c7aa66 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -1036,7 +1036,7 @@ bool SdrTextFitToSizeTypeItem::GetBoolValue() const { return GetValue()!=SdrFitT void SdrTextFitToSizeTypeItem::SetBoolValue(bool bVal) { - SetValue(sal::static_int_cast< sal_uInt16 >(bVal ? SdrFitToSizeType::Proportional : SdrFitToSizeType::NONE)); + SetValue(bVal ? SdrFitToSizeType::Proportional : SdrFitToSizeType::NONE); } bool SdrTextFitToSizeTypeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const @@ -1059,7 +1059,7 @@ bool SdrTextFitToSizeTypeItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemb eFS = (drawing::TextFitToSizeType) nEnum; } - SetValue( sal::static_int_cast< sal_uInt16 >( (SdrFitToSizeType)eFS ) ); + SetValue( (SdrFitToSizeType)eFS ); return true; } @@ -1107,7 +1107,7 @@ bool SdrTextVertAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberI eAdj = (drawing::TextVerticalAdjust)nEnum; } - SetValue( sal::static_int_cast< sal_uInt16 >( (SdrTextVertAdjust)eAdj ) ); + SetValue( (SdrTextVertAdjust)eAdj ); return true; } @@ -1162,7 +1162,7 @@ bool SdrTextHorzAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberI eAdj = (drawing::TextHorizontalAdjust)nEnum; } - SetValue( sal::static_int_cast< sal_uInt16 >( (SdrTextHorzAdjust)eAdj ) ); + SetValue( (SdrTextHorzAdjust)eAdj ); return true; } @@ -1209,7 +1209,7 @@ bool SdrTextAniKindItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ eKind = (drawing::TextAnimationKind)nEnum; } - SetValue( sal::static_int_cast< sal_uInt16 >( (SdrTextAniKind)eKind ) ); + SetValue( (SdrTextAniKind)eKind ); return true; } @@ -1257,7 +1257,7 @@ bool SdrTextAniDirectionItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMembe eDir = (drawing::TextAnimationDirection)nEnum; } - SetValue( sal::static_int_cast< sal_uInt16 >( (SdrTextAniDirection)eDir ) ); + SetValue( (SdrTextAniDirection)eDir ); return true; } @@ -1615,7 +1615,7 @@ bool SdrEdgeKindItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/) default: OSL_FAIL( "SdrEdgeKindItem::PuValue : unknown enum" ); } - SetValue( sal::static_int_cast< sal_uInt16 >( eEK ) ); + SetValue( eEK ); return true; } @@ -1756,7 +1756,7 @@ bool SdrMeasureKindItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ eKind = (drawing::MeasureKind)nEnum; } - SetValue( sal::static_int_cast< sal_uInt16 >( (SdrMeasureKind)eKind ) ); + SetValue( (SdrMeasureKind)eKind ); return true; } @@ -1803,7 +1803,7 @@ bool SdrMeasureTextHPosItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMember ePos = (drawing::MeasureTextHorzPos)nEnum; } - SetValue(sal::static_int_cast<sal_uInt16>(ePos)); + SetValue(ePos); return true; } @@ -1850,7 +1850,7 @@ bool SdrMeasureTextVPosItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMember ePos = (drawing::MeasureTextVertPos)nEnum; } - SetValue(sal::static_int_cast<sal_uInt16>(ePos)); + SetValue(ePos); return true; } @@ -1897,7 +1897,7 @@ bool SdrMeasureUnitItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ if(!(rVal >>= nMeasure)) return false; - SetValue( sal::static_int_cast< sal_uInt16 >( (FieldUnit)nMeasure ) ); + SetValue( (FieldUnit)nMeasure ); return true; } @@ -1944,7 +1944,7 @@ bool SdrCircKindItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/) eKind = (drawing::CircleKind)nEnum; } - SetValue( sal::static_int_cast< sal_uInt16 >( (SdrCircKind)eKind ) ); + SetValue( (SdrCircKind)eKind ); return true; } diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 4f84f675e63b..c7e3365e23a7 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -359,7 +359,7 @@ bool XColorItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/) SfxPoolItem* XLineStyleItem::CreateDefault() { return new XLineStyleItem; } XLineStyleItem::XLineStyleItem(css::drawing::LineStyle eTheLineStyle) : - SfxEnumItem(XATTR_LINESTYLE, sal::static_int_cast< sal_uInt16 >(eTheLineStyle)) + SfxEnumItem(XATTR_LINESTYLE, eTheLineStyle) { } @@ -424,7 +424,7 @@ bool XLineStyleItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId* eLS = (css::drawing::LineStyle)nLS; } - SetValue( sal::static_int_cast< sal_uInt16 >( eLS ) ); + SetValue( eLS ); return true; } @@ -2115,7 +2115,7 @@ bool XLineEndCenterItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMembe SfxPoolItem* XFillStyleItem::CreateDefault() { return new XFillStyleItem; } XFillStyleItem::XFillStyleItem(drawing::FillStyle eFillStyle) : - SfxEnumItem(XATTR_FILLSTYLE, sal::static_int_cast< sal_uInt16 >(eFillStyle)) + SfxEnumItem(XATTR_FILLSTYLE, eFillStyle) { } @@ -2196,7 +2196,7 @@ bool XFillStyleItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId* eFS = (css::drawing::FillStyle)nFS; } - SetValue( sal::static_int_cast< sal_uInt16 >( eFS ) ); + SetValue( eFS ); return true; } @@ -3164,7 +3164,7 @@ XFillHatchItem* XFillHatchItem::checkForUniqueItem( SdrModel* pModel ) const SfxPoolItem* XFormTextStyleItem::CreateDefault() { return new XFormTextStyleItem; } XFormTextStyleItem::XFormTextStyleItem(XFormTextStyle eTheStyle) : - SfxEnumItem(XATTR_FORMTXTSTYLE, sal::static_int_cast< sal_uInt16 >(eTheStyle)) + SfxEnumItem(XATTR_FORMTXTSTYLE, eTheStyle) { } @@ -3198,7 +3198,7 @@ bool XFormTextStyleItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ { sal_Int32 nValue = 0; rVal >>= nValue; - SetValue(sal::static_int_cast< sal_uInt16 >(nValue)); + SetValue((XFormTextStyle)nValue); return true; } @@ -3207,7 +3207,7 @@ bool XFormTextStyleItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ SfxPoolItem* XFormTextAdjustItem::CreateDefault() { return new XFormTextAdjustItem; } XFormTextAdjustItem::XFormTextAdjustItem(XFormTextAdjust eTheAdjust) : - SfxEnumItem(XATTR_FORMTXTADJUST, sal::static_int_cast< sal_uInt16 >(eTheAdjust)) + SfxEnumItem(XATTR_FORMTXTADJUST, eTheAdjust) { } @@ -3241,7 +3241,7 @@ bool XFormTextAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId* { sal_Int32 nValue = 0; rVal >>= nValue; - SetValue(sal::static_int_cast< sal_uInt16 >(nValue)); + SetValue((XFormTextAdjust)nValue); return true; } @@ -3341,8 +3341,7 @@ SfxPoolItem* XFormTextOutlineItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) co SfxPoolItem* XFormTextShadowItem::CreateDefault() { return new XFormTextShadowItem; } XFormTextShadowItem::XFormTextShadowItem(XFormTextShadow eFormTextShadow) : - SfxEnumItem( - XATTR_FORMTXTSHADOW, sal::static_int_cast< sal_uInt16 >(eFormTextShadow)) + SfxEnumItem(XATTR_FORMTXTSHADOW, eFormTextShadow) { } @@ -3376,7 +3375,7 @@ bool XFormTextShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId* { sal_Int32 nValue = 0; rVal >>= nValue; - SetValue(sal::static_int_cast< sal_uInt16 >(nValue)); + SetValue((XFormTextShadow)nValue); return true; } diff --git a/svx/source/xoutdev/xattr2.cxx b/svx/source/xoutdev/xattr2.cxx index 0307e31b8431..26f9f26816f6 100644 --- a/svx/source/xoutdev/xattr2.cxx +++ b/svx/source/xoutdev/xattr2.cxx @@ -84,7 +84,7 @@ bool XLineTransparenceItem::GetPresentation SfxPoolItem* XLineJointItem::CreateDefault() { return new XLineJointItem; } XLineJointItem::XLineJointItem( css::drawing::LineJoint eLineJoint ) : - SfxEnumItem(XATTR_LINEJOINT, sal::static_int_cast< sal_uInt16 >(eLineJoint)) + SfxEnumItem(XATTR_LINEJOINT, eLineJoint) { } @@ -173,7 +173,7 @@ bool XLineJointItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId* eUnoJoint = (css::drawing::LineJoint)nLJ; } - SetValue( sal::static_int_cast< sal_uInt16 >( eUnoJoint ) ); + SetValue( eUnoJoint ); return true; } @@ -288,7 +288,7 @@ bool AffineMatrixItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberI SfxPoolItem* XLineCapItem::CreateDefault() { return new XLineCapItem; } XLineCapItem::XLineCapItem(css::drawing::LineCap eLineCap) -: SfxEnumItem(XATTR_LINECAP, sal::static_int_cast< sal_uInt16 >(eLineCap)) +: SfxEnumItem(XATTR_LINECAP, eLineCap) { } @@ -373,7 +373,7 @@ bool XLineCapItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/) || css::drawing::LineCap_ROUND == eUnoCap || css::drawing::LineCap_SQUARE == eUnoCap, "Unknown enum value in XATTR_LINECAP (!)"); - SetValue(sal::static_int_cast< sal_uInt16 >(eUnoCap)); + SetValue(eUnoCap); return true; } @@ -558,7 +558,7 @@ void XFillBmpTileItem::dumpAsXml(xmlTextWriterPtr pWriter) const SfxPoolItem* XFillBmpPosItem::CreateDefault() {return new XFillBmpPosItem;} XFillBmpPosItem::XFillBmpPosItem( RectPoint eRP ) : - SfxEnumItem( XATTR_FILLBMP_POS, sal::static_int_cast< sal_uInt16 >( eRP ) ) + SfxEnumItem( XATTR_FILLBMP_POS, eRP ) { } |