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

Noel Grandin noel at peralex.com
Wed May 13 00:27:43 PDT 2015


 include/vcl/floatwin.hxx       |   21 ++++++++++++---------
 vcl/source/window/floatwin.cxx |   22 +++++++++++-----------
 vcl/source/window/scrwnd.cxx   |    2 +-
 vcl/source/window/window.cxx   |    2 +-
 4 files changed, 25 insertions(+), 22 deletions(-)

New commits:
commit 5525ad365c9c19d86d32efdd4644bfcf43063bcf
Author: Noel Grandin <noel at peralex.com>
Date:   Wed May 13 09:26:49 2015 +0200

    convert FLOATWIN_TITLE constants to scoped enum
    
    Change-Id: Iebd2eadfa375092a33d6de9d7f7964dba64f7d6b

diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx
index 2a35d6e..16f52cb 100644
--- a/include/vcl/floatwin.hxx
+++ b/include/vcl/floatwin.hxx
@@ -71,11 +71,14 @@ namespace o3tl
     template<> struct typed_flags<FloatWinPopupEndFlags> : is_typed_flags<FloatWinPopupEndFlags, 0x0f> {};
 }
 
-#define FLOATWIN_TITLE_NORMAL                   ((sal_uInt16)0x0001)
-#define FLOATWIN_TITLE_TEAROFF                  ((sal_uInt16)0x0002)
-#define FLOATWIN_TITLE_POPUP                    ((sal_uInt16)0x0004)
-#define FLOATWIN_TITLE_NONE                     ((sal_uInt16)0x0008)
-
+enum class FloatWinTitleType
+{
+    Unknown                  = 0,
+    Normal                   = 1,
+    TearOff                  = 2,
+    Popup                    = 3,
+    NONE                     = 4,
+};
 
 enum HitTest
 {
@@ -96,8 +99,8 @@ private:
     Rectangle       maFloatRect;
     ImplSVEvent *   mnPostId;
     FloatWinPopupFlags   mnPopupModeFlags;
-    sal_uInt16          mnTitle;
-    sal_uInt16          mnOldTitle;
+    FloatWinTitleType    mnTitle;
+    FloatWinTitleType    mnOldTitle;
     bool            mbInPopupMode;
     bool            mbPopupMode;
     bool            mbPopupModeCanceled;
@@ -147,8 +150,8 @@ public:
 
     virtual void    PopupModeEnd();
 
-    void            SetTitleType( sal_uInt16 nTitle );
-    sal_uInt16      GetTitleType() const { return mnTitle; }
+    void            SetTitleType( FloatWinTitleType nTitle );
+    FloatWinTitleType GetTitleType() const { return mnTitle; }
 
     void            StartPopupMode( const Rectangle& rRect, FloatWinPopupFlags nFlags = FloatWinPopupFlags::NONE );
     void            StartPopupMode( ToolBox* pBox, FloatWinPopupFlags nFlags = FloatWinPopupFlags::NONE  );
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 34d1023..413aeef 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -121,7 +121,7 @@ void FloatingWindow::ImplInit( vcl::Window* pParent, WinBits nStyle )
     mpNextFloat             = NULL;
     mpFirstPopupModeWin     = NULL;
     mnPostId                = 0;
-    mnTitle                 = (nStyle & (WB_MOVEABLE | WB_POPUP)) ? FLOATWIN_TITLE_NORMAL : FLOATWIN_TITLE_NONE;
+    mnTitle                 = (nStyle & (WB_MOVEABLE | WB_POPUP)) ? FloatWinTitleType::Normal : FloatWinTitleType::NONE;
     mnOldTitle              = mnTitle;
     mnPopupModeFlags        = FloatWinPopupFlags::NONE;
     mbInPopupMode           = false;
@@ -160,8 +160,8 @@ FloatingWindow::FloatingWindow(vcl::Window* pParent, const OString& rID, const O
     , mpImplData(0)
     , mnPostId(0)
     , mnPopupModeFlags(FloatWinPopupFlags::NONE)
-    , mnTitle(0)
-    , mnOldTitle(0)
+    , mnTitle(FloatWinTitleType::Unknown)
+    , mnOldTitle(FloatWinTitleType::Unknown)
     , mbInPopupMode(false)
     , mbPopupMode(false)
     , mbPopupModeCanceled(false)
@@ -599,20 +599,20 @@ void FloatingWindow::PopupModeEnd()
     maPopupModeEndHdl.Call( this );
 }
 
-void FloatingWindow::SetTitleType( sal_uInt16 nTitle )
+void FloatingWindow::SetTitleType( FloatWinTitleType nTitle )
 {
     if ( (mnTitle != nTitle) && mpWindowImpl->mpBorderWindow )
     {
         mnTitle = nTitle;
         Size aOutSize = GetOutputSizePixel();
         sal_uInt16 nTitleStyle;
-        if ( nTitle == FLOATWIN_TITLE_NORMAL )
+        if ( nTitle == FloatWinTitleType::Normal )
             nTitleStyle = BORDERWINDOW_TITLE_SMALL;
-        else if ( nTitle == FLOATWIN_TITLE_TEAROFF )
+        else if ( nTitle == FloatWinTitleType::TearOff )
             nTitleStyle = BORDERWINDOW_TITLE_TEAROFF;
-        else if ( nTitle == FLOATWIN_TITLE_POPUP )
+        else if ( nTitle == FloatWinTitleType::Popup )
             nTitleStyle = BORDERWINDOW_TITLE_POPUP;
-        else // nTitle == FLOATWIN_TITLE_NONE
+        else // nTitle == FloatWinTitleType::NONE
             nTitleStyle = BORDERWINDOW_TITLE_NONE;
         static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetTitleType( nTitleStyle, aOutSize );
         static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
@@ -631,11 +631,11 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, FloatWinPopupFlags
     // remove title
     mnOldTitle = mnTitle;
     if ( ( mpWindowImpl->mnStyle & WB_POPUP ) && !GetText().isEmpty() )
-        SetTitleType( FLOATWIN_TITLE_POPUP );
+        SetTitleType( FloatWinTitleType::Popup );
     else if ( nFlags & FloatWinPopupFlags::AllowTearOff )
-        SetTitleType( FLOATWIN_TITLE_TEAROFF );
+        SetTitleType( FloatWinTitleType::TearOff );
     else
-        SetTitleType( FLOATWIN_TITLE_NONE );
+        SetTitleType( FloatWinTitleType::NONE );
 
     // avoid close on focus change for decorated floating windows only
     if( mpWindowImpl->mbFrame && (GetStyle() & WB_MOVEABLE) )
diff --git a/vcl/source/window/scrwnd.cxx b/vcl/source/window/scrwnd.cxx
index 6fe7049..da613bd 100644
--- a/vcl/source/window/scrwnd.cxx
+++ b/vcl/source/window/scrwnd.cxx
@@ -57,7 +57,7 @@ ImplWheelWindow::ImplWheelWindow( vcl::Window* pParent ) :
     mnMaxWidth = (sal_uLong) ( 0.4 * hypot( (double) aSize.Width(), aSize.Height() ) );
 
     // create wheel window
-    SetTitleType( FLOATWIN_TITLE_NONE );
+    SetTitleType( FloatWinTitleType::NONE );
     ImplCreateImageList();
     ResMgr* pResMgr = ImplGetResMgr();
     Bitmap aBmp;
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index b42d724..1b95b9a 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3689,7 +3689,7 @@ bool Window::HasActiveChildFrame()
             // but FloatingWindows carry this information in their TitleType...
             // TODO: avoid duplicate WinBits !!!
             if( pChildFrame && pChildFrame->ImplIsFloatingWindow() )
-                bDecorated = static_cast<FloatingWindow*>(pChildFrame)->GetTitleType() != FLOATWIN_TITLE_NONE;
+                bDecorated = static_cast<FloatingWindow*>(pChildFrame)->GetTitleType() != FloatWinTitleType::NONE;
             if( bDecorated || (pFrameWin->mpWindowImpl->mnStyle & (WB_MOVEABLE | WB_SIZEABLE) ) )
                 if( pChildFrame && pChildFrame->IsVisible() && pChildFrame->IsActive() )
                 {


More information about the Libreoffice-commits mailing list