framework/source/uielement/toolbarmanager.cxx | 45 +++++++++----------------- 1 file changed, 16 insertions(+), 29 deletions(-)
New commits: commit d69340d4d1e7f96f0633bebd5abcf20114fbef0f Author: Maxim Monastirsky <momonas...@gmail.com> AuthorDate: Sun Jul 17 17:08:29 2022 +0300 Commit: Maxim Monastirsky <momonas...@gmail.com> CommitDate: Mon Jul 18 00:44:40 2022 +0200 Simplify by using InitAnyPropertySequence Change-Id: I145ce892e101ba4e8906cbdb0d32a52a4c655d43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137151 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky <momonas...@gmail.com> 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 ); }