basctl/source/dlged/dlged.cxx | 10 connectivity/source/drivers/component/CDatabaseMetaData.cxx | 24 - connectivity/source/drivers/component/CTable.cxx | 16 - connectivity/source/drivers/file/FCatalog.cxx | 12 connectivity/source/drivers/file/FConnection.cxx | 24 - connectivity/source/drivers/file/FDatabaseMetaData.cxx | 32 -- connectivity/source/drivers/file/FResultSet.cxx | 6 connectivity/source/drivers/firebird/Connection.cxx | 13 - connectivity/source/drivers/flat/EConnection.cxx | 28 +- connectivity/source/drivers/flat/EDatabaseMetaData.cxx | 26 -- connectivity/source/drivers/flat/EResultSet.cxx | 12 connectivity/source/drivers/flat/ETable.cxx | 16 - connectivity/source/drivers/hsqldb/HCatalog.cxx | 8 connectivity/source/drivers/hsqldb/HConnection.cxx | 7 connectivity/source/drivers/hsqldb/HDriver.cxx | 12 connectivity/source/drivers/hsqldb/HTable.cxx | 8 connectivity/source/drivers/jdbc/DatabaseMetaData.cxx | 7 connectivity/source/drivers/jdbc/tools.cxx | 82 +++--- editeng/source/editeng/editview.cxx | 14 - editeng/source/editeng/impedit.cxx | 6 editeng/source/editeng/impedit4.cxx | 3 editeng/source/editeng/impedit5.cxx | 14 - editeng/source/items/paraitem.cxx | 14 - editeng/source/items/xmlcnitm.cxx | 23 - editeng/source/misc/acorrcfg.cxx | 146 +++++------- editeng/source/misc/hangulhanja.cxx | 4 editeng/source/misc/splwrap.cxx | 12 editeng/source/misc/unolingu.cxx | 15 - embeddedobj/source/commonembedding/persistence.cxx | 11 eventattacher/source/eventattacher.cxx | 19 - extensions/source/logging/loggerconfig.cxx | 24 - filter/source/config/cache/basecontainer.cxx | 2 filter/source/config/cache/cacheitem.cxx | 4 filter/source/config/cache/filtercache.cxx | 42 +-- forms/source/component/Columns.cxx | 10 forms/source/component/DatabaseForm.cxx | 13 - forms/source/component/Filter.cxx | 9 forms/source/component/ListBox.cxx | 14 - forms/source/component/findpos.cxx | 8 forms/source/component/imgprod.cxx | 3 forms/source/component/propertybaghelper.cxx | 31 -- forms/source/richtext/richtextcontrol.cxx | 11 forms/source/richtext/specialdispatchers.cxx | 14 - forms/source/xforms/binding.cxx | 20 - forms/source/xforms/computedexpression.cxx | 10 forms/source/xforms/model_ui.cxx | 5 forms/source/xforms/unohelper.cxx | 7 formula/source/ui/dlg/formula.cxx | 13 - fpicker/source/office/OfficeFilePicker.cxx | 34 -- fpicker/source/office/RemoteFilesDialog.cxx | 6 fpicker/source/office/commonpicker.cxx | 13 - fpicker/source/office/iodlg.cxx | 6 framework/source/accelerators/presethandler.cxx | 10 framework/source/dispatch/interceptionhelper.cxx | 11 framework/source/jobs/helponstartup.cxx | 10 framework/source/services/autorecovery.cxx | 25 -- framework/source/uiconfiguration/uicategorydescription.cxx | 12 framework/source/uielement/objectmenucontroller.cxx | 4 framework/source/uielement/uicommanddescription.cxx | 11 i18npool/source/localedata/localedata.cxx | 2 i18npool/source/transliteration/transliterationImpl.cxx | 8 io/source/stm/odata.cxx | 2 io/source/stm/opipe.cxx | 3 lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx | 4 lingucomponent/source/thesaurus/libnth/nthesimp.cxx | 2 linguistic/source/lngsvcmgr.cxx | 18 - linguistic/source/misc.cxx | 8 linguistic/source/spelldsp.cxx | 9 linguistic/source/spelldta.cxx | 10 linguistic/source/thesdsp.cxx | 4 lotuswordpro/source/filter/LotusWordProImportFilter.cxx | 2 sfx2/source/appl/appuno.cxx | 3 stoc/source/inspect/introspection.cxx | 23 - stoc/source/invocation/invocation.cxx | 43 +-- stoc/source/invocation_adapterfactory/iafactory.cxx | 6 vcl/qa/cppunit/canvasbitmaptest.cxx | 46 +-- 76 files changed, 445 insertions(+), 754 deletions(-)
New commits: commit b280efcb9b006efefeca3a189cf789f06ab3dc96 Author: Mike Kaganski <[email protected]> AuthorDate: Sat Dec 6 13:31:01 2025 +0500 Commit: Mike Kaganski <[email protected]> CommitDate: Sun Dec 7 12:54:23 2025 +0100 Drop some uses Sequence::getConstArray Replace by operator[], begin() and end(), which don't have overhead since commit 2484de6728bd11bb7949003d112f1ece2223c7a1 (Remove non- const Sequence::begin()/end() in internal code, 2021-10-15) and commit fb3c04bd1930eedacd406874e1a285d62bbf27d9 (Drop non-const Sequence::operator[] in internal code, 2021-11-05). Change-Id: I221470b3439bb0dc6e7705b0d99deb3cd2063484 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195176 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx index 3d18805ff519..55a363e4a9af 100644 --- a/basctl/source/dlged/dlged.cxx +++ b/basctl/source/dlged/dlged.cxx @@ -638,7 +638,7 @@ static void implCopyStreamToByteSequence( const Reference< XInputStream >& xStre sal_Int32 nPos = bytes.getLength(); bytes.realloc( nPos + nRead ); - std::copy(readBytes.getConstArray(), readBytes.getConstArray() + static_cast<sal_uInt32>(nRead), bytes.getArray() + nPos); + std::copy_n(readBytes.getConstArray(), nRead, bytes.getArray() + nPos); } } @@ -762,8 +762,8 @@ void DlgEditor::Copy() pCombinedData[i] = sal_Int8( n & 0xff ); n >>= 8; } - std::copy(DialogModelBytes.getConstArray(), DialogModelBytes.getConstArray() + nDialogDataLen, pCombinedData + 4); - std::copy(aResData.getConstArray(), aResData.getConstArray() + nResDataLen, pCombinedData + nResOffset); + std::copy_n(DialogModelBytes.getConstArray(), nDialogDataLen, pCombinedData + 4); + std::copy_n(aResData.getConstArray(), nResDataLen, pCombinedData + nResOffset); Sequence< Any > aSeqData { @@ -860,10 +860,10 @@ void DlgEditor::Paste() sal_Int32 nDialogDataLen = nTotalLen - nResDataLen - 4; DialogModelBytes.realloc(nDialogDataLen); - std::copy(aCombinedData.getConstArray() + 4, aCombinedData.getConstArray() + 4 + nDialogDataLen, DialogModelBytes.getArray()); + std::copy_n(aCombinedData.getConstArray() + 4, nDialogDataLen, DialogModelBytes.getArray()); aResData.realloc(nResDataLen); - std::copy(aCombinedData.getConstArray() + nResOffset, aCombinedData.getConstArray() + nResOffset + nResDataLen, aResData.getArray()); + std::copy_n(aCombinedData.getConstArray() + nResOffset, nResDataLen, aResData.getArray()); } } else diff --git a/connectivity/source/drivers/component/CDatabaseMetaData.cxx b/connectivity/source/drivers/component/CDatabaseMetaData.cxx index 8d40b20bc4eb..4a9b4a7c3f5b 100644 --- a/connectivity/source/drivers/component/CDatabaseMetaData.cxx +++ b/connectivity/source/drivers/component/CDatabaseMetaData.cxx @@ -134,15 +134,12 @@ Reference< XResultSet > SAL_CALL OComponentDatabaseMetaData::getColumns( aRow[10] = new ORowSetValueDecorator(sal_Int32(10)); - Sequence< OUString> aTabNames(xNames->getElementNames()); - const OUString* pTabIter = aTabNames.getConstArray(); - const OUString* pTabEnd = pTabIter + aTabNames.getLength(); - for(;pTabIter != pTabEnd;++pTabIter) + for (const OUString& rTab : xNames->getElementNames()) { - if(match(tableNamePattern,*pTabIter,' + if (match(tableNamePattern, rTab, ' { - const Reference< XColumnsSupplier> xTable(xNames->getByName(*pTabIter),UNO_QUERY_THROW); - aRow[3] = new ORowSetValueDecorator(*pTabIter); + const Reference<XColumnsSupplier> xTable(xNames->getByName(rTab), UNO_QUERY_THROW); + aRow[3] = new ORowSetValueDecorator(rTab); const Reference< XNameAccess> xColumns = xTable->getColumns(); if(!xColumns.is()) @@ -150,16 +147,13 @@ Reference< XResultSet > SAL_CALL OComponentDatabaseMetaData::getColumns( const Sequence< OUString> aColNames(xColumns->getElementNames()); - const OUString* pColumnIter = aColNames.getConstArray(); - const OUString* pEnd = pColumnIter + aColNames.getLength(); - Reference< XPropertySet> xColumn; - for(sal_Int32 i=1;pColumnIter != pEnd;++pColumnIter,++i) + for (sal_Int32 i = 0; i < aColNames.getLength(); ++i) { - if(match(columnNamePattern,*pColumnIter,' + if (match(columnNamePattern, aColNames[i], ' { - aRow[4] = new ORowSetValueDecorator( *pColumnIter); + aRow[4] = new ORowSetValueDecorator(aColNames[i]); - xColumns->getByName(*pColumnIter) >>= xColumn; + auto xColumn = xColumns->getByName(aColNames[i]).query<XPropertySet>(); OSL_ENSURE(xColumn.is(),"Columns contains a column who isn't a fastpropertyset!"); aRow[5] = new ORowSetValueDecorator(::comphelper::getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))); aRow[6] = new ORowSetValueDecorator(::comphelper::getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))); @@ -183,7 +177,7 @@ Reference< XResultSet > SAL_CALL OComponentDatabaseMetaData::getColumns( default: aRow[16] = new ORowSetValueDecorator(sal_Int32(0)); } - aRow[17] = new ORowSetValueDecorator(i); + aRow[17] = new ORowSetValueDecorator(i + 1); switch(aRow[11]->getValue().getInt32()) { case ColumnValue::NO_NULLS: diff --git a/connectivity/source/drivers/component/CTable.cxx b/connectivity/source/drivers/component/CTable.cxx index e9d540152db2..0ce8798135d5 100644 --- a/connectivity/source/drivers/component/CTable.cxx +++ b/connectivity/source/drivers/component/CTable.cxx @@ -74,16 +74,14 @@ Sequence< Type > SAL_CALL OComponentTable::getTypes( ) std::vector<Type> aOwnTypes; aOwnTypes.reserve(aTypes.getLength()); - const Type* pBegin = aTypes.getConstArray(); - const Type* pEnd = pBegin + aTypes.getLength(); - for(;pBegin != pEnd;++pBegin) + for (const Type& rType : aTypes) { - if(!( *pBegin == cppu::UnoType<XKeysSupplier>::get()|| - *pBegin == cppu::UnoType<XIndexesSupplier>::get()|| - *pBegin == cppu::UnoType<XRename>::get()|| - *pBegin == cppu::UnoType<XAlterTable>::get()|| - *pBegin == cppu::UnoType<XDataDescriptorFactory>::get())) - aOwnTypes.push_back(*pBegin); + if(!( rType == cppu::UnoType<XKeysSupplier>::get()|| + rType == cppu::UnoType<XIndexesSupplier>::get()|| + rType == cppu::UnoType<XRename>::get()|| + rType == cppu::UnoType<XAlterTable>::get()|| + rType == cppu::UnoType<XDataDescriptorFactory>::get())) + aOwnTypes.push_back(rType); } aOwnTypes.push_back(cppu::UnoType<css::lang::XUnoTunnel>::get()); diff --git a/connectivity/source/drivers/file/FCatalog.cxx b/connectivity/source/drivers/file/FCatalog.cxx index 2a33bded28fe..90a49cb4f10e 100644 --- a/connectivity/source/drivers/file/FCatalog.cxx +++ b/connectivity/source/drivers/file/FCatalog.cxx @@ -83,15 +83,13 @@ Sequence< Type > SAL_CALL OFileCatalog::getTypes( ) Sequence< Type > aTypes = OFileCatalog_BASE::getTypes(); std::vector<Type> aOwnTypes; aOwnTypes.reserve(aTypes.getLength()); - const Type* pBegin = aTypes.getConstArray(); - const Type* pEnd = pBegin + aTypes.getLength(); - for(;pBegin != pEnd;++pBegin) + for (const Type& rType : aTypes) { - if(!(*pBegin == cppu::UnoType<XGroupsSupplier>::get()|| - *pBegin == cppu::UnoType<XUsersSupplier>::get()|| - *pBegin == cppu::UnoType<XViewsSupplier>::get())) + if(!(rType == cppu::UnoType<XGroupsSupplier>::get()|| + rType == cppu::UnoType<XUsersSupplier>::get()|| + rType == cppu::UnoType<XViewsSupplier>::get())) { - aOwnTypes.push_back(*pBegin); + aOwnTypes.push_back(rType); } } return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size()); diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx index fe43ed6477ed..edac48c2a401 100644 --- a/connectivity/source/drivers/file/FConnection.cxx +++ b/connectivity/source/drivers/file/FConnection.cxx @@ -89,22 +89,20 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >& osl_atomic_increment( &m_refCount ); OUString aExt; - const PropertyValue *pIter = info.getConstArray(); - const PropertyValue *pEnd = pIter + info.getLength(); - for(;pIter != pEnd;++pIter) + for (const auto& rPropertyValue : info) { - if( pIter->Name == "Extension" ) - OSL_VERIFY( pIter->Value >>= aExt ); - else if( pIter->Name == "CharSet" ) + if (rPropertyValue.Name == "Extension") + OSL_VERIFY(rPropertyValue.Value >>= aExt); + else if (rPropertyValue.Name == "CharSet") { - if (auto const numeric = o3tl::tryAccess<sal_uInt16>(pIter->Value)) + if (auto const numeric = o3tl::tryAccess<sal_uInt16>(rPropertyValue.Value)) { m_nTextEncoding = *numeric; } else { OUString sIanaName; - OSL_VERIFY( pIter->Value >>= sIanaName ); + OSL_VERIFY(rPropertyValue.Value >>= sIanaName); ::dbtools::OCharsetMap aLookupIanaName; ::dbtools::OCharsetMap::const_iterator aLookup = aLookupIanaName.findIanaName(sIanaName); @@ -114,15 +112,15 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >& m_nTextEncoding = RTL_TEXTENCODING_DONTKNOW; } } - else if( pIter->Name == "ShowDeleted" ) + else if (rPropertyValue.Name == "ShowDeleted") { - OSL_VERIFY( pIter->Value >>= m_bShowDeleted ); + OSL_VERIFY(rPropertyValue.Value >>= m_bShowDeleted); } - else if( pIter->Name == "EnableSQL92Check" ) + else if (rPropertyValue.Name == "EnableSQL92Check") { - pIter->Value >>= m_bCheckSQL92; + rPropertyValue.Value >>= m_bCheckSQL92; } - } // for(;pIter != pEnd;++pIter) + } { sal_Int32 nLen = url.indexOf(':'); diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx index acbf88b00c9e..a739021e1df9 100644 --- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx +++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx @@ -167,23 +167,8 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( static constexpr OUString aTable = u"TABLE"_ustr; - bool bTableFound = true; - sal_Int32 nLength = types.getLength(); - if(nLength) - { - bTableFound = false; - - const OUString* pBegin = types.getConstArray(); - const OUString* pEnd = pBegin + nLength; - for(;pBegin != pEnd;++pBegin) - { - if(*pBegin == aTable) - { - bTableFound = true; - break; - } - } - } + bool bTableFound + = !types.hasElements() || std::find(types.begin(), types.end(), aTable) != types.end(); if(!bTableFound) return pResult; @@ -381,23 +366,18 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( if( xTabSup.is()) { Reference< XNameAccess> xNames = xTabSup->getTables(); - Sequence< OUString > aNames = xNames->getElementNames(); - const OUString* pBegin = aNames.getConstArray(); - const OUString* pEnd = pBegin + aNames.getLength(); - for(;pBegin != pEnd;++pBegin) + for (const OUString& rName : xNames->getElementNames()) { - if(match(tableNamePattern,*pBegin,' + if (match(tableNamePattern, rName, ' { ODatabaseMetaDataResultSet::ORow aRow(8); - aRow[2] = new ORowSetValueDecorator(*pBegin); + aRow[2] = new ORowSetValueDecorator(rName); aRow[6] = ODatabaseMetaDataResultSet::getSelectValue(); aRow[7] = new ORowSetValueDecorator(u"NO"_ustr); aRows.push_back(aRow); - Reference< XPropertySet> xTable( - xNames->getByName(*pBegin), css::uno::UNO_QUERY); - if(xTable.is()) + if (auto xTable = xNames->getByName(rName).query<XPropertySet>()) { auto pTable = dynamic_cast<OFileTable*>(xTable.get()); if(pTable && !pTable->isReadOnly()) diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index ad365d6c949e..6010b2c3e2e7 100644 --- a/connectivity/source/drivers/file/FResultSet.cxx +++ b/connectivity/source/drivers/file/FResultSet.cxx @@ -1473,11 +1473,9 @@ void OResultSet::setBoundedColumns(const OValueRefRow& _rRow, { aSelectIters.emplace(aIter,true); sal_Int32 nSelectColumnPos = aIter - _rxColumns->begin() + 1; - const OUString* pBegin = aSelectColumns.getConstArray(); - const OUString* pEnd = pBegin + aSelectColumns.getLength(); - for(sal_Int32 i=0;pBegin != pEnd;++pBegin,++i) + for (sal_Int32 i = 0; i < aSelectColumns.getLength(); ++i) { - if ( aCase(*pBegin, sSelectColumnRealName) ) + if (aCase(aSelectColumns[i], sSelectColumnRealName)) { // the getXXX methods are 1-based ... sal_Int32 nTableColumnPos = i + 1; diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx index fc105a883e4e..f48630fd313a 100644 --- a/connectivity/source/drivers/firebird/Connection.cxx +++ b/connectivity/source/drivers/firebird/Connection.cxx @@ -137,18 +137,15 @@ void Connection::construct(const OUString& url, const Sequence< PropertyValue >& { m_bIsEmbedded = true; - const PropertyValue* pIter = info.getConstArray(); - const PropertyValue* pEnd = pIter + info.getLength(); - - for (;pIter != pEnd; ++pIter) + for (const PropertyValue& rPropertyValue : info) { - if ( pIter->Name == "Storage" ) + if (rPropertyValue.Name == "Storage") { - m_xEmbeddedStorage.set(pIter->Value,UNO_QUERY); + m_xEmbeddedStorage.set(rPropertyValue.Value, UNO_QUERY); } - else if ( pIter->Name == "Document" ) + else if (rPropertyValue.Name == "Document") { - pIter->Value >>= m_xParentDocument; + rPropertyValue.Value >>= m_xParentDocument; } } diff --git a/connectivity/source/drivers/flat/EConnection.cxx b/connectivity/source/drivers/flat/EConnection.cxx index 3f199cdfc4f0..c100f55935a5 100644 --- a/connectivity/source/drivers/flat/EConnection.cxx +++ b/connectivity/source/drivers/flat/EConnection.cxx @@ -61,50 +61,48 @@ void OFlatConnection::construct(const OUString& url,const Sequence< PropertyValu { osl_atomic_increment( &m_refCount ); - const PropertyValue *pBegin = info.getConstArray(); - const PropertyValue *pEnd = pBegin + info.getLength(); - for(;pBegin != pEnd;++pBegin) + for (const PropertyValue& rPropertyValue : info) { - if(pBegin->Name == "HeaderLine") + if (rPropertyValue.Name == "HeaderLine") { - if( ! (pBegin->Value >>= m_bHeaderLine) ) + if (!(rPropertyValue.Value >>= m_bHeaderLine)) SAL_WARN("connectivity.flat", "construct: unable to get property HeaderLine"); } - else if(pBegin->Name == "FieldDelimiter") + else if (rPropertyValue.Name == "FieldDelimiter") { OUString aVal; - if( ! (pBegin->Value >>= aVal) ) + if (!(rPropertyValue.Value >>= aVal)) SAL_WARN("connectivity.flat", "construct: unable to get property FieldDelimiter"); m_cFieldDelimiter = aVal.toChar(); } - else if(pBegin->Name == "StringDelimiter") + else if (rPropertyValue.Name == "StringDelimiter") { OUString aVal; - if( ! (pBegin->Value >>= aVal) ) + if (!(rPropertyValue.Value >>= aVal)) SAL_WARN("connectivity.flat", "construct: unable to get property StringDelimiter"); m_cStringDelimiter = aVal.toChar(); } - else if(pBegin->Name == "DecimalDelimiter") + else if (rPropertyValue.Name == "DecimalDelimiter") { OUString aVal; - if( ! (pBegin->Value >>= aVal) ) + if (!(rPropertyValue.Value >>= aVal)) SAL_WARN("connectivity.flat", "construct: unable to get property DecimalDelimiter"); m_cDecimalDelimiter = aVal.toChar(); } - else if(pBegin->Name == "ThousandDelimiter") + else if (rPropertyValue.Name == "ThousandDelimiter") { OUString aVal; - if( ! (pBegin->Value >>= aVal) ) + if (!(rPropertyValue.Value >>= aVal)) SAL_WARN("connectivity.flat", "construct: unable to get property ThousandDelimiter"); m_cThousandDelimiter = aVal.toChar(); } - else if ( pBegin->Name == "MaxRowScan" ) + else if (rPropertyValue.Name == "MaxRowScan") { - pBegin->Value >>= m_nMaxRowsToScan; + rPropertyValue.Value >>= m_nMaxRowsToScan; } } diff --git a/connectivity/source/drivers/flat/EDatabaseMetaData.cxx b/connectivity/source/drivers/flat/EDatabaseMetaData.cxx index 038f01ad2fa1..c870d4d9286e 100644 --- a/connectivity/source/drivers/flat/EDatabaseMetaData.cxx +++ b/connectivity/source/drivers/flat/EDatabaseMetaData.cxx @@ -160,16 +160,12 @@ Reference< XResultSet > SAL_CALL OFlatDatabaseMetaData::getColumns( ODatabaseMetaDataResultSet::ORows aRows; ODatabaseMetaDataResultSet::ORow aRow(19); aRow[10] = new ORowSetValueDecorator(sal_Int32(10)); - Sequence< OUString> aTabNames(xNames->getElementNames()); - const OUString* pTabBegin = aTabNames.getConstArray(); - const OUString* pTabEnd = pTabBegin + aTabNames.getLength(); - for(;pTabBegin != pTabEnd;++pTabBegin) + for (const OUString& rTabName : xNames->getElementNames()) { - if(match(tableNamePattern,*pTabBegin,' + if (match(tableNamePattern, rTabName, ' { - Reference< XColumnsSupplier> xTable( - xNames->getByName(*pTabBegin), css::uno::UNO_QUERY); - aRow[3] = new ORowSetValueDecorator(*pTabBegin); + Reference<XColumnsSupplier> xTable(xNames->getByName(rTabName), css::uno::UNO_QUERY); + aRow[3] = new ORowSetValueDecorator(rTabName); Reference< XNameAccess> xColumns = xTable->getColumns(); if(!xColumns.is()) @@ -177,17 +173,13 @@ Reference< XResultSet > SAL_CALL OFlatDatabaseMetaData::getColumns( Sequence< OUString> aColNames(xColumns->getElementNames()); - const OUString* pBegin = aColNames.getConstArray(); - const OUString* pEnd = pBegin + aColNames.getLength(); - Reference< XPropertySet> xColumn; - for(sal_Int32 i=1;pBegin != pEnd;++pBegin,++i) + for (sal_Int32 i = 0; i < aColNames.getLength(); ++i) { - if(match(columnNamePattern,*pBegin,' + if (match(columnNamePattern, aColNames[i], ' { - aRow[4] = new ORowSetValueDecorator(*pBegin); + aRow[4] = new ORowSetValueDecorator(aColNames[i]); - xColumn.set( - xColumns->getByName(*pBegin), css::uno::UNO_QUERY); + auto xColumn = xColumns->getByName(aColNames[i]).query<XPropertySet>(); OSL_ENSURE(xColumn.is(),"Columns contains a column who isn't a fastpropertyset!"); aRow[5] = new ORowSetValueDecorator(getINT32(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPE)))); aRow[6] = new ORowSetValueDecorator(getString(xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_TYPENAME)))); @@ -208,7 +200,7 @@ Reference< XResultSet > SAL_CALL OFlatDatabaseMetaData::getColumns( default: aRow[16] = new ORowSetValueDecorator(sal_Int32(0)); } - aRow[17] = new ORowSetValueDecorator(i); + aRow[17] = new ORowSetValueDecorator(i + 1); switch(aRow[11]->getValue().getInt32()) { case ColumnValue::NO_NULLS: diff --git a/connectivity/source/drivers/flat/EResultSet.cxx b/connectivity/source/drivers/flat/EResultSet.cxx index 57fd3ea1f324..3cc9afb840ac 100644 --- a/connectivity/source/drivers/flat/EResultSet.cxx +++ b/connectivity/source/drivers/flat/EResultSet.cxx @@ -74,15 +74,13 @@ Sequence< Type > SAL_CALL OFlatResultSet::getTypes( ) Sequence< Type > aTypes = OResultSet::getTypes(); std::vector<Type> aOwnTypes; aOwnTypes.reserve(aTypes.getLength()); - const Type* pBegin = aTypes.getConstArray(); - const Type* pEnd = pBegin + aTypes.getLength(); - for(;pBegin != pEnd;++pBegin) + for (const Type& rType : aTypes) { - if(!(*pBegin == cppu::UnoType<XDeleteRows>::get()|| - *pBegin == cppu::UnoType<XResultSetUpdate>::get()|| - *pBegin == cppu::UnoType<XRowUpdate>::get())) + if(!(rType == cppu::UnoType<XDeleteRows>::get()|| + rType == cppu::UnoType<XResultSetUpdate>::get()|| + rType == cppu::UnoType<XRowUpdate>::get())) { - aOwnTypes.push_back(*pBegin); + aOwnTypes.push_back(rType); } } Sequence< Type > aRet(aOwnTypes.data(), aOwnTypes.size()); diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index a248d0775bab..097c152afe75 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -515,17 +515,15 @@ Sequence< Type > SAL_CALL OFlatTable::getTypes( ) Sequence< Type > aTypes = OTable_TYPEDEF::getTypes(); vector<Type> aOwnTypes; aOwnTypes.reserve(aTypes.getLength()); - const Type* pBegin = aTypes.getConstArray(); - const Type* pEnd = pBegin + aTypes.getLength(); - for(;pBegin != pEnd;++pBegin) + for (const Type& rType : aTypes) { - if(!(*pBegin == cppu::UnoType<XKeysSupplier>::get()|| - *pBegin == cppu::UnoType<XRename>::get()|| - *pBegin == cppu::UnoType<XIndexesSupplier>::get()|| - *pBegin == cppu::UnoType<XAlterTable>::get()|| - *pBegin == cppu::UnoType<XDataDescriptorFactory>::get())) + if(!(rType == cppu::UnoType<XKeysSupplier>::get()|| + rType == cppu::UnoType<XRename>::get()|| + rType == cppu::UnoType<XIndexesSupplier>::get()|| + rType == cppu::UnoType<XAlterTable>::get()|| + rType == cppu::UnoType<XDataDescriptorFactory>::get())) { - aOwnTypes.push_back(*pBegin); + aOwnTypes.push_back(rType); } } return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size()); diff --git a/connectivity/source/drivers/hsqldb/HCatalog.cxx b/connectivity/source/drivers/hsqldb/HCatalog.cxx index d905e67399f0..bfc57320e9a5 100644 --- a/connectivity/source/drivers/hsqldb/HCatalog.cxx +++ b/connectivity/source/drivers/hsqldb/HCatalog.cxx @@ -129,13 +129,11 @@ Sequence< Type > SAL_CALL OHCatalog::getTypes( ) Sequence< Type > aTypes = OCatalog::getTypes(); std::vector<Type> aOwnTypes; aOwnTypes.reserve(aTypes.getLength()); - const Type* pBegin = aTypes.getConstArray(); - const Type* pEnd = pBegin + aTypes.getLength(); - for(;pBegin != pEnd;++pBegin) + for(const Type& rType : aTypes) { - if ( *pBegin != cppu::UnoType<XGroupsSupplier>::get()) + if (rType != cppu::UnoType<XGroupsSupplier>::get()) { - aOwnTypes.push_back(*pBegin); + aOwnTypes.push_back(rType); } } return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size()); diff --git a/connectivity/source/drivers/hsqldb/HConnection.cxx b/connectivity/source/drivers/hsqldb/HConnection.cxx index 032d02d90e8a..0a248e31760d 100644 --- a/connectivity/source/drivers/hsqldb/HConnection.cxx +++ b/connectivity/source/drivers/hsqldb/HConnection.cxx @@ -126,12 +126,9 @@ namespace connectivity::hsqldb { m_bIni = false; Reference< XDatabaseMetaData2 > xMeta2(m_xConnection->getMetaData(),UNO_QUERY_THROW); - const Sequence< PropertyValue > aInfo = xMeta2->getConnectionInfo(); - const PropertyValue* pIter = aInfo.getConstArray(); - const PropertyValue* pEnd = pIter + aInfo.getLength(); - for(;pIter != pEnd;++pIter) + for (const PropertyValue& rPropertyValue : xMeta2->getConnectionInfo()) { - if ( pIter->Name == "readonly" ) + if (rPropertyValue.Name == "readonly") m_bReadOnly = true; } } diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx index 9827553408fc..bb9bda20492e 100644 --- a/connectivity/source/drivers/hsqldb/HDriver.cxx +++ b/connectivity/source/drivers/hsqldb/HDriver.cxx @@ -165,18 +165,16 @@ namespace connectivity { OUString sURL; Reference<XStorage> xStorage; - const PropertyValue* pIter = info.getConstArray(); - const PropertyValue* pEnd = pIter + info.getLength(); - for (;pIter != pEnd; ++pIter) + for (const PropertyValue& rPropertyValue : info) { - if ( pIter->Name == "Storage" ) + if (rPropertyValue.Name == "Storage") { - xStorage.set(pIter->Value,UNO_QUERY); + xStorage.set(rPropertyValue.Value, UNO_QUERY); } - else if ( pIter->Name == "URL" ) + else if (rPropertyValue.Name == "URL") { - pIter->Value >>= sURL; + rPropertyValue.Value >>= sURL; } } diff --git a/connectivity/source/drivers/hsqldb/HTable.cxx b/connectivity/source/drivers/hsqldb/HTable.cxx index bb8281991bf1..88f07742bae2 100644 --- a/connectivity/source/drivers/hsqldb/HTable.cxx +++ b/connectivity/source/drivers/hsqldb/HTable.cxx @@ -309,13 +309,11 @@ Sequence< Type > SAL_CALL OHSQLTable::getTypes( ) Sequence< Type > aTypes = OTableHelper::getTypes(); std::vector<Type> aOwnTypes; aOwnTypes.reserve(aTypes.getLength()); - const Type* pIter = aTypes.getConstArray(); - const Type* pEnd = pIter + aTypes.getLength(); - for(;pIter != pEnd;++pIter) + for (const Type& rType : aTypes) { - if( *pIter != cppu::UnoType<XRename>::get()) + if (rType != cppu::UnoType<XRename>::get()) { - aOwnTypes.push_back(*pIter); + aOwnTypes.push_back(rType); } } return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size()); diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx index 18a5929e7287..b6c54c479246 100644 --- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx +++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx @@ -126,16 +126,15 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTables( { jobjectArray pObjArray = t.pEnv->NewObjectArray( static_cast<jsize>(typeFilterCount), java_lang_String::st_getMyClass(), nullptr ); OSL_VERIFY( !isExceptionOccurred( t.pEnv ) ); - const OUString* typeFilter = _types.getConstArray(); bool bIncludeAllTypes = false; - for ( sal_Int32 i=0; i<typeFilterCount; ++i, ++typeFilter ) + for (sal_Int32 i = 0; i < typeFilterCount; ++i) { - if ( *typeFilter == "%" ) + if (_types[i] == "%") { bIncludeAllTypes = true; break; } - jstring aT = convertwchar_tToJavaString( t.pEnv, *typeFilter ); + jstring aT = convertwchar_tToJavaString(t.pEnv, _types[i]); t.pEnv->SetObjectArrayElement( pObjArray, static_cast<jsize>(i), aT ); OSL_VERIFY( !isExceptionOccurred( t.pEnv ) ); } diff --git a/connectivity/source/drivers/jdbc/tools.cxx b/connectivity/source/drivers/jdbc/tools.cxx index eaf13ebb30ac..72ba5e7f3acb 100644 --- a/connectivity/source/drivers/jdbc/tools.cxx +++ b/connectivity/source/drivers/jdbc/tools.cxx @@ -102,56 +102,54 @@ jstring connectivity::convertwchar_tToJavaString(JNIEnv *pEnv,const OUString& _r std::unique_ptr<java_util_Properties> connectivity::createStringPropertyArray(const Sequence< PropertyValue >& info ) { std::unique_ptr<java_util_Properties> pProps(new java_util_Properties()); - const PropertyValue* pBegin = info.getConstArray(); - const PropertyValue* pEnd = pBegin + info.getLength(); - for(;pBegin != pEnd;++pBegin) + for (const PropertyValue& rPropertyValue : info) { // these are properties used internally by LibreOffice, // and should not be passed to the JDBC driver // (which probably does not know anything about them anyway). - if ( pBegin->Name != "JavaDriverClass" - && pBegin->Name != "JavaDriverClassPath" - && pBegin->Name != "SystemProperties" - && pBegin->Name != "CharSet" - && pBegin->Name != "AppendTableAliasName" - && pBegin->Name != "AppendTableAliasInSelect" - && pBegin->Name != "DisplayVersionColumns" - && pBegin->Name != "GeneratedValues" - && pBegin->Name != "UseIndexDirectionKeyword" - && pBegin->Name != "UseKeywordAsBeforeAlias" - && pBegin->Name != "AddIndexAppendix" - && pBegin->Name != "FormsCheckRequiredFields" - && pBegin->Name != "GenerateASBeforeCorrelationName" - && pBegin->Name != "EscapeDateTime" - && pBegin->Name != "ParameterNameSubstitution" - && pBegin->Name != "IsPasswordRequired" - && pBegin->Name != "IsAutoRetrievingEnabled" - && pBegin->Name != "AutoRetrievingStatement" - && pBegin->Name != "UseCatalogInSelect" - && pBegin->Name != "UseSchemaInSelect" - && pBegin->Name != "AutoIncrementCreation" - && pBegin->Name != "Extension" - && pBegin->Name != "NoNameLengthLimit" - && pBegin->Name != "EnableSQL92Check" - && pBegin->Name != "EnableOuterJoinEscape" - && pBegin->Name != "BooleanComparisonMode" - && pBegin->Name != "IgnoreCurrency" - && pBegin->Name != "TypeInfoSettings" - && pBegin->Name != "IgnoreDriverPrivileges" - && pBegin->Name != "ImplicitCatalogRestriction" - && pBegin->Name != "ImplicitSchemaRestriction" - && pBegin->Name != "SupportsTableCreation" - && pBegin->Name != "UseJava" - && pBegin->Name != "Authentication" - && pBegin->Name != "PreferDosLikeLineEnds" - && pBegin->Name != "PrimaryKeySupport" - && pBegin->Name != "RespectDriverResultSetType" + if ( rPropertyValue.Name != "JavaDriverClass" + && rPropertyValue.Name != "JavaDriverClassPath" + && rPropertyValue.Name != "SystemProperties" + && rPropertyValue.Name != "CharSet" + && rPropertyValue.Name != "AppendTableAliasName" + && rPropertyValue.Name != "AppendTableAliasInSelect" + && rPropertyValue.Name != "DisplayVersionColumns" + && rPropertyValue.Name != "GeneratedValues" + && rPropertyValue.Name != "UseIndexDirectionKeyword" + && rPropertyValue.Name != "UseKeywordAsBeforeAlias" + && rPropertyValue.Name != "AddIndexAppendix" + && rPropertyValue.Name != "FormsCheckRequiredFields" + && rPropertyValue.Name != "GenerateASBeforeCorrelationName" + && rPropertyValue.Name != "EscapeDateTime" + && rPropertyValue.Name != "ParameterNameSubstitution" + && rPropertyValue.Name != "IsPasswordRequired" + && rPropertyValue.Name != "IsAutoRetrievingEnabled" + && rPropertyValue.Name != "AutoRetrievingStatement" + && rPropertyValue.Name != "UseCatalogInSelect" + && rPropertyValue.Name != "UseSchemaInSelect" + && rPropertyValue.Name != "AutoIncrementCreation" + && rPropertyValue.Name != "Extension" + && rPropertyValue.Name != "NoNameLengthLimit" + && rPropertyValue.Name != "EnableSQL92Check" + && rPropertyValue.Name != "EnableOuterJoinEscape" + && rPropertyValue.Name != "BooleanComparisonMode" + && rPropertyValue.Name != "IgnoreCurrency" + && rPropertyValue.Name != "TypeInfoSettings" + && rPropertyValue.Name != "IgnoreDriverPrivileges" + && rPropertyValue.Name != "ImplicitCatalogRestriction" + && rPropertyValue.Name != "ImplicitSchemaRestriction" + && rPropertyValue.Name != "SupportsTableCreation" + && rPropertyValue.Name != "UseJava" + && rPropertyValue.Name != "Authentication" + && rPropertyValue.Name != "PreferDosLikeLineEnds" + && rPropertyValue.Name != "PrimaryKeySupport" + && rPropertyValue.Name != "RespectDriverResultSetType" ) { OUString aStr; - OSL_VERIFY( pBegin->Value >>= aStr ); - pProps->setProperty(pBegin->Name,aStr); + OSL_VERIFY(rPropertyValue.Value >>= aStr); + pProps->setProperty(rPropertyValue.Name, aStr); } } return pProps; diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 7e0cfa2819c3..13c5353e17ca 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -1155,13 +1155,12 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac Sequence< OUString > aAlt; if (xSpellAlt.is()) aAlt = xSpellAlt->getAlternatives(); - const OUString *pAlt = aAlt.getConstArray(); sal_uInt16 nWords = static_cast<sal_uInt16>(aAlt.getLength()); if ( nWords ) { for ( sal_uInt16 nW = 0; nW < nWords; nW++ ) { - OUString aAlternate( pAlt[nW] ); + OUString aAlternate(aAlt[nW]); OUString sId(OUString::number(MN_ALTSTART + nW)); xPopupMenu->insert(nW, sId, aAlternate, nullptr, nullptr, nullptr, TRISTATE_INDET); xAutoMenu->append(sId, aAlternate); @@ -1177,10 +1176,8 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac SvtLinguConfig aCfg; Reference< linguistic2::XSearchableDictionaryList > xDicList( LinguMgr::GetDictionaryList() ); - Sequence< Reference< linguistic2::XDictionary > > aDics; if (xDicList.is()) { - const Reference< linguistic2::XDictionary > *pDic = nullptr; // add the default positive dictionary to dic-list (if not already done). // This is to ensure that there is at least one dictionary to which // words could be added. @@ -1188,13 +1185,12 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac if (xDic.is()) xDic->setActive( true ); - aDics = xDicList->getDictionaries(); - pDic = aDics.getConstArray(); + Sequence<Reference<linguistic2::XDictionary>> aDics = xDicList->getDictionaries(); LanguageType nCheckedLanguage = getImpEditEngine().GetLanguage( aPaM2 ).nLang; sal_uInt16 nDicCount = static_cast<sal_uInt16>(aDics.getLength()); for (sal_uInt16 i = 0; i < nDicCount; i++) { - uno::Reference< linguistic2::XDictionary > xDicTmp = pDic[i]; + uno::Reference<linguistic2::XDictionary> xDicTmp = aDics[i]; if (!xDicTmp.is() || LinguMgr::GetIgnoreAllList() == xDicTmp) continue; @@ -1339,7 +1335,7 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac else if ( sId.toInt32() >= MN_AUTOSTART ) { DBG_ASSERT(sId.toInt32() - MN_AUTOSTART < aAlt.getLength(), "index out of range"); - OUString aWord = pAlt[sId.toInt32() - MN_AUTOSTART]; + OUString aWord = aAlt[sId.toInt32() - MN_AUTOSTART]; SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect(); if ( pAutoCorrect ) pAutoCorrect->PutText( aSelected, aWord, getImpEditEngine().GetLanguage( aPaM2 ).nLang ); @@ -1348,7 +1344,7 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac else if ( sId.toInt32() >= MN_ALTSTART ) // Replace { DBG_ASSERT(sId.toInt32() - MN_ALTSTART < aAlt.getLength(), "index out of range"); - OUString aWord = pAlt[sId.toInt32() - MN_ALTSTART]; + OUString aWord = aAlt[sId.toInt32() - MN_ALTSTART]; InsertText( aWord ); } else diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 9cb809656fb8..8d31616faff6 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -2526,11 +2526,9 @@ void ImpEditView::dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEv // Only check for text, will also be there if bin or rtf datatransfer::DataFlavor aTextFlavor; SotExchange::GetFormatDataFlavor( SotClipboardFormatId::STRING, aTextFlavor ); - const css::datatransfer::DataFlavor* pFlavors = rDTDEE.SupportedDataFlavors.getConstArray(); - int nFlavors = rDTDEE.SupportedDataFlavors.getLength(); - for ( int n = 0; n < nFlavors; n++ ) + for (const css::datatransfer::DataFlavor& rFlavor : rDTDEE.SupportedDataFlavors) { - if( TransferableDataHelper::IsEqual( pFlavors[n], aTextFlavor ) ) + if (TransferableDataHelper::IsEqual(rFlavor, aTextFlavor)) { mpDragAndDropInfo->bHasValidData = true; break; diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index c5a1f97ed464..8ccf389603b5 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -3221,12 +3221,11 @@ short ImpEditEngine::ReplaceTextOnly( { // Change text without losing the attributes sal_Int32 nCharsAfterTransliteration = rOffsets.getLength(); - const sal_Int32* pOffsets = rOffsets.getConstArray(); short nDiffs = 0; for ( sal_Int32 n = 0; n < nCharsAfterTransliteration; n++ ) { sal_Int32 nCurrentPos = nCurrentStart+n; - sal_Int32 nDiff = (nCurrentPos-nDiffs) - pOffsets[n]; + sal_Int32 nDiff = (nCurrentPos - nDiffs) - rOffsets[n]; if ( !nDiff ) { diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index bd025019da67..898819998629 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -1244,12 +1244,9 @@ bool ImpEditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView mxTransliterationWrapper.changeLocale( eLang); const ::utl::TransliterationWrapper* pTransliteration = mxTransliterationWrapper.get(); - css::uno::Sequence< css::i18n::CalendarItem2 > xItem = mxLocaleDataWrapper->getDefaultCalendarDays(); - sal_Int32 nCount = xItem.getLength(); - const css::i18n::CalendarItem2* pArr = xItem.getConstArray(); - for( sal_Int32 n = 0; n <= nCount; ++n ) + for (const auto& rItem : mxLocaleDataWrapper->getDefaultCalendarDays()) { - const OUString& rDay = pArr[n].FullName; + const OUString& rDay = rItem.FullName; if( pTransliteration->isMatch( aWord, rDay) ) { aComplete = rDay; @@ -1259,12 +1256,9 @@ bool ImpEditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView if ( aComplete.isEmpty() ) { - xItem = mxLocaleDataWrapper->getDefaultCalendarMonths(); - sal_Int32 nMonthCount = xItem.getLength(); - const css::i18n::CalendarItem2* pMonthArr = xItem.getConstArray(); - for( sal_Int32 n = 0; n <= nMonthCount; ++n ) + for (const auto& rItem : mxLocaleDataWrapper->getDefaultCalendarMonths()) { - const OUString& rMon = pMonthArr[n].FullName; + const OUString& rMon = rItem.FullName; if( pTransliteration->isMatch( aWord, rMon) ) { aComplete = rMon; diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index f49b1f986717..38e71f808e02 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -1120,12 +1120,10 @@ bool SvxTabStopItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) } maTabStops.clear(); - const style::TabStop* pArr = aSeq.getConstArray(); - const sal_uInt16 nCount = static_cast<sal_uInt16>(aSeq.getLength()); - for(sal_uInt16 i = 0; i < nCount ; i++) + for (const auto& rTabStop : aSeq) { SvxTabAdjust eAdjust = SvxTabAdjust::Default; - switch(pArr[i].Alignment) + switch (rTabStop.Alignment) { case style::TabAlign_LEFT : eAdjust = SvxTabAdjust::Left; break; case style::TabAlign_CENTER : eAdjust = SvxTabAdjust::Center; break; @@ -1133,12 +1131,10 @@ bool SvxTabStopItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) case style::TabAlign_DECIMAL: eAdjust = SvxTabAdjust::Decimal; break; default: ;//prevent warning } - sal_Unicode cFill = pArr[i].FillChar; - sal_Unicode cDecimal = pArr[i].DecimalChar; - SvxTabStop aTab( bConvert ? o3tl::toTwips(pArr[i].Position, o3tl::Length::mm100) : pArr[i].Position, + SvxTabStop aTab( bConvert ? o3tl::toTwips(rTabStop.Position, o3tl::Length::mm100) : rTabStop.Position, eAdjust, - cDecimal, - cFill ); + rTabStop.DecimalChar, + rTabStop.FillChar ); Insert(aTab); } break; diff --git a/editeng/source/items/xmlcnitm.cxx b/editeng/source/items/xmlcnitm.cxx index 80b3a36fe078..edfcd4298cf1 100644 --- a/editeng/source/items/xmlcnitm.cxx +++ b/editeng/source/items/xmlcnitm.cxx @@ -88,17 +88,9 @@ bool SvXMLAttrContainerItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nM if( !xContainer.is() ) return false; - const Sequence< OUString > aNameSequence( xContainer->getElementNames() ); - const OUString* pNames = aNameSequence.getConstArray(); - const sal_Int32 nCount = aNameSequence.getLength(); - Any aAny; - sal_Int32 nAttr; - - for( nAttr = 0; nAttr < nCount; nAttr++ ) + for (const OUString& aName : xContainer->getElementNames()) { - const OUString aName( *pNames++ ); - - aAny = xContainer->getByName( aName ); + Any aAny = xContainer->getByName(aName); auto pData = o3tl::tryAccess<AttributeData>(aAny); if( !pData ) return false; @@ -112,25 +104,22 @@ bool SvXMLAttrContainerItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nM if( pData->Namespace.isEmpty() ) { if( !aNewImpl.AddAttr( aPrefix, aLName, pData->Value ) ) - break; + return false; } else { if( !aNewImpl.AddAttr( aPrefix, pData->Namespace, aLName, pData->Value ) ) - break; + return false; } } else { if( !aNewImpl.AddAttr( aName, pData->Value ) ) - break; + return false; } } - if( nAttr == nCount ) - maContainerData = std::move(aNewImpl); - else - return false; + maContainerData = std::move(aNewImpl); } catch(...) { diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx index f67c73e0fbf1..bd0ecaa36ae5 100644 --- a/editeng/source/misc/acorrcfg.cxx +++ b/editeng/source/misc/acorrcfg.cxx @@ -201,7 +201,6 @@ void SvxBaseAutoCorrCfg::Load(bool bInit) Sequence<Any> aValues = GetProperties(aNames); if(bInit) EnableNotification(aNames); - const Any* pValues = aValues.getConstArray(); DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed"); if(aValues.getLength() != aNames.getLength()) return; @@ -210,96 +209,96 @@ void SvxBaseAutoCorrCfg::Load(bool bInit) sal_Int32 nTemp = 0; for(int nProp = 0; nProp < aNames.getLength(); nProp++) { - if(pValues[nProp].hasValue()) + if (aValues[nProp].hasValue()) { switch(nProp) { case 0: - if(*o3tl::doAccess<bool>(pValues[nProp])) + if (*o3tl::doAccess<bool>(aValues[nProp])) nFlags |= ACFlags::SaveWordCplSttLst; break;//"Exceptions/TwoCapitalsAtStart", case 1: - if(*o3tl::doAccess<bool>(pValues[nProp])) + if (*o3tl::doAccess<bool>(aValues[nProp])) nFlags |= ACFlags::SaveWordWordStartLst; break;//"Exceptions/CapitalAtStartSentence", case 2: - if(*o3tl::doAccess<bool>(pValues[nProp])) + if (*o3tl::doAccess<bool>(aValues[nProp])) nFlags |= ACFlags::Autocorrect; break;//"UseReplacementTable", case 3: - if(*o3tl::doAccess<bool>(pValues[nProp])) + if (*o3tl::doAccess<bool>(aValues[nProp])) nFlags |= ACFlags::CapitalStartWord; break;//"TwoCapitalsAtStart", case 4: - if(*o3tl::doAccess<bool>(pValues[nProp])) + if (*o3tl::doAccess<bool>(aValues[nProp])) nFlags |= ACFlags::CapitalStartSentence; break;//"CapitalAtStartSentence", case 5: - if(*o3tl::doAccess<bool>(pValues[nProp])) + if (*o3tl::doAccess<bool>(aValues[nProp])) nFlags |= ACFlags::ChgWeightUnderl; break;//"ChangeUnderlineWeight", case 6: - if(*o3tl::doAccess<bool>(pValues[nProp])) + if (*o3tl::doAccess<bool>(aValues[nProp])) nFlags |= ACFlags::SetINetAttr; break;//"SetInetAttribute", case 7: - if(*o3tl::doAccess<bool>(pValues[nProp])) + if (*o3tl::doAccess<bool>(aValues[nProp])) nFlags |= ACFlags::ChgOrdinalNumber; break;//"ChangeOrdinalNumber", case 8: - if(*o3tl::doAccess<bool>(pValues[nProp])) + if (*o3tl::doAccess<bool>(aValues[nProp])) nFlags |= ACFlags::AddNonBrkSpace; break;//"AddNonBreakingSpace" case 9: - if(*o3tl::doAccess<bool>(pValues[nProp])) + if (*o3tl::doAccess<bool>(aValues[nProp])) nFlags |= ACFlags::ChgToEnEmDash; break;//"ChangeDash", case 10: - if(*o3tl::doAccess<bool>(pValues[nProp])) + if (*o3tl::doAccess<bool>(aValues[nProp])) nFlags |= ACFlags::IgnoreDoubleSpace; break;//"RemoveDoubleSpaces", case 11: - if(*o3tl::doAccess<bool>(pValues[nProp])) + if (*o3tl::doAccess<bool>(aValues[nProp])) nFlags |= ACFlags::ChgSglQuotes; break;//"ReplaceSingleQuote", case 12: - pValues[nProp] >>= nTemp; + aValues[nProp] >>= nTemp; rParent.pAutoCorrect->SetStartSingleQuote( sal::static_int_cast< sal_Unicode >( nTemp ) ); break;//"SingleQuoteAtStart", case 13: - pValues[nProp] >>= nTemp; + aValues[nProp] >>= nTemp; rParent.pAutoCorrect->SetEndSingleQuote( sal::static_int_cast< sal_Unicode >( nTemp ) ); break;//"SingleQuoteAtEnd", case 14: - if(*o3tl::doAccess<bool>(pValues[nProp])) + if (*o3tl::doAccess<bool>(aValues[nProp])) nFlags |= ACFlags::ChgQuotes; break;//"ReplaceDoubleQuote", case 15: - pValues[nProp] >>= nTemp; + aValues[nProp] >>= nTemp; rParent.pAutoCorrect->SetStartDoubleQuote( sal::static_int_cast< sal_Unicode >( nTemp ) ); break;//"DoubleQuoteAtStart", case 16: - pValues[nProp] >>= nTemp; + aValues[nProp] >>= nTemp; rParent.pAutoCorrect->SetEndDoubleQuote( sal::static_int_cast< sal_Unicode >( nTemp ) ); break;//"DoubleQuoteAtEnd" case 17: - if(*o3tl::doAccess<bool>(pValues[nProp])) + if (*o3tl::doAccess<bool>(aValues[nProp])) nFlags |= ACFlags::CorrectCapsLock; break;//"CorrectAccidentalCapsLock" case 18: - if(*o3tl::doAccess<bool>(pValues[nProp])) + if (*o3tl::doAccess<bool>(aValues[nProp])) nFlags |= ACFlags::TransliterateRTL; break;//"TransliterateRTL" case 19: - if(*o3tl::doAccess<bool>(pValues[nProp])) + if (*o3tl::doAccess<bool>(aValues[nProp])) nFlags |= ACFlags::ChgAngleQuotes; break;//"ChangeAngleQuotes" case 20: - if(*o3tl::doAccess<bool>(pValues[nProp])) + if (*o3tl::doAccess<bool>(aValues[nProp])) nFlags |= ACFlags::SetDOIAttr; break;//"SetDOIAttr", } @@ -437,7 +436,6 @@ void SvxSwAutoCorrCfg::Load(bool bInit) Sequence<Any> aValues = GetProperties(aNames); if(bInit) EnableNotification(aNames); - const Any* pValues = aValues.getConstArray(); DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed"); if(aValues.getLength() != aNames.getLength()) return; @@ -445,137 +443,137 @@ void SvxSwAutoCorrCfg::Load(bool bInit) SvxSwAutoFormatFlags& rSwFlags = rParent.pAutoCorrect->GetSwFlags(); for(int nProp = 0; nProp < aNames.getLength(); nProp++) { - if(pValues[nProp].hasValue()) + if (aValues[nProp].hasValue()) { switch(nProp) { - case 0: rParent.bFileRel = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Text/FileLinks", - case 1: rParent.bNetRel = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Text/InternetLinks", - case 2: rParent.bAutoTextPreview = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Text/ShowPreview", - case 3: rParent.bAutoTextTip = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Text/ShowToolTip", - case 4: rParent.bSearchInAllCategories = *o3tl::doAccess<bool>(pValues[nProp]); break; //"Text/SearchInAllCategories" - case 5: rSwFlags.bAutoCorrect = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/UseReplacementTable", - case 6: rSwFlags.bCapitalStartSentence = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/TwoCapitalsAtStart", - case 7: rSwFlags.bCapitalStartWord = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/CapitalAtStartSentence", - case 8: rSwFlags.bChgWeightUnderl = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ChangeUnderlineWeight", - case 9: rSwFlags.bSetINetAttr = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/SetInetAttribute", - case 10: rSwFlags.bChgOrdinalNumber = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ChangeOrdinalNumber", - case 11: rSwFlags.bAddNonBrkSpace = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/AddNonBreakingSpace", + case 0: rParent.bFileRel = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Text/FileLinks", + case 1: rParent.bNetRel = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Text/InternetLinks", + case 2: rParent.bAutoTextPreview = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Text/ShowPreview", + case 3: rParent.bAutoTextTip = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Text/ShowToolTip", + case 4: rParent.bSearchInAllCategories = *o3tl::doAccess<bool>(aValues[nProp]); break; //"Text/SearchInAllCategories" + case 5: rSwFlags.bAutoCorrect = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/Option/UseReplacementTable", + case 6: rSwFlags.bCapitalStartSentence = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/Option/TwoCapitalsAtStart", + case 7: rSwFlags.bCapitalStartWord = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/Option/CapitalAtStartSentence", + case 8: rSwFlags.bChgWeightUnderl = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/Option/ChangeUnderlineWeight", + case 9: rSwFlags.bSetINetAttr = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/Option/SetInetAttribute", + case 10: rSwFlags.bChgOrdinalNumber = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/Option/ChangeOrdinalNumber", + case 11: rSwFlags.bAddNonBrkSpace = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/Option/AddNonBreakingSpace", // it doesn't exist here - the common flags are used for that -> LM // case 12: rSwFlags.bChgToEnEmDash = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ChangeDash", - case 13: rSwFlags.bDelEmptyNode = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/DelEmptyParagraphs", - case 14: rSwFlags.bChgUserColl = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ReplaceUserStyle", - case 15: rSwFlags.bChgEnumNum = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ChangeToBullets/Enable", + case 13: rSwFlags.bDelEmptyNode = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/Option/DelEmptyParagraphs", + case 14: rSwFlags.bChgUserColl = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/Option/ReplaceUserStyle", + case 15: rSwFlags.bChgEnumNum = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/Option/ChangeToBullets/Enable", case 16: { - sal_Int32 nVal = 0; pValues[nProp] >>= nVal; + sal_Int32 nVal = 0; aValues[nProp] >>= nVal; rSwFlags.cBullet = sal::static_int_cast< sal_Unicode >(nVal); } break; // "Format/Option/ChangeToBullets/SpecialCharacter/Char", case 17: { - OUString sTemp; pValues[nProp] >>= sTemp; + OUString sTemp; aValues[nProp] >>= sTemp; rSwFlags.aBulletFont.SetFamilyName(sTemp); } break; // "Format/Option/ChangeToBullets/SpecialCharacter/Font", case 18: { - sal_Int32 nVal = 0; pValues[nProp] >>= nVal; + sal_Int32 nVal = 0; aValues[nProp] >>= nVal; rSwFlags.aBulletFont.SetFamily(FontFamily(nVal)); } break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontFamily", case 19: { - sal_Int32 nVal = 0; pValues[nProp] >>= nVal; + sal_Int32 nVal = 0; aValues[nProp] >>= nVal; rSwFlags.aBulletFont.SetCharSet(rtl_TextEncoding(nVal)); } break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontCharset", case 20: { - sal_Int32 nVal = 0; pValues[nProp] >>= nVal; + sal_Int32 nVal = 0; aValues[nProp] >>= nVal; rSwFlags.aBulletFont.SetPitch(FontPitch(nVal)); } break; // "Format/Option/ChangeToBullets/SpecialCharacter/FontPitch", - case 21: rSwFlags.bRightMargin = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/CombineParagraphs", + case 21: rSwFlags.bRightMargin = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/Option/CombineParagraphs", case 22: { - sal_Int32 nVal = 0; pValues[nProp] >>= nVal; + sal_Int32 nVal = 0; aValues[nProp] >>= nVal; rSwFlags.nRightMargin = sal::static_int_cast< sal_uInt8 >(nVal); } break; // "Format/Option/CombineValue", - case 23: rSwFlags.bAFormatDelSpacesAtSttEnd = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/DelSpacesAtStartEnd", - case 24: rSwFlags.bAFormatDelSpacesBetweenLines = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/DelSpacesBetween", - case 25: rParent.bAutoFmtByInput = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/Enable", - case 26: rSwFlags.bChgToEnEmDash = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ChangeDash", - case 27: rSwFlags.bSetNumRule = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ApplyNumbering/Enable", - case 28: rSwFlags.bSetBorder = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ChangeToBorders", - case 29: rSwFlags.bCreateTable = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ChangeToTable", - case 30: rSwFlags.bReplaceStylesByInput = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ReplaceStyle", - case 31: rSwFlags.bAFormatByInpDelSpacesAtSttEnd = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/DelSpacesAtStartEnd", - case 32: rSwFlags.bAFormatByInpDelSpacesBetweenLines = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/DelSpacesBetween", - case 33: rSwFlags.bAutoCompleteWords = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Completion/Enable", + case 23: rSwFlags.bAFormatDelSpacesAtSttEnd = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/Option/DelSpacesAtStartEnd", + case 24: rSwFlags.bAFormatDelSpacesBetweenLines = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/Option/DelSpacesBetween", + case 25: rParent.bAutoFmtByInput = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/ByInput/Enable", + case 26: rSwFlags.bChgToEnEmDash = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/ByInput/ChangeDash", + case 27: rSwFlags.bSetNumRule = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/ByInput/ApplyNumbering/Enable", + case 28: rSwFlags.bSetBorder = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/ByInput/ChangeToBorders", + case 29: rSwFlags.bCreateTable = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/ByInput/ChangeToTable", + case 30: rSwFlags.bReplaceStylesByInput = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/ByInput/ReplaceStyle", + case 31: rSwFlags.bAFormatByInpDelSpacesAtSttEnd = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/ByInput/DelSpacesAtStartEnd", + case 32: rSwFlags.bAFormatByInpDelSpacesBetweenLines = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/ByInput/DelSpacesBetween", + case 33: rSwFlags.bAutoCompleteWords = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Completion/Enable", case 34: { - sal_Int32 nVal = 0; pValues[nProp] >>= nVal; + sal_Int32 nVal = 0; aValues[nProp] >>= nVal; rSwFlags.nAutoCmpltWordLen = sal::static_int_cast< sal_uInt16 >(nVal); } break; // "Completion/MinWordLen", case 35: { - sal_Int32 nVal = 0; pValues[nProp] >>= nVal; + sal_Int32 nVal = 0; aValues[nProp] >>= nVal; rSwFlags.nAutoCmpltListLen = sal::static_int_cast< sal_uInt32 >(nVal); } break; // "Completion/MaxListLen", - case 36: rSwFlags.bAutoCmpltCollectWords = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Completion/CollectWords", - case 37: rSwFlags.bAutoCmpltEndless = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Completion/EndlessList", - case 38: rSwFlags.bAutoCmpltAppendBlank = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Completion/AppendBlank", - case 39: rSwFlags.bAutoCmpltShowAsTip = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Completion/ShowAsTip", + case 36: rSwFlags.bAutoCmpltCollectWords = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Completion/CollectWords", + case 37: rSwFlags.bAutoCmpltEndless = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Completion/EndlessList", + case 38: rSwFlags.bAutoCmpltAppendBlank = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Completion/AppendBlank", + case 39: rSwFlags.bAutoCmpltShowAsTip = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Completion/ShowAsTip", case 40: { - sal_Int32 nVal = 0; pValues[nProp] >>= nVal; + sal_Int32 nVal = 0; aValues[nProp] >>= nVal; rSwFlags.nAutoCmpltExpandKey = sal::static_int_cast< sal_uInt16 >(nVal); } break; // "Completion/AcceptKey" - case 41 :rSwFlags.bAutoCmpltKeepList = *o3tl::doAccess<bool>(pValues[nProp]); break;//"Completion/KeepList" + case 41 :rSwFlags.bAutoCmpltKeepList = *o3tl::doAccess<bool>(aValues[nProp]); break;//"Completion/KeepList" case 42 : { - sal_Int32 nVal = 0; pValues[nProp] >>= nVal; + sal_Int32 nVal = 0; aValues[nProp] >>= nVal; rSwFlags.cByInputBullet = sal::static_int_cast< sal_Unicode >(nVal); } break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Char", case 43 : { - OUString sTemp; pValues[nProp] >>= sTemp; + OUString sTemp; aValues[nProp] >>= sTemp; rSwFlags.aByInputBulletFont.SetFamilyName(sTemp); } break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/Font", case 44 : { - sal_Int32 nVal = 0; pValues[nProp] >>= nVal; + sal_Int32 nVal = 0; aValues[nProp] >>= nVal; rSwFlags.aByInputBulletFont.SetFamily(FontFamily(nVal)); } break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontFamily", case 45 : { - sal_Int32 nVal = 0; pValues[nProp] >>= nVal; + sal_Int32 nVal = 0; aValues[nProp] >>= nVal; rSwFlags.aByInputBulletFont.SetCharSet(rtl_TextEncoding(nVal)); } break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontCharset", case 46 : { - sal_Int32 nVal = 0; pValues[nProp] >>= nVal; + sal_Int32 nVal = 0; aValues[nProp] >>= nVal; rSwFlags.aByInputBulletFont.SetPitch(FontPitch(nVal)); } break;// "Format/ByInput/ApplyNumbering/SpecialCharacter/FontPitch", - case 47: rSwFlags.bSetDOIAttr = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/SetDOIAttribute", - case 48 : rSwFlags.bSetNumRuleAfterSpace = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/ByInput/ApplyNumberingAfterSpace", - case 49 : rSwFlags.bReplaceStyles = *o3tl::doAccess<bool>(pValues[nProp]); break; // "Format/Option/ReplaceStyle", + case 47: rSwFlags.bSetDOIAttr = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/Option/SetDOIAttribute", + case 48 : rSwFlags.bSetNumRuleAfterSpace = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/ByInput/ApplyNumberingAfterSpace", + case 49 : rSwFlags.bReplaceStyles = *o3tl::doAccess<bool>(aValues[nProp]); break; // "Format/Option/ReplaceStyle", } } } diff --git a/editeng/source/misc/hangulhanja.cxx b/editeng/source/misc/hangulhanja.cxx index 3660d963e65a..5334b862a66a 100644 --- a/editeng/source/misc/hangulhanja.cxx +++ b/editeng/source/misc/hangulhanja.cxx @@ -540,11 +540,11 @@ namespace editeng { // silent conversion (e.g. for simplified/traditional Chinese)... if(m_aCurrentSuggestions.hasElements()) - implChange( m_aCurrentSuggestions.getConstArray()[0] ); + implChange( m_aCurrentSuggestions[0] ); } else if (bAutoChange) { - implChange( m_aCurrentSuggestions.getConstArray()[0] ); + implChange( m_aCurrentSuggestions[0] ); } else if ( bAlwaysChangeThis ) { diff --git a/editeng/source/misc/splwrap.cxx b/editeng/source/misc/splwrap.cxx index 8e3684606cfb..1d173980ad70 100644 --- a/editeng/source/misc/splwrap.cxx +++ b/editeng/source/misc/splwrap.cxx @@ -377,14 +377,8 @@ Reference< XDictionary > SvxSpellWrapper::GetAllRightDic() Reference< XSearchableDictionaryList > xDicList( LinguMgr::GetDictionaryList() ); if (xDicList.is()) { - Sequence< Reference< XDictionary > > aDics( xDicList->getDictionaries() ); - const Reference< XDictionary > *pDic = aDics.getConstArray(); - sal_Int32 nCount = aDics.getLength(); - - sal_Int32 i = 0; - while (!xDic.is() && i < nCount) + for (const Reference<XDictionary>& xTmp : xDicList->getDictionaries()) { - Reference< XDictionary > xTmp = pDic[i]; if (xTmp.is()) { if ( xTmp->isActive() && @@ -394,11 +388,11 @@ Reference< XDictionary > SvxSpellWrapper::GetAllRightDic() Reference< frame::XStorable > xStor( xTmp, UNO_QUERY ); if (xStor.is() && xStor->hasLocation() && !xStor->isReadonly()) { - xDic = std::move(xTmp); + xDic = xTmp; + break; } } } - ++i; } if (!xDic.is()) diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx index f4ab6e5cf29c..754944092cf0 100644 --- a/editeng/source/misc/unolingu.cxx +++ b/editeng/source/misc/unolingu.cxx @@ -102,13 +102,12 @@ void ThesDummy_Impl::GetCfgLocales() SvtLinguConfig aCfg; Sequence < OUString > aNodeNames( aCfg.GetNodeNames( u"ServiceManager/ThesaurusList"_ustr ) ); - const OUString *pNodeNames = aNodeNames.getConstArray(); sal_Int32 nLen = aNodeNames.getLength(); pLocaleSeq.reset( new Sequence< lang::Locale >( nLen ) ); lang::Locale *pLocale = pLocaleSeq->getArray(); for (sal_Int32 i = 0; i < nLen; ++i) { - pLocale[i] = LanguageTag::convertToLocaleWithFallback( pNodeNames[i] ); + pLocale[i] = LanguageTag::convertToLocaleWithFallback(aNodeNames[i]); } } @@ -149,17 +148,7 @@ sal_Bool SAL_CALL return xThes->hasLocale( rLocale ); else if (!pLocaleSeq) // if not already loaded save startup time by avoiding loading them now GetCfgLocales(); - bool bFound = false; - sal_Int32 nLen = pLocaleSeq->getLength(); - const lang::Locale *pLocale = pLocaleSeq->getConstArray(); - const lang::Locale *pEnd = pLocale + nLen; - for ( ; pLocale < pEnd && !bFound; ++pLocale) - { - bFound = pLocale->Language == rLocale.Language && - pLocale->Country == rLocale.Country && - pLocale->Variant == rLocale.Variant; - } - return bFound; + return std::find(pLocaleSeq->begin(), pLocaleSeq->end(), rLocale) != pLocaleSeq->end(); } diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index 62b8fa5233b3..af72eb466a8f 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -1085,14 +1085,9 @@ void SAL_CALL OCommonEmbeddedObject::setPersistentEntry( else if ( prop.Value >>= aOutFramePropsTyped ) { aOutFrameProps.realloc( aOutFramePropsTyped.getLength() ); - uno::Any* pProp = aOutFrameProps.getArray(); - for ( const beans::NamedValue* pTypedProp = aOutFramePropsTyped.getConstArray(); - pTypedProp != aOutFramePropsTyped.getConstArray() + aOutFramePropsTyped.getLength(); - ++pTypedProp, ++pProp - ) - { - *pProp <<= *pTypedProp; - } + std::transform(aOutFramePropsTyped.begin(), aOutFramePropsTyped.end(), + aOutFrameProps.getArray(), [](const beans::NamedValue& rTypedProp) + { return uno::Any(rTypedProp); }); m_xDocHolder->SetOutplaceFrameProperties( aOutFrameProps ); } else diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx index 3a1192c737fe..76cae1103862 100644 --- a/eventattacher/source/eventattacher.cxx +++ b/eventattacher/source/eventattacher.cxx @@ -141,10 +141,9 @@ Any SAL_CALL InvocationToAllListenerMapper::invoke(const OUString& FunctionName, sal_uInt32 nParamCount = aParamSeq.getLength(); if( nParamCount > 1 ) { - const ParamInfo* pInfo = aParamSeq.getConstArray(); for( sal_uInt32 i = 0 ; i < nParamCount ; i++ ) { - if( pInfo[ i ].aMode != ParamMode_IN ) + if (aParamSeq[i].aMode != ParamMode_IN) { bApproveFiring = true; break; @@ -587,9 +586,9 @@ Reference<XEventListener> EventAttacherImpl::attachListenerForTarget( Reference< XIdlClass > xListenerType; if( nParamCount == 1 ) - xListenerType = params.getConstArray()[0]; + xListenerType = params[0]; else if( nParamCount == 2 ) - xListenerType = params.getConstArray()[1]; + xListenerType = params[1]; // Request Adapter for the actual Listener type Reference< XInterface > xAdapter = createAllListenerAdapter( @@ -620,7 +619,7 @@ Reference<XEventListener> EventAttacherImpl::attachListenerForTarget( Any* pAnys = args.getArray(); // Check the type of the 1st parameter - Reference< XIdlClass > xParamClass = params.getConstArray()[0]; + Reference< XIdlClass > xParamClass = params[0]; if( xParamClass->getTypeClass() == TypeClass_STRING ) { pAnys[0] <<= aAddListenerParam; @@ -760,14 +759,8 @@ void EventAttacherImpl::removeListener aRemoveListenerName = "remove" + aListenerName; // Search methods for the correct removeListener method - Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods( MethodConcept::LISTENER ); - sal_uInt32 i, nLen = aMethodSeq.getLength(); - const Reference< XIdlMethod >* pMethods = aMethodSeq.getConstArray(); - for( i = 0 ; i < nLen ; i++ ) + for (const Reference<XIdlMethod>& rxMethod : xAccess->getMethods(MethodConcept::LISTENER)) { - // Call Method - const Reference< XIdlMethod >& rxMethod = pMethods[i]; - // Is it the right method? if( aRemoveListenerName == rxMethod->getName() ) { @@ -795,7 +788,7 @@ void EventAttacherImpl::removeListener Any* pAnys = args.getArray(); // Check the type of the 1st parameter - Reference< XIdlClass > xParamClass = params.getConstArray()[0]; + Reference< XIdlClass > xParamClass = params[0]; if( xParamClass->getTypeClass() == TypeClass_STRING ) pAnys[0] <<= AddListenerParam; diff --git a/extensions/source/logging/loggerconfig.cxx b/extensions/source/logging/loggerconfig.cxx index 31f7ce784ae7..7a166f517030 100644 --- a/extensions/source/logging/loggerconfig.cxx +++ b/extensions/source/logging/loggerconfig.cxx @@ -163,21 +163,15 @@ namespace logging Sequence< NamedValue > aSettings( nServiceSettingCount ); if ( nServiceSettingCount ) { - const OUString* pSettingNames = aSettingNames.getConstArray(); - const OUString* pSettingNamesEnd = aSettingNames.getConstArray() + aSettingNames.getLength(); - NamedValue* pSetting = aSettings.getArray(); - - for ( ; - pSettingNames != pSettingNamesEnd; - ++pSettingNames, ++pSetting - ) - { - pSetting->Name = *pSettingNames; - pSetting->Value = xServiceSettingsNode->getByName( *pSettingNames ); - - if ( _pSettingTranslation ) - _pSettingTranslation( _rxLogger, pSetting->Name, pSetting->Value ); - } + std::transform( + aSettingNames.begin(), aSettingNames.end(), aSettings.getArray(), + [&xServiceSettingsNode, &_rxLogger, _pSettingTranslation](const OUString& rName) + { + Any a = xServiceSettingsNode->getByName(rName); + if (_pSettingTranslation) + _pSettingTranslation(_rxLogger, rName, a); + return NamedValue(rName, a); + }); } OUString sServiceName; diff --git a/filter/source/config/cache/basecontainer.cxx b/filter/source/config/cache/basecontainer.cxx index 85e23378361c..8945120c5734 100644 --- a/filter/source/config/cache/basecontainer.cxx +++ b/filter/source/config/cache/basecontainer.cxx @@ -343,7 +343,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL BaseContainer::crea // search the key names of all items, where its properties match // the given ones in its minimum FilterCache* pCache = impl_getWorkingCache(aLock); - lKeys = pCache->getMatchingItemsByProps(m_eType, std::span<const css::beans::NamedValue>( lProperties.getConstArray(), lProperties.getLength() )); + lKeys = pCache->getMatchingItemsByProps(m_eType, std::span(lProperties)); } catch(const css::uno::Exception&) { diff --git a/filter/source/config/cache/cacheitem.cxx b/filter/source/config/cache/cacheitem.cxx index dddb7d464286..a84435482874 100644 --- a/filter/source/config/cache/cacheitem.cxx +++ b/filter/source/config/cache/cacheitem.cxx @@ -189,8 +189,8 @@ static bool isSubSet(const css::uno::Any& aSubSet, (aSet >>= uno_s2) ) { - auto s2Begin = uno_s2.getConstArray(); - auto s2End = uno_s2.getConstArray() + uno_s2.getLength(); + auto s2Begin = uno_s2.begin(); + auto s2End = uno_s2.end(); for (auto const& elem : uno_s1) { diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx index 18f503fb46fb..a8788990de4a 100644 --- a/filter/source/config/cache/filtercache.cxx +++ b/filter/source/config/cache/filtercache.cxx @@ -1001,8 +1001,6 @@ void FilterCache::impl_validateAndOptimize() it = aType.find(PROPNAME_URLPATTERN); if (it != aType.end()) it->second >>= lURLPattern; - sal_Int32 ce = lExtensions.getLength(); - sal_Int32 cu = lURLPattern.getLength(); #if OSL_DEBUG_LEVEL > 0 @@ -1016,7 +1014,7 @@ void FilterCache::impl_validateAndOptimize() ++nWarnings; } - if (!ce && !cu) + if (!lExtensions.hasElements() && !lURLPattern.hasElements()) { sLog.append("Warning : " "The type \"" + sType + "\" does not contain any URL pattern nor any extensions. "); ++nWarnings; @@ -1036,12 +1034,11 @@ void FilterCache::impl_validateAndOptimize() if (it != aType.end()) it->second >>= bPreferred; - const OUString* pExtensions = lExtensions.getConstArray(); - for (sal_Int32 e=0; e<ce; ++e) + for (const OUString& rExt : lExtensions) { // Note: We must be sure that address the right hash entry // does not depend from any upper/lower case problems ... - OUString sNormalizedExtension = pExtensions[e].toAsciiLowerCase(); + OUString sNormalizedExtension = rExt.toAsciiLowerCase(); std::vector<OUString>& lTypesForExtension = m_lExtensions2Types[sNormalizedExtension]; if (::std::find(lTypesForExtension.begin(), lTypesForExtension.end(), sType) != lTypesForExtension.end()) @@ -1053,10 +1050,9 @@ void FilterCache::impl_validateAndOptimize() lTypesForExtension.push_back(sType); } - const OUString* pURLPattern = lURLPattern.getConstArray(); - for (sal_Int32 u=0; u<cu; ++u) + for (const OUString& rURLPattern : lURLPattern) { - std::vector<OUString>& lTypesForURLPattern = m_lURLPattern2Types[pURLPattern[u]]; + std::vector<OUString>& lTypesForURLPattern = m_lURLPattern2Types[rURLPattern]; if (::std::find(lTypesForURLPattern.begin(), lTypesForURLPattern.end(), sType) != lTypesForURLPattern.end()) continue; @@ -1425,11 +1421,9 @@ void FilterCache::impl_loadSet(const css::uno::Reference< css::container::XNameA // But don't update optimized structures like e.g. hash // for mapping extensions to its types! - const OUString* pItems = lItems.getConstArray(); - sal_Int32 c = lItems.getLength(); - for (sal_Int32 i=0; i<c; ++i) + for (const OUString& rItem : lItems) { - CacheItemList::iterator pItem = pCache->find(pItems[i]); + CacheItemList::iterator pItem = pCache->find(rItem); switch(eOption) { // a) read a standard set of properties only or read all @@ -1438,7 +1432,7 @@ void FilterCache::impl_loadSet(const css::uno::Reference< css::container::XNameA { try { - (*pCache)[pItems[i]] = impl_loadItem(xSet, eType, pItems[i], eOption); + (*pCache)[rItem] = impl_loadItem(xSet, eType, rItem, eOption); } catch(const css::uno::Exception& ex) { @@ -1457,12 +1451,12 @@ void FilterCache::impl_loadSet(const css::uno::Reference< css::container::XNameA { if (pItem == pCache->end()) { - OUString sMsg("item \"" + pItems[i] + "\" not found for update!"); + OUString sMsg("item \"" + rItem + "\" not found for update!"); throw css::uno::Exception(sMsg, css::uno::Reference< css::uno::XInterface >()); } try { - CacheItem aItem = impl_loadItem(xSet, eType, pItems[i], eOption); + CacheItem aItem = impl_loadItem(xSet, eType, rItem, eOption); pItem->second.update(aItem); } catch(const css::uno::Exception& ex) @@ -1537,15 +1531,13 @@ void FilterCache::impl_savePatchUINames(const css::uno::Reference< css::containe css::uno::Reference< css::container::XNameContainer > xAdd (xNode, css::uno::UNO_QUERY); css::uno::Sequence< css::beans::PropertyValue > lUINames = rItem.getUnpackedValueOrDefault(PROPNAME_UINAMES, css::uno::Sequence< css::beans::PropertyValue >()); - sal_Int32 c = lUINames.getLength(); - const css::beans::PropertyValue* pUINames = lUINames.getConstArray(); - for (sal_Int32 i=0; i<c; ++i) + for (const auto& rPropertyValue : lUINames) { - if (xNode->hasByName(pUINames[i].Name)) - xNode->replaceByName(pUINames[i].Name, pUINames[i].Value); + if (xNode->hasByName(rPropertyValue.Name)) + xNode->replaceByName(rPropertyValue.Name, rPropertyValue.Value); else - xAdd->insertByName(pUINames[i].Name, pUINames[i].Value); + xAdd->insertByName(rPropertyValue.Name, rPropertyValue.Value); } } @@ -1880,13 +1872,11 @@ SfxFilterFlags FilterCache::impl_convertFlagNames2FlagField(const css::uno::Sequ { SfxFilterFlags nField = SfxFilterFlags::NONE; - const OUString* pNames = lNames.getConstArray(); - sal_Int32 c = lNames.getLength(); - for (sal_Int32 i=0; i<c; ++i) + for (const OUString& rName : lNames) { for (const auto& [eFlag, aName] : flagFilterSwitcher) { - if (pNames[i] == aName) { + if (rName == aName) { nField |= eFlag; break; } diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx index 930cb356ed97..905d03c79416 100644 --- a/forms/source/component/Columns.cxx +++ b/forms/source/component/Columns.cxx @@ -324,13 +324,11 @@ void OGridColumn::clearAggregateProperties( Sequence< Property >& _rProps, bool Sequence< Property > aNewProps( _rProps.getLength() ); Property* pNewProps = aNewProps.getArray(); - const Property* pProps = _rProps.getConstArray(); - const Property* pPropsEnd = pProps + _rProps.getLength(); - for ( ; pProps != pPropsEnd; ++pProps ) + for (const Property& rProp : _rProps) { - if ( aForbiddenProperties.find( pProps->Name ) == aForbiddenProperties.end() - && (bAllowDropDown || pProps->Name != PROPERTY_DROPDOWN)) - *pNewProps++ = *pProps; + if (aForbiddenProperties.find(rProp.Name) == aForbiddenProperties.end() + && (bAllowDropDown || rProp.Name != PROPERTY_DROPDOWN)) + *pNewProps++ = rProp; } aNewProps.realloc( pNewProps - aNewProps.getArray() ); diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index 28a238f720a0..7aa4f265155d 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -778,19 +778,16 @@ void ODatabaseForm::AppendComponent(HtmlSuccessfulObjList& rList, const Referenc Sequence< OUString > aVisibleList; xComponentSet->getPropertyValue( PROPERTY_STRINGITEMLIST ) >>= aVisibleList; sal_Int32 nStringCnt = aVisibleList.getLength(); - const OUString* pStrings = aVisibleList.getConstArray(); // Value list Sequence< OUString > aValueList; xComponentSet->getPropertyValue( PROPERTY_VALUE_SEQ ) >>= aValueList; sal_Int32 nValCnt = aValueList.getLength(); - const OUString* pVals = aValueList.getConstArray(); // Selection Sequence<sal_Int16> aSelectList; xComponentSet->getPropertyValue( PROPERTY_SELECT_SEQ ) >>= aSelectList; sal_Int32 nSelCount = aSelectList.getLength(); - const sal_Int16* pSels = aSelectList.getConstArray(); // Simple or multiple selection // For simple selections MT only accounts for the list's first entry. @@ -803,21 +800,21 @@ void ODatabaseForm::AppendComponent(HtmlSuccessfulObjList& rList, const Referenc sal_Int32 i; for( i=0; i<nSelCount; ++i ) { - if( pSels[i] < nStringCnt ) + if (aSelectList[i] < nStringCnt) ++nCurCnt; } OUString aSubValue; for(i=0; i<nCurCnt; ++i ) { - sal_Int16 nSelPos = pSels[i]; - if (nSelPos < nValCnt && !pVals[nSelPos].isEmpty()) + sal_Int16 nSelPos = aSelectList[i]; + if (nSelPos < nValCnt && !aValueList[nSelPos].isEmpty()) { - aSubValue = pVals[nSelPos]; + aSubValue = aValueList[nSelPos]; } else { - aSubValue = pStrings[nSelPos]; + aSubValue = aVisibleList[nSelPos]; } rList.emplace_back(aName, aSubValue ); } diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx index 4e59d22c0ac6..3ddf67cce561 100644 --- a/forms/source/component/Filter.cxx +++ b/forms/source/component/Filter.cxx @@ -732,9 +732,6 @@ namespace frm void SAL_CALL OFilterControl::initialize( const Sequence< Any >& aArguments ) { - const Any* pArguments = aArguments.getConstArray(); - const Any* pArgumentsEnd = pArguments + aArguments.getLength(); - PropertyValue aProp; NamedValue aValue; const OUString* pName = nullptr; @@ -748,15 +745,15 @@ namespace frm { initControlModel(xControlModel); } - else for ( ; pArguments != pArgumentsEnd; ++pArguments ) + else for (const Any& rArgument : aArguments) { // we recognize PropertyValues and NamedValues - if ( *pArguments >>= aProp ) + if (rArgument >>= aProp) { pName = &aProp.Name; pValue = &aProp.Value; } - else if ( *pArguments >>= aValue ) + else if (rArgument >>= aValue) { pName = &aValue.Name; pValue = &aValue.Value; diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index 305bccf64935..174d858caa06 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -1924,24 +1924,12 @@ namespace frm if (xSet.is()) { // Has the selection been changed? - bool bModified(false); Any aValue = xSet->getPropertyValue(PROPERTY_SELECT_SEQ); Sequence<sal_Int16> const & rSelection = *o3tl::doAccess<Sequence<sal_Int16>>(aValue); Sequence<sal_Int16> const & rOldSelection = *o3tl::doAccess<Sequence<sal_Int16>>(m_aCurrentSelection); - sal_Int32 nLen = rSelection.getLength(); - if (nLen != rOldSelection.getLength()) - bModified = true; - else - { - const sal_Int16* pVal = rSelection.getConstArray(); - const sal_Int16* pCompVal = rOldSelection.getConstArray(); - - while (nLen-- && !bModified) - bModified = pVal[nLen] != pCompVal[nLen]; - } - if (bModified) + if (rSelection != rOldSelection) { m_aCurrentSelection = std::move(aValue); m_aChangeIdle.Start(); diff --git a/forms/source/component/findpos.cxx b/forms/source/component/findpos.cxx index 6b2503ac0bcc..d71445d615bc 100644 --- a/forms/source/component/findpos.cxx +++ b/forms/source/component/findpos.cxx @@ -33,11 +33,9 @@ sal_Int32 findPos( const OUString& aStr, const css::uno::Sequence< OUString >& rList) { - const OUString* pStrList = rList.getConstArray(); - const OUString* pResult = ::std::lower_bound( - pStrList, pStrList + rList.getLength(), aStr ); - if ( ( pResult != pStrList + rList.getLength() ) && ( *pResult == aStr ) ) - return ( pResult - pStrList ); + const OUString* pResult = ::std::lower_bound(rList.begin(), rList.end(), aStr); + if ((pResult != rList.end()) && (*pResult == aStr)) + return std::distance(rList.begin(), pResult); return -1; } diff --git a/forms/source/component/imgprod.cxx b/forms/source/component/imgprod.cxx index 5e0378d0e0c1..f623dfff987e 100644 --- a/forms/source/component/imgprod.cxx +++ b/forms/source/component/imgprod.cxx @@ -324,9 +324,8 @@ void ImageProducer::initialize( const css::uno::Sequence< css::uno::Any >& aArgu { if ( aArguments.getLength() == 1 ) { - css::uno::Any aArg = aArguments.getConstArray()[0]; OUString aURL; - if ( aArg >>= aURL ) + if (aArguments[0] >>= aURL) { SetImage( aURL ); } diff --git a/forms/source/component/propertybaghelper.cxx b/forms/source/component/propertybaghelper.cxx index 8a18a094d415..34c4b7926cae 100644 --- a/forms/source/component/propertybaghelper.cxx +++ b/forms/source/component/propertybaghelper.cxx @@ -30,6 +30,7 @@ #include <comphelper/diagnose_ex.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> @@ -275,16 +276,9 @@ namespace frm DBG_UNHANDLED_EXCEPTION("forms.component"); } Sequence< PropertyValue > aPropertyValues( aValues.getLength() ); - PropertyValue* pPropertyValue = aPropertyValues.getArray(); - - const OUString* pName = aPropertyNames.getConstArray(); - const OUString* pNameEnd = aPropertyNames.getConstArray() + aPropertyNames.getLength(); - const Any* pValue = aValues.getConstArray(); - for ( ; pName != pNameEnd; ++pName, ++pValue, ++pPropertyValue ) - { - pPropertyValue->Name = *pName; - pPropertyValue->Value = *pValue; - } + std::transform(aPropertyNames.begin(), aPropertyNames.end(), aValues.begin(), + aPropertyValues.getArray(), [](const OUString& name, const Any& value) + { return comphelper::makePropertyValue(name, value); }); return aPropertyValues; } @@ -299,30 +293,27 @@ namespace frm // XMultiPropertySet::setPropertyValues expects its arguments to be sorted by name // while XPropertyAccess::setPropertyValues doesn't. So first of all, sort. - Sequence< PropertyValue > aSortedProps( _rProps ); - ::std::sort( aSortedProps.getArray(), aSortedProps.getArray() + nPropertyValues, PropertyValueLessByName() ); + std::vector<PropertyValue> aSortedProps(_rProps.begin(), _rProps.end()); + std::sort(aSortedProps.begin(), aSortedProps.end(), PropertyValueLessByName()); // also, XPropertyAccess::setPropertyValues is expected to throw an UnknownPropertyException // for unsupported properties, while XMultiPropertySet::setPropertyValues is expected to ignore // those. So, check for unsupported properties first. ::comphelper::OPropertyArrayAggregationHelper& rArrayHelper( impl_ts_getArrayHelper() ); - for ( const PropertyValue* pProperties = aSortedProps.getConstArray(); - pProperties != aSortedProps.getConstArray() + nPropertyValues; - ++pProperties - ) + for (const PropertyValue& rProperty : aSortedProps) { - if ( !rArrayHelper.hasPropertyByName( pProperties->Name ) ) - throw UnknownPropertyException( pProperties->Name, m_rContext.getPropertiesInterface() ); + if (!rArrayHelper.hasPropertyByName(rProperty.Name)) + throw UnknownPropertyException(rProperty.Name, m_rContext.getPropertiesInterface()); } // Now finally split into a Name and a Value sequence, and forward to // XMultiPropertySet::setPropertyValues Sequence< OUString > aNames( nPropertyValues ); - ::std::transform( aSortedProps.getConstArray(), aSortedProps.getConstArray() + nPropertyValues, + std::transform(aSortedProps.begin(), aSortedProps.end(), aNames.getArray(), SelectNameOfPropertyValue() ); Sequence< Any > aValues( nPropertyValues ); - ::std::transform( aSortedProps.getConstArray(), aSortedProps.getConstArray() + nPropertyValues, + std::transform(aSortedProps.begin(), aSortedProps.end(), aValues.getArray(), SelectValueOfPropertyValue() ); Reference< XMultiPropertySet > xMe( m_rContext.getPropertiesInterface(), css::uno::UNO_SET_THROW ); diff --git a/forms/source/richtext/richtextcontrol.cxx b/forms/source/richtext/richtextcontrol.cxx index 1dfc5315fee2..5840782e8df9 100644 --- a/forms/source/richtext/richtextcontrol.cxx +++ b/forms/source/richtext/richtextcontrol.cxx @@ -615,14 +615,9 @@ namespace frm Sequence< Reference< XDispatch > > SAL_CALL ORichTextPeer::queryDispatches( const Sequence< DispatchDescriptor >& _rRequests ) { Sequence< Reference< XDispatch > > aReturn( _rRequests.getLength() ); - Reference< XDispatch >* pReturn = aReturn.getArray(); - - const DispatchDescriptor* pRequest = _rRequests.getConstArray(); - const DispatchDescriptor* pRequestEnd = pRequest + _rRequests.getLength(); - for ( ; pRequest != pRequestEnd; ++pRequest, ++pReturn ) - { - *pReturn = queryDispatch( pRequest->FeatureURL, pRequest->FrameName, pRequest->SearchFlags ); - } + std::transform(_rRequests.begin(), _rRequests.end(), aReturn.getArray(), + [this](const DispatchDescriptor& r) + { return queryDispatch(r.FeatureURL, r.FrameName, r.SearchFlags); }); return aReturn; } diff --git a/forms/source/richtext/specialdispatchers.cxx b/forms/source/richtext/specialdispatchers.cxx index d1f99d857259..10611ea339ea 100644 --- a/forms/source/richtext/specialdispatchers.cxx +++ b/forms/source/richtext/specialdispatchers.cxx @@ -140,18 +140,12 @@ namespace frm SfxPoolItemHolder OAsianFontLayoutDispatcher::convertDispatchArgsToItem( const Sequence< PropertyValue >& _rArguments ) { // look for the "Enable" parameter - const PropertyValue* pLookup = _rArguments.getConstArray(); - const PropertyValue* pLookupEnd = _rArguments.getConstArray() + _rArguments.getLength(); - while ( pLookup != pLookupEnd ) - { - if ( pLookup->Name == "Enable" ) - break; - ++pLookup; - } - if ( pLookup != pLookupEnd ) + for (const PropertyValue& rArgument : _rArguments) { + if (rArgument.Name != "Enable") + continue; -e ... etc. - the rest is truncated
