summaryrefslogtreecommitdiffstats
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2016-05-08 09:21:17 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-05-09 09:41:34 +0000
commit50ac0f503b763d08aef4a193c38e64b70220bfba (patch)
tree9e02808b2736ac75852060bb3367c8236b9ac334 /vcl
parenttdf#99589 tolower / toupper - dangerous to Turks ... (diff)
downloadcore-50ac0f503b763d08aef4a193c38e64b70220bfba.tar.gz
core-50ac0f503b763d08aef4a193c38e64b70220bfba.zip
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')
-rw-r--r--vcl/source/font/font.cxx4
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx6
-rw-r--r--vcl/source/outdev/font.cxx29
-rw-r--r--vcl/source/outdev/text.cxx2
4 files changed, 21 insertions, 20 deletions
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;