diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2022-07-17 17:08:29 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2022-07-18 00:44:40 +0200 |
commit | d69340d4d1e7f96f0633bebd5abcf20114fbef0f (patch) | |
tree | 023f3439990be200b149bee5510acc34879fc758 /framework/source | |
parent | f1f52b6e5086124c75b57f6f6ff1f1f0353e40af (diff) |
Simplify by using InitAnyPropertySequence
Change-Id: I145ce892e101ba4e8906cbdb0d32a52a4c655d43
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137151
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'framework/source')
-rw-r--r-- | framework/source/uielement/toolbarmanager.cxx | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 34a63156bc2a..b2efe27c2f0a 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -59,7 +59,7 @@ #include <toolkit/helper/vclunohelper.hxx> #include <unotools/mediadescriptor.hxx> #include <comphelper/propertyvalue.hxx> -#include <comphelper/sequence.hxx> +#include <comphelper/propertysequence.hxx> #include <svtools/miscopt.hxx> #include <svtools/imgdef.hxx> #include <utility> @@ -1076,27 +1076,14 @@ void ToolBarManager::CreateControllers() if ( m_xToolbarControllerFactory.is() && m_xToolbarControllerFactory->hasController( aCommandURL, m_aModuleIdentifier )) { - PropertyValue aPropValue; - std::vector< Any > aPropertyVector; - - aPropValue.Name = "ModuleIdentifier"; - aPropValue.Value <<= m_aModuleIdentifier; - aPropertyVector.push_back( Any( aPropValue )); - aPropValue.Name = "Frame"; - aPropValue.Value <<= m_xFrame; - aPropertyVector.push_back( Any( aPropValue )); - aPropValue.Name = "ServiceManager"; Reference<XMultiServiceFactory> xMSF(m_xContext->getServiceManager(), UNO_QUERY_THROW); - aPropValue.Value <<= xMSF; - aPropertyVector.push_back( Any( aPropValue )); - aPropValue.Name = "ParentWindow"; - aPropValue.Value <<= xToolbarWindow; - aPropertyVector.push_back( Any( aPropValue )); - aPropValue.Name = "Identifier"; - aPropValue.Value <<= sal_uInt16(nId); - aPropertyVector.push_back( uno::Any( aPropValue ) ); - - Sequence< Any > aArgs( comphelper::containerToSequence( aPropertyVector )); + Sequence< Any > aArgs( comphelper::InitAnyPropertySequence( { + { "ModuleIdentifier", Any(m_aModuleIdentifier) }, + { "Frame", Any(m_xFrame) }, + { "ServiceManager", Any(xMSF) }, + { "ParentWindow", Any(xToolbarWindow) }, + { "Identifier", Any(sal_uInt16(nId)) }, + } )); xController.set( m_xToolbarControllerFactory->createInstanceWithArgumentsAndContext( aCommandURL, aArgs, m_xContext ), UNO_QUERY ); bInit = false; // Initialization is done through the factory service @@ -1184,14 +1171,14 @@ void ToolBarManager::CreateControllers() if ( bInit ) { Reference<XMultiServiceFactory> xMSF(m_xContext->getServiceManager(), UNO_QUERY_THROW); - Sequence< Any > aArgs { - Any( comphelper::makePropertyValue("Frame", m_xFrame) ), - Any( comphelper::makePropertyValue("CommandURL", aCommandURL) ), - Any( comphelper::makePropertyValue("ServiceManager", xMSF) ), - Any( comphelper::makePropertyValue("ParentWindow", xToolbarWindow) ), - Any( comphelper::makePropertyValue("ModuleIdentifier", m_aModuleIdentifier) ), - Any( comphelper::makePropertyValue("Identifier", sal_uInt16(nId)) ), - }; + Sequence< Any > aArgs( comphelper::InitAnyPropertySequence( { + { "Frame", Any(m_xFrame) }, + { "CommandURL", Any(aCommandURL) }, + { "ServiceManager", Any(xMSF) }, + { "ParentWindow", Any(xToolbarWindow) }, + { "ModuleIdentifier", Any(m_aModuleIdentifier) }, + { "Identifier", Any(sal_uInt16(nId)) }, + } )); xInit->initialize( aArgs ); } |