[Libreoffice-commits] core.git: svx/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Nov 21 08:33:00 UTC 2018
svx/source/accessibility/AccessibleShape.cxx | 5
svx/source/accessibility/ChildrenManagerImpl.cxx | 173 +++++------
svx/source/accessibility/GraphCtlAccessibleContext.cxx | 7
svx/source/accessibility/charmapacc.cxx | 5
svx/source/customshapes/EnhancedCustomShape3d.cxx | 3
svx/source/customshapes/EnhancedCustomShapeFontWork.cxx | 240 ++++------------
svx/source/dialog/charmap.cxx | 21 -
svx/source/dialog/docrecovery.cxx | 56 ---
svx/source/dialog/frmsel.cxx | 6
svx/source/dialog/searchcharmap.cxx | 10
svx/source/dialog/srchdlg.cxx | 7
svx/source/engine3d/helperhittest3d.cxx | 7
svx/source/engine3d/view3d.cxx | 31 --
13 files changed, 193 insertions(+), 378 deletions(-)
New commits:
commit b80c56f2798abca7b44ecf7c0fd9948a0b966e10
Author: Arkadiy Illarionov <qarkai at gmail.com>
AuthorDate: Wed Nov 21 02:49:30 2018 +0300
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Nov 21 09:32:34 2018 +0100
Simplify containers iterations in svx/source/[a-e]*
Use range-based loop or replace with STL functions
Change-Id: I7a24407f9e8f38b4903a643210ca4511372d91f2
Reviewed-on: https://gerrit.libreoffice.org/63687
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx
index 54e1afd405bd..dc2f0f1ab7c6 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -1369,9 +1369,9 @@ AccessibleShape::getGroupPosition( const uno::Any& )
//get the index of the selected object in the group
//we start counting position from 1
sal_Int32 nPos = 1;
- for ( std::vector< uno::Reference<drawing::XShape> >::const_iterator aIter = vXShapes.begin(); aIter != vXShapes.end(); ++aIter, nPos++ )
+ for ( const auto& rpShape : vXShapes )
{
- if ( (*aIter).get() == mxShape.get() )
+ if ( rpShape.get() == mxShape.get() )
{
sal_Int32* pArray = aRet.getArray();
pArray[0] = nGroupLevel;
@@ -1379,6 +1379,7 @@ AccessibleShape::getGroupPosition( const uno::Any& )
pArray[2] = nPos;
break;
}
+ nPos++;
}
return aRet;
diff --git a/svx/source/accessibility/ChildrenManagerImpl.cxx b/svx/source/accessibility/ChildrenManagerImpl.cxx
index ce77aed85e13..0485b35d24ab 100644
--- a/svx/source/accessibility/ChildrenManagerImpl.cxx
+++ b/svx/source/accessibility/ChildrenManagerImpl.cxx
@@ -49,10 +49,12 @@ namespace
{
void adjustIndexInParentOfShapes(ChildDescriptorListType& _rList)
{
- ChildDescriptorListType::const_iterator aEnd = _rList.end();
sal_Int32 i=0;
- for ( ChildDescriptorListType::iterator aIter = _rList.begin(); aIter != aEnd; ++aIter,++i)
- aIter->setIndexAtAccessibleShape(i);
+ for (auto& rItem : _rList)
+ {
+ rItem.setIndexAtAccessibleShape(i);
+ ++i;
+ }
}
}
@@ -112,12 +114,10 @@ long ChildrenManagerImpl::GetChildCount() const throw ()
css::uno::Reference<css::drawing::XShape> ChildrenManagerImpl::GetChildShape(long nIndex)
{
uno::Reference<XAccessible> xAcc = GetChild(nIndex);
- ChildDescriptorListType::const_iterator aEnd = maVisibleChildren.end();
- for (ChildDescriptorListType::iterator I = maVisibleChildren.begin(); I != aEnd; ++I)
- {
- if (I->mxAccessibleShape == xAcc)
- return I->mxShape;
- }
+ auto I = std::find_if(maVisibleChildren.begin(), maVisibleChildren.end(),
+ [&xAcc](const ChildDescriptor& rChild) { return rChild.mxAccessibleShape == xAcc; });
+ if (I != maVisibleChildren.end())
+ return I->mxShape;
return uno::Reference< drawing::XShape > ();
}
@@ -178,12 +178,10 @@ uno::Reference<XAccessible>
uno::Reference<XAccessible>
ChildrenManagerImpl::GetChild (const uno::Reference<drawing::XShape>& xShape)
{
- ChildDescriptorListType::const_iterator aEnd = maVisibleChildren.end();
- for (ChildDescriptorListType::iterator I = maVisibleChildren.begin(); I != aEnd; ++I)
- {
- if ( I->mxShape.get() == xShape.get() )
- return I->mxAccessibleShape;
- }
+ auto I = std::find_if(maVisibleChildren.begin(), maVisibleChildren.end(),
+ [&xShape](const ChildDescriptor& rChild) { return rChild.mxShape.get() == xShape.get(); });
+ if (I != maVisibleChildren.end())
+ return I->mxAccessibleShape;
return uno::Reference<XAccessible> ();
}
@@ -284,13 +282,12 @@ void ChildrenManagerImpl::CreateListOfVisibleShapes (
tools::Rectangle aVisibleArea = maShapeTreeInfo.GetViewForwarder()->GetVisibleArea();
// Add the visible shapes for which the accessible objects already exist.
- AccessibleShapeList::const_iterator aEnd = maAccessibleShapes.end();
- for (AccessibleShapeList::iterator I=maAccessibleShapes.begin(); I != aEnd; ++I)
+ for (const auto& rpShape : maAccessibleShapes)
{
- if (I->is())
+ if (rpShape.is())
{
uno::Reference<XAccessibleComponent> xComponent (
- (*I)->getAccessibleContext(), uno::UNO_QUERY);
+ rpShape->getAccessibleContext(), uno::UNO_QUERY);
if (xComponent.is())
{
// The bounding box of the object already is clipped to the
@@ -298,7 +295,7 @@ void ChildrenManagerImpl::CreateListOfVisibleShapes (
// bounding box has non-zero extensions.
awt::Rectangle aPixelBBox (xComponent->getBounds());
if ((aPixelBBox.Width > 0) && (aPixelBBox.Height > 0))
- raDescriptorList.emplace_back(*I);
+ raDescriptorList.emplace_back(rpShape);
}
}
}
@@ -340,25 +337,24 @@ void ChildrenManagerImpl::RemoveNonVisibleChildren (
// Iterate over list of formerly visible children and remove those that
// are not visible anymore, i.e. member of the new list of visible
// children.
- ChildDescriptorListType::const_iterator aEnd = rOldChildList.end();
- for (ChildDescriptorListType::iterator I=rOldChildList.begin(); I != aEnd; ++I)
+ for (auto& rChild : rOldChildList)
{
- if (::std::find(rNewChildList.begin(), rNewChildList.end(), *I) == rNewChildList.end())
+ if (::std::find(rNewChildList.begin(), rNewChildList.end(), rChild) == rNewChildList.end())
{
// The child is disposed when there is a UNO shape from which
// the accessible shape can be created when the shape becomes
// visible again. When there is no such UNO shape then simply
// reset the descriptor but keep the accessibility object.
- if (I->mxShape.is())
+ if (rChild.mxShape.is())
{
- UnregisterAsDisposeListener (I->mxShape);
- I->disposeAccessibleObject (mrContext);
+ UnregisterAsDisposeListener (rChild.mxShape);
+ rChild.disposeAccessibleObject (mrContext);
}
else
{
- AccessibleShape* pAccessibleShape = I->GetAccessibleShape();
+ AccessibleShape* pAccessibleShape = rChild.GetAccessibleShape();
pAccessibleShape->ResetState (AccessibleStateType::VISIBLE);
- I->mxAccessibleShape = nullptr;
+ rChild.mxAccessibleShape = nullptr;
}
}
}
@@ -370,36 +366,32 @@ void ChildrenManagerImpl::MergeAccessibilityInformation (
ChildDescriptorListType::const_iterator aStartVisibleChildren = maVisibleChildren.begin();
ChildDescriptorListType::const_iterator aEndVisibleChildren = maVisibleChildren.end();
- ChildDescriptorListType::const_iterator aEnd = raNewChildList.end();
- for (ChildDescriptorListType::iterator I=raNewChildList.begin(); I != aEnd; ++I)
+ for (auto& rChild : raNewChildList)
{
ChildDescriptorListType::const_iterator aOldChildDescriptor =
- std::find(aStartVisibleChildren, aEndVisibleChildren, *I);
+ std::find(aStartVisibleChildren, aEndVisibleChildren, rChild);
// Copy accessible shape if that exists in the old descriptor.
- bool bRegistrationIsNecessary = true;
- if (aOldChildDescriptor != aEndVisibleChildren)
- if (aOldChildDescriptor->mxAccessibleShape.is())
- {
- I->mxAccessibleShape = aOldChildDescriptor->mxAccessibleShape;
- I->mbCreateEventPending = false;
- bRegistrationIsNecessary = false;
- }
- if (bRegistrationIsNecessary)
- RegisterAsDisposeListener (I->mxShape);
+ if (aOldChildDescriptor != aEndVisibleChildren &&
+ aOldChildDescriptor->mxAccessibleShape.is())
+ {
+ rChild.mxAccessibleShape = aOldChildDescriptor->mxAccessibleShape;
+ rChild.mbCreateEventPending = false;
+ }
+ else
+ RegisterAsDisposeListener (rChild.mxShape);
}
}
void ChildrenManagerImpl::SendVisibleAreaEvents (
ChildDescriptorListType& raNewChildList)
{
- ChildDescriptorListType::const_iterator aEnd = raNewChildList.end();
- for (ChildDescriptorListType::iterator I=raNewChildList.begin(); I != aEnd; ++I)
+ for (const auto& rChild : raNewChildList)
{
// Tell shape of changed visible area. To do this, fake a
// change of the view forwarder. (Actually we usually get here
// as a result of a change of the view forwarder).
- AccessibleShape* pShape = I->GetAccessibleShape ();
+ AccessibleShape* pShape = rChild.GetAccessibleShape ();
if (pShape != nullptr)
pShape->ViewForwarderChanged();
}
@@ -409,22 +401,22 @@ void ChildrenManagerImpl::SendVisibleAreaEvents (
void ChildrenManagerImpl::CreateAccessibilityObjects (
ChildDescriptorListType& raNewChildList)
{
- ChildDescriptorListType::const_iterator aEnd = raNewChildList.end();
sal_Int32 nPos = 0;
- for ( ChildDescriptorListType::iterator I = raNewChildList.begin(); I != aEnd; ++I,++nPos)
+ for ( auto& rChild : raNewChildList)
{
// Create the associated accessible object when the flag says so and
// it does not yet exist.
- if ( ! I->mxAccessibleShape.is() )
- GetChild (*I,nPos);
- if (I->mxAccessibleShape.is() && I->mbCreateEventPending)
+ if ( ! rChild.mxAccessibleShape.is() )
+ GetChild (rChild, nPos);
+ if (rChild.mxAccessibleShape.is() && rChild.mbCreateEventPending)
{
- I->mbCreateEventPending = false;
+ rChild.mbCreateEventPending = false;
mrContext.CommitChange (
AccessibleEventId::CHILD,
- uno::makeAny(I->mxAccessibleShape),
+ uno::makeAny(rChild.mxAccessibleShape),
uno::Any());
}
+ ++nPos;
}
}
@@ -539,22 +531,20 @@ void ChildrenManagerImpl::ClearAccessibleShapeList()
// Clear the list of visible accessible objects. Objects not created on
// demand for XShapes are treated below.
- ChildDescriptorListType::const_iterator aEnd = aLocalVisibleChildren.end();
- for (ChildDescriptorListType::iterator I=aLocalVisibleChildren.begin(); I != aEnd; ++I)
- if ( I->mxAccessibleShape.is() && I->mxShape.is() )
+ for (auto& rChild : aLocalVisibleChildren)
+ if ( rChild.mxAccessibleShape.is() && rChild.mxShape.is() )
{
- ::comphelper::disposeComponent(I->mxAccessibleShape);
- I->mxAccessibleShape = nullptr;
+ ::comphelper::disposeComponent(rChild.mxAccessibleShape);
+ rChild.mxAccessibleShape = nullptr;
}
// Dispose all objects in the accessible shape list.
- AccessibleShapeList::const_iterator aEnd2 = aLocalAccessibleShapes.end();
- for (AccessibleShapeList::iterator J=aLocalAccessibleShapes.begin(); J != aEnd2; ++J)
- if (J->is())
+ for (auto& rpShape : aLocalAccessibleShapes)
+ if (rpShape.is())
{
// Dispose the object.
- ::comphelper::disposeComponent(*J);
- *J = nullptr;
+ ::comphelper::disposeComponent(rpShape);
+ rpShape = nullptr;
}
}
@@ -739,35 +729,31 @@ bool ChildrenManagerImpl::ReplaceChild (
if ( pNewChild.is() )
pNewChild->Init();
- bool bResult = false;
-
// Iterate over the visible children. If one of them has an already
// created accessible object that matches pCurrentChild then replace
// it. Otherwise the child to replace is either not in the list or has
// not ye been created (and is therefore not in the list, too) and a
// replacement is not necessary.
- ChildDescriptorListType::const_iterator aEnd = maVisibleChildren.end();
- for (ChildDescriptorListType::iterator I=maVisibleChildren.begin(); I != aEnd; ++I)
+ auto I = std::find_if(maVisibleChildren.begin(), maVisibleChildren.end(),
+ [&pCurrentChild](const ChildDescriptor& rChild) { return rChild.GetAccessibleShape() == pCurrentChild; });
+
+ bool bResult = I != maVisibleChildren.end();
+ if (bResult)
{
- if (I->GetAccessibleShape() == pCurrentChild)
- {
- // Dispose the current child and send an event about its deletion.
- pCurrentChild->dispose();
- mrContext.CommitChange (
- AccessibleEventId::CHILD,
- uno::Any(),
- uno::makeAny (I->mxAccessibleShape));
+ // Dispose the current child and send an event about its deletion.
+ pCurrentChild->dispose();
+ mrContext.CommitChange (
+ AccessibleEventId::CHILD,
+ uno::Any(),
+ uno::makeAny (I->mxAccessibleShape));
- // Replace with replacement and send an event about existence
- // of the new child.
- I->mxAccessibleShape = pNewChild.get();
- mrContext.CommitChange (
- AccessibleEventId::CHILD,
- uno::makeAny (I->mxAccessibleShape),
- uno::Any());
- bResult = true;
- break;
- }
+ // Replace with replacement and send an event about existence
+ // of the new child.
+ I->mxAccessibleShape = pNewChild.get();
+ mrContext.CommitChange (
+ AccessibleEventId::CHILD,
+ uno::makeAny (I->mxAccessibleShape),
+ uno::Any());
}
// When not found among the visible children we have to search the list
@@ -795,12 +781,10 @@ AccessibleControlShape * ChildrenManagerImpl::GetAccControlShapeFromModel(css::b
uno::Reference<XAccessible>
ChildrenManagerImpl::GetAccessibleCaption (const uno::Reference<drawing::XShape>& xShape)
{
- ChildDescriptorListType::const_iterator aEnd = maVisibleChildren.end();
- for (ChildDescriptorListType::iterator I = maVisibleChildren.begin(); I != aEnd; ++I)
- {
- if ( I->mxShape.get() == xShape.get() )
- return I->mxAccessibleShape;
- }
+ auto I = std::find_if(maVisibleChildren.begin(), maVisibleChildren.end(),
+ [&xShape](const ChildDescriptor& rChild) { return rChild.mxShape.get() == xShape.get(); });
+ if (I != maVisibleChildren.end())
+ return I->mxAccessibleShape;
return uno::Reference<XAccessible> ();
}
@@ -838,11 +822,10 @@ void ChildrenManagerImpl::UpdateSelection()
VEC_SHAPE vecSelect;
int nAddSelect=0;
bool bHasSelectedShape=false;
- ChildDescriptorListType::const_iterator aEnd = maVisibleChildren.end();
- for (ChildDescriptorListType::iterator I=maVisibleChildren.begin(); I != aEnd; ++I)
+ for (const auto& rChild : maVisibleChildren)
{
- AccessibleShape* pAccessibleShape = I->GetAccessibleShape();
- if (I->mxAccessibleShape.is() && I->mxShape.is() && pAccessibleShape!=nullptr)
+ AccessibleShape* pAccessibleShape = rChild.GetAccessibleShape();
+ if (rChild.mxAccessibleShape.is() && rChild.mxShape.is() && pAccessibleShape!=nullptr)
{
short nRole = pAccessibleShape->getAccessibleRole();
bool bDrawShape = (
@@ -857,7 +840,7 @@ void ChildrenManagerImpl::UpdateSelection()
// Look up the shape in the (single or multi-) selection.
if (xSelectedShape.is())
{
- if (I->mxShape == xSelectedShape)
+ if (rChild.mxShape == xSelectedShape)
{
bShapeIsSelected = true;
pNewFocusedShape = pAccessibleShape;
@@ -867,7 +850,7 @@ void ChildrenManagerImpl::UpdateSelection()
{
sal_Int32 nCount=xSelectedShapeAccess->getCount();
for (sal_Int32 i=0; i<nCount&&!bShapeIsSelected; i++)
- if (xSelectedShapeAccess->getByIndex(i) == I->mxShape)
+ if (xSelectedShapeAccess->getByIndex(i) == rChild.mxShape)
{
bShapeIsSelected = true;
// In a multi-selection no shape has the focus.
diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
index 5b886c8a7d4d..12a6f3175059 100644
--- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx
+++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
@@ -633,12 +633,9 @@ void SAL_CALL SvxGraphCtrlAccessibleContext::disposing()
mpPage = nullptr;
{
- ShapesMapType::iterator I;
- ShapesMapType::const_iterator endIt = mxShapes.end();
-
- for (I=mxShapes.begin(); I!=endIt; ++I)
+ for (const auto& rEntry : mxShapes)
{
- rtl::Reference<XAccessible> pAcc((*I).second.get());
+ rtl::Reference<XAccessible> pAcc(rEntry.second.get());
Reference< XComponent > xComp( pAcc.get(), UNO_QUERY );
if( xComp.is() )
xComp->dispose();
diff --git a/svx/source/accessibility/charmapacc.cxx b/svx/source/accessibility/charmapacc.cxx
index 568e5a1dfe43..e36d20cf6589 100644
--- a/svx/source/accessibility/charmapacc.cxx
+++ b/svx/source/accessibility/charmapacc.cxx
@@ -84,9 +84,8 @@ SvxShowCharSetAcc::~SvxShowCharSetAcc()
void SAL_CALL SvxShowCharSetAcc::disposing()
{
OAccessibleSelectionHelper::disposing();
- ::std::vector< Reference< XAccessible > >::const_iterator aEnd = m_aChildren.end();
- for (::std::vector< Reference< XAccessible > >::iterator aIter = m_aChildren.begin();aIter != aEnd ; ++aIter)
- ::comphelper::disposeComponent(*aIter);
+ for (auto& rChild : m_aChildren)
+ ::comphelper::disposeComponent(rChild);
m_aChildren.clear();
m_pParent = nullptr;
diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx
index de079b4012c1..90d5c75108b2 100644
--- a/svx/source/customshapes/EnhancedCustomShape3d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx
@@ -738,9 +738,8 @@ SdrObject* EnhancedCustomShape3d::Create3DObject(
pMap));
// removing placeholder objects
- for (std::vector< E3dCompoundObject* >::iterator aObjectListIter( aPlaceholderObjectList.begin() ); aObjectListIter != aPlaceholderObjectList.end(); )
+ for (E3dCompoundObject* pTemp : aPlaceholderObjectList)
{
- E3dCompoundObject* pTemp(*aObjectListIter++);
pScene->RemoveObject( pTemp->GetOrdNum() );
// always use SdrObject::Free(...) for SdrObjects (!)
SdrObject* pTemp2(pTemp);
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
index ac559be40f63..c35be6e0f47b 100644
--- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
@@ -206,9 +206,7 @@ static void CalculateHorizontalScalingFactor(
do
{
i = 0;
- std::vector< FWTextArea >::iterator aTextAreaIter = rFWData.vTextAreas.begin();
- std::vector< FWTextArea >::const_iterator aTextAreaIEnd = rFWData.vTextAreas.end();
- while( aTextAreaIter != aTextAreaIEnd )
+ for( const auto& rTextArea : rFWData.vTextAreas )
{
// calculating the width of the corresponding 2d text area
double fWidth = GetLength( rOutline2d.GetObject( i++ ) );
@@ -218,11 +216,9 @@ static void CalculateHorizontalScalingFactor(
fWidth /= 2.0;
}
- std::vector< FWParagraphData >::const_iterator aParagraphIter( aTextAreaIter->vParagraphs.begin() );
- std::vector< FWParagraphData >::const_iterator aParagraphIEnd( aTextAreaIter->vParagraphs.end() );
- while( aParagraphIter != aParagraphIEnd )
+ for( const auto& rParagraph : rTextArea.vParagraphs )
{
- double fTextWidth = pVirDev->GetTextWidth( aParagraphIter->aString );
+ double fTextWidth = pVirDev->GetTextWidth( rParagraph.aString );
if ( fTextWidth > 0.0 )
{
double fScale = fWidth / fTextWidth;
@@ -236,9 +232,7 @@ static void CalculateHorizontalScalingFactor(
fScalingFactor = fScale;
}
}
- ++aParagraphIter;
}
- ++aTextAreaIter;
}
if (fScalingFactor < 1.0)
@@ -269,11 +263,9 @@ static void GetTextAreaOutline(
sal_Int32 nVerticalOffset = rFWData.nMaxParagraphsPerTextArea > rTextArea.vParagraphs.size()
? rFWData.nSingleLineHeight / 2 : 0;
- std::vector< FWParagraphData >::iterator aParagraphIter( rTextArea.vParagraphs.begin() );
- std::vector< FWParagraphData >::const_iterator aParagraphIEnd( rTextArea.vParagraphs.end() );
- while( aParagraphIter != aParagraphIEnd )
+ for( auto& rParagraph : rTextArea.vParagraphs )
{
- const OUString& rText = aParagraphIter->aString;
+ const OUString& rText = rParagraph.aString;
if ( !rText.isEmpty() )
{
// generating vcl/font
@@ -319,7 +311,7 @@ static void GetTextAreaOutline(
pVirDev->SetMapMode(MapMode(MapUnit::Map100thMM));
pVirDev->SetFont( aFont );
pVirDev->EnableRTL();
- if ( aParagraphIter->nFrameDirection == SvxFrameDirection::Horizontal_RL_TB )
+ if ( rParagraph.nFrameDirection == SvxFrameDirection::Horizontal_RL_TB )
pVirDev->SetLayoutMode( ComplexTextLayoutFlags::BiDiRtl );
const SvxCharScaleWidthItem& rCharScaleWidthItem = rSdrObjCustomShape.GetMergedItem( EE_CHAR_FONTWIDTH );
@@ -341,48 +333,36 @@ static void GetTextAreaOutline(
if ( pVirDev->GetTextOutlines( aCharacterData.vOutlines, aCharText, 0, 0, -1, nWidth, pDXArry.get() ) )
{
sal_Int32 nTextWidth = pVirDev->GetTextWidth( aCharText);
- std::vector< tools::PolyPolygon >::iterator aOutlineIter = aCharacterData.vOutlines.begin();
- std::vector< tools::PolyPolygon >::const_iterator aOutlineIEnd = aCharacterData.vOutlines.end();
- if ( aOutlineIter == aOutlineIEnd )
+ if ( aCharacterData.vOutlines.empty() )
{
nHeight += rFWData.nSingleLineHeight;
}
else
{
- while ( aOutlineIter != aOutlineIEnd )
+ for ( auto& rOutline : aCharacterData.vOutlines )
{
// rotating
- aOutlineIter->Rotate( Point( nTextWidth / 2, rFWData.nSingleLineHeight / 2 ), 900 );
- aCharacterData.aBoundRect.Union( aOutlineIter->GetBoundRect() );
- ++aOutlineIter;
+ rOutline.Rotate( Point( nTextWidth / 2, rFWData.nSingleLineHeight / 2 ), 900 );
+ aCharacterData.aBoundRect.Union( rOutline.GetBoundRect() );
}
- aOutlineIter = aCharacterData.vOutlines.begin();
- aOutlineIEnd = aCharacterData.vOutlines.end();
- while ( aOutlineIter != aOutlineIEnd )
+ for ( auto& rOutline : aCharacterData.vOutlines )
{
sal_Int32 nM = - aCharacterData.aBoundRect.Left() + nHeight;
- aOutlineIter->Move( nM, 0 );
+ rOutline.Move( nM, 0 );
aCharacterData.aBoundRect.Move( nM, 0 );
- ++aOutlineIter;
}
nHeight += aCharacterData.aBoundRect.GetWidth() + ( rFWData.nSingleLineHeight / 5 );
aSingleCharacterUnion.Union( aCharacterData.aBoundRect );
}
}
- aParagraphIter->vCharacters.push_back( aCharacterData );
+ rParagraph.vCharacters.push_back( aCharacterData );
}
- std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
- std::vector< FWCharacterData >::const_iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
- while ( aCharacterIter != aCharacterIEnd )
+ for ( auto& rCharacter : rParagraph.vCharacters )
{
- std::vector< tools::PolyPolygon >::iterator aOutlineIter( aCharacterIter->vOutlines.begin() );
- std::vector< tools::PolyPolygon >::const_iterator aOutlineIEnd( aCharacterIter->vOutlines.end() );
- while ( aOutlineIter != aOutlineIEnd )
+ for ( auto& rOutline : rCharacter.vOutlines )
{
- aOutlineIter->Move( ( aSingleCharacterUnion.GetWidth() - aCharacterIter->aBoundRect.GetWidth() ) / 2, 0 );
- ++aOutlineIter;
+ rOutline.Move( ( aSingleCharacterUnion.GetWidth() - rCharacter.aBoundRect.GetWidth() ) / 2, 0 );
}
- ++aCharacterIter;
}
}
else
@@ -398,34 +378,26 @@ static void GetTextAreaOutline(
FWCharacterData aCharacterData;
if ( pVirDev->GetTextOutlines( aCharacterData.vOutlines, rText, 0, 0, -1, nWidth, pDXArry.get() ) )
{
- aParagraphIter->vCharacters.push_back( aCharacterData );
+ rParagraph.vCharacters.push_back( aCharacterData );
}
}
// vertical alignment
- std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
- std::vector< FWCharacterData >::const_iterator aCharacterIEnd ( aParagraphIter->vCharacters.end() );
- while ( aCharacterIter != aCharacterIEnd )
+ for ( auto& rCharacter : rParagraph.vCharacters )
{
- std::vector< tools::PolyPolygon >::iterator aOutlineIter( aCharacterIter->vOutlines.begin() );
- std::vector< tools::PolyPolygon >::const_iterator aOutlineIEnd( aCharacterIter->vOutlines.end() );
- while( aOutlineIter != aOutlineIEnd )
+ for( tools::PolyPolygon& rPolyPoly : rCharacter.vOutlines )
{
-
- tools::PolyPolygon& rPolyPoly = *aOutlineIter++;
-
if ( nVerticalOffset )
rPolyPoly.Move( 0, nVerticalOffset );
// retrieving the boundrect for the paragraph
tools::Rectangle aBoundRect( rPolyPoly.GetBoundRect() );
- aParagraphIter->aBoundRect.Union( aBoundRect );
+ rParagraph.aBoundRect.Union( aBoundRect );
}
- ++aCharacterIter;
}
}
// updating the boundrect for the text area by merging the current paragraph boundrect
- if ( aParagraphIter->aBoundRect.IsEmpty() )
+ if ( rParagraph.aBoundRect.IsEmpty() )
{
if ( rTextArea.aBoundRect.IsEmpty() )
rTextArea.aBoundRect = tools::Rectangle( Point( 0, 0 ), Size( 1, rFWData.nSingleLineHeight ) );
@@ -434,29 +406,23 @@ static void GetTextAreaOutline(
}
else
{
- tools::Rectangle& rParagraphBoundRect = aParagraphIter->aBoundRect;
+ tools::Rectangle& rParagraphBoundRect = rParagraph.aBoundRect;
rTextArea.aBoundRect.Union( rParagraphBoundRect );
if ( bSameLetterHeights )
{
- std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
- std::vector< FWCharacterData >::const_iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
- while ( aCharacterIter != aCharacterIEnd )
+ for ( auto& rCharacter : rParagraph.vCharacters )
{
- std::vector< tools::PolyPolygon >::iterator aOutlineIter( aCharacterIter->vOutlines.begin() );
- std::vector< tools::PolyPolygon >::const_iterator aOutlineIEnd( aCharacterIter->vOutlines.end() );
- while( aOutlineIter != aOutlineIEnd )
+ for( auto& rOutline : rCharacter.vOutlines )
{
- tools::Rectangle aPolyPolyBoundRect( aOutlineIter->GetBoundRect() );
+ tools::Rectangle aPolyPolyBoundRect( rOutline.GetBoundRect() );
if (aPolyPolyBoundRect.GetHeight() != rParagraphBoundRect.GetHeight() && aPolyPolyBoundRect.GetHeight())
- aOutlineIter->Scale( 1.0, static_cast<double>(rParagraphBoundRect.GetHeight()) / aPolyPolyBoundRect.GetHeight() );
- aPolyPolyBoundRect = aOutlineIter->GetBoundRect();
+ rOutline.Scale( 1.0, static_cast<double>(rParagraphBoundRect.GetHeight()) / aPolyPolyBoundRect.GetHeight() );
+ aPolyPolyBoundRect = rOutline.GetBoundRect();
sal_Int32 nMove = aPolyPolyBoundRect.Top() - rParagraphBoundRect.Top();
if ( nMove )
- aOutlineIter->Move( 0, -nMove );
- ++aOutlineIter;
+ rOutline.Move( 0, -nMove );
}
- ++aCharacterIter;
}
}
}
@@ -464,7 +430,6 @@ static void GetTextAreaOutline(
nVerticalOffset -= rFWData.nSingleLineHeight;
else
nVerticalOffset += rFWData.nSingleLineHeight;
- ++aParagraphIter;
}
}
@@ -475,9 +440,6 @@ static bool GetFontWorkOutline(
SdrTextHorzAdjust eHorzAdjust(rSdrObjCustomShape.GetMergedItem( SDRATTR_TEXT_HORZADJUST ).GetValue());
drawing::TextFitToSizeType const eFTS(rSdrObjCustomShape.GetMergedItem( SDRATTR_TEXT_FITTOSIZE ).GetValue());
- std::vector< FWTextArea >::iterator aTextAreaIter = rFWData.vTextAreas.begin();
- std::vector< FWTextArea >::const_iterator aTextAreaIEnd = rFWData.vTextAreas.end();
-
bool bSameLetterHeights = false;
const SdrCustomShapeGeometryItem& rGeometryItem(rSdrObjCustomShape.GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ));
const css::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( "TextPath", "SameLetterHeights" );
@@ -494,12 +456,12 @@ static bool GetFontWorkOutline(
if (rFWData.nSingleLineHeight == SAL_MIN_INT32)
return false;
- while ( aTextAreaIter != aTextAreaIEnd )
+ for ( auto& rTextArea : rFWData.vTextAreas )
{
GetTextAreaOutline(
rFWData,
rSdrObjCustomShape,
- *aTextAreaIter,
+ rTextArea,
bSameLetterHeights);
if (eFTS == drawing::TextFitToSizeType_ALLLINES ||
@@ -507,30 +469,21 @@ static bool GetFontWorkOutline(
// need another ODF attribute!
eFTS == drawing::TextFitToSizeType_PROPORTIONAL)
{
- std::vector< FWParagraphData >::iterator aParagraphIter( aTextAreaIter->vParagraphs.begin() );
- std::vector< FWParagraphData >::const_iterator aParagraphIEnd( aTextAreaIter->vParagraphs.end() );
- while ( aParagraphIter != aParagraphIEnd )
+ for ( auto& rParagraph : rTextArea.vParagraphs )
{
- sal_Int32 nParaWidth = aParagraphIter->aBoundRect.GetWidth();
+ sal_Int32 nParaWidth = rParagraph.aBoundRect.GetWidth();
if ( nParaWidth )
{
- double fScale = static_cast<double>(aTextAreaIter->aBoundRect.GetWidth()) / nParaWidth;
+ double fScale = static_cast<double>(rTextArea.aBoundRect.GetWidth()) / nParaWidth;
- std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
- std::vector< FWCharacterData >::const_iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
- while ( aCharacterIter != aCharacterIEnd )
+ for ( auto& rCharacter : rParagraph.vCharacters )
{
- std::vector< tools::PolyPolygon >::iterator aOutlineIter = aCharacterIter->vOutlines.begin();
- std::vector< tools::PolyPolygon >::const_iterator aOutlineIEnd = aCharacterIter->vOutlines.end();
- while( aOutlineIter != aOutlineIEnd )
+ for( auto& rOutline : rCharacter.vOutlines )
{
- aOutlineIter->Scale( fScale, 1.0 );
- ++aOutlineIter;
+ rOutline.Scale( fScale, 1.0 );
}
- ++aCharacterIter;
}
}
- ++aParagraphIter;
}
}
else if (rFWData.bScaleX)
@@ -538,36 +491,26 @@ static bool GetFontWorkOutline(
const SdrTextVertAdjust nVertJustify = rSdrObjCustomShape.GetMergedItem( SDRATTR_TEXT_VERTADJUST ).GetValue();
double fFactor = nVertJustify == SdrTextVertAdjust::SDRTEXTVERTADJUST_BOTTOM ? -0.5 : ( nVertJustify == SdrTextVertAdjust::SDRTEXTVERTADJUST_TOP ? 0.5 : 0 );
- std::vector< FWParagraphData >::iterator aParagraphIter( aTextAreaIter->vParagraphs.begin() );
- std::vector< FWParagraphData >::const_iterator aParagraphIEnd( aTextAreaIter->vParagraphs.end() );
- while ( aParagraphIter != aParagraphIEnd )
+ for ( auto& rParagraph : rTextArea.vParagraphs )
{
sal_Int32 nHorzDiff = 0;
- sal_Int32 nVertDiff = static_cast<double>( rFWData.nSingleLineHeight ) * fFactor * ( aTextAreaIter->vParagraphs.size() - 1 );
+ sal_Int32 nVertDiff = static_cast<double>( rFWData.nSingleLineHeight ) * fFactor * ( rTextArea.vParagraphs.size() - 1 );
if ( eHorzAdjust == SDRTEXTHORZADJUST_CENTER )
- nHorzDiff = ( rFWData.fHorizontalTextScaling * aTextAreaIter->aBoundRect.GetWidth() - aParagraphIter->aBoundRect.GetWidth() ) / 2;
+ nHorzDiff = ( rFWData.fHorizontalTextScaling * rTextArea.aBoundRect.GetWidth() - rParagraph.aBoundRect.GetWidth() ) / 2;
else if ( eHorzAdjust == SDRTEXTHORZADJUST_RIGHT )
- nHorzDiff = ( rFWData.fHorizontalTextScaling * aTextAreaIter->aBoundRect.GetWidth() - aParagraphIter->aBoundRect.GetWidth() );
+ nHorzDiff = ( rFWData.fHorizontalTextScaling * rTextArea.aBoundRect.GetWidth() - rParagraph.aBoundRect.GetWidth() );
if (nHorzDiff)
{
- std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
- std::vector< FWCharacterData >::const_iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
- while ( aCharacterIter != aCharacterIEnd )
+ for ( auto& rCharacter : rParagraph.vCharacters )
{
- std::vector< tools::PolyPolygon >::iterator aOutlineIter = aCharacterIter->vOutlines.begin();
- std::vector< tools::PolyPolygon >::const_iterator aOutlineIEnd = aCharacterIter->vOutlines.end();
- while( aOutlineIter != aOutlineIEnd )
+ for( auto& rOutline : rCharacter.vOutlines )
{
- aOutlineIter->Move( nHorzDiff, nVertDiff );
- ++aOutlineIter;
+ rOutline.Move( nHorzDiff, nVertDiff );
}
- ++aCharacterIter;
}
}
-
- ++aParagraphIter;
}
}
else
@@ -577,32 +520,23 @@ static bool GetFontWorkOutline(
case SDRTEXTHORZADJUST_RIGHT :
case SDRTEXTHORZADJUST_CENTER:
{
- std::vector< FWParagraphData >::iterator aParagraphIter( aTextAreaIter->vParagraphs.begin() );
- std::vector< FWParagraphData >::const_iterator aParagraphIEnd( aTextAreaIter->vParagraphs.end() );
- while ( aParagraphIter != aParagraphIEnd )
+ for ( auto& rParagraph : rTextArea.vParagraphs )
{
sal_Int32 nHorzDiff = 0;
if ( eHorzAdjust == SDRTEXTHORZADJUST_CENTER )
- nHorzDiff = ( aTextAreaIter->aBoundRect.GetWidth() - aParagraphIter->aBoundRect.GetWidth() ) / 2;
+ nHorzDiff = ( rTextArea.aBoundRect.GetWidth() - rParagraph.aBoundRect.GetWidth() ) / 2;
else if ( eHorzAdjust == SDRTEXTHORZADJUST_RIGHT )
- nHorzDiff = ( aTextAreaIter->aBoundRect.GetWidth() - aParagraphIter->aBoundRect.GetWidth() );
+ nHorzDiff = ( rTextArea.aBoundRect.GetWidth() - rParagraph.aBoundRect.GetWidth() );
if ( nHorzDiff )
{
- std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
- std::vector< FWCharacterData >::const_iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
- while ( aCharacterIter != aCharacterIEnd )
+ for ( auto& rCharacter : rParagraph.vCharacters )
{
- std::vector< tools::PolyPolygon >::iterator aOutlineIter = aCharacterIter->vOutlines.begin();
- std::vector< tools::PolyPolygon >::const_iterator aOutlineIEnd = aCharacterIter->vOutlines.end();
- while( aOutlineIter != aOutlineIEnd )
+ for( auto& rOutline : rCharacter.vOutlines )
{
- aOutlineIter->Move( nHorzDiff, 0 );
- ++aOutlineIter;
+ rOutline.Move( nHorzDiff, 0 );
}
- ++aCharacterIter;
}
}
- ++aParagraphIter;
}
}
break;
@@ -611,7 +545,6 @@ static bool GetFontWorkOutline(
case SDRTEXTHORZADJUST_LEFT : break; // already left aligned -> nothing to do
}
}
- ++aTextAreaIter;
}
return true;
@@ -653,10 +586,8 @@ static void CalcDistances( const tools::Polygon& rPoly, std::vector< double >& r
double fLength = rDistances[ rDistances.size() - 1 ];
if ( fLength > 0.0 )
{
- std::vector< double >::iterator aIter = rDistances.begin();
- std::vector< double >::const_iterator aEnd = rDistances.end();
- while ( aIter != aEnd )
- *aIter++ /= fLength;
+ for ( auto& rDistance : rDistances )
+ rDistance /= fLength;
}
}
}
@@ -745,13 +676,10 @@ static void GetPoint( const tools::Polygon& rPoly, const std::vector< double >&
static void FitTextOutlinesToShapeOutlines( const tools::PolyPolygon& aOutlines2d, FWData& rFWData )
{
- std::vector< FWTextArea >::iterator aTextAreaIter = rFWData.vTextAreas.begin();
- std::vector< FWTextArea >::iterator aTextAreaIEnd = rFWData.vTextAreas.end();
-
sal_uInt16 nOutline2dIdx = 0;
- while( aTextAreaIter != aTextAreaIEnd )
+ for( auto& rTextArea : rFWData.vTextAreas )
{
- tools::Rectangle rTextAreaBoundRect = aTextAreaIter->aBoundRect;
+ tools::Rectangle rTextAreaBoundRect = rTextArea.aBoundRect;
sal_Int32 nLeft = rTextAreaBoundRect.Left();
sal_Int32 nTop = rTextAreaBoundRect.Top();
sal_Int32 nWidth = rTextAreaBoundRect.GetWidth();
@@ -775,19 +703,12 @@ static void FitTextOutlinesToShapeOutlines( const tools::PolyPolygon& aOutlines2
CalcDistances( rOutlinePoly, vDistances );
if ( !vDistances.empty() )
{
- std::vector< FWParagraphData >::iterator aParagraphIter( aTextAreaIter->vParagraphs.begin() );
- std::vector< FWParagraphData >::const_iterator aParagraphIEnd( aTextAreaIter->vParagraphs.end() );
- while( aParagraphIter != aParagraphIEnd )
+ for( auto& rParagraph : rTextArea.vParagraphs )
{
- std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
- std::vector< FWCharacterData >::const_iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
- while ( aCharacterIter != aCharacterIEnd )
+ for ( auto& rCharacter : rParagraph.vCharacters )
{
- std::vector< tools::PolyPolygon >::iterator aOutlineIter = aCharacterIter->vOutlines.begin();
- std::vector< tools::PolyPolygon >::const_iterator aOutlineIEnd = aCharacterIter->vOutlines.end();
- while( aOutlineIter != aOutlineIEnd )
+ for( tools::PolyPolygon& rPolyPoly : rCharacter.vOutlines )
{
- tools::PolyPolygon& rPolyPoly = *aOutlineIter;
tools::Rectangle aBoundRect( rPolyPoly.GetBoundRect() );
double fx1 = aBoundRect.Left() - nLeft;
double fx2 = aBoundRect.Right() - nLeft;
@@ -812,17 +733,13 @@ static void FitTextOutlinesToShapeOutlines( const tools::PolyPolygon& aOutlines2
}
fvx = fvx / fL;
fvy = fvy / fL;
- fL = aTextAreaIter->aBoundRect.GetHeight() / 2.0 + aTextAreaIter->aBoundRect.Top() - aParagraphIter->aBoundRect.Center().Y();
+ fL = rTextArea.aBoundRect.GetHeight() / 2.0 + rTextArea.aBoundRect.Top() - rParagraph.aBoundRect.Center().Y();
fvx *= fL;
fvy *= fL;
- rPolyPoly.Rotate( Point( aBoundRect.Center().X(), aParagraphIter->aBoundRect.Center().Y() ), sin( fAngle ), cos( fAngle ) );
- rPolyPoly.Move( static_cast<sal_Int32>( ( fx1 + fvx )- aBoundRect.Center().X() ), static_cast<sal_Int32>( ( fy1 + fvy ) - aParagraphIter->aBoundRect.Center().Y() ) );
-
- ++aOutlineIter;
+ rPolyPoly.Rotate( Point( aBoundRect.Center().X(), rParagraph.aBoundRect.Center().Y() ), sin( fAngle ), cos( fAngle ) );
+ rPolyPoly.Move( static_cast<sal_Int32>( ( fx1 + fvx )- aBoundRect.Center().X() ), static_cast<sal_Int32>( ( fy1 + fvy ) - rParagraph.aBoundRect.Center().Y() ) );
}
- ++aCharacterIter;
}
- ++aParagraphIter;
}
}
}
@@ -843,19 +760,12 @@ static void FitTextOutlinesToShapeOutlines( const tools::PolyPolygon& aOutlines2
vDistances2.reserve( nPointCount2 );
CalcDistances( rOutlinePoly, vDistances );
CalcDistances( rOutlinePoly2, vDistances2 );
- std::vector< FWParagraphData >::iterator aParagraphIter = aTextAreaIter->vParagraphs.begin();
- std::vector< FWParagraphData >::const_iterator aParagraphIEnd = aTextAreaIter->vParagraphs.end();
- while( aParagraphIter != aParagraphIEnd )
+ for( auto& rParagraph : rTextArea.vParagraphs )
{
- std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
- std::vector< FWCharacterData >::const_iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
- while ( aCharacterIter != aCharacterIEnd )
+ for ( auto& rCharacter : rParagraph.vCharacters )
{
- std::vector< tools::PolyPolygon >::iterator aOutlineIter = aCharacterIter->vOutlines.begin();
- std::vector< tools::PolyPolygon >::const_iterator aOutlineIEnd = aCharacterIter->vOutlines.end();
- while( aOutlineIter != aOutlineIEnd )
+ for( tools::PolyPolygon& rPolyPoly : rCharacter.vOutlines )
{
- tools::PolyPolygon& rPolyPoly = *aOutlineIter;
sal_uInt16 i, nPolyCount = rPolyPoly.Count();
for ( i = 0; i < nPolyCount; i++ )
{
@@ -899,15 +809,11 @@ static void FitTextOutlinesToShapeOutlines( const tools::PolyPolygon& aOutlines2
// write back polygon
rPolyPoly[ i ] = aLocalPoly;
}
- ++aOutlineIter;
}
- ++aCharacterIter;
}
- ++aParagraphIter;
}
}
}
- ++aTextAreaIter;
}
}
@@ -919,30 +825,18 @@ static SdrObject* CreateSdrObjectFromParagraphOutlines(
basegfx::B2DPolyPolygon aPolyPoly;
if ( !rFWData.vTextAreas.empty() )
{
- std::vector< FWTextArea >::const_iterator aTextAreaIter = rFWData.vTextAreas.begin();
- std::vector< FWTextArea >::const_iterator aTextAreaIEnd = rFWData.vTextAreas.end();
- while ( aTextAreaIter != aTextAreaIEnd )
+ for ( const auto& rTextArea : rFWData.vTextAreas )
{
- std::vector< FWParagraphData >::const_iterator aParagraphIter = aTextAreaIter->vParagraphs.begin();
- std::vector< FWParagraphData >::const_iterator aParagraphIEnd = aTextAreaIter->vParagraphs.end();
- while ( aParagraphIter != aParagraphIEnd )
+ for ( const auto& rParagraph : rTextArea.vParagraphs )
{
- std::vector< FWCharacterData >::const_iterator aCharacterIter( aParagraphIter->vCharacters.begin() );
- std::vector< FWCharacterData >::const_iterator aCharacterIEnd( aParagraphIter->vCharacters.end() );
- while ( aCharacterIter != aCharacterIEnd )
+ for ( const auto& rCharacter : rParagraph.vCharacters )
{
- std::vector< tools::PolyPolygon >::const_iterator aOutlineIter = aCharacterIter->vOutlines.begin();
- std::vector< tools::PolyPolygon >::const_iterator aOutlineIEnd = aCharacterIter->vOutlines.end();
- while( aOutlineIter != aOutlineIEnd )
+ for( const auto& rOutline : rCharacter.vOutlines )
{
- aPolyPoly.append( aOutlineIter->getB2DPolyPolygon() );
- ++aOutlineIter;
+ aPolyPoly.append( rOutline.getB2DPolyPolygon() );
}
- ++aCharacterIter;
}
- ++aParagraphIter;
}
- ++aTextAreaIter;
}
pRet = new SdrPathObj(
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index a3044f460996..eea119f0927e 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -1808,19 +1808,14 @@ void SubsetMap::ApplyCharMap( const FontCharMapRef& rxFontCharMap )
return;
// remove subsets that are not matched in any range
- auto it = maSubsets.begin();
- while(it != maSubsets.end())
- {
- const Subset& rSubset = *it;
- sal_uInt32 cMin = rSubset.GetRangeMin();
- sal_uInt32 cMax = rSubset.GetRangeMax();
-
- int nCount = rxFontCharMap->CountCharsInRange( cMin, cMax );
- if( nCount <= 0 )
- it = maSubsets.erase(it);
- else
- ++it;
- }
+ maSubsets.erase(std::remove_if(maSubsets.begin(), maSubsets.end(),
+ [&rxFontCharMap](const Subset& rSubset) {
+ sal_uInt32 cMin = rSubset.GetRangeMin();
+ sal_uInt32 cMax = rSubset.GetRangeMax();
+ int nCount = rxFontCharMap->CountCharsInRange( cMin, cMax );
+ return nCount <= 0;
+ }),
+ maSubsets.end());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx
index 13677d4c63fc..c1434bf5df6b 100644
--- a/svx/source/dialog/docrecovery.cxx
+++ b/svx/source/dialog/docrecovery.cxx
@@ -130,12 +130,8 @@ void RecoveryCore::saveBrokenTempEntries(const OUString& rPath)
// changed or removed element. And that will change our m_lURLs list.
// That's not a good idea, if we use a stl iterator inbetween .-)
TURLList lURLs = m_lURLs;
- TURLList::const_iterator pIt;
- for ( pIt = lURLs.begin();
- pIt != lURLs.end() ;
- ++pIt )
+ for (const TURLInfo& rInfo : lURLs)
{
- const TURLInfo& rInfo = *pIt;
if (!RecoveryCore::isBrokenTempEntry(rInfo))
continue;
@@ -168,12 +164,8 @@ void RecoveryCore::saveAllTempEntries(const OUString& rPath)
// changed or removed element. And that will change our m_lURLs list.
// That's not a good idea, if we use a stl iterator inbetween .-)
TURLList lURLs = m_lURLs;
- TURLList::const_iterator pIt;
- for ( pIt = lURLs.begin();
- pIt != lURLs.end() ;
- ++pIt )
+ for (const TURLInfo& rInfo : lURLs)
{
- const TURLInfo& rInfo = *pIt;
if (rInfo.TempURL.isEmpty())
continue;
@@ -200,12 +192,8 @@ void RecoveryCore::forgetBrokenTempEntries()
// changed or removed element. And that will change our m_lURLs list.
// That's not a good idea, if we use a stl iterator inbetween .-)
TURLList lURLs = m_lURLs;
- TURLList::const_iterator pIt;
- for ( pIt = lURLs.begin();
- pIt != lURLs.end() ;
- ++pIt )
+ for (const TURLInfo& rInfo : lURLs)
{
- const TURLInfo& rInfo = *pIt;
if (!RecoveryCore::isBrokenTempEntry(rInfo))
continue;
@@ -232,12 +220,8 @@ void RecoveryCore::forgetAllRecoveryEntries()
// changed or removed element. And that will change our m_lURLs list.
// That's not a good idea, if we use a stl iterator inbetween .-)
TURLList lURLs = m_lURLs;
- TURLList::const_iterator pIt;
- for ( pIt = lURLs.begin();
- pIt != lURLs.end() ;
- ++pIt )
+ for (const TURLInfo& rInfo : lURLs)
{
- const TURLInfo& rInfo = *pIt;
lRemoveArgs[1].Value <<= rInfo.ID;
m_xRealCore->dispatch(aRemoveURL, lRemoveArgs);
}
@@ -261,12 +245,8 @@ void RecoveryCore::forgetBrokenRecoveryEntries()
// changed or removed element. And that will change our m_lURLs list.
// That's not a good idea, if we use a stl iterator inbetween .-)
TURLList lURLs = m_lURLs;
- TURLList::const_iterator pIt;
- for ( pIt = lURLs.begin();
- pIt != lURLs.end() ;
- ++pIt )
+ for (const TURLInfo& rInfo : lURLs)
{
- const TURLInfo& rInfo = *pIt;
if (!RecoveryCore::isBrokenTempEntry(rInfo))
continue;
@@ -419,12 +399,8 @@ void SAL_CALL RecoveryCore::statusChanged(const css::frame::FeatureStateEvent& a
}
// search for already existing items and update her nState value ...
- TURLList::iterator pIt;
- for ( pIt = m_lURLs.begin();
- pIt != m_lURLs.end() ;
- ++pIt )
+ for (TURLInfo& aOld : m_lURLs)
{
- TURLInfo& aOld = *pIt;
if (aOld.ID == aNew.ID)
{
// change existing
@@ -639,13 +615,9 @@ SaveDialog::SaveDialog(vcl::Window* pParent, RecoveryCore* pCore)
m_pFileListLB->Clear();
TURLList& rURLs = m_pCore->getURLListAccess();
- TURLList::const_iterator pIt;
- for ( pIt = rURLs.begin();
- pIt != rURLs.end() ;
- ++pIt )
+ for (const TURLInfo& rInfo : rURLs)
{
- const TURLInfo& rInfo = *pIt;
m_pFileListLB->InsertEntry( rInfo.DisplayName, rInfo.StandardImage );
}
}
@@ -878,13 +850,8 @@ RecoveryDialog::RecoveryDialog(vcl::Window* pParent, RecoveryCore* pCore)
// fill list box first time
TURLList& rURLList = m_pCore->getURLListAccess();
- TURLList::const_iterator pIt;
- for ( pIt = rURLList.begin();
- pIt != rURLList.end() ;
- ++pIt )
+ for (const TURLInfo& rInfo : rURLList)
{
- const TURLInfo& rInfo = *pIt;
-
OUString sName( rInfo.DisplayName );
sName += "\t";
sName += impl_getStatusString( rInfo );
@@ -1238,13 +1205,8 @@ void BrokenRecoveryDialog::impl_refresh()
{
m_bExecutionNeeded = false;
TURLList& rURLList = m_pCore->getURLListAccess();
- TURLList::const_iterator pIt;
- for ( pIt = rURLList.begin();
- pIt != rURLList.end() ;
- ++pIt )
+ for (const TURLInfo& rInfo : rURLList)
{
- const TURLInfo& rInfo = *pIt;
-
if (m_bBeforeRecovery)
{
// "Cancel" before recovery ->
diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx
index fe058f676914..ce7233371857 100644
--- a/svx/source/dialog/frmsel.cxx
+++ b/svx/source/dialog/frmsel.cxx
@@ -262,9 +262,9 @@ FrameSelectorImpl::FrameSelectorImpl( FrameSelector& rFrameSel ) :
FrameSelectorImpl::~FrameSelectorImpl()
{
- for( auto aIt = maChildVec.begin(), aEnd = maChildVec.end(); aIt != aEnd; ++aIt )
- if( aIt->is() )
- (*aIt)->Invalidate();
+ for( auto& rpChild : maChildVec )
+ if( rpChild.is() )
+ rpChild->Invalidate();
}
// initialization
diff --git a/svx/source/dialog/searchcharmap.cxx b/svx/source/dialog/searchcharmap.cxx
index b7361e8dce38..61e6eaaa8712 100644
--- a/svx/source/dialog/searchcharmap.cxx
+++ b/svx/source/dialog/searchcharmap.cxx
@@ -132,12 +132,10 @@ void SvxSearchCharSet::SelectCharacter( const Subset* sub )
while(cChar <= sub->GetRangeMax() && nMapIndex == 0)
{
- for(auto it = m_aItemList.begin(); it!= m_aItemList.end(); it++)
- if(it->second == cChar)
- {
- nMapIndex = it->first;
- break;
- }
+ auto it = std::find_if(m_aItemList.begin(), m_aItemList.end(),
+ [&cChar](const std::pair<const sal_Int32, sal_UCS4>& rItem) { return rItem.second == cChar; });
+ if (it != m_aItemList.end())
+ nMapIndex = it->first;
cChar++;
}
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 20cd94e06252..e86d1f4e9847 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -1627,11 +1627,8 @@ void SvxSearchDialog::Remember_Impl( const OUString &rStr, bool _bSearch )
ComboBox* pListBox = _bSearch ? m_pSearchLB.get() : m_pReplaceLB.get();
// ignore identical strings
- for (std::vector<OUString>::const_iterator i = pArr->begin(); i != pArr->end(); ++i)
- {
- if ((*i) == rStr)
- return;
- }
+ if (std::find(pArr->begin(), pArr->end(), rStr) != pArr->end())
+ return;
// delete oldest entry at maximum occupancy (ListBox and Array)
if(REMEMBER_SIZE < pArr->size())
diff --git a/svx/source/engine3d/helperhittest3d.cxx b/svx/source/engine3d/helperhittest3d.cxx
index 5ffa15457fe4..f5fc02d6456e 100644
--- a/svx/source/engine3d/helperhittest3d.cxx
+++ b/svx/source/engine3d/helperhittest3d.cxx
@@ -218,12 +218,9 @@ void getAllHit3DObjectsSortedFrontToBack(
::std::sort(aDepthAndObjectResults.begin(), aDepthAndObjectResults.end());
// copy SdrObject pointers to return result set
- ::std::vector< ImplPairDephAndObject >::iterator aIterator2(aDepthAndObjectResults.begin());
- ::std::vector< ImplPairDephAndObject >::const_iterator aEnd(aDepthAndObjectResults.end());
-
- for(;aIterator2 != aEnd; ++aIterator2)
+ for(const auto& rResult : aDepthAndObjectResults)
{
- o_rResult.push_back(aIterator2->getObject());
+ o_rResult.push_back(rResult.getObject());
}
}
}
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index ce6e3c831027..8a1b3852f8ae 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -1066,23 +1066,20 @@ void E3dView::DoDepthArrange(E3dScene const * pScene, double fDepth)
{
// do we have overlap with an object of this layer?
bool bOverlap(false);
- auto itAct = pLayer->mvNeighbours.begin();
- while(!bOverlap && itAct != pLayer->mvNeighbours.end())
+ for(const auto& rAct : pLayer->mvNeighbours)
{
- // do itAct->mpObj and pExtrudeObj overlap? Check by
+ // do rAct.mpObj and pExtrudeObj overlap? Check by
// using logical AND clipping
const basegfx::B2DPolyPolygon aAndPolyPolygon(
basegfx::utils::solvePolygonOperationAnd(
aExtrudePoly,
- itAct->maPreparedPolyPolygon));
+ rAct.maPreparedPolyPolygon));
- bOverlap = (0 != aAndPolyPolygon.count());
-
- if(bOverlap)
+ if(aAndPolyPolygon.count() != 0)
{
// second criteria: is another fillstyle or color used?
- const SfxItemSet& rCompareSet = itAct->mpObj->GetMergedItemSet();
+ const SfxItemSet& rCompareSet = rAct.mpObj->GetMergedItemSet();
drawing::FillStyle eCompareFillStyle = rCompareSet.Get(XATTR_FILLSTYLE).GetValue();
@@ -1094,17 +1091,18 @@ void E3dView::DoDepthArrange(E3dScene const * pScene, double fDepth)
if(aCompareColor == aLocalColor)
{
- bOverlap = false;
+ continue;
}
}
else if(eLocalFillStyle == drawing::FillStyle_NONE)
{
- bOverlap = false;
+ continue;
}
}
- }
- ++itAct;
+ bOverlap = true;
+ break;
+ }
}
if(bOverlap)
@@ -1143,15 +1141,10 @@ void E3dView::DoDepthArrange(E3dScene const * pScene, double fDepth)
while(pLayer)
{
// move along layer
- auto itAct = pLayer->mvNeighbours.begin();
-
- while(itAct != pLayer->mvNeighbours.end())
+ for(auto& rAct : pLayer->mvNeighbours)
{
// adapt extrude value
- itAct->mpObj->SetMergedItem(SfxUInt32Item(SDRATTR_3DOBJ_DEPTH, sal_uInt32(fMinDepth + 0.5)));
-
- // next
- ++itAct;
+ rAct.mpObj->SetMergedItem(SfxUInt32Item(SDRATTR_3DOBJ_DEPTH, sal_uInt32(fMinDepth + 0.5)));
}
// next layer
More information about the Libreoffice-commits
mailing list