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 /sw | |
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 'sw')
-rw-r--r-- | sw/source/core/bastyp/init.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentStylePoolManager.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/EnhancedPDFExportHelper.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 24 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 19 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 19 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 20 |
7 files changed, 39 insertions, 51 deletions
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; } |