summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-11-29 11:01:43 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-11-29 18:42:29 +0100
commitcca776d83a8e32c3501e6c00cf6f4e1fa73401b5 (patch)
tree1bc7839472e91fef81496471bf278a6e6b7490f4 /framework
parent7e40111f3c5258cbe884c19bcb6617ad342aa5f3 (diff)
use VCLXPopupMenu directly, don't extract underlying PopupMenu*
Change-Id: I7fb25ca34e6439020b00d0266453668df38efe6a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126035 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'framework')
-rw-r--r--framework/source/uielement/headermenucontroller.cxx20
1 files changed, 8 insertions, 12 deletions
diff --git a/framework/source/uielement/headermenucontroller.cxx b/framework/source/uielement/headermenucontroller.cxx
index 2851295c7c0a..34476f9c2100 100644
--- a/framework/source/uielement/headermenucontroller.cxx
+++ b/framework/source/uielement/headermenucontroller.cxx
@@ -24,6 +24,7 @@
#include <strings.hrc>
#include <classes/fwkresid.hxx>
+#include <com/sun/star/awt/MenuItemStyle.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -81,16 +82,13 @@ HeaderMenuController::~HeaderMenuController()
void HeaderMenuController::fillPopupMenu( const Reference< css::frame::XModel >& rModel, Reference< css::awt::XPopupMenu > const & rPopupMenu )
{
VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getFromUnoTunnel<VCLXMenu>( rPopupMenu ));
- PopupMenu* pVCLPopupMenu = nullptr;
SolarMutexGuard aSolarMutexGuard;
resetPopupMenu( rPopupMenu );
- if ( pPopupMenu )
- pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
Reference< XStyleFamiliesSupplier > xStyleFamiliesSupplier( rModel, UNO_QUERY );
- if ( !(pVCLPopupMenu && xStyleFamiliesSupplier.is()))
+ if (!xStyleFamiliesSupplier.is())
return;
Reference< XNameAccess > xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies();
@@ -141,17 +139,15 @@ void HeaderMenuController::fillPopupMenu( const Reference< css::frame::XModel >&
else
aStrBuf.append( "false" );
OUString aCommand( aStrBuf.makeStringAndClear() );
- pVCLPopupMenu->InsertItem( nId, aDisplayName, MenuItemBits::CHECKABLE );
+ pPopupMenu->insertItem(nId, aDisplayName, css::awt::MenuItemStyle::CHECKABLE, nCount);
if ( !bFirstItemInserted )
{
bFirstItemInserted = true;
bFirstChecked = bHeaderIsOn;
}
- pVCLPopupMenu->SetItemCommand( nId, aCommand );
-
- if ( bHeaderIsOn )
- pVCLPopupMenu->CheckItem( nId );
+ pPopupMenu->setCommand(nId, aCommand);
+ pPopupMenu->checkItem(nId, bHeaderIsOn);
++nId;
// Check if all entries have the same state
@@ -166,7 +162,7 @@ void HeaderMenuController::fillPopupMenu( const Reference< css::frame::XModel >&
if ( bAllOneState && ( nCount > 1 ))
{
// Insert special item for all command
- pVCLPopupMenu->InsertItem( ALL_MENUITEM_ID, FwkResId(STR_MENU_HEADFOOTALL), MenuItemBits::NONE, OString(), 0 );
+ pPopupMenu->insertItem(ALL_MENUITEM_ID, FwkResId(STR_MENU_HEADFOOTALL), 0, 0);
OUStringBuffer aStrBuf( aCmd );
aStrBuf.append( "?On:bool=" );
@@ -177,8 +173,8 @@ void HeaderMenuController::fillPopupMenu( const Reference< css::frame::XModel >&
else
aStrBuf.append( "false" );
- pVCLPopupMenu->SetItemCommand( 1, aStrBuf.makeStringAndClear() );
- pVCLPopupMenu->InsertSeparator(OString(), 1);
+ pPopupMenu->setCommand(1, aStrBuf.makeStringAndClear());
+ pPopupMenu->insertSeparator(1);
}
}
}