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

Noel Grandin noel at peralex.com
Wed May 11 09:13:00 UTC 2016


 cui/source/dialogs/dlgname.cxx   |    9 +++------
 cui/source/inc/defdlgname.hxx    |    4 ----
 cui/source/inc/dlgname.hxx       |    6 +++++-
 cui/source/tabpages/tpbitmap.cxx |    4 ++--
 cui/source/tabpages/tpcolor.cxx  |    4 ++--
 cui/source/tabpages/tpgradnt.cxx |    4 ++--
 cui/source/tabpages/tphatch.cxx  |    4 ++--
 cui/source/tabpages/tplnedef.cxx |    4 ++--
 8 files changed, 18 insertions(+), 21 deletions(-)

New commits:
commit 08234bab5e3287724344cd127ea88090561d9fc0
Author: Noel Grandin <noel at peralex.com>
Date:   Wed May 11 11:11:40 2016 +0200

    Convert MESS_BTN to scoped enum
    
    Change-Id: I9332216f58268b20b3b8e9488471279d70c519ad

diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx
index 3ff72b7..6772f44 100644
--- a/cui/source/dialogs/dlgname.cxx
+++ b/cui/source/dialogs/dlgname.cxx
@@ -202,20 +202,17 @@ IMPL_LINK_NOARG_TYPED(SvxMessDialog, Button2Hdl, Button*, void)
 
 /*************************************************************************/
 
-void SvxMessDialog::SetButtonText( sal_uInt16 nBtnId, const OUString& rNewTxt )
+void SvxMessDialog::SetButtonText( SvxMessDialogButton nBtnId, const OUString& rNewTxt )
 {
     switch ( nBtnId )
     {
-        case MESS_BTN_1:
+        case SvxMessDialogButton::N1:
             pBtn1->SetText( rNewTxt );
             break;
 
-        case MESS_BTN_2:
+        case SvxMessDialogButton::N2:
             pBtn2->SetText( rNewTxt );
             break;
-
-        default:
-            OSL_FAIL( "Invalid button number!!!" );
     }
 }
 
diff --git a/cui/source/inc/defdlgname.hxx b/cui/source/inc/defdlgname.hxx
index 432ba46..08aa424 100644
--- a/cui/source/inc/defdlgname.hxx
+++ b/cui/source/inc/defdlgname.hxx
@@ -19,10 +19,6 @@
 #ifndef INCLUDED_CUI_SOURCE_INC_DEFDLGNAME_HXX
 #define INCLUDED_CUI_SOURCE_INC_DEFDLGNAME_HXX
 
-// define ----------------------------------------------------------------
-
-#define MESS_BTN_1  ((sal_uInt16)0)
-#define MESS_BTN_2  ((sal_uInt16)1)
 
 // const -----------------------------------------------------------------
 
diff --git a/cui/source/inc/dlgname.hxx b/cui/source/inc/dlgname.hxx
index 3576b29..ac183a8 100644
--- a/cui/source/inc/dlgname.hxx
+++ b/cui/source/inc/dlgname.hxx
@@ -124,6 +124,10 @@ public:
     void GetDescription(OUString& rDescription) {rDescription = pEdtDescription->GetText(); }
 };
 
+enum class SvxMessDialogButton {
+    N1, N2
+};
+
 /// Dialog to cancel, save, or add
 class SvxMessDialog : public ModalDialog
 {
@@ -142,7 +146,7 @@ public:
     virtual ~SvxMessDialog();
     virtual void dispose() override;
 
-    void    SetButtonText( sal_uInt16 nBtnId, const OUString& rNewTxt );
+    void    SetButtonText( SvxMessDialogButton nBtnId, const OUString& rNewTxt );
 };
 
 
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index 0733247..163c0cf 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -440,8 +440,8 @@ long SvxBitmapTabPage::CheckChanges_Impl()
                                                           CUI_RES( RID_SVXSTR_ASK_CHANGE_BITMAP ),
                                                           &aWarningBoxImage );
             DBG_ASSERT(aMessDlg, "Dialog creation failed!");
-            aMessDlg->SetButtonText( MESS_BTN_1, ResId( RID_SVXSTR_CHANGE, rMgr ) );
-            aMessDlg->SetButtonText( MESS_BTN_2, ResId( RID_SVXSTR_ADD, rMgr ) );
+            aMessDlg->SetButtonText( SvxMessDialogButton::N1, ResId( RID_SVXSTR_CHANGE, rMgr ) );
+            aMessDlg->SetButtonText( SvxMessDialogButton::N2, ResId( RID_SVXSTR_ADD, rMgr ) );
 
             short nRet = aMessDlg->Execute();
 
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index 033dbf1..a84a182 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -540,9 +540,9 @@ long SvxColorTabPage::CheckChanges_Impl()
                                                           SVX_RESSTR( RID_SVXSTR_COLOR ),
                                                           ResId( RID_SVXSTR_ASK_CHANGE_COLOR, rMgr ),
                                                           &aWarningBoxImage );
-            aMessDlg->SetButtonText( MESS_BTN_1,
+            aMessDlg->SetButtonText( SvxMessDialogButton::N1,
                                     ResId( RID_SVXSTR_CHANGE, rMgr ) );
-            aMessDlg->SetButtonText( MESS_BTN_2,
+            aMessDlg->SetButtonText( SvxMessDialogButton::N2,
                                     ResId( RID_SVXSTR_ADD, rMgr ) );
 
             short nRet = aMessDlg->Execute();
diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx
index b7fee0d..e235640 100644
--- a/cui/source/tabpages/tpgradnt.cxx
+++ b/cui/source/tabpages/tpgradnt.cxx
@@ -292,9 +292,9 @@ long SvxGradientTabPage::CheckChanges_Impl()
                                                           CUI_RESSTR( RID_SVXSTR_ASK_CHANGE_GRADIENT ),
                                                           &aWarningBoxImage );
             DBG_ASSERT(aMessDlg, "Dialog creation failed!");
-            aMessDlg->SetButtonText( MESS_BTN_1,
+            aMessDlg->SetButtonText( SvxMessDialogButton::N1,
                                     OUString( ResId( RID_SVXSTR_CHANGE, rMgr ) ) );
-            aMessDlg->SetButtonText( MESS_BTN_2,
+            aMessDlg->SetButtonText( SvxMessDialogButton::N2,
                                     OUString( ResId( RID_SVXSTR_ADD, rMgr ) ) );
 
             short nRet = aMessDlg->Execute();
diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx
index 6700093..766ac7a 100644
--- a/cui/source/tabpages/tphatch.cxx
+++ b/cui/source/tabpages/tphatch.cxx
@@ -262,9 +262,9 @@ long SvxHatchTabPage::CheckChanges_Impl()
                                                       CUI_RESSTR( RID_SVXSTR_ASK_CHANGE_HATCH ),
                                                       &aWarningBoxImage );
         DBG_ASSERT(aMessDlg, "Dialog creation failed!");
-        aMessDlg->SetButtonText( MESS_BTN_1,
+        aMessDlg->SetButtonText( SvxMessDialogButton::N1,
                                 OUString( ResId( RID_SVXSTR_CHANGE, rMgr ) ) );
-        aMessDlg->SetButtonText( MESS_BTN_2,
+        aMessDlg->SetButtonText( SvxMessDialogButton::N2,
                                 OUString( ResId( RID_SVXSTR_ADD, rMgr ) ) );
 
         short nRet = aMessDlg->Execute();
diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx
index 46198f9..daa5b3e 100644
--- a/cui/source/tabpages/tplnedef.cxx
+++ b/cui/source/tabpages/tplnedef.cxx
@@ -246,8 +246,8 @@ void SvxLineDefTabPage::CheckChanges_Impl()
                                                       OUString( ResId( RID_SVXSTR_ASK_CHANGE_LINESTYLE, rMgr ) ),
                                                       &aWarningBoxImage );
         DBG_ASSERT(aMessDlg, "Dialog creation failed!");
-        aMessDlg->SetButtonText( MESS_BTN_1, OUString( ResId( RID_SVXSTR_CHANGE, rMgr ) ) );
-        aMessDlg->SetButtonText( MESS_BTN_2, OUString( ResId( RID_SVXSTR_ADD, rMgr ) ) );
+        aMessDlg->SetButtonText( SvxMessDialogButton::N1, OUString( ResId( RID_SVXSTR_CHANGE, rMgr ) ) );
+        aMessDlg->SetButtonText( SvxMessDialogButton::N2, OUString( ResId( RID_SVXSTR_ADD, rMgr ) ) );
 
         short nRet = aMessDlg->Execute();
 


More information about the Libreoffice-commits mailing list