framework/source/uielement/macrosmenucontroller.cxx |   16 ++++------------
 framework/source/uielement/objectmenucontroller.cxx |   13 +------------
 2 files changed, 5 insertions(+), 24 deletions(-)

New commits:
commit b7d12aab92b919e3b8a68be2ce2c7599f1d9dc7f
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Nov 29 11:13:33 2021 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Nov 29 21:18:13 2021 +0100

    can use css::awt::XPopupMenu::setCommand
    
    instead of PopupMenu::SetItemCommand since...
    
    commit 9aa4101c53e483be1d25c1e5aaad2cf542540a56
    Date:   Wed Feb 25 16:57:46 2004 +0000
    
        INTEGRATION: CWS layoutmanager (1.3.146); FILE MERGED
        2004/01/19 10:03:03 cd 1.3.146.2: #111899# Added new interface
    to support set/get commands/help URL
    
    Change-Id: I3ec9126aa601a30bf6376a18659c81198b78c4d4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126039
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/framework/source/uielement/objectmenucontroller.cxx 
b/framework/source/uielement/objectmenucontroller.cxx
index 7300eab60030..62b5586eeea9 100644
--- a/framework/source/uielement/objectmenucontroller.cxx
+++ b/framework/source/uielement/objectmenucontroller.cxx
@@ -23,10 +23,8 @@
 #include <com/sun/star/embed/VerbDescriptor.hpp>
 
 #include <svtools/popupmenucontrollerbase.hxx>
-#include <toolkit/awt/vclxmenu.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <cppuhelper/weak.hxx>
-#include <vcl/menu.hxx>
 #include <vcl/svapp.hxx>
 #include <osl/mutex.hxx>
 
@@ -81,17 +79,10 @@ ObjectMenuController::ObjectMenuController( const 
css::uno::Reference< css::uno:
 void ObjectMenuController::fillPopupMenu( const Sequence< 
css::embed::VerbDescriptor >& rVerbCommandSeq, Reference< css::awt::XPopupMenu 
> const & rPopupMenu )
 {
     const css::embed::VerbDescriptor* pVerbCommandArray = 
rVerbCommandSeq.getConstArray();
-    VCLXPopupMenu*                    pPopupMenu        = 
static_cast<VCLXPopupMenu *>(comphelper::getFromUnoTunnel<VCLXMenu>( rPopupMenu 
));
-    PopupMenu*                        pVCLPopupMenu     = nullptr;
 
     SolarMutexGuard aSolarMutexGuard;
 
     resetPopupMenu( rPopupMenu );
-    if ( pPopupMenu )
-        pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
-
-    if ( !pVCLPopupMenu )
-        return;
 
     static const OUStringLiteral aVerbCommand( 
u".uno:ObjectMenue?VerbID:short=" );
     for ( sal_Int32 i = 0; i < rVerbCommandSeq.getLength(); i++ )
@@ -100,10 +91,8 @@ void ObjectMenuController::fillPopupMenu( const Sequence< 
css::embed::VerbDescri
         if ( rVerb.VerbAttributes & 
css::embed::VerbAttributes::MS_VERBATTR_ONCONTAINERMENU )
         {
             m_xPopupMenu->insertItem( i+1, rVerb.VerbName, 0, i );
-            // use VCL popup menu pointer to set vital information that are 
not part of the awt implementation
-
             OUString aCommand = aVerbCommand + OUString::number( rVerb.VerbID 
);
-            pVCLPopupMenu->SetItemCommand( i+1, aCommand ); // Store verb 
command
+            m_xPopupMenu->setCommand( i+1, aCommand ); // Store verb command
         }
     }
 }
commit d521438710cf977b21dcec71d78bbfac966a1061
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Nov 29 11:10:51 2021 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Nov 29 21:17:59 2021 +0100

    can use css::awt::XPopupMenu::setCommand
    
    instead of PopupMenu::SetItemCommand since...
    
    commit 9aa4101c53e483be1d25c1e5aaad2cf542540a56
    Date:   Wed Feb 25 16:57:46 2004 +0000
    
        INTEGRATION: CWS layoutmanager (1.3.146); FILE MERGED
        2004/01/19 10:03:03 cd 1.3.146.2: #111899# Added new interface
    to support set/get commands/help URL
    
    Change-Id: I527d2ad2a12f7933d5e2cd892b26e96e284a0631
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126038
    Tested-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/framework/source/uielement/macrosmenucontroller.cxx 
b/framework/source/uielement/macrosmenucontroller.cxx
index cddfed74c693..a0745b1e4f6f 100644
--- a/framework/source/uielement/macrosmenucontroller.cxx
+++ b/framework/source/uielement/macrosmenucontroller.cxx
@@ -23,7 +23,6 @@
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <officecfg/Office/Common.hxx>
-#include <toolkit/awt/vclxmenu.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/commandinfoprovider.hxx>
 #include <osl/mutex.hxx>
@@ -74,24 +73,17 @@ void MacrosMenuController::fillPopupMenu( Reference< 
css::awt::XPopupMenu > cons
     if (bMacrosDisabled)
         return;
 
-    VCLXPopupMenu* pVCLPopupMenu = static_cast<VCLXPopupMenu 
*>(comphelper::getFromUnoTunnel<VCLXMenu>( rPopupMenu ));
-    PopupMenu*     pPopupMenu    = nullptr;
-
     SolarMutexGuard aSolarMutexGuard;
 
-    resetPopupMenu( rPopupMenu );
-    if ( pVCLPopupMenu )
-        pPopupMenu = static_cast<PopupMenu *>(pVCLPopupMenu->GetMenu());
-
-    if (!pPopupMenu)
-        return;
+    resetPopupMenu(rPopupMenu);
+    assert(rPopupMenu->getItemCount() == 0);
 
     // insert basic
     OUString aCommand(".uno:MacroDialog");
     auto aProperties = 
vcl::CommandInfoProvider::GetCommandProperties(aCommand, m_aModuleName);
     OUString aDisplayName = 
vcl::CommandInfoProvider::GetMenuLabelForCommand(aProperties);
-    pPopupMenu->InsertItem( 2, aDisplayName );
-    pPopupMenu->SetItemCommand( 2, aCommand );
+    rPopupMenu->insertItem(2, aDisplayName, 0, 0);
+    rPopupMenu->setCommand(2, aCommand);
 
     // insert providers but not basic or java
     addScriptItems(rPopupMenu, 4);

Reply via email to