diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-07 11:19:35 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-03-08 06:30:49 +0000 |
commit | 9cb57a50d7eeaa1dda19d18bcb3cde7e4a7984e5 (patch) | |
tree | 790282bdd3d41f9ceda28267cb72dd119ac15230 /editeng/source/items | |
parent | tdf#91222 VclBuilder constructor cleanup (diff) | |
download | core-9cb57a50d7eeaa1dda19d18bcb3cde7e4a7984e5.tar.gz core-9cb57a50d7eeaa1dda19d18bcb3cde7e4a7984e5.zip |
convert SvxAdjust to scoped enum
Change-Id: I0df7a5313d6d62d0c657e62ef6014a3ddbab4639
Reviewed-on: https://gerrit.libreoffice.org/34941
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng/source/items')
-rw-r--r-- | editeng/source/items/numitem.cxx | 4 | ||||
-rw-r--r-- | editeng/source/items/paraitem.cxx | 25 |
2 files changed, 12 insertions, 17 deletions
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index 54eef3e96bef..695e00f136bc 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -150,7 +150,7 @@ OUString SvxNumberType::GetNumStr( sal_uLong nNo, const css::lang::Locale& rLoca SvxNumberFormat::SvxNumberFormat( SvxNumType eType, SvxNumPositionAndSpaceMode ePositionAndSpaceMode ) : SvxNumberType(eType), - eNumAdjust(SVX_ADJUST_LEFT), + eNumAdjust(SvxAdjust::Left), nInclUpperLevels(0), nStart(1), cBullet(SVX_DEF_BULLET), @@ -255,7 +255,7 @@ void SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pConverte rStream.WriteUInt16( NUMITEM_VERSION_04 ); rStream.WriteUInt16( GetNumberingType() ); - rStream.WriteUInt16( eNumAdjust ); + rStream.WriteUInt16( (sal_uInt16)eNumAdjust ); rStream.WriteUInt16( nInclUpperLevels ); rStream.WriteUInt16( nStart ); rStream.WriteUInt16( cBullet ); diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index 760e77fa5ebf..2a99d6efb99f 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/style/LineSpacingMode.hpp> #include <com/sun/star/uno/Sequence.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/extract.hxx> #include <unotools/syslocale.hxx> #include <comphelper/types.hxx> #include <tools/mapunit.hxx> @@ -54,7 +55,7 @@ using namespace ::com::sun::star; SfxPoolItem* SvxLineSpacingItem::CreateDefault() { return new SvxLineSpacingItem(LINE_SPACE_DEFAULT_HEIGHT, 0);} -SfxPoolItem* SvxAdjustItem::CreateDefault() { return new SvxAdjustItem(SVX_ADJUST_LEFT, 0);} +SfxPoolItem* SvxAdjustItem::CreateDefault() { return new SvxAdjustItem(SvxAdjust::Left, 0);} SfxPoolItem* SvxWidowsItem::CreateDefault() { return new SvxWidowsItem(0, 0);} SfxPoolItem* SvxOrphansItem::CreateDefault() { return new SvxOrphansItem(0, 0);} SfxPoolItem* SvxHyphenZoneItem::CreateDefault() { return new SvxHyphenZoneItem(false, 0);} @@ -375,22 +376,16 @@ bool SvxAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) case MID_LAST_LINE_ADJUST : { sal_Int32 eVal = - 1; - try - { - eVal = ::comphelper::getEnumAsINT32(rVal); - } - catch(...) {} + ::cppu::enum2int(eVal,rVal); if(eVal >= 0 && eVal <= 4) { + SvxAdjust eAdjust = (SvxAdjust)eVal; if(MID_LAST_LINE_ADJUST == nMemberId && - eVal != SVX_ADJUST_LEFT && - eVal != SVX_ADJUST_BLOCK && - eVal != SVX_ADJUST_CENTER) + eAdjust != SvxAdjust::Left && + eAdjust != SvxAdjust::Block && + eAdjust != SvxAdjust::Center) return false; - if(eVal < (sal_uInt16)SVX_ADJUST_END) - nMemberId == MID_PARA_ADJUST ? - SetAdjust((SvxAdjust)eVal) : - SetLastBlock((SvxAdjust)eVal); + nMemberId == MID_PARA_ADJUST ? SetAdjust(eAdjust) : SetLastBlock(eAdjust); } } break; @@ -430,13 +425,13 @@ bool SvxAdjustItem::GetPresentation sal_uInt16 SvxAdjustItem::GetValueCount() const { - return SVX_ADJUST_END; // SVX_ADJUST_BLOCKLINE + 1 + return (sal_uInt16)SvxAdjust::End; // SvxAdjust::BlockLine + 1 } OUString SvxAdjustItem::GetValueTextByPos( sal_uInt16 nPos ) const { - DBG_ASSERT( nPos <= (sal_uInt16)SVX_ADJUST_BLOCKLINE, "enum overflow!" ); + DBG_ASSERT( nPos <= (sal_uInt16)SvxAdjust::BlockLine, "enum overflow!" ); return EE_RESSTR(RID_SVXITEMS_ADJUST_BEGIN + nPos); } |