summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slideshow/source/engine/activitiesqueue.cxx8
-rw-r--r--slideshow/source/engine/eventqueue.cxx12
-rw-r--r--slideshow/source/engine/slide/shapemanagerimpl.cxx75
-rw-r--r--slideshow/source/engine/slide/slideimpl.cxx9
-rw-r--r--slideshow/source/engine/slide/userpaintoverlay.cxx38
-rw-r--r--slideshow/source/engine/slideshowimpl.cxx28
-rw-r--r--slideshow/source/engine/transitions/slidetransitionfactory.cxx12
-rw-r--r--slideshow/source/engine/usereventqueue.cxx29
-rw-r--r--slideshow/source/inc/basecontainernode.hxx5
-rw-r--r--sot/qa/cppunit/test_sot.cxx11
-rw-r--r--sot/source/base/formats.cxx16
-rw-r--r--sot/source/sdstor/stgcache.cxx31
-rw-r--r--starmath/source/accessibility.cxx20
-rw-r--r--starmath/source/cfgitem.cxx11
-rw-r--r--starmath/source/cursor.cxx47
-rw-r--r--starmath/source/dialog.cxx10
-rw-r--r--starmath/source/symbol.cxx17
-rw-r--r--starmath/source/unomodel.cxx14
-rw-r--r--stoc/source/inspect/introspection.cxx10
-rw-r--r--stoc/source/invocation_adapterfactory/iafactory.cxx7
-rw-r--r--stoc/source/servicemanager/servicemanager.cxx10
-rw-r--r--stoc/source/simpleregistry/simpleregistry.cxx5
22 files changed, 168 insertions, 257 deletions
diff --git a/slideshow/source/engine/activitiesqueue.cxx b/slideshow/source/engine/activitiesqueue.cxx
index 8eadd83428e8..484c04283236 100644
--- a/slideshow/source/engine/activitiesqueue.cxx
+++ b/slideshow/source/engine/activitiesqueue.cxx
@@ -81,13 +81,9 @@ namespace slideshow
// accumulate time lag for all activities, and lag time
// base if necessary:
- ActivityQueue::const_iterator iPos(
- maCurrentActivitiesWaiting.begin() );
- const ActivityQueue::const_iterator iEnd(
- maCurrentActivitiesWaiting.end() );
double fLag = 0.0;
- for ( ; iPos != iEnd; ++iPos )
- fLag = std::max<double>( fLag, (*iPos)->calcTimeLag() );
+ for ( const auto& rxActivity : maCurrentActivitiesWaiting )
+ fLag = std::max<double>( fLag, rxActivity->calcTimeLag() );
if (fLag > 0.0)
{
mpTimer->adjustTimer( -fLag );
diff --git a/slideshow/source/engine/eventqueue.cxx b/slideshow/source/engine/eventqueue.cxx
index e1c53c4da4f6..33955faa61e4 100644
--- a/slideshow/source/engine/eventqueue.cxx
+++ b/slideshow/source/engine/eventqueue.cxx
@@ -59,11 +59,9 @@ namespace slideshow
EventQueue::~EventQueue()
{
// add in all that have been added explicitly for this round:
- EventEntryVector::const_iterator const iEnd( maNextEvents.end() );
- for ( EventEntryVector::const_iterator iPos( maNextEvents.begin() );
- iPos != iEnd; ++iPos )
+ for ( const auto& rEvent : maNextEvents )
{
- maEvents.push(*iPos);
+ maEvents.push(rEvent);
}
EventEntryVector().swap( maNextEvents );
@@ -166,10 +164,8 @@ namespace slideshow
SAL_INFO("slideshow.verbose", "EventQueue: heartbeat" );
// add in all that have been added explicitly for this round:
- EventEntryVector::const_iterator const iEnd( maNextEvents.end() );
- for ( EventEntryVector::const_iterator iPos( maNextEvents.begin() );
- iPos != iEnd; ++iPos ) {
- maEvents.push(*iPos);
+ for ( const auto& rEvent : maNextEvents ) {
+ maEvents.push(rEvent);
}
EventEntryVector().swap( maNextEvents );
diff --git a/slideshow/source/engine/slide/shapemanagerimpl.cxx b/slideshow/source/engine/slide/shapemanagerimpl.cxx
index 3b8f730eb2c0..e6a3bea58c1e 100644
--- a/slideshow/source/engine/slide/shapemanagerimpl.cxx
+++ b/slideshow/source/engine/slide/shapemanagerimpl.cxx
@@ -128,35 +128,30 @@ bool ShapeManagerImpl::handleMouseReleased( awt::MouseEvent const& e )
// find matching shape (scan reversely, to coarsely match
// paint order)
- ShapeToListenersMap::reverse_iterator aCurrBroadcaster(
- maShapeListenerMap.rbegin() );
- ShapeToListenersMap::reverse_iterator const aEndBroadcasters(
- maShapeListenerMap.rend() );
- while( aCurrBroadcaster != aEndBroadcasters )
+ auto aCurrBroadcaster = std::find_if(maShapeListenerMap.rbegin(), maShapeListenerMap.rend(),
+ [&aPosition](const ShapeToListenersMap::value_type& rBroadcaster) {
+ // TODO(F2): Get proper geometry polygon from the
+ // shape, to avoid having areas outside the shape
+ // react on the mouse
+ return rBroadcaster.first->getBounds().isInside( aPosition )
+ && rBroadcaster.first->isVisible();
+ });
+ if (aCurrBroadcaster != maShapeListenerMap.rend())
{
- // TODO(F2): Get proper geometry polygon from the
- // shape, to avoid having areas outside the shape
- // react on the mouse
- if( aCurrBroadcaster->first->getBounds().isInside( aPosition ) &&
- aCurrBroadcaster->first->isVisible() )
- {
- // shape hit, and shape is visible. Raise
- // event.
+ // shape hit, and shape is visible. Raise
+ // event.
- std::shared_ptr<comphelper::OInterfaceContainerHelper2> const pCont(
- aCurrBroadcaster->second );
- uno::Reference<drawing::XShape> const xShape(
- aCurrBroadcaster->first->getXShape() );
+ std::shared_ptr<comphelper::OInterfaceContainerHelper2> const pCont(
+ aCurrBroadcaster->second );
+ uno::Reference<drawing::XShape> const xShape(
+ aCurrBroadcaster->first->getXShape() );
- // DON'T do anything with /this/ after this point!
- pCont->forEach<presentation::XShapeEventListener>(
- [&xShape, &e]( const uno::Reference< presentation::XShapeEventListener >& rListener )
- { return rListener->click( xShape, e ); } );
+ // DON'T do anything with /this/ after this point!
+ pCont->forEach<presentation::XShapeEventListener>(
+ [&xShape, &e]( const uno::Reference< presentation::XShapeEventListener >& rListener )
+ { return rListener->click( xShape, e ); } );
- return true; // handled this event
- }
-
- ++aCurrBroadcaster;
+ return true; // handled this event
}
return false; // did not handle this event
@@ -185,25 +180,19 @@ bool ShapeManagerImpl::handleMouseMoved( const awt::MouseEvent& e )
{
// find matching shape (scan reversely, to coarsely match
// paint order)
- ShapeToCursorMap::reverse_iterator aCurrCursor(
- maShapeCursorMap.rbegin() );
- ShapeToCursorMap::reverse_iterator const aEndCursors(
- maShapeCursorMap.rend() );
- while( aCurrCursor != aEndCursors )
+ auto aCurrCursor = std::find_if(maShapeCursorMap.rbegin(), maShapeCursorMap.rend(),
+ [&aPosition](const ShapeToCursorMap::value_type& rCursor) {
+ // TODO(F2): Get proper geometry polygon from the
+ // shape, to avoid having areas outside the shape
+ // react on the mouse
+ return rCursor.first->getBounds().isInside( aPosition )
+ && rCursor.first->isVisible();
+ });
+ if (aCurrCursor != maShapeCursorMap.rend())
{
- // TODO(F2): Get proper geometry polygon from the
- // shape, to avoid having areas outside the shape
- // react on the mouse
- if( aCurrCursor->first->getBounds().isInside( aPosition ) &&
- aCurrCursor->first->isVisible() )
- {
- // shape found, and it's visible. set
- // requested cursor to shape's
- nNewCursor = aCurrCursor->second;
- break;
- }
-
- ++aCurrCursor;
+ // shape found, and it's visible. set
+ // requested cursor to shape's
+ nNewCursor = aCurrCursor->second;
}
}
diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx
index f762768b4dad..931eea2211b7 100644
--- a/slideshow/source/engine/slide/slideimpl.cxx
+++ b/slideshow/source/engine/slide/slideimpl.cxx
@@ -816,13 +816,8 @@ void SlideImpl::drawPolygons() const
void SlideImpl::addPolygons(const PolyPolygonVector& rPolygons)
{
- for( PolyPolygonVector::const_iterator aIter = rPolygons.begin(),
- aEnd = rPolygons.end();
- aIter!=aEnd;
- ++aIter )
- {
- maPolygons.push_back(*aIter);
- }
+ for (const auto& rxPolygon : rPolygons)
+ maPolygons.push_back(rxPolygon);
}
bool SlideImpl::isPaintOverlayActive() const
diff --git a/slideshow/source/engine/slide/userpaintoverlay.cxx b/slideshow/source/engine/slide/userpaintoverlay.cxx
index 2f866e32ece1..9dc527a10727 100644
--- a/slideshow/source/engine/slide/userpaintoverlay.cxx
+++ b/slideshow/source/engine/slide/userpaintoverlay.cxx
@@ -129,18 +129,16 @@ namespace slideshow
void repaintWithoutPolygons()
{
// must get access to the instance to erase all polygon
- for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end();
- aIter!=aEnd;
- ++aIter )
+ for( const auto& rxView : maViews )
{
// fully clear view content to background color
- //(*aIter)->getCanvas()->clear();
+ //rxView->getCanvas()->clear();
//get via SlideImpl instance the bitmap of the slide unmodified to redraw it
- SlideBitmapSharedPtr pBitmap( mrSlide.getCurrentSlideBitmap( *aIter ) );
- ::cppcanvas::CanvasSharedPtr pCanvas( (*aIter)->getCanvas() );
+ SlideBitmapSharedPtr pBitmap( mrSlide.getCurrentSlideBitmap( rxView ) );
+ ::cppcanvas::CanvasSharedPtr pCanvas( rxView->getCanvas() );
- const ::basegfx::B2DHomMatrix aViewTransform( (*aIter)->getTransformation() );
+ const ::basegfx::B2DHomMatrix aViewTransform( rxView->getTransformation() );
const ::basegfx::B2DPoint aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() );
// setup a canvas with device coordinate space, the slide
@@ -157,7 +155,7 @@ namespace slideshow
pBitmap->clip( ::basegfx::B2DPolyPolygon() );
pBitmap->draw( pDevicePixelCanvas );
- mrScreenUpdater.notifyUpdate(*aIter,true);
+ mrScreenUpdater.notifyUpdate(rxView,true);
}
}
@@ -213,11 +211,9 @@ namespace slideshow
//Draw all registered polygons.
void drawPolygons()
{
- for( PolyPolygonVector::iterator aIter=maPolygons.begin(), aEnd=maPolygons.end();
- aIter!=aEnd;
- ++aIter )
+ for( auto& rxPolygon : maPolygons )
{
- (*aIter)->draw();
+ rxPolygon->draw();
}
// screen update necessary to show painting
mrScreenUpdater.notifyUpdate();
@@ -333,16 +329,14 @@ namespace slideshow
//The point is to redraw the LastPoint the way it was originally on the bitmap,
//of the slide
- for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end();
- aIter!=aEnd;
- ++aIter )
+ for (const auto& rxView : maViews)
{
//get via SlideImpl instance the bitmap of the slide unmodified to redraw it
- SlideBitmapSharedPtr pBitmap( mrSlide.getCurrentSlideBitmap( *aIter ) );
- ::cppcanvas::CanvasSharedPtr pCanvas( (*aIter)->getCanvas() );
+ SlideBitmapSharedPtr pBitmap( mrSlide.getCurrentSlideBitmap( rxView ) );
+ ::cppcanvas::CanvasSharedPtr pCanvas( rxView->getCanvas() );
- ::basegfx::B2DHomMatrix aViewTransform( (*aIter)->getTransformation() );
+ ::basegfx::B2DHomMatrix aViewTransform( rxView->getTransformation() );
const ::basegfx::B2DPoint aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() );
// setup a canvas with device coordinate space, the slide
@@ -361,7 +355,7 @@ namespace slideshow
pBitmap->clip(aPolyPoly);
pBitmap->draw( pDevicePixelCanvas );
- mrScreenUpdater.notifyUpdate(*aIter,true);
+ mrScreenUpdater.notifyUpdate(rxView,true);
}
}
@@ -384,12 +378,10 @@ namespace slideshow
aPoly.append( maLastPoint );
// paint to all views
- for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end();
- aIter!=aEnd;
- ++aIter )
+ for (const auto& rxView : maViews)
{
::cppcanvas::PolyPolygonSharedPtr pPolyPoly(
- ::cppcanvas::BaseGfxFactory::createPolyPolygon( (*aIter)->getCanvas(),
+ ::cppcanvas::BaseGfxFactory::createPolyPolygon( rxView->getCanvas(),
aPoly ) );
if( pPolyPoly )
diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx
index 9b7eadb65cd6..b2437e4b147d 100644
--- a/slideshow/source/engine/slideshowimpl.cxx
+++ b/slideshow/source/engine/slideshowimpl.cxx
@@ -870,14 +870,7 @@ ActivitySharedPtr SlideShowImpl::createSlideTransition(
PolygonMap::iterator SlideShowImpl::findPolygons( uno::Reference<drawing::XDrawPage> const& xDrawPage)
{
// TODO(P2): optimize research in the map.
- PolygonMap::iterator aEnd = maPolygons.end();
- for( PolygonMap::iterator aIter = maPolygons.begin();
- aIter != aEnd;
- ++aIter )
- if( aIter->first == xDrawPage )
- return aIter;
-
- return aEnd;
+ return maPolygons.find(xDrawPage);
}
SlideSharedPtr SlideShowImpl::makeSlide(
@@ -1769,19 +1762,14 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty )
&& (aValues[1] >>= bValue))
{
// Look up the view.
- for (UnoViewVector::const_iterator
- iView (maViewContainer.begin()),
- iEnd (maViewContainer.end());
- iView!=iEnd;
- ++iView)
+ auto iView = std::find_if(maViewContainer.begin(), maViewContainer.end(),
+ [&xView](const UnoViewSharedPtr& rxView) { return rxView && rxView->getUnoView() == xView; });
+ if (iView != maViewContainer.end())
{
- if (*iView && (*iView)->getUnoView()==xView)
- {
- // Store the flag at the view so that media shapes have
- // access to it.
- (*iView)->setIsSoundEnabled(bValue);
- return true;
- }
+ // Store the flag at the view so that media shapes have
+ // access to it.
+ (*iView)->setIsSoundEnabled(bValue);
+ return true;
}
}
}
diff --git a/slideshow/source/engine/transitions/slidetransitionfactory.cxx b/slideshow/source/engine/transitions/slidetransitionfactory.cxx
index 75abacdbbfbf..db39e543b4a1 100644
--- a/slideshow/source/engine/transitions/slidetransitionfactory.cxx
+++ b/slideshow/source/engine/transitions/slidetransitionfactory.cxx
@@ -205,14 +205,12 @@ public:
SAL_INFO("slideshow", "PluginSlideChange viewRemoved");
SlideChangeBase::viewRemoved( rView );
- for( auto aIter = maTransitions.begin(); aIter != maTransitions.end(); ++aIter )
+ auto aIter = std::find_if(maTransitions.begin(), maTransitions.end(),
+ [&rView](const std::unique_ptr<TransitionViewPair>& rxTransition) { return rxTransition->mpView == rView; });
+ if (aIter != maTransitions.end())
{
- if( ( *aIter )->mpView == rView )
- {
- SAL_INFO("slideshow", "view removed" );
- maTransitions.erase( aIter );
- break;
- }
+ SAL_INFO("slideshow", "view removed" );
+ maTransitions.erase( aIter );
}
}
diff --git a/slideshow/source/engine/usereventqueue.cxx b/slideshow/source/engine/usereventqueue.cxx
index 6ae688351a48..9c976717b510 100644
--- a/slideshow/source/engine/usereventqueue.cxx
+++ b/slideshow/source/engine/usereventqueue.cxx
@@ -314,23 +314,20 @@ protected:
// find matching shape (scan reversely, to coarsely match
// paint order)
- ImpShapeEventMap::reverse_iterator aCurrShape(maShapeEventMap.rbegin());
- const ImpShapeEventMap::reverse_iterator aEndShape( maShapeEventMap.rend() );
- while( aCurrShape != aEndShape )
+ auto aCurrShape = std::find_if(maShapeEventMap.rbegin(), maShapeEventMap.rend(),
+ [&aPosition](const ImpShapeEventMap::value_type& rShape) {
+ // TODO(F2): Get proper geometry polygon from the
+ // shape, to avoid having areas outside the shape
+ // react on the mouse
+ return rShape.first->getBounds().isInside( aPosition )
+ && rShape.first->isVisible();
+ });
+ if (aCurrShape != maShapeEventMap.rend())
{
- // TODO(F2): Get proper geometry polygon from the
- // shape, to avoid having areas outside the shape
- // react on the mouse
- if( aCurrShape->first->getBounds().isInside( aPosition ) &&
- aCurrShape->first->isVisible() )
- {
- // shape hit, and shape is visible - report a
- // hit
- o_rHitShape = aCurrShape;
- return true;
- }
-
- ++aCurrShape;
+ // shape hit, and shape is visible - report a
+ // hit
+ o_rHitShape = aCurrShape;
+ return true;
}
return false; // nothing hit
diff --git a/slideshow/source/inc/basecontainernode.hxx b/slideshow/source/inc/basecontainernode.hxx
index 6338fb026c7c..94547302d7e6 100644
--- a/slideshow/source/inc/basecontainernode.hxx
+++ b/slideshow/source/inc/basecontainernode.hxx
@@ -72,10 +72,7 @@ protected:
void forEachChildNode( FuncT func,
int nodeStateMask ) const
{
- VectorOfNodes::const_iterator iPos( maChildren.begin() );
- VectorOfNodes::const_iterator const iEnd( maChildren.end() );
- for ( ; iPos != iEnd; ++iPos ) {
- AnimationNodeSharedPtr const& pNode = *iPos;
+ for (AnimationNodeSharedPtr const& pNode : maChildren) {
if (nodeStateMask != -1 && (pNode->getState() & nodeStateMask) == 0)
continue;
func(pNode);
diff --git a/sot/qa/cppunit/test_sot.cxx b/sot/qa/cppunit/test_sot.cxx
index 57c636de0df5..06e26c806eb1 100644
--- a/sot/qa/cppunit/test_sot.cxx
+++ b/sot/qa/cppunit/test_sot.cxx
@@ -107,16 +107,15 @@ namespace
SvStorageInfoList aInfoList;
xObjStor->FillInfoList( &aInfoList );
- for( SvStorageInfoList::iterator aIt = aInfoList.begin();
- aIt != aInfoList.end(); ++aIt )
+ for (auto& rInfo : aInfoList)
{
- if( aIt->IsStorage() )
+ if( rInfo.IsStorage() )
{
- tools::SvRef<SotStorage> xChild( xObjStor->OpenSotStorage( aIt->GetName() ) );
+ tools::SvRef<SotStorage> xChild( xObjStor->OpenSotStorage( rInfo.GetName() ) );
checkStorage( xChild );
}
- else if( aIt->IsStream() )
- checkStream( xObjStor, aIt->GetName(), aIt->GetSize() );
+ else if( rInfo.IsStream() )
+ checkStream( xObjStor, rInfo.GetName(), rInfo.GetSize() );
}
return true;
diff --git a/sot/source/base/formats.cxx b/sot/source/base/formats.cxx
index 9b7770f146ef..cc8ea22feaaa 100644
--- a/sot/source/base/formats.cxx
+++ b/sot/source/base/formats.cxx
@@ -1318,20 +1318,8 @@ const SotAction_Impl* GetExchangeDestinationWriterFreeAreaCopy()
bool IsFormatSupported( const DataFlavorExVector& rDataFlavorExVector, SotClipboardFormatId nId )
{
- auto aIter( rDataFlavorExVector.begin() );
- auto aEnd( rDataFlavorExVector.end() );
- bool bRet = false;
-
- while( aIter != aEnd )
- {
- if( nId == (*aIter++).mnSotId )
- {
- bRet = true;
- aIter = aEnd;
- }
- }
-
- return bRet;
+ return std::any_of(rDataFlavorExVector.begin(), rDataFlavorExVector.end(),
+ [nId](const DataFlavorEx& rDataFlavorEx) { return nId == rDataFlavorEx.mnSotId; });
}
diff --git a/sot/source/sdstor/stgcache.cxx b/sot/source/sdstor/stgcache.cxx
index 532b74e3d501..5c03f89cc4fd 100644
--- a/sot/source/sdstor/stgcache.cxx
+++ b/sot/source/sdstor/stgcache.cxx
@@ -131,12 +131,10 @@ void StgCache::Erase( const rtl::Reference< StgPage > &xElem )
{
OSL_ENSURE( xElem.is(), "The pointer should not be NULL!" );
if ( xElem.is() ) {
- for ( LRUList::iterator it = maLRUPages.begin(); it != maLRUPages.end(); ++it ) {
- if ( it->is() && (*it)->GetPage() == xElem->GetPage() ) {
- it->clear();
- break;
- }
- }
+ auto it = std::find_if(maLRUPages.begin(), maLRUPages.end(),
+ [xElem](const rtl::Reference<StgPage>& rxPage) { return rxPage.is() && rxPage->GetPage() == xElem->GetPage(); });
+ if (it != maLRUPages.end())
+ it->clear();
}
}
@@ -145,17 +143,18 @@ void StgCache::Erase( const rtl::Reference< StgPage > &xElem )
void StgCache::Clear()
{
maDirtyPages.clear();
- for ( LRUList::iterator it = maLRUPages.begin(); it != maLRUPages.end(); ++it )
- it->clear();
+ for (auto& rxPage : maLRUPages)
+ rxPage.clear();
}
// Look for a cached page
rtl::Reference< StgPage > StgCache::Find( sal_Int32 nPage )
{
- for ( LRUList::iterator it = maLRUPages.begin(); it != maLRUPages.end(); ++it )
- if ( it->is() && (*it)->GetPage() == nPage )
- return *it;
+ auto it = std::find_if(maLRUPages.begin(), maLRUPages.end(),
+ [nPage](const rtl::Reference<StgPage>& rxPage) { return rxPage.is() && rxPage->GetPage() == nPage; });
+ if (it != maLRUPages.end())
+ return *it;
IndexToStgPage::iterator it2 = maDirtyPages.find( nPage );
if ( it2 != maDirtyPages.end() )
return it2->second;
@@ -211,15 +210,13 @@ bool StgCache::Commit()
if ( Good() ) // otherwise Write does nothing
{
std::vector< StgPage * > aToWrite;
- for ( IndexToStgPage::iterator aIt = maDirtyPages.begin();
- aIt != maDirtyPages.end(); ++aIt )
- aToWrite.push_back( aIt->second.get() );
+ for (const auto& rEntry : maDirtyPages)
+ aToWrite.push_back( rEntry.second.get() );
std::sort( aToWrite.begin(), aToWrite.end(), StgPage::IsPageGreater );
- for ( std::vector< StgPage * >::iterator aWr = aToWrite.begin();
- aWr != aToWrite.end(); ++aWr)
+ for (StgPage* pWr : aToWrite)
{
- const rtl::Reference< StgPage > &pPage = *aWr;
+ const rtl::Reference< StgPage > &pPage = pWr;
if ( !Write( pPage->GetPage(), pPage->GetData() ) )
return false;
}
diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx
index 5e4993298a1e..345c70efcc16 100644
--- a/starmath/source/accessibility.cxx
+++ b/starmath/source/accessibility.cxx
@@ -1040,39 +1040,39 @@ static SfxItemState GetSvxEditEngineItemState( EditEngine const & rEditEngine, c
const SfxPoolItem* pParaItem = nullptr;
- for(std::vector<EECharAttrib>::const_iterator i = aAttribs.begin(); i < aAttribs.end(); ++i)
+ for(const auto& rAttrib : aAttribs)
{
- OSL_ENSURE( i->pAttr, "GetCharAttribs gives corrupt data" );
+ OSL_ENSURE( rAttrib.pAttr, "GetCharAttribs gives corrupt data" );
- const bool bEmptyPortion = (i->nStart == i->nEnd);
- if( (!bEmptyPortion && (i->nStart >= nEndPos)) || (bEmptyPortion && (i->nStart > nEndPos)) )
+ const bool bEmptyPortion = (rAttrib.nStart == rAttrib.nEnd);
+ if( (!bEmptyPortion && (rAttrib.nStart >= nEndPos)) || (bEmptyPortion && (rAttrib.nStart > nEndPos)) )
break; // break if we are already behind our selection
- if( (!bEmptyPortion && (i->nEnd <= nPos)) || (bEmptyPortion && (i->nEnd < nPos)) )
+ if( (!bEmptyPortion && (rAttrib.nEnd <= nPos)) || (bEmptyPortion && (rAttrib.nEnd < nPos)) )
continue; // or if the attribute ends before our selection
- if( i->pAttr->Which() != nWhich )
+ if( rAttrib.pAttr->Which() != nWhich )
continue; // skip if is not the searched item
// if we already found an item
if( pParaItem )
{
// ... and its different to this one than the state is don't care
- if( *pParaItem != *(i->pAttr) )
+ if( *pParaItem != *(rAttrib.pAttr) )
return SfxItemState::DONTCARE;
}
else
{
- pParaItem = i->pAttr;
+ pParaItem = rAttrib.pAttr;
}
if( bEmpty )
bEmpty = false;
- if( !bGaps && i->nStart > nLastEnd )
+ if( !bGaps && rAttrib.nStart > nLastEnd )
bGaps = true;
- nLastEnd = i->nEnd;
+ nLastEnd = rAttrib.nEnd;
}
if( !bEmpty && !bGaps && nLastEnd < ( nEndPos - 1 ) )
diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx
index e5c86e05ca53..025deb9c0049 100644
--- a/starmath/source/cfgitem.cxx
+++ b/starmath/source/cfgitem.cxx
@@ -484,11 +484,9 @@ void SmMathConfig::GetSymbols( std::vector< SmSym > &rSymbols ) const
sal_Int32 nNodes = aNodes.getLength();
rSymbols.resize( nNodes );
- std::vector< SmSym >::iterator aIt( rSymbols.begin() );
- std::vector< SmSym >::iterator aEnd( rSymbols.end() );
- while (aIt != aEnd)
+ for (auto& rSymbol : rSymbols)
{
- ReadSymbol( *aIt++, *pNode++, SYMBOL_LIST );
+ ReadSymbol( rSymbol, *pNode++, SYMBOL_LIST );
}
}
@@ -506,11 +504,8 @@ void SmMathConfig::SetSymbols( const std::vector< SmSym > &rNewSymbols )
PropertyValue *pVal = pValues;
OUString aDelim( "/" );
- std::vector< SmSym >::const_iterator aIt( rNewSymbols.begin() );
- std::vector< SmSym >::const_iterator aEnd( rNewSymbols.end() );
- while (aIt != aEnd)
+ for (const SmSym& rSymbol : rNewSymbols)
{
- const SmSym &rSymbol = *aIt++;
OUString aNodeNameDelim( SYMBOL_LIST );
aNodeNameDelim += aDelim;
aNodeNameDelim += rSymbol.GetExportName();
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index a1ada63bede4..a883b679ce2a 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -340,34 +340,31 @@ SmNodeList::iterator SmCursor::FindPositionInLineList(SmNodeList* pLineList,
const SmCaretPos& rCaretPos)
{
//Find iterator for position
- SmNodeList::iterator it;
- for(it = pLineList->begin(); it != pLineList->end(); ++it){
- if(*it == rCaretPos.pSelectedNode)
+ SmNodeList::iterator it = std::find(pLineList->begin(), pLineList->end(), rCaretPos.pSelectedNode);
+ if (it != pLineList->end())
+ {
+ if((*it)->GetType() == SmNodeType::Text)
{
- if((*it)->GetType() == SmNodeType::Text)
+ //Split textnode if needed
+ if(rCaretPos.nIndex > 0)
{
- //Split textnode if needed
- if(rCaretPos.nIndex > 0)
- {
- SmTextNode* pText = static_cast<SmTextNode*>(rCaretPos.pSelectedNode);
- if (rCaretPos.nIndex == pText->GetText().getLength())
- return ++it;
- OUString str1 = pText->GetText().copy(0, rCaretPos.nIndex);
- OUString str2 = pText->GetText().copy(rCaretPos.nIndex);
- pText->ChangeText(str1);
- ++it;
- //Insert str2 as new text node
- assert(!str2.isEmpty());
- SmTextNode* pNewText = new SmTextNode(pText->GetToken(), pText->GetFontDesc());
- pNewText->ChangeText(str2);
- it = pLineList->insert(it, pNewText);
- }
- }else
+ SmTextNode* pText = static_cast<SmTextNode*>(rCaretPos.pSelectedNode);
+ if (rCaretPos.nIndex == pText->GetText().getLength())
+ return ++it;
+ OUString str1 = pText->GetText().copy(0, rCaretPos.nIndex);
+ OUString str2 = pText->GetText().copy(rCaretPos.nIndex);
+ pText->ChangeText(str1);
++it;
- //it now pointer to the node following pos, so pLineList->insert(it, ...) will insert correctly
- return it;
-
- }
+ //Insert str2 as new text node
+ assert(!str2.isEmpty());
+ SmTextNode* pNewText = new SmTextNode(pText->GetToken(), pText->GetFontDesc());
+ pNewText->ChangeText(str2);
+ it = pLineList->insert(it, pNewText);
+ }
+ }else
+ ++it;
+ //it now pointer to the node following pos, so pLineList->insert(it, ...) will insert correctly
+ return it;
}
//If we didn't find pSelectedNode, it must be because the caret is in front of the line
return pLineList->begin();
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 61f3edeaf885..550401d8f157 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -1186,9 +1186,8 @@ void SmSymbolDialog::FillSymbolSets()
m_xSymbolSets->set_active(-1);
std::set< OUString > aSybolSetNames( rSymbolMgr.GetSymbolSetNames() );
- std::set< OUString >::const_iterator aIt( aSybolSetNames.begin() );
- for ( ; aIt != aSybolSetNames.end(); ++aIt)
- m_xSymbolSets->append_text(*aIt);
+ for (const auto& rSymbolSetName : aSybolSetNames)
+ m_xSymbolSets->append_text(rSymbolSetName);
}
IMPL_LINK_NOARG( SmSymbolDialog, SymbolSetChangeHdl, weld::ComboBox&, void )
@@ -1440,9 +1439,8 @@ void SmSymDefineDialog::FillSymbolSets(weld::ComboBox& rComboBox, bool bDeleteTe
rComboBox.set_entry_text(OUString());
const std::set< OUString > aSymbolSetNames( m_aSymbolMgrCopy.GetSymbolSetNames() );
- std::set< OUString >::const_iterator aIt( aSymbolSetNames.begin() );
- for ( ; aIt != aSymbolSetNames.end(); ++aIt)
- rComboBox.append_text(*aIt);
+ for (const auto& rSymbolSetName : aSymbolSetNames)
+ rComboBox.append_text(rSymbolSetName);
}
void SmSymDefineDialog::FillFonts()
diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx
index cb0533c1b269..86af8f6c528e 100644
--- a/starmath/source/symbol.cxx
+++ b/starmath/source/symbol.cxx
@@ -124,9 +124,8 @@ SmSym *SmSymbolManager::GetSymbolByName(const OUString& rSymbolName)
const SymbolPtrVec_t SmSymbolManager::GetSymbols() const
{
SymbolPtrVec_t aRes;
- SymbolMap_t::const_iterator aIt( m_aSymbols.begin() );
- for ( ; aIt != m_aSymbols.end(); ++aIt)
- aRes.push_back( &aIt->second );
+ for (const auto& rEntry : m_aSymbols)
+ aRes.push_back( &rEntry.second );
// OSL_ENSURE( sSymbols.size() == m_aSymbols.size(), "number of symbols mismatch " );
return aRes;
}
@@ -182,9 +181,8 @@ void SmSymbolManager::RemoveSymbol( const OUString & rSymbolName )
std::set< OUString > SmSymbolManager::GetSymbolSetNames() const
{
std::set< OUString > aRes;
- SymbolMap_t::const_iterator aIt( m_aSymbols.begin() );
- for ( ; aIt != m_aSymbols.end(); ++aIt )
- aRes.insert( aIt->second.GetSymbolSetName() );
+ for (const auto& rEntry : m_aSymbols)
+ aRes.insert( rEntry.second.GetSymbolSetName() );
return aRes;
}
@@ -194,11 +192,10 @@ const SymbolPtrVec_t SmSymbolManager::GetSymbolSet( const OUString& rSymbolSetNa
SymbolPtrVec_t aRes;
if (!rSymbolSetName.isEmpty())
{
- SymbolMap_t::const_iterator aIt( m_aSymbols.begin() );
- for ( ; aIt != m_aSymbols.end(); ++aIt )
+ for (const auto& rEntry : m_aSymbols)
{
- if (aIt->second.GetSymbolSetName() == rSymbolSetName)
- aRes.push_back( &aIt->second );
+ if (rEntry.second.GetSymbolSetName() == rSymbolSetName)
+ aRes.push_back( &rEntry.second );
}
}
return aRes;
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index b7ff3bd2206f..b19c1aab166d 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -843,21 +843,21 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu
Sequence < SymbolDescriptor > aSequence ( aVector.size() );
SymbolDescriptor * pDescriptor = aSequence.getArray();
- vector < const SmSym * >::const_iterator aIter = aVector.begin(), aEnd = aVector.end();
- for(; aIter != aEnd; pDescriptor++, ++aIter)
+ for (const SmSym* pSymbol : aVector)
{
- pDescriptor->sName = (*aIter)->GetName();
- pDescriptor->sExportName = (*aIter)->GetExportName();
- pDescriptor->sSymbolSet = (*aIter)->GetSymbolSetName();
- pDescriptor->nCharacter = static_cast < sal_Int32 > ((*aIter)->GetCharacter());
+ pDescriptor->sName = pSymbol->GetName();
+ pDescriptor->sExportName = pSymbol->GetExportName();
+ pDescriptor->sSymbolSet = pSymbol->GetSymbolSetName();
+ pDescriptor->nCharacter = static_cast < sal_Int32 > (pSymbol->GetCharacter());
- vcl::Font rFont = (*aIter)->GetFace();
+ vcl::Font rFont = pSymbol->GetFace();
pDescriptor->sFontName = rFont.GetFamilyName();
pDescriptor->nCharSet = sal::static_int_cast< sal_Int16 >(rFont.GetCharSet());
pDescriptor->nFamily = sal::static_int_cast< sal_Int16 >(rFont.GetFamilyType());
pDescriptor->nPitch = sal::static_int_cast< sal_Int16 >(rFont.GetPitch());
pDescriptor->nWeight = sal::static_int_cast< sal_Int16 >(rFont.GetWeight());
pDescriptor->nItalic = sal::static_int_cast< sal_Int16 >(rFont.GetItalic());
+ pDescriptor++;
}
*pValue <<= aSequence;
}
diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx
index 02706a6258de..53e045c6dc2b 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -1505,12 +1505,10 @@ public:
typename Map::size_type const MAX = 100;
assert(map_.size() <= MAX);
if (map_.size() == MAX) {
- typename Map::iterator del(map_.begin());
- for (typename Map::iterator i(map_.begin()); i != map_.end(); ++i) {
- if (i->second.hits < del->second.hits) {
- del = i;
- }
- }
+ typename Map::iterator del = std::min_element(map_.begin(), map_.end(),
+ [](const typename Map::value_type& a, const typename Map::value_type& b) {
+ return a.second.hits < b.second.hits;
+ });
map_.erase(del);
}
bool ins = map_.emplace(key, Data(access)).second;
diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx
index 52d2eb3ff2d5..cca99f1ebf20 100644
--- a/stoc/source/invocation_adapterfactory/iafactory.cxx
+++ b/stoc/source/invocation_adapterfactory/iafactory.cxx
@@ -766,11 +766,9 @@ static AdapterImpl * lookup_adapter(
// find matching adapter
Type const * pTypes = rTypes.getConstArray();
sal_Int32 nTypes = rTypes.getLength();
- t_ptr_set::const_iterator iPos( adapters_set.begin() );
- t_ptr_set::const_iterator const iEnd( adapters_set.end() );
- while (iEnd != iPos)
+ for (const auto& rpAdapter : adapters_set)
{
- AdapterImpl * that = static_cast< AdapterImpl * >( *iPos );
+ AdapterImpl * that = static_cast< AdapterImpl * >( rpAdapter );
// iterate through all types if that is a matching adapter
sal_Int32 nPosTypes;
for ( nPosTypes = nTypes; nPosTypes--; )
@@ -793,7 +791,6 @@ static AdapterImpl * lookup_adapter(
}
if (nPosTypes < 0) // all types found
return that;
- ++iPos;
}
return nullptr;
}
diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx
index 43aadfff0fbf..39ea85c5a833 100644
--- a/stoc/source/servicemanager/servicemanager.cxx
+++ b/stoc/source/servicemanager/servicemanager.cxx
@@ -640,12 +640,11 @@ void OServiceManager::disposing()
m_bInDisposing = true;
aImpls = m_ImplementationMap;
}
- HashSet_Ref::iterator aIt = aImpls.begin();
- while( aIt != aImpls.end() )
+ for( const auto& rxImpl : aImpls )
{
try
{
- Reference<XComponent > xComp( Reference<XComponent >::query( *aIt++ ) );
+ Reference<XComponent > xComp( Reference<XComponent >::query( rxImpl ) );
if( xComp.is() )
xComp->dispose();
}
@@ -779,9 +778,8 @@ Sequence< OUString > OServiceManager::getUniqueAvailableServiceNames(
{
check_undisposed();
MutexGuard aGuard( m_mutex );
- HashMultimap_OWString_Interface::iterator aSIt = m_ServiceMap.begin();
- while( aSIt != m_ServiceMap.end() )
- aNameSet.insert( (*aSIt++).first );
+ for( const auto& rEntry : m_ServiceMap )
+ aNameSet.insert( rEntry.first );
/* do not return the implementation names
HashMap_OWString_Interface m_ImplementationNameMap;
diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx
index 0c20d6b5d0bc..ff5e1444cdb6 100644
--- a/stoc/source/simpleregistry/simpleregistry.cxx
+++ b/stoc/source/simpleregistry/simpleregistry.cxx
@@ -489,10 +489,9 @@ void Key::setAsciiListValue(
list.push_back(utf8);
}
std::vector< char * > list2;
- for (std::vector< OString >::iterator i(list.begin()); i != list.end();
- ++i)
+ for (const auto& rItem : list)
{
- list2.push_back(const_cast< char * >(i->getStr()));
+ list2.push_back(const_cast< char * >(rItem.getStr()));
}
RegError err = key_.setStringListValue(
OUString(), list2.data(), static_cast< sal_uInt32 >(list2.size()));