diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-29 09:44:28 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-30 10:31:26 +0200 |
commit | f662ba95361ba6b8eb49e0acd98bf28bc5f21100 (patch) | |
tree | a06ea88459155bb72b3f01dcda1d27f17cc49209 /framework/source | |
parent | bddfc920220b712c08eda96ac320a274e4bfcee6 (diff) |
Prepare for removal of non-const operator[] from Sequence in framework
Change-Id: Ied2683a0b8a1bab1a7594da1e9bdbd3cb753552c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124370
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'framework/source')
63 files changed, 565 insertions, 594 deletions
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx index 54b4f5a8f827..90b393ace7fd 100644 --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -171,6 +171,7 @@ css::uno::Sequence< css::uno::Any > SAL_CALL XMLBasedAcceleratorConfiguration::g css::uno::Sequence< css::uno::Any > lPreferredOnes (c); // don't pack list! AcceleratorCache& rCache = impl_getCFG(); + auto lPreferredOnesRange = asNonConstRange(lPreferredOnes); for (i=0; i<c; ++i) { const OUString& rCommand = lCommandList[i]; @@ -187,7 +188,7 @@ css::uno::Sequence< css::uno::Any > SAL_CALL XMLBasedAcceleratorConfiguration::g if ( lKeys.empty() ) continue; - css::uno::Any& rAny = lPreferredOnes[i]; + css::uno::Any& rAny = lPreferredOnesRange[i]; rAny <<= *(lKeys.begin()); } @@ -677,6 +678,7 @@ css::uno::Sequence< css::uno::Any > SAL_CALL XCUBasedAcceleratorConfiguration::g css::uno::Sequence< css::uno::Any > lPreferredOnes (c); // don't pack list! AcceleratorCache& rCache = impl_getCFG(true); + auto lPreferredOnesRange = asNonConstRange(lPreferredOnes); for (i=0; i<c; ++i) { const OUString& rCommand = lCommandList[i]; @@ -696,7 +698,7 @@ css::uno::Sequence< css::uno::Any > SAL_CALL XCUBasedAcceleratorConfiguration::g AcceleratorCache::TKeyList::const_iterator pPreferredKey = lcl_getPreferredKey(lKeys); if (pPreferredKey != lKeys.end ()) { - css::uno::Any& rAny = lPreferredOnes[i]; + css::uno::Any& rAny = lPreferredOnesRange[i]; rAny <<= *pPreferredKey; } } diff --git a/framework/source/accelerators/presethandler.cxx b/framework/source/accelerators/presethandler.cxx index 44a6131a2951..40d8aeaebe3c 100644 --- a/framework/source/accelerators/presethandler.cxx +++ b/framework/source/accelerators/presethandler.cxx @@ -201,9 +201,10 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorag // based of a system directory. This must be used so, till the storage implementation // can work on directories too. */ - css::uno::Sequence< css::uno::Any > lArgs(2); - lArgs[0] <<= sShareLayer; - lArgs[1] <<= css::embed::ElementModes::READ | css::embed::ElementModes::NOCREATE; + css::uno::Sequence< css::uno::Any > lArgs{ + css::uno::Any(sShareLayer), + css::uno::Any(css::embed::ElementModes::READ | css::embed::ElementModes::NOCREATE) + }; css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory = css::embed::FileSystemStorageFactory::create( xContext ); css::uno::Reference< css::embed::XStorage > xStorage; @@ -249,9 +250,8 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::getOrCreateRootStorag sUserLayer += "soffice.cfg"; // storage file - css::uno::Sequence< css::uno::Any > lArgs(2); - lArgs[0] <<= sUserLayer; - lArgs[1] <<= css::embed::ElementModes::READWRITE; + css::uno::Sequence< css::uno::Any > lArgs{ css::uno::Any(sUserLayer), + css::uno::Any(css::embed::ElementModes::READWRITE) }; css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory = css::embed::FileSystemStorageFactory::create( xContext ); css::uno::Reference< css::embed::XStorage > xStorage; diff --git a/framework/source/classes/taskcreator.cxx b/framework/source/classes/taskcreator.cxx index baaaa7aba708..9c8ea6415aeb 100644 --- a/framework/source/classes/taskcreator.cxx +++ b/framework/source/classes/taskcreator.cxx @@ -71,33 +71,34 @@ css::uno::Reference< css::frame::XFrame > TaskCreator::createTask( const OUStrin xCreator = css::frame::TaskCreator::create(m_xContext); css::uno::Sequence< css::uno::Any > lArgs(6); + auto plArgs = lArgs.getArray(); css::beans::NamedValue aArg; aArg.Name = ARGUMENT_PARENTFRAME; aArg.Value <<= css::uno::Reference< css::frame::XFrame >( css::frame::Desktop::create( m_xContext ), css::uno::UNO_QUERY_THROW); - lArgs[0] <<= aArg; + plArgs[0] <<= aArg; aArg.Name = ARGUMENT_CREATETOPWINDOW; aArg.Value <<= true; - lArgs[1] <<= aArg; + plArgs[1] <<= aArg; aArg.Name = ARGUMENT_MAKEVISIBLE; aArg.Value <<= false; - lArgs[2] <<= aArg; + plArgs[2] <<= aArg; aArg.Name = ARGUMENT_SUPPORTPERSISTENTWINDOWSTATE; aArg.Value <<= true; - lArgs[3] <<= aArg; + plArgs[3] <<= aArg; aArg.Name = ARGUMENT_FRAMENAME; aArg.Value <<= sName; - lArgs[4] <<= aArg; + plArgs[4] <<= aArg; bool bHidden = rDescriptor.getUnpackedValueOrDefault("HiddenForConversion", false); aArg.Name = "HiddenForConversion"; aArg.Value <<= bHidden; - lArgs[5] <<= aArg; + plArgs[5] <<= aArg; css::uno::Reference< css::frame::XFrame > xTask(xCreator->createInstanceWithArguments(lArgs), css::uno::UNO_QUERY_THROW); return xTask; diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx index d4fa824c11e0..6b2a13cb4eb7 100644 --- a/framework/source/dispatch/closedispatcher.cxx +++ b/framework/source/dispatch/closedispatcher.cxx @@ -101,16 +101,16 @@ css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL CloseDispatcher:: /* Attention: Don't add .uno:CloseFrame here. Because it's not really a configurable feature ... and further it does not have a valid UIName entry inside the GenericCommands.xcu ... */ - css::uno::Sequence< css::frame::DispatchInformation > lViewInfos(1); - lViewInfos[0].Command = URL_CLOSEWIN; - lViewInfos[0].GroupId = css::frame::CommandGroup::VIEW; + css::uno::Sequence< css::frame::DispatchInformation > lViewInfos{ + { URL_CLOSEWIN, css::frame::CommandGroup::VIEW } + }; return lViewInfos; } else if (nCommandGroup == css::frame::CommandGroup::DOCUMENT) { - css::uno::Sequence< css::frame::DispatchInformation > lDocInfos(1); - lDocInfos[0].Command = URL_CLOSEDOC; - lDocInfos[0].GroupId = css::frame::CommandGroup::DOCUMENT; + css::uno::Sequence< css::frame::DispatchInformation > lDocInfos{ + { URL_CLOSEDOC, css::frame::CommandGroup::DOCUMENT } + }; return lDocInfos; } diff --git a/framework/source/dispatch/dispatchdisabler.cxx b/framework/source/dispatch/dispatchdisabler.cxx index b38fe3d521d5..2341d0dd6439 100644 --- a/framework/source/dispatch/dispatchdisabler.cxx +++ b/framework/source/dispatch/dispatchdisabler.cxx @@ -52,8 +52,9 @@ uno::Sequence< uno::Reference< frame::XDispatch > > SAL_CALL DispatchDisabler::queryDispatches( const uno::Sequence< frame::DispatchDescriptor >& rRequests ) { uno::Sequence< uno::Reference< frame::XDispatch > > aResult(rRequests.getLength()); + auto aResultRange = asNonConstRange(aResult); for( sal_Int32 i = 0; i < rRequests.getLength(); ++i ) - aResult[i] = queryDispatch(rRequests[i].FeatureURL, + aResultRange[i] = queryDispatch(rRequests[i].FeatureURL, rRequests[i].FrameName, rRequests[i].SearchFlags); return aResult; @@ -87,9 +88,10 @@ uno::Sequence< OUString > SAL_CALL DispatchDisabler::getInterceptedURLs() { uno::Sequence< OUString > aDisabledURLs(maDisabledURLs.size()); + auto aDisabledURLsRange = asNonConstRange(aDisabledURLs); sal_Int32 n = 0; for (auto const& disabledURL : maDisabledURLs) - aDisabledURLs[n++] = disabledURL; + aDisabledURLsRange[n++] = disabledURL; return aDisabledURLs; } diff --git a/framework/source/dispatch/dispatchinformationprovider.cxx b/framework/source/dispatch/dispatchinformationprovider.cxx index 3ad13062fd62..0f4b488a19a9 100644 --- a/framework/source/dispatch/dispatchinformationprovider.cxx +++ b/framework/source/dispatch/dispatchinformationprovider.cxx @@ -117,10 +117,9 @@ css::uno::Sequence< css::uno::Reference< css::frame::XDispatchInformationProvide css::uno::Reference< css::frame::XDispatchInformationProvider > xController (xFrame->getController() , css::uno::UNO_QUERY); css::uno::Reference< css::frame::XDispatchInformationProvider > xAppDispatcher = css::frame::AppDispatchProvider::create(m_xContext); - css::uno::Sequence< css::uno::Reference< css::frame::XDispatchInformationProvider > > lProvider(3); - lProvider[0] = xController; - lProvider[1] = css::uno::Reference< css::frame::XDispatchInformationProvider >(xCloser); - lProvider[2] = xAppDispatcher; + css::uno::Sequence< css::uno::Reference< css::frame::XDispatchInformationProvider > > lProvider{ + xController, xCloser, xAppDispatcher + }; return lProvider; } diff --git a/framework/source/dispatch/dispatchprovider.cxx b/framework/source/dispatch/dispatchprovider.cxx index e7c7fdfbe1a1..578170227578 100644 --- a/framework/source/dispatch/dispatchprovider.cxx +++ b/framework/source/dispatch/dispatchprovider.cxx @@ -126,11 +126,11 @@ css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL Disp // It's not allowed to pack it! sal_Int32 nCount = lDescriptions.getLength(); css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > lDispatcher( nCount ); - + auto lDispatcherRange = asNonConstRange(lDispatcher); // Step over all descriptors and try to get any dispatcher for it. for( sal_Int32 i=0; i<nCount; ++i ) { - lDispatcher[i] = queryDispatch( lDescriptions[i].FeatureURL , + lDispatcherRange[i] = queryDispatch( lDescriptions[i].FeatureURL , lDescriptions[i].FrameName , lDescriptions[i].SearchFlags ); } @@ -460,8 +460,7 @@ css::uno::Reference< css::frame::XDispatch > DispatchProvider::implts_searchProt try { // but do it only, if all context information is OK - css::uno::Sequence< css::uno::Any > lContext(1); - lContext[0] <<= xOwner; + css::uno::Sequence< css::uno::Any > lContext{ css::uno::Any(xOwner) }; xInit->initialize(lContext); } catch(const css::uno::Exception&) {} diff --git a/framework/source/dispatch/interceptionhelper.cxx b/framework/source/dispatch/interceptionhelper.cxx index 3363805299f8..ecbace6337fd 100644 --- a/framework/source/dispatch/interceptionhelper.cxx +++ b/framework/source/dispatch/interceptionhelper.cxx @@ -116,10 +116,7 @@ void SAL_CALL InterceptionHelper::registerDispatchProviderInterceptor(const css: if (xInfo.is()) aInfo.lURLPattern = xInfo->getInterceptedURLs(); else - { - aInfo.lURLPattern.realloc(1); - aInfo.lURLPattern[0] = "*"; - } + aInfo.lURLPattern = { "*" }; // SAFE { SolarMutexClearableGuard aWriteLock; diff --git a/framework/source/dispatch/mailtodispatcher.cxx b/framework/source/dispatch/mailtodispatcher.cxx index 330e395c4cfa..4c74d1ca7c6a 100644 --- a/framework/source/dispatch/mailtodispatcher.cxx +++ b/framework/source/dispatch/mailtodispatcher.cxx @@ -92,9 +92,10 @@ css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL Mail { sal_Int32 nCount = lDescriptor.getLength(); css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > lDispatcher( nCount ); + auto lDispatcherRange = asNonConstRange(lDispatcher); for( sal_Int32 i=0; i<nCount; ++i ) { - lDispatcher[i] = queryDispatch( + lDispatcherRange[i] = queryDispatch( lDescriptor[i].FeatureURL, lDescriptor[i].FrameName, lDescriptor[i].SearchFlags); diff --git a/framework/source/dispatch/oxt_handler.cxx b/framework/source/dispatch/oxt_handler.cxx index 254e07fed72e..92aa2711d827 100644 --- a/framework/source/dispatch/oxt_handler.cxx +++ b/framework/source/dispatch/oxt_handler.cxx @@ -93,8 +93,7 @@ void SAL_CALL Oxt_Handler::dispatchWithNotification( const css::util::URL& aURL, { osl::MutexGuard g(m_mutex); - css::uno::Sequence< css::uno::Any > lParams(1); - lParams[0] <<= aURL.Main; + css::uno::Sequence< css::uno::Any > lParams{ css::uno::Any(aURL.Main) }; css::uno::Reference< css::uno::XInterface > xService = m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( "com.sun.star.deployment.ui.PackageManagerDialog", lParams, m_xContext ); css::uno::Reference< css::task::XJobExecutor > xExecutable( xService, css::uno::UNO_QUERY ); diff --git a/framework/source/dispatch/popupmenudispatcher.cxx b/framework/source/dispatch/popupmenudispatcher.cxx index a35bd10599fd..154b9df688b4 100644 --- a/framework/source/dispatch/popupmenudispatcher.cxx +++ b/framework/source/dispatch/popupmenudispatcher.cxx @@ -160,9 +160,10 @@ PopupMenuDispatcher::queryDispatches( { sal_Int32 nCount = lDescriptor.getLength(); css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > lDispatcher( nCount ); + auto lDispatcherRange = asNonConstRange(lDispatcher); for( sal_Int32 i=0; i<nCount; ++i ) { - lDispatcher[i] = queryDispatch( + lDispatcherRange[i] = queryDispatch( lDescriptor[i].FeatureURL, lDescriptor[i].FrameName, lDescriptor[i].SearchFlags); diff --git a/framework/source/dispatch/servicehandler.cxx b/framework/source/dispatch/servicehandler.cxx index a7a100bd19c1..bff05e79f1eb 100644 --- a/framework/source/dispatch/servicehandler.cxx +++ b/framework/source/dispatch/servicehandler.cxx @@ -94,9 +94,10 @@ css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL Serv { sal_Int32 nCount = lDescriptor.getLength(); css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > lDispatcher( nCount ); + auto lDispatcherRange = asNonConstRange(lDispatcher); for( sal_Int32 i=0; i<nCount; ++i ) { - lDispatcher[i] = queryDispatch( + lDispatcherRange[i] = queryDispatch( lDescriptor[i].FeatureURL, lDescriptor[i].FrameName, lDescriptor[i].SearchFlags); diff --git a/framework/source/dispatch/systemexec.cxx b/framework/source/dispatch/systemexec.cxx index 7ee48b7fc676..72f217e6ccfb 100644 --- a/framework/source/dispatch/systemexec.cxx +++ b/framework/source/dispatch/systemexec.cxx @@ -71,9 +71,10 @@ css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL Syst { sal_Int32 nCount = lDescriptor.getLength(); css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > lDispatcher( nCount ); + auto lDispatcherRange = asNonConstRange(lDispatcher); for( sal_Int32 i=0; i<nCount; ++i ) { - lDispatcher[i] = queryDispatch( + lDispatcherRange[i] = queryDispatch( lDescriptor[i].FeatureURL, lDescriptor[i].FrameName, lDescriptor[i].SearchFlags); diff --git a/framework/source/fwe/classes/actiontriggercontainer.cxx b/framework/source/fwe/classes/actiontriggercontainer.cxx index e6675cf17c96..360223e6eb67 100644 --- a/framework/source/fwe/classes/actiontriggercontainer.cxx +++ b/framework/source/fwe/classes/actiontriggercontainer.cxx @@ -87,11 +87,9 @@ Reference< XInterface > SAL_CALL ActionTriggerContainer::createInstanceWithArgum Sequence< OUString > SAL_CALL ActionTriggerContainer::getAvailableServiceNames() { - Sequence< OUString > aSeq( 3 ); - - aSeq[0] = SERVICENAME_ACTIONTRIGGER; - aSeq[1] = SERVICENAME_ACTIONTRIGGERCONTAINER; - aSeq[2] = SERVICENAME_ACTIONTRIGGERSEPARATOR; + Sequence< OUString > aSeq{ SERVICENAME_ACTIONTRIGGER, + SERVICENAME_ACTIONTRIGGERCONTAINER, + SERVICENAME_ACTIONTRIGGERSEPARATOR }; return aSeq; } diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx index cd638a979522..ad9408291e34 100644 --- a/framework/source/fwe/classes/addonsoptions.cxx +++ b/framework/source/fwe/classes/addonsoptions.cxx @@ -655,14 +655,14 @@ void AddonsOptions_Impl::ReadAddonMenuSet( Sequence< Sequence< PropertyValue > > sal_uInt32 nCount = aAddonMenuNodeSeq.getLength(); sal_uInt32 nIndex = 0; Sequence< PropertyValue > aMenuItem( PROPERTYCOUNT_MENUITEM ); - + auto pMenuItem = aMenuItem.getArray(); // Init the property value sequence - aMenuItem[ OFFSET_MENUITEM_URL ].Name = m_aPropNames[ INDEX_URL ]; - aMenuItem[ OFFSET_MENUITEM_TITLE ].Name = m_aPropNames[ INDEX_TITLE ]; - aMenuItem[ OFFSET_MENUITEM_TARGET ].Name = m_aPropNames[ INDEX_TARGET ]; - aMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Name = m_aPropNames[ INDEX_IMAGEIDENTIFIER]; - aMenuItem[ OFFSET_MENUITEM_CONTEXT ].Name = m_aPropNames[ INDEX_CONTEXT ]; - aMenuItem[ OFFSET_MENUITEM_SUBMENU ].Name = m_aPropNames[ INDEX_SUBMENU ]; // Submenu set! + pMenuItem[ OFFSET_MENUITEM_URL ].Name = m_aPropNames[ INDEX_URL ]; + pMenuItem[ OFFSET_MENUITEM_TITLE ].Name = m_aPropNames[ INDEX_TITLE ]; + pMenuItem[ OFFSET_MENUITEM_TARGET ].Name = m_aPropNames[ INDEX_TARGET ]; + pMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Name = m_aPropNames[ INDEX_IMAGEIDENTIFIER]; + pMenuItem[ OFFSET_MENUITEM_CONTEXT ].Name = m_aPropNames[ INDEX_CONTEXT ]; + pMenuItem[ OFFSET_MENUITEM_SUBMENU ].Name = m_aPropNames[ INDEX_SUBMENU ]; // Submenu set! for ( sal_uInt32 n = 0; n < nCount; n++ ) { @@ -674,7 +674,7 @@ void AddonsOptions_Impl::ReadAddonMenuSet( Sequence< Sequence< PropertyValue > > // Successfully read a menu item, append to our list sal_uInt32 nMenuItemCount = rAddonMenuSeq.getLength() + 1; rAddonMenuSeq.realloc( nMenuItemCount ); - rAddonMenuSeq[nIndex++] = aMenuItem; + rAddonMenuSeq.getArray()[nIndex++] = aMenuItem; } } } @@ -689,14 +689,14 @@ void AddonsOptions_Impl::ReadOfficeHelpSet( Sequence< Sequence< PropertyValue > sal_uInt32 nCount = aAddonHelpMenuNodeSeq.getLength(); sal_uInt32 nIndex = 0; Sequence< PropertyValue > aMenuItem( PROPERTYCOUNT_MENUITEM ); - + auto pMenuItem = aMenuItem.getArray(); // Init the property value sequence - aMenuItem[ OFFSET_MENUITEM_URL ].Name = m_aPropNames[ INDEX_URL ]; - aMenuItem[ OFFSET_MENUITEM_TITLE ].Name = m_aPropNames[ INDEX_TITLE ]; - aMenuItem[ OFFSET_MENUITEM_TARGET ].Name = m_aPropNames[ INDEX_TARGET ]; - aMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Name = m_aPropNames[ INDEX_IMAGEIDENTIFIER]; - aMenuItem[ OFFSET_MENUITEM_CONTEXT ].Name = m_aPropNames[ INDEX_CONTEXT ]; - aMenuItem[ OFFSET_MENUITEM_SUBMENU ].Name = m_aPropNames[ INDEX_SUBMENU ]; // Submenu set! + pMenuItem[ OFFSET_MENUITEM_URL ].Name = m_aPropNames[ INDEX_URL ]; + pMenuItem[ OFFSET_MENUITEM_TITLE ].Name = m_aPropNames[ INDEX_TITLE ]; + pMenuItem[ OFFSET_MENUITEM_TARGET ].Name = m_aPropNames[ INDEX_TARGET ]; + pMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Name = m_aPropNames[ INDEX_IMAGEIDENTIFIER]; + pMenuItem[ OFFSET_MENUITEM_CONTEXT ].Name = m_aPropNames[ INDEX_CONTEXT ]; + pMenuItem[ OFFSET_MENUITEM_SUBMENU ].Name = m_aPropNames[ INDEX_SUBMENU ]; // Submenu set! for ( sal_uInt32 n = 0; n < nCount; n++ ) { @@ -708,7 +708,7 @@ void AddonsOptions_Impl::ReadOfficeHelpSet( Sequence< Sequence< PropertyValue > // Successfully read a menu item, append to our list sal_uInt32 nMenuItemCount = rAddonOfficeHelpMenuSeq.getLength() + 1; rAddonOfficeHelpMenuSeq.realloc( nMenuItemCount ); - rAddonOfficeHelpMenuSeq[nIndex++] = aMenuItem; + rAddonOfficeHelpMenuSeq.getArray()[nIndex++] = aMenuItem; } } } @@ -723,15 +723,15 @@ void AddonsOptions_Impl::ReadOfficeMenuBarSet( Sequence< Sequence< PropertyValue sal_uInt32 nCount = aAddonMenuBarNodeSeq.getLength(); sal_uInt32 nIndex = 0; Sequence< PropertyValue > aPopupMenu( PROPERTYCOUNT_POPUPMENU ); - + auto pPopupMenu = aPopupMenu.getArray(); // Init the property value sequence - aPopupMenu[ OFFSET_POPUPMENU_TITLE ].Name = m_aPropNames[ INDEX_TITLE ]; - aPopupMenu[ OFFSET_POPUPMENU_CONTEXT ].Name = m_aPropNames[ INDEX_CONTEXT]; - aPopupMenu[ OFFSET_POPUPMENU_SUBMENU ].Name = m_aPropNames[ INDEX_SUBMENU]; - aPopupMenu[ OFFSET_POPUPMENU_URL ].Name = m_aPropNames[ INDEX_URL ]; + pPopupMenu[ OFFSET_POPUPMENU_TITLE ].Name = m_aPropNames[ INDEX_TITLE ]; + pPopupMenu[ OFFSET_POPUPMENU_CONTEXT ].Name = m_aPropNames[ INDEX_CONTEXT]; + pPopupMenu[ OFFSET_POPUPMENU_SUBMENU ].Name = m_aPropNames[ INDEX_SUBMENU]; + pPopupMenu[ OFFSET_POPUPMENU_URL ].Name = m_aPropNames[ INDEX_URL ]; StringToIndexMap aTitleToIndexMap; - + auto pAddonOfficeMenuBarSeq = rAddonOfficeMenuBarSeq.getArray(); for ( sal_uInt32 n = 0; n < nCount; n++ ) { OUString aPopupMenuNode( aAddonMenuBarNode + aAddonMenuBarNodeSeq[n] ); @@ -747,7 +747,7 @@ void AddonsOptions_Impl::ReadOfficeMenuBarSet( Sequence< Sequence< PropertyValue if ( pIter != aTitleToIndexMap.end() ) { // title already there => concat both popup menus - Sequence< PropertyValue >& rOldPopupMenu = rAddonOfficeMenuBarSeq[pIter->second]; + Sequence< PropertyValue >& rOldPopupMenu = pAddonOfficeMenuBarSeq[pIter->second]; AppendPopupMenu( rOldPopupMenu, aPopupMenu ); } else @@ -755,7 +755,8 @@ void AddonsOptions_Impl::ReadOfficeMenuBarSet( Sequence< Sequence< PropertyValue // not found sal_uInt32 nMenuItemCount = rAddonOfficeMenuBarSeq.getLength() + 1; rAddonOfficeMenuBarSeq.realloc( nMenuItemCount ); - rAddonOfficeMenuBarSeq[nIndex] = aPopupMenu; + pAddonOfficeMenuBarSeq = rAddonOfficeMenuBarSeq.getArray(); + pAddonOfficeMenuBarSeq[nIndex] = aPopupMenu; aTitleToIndexMap.emplace( aPopupTitle, nIndex ); ++nIndex; } @@ -788,15 +789,15 @@ bool AddonsOptions_Impl::ReadToolBarItemSet( const OUString& rToolBarItemSetNode OUString aAddonToolBarItemSetNode( rToolBarItemSetNodeName + m_aPathDelimiter ); Sequence< OUString > aAddonToolBarItemSetNodeSeq = GetNodeNames( rToolBarItemSetNodeName ); Sequence< PropertyValue > aToolBarItem( PROPERTYCOUNT_TOOLBARITEM ); - + auto pToolBarItem = aToolBarItem.getArray(); // Init the property value sequence - aToolBarItem[ OFFSET_TOOLBARITEM_URL ].Name = m_aPropNames[ INDEX_URL ]; - aToolBarItem[ OFFSET_TOOLBARITEM_TITLE ].Name = m_aPropNames[ INDEX_TITLE ]; - aToolBarItem[ OFFSET_TOOLBARITEM_IMAGEIDENTIFIER ].Name = m_aPropNames[ INDEX_IMAGEIDENTIFIER]; - aToolBarItem[ OFFSET_TOOLBARITEM_TARGET ].Name = m_aPropNames[ INDEX_TARGET ]; - aToolBarItem[ OFFSET_TOOLBARITEM_CONTEXT ].Name = m_aPropNames[ INDEX_CONTEXT ]; - aToolBarItem[ OFFSET_TOOLBARITEM_CONTROLTYPE ].Name = m_aPropNames[ INDEX_CONTROLTYPE ]; - aToolBarItem[ OFFSET_TOOLBARITEM_WIDTH ].Name = m_aPropNames[ INDEX_WIDTH ]; + pToolBarItem[ OFFSET_TOOLBARITEM_URL ].Name = m_aPropNames[ INDEX_URL ]; + pToolBarItem[ OFFSET_TOOLBARITEM_TITLE ].Name = m_aPropNames[ INDEX_TITLE ]; + pToolBarItem[ OFFSET_TOOLBARITEM_IMAGEIDENTIFIER ].Name = m_aPropNames[ INDEX_IMAGEIDENTIFIER]; + pToolBarItem[ OFFSET_TOOLBARITEM_TARGET ].Name = m_aPropNames[ INDEX_TARGET ]; + pToolBarItem[ OFFSET_TOOLBARITEM_CONTEXT ].Name = m_aPropNames[ INDEX_CONTEXT ]; + pToolBarItem[ OFFSET_TOOLBARITEM_CONTROLTYPE ].Name = m_aPropNames[ INDEX_CONTROLTYPE ]; + pToolBarItem[ OFFSET_TOOLBARITEM_WIDTH ].Name = m_aPropNames[ INDEX_WIDTH ]; sal_uInt32 nCount = aAddonToolBarItemSetNodeSeq.getLength(); for ( sal_uInt32 n = 0; n < nCount; n++ ) @@ -809,7 +810,7 @@ bool AddonsOptions_Impl::ReadToolBarItemSet( const OUString& rToolBarItemSetNode // Successfully read a toolbar item, append to our list sal_uInt32 nAddonCount = rAddonOfficeToolBarSeq.getLength(); rAddonOfficeToolBarSeq.realloc( nAddonCount+1 ); - rAddonOfficeToolBarSeq[nAddonCount] = aToolBarItem; + rAddonOfficeToolBarSeq.getArray()[nAddonCount] = aToolBarItem; } } @@ -844,17 +845,17 @@ bool AddonsOptions_Impl::ReadNotebookBarItemSet( OUString aAddonNotebookBarItemSetNode(rNotebookBarItemSetNodeName + m_aPathDelimiter); Sequence<OUString> aAddonNotebookBarItemSetNodeSeq = GetNodeNames(rNotebookBarItemSetNodeName); Sequence<PropertyValue> aNotebookBarItem(PROPERTYCOUNT_NOTEBOOKBARITEM); - + auto pNotebookBarItem = aNotebookBarItem.getArray(); // Init the property value sequence - aNotebookBarItem[OFFSET_NOTEBOOKBARITEM_URL].Name = m_aPropNames[INDEX_URL]; - aNotebookBarItem[OFFSET_NOTEBOOKBARITEM_TITLE].Name = m_aPropNames[INDEX_TITLE]; - aNotebookBarItem[OFFSET_NOTEBOOKBARITEM_IMAGEIDENTIFIER].Name + pNotebookBarItem[OFFSET_NOTEBOOKBARITEM_URL].Name = m_aPropNames[INDEX_URL]; + pNotebookBarItem[OFFSET_NOTEBOOKBARITEM_TITLE].Name = m_aPropNames[INDEX_TITLE]; + pNotebookBarItem[OFFSET_NOTEBOOKBARITEM_IMAGEIDENTIFIER].Name = m_aPropNames[INDEX_IMAGEIDENTIFIER]; - aNotebookBarItem[OFFSET_NOTEBOOKBARITEM_TARGET].Name = m_aPropNames[INDEX_TARGET]; - aNotebookBarItem[OFFSET_NOTEBOOKBARITEM_CONTEXT].Name = m_aPropNames[INDEX_CONTEXT]; - aNotebookBarItem[OFFSET_NOTEBOOKBARITEM_CONTROLTYPE].Name = m_aPropNames[INDEX_CONTROLTYPE]; - aNotebookBarItem[OFFSET_NOTEBOOKBARITEM_WIDTH].Name = m_aPropNames[INDEX_WIDTH]; - aNotebookBarItem[OFFSET_NOTEBOOKBARITEM_STYLE].Name = m_aPropNames[INDEX_STYLE]; + pNotebookBarItem[OFFSET_NOTEBOOKBARITEM_TARGET].Name = m_aPropNames[INDEX_TARGET]; + pNotebookBarItem[OFFSET_NOTEBOOKBARITEM_CONTEXT].Name = m_aPropNames[INDEX_CONTEXT]; + pNotebookBarItem[OFFSET_NOTEBOOKBARITEM_CONTROLTYPE].Name = m_aPropNames[INDEX_CONTROLTYPE]; + pNotebookBarItem[OFFSET_NOTEBOOKBARITEM_WIDTH].Name = m_aPropNames[INDEX_WIDTH]; + pNotebookBarItem[OFFSET_NOTEBOOKBARITEM_STYLE].Name = m_aPropNames[INDEX_STYLE]; sal_uInt32 nCount = aAddonNotebookBarItemSetNodeSeq.getLength(); for (sal_uInt32 n = 0; n < nCount; n++) @@ -867,7 +868,7 @@ bool AddonsOptions_Impl::ReadNotebookBarItemSet( // Successfully read a toolbar item, append to our list sal_uInt32 nAddonCount = rAddonOfficeNotebookBarSeq.getLength(); rAddonOfficeNotebookBarSeq.realloc(nAddonCount + 1); - rAddonOfficeNotebookBarSeq[nAddonCount] = aNotebookBarItem; + rAddonOfficeNotebookBarSeq.getArray()[nAddonCount] = aNotebookBarItem; } } @@ -885,7 +886,6 @@ void AddonsOptions_Impl::ReadImages( ImageManager& aImageManager ) sal_uInt32 nCount = aAddonImagesNodeSeq.getLength(); // Init the property value sequence - Sequence< OUString > aAddonImageItemNodePropNames( 1 ); OUString aURL; for ( sal_uInt32 n = 0; n < nCount; n++ ) @@ -893,9 +893,9 @@ void AddonsOptions_Impl::ReadImages( ImageManager& aImageManager ) OUString aImagesItemNode( aAddonImagesNode + aAddonImagesNodeSeq[n] ); // Create sequence for data access - aAddonImageItemNodePropNames[0] = aImagesItemNode + + Sequence< OUString > aAddonImageItemNodePropNames = { aImagesItemNode + m_aPathDelimiter + - m_aPropNames[ OFFSET_MENUITEM_URL ]; + m_aPropNames[ OFFSET_MENUITEM_URL ] }; Sequence< Any > aAddonImageItemNodeValues = GetProperties( aAddonImageItemNodePropNames ); @@ -942,6 +942,7 @@ void AddonsOptions_Impl::ReadMenuMergeInstructions( MergeMenuInstructionContaine // Init the property value sequence Sequence< OUString > aNodePropNames( 5 ); + auto pNodePropNames = aNodePropNames.getArray(); for ( sal_uInt32 i = 0; i < nCount; i++ ) { @@ -958,19 +959,19 @@ void AddonsOptions_Impl::ReadMenuMergeInstructions( MergeMenuInstructionContaine m_aPathDelimiter; // Create sequence for data access - aNodePropNames[0] = aMergeAddonInstructionBase + + pNodePropNames[0] = aMergeAddonInstructionBase + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGEPOINT ]; - aNodePropNames[1] = aMergeAddonInstructionBase + + pNodePropNames[1] = aMergeAddonInstructionBase + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECOMMAND ]; - aNodePropNames[2] = aMergeAddonInstructionBase + + pNodePropNames[2] = aMergeAddonInstructionBase + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECOMMANDPARAMETER ]; - aNodePropNames[3] = aMergeAddonInstructionBase + + pNodePropNames[3] = aMergeAddonInstructionBase + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGEFALLBACK ]; - aNodePropNames[4] = aMergeAddonInstructionBase + + pNodePropNames[4] = aMergeAddonInstructionBase + m_aPropMergeMenuNames[ OFFSET_MERGEMENU_MERGECONTEXT ]; Sequence< Any > aNodePropValues = GetProperties( aNodePropNames ); @@ -1012,6 +1013,7 @@ void AddonsOptions_Impl::ReadToolbarMergeInstructions( ToolbarMergingInstruction // Init the property value sequence Sequence< OUString > aNodePropNames( 6 ); + auto pNodePropNames = aNodePropNames.getArray(); for ( sal_uInt32 i = 0; i < nCount; i++ ) { @@ -1028,22 +1030,22 @@ void AddonsOptions_Impl::ReadToolbarMergeInstructions( ToolbarMergingInstruction m_aPathDelimiter; // Create sequence for data access - aNodePropNames[0] = aMergeAddonInstructionBase + + pNodePropNames[0] = aMergeAddonInstructionBase + m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_TOOLBAR ]; - aNodePropNames[1] = aMergeAddonInstructionBase + + pNodePropNames[1] = aMergeAddonInstructionBase + m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGEPOINT ]; - aNodePropNames[2] = aMergeAddonInstructionBase + + pNodePropNames[2] = aMergeAddonInstructionBase + m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECOMMAND ]; - aNodePropNames[3] = aMergeAddonInstructionBase + + pNodePropNames[3] = aMergeAddonInstructionBase + m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECOMMANDPARAMETER ]; - aNodePropNames[4] = aMergeAddonInstructionBase + + pNodePropNames[4] = aMergeAddonInstructionBase + m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGEFALLBACK ]; - aNodePropNames[5] = aMergeAddonInstructionBase + + pNodePropNames[5] = aMergeAddonInstructionBase + m_aPropMergeToolbarNames[ OFFSET_MERGETOOLBAR_MERGECONTEXT ]; Sequence< Any > aNodePropValues = GetProperties( aNodePropNames ); @@ -1083,6 +1085,7 @@ void AddonsOptions_Impl::ReadNotebookBarMergeInstructions( // Init the property value sequence Sequence<OUString> aNodePropNames(6); + auto pNodePropNames = aNodePropNames.getArray(); for (sal_uInt32 i = 0; i < nCount; i++) { @@ -1099,22 +1102,22 @@ void AddonsOptions_Impl::ReadNotebookBarMergeInstructions( m_aPathDelimiter; // Create sequence for data access - aNodePropNames[0] = aMergeAddonInstructionBase + + pNodePropNames[0] = aMergeAddonInstructionBase + m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_NOTEBOOKBAR]; - aNodePropNames[1] = aMergeAddonInstructionBase + + pNodePropNames[1] = aMergeAddonInstructionBase + m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGEPOINT]; - aNodePropNames[2] = aMergeAddonInstructionBase + + pNodePropNames[2] = aMergeAddonInstructionBase + m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECOMMAND]; - aNodePropNames[3] = aMergeAddonInstructionBase + + pNodePropNames[3] = aMergeAddonInstructionBase + m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECOMMANDPARAMETER]; - aNodePropNames[4] = aMergeAddonInstructionBase + + pNodePropNames[4] = aMergeAddonInstructionBase + m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGEFALLBACK]; - aNodePropNames[5] = aMergeAddonInstructionBase + + pNodePropNames[5] = aMergeAddonInstructionBase + m_aPropMergeNotebookBarNames[OFFSET_MERGENOTEBOOKBAR_MERGECONTEXT]; Sequence<Any> aNodePropValues = GetProperties(aNodePropNames); @@ -1156,6 +1159,7 @@ void AddonsOptions_Impl::ReadStatusbarMergeInstructions( MergeStatusbarInstructi sal_uInt32 nCount = aAddonMergeNodesSeq.getLength(); Sequence< OUString > aNodePropNames( 5 ); + auto pNodePropNames = aNodePropNames.getArray(); for ( sal_uInt32 i = 0; i < nCount; i++ ) { @@ -1172,19 +1176,19 @@ void AddonsOptions_Impl::ReadStatusbarMergeInstructions( MergeStatusbarInstructi m_aPathDelimiter; // Create sequence for data access - aNodePropNames[0] = aMergeAddonInstructionBase + + pNodePropNames[0] = aMergeAddonInstructionBase + m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGEPOINT ]; - aNodePropNames[1] = aMergeAddonInstructionBase + + pNodePropNames[1] = aMergeAddonInstructionBase + m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECOMMAND ]; - aNodePropNames[2] = aMergeAddonInstructionBase + + pNodePropNames[2] = aMergeAddonInstructionBase + m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECOMMANDPARAMETER ]; - aNodePropNames[3] = aMergeAddonInstructionBase + + pNodePropNames[3] = aMergeAddonInstructionBase + m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGEFALLBACK ]; - aNodePropNames[4] = aMergeAddonInstructionBase + + pNodePropNames[4] = aMergeAddonInstructionBase + m_aPropMergeMenuNames[ OFFSET_MERGESTATUSBAR_MERGECONTEXT ]; Sequence< Any > aNodePropValues = GetProperties( aNodePropNames ); @@ -1215,14 +1219,15 @@ void AddonsOptions_Impl::ReadMergeStatusbarData( Sequence< OUString > aAddonStatusbarItemSetNodeSeq = GetNodeNames( aMergeStatusbarBaseNode ); Sequence< PropertyValue > aStatusbarItem( PROPERTYCOUNT_STATUSBARITEM ); - aStatusbarItem[ OFFSET_STATUSBARITEM_URL ].Name = m_aPropNames[ INDEX_URL ]; - aStatusbarItem[ OFFSET_STATUSBARITEM_TITLE ].Name = m_aPropNames[ INDEX_TITLE ]; - aStatusbarItem[ OFFSET_STATUSBARITEM_CONTEXT ].Name = m_aPropNames[ INDEX_CONTEXT ]; - aStatusbarItem[ OFFSET_STATUSBARITEM_ALIGN ].Name = m_aPropNames[ INDEX_ALIGN ]; - aStatusbarItem[ OFFSET_STATUSBARITEM_AUTOSIZE ].Name = m_aPropNames[ INDEX_AUTOSIZE ]; - aStatusbarItem[ OFFSET_STATUSBARITEM_OWNERDRAW ].Name = m_aPropNames[ INDEX_OWNERDRAW ]; - aStatusbarItem[ OFFSET_STATUSBARITEM_MANDATORY ].Name = m_aPropNames[ INDEX_MANDATORY ]; - aStatusbarItem[ OFFSET_STATUSBARITEM_WIDTH ].Name = m_aPropNames[ INDEX_WIDTH ]; + auto pStatusbarItem = aStatusbarItem.getArray(); + pStatusbarItem[ OFFSET_STATUSBARITEM_URL ].Name = m_aPropNames[ INDEX_URL ]; + pStatusbarItem[ OFFSET_STATUSBARITEM_TITLE ].Name = m_aPropNames[ INDEX_TITLE ]; + pStatusbarItem[ OFFSET_STATUSBARITEM_CONTEXT ].Name = m_aPropNames[ INDEX_CONTEXT ]; + pStatusbarItem[ OFFSET_STATUSBARITEM_ALIGN ].Name = m_aPropNames[ INDEX_ALIGN ]; + pStatusbarItem[ OFFSET_STATUSBARITEM_AUTOSIZE ].Name = m_aPropNames[ INDEX_AUTOSIZE ]; + pStatusbarItem[ OFFSET_STATUSBARITEM_OWNERDRAW ].Name = m_aPropNames[ INDEX_OWNERDRAW ]; + pStatusbarItem[ OFFSET_STATUSBARITEM_MANDATORY ].Name = m_aPropNames[ INDEX_MANDATORY ]; + pStatusbarItem[ OFFSET_STATUSBARITEM_WIDTH ].Name = m_aPropNames[ INDEX_WIDTH ]; sal_uInt32 nCount = aAddonStatusbarItemSetNodeSeq.getLength(); for ( sal_uInt32 n = 0; n < nCount; n++ ) @@ -1233,7 +1238,7 @@ void AddonsOptions_Impl::ReadMergeStatusbarData( { sal_uInt32 nAddonCount = rMergeStatusbarItems.getLength(); rMergeStatusbarItems.realloc( nAddonCount+1 ); - rMergeStatusbarItems[nAddonCount] = aStatusbarItem; + rMergeStatusbarItems.getArray()[nAddonCount] = aStatusbarItem; } } } @@ -1251,18 +1256,19 @@ bool AddonsOptions_Impl::ReadStatusBarItem( // Command URL is required if (( aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_URL ] >>= aURL ) && aURL.getLength() > 0 ) { - aStatusbarItem[ OFFSET_STATUSBARITEM_URL ].Value <<= aURL; - aStatusbarItem[ OFFSET_STATUSBARITEM_TITLE ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_TITLE ]; - aStatusbarItem[ OFFSET_STATUSBARITEM_CONTEXT ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_CONTEXT ]; - aStatusbarItem[ OFFSET_STATUSBARITEM_ALIGN ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_ALIGN ]; - aStatusbarItem[ OFFSET_STATUSBARITEM_AUTOSIZE ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_AUTOSIZE ]; - aStatusbarItem[ OFFSET_STATUSBARITEM_OWNERDRAW ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_OWNERDRAW ]; - aStatusbarItem[ OFFSET_STATUSBARITEM_MANDATORY ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_MANDATORY ]; + auto pStatusbarItem = aStatusbarItem.getArray(); + pStatusbarItem[ OFFSET_STATUSBARITEM_URL ].Value <<= aURL; + pStatusbarItem[ OFFSET_STATUSBARITEM_TITLE ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_TITLE ]; + pStatusbarItem[ OFFSET_STATUSBARITEM_CONTEXT ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_CONTEXT ]; + pStatusbarItem[ OFFSET_STATUSBARITEM_ALIGN ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_ALIGN ]; + pStatusbarItem[ OFFSET_STATUSBARITEM_AUTOSIZE ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_AUTOSIZE ]; + pStatusbarItem[ OFFSET_STATUSBARITEM_OWNERDRAW ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_OWNERDRAW ]; + pStatusbarItem[ OFFSET_STATUSBARITEM_MANDATORY ].Value = aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_MANDATORY ]; // Configuration uses hyper for long. Therefore transform into sal_Int32 sal_Int64 nValue( 0 ); aStatusbarItemNodePropValues[ OFFSET_STATUSBARITEM_WIDTH ] >>= nValue; - aStatusbarItem[ OFFSET_STATUSBARITEM_WIDTH ].Value <<= sal_Int32( nValue ); + pStatusbarItem[ OFFSET_STATUSBARITEM_WIDTH ].Value <<= sal_Int32( nValue ); bResult = true; } @@ -1279,7 +1285,8 @@ bool AddonsOptions_Impl::ReadMenuItem( std::u16string_view aMenuNodeName, Sequen Sequence< Any > aMenuItemNodePropValues = GetProperties( GetPropertyNamesMenuItem( aAddonMenuItemTreeNode ) ); if (( aMenuItemNodePropValues[ OFFSET_MENUITEM_TITLE ] >>= aStrValue ) && !aStrValue.isEmpty() ) { - aMenuItem[ OFFSET_MENUITEM_TITLE ].Value <<= aStrValue; + auto pMenuItem = aMenuItem.getArray(); + pMenuItem[ OFFSET_MENUITEM_TITLE ].Value <<= aStrValue; OUString aRootSubMenuName( aAddonMenuItemTreeNode + m_aPropNames[ INDEX_SUBMENU ] ); Sequence< OUString > aRootSubMenuNodeNames = GetNodeNames( aRootSubMenuName ); @@ -1294,10 +1301,10 @@ bool AddonsOptions_Impl::ReadMenuItem( std::u16string_view aMenuNodeName, Sequen // A popup menu must have a title and can have a URL and ImageIdentifier // Set the other property values to empty - aMenuItem[ OFFSET_MENUITEM_URL ].Value <<= aPopupMenuURL; - aMenuItem[ OFFSET_MENUITEM_TARGET ].Value <<= OUString(); - aMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Value <<= aPopupMenuImageId; - aMenuItem[ OFFSET_MENUITEM_CONTEXT ].Value = aMenuItemNodePropValues[ OFFSET_MENUITEM_CONTEXT ]; + pMenuItem[ OFFSET_MENUITEM_URL ].Value <<= aPopupMenuURL; + pMenuItem[ OFFSET_MENUITEM_TARGET ].Value <<= OUString(); + pMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Value <<= aPopupMenuImageId; + pMenuItem[ OFFSET_MENUITEM_CONTEXT ].Value = aMenuItemNodePropValues[ OFFSET_MENUITEM_CONTEXT ]; // Continue to read the sub menu nodes Sequence< Sequence< PropertyValue > > aSubMenuSeq; @@ -1305,7 +1312,7 @@ bool AddonsOptions_Impl::ReadMenuItem( std::u16string_view aMenuNodeName, Sequen for ( OUString& rName : asNonConstRange(aRootSubMenuNodeNames) ) rName = aSubMenuRootNodeName + rName; ReadSubMenuEntries( aRootSubMenuNodeNames, aSubMenuSeq ); - aMenuItem[ OFFSET_MENUITEM_SUBMENU ].Value <<= aSubMenuSeq; + pMenuItem[ OFFSET_MENUITEM_SUBMENU ].Value <<= aSubMenuSeq; bResult = true; } else if (( aMenuItemNodePropValues[ OFFSET_MENUITEM_URL ] >>= aStrValue ) && !aStrValue.isEmpty() ) @@ -1316,11 +1323,11 @@ bool AddonsOptions_Impl::ReadMenuItem( std::u16string_view aMenuNodeName, Sequen aMenuItemNodePropValues[ OFFSET_MENUITEM_IMAGEIDENTIFIER ] >>= aMenuImageId; ReadAndAssociateImages( aStrValue, aMenuImageId ); - aMenuItem[ OFFSET_MENUITEM_URL ].Value <<= aStrValue; - aMenuItem[ OFFSET_MENUITEM_TARGET ].Value = aMenuItemNodePropValues[ OFFSET_MENUITEM_TARGET ]; - aMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Value <<= aMenuImageId; - aMenuItem[ OFFSET_MENUITEM_CONTEXT ].Value = aMenuItemNodePropValues[ OFFSET_MENUITEM_CONTEXT ]; - aMenuItem[ OFFSET_MENUITEM_SUBMENU ].Value <<= Sequence< Sequence< PropertyValue > >(); // Submenu set! + pMenuItem[ OFFSET_MENUITEM_URL ].Value <<= aStrValue; + pMenuItem[ OFFSET_MENUITEM_TARGET ].Value = aMenuItemNodePropValues[ OFFSET_MENUITEM_TARGET ]; + pMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Value <<= aMenuImageId; + pMenuItem[ OFFSET_MENUITEM_CONTEXT ].Value = aMenuItemNodePropValues[ OFFSET_MENUITEM_CONTEXT ]; + pMenuItem[ OFFSET_MENUITEM_SUBMENU ].Value <<= Sequence< Sequence< PropertyValue > >(); // Submenu set! bResult = true; } @@ -1328,12 +1335,14 @@ bool AddonsOptions_Impl::ReadMenuItem( std::u16string_view aMenuNodeName, Sequen else if (( aMenuItemNodePropValues[ OFFSET_MENUITEM_URL ] >>= aStrValue ) && aStrValue == SEPARATOR_URL ) { + auto pMenuItem = aMenuItem.getArray(); + // Separator - aMenuItem[ OFFSET_MENUITEM_URL ].Value <<= aStrValue; - aMenuItem[ OFFSET_MENUITEM_TARGET ].Value <<= OUString(); - aMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Value <<= OUString(); - aMenuItem[ OFFSET_MENUITEM_CONTEXT ].Value <<= OUString(); - aMenuItem[ OFFSET_MENUITEM_SUBMENU ].Value <<= Sequence< Sequence< PropertyValue > >(); // Submenu set! + pMenuItem[ OFFSET_MENUITEM_URL ].Value <<= aStrValue; + pMenuItem[ OFFSET_MENUITEM_TARGET ].Value <<= OUString(); + pMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Value <<= OUString(); + pMenuItem[ OFFSET_MENUITEM_CONTEXT ].Value <<= OUString(); + pMenuItem[ OFFSET_MENUITEM_SUBMENU ].Value <<= Sequence< Sequence< PropertyValue > >(); // Submenu set! bResult = true; } @@ -1350,7 +1359,8 @@ bool AddonsOptions_Impl::ReadPopupMenu( std::u16string_view aPopupMenuNodeName, if (( aPopupMenuNodePropValues[ OFFSET_POPUPMENU_TITLE ] >>= aStrValue ) && !aStrValue.isEmpty() ) { - aPopupMenu[ OFFSET_POPUPMENU_TITLE ].Value <<= aStrValue; + auto pPopupMenu = aPopupMenu.getArray(); + pPopupMenu[ OFFSET_POPUPMENU_TITLE ].Value <<= aStrValue; OUString aRootSubMenuName( aAddonPopupMenuTreeNode + m_aPropNames[ INDEX_SUBMENU ] ); Sequence< OUString > aRootSubMenuNodeNames = GetNodeNames( aRootSubMenuName ); @@ -1360,8 +1370,8 @@ bool AddonsOptions_Impl::ReadPopupMenu( std::u16string_view aPopupMenuNodeName, // Set a unique prefixed Add-On popup menu URL so it can be identified later OUString aPopupMenuURL = GeneratePrefixURL(); - aPopupMenu[ OFFSET_POPUPMENU_URL ].Value <<= aPopupMenuURL; - aPopupMenu[ OFFSET_POPUPMENU_CONTEXT ].Value = aPopupMenuNodePropValues[ OFFSET_POPUPMENU_CONTEXT ]; + pPopupMenu[ OFFSET_POPUPMENU_URL ].Value <<= aPopupMenuURL; + pPopupMenu[ OFFSET_POPUPMENU_CONTEXT ].Value = aPopupMenuNodePropValues[ OFFSET_POPUPMENU_CONTEXT ]; // Continue to read the sub menu nodes Sequence< Sequence< PropertyValue > > aSubMenuSeq; @@ -1369,7 +1379,7 @@ bool AddonsOptions_Impl::ReadPopupMenu( std::u16string_view aPopupMenuNodeName, for ( OUString& rName : asNonConstRange(aRootSubMenuNodeNames) ) rName = aSubMenuRootNodeName + rName; ReadSubMenuEntries( aRootSubMenuNodeNames, aSubMenuSeq ); - aPopupMenu[ OFFSET_POPUPMENU_SUBMENU ].Value <<= aSubMenuSeq; + pPopupMenu[ OFFSET_POPUPMENU_SUBMENU ].Value <<= aSubMenuSeq; bResult = true; } } @@ -1387,9 +1397,10 @@ void AddonsOptions_Impl::AppendPopupMenu( Sequence< PropertyValue >& rTargetPopu { sal_uInt32 nIndex = aTargetSubMenuSeq.getLength(); aTargetSubMenuSeq.realloc( nIndex + aSourceSubMenuSeq.getLength() ); + auto pTargetSubMenuSeq = aTargetSubMenuSeq.getArray(); for ( Sequence<PropertyValue> const & rSeq : std::as_const(aSourceSubMenuSeq) ) - aTargetSubMenuSeq[nIndex++] = rSeq; - rTargetPopupMenu[ OFFSET_POPUPMENU_SUBMENU ].Value <<= aTargetSubMenuSeq; + pTargetSubMenuSeq[nIndex++] = rSeq; + rTargetPopupMenu.getArray()[ OFFSET_POPUPMENU_SUBMENU ].Value <<= aTargetSubMenuSeq; } } @@ -1407,19 +1418,23 @@ bool AddonsOptions_Impl::ReadToolBarItem( std::u16string_view aToolBarItemNodeNa OUString aTitle; if ( aURL == SEPARATOR_URL ) { + auto pToolBarItem = aToolBarItem.getArray(); + // A separator toolbar item only needs a URL - aToolBarItem[ OFFSET_TOOLBARITEM_URL ].Value <<= aURL; - aToolBarItem[ OFFSET_TOOLBARITEM_TITLE ].Value <<= OUString(); - aToolBarItem[ OFFSET_TOOLBARITEM_TARGET ].Value <<= OUString(); - aToolBarItem[ OFFSET_TOOLBARITEM_IMAGEIDENTIFIER ].Value <<= OUString(); - aToolBarItem[ OFFSET_TOOLBARITEM_CONTEXT ].Value <<= OUString(); - aToolBarItem[ OFFSET_TOOLBARITEM_CONTROLTYPE ].Value <<= OUString(); - aToolBarItem[ OFFSET_TOOLBARITEM_WIDTH ].Value <<= sal_Int32( 0 ); + pToolBarItem[ OFFSET_TOOLBARITEM_URL ].Value <<= aURL; + pToolBarItem[ OFFSET_TOOLBARITEM_TITLE ].Value <<= OUString(); + pToolBarItem[ OFFSET_TOOLBARITEM_TARGET ].Value <<= OUString(); + pToolBarItem[ OFFSET_TOOLBARITEM_IMAGEIDENTIFIER ].Value <<= OUString(); + pToolBarItem[ OFFSET_TOOLBARITEM_CONTEXT ].Value <<= OUString(); + pToolBarItem[ OFFSET_TOOLBARITEM_CONTROLTYPE ].Value <<= OUString(); + pToolBarItem[ OFFSET_TOOLBARITEM_WIDTH ].Value <<= sal_Int32( 0 ); bResult = true; } else if (( aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_TITLE ] >>= aTitle ) && !aTitle.isEmpty() ) { + auto pToolBarItem = aToolBarItem.getArray(); + // A normal toolbar item must also have title => read the other properties; OUString aImageId; @@ -1427,17 +1442,17 @@ bool AddonsOptions_Impl::ReadToolBarItem( std::u16string_view aToolBarItemNodeNa aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_IMAGEIDENTIFIER ] >>= aImageId; ReadAndAssociateImages( aURL, aImageId ); - aToolBarItem[ OFFSET_TOOLBARITEM_URL ].Value <<= aURL; - aToolBarItem[ OFFSET_TOOLBARITEM_TITLE ].Value <<= aTitle; - aToolBarItem[ OFFSET_TOOLBARITEM_TARGET ].Value = aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_TARGET ]; - aToolBarItem[ OFFSET_TOOLBARITEM_IMAGEIDENTIFIER ].Value <<= aImageId; - aToolBarItem[ OFFSET_TOOLBARITEM_CONTEXT ].Value = aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_CONTEXT ]; - aToolBarItem[ OFFSET_TOOLBARITEM_CONTROLTYPE ].Value = aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_CONTROLTYPE ]; + pToolBarItem[ OFFSET_TOOLBARITEM_URL ].Value <<= aURL; + pToolBarItem[ OFFSET_TOOLBARITEM_TITLE ].Value <<= aTitle; + pToolBarItem[ OFFSET_TOOLBARITEM_TARGET ].Value = aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_TARGET ]; + pToolBarItem[ OFFSET_TOOLBARITEM_IMAGEIDENTIFIER ].Value <<= aImageId; + pToolBarItem[ OFFSET_TOOLBARITEM_CONTEXT ].Value = aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_CONTEXT ]; + pToolBarItem[ OFFSET_TOOLBARITEM_CONTROLTYPE ].Value = aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_CONTROLTYPE ]; // Configuration uses hyper for long. Therefore transform into sal_Int32 sal_Int64 nValue( 0 ); aToolBarItemNodePropValues[ OFFSET_TOOLBARITEM_WIDTH ] >>= nValue; - aToolBarItem[ OFFSET_TOOLBARITEM_WIDTH ].Value <<= sal_Int32( nValue ); + pToolBarItem[ OFFSET_TOOLBARITEM_WIDTH ].Value <<= sal_Int32( nValue ); bResult = true; } @@ -1460,20 +1475,24 @@ bool AddonsOptions_Impl::ReadNotebookBarItem( std::u16string_view aNotebookBarIt OUString aTitle; if ( aURL == SEPARATOR_URL ) { + auto pNotebookBarItem = aNotebookBarItem.getArray(); + // A separator toolbar item only needs a URL - aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_URL ].Value <<= aURL; - aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_TITLE ].Value <<= OUString(); - aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_TARGET ].Value <<= OUString(); - aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_IMAGEIDENTIFIER ].Value <<= OUString(); - aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_CONTEXT ].Value <<= OUString(); - aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_CONTROLTYPE ].Value <<= OUString(); - aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_WIDTH ].Value <<= sal_Int32( 0 ); - aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_STYLE ].Value <<= OUString(); + pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_URL ].Value <<= aURL; + pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_TITLE ].Value <<= OUString(); + pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_TARGET ].Value <<= OUString(); + pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_IMAGEIDENTIFIER ].Value <<= OUString(); + pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_CONTEXT ].Value <<= OUString(); + pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_CONTROLTYPE ].Value <<= OUString(); + pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_WIDTH ].Value <<= sal_Int32( 0 ); + pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_STYLE ].Value <<= OUString(); bResult = true; } else if (( aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_TITLE ] >>= aTitle ) && !aTitle.isEmpty() ) { + auto pNotebookBarItem = aNotebookBarItem.getArray(); + // A normal toolbar item must also have title => read the other properties; OUString aImageId; @@ -1481,18 +1500,18 @@ bool AddonsOptions_Impl::ReadNotebookBarItem( std::u16string_view aNotebookBarIt aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_IMAGEIDENTIFIER ] >>= aImageId; ReadAndAssociateImages( aURL, aImageId ); - aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_URL ].Value <<= aURL; - aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_TITLE ].Value <<= aTitle; - aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_TARGET ].Value = aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_TARGET ]; - aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_IMAGEIDENTIFIER ].Value <<= aImageId; - aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_CONTEXT ].Value = aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_CONTEXT ]; - aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_CONTROLTYPE ].Value = aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_CONTROLTYPE ]; + pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_URL ].Value <<= aURL; + pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_TITLE ].Value <<= aTitle; + pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_TARGET ].Value = aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_TARGET ]; + pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_IMAGEIDENTIFIER ].Value <<= aImageId; + pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_CONTEXT ].Value = aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_CONTEXT ]; + pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_CONTROLTYPE ].Value = aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_CONTROLTYPE ]; // Configuration uses hyper for long. Therefore transform into sal_Int32 sal_Int64 nValue( 0 ); aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_WIDTH ] >>= nValue; - aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_WIDTH ].Value <<= sal_Int32( nValue ); - aNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_STYLE ].Value = aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_STYLE ]; + pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_WIDTH ].Value <<= sal_Int32( nValue ); + pNotebookBarItem[ OFFSET_NOTEBOOKBARITEM_STYLE ].Value = aNotebookBarItemNodePropValues[ OFFSET_NOTEBOOKBARITEM_STYLE ]; bResult = true; } @@ -1504,14 +1523,15 @@ bool AddonsOptions_Impl::ReadNotebookBarItem( std::u16string_view aNotebookBarIt void AddonsOptions_Impl::ReadSubMenuEntries( const Sequence< OUString >& aSubMenuNodeNames, Sequence< Sequence< PropertyValue > >& rSubMenuSeq ) { Sequence< PropertyValue > aMenuItem( PROPERTYCOUNT_MENUITEM ); + auto pMenuItem = aMenuItem.getArray(); // Init the property value sequence - aMenuItem[ OFFSET_MENUITEM_URL ].Name = PROPERTYNAME_URL; - aMenuItem[ OFFSET_MENUITEM_TITLE ].Name = PROPERTYNAME_TITLE; - aMenuItem[ OFFSET_MENUITEM_TARGET ].Name = PROPERTYNAME_TARGET; - aMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Name = PROPERTYNAME_IMAGEIDENTIFIER; - aMenuItem[ OFFSET_MENUITEM_CONTEXT ].Name = PROPERTYNAME_CONTEXT; - aMenuItem[ OFFSET_MENUITEM_SUBMENU ].Name = PROPERTYNAME_SUBMENU; // Submenu set! + pMenuItem[ OFFSET_MENUITEM_URL ].Name = PROPERTYNAME_URL; + pMenuItem[ OFFSET_MENUITEM_TITLE ].Name = PROPERTYNAME_TITLE; + pMenuItem[ OFFSET_MENUITEM_TARGET ].Name = PROPERTYNAME_TARGET; + pMenuItem[ OFFSET_MENUITEM_IMAGEIDENTIFIER ].Name = PROPERTYNAME_IMAGEIDENTIFIER; + pMenuItem[ OFFSET_MENUITEM_CONTEXT ].Name = PROPERTYNAME_CONTEXT; + pMenuItem[ OFFSET_MENUITEM_SUBMENU ].Name = PROPERTYNAME_SUBMENU; // Submenu set! sal_uInt32 nIndex = 0; sal_uInt32 nCount = aSubMenuNodeNames.getLength(); @@ -1521,7 +1541,7 @@ void AddonsOptions_Impl::ReadSubMenuEntries( const Sequence< OUString >& aSubMen { sal_uInt32 nSubMenuCount = rSubMenuSeq.getLength() + 1; rSubMenuSeq.realloc( nSubMenuCount ); - rSubMenuSeq[nIndex++] = aMenuItem; + rSubMenuSeq.getArray()[nIndex++] = aMenuItem; } } } @@ -1662,14 +1682,15 @@ bool AddonsOptions_Impl::CreateImageFromSequence( BitmapEx& rImage, Sequence< sa Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesMenuItem( std::u16string_view aPropertyRootNode ) const { Sequence< OUString > lResult( PROPERTYCOUNT_MENUITEM ); + auto plResult = lResult.getArray(); // Create property names dependent from the root node name - lResult[OFFSET_MENUITEM_URL] = aPropertyRootNode + m_aPropNames[ INDEX_URL ]; - lResult[OFFSET_MENUITEM_TITLE] = aPropertyRootNode + m_aPropNames[ INDEX_TITLE ]; - lResult[OFFSET_MENUITEM_IMAGEIDENTIFIER] = aPropertyRootNode + m_aPropNames[ INDEX_IMAGEIDENTIFIER ]; - lResult[OFFSET_MENUITEM_TARGET] = aPropertyRootNode + m_aPropNames[ INDEX_TARGET ]; - lResult[OFFSET_MENUITEM_CONTEXT] = aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT ]; - lResult[OFFSET_MENUITEM_SUBMENU] = aPropertyRootNode + m_aPropNames[ INDEX_SUBMENU ]; + plResult[OFFSET_MENUITEM_URL] = aPropertyRootNode + m_aPropNames[ INDEX_URL ]; + plResult[OFFSET_MENUITEM_TITLE] = aPropertyRootNode + m_aPropNames[ INDEX_TITLE ]; + plResult[OFFSET_MENUITEM_IMAGEIDENTIFIER] = aPropertyRootNode + m_aPropNames[ INDEX_IMAGEIDENTIFIER ]; + plResult[OFFSET_MENUITEM_TARGET] = aPropertyRootNode + m_aPropNames[ INDEX_TARGET ]; + plResult[OFFSET_MENUITEM_CONTEXT] = aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT ]; + plResult[OFFSET_MENUITEM_SUBMENU] = aPropertyRootNode + m_aPropNames[ INDEX_SUBMENU ]; return lResult; } @@ -1678,11 +1699,12 @@ Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesPopupMenu( std::u16stri { // The URL is automatically set and not read from the configuration. Sequence< OUString > lResult( PROPERTYCOUNT_POPUPMENU-1 ); + auto plResult = lResult.getArray(); // Create property names dependent from the root node name - lResult[OFFSET_POPUPMENU_TITLE] = aPropertyRootNode + m_aPropNames[ INDEX_TITLE ]; - lResult[OFFSET_POPUPMENU_CONTEXT] = aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT ]; - lResult[OFFSET_POPUPMENU_SUBMENU] = aPropertyRootNode + m_aPropNames[ INDEX_SUBMENU ]; + plResult[OFFSET_POPUPMENU_TITLE] = aPropertyRootNode + m_aPropNames[ INDEX_TITLE ]; + plResult[OFFSET_POPUPMENU_CONTEXT] = aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT ]; + plResult[OFFSET_POPUPMENU_SUBMENU] = aPropertyRootNode + m_aPropNames[ INDEX_SUBMENU ]; return lResult; } @@ -1690,15 +1712,16 @@ Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesPopupMenu( std::u16stri Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesToolBarItem( std::u16string_view aPropertyRootNode ) const { Sequence< OUString > lResult( PROPERTYCOUNT_TOOLBARITEM ); + auto plResult = lResult.getArray(); // Create property names dependent from the root node name - lResult[0] = aPropertyRootNode + m_aPropNames[ INDEX_URL ]; - lResult[1] = aPropertyRootNode + m_aPropNames[ INDEX_TITLE ]; - lResult[2] = aPropertyRootNode + m_aPropNames[ INDEX_IMAGEIDENTIFIER]; - lResult[3] = aPropertyRootNode + m_aPropNames[ INDEX_TARGET ]; - lResult[4] = aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT ]; - lResult[5] = aPropertyRootNode + m_aPropNames[ INDEX_CONTROLTYPE ]; - lResult[6] = aPropertyRootNode + m_aPropNames[ INDEX_WIDTH ]; + plResult[0] = aPropertyRootNode + m_aPropNames[ INDEX_URL ]; + plResult[1] = aPropertyRootNode + m_aPropNames[ INDEX_TITLE ]; + plResult[2] = aPropertyRootNode + m_aPropNames[ INDEX_IMAGEIDENTIFIER]; + plResult[3] = aPropertyRootNode + m_aPropNames[ INDEX_TARGET ]; + plResult[4] = aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT ]; + plResult[5] = aPropertyRootNode + m_aPropNames[ INDEX_CONTROLTYPE ]; + plResult[6] = aPropertyRootNode + m_aPropNames[ INDEX_WIDTH ]; return lResult; } @@ -1706,16 +1729,17 @@ Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesToolBarItem( std::u16st Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesNotebookBarItem( std::u16string_view aPropertyRootNode ) const { Sequence< OUString > lResult( PROPERTYCOUNT_NOTEBOOKBARITEM ); + auto plResult = lResult.getArray(); // Create property names dependent from the root node name - lResult[0] = aPropertyRootNode + m_aPropNames[ INDEX_URL ]; - lResult[1] = aPropertyRootNode + m_aPropNames[ INDEX_TITLE ]; - lResult[2] = aPropertyRootNode + m_aPropNames[ INDEX_IMAGEIDENTIFIER]; - lResult[3] = aPropertyRootNode + m_aPropNames[ INDEX_TARGET ]; - lResult[4] = aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT ]; - lResult[5] = aPropertyRootNode + m_aPropNames[ INDEX_CONTROLTYPE ]; - lResult[6] = aPropertyRootNode + m_aPropNames[ INDEX_WIDTH ]; - lResult[7] = aPropertyRootNode + m_aPropNames[ INDEX_STYLE ]; + plResult[0] = aPropertyRootNode + m_aPropNames[ INDEX_URL ]; + plResult[1] = aPropertyRootNode + m_aPropNames[ INDEX_TITLE ]; + plResult[2] = aPropertyRootNode + m_aPropNames[ INDEX_IMAGEIDENTIFIER]; + plResult[3] = aPropertyRootNode + m_aPropNames[ INDEX_TARGET ]; + plResult[4] = aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT ]; + plResult[5] = aPropertyRootNode + m_aPropNames[ INDEX_CONTROLTYPE ]; + plResult[6] = aPropertyRootNode + m_aPropNames[ INDEX_WIDTH ]; + plResult[7] = aPropertyRootNode + m_aPropNames[ INDEX_STYLE ]; return lResult; } @@ -1724,15 +1748,16 @@ Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesStatusbarItem( std::u16string_view aPropertyRootNode ) const { Sequence< OUString > lResult( PROPERTYCOUNT_STATUSBARITEM ); + auto plResult = lResult.getArray(); - lResult[0] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_URL ] ); - lResult[1] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_TITLE ] ); - lResult[2] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT ] ); - lResult[3] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_ALIGN ] ); - lResult[4] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_AUTOSIZE ] ); - lResult[5] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_OWNERDRAW ] ); - lResult[6] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_MANDATORY ] ); - lResult[7] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_WIDTH ] ); + plResult[0] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_URL ] ); + plResult[1] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_TITLE ] ); + plResult[2] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_CONTEXT ] ); + plResult[3] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_ALIGN ] ); + plResult[4] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_AUTOSIZE ] ); + plResult[5] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_OWNERDRAW ] ); + plResult[6] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_MANDATORY ] ); + plResult[7] = OUString( aPropertyRootNode + m_aPropNames[ INDEX_WIDTH ] ); return lResult; } @@ -1740,16 +1765,17 @@ Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesStatusbarItem( Sequence< OUString > AddonsOptions_Impl::GetPropertyNamesImages( std::u16string_view aPropertyRootNode ) const { Sequence< OUString > lResult( PROPERTYCOUNT_IMAGES ); + auto plResult = lResult.getArray(); // Create property names dependent from the root node name - lResult[0] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_SMALL ]; - lResult[1] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_BIG ]; - lResult[2] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_SMALLHC ]; - lResult[3] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_BIGHC ]; - lResult[4] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_SMALL_URL ]; - lResult[5] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_BIG_URL ]; - lResult[6] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_SMALLHC_URL]; - lResult[7] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_BIGHC_URL ]; + plResult[0] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_SMALL ]; + plResult[1] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_BIG ]; + plResult[2] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_SMALLHC ]; + plResult[3] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_BIGHC ]; + plResult[4] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_SMALL_URL ]; + plResult[5] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_BIG_URL ]; + plResult[6] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_SMALLHC_URL]; + plResult[7] = aPropertyRootNode + m_aPropImagesNames[ OFFSET_IMAGES_BIGHC_URL ]; return lResult; } diff --git a/framework/source/fwe/classes/rootactiontriggercontainer.cxx b/framework/source/fwe/classes/rootactiontriggercontainer.cxx index f49cf9c70c5e..46e36d9bb94a 100644 --- a/framework/source/fwe/classes/rootactiontriggercontainer.cxx +++ b/framework/source/fwe/classes/rootactiontriggercontainer.cxx @@ -104,12 +104,9 @@ Reference< XInterface > SAL_CALL RootActionTriggerContainer::createInstanceWithA Sequence< OUString > SAL_CALL RootActionTriggerContainer::getAvailableServiceNames() { - Sequence< OUString > aSeq( 3 ); - - aSeq[0] = SERVICENAME_ACTIONTRIGGER; - aSeq[1] = SERVICENAME_ACTIONTRIGGERCONTAINER; - aSeq[2] = SERVICENAME_ACTIONTRIGGERSEPARATOR; - + Sequence< OUString > aSeq{ SERVICENAME_ACTIONTRIGGER, + SERVICENAME_ACTIONTRIGGERCONTAINER, + SERVICENAME_ACTIONTRIGGERSEPARATOR }; return aSeq; } diff --git a/framework/source/fwe/helper/undomanagerhelper.cxx b/framework/source/fwe/helper/undomanagerhelper.cxx index ef6a9da4a5b4..87cba0c6de09 100644 --- a/framework/source/fwe/helper/undomanagerhelper.cxx +++ b/framework/source/fwe/helper/undomanagerhelper.cxx @@ -958,9 +958,10 @@ namespace framework : rUndoManager.GetRedoActionCount( SfxUndoManager::TopLevel ); Sequence< OUString > aTitles( nCount ); + auto aTitlesRange = asNonConstRange(aTitles); for ( size_t i=0; i<nCount; ++i ) { - aTitles[i] = i_undo + aTitlesRange[i] = i_undo ? rUndoManager.GetUndoActionComment( i, SfxUndoManager::TopLevel ) : rUndoManager.GetRedoActionComment( i, SfxUndoManager::TopLevel ); } diff --git a/framework/source/fwe/xml/menudocumenthandler.cxx b/framework/source/fwe/xml/menudocumenthandler.cxx index c2c44447f3cc..f265f9260828 100644 --- a/framework/source/fwe/xml/menudocumenthandler.cxx +++ b/framework/source/fwe/xml/menudocumenthandler.cxx @@ -31,6 +31,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/attributelist.hxx> #ifdef ATTRIBUTE_HELPID @@ -191,20 +192,22 @@ void ReadMenuDocumentHandlerBase::initPropertyCommon( Sequence< PropertyValue > &rProps, const OUString &rCommandURL, const OUString &rHelpId, const OUString &rLabel, sal_Int16 nItemStyleBits ) { - rProps[0].Name = m_aCommandURL; - rProps[1].Name = m_aHelpURL; - rProps[2].Name = m_aContainer; - rProps[3].Name = m_aLabel; - rProps[4].Name = m_aStyle; - rProps[5].Name = m_aType; + auto pProps = rProps.getArray(); + + pProps[0].Name = m_aCommandURL; + pProps[1].Name = m_aHelpURL; + pProps[2].Name = m_aContainer; + pProps[3].Name = m_aLabel; + pProps[4].Name = m_aStyle; + pProps[5].Name = m_aType; // Common values - rProps[0].Value <<= rCommandURL.intern(); - rProps[1].Value <<= rHelpId; - rProps[2].Value <<= Reference< XIndexContainer >(); - rProps[3].Value <<= rLabel; - rProps[4].Value <<= nItemStyleBits; - rProps[5].Value <<= css::ui::ItemType::DEFAULT; + pProps[0].Value <<= rCommandURL.intern(); + pProps[1].Value <<= rHelpId; + pProps[2].Value <<= Reference< XIndexContainer >(); + pProps[3].Value <<= rLabel; + pProps[4].Value <<= nItemStyleBits; + pProps[5].Value <<= css::ui::ItemType::DEFAULT; } OReadMenuDocumentHandler::OReadMenuDocumentHandler( @@ -376,7 +379,7 @@ void SAL_CALL OReadMenuBarHandler::startElement( { Sequence< PropertyValue > aSubMenuProp( 6 ); initPropertyCommon( aSubMenuProp, aCommandId, aHelpId, aLabel, nItemBits ); - aSubMenuProp[2].Value <<= xSubItemContainer; + aSubMenuProp.getArray()[2].Value <<= xSubItemContainer; m_xMenuBarContainer->insertByIndex( m_xMenuBarContainer->getCount(), makeAny( aSubMenuProp ) ); } @@ -577,7 +580,7 @@ void SAL_CALL OReadMenuPopupHandler::startElement( { Sequence< PropertyValue > aSubMenuProp( 6 ); initPropertyCommon( aSubMenuProp, aCommandId, aHelpId, aLabel, nItemBits ); - aSubMenuProp[2].Value <<= xSubItemContainer; + aSubMenuProp.getArray()[2].Value <<= xSubItemContainer; m_xMenuContainer->insertByIndex( m_xMenuContainer->getCount(), makeAny( aSubMenuProp ) ); } @@ -633,7 +636,7 @@ void SAL_CALL OReadMenuPopupHandler::startElement( { Sequence< PropertyValue > aMenuItem( 6 ); initPropertyCommon( aMenuItem, aCommandId, aHelpId, aLabel, nItemBits ); - aMenuItem[2].Value <<= Reference< XIndexContainer >(); + aMenuItem.getArray()[2].Value <<= Reference< XIndexContainer >(); m_xMenuContainer->insertByIndex( m_xMenuContainer->getCount(), makeAny( aMenuItem ) ); } @@ -642,9 +645,8 @@ void SAL_CALL OReadMenuPopupHandler::startElement( } else if ( rName == ELEMENT_MENUSEPARATOR ) { - Sequence< PropertyValue > aMenuSeparator( 1 ); - aMenuSeparator[0].Name = ITEM_DESCRIPTOR_TYPE; - aMenuSeparator[0].Value <<= css::ui::ItemType::SEPARATOR_LINE; + Sequence< PropertyValue > aMenuSeparator{ comphelper::makePropertyValue( + ITEM_DESCRIPTOR_TYPE, css::ui::ItemType::SEPARATOR_LINE) }; m_xMenuContainer->insertByIndex( m_xMenuContainer->getCount(), makeAny( aMenuSeparator ) ); diff --git a/framework/source/fwe/xml/statusbardocumenthandler.cxx b/framework/source/fwe/xml/statusbardocumenthandler.cxx index 16f10f157660..e04299d764d1 100644 --- a/framework/source/fwe/xml/statusbardocumenthandler.cxx +++ b/framework/source/fwe/xml/statusbardocumenthandler.cxx @@ -31,6 +31,7 @@ #include <vcl/status.hxx> #include <comphelper/attributelist.hxx> +#include <comphelper/propertyvalue.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -374,20 +375,14 @@ void SAL_CALL OReadStatusBarDocumentHandler::startElement( } else { - Sequence< PropertyValue > aStatusbarItemProp( 6 ); - aStatusbarItemProp[0].Name = ITEM_DESCRIPTOR_COMMANDURL; - aStatusbarItemProp[1].Name = ITEM_DESCRIPTOR_HELPURL; - aStatusbarItemProp[2].Name = ITEM_DESCRIPTOR_OFFSET; - aStatusbarItemProp[3].Name = ITEM_DESCRIPTOR_STYLE; - aStatusbarItemProp[4].Name = ITEM_DESCRIPTOR_WIDTH; - aStatusbarItemProp[5].Name = ITEM_DESCRIPTOR_TYPE; - - aStatusbarItemProp[0].Value <<= aCommandURL; - aStatusbarItemProp[1].Value <<= aHelpURL; - aStatusbarItemProp[2].Value <<= nOffset; - aStatusbarItemProp[3].Value <<= nItemBits; - aStatusbarItemProp[4].Value <<= nWidth; - aStatusbarItemProp[5].Value <<= css::ui::ItemType::DEFAULT; + Sequence< PropertyValue > aStatusbarItemProp{ + comphelper::makePropertyValue(ITEM_DESCRIPTOR_COMMANDURL, aCommandURL), + comphelper::makePropertyValue(ITEM_DESCRIPTOR_HELPURL, aHelpURL), + comphelper::makePropertyValue(ITEM_DESCRIPTOR_OFFSET, nOffset), + comphelper::makePropertyValue(ITEM_DESCRIPTOR_STYLE, nItemBits), + comphelper::makePropertyValue(ITEM_DESCRIPTOR_WIDTH, nWidth), + comphelper::makePropertyValue(ITEM_DESCRIPTOR_TYPE, css::ui::ItemType::DEFAULT) + }; m_aStatusBarItems->insertByIndex( m_aStatusBarItems->getCount(), makeAny( aStatusbarItemProp ) ); } diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx index c5dc0f429483..4fd152a6f03e 100644 --- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx +++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx @@ -36,6 +36,7 @@ #include <comphelper/attributelist.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertyvalue.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -400,12 +401,10 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement( m_bToolBarSpaceStartFound = true; - Sequence< PropertyValue > aToolbarItemProp( 2 ); - aToolbarItemProp[0].Name = m_aCommandURL; - aToolbarItemProp[1].Name = m_aType; - - aToolbarItemProp[0].Value <<= OUString(); - aToolbarItemProp[1].Value <<= css::ui::ItemType::SEPARATOR_SPACE; + Sequence< PropertyValue > aToolbarItemProp{ + comphelper::makePropertyValue(m_aCommandURL, OUString()), + comphelper::makePropertyValue(m_aType, css::ui::ItemType::SEPARATOR_SPACE) + }; m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), makeAny( aToolbarItemProp ) ); } @@ -424,12 +423,10 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement( m_bToolBarBreakStartFound = true; - Sequence< PropertyValue > aToolbarItemProp( 2 ); - aToolbarItemProp[0].Name = m_aCommandURL; - aToolbarItemProp[1].Name = m_aType; - - aToolbarItemProp[0].Value <<= OUString(); - aToolbarItemProp[1].Value <<= css::ui::ItemType::SEPARATOR_LINEBREAK; + Sequence< PropertyValue > aToolbarItemProp{ + comphelper::makePropertyValue(m_aCommandURL, OUString()), + comphelper::makePropertyValue(m_aType, css::ui::ItemType::SEPARATOR_LINEBREAK) + }; m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), makeAny( aToolbarItemProp ) ); } @@ -448,12 +445,10 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement( m_bToolBarSeparatorStartFound = true; - Sequence< PropertyValue > aToolbarItemProp( 2 ); - aToolbarItemProp[0].Name = m_aCommandURL; - aToolbarItemProp[1].Name = m_aType; - - aToolbarItemProp[0].Value <<= OUString(); - aToolbarItemProp[1].Value <<= css::ui::ItemType::SEPARATOR_LINE; + Sequence< PropertyValue > aToolbarItemProp{ + comphelper::makePropertyValue(m_aCommandURL, OUString()), + comphelper::makePropertyValue(m_aType, css::ui::ItemType::SEPARATOR_LINE) + }; m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), makeAny( aToolbarItemProp ) ); } diff --git a/framework/source/fwi/classes/converter.cxx b/framework/source/fwi/classes/converter.cxx index 33af820202c9..a29c5b1271c9 100644 --- a/framework/source/fwi/classes/converter.cxx +++ b/framework/source/fwi/classes/converter.cxx @@ -29,10 +29,11 @@ css::uno::Sequence< css::beans::NamedValue > Converter::convert_seqPropVal2seqNa { sal_Int32 nCount = lSource.getLength(); css::uno::Sequence< css::beans::NamedValue > lDestination(nCount); + auto lDestinationRange = asNonConstRange(lDestination); for (sal_Int32 nItem=0; nItem<nCount; ++nItem) { - lDestination[nItem].Name = lSource[nItem].Name; - lDestination[nItem].Value = lSource[nItem].Value; + lDestinationRange[nItem].Name = lSource[nItem].Name; + lDestinationRange[nItem].Value = lSource[nItem].Value; } return lDestination; } diff --git a/framework/source/fwi/classes/protocolhandlercache.cxx b/framework/source/fwi/classes/protocolhandlercache.cxx index 41aa74a02f17..7619d4323a24 100644 --- a/framework/source/fwi/classes/protocolhandlercache.cxx +++ b/framework/source/fwi/classes/protocolhandlercache.cxx @@ -193,13 +193,13 @@ void HandlerCFGAccess::read( HandlerHash& rHandlerHash, PatternHash& rPatternHas sal_Int32 nTargetCount = nSourceCount; // list of all full qualified path names of configuration entries css::uno::Sequence< OUString > lFullNames ( nTargetCount ); - + auto lFullNamesRange = asNonConstRange(lFullNames); // expand names to full path names sal_Int32 nSource=0; sal_Int32 nTarget=0; for( nSource=0; nSource<nSourceCount; ++nSource ) { - lFullNames[nTarget] = + lFullNamesRange[nTarget] = SETNAME_HANDLER + CFG_PATH_SEPARATOR + lNames[nSource] + diff --git a/framework/source/fwi/jobs/configaccess.cxx b/framework/source/fwi/jobs/configaccess.cxx index bcb739c09cdb..d3ce0e5f70a1 100644 --- a/framework/source/fwi/jobs/configaccess.cxx +++ b/framework/source/fwi/jobs/configaccess.cxx @@ -107,8 +107,7 @@ void ConfigAccess::open( /*IN*/ EOpenMode eMode ) aParam.Name = "nodepath"; aParam.Value <<= m_sRoot; - css::uno::Sequence< css::uno::Any > lParams(1); - lParams[0] <<= aParam; + css::uno::Sequence< css::uno::Any > lParams{ css::uno::Any(aParam) }; // open it try diff --git a/framework/source/fwi/uielement/constitemcontainer.cxx b/framework/source/fwi/uielement/constitemcontainer.cxx index ef76a51e5cc0..9dee39a6e76d 100644 --- a/framework/source/fwi/uielement/constitemcontainer.cxx +++ b/framework/source/fwi/uielement/constitemcontainer.cxx @@ -100,7 +100,7 @@ ConstItemContainer::ConstItemContainer( const Reference< XIndexAccess >& rSource } if ( xIndexAccess.is() && nContainerIndex >= 0 ) - aPropSeq[nContainerIndex].Value <<= deepCopyContainer( xIndexAccess ); + aPropSeq.getArray()[nContainerIndex].Value <<= deepCopyContainer( xIndexAccess ); m_aItemVector.push_back( aPropSeq ); } @@ -136,7 +136,7 @@ void ConstItemContainer::copyItemContainer( const std::vector< Sequence< Propert } if ( xIndexAccess.is() && nContainerIndex >= 0 ) - aPropSeq[nContainerIndex].Value <<= deepCopyContainer( xIndexAccess ); + aPropSeq.getArray()[nContainerIndex].Value <<= deepCopyContainer( xIndexAccess ); m_aItemVector.push_back( aPropSeq ); } diff --git a/framework/source/fwi/uielement/itemcontainer.cxx b/framework/source/fwi/uielement/itemcontainer.cxx index 1f690452aee2..8cee8440ee41 100644 --- a/framework/source/fwi/uielement/itemcontainer.cxx +++ b/framework/source/fwi/uielement/itemcontainer.cxx @@ -76,7 +76,7 @@ ItemContainer::ItemContainer( const Reference< XIndexAccess >& rSourceContainer, } if ( xIndexAccess.is() && nContainerIndex >= 0 ) - aPropSeq[nContainerIndex].Value <<= deepCopyContainer( xIndexAccess, rMutex ); + aPropSeq.getArray()[nContainerIndex].Value <<= deepCopyContainer( xIndexAccess, rMutex ); m_aItemVector.push_back( aPropSeq ); } @@ -111,7 +111,7 @@ void ItemContainer::copyItemContainer( const std::vector< Sequence< PropertyValu } if ( xIndexAccess.is() && nContainerIndex >= 0 ) - aPropSeq[nContainerIndex].Value <<= deepCopyContainer( xIndexAccess, rMutex ); + aPropSeq.getArray()[nContainerIndex].Value <<= deepCopyContainer( xIndexAccess, rMutex ); m_aItemVector.push_back( aPropSeq ); } diff --git a/framework/source/fwi/uielement/rootitemcontainer.cxx b/framework/source/fwi/uielement/rootitemcontainer.cxx index 480c5b23d7b9..a91742cb598e 100644 --- a/framework/source/fwi/uielement/rootitemcontainer.cxx +++ b/framework/source/fwi/uielement/rootitemcontainer.cxx @@ -90,7 +90,7 @@ RootItemContainer::RootItemContainer( const Reference< XIndexAccess >& rSourceCo } if ( xIndexAccess.is() && nContainerIndex >= 0 ) - aPropSeq[nContainerIndex].Value <<= deepCopyContainer( xIndexAccess ); + aPropSeq.getArray()[nContainerIndex].Value <<= deepCopyContainer( xIndexAccess ); m_aItemVector.push_back( aPropSeq ); } diff --git a/framework/source/helper/oframes.cxx b/framework/source/helper/oframes.cxx index 048d5ad79b54..a58949852d43 100644 --- a/framework/source/helper/oframes.cxx +++ b/framework/source/helper/oframes.cxx @@ -143,18 +143,14 @@ Sequence< css::uno::Reference< XFrame > > SAL_CALL OFrames::queryFrames( sal_Int css::uno::Reference< XFrame > xParent = xOwner->getCreator(); if( xParent.is() ) { - Sequence< css::uno::Reference< XFrame > > seqParent( 1 ); - seqParent[0] = xParent; - impl_appendSequence( seqFrames, seqParent ); + impl_appendSequence( seqFrames, { xParent } ); } } // Add owner to list if SELF is searched. if( nSearchFlags & FrameSearchFlag::SELF ) { - Sequence< css::uno::Reference< XFrame > > seqSelf( 1 ); - seqSelf[0] = xOwner; - impl_appendSequence( seqFrames, seqSelf ); + impl_appendSequence( seqFrames, { xOwner } ); } // Add SIBLINGS to list. diff --git a/framework/source/jobs/job.cxx b/framework/source/jobs/job.cxx index 81203f3afcfc..39b867ac3291 100644 --- a/framework/source/jobs/job.cxx +++ b/framework/source/jobs/job.cxx @@ -336,30 +336,36 @@ css::uno::Sequence< css::beans::NamedValue > Job::impl_generateJobArgs( /*IN*/ c // Create list of environment variables. This list must be part of the // returned structure every time... but some of its members are optional! - css::uno::Sequence< css::beans::NamedValue > lEnvArgs(1); - lEnvArgs[0].Name = "EnvType"; - lEnvArgs[0].Value <<= m_aJobCfg.getEnvironmentDescriptor(); + sal_Int32 nLen = 1; + if (m_xFrame.is()) + ++nLen; + if (m_xModel.is()) + ++nLen; + if (eMode==JobData::E_EVENT) + ++nLen; + css::uno::Sequence< css::beans::NamedValue > lEnvArgs(nLen); + auto plEnvArgs = lEnvArgs.getArray(); + plEnvArgs[0].Name = "EnvType"; + plEnvArgs[0].Value <<= m_aJobCfg.getEnvironmentDescriptor(); + sal_Int32 i = 0; if (m_xFrame.is()) { - sal_Int32 c = lEnvArgs.getLength(); - lEnvArgs.realloc(c+1); - lEnvArgs[c].Name = "Frame"; - lEnvArgs[c].Value <<= m_xFrame; + ++i; + plEnvArgs[i].Name = "Frame"; + plEnvArgs[i].Value <<= m_xFrame; } if (m_xModel.is()) { - sal_Int32 c = lEnvArgs.getLength(); - lEnvArgs.realloc(c+1); - lEnvArgs[c].Name = "Model"; - lEnvArgs[c].Value <<= m_xModel; + ++i; + plEnvArgs[i].Name = "Model"; + plEnvArgs[i].Value <<= m_xModel; } if (eMode==JobData::E_EVENT) { - sal_Int32 c = lEnvArgs.getLength(); - lEnvArgs.realloc(c+1); - lEnvArgs[c].Name = "EventName"; - lEnvArgs[c].Value <<= m_aJobCfg.getEvent(); + ++i; + plEnvArgs[i].Name = "EventName"; + plEnvArgs[i].Value <<= m_aJobCfg.getEvent(); } // get the configuration data from the job data container ... if possible @@ -381,29 +387,33 @@ css::uno::Sequence< css::beans::NamedValue > Job::impl_generateJobArgs( /*IN*/ c { sal_Int32 nLength = lAllArgs.getLength(); lAllArgs.realloc(nLength+1); - lAllArgs[nLength].Name = "Config"; - lAllArgs[nLength].Value <<= lConfigArgs; + auto plAllArgs = lAllArgs.getArray(); + plAllArgs[nLength].Name = "Config"; + plAllArgs[nLength].Value <<= lConfigArgs; } if (!lJobConfigArgs.empty()) { sal_Int32 nLength = lAllArgs.getLength(); lAllArgs.realloc(nLength+1); - lAllArgs[nLength].Name = "JobConfig"; - lAllArgs[nLength].Value <<= comphelper::containerToSequence(lJobConfigArgs); + auto plAllArgs = lAllArgs.getArray(); + plAllArgs[nLength].Name = "JobConfig"; + plAllArgs[nLength].Value <<= comphelper::containerToSequence(lJobConfigArgs); } if (lEnvArgs.hasElements()) { sal_Int32 nLength = lAllArgs.getLength(); lAllArgs.realloc(nLength+1); - lAllArgs[nLength].Name = "Environment"; - lAllArgs[nLength].Value <<= lEnvArgs; + auto plAllArgs = lAllArgs.getArray(); + plAllArgs[nLength].Name = "Environment"; + plAllArgs[nLength].Value <<= lEnvArgs; } if (lDynamicArgs.hasElements()) { sal_Int32 nLength = lAllArgs.getLength(); lAllArgs.realloc(nLength+1); - lAllArgs[nLength].Name = "DynamicData"; - lAllArgs[nLength].Value <<= lDynamicArgs; + auto plAllArgs = lAllArgs.getArray(); + plAllArgs[nLength].Name = "DynamicData"; + plAllArgs[nLength].Value <<= lDynamicArgs; } return lAllArgs; diff --git a/framework/source/jobs/jobdata.cxx b/framework/source/jobs/jobdata.cxx index a516abdadd7c..974f2630fe84 100644 --- a/framework/source/jobs/jobdata.cxx +++ b/framework/source/jobs/jobdata.cxx @@ -252,12 +252,14 @@ void JobData::setJobConfig( std::vector< css::beans::NamedValue >&& lArguments ) { sal_Int32 nCount = m_lArguments.size(); css::uno::Sequence< OUString > lNames (nCount); + auto lNamesRange = asNonConstRange(lNames); css::uno::Sequence< css::uno::Any > lValues(nCount); + auto lValuesRange = asNonConstRange(lValues); for (sal_Int32 i=0; i<nCount; ++i) { - lNames [i] = m_lArguments[i].Name; - lValues[i] = m_lArguments[i].Value; + lNamesRange [i] = m_lArguments[i].Name; + lValuesRange[i] = m_lArguments[i].Value; } xArgumentList->setHierarchicalPropertyValues(lNames, lValues); @@ -341,20 +343,9 @@ css::uno::Sequence< css::beans::NamedValue > JobData::getConfig() const css::uno::Sequence< css::beans::NamedValue > lConfig; if (m_eMode==E_ALIAS) { - lConfig.realloc(3); - sal_Int32 i = 0; - - lConfig[i].Name = "Alias"; - lConfig[i].Value <<= m_sAlias; - ++i; - - lConfig[i].Name = "Service"; - lConfig[i].Value <<= m_sService; - ++i; - - lConfig[i].Name = "Context"; - lConfig[i].Value <<= m_sContext; - ++i; + lConfig = { { "Alias", css::uno::Any(m_sAlias) }, + { "Service", css::uno::Any(m_sService) }, + { "Context", css::uno::Any(m_sContext) } }; } return lConfig; } diff --git a/framework/source/jobs/jobdispatch.cxx b/framework/source/jobs/jobdispatch.cxx index c07727d017e7..e32f65123375 100644 --- a/framework/source/jobs/jobdispatch.cxx +++ b/framework/source/jobs/jobdispatch.cxx @@ -226,9 +226,9 @@ css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL JobD // don't pack resulting list! sal_Int32 nCount = lDescriptor.getLength(); css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > lDispatches(nCount); - + auto lDispatchesRange = asNonConstRange(lDispatches); for (sal_Int32 i=0; i<nCount; ++i) - lDispatches[i] = queryDispatch( lDescriptor[i].FeatureURL , + lDispatchesRange[i] = queryDispatch( lDescriptor[i].FeatureURL , lDescriptor[i].FrameName , lDescriptor[i].SearchFlags ); return lDispatches; diff --git a/framework/source/layoutmanager/helpers.cxx b/framework/source/layoutmanager/helpers.cxx index f9b319f4e19e..494281f16e5e 100644 --- a/framework/source/layoutmanager/helpers.cxx +++ b/framework/source/layoutmanager/helpers.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/ui/XUIElement.hpp> #include <comphelper/lok.hxx> +#include <comphelper/propertyvalue.hxx> #include <unotools/mediadescriptor.hxx> #include <vcl/svapp.hxx> #include <toolkit/helper/vclunohelper.hxx> @@ -297,9 +298,8 @@ void impl_setDockingWindowVisibility( const css::uno::Reference< css::uno::XComp OUString aDockWinArgName = "DockingWindow" + OUString::number( nIndex ); - css::uno::Sequence< css::beans::PropertyValue > aArgs(1); - aArgs[0].Name = aDockWinArgName; - aArgs[0].Value <<= bVisible; + css::uno::Sequence< css::beans::PropertyValue > aArgs{ comphelper::makePropertyValue( + aDockWinArgName, bVisible) }; css::uno::Reference< css::frame::XDispatchHelper > xDispatcher = css::frame::DispatchHelper::create( rxContext ); diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index bed044cc5523..e02f57e4345e 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -51,6 +51,7 @@ #include <com/sun/star/util/URLTransformer.hpp> #include <comphelper/lok.hxx> +#include <comphelper/propertyvalue.hxx> #include <vcl/status.hxx> #include <vcl/settings.hxx> #include <vcl/window.hxx> @@ -672,28 +673,21 @@ void LayoutManager::implts_writeWindowStateData( const OUString& aName, const UI try { - Sequence< PropertyValue > aWindowState( 8 ); - - aWindowState[0].Name = WINDOWSTATE_PROPERTY_DOCKED; - aWindowState[0].Value <<= !rElementData.m_bFloating; - aWindowState[1].Name = WINDOWSTATE_PROPERTY_VISIBLE; - aWindowState[1].Value <<= rElementData.m_bVisible; - - aWindowState[2].Name = WINDOWSTATE_PROPERTY_DOCKINGAREA; - aWindowState[2].Value <<= rElementData.m_aDockedData.m_nDockedArea; - - aWindowState[3].Name = WINDOWSTATE_PROPERTY_DOCKPOS; - aWindowState[3].Value <<= rElementData.m_aDockedData.m_aPos; - - aWindowState[4].Name = WINDOWSTATE_PROPERTY_POS; - aWindowState[4].Value <<= rElementData.m_aFloatingData.m_aPos; - - aWindowState[5].Name = WINDOWSTATE_PROPERTY_SIZE; - aWindowState[5].Value <<= rElementData.m_aFloatingData.m_aSize; - aWindowState[6].Name = WINDOWSTATE_PROPERTY_UINAME; - aWindowState[6].Value <<= rElementData.m_aUIName; - aWindowState[7].Name = WINDOWSTATE_PROPERTY_LOCKED; - aWindowState[7].Value <<= rElementData.m_aDockedData.m_bLocked; + Sequence< PropertyValue > aWindowState{ + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_DOCKED, !rElementData.m_bFloating), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_VISIBLE, rElementData.m_bVisible), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_DOCKINGAREA, + rElementData.m_aDockedData.m_nDockedArea), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_DOCKPOS, + rElementData.m_aDockedData.m_aPos), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_POS, + rElementData.m_aFloatingData.m_aPos), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_SIZE, + rElementData.m_aFloatingData.m_aSize), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_UINAME, rElementData.m_aUIName), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_LOCKED, + rElementData.m_aDockedData.m_bLocked) + }; if ( xPersistentWindowState->hasByName( aName )) { @@ -730,11 +724,8 @@ Reference< XUIElement > LayoutManager::implts_createElement( const OUString& aNa Reference< ui::XUIElement > xUIElement; SolarMutexGuard g; - Sequence< PropertyValue > aPropSeq( 2 ); - aPropSeq[0].Name = "Frame"; - aPropSeq[0].Value <<= m_xFrame; - aPropSeq[1].Name = "Persistent"; - aPropSeq[1].Value <<= true; + Sequence< PropertyValue > aPropSeq{ comphelper::makePropertyValue("Frame", m_xFrame), + comphelper::makePropertyValue("Persistent", true) }; try { @@ -1681,10 +1672,11 @@ Sequence< Reference< ui::XUIElement > > SAL_CALL LayoutManager::getElements() } aSeq.realloc(nSize); + auto pSeq = aSeq.getArray(); if ( nMenuBarIndex >= 0 ) - aSeq[nMenuBarIndex] = xMenuBar; + pSeq[nMenuBarIndex] = xMenuBar; if ( nStatusBarIndex >= 0 ) - aSeq[nStatusBarIndex] = xStatusBar; + pSeq[nStatusBarIndex] = xStatusBar; return aSeq; } diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index 97e8e75e5b29..c190b1a40f23 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/ui/XUIElementSettings.hpp> #include <com/sun/star/ui/XUIFunctionListener.hpp> +#include <comphelper/propertyvalue.hxx> #include <cppuhelper/queryinterface.hxx> #include <o3tl/string_view.hxx> #include <unotools/cmdoptions.hxx> @@ -450,11 +451,10 @@ bool ToolbarLayoutManager::createToolbar( const OUString& rResourceURL ) { uno::Reference< ui::XUIElement > xUIElement; - uno::Sequence< beans::PropertyValue > aPropSeq( 2 ); - aPropSeq[0].Name = "Frame"; - aPropSeq[0].Value <<= xFrame; - aPropSeq[1].Name = "Persistent"; - aPropSeq[1].Value <<= true; + uno::Sequence< beans::PropertyValue > aPropSeq{ + comphelper::makePropertyValue("Frame", xFrame), + comphelper::makePropertyValue("Persistent", true) + }; uno::Reference<ui::XUIElementFactory> xUIElementFactory; { SolarMutexGuard aReadLock; @@ -1080,15 +1080,16 @@ void ToolbarLayoutManager::implts_createAddonsToolBars() sal_uInt32 nCount = m_pAddonOptions->GetAddonsToolBarCount(); uno::Sequence< beans::PropertyValue > aPropSeq( 2 ); - aPropSeq[0].Name = "Frame"; - aPropSeq[0].Value <<= xFrame; - aPropSeq[1].Name = "ConfigurationData"; + auto pPropSeq = aPropSeq.getArray(); + pPropSeq[0].Name = "Frame"; + pPropSeq[0].Value <<= xFrame; + pPropSeq[1].Name = "ConfigurationData"; for ( sal_uInt32 i = 0; i < nCount; i++ ) { OUString aAddonToolBarName( "private:resource/toolbar/addon_" + m_pAddonOptions->GetAddonsToolbarResourceName(i) ); aAddonToolBarData = m_pAddonOptions->GetAddonsToolBarPart( i ); - aPropSeq[1].Value <<= aAddonToolBarData; + pPropSeq[1].Value <<= aAddonToolBarData; UIElement aElement = implts_findToolbar( aAddonToolBarName ); @@ -1563,31 +1564,23 @@ void ToolbarLayoutManager::implts_writeWindowStateData( const UIElement& rElemen try { - uno::Sequence< beans::PropertyValue > aWindowState( 9 ); - - aWindowState[0].Name = WINDOWSTATE_PROPERTY_DOCKED; - aWindowState[0].Value <<= !rElementData.m_bFloating; - aWindowState[1].Name = WINDOWSTATE_PROPERTY_VISIBLE; - aWindowState[1].Value <<= rElementData.m_bVisible; - aWindowState[2].Name = WINDOWSTATE_PROPERTY_DOCKINGAREA; - aWindowState[2].Value <<= rElementData.m_aDockedData.m_nDockedArea; - - awt::Point aPos = rElementData.m_aDockedData.m_aPos; - aWindowState[3].Name = WINDOWSTATE_PROPERTY_DOCKPOS; - aWindowState[3].Value <<= aPos; - - aPos = rElementData.m_aFloatingData.m_aPos; - aWindowState[4].Name = WINDOWSTATE_PROPERTY_POS; - aWindowState[4].Value <<= aPos; - - aWindowState[5].Name = WINDOWSTATE_PROPERTY_SIZE; - aWindowState[5].Value <<= rElementData.m_aFloatingData.m_aSize; - aWindowState[6].Name = WINDOWSTATE_PROPERTY_UINAME; - aWindowState[6].Value <<= rElementData.m_aUIName; - aWindowState[7].Name = WINDOWSTATE_PROPERTY_LOCKED; - aWindowState[7].Value <<= rElementData.m_aDockedData.m_bLocked; - aWindowState[8].Name = WINDOWSTATE_PROPERTY_STYLE; - aWindowState[8].Value <<= static_cast<sal_uInt16>(rElementData.m_nStyle); + uno::Sequence<beans::PropertyValue> aWindowState{ + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_DOCKED, !rElementData.m_bFloating), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_VISIBLE, rElementData.m_bVisible), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_DOCKINGAREA, + rElementData.m_aDockedData.m_nDockedArea), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_DOCKPOS, + rElementData.m_aDockedData.m_aPos), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_POS, + rElementData.m_aFloatingData.m_aPos), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_SIZE, + rElementData.m_aFloatingData.m_aSize), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_UINAME, rElementData.m_aUIName), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_LOCKED, + rElementData.m_aDockedData.m_bLocked), + comphelper::makePropertyValue(WINDOWSTATE_PROPERTY_STYLE, + static_cast<sal_uInt16>(rElementData.m_nStyle)) + }; OUString aName = rElementData.m_aName; if ( xPersistentWindowState->hasByName( aName )) @@ -3930,7 +3923,7 @@ uno::Sequence< uno::Reference< ui::XUIElement > > ToolbarLayoutManager::getToolb { ++nCount; aSeq.realloc( nCount ); - aSeq[nCount-1] = elem.m_xUIElement; + aSeq.getArray()[nCount-1] = elem.m_xUIElement; } } } diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 25639461f0ad..f51c2591070f 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -954,13 +954,13 @@ bool LoadEnv::impl_furtherDocsAllowed() if (xInteraction.is()) { css::uno::Any aInteraction; - css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > lContinuations(2); rtl::Reference<comphelper::OInteractionAbort> pAbort = new comphelper::OInteractionAbort(); rtl::Reference<comphelper::OInteractionApprove> pApprove = new comphelper::OInteractionApprove(); - lContinuations[0] = pAbort; - lContinuations[1] = pApprove; + css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > lContinuations{ + pAbort, pApprove + }; css::task::ErrorCodeRequest aErrorCode; aErrorCode.ErrCode = sal_uInt32(ERRCODE_SFX_NOMOREDOCUMENTSALLOWED); diff --git a/framework/source/services/dispatchhelper.cxx b/framework/source/services/dispatchhelper.cxx index e5defdff6210..9c1e23f00041 100644 --- a/framework/source/services/dispatchhelper.cxx +++ b/framework/source/services/dispatchhelper.cxx @@ -139,8 +139,9 @@ DispatchHelper::executeDispatch(const css::uno::Reference<css::frame::XDispatch> css::uno::Sequence<css::beans::PropertyValue> aArguments(lArguments); sal_Int32 nLength = lArguments.getLength(); aArguments.realloc(nLength + 1); - aArguments[nLength].Name = "SynchronMode"; - aArguments[nLength].Value <<= SyncronFlag; + auto pArguments = aArguments.getArray(); + pArguments[nLength].Name = "SynchronMode"; + pArguments[nLength].Value <<= SyncronFlag; if (xNotifyDispatch.is()) { diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index ac9ee29c6cdf..9f45e891ff13 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -1987,10 +1987,10 @@ css::uno::Sequence< css::beans::Property > SAL_CALL XFrameImpl::getProperties() sal_Int32 c = static_cast<sal_Int32>(m_lProps.size()); css::uno::Sequence< css::beans::Property > lProps(c); - + auto lPropsRange = asNonConstRange(lProps); for (auto const& elem : m_lProps) { - lProps[--c] = elem.second; + lPropsRange[--c] = elem.second; } return lProps; diff --git a/framework/source/services/mediatypedetectionhelper.cxx b/framework/source/services/mediatypedetectionhelper.cxx index 440a3d59a022..894f95740ad9 100644 --- a/framework/source/services/mediatypedetectionhelper.cxx +++ b/framework/source/services/mediatypedetectionhelper.cxx @@ -62,10 +62,11 @@ css::uno::Sequence< OUString > SAL_CALL MediaTypeDetectionHelper::getSupportedSe sal_Bool SAL_CALL MediaTypeDetectionHelper::mapStrings(uno::Sequence< OUString >& rSeq) { bool bModified = false; + auto rSeqRange = asNonConstRange(rSeq); for( sal_Int32 i = rSeq.getLength(); i--; ) { - OUString& rUrl = rSeq[i]; + OUString& rUrl = rSeqRange[i]; INetContentType eType = INetContentTypes::GetContentTypeFromURL( rUrl ); OUString aType( INetContentTypes::GetContentType( eType ) ); diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx index 2fedd2ac65fa..fc74b81d55f1 100644 --- a/framework/source/services/pathsettings.cxx +++ b/framework/source/services/pathsettings.cxx @@ -804,11 +804,10 @@ css::uno::Sequence< sal_Int32 > PathSettings::impl_mapPathName2IDList(std::u16st // follow these group IDs! But if such ID is not in the range of [0..IDGROUP_COUNT] // the outside can't determine the right group ... and can not fire the right events .-) - css::uno::Sequence< sal_Int32 > lIDs(IDGROUP_COUNT); - lIDs[0] = IDGROUP_OLDSTYLE; - lIDs[1] = IDGROUP_INTERNAL_PATHS; - lIDs[2] = IDGROUP_USER_PATHS; - lIDs[3] = IDGROUP_WRITE_PATH; + css::uno::Sequence<sal_Int32> lIDs{ IDGROUP_OLDSTYLE, IDGROUP_INTERNAL_PATHS, + IDGROUP_USER_PATHS, IDGROUP_WRITE_PATH }; + assert(lIDs.getLength() == IDGROUP_COUNT); + auto plIDs = lIDs.getArray(); sal_Int32 c = m_lPropDesc.getLength(); sal_Int32 i = 0; @@ -817,16 +816,16 @@ css::uno::Sequence< sal_Int32 > PathSettings::impl_mapPathName2IDList(std::u16st const css::beans::Property& rProp = m_lPropDesc[i]; if (rProp.Name == sPath) - lIDs[IDGROUP_OLDSTYLE] = rProp.Handle; + plIDs[IDGROUP_OLDSTYLE] = rProp.Handle; else if (rProp.Name == sInternalProp) - lIDs[IDGROUP_INTERNAL_PATHS] = rProp.Handle; + plIDs[IDGROUP_INTERNAL_PATHS] = rProp.Handle; else if (rProp.Name == sUserProp) - lIDs[IDGROUP_USER_PATHS] = rProp.Handle; + plIDs[IDGROUP_USER_PATHS] = rProp.Handle; else if (rProp.Name == sWriteProp) - lIDs[IDGROUP_WRITE_PATH] = rProp.Handle; + plIDs[IDGROUP_WRITE_PATH] = rProp.Handle; } return lIDs; @@ -837,8 +836,11 @@ void PathSettings::impl_notifyPropListener( std::u16string_view sPath, const PathSettings::PathInfo* pPathNew) { css::uno::Sequence< sal_Int32 > lHandles(1); + auto plHandles = lHandles.getArray(); css::uno::Sequence< css::uno::Any > lOldVals(1); + auto plOldVals = lOldVals.getArray(); css::uno::Sequence< css::uno::Any > lNewVals(1); + auto plNewVals = lNewVals.getArray(); css::uno::Sequence< sal_Int32 > lIDs = impl_mapPathName2IDList(sPath); sal_Int32 c = lIDs.getLength(); @@ -854,7 +856,7 @@ void PathSettings::impl_notifyPropListener( std::u16string_view sPath, ) continue; - lHandles[0] = nID; + plHandles[0] = nID; switch(impl_getPropGroup(nID)) { case IDGROUP_OLDSTYLE : @@ -862,12 +864,12 @@ void PathSettings::impl_notifyPropListener( std::u16string_view sPath, if (pPathOld) { OUString sVal = impl_convertPath2OldStyle(*pPathOld); - lOldVals[0] <<= sVal; + plOldVals[0] <<= sVal; } if (pPathNew) { OUString sVal = impl_convertPath2OldStyle(*pPathNew); - lNewVals[0] <<= sVal; + plNewVals[0] <<= sVal; } } break; @@ -875,34 +877,34 @@ void PathSettings::impl_notifyPropListener( std::u16string_view sPath, case IDGROUP_INTERNAL_PATHS : { if (pPathOld) - lOldVals[0] <<= comphelper::containerToSequence(pPathOld->lInternalPaths); + plOldVals[0] <<= comphelper::containerToSequence(pPathOld->lInternalPaths); if (pPathNew) - lNewVals[0] <<= comphelper::containerToSequence(pPathNew->lInternalPaths); + plNewVals[0] <<= comphelper::containerToSequence(pPathNew->lInternalPaths); } break; case IDGROUP_USER_PATHS : { if (pPathOld) - lOldVals[0] <<= comphelper::containerToSequence(pPathOld->lUserPaths); + plOldVals[0] <<= comphelper::containerToSequence(pPathOld->lUserPaths); if (pPathNew) - lNewVals[0] <<= comphelper::containerToSequence(pPathNew->lUserPaths); + plNewVals[0] <<= comphelper::containerToSequence(pPathNew->lUserPaths); } break; case IDGROUP_WRITE_PATH : { if (pPathOld) - lOldVals[0] <<= pPathOld->sWritePath; + plOldVals[0] <<= pPathOld->sWritePath; if (pPathNew) - lNewVals[0] <<= pPathNew->sWritePath; + plNewVals[0] <<= pPathNew->sWritePath; } break; } - fire(lHandles.getArray(), - lNewVals.getArray(), - lOldVals.getArray(), + fire(plHandles, + plNewVals, + plOldVals, 1, false); } @@ -1027,13 +1029,14 @@ void PathSettings::impl_rebuildPropertyDescriptor() sal_Int32 c = static_cast<sal_Int32>(m_lPaths.size()); sal_Int32 i = 0; m_lPropDesc.realloc(c*IDGROUP_COUNT); + auto plPropDesc = m_lPropDesc.getArray(); for (auto const& path : m_lPaths) { const PathSettings::PathInfo& rPath = path.second; css::beans::Property* pProp = nullptr; - pProp = &(m_lPropDesc[i]); + pProp = &(plPropDesc[i]); pProp->Name = rPath.sPathName; pProp->Handle = i; pProp->Type = cppu::UnoType<OUString>::get(); @@ -1042,7 +1045,7 @@ void PathSettings::impl_rebuildPropertyDescriptor() pProp->Attributes |= css::beans::PropertyAttribute::READONLY; ++i; - pProp = &(m_lPropDesc[i]); + pProp = &(plPropDesc[i]); pProp->Name = rPath.sPathName+POSTFIX_INTERNAL_PATHS; pProp->Handle = i; pProp->Type = cppu::UnoType<css::uno::Sequence< OUString >>::get(); @@ -1050,7 +1053,7 @@ void PathSettings::impl_rebuildPropertyDescriptor() css::beans::PropertyAttribute::READONLY; ++i; - pProp = &(m_lPropDesc[i]); + pProp = &(plPropDesc[i]); pProp->Name = rPath.sPathName+POSTFIX_USER_PATHS; pProp->Handle = i; pProp->Type = cppu::UnoType<css::uno::Sequence< OUString >>::get(); @@ -1059,7 +1062,7 @@ void PathSettings::impl_rebuildPropertyDescriptor() pProp->Attributes |= css::beans::PropertyAttribute::READONLY; ++i; - pProp = &(m_lPropDesc[i]); + pProp = &(plPropDesc[i]); pProp->Name = rPath.sPathName+POSTFIX_WRITE_PATH; pProp->Handle = i; pProp->Type = cppu::UnoType<OUString>::get(); diff --git a/framework/source/services/sessionlistener.cxx b/framework/source/services/sessionlistener.cxx index e90cde5c3641..01e4cdbce614 100644 --- a/framework/source/services/sessionlistener.cxx +++ b/framework/source/services/sessionlistener.cxx @@ -179,8 +179,8 @@ void SessionListener::StoreSession( bool bAsync ) if ( bAsync ) xDispatch->addStatusListener(this, aURL); - Sequence< PropertyValue > args(1); - args[0] = PropertyValue("DispatchAsynchron",-1,makeAny(bAsync),PropertyState_DIRECT_VALUE); + Sequence< PropertyValue > args{ PropertyValue("DispatchAsynchron",-1,makeAny(bAsync), + PropertyState_DIRECT_VALUE) }; xDispatch->dispatch(aURL, args); } catch (const css::uno::Exception&) { TOOLS_WARN_EXCEPTION("fwk.session", ""); @@ -207,8 +207,8 @@ void SessionListener::QuitSessionQuietly() aURL.Complete = "vnd.sun.star.autorecovery:/doSessionQuietQuit"; xURLTransformer->parseStrict(aURL); - Sequence< PropertyValue > args(1); - args[0] = PropertyValue("DispatchAsynchron",-1,makeAny(false),PropertyState_DIRECT_VALUE); + Sequence< PropertyValue > args{ PropertyValue("DispatchAsynchron",-1,makeAny(false), + PropertyState_DIRECT_VALUE) }; xDispatch->dispatch(aURL, args); } catch (const css::uno::Exception&) { TOOLS_WARN_EXCEPTION("fwk.session", ""); diff --git a/framework/source/services/taskcreatorsrv.cxx b/framework/source/services/taskcreatorsrv.cxx index 856d440230b6..9ce0941fb745 100644 --- a/framework/source/services/taskcreatorsrv.cxx +++ b/framework/source/services/taskcreatorsrv.cxx @@ -315,8 +315,7 @@ void TaskCreatorService::implts_establishWindowStateListener( const css::uno::Re // See used classes for further information too. rtl::Reference<PersistentWindowState> pPersistentStateHandler = new PersistentWindowState( m_xContext ); - css::uno::Sequence< css::uno::Any > lInitData(1); - lInitData[0] <<= xFrame; + css::uno::Sequence< css::uno::Any > lInitData{ css::uno::Any(xFrame) }; pPersistentStateHandler->initialize(lInitData); } @@ -327,8 +326,7 @@ void TaskCreatorService::implts_establishDocModifyListener( const css::uno::Refe // It will tag the window as modified if the underlying model was modified ... rtl::Reference<TagWindowAsModified> pTag = new TagWindowAsModified(); - css::uno::Sequence< css::uno::Any > lInitData(1); - lInitData[0] <<= xFrame; + css::uno::Sequence< css::uno::Any > lInitData{ css::uno::Any(xFrame) }; pTag->initialize(lInitData); } @@ -336,8 +334,7 @@ void TaskCreatorService::implts_establishTitleBarUpdate( const css::uno::Referen { rtl::Reference<TitleBarUpdate> pHelper = new TitleBarUpdate (m_xContext); - css::uno::Sequence< css::uno::Any > lInitData(1); - lInitData[0] <<= xFrame; + css::uno::Sequence< css::uno::Any > lInitData{ css::uno::Any(xFrame) }; pHelper->initialize(lInitData); } diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx index f479063b4bfc..47d4e3825cc3 100644 --- a/framework/source/uiconfiguration/imagemanagerimpl.cxx +++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx @@ -715,6 +715,7 @@ Sequence< uno::Reference< XGraphic > > ImageManagerImpl::getImages( // 1. user image list (read/write) // 2. module image list (read) // 3. global image list (read) + auto aGraphSeqRange = asNonConstRange(aGraphSeq); sal_Int32 n = 0; for ( const OUString& rURL : aCommandURLSequence ) { @@ -726,7 +727,7 @@ Sequence< uno::Reference< XGraphic > > ImageManagerImpl::getImages( aImage = rGlobalImageList->getImageFromCommandURL( nIndex, rURL ); } - aGraphSeq[n++] = GetXGraphic(aImage); + aGraphSeqRange[n++] = GetXGraphic(aImage); } return aGraphSeq; diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index ef141701cb6c..b2346455d228 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -55,6 +55,7 @@ #include <vcl/svapp.hxx> #include <sal/log.hxx> #include <comphelper/multicontainer2.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequenceashashmap.hxx> #include <comphelper/servicehelper.hxx> #include <memory> @@ -1068,17 +1069,15 @@ Sequence< Sequence< PropertyValue > > SAL_CALL ModuleUIConfigurationManager::get else impl_fillSequenceWithElementTypeInfo( aUIElementInfoCollection, ElementType ); - Sequence< PropertyValue > aUIElementInfo( 2 ); - aUIElementInfo[0].Name = "ResourceURL"; - aUIElementInfo[1].Name = m_aPropUIName; - aElementInfoSeq.resize( aUIElementInfoCollection.size() ); sal_Int32 n = 0; for (auto const& elem : aUIElementInfoCollection) { - aUIElementInfo[0].Value <<= elem.second.aResourceURL; - aUIElementInfo[1].Value <<= elem.second.aUIName; + Sequence< PropertyValue > aUIElementInfo{ + comphelper::makePropertyValue("ResourceURL", elem.second.aResourceURL), + comphelper::makePropertyValue(m_aPropUIName, elem.second.aUIName) + }; aElementInfoSeq[n++] = aUIElementInfo; } diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index eebfad2fb5a7..495bbb573896 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -48,6 +48,7 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/multicontainer2.hxx> #include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> @@ -850,16 +851,14 @@ Sequence< Sequence< PropertyValue > > SAL_CALL UIConfigurationManager::getUIElem else impl_fillSequenceWithElementTypeInfo( aUIElementInfoCollection, ElementType ); - Sequence< PropertyValue > aUIElementInfo( 2 ); - aUIElementInfo[0].Name = "ResourceURL"; - aUIElementInfo[1].Name = m_aPropUIName; - aElementInfoSeq.resize( aUIElementInfoCollection.size() ); sal_Int32 n = 0; for (auto const& elem : aUIElementInfoCollection) { - aUIElementInfo[0].Value <<= elem.second.aResourceURL; - aUIElementInfo[1].Value <<= elem.second.aUIName; + Sequence< PropertyValue > aUIElementInfo{ + comphelper::makePropertyValue("ResourceURL", elem.second.aResourceURL), + comphelper::makePropertyValue(m_aPropUIName, elem.second.aUIName) + }; aElementInfoSeq[n++] = aUIElementInfo; } diff --git a/framework/source/uielement/FixedTextToolbarController.cxx b/framework/source/uielement/FixedTextToolbarController.cxx index 36a1061aa86f..02bfd4c5d6cb 100644 --- a/framework/source/uielement/FixedTextToolbarController.cxx +++ b/framework/source/uielement/FixedTextToolbarController.cxx @@ -19,6 +19,7 @@ #include <uielement/FixedTextToolbarController.hxx> +#include <comphelper/propertyvalue.hxx> #include <vcl/toolbox.hxx> #include <vcl/InterimItemWindow.hxx> #include <vcl/svapp.hxx> @@ -89,14 +90,11 @@ void SAL_CALL FixedTextToolbarController::dispose() Sequence<PropertyValue> FixedTextToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const { - Sequence<PropertyValue> aArgs(2); const OUString aSelectedText = m_pFixedTextControl->get_label(); // Add key modifier to argument list - aArgs[0].Name = "KeyModifier"; - aArgs[0].Value <<= KeyModifier; - aArgs[1].Name = "Text"; - aArgs[1].Value <<= aSelectedText; + Sequence<PropertyValue> aArgs{ comphelper::makePropertyValue("KeyModifier", KeyModifier), + comphelper::makePropertyValue("Text", aSelectedText) }; return aArgs; } diff --git a/framework/source/uielement/buttontoolbarcontroller.cxx b/framework/source/uielement/buttontoolbarcontroller.cxx index cfdcd23979db..2c869acd8cab 100644 --- a/framework/source/uielement/buttontoolbarcontroller.cxx +++ b/framework/source/uielement/buttontoolbarcontroller.cxx @@ -27,6 +27,7 @@ #include <cppuhelper/queryinterface.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <vcl/svapp.hxx> #include <vcl/toolbox.hxx> @@ -228,11 +229,8 @@ void SAL_CALL ButtonToolbarController::execute( sal_Int16 KeyModifier ) try { - Sequence<PropertyValue> aArgs( 1 ); - // Provide key modifier information to dispatch function - aArgs[0].Name = "KeyModifier"; - aArgs[0].Value <<= KeyModifier; + Sequence<PropertyValue> aArgs{ comphelper::makePropertyValue("KeyModifier", KeyModifier) }; xDispatch->dispatch( aTargetURL, aArgs ); } diff --git a/framework/source/uielement/comboboxtoolbarcontroller.cxx b/framework/source/uielement/comboboxtoolbarcontroller.cxx index a54c78d0d774..0bc03db8de69 100644 --- a/framework/source/uielement/comboboxtoolbarcontroller.cxx +++ b/framework/source/uielement/comboboxtoolbarcontroller.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> +#include <comphelper/propertyvalue.hxx> #include <vcl/InterimItemWindow.hxx> #include <svtools/toolboxcontroller.hxx> #include <vcl/svapp.hxx> @@ -178,14 +179,11 @@ void SAL_CALL ComboboxToolbarController::dispose() Sequence<PropertyValue> ComboboxToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const { - Sequence<PropertyValue> aArgs( 2 ); OUString aSelectedText = m_pComboBox->get_active_text(); // Add key modifier to argument list - aArgs[0].Name = "KeyModifier"; - aArgs[0].Value <<= KeyModifier; - aArgs[1].Name = "Text"; - aArgs[1].Value <<= aSelectedText; + Sequence<PropertyValue> aArgs{ comphelper::makePropertyValue("KeyModifier", KeyModifier), + comphelper::makePropertyValue("Text", aSelectedText) }; return aArgs; } diff --git a/framework/source/uielement/complextoolbarcontroller.cxx b/framework/source/uielement/complextoolbarcontroller.cxx index 743306590056..fb902ed17d1e 100644 --- a/framework/source/uielement/complextoolbarcontroller.cxx +++ b/framework/source/uielement/complextoolbarcontroller.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/frame/XControlNotificationListener.hpp> #include <com/sun/star/frame/XFrame.hpp> +#include <comphelper/propertyvalue.hxx> #include <svtools/toolboxcontroller.hxx> #include <vcl/svapp.hxx> #include <vcl/mnemonic.hxx> @@ -77,11 +78,8 @@ void SAL_CALL ComplexToolbarController::dispose() Sequence<PropertyValue> ComplexToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const { - Sequence<PropertyValue> aArgs( 1 ); - // Add key modifier to argument list - aArgs[0].Name = "KeyModifier"; - aArgs[0].Value <<= KeyModifier; + Sequence<PropertyValue> aArgs{ comphelper::makePropertyValue("KeyModifier", KeyModifier) }; return aArgs; } @@ -264,8 +262,9 @@ void ComplexToolbarController::addNotifyInfo( sal_Int32 nCount = rInfo.getLength(); uno::Sequence< beans::NamedValue > aInfoSeq( rInfo ); aInfoSeq.realloc( nCount+1 ); - aInfoSeq[nCount].Name = "Source"; - aInfoSeq[nCount].Value <<= getFrameInterface(); + auto pInfoSeq = aInfoSeq.getArray(); + pInfoSeq[nCount].Name = "Source"; + pInfoSeq[nCount].Value <<= getFrameInterface(); pNotifyInfo->aInfoSeq = aInfoSeq; Application::PostUserEvent( LINK(nullptr, ComplexToolbarController, Notify_Impl), pNotifyInfo ); diff --git a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx index 00c14f2b0c7c..ae4b14ab2055 100644 --- a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx +++ b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> +#include <comphelper/propertyvalue.hxx> #include <vcl/InterimItemWindow.hxx> #include <svtools/toolboxcontroller.hxx> #include <vcl/svapp.hxx> @@ -155,14 +156,11 @@ void SAL_CALL DropdownToolbarController::dispose() Sequence<PropertyValue> DropdownToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const { - Sequence<PropertyValue> aArgs( 2 ); OUString aSelectedText = m_pListBoxControl->get_active_text(); // Add key modifier to argument list - aArgs[0].Name = "KeyModifier"; - aArgs[0].Value <<= KeyModifier; - aArgs[1].Name = "Text"; - aArgs[1].Value <<= aSelectedText; + Sequence<PropertyValue> aArgs{ comphelper::makePropertyValue("KeyModifier", KeyModifier), + comphelper::makePropertyValue("Text", aSelectedText) }; return aArgs; } diff --git a/framework/source/uielement/edittoolbarcontroller.cxx b/framework/source/uielement/edittoolbarcontroller.cxx index 8bde909c703d..1f974e77cd54 100644 --- a/framework/source/uielement/edittoolbarcontroller.cxx +++ b/framework/source/uielement/edittoolbarcontroller.cxx @@ -20,6 +20,8 @@ #include <uielement/edittoolbarcontroller.hxx> #include <com/sun/star/beans/PropertyValue.hpp> + +#include <comphelper/propertyvalue.hxx> #include <vcl/InterimItemWindow.hxx> #include <svtools/toolboxcontroller.hxx> #include <vcl/svapp.hxx> @@ -160,14 +162,11 @@ void SAL_CALL EditToolbarController::dispose() Sequence<PropertyValue> EditToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const { - Sequence<PropertyValue> aArgs( 2 ); OUString aSelectedText = m_pEditControl->get_text(); // Add key modifier to argument list - aArgs[0].Name = "KeyModifier"; - aArgs[0].Value <<= KeyModifier; - aArgs[1].Name = "Text"; - aArgs[1].Value <<= aSelectedText; + Sequence<PropertyValue> aArgs{ comphelper::makePropertyValue("KeyModifier", KeyModifier), + comphelper::makePropertyValue("Text", aSelectedText) }; return aArgs; } diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx index 004fcf80ce78..aa2f7b0b9eb2 100644 --- a/framework/source/uielement/generictoolbarcontroller.cxx +++ b/framework/source/uielement/generictoolbarcontroller.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/frame/status/Visibility.hpp> #include <com/sun/star/frame/ControlCommand.hpp> +#include <comphelper/propertyvalue.hxx> #include <vcl/svapp.hxx> #include <vcl/toolbox.hxx> #include <vcl/weld.hxx> @@ -150,11 +151,9 @@ void SAL_CALL GenericToolbarController::execute( sal_Int16 KeyModifier ) return; css::util::URL aTargetURL; - Sequence<PropertyValue> aArgs( 1 ); // Add key modifier to argument list - aArgs[0].Name = "KeyModifier"; - aArgs[0].Value <<= KeyModifier; + Sequence<PropertyValue> aArgs{ comphelper::makePropertyValue("KeyModifier", KeyModifier) }; aTargetURL.Complete = aCommandURL; if ( m_xUrlTransformer.is() ) diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 7e6b202d4353..e17268d8d997 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -42,6 +42,7 @@ #include <com/sun/star/util/URLTransformer.hpp> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertyvalue.hxx> #include <officecfg/Office/Common.hxx> #include <svtools/javainteractionhandler.hxx> #include <uno/current_context.hxx> @@ -795,9 +796,7 @@ IMPL_LINK( MenuBarManager, Select, Menu *, pMenu, bool ) if ( pMenu->GetUserValue( nCurItemId ) ) { // addon menu item selected - aArgs.realloc( 1 ); - aArgs[0].Name = "Referer"; - aArgs[0].Value <<= OUString( "private:user" ); + aArgs = { comphelper::makePropertyValue("Referer", OUString("private:user")) }; } xDispatch = pMenuItemHandler->xMenuItemDispatch; @@ -1190,10 +1189,11 @@ void MenuBarManager::RetrieveShortcuts( std::vector< std::unique_ptr<MenuItemHan vcl::KeyCode aEmptyKeyCode; Sequence< OUString > aSeq( aMenuShortCuts.size() ); + auto aSeqRange = asNonConstRange(aSeq); const sal_uInt32 nCount = aMenuShortCuts.size(); for ( sal_uInt32 i = 0; i < nCount; ++i ) { - aSeq[i] = aMenuShortCuts[i]->aMenuItemURL; + aSeqRange[i] = aMenuShortCuts[i]->aMenuItemURL; aMenuShortCuts[i]->aKeyCode = aEmptyKeyCode; } diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index 1e6d88e9c286..710f49c264d4 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/util/XURLTransformer.hpp> +#include <comphelper/propertyvalue.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include <vcl/commandinfoprovider.hxx> @@ -232,17 +233,18 @@ void NewMenuController::setAccelerators( PopupMenu* pPopupMenu ) nSeqCount+=1; Sequence< OUString > aSeq( nSeqCount ); + auto aSeqRange = asNonConstRange(aSeq); // Add a special command for our "New" menu. if ( m_bNewMenu ) { - aSeq[nSeqCount-1] = m_aCommandURL; + aSeqRange[nSeqCount-1] = m_aCommandURL; aMenuShortCuts.push_back( aEmptyKeyCode ); } const sal_uInt32 nCount = aCmds.size(); for ( sal_uInt32 i = 0; i < nCount; i++ ) - aSeq[i] = aCmds[i]; + aSeqRange[i] = aCmds[i]; if ( m_xGlobalAcceleratorManager.is() ) retrieveShortcutsFromConfiguration( xGlobalAccelCfg, aSeq, aMenuShortCuts ); @@ -405,9 +407,8 @@ void SAL_CALL NewMenuController::itemSelected( const css::awt::MenuEvent& rEvent aTargetFrame = pAttributes->aTargetFrame; } - Sequence< PropertyValue > aArgsList( 1 ); - aArgsList[0].Name = "Referer"; - aArgsList[0].Value <<= OUString( "private:user" ); + Sequence< PropertyValue > aArgsList{ comphelper::makePropertyValue("Referer", + OUString( "private:user" )) }; dispatchCommand( aURL, aArgsList, aTargetFrame ); } diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx index d4f702d84e50..078022c6ac85 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -255,7 +255,7 @@ void PopupMenuToolbarController::createPopupMenuController() { sal_Int32 nAppendIndex = aArgs.getLength(); aArgs.realloc(nAppendIndex + 1); - aArgs[nAppendIndex] <<= comphelper::makePropertyValue("ResourceURL", m_aPopupCommand); + aArgs.getArray()[nAppendIndex] <<= comphelper::makePropertyValue("ResourceURL", m_aPopupCommand); m_xPopupMenuController.set( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( "com.sun.star.comp.framework.ResourceMenuController", aArgs, m_xContext), css::uno::UNO_QUERY_THROW ); @@ -707,9 +707,8 @@ void SAL_CALL NewToolbarController::execute( sal_Int16 /*KeyModifier*/ ) else aURL = m_aCommandURL; - css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 ); - aArgs[0].Name = "Referer"; - aArgs[0].Value <<= OUString( "private:user" ); + css::uno::Sequence< css::beans::PropertyValue > aArgs{ comphelper::makePropertyValue( + "Referer", OUString( "private:user" )) }; dispatchCommand( aURL, aArgs, aTarget ); } diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx index 87701f8b9ba6..6fe4a8f7286f 100644 --- a/framework/source/uielement/recentfilesmenucontroller.cxx +++ b/framework/source/uielement/recentfilesmenucontroller.cxx @@ -20,6 +20,7 @@ #include <strings.hrc> #include <classes/fwkresid.hxx> +#include <comphelper/propertyvalue.hxx> #include <cppuhelper/supportsservice.hxx> #include <osl/mutex.hxx> #include <svtools/popupmenucontrollerbase.hxx> @@ -245,18 +246,15 @@ void RecentFilesMenuController::executeEntry( sal_Int32 nIndex ) ( nIndex >= sal::static_int_cast<sal_Int32>( m_aRecentFilesItems.size() ))) return; - Sequence< PropertyValue > aArgsList(3); - aArgsList[0].Name = "Referer"; - aArgsList[0].Value <<= OUString( "private:user" ); + Sequence< PropertyValue > aArgsList{ + comphelper::makePropertyValue("Referer", OUString( "private:user" )), - // documents in the picklist will never be opened as templates - aArgsList[1].Name = "AsTemplate"; - aArgsList[1].Value <<= false; - - // Type detection needs to know which app we are opening it from. - aArgsList[2].Name = "DocumentService"; - aArgsList[2].Value <<= m_aModuleName; + // documents in the picklist will never be opened as templates + comphelper::makePropertyValue("AsTemplate", false), + // Type detection needs to know which app we are opening it from. + comphelper::makePropertyValue("DocumentService", m_aModuleName) + }; dispatchCommand( m_aRecentFilesItems[ nIndex ], aArgsList, "_default" ); } diff --git a/framework/source/uielement/spinfieldtoolbarcontroller.cxx b/framework/source/uielement/spinfieldtoolbarcontroller.cxx index cb5e16194193..fdcac34fd1fe 100644 --- a/framework/source/uielement/spinfieldtoolbarcontroller.cxx +++ b/framework/source/uielement/spinfieldtoolbarcontroller.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> +#include <comphelper/propertyvalue.hxx> #include <svtools/toolboxcontroller.hxx> #include <vcl/InterimItemWindow.hxx> #include <vcl/event.hxx> @@ -206,18 +207,13 @@ void SAL_CALL SpinfieldToolbarController::dispose() Sequence<PropertyValue> SpinfieldToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const { - Sequence<PropertyValue> aArgs( 2 ); OUString aSpinfieldText = m_pSpinfieldControl->get_entry_text(); // Add key modifier to argument list - aArgs[0].Name = "KeyModifier"; - aArgs[0].Value <<= KeyModifier; - aArgs[1].Name = "Value"; - if ( m_bFloat ) - aArgs[1].Value <<= aSpinfieldText.toDouble(); - else - aArgs[1].Value <<= aSpinfieldText.toInt32(); - return aArgs; + auto aArgs0 = comphelper::makePropertyValue("KeyModifier", KeyModifier); + auto aArgs1 = comphelper::makePropertyValue("Value", m_bFloat ? Any(aSpinfieldText.toDouble()) + : Any(aSpinfieldText.toInt32())); + return { aArgs0, aArgs1 }; } void SpinfieldToolbarController::Modify() diff --git a/framework/source/uielement/togglebuttontoolbarcontroller.cxx b/framework/source/uielement/togglebuttontoolbarcontroller.cxx index 77bf14418ca5..37f65a336404 100644 --- a/framework/source/uielement/togglebuttontoolbarcontroller.cxx +++ b/framework/source/uielement/togglebuttontoolbarcontroller.cxx @@ -19,6 +19,7 @@ #include <uielement/togglebuttontoolbarcontroller.hxx> +#include <comphelper/propertyvalue.hxx> #include <vcl/svapp.hxx> #include <vcl/toolbox.hxx> #include <vcl/menu.hxx> @@ -61,13 +62,9 @@ void SAL_CALL ToggleButtonToolbarController::dispose() Sequence<PropertyValue> ToggleButtonToolbarController::getExecuteArgs(sal_Int16 KeyModifier) const { - Sequence<PropertyValue> aArgs( 2 ); - - // Add key modifier to argument list - aArgs[0].Name = "KeyModifier"; - aArgs[0].Value <<= KeyModifier; - aArgs[1].Name = "Text"; - aArgs[1].Value <<= m_aCurrentSelection; + Sequence<PropertyValue> aArgs{ // Add key modifier to argument list + comphelper::makePropertyValue("KeyModifier", KeyModifier), + comphelper::makePropertyValue("Text", m_aCurrentSelection) }; return aArgs; } diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index ddec6fb528d7..1664040e76cc 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -58,6 +58,7 @@ #include <unotools/cmdoptions.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <unotools/mediadescriptor.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include <svtools/miscopt.hxx> #include <svtools/imgdef.hxx> @@ -977,9 +978,8 @@ void ToolBarManager::impl_elementChanged(bool const isRemove, // Special case: An image from the document image manager has been removed. // It is possible that we have an image at our module image manager. Before // we can remove our image we have to ask our module image manager. - Sequence< OUString > aCmdURLSeq( 1 ); + Sequence< OUString > aCmdURLSeq{ pIter->first }; Sequence< Reference< XGraphic > > aGraphicSeq; - aCmdURLSeq[0] = pIter->first; aGraphicSeq = m_xModuleImageManager->getImages( nImageType, aCmdURLSeq ); aImage = Image( aGraphicSeq[0] ); } @@ -2090,10 +2090,8 @@ IMPL_LINK( ToolBarManager, MenuSelect, Menu*, pMenu, bool ) if ( xDisp.is() ) { - Sequence< PropertyValue > aPropSeq( 1 ); - - aPropSeq[ 0 ].Name = "ResourceURL"; - aPropSeq[ 0 ].Value <<= m_aResourceName; + Sequence< PropertyValue > aPropSeq{ comphelper::makePropertyValue( + "ResourceURL", m_aResourceName) }; xDisp->dispatch( aURL, aPropSeq ); } @@ -2207,7 +2205,7 @@ IMPL_LINK( ToolBarManager, MenuSelect, Menu*, pMenu, bool ) { // We have found the requested item, toggle the visible flag // and write back the configuration settings to the toolbar - aProp[nVisibleIndex].Value <<= !bVisible; + aProp.getArray()[nVisibleIndex].Value <<= !bVisible; try { xItemContainer->replaceByIndex( i, makeAny( aProp )); diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index 7806acb53443..7e2323d085f0 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/ui/UIElementType.hpp> #include <com/sun/star/ui/theWindowStateConfiguration.hpp> +#include <comphelper/propertyvalue.hxx> #include <officecfg/Office/Common.hxx> #include <vcl/menu.hxx> #include <vcl/svapp.hxx> @@ -282,17 +283,16 @@ Sequence< Sequence< css::beans::PropertyValue > > ToolbarsMenuController::getLay } } - Sequence< css::beans::PropertyValue > aTbSeq( 2 ); - aTbSeq[0].Name = g_aPropUIName; - aTbSeq[1].Name = g_aPropResourceURL; - Sequence< Sequence< css::beans::PropertyValue > > aSeq( aToolBarArray.size() ); + auto pSeq = aSeq.getArray(); const sal_uInt32 nCount = aToolBarArray.size(); for ( sal_uInt32 i = 0; i < nCount; i++ ) { - aTbSeq[0].Value <<= aToolBarArray[i].aToolBarUIName; - aTbSeq[1].Value <<= aToolBarArray[i].aToolBarResName; - aSeq[i] = aTbSeq; + Sequence< css::beans::PropertyValue > aTbSeq{ + comphelper::makePropertyValue(g_aPropUIName, aToolBarArray[i].aToolBarUIName), + comphelper::makePropertyValue(g_aPropResourceURL, aToolBarArray[i].aToolBarResName) + }; + pSeq[i] = aTbSeq; } return aSeq; @@ -603,7 +603,7 @@ void SAL_CALL ToolbarsMenuController::itemSelected( const css::awt::MenuEvent& r if ( !bVisible && bContextSensitive && nVisibleIndex >= 0 ) { // Default is: Every context sensitive toolbar is visible - aWindowState[nVisibleIndex].Value <<= true; + aWindowState.getArray()[nVisibleIndex].Value <<= true; xNameReplace->replaceByName( aElementName, makeAny( aWindowState )); bRefreshToolbars = true; } diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx index 90051358f5be..682b482766fc 100644 --- a/framework/source/uielement/uicommanddescription.cxx +++ b/framework/source/uielement/uicommanddescription.cxx @@ -39,6 +39,7 @@ #include <vcl/mnemonic.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include <comphelper/string.hxx> @@ -265,24 +266,18 @@ Any ConfigurationAccess_UICommand::getSequenceFromCache( const OUString& aComman if ( !pIter->second.bCommandNameCreated ) fillInfoFromResult( pIter->second, pIter->second.aLabel ); - Sequence< PropertyValue > aPropSeq( 8 ); - aPropSeq[0].Name = "Label"; - aPropSeq[0].Value = !pIter->second.aContextLabel.isEmpty() ? - makeAny( pIter->second.aContextLabel ): makeAny( pIter->second.aLabel ); - aPropSeq[1].Name = "Name"; - aPropSeq[1].Value <<= pIter->second.aCommandName; - aPropSeq[2].Name = "Popup"; - aPropSeq[2].Value <<= pIter->second.bPopup; - aPropSeq[3].Name = m_aPropProperties; - aPropSeq[3].Value <<= pIter->second.nProperties; - aPropSeq[4].Name = "PopupLabel"; - aPropSeq[4].Value <<= pIter->second.aPopupLabel; - aPropSeq[5].Name = "TooltipLabel"; - aPropSeq[5].Value <<= pIter->second.aTooltipLabel; - aPropSeq[6].Name = "TargetURL"; - aPropSeq[6].Value <<= pIter->second.aTargetURL; - aPropSeq[7].Name = "IsExperimental"; - aPropSeq[7].Value <<= pIter->second.bIsExperimental; + Sequence< PropertyValue > aPropSeq{ + comphelper::makePropertyValue("Label", !pIter->second.aContextLabel.isEmpty() + ? makeAny(pIter->second.aContextLabel) + : makeAny(pIter->second.aLabel)), + comphelper::makePropertyValue("Name", pIter->second.aCommandName), + comphelper::makePropertyValue("Popup", pIter->second.bPopup), + comphelper::makePropertyValue(m_aPropProperties, pIter->second.nProperties), + comphelper::makePropertyValue("PopupLabel", pIter->second.aPopupLabel), + comphelper::makePropertyValue("TooltipLabel", pIter->second.aTooltipLabel), + comphelper::makePropertyValue("TargetURL", pIter->second.aTargetURL), + comphelper::makePropertyValue("IsExperimental", pIter->second.bIsExperimental) + }; return makeAny( aPropSeq ); } diff --git a/framework/source/uifactory/addonstoolbarfactory.cxx b/framework/source/uifactory/addonstoolbarfactory.cxx index 1c48d6c5844b..399f2e50872d 100644 --- a/framework/source/uifactory/addonstoolbarfactory.cxx +++ b/framework/source/uifactory/addonstoolbarfactory.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/ui/XUIElementFactory.hpp> +#include <comphelper/propertyvalue.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <vcl/svapp.hxx> @@ -180,17 +181,10 @@ Reference< XUIElement > SAL_CALL AddonsToolBarFactory::createUIElement( aConfigData.hasElements() && hasButtonsInContext( aConfigData, xFrame )) { - PropertyValue aPropValue; - Sequence< Any > aPropSeq( 3 ); - aPropValue.Name = "Frame"; - aPropValue.Value <<= xFrame; - aPropSeq[0] <<= aPropValue; - aPropValue.Name = "ConfigurationData"; - aPropValue.Value <<= aConfigData; - aPropSeq[1] <<= aPropValue; - aPropValue.Name = "ResourceURL"; - aPropValue.Value <<= aResourceURL; - aPropSeq[2] <<= aPropValue; + Sequence< Any > aPropSeq{ Any(comphelper::makePropertyValue("Frame", xFrame)), + Any(comphelper::makePropertyValue("ConfigurationData", + aConfigData)), + Any(comphelper::makePropertyValue("ResourceURL", aResourceURL)) }; SolarMutexGuard aGuard; rtl::Reference<AddonsToolBarWrapper> pToolBarWrapper = new AddonsToolBarWrapper( m_xContext ); diff --git a/framework/source/uifactory/menubarfactory.cxx b/framework/source/uifactory/menubarfactory.cxx index 56f84c15de34..95c62a71afc5 100644 --- a/framework/source/uifactory/menubarfactory.cxx +++ b/framework/source/uifactory/menubarfactory.cxx @@ -133,6 +133,7 @@ void MenuBarFactory::CreateUIElement(const OUString& ResourceURL nURLPropertyIndex++; Sequence< Any > aPropSeq( nSeqLength ); + auto aPropSeqRange = asNonConstRange(aPropSeq); for ( sal_Int32 n = 0; n < aPropSeq.getLength(); n++ ) { PropertyValue aPropValue; @@ -149,7 +150,7 @@ void MenuBarFactory::CreateUIElement(const OUString& ResourceURL else aPropValue = Args[n]; - aPropSeq[n] <<= aPropValue; + aPropSeqRange[n] <<= aPropValue; } SolarMutexGuard aGuard; diff --git a/framework/source/uifactory/uicontrollerfactory.cxx b/framework/source/uifactory/uicontrollerfactory.cxx index 0c013c9eb59d..61852fbf0b17 100644 --- a/framework/source/uifactory/uicontrollerfactory.cxx +++ b/framework/source/uifactory/uicontrollerfactory.cxx @@ -142,19 +142,20 @@ Reference< XInterface > SAL_CALL UIControllerFactory::createInstanceWithArgument sal_Int32 nAppendIndex = aNewArgs.getLength(); aNewArgs.realloc( aNewArgs.getLength() + 2 ); + auto pNewArgs = aNewArgs.getArray(); // Append the command URL to the Arguments sequence so that one controller can be // used for more than one command URL. aPropValue.Name = "CommandURL"; aPropValue.Value <<= ServiceSpecifier; - aNewArgs[nAppendIndex] <<= aPropValue; + pNewArgs[nAppendIndex] <<= aPropValue; // Append the optional value argument. It's an empty string if no additional info // is provided to the controller. OUString aValue = m_pConfigAccess->getValueFromCommandModule( ServiceSpecifier, aPropName ); aPropValue.Name = "Value"; aPropValue.Value <<= aValue; - aNewArgs[nAppendIndex+1] <<= aPropValue; + pNewArgs[nAppendIndex+1] <<= aPropValue; { OUString aServiceName; diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx index b1567724ff06..029d8790943f 100644 --- a/framework/source/uifactory/uielementfactorymanager.cxx +++ b/framework/source/uifactory/uielementfactorymanager.cxx @@ -41,6 +41,7 @@ #include <rtl/ref.hxx> #include <sal/log.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertyvalue.hxx> #include <cppuhelper/basemutex.hxx> #include <cppuhelper/compbase.hxx> #include <cppuhelper/supportsservice.hxx> @@ -162,25 +163,26 @@ Sequence< Sequence< PropertyValue > > ConfigurationAccess_FactoryManager::getFac if ( !aFactory.isEmpty() ) { sal_Int32 nToken = 0; - Sequence< PropertyValue > aSeq( 1 ); aSeqSeq.realloc( aSeqSeq.getLength() + 1 ); - aSeq[0].Name = m_aPropType; - aSeq[0].Value <<= aFactory.getToken( 0, '^', nToken ); + Sequence< PropertyValue > aSeq{ comphelper::makePropertyValue( + m_aPropType, aFactory.getToken( 0, '^', nToken )) }; if ( nToken > 0 ) { aSeq.realloc( 2 ); - aSeq[1].Name = m_aPropName; - aSeq[1].Value <<= aFactory.getToken( 0, '^', nToken ); + aSeq.getArray()[1] + = comphelper::makePropertyValue(m_aPropName, + aFactory.getToken( 0, '^', nToken )); if ( nToken > 0 ) { aSeq.realloc( 3 ); - aSeq[2].Name = m_aPropModule; - aSeq[2].Value <<= aFactory.getToken( 0, '^', nToken ); + aSeq.getArray()[2] + = comphelper::makePropertyValue(m_aPropModule, + aFactory.getToken( 0, '^', nToken )); } } - aSeqSeq[nIndex++] = aSeq; + aSeqSeq.getArray()[nIndex++] = aSeq; } } |