Kaydet (Commit) 0045ee9b authored tarafından Noel Grandin's avatar Noel Grandin

convert ColorPickerMode to scoped enum

and drop unused Add constant

Change-Id: I4e4f0d35e4d081883b78e0205ffd7086c9cadf04
Reviewed-on: https://gerrit.libreoffice.org/46587Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 65102921
...@@ -424,7 +424,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickWorkOnHdl_Impl, Button*, void) ...@@ -424,7 +424,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickWorkOnHdl_Impl, Button*, void)
std::unique_ptr<SvColorDialog> pColorDlg(new SvColorDialog( GetParentDialog() )); std::unique_ptr<SvColorDialog> pColorDlg(new SvColorDialog( GetParentDialog() ));
pColorDlg->SetColor (aCurrentColor); pColorDlg->SetColor (aCurrentColor);
pColorDlg->SetMode( svtools::ColorPickerMode_MODIFY ); pColorDlg->SetMode( svtools::ColorPickerMode::Modify );
if( pColorDlg->Execute() == RET_OK ) if( pColorDlg->Execute() == RET_OK )
{ {
......
...@@ -28,8 +28,9 @@ namespace vcl { class Window; } ...@@ -28,8 +28,9 @@ namespace vcl { class Window; }
namespace svtools namespace svtools
{ {
// SELECT is the default // Select is the default.
enum ColorPickerMode { ColorPickerMode_SELECT = 0, ColorPickerMode_ADD = 1, ColorPickerMode_MODIFY = 2 }; // 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 class SVT_DLLPUBLIC SvColorDialog final
...@@ -41,14 +42,14 @@ public: ...@@ -41,14 +42,14 @@ public:
void SetColor( const Color& rColor ); void SetColor( const Color& rColor );
const Color& GetColor() const { return maColor;} const Color& GetColor() const { return maColor;}
void SetMode( sal_Int16 eMode ); void SetMode( svtools::ColorPickerMode eMode );
short Execute(); short Execute();
private: private:
VclPtr<vcl::Window> mpParent; VclPtr<vcl::Window> mpParent;
Color maColor; Color maColor;
sal_Int16 meMode; svtools::ColorPickerMode meMode;
}; };
#endif // INCLUDED_SVTOOLS_COLRDLG_HXX #endif // INCLUDED_SVTOOLS_COLRDLG_HXX
......
...@@ -39,7 +39,7 @@ using namespace ::com::sun::star::ui::dialogs; ...@@ -39,7 +39,7 @@ using namespace ::com::sun::star::ui::dialogs;
SvColorDialog::SvColorDialog( vcl::Window* pWindow ) SvColorDialog::SvColorDialog( vcl::Window* pWindow )
: mpParent( pWindow ) : mpParent( pWindow )
, meMode( svtools::ColorPickerMode_SELECT ) , meMode( svtools::ColorPickerMode::Select )
{ {
} }
...@@ -53,7 +53,7 @@ void SvColorDialog::SetColor( const Color& rColor ) ...@@ -53,7 +53,7 @@ void SvColorDialog::SetColor( const Color& rColor )
} }
void SvColorDialog::SetMode( sal_Int16 eMode ) void SvColorDialog::SetMode( svtools::ColorPickerMode eMode )
{ {
meMode = eMode; meMode = eMode;
} }
...@@ -76,7 +76,7 @@ short SvColorDialog::Execute() ...@@ -76,7 +76,7 @@ short SvColorDialog::Execute()
props[0].Name = sColor; props[0].Name = sColor;
props[0].Value <<= (sal_Int32) maColor.GetColor(); props[0].Value <<= (sal_Int32) maColor.GetColor();
props[1].Name = "Mode"; props[1].Name = "Mode";
props[1].Value <<= meMode; props[1].Value <<= static_cast<sal_Int16>(meMode);
xPropertyAccess->setPropertyValues( props ); xPropertyAccess->setPropertyValues( props );
......
...@@ -311,7 +311,7 @@ void PaletteManager::PopupColorPicker(const OUString& aCommand, const Color& rIn ...@@ -311,7 +311,7 @@ void PaletteManager::PopupColorPicker(const OUString& aCommand, const Color& rIn
OUString aCommandCopy = aCommand; OUString aCommandCopy = aCommand;
SvColorDialog aColorDlg( nullptr ); SvColorDialog aColorDlg( nullptr );
aColorDlg.SetColor(rInitialColor); aColorDlg.SetColor(rInitialColor);
aColorDlg.SetMode(svtools::ColorPickerMode_MODIFY); aColorDlg.SetMode(svtools::ColorPickerMode::Modify);
if( aColorDlg.Execute() == RET_OK ) if( aColorDlg.Execute() == RET_OK )
{ {
if (mpBtnUpdater) if (mpBtnUpdater)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment