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 | |
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>
38 files changed, 170 insertions, 176 deletions
diff --git a/cppcanvas/source/inc/outdevstate.hxx b/cppcanvas/source/inc/outdevstate.hxx index 2613440b0951..9478e4360138 100644 --- a/cppcanvas/source/inc/outdevstate.hxx +++ b/cppcanvas/source/inc/outdevstate.hxx @@ -57,7 +57,7 @@ namespace cppcanvas mapModeTransform(), fontRotation(0.0), - textEmphasisMarkStyle(EMPHASISMARK_NONE), + textEmphasisMarkStyle(FontEmphasisMark::NONE), pushFlags(PushFlags::ALL), textDirection(css::rendering::TextDirection::WEAK_LEFT_TO_RIGHT), textAlignment(0), // TODO(Q2): Synchronize with implrenderer @@ -99,7 +99,7 @@ namespace cppcanvas ::basegfx::B2DHomMatrix mapModeTransform; double fontRotation; - sal_uInt16 textEmphasisMarkStyle; + FontEmphasisMark textEmphasisMarkStyle; PushFlags pushFlags; sal_Int8 textDirection; sal_Int8 textAlignment; diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index 3368e74c2aab..bb64de5c1e27 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -1497,7 +1497,7 @@ namespace cppcanvas (*rParms.maFontUnderline ? (sal_Int8)LINESTYLE_SINGLE : (sal_Int8)LINESTYLE_NONE) : (sal_Int8)rFont.GetUnderline(); rState.textStrikeoutStyle = (sal_Int8)rFont.GetStrikeout(); - rState.textEmphasisMarkStyle = (sal_Int8)rFont.GetEmphasisMark(); + rState.textEmphasisMarkStyle = rFont.GetEmphasisMark() & FontEmphasisMark::Style; rState.isTextEffectShadowSet = rFont.IsShadow(); rState.isTextWordUnderlineSet = rFont.IsWordLineMode(); rState.isTextOutlineModeSet = rFont.IsOutline(); diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index d278b35fa1f2..9f53b7a97680 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -1537,7 +1537,7 @@ void SvxCharEffectsPage::UpdatePreview_Impl() nPos = m_pPositionLB->GetSelectEntryPos(); bool bUnder = ( CHRDLG_POSITION_UNDER == reinterpret_cast<sal_uLong>(m_pPositionLB->GetEntryData( nPos )) ); FontEmphasisMark eMark = (FontEmphasisMark)m_pEmphasisLB->GetSelectEntryPos(); - eMark |= bUnder ? EMPHASISMARK_POS_BELOW : EMPHASISMARK_POS_ABOVE; + eMark |= bUnder ? FontEmphasisMark::PosBelow : FontEmphasisMark::PosAbove; rFont.SetEmphasisMark( eMark ); rCJKFont.SetEmphasisMark( eMark ); rCTLFont.SetEmphasisMark( eMark ); @@ -1982,11 +1982,11 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet ) rCJKFont.SetEmphasisMark( eMark ); rCTLFont.SetEmphasisMark( eMark ); - m_pEmphasisLB->SelectEntryPos( (sal_Int32)( eMark & EMPHASISMARK_STYLE ) ); - eMark &= ~EMPHASISMARK_STYLE; - sal_uLong nEntryData = ( eMark == EMPHASISMARK_POS_ABOVE ) + m_pEmphasisLB->SelectEntryPos( (sal_Int32)( eMark & FontEmphasisMark::Style ) ); + eMark &= ~FontEmphasisMark::Style; + sal_uLong nEntryData = ( eMark == FontEmphasisMark::PosAbove ) ? CHRDLG_POSITION_OVER - : ( eMark == EMPHASISMARK_POS_BELOW ) ? CHRDLG_POSITION_UNDER : 0; + : ( eMark == FontEmphasisMark::PosBelow ) ? CHRDLG_POSITION_UNDER : 0; for ( sal_Int32 i = 0; i < m_pPositionLB->GetEntryCount(); i++ ) { @@ -2371,7 +2371,7 @@ bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet ) if ( m_pPositionLB->IsEnabled() ) { eMark |= ( CHRDLG_POSITION_UNDER == reinterpret_cast<sal_uLong>(m_pPositionLB->GetEntryData( nPosPos )) ) - ? EMPHASISMARK_POS_BELOW : EMPHASISMARK_POS_ABOVE; + ? FontEmphasisMark::PosBelow : FontEmphasisMark::PosAbove; } if ( pOld ) diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index 094e186f283c..ea58a15fb73f 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -1292,7 +1292,7 @@ namespace LINESTYLE_NONE != rFont.GetOverline() || LINESTYLE_NONE != rFont.GetUnderline() || STRIKEOUT_NONE != rFont.GetStrikeout() - || EMPHASISMARK_NONE != (rFont.GetEmphasisMark() & EMPHASISMARK_STYLE) + || FontEmphasisMark::NONE != (rFont.GetEmphasisMark() & FontEmphasisMark::Style) || RELIEF_NONE != rFont.GetRelief() || rFont.IsShadow() || bWordLineMode); @@ -1308,18 +1308,19 @@ namespace const bool bUnderlineAbove(drawinglayer::primitive2d::TEXT_LINE_NONE != eFontLineStyle && isUnderlineAbove(rFont)); // prepare emphasis mark data - drawinglayer::primitive2d::TextEmphasisMark eTextEmphasisMark(drawinglayer::primitive2d::TEXT_EMPHASISMARK_NONE); + drawinglayer::primitive2d::TextEmphasisMark eTextEmphasisMark(drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_NONE); - switch(rFont.GetEmphasisMark() & EMPHASISMARK_STYLE) + switch(rFont.GetEmphasisMark() & FontEmphasisMark::Style) { - case EMPHASISMARK_DOT : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_DOT; break; - case EMPHASISMARK_CIRCLE : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_CIRCLE; break; - case EMPHASISMARK_DISC : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_DISC; break; - case EMPHASISMARK_ACCENT : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_ACCENT; break; + case FontEmphasisMark::Dot : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_DOT; break; + case FontEmphasisMark::Circle : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_CIRCLE; break; + case FontEmphasisMark::Disc : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_DISC; break; + case FontEmphasisMark::Accent : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_ACCENT; break; + default: break; } - const bool bEmphasisMarkAbove(rFont.GetEmphasisMark() & EMPHASISMARK_POS_ABOVE); - const bool bEmphasisMarkBelow(rFont.GetEmphasisMark() & EMPHASISMARK_POS_BELOW); + const bool bEmphasisMarkAbove(rFont.GetEmphasisMark() & FontEmphasisMark::PosAbove); + const bool bEmphasisMarkBelow(rFont.GetEmphasisMark() & FontEmphasisMark::PosBelow); // prepare font relief data drawinglayer::primitive2d::TextRelief eTextRelief(drawinglayer::primitive2d::TEXT_RELIEF_NONE); diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx index eaae44d8e5a5..d8d2f9a26f08 100644 --- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx @@ -352,7 +352,7 @@ namespace drawinglayer return (TEXT_LINE_NONE != getFontOverline() || TEXT_LINE_NONE != getFontUnderline() || TEXT_STRIKEOUT_NONE != getTextStrikeout() - || TEXT_EMPHASISMARK_NONE != getTextEmphasisMark() + || TEXT_FONT_EMPHASIS_MARK_NONE != getTextEmphasisMark() || TEXT_RELIEF_NONE != getTextRelief() || getShadow()); } diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index f5d24cf001cb..ec31b509c456 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -179,27 +179,27 @@ namespace drawinglayer // set EmphasisMark attribute - FontEmphasisMark eFontEmphasisMark = EMPHASISMARK_NONE; + FontEmphasisMark eFontEmphasisMark = FontEmphasisMark::NONE; switch( pTCPP->getTextEmphasisMark() ) { default: SAL_WARN("drawinglayer", "Unknown EmphasisMark style " << pTCPP->getTextEmphasisMark() ); // fall through - case primitive2d::TEXT_EMPHASISMARK_NONE: eFontEmphasisMark = EMPHASISMARK_NONE; break; - case primitive2d::TEXT_EMPHASISMARK_DOT: eFontEmphasisMark = EMPHASISMARK_DOT; break; - case primitive2d::TEXT_EMPHASISMARK_CIRCLE: eFontEmphasisMark = EMPHASISMARK_CIRCLE; break; - case primitive2d::TEXT_EMPHASISMARK_DISC: eFontEmphasisMark = EMPHASISMARK_DISC; break; - case primitive2d::TEXT_EMPHASISMARK_ACCENT: eFontEmphasisMark = EMPHASISMARK_ACCENT; break; + case primitive2d::TEXT_FONT_EMPHASIS_MARK_NONE: eFontEmphasisMark = FontEmphasisMark::NONE; break; + case primitive2d::TEXT_FONT_EMPHASIS_MARK_DOT: eFontEmphasisMark = FontEmphasisMark::Dot; break; + case primitive2d::TEXT_FONT_EMPHASIS_MARK_CIRCLE: eFontEmphasisMark = FontEmphasisMark::Circle; break; + case primitive2d::TEXT_FONT_EMPHASIS_MARK_DISC: eFontEmphasisMark = FontEmphasisMark::Disc; break; + case primitive2d::TEXT_FONT_EMPHASIS_MARK_ACCENT: eFontEmphasisMark = FontEmphasisMark::Accent; break; } - if( eFontEmphasisMark != EMPHASISMARK_NONE ) + if( eFontEmphasisMark != FontEmphasisMark::NONE ) { DBG_ASSERT( (pTCPP->getEmphasisMarkAbove() != pTCPP->getEmphasisMarkBelow()), "DrawingLayer: Bad EmphasisMark position!" ); if( pTCPP->getEmphasisMarkAbove() ) - eFontEmphasisMark |= EMPHASISMARK_POS_ABOVE; + eFontEmphasisMark |= FontEmphasisMark::PosAbove; else - eFontEmphasisMark |= EMPHASISMARK_POS_BELOW; + eFontEmphasisMark |= FontEmphasisMark::PosBelow; aFont.SetEmphasisMark( eFontEmphasisMark ); } diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 38d749b581fe..c7b202733b74 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -2081,7 +2081,7 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, S if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_WLM ) == SfxItemState::SET ) ) rFont.SetWordLineMode( static_cast<const SvxWordLineModeItem&>(rSet.Get( EE_CHAR_WLM )).GetValue() ); if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_EMPHASISMARK ) == SfxItemState::SET ) ) - rFont.SetEmphasisMark( static_cast<const SvxEmphasisMarkItem&>(rSet.Get( EE_CHAR_EMPHASISMARK )).GetValue() ); + rFont.SetEmphasisMark( static_cast<const SvxEmphasisMarkItem&>(rSet.Get( EE_CHAR_EMPHASISMARK )).GetEmphasisMark() ); if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_RELIEF ) == SfxItemState::SET ) ) rFont.SetRelief( (FontRelief)static_cast<const SvxCharReliefItem&>(rSet.Get( EE_CHAR_RELIEF )).GetValue() ); diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx index 1be1ce37516c..b444d6c0ac0a 100644 --- a/editeng/source/editeng/eerdll.cxx +++ b/editeng/source/editeng/eerdll.cxx @@ -150,7 +150,7 @@ SfxPoolItem** GlobalEditData::GetDefItems() ppDefItems[40] = new SvxWeightItem( WEIGHT_NORMAL, EE_CHAR_WEIGHT_CTL ); ppDefItems[41] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CJK ); ppDefItems[42] = new SvxPostureItem( ITALIC_NONE, EE_CHAR_ITALIC_CTL ); - ppDefItems[43] = new SvxEmphasisMarkItem( EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ); + ppDefItems[43] = new SvxEmphasisMarkItem( FontEmphasisMark::NONE, EE_CHAR_EMPHASISMARK ); ppDefItems[44] = new SvxCharReliefItem( RELIEF_NONE, EE_CHAR_RELIEF ); ppDefItems[45] = new SfxVoidItem( EE_CHAR_RUBI_DUMMY ); ppDefItems[46] = new SvXMLAttrContainerItem( EE_CHAR_XMLATTRIBS ); diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index fc7744a956f0..07ad13a8bde3 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -921,10 +921,10 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, break; case EE_CHAR_EMPHASISMARK: { - sal_uInt16 nMark = static_cast<const SvxEmphasisMarkItem&>(rItem).GetValue(); - if ( nMark == EMPHASISMARK_NONE ) + FontEmphasisMark nMark = static_cast<const SvxEmphasisMarkItem&>(rItem).GetEmphasisMark(); + if ( nMark == FontEmphasisMark::NONE ) rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_ACCNONE ); - else if ( nMark == EMPHASISMARK_SIDE_DOTS ) + else if ( nMark == (FontEmphasisMark::Accent | FontEmphasisMark::PosAbove) ) rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_ACCCOMMA ); else rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_ACCDOT ); 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; } diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index c39f8d610321..12ae4165f32f 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -853,7 +853,7 @@ vcl::Font Outliner::ImpCalcBulletFont( sal_Int32 nPara ) const aBulletFont.SetUnderline( LINESTYLE_NONE ); aBulletFont.SetOverline( LINESTYLE_NONE ); aBulletFont.SetStrikeout( STRIKEOUT_NONE ); - aBulletFont.SetEmphasisMark( EMPHASISMARK_NONE ); + aBulletFont.SetEmphasisMark( FontEmphasisMark::NONE ); aBulletFont.SetRelief( RELIEF_NONE ); } diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx index 510eba5b6d74..3298878baf20 100644 --- a/editeng/source/rtf/rtfitem.cxx +++ b/editeng/source/rtf/rtfitem.cxx @@ -1005,14 +1005,14 @@ ATTR_SETOVERLINE: case RTF_ACCNONE: - eEmphasis = EMPHASISMARK_NONE; + eEmphasis = FontEmphasisMark::NONE; goto ATTR_SETEMPHASIS; case RTF_ACCDOT: - eEmphasis = EMPHASISMARK_DOTS_ABOVE; + eEmphasis = (FontEmphasisMark::Dot | FontEmphasisMark::PosAbove); goto ATTR_SETEMPHASIS; case RTF_ACCCOMMA: - eEmphasis = EMPHASISMARK_SIDE_DOTS; + eEmphasis = (FontEmphasisMark::Accent | FontEmphasisMark::PosAbove); ATTR_SETEMPHASIS: if( aPlainMap.nEmphasis ) { diff --git a/extensions/source/propctrlr/fontdialog.cxx b/extensions/source/propctrlr/fontdialog.cxx index 2839b04bb7e5..868260454b60 100644 --- a/extensions/source/propctrlr/fontdialog.cxx +++ b/extensions/source/propctrlr/fontdialog.cxx @@ -215,7 +215,7 @@ namespace pcr sal_Int32 nTextLineColor = aPropExtractor.getInt32FontProperty(PROPERTY_TEXTLINECOLOR, COL_AUTO); sal_Int16 nFontRelief = aPropExtractor.getInt16FontProperty(PROPERTY_FONT_RELIEF, (sal_Int16)aDefaultVCLFont.GetRelief()); - sal_Int16 nFontEmphasisMark = aPropExtractor.getInt16FontProperty(PROPERTY_FONT_EMPHASIS_MARK, aDefaultVCLFont.GetEmphasisMark()); + sal_Int16 nFontEmphasisMark = aPropExtractor.getInt16FontProperty(PROPERTY_FONT_EMPHASIS_MARK, (sal_uInt16)aDefaultVCLFont.GetEmphasisMark()); Any aValue; bool bWordLineMode = aPropExtractor.getCheckFontProperty(PROPERTY_WORDLINEMODE, aValue) ? aDefaultFont.WordLineMode : ::cppu::any2bool(aValue); diff --git a/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx b/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx index 671b73246261..23f6b26f33b3 100644 --- a/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx @@ -99,7 +99,7 @@ namespace drawinglayer bool bUnderlineAbove = false, TextStrikeout eTextStrikeout = TEXT_STRIKEOUT_NONE, bool bWordLineMode = false, - TextEmphasisMark eTextEmphasisMark = TEXT_EMPHASISMARK_NONE, + TextEmphasisMark eTextEmphasisMark = TEXT_FONT_EMPHASIS_MARK_NONE, bool bEmphasisMarkAbove = true, bool bEmphasisMarkBelow = false, TextRelief eTextRelief = TEXT_RELIEF_NONE, diff --git a/include/drawinglayer/primitive2d/textenumsprimitive2d.hxx b/include/drawinglayer/primitive2d/textenumsprimitive2d.hxx index 9464d80e6563..b84779984e95 100644 --- a/include/drawinglayer/primitive2d/textenumsprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/textenumsprimitive2d.hxx @@ -78,11 +78,11 @@ namespace drawinglayer /** TextEmphasisMark definition */ enum TextEmphasisMark { - TEXT_EMPHASISMARK_NONE, - TEXT_EMPHASISMARK_DOT, - TEXT_EMPHASISMARK_CIRCLE, - TEXT_EMPHASISMARK_DISC, - TEXT_EMPHASISMARK_ACCENT + TEXT_FONT_EMPHASIS_MARK_NONE, + TEXT_FONT_EMPHASIS_MARK_DOT, + TEXT_FONT_EMPHASIS_MARK_CIRCLE, + TEXT_FONT_EMPHASIS_MARK_DISC, + TEXT_FONT_EMPHASIS_MARK_ACCENT }; /** TextRelief definition */ diff --git a/include/editeng/emphasismarkitem.hxx b/include/editeng/emphasismarkitem.hxx index 2384aa4e688d..62955dc4832b 100644 --- a/include/editeng/emphasismarkitem.hxx +++ b/include/editeng/emphasismarkitem.hxx @@ -37,7 +37,7 @@ class EDITENG_DLLPUBLIC SvxEmphasisMarkItem : public SfxUInt16Item public: static SfxPoolItem* CreateDefault(); - SvxEmphasisMarkItem( const FontEmphasisMark eVal /*= EMPHASISMARK_NONE*/, + SvxEmphasisMarkItem( const FontEmphasisMark eVal /*= FontEmphasisMark::NONE*/, const sal_uInt16 nId ); // "pure virtual Methods" from SfxPoolItem + SfxEnumItem diff --git a/include/tools/fontenum.hxx b/include/tools/fontenum.hxx index 3ab14d4697c0..ce5736b192d1 100644 --- a/include/tools/fontenum.hxx +++ b/include/tools/fontenum.hxx @@ -20,6 +20,7 @@ #define INCLUDED_TOOLS_FONTENUM_HXX #include <sal/types.h> +#include <o3tl/typed_flags_set.hxx> enum FontFamily { FAMILY_DONTKNOW, FAMILY_DECORATIVE, FAMILY_MODERN, FAMILY_ROMAN, FAMILY_SCRIPT, FAMILY_SWISS, FAMILY_SYSTEM, FontFamily_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; @@ -58,21 +59,21 @@ enum FontStrikeout { STRIKEOUT_NONE, STRIKEOUT_SINGLE, STRIKEOUT_DOUBLE, STRIKEOUT_SLASH, STRIKEOUT_X, FontStrikeout_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; -typedef sal_uInt16 FontEmphasisMark; -#define EMPHASISMARK_NONE ((FontEmphasisMark)0x0000) -#define EMPHASISMARK_DOT ((FontEmphasisMark)0x0001) -#define EMPHASISMARK_CIRCLE ((FontEmphasisMark)0x0002) -#define EMPHASISMARK_DISC ((FontEmphasisMark)0x0003) -#define EMPHASISMARK_ACCENT ((FontEmphasisMark)0x0004) -#define EMPHASISMARK_STYLE ((FontEmphasisMark)0x00FF) -#define EMPHASISMARK_POS_ABOVE ((FontEmphasisMark)0x1000) -#define EMPHASISMARK_POS_BELOW ((FontEmphasisMark)0x2000) - -// Only for compatibility -#define EMPHASISMARK_DOTS_ABOVE (EMPHASISMARK_DOT | EMPHASISMARK_POS_ABOVE) -#define EMPHASISMARK_DOTS_BELOW (EMPHASISMARK_DOT | EMPHASISMARK_POS_BELOW) -#define EMPHASISMARK_SIDE_DOTS (EMPHASISMARK_ACCENT | EMPHASISMARK_POS_ABOVE) -#define EMPHASISMARK_CIRCLE_ABOVE (EMPHASISMARK_CIRCLE | EMPHASISMARK_POS_ABOVE) +enum class FontEmphasisMark { + NONE = 0x0000, // capitalisation to avoid conflict with X11 macro + Dot = 0x0001, + Circle = 0x0002, + Disc = 0x0003, + Accent = 0x0004, + Style = 0x000f, + PosAbove = 0x1000, + PosBelow = 0x2000 +}; +namespace o3tl +{ + template<> struct typed_flags<FontEmphasisMark> : is_typed_flags<FontEmphasisMark, 0x300f> {}; +} + enum FontType { TYPE_DONTKNOW, TYPE_RASTER, TYPE_VECTOR, TYPE_SCALABLE, FontType_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index e7c3fc07549b..d2e7f467fefe 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -669,7 +669,7 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep new SvxAutoKernItem(false,ITEMID_AUTOKERN), new SvxColorListItem(pColorList.get(),ITEMID_COLOR_TABLE), new SvxBlinkItem(false,ITEMID_BLINK), - new SvxEmphasisMarkItem(EMPHASISMARK_NONE,ITEMID_EMPHASISMARK), + new SvxEmphasisMarkItem(FontEmphasisMark::NONE,ITEMID_EMPHASISMARK), new SvxTwoLinesItem(true,0,0,ITEMID_TWOLINES), new SvxCharRotateItem(0,false,ITEMID_CHARROTATE), new SvxCharScaleWidthItem(100,ITEMID_CHARSCALE_W), diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 9966404d6a4a..00b7e4842925 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -757,7 +757,7 @@ static sal_uInt16 lcl_GetAttribHeight( const ScPatternAttr& rPattern, sal_uInt16 nHeight *= 1.18; if ( static_cast<const SvxEmphasisMarkItem&>(rPattern. - GetItem(ATTR_FONT_EMPHASISMARK)).GetEmphasisMark() != EMPHASISMARK_NONE ) + GetItem(ATTR_FONT_EMPHASISMARK)).GetEmphasisMark() != FontEmphasisMark::NONE ) { // add height for emphasis marks //TODO: font metrics should be used instead diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx index 71f7cf12f502..3b23782a0fc9 100644 --- a/sc/source/core/data/docpool.cxx +++ b/sc/source/core/data/docpool.cxx @@ -247,7 +247,7 @@ ScDocumentPool::ScDocumentPool( SfxItemPool* pSecPool) ppPoolDefaults[ ATTR_CTL_FONT_POSTURE- ATTR_STARTINDEX ] = new SvxPostureItem( ITALIC_NONE, ATTR_CTL_FONT_POSTURE ); ppPoolDefaults[ ATTR_CTL_FONT_LANGUAGE-ATTR_STARTINDEX ] = new SvxLanguageItem( LanguageType(LANGUAGE_DONTKNOW), ATTR_CTL_FONT_LANGUAGE ); - ppPoolDefaults[ ATTR_FONT_EMPHASISMARK-ATTR_STARTINDEX ] = new SvxEmphasisMarkItem( EMPHASISMARK_NONE, ATTR_FONT_EMPHASISMARK ); + ppPoolDefaults[ ATTR_FONT_EMPHASISMARK-ATTR_STARTINDEX ] = new SvxEmphasisMarkItem( FontEmphasisMark::NONE, ATTR_FONT_EMPHASISMARK ); ppPoolDefaults[ ATTR_USERDEF - ATTR_STARTINDEX ] = new SvXMLAttrContainerItem( ATTR_USERDEF ); ppPoolDefaults[ ATTR_FONT_WORDLINE - ATTR_STARTINDEX ] = new SvxWordLineModeItem(false, ATTR_FONT_WORDLINE ); ppPoolDefaults[ ATTR_FONT_RELIEF - ATTR_STARTINDEX ] = new SvxCharReliefItem( RELIEF_NONE, ATTR_FONT_RELIEF ); diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 556d4abe4619..47c1a84296d9 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -579,7 +579,7 @@ void ScXMLTableRowCellContext::PushFormat(sal_Int32 nBegin, sal_Int32 nEnd, cons case EE_CHAR_EMPHASISMARK: { if (!pPoolItem) - pPoolItem.reset(new SvxEmphasisMarkItem(EMPHASISMARK_NONE, pEntry->mnItemID)); + pPoolItem.reset(new SvxEmphasisMarkItem(FontEmphasisMark::NONE, pEntry->mnItemID)); pPoolItem->PutValue(it->maValue, pEntry->mnFlag); } diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx index e476ef3ed814..3dceb0c7308b 100644 --- a/sd/source/core/drawdoc4.cxx +++ b/sd/source/core/drawdoc4.cxx @@ -216,7 +216,7 @@ void SdDrawDocument::CreateLayoutTemplates() rISet.Put(SvxOverlineItem(LINESTYLE_NONE, EE_CHAR_OVERLINE)); rISet.Put(SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT )); rISet.Put(SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, EE_CHAR_CASEMAP )); - rISet.Put(SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK)); + rISet.Put(SvxEmphasisMarkItem(FontEmphasisMark::NONE, EE_CHAR_EMPHASISMARK)); rISet.Put(SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF)); rISet.Put(SvxColorItem(Color(COL_AUTO), EE_CHAR_COLOR )); diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index 0374daa494fb..b6fe26709882 100644 --- a/sd/source/core/stlpool.cxx +++ b/sd/source/core/stlpool.cxx @@ -244,7 +244,7 @@ void SdStyleSheetPool::CreateLayoutStyleSheets(const OUString& rLayoutName, bool rSet.Put( SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, EE_CHAR_CASEMAP ) ); rSet.Put( SvxShadowedItem(false, EE_CHAR_SHADOW ) ); rSet.Put( SvxContourItem(false, EE_CHAR_OUTLINE ) ); - rSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) ); + rSet.Put( SvxEmphasisMarkItem(FontEmphasisMark::NONE, EE_CHAR_EMPHASISMARK ) ); rSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF) ); rSet.Put( SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR) ); rSet.Put( SvxBackgroundColorItem( Color (COL_AUTO), EE_CHAR_BKGCOLOR ) ); @@ -362,7 +362,7 @@ void SdStyleSheetPool::CreateLayoutStyleSheets(const OUString& rLayoutName, bool rTitleSet.Put(SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, EE_CHAR_CASEMAP )); rTitleSet.Put(SvxShadowedItem(false, EE_CHAR_SHADOW )); rTitleSet.Put(SvxContourItem(false, EE_CHAR_OUTLINE )); - rTitleSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) ); + rTitleSet.Put( SvxEmphasisMarkItem(FontEmphasisMark::NONE, EE_CHAR_EMPHASISMARK ) ); rTitleSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF ) ); rTitleSet.Put(SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR )); rTitleSet.Put(SvxBackgroundColorItem( Color(COL_AUTO), EE_CHAR_BKGCOLOR )); @@ -408,7 +408,7 @@ void SdStyleSheetPool::CreateLayoutStyleSheets(const OUString& rLayoutName, bool rSubtitleSet.Put(SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, EE_CHAR_CASEMAP )); rSubtitleSet.Put(SvxShadowedItem(false, EE_CHAR_SHADOW )); rSubtitleSet.Put(SvxContourItem(false, EE_CHAR_OUTLINE )); - rSubtitleSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) ); + rSubtitleSet.Put( SvxEmphasisMarkItem(FontEmphasisMark::NONE, EE_CHAR_EMPHASISMARK ) ); rSubtitleSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF ) ); rSubtitleSet.Put(SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR )); rSubtitleSet.Put(SvxBackgroundColorItem( Color(COL_AUTO), EE_CHAR_BKGCOLOR )); @@ -457,7 +457,7 @@ void SdStyleSheetPool::CreateLayoutStyleSheets(const OUString& rLayoutName, bool rNotesSet.Put( SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, EE_CHAR_CASEMAP ) ); rNotesSet.Put( SvxShadowedItem(false, EE_CHAR_SHADOW ) ); rNotesSet.Put( SvxContourItem(false, EE_CHAR_OUTLINE ) ); - rNotesSet.Put( SvxEmphasisMarkItem(EMPHASISMARK_NONE, EE_CHAR_EMPHASISMARK ) ); + rNotesSet.Put( SvxEmphasisMarkItem(FontEmphasisMark::NONE, EE_CHAR_EMPHASISMARK ) ); rNotesSet.Put( SvxCharReliefItem(RELIEF_NONE, EE_CHAR_RELIEF) ); rNotesSet.Put( SvxColorItem( Color(COL_AUTO), EE_CHAR_COLOR ) ); rNotesSet.Put( SvxBackgroundColorItem( Color(COL_AUTO), EE_CHAR_BKGCOLOR ) ); diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx index 64bf0b478926..29fd2561200c 100644 --- a/svgio/source/svgreader/svgcharacternode.cxx +++ b/svgio/source/svgreader/svgcharacternode.cxx @@ -471,7 +471,7 @@ namespace svgio false, TextDecoration_line_through == aDeco ? drawinglayer::primitive2d::TEXT_STRIKEOUT_SINGLE : drawinglayer::primitive2d::TEXT_STRIKEOUT_NONE, false, - drawinglayer::primitive2d::TEXT_EMPHASISMARK_NONE, + drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_NONE, true, false, drawinglayer::primitive2d::TEXT_RELIEF_NONE, diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index ae3e5c07cdbf..2f9e9d48eaee 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -1853,7 +1853,7 @@ void FmXGridPeer::setProperty( const OUString& PropertyName, const Any& Value) t { vcl::Font aGridFont = pGrid->GetControlFont(); sal_Int16 nValue = ::comphelper::getINT16(Value); - aGridFont.SetEmphasisMark( nValue ); + aGridFont.SetEmphasisMark( (FontEmphasisMark)nValue ); pGrid->SetControlFont( aGridFont ); } else if ( PropertyName == FM_PROP_FONTRELIEF ) diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index e1ecafd576a6..d822a71183e7 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -278,7 +278,7 @@ namespace LINESTYLE_NONE != rInfo.mrFont.GetOverline() || LINESTYLE_NONE != rInfo.mrFont.GetUnderline() || STRIKEOUT_NONE != rInfo.mrFont.GetStrikeout() - || EMPHASISMARK_NONE != (rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_STYLE) + || FontEmphasisMark::NONE != (rInfo.mrFont.GetEmphasisMark() & FontEmphasisMark::Style) || RELIEF_NONE != rInfo.mrFont.GetRelief() || rInfo.mrFont.IsShadow() || bWordLineMode); @@ -307,18 +307,19 @@ namespace drawinglayer::primitive2d::mapFontStrikeoutToTextStrikeout(rInfo.mrFont.GetStrikeout())); // prepare emphasis mark data - drawinglayer::primitive2d::TextEmphasisMark eTextEmphasisMark(drawinglayer::primitive2d::TEXT_EMPHASISMARK_NONE); + drawinglayer::primitive2d::TextEmphasisMark eTextEmphasisMark(drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_NONE); - switch(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_STYLE) + switch(rInfo.mrFont.GetEmphasisMark() & FontEmphasisMark::Style) { - case EMPHASISMARK_DOT : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_DOT; break; - case EMPHASISMARK_CIRCLE : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_CIRCLE; break; - case EMPHASISMARK_DISC : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_DISC; break; - case EMPHASISMARK_ACCENT : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_EMPHASISMARK_ACCENT; break; + case FontEmphasisMark::Dot : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_DOT; break; + case FontEmphasisMark::Circle : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_CIRCLE; break; + case FontEmphasisMark::Disc : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_DISC; break; + case FontEmphasisMark::Accent : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_ACCENT; break; + default: break; } - const bool bEmphasisMarkAbove(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_POS_ABOVE); - const bool bEmphasisMarkBelow(rInfo.mrFont.GetEmphasisMark() & EMPHASISMARK_POS_BELOW); + const bool bEmphasisMarkAbove(rInfo.mrFont.GetEmphasisMark() & FontEmphasisMark::PosAbove); + const bool bEmphasisMarkBelow(rInfo.mrFont.GetEmphasisMark() & FontEmphasisMark::PosBelow); // prepare font relief data drawinglayer::primitive2d::TextRelief eTextRelief(drawinglayer::primitive2d::TEXT_RELIEF_NONE); diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 0d4f06a01ccb..105a4473bef4 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -504,7 +504,7 @@ void InitCore() aAttrTab[ RES_CHRATR_CTL_WEIGHT - POOLATTR_BEGIN ] = new SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_CTL_WEIGHT ); aAttrTab[ RES_CHRATR_ROTATE - POOLATTR_BEGIN ] = new SvxCharRotateItem( 0, false, RES_CHRATR_ROTATE ); - aAttrTab[ RES_CHRATR_EMPHASIS_MARK - POOLATTR_BEGIN ] = new SvxEmphasisMarkItem( EMPHASISMARK_NONE, RES_CHRATR_EMPHASIS_MARK ); + aAttrTab[ RES_CHRATR_EMPHASIS_MARK - POOLATTR_BEGIN ] = new SvxEmphasisMarkItem( FontEmphasisMark::NONE, RES_CHRATR_EMPHASIS_MARK ); aAttrTab[ RES_CHRATR_TWO_LINES - POOLATTR_BEGIN ] = new SvxTwoLinesItem( false, 0, 0, RES_CHRATR_TWO_LINES ); aAttrTab[ RES_CHRATR_SCALEW - POOLATTR_BEGIN ] = new SvxCharScaleWidthItem( 100, RES_CHRATR_SCALEW ); aAttrTab[ RES_CHRATR_RELIEF - POOLATTR_BEGIN ] = new SvxCharReliefItem( RELIEF_NONE, RES_CHRATR_RELIEF ); diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx index 9c1cd3368e8b..a335326e3523 100644 --- a/sw/source/core/doc/DocumentStylePoolManager.cxx +++ b/sw/source/core/doc/DocumentStylePoolManager.cxx @@ -1243,7 +1243,7 @@ SwFormat* DocumentStylePoolManager::GetFormatFromPool( sal_uInt16 nId ) RES_CHRATR_CJK_FONTSIZE ))->GetHeight() / 2; SetAllScriptItem( aSet, SvxFontHeightItem( nH, 100, RES_CHRATR_FONTSIZE)); aSet.Put(SvxUnderlineItem( LINESTYLE_NONE, RES_CHRATR_UNDERLINE )); - aSet.Put(SvxEmphasisMarkItem( EMPHASISMARK_NONE, RES_CHRATR_EMPHASIS_MARK) ); + aSet.Put(SvxEmphasisMarkItem( FontEmphasisMark::NONE, RES_CHRATR_EMPHASIS_MARK) ); } break; diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 450d0e9b599d..076a2ae31e5b 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -790,7 +790,7 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) mpPDFExtOutDevData->SetStructureAttribute( vcl::PDFWriter::TextDecorationType, vcl::PDFWriter::Overline ); if ( STRIKEOUT_NONE != rInf.GetFont()->GetStrikeout() ) mpPDFExtOutDevData->SetStructureAttribute( vcl::PDFWriter::TextDecorationType, vcl::PDFWriter::LineThrough ); - if ( EMPHASISMARK_NONE != rInf.GetFont()->GetEmphasisMark() ) + if ( FontEmphasisMark::NONE != rInf.GetFont()->GetEmphasisMark() ) mpPDFExtOutDevData->SetStructureAttribute( vcl::PDFWriter::TextDecorationType, vcl::PDFWriter::Overline ); } @@ -1382,7 +1382,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() if ( LINESTYLE_NONE != rInf.GetFont()->GetUnderline() || LINESTYLE_NONE != rInf.GetFont()->GetOverline() || STRIKEOUT_NONE != rInf.GetFont()->GetStrikeout() || - EMPHASISMARK_NONE != rInf.GetFont()->GetEmphasisMark() || + FontEmphasisMark::NONE != rInf.GetFont()->GetEmphasisMark() || 0 != rInf.GetFont()->GetEscapement() || SwFontScript::Latin != nFont || nCurrentLanguage != nDefaultLang || diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 92c4ac40643f..4bb1527e4719 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3982,7 +3982,7 @@ void DocxAttributeOutput::OutputDefaultItem(const SfxPoolItem& rHt) bMustWrite = static_cast< const SvxCharRotateItem& >(rHt).GetValue() != 0; break; case RES_CHRATR_EMPHASIS_MARK: - bMustWrite = static_cast< const SvxEmphasisMarkItem& >(rHt).GetValue() != EMPHASISMARK_NONE; + bMustWrite = static_cast< const SvxEmphasisMarkItem& >(rHt).GetEmphasisMark() != FontEmphasisMark::NONE; break; case RES_CHRATR_TWO_LINES: bMustWrite = static_cast< const SvxTwoLinesItem& >(rHt).GetValue(); @@ -6493,26 +6493,18 @@ void DocxAttributeOutput::CharRotate( const SvxCharRotateItem& rRotate) void DocxAttributeOutput::CharEmphasisMark( const SvxEmphasisMarkItem& rEmphasisMark ) { const char *pEmphasis; + const FontEmphasisMark v = rEmphasisMark.GetEmphasisMark(); - switch ( rEmphasisMark.GetValue() ) - { - default: - case EMPHASISMARK_NONE: - pEmphasis = "none"; - break; - case EMPHASISMARK_DOT | EMPHASISMARK_POS_ABOVE: + if (v == (FontEmphasisMark::Dot | FontEmphasisMark::PosAbove)) pEmphasis = "dot"; - break; - case EMPHASISMARK_ACCENT | EMPHASISMARK_POS_ABOVE: + else if (v == (FontEmphasisMark::Accent | FontEmphasisMark::PosAbove)) pEmphasis = "comma"; - break; - case EMPHASISMARK_CIRCLE | EMPHASISMARK_POS_ABOVE: + else if (v == (FontEmphasisMark::Circle | FontEmphasisMark::PosAbove)) pEmphasis = "circle"; - break; - case EMPHASISMARK_DOT|EMPHASISMARK_POS_BELOW: + else if (v == (FontEmphasisMark::Dot|FontEmphasisMark::PosBelow)) pEmphasis = "underDot"; - break; - } + else + pEmphasis = "none"; m_pSerializer->singleElementNS( XML_w, XML_em, FSNS( XML_w, XML_val ), pEmphasis, FSEND ); } diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 9bc357981320..a755528e341f 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -2534,24 +2534,17 @@ void RtfAttributeOutput::CharRotate(const SvxCharRotateItem& rRotate) void RtfAttributeOutput::CharEmphasisMark(const SvxEmphasisMarkItem& rEmphasisMark) { - switch (rEmphasisMark.GetEmphasisMark()) - { - case EMPHASISMARK_NONE: + FontEmphasisMark v = rEmphasisMark.GetEmphasisMark(); + if (v == FontEmphasisMark::NONE) m_aStyles.append(OOO_STRING_SVTOOLS_RTF_ACCNONE); - break; - case EMPHASISMARK_DOT | EMPHASISMARK_POS_ABOVE: + else if (v == (FontEmphasisMark::Dot | FontEmphasisMark::PosAbove)) m_aStyles.append(OOO_STRING_SVTOOLS_RTF_ACCDOT); - break; - case EMPHASISMARK_ACCENT | EMPHASISMARK_POS_ABOVE: + else if (v == (FontEmphasisMark::Accent | FontEmphasisMark::PosAbove)) m_aStyles.append(OOO_STRING_SVTOOLS_RTF_ACCCOMMA); - break; - case EMPHASISMARK_CIRCLE | EMPHASISMARK_POS_ABOVE: + else if (v == (FontEmphasisMark::Circle | FontEmphasisMark::PosAbove)) m_aStyles.append(OOO_STRING_SVTOOLS_RTF_ACCCIRCLE); - break; - case EMPHASISMARK_DOT|EMPHASISMARK_POS_BELOW: + else if (v == (FontEmphasisMark::Dot | FontEmphasisMark::PosBelow)) m_aStyles.append(OOO_STRING_SVTOOLS_RTF_ACCUNDERDOT); - break; - } } void RtfAttributeOutput::CharTwoLines(const SvxTwoLinesItem& rTwoLines) diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index e6f139ee2f6c..43d7ee9b2e89 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -1448,15 +1448,18 @@ void WW8AttributeOutput::CharRotate( const SvxCharRotateItem& rRotate ) void WW8AttributeOutput::CharEmphasisMark( const SvxEmphasisMarkItem& rEmphasisMark ) { sal_uInt8 nVal; - switch ( rEmphasisMark.GetValue() ) - { - case EMPHASISMARK_NONE: nVal = 0; break; - case EMPHASISMARK_SIDE_DOTS: nVal = 2; break; - case EMPHASISMARK_CIRCLE_ABOVE: nVal = 3; break; - case EMPHASISMARK_DOTS_BELOW: nVal = 4; break; + const FontEmphasisMark v = rEmphasisMark.GetEmphasisMark(); + if (v == FontEmphasisMark::NONE) + nVal = 0; + else if (v == (FontEmphasisMark::Accent | FontEmphasisMark::PosAbove)) + nVal = 2; + else if (v == (FontEmphasisMark::Circle | FontEmphasisMark::PosAbove)) + nVal = 3; + else if (v == (FontEmphasisMark::Dot | FontEmphasisMark::PosBelow)) + nVal = 4; + else // case 1: - default: nVal = 1; break; - } + nVal = 1; m_rWW8Export.InsUInt16( NS_sprm::LN_CKcd ); m_rWW8Export.pO->push_back( nVal ); diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 4b240867a2e5..399d8109c55b 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -4427,34 +4427,34 @@ void SwWW8ImplReader::Read_Emphasis( sal_uInt16, const sal_uInt8* pData, short n GetFormatAttr(RES_CHRATR_CJK_LANGUAGE))->GetLanguage(); } - sal_uInt16 nVal; + FontEmphasisMark nVal; switch( *pData ) { case 0: - nVal = EMPHASISMARK_NONE; + nVal = FontEmphasisMark::NONE; break; case 2: if (MsLangId::isKorean(nLang) || MsLangId::isTraditionalChinese(nLang)) - nVal = EMPHASISMARK_CIRCLE_ABOVE; + nVal = (FontEmphasisMark::Circle | FontEmphasisMark::PosAbove); else if (nLang == LANGUAGE_JAPANESE) - nVal = EMPHASISMARK_SIDE_DOTS; + nVal = (FontEmphasisMark::Accent | FontEmphasisMark::PosAbove); else - nVal = EMPHASISMARK_DOTS_BELOW; + nVal = (FontEmphasisMark::Dot | FontEmphasisMark::PosBelow); break; case 3: - nVal = EMPHASISMARK_CIRCLE_ABOVE; + nVal = (FontEmphasisMark::Circle | FontEmphasisMark::PosAbove); break; case 4: - nVal = EMPHASISMARK_DOTS_BELOW; + nVal = (FontEmphasisMark::Dot | FontEmphasisMark::PosBelow); break; case 1: if (MsLangId::isSimplifiedChinese(nLang)) - nVal = EMPHASISMARK_DOTS_BELOW; + nVal = (FontEmphasisMark::Dot | FontEmphasisMark::PosBelow); else - nVal = EMPHASISMARK_DOTS_ABOVE; + nVal = (FontEmphasisMark::Dot | FontEmphasisMark::PosAbove); break; default: - nVal = EMPHASISMARK_DOTS_ABOVE; + nVal = (FontEmphasisMark::Dot | FontEmphasisMark::PosAbove); break; } diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index 5f896a93b116..2b0269c06105 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -1569,7 +1569,7 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any& if ( Value >>= n ) { vcl::Font aFont = pWindow->GetControlFont(); - aFont.SetEmphasisMark( n ); + aFont.SetEmphasisMark( (FontEmphasisMark)n ); pWindow->SetControlFont( aFont ); } } diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx index 5e672b111748..de56c8059e57 100644 --- a/vcl/source/font/font.cxx +++ b/vcl/source/font/font.cxx @@ -424,7 +424,7 @@ SvStream& WriteImplFont( SvStream& rOStm, const ImplFont& rImplFont ) rOStm.WriteUChar( rImplFont.meRelief ); rOStm.WriteUInt16( rImplFont.maCJKLanguageTag.getLanguageType( false) ); rOStm.WriteBool( rImplFont.mbVertical ); - rOStm.WriteUInt16( rImplFont.meEmphasisMark ); + rOStm.WriteUInt16( (sal_uInt16)rImplFont.meEmphasisMark ); // new in version 3 rOStm.WriteUInt16( rImplFont.meOverline ); @@ -728,7 +728,7 @@ ImplFont::ImplFont() : meOverline( LINESTYLE_NONE ), meStrikeout( STRIKEOUT_NONE ), meRelief( RELIEF_NONE ), - meEmphasisMark( EMPHASISMARK_NONE ), + meEmphasisMark( FontEmphasisMark::NONE ), meKerning( FontKerning::NONE ), meCharSet( RTL_TEXTENCODING_DONTKNOW ), maLanguageTag( LANGUAGE_DONTKNOW ), diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 86723116487c..2299f71c91fb 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -9098,7 +9098,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool } // write eventual emphasis marks - if( m_aCurrentPDFState.m_aFont.GetEmphasisMark() & EMPHASISMARK_STYLE ) + if( m_aCurrentPDFState.m_aFont.GetEmphasisMark() & FontEmphasisMark::Style ) { tools::PolyPolygon aEmphPoly; Rectangle aEmphRect1; @@ -9115,7 +9115,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool aLine.append( "q\n" ); nEmphMark = OutputDevice::ImplGetEmphasisMarkStyle( m_aCurrentPDFState.m_aFont ); - if ( nEmphMark & EMPHASISMARK_POS_BELOW ) + if ( nEmphMark & FontEmphasisMark::PosBelow ) nEmphHeight = m_pReferenceDevice->mnEmphasisDescent; else nEmphHeight = m_pReferenceDevice->mnEmphasisAscent; @@ -9142,7 +9142,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool Point aOffset = Point(0,0); - if ( nEmphMark & EMPHASISMARK_POS_BELOW ) + if ( nEmphMark & FontEmphasisMark::PosBelow ) aOffset.Y() += m_pReferenceDevice->mpFontInstance->mxFontMetric->GetDescent() + nEmphYOff; else aOffset.Y() -= m_pReferenceDevice->mpFontInstance->mxFontMetric->GetAscent() + nEmphYOff; diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index cb9ec331ae12..0d04de4039c1 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -333,11 +333,11 @@ void OutputDevice::ImplGetEmphasisMark( tools::PolyPolygon& rPolyPoly, bool& rPo if ( !nHeight ) return; - FontEmphasisMark nEmphasisStyle = eEmphasis & EMPHASISMARK_STYLE; + FontEmphasisMark nEmphasisStyle = eEmphasis & FontEmphasisMark::Style; long nDotSize = 0; switch ( nEmphasisStyle ) { - case EMPHASISMARK_DOT: + case FontEmphasisMark::Dot: // Dot has 55% of the height nDotSize = (nHeight*550)/1000; if ( !nDotSize ) @@ -354,7 +354,7 @@ void OutputDevice::ImplGetEmphasisMark( tools::PolyPolygon& rPolyPoly, bool& rPo rWidth = nDotSize; break; - case EMPHASISMARK_CIRCLE: + case FontEmphasisMark::Circle: // Dot has 80% of the height nDotSize = (nHeight*800)/1000; if ( !nDotSize ) @@ -380,7 +380,7 @@ void OutputDevice::ImplGetEmphasisMark( tools::PolyPolygon& rPolyPoly, bool& rPo rWidth = nDotSize; break; - case EMPHASISMARK_DISC: + case FontEmphasisMark::Disc: // Dot has 80% of the height nDotSize = (nHeight*800)/1000; if ( !nDotSize ) @@ -396,7 +396,7 @@ void OutputDevice::ImplGetEmphasisMark( tools::PolyPolygon& rPolyPoly, bool& rPo rWidth = nDotSize; break; - case EMPHASISMARK_ACCENT: + case FontEmphasisMark::Accent: // Dot has 80% of the height nDotSize = (nHeight*800)/1000; if ( !nDotSize ) @@ -429,6 +429,7 @@ void OutputDevice::ImplGetEmphasisMark( tools::PolyPolygon& rPolyPoly, bool& rPo rPolyPoly.Insert( aTemp ); } break; + default: break; } // calculate position @@ -436,7 +437,7 @@ void OutputDevice::ImplGetEmphasisMark( tools::PolyPolygon& rPolyPoly, bool& rPo long nSpaceY = nHeight-nDotSize; if ( nSpaceY >= nOffY*2 ) rYOff += nOffY; - if ( !(eEmphasis & EMPHASISMARK_POS_BELOW) ) + if ( !(eEmphasis & FontEmphasisMark::PosBelow) ) rYOff += nDotSize; } @@ -446,20 +447,20 @@ FontEmphasisMark OutputDevice::ImplGetEmphasisMarkStyle( const vcl::Font& rFont // If no Position is set, then calculate the default position, which // depends on the language - if ( !(nEmphasisMark & (EMPHASISMARK_POS_ABOVE | EMPHASISMARK_POS_BELOW)) ) + if ( !(nEmphasisMark & (FontEmphasisMark::PosAbove | FontEmphasisMark::PosBelow)) ) { LanguageType eLang = rFont.GetLanguage(); // In Chinese Simplified the EmphasisMarks are below/left if (MsLangId::isSimplifiedChinese(eLang)) - nEmphasisMark |= EMPHASISMARK_POS_BELOW; + nEmphasisMark |= FontEmphasisMark::PosBelow; else { eLang = rFont.GetCJKContextLanguage(); // In Chinese Simplified the EmphasisMarks are below/left if (MsLangId::isSimplifiedChinese(eLang)) - nEmphasisMark |= EMPHASISMARK_POS_BELOW; + nEmphasisMark |= FontEmphasisMark::PosBelow; else - nEmphasisMark |= EMPHASISMARK_POS_ABOVE; + nEmphasisMark |= FontEmphasisMark::PosAbove; } } @@ -1112,13 +1113,13 @@ bool OutputDevice::ImplNewFont() const // calculate EmphasisArea mnEmphasisAscent = 0; mnEmphasisDescent = 0; - if ( maFont.GetEmphasisMark() & EMPHASISMARK_STYLE ) + if ( maFont.GetEmphasisMark() & FontEmphasisMark::Style ) { FontEmphasisMark nEmphasisMark = ImplGetEmphasisMarkStyle( maFont ); long nEmphasisHeight = (pFontInstance->mnLineHeight*250)/1000; if ( nEmphasisHeight < 1 ) nEmphasisHeight = 1; - if ( nEmphasisMark & EMPHASISMARK_POS_BELOW ) + if ( nEmphasisMark & FontEmphasisMark::PosBelow ) mnEmphasisDescent = nEmphasisHeight; else mnEmphasisAscent = nEmphasisHeight; @@ -1255,7 +1256,7 @@ void OutputDevice::ImplDrawEmphasisMarks( SalLayout& rSalLayout ) long nEmphasisHeight; bool bPolyLine; - if ( nEmphasisMark & EMPHASISMARK_POS_BELOW ) + if ( nEmphasisMark & FontEmphasisMark::PosBelow ) nEmphasisHeight = mnEmphasisDescent; else nEmphasisHeight = mnEmphasisAscent; @@ -1279,7 +1280,7 @@ void OutputDevice::ImplDrawEmphasisMarks( SalLayout& rSalLayout ) Point aOffset = Point(0,0); - if ( nEmphasisMark & EMPHASISMARK_POS_BELOW ) + if ( nEmphasisMark & FontEmphasisMark::PosBelow ) aOffset.Y() += mpFontInstance->mxFontMetric->GetDescent() + nEmphasisYOff; else aOffset.Y() -= mpFontInstance->mxFontMetric->GetAscent() + nEmphasisYOff; diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index e887efa90e2c..2fb4c2f8eba4 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -326,7 +326,7 @@ bool OutputDevice::ImplDrawTextDirect( SalLayout& rSalLayout, maFont.IsWordLineMode(), ImplIsUnderlineAbove( maFont ) ); // emphasis marks - if( maFont.GetEmphasisMark() & EMPHASISMARK_STYLE ) + if( maFont.GetEmphasisMark() & FontEmphasisMark::Style ) ImplDrawEmphasisMarks( rSalLayout ); return true; |