[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - include/svl sc/inc sc/qa sc/source
include/svl/hint.hxx|1 sc/inc/column.hxx |2 - sc/qa/unit/ucalc.hxx|2 + sc/qa/unit/ucalc_formula.cxx| 44 sc/source/core/data/column3.cxx |5 +--- sc/source/core/data/formulacell.cxx |2 - sc/source/core/data/table5.cxx |2 - 7 files changed, 52 insertions(+), 6 deletions(-) New commits: commit 70ca2d0bc42a0360055b9c54e6e5edd3ef9317b8 Author: Arul Michael <arul7...@gmail.com> Date: Tue May 16 17:05:19 2017 +0530 New HintId and unit test for hidden rows and SUBTOTAL, tdf#93171 follow-up Adding new Hintid for HideRows so that we notify only formulas with subtotal and aggregate function for recalculation. Added unit testing. Change-Id: I44f2e45acaf697f91744bc8202f27b218faa5b43 (cherry picked from commit 6f9d7c3506ca13d79c8a2c732f42ce029452bd36) Reviewed-on: https://gerrit.libreoffice.org/37776 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Eike Rathke <er...@redhat.com> diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx index 2c94c4529300..f7f0c73e062e 100644 --- a/include/svl/hint.hxx +++ b/include/svl/hint.hxx @@ -85,6 +85,7 @@ enum class SfxHintId { ScRefModeChanged, ScKillEditView, ScKillEditViewNoPaint, +ScHiddenRowsChanged, // SC accessibility hints ScAccTableChanged, diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index e163a1e295a1..0c195eb316d0 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -588,7 +588,7 @@ public: void Broadcast( SCROW nRow ); void BroadcastCells( const std::vector& rRows, SfxHintId nHint ); -void BroadcastRows( SCROW nStartRow, SCROW nEndRow ); +void BroadcastRows( SCROW nStartRow, SCROW nEndRow, SfxHintId nHint ); // cell notes ScPostIt* GetCellNote( SCROW nRow ); diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index 732ab5b1ec3d..5d1def66c7c7 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -530,6 +530,7 @@ public: void testPrecisionAsShown(); void testProtectedSheetEditByRow(); void testProtectedSheetEditByColumn(); +void testFuncRowsHidden(); CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testCollator); @@ -800,6 +801,7 @@ public: CPPUNIT_TEST(testPrecisionAsShown); CPPUNIT_TEST(testProtectedSheetEditByRow); CPPUNIT_TEST(testProtectedSheetEditByColumn); +CPPUNIT_TEST(testFuncRowsHidden); CPPUNIT_TEST_SUITE_END(); private: diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 46fcdf05de68..223b88dd1f2f 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -7860,4 +7860,48 @@ void Test::testIntersectionOpExcel() m_pDoc->DeleteTab(0); } +//Test Subtotal and Aggregate during hide rows #tdf93171 +void Test::testFuncRowsHidden() +{ +sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on. +m_pDoc->InsertTab(0, "Test"); +m_pDoc->SetValue(0, 0, 0, 1); //A1 +m_pDoc->SetValue(0, 1, 0, 2); //A2 +m_pDoc->SetValue(0, 2, 0, 4); //A3 +m_pDoc->SetValue(0, 3, 0, 8); //A4 +m_pDoc->SetValue(0, 4, 0, 16); //A5 +m_pDoc->SetValue(0, 5, 0, 32); //A6 + +ScAddress aPos(0,6,0); +m_pDoc->SetString(aPos, "=SUBTOTAL(109; A1:A6)"); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Calculation of SUBTOTAL failed", 63.0, m_pDoc->GetValue(aPos)); +//Hide row 1 +m_pDoc->SetRowHidden(0, 0, 0, true); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Calculation of SUBTOTAL failed", 62.0, m_pDoc->GetValue(aPos)); +m_pDoc->SetRowHidden(0, 0, 0, false); +//Hide row 2 and 3 +m_pDoc->SetRowHidden(1, 2, 0, true); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Calculation of SUBTOTAL failed", 57.0, m_pDoc->GetValue(aPos)); +m_pDoc->SetRowHidden(1, 2, 0, false); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Calculation of SUBTOTAL failed", 63.0, m_pDoc->GetValue(aPos)); + +m_pDoc->SetString(aPos, "=AGGREGATE(9; 5; A1:A6)"); //9=SUM 5=Ignore only hidden rows +CPPUNIT_ASSERT_EQUAL_MESSAGE("Calculation of AGGREGATE failed", 63.0, m_pDoc->GetValue(aPos)); +//Hide row 1 +m_pDoc->SetRowHidden(0, 0, 0, true); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Calculation of AGGREGATE failed", 62.0, m_pDoc->GetValue(aPos)); +m_pDoc->SetRowHidden(0, 0, 0, false); +//Hide rows 3 to 5 +m_pDoc->SetRowHidden(2, 4, 0, true); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Calculation of AGGREGATE failed", 35.0, m_pDoc->GetValue(aPos)); +m_pDoc->SetRowHidden(2, 4, 0, false); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Calculation of AGGREGATE failed", 63.0, m_pDoc->GetValue(aPos)); + +m_pDoc->SetString(aPos, "=SUM(A1:A6)"); +m_pDoc->SetRowHidden(2, 4, 0, true); +CPPUNIT_ASSERT_EQ
[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sc/source
sc/source/core/data/document.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit f55f0b57b1f206763e97065f6121fcb55c53e53d Author: Arul Michael <arul7...@gmail.com> Date: Thu Apr 27 10:32:10 2017 +0530 tdf#106051 Notify listeners on top and bottom of split formula group Change-Id: Icecb59a476f57cee0c04c3e21d60e6c7fa12f65a Reviewed-on: https://gerrit.libreoffice.org/37011 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins <c...@libreoffice.org> (cherry picked from commit c882c60f54cc90740a674eed8c47bde0e9959652) Reviewed-on: https://gerrit.libreoffice.org/37543 diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 80fb075988b8..ee69a89cc3f8 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -5849,6 +5849,12 @@ void ScDocument::DeleteSelection( InsertDeleteFlags nDelFlag, const ScMarkData& if (pRange) SetDirty( *pRange, true); } +//Notify listeners on top and bottom of the group that has been split +for (size_t i = 0; i < aGroupPos.size(); ++i) { +ScFormulaCell *pFormulaCell = GetFormulaCell(aGroupPos[i]); +if (pFormulaCell) +pFormulaCell->SetDirty(true); +} } } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/document.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit c882c60f54cc90740a674eed8c47bde0e9959652 Author: Arul Michael <arul7...@gmail.com> Date: Thu Apr 27 10:32:10 2017 +0530 tdf#106051 Notify listeners on top and bottom of split formula group Change-Id: Icecb59a476f57cee0c04c3e21d60e6c7fa12f65a Reviewed-on: https://gerrit.libreoffice.org/37011 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins <c...@libreoffice.org> diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index d96451afacad..4e6df253e358 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -5847,6 +5847,12 @@ void ScDocument::DeleteSelection( InsertDeleteFlags nDelFlag, const ScMarkData& if (pRange) SetDirty( *pRange, true); } +//Notify listeners on top and bottom of the group that has been split +for (size_t i = 0; i < aGroupPos.size(); ++i) { +ScFormulaCell *pFormulaCell = GetFormulaCell(aGroupPos[i]); +if (pFormulaCell) +pFormulaCell->SetDirty(true); +} } } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sc/inc sc/source
sc/inc/column.hxx |1 + sc/source/core/data/column3.cxx | 10 ++ sc/source/core/data/table5.cxx |4 3 files changed, 15 insertions(+) New commits: commit 318b6b8ea87cba41995436bbc44818a068b35b6d Author: Arul Michael <arul7...@gmail.com> Date: Thu May 11 17:52:40 2017 +0530 tdf#93171 Subtotal function with function indexes don't update Calling InerpretTail during Hide rows by SfxHintId::ScDataChanged broadcast Reviewed-on: https://gerrit.libreoffice.org/37509 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Eike Rathke <er...@redhat.com> (cherry picked from commit 970b431f1a7b6b96c4c9536657ce4fe9d8f5b585) Backported. Conflicts: sc/inc/column.hxx Change-Id: Ie78170bb6d49933a49d828a18637cb410796dc06 Reviewed-on: https://gerrit.libreoffice.org/37522 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins <c...@libreoffice.org> diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index cfce9d6a4e50..c261a26308c8 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -585,6 +585,7 @@ public: void Broadcast( SCROW nRow ); void BroadcastCells( const std::vector& rRows, sal_uInt32 nHint ); +void BroadcastRows( SCROW nStartRow, SCROW nEndRow ); // cell notes ScPostIt* GetCellNote( SCROW nRow ); diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 73da282cc1f2..3d3aeba28af5 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -90,6 +90,16 @@ void ScColumn::BroadcastCells( const std::vector& rRows, sal_uInt32 nHint } } +void ScColumn::BroadcastRows( SCROW nStartRow, SCROW nEndRow ) +{ +sc::SingleColumnSpanSet aSpanSet; +aSpanSet.scan(*this, nStartRow, nEndRow); +std::vector aRows; +aSpanSet.getRows(aRows); +BroadcastCells(aRows, SC_HINT_DATACHANGED); +} + + struct DirtyCellInterpreter { void operator() (size_t, ScFormulaCell* p) diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx index 3ac1d04d4fcb..ccbbeb22a167 100644 --- a/sc/source/core/data/table5.cxx +++ b/sc/source/core/data/table5.cxx @@ -593,6 +593,10 @@ bool ScTable::SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden) { if (IsStreamValid()) SetStreamValid(false); +for (SCCOL i = 0; i < aCol.size(); i++) +{ +aCol[i].BroadcastRows(nStartRow, nEndRow); +} } return bChanged; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/inc sc/source
sc/inc/column.hxx |1 + sc/source/core/data/column3.cxx | 10 ++ sc/source/core/data/table5.cxx |4 3 files changed, 15 insertions(+) New commits: commit 970b431f1a7b6b96c4c9536657ce4fe9d8f5b585 Author: Arul Michael <arul7...@gmail.com> Date: Thu May 11 17:52:40 2017 +0530 tdf#93171 Subtotal function with function indexes don't update Calling InerpretTail during Hide rows by SfxHintId::ScDataChanged broadcast Change-Id: Ie78170bb6d49933a49d828a18637cb410796dc06 Reviewed-on: https://gerrit.libreoffice.org/37509 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Eike Rathke <er...@redhat.com> diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 564b6ff8114a..e163a1e295a1 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -588,6 +588,7 @@ public: void Broadcast( SCROW nRow ); void BroadcastCells( const std::vector& rRows, SfxHintId nHint ); +void BroadcastRows( SCROW nStartRow, SCROW nEndRow ); // cell notes ScPostIt* GetCellNote( SCROW nRow ); diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index c0a6e2923d38..97759267945d 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -88,6 +88,16 @@ void ScColumn::BroadcastCells( const std::vector& rRows, SfxHintId nHint } } +void ScColumn::BroadcastRows( SCROW nStartRow, SCROW nEndRow ) +{ +sc::SingleColumnSpanSet aSpanSet; +aSpanSet.scan(*this, nStartRow, nEndRow); +std::vector aRows; +aSpanSet.getRows(aRows); +BroadcastCells(aRows, SfxHintId::ScDataChanged); +} + + struct DirtyCellInterpreter { void operator() (size_t, ScFormulaCell* p) diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx index d0d26d2855d9..9342a7401a06 100644 --- a/sc/source/core/data/table5.cxx +++ b/sc/source/core/data/table5.cxx @@ -593,6 +593,10 @@ bool ScTable::SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden) { if (IsStreamValid()) SetStreamValid(false); +for (SCCOL i = 0; i < aCol.size(); i++) +{ +aCol[i].BroadcastRows(nStartRow, nEndRow); +} } return bChanged; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/table3.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 88a5f7d56f9e6040450fb959ce8d091a50edcfde Author: Arul Michael <arul7...@gmail.com> Date: Fri Jul 29 17:14:46 2016 +0530 tdf#88793 EDITING, subtotals don't apply formatting Change-Id: I29f33287715ccdee758c1e17dfabad1505049e1a Reviewed-on: https://gerrit.libreoffice.org/27680 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Eike Rathke <er...@redhat.com> diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index efe0c27..6da1c7c 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -2142,9 +2142,10 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam ) aArr.AddOpCode( ocStop ); ScFormulaCell* pCell = new ScFormulaCell( pDocument, ScAddress(nResCols[nResult], iEntry->nDestRow, nTab), aArr); +if ( rParam.bIncludePattern ) +pCell->SetNeedNumberFormat(true); SetFormulaCell(nResCols[nResult], iEntry->nDestRow, pCell); - if ( nResCols[nResult] != nGroupCol[iEntry->nGroupNo] ) { ApplyStyle( nResCols[nResult], iEntry->nDestRow, *pStyle ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source
sc/source/core/data/column.cxx |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit b7c9357dfbd119b0bad5034d61b1be140f99943b Author: Arul Michael <arul7...@gmail.com> Date: Mon May 16 15:52:21 2016 +0530 tdf#99255 Calc crashing on Undo after Spell Correction Avoiding null pointers being set for ScPostit* while creating the undo document during spell check. Change-Id: Ieb09cb2cee1c030f275eb5030dd779d543753c8b Reviewed-on: https://gerrit.libreoffice.org/25030 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Eike Rathke <er...@redhat.com> (cherry picked from commit 2d15020ea29d5541d1c44ff44a06eb5bcb35c52e) Reviewed-on: https://gerrit.libreoffice.org/25070 diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 596e338..4a5f266 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1206,9 +1206,13 @@ void ScColumn::CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDes { rDestCol.maCellTextAttrs.set(nDestRow, maCellTextAttrs.get(nSrcRow)); ScPostIt* pNote = maCellNotes.get<ScPostIt*>(nSrcRow); -rDestCol.maCellNotes.set(nDestRow, pNote); if (pNote) +{ +rDestCol.maCellNotes.set(nDestRow, pNote); pNote->UpdateCaptionPos(ScAddress(rDestCol.nCol, nDestRow, rDestCol.nTab)); +} +else +rDestCol.maCellNotes.set_empty(nDestRow, nDestRow); } else { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/column.cxx |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit 2d15020ea29d5541d1c44ff44a06eb5bcb35c52e Author: Arul Michael <arul7...@gmail.com> Date: Mon May 16 15:52:21 2016 +0530 tdf#99255 Calc crashing on Undo after Spell Correction Avoiding null pointers being set for ScPostit* while creating the undo document during spell check. Change-Id: Ieb09cb2cee1c030f275eb5030dd779d543753c8b Reviewed-on: https://gerrit.libreoffice.org/25030 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Eike Rathke <er...@redhat.com> diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index faf7f3a2..6389b1c 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1206,9 +1206,13 @@ void ScColumn::CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDes { rDestCol.maCellTextAttrs.set(nDestRow, maCellTextAttrs.get(nSrcRow)); ScPostIt* pNote = maCellNotes.get<ScPostIt*>(nSrcRow); -rDestCol.maCellNotes.set(nDestRow, pNote); if (pNote) +{ +rDestCol.maCellNotes.set(nDestRow, pNote); pNote->UpdateCaptionPos(ScAddress(rDestCol.nCol, nDestRow, rDestCol.nTab)); +} +else +rDestCol.maCellNotes.set_empty(nDestRow, nDestRow); } else { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sc/source
sc/source/core/data/column2.cxx |7 +++ 1 file changed, 7 insertions(+) New commits: commit 527f2cd0b75f901efc683efd92a51af771b860b5 Author: Arul Michael <arul7...@gmail.com> Date: Thu Mar 31 17:17:58 2016 +0530 tdf#92963 Pasting a whole row with data crashes all open LibO apps In ScColumn::GetNeededSize the memory pointed by rOptions.pPattern is freed and new value is set again in ScFormulaCell::InterpretTail function in pDocument->SetNumberFormat when pDocument->GetCondResult is called in column2.cxx:130.For fix setting the newly calculated ScPatternAttr* value after the GetCondResult call. Change-Id: I045404465b6dfa561b0821bb3b1875463aa7887a Reviewed-on: https://gerrit.libreoffice.org/23688 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Eike Rathke <er...@redhat.com> (cherry picked from commit 99bf0b931401f556033f67297aa9783c4cf19b00) Reviewed-on: https://gerrit.libreoffice.org/23709 diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 8929ecd..0d4b869 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -127,6 +127,13 @@ long ScColumn::GetNeededSize( // conditional formatting const SfxItemSet* pCondSet = pDocument->GetCondResult( nCol, nRow, nTab ); +//The pPattern may change in GetCondResult +if (aCell.meType == CELLTYPE_FORMULA) +{ +pPattern = pAttrArray->GetPattern( nRow ); +if (ppPatternChange) +*ppPatternChange = pPattern; +} // line break? const SfxPoolItem* pCondItem; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source
sc/source/core/data/column2.cxx |7 +++ 1 file changed, 7 insertions(+) New commits: commit 7a9a28857a4da8d2353c88ce90d8a60030d89e48 Author: Arul Michael <arul7...@gmail.com> Date: Thu Mar 31 17:17:58 2016 +0530 tdf#92963 Pasting a whole row with data crashes all open LibO apps In ScColumn::GetNeededSize the memory pointed by rOptions.pPattern is freed and new value is set again in ScFormulaCell::InterpretTail function in pDocument->SetNumberFormat when pDocument->GetCondResult is called in column2.cxx:130.For fix setting the newly calculated ScPatternAttr* value after the GetCondResult call. Change-Id: I045404465b6dfa561b0821bb3b1875463aa7887a Reviewed-on: https://gerrit.libreoffice.org/23688 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Eike Rathke <er...@redhat.com> (cherry picked from commit 99bf0b931401f556033f67297aa9783c4cf19b00) Reviewed-on: https://gerrit.libreoffice.org/23708 diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 01dde57..8c15aae 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -129,6 +129,13 @@ long ScColumn::GetNeededSize( // conditional formatting const SfxItemSet* pCondSet = pDocument->GetCondResult( nCol, nRow, nTab ); +//The pPattern may change in GetCondResult +if (aCell.meType == CELLTYPE_FORMULA) +{ +pPattern = pAttrArray->GetPattern( nRow ); +if (ppPatternChange) +*ppPatternChange = pPattern; +} // line break? const SfxPoolItem* pCondItem; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/column2.cxx |7 +++ 1 file changed, 7 insertions(+) New commits: commit 99bf0b931401f556033f67297aa9783c4cf19b00 Author: Arul Michael <arul7...@gmail.com> Date: Thu Mar 31 17:17:58 2016 +0530 tdf#92963 Pasting a whole row with data crashes all open LibO apps In ScColumn::GetNeededSize the memory pointed by rOptions.pPattern is freed and new value is set again in ScFormulaCell::InterpretTail function in pDocument->SetNumberFormat when pDocument->GetCondResult is called in column2.cxx:130.For fix setting the newly calculated ScPatternAttr* value after the GetCondResult call. Change-Id: I045404465b6dfa561b0821bb3b1875463aa7887a Reviewed-on: https://gerrit.libreoffice.org/23688 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Eike Rathke <er...@redhat.com> diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index b520d0a..3c2986e 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -129,6 +129,13 @@ long ScColumn::GetNeededSize( // conditional formatting const SfxItemSet* pCondSet = pDocument->GetCondResult( nCol, nRow, nTab ); +//The pPattern may change in GetCondResult +if (aCell.meType == CELLTYPE_FORMULA) +{ +pPattern = pAttrArray->GetPattern( nRow ); +if (ppPatternChange) +*ppPatternChange = pPattern; +} // line break? const SfxPoolItem* pCondItem; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source
sc/source/core/data/table3.cxx | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) New commits: commit a6e7673aec0321ceb328de902d5ee0689df3abf7 Author: Arul Michael <arul7...@gmail.com> Date: Mon Feb 22 09:53:31 2016 +0530 tdf#97215 Sorting with update reference causes crash The memory of SvtBroadcaster* of a cell is freed in EndlisteningCell() during SplitFormulaGroups call. The same memory address is assigned back to the cell again when the contents are transferred back after sorting. This is because the CreateSortinfoArray is done before SplitformulaGroup. For fix getting mpbroadcaster from the Document instead of SortinfoArray since we change the broadcaster in document after creating the SortInfoArray. Change-Id: Ic492d5019e26ff204307db4fefccc48ec99c0a6d Reviewed-on: https://gerrit.libreoffice.org/22607 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Eike Rathke <er...@redhat.com> (cherry picked from commit fca1147953989ef26e641e2ee9bb7e6390a69dd6) Reviewed-on: https://gerrit.libreoffice.org/22877 diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index ee76080..2671fde 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -231,11 +231,10 @@ public: { ScRefCellValue maCell; const sc::CellTextAttr* mpAttr; -const SvtBroadcaster* mpBroadcaster; const ScPostIt* mpNote; const ScPatternAttr* mpPattern; -Cell() : mpAttr(nullptr), mpBroadcaster(nullptr), mpNote(nullptr), mpPattern(nullptr) {} +Cell() : mpAttr(nullptr), mpNote(nullptr), mpPattern(nullptr) {} }; struct Row @@ -438,10 +437,8 @@ void initDataRows( { ScSortInfoArray::Row& rRow = *rRows[nRow-nRow1]; ScSortInfoArray::Cell& rCell = rRow.maCells[nCol-nCol1]; - rCell.maCell = rCol.GetCellValue(aBlockPos, nRow); rCell.mpAttr = rCol.GetCellTextAttr(aBlockPos, nRow); -rCell.mpBroadcaster = rCol.GetBroadcaster(aBlockPos, nRow); rCell.mpNote = rCol.GetCellNote(aBlockPos, nRow); if (!bUniformPattern && bPattern) @@ -709,10 +706,11 @@ void fillSortedColumnArray( std::vector<std::unique_ptr>& rSortedCols, SortedRowFlags& rRowFlags, std::vector<SvtListener*>& rCellListeners, -ScSortInfoArray* pArray, SCTAB nTab, SCCOL nCol1, SCCOL nCol2, ScProgress* pProgress ) +ScSortInfoArray* pArray, SCTAB nTab, SCCOL nCol1, SCCOL nCol2, ScProgress* pProgress, const ScTable* pTable ) { SCROW nRow1 = pArray->GetStart(); ScSortInfoArray::RowsType* pRows = pArray->GetDataRows(); +std::vector aOrderIndices = pArray->GetOrderIndices(); size_t nColCount = nCol2 - nCol1 + 1; std::vector<std::unique_ptr> aSortedCols; // storage for copied cells. @@ -795,10 +793,11 @@ void fillSortedColumnArray( // At this point each broadcaster instance is managed by 2 // containers. We will release those in the original storage // below before transferring them to the document. +const SvtBroadcaster* pBroadcaster = pTable->GetBroadcaster( nCol1 + j, aOrderIndices[i]); sc::BroadcasterStoreType& rBCStore = aSortedCols.at(j).get()->maBroadcasters; -if (rCell.mpBroadcaster) +if (pBroadcaster) // A const pointer would be implicitly converted to a bool type. - rBCStore.push_back(const_cast<SvtBroadcaster*>(rCell.mpBroadcaster)); + rBCStore.push_back(const_cast<SvtBroadcaster*>(pBroadcaster)); else rBCStore.push_back_empty(); } @@ -1091,7 +1090,7 @@ void ScTable::SortReorderByRow( // a copy before updating the document. std::vector<std::unique_ptr> aSortedCols; // storage for copied cells. SortedRowFlags aRowFlags; -fillSortedColumnArray(aSortedCols, aRowFlags, aCellListeners, pArray, nTab, nCol1, nCol2, pProgress); +fillSortedColumnArray(aSortedCols, aRowFlags, aCellListeners, pArray, nTab, nCol1, nCol2, pProgress, this); for (size_t i = 0, n = aSortedCols.size(); i < n; ++i) { @@ -1277,7 +1276,7 @@ void ScTable::SortReorderByRowRefUpdate( std::vector<std::unique_ptr> aSortedCols; // storage for copied cells. SortedRowFlags aRowFlags; std::vector<SvtListener*> aListenersDummy; -fillSortedColumnArray(aSortedCols, aRowFlags, aListenersDummy, pArray, nTab, nCol1, nCol2, pProgress); +fillSortedColumnArray(aSortedCols, aRowFlags, aListenersDummy, pArray, nTab, nCol1, nCol2, pProgress, this); for (size_t i = 0, n = aSortedCols.size(); i < n; ++i) { ___ Li
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/table3.cxx | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) New commits: commit fca1147953989ef26e641e2ee9bb7e6390a69dd6 Author: Arul Michael <arul7...@gmail.com> Date: Mon Feb 22 09:53:31 2016 +0530 tdf#97215 Sorting with update reference causes crash The memory of SvtBroadcaster* of a cell is freed in EndlisteningCell() during SplitFormulaGroups call. The same memory address is assigned back to the cell again when the contents are transferred back after sorting. This is because the CreateSortinfoArray is done before SplitformulaGroup. For fix getting mpbroadcaster from the Document instead of SortinfoArray since we change the broadcaster in document after creating the SortInfoArray. Change-Id: Ic492d5019e26ff204307db4fefccc48ec99c0a6d Reviewed-on: https://gerrit.libreoffice.org/22607 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Eike Rathke <er...@redhat.com> diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index e1842c8..6cdeace 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -227,11 +227,10 @@ public: { ScRefCellValue maCell; const sc::CellTextAttr* mpAttr; -const SvtBroadcaster* mpBroadcaster; const ScPostIt* mpNote; const ScPatternAttr* mpPattern; -Cell() : mpAttr(nullptr), mpBroadcaster(nullptr), mpNote(nullptr), mpPattern(nullptr) {} +Cell() : mpAttr(nullptr), mpNote(nullptr), mpPattern(nullptr) {} }; struct Row @@ -434,10 +433,8 @@ void initDataRows( { ScSortInfoArray::Row& rRow = *rRows[nRow-nRow1]; ScSortInfoArray::Cell& rCell = rRow.maCells[nCol-nCol1]; - rCell.maCell = rCol.GetCellValue(aBlockPos, nRow); rCell.mpAttr = rCol.GetCellTextAttr(aBlockPos, nRow); -rCell.mpBroadcaster = rCol.GetBroadcaster(aBlockPos, nRow); rCell.mpNote = rCol.GetCellNote(aBlockPos, nRow); if (!bUniformPattern && bPattern) @@ -705,10 +702,11 @@ void fillSortedColumnArray( std::vector<std::unique_ptr>& rSortedCols, SortedRowFlags& rRowFlags, std::vector<SvtListener*>& rCellListeners, -ScSortInfoArray* pArray, SCTAB nTab, SCCOL nCol1, SCCOL nCol2, ScProgress* pProgress ) +ScSortInfoArray* pArray, SCTAB nTab, SCCOL nCol1, SCCOL nCol2, ScProgress* pProgress, const ScTable* pTable ) { SCROW nRow1 = pArray->GetStart(); ScSortInfoArray::RowsType* pRows = pArray->GetDataRows(); +std::vector aOrderIndices = pArray->GetOrderIndices(); size_t nColCount = nCol2 - nCol1 + 1; std::vector<std::unique_ptr> aSortedCols; // storage for copied cells. @@ -791,10 +789,11 @@ void fillSortedColumnArray( // At this point each broadcaster instance is managed by 2 // containers. We will release those in the original storage // below before transferring them to the document. +const SvtBroadcaster* pBroadcaster = pTable->GetBroadcaster( nCol1 + j, aOrderIndices[i]); sc::BroadcasterStoreType& rBCStore = aSortedCols.at(j).get()->maBroadcasters; -if (rCell.mpBroadcaster) +if (pBroadcaster) // A const pointer would be implicitly converted to a bool type. - rBCStore.push_back(const_cast<SvtBroadcaster*>(rCell.mpBroadcaster)); + rBCStore.push_back(const_cast<SvtBroadcaster*>(pBroadcaster)); else rBCStore.push_back_empty(); } @@ -1087,7 +1086,7 @@ void ScTable::SortReorderByRow( // a copy before updating the document. std::vector<std::unique_ptr> aSortedCols; // storage for copied cells. SortedRowFlags aRowFlags; -fillSortedColumnArray(aSortedCols, aRowFlags, aCellListeners, pArray, nTab, nCol1, nCol2, pProgress); +fillSortedColumnArray(aSortedCols, aRowFlags, aCellListeners, pArray, nTab, nCol1, nCol2, pProgress, this); for (size_t i = 0, n = aSortedCols.size(); i < n; ++i) { @@ -1274,7 +1273,7 @@ void ScTable::SortReorderByRowRefUpdate( std::vector<std::unique_ptr> aSortedCols; // storage for copied cells. SortedRowFlags aRowFlags; std::vector<SvtListener*> aListenersDummy; -fillSortedColumnArray(aSortedCols, aRowFlags, aListenersDummy, pArray, nTab, nCol1, nCol2, pProgress); +fillSortedColumnArray(aSortedCols, aRowFlags, aListenersDummy, pArray, nTab, nCol1, nCol2, pProgress, this); for (size_t i = 0, n = aSortedCols.size(); i < n; ++i) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits