diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-12-30 19:48:20 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-12-31 12:06:25 +0100 |
commit | b6c0cad80986ddbd7e62b07c51816c1df7031831 (patch) | |
tree | 698b4cd56e86597fea2b23eb6c67f5c52ec6dc70 | |
parent | 444f0d256957544d26b9af9a0898364e829df1b5 (diff) |
support welded toolbar popovers in PopupWindowController
Change-Id: Ie3d9f281d66592a063f179637c99814ef8745c42
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86037
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | svtools/source/uno/popupwindowcontroller.cxx | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx index c266600546d5..0ffb2f5871cd 100644 --- a/svtools/source/uno/popupwindowcontroller.cxx +++ b/svtools/source/uno/popupwindowcontroller.cxx @@ -20,8 +20,9 @@ #include <cppuhelper/supportsservice.hxx> #include <toolkit/helper/vclunohelper.hxx> -#include <vcl/toolbox.hxx> #include <vcl/svapp.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/weldutils.hxx> #include <svtools/popupwindowcontroller.hxx> @@ -180,12 +181,23 @@ void SAL_CALL PopupWindowController::dispose() // XStatusListener void SAL_CALL PopupWindowController::statusChanged( const frame::FeatureStateEvent& rEvent ) { + bool bValue = false; + rEvent.State >>= bValue; + + if (weld::TransportAsXWindow* pTunnel = dynamic_cast<weld::TransportAsXWindow*>(getParent().get())) + { + auto pToolbar = dynamic_cast<weld::Toolbar*>(pTunnel->getWidget()); + assert(pToolbar && "must be a toolbar"); + OString sId = m_aCommandURL.toUtf8(); + pToolbar->set_item_active(sId, bValue); + pToolbar->set_item_sensitive(sId, rEvent.IsEnabled); + return; + } + ToolBox* pToolBox = nullptr; sal_uInt16 nItemId = 0; if ( getToolboxId( nItemId, &pToolBox ) ) { - bool bValue = false; - rEvent.State >>= bValue; pToolBox->CheckItem( nItemId, bValue ); pToolBox->EnableItem( nItemId, rEvent.IsEnabled ); } |