summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-07-10 16:12:07 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-07-11 12:50:55 +0200
commit20571c472528c4f98fe3f55700d134915d32a49a (patch)
tree9b350824d845b8aaeb13d087ef74febb454b821b /sc
parentb401896a56149aa2871b65a330a6f601a9830ccd (diff)
use more range-for on uno::Sequence
Change-Id: Ifad32425d79be5a22d33d721bdc5fb993f699759 Reviewed-on: https://gerrit.libreoffice.org/39763 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx22
-rw-r--r--sc/source/ui/unoobj/chartuno.cxx5
-rw-r--r--sc/source/ui/vba/vbawsfunction.cxx34
3 files changed, 27 insertions, 34 deletions
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 8cdfb63c1d05..d341e582cac4 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2113,15 +2113,14 @@ void ScXMLExport::AddStyleFromCells(const uno::Reference<beans::XPropertySet>& x
nIndex = pCellStyles->GetIndexOfStyleName(sName, XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX, bIsAutoStyle);
uno::Sequence<table::CellRangeAddress> aAddresses(xCellRanges->getRangeAddresses());
- table::CellRangeAddress* pAddresses(aAddresses.getArray());
bool bGetMerge(true);
- for (sal_Int32 i = 0; i < aAddresses.getLength(); ++i, ++pAddresses)
+ for (table::CellRangeAddress const & address : aAddresses)
{
- pSharedData->SetLastColumn(nTable, pAddresses->EndColumn);
- pSharedData->SetLastRow(nTable, pAddresses->EndRow);
- pCellStyles->AddRangeStyleName(*pAddresses, nIndex, bIsAutoStyle, nValidationIndex, nNumberFormat);
+ pSharedData->SetLastColumn(nTable, address.EndColumn);
+ pSharedData->SetLastRow(nTable, address.EndRow);
+ pCellStyles->AddRangeStyleName(address, nIndex, bIsAutoStyle, nValidationIndex, nNumberFormat);
if (bGetMerge)
- bGetMerge = GetMerged(pAddresses, xTable);
+ bGetMerge = GetMerged(&address, xTable);
}
}
}
@@ -2137,17 +2136,16 @@ void ScXMLExport::AddStyleFromCells(const uno::Reference<beans::XPropertySet>& x
if ( !pOldName )
{
uno::Sequence<table::CellRangeAddress> aAddresses(xCellRanges->getRangeAddresses());
- table::CellRangeAddress* pAddresses(aAddresses.getArray());
bool bGetMerge(true);
- for (sal_Int32 i = 0; i < aAddresses.getLength(); ++i, ++pAddresses)
+ for (table::CellRangeAddress const & address : aAddresses)
{
if (bGetMerge)
- bGetMerge = GetMerged(pAddresses, xTable);
- pCellStyles->AddRangeStyleName(*pAddresses, nIndex, false, nValidationIndex, nNumberFormat);
+ bGetMerge = GetMerged(&address, xTable);
+ pCellStyles->AddRangeStyleName(address, nIndex, false, nValidationIndex, nNumberFormat);
if( sStyleName != "Default" || nValidationIndex != -1 )
{
- pSharedData->SetLastColumn(nTable, pAddresses->EndColumn);
- pSharedData->SetLastRow(nTable, pAddresses->EndRow);
+ pSharedData->SetLastColumn(nTable, address.EndColumn);
+ pSharedData->SetLastRow(nTable, address.EndRow);
}
}
}
diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx
index c9da280e6955..cc38b7059892 100644
--- a/sc/source/ui/unoobj/chartuno.cxx
+++ b/sc/source/ui/unoobj/chartuno.cxx
@@ -527,11 +527,8 @@ void ScChartObj::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const uno:
if ( rValue >>= aCellRanges )
{
ScRangeListRef rRangeList = new ScRangeList();
- const table::CellRangeAddress* pCellRanges = aCellRanges.getArray();
- sal_Int32 nCount = aCellRanges.getLength();
- for ( sal_Int32 i = 0; i < nCount; ++i )
+ for ( table::CellRangeAddress const & aCellRange : aCellRanges )
{
- table::CellRangeAddress aCellRange = pCellRanges[ i ];
ScRange aRange;
ScUnoConversion::FillScRange( aRange, aCellRange );
rRangeList->Append( aRange );
diff --git a/sc/source/ui/vba/vbawsfunction.cxx b/sc/source/ui/vba/vbawsfunction.cxx
index ca7cf6dadc08..dba387baf3cd 100644
--- a/sc/source/ui/vba/vbawsfunction.cxx
+++ b/sc/source/ui/vba/vbawsfunction.cxx
@@ -84,55 +84,53 @@ ScVbaWSFunction::invoke(const OUString& FunctionName, const uno::Sequence< uno::
uno::Sequence< uno::Any > aParamTemp( Params );
if( aParamTemp.hasElements() )
{
- uno::Any* pArray = aParamTemp.getArray();
- uno::Any* pArrayEnd = pArray + aParamTemp.getLength();
- for( ; pArray < pArrayEnd; ++pArray )
+ for( uno::Any & rArray : aParamTemp )
{
- switch( pArray->getValueType().getTypeClass() )
+ switch( rArray.getValueType().getTypeClass() )
{
case uno::TypeClass_BOOLEAN:
- lclConvertBooleanToDouble( *pArray );
+ lclConvertBooleanToDouble( rArray );
break;
case uno::TypeClass_INTERFACE:
{
- uno::Reference< excel::XRange > myRange( *pArray, uno::UNO_QUERY );
+ uno::Reference< excel::XRange > myRange( rArray, uno::UNO_QUERY );
if( myRange.is() )
- *pArray = myRange->getCellRange();
+ rArray = myRange->getCellRange();
}
break;
case uno::TypeClass_SEQUENCE:
{
// the sheet.FunctionAccess service doesn't deal with Sequences, only Sequences of Sequence
- uno::Type aType = pArray->getValueType();
+ uno::Type aType = rArray.getValueType();
if ( aType.equals( cppu::UnoType<uno::Sequence<sal_Int16>>::get() ) )
{
uno::Sequence< uno::Sequence< sal_Int16 > > aTmp(1);
- (*pArray) >>= aTmp[ 0 ];
- (*pArray) <<= aTmp;
+ rArray >>= aTmp[ 0 ];
+ rArray <<= aTmp;
}
else if ( aType.equals( cppu::UnoType<uno::Sequence<sal_Int32>>::get() ) )
{
uno::Sequence< uno::Sequence< sal_Int32 > > aTmp(1);
- (*pArray) >>= aTmp[ 0 ];
- (*pArray) <<= aTmp;
+ rArray >>= aTmp[ 0 ];
+ rArray <<= aTmp;
}
else if ( aType.equals( cppu::UnoType<uno::Sequence<double>>::get() ) )
{
uno::Sequence< uno::Sequence< double > > aTmp(1);
- (*pArray) >>= aTmp[ 0 ];
- (*pArray) <<= aTmp;
+ rArray >>= aTmp[ 0 ];
+ rArray <<= aTmp;
}
else if ( aType.equals( cppu::UnoType<uno::Sequence<OUString>>::get() ) )
{
uno::Sequence< uno::Sequence< OUString > > aTmp(1);
- (*pArray) >>= aTmp[ 0 ];
- (*pArray) <<= aTmp;
+ rArray >>= aTmp[ 0 ];
+ rArray <<= aTmp;
}
else if ( aType.equals( cppu::UnoType<uno::Sequence<uno::Any>>::get() ) )
{
uno::Sequence< uno::Sequence<uno::Any > > aTmp(1);
- (*pArray) >>= aTmp[ 0 ];
- (*pArray) <<= aTmp;
+ rArray >>= aTmp[ 0 ];
+ rArray <<= aTmp;
}
}
break;