summaryrefslogtreecommitdiff
path: root/sc/source/core/tool/grouparealistener.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/tool/grouparealistener.cxx')
-rw-r--r--sc/source/core/tool/grouparealistener.cxx44
1 files changed, 32 insertions, 12 deletions
diff --git a/sc/source/core/tool/grouparealistener.cxx b/sc/source/core/tool/grouparealistener.cxx
index 7f4dad673bb2..656c931445eb 100644
--- a/sc/source/core/tool/grouparealistener.cxx
+++ b/sc/source/core/tool/grouparealistener.cxx
@@ -15,6 +15,8 @@
#include <column.hxx>
#include <listenerquery.hxx>
#include <listenerqueryids.hxx>
+#include <document.hxx>
+#include <table.hxx>
namespace sc {
@@ -69,25 +71,31 @@ public:
}
-FormulaGroupAreaListener::FormulaGroupAreaListener(
- const ScRange& rRange, ScFormulaCell** ppTopCell, SCROW nGroupLen, bool bStartFixed, bool bEndFixed ) :
+FormulaGroupAreaListener::FormulaGroupAreaListener( const ScRange& rRange, const ScDocument& rDocument,
+ const ScAddress& rTopCellPos, SCROW nGroupLen, bool bStartFixed, bool bEndFixed ) :
maRange(rRange),
- mppTopCell(ppTopCell),
+ mpColumn(NULL),
+ mnTopCellRow(rTopCellPos.Row()),
mnGroupLen(nGroupLen),
mbStartFixed(bStartFixed),
mbEndFixed(bEndFixed)
{
- assert(mppTopCell); // This can't be NULL.
+ const ScTable* pTab = rDocument.FetchTable( rTopCellPos.Tab());
+ assert(pTab);
+ mpColumn = pTab->FetchColumn( rTopCellPos.Col());
+ assert(mpColumn);
SAL_INFO( "sc.core.grouparealistener",
"FormulaGroupAreaListener ctor this " << this <<
- " range " << maRange.Format(SCA_VALID) << " *mppTopCell " << *mppTopCell << " length " << mnGroupLen);
+ " range " << maRange.Format(SCA_VALID) <<
+ " mnTopCellRow " << mnTopCellRow << " length " << mnGroupLen);
}
FormulaGroupAreaListener::~FormulaGroupAreaListener()
{
SAL_INFO( "sc.core.grouparealistener",
"FormulaGroupAreaListener dtor this " << this <<
- " range " << maRange.Format(SCA_VALID) << " *mppTopCell " << *mppTopCell << " length " << mnGroupLen);
+ " range " << maRange.Format(SCA_VALID) <<
+ " mnTopCellRow " << mnTopCellRow << " length " << mnGroupLen);
}
ScRange FormulaGroupAreaListener::getListeningRange() const
@@ -126,7 +134,7 @@ void FormulaGroupAreaListener::Query( QueryBase& rQuery ) const
{
case SC_LISTENER_QUERY_FORMULA_GROUP_RANGE:
{
- ScFormulaCell* pTop = *mppTopCell;
+ const ScFormulaCell* pTop = getTopCell();
ScRange aRange(pTop->aPos);
aRange.aEnd.IncRow(mnGroupLen-1);
QueryRange& rQR = static_cast<QueryRange&>(rQuery);
@@ -176,10 +184,15 @@ void FormulaGroupAreaListener::collectFormulaCells(
{
SAL_INFO( "sc.core.grouparealistener",
"FormulaGroupAreaListener::collectFormulaCells() this " << this <<
- " range " << maRange.Format(SCA_VALID) << " *mppTopCell " << *mppTopCell << " length " << mnGroupLen);
+ " range " << maRange.Format(SCA_VALID) <<
+ " mnTopCellRow " << mnTopCellRow << " length " << mnGroupLen);
- ScFormulaCell** pp = mppTopCell;
- ScFormulaCell** ppEnd = pp + mnGroupLen;
+ ScFormulaCell* const * pp = mpColumn->GetFormulaCellBlockAddress( mnTopCellRow);
+ assert(pp);
+ if (!pp)
+ return;
+
+ ScFormulaCell* const * ppEnd = pp + mnGroupLen;
if (mbStartFixed)
{
@@ -261,8 +274,15 @@ void FormulaGroupAreaListener::collectFormulaCells(
ScAddress FormulaGroupAreaListener::getTopCellPos() const
{
- const ScFormulaCell& rFC = **mppTopCell;
- return rFC.aPos;
+ const ScFormulaCell* p = getTopCell();
+ return p ? p->aPos : ScAddress();
+}
+
+const ScFormulaCell* FormulaGroupAreaListener::getTopCell() const
+{
+ const ScFormulaCell* const * pp = mpColumn->GetFormulaCellBlockAddress( mnTopCellRow);
+ assert(pp);
+ return pp ? *pp : NULL;
}
const ScRange& FormulaGroupAreaListener::getRange() const