diff options
-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 ); } |