diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2021-07-16 10:06:43 +0200 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2021-08-19 10:02:15 +0200 |
commit | f54ccf09a5073b6e544c976da68de0c9fc0bdf6c (patch) | |
tree | 63f5c2db742cb8c53cb8763e15e535c578d58ac6 /svx | |
parent | abd08d042fb397fbf97b93d8ca1a6426c1b304e6 (diff) |
Make Custom Color Picker dialog async
- now supports also XAsynchronousExecutableDialog
- inherits from SfxDialogController to attach correct LOKNotifier
Change-Id: Ic21db4057b8087d74a437b1c8ec95408ade5264d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119012
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120670
Tested-by: Jenkins
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/tbxctrls/PaletteManager.cxx | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx index 4084dffc993c..7bb067952438 100644 --- a/svx/source/tbxctrls/PaletteManager.cxx +++ b/svx/source/tbxctrls/PaletteManager.cxx @@ -28,7 +28,6 @@ #include <svx/svxids.hrc> #include <svx/dialmgr.hxx> #include <tbxcolorupdate.hxx> -#include <svtools/colrdlg.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include <stack> @@ -301,19 +300,21 @@ void PaletteManager::PopupColorPicker(weld::Window* pParent, const OUString& aCo { // The calling object goes away during aColorDlg.Execute(), so we must copy this OUString aCommandCopy = aCommand; - SvColorDialog aColorDlg; - aColorDlg.SetColor(rInitialColor); - aColorDlg.SetMode(svtools::ColorPickerMode::Modify); - if (aColorDlg.Execute(pParent) == RET_OK) - { - Color aLastColor = aColorDlg.GetColor(); - OUString sColorName = "#" + aLastColor.AsRGBHexString().toAsciiUpperCase(); - NamedColor aNamedColor = std::make_pair(aLastColor, sColorName); - if (mpBtnUpdater) - mpBtnUpdater->Update(aNamedColor); - AddRecentColor(aLastColor, sColorName); - maColorSelectFunction(aCommandCopy, aNamedColor); - } + m_pColorDlg = std::make_unique<SvColorDialog>(); + m_pColorDlg->SetColor(rInitialColor); + m_pColorDlg->SetMode(svtools::ColorPickerMode::Modify); + m_pColorDlg->ExecuteAsync(pParent, [this, aCommandCopy] (sal_Int32 nResult) { + if (nResult == RET_OK) + { + Color aLastColor = m_pColorDlg->GetColor(); + OUString sColorName = "#" + aLastColor.AsRGBHexString().toAsciiUpperCase(); + NamedColor aNamedColor = std::make_pair(aLastColor, sColorName); + if (mpBtnUpdater) + mpBtnUpdater->Update(aNamedColor); + AddRecentColor(aLastColor, sColorName); + maColorSelectFunction(aCommandCopy, aNamedColor); + } + }); } void PaletteManager::DispatchColorCommand(const OUString& aCommand, const NamedColor& rColor) |