[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/uitest/autofilter/tdf36383.py | 68 sc/source/ui/view/viewfunc.cxx | 22 ++- 2 files changed, 88 insertions(+), 2 deletions(-) New commits: commit ce0fc9b59726f09e4ecbec540c3cf646d20f949e Author: Tünde Tóth AuthorDate: Fri Mar 5 10:20:03 2021 +0100 Commit: Gabor Kelemen CommitDate: Thu Apr 29 15:09:03 2021 +0200 tdf#36383 sc AutoFilter: fix changing row height Changing row height showed the rows hidden by AutoFilter, removing the result of the filtering. Change-Id: Ie2cba567c1fa4b479bd351693ae6dd3fd604ffc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112006 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 3678e0efcb8bedc58dd329a430da0ac3b1572df8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114863 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/uitest/autofilter/tdf36383.py b/sc/qa/uitest/autofilter/tdf36383.py new file mode 100644 index ..d55db21837b3 --- /dev/null +++ b/sc/qa/uitest/autofilter/tdf36383.py @@ -0,0 +1,68 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_row + +#Bug 36383 - EDITING auto row height or change row height removes AutoFilter result + +class tdf36383(UITestCase): +def test_tdf36383_row_height(self): +self.ui_test.create_doc_in_start_center("calc") +document = self.ui_test.get_component() +calcDoc = self.xUITest.getTopFocusWindow() +gridwin = calcDoc.getChild("grid_window") +document = self.ui_test.get_component() + +enter_text_to_cell(gridwin, "A1", "A") +enter_text_to_cell(gridwin, "A2", "1") +enter_text_to_cell(gridwin, "A3", "2") +enter_text_to_cell(gridwin, "A4", "3") + +gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + +self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + +gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xList = xCheckListMenu.getChild("check_list_box") +xEntry = xList.getChild("1") +xEntry.executeAction("CLICK", tuple()) + +xOkButton = xFloatWindow.getChild("ok") +xOkButton.executeAction("CLICK", tuple()) + +row = get_row(document, 2) +self.assertFalse(row.getPropertyValue("IsVisible")) + +#row height +self.ui_test.execute_dialog_through_command(".uno:RowHeight") +xDialog = self.xUITest.getTopFocusWindow() +xvalue = xDialog.getChild("value") +xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) +xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) +xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + +xOk = xDialog.getChild("ok") +self.ui_test.close_dialog_through_button(xOk) + +self.assertFalse(row.getPropertyValue("IsVisible")) + +#optimal row height +self.ui_test.execute_dialog_through_command(".uno:SetOptimalRowHeight") +xDialog = self.xUITest.getTopFocusWindow() + +xOk = xDialog.getChild("ok") +self.ui_test.close_dialog_through_button(xOk) + +self.assertFalse(row.getPropertyValue("IsVisible")) + +self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 6e4be285c073..ae60a5cb06e5 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -2158,7 +2158,17 @@ void ScViewFunc::SetWidthOrHeight( aCxt.setExtraHeight(nSizeTwips); rDoc.SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab); if (bAll) -rDoc.ShowRows( nStartNo, nEndNo, nTab, true ); +{ +for (SCROW nRow = nStartNo; nRow <= nEndNo; ++nRow) +{ +SCROW nLastRow = nRow; +// tdf#36383 skip consecutive rows hidden by AutoFilter +if (rDoc.RowFiltered(nRow, nTab, nullptr, )) +nRow = nLastRow; +else +rDoc.ShowRow(nRow, nTab, true); +} +} //
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/uitest/autofilter/autofilter.py | 15 sc/qa/uitest/data/autofilter/tdf137626.xlsx |binary sc/source/core/data/column3.cxx |8 ++ sc/source/filter/oox/autofilterbuffer.cxx | 33 +--- sc/source/ui/unoobj/datauno.cxx |5 ++-- 5 files changed, 56 insertions(+), 5 deletions(-) New commits: commit 2cc05be5213ccedb673f5e06278d65b0cdbe890b Author: Balazs Varga AuthorDate: Tue Mar 2 22:46:33 2021 +0100 Commit: Gabor Kelemen CommitDate: Thu Apr 29 08:47:17 2021 +0200 tdf#137626 XLSX import: fix missing datetime filters by convert string representation of the datetime data to ISO 8601 (with blank instead of T) datetime to eliminate locale dependent behaviour when filtering for datetimes. Follow-up of commit 0e751d0cb816197f15a2448ec36c57df17387e40 (tdf#116818 sc,offapi,XLSX import: fix autofiltered date columns). Change-Id: I3a0f41dbbf28a1a60a54fe7b2c8c338516edb079 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111851 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 26032e63abd01c3d5941a2728ef024da290d6b0a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114730 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index 149fa3400134..b968a06a8f74 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -173,5 +173,20 @@ class AutofilterTest(UITestCase): xOkBtn = xFloatWindow.getChild("cancel") xOkBtn.executeAction("CLICK", tuple()) +self.ui_test.close_doc() + +def test_tdf137626(self): +doc = self.ui_test.load_file(get_url_for_data_file("tdf137626.xlsx")) + +xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + +xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xTreeList = xCheckListMenu.getChild("check_list_box") +self.assertEqual(3, len(xTreeList.getChildren())) +xOkBtn = xFloatWindow.getChild("cancel") +xOkBtn.executeAction("CLICK", tuple()) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/autofilter/tdf137626.xlsx b/sc/qa/uitest/data/autofilter/tdf137626.xlsx new file mode 100644 index ..eb5ce4da7b98 Binary files /dev/null and b/sc/qa/uitest/data/autofilter/tdf137626.xlsx differ diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 0f4f3d8e76ab..d8f5c0a4224f 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2470,6 +2470,14 @@ class FilterEntriesHandler sal_uInt32 nIndex = pFormatter->GetFormatIndex( NF_DATE_DIN_MMDD); pFormatter->GetInputLineString( fVal, nIndex, aStr); } +else if (nType == SvNumFormatType::DATETIME) +{ +// special case for datetime values. +// Convert string representation to ISO 8601 (with blank instead of T) datetime +// to eliminate locale dependent behaviour later when filtering for datetimes. +sal_uInt32 nIndex = pFormatter->GetFormatIndex(NF_DATETIME_ISO_MMDD_HHMMSS); +pFormatter->GetInputLineString(fVal, nIndex, aStr); +} // maybe extend ScTypedStrData enum is also an option here mrFilterEntries.push_back(ScTypedStrData(aStr, fVal, ScTypedStrData::Value,bDate)); } diff --git a/sc/source/filter/oox/autofilterbuffer.cxx b/sc/source/filter/oox/autofilterbuffer.cxx index f8a860e27f80..0e5807a5cc32 100644 --- a/sc/source/filter/oox/autofilterbuffer.cxx +++ b/sc/source/filter/oox/autofilterbuffer.cxx @@ -240,23 +240,50 @@ void DiscreteFilter::importAttribs( sal_Int32 nElement, const AttributeList& rAt // it is just a fallback, we do not need the XML_day as default value, // because if the dateGroupItem exists also XML_dateTimeGrouping exists! sal_uInt16 nToken = rAttribs.getToken(XML_dateTimeGrouping, XML_day); -if( nToken == XML_year || nToken == XML_month || nToken == XML_day ) +if( nToken == XML_year || nToken == XML_month || nToken == XML_day || +nToken == XML_hour || nToken == XML_min || nToken == XML_second ) { aDateValue = rAttribs.getString(XML_year, OUString()); -if( nToken == XML_month || nToken == XML_day ) +if( nToken == XML_month || nToken == XML_day || nToken == XML_hour || +nToken == XML_min || nToken == XML_second ) { OUString aMonthName =
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf139928.xlsx|binary sc/qa/unit/subsequent_export-test.cxx |4 +-- sc/qa/unit/subsequent_filters-test.cxx | 40 +++-- sc/source/filter/inc/extlstcontext.hxx | 12 - sc/source/filter/oox/extlstcontext.cxx | 33 --- 5 files changed, 75 insertions(+), 14 deletions(-) New commits: commit a4be4d241d2fadc1a3f710ee891511267fc4de22 Author: Tibor Nagy AuthorDate: Sun Feb 7 21:24:45 2021 +0100 Commit: Gabor Kelemen CommitDate: Fri Apr 23 09:43:03 2021 +0200 tdf#139928 XLSX import: fix conditional formatting in same cell range Multiple conditional formatting rules of the same cell range were imported incorrectly because of missing handling of their (different) priorities and operators. Note: older unit tests were modified according to the fixed priorities. Co-authored-by: Attila Szűcs (NISZ) Change-Id: I4b542b310642e1a85ef6281d0025b3ef2b2ba8c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110544 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit a5513cb45d90e0a1bfa0dfe39c0f090f1cda45de) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111923 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 46f5c61e937cc34d8d06991137c713f43c241735) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114504 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/tdf139928.xlsx b/sc/qa/unit/data/xlsx/tdf139928.xlsx new file mode 100644 index ..d0bc3067fa34 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf139928.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index c13695c111d1..293cd295a36e 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -761,7 +761,7 @@ void ScExportTest::testCondFormatExportCellIs() CPPUNIT_ASSERT_EQUAL( ScConditionMode::Equal, pCondition->GetOperation()); OUString aStr = pCondition->GetExpression(ScAddress(0, 0, 0), 0); -CPPUNIT_ASSERT_EQUAL( OUString("$Sheet2.$A$1"), aStr ); +CPPUNIT_ASSERT_EQUAL( OUString("$Sheet2.$A$2"), aStr ); pEntry = pFormat->GetEntry(1); CPPUNIT_ASSERT(pEntry); @@ -771,7 +771,7 @@ void ScExportTest::testCondFormatExportCellIs() CPPUNIT_ASSERT_EQUAL( ScConditionMode::Equal, pCondition->GetOperation()); aStr = pCondition->GetExpression(ScAddress(0, 0, 0), 0); -CPPUNIT_ASSERT_EQUAL( OUString("$Sheet2.$A$2"), aStr ); +CPPUNIT_ASSERT_EQUAL( OUString("$Sheet2.$A$1"), aStr ); xDocSh->DoClose(); } diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index ce093603ddb6..f2d17b8d5345 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -106,6 +106,7 @@ public: virtual void tearDown() override; //ods, xls, xlsx filter tests +void testCondFormatOperatorsSameRangeXLSX(); void testCondFormatFormulaIsXLSX(); void testCondFormatBeginsAndEndsWithXLSX(); void testExtCondFormatXLSX(); @@ -278,6 +279,7 @@ public: void testDeleteCirclesInRowAndCol(); CPPUNIT_TEST_SUITE(ScFiltersTest); +CPPUNIT_TEST(testCondFormatOperatorsSameRangeXLSX); CPPUNIT_TEST(testCondFormatFormulaIsXLSX); CPPUNIT_TEST(testCondFormatBeginsAndEndsWithXLSX); CPPUNIT_TEST(testExtCondFormatXLSX); @@ -494,6 +496,40 @@ void testRangeNameImpl(const ScDocument& rDoc) } +void ScFiltersTest::testCondFormatOperatorsSameRangeXLSX() +{ +ScDocShellRef xDocSh = loadDoc(u"tdf139928.", FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to load tdf139928.xlsx", xDocSh.is()); + +ScDocument& rDoc = xDocSh->GetDocument(); + +ScConditionalFormat* pFormat = rDoc.GetCondFormat(0, 0, 0); +CPPUNIT_ASSERT(pFormat); + +const ScFormatEntry* pEntry = pFormat->GetEntry(0); +CPPUNIT_ASSERT(pEntry); +CPPUNIT_ASSERT_EQUAL(ScFormatEntry::Type::ExtCondition, pEntry->GetType()); + +const ScCondFormatEntry* pCondition = static_cast(pEntry); +CPPUNIT_ASSERT_EQUAL( ScConditionMode::ContainsText, pCondition->GetOperation()); + +pEntry = pFormat->GetEntry(1); +CPPUNIT_ASSERT(pEntry); +CPPUNIT_ASSERT_EQUAL(ScFormatEntry::Type::ExtCondition, pEntry->GetType()); + +pCondition = static_cast(pEntry); +CPPUNIT_ASSERT_EQUAL( ScConditionMode::BeginsWith, pCondition->GetOperation()); + +pEntry = pFormat->GetEntry(2); +CPPUNIT_ASSERT(pEntry); +CPPUNIT_ASSERT_EQUAL(ScFormatEntry::Type::ExtCondition, pEntry->GetType()); + +pCondition = static_cast(pEntry); +CPPUNIT_ASSERT_EQUAL( ScConditionMode::EndsWith, pCondition->GetOperation()); + +xDocSh->DoClose(); +} + void ScFiltersTest::testCondFormatFormulaIsXLSX() { ScDocShellRef xDocSh = loadDoc(u"tdf113013.", FORMAT_XLSX); @@
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/uitest/autofilter/autofilter.py | 15 + sc/qa/uitest/data/autofilter/tdf140469.xlsx |binary sc/source/filter/inc/autofilterbuffer.hxx | 10 - sc/source/filter/oox/autofilterbuffer.cxx | 262 4 files changed, 135 insertions(+), 152 deletions(-) New commits: commit ae067f7e46ef9606fca3a5a26857ef3169deb2dd Author: Balazs Varga AuthorDate: Thu Feb 18 18:04:53 2021 +0100 Commit: Gabor Kelemen CommitDate: Thu Apr 22 15:11:31 2021 +0200 tdf#140469 XLSX import: apply more than 8 filters in OOXML autofilter import by removing the artificial limit (which looked like the limit for conditions handled by the standard filter in LO, but not for the autofilter). Now the autofilter popup menu does not always select all items, if the document contained more than 8 selected items there. Change-Id: Iaa6ce15d4b1162ab78dd001734721ae859283d0d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/56 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 7ba76115b0e3baefae0ede66848f4340c7c7401b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114494 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index bb5260da504e..bf01911f62b4 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -127,5 +127,20 @@ class AutofilterTest(UITestCase): xOkBtn = xFloatWindow.getChild("cancel") xOkBtn.executeAction("CLICK", tuple()) +self.ui_test.close_doc() + +def test_tdf140469(self): +doc = self.ui_test.load_file(get_url_for_data_file("tdf140469.xlsx")) + +xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + +xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("check_list_menu") +xTreeList = xCheckListMenu.getChild("check_list_box") +self.assertEqual(9, len(xTreeList.getChildren())) +xOkBtn = xFloatWindow.getChild("cancel") +xOkBtn.executeAction("CLICK", tuple()) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/autofilter/tdf140469.xlsx b/sc/qa/uitest/data/autofilter/tdf140469.xlsx new file mode 100644 index ..3c90c7cfe1b1 Binary files /dev/null and b/sc/qa/uitest/data/autofilter/tdf140469.xlsx differ diff --git a/sc/source/filter/inc/autofilterbuffer.hxx b/sc/source/filter/inc/autofilterbuffer.hxx index e0270336a10e..3b512f4f98b9 100644 --- a/sc/source/filter/inc/autofilterbuffer.hxx +++ b/sc/source/filter/inc/autofilterbuffer.hxx @@ -64,7 +64,7 @@ public: virtual voidimportRecord( sal_Int32 nRecId, SequenceInputStream& rStrm ); /** Derived classes return converted UNO API filter settings representing all filter settings. */ -virtual ApiFilterSettings finalizeImport( sal_Int32 nMaxCount ); +virtual ApiFilterSettings finalizeImport(); }; @@ -82,7 +82,7 @@ public: virtual voidimportRecord( sal_Int32 nRecId, SequenceInputStream& rStrm ) override; /** Returns converted UNO API filter settings representing all filter settings. */ -virtual ApiFilterSettings finalizeImport( sal_Int32 nMaxCount ) override; +virtual ApiFilterSettings finalizeImport() override; private: @@ -103,7 +103,7 @@ public: virtual voidimportRecord( sal_Int32 nRecId, SequenceInputStream& rStrm ) override; /** Returns converted UNO API filter settings representing all filter settings. */ -virtual ApiFilterSettings finalizeImport( sal_Int32 nMaxCount ) override; +virtual ApiFilterSettings finalizeImport() override; private: double mfValue;/// Number of items or percentage. @@ -141,7 +141,7 @@ public: virtual voidimportRecord( sal_Int32 nRecId, SequenceInputStream& rStrm ) override; /** Returns converted UNO API filter settings representing all filter settings. */ -virtual ApiFilterSettings finalizeImport( sal_Int32 nMaxCount ) override; +virtual ApiFilterSettings finalizeImport() override; private: /** Appends the passed filter criterion, if it contains valid settings. */ @@ -174,7 +174,7 @@ public: /** Returns converted UNO API filter settings representing all filter settings of this column. */ -ApiFilterSettings finalizeImport( sal_Int32 nMaxCount ); +ApiFilterSettings finalizeImport(); private: std::shared_ptr< FilterSettingsBase > diff --git a/sc/source/filter/oox/autofilterbuffer.cxx b/sc/source/filter/oox/autofilterbuffer.cxx index 3821c650dbcb..f8a860e27f80 100644 --- a/sc/source/filter/oox/autofilterbuffer.cxx +++
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/uicalc/uicalc.cxx | 77 + sc/source/ui/docshell/dbdocfun.cxx |2 2 files changed, 79 insertions(+) New commits: commit 472011276be24ef28708d23a85665ad8ca1a56bd Author: Tünde Tóth AuthorDate: Wed Feb 10 16:46:12 2021 +0100 Commit: Gabor Kelemen CommitDate: Thu Apr 22 13:25:37 2021 +0200 tdf#123202 calc: fix sorting of autofiltered rows by keeping the query, when the data range contains hidden rows. Change-Id: Ib3de0c36d53b6fd4541a9cb5e53e018c29bd38c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110715 Tested-by: László Németh Reviewed-by: László Németh Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110940 Tested-by: Jenkins (cherry picked from commit e51f4419645305037af92d051b7ca40d77da4678) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114431 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index b68c5e6cd941..20be4ea98e28 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -29,6 +29,9 @@ public: ScModelObj* createDoc(const char* pName); void checkCurrentCell(SCCOL nCol, SCROW nRow); +void goToCell(const OUString& rCell); +void insertStringToCell(ScModelObj& rModelObj, const OUString& rCell, const std::string& rStr, +bool bIsArray = false); protected: uno::Reference mxComponent; @@ -55,6 +58,39 @@ void ScUiCalcTest::checkCurrentCell(SCCOL nCol, SCROW nRow) CPPUNIT_ASSERT_EQUAL(sal_Int32(nRow), ScDocShell::GetViewData()->GetCurY()); } +void ScUiCalcTest::goToCell(const OUString& rCell) +{ +uno::Sequence aArgs += comphelper::InitPropertySequence({ { "ToPoint", uno::makeAny(rCell) } }); +dispatchCommand(mxComponent, ".uno:GoToCell", aArgs); +} + +void ScUiCalcTest::insertStringToCell(ScModelObj& rModelObj, const OUString& rCell, + const std::string& rStr, bool bIsArray) +{ +goToCell(rCell); + +for (const char c : rStr) +{ +rModelObj.postKeyEvent(LOK_KEYEVENT_KEYINPUT, c, 0); +rModelObj.postKeyEvent(LOK_KEYEVENT_KEYUP, c, 0); +Scheduler::ProcessEventsToIdle(); +} + +if (bIsArray) +{ +rModelObj.postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_MOD1 | KEY_SHIFT | awt::Key::RETURN); +rModelObj.postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_MOD1 | KEY_SHIFT | awt::Key::RETURN); +Scheduler::ProcessEventsToIdle(); +} +else +{ +rModelObj.postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN); +rModelObj.postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::RETURN); +Scheduler::ProcessEventsToIdle(); +} +} + char const DATA_DIRECTORY[] = "/sc/qa/unit/uicalc/data/"; ScModelObj* ScUiCalcTest::createDoc(const char* pName) @@ -178,6 +214,47 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf83901) CPPUNIT_ASSERT_EQUAL(3.0, pDoc->GetValue(ScAddress(0, 1, 0))); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf123202) +{ +mxComponent = loadFromDesktop("private:factory/scalc"); +ScModelObj* pModelObj = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pModelObj); +ScDocument* pDoc = pModelObj->GetDocument(); +CPPUNIT_ASSERT(pDoc); + +insertStringToCell(*pModelObj, "A1", "1"); +insertStringToCell(*pModelObj, "A2", "2"); +insertStringToCell(*pModelObj, "A3", "3"); +insertStringToCell(*pModelObj, "A4", "4"); + +goToCell("A3"); + +dispatchCommand(mxComponent, ".uno:HideRow", {}); + +goToCell("A1:A4"); + +dispatchCommand(mxComponent, ".uno:SortDescending", {}); + +CPPUNIT_ASSERT_EQUAL(OUString("4"), pDoc->GetString(ScAddress(0, 0, 0))); +CPPUNIT_ASSERT_EQUAL(OUString("3"), pDoc->GetString(ScAddress(0, 1, 0))); +CPPUNIT_ASSERT_EQUAL(OUString("2"), pDoc->GetString(ScAddress(0, 2, 0))); +CPPUNIT_ASSERT_EQUAL(OUString("1"), pDoc->GetString(ScAddress(0, 3, 0))); + +// This failed, if the "3" is visible. +CPPUNIT_ASSERT(pDoc->RowHidden(1, 0)); +CPPUNIT_ASSERT(!pDoc->RowHidden(2, 0)); + +dispatchCommand(mxComponent, ".uno:Undo", {}); + +CPPUNIT_ASSERT_EQUAL(OUString("1"), pDoc->GetString(ScAddress(0, 0, 0))); +CPPUNIT_ASSERT_EQUAL(OUString("2"), pDoc->GetString(ScAddress(0, 1, 0))); +CPPUNIT_ASSERT_EQUAL(OUString("3"), pDoc->GetString(ScAddress(0, 2, 0))); +CPPUNIT_ASSERT_EQUAL(OUString("4"), pDoc->GetString(ScAddress(0, 3, 0))); + +CPPUNIT_ASSERT(!pDoc->RowHidden(1, 0)); +CPPUNIT_ASSERT(pDoc->RowHidden(2, 0)); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 352c77f619e9..36197edf8ee4 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -574,6 +574,8 @@ bool
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/copy_paste_test.cxx | 51 sc/qa/unit/data/ods/tdf113500_autofillMixed.ods |binary sc/source/core/data/table4.cxx | 15 --- 3 files changed, 51 insertions(+), 15 deletions(-) New commits: commit 986aca62157c828687ad6401a332ead233cbbf14 Author: Attila Szűcs AuthorDate: Fri Nov 13 13:22:21 2020 +0100 Commit: Gabor Kelemen CommitDate: Tue Apr 20 15:21:49 2021 +0200 tdf#113500 sc: fix autofill of same mixed values for example selecting two cells with the same text content "A1", and autofilling them must result "A1", "A1"... instead of "A2", "A2", "A3", A3"... Remove an obsolete fix in FillAnalyse(). As 0 increment is handled by both user list and mixed sequence cases, there is no need to pre-check that the elements are the same. Now FillAnalyse will return with the proper FILL_LINEAR (or user list) instead of FILL_SIMPLE that caused the unnecessary +1 increment. See commit d64bd977a430182826252695f041a6ddd62e45ef (tdf#137653 tdf#137624 sc: fix autofill user list sequence) and commit 5af699cf62b2313980add377a777c49dc1e7ae2a (don't deduce increment from multiple equal list entries). Co-authored-by: Tibor Nagy (NISZ) Change-Id: I0750816375486b5b95fb2e0fcfdb9b1d6c8ce7d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105791 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 4bcfa22a66deef210535391cfc3f683851b1b3f7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114288 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx index 9b0a472496a0..9a967810d5f9 100644 --- a/sc/qa/unit/copy_paste_test.cxx +++ b/sc/qa/unit/copy_paste_test.cxx @@ -49,6 +49,7 @@ public: void tdf137621_autofillMergedBool(); void tdf137205_autofillDatesInMergedCells(); void tdf137653_137654_autofillUserlist(); +void tdf113500_autofillMixed(); void tdf137625_autofillMergedUserlist(); void tdf137624_autofillMergedMixed(); @@ -65,6 +66,7 @@ public: CPPUNIT_TEST(tdf137621_autofillMergedBool); CPPUNIT_TEST(tdf137205_autofillDatesInMergedCells); CPPUNIT_TEST(tdf137653_137654_autofillUserlist); +CPPUNIT_TEST(tdf113500_autofillMixed); CPPUNIT_TEST(tdf137625_autofillMergedUserlist); CPPUNIT_TEST(tdf137624_autofillMergedMixed); CPPUNIT_TEST_SUITE_END(); @@ -823,6 +825,55 @@ void ScCopyPasteTest::tdf137653_137654_autofillUserlist() } } +void ScCopyPasteTest::tdf113500_autofillMixed() +{ +ScDocShellRef xDocSh = loadDocAndSetupModelViewController("tdf113500_autofillMixed.", FORMAT_ODS, true); +ScDocument& rDoc = xDocSh->GetDocument(); + +// Get the document controller +ScTabViewShell* pView = xDocSh->GetBestViewShell(false); +CPPUNIT_ASSERT(pView != nullptr); + +// fillauto userlist, these areas contain only merged cells +pView->FillAuto(FILL_TO_RIGHT, 4, 5, 6, 7, 3); //E6:G8 +pView->FillAuto(FILL_TO_LEFT, 4, 5, 6, 7, 3);//E6:G8 +pView->FillAuto(FILL_TO_BOTTOM, 1, 18, 3, 19, 2); //B19:D20 +pView->FillAuto(FILL_TO_TOP, 1, 18, 3, 19, 2);//B19:D20 + +// compare the results of fill-right / -left with the reference stored in the test file +// this compares the whole area blindly, for specific test cases, check the test file +// do not check the 3. row: a1,b2,a3. It is an other bug to fix +for (int nCol = 1; nCol <= 9; nCol++) +{ +for (int nRow = 5; nRow <= 6; nRow++) +{ +CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0)); +CellType nType2 = rDoc.GetCellType(ScAddress(nCol, nRow + 4, 0)); +OUString aStr1 = rDoc.GetString(nCol, nRow, 0); +OUString aStr2 = rDoc.GetString(nCol, nRow + 4, 0); + +CPPUNIT_ASSERT_EQUAL(nType1, nType2); +CPPUNIT_ASSERT_EQUAL(aStr1, aStr2); +} +} + +// compare the results of fill-up / -down +// do not check the 2. column: 1st,3st. It is an other bug to fix +for (int nCol = 1; nCol <= 3; nCol+=2) +{ +for (int nRow = 16; nRow <= 21; nRow++) +{ +CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0)); +CellType nType2 = rDoc.GetCellType(ScAddress(nCol + 4, nRow, 0)); +OUString aStr1 = rDoc.GetString(nCol, nRow, 0); +OUString aStr2 = rDoc.GetString(nCol + 4, nRow, 0); + +CPPUNIT_ASSERT_EQUAL(nType1, nType2); +CPPUNIT_ASSERT_EQUAL(aStr1, aStr2); +} +} +} + void ScCopyPasteTest::tdf137625_autofillMergedUserlist() { ScDocShellRef xDocSh = loadDocAndSetupModelViewController("tdf137625_autofillMergedUserlist.", FORMAT_ODS, true); diff --git a/sc/qa/unit/data/ods/tdf113500_autofillMixed.ods
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf139167.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 21 + sc/source/filter/excel/xestyle.cxx|9 ++--- sc/source/filter/excel/xltools.cxx|4 4 files changed, 31 insertions(+), 3 deletions(-) New commits: commit 6f61e7fd2c5c43c7ecbeccfed6e6e4d8365924f2 Author: Tibor Nagy AuthorDate: Wed Jan 20 09:53:46 2021 +0100 Commit: Gabor Kelemen CommitDate: Thu Mar 4 09:08:23 2021 +0100 tdf#139167 XLSX export: fix proliferation of conditional styles Run-time created styles “ExtConditionalStyle_N N” for extended conditional styles were written back to the XLSX file, growing the cell style list by each save-reload with unused styles. Co-authored-by: Attila Szűcs (NISZ) Change-Id: Icccb9f511556132b760efd4e8c8c2db00858 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109667 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 807a63d66010b1969cfbb61d3609b91909872399) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109887 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 20ce9f5de3c9d3081d197b0a0138d51d75ae3950) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111918 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/tdf139167.xlsx b/sc/qa/unit/data/xlsx/tdf139167.xlsx new file mode 100644 index ..b1c7aa201713 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf139167.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 7b4a69846d3f..c13695c111d1 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -93,6 +93,7 @@ public: ScDocShellRef saveAndReloadPassword( ScDocShell*, const OUString&, const OUString&, const OUString&, SfxFilterFlags ); void test(); +void testTdf139167(); void testTdf139394(); void testExtCondFormatXLSX(); void testTdf90104(); @@ -281,6 +282,7 @@ public: CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); +CPPUNIT_TEST(testTdf139167); CPPUNIT_TEST(testTdf139394); CPPUNIT_TEST(testExtCondFormatXLSX); CPPUNIT_TEST(testTdf90104); @@ -552,6 +554,25 @@ void ScExportTest::test() xDocSh->DoClose(); } +void ScExportTest::testTdf139167() +{ +ScDocShellRef xShell = loadDoc(u"tdf139167.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); + +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); +xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/styles.xml"); +CPPUNIT_ASSERT(pDoc); + +assertXPath(pDoc, "/x:styleSheet/x:cellStyles", "count", "6"); +assertXPath(pDoc, "/x:styleSheet/x:dxfs/x:dxf/x:fill/x:patternFill/x:bgColor", "rgb", +"FF00"); + +xDocSh->DoClose(); +} + void ScExportTest::testTdf139394() { ScDocShellRef xShell = loadDoc(u"tdf139394.", FORMAT_XLSX); diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 5a0354701b64..74cdfc58deae 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -3026,12 +3026,15 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot ) for (size_t nFormatEntry = 0; nFormatEntry < nEntryCount; ++nFormatEntry) { const ScFormatEntry* pFormatEntry = rxItem->GetEntry(nFormatEntry); -if (!pFormatEntry || (pFormatEntry->GetType() != ScFormatEntry::Type::Condition && -pFormatEntry->GetType() != ScFormatEntry::Type::Date)) +if (!pFormatEntry +|| (pFormatEntry->GetType() != ScFormatEntry::Type::Condition +&& pFormatEntry->GetType() != ScFormatEntry::Type::Date +&& pFormatEntry->GetType() != ScFormatEntry::Type::ExtCondition)) continue; OUString aStyleName; -if(pFormatEntry->GetType() == ScFormatEntry::Type::Condition) +if (pFormatEntry->GetType() == ScFormatEntry::Type::Condition +|| pFormatEntry->GetType() == ScFormatEntry::Type::ExtCondition) { const ScCondFormatEntry* pEntry = static_cast(pFormatEntry); aStyleName= pEntry->GetStyle(); diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx index e6fce7474725..b2a42f18542e 100644 --- a/sc/source/filter/excel/xltools.cxx +++ b/sc/source/filter/excel/xltools.cxx @@ -656,6 +656,7 @@ bool XclTools::GetBuiltInStyleId( sal_uInt8& rnStyleId, sal_uInt8& rnLevel, cons static
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/xlsx/dateAutofilter.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 25 sc/source/filter/excel/excrecds.cxx | 31 ++ sc/source/filter/inc/excrecds.hxx |2 - sc/source/filter/oox/autofilterbuffer.cxx |2 + sc/source/ui/unoobj/datauno.cxx |1 6 files changed, 56 insertions(+), 5 deletions(-) New commits: commit 6072bc982782398a9b01a11dbbb6730a2c1fbe17 Author: Balazs Varga AuthorDate: Wed Jan 20 12:11:14 2021 +0100 Commit: Gabor Kelemen CommitDate: Wed Mar 3 19:24:53 2021 +0100 tdf#139809 sc ooxml export autofiltered date columns Export XML_dateGroupItem, XML_year, XML_month, XML_day, XML_dateTimeGrouping based on the OOXML standard. Follow up commit of: d101a6f8579df8241dcd8100908868cd7d7c3f8a (tdf#116818 sc OOXML: import autofiltered date columns) Note: DOCX round-trip is not lossless here, because instead of exporting the original yearly and monthly dataGroupItem filtering, the export contains daily level dataGroupItem elements for each day. Change-Id: I456b2240213839725e2b416622986ee4a9cf60d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109699 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit eea523b686b27b4807ab21b62805ce9fbddf74ef) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111914 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/dateAutofilter.xlsx b/sc/qa/unit/data/xlsx/dateAutofilter.xlsx new file mode 100644 index ..1c836511d0dc Binary files /dev/null and b/sc/qa/unit/data/xlsx/dateAutofilter.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 8df43f1e4922..7b4a69846d3f 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -214,6 +214,7 @@ public: void testTdf95640_ods_to_xlsx(); void testTdf95640_ods_to_xlsx_with_standard_list(); void testTdf95640_xlsx_to_xlsx(); +void testDateAutofilterXLSX(); void testRefStringXLSX(); void testRefStringConfigXLSX(); @@ -385,6 +386,7 @@ public: CPPUNIT_TEST(testTdf95640_ods_to_xlsx); CPPUNIT_TEST(testTdf95640_ods_to_xlsx_with_standard_list); CPPUNIT_TEST(testTdf95640_xlsx_to_xlsx); +CPPUNIT_TEST(testDateAutofilterXLSX); CPPUNIT_TEST(testRefStringXLSX); CPPUNIT_TEST(testRefStringConfigXLSX); @@ -4454,6 +4456,29 @@ void ScExportTest::testTdf95640_xlsx_to_xlsx() "Low,Medium,High"); } +void ScExportTest::testDateAutofilterXLSX() +{ +// XLSX Roundtripping autofilter with date list +ScDocShellRef xDocSh = loadDoc(u"dateAutofilter.", FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); +CPPUNIT_ASSERT(pDoc); + +assertXPath(pDoc, "//x:autoFilter", "ref", "A1:B4"); +assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]", "day", "02"); +assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]", "month", "03"); +assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]", "year", "2017"); +assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[1]", "dateTimeGrouping", "day"); + +assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[2]", "day", "01"); +assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[2]", "month", "10"); +assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[2]", "year", "2014"); +assertXPath(pDoc, "//x:autoFilter/x:filterColumn/x:filters/x:dateGroupItem[2]", "dateTimeGrouping", "day"); + +xDocSh->DoClose(); +} + void ScExportTest::testTdf88657ODS() { ScDocShellRef xDocSh = loadDoc("tdf88657.", FORMAT_ODS); diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index ce6b05970e6d..3f87f5874f4b 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -24,6 +24,7 @@ #include #include +#include #include @@ -774,7 +775,7 @@ void XclExpAutofilter::AddMultiValueEntry( const ScQueryEntry& rEntry ) meType = MultiValue; const ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems(); for (const auto& rItem : rItems) -maMultiValues.push_back(rItem.maString.getString()); +maMultiValues.push_back( std::make_pair(rItem.maString.getString(), rItem.meType == ScQueryEntry::ByDate) ); } void XclExpAutofilter::WriteBody( XclExpStream& rStrm ) @@ -832,9 +833,31 @@ void XclExpAutofilter::SaveXml( XclExpXmlStream& rStrm ) rWorksheet->startElement(XML_filters); for (const auto& rMultiValue :
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx | 21 + sc/source/filter/xcl97/xcl97rec.cxx | 11 +++ 2 files changed, 24 insertions(+), 8 deletions(-) New commits: commit 33dbe50194dbfaf2748691e6259eefdc63d35e67 Author: Szabolcs Toth AuthorDate: Thu Dec 31 10:31:30 2020 +0100 Commit: Gabor Kelemen CommitDate: Wed Mar 3 15:08:49 2021 +0100 tdf#139258 XLSX export: fix position of rotated images Follow-up of commit a4eec60c388cc65ae0b4c8ea0fd7235f520a749d (tdf#123613 XLSX export: fix position of rotated shapes) and commit 368c56144aab5794c39d5bc2082d9b3d6d7cebdb (refactor for xlsx shape export). Change-Id: If5a79685efa1a80ea82eac19aed12bb426d10987 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108533 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit fddad2ed797f1773ed5be979a0b05d3f976b744e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109517 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit aa23da6b9e935fbfcb0b432d43c72f7a6db50657) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111885 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 760b194ed371..8df43f1e4922 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -276,6 +276,7 @@ public: void testTdf138824_linkToParentDirectory(); void testTdf129969(); void testTdf84874(); +void testTdf139258_rotated_image(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -446,6 +447,7 @@ public: CPPUNIT_TEST(testTdf138824_linkToParentDirectory); CPPUNIT_TEST(testTdf129969); CPPUNIT_TEST(testTdf84874); +CPPUNIT_TEST(testTdf139258_rotated_image); CPPUNIT_TEST_SUITE_END(); @@ -5694,6 +5696,25 @@ void ScExportTest::testTdf84874() xDocSh->DoClose(); } +void ScExportTest::testTdf139258_rotated_image() +{ +// Check that the topleft position of the image is correct. +ScDocShellRef xShell = loadDoc(u"tdf139258_rotated_image.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.is()); + +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); + +xmlDocUniquePtr pDrawing += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); +CPPUNIT_ASSERT(pDrawing); + +assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:from/xdr:col", "1"); +assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:from/xdr:row", "12"); +assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:to/xdr:col", "6"); +assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:to/xdr:row", "25"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 38ad870c4970..b8676ca00e4e 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1103,14 +1103,9 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& { sal_Int16 nHalfWidth = aSize.Width / 2; sal_Int16 nHalfHeight = aSize.Height / 2; -// aTopLeft needs correction for rotated customshapes -if (pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE) -{ -const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape -aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - nHalfWidth; -aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - nHalfHeight; -} - +const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape +aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - nHalfWidth; +aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - nHalfHeight; // MSO changes the anchor positions at these angles and that does an extra 90 degrees // rotation on our shapes, so we output it in such position that MSO // can draw this shape correctly. ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/ods/tdf87973_externalLinkSkipUnuseds.ods |binary sc/qa/unit/subsequent_export-test.cxx| 12 sc/source/core/tool/compiler.cxx |2 +- 3 files changed, 13 insertions(+), 1 deletion(-) New commits: commit a808742d5528648c1f4378997def426d244216f4 Author: Attila Szűcs AuthorDate: Mon Jan 11 12:13:48 2021 +0100 Commit: Gabor Kelemen CommitDate: Wed Mar 3 12:26:00 2021 +0100 tdf#138832 XLSX export: fix lost file names in modified links Also for single-reference links, use the temporary indexes calculated in commit f85d860ccbebd99bc128218148e2992c9415f221 (tdf#87973 XLSX export: fix lost file names in modified links), Note: only a new test case has been added to the modified unit test document. Co-authored-by: Tibor Nagy (NISZ) Change-Id: I4337a4e68008956ea42b626d210f07b1cbfe59ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109088 Tested-by: László Németh Reviewed-by: László Németh Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109536 Tested-by: Jenkins (cherry picked from commit 3b481336018d274384b7ade7c2c5e858f24f0e8c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111883 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/ods/tdf87973_externalLinkSkipUnuseds.ods b/sc/qa/unit/data/ods/tdf87973_externalLinkSkipUnuseds.ods index cdaf9d4e7007..d25a18b19cac 100644 Binary files a/sc/qa/unit/data/ods/tdf87973_externalLinkSkipUnuseds.ods and b/sc/qa/unit/data/ods/tdf87973_externalLinkSkipUnuseds.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index f988256a8b28..760b194ed371 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -5551,6 +5551,15 @@ void ScExportTest::testTdf87973_externalLinkSkipUnuseds() aFormula = aFormula.replaceAt(nIdxOfFile, nIdxOfFilename - nIdxOfFile, aTempFilename); rDoc.SetFormula(ScAddress(3, 1, 0), aFormula, formula::FormulaGrammar::GRAM_NATIVE_UI); +// tdf#138832: test the same thing with singleref link +rDoc.GetFormula(3, 2, 0, aFormula); +nIdxOfFilename = aFormula.indexOf("tdf132105_external.ods"); +aFormula = aFormula.replaceAt(nIdxOfFilename, 22, "87973_externalSource.ods"); +nIdxOfFile = aFormula.indexOf("file"); + +aFormula = aFormula.replaceAt(nIdxOfFile, nIdxOfFilename - nIdxOfFile, aTempFilename); +rDoc.SetFormula(ScAddress(3, 2, 0), aFormula, formula::FormulaGrammar::GRAM_NATIVE_UI); + // save and load back ScDocShellRef pDocSh = saveAndReload(&(*pShell), FORMAT_XLSX); CPPUNIT_ASSERT(pDocSh.is()); @@ -5560,6 +5569,9 @@ void ScExportTest::testTdf87973_externalLinkSkipUnuseds() rDoc2.GetFormula(3, 1, 0, aFormula2); CPPUNIT_ASSERT(aFormula2.indexOf("tdf132105_external.ods") < 0); CPPUNIT_ASSERT(aFormula2.indexOf("87973_externalSource.ods") >= 0); +rDoc2.GetFormula(3, 2, 0, aFormula2); +CPPUNIT_ASSERT(aFormula2.indexOf("tdf132105_external.ods") < 0); +CPPUNIT_ASSERT(aFormula2.indexOf("87973_externalSource.ods") >= 0); pDocSh->DoClose(); } diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index d6d83c18e841..3ce2d9f13663 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -5099,7 +5099,7 @@ void ScCompiler::CreateStringFromExternal( OUStringBuffer& rBuffer, const Formul break; case svExternalSingleRef: pConv->makeExternalRefStr(pDoc->GetSheetLimits(), - rBuffer, GetPos(), nFileId, *pFileName, t->GetString().getString(), + rBuffer, GetPos(), nUsedFileId, *pFileName, t->GetString().getString(), *t->GetSingleRef()); break; case svExternalDoubleRef: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx |8 +++- sc/source/filter/excel/xestream.cxx |5 +++-- 2 files changed, 6 insertions(+), 7 deletions(-) New commits: commit 0f0162aefdc7d64fdcae215ead7d6c813e676120 Author: Attila Szűcs AuthorDate: Mon Dec 21 23:54:43 2020 +0100 Commit: Gabor Kelemen CommitDate: Wed Mar 3 12:12:47 2021 +0100 tdf#121472 XLSX export: fix external Linux path Removed the extra 4th '/' after 'file:///' from aData.maBasePath at exportDocument(). In Linux, the root path could start with '/'.. like /home/... in that case 'file:///'+'/home/..' resulted 'file:home/ that is invalid. Co-authored-by: Tibor Nagy (NISZ) Change-Id: Ia37a11def80df2747578807ee021fafe38d48ec0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108131 Tested-by: Jenkins Reviewed-by: László Németh Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109535 (cherry picked from commit 95b1411e26c1a82e110a8ccf970b8b3590427cb9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111882 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index b094eb7d1ce3..f988256a8b28 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -5608,11 +5608,9 @@ void ScExportTest::testTdf138824_linkToParentDirectory() pXPathFile, m_xSFactory, "xl/externalLinks/_rels/externalLink1.xml.rels"); CPPUNIT_ASSERT(pDoc); -// it should be "../tdf138824_externalSource.ods" but because of an other bug, -// on linux some other directory names may added into the middle -OUString aValue = getXPath(pDoc, "/r:Relationships/r:Relationship", "Target"); -CPPUNIT_ASSERT_EQUAL(0, static_cast(aValue.indexOf("../"))); -CPPUNIT_ASSERT(aValue.indexOf("/tdf138824_externalSource.ods") > 0); +// test also the Linux specific bug tdf#121472 +assertXPath(pDoc, "/r:Relationships/r:Relationship", "Target", +"../tdf138824_externalSource.ods"); xDocSh->DoClose(); } diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 4776bd24b4a9..da880cf6d925 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -1036,8 +1036,9 @@ bool XclExpXmlStream::exportDocument() aData.mpCompileFormulaCxt = std::make_shared(); // set target path to get correct relative links to target document, not source INetURLObject aPath(getFileUrl()); -aData.maBasePath = aPath.GetPath() + "\\"; -aData.maBasePath = "file:///" + aData.maBasePath.replace('\\', '/'); +aData.maBasePath = OUString("file:///" + aPath.GetPath() + "\\").replace('\\', '/') +// fix for Linux +.replaceFirst("file:", "file:///"); XclExpRoot aRoot( aData ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/ods/childDir/tdf138824_linkToParentDirectory.ods |binary sc/qa/unit/data/ods/tdf138824_externalSource.ods |binary sc/qa/unit/subsequent_export-test.cxx| 52 +- sc/source/filter/excel/xelink.cxx| 11 +- 4 files changed, 56 insertions(+), 7 deletions(-) New commits: commit 4f603665230151a73c5d633436102b980102ef09 Author: Attila Szűcs AuthorDate: Fri Dec 11 18:51:10 2020 +0100 Commit: Gabor Kelemen CommitDate: Wed Mar 3 11:58:13 2021 +0100 tdf#138824 tdf#137937 XLSX export: fix parent directory path Parent directory paths (../) removed by XclExpHyperlink::BuildFileName() resulted broken external reference. Note: on Linux, now this fix creates a working, but still fragile path relative to the root directory. Co-authored-by: Tibor Nagy (NISZ) Change-Id: I9401d75d1fba0194d4ff509d9b7305969b8804e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107603 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 107a20ee079ae852b3b33412f234aab2dc35168f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108006 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit ad3b51b5b383dc9c7302b6d1d2e7f6daad5d4d5b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111881 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/ods/childDir/tdf138824_linkToParentDirectory.ods b/sc/qa/unit/data/ods/childDir/tdf138824_linkToParentDirectory.ods new file mode 100644 index ..2f0c6d2f93cb Binary files /dev/null and b/sc/qa/unit/data/ods/childDir/tdf138824_linkToParentDirectory.ods differ diff --git a/sc/qa/unit/data/ods/tdf138824_externalSource.ods b/sc/qa/unit/data/ods/tdf138824_externalSource.ods new file mode 100644 index ..59228e390e4d Binary files /dev/null and b/sc/qa/unit/data/ods/tdf138824_externalSource.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index f81437aa6693..b094eb7d1ce3 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -273,6 +273,7 @@ public: void testTdf126305_DataValidatyErrorAlert(); void testTdf87973_externalLinkSkipUnuseds(); void testTdf138741_externalLinkSkipUnusedsCrash(); +void testTdf138824_linkToParentDirectory(); void testTdf129969(); void testTdf84874(); @@ -442,6 +443,7 @@ public: CPPUNIT_TEST(testTdf126305_DataValidatyErrorAlert); CPPUNIT_TEST(testTdf87973_externalLinkSkipUnuseds); CPPUNIT_TEST(testTdf138741_externalLinkSkipUnusedsCrash); +CPPUNIT_TEST(testTdf138824_linkToParentDirectory); CPPUNIT_TEST(testTdf129969); CPPUNIT_TEST(testTdf84874); @@ -5533,7 +5535,7 @@ void ScExportTest::testTdf87973_externalLinkSkipUnuseds() ScDocument& rDoc = pShell->GetDocument(); // change external link to: 87973_externalSource.ods -OUString aFormula, bFormula; +OUString aFormula, aFormula2; rDoc.GetFormula(3, 1, 0, aFormula); auto nIdxOfFilename = aFormula.indexOf("tdf132105_external.ods"); aFormula = aFormula.replaceAt(nIdxOfFilename, 22, "87973_externalSource.ods"); @@ -,9 +5557,9 @@ void ScExportTest::testTdf87973_externalLinkSkipUnuseds() // check if the the new filename is present in the link (and not replaced by '[2]') ScDocument& rDoc2 = pDocSh->GetDocument(); -rDoc2.GetFormula(3, 1, 0, bFormula); -CPPUNIT_ASSERT(bFormula.indexOf("tdf132105_external.ods") < 0); -CPPUNIT_ASSERT(bFormula.indexOf("87973_externalSource.ods") > 0); +rDoc2.GetFormula(3, 1, 0, aFormula2); +CPPUNIT_ASSERT(aFormula2.indexOf("tdf132105_external.ods") < 0); +CPPUNIT_ASSERT(aFormula2.indexOf("87973_externalSource.ods") >= 0); pDocSh->DoClose(); } @@ -5573,6 +5575,48 @@ void ScExportTest::testTdf138741_externalLinkSkipUnusedsCrash() xShell->DoClose(); } +void ScExportTest::testTdf138824_linkToParentDirectory() +{ +ScDocShellRef xShell = loadDoc("childDir/tdf138824_linkToParentDirectory.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.is()); + +ScDocument& rDoc = xShell->GetDocument(); + +// saveAndReload save the file to a temporary directory +// the link must be changed to point to that parent directory +utl::TempFile aTempFile; +auto aTempFilename = aTempFile.GetURL(); +auto nIdxOfTmpFile = aTempFilename.lastIndexOf('/'); +nIdxOfTmpFile = aTempFilename.lastIndexOf('/', nIdxOfTmpFile); +aTempFilename = aTempFilename.copy(0, nIdxOfTmpFile + 1); + +// change external link to tmp directory +OUString aFormula; +rDoc.GetFormula(3, 1, 0, aFormula); +auto nIdxOfFilename = aFormula.indexOf("tdf138824_externalSource.ods"); +auto nIdxOfFile = aFormula.indexOf("file"); + +aFormula = aFormula.replaceAt(nIdxOfFile,
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf113013.xlsx|binary sc/qa/unit/subsequent_filters-test.cxx | 26 ++ sc/source/filter/oox/extlstcontext.cxx | 13 + 3 files changed, 35 insertions(+), 4 deletions(-) New commits: commit bfa3d8af13b18ca01a4c373e42b0ce02c772fa9b Author: Tibor Nagy AuthorDate: Wed Jan 6 12:23:32 2021 +0100 Commit: Gabor Kelemen CommitDate: Wed Mar 3 11:14:30 2021 +0100 tdf#113013 XLSX import: fix "Formula is" type conditional formatting rule when the formula contains a reference to another worksheet. Change-Id: I873fad97a88df64e885fef20d4259ef6bfeaa06b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108850 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit fcd96df8f648439ea191d8c2070e8b21ff0b1001) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111878 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/tdf113013.xlsx b/sc/qa/unit/data/xlsx/tdf113013.xlsx new file mode 100644 index ..25e6276e7fbb Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf113013.xlsx differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 5f7dcf412d9e..ce093603ddb6 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -106,6 +106,7 @@ public: virtual void tearDown() override; //ods, xls, xlsx filter tests +void testCondFormatFormulaIsXLSX(); void testCondFormatBeginsAndEndsWithXLSX(); void testExtCondFormatXLSX(); void testUpdateCircleInMergedCellODS(); @@ -277,6 +278,7 @@ public: void testDeleteCirclesInRowAndCol(); CPPUNIT_TEST_SUITE(ScFiltersTest); +CPPUNIT_TEST(testCondFormatFormulaIsXLSX); CPPUNIT_TEST(testCondFormatBeginsAndEndsWithXLSX); CPPUNIT_TEST(testExtCondFormatXLSX); CPPUNIT_TEST(testUpdateCircleInMergedCellODS); @@ -492,6 +494,30 @@ void testRangeNameImpl(const ScDocument& rDoc) } +void ScFiltersTest::testCondFormatFormulaIsXLSX() +{ +ScDocShellRef xDocSh = loadDoc(u"tdf113013.", FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to load tdf113013.xlsx", xDocSh.is()); + +ScDocument& rDoc = xDocSh->GetDocument(); + +// "Formula is" condition +ScConditionalFormat* pFormatB1 = rDoc.GetCondFormat(1, 0, 0); +CPPUNIT_ASSERT(pFormatB1); +ScConditionalFormat* pFormatA2 = rDoc.GetCondFormat(0, 1, 0); +CPPUNIT_ASSERT(pFormatA2); + +ScRefCellValue aCellB1(rDoc, ScAddress(1, 0, 0)); +OUString aCellStyleB1 = pFormatB1->GetCellStyle(aCellB1, ScAddress(1, 0, 0)); +CPPUNIT_ASSERT(!aCellStyleB1.isEmpty()); + +ScRefCellValue aCellA2(rDoc, ScAddress(0, 1, 0)); +OUString aCellStyleA2 = pFormatA2->GetCellStyle(aCellA2, ScAddress(0, 1, 0)); +CPPUNIT_ASSERT(!aCellStyleA2.isEmpty()); + +xDocSh->DoClose(); +} + void ScFiltersTest::testCondFormatBeginsAndEndsWithXLSX() { ScDocShellRef xDocSh = loadDoc("tdf120749.", FORMAT_XLSX); diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx index 2f0c6c475c9a..f06d2e55241f 100644 --- a/sc/source/filter/oox/extlstcontext.cxx +++ b/sc/source/filter/oox/extlstcontext.cxx @@ -153,26 +153,31 @@ ContextHandlerRef ExtConditionalFormattingContext::onCreateContext(sal_Int32 nEl eOperator = CondFormatBuffer::convertToInternalOperator(aToken); return this; } -else if(aType == "containsText") +else if (aType == "containsText") { eOperator = ScConditionMode::ContainsText; return this; } -else if(aType == "notContainsText") +else if (aType == "notContainsText") { eOperator = ScConditionMode::NotContainsText; return this; } -else if(aType == "beginsWith") +else if (aType == "beginsWith") { eOperator = ScConditionMode::BeginsWith; return this; } -else if(aType == "endsWith") +else if (aType == "endsWith") { eOperator = ScConditionMode::EndsWith; return this; } +else if (aType == "expression") +{ +eOperator = ScConditionMode::Direct; +return this; +} else { SAL_WARN("sc", "unhandled XLS14_TOKEN(cfRule) with type: " << aType); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/uitest/validity/tdf138134.py | 63 + sc/source/ui/view/output.cxx | 11 ++ 2 files changed, 74 insertions(+) New commits: commit f55be8c2ed37e4428f28050f2b8b0a54fe896f03 Author: Tibor Nagy AuthorDate: Tue Nov 24 13:46:45 2020 +0100 Commit: Gabor Kelemen CommitDate: Wed Mar 3 11:06:40 2021 +0100 tdf#138134 sc: remove red circle of updated formula Recalculation of formulas didn't remove the red validation circle around the formula cells despite their new valid value. Note: to check/show the fix manually, run the test with $ (cd sc && make -srj8 UITest_validity UITEST_TEST_NAME="tdf138134.DetectiveCircle.test_delete_circle_at_formula" SAL_USE_VCLPLUGIN=gen) (if needed, by adding import time time.sleep(5) to the called function of sc/qa/uitest/validity/tdf138134.py) Co-authored-by: Attila Szűcs (NISZ) Change-Id: Ieda4449b1ef07a3cb536881e99130d967c1bb175 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106502 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 0478bdb68e8945cc76dc04c6f7040526656329a8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111877 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/uitest/validity/tdf138134.py b/sc/qa/uitest/validity/tdf138134.py new file mode 100644 index ..6d660019d15e --- /dev/null +++ b/sc/qa/uitest/validity/tdf138134.py @@ -0,0 +1,63 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# 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/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +class DetectiveCircle(UITestCase): + +def test_delete_circle_at_formula(self): +calc_doc = self.ui_test.create_doc_in_start_center("calc") +xCalcDoc = self.xUITest.getTopFocusWindow() +gridwin = xCalcDoc.getChild("grid_window") +document = self.ui_test.get_component() +enter_text_to_cell(gridwin, "A1", "1") +enter_text_to_cell(gridwin, "A2", "3") +enter_text_to_cell(gridwin, "A3", "=SUM(A1:A2)") + +#Select the cells to be validated +gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) +#Apply Data > Validity ... > Whole Numbers +self.ui_test.execute_dialog_through_command(".uno:Validation") +xDialog = self.xUITest.getTopFocusWindow() +xTabs = xDialog.getChild("tabcontrol") +select_pos(xTabs, "0") +xallow = xDialog.getChild("allow") +xallowempty = xDialog.getChild("allowempty") +xdata = xDialog.getChild("data") +xmin = xDialog.getChild("min") +xmax = xDialog.getChild("max") + +props = {"TEXT": "Whole Numbers"} +actionProps = mkPropertyValues(props) +xallow.executeAction("SELECT", actionProps) +xallowempty.executeAction("CLICK", tuple()) +propsA = {"TEXT": "equal"} +actionPropsA = mkPropertyValues(propsA) +xdata.executeAction("SELECT", actionPropsA) +xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"5"})) +xOKBtn = xDialog.getChild("ok") +self.ui_test.close_dialog_through_button(xOKBtn) + +self.xUITest.executeCommand(".uno:ShowInvalid") + +detectiveCircle1 = document.Sheets.getByName("Sheet1").DrawPage.getCount() +#There should be 1 detective circle object! +self.assertEqual(detectiveCircle1, 1) + +enter_text_to_cell(gridwin, "A1", "2") + +detectiveCircle2 = document.Sheets.getByName("Sheet1").DrawPage.getCount() +#There should not be a detective circle object! +self.assertEqual(detectiveCircle2, 0) + +self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 8683ecdadf77..8ced4bd0ba0a 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -56,6 +56,8 @@ #include #include #include +#include +#include #include @@ -1830,6 +1832,15 @@ void ScOutputData::FindChanged() nCol2 = std::max(rPos.Col(), nCol2); nRow1 = std::min(rPos.Row(), nRow1); nRow2 = std::max(rPos.Row(), nRow2); + +const SfxUInt32Item* pItem = mpDoc->GetAttr(rPos, ATTR_VALIDDATA); +const ScValidationData* pData = mpDoc->GetValidationEntry(pItem->GetValue()); +if (pData) +
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf139394.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 27 +++ sc/source/filter/excel/xeextlst.cxx | 20 ++-- 3 files changed, 37 insertions(+), 10 deletions(-) New commits: commit 371ea6a4f60c12df6a35bb4715b8ea92a9266e03 Author: Tibor Nagy AuthorDate: Tue Dec 29 08:36:49 2020 +0100 Commit: Gabor Kelemen CommitDate: Wed Mar 3 08:59:53 2021 +0100 tdf#139394 XLSX export: remove extra quotation marks This fixes commit 583e2bfba2d72ac8afe7261c23f380daf5486889 (tdf#139021 XLSX export: fix "contains" conditional formatting). Change-Id: Idae3190b5f87dac551251da19c511f501bdaaa21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108452 Tested-by: László Németh Reviewed-by: László Németh Reviewed-by: Eike Rathke Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108808 Tested-by: Jenkins (cherry picked from commit 9e82c64fa54ce7c0ef18e9de5a06e1243a3a7e44) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111874 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/tdf139394.xlsx b/sc/qa/unit/data/xlsx/tdf139394.xlsx new file mode 100644 index ..eac83fb2f3a8 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf139394.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 158f1f1a2959..f81437aa6693 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -93,6 +93,7 @@ public: ScDocShellRef saveAndReloadPassword( ScDocShell*, const OUString&, const OUString&, const OUString&, SfxFilterFlags ); void test(); +void testTdf139394(); void testExtCondFormatXLSX(); void testTdf90104(); void testTdf111876(); @@ -277,6 +278,7 @@ public: CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); +CPPUNIT_TEST(testTdf139394); CPPUNIT_TEST(testExtCondFormatXLSX); CPPUNIT_TEST(testTdf90104); CPPUNIT_TEST(testTdf111876); @@ -544,6 +546,31 @@ void ScExportTest::test() xDocSh->DoClose(); } +void ScExportTest::testTdf139394() +{ +ScDocShellRef xShell = loadDoc(u"tdf139394.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); + +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); +xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pDoc); + +assertXPathContent(pDoc, + "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[1]/" +"x14:cfRule/xm:f", "LEFT(A1,LEN(\"+\"))=\"+\""); +assertXPathContent(pDoc, + "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[2]/" +"x14:cfRule/xm:f", "RIGHT(A2,LEN(\"-\"))=\"-\""); +assertXPathContent(pDoc, + "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[3]/" +"x14:cfRule/xm:f", "LEFT(A3,LEN($B$3))=$B$3"); + +xDocSh->DoClose(); +} + void ScExportTest::testExtCondFormatXLSX() { ScDocShellRef xShell = loadDoc("tdf139021.", FORMAT_XLSX); diff --git a/sc/source/filter/excel/xeextlst.cxx b/sc/source/filter/excel/xeextlst.cxx index f4a385088d8b..887801174301 100644 --- a/sc/source/filter/excel/xeextlst.cxx +++ b/sc/source/filter/excel/xeextlst.cxx @@ -174,16 +174,16 @@ OString GetFixedFormula(ScConditionMode eMode, const ScAddress& rAddress, const OString aPos = aBuffer.makeStringAndClear(); switch (eMode) { -case ScConditionMode::BeginsWith: -return OString("LEFT(" + aPos + ",LEN(" + rText + "))=\"" + rText + "\""); -case ScConditionMode::EndsWith: -return OString("RIGHT(" + aPos + ",LEN(" + rText + "))=\"" + rText + "\""); -case ScConditionMode::ContainsText: -return OString("NOT(ISERROR(SEARCH(" + rText + "," + aPos + ")))"); -case ScConditionMode::NotContainsText: -return OString("ISERROR(SEARCH(" + rText + "," + aPos + "))"); -default: -break; +case ScConditionMode::BeginsWith: +return OString("LEFT(" + aPos + ",LEN(" + rText + "))=" + rText); +case ScConditionMode::EndsWith: +return OString("RIGHT(" + aPos + ",LEN(" + rText + "))=" + rText); +case ScConditionMode::ContainsText: +return OString("NOT(ISERROR(SEARCH(" + rText + "," + aPos + ")))"); +case ScConditionMode::NotContainsText: +return OString("ISERROR(SEARCH(" + rText + "," + aPos + "))"); +default: +break; } return ""; ___ Libreoffice-commits mailing list
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf139021.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 36 + sc/source/filter/excel/xeextlst.cxx | 89 -- 3 files changed, 120 insertions(+), 5 deletions(-) New commits: commit 390adf01b9fe313c73908680ac8b6fa627b91602 Author: Tibor Nagy AuthorDate: Sat Dec 19 22:25:08 2020 +0100 Commit: Gabor Kelemen CommitDate: Wed Mar 3 08:50:47 2021 +0100 tdf#139021 XLSX export: fix "contains" conditional formatting when using "Given text" type with cell reference instead of fixed string. Note: fix also "notContainsText", and prepare the fix for "beginsWith", "endsWith" and "expression" type conditions. Follow-up of commit 0101975f8eac650bb87c4af81157cb33a6309e0e (tdf#122102 XLSX import: fix "contains" conditional formatting). Co-authored-by: Attila Szűcs (NISZ) Change-Id: I46d80946f2b6cfaa2a9fe2438fae20e8aa9d50f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108035 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 583e2bfba2d72ac8afe7261c23f380daf5486889) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108695 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 9ffc483be4ca49c436406a93690044459e880a9d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111873 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/tdf139021.xlsx b/sc/qa/unit/data/xlsx/tdf139021.xlsx new file mode 100644 index ..f420b7c150d2 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf139021.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 3010bac88ead..158f1f1a2959 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -93,6 +93,7 @@ public: ScDocShellRef saveAndReloadPassword( ScDocShell*, const OUString&, const OUString&, const OUString&, SfxFilterFlags ); void test(); +void testExtCondFormatXLSX(); void testTdf90104(); void testTdf111876(); void testPasswordExportODS(); @@ -276,6 +277,7 @@ public: CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); +CPPUNIT_TEST(testExtCondFormatXLSX); CPPUNIT_TEST(testTdf90104); CPPUNIT_TEST(testTdf111876); CPPUNIT_TEST(testPasswordExportODS); @@ -542,6 +544,40 @@ void ScExportTest::test() xDocSh->DoClose(); } +void ScExportTest::testExtCondFormatXLSX() +{ +ScDocShellRef xShell = loadDoc("tdf139021.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); + +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); +xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pDoc); + +assertXPath(pDoc, + "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[1]/" +"x14:cfRule", "type", "containsText"); +assertXPathContent(pDoc, + "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[1]/" +"x14:cfRule/xm:f[1]", "NOT(ISERROR(SEARCH($B$1,A1)))"); +assertXPathContent(pDoc, + "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[1]/" +"x14:cfRule/xm:f[2]", "$B$1"); +assertXPath(pDoc, + "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[2]/" +"x14:cfRule", "type", "notContainsText"); +assertXPathContent(pDoc, + "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[2]/" +"x14:cfRule/xm:f[1]", "ISERROR(SEARCH($B$2,A2))"); +assertXPathContent(pDoc, + "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[2]/" +"x14:cfRule/xm:f[2]", "$B$2"); + +xDocSh->DoClose(); +} + void ScExportTest::testTdf90104() { ScDocShellRef xShell = loadDoc("tdf90104.", FORMAT_XLSX); diff --git a/sc/source/filter/excel/xeextlst.cxx b/sc/source/filter/excel/xeextlst.cxx index 35d2fac152d7..f4a385088d8b 100644 --- a/sc/source/filter/excel/xeextlst.cxx +++ b/sc/source/filter/excel/xeextlst.cxx @@ -149,6 +149,48 @@ XclExpExtCF::XclExpExtCF( const XclExpRoot& rRoot, const ScCondFormatEntry& rFor { } +namespace { + +bool RequiresFixedFormula(ScConditionMode eMode) +{ +switch (eMode) +{ +case ScConditionMode::BeginsWith: +case ScConditionMode::EndsWith: +case ScConditionMode::ContainsText: +case ScConditionMode::NotContainsText: +return true; +default: +break; +} + +return false; +} + +OString GetFixedFormula(ScConditionMode
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf120749.xlsx|binary sc/qa/unit/subsequent_filters-test.cxx | 38 + sc/source/filter/inc/extlstcontext.hxx |1 sc/source/filter/oox/extlstcontext.cxx | 33 +++- 4 files changed, 71 insertions(+), 1 deletion(-) New commits: commit dfe64f1a4cafb5afa8fa00e4901a65f1fa92c77c Author: Tibor Nagy AuthorDate: Sun Dec 20 19:45:50 2020 +0100 Commit: Gabor Kelemen CommitDate: Wed Mar 3 08:38:39 2021 +0100 tdf#120749 XLSX: fix "begins/ends with" conditional formatting when using "Given text" type and cell reference. Follow-up of commit 583e2bfba2d72ac8afe7261c23f380daf5486889 (tdf#139021 XLSX export: fix "contains" conditional formatting). Co-authored-by: Attila Szűcs (NISZ) Change-Id: Idf5d46469765454a11311bd6ec1d85c85b89e26f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108058 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 879ea123514ce6808212dfbef7e1d226e9d5fd9b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108592 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 75596e1254f284fca22efc8e6cba158bd6c50b15) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111872 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/tdf120749.xlsx b/sc/qa/unit/data/xlsx/tdf120749.xlsx new file mode 100644 index ..de601234d3be Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf120749.xlsx differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 66c092276e3d..5f7dcf412d9e 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -106,6 +106,7 @@ public: virtual void tearDown() override; //ods, xls, xlsx filter tests +void testCondFormatBeginsAndEndsWithXLSX(); void testExtCondFormatXLSX(); void testUpdateCircleInMergedCellODS(); void testDeleteCircleInMergedCellODS(); @@ -276,6 +277,7 @@ public: void testDeleteCirclesInRowAndCol(); CPPUNIT_TEST_SUITE(ScFiltersTest); +CPPUNIT_TEST(testCondFormatBeginsAndEndsWithXLSX); CPPUNIT_TEST(testExtCondFormatXLSX); CPPUNIT_TEST(testUpdateCircleInMergedCellODS); CPPUNIT_TEST(testDeleteCircleInMergedCellODS); @@ -490,6 +492,42 @@ void testRangeNameImpl(const ScDocument& rDoc) } +void ScFiltersTest::testCondFormatBeginsAndEndsWithXLSX() +{ +ScDocShellRef xDocSh = loadDoc("tdf120749.", FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to load tdf120749.xlsx", xDocSh.is()); + +ScDocument& rDoc = xDocSh->GetDocument(); + +// begins with and ends with conditions +ScConditionalFormat* pFormatA1 = rDoc.GetCondFormat(0, 0, 0); +CPPUNIT_ASSERT(pFormatA1); +ScConditionalFormat* pFormatA2 = rDoc.GetCondFormat(0, 1, 0); +CPPUNIT_ASSERT(pFormatA2); +ScConditionalFormat* pFormatA3 = rDoc.GetCondFormat(0, 2, 0); +CPPUNIT_ASSERT(pFormatA3); +ScConditionalFormat* pFormatA4 = rDoc.GetCondFormat(0, 3, 0); +CPPUNIT_ASSERT(pFormatA4); + +ScRefCellValue aCellA1(rDoc, ScAddress(0, 0, 0)); +OUString aCellStyleA1 = pFormatA1->GetCellStyle(aCellA1, ScAddress(0, 0, 0)); +CPPUNIT_ASSERT(!aCellStyleA1.isEmpty()); + +ScRefCellValue aCellA2(rDoc, ScAddress(0, 1, 0)); +OUString aCellStyleA2 = pFormatA2->GetCellStyle(aCellA2, ScAddress(0, 1, 0)); +CPPUNIT_ASSERT(!aCellStyleA2.isEmpty()); + +ScRefCellValue aCellA3(rDoc, ScAddress(0, 2, 0)); +OUString aCellStyleA3 = pFormatA3->GetCellStyle(aCellA3, ScAddress(0, 2, 0)); +CPPUNIT_ASSERT(!aCellStyleA3.isEmpty()); + +ScRefCellValue aCellA4(rDoc, ScAddress(0, 3, 0)); +OUString aCellStyleA4 = pFormatA4->GetCellStyle(aCellA4, ScAddress(0, 3, 0)); +CPPUNIT_ASSERT(!aCellStyleA4.isEmpty()); + +xDocSh->DoClose(); +} + void ScFiltersTest::testExtCondFormatXLSX() { ScDocShellRef xDocSh = loadDoc("tdf122102.", FORMAT_XLSX); diff --git a/sc/source/filter/inc/extlstcontext.hxx b/sc/source/filter/inc/extlstcontext.hxx index 4c7b697299e8..8e4f3e5278b8 100644 --- a/sc/source/filter/inc/extlstcontext.hxx +++ b/sc/source/filter/inc/extlstcontext.hxx @@ -52,6 +52,7 @@ public: virtual void onEndElement() override; private: +sal_Int32 nFormulaCount; OUString aChars; // Characters of between xml elements. OUString rStyle; // Style of the corresponding condition sal_Int32 nPriority; // Priority of last cfRule element. diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx index 0a694e00fd2d..2f0c6c475c9a 100644 --- a/sc/source/filter/oox/extlstcontext.cxx +++ b/sc/source/filter/oox/extlstcontext.cxx @@ -80,8 +80,26 @@ void ExtCfRuleContext::onStartElement( const AttributeList& rAttribs ) } } +namespace { +bool IsSpecificTextCondMode(ScConditionMode eMode) +
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf122102.xlsx|binary sc/qa/unit/subsequent_filters-test.cxx | 38 + sc/source/filter/oox/extlstcontext.cxx | 13 ++- 3 files changed, 50 insertions(+), 1 deletion(-) New commits: commit 2dcf05d75624f0d1a4cfb6c4ab724a53dbeab316 Author: Tibor Nagy AuthorDate: Tue Dec 15 18:58:33 2020 +0100 Commit: Gabor Kelemen CommitDate: Tue Mar 2 17:13:56 2021 +0100 tdf#122102 XLSX import: fix "contains" conditional formatting when using "Given text" type and cell reference with "contains text" or "not contains text" conditions. Co-authored-by: Attila Szűcs (NISZ) Change-Id: Ifbd34ef9f7ee948b6ac42a890bd52f3fb8486aec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107791 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 0101975f8eac650bb87c4af81157cb33a6309e0e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107810 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 4bca4f507c064c18880bd8283aaba567865d2462) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111789 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/tdf122102.xlsx b/sc/qa/unit/data/xlsx/tdf122102.xlsx new file mode 100644 index ..bc1db82d78a7 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf122102.xlsx differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 31fce53b67bd..66c092276e3d 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -106,6 +106,7 @@ public: virtual void tearDown() override; //ods, xls, xlsx filter tests +void testExtCondFormatXLSX(); void testUpdateCircleInMergedCellODS(); void testDeleteCircleInMergedCellODS(); void testBooleanFormatXLSX(); @@ -275,6 +276,7 @@ public: void testDeleteCirclesInRowAndCol(); CPPUNIT_TEST_SUITE(ScFiltersTest); +CPPUNIT_TEST(testExtCondFormatXLSX); CPPUNIT_TEST(testUpdateCircleInMergedCellODS); CPPUNIT_TEST(testDeleteCircleInMergedCellODS); CPPUNIT_TEST(testBooleanFormatXLSX); @@ -488,6 +490,42 @@ void testRangeNameImpl(const ScDocument& rDoc) } +void ScFiltersTest::testExtCondFormatXLSX() +{ +ScDocShellRef xDocSh = loadDoc("tdf122102.", FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to load tdf122102.xlsx", xDocSh.is()); + +ScDocument& rDoc = xDocSh->GetDocument(); + +// contains text and not contains text conditions +ScConditionalFormat* pFormatA1 = rDoc.GetCondFormat(0, 0, 0); +CPPUNIT_ASSERT(pFormatA1); +ScConditionalFormat* pFormatA2 = rDoc.GetCondFormat(0, 1, 0); +CPPUNIT_ASSERT(pFormatA2); +ScConditionalFormat* pFormatA3 = rDoc.GetCondFormat(0, 2, 0); +CPPUNIT_ASSERT(pFormatA3); +ScConditionalFormat* pFormatA4 = rDoc.GetCondFormat(0, 3, 0); +CPPUNIT_ASSERT(pFormatA4); + +ScRefCellValue aCellA1(rDoc, ScAddress(0, 0, 0)); +OUString aCellStyleA1 = pFormatA1->GetCellStyle(aCellA1, ScAddress(0, 0, 0)); +CPPUNIT_ASSERT(!aCellStyleA1.isEmpty()); + +ScRefCellValue aCellA2(rDoc, ScAddress(0, 1, 0)); +OUString aCellStyleA2 = pFormatA2->GetCellStyle(aCellA2, ScAddress(0, 1, 0)); +CPPUNIT_ASSERT(!aCellStyleA2.isEmpty()); + +ScRefCellValue aCellA3(rDoc, ScAddress(0, 2, 0)); +OUString aCellStyleA3 = pFormatA3->GetCellStyle(aCellA3, ScAddress(0, 2, 0)); +CPPUNIT_ASSERT(!aCellStyleA3.isEmpty()); + +ScRefCellValue aCellA4(rDoc, ScAddress(0, 3, 0)); +OUString aCellStyleA4 = pFormatA4->GetCellStyle(aCellA4, ScAddress(0, 3, 0)); +CPPUNIT_ASSERT(!aCellStyleA4.isEmpty()); + +xDocSh->DoClose(); +} + void ScFiltersTest::testUpdateCircleInMergedCellODS() { ScDocShellRef xDocSh = loadDoc("updateCircleInMergedCell.", FORMAT_ODS); diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx index 06aa3d836120..0a694e00fd2d 100644 --- a/sc/source/filter/oox/extlstcontext.cxx +++ b/sc/source/filter/oox/extlstcontext.cxx @@ -135,6 +135,16 @@ ContextHandlerRef ExtConditionalFormattingContext::onCreateContext(sal_Int32 nEl eOperator = CondFormatBuffer::convertToInternalOperator(aToken); return this; } +else if(aType == "containsText") +{ +eOperator = ScConditionMode::ContainsText; +return this; +} +else if(aType == "notContainsText") +{ +eOperator = ScConditionMode::NotContainsText; +return this; +} else { SAL_WARN("sc", "unhandled XLS14_TOKEN(cfRule) with type: " << aType); @@ -181,7 +191,8 @@ void ExtConditionalFormattingContext::onEndElement() { case XM_TOKEN(f): { -rFormulas.push_back(aChars); +if(!aChars.startsWith("ISERROR(SEARCH(") &&
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx | 16 sc/source/filter/xcl97/xcl97rec.cxx | 10 ++ 2 files changed, 22 insertions(+), 4 deletions(-) New commits: commit 87118c2e311af035171ec4b53609cc9e7a7b139e Author: Szabolcs Toth AuthorDate: Tue Dec 8 16:21:25 2020 +0100 Commit: Gabor Kelemen CommitDate: Tue Mar 2 15:17:45 2021 +0100 tdf#123613 XLSX export: fix position of rotated shapes based on the bounding box of the custom shape. Change-Id: I63a2a4380ae0c6c0eb37d3e5e4dcbfc839b410a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107424 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit a4eec60c388cc65ae0b4c8ea0fd7235f520a749d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111786 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index f9290a8d5995..3010bac88ead 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -5364,8 +5364,9 @@ void ScExportTest::testHeaderFontStyleXLSX() void ScExportTest::testTdf135828_Shape_Rect() { -// tdf#135828 Check that the width and the height of rectangle of the shape -// is correct. +// tdf#135828 Check that the width and the height of rectangle of the shape is correct. +// tdf#123613 Check the positioning, and allow massive rounding errors because of the back and +// forth conversion between emu and hmm. ScDocShellRef xShell = loadDoc("tdf135828_Shape_Rect.", FORMAT_XLSX); CPPUNIT_ASSERT(xShell.is()); @@ -5377,8 +5378,15 @@ void ScExportTest::testTdf135828_Shape_Rect() xmlDocUniquePtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDrawing); -assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cx", "294480"); // width -assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cy", "1990440"); // height +double nXPosOfTopleft = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:off", "x" ).toDouble(); +double nYPosOfTopleft = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:off", "y" ).toDouble(); +double nWidth = getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cx").toDouble(); +double nHeight= getXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cy").toDouble(); + +CPPUNIT_ASSERT_DOUBLES_EQUAL( 854640, nXPosOfTopleft, 1); +CPPUNIT_ASSERT_DOUBLES_EQUAL( -570600, nYPosOfTopleft, 1); +CPPUNIT_ASSERT_DOUBLES_EQUAL( 294840, nWidth, 1); +CPPUNIT_ASSERT_DOUBLES_EQUAL( 1988280,nHeight, 1); } void ScExportTest::testTdf123353() diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 215c38055cd7..77265db3f21f 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1103,6 +1103,16 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& awt::Point aTopLeft= rShape->getPosition(); awt::Size aSize = rShape->getSize(); +// size is correct, but aTopLeft needs correction for rotated shapes +SdrObject* pObj = SdrObject::getSdrObjectFromXShape(rShape.get()); +sal_Int32 nRotation = pObj->GetRotateAngle(); +if ( pObj && nRotation != 0 && pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE ) +{ +const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape +aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - (aSize.Width / 2); +aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - (aSize.Height / 2); +} + uno::Reference< beans::XPropertySet > xShapeProperties(rShape, uno::UNO_QUERY_THROW); uno::Any nRotProp = xShapeProperties->getPropertyValue("RotateAngle"); sal_Int32 nRot = nRotProp.get(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf138741_externalLinkSkipUnusedsCrash.xlsx |binary sc/qa/unit/subsequent_export-test.cxx| 13 ++ sc/source/filter/excel/xelink.cxx|2 + sc/source/ui/docshell/externalrefmgr.cxx |2 - 4 files changed, 16 insertions(+), 1 deletion(-) New commits: commit 623f68f6d8404d73f8bcfe9db798752efd36c79f Author: Attila Szűcs AuthorDate: Tue Dec 8 18:22:07 2020 +0100 Commit: Gabor Kelemen CommitDate: Tue Mar 2 12:54:45 2021 +0100 tdf#138741 XLSX export: fix crash in setSkipUnusedFileIds Changed size of maConvertFileIdToUsedFileId vector to the same as maSrcFiles size. Some external references was not inserted into maRefCells, that resulted a smaller maConvertFileIdToUsedFileId as was needed. This crash was caused by: tdf#87973 XLSX export: fix lost file names in modified links f85d860ccbebd99bc128218148e2992c9415f221 Co-authored-by: Tibor Nagy (NISZ) Change-Id: I1501f5222483bf3e9e41c9e921a024320231dce8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107434 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara (cherry picked from commit 8cfe270258d914e154b9db8b6ad02cd923984435) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107481 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 172b81479451f0af2978dfa2eba1f9d105b946c9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111781 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/tdf138741_externalLinkSkipUnusedsCrash.xlsx b/sc/qa/unit/data/xlsx/tdf138741_externalLinkSkipUnusedsCrash.xlsx new file mode 100644 index ..59102f2ab814 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf138741_externalLinkSkipUnusedsCrash.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 5b2ae8b3729b..f9290a8d5995 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -270,6 +270,7 @@ public: void testTdf137000_handle_upright(); void testTdf126305_DataValidatyErrorAlert(); void testTdf87973_externalLinkSkipUnuseds(); +void testTdf138741_externalLinkSkipUnusedsCrash(); void testTdf129969(); void testTdf84874(); @@ -436,6 +437,7 @@ public: CPPUNIT_TEST(testTdf137000_handle_upright); CPPUNIT_TEST(testTdf126305_DataValidatyErrorAlert); CPPUNIT_TEST(testTdf87973_externalLinkSkipUnuseds); +CPPUNIT_TEST(testTdf138741_externalLinkSkipUnusedsCrash); CPPUNIT_TEST(testTdf129969); CPPUNIT_TEST(testTdf84874); @@ -5489,6 +5491,17 @@ void ScExportTest::testTdf87973_externalLinkSkipUnuseds() pDocSh->DoClose(); } +void ScExportTest::testTdf138741_externalLinkSkipUnusedsCrash() +{ +ScDocShellRef xShell = loadDoc("tdf138741_externalLinkSkipUnusedsCrash.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell); + +//without the fix in place, it would have crashed at export time +ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); + +xShell->DoClose(); +} + void ScExportTest::testTdf129969() { ScDocShellRef xShell = loadDoc("external_hyperlink.", FORMAT_ODS); diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx index d36bba70de9f..c0d37c44d60c 100644 --- a/sc/source/filter/excel/xelink.cxx +++ b/sc/source/filter/excel/xelink.cxx @@ -2083,6 +2083,8 @@ void XclExpSupbookBuffer::SaveXml( XclExpXmlStream& rStrm ) for (size_t nPos = 0, nSize = maSupbookList.GetSize(); nPos < nSize; ++nPos) { XclExpSupbookRef xRef(maSupbookList.GetRecord(nPos)); +// fileIDs are indexed from 1 in xlsx, and from 0 in ScExternalRefManager +// converting between them require a -1 or +1 if (xRef->GetType() == XclSupbookType::Extern) aExternFileIds.push_back(xRef->GetFileId() - 1); } diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 6591c4495e76..329da9dcc21a 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -2751,7 +2751,7 @@ sal_uInt16 ScExternalRefManager::convertFileIdToUsedFileId(sal_uInt16 nFileId) void ScExternalRefManager::setSkipUnusedFileIds(std::vector& rExternFileIds) { mbSkipUnusedFileIds = true; -maConvertFileIdToUsedFileId.resize(maRefCells.size()); +maConvertFileIdToUsedFileId.resize(maSrcFiles.size()); std::fill(maConvertFileIdToUsedFileId.begin(), maConvertFileIdToUsedFileId.end(), 0); int nUsedCount = 0; for (auto nEntry : rExternFileIds) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/ods/updateCircleInMergedCell.ods |binary sc/qa/unit/subsequent_filters-test.cxx | 35 +++ sc/source/core/tool/detfunc.cxx |9 +++-- sc/source/ui/docshell/docfunc.cxx|8 + sc/source/ui/inc/docfunc.hxx |3 + 5 files changed, 51 insertions(+), 4 deletions(-) New commits: commit 7afe5cc58143114ce60d22be63bf1663b779b50c Author: Tibor Nagy AuthorDate: Thu Nov 26 14:20:14 2020 +0100 Commit: Gabor Kelemen CommitDate: Mon Mar 1 15:55:13 2021 +0100 tdf#138483 sc: update red circles after merging cells If there are detective circles on the cells and these cells are merged, the merged cell keeps all red circles instead of removed them except the circle of merged cell. Co-authored-by: Attila Szűcs (NISZ) Change-Id: I39c76cbb7c41affb0a18e5e82923945a2d41795d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106698 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 3741b90abe478fb04db88207b496a5238df35bb8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106827 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit df36ac613e43934e49edd3f087d78c7c54ac92ee) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111709 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/ods/updateCircleInMergedCell.ods b/sc/qa/unit/data/ods/updateCircleInMergedCell.ods new file mode 100644 index ..93be82487e22 Binary files /dev/null and b/sc/qa/unit/data/ods/updateCircleInMergedCell.ods differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index f7171a4d567d..31fce53b67bd 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -66,6 +66,8 @@ #include #include #include +#include +#include #include #include @@ -104,6 +106,7 @@ public: virtual void tearDown() override; //ods, xls, xlsx filter tests +void testUpdateCircleInMergedCellODS(); void testDeleteCircleInMergedCellODS(); void testBooleanFormatXLSX(); void testBasicCellContentODS(); @@ -272,6 +275,7 @@ public: void testDeleteCirclesInRowAndCol(); CPPUNIT_TEST_SUITE(ScFiltersTest); +CPPUNIT_TEST(testUpdateCircleInMergedCellODS); CPPUNIT_TEST(testDeleteCircleInMergedCellODS); CPPUNIT_TEST(testBooleanFormatXLSX); CPPUNIT_TEST(testBasicCellContentODS); @@ -484,6 +488,37 @@ void testRangeNameImpl(const ScDocument& rDoc) } +void ScFiltersTest::testUpdateCircleInMergedCellODS() +{ +ScDocShellRef xDocSh = loadDoc("updateCircleInMergedCell.", FORMAT_ODS); +CPPUNIT_ASSERT_MESSAGE("Failed to load updateCircleInMergedCell.ods", xDocSh.is()); + +ScDocument& rDoc = xDocSh->GetDocument(); +rDoc.EnableChangeReadOnly(true); + +ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); +SdrPage* pPage = pDrawLayer->GetPage(0); +CPPUNIT_ASSERT_MESSAGE("draw page for sheet 1 should exist.", pPage); + +// There should be four circle objects! +CPPUNIT_ASSERT_EQUAL(static_cast(4), pPage->GetObjCount()); + +ScCellMergeOption aCellMergeOption(0,0,1,1); // A1:B2 +aCellMergeOption.maTabs.insert(0); +xDocSh->GetDocFunc().MergeCells(aCellMergeOption, false, true, true, false); + +// There should be a circle object! +CPPUNIT_ASSERT_EQUAL(static_cast(1), pPage->GetObjCount()); + +std::unique_ptr pUndoRemoveMerge; +xDocSh->GetDocFunc().UnmergeCells(aCellMergeOption, true, pUndoRemoveMerge.get()); + +// There should be four circle objects! +CPPUNIT_ASSERT_EQUAL(static_cast(4), pPage->GetObjCount()); + +xDocSh->DoClose(); +} + void ScFiltersTest::testDeleteCircleInMergedCellODS() { ScDocShellRef xDocSh = loadDoc("deleteCircleInMergedCell.", FORMAT_ODS); diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index 5e5b538a80e6..f30d36d11e70 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -1388,13 +1388,15 @@ bool ScDetectiveFunc::MarkInvalid(bool& rOverflow) if ( bMarkEmpty ) for ( nRow = nNextRow; nRow < nCellRow && nInsCount < SC_DET_MAXCIRCLE; nRow++ ) { -DrawCircle( nCol, nRow, aData ); + if(!pPattern->GetItem(ATTR_MERGE_FLAG).IsOverlapped()) + DrawCircle( nCol, nRow, aData ); ++nInsCount; } ScRefCellValue aCell = aCellIter.getRefCellValue(); if (!pData->IsDataValid(aCell, aCellIter.GetPos())) { -DrawCircle( nCol, nCellRow, aData ); +if(!pPattern->GetItem(ATTR_MERGE_FLAG).IsOverlapped()) +
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/ods/deleteCircleInMergedCell.ods |binary sc/qa/unit/subsequent_filters-test.cxx | 36 +++ sc/source/core/tool/detfunc.cxx |2 - 3 files changed, 37 insertions(+), 1 deletion(-) New commits: commit a6d3668362f8c7d41f08f8a4fa3dad56a4f5527f Author: Tibor Nagy AuthorDate: Thu Nov 19 16:29:01 2020 +0100 Commit: Gabor Kelemen CommitDate: Mon Mar 1 13:01:27 2021 +0100 tdf#138137 sc: remove red circle in merged cell This mark wasn't removed when valid data is entered in the merged cell. Co-authored-by: Attila Szűcs (NISZ) Change-Id: I7632abadde9c482819f80af2600ab4c58292a821 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106172 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 6975e4387640a1473ca158f503637be61ac9dedb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106447 Reviewed-by: Xisco Fauli (cherry picked from commit fbf92ea796a398f0fceb1613aad0a3d682dd2403) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111701 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/ods/deleteCircleInMergedCell.ods b/sc/qa/unit/data/ods/deleteCircleInMergedCell.ods new file mode 100644 index ..f4d078d1f610 Binary files /dev/null and b/sc/qa/unit/data/ods/deleteCircleInMergedCell.ods differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 6d400cb7371f..f7171a4d567d 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -104,6 +104,7 @@ public: virtual void tearDown() override; //ods, xls, xlsx filter tests +void testDeleteCircleInMergedCellODS(); void testBooleanFormatXLSX(); void testBasicCellContentODS(); void testRangeNameXLS(); @@ -271,6 +272,7 @@ public: void testDeleteCirclesInRowAndCol(); CPPUNIT_TEST_SUITE(ScFiltersTest); +CPPUNIT_TEST(testDeleteCircleInMergedCellODS); CPPUNIT_TEST(testBooleanFormatXLSX); CPPUNIT_TEST(testBasicCellContentODS); CPPUNIT_TEST(testRangeNameXLS); @@ -482,6 +484,40 @@ void testRangeNameImpl(const ScDocument& rDoc) } +void ScFiltersTest::testDeleteCircleInMergedCellODS() +{ +ScDocShellRef xDocSh = loadDoc("deleteCircleInMergedCell.", FORMAT_ODS); +CPPUNIT_ASSERT_MESSAGE("Failed to load deleteCircleInMergedCell.ods", xDocSh.is()); + +ScDocument& rDoc = xDocSh->GetDocument(); + +ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); +SdrPage* pPage = pDrawLayer->GetPage(0); +CPPUNIT_ASSERT_MESSAGE("draw page for sheet 1 should exist.", pPage); + +// There should be a circle object! +CPPUNIT_ASSERT_EQUAL(static_cast(1), pPage->GetObjCount()); + +ScRefCellValue aMergedCell; +ScAddress aPosMergedCell(0, 0, 0); +aMergedCell.assign(rDoc, aPosMergedCell); + +// The value of merged cell change to 6. +aMergedCell.mfValue = 6; + +// Check that the data is valid.(True if the value = 6) +const ScValidationData* pData = rDoc.GetValidationEntry(1); +bool bValidA1 = pData->IsDataValid(aMergedCell, aPosMergedCell); +// if valid, delete circle. +if (bValidA1) +ScDetectiveFunc(, 0).DeleteCirclesAt(aPosMergedCell.Col(), aPosMergedCell.Row()); + +// There should not be a circle object! +CPPUNIT_ASSERT_EQUAL(static_cast(0), pPage->GetObjCount()); + +xDocSh->DoClose(); +} + void ScFiltersTest::testBasicCellContentODS() { ScDocShellRef xDocSh = loadDoc("basic-cell-content.", FORMAT_ODS); diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index b76af228830f..5e5b538a80e6 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -1240,7 +1240,7 @@ bool ScDetectiveFunc::DeletePred( SCCOL nCol, SCROW nRow ) bool ScDetectiveFunc::DeleteCirclesAt( SCCOL nCol, SCROW nRow ) { -tools::Rectangle aRect = GetDrawRect(nCol, nRow); +tools::Rectangle aRect = ScDrawLayer::GetCellRect(*pDoc, ScAddress(nCol, nRow, nTab), true); aRect.AdjustLeft(-250); aRect.AdjustRight(250); aRect.AdjustTop(-70); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/ods/deleteCirclesInRowAndCol.ods |binary sc/qa/unit/subsequent_filters-test.cxx | 31 + sc/source/core/data/drwlayer.cxx | 51 ++- 3 files changed, 64 insertions(+), 18 deletions(-) New commits: commit 0dca9589e0051e41ec29552b3204a57fb14ccebf Author: Tibor Nagy AuthorDate: Tue Nov 10 14:25:23 2020 +0100 Commit: Gabor Kelemen CommitDate: Mon Mar 1 09:50:17 2021 +0100 tdf#41845 sc: delete row/column with validation circles Red validation circles around the cells were left after deleting their rows or columns, showing invalid data on the next valid or not-validated cells. Co-authored-by: Attila Szűcs (NISZ) Change-Id: I0dcef9225696b76eda78f0ee8831a83c20f53b0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105527 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit d6d8b9c59524cff8effc170c57940700282bf625) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111585 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/ods/deleteCirclesInRowAndCol.ods b/sc/qa/unit/data/ods/deleteCirclesInRowAndCol.ods new file mode 100644 index ..6b99787c4b43 Binary files /dev/null and b/sc/qa/unit/data/ods/deleteCirclesInRowAndCol.ods differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 91aff833b4b1..6d400cb7371f 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -268,6 +268,7 @@ public: void testTextLengthDataValidityXLSX(); void testDeleteCircles(); void testDrawCircleInMergeCells(); +void testDeleteCirclesInRowAndCol(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBooleanFormatXLSX); @@ -423,6 +424,7 @@ public: CPPUNIT_TEST(testTextLengthDataValidityXLSX); CPPUNIT_TEST(testDeleteCircles); CPPUNIT_TEST(testDrawCircleInMergeCells); +CPPUNIT_TEST(testDeleteCirclesInRowAndCol); CPPUNIT_TEST_SUITE_END(); @@ -4735,6 +4737,35 @@ void ScFiltersTest::testDrawCircleInMergeCells() xDocSh->DoClose(); } +void ScFiltersTest::testDeleteCirclesInRowAndCol() +{ +ScDocShellRef xDocSh = loadDoc("deleteCirclesInRowAndCol.", FORMAT_ODS); +CPPUNIT_ASSERT_MESSAGE("Failed to load deleteCirclesInRowAndCol.ods", xDocSh.is()); + +ScDocument& rDoc = xDocSh->GetDocument(); + +ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); +SdrPage* pPage = pDrawLayer->GetPage(0); +CPPUNIT_ASSERT_MESSAGE("draw page for sheet 1 should exist.", pPage); + +// There should be 6 circle objects! +CPPUNIT_ASSERT_EQUAL(static_cast(6), pPage->GetObjCount()); + +// Delete first row (1023 = MAXCOLS) +pDrawLayer->DeleteObjectsInArea(0,0,0,1023,0,true); + +// There should be 3 circle objects! +CPPUNIT_ASSERT_EQUAL(static_cast(3), pPage->GetObjCount()); + +// Delete first col (1048575 = MAXROWS) +pDrawLayer->DeleteObjectsInArea(0,0,0,0,1048575,true); + +// There should not be a circle object! +CPPUNIT_ASSERT_EQUAL(static_cast(0), pPage->GetObjCount()); + +xDocSh->DoClose(); +} + ScFiltersTest::ScFiltersTest() : ScBootstrapFixture( "sc/qa/unit/data" ) { diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 76a79a00b060..2da197750608 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -1372,37 +1372,53 @@ void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, pPage->RecalcObjOrdNums(); const size_t nObjCount = pPage->GetObjCount(); -if (nObjCount) -{ -size_t nDelCount = 0; -tools::Rectangle aDelRect = pDoc->GetMMRect( nCol1, nRow1, nCol2, nRow2, nTab ); +if (!nObjCount) +return; -std::unique_ptr ppObj(new SdrObject*[nObjCount]); +size_t nDelCount = 0; +tools::Rectangle aDelRect = pDoc->GetMMRect( nCol1, nRow1, nCol2, nRow2, nTab ); +tools::Rectangle aDelCircle = pDoc->GetMMRect( nCol1, nRow1, nCol2, nRow2, nTab ); +aDelCircle.AdjustLeft(-250); +aDelCircle.AdjustRight(250); +aDelCircle.AdjustTop(-70); +aDelCircle.AdjustBottom(70); -SdrObjListIter aIter( pPage, SdrIterMode::Flat ); -SdrObject* pObject = aIter.Next(); -while (pObject) +std::unique_ptr ppObj(new SdrObject*[nObjCount]); + +SdrObjListIter aIter( pPage, SdrIterMode::Flat ); +SdrObject* pObject = aIter.Next(); +while (pObject) +{ +// do not delete note caption, they are always handled by the cell note +// TODO: detective objects are still deleted, is this desired? +if (!IsNoteCaption( pObject )) { -// do not delete note caption, they are always handled by the cell note -// TODO: detective objects are still deleted, is this desired? -if
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/copy_paste_test.cxx| 52 sc/qa/unit/data/ods/tdf137624_autofillMergedMixed.ods |binary sc/source/core/data/table4.cxx| 75 -- 3 files changed, 105 insertions(+), 22 deletions(-) New commits: commit 31a1928861cbd5bc888b932286a3beafaead4231 Author: Attila Szűcs AuthorDate: Fri Nov 13 09:42:00 2020 +0100 Commit: Gabor Kelemen CommitDate: Fri Feb 26 14:09:16 2021 +0100 tdf#137624 sc: autofill mixed sequences in merged cells Improve FillAnalyse, FillSeries to continue linear sequences of mixed values in merged cells (mixed values are string + number, like 'a1','a2' or '1a'). It discovers the linear sequence only if the string parts are identical. It recognizes user lists only if all elements are in the same user list. Co-authored-by: Tibor Nagy (NISZ) Change-Id: I8810a0f1d637436222e3d0b9219da38ccb7c6346 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105784 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 09eccdc87db5258ea779e2bcc12437f802624ee5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111583 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx index eb07928e05e4..9b0a472496a0 100644 --- a/sc/qa/unit/copy_paste_test.cxx +++ b/sc/qa/unit/copy_paste_test.cxx @@ -50,6 +50,7 @@ public: void tdf137205_autofillDatesInMergedCells(); void tdf137653_137654_autofillUserlist(); void tdf137625_autofillMergedUserlist(); +void tdf137624_autofillMergedMixed(); CPPUNIT_TEST_SUITE(ScCopyPasteTest); CPPUNIT_TEST(testCopyPasteXLS); @@ -65,6 +66,7 @@ public: CPPUNIT_TEST(tdf137205_autofillDatesInMergedCells); CPPUNIT_TEST(tdf137653_137654_autofillUserlist); CPPUNIT_TEST(tdf137625_autofillMergedUserlist); +CPPUNIT_TEST(tdf137624_autofillMergedMixed); CPPUNIT_TEST_SUITE_END(); private: @@ -880,7 +882,57 @@ void ScCopyPasteTest::tdf137625_autofillMergedUserlist() } } +void ScCopyPasteTest::tdf137624_autofillMergedMixed() +{ +ScDocShellRef xDocSh = loadDocAndSetupModelViewController("tdf137624_autofillMergedMixed.", FORMAT_ODS, true); +ScDocument& rDoc = xDocSh->GetDocument(); + +// Get the document controller +ScTabViewShell* pView = xDocSh->GetBestViewShell(false); +CPPUNIT_ASSERT(pView != nullptr); + +// add 1aa,2bb,3cc,4dd,5ee,6ff to userlist, to test that autofill won't confuse it with 1aa,3aa +// delete every userlist to make sure there won't be any string that is in 2 different userlist +ScGlobal::GetUserList()->clear(); +addToUserList({ "1aa,2bb,3cc,4dd,5ee,6ff" }); + +// fillauto mixed (string + number), these areas contain only merged cells +pView->FillAuto(FILL_TO_RIGHT, 7, 5, 12, 7, 6); //H6:M8 +pView->FillAuto(FILL_TO_LEFT, 7, 5, 12, 7, 6);//H6:M8 +pView->FillAuto(FILL_TO_BOTTOM, 1, 20, 3, 23, 4); //B21:D24 +pView->FillAuto(FILL_TO_TOP, 1, 20, 3, 23, 4);//B21:D24 +// compare the results of fill-right / -left with the reference stored in the test file +// this compares the whole area blindly, for specific test cases, check the test file +for (int nCol = 1; nCol <= 18; nCol++) +{ +for (int nRow = 5; nRow <= 7; nRow++) +{ +CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0)); +CellType nType2 = rDoc.GetCellType(ScAddress(nCol, nRow + 4, 0)); +OUString aStr1 = rDoc.GetString(nCol, nRow, 0); +OUString aStr2 = rDoc.GetString(nCol, nRow + 4, 0); + +CPPUNIT_ASSERT_EQUAL(nType1, nType2); +CPPUNIT_ASSERT_EQUAL(aStr1, aStr2); +} +} + +// compare the results of fill-up / -down +for (int nCol = 1; nCol <= 3; nCol++) +{ +for (int nRow = 16; nRow <= 27; nRow++) +{ +CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0)); +CellType nType2 = rDoc.GetCellType(ScAddress(nCol + 4, nRow, 0)); +OUString aStr1 = rDoc.GetString(nCol, nRow, 0); +OUString aStr2 = rDoc.GetString(nCol + 4, nRow, 0); + +CPPUNIT_ASSERT_EQUAL(nType1, nType2); +CPPUNIT_ASSERT_EQUAL(aStr1, aStr2); +} +} +} ScCopyPasteTest::ScCopyPasteTest() : ScBootstrapFixture( "sc/qa/unit/data" ) diff --git a/sc/qa/unit/data/ods/tdf137624_autofillMergedMixed.ods b/sc/qa/unit/data/ods/tdf137624_autofillMergedMixed.ods new file mode 100644 index ..cc1b6a7c6ab8 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf137624_autofillMergedMixed.ods differ diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 16b6c1cbf35f..3daea8217cd4 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -419,25 +419,9 @@ void
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/copy_paste_test.cxx| 97 -- sc/qa/unit/data/ods/tdf137653_137654_autofillUserlist.ods |binary sc/source/core/data/table4.cxx| 36 +++-- 3 files changed, 110 insertions(+), 23 deletions(-) New commits: commit 2a1dda925b7ff1f79bf6a98194322dbda5aa5386 Author: Attila Szűcs AuthorDate: Tue Nov 3 16:35:59 2020 +0100 Commit: Gabor Kelemen CommitDate: Fri Feb 26 14:03:58 2021 +0100 tdf#137653 tdf#137624 sc: fix autofill user list sequences Improve FillAuto, FillAnalyse to discover the step between values of linear sequences of user list (sort list) values in 1x1 cells, and continue it. (Sort lists are special string lists with values like day names Monday, Tuesday, ... see Tools->Options...->Calc->Sort list) Note: The unit test is not language dependent, as it clears all user lists and replace it with its own list. Also fixed this in the unit test of tdf#137625. Co-authored-by: Tibor Nagy (NISZ) Change-Id: I1c8b0df9ad29f91a6080e56e5f2ebe0029a10a08 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105259 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit d64bd977a430182826252695f041a6ddd62e45ef) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111584 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx index e21ab52d169b..eb07928e05e4 100644 --- a/sc/qa/unit/copy_paste_test.cxx +++ b/sc/qa/unit/copy_paste_test.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -47,6 +48,7 @@ public: void testTdf88782_autofillLinearNumbersInMergedCells(); void tdf137621_autofillMergedBool(); void tdf137205_autofillDatesInMergedCells(); +void tdf137653_137654_autofillUserlist(); void tdf137625_autofillMergedUserlist(); CPPUNIT_TEST_SUITE(ScCopyPasteTest); @@ -61,12 +63,14 @@ public: CPPUNIT_TEST(testTdf88782_autofillLinearNumbersInMergedCells); CPPUNIT_TEST(tdf137621_autofillMergedBool); CPPUNIT_TEST(tdf137205_autofillDatesInMergedCells); +CPPUNIT_TEST(tdf137653_137654_autofillUserlist); CPPUNIT_TEST(tdf137625_autofillMergedUserlist); CPPUNIT_TEST_SUITE_END(); private: ScDocShellRef loadDocAndSetupModelViewController(const OUString& rFileName, sal_Int32 nFormat, bool bReadWrite); +void addToUserList(const OUString& rStr); uno::Reference m_xCalcComponent; }; @@ -754,6 +758,69 @@ void ScCopyPasteTest::tdf137205_autofillDatesInMergedCells() } } +void ScCopyPasteTest::addToUserList(const OUString& rStr) +{ +ScUserListData* aListData = new ScUserListData(rStr); +ScGlobal::GetUserList()->push_back(aListData); +} + +void ScCopyPasteTest::tdf137653_137654_autofillUserlist() +{ +ScDocShellRef xDocSh = loadDocAndSetupModelViewController("tdf137653_137654_autofillUserlist.", FORMAT_ODS, true); +ScDocument& rDoc = xDocSh->GetDocument(); + +// Get the document controller +ScTabViewShell* pView = xDocSh->GetBestViewShell(false); +CPPUNIT_ASSERT(pView != nullptr); + +// delete every userlist to make sure there won't be any string that is in 2 different userlist +ScGlobal::GetUserList()->clear(); +addToUserList({ "January,February,March,April,May,June,July,August,September,October,November,December" }); +const ScUserListData* pListData = ScGlobal::GetUserList()->GetData("January"); +sal_uInt16 nIdx1 = 0, nIdx2 = 0; +bool bHasIdx1, bHasIdx2; +bool bMatchCase = false; + +// fillauto userlist, these areas contain only merged cells +pView->FillAuto(FILL_TO_RIGHT, 4, 5, 6, 7, 3); //E6:G8 +pView->FillAuto(FILL_TO_LEFT, 4, 5, 6, 7, 3);//E6:G8 +pView->FillAuto(FILL_TO_BOTTOM, 1, 18, 3, 19, 2); //B19:D20 +pView->FillAuto(FILL_TO_TOP, 1, 18, 3, 19, 2);//B19:D20 + +// compare the results of fill-right / -left with the reference stored in the test file +// this compares the whole area blindly, for specific test cases, check the test file +for (int nCol = 1; nCol <= 9; nCol++) +{ +for (int nRow = 5; nRow <= 7; nRow++) +{ +CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0)); +CellType nType2 = rDoc.GetCellType(ScAddress(nCol, nRow + 4, 0)); +bHasIdx1 = pListData->GetSubIndex(rDoc.GetString(nCol, nRow, 0), nIdx1, bMatchCase); +bHasIdx2 = pListData->GetSubIndex(rDoc.GetString(nCol, nRow + 4, 0), nIdx2, bMatchCase); + +CPPUNIT_ASSERT_EQUAL(nType1, nType2); +CPPUNIT_ASSERT(bHasIdx1 && bHasIdx2); +CPPUNIT_ASSERT_EQUAL(nIdx1, nIdx2); // userlist index value of cells +} +} + +// compare the results of fill-up / -down +for (int nCol = 1; nCol <= 3; nCol++) +{ +for (int nRow = 16; nRow <=
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/xlsx/testDrawCircleInMergeCells.xlsx |binary sc/qa/unit/subsequent_filters-test.cxx | 69 +++ sc/source/core/data/drwlayer.cxx | 10 -- sc/source/core/tool/detfunc.cxx |2 4 files changed, 71 insertions(+), 10 deletions(-) New commits: commit c80dfc6592ce315700dbda4b69f3fb22c17a1429 Author: Tibor Nagy AuthorDate: Tue Nov 3 11:50:59 2020 +0100 Commit: Gabor Kelemen CommitDate: Fri Feb 26 09:31:25 2021 +0100 tdf#137614 sc: fix data circle shape size on merged cells When we are marked invalid data using Tools->Detective-> Mark Invalid Data, only top left cell of the merged cells is circled instead of all the merged range. Note: ScDrawLayer::RecalcPos change is for resizing the circled merged cell. Co-authored-by: Regina Henschel Change-Id: Ia03c506c92ec6e1c81ef3039c20e8e7ba9e9181d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105241 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit d7bcf59a51a058ba57e685cfc3e000fec623f716) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111577 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/testDrawCircleInMergeCells.xlsx b/sc/qa/unit/data/xlsx/testDrawCircleInMergeCells.xlsx new file mode 100644 index ..cab448a22d49 Binary files /dev/null and b/sc/qa/unit/data/xlsx/testDrawCircleInMergeCells.xlsx differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index b067b8c22ba8..91aff833b4b1 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -267,6 +267,7 @@ public: void testTextBoxBodyUpright(); void testTextLengthDataValidityXLSX(); void testDeleteCircles(); +void testDrawCircleInMergeCells(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBooleanFormatXLSX); @@ -421,6 +422,7 @@ public: CPPUNIT_TEST(testTextBoxBodyUpright); CPPUNIT_TEST(testTextLengthDataValidityXLSX); CPPUNIT_TEST(testDeleteCircles); +CPPUNIT_TEST(testDrawCircleInMergeCells); CPPUNIT_TEST_SUITE_END(); @@ -4666,6 +4668,73 @@ void ScFiltersTest::testDeleteCircles() xDocSh->DoClose(); } +void ScFiltersTest::testDrawCircleInMergeCells() +{ +ScDocShellRef xDocSh = loadDoc("testDrawCircleInMergeCells.", FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to load testDrawCircleInMergeCells.ods", xDocSh.is()); + +ScDocument& rDoc = xDocSh->GetDocument(); + +ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); +SdrPage* pPage = pDrawLayer->GetPage(0); +CPPUNIT_ASSERT_MESSAGE("draw page for sheet 1 should exist.", pPage); + +// A1:B2 is merged. +ScRange aMergedRange(0,0,0); +rDoc.ExtendTotalMerge(aMergedRange); +CPPUNIT_ASSERT_EQUAL(ScRange(0,0,0,1,1,0), aMergedRange); + +// Mark invalid value +bool bOverflow; +bool bMarkInvalid = ScDetectiveFunc(, 0).MarkInvalid(bOverflow); +CPPUNIT_ASSERT_EQUAL(true, bMarkInvalid); + +// There should be a circle object! +CPPUNIT_ASSERT_EQUAL(static_cast(1), pPage->GetObjCount()); + +SdrObject* pObj = pPage->GetObj(0); +tools::Rectangle aRect(pObj->GetLogicRect()); +Point aStartCircle = aRect.TopLeft(); +Point aEndCircle = aRect.BottomRight(); + +tools::Rectangle aCellRect = rDoc.GetMMRect(0,0,1,1,0); +aCellRect.AdjustLeft( -250 ); +aCellRect.AdjustRight(250 ); +aCellRect.AdjustTop( -70 ); +aCellRect.AdjustBottom(70 ); +Point aStartCell = aCellRect.TopLeft(); +Point aEndCell = aCellRect.BottomRight(); + +CPPUNIT_ASSERT_EQUAL(aStartCell.X(), aStartCircle.X()); +CPPUNIT_ASSERT_EQUAL(aEndCell.X(), aEndCircle.X()); +CPPUNIT_ASSERT_EQUAL(aStartCell.Y(), aStartCircle.Y()); +CPPUNIT_ASSERT_EQUAL(aEndCell.Y(), aEndCircle.Y()); + +// Change the height of the first row. (556 ~ 1cm) +rDoc.SetRowHeight(0, 0, 556); +ScDrawObjData* pData = ScDrawLayer::GetObjData(pObj); +pDrawLayer->RecalcPos(pObj,*pData,false,false); + +tools::Rectangle aRecalcRect(pObj->GetLogicRect()); +Point aStartRecalcCircle = aRecalcRect.TopLeft(); +Point aEndRecalcCircle = aRecalcRect.BottomRight(); + +tools::Rectangle aRecalcCellRect = rDoc.GetMMRect(0,0,1,1,0); +aRecalcCellRect.AdjustLeft( -250 ); +aRecalcCellRect.AdjustRight(250 ); +aRecalcCellRect.AdjustTop( -70 ); +aRecalcCellRect.AdjustBottom(70 ); +Point aStartRecalcCell = aRecalcCellRect.TopLeft(); +Point aEndRecalcCell1 = aRecalcCellRect.BottomRight(); + +CPPUNIT_ASSERT_EQUAL(aStartRecalcCell.X(), aStartRecalcCircle.X()); +CPPUNIT_ASSERT_EQUAL(aEndRecalcCell1.X(), aEndRecalcCircle.X()); +CPPUNIT_ASSERT_EQUAL(aStartRecalcCell.Y(), aStartRecalcCircle.Y()); +CPPUNIT_ASSERT_EQUAL(aEndRecalcCell1.Y(), aEndRecalcCircle.Y()); + +
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/copy_paste_test.cxx | 57 + sc/qa/unit/data/ods/tdf137625_autofillMergedUserlist.ods |binary sc/source/core/data/table4.cxx | 146 +-- 3 files changed, 184 insertions(+), 19 deletions(-) New commits: commit e4bc887ee575645ab694f195ad93f2f96d2d10ca Author: Attila Szűcs AuthorDate: Thu Oct 22 17:44:40 2020 +0200 Commit: Gabor Kelemen CommitDate: Thu Feb 25 16:18:13 2021 +0100 tdf#137625 sc: autofill user list sequences in merged cells Improve FillAuto, FillAnalyse to continue linear sequences of user list values in merged cells. (User lists are special string lists with values like day names Monday, Tuesday, ...) If values are user list values, but not in linear sequence, then the autofill will just fill with FILL_SIMPLE (pattern repeat). Note: the unit test depends on English system locale settings, check it in Tools->Options->LibreOffice Calc->Sort list, otherwise extend Sort list with English day names for manual testing. Co-authored-by: Tibor Nagy (NISZ) Change-Id: I7a1da5e82a18ba8ebd24af7e4b89c7651f3ec24a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104690 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit e8a88d6129948227b46d734a7eba999ec9d1a025) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111572 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx index d1836fe214b9..e21ab52d169b 100644 --- a/sc/qa/unit/copy_paste_test.cxx +++ b/sc/qa/unit/copy_paste_test.cxx @@ -47,6 +47,7 @@ public: void testTdf88782_autofillLinearNumbersInMergedCells(); void tdf137621_autofillMergedBool(); void tdf137205_autofillDatesInMergedCells(); +void tdf137625_autofillMergedUserlist(); CPPUNIT_TEST_SUITE(ScCopyPasteTest); CPPUNIT_TEST(testCopyPasteXLS); @@ -60,6 +61,7 @@ public: CPPUNIT_TEST(testTdf88782_autofillLinearNumbersInMergedCells); CPPUNIT_TEST(tdf137621_autofillMergedBool); CPPUNIT_TEST(tdf137205_autofillDatesInMergedCells); +CPPUNIT_TEST(tdf137625_autofillMergedUserlist); CPPUNIT_TEST_SUITE_END(); private: @@ -752,6 +754,61 @@ void ScCopyPasteTest::tdf137205_autofillDatesInMergedCells() } } +void ScCopyPasteTest::tdf137625_autofillMergedUserlist() +{ +ScDocShellRef xDocSh = loadDocAndSetupModelViewController("tdf137625_autofillMergedUserlist.", FORMAT_ODS, true); +ScDocument& rDoc = xDocSh->GetDocument(); + +// Get the document controller +ScTabViewShell* pView = xDocSh->GetBestViewShell(false); +CPPUNIT_ASSERT(pView != nullptr); + +// fillauto userlist, these areas contain only merged cells +pView->FillAuto(FILL_TO_RIGHT, 7, 5, 12, 7, 6); //H6:M8 +pView->FillAuto(FILL_TO_LEFT, 7, 5, 12, 7, 6);//H6:M8 +pView->FillAuto(FILL_TO_BOTTOM, 1, 20, 3, 23, 4); //B21:D24 +pView->FillAuto(FILL_TO_TOP, 1, 20, 3, 23, 4);//B21:D24 + +// compare the results of fill-right / -left with the reference stored in the test file +// this compares the whole area blindly, for specific test cases, check the test file +for (int nCol = 1; nCol <= 18; nCol++) +{ +for (int nRow = 5; nRow <= 7; nRow++) +{ +CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0)); +CellType nType2 = rDoc.GetCellType(ScAddress(nCol, nRow + 4, 0)); +double* pValue1 = rDoc.GetValueCell(ScAddress(nCol, nRow, 0)); +double* pValue2 = rDoc.GetValueCell(ScAddress(nCol, nRow + 4, 0)); + +CPPUNIT_ASSERT_EQUAL(nType1, nType2); +if (pValue2 != nullptr) +CPPUNIT_ASSERT_EQUAL(*pValue1, *pValue2); //cells with userlist value +else +CPPUNIT_ASSERT_EQUAL(pValue1, pValue2); //empty cells +} +} + +// compare the results of fill-up / -down +for (int nCol = 1; nCol <= 3; nCol++) +{ +for (int nRow = 16; nRow <= 27; nRow++) +{ +CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0)); +CellType nType2 = rDoc.GetCellType(ScAddress(nCol + 4, nRow, 0)); +double* pValue1 = rDoc.GetValueCell(ScAddress(nCol, nRow, 0)); +double* pValue2 = rDoc.GetValueCell(ScAddress(nCol + 4, nRow, 0)); + +CPPUNIT_ASSERT_EQUAL(nType1, nType2); +if (pValue2 != nullptr) +CPPUNIT_ASSERT_EQUAL(*pValue1, *pValue2); //cells with userlist value +else +CPPUNIT_ASSERT_EQUAL(pValue1, pValue2); //empty cells +} +} +} + + + ScCopyPasteTest::ScCopyPasteTest() : ScBootstrapFixture( "sc/qa/unit/data" ) { diff --git a/sc/qa/unit/data/ods/tdf137625_autofillMergedUserlist.ods b/sc/qa/unit/data/ods/tdf137625_autofillMergedUserlist.ods new file mode
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/ods/tdf84874.ods |binary sc/qa/unit/subsequent_export-test.cxx | 33 sc/source/core/data/table4.cxx|2 - sc/source/filter/excel/xecontent.cxx | 39 -- 4 files changed, 57 insertions(+), 17 deletions(-) New commits: commit c4a4c25bb94f60140612b544e1ba45119f7354fd Author: Tibor Nagy AuthorDate: Mon Oct 19 22:46:08 2020 +0200 Commit: Gabor Kelemen CommitDate: Thu Feb 25 15:57:14 2021 +0100 tdf#84874 XLSX export: truncate validation text Maximum length allowed in Excel is 255 characters for title and message of validation input and error, so truncate them, otherwise Excel throws away the whole message. Co-authored-by: Attila Szűcs (NISZ) Change-Id: Id4576f167ab8a39e0cd943bc07c2e465a77ba665 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104547 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit ec1f4d3253963ac16d638734ac70dde033e82154) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111471 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/ods/tdf84874.ods b/sc/qa/unit/data/ods/tdf84874.ods new file mode 100644 index ..8eb87761b321 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf84874.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 70305f238b85..331c872c090f 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -270,6 +270,7 @@ public: void testTdf137000_handle_upright(); void testTdf126305_DataValidatyErrorAlert(); void testTdf129969(); +void testTdf84874(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -434,6 +435,7 @@ public: CPPUNIT_TEST(testTdf137000_handle_upright); CPPUNIT_TEST(testTdf126305_DataValidatyErrorAlert); CPPUNIT_TEST(testTdf129969); +CPPUNIT_TEST(testTdf84874); CPPUNIT_TEST_SUITE_END(); @@ -5481,6 +5483,37 @@ void ScExportTest::testTdf137000_handle_upright() "rot"); } +void ScExportTest::testTdf84874() +{ +ScDocShellRef xShell = loadDoc("tdf84874.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.is()); + +ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX); +xShell->DoClose(); +CPPUNIT_ASSERT(xDocSh.is()); + +ScDocument& rDoc = xDocSh->GetDocument(); + +const ScValidationData* pData = rDoc.GetValidationEntry(1); +OUString aTitle, aText; +pData->GetInput( aTitle, aText ); +sal_uInt32 nPromptTitleLen = aTitle.getLength(); +sal_uInt32 nPromptTextLen = aText.getLength(); + +CPPUNIT_ASSERT_EQUAL(static_cast(255), nPromptTitleLen); +CPPUNIT_ASSERT_EQUAL(static_cast(255), nPromptTextLen); + +ScValidErrorStyle eErrStyle = SC_VALERR_STOP; +pData->GetErrMsg( aTitle, aText, eErrStyle ); +sal_uInt32 nErrorTitleLen = aTitle.getLength(); +sal_uInt32 nErrorTextLen = aText.getLength(); + +CPPUNIT_ASSERT_EQUAL(static_cast(255), nErrorTitleLen); +CPPUNIT_ASSERT_EQUAL(static_cast(255), nErrorTextLen); + +xDocSh->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index a0dcb99602a7..7a88aec3260b 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -401,7 +401,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if (!::rtl::math::approxEqual(nDiff, rInc, 13)) bVal = false; else if ((aCurrCell.mfValue == 0.0 || aCurrCell.mfValue == 1.0) - && (rDocument.GetFormatTable()->GetType( + && (pDocument->GetFormatTable()->GetType( GetNumberFormat(nColCurr, nRowCurr)) == SvNumFormatType::LOGICAL)) bVal = false; diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 7f09509175f9..10cb1d190950 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -52,6 +52,7 @@ #include #include #include +#include using namespace ::oox; @@ -1647,6 +1648,24 @@ const char* lcl_GetErrorType( sal_uInt32 nFlags ) return nullptr; } +void lcl_SetValidationText(const OUString& rText, XclExpString& rValidationText) +{ +if ( !rText.isEmpty() ) +{ +// maximum length allowed in Excel is 255 characters +if ( rText.getLength() > 255 ) +{ +OUStringBuffer aBuf( rText ); +rValidationText.Assign( +comphelper::string::truncateToLength(aBuf, 255).makeStringAndClear() ); +
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/copy_paste_test.cxx | 57 --- sc/qa/unit/data/ods/tdf137621_autofillMergedBool.ods |binary sc/source/core/data/table4.cxx | 11 +++ 3 files changed, 59 insertions(+), 9 deletions(-) New commits: commit ad3b553f2248acd564a9e9f7c0b8b7baf7e31ffd Author: Attila Szűcs AuthorDate: Thu Oct 22 12:47:16 2020 +0200 Commit: Gabor Kelemen CommitDate: Thu Feb 25 15:37:11 2021 +0100 tdf#137621 sc: autofill bool sequences in merged cells Fixed FillAnalyse to not discover booleans as number sequences, rather as a pattern that can be repeated. Co-authored-by: Tibor Nagy (NISZ) Change-Id: I0a32e756461eb4101b77724129b745e23a658b1d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104655 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 66c316cd4a703b4bc2e569b14888ea9e0d2ca9c9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111469 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx index 6dc5b574c4a7..d1836fe214b9 100644 --- a/sc/qa/unit/copy_paste_test.cxx +++ b/sc/qa/unit/copy_paste_test.cxx @@ -45,6 +45,7 @@ public: void testTdf40993_fillMergedCells(); void testTdf43958_clickSelectOnMergedCells(); void testTdf88782_autofillLinearNumbersInMergedCells(); +void tdf137621_autofillMergedBool(); void tdf137205_autofillDatesInMergedCells(); CPPUNIT_TEST_SUITE(ScCopyPasteTest); @@ -57,6 +58,7 @@ public: CPPUNIT_TEST(testTdf40993_fillMergedCells); CPPUNIT_TEST(testTdf43958_clickSelectOnMergedCells); CPPUNIT_TEST(testTdf88782_autofillLinearNumbersInMergedCells); +CPPUNIT_TEST(tdf137621_autofillMergedBool); CPPUNIT_TEST(tdf137205_autofillDatesInMergedCells); CPPUNIT_TEST_SUITE_END(); @@ -648,10 +650,12 @@ void ScCopyPasteTest::testTdf88782_autofillLinearNumbersInMergedCells() pView->FillAuto(FILL_TO_LEFT, 9, 30, 16, 35, 8);//J31:Q36 -> B31:Q36 // compare the results of fill-down with the reference stored in the test file -// this compare the whole area blindly, for concrete test cases, check the test file +// this compares the whole area blindly, for specific test cases, check the test file // the test file have instructions / explanations, so that is easy to understand -for (int nCol = 1; nCol <= 10; nCol++) { -for (int nRow = 8; nRow <= 27; nRow++) { +for (int nCol = 1; nCol <= 10; nCol++) +{ +for (int nRow = 8; nRow <= 27; nRow++) +{ CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0)); CellType nType2 = rDoc.GetCellType(ScAddress(nCol + 22, nRow, 0)); double* pValue1 = rDoc.GetValueCell(ScAddress(nCol, nRow, 0)); @@ -666,8 +670,10 @@ void ScCopyPasteTest::testTdf88782_autofillLinearNumbersInMergedCells() } // compare the results of fill-right and left with the reference stored in the test file -for (int nCol = 1; nCol <= 24; nCol++) { -for (int nRow = 30; nRow <= 35; nRow++) { +for (int nCol = 1; nCol <= 24; nCol++) +{ +for (int nRow = 30; nRow <= 35; nRow++) +{ CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0)); CellType nType2 = rDoc.GetCellType(ScAddress(nCol, nRow + 16, 0)); double* pValue1 = rDoc.GetValueCell(ScAddress(nCol, nRow, 0)); @@ -681,6 +687,39 @@ void ScCopyPasteTest::testTdf88782_autofillLinearNumbersInMergedCells() } } } + +void ScCopyPasteTest::tdf137621_autofillMergedBool() +{ +ScDocShellRef xDocSh = loadDocAndSetupModelViewController("tdf137621_autofillMergedBool.", FORMAT_ODS, true); +ScDocument& rDoc = xDocSh->GetDocument(); + +// Get the document controller +ScTabViewShell* pView = xDocSh->GetBestViewShell(false); +CPPUNIT_ASSERT(pView != nullptr); + +// fillauto booleans, these areas contain only merged cells +pView->FillAuto(FILL_TO_RIGHT, 0, 4, 3, 5, 8); //A5:D6 + +// compare the results of fill-right with the reference stored in the test file +// this compares the whole area blindly, for specific test cases, check the test file +for (int nCol = 4; nCol <= 11; nCol++) +{ +for (int nRow = 4; nRow <= 5; nRow++) +{ +CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0)); +CellType nType2 = rDoc.GetCellType(ScAddress(nCol, nRow + 3, 0)); +double* pValue1 = rDoc.GetValueCell(ScAddress(nCol, nRow, 0)); +double* pValue2 = rDoc.GetValueCell(ScAddress(nCol, nRow + 3, 0)); + +CPPUNIT_ASSERT_EQUAL(nType1, nType2); +if (pValue2 != nullptr) +CPPUNIT_ASSERT_EQUAL(*pValue1, *pValue2); //cells with boolean value +else +CPPUNIT_ASSERT_EQUAL(pValue1, pValue2);
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/ods/external_hyperlink.ods |binary sc/qa/unit/subsequent_export-test.cxx | 19 +++ sc/source/filter/excel/xecontent.cxx |5 ++--- 3 files changed, 21 insertions(+), 3 deletions(-) New commits: commit f516f2a0ccc939f565c8a84ae5430b3706d56bb4 Author: Tünde Tóth AuthorDate: Wed Oct 14 10:53:54 2020 +0200 Commit: Gabor Kelemen CommitDate: Thu Feb 25 13:57:22 2021 +0100 tdf#129969 XLSX export: file URLs need IURI encoding External hyperlinks with # in directory name didn't work after XLSX export. Change-Id: Ibdf4fcbb65d0c580841d24c1721454164e341424 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104272 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit fc58d7d65b9683db7b7632137126680b8483f6c5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111465 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/ods/external_hyperlink.ods b/sc/qa/unit/data/ods/external_hyperlink.ods new file mode 100644 index ..1e895b988497 Binary files /dev/null and b/sc/qa/unit/data/ods/external_hyperlink.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index a3b699cb9938..f37778217a73 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -267,6 +267,7 @@ public: void testTdf123353(); void testTdf133688_precedents(); void testTdf126305_DataValidatyErrorAlert(); +void testTdf129969(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -428,6 +429,7 @@ public: CPPUNIT_TEST(testTdf123353); CPPUNIT_TEST(testTdf133688_precedents); CPPUNIT_TEST(testTdf126305_DataValidatyErrorAlert); +CPPUNIT_TEST(testTdf129969); CPPUNIT_TEST_SUITE_END(); @@ -5420,6 +5422,23 @@ void ScExportTest::testTdf126305_DataValidatyErrorAlert() xDocSh->DoClose(); } +void ScExportTest::testTdf129969() +{ +ScDocShellRef xShell = loadDoc("external_hyperlink.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.is()); + +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); +ScDocument& rDoc = xDocSh->GetDocument(); +ScAddress aPos(0, 0, 0); +const EditTextObject* pEditText = rDoc.GetEditText(aPos); +const SvxFieldData* pData = pEditText->GetFieldData(0, 0, text::textfield::Type::URL); +const SvxURLField* pURLData = static_cast(pData); + CPPUNIT_ASSERT(pURLData->GetURL().endsWith("/%23folder/test.ods#Sheet2.B10")); + +xDocSh->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 7bc5445de207..d69946b06f62 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -351,9 +351,8 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU { sal_uInt16 nLevel; bool bRel; -/* TODO: should we differentiate between BIFF and OOXML and write IURI - * encoded for OOXML? */ -OUString aFileName( BuildFileName( nLevel, bRel, rUrl, rRoot, false ) ); +OUString aFileName( +BuildFileName(nLevel, bRel, rUrl, rRoot, rRoot.GetOutput() == EXC_OUTPUT_XML_2007)); if( eProtocol == INetProtocol::Smb ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf90104.xlsx|binary sc/qa/unit/subsequent_export-test.cxx | 24 +++ sc/source/filter/excel/xecontent.cxx | 35 +- sc/source/filter/inc/xecontent.hxx|1 4 files changed, 59 insertions(+), 1 deletion(-) New commits: commit 677fe80877a4166eb4c243a6943b4e2b7e36c147 Author: Tibor Nagy AuthorDate: Tue Oct 13 15:48:31 2020 +0200 Commit: Gabor Kelemen CommitDate: Thu Feb 25 13:48:10 2021 +0100 tdf#90104 XLSX export: fix commas in data validation list Comma was exported as list separator instead of decimal separator, messing up the data validation list by breaking integer and fractional parts of a number to two integer numbers, for example the 2-item list 1,5, 2,5 to the bad 4-item list 1, 5, 2, 5. Note: for testing with numbers, it needs to set decimal separator to comma in locale settings. Co-authored-by: Attila Szűcs (NISZ) Change-Id: I6133c402b47aab8ed9f02b412762404fc520badc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104240 Tested-by: László Németh Reviewed-by: László Németh Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111459 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/tdf90104.xlsx b/sc/qa/unit/data/xlsx/tdf90104.xlsx new file mode 100644 index ..ce6ed68368d6 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf90104.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 462c63c93b42..a3b699cb9938 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -93,6 +93,7 @@ public: ScDocShellRef saveAndReloadPassword( ScDocShell*, const OUString&, const OUString&, const OUString&, SfxFilterFlags ); void test(); +void testTdf90104(); void testTdf111876(); void testPasswordExportODS(); void testTdf134332(); @@ -269,6 +270,7 @@ public: CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); +CPPUNIT_TEST(testTdf90104); CPPUNIT_TEST(testTdf111876); CPPUNIT_TEST(testPasswordExportODS); CPPUNIT_TEST(testTdf134332); @@ -464,6 +466,7 @@ void ScExportTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) { BAD_CAST("ContentType"), BAD_CAST("http://schemas.openxmlformats.org/package/2006/content-types;) }, { BAD_CAST("x14"), BAD_CAST("http://schemas.microsoft.com/office/spreadsheetml/2009/9/main;) }, { BAD_CAST("xm"), BAD_CAST("http://schemas.microsoft.com/office/excel/2006/main;) }, +{ BAD_CAST("x12ac"), BAD_CAST("http://schemas.microsoft.com/office/spreadsheetml/2011/1/ac;) }, }; for(size_t i = 0; i < SAL_N_ELEMENTS(aNamespaces); ++i) { @@ -527,6 +530,27 @@ void ScExportTest::test() xDocSh->DoClose(); } +void ScExportTest::testTdf90104() +{ +ScDocShellRef xShell = loadDoc("tdf90104.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); + +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); + +xmlDocUniquePtr pDoc += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pDoc); + +assertXPathContent(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation/mc:AlternateContent" + "/mc:Choice/x12ac:list", "1,\"2,3\",4,\"5,6\""); +assertXPathContent(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation/mc:AlternateContent" + "/mc:Fallback/x:formula1", "\"1,2,3,4,5,6\""); +} + void ScExportTest::testTdf111876() { // Document with relative path hyperlink diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 765d8ef3c728..7bc5445de207 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -1739,6 +1739,8 @@ XclExpDV::XclExpDV( const XclExpRoot& rRoot, sal_uLong nScHandle ) : OUString aString; if( XclTokenArrayHelper::GetStringList( aString, *xScTokArr, '\n' ) ) { +bool bList = false; +OUStringBuffer sListBuf; OUStringBuffer sFormulaBuf; sFormulaBuf.append( '"' ); /* Formula is a list of string tokens -> build the Excel string. @@ -1751,12 +1753,22 @@ XclExpDV::XclExpDV( const XclExpRoot& rRoot, sal_uLong nScHandle ) : for(;;) { const OUString aToken( aString.getToken( 0, '\n', nStringIx ) ); +if (aToken.indexOf(",") != -1) +{ +sListBuf.append('"'); +
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/ods/tdf126305.ods |binary sc/qa/unit/subsequent_export-test.cxx | 21 + sc/source/filter/excel/xecontent.cxx | 13 - 3 files changed, 33 insertions(+), 1 deletion(-) New commits: commit e8ab7f84e2d94e63f8fdae001170e5a3de3bc3de Author: Tibor Nagy AuthorDate: Tue Oct 6 12:12:29 2020 +0200 Commit: Gabor Kelemen CommitDate: Wed Feb 24 16:39:52 2021 +0100 tdf#126305 XLSX export: fix data validation Error Alert Excel supports three kinds of error messages: stop, warning and information, but LO only one of error message(stop) was exported. Co-authored-by: Attila Szűcs (NISZ) Change-Id: Iecf790c104bee39ee29629a13fe4af4d8b29d311 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104021 Tested-by: Jenkins Reviewed-by: Eike Rathke (cherry picked from commit fca525d570f4fada3db1a9bbee2e88a5a02839d9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111456 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/ods/tdf126305.ods b/sc/qa/unit/data/ods/tdf126305.ods new file mode 100644 index ..fdff7d9568c3 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf126305.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index d387221d4156..462c63c93b42 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -265,6 +265,7 @@ public: void testTdf135828_Shape_Rect(); void testTdf123353(); void testTdf133688_precedents(); +void testTdf126305_DataValidatyErrorAlert(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -424,6 +425,7 @@ public: CPPUNIT_TEST(testTdf135828_Shape_Rect); CPPUNIT_TEST(testTdf123353); CPPUNIT_TEST(testTdf133688_precedents); +CPPUNIT_TEST(testTdf126305_DataValidatyErrorAlert); CPPUNIT_TEST_SUITE_END(); @@ -5375,6 +5377,25 @@ void ScExportTest::testTdf133688_precedents() assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor[1]", 0); } +void ScExportTest::testTdf126305_DataValidatyErrorAlert() +{ +ScDocShellRef xShell = loadDoc("tdf126305.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.is()); + +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); +xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pDoc); + +assertXPath(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation[1]", "errorStyle", "stop"); +assertXPath(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation[2]", "errorStyle", "warning"); +assertXPath(pDoc, "/x:worksheet/x:dataValidations/x:dataValidation[3]", "errorStyle", "information"); + +xDocSh->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index c7d6d97ea6de..2628c8b0d1ae 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -1638,6 +1638,17 @@ const char* lcl_GetOperatorType( sal_uInt32 nFlags ) return nullptr; } +const char* lcl_GetErrorType( sal_uInt32 nFlags ) +{ +switch (nFlags & EXC_DV_ERROR_MASK) +{ +case EXC_DV_ERROR_STOP: return "stop"; +case EXC_DV_ERROR_WARNING: return "warning"; +case EXC_DV_ERROR_INFO: return "information"; +} +return nullptr; +} + } // namespace XclExpDV::XclExpDV( const XclExpRoot& rRoot, sal_uLong nScHandle ) : @@ -1845,7 +1856,7 @@ void XclExpDV::SaveXml( XclExpXmlStream& rStrm ) rWorksheet->startElement( XML_dataValidation, XML_allowBlank, ToPsz( ::get_flag( mnFlags, EXC_DV_IGNOREBLANK ) ), XML_error, XESTRING_TO_PSZ( maErrorText ), -// OOXTODO: XML_errorStyle, +XML_errorStyle, lcl_GetErrorType(mnFlags), XML_errorTitle, XESTRING_TO_PSZ( maErrorTitle ), // OOXTODO: XML_imeMode, XML_operator, lcl_GetOperatorType( mnFlags ), ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/copy_paste_test.cxx | 33 ++ sc/qa/unit/data/ods/tdf137205_AutofillDatesInMergedCells.ods |binary sc/source/core/data/table4.cxx | 142 --- 3 files changed, 143 insertions(+), 32 deletions(-) New commits: commit 3d18cc2b2657cbd1a6338ada87fe2649041f1f70 Author: Attila Szűcs AuthorDate: Mon Oct 5 15:01:02 2020 +0200 Commit: Gabor Kelemen CommitDate: Wed Feb 24 10:09:31 2021 +0100 tdf#137205 sc: autofill date sequences in merged cells Improve FillAnalyse to discover and continue linear sequences of dates with the only differences of months or years in merged cells by skipping the empty overlapped cells of the merged area. Follow-up of commit Ib431e8968f5d71e321b0e57cfb173534a0f5da31 (tdf#88782 sc: autofill number sequences in merged cells) Co-authored-by: Tibor Nagy (NISZ) Change-Id: I1e37efd34858f53691bf867ebefc2fe26e39e676 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103967 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 60848fe54e2792a99970f8b48f6b9c02837b407e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111424 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx index 592be6cf518c..6dc5b574c4a7 100644 --- a/sc/qa/unit/copy_paste_test.cxx +++ b/sc/qa/unit/copy_paste_test.cxx @@ -45,6 +45,7 @@ public: void testTdf40993_fillMergedCells(); void testTdf43958_clickSelectOnMergedCells(); void testTdf88782_autofillLinearNumbersInMergedCells(); +void tdf137205_autofillDatesInMergedCells(); CPPUNIT_TEST_SUITE(ScCopyPasteTest); CPPUNIT_TEST(testCopyPasteXLS); @@ -56,6 +57,7 @@ public: CPPUNIT_TEST(testTdf40993_fillMergedCells); CPPUNIT_TEST(testTdf43958_clickSelectOnMergedCells); CPPUNIT_TEST(testTdf88782_autofillLinearNumbersInMergedCells); +CPPUNIT_TEST(tdf137205_autofillDatesInMergedCells); CPPUNIT_TEST_SUITE_END(); private: @@ -638,7 +640,7 @@ void ScCopyPasteTest::testTdf88782_autofillLinearNumbersInMergedCells() aMergeOptions.maTabs.insert(0); xDocSh->GetDocFunc().MergeCells(aMergeOptions, false, true, true, false); -// fillauto numbers, these areas contains mostly merged cells +// fillauto numbers, these areas contain mostly merged cells pView->FillAuto(FILL_TO_BOTTOM, 1, 8, 3, 14, 7);// B9:D15 -> B9:D22 pView->FillAuto(FILL_TO_BOTTOM, 5, 8, 7, 17, 10); // F9:H18 -> F9:H28 pView->FillAuto(FILL_TO_BOTTOM, 9, 8, 10, 13, 6); // J9:K14 -> J9:K20 @@ -679,6 +681,35 @@ void ScCopyPasteTest::testTdf88782_autofillLinearNumbersInMergedCells() } } } +void ScCopyPasteTest::tdf137205_autofillDatesInMergedCells() +{ +ScDocShellRef xDocSh = loadDocAndSetupModelViewController("tdf137205_AutofillDatesInMergedCells.", FORMAT_ODS, true); +ScDocument& rDoc = xDocSh->GetDocument(); + +// Get the document controller +ScTabViewShell* pView = xDocSh->GetBestViewShell(false); +CPPUNIT_ASSERT(pView != nullptr); + +// fillauto dates, this areas contain only merged cells +pView->FillAuto(FILL_TO_RIGHT, 1, 5, 4, 7, 8); //B6:E8 + +// compare the results of fill-right with the reference stored in the test file +// this compare the whole area blindly, for concrete test cases, check the test file +for (int nCol = 5; nCol <= 12; nCol++) { +for (int nRow = 5; nRow <= 7; nRow++) { +CellType nType1 = rDoc.GetCellType(ScAddress(nCol, nRow, 0)); +CellType nType2 = rDoc.GetCellType(ScAddress(nCol, nRow + 5, 0)); +double* pValue1 = rDoc.GetValueCell(ScAddress(nCol, nRow, 0)); +double* pValue2 = rDoc.GetValueCell(ScAddress(nCol, nRow + 5, 0)); + +CPPUNIT_ASSERT_EQUAL(nType1, nType2); +if (pValue2 != nullptr) +CPPUNIT_ASSERT_EQUAL(*pValue1, *pValue2); //cells with number value +else +CPPUNIT_ASSERT_EQUAL(pValue1, pValue2); //empty cells +} +} +} ScCopyPasteTest::ScCopyPasteTest() : ScBootstrapFixture( "sc/qa/unit/data" ) diff --git a/sc/qa/unit/data/ods/tdf137205_AutofillDatesInMergedCells.ods b/sc/qa/unit/data/ods/tdf137205_AutofillDatesInMergedCells.ods new file mode 100644 index ..9a62d575dbd2 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf137205_AutofillDatesInMergedCells.ods differ diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 18747e24c708..d23f1114bda1 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -253,15 +253,15 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, { bool bHasOverlappedCells = false; bool bSkipOverlappedCells = true; -SCCOL nColAkt = nCol1; -
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/copy_paste_test.cxx | 32 sc/source/ui/view/viewdata.cxx | 21 - 2 files changed, 52 insertions(+), 1 deletion(-) New commits: commit 5c2d2a4f3bdb03bb957178dce4df09e9914e3a44 Author: Attila Szűcs AuthorDate: Fri Sep 18 12:59:38 2020 +0200 Commit: Gabor Kelemen CommitDate: Tue Feb 23 15:09:47 2021 +0100 tdf#43958 sc: fix fill by selecting merged cell wholly instead of only its top left corner, if there is no marked selection present. This fixes the selection rectangle during dragging by fill handle of selected merged cells, copying their attributes in other cells of the target area, too, fixing losing merged cell structure, e.g. incomplete grid and other problems. Follow-up of commit 1ed04c2029218619aab2f3422130c890f67f309c (tdf#40993 tdf#59585 sc fill: copy merged cell structure). Note: the selection is a bit different, if there is filtered (hidden) rows in the current cell area. Co-authored-by: Tibor Nagy (NISZ) Change-Id: I387feef640b7a89ab601c24e3641075934d3fc54 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103001 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 605b4ba57b2daa447af9d43d3759079e15df8148) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111329 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx index 5580f8349de7..22c0f832e64a 100644 --- a/sc/qa/unit/copy_paste_test.cxx +++ b/sc/qa/unit/copy_paste_test.cxx @@ -41,6 +41,7 @@ public: void testTdf107394(); void testTdf53431_fillOnAutofilter(); void testTdf40993_fillMergedCells(); +void testTdf43958_clickSelectOnMergedCells(); CPPUNIT_TEST_SUITE(ScCopyPasteTest); CPPUNIT_TEST(testCopyPasteXLS); @@ -50,6 +51,7 @@ public: CPPUNIT_TEST(testTdf107394); CPPUNIT_TEST(testTdf53431_fillOnAutofilter); CPPUNIT_TEST(testTdf40993_fillMergedCells); +CPPUNIT_TEST(testTdf43958_clickSelectOnMergedCells); CPPUNIT_TEST_SUITE_END(); private: @@ -588,6 +590,36 @@ void ScCopyPasteTest::testTdf40993_fillMergedCells() CPPUNIT_ASSERT_EQUAL(lcl_getMergeSizeOfCell(rDoc, 3, 5, 0), ScAddress(2, 1, 0)); } +static void lcl_clickAndCheckCurrentArea(SCCOL nCol, SCROW nRow, SCCOL nCol2, SCROW nRow2) +{ +ScRange aRange; +ScDocShell::GetViewData()->SetCurX(nCol); +ScDocShell::GetViewData()->SetCurY(nRow); +ScDocShell::GetViewData()->GetSimpleArea(aRange); +CPPUNIT_ASSERT_EQUAL(aRange, ScRange(nCol, nRow, 0, nCol2, nRow2, 0)); +} + +void ScCopyPasteTest::testTdf43958_clickSelectOnMergedCells() +{ +loadDocAndSetupModelViewController("tdf40993_fillMergedCells.", FORMAT_ODS, true); + +// select cell (e.g. by clicking on it) and check what is selected [but not marked]: +// if it is the top left cell of a merged area, the selection is enlarged to the area +lcl_clickAndCheckCurrentArea(1, 5, 2, 8);// B6 -> B6:C9 +lcl_clickAndCheckCurrentArea(0, 5, 0, 6);// A6 -> A6:A7 +lcl_clickAndCheckCurrentArea(3, 5, 4, 5);// D6 -> D6:E6 +lcl_clickAndCheckCurrentArea(4, 6, 4, 7);// D7 -> D6:D7 +lcl_clickAndCheckCurrentArea(7, 10, 8, 10); // H11 -> H11:I11 +lcl_clickAndCheckCurrentArea(7, 13, 8, 13); // H14 -> H14:I14 + +// otherwise it remains the same +lcl_clickAndCheckCurrentArea(0, 7, 0, 7);// A8 +lcl_clickAndCheckCurrentArea(0, 8, 0, 8);// A9 +lcl_clickAndCheckCurrentArea(2, 6, 2, 6);// C7 +lcl_clickAndCheckCurrentArea(2, 7, 2, 7);// C8 +lcl_clickAndCheckCurrentArea(2, 8, 2, 8);// C9 +} + ScCopyPasteTest::ScCopyPasteTest() : ScBootstrapFixture( "sc/qa/unit/data" ) { diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 0fddf7862b82..0b50f90a3bfa 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1149,7 +1149,26 @@ ScMarkType ScViewData::GetSimpleArea( ScRange & rRange, ScMarkData & rNewMark ) { if (eMarkType == SC_MARK_NONE) eMarkType = SC_MARK_SIMPLE; -rRange = ScRange( GetCurX(), GetCurY(), GetTabNo() ); +const ScPatternAttr* pMarkPattern = pDoc->GetPattern(GetCurX(), GetCurY(), GetTabNo()); +if (pMarkPattern->GetItemSet().GetItemState(ATTR_MERGE, false) == SfxItemState::SET) +{ +SCROW nRow = pMarkPattern->GetItem(ATTR_MERGE).GetRowMerge(); +SCCOL nCol = pMarkPattern->GetItem(ATTR_MERGE).GetColMerge(); +if ( nRow < 1 || nCol < 1 ) +{ +// This kind of cells do exist. Not sure if that is intended or a bug. +rRange = ScRange(GetCurX(), GetCurY(), GetTabNo()); +} +else +{ +rRange = ScRange(GetCurX(), GetCurY(), GetTabNo(), +
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/copy_paste_test.cxx | 100 ++- sc/qa/unit/data/ods/tdf40993_fillMergedCells.ods |binary sc/source/core/data/table4.cxx | 60 - sc/source/ui/inc/viewfunc.hxx|3 4 files changed, 152 insertions(+), 11 deletions(-) New commits: commit 19283446adf67c3d74f41627e532a97f1856e4b8 Author: Attila Szűcs AuthorDate: Thu Sep 10 16:46:30 2020 +0200 Commit: Gabor Kelemen CommitDate: Tue Feb 23 14:19:12 2021 +0100 tdf#40993 tdf#59585 sc fill: copy merged cell structure like other spreadsheets do. This avoids losing and recreation of merged cell structure again and again after modifying cell content using fill. By dragging the fill handle, cell attributes ATTR_MERGE and ATTR_MERGE_FLAG are copied, too, resulting the same merged cell structure in the selection. See TODOs about the remaining tasks. Co-authored-by: Tibor Nagy (NISZ) Change-Id: Icd4287d4429d3ba27a2ffb062560856d7ad86099 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102394 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 1ed04c2029218619aab2f3422130c890f67f309c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111328 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx index 69557ea982c9..5580f8349de7 100644 --- a/sc/qa/unit/copy_paste_test.cxx +++ b/sc/qa/unit/copy_paste_test.cxx @@ -40,6 +40,7 @@ public: void testTdf126421(); void testTdf107394(); void testTdf53431_fillOnAutofilter(); +void testTdf40993_fillMergedCells(); CPPUNIT_TEST_SUITE(ScCopyPasteTest); CPPUNIT_TEST(testCopyPasteXLS); @@ -48,10 +49,12 @@ public: CPPUNIT_TEST(testTdf126421); CPPUNIT_TEST(testTdf107394); CPPUNIT_TEST(testTdf53431_fillOnAutofilter); +CPPUNIT_TEST(testTdf40993_fillMergedCells); CPPUNIT_TEST_SUITE_END(); private: +ScDocShellRef loadDocAndSetupModelViewController(const OUString& rFileName, sal_Int32 nFormat, bool bReadWrite); uno::Reference m_xCalcComponent; }; @@ -433,7 +436,14 @@ static ScMF lcl_getMergeFlagOfCell(const ScDocument& rDoc, SCCOL nCol, SCROW nRo return rMergeFlag.GetValue(); } -void ScCopyPasteTest::testTdf53431_fillOnAutofilter() +static ScAddress lcl_getMergeSizeOfCell(const ScDocument& rDoc, SCCOL nCol, SCROW nRow, SCTAB nTab) +{ +const SfxPoolItem& rPoolItem = rDoc.GetPattern(nCol, nRow, nTab)->GetItem(ATTR_MERGE); +const ScMergeAttr& rMerge = static_cast(rPoolItem); +return ScAddress(rMerge.GetColMerge(), rMerge.GetRowMerge(), nTab); +} + +ScDocShellRef ScCopyPasteTest::loadDocAndSetupModelViewController(const OUString& rFileName, sal_Int32 nFormat, bool bReadWrite) { uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(::comphelper::getProcessComponentContext()); CPPUNIT_ASSERT(xDesktop.is()); @@ -443,8 +453,8 @@ void ScCopyPasteTest::testTdf53431_fillOnAutofilter() CPPUNIT_ASSERT(xTargetFrame.is()); // 1. Open the document -ScDocShellRef xDocSh = loadDoc("tdf53431_autofilterFilldown.", FORMAT_ODS, true); -CPPUNIT_ASSERT_MESSAGE("Failed to load tdf53431_autofilterFilldown.ods.", xDocSh.is()); +ScDocShellRef xDocSh = loadDoc(rFileName, nFormat, bReadWrite); +CPPUNIT_ASSERT_MESSAGE(OString("Failed to load " + OUStringToOString(rFileName, RTL_TEXTENCODING_UTF8)).getStr(), xDocSh.is()); uno::Reference< frame::XModel2 > xModel2(xDocSh->GetModel(), UNO_QUERY); CPPUNIT_ASSERT(xModel2.is()); @@ -459,6 +469,12 @@ void ScCopyPasteTest::testTdf53431_fillOnAutofilter() xController->attachFrame(xTargetFrame); xModel2->setCurrentController(xController.get()); +return xDocSh; +} + +void ScCopyPasteTest::testTdf53431_fillOnAutofilter() +{ +ScDocShellRef xDocSh = loadDocAndSetupModelViewController("tdf53431_autofilterFilldown.", FORMAT_ODS, true); ScDocument& rDoc = xDocSh->GetDocument(); // Get the document controller @@ -494,6 +510,84 @@ void ScCopyPasteTest::testTdf53431_fillOnAutofilter() CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(rDoc, 0, 1, 0) & ScMF::Auto)); } +void ScCopyPasteTest::testTdf40993_fillMergedCells() +{ +ScDocShellRef xDocSh = loadDocAndSetupModelViewController("tdf40993_fillMergedCells.", FORMAT_ODS, true); +ScDocument& rDoc = xDocSh->GetDocument(); + +// Get the document controller +ScTabViewShell* pView = xDocSh->GetBestViewShell(false); +CPPUNIT_ASSERT(pView != nullptr); + +// check content of the merged cell H11:I11 +CPPUNIT_ASSERT_EQUAL(OUString("1.5"), rDoc.GetString(ScAddress(7, 10, 0))); + +// fill operation on the merged cell should clone ATTR_MERGE and ATTR_MERGE_FLAG +// (as long as ATTR_MERGE_FLAG has only ScMF::Hor or ScMF::Ver) +// +// select merged cell +
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/xlsx/textLengthDataValidity.xlsx |binary sc/qa/unit/subsequent_filters-test.cxx | 40 +++ sc/source/core/data/validat.cxx | 20 +-- 3 files changed, 56 insertions(+), 4 deletions(-) New commits: commit 5e99596e8980ebe7b6295e5cf07567a37f63ddea Author: Tibor Nagy AuthorDate: Wed Sep 9 14:23:12 2020 +0200 Commit: Gabor Kelemen CommitDate: Thu Feb 18 16:33:05 2021 +0100 tdf#128797 sc: fix invalid detective marks cells If numeric value of cell formatted as text or not and validation set up as text length > 0 to ensure cells are filled. When the detective is used to mark invalid data, the value of cells are marked as invalid. Co-authored-by: Attila Szűcs (NISZ) Change-Id: I3481a6c999871f9a5cf73669d2ac73df1fc0ca20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102322 Tested-by: Jenkins Reviewed-by: Eike Rathke (cherry picked from commit 192235e0b71dd2a75bc7de85fe664bb69283f4a0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/44 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/textLengthDataValidity.xlsx b/sc/qa/unit/data/xlsx/textLengthDataValidity.xlsx new file mode 100644 index ..a007fd9f7146 Binary files /dev/null and b/sc/qa/unit/data/xlsx/textLengthDataValidity.xlsx differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index f548a9b8e21b..7ff383a8a760 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -264,6 +264,7 @@ public: void testShapeRotationImport(); void testShapeDisplacementOnRotationImport(); void testTextBoxBodyUpright(); +void testTextLengthDataValidityXLSX(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBooleanFormatXLSX); @@ -416,6 +417,7 @@ public: CPPUNIT_TEST(testShapeRotationImport); CPPUNIT_TEST(testShapeDisplacementOnRotationImport); CPPUNIT_TEST(testTextBoxBodyUpright); +CPPUNIT_TEST(testTextLengthDataValidityXLSX); CPPUNIT_TEST_SUITE_END(); @@ -4584,6 +4586,44 @@ void ScFiltersTest::testTextBoxBodyUpright() CPPUNIT_ASSERT_EQUAL(sal_Int32(90), nAngle); } +void ScFiltersTest::testTextLengthDataValidityXLSX() +{ +ScDocShellRef xDocSh = loadDoc("textLengthDataValidity.", FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to load textLengthDataValidity.xlsx", xDocSh.is()); + +ScDocument& rDoc = xDocSh->GetDocument(); + +const ScValidationData* pData = rDoc.GetValidationEntry(1); + +ScRefCellValue aCellA1; // A1 = 1234(numeric value) +ScAddress aValBaseAddrA1( 0,0,0 ); +aCellA1.assign(rDoc, aValBaseAddrA1); +bool bValidA1 = pData->IsDataValid(aCellA1, aValBaseAddrA1); + +ScRefCellValue aCellA2; // A2 = 1234(numeric value format as text) +ScAddress aValBaseAddrA2( 0,1,0 ); +aCellA2.assign(rDoc, aValBaseAddrA2); +bool bValidA2 = pData->IsDataValid(aCellA2, aValBaseAddrA2); + +ScRefCellValue aCellA3; // A3 = 1234.00(numeric value) +ScAddress aValBaseAddrA3( 0,2,0 ); +aCellA3.assign(rDoc, aValBaseAddrA3); +bool bValidA3 = pData->IsDataValid(aCellA3, aValBaseAddrA3); + +ScRefCellValue aCellA4; // A4 = 12.3(numeric value) +ScAddress aValBaseAddrA4( 0,3,0 ); +aCellA4.assign(rDoc, aValBaseAddrA4); +bool bValidA4 = pData->IsDataValid(aCellA4, aValBaseAddrA4); + +// True if text length = 4 +CPPUNIT_ASSERT_EQUAL(true, bValidA1); +CPPUNIT_ASSERT_EQUAL(true, bValidA2); +CPPUNIT_ASSERT_EQUAL(true, bValidA3); +CPPUNIT_ASSERT_EQUAL(true, bValidA4); + +xDocSh->DoClose(); +} + ScFiltersTest::ScFiltersTest() : ScBootstrapFixture( "sc/qa/unit/data" ) { diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index e2921aaf7368..221796a9567e 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -584,14 +584,26 @@ bool ScValidationData::IsDataValid( ScRefCellValue& rCell, const ScAddress& rPos break; case SC_VALID_TEXTLEN: +{ +double nLenVal; bOk = !bIsVal; // only Text if ( bOk ) { -double nLenVal = static_cast(aString.getLength()); -ScRefCellValue aTmpCell(nLenVal); -bOk = IsCellValid(aTmpCell, rPos); +nLenVal = static_cast(aString.getLength()); } -break; +else +{ +const ScPatternAttr* pPattern += mpDoc->GetPattern(rPos.Col(), rPos.Row(), rPos.Tab()); +SvNumberFormatter* pFormatter = GetDocument()->GetFormatTable(); +sal_uInt32 nFormat = pPattern->GetNumberFormat(pFormatter); +pFormatter->GetInputLineString(nVal, nFormat, aString); +nLenVal =
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/copy_paste_test.cxx | 73 sc/qa/unit/data/ods/tdf53431_autofilterFilldown.ods |binary sc/source/core/data/documen3.cxx|5 + sc/source/ui/inc/viewfunc.hxx |3 4 files changed, 80 insertions(+), 1 deletion(-) New commits: commit 1c914b4b2d9ab2bbdde1c9c309b90832ca806d0d Author: Attila Szűcs AuthorDate: Mon Sep 7 14:36:25 2020 +0200 Commit: Gabor Kelemen CommitDate: Thu Feb 18 15:15:48 2021 +0100 tdf#53431 tdf#136535 sc: fix Fill Cells with Autofilter Sheet->Fill Cells on a selected range duplicated or removed the AutoFilter button, when the range contained that, by copying cell properties. Apply RefreshAutoFilter() after the fill to repair this. Note: this refresh is not slow, because it depends only on the number of columns, see ATTR_MERGE_FLAG attribute of the columns. Co-authored-by: Tibor Nagy (NISZ) Change-Id: I95d394c5432d22805a761b76219f656fad3feae1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102173 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 789abce00bbb1139eb4005f78b82478a17342048) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/39 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx index 71adbe5c8c8d..69557ea982c9 100644 --- a/sc/qa/unit/copy_paste_test.cxx +++ b/sc/qa/unit/copy_paste_test.cxx @@ -14,6 +14,9 @@ #include #include #include +#include +#include +#include #include #include @@ -36,6 +39,7 @@ public: void testTdf124565(); void testTdf126421(); void testTdf107394(); +void testTdf53431_fillOnAutofilter(); CPPUNIT_TEST_SUITE(ScCopyPasteTest); CPPUNIT_TEST(testCopyPasteXLS); @@ -43,6 +47,7 @@ public: CPPUNIT_TEST(testTdf124565); CPPUNIT_TEST(testTdf126421); CPPUNIT_TEST(testTdf107394); +CPPUNIT_TEST(testTdf53431_fillOnAutofilter); CPPUNIT_TEST_SUITE_END(); private: @@ -421,6 +426,74 @@ void ScCopyPasteTest::testTdf107394() xComponent->dispose(); } +static ScMF lcl_getMergeFlagOfCell(const ScDocument& rDoc, SCCOL nCol, SCROW nRow, SCTAB nTab) +{ +const SfxPoolItem& rPoolItem = rDoc.GetPattern(nCol, nRow, nTab)->GetItem(ATTR_MERGE_FLAG); +const ScMergeFlagAttr& rMergeFlag = static_cast(rPoolItem); +return rMergeFlag.GetValue(); +} + +void ScCopyPasteTest::testTdf53431_fillOnAutofilter() +{ +uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(::comphelper::getProcessComponentContext()); +CPPUNIT_ASSERT(xDesktop.is()); + +// create a frame +Reference< frame::XFrame > xTargetFrame = xDesktop->findFrame("_blank", 0); +CPPUNIT_ASSERT(xTargetFrame.is()); + +// 1. Open the document +ScDocShellRef xDocSh = loadDoc("tdf53431_autofilterFilldown.", FORMAT_ODS, true); +CPPUNIT_ASSERT_MESSAGE("Failed to load tdf53431_autofilterFilldown.ods.", xDocSh.is()); + +uno::Reference< frame::XModel2 > xModel2(xDocSh->GetModel(), UNO_QUERY); +CPPUNIT_ASSERT(xModel2.is()); + +Reference< frame::XController2 > xController = xModel2->createDefaultViewController(xTargetFrame); +CPPUNIT_ASSERT(xController.is()); + +// introduce model/view/controller to each other +xController->attachModel(xModel2.get()); +xModel2->connectController(xController.get()); +xTargetFrame->setComponent(xController->getComponentWindow(), xController.get()); +xController->attachFrame(xTargetFrame); +xModel2->setCurrentController(xController.get()); + +ScDocument& rDoc = xDocSh->GetDocument(); + +// Get the document controller +ScTabViewShell* pView = xDocSh->GetBestViewShell(false); +CPPUNIT_ASSERT(pView != nullptr); + +//Fill should not clone Autofilter button +ScDocShell::GetViewData()->GetMarkData().SetMarkArea(ScRange(1, 1, 0, 2, 4, 0)); +pView->FillSimple(FILL_TO_BOTTOM); +CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(rDoc, 1, 1, 0) & ScMF::Auto)); +CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(rDoc, 2, 1, 0) & ScMF::Auto)); +CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(rDoc, 1, 4, 0) & ScMF::Auto)); + +ScDocShell::GetViewData()->GetMarkData().SetMarkArea(ScRange(1, 1, 0, 4, 4, 0)); +pView->FillSimple(FILL_TO_RIGHT); +CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(rDoc, 1, 1, 0) & ScMF::Auto)); +CPPUNIT_ASSERT((lcl_getMergeFlagOfCell(rDoc, 2, 1, 0) & ScMF::Auto)); +CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(rDoc, 4, 1, 0) & ScMF::Auto)); +CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(rDoc, 1, 4, 0) & ScMF::Auto)); +CPPUNIT_ASSERT(!(lcl_getMergeFlagOfCell(rDoc, 4, 4, 0) & ScMF::Auto)); + +//Fill should not delete Autofilter buttons +ScDocShell::GetViewData()->GetMarkData().SetMarkArea(ScRange(0, 0, 0, 2, 4, 0)); +pView->FillSimple(FILL_TO_TOP); +
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/ods/tdf121718_UseFirstPageNumber.ods |binary sc/qa/unit/subsequent_export-test.cxx| 27 +++ sc/source/filter/excel/xepage.cxx|8 - 3 files changed, 33 insertions(+), 2 deletions(-) New commits: commit de14b8ad2cabf857c510d78e6d21a0ab1fb84b9e Author: Attila Szűcs AuthorDate: Thu Aug 6 10:35:06 2020 +0200 Commit: Gabor Kelemen CommitDate: Thu Feb 18 12:18:58 2021 +0100 tdf#121718 XLSX export: fix first page number Changed code to not save 'useFirstPageNumber' and 'firstPageNumber' if "First page number" is not checked. It was needed because Excel does not care about 'useFirstPageNumber', and blindly load 'firstPageNumber' even if that had an invalid value (that could happen when useFirstPageNumber==false). Co-authored-by: Tibor Nagy (NISZ) Change-Id: I69c9ed0fd4fdca1794d4bbc197713ac687eb4005 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100203 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 790c0aeab258f770eb94f2d2cceceebfeaceb825) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/33 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/ods/tdf121718_UseFirstPageNumber.ods b/sc/qa/unit/data/ods/tdf121718_UseFirstPageNumber.ods new file mode 100644 index ..0726e4cb1edc Binary files /dev/null and b/sc/qa/unit/data/ods/tdf121718_UseFirstPageNumber.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index e84a464ab886..d387221d4156 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -260,6 +260,7 @@ public: void testTdf121716_ExportEvenHeaderFooterXLSX(); void testTdf134459_HeaderFooterColorXLSX(); void testTdf134817_HeaderFooterTextWith2SectionXLSX(); +void testTdf121718_UseFirstPageNumberXLSX(); void testHeaderFontStyleXLSX(); void testTdf135828_Shape_Rect(); void testTdf123353(); @@ -418,6 +419,7 @@ public: CPPUNIT_TEST(testTdf121716_ExportEvenHeaderFooterXLSX); CPPUNIT_TEST(testTdf134817_HeaderFooterTextWith2SectionXLSX); CPPUNIT_TEST(testTdf134459_HeaderFooterColorXLSX); +CPPUNIT_TEST(testTdf121718_UseFirstPageNumberXLSX); CPPUNIT_TEST(testHeaderFontStyleXLSX); CPPUNIT_TEST(testTdf135828_Shape_Rect); CPPUNIT_TEST(testTdf123353); @@ -5267,6 +5269,31 @@ void ScExportTest::testTdf134817_HeaderFooterTextWith2SectionXLSX() xDocSh->DoClose(); } +void ScExportTest::testTdf121718_UseFirstPageNumberXLSX() +{ +// If "First page number" is not checked then useFirstPageNumb, and firstPageNumber should not be exported. +ScDocShellRef xShell = loadDoc("tdf121718_UseFirstPageNumber.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.is()); + +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); +xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pDoc); + +assertXPath(pDoc, "/x:worksheet/x:pageSetup", "useFirstPageNumber", "true"); +assertXPath(pDoc, "/x:worksheet/x:pageSetup", "firstPageNumber", "10"); + +pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet2.xml"); +CPPUNIT_ASSERT(pDoc); + +assertXPathNoAttribute(pDoc, "/x:worksheet/x:pageSetup", "useFirstPageNumber"); +assertXPathNoAttribute(pDoc, "/x:worksheet/x:pageSetup", "firstPageNumber"); + +xDocSh->DoClose(); +} + void ScExportTest::testHeaderFontStyleXLSX() { ScDocShellRef xShell = loadDoc("tdf134826.", FORMAT_XLSX); diff --git a/sc/source/filter/excel/xepage.cxx b/sc/source/filter/excel/xepage.cxx index 3941bd191f92..64d671a3acba 100644 --- a/sc/source/filter/excel/xepage.cxx +++ b/sc/source/filter/excel/xepage.cxx @@ -107,7 +107,6 @@ void XclExpSetup::SaveXml( XclExpXmlStream& rStrm ) // pAttrList->add( XML_paperUnits, "mm" ); } pAttrList->add( XML_scale, OString::number( mrData.mnScaling ).getStr() ); -pAttrList->add( XML_firstPageNumber,OString::number( mrData.mnStartPage ).getStr() ); pAttrList->add( XML_fitToWidth, OString::number( mrData.mnFitToWidth ).getStr() ); pAttrList->add( XML_fitToHeight,OString::number( mrData.mnFitToHeight ).getStr() ); pAttrList->add( XML_pageOrder, mrData.mbPrintInRows ? "overThenDown" : "downThenOver" ); @@ -119,7 +118,12 @@ void XclExpSetup::SaveXml( XclExpXmlStream& rStrm ) pAttrList->add( XML_blackAndWhite, ToPsz( mrData.mbBlackWhite ) ); pAttrList->add( XML_draft, ToPsz( mrData.mbDraftQuality ) ); pAttrList->add( XML_cellComments, mrData.mbPrintNotes ? "atEnd" : "none" );
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/ods/tdf121716_EvenHeaderFooter.ods |binary sc/qa/unit/subsequent_export-test.cxx | 52 ++--- sc/source/filter/excel/xepage.cxx | 49 +-- sc/source/filter/excel/xipage.cxx |8 ++- sc/source/filter/excel/xlpage.cxx |3 + sc/source/filter/inc/xlpage.hxx|9 +++ 6 files changed, 106 insertions(+), 15 deletions(-) New commits: commit 74ff90587db28aa199fdbcae0abb7f37f83fb617 Author: Attila Szűcs AuthorDate: Thu Jul 23 14:51:01 2020 +0200 Commit: Gabor Kelemen CommitDate: Thu Feb 18 10:36:27 2021 +0100 tdf#121716 XLSX export: fix loss of left header (footer) when footer (header) is shared (even). Co-authored-by: Tibor Nagy (NISZ) Change-Id: I6e656f2df1f9b6522af933bd1c71b8d60bbfe19f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99315 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit a858284092e976fa284d5ed118e366d9860ec9bb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111048 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/ods/tdf121716_EvenHeaderFooter.ods b/sc/qa/unit/data/ods/tdf121716_EvenHeaderFooter.ods new file mode 100644 index ..2666a9d4291e Binary files /dev/null and b/sc/qa/unit/data/ods/tdf121716_EvenHeaderFooter.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 56f38a3697a9..e84a464ab886 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -257,8 +257,9 @@ public: void testTdf131372(); void testTdf122331(); void testTdf83779(); -void testTdf134817_HeaderFooterTextWith2SectionXLSX(); +void testTdf121716_ExportEvenHeaderFooterXLSX(); void testTdf134459_HeaderFooterColorXLSX(); +void testTdf134817_HeaderFooterTextWith2SectionXLSX(); void testHeaderFontStyleXLSX(); void testTdf135828_Shape_Rect(); void testTdf123353(); @@ -414,6 +415,7 @@ public: CPPUNIT_TEST(testTdf131372); CPPUNIT_TEST(testTdf122331); CPPUNIT_TEST(testTdf83779); +CPPUNIT_TEST(testTdf121716_ExportEvenHeaderFooterXLSX); CPPUNIT_TEST(testTdf134817_HeaderFooterTextWith2SectionXLSX); CPPUNIT_TEST(testTdf134459_HeaderFooterColorXLSX); CPPUNIT_TEST(testHeaderFontStyleXLSX); @@ -5195,20 +5197,36 @@ void ScExportTest::testTdf83779() xShell->DoClose(); } -void ScExportTest::testTdf134817_HeaderFooterTextWith2SectionXLSX() +void ScExportTest::testTdf121716_ExportEvenHeaderFooterXLSX() { -// Header/footer text with multiple selection should be exported, and imported properly -ScDocShellRef xShell = loadDoc("tdf134817_HeaderFooterTextWith2Section.", FORMAT_XLSX); +// Header and footer on even pages should be exported properly +// If there are separate odd/even header, but only 1 footer for all pages (this is possible only in LibreOffice) +// then the footer will be duplicated to have the same footer separately for even/odd pages + +ScDocShellRef xShell = loadDoc("tdf121716_EvenHeaderFooter.", FORMAT_ODS); CPPUNIT_ASSERT(xShell.is()); ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); -xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); +xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); -assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddHeader", "&\"Abadi,Regular\"&11aaa&\"Bembo,Regular\"&20bbb"); -assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter", "&\"Cambria,Regular\"&14camb&\"Dante,Regular\"&18dant"); +assertXPath(pDoc, "/x:worksheet/x:headerFooter", "differentOddEven", "true"); +assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddHeader", "/right"); +assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter", "&12page"); +assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:evenHeader", "/left"); +assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:evenFooter", "&12page"); + +pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet2.xml"); +CPPUNIT_ASSERT(pDoc); + +assertXPath(pDoc, "/x:worksheet/x:headerFooter", "differentOddEven", "true"); +assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddHeader", ""); +assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter", ""); +assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:evenHeader", ""); +assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:evenFooter", ""); xDocSh->DoClose(); } @@ -5227,6
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf123353.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 21 + sc/source/filter/excel/excrecds.cxx | 12 ++-- sc/source/filter/inc/excrecds.hxx |2 +- 4 files changed, 32 insertions(+), 3 deletions(-) New commits: commit 6a2f504986d1947d6f14f8dcb653d7c46f5ca464 Author: Tibor Nagy AuthorDate: Tue Sep 1 13:55:25 2020 +0200 Commit: Gabor Kelemen CommitDate: Wed Jan 6 16:31:55 2021 +0100 tdf#123353 XLSX export: fix lost AutoFilter on empty cells The AutoFilter button was lost during export when only the rows with empty cells were visible and everything else was hidden. The filter itself was still active, but the button itself was gone. Co-authored-by: Attila Szűcs (NISZ) Change-Id: Ia0b16bf4f15303d1320081cb62090368a0ce3908 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101847 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 487df0c8f307500029b06c89985a1148ebc784b5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108892 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/tdf123353.xlsx b/sc/qa/unit/data/xlsx/tdf123353.xlsx new file mode 100644 index ..f37f0724ca98 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf123353.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 316af342f200..38231f8dab98 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -261,6 +261,7 @@ public: void testTdf134459_HeaderFooterColorXLSX(); void testHeaderFontStyleXLSX(); void testTdf135828_Shape_Rect(); +void testTdf123353(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -416,6 +417,7 @@ public: CPPUNIT_TEST(testTdf134459_HeaderFooterColorXLSX); CPPUNIT_TEST(testHeaderFontStyleXLSX); CPPUNIT_TEST(testTdf135828_Shape_Rect); +CPPUNIT_TEST(testTdf123353); CPPUNIT_TEST_SUITE_END(); @@ -5266,6 +5268,7 @@ void ScExportTest::testTdf135828_Shape_Rect() CPPUNIT_ASSERT(xDocSh.is()); std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); + xmlDocUniquePtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDrawing); @@ -5273,6 +5276,24 @@ void ScExportTest::testTdf135828_Shape_Rect() assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cy", "1990440"); // height } +void ScExportTest::testTdf123353() +{ +ScDocShellRef xShell = loadDoc("tdf123353.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); + +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); + +xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pDoc); + +assertXPath(pDoc, "/x:worksheet/x:autoFilter/x:filterColumn/x:filters", "blank", "1"); + +xShell->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index b8e1e375e3d8..ce6b05970e6d 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -651,9 +651,12 @@ bool XclExpAutofilter::HasCondition() const bool XclExpAutofilter::AddEntry( const ScQueryEntry& rEntry ) { const ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems(); -if (rItems.empty()) -return true; +if (GetOutput() != EXC_OUTPUT_BINARY && rItems.empty()) +{ +meType = BlankValue; +return false; +} if (GetOutput() != EXC_OUTPUT_BINARY && rItems.size() > 1) { AddMultiValueEntry(rEntry); @@ -819,6 +822,11 @@ void XclExpAutofilter::SaveXml( XclExpXmlStream& rStrm ) // XML_extLst, XML_filters, XML_iconFilter, XML_top10 } break; +case BlankValue: +{ +rWorksheet->singleElement(XML_filters, XML_blank, "1"); +} +break; case MultiValue: { rWorksheet->startElement(XML_filters); diff --git a/sc/source/filter/inc/excrecds.hxx b/sc/source/filter/inc/excrecds.hxx index 20c9425822f1..986654fbd335 100644 --- a/sc/source/filter/inc/excrecds.hxx +++ b/sc/source/filter/inc/excrecds.hxx @@ -361,7 +361,7 @@ public: class XclExpAutofilter : public XclExpRecord, protected XclExpRoot { private: -enum FilterType { FilterCondition, MultiValue }; +enum FilterType { FilterCondition, MultiValue, BlankValue }; FilterType meType; sal_uInt16 nCol; sal_uInt16 nFlags; ___
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf135828_Shape_Rect.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 20 sc/source/filter/xcl97/xcl97rec.cxx| 19 +++ 3 files changed, 39 insertions(+) New commits: commit 20a87f9607317c223070f4c884c8ae654430cff1 Author: Szabolcs Toth AuthorDate: Mon Aug 17 10:55:43 2020 +0200 Commit: Gabor Kelemen CommitDate: Wed Jan 6 14:56:05 2021 +0100 tdf#135828 XLSX shape export: fix distortion of rotated shapes Shapes that were rotated at angles {[45, 135) U [225, 315)} need new anchor positions that does an extra 90 degrees rotation. See commit 130e6a3f4493b987a7d0b177cc84d65219b47d13 (tdf#83593 XLSX DrawingML shape import: fix missing rotation) Co-authored-by: Balázs Regényi Change-Id: I42a5d203cf3b6f6e725d84dd5f39ac323f4f1ceb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100853 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 5e8875780d665b7ae0fee1a053b5ce78ec513f69) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108866 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/tdf135828_Shape_Rect.xlsx b/sc/qa/unit/data/xlsx/tdf135828_Shape_Rect.xlsx new file mode 100644 index ..c01c81ab6d74 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf135828_Shape_Rect.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 895754f5e780..316af342f200 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -260,6 +260,7 @@ public: void testTdf134817_HeaderFooterTextWith2SectionXLSX(); void testTdf134459_HeaderFooterColorXLSX(); void testHeaderFontStyleXLSX(); +void testTdf135828_Shape_Rect(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -414,6 +415,7 @@ public: CPPUNIT_TEST(testTdf134817_HeaderFooterTextWith2SectionXLSX); CPPUNIT_TEST(testTdf134459_HeaderFooterColorXLSX); CPPUNIT_TEST(testHeaderFontStyleXLSX); +CPPUNIT_TEST(testTdf135828_Shape_Rect); CPPUNIT_TEST_SUITE_END(); @@ -5253,6 +5255,24 @@ void ScExportTest::testHeaderFontStyleXLSX() xShell->DoClose(); } +void ScExportTest::testTdf135828_Shape_Rect() +{ +// tdf#135828 Check that the width and the height of rectangle of the shape +// is correct. +ScDocShellRef xShell = loadDoc("tdf135828_Shape_Rect.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); + +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); +xmlDocUniquePtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); +CPPUNIT_ASSERT(pDrawing); + +assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cx", "294480"); // width +assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cy", "1990440"); // height +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index d4f6eae65344..6c05b87e871c 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1100,6 +1100,25 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& awt::Point aTopLeft= rShape->getPosition(); awt::Size aSize = rShape->getSize(); + +uno::Reference< beans::XPropertySet > xShapeProperties(rShape, uno::UNO_QUERY_THROW); +uno::Any nRotProp = xShapeProperties->getPropertyValue("RotateAngle"); +sal_Int32 nRot = nRotProp.get(); + +if ((nRot >= 45 * 100 && nRot < 135 * 100) || (nRot >= 225 * 100 && nRot < 315 * 100)) +{ +// MSO changes the anchor positions at these angles and that does an extra 90 degrees +// rotation on our shapes, so we output it in such position that MSO +// can draw this shape correctly. + +sal_Int16 nHalfWidth = aSize.Width / 2; +sal_Int16 nHalfHeight = aSize.Height / 2; +aTopLeft.X = aTopLeft.X - nHalfHeight + nHalfWidth; +aTopLeft.Y = aTopLeft.Y - nHalfWidth + nHalfHeight; + +std::swap(aSize.Width, aSize.Height); +} + tools::Rectangle aLocation( aTopLeft.X, aTopLeft.Y, aTopLeft.X + aSize.Width, aTopLeft.Y + aSize.Height ); ScRange aRange = rStrm.GetRoot().GetDoc().GetRange( nTab, aLocation ); tools::Rectangle aRangeRect = rStrm.GetRoot().GetDoc().GetMMRect( aRange.aStart.Col(), aRange.aStart.Row(), ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/xlsx/testShapeDisplacementOnRotationImport.xlsx |binary sc/qa/unit/subsequent_filters-test.cxx | 19 ++ sc/source/filter/oox/drawingfragment.cxx|8 ++-- 3 files changed, 24 insertions(+), 3 deletions(-) New commits: commit f7413d0c1b5741adf97c40f755a069afc551578a Author: Regényi Balázs AuthorDate: Wed Aug 19 15:32:54 2020 +0200 Commit: Gabor Kelemen CommitDate: Wed Jan 6 14:43:18 2021 +0100 tdf#135918 XLSX DrawingML shape import: fix needless displacement Shape was displaced on rotation if it is placed next to the sheets upper/left edges. Co-authored-by: Szabolcs Tóth Change-Id: I987e7b0d863b89cfb5d8154e2f0a017e21248ee1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101001 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 3e85b22769a4b02744a7006d7dc772973c0093f5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108865 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/testShapeDisplacementOnRotationImport.xlsx b/sc/qa/unit/data/xlsx/testShapeDisplacementOnRotationImport.xlsx new file mode 100644 index ..a5fcd1ce2fbd Binary files /dev/null and b/sc/qa/unit/data/xlsx/testShapeDisplacementOnRotationImport.xlsx differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index a8229d26d158..16a38a862121 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -262,6 +262,7 @@ public: void testXLSDefColWidth(); void testPreviewMissingObjLink(); void testShapeRotationImport(); +void testShapeDisplacementOnRotationImport(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBooleanFormatXLSX); @@ -412,6 +413,7 @@ public: CPPUNIT_TEST(testXLSDefColWidth); CPPUNIT_TEST(testPreviewMissingObjLink); CPPUNIT_TEST(testShapeRotationImport); +CPPUNIT_TEST(testShapeDisplacementOnRotationImport); CPPUNIT_TEST_SUITE_END(); @@ -4520,6 +4522,23 @@ void ScFiltersTest::testShapeRotationImport() } } +void ScFiltersTest::testShapeDisplacementOnRotationImport() +{ +// tdf#135918 shape is displaced on rotation if it is placed next to the sheets upper/left edges +ScDocShellRef xDocSh = loadDoc("testShapeDisplacementOnRotationImport.", FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to load testShapeDisplacementOnRotationImport.xlsx", xDocSh.is()); + +uno::Reference xDoc(xDocSh->GetModel(), uno::UNO_QUERY_THROW); +uno::Reference xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW); +uno::Reference xShape(xPage->getByIndex(0), uno::UNO_QUERY_THROW); + +uno::Reference xShapeProperties(xShape, uno::UNO_QUERY_THROW); +uno::Any aRectProp = xShapeProperties->getPropertyValue("FrameRect"); +awt::Rectangle aRectangle = aRectProp.get(); +CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aRectangle.X); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aRectangle.Y); +} + ScFiltersTest::ScFiltersTest() : ScBootstrapFixture( "sc/qa/unit/data" ) { diff --git a/sc/source/filter/oox/drawingfragment.cxx b/sc/source/filter/oox/drawingfragment.cxx index 396170be35e3..b726ea9479ad 100644 --- a/sc/source/filter/oox/drawingfragment.cxx +++ b/sc/source/filter/oox/drawingfragment.cxx @@ -295,9 +295,11 @@ void DrawingFragment::onEndElement() } // TODO: DrawingML implementation expects 32-bit coordinates for EMU rectangles (change that to EmuRectangle) +// tdf#135918: Negative X,Y position has to be allowed to avoid shape displacement on rotation. +// The negative values can exist because of previous lines where the anchor rectangle must be mirrored in some ranges. Rectangle aShapeRectEmu32( -getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.X, 0, SAL_MAX_INT32 ), -getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Y, 0, SAL_MAX_INT32 ), +getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.X, SAL_MIN_INT32, SAL_MAX_INT32 ), +getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Y, SAL_MIN_INT32, SAL_MAX_INT32 ), getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Width, 0, SAL_MAX_INT32 ), getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Height, 0, SAL_MAX_INT32 ) ); @@ -314,7 +316,7 @@ void DrawingFragment::onEndElement() /* Collect all shape positions in the WorksheetHelper base class. But first, scale EMUs to 1/100 mm. */ Rectangle aShapeRectHmm( -convertEmuToHmm(aShapeRectEmu32.X ), convertEmuToHmm(aShapeRectEmu32.Y ), +
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf134826.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 31 +++ sc/source/filter/oox/pagesettings.cxx |6 -- 3 files changed, 35 insertions(+), 2 deletions(-) New commits: commit cf577bb6f6f6bf43fa503c08fff8dba3c44f5aa8 Author: Tibor Nagy AuthorDate: Fri Jul 17 13:23:41 2020 +0200 Commit: Gabor Kelemen CommitDate: Wed Jan 6 12:14:39 2021 +0100 tdf#134826 XLSX import: extend localized bold/italic footer/header OOXML formatting code support with Hungarian "félkövér" (semibold) and "dőlt" (italic), similar to German, according to formatting code standard of OOXML 18.3.1.46 headerFooter (Header Footer Settings): "Both font-name and font-type can be localized values." Co-authored-by: Attila Szűcs (NISZ) Change-Id: I95de548fe27d4a6c4e9504dc1f746c8d4419222b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99016 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 055735fa8589670f67e016bc3b7835d4cf81641f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108858 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/tdf134826.xlsx b/sc/qa/unit/data/xlsx/tdf134826.xlsx new file mode 100644 index ..dd86afea2cd5 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf134826.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index a37f89d19f6a..895754f5e780 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -259,6 +259,7 @@ public: void testTdf83779(); void testTdf134817_HeaderFooterTextWith2SectionXLSX(); void testTdf134459_HeaderFooterColorXLSX(); +void testHeaderFontStyleXLSX(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -412,6 +413,7 @@ public: CPPUNIT_TEST(testTdf83779); CPPUNIT_TEST(testTdf134817_HeaderFooterTextWith2SectionXLSX); CPPUNIT_TEST(testTdf134459_HeaderFooterColorXLSX); +CPPUNIT_TEST(testHeaderFontStyleXLSX); CPPUNIT_TEST_SUITE_END(); @@ -5219,7 +5221,36 @@ void ScExportTest::testTdf134459_HeaderFooterColorXLSX() assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddHeader", ""); assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter", ""); +} + +void ScExportTest::testHeaderFontStyleXLSX() +{ +ScDocShellRef xShell = loadDoc("tdf134826.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); +ScDocument& rDoc = xShell->GetDocument(); +SfxStyleSheetBase* pStyleSheet = rDoc.GetStyleSheetPool()->Find(rDoc.GetPageStyle(0), SfxStyleFamily::Page); +const SfxItemSet& rItemSet = pStyleSheet->GetItemSet(); +const ScPageHFItem& rHFItem = rItemSet.Get(ATTR_PAGE_HEADERRIGHT); +const EditTextObject* pTextObj = rHFItem.GetLeftArea(); + +std::vector rLst; + +// first line is bold. +pTextObj->GetCharAttribs(0, rLst); +bool bHasBold = std::any_of(rLst.begin(), rLst.end(), [](const EECharAttrib& rAttrib) { +return rAttrib.pAttr->Which() == EE_CHAR_WEIGHT && +static_cast(*rAttrib.pAttr).GetWeight() == WEIGHT_BOLD; }); +CPPUNIT_ASSERT_MESSAGE("First line should be bold.", bHasBold); + +// second line is italic. +pTextObj->GetCharAttribs(1, rLst); +bool bHasItalic = std::any_of(rLst.begin(), rLst.end(), [](const EECharAttrib& rAttrib) { +return rAttrib.pAttr->Which() == EE_CHAR_ITALIC && +static_cast(*rAttrib.pAttr).GetPosture() == ITALIC_NORMAL; }); +CPPUNIT_ASSERT_MESSAGE("Second line should be italic.", bHasItalic); + +xShell->DoClose(); } CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx index 461af3e85599..7aa952821d3b 100644 --- a/sc/source/filter/oox/pagesettings.cxx +++ b/sc/source/filter/oox/pagesettings.cxx @@ -453,7 +453,8 @@ static const char* const sppcBoldNames[] = "demibold", "halbfett", // German 'demibold' "black", -"heavy" +"heavy", +"f\303\251lk\303\266v\303\251r" // Hungarian 'bold' }; // different names for italic font style (lowercase) @@ -463,7 +464,8 @@ static const char* const sppcItalicNames[] = "kursiv", // German 'italic' "oblique", "schr\303\204g",// German 'oblique' with uppercase A umlaut -"schr\303\244g" // German 'oblique' with lowercase A umlaut +"schr\303\244g",// German 'oblique' with lowercase A umlaut +"d\305\221lt" // Hungarian 'italic' }; } // namespace ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf134459_HeaderFooterColor.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 19 ++ sc/source/filter/excel/xehelper.cxx |7 ++ 3 files changed, 26 insertions(+) New commits: commit a6b993edc19890a082216407e81ebb9a41fa30d6 Author: Attila Szűcs AuthorDate: Thu Jul 16 09:34:31 2020 +0200 Commit: Gabor Kelemen CommitDate: Wed Jan 6 10:25:56 2021 +0100 tdf#134459 XLSX export: fix missing font color in header/footer Co-authored-by: Tibor Nagy (NISZ) Change-Id: I7aacbad1c4052b2480630d0b98175b46cf2aeed0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98873 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 2abaaf97e95bf6149378c6cd5e58cdb2ce78dc4b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108852 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/tdf134459_HeaderFooterColor.xlsx b/sc/qa/unit/data/xlsx/tdf134459_HeaderFooterColor.xlsx new file mode 100644 index ..fe799886c062 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf134459_HeaderFooterColor.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 9647d0964277..a37f89d19f6a 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -258,6 +258,7 @@ public: void testTdf122331(); void testTdf83779(); void testTdf134817_HeaderFooterTextWith2SectionXLSX(); +void testTdf134459_HeaderFooterColorXLSX(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -410,6 +411,7 @@ public: CPPUNIT_TEST(testTdf122331); CPPUNIT_TEST(testTdf83779); CPPUNIT_TEST(testTdf134817_HeaderFooterTextWith2SectionXLSX); +CPPUNIT_TEST(testTdf134459_HeaderFooterColorXLSX); CPPUNIT_TEST_SUITE_END(); @@ -5203,6 +5205,23 @@ void ScExportTest::testTdf134817_HeaderFooterTextWith2SectionXLSX() xDocSh->DoClose(); } +void ScExportTest::testTdf134459_HeaderFooterColorXLSX() +{ +// Colors in header and footer should be exported, and imported properly +ScDocShellRef xShell = loadDoc("tdf134459_HeaderFooterColor.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); + +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); +CPPUNIT_ASSERT(pDoc); + +assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddHeader", ""); +assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter", ""); + +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index 88dcabe1b58f..9bb3d905f1e3 100644 --- a/sc/source/filter/excel/xehelper.cxx +++ b/sc/source/filter/excel/xehelper.cxx @@ -780,6 +780,13 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico (nTmpUnderl == EXC_FONTUNDERL_SINGLE)? aParaText.append("") : aParaText.append(""); } +// font color +aNewData.maColor = aFont.GetColor(); +if ( !aFontData.maColor.IsRGBEqual( aNewData.maColor ) ) +{ + aParaText.append("").append(aNewData.maColor.AsRGBHexString()); +} + // strikeout aNewData.mbStrikeout = (aFont.GetStrikeout() != STRIKEOUT_NONE); if( aFontData.mbStrikeout != aNewData.mbStrikeout ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits