[Libreoffice-commits] core.git: vcl/source

Noel Grandin noel at peralex.com
Thu Oct 9 04:52:03 PDT 2014


 vcl/source/filter/wmf/enhwmf.cxx |    2 +-
 vcl/source/filter/wmf/winmtf.cxx |   10 +++++-----
 vcl/source/filter/wmf/winmtf.hxx |   19 ++++++++++++-------
 vcl/source/filter/wmf/winwmf.cxx |    2 +-
 4 files changed, 19 insertions(+), 14 deletions(-)

New commits:
commit 27ff44965e60a56071d325bde62287a862a53ab7
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Oct 9 14:48:01 2014 +0300

    convert BKMODE #defines to 'enum class'
    
    mostly to get the TRANSPARENT #define out of the global namespace
    
    Change-Id: Iec592d26d4d12b5f30f7f9a04dd377a1fb20d643

diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx
index 5b33913..290437c 100644
--- a/vcl/source/filter/wmf/enhwmf.cxx
+++ b/vcl/source/filter/wmf/enhwmf.cxx
@@ -775,7 +775,7 @@ bool EnhWMFReader::ReadEnhWMF()
                 case EMR_SETBKMODE :
                 {
                     pWMF->ReadUInt32( nDat32 );
-                    pOut->SetBkMode( nDat32 );
+                    pOut->SetBkMode( static_cast<BkMode>(nDat32) );
                 }
                 break;
 
diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index a6cddf1..5153574 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -611,7 +611,7 @@ void WinMtfOutput::SetTextLayoutMode( ComplexTextLayoutMode nTextLayoutMode )
     mnTextLayoutMode = nTextLayoutMode;
 }
 
-void WinMtfOutput::SetBkMode( sal_uInt32 nMode )
+void WinMtfOutput::SetBkMode( BkMode nMode )
 {
     mnBkMode = nMode;
 }
@@ -803,8 +803,8 @@ WinMtfOutput::WinMtfOutput( GDIMetaFile& rGDIMetaFile ) :
     maBkColor           ( COL_WHITE ),
     mnLatestTextLayoutMode( TEXT_LAYOUT_DEFAULT ),
     mnTextLayoutMode    ( TEXT_LAYOUT_DEFAULT ),
-    mnLatestBkMode      ( 0 ),
-    mnBkMode            ( OPAQUE ),
+    mnLatestBkMode      ( BkMode::NONE ),
+    mnBkMode            ( BkMode::OPAQUE ),
     meLatestRasterOp    ( ROP_INVERT ),
     meRasterOp          ( ROP_OVERPAINT ),
     maActPos            ( Point() ),
@@ -907,7 +907,7 @@ void WinMtfOutput::UpdateLineStyle()
 void WinMtfOutput::UpdateFillStyle()
 {
     if ( !mbFillStyleSelected )     // SJ: #i57205# taking care of bkcolor if no brush is selected
-        maFillStyle = WinMtfFillStyle( maBkColor, mnBkMode == TRANSPARENT );
+        maFillStyle = WinMtfFillStyle( maBkColor, mnBkMode == BkMode::TRANSPARENT );
     if (!( maLatestFillStyle == maFillStyle ) )
     {
         maLatestFillStyle = maFillStyle;
@@ -1398,7 +1398,7 @@ void WinMtfOutput::DrawText( Point& rPosition, OUString& rText, long* pDXArry, b
     aTmp.SetColor( maTextColor );
     aTmp.SetFillColor( maBkColor );
 
-    if( mnBkMode == TRANSPARENT )
+    if( mnBkMode == BkMode::TRANSPARENT )
         aTmp.SetTransparent( true );
     else
         aTmp.SetTransparent( false );
diff --git a/vcl/source/filter/wmf/winmtf.hxx b/vcl/source/filter/wmf/winmtf.hxx
index 2989556..8eae615 100644
--- a/vcl/source/filter/wmf/winmtf.hxx
+++ b/vcl/source/filter/wmf/winmtf.hxx
@@ -40,9 +40,13 @@
 #define RGN_DIFF                4
 #define RGN_COPY                5
 
-#define TRANSPARENT             1
-#define OPAQUE                  2
-#define BKMODE_LAST             2
+enum class BkMode
+{
+    NONE         = 0,
+    TRANSPARENT  = 1,
+    OPAQUE       = 2,
+    LAST         = 2
+};
 
 /* xform stuff */
 #define MWT_IDENTITY            1
@@ -471,7 +475,8 @@ struct XForm
 
 struct SaveStruct
 {
-    sal_uInt32          nBkMode, nMapMode, nGfxMode;
+    BkMode              nBkMode;
+    sal_uInt32          nMapMode, nGfxMode;
     ComplexTextLayoutMode nTextLayoutMode;
     sal_Int32           nWinOrgX, nWinOrgY, nWinExtX, nWinExtY;
     sal_Int32           nDevOrgX, nDevOrgY, nDevWidth, nDevHeight;
@@ -596,8 +601,8 @@ class WinMtfOutput
     Color               maBkColor;
     ComplexTextLayoutMode  mnLatestTextLayoutMode;
     ComplexTextLayoutMode  mnTextLayoutMode;
-    sal_uInt32          mnLatestBkMode;
-    sal_uInt32          mnBkMode;
+    BkMode              mnLatestBkMode;
+    BkMode              mnBkMode;
     RasterOp            meLatestRasterOp;
     RasterOp            meRasterOp;
 
@@ -680,7 +685,7 @@ public:
 
     void                SetGfxMode( sal_Int32 nGfxMode ){ mnGfxMode = nGfxMode; };
     sal_Int32           GetGfxMode() const { return mnGfxMode; };
-    void                SetBkMode( sal_uInt32 nMode );
+    void                SetBkMode( BkMode nMode );
     void                SetBkColor( const Color& rColor );
     void                SetTextColor( const Color& rColor );
     void                SetTextAlign( sal_uInt32 nAlign );
diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx
index 919e9f1..fa2dc1b 100644
--- a/vcl/source/filter/wmf/winwmf.cxx
+++ b/vcl/source/filter/wmf/winwmf.cxx
@@ -176,7 +176,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
         {
             sal_uInt16 nDat = 0;
             pWMF->ReadUInt16( nDat );
-            pOut->SetBkMode( nDat );
+            pOut->SetBkMode( static_cast<BkMode>(nDat) );
         }
         break;
 


More information about the Libreoffice-commits mailing list