summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-03-02 10:01:33 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2024-03-02 12:55:02 +0100
commitf7d3b846ccdc979ebb3dfbff21eabc9d17eb204a (patch)
tree4303825e7b5a2c36e1ffe563d0eb3a53efc35460
parentda7867bbb98de03768f2212d9219023b6b854805 (diff)
Simplify a bit
Change-Id: I13f12235e7f0646faf7a5cfe3c9b757491947365 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164204 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--sc/source/core/tool/charthelper.cxx26
1 files changed, 6 insertions, 20 deletions
diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx
index df6c825a31d3..fd8ade6ce93b 100644
--- a/sc/source/core/tool/charthelper.cxx
+++ b/sc/source/core/tool/charthelper.cxx
@@ -57,8 +57,7 @@ sal_uInt16 lcl_DoUpdateCharts( ScDocument& rDoc )
OSL_ENSURE(pPage,"Page ?");
SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
- SdrObject* pObject = aIter.Next();
- while (pObject)
+ while (SdrObject* pObject = aIter.Next())
{
if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 && ScDocument::IsChart( pObject ) )
{
@@ -66,7 +65,6 @@ sal_uInt16 lcl_DoUpdateCharts( ScDocument& rDoc )
rDoc.UpdateChart( aName );
++nFound;
}
- pObject = aIter.Next();
}
}
return nFound;
@@ -122,8 +120,7 @@ void ScChartHelper::AdjustRangesOfChartsOnDestinationPage( const ScDocument& rSr
return;
SdrObjListIter aIter( pDestPage, SdrIterMode::Flat );
- SdrObject* pObject = aIter.Next();
- while( pObject )
+ while (SdrObject* pObject = aIter.Next())
{
if( pObject->GetObjIdentifier() == SdrObjKind::OLE2 && static_cast<SdrOle2Obj*>(pObject)->IsChart() )
{
@@ -143,7 +140,6 @@ void ScChartHelper::AdjustRangesOfChartsOnDestinationPage( const ScDocument& rSr
rDestDoc.SetChartRanges( aChartName, aRangesVector );
}
}
- pObject = aIter.Next();
}
}
@@ -158,8 +154,7 @@ void ScChartHelper::UpdateChartsOnDestinationPage( ScDocument& rDestDoc, const S
return;
SdrObjListIter aIter( pDestPage, SdrIterMode::Flat );
- SdrObject* pObject = aIter.Next();
- while( pObject )
+ while (SdrObject* pObject = aIter.Next())
{
if( pObject->GetObjIdentifier() == SdrObjKind::OLE2 && static_cast<SdrOle2Obj*>(pObject)->IsChart() )
{
@@ -168,7 +163,6 @@ void ScChartHelper::UpdateChartsOnDestinationPage( ScDocument& rDestDoc, const S
Reference< util::XModifiable > xModif(xChartDoc, uno::UNO_QUERY_THROW);
xModif->setModified( true);
}
- pObject = aIter.Next();
}
}
@@ -326,12 +320,8 @@ void ScChartHelper::FillProtectedChartRangesVector( ScRangeListVector& rRangesVe
if ( pPage )
{
SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
- SdrObject* pObject = aIter.Next();
- while ( pObject )
- {
+ while (SdrObject* pObject = aIter.Next())
AddRangesIfProtectedChart( rRangesVector, rDocument, pObject );
- pObject = aIter.Next();
- }
}
}
@@ -341,8 +331,7 @@ void ScChartHelper::GetChartNames( ::std::vector< OUString >& rChartNames, const
return;
SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
- SdrObject* pObject = aIter.Next();
- while ( pObject )
+ while (SdrObject* pObject = aIter.Next())
{
if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 )
{
@@ -352,7 +341,6 @@ void ScChartHelper::GetChartNames( ::std::vector< OUString >& rChartNames, const
rChartNames.push_back( pSdrOle2Obj->GetPersistName() );
}
}
- pObject = aIter.Next();
}
}
@@ -365,8 +353,7 @@ void ScChartHelper::CreateProtectedChartListenersAndNotify( ScDocument& rDoc, co
size_t nRangeListCount = rRangesVector.size();
size_t nRangeList = 0;
SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
- SdrObject* pObject = aIter.Next();
- while ( pObject )
+ while (SdrObject* pObject = aIter.Next())
{
if ( pObject->GetObjIdentifier() == SdrObjKind::OLE2 )
{
@@ -424,7 +411,6 @@ void ScChartHelper::CreateProtectedChartListenersAndNotify( ScDocument& rDoc, co
}
}
}
- pObject = aIter.Next();
}
}