[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - include/svx reportdesign/source svx/source
Caolán McNamara
caolanm at redhat.com
Fri Jun 22 20:14:38 UTC 2018
include/svx/colorwindow.hxx | 6 ++++++
reportdesign/source/ui/dlg/Condition.cxx | 1 +
svx/source/tbxctrls/tbcontrl.cxx | 19 +++++++++++++++++--
3 files changed, 24 insertions(+), 2 deletions(-)
New commits:
commit 565f5d40c83ca30fcd2f28359e0f1df0b4cbb9fe
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 22 14:49:06 2018 +0100
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 at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
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 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));
More information about the Libreoffice-commits
mailing list