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>
This commit is contained in:
parent
68a37c46f2
commit
ac9db25da2
3 changed files with 24 additions and 2 deletions
|
@ -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;
|
||||
|
|
|
@ -231,6 +231,7 @@ IMPL_LINK(Condition, DropdownClick, ToolBox*, pToolBox, void)
|
|||
nSlotId,
|
||||
nullptr,
|
||||
pToolBox,
|
||||
false,
|
||||
m_aColorWrapper);
|
||||
|
||||
m_pColorFloat->EnableDocking();
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue