diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-29 09:27:05 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-30 17:39:47 +0200 |
commit | 471f5ab323c5676ca22358ca67f4e6820b7e071c (patch) | |
tree | fc66276831a6bf9397d1235d306d81321682b417 /desktop | |
parent | 7ba7c1128f469ee5631f3221f6c468ed24c04b98 (diff) |
Prepare for removal of non-const operator[] from Sequence in desktop
Change-Id: I76959f62d46e12d984fe4c7be74e5857399e9126
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124358
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'desktop')
20 files changed, 120 insertions, 157 deletions
diff --git a/desktop/qa/unit/desktop-lok-init.cxx b/desktop/qa/unit/desktop-lok-init.cxx index 7e6e266cf899..49971afc2e5c 100644 --- a/desktop/qa/unit/desktop-lok-init.cxx +++ b/desktop/qa/unit/desktop-lok-init.cxx @@ -11,6 +11,7 @@ #include <cppunit/plugin/TestPlugIn.h> #include <cppunit/extensions/HelperMacros.h> #include <comphelper/anytostring.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include <tools/color.hxx> @@ -61,9 +62,7 @@ void LOKInitTest::testJsonToPropertyValues() "\"value\":\"something.odt\"" "}}"; - uno::Sequence<beans::PropertyValue> aArgs(1); - aArgs[0].Name = "FileName"; - aArgs[0].Value <<= OUString("something.odt"); + uno::Sequence aArgs{ comphelper::makePropertyValue("FileName", OUString("something.odt")) }; assertSequencesEqual( aArgs, comphelper::containerToSequence(desktop::jsonToPropertyValuesVector(arguments))); @@ -129,31 +128,26 @@ void LOKInitTest::testJsonToPropertyValuesBorder() "}}"; // see SvxBoxItem::QueryValue for details - uno::Sequence<uno::Any> aOuterSeq(9); table::BorderLine2 aLine(sal_Int32(COL_BLACK), 0, 1, 0, table::BorderLineStyle::SOLID, 1); - aOuterSeq[0] <<= aLine; // left - aOuterSeq[1] <<= aLine; // right - aOuterSeq[2] <<= aLine; // bottom - aOuterSeq[3] <<= aLine; // top - aOuterSeq[4] <<= static_cast<sal_Int32>(0); - aOuterSeq[5] <<= static_cast<sal_Int32>(0); - aOuterSeq[6] <<= static_cast<sal_Int32>(0); - aOuterSeq[7] <<= static_cast<sal_Int32>(0); - aOuterSeq[8] <<= static_cast<sal_Int32>(0); + uno::Sequence<uno::Any> aOuterSeq{ uno::Any(aLine), // left + uno::Any(aLine), // right + uno::Any(aLine), // bottom + uno::Any(aLine), // top + uno::Any(static_cast<sal_Int32>(0)), + uno::Any(static_cast<sal_Int32>(0)), + uno::Any(static_cast<sal_Int32>(0)), + uno::Any(static_cast<sal_Int32>(0)), + uno::Any(static_cast<sal_Int32>(0)) }; // see SvxBoxInfoItem::QueryValue() for details - uno::Sequence<uno::Any> aInnerSeq(5); - aInnerSeq[0] <<= aLine; // horizontal - aInnerSeq[1] <<= aLine; // vertical - aInnerSeq[2] <<= static_cast<sal_Int16>(0); - aInnerSeq[3] <<= static_cast<sal_Int16>(0x7F); - aInnerSeq[4] <<= static_cast<sal_Int32>(0); - - uno::Sequence<beans::PropertyValue> aArgs(2); - aArgs[0].Name = "OuterBorder"; - aArgs[0].Value <<= aOuterSeq; - aArgs[1].Name = "InnerBorder"; - aArgs[1].Value <<= aInnerSeq; + uno::Sequence<uno::Any> aInnerSeq{ uno::Any(aLine), // horizontal + uno::Any(aLine), // vertical + uno::Any(static_cast<sal_Int16>(0)), + uno::Any(static_cast<sal_Int16>(0x7F)), + uno::Any(static_cast<sal_Int32>(0)) }; + + uno::Sequence aArgs{ comphelper::makePropertyValue("OuterBorder", aOuterSeq), + comphelper::makePropertyValue("InnerBorder", aInnerSeq) }; assertSequencesEqual( aArgs, comphelper::containerToSequence(desktop::jsonToPropertyValuesVector(arguments))); diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index a026a1ede209..b254c927fd10 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -2432,9 +2432,7 @@ void Desktop::OpenSplashScreen() if ( rCmdLine.HasSplashPipe() ) aSplashService = "com.sun.star.office.PipeSplashScreen"; - Sequence< Any > aSeq( 2 ); - aSeq[0] <<= true; // bVisible - aSeq[1] <<= aAppName; + Sequence< Any > aSeq{ Any(true) /* bVisible */, Any(aAppName) }; css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); m_rSplashScreen.set( xContext->getServiceManager()->createInstanceWithArgumentsAndContext(aSplashService, aSeq, xContext), diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx index cff0a684cfcf..bc4af1c681b8 100644 --- a/desktop/source/app/appinit.cxx +++ b/desktop/source/app/appinit.cxx @@ -136,9 +136,7 @@ void Desktop::createAcceptor(const OUString& aAcceptString) if (pIter != rMap.end() ) return; - Sequence< Any > aSeq( 2 ); - aSeq[0] <<= aAcceptString; - aSeq[1] <<= bAccept; + Sequence< Any > aSeq{ Any(aAcceptString), Any(bAccept) }; Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); Reference<XInitialization> rAcceptor( xContext->getServiceManager()->createInstanceWithContext("com.sun.star.office.Acceptor", xContext), @@ -169,11 +167,9 @@ namespace { class enable { private: - Sequence<Any> m_aSeq; + Sequence<Any> m_aSeq{ Any(true) }; public: - enable() : m_aSeq(1) { - m_aSeq[0] <<= true; - } + enable() = default; void operator() (const AcceptorMap::value_type& val) { if (val.second.is()) { val.second->initialize(m_aSeq); diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx index 3080909b484c..a5978696f6e5 100644 --- a/desktop/source/app/check_ext_deps.cxx +++ b/desktop/source/app/check_ext_deps.cxx @@ -315,10 +315,9 @@ static void impl_setNeedsCompatCheck() configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() ) ); - Sequence< Any > theArgs(1); beans::NamedValue v( "nodepath", makeAny( OUString("org.openoffice.Setup/Office") ) ); - theArgs[0] <<= v; + Sequence< Any > theArgs{ Any(v) }; Reference< beans::XPropertySet > pset( theConfigProvider->createInstanceWithArguments( aAccessSrvc, theArgs ), UNO_QUERY_THROW ); @@ -346,10 +345,9 @@ static bool impl_needsCompatCheck() configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() ) ); - Sequence< Any > theArgs(1); beans::NamedValue v( "nodepath", makeAny( OUString("org.openoffice.Setup/Office") ) ); - theArgs[0] <<= v; + Sequence< Any > theArgs{ Any(v) }; Reference< beans::XPropertySet > pset( theConfigProvider->createInstanceWithArguments( aAccessSrvc, theArgs ), UNO_QUERY_THROW ); diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 0e39415d8fab..a3c5bc40d5c4 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -53,6 +53,7 @@ #include <com/sun/star/script/XLibraryContainer2.hpp> #include <com/sun/star/document/XEmbeddedScripts.hpp> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include <tools/diagnose_ex.h> #include <tools/urlobj.hxx> @@ -215,7 +216,7 @@ void scriptCat(const Reference< XModel >& xDoc ) std::cout << aObjectNames.getLength() << "\n\n"; for ( sal_Int32 j = 0 ; j < aObjectNames.getLength() ; ++j ) { - OUString &rObjectName = aObjectNames[j]; + const OUString &rObjectName = aObjectNames[j]; try { @@ -270,20 +271,16 @@ void batchPrint( const OUString &rPrinterName, const Reference< XPrintable > &xD std::cout << std::endl; // create the custom printer, if given - Sequence < PropertyValue > aPrinterArgs( 1 ); + Sequence < PropertyValue > aPrinterArgs; if( !aPrinterName.isEmpty() ) { - aPrinterArgs[0].Name = "Name"; - aPrinterArgs[0].Value <<= aPrinterName; + aPrinterArgs = { comphelper::makePropertyValue("Name", aPrinterName) }; xDoc->setPrinter( aPrinterArgs ); } // print ( also without user interaction ) - aPrinterArgs.realloc(2); - aPrinterArgs[0].Name = "FileName"; - aPrinterArgs[0].Value <<= aOutFile; - aPrinterArgs[1].Name = "Wait"; - aPrinterArgs[1].Value <<= true; + aPrinterArgs = { comphelper::makePropertyValue("FileName", aOutFile), + comphelper::makePropertyValue("Wait", true) }; xDoc->print( aPrinterArgs ); } @@ -433,9 +430,8 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest // We have to be listener to catch errors during dispatching URLs. // Otherwise it would be possible to have an office running without an open // window!! - Sequence < PropertyValue > aArgs2(1); - aArgs2[0].Name = "SynchronMode"; - aArgs2[0].Value <<= true; + Sequence < PropertyValue > aArgs2{ comphelper::makePropertyValue("SynchronMode", + true) }; Reference < XNotifyingDispatch > xDisp( xDispatcher, UNO_QUERY ); if ( xDisp.is() ) xDisp->dispatchWithNotification( aURL, aArgs2, this ); @@ -613,12 +609,13 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest if ( !aImgOut.isEmpty() ) nProps +=1; Sequence<PropertyValue> conversionProperties( nProps ); - conversionProperties[0].Name = "ConversionRequestOrigin"; - conversionProperties[0].Value <<= OUString("CommandLine"); - conversionProperties[1].Name = "Overwrite"; - conversionProperties[1].Value <<= true; + auto pconversionProperties = conversionProperties.getArray(); + pconversionProperties[0].Name = "ConversionRequestOrigin"; + pconversionProperties[0].Value <<= OUString("CommandLine"); + pconversionProperties[1].Name = "Overwrite"; + pconversionProperties[1].Value <<= true; - conversionProperties[2].Name = "FilterName"; + pconversionProperties[2].Name = "FilterName"; if( 0 < nFilterOptionsIndex ) { OUString sFilterName = aFilter.copy(0, nFilterOptionsIndex); @@ -643,21 +640,21 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest bMultiFileTarget = (!aTok.isEmpty() && aTok.toInt32() != 0); } - conversionProperties[2].Value <<= sFilterName; + pconversionProperties[2].Value <<= sFilterName; - conversionProperties[3].Name = "FilterOptions"; - conversionProperties[3].Value <<= sFilterOptions; + pconversionProperties[3].Name = "FilterOptions"; + pconversionProperties[3].Value <<= sFilterOptions; } else { - conversionProperties[2].Value <<= aFilter; + pconversionProperties[2].Value <<= aFilter; } if ( !aImgOut.isEmpty() ) { assert(conversionProperties[nProps-1].Name.isEmpty()); - conversionProperties[nProps-1].Name = "ImageFilter"; - conversionProperties[nProps-1].Value <<= aImgOut; + pconversionProperties[nProps-1].Name = "ImageFilter"; + pconversionProperties[nProps-1].Value <<= aImgOut; } OUString aTempName; @@ -718,16 +715,14 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest if ( aDispatchRequest.aRequestType == REQUEST_PRINTTO ) { // create the printer - Sequence < PropertyValue > aPrinterArgs( 1 ); - aPrinterArgs[0].Name = "Name"; - aPrinterArgs[0].Value <<= aDispatchRequest.aPrinterName; + Sequence < PropertyValue > aPrinterArgs{ comphelper::makePropertyValue( + "Name", aDispatchRequest.aPrinterName) }; xDoc->setPrinter( aPrinterArgs ); } // print ( also without user interaction ) - Sequence < PropertyValue > aPrinterArgs( 1 ); - aPrinterArgs[0].Name = "Wait"; - aPrinterArgs[0].Value <<= true; + Sequence < PropertyValue > aPrinterArgs{ comphelper::makePropertyValue("Wait", + true) }; xDoc->print( aPrinterArgs ); } } @@ -762,11 +757,10 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest if ( !aDispatches.empty() ) { // Execute all asynchronous dispatches now after we placed them into our request container! - Sequence < PropertyValue > aArgs( 2 ); - aArgs[0].Name = "Referer"; - aArgs[0].Value <<= OUString("private:OpenEvent"); - aArgs[1].Name = "SynchronMode"; - aArgs[1].Value <<= true; + Sequence < PropertyValue > aArgs{ + comphelper::makePropertyValue("Referer", OUString("private:OpenEvent")), + comphelper::makePropertyValue("SynchronMode", true) + }; for (const DispatchHolder & aDispatche : aDispatches) { diff --git a/desktop/source/app/opencl.cxx b/desktop/source/app/opencl.cxx index 0ea322e02565..fb5c3723ed8b 100644 --- a/desktop/source/app/opencl.cxx +++ b/desktop/source/app/opencl.cxx @@ -24,6 +24,7 @@ #include <officecfg/Office/Calc.hxx> #include <officecfg/Office/Common.hxx> +#include <comphelper/propertyvalue.hxx> #include <svl/documentlockfile.hxx> #include <tools/diagnose_ex.h> @@ -125,9 +126,8 @@ static bool testOpenCLCompute(const Reference< XDesktop2 > &xDesktop, const OUSt try { css::uno::Reference< css::frame::XComponentLoader > xLoader(xDesktop, css::uno::UNO_QUERY_THROW); - css::uno::Sequence< css::beans::PropertyValue > aArgs(1); - aArgs[0].Name = "Hidden"; - aArgs[0].Value <<= true; + css::uno::Sequence< css::beans::PropertyValue > aArgs{ comphelper::makePropertyValue("Hidden", + true) }; xComponent.set(xLoader->loadComponentFromURL(rURL, "_blank", 0, aArgs)); diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index 00523112f88b..b13697a75c30 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -60,6 +60,7 @@ #include <vcl/svapp.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <dp_dependencies.hxx> #include <dp_descriptioninfoset.hxx> @@ -376,8 +377,9 @@ void UpdateDialog::Thread::prepareUpdateData( out_du.aUpdateInfo = updateInfo; out_du.unsatisfiedDependencies.realloc(ds.getLength()); + auto p_unsatisfiedDependencies = out_du.unsatisfiedDependencies.getArray(); for (sal_Int32 i = 0; i < ds.getLength(); ++i) { - out_du.unsatisfiedDependencies[i] = dp_misc::Dependencies::getErrorText(ds[i]); + p_unsatisfiedDependencies[i] = dp_misc::Dependencies::getErrorText(ds[i]); } const ::std::optional< OUString> updateWebsiteURL(infoset.getLocalizedUpdateWebsiteURL()); @@ -606,12 +608,9 @@ void UpdateDialog::createNotifyJob( bool bPrepareOnly, configuration::theDefaultProvider::get( comphelper::getProcessComponentContext())); - beans::PropertyValue aProperty; - aProperty.Name = "nodepath"; - aProperty.Value <<= OUString("org.openoffice.Office.Addons/AddonUI/OfficeHelp/UpdateCheckJob"); - - uno::Sequence< uno::Any > aArgumentList( 1 ); - aArgumentList[0] <<= aProperty; + uno::Sequence< uno::Any > aArgumentList{ uno::Any(comphelper::makePropertyValue( + "nodepath", + OUString("org.openoffice.Office.Addons/AddonUI/OfficeHelp/UpdateCheckJob"))) }; uno::Reference< container::XNameAccess > xNameAccess( xConfigProvider->createInstanceWithArguments( @@ -633,13 +632,8 @@ void UpdateDialog::createNotifyJob( bool bPrepareOnly, if( xDispatch.is() ) { - uno::Sequence< beans::PropertyValue > aPropList(2); - aProperty.Name = "updateList"; - aProperty.Value <<= rItemList; - aPropList[0] = aProperty; - aProperty.Name = "prepareOnly"; - aProperty.Value <<= bPrepareOnly; - aPropList[1] = aProperty; + uno::Sequence aPropList{ comphelper::makePropertyValue("updateList", rItemList), + comphelper::makePropertyValue("prepareOnly", bPrepareOnly) }; xDispatch->dispatch(aURL, aPropList ); } @@ -678,7 +672,7 @@ void UpdateDialog::notifyMenubar( bool bPrepareOnly, bool bRecheckOnly ) aInfoset.getVersion() }; aItemList.realloc( nCount + 1 ); - aItemList[ nCount ] = aItem; + aItemList.getArray()[ nCount ] = aItem; nCount += 1; } else @@ -768,8 +762,7 @@ void UpdateDialog::getIgnoredUpdates() uno::Reference< lang::XMultiServiceFactory > xConfig( configuration::theDefaultProvider::get(m_context)); beans::NamedValue aValue( "nodepath", uno::Any( OUString(IGNORED_UPDATES) ) ); - uno::Sequence< uno::Any > args(1); - args[0] <<= aValue; + uno::Sequence< uno::Any > args{ uno::Any(aValue) }; uno::Reference< container::XNameAccess > xNameAccess( xConfig->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", args), uno::UNO_QUERY_THROW ); const uno::Sequence< OUString > aElementNames = xNameAccess->getElementNames(); diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index 68a6fe08579d..f9232f0e36f1 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -1125,9 +1125,10 @@ uno::Sequence< uno::Sequence<Reference<css::deployment::XPackage> > > sal_Int32 j = 0; uno::Sequence< uno::Sequence<Reference<css::deployment::XPackage> > > seqSeq(vecExtensions.size()); + auto seqSeqRange = asNonConstRange(seqSeq); for (auto const& elem : vecExtensions) { - seqSeq[j++] = comphelper::containerToSequence(elem); + seqSeqRange[j++] = comphelper::containerToSequence(elem); } return seqSeq; diff --git a/desktop/source/deployment/manager/dp_informationprovider.cxx b/desktop/source/deployment/manager/dp_informationprovider.cxx index 738600556dd9..1e7beea34a05 100644 --- a/desktop/source/deployment/manager/dp_informationprovider.cxx +++ b/desktop/source/deployment/manager/dp_informationprovider.cxx @@ -275,7 +275,7 @@ PackageInformationProvider::isUpdateAvailable( const OUString& _sExtensionId ) aNewEntry[0] = updateInfo.first; aNewEntry[1] = updateVersion; aList.realloc( ++nCount ); - aList[ nCount-1 ] = ::uno::Sequence< OUString >( aNewEntry, 2 ); + aList.getArray()[ nCount-1 ] = ::uno::Sequence< OUString >( aNewEntry, 2 ); } } return aList; @@ -299,6 +299,7 @@ uno::Sequence< uno::Sequence< OUString > > SAL_CALL PackageInformationProvider:: sal_Int32 cAllIds = allExt.getLength(); retList.realloc(cAllIds); + auto pretList = retList.getArray(); for (sal_Int32 i = 0; i < cAllIds; i++) { @@ -315,10 +316,7 @@ uno::Sequence< uno::Sequence< OUString > > SAL_CALL PackageInformationProvider:: uno::Reference< deployment::XPackage > const & xExtension( seqExtension[j] ); if (xExtension.is()) { - OUString aNewEntry[2]; - aNewEntry[0] = dp_misc::getIdentifier(xExtension); - aNewEntry[1] = xExtension->getVersion(); - retList[i] = ::uno::Sequence< OUString >( aNewEntry, 2 ); + pretList[i] = { dp_misc::getIdentifier(xExtension), xExtension->getVersion() }; break; } } diff --git a/desktop/source/deployment/misc/dp_dependencies.cxx b/desktop/source/deployment/misc/dp_dependencies.cxx index 16e2590bd8a2..e187a69746f1 100644 --- a/desktop/source/deployment/misc/dp_dependencies.cxx +++ b/desktop/source/deployment/misc/dp_dependencies.cxx @@ -104,6 +104,7 @@ check(dp_misc::DescriptionInfoset const & infoset) { sal_Int32 n = deps->getLength(); css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > > unsatisfied(n); + auto unsatisfiedRange = asNonConstRange(unsatisfied); sal_Int32 unsat = 0; // check first if minimalVersionLibreOffice is specified -- in that case ignore the legacy OOo dependencies bool bIgnoreOoo = false; @@ -147,7 +148,7 @@ check(dp_misc::DescriptionInfoset const & infoset) { minimalVersionOpenOfficeOrg)); } if (!sat) { - unsatisfied[unsat++] = e; + unsatisfiedRange[unsat++] = e; } } unsatisfied.realloc(unsat); diff --git a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx index f38c2b722ed4..00315cb3bad5 100644 --- a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx +++ b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx @@ -564,8 +564,9 @@ css::uno::Sequence< OUString > DescriptionInfoset::getUrls( } } css::uno::Sequence< OUString > urls(ns.is() ? ns->getLength() : 0); + auto urlsRange = asNonConstRange(urls); for (::sal_Int32 i = 0; i < urls.getLength(); ++i) { - urls[i] = getNodeValue(ns->item(i)); + urlsRange[i] = getNodeValue(ns->item(i)); } return urls; } diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index 218093c3587a..95bf25489147 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -514,15 +514,9 @@ BackendImpl::BackendImpl( "*.jar", DpResId(RID_STR_JAVA_TYPELIB) ) ), - m_typeInfos( 6 ) + m_typeInfos{ m_xDynComponentTypeInfo, m_xJavaComponentTypeInfo, m_xPythonComponentTypeInfo, + m_xComponentsTypeInfo, m_xRDBTypelibTypeInfo, m_xJavaTypelibTypeInfo } { - m_typeInfos[ 0 ] = m_xDynComponentTypeInfo; - m_typeInfos[ 1 ] = m_xJavaComponentTypeInfo; - m_typeInfos[ 2 ] = m_xPythonComponentTypeInfo; - m_typeInfos[ 3 ] = m_xComponentsTypeInfo; - m_typeInfos[ 4 ] = m_xRDBTypelibTypeInfo; - m_typeInfos[ 5 ] = m_xJavaTypelibTypeInfo; - const Reference<XCommandEnvironment> xCmdEnv; if (transientMode()) diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index 03eedff5fbab..4b388414a778 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -188,11 +188,8 @@ BackendImpl::BackendImpl( "*.xcs", DpResId(RID_STR_CONF_SCHEMA) ) ), - m_typeInfos( 2 ) + m_typeInfos{ m_xConfDataTypeInfo, m_xConfSchemaTypeInfo } { - m_typeInfos[ 0 ] = m_xConfDataTypeInfo; - m_typeInfos[ 1 ] = m_xConfSchemaTypeInfo; - const Reference<XCommandEnvironment> xCmdEnv; if (transientMode()) diff --git a/desktop/source/deployment/registry/dp_registry.cxx b/desktop/source/deployment/registry/dp_registry.cxx index 91db8918e747..10e155f40d4f 100644 --- a/desktop/source/deployment/registry/dp_registry.cxx +++ b/desktop/source/deployment/registry/dp_registry.cxx @@ -287,7 +287,8 @@ Reference<deployment::XPackageRegistry> PackageRegistryImpl::create( { Any element( xEnum->nextElement() ); Sequence<Any> registryArgs(cachePath.isEmpty() ? 1 : 3 ); - registryArgs[ 0 ] <<= context; + auto pregistryArgs = registryArgs.getArray(); + pregistryArgs[ 0 ] <<= context; if (!cachePath.isEmpty()) { Reference<lang::XServiceInfo> xServiceInfo( @@ -299,8 +300,8 @@ Reference<deployment::XPackageRegistry> PackageRegistryImpl::create( rtl_UriCharClassPchar, rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8 ) ) ); - registryArgs[ 1 ] <<= registryCachePath; - registryArgs[ 2 ] <<= false; // readOnly; + pregistryArgs[ 1 ] <<= registryCachePath; + pregistryArgs[ 2 ] <<= false; // readOnly; create_folder( nullptr, registryCachePath, Reference<XCommandEnvironment>() ); } diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index 6ed978ab3957..4c8d077e27fc 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -131,9 +131,8 @@ BackendImpl::BackendImpl( OUString(), DpResId(RID_STR_HELP) ) ), - m_typeInfos( 1 ) + m_typeInfos{ m_xHelpTypeInfo } { - m_typeInfos[ 0 ] = m_xHelpTypeInfo; if (transientMode()) return; diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index 8d8d234858c9..f69919c3b50c 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -36,6 +36,7 @@ #include <cppuhelper/supportsservice.hxx> #include <ucbhelper/content.hxx> #include <svl/inettype.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include <com/sun/star/lang/WrappedTargetException.hpp> #include <com/sun/star/graphic/XGraphic.hpp> @@ -274,11 +275,8 @@ BackendImpl::BackendImpl( "*.zip", m_xBundleTypeInfo->getShortDescription() ) ), - m_typeInfos(2) + m_typeInfos{ m_xBundleTypeInfo, m_xLegacyBundleTypeInfo } { - m_typeInfos[ 0 ] = m_xBundleTypeInfo; - m_typeInfos[ 1 ] = m_xLegacyBundleTypeInfo; - if (!transientMode()) { OUString dbFile = makeURL(getCachePath(), getImplementationName()); @@ -770,10 +768,8 @@ uno::Reference< graphic::XGraphic > BackendImpl::PackageImpl::getIcon( sal_Bool uno::Reference< XComponentContext > xContext( getMyBackend()->getComponentContext() ); uno::Reference< graphic::XGraphicProvider > xGraphProvider( graphic::GraphicProvider::create(xContext) ); - uno::Sequence< beans::PropertyValue > aMediaProps( 1 ); - aMediaProps[0].Name = "URL"; - aMediaProps[0].Value <<= aFullIconURL; - + uno::Sequence< beans::PropertyValue > aMediaProps{ comphelper::makePropertyValue( + "URL", aFullIconURL) }; xGraphic = xGraphProvider->queryGraphic( aMediaProps ); } @@ -1581,10 +1577,11 @@ Reference<deployment::XPackageRegistry> create( Reference<XComponentContext> const & xComponentContext ) { Sequence<Any> args(cachePath.isEmpty() ? 1 : 3 ); - args[ 0 ] <<= context; + auto pArgs = args.getArray(); + pArgs[ 0 ] <<= context; if (!cachePath.isEmpty()) { - args[ 1 ] <<= cachePath; - args[ 2 ] <<= false; // readOnly + pArgs[ 1 ] <<= cachePath; + pArgs[ 2 ] <<= false; // readOnly } return new BackendImpl( args, xComponentContext, xRootRegistry ); } diff --git a/desktop/source/deployment/registry/script/dp_script.cxx b/desktop/source/deployment/registry/script/dp_script.cxx index c0adcf069484..4dd3d3b3eb79 100644 --- a/desktop/source/deployment/registry/script/dp_script.cxx +++ b/desktop/source/deployment/registry/script/dp_script.cxx @@ -153,11 +153,8 @@ BackendImpl::BackendImpl( OUString() /* no file filter */, DpResId(RID_STR_DIALOG_LIB) ) ), - m_typeInfos( 2 ) + m_typeInfos{ m_xBasicLibTypeInfo, m_xDialogLibTypeInfo } { - m_typeInfos[ 0 ] = m_xBasicLibTypeInfo; - m_typeInfos[ 1 ] = m_xDialogLibTypeInfo; - OSL_ASSERT( ! transientMode() ); if (!transientMode()) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 8543bfd49513..4ab45c346697 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -59,6 +59,7 @@ #include <comphelper/string.hxx> #include <comphelper/profilezone.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/scopeguard.hxx> #include <comphelper/threadpool.hxx> #include <comphelper/sequenceashashmap.hxx> @@ -468,10 +469,10 @@ std::vector<beans::PropertyValue> desktop::jsonToPropertyValuesVector(const char aNodeValue = rPair.second.get_child("value", aNodeNull); if (aNodeValue != aNodeNull && !aNodeValue.empty()) { - sal_Int32 itSeq = 0; uno::Sequence< uno::Any > aSeq(aNodeValue.size()); - for (const auto& rSeqPair : aNodeValue) - aSeq[itSeq++] = jsonToUnoAny(rSeqPair.second); + std::transform(aNodeValue.begin(), aNodeValue.end(), aSeq.getArray(), + [](const auto& rSeqPair) + { return jsonToUnoAny(rSeqPair.second); }); aValue.Value <<= aSeq; } } @@ -2557,11 +2558,7 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis, Application::SetDialogCancelMode(DialogCancelMode::LOKSilent); } - uno::Sequence<css::beans::PropertyValue> aFilterOptions(3); - aFilterOptions[0] = css::beans::PropertyValue( "FilterOptions", - 0, - uno::makeAny(aOptions), - beans::PropertyState_DIRECT_VALUE); + const OUString sFilterOptions = aOptions; rtl::Reference<LOKInteractionHandler> const pInteraction( new LOKInteractionHandler("load", pLib)); @@ -2573,8 +2570,6 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis, } }); uno::Reference<task::XInteractionHandler2> const xInteraction(pInteraction); - aFilterOptions[1].Name = "InteractionHandler"; - aFilterOptions[1].Value <<= xInteraction; int nMacroSecurityLevel = 1; const OUString aMacroSecurityLevel = extractParameter(aOptions, u"MacroSecurityLevel"); @@ -2595,8 +2590,12 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis, sal_Int16 nMacroExecMode = aEnableMacrosExecution == "true" ? document::MacroExecMode::USE_CONFIG : document::MacroExecMode::NEVER_EXECUTE; #endif - aFilterOptions[2].Name = "MacroExecutionMode"; - aFilterOptions[2].Value <<= nMacroExecMode; + + uno::Sequence<css::beans::PropertyValue> aFilterOptions{ + comphelper::makePropertyValue("FilterOptions", sFilterOptions), + comphelper::makePropertyValue("InteractionHandler", xInteraction), + comphelper::makePropertyValue("MacroExecutionMode", nMacroExecMode) + }; /* TODO sal_Int16 nUpdateDoc = document::UpdateDocMode::ACCORDING_TO_CONFIG; diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx index 41f46e854164..b4de36c56578 100644 --- a/desktop/source/lib/lokclipboard.cxx +++ b/desktop/source/lib/lokclipboard.cxx @@ -137,7 +137,7 @@ LOKTransferable::LOKTransferable(const OUString& sMimeType, { m_aContent.reserve(1); m_aFlavors = css::uno::Sequence<css::datatransfer::DataFlavor>(1); - initFlavourFromMime(m_aFlavors[0], sMimeType); + initFlavourFromMime(m_aFlavors.getArray()[0], sMimeType); uno::Any aContent; if (m_aFlavors[0].DataType == cppu::UnoType<OUString>::get()) @@ -155,7 +155,7 @@ LOKTransferable::LOKTransferable() { m_aContent.reserve(1); m_aFlavors = css::uno::Sequence<css::datatransfer::DataFlavor>(1); - initFlavourFromMime(m_aFlavors[0], "text/plain"); + initFlavourFromMime(m_aFlavors.getArray()[0], "text/plain"); uno::Any aContent; aContent <<= OUString(); m_aContent.push_back(aContent); @@ -183,9 +183,10 @@ LOKTransferable::LOKTransferable(const size_t nInCount, const char** pInMimeType { m_aContent.reserve(nInCount); m_aFlavors = css::uno::Sequence<css::datatransfer::DataFlavor>(nInCount); + auto p_aFlavors = m_aFlavors.getArray(); for (size_t i = 0; i < nInCount; ++i) { - initFlavourFromMime(m_aFlavors[i], OUString::fromUtf8(pInMimeTypes[i])); + initFlavourFromMime(p_aFlavors[i], OUString::fromUtf8(pInMimeTypes[i])); uno::Any aContent; if (m_aFlavors[i].DataType == cppu::UnoType<OUString>::get()) diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index d920cb40ff3f..c846eaa673fd 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -751,9 +751,10 @@ void MigrationImpl::runServices() { // Build argument array uno::Sequence< uno::Any > seqArguments(3); - seqArguments[0] <<= NamedValue("Productname", + auto pseqArguments = seqArguments.getArray(); + pseqArguments[0] <<= NamedValue("Productname", uno::makeAny(m_aInfo.productname)); - seqArguments[1] <<= NamedValue("UserData", + pseqArguments[1] <<= NamedValue("UserData", uno::makeAny(m_aInfo.userdata)); @@ -773,7 +774,7 @@ void MigrationImpl::runServices() if ( nSize > 0 ) seqExtDenyList = comphelper::arrayToSequence< OUString >( rMigration.excludeExtensions.data(), nSize ); - seqArguments[2] <<= NamedValue("ExtensionDenyList", + pseqArguments[2] <<= NamedValue("ExtensionDenyList", uno::makeAny( seqExtDenyList )); xMigrationJob.set( @@ -1065,7 +1066,9 @@ void NewVersionUIInfo::init(const std::vector< MigrationModuleInfo >& vModulesIn { m_lCfgManagerSeq.resize(vModulesInfo.size()); m_lNewVersionMenubarSettingsSeq.realloc(vModulesInfo.size()); + auto p_lNewVersionMenubarSettingsSeq = m_lNewVersionMenubarSettingsSeq.getArray(); m_lNewVersionToolbarSettingsSeq.realloc(vModulesInfo.size()); + auto p_lNewVersionToolbarSettingsSeq = m_lNewVersionToolbarSettingsSeq.getArray(); static const OUStringLiteral sMenubarResourceURL(u"private:resource/menubar/menubar"); static const OUStringLiteral sToolbarResourcePre(u"private:resource/toolbar/"); @@ -1080,23 +1083,24 @@ void NewVersionUIInfo::init(const std::vector< MigrationModuleInfo >& vModulesIn m_lCfgManagerSeq[i].Value <<= xCfgManager; if (vModulesInfo[i].bHasMenubar) { - m_lNewVersionMenubarSettingsSeq[i].Name = vModulesInfo[i].sModuleShortName; - m_lNewVersionMenubarSettingsSeq[i].Value <<= xCfgManager->getSettings(sMenubarResourceURL, true); + p_lNewVersionMenubarSettingsSeq[i].Name = vModulesInfo[i].sModuleShortName; + p_lNewVersionMenubarSettingsSeq[i].Value <<= xCfgManager->getSettings(sMenubarResourceURL, true); } sal_Int32 nToolbars = vModulesInfo[i].m_vToolbars.size(); if (nToolbars > 0) { uno::Sequence< beans::PropertyValue > lPropSeq(nToolbars); + auto plPropSeq = lPropSeq.getArray(); for (sal_Int32 j=0; j<nToolbars; ++j) { OUString sToolbarName = vModulesInfo[i].m_vToolbars[j]; OUString sToolbarResourceURL = sToolbarResourcePre + sToolbarName; - lPropSeq[j].Name = sToolbarName; - lPropSeq[j].Value <<= xCfgManager->getSettings(sToolbarResourceURL, true); + plPropSeq[j].Name = sToolbarName; + plPropSeq[j].Value <<= xCfgManager->getSettings(sToolbarResourceURL, true); } - m_lNewVersionToolbarSettingsSeq[i].Name = vModulesInfo[i].sModuleShortName; - m_lNewVersionToolbarSettingsSeq[i].Value <<= lPropSeq; + p_lNewVersionToolbarSettingsSeq[i].Name = vModulesInfo[i].sModuleShortName; + p_lNewVersionToolbarSettingsSeq[i].Value <<= lPropSeq; } } } |