22#include <com/sun/star/uno/Sequence.hxx>
60 std::u16string_view rContext, std::u16string_view rModuleIdentifier )
62 return ( rContext.empty() || ( rContext.find( rModuleIdentifier ) != std::u16string_view::npos ));
66 std::u16string_view rReferencePathString,
67 ::std::vector< OUString >& rReferencePath )
69 const char aDelimiter =
'\\';
71 rReferencePath.clear();
75 OUString aToken(
o3tl::getToken(rReferencePathString, 0, aDelimiter, nIndex ) );
76 if ( !aToken.isEmpty() )
77 rReferencePath.push_back( aToken );
79 while ( nIndex >= 0 );
83 const ::std::vector< OUString >& rReferencePath,
87 const sal_uInt32
nCount( rReferencePath.size() );
89 ReferencePathInfo aResult;
92 aResult.pPopupMenu =
nullptr;
99 Menu* pCurrMenu( pMenu );
102 sal_Int32 nLevel( - 1 );
103 sal_uInt16
nPos( MENU_ITEM_NOTFOUND );
107 OUString aCmd( rReferencePath[i] );
113 if ( nTmpPos != MENU_ITEM_NOTFOUND )
121 if ( nTmpPos != MENU_ITEM_NOTFOUND )
123 sal_uInt16 nItemId = pCurrMenu->GetItemId( nTmpPos );
125 if ( pTmpMenu !=
nullptr )
126 pCurrMenu = pTmpMenu;
138 while ((i < nCount) && (eResult ==
RP_OK));
140 aResult.pPopupMenu = pCurrMenu;
142 aResult.nLevel = nLevel;
143 aResult.eResult = eResult;
152 const sal_uInt16 nItemId = pCurrMenu->
GetItemId(
i );
166 const OUString& rModuleIdentifier,
169 const sal_uInt32 nSize = rAddonSubMenu.size();
170 for ( sal_uInt32
i = 0;
i < nSize;
i++ )
204 sal_uInt16 nModIndex,
206 const OUString& rModuleIdentifier,
210 const sal_uInt32 nSize = rAddonMenuItems.size();
211 for ( sal_uInt32
i = 0;
i < nSize;
i++ )
247 const OUString& rModuleIdentifier,
260 std::u16string_view rMergeCommandParameter )
262 const sal_uInt16 nParam( sal_uInt16(
o3tl::toInt32(rMergeCommandParameter) ));
263 sal_uInt16
nCount = std::max( nParam, sal_uInt16(1) );
266 while (( nPos < pMenu->GetItemCount() ) && (
i <
nCount ))
279 std::u16string_view rMergeCommand,
280 std::u16string_view rMergeCommandParameter,
281 const OUString& rModuleIdentifier,
284 sal_uInt16 nModIndex( 0 );
289 return MergeMenuItems( pMenu,
nPos, nModIndex, nItemId, rModuleIdentifier, rAddonMenuItems );
294 return MergeMenuItems( pMenu,
nPos, nModIndex, nItemId, rModuleIdentifier, rAddonMenuItems );
311 std::u16string_view rMergeCommand,
312 std::u16string_view rMergeFallback,
313 const ::std::vector< OUString >& rReferencePath,
314 const std::u16string_view rModuleIdentifier,
326 sal_Int32 nLevel( aRefPathInfo.
nLevel );
327 const sal_Int32 nSize( rReferencePath.size() );
328 bool bFirstLevel(
true );
330 while ( nLevel < nSize )
332 if ( nLevel == nSize-1 )
334 const sal_uInt32
nCount = rAddonMenuItems.size();
335 for ( sal_uInt32
i = 0;
i <
nCount; ++
i )
353 const OUString aCmd( rReferencePath[nLevel] );
360 sal_uInt16 nInsPos = aRefPathInfo.
nPos;
361 sal_uInt16 nSetItemId = pCurrMenu->
GetItemId( nInsPos );
373 pCurrMenu = pPopupMenu;
386 const uno::Sequence< beans::PropertyValue >& rAddonMenuEntry,
392 for (
const beans::PropertyValue& rProp : rAddonMenuEntry )
394 OUString aMenuEntryPropName = rProp.Name;
396 rProp.Value >>= rAddonMenuItem.
aURL;
398 rProp.Value >>= rAddonMenuItem.
aTitle;
401 uno::Sequence< uno::Sequence< beans::PropertyValue > > aSubMenu;
402 rProp.Value >>= aSubMenu;
406 rProp.Value >>= rAddonMenuItem.
aContext;
411 const uno::Sequence< uno::Sequence< beans::PropertyValue > >& rSubMenuEntries,
416 const sal_Int32
nCount = rSubMenuEntries.getLength();
417 rSubMenu.reserve(rSubMenu.size() + nCount);
418 for ( sal_Int32 i = 0;
i <
nCount;
i++ )
420 const uno::Sequence< beans::PropertyValue >& rMenuEntry = rSubMenuEntries[
i ];
422 AddonMenuItem aMenuItem;
424 rSubMenu.push_back( aMenuItem );
constexpr OUStringLiteral ADDONSMENUITEM_STRING_URL
constexpr OUStringLiteral ADDONSMENUITEM_STRING_SUBMENU
constexpr OUStringLiteral ADDONSMENUITEM_STRING_CONTEXT
constexpr OUStringLiteral ADDONSMENUITEM_STRING_TITLE
static VclPtr< reference_type > Create(Arg &&... arg)
const char16_t MERGECOMMAND_REPLACE[]
::std::vector< AddonMenuItem > AddonMenuContainer
const char16_t MERGEFALLBACK_IGNORE[]
@ RP_MENUITEM_INSTEAD_OF_POPUPMENU_FOUND
const char16_t MERGECOMMAND_ADDAFTER[]
const char16_t MERGECOMMAND_REMOVE[]
const char16_t MERGECOMMAND_ADDBEFORE[]
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
VclPtr< Menu > pPopupMenu