summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-08-15 11:26:29 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-08-15 14:18:49 +0200
commit5a526f9196a8aeb527a2fc6d7c081812770c28be (patch)
tree076a324476d79bf397fb97d5884db571106425e8
parentcf3fb54debffeab546085e648c73c576343be9f4 (diff)
loplugin:sequenceloop dbaccess..extensions
Change-Id: I0eb33a8e293eb8afd0cf5a933384c44e023a2e6b Reviewed-on: https://gerrit.libreoffice.org/77498 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--dbaccess/source/core/api/query.cxx3
-rw-r--r--dbaccess/source/core/dataaccess/connection.cxx2
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.cxx2
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx2
-rw-r--r--dbaccess/source/core/dataaccess/databaseregistrations.cxx4
-rw-r--r--dbaccess/source/core/dataaccess/datasource.cxx6
-rw-r--r--dbaccess/source/core/misc/ContainerMediator.cxx2
-rw-r--r--dbaccess/source/core/recovery/dbdocrecovery.cxx2
-rw-r--r--dbaccess/source/ext/macromigration/migrationengine.cxx8
-rw-r--r--dbaccess/source/ui/browser/exsrcbrw.cxx2
-rw-r--r--dbaccess/source/ui/browser/formadapter.cxx3
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx12
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.cxx2
-rw-r--r--dbaccess/source/ui/dlg/adtabdlg.cxx2
-rw-r--r--dbaccess/source/ui/dlg/dbfindex.cxx3
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/QueryTableView.cxx3
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx9
-rw-r--r--desktop/source/lib/init.cxx8
-rw-r--r--desktop/source/migration/migration.cxx13
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx3
-rw-r--r--extensions/source/bibliography/datman.cxx6
-rw-r--r--extensions/source/propctrlr/eventhandler.cxx3
-rw-r--r--extensions/source/propctrlr/formcomponenthandler.cxx17
-rw-r--r--extensions/source/propctrlr/genericpropertyhandler.cxx2
-rw-r--r--extensions/source/propctrlr/propcontroller.cxx2
-rw-r--r--extensions/source/propctrlr/taborder.cxx5
27 files changed, 74 insertions, 54 deletions
diff --git a/dbaccess/source/core/api/query.cxx b/dbaccess/source/core/api/query.cxx
index 76cc0130cc94..ddb1f59c2ef6 100644
--- a/dbaccess/source/core/api/query.cxx
+++ b/dbaccess/source/core/api/query.cxx
@@ -168,7 +168,8 @@ void OQuery::rebuildColumns()
throw RuntimeException();
}
- for ( const OUString& rName : xColumns->getElementNames() )
+ const Sequence<OUString> aColNames = xColumns->getElementNames();
+ for ( const OUString& rName : aColNames )
{
Reference<XPropertySet> xSource(xColumns->getByName( rName ),UNO_QUERY);
OUString sLabel = rName;
diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx
index 313fac79f6f7..988d20182a68 100644
--- a/dbaccess/source/core/dataaccess/connection.cxx
+++ b/dbaccess/source/core/dataaccess/connection.cxx
@@ -762,7 +762,7 @@ void OConnection::impl_checkTableQueryNames_nothrow()
std::set< OUString > aSortedTableNames( aTableNames.begin(), aTableNames.end() );
Reference< XNameAccess > xQueries( getQueries() );
- Sequence< OUString > aQueryNames( xQueries->getElementNames() );
+ const Sequence< OUString > aQueryNames( xQueries->getElementNames() );
for ( auto const & queryName : aQueryNames )
{
diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx
index 447c85767979..0bcdb475c353 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.cxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.cxx
@@ -481,7 +481,7 @@ void ODatabaseContext::storeTransientProperties( ODatabaseModelImpl& _rModelImpl
if (xSetInfo.is())
aProperties = xSetInfo->getProperties();
- for ( const Property& rProperty : aProperties )
+ for ( const Property& rProperty : std::as_const(aProperties) )
{
if ( ( ( rProperty.Attributes & PropertyAttribute::TRANSIENT) != 0 )
&& ( ( rProperty.Attributes & PropertyAttribute::READONLY) == 0 )
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 21250ea0723d..b5ee7df84635 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -571,7 +571,7 @@ namespace
{
Reference< css::sdb::application::XDatabaseDocumentUI > xDatabaseUI( i_rController, UNO_QUERY_THROW );
- Sequence< Reference< XComponent > > aComponents( xDatabaseUI->getSubComponents() );
+ const Sequence< Reference< XComponent > > aComponents( xDatabaseUI->getSubComponents() );
bool isAnyModified = false;
for ( auto const & xComponent : aComponents )
diff --git a/dbaccess/source/core/dataaccess/databaseregistrations.cxx b/dbaccess/source/core/dataaccess/databaseregistrations.cxx
index 052226a3d921..9178e60efd85 100644
--- a/dbaccess/source/core/dataaccess/databaseregistrations.cxx
+++ b/dbaccess/source/core/dataaccess/databaseregistrations.cxx
@@ -153,7 +153,7 @@ namespace dbaccess
::utl::OConfigurationNode DatabaseRegistrations::impl_getNodeForName_nothrow( const OUString& _rName )
{
- Sequence< OUString > aNames( m_aConfigurationRoot.getNodeNames() );
+ const Sequence< OUString > aNames( m_aConfigurationRoot.getNodeNames() );
for ( auto const & nodeName : aNames )
{
::utl::OConfigurationNode aNodeForName = m_aConfigurationRoot.openNode( nodeName );
@@ -241,7 +241,7 @@ namespace dbaccess
if ( !m_aConfigurationRoot.isValid() )
throw RuntimeException( OUString(), *this );
- Sequence< OUString > aProgrammaticNames( m_aConfigurationRoot.getNodeNames() );
+ const Sequence< OUString > aProgrammaticNames( m_aConfigurationRoot.getNodeNames() );
Sequence< OUString > aDisplayNames( aProgrammaticNames.getLength() );
OUString* pDisplayName = aDisplayNames.getArray();
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index 25b3558d275b..4085d705f67b 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -854,7 +854,7 @@ sal_Bool ODatabaseSource::convertFastPropertyValue(Any & rConvertedValue, Any &
if (!(rValue >>= aValues))
throw IllegalArgumentException();
- for ( auto const & checkName : aValues )
+ for ( auto const & checkName : std::as_const(aValues) )
{
if ( checkName.Name.isEmpty() )
throw IllegalArgumentException();
@@ -926,7 +926,7 @@ namespace
{
// obtain all properties currently known at the bag
Reference< XPropertySetInfo > xPSI( _rxPropertyBag->getPropertySetInfo(), UNO_SET_THROW );
- Sequence< Property > aAllExistentProperties( xPSI->getProperties() );
+ const Sequence< Property > aAllExistentProperties( xPSI->getProperties() );
Reference< XPropertyState > xPropertyState( _rxPropertyBag, UNO_QUERY_THROW );
@@ -1032,7 +1032,7 @@ void ODatabaseSource::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) con
// collect the property attributes of all current settings
Reference< XPropertySet > xSettingsAsProps( m_pImpl->m_xSettings, UNO_QUERY_THROW );
Reference< XPropertySetInfo > xPST( xSettingsAsProps->getPropertySetInfo(), UNO_SET_THROW );
- Sequence< Property > aSettings( xPST->getProperties() );
+ const Sequence< Property > aSettings( xPST->getProperties() );
std::map< OUString, sal_Int32 > aPropertyAttributes;
for ( auto const & setting : aSettings )
{
diff --git a/dbaccess/source/core/misc/ContainerMediator.cxx b/dbaccess/source/core/misc/ContainerMediator.cxx
index e899f1a16935..0b06d9404ffd 100644
--- a/dbaccess/source/core/misc/ContainerMediator.cxx
+++ b/dbaccess/source/core/misc/ContainerMediator.cxx
@@ -210,7 +210,7 @@ void OContainerMediator::notifyElementCreated( const OUString& _sName, const Ref
// collect the to-be-monitored properties
Reference< XPropertySetInfo > xPSI( _xDest->getPropertySetInfo(), UNO_SET_THROW );
- Sequence< Property > aProperties( xPSI->getProperties() );
+ const Sequence< Property > aProperties( xPSI->getProperties() );
for ( auto const & property : aProperties )
{
if ( ( property.Attributes & PropertyAttribute::READONLY ) != 0 )
diff --git a/dbaccess/source/core/recovery/dbdocrecovery.cxx b/dbaccess/source/core/recovery/dbdocrecovery.cxx
index be0e50586da9..e330ce0cbc04 100644
--- a/dbaccess/source/core/recovery/dbdocrecovery.cxx
+++ b/dbaccess/source/core/recovery/dbdocrecovery.cxx
@@ -242,7 +242,7 @@ namespace dbaccess
for (auto const& controller : i_rControllers)
{
Reference< XDatabaseDocumentUI > xDatabaseUI(controller, UNO_QUERY_THROW);
- Sequence< Reference< XComponent > > aComponents( xDatabaseUI->getSubComponents() );
+ const Sequence< Reference< XComponent > > aComponents( xDatabaseUI->getSubComponents() );
for ( auto const & component : aComponents )
{
diff --git a/dbaccess/source/ext/macromigration/migrationengine.cxx b/dbaccess/source/ext/macromigration/migrationengine.cxx
index 254eaaa9091a..59369641b413 100644
--- a/dbaccess/source/ext/macromigration/migrationengine.cxx
+++ b/dbaccess/source/ext/macromigration/migrationengine.cxx
@@ -966,7 +966,7 @@ namespace dbmm
_rContainerLoc.isEmpty() ? OUString() :
OUString( _rContainerLoc + "/" ) );
- Sequence< OUString > aElementNames( _rxContainer->getElementNames() );
+ const Sequence< OUString > aElementNames( _rxContainer->getElementNames() );
for ( auto const & elementName : aElementNames )
{
Any aElement( _rxContainer->getByName( elementName ) );
@@ -1431,7 +1431,7 @@ namespace dbmm
Reference< XNameAccess > xSourceLib( xSourceLibraries->getByName( *pSourceLibName ), UNO_QUERY_THROW );
Reference< XNameContainer > xTargetLib( xTargetLibraries->createLibrary( sNewLibName ), UNO_SET_THROW );
- Sequence< OUString > aLibElementNames( xSourceLib->getElementNames() );
+ const Sequence< OUString > aLibElementNames( xSourceLib->getElementNames() );
for ( auto const & sourceElementName : aLibElementNames )
{
Any aElement = xSourceLib->getByName( sourceElementName );
@@ -1627,7 +1627,7 @@ namespace dbmm
return;
Reference< XNameReplace > xEvents( xSuppEvents->getEvents(), UNO_SET_THROW );
- Sequence< OUString > aEventNames = xEvents->getElementNames();
+ const Sequence< OUString > aEventNames = xEvents->getElementNames();
Any aEvent;
for ( auto const & eventName : aEventNames )
@@ -1658,7 +1658,7 @@ namespace dbmm
{
Reference< XScriptEventsSupplier > xEventsSupplier( _rxElement, UNO_QUERY_THROW );
Reference< XNameReplace > xEvents( xEventsSupplier->getEvents(), UNO_QUERY_THROW );
- Sequence< OUString > aEventNames( xEvents->getElementNames() );
+ const Sequence< OUString > aEventNames( xEvents->getElementNames() );
ScriptEventDescriptor aScriptEvent;
for ( OUString const & eventName : aEventNames )
diff --git a/dbaccess/source/ui/browser/exsrcbrw.cxx b/dbaccess/source/ui/browser/exsrcbrw.cxx
index d835731c3df1..597ab6a73dff 100644
--- a/dbaccess/source/ui/browser/exsrcbrw.cxx
+++ b/dbaccess/source/ui/browser/exsrcbrw.cxx
@@ -182,7 +182,7 @@ void SAL_CALL SbaExternalSourceBrowser::dispatch(const css::util::URL& aURL, con
// set its properties
if (xNewColProperties.is())
{
- for (const css::beans::PropertyValue& rControlProp : aControlProps)
+ for (const css::beans::PropertyValue& rControlProp : std::as_const(aControlProps))
{
try
{
diff --git a/dbaccess/source/ui/browser/formadapter.cxx b/dbaccess/source/ui/browser/formadapter.cxx
index cd1400a5c15f..aea58079ff23 100644
--- a/dbaccess/source/ui/browser/formadapter.cxx
+++ b/dbaccess/source/ui/browser/formadapter.cxx
@@ -1202,7 +1202,8 @@ Reference< css::beans::XPropertySetInfo > SAL_CALL SbaXFormAdapter::getPropertyS
if (-1 == m_nNamePropHandle)
{
// we need to determine the handle for the NAME property
- for (const css::beans::Property& rProp : xReturn->getProperties())
+ const Sequence<css::beans::Property> aProps = xReturn->getProperties();
+ for (const css::beans::Property& rProp : aProps)
{
if (rProp.Name == PROPERTY_NAME)
{
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index f28149f84284..6903e7c5565e 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -657,7 +657,8 @@ void SbaTableQueryBrowser::InitializeGridModel(const Reference< css::form::XForm
OUString sDefaultProperty;
Reference< XPropertySet > xColumn;
Reference< XPropertySetInfo > xColPSI;
- for (const OUString& rName : xColumns->getElementNames())
+ const Sequence<OUString> aColNames = xColumns->getElementNames();
+ for (const OUString& rName : aColNames)
{
xColumn.set( xColumns->getByName( rName ), UNO_QUERY_THROW );
xColPSI.set( xColumn->getPropertySetInfo(), UNO_SET_THROW );
@@ -2059,7 +2060,8 @@ void SbaTableQueryBrowser::initializeTreeModel()
OUString sQueriesName, sTablesName;
// fill the model with the names of the registered datasources
- for (const OUString& rDatasource : m_xDatabaseContext->getElementNames())
+ const Sequence<OUString> aDatasourceNames = m_xDatabaseContext->getElementNames();
+ for (const OUString& rDatasource : aDatasourceNames)
implAddDatasource( rDatasource, aDBImage, sQueriesName, aQueriesImage, sTablesName, aTablesImage, SharedConnection() );
}
}
@@ -2074,7 +2076,8 @@ void SbaTableQueryBrowser::populateTree(const Reference<XNameAccess>& _xNameAcce
try
{
- for (const OUString& rName : _xNameAccess->getElementNames())
+ const Sequence<OUString> aNames = _xNameAccess->getElementNames();
+ for (const OUString& rName : aNames)
{
if( !m_pTreeView->getListBox().GetEntryPosByName(rName,_pParent))
{
@@ -3557,7 +3560,8 @@ void SbaTableQueryBrowser::clearGridColumns(const Reference< XNameContainer >& _
{
// first we have to clear the grid
Reference< XInterface > xColumn;
- for (const OUString& rName : _xColContainer->getElementNames())
+ const Sequence<OUString> aColNames = _xColContainer->getElementNames();
+ for (const OUString& rName : aColNames)
{
_xColContainer->getByName(rName) >>= xColumn;
_xColContainer->removeByName(rName);
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index 26ffae2aff03..2d12a18ad546 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -583,7 +583,7 @@ void ODbDataSourceAdministrationHelper::translateProperties(const Reference< XPr
// collect the names of the additional settings
PropertyValueSet aInfos;
- for (const PropertyValue& rAdditionalInfo : aAdditionalInfo)
+ for (const PropertyValue& rAdditionalInfo : std::as_const(aAdditionalInfo))
{
if( rAdditionalInfo.Name == "JDBCDRV" )
{ // compatibility
diff --git a/dbaccess/source/ui/dlg/adtabdlg.cxx b/dbaccess/source/ui/dlg/adtabdlg.cxx
index 1add8474188e..9cb22f5fbb10 100644
--- a/dbaccess/source/ui/dlg/adtabdlg.cxx
+++ b/dbaccess/source/ui/dlg/adtabdlg.cxx
@@ -300,7 +300,7 @@ void QueryListFacade::updateTableObjectList( bool /*_bAllowViews*/ )
Reference< XContainer> xContainer(xQueries,UNO_QUERY_THROW);
m_pContainerListener = new ::comphelper::OContainerListenerAdapter(this,xContainer);
}
- Sequence< OUString > aQueryNames = xQueries->getElementNames();
+ const Sequence< OUString > aQueryNames = xQueries->getElementNames();
for ( auto const & name : aQueryNames )
m_rQueryList.append("", name, aQueryImage);
diff --git a/dbaccess/source/ui/dlg/dbfindex.cxx b/dbaccess/source/ui/dlg/dbfindex.cxx
index fe934b7914c0..42bcff9585e7 100644
--- a/dbaccess/source/ui/dlg/dbfindex.cxx
+++ b/dbaccess/source/ui/dlg/dbfindex.cxx
@@ -261,7 +261,8 @@ void ODbaseIndexDialog::Init()
std::vector< OUString > aUsedIndexes;
aURL.SetSmartProtocol(INetProtocol::File);
- for(const OUString& rURL : ::utl::LocalFileHelper::GetFolderContents(m_aDSN, bFolder))
+ const Sequence<OUString> aFolderUrls = ::utl::LocalFileHelper::GetFolderContents(m_aDSN, bFolder);
+ for(const OUString& rURL : aFolderUrls)
{
OUString aName;
osl::FileBase::getSystemPathFromFileURL(rURL,aName);
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index 4cd6b43d889f..47414efe08ab 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -908,7 +908,7 @@ bool appendToFilter(const Reference<XConnection>& _xConnection,
xProp->getPropertyValue(PROPERTY_TABLEFILTER) >>= aFilter;
// first check if we have something like SCHEMA.%
bool bHasToInsert = true;
- for (const OUString& rItem : aFilter)
+ for (const OUString& rItem : std::as_const(aFilter))
{
if(rItem.indexOf('%') != -1)
{
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index 2cab54cad51d..f6123e2b9676 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -137,7 +137,8 @@ namespace
OUString sRelatedColumn;
// iterate through all foreignkey columns to create the connections
- for(const OUString& rElement : _rxSourceForeignKeyColumns->getElementNames())
+ const Sequence<OUString> aKeyCols = _rxSourceForeignKeyColumns->getElementNames();
+ for(const OUString& rElement : aKeyCols)
{
Reference<XPropertySet> xColumn;
if ( !( _rxSourceForeignKeyColumns->getByName(rElement) >>= xColumn ) )
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index 3aff255781d2..b7b8a11b4579 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -777,7 +777,8 @@ void OTableController::loadData()
// sal_Bool bReadOldRow = xMetaData->supportsAlterTableWithAddColumn() && xMetaData->supportsAlterTableWithDropColumn();
bool bIsAlterAllowed = isAlterAllowed();
- for(const OUString& rColumn : xColumns->getElementNames())
+ const Sequence<OUString> aColNames = xColumns->getElementNames();
+ for(const OUString& rColumn : aColNames)
{
Reference<XPropertySet> xColumn;
xColumns->getByName(rColumn) >>= xColumn;
@@ -847,7 +848,8 @@ void OTableController::loadData()
Reference<XNameAccess> xKeyColumns = getKeyColumns();
if(xKeyColumns.is())
{
- for(const OUString& rKeyColumn : xKeyColumns->getElementNames())
+ const Sequence<OUString> aKeyColumnNames = xKeyColumns->getElementNames();
+ for(const OUString& rKeyColumn : aKeyColumnNames)
{
for(std::shared_ptr<OTableRow> const& pRow : m_vRowList)
{
@@ -1158,7 +1160,8 @@ void OTableController::alterColumns()
// now we have to look for the columns who could be deleted
if ( xDrop.is() )
{
- for(const OUString& rColumnName : xColumns->getElementNames())
+ const Sequence<OUString> aColNames = xColumns->getElementNames();
+ for(const OUString& rColumnName : aColNames)
{
if(aColumns.find(rColumnName) == aColumns.end()) // found a column to delete
{
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 2a86c3f6a94f..c04f5c461dea 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2184,7 +2184,7 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha
// saveAs() is more like save-a-copy, which allows saving to any
// random format like PDF or PNG.
// It is not a real filter option, so we have to filter it out.
- uno::Sequence<OUString> aOptionSeq = comphelper::string::convertCommaSeparated(aFilterOptions);
+ const uno::Sequence<OUString> aOptionSeq = comphelper::string::convertCommaSeparated(aFilterOptions);
std::vector<OUString> aFilteredOptionVec;
bool bTakeOwnership = false;
MediaDescriptor aSaveMediaDescriptor;
@@ -4019,7 +4019,7 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
}
}
- uno::Sequence<OUString> aStyles = xStyleFamily->getElementNames();
+ const uno::Sequence<OUString> aStyles = xStyleFamily->getElementNames();
for (const OUString& rStyle: aStyles )
{
// Filter out the default styles - they are already at the top
@@ -4959,7 +4959,7 @@ static char* lo_getFilterTypes(LibreOfficeKit* pThis)
}
uno::Reference<container::XNameAccess> xTypeDetection(xSFactory->createInstance("com.sun.star.document.TypeDetection"), uno::UNO_QUERY);
- uno::Sequence<OUString> aTypes = xTypeDetection->getElementNames();
+ const uno::Sequence<OUString> aTypes = xTypeDetection->getElementNames();
boost::property_tree::ptree aTree;
for (const OUString& rType : aTypes)
{
@@ -5228,7 +5228,7 @@ static void preloadData()
aLocales = xSpell->getLocales();
}
- for (const auto& aLocale : aLocales)
+ for (const auto& aLocale : std::as_const(aLocales))
{
//TODO: Add more types and cache more aggressively. For now this initializes the fontcache.
using namespace ::com::sun::star::i18n::ScriptType;
diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx
index 5d9f68e8e467..93bf9cd3e89b 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -383,38 +383,39 @@ migrations_vr MigrationImpl::readMigrationSteps(const OUString& rMigrationName)
uno::Reference< XNameAccess > tmpAccess;
uno::Sequence< OUString > tmpSeq;
migrations_vr vrMigrations(new migrations_v);
- for (const OUString& rMigrationStep : theNameAccess->getElementNames()) {
+ const css::uno::Sequence<OUString> aMigrationSteps = theNameAccess->getElementNames();
+ for (const OUString& rMigrationStep : aMigrationSteps) {
// get current migration step
theNameAccess->getByName(rMigrationStep) >>= tmpAccess;
migration_step tmpStep;
// read included files from current step description
if (tmpAccess->getByName("IncludedFiles") >>= tmpSeq) {
- for (const OUString& rSeqEntry : tmpSeq)
+ for (const OUString& rSeqEntry : std::as_const(tmpSeq))
tmpStep.includeFiles.push_back(rSeqEntry);
}
// excluded files...
if (tmpAccess->getByName("ExcludedFiles") >>= tmpSeq) {
- for (const OUString& rSeqEntry : tmpSeq)
+ for (const OUString& rSeqEntry : std::as_const(tmpSeq))
tmpStep.excludeFiles.push_back(rSeqEntry);
}
// included nodes...
if (tmpAccess->getByName("IncludedNodes") >>= tmpSeq) {
- for (const OUString& rSeqEntry : tmpSeq)
+ for (const OUString& rSeqEntry : std::as_const(tmpSeq))
tmpStep.includeConfig.push_back(rSeqEntry);
}
// excluded nodes...
if (tmpAccess->getByName("ExcludedNodes") >>= tmpSeq) {
- for (const OUString& rSeqEntry : tmpSeq)
+ for (const OUString& rSeqEntry : std::as_const(tmpSeq))
tmpStep.excludeConfig.push_back(rSeqEntry);
}
// excluded extensions...
if (tmpAccess->getByName("ExcludedExtensions") >>= tmpSeq) {
- for (const OUString& rSeqEntry : tmpSeq)
+ for (const OUString& rSeqEntry : std::as_const(tmpSeq))
tmpStep.excludeExtensions.push_back(rSeqEntry);
}
diff --git a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx
index c17e2ccbb9d1..fb04a35bccda 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx
@@ -280,7 +280,8 @@ void CommandEnvironmentImpl::handle(
}
// select:
- for ( auto const& rCont : xRequest->getContinuations() )
+ const css::uno::Sequence<css::uno::Reference<css::task::XInteractionContinuation>> xIC = xRequest->getContinuations();
+ for ( auto const& rCont : xIC )
{
if (approve) {
Reference<task::XInteractionApprove> xInteractionApprove(
diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx
index aaaff07f1b6e..64201ff405fb 100644
--- a/extensions/source/bibliography/datman.cxx
+++ b/extensions/source/bibliography/datman.cxx
@@ -318,7 +318,8 @@ MappingDialog_Impl::MappingDialog_Impl(weld::Window* pParent, BibDataManager* pM
DBG_ASSERT(xFields.is(), "MappingDialog_Impl::MappingDialog_Impl : gave me an invalid form !");
if (xFields.is())
{
- for(const OUString& rName : xFields->getElementNames())
+ const Sequence<OUString> aFieldNames = xFields->getElementNames();
+ for(const OUString& rName : aFieldNames)
aListBoxes[0]->append_text(rName);
}
@@ -579,7 +580,8 @@ void BibDataManager::InsertFields(const Reference< XFormComponent > & _rxGrid)
Reference< XPropertySet > xField;
- for ( const OUString& rField : xFields->getElementNames() )
+ const Sequence<OUString> aFieldNames = xFields->getElementNames();
+ for ( const OUString& rField : aFieldNames )
{
xFields->getByName( rField ) >>= xField;
diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx
index d53cdba2172c..badaab0d23e7 100644
--- a/extensions/source/propctrlr/eventhandler.cxx
+++ b/extensions/source/propctrlr/eventhandler.cxx
@@ -702,7 +702,8 @@ namespace pcr
continue;
// loop through all methods
- for (const OUString& rMethod : comphelper::getEventMethodsForType( rListener ))
+ const Sequence<OUString> aEventMethods = comphelper::getEventMethodsForType( rListener );
+ for (const OUString& rMethod : aEventMethods)
{
EventDescription aEvent;
if ( !lcl_getEventDescriptionForMethod( rMethod, aEvent ) )
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 93464c0f2669..e65f62ac8b2d 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -277,7 +277,7 @@ namespace pcr
aResolvedStrings.reserve( aStrings.getLength() );
try
{
- for ( const OUString& rIdStr : aStrings )
+ for ( const OUString& rIdStr : std::as_const(aStrings) )
{
OUString aPureIdStr = rIdStr.copy( 1 );
if( xStringResourceResolver->hasEntryForId( aPureIdStr ) )
@@ -330,7 +330,7 @@ namespace pcr
if( ! (_rValue >>= aFontPropertyValues) )
SAL_WARN("extensions.propctrlr", "setPropertyValue: unable to get property " << PROPERTY_ID_FONT);
- for ( const NamedValue& fontPropertyValue : aFontPropertyValues )
+ for ( const NamedValue& fontPropertyValue : std::as_const(aFontPropertyValues) )
m_xComponent->setPropertyValue( fontPropertyValue.Name, fontPropertyValue.Value );
}
else
@@ -392,7 +392,7 @@ namespace pcr
}
// Move strings to new Ids for all locales
- Sequence< Locale > aLocaleSeq = xStringResourceManager->getLocales();
+ const Sequence< Locale > aLocaleSeq = xStringResourceManager->getLocales();
Sequence< OUString > aOldIdStrings;
aPropertyValue >>= aOldIdStrings;
try
@@ -445,7 +445,7 @@ namespace pcr
aValue <<= aNewIdStrings;
// Remove old ids from resource for all locales
- for( const OUString& rIdStr : aOldIdStrings )
+ for( const OUString& rIdStr : std::as_const(aOldIdStrings) )
{
OUString aPureIdStr = rIdStr.copy( 1 );
for ( const Locale& rLocale : aLocaleSeq )
@@ -2365,7 +2365,8 @@ namespace pcr
if( ! (xFormSet->getPropertyValue( PROPERTY_COMMANDTYPE ) >>= nObjectType) )
SAL_WARN("extensions.propctrlr", "impl_initFieldList_nothrow: unable to get property " PROPERTY_COMMANDTYPE);
- for ( const OUString& rField : ::dbtools::getFieldNamesByCommandDescriptor( m_xRowSetConnection, nObjectType, sObjectName ) )
+ const Sequence<OUString> aNames = ::dbtools::getFieldNamesByCommandDescriptor( m_xRowSetConnection, nObjectType, sObjectName );
+ for ( const OUString& rField : aNames )
_rFieldNames.push_back( rField );
}
}
@@ -2500,7 +2501,8 @@ namespace pcr
if ( !xTableNames.is() )
return;
- for ( const OUString& rTableName : xTableNames->getElementNames() )
+ const Sequence<OUString> aNames = xTableNames->getElementNames();
+ for ( const OUString& rTableName : aNames )
_out_rNames.push_back( rTableName );
}
@@ -2527,7 +2529,8 @@ namespace pcr
bool bAdd = !_sName.isEmpty();
- for ( const OUString& rQueryName : _xQueryNames->getElementNames() )
+ const Sequence<OUString> aQueryNames =_xQueryNames->getElementNames();
+ for ( const OUString& rQueryName : aQueryNames )
{
OUStringBuffer sTemp;
if ( bAdd )
diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx
index 20e668c569a3..955426c434ce 100644
--- a/extensions/source/propctrlr/genericpropertyhandler.cxx
+++ b/extensions/source/propctrlr/genericpropertyhandler.cxx
@@ -470,7 +470,7 @@ namespace pcr
aProperties = xPSI->getProperties();
DBG_ASSERT( aProperties.hasElements(), "GenericPropertyHandler::getSupportedProperties: no properties!" );
- for ( auto const & property : aProperties )
+ for ( auto const & property : std::as_const(aProperties) )
{
switch ( property.Type.getTypeClass() )
{
diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx
index 1b789bf86764..862f76c4154e 100644
--- a/extensions/source/propctrlr/propcontroller.cxx
+++ b/extensions/source/propctrlr/propcontroller.cxx
@@ -1413,7 +1413,7 @@ namespace pcr
if ( m_xModel.is() )
aHandlerFactories = m_xModel->getHandlerFactories();
- for ( auto const & handlerFactory : aHandlerFactories )
+ for ( auto const & handlerFactory : std::as_const(aHandlerFactories) )
{
if ( _rObjects.size() == 1 )
{ // we're inspecting only one object -> one handler
diff --git a/extensions/source/propctrlr/taborder.cxx b/extensions/source/propctrlr/taborder.cxx
index 8163ce6c3c3b..3fc08b9599a5 100644
--- a/extensions/source/propctrlr/taborder.cxx
+++ b/extensions/source/propctrlr/taborder.cxx
@@ -165,7 +165,8 @@ namespace pcr
OUString aName;
OUString aImage;
- for ( auto const& rControlModel : m_xTempModel->getControlModels() )
+ const Sequence<Reference<css::awt::XControlModel>> aControlModels = m_xTempModel->getControlModels();
+ for ( auto const& rControlModel : aControlModels )
{
Reference< XPropertySet > xControl( rControlModel, UNO_QUERY );
Reference< XPropertySetInfo > xPI;
@@ -237,7 +238,7 @@ namespace pcr
{
int nEntryCount = m_xLB_Controls->n_children();
Sequence< Reference< XControlModel > > aSortedControlModelSeq( nEntryCount );
- Sequence< Reference< XControlModel > > aControlModels( m_xTempModel->getControlModels());
+ const Sequence< Reference< XControlModel > > aControlModels( m_xTempModel->getControlModels());
Reference< XControlModel > * pSortedControlModels = aSortedControlModelSeq.getArray();
for (int i = 0; i < nEntryCount; ++i)