[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - 5 commits - configure.ac editeng/qa external/icu sc/inc sc/source sw/source

Andras Timar andras.timar at collabora.com
Wed Dec 3 09:44:27 PST 2014


 configure.ac                        |    2 
 editeng/qa/unit/core-test.cxx       |    4 
 external/icu/UnpackedTarball_icu.mk |    1 
 external/icu/icu4c-scriptrun.patch  |   58 ++++++++
 sc/inc/column.hxx                   |    2 
 sc/inc/document.hxx                 |    2 
 sc/inc/refhint.hxx                  |   18 ++
 sc/inc/table.hxx                    |    2 
 sc/source/core/data/column.cxx      |   17 ++
 sc/source/core/data/document.cxx    |    5 
 sc/source/core/data/formulacell.cxx |   10 +
 sc/source/core/data/table2.cxx      |    4 
 sc/source/core/data/table3.cxx      |  245 +++++++++++++++++++++++-------------
 sc/source/core/tool/refhint.cxx     |    6 
 sc/source/ui/docshell/dbdocfun.cxx  |    2 
 sw/source/ui/misc/swruler.cxx       |    3 
 16 files changed, 283 insertions(+), 98 deletions(-)

New commits:
commit 2580fb2882343b7b80cc3c0317d8f99379cc8acb
Author: Andras Timar <andras.timar at collabora.com>
Date:   Wed Dec 3 08:21:05 2014 -0800

    Bump version to 4.2-20
    
    Change-Id: I9838eede17e52ba377f072f967acf65f081d1985

diff --git a/configure.ac b/configure.ac
index ed38062..5ef7055 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ dnl in order to create a configure script.
 # several non-alphanumeric characters, those are split off and used only for the
 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
 
-AC_INIT([LibreOffice],[4.2.10.19],[],[],[https://libreoffice-from-collabora.com/])
+AC_INIT([LibreOffice],[4.2.10.20],[],[],[https://libreoffice-from-collabora.com/])
 
 AC_PREREQ([2.59])
 
commit d1b9bad9414b91787760a320cd80467139c064f5
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Dec 1 23:56:44 2014 +0100

    fdo#86762 re-establish listeners to move cell broadcasters
    
    ... for UpdateReferenceOnSort=false
    
    (cherry picked from commit 6c2111f17089eb667bf526561d7667d17825e822)
    
    Conflicts:
    	sc/source/core/data/table3.cxx
    
    fdo#86762 broadcast also empty cells after sort
    
    (cherry picked from commit 08793e08c7e9cefe594c49130f782725e386c463)
    
    Conflicts:
    	sc/inc/column.hxx
    	sc/source/core/data/column.cxx
    	sc/source/core/data/document.cxx
    	sc/source/core/data/table2.cxx
    	sc/source/ui/docshell/dbdocfun.cxx
    
    fdo#86762 re-establish listeners on moved broadcasters
    
    ...  also in SortReorderByColumn() similar to SortReorderByRow()
    
    (cherry picked from commit e119f3883513aeaa49f332362620e955dc8b453f)
    
    Conflicts:
    	sc/source/core/data/table3.cxx
    
    e275a754c530d6039ed14304900dd71416f36e46
    7665dcc90d70fcf3b08bef0adb9ab6aaff1cdcdf
    
    Change-Id: Id90288660e317d6e47ee01ee3b5ff9058cfa18df
    Reviewed-on: https://gerrit.libreoffice.org/13275
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 4bda39d..86d39ab 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -334,7 +334,7 @@ public:
     bool IsFormulaDirty( SCROW nRow ) const;
 
     void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
-    void        SetDirty( SCROW nRow1, SCROW nRow2 );
+    void        SetDirty( SCROW nRow1, SCROW nRow2, bool bIncludeEmptyCells = false );
     void        SetDirtyVar();
     void        SetDirtyAfterLoad();
     void        SetTableOpDirty( const ScRange& );
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 432cf13..e7cd762 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -996,7 +996,7 @@ public:
     void            ResetChanged( const ScRange& rRange );
 
     void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
-    void            SetDirty( const ScRange& );
+    void            SetDirty( const ScRange&, bool bIncludeEmptyCells = false );
     void            SetTableOpDirty( const ScRange& );  // for Interpreter TableOp
     void            InterpretDirtyCells( const ScRangeList& rRanges );
     SC_DLLPUBLIC void CalcAll();
diff --git a/sc/inc/refhint.hxx b/sc/inc/refhint.hxx
index 6ccda8b..9ff8d30 100644
--- a/sc/inc/refhint.hxx
+++ b/sc/inc/refhint.hxx
@@ -21,7 +21,9 @@ public:
     enum Type {
         Moved,
         ColumnReordered,
-        RowReordered
+        RowReordered,
+        StartListening,
+        StopListening
     };
 
 private:
@@ -95,6 +97,20 @@ public:
     SCCOL getEndColumn() const;
 };
 
+class RefStartListeningHint : public RefHint
+{
+public:
+    RefStartListeningHint();
+    virtual ~RefStartListeningHint();
+};
+
+class RefStopListeningHint : public RefHint
+{
+public:
+    RefStopListeningHint();
+    virtual ~RefStopListeningHint();
+};
+
 }
 
 #endif
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 0b451a4..cc0257e 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -521,7 +521,7 @@ public:
     void        ResetChanged( const ScRange& rRange );
 
     void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
-    void        SetDirty( const ScRange& );
+    void        SetDirty( const ScRange&, bool bIncludeEmptyCells = false );
     void        SetDirtyAfterLoad();
     void        SetDirtyVar();
     void        SetTableOpDirty( const ScRange& );
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index ec1224c..9836cc0 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -3061,14 +3061,27 @@ void ScColumn::SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt )
     sc::ProcessFormula(maCells, aFunc);
 }
 
-void ScColumn::SetDirty( SCROW nRow1, SCROW nRow2 )
+void ScColumn::SetDirty( SCROW nRow1, SCROW nRow2, bool bIncludeEmptyCells )
 {
     // broadcasts everything within the range, with FormulaTracking
     sc::AutoCalcSwitch aSwitch(*pDocument, false);
 
     SetDirtyOnRangeHandler aHdl(*this);
     sc::ProcessFormula(maCells.begin(), maCells, nRow1, nRow2, aHdl, aHdl);
-    aHdl.broadcast();
+    if (bIncludeEmptyCells)
+    {
+        // Broadcast the changes.
+        ScHint aHint( SC_HINT_DATACHANGED, ScAddress( nCol, 0, nTab));
+        for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
+        {
+            aHint.GetAddress().SetRow(nRow);
+            pDocument->Broadcast(aHint);
+        }
+    }
+    else
+    {
+        aHdl.broadcast();
+    }
 }
 
 void ScColumn::SetTableOpDirty( const ScRange& rRange )
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 12e0ff1..e7963b9 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3549,8 +3549,7 @@ void ScDocument::SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt )
     SetAutoCalc( bOldAutoCalc );
 }
 
-
-void ScDocument::SetDirty( const ScRange& rRange )
+void ScDocument::SetDirty( const ScRange& rRange, bool bIncludeEmptyCells )
 {
     bool bOldAutoCalc = GetAutoCalc();
     bAutoCalc = false;      // keine Mehrfachberechnung
@@ -3558,7 +3557,7 @@ void ScDocument::SetDirty( const ScRange& rRange )
         ScBulkBroadcast aBulkBroadcast( GetBASM());
         SCTAB nTab2 = rRange.aEnd.Tab();
         for (SCTAB i=rRange.aStart.Tab(); i<=nTab2 && i < static_cast<SCTAB>(maTabs.size()); i++)
-            if (maTabs[i]) maTabs[i]->SetDirty( rRange );
+            if (maTabs[i]) maTabs[i]->SetDirty( rRange, bIncludeEmptyCells );
     }
     SetAutoCalc( bOldAutoCalc );
 }
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 3887caa..a1ab35a 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1936,6 +1936,16 @@ void ScFormulaCell::Notify( const SfxHint& rHint )
                         rRefRowReorder.getRowMap());
             }
             break;
+            case sc::RefHint::StartListening:
+            {
+                StartListeningTo( pDocument);
+            }
+            break;
+            case sc::RefHint::StopListening:
+            {
+                EndListeningTo( pDocument);
+            }
+            break;
             default:
                 ;
         }
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 101eb18..97432a7 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1688,13 +1688,13 @@ void ScTable::SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt )
 }
 
 
-void ScTable::SetDirty( const ScRange& rRange )
+void ScTable::SetDirty( const ScRange& rRange, bool bIncludeEmptyCells )
 {
     bool bOldAutoCalc = pDocument->GetAutoCalc();
     pDocument->SetAutoCalc( false );    // Mehrfachberechnungen vermeiden
     SCCOL nCol2 = rRange.aEnd.Col();
     for (SCCOL i=rRange.aStart.Col(); i<=nCol2; i++)
-        aCol[i].SetDirty(rRange.aStart.Row(), rRange.aEnd.Row());
+        aCol[i].SetDirty(rRange.aStart.Row(), rRange.aEnd.Row(), bIncludeEmptyCells);
     pDocument->SetAutoCalc( bOldAutoCalc );
 }
 
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index e49a4dc..58621c6 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -663,6 +663,30 @@ public:
 typedef ReorderNotifier<sc::RefColReorderHint, sc::ColRowReorderMapType, SCCOL> ColReorderNotifier;
 typedef ReorderNotifier<sc::RefRowReorderHint, sc::ColRowReorderMapType, SCROW> RowReorderNotifier;
 
+class StartListeningNotifier : std::unary_function<SvtListener*, void>
+{
+    sc::RefStartListeningHint maHint;
+public:
+    StartListeningNotifier() {}
+
+    void operator() ( SvtListener* p )
+    {
+        p->Notify(maHint);
+    }
+};
+
+class StopListeningNotifier : std::unary_function<SvtListener*, void>
+{
+    sc::RefStopListeningHint maHint;
+public:
+    StopListeningNotifier() {}
+
+    void operator() ( SvtListener* p )
+    {
+        p->Notify(maHint);
+    }
+};
+
 class FormulaGroupPosCollector : std::unary_function<SvtListener*, void>
 {
     sc::RefQueryFormulaGroup& mrQuery;
@@ -692,6 +716,28 @@ void ScTable::SortReorderByColumn(
     for (SCCOL nCol = nStart; nCol <= nLast; ++nCol)
         aCol[nCol].SplitFormulaGroupByRelativeRef(aSortRange);
 
+    // Collect all listeners of cell broadcasters of sorted range.
+    std::vector<SvtListener*> aCellListeners;
+
+    if (!pArray->IsUpdateRefs())
+    {
+        // Collect listeners of cell broadcasters.
+        for (SCCOL nCol = nStart; nCol <= nLast; ++nCol)
+            aCol[nCol].CollectListeners(aCellListeners, nRow1, nRow2);
+
+        // Remove any duplicate listener entries.  We must ensure that we
+        // notify each unique listener only once.
+        std::sort(aCellListeners.begin(), aCellListeners.end());
+        aCellListeners.erase(std::unique(aCellListeners.begin(), aCellListeners.end()), aCellListeners.end());
+
+        // Notify the cells' listeners to stop listening.
+        /* TODO: for performance this could be enhanced to stop and later
+         * restart only listening to within the reordered range and keep
+         * listening to everything outside untouched. */
+        StopListeningNotifier aFunc;
+        std::for_each(aCellListeners.begin(), aCellListeners.end(), aFunc);
+    }
+
     // table to keep track of column index to position in the index table.
     std::vector<SCCOLROW> aPosTable(nCount);
     for (size_t i = 0; i < nCount; ++i)
@@ -720,38 +766,38 @@ void ScTable::SortReorderByColumn(
     for (SCCOL nCol = nStart; nCol <= nLast; ++nCol)
         aCol[nCol].ResetFormulaCellPositions(nRow1, nRow2, bUpdateRefs);
 
-    // Set up column reorder map (for later broadcasting of reference updates).
-    sc::ColRowReorderMapType aColMap;
-    const std::vector<SCCOLROW>& rOldIndices = pArray->GetOrderIndices();
-    for (size_t i = 0, n = rOldIndices.size(); i < n; ++i)
-    {
-        SCCOL nNew = i + nStart;
-        SCCOL nOld = rOldIndices[i];
-        aColMap.insert(sc::ColRowReorderMapType::value_type(nOld, nNew));
-    }
-
-    // Collect all listeners within sorted range ahead of time.
-    std::vector<SvtListener*> aListeners;
-
-    // Get all area listeners that listen on one column within the range and
-    // end their listening.
-    ScRange aMoveRange( nStart, nRow1, nTab, nLast, nRow2, nTab);
-    std::vector<sc::AreaListener> aAreaListeners = pDocument->GetBASM()->GetAllListeners(
-            aMoveRange, sc::OneColumnInsideArea);
+    if (pArray->IsUpdateRefs())
     {
-        std::vector<sc::AreaListener>::iterator it = aAreaListeners.begin(), itEnd = aAreaListeners.end();
-        for (; it != itEnd; ++it)
+        // Set up column reorder map (for later broadcasting of reference updates).
+        sc::ColRowReorderMapType aColMap;
+        const std::vector<SCCOLROW>& rOldIndices = pArray->GetOrderIndices();
+        for (size_t i = 0, n = rOldIndices.size(); i < n; ++i)
         {
-            pDocument->EndListeningArea(it->maArea, it->mpListener);
-            aListeners.push_back( it->mpListener);
+            SCCOL nNew = i + nStart;
+            SCCOL nOld = rOldIndices[i];
+            aColMap.insert(sc::ColRowReorderMapType::value_type(nOld, nNew));
         }
-    }
 
-    if (pArray->IsUpdateRefs())
-    {
+        // Collect all listeners within sorted range ahead of time.
+        std::vector<SvtListener*> aListeners;
+
         for (SCCOL nCol = nStart; nCol <= nLast; ++nCol)
             aCol[nCol].CollectListeners(aListeners, nRow1, nRow2);
 
+        // Get all area listeners that listen on one column within the range
+        // and end their listening.
+        ScRange aMoveRange( nStart, nRow1, nTab, nLast, nRow2, nTab);
+        std::vector<sc::AreaListener> aAreaListeners = pDocument->GetBASM()->GetAllListeners(
+                aMoveRange, sc::OneColumnInsideArea);
+        {
+            std::vector<sc::AreaListener>::iterator it = aAreaListeners.begin(), itEnd = aAreaListeners.end();
+            for (; it != itEnd; ++it)
+            {
+                pDocument->EndListeningArea(it->maArea, it->mpListener);
+                aListeners.push_back( it->mpListener);
+            }
+        }
+
         // Remove any duplicate listener entries and notify all listeners
         // afterward.  We must ensure that we notify each unique listener only
         // once.
@@ -759,23 +805,29 @@ void ScTable::SortReorderByColumn(
         aListeners.erase(std::unique(aListeners.begin(), aListeners.end()), aListeners.end());
         ColReorderNotifier aFunc(aColMap, nTab, nRow1, nRow2);
         std::for_each(aListeners.begin(), aListeners.end(), aFunc);
-    }
 
-    // Re-start area listeners on the reordered columns.
-    {
-        std::vector<sc::AreaListener>::iterator it = aAreaListeners.begin(), itEnd = aAreaListeners.end();
-        for (; it != itEnd; ++it)
+        // Re-start area listeners on the reordered columns.
         {
-            ScRange aNewRange = it->maArea;
-            sc::ColRowReorderMapType::const_iterator itCol = aColMap.find( aNewRange.aStart.Col());
-            if (itCol != aColMap.end())
+            std::vector<sc::AreaListener>::iterator it = aAreaListeners.begin(), itEnd = aAreaListeners.end();
+            for (; it != itEnd; ++it)
             {
-                aNewRange.aStart.SetCol( itCol->second);
-                aNewRange.aEnd.SetCol( itCol->second);
+                ScRange aNewRange = it->maArea;
+                sc::ColRowReorderMapType::const_iterator itCol = aColMap.find( aNewRange.aStart.Col());
+                if (itCol != aColMap.end())
+                {
+                    aNewRange.aStart.SetCol( itCol->second);
+                    aNewRange.aEnd.SetCol( itCol->second);
+                }
+                pDocument->StartListeningArea(aNewRange, it->mpListener);
             }
-            pDocument->StartListeningArea(aNewRange, it->mpListener);
         }
     }
+    else    // !(pArray->IsUpdateRefs())
+    {
+        // Notify the cells' listeners to (re-)start listening.
+        StartListeningNotifier aFunc;
+        std::for_each(aCellListeners.begin(), aCellListeners.end(), aFunc);
+    }
 
     // Re-join formulas at row boundaries now that all the references have
     // been adjusted for column reordering.
@@ -803,6 +855,9 @@ void ScTable::SortReorderByRow(
     ScSortInfoArray::RowsType* pRows = pArray->GetDataRows();
     assert(pRows); // In sort-by-row mode we must have data rows already populated.
 
+    // Collect all listeners of cell broadcasters of sorted range.
+    std::vector<SvtListener*> aCellListeners;
+
     if (!pArray->IsUpdateRefs())
     {
         // When the update ref mode is disabled, we need to detach all formula
@@ -810,6 +865,22 @@ void ScTable::SortReorderByRow(
         // afterward.
         sc::EndListeningContext aCxt(*pDocument);
         DetachFormulaCells(aCxt, nCol1, nRow1, nCol2, nRow2);
+
+        // Collect listeners of cell broadcasters.
+        for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
+            aCol[nCol].CollectListeners(aCellListeners, nRow1, nRow2);
+
+        // Remove any duplicate listener entries.  We must ensure that we notify
+        // each unique listener only once.
+        std::sort(aCellListeners.begin(), aCellListeners.end());
+        aCellListeners.erase(std::unique(aCellListeners.begin(), aCellListeners.end()), aCellListeners.end());
+
+        // Notify the cells' listeners to stop listening.
+        /* TODO: for performance this could be enhanced to stop and later
+         * restart only listening to within the reordered range and keep
+         * listening to everything outside untouched. */
+        StopListeningNotifier aFunc;
+        std::for_each(aCellListeners.begin(), aCellListeners.end(), aFunc);
     }
 
     // Split formula groups at the sort range boundaries (if applicable).
@@ -889,15 +960,18 @@ void ScTable::SortReorderByRow(
             else
                 rAttrStore.push_back_empty();
 
-            // At this point each broadcaster instance is managed by 2
-            // containers. We will release those in the original storage
-            // below before transferring them to the document.
-            sc::BroadcasterStoreType& rBCStore = aSortedCols.at(j).maBroadcasters;
-            if (rCell.mpBroadcaster)
-                // A const pointer would be implicitly converted to a bool type.
-                rBCStore.push_back(const_cast<SvtBroadcaster*>(rCell.mpBroadcaster));
-            else
-                rBCStore.push_back_empty();
+            if (pArray->IsUpdateRefs())
+            {
+                // At this point each broadcaster instance is managed by 2
+                // containers. We will release those in the original storage
+                // below before transferring them to the document.
+                sc::BroadcasterStoreType& rBCStore = aSortedCols.at(j).maBroadcasters;
+                if (rCell.mpBroadcaster)
+                    // A const pointer would be implicitly converted to a bool type.
+                    rBCStore.push_back(const_cast<SvtBroadcaster*>(rCell.mpBroadcaster));
+                else
+                    rBCStore.push_back_empty();
+            }
 
             // The same with cell note instances ...
             sc::CellNoteStoreType& rNoteStore = aSortedCols.at(j).maCellNotes;
@@ -938,6 +1012,7 @@ void ScTable::SortReorderByRow(
             rSrc.transfer(nRow1, nRow2, rDest, nRow1);
         }
 
+        if (pArray->IsUpdateRefs())
         {
             sc::BroadcasterStoreType& rSrc = aSortedCols[i].maBroadcasters;
             sc::BroadcasterStoreType& rDest = aCol[nThisCol].maBroadcasters;
@@ -1003,39 +1078,39 @@ void ScTable::SortReorderByRow(
             SetRowFiltered(it->mnRow1, it->mnRow2, true);
     }
 
-    // Set up row reorder map (for later broadcasting of reference updates).
-    sc::ColRowReorderMapType aRowMap;
-    const std::vector<SCCOLROW>& rOldIndices = pArray->GetOrderIndices();
-    for (size_t i = 0, n = rOldIndices.size(); i < n; ++i)
-    {
-        SCROW nNew = i + nRow1;
-        SCROW nOld = rOldIndices[i];
-        aRowMap.insert(sc::ColRowReorderMapType::value_type(nOld, nNew));
-    }
-
-    // Collect all listeners within sorted range ahead of time.
-    std::vector<SvtListener*> aListeners;
-
-    // Get all area listeners that listen on one row within the range and end
-    // their listening.
-    ScRange aMoveRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab);
-    std::vector<sc::AreaListener> aAreaListeners = pDocument->GetBASM()->GetAllListeners(
-            aMoveRange, sc::OneRowInsideArea);
+    if (pArray->IsUpdateRefs())
     {
-        std::vector<sc::AreaListener>::iterator it = aAreaListeners.begin(), itEnd = aAreaListeners.end();
-        for (; it != itEnd; ++it)
+        // Set up row reorder map (for later broadcasting of reference updates).
+        sc::ColRowReorderMapType aRowMap;
+        const std::vector<SCCOLROW>& rOldIndices = pArray->GetOrderIndices();
+        for (size_t i = 0, n = rOldIndices.size(); i < n; ++i)
         {
-            pDocument->EndListeningArea(it->maArea, it->mpListener);
-            aListeners.push_back( it->mpListener);
+            SCROW nNew = i + nRow1;
+            SCROW nOld = rOldIndices[i];
+            aRowMap.insert(sc::ColRowReorderMapType::value_type(nOld, nNew));
         }
-    }
 
-    if (pArray->IsUpdateRefs())
-    {
+        // Collect all listeners within sorted range ahead of time.
+        std::vector<SvtListener*> aListeners;
+
         // Collect listeners of cell broadcasters.
         for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
             aCol[nCol].CollectListeners(aListeners, nRow1, nRow2);
 
+        // Get all area listeners that listen on one row within the range and end
+        // their listening.
+        ScRange aMoveRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab);
+        std::vector<sc::AreaListener> aAreaListeners = pDocument->GetBASM()->GetAllListeners(
+                aMoveRange, sc::OneRowInsideArea);
+        {
+            std::vector<sc::AreaListener>::iterator it = aAreaListeners.begin(), itEnd = aAreaListeners.end();
+            for (; it != itEnd; ++it)
+            {
+                pDocument->EndListeningArea(it->maArea, it->mpListener);
+                aListeners.push_back( it->mpListener);
+            }
+        }
+
         // Remove any duplicate listener entries.  We must ensure that we notify
         // each unique listener only once.
         std::sort(aListeners.begin(), aListeners.end());
@@ -1061,7 +1136,7 @@ void ScTable::SortReorderByRow(
             }
         }
 
-        // Notify the listeners.
+        // Notify the listeners to update their references.
         RowReorderNotifier aFunc(aRowMap, nTab, nCol1, nCol2);
         std::for_each(aListeners.begin(), aListeners.end(), aFunc);
 
@@ -1073,23 +1148,29 @@ void ScTable::SortReorderByRow(
             for (; itCol != itColEnd; ++itCol)
                 pDocument->RegroupFormulaCells(itGroupTab->first, itCol->first);
         }
-    }
 
-    // Re-start area listeners on the reordered rows.
-    {
-        std::vector<sc::AreaListener>::iterator it = aAreaListeners.begin(), itEnd = aAreaListeners.end();
-        for (; it != itEnd; ++it)
+        // Re-start area listeners on the reordered rows.
         {
-            ScRange aNewRange = it->maArea;
-            sc::ColRowReorderMapType::const_iterator itRow = aRowMap.find( aNewRange.aStart.Row());
-            if (itRow != aRowMap.end())
+            std::vector<sc::AreaListener>::iterator it = aAreaListeners.begin(), itEnd = aAreaListeners.end();
+            for (; it != itEnd; ++it)
             {
-                aNewRange.aStart.SetRow( itRow->second);
-                aNewRange.aEnd.SetRow( itRow->second);
+                ScRange aNewRange = it->maArea;
+                sc::ColRowReorderMapType::const_iterator itRow = aRowMap.find( aNewRange.aStart.Row());
+                if (itRow != aRowMap.end())
+                {
+                    aNewRange.aStart.SetRow( itRow->second);
+                    aNewRange.aEnd.SetRow( itRow->second);
+                }
+                pDocument->StartListeningArea(aNewRange, it->mpListener);
             }
-            pDocument->StartListeningArea(aNewRange, it->mpListener);
         }
     }
+    else    // !(pArray->IsUpdateRefs())
+    {
+        // Notify the cells' listeners to (re-)start listening.
+        StartListeningNotifier aFunc;
+        std::for_each(aCellListeners.begin(), aCellListeners.end(), aFunc);
+    }
 
     // Re-group columns in the sorted range too.
     for (SCCOL i = nCol1; i <= nCol2; ++i)
diff --git a/sc/source/core/tool/refhint.cxx b/sc/source/core/tool/refhint.cxx
index 29a9166..33b510d 100644
--- a/sc/source/core/tool/refhint.cxx
+++ b/sc/source/core/tool/refhint.cxx
@@ -81,6 +81,12 @@ SCCOL RefRowReorderHint::getEndColumn() const
     return mnCol2;
 }
 
+RefStartListeningHint::RefStartListeningHint() : RefHint(StartListening) {}
+RefStartListeningHint::~RefStartListeningHint() {}
+
+RefStopListeningHint::RefStopListeningHint() : RefHint(StopListening) {}
+RefStopListeningHint::~RefStopListeningHint() {}
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 9163a84..9389a1e 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -536,7 +536,7 @@ sal_Bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
     ScRange aDirtyRange(
         aLocalParam.nCol1, nStartRow, nTab,
         aLocalParam.nCol2, aLocalParam.nRow2, nTab);
-    pDoc->SetDirty( aDirtyRange );
+    pDoc->SetDirty( aDirtyRange, true );
 
     if (bPaint)
     {
commit 5ba491c476fc434fffbae7a0413a0ec611c5bb7b
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Dec 2 16:01:32 2014 +0100

    editeng: fix build
    
    Change-Id: I64d50f1b1554f7bbb1aadffd16089be2847b765a
    (cherry picked from commit d6edd18c7bda9ca6325b1abd59de0014be33a0bb)

diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx
index 3d5bd81..1f02e3a 100644
--- a/editeng/qa/unit/core-test.cxx
+++ b/editeng/qa/unit/core-test.cxx
@@ -578,7 +578,7 @@ void Test::testSectionAttributes()
     {
         aEngine.Clear();
         aEngine.SetText("one\ntwo");
-        CPPUNIT_ASSERT_EQUAL(2, aEngine.GetParagraphCount());
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aEngine.GetParagraphCount());
 
         // embolden 2nd paragraph
         pSet.reset(new SfxItemSet(aEngine.GetEmptyItemSet()));
@@ -591,7 +591,7 @@ void Test::testSectionAttributes()
 
         // now delete & join the paragraphs - this is fdo#85496 scenario
         aEngine.QuickDelete(ESelection(0,0,1,3));
-        CPPUNIT_ASSERT_EQUAL(1, aEngine.GetParagraphCount());
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aEngine.GetParagraphCount());
 
         boost::scoped_ptr<EditTextObject> pEditText(aEngine.CreateTextObject());
         CPPUNIT_ASSERT_MESSAGE("Failed to create text object.", pEditText.get());
commit b148f73477c69dfd9ea18bdf28e745ced4e41b14
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Nov 30 20:38:42 2014 +0000

    mirror fixes for fdo#78906 and deb#766788 into icu
    
    (cherry picked from commit a66451887425ddd9387e2b25d5125916f4a35f83)
    (cherry picked from commit bff0fe902686d8c126a73e1d2c914f5d65c6ffaf)
    
    Conflicts:
    	external/icu/UnpackedTarball_icu.mk
    
    Change-Id: I9325bb28eb267b023f628e24fea216ad580759e9
    Reviewed-on: https://gerrit.libreoffice.org/13220
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/external/icu/UnpackedTarball_icu.mk b/external/icu/UnpackedTarball_icu.mk
index 77cd38a..8c73b48 100644
--- a/external/icu/UnpackedTarball_icu.mk
+++ b/external/icu/UnpackedTarball_icu.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,icu,\
 	external/icu/icu4c-mkdir.patch \
 	external/icu/icu4c-buffer-overflow.patch \
 	external/icu/icu4c-$(if $(filter ANDROID,$(OS)),android,rpath).patch \
+	external/icu/icu4c-scriptrun.patch \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/icu/icu4c-scriptrun.patch b/external/icu/icu4c-scriptrun.patch
new file mode 100644
index 0000000..e307811
--- /dev/null
+++ b/external/icu/icu4c-scriptrun.patch
@@ -0,0 +1,58 @@
+--- misc/icu/source/extra/scrptrun/scrptrun.cpp
++++ misc/build/icu/source/extra/scrptrun/scrptrun.cpp
+@@ -150,7 +150,11 @@
+         // characters above it on the stack will be poped.
+         if (pairIndex >= 0) {
+             if ((pairIndex & 1) == 0) {
+-                parenStack[++parenSP].pairIndex = pairIndex;
++                ++parenSP;
++                int32_t nVecSize = parenStack.size();
++                if (parenSP == nVecSize)
++                    parenStack.resize(nVecSize + 128);
++                parenStack[parenSP].pairIndex = pairIndex;
+                 parenStack[parenSP].scriptCode  = scriptCode;
+             } else if (parenSP >= 0) {
+                 int32_t pi = pairIndex & ~1;
+@@ -184,7 +188,14 @@
+             // pop it from the stack
+             if (pairIndex >= 0 && (pairIndex & 1) != 0 && parenSP >= 0) {
+                 parenSP -= 1;
+-                startSP -= 1;
++                /* decrement startSP only if it is >= 0,
++                   decrementing it unnecessarily will lead to memory corruption
++                   while processing the above while block.
++                   e.g. startSP = -4 , parenSP = -1
++                */
++                if (startSP >= 0) {
++                    startSP -= 1;
++                }
+             }
+         } else {
+             // if the run broke on a surrogate pair,
+--- misc/icu/source/extra/scrptrun/scrptrun.h
++++ misc/build/icu/source/extra/scrptrun/scrptrun.h
+@@ -17,6 +17,7 @@
+ #include "unicode/utypes.h"
+ #include "unicode/uobject.h"
+ #include "unicode/uscript.h"
++#include <vector>
+ 
+ struct ScriptRecord
+ {
+@@ -79,7 +80,7 @@
+     int32_t scriptEnd;
+     UScriptCode scriptCode;
+ 
+-    ParenStackEntry parenStack[128];
++    std::vector<ParenStackEntry> parenStack;
+     int32_t parenSP;
+ 
+     static int8_t highBit(int32_t value);
+@@ -133,6 +134,7 @@
+     scriptEnd   = charStart;
+     scriptCode  = USCRIPT_INVALID_CODE;
+     parenSP     = -1;
++    parenStack.resize(128);
+ }
+ 
+ inline void ScriptRun::reset(int32_t start, int32_t length)
commit c5822853ed48df7cc67d16d3910097e4b33001c2
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Dec 20 14:56:33 2013 +0200

    Prevent occasional crash
    
    I came across the crash by accident when checking how it works to have
    multiple windows showing the same document. Pasting in lots of text
    and then quickly telling LO to exit with Cmd-Q caused a crash here as
    GetPostItMgr() returned NULL.
    
    Change-Id: Ib9e636df0832a679a1d81fa3856ea0a7105a69c3
    (cherry picked from commit 0eb1ef39084a978e8c2bec977ebabf6708f0c073)
    Reviewed-on: https://gerrit.libreoffice.org/13219
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/source/ui/misc/swruler.cxx b/sw/source/ui/misc/swruler.cxx
index fa396d0..b1035c9 100644
--- a/sw/source/ui/misc/swruler.cxx
+++ b/sw/source/ui/misc/swruler.cxx
@@ -56,7 +56,8 @@ void SwCommentRuler::Paint( const Rectangle& rRect )
 {
     SvxRuler::Paint( rRect );
     // Don't draw if there is not any note
-    if ( mpViewShell->GetPostItMgr()->HasNotes() )
+    if ( mpViewShell->GetPostItMgr()
+         && mpViewShell->GetPostItMgr()->HasNotes() )
         DrawCommentControl();
 }
 


More information about the Libreoffice-commits mailing list