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

Noel Grandin noel at peralex.com
Sun May 22 17:51:59 UTC 2016


 vcl/inc/unx/gtk/gtkframe.hxx     |    5 ++++-
 vcl/source/filter/wmf/winmtf.cxx |    4 ++--
 vcl/source/filter/wmf/winmtf.hxx |   13 ++++++-------
 vcl/unx/gtk/gtksalframe.cxx      |   28 +++++++++++-----------------
 vcl/unx/gtk3/gtk3gtkframe.cxx    |   28 +++++++++++-----------------
 5 files changed, 34 insertions(+), 44 deletions(-)

New commits:
commit dfc6b7506738465b14c6bcce63ce5eb7266c969a
Author: Noel Grandin <noel at peralex.com>
Date:   Fri May 20 15:20:42 2016 +0200

    Convert WinMtfFillStyleType to scoped enum
    
    Change-Id: Ifcbcac1883285d175e1b72e99f300afad2f4d092
    Reviewed-on: https://gerrit.libreoffice.org/25200
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index ac6fac9..2228bbc 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -912,7 +912,7 @@ void WinMtfOutput::UpdateFillStyle()
     if (!( maLatestFillStyle == maFillStyle ) )
     {
         maLatestFillStyle = maFillStyle;
-        if (maFillStyle.aType == FillStyleSolid)
+        if (maFillStyle.aType == WinMtfFillStyleType::Solid)
             mpGDIMetaFile->AddAction( new MetaFillColorAction( maFillStyle.aFillColor, !maFillStyle.bTransparent ) );
     }
 }
@@ -1211,7 +1211,7 @@ void WinMtfOutput::DrawPolygon( tools::Polygon& rPolygon, bool bRecordPath )
             {
                 UpdateLineStyle();
 
-                if (maLatestFillStyle.aType != FillStylePattern)
+                if (maLatestFillStyle.aType != WinMtfFillStyleType::Pattern)
                     mpGDIMetaFile->AddAction( new MetaPolygonAction( rPolygon ) );
                 else {
                     SvtGraphicFill aFill = SvtGraphicFill( tools::PolyPolygon( rPolygon ),
diff --git a/vcl/source/filter/wmf/winmtf.hxx b/vcl/source/filter/wmf/winmtf.hxx
index 3f4182e..cff2763 100644
--- a/vcl/source/filter/wmf/winmtf.hxx
+++ b/vcl/source/filter/wmf/winmtf.hxx
@@ -299,11 +299,10 @@ struct WinMtfFontStyle : GDIObj
 };
 
 
-typedef enum
+enum class WinMtfFillStyleType
 {
-    FillStyleSolid,
-    FillStylePattern
-} WinMtfFillStyleType;
+    Solid, Pattern
+};
 
 struct WinMtfFillStyle : GDIObj
 {
@@ -315,18 +314,18 @@ struct WinMtfFillStyle : GDIObj
     WinMtfFillStyle()
         : aFillColor(Color(COL_BLACK))
         , bTransparent(false)
-        , aType(FillStyleSolid)
+        , aType(WinMtfFillStyleType::Solid)
     {}
 
     WinMtfFillStyle(const Color& rColor, bool bTrans = false)
         : aFillColor(rColor)
         , bTransparent(bTrans)
-        , aType(FillStyleSolid)
+        , aType(WinMtfFillStyleType::Solid)
     {}
 
     explicit WinMtfFillStyle(Bitmap& rBmp)
         : bTransparent(false)
-        , aType(FillStylePattern)
+        , aType(WinMtfFillStyleType::Pattern)
         , aBmp(rBmp)
     {}
 
commit a0ac522f6b9850c478c28bb54cafe82fed95a389
Author: Noel Grandin <noel at peralex.com>
Date:   Fri May 20 15:17:41 2016 +0200

    Convert SetType to scoped enum
    
    Change-Id: I1f724340a990ce8a811fa84e1f5fc54fad54ae81
    Reviewed-on: https://gerrit.libreoffice.org/25198
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 7c0803b..14a9818 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -342,7 +342,10 @@ class GtkSalFrame : public SalFrame
     void TriggerPaintEvent();
 
     void updateWMClass();
-    void SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSize = nullptr );
+
+    enum class SetType { RetainSize, Fullscreen, UnFullscreen };
+
+    void SetScreen( unsigned int nNewScreen, SetType eType, Rectangle *pSize = nullptr );
 
 public:
 #if GTK_CHECK_VERSION(3,0,0)
diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index 83e8836..0c6e315 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -1935,18 +1935,12 @@ bool GtkSalFrame::GetWindowState( SalFrameState* pState )
     return true;
 }
 
-typedef enum {
-    SET_RETAIN_SIZE,
-    SET_FULLSCREEN,
-    SET_UN_FULLSCREEN
-} SetType;
-
-void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSize )
+void GtkSalFrame::SetScreen( unsigned int nNewScreen, SetType eType, Rectangle *pSize )
 {
     if( !m_pWindow )
         return;
 
-    if (maGeometry.nDisplayScreenNumber == nNewScreen && eType == SET_RETAIN_SIZE)
+    if (maGeometry.nDisplayScreenNumber == nNewScreen && eType == SetType::RetainSize)
         return;
 
     GdkScreen *pScreen = nullptr;
@@ -2011,7 +2005,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz
     if( bVisible )
         Show( false );
 
-    if( eType == SET_FULLSCREEN )
+    if( eType == SetType::Fullscreen )
     {
         maGeometry.nX = aNewMonitor.x;
         maGeometry.nY = aNewMonitor.y;
@@ -2026,7 +2020,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz
         m_aMaxSize.Height() = aNewMonitor.height;
     }
 
-    if( pSize && eType == SET_UN_FULLSCREEN )
+    if( pSize && eType == SetType::UnFullscreen )
     {
         maGeometry.nX = pSize->Left();
         maGeometry.nY = pSize->Top();
@@ -2053,13 +2047,13 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz
     // _NET_WM_STATE_FULLSCREEN (Metacity <-> KWin)
     if( ! getDisplay()->getWMAdaptor()->isLegacyPartialFullscreen() )
     {
-        if( eType == SET_FULLSCREEN )
+        if( eType == SetType::Fullscreen )
             gtk_window_fullscreen( GTK_WINDOW( m_pWindow ) );
-        else if( eType == SET_UN_FULLSCREEN )
+        else if( eType == SetType::UnFullscreen )
             gtk_window_unfullscreen( GTK_WINDOW( m_pWindow ) );
     }
 
-    if( eType == SET_UN_FULLSCREEN &&
+    if( eType == SetType::UnFullscreen &&
         !(m_nStyle & SalFrameStyleFlags::SIZEABLE) )
         gtk_window_set_resizable( GTK_WINDOW( m_pWindow ), FALSE );
 
@@ -2068,7 +2062,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz
         SetParent( nullptr );
     std::list< GtkSalFrame* > aChildren = m_aChildren;
     for( std::list< GtkSalFrame* >::iterator it = aChildren.begin(); it != aChildren.end(); ++it )
-        (*it)->SetScreen( nNewScreen, SET_RETAIN_SIZE );
+        (*it)->SetScreen( nNewScreen, SetType::RetainSize );
 
     m_bDefaultPos = m_bDefaultSize = false;
     updateScreenNumber();
@@ -2080,7 +2074,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz
 
 void GtkSalFrame::SetScreenNumber( unsigned int nNewScreen )
 {
-    SetScreen( nNewScreen, SET_RETAIN_SIZE );
+    SetScreen( nNewScreen, SetType::RetainSize );
 }
 
 void GtkSalFrame::updateWMClass()
@@ -2131,11 +2125,11 @@ void GtkSalFrame::ShowFullScreen( bool bFullScreen, sal_Int32 nScreen )
     {
         m_aRestorePosSize = Rectangle( Point( maGeometry.nX, maGeometry.nY ),
                                        Size( maGeometry.nWidth, maGeometry.nHeight ) );
-        SetScreen( nScreen, SET_FULLSCREEN );
+        SetScreen( nScreen, SetType::Fullscreen );
     }
     else
     {
-        SetScreen( nScreen, SET_UN_FULLSCREEN,
+        SetScreen( nScreen, SetType::UnFullscreen,
                    !m_aRestorePosSize.IsEmpty() ? &m_aRestorePosSize : nullptr );
         m_aRestorePosSize = Rectangle();
     }
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 7eaa53c..0bb9bf7 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1786,18 +1786,12 @@ bool GtkSalFrame::GetWindowState( SalFrameState* pState )
     return true;
 }
 
-typedef enum {
-    SET_RETAIN_SIZE,
-    SET_FULLSCREEN,
-    SET_UN_FULLSCREEN
-} SetType;
-
-void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSize )
+void GtkSalFrame::SetScreen( unsigned int nNewScreen, SetType eType, Rectangle *pSize )
 {
     if( !m_pWindow )
         return;
 
-    if (maGeometry.nDisplayScreenNumber == nNewScreen && eType == SET_RETAIN_SIZE)
+    if (maGeometry.nDisplayScreenNumber == nNewScreen && eType == SetType::RetainSize)
         return;
 
     int nX = maGeometry.nX, nY = maGeometry.nY,
@@ -1864,7 +1858,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz
     if( bVisible )
         Show( false );
 
-    if( eType == SET_FULLSCREEN )
+    if( eType == SetType::Fullscreen )
     {
         nX = aNewMonitor.x;
         nY = aNewMonitor.y;
@@ -1879,7 +1873,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz
         m_aMaxSize.Height() = aNewMonitor.height;
     }
 
-    if( pSize && eType == SET_UN_FULLSCREEN )
+    if( pSize && eType == SetType::UnFullscreen )
     {
         nX = pSize->Left();
         nY = pSize->Top();
@@ -1903,12 +1897,12 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz
     gdk_window_set_fullscreen_mode( widget_get_window(m_pWindow), m_bSpanMonitorsWhenFullscreen
         ? GDK_FULLSCREEN_ON_ALL_MONITORS : GDK_FULLSCREEN_ON_CURRENT_MONITOR );
 #endif
-    if( eType == SET_FULLSCREEN )
+    if( eType == SetType::Fullscreen )
         gtk_window_fullscreen( GTK_WINDOW( m_pWindow ) );
-    else if( eType == SET_UN_FULLSCREEN )
+    else if( eType == SetType::UnFullscreen )
         gtk_window_unfullscreen( GTK_WINDOW( m_pWindow ) );
 
-    if( eType == SET_UN_FULLSCREEN &&
+    if( eType == SetType::UnFullscreen &&
         !(m_nStyle & SalFrameStyleFlags::SIZEABLE) )
         gtk_window_set_resizable( GTK_WINDOW( m_pWindow ), FALSE );
 
@@ -1917,7 +1911,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz
         SetParent( nullptr );
     std::list< GtkSalFrame* > aChildren = m_aChildren;
     for( std::list< GtkSalFrame* >::iterator it = aChildren.begin(); it != aChildren.end(); ++it )
-        (*it)->SetScreen( nNewScreen, SET_RETAIN_SIZE );
+        (*it)->SetScreen( nNewScreen, SetType::RetainSize );
 
     m_bDefaultPos = m_bDefaultSize = false;
     updateScreenNumber();
@@ -1928,7 +1922,7 @@ void GtkSalFrame::SetScreen( unsigned int nNewScreen, int eType, Rectangle *pSiz
 
 void GtkSalFrame::SetScreenNumber( unsigned int nNewScreen )
 {
-    SetScreen( nNewScreen, SET_RETAIN_SIZE );
+    SetScreen( nNewScreen, SetType::RetainSize );
 }
 
 void GtkSalFrame::updateWMClass()
@@ -1978,11 +1972,11 @@ void GtkSalFrame::ShowFullScreen( bool bFullScreen, sal_Int32 nScreen )
     if( bFullScreen )
     {
         m_aRestorePosSize = GetPosAndSize(GTK_WINDOW(m_pWindow));
-        SetScreen( nScreen, SET_FULLSCREEN );
+        SetScreen( nScreen, SetType::Fullscreen );
     }
     else
     {
-        SetScreen( nScreen, SET_UN_FULLSCREEN,
+        SetScreen( nScreen, SetType::UnFullscreen,
                    !m_aRestorePosSize.IsEmpty() ? &m_aRestorePosSize : nullptr );
         m_aRestorePosSize = Rectangle();
     }


More information about the Libreoffice-commits mailing list