From 7a0af37989d1f1b508a61f28e785c5b1f27d58af Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 15 May 2015 11:05:45 +0200 Subject: convert SAL_LAYOUT flags to scoped enum Change-Id: I0aeea1f32136e43e90a1afb0ea84dbaff2b77587 --- include/vcl/outdev.hxx | 94 ++++++++++++++++++--------------- sw/source/core/txtnode/fntcache.cxx | 4 +- vcl/generic/glyphs/gcach_layout.cxx | 10 ++-- vcl/generic/print/genpspgraphics.cxx | 10 ++-- vcl/inc/salgdi.hxx | 8 +-- vcl/inc/sallayout.hxx | 8 +-- vcl/opengl/x11/salvd.cxx | 2 +- vcl/quartz/ctlayout.cxx | 20 +++---- vcl/source/gdi/salgdilayout.cxx | 84 ++++++++++++++--------------- vcl/source/gdi/sallayout.cxx | 42 +++++++-------- vcl/source/gdi/virdev.cxx | 2 +- vcl/source/glyphs/graphite_layout.cxx | 22 ++++---- vcl/source/outdev/font.cxx | 2 +- vcl/source/outdev/outdev.cxx | 8 +-- vcl/source/outdev/text.cxx | 36 ++++++------- vcl/unx/generic/gdi/cairotextrender.cxx | 2 +- vcl/unx/generic/gdi/salvd.cxx | 2 +- vcl/win/source/gdi/salprn.cxx | 2 +- vcl/win/source/gdi/salvd.cxx | 2 +- vcl/win/source/gdi/winlayout.cxx | 50 +++++++++--------- 20 files changed, 208 insertions(+), 202 deletions(-) diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 3655e44b08d8..da18ee8993f9 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -56,12 +57,6 @@ #include #include -#if defined UNX -#define GLYPH_FONT_HEIGHT 128 -#else -#define GLYPH_FONT_HEIGHT 256 -#endif - struct ImplOutDevData; class ImplFontEntry; class OutDevState; @@ -93,23 +88,25 @@ class SalLayout; class ImplLayoutArgs; class ImplFontAttributes; class VirtualDevice; -namespace vcl { class Window; } struct SalTwoRect; +class VirtualDevice; +class Printer; +class FontSelectPattern; +class ImplFontMetricData; +class VCLXGraphics; +class OutDevStateStack; +struct BitmapSystemData; -// Layout options -#define SAL_LAYOUT_BIDI_RTL (1<<0) -#define SAL_LAYOUT_BIDI_STRONG (1<<1) -#define SAL_LAYOUT_RIGHT_ALIGN (1<<2) -#define SAL_LAYOUT_KERNING_PAIRS (1<<4) -#define SAL_LAYOUT_KERNING_ASIAN (1<<5) -#define SAL_LAYOUT_VERTICAL (1<<6) -#define SAL_LAYOUT_COMPLEX_DISABLED (1<<8) -#define SAL_LAYOUT_ENABLE_LIGATURES (1<<9) -#define SAL_LAYOUT_SUBSTITUTE_DIGITS (1<<10) -#define SAL_LAYOUT_KASHIDA_JUSTIFICATON (1<<11) -#define SAL_LAYOUT_DISABLE_GLYPH_PROCESSING (1<<12) -#define SAL_LAYOUT_FOR_FALLBACK (1<<13) -#define SAL_LAYOUT_DRAW_BULLET (1<<14) +namespace vcl +{ + class PDFWriterImpl; + class ExtOutDevData; + class ITextLayout; + struct FontCapabilities; + class TextLayoutCache; + class Window; + class FontInfo; +} namespace com { namespace sun { namespace star { namespace rendering { class XCanvas; @@ -127,17 +124,37 @@ namespace com { namespace sun { namespace star { namespace awt { class XGraphics; } } } } -typedef std::vector< Rectangle > MetricVector; +#if defined UNX +#define GLYPH_FONT_HEIGHT 128 +#else +#define GLYPH_FONT_HEIGHT 256 +#endif -namespace vcl +// Text Layout options +enum class SalLayoutFlags { - class PDFWriterImpl; - class ExtOutDevData; - class ITextLayout; - struct FontCapabilities; - class TextLayoutCache; + NONE = 0x0000, + BiDiRtl = 0x0001, + BiDiStrong = 0x0002, + RightAlign = 0x0004, + KerningPairs = 0x0010, + KerningAsian = 0x0020, + Vertical = 0x0040, + ComplexDisabled = 0x0100, + EnableLigatures = 0x0200, + SubstituteDigits = 0x0400, + KashidaJustification = 0x0800, + DisableGlyphProcessing = 0x1000, + ForFallback = 0x2000, + DrawBullet = 0x4000, +}; +namespace o3tl +{ + template<> struct typed_flags : is_typed_flags {}; } +typedef std::vector< Rectangle > MetricVector; + // OutputDevice-Types // Flags for DrawText() @@ -226,20 +243,8 @@ enum OutDevViewType { OUTDEV_VIEWTYPE_DONTKNOW, OUTDEV_VIEWTYPE_PRINTPREVIEW, OU // OutputDevice -class VirtualDevice; -class Printer; -class FontSelectPattern; -class ImplFontMetricData; -class VCLXGraphics; -class OutDevStateStack; -struct BitmapSystemData; - typedef boost::intrusive_ptr< FontCharMap > FontCharMapPtr; -namespace vcl { - class FontInfo; -} - BmpMirrorFlags AdjustTwoRect( SalTwoRect& rTwoRect, const Size& rSizePix ); void AdjustTwoRect( SalTwoRect& rTwoRect, const Rectangle& rValidSrcRect ); @@ -1113,7 +1118,7 @@ public: const long* pDXAry = NULL, sal_Int32 nIndex = 0, sal_Int32 nLen = -1, - int flags = 0); + SalLayoutFlags flags = SalLayoutFlags::NONE); long GetTextArray( const OUString& rStr, long* pDXAry = NULL, sal_Int32 nIndex = 0, sal_Int32 nLen = -1, vcl::TextLayoutCache const* = nullptr) const; @@ -1285,11 +1290,12 @@ public: virtual bool HasMirroredGraphics() const; SAL_DLLPRIVATE SalLayout* ImplLayout( const OUString&, sal_Int32 nIndex, sal_Int32 nLen, const Point& rLogicPos = Point(0,0), long nLogicWidth=0, - const long* pLogicDXArray=NULL, int flags=0, + const long* pLogicDXArray=NULL, SalLayoutFlags flags = SalLayoutFlags::NONE, vcl::TextLayoutCache const* = nullptr) const; SAL_DLLPRIVATE ImplLayoutArgs ImplPrepareLayoutArgs( OUString&, const sal_Int32 nIndex, const sal_Int32 nLen, - DeviceCoordinate nPixelWidth, const DeviceCoordinate* pPixelDXArray, int flags = 0, - vcl::TextLayoutCache const* = nullptr) const; + DeviceCoordinate nPixelWidth, const DeviceCoordinate* pPixelDXArray, + SalLayoutFlags flags = SalLayoutFlags::NONE, + vcl::TextLayoutCache const* = nullptr) const; SAL_DLLPRIVATE SalLayout* ImplGlyphFallbackLayout( SalLayout*, ImplLayoutArgs& ) const; // tells whether this output device is RTL in an LTR UI or LTR in a RTL UI SAL_DLLPRIVATE SalLayout* getFallbackFont(ImplFontEntry &rFallbackFont, diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 0bf13ebfaeab..6e0fa91df9fe 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -1559,7 +1559,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) #if defined(MACOSX) || defined(IOS) rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(), - pKernArray, rInf.GetIdx(), 1, bBullet ? SAL_LAYOUT_DRAW_BULLET : 0 ); + pKernArray, rInf.GetIdx(), 1, bBullet ? SalLayoutFlags::DrawBullet : 0 ); #else rInf.GetOut().DrawTextArray( aTextOriginPos, rInf.GetText(), pKernArray, rInf.GetIdx(), 1 ); @@ -1749,7 +1749,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) #if defined(MACOSX) || defined(IOS) rInf.GetOut().DrawTextArray( aTextOriginPos, *pStr, pKernArray + nOffs, - rInf.GetIdx() + nOffs , nLen - nOffs, bBullet ? SAL_LAYOUT_DRAW_BULLET : 0 ); + rInf.GetIdx() + nOffs , nLen - nOffs, bBullet ? SalLayoutFlags::DrawBullet : 0 ); #else // If we paint bullets instead of spaces, we use a copy of // the paragraph string. For the layout engine, the copy diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx index 4a17997b6de2..bc65eafc8c89 100644 --- a/vcl/generic/glyphs/gcach_layout.cxx +++ b/vcl/generic/glyphs/gcach_layout.cxx @@ -56,13 +56,13 @@ void ServerFontLayout::AdjustLayout( ImplLayoutArgs& rArgs ) GenericSalLayout::AdjustLayout( rArgs ); // apply asian kerning if the glyphs are not already formatted - if( (rArgs.mnFlags & SAL_LAYOUT_KERNING_ASIAN) - && !(rArgs.mnFlags & SAL_LAYOUT_VERTICAL) ) + if( (rArgs.mnFlags & SalLayoutFlags::KerningAsian) + && !(rArgs.mnFlags & SalLayoutFlags::Vertical) ) if( (rArgs.mpDXArray != NULL) || (rArgs.mnLayoutWidth != 0) ) ApplyAsianKerning( rArgs.mpStr, rArgs.mnLength ); // insert kashidas where requested by the formatting array - if( (rArgs.mnFlags & SAL_LAYOUT_KASHIDA_JUSTIFICATON) && rArgs.mpDXArray ) + if( (rArgs.mnFlags & SalLayoutFlags::KashidaJustification) && rArgs.mpDXArray ) { int nKashidaIndex = mrServerFont.GetGlyphIndex( 0x0640 ); if( nKashidaIndex != 0 ) @@ -492,7 +492,7 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs) if (!nGlyphIndex) { rLayout.SetNeedFallback(rArgs, nCharPos, bRightToLeft); - if (SAL_LAYOUT_FOR_FALLBACK & rArgs.mnFlags) + if (SalLayoutFlags::ForFallback & rArgs.mnFlags) continue; } @@ -580,7 +580,7 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs) // determine need for kashida justification if((rArgs.mpDXArray || rArgs.mnLayoutWidth) && ((maHbScript == HB_SCRIPT_ARABIC) || (maHbScript == HB_SCRIPT_SYRIAC))) - rArgs.mnFlags |= SAL_LAYOUT_KASHIDA_JUSTIFICATON; + rArgs.mnFlags |= SalLayoutFlags::KashidaJustification; return true; } diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx index d121ba6ca2eb..beedfaa40dee 100644 --- a/vcl/generic/print/genpspgraphics.cxx +++ b/vcl/generic/print/genpspgraphics.cxx @@ -282,7 +282,7 @@ void GenPspGraphics::Init(psp::JobData* pJob, psp::PrinterGfx* pGfx, m_pJobData = pJob; m_pPrinterGfx = pGfx; m_pInfoPrinter = pInfoPrinter; - SetLayout( 0 ); + SetLayout( SalLayoutFlags::NONE ); } GenPspGraphics::~GenPspGraphics() @@ -613,7 +613,7 @@ PspFontLayout::PspFontLayout( ::psp::PrinterGfx& rGfx ) bool PspFontLayout::LayoutText( ImplLayoutArgs& rArgs ) { - mbVertical = ((rArgs.mnFlags & SAL_LAYOUT_VERTICAL) != 0); + mbVertical = bool(rArgs.mnFlags & SalLayoutFlags::Vertical); long nUnitsPerPixel = 1; sal_GlyphId aOldGlyphId( GF_DROPPED); @@ -960,14 +960,14 @@ SalLayout* GenPspGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe // workaround for printers not handling glyph indexing for non-TT fonts int nFontId = m_pPrinterGfx->GetFontID(); if( psp::fonttype::TrueType != psp::PrintFontManager::get().getFontType( nFontId ) ) - rArgs.mnFlags |= SAL_LAYOUT_DISABLE_GLYPH_PROCESSING; + rArgs.mnFlags |= SalLayoutFlags::DisableGlyphProcessing; else if( nFallbackLevel > 0 ) - rArgs.mnFlags &= ~SAL_LAYOUT_DISABLE_GLYPH_PROCESSING; + rArgs.mnFlags &= ~SalLayoutFlags::DisableGlyphProcessing; GenericSalLayout* pLayout = NULL; if( m_pServerFont[ nFallbackLevel ] - && !(rArgs.mnFlags & SAL_LAYOUT_DISABLE_GLYPH_PROCESSING) ) + && !(rArgs.mnFlags & SalLayoutFlags::DisableGlyphProcessing) ) { #if ENABLE_GRAPHITE // Is this a Graphite font? diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index 827baa0f2514..50e5e5a30646 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -229,9 +229,9 @@ public: virtual bool supportsOperation( OutDevSupportType ) const = 0; - // mirroring specifica - int GetLayout() { return m_nLayout; } - void SetLayout( int aLayout ) { m_nLayout = aLayout;} + // mirroring specifics + SalLayoutFlags GetLayout() { return m_nLayout; } + void SetLayout( SalLayoutFlags aLayout ) { m_nLayout = aLayout;} void mirror( long& nX, const OutputDevice *pOutDev, bool bBack = false ) const; void mirror( long& nX, long& nWidth, const OutputDevice *pOutDev, bool bBack = false ) const; @@ -614,7 +614,7 @@ protected: sal_uInt8 nTransparency ) = 0; private: - int m_nLayout; //< 0: mirroring off, 1: mirror x-axis + SalLayoutFlags m_nLayout; //< 0: mirroring off, 1: mirror x-axis protected: /// flags which hold the SetAntialiasing() value from OutputDevice diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index 0e38ad16485b..9e82f39ece7c 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -41,7 +41,7 @@ typedef unsigned short LanguageType; class SalGraphics; class PhysicalFontFace; - +enum class SalLayoutFlags; namespace vcl { class TextLayoutCache; } @@ -74,7 +74,7 @@ class ImplLayoutArgs public: // string related inputs LanguageTag maLanguageTag; - int mnFlags; + SalLayoutFlags mnFlags; int mnLength; int mnMinCharPos; int mnEndCharPos; @@ -94,7 +94,7 @@ public: public: ImplLayoutArgs( const sal_Unicode* pStr, int nLength, - int nMinCharPos, int nEndCharPos, int nFlags, + int nMinCharPos, int nEndCharPos, SalLayoutFlags nFlags, const LanguageTag& rLanguageTag, vcl::TextLayoutCache const* pLayoutCache); @@ -224,7 +224,7 @@ private: protected: int mnMinCharPos; int mnEndCharPos; - int mnLayoutFlags; + SalLayoutFlags mnLayoutFlags; int mnUnitsPerPixel; int mnOrientation; diff --git a/vcl/opengl/x11/salvd.cxx b/vcl/opengl/x11/salvd.cxx index e98329bfea2f..a613ce5f84fc 100644 --- a/vcl/opengl/x11/salvd.cxx +++ b/vcl/opengl/x11/salvd.cxx @@ -54,7 +54,7 @@ X11OpenGLSalVirtualDevice::X11OpenGLSalVirtualDevice( SalGraphics* pGraphics, mnWidth = nDX; mnHeight = nDY; mpGraphics = new X11SalGraphics(); - mpGraphics->SetLayout( 0 ); + mpGraphics->SetLayout( SalLayoutFlags::NONE ); mpGraphics->Init( this ); } diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx index b9d4f1b99b2c..67733de9c32e 100644 --- a/vcl/quartz/ctlayout.cxx +++ b/vcl/quartz/ctlayout.cxx @@ -217,7 +217,7 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs ) DeviceCoordinate nPixelWidth = 0; - if(rArgs.mpDXArray && !(rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL) ) + if(rArgs.mpDXArray && !(rArgs.mnFlags & SalLayoutFlags::BiDiRtl) ) { nPixelWidth = rArgs.mpDXArray[ mnCharCount - 1 ]; if( nPixelWidth <= 0) @@ -238,7 +238,7 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs ) { nPixelWidth = rArgs.mnLayoutWidth; - if( nPixelWidth <= 0 && rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL) + if( nPixelWidth <= 0 && rArgs.mnFlags & SalLayoutFlags::BiDiRtl) { nPixelWidth = GetTextWidth(); } @@ -278,7 +278,7 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs ) // in RTL-layouts trailing spaces are leftmost // TODO: use BiDi-algorithm to thoroughly check this assumption - if( rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL) + if( rArgs.mnFlags & SalLayoutFlags::BiDiRtl) { mfBaseAdv = mfTrailingSpaceWidth; } @@ -316,7 +316,7 @@ CGPoint CTLayout::GetTextDrawPosition() const { CGFloat fPosX, fPosY; - if (mnLayoutFlags & SAL_LAYOUT_RIGHT_ALIGN) + if (mnLayoutFlags & SalLayoutFlags::RightAlign) { // text is always drawn at its leftmost point const Point aPos = DrawBase(); @@ -425,7 +425,7 @@ void CTLayout::drawCTLine(AquaSalGraphics& rAquaGraphics, CTLineRef ctline, cons * Otherwise we just use CoreText to display the whole line */ - if(!(mnLayoutFlags & SAL_LAYOUT_VERTICAL)) + if(!(mnLayoutFlags & SalLayoutFlags::Vertical)) { boost::ptr_vector::const_iterator iter = m_vRunData.begin(); if(iter != m_vRunData.end()) @@ -448,7 +448,7 @@ void CTLayout::drawCTLine(AquaSalGraphics& rAquaGraphics, CTLineRef ctline, cons CGContextSetFont(context, cgFont); CGContextSetFontSize(context, CTFontGetSize(runFont)); CGContextSetFillColor( context, rAquaGraphics.maTextColor.AsArray() ); - if(mnLayoutFlags & SAL_LAYOUT_VERTICAL) + if(mnLayoutFlags & SalLayoutFlags::Vertical) { CGContextRotateCTM( context, -F_PI/2 ); } @@ -462,7 +462,7 @@ void CTLayout::drawCTLine(AquaSalGraphics& rAquaGraphics, CTLineRef ctline, cons CFRelease(cgFont); } /* Do we want to show 'space' as 'bullet' */ - if(mnLayoutFlags & SAL_LAYOUT_DRAW_BULLET) + if(mnLayoutFlags & SalLayoutFlags::DrawBullet) { for(int i = 0 ; i < iter->m_nGlyphs; i++) { @@ -510,7 +510,7 @@ void CTLayout::drawCTLine(AquaSalGraphics& rAquaGraphics, CTLineRef ctline, cons // draw the text CTLineDraw( ctline, context ); - if(mnLayoutFlags & SAL_LAYOUT_DRAW_BULLET) + if(mnLayoutFlags & SalLayoutFlags::DrawBullet) { CFArrayRef runArray = CTLineGetGlyphRuns(ctline); CFIndex runCount = CFArrayGetCount(runArray); @@ -542,7 +542,7 @@ void CTLayout::drawCTLine(AquaSalGraphics& rAquaGraphics, CTLineRef ctline, cons CTRunGetPositions(run, glyphRange, &position); CTRunGetAdvances(run, glyphRange, &advance); CGRect bulletRect; - if(mnLayoutFlags & SAL_LAYOUT_VERTICAL) + if(mnLayoutFlags & SalLayoutFlags::Vertical) { bulletRect = CGRectMake(position.x - advance.width / 4, -position.y, baseSize / 5, baseSize / 5 ); @@ -558,7 +558,7 @@ void CTLayout::drawCTLine(AquaSalGraphics& rAquaGraphics, CTLineRef ctline, cons RGBAColor bulletColor(MAKE_SALCOLOR(0x26, 0x8b, 0xd2 )); // NON_PRINTING_CHARACTER_COLOR CGContextSetFillColor( context, bulletColor.AsArray() ); CGContextSetStrokeColor(context, bulletColor.AsArray()); - if(mnLayoutFlags & SAL_LAYOUT_VERTICAL) + if(mnLayoutFlags & SalLayoutFlags::Vertical) { CGContextRotateCTM( context, -F_PI/2 ); } diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index e3381ab2722d..f25b95658005 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -65,12 +65,12 @@ SalFrameGeometry SalFrame::GetGeometry() } SalGraphics::SalGraphics() -: m_nLayout( 0 ), +: m_nLayout( SalLayoutFlags::NONE ), m_bAntiAliasB2DDraw(false) { // read global RTL settings if( AllSettings::GetLayoutRTL() ) - m_nLayout = SAL_LAYOUT_BIDI_RTL; + m_nLayout = SalLayoutFlags::BiDiRtl; } SalGraphics::~SalGraphics() @@ -107,7 +107,7 @@ void SalGraphics::mirror( long& x, const OutputDevice *pOutDev, bool bBack ) con { OutputDevice *pOutDevRef = const_cast(pOutDev); // mirror this window back - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) ) { long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX if( bBack ) @@ -124,7 +124,7 @@ void SalGraphics::mirror( long& x, const OutputDevice *pOutDev, bool bBack ) con x = pOutDevRef->GetOutputWidthPixel() - (x - devX) + pOutDevRef->GetOutOffXPixel() - 1; } } - else if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + else if( (m_nLayout & SalLayoutFlags::BiDiRtl) ) x = w-1-x; } } @@ -139,7 +139,7 @@ void SalGraphics::mirror( long& x, long& nWidth, const OutputDevice *pOutDev, bo { OutputDevice *pOutDevRef = const_cast(pOutDev); // mirror this window back - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) ) { long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX if( bBack ) @@ -156,7 +156,7 @@ void SalGraphics::mirror( long& x, long& nWidth, const OutputDevice *pOutDev, bo x = pOutDevRef->GetOutputWidthPixel() - (x - devX) + pOutDevRef->GetOutOffXPixel() - nWidth; } } - else if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + else if( (m_nLayout & SalLayoutFlags::BiDiRtl) ) x = w-nWidth-x; } @@ -174,7 +174,7 @@ bool SalGraphics::mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint * { OutputDevice *pOutDevRef = const_cast(pOutDev); // mirror this window back - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) ) { long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX if( bBack ) @@ -223,7 +223,7 @@ bool SalGraphics::mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint * } } } - else if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + else if( (m_nLayout & SalLayoutFlags::BiDiRtl) ) { for( i=0, j=nPoints-1; iIsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { vcl::Region aMirror( i_rClip ); mirror( aMirror, pOutDev ); @@ -368,21 +368,21 @@ bool SalGraphics::SetClipRegion( const vcl::Region& i_rClip, const OutputDevice void SalGraphics::DrawPixel( long nX, long nY, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, pOutDev ); drawPixel( nX, nY ); } void SalGraphics::DrawPixel( long nX, long nY, SalColor nSalColor, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, pOutDev ); drawPixel( nX, nY, nSalColor ); } void SalGraphics::DrawLine( long nX1, long nY1, long nX2, long nY2, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { mirror( nX1, pOutDev ); mirror( nX2, pOutDev ); @@ -392,14 +392,14 @@ void SalGraphics::DrawLine( long nX1, long nY1, long nX2, long nY2, const Output void SalGraphics::DrawRect( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); drawRect( nX, nY, nWidth, nHeight ); } void SalGraphics::DrawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { boost::scoped_array pPtAry2(new SalPoint[nPoints]); bool bCopied = mirror( nPoints, pPtAry, pPtAry2.get(), pOutDev ); @@ -411,7 +411,7 @@ void SalGraphics::DrawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry, cons void SalGraphics::DrawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { boost::scoped_array pPtAry2(new SalPoint[nPoints]); bool bCopied = mirror( nPoints, pPtAry, pPtAry2.get(), pOutDev ); @@ -423,7 +423,7 @@ void SalGraphics::DrawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry, const void SalGraphics::DrawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { // TODO: optimize, reduce new/delete calls SalPoint **pPtAry2 = new SalPoint*[nPoly]; @@ -448,7 +448,7 @@ void SalGraphics::DrawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, bool SalGraphics::DrawPolyPolygon( const basegfx::B2DPolyPolygon& i_rPolyPolygon, double i_fTransparency, const OutputDevice* i_pOutDev ) { bool bRet = false; - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) ) { basegfx::B2DPolyPolygon aMirror( mirror( i_rPolyPolygon, i_pOutDev ) ); bRet = drawPolyPolygon( aMirror, i_fTransparency ); @@ -461,7 +461,7 @@ bool SalGraphics::DrawPolyPolygon( const basegfx::B2DPolyPolygon& i_rPolyPolygon bool SalGraphics::DrawPolyLineBezier( sal_uInt32 nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry, const OutputDevice* pOutDev ) { bool bResult = false; - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { boost::scoped_array pPtAry2(new SalPoint[nPoints]); bool bCopied = mirror( nPoints, pPtAry, pPtAry2.get(), pOutDev ); @@ -475,7 +475,7 @@ bool SalGraphics::DrawPolyLineBezier( sal_uInt32 nPoints, const SalPoint* pPtAry bool SalGraphics::DrawPolygonBezier( sal_uInt32 nPoints, const SalPoint* pPtAry, const sal_uInt8* pFlgAry, const OutputDevice* pOutDev ) { bool bResult = false; - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { boost::scoped_array pPtAry2(new SalPoint[nPoints]); bool bCopied = mirror( nPoints, pPtAry, pPtAry2.get(), pOutDev ); @@ -490,7 +490,7 @@ bool SalGraphics::DrawPolyPolygonBezier( sal_uInt32 i_nPoly, const sal_uInt32* i const SalPoint* const* i_pPtAry, const sal_uInt8* const* i_pFlgAry, const OutputDevice* i_pOutDev ) { bool bRet = false; - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) ) { // TODO: optimize, reduce new/delete calls SalPoint **pPtAry2 = new SalPoint*[i_nPoly]; @@ -521,7 +521,7 @@ bool SalGraphics::DrawPolyLine( const basegfx::B2DPolygon& i_rPolygon, const OutputDevice* i_pOutDev ) { bool bRet = false; - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (i_pOutDev && i_pOutDev->IsRTLEnabled()) ) { basegfx::B2DPolygon aMirror( mirror( i_rPolygon, i_pOutDev ) ); bRet = drawPolyLine( aMirror, i_fTransparency, i_rLineWidth, i_eLineJoin, i_eLineCap ); @@ -541,7 +541,7 @@ void SalGraphics::CopyArea( long nDestX, long nDestY, long nSrcWidth, long nSrcHeight, sal_uInt16 nFlags, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { mirror( nDestX, nSrcWidth, pOutDev ); mirror( nSrcX, nSrcWidth, pOutDev ); @@ -552,13 +552,13 @@ void SalGraphics::CopyArea( long nDestX, long nDestY, void SalGraphics::CopyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics, const OutputDevice *pOutDev, const OutputDevice *pSrcOutDev ) { - if( ( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) || - (pSrcGraphics && ( (pSrcGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) || (pSrcOutDev && pSrcOutDev->IsRTLEnabled()) ) ) ) + if( ( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) || + (pSrcGraphics && ( (pSrcGraphics->GetLayout() & SalLayoutFlags::BiDiRtl) || (pSrcOutDev && pSrcOutDev->IsRTLEnabled()) ) ) ) { SalTwoRect aPosAry2 = rPosAry; - if( (pSrcGraphics && (pSrcGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL)) || (pSrcOutDev && pSrcOutDev->IsRTLEnabled()) ) + if( (pSrcGraphics && (pSrcGraphics->GetLayout() & SalLayoutFlags::BiDiRtl)) || (pSrcOutDev && pSrcOutDev->IsRTLEnabled()) ) mirror( aPosAry2.mnSrcX, aPosAry2.mnSrcWidth, pSrcOutDev ); - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( aPosAry2.mnDestX, aPosAry2.mnDestWidth, pOutDev ); copyBits( aPosAry2, pSrcGraphics ); } @@ -569,7 +569,7 @@ void SalGraphics::CopyBits( const SalTwoRect& rPosAry, void SalGraphics::DrawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect aPosAry2 = rPosAry; mirror( aPosAry2.mnDestX, aPosAry2.mnDestWidth, pOutDev ); @@ -583,7 +583,7 @@ void SalGraphics::DrawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, const SalBitmap& rTransparentBitmap, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect aPosAry2 = rPosAry; mirror( aPosAry2.mnDestX, aPosAry2.mnDestWidth, pOutDev ); @@ -597,7 +597,7 @@ void SalGraphics::DrawMask( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap, SalColor nMaskColor, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect aPosAry2 = rPosAry; mirror( aPosAry2.mnDestX, aPosAry2.mnDestWidth, pOutDev ); @@ -609,28 +609,28 @@ void SalGraphics::DrawMask( const SalTwoRect& rPosAry, SalBitmap* SalGraphics::GetBitmap( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); return getBitmap( nX, nY, nWidth, nHeight ); } SalColor SalGraphics::GetPixel( long nX, long nY, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, pOutDev ); return getPixel( nX, nY ); } void SalGraphics::Invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); invert( nX, nY, nWidth, nHeight, nFlags ); } void SalGraphics::Invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { boost::scoped_array pPtAry2(new SalPoint[nPoints]); bool bCopied = mirror( nPoints, pPtAry, pPtAry2.get(), pOutDev ); @@ -642,7 +642,7 @@ void SalGraphics::Invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert bool SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); return drawEPS( nX, nY, nWidth, nHeight, pPtr, nSize ); } @@ -650,7 +650,7 @@ bool SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void* pP bool SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, const Point& aPos, bool& rIsInside, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { Point pt( aPos ); Rectangle rgn( rControlRegion ); @@ -701,7 +701,7 @@ bool SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const ControlState nState, const ImplControlValue& aValue, const OUString& aCaption, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { Rectangle rgn( rControlRegion ); mirror( rgn, pOutDev ); @@ -718,7 +718,7 @@ bool SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, const ImplControlValue& aValue, const OUString& aCaption, Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { Rectangle rgn( rControlRegion ); mirror( rgn, pOutDev ); @@ -742,7 +742,7 @@ bool SalGraphics::BlendBitmap( const SalTwoRect& rPosAry, const SalBitmap& rBitmap, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect aPosAry2 = rPosAry; mirror( aPosAry2.mnDestX, aPosAry2.mnDestWidth, pOutDev ); @@ -758,7 +758,7 @@ bool SalGraphics::BlendAlphaBitmap( const SalTwoRect& rPosAry, const SalBitmap& rAlphaBitmap, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect aPosAry2 = rPosAry; mirror( aPosAry2.mnDestX, aPosAry2.mnDestWidth, pOutDev ); @@ -773,7 +773,7 @@ bool SalGraphics::DrawAlphaBitmap( const SalTwoRect& rPosAry, const SalBitmap& rAlphaBitmap, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect aPosAry2 = rPosAry; mirror( aPosAry2.mnDestX, aPosAry2.mnDestWidth, pOutDev ); @@ -791,7 +791,7 @@ bool SalGraphics::DrawTransformedBitmap( const SalBitmap* pAlphaBitmap, const OutputDevice* pOutDev) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) { basegfx::B2DPoint aNull(rNull); basegfx::B2DPoint aX(rX); @@ -812,7 +812,7 @@ bool SalGraphics::DrawTransformedBitmap( bool SalGraphics::DrawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) + if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); return drawAlphaRect( nX, nY, nWidth, nHeight, nTransparency ); diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index de37876d7770..cdf7cb88f7a6 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -81,24 +81,24 @@ std::ostream &operator <<(std::ostream& s, ImplLayoutArgs &rArgs) s << "ImplLayoutArgs{"; s << "Flags="; - if (rArgs.mnFlags == 0) + if (rArgs.mnFlags == SalLayoutFlags::NONE) s << 0; else { bool need_or = false; s << "{"; -#define TEST(x) if (rArgs.mnFlags & SAL_LAYOUT_##x) { if (need_or) s << "|"; s << #x; need_or = true; } - TEST(BIDI_RTL); - TEST(BIDI_STRONG); - TEST(RIGHT_ALIGN); - TEST(KERNING_PAIRS); - TEST(KERNING_ASIAN); - TEST(VERTICAL); - TEST(COMPLEX_DISABLED); - TEST(ENABLE_LIGATURES); - TEST(SUBSTITUTE_DIGITS); - TEST(KASHIDA_JUSTIFICATON); - TEST(DISABLE_GLYPH_PROCESSING); - TEST(FOR_FALLBACK); +#define TEST(x) if (rArgs.mnFlags & SalLayoutFlags::x) { if (need_or) s << "|"; s << #x; need_or = true; } + TEST(BiDiRtl); + TEST(BiDiStrong); + TEST(RightAlign); + TEST(KerningPairs); + TEST(KerningAsian); + TEST(Vertical); + TEST(ComplexDisabled); + TEST(EnableLigatures); + TEST(SubstituteDigits); + TEST(KashidaJustification); + TEST(DisableGlyphProcessing); + TEST(ForFallback); #undef TEST s << "}"; } @@ -486,7 +486,7 @@ bool ImplLayoutRuns::GetRun( int* nMinRunPos, int* nEndRunPos, bool* bRightToLef } ImplLayoutArgs::ImplLayoutArgs( const sal_Unicode* pStr, int nLen, - int nMinCharPos, int nEndCharPos, int nFlags, const LanguageTag& rLanguageTag, + int nMinCharPos, int nEndCharPos, SalLayoutFlags nFlags, const LanguageTag& rLanguageTag, vcl::TextLayoutCache const*const pLayoutCache) : maLanguageTag( rLanguageTag ), @@ -500,14 +500,14 @@ ImplLayoutArgs::ImplLayoutArgs( const sal_Unicode* pStr, int nLen, mnLayoutWidth( 0 ), mnOrientation( 0 ) { - if( mnFlags & SAL_LAYOUT_BIDI_STRONG ) + if( mnFlags & SalLayoutFlags::BiDiStrong ) { // handle strong BiDi mode // do not bother to BiDi analyze strong LTR/RTL // TODO: can we assume these strings do not have unicode control chars? // if not remove the control characters from the runs - bool bRTL = ((mnFlags & SAL_LAYOUT_BIDI_RTL) != 0); + bool bRTL(mnFlags & SalLayoutFlags::BiDiRtl); AddRun( mnMinCharPos, mnEndCharPos, bRTL ); } else @@ -515,7 +515,7 @@ ImplLayoutArgs::ImplLayoutArgs( const sal_Unicode* pStr, int nLen, // handle weak BiDi mode UBiDiLevel nLevel = UBIDI_DEFAULT_LTR; - if( mnFlags & SAL_LAYOUT_BIDI_RTL ) + if( mnFlags & SalLayoutFlags::BiDiRtl ) nLevel = UBIDI_DEFAULT_RTL; // prepare substring for BiDi analysis @@ -646,7 +646,7 @@ bool ImplLayoutArgs::GetNextRun( int* nMinRunPos, int* nEndRunPos, bool* bRTL ) SalLayout::SalLayout() : mnMinCharPos( -1 ), mnEndCharPos( -1 ), - mnLayoutFlags( 0 ), + mnLayoutFlags( SalLayoutFlags::NONE ), mnUnitsPerPixel( 1 ), mnOrientation( 0 ), mnRefCount( 1 ), @@ -1036,7 +1036,7 @@ void GenericSalLayout::ApplyDXArray( ImplLayoutArgs& rArgs ) size_t i; int n,p; long nBasePointX = -1; - if( mnLayoutFlags & SAL_LAYOUT_FOR_FALLBACK ) + if( mnLayoutFlags & SalLayoutFlags::ForFallback ) nBasePointX = 0; for(p = 0; p < nCharCount; ++p ) pLogCluster[ p ] = -1; @@ -1670,7 +1670,7 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs ) if( n > 0 ) { aMultiArgs.maRuns = maFallbackRuns[ n-1 ]; - aMultiArgs.mnFlags |= SAL_LAYOUT_FOR_FALLBACK; + aMultiArgs.mnFlags |= SalLayoutFlags::ForFallback; } mpLayouts[n]->AdjustLayout( aMultiArgs ); diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index e6c3fe1fe8fc..a31dc22edae7 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -434,7 +434,7 @@ void VirtualDevice::EnableRTL( bool bEnable ) // because each virdev has its own SalGraphics we can safely switch the SalGraphics here // ...hopefully if( AcquireGraphics() ) - mpGraphics->SetLayout( bEnable ? SAL_LAYOUT_BIDI_RTL : 0 ); + mpGraphics->SetLayout( bEnable ? SalLayoutFlags::BiDiRtl : SalLayoutFlags::NONE ); OutputDevice::EnableRTL(bEnable); } diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx index 37ac060fac03..474756f9ae0b 100644 --- a/vcl/source/glyphs/graphite_layout.cxx +++ b/vcl/source/glyphs/graphite_layout.cxx @@ -171,7 +171,7 @@ static void findFirstClusterSlot(const gr_slot* base, gr_slot const** first, gr_ void GraphiteLayout::fillFrom(gr_segment * pSegment, ImplLayoutArgs &rArgs, float fScaling) { - bool bRtl = (rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL); + bool bRtl(rArgs.mnFlags & SalLayoutFlags::BiDiRtl); int nCharRequested = rArgs.mnEndCharPos - rArgs.mnMinCharPos; int nChar = gr_seg_n_cinfo(pSegment); float fMinX = gr_seg_advance_X(pSegment); @@ -391,7 +391,7 @@ GraphiteLayout::append(gr_segment *pSeg, ImplLayoutArgs &rArgs, const gr_slot * gi, float gOrigin, float nextGlyphOrigin, float scaling, long & rDXOffset, bool bIsBase, int baseChar) { - bool bRtl = (rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL); + bool bRtl(rArgs.mnFlags & SalLayoutFlags::BiDiRtl); float nextOrigin; assert(gi); assert(gr_slot_before(gi) <= gr_slot_after(gi)); @@ -424,14 +424,14 @@ GraphiteLayout::append(gr_segment *pSeg, ImplLayoutArgs &rArgs, if (glyphId == 0) { rArgs.NeedFallback(firstChar, bRtl); - if( (SAL_LAYOUT_FOR_FALLBACK & rArgs.mnFlags )) + if( (SalLayoutFlags::ForFallback & rArgs.mnFlags )) { glyphId = GF_DROPPED; deltaOffset -= glyphWidth; glyphWidth = 0; } } - else if(rArgs.mnFlags & SAL_LAYOUT_FOR_FALLBACK) + else if(rArgs.mnFlags & SalLayoutFlags::ForFallback) { #ifdef GRLAYOUT_DEBUG fprintf(grLog(),"fallback c%d %x in run %d\n", firstChar, rArgs.mpStr[firstChar], @@ -544,7 +544,7 @@ gr_segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs) // Clear out any previous buffers clear(); - bool bRtl = mnLayoutFlags & SAL_LAYOUT_BIDI_RTL; + bool bRtl(mnLayoutFlags & SalLayoutFlags::BiDiRtl); try { // Don't set RTL if font doesn't support it otherwise it forces rtl on @@ -559,7 +559,7 @@ gr_segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs) // a hyphenation point, so disable if CTL is disabled. mnSegCharOffset = rArgs.mnMinCharPos; int limit = rArgs.mnEndCharPos; - if (!(SAL_LAYOUT_COMPLEX_DISABLED & rArgs.mnFlags)) + if (!(SalLayoutFlags::ComplexDisabled & rArgs.mnFlags)) { int nSegCharMin = maximum(0, mnMinCharPos - EXTRA_CONTEXT_LENGTH); int nSegCharLimit = minimum(rArgs.mnLength, mnEndCharPos + EXTRA_CONTEXT_LENGTH); @@ -643,7 +643,7 @@ bool GraphiteLayout::LayoutGlyphs(ImplLayoutArgs& rArgs, gr_segment * pSegment) // Discover all the clusters. try { - bool bRtl = mnLayoutFlags & SAL_LAYOUT_BIDI_RTL; + bool bRtl(mnLayoutFlags & SalLayoutFlags::BiDiRtl); fillFrom(pSegment, rArgs, mfScaling); if (bRtl) @@ -777,8 +777,8 @@ void GraphiteLayout::AdjustLayout(ImplLayoutArgs& rArgs) std::vector vDeltaWidths(mvGlyphs.size(), 0); ApplyDXArray(rArgs, vDeltaWidths); - if( (mnLayoutFlags & SAL_LAYOUT_BIDI_RTL) && - !(rArgs.mnFlags & SAL_LAYOUT_FOR_FALLBACK) ) + if( (mnLayoutFlags & SalLayoutFlags::BiDiRtl) && + !(rArgs.mnFlags & SalLayoutFlags::ForFallback) ) { // check if this is a kashida script bool bKashidaScript = false; @@ -895,7 +895,7 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector & rDelt fprintf(grLog(),"%d,%d,%ld ", (int)iDx, (int)mvCharDxs[iDx], args.mpDXArray[iDx]); fprintf(grLog(),"ApplyDx\n"); #endif - bool bRtl = mnLayoutFlags & SAL_LAYOUT_BIDI_RTL; + bool bRtl(mnLayoutFlags & SalLayoutFlags::BiDiRtl); int nXOffset = 0; if (bRtl) { @@ -1097,7 +1097,7 @@ void GraphiteLayout::GetCaretPositions( int nArraySize, long* pCaretXArray ) con std::fill(pCaretXArray, pCaretXArray + nArraySize, -1); // the layout method doesn't modify the layout even though it isn't // const in the interface - bool bRtl = (mnLayoutFlags & SAL_LAYOUT_BIDI_RTL);//const_cast(this)->maLayout.rightToLeft(); + bool bRtl(mnLayoutFlags & SalLayoutFlags::BiDiRtl);//const_cast(this)->maLayout.rightToLeft(); int prevBase = -1; long prevClusterWidth = 0; for (int i = 0, nCharSlot = 0; i < nArraySize && nCharSlot < static_cast(mvCharDxs.size()); ++nCharSlot, i+=2) diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index eefa320c8434..3e7f00917d51 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -2072,7 +2072,7 @@ SalLayout* OutputDevice::ImplGlyphFallbackLayout( SalLayout* pSalLayout, ImplLay MultiSalLayout* pMultiSalLayout = NULL; ImplLayoutRuns aLayoutRuns = rLayoutArgs.maRuns; rLayoutArgs.PrepareFallback(); - rLayoutArgs.mnFlags |= SAL_LAYOUT_FOR_FALLBACK; + rLayoutArgs.mnFlags |= SalLayoutFlags::ForFallback; // get list of unicodes that need glyph fallback int nCharPos = -1; diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index e9e622867c14..85ab4a2528f0 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -723,7 +723,7 @@ void OutputDevice::drawOutDevDirect( const OutputDevice* pSrcDev, SalTwoRect& rP // mirroring may be required // because only windows have a SalGraphicsLayout // mirroring is performed here - if( (GetOutDevType() != OUTDEV_WINDOW) && pSrcGraphics && (pSrcGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) ) + if( (GetOutDevType() != OUTDEV_WINDOW) && pSrcGraphics && (pSrcGraphics->GetLayout() & SalLayoutFlags::BiDiRtl) ) { SalTwoRect aPosAry2 = rPosAry; pSrcGraphics->mirror( aPosAry2.mnSrcX, aPosAry2.mnSrcWidth, pSrcDev ); @@ -749,8 +749,8 @@ bool OutputDevice::ImplIsAntiparallel() const bool bRet = false; if( AcquireGraphics() ) { - if( ( (mpGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) && ! IsRTLEnabled() ) || - ( ! (mpGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) && IsRTLEnabled() ) ) + if( ( (mpGraphics->GetLayout() & SalLayoutFlags::BiDiRtl) && ! IsRTLEnabled() ) || + ( ! (mpGraphics->GetLayout() & SalLayoutFlags::BiDiRtl) && IsRTLEnabled() ) ) { bRet = true; } @@ -794,7 +794,7 @@ void OutputDevice::ReMirror( vcl::Region &rRegion ) const bool OutputDevice::HasMirroredGraphics() const { - return ( AcquireGraphics() && (mpGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) ); + return ( AcquireGraphics() && (mpGraphics->GetLayout() & SalLayoutFlags::BiDiRtl) ); } bool OutputDevice::ImplIsRecordLayout() const diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index b142dd2dc30b..832cdbc4d0a5 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -959,7 +959,7 @@ float OutputDevice::approximate_char_width() const void OutputDevice::DrawTextArray( const Point& rStartPt, const OUString& rStr, const long* pDXAry, - sal_Int32 nIndex, sal_Int32 nLen, int flags ) + sal_Int32 nIndex, sal_Int32 nLen, SalLayoutFlags flags ) { if(nLen == 0x0FFFF) { @@ -1012,7 +1012,7 @@ long OutputDevice::GetTextArray( const OUString& rStr, long* pDXAry, } // do layout SalLayout *const pSalLayout = ImplLayout(rStr, nIndex, nLen, - Point(0,0), 0, nullptr, 0, pLayoutCache); + Point(0,0), 0, nullptr, SalLayoutFlags::NONE, pLayoutCache); if( !pSalLayout ) return 0; #if VCL_FLOAT_DEVICE_PIXEL @@ -1194,7 +1194,7 @@ void OutputDevice::DrawStretchText( const Point& rStartPt, sal_uLong nWidth, ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( OUString& rStr, const sal_Int32 nMinIndex, const sal_Int32 nLen, DeviceCoordinate nPixelWidth, const DeviceCoordinate* pDXArray, - int nLayoutFlags, + SalLayoutFlags nLayoutFlags, vcl::TextLayoutCache const*const pLayoutCache) const { assert(nMinIndex >= 0); @@ -1210,9 +1210,9 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( OUString& rStr, nEndIndex = nMinIndex; if( mnTextLayoutMode & TEXT_LAYOUT_BIDI_RTL ) - nLayoutFlags |= SAL_LAYOUT_BIDI_RTL; + nLayoutFlags |= SalLayoutFlags::BiDiRtl; if( mnTextLayoutMode & TEXT_LAYOUT_BIDI_STRONG ) - nLayoutFlags |= SAL_LAYOUT_BIDI_STRONG; + nLayoutFlags |= SalLayoutFlags::BiDiStrong; else if( !(mnTextLayoutMode & TEXT_LAYOUT_BIDI_RTL) ) { // disable Bidi if no RTL hint and no RTL codes used @@ -1224,20 +1224,20 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( OUString& rStr, || ((*pStr >= 0xFE70) && (*pStr < 0xFEFF)) ) // arabic presentation forms B break; if( pStr >= pEnd ) - nLayoutFlags |= SAL_LAYOUT_BIDI_STRONG; + nLayoutFlags |= SalLayoutFlags::BiDiStrong; } if( mbKerning ) - nLayoutFlags |= SAL_LAYOUT_KERNING_PAIRS; + nLayoutFlags |= SalLayoutFlags::KerningPairs; if( maFont.GetKerning() & FontKerning::Asian ) - nLayoutFlags |= SAL_LAYOUT_KERNING_ASIAN; + nLayoutFlags |= SalLayoutFlags::KerningAsian; if( maFont.IsVertical() ) - nLayoutFlags |= SAL_LAYOUT_VERTICAL; + nLayoutFlags |= SalLayoutFlags::Vertical; if( mnTextLayoutMode & TEXT_LAYOUT_ENABLE_LIGATURES ) - nLayoutFlags |= SAL_LAYOUT_ENABLE_LIGATURES; + nLayoutFlags |= SalLayoutFlags::EnableLigatures; else if( mnTextLayoutMode & TEXT_LAYOUT_COMPLEX_DISABLED ) - nLayoutFlags |= SAL_LAYOUT_COMPLEX_DISABLED; + nLayoutFlags |= SalLayoutFlags::ComplexDisabled; else { // disable CTL for non-CTL text @@ -1255,7 +1255,7 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( OUString& rStr, ) break; if( pStr >= pEnd ) - nLayoutFlags |= SAL_LAYOUT_COMPLEX_DISABLED; + nLayoutFlags |= SalLayoutFlags::ComplexDisabled; } if( meTextLanguage ) //TODO: (mnTextLayoutMode & TEXT_LAYOUT_SUBSTITUTE_DIGITS) @@ -1291,7 +1291,7 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( OUString& rStr, bool bRTLWindow = IsRTLEnabled(); bRightAlign ^= bRTLWindow; if( bRightAlign ) - nLayoutFlags |= SAL_LAYOUT_RIGHT_ALIGN; + nLayoutFlags |= SalLayoutFlags::RightAlign; // set layout options ImplLayoutArgs aLayoutArgs( rStr.getStr(), rStr.getLength(), nMinIndex, nEndIndex, nLayoutFlags, maFont.GetLanguageTag(), pLayoutCache ); @@ -1308,7 +1308,7 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( OUString& rStr, SalLayout* OutputDevice::ImplLayout(const OUString& rOrigStr, sal_Int32 nMinIndex, sal_Int32 nLen, const Point& rLogicalPos, long nLogicalWidth, - const long* pDXArray, int flags, + const long* pDXArray, SalLayoutFlags flags, vcl::TextLayoutCache const* pLayoutCache) const { // we need a graphics @@ -1399,7 +1399,7 @@ SalLayout* OutputDevice::ImplLayout(const OUString& rOrigStr, pSalLayout->AdjustLayout( aLayoutArgs ); pSalLayout->DrawBase() = ImplLogicToDevicePixel( rLogicalPos ); // adjust to right alignment if necessary - if( aLayoutArgs.mnFlags & SAL_LAYOUT_RIGHT_ALIGN ) + if( aLayoutArgs.mnFlags & SalLayoutFlags::RightAlign ) { DeviceCoordinate nRTLOffset; if( pDXPixelArray ) @@ -1421,7 +1421,7 @@ std::shared_ptr OutputDevice::CreateTextLayoutCache( return nullptr; OUString copyBecausePrepareModifiesIt(rString); ImplLayoutArgs aLayoutArgs = ImplPrepareLayoutArgs(copyBecausePrepareModifiesIt, - 0, rString.getLength(), 0, nullptr, 0, nullptr); + 0, rString.getLength(), 0, nullptr, SalLayoutFlags::NONE, nullptr); SalLayout *const pSalLayout = mpGraphics->GetTextLayout( aLayoutArgs, 0 ); if (!pSalLayout) @@ -1449,7 +1449,7 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, long nTextWidth, vcl::TextLayoutCache const*const pLayoutCache) const { SalLayout *const pSalLayout = ImplLayout( rStr, nIndex, nLen, - Point(0,0), 0, nullptr, 0, pLayoutCache); + Point(0,0), 0, nullptr, SalLayoutFlags::NONE, pLayoutCache); sal_Int32 nRetVal = -1; if( pSalLayout ) { @@ -1484,7 +1484,7 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, long nTextWidth, rHyphenPos = -1; SalLayout *const pSalLayout = ImplLayout( rStr, nIndex, nLen, - Point(0,0), 0, nullptr, 0, pLayoutCache); + Point(0,0), 0, nullptr, SalLayoutFlags::NONE, pLayoutCache); sal_Int32 nRetVal = -1; if( pSalLayout ) { diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index 20fcc1d3b85f..a3248b72a395 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -548,7 +548,7 @@ SalLayout* CairoTextRender::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackL SalLayout* pLayout = NULL; if( mpServerFont[ nFallbackLevel ] - && !(rArgs.mnFlags & SAL_LAYOUT_DISABLE_GLYPH_PROCESSING) ) + && !(rArgs.mnFlags & SalLayoutFlags::DisableGlyphProcessing) ) { #if ENABLE_GRAPHITE // Is this a Graphite font? diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx index 1b9d992e6fe5..f64612bd5197 100644 --- a/vcl/unx/generic/gdi/salvd.cxx +++ b/vcl/unx/generic/gdi/salvd.cxx @@ -150,7 +150,7 @@ X11SalVirtualDevice::X11SalVirtualDevice( SalGraphics* pGraphics, bDeleteColormap = true; } - pGraphics_->SetLayout( 0 ); // by default no! mirroring for VirtualDevices, can be enabled with EnableRTL() + pGraphics_->SetLayout( SalLayoutFlags::NONE ); // by default no! mirroring for VirtualDevices, can be enabled with EnableRTL() pGraphics_->Init( this, pColormap, bDeleteColormap ); } diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx index 78226624ddaa..300d2aaf172e 100644 --- a/vcl/win/source/gdi/salprn.cxx +++ b/vcl/win/source/gdi/salprn.cxx @@ -1046,7 +1046,7 @@ static HDC ImplCreateSalPrnIC( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetup static WinSalGraphics* ImplCreateSalPrnGraphics( HDC hDC ) { WinSalGraphics* pGraphics = new WinSalGraphics(WinSalGraphics::PRINTER, false, 0, /* CHECKME */ NULL); - pGraphics->SetLayout( 0 ); + pGraphics->SetLayout( SalLayoutFlags::NONE ); pGraphics->setHDC(hDC); pGraphics->InitGraphics(); return pGraphics; diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx index 340e1609c2dc..ac01d92e86af 100644 --- a/vcl/win/source/gdi/salvd.cxx +++ b/vcl/win/source/gdi/salvd.cxx @@ -117,7 +117,7 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics, WinSalVirtualDevice* pVDev = new WinSalVirtualDevice; SalData* pSalData = GetSalData(); WinSalGraphics* pVirGraphics = new WinSalGraphics(WinSalGraphics::VIRTUAL_DEVICE, pGraphics->isScreen(), 0, pVDev); - pVirGraphics->SetLayout( 0 ); // by default no! mirroring for VirtualDevices, can be enabled with EnableRTL() + pVirGraphics->SetLayout( SalLayoutFlags::NONE ); // by default no! mirroring for VirtualDevices, can be enabled with EnableRTL() pVirGraphics->setHDC(hDC); if ( pSalData->mhDitherPal && pVirGraphics->isScreen() ) { diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index ad8b31986f7c..4de04377a159 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -264,14 +264,14 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs ) { // prepare layout // TODO: fix case when recyclying old SimpleWinLayout object - mbDisableGlyphs |= ((rArgs.mnFlags & SAL_LAYOUT_DISABLE_GLYPH_PROCESSING) != 0); + mbDisableGlyphs |= ((rArgs.mnFlags & SalLayoutFlags::DisableGlyphProcessing) != 0); mnCharCount = rArgs.mnEndCharPos - rArgs.mnMinCharPos; if( !mbDisableGlyphs ) { // Win32 glyph APIs have serious problems with vertical layout // => workaround is to use the unicode methods then - if( rArgs.mnFlags & SAL_LAYOUT_VERTICAL ) + if( rArgs.mnFlags & SalLayoutFlags::Vertical ) mbDisableGlyphs = true; else // use cached value from font face @@ -279,19 +279,19 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs ) } // TODO: use a cached value for bDisableAsianKern from upper layers - if( rArgs.mnFlags & SAL_LAYOUT_KERNING_ASIAN ) + if( rArgs.mnFlags & SalLayoutFlags::KerningAsian ) { TEXTMETRICA aTextMetricA; if( ::GetTextMetricsA( mhDC, &aTextMetricA ) && !(aTextMetricA.tmPitchAndFamily & TMPF_FIXED_PITCH) && !(aTextMetricA.tmCharSet == 0x86) ) - rArgs.mnFlags &= ~SAL_LAYOUT_KERNING_ASIAN; + rArgs.mnFlags &= ~SalLayoutFlags::KerningAsian; } // layout text int i, j; mnGlyphCount = 0; - bool bVertical = (rArgs.mnFlags & SAL_LAYOUT_VERTICAL) != 0; + bool bVertical = (rArgs.mnFlags & SalLayoutFlags::Vertical) != 0; // count the number of chars to process if no RTL run rArgs.ResetPos(); @@ -357,7 +357,7 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs ) mpOutGlyphs = new WCHAR[ mnGlyphCount ]; mpGlyphAdvances = new int[ mnGlyphCount ]; - if( rArgs.mnFlags & (SAL_LAYOUT_KERNING_PAIRS | SAL_LAYOUT_KERNING_ASIAN) ) + if( rArgs.mnFlags & (SalLayoutFlags::KerningPairs | SalLayoutFlags::KerningAsian) ) mpGlyphOrigAdvs = new int[ mnGlyphCount ]; for( i = 0; i < mnGlyphCount; ++i ) @@ -417,7 +417,7 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs ) rArgs.NeedFallback( nCharPos+1, bRTL ); // replace the current glyph shape with the NotDef glyph shape - if( rArgs.mnFlags & SAL_LAYOUT_FOR_FALLBACK ) + if( rArgs.mnFlags & SalLayoutFlags::ForFallback ) { // when we already are layouting for glyph fallback // then a new unresolved glyph is not interesting @@ -450,7 +450,7 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs ) } // apply kerning if the layout engine has not yet done it - if( rArgs.mnFlags & (SAL_LAYOUT_KERNING_ASIAN|SAL_LAYOUT_KERNING_PAIRS) ) + if( rArgs.mnFlags & (SalLayoutFlags::KerningAsian|SalLayoutFlags::KerningPairs) ) { for( i = 0; i < mnGlyphCount; ++i ) mpGlyphOrigAdvs[i] = mpGlyphAdvances[i]; @@ -461,13 +461,13 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs ) ++nLen; for( i = 1; i < nLen; ++i ) { - if( rArgs.mnFlags & SAL_LAYOUT_KERNING_PAIRS ) + if( rArgs.mnFlags & SalLayoutFlags::KerningPairs ) { int nKernAmount = mrWinFontEntry.GetKerning( pBidiStr[i-1], pBidiStr[i] ); mpGlyphAdvances[ i-1 ] += nKernAmount; mnWidth += nKernAmount; } - else if( rArgs.mnFlags & SAL_LAYOUT_KERNING_ASIAN ) + else if( rArgs.mnFlags & SalLayoutFlags::KerningAsian ) if( ( (0x3000 == (0xFF00 & pBidiStr[i-1])) || (0x2010 == (0xFFF0 & pBidiStr[i-1])) || (0xFF00 == (0xFF00 & pBidiStr[i-1]))) && ( (0x3000 == (0xFF00 & pBidiStr[i])) || (0x2010 == (0xFFF0 & pBidiStr[i])) || (0xFF00 == (0xFF00 & pBidiStr[i])) ) ) @@ -547,7 +547,7 @@ int SimpleWinLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIds, Point& rPo sal_GlyphId aGlyphId = mpOutGlyphs[ nStart ]; if( mbDisableGlyphs ) { - if( mnLayoutFlags & SAL_LAYOUT_VERTICAL ) + if( mnLayoutFlags & SalLayoutFlags::Vertical ) { const sal_UCS4 cChar = static_cast(aGlyphId & GF_IDXMASK); if( mrWinFontData.HasGSUBstitutions( mhDC ) @@ -1044,7 +1044,7 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs ) // => when the whole string is involved there is no extra context typedef std::vector TIntVector; TIntVector aDropChars; - if( rArgs.mnFlags & SAL_LAYOUT_FOR_FALLBACK ) + if( rArgs.mnFlags & SalLayoutFlags::ForFallback ) { // calculate superfluous context char positions aDropChars.push_back( 0 ); @@ -1071,14 +1071,14 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs ) // prepare itemization // TODO: try to avoid itemization since it costs a lot of performance SCRIPT_STATE aScriptState = {0,false,false,false,false,false,false,false,false,0,0}; - aScriptState.uBidiLevel = (0 != (rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL)); - aScriptState.fOverrideDirection = (0 != (rArgs.mnFlags & SAL_LAYOUT_BIDI_STRONG)); - aScriptState.fDigitSubstitute = (0 != (rArgs.mnFlags & SAL_LAYOUT_SUBSTITUTE_DIGITS)); + aScriptState.uBidiLevel = (0 != (rArgs.mnFlags & SalLayoutFlags::BiDiRtl)); + aScriptState.fOverrideDirection = (0 != (rArgs.mnFlags & SalLayoutFlags::BidiStrong)); + aScriptState.fDigitSubstitute = (0 != (rArgs.mnFlags & SalLayoutFlags::SubstituteDigits)); aScriptState.fArabicNumContext = aScriptState.fDigitSubstitute & aScriptState.uBidiLevel; DWORD nLangId = 0; // TODO: get language from font SCRIPT_CONTROL aScriptControl = {nLangId,false,false,false,false,false,false,false,false,0}; aScriptControl.fNeutralOverride = aScriptState.fOverrideDirection; - aScriptControl.fContextDigits = (0 != (rArgs.mnFlags & SAL_LAYOUT_SUBSTITUTE_DIGITS)); + aScriptControl.fContextDigits = (0 != (rArgs.mnFlags & SalLayoutFlags::SubstituteDigits)); #if HAVE_FMERGENEUTRALITEMS aScriptControl.fMergeNeutralItems = true; #endif @@ -1137,10 +1137,10 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs ) } // reorder visual item order if needed - if( rArgs.mnFlags & SAL_LAYOUT_BIDI_STRONG ) + if( rArgs.mnFlags & SalLayoutFlags::BidiStrong ) { // force RTL item ordering if requested - if( rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL ) + if( rArgs.mnFlags & SalLayoutFlags::BiDiRtl ) { VisualItem* pVI0 = &mpVisualItems[ 0 ]; VisualItem* pVI1 = &mpVisualItems[ mnItemCount ]; @@ -1234,7 +1234,7 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs ) } // override bidi analysis if requested - if( rArgs.mnFlags & SAL_LAYOUT_BIDI_STRONG ) + if( rArgs.mnFlags & SalLayoutFlags::BidiStrong ) { // FIXME: is this intended ? rVisualItem.mpScriptItem->a.fRTL = (aScriptState.uBidiLevel & 1); @@ -1265,7 +1265,7 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs ) rVisualItem.IsRTL() ); // don't bother to do a default layout in a fallback level - if( 0 != (rArgs.mnFlags & SAL_LAYOUT_FOR_FALLBACK) ) + if( 0 != (rArgs.mnFlags & SalLayoutFlags::ForFallback) ) continue; // the primitive layout engine is good enough for the default layout @@ -2113,7 +2113,7 @@ void UniscribeLayout::GetCaretPositions( int nMaxIdx, long* pCaretXArray ) const if( rVisualItem.IsEmpty() ) continue; - if (mnLayoutFlags & SAL_LAYOUT_FOR_FALLBACK) + if (mnLayoutFlags & SalLayoutFlags::ForFallback) { nXPos = rVisualItem.mnXOffset; } @@ -2150,7 +2150,7 @@ void UniscribeLayout::GetCaretPositions( int nMaxIdx, long* pCaretXArray ) const } } - if (!(mnLayoutFlags & SAL_LAYOUT_FOR_FALLBACK)) + if (!(mnLayoutFlags & SalLayoutFlags::ForFallback)) { nXPos = 0; // fixup unknown character positions to neighbor @@ -2638,7 +2638,7 @@ void GraphiteWinLayout::AdjustLayout(ImplLayoutArgs& rArgs) WinLayout::AdjustLayout(rArgs); maImpl.DrawBase() = WinLayout::maDrawBase; maImpl.DrawOffset() = WinLayout::maDrawOffset; - if ( (rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL) && rArgs.mpDXArray) + if ( (rArgs.mnFlags & SalLayoutFlags::BiDiRtl) && rArgs.mpDXArray) { mrWinFontEntry.InitKashidaHandling(mhDC); } @@ -2722,7 +2722,7 @@ SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe bool bUseOpenGL = OpenGLHelper::isVCLOpenGLEnabled(); - if( !(rArgs.mnFlags & SAL_LAYOUT_COMPLEX_DISABLED) + if( !(rArgs.mnFlags & SalLayoutFlags::ComplexDisabled) && (bUspInited || InitUSP()) ) // CTL layout engine { #if ENABLE_GRAPHITE @@ -2740,7 +2740,7 @@ SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe } else { - if( (rArgs.mnFlags & SAL_LAYOUT_KERNING_PAIRS) && !rFontInstance.HasKernData() ) + if( (rArgs.mnFlags & SalLayoutFlags::KerningPairs) && !rFontInstance.HasKernData() ) { // TODO: directly cache kerning info in the rFontInstance // TODO: get rid of kerning methods+data in WinSalGraphics object -- cgit