[Libreoffice-commits] core.git: chart2/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Feb 23 19:19:35 UTC 2021


 chart2/source/controller/main/ChartController_Window.cxx |   15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

New commits:
commit 288e8e9c291160916d26a559ff01a176fa9b9bec
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Feb 23 14:32:30 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Feb 23 20:18:49 2021 +0100

    we don't need the PopupMenu to derive the info we need here
    
    Change-Id: Idc8b658ee4b8cb983dbc95f8614141402811ac3a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111406
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index d9879174656d..a8d71e903fd3 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -78,7 +78,6 @@
 #include <svx/svddrgmt.hxx>
 #include <vcl/commandevent.hxx>
 #include <vcl/event.hxx>
-#include <vcl/menu.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/weld.hxx>
@@ -1289,19 +1288,19 @@ 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)
+                if (pCommandDispatch)
                 {
-                    for (sal_uInt16 nPos = 0; nPos < pPopupMenu->GetItemCount(); nPos++)
+                    for (int nPos = 0, nCount = xPopupMenu->getItemCount(); nPos < nCount; ++nPos)
                     {
-                        const sal_uInt16 nItemId = pPopupMenu->GetItemId(nPos);
-                        OUString aCommandURL = pPopupMenu->GetItemCommand(nItemId);
-                        if(!pCommandDispatch->commandAvailable(aCommandURL))
-                            pPopupMenu->EnableItem(nItemId, false);
+                        auto nItemId = xPopupMenu->getItemId(nPos);
+                        OUString aCommandURL = xPopupMenu->getCommand(nItemId);
+                        if (!pCommandDispatch->commandAvailable(aCommandURL))
+                            xPopupMenu->enableItem(nItemId, false);
                     }
                 }
 
+                Menu* pPopupMenu = comphelper::getUnoTunnelImplementation<VCLXMenu>(xPopupMenu)->GetMenu();
                 boost::property_tree::ptree aMenu = SfxDispatcher::fillPopupMenu(pPopupMenu);
                 boost::property_tree::ptree aRoot;
                 aRoot.add_child("menu", aMenu);


More information about the Libreoffice-commits mailing list