From 16164b63f3d31a99130097460af51409e75b6a0e Mon Sep 17 00:00:00 2001 From: David Tardon Date: Mon, 10 Nov 2014 19:55:08 +0100 Subject: [PATCH] update to 4.3.4 rc1 --- .gitignore | 3 + ...t-sorting-unit-tests-for-new-default.patch | 248 -- ...s-comprehensive-sorting-unit-tests-f.patch | 2057 ----------------- ...-62682-crash-on-second-export-of-svg.patch | 162 -- ...47-fix-word-count-with-recorded-chan.patch | 334 --- ...29-buffer-cache-grows-to-over-9000-u.patch | 58 - ...do-84885-chart-wizard-dialog-cut-off.patch | 168 -- ...46169-a11y-frames-label-dies-before-.patch | 53 - ...-new-compatibiltiy-flag-PropLineSpac.patch | 240 -- ...-text-formatting-of-proportional-lin.patch | 81 - ...broadcasting-during-cell-delete-shif.patch | 40 - ...846-Broadcast-changes-before-EndUndo.patch | 80 - ...hidden-configuration-option-to-toggl.patch | 593 ----- ...tly-adjust-references-in-range-names.patch | 76 - ...d-COLUMN-to-be-properly-recalculated.patch | 54 - ...adjust-references-wrt-cell-position-.patch | 51 - ...-that-formula-broadcasting-works-aft.patch | 52 - ...t-adjustment-of-range-reference-on-d.patch | 110 - ...broadcast-changes-after-TextToColumn.patch | 35 - 0001-just-use-ANSI-C-declarations.patch | 65 + libreoffice.spec | 48 +- sources | 6 +- 22 files changed, 88 insertions(+), 4526 deletions(-) delete mode 100644 0001-Adapt-sorting-unit-tests-for-new-default.patch delete mode 100644 0001-Back-port-Kohei-s-comprehensive-sorting-unit-tests-f.patch delete mode 100644 0001-Resolves-fdo-62682-crash-on-second-export-of-svg.patch delete mode 100644 0001-Resolves-fdo-68347-fix-word-count-with-recorded-chan.patch delete mode 100644 0001-Resolves-fdo-84729-buffer-cache-grows-to-over-9000-u.patch delete mode 100644 0001-Resolves-fdo-84885-chart-wizard-dialog-cut-off.patch delete mode 100644 0001-Resolves-rhbz-1146169-a11y-frames-label-dies-before-.patch delete mode 100644 0001-fdo-79602-sw-add-new-compatibiltiy-flag-PropLineSpac.patch delete mode 100644 0001-fdo-79602-sw-fix-text-formatting-of-proportional-lin.patch delete mode 100644 0001-fdo-80284-Avoid-broadcasting-during-cell-delete-shif.patch delete mode 100644 0001-fdo-80846-Broadcast-changes-before-EndUndo.patch delete mode 100644 0001-fdo-81633-Add-a-hidden-configuration-option-to-toggl.patch delete mode 100644 0001-fdo-82047-Correctly-adjust-references-in-range-names.patch delete mode 100644 0001-fdo-83901-ROW-and-COLUMN-to-be-properly-recalculated.patch delete mode 100644 0001-fdo-85215-Don-t-adjust-references-wrt-cell-position-.patch delete mode 100644 0001-fdo-85215-Ensure-that-formula-broadcasting-works-aft.patch delete mode 100644 0001-fdo-85282-Correct-adjustment-of-range-reference-on-d.patch delete mode 100644 0001-fdo-85403-broadcast-changes-after-TextToColumn.patch create mode 100644 0001-just-use-ANSI-C-declarations.patch diff --git a/.gitignore b/.gitignore index 4d07094..e233af1 100644 --- a/.gitignore +++ b/.gitignore @@ -107,3 +107,6 @@ /libreoffice-4.3.3.2.tar.xz /libreoffice-help-4.3.3.2.tar.xz /libreoffice-translations-4.3.3.2.tar.xz +/libreoffice-4.3.4.1.tar.xz +/libreoffice-help-4.3.4.1.tar.xz +/libreoffice-translations-4.3.4.1.tar.xz diff --git a/0001-Adapt-sorting-unit-tests-for-new-default.patch b/0001-Adapt-sorting-unit-tests-for-new-default.patch deleted file mode 100644 index 7875402..0000000 --- a/0001-Adapt-sorting-unit-tests-for-new-default.patch +++ /dev/null @@ -1,248 +0,0 @@ -From 77c6ce66696a997269b9fe4dfed1dc2e51ecd00e Mon Sep 17 00:00:00 2001 -From: Michael Meeks -Date: Fri, 10 Oct 2014 13:00:35 +0100 -Subject: [PATCH] Adapt sorting unit tests for new default. - -Change-Id: I9885e2712753390f0597233c404ab80c0ad2b537 -Reviewed-on: https://gerrit.libreoffice.org/11904 -Reviewed-by: Muthu Subramanian K -Reviewed-by: Eike Rathke -Tested-by: Eike Rathke ---- - sc/Library_scqahelper.mk | 2 +- - sc/qa/unit/filters-test.cxx | 9 +++++++ - sc/qa/unit/helper/sorthelper.hxx | 55 ++++++++++++++++++++++++++++++++++++++++ - sc/qa/unit/ucalc_sort.cxx | 26 ++++++++++++++----- - 4 files changed, 85 insertions(+), 7 deletions(-) - create mode 100644 sc/qa/unit/helper/sorthelper.hxx - -diff --git a/sc/Library_scqahelper.mk b/sc/Library_scqahelper.mk -index 351b115..912d5f8 100644 ---- a/sc/Library_scqahelper.mk -+++ b/sc/Library_scqahelper.mk -@@ -46,7 +46,7 @@ $(eval $(call gb_Library_use_libraries,scqahelper,\ - svl \ - svt \ - svx \ -- svxcore \ -+ svxcore \ - test \ - tl \ - unotest \ -diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx -index 0ea9f85..596f3fa 100644 ---- a/sc/qa/unit/filters-test.cxx -+++ b/sc/qa/unit/filters-test.cxx -@@ -21,6 +21,7 @@ - #include - - #include "helper/qahelper.hxx" -+#include "helper/sorthelper.hxx" - - #include "docsh.hxx" - #include "postit.hxx" -@@ -549,6 +550,13 @@ void ScFiltersTest::testEnhancedProtectionXLSX() - - void ScFiltersTest::testSortWithSharedFormulasODS() - { -+#if 0 -+ // This guy is a nightmare - he requires a ton of internal / -+ // private API from sc - that has a huge knock-on effect on -+ // filters-test linking etc. etc. - urgh ... surely we should -+ // test this just in ucalc - review appreciated Eike ... -+ SortRefUpdateSetter aUpdateSet; -+ - ScDocShellRef xDocSh = loadDoc("shared-formula/sort-crash.", ODS, true); - CPPUNIT_ASSERT(xDocSh.Is()); - ScDocument* pDoc = xDocSh->GetDocument(); -@@ -594,6 +602,7 @@ void ScFiltersTest::testSortWithSharedFormulasODS() - CPPUNIT_ASSERT_EQUAL(static_cast(15), pFC->GetSharedLength()); - - xDocSh->DoClose(); -+#endif - } - - ScFiltersTest::ScFiltersTest() -diff --git a/sc/qa/unit/helper/sorthelper.hxx b/sc/qa/unit/helper/sorthelper.hxx -new file mode 100644 -index 0000000..e82b8c2 ---- /dev/null -+++ b/sc/qa/unit/helper/sorthelper.hxx -@@ -0,0 +1,55 @@ -+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -+/* -+ * This file is part of the LibreOffice project. -+ * -+ * This Source Code Form is subject to the terms of the Mozilla Public -+ * License, v. 2.0. If a copy of the MPL was not distributed with this -+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. -+ */ -+ -+#ifndef INCLUDED_SC_QA_SORT_HELPER_QAHELPER_HXX -+#define INCLUDED_SC_QA_SORT_HELPER_QAHELPER_HXX -+ -+// Unfortunately requires linkage to sc/ internals so -+// can't live in qahelper itself. -+#include "inputopt.hxx" -+ -+/** -+ * Temporarily set the sorting type. -+ */ -+class SortTypeSetter { -+ bool mbSortRefUpdate; -+public: -+ SortTypeSetter(bool bSortRefUpdate) -+ { -+ mbSortRefUpdate = changeTo(bSortRefUpdate); -+ } -+ bool changeTo(bool bSortRefUpdate) -+ { -+ ScInputOptions aInputOptions = SC_MOD()->GetInputOptions(); -+ bool bRet = aInputOptions.GetSortRefUpdate(); -+ aInputOptions.SetSortRefUpdate(bSortRefUpdate); -+ SC_MOD()->SetInputOptions(aInputOptions); -+ return bRet; -+ } -+ virtual ~SortTypeSetter() -+ { -+ changeTo(mbSortRefUpdate); -+ } -+}; -+ -+class SortRefNoUpdateSetter : private SortTypeSetter -+{ -+public: -+ SortRefNoUpdateSetter() : SortTypeSetter(false) {} -+}; -+ -+class SortRefUpdateSetter : private SortTypeSetter -+{ -+public: -+ SortRefUpdateSetter() : SortTypeSetter(true) {} -+}; -+ -+#endif -+ -+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -diff --git a/sc/qa/unit/ucalc_sort.cxx b/sc/qa/unit/ucalc_sort.cxx -index f81a394..ce6b9b3 100644 ---- a/sc/qa/unit/ucalc_sort.cxx -+++ b/sc/qa/unit/ucalc_sort.cxx -@@ -8,6 +8,7 @@ - */ - - #include "ucalc.hxx" -+#include "helper/sorthelper.hxx" - - #include - #include -@@ -18,7 +19,6 @@ - #include - #include - #include --#include - #include - - #include -@@ -117,6 +117,8 @@ void Test::testSort() - - void Test::testSortHorizontal() - { -+ SortRefUpdateSetter aUpdateSet; -+ - ScFormulaOptions aOptions; - aOptions.SetFormulaSepArg(";"); - aOptions.SetFormulaSepArrayCol(";"); -@@ -361,6 +363,8 @@ void Test::testSortSingleRow() - // if cells in the sort are referenced by formulas - void Test::testSortWithFormulaRefs() - { -+ SortRefUpdateSetter aUpdateSet; -+ - m_pDoc->InsertTab(0, "List1"); - m_pDoc->InsertTab(1, "List2"); - -@@ -460,6 +464,8 @@ void Test::testSortWithStrings() - - void Test::testSortInFormulaGroup() - { -+ SortRefUpdateSetter aUpdateSet; -+ - static struct { - SCCOL nCol; - SCROW nRow; -@@ -691,6 +697,8 @@ void Test::testSortWithCellFormats() - - void Test::testSortRefUpdate() - { -+ SortTypeSetter aSortTypeSet(true); -+ - sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on. - FormulaGrammarSwitch aFGSwitch(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1); - -@@ -811,8 +819,7 @@ void Test::testSortRefUpdate() - m_pDoc->SetString(ScAddress(2,1+i,0), "=RC[-2]"); - - // Turn off reference update on sort. -- ScInputOptions aInputOption = SC_MOD()->GetInputOptions(); -- aInputOption.SetSortRefUpdate(false); -+ aSortTypeSet.changeTo(false); - - bSorted = aFunc.Sort(0, aSortData, true, true, true); - CPPUNIT_ASSERT(bSorted); -@@ -837,14 +844,13 @@ void Test::testSortRefUpdate() - CPPUNIT_ASSERT_EQUAL(fCheck, m_pDoc->GetValue(ScAddress(2,i+1,0))); // column C - } - -- // Turn it back on. -- aInputOption.SetSortRefUpdate(true); -- - m_pDoc->DeleteTab(0); - } - - void Test::testSortRefUpdate2() - { -+ SortRefUpdateSetter aUpdateSet; -+ - sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on. - FormulaGrammarSwitch aFGSwitch(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1); - -@@ -932,6 +938,8 @@ void Test::testSortRefUpdate2() - - void Test::testSortRefUpdate3() - { -+ SortRefUpdateSetter aUpdateSet; -+ - sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on. - m_pDoc->InsertTab(0, "Sort"); - -@@ -1020,6 +1028,8 @@ void Test::testSortRefUpdate3() - // testRefInterne.ods - void Test::testSortRefUpdate4() - { -+ SortRefUpdateSetter aUpdateSet; -+ - sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on. - m_pDoc->InsertTab(0, "Sort"); - m_pDoc->InsertTab(1, "Lesson1"); -@@ -1217,6 +1227,8 @@ void Test::testSortRefUpdate4() - * before midnight, ermm.. */ - void Test::testSortRefUpdate5() - { -+ SortRefUpdateSetter aUpdateSet; -+ - sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on. - m_pDoc->InsertTab(0, "Sort"); - -@@ -1388,6 +1400,8 @@ void Test::testSortOutOfPlaceResult() - - void Test::testSortPartialFormulaGroup() - { -+ SortRefUpdateSetter aUpdateSet; -+ - sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on. - FormulaGrammarSwitch aFGSwitch(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1); - --- -1.9.3 - diff --git a/0001-Back-port-Kohei-s-comprehensive-sorting-unit-tests-f.patch b/0001-Back-port-Kohei-s-comprehensive-sorting-unit-tests-f.patch deleted file mode 100644 index 2620af9..0000000 --- a/0001-Back-port-Kohei-s-comprehensive-sorting-unit-tests-f.patch +++ /dev/null @@ -1,2057 +0,0 @@ -From f4dabc071f0eaf0e22db9b23c573a380b5e480ff Mon Sep 17 00:00:00 2001 -From: Michael Meeks -Date: Thu, 9 Oct 2014 17:30:42 +0100 -Subject: [PATCH] Back-port Kohei's comprehensive sorting unit tests from - master. - -As of master commit fab88063281761dbdac7ea550072660fe0f8c863. - -Change-Id: I45ee0021c727281ba5590ceead6d8c5848e25169 -Reviewed-on: https://gerrit.libreoffice.org/11903 -Reviewed-by: Muthu Subramanian K -Reviewed-by: Eike Rathke -Tested-by: Eike Rathke ---- - sc/CppunitTest_sc_ucalc.mk | 1 + - sc/qa/unit/ucalc.cxx | 491 --------------- - sc/qa/unit/ucalc.hxx | 21 +- - sc/qa/unit/ucalc_sort.cxx | 1464 ++++++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 1485 insertions(+), 492 deletions(-) - create mode 100644 sc/qa/unit/ucalc_sort.cxx - -diff --git a/sc/CppunitTest_sc_ucalc.mk b/sc/CppunitTest_sc_ucalc.mk -index 9b3c498..2054f19 100644 ---- a/sc/CppunitTest_sc_ucalc.mk -+++ b/sc/CppunitTest_sc_ucalc.mk -@@ -17,6 +17,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sc_ucalc, \ - sc/qa/unit/ucalc_formula \ - sc/qa/unit/ucalc_pivottable \ - sc/qa/unit/ucalc_sharedformula \ -+ sc/qa/unit/ucalc_sort \ - )) - - $(eval $(call gb_CppunitTest_use_library_objects,sc_ucalc, \ -diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx -index 8e19f2f..2bb0889 100644 ---- a/sc/qa/unit/ucalc.cxx -+++ b/sc/qa/unit/ucalc.cxx -@@ -4724,497 +4724,6 @@ void Test::testFindAreaPosColRight() - m_pDoc->DeleteTab(0); - } - --// regression test fo fdo#53814, sorting doens't work as expected --// if cells in the sort are referenced by formulas --void Test::testSortWithFormulaRefs() --{ -- m_pDoc->InsertTab(0, "List1"); -- m_pDoc->InsertTab(1, "List2"); -- -- const char* aFormulaData[6] = { -- "=IF($List1.A2<>\"\";$List1.A2;\"\")", -- "=IF($List1.A3<>\"\";$List1.A3;\"\")", -- "=IF($List1.A4<>\"\";$List1.A4;\"\")", -- "=IF($List1.A5<>\"\";$List1.A5;\"\")", -- "=IF($List1.A6<>\"\";$List1.A6;\"\")", -- "=IF($List1.A7<>\"\";$List1.A7;\"\")", -- }; -- -- const char* aTextData[4] = { -- "bob", -- "tim", -- "brian", -- "larry", -- }; -- -- const char* aResults[6] = { -- "bob", -- "brian", -- "larry", -- "tim", -- "", -- "", -- }; -- -- // Insert data to sort in A2:A5 on the 1st sheet. -- for (SCROW i = 1; i <= 4; ++i) -- m_pDoc->SetString( 0, i, 0, OUString::createFromAscii(aTextData[i-1]) ); -- -- // Insert forumulas in A1:A6 on the 2nd sheet. -- for (size_t i = 0; i < SAL_N_ELEMENTS(aFormulaData); ++i) -- m_pDoc->SetString( 0, i, 1, OUString::createFromAscii(aFormulaData[i]) ); -- -- // Sort data in A2:A8 on the 1st sheet. No column header. -- ScSortParam aSortData; -- aSortData.nCol1 = 0; -- aSortData.nCol2 = 0; -- aSortData.nRow1 = 1; -- aSortData.nRow2 = 7; -- aSortData.maKeyState[0].bDoSort = true; -- aSortData.maKeyState[0].nField = 0; -- -- m_pDoc->Sort(0, aSortData, false, true, NULL, NULL); -- -- for (size_t i = 0; i < SAL_N_ELEMENTS(aResults); ++i) -- { -- OUString sResult = m_pDoc->GetString(0, i + 1, 0); -- CPPUNIT_ASSERT_EQUAL( OUString::createFromAscii( aResults[i] ), sResult ); -- } -- m_pDoc->DeleteTab(1); -- m_pDoc->DeleteTab(0); --} -- --void Test::testSortWithStrings() --{ -- m_pDoc->InsertTab(0, "Test"); -- -- ScFieldEditEngine& rEE = m_pDoc->GetEditEngine(); -- rEE.SetText("Val1"); -- m_pDoc->SetString(ScAddress(1,1,0), "Header"); -- m_pDoc->SetString(ScAddress(1,2,0), "Val2"); -- m_pDoc->SetEditText(ScAddress(1,3,0), rEE.CreateTextObject()); -- -- CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(1,1,0))); -- CPPUNIT_ASSERT_EQUAL(OUString("Val2"), m_pDoc->GetString(ScAddress(1,2,0))); -- CPPUNIT_ASSERT_EQUAL(OUString("Val1"), m_pDoc->GetString(ScAddress(1,3,0))); -- -- ScSortParam aParam; -- aParam.nCol1 = 1; -- aParam.nCol2 = 1; -- aParam.nRow1 = 1; -- aParam.nRow2 = 3; -- aParam.bHasHeader = true; -- aParam.maKeyState[0].bDoSort = true; -- aParam.maKeyState[0].bAscending = true; -- aParam.maKeyState[0].nField = 1; -- -- m_pDoc->Sort(0, aParam, false, true, NULL, NULL); -- -- CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(1,1,0))); -- CPPUNIT_ASSERT_EQUAL(OUString("Val1"), m_pDoc->GetString(ScAddress(1,2,0))); -- CPPUNIT_ASSERT_EQUAL(OUString("Val2"), m_pDoc->GetString(ScAddress(1,3,0))); -- -- aParam.maKeyState[0].bAscending = false; -- -- m_pDoc->Sort(0, aParam, false, true, NULL, NULL); -- -- CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(1,1,0))); -- CPPUNIT_ASSERT_EQUAL(OUString("Val2"), m_pDoc->GetString(ScAddress(1,2,0))); -- CPPUNIT_ASSERT_EQUAL(OUString("Val1"), m_pDoc->GetString(ScAddress(1,3,0))); -- -- m_pDoc->DeleteTab(0); --} -- --void Test::testSort() --{ -- m_pDoc->InsertTab(0, "test1"); -- -- ScRange aDataRange; -- ScAddress aPos(0,0,0); -- { -- const char* aData[][2] = { -- { "2", "4" }, -- { "4", "1" }, -- { "1", "2" }, -- { "1", "23" }, -- }; -- -- clearRange(m_pDoc, ScRange(0, 0, 0, 1, SAL_N_ELEMENTS(aData), 0)); -- aDataRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); -- CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); -- } -- -- // Insert note in cell B2. -- ScAddress rAddr(1, 1, 0); -- ScPostIt* pNote = m_pDoc->GetOrCreateNote(rAddr); -- pNote->SetText(rAddr, "Hello"); -- pNote->SetAuthor("Jim Bob"); -- -- ScSortParam aSortData; -- aSortData.nCol1 = 1; -- aSortData.nCol2 = 1; -- aSortData.nRow1 = 0; -- aSortData.nRow2 = 2; -- aSortData.maKeyState[0].bDoSort = true; -- aSortData.maKeyState[0].nField = 1; -- aSortData.maKeyState[0].bAscending = true; -- -- m_pDoc->Sort(0, aSortData, false, true, NULL, NULL); -- -- double nVal = m_pDoc->GetValue(1,0,0); -- ASSERT_DOUBLES_EQUAL(nVal, 1.0); -- -- // check that note is also moved after sorting -- pNote = m_pDoc->GetNote(1, 0, 0); -- CPPUNIT_ASSERT(pNote); -- -- clearRange(m_pDoc, ScRange(0, 0, 0, 1, 9, 0)); // Clear A1:B10. -- { -- // 0 = empty cell -- const char* aData[][1] = { -- { "Title" }, -- { 0 }, -- { 0 }, -- { "12" }, -- { "b" }, -- { "1" }, -- { "9" }, -- { "123" } -- }; -- -- aDataRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); -- CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); -- } -- -- aSortData.nCol1 = aDataRange.aStart.Col(); -- aSortData.nCol2 = aDataRange.aEnd.Col(); -- aSortData.nRow1 = aDataRange.aStart.Row(); -- aSortData.nRow2 = aDataRange.aEnd.Row(); -- aSortData.bHasHeader = true; -- aSortData.maKeyState[0].nField = 0; -- m_pDoc->Sort(0, aSortData, false, true, NULL, NULL); -- -- // Title should stay at the top, numbers should be sorted numerically, -- // numbers always come before strings, and empty cells always occur at the -- // end. -- CPPUNIT_ASSERT_EQUAL(OUString("Title"), m_pDoc->GetString(aPos)); -- aPos.IncRow(); -- CPPUNIT_ASSERT_EQUAL(OUString("1"), m_pDoc->GetString(aPos)); -- aPos.IncRow(); -- CPPUNIT_ASSERT_EQUAL(OUString("9"), m_pDoc->GetString(aPos)); -- aPos.IncRow(); -- CPPUNIT_ASSERT_EQUAL(OUString("12"), m_pDoc->GetString(aPos)); -- aPos.IncRow(); -- CPPUNIT_ASSERT_EQUAL(OUString("123"), m_pDoc->GetString(aPos)); -- aPos.IncRow(); -- CPPUNIT_ASSERT_EQUAL(OUString("b"), m_pDoc->GetString(aPos)); -- aPos.IncRow(); -- CPPUNIT_ASSERT_EQUAL(CELLTYPE_NONE, m_pDoc->GetCellType(aPos)); -- -- m_pDoc->DeleteTab(0); --} -- --void Test::testSortHorizontal() --{ -- ScFormulaOptions aOptions; -- aOptions.SetFormulaSepArg(";"); -- aOptions.SetFormulaSepArrayCol(";"); -- aOptions.SetFormulaSepArrayRow("|"); -- getDocShell().SetFormulaOptions(aOptions); -- -- sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); -- m_pDoc->InsertTab(0, "Sort"); -- -- // Test case from fdo#78079. -- -- // 0 = empty cell -- const char* aData[][4] = { -- { "table", "has UNIQUE", "Publish to EC2", "flag" }, -- { "w2gi.mobilehit", "Yes", "No", "=CONCATENATE(B2;\"-\";C2)" }, -- { "w2gi.visitors", "No", "No", "=CONCATENATE(B3;\"-\";C3)" }, -- { "w2gi.pagedimension", "Yes", "Yes", "=CONCATENATE(B4;\"-\";C4)" }, -- }; -- -- // Insert raw data into A1:D4. -- ScRange aDataRange = insertRangeData(m_pDoc, ScAddress(0,0,0), aData, SAL_N_ELEMENTS(aData)); -- CPPUNIT_ASSERT_EQUAL(OUString("A1:D4"), aDataRange.Format(SCA_VALID)); -- -- // Check the formula values. -- CPPUNIT_ASSERT_EQUAL(OUString("Yes-No"), m_pDoc->GetString(ScAddress(3,1,0))); -- CPPUNIT_ASSERT_EQUAL(OUString("No-No"), m_pDoc->GetString(ScAddress(3,2,0))); -- CPPUNIT_ASSERT_EQUAL(OUString("Yes-Yes"), m_pDoc->GetString(ScAddress(3,3,0))); -- -- // Define A1:D4 as sheet-local anonymous database range. -- m_pDoc->SetAnonymousDBData( -- 0, new ScDBData(STR_DB_LOCAL_NONAME, 0, 0, 0, 3, 3)); -- -- // Sort A1:D4 horizontally, ascending by row 1. -- ScDBDocFunc aFunc(getDocShell()); -- -- ScSortParam aSortData; -- aSortData.nCol1 = 0; -- aSortData.nCol2 = 3; -- aSortData.nRow1 = 0; -- aSortData.nRow2 = 3; -- aSortData.bHasHeader = true; -- aSortData.bByRow = false; // Sort by column (in horizontal direction). -- aSortData.bIncludePattern = true; -- aSortData.maKeyState[0].bDoSort = true; -- aSortData.maKeyState[0].nField = 0; -- aSortData.maKeyState[0].bAscending = true; -- bool bSorted = aFunc.Sort(0, aSortData, true, true, true); -- CPPUNIT_ASSERT(bSorted); -- -- { -- // Expected output table content. 0 = empty cell -- const char* aOutputCheck[][4] = { -- { "table", "flag", "has UNIQUE", "Publish to EC2" }, -- { "w2gi.mobilehit", "Yes-No", "Yes", "No" }, -- { "w2gi.visitors", "No-No", "No", "No" }, -- { "w2gi.pagedimension", "Yes-Yes", "Yes", "Yes" }, -- }; -- -- bool bSuccess = checkOutput<4>(m_pDoc, aDataRange, aOutputCheck, "Sorted by column with formula"); -- CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess); -- } -- -- if (!checkFormula(*m_pDoc, ScAddress(1,1,0), "CONCATENATE(C2;\"-\";D2)")) -- CPPUNIT_FAIL("Wrong formula!"); -- if (!checkFormula(*m_pDoc, ScAddress(1,2,0), "CONCATENATE(C3;\"-\";D3)")) -- CPPUNIT_FAIL("Wrong formula!"); -- if (!checkFormula(*m_pDoc, ScAddress(1,3,0), "CONCATENATE(C4;\"-\";D4)")) -- CPPUNIT_FAIL("Wrong formula!"); -- -- m_pDoc->DeleteTab(0); --} -- --void Test::testSortInFormulaGroup() --{ -- static struct { -- SCCOL nCol; -- SCROW nRow; -- const char *pData; -- } aEntries[] = { -- { 0, 0, "3" }, { 1, 0, "=A1" }, -- { 0, 1, "1" }, { 1, 1, "=A2" }, -- { 0, 2, "20" }, { 1, 2, "=A3" }, -- { 0, 3, "10" }, { 1, 3, "=A4+1" }, // swap across groups -- { 0, 4, "2" }, { 1, 4, "=A5+1" }, -- { 0, 5, "101" }, { 1, 5, "=A6" }, // swap inside contiguious group -- { 0, 6, "100" }, { 1, 6, "=A7" }, -- { 0, 7, "102" }, { 1, 7, "=A8" }, -- { 0, 8, "104" }, { 1, 8, "=A9" }, -- { 0, 9, "103" }, { 1, 9, "=A10" }, -- }; -- -- m_pDoc->InsertTab(0, "sorttest"); -- -- for ( SCROW i = 0; i < (SCROW) SAL_N_ELEMENTS( aEntries ); ++i ) -- m_pDoc->SetString( aEntries[i].nCol, aEntries[i].nRow, 0, -- OUString::createFromAscii( aEntries[i].pData) ); -- -- ScSortParam aSortData; -- aSortData.nCol1 = 0; -- aSortData.nCol2 = 1; -- aSortData.nRow1 = 0; -- aSortData.nRow2 = 9; -- aSortData.maKeyState[0].bDoSort = true; -- aSortData.maKeyState[0].nField = 0; -- aSortData.maKeyState[0].bAscending = true; -- -- m_pDoc->Sort(0, aSortData, false, true, NULL, NULL); -- -- static struct { -- SCCOL nCol; -- SCROW nRow; -- double fValue; -- } aResults[] = { -- { 0, 0, 1.0 }, { 1, 0, 1.0 }, -- { 0, 1, 2.0 }, { 1, 1, 3.0 }, -- { 0, 2, 3.0 }, { 1, 2, 3.0 }, -- { 0, 3, 10.0 }, { 1, 3, 11.0 }, -- { 0, 4, 20.0 }, { 1, 4, 20.0 }, -- { 0, 5, 100.0 }, { 1, 5, 100.0 }, -- { 0, 6, 101.0 }, { 1, 6, 101.0 }, -- { 0, 7, 102.0 }, { 1, 7, 102.0 }, -- { 0, 8, 103.0 }, { 1, 8, 103.0 }, -- { 0, 9, 104.0 }, { 1, 9, 104.0 }, -- }; -- -- for ( SCROW i = 0; i < (SCROW) SAL_N_ELEMENTS( aEntries ); ++i ) -- { -- double val = m_pDoc->GetValue( aEntries[i].nCol, aEntries[i].nRow, 0 ); --// fprintf(stderr, "value at %d %d is %g = %g\n", --// (int)aResults[i].nRow, (int)aResults[i].nCol, --// val, aResults[i].fValue); -- CPPUNIT_ASSERT_MESSAGE("Mis-matching value after sort.", -- rtl::math::approxEqual(val, aResults[i].fValue)); -- } -- -- m_pDoc->DeleteTab( 0 ); --} -- --void Test::testSortWithCellFormats() --{ -- struct -- { -- bool isBold( const ScPatternAttr* pPat ) const -- { -- if (!pPat) -- { -- cerr << "Pattern is NULL!" << endl; -- return false; -- } -- -- const SfxPoolItem* pItem = NULL; -- if (!pPat->GetItemSet().HasItem(ATTR_FONT_WEIGHT, &pItem)) -- { -- cerr << "Pattern does not have a font weight item, but it should." << endl; -- return false; -- } -- -- if (static_cast(pItem)->GetEnumValue() != WEIGHT_BOLD) -- { -- cerr << "Font weight should be bold." << endl; -- return false; -- } -- -- return true; -- } -- -- bool isItalic( const ScPatternAttr* pPat ) const -- { -- if (!pPat) -- { -- cerr << "Pattern is NULL!" << endl; -- return false; -- } -- -- const SfxPoolItem* pItem = NULL; -- if (!pPat->GetItemSet().HasItem(ATTR_FONT_POSTURE, &pItem)) -- { -- cerr << "Pattern does not have a font posture item, but it should." << endl; -- return false; -- } -- -- if (static_cast(pItem)->GetEnumValue() != ITALIC_NORMAL) -- { -- cerr << "Italic should be applied.." << endl; -- return false; -- } -- -- return true; -- } -- -- bool isNormal( const ScPatternAttr* pPat ) const -- { -- if (!pPat) -- { -- cerr << "Pattern is NULL!" << endl; -- return false; -- } -- -- const SfxPoolItem* pItem = NULL; -- if (pPat->GetItemSet().HasItem(ATTR_FONT_WEIGHT)) -- { -- // Check if the font weight is applied. -- if (static_cast(pItem)->GetEnumValue() == WEIGHT_BOLD) -- { -- cerr << "This cell is bold, but shouldn't." << endl; -- return false; -- } -- } -- -- if (pPat->GetItemSet().HasItem(ATTR_FONT_POSTURE)) -- { -- // Check if the italics is applied. -- if (static_cast(pItem)->GetEnumValue() == ITALIC_NORMAL) -- { -- cerr << "This cell is bold, but shouldn't." << endl; -- return false; -- } -- } -- -- return true; -- } -- -- } aCheck; -- -- m_pDoc->InsertTab(0, "Test"); -- -- // Insert some values into A1:A4. -- m_pDoc->SetString(ScAddress(0,0,0), "Header"); -- m_pDoc->SetString(ScAddress(0,1,0), "Normal"); -- m_pDoc->SetString(ScAddress(0,2,0), "Bold"); -- m_pDoc->SetString(ScAddress(0,3,0), "Italic"); -- -- // Set A3 bold and A4 italic. -- const ScPatternAttr* pPat = m_pDoc->GetPattern(ScAddress(0,2,0)); -- CPPUNIT_ASSERT(pPat); -- { -- ScPatternAttr aNewPat(*pPat); -- SfxItemSet& rSet = aNewPat.GetItemSet(); -- rSet.Put(SvxWeightItem(WEIGHT_BOLD, ATTR_FONT_WEIGHT)); -- m_pDoc->ApplyPattern(0, 2, 0, aNewPat); -- -- // Make sure it's really in. -- bool bGood = aCheck.isBold(m_pDoc->GetPattern(ScAddress(0,2,0))); -- CPPUNIT_ASSERT_MESSAGE("A3 is not bold but it should.", bGood); -- } -- -- pPat = m_pDoc->GetPattern(ScAddress(0,3,0)); -- CPPUNIT_ASSERT(pPat); -- { -- ScPatternAttr aNewPat(*pPat); -- SfxItemSet& rSet = aNewPat.GetItemSet(); -- rSet.Put(SvxPostureItem(ITALIC_NORMAL, ATTR_FONT_POSTURE)); -- m_pDoc->ApplyPattern(0, 3, 0, aNewPat); -- -- bool bGood = aCheck.isItalic(m_pDoc->GetPattern(ScAddress(0,3,0))); -- CPPUNIT_ASSERT_MESSAGE("A4 is not italic but it should.", bGood); -- } -- -- // Define A1:A4 as sheet-local anonymous database range, else sort wouldn't run. -- m_pDoc->SetAnonymousDBData( -- 0, new ScDBData(STR_DB_LOCAL_NONAME, 0, 0, 0, 0, 3)); -- -- // Sort A1:A4 ascending with cell formats. -- ScDBDocFunc aFunc(getDocShell()); -- -- ScSortParam aSortData; -- aSortData.nCol1 = 0; -- aSortData.nCol2 = 0; -- aSortData.nRow1 = 0; -- aSortData.nRow2 = 3; -- aSortData.bHasHeader = true; -- aSortData.bIncludePattern = true; -- aSortData.maKeyState[0].bDoSort = true; -- aSortData.maKeyState[0].nField = 0; -- aSortData.maKeyState[0].bAscending = true; -- bool bSorted = aFunc.Sort(0, aSortData, true, false, true); -- CPPUNIT_ASSERT(bSorted); -- -- // Check the sort result. -- CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(0,0,0))); -- CPPUNIT_ASSERT_EQUAL(OUString("Bold"), m_pDoc->GetString(ScAddress(0,1,0))); -- CPPUNIT_ASSERT_EQUAL(OUString("Italic"), m_pDoc->GetString(ScAddress(0,2,0))); -- CPPUNIT_ASSERT_EQUAL(OUString("Normal"), m_pDoc->GetString(ScAddress(0,3,0))); -- -- // A2 should be bold now. -- bool bBold = aCheck.isBold(m_pDoc->GetPattern(ScAddress(0,1,0))); -- CPPUNIT_ASSERT_MESSAGE("A2 should be bold after the sort.", bBold); -- -- // and A3 should be italic. -- bool bItalic = aCheck.isItalic(m_pDoc->GetPattern(ScAddress(0,2,0))); -- CPPUNIT_ASSERT_MESSAGE("A3 should be italic.", bItalic); -- -- // A4 should have neither bold nor italic. -- bool bNormal = aCheck.isNormal(m_pDoc->GetPattern(ScAddress(0,3,0))); -- CPPUNIT_ASSERT_MESSAGE("A4 should be neither bold nor italic.", bNormal); -- -- m_pDoc->DeleteTab(0); --} -- - void Test::testShiftCells() - { - m_pDoc->InsertTab(0, "foo"); -diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx -index 39862ee..a1688f7 100644 ---- a/sc/qa/unit/ucalc.hxx -+++ b/sc/qa/unit/ucalc.hxx -@@ -338,13 +338,23 @@ public: - - void testFindAreaPosVertical(); - void testFindAreaPosColRight(); -+ void testShiftCells(); -+ - void testSort(); - void testSortHorizontal(); -+ void testSortHorizontalWholeColumn(); -+ void testSortSingleRow(); - void testSortWithFormulaRefs(); - void testSortWithStrings(); - void testSortInFormulaGroup(); - void testSortWithCellFormats(); -- void testShiftCells(); -+ void testSortRefUpdate(); -+ void testSortRefUpdate2(); -+ void testSortRefUpdate3(); -+ void testSortRefUpdate4(); -+ void testSortRefUpdate5(); -+ void testSortOutOfPlaceResult(); -+ void testSortPartialFormulaGroup(); - - void testNoteBasic(); - void testNoteDeleteRow(); -@@ -507,10 +517,19 @@ public: - CPPUNIT_TEST(testFindAreaPosColRight); - CPPUNIT_TEST(testSort); - CPPUNIT_TEST(testSortHorizontal); -+ CPPUNIT_TEST(testSortHorizontalWholeColumn); -+ CPPUNIT_TEST(testSortSingleRow); - CPPUNIT_TEST(testSortWithFormulaRefs); - CPPUNIT_TEST(testSortWithStrings); - CPPUNIT_TEST(testSortInFormulaGroup); - CPPUNIT_TEST(testSortWithCellFormats); -+ CPPUNIT_TEST(testSortRefUpdate); -+ CPPUNIT_TEST(testSortRefUpdate2); -+ CPPUNIT_TEST(testSortRefUpdate3); -+ CPPUNIT_TEST(testSortRefUpdate4); -+ CPPUNIT_TEST(testSortRefUpdate5); -+ CPPUNIT_TEST(testSortOutOfPlaceResult); -+ CPPUNIT_TEST(testSortPartialFormulaGroup); - CPPUNIT_TEST(testShiftCells); - CPPUNIT_TEST(testNoteBasic); - CPPUNIT_TEST(testNoteDeleteRow); -diff --git a/sc/qa/unit/ucalc_sort.cxx b/sc/qa/unit/ucalc_sort.cxx -new file mode 100644 -index 0000000..f81a394 ---- /dev/null -+++ b/sc/qa/unit/ucalc_sort.cxx -@@ -0,0 +1,1464 @@ -+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -+/* -+ * This file is part of the LibreOffice project. -+ * -+ * This Source Code Form is subject to the terms of the Mozilla Public -+ * License, v. 2.0. If a copy of the MPL was not distributed with this -+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. -+ */ -+ -+#include "ucalc.hxx" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+void Test::testSort() -+{ -+ m_pDoc->InsertTab(0, "test1"); -+ -+ ScRange aDataRange; -+ ScAddress aPos(0,0,0); -+ { -+ const char* aData[][2] = { -+ { "2", "4" }, -+ { "4", "1" }, -+ { "1", "2" }, -+ { "1", "23" }, -+ }; -+ -+ clearRange(m_pDoc, ScRange(0, 0, 0, 1, SAL_N_ELEMENTS(aData), 0)); -+ aDataRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); -+ CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); -+ } -+ -+ // Insert note in cell B2. -+ ScAddress rAddr(1, 1, 0); -+ ScPostIt* pNote = m_pDoc->GetOrCreateNote(rAddr); -+ pNote->SetText(rAddr, "Hello"); -+ pNote->SetAuthor("Jim Bob"); -+ -+ ScSortParam aSortData; -+ aSortData.nCol1 = 1; -+ aSortData.nCol2 = 1; -+ aSortData.nRow1 = 0; -+ aSortData.nRow2 = 2; -+ aSortData.maKeyState[0].bDoSort = true; -+ aSortData.maKeyState[0].nField = 1; -+ aSortData.maKeyState[0].bAscending = true; -+ -+ m_pDoc->Sort(0, aSortData, false, true, NULL, NULL); -+ -+ double nVal = m_pDoc->GetValue(1,0,0); -+ ASSERT_DOUBLES_EQUAL(nVal, 1.0); -+ -+ // check that note is also moved after sorting -+ pNote = m_pDoc->GetNote(1, 0, 0); -+ CPPUNIT_ASSERT(pNote); -+ -+ clearRange(m_pDoc, ScRange(0, 0, 0, 1, 9, 0)); // Clear A1:B10. -+ { -+ // 0 = empty cell -+ const char* aData[][1] = { -+ { "Title" }, -+ { 0 }, -+ { 0 }, -+ { "12" }, -+ { "b" }, -+ { "1" }, -+ { "9" }, -+ { "123" } -+ }; -+ -+ aDataRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); -+ CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aDataRange.aStart == aPos); -+ } -+ -+ aSortData.nCol1 = aDataRange.aStart.Col(); -+ aSortData.nCol2 = aDataRange.aEnd.Col(); -+ aSortData.nRow1 = aDataRange.aStart.Row(); -+ aSortData.nRow2 = aDataRange.aEnd.Row(); -+ aSortData.bHasHeader = true; -+ aSortData.maKeyState[0].nField = 0; -+ m_pDoc->Sort(0, aSortData, false, true, NULL, NULL); -+ -+ // Title should stay at the top, numbers should be sorted numerically, -+ // numbers always come before strings, and empty cells always occur at the -+ // end. -+ CPPUNIT_ASSERT_EQUAL(OUString("Title"), m_pDoc->GetString(aPos)); -+ aPos.IncRow(); -+ CPPUNIT_ASSERT_EQUAL(OUString("1"), m_pDoc->GetString(aPos)); -+ aPos.IncRow(); -+ CPPUNIT_ASSERT_EQUAL(OUString("9"), m_pDoc->GetString(aPos)); -+ aPos.IncRow(); -+ CPPUNIT_ASSERT_EQUAL(OUString("12"), m_pDoc->GetString(aPos)); -+ aPos.IncRow(); -+ CPPUNIT_ASSERT_EQUAL(OUString("123"), m_pDoc->GetString(aPos)); -+ aPos.IncRow(); -+ CPPUNIT_ASSERT_EQUAL(OUString("b"), m_pDoc->GetString(aPos)); -+ aPos.IncRow(); -+ CPPUNIT_ASSERT_EQUAL(CELLTYPE_NONE, m_pDoc->GetCellType(aPos)); -+ -+ m_pDoc->DeleteTab(0); -+} -+ -+void Test::testSortHorizontal() -+{ -+ ScFormulaOptions aOptions; -+ aOptions.SetFormulaSepArg(";"); -+ aOptions.SetFormulaSepArrayCol(";"); -+ aOptions.SetFormulaSepArrayRow("|"); -+ getDocShell().SetFormulaOptions(aOptions); -+ -+ sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); -+ m_pDoc->InsertTab(0, "Sort"); -+ -+ // Test case from fdo#78079. -+ -+ // 0 = empty cell -+ const char* aData[][4] = { -+ { "table", "has UNIQUE", "Publish to EC2", "flag" }, -+ { "w2gi.mobilehit", "Yes", "No", "=CONCATENATE(B2;\"-\";C2)" }, -+ { "w2gi.visitors", "No", "No", "=CONCATENATE(B3;\"-\";C3)" }, -+ { "w2gi.pagedimension", "Yes", "Yes", "=CONCATENATE(B4;\"-\";C4)" }, -+ }; -+ -+ // Insert raw data into A1:D4. -+ ScRange aDataRange = insertRangeData(m_pDoc, ScAddress(0,0,0), aData, SAL_N_ELEMENTS(aData)); -+ CPPUNIT_ASSERT_EQUAL(OUString("A1:D4"), aDataRange.Format(SCA_VALID)); -+ -+ // Check the formula values. -+ CPPUNIT_ASSERT_EQUAL(OUString("Yes-No"), m_pDoc->GetString(ScAddress(3,1,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("No-No"), m_pDoc->GetString(ScAddress(3,2,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("Yes-Yes"), m_pDoc->GetString(ScAddress(3,3,0))); -+ -+ // Define A1:D4 as sheet-local anonymous database range. -+ m_pDoc->SetAnonymousDBData( -+ 0, new ScDBData(STR_DB_LOCAL_NONAME, 0, 0, 0, 3, 3)); -+ -+ // Sort A1:D4 horizontally, ascending by row 1. -+ ScDBDocFunc aFunc(getDocShell()); -+ -+ ScSortParam aSortData; -+ aSortData.nCol1 = 0; -+ aSortData.nCol2 = 3; -+ aSortData.nRow1 = 0; -+ aSortData.nRow2 = 3; -+ aSortData.bHasHeader = true; -+ aSortData.bByRow = false; // Sort by column (in horizontal direction). -+ aSortData.bIncludePattern = true; -+ aSortData.maKeyState[0].bDoSort = true; -+ aSortData.maKeyState[0].nField = 0; -+ aSortData.maKeyState[0].bAscending = true; -+ bool bSorted = aFunc.Sort(0, aSortData, true, true, true); -+ CPPUNIT_ASSERT(bSorted); -+ -+ { -+ // Expected output table content. 0 = empty cell -+ const char* aOutputCheck[][4] = { -+ { "table", "flag", "has UNIQUE", "Publish to EC2" }, -+ { "w2gi.mobilehit", "Yes-No", "Yes", "No" }, -+ { "w2gi.visitors", "No-No", "No", "No" }, -+ { "w2gi.pagedimension", "Yes-Yes", "Yes", "Yes" }, -+ }; -+ -+ bool bSuccess = checkOutput<4>(m_pDoc, aDataRange, aOutputCheck, "Sorted by column with formula"); -+ CPPUNIT_ASSERT_MESSAGE("Table output check failed", bSuccess); -+ } -+ -+ if (!checkFormula(*m_pDoc, ScAddress(1,1,0), "CONCATENATE(C2;\"-\";D2)")) -+ CPPUNIT_FAIL("Wrong formula!"); -+ if (!checkFormula(*m_pDoc, ScAddress(1,2,0), "CONCATENATE(C3;\"-\";D3)")) -+ CPPUNIT_FAIL("Wrong formula!"); -+ if (!checkFormula(*m_pDoc, ScAddress(1,3,0), "CONCATENATE(C4;\"-\";D4)")) -+ CPPUNIT_FAIL("Wrong formula!"); -+ -+ m_pDoc->DeleteTab(0); -+} -+ -+void Test::testSortHorizontalWholeColumn() -+{ -+ sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); -+ m_pDoc->InsertTab(0, "Sort"); -+ -+ // 0 = empty cell -+ const char* aData[][5] = { -+ { "4", "2", "47", "a", "9" } -+ }; -+ -+ // Insert row data to C1:G1. -+ ScRange aSortRange = insertRangeData(m_pDoc, ScAddress(2,0,0), aData, SAL_N_ELEMENTS(aData)); -+ CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(2,0,0))); -+ CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(3,0,0))); -+ CPPUNIT_ASSERT_EQUAL(47.0, m_pDoc->GetValue(ScAddress(4,0,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("a"), m_pDoc->GetString(ScAddress(5,0,0))); -+ CPPUNIT_ASSERT_EQUAL(9.0, m_pDoc->GetValue(ScAddress(6,0,0))); -+ -+ // Extend the sort range to whole column. -+ aSortRange.aEnd.SetRow(MAXROW); -+ -+ SCCOL nCol1 = aSortRange.aStart.Col(); -+ SCCOL nCol2 = aSortRange.aEnd.Col(); -+ SCROW nRow1 = aSortRange.aStart.Row(); -+ SCROW nRow2 = aSortRange.aEnd.Row(); -+ -+ // Define C:G as sheet-local anonymous database range. -+ m_pDoc->SetAnonymousDBData( -+ 0, new ScDBData(STR_DB_LOCAL_NONAME, 0, nCol1, nRow1, nCol2, nRow2, false, false)); -+ -+ // Sort C:G horizontally ascending by row 1. -+ ScDBDocFunc aFunc(getDocShell()); -+ -+ ScSortParam aSortData; -+ aSortData.nCol1 = nCol1; -+ aSortData.nCol2 = nCol2; -+ aSortData.nRow1 = nRow1; -+ aSortData.nRow2 = nRow2; -+ aSortData.bHasHeader = false; -+ aSortData.bByRow = false; // Sort by column (in horizontal direction). -+ aSortData.bIncludePattern = true; -+ aSortData.maKeyState[0].bDoSort = true; -+ aSortData.maKeyState[0].nField = 0; -+ aSortData.maKeyState[0].bAscending = true; -+ bool bSorted = aFunc.Sort(0, aSortData, true, true, true); -+ CPPUNIT_ASSERT(bSorted); -+ -+ // Check the sort result. -+ CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(2,0,0))); -+ CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(3,0,0))); -+ CPPUNIT_ASSERT_EQUAL(9.0, m_pDoc->GetValue(ScAddress(4,0,0))); -+ CPPUNIT_ASSERT_EQUAL(47.0, m_pDoc->GetValue(ScAddress(5,0,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("a"), m_pDoc->GetString(ScAddress(6,0,0))); -+ -+ // Undo and check. -+ -+ SfxUndoManager* pUndoMgr = m_pDoc->GetUndoManager(); -+ CPPUNIT_ASSERT(pUndoMgr); -+ -+ pUndoMgr->Undo(); -+ CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(2,0,0))); -+ CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(3,0,0))); -+ CPPUNIT_ASSERT_EQUAL(47.0, m_pDoc->GetValue(ScAddress(4,0,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("a"), m_pDoc->GetString(ScAddress(5,0,0))); -+ CPPUNIT_ASSERT_EQUAL(9.0, m_pDoc->GetValue(ScAddress(6,0,0))); -+ -+ // Redo and check. -+ pUndoMgr->Redo(); -+ CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(2,0,0))); -+ CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(3,0,0))); -+ CPPUNIT_ASSERT_EQUAL(9.0, m_pDoc->GetValue(ScAddress(4,0,0))); -+ CPPUNIT_ASSERT_EQUAL(47.0, m_pDoc->GetValue(ScAddress(5,0,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("a"), m_pDoc->GetString(ScAddress(6,0,0))); -+ -+ m_pDoc->DeleteTab(0); -+} -+ -+void Test::testSortSingleRow() -+{ -+ // This test case is from fdo#80462. -+ -+ m_pDoc->InsertTab(0, "Test"); -+ -+ // Sort range consists of only one row. -+ m_pDoc->SetString(ScAddress(0,0,0), "X"); -+ m_pDoc->SetString(ScAddress(1,0,0), "Y"); -+ -+ // Define A1:B1 as sheet-local anonymous database range. -+ m_pDoc->SetAnonymousDBData( -+ 0, new ScDBData(STR_DB_LOCAL_NONAME, 0, 0, 0, 1, 0)); -+ -+ // Sort A1:B1 horizontally, ascending by row 1. -+ ScDBDocFunc aFunc(getDocShell()); -+ -+ ScSortParam aSortData; -+ aSortData.nCol1 = 0; -+ aSortData.nCol2 = 1; -+ aSortData.nRow1 = 0; -+ aSortData.nRow2 = 0; -+ aSortData.bHasHeader = true; -+ aSortData.bByRow = true; -+ aSortData.bIncludePattern = true; -+ aSortData.maKeyState[0].bDoSort = true; -+ aSortData.maKeyState[0].nField = 0; -+ aSortData.maKeyState[0].bAscending = true; -+ -+ // Do the sorting. This should not crash. -+ bool bSorted = aFunc.Sort(0, aSortData, true, true, true); -+ CPPUNIT_ASSERT(bSorted); -+ -+ // Another test case - single row horizontal sort with header column. -+ clearSheet(m_pDoc, 0); -+ -+ // A1:G1 -+ m_pDoc->SetString(ScAddress(0,0,0), "Header"); -+ m_pDoc->SetValue(ScAddress(1,0,0), 1.0); -+ m_pDoc->SetValue(ScAddress(2,0,0), 10.0); -+ m_pDoc->SetValue(ScAddress(3,0,0), 3.0); -+ m_pDoc->SetValue(ScAddress(4,0,0), 9.0); -+ m_pDoc->SetValue(ScAddress(5,0,0), 12.0); -+ m_pDoc->SetValue(ScAddress(6,0,0), 2.0); -+ -+ // Define A1:G1 as sheet-local anonymous database range. -+ m_pDoc->SetAnonymousDBData( -+ 0, new ScDBData(STR_DB_LOCAL_NONAME, 0, 0, 0, 6, 0, false, true)); -+ -+ // Update the sort data. -+ aSortData.nCol1 = 0; -+ aSortData.nCol2 = 6; -+ aSortData.bByRow = false; -+ bSorted = aFunc.Sort(0, aSortData, true, true, true); -+ CPPUNIT_ASSERT(bSorted); -+ -+ // Check the result. -+ CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(0,0,0))); -+ CPPUNIT_ASSERT_EQUAL( 1.0, m_pDoc->GetValue(ScAddress(1,0,0))); -+ CPPUNIT_ASSERT_EQUAL( 2.0, m_pDoc->GetValue(ScAddress(2,0,0))); -+ CPPUNIT_ASSERT_EQUAL( 3.0, m_pDoc->GetValue(ScAddress(3,0,0))); -+ CPPUNIT_ASSERT_EQUAL( 9.0, m_pDoc->GetValue(ScAddress(4,0,0))); -+ CPPUNIT_ASSERT_EQUAL(10.0, m_pDoc->GetValue(ScAddress(5,0,0))); -+ CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(ScAddress(6,0,0))); -+ -+ // Undo and check. -+ SfxUndoManager* pUndoMgr = m_pDoc->GetUndoManager(); -+ CPPUNIT_ASSERT(pUndoMgr); -+ pUndoMgr->Undo(); -+ -+ CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(0,0,0))); -+ CPPUNIT_ASSERT_EQUAL( 1.0, m_pDoc->GetValue(ScAddress(1,0,0))); -+ CPPUNIT_ASSERT_EQUAL(10.0, m_pDoc->GetValue(ScAddress(2,0,0))); -+ CPPUNIT_ASSERT_EQUAL( 3.0, m_pDoc->GetValue(ScAddress(3,0,0))); -+ CPPUNIT_ASSERT_EQUAL( 9.0, m_pDoc->GetValue(ScAddress(4,0,0))); -+ CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(ScAddress(5,0,0))); -+ CPPUNIT_ASSERT_EQUAL( 2.0, m_pDoc->GetValue(ScAddress(6,0,0))); -+ -+ // Redo and check. -+ pUndoMgr->Redo(); -+ CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(0,0,0))); -+ CPPUNIT_ASSERT_EQUAL( 1.0, m_pDoc->GetValue(ScAddress(1,0,0))); -+ CPPUNIT_ASSERT_EQUAL( 2.0, m_pDoc->GetValue(ScAddress(2,0,0))); -+ CPPUNIT_ASSERT_EQUAL( 3.0, m_pDoc->GetValue(ScAddress(3,0,0))); -+ CPPUNIT_ASSERT_EQUAL( 9.0, m_pDoc->GetValue(ScAddress(4,0,0))); -+ CPPUNIT_ASSERT_EQUAL(10.0, m_pDoc->GetValue(ScAddress(5,0,0))); -+ CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(ScAddress(6,0,0))); -+ -+ m_pDoc->DeleteTab(0); -+} -+ -+// regression test fo fdo#53814, sorting doens't work as expected -+// if cells in the sort are referenced by formulas -+void Test::testSortWithFormulaRefs() -+{ -+ m_pDoc->InsertTab(0, "List1"); -+ m_pDoc->InsertTab(1, "List2"); -+ -+ const char* aFormulaData[6] = { -+ "=IF($List1.A2<>\"\";$List1.A2;\"\")", -+ "=IF($List1.A3<>\"\";$List1.A3;\"\")", -+ "=IF($List1.A4<>\"\";$List1.A4;\"\")", -+ "=IF($List1.A5<>\"\";$List1.A5;\"\")", -+ "=IF($List1.A6<>\"\";$List1.A6;\"\")", -+ "=IF($List1.A7<>\"\";$List1.A7;\"\")", -+ }; -+ -+ const char* aTextData[4] = { -+ "bob", -+ "tim", -+ "brian", -+ "larry", -+ }; -+ -+ const char* aResults[6] = { -+ "bob", -+ "brian", -+ "larry", -+ "tim", -+ "", -+ "", -+ }; -+ -+ // Insert data to sort in A2:A5 on the 1st sheet. -+ for (SCROW i = 1; i <= 4; ++i) -+ m_pDoc->SetString( 0, i, 0, OUString::createFromAscii(aTextData[i-1]) ); -+ -+ // Insert forumulas in A1:A6 on the 2nd sheet. -+ for (size_t i = 0; i < SAL_N_ELEMENTS(aFormulaData); ++i) -+ m_pDoc->SetString( 0, i, 1, OUString::createFromAscii(aFormulaData[i]) ); -+ -+ // Sort data in A2:A8 on the 1st sheet. No column header. -+ ScSortParam aSortData; -+ aSortData.nCol1 = 0; -+ aSortData.nCol2 = 0; -+ aSortData.nRow1 = 1; -+ aSortData.nRow2 = 7; -+ aSortData.maKeyState[0].bDoSort = true; -+ aSortData.maKeyState[0].nField = 0; -+ -+ m_pDoc->Sort(0, aSortData, false, true, NULL, NULL); -+ -+ for (size_t i = 0; i < SAL_N_ELEMENTS(aResults); ++i) -+ { -+ OUString sResult = m_pDoc->GetString(0, i + 1, 0); -+ CPPUNIT_ASSERT_EQUAL( OUString::createFromAscii( aResults[i] ), sResult ); -+ } -+ m_pDoc->DeleteTab(1); -+ m_pDoc->DeleteTab(0); -+} -+ -+void Test::testSortWithStrings() -+{ -+ m_pDoc->InsertTab(0, "Test"); -+ -+ ScFieldEditEngine& rEE = m_pDoc->GetEditEngine(); -+ rEE.SetText("Val1"); -+ m_pDoc->SetString(ScAddress(1,1,0), "Header"); -+ m_pDoc->SetString(ScAddress(1,2,0), "Val2"); -+ m_pDoc->SetEditText(ScAddress(1,3,0), rEE.CreateTextObject()); -+ -+ CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(1,1,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("Val2"), m_pDoc->GetString(ScAddress(1,2,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("Val1"), m_pDoc->GetString(ScAddress(1,3,0))); -+ -+ ScSortParam aParam; -+ aParam.nCol1 = 1; -+ aParam.nCol2 = 1; -+ aParam.nRow1 = 1; -+ aParam.nRow2 = 3; -+ aParam.bHasHeader = true; -+ aParam.maKeyState[0].bDoSort = true; -+ aParam.maKeyState[0].bAscending = true; -+ aParam.maKeyState[0].nField = 1; -+ -+ m_pDoc->Sort(0, aParam, false, true, NULL, NULL); -+ -+ CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(1,1,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("Val1"), m_pDoc->GetString(ScAddress(1,2,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("Val2"), m_pDoc->GetString(ScAddress(1,3,0))); -+ -+ aParam.maKeyState[0].bAscending = false; -+ -+ m_pDoc->Sort(0, aParam, false, true, NULL, NULL); -+ -+ CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(1,1,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("Val2"), m_pDoc->GetString(ScAddress(1,2,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("Val1"), m_pDoc->GetString(ScAddress(1,3,0))); -+ -+ m_pDoc->DeleteTab(0); -+} -+ -+void Test::testSortInFormulaGroup() -+{ -+ static struct { -+ SCCOL nCol; -+ SCROW nRow; -+ const char *pData; -+ } aEntries[] = { -+ { 0, 0, "3" }, { 1, 0, "=A1" }, -+ { 0, 1, "1" }, { 1, 1, "=A2" }, -+ { 0, 2, "20" }, { 1, 2, "=A3" }, -+ { 0, 3, "10" }, { 1, 3, "=A4+1" }, // swap across groups -+ { 0, 4, "2" }, { 1, 4, "=A5+1" }, -+ { 0, 5, "101" }, { 1, 5, "=A6" }, // swap inside contiguious group -+ { 0, 6, "100" }, { 1, 6, "=A7" }, -+ { 0, 7, "102" }, { 1, 7, "=A8" }, -+ { 0, 8, "104" }, { 1, 8, "=A9" }, -+ { 0, 9, "103" }, { 1, 9, "=A10" }, -+ }; -+ -+ m_pDoc->InsertTab(0, "sorttest"); -+ -+ for ( SCROW i = 0; i < (SCROW) SAL_N_ELEMENTS( aEntries ); ++i ) -+ m_pDoc->SetString( aEntries[i].nCol, aEntries[i].nRow, 0, -+ OUString::createFromAscii( aEntries[i].pData) ); -+ -+ ScSortParam aSortData; -+ aSortData.nCol1 = 0; -+ aSortData.nCol2 = 1; -+ aSortData.nRow1 = 0; -+ aSortData.nRow2 = 9; -+ aSortData.maKeyState[0].bDoSort = true; -+ aSortData.maKeyState[0].nField = 0; -+ aSortData.maKeyState[0].bAscending = true; -+ -+ m_pDoc->Sort(0, aSortData, false, true, NULL, NULL); -+ -+ static struct { -+ SCCOL nCol; -+ SCROW nRow; -+ double fValue; -+ } aResults[] = { -+ { 0, 0, 1.0 }, { 1, 0, 1.0 }, -+ { 0, 1, 2.0 }, { 1, 1, 3.0 }, -+ { 0, 2, 3.0 }, { 1, 2, 3.0 }, -+ { 0, 3, 10.0 }, { 1, 3, 11.0 }, -+ { 0, 4, 20.0 }, { 1, 4, 20.0 }, -+ { 0, 5, 100.0 }, { 1, 5, 100.0 }, -+ { 0, 6, 101.0 }, { 1, 6, 101.0 }, -+ { 0, 7, 102.0 }, { 1, 7, 102.0 }, -+ { 0, 8, 103.0 }, { 1, 8, 103.0 }, -+ { 0, 9, 104.0 }, { 1, 9, 104.0 }, -+ }; -+ -+ for ( SCROW i = 0; i < (SCROW) SAL_N_ELEMENTS( aEntries ); ++i ) -+ { -+ double val = m_pDoc->GetValue( aEntries[i].nCol, aEntries[i].nRow, 0 ); -+// fprintf(stderr, "value at %d %d is %g = %g\n", -+// (int)aResults[i].nRow, (int)aResults[i].nCol, -+// val, aResults[i].fValue); -+ CPPUNIT_ASSERT_MESSAGE("Mis-matching value after sort.", -+ rtl::math::approxEqual(val, aResults[i].fValue)); -+ } -+ -+ m_pDoc->DeleteTab( 0 ); -+} -+ -+void Test::testSortWithCellFormats() -+{ -+ struct -+ { -+ bool isBold( const ScPatternAttr* pPat ) const -+ { -+ if (!pPat) -+ { -+ cerr << "Pattern is NULL!" << endl; -+ return false; -+ } -+ -+ const SfxPoolItem* pItem = NULL; -+ if (!pPat->GetItemSet().HasItem(ATTR_FONT_WEIGHT, &pItem)) -+ { -+ cerr << "Pattern does not have a font weight item, but it should." << endl; -+ return false; -+ } -+ -+ CPPUNIT_ASSERT(pItem); -+ -+ if (static_cast(pItem)->GetEnumValue() != WEIGHT_BOLD) -+ { -+ cerr << "Font weight should be bold." << endl; -+ return false; -+ } -+ -+ return true; -+ } -+ -+ bool isItalic( const ScPatternAttr* pPat ) const -+ { -+ if (!pPat) -+ { -+ cerr << "Pattern is NULL!" << endl; -+ return false; -+ } -+ -+ const SfxPoolItem* pItem = NULL; -+ if (!pPat->GetItemSet().HasItem(ATTR_FONT_POSTURE, &pItem)) -+ { -+ cerr << "Pattern does not have a font posture item, but it should." << endl; -+ return false; -+ } -+ -+ CPPUNIT_ASSERT(pItem); -+ -+ if (static_cast(pItem)->GetEnumValue() != ITALIC_NORMAL) -+ { -+ cerr << "Italic should be applied.." << endl; -+ return false; -+ } -+ -+ return true; -+ } -+ -+ bool isNormal( const ScPatternAttr* pPat ) const -+ { -+ if (!pPat) -+ { -+ cerr << "Pattern is NULL!" << endl; -+ return false; -+ } -+ -+ const SfxPoolItem* pItem = NULL; -+ if (pPat->GetItemSet().HasItem(ATTR_FONT_WEIGHT, &pItem)) -+ { -+ // Check if the font weight is applied. -+ if (static_cast(pItem)->GetEnumValue() == WEIGHT_BOLD) -+ { -+ cerr << "This cell is bold, but shouldn't." << endl; -+ return false; -+ } -+ } -+ -+ if (pPat->GetItemSet().HasItem(ATTR_FONT_POSTURE, &pItem)) -+ { -+ // Check if the italics is applied. -+ if (static_cast(pItem)->GetEnumValue() == ITALIC_NORMAL) -+ { -+ cerr << "This cell is bold, but shouldn't." << endl; -+ return false; -+ } -+ } -+ -+ return true; -+ } -+ -+ } aCheck; -+ -+ m_pDoc->InsertTab(0, "Test"); -+ -+ // Insert some values into A1:A4. -+ m_pDoc->SetString(ScAddress(0,0,0), "Header"); -+ m_pDoc->SetString(ScAddress(0,1,0), "Normal"); -+ m_pDoc->SetString(ScAddress(0,2,0), "Bold"); -+ m_pDoc->SetString(ScAddress(0,3,0), "Italic"); -+ -+ // Set A3 bold and A4 italic. -+ const ScPatternAttr* pPat = m_pDoc->GetPattern(ScAddress(0,2,0)); -+ CPPUNIT_ASSERT(pPat); -+ { -+ ScPatternAttr aNewPat(*pPat); -+ SfxItemSet& rSet = aNewPat.GetItemSet(); -+ rSet.Put(SvxWeightItem(WEIGHT_BOLD, ATTR_FONT_WEIGHT)); -+ m_pDoc->ApplyPattern(0, 2, 0, aNewPat); -+ -+ // Make sure it's really in. -+ bool bGood = aCheck.isBold(m_pDoc->GetPattern(ScAddress(0,2,0))); -+ CPPUNIT_ASSERT_MESSAGE("A3 is not bold but it should.", bGood); -+ } -+ -+ pPat = m_pDoc->GetPattern(ScAddress(0,3,0)); -+ CPPUNIT_ASSERT(pPat); -+ { -+ ScPatternAttr aNewPat(*pPat); -+ SfxItemSet& rSet = aNewPat.GetItemSet(); -+ rSet.Put(SvxPostureItem(ITALIC_NORMAL, ATTR_FONT_POSTURE)); -+ m_pDoc->ApplyPattern(0, 3, 0, aNewPat); -+ -+ bool bGood = aCheck.isItalic(m_pDoc->GetPattern(ScAddress(0,3,0))); -+ CPPUNIT_ASSERT_MESSAGE("A4 is not italic but it should.", bGood); -+ } -+ -+ // Define A1:A4 as sheet-local anonymous database range, else sort wouldn't run. -+ m_pDoc->SetAnonymousDBData( -+ 0, new ScDBData(STR_DB_LOCAL_NONAME, 0, 0, 0, 0, 3)); -+ -+ // Sort A1:A4 ascending with cell formats. -+ ScDBDocFunc aFunc(getDocShell()); -+ -+ ScSortParam aSortData; -+ aSortData.nCol1 = 0; -+ aSortData.nCol2 = 0; -+ aSortData.nRow1 = 0; -+ aSortData.nRow2 = 3; -+ aSortData.bHasHeader = true; -+ aSortData.bIncludePattern = true; -+ aSortData.maKeyState[0].bDoSort = true; -+ aSortData.maKeyState[0].nField = 0; -+ aSortData.maKeyState[0].bAscending = true; -+ bool bSorted = aFunc.Sort(0, aSortData, true, false, true); -+ CPPUNIT_ASSERT(bSorted); -+ -+ // Check the sort result. -+ CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(0,0,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("Bold"), m_pDoc->GetString(ScAddress(0,1,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("Italic"), m_pDoc->GetString(ScAddress(0,2,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("Normal"), m_pDoc->GetString(ScAddress(0,3,0))); -+ -+ // A2 should be bold now. -+ bool bBold = aCheck.isBold(m_pDoc->GetPattern(ScAddress(0,1,0))); -+ CPPUNIT_ASSERT_MESSAGE("A2 should be bold after the sort.", bBold); -+ -+ // and A3 should be italic. -+ bool bItalic = aCheck.isItalic(m_pDoc->GetPattern(ScAddress(0,2,0))); -+ CPPUNIT_ASSERT_MESSAGE("A3 should be italic.", bItalic); -+ -+ // A4 should have neither bold nor italic. -+ bool bNormal = aCheck.isNormal(m_pDoc->GetPattern(ScAddress(0,3,0))); -+ CPPUNIT_ASSERT_MESSAGE("A4 should be neither bold nor italic.", bNormal); -+ -+ m_pDoc->DeleteTab(0); -+} -+ -+void Test::testSortRefUpdate() -+{ -+ sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on. -+ FormulaGrammarSwitch aFGSwitch(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1); -+ -+ m_pDoc->InsertTab(0, "Sort"); -+ -+ // Set values to sort in column A. -+ m_pDoc->SetString(ScAddress(0,0,0), "Header"); -+ -+ double aValues[] = { 4.0, 36.0, 14.0, 29.0, 98.0, 78.0, 0.0, 99.0, 1.0 }; -+ size_t nCount = SAL_N_ELEMENTS(aValues); -+ for (size_t i = 0; i < nCount; ++i) -+ m_pDoc->SetValue(ScAddress(0,i+1,0), aValues[i]); -+ -+ // Set formulas to reference these values in column C. -+ m_pDoc->SetString(ScAddress(2,0,0), "Formula"); -+ for (size_t i = 0; i < nCount; ++i) -+ m_pDoc->SetString(ScAddress(2,1+i,0), "=RC[-2]"); -+ -+ // Check the values in column C. -+ for (size_t i = 0; i < nCount; ++i) -+ { -+ double fCheck = aValues[i]; -+ CPPUNIT_ASSERT_EQUAL(fCheck, m_pDoc->GetValue(ScAddress(2,i+1,0))); -+ } -+ -+ ScDBDocFunc aFunc(getDocShell()); -+ -+ // Define A1:A10 as sheet-local anonymous database range, else sort wouldn't run. -+ m_pDoc->SetAnonymousDBData( -+ 0, new ScDBData(STR_DB_LOCAL_NONAME, 0, 0, 0, 0, 9)); -+ -+ // Sort A1:A10 (with a header row). -+ ScSortParam aSortData; -+ aSortData.nCol1 = 0; -+ aSortData.nCol2 = 0; -+ aSortData.nRow1 = 0; -+ aSortData.nRow2 = 9; -+ aSortData.bHasHeader = true; -+ aSortData.maKeyState[0].bDoSort = true; -+ aSortData.maKeyState[0].nField = 0; -+ aSortData.maKeyState[0].bAscending = true; -+ bool bSorted = aFunc.Sort(0, aSortData, true, true, true); -+ CPPUNIT_ASSERT(bSorted); -+ -+ double aSorted[] = { 0.0, 1.0, 4.0, 14.0, 29.0, 36.0, 78.0, 98.0, 99.0 }; -+ -+ // Check the sort result. -+ CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(0,0,0))); -+ for (size_t i = 0; i < nCount; ++i) -+ { -+ double fCheck = aSorted[i]; -+ CPPUNIT_ASSERT_EQUAL(fCheck, m_pDoc->GetValue(ScAddress(0,i+1,0))); -+ } -+ -+ // Sorting should not alter the values in column C. -+ m_pDoc->CalcAll(); // just in case... -+ for (size_t i = 0; i < nCount; ++i) -+ { -+ double fCheck = aValues[i]; -+ CPPUNIT_ASSERT_EQUAL(fCheck, m_pDoc->GetValue(ScAddress(2,i+1,0))); -+ } -+ -+ // C2 should now point to A4. -+ if (!checkFormula(*m_pDoc, ScAddress(2,1,0), "R[2]C[-2]")) -+ CPPUNIT_FAIL("Wrong formula in C2!"); -+ -+ // Undo the sort. -+ SfxUndoManager* pUndoMgr = m_pDoc->GetUndoManager(); -+ pUndoMgr->Undo(); -+ -+ // Check the undo result. -+ CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(0,0,0))); -+ for (size_t i = 0; i < nCount; ++i) -+ { -+ double fCheck = aValues[i]; -+ CPPUNIT_ASSERT_EQUAL(fCheck, m_pDoc->GetValue(ScAddress(0,i+1,0))); -+ } -+ -+ // Values in column C should still be unaltered. -+ m_pDoc->CalcAll(); // just in case... -+ for (size_t i = 0; i < nCount; ++i) -+ { -+ double fCheck = aValues[i]; -+ CPPUNIT_ASSERT_EQUAL(fCheck, m_pDoc->GetValue(ScAddress(2,i+1,0))); -+ } -+ -+ // C2 should now point to A2. -+ if (!checkFormula(*m_pDoc, ScAddress(2,1,0), "RC[-2]")) -+ CPPUNIT_FAIL("Wrong formula in C2!"); -+ -+ // Redo. -+ pUndoMgr->Redo(); -+ -+ CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(0,0,0))); -+ for (size_t i = 0; i < nCount; ++i) -+ { -+ double fCheck = aSorted[i]; -+ CPPUNIT_ASSERT_EQUAL(fCheck, m_pDoc->GetValue(ScAddress(0,i+1,0))); -+ } -+ -+ // Sorting should not alter the values in column C. -+ m_pDoc->CalcAll(); // just in case... -+ for (size_t i = 0; i < nCount; ++i) -+ { -+ double fCheck = aValues[i]; -+ CPPUNIT_ASSERT_EQUAL(fCheck, m_pDoc->GetValue(ScAddress(2,i+1,0))); -+ } -+ -+ // C2 should now point to A4. -+ if (!checkFormula(*m_pDoc, ScAddress(2,1,0), "R[2]C[-2]")) -+ CPPUNIT_FAIL("Wrong formula in C2!"); -+ -+ // Undo again. -+ pUndoMgr->Undo(); -+ -+ // Formulas in column C should all be "RC[-2]" again. -+ for (size_t i = 0; i < nCount; ++i) -+ m_pDoc->SetString(ScAddress(2,1+i,0), "=RC[-2]"); -+ -+ // Turn off reference update on sort. -+ ScInputOptions aInputOption = SC_MOD()->GetInputOptions(); -+ aInputOption.SetSortRefUpdate(false); -+ -+ bSorted = aFunc.Sort(0, aSortData, true, true, true); -+ CPPUNIT_ASSERT(bSorted); -+ -+ // Check the sort result again. -+ CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(0,0,0))); -+ for (size_t i = 0; i < nCount; ++i) -+ { -+ double fCheck = aSorted[i]; -+ CPPUNIT_ASSERT_EQUAL(fCheck, m_pDoc->GetValue(ScAddress(0,i+1,0))); -+ } -+ -+ // Formulas in column C should all remain "RC[-2]". -+ for (size_t i = 0; i < nCount; ++i) -+ m_pDoc->SetString(ScAddress(2,1+i,0), "=RC[-2]"); -+ -+ // The values in column C should now be the same as sorted values in column A. -+ m_pDoc->CalcAll(); // just in case... -+ for (size_t i = 0; i < nCount; ++i) -+ { -+ double fCheck = aSorted[i]; -+ CPPUNIT_ASSERT_EQUAL(fCheck, m_pDoc->GetValue(ScAddress(2,i+1,0))); // column C -+ } -+ -+ // Turn it back on. -+ aInputOption.SetSortRefUpdate(true); -+ -+ m_pDoc->DeleteTab(0); -+} -+ -+void Test::testSortRefUpdate2() -+{ -+ sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on. -+ FormulaGrammarSwitch aFGSwitch(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1); -+ -+ m_pDoc->InsertTab(0, "Sort"); -+ -+ // Set up the sheet. -+ const char* aData[][2] = { -+ { "F1", "F2" }, -+ { "9", "=RC[-1]" }, -+ { "2", "=RC[-1]" }, -+ { "6", "=RC[-1]" }, -+ { "4", "=RC[-1]" }, -+ { 0, 0 } // terminator -+ }; -+ -+ for (SCROW i = 0; aData[i][0]; ++i) -+ { -+ m_pDoc->SetString(0, i, 0, OUString::createFromAscii(aData[i][0])); -+ m_pDoc->SetString(1, i, 0, OUString::createFromAscii(aData[i][1])); -+ } -+ -+ // Check the values in B2:B5. -+ CPPUNIT_ASSERT_EQUAL(9.0, m_pDoc->GetValue(ScAddress(1,1,0))); -+ CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(1,2,0))); -+ CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(1,3,0))); -+ CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(1,4,0))); -+ -+ ScDBDocFunc aFunc(getDocShell()); -+ -+ // Define A1:B5 as sheet-local anonymous database range, else sort wouldn't run. -+ m_pDoc->SetAnonymousDBData( -+ 0, new ScDBData(STR_DB_LOCAL_NONAME, 0, 0, 0, 1, 4)); -+ -+ // Sort A1:B5 by column A (with a row header). -+ ScSortParam aSortData; -+ aSortData.nCol1 = 0; -+ aSortData.nCol2 = 1; -+ aSortData.nRow1 = 0; -+ aSortData.nRow2 = 4; -+ aSortData.bHasHeader = true; -+ aSortData.maKeyState[0].bDoSort = true; -+ aSortData.maKeyState[0].nField = 0; -+ aSortData.maKeyState[0].bAscending = true; -+ bool bSorted = aFunc.Sort(0, aSortData, true, true, true); -+ CPPUNIT_ASSERT(bSorted); -+ -+ // Check the sort result in column A. -+ CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(0,1,0))); -+ CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(0,2,0))); -+ CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(0,3,0))); -+ CPPUNIT_ASSERT_EQUAL(9.0, m_pDoc->GetValue(ScAddress(0,4,0))); -+ -+ // and column B. -+ CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(1,1,0))); -+ CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(1,2,0))); -+ CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(1,3,0))); -+ CPPUNIT_ASSERT_EQUAL(9.0, m_pDoc->GetValue(ScAddress(1,4,0))); -+ -+ // Formulas in column B should still point to their respective left neighbor cell. -+ for (SCROW i = 1; i <= 4; ++i) -+ { -+ if (!checkFormula(*m_pDoc, ScAddress(1,i,0), "RC[-1]")) -+ CPPUNIT_FAIL("Wrong formula!"); -+ } -+ -+ // Undo and check the result in column B. -+ SfxUndoManager* pUndoMgr = m_pDoc->GetUndoManager(); -+ pUndoMgr->Undo(); -+ -+ CPPUNIT_ASSERT_EQUAL(9.0, m_pDoc->GetValue(ScAddress(1,1,0))); -+ CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(1,2,0))); -+ CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(1,3,0))); -+ CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(1,4,0))); -+ -+ // and redo. -+ pUndoMgr->Redo(); -+ -+ CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(ScAddress(1,1,0))); -+ CPPUNIT_ASSERT_EQUAL(4.0, m_pDoc->GetValue(ScAddress(1,2,0))); -+ CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(1,3,0))); -+ CPPUNIT_ASSERT_EQUAL(9.0, m_pDoc->GetValue(ScAddress(1,4,0))); -+ -+ m_pDoc->DeleteTab(0); -+} -+ -+void Test::testSortRefUpdate3() -+{ -+ sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on. -+ m_pDoc->InsertTab(0, "Sort"); -+ -+ const char* pData[] = { -+ "Header", -+ "1", -+ "=A2+10", -+ "2", -+ "=A4+10", -+ "=A2+A4", -+ 0 // terminator -+ }; -+ -+ for (SCROW i = 0; pData[i]; ++i) -+ m_pDoc->SetString(ScAddress(0,i,0), OUString::createFromAscii(pData[i])); -+ -+ // Check the initial values. -+ CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(0,0,0))); -+ CPPUNIT_ASSERT_EQUAL( 1.0, m_pDoc->GetValue(ScAddress(0,1,0))); -+ CPPUNIT_ASSERT_EQUAL(11.0, m_pDoc->GetValue(ScAddress(0,2,0))); -+ CPPUNIT_ASSERT_EQUAL( 2.0, m_pDoc->GetValue(ScAddress(0,3,0))); -+ CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(ScAddress(0,4,0))); -+ CPPUNIT_ASSERT_EQUAL( 3.0, m_pDoc->GetValue(ScAddress(0,5,0))); -+ -+ ScDBDocFunc aFunc(getDocShell()); -+ -+ // Sort A1:A6. -+ m_pDoc->SetAnonymousDBData( -+ 0, new ScDBData(STR_DB_LOCAL_NONAME, 0, 0, 0, 0, 5)); -+ -+ // Sort A1:A6 by column A (with a row header). -+ ScSortParam aSortData; -+ aSortData.nCol1 = 0; -+ aSortData.nCol2 = 0; -+ aSortData.nRow1 = 0; -+ aSortData.nRow2 = 5; -+ aSortData.bHasHeader = true; -+ aSortData.maKeyState[0].bDoSort = true; -+ aSortData.maKeyState[0].nField = 0; -+ aSortData.maKeyState[0].bAscending = true; -+ bool bSorted = aFunc.Sort(0, aSortData, true, true, true); -+ CPPUNIT_ASSERT(bSorted); -+ -+ // Check the sorted values. -+ m_pDoc->CalcAll(); -+ CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(0,0,0))); -+ CPPUNIT_ASSERT_EQUAL( 1.0, m_pDoc->GetValue(ScAddress(0,1,0))); -+ CPPUNIT_ASSERT_EQUAL( 2.0, m_pDoc->GetValue(ScAddress(0,2,0))); -+ CPPUNIT_ASSERT_EQUAL( 3.0, m_pDoc->GetValue(ScAddress(0,3,0))); -+ CPPUNIT_ASSERT_EQUAL(11.0, m_pDoc->GetValue(ScAddress(0,4,0))); -+ CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(ScAddress(0,5,0))); -+ -+ // Make sure the formula cells have been adjusted correctly. -+ if (!checkFormula(*m_pDoc, ScAddress(0,3,0), "A2+A3")) -+ CPPUNIT_FAIL("Wrong formula in A4."); -+ if (!checkFormula(*m_pDoc, ScAddress(0,4,0), "A2+10")) -+ CPPUNIT_FAIL("Wrong formula in A5."); -+ if (!checkFormula(*m_pDoc, ScAddress(0,5,0), "A3+10")) -+ CPPUNIT_FAIL("Wrong formula in A6."); -+ -+ // Undo and check the result. -+ SfxUndoManager* pUndoMgr = m_pDoc->GetUndoManager(); -+ pUndoMgr->Undo(); -+ m_pDoc->CalcAll(); -+ CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(0,0,0))); -+ CPPUNIT_ASSERT_EQUAL( 1.0, m_pDoc->GetValue(ScAddress(0,1,0))); -+ CPPUNIT_ASSERT_EQUAL(11.0, m_pDoc->GetValue(ScAddress(0,2,0))); -+ CPPUNIT_ASSERT_EQUAL( 2.0, m_pDoc->GetValue(ScAddress(0,3,0))); -+ CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(ScAddress(0,4,0))); -+ CPPUNIT_ASSERT_EQUAL( 3.0, m_pDoc->GetValue(ScAddress(0,5,0))); -+ -+ // Redo and check the result. -+ pUndoMgr->Redo(); -+ m_pDoc->CalcAll(); -+ CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(0,0,0))); -+ CPPUNIT_ASSERT_EQUAL( 1.0, m_pDoc->GetValue(ScAddress(0,1,0))); -+ CPPUNIT_ASSERT_EQUAL( 2.0, m_pDoc->GetValue(ScAddress(0,2,0))); -+ CPPUNIT_ASSERT_EQUAL( 3.0, m_pDoc->GetValue(ScAddress(0,3,0))); -+ CPPUNIT_ASSERT_EQUAL(11.0, m_pDoc->GetValue(ScAddress(0,4,0))); -+ CPPUNIT_ASSERT_EQUAL(12.0, m_pDoc->GetValue(ScAddress(0,5,0))); -+ -+ m_pDoc->DeleteTab(0); -+} -+ -+// Derived from fdo#79441 https://bugs.freedesktop.org/attachment.cgi?id=100144 -+// testRefInterne.ods -+void Test::testSortRefUpdate4() -+{ -+ sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on. -+ m_pDoc->InsertTab(0, "Sort"); -+ m_pDoc->InsertTab(1, "Lesson1"); -+ m_pDoc->InsertTab(2, "Lesson2"); -+ -+ ScRange aLesson1Range; -+ { -+ const char* aData[][2] = { -+ { "Name", "Note" }, -+ { "Student1", "1" }, -+ { "Student2", "2" }, -+ { "Student3", "3" }, -+ { "Student4", "4" }, -+ { "Student5", "5" }, -+ }; -+ -+ SCTAB nTab = 1; -+ ScAddress aPos(0,0,nTab); -+ clearRange(m_pDoc, ScRange(0, 0, nTab, 1, SAL_N_ELEMENTS(aData), nTab)); -+ aLesson1Range = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); -+ CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aLesson1Range.aStart == aPos); -+ } -+ -+ ScRange aLesson2Range; -+ { -+ const char* aData[][2] = { -+ { "Name", "Note" }, -+ { "=Lesson1.A2", "3" }, -+ { "=Lesson1.A3", "4" }, -+ { "=Lesson1.A4", "9" }, -+ { "=Lesson1.A5", "6" }, -+ { "=Lesson1.A6", "3" }, -+ }; -+ -+ SCTAB nTab = 2; -+ ScAddress aPos(0,0,nTab); -+ clearRange(m_pDoc, ScRange(0, 0, nTab, 1, SAL_N_ELEMENTS(aData), nTab)); -+ aLesson2Range = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); -+ CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aLesson2Range.aStart == aPos); -+ } -+ -+ ScRange aSortRange; -+ { -+ const char* aData[][4] = { -+ { "Name", "Lesson1", "Lesson2", "Average" }, -+ { "=Lesson1.A2", "=Lesson1.B2", "=Lesson2.B2", "=AVERAGE(B2:C2)" }, -+ { "=Lesson1.A3", "=Lesson1.B3", "=Lesson2.B3", "=AVERAGE(B3:C3)" }, -+ { "=Lesson1.A4", "=Lesson1.B4", "=Lesson2.B4", "=AVERAGE(B4:C4)" }, -+ { "=Lesson1.A5", "=Lesson1.B5", "=Lesson2.B5", "=AVERAGE(B5:C5)" }, -+ { "=Lesson1.A6", "=Lesson1.B6", "=Lesson2.B6", "=AVERAGE(B6:C6)" }, -+ }; -+ -+ SCTAB nTab = 0; -+ ScAddress aPos(0,0,nTab); -+ clearRange(m_pDoc, ScRange(0, 0, nTab, 1, SAL_N_ELEMENTS(aData), nTab)); -+ aSortRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); -+ CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aSortRange.aStart == aPos); -+ } -+ -+ ScDBDocFunc aFunc(getDocShell()); -+ -+ // Sort A1:D6 by column D (Average, with a row header). -+ { -+ ScSortParam aSortData; -+ aSortData.nCol1 = aSortRange.aStart.Col(); -+ aSortData.nCol2 = aSortRange.aEnd.Col(); -+ aSortData.nRow1 = aSortRange.aStart.Row(); -+ aSortData.nRow2 = aSortRange.aEnd.Row(); -+ aSortData.bHasHeader = true; -+ aSortData.maKeyState[0].bDoSort = true; // sort on -+ aSortData.maKeyState[0].nField = 3; // Average -+ aSortData.maKeyState[0].bAscending = false; // descending -+ -+ m_pDoc->SetAnonymousDBData( 0, new ScDBData( STR_DB_LOCAL_NONAME, aSortRange.aStart.Tab(), -+ aSortData.nCol1, aSortData.nRow1, aSortData.nCol2, aSortData.nRow2)); -+ -+ bool bSorted = aFunc.Sort(0, aSortData, true, true, true); -+ CPPUNIT_ASSERT(bSorted); -+ -+ // Check the sorted values. -+ m_pDoc->CalcAll(); -+ CPPUNIT_ASSERT_EQUAL(OUString("Name"), m_pDoc->GetString(ScAddress(0,0,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("Student3"), m_pDoc->GetString(ScAddress(0,1,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("Student4"), m_pDoc->GetString(ScAddress(0,2,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("Student5"), m_pDoc->GetString(ScAddress(0,3,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("Student2"), m_pDoc->GetString(ScAddress(0,4,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("Student1"), m_pDoc->GetString(ScAddress(0,5,0))); -+ CPPUNIT_ASSERT_EQUAL( 6.0, m_pDoc->GetValue(ScAddress(3,1,0))); -+ CPPUNIT_ASSERT_EQUAL( 5.0, m_pDoc->GetValue(ScAddress(3,2,0))); -+ CPPUNIT_ASSERT_EQUAL( 4.0, m_pDoc->GetValue(ScAddress(3,3,0))); -+ CPPUNIT_ASSERT_EQUAL( 3.0, m_pDoc->GetValue(ScAddress(3,4,0))); -+ CPPUNIT_ASSERT_EQUAL( 2.0, m_pDoc->GetValue(ScAddress(3,5,0))); -+ -+ // Make sure the formula cells have been adjusted correctly. -+ const char* aCheck[][4] = { -+ // Name Lesson1 Lesson2 Average -+ { "Lesson1.A4", "Lesson1.B4", "Lesson2.B4", "AVERAGE(B2:C2)" }, -+ { "Lesson1.A5", "Lesson1.B5", "Lesson2.B5", "AVERAGE(B3:C3)" }, -+ { "Lesson1.A6", "Lesson1.B6", "Lesson2.B6", "AVERAGE(B4:C4)" }, -+ { "Lesson1.A3", "Lesson1.B3", "Lesson2.B3", "AVERAGE(B5:C5)" }, -+ { "Lesson1.A2", "Lesson1.B2", "Lesson2.B2", "AVERAGE(B6:C6)" }, -+ }; -+ for (SCROW nRow=0; nRow < static_cast(SAL_N_ELEMENTS(aCheck)); ++nRow) -+ { -+ for (SCCOL nCol=0; nCol < 4; ++nCol) -+ { -+ if (!checkFormula(*m_pDoc, ScAddress(nCol,nRow+1,0), aCheck[nRow][nCol])) -+ CPPUNIT_FAIL(OString("Wrong formula in " + OString('A'+nCol) + OString::number(nRow+2) + ".").getStr()); -+ } -+ } -+ -+ // Undo and check the result. -+ SfxUndoManager* pUndoMgr = m_pDoc->GetUndoManager(); -+ pUndoMgr->Undo(); -+ m_pDoc->CalcAll(); -+ CPPUNIT_ASSERT_EQUAL(OUString("Name"), m_pDoc->GetString(ScAddress(0,0,0))); -+ CPPUNIT_ASSERT_EQUAL( 2.0, m_pDoc->GetValue(ScAddress(3,1,0))); -+ CPPUNIT_ASSERT_EQUAL( 3.0, m_pDoc->GetValue(ScAddress(3,2,0))); -+ CPPUNIT_ASSERT_EQUAL( 6.0, m_pDoc->GetValue(ScAddress(3,3,0))); -+ CPPUNIT_ASSERT_EQUAL( 5.0, m_pDoc->GetValue(ScAddress(3,4,0))); -+ CPPUNIT_ASSERT_EQUAL( 4.0, m_pDoc->GetValue(ScAddress(3,5,0))); -+ -+ // Redo and check the result. -+ pUndoMgr->Redo(); -+ m_pDoc->CalcAll(); -+ CPPUNIT_ASSERT_EQUAL(OUString("Name"), m_pDoc->GetString(ScAddress(0,0,0))); -+ CPPUNIT_ASSERT_EQUAL( 6.0, m_pDoc->GetValue(ScAddress(3,1,0))); -+ CPPUNIT_ASSERT_EQUAL( 5.0, m_pDoc->GetValue(ScAddress(3,2,0))); -+ CPPUNIT_ASSERT_EQUAL( 4.0, m_pDoc->GetValue(ScAddress(3,3,0))); -+ CPPUNIT_ASSERT_EQUAL( 3.0, m_pDoc->GetValue(ScAddress(3,4,0))); -+ CPPUNIT_ASSERT_EQUAL( 2.0, m_pDoc->GetValue(ScAddress(3,5,0))); -+ } -+ -+ // Sort A2:AMJ6 by column A (Name, without header). -+ { -+ ScSortParam aSortData; -+ aSortData.nCol1 = 0; -+ aSortData.nCol2 = MAXCOL; -+ aSortData.nRow1 = aSortRange.aStart.Row()+1; -+ aSortData.nRow2 = aSortRange.aEnd.Row(); -+ aSortData.bHasHeader = false; -+ aSortData.maKeyState[0].bDoSort = true; // sort on -+ aSortData.maKeyState[0].nField = 0; // Name -+ aSortData.maKeyState[0].bAscending = false; // descending -+ -+ m_pDoc->SetAnonymousDBData( 0, new ScDBData( STR_DB_LOCAL_NONAME, aSortRange.aStart.Tab(), -+ aSortData.nCol1, aSortData.nRow1, aSortData.nCol2, aSortData.nRow2)); -+ -+ bool bSorted = aFunc.Sort(0, aSortData, true, true, true); -+ CPPUNIT_ASSERT(bSorted); -+ -+ // Check the sorted values. -+ m_pDoc->CalcAll(); -+ CPPUNIT_ASSERT_EQUAL(OUString("Name"), m_pDoc->GetString(ScAddress(0,0,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("Student5"), m_pDoc->GetString(ScAddress(0,1,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("Student4"), m_pDoc->GetString(ScAddress(0,2,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("Student3"), m_pDoc->GetString(ScAddress(0,3,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("Student2"), m_pDoc->GetString(ScAddress(0,4,0))); -+ CPPUNIT_ASSERT_EQUAL(OUString("Student1"), m_pDoc->GetString(ScAddress(0,5,0))); -+ CPPUNIT_ASSERT_EQUAL( 4.0, m_pDoc->GetValue(ScAddress(3,1,0))); -+ CPPUNIT_ASSERT_EQUAL( 5.0, m_pDoc->GetValue(ScAddress(3,2,0))); -+ CPPUNIT_ASSERT_EQUAL( 6.0, m_pDoc->GetValue(ScAddress(3,3,0))); -+ CPPUNIT_ASSERT_EQUAL( 3.0, m_pDoc->GetValue(ScAddress(3,4,0))); -+ CPPUNIT_ASSERT_EQUAL( 2.0, m_pDoc->GetValue(ScAddress(3,5,0))); -+ -+ // Make sure the formula cells have been adjusted correctly. -+ const char* aCheck[][4] = { -+ // Name Lesson1 Lesson2 Average -+ { "Lesson1.A6", "Lesson1.B6", "Lesson2.B6", "AVERAGE(B2:C2)" }, -+ { "Lesson1.A5", "Lesson1.B5", "Lesson2.B5", "AVERAGE(B3:C3)" }, -+ { "Lesson1.A4", "Lesson1.B4", "Lesson2.B4", "AVERAGE(B4:C4)" }, -+ { "Lesson1.A3", "Lesson1.B3", "Lesson2.B3", "AVERAGE(B5:C5)" }, -+ { "Lesson1.A2", "Lesson1.B2", "Lesson2.B2", "AVERAGE(B6:C6)" }, -+ }; -+ for (SCROW nRow=0; nRow < static_cast(SAL_N_ELEMENTS(aCheck)); ++nRow) -+ { -+ for (SCCOL nCol=0; nCol < 4; ++nCol) -+ { -+ if (!checkFormula(*m_pDoc, ScAddress(nCol,nRow+1,0), aCheck[nRow][nCol])) -+ CPPUNIT_FAIL(OString("Wrong formula in " + OString('A'+nCol) + OString::number(nRow+2) + ".").getStr()); -+ } -+ } -+ } -+ -+ m_pDoc->DeleteTab(2); -+ m_pDoc->DeleteTab(1); -+ m_pDoc->DeleteTab(0); -+} -+ -+// Make sure the refupdate works also with volatile cells, see fdo#83067 -+/* FIXME: this test is not roll-over-midnight safe and will fail then! We may -+ * want to have something different, but due to the nature of volatile -+ * functions it's not that easy to come up with something reproducible staying -+ * stable over sorts.. ;-) Check for time and don't run test a few seconds -+ * before midnight, ermm.. */ -+void Test::testSortRefUpdate5() -+{ -+ sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on. -+ m_pDoc->InsertTab(0, "Sort"); -+ -+ double aValCheck[][3] = { -+ // Result, Unsorted order, Sorted result. -+ { 0, 4, 0 }, -+ { 0, 1, 0 }, -+ { 0, 3, 0 }, -+ { 0, 2, 0 }, -+ }; -+ ScRange aSortRange; -+ { -+ const char* aData[][3] = { -+ { "Date", "Volatile", "Order" }, -+ { "1999-05-05", "=TODAY()-$A2", "4" }, -+ { "1994-10-18", "=TODAY()-$A3", "1" }, -+ { "1996-06-30", "=TODAY()-$A4", "3" }, -+ { "1995-11-21", "=TODAY()-$A5", "2" }, -+ }; -+ -+ SCTAB nTab = 0; -+ ScAddress aPos(0,0,nTab); -+ clearRange(m_pDoc, ScRange(0, 0, nTab, 2, SAL_N_ELEMENTS(aData), nTab)); -+ aSortRange = insertRangeData(m_pDoc, aPos, aData, SAL_N_ELEMENTS(aData)); -+ CPPUNIT_ASSERT_MESSAGE("failed to insert range data at correct position", aSortRange.aStart == aPos); -+ -+ // Actual results and expected sorted results. -+ for (SCROW nRow=0; nRow < static_cast(SAL_N_ELEMENTS(aValCheck)); ++nRow) -+ { -+ double fVal = m_pDoc->GetValue(ScAddress(1,nRow+1,0)); -+ aValCheck[nRow][0] = fVal; -+ aValCheck[static_cast(aValCheck[nRow][1])-1][2] = fVal; -+ } -+ } -+ -+ ScDBDocFunc aFunc(getDocShell()); -+ -+ // Sort A1:B5. -+ m_pDoc->SetAnonymousDBData( 0, new ScDBData( STR_DB_LOCAL_NONAME, aSortRange.aStart.Tab(), -+ aSortRange.aStart.Col(), aSortRange.aStart.Row(), aSortRange.aEnd.Col(), aSortRange.aEnd.Row())); -+ -+ // Sort by column A. -+ ScSortParam aSortData; -+ aSortData.nCol1 = aSortRange.aStart.Col(); -+ aSortData.nCol2 = aSortRange.aEnd.Col(); -+ aSortData.nRow1 = aSortRange.aStart.Row(); -+ aSortData.nRow2 = aSortRange.aEnd.Row(); -+ aSortData.bHasHeader = true; -+ aSortData.maKeyState[0].bDoSort = true; // sort on -+ aSortData.maKeyState[0].nField = 0; // Date -+ aSortData.maKeyState[0].bAscending = true; // ascending -+ bool bSorted = aFunc.Sort(0, aSortData, true, true, true); -+ CPPUNIT_ASSERT(bSorted); -+ -+ // Check the sorted values. -+ m_pDoc->CalcAll(); -+ for (SCROW nRow=0; nRow < static_cast(SAL_N_ELEMENTS(aValCheck)); ++nRow) -+ { -+ size_t i = static_cast(m_pDoc->GetValue(ScAddress(2,nRow+1,0))); // order 1..4 -+ CPPUNIT_ASSERT_EQUAL( static_cast(nRow+1), i); -+ CPPUNIT_ASSERT_EQUAL( aValCheck[i-1][2], m_pDoc->GetValue(ScAddress(1,nRow+1,0))); -+ } -+ -+ // Make sure the formula cells have been adjusted correctly. -+ const char* aFormulaCheck[] = { -+ // Volatile -+ "TODAY()-$A2", -+ "TODAY()-$A3", -+ "TODAY()-$A4", -+ "TODAY()-$A5", -+ }; -+ for (SCROW nRow=0; nRow < static_cast(SAL_N_ELEMENTS(aFormulaCheck)); ++nRow) -+ { -+ if (!checkFormula(*m_pDoc, ScAddress(1,nRow+1,0), aFormulaCheck[nRow])) -+ CPPUNIT_FAIL(OString("Wrong formula in B" + OString::number(nRow+2) + ".").getStr()); -+ } -+ -+ // Undo and check the result. -+ SfxUndoManager* pUndoMgr = m_pDoc->GetUndoManager(); -+ pUndoMgr->Undo(); -+ m_pDoc->CalcAll(); -+ for (SCROW nRow=0; nRow < static_cast(SAL_N_ELEMENTS(aValCheck)); ++nRow) -+ { -+ CPPUNIT_ASSERT_EQUAL( aValCheck[nRow][0], m_pDoc->GetValue(ScAddress(1,nRow+1,0))); -+ CPPUNIT_ASSERT_EQUAL( aValCheck[nRow][1], m_pDoc->GetValue(ScAddress(2,nRow+1,0))); -+ } -+ -+ // Redo and check the result. -+ pUndoMgr->Redo(); -+ m_pDoc->CalcAll(); -+ for (SCROW nRow=0; nRow < static_cast(SAL_N_ELEMENTS(aValCheck)); ++nRow) -+ { -+ size_t i = static_cast(m_pDoc->GetValue(ScAddress(2,nRow+1,0))); // order 1..4 -+ CPPUNIT_ASSERT_EQUAL( static_cast(nRow+1), i); -+ CPPUNIT_ASSERT_EQUAL( aValCheck[i-1][2], m_pDoc->GetValue(ScAddress(1,nRow+1,0))); -+ } -+ -+ m_pDoc->DeleteTab(0); -+} -+ -+void Test::testSortOutOfPlaceResult() -+{ -+ m_pDoc->InsertTab(0, "Sort"); -+ m_pDoc->InsertTab(1, "Result"); -+ -+ const char* pData[] = { -+ "Header", -+ "1", -+ "23", -+ "2", -+ "9", -+ "-2", -+ 0 // terminator -+ }; -+ -+ // source data in A1:A6. -+ for (SCROW i = 0; pData[i]; ++i) -+ m_pDoc->SetString(ScAddress(0,i,0), OUString::createFromAscii(pData[i])); -+ -+ // Check the initial values. -+ CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(0,0,0))); -+ CPPUNIT_ASSERT_EQUAL( 1.0, m_pDoc->GetValue(ScAddress(0,1,0))); -+ CPPUNIT_ASSERT_EQUAL(23.0, m_pDoc->GetValue(ScAddress(0,2,0))); -+ CPPUNIT_ASSERT_EQUAL( 2.0, m_pDoc->GetValue(ScAddress(0,3,0))); -+ CPPUNIT_ASSERT_EQUAL( 9.0, m_pDoc->GetValue(ScAddress(0,4,0))); -+ CPPUNIT_ASSERT_EQUAL(-2.0, m_pDoc->GetValue(ScAddress(0,5,0))); -+ -+ ScDBDocFunc aFunc(getDocShell()); -+ -+ // Sort A1:A6, and set the result to C2:C7 -+ m_pDoc->SetAnonymousDBData( -+ 0, new ScDBData(STR_DB_LOCAL_NONAME, 0, 0, 0, 0, 5)); -+ -+ ScSortParam aSortData; -+ aSortData.nCol1 = 0; -+ aSortData.nCol2 = 0; -+ aSortData.nRow1 = 0; -+ aSortData.nRow2 = 5; -+ aSortData.bHasHeader = true; -+ aSortData.bInplace = false; -+ aSortData.nDestTab = 1; -+ aSortData.nDestCol = 2; -+ aSortData.nDestRow = 1; -+ aSortData.maKeyState[0].bDoSort = true; -+ aSortData.maKeyState[0].nField = 0; -+ aSortData.maKeyState[0].bAscending = true; -+ bool bSorted = aFunc.Sort(0, aSortData, true, true, true); -+ CPPUNIT_ASSERT(bSorted); -+ -+ // Source data still intact. -+ CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(0,0,0))); -+ CPPUNIT_ASSERT_EQUAL( 1.0, m_pDoc->GetValue(ScAddress(0,1,0))); -+ CPPUNIT_ASSERT_EQUAL(23.0, m_pDoc->GetValue(ScAddress(0,2,0))); -+ CPPUNIT_ASSERT_EQUAL( 2.0, m_pDoc->GetValue(ScAddress(0,3,0))); -+ CPPUNIT_ASSERT_EQUAL( 9.0, m_pDoc->GetValue(ScAddress(0,4,0))); -+ CPPUNIT_ASSERT_EQUAL(-2.0, m_pDoc->GetValue(ScAddress(0,5,0))); -+ -+ // Sort result in C2:C7 on sheet "Result". -+ CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(2,1,1))); -+ CPPUNIT_ASSERT_EQUAL(-2.0, m_pDoc->GetValue(ScAddress(2,2,1))); -+ CPPUNIT_ASSERT_EQUAL( 1.0, m_pDoc->GetValue(ScAddress(2,3,1))); -+ CPPUNIT_ASSERT_EQUAL( 2.0, m_pDoc->GetValue(ScAddress(2,4,1))); -+ CPPUNIT_ASSERT_EQUAL( 9.0, m_pDoc->GetValue(ScAddress(2,5,1))); -+ CPPUNIT_ASSERT_EQUAL(23.0, m_pDoc->GetValue(ScAddress(2,6,1))); -+ -+ m_pDoc->DeleteTab(1); -+ m_pDoc->DeleteTab(0); -+} -+ -+void Test::testSortPartialFormulaGroup() -+{ -+ sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on. -+ FormulaGrammarSwitch aFGSwitch(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1); -+ -+ m_pDoc->InsertTab(0, "Sort"); -+ -+ // Set up the sheet. -+ const char* aData[][2] = { -+ { "F1", "F2" }, -+ { "43", "=RC[-1]" }, -+ { "50", "=RC[-1]" }, -+ { "8", "=RC[-1]" }, -+ { "47", "=RC[-1]" }, -+ { "28", "=RC[-1]" }, -+ { 0, 0 } // terminator -+ }; -+ -+ // A1:B6. -+ for (SCROW i = 0; aData[i][0]; ++i) -+ { -+ m_pDoc->SetString(0, i, 0, OUString::createFromAscii(aData[i][0])); -+ m_pDoc->SetString(1, i, 0, OUString::createFromAscii(aData[i][1])); -+ } -+ -+ // Check the initial condition. -+ for (SCROW i = 1; i <= 5; ++i) -+ // A2:A6 should equal B2:B6. -+ CPPUNIT_ASSERT_EQUAL(m_pDoc->GetValue(ScAddress(0,i,0)), m_pDoc->GetValue(ScAddress(1,i,0))); -+ -+ const ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(1,1,0)); -+ CPPUNIT_ASSERT(pFC); -+ CPPUNIT_ASSERT_MESSAGE("This formula cell should be the first in a group.", pFC->IsSharedTop()); -+ CPPUNIT_ASSERT_MESSAGE("Incorrect formula group length.", pFC->GetSharedLength() == 5); -+ -+ ScDBDocFunc aFunc(getDocShell()); -+ -+ // Sort only B2:B4. This caused crash at one point (c.f. fdo#81617). -+ -+ m_pDoc->SetAnonymousDBData(0, new ScDBData(STR_DB_LOCAL_NONAME, 0, 1, 1, 1, 3)); -+ -+ ScSortParam aSortData; -+ aSortData.nCol1 = 1; -+ aSortData.nCol2 = 1; -+ aSortData.nRow1 = 1; -+ aSortData.nRow2 = 3; -+ aSortData.bHasHeader = false; -+ aSortData.bInplace = true; -+ aSortData.maKeyState[0].bDoSort = true; -+ aSortData.maKeyState[0].nField = 0; -+ aSortData.maKeyState[0].bAscending = true; -+ bool bSorted = aFunc.Sort(0, aSortData, true, true, true); -+ CPPUNIT_ASSERT(bSorted); -+ -+ m_pDoc->CalcAll(); // just in case... -+ -+ // Check the cell values after the partial sort. -+ -+ // Column A -+ CPPUNIT_ASSERT_EQUAL(43.0, m_pDoc->GetValue(ScAddress(0,1,0))); -+ CPPUNIT_ASSERT_EQUAL(50.0, m_pDoc->GetValue(ScAddress(0,2,0))); -+ CPPUNIT_ASSERT_EQUAL( 8.0, m_pDoc->GetValue(ScAddress(0,3,0))); -+ CPPUNIT_ASSERT_EQUAL(47.0, m_pDoc->GetValue(ScAddress(0,4,0))); -+ CPPUNIT_ASSERT_EQUAL(28.0, m_pDoc->GetValue(ScAddress(0,5,0))); -+ -+ // Column B -+ CPPUNIT_ASSERT_EQUAL( 8.0, m_pDoc->GetValue(ScAddress(1,1,0))); -+ CPPUNIT_ASSERT_EQUAL(43.0, m_pDoc->GetValue(ScAddress(1,2,0))); -+ CPPUNIT_ASSERT_EQUAL(50.0, m_pDoc->GetValue(ScAddress(1,3,0))); -+ CPPUNIT_ASSERT_EQUAL(47.0, m_pDoc->GetValue(ScAddress(1,4,0))); -+ CPPUNIT_ASSERT_EQUAL(28.0, m_pDoc->GetValue(ScAddress(1,5,0))); -+ -+ m_pDoc->DeleteTab(0); -+} -+ -+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ --- -1.9.3 - diff --git a/0001-Resolves-fdo-62682-crash-on-second-export-of-svg.patch b/0001-Resolves-fdo-62682-crash-on-second-export-of-svg.patch deleted file mode 100644 index 9e0cada..0000000 --- a/0001-Resolves-fdo-62682-crash-on-second-export-of-svg.patch +++ /dev/null @@ -1,162 +0,0 @@ -From 0bb29affae83d0410f745f46267527e10777fcd2 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Fri, 17 Oct 2014 15:03:34 +0100 -Subject: [PATCH] Resolves: fdo#62682 crash on second export of svg - -because the first export has left "dangling" CalcFieldValueHdl Links in -Outliners that got created based on the Drawing Outliner while it had a -temporary CalcFieldValueHdl installed, and didn't get the old CalcFieldValueHdl -installed when the old Drawing Outliner one was re-installed. - -(cherry picked from commit 5bdfa8c12472eb9ff6ca054c2ada7150b1869fff) - -Change-Id: I064a154ece488c9a4c3467b753451df7e73ae883 -Reviewed-on: https://gerrit.libreoffice.org/12009 -Reviewed-by: Michael Stahl -Tested-by: Michael Stahl ---- - filter/source/svg/svgexport.cxx | 18 ++++++++++++++++-- - filter/source/svg/svgfilter.hxx | 1 + - include/svx/svdmodel.hxx | 2 ++ - svx/source/inc/svdoutlinercache.hxx | 7 +++++++ - svx/source/svdraw/svdmodel.cxx | 11 +++++++++++ - svx/source/svdraw/svdoutlinercache.cxx | 2 ++ - 6 files changed, 39 insertions(+), 2 deletions(-) - -diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx -index 07cf0a4..7dc2419 100644 ---- a/filter/source/svg/svgexport.cxx -+++ b/filter/source/svg/svgexport.cxx -@@ -602,7 +602,8 @@ bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) - SdrOutliner& rOutl = mpSdrModel->GetDrawOutliner(NULL); - - maOldFieldHdl = rOutl.GetCalcFieldValueHdl(); -- rOutl.SetCalcFieldValueHdl( LINK( this, SVGFilter, CalcFieldHdl) ); -+ maNewFieldHdl = LINK(this, SVGFilter, CalcFieldHdl); -+ rOutl.SetCalcFieldValueHdl(maNewFieldHdl); - } - } - bRet = implExportDocument(); -@@ -615,7 +616,20 @@ bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) - } - - if( mpSdrModel ) -- mpSdrModel->GetDrawOutliner( NULL ).SetCalcFieldValueHdl( maOldFieldHdl ); -+ { -+ //fdo#62682 The maNewFieldHdl can end up getting copied -+ //into various other outliners which live past this -+ //method, so get the full list of outliners and restore -+ //the maOldFieldHdl for all that have ended up using -+ //maNewFieldHdl -+ std::vector aOutliners(mpSdrModel->GetActiveOutliners()); -+ for (std::vector::iterator aIter = aOutliners.begin(); aIter != aOutliners.end(); ++aIter) -+ { -+ SdrOutliner* pOutliner = *aIter; -+ if (maNewFieldHdl == pOutliner->GetCalcFieldValueHdl()) -+ pOutliner->SetCalcFieldValueHdl(maOldFieldHdl); -+ } -+ } - - delete mpSVGWriter, mpSVGWriter = NULL; - mpSVGExport = NULL; // pointed object is released by xSVGExport dtor at the end of this scope -diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx -index 7b68c2b..0c6371f 100644 ---- a/filter/source/svg/svgfilter.hxx -+++ b/filter/source/svg/svgfilter.hxx -@@ -265,6 +265,7 @@ private: - XDrawPageSequence mMasterPageTargets; - - Link maOldFieldHdl; -+ Link maNewFieldHdl; - - bool implImport( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException); - -diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx -index e982cb5..5aeeb70 100644 ---- a/include/svx/svdmodel.hxx -+++ b/include/svx/svdmodel.hxx -@@ -233,6 +233,8 @@ public: - sal_uIntPtr nSwapGraphicsMode; - - SdrOutlinerCache* mpOutlinerCache; -+ //get a vector of all the SdrOutliner belonging to the model -+ std::vector GetActiveOutliners() const; - SdrModelImpl* mpImpl; - sal_uInt16 mnCharCompressType; - sal_uInt16 mnHandoutPageCount; -diff --git a/svx/source/inc/svdoutlinercache.hxx b/svx/source/inc/svdoutlinercache.hxx -index 6dbf728..03572fc 100644 ---- a/svx/source/inc/svdoutlinercache.hxx -+++ b/svx/source/inc/svdoutlinercache.hxx -@@ -21,6 +21,7 @@ - #define INCLUDED_SVX_SOURCE_INC_SVDOUTLINERCACHE_HXX - - #include -+#include - - class SdrModel; - class SdrOutliner; -@@ -33,12 +34,18 @@ private: - - SdrOutliner* mpModeOutline; - SdrOutliner* mpModeText; -+ -+ std::vector maActiveOutliners; - public: - SdrOutlinerCache( SdrModel* pModel ); - ~SdrOutlinerCache(); - - SdrOutliner* createOutliner( sal_uInt16 nOutlinerMode ); - void disposeOutliner( SdrOutliner* pOutliner ); -+ std::vector GetActiveOutliners() const -+ { -+ return maActiveOutliners; -+ } - }; - - #endif -diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx -index f3fc337..0735d14 100644 ---- a/svx/source/svdraw/svdmodel.cxx -+++ b/svx/source/svdraw/svdmodel.cxx -@@ -1929,6 +1929,17 @@ SdrOutliner* SdrModel::createOutliner( sal_uInt16 nOutlinerMode ) - return mpOutlinerCache->createOutliner( nOutlinerMode ); - } - -+std::vector SdrModel::GetActiveOutliners() const -+{ -+ std::vector aRet(mpOutlinerCache ? -+ mpOutlinerCache->GetActiveOutliners() : std::vector()); -+ -+ aRet.push_back(pDrawOutliner); -+ aRet.push_back(pHitTestOutliner); -+ -+ return aRet; -+} -+ - void SdrModel::disposeOutliner( SdrOutliner* pOutliner ) - { - if( mpOutlinerCache ) -diff --git a/svx/source/svdraw/svdoutlinercache.cxx b/svx/source/svdraw/svdoutlinercache.cxx -index 8f9eba8..810034a 100644 ---- a/svx/source/svdraw/svdoutlinercache.cxx -+++ b/svx/source/svdraw/svdoutlinercache.cxx -@@ -49,6 +49,7 @@ SdrOutliner* SdrOutlinerCache::createOutliner( sal_uInt16 nOutlinerMode ) - pOutliner = SdrMakeOutliner( nOutlinerMode, mpModel ); - Outliner& aDrawOutliner = mpModel->GetDrawOutliner(); - pOutliner->SetCalcFieldValueHdl( aDrawOutliner.GetCalcFieldValueHdl() ); -+ maActiveOutliners.push_back(pOutliner); - } - - return pOutliner; -@@ -95,6 +96,7 @@ void SdrOutlinerCache::disposeOutliner( SdrOutliner* pOutliner ) - } - else - { -+ maActiveOutliners.erase(std::remove(maActiveOutliners.begin(), maActiveOutliners.end(), pOutliner), maActiveOutliners.end()); - delete pOutliner; - } - } --- -1.9.3 - diff --git a/0001-Resolves-fdo-68347-fix-word-count-with-recorded-chan.patch b/0001-Resolves-fdo-68347-fix-word-count-with-recorded-chan.patch deleted file mode 100644 index 2475f8a..0000000 --- a/0001-Resolves-fdo-68347-fix-word-count-with-recorded-chan.patch +++ /dev/null @@ -1,334 +0,0 @@ -From 5ae6072774ab544fdfdfebf2364e97ca2fa2326a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Mon, 3 Nov 2014 09:49:37 +0000 -Subject: [PATCH] Resolves: fdo#68347 fix word count with recorded changes - -also see fdo#46757 - -a) We need to ignore redline-deleted text, but count redline-added text -b) each block of text is denoted by its end position in the model - and where that maps to in the view so a hidden portion - should record its end point not its starting point, and a non-hidden - deleted portion should always record its end point -c) when mapping a model position to the view we take the offset of - the model pos arg from the block end and use that to offset the - mapped block-end view pos to get the final view pos. But for - hidden portions that won't make a whole lot of sense, and - end up offsetting into prior portions, so map all positions within a - hidden portion to the same block-end view pos - -add regression tests for these cases - -(cherry picked from commit fa430e6b4e6f5d096bdf59db26e5d7393ca2297b) - -Conflicts: - sw/qa/core/uwriter.cxx - -Change-Id: I45c76bba47fd430bc3bccb5f919502660d415d9e -Reviewed-on: https://gerrit.libreoffice.org/12219 -Reviewed-by: Michael Stahl -Tested-by: Michael Stahl ---- - sw/inc/modeltoviewhelper.hxx | 25 +++++++--- - sw/qa/core/uwriter.cxx | 34 ++++++++++---- - sw/source/core/text/porlay.cxx | 5 +- - sw/source/core/txtnode/modeltoviewhelper.cxx | 70 +++++++++++++++++----------- - sw/source/core/txtnode/txtedt.cxx | 2 +- - 5 files changed, 93 insertions(+), 43 deletions(-) - -diff --git a/sw/inc/modeltoviewhelper.hxx b/sw/inc/modeltoviewhelper.hxx -index 018b67c..d99c9db 100644 ---- a/sw/inc/modeltoviewhelper.hxx -+++ b/sw/inc/modeltoviewhelper.hxx -@@ -65,19 +65,30 @@ class SwTxtNode; - #define EXPANDFIELDS 0x0001 - #define EXPANDFOOTNOTE 0x0002 - #define HIDEINVISIBLE 0x0004 --#define HIDEREDLINED 0x0008 -+#define HIDEDELETIONS 0x0008 - /// do not expand to content, but replace with ZWSP - #define REPLACEMODE 0x0010 - - class ModelToViewHelper - { -- /** For each field in the model string, there is an entry in the conversion -- map. The first value of the ConversionMapEntry points to the field -- position in the model string, the second value points to the associated -- position in the view string. The last entry in the conversion map -- denotes the lengths of the model resp. view string. -+ /** For each expanded/hidden portion in the model string, there is an entry in -+ the conversion map. The first value of the ConversionMapEntry points to -+ the start position in the model string, the second value points to the -+ associated start position in the view string. The last entry in the -+ conversion map denotes the lengths of the model resp. view string. - */ -- typedef std::pair< sal_Int32 , sal_Int32 > ConversionMapEntry; -+ struct ConversionMapEntry -+ { -+ ConversionMapEntry(sal_Int32 nModelPos, sal_Int32 nViewPos, bool bVisible) -+ : m_nModelPos(nModelPos) -+ , m_nViewPos(nViewPos) -+ , m_bVisible(bVisible) -+ { -+ } -+ sal_Int32 m_nModelPos; -+ sal_Int32 m_nViewPos; -+ bool m_bVisible; -+ }; - typedef std::vector< ConversionMapEntry > ConversionMap; - typedef std::vector Positions; - -diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx -index bd6e000..1297c65 100644 ---- a/sw/qa/core/uwriter.cxx -+++ b/sw/qa/core/uwriter.cxx -@@ -321,7 +321,7 @@ void SwDocTest::testModelToViewHelper() - } - - { -- ModelToViewHelper aModelToViewHelper(*pTxtNode, HIDEREDLINED); -+ ModelToViewHelper aModelToViewHelper(*pTxtNode, HIDEDELETIONS); - OUString sViewText = aModelToViewHelper.getViewText(); - CPPUNIT_ASSERT_EQUAL( - OUString("AAAABB " + OUString(CH_TXTATR_BREAKWORD) + " CCCCC " + OUString(CH_TXTATR_BREAKWORD) + " DDDDD"), -@@ -349,14 +349,14 @@ void SwDocTest::testModelToViewHelper() - } - - { -- ModelToViewHelper aModelToViewHelper(*pTxtNode, EXPANDFIELDS | HIDEREDLINED | EXPANDFOOTNOTE); -+ ModelToViewHelper aModelToViewHelper(*pTxtNode, EXPANDFIELDS | HIDEDELETIONS | EXPANDFOOTNOTE); - OUString sViewText = aModelToViewHelper.getViewText(); - CPPUNIT_ASSERT_EQUAL( - OUString("AAAABB foo CCCCC foo DDDDD"), sViewText); - } - { - ModelToViewHelper aModelToViewHelper(*pTxtNode, -- EXPANDFIELDS | HIDEREDLINED | EXPANDFOOTNOTE | REPLACEMODE); -+ EXPANDFIELDS | HIDEDELETIONS | EXPANDFOOTNOTE | REPLACEMODE); - OUString sViewText = aModelToViewHelper.getViewText(); - CPPUNIT_ASSERT_EQUAL( - OUString("AAAABB " + OUString(CHAR_ZWSP) + " CCCCC " + OUString(CHAR_ZWSP) + " DDDDD"), -@@ -372,7 +372,7 @@ void SwDocTest::testModelToViewHelper() - } - - { -- ModelToViewHelper aModelToViewHelper(*pTxtNode, HIDEINVISIBLE | HIDEREDLINED); -+ ModelToViewHelper aModelToViewHelper(*pTxtNode, HIDEINVISIBLE | HIDEDELETIONS); - OUString sViewText = aModelToViewHelper.getViewText(); - OUStringBuffer aBuffer; - aBuffer.append("AAAACCCCC "); -@@ -382,13 +382,13 @@ void SwDocTest::testModelToViewHelper() - } - - { -- ModelToViewHelper aModelToViewHelper(*pTxtNode, EXPANDFIELDS | HIDEINVISIBLE | HIDEREDLINED | EXPANDFOOTNOTE); -+ ModelToViewHelper aModelToViewHelper(*pTxtNode, EXPANDFIELDS | HIDEINVISIBLE | HIDEDELETIONS | EXPANDFOOTNOTE); - OUString sViewText = aModelToViewHelper.getViewText(); - CPPUNIT_ASSERT_EQUAL(OUString("AAAACCCCC foo DDDDD"), sViewText); - } - { - ModelToViewHelper aModelToViewHelper(*pTxtNode, -- EXPANDFIELDS | HIDEINVISIBLE | HIDEREDLINED | EXPANDFOOTNOTE | REPLACEMODE); -+ EXPANDFIELDS | HIDEINVISIBLE | HIDEDELETIONS | EXPANDFOOTNOTE | REPLACEMODE); - OUString sViewText = aModelToViewHelper.getViewText(); - CPPUNIT_ASSERT_EQUAL(sViewText, - OUString("AAAACCCCC " + OUString(CHAR_ZWSP) + " DDDDD")); -@@ -669,8 +669,26 @@ void SwDocTest::testSwScanner() - - aDocStat.Reset(); - pTxtNode->CountWords(aDocStat, 0, pTxtNode->Len()); //word-counting the text should only count the non-deleted text, and this whole chunk should be ignored -- CPPUNIT_ASSERT_EQUAL(aDocStat.nWord, static_cast(0)); -- CPPUNIT_ASSERT_EQUAL(aDocStat.nChar, static_cast(0)); -+ CPPUNIT_ASSERT_EQUAL(static_cast(0), aDocStat.nWord); -+ CPPUNIT_ASSERT_EQUAL(static_cast(0), aDocStat.nChar); -+ -+ // https://bugs.libreoffice.org/show_bug.cgi?id=68347 we do want to count -+ // redline *added* text though -+ m_pDoc->SetRedlineMode(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_DELETE|nsRedlineMode_t::REDLINE_SHOW_INSERT); -+ aPaM.DeleteMark(); -+ aPaM.GetPoint()->nContent.Assign(aPaM.GetCntntNode(), 0); -+ m_pDoc->InsertString(aPaM, "redline-new-text "); -+ aDocStat.Reset(); -+ pTxtNode = aPaM.GetNode()->GetTxtNode(); -+ pTxtNode->SetWordCountDirty(true); -+ pTxtNode->CountWords(aDocStat, 0, pTxtNode->Len()); -+ CPPUNIT_ASSERT_EQUAL(static_cast(2), aDocStat.nWord); -+ //redline-new-text Lorem ipsum -+ //+++++++++++++++++ ------ -+ //select start of original text and part of deleted text -+ aDocStat.Reset(); -+ pTxtNode->CountWords(aDocStat, 17, 25); -+ CPPUNIT_ASSERT_EQUAL(static_cast(5), aDocStat.nChar); - } - - //See https://bugs.libreoffice.org/show_bug.cgi?id=38983 -diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx -index 40e3a58..214bbe5 100644 ---- a/sw/source/core/text/porlay.cxx -+++ b/sw/source/core/text/porlay.cxx -@@ -2107,9 +2107,12 @@ void SwScriptInfo::selectRedLineDeleted(const SwTxtNode& rNode, MultiSelection & - { - const SwRangeRedline* pRed = rIDRA.GetRedlineTbl()[ nAct ]; - -- if ( pRed->Start()->nNode > rNode.GetIndex() ) -+ if (pRed->Start()->nNode > rNode.GetIndex()) - break; - -+ if (pRed->GetType() != nsRedlineType_t::REDLINE_DELETE) -+ continue; -+ - sal_Int32 nRedlStart; - sal_Int32 nRedlnEnd; - pRed->CalcStartEnd( rNode.GetIndex(), nRedlStart, nRedlnEnd ); -diff --git a/sw/source/core/txtnode/modeltoviewhelper.cxx b/sw/source/core/txtnode/modeltoviewhelper.cxx -index bd1a3ae..875ea1e 100644 ---- a/sw/source/core/txtnode/modeltoviewhelper.cxx -+++ b/sw/source/core/txtnode/modeltoviewhelper.cxx -@@ -94,7 +94,7 @@ ModelToViewHelper::ModelToViewHelper(const SwTxtNode &rNode, sal_uInt16 eMode) - if (eMode & HIDEINVISIBLE) - SwScriptInfo::selectHiddenTextProperty(rNode, aHiddenMulti); - -- if (eMode & HIDEREDLINED) -+ if (eMode & HIDEDELETIONS) - SwScriptInfo::selectRedLineDeleted(rNode, aHiddenMulti); - - std::vector aBlocks; -@@ -203,43 +203,55 @@ ModelToViewHelper::ModelToViewHelper(const SwTxtNode &rNode, sal_uInt16 eMode) - } - } - -+ //store the end of each range in the model and where that end of range -+ //maps to in the view - sal_Int32 nOffset = 0; - for (std::vector::iterator i = aBlocks.begin(); i != aBlocks.end(); ++i) - { -+ const sal_Int32 nBlockLen = i->m_nLen; -+ if (!nBlockLen) -+ continue; -+ const sal_Int32 nBlockStart = i->m_nStart; -+ const sal_Int32 nBlockEnd = nBlockStart + nBlockLen; -+ - if (!i->m_bVisible) - { -- const sal_Int32 nHiddenStart = i->m_nStart; -- const sal_Int32 nHiddenLen = i->m_nLen; -+ sal_Int32 const modelBlockPos(nBlockEnd); -+ sal_Int32 const viewBlockPos(nBlockStart + nOffset); -+ m_aMap.push_back(ConversionMapEntry(modelBlockPos, viewBlockPos, false)); - -- m_aRetText = m_aRetText.replaceAt( nOffset + nHiddenStart, nHiddenLen, OUString() ); -- m_aMap.push_back( ConversionMapEntry( nHiddenStart, nOffset + nHiddenStart ) ); -- nOffset -= nHiddenLen; -+ m_aRetText = m_aRetText.replaceAt(nOffset + nBlockStart, nBlockLen, OUString()); -+ nOffset -= nBlockLen; - } - else - { - for (FieldResultSet::iterator j = i->m_aAttrs.begin(); j != i->m_aAttrs.end(); ++j) - { -- sal_Int32 const viewPos(nOffset + j->m_nFieldPos); -- m_aRetText = m_aRetText.replaceAt(viewPos, 1, j->m_sExpand); -- m_aMap.push_back( ConversionMapEntry(j->m_nFieldPos, viewPos) ); -+ sal_Int32 const modelFieldPos(j->m_nFieldPos); -+ sal_Int32 const viewFieldPos(j->m_nFieldPos + nOffset); -+ m_aMap.push_back( ConversionMapEntry(modelFieldPos, viewFieldPos, true) ); -+ -+ m_aRetText = m_aRetText.replaceAt(viewFieldPos, 1, j->m_sExpand); -+ nOffset += j->m_sExpand.getLength() - 1; -+ - switch (j->m_eType) - { - case FieldResult::FIELD: -- m_FieldPositions.push_back(viewPos); -+ m_FieldPositions.push_back(viewFieldPos); - break; - case FieldResult::FOOTNOTE: -- m_FootnotePositions.push_back(viewPos); -+ m_FootnotePositions.push_back(viewFieldPos); - break; - case FieldResult::NONE: /*ignore*/ - break; - } -- nOffset += j->m_sExpand.getLength() - 1; - } -+ -+ sal_Int32 const modelEndBlock(nBlockEnd); -+ sal_Int32 const viewFieldPos(nBlockEnd + nOffset); -+ m_aMap.push_back(ConversionMapEntry(modelEndBlock, viewFieldPos, true)); - } - } -- -- if ( !m_aMap.empty() ) -- m_aMap.push_back( ConversionMapEntry( rNodeText.getLength()+1, m_aRetText.getLength()+1 ) ); - } - - /** Converts a model position into a view position -@@ -248,15 +260,21 @@ sal_Int32 ModelToViewHelper::ConvertToViewPosition( sal_Int32 nModelPos ) const - { - // Search for entry after nPos: - ConversionMap::const_iterator aIter; -+ - for ( aIter = m_aMap.begin(); aIter != m_aMap.end(); ++aIter ) - { -- if ( (*aIter).first >= nModelPos ) -+ if (aIter->m_nModelPos >= nModelPos) - { -- const sal_Int32 nPosModel = (*aIter).first; -- const sal_Int32 nPosExpand = (*aIter).second; -- -- const sal_Int32 nDistToNextModel = nPosModel - nModelPos; -- return nPosExpand - nDistToNextModel; -+ //if it's an invisible portion, map all contained positions -+ //to the anchor viewpos -+ if (!aIter->m_bVisible) -+ return aIter->m_nViewPos; -+ -+ //if it's a visible portion, then the view position is the anchor -+ //viewpos - the offset of the input modelpos from the anchor -+ //modelpos -+ const sal_Int32 nOffsetFromEnd = aIter->m_nModelPos - nModelPos; -+ return aIter->m_nViewPos - nOffsetFromEnd; - } - } - -@@ -274,10 +292,10 @@ ModelToViewHelper::ModelPosition ModelToViewHelper::ConvertToModelPosition( sal_ - ConversionMap::const_iterator aIter; - for ( aIter = m_aMap.begin(); aIter != m_aMap.end(); ++aIter ) - { -- if ( (*aIter).second > nViewPos ) -+ if (aIter->m_nViewPos > nViewPos) - { -- const sal_Int32 nPosModel = (*aIter).first; -- const sal_Int32 nPosExpand = (*aIter).second; -+ const sal_Int32 nPosModel = aIter->m_nModelPos; -+ const sal_Int32 nPosExpand = aIter->m_nViewPos; - - // If nViewPos is in front of first field, we are finished. - if ( aIter == m_aMap.begin() ) -@@ -286,8 +304,8 @@ ModelToViewHelper::ModelPosition ModelToViewHelper::ConvertToModelPosition( sal_ - --aIter; - - // nPrevPosModel is the field position -- const sal_Int32 nPrevPosModel = (*aIter).first; -- const sal_Int32 nPrevPosExpand = (*aIter).second; -+ const sal_Int32 nPrevPosModel = aIter->m_nModelPos; -+ const sal_Int32 nPrevPosExpand = aIter->m_nViewPos; - - const sal_Int32 nLengthModel = nPosModel - nPrevPosModel; - const sal_Int32 nLengthExpand = nPosExpand - nPrevPosExpand; -diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx -index aa6f7d6..f9f19e2 100644 ---- a/sw/source/core/txtnode/txtedt.cxx -+++ b/sw/source/core/txtnode/txtedt.cxx -@@ -1986,7 +1986,7 @@ bool SwTxtNode::CountWords( SwDocStat& rStat, - } - - // ConversionMap to expand fields, remove invisible and redline deleted text for scanner -- const ModelToViewHelper aConversionMap(*this, EXPANDFIELDS | EXPANDFOOTNOTE | HIDEINVISIBLE | HIDEREDLINED); -+ const ModelToViewHelper aConversionMap(*this, EXPANDFIELDS | EXPANDFOOTNOTE | HIDEINVISIBLE | HIDEDELETIONS); - OUString aExpandText = aConversionMap.getViewText(); - - if (aExpandText.isEmpty() && !bCountNumbering) --- -1.9.3 - diff --git a/0001-Resolves-fdo-84729-buffer-cache-grows-to-over-9000-u.patch b/0001-Resolves-fdo-84729-buffer-cache-grows-to-over-9000-u.patch deleted file mode 100644 index 50cf8fa..0000000 --- a/0001-Resolves-fdo-84729-buffer-cache-grows-to-over-9000-u.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 6b379995697f8ac25f8f3871c9c91e8dc009afa8 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Fri, 24 Oct 2014 15:10:15 +0100 -Subject: [PATCH] Resolves: fdo#84729 buffer cache grows to over 9000 unused - entries - -regression from - -commit a5351434fbea1126961f5dbaa986e7c9e686c24e -Author: tsahi glik -Date: Thu Jan 16 12:51:44 2014 -0800 - fix rendering issues in iOS with aqua - -because now the cache just fills up because nothing will have -a depth of "0" and a new entry is created every time. - -0 could be seen to mean "whatever is a good non-1bit depth" or auto or -something. (Do the uses of "8" really mean 8) - -0 passed to new VirtualDevice under Linux/X ends up using the depth of the -outputdev, so here set nBits to that value to start with and the problem -goes away - -Change-Id: I4390d6f7edef9dc7430cc77e3518dc751a5f479d -(cherry picked from commit e25a020d59b019893d2e04ac61e4ed25ef0a6e61) -Reviewed-on: https://gerrit.libreoffice.org/12087 -Reviewed-by: Miklos Vajna -Tested-by: Miklos Vajna ---- - drawinglayer/source/processor2d/vclhelperbufferdevice.cxx | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx -index 2f98e71..d812d93 100644 ---- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx -+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx -@@ -85,6 +85,9 @@ namespace - ::osl::MutexGuard aGuard(m_aMutex); - VirtualDevice* pRetval = 0; - -+ if (nBits == 0) -+ nBits = rOutDev.GetBitCount(); -+ - if(!maFreeBuffers.empty()) - { - bool bOkay(false); -@@ -183,6 +186,8 @@ namespace - - maUsedBuffers.erase(aUsedFound); - maFreeBuffers.push_back(&rDevice); -+ SAL_WARN_IF(maFreeBuffers.size() > 1000, "drawinglayer", "excessive cached buffers, " -+ << maFreeBuffers.size() << " entries!"); - Start(); - } - --- -1.9.3 - diff --git a/0001-Resolves-fdo-84885-chart-wizard-dialog-cut-off.patch b/0001-Resolves-fdo-84885-chart-wizard-dialog-cut-off.patch deleted file mode 100644 index 34a550c..0000000 --- a/0001-Resolves-fdo-84885-chart-wizard-dialog-cut-off.patch +++ /dev/null @@ -1,168 +0,0 @@ -From fb2ed3e17623476c1b772826f0ed4468350baf59 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Mon, 20 Oct 2014 14:22:40 +0100 -Subject: [PATCH] Resolves: fdo#84885 chart wizard dialog cut off - -Change-Id: Ie24687cd1c54b1fed04745c83f507c17a5574175 -(cherry picked from commit f9c242674094eba7ac19bd279f611dba0a8e5571) -Reviewed-on: https://gerrit.libreoffice.org/12052 -Reviewed-by: Miklos Vajna -Tested-by: Miklos Vajna ---- - chart2/uiconfig/ui/tp_DataSource.ui | 62 +++++++++++++++++++++---------------- - 1 file changed, 35 insertions(+), 27 deletions(-) - -diff --git a/chart2/uiconfig/ui/tp_DataSource.ui b/chart2/uiconfig/ui/tp_DataSource.ui -index f7bed1d..69e7262 100644 ---- a/chart2/uiconfig/ui/tp_DataSource.ui -+++ b/chart2/uiconfig/ui/tp_DataSource.ui -@@ -167,12 +167,13 @@ - - - -- -+ - True - False -+ start - True -- vertical -- 6 -+ True -+ 6 - - - True -@@ -183,9 +184,10 @@ - LB_ROLE:border - - -- False -- True -- 0 -+ 0 -+ 0 -+ 1 -+ 1 - - - -@@ -193,16 +195,18 @@ - 440 - 100 - True -- False -+ True - True -+ True - -- -+ - - - -- False -- True -- 1 -+ 0 -+ 1 -+ 1 -+ 1 - - - -@@ -215,9 +219,10 @@ - EDT_RANGE - - -- False -- True -- 2 -+ 0 -+ 2 -+ 1 -+ 1 - - - -@@ -229,7 +234,7 @@ - - - True -- False -+ True - True - - -@@ -243,7 +248,7 @@ - - False - True -- False -+ True - True - imageIMB_RANGE_MAIN - -@@ -255,9 +260,10 @@ - - - -- False -- True -- 3 -+ 0 -+ 3 -+ 1 -+ 1 - - - -@@ -296,9 +302,10 @@ - - - -- False -- True -- 4 -+ 0 -+ 4 -+ 1 -+ 1 - - - -@@ -310,7 +317,7 @@ - - - True -- False -+ True - True - - -@@ -324,7 +331,7 @@ - - False - True -- False -+ True - True - imageIMB_RANGE_CAT - -@@ -336,9 +343,10 @@ - - - -- False -- True -- 5 -+ 0 -+ 5 -+ 1 -+ 1 - - - --- -1.9.3 - diff --git a/0001-Resolves-rhbz-1146169-a11y-frames-label-dies-before-.patch b/0001-Resolves-rhbz-1146169-a11y-frames-label-dies-before-.patch deleted file mode 100644 index a490b28..0000000 --- a/0001-Resolves-rhbz-1146169-a11y-frames-label-dies-before-.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 1aa560ce6516556703e2ece183354f606b602897 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Wed, 29 Oct 2014 17:12:40 +0000 -Subject: [PATCH] Resolves: rhbz#1146169 a11y frames label dies before frame - -Change-Id: I2bc45dcb92b8e68bf4ae4df72c0fbd4e3b535604 ---- - include/vcl/layout.hxx | 1 + - vcl/source/window/layout.cxx | 13 ++++++++++++- - 2 files changed, 13 insertions(+), 1 deletion(-) - -diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx -index d758d63..8bad8e7 100644 ---- a/include/vcl/layout.hxx -+++ b/include/vcl/layout.hxx -@@ -458,6 +458,7 @@ private: - private: - friend class VclBuilder; - void designate_label(Window *pWindow); -+ DECL_LINK(WindowEventListener, VclSimpleEvent*); - public: - VclFrame(Window *pParent) - : VclBin(pParent) -diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx -index 06f387b..6db0f15 100644 ---- a/vcl/source/window/layout.cxx -+++ b/vcl/source/window/layout.cxx -@@ -1338,10 +1338,21 @@ void VclFrame::setAllocation(const Size &rAllocation) - setLayoutAllocation(*pChild, aChildPos, aAllocation); - } - -+IMPL_LINK(VclFrame, WindowEventListener, VclSimpleEvent*, pEvent) -+{ -+ if (pEvent && pEvent->GetId() == VCLEVENT_OBJECT_DYING) -+ designate_label(NULL); -+ return 0; -+} -+ - void VclFrame::designate_label(Window *pWindow) - { -- assert(pWindow->GetParent() == this); -+ assert(!pWindow || pWindow->GetParent() == this); -+ if (m_pLabel) -+ m_pLabel->RemoveEventListener(LINK(this, VclFrame, WindowEventListener)); - m_pLabel = pWindow; -+ if (m_pLabel) -+ m_pLabel->AddEventListener(LINK(this, VclFrame, WindowEventListener)); - } - - const Window *VclFrame::get_label_widget() const --- -1.9.3 - diff --git a/0001-fdo-79602-sw-add-new-compatibiltiy-flag-PropLineSpac.patch b/0001-fdo-79602-sw-add-new-compatibiltiy-flag-PropLineSpac.patch deleted file mode 100644 index bb0437f..0000000 --- a/0001-fdo-79602-sw-add-new-compatibiltiy-flag-PropLineSpac.patch +++ /dev/null @@ -1,240 +0,0 @@ -From cff2323e10161d3cbbdba088e8ec74aee3839c62 Mon Sep 17 00:00:00 2001 -From: Michael Stahl -Date: Thu, 30 Oct 2014 15:12:33 +0100 -Subject: [PATCH] fdo#79602: sw: add new compatibiltiy flag - PropLineSpacingShrinksFirstLine - -This is enabled by default, to get the new formatting where the first -line of a paragraph is shrunk if a proportional line spacing < 100% is -applied; existing OOo documents get the previous (before LO 3.3) -formatting. Since the formatting in LO releases is broken anyway, it -does not matter much which way documents written by old LO get -formatted. - -(cherry picked from commit 9605763e3dc8c85137787c77c31e8639553a35ed) - -Conflicts: - sw/source/filter/ww8/ww8par.cxx - -Change-Id: I0952f568a933c137bd03070759989cac3517d8b9 -Reviewed-on: https://gerrit.libreoffice.org/12157 -Reviewed-by: Miklos Vajna -Tested-by: Miklos Vajna ---- - sw/inc/IDocumentSettingAccess.hxx | 3 ++- - sw/source/core/doc/DocumentSettingManager.cxx | 6 ++++++ - sw/source/core/inc/DocumentSettingManager.hxx | 1 + - sw/source/core/text/itrform2.cxx | 3 ++- - sw/source/core/uibase/uno/SwXDocumentSettings.cxx | 21 ++++++++++++++++++++- - sw/source/filter/ww8/ww8par.cxx | 1 + - sw/source/filter/xml/xmlimp.cxx | 10 ++++++++++ - writerfilter/source/filter/ImportFilter.cxx | 1 + - 8 files changed, 43 insertions(+), 3 deletions(-) - -diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx -index 4e94a1e..a67d469 100644 ---- a/sw/inc/IDocumentSettingAccess.hxx -+++ b/sw/inc/IDocumentSettingAccess.hxx -@@ -79,6 +79,7 @@ namespace com { namespace sun { namespace star { namespace i18n { struct Forbidd - TAB_OVER_MARGIN, - // MS Word still wraps text around objects with less space than LO would. - SURROUND_TEXT_WRAP_SMALL, -+ PROP_LINE_SPACING_SHRINKS_FIRST_LINE, - // COMPATIBILITY FLAGS END - - BROWSE_MODE, -@@ -93,7 +94,7 @@ namespace com { namespace sun { namespace star { namespace i18n { struct Forbidd - FLOATTABLE_NOMARGINS, - EMBED_FONTS, - EMBED_SYSTEM_FONTS, -- APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING -+ APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, - }; - - public: -diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx -index 68ff997..184b242 100644 ---- a/sw/source/core/doc/DocumentSettingManager.cxx -+++ b/sw/source/core/doc/DocumentSettingManager.cxx -@@ -75,6 +75,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc) - mbBackgroundParaOverDrawings(false), - mbTabOverMargin(false), - mbSurroundTextWrapSmall(false), -+ mbPropLineSpacingShrinksFirstLine(true), - mApplyParagraphMarkFormatToNumbering(false), - mbLastBrowseMode( false ) - -@@ -149,6 +150,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const - case BACKGROUND_PARA_OVER_DRAWINGS: return mbBackgroundParaOverDrawings; - case TAB_OVER_MARGIN: return mbTabOverMargin; - case SURROUND_TEXT_WRAP_SMALL: return mbSurroundTextWrapSmall; -+ case PROP_LINE_SPACING_SHRINKS_FIRST_LINE: return mbPropLineSpacingShrinksFirstLine; - - case BROWSE_MODE: return mbLastBrowseMode; // Attention: normally the SwViewShell has to be asked! - case HTML_MODE: return mbHTMLMode; -@@ -311,6 +313,10 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo - mbSurroundTextWrapSmall = value; - break; - -+ case PROP_LINE_SPACING_SHRINKS_FIRST_LINE: -+ mbPropLineSpacingShrinksFirstLine = value; -+ break; -+ - // COMPATIBILITY FLAGS END - - case BROWSE_MODE: //can be used temporary (load/save) when no SwViewShell is available -diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx -index 2e8ab4b..3226278 100644 ---- a/sw/source/core/inc/DocumentSettingManager.hxx -+++ b/sw/source/core/inc/DocumentSettingManager.hxx -@@ -85,6 +85,7 @@ class DocumentSettingManager : - bool mbBackgroundParaOverDrawings; - bool mbTabOverMargin; - bool mbSurroundTextWrapSmall; -+ bool mbPropLineSpacingShrinksFirstLine; // fdo#79602 - bool mApplyParagraphMarkFormatToNumbering; - - bool mbLastBrowseMode : 1; -diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx -index 4880013..9dfa8ad 100644 ---- a/sw/source/core/text/itrform2.cxx -+++ b/sw/source/core/text/itrform2.cxx -@@ -1743,7 +1743,8 @@ void SwTxtFormatter::CalcRealHeight( bool bNewLine ) - case SVX_LINE_SPACE_AUTO: - // shrink first line of paragraph too on spacing < 100% - if (IsParaLine() && -- pSpace->GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP) -+ pSpace->GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP -+ && GetTxtFrm()->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::PROP_LINE_SPACING_SHRINKS_FIRST_LINE)) - { - long nTmp = pSpace->GetPropLineSpace(); - // Word will render < 50% too but it's just not readable -diff --git a/sw/source/core/uibase/uno/SwXDocumentSettings.cxx b/sw/source/core/uibase/uno/SwXDocumentSettings.cxx -index 6ab7e54..fb64d02 100644 ---- a/sw/source/core/uibase/uno/SwXDocumentSettings.cxx -+++ b/sw/source/core/uibase/uno/SwXDocumentSettings.cxx -@@ -123,7 +123,8 @@ enum SwDocumentSettingsPropertyHandles - HANDLE_EMBED_SYSTEM_FONTS, - HANDLE_TAB_OVER_MARGIN, - HANDLE_SURROUND_TEXT_WRAP_SMALL, -- HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING -+ HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, -+ HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, - }; - - static MasterPropertySetInfo * lcl_createSettingsInfo() -@@ -195,6 +196,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo() - { OUString("TabOverMargin"), HANDLE_TAB_OVER_MARGIN, cppu::UnoType::get(), 0, 0}, - { OUString("SurroundTextWrapSmall"), HANDLE_SURROUND_TEXT_WRAP_SMALL, cppu::UnoType::get(), 0, 0}, - { OUString("ApplyParagraphMarkFormatToNumbering"), HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, cppu::UnoType::get(), 0, 0}, -+ { OUString("PropLineSpacingShrinksFirstLine"), HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE, cppu::UnoType::get(), 0, 0}, - /* - * As OS said, we don't have a view when we need to set this, so I have to - * find another solution before adding them to this property set - MTG -@@ -802,6 +804,16 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf - mpDoc->set(IDocumentSettingAccess::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, bTmp); - } - break; -+ case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE: -+ { -+ bool bTmp; -+ if (rValue >>= bTmp) -+ { -+ mpDoc->set( -+ IDocumentSettingAccess::PROP_LINE_SPACING_SHRINKS_FIRST_LINE, bTmp); -+ } -+ } -+ break; - default: - throw UnknownPropertyException(); - } -@@ -1230,6 +1242,13 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf - rValue.setValue( &bTmp, ::getBooleanCppuType() ); - } - break; -+ case HANDLE_PROP_LINE_SPACING_SHRINKS_FIRST_LINE: -+ { -+ sal_Bool const bTmp(mpDoc->get( -+ IDocumentSettingAccess::PROP_LINE_SPACING_SHRINKS_FIRST_LINE)); -+ rValue <<= bTmp; -+ } -+ break; - default: - throw UnknownPropertyException(); - } -diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx -index 0bf4265..cb2a23f 100644 ---- a/sw/source/filter/ww8/ww8par.cxx -+++ b/sw/source/filter/ww8/ww8par.cxx -@@ -1927,6 +1927,7 @@ void SwWW8ImplReader::ImportDop() - rDoc.set(IDocumentSettingAccess::CLIPPED_PICTURES, true); - rDoc.set(IDocumentSettingAccess::TAB_OVER_MARGIN, true); - rDoc.set(IDocumentSettingAccess::SURROUND_TEXT_WRAP_SMALL, true); -+ rDoc.set(IDocumentSettingAccess::PROP_LINE_SPACING_SHRINKS_FIRST_LINE, true); - - // COMPATIBILITY FLAGS END - -diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx -index 3af249c..b04cfbd 100644 ---- a/sw/source/filter/xml/xmlimp.cxx -+++ b/sw/source/filter/xml/xmlimp.cxx -@@ -1055,6 +1055,9 @@ void SwXMLImport::SetViewSettings(const Sequence < PropertyValue > & aViewProps) - GetTextImport()->SetShowChanges( bShowRedlineChanges ); - } - -+// Note: this will be called only if there are OOo elements in settings.xml. -+// So if a setting is missing there we can assume that it was written -+// by an OOo/LO version that is older than the introduction of the setting! - void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aConfigProps) - { - // this method will modify the document directly -> lock SolarMutex -@@ -1104,6 +1107,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC - aSet.insert("ClippedPictures"); - aSet.insert("BackgroundParaOverDrawings"); - aSet.insert("TabOverMargin"); -+ aSet.insert("PropLineSpacingShrinksFirstLine"); - - sal_Int32 nCount = aConfigProps.getLength(); - const PropertyValue* pValues = aConfigProps.getConstArray(); -@@ -1138,6 +1142,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC - bool bClippedPictures = false; - bool bBackgroundParaOverDrawings = false; - bool bTabOverMargin = false; -+ bool bPropLineSpacingShrinksFirstLine = false; - - const PropertyValue* currentDatabaseDataSource = NULL; - const PropertyValue* currentDatabaseCommand = NULL; -@@ -1225,6 +1230,8 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC - bBackgroundParaOverDrawings = true; - else if ( pValues->Name == "TabOverMargin" ) - bTabOverMargin = true; -+ else if ( pValues->Name == "PropLineSpacingShrinksFirstLine" ) -+ bPropLineSpacingShrinksFirstLine = true; - } - catch( Exception& ) - { -@@ -1400,6 +1407,9 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC - if ( !bTabOverMargin ) - xProps->setPropertyValue("TabOverMargin", makeAny( false ) ); - -+ if (!bPropLineSpacingShrinksFirstLine) -+ xProps->setPropertyValue("PropLineSpacingShrinksFirstLine", makeAny(false)); -+ - SwDoc *pDoc = getDoc(); - SfxPrinter *pPrinter = pDoc->getPrinter( false ); - if( pPrinter ) -diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx -index 277f2da..51a6d55 100644 ---- a/writerfilter/source/filter/ImportFilter.cxx -+++ b/writerfilter/source/filter/ImportFilter.cxx -@@ -225,6 +225,7 @@ void WriterFilter::setTargetDocument( const uno::Reference< lang::XComponent >& - xSettings->setPropertyValue( "ClippedPictures", uno::makeAny( sal_True ) ); - xSettings->setPropertyValue( "BackgroundParaOverDrawings", uno::makeAny( sal_True ) ); - xSettings->setPropertyValue( "TabOverMargin", uno::makeAny( sal_True ) ); -+ xSettings->setPropertyValue("PropLineSpacingShrinksFirstLine", uno::makeAny(sal_True)); - } - - void WriterFilter::setSourceDocument( const uno::Reference< lang::XComponent >& xDoc ) --- -1.9.3 - diff --git a/0001-fdo-79602-sw-fix-text-formatting-of-proportional-lin.patch b/0001-fdo-79602-sw-fix-text-formatting-of-proportional-lin.patch deleted file mode 100644 index 0aae86f..0000000 --- a/0001-fdo-79602-sw-fix-text-formatting-of-proportional-lin.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 7ca9c060155b79a037861a972843a70b8a518c4f Mon Sep 17 00:00:00 2001 -From: Michael Stahl -Date: Wed, 29 Oct 2014 23:50:21 +0100 -Subject: [PATCH] fdo#79602: sw: fix text formatting of proportional line space - < 100% - -SwTxtFormatter::CalcRealHeight(): Apply the special treatment of < 100% -line space shrinking the Height() of the line only to the first line -in a paragraph; the subsequent ones are shrunk again (to the square of -the desired proportion) 30 lines later. - -Also set the Ascent of the line, as the wrong base-line causes the lower -part of the line to be clipped. - -(regression from 42532d42bfcdb12df86376cda009e8e315a82153) - -(cherry picked from commit 4e223fab04279c3583689e69fa1342966e81de36) - -Conflicts: - sw/source/core/text/itrform2.cxx - -Change-Id: I0424396263293deaa318c80eedc2237cdb01b22b -Reviewed-on: https://gerrit.libreoffice.org/12156 -Reviewed-by: Miklos Vajna -Tested-by: Miklos Vajna ---- - sw/source/core/text/itrform2.cxx | 18 +++++++++++++----- - 1 file changed, 13 insertions(+), 5 deletions(-) - -diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx -index 2738b9b..4880013 100644 ---- a/sw/source/core/text/itrform2.cxx -+++ b/sw/source/core/text/itrform2.cxx -@@ -1741,24 +1741,30 @@ void SwTxtFormatter::CalcRealHeight( bool bNewLine ) - switch( pSpace->GetLineSpaceRule() ) - { - case SVX_LINE_SPACE_AUTO: -- if (pSpace->GetInterLineSpaceRule()==SVX_INTER_LINE_SPACE_PROP) { -+ // shrink first line of paragraph too on spacing < 100% -+ if (IsParaLine() && -+ pSpace->GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP) -+ { - long nTmp = pSpace->GetPropLineSpace(); -+ // Word will render < 50% too but it's just not readable -+ if( nTmp < 50 ) -+ nTmp = nTmp ? 50 : 100; - if (nTmp<100) { // code adaped from fixed line height - nTmp *= nLineHeight; - nTmp /= 100; - if( !nTmp ) - ++nTmp; - nLineHeight = (KSHORT)nTmp; -- /* -- //@TODO figure out how WW maps ascent and descent -- //in case of prop line spacing <100% - KSHORT nAsc = ( 4 * nLineHeight ) / 5; // 80% -+#if 0 -+ // could do clipping here (like Word does) -+ // but at 0.5 its unreadable either way... - if( nAsc < pCurr->GetAscent() || - nLineHeight - nAsc < pCurr->Height() - - pCurr->GetAscent() ) - pCurr->SetClipping( true ); -+#endif - pCurr->SetAscent( nAsc ); -- */ - pCurr->Height( nLineHeight ); - pInf->GetParaPortion()->SetFixLineHeight(); - } -@@ -1784,6 +1790,8 @@ void SwTxtFormatter::CalcRealHeight( bool bNewLine ) - break; - default: OSL_FAIL( ": unknown LineSpaceRule" ); - } -+ // Note: for the _first_ line the line spacing of the previous -+ // paragraph is applied in SwFlowFrm::CalcUpperSpace() - if( !IsParaLine() ) - switch( pSpace->GetInterLineSpaceRule() ) - { --- -1.9.3 - diff --git a/0001-fdo-80284-Avoid-broadcasting-during-cell-delete-shif.patch b/0001-fdo-80284-Avoid-broadcasting-during-cell-delete-shif.patch deleted file mode 100644 index b9d160f..0000000 --- a/0001-fdo-80284-Avoid-broadcasting-during-cell-delete-shif.patch +++ /dev/null @@ -1,40 +0,0 @@ -From b35c51d15189835bd388411f9ab4baefacd7b460 Mon Sep 17 00:00:00 2001 -From: Kohei Yoshida -Date: Fri, 17 Oct 2014 21:48:31 -0400 -Subject: [PATCH] fdo#80284: Avoid broadcasting during cell delete & shift. - -Broadcasting it here and marking formula cells dirty prevents them -from being entered into the formula tree at the end. They get marked -"postponed dirty" during reference update, and are supposed to be -set dirty at the end. - -Change-Id: I65977300ee4ee26b6166d170acd2145abcbbf288 -(cherry picked from commit 7fef943114b9184e69c8c714bf158116b8d9caf7) -Reviewed-on: https://gerrit.libreoffice.org/12014 -Reviewed-by: Eike Rathke -Tested-by: Eike Rathke ---- - sc/source/core/data/table2.cxx | 7 ++----- - 1 file changed, 2 insertions(+), 5 deletions(-) - -diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx -index 9abd954..9b4fd02 100644 ---- a/sc/source/core/data/table2.cxx -+++ b/sc/source/core/data/table2.cxx -@@ -391,11 +391,8 @@ void ScTable::DeleteCol( - } - } - -- { // scope for bulk broadcast -- ScBulkBroadcast aBulkBroadcast( pDocument->GetBASM()); -- for (SCSIZE i = 0; i < nSize; i++) -- aCol[nStartCol + i].DeleteArea(nStartRow, nEndRow, IDF_ALL); -- } -+ for (SCSIZE i = 0; i < nSize; i++) -+ aCol[nStartCol + i].DeleteArea(nStartRow, nEndRow, IDF_ALL, false); - - if ((nStartRow == 0) && (nEndRow == MAXROW)) - { --- -1.9.3 - diff --git a/0001-fdo-80846-Broadcast-changes-before-EndUndo.patch b/0001-fdo-80846-Broadcast-changes-before-EndUndo.patch deleted file mode 100644 index 90fdd8c..0000000 --- a/0001-fdo-80846-Broadcast-changes-before-EndUndo.patch +++ /dev/null @@ -1,80 +0,0 @@ -From eb5f25984307cd9e63e9cc88cbdb09228d66b097 Mon Sep 17 00:00:00 2001 -From: Kohei Yoshida -Date: Sat, 11 Oct 2014 14:18:10 -0400 -Subject: [PATCH] fdo#80846: Broadcast changes before EndUndo(). -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -EndUndo() calls PostDataChanged(), which renders the recalculated formula -cells. Not broadcasting before EndUndo causes some dependent formula -cells to not get recalculated. - -This one unfortunately is not currently unit-testable as this behavior -depends on the presence of ScTabViewShell.... - -Change-Id: I86288608b7f2627cda7c74be27a18029832775ef -(cherry picked from commit 424bfaa773e58d6b609ac7f64907db4b542d1315) -Reviewed-on: https://gerrit.libreoffice.org/11927 -Reviewed-by: Caolán McNamara -Tested-by: Caolán McNamara ---- - sc/source/ui/undo/undoblk3.cxx | 23 +++++++++-------------- - 1 file changed, 9 insertions(+), 14 deletions(-) - -diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx -index 03edabf..6784134 100644 ---- a/sc/source/ui/undo/undoblk3.cxx -+++ b/sc/source/ui/undo/undoblk3.cxx -@@ -170,12 +170,20 @@ void ScUndoDeleteContents::DoChange( const bool bUndo ) - SetChangeTrack(); - } - -+ if (nFlags & IDF_CONTENTS) -+ { -+ // Broadcast only when the content changes. fdo#74687 -+ if (mpDataSpans) -+ BroadcastChanges(*mpDataSpans); -+ else -+ BroadcastChanges(aRange); -+ } -+ - ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); - if ( !( (pViewShell) && pViewShell->AdjustRowHeight( - aRange.aStart.Row(), aRange.aEnd.Row() ) ) ) - /*A*/ pDocShell->PostPaint( aRange, PAINT_GRID | PAINT_EXTRAS, nExtFlags ); - -- pDocShell->PostDataChanged(); - if (pViewShell) - pViewShell->CellContentChanged(); - -@@ -188,15 +196,6 @@ void ScUndoDeleteContents::Undo() - DoChange( true ); - EndUndo(); - -- if (nFlags & IDF_CONTENTS) -- { -- // Broadcast only when the content changes. fdo#74687 -- if (mpDataSpans) -- BroadcastChanges(*mpDataSpans); -- else -- BroadcastChanges(aRange); -- } -- - HelperNotifyChanges::NotifyIfChangesListeners(*pDocShell, aRange); - } - -@@ -206,10 +205,6 @@ void ScUndoDeleteContents::Redo() - DoChange( false ); - EndRedo(); - -- if (nFlags & IDF_CONTENTS) -- // Broadcast only when the content changes. fdo#74687 -- BroadcastChanges(aRange); -- - HelperNotifyChanges::NotifyIfChangesListeners(*pDocShell, aRange); - } - --- -1.9.3 - diff --git a/0001-fdo-81633-Add-a-hidden-configuration-option-to-toggl.patch b/0001-fdo-81633-Add-a-hidden-configuration-option-to-toggl.patch deleted file mode 100644 index 00ee26f..0000000 --- a/0001-fdo-81633-Add-a-hidden-configuration-option-to-toggl.patch +++ /dev/null @@ -1,593 +0,0 @@ -From 2554bd33ebc74644b906ff7c0253ddf82a9789e2 Mon Sep 17 00:00:00 2001 -From: Kohei Yoshida -Date: Thu, 9 Oct 2014 16:21:59 +0100 -Subject: [PATCH] fdo#81633: Add a hidden configuration option to toggle ref - update on sort. - -This option is defaulted to off for 4.3 for back-compatibility. - -Change-Id: I5ac686e96742df40f7d8ba5ffec23806db2988a6 -Reviewed-on: https://gerrit.libreoffice.org/11902 -Reviewed-by: Muthu Subramanian K -Reviewed-by: Eike Rathke -Tested-by: Eike Rathke ---- - .../registry/schema/org/openoffice/Office/Calc.xcs | 10 ++ - sc/inc/document.hxx | 5 +- - sc/inc/inputopt.hxx | 3 + - sc/inc/sc.hrc | 1 + - sc/inc/sortparam.hxx | 1 + - sc/inc/table.hxx | 8 +- - sc/qa/unit/ucalc.cxx | 12 +-- - sc/source/core/data/documen3.cxx | 5 +- - sc/source/core/data/table3.cxx | 115 ++++++++++++--------- - sc/source/core/tool/inputopt.cxx | 34 +++--- - sc/source/ui/app/scmod.cxx | 9 +- - sc/source/ui/docshell/dbdocfun.cxx | 5 +- - sc/source/ui/undo/undosort.cxx | 2 + - 13 files changed, 136 insertions(+), 74 deletions(-) - -diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs -index d2b9692..9878f53 100644 ---- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs -+++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs -@@ -678,6 +678,16 @@ - - false - -+ -+ -+ -+ -+ -+ Specifies whether references get updated when performing sort on a range of cells. -+ -+ -+ false -+ - - - -diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx -index c8ca888..1052e6c 100644 ---- a/sc/inc/document.hxx -+++ b/sc/inc/document.hxx -@@ -1678,7 +1678,10 @@ public: - SC_DLLPUBLIC SvNumberFormatter* GetFormatTable() const; - SC_DLLPUBLIC SvNumberFormatter* CreateFormatTable() const; - -- void Sort( SCTAB nTab, const ScSortParam& rSortParam, bool bKeepQuery, ScProgress* pProgress, sc::ReorderParam* pUndo ); -+ void Sort( -+ SCTAB nTab, const ScSortParam& rSortParam, bool bKeepQuery, bool bUpdateRefs, -+ ScProgress* pProgress, sc::ReorderParam* pUndo ); -+ - void Reorder( const sc::ReorderParam& rParam, ScProgress* pProgress ); - - SCSIZE Query( SCTAB nTab, const ScQueryParam& rQueryParam, bool bKeepSub ); -diff --git a/sc/inc/inputopt.hxx b/sc/inc/inputopt.hxx -index bc25992..37bfbc4 100644 ---- a/sc/inc/inputopt.hxx -+++ b/sc/inc/inputopt.hxx -@@ -31,6 +31,7 @@ private: - bool bExtendFormat; - bool bRangeFinder; - bool bExpandRefs; -+ bool mbSortRefUpdate; - bool bMarkHeader; - bool bUseTabCol; - bool bTextWysiwyg; -@@ -56,6 +57,8 @@ public: - bool GetRangeFinder() const { return bRangeFinder; } - void SetExpandRefs(bool bSet) { bExpandRefs = bSet; } - bool GetExpandRefs() const { return bExpandRefs; } -+ void SetSortRefUpdate(bool bSet) { mbSortRefUpdate = bSet; } -+ bool GetSortRefUpdate() const { return mbSortRefUpdate; } - void SetMarkHeader(bool bSet) { bMarkHeader = bSet; } - bool GetMarkHeader() const { return bMarkHeader; } - void SetUseTabCol(bool bSet) { bUseTabCol = bSet; } -diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc -index 5204efb..a191f7b 100644 ---- a/sc/inc/sc.hrc -+++ b/sc/inc/sc.hrc -@@ -86,6 +86,7 @@ - - // TabPage entry - Legacy selection - #define SID_SC_INPUT_LEGACY_CELL_SELECTION (SC_VIEW_START + 15) -+#define SID_SC_OPT_SORT_REF_UPDATE (SC_VIEW_START + 16) - - // Format options - #define SID_SCFORMULAOPTIONS (SC_VIEW_START + 20) -diff --git a/sc/inc/sortparam.hxx b/sc/inc/sortparam.hxx -index e61528b..6f6364a 100644 ---- a/sc/inc/sortparam.hxx -+++ b/sc/inc/sortparam.hxx -@@ -97,6 +97,7 @@ struct SC_DLLPUBLIC ReorderParam - bool mbByRow; - bool mbPattern; - bool mbHiddenFiltered; -+ bool mbUpdateRefs; - - /** - * Reorder the position indices such that it can be used to undo the -diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx -index 537846d..fe36dac 100644 ---- a/sc/inc/table.hxx -+++ b/sc/inc/table.hxx -@@ -826,7 +826,9 @@ public: - void ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 ); - - void Sort( -- const ScSortParam& rSortParam, bool bKeepQuery, ScProgress* pProgress, sc::ReorderParam* pUndo ); -+ const ScSortParam& rSortParam, bool bKeepQuery, bool bUpdateRefs, -+ ScProgress* pProgress, sc::ReorderParam* pUndo ); -+ - void Reorder( const sc::ReorderParam& rParam, ScProgress* pProgress ); - - bool ValidQuery( -@@ -1023,7 +1025,9 @@ private: - short Compare(SCCOLROW nIndex1, SCCOLROW nIndex2) const; - short Compare( ScSortInfoArray*, SCCOLROW nIndex1, SCCOLROW nIndex2) const; - ScSortInfoArray* CreateSortInfoArray( const sc::ReorderParam& rParam ); -- ScSortInfoArray* CreateSortInfoArray( const ScSortParam& rSortParam, SCCOLROW nInd1, SCCOLROW nInd2, bool bKeepQuery ); -+ ScSortInfoArray* CreateSortInfoArray( -+ const ScSortParam& rSortParam, SCCOLROW nInd1, SCCOLROW nInd2, -+ bool bKeepQuery, bool bUpdateRefs ); - void QuickSort( ScSortInfoArray*, SCsCOLROW nLo, SCsCOLROW nHi); - void SortReorderByColumn( ScSortInfoArray* pArray, SCROW nRow1, SCROW nRow2, bool bPattern, ScProgress* pProgress ); - void SortReorderByRow( ScSortInfoArray* pArray, SCCOL nCol1, SCCOL nCol2, ScProgress* pProgress ); -diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx -index 8f22cf4..8e19f2f 100644 ---- a/sc/qa/unit/ucalc.cxx -+++ b/sc/qa/unit/ucalc.cxx -@@ -4773,7 +4773,7 @@ void Test::testSortWithFormulaRefs() - aSortData.maKeyState[0].bDoSort = true; - aSortData.maKeyState[0].nField = 0; - -- m_pDoc->Sort(0, aSortData, false, NULL, NULL); -+ m_pDoc->Sort(0, aSortData, false, true, NULL, NULL); - - for (size_t i = 0; i < SAL_N_ELEMENTS(aResults); ++i) - { -@@ -4808,7 +4808,7 @@ void Test::testSortWithStrings() - aParam.maKeyState[0].bAscending = true; - aParam.maKeyState[0].nField = 1; - -- m_pDoc->Sort(0, aParam, false, NULL, NULL); -+ m_pDoc->Sort(0, aParam, false, true, NULL, NULL); - - CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(1,1,0))); - CPPUNIT_ASSERT_EQUAL(OUString("Val1"), m_pDoc->GetString(ScAddress(1,2,0))); -@@ -4816,7 +4816,7 @@ void Test::testSortWithStrings() - - aParam.maKeyState[0].bAscending = false; - -- m_pDoc->Sort(0, aParam, false, NULL, NULL); -+ m_pDoc->Sort(0, aParam, false, true, NULL, NULL); - - CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(1,1,0))); - CPPUNIT_ASSERT_EQUAL(OUString("Val2"), m_pDoc->GetString(ScAddress(1,2,0))); -@@ -4859,7 +4859,7 @@ void Test::testSort() - aSortData.maKeyState[0].nField = 1; - aSortData.maKeyState[0].bAscending = true; - -- m_pDoc->Sort(0, aSortData, false, NULL, NULL); -+ m_pDoc->Sort(0, aSortData, false, true, NULL, NULL); - - double nVal = m_pDoc->GetValue(1,0,0); - ASSERT_DOUBLES_EQUAL(nVal, 1.0); -@@ -4892,7 +4892,7 @@ void Test::testSort() - aSortData.nRow2 = aDataRange.aEnd.Row(); - aSortData.bHasHeader = true; - aSortData.maKeyState[0].nField = 0; -- m_pDoc->Sort(0, aSortData, false, NULL, NULL); -+ m_pDoc->Sort(0, aSortData, false, true, NULL, NULL); - - // Title should stay at the top, numbers should be sorted numerically, - // numbers always come before strings, and empty cells always occur at the -@@ -5022,7 +5022,7 @@ void Test::testSortInFormulaGroup() - aSortData.maKeyState[0].nField = 0; - aSortData.maKeyState[0].bAscending = true; - -- m_pDoc->Sort(0, aSortData, false, NULL, NULL); -+ m_pDoc->Sort(0, aSortData, false, true, NULL, NULL); - - static struct { - SCCOL nCol; -diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx -index 73cb7ad..ef39f33 100644 ---- a/sc/source/core/data/documen3.cxx -+++ b/sc/source/core/data/documen3.cxx -@@ -1366,13 +1366,14 @@ bool ScDocument::UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, b - } - - void ScDocument::Sort( -- SCTAB nTab, const ScSortParam& rSortParam, bool bKeepQuery, ScProgress* pProgress, sc::ReorderParam* pUndo ) -+ SCTAB nTab, const ScSortParam& rSortParam, bool bKeepQuery, bool bUpdateRefs, -+ ScProgress* pProgress, sc::ReorderParam* pUndo ) - { - if ( ValidTab(nTab) && nTab < static_cast(maTabs.size()) && maTabs[nTab] ) - { - bool bOldEnableIdle = IsIdleEnabled(); - EnableIdle(false); -- maTabs[nTab]->Sort(rSortParam, bKeepQuery, pProgress, pUndo); -+ maTabs[nTab]->Sort(rSortParam, bKeepQuery, bUpdateRefs, pProgress, pUndo); - EnableIdle(bOldEnableIdle); - } - } -diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx -index c5bfe75..ce17bb9 100644 ---- a/sc/source/core/data/table3.cxx -+++ b/sc/source/core/data/table3.cxx -@@ -262,6 +262,7 @@ private: - - std::vector maOrderIndices; - bool mbKeepQuery; -+ bool mbUpdateRefs; - - public: - ScSortInfoArray( sal_uInt16 nSorts, SCCOLROW nInd1, SCCOLROW nInd2 ) : -@@ -309,6 +310,10 @@ public: - - bool IsKeepQuery() const { return mbKeepQuery; } - -+ void SetUpdateRefs( bool b ) { mbUpdateRefs = b; } -+ -+ bool IsUpdateRefs() const { return mbUpdateRefs; } -+ - /** - * Call this only during normal sorting, not from reordering. - */ -@@ -472,6 +477,7 @@ ScSortInfoArray* ScTable::CreateSortInfoArray( const sc::ReorderParam& rParam ) - - pArray = new ScSortInfoArray(0, nRow1, nRow2); - pArray->SetKeepQuery(rParam.mbHiddenFiltered); -+ pArray->SetUpdateRefs(rParam.mbUpdateRefs); - - initDataRows( - *pArray, *this, aCol, nCol1, nRow1, nCol2, nRow2, -@@ -484,19 +490,22 @@ ScSortInfoArray* ScTable::CreateSortInfoArray( const sc::ReorderParam& rParam ) - - pArray = new ScSortInfoArray(0, nCol1, nCol2); - pArray->SetKeepQuery(rParam.mbHiddenFiltered); -+ pArray->SetUpdateRefs(rParam.mbUpdateRefs); - } - - return pArray; - } - - ScSortInfoArray* ScTable::CreateSortInfoArray( -- const ScSortParam& rSortParam, SCCOLROW nInd1, SCCOLROW nInd2, bool bKeepQuery ) -+ const ScSortParam& rSortParam, SCCOLROW nInd1, SCCOLROW nInd2, -+ bool bKeepQuery, bool bUpdateRefs ) - { - sal_uInt16 nUsedSorts = 1; - while ( nUsedSorts < rSortParam.GetSortKeyCount() && rSortParam.maKeyState[nUsedSorts].bDoSort ) - nUsedSorts++; - ScSortInfoArray* pArray = new ScSortInfoArray( nUsedSorts, nInd1, nInd2 ); - pArray->SetKeepQuery(bKeepQuery); -+ pArray->SetUpdateRefs(bUpdateRefs); - - if ( rSortParam.bByRow ) - { -@@ -738,16 +747,19 @@ void ScTable::SortReorderByColumn( - } - } - -- for (SCCOL nCol = nStart; nCol <= nLast; ++nCol) -- aCol[nCol].CollectListeners(aListeners, nRow1, nRow2); -+ if (pArray->IsUpdateRefs()) -+ { -+ for (SCCOL nCol = nStart; nCol <= nLast; ++nCol) -+ aCol[nCol].CollectListeners(aListeners, nRow1, nRow2); - -- // Remove any duplicate listener entries and notify all listeners -- // afterward. We must ensure that we notify each unique listener only -- // once. -- std::sort(aListeners.begin(), aListeners.end()); -- aListeners.erase(std::unique(aListeners.begin(), aListeners.end()), aListeners.end()); -- ColReorderNotifier aFunc(aColMap, nTab, nRow1, nRow2); -- std::for_each(aListeners.begin(), aListeners.end(), aFunc); -+ // Remove any duplicate listener entries and notify all listeners -+ // afterward. We must ensure that we notify each unique listener only -+ // once. -+ std::sort(aListeners.begin(), aListeners.end()); -+ aListeners.erase(std::unique(aListeners.begin(), aListeners.end()), aListeners.end()); -+ ColReorderNotifier aFunc(aColMap, nTab, nRow1, nRow2); -+ std::for_each(aListeners.begin(), aListeners.end(), aFunc); -+ } - - // Re-start area listeners on the reordered columns. - { -@@ -1002,39 +1014,51 @@ void ScTable::SortReorderByRow( - } - } - -- // Collect listeners of cell broadcasters. -- for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol) -- aCol[nCol].CollectListeners(aListeners, nRow1, nRow2); -+ if (pArray->IsUpdateRefs()) -+ { -+ // Collect listeners of cell broadcasters. -+ for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol) -+ aCol[nCol].CollectListeners(aListeners, nRow1, nRow2); - -- // Remove any duplicate listener entries. We must ensure that we notify -- // each unique listener only once. -- std::sort(aListeners.begin(), aListeners.end()); -- aListeners.erase(std::unique(aListeners.begin(), aListeners.end()), aListeners.end()); -+ // Remove any duplicate listener entries. We must ensure that we notify -+ // each unique listener only once. -+ std::sort(aListeners.begin(), aListeners.end()); -+ aListeners.erase(std::unique(aListeners.begin(), aListeners.end()), aListeners.end()); - -- // Collect positions of all shared formula cells outside the sorted range, -- // and make them unshared before notifying them. -- sc::RefQueryFormulaGroup aFormulaGroupPos; -- aFormulaGroupPos.setSkipRange(ScRange(nCol1, nRow1, nTab, nCol2, nRow2, nTab)); -+ // Collect positions of all shared formula cells outside the sorted range, -+ // and make them unshared before notifying them. -+ sc::RefQueryFormulaGroup aFormulaGroupPos; -+ aFormulaGroupPos.setSkipRange(ScRange(nCol1, nRow1, nTab, nCol2, nRow2, nTab)); - -- std::for_each(aListeners.begin(), aListeners.end(), FormulaGroupPosCollector(aFormulaGroupPos)); -- const sc::RefQueryFormulaGroup::TabsType& rGroupTabs = aFormulaGroupPos.getAllPositions(); -- sc::RefQueryFormulaGroup::TabsType::const_iterator itGroupTab = rGroupTabs.begin(), itGroupTabEnd = rGroupTabs.end(); -- for (; itGroupTab != itGroupTabEnd; ++itGroupTab) -- { -- const sc::RefQueryFormulaGroup::ColsType& rCols = itGroupTab->second; -- sc::RefQueryFormulaGroup::ColsType::const_iterator itCol = rCols.begin(), itColEnd = rCols.end(); -- for (; itCol != itColEnd; ++itCol) -+ std::for_each(aListeners.begin(), aListeners.end(), FormulaGroupPosCollector(aFormulaGroupPos)); -+ const sc::RefQueryFormulaGroup::TabsType& rGroupTabs = aFormulaGroupPos.getAllPositions(); -+ sc::RefQueryFormulaGroup::TabsType::const_iterator itGroupTab = rGroupTabs.begin(), itGroupTabEnd = rGroupTabs.end(); -+ for (; itGroupTab != itGroupTabEnd; ++itGroupTab) -+ { -+ const sc::RefQueryFormulaGroup::ColsType& rCols = itGroupTab->second; -+ sc::RefQueryFormulaGroup::ColsType::const_iterator itCol = rCols.begin(), itColEnd = rCols.end(); -+ for (; itCol != itColEnd; ++itCol) -+ { -+ const sc::RefQueryFormulaGroup::ColType& rCol = itCol->second; -+ std::vector aBounds(rCol); -+ pDocument->UnshareFormulaCells(itGroupTab->first, itCol->first, aBounds); -+ } -+ } -+ -+ // Notify the listeners. -+ RowReorderNotifier aFunc(aRowMap, nTab, nCol1, nCol2); -+ std::for_each(aListeners.begin(), aListeners.end(), aFunc); -+ -+ // Re-group formulas in affected columns. -+ for (itGroupTab = rGroupTabs.begin(); itGroupTab != itGroupTabEnd; ++itGroupTab) - { -- const sc::RefQueryFormulaGroup::ColType& rCol = itCol->second; -- std::vector aBounds(rCol); -- pDocument->UnshareFormulaCells(itGroupTab->first, itCol->first, aBounds); -+ const sc::RefQueryFormulaGroup::ColsType& rCols = itGroupTab->second; -+ sc::RefQueryFormulaGroup::ColsType::const_iterator itCol = rCols.begin(), itColEnd = rCols.end(); -+ for (; itCol != itColEnd; ++itCol) -+ pDocument->RegroupFormulaCells(itGroupTab->first, itCol->first); - } - } - -- // Notify the listeners. -- RowReorderNotifier aFunc(aRowMap, nTab, nCol1, nCol2); -- std::for_each(aListeners.begin(), aListeners.end(), aFunc); -- - // Re-start area listeners on the reordered rows. - { - std::vector::iterator it = aAreaListeners.begin(), itEnd = aAreaListeners.end(); -@@ -1051,15 +1075,6 @@ void ScTable::SortReorderByRow( - } - } - -- // Re-group formulas in affected columns. -- for (itGroupTab = rGroupTabs.begin(); itGroupTab != itGroupTabEnd; ++itGroupTab) -- { -- const sc::RefQueryFormulaGroup::ColsType& rCols = itGroupTab->second; -- sc::RefQueryFormulaGroup::ColsType::const_iterator itCol = rCols.begin(), itColEnd = rCols.end(); -- for (; itCol != itColEnd; ++itCol) -- pDocument->RegroupFormulaCells(itGroupTab->first, itCol->first); -- } -- - // Re-group columns in the sorted range too. - for (SCCOL i = nCol1; i <= nCol2; ++i) - aCol[i].RegroupFormulaCells(); -@@ -1282,7 +1297,8 @@ void ScTable::DecoladeRow( ScSortInfoArray* pArray, SCROW nRow1, SCROW nRow2 ) - } - - void ScTable::Sort( -- const ScSortParam& rSortParam, bool bKeepQuery, ScProgress* pProgress, sc::ReorderParam* pUndo ) -+ const ScSortParam& rSortParam, bool bKeepQuery, bool bUpdateRefs, -+ ScProgress* pProgress, sc::ReorderParam* pUndo ) - { - aSortParam = rSortParam; - InitSortCollator( rSortParam ); -@@ -1294,6 +1310,7 @@ void ScTable::Sort( - pUndo->mbByRow = rSortParam.bByRow; - pUndo->mbPattern = rSortParam.bIncludePattern; - pUndo->mbHiddenFiltered = bKeepQuery; -+ pUndo->mbUpdateRefs = bUpdateRefs; - } - - if (rSortParam.bByRow) -@@ -1309,7 +1326,7 @@ void ScTable::Sort( - if(pProgress) - pProgress->SetState( 0, nLastRow-nRow1 ); - -- boost::scoped_ptr pArray(CreateSortInfoArray(aSortParam, nRow1, nLastRow, bKeepQuery)); -+ boost::scoped_ptr pArray(CreateSortInfoArray(aSortParam, nRow1, nLastRow, bKeepQuery, bUpdateRefs)); - - if ( nLastRow - nRow1 > 255 ) - DecoladeRow(pArray.get(), nRow1, nLastRow); -@@ -1338,7 +1355,7 @@ void ScTable::Sort( - if(pProgress) - pProgress->SetState( 0, nLastCol-nCol1 ); - -- boost::scoped_ptr pArray(CreateSortInfoArray(aSortParam, nCol1, nLastCol, bKeepQuery)); -+ boost::scoped_ptr pArray(CreateSortInfoArray(aSortParam, nCol1, nLastCol, bKeepQuery, bUpdateRefs)); - - QuickSort(pArray.get(), nCol1, nLastCol); - SortReorderByColumn(pArray.get(), aSortParam.nRow1, aSortParam.nRow2, aSortParam.bIncludePattern, pProgress); -@@ -2370,7 +2387,7 @@ void ScTable::TopTenQuery( ScQueryParam& rParam ) - bSortCollatorInitialized = true; - InitSortCollator( aLocalSortParam ); - } -- boost::scoped_ptr pArray(CreateSortInfoArray(aSortParam, nRow1, rParam.nRow2, bGlobalKeepQuery)); -+ boost::scoped_ptr pArray(CreateSortInfoArray(aSortParam, nRow1, rParam.nRow2, bGlobalKeepQuery, false)); - DecoladeRow( pArray.get(), nRow1, rParam.nRow2 ); - QuickSort( pArray.get(), nRow1, rParam.nRow2 ); - ScSortInfo** ppInfo = pArray->GetFirstArray(); -diff --git a/sc/source/core/tool/inputopt.cxx b/sc/source/core/tool/inputopt.cxx -index ccedff6..27c9fb8 100644 ---- a/sc/source/core/tool/inputopt.cxx -+++ b/sc/source/core/tool/inputopt.cxx -@@ -55,6 +55,7 @@ void ScInputOptions::SetDefaults() - bExtendFormat = false; - bRangeFinder = true; - bExpandRefs = false; -+ mbSortRefUpdate = true; - bMarkHeader = true; - bUseTabCol = false; - bTextWysiwyg = false; -@@ -70,6 +71,7 @@ const ScInputOptions& ScInputOptions::operator=( const ScInputOptions& rCpy ) - bExtendFormat = rCpy.bExtendFormat; - bRangeFinder = rCpy.bRangeFinder; - bExpandRefs = rCpy.bExpandRefs; -+ mbSortRefUpdate = rCpy.mbSortRefUpdate; - bMarkHeader = rCpy.bMarkHeader; - bUseTabCol = rCpy.bUseTabCol; - bTextWysiwyg = rCpy.bTextWysiwyg; -@@ -83,18 +85,19 @@ const ScInputOptions& ScInputOptions::operator=( const ScInputOptions& rCpy ) - - #define CFGPATH_INPUT "Office.Calc/Input" - --#define SCINPUTOPT_MOVEDIR 0 --#define SCINPUTOPT_MOVESEL 1 --#define SCINPUTOPT_EDTEREDIT 2 --#define SCINPUTOPT_EXTENDFMT 3 --#define SCINPUTOPT_RANGEFIND 4 --#define SCINPUTOPT_EXPANDREFS 5 --#define SCINPUTOPT_MARKHEADER 6 --#define SCINPUTOPT_USETABCOL 7 --#define SCINPUTOPT_TEXTWYSIWYG 8 --#define SCINPUTOPT_REPLCELLSWARN 9 --#define SCINPUTOPT_LEGACY_CELL_SELECTION 10 --#define SCINPUTOPT_COUNT 11 -+#define SCINPUTOPT_MOVEDIR 0 -+#define SCINPUTOPT_MOVESEL 1 -+#define SCINPUTOPT_EDTEREDIT 2 -+#define SCINPUTOPT_EXTENDFMT 3 -+#define SCINPUTOPT_RANGEFIND 4 -+#define SCINPUTOPT_EXPANDREFS 5 -+#define SCINPUTOPT_SORT_REF_UPDATE 6 -+#define SCINPUTOPT_MARKHEADER 7 -+#define SCINPUTOPT_USETABCOL 8 -+#define SCINPUTOPT_TEXTWYSIWYG 9 -+#define SCINPUTOPT_REPLCELLSWARN 10 -+#define SCINPUTOPT_LEGACY_CELL_SELECTION 11 -+#define SCINPUTOPT_COUNT 12 - - Sequence ScInputCfg::GetPropertyNames() - { -@@ -106,6 +109,7 @@ Sequence ScInputCfg::GetPropertyNames() - "ExpandFormatting", // SCINPUTOPT_EXTENDFMT - "ShowReference", // SCINPUTOPT_RANGEFIND - "ExpandReference", // SCINPUTOPT_EXPANDREFS -+ "UpdateReferenceOnSort", // SCINPUTOPT_SORT_REF_UPDATE - "HighlightSelection", // SCINPUTOPT_MARKHEADER - "UseTabCol", // SCINPUTOPT_USETABCOL - "UsePrinterMetrics", // SCINPUTOPT_TEXTWYSIWYG -@@ -157,6 +161,9 @@ ScInputCfg::ScInputCfg() : - case SCINPUTOPT_EXPANDREFS: - SetExpandRefs( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); - break; -+ case SCINPUTOPT_SORT_REF_UPDATE: -+ SetSortRefUpdate(ScUnoHelpFunctions::GetBoolFromAny(pValues[nProp])); -+ break; - case SCINPUTOPT_MARKHEADER: - SetMarkHeader( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); - break; -@@ -206,6 +213,9 @@ void ScInputCfg::Commit() - case SCINPUTOPT_EXPANDREFS: - ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetExpandRefs() ); - break; -+ case SCINPUTOPT_SORT_REF_UPDATE: -+ ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetSortRefUpdate() ); -+ break; - case SCINPUTOPT_MARKHEADER: - ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetMarkHeader() ); - break; -diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx -index 9f4a7e9..a0f222e 100644 ---- a/sc/source/ui/app/scmod.cxx -+++ b/sc/source/ui/app/scmod.cxx -@@ -1242,6 +1242,12 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet ) - pInputCfg->SetExpandRefs( ((const SfxBoolItem*)pItem)->GetValue() ); - bSaveInputOptions = true; - } -+ if (rOptSet.HasItem(SID_SC_OPT_SORT_REF_UPDATE, &pItem)) -+ { -+ pInputCfg->SetSortRefUpdate(static_cast(pItem)->GetValue()); -+ bSaveInputOptions = true; -+ } -+ - if ( rOptSet.HasItem(SID_SC_INPUT_MARK_HEADER,&pItem) ) - { - pInputCfg->SetMarkHeader( ((const SfxBoolItem*)pItem)->GetValue() ); -@@ -1999,7 +2005,7 @@ SfxItemSet* ScModule::CreateItemSet( sal_uInt16 nId ) - SID_SC_INPUT_SELECTION,SID_SC_INPUT_MARK_HEADER, - SID_SC_INPUT_TEXTWYSIWYG,SID_SC_INPUT_TEXTWYSIWYG, - SID_SC_INPUT_REPLCELLSWARN,SID_SC_INPUT_REPLCELLSWARN, -- SID_SC_INPUT_LEGACY_CELL_SELECTION,SID_SC_INPUT_LEGACY_CELL_SELECTION, -+ SID_SC_INPUT_LEGACY_CELL_SELECTION,SID_SC_OPT_SORT_REF_UPDATE, - // TP_USERLISTS: - SCITEM_USERLIST, SCITEM_USERLIST, - // TP_PRINT: -@@ -2062,6 +2068,7 @@ SfxItemSet* ScModule::CreateItemSet( sal_uInt16 nId ) - rInpOpt.GetRangeFinder() ) ); - pRet->Put( SfxBoolItem( SID_SC_INPUT_REF_EXPAND, - rInpOpt.GetExpandRefs() ) ); -+ pRet->Put( SfxBoolItem(SID_SC_OPT_SORT_REF_UPDATE, rInpOpt.GetSortRefUpdate())); - pRet->Put( SfxBoolItem( SID_SC_INPUT_MARK_HEADER, - rInpOpt.GetMarkHeader() ) ); - pRet->Put( SfxBoolItem( SID_SC_INPUT_TEXTWYSIWYG, -diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx -index 7469578..2ca4808 100644 ---- a/sc/source/ui/docshell/dbdocfun.cxx -+++ b/sc/source/ui/docshell/dbdocfun.cxx -@@ -48,6 +48,7 @@ - #include "markdata.hxx" - #include "progress.hxx" - #include -+#include - - #include - #include -@@ -514,8 +515,10 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam, - // don't call ScDocument::Sort with an empty SortParam (may be empty here if bCopy is set) - if (aLocalParam.GetSortKeyCount() && aLocalParam.maKeyState[0].bDoSort) - { -+ ScInputOptions aInputOption = SC_MOD()->GetInputOptions(); -+ bool bUpdateRefs = aInputOption.GetSortRefUpdate(); - ScProgress aProgress(&rDocShell, ScGlobal::GetRscString(STR_PROGRESS_SORTING), 0); -- pDoc->Sort(nTab, aLocalParam, bRepeatQuery, &aProgress, &aUndoParam); -+ pDoc->Sort(nTab, aLocalParam, bRepeatQuery, bUpdateRefs, &aProgress, &aUndoParam); - } - - if (bRecord) -diff --git a/sc/source/ui/undo/undosort.cxx b/sc/source/ui/undo/undosort.cxx -index 4ff0960..36156fe 100644 ---- a/sc/source/ui/undo/undosort.cxx -+++ b/sc/source/ui/undo/undosort.cxx -@@ -48,6 +48,8 @@ void UndoSort::Execute( bool bUndo ) - - pDocShell->PostPaint(maParam.maSortRange, PAINT_GRID); - pDocShell->PostDataChanged(); -+ if (!aParam.mbUpdateRefs) -+ rDoc.BroadcastCells(aParam.maSortRange, SC_HINT_DATACHANGED); - } - - } --- -1.9.3 - diff --git a/0001-fdo-82047-Correctly-adjust-references-in-range-names.patch b/0001-fdo-82047-Correctly-adjust-references-in-range-names.patch deleted file mode 100644 index de103d0..0000000 --- a/0001-fdo-82047-Correctly-adjust-references-in-range-names.patch +++ /dev/null @@ -1,76 +0,0 @@ -From ab5ff775b5b197a11a76a5e91859c31421ff559f Mon Sep 17 00:00:00 2001 -From: Kohei Yoshida -Date: Sat, 18 Oct 2014 20:22:53 -0400 -Subject: [PATCH] fdo#82047: Correctly adjust references in range names on row - deletion. - -Change-Id: Iac924b0b6932863f7f9cc088f996e0b07c340d2c -(cherry picked from commit 281847613bd3ae472523822f4be9c21cc353867e) -Reviewed-on: https://gerrit.libreoffice.org/12025 -Reviewed-by: Eike Rathke -Tested-by: Eike Rathke ---- - sc/source/core/tool/token.cxx | 47 +++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 47 insertions(+) - -diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx -index 916a88e..84c8ccc 100644 ---- a/sc/source/core/tool/token.cxx -+++ b/sc/source/core/tool/token.cxx -@@ -3170,6 +3170,53 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceInName( - if (adjustDoubleRefInName(rRef, rCxt, rPos)) - aRes.mbReferenceModified = true; - } -+ else if (rCxt.mnRowDelta < 0) -+ { -+ // row(s) deleted. -+ if (rRef.Ref1.IsRowRel() || rRef.Ref2.IsRowRel()) -+ // Don't modify relative references in names. -+ break; -+ -+ if (aAbs.aStart.Col() < rCxt.maRange.aStart.Col() || rCxt.maRange.aEnd.Col() < aAbs.aEnd.Col()) -+ // column range of the reference is not entirely in the deleted column range. -+ break; -+ -+ ScRange aDeleted = rCxt.maRange; -+ aDeleted.aStart.IncRow(rCxt.mnRowDelta); -+ aDeleted.aEnd.SetRow(aDeleted.aStart.Row()-rCxt.mnRowDelta-1); -+ -+ if (aAbs.aEnd.Row() < aDeleted.aStart.Row() || aDeleted.aEnd.Row() < aAbs.aStart.Row()) -+ // reference range doesn't intersect with the deleted range. -+ break; -+ -+ if (aDeleted.aStart.Row() <= aAbs.aStart.Row() && aAbs.aEnd.Row() <= aDeleted.aEnd.Row()) -+ { -+ // This reference is entirely deleted. -+ rRef.Ref1.SetRowDeleted(true); -+ rRef.Ref2.SetRowDeleted(true); -+ aRes.mbReferenceModified = true; -+ break; -+ } -+ -+ if (aAbs.aStart.Row() < aDeleted.aStart.Row()) -+ { -+ if (aDeleted.aEnd.Row() < aAbs.aEnd.Row()) -+ // Deleted in the middle. Make the reference shorter. -+ rRef.Ref2.IncRow(rCxt.mnRowDelta); -+ else -+ // Deleted at tail end. Cut off the lower part. -+ rRef.Ref2.SetAbsRow(aDeleted.aStart.Row()-1); -+ } -+ else -+ { -+ // Deleted at the top. Cut the top off and shift up. -+ rRef.Ref1.SetAbsRow(aDeleted.aEnd.Row()+1); -+ rRef.Ref1.IncRow(rCxt.mnRowDelta); -+ rRef.Ref2.IncRow(rCxt.mnRowDelta); -+ } -+ -+ aRes.mbReferenceModified = true; -+ } - else if (rCxt.maRange.Intersects(aAbs)) - { - if (rCxt.mnColDelta && rCxt.maRange.aStart.Row() <= aAbs.aStart.Row() && aAbs.aEnd.Row() <= rCxt.maRange.aEnd.Row()) --- -1.9.3 - diff --git a/0001-fdo-83901-ROW-and-COLUMN-to-be-properly-recalculated.patch b/0001-fdo-83901-ROW-and-COLUMN-to-be-properly-recalculated.patch deleted file mode 100644 index cbf245d..0000000 --- a/0001-fdo-83901-ROW-and-COLUMN-to-be-properly-recalculated.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 4b2f0915f9f3bff7d2476ec41a272e5263fbb312 Mon Sep 17 00:00:00 2001 -From: Kohei Yoshida -Date: Sun, 12 Oct 2014 10:18:09 -0400 -Subject: [PATCH] fdo#83901: ROW() and COLUMN() to be properly recalculated on - cell move. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -For cases where ROW or COLUMN references another cell that has shifted. - -Change-Id: Ic4bef8672dab811ceff6886d9af0388306a66485 -(cherry picked from commit 0b29a16d1dcffd75e49bd7ad3da867b0d0ebfa38) -Reviewed-on: https://gerrit.libreoffice.org/11934 -Reviewed-by: Caolán McNamara -Tested-by: Caolán McNamara ---- - sc/source/core/data/column.cxx | 6 ++++++ - sc/source/core/data/formulacell.cxx | 2 +- - 2 files changed, 7 insertions(+), 1 deletion(-) - -diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx -index 1676e1b..42da658 100644 ---- a/sc/source/core/data/column.cxx -+++ b/sc/source/core/data/column.cxx -@@ -2096,6 +2096,12 @@ class UpdateRefOnNonCopy : std::unary_function - if (pCode->IsRecalcModeOnRefMove()) - aRes.mbValueChanged = true; - } -+ else if (aRes.mbReferenceModified && pCode->IsRecalcModeOnRefMove()) -+ { -+ // The cell itself hasn't shifted. But it may have ROW or COLUMN -+ // referencing another cell that has. -+ aRes.mbValueChanged = true; -+ } - - if (aRes.mbNameModified) - recompileTokenArray(*pTop); -diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx -index 2059aee..96eb323 100644 ---- a/sc/source/core/data/formulacell.cxx -+++ b/sc/source/core/data/formulacell.cxx -@@ -2758,7 +2758,7 @@ bool ScFormulaCell::UpdateReferenceOnShift( - - if (bOnRefMove) - // Cell may reference itself, e.g. ocColumn, ocRow without parameter -- bOnRefMove = (bValChanged || (aPos != aOldPos)); -+ bOnRefMove = (bValChanged || (aPos != aOldPos) || bRefModified); - - bool bNewListening = false; - bool bInDeleteUndo = false; --- -1.9.3 - diff --git a/0001-fdo-85215-Don-t-adjust-references-wrt-cell-position-.patch b/0001-fdo-85215-Don-t-adjust-references-wrt-cell-position-.patch deleted file mode 100644 index fd286e7..0000000 --- a/0001-fdo-85215-Don-t-adjust-references-wrt-cell-position-.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 81e4dbe1adf196ee20f1a4bfbc50b54abfc79f4b Mon Sep 17 00:00:00 2001 -From: Kohei Yoshida -Date: Sun, 26 Oct 2014 14:43:14 -0700 -Subject: [PATCH] fdo#85215: Don't adjust references wrt cell position when - disabled. - -Change-Id: Ie1a12cc189bcb66fad59ea9901ac0dc95bb68788 -(cherry picked from commit 10fc138307afb4b39baddb0d56eb8e986e5d29ea) -Reviewed-on: https://gerrit.libreoffice.org/12106 -Reviewed-by: Markus Mohrhard -Tested-by: Markus Mohrhard ---- - sc/source/core/data/table3.cxx | 7 +++++-- - sc/source/ui/undo/undosort.cxx | 3 +-- - 2 files changed, 6 insertions(+), 4 deletions(-) - -diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx -index ce17bb9..05285d8 100644 ---- a/sc/source/core/data/table3.cxx -+++ b/sc/source/core/data/table3.cxx -@@ -856,8 +856,11 @@ void ScTable::SortReorderByRow( - ScAddress aOldPos = rCell.maCell.mpFormula->aPos; - - ScFormulaCell* pNew = rCell.maCell.mpFormula->Clone( aCellPos, SC_CLONECELL_DEFAULT); -- pNew->CopyAllBroadcasters(*rCell.maCell.mpFormula); -- pNew->GetCode()->AdjustReferenceOnMovedOrigin(aOldPos, aCellPos); -+ if (pArray->IsUpdateRefs()) -+ { -+ pNew->CopyAllBroadcasters(*rCell.maCell.mpFormula); -+ pNew->GetCode()->AdjustReferenceOnMovedOrigin(aOldPos, aCellPos); -+ } - - sc::CellStoreType::iterator itBlk = rCellStore.push_back(pNew); - } -diff --git a/sc/source/ui/undo/undosort.cxx b/sc/source/ui/undo/undosort.cxx -index 36156fe..4a00707 100644 ---- a/sc/source/ui/undo/undosort.cxx -+++ b/sc/source/ui/undo/undosort.cxx -@@ -46,8 +46,7 @@ void UndoSort::Execute( bool bUndo ) - - ScUndoUtil::MarkSimpleBlock(pDocShell, maParam.maSortRange); - -- pDocShell->PostPaint(maParam.maSortRange, PAINT_GRID); -- pDocShell->PostDataChanged(); -+ rDoc.SetDirty(maParam.maSortRange); - if (!aParam.mbUpdateRefs) - rDoc.BroadcastCells(aParam.maSortRange, SC_HINT_DATACHANGED); - } --- -1.9.3 - diff --git a/0001-fdo-85215-Ensure-that-formula-broadcasting-works-aft.patch b/0001-fdo-85215-Ensure-that-formula-broadcasting-works-aft.patch deleted file mode 100644 index 78b22a2..0000000 --- a/0001-fdo-85215-Ensure-that-formula-broadcasting-works-aft.patch +++ /dev/null @@ -1,52 +0,0 @@ -From fa08c98c485e0de34082f3d66c5e1b6609268be1 Mon Sep 17 00:00:00 2001 -From: Kohei Yoshida -Date: Mon, 27 Oct 2014 08:52:38 -0700 -Subject: [PATCH] fdo#85215: Ensure that formula broadcasting works after sort. - -When the reference update on sort is turned off. - -Change-Id: I547dd1525a638dd447fe331e22583af4a7947308 -(cherry picked from commit 1eb82c78a223d9a0b2bb5c3f5c129c1ee8bdf303) -Reviewed-on: https://gerrit.libreoffice.org/12113 -Reviewed-by: Michael Meeks -Tested-by: Michael Meeks ---- - sc/source/core/data/table3.cxx | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx -index 05285d8..f7589dd 100644 ---- a/sc/source/core/data/table3.cxx -+++ b/sc/source/core/data/table3.cxx -@@ -803,6 +803,15 @@ void ScTable::SortReorderByRow( - ScSortInfoArray::RowsType* pRows = pArray->GetDataRows(); - assert(pRows); // In sort-by-row mode we must have data rows already populated. - -+ if (!pArray->IsUpdateRefs()) -+ { -+ // When the update ref mode is disabled, we need to detach all formula -+ // cells in the sorted range before reordering, and re-start them -+ // afterward. -+ sc::EndListeningContext aCxt(*pDocument); -+ DetachFormulaCells(aCxt, nCol1, nRow1, nCol2, nRow2); -+ } -+ - // Split formula groups at the sort range boundaries (if applicable). - std::vector aRowBounds; - aRowBounds.reserve(2); -@@ -1081,6 +1090,12 @@ void ScTable::SortReorderByRow( - // Re-group columns in the sorted range too. - for (SCCOL i = nCol1; i <= nCol2; ++i) - aCol[i].RegroupFormulaCells(); -+ -+ if (!pArray->IsUpdateRefs()) -+ { -+ sc::StartListeningContext aCxt(*pDocument); -+ AttachFormulaCells(aCxt, nCol1, nRow1, nCol2, nRow2); -+ } - } - - short ScTable::CompareCell( --- -1.9.3 - diff --git a/0001-fdo-85282-Correct-adjustment-of-range-reference-on-d.patch b/0001-fdo-85282-Correct-adjustment-of-range-reference-on-d.patch deleted file mode 100644 index 581ab17..0000000 --- a/0001-fdo-85282-Correct-adjustment-of-range-reference-on-d.patch +++ /dev/null @@ -1,110 +0,0 @@ -From bc38612d349b9efd877dec23f3e68a3f7b945cec Mon Sep 17 00:00:00 2001 -From: Kohei Yoshida -Date: Mon, 27 Oct 2014 07:32:32 -0700 -Subject: [PATCH] fdo#85282: Correct adjustment of range reference on delete & - shift. - -Change-Id: I6e01c160f77599dfa4a2e55b60e23d256184c822 -(cherry picked from commit c3c16d5b74fb5707691283538a969a03c2f918b0) -Reviewed-on: https://gerrit.libreoffice.org/12111 -Reviewed-by: Eike Rathke -Tested-by: Eike Rathke ---- - sc/source/core/tool/token.cxx | 67 +++++++++++++++++++++++++++++++++++++++---- - 1 file changed, 61 insertions(+), 6 deletions(-) - -diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx -index 84c8ccc..b0a495a 100644 ---- a/sc/source/core/tool/token.cxx -+++ b/sc/source/core/tool/token.cxx -@@ -2546,6 +2546,9 @@ void setRefDeleted( ScComplexRefData& rRef, const sc::RefUpdateContext& rCxt ) - - bool shrinkRange( const sc::RefUpdateContext& rCxt, ScRange& rRefRange, const ScRange& rDeletedRange ) - { -+ if (!rDeletedRange.Intersects(rRefRange)) -+ return false; -+ - if (rCxt.mnColDelta < 0) - { - // Shifting left. -@@ -2553,9 +2556,35 @@ bool shrinkRange( const sc::RefUpdateContext& rCxt, ScRange& rRefRange, const Sc - // Deleted range is only partially overlapping in vertical direction. Bail out. - return false; - -- // Move the last column position to the left. -- SCCOL nDelta = rDeletedRange.aStart.Col() - rDeletedRange.aEnd.Col() - 1; -- rRefRange.aEnd.IncCol(nDelta); -+ if (rDeletedRange.aStart.Col() <= rRefRange.aStart.Col()) -+ { -+ if (rRefRange.aEnd.Col() <= rDeletedRange.aEnd.Col()) -+ { -+ // Reference is entirely deleted. -+ rRefRange.SetInvalid(); -+ } -+ else -+ { -+ // The reference range is truncated on the left. -+ SCCOL nOffset = rDeletedRange.aStart.Col() - rRefRange.aStart.Col(); -+ SCCOL nDelta = rRefRange.aStart.Col() - rDeletedRange.aEnd.Col() - 1; -+ rRefRange.aStart.IncCol(nOffset); -+ rRefRange.aEnd.IncCol(nDelta+nOffset); -+ } -+ } -+ else if (rDeletedRange.aEnd.Col() < rRefRange.aEnd.Col()) -+ { -+ // Reference is deleted in the middle. Move the last column -+ // position to the left. -+ SCCOL nDelta = rDeletedRange.aStart.Col() - rDeletedRange.aEnd.Col() - 1; -+ rRefRange.aEnd.IncCol(nDelta); -+ } -+ else -+ { -+ // The reference range is truncated on the right. -+ SCCOL nDelta = rDeletedRange.aStart.Col() - rRefRange.aEnd.Col() - 1; -+ rRefRange.aEnd.IncCol(nDelta); -+ } - return true; - } - else if (rCxt.mnRowDelta < 0) -@@ -2566,9 +2595,35 @@ bool shrinkRange( const sc::RefUpdateContext& rCxt, ScRange& rRefRange, const Sc - // Deleted range is only partially overlapping in horizontal direction. Bail out. - return false; - -- // Move the last row position up. -- SCROW nDelta = rDeletedRange.aStart.Row() - rDeletedRange.aEnd.Row() - 1; -- rRefRange.aEnd.IncRow(nDelta); -+ if (rDeletedRange.aStart.Row() <= rRefRange.aStart.Row()) -+ { -+ if (rRefRange.aEnd.Row() <= rDeletedRange.aEnd.Row()) -+ { -+ // Reference is entirely deleted. -+ rRefRange.SetInvalid(); -+ } -+ else -+ { -+ // The reference range is truncated on the top. -+ SCCOL nOffset = rDeletedRange.aStart.Row() - rRefRange.aStart.Row(); -+ SCCOL nDelta = rRefRange.aStart.Row() - rDeletedRange.aEnd.Row() - 1; -+ rRefRange.aStart.IncRow(nOffset); -+ rRefRange.aEnd.IncRow(nDelta+nOffset); -+ } -+ } -+ else if (rDeletedRange.aEnd.Row() < rRefRange.aEnd.Row()) -+ { -+ // Reference is deleted in the middle. Move the last row -+ // position upward. -+ SCCOL nDelta = rDeletedRange.aStart.Row() - rDeletedRange.aEnd.Row() - 1; -+ rRefRange.aEnd.IncRow(nDelta); -+ } -+ else -+ { -+ // The reference range is truncated on the bottom. -+ SCCOL nDelta = rDeletedRange.aStart.Row() - rRefRange.aEnd.Row() - 1; -+ rRefRange.aEnd.IncRow(nDelta); -+ } - return true; - } - --- -1.9.3 - diff --git a/0001-fdo-85403-broadcast-changes-after-TextToColumn.patch b/0001-fdo-85403-broadcast-changes-after-TextToColumn.patch deleted file mode 100644 index b7d6e99..0000000 --- a/0001-fdo-85403-broadcast-changes-after-TextToColumn.patch +++ /dev/null @@ -1,35 +0,0 @@ -From e963f4ee14fdda118a54745dcfca46e6244f0999 Mon Sep 17 00:00:00 2001 -From: Eike Rathke -Date: Mon, 3 Nov 2014 14:52:27 +0100 -Subject: [PATCH] fdo#85403 broadcast changes after TextToColumn -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Regression introduced with 3d869cda8db03820dea8c4ba463eb155d05e933b for -fdo#74014 - -Change-Id: Ie8ca1e7c15609aaf80b4ecbb6ccffc30a3f79f0a -(cherry picked from commit 99cfc0f8a321c3fd3ef1a49d669ebc5744dbf606) -Reviewed-on: https://gerrit.libreoffice.org/12216 -Reviewed-by: Caolán McNamara -Tested-by: Caolán McNamara ---- - sc/source/ui/view/cellsh2.cxx | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx -index 9a0fc853..7b7189c 100644 ---- a/sc/source/ui/view/cellsh2.cxx -+++ b/sc/source/ui/view/cellsh2.cxx -@@ -976,6 +976,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) - pDlg->SaveParameters(); - aImport.SetExtOptions( aOptions ); - aImport.SetApi( false ); -+ aImport.SetImportBroadcast( true ); - aStream.Seek( 0 ); - aImport.ImportStream( aStream, OUString(), FORMAT_STRING ); - --- -1.9.3 - diff --git a/0001-just-use-ANSI-C-declarations.patch b/0001-just-use-ANSI-C-declarations.patch new file mode 100644 index 0000000..e3acab2 --- /dev/null +++ b/0001-just-use-ANSI-C-declarations.patch @@ -0,0 +1,65 @@ +From 4d687aec3c5ea0f18ab3f01f827cc544e677bae3 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Thu, 6 Nov 2014 10:20:00 +0100 +Subject: [PATCH] just use ANSI C declarations + +Change-Id: Iec50f3474b97497c50522eabb4435795b3ba3b56 +--- + vcl/source/filter/jpeg/transupp.h | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +diff --git a/vcl/source/filter/jpeg/transupp.h b/vcl/source/filter/jpeg/transupp.h +index 4448c9f..4dbbc2a 100644 +--- a/vcl/source/filter/jpeg/transupp.h ++++ b/vcl/source/filter/jpeg/transupp.h +@@ -164,27 +164,27 @@ typedef struct { + + /* Parse a crop specification (written in X11 geometry style) */ + EXTERN(boolean) jtransform_parse_crop_spec +- JPP((jpeg_transform_info *info, const char *spec)); ++ (jpeg_transform_info *info, const char *spec); + /* Request any required workspace */ + EXTERN(boolean) jtransform_request_workspace +- JPP((j_decompress_ptr srcinfo, jpeg_transform_info *info)); ++ (j_decompress_ptr srcinfo, jpeg_transform_info *info); + /* Adjust output image parameters */ + EXTERN(jvirt_barray_ptr *) jtransform_adjust_parameters +- JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, ++ (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, + jvirt_barray_ptr *src_coef_arrays, +- jpeg_transform_info *info)); ++ jpeg_transform_info *info); + /* Execute the actual transformation, if any */ + EXTERN(void) jtransform_execute_transform +- JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, ++ (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, + jvirt_barray_ptr *src_coef_arrays, +- jpeg_transform_info *info)); ++ jpeg_transform_info *info); + /* Determine whether lossless transformation is perfectly + * possible for a specified image and transformation. + */ + EXTERN(boolean) jtransform_perfect_transform +- JPP((JDIMENSION image_width, JDIMENSION image_height, ++ (JDIMENSION image_width, JDIMENSION image_height, + int MCU_width, int MCU_height, +- JXFORM_CODE transform)); ++ JXFORM_CODE transform); + + /* jtransform_execute_transform used to be called + * jtransform_execute_transformation, but some compilers complain about +@@ -209,8 +209,8 @@ typedef enum { + + /* Setup decompression object to save desired markers in memory */ + EXTERN(void) jcopy_markers_setup +- JPP((j_decompress_ptr srcinfo, JCOPY_OPTION option)); ++ (j_decompress_ptr srcinfo, JCOPY_OPTION option); + /* Copy markers saved in the given source object to the destination object */ + EXTERN(void) jcopy_markers_execute +- JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo, +- JCOPY_OPTION option)); ++ (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, ++ JCOPY_OPTION option); +-- +2.1.0 + diff --git a/libreoffice.spec b/libreoffice.spec index b6baf69..6b28617 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -1,5 +1,5 @@ # download path contains version without the last (fourth) digit -%define libo_version 4.3.3 +%define libo_version 4.3.4 # Should contain .alphaX / .betaX, if this is pre-release (actually # pre-RC) version. The pre-release string is part of tarball file names, # so we need a way to define it easily at one place. @@ -45,8 +45,8 @@ Summary: Free Software Productivity Suite Name: libreoffice Epoch: 1 -Version: %{libo_version}.2 -Release: 6%{?libo_prerelease}%{?dist} +Version: %{libo_version}.1 +Release: 1%{?libo_prerelease}%{?dist} License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0 and CC0 Group: Applications/Productivity URL: http://www.libreoffice.org/ @@ -330,33 +330,16 @@ Patch32: 0001-Resolves-fdo-68967-looping-layout.patch Patch33: 0001-Remove-smb-from-X-KDE-Protocols-lines.patch Patch34: 0001-libgcrypt-and-gnutls-are-only-used-by-our-internal-e.patch Patch35: 0001-allow-to-build-with-system-opencollada.patch -Patch36: 0001-Resolves-rhbz-1146169-a11y-frames-label-dies-before-.patch -Patch37: 0001-Resolves-fdo-37559-revert-adding-extra-dummy-polygon.patch -Patch38: 0001-Resolves-fdo-76581-copy-and-paste-slideshow-crash-in.patch -Patch39: 0001-Resolves-fdo-68347-fix-word-count-with-recorded-chan.patch -Patch40: 0001-fdo-81633-Add-a-hidden-configuration-option-to-toggl.patch -Patch41: 0001-fdo-85215-Ensure-that-formula-broadcasting-works-aft.patch -Patch42: 0001-fdo-85282-Correct-adjustment-of-range-reference-on-d.patch -Patch43: 0001-fdo-79602-sw-fix-text-formatting-of-proportional-lin.patch -Patch44: 0001-fdo-79602-sw-add-new-compatibiltiy-flag-PropLineSpac.patch -Patch45: 0001-Resolves-fdo-84729-buffer-cache-grows-to-over-9000-u.patch -Patch46: 0001-Resolves-fdo-84885-chart-wizard-dialog-cut-off.patch -Patch47: 0001-Resolves-fdo-62682-crash-on-second-export-of-svg.patch -Patch48: 0001-fdo-85247-copy-and-paste-of-a-slide-results-in-a-blu.patch -Patch49: 0001-fdo-60712-Inherits-cell-styles-in-inserting-rows-col.patch -Patch50: 0001-implement-toggling-off-removeable-master-elements-wi.patch -Patch51: 0001-Resolves-fdo-78151-change-style-on-toggling-bullets-.patch -Patch52: 0001-Resolves-rhbz-1161238-sync-PRESOBJ_OUTLINE-para-dept.patch -Patch53: 0001-fdo-83901-ROW-and-COLUMN-to-be-properly-recalculated.patch -Patch54: 0001-fdo-80846-Broadcast-changes-before-EndUndo.patch -Patch55: 0001-Back-port-Kohei-s-comprehensive-sorting-unit-tests-f.patch -Patch56: 0001-Adapt-sorting-unit-tests-for-new-default.patch -Patch57: 0001-fdo-80284-Avoid-broadcasting-during-cell-delete-shif.patch -Patch58: 0001-fdo-82047-Correctly-adjust-references-in-range-names.patch -Patch59: 0001-fdo-85215-Don-t-adjust-references-wrt-cell-position-.patch -Patch60: 0001-fdo-85403-broadcast-changes-after-TextToColumn.patch -Patch61: 0001-strip-off-hard-coded-numbering-from-outliner-preview.patch -Patch62: 0001-have-a-stab-at-improving-impossible-question.patch +Patch36: 0001-Resolves-fdo-37559-revert-adding-extra-dummy-polygon.patch +Patch37: 0001-Resolves-fdo-76581-copy-and-paste-slideshow-crash-in.patch +Patch38: 0001-fdo-85247-copy-and-paste-of-a-slide-results-in-a-blu.patch +Patch39: 0001-fdo-60712-Inherits-cell-styles-in-inserting-rows-col.patch +Patch40: 0001-implement-toggling-off-removeable-master-elements-wi.patch +Patch41: 0001-Resolves-fdo-78151-change-style-on-toggling-bullets-.patch +Patch42: 0001-Resolves-rhbz-1161238-sync-PRESOBJ_OUTLINE-para-dept.patch +Patch43: 0001-strip-off-hard-coded-numbering-from-outliner-preview.patch +Patch44: 0001-have-a-stab-at-improving-impossible-question.patch +Patch45: 0001-just-use-ANSI-C-declarations.patch %define instdir %{_libdir} %define baseinstdir %{instdir}/libreoffice @@ -2323,10 +2306,13 @@ update-desktop-database %{_datadir}/applications &> /dev/null || : %endif %changelog +* Tue Nov 11 2014 David Tardon - 1:4.3.4.1-1 +- update to 4.3.4 rc1 + * Tue Nov 11 2014 Caolán McNamara - 1:4.3.3.2-6 - strip hard coded numbering off outline master previews -* Tue Nov 11 2014 Caolán McNamara - 1:4.3.3.2-5 +* Mon Nov 10 2014 Caolán McNamara - 1:4.3.3.2-5 - Resolves: rhbz#1161238 sync PRESOBJ_OUTLINE para depth on load * Thu Nov 06 2014 Caolán McNamara - 1:4.3.3.2-4 diff --git a/sources b/sources index 82836b2..ae442c6 100644 --- a/sources +++ b/sources @@ -7,6 +7,6 @@ a7983f859eafb2677d7ff386a023bc40 a7983f859eafb2677d7ff386a023bc40-xsltml_2.1.2. 0168229624cfac409e766913506961a8 0168229624cfac409e766913506961a8-ucpp-1.3.2.tar.gz 12fb8b5b0d5132726e57b9b9fc7e22c4 libreoffice-multiliblauncher.sh 4b87018f7fff1d054939d19920b751a0 4b87018f7fff1d054939d19920b751a0-collada2gltf-master-cb1d97788a.tar.bz2 -a0c7f05fd2edb91e195adb2f4170d794 libreoffice-4.3.3.2.tar.xz -072a585981c9177e7930a193b357a4b2 libreoffice-help-4.3.3.2.tar.xz -5b735fd27b42af83cf83d483a5eb2b04 libreoffice-translations-4.3.3.2.tar.xz +98312fcb1e1ab37321f29f64f312160a libreoffice-4.3.4.1.tar.xz +71ed47d8148dd66275bd87699b31c242 libreoffice-help-4.3.4.1.tar.xz +6e405e2b499ce28bce1e926bcb7268da libreoffice-translations-4.3.4.1.tar.xz