Kaydet (Commit) 98a940b6 authored tarafından Eike Rathke's avatar Eike Rathke

fdo#88398 disable grouped listeners for now

Further implementation is needed to re-establish grouped listeners after
unshare and split.

Change-Id: I861b3f9d63a611ab0e32918ce1b272121bf12988
üst 4f747afa
......@@ -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;
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment