summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-12-17 23:00:24 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-12-18 07:36:32 +0100
commit4e144751f12a06e358e4f7efa7c8f13954e6cfd7 (patch)
treec6df66d58d02ecaf5caa437a944665fe83959402 /extensions
parent39c618caf5aa19da95285bec6cab7108bee3984c (diff)
loplugin:unusedindex
Change-Id: I256a807dd2a4c81126b5a76f3d472e31b8224146 Reviewed-on: https://gerrit.libreoffice.org/46652 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/bibliography/datman.cxx68
-rw-r--r--extensions/source/propctrlr/eventhandler.cxx11
-rw-r--r--extensions/source/propctrlr/formcomponenthandler.cxx79
-rw-r--r--extensions/source/propctrlr/taborder.cxx14
4 files changed, 55 insertions, 117 deletions
diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx
index a49f854013f2..c189ffc3c300 100644
--- a/extensions/source/bibliography/datman.cxx
+++ b/extensions/source/bibliography/datman.cxx
@@ -329,12 +329,8 @@ MappingDialog_Impl::MappingDialog_Impl(vcl::Window* pParent, BibDataManager* pMa
DBG_ASSERT(xFields.is(), "MappingDialog_Impl::MappingDialog_Impl : gave me an invalid form !");
if(xFields.is())
{
- Sequence< OUString > aNames = xFields->getElementNames();
- sal_Int32 nFieldsCount = aNames.getLength();
- const OUString* pNames = aNames.getConstArray();
-
- for(sal_Int32 nField = 0; nField < nFieldsCount; nField++)
- aListBoxes[0]->InsertEntry(pNames[nField]);
+ for(const OUString& rName : xFields->getElementNames())
+ aListBoxes[0]->InsertEntry(rName);
}
Link<ListBox&,void> aLnk = LINK(this, MappingDialog_Impl, ListBoxSelectHdl);
@@ -486,10 +482,8 @@ DBChangeDialog_Impl::DBChangeDialog_Impl(vcl::Window* pParent, BibDataManager* p
try
{
OUString sActiveSource = pDatMan->getActiveDataSource();
- const Sequence< OUString >& rSources = aConfig.GetDataSourceNames();
- const OUString* pSourceNames = rSources.getConstArray();
- for (sal_Int32 i = 0; i < rSources.getLength(); ++i)
- m_pSelectionLB->InsertEntry(pSourceNames[i]);
+ for (const OUString& rSourceName : aConfig.GetDataSourceNames())
+ m_pSelectionLB->InsertEntry(rSourceName);
m_pSelectionLB->SelectEntry(sActiveSource);
}
@@ -566,10 +560,9 @@ css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL
{
Sequence< Reference< XDispatch> > aReturn( aDescripts.getLength() );
Reference< XDispatch >* pReturn = aReturn.getArray();
- const DispatchDescriptor* pDescripts = aDescripts.getConstArray();
- for ( sal_Int32 i=0; i<aDescripts.getLength(); ++i, ++pReturn, ++pDescripts )
+ for ( const DispatchDescriptor& rDescript : aDescripts )
{
- *pReturn = queryDispatch( pDescripts->FeatureURL, pDescripts->FrameName, pDescripts->SearchFlags );
+ *pReturn++ = queryDispatch( rDescript.FeatureURL, rDescript.FrameName, rDescript.SearchFlags );
}
return aReturn;
}
@@ -650,11 +643,8 @@ void BibDataManager::InsertFields(const Reference< XFormComponent > & _rxGrid)
// remove the old fields
if ( xColContainer->hasElements() )
{
- Sequence< OUString > aNames = xColContainer->getElementNames();
- const OUString* pNames = aNames.getConstArray();
- const OUString* pNamesEnd = pNames + aNames.getLength();
- for ( ; pNames != pNamesEnd; ++pNames )
- xColContainer->removeByName( *pNames );
+ for ( OUString& rName : xColContainer->getElementNames() )
+ xColContainer->removeByName( rName );
}
Reference< XNameAccess > xFields = getColumns( m_xForm );
@@ -665,13 +655,9 @@ void BibDataManager::InsertFields(const Reference< XFormComponent > & _rxGrid)
Reference< XPropertySet > xField;
- Sequence< OUString > aFields( xFields->getElementNames() );
- const OUString* pFields = aFields.getConstArray();
- const OUString* pFieldsEnd = pFields + aFields.getLength();
-
- for ( ; pFields != pFieldsEnd; ++pFields )
+ for ( const OUString& rField : xFields->getElementNames() )
{
- xFields->getByName( *pFields ) >>= xField;
+ xFields->getByName( rField ) >>= xField;
OUString sCurrentModelType;
const OUString sType("Type");
@@ -713,11 +699,11 @@ void BibDataManager::InsertFields(const Reference< XFormComponent > & _rxGrid)
Any aFormatted(bFormattedIsNumeric);
xCurrentCol->setPropertyValue("TreatAsNumber", aFormatted);
}
- Any aColName = makeAny( *pFields );
+ Any aColName = makeAny( rField );
xCurrentCol->setPropertyValue(FM_PROP_CONTROLSOURCE, aColName);
xCurrentCol->setPropertyValue(FM_PROP_LABEL, aColName);
- xColContainer->insertByName( *pFields, makeAny( xCurrentCol ) );
+ xColContainer->insertByName( rField, makeAny( xCurrentCol ) );
}
}
catch (const Exception&)
@@ -796,12 +782,11 @@ Reference< XForm > BibDataManager::createDatabaseForm(BibDBDescriptor& rDesc)
if(aTableNameSeq.getLength() > 0)
{
- const OUString* pTableNames = aTableNameSeq.getConstArray();
if(!rDesc.sTableOrQuery.isEmpty())
aActiveDataTable = rDesc.sTableOrQuery;
else
{
- rDesc.sTableOrQuery = aActiveDataTable = pTableNames[0];
+ rDesc.sTableOrQuery = aActiveDataTable = aTableNameSeq[0];
rDesc.nCommandType = CommandType::TABLE;
}
@@ -918,11 +903,10 @@ OUString BibDataManager::getQueryField()
OUString aFieldString = pConfig->getQueryField();
if(aFieldString.isEmpty())
{
- Sequence< OUString > aSeq = getQueryFields();
- const OUString* pFields = aSeq.getConstArray();
+ const Sequence< OUString > aSeq = getQueryFields();
if(aSeq.getLength()>0)
{
- aFieldString=pFields[0];
+ aFieldString=aSeq[0];
}
}
return aFieldString;
@@ -986,8 +970,7 @@ void BibDataManager::setActiveDataSource(const OUString& rURL)
}
if(aTableNameSeq.getLength() > 0)
{
- const OUString* pTableNames = aTableNameSeq.getConstArray();
- aActiveDataTable = pTableNames[0];
+ aActiveDataTable = aTableNameSeq[0];
aVal <<= aActiveDataTable;
aPropertySet->setPropertyValue("Command", aVal);
aPropertySet->setPropertyValue("CommandType", makeAny(CommandType::TABLE));
@@ -1431,17 +1414,12 @@ void BibDataManager::SetMeAsUidListener()
if (!xFields.is())
return;
- Sequence< OUString > aFields(xFields->getElementNames());
- const OUString* pFields = aFields.getConstArray();
- sal_Int32 nCount=aFields.getLength();
OUString theFieldName;
- for( sal_Int32 i=0; i<nCount; i++ )
+ for( const OUString& rName : xFields->getElementNames() )
{
- const OUString& rName = pFields[i];
-
if (rName.equalsIgnoreAsciiCase(STR_UID))
{
- theFieldName=pFields[i];
+ theFieldName=rName;
break;
}
}
@@ -1472,18 +1450,12 @@ void BibDataManager::RemoveMeAsUidListener()
if (!xFields.is())
return;
-
- Sequence< OUString > aFields(xFields->getElementNames());
- const OUString* pFields = aFields.getConstArray();
- sal_Int32 nCount=aFields.getLength();
OUString theFieldName;
- for( sal_Int32 i=0; i<nCount; i++ )
+ for(const OUString& rName : xFields->getElementNames() )
{
- const OUString& rName = pFields[i];
-
if (rName.equalsIgnoreAsciiCase(STR_UID))
{
- theFieldName=pFields[i];
+ theFieldName=rName;
break;
}
}
diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx
index 90df51b7c7ac..0cb98a68d822 100644
--- a/extensions/source/propctrlr/eventhandler.cxx
+++ b/extensions/source/propctrlr/eventhandler.cxx
@@ -712,22 +712,17 @@ namespace pcr
continue;
// loop through all methods
- Sequence< OUString > aMethods( comphelper::getEventMethodsForType( rListener ) );
-
- const OUString* pMethods = aMethods.getConstArray();
- sal_uInt32 methodCount = aMethods.getLength();
-
- for (sal_uInt32 method = 0 ; method < methodCount ; ++method, ++pMethods )
+ for (const OUString& rMethod : comphelper::getEventMethodsForType( rListener ))
{
EventDescription aEvent;
- if ( !lcl_getEventDescriptionForMethod( *pMethods, aEvent ) )
+ if ( !lcl_getEventDescriptionForMethod( rMethod, aEvent ) )
continue;
if ( !impl_filterMethod_nothrow( aEvent ) )
continue;
m_aEvents.emplace(
- lcl_getEventPropertyName( sListenerClassName, *pMethods ), aEvent );
+ lcl_getEventPropertyName( sListenerClassName, rMethod ), aEvent );
}
}
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 0f7ebacb8689..89c44b73054b 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -272,21 +272,17 @@ namespace pcr
Sequence< OUString > aStrings;
aPropertyValue >>= aStrings;
- const OUString* pStrings = aStrings.getConstArray();
- sal_Int32 nCount = aStrings.getLength();
-
std::vector< OUString > aResolvedStrings;
- aResolvedStrings.resize( nCount );
+ aResolvedStrings.reserve( aStrings.getLength() );
try
{
- for ( sal_Int32 i = 0; i < nCount; ++i )
+ for ( const OUString& rIdStr : aStrings )
{
- OUString aIdStr = pStrings[i];
- OUString aPureIdStr = aIdStr.copy( 1 );
+ OUString aPureIdStr = rIdStr.copy( 1 );
if( xStringResourceResolver->hasEntryForId( aPureIdStr ) )
- aResolvedStrings[i] = xStringResourceResolver->resolveString( aPureIdStr );
+ aResolvedStrings.push_back(xStringResourceResolver->resolveString( aPureIdStr ));
else
- aResolvedStrings[i] = aIdStr;
+ aResolvedStrings.push_back(rIdStr);
}
}
catch( const resource::MissingResourceException & )
@@ -333,10 +329,8 @@ namespace pcr
// special handling, the value is a faked value we generated ourself in impl_executeFontDialog_nothrow
Sequence< NamedValue > aFontPropertyValues;
OSL_VERIFY( _rValue >>= aFontPropertyValues );
- const NamedValue* fontPropertyValue = aFontPropertyValues.getConstArray();
- const NamedValue* fontPropertyValueEnd = fontPropertyValue + aFontPropertyValues.getLength();
- for ( ; fontPropertyValue != fontPropertyValueEnd; ++fontPropertyValue )
- m_xComponent->setPropertyValue( fontPropertyValue->Name, fontPropertyValue->Value );
+ for ( const NamedValue& fontPropertyValue : aFontPropertyValues )
+ m_xComponent->setPropertyValue( fontPropertyValue.Name, fontPropertyValue.Value );
}
else
{
@@ -374,8 +368,7 @@ namespace pcr
Sequence< OUString > aNewStrings;
_rValue >>= aNewStrings;
- const OUString* pNewStrings = aNewStrings.getConstArray();
- sal_Int32 nNewCount = aNewStrings.getLength();
+ const sal_Int32 nNewCount = aNewStrings.getLength();
// Create new Ids
std::unique_ptr<OUString[]> pNewPureIds(new OUString[nNewCount]);
@@ -399,8 +392,6 @@ namespace pcr
// Move strings to new Ids for all locales
Sequence< Locale > aLocaleSeq = xStringResourceManager->getLocales();
- const Locale* pLocale = aLocaleSeq.getConstArray();
- sal_Int32 nLocaleCount = aLocaleSeq.getLength();
Sequence< OUString > aOldIdStrings;
aPropertyValue >>= aOldIdStrings;
try
@@ -418,20 +409,18 @@ namespace pcr
}
OUString aNewPureIdStr = pNewPureIds[i];
- for ( sal_Int32 iLocale = 0; iLocale < nLocaleCount; ++iLocale )
+ for ( const Locale& rLocale : aLocaleSeq )
{
- Locale aLocale = pLocale[iLocale];
-
OUString aResourceStr;
if( !aOldPureIdStr.isEmpty() )
{
- if( xStringResourceManager->hasEntryForIdAndLocale( aOldPureIdStr, aLocale ) )
+ if( xStringResourceManager->hasEntryForIdAndLocale( aOldPureIdStr, rLocale ) )
{
aResourceStr = xStringResourceManager->
- resolveStringForLocale( aOldPureIdStr, aLocale );
+ resolveStringForLocale( aOldPureIdStr, rLocale );
}
}
- xStringResourceManager->setStringForLocale( aNewPureIdStr, aResourceStr, aLocale );
+ xStringResourceManager->setStringForLocale( aNewPureIdStr, aResourceStr, rLocale );
}
}
}
@@ -446,8 +435,8 @@ namespace pcr
OUString* pNewIdStrings = aNewIdStrings.getArray();
for ( i = 0; i < nNewCount; ++i )
{
- OUString aPureIdStr = pNewPureIds[i];
- OUString aStr = pNewStrings[i];
+ const OUString& aPureIdStr = pNewPureIds[i];
+ const OUString& aStr = aNewStrings[i];
xStringResourceManager->setString( aPureIdStr, aStr );
pNewIdStrings[i] = "&" + aPureIdStr;
@@ -455,18 +444,14 @@ namespace pcr
aValue <<= aNewIdStrings;
// Remove old ids from resource for all locales
- const OUString* pOldIdStrings = aOldIdStrings.getConstArray();
- sal_Int32 nOldIdCount = aOldIdStrings.getLength();
- for( i = 0 ; i < nOldIdCount ; ++i )
+ for( const OUString& rIdStr : aOldIdStrings )
{
- OUString aIdStr = pOldIdStrings[i];
- OUString aPureIdStr = aIdStr.copy( 1 );
- for ( sal_Int32 iLocale = 0; iLocale < nLocaleCount; ++iLocale )
+ OUString aPureIdStr = rIdStr.copy( 1 );
+ for ( const Locale& rLocale : aLocaleSeq )
{
- Locale aLocale = pLocale[iLocale];
try
{
- xStringResourceManager->removeIdForLocale( aPureIdStr, aLocale );
+ xStringResourceManager->removeIdForLocale( aPureIdStr, rLocale );
}
catch( const resource::MissingResourceException & )
{}
@@ -2316,11 +2301,8 @@ namespace pcr
sal_Int32 nObjectType = CommandType::COMMAND;
OSL_VERIFY( xFormSet->getPropertyValue( PROPERTY_COMMANDTYPE ) >>= nObjectType );
- Sequence< OUString > aFields( ::dbtools::getFieldNamesByCommandDescriptor( m_xRowSetConnection, nObjectType, sObjectName ) );
-
- const OUString* pFields = aFields.getConstArray();
- for ( sal_Int32 i = 0; i < aFields.getLength(); ++i, ++pFields )
- _rFieldNames.push_back( *pFields );
+ for ( const OUString& rField : ::dbtools::getFieldNamesByCommandDescriptor( m_xRowSetConnection, nObjectType, sObjectName ) )
+ _rFieldNames.push_back( rField );
}
}
catch (const Exception&)
@@ -2454,12 +2436,8 @@ namespace pcr
if ( !xTableNames.is() )
return;
- Sequence< OUString> aTableNames = xTableNames->getElementNames();
- sal_uInt32 nCount = aTableNames.getLength();
- const OUString* pTableNames = aTableNames.getConstArray();
-
- for ( sal_uInt32 i=0; i<nCount; ++i ,++pTableNames )
- _out_rNames.push_back( *pTableNames );
+ for ( const OUString& rTableName : xTableNames->getElementNames() )
+ _out_rNames.push_back( rTableName );
}
@@ -2483,12 +2461,9 @@ namespace pcr
if ( !_xQueryNames.is() )
return;
- Sequence< OUString> aQueryNames = _xQueryNames->getElementNames();
- sal_uInt32 nCount = aQueryNames.getLength();
- const OUString* pQueryNames = aQueryNames.getConstArray();
bool bAdd = !_sName.isEmpty();
- for ( sal_uInt32 i=0; i<nCount; i++, ++pQueryNames )
+ for ( const OUString& rQueryName : _xQueryNames->getElementNames() )
{
OUStringBuffer sTemp;
if ( bAdd )
@@ -2496,8 +2471,8 @@ namespace pcr
sTemp.append(_sName);
sTemp.append("/");
}
- sTemp.append(*pQueryNames);
- Reference< XNameAccess > xSubQueries(_xQueryNames->getByName(*pQueryNames),UNO_QUERY);
+ sTemp.append(rQueryName);
+ Reference< XNameAccess > xSubQueries(_xQueryNames->getByName(rQueryName),UNO_QUERY);
if ( xSubQueries.is() )
impl_fillQueryNames_throw(xSubQueries,_out_rNames,sTemp.makeStringAndClear());
else
@@ -2696,8 +2671,8 @@ namespace pcr
{
const sal_uInt32* pDeletedKeys = pInfoItem->GetDelArray();
- for (sal_uInt32 i=0; i< pInfoItem->GetDelCount(); ++i, ++pDeletedKeys)
- pFormatter->DeleteEntry(*pDeletedKeys);
+ for (sal_uInt32 i=0; i< pInfoItem->GetDelCount(); ++i)
+ pFormatter->DeleteEntry(pDeletedKeys[i]);
}
pItem = nullptr;
diff --git a/extensions/source/propctrlr/taborder.cxx b/extensions/source/propctrlr/taborder.cxx
index 157e6aaaf0fb..719ca2cc1431 100644
--- a/extensions/source/propctrlr/taborder.cxx
+++ b/extensions/source/propctrlr/taborder.cxx
@@ -177,15 +177,12 @@ namespace pcr
try
{
- Sequence< Reference< XControlModel > > aControlModels( m_xTempModel->getControlModels() );
- const Reference< XControlModel >* pControlModels = aControlModels.getConstArray();
-
OUString aName;
Image aImage;
- for ( sal_Int32 i=0; i < aControlModels.getLength(); ++i, ++pControlModels )
+ for ( auto const& rControlModel : m_xTempModel->getControlModels() )
{
- Reference< XPropertySet > xControl( *pControlModels, UNO_QUERY );
+ Reference< XPropertySet > xControl( rControlModel, UNO_QUERY );
Reference< XPropertySetInfo > xPI;
if ( xControl.is() )
xPI = xControl->getPropertySetInfo();
@@ -261,18 +258,17 @@ namespace pcr
Sequence< Reference< XControlModel > > aSortedControlModelSeq( nEntryCount );
Sequence< Reference< XControlModel > > aControlModels( m_xTempModel->getControlModels());
Reference< XControlModel > * pSortedControlModels = aSortedControlModelSeq.getArray();
- const Reference< XControlModel > * pControlModels = aControlModels.getConstArray();
for (sal_uLong i=0; i < nEntryCount; i++)
{
SvTreeListEntry* pEntry = m_pLB_Controls->GetEntry(i);
- for( sal_Int32 j=0; j<aControlModels.getLength(); j++ )
+ for( auto const& rControlModel : aControlModels )
{
- Reference< XPropertySet > xSet(pControlModels[j], UNO_QUERY);
+ Reference< XPropertySet > xSet(rControlModel, UNO_QUERY);
if (xSet.get() == static_cast<XPropertySet*>(pEntry->GetUserData()))
{
- pSortedControlModels[i] = pControlModels[j];
+ pSortedControlModels[i] = rControlModel;
break;
}
}