28#include <com/sun/star/frame/XDispatch.hpp>
29#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
30#include <com/sun/star/lang/DisposedException.hpp>
31#include <com/sun/star/uno/XComponentContext.hpp>
32#include <com/sun/star/uno/XCurrentContext.hpp>
33#include <com/sun/star/frame/XPopupMenuController.hpp>
34#include <com/sun/star/frame/thePopupMenuControllerFactory.hpp>
35#include <com/sun/star/lang/SystemDependent.hpp>
36#include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp>
37#include <com/sun/star/ui/ItemType.hpp>
38#include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
39#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
40#include <com/sun/star/ui/ItemStyle.hpp>
41#include <com/sun/star/frame/status/Visibility.hpp>
42#include <com/sun/star/util/URLTransformer.hpp>
46#include <officecfg/Office/Common.hxx>
48#include <uno/current_context.hxx>
63using namespace ::
cppu;
85 const Reference< XComponentContext >& rxContext,
86 const Reference< XFrame >& rFrame,
87 const Reference< XURLTransformer >& _xURLTransformer,
88 const Reference< XDispatchProvider >& rDispatchProvider,
89 const OUString& rModuleIdentifier,
90 Menu* pMenu,
bool bDelete,
bool bHasMenuBar ):
91 m_bRetrieveImages( false )
92 , m_bAcceleratorCfg( false )
93 , m_bHasMenuBar( bHasMenuBar )
95 , m_xURLTransformer(_xURLTransformer)
97 , m_aAsyncSettingsTimer(
"framework::MenuBarManager::Deactivate m_aAsyncSettingsTimer" )
100 FillMenuManager( pMenu, rFrame, rDispatchProvider, rModuleIdentifier, bDelete );
108 throw css::lang::DisposedException();
116 m_pVCLMenu->GetSystemMenuData( &aSystemMenuData );
118 if( SystemType == SystemDependent::SYSTEM_WIN32 )
121 reinterpret_cast<sal_IntPtr
>(aSystemMenuData.hMenu));
137 SAL_WARN_IF( OWeakObject::m_refCount != 0,
"fwk.uielement",
"Who wants to delete an object with refcount > 0!" );
143 Reference< XComponent > xThis(
this );
165 Reference< XUIConfigurationListener >(
this) );
176 Reference< XUIConfigurationListener >(
this) );
199 sal_Int16 nImageType = sal_Int16();
200 if (( Event.aInfo >>= nImageType ) && nImageType == 0 )
220 throw css::lang::DisposedException();
228 if ( menuItemHandler->xMenuItemDispatch.is() )
231 aTargetURL.Complete = menuItemHandler->aMenuItemURL;
234 menuItemHandler->xMenuItemDispatch->removeStatusListener(
this,
aTargetURL );
236 menuItemHandler->xMenuItemDispatch.clear();
243 OUString aFeatureURL = Event.FeatureURL.Complete;
253 if ( menuItemHandler->aParsedItemURL == aFeatureURL )
255 bool bCheckmark(
false );
256 bool bMenuItemEnabled(
m_pVCLMenu->IsItemEnabled( menuItemHandler->nItemId ));
257 bool bEnabledItem( Event.IsEnabled );
259 status::Visibility aVisibilityStatus;
270 if ( (menuItemHandler->aMenuItemURL ==
".uno:Paste" &&
272 || menuItemHandler->aMenuItemURL ==
".uno:PasteClipboard" )
277 if ( bEnabledItem != bMenuItemEnabled )
279 m_pVCLMenu->EnableItem( menuItemHandler->nItemId, bEnabledItem );
287 if ( !bEnabledItem &&
m_pVCLMenu->IsItemChecked( menuItemHandler->nItemId ) )
288 m_pVCLMenu->CheckItem( menuItemHandler->nItemId,
false );
291 if ( Event.State >>= bCheckmark )
294 m_pVCLMenu->CheckItem( menuItemHandler->nItemId, bCheckmark );
297 if (!(nBits & MenuItemBits::RADIOCHECK))
298 m_pVCLMenu->SetItemBits( menuItemHandler->nItemId, nBits | MenuItemBits::CHECKABLE );
300 if ( menuItemHandler->bMadeInvisible )
301 m_pVCLMenu->ShowItem( menuItemHandler->nItemId );
303 else if ( Event.State >>= aItemText )
306 OUString aEnumPart =
aURL.GetURLPath().getToken( 1,
'.' );
307 if ( !aEnumPart.isEmpty() &&
aURL.GetProtocol() == INetProtocol::Uno )
310 m_pVCLMenu->CheckItem( menuItemHandler->nItemId, aItemText == aEnumPart );
313 if (!(nBits & MenuItemBits::RADIOCHECK))
314 m_pVCLMenu->SetItemBits( menuItemHandler->nItemId, nBits | MenuItemBits::CHECKABLE );
319 if ( aItemText.startsWith(
"($1)") )
321 aItemText =
FwkResId(STR_UPDATEDOC) +
" " + aItemText.subView( 4 );
323 else if ( aItemText.startsWith(
"($2)") )
325 aItemText =
FwkResId(STR_CLOSEDOC_ANDRETURN) + aItemText.subView( 4 );
327 else if ( aItemText.startsWith(
"($3)") )
329 aItemText =
FwkResId(STR_SAVECOPYDOC) + aItemText.subView( 4 );
332 m_pVCLMenu->SetItemText( menuItemHandler->nItemId, aItemText );
335 if ( menuItemHandler->bMadeInvisible )
336 m_pVCLMenu->ShowItem( menuItemHandler->nItemId );
338 else if ( Event.State >>= aVisibilityStatus )
341 m_pVCLMenu->ShowItem( menuItemHandler->nItemId, aVisibilityStatus.bVisible );
342 menuItemHandler->bMadeInvisible = !aVisibilityStatus.bVisible;
344 else if ( menuItemHandler->bMadeInvisible )
345 m_pVCLMenu->ShowItem( menuItemHandler->nItemId );
351 menuItemHandler->xMenuItemDispatch.
clear();
364 if ( menuItemHandler->nItemId == nItemId )
365 return menuItemHandler.get();
378 if ( menuItemHandler->xSubMenuManager.is() )
393 if ( menuItemHandler->xMenuItemDispatch.is() )
396 aTargetURL.Complete = menuItemHandler->aMenuItemURL;
399 menuItemHandler->xMenuItemDispatch->removeStatusListener(
400 static_cast< XStatusListener*
>(
this ),
aTargetURL );
403 menuItemHandler->xMenuItemDispatch.clear();
405 if ( menuItemHandler->xPopupMenu.is() )
409 m_pVCLMenu->SetPopupMenu( menuItemHandler->nItemId,
nullptr );
412 Reference< css::lang::XEventListener > xEventListener( menuItemHandler->xPopupMenuController, UNO_QUERY );
413 if ( xEventListener.is() )
415 EventObject aEventObject;
416 aEventObject.Source =
static_cast<OWeakObject *
>(
this);
417 xEventListener->disposing( aEventObject );
425 Reference< XComponent > xComponent( menuItemHandler->xPopupMenuController, UNO_QUERY );
426 if ( xComponent.is() )
427 xComponent->dispose();
438 menuItemHandler->xPopupMenuController.clear();
439 menuItemHandler->xPopupMenu.clear();
442 Reference< XComponent > xComponent( menuItemHandler->xSubMenuManager, UNO_QUERY );
443 if ( xComponent.is() )
444 xComponent->dispose();
450 m_xFrame->removeFrameActionListener( Reference< XFrameActionListener >(
this) );
461 MenuItemHandler* pMenuItemDisposing =
nullptr;
467 if ( menuItemHandler->xMenuItemDispatch.is() &&
468 menuItemHandler->xMenuItemDispatch ==
Source.Source )
471 pMenuItemDisposing = menuItemHandler.get();
476 if ( pMenuItemDisposing )
480 aTargetURL.Complete = pMenuItemDisposing->aMenuItemURL;
484 pMenuItemDisposing->xMenuItemDispatch->removeStatusListener(
485 static_cast< XStatusListener*
>(
this ),
aTargetURL );
486 pMenuItemDisposing->xMenuItemDispatch.clear();
487 if ( pMenuItemDisposing->xPopupMenu.is() )
489 Reference< css::lang::XEventListener > xEventListener( pMenuItemDisposing->xPopupMenuController, UNO_QUERY );
490 if ( xEventListener.is() )
491 xEventListener->disposing( Source );
496 m_pVCLMenu->SetPopupMenu( pMenuItemDisposing->nItemId,
nullptr );
499 pMenuItemDisposing->xPopupMenuController.
clear();
500 pMenuItemDisposing->xPopupMenu.clear();
518 pMenu->
EnableItem( nItemId, pThisPopup->GetItemCount() != 0 && pThisPopup->HasValidEntries(
true));
525class QuietInteractionContext:
526 public cppu::WeakImplHelper< css::uno::XCurrentContext >
529 explicit QuietInteractionContext(
530 css::uno::Reference< css::uno::XCurrentContext > context):
532 QuietInteractionContext(
const QuietInteractionContext&) =
delete;
533 QuietInteractionContext& operator=(
const QuietInteractionContext&) =
delete;
536 virtual ~QuietInteractionContext()
override {}
538 virtual css::uno::Any SAL_CALL getValueByName(
539 OUString
const & Name)
override
546 css::uno::Reference< css::uno::XCurrentContext >
554 if ( pMenu != m_pVCLMenu )
557 css::uno::ContextLayer layer(
558 new QuietInteractionContext(
559 css::uno::getCurrentContext()));
562 bool bDontHide = officecfg::Office::Common::View::Menu::DontHideDisabledEntry::get();
574 nFlag |= MenuFlags::HideDisabledEntries;
575 pMenu->SetMenuFlags( nFlag );
585 if ( m_bRetrieveImages ||
586 bShowMenuImages != m_bShowMenuImages ||
587 sIconTheme != m_sIconTheme )
589 m_bShowMenuImages = bShowMenuImages;
590 m_bRetrieveImages =
false;
591 m_sIconTheme = sIconTheme;
592 FillMenuImages(
m_xFrame, pMenu, bShowMenuImages );
596 for ( sal_uInt16
nPos = 0;
nPos < pMenu->GetItemCount();
nPos++ )
598 sal_uInt16 nItemId = pMenu->GetItemId(
nPos );
599 if (( pMenu->GetItemType(
nPos ) != MenuItemType::SEPARATOR ) &&
600 ( pMenu->GetItemText( nItemId ).isEmpty() ))
602 OUString
aCommand = pMenu->GetItemCommand( nItemId );
604 pMenu->SetItemText( nItemId, RetrieveLabelFromCommand(
aCommand ));
611 if ( bShowShortcuts )
612 RetrieveShortcuts( m_aMenuItemHandlerVector );
614 for (
auto const& menuItemHandler : m_aMenuItemHandlerVector)
616 if ( !bShowShortcuts )
618 pMenu->SetAccelKey( menuItemHandler->nItemId,
vcl::KeyCode() );
625 pMenu->SetAccelKey( menuItemHandler->nItemId, aKeyCode );
627 else if ( pMenu->GetPopupMenu( menuItemHandler->nItemId ) ==
nullptr )
628 pMenu->SetAccelKey( menuItemHandler->nItemId, menuItemHandler->aKeyCode );
635 Reference< XDispatchProvider > xDispatchProvider;
636 if ( m_xDispatchProvider.is() )
637 xDispatchProvider = m_xDispatchProvider;
639 xDispatchProvider.set(
m_xFrame, UNO_QUERY );
641 if ( !xDispatchProvider.is() )
645 for (
auto const& menuItemHandler : m_aMenuItemHandlerVector)
649 if ( !menuItemHandler->xMenuItemDispatch.is() &&
650 !menuItemHandler->xSubMenuManager.is() )
652 Reference< XDispatch > xMenuItemDispatch;
654 aTargetURL.Complete = menuItemHandler->aMenuItemURL;
658 if ( bHasDisabledEntries )
661 pMenu->HideItem( menuItemHandler->nItemId );
664 if (
aTargetURL.Complete.startsWith(
".uno:StyleApply?" ) )
667 xMenuItemDispatch = xDispatchProvider->queryDispatch(
aTargetURL, menuItemHandler->aTargetFrame, 0 );
669 bool bPopupMenu(
false );
670 if ( !menuItemHandler->xPopupMenuController.is() &&
671 m_xPopupMenuControllerFactory->hasController( menuItemHandler->aMenuItemURL, m_aModuleIdentifier ) )
673 if( xMenuItemDispatch.is() || menuItemHandler->aMenuItemURL !=
".uno:RecentFileList" )
674 bPopupMenu = CreatePopupMenuController(menuItemHandler.get(), m_xDispatchProvider, m_aModuleIdentifier);
676 if (bPopupMenu && menuItemHandler->xPopupMenuController.is())
680 pThisPopup->Activate();
681 pThisPopup->Deactivate();
685 else if ( menuItemHandler->xPopupMenuController.is() )
688 menuItemHandler->xPopupMenuController->updatePopupMenu();
692 pThisPopup->Activate();
693 pThisPopup->Deactivate();
698 if ( xMenuItemDispatch.is() )
700 menuItemHandler->xMenuItemDispatch = xMenuItemDispatch;
701 menuItemHandler->aParsedItemURL =
aTargetURL.Complete;
705 xMenuItemDispatch->addStatusListener(
static_cast< XStatusListener*
>(
this ),
aTargetURL );
707 if ( !m_bHasMenuBar )
708 xMenuItemDispatch->removeStatusListener(
static_cast< XStatusListener*
>(
this ),
aTargetURL );
711 else if ( !bPopupMenu )
712 pMenu->EnableItem( menuItemHandler->nItemId,
false );
714 else if ( menuItemHandler->xPopupMenuController.is() )
717 menuItemHandler->xPopupMenuController->updatePopupMenu();
720 pThisPopup->Activate();
721 pThisPopup->Deactivate();
725 else if ( menuItemHandler->xMenuItemDispatch.is() )
730 aTargetURL.Complete = menuItemHandler->aMenuItemURL;
733 menuItemHandler->xMenuItemDispatch->addStatusListener(
734 static_cast< XStatusListener*
>(
this ),
aTargetURL );
735 menuItemHandler->xMenuItemDispatch->removeStatusListener(
736 static_cast< XStatusListener*
>(
this ),
aTargetURL );
742 else if (menuItemHandler->xSubMenuManager.is())
747 pMenuBarManager->Activate(pMenuBarManager->
GetMenuBar());
748 pMenuBarManager->Deactivate(pMenuBarManager->
GetMenuBar());
760 if ( pMenu == m_pVCLMenu )
763 if ( pMenu->IsMenuBar() && m_xDeferredItemContainer.is() )
769 m_aAsyncSettingsTimer.SetTimeout(10);
770 m_aAsyncSettingsTimer.Start();
780 Reference< XInterface > xSelfHold(
783 m_aAsyncSettingsTimer.Stop();
784 if ( !m_bActive && m_xDeferredItemContainer.is() )
786 SetItemContainer( m_xDeferredItemContainer );
787 m_xDeferredItemContainer.clear();
794 Sequence<PropertyValue> aArgs;
800 sal_uInt16 nCurItemId = pMenu->GetCurItemId();
801 sal_uInt16 nCurPos = pMenu->GetItemPos( nCurItemId );
802 if ( pMenu == m_pVCLMenu &&
803 pMenu->GetItemType( nCurPos ) != MenuItemType::SEPARATOR )
805 MenuItemHandler* pMenuItemHandler = GetMenuItemHandler( nCurItemId );
806 if ( pMenuItemHandler && pMenuItemHandler->xMenuItemDispatch.is() )
808 aTargetURL.Complete = pMenuItemHandler->aMenuItemURL;
811 if ( pMenu->GetUserValue( nCurItemId ) )
817 xDispatch = pMenuItemHandler->xMenuItemDispatch;
830 if ( !m_bHasMenuBar )
847 sal_uInt16 nHideCount( 0 );
849 for ( sal_uInt16
i = 0;
i <
nCount;
i++ )
876 return (
nCount == nHideCount );
891 const css::uno::Reference< css::frame::XDispatchProvider >& rDispatchProvider,
892 const OUString& rModuleIdentifier )
894 OUString aItemCommand( pMenuItemHandler->
aMenuItemURL );
901 {
"DispatchProvider",
Any(rDispatchProvider) },
902 {
"ModuleIdentifier",
Any(rModuleIdentifier) },
907 Reference< XPopupMenuController > xPopupMenuController(
914 if ( xPopupMenuController.is() )
918 xPopupMenuController->setPopupMenu( pMenuItemHandler->
xPopupMenu );
926 const Reference< XDispatchProvider >& rDispatchProvider,
927 const OUString& rModuleIdentifier,
bool bDelete )
940 if (!rModuleIdentifier.isEmpty())
970 OUString aItemCommand;
972 for ( sal_uInt16
i = 0;
i < nItemCount;
i++ )
976 if (( pMenu->
IsMenuBar() || bAccessibilityEnabled ) &&
979 if ( !aItemCommand.isEmpty() )
986 if ( !aRealCommand.isEmpty() )
987 aItemCommand = aRealCommand;
990 Reference< XStatusListener > xStatusListener;
994 bool bItemShowMenuImages = (
m_bShowMenuImages && nBits != MenuItemBits::TEXT ) || nBits & MenuItemBits::ICON;
999 OUString aModuleIdentifier( rModuleIdentifier );
1007 Reference< XDispatchProvider > xPopupMenuDispatchProvider( rDispatchProvider );
1025 if ( bAccessibilityEnabled || pMenu->
IsMenuBar())
1039 if ( pSubMenu && ( pSubMenu->GetItemCount() > 0 ))
1041 if ( pPopup->GetItemType( pPopup->GetItemCount() - 1 ) != MenuItemType::SEPARATOR )
1042 pPopup->InsertSeparator();
1053 xPopupMenuDispatchProvider, aModuleIdentifier, pPopup,
false,
m_bHasMenuBar );
1055 AddMenu(pSubMenuManager.get(), aItemCommand, nItemId);
1058 else if ( pMenu->
GetItemType(
i ) != MenuItemType::SEPARATOR )
1060 if ( bItemShowMenuImages )
1068 pItemHandler->aMenuItemURL = aItemCommand;
1078 pMenu->
SetPopupMenu( pItemHandler->nItemId, pPopupMenu );
1079 pItemHandler->xPopupMenu = pVCLXPopupMenu;
1083 pItemHandler->xPopupMenuController->updatePopupMenu();
1103 pMenu->
SetAccelKey( menuItemHandler->nItemId, aKeyCode );
1105 else if ( pMenu->
GetPopupMenu( menuItemHandler->nItemId ) ==
nullptr )
1106 pMenu->
SetAccelKey( menuItemHandler->nItemId, menuItemHandler->aKeyCode );
1114 const Reference< XAcceleratorConfiguration >& rAccelCfg,
1115 const Sequence< OUString >& rCommands,
1116 std::vector< std::unique_ptr<MenuItemHandler> >& aMenuShortCuts )
1118 if ( !rAccelCfg.is() )
1123 css::awt::KeyEvent aKeyEvent;
1124 Sequence< Any > aSeqKeyCode = rAccelCfg->getPreferredKeyEventsForCommandList( rCommands );
1125 for ( sal_Int32
i = 0;
i < aSeqKeyCode.getLength();
i++ )
1127 if ( aSeqKeyCode[
i] >>= aKeyEvent )
1131 catch (
const IllegalArgumentException& )
1146 if ( !xDocAccelCfg.is() )
1149 Reference< XModel >
xModel;
1155 Reference< XUIConfigurationManagerSupplier > xSupplier(
xModel, UNO_QUERY );
1156 if ( xSupplier.is() )
1158 Reference< XUIConfigurationManager > xDocUICfgMgr = xSupplier->getUIConfigurationManager();
1159 if ( xDocUICfgMgr.is() )
1161 xDocAccelCfg = xDocUICfgMgr->getShortCutManager();
1169 if ( !xModuleAccelCfg.is() )
1171 Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier =
1172 theModuleUIConfigurationManagerSupplier::get(
m_xContext );
1175 Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager(
m_aModuleIdentifier );
1176 if ( xUICfgMgr.is() )
1178 xModuleAccelCfg = xUICfgMgr->getShortCutManager();
1191 if ( !xGlobalAccelCfg.is() )
try
1193 xGlobalAccelCfg = GlobalAcceleratorConfiguration::create(
m_xContext );
1196 catch (
const css::uno::DeploymentException& )
1198 SAL_WARN(
"fwk.uielement",
"GlobalAcceleratorConfiguration"
1199 " not available. This should happen only on mobile platforms.");
1204 Sequence< OUString >
aSeq( aMenuShortCuts.size() );
1205 auto aSeqRange = asNonConstRange(
aSeq);
1206 const sal_uInt32
nCount = aMenuShortCuts.size();
1207 for ( sal_uInt32
i = 0;
i <
nCount; ++
i )
1209 aSeqRange[
i] = aMenuShortCuts[
i]->aMenuItemURL;
1210 aMenuShortCuts[
i]->aKeyCode = aEmptyKeyCode;
1226 Reference< XModel >
xModel;
1232 Reference< XUIConfigurationManagerSupplier > xSupplier(
xModel, UNO_QUERY );
1233 if ( xSupplier.is() )
1235 Reference< XUIConfigurationManager > xDocUICfgMgr = xSupplier->getUIConfigurationManager();
1238 Reference< XUIConfigurationListener >(
this) );
1246 Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier =
1247 theModuleUIConfigurationManagerSupplier::get(
m_xContext );
1248 Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager(
m_aModuleIdentifier );
1257 const OUString& rModuleIdentifier,
1258 const Reference< XIndexAccess >& rItemContainer,
1259 const Reference< XURLTransformer >& rTransformer )
1261 Reference< XDispatchProvider > xEmptyDispatchProvider;
1266 AddonsOptions().GetMergeMenuInstructions(),
1267 rModuleIdentifier );
1270 if ( !bHasDisabledEntries )
1274 for ( sal_uInt16
i = 0;
i <
nCount;
i++ )
1292 const OUString& rModuleIdentifier,
1293 const Reference< XIndexAccess >& rItemContainer,
1294 const Reference< XDispatchProvider >& rDispatchProvider )
1297 for ( sal_Int32
n = 0;
n < rItemContainer->getCount();
n++ )
1299 Sequence< PropertyValue > aProps;
1300 OUString aCommandURL;
1302 OUString aModuleIdentifier( rModuleIdentifier );
1303 sal_uInt16
nType = 0;
1304 Reference< XIndexAccess > xIndexContainer;
1305 Reference< XDispatchProvider > xDispatchProvider( rDispatchProvider );
1306 sal_Int16 nStyle = 0;
1309 if ( rItemContainer->getByIndex(
n ) >>= aProps )
1312 bool bEnabled =
true;
1314 for ( beans::PropertyValue
const & rProp : std::as_const(aProps) )
1318 rProp.Value >>= aCommandURL;
1319 else if (
aPropName ==
"ItemDescriptorContainer" )
1320 rProp.Value >>= xIndexContainer;
1324 rProp.Value >>=
nType;
1325 else if (
aPropName ==
"ModuleIdentifier" )
1326 rProp.Value >>= aModuleIdentifier;
1327 else if (
aPropName ==
"DispatchProvider" )
1328 rProp.Value >>= xDispatchProvider;
1330 rProp.Value >>= nStyle;
1332 rProp.Value >>= bShow;
1334 rProp.Value >>= bEnabled;
1338 !officecfg::Office::Common::Misc::ExperimentalMode::get())
1343 if (
nType == css::ui::ItemType::DEFAULT )
1351 if ( nStyle & css::ui::ItemStyle::ICON )
1352 nBits |= MenuItemBits::ICON;
1353 if ( nStyle & css::ui::ItemStyle::TEXT )
1354 nBits |= MenuItemBits::TEXT;
1355 if ( nStyle & css::ui::ItemStyle::RADIO_CHECK )
1356 nBits |= MenuItemBits::RADIOCHECK;
1366 if ( xIndexContainer.is() )
1371 pNewPopupMenu->SetHelpId(aCommandURL);
1373 if ( xDispatchProvider.is() )
1381 if ( !aModuleIdentifier.isEmpty() )
1385 FillMenu(
nId, pNewPopupMenu, aModuleIdentifier, xIndexContainer, xDispatchProvider );
1397 catch (
const IndexOutOfBoundsException& )
1407 const OUString& rModuleIdentifier )
1412 const sal_uInt32
nCount = aMergeInstructionContainer.size();
1413 for ( sal_uInt32
i = 0;
i <
nCount;
i++ )
1419 ::std::vector< OUString > aMergePath;
1429 Menu* pMenu = pMenuBar;
1483 Reference< XDispatchProvider > xDispatchProvider;
1487 m_xFrame->addFrameActionListener( Reference< XFrameActionListener >(
this) );
1498 if ( menuItemHandler->xPopupMenuController.is() )
1500 Reference< XDispatchProvider > xDispatchProvider( menuItemHandler->xPopupMenuController, UNO_QUERY );
1506 sal_Int32 nSchemePart( 0 );
1507 OUString aMenuURL( menuItemHandler->aMenuItemURL );
1509 nSchemePart = aMenuURL.indexOf(
':' );
1510 if (( nSchemePart > 0 ) &&
1511 ( aMenuURL.getLength() > ( nSchemePart+1 )))
1513 OUString aMainURL(
"vnd.sun.star.popup:" );
1514 sal_Int32 nQueryPart = aMenuURL.indexOf(
'?', nSchemePart );
1515 if ( nQueryPart > 0 )
1516 aMainURL += aMenuURL.subView( nSchemePart, nQueryPart-nSchemePart );
1517 else if ( nQueryPart == -1 )
1518 aMainURL += aMenuURL.subView( nSchemePart+1 );
1520 rPopupController.emplace( aMainURL, aPopupControllerEntry );
1523 if ( menuItemHandler->xSubMenuManager.is() )
1526 if ( pMenuBarManager )
1534 Reference< XStatusListener > xSubMenuManager( pSubMenuManager );
1535 m_xFrame->addFrameActionListener( Reference< XFrameActionListener >( xSubMenuManager, UNO_QUERY ));
1538 std::unique_ptr<MenuItemHandler> pMenuItemHandler(
new MenuItemHandler(
1542 pMenuItemHandler->aMenuItemURL = _sItemCommand;
1548 sal_uInt16 nItemId = _pMenu->
GetItemId( _nIndex );
1551 if ( _rItemCommand.isEmpty() )
1553 _rItemCommand =
"slot:" + OUString::number( nItemId );
1571 AddonsOptions aAddonOptions;
1580 bool bTmpShowMenuImages = ( bShowMenuImages && nBits != MenuItemBits::TEXT ) || nBits & MenuItemBits::ICON;
1582 if ( bTmpShowMenuImages )
1587 aImage =
Image(aAddonOptions.GetImageFromURL(aMenuItemCommand,
false));
PropertiesInfo aProperties
css::uno::Reference< css::lang::XComponent > m_xFrame
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
bool GetContextMenuShortcuts() const
bool GetUseImagesInMenus() const
bool LookupDisabled(const OUString &aCommandURL) const
bool HasEntriesDisabled() const
static OUString GetIconTheme()
static VclPtr< reference_type > Create(Arg &&... arg)
A dispatcher that serves as a proxy for style commands with arguments i.e.
static vcl::KeyCode st_AWTKey2VCLKey(const css::awt::KeyEvent &aKey)
Reference< XDispatch > xDispatch
OUString FwkResId(TranslateId aId)
css::uno::Reference< css::uno::XComponentContext > m_xContext
constexpr OUStringLiteral JAVA_INTERACTION_HANDLER_NAME
constexpr sal_uInt16 KEY_F1
#define LINK(Instance, Class, Member)
Sequence< sal_Int8 > aSeq
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
css::uno::Sequence< css::uno::Any > InitAnyPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
::std::vector< MergeMenuInstruction > MergeMenuInstructionContainer
std::unordered_map< OUString, PopupControllerEntry > PopupControllerCache
constexpr OUStringLiteral aCmdToolsMenu
static void lcl_CheckForChildren(Menu *pMenu, sal_uInt16 nItemId)
IMPL_LINK(WindowCommandDispatch, impl_notifyCommand, VclWindowEvent &, rEvent, void)
::std::vector< AddonMenuItem > AddonMenuContainer
IMPL_LINK_NOARG(CloseDispatcher, impl_asyncCallback, LinkParamNone *, void)
asynchronous callback @descr We start all actions inside this object asynchronous (see comments there...
constexpr OUStringLiteral aCmdHelpIndex
constexpr OUStringLiteral aSpecialWindowCommand
constexpr OUStringLiteral aCmdHelpMenu
Sequence< beans::PropertyValue > GetCommandProperties(const OUString &rsCommandName, const OUString &rsModuleName)
OUString GetRealCommandForCommand(const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
OUString GetModuleIdentifier(const Reference< frame::XFrame > &rxFrame)
OUString GetPopupLabelForCommand(const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
Image GetImageForCommand(const OUString &rsCommandName, const Reference< frame::XFrame > &rxFrame, vcl::ImageType eImageType)
bool IsExperimental(const OUString &rsCommandName, const OUString &rModuleName)
OUString GetMenuLabelForCommand(const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
css::uno::Reference< css::frame::XPopupMenuController > xPopupMenuController
css::uno::Reference< css::awt::XPopupMenu > xPopupMenu
VclPtr< Menu > pPopupMenu
Reference< XController > xController
Reference< XFrame > xFrame
Reference< XModel > xModel