summaryrefslogtreecommitdiff
path: root/vcl/source/gdi
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-08-01 12:34:33 +0200
committerCaolán McNamara <caolanm@redhat.com>2014-08-20 09:01:26 -0500
commit794d5ac4ac0b1dcaac289772ce096a4295d4e15d (patch)
treed02d4d13e793b0856c4dd962cf4b8d946942e3c4 /vcl/source/gdi
parent71804294c79136ef43a8f91b5c961e266d32187a (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/gdi')
-rw-r--r--vcl/source/gdi/gdimtf.cxx4
-rw-r--r--vcl/source/gdi/metaact.cxx8
-rw-r--r--vcl/source/gdi/pdfwriter.cxx4
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx4
-rw-r--r--vcl/source/gdi/pdfwriter_impl.hxx6
-rw-r--r--vcl/source/gdi/textlayout.cxx2
6 files changed, 15 insertions, 13 deletions
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 36c10226fceb..5217f2561ee8 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -351,7 +351,7 @@ void GDIMetaFile::Play( OutputDevice* pOut, size_t nPos )
// recent add-ons. Newer metafiles must of course explicitly set
// those states.
pOut->Push( PUSH_TEXTLAYOUTMODE|PUSH_TEXTLANGUAGE );
- pOut->SetLayoutMode( 0 );
+ pOut->SetLayoutMode( TEXT_LAYOUT_DEFAULT );
pOut->SetDigitLanguage( 0 );
OSL_TRACE("GDIMetaFile::Play on device of size: %ld x %ld", pOut->GetOutputSizePixel().Width(), pOut->GetOutputSizePixel().Height());
@@ -580,7 +580,7 @@ void GDIMetaFile::Play( OutputDevice* pOut, const Point& rPos,
// This is necessary, since old metafiles don't even know of these
// recent add-ons. Newer metafiles must of course explicitly set
// those states.
- pOut->SetLayoutMode( 0 );
+ pOut->SetLayoutMode( TEXT_LAYOUT_DEFAULT );
pOut->SetDigitLanguage( 0 );
Play( pOut, nPos );
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index 728860b7bd35..cad74be4c1d3 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -3698,13 +3698,13 @@ void MetaCommentAction::Read( SvStream& rIStm, ImplMetaReadData* )
MetaLayoutModeAction::MetaLayoutModeAction() :
MetaAction ( META_LAYOUTMODE_ACTION ),
- mnLayoutMode( 0 )
+ mnLayoutMode( TEXT_LAYOUT_DEFAULT )
{}
MetaLayoutModeAction::~MetaLayoutModeAction()
{}
-MetaLayoutModeAction::MetaLayoutModeAction( sal_uInt32 nLayoutMode ) :
+MetaLayoutModeAction::MetaLayoutModeAction( ComplexTextLayoutMode nLayoutMode ) :
MetaAction ( META_LAYOUTMODE_ACTION ),
mnLayoutMode( nLayoutMode )
{}
@@ -3736,7 +3736,9 @@ void MetaLayoutModeAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
void MetaLayoutModeAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
VersionCompat aCompat(rIStm, STREAM_READ);
- rIStm.ReadUInt32( mnLayoutMode );
+ sal_uInt32 tmp;
+ rIStm.ReadUInt32( tmp );
+ mnLayoutMode = static_cast<ComplexTextLayoutMode>(tmp);
}
MetaTextLanguageAction::MetaTextLanguageAction() :
diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx
index 8cc1c314baa2..8acf85f6e0f1 100644
--- a/vcl/source/gdi/pdfwriter.cxx
+++ b/vcl/source/gdi/pdfwriter.cxx
@@ -274,9 +274,9 @@ void PDFWriter::IntersectClipRegion( const Rectangle& rRect )
pImplementation->intersectClipRegion( rRect );
}
-void PDFWriter::SetLayoutMode( sal_uLong nMode )
+void PDFWriter::SetLayoutMode( ComplexTextLayoutMode nMode )
{
- pImplementation->setLayoutMode( (sal_Int32)nMode );
+ pImplementation->setLayoutMode( nMode );
}
void PDFWriter::SetDigitLanguage( LanguageType eLang )
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 2ff64f1daf24..8b18321d7665 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -7581,7 +7581,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
// TODO: a real solution would be to map the layout engine's
// glyphid (i.e. FreeType's synthetic glyphid for a Type1 font)
// back to unicode and then to embeddable font's encoding
- if( getReferenceDevice()->GetLayoutMode() & TEXT_LAYOUT_BIDI_RTL )
+ if( (getReferenceDevice()->GetLayoutMode() & TEXT_LAYOUT_BIDI_RTL) != TEXT_LAYOUT_DEFAULT )
{
size_t nI = aUnicodes.size()-1;
for( int n = 0; n < nChars; n++, nI-- )
@@ -8386,7 +8386,7 @@ void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, long nWidth, FontStrik
}
// strikeout string is left aligned non-CTL text
- sal_uLong nOrigTLM = m_pReferenceDevice->GetLayoutMode();
+ ComplexTextLayoutMode nOrigTLM = m_pReferenceDevice->GetLayoutMode();
m_pReferenceDevice->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG|TEXT_LAYOUT_COMPLEX_DISABLED );
push( PUSH_CLIPREGION );
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index 0020e9b1e202..ed4013befcd8 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -710,7 +710,7 @@ private:
basegfx::B2DPolyPolygon m_aClipRegion;
bool m_bClipRegion;
sal_Int32 m_nAntiAlias;
- sal_Int32 m_nLayoutMode;
+ ComplexTextLayoutMode m_nLayoutMode;
LanguageType m_aDigitLanguage;
sal_Int32 m_nTransparentPercent;
sal_uInt16 m_nFlags;
@@ -735,7 +735,7 @@ private:
m_aOverlineColor( COL_TRANSPARENT ),
m_bClipRegion( false ),
m_nAntiAlias( 1 ),
- m_nLayoutMode( 0 ),
+ m_nLayoutMode( TEXT_LAYOUT_DEFAULT ),
m_aDigitLanguage( 0 ),
m_nTransparentPercent( 0 ),
m_nFlags( 0xffff ),
@@ -1182,7 +1182,7 @@ public:
bool intersectClipRegion( const basegfx::B2DPolyPolygon& rRegion );
- void setLayoutMode( sal_Int32 nLayoutMode )
+ void setLayoutMode( ComplexTextLayoutMode nLayoutMode )
{
m_aGraphicsStack.front().m_nLayoutMode = nLayoutMode;
m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateLayoutMode;
diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx
index b1a3a77debd4..f7d3b81d3cac 100644
--- a/vcl/source/gdi/textlayout.cxx
+++ b/vcl/source/gdi/textlayout.cxx
@@ -263,7 +263,7 @@ namespace vcl
return Rectangle();
// determine text layout mode from the RTL-ness of the control whose text we render
- sal_uLong nTextLayoutMode = m_bRTLEnabled ? TEXT_LAYOUT_BIDI_RTL : TEXT_LAYOUT_BIDI_LTR;
+ ComplexTextLayoutMode nTextLayoutMode = m_bRTLEnabled ? TEXT_LAYOUT_BIDI_RTL : TEXT_LAYOUT_DEFAULT;
m_rReferenceDevice.SetLayoutMode( nTextLayoutMode );
m_rTargetDevice.SetLayoutMode( nTextLayoutMode | TEXT_LAYOUT_TEXTORIGIN_LEFT );