diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-29 01:31:19 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-30 06:20:50 +0200 |
commit | ea9367037232054a576f1e6aabffeb3a62ffa44b (patch) | |
tree | ea5c755830b87fc140e9c3ce027b4957956fae48 /extensions/source | |
parent | e82c9633e4f9bc4590bd6cd8d2a82a974ddaf00f (diff) |
Drop some uses of css::uno::Sequence::getConstArray ...
where it was obsoleted by commits 2484de6728bd11bb7949003d112f1ece2223c7a1
(Remove non-const Sequence::begin()/end() in internal code, 2021-10-15) and
fb3c04bd1930eedacd406874e1a285d62bbf27d9 (Drop non-const Sequence::operator[]
in internal code 2021-11-05).
Change-Id: I4ccc647bb794515c8c11f8dfd9a26563f4aa094b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166819
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'extensions/source')
-rw-r--r-- | extensions/source/abpilot/datasourcehandling.cxx | 14 | ||||
-rw-r--r-- | extensions/source/abpilot/fieldmappingimpl.cxx | 24 | ||||
-rw-r--r-- | extensions/source/bibliography/bibconfig.cxx | 31 | ||||
-rw-r--r-- | extensions/source/bibliography/bibload.cxx | 2 | ||||
-rw-r--r-- | extensions/source/bibliography/datman.cxx | 54 | ||||
-rw-r--r-- | extensions/source/bibliography/framectr.cxx | 12 | ||||
-rw-r--r-- | extensions/source/bibliography/toolbar.cxx | 16 | ||||
-rw-r--r-- | extensions/source/dbpilots/controlwizard.cxx | 21 | ||||
-rw-r--r-- | extensions/source/dbpilots/gridwizard.cxx | 19 |
9 files changed, 74 insertions, 119 deletions
diff --git a/extensions/source/abpilot/datasourcehandling.cxx b/extensions/source/abpilot/datasourcehandling.cxx index fd5820fce1ee..c26066b8daaa 100644 --- a/extensions/source/abpilot/datasourcehandling.cxx +++ b/extensions/source/abpilot/datasourcehandling.cxx @@ -199,12 +199,8 @@ namespace abp m_pImpl->xContext.set( lcl_getDataSourceContext( _rxORB ), UNO_QUERY_THROW ); // collect the data source names - Sequence< OUString > aDSNames = m_pImpl->xContext->getElementNames(); - const OUString* pDSNames = aDSNames.getConstArray(); - const OUString* pDSNamesEnd = pDSNames + aDSNames.getLength(); - - for ( ;pDSNames != pDSNamesEnd; ++pDSNames ) - m_pImpl->aDataSourceNames.insert( *pDSNames ); + for (auto& rDSName : m_pImpl->xContext->getElementNames()) + m_pImpl->aDataSourceNames.insert(rDSName); } catch( const Exception& ) { @@ -487,10 +483,8 @@ namespace abp aTableNames = xTables->getElementNames( ); // copy the names - const OUString* pTableNames = aTableNames.getConstArray(); - const OUString* pTableNamesEnd = pTableNames + aTableNames.getLength(); - for (;pTableNames < pTableNamesEnd; ++pTableNames) - m_pImpl->aTables.insert( *pTableNames ); + for (auto& rTableName : aTableNames) + m_pImpl->aTables.insert(rTableName); } catch(const Exception&) { diff --git a/extensions/source/abpilot/fieldmappingimpl.cxx b/extensions/source/abpilot/fieldmappingimpl.cxx index b8e8ac56686c..3b54e7504f1d 100644 --- a/extensions/source/abpilot/fieldmappingimpl.cxx +++ b/extensions/source/abpilot/fieldmappingimpl.cxx @@ -90,10 +90,8 @@ namespace abp DBG_ASSERT( bSuccess, "fieldmapping::invokeDialog: invalid property type for FieldMapping!" ); // and copy it into the map - const AliasProgrammaticPair* pMapping = aMapping.getConstArray(); - const AliasProgrammaticPair* pMappingEnd = pMapping + aMapping.getLength(); - for (;pMapping != pMappingEnd; ++pMapping) - _rSettings.aFieldMapping[ pMapping->ProgrammaticName ] = pMapping->Alias; + for (auto& rMapping : aMapping) + _rSettings.aFieldMapping[rMapping.ProgrammaticName] = rMapping.Alias; return true; } @@ -214,37 +212,33 @@ namespace abp OConfigurationNode aFields = aAddressBookSettings.openNode( OUString( "Fields" ) ); // loop through all existent fields - Sequence< OUString > aExistentFields = aFields.getNodeNames(); - const OUString* pExistentFields = aExistentFields.getConstArray(); - const OUString* pExistentFieldsEnd = pExistentFields + aExistentFields.getLength(); - static constexpr OUString sProgrammaticNodeName( u"ProgrammaticFieldName"_ustr ); static constexpr OUString sAssignedNodeName( u"AssignedFieldName"_ustr ); - for ( ; pExistentFields != pExistentFieldsEnd; ++pExistentFields ) + for (auto& rExistentField : aFields.getNodeNames()) { SAL_WARN_IF( - ((aFields.openNode(*pExistentFields) + ((aFields.openNode(rExistentField) .getNodeValue(sProgrammaticNodeName).get<OUString>()) - != *pExistentFields), + != rExistentField), "extensions.abpilot", "fieldmapping::writeTemplateAddressFieldMapping: inconsistent config data!"); // there should be a redundancy in the config data... if this asserts, there isn't anymore! // do we have a new alias for the programmatic? - MapString2String::iterator aPos = aFieldAssignment.find( *pExistentFields ); + MapString2String::iterator aPos = aFieldAssignment.find(rExistentField); if ( aFieldAssignment.end() != aPos ) { // yes // -> set a new value - OConfigurationNode aExistentField = aFields.openNode( *pExistentFields ); + OConfigurationNode aExistentField = aFields.openNode(rExistentField); aExistentField.setNodeValue( sAssignedNodeName, Any( aPos->second ) ); // and remove the mapping entry - aFieldAssignment.erase( *pExistentFields ); + aFieldAssignment.erase(rExistentField); } else { // no // -> remove it - aFields.removeNode( *pExistentFields ); + aFields.removeNode(rExistentField); } } diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx index 11ba8999a62c..746e136c25f3 100644 --- a/extensions/source/bibliography/bibconfig.cxx +++ b/extensions/source/bibliography/bibconfig.cxx @@ -95,24 +95,23 @@ BibConfig::BibConfig() const Sequence< OUString > aPropertyNames = GetPropertyNames(); const Sequence<Any> aPropertyValues = GetProperties( aPropertyNames ); - const Any* pValues = aPropertyValues.getConstArray(); if(aPropertyValues.getLength() == aPropertyNames.getLength()) { for(int nProp = 0; nProp < aPropertyNames.getLength(); nProp++) { - if(pValues[nProp].hasValue()) + if (aPropertyValues[nProp].hasValue()) { switch(nProp) { - case 0: pValues[nProp] >>= sDataSource; break; - case 1: pValues[nProp] >>= sTableOrQuery; break; - case 2: pValues[nProp] >>= nTblOrQuery; break; - case 3: pValues[nProp] >>= nBeamerSize; break; - case 4: pValues[nProp] >>= nViewSize ; break; - case 5: pValues[nProp] >>= sQueryText ; break; - case 6: pValues[nProp] >>= sQueryField; break; + case 0: aPropertyValues[nProp] >>= sDataSource; break; + case 1: aPropertyValues[nProp] >>= sTableOrQuery; break; + case 2: aPropertyValues[nProp] >>= nTblOrQuery; break; + case 3: aPropertyValues[nProp] >>= nBeamerSize; break; + case 4: aPropertyValues[nProp] >>= nViewSize ; break; + case 5: aPropertyValues[nProp] >>= sQueryText ; break; + case 6: aPropertyValues[nProp] >>= sQueryField; break; case 7: - bShowColumnAssignmentWarning = *o3tl::doAccess<bool>(pValues[nProp]); + bShowColumnAssignmentWarning = *o3tl::doAccess<bool>(aPropertyValues[nProp]); break; } } @@ -130,14 +129,13 @@ BibConfig::BibConfig() pHistoryNames[2] = sPrefix + "CommandType"; Sequence<Any> aHistoryValues = GetProperties( aHistoryNames ); - const Any* pHistoryValues = aHistoryValues.getConstArray(); if(aHistoryValues.getLength() == aHistoryNames.getLength()) { Mapping* pMapping = new Mapping; - pHistoryValues[0] >>= pMapping->sURL; - pHistoryValues[1] >>= pMapping->sTableName; - pHistoryValues[2] >>= pMapping->nCommandType; + aHistoryValues[0] >>= pMapping->sURL; + aHistoryValues[1] >>= pMapping->sTableName; + aHistoryValues[2] >>= pMapping->nCommandType; //field assignment is contained in another set sPrefix += "Fields"; const Sequence< OUString > aAssignmentNodeNames = GetNodeNames(sPrefix); @@ -153,15 +151,14 @@ BibConfig::BibConfig() pAssignmentPropertyNames[nFieldIdx++] += "/AssignedFieldName"; } Sequence<Any> aAssignmentValues = GetProperties(aAssignmentPropertyNames); - const Any* pAssignmentValues = aAssignmentValues.getConstArray(); OUString sTempLogical; OUString sTempReal; sal_Int16 nSetMapping = 0; nFieldIdx = 0; for(sal_Int32 nFieldVal = 0; nFieldVal < aAssignmentValues.getLength() / 2; nFieldVal++) { - pAssignmentValues[nFieldIdx++] >>= sTempLogical; - pAssignmentValues[nFieldIdx++] >>= sTempReal; + aAssignmentValues[nFieldIdx++] >>= sTempLogical; + aAssignmentValues[nFieldIdx++] >>= sTempReal; if(!(sTempLogical.isEmpty() || sTempReal.isEmpty())) { pMapping->aColumnPairs[nSetMapping].sLogicalColumnName = sTempLogical; diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx index c8d88d8d0160..755b43d8defa 100644 --- a/extensions/source/bibliography/bibload.cxx +++ b/extensions/source/bibliography/bibload.cxx @@ -207,7 +207,7 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, DBChangeDialogConfig_Impl aConfig; const Sequence<OUString> aSources = aConfig.GetDataSourceNames(); if(aSources.hasElements()) - aBibDesc.sDataSource = aSources.getConstArray()[0]; + aBibDesc.sDataSource = aSources[0]; } m_xDatMan->createDatabaseForm( aBibDesc ); diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx index a15a3e889c18..407645c1df89 100644 --- a/extensions/source/bibliography/datman.cxx +++ b/extensions/source/bibliography/datman.cxx @@ -948,48 +948,42 @@ void BibDataManager::setActiveDataTable(const OUString& rTable) Reference< XConnection > xConnection = getConnection( m_xForm ); Reference< XTablesSupplier > xSupplyTables(xConnection, UNO_QUERY); Reference< XNameAccess > xAccess = xSupplyTables->getTables(); - Sequence< OUString > aTableNameSeq = xAccess->getElementNames(); - sal_uInt32 nCount = aTableNameSeq.getLength(); - const OUString* pTableNames = aTableNameSeq.getConstArray(); - const OUString* pTableNamesEnd = pTableNames + nCount; - - for ( ; pTableNames != pTableNamesEnd; ++pTableNames ) + for (auto& rTableName: xAccess->getElementNames()) { - if ( rTable == *pTableNames ) + if (rTable == rTableName) { aActiveDataTable = rTable; Any aVal; aVal <<= rTable; aPropertySet->setPropertyValue( "Command", aVal ); - break; - } - } - if (pTableNames != pTableNamesEnd) - { - Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData(); - aQuoteChar = xMetaData->getIdentifierQuoteString(); - Reference< XMultiServiceFactory > xFactory(xConnection, UNO_QUERY); - if ( xFactory.is() ) - m_xParser.set( xFactory->createInstance("com.sun.star.sdb.SingleSelectQueryComposer"), UNO_QUERY ); + Reference<XDatabaseMetaData> xMetaData = xConnection->getMetaData(); + aQuoteChar = xMetaData->getIdentifierQuoteString(); - OUString aString("SELECT * FROM "); + Reference<XMultiServiceFactory> xFactory(xConnection, UNO_QUERY); + if (xFactory.is()) + m_xParser.set( xFactory->createInstance("com.sun.star.sdb.SingleSelectQueryComposer"), UNO_QUERY ); - OUString sCatalog, sSchema, sName; - ::dbtools::qualifiedNameComponents( xMetaData, aActiveDataTable, sCatalog, sSchema, sName, ::dbtools::EComposeRule::InDataManipulation ); - aString += ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sName ); + OUString aString("SELECT * FROM "); - m_xParser->setElementaryQuery(aString); + OUString sCatalog, sSchema, sName; + ::dbtools::qualifiedNameComponents( xMetaData, aActiveDataTable, sCatalog, sSchema, sName, ::dbtools::EComposeRule::InDataManipulation ); + aString += ::dbtools::composeTableNameForSelect( xConnection, sCatalog, sSchema, sName ); - BibConfig* pConfig = BibModul::GetConfig(); - pConfig->setQueryField(getQueryField()); - startQueryWith(pConfig->getQueryText()); + m_xParser->setElementaryQuery(aString); + + BibConfig* pConfig = BibModul::GetConfig(); + pConfig->setQueryField(getQueryField()); + startQueryWith(pConfig->getQueryText()); + + BibDBDescriptor aDesc; + aDesc.sDataSource = aDataSourceURL; + aDesc.sTableOrQuery = aActiveDataTable; + aDesc.nCommandType = CommandType::TABLE; + BibModul::GetConfig()->SetBibliographyURL(aDesc); - BibDBDescriptor aDesc; - aDesc.sDataSource = aDataSourceURL; - aDesc.sTableOrQuery = aActiveDataTable; - aDesc.nCommandType = CommandType::TABLE; - BibModul::GetConfig()->SetBibliographyURL(aDesc); + break; + } } } } diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx index 758c8b3484c2..7e0ec6e93938 100644 --- a/extensions/source/bibliography/framectr.cxx +++ b/extensions/source/bibliography/framectr.cxx @@ -431,14 +431,11 @@ void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequen } } - const beans::PropertyValue* pPropertyValue = aArgs.getConstArray(); - uno::Any aValue=pPropertyValue[0].Value; OUString aQuery; - aValue >>= aQuery; + aArgs[0].Value >>= aQuery; - aValue=pPropertyValue[1].Value; OUString aQueryField; - aValue >>= aQueryField; + aArgs[1].Value >>= aQueryField; BibConfig* pConfig = BibModul::GetConfig(); pConfig->setQueryField(aQueryField); m_xDatMan->startQueryWith(aQuery); @@ -806,15 +803,14 @@ void BibFrameController_Impl::RemoveFilter() void BibFrameController_Impl::ChangeDataSource(const uno::Sequence< beans::PropertyValue >& aArgs) { - const beans::PropertyValue* pPropertyValue = aArgs.getConstArray(); - uno::Any aValue=pPropertyValue[0].Value; + uno::Any aValue = aArgs[0].Value; OUString aDBTableName; aValue >>= aDBTableName; if(aArgs.getLength() > 1) { - uno::Any aDB = pPropertyValue[1].Value; + uno::Any aDB = aArgs[1].Value; OUString aURL; aDB >>= aURL; m_xDatMan->setActiveDataSource(aURL); diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx index e4041c5a80f1..35bd6b2320fb 100644 --- a/extensions/source/bibliography/toolbar.cxx +++ b/extensions/source/bibliography/toolbar.cxx @@ -100,13 +100,8 @@ void BibTBListBoxListener::statusChanged(const css::frame::FeatureStateEvent& rE pToolBar->UpdateSourceList(false); pToolBar->ClearSourceList(); - const OUString* pStringArray = pStringSeq->getConstArray(); - - sal_uInt32 nCount = pStringSeq->getLength(); - OUString aEntry; - for( sal_uInt32 i=0; i<nCount; i++ ) + for (auto& aEntry : *pStringSeq) { - aEntry = pStringArray[i]; pToolBar->InsertSourceEntry(aEntry); } pToolBar->UpdateSourceList(true); @@ -139,13 +134,10 @@ void BibTBQueryMenuListener::statusChanged(const frame::FeatureStateEvent& rEvt) pToolBar->ClearFilterMenu(); - const OUString* pStringArray = pStringSeq->getConstArray(); - - sal_uInt32 nCount = pStringSeq->getLength(); - for( sal_uInt32 i=0; i<nCount; i++ ) + for (auto& string : *pStringSeq) { - sal_uInt16 nID = pToolBar->InsertFilterItem(pStringArray[i]); - if(pStringArray[i]==rEvt.FeatureDescriptor) + sal_uInt16 nID = pToolBar->InsertFilterItem(string); + if (string == rEvt.FeatureDescriptor) { pToolBar->SelectFilterItem(nID); } diff --git a/extensions/source/dbpilots/controlwizard.cxx b/extensions/source/dbpilots/controlwizard.cxx index 1b0d3ceaf77c..5a3eca35b539 100644 --- a/extensions/source/dbpilots/controlwizard.cxx +++ b/extensions/source/dbpilots/controlwizard.cxx @@ -116,23 +116,18 @@ namespace dbp void OControlWizardPage::fillListBox(weld::TreeView& _rList, const Sequence< OUString >& _rItems) { _rList.clear(); - const OUString* pItems = _rItems.getConstArray(); - const OUString* pEnd = pItems + _rItems.getLength(); - sal_Int32 nIndex = 0; - for (;pItems < pEnd; ++pItems, ++nIndex) + for (sal_Int32 nIndex = 0; nIndex < _rItems.getLength(); ++nIndex) { - _rList.append(OUString::number(nIndex), *pItems); + _rList.append(OUString::number(nIndex), _rItems[nIndex]); } } void OControlWizardPage::fillListBox(weld::ComboBox& _rList, const Sequence< OUString >& _rItems) { _rList.clear(); - const OUString* pItems = _rItems.getConstArray(); - const OUString* pEnd = pItems + _rItems.getLength(); - for (;pItems < pEnd; ++pItems) + for (auto& item : _rItems) { - _rList.append_text(*pItems); + _rList.append_text(item); } } @@ -539,15 +534,13 @@ namespace dbp if (xColumns.is()) { m_aContext.aFieldNames = xColumns->getElementNames(); - const OUString* pBegin = m_aContext.aFieldNames.getConstArray(); - const OUString* pEnd = pBegin + m_aContext.aFieldNames.getLength(); - for(;pBegin != pEnd;++pBegin) + for (auto& name : m_aContext.aFieldNames) { sal_Int32 nFieldType = DataType::OTHER; try { Reference< XPropertySet > xColumn; - xColumns->getByName(*pBegin) >>= xColumn; + xColumns->getByName(name) >>= xColumn; xColumn->getPropertyValue("Type") >>= nFieldType; } catch(const Exception&) @@ -556,7 +549,7 @@ namespace dbp "extensions.dbpilots", "unexpected exception while gathering column information!"); } - m_aContext.aTypes.emplace(*pBegin,nFieldType); + m_aContext.aTypes.emplace(name, nFieldType); } } } diff --git a/extensions/source/dbpilots/gridwizard.cxx b/extensions/source/dbpilots/gridwizard.cxx index 4b382e228264..ec61df855503 100644 --- a/extensions/source/dbpilots/gridwizard.cxx +++ b/extensions/source/dbpilots/gridwizard.cxx @@ -105,17 +105,15 @@ namespace dbp aFormFieldNames.reserve(getSettings().aSelectedFields.getLength()); // loop through the selected field names - const OUString* pSelectedFields = getSettings().aSelectedFields.getConstArray(); - const OUString* pEnd = pSelectedFields + getSettings().aSelectedFields.getLength(); - for (;pSelectedFields < pEnd; ++pSelectedFields) + for (auto& selectedField : getSettings().aSelectedFields) { // get the information for the selected column sal_Int32 nFieldType = DataType::OTHER; - OControlWizardContext::TNameTypeMap::const_iterator aFind = rContext.aTypes.find(*pSelectedFields); + OControlWizardContext::TNameTypeMap::const_iterator aFind = rContext.aTypes.find(selectedField); if ( aFind != rContext.aTypes.end() ) nFieldType = aFind->second; - aFormFieldNames.push_back(*pSelectedFields); + aFormFieldNames.push_back(selectedField); switch (nFieldType) { case DataType::BIT: @@ -154,7 +152,7 @@ namespace dbp aColumnServiceNames.emplace_back("DateField"); aColumnLabelPostfixes.push_back(compmodule::ModuleRes(RID_STR_DATEPOSTFIX)); - aFormFieldNames.push_back(*pSelectedFields); + aFormFieldNames.push_back(selectedField); aColumnServiceNames.emplace_back("TimeField"); aColumnLabelPostfixes.push_back(compmodule::ModuleRes(RID_STR_TIMEPOSTFIX)); break; @@ -324,13 +322,10 @@ namespace dbp fillListBox(*m_xExistFields, rContext.aFieldNames); m_xSelFields->clear(); - const OGridSettings& rSettings = getSettings(); - const OUString* pSelected = rSettings.aSelectedFields.getConstArray(); - const OUString* pEnd = pSelected + rSettings.aSelectedFields.getLength(); - for (; pSelected < pEnd; ++pSelected) + for (auto& field : getSettings().aSelectedFields) { - m_xSelFields->append_text(*pSelected); - m_xExistFields->remove_text(*pSelected); + m_xSelFields->append_text(field); + m_xExistFields->remove_text(field); } implCheckButtons(); |