[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/inc sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Thu Jan 30 15:40:35 PST 2014


 sc/inc/column.hxx                |    5 +++--
 sc/inc/document.hxx              |    4 ++--
 sc/inc/table.hxx                 |    2 +-
 sc/source/core/data/column.cxx   |    4 ++--
 sc/source/core/data/column3.cxx  |   12 ++++++++----
 sc/source/core/data/document.cxx |    9 +++++----
 sc/source/core/data/table2.cxx   |    4 ++--
 sc/source/ui/undo/undoblk.cxx    |    5 ++++-
 8 files changed, 27 insertions(+), 18 deletions(-)

New commits:
commit 92346fb7714ca7c6a467771d8a8b01305c1b17d1
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Jan 29 14:00:47 2014 -0500

    fdo#74014: Broadcast changes during undo and redo after paste.
    
    Change-Id: I271bbba5e5eb70e48274a4a062d125456af8ff6c
    (cherry picked from commit f5d8029a456c2c708cbc2b67f2d7875540dff1ab)
    Reviewed-on: https://gerrit.libreoffice.org/7728
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 032ef8e..67d7572 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -213,7 +213,8 @@ public:
     bool TestInsertRow( SCROW nStartRow, SCSIZE nSize ) const;
     void        InsertRow( SCROW nStartRow, SCSIZE nSize );
     void        DeleteRow( SCROW nStartRow, SCSIZE nSize );
-    void        DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag );
+    void DeleteArea(
+        SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag, bool bBroadcast = true );
     void CopyToClip(
         sc::CopyToClipContext& rCxt, SCROW nRow1, SCROW nRow2, ScColumn& rColumn ) const;
     void CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol);
@@ -408,7 +409,7 @@ public:
     void        RemoveProtected( SCROW nStartRow, SCROW nEndRow );
 
     SCsROW      ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray = NULL );
-    void        DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark );
+    void DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark, bool bBroadcast );
 
     void        ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
     void        ChangeSelectionIndent( bool bIncrement, const ScMarkData& rMark );
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 665fb35..1f8ced4 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1441,8 +1441,8 @@ public:
 
     SC_DLLPUBLIC void            ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark,
                                            ScEditDataArray* pDataArray = NULL );
-    void            DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark );
-    void            DeleteSelectionTab( SCTAB nTab, sal_uInt16 nDelFlag, const ScMarkData& rMark );
+    void DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark, bool bBroadcast = true );
+    void DeleteSelectionTab( SCTAB nTab, sal_uInt16 nDelFlag, const ScMarkData& rMark, bool bBroadcast = true );
 
     SC_DLLPUBLIC void           SetColWidth( SCCOL nCol, SCTAB nTab, sal_uInt16 nNewWidth );
     SC_DLLPUBLIC void           SetColWidthOnly( SCCOL nCol, SCTAB nTab, sal_uInt16 nNewWidth );
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 7877a1c..2e1cfd5 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -622,7 +622,7 @@ public:
     bool        RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags );
 
     void        ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray = NULL );
-    void        DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark );
+    void DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark, bool bBroadcast = true );
 
     void        ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
     void        ChangeSelectionIndent( bool bIncrement, const ScMarkData& rMark );
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 8c6102f..7771f0e 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -484,7 +484,7 @@ void ScColumn::ClearSelectionItems( const sal_uInt16* pWhich,const ScMarkData& r
 }
 
 
-void ScColumn::DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark )
+void ScColumn::DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark, bool bBroadcast )
 {
     SCROW nTop;
     SCROW nBottom;
@@ -493,7 +493,7 @@ void ScColumn::DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark )
     {
         ScMarkArrayIter aMarkIter( rMark.GetArray() + nCol );
         while (aMarkIter.Next( nTop, nBottom ))
-            DeleteArea(nTop, nBottom, nDelFlag);
+            DeleteArea(nTop, nBottom, nDelFlag, bBroadcast);
     }
 }
 
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 798d544..54b53f2 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -574,7 +574,8 @@ public:
 
 }
 
-void ScColumn::DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag)
+void ScColumn::DeleteArea(
+    SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag, bool bBroadcast )
 {
     sal_uInt16 nContMask = IDF_CONTENTS;
     // IDF_NOCAPTIONS needs to be passed too, if IDF_NOTE is set
@@ -626,9 +627,12 @@ void ScColumn::DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag)
     else if ((nDelFlag & IDF_HARDATTR) == IDF_HARDATTR)
         pAttrArray->DeleteHardAttr( nStartRow, nEndRow );
 
-    // Broadcast on only cells that were deleted; no point broadcasting on
-    // cells that were already empty before the deletion.
-    BroadcastCells(aDeletedRows, SC_HINT_DATACHANGED);
+    if (bBroadcast)
+    {
+        // Broadcast on only cells that were deleted; no point broadcasting on
+        // cells that were already empty before the deletion.
+        BroadcastCells(aDeletedRows, SC_HINT_DATACHANGED);
+    }
 }
 
 bool ScColumn::InitBlockPosition( sc::ColumnBlockPosition& rBlockPos )
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index c9f14cf..11b6507 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -5575,20 +5575,21 @@ void ScDocument::ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData
 }
 
 
-void ScDocument::DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark )
+void ScDocument::DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark, bool bBroadcast )
 {
     SCTAB nMax = static_cast<SCTAB>(maTabs.size());
     ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end();
     for (; itr != itrEnd && *itr < nMax; ++itr)
         if (maTabs[*itr])
-            maTabs[*itr]->DeleteSelection( nDelFlag, rMark );
+            maTabs[*itr]->DeleteSelection(nDelFlag, rMark, bBroadcast);
 }
 
 
-void ScDocument::DeleteSelectionTab( SCTAB nTab, sal_uInt16 nDelFlag, const ScMarkData& rMark )
+void ScDocument::DeleteSelectionTab(
+    SCTAB nTab, sal_uInt16 nDelFlag, const ScMarkData& rMark, bool bBroadcast )
 {
     if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
-        maTabs[nTab]->DeleteSelection( nDelFlag, rMark );
+        maTabs[nTab]->DeleteSelection(nDelFlag, rMark, bBroadcast);
     else
     {
         OSL_FAIL("wrong table");
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index f96d913b..ce4871a 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -453,12 +453,12 @@ void ScTable::DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal
 }
 
 
-void ScTable::DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark )
+void ScTable::DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark, bool bBroadcast )
 {
     {   // scope for bulk broadcast
         ScBulkBroadcast aBulkBroadcast( pDocument->GetBASM());
         for (SCCOL i=0; i<=MAXCOL; i++)
-            aCol[i].DeleteSelection( nDelFlag, rMark );
+            aCol[i].DeleteSelection(nDelFlag, rMark, bBroadcast);
     }
 
     ScRangeList aRangeList;
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index ffbda7a..5661fd7 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -950,7 +950,10 @@ void ScUndoPaste::DoChange(bool bUndo)
     pDocShell->UpdatePaintExt(nExtFlags, maBlockRanges.Combine());
 
     aMarkData.MarkToMulti();
-    pDoc->DeleteSelection( nUndoFlags, aMarkData );
+    pDoc->DeleteSelection(nUndoFlags, aMarkData, false); // no broadcasting here
+    for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i)
+        pDoc->BroadcastCells(*maBlockRanges[i], SC_HINT_DATACHANGED);
+
     aMarkData.MarkToSimple();
 
     SCTAB nFirstSelected = aMarkData.GetFirstSelected();


More information about the Libreoffice-commits mailing list