sc/inc/column.hxx | 2 - sc/inc/columnspanset.hxx | 1 sc/inc/document.hxx | 2 - sc/inc/table.hxx | 2 - sc/source/core/data/column2.cxx | 5 ++-- sc/source/core/data/columnspanset.cxx | 33 +------------------------------- sc/source/core/data/document.cxx | 6 ++--- sc/source/core/data/listenercontext.cxx | 14 +++++++++++-- sc/source/core/data/table1.cxx | 5 ++-- 9 files changed, 26 insertions(+), 44 deletions(-)
New commits: commit 7deddb5045887ec5b905bf8c2827657ad4ff9757 Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Mon May 20 13:17:28 2013 -0400 Ditto when purging broadcasters. Change-Id: I632d617cad76485f7e1f57daa7db4d4cfa775e8b diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 6db56d4..d1492eb 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -471,7 +471,7 @@ public: SvtBroadcaster* GetBroadcaster( SCROW nRow ); const SvtBroadcaster* GetBroadcaster( SCROW nRow ) const; - void DeleteBroadcasters( SCROW nRow1, SCROW nRow2 ); + void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2 ); private: void UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow ); diff --git a/sc/inc/columnspanset.hxx b/sc/inc/columnspanset.hxx index 35d94bf..ab24828 100644 --- a/sc/inc/columnspanset.hxx +++ b/sc/inc/columnspanset.hxx @@ -47,7 +47,6 @@ public: void set(SCTAB nTab, SCCOL nCol, SCROW nRow1, SCROW nRow2, bool bVal); void executeFromTop(Action& ac) const; - void executeFromBottom(Action& ac) const; }; } diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 544c9b5..ff525a6 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1970,7 +1970,7 @@ public: SvtBroadcaster* GetBroadcaster( const ScAddress& rPos ); const SvtBroadcaster* GetBroadcaster( const ScAddress& rPos ) const; - void DeleteBroadcasters( const ScAddress& rTopPos, SCROW nLength ); + void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, const ScAddress& rTopPos, SCROW nLength ); private: // CLOOK-Impl-methods diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 48fca53..6038311 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -850,7 +850,7 @@ public: SvtBroadcaster* GetBroadcaster( SCCOL nCol, SCROW nRow ); const SvtBroadcaster* GetBroadcaster( SCCOL nCol, SCROW nRow ) const; - void DeleteBroadcasters( SCCOL nCol, SCROW nRow1, SCROW nRow2 ); + void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SCROW nRow1, SCROW nRow2 ); /** Replace behaves differently to the Search; adjust the rCol and rRow accordingly. diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 324519a..43a0ee5 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1605,9 +1605,10 @@ const SvtBroadcaster* ScColumn::GetBroadcaster(SCROW nRow) const return maBroadcasters.get<SvtBroadcaster*>(nRow); } -void ScColumn::DeleteBroadcasters( SCROW nRow1, SCROW nRow2 ) +void ScColumn::DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2 ) { - maBroadcasters.set_empty(nRow1, nRow2); + rBlockPos.miBroadcasterPos = + maBroadcasters.set_empty(rBlockPos.miBroadcasterPos, nRow1, nRow2); } sal_uInt16 ScColumn::GetTextWidth(SCROW nRow) const diff --git a/sc/source/core/data/columnspanset.cxx b/sc/source/core/data/columnspanset.cxx index ea4f706..9b63dc7 100644 --- a/sc/source/core/data/columnspanset.cxx +++ b/sc/source/core/data/columnspanset.cxx @@ -85,43 +85,14 @@ void ColumnSpanSet::executeFromTop(Action& ac) const ColumnSpansType::const_iterator it = rCol.begin(), itEnd = rCol.end(); SCROW nRow1, nRow2; nRow1 = it->first; + bool bVal = it->second; for (++it; it != itEnd; ++it) { nRow2 = it->first-1; - bool bVal = it->second; ac.execute(ScAddress(nCol, nRow1, nTab), nRow2-nRow1+1, bVal); nRow1 = nRow2+1; // for the next iteration. - } - } - } -} - -void ColumnSpanSet::executeFromBottom(Action& ac) const -{ - for (size_t nTab = 0; nTab < maDoc.size(); ++nTab) - { - if (!maDoc[nTab]) - continue; - - const TableType& rTab = *maDoc[nTab]; - for (size_t nCol = 0; nCol < rTab.size(); ++nCol) - { - if (!rTab[nCol]) - continue; - - ac.startColumn(nTab, nCol); - ColumnSpansType& rCol = *rTab[nCol]; - ColumnSpansType::const_reverse_iterator it = rCol.rbegin(), itEnd = rCol.rend(); - SCROW nRow1, nRow2; - nRow2 = it->first-1; - for (++it; it != itEnd; ++it) - { - nRow1 = it->first; - bool bVal = it->second; - ac.execute(ScAddress(nCol, nRow1, nTab), nRow2-nRow1+1, bVal); - - nRow2 = nRow1-1; // for the next iteration. + bVal = it->second; } } } diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index d9145b0..4b63e7a 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2238,20 +2238,20 @@ SvtBroadcaster* ScDocument::GetBroadcaster( const ScAddress& rPos ) const SvtBroadcaster* ScDocument::GetBroadcaster( const ScAddress& rPos ) const { - ScTable* pTab = FetchTable(rPos.Tab()); + const ScTable* pTab = FetchTable(rPos.Tab()); if (!pTab) return NULL; return pTab->GetBroadcaster(rPos.Col(), rPos.Row()); } -void ScDocument::DeleteBroadcasters( const ScAddress& rTopPos, SCROW nLength ) +void ScDocument::DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, const ScAddress& rTopPos, SCROW nLength ) { ScTable* pTab = FetchTable(rTopPos.Tab()); if (!pTab || nLength <= 0) return; - pTab->DeleteBroadcasters(rTopPos.Col(), rTopPos.Row(), rTopPos.Row()+nLength-1); + pTab->DeleteBroadcasters(rBlockPos, rTopPos.Col(), rTopPos.Row(), rTopPos.Row()+nLength-1); } bool ScDocument::TableExists( SCTAB nTab ) const diff --git a/sc/source/core/data/listenercontext.cxx b/sc/source/core/data/listenercontext.cxx index f53f1bc..1f4c995 100644 --- a/sc/source/core/data/listenercontext.cxx +++ b/sc/source/core/data/listenercontext.cxx @@ -17,12 +17,22 @@ namespace { class PurgeAction : public ColumnSpanSet::Action { ScDocument& mrDoc; + sc::ColumnBlockPosition maBlockPos; + public: PurgeAction(ScDocument& rDoc) : mrDoc(rDoc) {} + + virtual void startColumn(SCTAB nTab, SCCOL nCol) + { + mrDoc.InitColumnBlockPosition(maBlockPos, nTab, nCol); + } + virtual void execute(const ScAddress& rPos, SCROW nLength, bool bVal) { if (bVal) - mrDoc.DeleteBroadcasters(rPos, nLength); + { + mrDoc.DeleteBroadcasters(maBlockPos, rPos, nLength); + } }; }; @@ -60,7 +70,7 @@ void EndListeningContext::addEmptyBroadcasterPosition(SCTAB nTab, SCCOL nCol, SC void EndListeningContext::purgeEmptyBroadcasters() { PurgeAction aAction(mrDoc); - maSet.executeFromBottom(aAction); + maSet.executeFromTop(aAction); } } diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index d1654a6..9c380c8 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -2177,12 +2177,13 @@ SvtBroadcaster* ScTable::GetBroadcaster( SCCOL nCol, SCROW nRow ) return aCol[nCol].GetBroadcaster(nRow); } -void ScTable::DeleteBroadcasters( SCCOL nCol, SCROW nRow1, SCROW nRow2 ) +void ScTable::DeleteBroadcasters( + sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SCROW nRow1, SCROW nRow2 ) { if (!ValidCol(nCol)) return; - aCol[nCol].DeleteBroadcasters(nRow1, nRow2); + aCol[nCol].DeleteBroadcasters(rBlockPos, nRow1, nRow2); } const SvtBroadcaster* ScTable::GetBroadcaster( SCCOL nCol, SCROW nRow ) const _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits