[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - 2 commits - mdds/0001-Remove-disambiguation-of-a-integer-type.patch mdds/UnpackedTarball_mdds.mk sc/inc sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Fri May 10 09:46:05 PDT 2013


 mdds/0001-Remove-disambiguation-of-a-integer-type.patch |   25 ++++++++
 mdds/UnpackedTarball_mdds.mk                            |    1 
 sc/inc/column.hxx                                       |    3 -
 sc/source/core/data/column3.cxx                         |   47 +++++++++++-----
 4 files changed, 63 insertions(+), 13 deletions(-)

New commits:
commit 61ea9b81239d9e712d3568a697399208b6ffd694
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri May 10 12:47:19 2013 -0400

    Broadcast only on deleted cells that were previously non-empty.
    
    Change-Id: I87e9cffcb50f879b699fe8df141281fdc6d2dbae

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index a76fd86..1fe28909 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -474,7 +474,8 @@ public:
     const SvtBroadcaster* GetBroadcaster( SCROW nRow ) const;
 
 private:
-    void DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDelFlag );
+    void DeleteRange(
+        SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDelFlag, std::vector<SCROW>& rDeletedRows );
 
     const ScFormulaCell* FetchFormulaCell( SCROW nRow ) const;
 
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 0b1571c..dc26882 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -61,6 +61,22 @@ extern const ScFormulaCell* pLastFormulaTreeTop; // in cellform.cxx
 using namespace formula;
 // STATIC DATA -----------------------------------------------------------
 
+namespace {
+
+void broadcastCells(ScDocument& rDoc, SCCOL nCol, SCROW nTab, const std::vector<SCROW>& rRows)
+{
+    // Broadcast the changes.
+    ScHint aHint(SC_HINT_DATACHANGED, ScAddress(nCol, 0, nTab));
+    std::vector<SCROW>::const_iterator itRow = rRows.begin(), itRowEnd = rRows.end();
+    for (; itRow != itRowEnd; ++itRow)
+    {
+        aHint.GetAddress().SetRow(*itRow);
+        rDoc.Broadcast(aHint);
+    }
+}
+
+}
+
 void ScColumn::Insert( SCROW nRow, ScBaseCell* pNewCell )
 {
     SetCell(nRow, pNewCell);
@@ -195,7 +211,10 @@ void ScColumn::DeleteRow( SCROW nStartRow, SCSIZE nSize )
 
     if (bFound)
     {
-        DeleteRange( nStartIndex, nEndIndex, IDF_CONTENTS );
+        std::vector<SCROW> aDeletedRows;
+        DeleteRange(nStartIndex, nEndIndex, IDF_CONTENTS, aDeletedRows);
+        broadcastCells(*pDocument, nCol, nTab, aDeletedRows);
+
         Search( nStartRow, i );
         if ( i >= maItems.size() )
         {
@@ -303,7 +322,8 @@ bool checkDeleteCellByFlag(
 
 }
 
-void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDelFlag )
+void ScColumn::DeleteRange(
+    SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDelFlag, std::vector<SCROW>& rDeletedRows )
 {
     /*  If caller specifies to not remove the note caption objects, all cells
         have to forget the pointers to them. This is used e.g. while undoing a
@@ -326,6 +346,8 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe
             // all content is to be deleted.
 
             ScBaseCell* pOldCell = maItems[ nIdx ].pCell;
+            rDeletedRows.push_back(maItems[nIdx].nRow);
+
             if (pOldCell->GetCellType() == CELLTYPE_FORMULA)
             {
                 // cache formula cell, will be deleted below
@@ -361,6 +383,8 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe
             }
             else
                 pOldCell->Delete();
+
+            rDeletedRows.push_back(maItems[nIdx].nRow);
         }
 
         if (!bDelete)
@@ -428,7 +452,6 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDe
     }
 }
 
-
 void ScColumn::DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag)
 {
     //  FreeAll must not be called here due to Broadcasters
@@ -440,10 +463,14 @@ void ScColumn::DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag)
         nContMask |= IDF_NOCAPTIONS;
     sal_uInt16 nContFlag = nDelFlag & nContMask;
 
+    std::vector<SCROW> aDeletedRows;
+
     if ( !maItems.empty() && nContFlag)
     {
         if (nStartRow==0 && nEndRow==MAXROW)
-            DeleteRange( 0, maItems.size()-1, nContFlag );
+        {
+            DeleteRange(0, maItems.size()-1, nContFlag, aDeletedRows);
+        }
         else
         {
             sal_Bool bFound=false;
@@ -460,7 +487,7 @@ void ScColumn::DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag)
                     nEndIndex = i;
                 }
             if (bFound)
-                DeleteRange( nStartIndex, nEndIndex, nContFlag );
+                DeleteRange(nStartIndex, nEndIndex, nContFlag, aDeletedRows);
         }
     }
 
@@ -476,13 +503,9 @@ void ScColumn::DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag)
     else if ((nDelFlag & IDF_ATTRIB) != 0)
         pAttrArray->DeleteHardAttr( nStartRow, nEndRow );
 
-    // Broadcast the changes.
-    ScHint aHint(SC_HINT_DATACHANGED, ScAddress(nCol, 0, nTab));
-    for (SCROW i = nStartRow; i <= nEndRow; ++i)
-    {
-        aHint.GetAddress().SetRow(i);
-        pDocument->Broadcast(aHint);
-    }
+    // Broadcast on only cells that were deleted; no point broadcasting on
+    // cells that were already empty before the deletion.
+    broadcastCells(*pDocument, nCol, nTab, aDeletedRows);
 }
 
 
commit bd9548fc6ebcb4d77a938ebf57efb37ebba9486d
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Thu May 9 14:57:16 2013 -0400

    Perhaps this will help the clang buildbot (?)
    
    Change-Id: Ib0b56e1c7d3b58de10a45ebc352f4f116cba58f9

diff --git a/mdds/0001-Remove-disambiguation-of-a-integer-type.patch b/mdds/0001-Remove-disambiguation-of-a-integer-type.patch
new file mode 100644
index 0000000..e23d057
--- /dev/null
+++ b/mdds/0001-Remove-disambiguation-of-a-integer-type.patch
@@ -0,0 +1,25 @@
+From 46cf3188790b821b359e13b14e2211898ab2139b Mon Sep 17 00:00:00 2001
+From: Kohei Yoshida <kohei.yoshida at gmail.com>
+Date: Thu, 9 May 2013 14:48:41 -0400
+Subject: [PATCH] Remove disambiguation of a integer type.
+
+---
+ include/mdds/multi_type_vector_def.inl | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/mdds/multi_type_vector_def.inl b/include/mdds/multi_type_vector_def.inl
+index 2299a7b..f443e08 100644
+--- a/include/mdds/multi_type_vector_def.inl
++++ misc/build/mdds_0.8.0/include/mdds/multi_type_vector_def.inl
+@@ -1479,7 +1479,7 @@ multi_type_vector<_CellBlockFunc>::transfer_single_block(
+ 
+         // Insert two new blocks below current.
+         size_type blk2_size = blk_dest->m_size - dest_pos_in_block - len;
+-        dest.m_blocks.insert(dest.m_blocks.begin()+dest_block_index+1, 2, NULL);
++        dest.m_blocks.insert(dest.m_blocks.begin()+dest_block_index+1, 2u, NULL);
+         dest.m_blocks[dest_block_index+1] = new block(len);
+         dest.m_blocks[dest_block_index+2] = new block(blk2_size);
+         blk_dest->m_size = dest_pos_in_block;
+-- 
+1.8.0
+
diff --git a/mdds/UnpackedTarball_mdds.mk b/mdds/UnpackedTarball_mdds.mk
index b33bc1b..11a6a23 100644
--- a/mdds/UnpackedTarball_mdds.mk
+++ b/mdds/UnpackedTarball_mdds.mk
@@ -17,6 +17,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,mdds,\
 	mdds/mdds_0.6.0.patch \
 	mdds/0001-Workaround-for-gcc-bug.patch \
 	mdds/mdds_0.7.0_unreachable_warning.patch.1 \
+	mdds/0001-Remove-disambiguation-of-a-integer-type.patch \
 ))
 
 # vim: set noet sw=4 ts=4:


More information about the Libreoffice-commits mailing list