From e8184b4bda4f8ce0bfa676d592e1f493ca9e3eeb Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Fri, 14 Nov 2014 17:47:42 -0500 Subject: We don't need 2 variants of this method. One is enough. Change-Id: I001c388669737e9cf1d92f1fbb1e64fb9f4b05c3 --- sc/inc/grouparealistener.hxx | 10 ---- sc/source/core/tool/grouparealistener.cxx | 91 +------------------------------ 2 files changed, 1 insertion(+), 100 deletions(-) diff --git a/sc/inc/grouparealistener.hxx b/sc/inc/grouparealistener.hxx index 6301023d8093..28e8f4320ad4 100644 --- a/sc/inc/grouparealistener.hxx +++ b/sc/inc/grouparealistener.hxx @@ -38,16 +38,6 @@ public: virtual void Notify( const SfxHint& rHint ) SAL_OVERRIDE; - /** - * Given the position of a changed cell, collect all formula cells that - * need to be notified of the change. - * - * @param rPos position of changed cell. - * @param rCells all formula cells that need to be notified are put into - * this container. - */ - void collectFormulaCells( const ScAddress& rPos, std::vector& rCells ) const; - /** * Given the row span of changed cells within a single column, collect all * formula cells that need to be notified of the change. diff --git a/sc/source/core/tool/grouparealistener.cxx b/sc/source/core/tool/grouparealistener.cxx index e682d613d0ec..7a834614b5e7 100644 --- a/sc/source/core/tool/grouparealistener.cxx +++ b/sc/source/core/tool/grouparealistener.cxx @@ -125,95 +125,6 @@ void FormulaGroupAreaListener::notifyBulkChange( const BulkDataHint& rHint ) std::for_each(aCells.begin(), aCells.end(), Notifier(aHint)); } -void FormulaGroupAreaListener::collectFormulaCells( const ScAddress& rPos, std::vector& rCells ) const -{ - if (rPos.Tab() < maRange.aStart.Tab() || maRange.aEnd.Tab() < rPos.Tab()) - // Wrong sheet. - return; - - if (rPos.Col() < maRange.aStart.Col() || maRange.aEnd.Col() < rPos.Col()) - // Outside the column range. - return; - - ScFormulaCell** pp = mppTopCell; - ScFormulaCell** ppEnd = pp + mnGroupLen; - - if (mbStartFixed) - { - if (mbEndFixed) - { - // Both top and bottom row positions are absolute. Use the original range as-is. - SCROW nRow1 = maRange.aStart.Row(); - SCROW nRow2 = maRange.aEnd.Row(); - if (rPos.Row() < nRow1 || nRow2 < rPos.Row()) - return; - - for (; pp != ppEnd; ++pp) - rCells.push_back(*pp); - } - else - { - // Only the end row is relative. - SCROW nRow1 = maRange.aStart.Row(); - SCROW nRow2 = maRange.aEnd.Row(); - SCROW nMaxRow = nRow2 + mnGroupLen - 1; - if (rPos.Row() < nRow1 || nMaxRow < rPos.Row()) - return; - - if (nRow2 < rPos.Row()) - { - // Skip ahead to the first hit. - SCROW nSkip = rPos.Row() - nRow2; - pp += nSkip; - nRow2 += nSkip; - } - - // Notify the first hit cell and all subsequent ones. - for (; pp != ppEnd; ++pp) - rCells.push_back(*pp); - } - } - else if (mbEndFixed) - { - // Only the start row is relative. - SCROW nRow1 = maRange.aStart.Row(); - SCROW nRow2 = maRange.aEnd.Row(); - - if (rPos.Row() < nRow1 || nRow2 < rPos.Row()) - return; - - for (; pp != ppEnd && nRow1 <= nRow2; ++pp, ++nRow1) - rCells.push_back(*pp); - } - else - { - // Both top and bottom row positions are relative. - SCROW nRow1 = maRange.aStart.Row(); - SCROW nRow2 = maRange.aEnd.Row(); - SCROW nMaxRow = nRow2 + mnGroupLen - 1; - if (nMaxRow < rPos.Row()) - return; - - if (nRow2 < rPos.Row()) - { - // Skip ahead. - SCROW nSkip = rPos.Row() - nRow2; - pp += nSkip; - nRow1 += nSkip; - nRow2 += nSkip; - } - - for (; pp != ppEnd; ++pp, ++nRow1, ++nRow2) - { - if (rPos.Row() < nRow1 || nRow2 < rPos.Row()) - // Changed cell is outside the range. - continue; - - rCells.push_back(*pp); - } - } -} - void FormulaGroupAreaListener::collectFormulaCells( SCTAB nTab, SCCOL nCol, SCROW nRow1, SCROW nRow2, std::vector& rCells ) const { @@ -312,7 +223,7 @@ void FormulaGroupAreaListener::notifyCellChange( const SfxHint& rHint, const ScA { // Determine which formula cells within the group need to be notified of this change. std::vector aCells; - collectFormulaCells(rPos, aCells); + collectFormulaCells(rPos.Tab(), rPos.Col(), rPos.Row(), rPos.Row(), aCells); std::for_each(aCells.begin(), aCells.end(), Notifier(rHint)); } -- cgit