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

Julien Nabet serval2412 at yahoo.fr
Thu Apr 14 07:04:06 UTC 2016


 svx/source/dialog/charmap.cxx           |    3 ++-
 svx/source/dialog/orienthelper.cxx      |    6 ++++--
 svx/source/engine3d/helperhittest3d.cxx |    3 ++-
 svx/source/fmcomp/gridctrl.cxx          |    2 +-
 svx/source/form/filtnav.cxx             |    8 +++++---
 svx/source/form/fmexpl.cxx              |    3 ++-
 svx/source/form/fmsrcimp.cxx            |    9 +++++----
 svx/source/form/fmtextcontrolshell.cxx  |    6 ++++--
 svx/source/form/fmvwimp.cxx             |    3 ++-
 svx/source/form/formcontroller.cxx      |   25 +++++++++++++++----------
 svx/source/form/navigatortree.cxx       |    7 ++++---
 11 files changed, 46 insertions(+), 29 deletions(-)

New commits:
commit 85dd50819b8b736e8a791ed3f001145a0df54265
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Wed Apr 13 21:20:25 2016 +0200

    Use const_iterator when possible (svx/dialog,engine3d,fmcomp,form)
    
    Change-Id: Ie08593a3b5b3043a1f212d51d77ced467c309749
    Reviewed-on: https://gerrit.libreoffice.org/24064
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index 7e31fd5..c42bcbf 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -1619,7 +1619,8 @@ void SubsetMap::ApplyCharMap( const FontCharMapPtr& rxFontCharMap )
 
     // remove subsets that are not matched in any range
     SubsetList::iterator it = maSubsets.begin();
-    while( it != maSubsets.end() )
+    SubsetList::const_iterator aEnd = maSubsets.end();
+    while(it != aEnd)
     {
         const Subset& rSubset = *it;
         sal_uInt32 cMin = rSubset.GetRangeMin();
diff --git a/svx/source/dialog/orienthelper.cxx b/svx/source/dialog/orienthelper.cxx
index 3c40a15..b8f9432 100644
--- a/svx/source/dialog/orienthelper.cxx
+++ b/svx/source/dialog/orienthelper.cxx
@@ -71,7 +71,8 @@ void OrientationHelper_Impl::AddDependentWindow( vcl::Window& rWindow, TriState
 
 void OrientationHelper_Impl::EnableDependentWindows()
 {
-    for( WindowVec::iterator aIt = maWinVec.begin(), aEnd = maWinVec.end(); aIt != aEnd; ++aIt )
+    WindowVec::const_iterator aEnd = maWinVec.end();
+    for( WindowVec::iterator aIt = maWinVec.begin(); aIt != aEnd; ++aIt )
         EnableWindow( *aIt->first, aIt->second );
 }
 
@@ -91,7 +92,8 @@ void OrientationHelper_Impl::EnableWindow( vcl::Window& rWindow, TriState eDisab
 
 void OrientationHelper_Impl::ShowDependentWindows()
 {
-    for( WindowVec::iterator aIt = maWinVec.begin(), aEnd = maWinVec.end(); aIt != aEnd; ++aIt )
+    WindowVec::const_iterator aEnd = maWinVec.end();
+    for( WindowVec::iterator aIt = maWinVec.begin(); aIt != aEnd; ++aIt )
         aIt->first->Show( mbVisible );
 }
 
diff --git a/svx/source/engine3d/helperhittest3d.cxx b/svx/source/engine3d/helperhittest3d.cxx
index cf9b912..62bcafb 100644
--- a/svx/source/engine3d/helperhittest3d.cxx
+++ b/svx/source/engine3d/helperhittest3d.cxx
@@ -219,8 +219,9 @@ void getAllHit3DObjectsSortedFrontToBack(
 
                 // copy SdrObject pointers to return result set
                 ::std::vector< ImplPairDephAndObject >::iterator aIterator2(aDepthAndObjectResults.begin());
+                ::std::vector< ImplPairDephAndObject >::const_iterator aEnd(aDepthAndObjectResults.end());
 
-                for(;aIterator2 != aDepthAndObjectResults.end(); ++aIterator2)
+                for(;aIterator2 != aEnd; ++aIterator2)
                 {
                     o_rResult.push_back(aIterator2->getObject());
                 }
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index 8ec0779..901e804 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -3652,7 +3652,7 @@ void DbGridControl::FieldListenerDisposing(sal_uInt16 _nId)
         return;
     }
 
-    ColumnFieldValueListeners::iterator aPos = pListeners->find(_nId);
+    ColumnFieldValueListeners::const_iterator aPos = pListeners->find(_nId);
     if (aPos == pListeners->end())
     {
         OSL_FAIL("DbGridControl::FieldListenerDisposing : invalid call (did not find the listener) !");
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index da326d7..1583d4d 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -708,9 +708,10 @@ void FmFilterModel::SetCurrentController(const Reference< XFormController > & xC
 void FmFilterModel::AppendFilterItems( FmFormItem& _rFormItem )
 {
     // insert the condition behind the last filter items
+    ::std::vector<FmFilterData*>::const_reverse_iterator aEnd = _rFormItem.GetChildren().rend();
     ::std::vector<FmFilterData*>::reverse_iterator iter;
     for (   iter = _rFormItem.GetChildren().rbegin();
-            iter != _rFormItem.GetChildren().rend();
+            iter != aEnd;
             ++iter
         )
     {
@@ -884,7 +885,7 @@ void FmFilterModel::Append(FmFilterItems* pItems, FmFilterItem* pFilterItem)
 void FmFilterModel::SetTextForItem(FmFilterItem* pItem, const OUString& rText)
 {
     ::std::vector<FmFilterData*>& rItems = pItem->GetParent()->GetParent()->GetChildren();
-    ::std::vector<FmFilterData*>::iterator i = ::std::find(rItems.begin(), rItems.end(), pItem->GetParent());
+    ::std::vector<FmFilterData*>::const_iterator i = ::std::find(rItems.begin(), rItems.end(), pItem->GetParent());
     sal_Int32 nParentPos = i - rItems.begin();
 
     FmFilterAdapter::setText(nParentPos, pItem, rText);
@@ -951,9 +952,10 @@ void FmFilterModel::EnsureEmptyFilterRows( FmParentData& _rItem )
     // checks whether for each form there's one free level for input
     ::std::vector< FmFilterData* >& rChildren = _rItem.GetChildren();
     bool bAppendLevel = dynamic_cast<const FmFormItem*>(&_rItem) !=  nullptr;
+    ::std::vector<FmFilterData*>::const_iterator aEnd = rChildren.end();
 
     for (   ::std::vector<FmFilterData*>::iterator i = rChildren.begin();
-            i != rChildren.end();
+            i != aEnd;
             ++i
         )
     {
diff --git a/svx/source/form/fmexpl.cxx b/svx/source/form/fmexpl.cxx
index 316f951..edb5c82 100644
--- a/svx/source/form/fmexpl.cxx
+++ b/svx/source/form/fmexpl.cxx
@@ -137,8 +137,9 @@ FmEntryDataList::~FmEntryDataList()
 
 FmEntryData* FmEntryDataList::remove( FmEntryData* pItem )
 {
+    FmEntryDataBaseList::const_iterator aEnd = maEntryDataList.end();
     for ( FmEntryDataBaseList::iterator it = maEntryDataList.begin();
-          it != maEntryDataList.end();
+          it != aEnd;
           ++it
         )
     {
diff --git a/svx/source/form/fmsrcimp.cxx b/svx/source/form/fmsrcimp.cxx
index 14fcaf9..d82eb583 100644
--- a/svx/source/form/fmsrcimp.cxx
+++ b/svx/source/form/fmsrcimp.cxx
@@ -398,7 +398,7 @@ FmSearchEngine::SEARCH_RESULT FmSearchEngine::SearchSpecial(bool _bSearchForNull
     Any aStartMark;
     try { aStartMark = m_xSearchCursor.getBookmark(); }
     catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); return SR_ERROR; }
-    FieldCollection::iterator iterInitialField = iterFieldLoop;
+    FieldCollection::const_iterator iterInitialField = iterFieldLoop;
 
 
     bool bFound(false);
@@ -463,7 +463,7 @@ FmSearchEngine::SEARCH_RESULT FmSearchEngine::SearchWildcard(const OUString& str
     Any aStartMark;
     try { aStartMark = m_xSearchCursor.getBookmark(); }
     catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); return SR_ERROR; }
-    FieldCollection::iterator iterInitialField = iterFieldLoop;
+    FieldCollection::const_iterator iterInitialField = iterFieldLoop;
 
     WildCard aSearchExpression(strExpression);
 
@@ -546,7 +546,7 @@ FmSearchEngine::SEARCH_RESULT FmSearchEngine::SearchRegularApprox(const OUString
     Any aStartMark;
     try { aStartMark = m_xSearchCursor.getBookmark(); }
     catch ( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); return SR_ERROR; }
-    FieldCollection::iterator iterInitialField = iterFieldLoop;
+    FieldCollection::const_iterator iterInitialField = iterFieldLoop;
 
     // Parameter sammeln
     SearchOptions2 aParam;
@@ -769,8 +769,9 @@ bool FmSearchEngine::GetCaseSensitive() const
 
 void FmSearchEngine::clearControlTexts()
 {
+    ControlTextSuppliers::const_iterator aEnd = m_aControlTexts.end();
     for (   ControlTextSuppliers::iterator aIter = m_aControlTexts.begin();
-            aIter < m_aControlTexts.end();
+            aIter != aEnd;
             ++aIter
         )
     {
diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx
index 1b1331c..b16df02 100644
--- a/svx/source/form/fmtextcontrolshell.cxx
+++ b/svx/source/form/fmtextcontrolshell.cxx
@@ -1121,8 +1121,9 @@ namespace svx
         OSL_PRECOND( isControllerListening(), "FmTextControlShell::stopControllerListening: inconsistence!" );
 
         // dispose all listeners associated with the controls of the active controller
+        FocusListenerAdapters::const_iterator aEnd = m_aControlObservers.end();
         for (   FocusListenerAdapters::iterator aLoop = m_aControlObservers.begin();
-                aLoop != m_aControlObservers.end();
+                aLoop != aEnd;
                 ++aLoop
             )
         {
@@ -1139,8 +1140,9 @@ namespace svx
     void FmTextControlShell::implClearActiveControlRef()
     {
         // no more features for this control
+        ControlFeatures::const_iterator aEnd = m_aControlFeatures.end();
         for (   ControlFeatures::iterator aLoop = m_aControlFeatures.begin();
-                aLoop != m_aControlFeatures.end();
+                aLoop != aEnd;
                 ++aLoop
             )
         {
diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
index 8c2daea..184a29d 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -577,8 +577,9 @@ void FmXFormView::removeWindow( const Reference< XControlContainer >& _rxCC )
     // - der Control-Container fuer ein Window entfernt wird, waehrend
     //   der aktive Modus eingeschaltet ist.
 
+    PageWindowAdapterList::const_iterator aEnd = m_aPageWindowAdapters.end();
     for (   PageWindowAdapterList::iterator i = m_aPageWindowAdapters.begin();
-            i != m_aPageWindowAdapters.end();
+            i != aEnd;
             ++i
         )
     {
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index 3e1bcb3..ab51d0a 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -324,8 +324,9 @@ namespace
 
 void ColumnInfoCache::deinitializeControls()
 {
+    ColumnInfos::const_iterator aEnd = m_aColumns.end();
     for (   ColumnInfos::iterator col = m_aColumns.begin();
-            col != m_aColumns.end();
+            col != aEnd;
             ++col
         )
     {
@@ -338,9 +339,10 @@ void ColumnInfoCache::initializeControls( const Sequence< Reference< XControl >
 {
     try
     {
+        ColumnInfos::const_iterator aEnd = m_aColumns.end();
         // for every of our known columns, find the controls which are bound to this column
         for (   ColumnInfos::iterator col = m_aColumns.begin();
-                col != m_aColumns.end();
+                col != aEnd;
                 ++col
             )
         {
@@ -1130,8 +1132,9 @@ void SAL_CALL FormController::disposing(const EventObject& e) throw( RuntimeExce
 
 void FormController::disposeAllFeaturesAndDispatchers()
 {
+    DispatcherContainer::const_iterator aEnd = m_aFeatureDispatchers.end();
     for ( DispatcherContainer::iterator aDispatcher = m_aFeatureDispatchers.begin();
-          aDispatcher != m_aFeatureDispatchers.end();
+          aDispatcher != aEnd;
           ++aDispatcher
         )
     {
@@ -3075,8 +3078,9 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
         Reference< XNameAccess > xQueryColumns =
             Reference< XColumnsSupplier >( m_xComposer, UNO_QUERY_THROW )->getColumns();
 
+        ::std::vector<FmFieldInfo>::const_iterator aEnd = rFieldInfos.end();
         for (::std::vector<FmFieldInfo>::iterator iter = rFieldInfos.begin();
-            iter != rFieldInfos.end(); ++iter)
+            iter != aEnd; ++iter)
         {
             if ( xQueryColumns->hasByName((*iter).aFieldName) )
             {
@@ -3157,8 +3161,8 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
                 }
 
                 // find the text component
-                for (::std::vector<FmFieldInfo>::iterator iter = rFieldInfos.begin();
-                    iter != rFieldInfos.end(); ++iter)
+                for (::std::vector<FmFieldInfo>::const_iterator iter = rFieldInfos.begin();
+                    iter != aEnd; ++iter)
                 {
                     // we found the field so insert a new entry to the filter row
                     if ((*iter).xField == xField)
@@ -3205,8 +3209,8 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
     }
 
     // now set the filter controls
-    for (   ::std::vector<FmFieldInfo>::iterator field = rFieldInfos.begin();
-            field != rFieldInfos.end();
+    for (   ::std::vector<FmFieldInfo>::const_iterator field = rFieldInfos.begin(), aEnd = rFieldInfos.end();
+            field != aEnd;
             ++field
         )
     {
@@ -4210,16 +4214,17 @@ void FormController::deleteInterceptor(const Reference< XDispatchProviderInterce
 {
     OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" );
     // search the interceptor responsible for the given object
+    Interceptors::const_iterator aEnd = m_aControlDispatchInterceptors.end();
     Interceptors::iterator aIter;
     for (   aIter = m_aControlDispatchInterceptors.begin();
-            aIter != m_aControlDispatchInterceptors.end();
+            aIter != aEnd;
             ++aIter
         )
     {
         if ((*aIter)->getIntercepted() == _xInterception)
             break;
     }
-    if (aIter == m_aControlDispatchInterceptors.end())
+    if (aIter == aEnd)
     {
         return;
     }
diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx
index df66815..854289b 100644
--- a/svx/source/form/navigatortree.cxx
+++ b/svx/source/form/navigatortree.cxx
@@ -1921,18 +1921,19 @@ namespace svxform
             // This may be a frequently used code ( at every change in mark of the view!),
             // so i use latter one
             SvTreeListEntry* pLoop = First();
-            while( pLoop )
+            FmEntryDataArray::const_iterator aEnd = arredToSelect.end();
+            while(pLoop)
             {
                 FmEntryData* pCurEntryData = static_cast<FmEntryData*>(pLoop->GetUserData());
                 FmEntryDataArray::iterator it = arredToSelect.find(pCurEntryData);
-                if ( it != arredToSelect.end() )
+                if (it != aEnd)
                 {
                     Select(pLoop);
                     MakeVisible(pLoop);
                     SetCursor(pLoop, true);
                 }
 
-                pLoop = Next( pLoop );
+                pLoop = Next(pLoop);
             }
         }
         UnlockSelectionHandling();


More information about the Libreoffice-commits mailing list