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 /vcl/source/outdev | |
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 'vcl/source/outdev')
-rw-r--r-- | vcl/source/outdev/font.cxx | 29 | ||||
-rw-r--r-- | vcl/source/outdev/text.cxx | 2 |
2 files changed, 16 insertions, 15 deletions
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; |