dbaccess/qa/extras/dialog-save.cxx | 3 dbaccess/qa/extras/empty-stdlib-save.cxx | 3 dbaccess/qa/extras/nolib-save.cxx | 3 dbaccess/source/core/api/FilteredContainer.cxx | 15 +--- dbaccess/source/core/api/KeySet.cxx | 3 dbaccess/source/core/dataaccess/ContentHelper.cxx | 25 +++---- dbaccess/source/core/dataaccess/ModelImpl.cxx | 9 -- dbaccess/source/core/dataaccess/connection.cxx | 5 - dbaccess/source/core/dataaccess/databasedocument.cxx | 23 ++---- dbaccess/source/core/dataaccess/datasource.cxx | 34 +++++---- dbaccess/source/core/dataaccess/documentcontainer.cxx | 7 -- dbaccess/source/core/dataaccess/documentdefinition.cxx | 16 ++-- dbaccess/source/core/dataaccess/intercept.cxx | 25 +++---- dbaccess/source/core/misc/DatabaseDataProvider.cxx | 5 - dbaccess/source/filter/hsqldb/rowinputbinary.cxx | 4 - dbaccess/source/filter/xml/xmlDataSourceSetting.cxx | 2 dbaccess/source/filter/xml/xmlExport.cxx | 15 ++-- dbaccess/source/ui/app/AppController.cxx | 13 ++- dbaccess/source/ui/app/AppControllerGen.cxx | 7 +- dbaccess/source/ui/browser/formadapter.cxx | 3 dbaccess/source/ui/browser/sbagrid.cxx | 16 +--- dbaccess/source/ui/control/dbtreelistbox.cxx | 9 +- dbaccess/source/ui/dlg/ConnectionHelper.cxx | 6 - dbaccess/source/ui/dlg/paramdialog.cxx | 2 dbaccess/source/ui/dlg/queryfilter.cxx | 52 ++++----------- dbaccess/source/ui/dlg/tablespage.cxx | 5 - dbaccess/source/ui/misc/TokenWriter.cxx | 3 dbaccess/source/ui/misc/WCopyTable.cxx | 9 +- dbaccess/source/ui/misc/databaseobjectview.cxx | 19 +---- dbaccess/source/ui/misc/linkeddocuments.cxx | 34 ++++----- dbaccess/source/ui/misc/singledoccontroller.cxx | 6 + dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx | 6 - dbaccess/source/ui/querydesign/TableFieldDescription.cxx | 5 - dbaccess/source/ui/querydesign/TableWindowAccess.cxx | 3 dbaccess/source/ui/querydesign/limitboxcontroller.cxx | 6 - dbaccess/source/ui/querydesign/querycontroller.cxx | 8 +- dbaccess/source/ui/uno/textconnectionsettings_uno.cxx | 13 ++- 37 files changed, 185 insertions(+), 237 deletions(-)
New commits: commit 3412c0f091c54da74ea6964062b9be302e126fe9 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Fri Oct 29 08:14:44 2021 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Fri Oct 29 13:22:00 2021 +0200 Prepare for removal of non-const operator[] from Sequence in dbaccess Change-Id: Iddb96d39a512ef68827ecf89f3b5650950f88096 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124357 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/dbaccess/qa/extras/dialog-save.cxx b/dbaccess/qa/extras/dialog-save.cxx index 1eb4720cbcd1..ff4f612dc869 100644 --- a/dbaccess/qa/extras/dialog-save.cxx +++ b/dbaccess/qa/extras/dialog-save.cxx @@ -92,8 +92,7 @@ void DialogSaveTest::test() // All our uno::References are (should?) be invalid now -> let them go out of scope } { - uno::Sequence<uno::Any> args(1); - args[0] <<= aFileName; + uno::Sequence<uno::Any> args{ uno::Any(aFileName) }; Reference<container::XHierarchicalNameAccess> xHNA(getMultiServiceFactory()->createInstanceWithArguments("com.sun.star.packages.Package", args), UNO_QUERY_THROW); Reference< beans::XPropertySet > xPS(xHNA->getByHierarchicalName("Dialogs/Standard/Dialog1.xml"), UNO_QUERY_THROW); sal_Int64 nSize = 0; diff --git a/dbaccess/qa/extras/empty-stdlib-save.cxx b/dbaccess/qa/extras/empty-stdlib-save.cxx index 9339d3c4307e..2ffbccaa6131 100644 --- a/dbaccess/qa/extras/empty-stdlib-save.cxx +++ b/dbaccess/qa/extras/empty-stdlib-save.cxx @@ -106,8 +106,7 @@ void DialogSaveTest::test() // All our uno::References are (should?) be invalid now -> let them go out of scope } { - uno::Sequence<uno::Any> args(1); - args[0] <<= aFileName; + uno::Sequence<uno::Any> args{ uno::Any(aFileName) }; Reference<container::XHierarchicalNameAccess> xHNA(getMultiServiceFactory()->createInstanceWithArguments("com.sun.star.packages.Package", args), UNO_QUERY_THROW); CPPUNIT_ASSERT(!xHNA->hasByHierarchicalName("Basic/Standard")); CPPUNIT_ASSERT(!xHNA->hasByHierarchicalName("Dialogs/Standard")); diff --git a/dbaccess/qa/extras/nolib-save.cxx b/dbaccess/qa/extras/nolib-save.cxx index f441b608b31e..f64e0fbece10 100644 --- a/dbaccess/qa/extras/nolib-save.cxx +++ b/dbaccess/qa/extras/nolib-save.cxx @@ -96,8 +96,7 @@ void DialogSaveTest::test() // All our uno::References are (should?) be invalid now -> let them go out of scope } { - uno::Sequence<uno::Any> args(1); - args[0] <<= aFileName; + uno::Sequence<uno::Any> args{ uno::Any(aFileName) }; Reference<container::XHierarchicalNameAccess> xHNA(getMultiServiceFactory()->createInstanceWithArguments("com.sun.star.packages.Package", args), UNO_QUERY_THROW); CPPUNIT_ASSERT(!xHNA->hasByHierarchicalName("Basic/Standard")); CPPUNIT_ASSERT(!xHNA->hasByHierarchicalName("Dialogs/Standard")); diff --git a/dbaccess/source/core/api/FilteredContainer.cxx b/dbaccess/source/core/api/FilteredContainer.cxx index 2e383596f12f..70eb85210a80 100644 --- a/dbaccess/source/core/api/FilteredContainer.cxx +++ b/dbaccess/source/core/api/FilteredContainer.cxx @@ -326,8 +326,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std:: return; } } - aTableTypeFilter.realloc( 1 ); - aTableTypeFilter[0] = sInherentTableTypeRestriction; + aTableTypeFilter = { sInherentTableTypeRestriction }; } else { @@ -441,19 +440,13 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std:: SAL_WARN("dbaccess", "OTableContainer::getAllTableTypeFilter: unknown TableTypeFilterMode!" ); [[fallthrough]]; case FILTER_MODE_MIX_ALL: - _rFilter.realloc( 3 ); - _rFilter[0] = sView; - _rFilter[1] = sTable; - _rFilter[2] = sAll; + _rFilter = { sView, sTable, sAll }; break; case FILTER_MODE_FIXED: - _rFilter.realloc( 2 ); - _rFilter[0] = sView; - _rFilter[1] = sTable; + _rFilter = { sView, sTable }; break; case FILTER_MODE_WILDCARD: - _rFilter.realloc( 1 ); - _rFilter[0] = sAll; + _rFilter = { sAll }; break; case FILTER_MODE_STANDARD: _rFilter.realloc( 0 ); diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index ffca2cb08662..86b397cbbff2 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -161,10 +161,11 @@ void OKeySet::findTableColumnsMatching_throw( const Any& i_aTable, Reference<XIndexAccess> xQueryParameters = xParaSup->getParameters(); const sal_Int32 nParaCount = xQueryParameters->getCount(); Sequence< OUString> aParameterColumns(nParaCount); + auto aParameterColumnsRange = asNonConstRange(aParameterColumns); for(sal_Int32 i = 0; i< nParaCount;++i) { Reference<XPropertySet> xPara(xQueryParameters->getByIndex(i),UNO_QUERY_THROW); - xPara->getPropertyValue(PROPERTY_REALNAME) >>= aParameterColumns[i]; + xPara->getPropertyValue(PROPERTY_REALNAME) >>= aParameterColumnsRange[i]; } OUString sUpdateTableName( i_rUpdateTableName ); diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx index 1035a2e6260a..32c89c877f39 100644 --- a/dbaccess/source/core/dataaccess/ContentHelper.cxx +++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx @@ -332,6 +332,7 @@ Sequence< Any > OContentHelper::setPropertyValues(const Sequence< PropertyValue osl::ClearableGuard< osl::Mutex > aGuard( m_aMutex ); Sequence< Any > aRet( rValues.getLength() ); + auto aRetRange = asNonConstRange(aRet); Sequence< PropertyChangeEvent > aChanges( rValues.getLength() ); sal_Int32 nChanged = 0; @@ -350,7 +351,7 @@ Sequence< Any > OContentHelper::setPropertyValues(const Sequence< PropertyValue if ( rValue.Name == "ContentType" || rValue.Name == "IsDocument" || rValue.Name == "IsFolder" ) { // Read-only property! - aRet[ n ] <<= IllegalAccessException("Property is read-only!", + aRetRange[ n ] <<= IllegalAccessException("Property is read-only!", static_cast< cppu::OWeakObject * >( this ) ); } else if ( rValue.Name == "Title" ) @@ -384,14 +385,14 @@ Sequence< Any > OContentHelper::setPropertyValues(const Sequence< PropertyValue } else { - aRet[ n ] <<= IllegalTypeException("Property value has wrong type!", + aRetRange[ n ] <<= IllegalTypeException("Property value has wrong type!", static_cast< cppu::OWeakObject * >( this ) ); } } else { - aRet[ n ] <<= Exception("No property set for storing the value!", + aRetRange[ n ] <<= Exception("No property set for storing the value!", static_cast< cppu::OWeakObject * >( this ) ); } } @@ -525,7 +526,7 @@ void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent else propertyEvents = &(*it).second; - (*propertyEvents)[n] = rEvent; + propertyEvents->getArray()[n] = rEvent; } } } @@ -566,14 +567,14 @@ void OContentHelper::impl_rename_throw(const OUString& _sNewName,bool _bNotify ) return; try { - Sequence< PropertyChangeEvent > aChanges( 1 ); - - aChanges[0].Source = static_cast< cppu::OWeakObject * >( this ); - aChanges[0].Further = false; - aChanges[0].PropertyName = PROPERTY_NAME; - aChanges[0].PropertyHandle = PROPERTY_ID_NAME; - aChanges[0].OldValue <<= m_pImpl->m_aProps.aTitle; - aChanges[0].NewValue <<= _sNewName; + Sequence<PropertyChangeEvent> aChanges{ + { /* Source */ static_cast<cppu::OWeakObject*>(this), + /* PropertyName */ PROPERTY_NAME, + /* Further */ false, + /* PropertyHandle */ PROPERTY_ID_NAME, + /* OldValue */ Any(m_pImpl->m_aProps.aTitle), + /* NewValue */ Any(_sNewName) } + }; aGuard.clear(); diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index c7a7238f3f97..49a74717e559 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -374,8 +374,7 @@ ODatabaseModelImpl::ODatabaseModelImpl( const Reference< XComponentContext >& _r { // some kind of default m_sConnectURL = "jdbc:"; - m_aTableFilter.realloc(1); - m_aTableFilter[0] = "%"; + m_aTableFilter = { "%" }; impl_construct_nothrow(); } @@ -766,9 +765,7 @@ Reference< XStorage > const & ODatabaseModelImpl::getOrCreateRootStorage() if ( aSource.hasValue() ) { - Sequence< Any > aStorageCreationArgs(2); - aStorageCreationArgs[0] = aSource; - aStorageCreationArgs[1] <<= ElementModes::READWRITE; + Sequence< Any > aStorageCreationArgs{ aSource, Any(ElementModes::READWRITE) }; Reference< XStorage > xDocumentStorage; OUString sURL; @@ -783,7 +780,7 @@ Reference< XStorage > const & ODatabaseModelImpl::getOrCreateRootStorage() catch( const Exception& ) { m_bDocumentReadOnly = true; - aStorageCreationArgs[1] <<= ElementModes::READ; + aStorageCreationArgs.getArray()[1] <<= ElementModes::READ; try { xDocumentStorage.set( xStorageFactory->createInstanceWithArguments( aStorageCreationArgs ), UNO_QUERY_THROW ); diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx index 15054023170e..0da533536a9d 100644 --- a/dbaccess/source/core/dataaccess/connection.cxx +++ b/dbaccess/source/core/dataaccess/connection.cxx @@ -86,7 +86,7 @@ Sequence< OUString > OConnection::getSupportedServiceNames( ) { sal_Int32 nLen = aSupported.getLength(); aSupported.realloc( nLen + 1 ); - aSupported[ nLen ] = SERVICE_SDB_CONNECTION; + aSupported.getArray()[ nLen ] = SERVICE_SDB_CONNECTION; } return aSupported; @@ -628,9 +628,8 @@ Reference< XInterface > SAL_CALL OConnection::createInstance( const OUString& _s TSupportServices::const_iterator aFind = m_aSupportServices.find(_sServiceSpecifier); if ( aFind == m_aSupportServices.end() ) { - Sequence<Any> aArgs(1); Reference<XConnection> xMy(this); - aArgs[0] <<= NamedValue("ActiveConnection",makeAny(xMy)); + Sequence<Any> aArgs{ Any(NamedValue("ActiveConnection",makeAny(xMy))) }; aFind = m_aSupportServices.emplace( _sServiceSpecifier, m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(_sServiceSpecifier, aArgs, m_aContext) diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index c38dc9429cfc..45867c0e3bac 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -278,7 +278,7 @@ namespace sal_Int32 nLength = _rCallArgs.getLength(); _rCallArgs.realloc( nLength + 1 ); - _rCallArgs[ nLength ] <<= xStatusIndicator; + _rCallArgs.getArray()[ nLength ] <<= xStatusIndicator; } void lcl_extractAndStartStatusIndicator( const ::comphelper::NamedValueCollection& _rArguments, Reference< XStatusIndicator >& _rxStatusIndicator, @@ -294,7 +294,7 @@ namespace sal_Int32 nLength = _rCallArgs.getLength(); _rCallArgs.realloc( nLength + 1 ); - _rCallArgs[ nLength ] <<= _rxStatusIndicator; + _rCallArgs.getArray()[ nLength ] <<= _rxStatusIndicator; } catch( const Exception& ) { @@ -455,7 +455,7 @@ void ODatabaseDocument::impl_import_nolck_throw( const Reference< XComponentCont const sal_Int32 nCount = aFilterCreationArgs.getLength(); aFilterCreationArgs.realloc(nCount + 1); - aFilterCreationArgs[nCount] <<= xInfoSet; + aFilterCreationArgs.getArray()[nCount] <<= xInfoSet; Reference< XImporter > xImporter( _rContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.comp.sdb.DBFilter", aFilterCreationArgs, _rContext), @@ -1121,9 +1121,7 @@ Reference< XStorage > ODatabaseDocument::impl_createStorageFor_throw( const OUSt { xTruncate->truncate(); } - Sequence<Any> aParam(2); - aParam[0] <<= xStream; - aParam[1] <<= ElementModes::READWRITE | ElementModes::TRUNCATE; + Sequence<Any> aParam{ Any(xStream), Any(ElementModes::READWRITE | ElementModes::TRUNCATE) }; Reference< XSingleServiceFactory > xStorageFactory( m_pImpl->createStorageFactory(), UNO_SET_THROW ); return Reference< XStorage >( xStorageFactory->createInstanceWithArguments( aParam ), UNO_QUERY_THROW ); @@ -1422,8 +1420,7 @@ Reference< XNameAccess > ODatabaseDocument::impl_getDocumentContainer_throw( ODa aValue >>= sSupportService; if ( !sSupportService.isEmpty() ) { - Sequence<Any> aArgs(1); - aArgs[0] <<= NamedValue("DatabaseDocument",makeAny(xMy)); + Sequence<Any> aArgs{ Any(NamedValue("DatabaseDocument",makeAny(xMy))) }; xContainer.set( m_pImpl->m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(sSupportService, aArgs, m_pImpl->m_aContext), UNO_QUERY); @@ -1597,9 +1594,10 @@ void ODatabaseDocument::WriteThroughComponent( const Reference< XOutputStream >& // prepare arguments (prepend doc handler to given arguments) Sequence<Any> aArgs( 1 + _rArguments.getLength() ); - aArgs[0] <<= xSaxWriter; + auto pArgs = aArgs.getArray(); + pArgs[0] <<= xSaxWriter; for ( sal_Int32 i = 0; i < _rArguments.getLength(); ++i ) - aArgs[ i+1 ] = _rArguments[i]; + pArgs[ i+1 ] = _rArguments[i]; // get filter component Reference< XExporter > xExporter( m_pImpl->m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(OUString::createFromAscii(pServiceName), aArgs, m_pImpl->m_aContext), UNO_QUERY_THROW ); @@ -1648,7 +1646,7 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r sal_Int32 nArgsLen = aDelegatorArguments.getLength(); aDelegatorArguments.realloc(nArgsLen+1); - aDelegatorArguments[nArgsLen++] <<= xInfoSet; + aDelegatorArguments.getArray()[nArgsLen++] <<= xInfoSet; Reference< XPropertySet > xProp( _rxTargetStorage, UNO_QUERY_THROW ); xProp->setPropertyValue( INFO_MEDIATYPE, makeAny( OUString(MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII) ) ); @@ -1917,8 +1915,7 @@ void SAL_CALL ODatabaseDocument::loadFromStorage(const Reference<XStorage>& xSto xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("content.xml"))); xInfoSet->setPropertyValue("SourceStorage", uno::makeAny(xStorage)); - uno::Sequence<uno::Any> aFilterCreationArgs(1); - aFilterCreationArgs[0] <<= xInfoSet; + uno::Sequence<uno::Any> aFilterCreationArgs{ Any(xInfoSet) }; uno::Reference<document::XImporter> xImporter(m_pImpl->m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.comp.sdb.DBFilter", aFilterCreationArgs, m_pImpl->m_aContext), uno::UNO_QUERY_THROW); diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index b36ac6ea67b6..5239e19b8bc4 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -349,10 +349,11 @@ Reference<XConnection> OSharedConnectionManager::getConnection( const OUString& Sequence< PropertyValue > aInfoCopy(_aInfo); sal_Int32 nPos = aInfoCopy.getLength(); aInfoCopy.realloc( nPos + 2 ); - aInfoCopy[nPos].Name = "TableFilter"; - aInfoCopy[nPos++].Value <<= _pDataSource->m_pImpl->m_aTableFilter; - aInfoCopy[nPos].Name = "TableTypeFilter"; - aInfoCopy[nPos++].Value <<= _pDataSource->m_pImpl->m_aTableTypeFilter; + auto pInfoCopy = aInfoCopy.getArray(); + pInfoCopy[nPos].Name = "TableFilter"; + pInfoCopy[nPos++].Value <<= _pDataSource->m_pImpl->m_aTableFilter; + pInfoCopy[nPos].Name = "TableTypeFilter"; + pInfoCopy[nPos++].Value <<= _pDataSource->m_pImpl->m_aTableTypeFilter; OUString sUser = user; OUString sPassword = password; @@ -684,17 +685,18 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString if (!sPwd.isEmpty()) ++nAdditionalArgs; Sequence< PropertyValue > aUserPwd(nAdditionalArgs); + auto aUserPwdRange = asNonConstRange(aUserPwd); sal_Int32 nArgPos = 0; if (!sUser.isEmpty()) { - aUserPwd[ nArgPos ].Name = "user"; - aUserPwd[ nArgPos ].Value <<= sUser; + aUserPwdRange[ nArgPos ].Name = "user"; + aUserPwdRange[ nArgPos ].Value <<= sUser; ++nArgPos; } if (!sPwd.isEmpty()) { - aUserPwd[ nArgPos ].Name = "password"; - aUserPwd[ nArgPos ].Value <<= sPwd; + aUserPwdRange[ nArgPos ].Name = "password"; + aUserPwdRange[ nArgPos ].Value <<= sPwd; } Reference< XDriver > xDriver; try @@ -729,16 +731,17 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString { sal_Int32 nCount = aDriverInfo.getLength(); aDriverInfo.realloc(nCount + 3 ); + auto pDriverInfo = aDriverInfo.getArray(); - aDriverInfo[nCount].Name = "URL"; - aDriverInfo[nCount++].Value <<= m_pImpl->getURL(); + pDriverInfo[nCount].Name = "URL"; + pDriverInfo[nCount++].Value <<= m_pImpl->getURL(); - aDriverInfo[nCount].Name = "Storage"; + pDriverInfo[nCount].Name = "Storage"; Reference< css::document::XDocumentSubStorageSupplier> xDocSup( m_pImpl->getDocumentSubStorageSupplier() ); - aDriverInfo[nCount++].Value <<= xDocSup->getDocumentSubStorage("database",ElementModes::READWRITE); + pDriverInfo[nCount++].Value <<= xDocSup->getDocumentSubStorage("database",ElementModes::READWRITE); - aDriverInfo[nCount].Name = "Document"; - aDriverInfo[nCount++].Value <<= getDatabaseDocument(); + pDriverInfo[nCount].Name = "Document"; + pDriverInfo[nCount++].Value <<= getDatabaseDocument(); } if (nAdditionalArgs) xReturn = xManager->getConnectionWithInfo(m_pImpl->m_sConnectURL, ::comphelper::concatSequences(aUserPwd,aDriverInfo)); @@ -1271,8 +1274,7 @@ Reference< XNameAccess > SAL_CALL ODatabaseSource::getQueryDefinitions( ) aValue >>= sSupportService; if ( !sSupportService.isEmpty() ) { - Sequence<Any> aArgs(1); - aArgs[0] <<= NamedValue("DataSource",makeAny(xMy)); + Sequence<Any> aArgs{ Any(NamedValue("DataSource",makeAny(xMy))) }; xContainer.set( m_pImpl->m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(sSupportService, aArgs, m_pImpl->m_aContext), UNO_QUERY); } } diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index cfd552b36d7e..07c669e70fd9 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -218,9 +218,7 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments const bool bNeedClassID = !aClassID.hasElements() && sURL.isEmpty() ; if ( xCopyFrom.is() ) { - Sequence<Any> aIni(2); - aIni[0] <<= getContainerStorage(); - aIni[1] <<= sPersistentName; + Sequence<Any> aIni{ Any(getContainerStorage()), Any(sPersistentName) }; Command aCommand; aCommand.Name = "copyTo"; aCommand.Argument <<= aIni; @@ -279,8 +277,7 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments if ( !sURL.isEmpty() ) { - Sequence<Any> aIni(2); - aIni[0] <<= sURL; + Sequence<Any> aIni{ Any(sURL) }; Command aCommand; aCommand.Name = "insert"; aCommand.Argument <<= aIni; diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index ad20bb0bb616..9a2944bb338d 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -27,6 +27,7 @@ #include <comphelper/namedvaluecollection.hxx> #include <comphelper/classids.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/types.hxx> #include <com/sun/star/frame/XUntitledNumbers.hpp> #include <com/sun/star/awt/Size.hpp> @@ -526,11 +527,10 @@ IPropertyArrayHelper* ODocumentDefinition::createArrayHelper( ) const describeProperties( aProps ); // properties not maintained by our base class - Sequence< Property > aManualProps( 1 ); - aManualProps[0].Name = PROPERTY_PERSISTENT_PATH; - aManualProps[0].Handle = PROPERTY_ID_PERSISTENT_PATH; - aManualProps[0].Type = ::cppu::UnoType<OUString>::get(); - aManualProps[0].Attributes = PropertyAttribute::READONLY; + Sequence< Property > aManualProps{ { /* Name */ PROPERTY_PERSISTENT_PATH, + /* Handle */ PROPERTY_ID_PERSISTENT_PATH, + /* Type */ ::cppu::UnoType<OUString>::get(), + /* Attributes */ PropertyAttribute::READONLY } }; return new OPropertyArrayHelper( ::comphelper::concatSequences( aProps, aManualProps ) ); } @@ -1165,9 +1165,9 @@ void ODocumentDefinition::onCommandInsert( const OUString& _sURL, const Referenc if ( xStorage.is() ) { Reference< XEmbeddedObjectCreator> xEmbedFactory = EmbeddedObjectCreator::create(m_aContext); - Sequence<PropertyValue> aEmpty,aMediaDesc(1); - aMediaDesc[0].Name = PROPERTY_URL; - aMediaDesc[0].Value <<= _sURL; + Sequence<PropertyValue> aEmpty; + Sequence<PropertyValue> aMediaDesc{ comphelper::makePropertyValue(PROPERTY_URL, + _sURL) }; m_xEmbeddedObject.set(xEmbedFactory->createInstanceInitFromMediaDescriptor( xStorage ,m_pImpl->m_aProps.sPersistentName ,aMediaDesc diff --git a/dbaccess/source/core/dataaccess/intercept.cxx b/dbaccess/source/core/dataaccess/intercept.cxx index 3b42df4ed6a1..3e7f309976f9 100644 --- a/dbaccess/source/core/dataaccess/intercept.cxx +++ b/dbaccess/source/core/dataaccess/intercept.cxx @@ -65,17 +65,14 @@ void OInterceptor::dispose() OInterceptor::OInterceptor( ODocumentDefinition* _pContentHolder ) :m_pContentHolder( _pContentHolder ) - ,m_aInterceptedURL(7) + ,m_aInterceptedURL{ /* DISPATCH_SAVEAS */ ".uno:SaveAs", + /* DISPATCH_SAVE */ ".uno:Save", + /* DISPATCH_CLOSEDOC */ ".uno:CloseDoc", + /* DISPATCH_CLOSEWIN */ ".uno:CloseWin", + /* DISPATCH_CLOSEFRAME */ ".uno:CloseFrame", + /* DISPATCH_RELOAD */ ".uno:Reload" } { - OSL_ENSURE(DISPATCH_RELOAD < m_aInterceptedURL.getLength(),"Illegal size."); - - m_aInterceptedURL[DISPATCH_SAVEAS] = ".uno:SaveAs"; - m_aInterceptedURL[DISPATCH_SAVE] = ".uno:Save"; - m_aInterceptedURL[DISPATCH_CLOSEDOC] = ".uno:CloseDoc"; - m_aInterceptedURL[DISPATCH_CLOSEWIN] = ".uno:CloseWin"; - m_aInterceptedURL[DISPATCH_CLOSEFRAME] = ".uno:CloseFrame"; - m_aInterceptedURL[DISPATCH_RELOAD] = ".uno:Reload"; } @@ -131,7 +128,7 @@ void SAL_CALL OInterceptor::dispatch( const URL& URL,const Sequence<PropertyValu { if ( aNewArgs[nInd].Name == "SaveTo" ) { - aNewArgs[nInd].Value <<= true; + aNewArgs.getArray()[nInd].Value <<= true; break; } nInd++; @@ -140,8 +137,9 @@ void SAL_CALL OInterceptor::dispatch( const URL& URL,const Sequence<PropertyValu if ( nInd == aNewArgs.getLength() ) { aNewArgs.realloc( nInd + 1 ); - aNewArgs[nInd].Name = "SaveTo"; - aNewArgs[nInd].Value <<= true; + auto pNewArgs = aNewArgs.getArray(); + pNewArgs[nInd].Name = "SaveTo"; + pNewArgs[nInd].Value <<= true; } Reference< XDispatch > xDispatch = m_xSlaveDispatchProvider->queryDispatch(URL, "_self", 0 ); @@ -311,6 +309,7 @@ Sequence< Reference< XDispatch > > SAL_CALL OInterceptor::queryDispatches( cons aRet = m_xSlaveDispatchProvider->queryDispatches(Requests); else aRet.realloc(Requests.getLength()); + auto aRetRange = asNonConstRange(aRet); for(sal_Int32 i = 0; i < Requests.getLength(); ++i) { @@ -320,7 +319,7 @@ Sequence< Reference< XDispatch > > SAL_CALL OInterceptor::queryDispatches( cons { if ( Requests[i].FeatureURL.Complete == *pIter ) { - aRet[i] = static_cast<XDispatch*>(this); + aRetRange[i] = static_cast<XDispatch*>(this); break; } } diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx index 3517a437e10a..9b455c5ae452 100644 --- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx +++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx @@ -202,9 +202,8 @@ uno::Reference< chart2::data::XDataSource > SAL_CALL DatabaseDataProvider::creat uno::Reference< lang::XInitialization> xIni(m_xInternal,uno::UNO_QUERY); if ( xIni.is() ) { - uno::Sequence< uno::Any > aInitArgs(1); beans::NamedValue aParam("CreateDefaultData",uno::makeAny(true)); - aInitArgs[0] <<= aParam; + uno::Sequence< uno::Any > aInitArgs{ uno::Any(aParam) }; xIni->initialize(aInitArgs); } } @@ -660,7 +659,7 @@ void DatabaseDataProvider::impl_fillInternalDataProvider_throw(bool _bHasCategor { const sal_Int32 nAssumedRowSetColumnIndex = _bHasCategories ? 1 : 0; if ( nAssumedRowSetColumnIndex < aRowSetColumnNames.getLength() ) - aImposedColumnNames[0] = aRowSetColumnNames[ nAssumedRowSetColumnIndex ]; + aImposedColumnNames.getArray()[0] = aRowSetColumnNames[ nAssumedRowSetColumnIndex ]; } const sal_Int32 nCount = aImposedColumnNames.getLength(); diff --git a/dbaccess/source/filter/hsqldb/rowinputbinary.cxx b/dbaccess/source/filter/hsqldb/rowinputbinary.cxx index cfbef28a2b11..1a71ad9276e1 100644 --- a/dbaccess/source/filter/hsqldb/rowinputbinary.cxx +++ b/dbaccess/source/filter/hsqldb/rowinputbinary.cxx @@ -309,10 +309,8 @@ std::vector<Any> HsqlRowInputStream::readOneRow(const std::vector<ColumnDefiniti sal_Int32 nScale = 0; m_pStream->ReadInt32(nScale); - Sequence<Any> result(2); OUString sNum = lcl_makeStringFromBigint(std::move(aBytes)); - result[0] <<= lcl_putDot(sNum, nScale); - result[1] <<= nScale; + Sequence<Any> result{ Any(lcl_putDot(sNum, nScale)), Any(nScale) }; aData.push_back(makeAny(result)); } break; diff --git a/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx b/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx index d250dd10fecc..9402bb399dca 100644 --- a/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx +++ b/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx @@ -143,7 +143,7 @@ void OXMLDataSourceSetting::addValue(const OUString& _sValue) { sal_Int32 nPos = m_aInfoSequence.getLength(); m_aInfoSequence.realloc(nPos+1); - m_aInfoSequence[nPos] = aValue; + m_aInfoSequence.getArray()[nPos] = aValue; } } diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index b2b6ae0ce395..74cb97721f2b 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -1194,22 +1194,24 @@ void ODBExport::GetViewSettings(Sequence<PropertyValue>& aProps) { sal_Int32 nLength = aProps.getLength(); aProps.realloc(nLength + 1); - aProps[nLength].Name = "Queries"; + auto pProps = aProps.getArray(); + pProps[nLength].Name = "Queries"; Sequence< OUString> aSeq = xCollection->getElementNames(); const OUString* pIter = aSeq.getConstArray(); const OUString* pEnd = pIter + aSeq.getLength(); Sequence<PropertyValue> aQueries(aSeq.getLength()); + auto aQueriesRange = asNonConstRange(aQueries); for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i) { Reference<XPropertySet> xProp(xCollection->getByName(*pIter),UNO_QUERY); if ( xProp.is() ) { - aQueries[i].Name = *pIter; - aQueries[i].Value = xProp->getPropertyValue(PROPERTY_LAYOUTINFORMATION); + aQueriesRange[i].Name = *pIter; + aQueriesRange[i].Value = xProp->getPropertyValue(PROPERTY_LAYOUTINFORMATION); } } - aProps[nLength].Value <<= aQueries; + pProps[nLength].Value <<= aQueries; } catch(const Exception&) { @@ -1233,8 +1235,9 @@ void ODBExport::GetConfigurationSettings(Sequence<PropertyValue>& aProps) if ( aPropValues.hasElements() ) { aProps.realloc(nLength + 1); - aProps[nLength].Name = "layout-settings"; - aProps[nLength].Value = aValue; + auto pProps = aProps.getArray(); + pProps[nLength].Name = "layout-settings"; + pProps[nLength].Value = aValue; } } catch(const Exception&) diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index a8fd1cec3c94..7a329bc513f0 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -2729,7 +2729,7 @@ sal_Bool SAL_CALL OApplicationController::select( const Any& _aSelection ) if ( !( _aSelection >>= aSelectedObjects ) ) { aSelectedObjects.realloc( 1 ); - if ( !( _aSelection >>= aSelectedObjects[0] ) ) + if ( !( _aSelection >>= aSelectedObjects.getArray()[0] ) ) throw IllegalArgumentException(); } @@ -2816,13 +2816,14 @@ Any SAL_CALL OApplicationController::getSelection( ) { // if no objects are selected, add an entry to the sequence which describes the overall category // which is selected currently aCurrentSelection.realloc(1); - aCurrentSelection[0].Name = getDatabaseName(); + auto pCurrentSelection = aCurrentSelection.getArray(); + pCurrentSelection[0].Name = getDatabaseName(); switch ( eType ) { - case E_TABLE: aCurrentSelection[0].Type = DatabaseObjectContainer::TABLES; break; - case E_QUERY: aCurrentSelection[0].Type = DatabaseObjectContainer::QUERIES; break; - case E_FORM: aCurrentSelection[0].Type = DatabaseObjectContainer::FORMS; break; - case E_REPORT: aCurrentSelection[0].Type = DatabaseObjectContainer::REPORTS; break; + case E_TABLE: pCurrentSelection[0].Type = DatabaseObjectContainer::TABLES; break; + case E_QUERY: pCurrentSelection[0].Type = DatabaseObjectContainer::QUERIES; break; + case E_FORM: pCurrentSelection[0].Type = DatabaseObjectContainer::FORMS; break; + case E_REPORT: pCurrentSelection[0].Type = DatabaseObjectContainer::REPORTS; break; default: OSL_FAIL( "OApplicationController::getSelection: unexpected current element type!" ); break; diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index 632523e76977..3ec1094eeb9e 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -155,6 +155,7 @@ void OApplicationController::openDialog( const OUString& _sServiceName ) weld::WaitObject aWO(getFrameWeld()); Sequence< Any > aArgs(3); + auto pArgs = aArgs.getArray(); sal_Int32 nArgPos = 0; Reference< css::awt::XWindow> xWindow = getTopMostContainerWindow(); @@ -165,7 +166,7 @@ void OApplicationController::openDialog( const OUString& _sServiceName ) xWindow = VCLUnoHelper::GetInterface(getView()->Window::GetParent()); } // the parent window - aArgs[nArgPos++] <<= PropertyValue( "ParentWindow", + pArgs[nArgPos++] <<= PropertyValue( "ParentWindow", 0, makeAny(xWindow), PropertyState_DIRECT_VALUE); @@ -176,7 +177,7 @@ void OApplicationController::openDialog( const OUString& _sServiceName ) sInitialSelection = getDatabaseName(); if ( !sInitialSelection.isEmpty() ) { - aArgs[ nArgPos++ ] <<= PropertyValue( + pArgs[ nArgPos++ ] <<= PropertyValue( "InitialSelection", 0, makeAny( sInitialSelection ), PropertyState_DIRECT_VALUE ); } @@ -184,7 +185,7 @@ void OApplicationController::openDialog( const OUString& _sServiceName ) SharedConnection xConnection( getConnection() ); if ( xConnection.is() ) { - aArgs[ nArgPos++ ] <<= PropertyValue( + pArgs[ nArgPos++ ] <<= PropertyValue( PROPERTY_ACTIVE_CONNECTION, 0, makeAny( xConnection ), PropertyState_DIRECT_VALUE ); } diff --git a/dbaccess/source/ui/browser/formadapter.cxx b/dbaccess/source/ui/browser/formadapter.cxx index 37f35a0472ee..4b98babb26c9 100644 --- a/dbaccess/source/ui/browser/formadapter.cxx +++ b/dbaccess/source/ui/browser/formadapter.cxx @@ -1227,13 +1227,14 @@ Sequence< Any > SAL_CALL SbaXFormAdapter::getPropertyValues(const Sequence< OUSt return Sequence< Any>(aPropertyNames.getLength()); Sequence< Any> aReturn = xSet->getPropertyValues(aPropertyNames); + auto aReturnRange = asNonConstRange(aReturn); // search for (and fake) the NAME property OSL_ENSURE(aReturn.getLength() == aPropertyNames.getLength(), "SAL_CALL SbaXFormAdapter::getPropertyValues : the main form returned an invalid-length sequence !"); for (sal_Int32 i=0; i<aPropertyNames.getLength(); ++i) if (aPropertyNames[i] == PROPERTY_NAME) { - aReturn[i] <<= m_sName; + aReturnRange[i] <<= m_sName; break; } diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx index db4dc6da6290..16980f05bfe5 100644 --- a/dbaccess/source/ui/browser/sbagrid.cxx +++ b/dbaccess/source/ui/browser/sbagrid.cxx @@ -44,6 +44,7 @@ #include <svl/zforlist.hxx> #include <cppuhelper/queryinterface.hxx> #include <connectivity/dbtools.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/types.hxx> #include <com/sun/star/sdbc/DataType.hpp> #include <com/sun/star/sdbc/SQLException.hpp> @@ -777,14 +778,10 @@ void SbaGridControl::SetBrowserAttrs() try { Reference< XComponentContext > xContext = getContext(); - css::beans::PropertyValue aArg; - css::uno::Sequence<css::uno::Any> aArguments(2); - aArg.Name = "IntrospectedObject"; - aArg.Value <<= xGridModel; - aArguments[0] <<= aArg; - aArg.Name = "ParentWindow"; - aArg.Value <<= VCLUnoHelper::GetInterface(this); - aArguments[1] <<= aArg; + css::uno::Sequence<css::uno::Any> aArguments{ + Any(comphelper::makePropertyValue("IntrospectedObject", xGridModel)), + Any(comphelper::makePropertyValue("ParentWindow", VCLUnoHelper::GetInterface(this))) + }; Reference<XExecutableDialog> xExecute(xContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.form.ControlFontDialog", aArguments, xContext), css::uno::UNO_QUERY_THROW); xExecute->execute(); @@ -1063,8 +1060,7 @@ void SbaGridControl::implTransferSelectedRows( sal_Int16 nRowPos, bool _bTrueIfC // collect the affected rows if ((GetSelectRowCount() == 0) && (nRowPos >= 0)) { - aSelectedRows.realloc( 1 ); - aSelectedRows[0] <<= static_cast<sal_Int32>(nRowPos + 1); + aSelectedRows = { Any(static_cast<sal_Int32>(nRowPos + 1)) }; bSelectionBookmarks = false; } else if ( !IsAllSelected() && GetSelectRowCount() ) diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx index 55c9d3877389..2fd21fac1318 100644 --- a/dbaccess/source/ui/control/dbtreelistbox.cxx +++ b/dbaccess/source/ui/control/dbtreelistbox.cxx @@ -366,10 +366,11 @@ IMPL_LINK(TreeListBox, CommandHdl, const CommandEvent&, rCEvt, bool) if (aResourceName.isEmpty()) return false; - css::uno::Sequence< css::uno::Any > aArgs( 3 ); - aArgs[0] <<= comphelper::makePropertyValue( "Value", aResourceName ); - aArgs[1] <<= comphelper::makePropertyValue( "Frame", m_pContextMenuProvider->getCommandController().getXController()->getFrame() ); - aArgs[2] <<= comphelper::makePropertyValue( "IsContextMenu", true ); + css::uno::Sequence< css::uno::Any > aArgs{ + css::uno::Any(comphelper::makePropertyValue( "Value", aResourceName )), + css::uno::Any(comphelper::makePropertyValue( "Frame", m_pContextMenuProvider->getCommandController().getXController()->getFrame() )), + css::uno::Any(comphelper::makePropertyValue( "IsContextMenu", true )) + }; css::uno::Reference< css::uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); css::uno::Reference<css::frame::XPopupMenuController> xMenuController diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx index 184f49046a90..b9c954c62c0b 100644 --- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx @@ -614,16 +614,14 @@ namespace dbaui // the properties which need to be set on the new content Sequence< OUString > aNewDirectoryProperties { "Title" }; - // the values to be set - Sequence< Any > aNewDirectoryAttributes(1); - // loop for ( std::vector< OUString >::const_reverse_iterator aLocalName = aToBeCreated.rbegin(); aLocalName != aToBeCreated.rend(); ++aLocalName ) { - aNewDirectoryAttributes[0] <<= *aLocalName; + // the values to be set + Sequence< Any > aNewDirectoryAttributes{ Any(* aLocalName) }; if (!aParent.insertNewContent(sContentType, aNewDirectoryProperties, aNewDirectoryAttributes, aParent)) return false; } diff --git a/dbaccess/source/ui/dlg/paramdialog.cxx b/dbaccess/source/ui/dlg/paramdialog.cxx index 5bb6024a4b67..12f96d186f78 100644 --- a/dbaccess/source/ui/dlg/paramdialog.cxx +++ b/dbaccess/source/ui/dlg/paramdialog.cxx @@ -280,7 +280,7 @@ namespace dbaui return true; } - m_aFinalValues[m_nCurrentlySelected].Value <<= m_xParam->get_text(); + m_aFinalValues.getArray()[m_nCurrentlySelected].Value <<= m_xParam->get_text(); } // initialize the controls with the new values diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx index 1b75869cf15e..c5490bd959c1 100644 --- a/dbaccess/source/ui/dlg/queryfilter.cxx +++ b/dbaccess/source/ui/dlg/queryfilter.cxx @@ -675,22 +675,18 @@ IMPL_LINK_NOARG(DlgFilterCrit, ListSelectCompHdl, weld::ComboBox&, void) void DlgFilterCrit::BuildWherePart() { - Sequence<Sequence<PropertyValue> > aFilter,aHaving; - aFilter.realloc(1); - aHaving.realloc(1); + Sequence<Sequence<PropertyValue> > aFilter(1),aHaving(1); if( LbPos(*m_xLB_WHEREFIELD1) != 0 ) { PropertyValue aValue; if ( getCondition(*m_xLB_WHEREFIELD1,*m_xLB_WHERECOMP1,*m_xET_WHEREVALUE1,aValue) ) { - aHaving[0].realloc(1); - aHaving[0][0] = aValue; + aHaving = { { aValue } }; } else { - aFilter[0].realloc(1); - aFilter[0][0] = aValue; + aFilter = { { aValue} }; } } @@ -700,22 +696,13 @@ void DlgFilterCrit::BuildWherePart() Sequence<Sequence<PropertyValue> >& _rValues = aFilter; if ( getCondition(*m_xLB_WHEREFIELD2,*m_xLB_WHERECOMP2,*m_xET_WHEREVALUE2,aValue) ) _rValues = aHaving; - PropertyValue* pPos = nullptr; if ( m_xLB_WHERECOND2->get_active() ) - { - sal_Int32 nPos = _rValues.getLength(); - _rValues.realloc( nPos + 1); - _rValues[nPos].realloc( 1); - pPos = &_rValues[nPos][0]; - } - else - { - sal_Int32 nPos = _rValues.getLength() - 1; - sal_Int32 nAndPos = _rValues[nPos].getLength(); - _rValues[nPos].realloc( _rValues[nPos].getLength() + 1); - pPos = &_rValues[nPos][nAndPos]; - } - *pPos = aValue; + _rValues.realloc( _rValues.getLength() + 1); + sal_Int32 nPos = _rValues.getLength() - 1; + sal_Int32 nAndPos = _rValues[nPos].getLength(); + auto pValues = _rValues.getArray(); + pValues[nPos].realloc( _rValues[nPos].getLength() + 1); + pValues[nPos].getArray()[nAndPos] = aValue; } if( LbPos(*m_xLB_WHEREFIELD3) != 0 ) @@ -724,22 +711,13 @@ void DlgFilterCrit::BuildWherePart() Sequence<Sequence<PropertyValue> >& _rValues = aFilter; if ( getCondition(*m_xLB_WHEREFIELD3,*m_xLB_WHERECOMP3,*m_xET_WHEREVALUE3,aValue) ) _rValues = aHaving; - PropertyValue* pPos = nullptr; if (m_xLB_WHERECOND3->get_active()) - { - sal_Int32 nPos = _rValues.getLength(); - _rValues.realloc( nPos + 1); - _rValues[nPos].realloc( 1); - pPos = &_rValues[nPos][0]; - } - else - { - sal_Int32 nPos = _rValues.getLength() - 1; - sal_Int32 nAndPos = _rValues[nPos].getLength(); - _rValues[nPos].realloc( _rValues[nPos].getLength() + 1); - pPos = &_rValues[nPos][nAndPos]; - } - *pPos = aValue; + _rValues.realloc( _rValues.getLength() + 1); + sal_Int32 nPos = _rValues.getLength() - 1; + sal_Int32 nAndPos = _rValues[nPos].getLength(); + auto pValues = _rValues.getArray(); + pValues[nPos].realloc( _rValues[nPos].getLength() + 1); + pValues[nPos].getArray()[nAndPos] = aValue; } try { diff --git a/dbaccess/source/ui/dlg/tablespage.cxx b/dbaccess/source/ui/dlg/tablespage.cxx index 91456123ec58..d8ff8f863923 100644 --- a/dbaccess/source/ui/dlg/tablespage.cxx +++ b/dbaccess/source/ui/dlg/tablespage.cxx @@ -412,7 +412,7 @@ namespace dbaui sal_Int32 nOldLen = aTableFilter.getLength(); aTableFilter.realloc(nOldLen + 1); // add the new name - aTableFilter[nOldLen] = sComposedName.makeStringAndClear(); + aTableFilter.getArray()[nOldLen] = sComposedName.makeStringAndClear(); } if (bCatalogWildcard) @@ -463,8 +463,7 @@ namespace dbaui auto xRoot = m_xTablesList->getAllObjectsEntry(); if (xRoot && m_xTablesList->isWildcardChecked(*xRoot)) { - aTableFilter.realloc(1); - aTableFilter[0] = "%"; + aTableFilter = { "%" }; } else { diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx index c0401f591a6f..615620ba6271 100644 --- a/dbaccess/source/ui/misc/TokenWriter.cxx +++ b/dbaccess/source/ui/misc/TokenWriter.cxx @@ -695,8 +695,9 @@ void OHTMLImportExport::WriteTables() { sal_Int32 nCount = m_xResultSetMetaData->getColumnCount(); aNames.realloc(nCount); + auto aNamesRange = asNonConstRange(aNames); for (sal_Int32 i= 0; i < nCount; ++i) - aNames[i] = m_xResultSetMetaData->getColumnName(i+1); + aNamesRange[i] = m_xResultSetMetaData->getColumnName(i+1); bUseResultMetaData = true; } } diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index b72e16180727..376c882d373f 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -55,6 +55,8 @@ #include <sal/log.hxx> #include <tools/diagnose_ex.h> +#include <algorithm> + using namespace ::dbaui; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -327,9 +329,8 @@ void NamedTableCopySource::impl_ensureColumnInfo_throw() Sequence< OUString > NamedTableCopySource::getColumnNames() const { Sequence< OUString > aNames( m_aColumnInfo.size() ); - size_t nPos = 0; - for (auto const& elem : m_aColumnInfo) - aNames[ nPos++ ] = elem.GetName(); + std::transform(m_aColumnInfo.begin(), m_aColumnInfo.end(), aNames.getArray(), + [](const auto& elem) { return elem.GetName(); }); return aNames; } @@ -346,7 +347,7 @@ Sequence< OUString > NamedTableCopySource::getPrimaryKeyColumnNames() const { sal_Int32 len( aPKColNames.getLength() ); aPKColNames.realloc( len + 1 ); - aPKColNames[ len ] = xPKDescRow->getString( 4 ); // COLUMN_NAME + aPKColNames.getArray()[ len ] = xPKDescRow->getString( 4 ); // COLUMN_NAME } } catch( const Exception& ) diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx index 7c47a8101bb6..4a58f085acb0 100644 --- a/dbaccess/source/ui/misc/databaseobjectview.cxx +++ b/dbaccess/source/ui/misc/databaseobjectview.cxx @@ -103,21 +103,10 @@ namespace dbaui if ( !m_xFrameLoader.is() ) { Reference< XSingleServiceFactory > xFact = TaskCreator::create(m_xORB); - Sequence< Any > lArgs(3); - NamedValue aProp; - sal_Int32 nArg = 0; - - aProp.Name = "ParentFrame"; - aProp.Value <<= m_xParentFrame; - lArgs[nArg++] <<= aProp; - - aProp.Name = "TopWindow"; - aProp.Value <<= true; - lArgs[nArg++] <<= aProp; - - aProp.Name = "SupportPersistentWindowState"; - aProp.Value <<= true; - lArgs[nArg++] <<= aProp; + Sequence< Any > lArgs{ Any(NamedValue("ParentFrame", Any(m_xParentFrame))), + Any(NamedValue("TopWindow", Any(true))), + Any(NamedValue("SupportPersistentWindowState", + Any(true))) }; m_xFrameLoader.set(xFact->createInstanceWithArguments(lArgs), UNO_QUERY_THROW); diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx index 13effe4ccd93..15394133ed59 100644 --- a/dbaccess/source/ui/misc/linkeddocuments.cxx +++ b/dbaccess/source/ui/misc/linkeddocuments.cxx @@ -65,24 +65,22 @@ namespace dbaui sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11, sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 ) { - Sequence< sal_Int8 > aResult( 16 ); - aResult[0] = static_cast<sal_Int8>(n1 >> 24); - aResult[1] = static_cast<sal_Int8>(( n1 << 8 ) >> 24); - aResult[2] = static_cast<sal_Int8>(( n1 << 16 ) >> 24); - aResult[3] = static_cast<sal_Int8>(( n1 << 24 ) >> 24); - aResult[4] = static_cast<sal_Int8>(n2 >> 8); - aResult[5] = static_cast<sal_Int8>(( n2 << 8 ) >> 8); - aResult[6] = static_cast<sal_Int8>(n3 >> 8); - aResult[7] = static_cast<sal_Int8>(( n3 << 8 ) >> 8); - aResult[8] = b8; - aResult[9] = b9; - aResult[10] = b10; - aResult[11] = b11; - aResult[12] = b12; - aResult[13] = b13; - aResult[14] = b14; - aResult[15] = b15; - + Sequence< sal_Int8 > aResult{ /* [ 0] */ static_cast<sal_Int8>(n1 >> 24), + /* [ 1] */ static_cast<sal_Int8>(( n1 << 8 ) >> 24), + /* [ 2] */ static_cast<sal_Int8>(( n1 << 16 ) >> 24), + /* [ 3] */ static_cast<sal_Int8>(( n1 << 24 ) >> 24), + /* [ 4] */ static_cast<sal_Int8>(n2 >> 8), + /* [ 5] */ static_cast<sal_Int8>(( n2 << 8 ) >> 8), + /* [ 6] */ static_cast<sal_Int8>(n3 >> 8), + /* [ 7] */ static_cast<sal_Int8>(( n3 << 8 ) >> 8), + /* [ 8] */ static_cast<sal_Int8>(b8), + /* [ 9] */ static_cast<sal_Int8>(b9), + /* [10] */ static_cast<sal_Int8>(b10), + /* [11] */ static_cast<sal_Int8>(b11), + /* [12] */ static_cast<sal_Int8>(b12), + /* [13] */ static_cast<sal_Int8>(b13), + /* [14] */ static_cast<sal_Int8>(b14), + /* [15] */ static_cast<sal_Int8>(b15) }; return aResult; } } diff --git a/dbaccess/source/ui/misc/singledoccontroller.cxx b/dbaccess/source/ui/misc/singledoccontroller.cxx index c07da46c955f..28b0c9e774bd 100644 --- a/dbaccess/source/ui/misc/singledoccontroller.cxx +++ b/dbaccess/source/ui/misc/singledoccontroller.cxx @@ -123,8 +123,9 @@ namespace dbaui { size_t nCount(GetUndoManager().GetUndoActionCount()); Sequence<OUString> aSeq(nCount); + auto aSeqRange = asNonConstRange(aSeq); for (size_t n = 0; n < nCount; ++n) - aSeq[n] = GetUndoManager().GetUndoActionComment(n); + aSeqRange[n] = GetUndoManager().GetUndoActionComment(n); aReturn.aValue <<= aSeq; aReturn.bEnabled = true; break; @@ -134,8 +135,9 @@ namespace dbaui { size_t nCount(GetUndoManager().GetRedoActionCount()); Sequence<OUString> aSeq(nCount); + auto aSeqRange = asNonConstRange(aSeq); for (size_t n = 0; n < nCount; ++n) - aSeq[n] = GetUndoManager().GetRedoActionComment(n); + aSeqRange[n] = GetUndoManager().GetRedoActionComment(n); aReturn.aValue <<= aSeq; aReturn.bEnabled = true; break; diff --git a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx index 0918fb1979a1..f11ca853c930 100644 --- a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx +++ b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx @@ -144,11 +144,11 @@ namespace dbaui if( nIndex < 0 || nIndex >= getRelationCount() ) throw IndexOutOfBoundsException(); - Sequence< Reference<XInterface> > aSeq(m_pLine ? 2 : 0); + Sequence< Reference<XInterface> > aSeq; if( m_pLine ) { - aSeq[0] = m_pLine->GetSourceWin()->GetAccessible(); - aSeq[1] = m_pLine->GetDestWin()->GetAccessible(); + aSeq = { m_pLine->GetSourceWin()->GetAccessible(), + m_pLine->GetDestWin()->GetAccessible() }; } return AccessibleRelation(AccessibleRelationType::CONTROLLED_BY,aSeq); diff --git a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx index c8f0a402218f..1e8604181886 100644 --- a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx +++ b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx @@ -182,10 +182,11 @@ void OTableFieldDesc::Save( ::comphelper::NamedValueCollection& o_rSettings, con sal_Int32 c = 0; Sequence< PropertyValue > aCriteria( m_aCriteria.size() ); + auto pCriteria = aCriteria.getArray(); for (auto const& criteria : m_aCriteria) { - aCriteria[c].Name = "Criterion_" + OUString::number( c ); - aCriteria[c].Value <<= criteria; + pCriteria[c].Name = "Criterion_" + OUString::number( c ); + pCriteria[c].Value <<= criteria; ++c; } diff --git a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx index 3a35d4a66f9b..787d257b59e1 100644 --- a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx +++ b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx @@ -191,8 +191,7 @@ namespace dbaui { OJoinTableView* pView = m_pTable->getTableView(); auto aIter = pView->getTableConnections(m_pTable) + nIndex; - aRet.TargetSet.realloc(1); - aRet.TargetSet[0] = getParentChild(aIter - pView->getTableConnections().begin()); + aRet.TargetSet = { getParentChild(aIter - pView->getTableConnections().begin()) }; aRet.RelationType = AccessibleRelationType::CONTROLLER_FOR; } return aRet; diff --git a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx index f499135080b2..dad770975a44 100644 --- a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx +++ b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx @@ -15,6 +15,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/util/XURLTransformer.hpp> +#include <comphelper/propertyvalue.hxx> #include <vcl/InterimItemWindow.hxx> #include <vcl/event.hxx> #include <vcl/svapp.hxx> @@ -106,8 +107,6 @@ private: { if (!m_xWidget->get_value_changed_from_saved()) return; - uno::Sequence< beans::PropertyValue > aArgs( 1 ); - aArgs[0].Name = "DBLimit.Value"; sal_Int64 nLimit; OUString sActiveText = m_xWidget->get_active_text(); if (sActiveText == DBA_RES(STR_QUERY_LIMIT_ALL)) @@ -119,8 +118,7 @@ private: nLimit = -1; } set_value(nLimit); - aArgs[0].Value <<= nLimit; - m_pControl->dispatchCommand( aArgs ); + m_pControl->dispatchCommand({ comphelper::makePropertyValue("DBLimit.Value", nLimit) }); } ///Initialize entries diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index 9500281a7275..450a1ba416a8 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -281,17 +281,17 @@ void SAL_CALL OQueryController::getFastPropertyValue( Any& o_rValue, sal_Int32 i // one additional property: const sal_Int32 nLength = aProps.getLength(); aProps.realloc( nLength + 1 ); - aProps[ nLength ] = Property( + auto pProps = aProps.getArray(); + pProps[ nLength ] = Property( "CurrentQueryDesign", PROPERTY_ID_CURRENT_QUERY_DESIGN, ::cppu::UnoType< Sequence< PropertyValue > >::get(), PropertyAttribute::READONLY ); - auto [begin, end] = asNonConstRange(aProps); std::sort( - begin, - end, + pProps, + pProps + aProps.getLength(), ::comphelper::PropertyCompareByName() ); diff --git a/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx b/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx index 3bbce14be9fa..78a470ddd5a0 100644 --- a/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx +++ b/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx @@ -149,43 +149,44 @@ namespace dbaui // but whose values are stored in our item set sal_Int32 nProp = aProps.getLength(); aProps.realloc( nProp + 6 ); + auto pProps = aProps.getArray(); - aProps[ nProp++ ] = Property( + pProps[ nProp++ ] = Property( "HeaderLine", PROPERTY_ID_HEADER_LINE, ::cppu::UnoType< sal_Bool >::get(), PropertyAttribute::TRANSIENT ); - aProps[ nProp++ ] = Property( + pProps[ nProp++ ] = Property( "FieldDelimiter", PROPERTY_ID_FIELD_DELIMITER, ::cppu::UnoType< OUString >::get(), PropertyAttribute::TRANSIENT ); - aProps[ nProp++ ] = Property( + pProps[ nProp++ ] = Property( "StringDelimiter", PROPERTY_ID_STRING_DELIMITER, ::cppu::UnoType< OUString >::get(), PropertyAttribute::TRANSIENT ); - aProps[ nProp++ ] = Property( + pProps[ nProp++ ] = Property( "DecimalDelimiter", PROPERTY_ID_DECIMAL_DELIMITER, ::cppu::UnoType< OUString >::get(), PropertyAttribute::TRANSIENT ); - aProps[ nProp++ ] = Property( + pProps[ nProp++ ] = Property( "ThousandDelimiter", PROPERTY_ID_THOUSAND_DELIMITER, ::cppu::UnoType< OUString >::get(), PropertyAttribute::TRANSIENT ); - aProps[ nProp++ ] = Property( + pProps[ nProp++ ] = Property( "CharSet", PROPERTY_ID_ENCODING, ::cppu::UnoType< OUString >::get(),