diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2016-05-08 09:21:17 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-09 09:41:34 +0000 |
commit | 50ac0f503b763d08aef4a193c38e64b70220bfba (patch) | |
tree | 9e02808b2736ac75852060bb3367c8236b9ac334 /editeng/source/items | |
parent | 26d314d2e25945941d49a4872d7ffa27cfc2fdc8 (diff) |
convert FONT_EMPHASIS_MARK to scoped enum
Change-Id: I137c78b337e57d3442db08334128e79d186b278f
Reviewed-on: https://gerrit.libreoffice.org/24753
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'editeng/source/items')
-rw-r--r-- | editeng/source/items/textitem.cxx | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index ec4c7beabc3b..68e6abebc5d3 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -127,7 +127,7 @@ SfxPoolItem* SvxNoLinebreakItem::CreateDefault() {return new SvxNoLinebreakItem( SfxPoolItem* SvxNoHyphenItem::CreateDefault() {return new SvxNoHyphenItem(true, 0);} SfxPoolItem* SvxLineColorItem::CreateDefault() {return new SvxLineColorItem(0);} SfxPoolItem* SvxBlinkItem::CreateDefault() {return new SvxBlinkItem(false, 0);} -SfxPoolItem* SvxEmphasisMarkItem::CreateDefault() {return new SvxEmphasisMarkItem(EMPHASISMARK_NONE, 0);} +SfxPoolItem* SvxEmphasisMarkItem::CreateDefault() {return new SvxEmphasisMarkItem(FontEmphasisMark::NONE, 0);} SfxPoolItem* SvxTwoLinesItem::CreateDefault() {return new SvxTwoLinesItem(true, 0, 0, 0);} SfxPoolItem* SvxScriptTypeItem::CreateDefault() {return new SvxScriptTypeItem();} SfxPoolItem* SvxCharRotateItem::CreateDefault() {return new SvxCharRotateItem(0, false, 0);} @@ -2611,7 +2611,7 @@ bool SvxBlinkItem::GetPresentation SvxEmphasisMarkItem::SvxEmphasisMarkItem( const FontEmphasisMark nValue, const sal_uInt16 nId ) - : SfxUInt16Item( nId, nValue ) + : SfxUInt16Item( nId, (sal_uInt16)nValue ) { } @@ -2647,12 +2647,12 @@ bool SvxEmphasisMarkItem::GetPresentation const IntlWrapper * /*pIntl*/ ) const { - sal_uInt16 nVal = GetValue(); + FontEmphasisMark nVal = GetEmphasisMark(); rText = EE_RESSTR( RID_SVXITEMS_EMPHASIS_BEGIN_STYLE + - ( EMPHASISMARK_STYLE & nVal )); - sal_uInt16 nId = ( EMPHASISMARK_POS_ABOVE & nVal ) + (sal_uInt16)(FontEmphasisMark)( nVal & FontEmphasisMark::Style )); + sal_uInt16 nId = ( FontEmphasisMark::PosAbove & nVal ) ? RID_SVXITEMS_EMPHASIS_ABOVE_POS - : ( EMPHASISMARK_POS_BELOW & nVal ) + : ( FontEmphasisMark::PosBelow & nVal ) ? RID_SVXITEMS_EMPHASIS_BELOW_POS : 0; if( nId ) @@ -2668,17 +2668,18 @@ bool SvxEmphasisMarkItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) cons { case MID_EMPHASIS: { - sal_Int16 nValue = GetValue(); + FontEmphasisMark nValue = GetEmphasisMark(); sal_Int16 nRet = 0; - switch(nValue & EMPHASISMARK_STYLE) + switch(nValue & FontEmphasisMark::Style) { - case EMPHASISMARK_NONE : nRet = FontEmphasis::NONE; break; - case EMPHASISMARK_DOT : nRet = FontEmphasis::DOT_ABOVE; break; - case EMPHASISMARK_CIRCLE : nRet = FontEmphasis::CIRCLE_ABOVE; break; - case EMPHASISMARK_DISC : nRet = FontEmphasis::DISK_ABOVE; break; - case EMPHASISMARK_ACCENT : nRet = FontEmphasis::ACCENT_ABOVE; break; + case FontEmphasisMark::NONE : nRet = FontEmphasis::NONE; break; + case FontEmphasisMark::Dot : nRet = FontEmphasis::DOT_ABOVE; break; + case FontEmphasisMark::Circle : nRet = FontEmphasis::CIRCLE_ABOVE; break; + case FontEmphasisMark::Disc : nRet = FontEmphasis::DISK_ABOVE; break; + case FontEmphasisMark::Accent : nRet = FontEmphasis::ACCENT_ABOVE; break; + default: break; } - if(nRet && nValue & EMPHASISMARK_POS_BELOW) + if(nRet && nValue & FontEmphasisMark::PosBelow) nRet += 10; rVal <<= nRet; } @@ -2697,20 +2698,21 @@ bool SvxEmphasisMarkItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { sal_Int32 nValue = -1; rVal >>= nValue; + FontEmphasisMark nMark; switch(nValue) { - case FontEmphasis::NONE : nValue = EMPHASISMARK_NONE; break; - case FontEmphasis::DOT_ABOVE : nValue = EMPHASISMARK_DOT|EMPHASISMARK_POS_ABOVE; break; - case FontEmphasis::CIRCLE_ABOVE: nValue = EMPHASISMARK_CIRCLE|EMPHASISMARK_POS_ABOVE; break; - case FontEmphasis::DISK_ABOVE : nValue = EMPHASISMARK_DISC|EMPHASISMARK_POS_ABOVE; break; - case FontEmphasis::ACCENT_ABOVE: nValue = EMPHASISMARK_ACCENT|EMPHASISMARK_POS_ABOVE; break; - case FontEmphasis::DOT_BELOW : nValue = EMPHASISMARK_DOT|EMPHASISMARK_POS_BELOW; break; - case FontEmphasis::CIRCLE_BELOW: nValue = EMPHASISMARK_CIRCLE|EMPHASISMARK_POS_BELOW; break; - case FontEmphasis::DISK_BELOW : nValue = EMPHASISMARK_DISC|EMPHASISMARK_POS_BELOW; break; - case FontEmphasis::ACCENT_BELOW: nValue = EMPHASISMARK_ACCENT|EMPHASISMARK_POS_BELOW; break; + case FontEmphasis::NONE : nMark = FontEmphasisMark::NONE; break; + case FontEmphasis::DOT_ABOVE : nMark = FontEmphasisMark::Dot|FontEmphasisMark::PosAbove; break; + case FontEmphasis::CIRCLE_ABOVE: nMark = FontEmphasisMark::Circle|FontEmphasisMark::PosAbove; break; + case FontEmphasis::DISK_ABOVE : nMark = FontEmphasisMark::Disc|FontEmphasisMark::PosAbove; break; + case FontEmphasis::ACCENT_ABOVE: nMark = FontEmphasisMark::Accent|FontEmphasisMark::PosAbove; break; + case FontEmphasis::DOT_BELOW : nMark = FontEmphasisMark::Dot|FontEmphasisMark::PosBelow; break; + case FontEmphasis::CIRCLE_BELOW: nMark = FontEmphasisMark::Circle|FontEmphasisMark::PosBelow; break; + case FontEmphasis::DISK_BELOW : nMark = FontEmphasisMark::Disc|FontEmphasisMark::PosBelow; break; + case FontEmphasis::ACCENT_BELOW: nMark = FontEmphasisMark::Accent|FontEmphasisMark::PosBelow; break; default: return false; } - SetValue( (sal_Int16)nValue ); + SetValue( (sal_Int16)nMark ); } break; } |