diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-06-22 14:49:06 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-06-22 17:49:58 +0200 |
commit | ac9db25da2d78f8ecc2ce68ad622cc6012972494 (patch) | |
tree | ead17ba26a9889aabc2517bf1d66361349f07066 | |
parent | 68a37c46f21daaedcae479ccce9889ee0459e745 (diff) |
Resolves: tdf#118251 decide what parent colorpicker should have...
depending on if launched from a listbox within a dialog, or from
a (potentially) ephemeral toolbar
Change-Id: I5d3b5cc6dd501490b99b46250e2729fb8bc2a2e2
Reviewed-on: https://gerrit.libreoffice.org/56297
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/svx/colorwindow.hxx | 6 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/Condition.cxx | 1 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 19 |
3 files changed, 24 insertions, 2 deletions
diff --git a/include/svx/colorwindow.hxx b/include/svx/colorwindow.hxx index d6c0e01239bf..16fb45da4ff3 100644 --- a/include/svx/colorwindow.hxx +++ b/include/svx/colorwindow.hxx @@ -69,6 +69,7 @@ private: BorderColorStatus& mrBorderColorStatus; ColorSelectFunction maColorSelectFunction; + bool mbReuseParentForPicker; DECL_LINK( SelectHdl, ValueSet*, void ); DECL_LINK( SelectPaletteHdl, ListBox&, void); @@ -86,6 +87,11 @@ public: sal_uInt16 nSlotId, const css::uno::Reference< css::frame::XFrame >& rFrame, vcl::Window* pParentWindow, + // tdf#118251 When true, reuse pParentWindow as the parent of the color picker + // that appears from the 'custom color' button. When false use the window of + // rFrame. true is helpful when launched from a dialog, false for launched + // from a toolbar + bool bReuseParentForPicker, ColorSelectFunction const& rColorSelectFunction); virtual ~SvxColorWindow() override; virtual void dispose() override; diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx index 5a934f9bd0fa..8d4e76ba23b2 100644 --- a/reportdesign/source/ui/dlg/Condition.cxx +++ b/reportdesign/source/ui/dlg/Condition.cxx @@ -231,6 +231,7 @@ IMPL_LINK(Condition, DropdownClick, ToolBox*, pToolBox, void) nSlotId, nullptr, pToolBox, + false, m_aColorWrapper); m_pColorFloat->EnableDocking(); diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 7842897b42fa..5a9b89af6551 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -1257,6 +1257,7 @@ SvxColorWindow::SvxColorWindow(const OUString& rCommand, sal_uInt16 nSlotId, const Reference< XFrame >& rFrame, vcl::Window* pParentWindow, + bool bReuseParentForPicker, std::function<void(const OUString&, const NamedColor&)> const & aFunction): ToolbarPopup( rFrame, pParentWindow, "palette_popup_window", "svx/ui/colorwindow.ui" ), @@ -1265,7 +1266,8 @@ SvxColorWindow::SvxColorWindow(const OUString& rCommand, mxParentWindow(pParentWindow), mxPaletteManager( rPaletteManager ), mrBorderColorStatus( rBorderColorStatus ), - maColorSelectFunction(aFunction) + maColorSelectFunction(aFunction), + mbReuseParentForPicker(bReuseParentForPicker) { get(mpPaletteListBox, "palette_listbox"); get(mpButtonAutoColor, "auto_color_button"); @@ -1513,7 +1515,18 @@ IMPL_LINK_NOARG(SvxColorWindow, OpenPickerClickHdl, Button*, void) if ( IsInPopupMode() ) EndPopupMode(); - mxPaletteManager->PopupColorPicker(mxParentWindow->GetFrameWeld(), maCommand, GetSelectEntryColor().first); + + weld::Window* pParentFrame; + if (mbReuseParentForPicker) + { + pParentFrame = mxParentWindow->GetFrameWeld(); + } + else + { + const css::uno::Reference<css::awt::XWindow> xParent(mxFrame->getContainerWindow(), uno::UNO_QUERY); + pParentFrame = Application::GetFrameWeld(xParent); + } + mxPaletteManager->PopupColorPicker(pParentFrame, maCommand, GetSelectEntryColor().first); } void SvxColorWindow::StartSelection() @@ -2866,6 +2879,7 @@ VclPtr<vcl::Window> SvxColorToolBoxControl::createPopupWindow( vcl::Window* pPar m_nSlotId, m_xFrame, pParent, + false, m_aColorSelectFunction); OUString aWindowTitle = vcl::CommandInfoProvider::GetLabelForCommand( m_aCommandURL, m_sModuleName ); @@ -3386,6 +3400,7 @@ void SvxColorListBox::createColorWindow() m_nSlotId, xFrame, this, + true, m_aColorWrapper); m_xColorWindow->AddEventListener(LINK(this, SvxColorListBox, WindowEventListener)); |