[Libreoffice-commits] core.git: svx/source

Julien Nabet serval2412 at yahoo.fr
Mon Apr 18 05:09:08 UTC 2016


 svx/source/gallery2/galbrws2.cxx                  |    3 ++-
 svx/source/gallery2/gallery1.cxx                  |    6 ++++--
 svx/source/gallery2/galtheme.cxx                  |    2 +-
 svx/source/items/numfmtsh.cxx                     |   13 +++----------
 svx/source/sdr/animation/scheduler.cxx            |    3 ++-
 svx/source/sdr/overlay/overlaymanager.cxx         |    6 ++++--
 svx/source/sdr/properties/attributeproperties.cxx |    4 ++--
 svx/source/sdr/properties/textproperties.cxx      |    4 ++--
 svx/source/stbctrls/zoomsliderctrl.cxx            |   16 ++++++++--------
 9 files changed, 28 insertions(+), 29 deletions(-)

New commits:
commit 101e5bbc8aaa77d5db36e0969a512b5a283f1672
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sun Apr 17 22:54:57 2016 +0200

    Use const_iterator when possible (svx/gallery2,items,sdr,stbctrls)
    
    Change-Id: Idd8992fcb76c25120202b24a23820d85ca09e434
    Reviewed-on: https://gerrit.libreoffice.org/24174
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index 0a4cc54..fecc083 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -299,8 +299,9 @@ void GalleryThemePopup::ExecutePopup( vcl::Window *pWindow, const ::Point &aPos
         GalleryBrowser2::GetFrame(), css::uno::UNO_QUERY );
     css::uno::Reference< css::util::XURLTransformer > xTransformer(
         mpBrowser->GetURLTransformer() );
+    CommandInfoMap::const_iterator aEnd = m_aCommandInfo.end();
     for ( CommandInfoMap::iterator it = m_aCommandInfo.begin();
-         it != m_aCommandInfo.end(); ++it )
+         it != aEnd; ++it )
     {
         try
         {
diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx
index 7ffa2d0..94e51e3 100644
--- a/svx/source/gallery2/gallery1.cxx
+++ b/svx/source/gallery2/gallery1.cxx
@@ -570,7 +570,8 @@ bool Gallery::RemoveTheme( const OUString& rThemeName )
             KillFile( aStrURL );
         }
 
-        for ( GalleryThemeList::iterator it = aThemeList.begin(); it != aThemeList.end(); ++it )
+        GalleryThemeList::const_iterator aEnd = aThemeList.end();
+        for ( GalleryThemeList::iterator it = aThemeList.begin(); it != aEnd; ++it )
         {
             if ( pThemeEntry == *it ) {
                 delete pThemeEntry;
@@ -641,7 +642,8 @@ GalleryTheme* Gallery::ImplGetCachedTheme(const GalleryThemeEntry* pThemeEntry)
 
 void Gallery::ImplDeleteCachedTheme( GalleryTheme* pTheme )
 {
-    for (GalleryCacheThemeList::iterator it = aThemeCache.begin(); it != aThemeCache.end(); ++it)
+    GalleryCacheThemeList::const_iterator aEnd = aThemeCache.end();
+    for (GalleryCacheThemeList::iterator it = aThemeCache.begin(); it != aEnd; ++it)
     {
         if (pTheme == (*it)->GetTheme())
         {
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index 2a2f621..a9e1aca 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -592,7 +592,7 @@ void GalleryTheme::Actualize( const Link<const INetURLObject&, void>& rActualize
 
         // remove all entries with set flag
         GalleryObjectList::const_iterator aEnd = aObjectList.end();
-        for ( GalleryObjectList::iterator it = aObjectList.begin(); it != aEnd ; /* increment is in the body ofloop */)
+        for ( GalleryObjectList::iterator it = aObjectList.begin(); it != aEnd ; /* increment is in the body of loop */)
         {
             if( (*it)->mbDelete )
             {
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index 7d78eca..637a7d1 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -786,9 +786,7 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( std::vector<OUString>& rL
 
     if(nCurCategory!=css::util::NumberFormat::ALL)
     {
-        SvNumberFormatTable::iterator it = pCurFmtTable->begin();
-
-        while ( it != pCurFmtTable->end() )
+        for( SvNumberFormatTable::const_iterator it = pCurFmtTable->begin(), aEnd = pCurFmtTable->end(); it != aEnd; ++it )
         {
             sal_uInt32 nKey = it->first;
             const SvNumberformat* pNumEntry   = it->second;
@@ -821,7 +819,6 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( std::vector<OUString>& rL
                     aCurEntryList.push_back( nKey );
                 }
             }
-            ++it;
         }
     }
     return nSelPos;
@@ -887,8 +884,7 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<OUString>& r
         rShortSymbol = pTmpCurrencyEntry->BuildSymbolString(bTmpBanking,true);
     }
 
-    SvNumberFormatTable::iterator it = pCurFmtTable->begin();
-    while ( it != pCurFmtTable->end() )
+    for ( SvNumberFormatTable::const_iterator it = pCurFmtTable->begin(), aEnd = pCurFmtTable->end(); it != aEnd; ++it )
     {
         sal_uInt32 nKey = it->first;
         const SvNumberformat* pNumEntry = it->second;
@@ -938,7 +934,6 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<OUString>& r
                 }
             }
         }
-        ++it;
     }
 
     NfWSStringsDtor aWSStringsDtor;
@@ -1040,8 +1035,7 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl( std::vector<OUString>& rList,
     bool            bAdditional = (nPrivCat != CAT_USERDEFINED &&
                                     nCurCategory != css::util::NumberFormat::ALL);
 
-    SvNumberFormatTable::iterator it = pCurFmtTable->begin();
-    while ( it != pCurFmtTable->end() )
+    for( SvNumberFormatTable::const_iterator it = pCurFmtTable->begin(), aEnd = pCurFmtTable->end(); it != aEnd; ++it )
     {
         sal_uInt32 nKey = it->first;
         const SvNumberformat* pNumEntry = it->second;
@@ -1071,7 +1065,6 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl( std::vector<OUString>& rList,
                 }
             }
         }
-        ++it;
     }
     return nSelPos;
 }
diff --git a/svx/source/sdr/animation/scheduler.cxx b/svx/source/sdr/animation/scheduler.cxx
index 6b0e4d1..84e1ce3 100644
--- a/svx/source/sdr/animation/scheduler.cxx
+++ b/svx/source/sdr/animation/scheduler.cxx
@@ -190,8 +190,9 @@ namespace sdr
                 }
 
                 // execute events from the vector
+                ::std::vector< Event* >::const_iterator aEnd = EventPointerVector.end();
                 for(::std::vector< Event* >::iterator aCandidate = EventPointerVector.begin();
-                    aCandidate != EventPointerVector.end(); ++aCandidate)
+                    aCandidate != aEnd; ++aCandidate)
                 {
                     // trigger event. This may re-insert the event to the scheduler again
                     (*aCandidate)->Trigger(mnTime);
diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx
index 479310f..747a727 100644
--- a/svx/source/sdr/overlay/overlaymanager.cxx
+++ b/svx/source/sdr/overlay/overlaymanager.cxx
@@ -94,7 +94,8 @@ namespace sdr
 
             if(nSize)
             {
-                for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); ++aIter)
+                OverlayObjectVector::const_iterator aEnd(maOverlayObjects.end());
+                for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != aEnd; ++aIter)
                 {
                     OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)");
                     OverlayObject& rCandidate = **aIter;
@@ -223,7 +224,8 @@ namespace sdr
 
             if(nSize)
             {
-                for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); ++aIter)
+                OverlayObjectVector::const_iterator aEnd = maOverlayObjects.end();
+                for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != aEnd; ++aIter)
                 {
                     OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)");
                     OverlayObject& rCandidate = **aIter;
diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx
index a9955c2..7018952 100644
--- a/svx/source/sdr/properties/attributeproperties.cxx
+++ b/svx/source/sdr/properties/attributeproperties.cxx
@@ -362,8 +362,8 @@ namespace sdr
                             SfxStyleSheetBase* pLastSheet = nullptr;
                             SfxStyleSheetBase* pForThisObject = nullptr;
 
-                            std::vector<SfxStyleSheetBase*>::iterator iter;
-                            for (iter = aStyleList.begin(); iter != aStyleList.end(); ++iter)
+                            for (std::vector<SfxStyleSheetBase*>::const_iterator iter = aStyleList.begin(), aEnd = aStyleList.end()
+                                ; iter != aEnd; ++iter)
                             {
                                 pNewSheet = &pNewPool->Make((*iter)->GetName(), (*iter)->GetFamily(), (*iter)->GetMask());
                                 pNewSheet->GetItemSet().Put((*iter)->GetItemSet(), false);
diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx
index 794c2ec6..180b907 100644
--- a/svx/source/sdr/properties/textproperties.cxx
+++ b/svx/source/sdr/properties/textproperties.cxx
@@ -461,7 +461,7 @@ namespace sdr
                                     std::vector<EECharAttrib> aAttribs;
                                     pEditEngine->GetCharAttribs(nPara, aAttribs);
 
-                                    for(std::vector<EECharAttrib>::iterator i = aAttribs.begin(); i < aAttribs.end(); ++i)
+                                    for(std::vector<EECharAttrib>::const_iterator i = aAttribs.begin(), aEnd = aAttribs.end(); i != aEnd; ++i)
                                     {
                                         if(EE_FEATURE_FIELD == i->pAttr->Which())
                                         {
@@ -490,7 +490,7 @@ namespace sdr
 
                                         ESelection aSel(nPara, 0);
 
-                                        for(std::vector<EECharAttrib>::iterator i = aAttribs.begin(); i < aAttribs.end(); ++i)
+                                        for(std::vector<EECharAttrib>::const_iterator i = aAttribs.begin(), aEnd = aAttribs.end(); i != aEnd; ++i)
                                         {
                                             if(EE_FEATURE_FIELD == i->pAttr->Which())
                                             {
diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx
index 3c56ee9..3f2fc41 100644
--- a/svx/source/stbctrls/zoomsliderctrl.cxx
+++ b/svx/source/stbctrls/zoomsliderctrl.cxx
@@ -79,9 +79,9 @@ sal_uInt16 SvxZoomSliderControl::Offset2Zoom( long nOffset ) const
 
     // check for snapping points:
     sal_uInt16 nCount = 0;
-    std::vector< long >::iterator aSnappingPointIter;
-    for ( aSnappingPointIter = mxImpl->maSnappingPointOffsets.begin();
-          aSnappingPointIter != mxImpl->maSnappingPointOffsets.end();
+    for ( std::vector< long >::const_iterator aSnappingPointIter = mxImpl->maSnappingPointOffsets.begin(),
+           aEnd = mxImpl->maSnappingPointOffsets.end();
+          aSnappingPointIter != aEnd;
           ++aSnappingPointIter )
     {
         const long nCurrent = *aSnappingPointIter;
@@ -223,10 +223,10 @@ void SvxZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eStat
         }
 
         // remove snapping points that are to close to each other:
-        std::set< sal_uInt16 >::iterator aSnappingPointIter;
         long nLastOffset = 0;
 
-        for ( aSnappingPointIter = aTmpSnappingPoints.begin(); aSnappingPointIter != aTmpSnappingPoints.end(); ++aSnappingPointIter )
+        for ( std::set< sal_uInt16 >::const_iterator aSnappingPointIter = aTmpSnappingPoints.begin(),
+              aEnd = aTmpSnappingPoints.end(); aSnappingPointIter != aEnd; ++aSnappingPointIter )
         {
             const sal_uInt16 nCurrent = *aSnappingPointIter;
             const long nCurrentOffset = Zoom2Offset( nCurrent );
@@ -270,9 +270,9 @@ void SvxZoomSliderControl::Paint( const UserDrawEvent& rUsrEvt )
 
 
     // draw snapping points:
-    std::vector< long >::iterator aSnappingPointIter;
-    for ( aSnappingPointIter = mxImpl->maSnappingPointOffsets.begin();
-          aSnappingPointIter != mxImpl->maSnappingPointOffsets.end();
+    for ( std::vector< long >::const_iterator aSnappingPointIter = mxImpl->maSnappingPointOffsets.begin(),
+            aEnd = mxImpl->maSnappingPointOffsets.end();
+          aSnappingPointIter != aEnd;
           ++aSnappingPointIter )
     {
         long nSnapPosX = aRect.Left() + *aSnappingPointIter;


More information about the Libreoffice-commits mailing list