[Libreoffice-commits] core.git: 2 commits - sc/inc sc/qa sc/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Sat Jan 10 04:47:57 PST 2015


 sc/inc/column.hxx                 |    1 +
 sc/qa/unit/ucalc.cxx              |   17 +++++++++++++++++
 sc/qa/unit/ucalc.hxx              |    2 ++
 sc/source/core/data/cellvalue.cxx |    4 ++--
 sc/source/core/data/column3.cxx   |   13 ++++++++++++-
 5 files changed, 34 insertions(+), 3 deletions(-)

New commits:
commit 29a5692bcf22f27a87959b87065e6c65b59ae886
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat Jan 10 13:38:01 2015 +0100

    add test for fdo#88200
    
    Change-Id: Icb6d782a4a3aa91e05c6466edb3d84c5dfc08f08

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 093ec53..e5cb050 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -6241,6 +6241,23 @@ void Test::testMixData()
     m_pDoc->DeleteTab(0);
 }
 
+void Test::testSetStringAndNote()
+{
+    m_pDoc->InsertTab(0, "Test");
+
+    //note on A1
+    ScAddress aAdrA1 (0, 0, 0);
+    ScPostIt* pNote = m_pDoc->GetOrCreateNote(aAdrA1);
+    pNote->SetText(aAdrA1, "Hello world in A1");
+
+    m_pDoc->SetString(0, 0, 0, "");
+
+    pNote = m_pDoc->GetNote(aAdrA1);
+    CPPUNIT_ASSERT(pNote);
+
+    m_pDoc->DeleteTab(0);
+}
+
 ScDocShell* Test::findLoadedDocShellByName(const OUString& rName)
 {
     TypeId aType(TYPE(ScDocShell));
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 013ac26..6f6af6b 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -420,6 +420,7 @@ public:
     void testFormulaToValue2();
 
     void testColumnFindEditCells();
+    void testSetStringAndNote();
 
     CPPUNIT_TEST_SUITE(Test);
 #if CALC_TEST_PERF
@@ -621,6 +622,7 @@ public:
     CPPUNIT_TEST(testFormulaToValue);
     CPPUNIT_TEST(testFormulaToValue2);
     CPPUNIT_TEST(testColumnFindEditCells);
+    CPPUNIT_TEST(testSetStringAndNote);
     CPPUNIT_TEST_SUITE_END();
 
 private:
commit 8449e43255c0929af9c9a205e60db2bb0f4fbde8
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat Jan 10 13:16:20 2015 +0100

    only delete cell content for CELLTYPE_NONE, fdo#88200
    
    Change-Id: I43463b56cabfea4c9ee2b98445f7fb522221197d

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 7eaf60c..f36f7fc 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -199,6 +199,7 @@ public:
     const sc::CellTextAttr* GetCellTextAttr( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow ) const;
 
     void        Delete( SCROW nRow );
+    void        DeleteContent( SCROW nRow, bool bBroadcast = true );
     void        FreeAll();
     void        FreeNotes();
     void Swap( ScColumn& rOther, SCROW nRow1, SCROW nRow2, bool bPattern );
diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx
index 8a69d12..8732926 100644
--- a/sc/source/core/data/cellvalue.cxx
+++ b/sc/source/core/data/cellvalue.cxx
@@ -123,7 +123,7 @@ static void commitToColumn( const ScCellValue& rCell, ScColumn& rColumn, SCROW n
         }
         break;
         default:
-            rColumn.Delete(nRow);
+            rColumn.DeleteContent(nRow);
     }
 }
 
@@ -463,7 +463,7 @@ void ScCellValue::release( ScColumn& rColumn, SCROW nRow, sc::StartListeningType
             rColumn.SetFormulaCell(nRow, mpFormula, eListenType);
         break;
         default:
-            rColumn.Delete(nRow);
+            rColumn.DeleteContent(nRow);
     }
 
     meType = CELLTYPE_NONE;
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 44e3585..8173e67 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -108,7 +108,7 @@ void ScColumn::InterpretDirtyCells( SCROW nRow1, SCROW nRow2 )
     sc::ProcessFormula(maCells.begin(), maCells, nRow1, nRow2, aFunc);
 }
 
-void ScColumn::Delete( SCROW nRow )
+void ScColumn::DeleteContent( SCROW nRow, bool bBroadcast )
 {
     sc::CellStoreType::position_type aPos = maCells.position(nRow);
     sc::CellStoreType::iterator it = aPos.first;
@@ -122,6 +122,17 @@ void ScColumn::Delete( SCROW nRow )
         sc::SharedFormulaUtil::unshareFormulaCell(aPos, *p);
     }
     maCells.set_empty(nRow, nRow);
+
+    if (bBroadcast)
+    {
+        Broadcast(nRow);
+        CellStorageModified();
+    }
+}
+
+void ScColumn::Delete( SCROW nRow )
+{
+    DeleteContent(nRow, false);
     maCellTextAttrs.set_empty(nRow, nRow);
     maCellNotes.set_empty(nRow, nRow);
 


More information about the Libreoffice-commits mailing list