summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-01-08 10:50:08 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-01-08 18:15:01 +0100
commite653a084ef8693aaf8396e8d6c7fb605f5b59f94 (patch)
tree0a4d81bb9be7def61451302b3201fc369a14643f /svtools
parentc1599fc5c9800086548595d1f1464619a7024d06 (diff)
add a scheme to host welded toolbar dropdown windows in unwelded toolbars
Change-Id: I72c9896798740a760eac479bdccaf7825872c01b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86420 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/control/toolbarmenu.cxx50
-rw-r--r--svtools/source/uno/popupwindowcontroller.cxx6
2 files changed, 55 insertions, 1 deletions
diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx
index 247987305bbc..7b12d910a81e 100644
--- a/svtools/source/control/toolbarmenu.cxx
+++ b/svtools/source/control/toolbarmenu.cxx
@@ -30,6 +30,7 @@
#include <vcl/settings.hxx>
#include <vcl/commandevent.hxx>
#include <vcl/event.hxx>
+#include <vcl/svapp.hxx>
#include <svtools/framestatuslistener.hxx>
#include <svtools/valueset.hxx>
@@ -1514,8 +1515,57 @@ void ToolbarMenu::SetSelectHdl( const Link<ToolbarMenu*,void>& rLink )
mpImpl->maSelectHdl = rLink;
}
+}
+
+WeldToolbarPopup::WeldToolbarPopup(const css::uno::Reference<css::frame::XFrame>& rFrame,
+ weld::Widget* pParent, const OUString& rUIFile,
+ const OString& rId)
+ : ToolbarPopupBase(rFrame)
+ , m_xBuilder(Application::CreateBuilder(pParent, rUIFile))
+ , m_xTopLevel(m_xBuilder->weld_container(rId))
+ , m_xContainer(m_xBuilder->weld_container("container"))
+{
+ m_xTopLevel->connect_focus_in(LINK(this, WeldToolbarPopup, FocusHdl));
+}
+
+WeldToolbarPopup::~WeldToolbarPopup()
+{
+}
+
+IMPL_LINK_NOARG(WeldToolbarPopup, FocusHdl, weld::Widget&, void)
+{
+ GrabFocus();
+}
+
+InterimToolbarPopup::InterimToolbarPopup(const css::uno::Reference<css::frame::XFrame>& rFrame, vcl::Window* pParent, WeldToolbarPopup* pPopup)
+ : ToolbarPopup(rFrame, pParent, "InterimDockParent", "svx/ui/interimdockparent.ui")
+ , m_xBox(get<vcl::Window>("box"))
+ , m_xBuilder(Application::CreateInterimBuilder(m_xBox.get(), "svx/ui/interimparent.ui"))
+ , m_xContainer(m_xBuilder->weld_container("container"))
+ , m_pPopup(pPopup)
+{
+ // move the WeldToolbarPopup contents into this interim toolbar so welded contents can appear as a dropdown in an unwelded toolbar
+ m_pPopup->getTopLevel()->move(m_pPopup->getContainer(), m_xContainer.get());
+}
+void InterimToolbarPopup::GetFocus()
+{
+ ToolbarPopup::GetFocus();
+ m_pPopup->GrabFocus();
}
+void InterimToolbarPopup::dispose()
+{
+ // move the contents back where it belongs
+ m_xContainer->move(m_pPopup->getContainer(), m_pPopup->getTopLevel());
+ m_xContainer.reset();
+ m_xBox.clear();
+ ToolbarPopup::dispose();
+}
+
+InterimToolbarPopup::~InterimToolbarPopup()
+{
+ disposeOnce();
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx
index cc283adbdf42..7b1e3357424d 100644
--- a/svtools/source/uno/popupwindowcontroller.cxx
+++ b/svtools/source/uno/popupwindowcontroller.cxx
@@ -176,6 +176,7 @@ sal_Bool SAL_CALL PopupWindowController::supportsService( const OUString& Servic
// XComponent
void SAL_CALL PopupWindowController::dispose()
{
+ mxInterimPopover.clear();
mxPopover.reset();
mxImpl.reset();
svt::ToolboxController::dispose();
@@ -238,7 +239,10 @@ Reference< awt::XWindow > SAL_CALL PopupWindowController::createPopupWindow()
void PopupWindowController::EndPopupMode()
{
- m_pToolbar->set_menu_item_active(m_aCommandURL.toUtf8(), false);
+ if (m_pToolbar)
+ m_pToolbar->set_menu_item_active(m_aCommandURL.toUtf8(), false);
+ else if (mxInterimPopover)
+ mxInterimPopover->EndPopupMode();
}
}