diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-29 09:37:07 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-30 08:02:23 +0200 |
commit | 9265b53978e1ed5a61db9941b5661b88d0efd31b (patch) | |
tree | 1915de28c381bddc457e23b984be4dbc8bd2bf9e /extensions | |
parent | 04a2e941cf976894bb69e4d2e1d946a5e513225b (diff) |
Prepare for removal of non-const operator[] from Sequence in extensions
Change-Id: Id57b187aaa669d4b9a35ab726a6df1a9b4823f1d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124364
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'extensions')
29 files changed, 111 insertions, 136 deletions
diff --git a/extensions/qa/update/test_update.cxx b/extensions/qa/update/test_update.cxx index f99855dc6198..27d634b3b374 100644 --- a/extensions/qa/update/test_update.cxx +++ b/extensions/qa/update/test_update.cxx @@ -37,8 +37,7 @@ public: m_xProvider = deployment::UpdateInformationProvider::create( m_xContext ); // repositories that we will be checking - m_aRepositoryList.realloc( 1 ); - m_aRepositoryList[0] = m_directories.getURLFromSrc( u"/extensions/qa/update/simple.xml" ); + m_aRepositoryList = { m_directories.getURLFromSrc( u"/extensions/qa/update/simple.xml" ) }; } virtual void tearDown() override diff --git a/extensions/source/abpilot/unodialogabp.cxx b/extensions/source/abpilot/unodialogabp.cxx index a9836d910535..dd878f03e5c3 100644 --- a/extensions/source/abpilot/unodialogabp.cxx +++ b/extensions/source/abpilot/unodialogabp.cxx @@ -105,8 +105,8 @@ namespace abp { Reference<awt::XWindow> xParentWindow; if (aArguments.getLength() == 1 && (aArguments[0] >>= xParentWindow) ) { - Sequence< Any > aNewArgs(1); - aNewArgs[0] <<= PropertyValue( "ParentWindow", 0, makeAny(xParentWindow), PropertyState_DIRECT_VALUE ); + Sequence< Any > aNewArgs{ Any(PropertyValue( + "ParentWindow", 0, makeAny(xParentWindow), PropertyState_DIRECT_VALUE )) }; OGenericUnoDialog::initialize(aNewArgs); } else { OGenericUnoDialog::initialize(aArguments); diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx index 8c1d6eefddc3..1c5f85c03f35 100644 --- a/extensions/source/bibliography/framectr.cxx +++ b/extensions/source/bibliography/framectr.cxx @@ -263,19 +263,18 @@ uno::Reference< frame::XDispatch > BibFrameController_Impl::queryDispatch( cons uno::Sequence<uno::Reference< XDispatch > > BibFrameController_Impl::queryDispatches( const uno::Sequence<DispatchDescriptor>& aDescripts ) { uno::Sequence< uno::Reference< XDispatch > > aDispatches( aDescripts.getLength() ); + auto aDispatchesRange = asNonConstRange(aDispatches); for ( sal_Int32 i=0; i<aDescripts.getLength(); ++i ) - aDispatches[i] = queryDispatch( aDescripts[i].FeatureURL, aDescripts[i].FrameName, aDescripts[i].SearchFlags ); + aDispatchesRange[i] = queryDispatch( aDescripts[i].FeatureURL, aDescripts[i].FrameName, aDescripts[i].SearchFlags ); return aDispatches; } uno::Sequence< ::sal_Int16 > SAL_CALL BibFrameController_Impl::getSupportedCommandGroups() { - uno::Sequence< ::sal_Int16 > aDispatchInfo( 4 ); - - aDispatchInfo[0] = frame::CommandGroup::EDIT; - aDispatchInfo[1] = frame::CommandGroup::DOCUMENT; - aDispatchInfo[2] = frame::CommandGroup::DATA; - aDispatchInfo[3] = frame::CommandGroup::VIEW; + uno::Sequence< ::sal_Int16 > aDispatchInfo{ frame::CommandGroup::EDIT, + frame::CommandGroup::DOCUMENT, + frame::CommandGroup::DATA, + frame::CommandGroup::VIEW }; return aDispatchInfo; } diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx index ad3a8c957b66..5fd46955c54a 100644 --- a/extensions/source/bibliography/general.cxx +++ b/extensions/source/bibliography/general.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/uri/UriReferenceFactory.hpp> +#include <o3tl/safeint.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <cppuhelper/implbase.hxx> #include <vcl/event.hxx> @@ -673,8 +674,7 @@ namespace return; m_bSelfChanging = true; - Sequence<sal_Int16> aSelection(1); - aSelection[0] = m_rComboBox.get_active(); + Sequence<sal_Int16> aSelection{ o3tl::narrowing<sal_Int16>(m_rComboBox.get_active()) }; m_xPropSet->setPropertyValue("SelectedItems", makeAny(aSelection)); css::uno::Reference<css::form::XBoundComponent> xBound(m_xPropSet, css::uno::UNO_QUERY); diff --git a/extensions/source/config/ldap/ldapuserprofilebe.cxx b/extensions/source/config/ldap/ldapuserprofilebe.cxx index 8be633a4ca3e..9ed6a115e2b7 100644 --- a/extensions/source/config/ldap/ldapuserprofilebe.cxx +++ b/extensions/source/config/ldap/ldapuserprofilebe.cxx @@ -96,8 +96,7 @@ bool LdapUserProfileBe::readLdapConfiguration( css::beans::NamedValue aPath("nodepath", uno::makeAny(OUString("org.openoffice.LDAP/UserDirectory")) ); - uno::Sequence< uno::Any > aArgs(1); - aArgs[0] <<= aPath; + uno::Sequence< uno::Any > aArgs{ uno::Any(aPath) }; xIface = xCfgProvider->createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", aArgs); diff --git a/extensions/source/logging/loggerconfig.cxx b/extensions/source/logging/loggerconfig.cxx index 4fd183099544..2ad97cc311b5 100644 --- a/extensions/source/logging/loggerconfig.cxx +++ b/extensions/source/logging/loggerconfig.cxx @@ -191,8 +191,7 @@ namespace logging bool bSuccess = false; if ( aSettings.hasElements() ) { - Sequence< Any > aConstructionArgs(1); - aConstructionArgs[0] <<= aSettings; + Sequence< Any > aConstructionArgs{ Any(aSettings) }; xInstance = _rContext->getServiceManager()->createInstanceWithArgumentsAndContext(sServiceName, aConstructionArgs, _rContext); bSuccess = xInstance.is(); } @@ -222,11 +221,8 @@ namespace logging css::configuration::theDefaultProvider::get(_rContext)); // write access to the "Settings" node (which includes settings for all loggers) - Sequence< Any > aArguments(1); - aArguments[0] <<= NamedValue( - "nodepath", - makeAny( OUString( "/org.openoffice.Office.Logging/Settings" ) ) - ); + Sequence<Any> aArguments{ Any(NamedValue( + "nodepath", makeAny(OUString("/org.openoffice.Office.Logging/Settings")))) }; Reference< XNameContainer > xAllSettings( xConfigProvider->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationUpdateAccess", aArguments diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx index ba33772c171a..85f410c54604 100644 --- a/extensions/source/ole/oleobjw.cxx +++ b/extensions/source/ole/oleobjw.cxx @@ -1018,7 +1018,9 @@ Any IUnknownWrapper::invokeWithDispIdUnoTlb(const OUString& sFunctionName, if( outParameterCount && pMethod) { OutParamIndex.realloc( outParameterCount); + auto pOutParamIndex = OutParamIndex.getArray(); OutParam.realloc( outParameterCount); + auto pOutParam = OutParam.getArray(); sal_Int32 outIndex=0; int i = 0; try @@ -1027,13 +1029,13 @@ Any IUnknownWrapper::invokeWithDispIdUnoTlb(const OUString& sFunctionName, { if( pMethod->pParams[i].bOut ) { - OutParamIndex[outIndex]= static_cast<sal_Int16>(i); + pOutParamIndex[outIndex]= static_cast<sal_Int16>(i); Any outAny; if( !bJScriptObject) { variantToAny( &pVarParamsRef[outIndex], outAny, Type(pMethod->pParams[i].pTypeRef), false); - OutParam[outIndex++]= outAny; + pOutParam[outIndex++]= outAny; } else //JScriptObject { @@ -1047,7 +1049,7 @@ Any IUnknownWrapper::invokeWithDispIdUnoTlb(const OUString& sFunctionName, { variantToAny( &varOut, outAny, Type(pMethod->pParams[parameterCount - 1 - i].pTypeRef), false); - OutParam[outParameterCount - 1 - outIndex++]= outAny; + pOutParam[outParameterCount - 1 - outIndex++]= outAny; } else bConvRet= false; @@ -1985,6 +1987,8 @@ Any IUnknownWrapper::invokeWithDispIdComTlb(FuncDesc& aFuncDesc, // Convert out params if (outParamsCount) { + auto pOutParamIndex = OutParamIndex.getArray(); + auto pOutParam = OutParam.getArray(); int outParamIndex=0; for (int paramIndex = 0; paramIndex < nUnoArgs; paramIndex ++) { @@ -2021,8 +2025,8 @@ Any IUnknownWrapper::invokeWithDispIdComTlb(FuncDesc& aFuncDesc, e.ArgumentIndex = paramIndex; throw; } - OutParam[outParamIndex] = outAny; - OutParamIndex[outParamIndex] = ::sal::static_int_cast< sal_Int16, int >( paramIndex ); + pOutParam[outParamIndex] = outAny; + pOutParamIndex[outParamIndex] = ::sal::static_int_cast< sal_Int16, int >( paramIndex ); outParamIndex++; } OutParam.realloc(outParamIndex); diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx index 338d85b622da..6cf3dc961731 100644 --- a/extensions/source/ole/unoconversionutilities.hxx +++ b/extensions/source/ole/unoconversionutilities.hxx @@ -1280,7 +1280,7 @@ void UnoConversionUtilities<T>::getElementCountAndTypeOfSequence( const Any& rS { sal_Int32 dimCount= (*static_cast<uno_Sequence* const *>(rSeq.getValue()))->nElements; if( dimCount > seqElementCounts[ dim-1]) - seqElementCounts[ dim-1]= dimCount; + seqElementCounts.getArray()[ dim-1]= dimCount; // we need the element type to construct the any that is // passed into getElementCountAndTypeOfSequence again @@ -2331,11 +2331,12 @@ Sequence<Type> UnoConversionUtilities<T>::getImplementedInterfaces(IUnknown* pUn if( anyNames >>= seqAny) { seqTypes.realloc( seqAny.getLength()); + auto pseqTypes = seqTypes.getArray(); for( sal_Int32 i=0; i < seqAny.getLength(); i++) { OUString typeName; seqAny[i] >>= typeName; - seqTypes[i]= Type( TypeClass_INTERFACE, typeName); + pseqTypes[i]= Type( TypeClass_INTERFACE, typeName); } } } diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx index 81fbae1a0aca..034d7cec62a1 100644 --- a/extensions/source/ole/unoobjw.cxx +++ b/extensions/source/ole/unoobjw.cxx @@ -2326,6 +2326,7 @@ Sink::Call( const OUString& Method, Sequence< Any >& Arguments ) aMethods.getLength() > 0); int nMemId = 1; + auto ArgumentsRange = asNonConstRange(Arguments); // Skip the three XInterface methods for (int i = 3; i < aMethods.getLength(); i++) { @@ -2419,21 +2420,21 @@ Sink::Call( const OUString& Method, Sequence< Any >& Arguments ) case VT_BYREF|VT_I2: { SHORT *pI = static_cast<SHORT*>(aDispParams.rgvarg[j].byref); - Arguments[nIncomingArgIndex] <<= static_cast<sal_Int16>(*pI); + ArgumentsRange[nIncomingArgIndex] <<= static_cast<sal_Int16>(*pI); delete pI; } break; case VT_BYREF|VT_I4: { LONG *pL = static_cast<LONG*>(aDispParams.rgvarg[j].byref); - Arguments[nIncomingArgIndex] <<= static_cast<sal_Int32>(*pL); + ArgumentsRange[nIncomingArgIndex] <<= static_cast<sal_Int32>(*pL); delete pL; } break; case VT_BYREF|VT_BSTR: { BSTR *pBstr = static_cast<BSTR*>(aDispParams.rgvarg[j].byref); - Arguments[nIncomingArgIndex] <<= OUString(o3tl::toU(*pBstr)); + ArgumentsRange[nIncomingArgIndex] <<= OUString(o3tl::toU(*pBstr)); // Undo SysAllocString() done in anyToVariant() SysFreeString(*pBstr); delete pBstr; @@ -2443,7 +2444,7 @@ Sink::Call( const OUString& Method, Sequence< Any >& Arguments ) { VARIANT_BOOL *pBool = static_cast<VARIANT_BOOL*>(aDispParams.rgvarg[j].byref); // SAL_ DEBUG("===> VT_BOOL: byref is now " << aDispParams.rgvarg[j].byref << ", " << (int)*pBool); - Arguments[nIncomingArgIndex] <<= (*pBool != VARIANT_FALSE); + ArgumentsRange[nIncomingArgIndex] <<= (*pBool != VARIANT_FALSE); delete pBool; } break; diff --git a/extensions/source/propctrlr/browserline.cxx b/extensions/source/propctrlr/browserline.cxx index d4770ba3e5d1..a42b63c10e9b 100644 --- a/extensions/source/propctrlr/browserline.cxx +++ b/extensions/source/propctrlr/browserline.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/graphic/XGraphicProvider.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/string.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> @@ -314,9 +315,7 @@ namespace pcr Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); Reference< XGraphicProvider > xGraphicProvider( GraphicProvider::create(xContext) ); - Sequence< PropertyValue > aMediaProperties(1); - aMediaProperties[0].Name = "URL"; - aMediaProperties[0].Value <<= rImageURL; + Sequence aMediaProperties{ comphelper::makePropertyValue("URL", rImageURL) }; xGraphic = Reference<XGraphic>(xGraphicProvider->queryGraphic(aMediaProperties), css::uno::UNO_SET_THROW); } diff --git a/extensions/source/propctrlr/buttonnavigationhandler.cxx b/extensions/source/propctrlr/buttonnavigationhandler.cxx index dc5b8d521c94..618d9db46b86 100644 --- a/extensions/source/propctrlr/buttonnavigationhandler.cxx +++ b/extensions/source/propctrlr/buttonnavigationhandler.cxx @@ -183,9 +183,7 @@ namespace pcr Sequence< OUString > SAL_CALL ButtonNavigationHandler::getActuatingProperties( ) { - Sequence< OUString > aActuating( 2 ); - aActuating[0] = PROPERTY_BUTTONTYPE; - aActuating[1] = PROPERTY_TARGET_URL; + Sequence< OUString > aActuating{ PROPERTY_BUTTONTYPE, PROPERTY_TARGET_URL }; return aActuating; } diff --git a/extensions/source/propctrlr/cellbindinghandler.cxx b/extensions/source/propctrlr/cellbindinghandler.cxx index d73d8cfeeb8a..32517a6c4be9 100644 --- a/extensions/source/propctrlr/cellbindinghandler.cxx +++ b/extensions/source/propctrlr/cellbindinghandler.cxx @@ -81,10 +81,9 @@ namespace pcr Sequence< OUString > SAL_CALL CellBindingPropertyHandler::getActuatingProperties( ) { - Sequence< OUString > aInterestingProperties( 3 ); - aInterestingProperties[0] = PROPERTY_LIST_CELL_RANGE; - aInterestingProperties[1] = PROPERTY_BOUND_CELL; - aInterestingProperties[2] = PROPERTY_CONTROLSOURCE; + Sequence< OUString > aInterestingProperties{ PROPERTY_LIST_CELL_RANGE, + PROPERTY_BOUND_CELL, + PROPERTY_CONTROLSOURCE }; return aInterestingProperties; } diff --git a/extensions/source/propctrlr/cellbindinghelper.cxx b/extensions/source/propctrlr/cellbindinghelper.cxx index 90dd8b77277b..e2bc47f16cc2 100644 --- a/extensions/source/propctrlr/cellbindinghelper.cxx +++ b/extensions/source/propctrlr/cellbindinghelper.cxx @@ -264,13 +264,7 @@ namespace pcr { if ( !_rArgumentName.isEmpty() ) { - NamedValue aArg; - aArg.Name = _rArgumentName; - aArg.Value = _rArgumentValue; - - Sequence< Any > aArgs( 1 ); - aArgs[ 0 ] <<= aArg; - + Sequence aArgs{ Any(NamedValue(_rArgumentName, _rArgumentValue)) }; xReturn = xDocumentFactory->createInstanceWithArguments( _rService, aArgs ); } else diff --git a/extensions/source/propctrlr/controlfontdialog.cxx b/extensions/source/propctrlr/controlfontdialog.cxx index 436770e60316..a4fa97881085 100644 --- a/extensions/source/propctrlr/controlfontdialog.cxx +++ b/extensions/source/propctrlr/controlfontdialog.cxx @@ -21,6 +21,8 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include "controlfontdialog.hxx" + +#include <comphelper/propertyvalue.hxx> #include <vcl/svapp.hxx> #include "fontdialog.hxx" #include "formstrings.hxx" @@ -80,11 +82,8 @@ namespace pcr Reference<XPropertySet> xGridModel; if (aArguments.getLength() == 1 && (aArguments[0] >>= xGridModel)) { - PropertyValue aArg; - aArg.Name = "IntrospectedObject"; - aArg.Value <<= xGridModel; - Sequence< Any > aNewArguments(1); - aNewArguments[0] <<= aArg; + Sequence aNewArguments{ Any(comphelper::makePropertyValue("IntrospectedObject", + xGridModel)) }; OControlFontDialog_DBase::initialize(aNewArguments); } else diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx index b920a4262650..75a37e9c0dd0 100644 --- a/extensions/source/propctrlr/eventhandler.cxx +++ b/extensions/source/propctrlr/eventhandler.cxx @@ -51,6 +51,7 @@ #include <comphelper/namedvaluecollection.hxx> #include <comphelper/evtmethodhelper.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include <comphelper/types.hxx> #include <cppuhelper/implbase.hxx> @@ -375,11 +376,10 @@ namespace pcr { ScriptEventDescriptor aDescriptor( impl_getDescriptor_throw( _rName ) ); - Sequence< PropertyValue > aScriptDescriptor( 2 ); - aScriptDescriptor[0].Name = "EventType"; - aScriptDescriptor[0].Value <<= aDescriptor.ScriptType; - aScriptDescriptor[1].Name = "Script"; - aScriptDescriptor[1].Value <<= aDescriptor.ScriptCode; + Sequence< PropertyValue > aScriptDescriptor{ + comphelper::makePropertyValue("EventType", aDescriptor.ScriptType), + comphelper::makePropertyValue("Script", aDescriptor.ScriptCode) + }; return makeAny( aScriptDescriptor ); } diff --git a/extensions/source/propctrlr/formcontroller.cxx b/extensions/source/propctrlr/formcontroller.cxx index e6be69492f2c..6e94aa0d1eb3 100644 --- a/extensions/source/propctrlr/formcontroller.cxx +++ b/extensions/source/propctrlr/formcontroller.cxx @@ -108,7 +108,7 @@ namespace pcr { Sequence< OUString > aSupported( m_aSupportedServiceNames ); aSupported.realloc( aSupported.getLength() + 1 ); - aSupported[ aSupported.getLength() - 1 ] = "com.sun.star.inspection.ObjectInspector"; + aSupported.getArray()[ aSupported.getLength() - 1 ] = "com.sun.star.inspection.ObjectInspector"; return aSupported; } @@ -127,19 +127,20 @@ namespace pcr ::cppu::IPropertyArrayHelper* FormController::createArrayHelper( ) const { - Sequence< Property > aProps( 2 ); - aProps[0] = Property( - PROPERTY_CURRENTPAGE, - OWN_PROPERTY_ID_CURRENTPAGE, - ::cppu::UnoType<OUString>::get(), - PropertyAttribute::TRANSIENT - ); - aProps[1] = Property( - PROPERTY_INTROSPECTEDOBJECT, - OWN_PROPERTY_ID_INTROSPECTEDOBJECT, - cppu::UnoType<XPropertySet>::get(), - PropertyAttribute::TRANSIENT | PropertyAttribute::CONSTRAINED - ); + Sequence< Property > aProps{ + Property( + PROPERTY_CURRENTPAGE, + OWN_PROPERTY_ID_CURRENTPAGE, + ::cppu::UnoType<OUString>::get(), + PropertyAttribute::TRANSIENT + ), + Property( + PROPERTY_INTROSPECTEDOBJECT, + OWN_PROPERTY_ID_INTROSPECTEDOBJECT, + cppu::UnoType<XPropertySet>::get(), + PropertyAttribute::TRANSIENT | PropertyAttribute::CONSTRAINED + ) + }; return new ::cppu::OPropertyArrayHelper( aProps ); } @@ -179,8 +180,7 @@ namespace pcr Sequence< Reference< XInterface > > aObjects; if ( m_xCurrentInspectee.is() ) { - aObjects.realloc( 1 ); - aObjects[0] = m_xCurrentInspectee; + aObjects = { m_xCurrentInspectee }; } Reference< XObjectInspector > xInspector( *this, UNO_QUERY_THROW ); diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx index 485c6937c2f6..014b4cf55f0f 100644 --- a/extensions/source/propctrlr/genericpropertyhandler.cxx +++ b/extensions/source/propctrlr/genericpropertyhandler.cxx @@ -36,6 +36,7 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <comphelper/extract.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include <comphelper/types.hxx> #include <tools/debug.hxx> @@ -248,9 +249,7 @@ namespace pcr Reference< XDesktop2 > xDispProv = Desktop::create( m_xContext ); Reference< XDispatch > xDispatch( xDispProv->queryDispatch( aURL, OUString(), 0 ), UNO_SET_THROW ); - Sequence< PropertyValue > aDispatchArgs(1); - aDispatchArgs[0].Name = "URL"; - aDispatchArgs[0].Value <<= _rURL; + Sequence aDispatchArgs{ comphelper::makePropertyValue("URL", _rURL) }; xDispatch->dispatch( aURL, aDispatchArgs ); } diff --git a/extensions/source/propctrlr/objectinspectormodel.cxx b/extensions/source/propctrlr/objectinspectormodel.cxx index c0f6bf6b703e..adad6e66f27b 100644 --- a/extensions/source/propctrlr/objectinspectormodel.cxx +++ b/extensions/source/propctrlr/objectinspectormodel.cxx @@ -152,8 +152,7 @@ namespace pcr void ObjectInspectorModel::createDefault() { - m_aFactories.realloc( 1 ); - m_aFactories[0] <<= OUString( "com.sun.star.inspection.GenericPropertyHandler" ); + m_aFactories = { Any(OUString( "com.sun.star.inspection.GenericPropertyHandler" )) }; } diff --git a/extensions/source/propctrlr/pcrunodialogs.cxx b/extensions/source/propctrlr/pcrunodialogs.cxx index 2c6113647855..d3f1e81190d3 100644 --- a/extensions/source/propctrlr/pcrunodialogs.cxx +++ b/extensions/source/propctrlr/pcrunodialogs.cxx @@ -111,19 +111,20 @@ namespace pcr Reference<css::awt::XWindow> xParentWindow; if (aArguments.getLength() == 3 && (aArguments[0] >>= xTabbingModel) && (aArguments[1] >>= xControlContext) && (aArguments[2] >>= xParentWindow)) { - Sequence< Any > aNewArguments( 3 ); - aNewArguments[0] <<= NamedValue( - "TabbingModel", - makeAny( xTabbingModel ) - ); - aNewArguments[1] <<= NamedValue( - "ControlContext", - makeAny( xControlContext ) - ); - aNewArguments[2] <<= NamedValue( - "ParentWindow", - makeAny( xParentWindow ) - ); + Sequence< Any > aNewArguments{ + Any(NamedValue( + "TabbingModel", + makeAny( xTabbingModel ) + )), + Any(NamedValue( + "ControlContext", + makeAny( xControlContext ) + )), + Any(NamedValue( + "ParentWindow", + makeAny( xParentWindow ) + )) + }; OTabOrderDialog_DBase::initialize(aNewArguments); } else diff --git a/extensions/source/propctrlr/sqlcommanddesign.cxx b/extensions/source/propctrlr/sqlcommanddesign.cxx index c5bd8a34c749..73e205be4ed0 100644 --- a/extensions/source/propctrlr/sqlcommanddesign.cxx +++ b/extensions/source/propctrlr/sqlcommanddesign.cxx @@ -37,6 +37,7 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/sdb/CommandType.hpp> +#include <comphelper/propertyvalue.hxx> #include <tools/diagnose_ex.h> #include <osl/diagnose.h> @@ -221,19 +222,14 @@ namespace pcr // thus, we create a blank frame at the desktop, remove it from the desktop's frame list // immediately, and then load the component into this blank (and now parent-less) frame Reference< XComponentLoader > xLoader( impl_createEmptyParentlessTask_nothrow(), UNO_QUERY_THROW ); - Sequence< PropertyValue > aArgs( 5 ); - aArgs[0].Name = PROPERTY_ACTIVE_CONNECTION; - aArgs[0].Value <<= m_xConnection.getTyped(); - - aArgs[1].Name = PROPERTY_COMMAND; - aArgs[1].Value <<= m_xObjectAdapter->getSQLCommand(); - aArgs[2].Name = PROPERTY_COMMANDTYPE; - aArgs[2].Value <<= sal_Int32(CommandType::COMMAND); - aArgs[3].Name = PROPERTY_ESCAPE_PROCESSING; - aArgs[3].Value <<= m_xObjectAdapter->getEscapeProcessing(); - - aArgs[4].Name = "GraphicalDesign"; - aArgs[4].Value <<= m_xObjectAdapter->getEscapeProcessing(); + const bool bEscapeProcessing = m_xObjectAdapter->getEscapeProcessing(); + Sequence< PropertyValue > aArgs{ + comphelper::makePropertyValue(PROPERTY_ACTIVE_CONNECTION, m_xConnection.getTyped()), + comphelper::makePropertyValue(PROPERTY_COMMAND, m_xObjectAdapter->getSQLCommand()), + comphelper::makePropertyValue(PROPERTY_COMMANDTYPE, CommandType::COMMAND), + comphelper::makePropertyValue(PROPERTY_ESCAPE_PROCESSING, bEscapeProcessing), + comphelper::makePropertyValue("GraphicalDesign", bEscapeProcessing) + }; Reference< XComponent > xQueryDesign = xLoader->loadComponentFromURL( ".component:DB/QueryDesign", diff --git a/extensions/source/propctrlr/stringrepresentation.cxx b/extensions/source/propctrlr/stringrepresentation.cxx index da468e5b51ef..83befe2039d3 100644 --- a/extensions/source/propctrlr/stringrepresentation.cxx +++ b/extensions/source/propctrlr/stringrepresentation.cxx @@ -345,7 +345,7 @@ namespace do { _out_SplitUp.realloc( _out_SplitUp.getLength() + 1 ); - _out_SplitUp[ _out_SplitUp.getLength() - 1 ] = static_cast<ElementType>(_rTransformer( _rComposed.getToken( 0, '\n', tokenPos ) )); + _out_SplitUp.getArray()[ _out_SplitUp.getLength() - 1 ] = static_cast<ElementType>(_rTransformer( _rComposed.getToken( 0, '\n', tokenPos ) )); } while ( tokenPos != -1 ); } diff --git a/extensions/source/propctrlr/submissionhandler.cxx b/extensions/source/propctrlr/submissionhandler.cxx index 3d2dfeff4ee2..87609e905e74 100644 --- a/extensions/source/propctrlr/submissionhandler.cxx +++ b/extensions/source/propctrlr/submissionhandler.cxx @@ -216,10 +216,9 @@ namespace pcr if (!m_pHelper) return Sequence< OUString >(); - Sequence< OUString > aReturn( 3 ); - aReturn[ 0 ] = PROPERTY_TARGET_URL; - aReturn[ 1 ] = PROPERTY_TARGET_FRAME; - aReturn[ 2 ] = PROPERTY_BUTTONTYPE; + Sequence< OUString > aReturn{ PROPERTY_TARGET_URL, + PROPERTY_TARGET_FRAME, + PROPERTY_BUTTONTYPE }; return aReturn; } diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx index 44787d46d0e6..b06e30a2794a 100644 --- a/extensions/source/scanner/scanunx.cxx +++ b/extensions/source/scanner/scanunx.cxx @@ -224,9 +224,7 @@ Sequence< ScannerContext > ScannerManager::getAvailableScanners() if( Sane::IsSane() ) { - Sequence< ScannerContext > aRet(1); - aRet[0].ScannerName = "SANE"; - aRet[0].InternalData = 0; + Sequence< ScannerContext > aRet{ { /* ScannerName */ "SANE", /* InternalData */ 0 } }; return aRet; } diff --git a/extensions/source/update/check/download.cxx b/extensions/source/update/check/download.cxx index 905d16e99a7f..387c1efd7a4f 100644 --- a/extensions/source/update/check/download.cxx +++ b/extensions/source/update/check/download.cxx @@ -178,8 +178,7 @@ Download::getProxyForURL(std::u16string_view rURL, OString& rHost, sal_Int32& rP aProperty.Name = "nodepath"; aProperty.Value <<= OUString("org.openoffice.Inet/Settings"); - uno::Sequence< uno::Any > aArgumentList( 1 ); - aArgumentList[0] <<= aProperty; + uno::Sequence< uno::Any > aArgumentList{ uno::Any(aProperty) }; uno::Reference< container::XNameAccess > xNameAccess( xConfigProvider->createInstanceWithArguments( diff --git a/extensions/source/update/check/updatecheckconfig.cxx b/extensions/source/update/check/updatecheckconfig.cxx index 3c5f163b7226..30e444051e3f 100644 --- a/extensions/source/update/check/updatecheckconfig.cxx +++ b/extensions/source/update/check/updatecheckconfig.cxx @@ -226,8 +226,7 @@ UpdateCheckConfig::get( aProperty.Name = "nodepath"; aProperty.Value <<= OUString("org.openoffice.Office.Jobs/Jobs/UpdateCheck/Arguments"); - uno::Sequence< uno::Any > aArgumentList( 1 ); - aArgumentList[0] <<= aProperty; + uno::Sequence< uno::Any > aArgumentList{ uno::Any(aProperty) }; uno::Reference< container::XNameContainer > xContainer( xConfigProvider->createInstanceWithArguments( @@ -235,11 +234,11 @@ UpdateCheckConfig::get( uno::UNO_QUERY_THROW ); aProperty.Value <<= OUString("/org.openoffice.Office.ExtensionManager/ExtensionUpdateData/IgnoredUpdates"); - aArgumentList[0] <<= aProperty; + aArgumentList = { uno::Any(aProperty) }; uno::Reference< container::XNameContainer > xIgnoredExt( xConfigProvider->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationUpdateAccess", aArgumentList ), uno::UNO_QUERY_THROW ); aProperty.Value <<= OUString("/org.openoffice.Office.ExtensionManager/ExtensionUpdateData/AvailableUpdates"); - aArgumentList[0] <<= aProperty; + aArgumentList = { uno::Any(aProperty) }; uno::Reference< container::XNameContainer > xUpdateAvail( xConfigProvider->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationUpdateAccess", aArgumentList ), uno::UNO_QUERY_THROW ); return new UpdateCheckConfig( xContainer, xUpdateAvail, xIgnoredExt, rListener ); diff --git a/extensions/source/update/check/updatehdl.cxx b/extensions/source/update/check/updatehdl.cxx index 16b94d6c9db0..74f7b857828c 100644 --- a/extensions/source/update/check/updatehdl.cxx +++ b/extensions/source/update/check/updatehdl.cxx @@ -782,8 +782,7 @@ void UpdateHandler::setFullVersion( OUString& rString ) aProperty.Name = "nodepath"; aProperty.Value <<= OUString("org.openoffice.Setup/Product"); - uno::Sequence< uno::Any > aArgumentList( 1 ); - aArgumentList[0] <<= aProperty; + uno::Sequence< uno::Any > aArgumentList{ uno::Any(aProperty) }; uno::Reference< uno::XInterface > xConfigAccess = xConfigurationProvider->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", aArgumentList ); diff --git a/extensions/source/update/check/updateprotocol.cxx b/extensions/source/update/check/updateprotocol.cxx index a2da6a82c716..db8319c799df 100644 --- a/extensions/source/update/check/updateprotocol.cxx +++ b/extensions/source/update/check/updateprotocol.cxx @@ -61,8 +61,7 @@ getBootstrapData( if( !aValue.isEmpty() ) { - rRepositoryList.realloc(1); - rRepositoryList[0] = aValue; + rRepositoryList = { aValue }; } return true; diff --git a/extensions/source/update/feed/updatefeed.cxx b/extensions/source/update/feed/updatefeed.cxx index 142bd301cffa..c06328da7f79 100644 --- a/extensions/source/update/feed/updatefeed.cxx +++ b/extensions/source/update/feed/updatefeed.cxx @@ -302,8 +302,9 @@ UpdateInformationProvider::UpdateInformationProvider( uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider( css::configuration::theDefaultProvider::get(m_xContext)); - m_aRequestHeaderList[0].First = "Accept-Language"; - m_aRequestHeaderList[0].Second = getConfigurationItem( xConfigurationProvider, "org.openoffice.Setup/L10N", "ooLocale" ); + auto pRequestHeaderList = m_aRequestHeaderList.getArray(); + pRequestHeaderList[0].First = "Accept-Language"; + pRequestHeaderList[0].Second = getConfigurationItem( xConfigurationProvider, "org.openoffice.Setup/L10N", "ooLocale" ); } bool @@ -385,8 +386,9 @@ uno::Sequence< beans::StringPair > SAL_CALL UpdateInformationProvider::getUserRe aPair.realloc(1); else { - aPair[1].First = "User-Agent"; - aPair[1].Second = aUserAgent; + auto pPair = aPair.getArray(); + pPair[1].First = "User-Agent"; + pPair[1].Second = aUserAgent; } return aPair; @@ -403,9 +405,7 @@ UpdateInformationProvider::getConfigurationItemAny(uno::Reference<lang::XMultiSe aProperty.Name = "nodepath"; aProperty.Value <<= node; - uno::Sequence< uno::Any > aArgumentList( 1 ); - aArgumentList[0] <<= aProperty; - + uno::Sequence< uno::Any > aArgumentList{ uno::Any(aProperty) }; uno::Reference< container::XNameAccess > xNameAccess( configurationProvider->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx index fbed068c3b4d..6f7443700ec1 100644 --- a/extensions/source/update/ui/updatecheckui.cxx +++ b/extensions/source/update/ui/updatecheckui.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/graphic/XGraphicProvider.hpp> #include <com/sun/star/task/XJob.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <unotools/resmgr.hxx> #include <vcl/image.hxx> #include <vcl/menubarupdateicon.hxx> @@ -140,10 +141,8 @@ Image UpdateCheckUI::GetBubbleImage( OUString const &rURL ) try { uno::Reference< graphic::XGraphicProvider > xGraphProvider(graphic::GraphicProvider::create(xContext)); - uno::Sequence< beans::PropertyValue > aMediaProps( 1 ); - aMediaProps[0].Name = "URL"; - aMediaProps[0].Value <<= rURL; - + uno::Sequence< beans::PropertyValue > aMediaProps{ comphelper::makePropertyValue("URL", + rURL) }; uno::Reference< graphic::XGraphic > xGraphic = xGraphProvider->queryGraphic( aMediaProps ); if ( xGraphic.is() ) { |