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 /editeng | |
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 'editeng')
-rw-r--r-- | editeng/source/items/frmitems.cxx | 4 | ||||
-rw-r--r-- | editeng/source/items/justifyitem.cxx | 24 | ||||
-rw-r--r-- | editeng/source/items/textitem.cxx | 39 |
3 files changed, 34 insertions, 33 deletions
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 3fd113b75e91..2c45bbda9f18 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -2933,7 +2933,7 @@ bool SvxFormatBreakItem::GetPresentation OUString& rText, const IntlWrapper * ) const { - rText = GetValueTextByPos( GetValue() ); + rText = GetValueTextByPos( GetEnumValue() ); return true; } @@ -3000,7 +3000,7 @@ SfxPoolItem* SvxFormatBreakItem::Clone( SfxItemPool* ) const SvStream& SvxFormatBreakItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const { - rStrm.WriteSChar( GetValue() ); + rStrm.WriteSChar( GetEnumValue() ); if( FMTBREAK_NOAUTO > nItemVersion ) rStrm.WriteSChar( 0x01 ); return rStrm; diff --git a/editeng/source/items/justifyitem.cxx b/editeng/source/items/justifyitem.cxx index 7979a7b82e93..5d63a37abd78 100644 --- a/editeng/source/items/justifyitem.cxx +++ b/editeng/source/items/justifyitem.cxx @@ -38,13 +38,13 @@ using namespace ::com::sun::star; SvxHorJustifyItem::SvxHorJustifyItem( const sal_uInt16 nId ) : - SfxEnumItem( nId, (sal_uInt16)SVX_HOR_JUSTIFY_STANDARD ) + SfxEnumItem( nId, SVX_HOR_JUSTIFY_STANDARD ) { } SvxHorJustifyItem::SvxHorJustifyItem( const SvxCellHorJustify eJustify, const sal_uInt16 nId ) : - SfxEnumItem( nId, (sal_uInt16)eJustify ) + SfxEnumItem( nId, eJustify ) { } @@ -130,7 +130,7 @@ bool SvxHorJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) case table::CellHoriJustify_REPEAT: eSvx = SVX_HOR_JUSTIFY_REPEAT; break; default: ; //prevent warning } - SetValue( (sal_uInt16)eSvx ); + SetValue( eSvx ); } break; case MID_HORJUST_ADJUST: @@ -150,7 +150,7 @@ bool SvxHorJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) case style::ParagraphAdjust_BLOCK: eSvx = SVX_HOR_JUSTIFY_BLOCK; break; case style::ParagraphAdjust_CENTER: eSvx = SVX_HOR_JUSTIFY_CENTER; break; } - SetValue( (sal_uInt16)eSvx ); + SetValue( eSvx ); } } return true; @@ -185,13 +185,13 @@ sal_uInt16 SvxHorJustifyItem::GetValueCount() const SvxVerJustifyItem::SvxVerJustifyItem( const sal_uInt16 nId ) : - SfxEnumItem( nId, (sal_uInt16)SVX_VER_JUSTIFY_STANDARD ) + SfxEnumItem( nId, SVX_VER_JUSTIFY_STANDARD ) { } SvxVerJustifyItem::SvxVerJustifyItem( const SvxCellVerJustify eJustify, const sal_uInt16 nId ) : - SfxEnumItem( nId, (sal_uInt16)eJustify ) + SfxEnumItem( nId, eJustify ) { } @@ -266,7 +266,7 @@ bool SvxVerJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) case style::VerticalAlignment_BOTTOM: eSvx = SVX_VER_JUSTIFY_BOTTOM; break; default:; } - SetValue( (sal_uInt16)eSvx ); + SetValue( eSvx ); break; } default: @@ -284,7 +284,7 @@ bool SvxVerJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) case table::CellVertJustify2::BLOCK: eSvx = SVX_VER_JUSTIFY_BLOCK; break; default: ; //prevent warning } - SetValue( (sal_uInt16)eSvx ); + SetValue( eSvx ); break; } } @@ -322,7 +322,7 @@ sal_uInt16 SvxVerJustifyItem::GetValueCount() const SvxJustifyMethodItem::SvxJustifyMethodItem( const SvxCellJustifyMethod eJustify, const sal_uInt16 nId ) : - SfxEnumItem( nId, (sal_uInt16)eJustify ) + SfxEnumItem( nId, eJustify ) { } @@ -335,7 +335,7 @@ bool SvxJustifyMethodItem::GetPresentation OUString& rText, const IntlWrapper * ) const { - rText = GetValueText( GetValue() ); + rText = GetValueText( GetEnumValue() ); return true; } @@ -343,7 +343,7 @@ bool SvxJustifyMethodItem::GetPresentation bool SvxJustifyMethodItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { sal_Int32 nUno = table::CellJustifyMethod::AUTO; - switch (static_cast<SvxCellJustifyMethod>(GetValue())) + switch (GetValue()) { case SvxCellJustifyMethod::Auto: nUno = table::CellJustifyMethod::AUTO; break; case SvxCellJustifyMethod::Distribute: nUno = table::CellJustifyMethod::DISTRIBUTE; break; @@ -370,7 +370,7 @@ bool SvxJustifyMethodItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId break; default:; } - SetValue(static_cast<sal_uInt16>(eSvx)); + SetValue(eSvx); return true; } diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index c7c875e1a8ff..4b4b62164ad0 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -452,7 +452,7 @@ void SvxFontItem::dumpAsXml(xmlTextWriterPtr pWriter) const // class SvxPostureItem -------------------------------------------------- SvxPostureItem::SvxPostureItem( const FontItalic ePosture, const sal_uInt16 nId ) : - SfxEnumItem( nId, (sal_uInt16)ePosture ) + SfxEnumItem( nId, ePosture ) { } @@ -549,7 +549,7 @@ bool SvxPostureItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) eSlant = (awt::FontSlant)nValue; } - SetValue((sal_uInt16)eSlant); + SetValue((FontItalic)eSlant); } } return true; @@ -564,13 +564,13 @@ bool SvxPostureItem::HasBoolValue() const bool SvxPostureItem::GetBoolValue() const { - return ( (FontItalic)GetValue() >= ITALIC_OBLIQUE ); + return ( GetValue() >= ITALIC_OBLIQUE ); } void SvxPostureItem::SetBoolValue( bool bVal ) { - SetValue( (sal_uInt16)(bVal ? ITALIC_NORMAL : ITALIC_NONE) ); + SetValue( bVal ? ITALIC_NORMAL : ITALIC_NONE ); } void SvxPostureItem::dumpAsXml(xmlTextWriterPtr pWriter) const @@ -585,7 +585,7 @@ void SvxPostureItem::dumpAsXml(xmlTextWriterPtr pWriter) const // class SvxWeightItem --------------------------------------------------- SvxWeightItem::SvxWeightItem( const FontWeight eWght, const sal_uInt16 nId ) : - SfxEnumItem( nId, (sal_uInt16)eWght ) + SfxEnumItem( nId, eWght ) { } @@ -598,13 +598,13 @@ bool SvxWeightItem::HasBoolValue() const bool SvxWeightItem::GetBoolValue() const { - return (FontWeight)GetValue() >= WEIGHT_BOLD; + return GetValue() >= WEIGHT_BOLD; } void SvxWeightItem::SetBoolValue( bool bVal ) { - SetValue( (sal_uInt16)(bVal ? WEIGHT_BOLD : WEIGHT_NORMAL) ); + SetValue( bVal ? WEIGHT_BOLD : WEIGHT_NORMAL ); } @@ -689,7 +689,7 @@ bool SvxWeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) return false; fValue = (float)nValue; } - SetValue( (sal_uInt16)VCLUnoHelper::ConvertFontWeight((float)fValue) ); + SetValue( VCLUnoHelper::ConvertFontWeight((float)fValue) ); } break; } @@ -1210,7 +1210,7 @@ bool SvxFontWidthItem::GetPresentation // class SvxTextLineItem ------------------------------------------------ SvxTextLineItem::SvxTextLineItem( const FontLineStyle eSt, const sal_uInt16 nId ) - : SfxEnumItem( nId, (sal_uInt16)eSt ), mColor( COL_TRANSPARENT ) + : SfxEnumItem( nId, eSt ), mColor( COL_TRANSPARENT ) { } @@ -1229,7 +1229,7 @@ bool SvxTextLineItem::GetBoolValue() const void SvxTextLineItem::SetBoolValue( bool bVal ) { - SetValue( (sal_uInt16)(bVal ? LINESTYLE_SINGLE : LINESTYLE_NONE) ); + SetValue( bVal ? LINESTYLE_SINGLE : LINESTYLE_NONE ); } @@ -1320,7 +1320,7 @@ bool SvxTextLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) if(!(rVal >>= nValue)) bRet = false; else - SetValue((sal_Int16)nValue); + SetValue((FontLineStyle)nValue); } break; case MID_TL_COLOR: @@ -1348,7 +1348,7 @@ bool SvxTextLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) bool SvxTextLineItem::operator==( const SfxPoolItem& rItem ) const { assert(SfxPoolItem::operator==(rItem)); - return SfxEnumItem::operator==( rItem ) && + return SfxEnumItem::operator==( static_cast<const SfxEnumItem<FontLineStyle>&>(rItem) ) && GetColor() == static_cast<const SvxTextLineItem&>(rItem).GetColor(); } @@ -1415,7 +1415,7 @@ OUString SvxOverlineItem::GetValueTextByPos( sal_uInt16 nPos ) const // class SvxCrossedOutItem ----------------------------------------------- SvxCrossedOutItem::SvxCrossedOutItem( const FontStrikeout eSt, const sal_uInt16 nId ) - : SfxEnumItem( nId, (sal_uInt16)eSt ) + : SfxEnumItem( nId, eSt ) { } @@ -1428,13 +1428,13 @@ bool SvxCrossedOutItem::HasBoolValue() const bool SvxCrossedOutItem::GetBoolValue() const { - return (FontStrikeout)GetValue() != STRIKEOUT_NONE; + return GetValue() != STRIKEOUT_NONE; } void SvxCrossedOutItem::SetBoolValue( bool bVal ) { - SetValue( (sal_uInt16)(bVal ? STRIKEOUT_SINGLE : STRIKEOUT_NONE) ); + SetValue( bVal ? STRIKEOUT_SINGLE : STRIKEOUT_NONE ); } @@ -1512,7 +1512,7 @@ bool SvxCrossedOutItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) sal_Int32 nValue = 0; if(!(rVal >>= nValue)) return false; - SetValue((sal_Int16)nValue); + SetValue((FontStrikeout)nValue); } break; } @@ -2086,7 +2086,7 @@ bool SvxKerningItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId) // class SvxCaseMapItem -------------------------------------------------- SvxCaseMapItem::SvxCaseMapItem( const SvxCaseMap eMap, const sal_uInt16 nId ) : - SfxEnumItem( nId, (sal_uInt16)eMap ) + SfxEnumItem( nId, eMap ) { } @@ -2146,6 +2146,7 @@ bool SvxCaseMapItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const case SVX_CASEMAP_GEMEINE : nRet = style::CaseMap::LOWERCASE; break; case SVX_CASEMAP_TITEL : nRet = style::CaseMap::TITLE ; break; case SVX_CASEMAP_KAPITAELCHEN: nRet = style::CaseMap::SMALLCAPS; break; + default: break; } rVal <<= (sal_Int16)(nRet); return true; @@ -2165,7 +2166,7 @@ bool SvxCaseMapItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) case style::CaseMap::TITLE : nVal = SVX_CASEMAP_TITEL ; break; case style::CaseMap::SMALLCAPS: nVal = SVX_CASEMAP_KAPITAELCHEN; break; } - SetValue(nVal); + SetValue((SvxCaseMap)nVal); return true; } @@ -3097,7 +3098,7 @@ bool SvxCharScaleWidthItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ SvxCharReliefItem::SvxCharReliefItem( FontRelief eValue, const sal_uInt16 nId ) - : SfxEnumItem( nId, (sal_uInt16)eValue ) + : SfxEnumItem( nId, eValue ) { } |