[Libreoffice-commits] core.git: svx/source
Julien Nabet
serval2412 at yahoo.fr
Tue Apr 12 16:04:21 UTC 2016
svx/source/accessibility/AccessibleShape.cxx | 3
svx/source/accessibility/ChildrenManagerImpl.cxx | 64 ++++++++---------
svx/source/accessibility/GraphCtlAccessibleContext.cxx | 5 -
svx/source/accessibility/ShapeTypeHandler.cxx | 4 -
svx/source/accessibility/charmapacc.cxx | 5 -
5 files changed, 39 insertions(+), 42 deletions(-)
New commits:
commit ebbc55f27052229d4a445884f83c426ee2ddc402
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Tue Apr 12 12:36:26 2016 +0200
Use const_iterator when possible (svx/accessibility)
Change-Id: I9bdd0a03f69bb92ed668da2ad596e23164d7f290
Reviewed-on: https://gerrit.libreoffice.org/24022
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx
index 6a19e34..4715e92 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -1442,10 +1442,9 @@ throw (uno::RuntimeException, std::exception)
std::sort( vXShapes.begin(), vXShapes.end(), XShapePosCompareHelper() );
//get the index of the selected object in the group
- std::vector< uno::Reference<drawing::XShape> >::iterator aIter;
//we start counting position from 1
sal_Int32 nPos = 1;
- for ( aIter = vXShapes.begin(); aIter != vXShapes.end(); ++aIter, nPos++ )
+ for ( std::vector< uno::Reference<drawing::XShape> >::const_iterator aIter = vXShapes.begin(); aIter != vXShapes.end(); ++aIter, nPos++ )
{
if ( (*aIter).get() == mxShape.get() )
{
diff --git a/svx/source/accessibility/ChildrenManagerImpl.cxx b/svx/source/accessibility/ChildrenManagerImpl.cxx
index 5dee9c7..35c11e4 100644
--- a/svx/source/accessibility/ChildrenManagerImpl.cxx
+++ b/svx/source/accessibility/ChildrenManagerImpl.cxx
@@ -45,7 +45,7 @@ namespace
{
void adjustIndexInParentOfShapes(ChildDescriptorListType& _rList)
{
- ChildDescriptorListType::iterator aEnd = _rList.end();
+ ChildDescriptorListType::const_iterator aEnd = _rList.end();
sal_Int32 i=0;
for ( ChildDescriptorListType::iterator aIter = _rList.begin(); aIter != aEnd; ++aIter,++i)
aIter->setIndexAtAccessibleShape(i);
@@ -111,8 +111,8 @@ css::uno::Reference<css::drawing::XShape> ChildrenManagerImpl::GetChildShape(lon
css::lang::IndexOutOfBoundsException)
{
uno::Reference<XAccessible> xAcc = GetChild(nIndex);
- ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end();
- for (I = maVisibleChildren.begin(); I != aEnd; ++I)
+ ChildDescriptorListType::const_iterator aEnd = maVisibleChildren.end();
+ for (ChildDescriptorListType::iterator I = maVisibleChildren.begin(); I != aEnd; ++I)
{
if (I->mxAccessibleShape == xAcc)
return I->mxShape;
@@ -181,8 +181,8 @@ uno::Reference<XAccessible>
ChildrenManagerImpl::GetChild (const uno::Reference<drawing::XShape>& xShape)
throw (uno::RuntimeException)
{
- ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end();
- for (I = maVisibleChildren.begin(); I != aEnd; ++I)
+ ChildDescriptorListType::const_iterator aEnd = maVisibleChildren.end();
+ for (ChildDescriptorListType::iterator I = maVisibleChildren.begin(); I != aEnd; ++I)
{
if ( I->mxShape.get() == xShape.get() )
return I->mxAccessibleShape;
@@ -287,8 +287,8 @@ void ChildrenManagerImpl::CreateListOfVisibleShapes (
Rectangle aVisibleArea = maShapeTreeInfo.GetViewForwarder()->GetVisibleArea();
// Add the visible shapes for which the accessible objects already exist.
- AccessibleShapeList::iterator I,aEnd = maAccessibleShapes.end();
- for (I=maAccessibleShapes.begin(); I != aEnd; ++I)
+ AccessibleShapeList::const_iterator aEnd = maAccessibleShapes.end();
+ for (AccessibleShapeList::iterator I=maAccessibleShapes.begin(); I != aEnd; ++I)
{
if (I->is())
{
@@ -343,8 +343,8 @@ 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::iterator I, aEnd = rOldChildList.end();
- for (I=rOldChildList.begin(); I != aEnd; ++I)
+ ChildDescriptorListType::const_iterator aEnd = rOldChildList.end();
+ for (ChildDescriptorListType::iterator I=rOldChildList.begin(); I != aEnd; ++I)
{
if (::std::find(rNewChildList.begin(), rNewChildList.end(), *I) == rNewChildList.end())
{
@@ -372,14 +372,16 @@ void ChildrenManagerImpl::MergeAccessibilityInformation (
ChildDescriptorListType& raNewChildList)
{
ChildDescriptorListType::iterator aOldChildDescriptor;
- ChildDescriptorListType::iterator I, aEnd = raNewChildList.end();
- for (I=raNewChildList.begin(); I != aEnd; ++I)
+ ChildDescriptorListType::const_iterator aEndVisibleChildren = maVisibleChildren.end();
+
+ ChildDescriptorListType::const_iterator aEnd = raNewChildList.end();
+ for (ChildDescriptorListType::iterator I=raNewChildList.begin(); I != aEnd; ++I)
{
aOldChildDescriptor = ::std::find (maVisibleChildren.begin(), maVisibleChildren.end(), *I);
// Copy accessible shape if that exists in the old descriptor.
bool bRegistrationIsNecessary = true;
- if (aOldChildDescriptor != maVisibleChildren.end())
+ if (aOldChildDescriptor != aEndVisibleChildren)
if (aOldChildDescriptor->mxAccessibleShape.is())
{
I->mxAccessibleShape = aOldChildDescriptor->mxAccessibleShape;
@@ -395,8 +397,8 @@ void ChildrenManagerImpl::MergeAccessibilityInformation (
void ChildrenManagerImpl::SendVisibleAreaEvents (
ChildDescriptorListType& raNewChildList)
{
- ChildDescriptorListType::iterator I,aEnd = raNewChildList.end();
- for (I=raNewChildList.begin(); I != aEnd; ++I)
+ ChildDescriptorListType::const_iterator aEnd = raNewChildList.end();
+ for (ChildDescriptorListType::iterator I=raNewChildList.begin(); I != aEnd; ++I)
{
// Tell shape of changed visible area. To do this, fake a
// change of the view forwarder. (Actually we usually get here
@@ -413,9 +415,9 @@ void ChildrenManagerImpl::SendVisibleAreaEvents (
void ChildrenManagerImpl::CreateAccessibilityObjects (
ChildDescriptorListType& raNewChildList)
{
- ChildDescriptorListType::iterator I, aEnd = raNewChildList.end();
+ ChildDescriptorListType::const_iterator aEnd = raNewChildList.end();
sal_Int32 nPos = 0;
- for ( I = raNewChildList.begin(); I != aEnd; ++I,++nPos)
+ for ( ChildDescriptorListType::iterator I = raNewChildList.begin(); I != aEnd; ++I,++nPos)
{
// Create the associated accessible object when the flag says so and
// it does not yet exist.
@@ -547,8 +549,8 @@ void ChildrenManagerImpl::ClearAccessibleShapeList()
// Clear the list of visible accessible objects. Objects not created on
// demand for XShapes are treated below.
- ChildDescriptorListType::iterator I,aEnd = aLocalVisibleChildren.end();
- for (I=aLocalVisibleChildren.begin(); I != aEnd; ++I)
+ ChildDescriptorListType::const_iterator aEnd = aLocalVisibleChildren.end();
+ for (ChildDescriptorListType::iterator I=aLocalVisibleChildren.begin(); I != aEnd; ++I)
if ( I->mxAccessibleShape.is() && I->mxShape.is() )
{
::comphelper::disposeComponent(I->mxAccessibleShape);
@@ -556,8 +558,8 @@ void ChildrenManagerImpl::ClearAccessibleShapeList()
}
// Dispose all objects in the accessible shape list.
- AccessibleShapeList::iterator J,aEnd2 = aLocalAccessibleShapes.end();
- for (J=aLocalAccessibleShapes.begin(); J != aEnd2; ++J)
+ AccessibleShapeList::const_iterator aEnd2 = aLocalAccessibleShapes.end();
+ for (AccessibleShapeList::iterator J=aLocalAccessibleShapes.begin(); J != aEnd2; ++J)
if (J->is())
{
// Dispose the object.
@@ -741,8 +743,8 @@ void ChildrenManagerImpl::ViewForwarderChanged (ChangeType aChangeType,
else
{
SolarMutexGuard g;
- ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end();
- for (I=maVisibleChildren.begin(); I != aEnd; ++I)
+ ChildDescriptorListType::const_iterator aEnd = maVisibleChildren.end();
+ for (ChildDescriptorListType::iterator I=maVisibleChildren.begin(); I != aEnd; ++I)
{
AccessibleShape* pShape = I->GetAccessibleShape();
if (pShape != nullptr)
@@ -775,8 +777,8 @@ bool ChildrenManagerImpl::ReplaceChild (
// 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::iterator I,aEnd = maVisibleChildren.end();
- for (I=maVisibleChildren.begin(); I != aEnd; ++I)
+ ChildDescriptorListType::const_iterator aEnd = maVisibleChildren.end();
+ for (ChildDescriptorListType::iterator I=maVisibleChildren.begin(); I != aEnd; ++I)
{
if (I->GetAccessibleShape() == pCurrentChild)
{
@@ -825,8 +827,8 @@ uno::Reference<XAccessible>
ChildrenManagerImpl::GetAccessibleCaption (const uno::Reference<drawing::XShape>& xShape)
throw (uno::RuntimeException)
{
- ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end();
- for (I = maVisibleChildren.begin(); I != aEnd; ++I)
+ ChildDescriptorListType::const_iterator aEnd = maVisibleChildren.end();
+ for (ChildDescriptorListType::iterator I = maVisibleChildren.begin(); I != aEnd; ++I)
{
if ( I->mxShape.get() == xShape.get() )
return I->mxAccessibleShape;
@@ -869,8 +871,8 @@ void ChildrenManagerImpl::UpdateSelection()
int nAddSelect=0;
int nRemoveSelect=0;
bool bHasSelectedShape=false;
- ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end();
- for (I=maVisibleChildren.begin(); I != aEnd; ++I)
+ ChildDescriptorListType::const_iterator aEnd = maVisibleChildren.end();
+ for (ChildDescriptorListType::iterator I=maVisibleChildren.begin(); I != aEnd; ++I)
{
AccessibleShape* pAccessibleShape = I->GetAccessibleShape();
if (I->mxAccessibleShape.is() && I->mxShape.is() && pAccessibleShape!=nullptr)
@@ -964,11 +966,7 @@ void ChildrenManagerImpl::UpdateSelection()
mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED_WITHIN,uno::Any(),uno::Any());
nAddSelect =0 ;//not fire selection event
}
- //VEC_SHAPE::iterator vi = vecSelect.begin();
- //for (; vi != vecSelect.end() ;++vi)
- VEC_SHAPE::reverse_iterator vi = vecSelect.rbegin();
- for (; vi != vecSelect.rend() ;++vi)
-
+ for (VEC_SHAPE::reverse_iterator vi = vecSelect.rbegin(), aEndVecSelect = vecSelect.rend(); vi != aEndVecSelect ;++vi)
{
PAIR_SHAPE &pairShape= *vi;
Reference< XAccessible > xShape(pairShape.first);
diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
index 2e4462d..827078b 100644
--- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx
+++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
@@ -138,7 +138,7 @@ Reference< XAccessible > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessible(
if( pObj )
{
// see if we already created an XAccessible for the given SdrObject
- ShapesMapType::iterator iter = mxShapes.find( pObj );
+ ShapesMapType::const_iterator iter = mxShapes.find( pObj );
if( iter != mxShapes.end() )
{
@@ -669,8 +669,9 @@ void SAL_CALL SvxGraphCtrlAccessibleContext::disposing()
{
ShapesMapType::iterator I;
+ ShapesMapType::const_iterator endIt = mxShapes.end();
- for (I=mxShapes.begin(); I!=mxShapes.end(); ++I)
+ for (I=mxShapes.begin(); I!=endIt; ++I)
{
rtl::Reference<XAccessible> pAcc((*I).second.get());
Reference< XComponent > xComp( pAcc.get(), UNO_QUERY );
diff --git a/svx/source/accessibility/ShapeTypeHandler.cxx b/svx/source/accessibility/ShapeTypeHandler.cxx
index eba8907..0febf58 100644
--- a/svx/source/accessibility/ShapeTypeHandler.cxx
+++ b/svx/source/accessibility/ShapeTypeHandler.cxx
@@ -79,7 +79,7 @@ ShapeTypeHandler& ShapeTypeHandler::Instance()
*/
ShapeTypeId ShapeTypeHandler::GetTypeId (const OUString& aServiceName) const
{
- tServiceNameToSlotId::iterator I (maServiceNameToSlotId.find (aServiceName));
+ tServiceNameToSlotId::const_iterator I (maServiceNameToSlotId.find (aServiceName));
if (I != maServiceNameToSlotId.end())
{
return maShapeTypeDescriptorList[I->second].mnShapeTypeId;
@@ -178,7 +178,7 @@ void ShapeTypeHandler::AddShapeTypeList (int nDescriptorCount,
long ShapeTypeHandler::GetSlotId (const OUString& aServiceName) const
{
- tServiceNameToSlotId::iterator I (maServiceNameToSlotId.find (aServiceName));
+ tServiceNameToSlotId::const_iterator I (maServiceNameToSlotId.find (aServiceName));
if (I != maServiceNameToSlotId.end())
return I->second;
else
diff --git a/svx/source/accessibility/charmapacc.cxx b/svx/source/accessibility/charmapacc.cxx
index c9a2777..80d0e51 100644
--- a/svx/source/accessibility/charmapacc.cxx
+++ b/svx/source/accessibility/charmapacc.cxx
@@ -283,9 +283,8 @@ SvxShowCharSetAcc::~SvxShowCharSetAcc()
void SAL_CALL SvxShowCharSetAcc::disposing()
{
OAccessibleSelectionHelper::disposing();
- ::std::vector< Reference< XAccessible > >::iterator aIter = m_aChildren.begin();
- ::std::vector< Reference< XAccessible > >::iterator aEnd = m_aChildren.end();
- for (;aIter != aEnd ; ++aIter)
+ ::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);
m_aChildren.clear();
More information about the Libreoffice-commits
mailing list