[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Mon May 20 09:24:20 PDT 2013
sc/inc/listenercontext.hxx | 3 +++
sc/source/core/data/column2.cxx | 13 +++++++++++--
sc/source/core/data/listenercontext.cxx | 7 ++++++-
3 files changed, 20 insertions(+), 3 deletions(-)
New commits:
commit 822f0ad64aaff65737bf10189642538f2dd81225
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon May 20 12:25:19 2013 -0400
Do the same trick when getting broadcasters during mass formula cell deletion.
Change-Id: Iee1b3ff637d10c6bd2d2342db518a2fc986327b7
diff --git a/sc/inc/listenercontext.hxx b/sc/inc/listenercontext.hxx
index 2503e72..f4fbb0f 100644
--- a/sc/inc/listenercontext.hxx
+++ b/sc/inc/listenercontext.hxx
@@ -35,10 +35,13 @@ class EndListeningContext : boost::noncopyable
{
ScDocument& mrDoc;
ColumnSpanSet maSet;
+ ColumnBlockPositionSet maPosSet;
public:
EndListeningContext(ScDocument& rDoc);
ScDocument& getDoc();
+ ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol);
+
void addEmptyBroadcasterPosition(SCTAB nTab, SCCOL nCol, SCROW nRow);
void purgeEmptyBroadcasters();
};
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index eeb5519..324519a 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -2107,10 +2107,19 @@ void ScColumn::StartListening( sc::StartListeningContext& rCxt, SCROW nRow, SvtL
void ScColumn::EndListening( sc::EndListeningContext& rCxt, SCROW nRow, SvtListener& rListener )
{
- SvtBroadcaster* pBC = GetBroadcaster(nRow);
- if (!pBC)
+ sc::ColumnBlockPosition* p = rCxt.getBlockPosition(nTab, nCol);
+ if (!p)
+ return;
+
+ sc::BroadcasterStoreType::iterator& it = p->miBroadcasterPos;
+ std::pair<sc::BroadcasterStoreType::iterator,size_t> aPos = maBroadcasters.position(it, nRow);
+ it = aPos.first; // store the block position for next iteration.
+ if (it->type != sc::element_type_broadcaster)
return;
+ SvtBroadcaster* pBC = sc::custom_broadcaster_block::at(*it->data, aPos.second);
+ OSL_ASSERT(pBC);
+
rListener.EndListening(*pBC);
if (!pBC->HasListeners())
// There is no more listeners for this cell. Add it to the purge list for later purging.
diff --git a/sc/source/core/data/listenercontext.cxx b/sc/source/core/data/listenercontext.cxx
index 7ab3799..f53f1bc 100644
--- a/sc/source/core/data/listenercontext.cxx
+++ b/sc/source/core/data/listenercontext.cxx
@@ -40,13 +40,18 @@ ColumnBlockPosition* StartListeningContext::getBlockPosition(SCTAB nTab, SCCOL n
return maSet.getBlockPosition(nTab, nCol);
}
-EndListeningContext::EndListeningContext(ScDocument& rDoc) : mrDoc(rDoc) {}
+EndListeningContext::EndListeningContext(ScDocument& rDoc) : mrDoc(rDoc), maPosSet(rDoc) {}
ScDocument& EndListeningContext::getDoc()
{
return mrDoc;
}
+ColumnBlockPosition* EndListeningContext::getBlockPosition(SCTAB nTab, SCCOL nCol)
+{
+ return maPosSet.getBlockPosition(nTab, nCol);
+}
+
void EndListeningContext::addEmptyBroadcasterPosition(SCTAB nTab, SCCOL nCol, SCROW nRow)
{
maSet.set(nTab, nCol, nRow, true);
More information about the Libreoffice-commits
mailing list