framework/source/dispatch/windowcommanddispatch.cxx |    6 +++---
 include/vcl/cmdevt.hxx                              |   17 ++++++++++-------
 vcl/osx/salmenu.cxx                                 |   12 ++++++------
 vcl/source/window/winproc.cxx                       |    4 ++--
 4 files changed, 21 insertions(+), 18 deletions(-)

New commits:
commit cce752b1ba0c7dc3bbfcb77d78b63398246da80a
Author: Noel Grandin <n...@peralex.com>
Date:   Wed May 6 15:10:25 2015 +0200

    convert SHOWDIALOG_ID constants to scoped enum
    
    Change-Id: I58fffa7345f6b5050b8a1b3ac1022c630e64dbb4
    Reviewed-on: https://gerrit.libreoffice.org/15651
    Reviewed-by: Noel Grandin <noelgran...@gmail.com>
    Tested-by: Noel Grandin <noelgran...@gmail.com>

diff --git a/framework/source/dispatch/windowcommanddispatch.cxx 
b/framework/source/dispatch/windowcommanddispatch.cxx
index 7f961e7..6920549 100644
--- a/framework/source/dispatch/windowcommanddispatch.cxx
+++ b/framework/source/dispatch/windowcommanddispatch.cxx
@@ -114,16 +114,16 @@ IMPL_LINK(WindowCommandDispatch, impl_notifyCommand, 
void*, pParam)
     if ( ! pData)
         return 0L;
 
-    const int nCommand = pData->GetDialogId();
+    const ShowDialogId nCommand = pData->GetDialogId();
     OUString sCommand;
 
     switch (nCommand)
     {
-        case SHOWDIALOG_ID_PREFERENCES :
+        case ShowDialogId::Preferences :
                 sCommand = ".uno:OptionsTreeDialog";
                 break;
 
-        case SHOWDIALOG_ID_ABOUT :
+        case ShowDialogId::About :
                 sCommand = ".uno:About";
                 break;
 
diff --git a/include/vcl/cmdevt.hxx b/include/vcl/cmdevt.hxx
index 942d45b..fd308eb 100644
--- a/include/vcl/cmdevt.hxx
+++ b/include/vcl/cmdevt.hxx
@@ -253,21 +253,24 @@ inline CommandModKeyData::CommandModKeyData( sal_uInt16 
nCode )
 }
 
 
-// - CommanDialogData -
+// - CommandDialogData -
 
 
-#define SHOWDIALOG_ID_PREFERENCES       1
-#define SHOWDIALOG_ID_ABOUT             2
+enum class ShowDialogId
+{
+    Preferences       = 1,
+    About             = 2,
+};
 
 class VCL_DLLPUBLIC CommandDialogData
 {
-    int             m_nDialogId;
-    public:
-    CommandDialogData( int nDialogId = SHOWDIALOG_ID_PREFERENCES )
+    ShowDialogId   m_nDialogId;
+public:
+    CommandDialogData( ShowDialogId nDialogId = ShowDialogId::Preferences )
     : m_nDialogId( nDialogId )
     {}
 
-    int GetDialogId() const { return m_nDialogId; }
+    ShowDialogId GetDialogId() const { return m_nDialogId; }
 };
 
 // Media Commands
diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx
index b1e652e..61e7b76 100644
--- a/vcl/osx/salmenu.cxx
+++ b/vcl/osx/salmenu.cxx
@@ -44,13 +44,13 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = NULL;
 @interface MainMenuSelector : NSObject
 {
 }
--(void)showDialog: (int)nDialog;
+-(void)showDialog: (ShowDialogId)nDialog;
 -(void)showPreferences: (id)sender;
 -(void)showAbout: (id)sender;
 @end
 
 @implementation MainMenuSelector
--(void)showDialog: (int)nDialog
+-(void)showDialog: (ShowDialogId)nDialog
 {
     if( AquaSalMenu::pCurrentMenuBar )
     {
@@ -63,9 +63,9 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = NULL;
     else
     {
         OUString aDialog;
-        if( nDialog == SHOWDIALOG_ID_ABOUT )
+        if( nDialog == ShowDialogId::About )
             aDialog = "ABOUT";
-        else if( nDialog == SHOWDIALOG_ID_PREFERENCES )
+        else if( nDialog == ShowDialogId::Preferences )
             aDialog = "PREFERENCES";
         const ApplicationEvent* pAppEvent = new ApplicationEvent(
             ApplicationEvent::TYPE_SHOWDIALOG, aDialog);
@@ -78,14 +78,14 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = NULL;
     (void)sender;
     YIELD_GUARD;
 
-    [self showDialog: SHOWDIALOG_ID_PREFERENCES];
+    [self showDialog: ShowDialogId::Preferences];
 }
 -(void)showAbout: (id) sender
 {
     (void)sender;
     YIELD_GUARD;
 
-    [self showDialog: SHOWDIALOG_ID_ABOUT];
+    [self showDialog: ShowDialogId::About];
 }
 @end
 
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 30db414..d50093e 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -2256,7 +2256,7 @@ static void ImplHandleSalExtTextInputPos( vcl::Window* 
pWindow, SalExtTextInputP
     }
 }
 
-static bool ImplHandleShowDialog( vcl::Window* pWindow, int nDialogId )
+static bool ImplHandleShowDialog( vcl::Window* pWindow, ShowDialogId nDialogId 
)
 {
     if( ! pWindow )
         return false;
@@ -2605,7 +2605,7 @@ bool ImplWindowFrameProc( vcl::Window* _pWindow, 
SalFrame* /*pFrame*/,
             break;
         case SALEVENT_SHOWDIALOG:
             {
-                int nDialogID = 
static_cast<int>(reinterpret_cast<sal_IntPtr>(pEvent));
+                ShowDialogId nDialogID = 
static_cast<ShowDialogId>(reinterpret_cast<sal_IntPtr>(pEvent));
                 nRet = ImplHandleShowDialog( pWindow, nDialogID );
             }
             break;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to