[Libreoffice-commits] core.git: Branch 'aoo/trunk' - sc/source

Andre Fischer af at apache.org
Mon Jan 20 08:08:55 PST 2014


 sc/source/core/data/table2.cxx |   26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

New commits:
commit 3551c988e2757394dadce776515fccdef78f0214
Author: Andre Fischer <af at apache.org>
Date:   Mon Jan 20 14:11:17 2014 +0000

    124033: Made the update of maColManualBreaks more conservative.

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 544a265..5b96472 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -267,18 +267,24 @@ void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE
 
         if (!maColManualBreaks.empty())
         {
-            std::set<SCCOL>::reverse_iterator rit = maColManualBreaks.rbegin();
-            while (rit != maColManualBreaks.rend())
+            std::vector<SCCOL> aUpdatedBreaks;
+
+            while ( ! maColManualBreaks.empty())
             {
-                SCCOL nCol = *rit;
-                if (nCol < nStartCol)
-                    break;  // while
-                else
-                {
-                    maColManualBreaks.erase( (++rit).base());
-                    maColManualBreaks.insert( static_cast<SCCOL>( nCol + nSize));
-                }
+                std::set<SCCOL>::iterator aLast (--maColManualBreaks.end());
+
+                // Check if there are more entries that have to be processed.
+                if (*aLast < nStartRow)
+                    break;
+
+                // Remember the updated break location and erase the entry.
+                aUpdatedBreaks.push_back(static_cast<SCCOL>(*aLast + nSize));
+                maColManualBreaks.erase(aLast);
             }
+
+            // Insert the updated break locations.
+            if ( ! aUpdatedBreaks.empty())
+                maColManualBreaks.insert(aUpdatedBreaks.begin(), aUpdatedBreaks.end());
         }
     }
 


More information about the Libreoffice-commits mailing list