diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-12-12 21:25:54 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-12-13 10:03:12 +0100 |
commit | 984ad86e71a5abb0df7a2c14c61a270e956cba0f (patch) | |
tree | 820a96374938f670b3a6e53288d3b3ef9f110e8c /framework/source/uielement | |
parent | 9f326792c165ab1bcec7ccb6a3afad1c2b01f7b2 (diff) |
prefer css::awt::XPopupMenu api
Change-Id: I486e24b0b85357b43213443c1a9b71206b8f441a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126711
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'framework/source/uielement')
-rw-r--r-- | framework/source/uielement/resourcemenucontroller.cxx | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/framework/source/uielement/resourcemenucontroller.cxx b/framework/source/uielement/resourcemenucontroller.cxx index cebd11f03c19..7a1364b41f4c 100644 --- a/framework/source/uielement/resourcemenucontroller.cxx +++ b/framework/source/uielement/resourcemenucontroller.cxx @@ -385,25 +385,24 @@ SaveAsMenuController::SaveAsMenuController( const css::uno::Reference< css::uno: { } -void SaveAsMenuController::impl_setPopupMenu() +void InsertItem(const css::uno::Reference<css::awt::XPopupMenu>& rPopupMenu, + const OUString& rCommand) { - VCLXMenu* pPopupMenu = comphelper::getFromUnoTunnel<VCLXMenu>( m_xPopupMenu ); - Menu* pVCLPopupMenu = nullptr; + sal_uInt16 nItemId = rPopupMenu->getItemCount() + 1; + rPopupMenu->insertItem(nItemId, OUString(), 0, -1); + rPopupMenu->setCommand(nItemId, rCommand); +} +void SaveAsMenuController::impl_setPopupMenu() +{ SolarMutexGuard aGuard; - if ( pPopupMenu ) - pVCLPopupMenu = pPopupMenu->GetMenu(); - - if ( !pVCLPopupMenu ) - return; - - pVCLPopupMenu->InsertItem( ".uno:SaveAs", nullptr ); - pVCLPopupMenu->InsertItem( ".uno:ExportTo", nullptr ); - pVCLPopupMenu->InsertItem( ".uno:SaveACopy", nullptr ); - pVCLPopupMenu->InsertItem( ".uno:SaveAsTemplate", nullptr ); - pVCLPopupMenu->InsertSeparator(); - pVCLPopupMenu->InsertItem( ".uno:SaveAsRemote", nullptr ); + InsertItem(m_xPopupMenu, ".uno:SaveAs"); + InsertItem(m_xPopupMenu, ".uno:ExportTo"); + InsertItem(m_xPopupMenu, ".uno:SaveACopy"); + InsertItem(m_xPopupMenu, ".uno:SaveAsTemplate"); + m_xPopupMenu->insertSeparator(-1); + InsertItem(m_xPopupMenu, ".uno:SaveAsRemote"); } OUString SaveAsMenuController::getImplementationName() |