From 0045ee9b7f028dba5f9a3cad43125c9154169ef0 Mon Sep 17 00:00:00 2001
From: Noel Grandin <noel.grandin@collabora.co.uk>
Date: Fri, 15 Dec 2017 15:13:56 +0200
Subject: convert ColorPickerMode to scoped enum

and drop unused Add constant

Change-Id: I4e4f0d35e4d081883b78e0205ffd7086c9cadf04
Reviewed-on: https://gerrit.libreoffice.org/46587
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
---
 cui/source/tabpages/tpcolor.cxx        | 2 +-
 include/svtools/colrdlg.hxx            | 9 +++++----
 svtools/source/dialogs/colrdlg.cxx     | 6 +++---
 svx/source/tbxctrls/PaletteManager.cxx | 2 +-
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index 185f28fcfcc4..055bf4f19af8 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -424,7 +424,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickWorkOnHdl_Impl, Button*, void)
     std::unique_ptr<SvColorDialog> pColorDlg(new SvColorDialog( GetParentDialog() ));
 
     pColorDlg->SetColor (aCurrentColor);
-    pColorDlg->SetMode( svtools::ColorPickerMode_MODIFY );
+    pColorDlg->SetMode( svtools::ColorPickerMode::Modify );
 
     if( pColorDlg->Execute() == RET_OK )
     {
diff --git a/include/svtools/colrdlg.hxx b/include/svtools/colrdlg.hxx
index af7c27c6b441..69def8510b35 100644
--- a/include/svtools/colrdlg.hxx
+++ b/include/svtools/colrdlg.hxx
@@ -28,8 +28,9 @@ namespace vcl { class Window; }
 
 namespace svtools
 {
-    // SELECT is the default
-    enum ColorPickerMode { ColorPickerMode_SELECT = 0, ColorPickerMode_ADD = 1, ColorPickerMode_MODIFY = 2 };
+    // Select is the default.
+    // These values must match the constants used in ColorPickerDialog in cui/source/dialogs/colorpicker.cxx
+    enum class ColorPickerMode { Select = 0, Modify = 2 };
 }
 
 class SVT_DLLPUBLIC SvColorDialog final
@@ -41,14 +42,14 @@ public:
     void            SetColor( const Color& rColor );
     const Color&    GetColor() const { return maColor;}
 
-    void            SetMode( sal_Int16 eMode );
+    void            SetMode( svtools::ColorPickerMode eMode );
 
     short           Execute();
 
 private:
     VclPtr<vcl::Window> mpParent;
     Color               maColor;
-    sal_Int16           meMode;
+    svtools::ColorPickerMode meMode;
 };
 
 #endif // INCLUDED_SVTOOLS_COLRDLG_HXX
diff --git a/svtools/source/dialogs/colrdlg.cxx b/svtools/source/dialogs/colrdlg.cxx
index be1ceb111af6..a0d4af23f78f 100644
--- a/svtools/source/dialogs/colrdlg.cxx
+++ b/svtools/source/dialogs/colrdlg.cxx
@@ -39,7 +39,7 @@ using namespace ::com::sun::star::ui::dialogs;
 
 SvColorDialog::SvColorDialog( vcl::Window* pWindow )
 : mpParent( pWindow )
-, meMode( svtools::ColorPickerMode_SELECT )
+, meMode( svtools::ColorPickerMode::Select )
 {
 }
 
@@ -53,7 +53,7 @@ void SvColorDialog::SetColor( const Color& rColor )
 }
 
 
-void SvColorDialog::SetMode( sal_Int16 eMode )
+void SvColorDialog::SetMode( svtools::ColorPickerMode eMode )
 {
     meMode = eMode;
 }
@@ -76,7 +76,7 @@ short SvColorDialog::Execute()
         props[0].Name = sColor;
         props[0].Value <<= (sal_Int32) maColor.GetColor();
         props[1].Name = "Mode";
-        props[1].Value <<= meMode;
+        props[1].Value <<= static_cast<sal_Int16>(meMode);
 
         xPropertyAccess->setPropertyValues( props );
 
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx
index 35b376c3839c..a275670e33c1 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -311,7 +311,7 @@ void PaletteManager::PopupColorPicker(const OUString& aCommand, const Color& rIn
     OUString aCommandCopy = aCommand;
     SvColorDialog aColorDlg( nullptr );
     aColorDlg.SetColor(rInitialColor);
-    aColorDlg.SetMode(svtools::ColorPickerMode_MODIFY);
+    aColorDlg.SetMode(svtools::ColorPickerMode::Modify);
     if( aColorDlg.Execute() == RET_OK )
     {
         if (mpBtnUpdater)
-- 
cgit