[Libreoffice-commits] core.git: chart2/source
Tamás Zolnai (via logerrit)
logerrit at kemper.freedesktop.org
Sun Nov 24 12:53:39 UTC 2019
chart2/source/controller/inc/CommandDispatchContainer.hxx | 2 +
chart2/source/controller/main/ChartController_Window.cxx | 13 ++++++++++++
chart2/source/controller/main/ControllerCommandDispatch.hxx | 3 +-
3 files changed, 17 insertions(+), 1 deletion(-)
New commits:
commit 4582222a3ade99584514a86dbaddf0c80f7e7196
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Nov 22 18:05:26 2019 +0100
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Sun Nov 24 13:52:32 2019 +0100
lok: Chart context menu: Disable menu items which are not available.
Change-Id: Id7487c581759389e66ca513381d6706f3ae49980
Reviewed-on: https://gerrit.libreoffice.org/83605
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>
diff --git a/chart2/source/controller/inc/CommandDispatchContainer.hxx b/chart2/source/controller/inc/CommandDispatchContainer.hxx
index 72c2daaa9367..9d6cd7e2e97b 100644
--- a/chart2/source/controller/inc/CommandDispatchContainer.hxx
+++ b/chart2/source/controller/inc/CommandDispatchContainer.hxx
@@ -103,6 +103,8 @@ public:
const css::uno::Reference< css::frame::XController > & xChartController,
const css::util::URL & rURL );
+ css::uno::Reference< css::frame::XDispatch > getChartDispatcher() { return m_xChartDispatcher; }
+
void setDrawCommandDispatch( DrawCommandDispatch* pDispatch );
DrawCommandDispatch* getDrawCommandDispatch() { return m_pDrawCommandDispatch; }
void setShapeController( ShapeController* pController );
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index c4f20d871aa7..9266e61005c7 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -44,6 +44,7 @@
#include <servicenames_charttypes.hxx>
#include "DrawCommandDispatch.hxx"
#include <PopupRequest.hxx>
+#include "ControllerCommandDispatch.hxx"
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/chart2/RelativeSize.hpp>
@@ -1283,6 +1284,18 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
if (SfxViewShell* pViewShell = SfxViewShell::Current())
{
PopupMenu* pPopupMenu = static_cast<PopupMenu*>(comphelper::getUnoTunnelImplementation<VCLXMenu>(xPopupMenu)->GetMenu());
+ ControllerCommandDispatch* pCommandDispatch = dynamic_cast<ControllerCommandDispatch*>(m_aDispatchContainer.getChartDispatcher().get());
+ if(pCommandDispatch)
+ {
+ for (sal_uInt16 nPos = 0; nPos < pPopupMenu->GetItemCount(); nPos++)
+ {
+ const sal_uInt16 nItemId = pPopupMenu->GetItemId(nPos);
+ OUString aCommandURL = pPopupMenu->GetItemCommand(nItemId);
+ if(!pCommandDispatch->commandAvailable(aCommandURL))
+ pPopupMenu->EnableItem(nItemId, false);
+ }
+ }
+
boost::property_tree::ptree aMenu = SfxDispatcher::fillPopupMenu(pPopupMenu);
boost::property_tree::ptree aRoot;
aRoot.add_child("menu", aMenu);
diff --git a/chart2/source/controller/main/ControllerCommandDispatch.hxx b/chart2/source/controller/main/ControllerCommandDispatch.hxx
index 4e105f86702c..b2f2a5e3dc51 100644
--- a/chart2/source/controller/main/ControllerCommandDispatch.hxx
+++ b/chart2/source/controller/main/ControllerCommandDispatch.hxx
@@ -65,6 +65,8 @@ public:
// late initialisation, especially for adding as listener
virtual void initialize() override;
+ bool commandAvailable( const OUString & rCommand );
+
protected:
// ____ XDispatch ____
virtual void SAL_CALL dispatch(
@@ -96,7 +98,6 @@ private:
const OUString & rURL,
const css::uno::Reference< css::frame::XStatusListener > & xSingleListener );
- bool commandAvailable( const OUString & rCommand );
void updateCommandAvailability();
bool isShapeControllerCommandAvailable( const OUString& rCommand );
More information about the Libreoffice-commits
mailing list