diff options
author | Eike Rathke <erack@redhat.com> | 2019-03-22 22:32:34 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2019-03-22 23:37:35 +0100 |
commit | cd72a2dd6c65284a9a5cedff48766c94f9fffb94 (patch) | |
tree | 6b0da02738073bf93d25bd8e026b5c701be470a0 /sc | |
parent | 6280b5c1c62ad40b5b9780a93c7cbee9ca0260f8 (diff) |
Remove listening in ScDocument::SetString() and ScDocument::SetValue()
They now unnecessarily duplicated the start listening with the
changes that introduced ScColumn::StartListeningUnshared().
Also the ScColumn::BroadcastNewCell() now is sufficient as it is
called after StartListeningUnshared().
Change-Id: I0495ce5fe47daa068974c7b70ec28e0530c080f1
Reviewed-on: https://gerrit.libreoffice.org/69570
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/document.cxx | 54 |
1 files changed, 15 insertions, 39 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index cf236daeda2e..d40103096d8b 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3376,36 +3376,22 @@ bool ScDocument::SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString& if (!pTab) return false; - bool bNumFmtSet = false; - const ScFormulaCell* pCurCellFormula = pTab->GetFormulaCell(nCol, nRow); if (pCurCellFormula && pCurCellFormula->IsShared()) { - // In case setting this string affects an existing formula group, record - // its above and below position for later listening. + // In case setting this string affects an existing formula group, end + // its listening to purge then empty cell broadcasters. Affected + // remaining split group listeners will be set up again via + // ScColumn::DetachFormulaCell() and + // ScColumn::StartListeningUnshared(). - std::vector<ScAddress> aGroupPos; sc::EndListeningContext aCxt(*this); ScAddress aPos(nCol, nRow, nTab); - EndListeningIntersectedGroup(aCxt, aPos, &aGroupPos); + EndListeningIntersectedGroup(aCxt, aPos, nullptr); aCxt.purgeEmptyBroadcasters(); - - bNumFmtSet = pTab->SetString(nCol, nRow, nTab, rString, pParam); - - SetNeedsListeningGroups(aGroupPos); - StartNeededListeners(); - - // Listeners may just have been setup that are affected by the current - // position thus were not notified by a ScColumn::BroadcastNewCell() - // during ScTable::SetString(), so do it here. - Broadcast( ScHint( SfxHintId::ScDataChanged, aPos)); - } - else - { - bNumFmtSet = pTab->SetString(nCol, nRow, nTab, rString, pParam); } - return bNumFmtSet; + return pTab->SetString(nCol, nRow, nTab, rString, pParam); } bool ScDocument::SetString( @@ -3492,28 +3478,18 @@ void ScDocument::SetValue( const ScAddress& rPos, double fVal ) const ScFormulaCell* pCurCellFormula = pTab->GetFormulaCell(rPos.Col(), rPos.Row()); if (pCurCellFormula && pCurCellFormula->IsShared()) { - // In case setting this string affects an existing formula group, record - // its above and below position for later listening. + // In case setting this value affects an existing formula group, end + // its listening to purge then empty cell broadcasters. Affected + // remaining split group listeners will be set up again via + // ScColumn::DetachFormulaCell() and + // ScColumn::StartListeningUnshared(). - std::vector<ScAddress> aGroupPos; sc::EndListeningContext aCxt(*this); - EndListeningIntersectedGroup(aCxt, rPos, &aGroupPos); + EndListeningIntersectedGroup(aCxt, rPos, nullptr); aCxt.purgeEmptyBroadcasters(); - - pTab->SetValue(rPos.Col(), rPos.Row(), fVal); - - SetNeedsListeningGroups(aGroupPos); - StartNeededListeners(); - - // Listeners may just have been setup that are affected by the current - // position thus were not notified by a ScColumn::BroadcastNewCell() - // during ScTable::SetValue(), so do it here. - Broadcast( ScHint( SfxHintId::ScDataChanged, rPos)); - } - else - { - pTab->SetValue(rPos.Col(), rPos.Row(), fVal); } + + pTab->SetValue(rPos.Col(), rPos.Row(), fVal); } OUString ScDocument::GetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext* pContext ) const |