[Libreoffice-commits] core.git: include/svtools include/vcl sd/source sfx2/source starmath/source svtools/source vcl/osx vcl/source vcl/unx

Noel Grandin noel at peralex.com
Tue May 12 23:48:46 PDT 2015


 include/svtools/valueset.hxx             |    3 +
 include/vcl/decoview.hxx                 |   37 ++++++++++++-------
 sd/source/ui/dlg/headerfooterdlg.cxx     |    2 -
 sfx2/source/dialog/dockwin.cxx           |    2 -
 starmath/source/view.cxx                 |    4 +-
 svtools/source/control/valueset.cxx      |    6 +--
 vcl/osx/salnativewidgets.cxx             |    6 +--
 vcl/source/control/button.cxx            |   10 ++---
 vcl/source/control/ctrl.cxx              |    2 -
 vcl/source/control/fixed.cxx             |    2 -
 vcl/source/edit/vclmedit.cxx             |    2 -
 vcl/source/window/brdwin.cxx             |   34 +++++++++---------
 vcl/source/window/decoview.cxx           |   58 ++++++++++++++++---------------
 vcl/source/window/menu.cxx               |    2 -
 vcl/source/window/printdlg.cxx           |    4 +-
 vcl/source/window/splitwin.cxx           |    2 -
 vcl/source/window/status.cxx             |   10 ++---
 vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx |   10 ++---
 vcl/unx/kde4/KDESalGraphics.cxx          |    2 -
 19 files changed, 107 insertions(+), 91 deletions(-)

New commits:
commit 61eb53d39a8d90167dc5599c2a2092626788a630
Author: Noel Grandin <noel at peralex.com>
Date:   Fri May 8 15:40:06 2015 +0200

    convert FRAME_DRAW constants to scoped enum
    
    Change-Id: I98e52aa56ec063ecc8f3d10baef65eb293c726bf

diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx
index 7bb41f7..0497bdd 100644
--- a/include/svtools/valueset.hxx
+++ b/include/svtools/valueset.hxx
@@ -39,6 +39,7 @@ struct ValueSetItem;
 
 class ValueSetAcc;
 class ValueItemAcc;
+enum class DrawFrameStyle;
 
 /*************************************************************************
 
@@ -219,7 +220,7 @@ private:
     sal_uInt16      mnUserVisLines;
     sal_uInt16      mnFirstLine;
     sal_uInt16      mnSpacing;
-    sal_uInt16      mnFrameStyle;
+    DrawFrameStyle  mnFrameStyle;
     Color           maColor;
     Link<>          maDoubleClickHdl;
     Link<>          maSelectHdl;
diff --git a/include/vcl/decoview.hxx b/include/vcl/decoview.hxx
index ef54996..a57c527 100644
--- a/include/vcl/decoview.hxx
+++ b/include/vcl/decoview.hxx
@@ -43,18 +43,29 @@ namespace o3tl
 }
 
 // Flags for DrawFrame()
-#define FRAME_DRAW_IN                       ((sal_uInt16)0x0001)
-#define FRAME_DRAW_OUT                      ((sal_uInt16)0x0002)
-#define FRAME_DRAW_GROUP                    ((sal_uInt16)0x0003)
-#define FRAME_DRAW_DOUBLEIN                 ((sal_uInt16)0x0004)
-#define FRAME_DRAW_DOUBLEOUT                ((sal_uInt16)0x0005)
-#define FRAME_DRAW_NWF                      ((sal_uInt16)0x0006)
-#define FRAME_DRAW_MENU                     ((sal_uInt16)0x0010)
-#define FRAME_DRAW_WINDOWBORDER             ((sal_uInt16)0x0020)
-#define FRAME_DRAW_BORDERWINDOWBORDER       ((sal_uInt16)0x0040)
-#define FRAME_DRAW_MONO                     ((sal_uInt16)0x1000)
-#define FRAME_DRAW_NODRAW                   ((sal_uInt16)0x8000)
-#define FRAME_DRAW_STYLE                    ((sal_uInt16)0x000F)
+enum class DrawFrameStyle
+{
+    NONE                     = 0x0000,
+    In                       = 0x0001,
+    Out                      = 0x0002,
+    Group                    = 0x0003,
+    DoubleIn                 = 0x0004,
+    DoubleOut                = 0x0005,
+    NWF                      = 0x0006,
+};
+enum class DrawFrameFlags
+{
+    NONE                     = 0x0000,
+    Menu                     = 0x0010,
+    WindowBorder             = 0x0020,
+    BorderWindowBorder       = 0x0040,
+    Mono                     = 0x1000,
+    NoDraw                   = 0x8000,
+};
+namespace o3tl
+{
+    template<> struct typed_flags<DrawFrameFlags> : is_typed_flags<DrawFrameFlags, 0x9070> {};
+}
 
 // Flags for DrawHighlightFrame()
 #define FRAME_HIGHLIGHT_IN                  ((sal_uInt16)0x0001)
@@ -92,7 +103,7 @@ public:
                                    const Color& rRightBottomColor );
     void                DrawHighlightFrame( const Rectangle& rRect,
                                             sal_uInt16 nStyle = FRAME_HIGHLIGHT_OUT );
-    Rectangle           DrawFrame( const Rectangle& rRect, sal_uInt16 nStyle = FRAME_DRAW_OUT );
+    Rectangle           DrawFrame( const Rectangle& rRect, DrawFrameStyle nStyle = DrawFrameStyle::Out, DrawFrameFlags nFlags = DrawFrameFlags::NONE );
     Rectangle           DrawButton( const Rectangle& rRect, sal_uInt16 nStyle );
     void                DrawSeparator( const Point& rStart, const Point& rStop, bool bVertical = true );
     void                DrawHandle(const Rectangle& rRectangle, bool bVertical = true);
diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx
index 93246b8..041d61a 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -806,7 +806,7 @@ void PresLayoutPreview::Paint( vcl::RenderContext& /*rRenderContext*/, const Rec
 
     // draw decoration frame
     DecorationView aDecoView( this );
-    maOutRect = aDecoView.DrawFrame( maOutRect, FRAME_HIGHLIGHT_IN );
+    maOutRect = aDecoView.DrawFrame( maOutRect, DrawFrameStyle::In );
 
     // draw page background
     SetFillColor( Color(COL_WHITE) );
diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index 1b47bbe..fec3dba 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -1791,7 +1791,7 @@ void SfxDockingWindow::Paint(vcl::RenderContext& /*rRenderContext*/, const Recta
     }
 
     DecorationView aView( this );
-    aView.DrawFrame( aRect, FRAME_DRAW_OUT );
+    aView.DrawFrame( aRect, DrawFrameStyle::Out );
 }
 
 
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 3de112f..65a1ecc 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -753,7 +753,7 @@ void SmCmdBoxWindow::Resize()
     aRect.Bottom() -= CMD_BOX_PADDING;
 
     DecorationView aView(this);
-    aRect = aView.DrawFrame( aRect, FRAME_DRAW_IN | FRAME_DRAW_NODRAW );
+    aRect = aView.DrawFrame( aRect, DrawFrameStyle::In, DrawFrameFlags::NoDraw );
 
     aEdit->SetPosSizePixel(aRect.TopLeft(), aRect.GetSize());
     SfxDockingWindow::Resize();
@@ -769,7 +769,7 @@ void SmCmdBoxWindow::Paint(vcl::RenderContext& /*rRenderContext*/, const Rectang
     aRect.Bottom() -= CMD_BOX_PADDING;
 
     DecorationView aView(this);
-    aView.DrawFrame( aRect, FRAME_DRAW_IN );
+    aView.DrawFrame( aRect, DrawFrameStyle::In );
 }
 
 Size SmCmdBoxWindow::CalcDockingSize(SfxChildAlignment eAlign)
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index 29c9e18..75882c4 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -75,7 +75,7 @@ void ValueSet::ImplInit()
     mnUserCols          = 0;
     mnUserVisLines      = 0;
     mnSpacing           = 0;
-    mnFrameStyle        = 0;
+    mnFrameStyle        = DrawFrameStyle::NONE;
     mbFormat            = true;
     mbHighlight         = false;
     mbSelection         = false;
@@ -524,9 +524,9 @@ void ValueSet::Format(vcl::RenderContext& rRenderContext)
 
         // determine Frame-Style
         if (nStyle & WB_DOUBLEBORDER)
-            mnFrameStyle = FRAME_DRAW_DOUBLEIN;
+            mnFrameStyle = DrawFrameStyle::DoubleIn;
         else
-            mnFrameStyle = FRAME_DRAW_IN;
+            mnFrameStyle = DrawFrameStyle::In;
 
         // determine selected color and width
         // if necessary change the colors, to make the selection
diff --git a/vcl/osx/salnativewidgets.cxx b/vcl/osx/salnativewidgets.cxx
index 72e035f..8ef6ed6 100644
--- a/vcl/osx/salnativewidgets.cxx
+++ b/vcl/osx/salnativewidgets.cxx
@@ -1015,7 +1015,7 @@ bool AquaSalGraphics::drawNativeControl(ControlType nType,
         {
             sal_uInt16 nStyle = aValue.getNumericVal();
             if( nPart == PART_BORDER ) {
-                if(!( nStyle & FRAME_DRAW_MENU ) && !(nStyle & FRAME_DRAW_WINDOWBORDER) )
+                if(!( nStyle & DrawFrameFlags::Menu ) && !(nStyle & DrawFrameFlags::WindowBorder) )
                 {
                     // #i84756# strange effects start to happen when HIThemeDrawFrame
                     // meets the border of the window. These can be avoided by clipping
@@ -1321,10 +1321,10 @@ bool AquaSalGraphics::getNativeControlRegion( ControlType nType, ControlPart nPa
             {
                 sal_uInt16 nStyle = aValue.getNumericVal();
                 if(  ( nPart == PART_BORDER ) &&
-                    !( nStyle & (FRAME_DRAW_MENU | FRAME_DRAW_WINDOWBORDER | FRAME_DRAW_BORDERWINDOWBORDER) ) )
+                    !( nStyle & (DrawFrameFlags::Menu | DrawFrameFlags::WindowBorder | DrawFrameFlags::BorderWindowBorder) ) )
                 {
                     Rectangle aRect(aCtrlBoundRect);
-                    if( nStyle & FRAME_DRAW_DOUBLEIN )
+                    if( nStyle & DrawFrameStyle::DoubleIn )
                     {
                         aRect.Left()    += 1;
                         aRect.Top()     += 1;
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 659b25f..9dd23ed 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -1910,7 +1910,7 @@ void RadioButton::ImplDrawRadioButtonState(vcl::RenderContext& rRenderContext)
             Rectangle aImageRect  = maStateRect;
             Size aImageSize = maImage.GetSizePixel();
             bool bEnabled = IsEnabled();
-            sal_uInt16 nButtonStyle = FRAME_DRAW_DOUBLEIN;
+            DrawFrameStyle nButtonStyle = DrawFrameStyle::DoubleIn;
 
             aImageSize.Width()  = CalcZoom(aImageSize.Width());
             aImageSize.Height() = CalcZoom(aImageSize.Height());
@@ -1925,9 +1925,9 @@ void RadioButton::ImplDrawRadioButtonState(vcl::RenderContext& rRenderContext)
             rRenderContext.DrawRect(aImageRect);
 
             // display image
-            nButtonStyle = 0;
+            sal_uInt16 nImageStyle = 0;
             if (!bEnabled)
-                nButtonStyle |= IMAGE_DRAW_DISABLE;
+                nImageStyle |= IMAGE_DRAW_DISABLE;
 
             Image* pImage = &maImage;
 
@@ -1935,9 +1935,9 @@ void RadioButton::ImplDrawRadioButtonState(vcl::RenderContext& rRenderContext)
             aImagePos.X() += (aImageRect.GetWidth() - aImageSize.Width()) / 2;
             aImagePos.Y() += (aImageRect.GetHeight() - aImageSize.Height()) / 2;
             if (IsZoom())
-                rRenderContext.DrawImage(aImagePos, aImageSize, *pImage, nButtonStyle);
+                rRenderContext.DrawImage(aImagePos, aImageSize, *pImage, nImageStyle);
             else
-                rRenderContext.DrawImage(aImagePos, *pImage, nButtonStyle);
+                rRenderContext.DrawImage(aImagePos, *pImage, nImageStyle);
 
             aImageRect.Left()++;
             aImageRect.Top()++;
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 34c4248..fb0020e 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -377,7 +377,7 @@ void Control::ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect )
     pDev->OutputDevice::SetSettings( aNewSettings );
 
     DecorationView aDecoView( pDev );
-    rRect = aDecoView.DrawFrame( rRect, FRAME_DRAW_WINDOWBORDER );
+    rRect = aDecoView.DrawFrame( rRect, DrawFrameStyle::Out, DrawFrameFlags::WindowBorder );
 
     pDev->OutputDevice::SetSettings( aOriginalSettings );
 }
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index 58c6fb4..19988df 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -790,7 +790,7 @@ void FixedBitmap::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize
     if ( !(nFlags & WINDOW_DRAW_NOBORDER) && (GetStyle() & WB_BORDER) )
     {
         DecorationView aDecoView( pDev );
-        aRect = aDecoView.DrawFrame( aRect, FRAME_DRAW_DOUBLEIN );
+        aRect = aDecoView.DrawFrame( aRect, DrawFrameStyle::DoubleIn );
     }
     pDev->IntersectClipRegion( aRect );
     ImplDraw( pDev, nFlags, aRect.TopLeft(), aRect.GetSize() );
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index 1ef7ccd..c34fc22 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -1338,7 +1338,7 @@ void VclMultiLineEdit::Draw( OutputDevice* pDev, const Point& rPos, const Size&
         if ( bBorder )
         {
             DecorationView aDecoView( pDev );
-            aRect = aDecoView.DrawFrame( aRect, FRAME_DRAW_DOUBLEIN );
+            aRect = aDecoView.DrawFrame( aRect, DrawFrameStyle::DoubleIn );
         }
         if ( bBackground )
         {
diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx
index 90995cb..5336d01 100644
--- a/vcl/source/window/brdwin.cxx
+++ b/vcl/source/window/brdwin.cxx
@@ -1133,20 +1133,21 @@ void ImplSmallBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHei
 
         if( ! mbNWFBorder )
         {
-            sal_uInt16 nStyle = FRAME_DRAW_NODRAW;
+            DrawFrameStyle nStyle = DrawFrameStyle::NONE;
+            DrawFrameFlags nFlags = DrawFrameFlags::NoDraw;
             // move border outside if border was converted or if the BorderWindow is a frame window,
             if ( mpBorderWindow->mbSmallOutBorder )
-                nStyle |= FRAME_DRAW_DOUBLEOUT;
+                nStyle = DrawFrameStyle::DoubleOut;
             else if ( nBorderStyle & WindowBorderStyle::NWF )
-                nStyle |= FRAME_DRAW_NWF;
+                nStyle = DrawFrameStyle::NWF;
             else
-                nStyle |= FRAME_DRAW_DOUBLEIN;
+                nStyle = DrawFrameStyle::DoubleIn;
             if ( nBorderStyle & WindowBorderStyle::MONO )
-                nStyle |= FRAME_DRAW_MONO;
+                nFlags |= DrawFrameFlags::Mono;
 
             DecorationView  aDecoView( mpOutDev );
             Rectangle       aRect( 0, 0, 10, 10 );
-            Rectangle       aCalcRect = aDecoView.DrawFrame( aRect, nStyle );
+            Rectangle       aCalcRect = aDecoView.DrawFrame( aRect, nStyle, nFlags );
             mnLeftBorder    = aCalcRect.Left();
             mnTopBorder     = aCalcRect.Top();
             mnRightBorder   = aRect.Right()-aCalcRect.Right();
@@ -1321,26 +1322,27 @@ void ImplSmallBorderWindowView::DrawWindow(sal_uInt16 nDrawFlags, OutputDevice*,
 
     if (nDrawFlags & BORDERWINDOW_DRAW_FRAME)
     {
-        sal_uInt16 nStyle = 0;
+        DrawFrameStyle nStyle = DrawFrameStyle::NONE;
+        DrawFrameFlags nFlags = DrawFrameFlags::NONE;
         // move border outside if border was converted or if the border window is a frame window,
         if (mpBorderWindow->mbSmallOutBorder)
-            nStyle |= FRAME_DRAW_DOUBLEOUT;
+            nStyle = DrawFrameStyle::DoubleOut;
         else if (nBorderStyle & WindowBorderStyle::NWF)
-            nStyle |= FRAME_DRAW_NWF;
+            nStyle = DrawFrameStyle::NWF;
         else
-            nStyle |= FRAME_DRAW_DOUBLEIN;
+            nStyle = DrawFrameStyle::DoubleIn;
         if (nBorderStyle & WindowBorderStyle::MONO)
-            nStyle |= FRAME_DRAW_MONO;
+            nFlags |= DrawFrameFlags::Mono;
         if (nBorderStyle & WindowBorderStyle::MENU)
-            nStyle |= FRAME_DRAW_MENU;
+            nFlags |= DrawFrameFlags::Menu;
         // tell DrawFrame that we're drawing a window border of a frame window to avoid round corners
         if (pWin && pWin == pWin->ImplGetFrameWindow())
-            nStyle |= FRAME_DRAW_WINDOWBORDER;
+            nFlags |= DrawFrameFlags::WindowBorder;
 
         DecorationView aDecoView(mpOutDev);
         Point aTmpPoint;
         Rectangle aInRect(aTmpPoint, Size(mnWidth, mnHeight));
-        aDecoView.DrawFrame(aInRect, nStyle);
+        aDecoView.DrawFrame(aInRect, nStyle, nFlags);
     }
 }
 
@@ -1402,7 +1404,7 @@ void ImplStdBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHeigh
     const StyleSettings&    rStyleSettings = pDev->GetSettings().GetStyleSettings();
     DecorationView          aDecoView( pDev );
     Rectangle               aRect( 0, 0, 10, 10 );
-    Rectangle               aCalcRect = aDecoView.DrawFrame( aRect, FRAME_DRAW_DOUBLEOUT | FRAME_DRAW_NODRAW );
+    Rectangle               aCalcRect = aDecoView.DrawFrame( aRect, DrawFrameStyle::DoubleOut, DrawFrameFlags::NoDraw );
 
     pData->mpOutDev         = pDev;
     pData->mnWidth          = nWidth;
@@ -1605,7 +1607,7 @@ void ImplStdBorderWindowView::DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* p
             pDev->SetClipRegion(oldClipRgn);
     }
     else
-        aInRect = aDecoView.DrawFrame(aInRect, FRAME_DRAW_DOUBLEOUT | FRAME_DRAW_NODRAW);
+        aInRect = aDecoView.DrawFrame(aInRect, DrawFrameStyle::DoubleOut, DrawFrameFlags::NoDraw);
 
     // Draw Border
     pDev->SetLineColor();
diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index 1be0a5d..76d5d58 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -621,11 +621,11 @@ void ImplDrawButton( OutputDevice *const pDev, Rectangle aFillRect,
 }
 
 void ImplDrawFrame( OutputDevice *const pDev, Rectangle& rRect,
-                    const StyleSettings& rStyleSettings, sal_uInt16 nStyle )
+                    const StyleSettings& rStyleSettings, DrawFrameStyle nStyle, DrawFrameFlags nFlags )
 {
     vcl::Window *const pWin = (pDev->GetOutDevType()==OUTDEV_WINDOW) ? static_cast<vcl::Window*>(pDev) : NULL;
 
-    const bool bMenuStyle = nStyle & FRAME_DRAW_MENU;
+    const bool bMenuStyle(nFlags & DrawFrameFlags::Menu);
 
     // UseFlatBorders disables 3D style for all frames except menus
     // menus may use different border colors (eg on XP)
@@ -643,19 +643,19 @@ void ImplDrawFrame( OutputDevice *const pDev, Rectangle& rRect,
             bFlatBorders = false;
     }
 
-    const bool bNoDraw = nStyle & FRAME_DRAW_NODRAW;
+    const bool bNoDraw(nFlags & DrawFrameFlags::NoDraw);
 
     if ( (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ||
          (pDev->GetOutDevType() == OUTDEV_PRINTER) ||
          bFlatBorders )
-        nStyle |= FRAME_DRAW_MONO;
+        nFlags |= DrawFrameFlags::Mono;
 
-    if( (nStyle & FRAME_DRAW_STYLE) != FRAME_DRAW_NWF &&
+    if( nStyle != DrawFrameStyle::NWF &&
         pWin && pWin->IsNativeControlSupported(CTRL_FRAME, PART_BORDER) )
     {
-        ImplControlValue aControlValue( nStyle |
-                                        (pWin->GetType()==WINDOW_BORDERWINDOW ?
-                                        FRAME_DRAW_BORDERWINDOWBORDER : 0) );
+        ImplControlValue aControlValue( static_cast<long>(nStyle) |
+                                        static_cast<long>(pWin->GetType()==WINDOW_BORDERWINDOW ?
+                                                          DrawFrameFlags::BorderWindowBorder : DrawFrameFlags::NONE) );
         Rectangle aBound, aContent;
         Rectangle aNatRgn( rRect );
         if( pWin->GetNativeControlRegion(CTRL_FRAME, PART_BORDER,
@@ -673,10 +673,10 @@ void ImplDrawFrame( OutputDevice *const pDev, Rectangle& rRect,
         }
     }
 
-    if ( nStyle & FRAME_DRAW_MONO )
+    if ( nFlags & DrawFrameFlags::Mono )
     {
         // no round corners for window frame borders
-        const bool bRound = bFlatBorders && !(nStyle & FRAME_DRAW_WINDOWBORDER);
+        const bool bRound = bFlatBorders && !(nFlags & DrawFrameFlags::WindowBorder);
 
         if ( bNoDraw )
         {
@@ -704,39 +704,40 @@ void ImplDrawFrame( OutputDevice *const pDev, Rectangle& rRect,
     {
         if ( bNoDraw )
         {
-            switch ( nStyle & FRAME_DRAW_STYLE )
+            switch ( nStyle )
             {
-                case FRAME_DRAW_IN:
-                case FRAME_DRAW_OUT:
+                case DrawFrameStyle::In:
+                case DrawFrameStyle::Out:
                     ++rRect.Left();
                     ++rRect.Top();
                     --rRect.Right();
                     --rRect.Bottom();
                     break;
 
-                case FRAME_DRAW_GROUP:
-                case FRAME_DRAW_DOUBLEIN:
-                case FRAME_DRAW_DOUBLEOUT:
+                case DrawFrameStyle::Group:
+                case DrawFrameStyle::DoubleIn:
+                case DrawFrameStyle::DoubleOut:
                     rRect.Left()   += 2;
                     rRect.Top()    += 2;
                     rRect.Right()  -= 2;
                     rRect.Bottom() -= 2;
                     break;
 
-                case FRAME_DRAW_NWF:
+                case DrawFrameStyle::NWF:
                     // enough space for the native rendering
                     rRect.Left() += 4;
                     rRect.Top() += 4;
                     rRect.Right() -= 4;
                     rRect.Bottom() -= 4;
                     break;
+                default: break;
             }
         }
         else
         {
-            switch ( nStyle & FRAME_DRAW_STYLE )
+            switch ( nStyle )
             {
-                case FRAME_DRAW_GROUP:
+                case DrawFrameStyle::Group:
                     pDev->SetFillColor();
                     pDev->SetLineColor( rStyleSettings.GetLightColor() );
                     pDev->DrawRect( Rectangle( rRect.Left()+1, rRect.Top()+1,
@@ -752,19 +753,19 @@ void ImplDrawFrame( OutputDevice *const pDev, Rectangle& rRect,
                     rRect.Bottom() -= 2;
                     break;
 
-                case FRAME_DRAW_IN:
+                case DrawFrameStyle::In:
                     ImplDraw2ColorFrame( pDev, rRect,
                                          rStyleSettings.GetShadowColor(),
                                          rStyleSettings.GetLightColor() );
                     break;
 
-                case FRAME_DRAW_OUT:
+                case DrawFrameStyle::Out:
                     ImplDraw2ColorFrame( pDev, rRect,
                                          rStyleSettings.GetLightColor(),
                                          rStyleSettings.GetShadowColor() );
                     break;
 
-                case FRAME_DRAW_DOUBLEIN:
+                case DrawFrameStyle::DoubleIn:
                     if( bFlatBorders )
                     {
                         // no 3d effect
@@ -786,7 +787,7 @@ void ImplDrawFrame( OutputDevice *const pDev, Rectangle& rRect,
                     }
                     break;
 
-                case FRAME_DRAW_DOUBLEOUT:
+                case DrawFrameStyle::DoubleOut:
                     if( bMenuStyle )
                     {
                         ImplDraw2ColorFrame( pDev, rRect,
@@ -812,13 +813,14 @@ void ImplDrawFrame( OutputDevice *const pDev, Rectangle& rRect,
                     }
                     break;
 
-                case FRAME_DRAW_NWF:
+                case DrawFrameStyle::NWF:
                     // no rendering, just enough space for the native rendering
                     rRect.Left() += 4;
                     rRect.Top() += 4;
                     rRect.Right() -= 4;
                     rRect.Bottom() -= 4;
                     break;
+                default: break;
             }
         }
     }
@@ -934,7 +936,7 @@ void DecorationView::DrawHighlightFrame( const Rectangle& rRect,
     DrawFrame( rRect, aLightColor, aShadowColor );
 }
 
-Rectangle DecorationView::DrawFrame( const Rectangle& rRect, sal_uInt16 nStyle )
+Rectangle DecorationView::DrawFrame( const Rectangle& rRect, DrawFrameStyle nStyle, DrawFrameFlags nFlags )
 {
     Rectangle   aRect = rRect;
     bool        bOldMap = mpOutDev->IsMapModeEnabled();
@@ -946,13 +948,13 @@ Rectangle DecorationView::DrawFrame( const Rectangle& rRect, sal_uInt16 nStyle )
 
     if ( !rRect.IsEmpty() )
     {
-        if ( nStyle & FRAME_DRAW_NODRAW )
-             ImplDrawFrame( mpOutDev, aRect, mpOutDev->GetSettings().GetStyleSettings(), nStyle );
+        if ( nFlags & DrawFrameFlags::NoDraw )
+             ImplDrawFrame( mpOutDev, aRect, mpOutDev->GetSettings().GetStyleSettings(), nStyle, nFlags );
         else
         {
              Color maOldLineColor  = mpOutDev->GetLineColor();
              Color maOldFillColor  = mpOutDev->GetFillColor();
-             ImplDrawFrame( mpOutDev, aRect, mpOutDev->GetSettings().GetStyleSettings(), nStyle );
+             ImplDrawFrame( mpOutDev, aRect, mpOutDev->GetSettings().GetStyleSettings(), nStyle, nFlags );
              mpOutDev->SetLineColor( maOldLineColor );
              mpOutDev->SetFillColor( maOldFillColor );
         }
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index b8e9c98..2e6d8c6 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2064,7 +2064,7 @@ void Menu::ImplPaint( vcl::Window* pWin, sal_uInt16 nBorder, long nStartY, MenuI
                             Point aTmpPos2( aPos );
                             aTmpPos2.X() = aOutSz.Width() - nFontHeight - nFontHeight/4;
                             aDecoView.DrawFrame(
-                                Rectangle( aTmpPos2, Size( nFontHeight+nFontHeight/4, pData->aSz.Height() ) ), FRAME_DRAW_GROUP );
+                                Rectangle( aTmpPos2, Size( nFontHeight+nFontHeight/4, pData->aSz.Height() ) ), DrawFrameStyle::Group );
                         }
                         aDecoView.DrawSymbol(
                             Rectangle( aTmpPos, Size( nFontHeight/2, nFontHeight/2 ) ),
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 16b76c4..b778e08 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -192,7 +192,7 @@ void PrintDialog::PrintPreviewWindow::Paint(vcl::RenderContext& rRenderContext,
 
     Rectangle aFrameRect(aOffset + Point(-1, -1), Size(maPreviewSize.Width() + 2, maPreviewSize.Height() + 2));
     DecorationView aDecorationView(&rRenderContext);
-    aDecorationView.DrawFrame(aFrameRect, FRAME_DRAW_GROUP);
+    aDecorationView.DrawFrame(aFrameRect, DrawFrameStyle::Group);
 }
 
 void PrintDialog::PrintPreviewWindow::Command( const CommandEvent& rEvt )
@@ -377,7 +377,7 @@ void PrintDialog::ShowNupOrderWindow::Paint(vcl::RenderContext& rRenderContext,
                                       nY * aSubSize.Height() + nDeltaY), aPageText);
     }
     DecorationView aDecorationView(&rRenderContext);
-    aDecorationView.DrawFrame(Rectangle(Point(0, 0), aOutSize), FRAME_DRAW_GROUP);
+    aDecorationView.DrawFrame(Rectangle(Point(0, 0), aOutSize), DrawFrameStyle::Group);
 }
 
 PrintDialog::NUpTabPage::NUpTabPage( VclBuilder *pUIBuilder )
diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index 115db62..f88aec7 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -161,7 +161,7 @@ void SplitWindow::ImplDrawBorder(vcl::RenderContext& rRenderContext)
         DecorationView aDecoView(&rRenderContext);
         Point aTmpPoint;
         Rectangle aRect(aTmpPoint, Size(nDX, nDY));
-        aDecoView.DrawFrame(aRect, FRAME_DRAW_DOUBLEIN);
+        aDecoView.DrawFrame(aRect, DrawFrameStyle::DoubleIn);
     }
     else
     {
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index 1c8d9d0..bfbe30b 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -444,12 +444,12 @@ void StatusBar::ImplDrawItem(vcl::RenderContext& rRenderContext, bool bOffScreen
         {
             if (!(pItem->mnBits & SIB_FLAT))
             {
-                sal_uInt16 nStyle;
+                DrawFrameStyle nStyle;
 
                 if (pItem->mnBits & SIB_IN)
-                    nStyle = FRAME_DRAW_IN;
+                    nStyle = DrawFrameStyle::In;
                 else
-                    nStyle = FRAME_DRAW_OUT;
+                    nStyle = DrawFrameStyle::Out;
 
                 DecorationView aDecoView(&rRenderContext);
                 aDecoView.DrawFrame(aRect, nStyle);
@@ -598,7 +598,7 @@ void StatusBar::ImplDrawProgress(vcl::RenderContext& rRenderContext, bool bPaint
         if (!bNative)
         {
             DecorationView aDecoView(&rRenderContext);
-            aDecoView.DrawFrame(maPrgsFrameRect, FRAME_DRAW_IN);
+            aDecoView.DrawFrame(maPrgsFrameRect, DrawFrameStyle::In);
         }
     }
 
@@ -1463,7 +1463,7 @@ Size StatusBar::CalcWindowSizePixel() const
     if( mpImplData->mbDrawItemFrames &&
         IsNativeControlSupported( CTRL_FRAME, PART_BORDER ) )
     {
-        ImplControlValue aControlValue( FRAME_DRAW_NODRAW );
+        ImplControlValue aControlValue( static_cast<long>(DrawFrameFlags::NoDraw) );
         Rectangle aBound, aContent;
         Rectangle aNatRgn( Point( 0, 0 ), Size( 150, 50 ) );
         if( GetNativeControlRegion(CTRL_FRAME, PART_BORDER,
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index ac0a6a8..20feb22 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -1317,13 +1317,13 @@ bool GtkSalGraphics::getNativeControlRegion(  ControlType nType,
     {
         int frameWidth = getFrameWidth(gWidgetData[m_nXScreen].gFrame);
         rNativeBoundingRegion = rControlRegion;
-        sal_uInt16 nStyle = aValue.getNumericVal();
+        DrawFrameFlags nStyle = static_cast<DrawFrameFlags>(aValue.getNumericVal() & 0xfff0);
         int x1=rControlRegion.Left();
         int y1=rControlRegion.Top();
         int x2=rControlRegion.Right();
         int y2=rControlRegion.Bottom();
 
-        if( nStyle & FRAME_DRAW_NODRAW )
+        if( nStyle & DrawFrameFlags::NoDraw )
         {
             rNativeContentRegion = Rectangle(x1+frameWidth,
                                              y1+frameWidth,
@@ -1494,10 +1494,10 @@ bool GtkSalGraphics::NWPaintGTKFrame(
     GdkRectangle clipRect;
     int frameWidth=getFrameWidth(gWidgetData[m_nXScreen].gFrame);
     GtkShadowType shadowType=GTK_SHADOW_IN;
-    sal_uInt16 nStyle = aValue.getNumericVal();
-    if( nStyle & FRAME_DRAW_IN )
+    DrawFrameStyle nStyle = static_cast<DrawFrameStyle>(aValue.getNumericVal() & 0x0f);
+    if( nStyle == DrawFrameStyle::In )
         shadowType=GTK_SHADOW_OUT;
-    if( nStyle & FRAME_DRAW_OUT )
+    if( nStyle == DrawFrameStyle::Out )
         shadowType=GTK_SHADOW_IN;
 
     for( clipList::const_iterator it = rClipList.begin(); it != rClipList.end(); ++it )
diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
index f383788..e6a3851 100644
--- a/vcl/unx/kde4/KDESalGraphics.cxx
+++ b/vcl/unx/kde4/KDESalGraphics.cxx
@@ -840,7 +840,7 @@ bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
             {
                 int nFrameWidth = static_cast< KDESalInstance* >(GetSalData()->m_pInstance)->getFrameWidth();
                 sal_uInt16 nStyle = val.getNumericVal();
-                if( nStyle & FRAME_DRAW_NODRAW )
+                if( nStyle & DrawFrameFlags::NoDraw )
                 {
                     // in this case the question is: how thick would a frame be
                     // see brdwin.cxx, decoview.cxx


More information about the Libreoffice-commits mailing list