summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-11-29 11:22:49 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-11-29 21:20:00 +0100
commit484fe977fd5d0aea1ba5a99e69e6225e2629502c (patch)
tree5ec891f2d27d20356eea1fd53d2f1f96fe9b74ab /framework
parentf416f480ebe13e33021c75bf13002e447d8dbde1 (diff)
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: I0cf0beaa300331c2d221a60b91a855b1bd47c7c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126041 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'framework')
-rw-r--r--framework/source/uielement/toolbarsmenucontroller.cxx27
1 files changed, 8 insertions, 19 deletions
diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx
index 7e2323d085f0..734c5f18dfd5 100644
--- a/framework/source/uielement/toolbarsmenucontroller.cxx
+++ b/framework/source/uielement/toolbarsmenucontroller.cxx
@@ -498,39 +498,33 @@ void SAL_CALL ToolbarsMenuController::statusChanged( const FeatureStateEvent& Ev
return;
SolarMutexGuard aGuard;
- VCLXPopupMenu* pXPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getFromUnoTunnel<VCLXMenu>( xPopupMenu ));
- PopupMenu* pVCLPopupMenu = pXPopupMenu ? static_cast<PopupMenu *>(pXPopupMenu->GetMenu()) : nullptr;
-
- SAL_WARN_IF(!pVCLPopupMenu, "fwk.uielement", "worrying lack of popup menu");
- if (!pVCLPopupMenu)
- return;
bool bSetCheckmark = false;
bool bCheckmark = false;
- for ( sal_uInt16 i = 0; i < pVCLPopupMenu->GetItemCount(); i++ )
+ for (sal_Int16 i = 0, nCount = xPopupMenu->getItemCount(); i < nCount; ++i)
{
- sal_uInt16 nId = pVCLPopupMenu->GetItemId( i );
+ sal_Int16 nId = xPopupMenu->getItemId(i);
if ( nId == 0 )
continue;
- OUString aCmd = pVCLPopupMenu->GetItemCommand( nId );
+ OUString aCmd = xPopupMenu->getCommand(nId);
if ( aCmd == aFeatureURL )
{
// Enable/disable item
- pVCLPopupMenu->EnableItem( nId, Event.IsEnabled );
+ xPopupMenu->enableItem(nId, Event.IsEnabled);
// Checkmark
if ( Event.State >>= bCheckmark )
bSetCheckmark = true;
if ( bSetCheckmark )
- pVCLPopupMenu->CheckItem( nId, bCheckmark );
+ xPopupMenu->checkItem(nId, bCheckmark);
else
{
OUString aItemText;
if ( Event.State >>= aItemText )
- pVCLPopupMenu->SetItemText( nId, aItemText );
+ xPopupMenu->setItemText(nId, aItemText);
}
}
}
@@ -557,14 +551,9 @@ void SAL_CALL ToolbarsMenuController::itemSelected( const css::awt::MenuEvent& r
if ( !xPopupMenu.is() )
return;
- VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getFromUnoTunnel<VCLXMenu>( xPopupMenu ));
- if ( !pPopupMenu )
- return;
-
SolarMutexGuard aSolarMutexGuard;
- PopupMenu* pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
- OUString aCmd( pVCLPopupMenu->GetItemCommand( rEvent.MenuId ));
+ OUString aCmd(xPopupMenu->getCommand(rEvent.MenuId));
if ( aCmd.startsWith( STATIC_INTERNAL_CMD_PART ) )
{
// Command to restore the visibility of all context sensitive toolbars
@@ -677,7 +666,7 @@ void SAL_CALL ToolbarsMenuController::itemSelected( const css::awt::MenuEvent& r
{
OUString aToolBarResName = OUString::Concat("private:resource/toolbar/") + aCmd.subView(nIndex+1);
- bool bShow( !pVCLPopupMenu->IsItemChecked( rEvent.MenuId ));
+ const bool bShow(!xPopupMenu->isItemChecked(rEvent.MenuId));
if ( bShow )
{
xLayoutManager->createElement( aToolBarResName );