sc/source/core/data/document.cxx | 56 +++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 19 deletions(-)
New commits: commit 7042961f4d3e383c04f792a60e96d909b7e44363 Author: Laurent Godard <lgodard.li...@laposte.net> Date: Fri Mar 20 12:02:31 2015 +0100 tdf#90042 only handle formula group if useful Reviewed-on: https://gerrit.libreoffice.org/14920 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Eike Rathke <er...@redhat.com> (cherry picked from commit c79bdd062f657d1be98aa815d9b882d144f35e04) only handle formula group if useful, tdf#90042 related Same as in ScDocument::SetString() as changed with c79bdd062f657d1be98aa815d9b882d144f35e04, do it similar in ScDocument::SetValue() (cherry picked from commit 02bea75dd6bc91759e987fafb5dccec6ce92b0c2) 7c666b176062c81a8a74cb49f345408c1060d973 Change-Id: I497a5bae4b08b46357415501ddbafc70585adfb0 Reviewed-on: https://gerrit.libreoffice.org/15036 Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrh...@googlemail.com> diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index b9307c1..ff5ffe7 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3204,19 +3204,29 @@ bool ScDocument::SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString& if (!pTab) return false; - // In case setting this string affects an existing formula group, record - // its above and below position for later listening. + bool bNumFmtSet = false; - std::vector<ScAddress> aGroupPos; - sc::EndListeningContext aCxt(*this); - ScAddress aPos(nCol, nRow, nTab); - EndListeningIntersectedGroup(aCxt, aPos, &aGroupPos); - aCxt.purgeEmptyBroadcasters(); + 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. - bool bNumFmtSet = pTab->SetString(nCol, nRow, nTab, rString, pParam); + std::vector<ScAddress> aGroupPos; + sc::EndListeningContext aCxt(*this); + ScAddress aPos(nCol, nRow, nTab); + EndListeningIntersectedGroup(aCxt, aPos, &aGroupPos); + aCxt.purgeEmptyBroadcasters(); - SetNeedsListeningGroups(aGroupPos); - StartNeededListeners(); + bNumFmtSet = pTab->SetString(nCol, nRow, nTab, rString, pParam); + + SetNeedsListeningGroups(aGroupPos); + StartNeededListeners(); + } + else + { + bNumFmtSet = pTab->SetString(nCol, nRow, nTab, rString, pParam); + } return bNumFmtSet; } @@ -3303,18 +3313,26 @@ void ScDocument::SetValue( const ScAddress& rPos, double fVal ) if (!pTab) return; - // In case setting this string affects an existing formula group, record - // its above and below position for later listening. + 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. - std::vector<ScAddress> aGroupPos; - sc::EndListeningContext aCxt(*this); - EndListeningIntersectedGroup(aCxt, rPos, &aGroupPos); - aCxt.purgeEmptyBroadcasters(); + std::vector<ScAddress> aGroupPos; + sc::EndListeningContext aCxt(*this); + EndListeningIntersectedGroup(aCxt, rPos, &aGroupPos); + aCxt.purgeEmptyBroadcasters(); - pTab->SetValue(rPos.Col(), rPos.Row(), fVal); + pTab->SetValue(rPos.Col(), rPos.Row(), fVal); - SetNeedsListeningGroups(aGroupPos); - StartNeededListeners(); + SetNeedsListeningGroups(aGroupPos); + StartNeededListeners(); + } + else + { + pTab->SetValue(rPos.Col(), rPos.Row(), fVal); + } } OUString ScDocument::GetString( SCCOL nCol, SCROW nRow, SCTAB nTab ) const _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits