summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-01-15 17:21:41 +0100
committerEike Rathke <erack@redhat.com>2015-01-15 17:27:27 +0100
commit98a940b60c666792127c58aee989a87820fb7294 (patch)
tree2071aee999bade2b0d0ac5fbb677f8ef1ff1304a /sc
parent4f747afae591f244164df25d96a83f417e6c0698 (diff)
fdo#88398 disable grouped listeners for now
Further implementation is needed to re-establish grouped listeners after unshare and split. Change-Id: I861b3f9d63a611ab0e32918ce1b272121bf12988
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/sharedformula.hxx5
-rw-r--r--sc/qa/unit/ucalc.cxx13
-rw-r--r--sc/qa/unit/ucalc_sharedformula.cxx10
-rw-r--r--sc/source/core/tool/sharedformula.cxx2
4 files changed, 28 insertions, 2 deletions
diff --git a/sc/inc/sharedformula.hxx b/sc/inc/sharedformula.hxx
index d94d8fe39e08..910140246d75 100644
--- a/sc/inc/sharedformula.hxx
+++ b/sc/inc/sharedformula.hxx
@@ -15,6 +15,11 @@
#include <vector>
+/* TODO: before this can be activated further implementation is needed to
+ * re-establish the area listeners in case of unshare/split/join that currently
+ * would get discarded. */
+#define USE_FORMULA_GROUP_LISTENER 0
+
namespace sc {
class StartListeningContext;
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index cb9dda996ede..fe01944f3d85 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -66,6 +66,7 @@
#include <editable.hxx>
#include <bcaslot.hxx>
+#include <sharedformula.hxx>
#include <formula/IFunctionDescription.hxx>
@@ -3992,6 +3993,8 @@ void Test::testCopyPasteRepeatOneFormula()
m_pDoc->SetString(aPos, "=SUM(A1:B1)");
CPPUNIT_ASSERT_EQUAL(11.0, m_pDoc->GetValue(aPos));
+ // This check makes only sense if group listeners are activated.
+#if !defined(USE_FORMULA_GROUP_LISTENER) || USE_FORMULA_GROUP_LISTENER
// At this point, there should be only one normal area listener listening
// on A1:B1.
ScRange aWholeSheet(0,0,0,MAXCOL,MAXROW,0);
@@ -4002,6 +4005,7 @@ void Test::testCopyPasteRepeatOneFormula()
const sc::AreaListener* pListener = &aListeners[0];
CPPUNIT_ASSERT_EQUAL(ScRange(0,0,0,1,0,0), pListener->maArea);
CPPUNIT_ASSERT_MESSAGE("This listener shouldn't be a group listener.", !pListener->mbGroupListening);
+#endif
// Copy C1 to clipboard.
ScClipParam aClipParam(aPos, false);
@@ -4026,6 +4030,8 @@ void Test::testCopyPasteRepeatOneFormula()
CPPUNIT_ASSERT_EQUAL(fExpected, m_pDoc->GetValue(ScAddress(2,i,0)));
}
+ // This check makes only sense if group listeners are activated.
+#if !defined(USE_FORMULA_GROUP_LISTENER) || USE_FORMULA_GROUP_LISTENER
// At this point, there should only be one area listener and it should be
// a group listener listening on A1:B10.
aListeners = pBASM->GetAllListeners(aWholeSheet, sc::AreaInside);
@@ -4033,6 +4039,7 @@ void Test::testCopyPasteRepeatOneFormula()
pListener = &aListeners[0];
CPPUNIT_ASSERT_EQUAL(ScRange(0,0,0,1,9,0), pListener->maArea);
CPPUNIT_ASSERT_MESSAGE("This listener should be a group listener.", pListener->mbGroupListening);
+#endif
// Insert a new row at row 1.
ScRange aRowOne(0,0,0,MAXCOL,0,0);
@@ -4042,12 +4049,15 @@ void Test::testCopyPasteRepeatOneFormula()
CPPUNIT_ASSERT_MESSAGE("C1 should be empty.", m_pDoc->GetCellType(ScAddress(2,0,0)) == CELLTYPE_NONE);
+ // This check makes only sense if group listeners are activated.
+#if !defined(USE_FORMULA_GROUP_LISTENER) || USE_FORMULA_GROUP_LISTENER
// Make there we only have one group area listener listening on A2:B11.
aListeners = pBASM->GetAllListeners(aWholeSheet, sc::AreaInside);
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aListeners.size());
pListener = &aListeners[0];
CPPUNIT_ASSERT_EQUAL(ScRange(0,1,0,1,10,0), pListener->maArea);
CPPUNIT_ASSERT_MESSAGE("This listener should be a group listener.", pListener->mbGroupListening);
+#endif
// Check the formula results.
for (SCROW i = 0; i < 10; ++i)
@@ -4066,12 +4076,15 @@ void Test::testCopyPasteRepeatOneFormula()
CPPUNIT_ASSERT_EQUAL(fExpected, m_pDoc->GetValue(ScAddress(2,i,0)));
}
+ // This check makes only sense if group listeners are activated.
+#if !defined(USE_FORMULA_GROUP_LISTENER) || USE_FORMULA_GROUP_LISTENER
// Check the group area listener again to make sure it's listening on A1:B10 once again.
aListeners = pBASM->GetAllListeners(aWholeSheet, sc::AreaInside);
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aListeners.size());
pListener = &aListeners[0];
CPPUNIT_ASSERT_EQUAL(ScRange(0,0,0,1,9,0), pListener->maArea);
CPPUNIT_ASSERT_MESSAGE("This listener should be a group listener.", pListener->mbGroupListening);
+#endif
m_pDoc->DeleteTab(0);
}
diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx
index aa1d778bf354..36fb824c98bf 100644
--- a/sc/qa/unit/ucalc_sharedformula.cxx
+++ b/sc/qa/unit/ucalc_sharedformula.cxx
@@ -22,6 +22,7 @@
#include <globalnames.hxx>
#include <dbdata.hxx>
#include <bcaslot.hxx>
+#include <sharedformula.hxx>
#include <svl/sharedstring.hxx>
@@ -631,6 +632,8 @@ void Test::testSharedFormulasRefUpdateRangeDeleteRow()
std::vector<sc::AreaListener> aListeners = pBASM->GetAllListeners(aWholeArea, sc::AreaInside);
std::sort(aListeners.begin(), aListeners.end(), sc::AreaListener::SortByArea());
+ // This check makes only sense if group listeners are activated.
+#if !defined(USE_FORMULA_GROUP_LISTENER) || USE_FORMULA_GROUP_LISTENER
CPPUNIT_ASSERT_MESSAGE("There should only be 2 area listeners.", aListeners.size() == 2);
// First one should be group-listening on A1:B2.
CPPUNIT_ASSERT_MESSAGE("This listener should be listening on A1:B2.", aListeners[0].maArea == ScRange(0,0,0,1,1,0));
@@ -638,6 +641,7 @@ void Test::testSharedFormulasRefUpdateRangeDeleteRow()
// Second one should be group-listening on A4:B5.
CPPUNIT_ASSERT_MESSAGE("This listener should be listening on A1:B2.", aListeners[0].maArea == ScRange(0,0,0,1,1,0));
CPPUNIT_ASSERT_MESSAGE("This listener should be group-listening.", aListeners[0].mbGroupListening);
+#endif
// Make sure that C1:C2 and C4:C5 are formula groups.
const ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(2,0,0));
@@ -662,11 +666,14 @@ void Test::testSharedFormulasRefUpdateRangeDeleteRow()
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(0), pFC->GetSharedTopRow());
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(4), pFC->GetSharedLength());
+ // This check makes only sense if group listeners are activated.
+#if !defined(USE_FORMULA_GROUP_LISTENER) || USE_FORMULA_GROUP_LISTENER
// We should only have one listener group-listening on A1:B4.
aListeners = pBASM->GetAllListeners(aWholeArea, sc::AreaInside);
CPPUNIT_ASSERT_MESSAGE("There should only be 1 area listener.", aListeners.size() == 1);
CPPUNIT_ASSERT_MESSAGE("This listener should be listening on A1:B4.", aListeners[0].maArea == ScRange(0,0,0,1,3,0));
CPPUNIT_ASSERT_MESSAGE("This listener should be group-listening.", aListeners[0].mbGroupListening);
+#endif
// Change the value of B4 and make sure the value of C4 changes.
rFunc.SetValueCell(ScAddress(1,3,0), 100.0, false);
@@ -691,6 +698,8 @@ void Test::testSharedFormulasRefUpdateRangeDeleteRow()
aListeners = pBASM->GetAllListeners(aWholeArea, sc::AreaInside);
std::sort(aListeners.begin(), aListeners.end(), sc::AreaListener::SortByArea());
+ // This check makes only sense if group listeners are activated.
+#if !defined(USE_FORMULA_GROUP_LISTENER) || USE_FORMULA_GROUP_LISTENER
CPPUNIT_ASSERT_MESSAGE("There should only be 2 area listeners.", aListeners.size() == 2);
// First one should be group-listening on A1:B2.
CPPUNIT_ASSERT_MESSAGE("This listener should be listening on A1:B2.", aListeners[0].maArea == ScRange(0,0,0,1,1,0));
@@ -698,6 +707,7 @@ void Test::testSharedFormulasRefUpdateRangeDeleteRow()
// Second one should be group-listening on A4:B5.
CPPUNIT_ASSERT_MESSAGE("This listener should be listening on A1:B2.", aListeners[0].maArea == ScRange(0,0,0,1,1,0));
CPPUNIT_ASSERT_MESSAGE("This listener should be group-listening.", aListeners[0].mbGroupListening);
+#endif
m_pDoc->DeleteTab(0);
}
diff --git a/sc/source/core/tool/sharedformula.cxx b/sc/source/core/tool/sharedformula.cxx
index b1cd80d1fe7c..844e0a7678cd 100644
--- a/sc/source/core/tool/sharedformula.cxx
+++ b/sc/source/core/tool/sharedformula.cxx
@@ -14,8 +14,6 @@
#include <document.hxx>
#include <grouparealistener.hxx>
-#define USE_FORMULA_GROUP_LISTENER 1
-
namespace sc {
void SharedFormulaUtil::splitFormulaCellGroup(const CellStoreType::position_type& aPos)