diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-25 09:34:01 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-25 12:03:17 +0200 |
commit | f74da1315a5b2ec232a66944e41ff90231b383be (patch) | |
tree | 60d464c45df3531013642d61cbc8302ac815a1ae /framework | |
parent | 04a6a5d5cdc6889c6f0e41b3df537f59baeee9f9 (diff) |
use more comphelper::InitAnyPropertySequence
Found with:
git grep -n -A10 'Sequence.*Any' -- *.cxx | grep -B5 -w PropertyValueProvider
and:
git grep -n 'Sequence.*Any.*( *&'
Change-Id: Icb18c98bdd3f8352817e443ff78de5df042859ad
Reviewed-on: https://gerrit.libreoffice.org/40389
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework')
9 files changed, 59 insertions, 88 deletions
diff --git a/framework/source/uiconfiguration/globalsettings.cxx b/framework/source/uiconfiguration/globalsettings.cxx index 8cc4316d8669..0af47f622d2b 100644 --- a/framework/source/uiconfiguration/globalsettings.cxx +++ b/framework/source/uiconfiguration/globalsettings.cxx @@ -31,6 +31,7 @@ #include <rtl/ustrbuf.hxx> #include <rtl/instance.hxx> +#include <comphelper/propertysequence.hxx> #include <cppuhelper/implbase.hxx> // Defines @@ -190,9 +191,6 @@ bool GlobalSettings_Access::GetToolbarStateInfo( GlobalSettings::StateInfo eStat void GlobalSettings_Access::impl_initConfigAccess() { - css::uno::Sequence< css::uno::Any > aArgs( 2 ); - css::beans::PropertyValue aPropValue; - try { if ( m_xContext.is() ) @@ -200,13 +198,11 @@ void GlobalSettings_Access::impl_initConfigAccess() css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider = css::configuration::theDefaultProvider::get( m_xContext ); - aPropValue.Name = "nodepath"; - aPropValue.Value <<= OUString("/org.openoffice.Office.UI.GlobalSettings/Toolbars"); - aArgs[0] <<= aPropValue; - aPropValue.Name = "lazywrite"; - aPropValue.Value <<= true; - aArgs[1] <<= aPropValue; - + uno::Sequence<uno::Any> aArgs(comphelper::InitAnyPropertySequence( + { + {"nodepath", uno::Any(OUString("/org.openoffice.Office.UI.GlobalSettings/Toolbars"))}, + {"lazywrite", uno::Any(true)} + })); m_xConfigAccess.set(xConfigProvider->createInstanceWithArguments( SERVICENAME_CFGREADACCESS, aArgs ), css::uno::UNO_QUERY ); diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 1bb4119e5387..00c66f75be67 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -49,6 +49,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XComponent.hpp> +#include <comphelper/propertysequence.hxx> #include <comphelper/sequence.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/interfacecontainer.hxx> @@ -1442,18 +1443,12 @@ Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getImageManager() UNO_QUERY ); Reference< XInitialization > xInit( m_xModuleImageManager, UNO_QUERY ); - Sequence< Any > aPropSeq( 3 ); - PropertyValue aPropValue; - aPropValue.Name = "UserConfigStorage"; - aPropValue.Value <<= m_xUserConfigStorage; - aPropSeq[0] <<= aPropValue; - aPropValue.Name = "ModuleIdentifier"; - aPropValue.Value <<= m_aModuleIdentifier; - aPropSeq[1] <<= aPropValue; - aPropValue.Name = "UserRootCommit"; - aPropValue.Value <<= m_xUserRootCommit; - aPropSeq[2] <<= aPropValue; - + uno::Sequence<uno::Any> aPropSeq(comphelper::InitAnyPropertySequence( + { + {"UserConfigStorage", uno::Any(m_xUserConfigStorage)}, + {"ModuleIdentifier", uno::Any(m_aModuleIdentifier)}, + {"UserRootCommit", uno::Any(m_xUserRootCommit)}, + })); xInit->initialize( aPropSeq ); } diff --git a/framework/source/uiconfiguration/uicategorydescription.cxx b/framework/source/uiconfiguration/uicategorydescription.cxx index 1dcd2681c1e2..119d5282a373 100644 --- a/framework/source/uiconfiguration/uicategorydescription.cxx +++ b/framework/source/uiconfiguration/uicategorydescription.cxx @@ -37,6 +37,7 @@ #include <unotools/configmgr.hxx> #include <vcl/mnemonic.hxx> +#include <comphelper/propertysequence.hxx> #include <comphelper/sequence.hxx> #include <unordered_map> @@ -294,14 +295,12 @@ Sequence< OUString > ConfigurationAccess_UICategory::getAllIds() void ConfigurationAccess_UICategory::initializeConfigAccess() { - Sequence< Any > aArgs( 1 ); - PropertyValue aPropValue; - try { - aPropValue.Name = "nodepath"; - aPropValue.Value <<= m_aConfigCategoryAccess; - aArgs[0] <<= aPropValue; + Sequence<Any> aArgs(comphelper::InitAnyPropertySequence( + { + {"nodepath", Any(m_aConfigCategoryAccess)} + })); m_xConfigAccess.set( m_xConfigProvider->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", aArgs ),UNO_QUERY ); diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index 8419dac29b02..945d0cee0f26 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -47,6 +47,7 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> +#include <comphelper/propertysequence.hxx> #include <comphelper/sequence.hxx> #include <vcl/svapp.hxx> #include <rtl/ref.hxx> @@ -1139,14 +1140,11 @@ Reference< XInterface > SAL_CALL UIConfigurationManager::getImageManager() UNO_QUERY ); Reference< XInitialization > xInit( m_xImageManager, UNO_QUERY ); - Sequence< Any > aPropSeq( 2 ); - PropertyValue aPropValue; - aPropValue.Name = "UserConfigStorage"; - aPropValue.Value <<= m_xDocConfigStorage; - aPropSeq[0] <<= aPropValue; - aPropValue.Name = "ModuleIdentifier"; - aPropValue.Value <<= m_aModuleIdentifier; - aPropSeq[1] <<= aPropValue; + Sequence<Any> aPropSeq(comphelper::InitAnyPropertySequence( + { + {"UserConfigStorage", Any(m_xDocConfigStorage)}, + {"ModuleIdentifier", Any(m_aModuleIdentifier)}, + })); xInit->initialize( aPropSeq ); } diff --git a/framework/source/uiconfiguration/windowstateconfiguration.cxx b/framework/source/uiconfiguration/windowstateconfiguration.cxx index 9ce2da62bdf2..3870b0c0cb28 100644 --- a/framework/source/uiconfiguration/windowstateconfiguration.cxx +++ b/framework/source/uiconfiguration/windowstateconfiguration.cxx @@ -40,6 +40,7 @@ #include <cppuhelper/compbase.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> +#include <comphelper/propertysequence.hxx> #include <comphelper/sequence.hxx> #include <unordered_map> @@ -1209,18 +1210,13 @@ void ConfigurationAccess_WindowState::impl_putPropertiesFromStruct( const Window void ConfigurationAccess_WindowState::impl_initializeConfigAccess() { - Sequence< Any > aArgs( 2 ); - PropertyValue aPropValue; - try { - aPropValue.Name = "nodepath"; - aPropValue.Value <<= m_aConfigWindowAccess; - aArgs[0] <<= aPropValue; - aPropValue.Name = "lazywrite"; - aPropValue.Value <<= true; - aArgs[1] <<= aPropValue; - + Sequence<Any> aArgs(comphelper::InitAnyPropertySequence( + { + {"nodepath", Any(m_aConfigWindowAccess)}, + {"lazywrite", Any(true)} + })); m_xConfigAccess.set( m_xConfigProvider->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationUpdateAccess", aArgs ), UNO_QUERY ); if ( m_xConfigAccess.is() ) diff --git a/framework/source/uielement/addonstoolbarmanager.cxx b/framework/source/uielement/addonstoolbarmanager.cxx index 211c9f9e27b3..9d00ca60d939 100644 --- a/framework/source/uielement/addonstoolbarmanager.cxx +++ b/framework/source/uielement/addonstoolbarmanager.cxx @@ -42,6 +42,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/ui/DockingArea.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> +#include <comphelper/propertysequence.hxx> #include <comphelper/processfactory.hxx> #include <svtools/imgdef.hxx> #include <svtools/toolboxcontroller.hxx> @@ -277,25 +278,14 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue if ( m_xToolbarControllerFactory.is() && m_xToolbarControllerFactory->hasController( aURL, m_aModuleIdentifier )) { - Sequence< Any > aArgs(5); - PropertyValue aPropValue; - - aPropValue.Name = "ModuleIdentifier"; - aPropValue.Value <<= m_aModuleIdentifier; - aArgs[0] <<= aPropValue; - aPropValue.Name = "Frame"; - aPropValue.Value <<= m_xFrame; - aArgs[1] <<= aPropValue; - aPropValue.Name = "ServiceManager"; - aPropValue.Value <<= Reference<XMultiServiceFactory>(m_xContext->getServiceManager(), UNO_QUERY_THROW); - aArgs[2] <<= aPropValue; - aPropValue.Name = "ParentWindow"; - aPropValue.Value <<= xToolbarWindow; - aArgs[3] <<= aPropValue; - aPropValue.Name = "ItemId"; - aPropValue.Value <<= sal_Int32( nId ); - aArgs[4] <<= aPropValue; - + uno::Sequence<uno::Any> aArgs(comphelper::InitAnyPropertySequence( + { + {"ModuleIdentifier", uno::Any(m_aModuleIdentifier)}, + {"Frame", uno::Any(m_xFrame)}, + {"ServiceManager", uno::Any(Reference<XMultiServiceFactory>(m_xContext->getServiceManager(), UNO_QUERY_THROW))}, + {"ParentWindow", uno::Any(xToolbarWindow)}, + {"ItemId", uno::Any(sal_Int32( nId ))} + })); try { xController.set( m_xToolbarControllerFactory->createInstanceWithArgumentsAndContext( diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx index eed5f5c7230e..5a59fce6e662 100644 --- a/framework/source/uielement/uicommanddescription.cxx +++ b/framework/source/uielement/uicommanddescription.cxx @@ -36,6 +36,7 @@ #include <unotools/configmgr.hxx> #include <vcl/mnemonic.hxx> +#include <comphelper/propertysequence.hxx> #include <comphelper/sequence.hxx> #include <comphelper/string.hxx> @@ -500,15 +501,12 @@ Sequence< OUString > ConfigurationAccess_UICommand::getAllCommands() void ConfigurationAccess_UICommand::initializeConfigAccess() { - Sequence< Any > aArgs( 1 ); - PropertyValue aPropValue; - try { - aPropValue.Name = "nodepath"; - aPropValue.Value <<= m_aConfigCmdAccess; - aArgs[0] <<= aPropValue; - + Sequence<Any> aArgs(comphelper::InitAnyPropertySequence( + { + {"nodepath", Any(m_aConfigCmdAccess)} + })); m_xConfigAccess.set( m_xConfigProvider->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", aArgs ),UNO_QUERY ); if ( m_xConfigAccess.is() ) @@ -522,10 +520,12 @@ void ConfigurationAccess_UICommand::initializeConfigAccess() } } - aPropValue.Value <<= m_aConfigPopupAccess; - aArgs[0] <<= aPropValue; + Sequence<Any> aArgs2(comphelper::InitAnyPropertySequence( + { + {"nodepath", Any(m_aConfigPopupAccess)} + })); m_xConfigAccessPopups.set( m_xConfigProvider->createInstanceWithArguments( - "com.sun.star.configuration.ConfigurationAccess", aArgs ),UNO_QUERY ); + "com.sun.star.configuration.ConfigurationAccess", aArgs2 ),UNO_QUERY ); if ( m_xConfigAccessPopups.is() ) { // Add as container listener diff --git a/framework/source/uifactory/factoryconfiguration.cxx b/framework/source/uifactory/factoryconfiguration.cxx index 1a600b0ea75a..1895daa7f376 100644 --- a/framework/source/uifactory/factoryconfiguration.cxx +++ b/framework/source/uifactory/factoryconfiguration.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/container/XContainer.hpp> #include <rtl/ustrbuf.hxx> +#include <comphelper/propertysequence.hxx> #include <cppuhelper/weak.hxx> // Defines @@ -192,13 +193,10 @@ void ConfigurationAccess_ControllerFactory::readConfigurationData() if ( !m_bConfigAccessInitialized ) { - Sequence< Any > aArgs( 1 ); - PropertyValue aPropValue; - - aPropValue.Name = "nodepath"; - aPropValue.Value <<= m_sRoot; - aArgs[0] <<= aPropValue; - + uno::Sequence<uno::Any> aArgs(comphelper::InitAnyPropertySequence( + { + {"nodepath", uno::Any(m_sRoot)} + })); try { m_xConfigAccess.set( m_xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,aArgs ), UNO_QUERY ); diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx index ee455a54d2bb..5524e3118528 100644 --- a/framework/source/uifactory/uielementfactorymanager.cxx +++ b/framework/source/uifactory/uielementfactorymanager.cxx @@ -37,6 +37,7 @@ #include <com/sun/star/ui/XUIElementFactoryManager.hpp> #include <rtl/ustrbuf.hxx> +#include <comphelper/propertysequence.hxx> #include <cppuhelper/basemutex.hxx> #include <cppuhelper/compbase.hxx> #include <cppuhelper/supportsservice.hxx> @@ -263,12 +264,10 @@ void ConfigurationAccess_FactoryManager::readConfigurationData() if ( !m_bConfigAccessInitialized ) { - Sequence< Any > aArgs( 1 ); - PropertyValue aPropValue; - - aPropValue.Name = "nodepath"; - aPropValue.Value <<= m_sRoot; - aArgs[0] <<= aPropValue; + Sequence<Any> aArgs(comphelper::InitAnyPropertySequence( + { + {"nodepath", Any(m_sRoot)} + })); try { |