diff options
author | Noel Grandin <noel@peralex.com> | 2014-08-01 12:34:33 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-08-20 09:01:26 -0500 |
commit | 794d5ac4ac0b1dcaac289772ce096a4295d4e15d (patch) | |
tree | d02d4d13e793b0856c4dd962cf4b8d946942e3c4 /vcl/source/outdev | |
parent | 71804294c79136ef43a8f91b5c961e266d32187a (diff) |
vcl: use enum for complex text layout constants
Since these constants are bitfield flags, we define some methods to make
working with them reasonably type safe.
Move the definitions to outdevstate.hxx, since we need the values there,
and that appears to be the "root most" header file.
Also dump TEXT_LAYOUT_BIDI_LTR constant, since it means the same thing
as TEXT_LAYOUT_DEFAULT (ie. 0), and leaving it in causes people to write
weird code thinking that it's a real flag.
Change-Id: Iddab86cd6c78181ceb8caa48e77e1f5a8e526343
Reviewed-on: https://gerrit.libreoffice.org/10676
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source/outdev')
-rw-r--r-- | vcl/source/outdev/outdevstate.cxx | 2 | ||||
-rw-r--r-- | vcl/source/outdev/text.cxx | 12 | ||||
-rw-r--r-- | vcl/source/outdev/textline.cxx | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx index 2dcaf11f76a0..21a7727dfe55 100644 --- a/vcl/source/outdev/outdevstate.cxx +++ b/vcl/source/outdev/outdevstate.cxx @@ -289,7 +289,7 @@ void OutputDevice::SetDrawMode( sal_uLong nDrawMode ) mpAlphaVDev->SetDrawMode( nDrawMode ); } -void OutputDevice::SetLayoutMode( sal_uLong nTextLayoutMode ) +void OutputDevice::SetLayoutMode( ComplexTextLayoutMode nTextLayoutMode ) { if( mpMetaFile ) mpMetaFile->AddAction( new MetaLayoutModeAction( nTextLayoutMode ) ); diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 75ac162ff040..51117fe1c172 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1201,9 +1201,9 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( OUString& rStr, if( nEndIndex < nMinIndex ) nEndIndex = nMinIndex; - if( mnTextLayoutMode & TEXT_LAYOUT_BIDI_RTL ) + if( (mnTextLayoutMode & TEXT_LAYOUT_BIDI_RTL) != 0 ) nLayoutFlags |= SAL_LAYOUT_BIDI_RTL; - if( mnTextLayoutMode & TEXT_LAYOUT_BIDI_STRONG ) + if( (mnTextLayoutMode & TEXT_LAYOUT_BIDI_STRONG) != 0 ) nLayoutFlags |= SAL_LAYOUT_BIDI_STRONG; else if( 0 == (mnTextLayoutMode & TEXT_LAYOUT_BIDI_RTL) ) { @@ -1226,9 +1226,9 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( OUString& rStr, if( maFont.IsVertical() ) nLayoutFlags |= SAL_LAYOUT_VERTICAL; - if( mnTextLayoutMode & TEXT_LAYOUT_ENABLE_LIGATURES ) + if( (mnTextLayoutMode & TEXT_LAYOUT_ENABLE_LIGATURES) != 0 ) nLayoutFlags |= SAL_LAYOUT_ENABLE_LIGATURES; - else if( mnTextLayoutMode & TEXT_LAYOUT_COMPLEX_DISABLED ) + else if( (mnTextLayoutMode & TEXT_LAYOUT_COMPLEX_DISABLED) != 0 ) nLayoutFlags |= SAL_LAYOUT_COMPLEX_DISABLED; else { @@ -1274,9 +1274,9 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( OUString& rStr, // right align for RTL text, DRAWPOS_REVERSED, RTL window style bool bRightAlign = ((mnTextLayoutMode & TEXT_LAYOUT_BIDI_RTL) != 0); - if( mnTextLayoutMode & TEXT_LAYOUT_TEXTORIGIN_LEFT ) + if( (mnTextLayoutMode & TEXT_LAYOUT_TEXTORIGIN_LEFT) != 0 ) bRightAlign = false; - else if ( mnTextLayoutMode & TEXT_LAYOUT_TEXTORIGIN_RIGHT ) + else if ( (mnTextLayoutMode & TEXT_LAYOUT_TEXTORIGIN_RIGHT) != 0 ) bRightAlign = true; // SSA: hack for western office, ie text get right aligned // for debugging purposes of mirrored UI diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx index 5cf597823fbd..def2f64af08d 100644 --- a/vcl/source/outdev/textline.cxx +++ b/vcl/source/outdev/textline.cxx @@ -625,7 +625,7 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY, nBaseY += nDistY; // strikeout text has to be left aligned - sal_uLong nOrigTLM = mnTextLayoutMode; + ComplexTextLayoutMode nOrigTLM = mnTextLayoutMode; mnTextLayoutMode = TEXT_LAYOUT_BIDI_STRONG | TEXT_LAYOUT_COMPLEX_DISABLED; pLayout = ImplLayout( aStrikeoutText, 0, aStrikeoutText.getLength() ); mnTextLayoutMode = nOrigTLM; |