Kaydet (Commit) 0ded54c3 authored tarafından Arkadiy Illarionov's avatar Arkadiy Illarionov Kaydeden (comit) Noel Grandin

Simplify containers iterations in slideshow, sot, starmath, stoc

Use range-based loop or replace with STL functions

Change-Id: I94792c28b283a0998bf813317e5beb37d93e0c23
Reviewed-on: https://gerrit.libreoffice.org/64125
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 7d311ea8
......@@ -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 );
......
......@@ -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 );
......
......@@ -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;
}
}
......
......@@ -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
......
......@@ -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 )
......
......@@ -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;
}
}
}
......
......@@ -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 );
}
}
......
......@@ -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
......
......@@ -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);
......
......@@ -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;
......
......@@ -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; });
}
......
......@@ -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;
}
......
......@@ -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 ) )
......
......@@ -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();
......
......@@ -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();
......
......@@ -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()
......
......@@ -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;
......
......@@ -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();