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 22:14:10 +0200 |
commit | 565f5d40c83ca30fcd2f28359e0f1df0b4cbb9fe (patch) | |
tree | 753893561dd25380645e76adb086077e0933ae57 /svx | |
parent | 55ce334d65baebcf523d1a825004d35385c637d0 (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/56301
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index b9e58be778ae..9b67a77d87ba 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() @@ -2872,6 +2885,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 ); @@ -3392,6 +3406,7 @@ void SvxColorListBox::createColorWindow() m_nSlotId, xFrame, this, + true, m_aColorWrapper); m_xColorWindow->AddEventListener(LINK(this, SvxColorListBox, WindowEventListener)); |