core.git: sc/qa sc/source
sc/qa/unit/uicalc/uicalc.cxx | 39 +++ sc/source/core/data/document.cxx |8 +++- 2 files changed, 46 insertions(+), 1 deletion(-) New commits: commit 9a2c38530dd5e479a96953980ee7f6c448dce87a Author: Andreas Heinisch AuthorDate: Thu Sep 26 10:31:41 2024 +0200 Commit: Andreas Heinisch CommitDate: Fri Oct 4 18:56:08 2024 +0200 tdf#163019 - Remove the formula of a cell during paste special Remove the formula of a cell during paste special and not only the required for insertion. Otherwise, the formula listeners are not updated correctly leading to a crash during the repaint process. Change-Id: I4bf1410ecc7b25e36e1cc91bc0cd5335decb1cae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173975 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 68a4289417af..76d55137e98b 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -2311,6 +2311,45 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf141440) CPPUNIT_ASSERT_EQUAL(u"Note in A1"_ustr, pDoc->GetNote(ScAddress(0, 0, 0))->GetText()); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf163019) +{ +createScDoc(); +ScDocument* pDoc = getScDoc(); + +// Disable replace cell warning +ScModule* pMod = SC_MOD(); +ScInputOptions aInputOption = pMod->GetInputOptions(); +bool bOldStatus = aInputOption.GetReplaceCellsWarn(); +aInputOption.SetReplaceCellsWarn(false); +pMod->SetInputOptions(aInputOption); + +// Insert test data and formulas to create a sample crash document +insertStringToCell(u"B1"_ustr, u"1"); +insertStringToCell(u"A2"_ustr, u"1"); +insertStringToCell(u"A3"_ustr, u"1"); +insertStringToCell(u"B2"_ustr, u"=B1-A2"); +insertStringToCell(u"B3"_ustr, u"=B2-A3"); + +// Copy content from B2 to B2 using paste special command as a number (Flags ) +goToCell(u"B2"_ustr); +dispatchCommand(mxComponent, u".uno:Copy"_ustr, {}); +goToCell(u"B2"_ustr); +uno::Sequence aArgs = comphelper::InitPropertySequence( +{ { "Flags", uno::Any(u"V"_ustr) }, + { "FormulaCommand", uno::Any(sal_uInt16(ScPasteFunc::NONE)) }, + { "SkipEmptyCells", uno::Any(false) }, + { "Transpose", uno::Any(false) }, + { "AsLink", uno::Any(false) }, + { "MoveMode", uno::Any(sal_uInt16(InsCellCmd::INS_NONE)) } }); +// Without the fix in place, this test would have crashed here +dispatchCommand(mxComponent, u".uno:InsertContents"_ustr, aArgs); +CPPUNIT_ASSERT_EQUAL(u"0"_ustr, pDoc->GetString(ScAddress(1, 1, 0))); + +// Restore previous replace cell warning status +aInputOption.SetReplaceCellsWarn(bOldStatus); +pMod->SetInputOptions(aInputOption); +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf158551) { createScDoc(); diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index bbce2d15031b..f1ff4241413d 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2899,7 +2899,13 @@ void ScDocument::CopyFromClip( these cells. In this case, just delete old notes from the destination area. */ InsertDeleteFlags nDelFlag = nInsFlag; -if ( (nInsFlag & (InsertDeleteFlags::CONTENTS | InsertDeleteFlags::ADDNOTES)) == (InsertDeleteFlags::NOTE | InsertDeleteFlags::ADDNOTES) ) +// tdf#163019 - remove formula of the cell to update formula listeners +if (nInsFlag & InsertDeleteFlags::CONTENTS) +nDelFlag |= InsertDeleteFlags::FORMULA; + +// tdf#161189 - remove the note deletion flag if no notes are included +if ((nInsFlag & (InsertDeleteFlags::CONTENTS | InsertDeleteFlags::ADDNOTES)) +== (InsertDeleteFlags::NOTE | InsertDeleteFlags::ADDNOTES)) nDelFlag &= ~InsertDeleteFlags::NOTE; if (nInsFlag & InsertDeleteFlags::ATTRIB)
core.git: sc/qa sc/source
dev/null |binary sc/qa/unit/subsequent_export_test.cxx | 27 --- sc/qa/unit/subsequent_export_test3.cxx |6 +- sc/qa/unit/subsequent_export_test4.cxx | 10 ++ sc/source/filter/excel/xestyle.cxx |2 +- sc/source/filter/excel/xetable.cxx |2 +- 6 files changed, 17 insertions(+), 30 deletions(-) New commits: commit dafb629f4f5739e326fdf6b3f072fe139ed27c3b Author: Justin Luth AuthorDate: Wed Oct 2 19:17:46 2024 -0400 Commit: Justin Luth CommitDate: Thu Oct 3 03:05:05 2024 +0200 tdf#161453 tdf#158252 tdf#159690 Revert "sc: Fix wrapText ... ...not being applied correctly on export" This reverts 24.2 commit 1760ee4d328cfb6ba22a5b3c84016625b12adb25 which was presumably made for tdf#158460. There are two bug reports in QA statistics - Regressions with most dups that relate to the chain of commits started by this patch. So just revert everything and let any initial fixes start again fresh. make CppunitTest_sc_subsequent_export_test3 \ CPPUNIT_TEST_NAME=testCustomXml make CppunitTest_sc_subsequent_export_test4 \ CPPUNIT_TEST_NAME=testTdf152980 Change-Id: I3df533daa67dfec0080c99dcdc2f593b1b6da8f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174401 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sc/qa/unit/data/xlsx/wrap-text.xlsx b/sc/qa/unit/data/xlsx/wrap-text.xlsx deleted file mode 100644 index 961cfcbdc02e.. Binary files a/sc/qa/unit/data/xlsx/wrap-text.xlsx and /dev/null differ diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx index 7adb5e90bf34..9472fcca9993 100644 --- a/sc/qa/unit/subsequent_export_test.cxx +++ b/sc/qa/unit/subsequent_export_test.cxx @@ -1800,33 +1800,6 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testRichTextCellFormatXLSX) assertXPath(pStyles, aXPath3, "val"_ostr, u"true"_ustr); } -CPPUNIT_TEST_FIXTURE(ScExportTest, testWrapText) -{ -createScDoc("xlsx/wrap-text.xlsx"); - -save(u"Calc Office Open XML"_ustr); - -xmlDocUniquePtr pStyles = parseExport(u"xl/styles.xml"_ustr); -CPPUNIT_ASSERT(pStyles); - -assertXPath(pStyles, "/x:styleSheet/x:cellXfs"_ostr, "count"_ostr, u"7"_ustr); - -assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[1]/x:alignment"_ostr, "wrapText"_ostr, -u"false"_ustr); -assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment"_ostr, "wrapText"_ostr, -u"false"_ustr); -assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[3]/x:alignment"_ostr, "wrapText"_ostr, -u"false"_ustr); -assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[4]/x:alignment"_ostr, "wrapText"_ostr, -u"false"_ustr); -assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[5]/x:alignment"_ostr, "wrapText"_ostr, -u"true"_ustr); -assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[6]/x:alignment"_ostr, "wrapText"_ostr, -u"true"_ustr); -assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[7]/x:alignment"_ostr, "wrapText"_ostr, -u"true"_ustr); -} - CPPUNIT_TEST_FIXTURE(ScExportTest, testFormulaRefSheetNameODS) { createScDoc("ods/formula-quote-in-sheet-name.ods"); diff --git a/sc/qa/unit/subsequent_export_test3.cxx b/sc/qa/unit/subsequent_export_test3.cxx index e537595b6cee..37957d10aafa 100644 --- a/sc/qa/unit/subsequent_export_test3.cxx +++ b/sc/qa/unit/subsequent_export_test3.cxx @@ -929,7 +929,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testCustomXml) // Load document and export it to a temporary file createScDoc("xlsx/customxml.xlsx"); -save(u"Calc Office Open XML"_ustr); +saveAndReload(u"Calc Office Open XML"_ustr); xmlDocUniquePtr pXmlDoc = parseExport(u"customXml/item1.xml"_ustr); CPPUNIT_ASSERT(pXmlDoc); xmlDocUniquePtr pRelsDoc = parseExport(u"customXml/_rels/item1.xml.rels"_ustr); @@ -943,6 +943,10 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testCustomXml) std::unique_ptr pStream = parseExportStream(maTempFile.GetURL(), u"ddp/ddpfile.xen"_ustr); CPPUNIT_ASSERT(pStream); + +// tdf#161453: ensure E1's wrap text attribute was round-tripped +ScDocument* pDoc = getScDoc(); +CPPUNIT_ASSERT(pDoc->GetAttr(4, 0, 0, ATTR_LINEBREAK)->GetValue()); } #ifdef _WIN32 diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index fbf31673ada3..e194568803c0 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -1831,6 +1832,15 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf152980) CPPUNIT_ASSERT_EQUAL(u"a b"_ustr, pDoc->GetString(0, 5, 0)); CPPUNIT_ASSERT_EQUAL(u"a b"_ustr, pDoc->GetString(0, 6, 0)); CPPUNIT_ASSERT_EQUAL(u"a b"
core.git: sc/qa sc/source
sc/qa/filter/html/data/bad-json.html |4 sc/qa/filter/html/html.cxx | 15 +++ sc/source/filter/html/htmlpars.cxx | 10 +- 3 files changed, 28 insertions(+), 1 deletion(-) New commits: commit 45c7bb44b4d76a387dbb0dc6b10e353440cb3923 Author: Miklos Vajna AuthorDate: Tue Aug 27 10:06:59 2024 +0200 Commit: Miklos Vajna CommitDate: Tue Aug 27 11:11:50 2024 +0200 tdf#162574 sc HTML paste: handle not well-formed json for td data-sheets-value Regression from commit f5f6db55a5938f37a1c136be904ad7f10a3438ef (tdf#159483 sc HTML paste: handle data-sheets-value here, too, 2024-02-08), in case the HTML markup is like: then just ignore it, as if the attribute would be missing. We're only interested in the case where it contains well-formed JSON. Change-Id: Id625205e56ae2bfe05a26296a1a0f3abf6d5a4f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172452 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/sc/qa/filter/html/data/bad-json.html b/sc/qa/filter/html/data/bad-json.html new file mode 100644 index ..3a978e777f6d --- /dev/null +++ b/sc/qa/filter/html/data/bad-json.html @@ -0,0 +1,4 @@ + + + + diff --git a/sc/qa/filter/html/html.cxx b/sc/qa/filter/html/html.cxx index 38b0500297ba..9e60af2565f9 100644 --- a/sc/qa/filter/html/html.cxx +++ b/sc/qa/filter/html/html.cxx @@ -85,6 +85,21 @@ CPPUNIT_TEST_FIXTURE(Test, testPasteTdAsText) CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, eCellType); } +CPPUNIT_TEST_FIXTURE(Test, testPasteBadJson) +{ +createScDoc(); + +// Just care we don't crash on not-well-formed JSON: +ScDocument* pDoc = getScDoc(); +ScAddress aCellPos(/*nColP=*/0, /*nRowP=*/0, /*nTabP=*/0); +ScImportExport aImporter(*pDoc, aCellPos); +SvFileStream aFile(createFileURL(u"bad-json.html"), StreamMode::READ); +SvMemoryStream aMemory; +aMemory.WriteStream(aFile); +aMemory.Seek(0); +CPPUNIT_ASSERT(aImporter.ImportStream(aMemory, OUString(), SotClipboardFormatId::HTML)); +} + CPPUNIT_TEST_FIXTURE(Test, testPasteTdAsBools) { // Given an empty document: diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 2ef84c4cdb12..cf4aa77a3ae3 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -84,7 +84,15 @@ void ParseDataSheetsValue(const OUString& rDataSheetsValue, std::optional
core.git: sc/qa sc/source
sc/qa/unit/data/functions/text/fods/exact.fods | 40 + sc/source/core/tool/interpr1.cxx |2 - 2 files changed, 29 insertions(+), 13 deletions(-) New commits: commit 26931fa1ce1c22f0c54ab2916e9924b1c78f8efe Author: Mike Kaganski AuthorDate: Mon Aug 12 15:58:24 2024 +0500 Commit: Mike Kaganski CommitDate: Mon Aug 12 17:10:31 2024 +0200 tdf#162439: compare strings, not pointers Change-Id: Id107eaee553531f49da4ad06c681a34cdc08e4da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171756 Reviewed-by: Noel Grandin Reviewed-by: Mike Kaganski Tested-by: Jenkins diff --git a/sc/qa/unit/data/functions/text/fods/exact.fods b/sc/qa/unit/data/functions/text/fods/exact.fods index 5a97d27654ec..db69bed3dba5 100644 --- a/sc/qa/unit/data/functions/text/fods/exact.fods +++ b/sc/qa/unit/data/functions/text/fods/exact.fods @@ -2799,25 +2799,41 @@ - - - - + + + + + - - - - - + + + + + + + + - - + + + + + + + + - + + + + + + + diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index fbfb30761f48..ad5685c84b89 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -10628,7 +10628,7 @@ void ScInterpreter::ScExact() { svl::SharedString s1 = GetString(); svl::SharedString s2 = GetString(); -PushInt( int(s1.getData() == s2.getData()) ); +PushInt(int(s1 == s2)); } }
core.git: sc/qa sc/source
sc/qa/unit/ucalc_copypaste.cxx | 14 ++ sc/source/core/data/document.cxx |7 ++- 2 files changed, 8 insertions(+), 13 deletions(-) New commits: commit e747986af4dbb6b48957092dadce26a95b910a82 Author: Andreas Heinisch AuthorDate: Sat Jul 20 21:45:34 2024 +0200 Commit: Andreas Heinisch CommitDate: Fri Aug 2 10:32:56 2024 +0200 tdf#161189 - CopyFromClip: improve handling of deleting notes Instead of adding additional deletion flags, just remove the note deletetion flag when needed. Change-Id: Iba0dd4f922694c9fff98f4b74bccad1b8ee16d49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170803 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx index cba06db1de22..a58698f1e18e 100644 --- a/sc/qa/unit/ucalc_copypaste.cxx +++ b/sc/qa/unit/ucalc_copypaste.cxx @@ -9350,11 +9350,10 @@ CPPUNIT_TEST_FIXTURE(TestCopyPaste, testCopyPasteSkipEmpty) // Check the content after the paste. { -// tdf#141440 - do not delete notes when pasting contents static const Check aChecks[] = { -{ "Clip1", COL_YELLOW, true }, { "B", COL_BLUE, true }, -{ "Clip2", COL_YELLOW, true }, { "D", COL_BLUE, true }, -{ "Clip3", COL_YELLOW, true }, +{ "Clip1", COL_YELLOW, false }, { "B", COL_BLUE, true }, +{ "Clip2", COL_YELLOW, false }, { "D", COL_BLUE, true }, +{ "Clip3", COL_YELLOW, false }, }; bool bRes @@ -9378,11 +9377,10 @@ CPPUNIT_TEST_FIXTURE(TestCopyPaste, testCopyPasteSkipEmpty) // Redo, and check the content again. aUndo.Redo(); { -// tdf#141440 - do not delete notes when pasting contents static const Check aChecks[] = { -{ "Clip1", COL_YELLOW, true }, { "B", COL_BLUE, true }, -{ "Clip2", COL_YELLOW, true }, { "D", COL_BLUE, true }, -{ "Clip3", COL_YELLOW, true }, +{ "Clip1", COL_YELLOW, false }, { "B", COL_BLUE, true }, +{ "Clip2", COL_YELLOW, false }, { "D", COL_BLUE, true }, +{ "Clip3", COL_YELLOW, false }, }; bool bRes diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index ceb1de82cc38..3830ed410cef 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2899,12 +2899,9 @@ void ScDocument::CopyFromClip( overwrite/delete existing cells but to insert the notes into these cells. In this case, just delete old notes from the destination area. */ -InsertDeleteFlags nDelFlag = InsertDeleteFlags::NONE; +InsertDeleteFlags nDelFlag = nInsFlag; if ( (nInsFlag & (InsertDeleteFlags::CONTENTS | InsertDeleteFlags::ADDNOTES)) == (InsertDeleteFlags::NOTE | InsertDeleteFlags::ADDNOTES) ) -nDelFlag |= InsertDeleteFlags::NOTE; -// tdf#141440 - do not delete notes when pasting contents (see InsertDeleteFlags::CONTENTS) -else if ( nInsFlag & (InsertDeleteFlags::CONTENTS & ~InsertDeleteFlags::NOTE) ) -nDelFlag |= InsertDeleteFlags::CONTENTS & ~InsertDeleteFlags::NOTE; +nDelFlag &= ~InsertDeleteFlags::NOTE; if (nInsFlag & InsertDeleteFlags::ATTRIB) nDelFlag |= InsertDeleteFlags::ATTRIB;
core.git: sc/qa sc/source
sc/qa/unit/ucalc.cxx | 74 + sc/source/core/data/table2.cxx |3 - 2 files changed, 74 insertions(+), 3 deletions(-) New commits: commit e552de24b646f8dc59551203edd901dad6af0ff5 Author: Xisco Fauli AuthorDate: Tue Jul 30 14:05:32 2024 +0200 Commit: Xisco Fauli CommitDate: Tue Jul 30 21:02:42 2024 +0200 tdf#156689: don't initialize the last columns from the default attributes Regression from dd8e061406fac581d399da088c7f0187278035dc "tdf#153437 sc: fix broken formatting without performance regression" Change-Id: Ifacc48db93f28ec7b539af640e95eff8ad5ec535 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171242 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 57441651694d..2d8bbf59d286 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -326,6 +326,80 @@ CPPUNIT_TEST_FIXTURE(Test, testSharedStringPool) m_pDoc->DeleteTab(0); } +CPPUNIT_TEST_FIXTURE(Test, testBackgroundColorDeleteColumn) +{ +m_pDoc->InsertTab(0, u"Table1"_ustr); + +ScMarkData aMark(m_pDoc->GetSheetLimits()); + +// Set Values to B1, C2, D5 +m_pDoc->SetValue(ScAddress(1, 0, 0), 1.0); // B1 +m_pDoc->SetValue(ScAddress(2, 1, 0), 2.0); // C2 +m_pDoc->SetValue(ScAddress(3, 4, 0), 3.0); // D5 + +// Add patterns +ScPatternAttr aCellBlueColor(m_pDoc->getCellAttributeHelper()); +aCellBlueColor.GetItemSet().Put(SvxBrushItem(COL_BLUE, ATTR_BACKGROUND)); +m_pDoc->ApplyPatternAreaTab(3, 0, 3, m_pDoc->MaxRow(), 0, aCellBlueColor); + +// Delete column 10 +m_pDoc->DeleteCol(ScRange(9,0,0,9,m_pDoc->MaxRow(),0)); + +// Check patterns +const SfxPoolItem* pItem = nullptr; +m_pDoc->GetPattern(ScAddress(3, 1000, 0))->GetItemSet().HasItem(ATTR_BACKGROUND, &pItem); +CPPUNIT_ASSERT(pItem); +CPPUNIT_ASSERT_EQUAL(COL_BLUE, static_cast(pItem)->GetColor()); + +// Delete column 2 +m_pDoc->DeleteCol(ScRange(1,0,0,1,m_pDoc->MaxRow(),0)); + +// Check patterns +pItem = nullptr; +m_pDoc->GetPattern(ScAddress(2, 1000, 0))->GetItemSet().HasItem(ATTR_BACKGROUND, &pItem); +CPPUNIT_ASSERT(pItem); +CPPUNIT_ASSERT_EQUAL(COL_BLUE, static_cast(pItem)->GetColor()); + +m_pDoc->DeleteTab(0); +} + +CPPUNIT_TEST_FIXTURE(Test, testBackgroundColorDeleteRow) +{ +m_pDoc->InsertTab(0, u"Table1"_ustr); + +ScMarkData aMark(m_pDoc->GetSheetLimits()); + +// Set Values to B1, C2, D5 +m_pDoc->SetValue(ScAddress(1, 0, 0), 1.0); // B1 +m_pDoc->SetValue(ScAddress(2, 1, 0), 2.0); // C2 +m_pDoc->SetValue(ScAddress(3, 4, 0), 3.0); // D5 + +// Add patterns +ScPatternAttr aCellBlueColor(m_pDoc->getCellAttributeHelper()); +aCellBlueColor.GetItemSet().Put(SvxBrushItem(COL_BLUE, ATTR_BACKGROUND)); +m_pDoc->ApplyPatternAreaTab(0, 3, m_pDoc->MaxCol(), 3, 0, aCellBlueColor); + +// Delete row 10 +m_pDoc->DeleteRow(ScRange(0,9,0,m_pDoc->MaxCol(),9,0)); + +// Check patterns +const SfxPoolItem* pItem = nullptr; +m_pDoc->GetPattern(ScAddress(1000, 3, 0))->GetItemSet().HasItem(ATTR_BACKGROUND, &pItem); +CPPUNIT_ASSERT(pItem); +CPPUNIT_ASSERT_EQUAL(COL_BLUE, static_cast(pItem)->GetColor()); + +// Delete row 2 +m_pDoc->DeleteRow(ScRange(0,1,0,m_pDoc->MaxCol(),1,0)); + +// Check patterns +pItem = nullptr; +m_pDoc->GetPattern(ScAddress(1000, 2, 0))->GetItemSet().HasItem(ATTR_BACKGROUND, &pItem); +CPPUNIT_ASSERT(pItem); +CPPUNIT_ASSERT_EQUAL(COL_BLUE, static_cast(pItem)->GetColor()); + +m_pDoc->DeleteTab(0); +} + CPPUNIT_TEST_FIXTURE(Test, testSharedStringPoolUndoDoc) { struct diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 4629ce8036d1..933b9a37930e 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -400,9 +400,6 @@ void ScTable::DeleteCol( { for (SCCOL nCol = nStartCol + nSize; nCol < aCol.size(); ++nCol) aCol[nCol].SwapCol(aCol[nCol - nSize]); -// When delete column(s), initialize the last columns from the default attributes -for (SCCOL nCol = aCol.size() < static_cast(nSize) ? 0 : aCol.size() - nSize; nCol < aCol.size(); ++nCol) -aCol[nCol].Init(nCol, aCol[nCol].GetTab(), rDocument, false); } else {
core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/cell-note.xlsx|binary sc/qa/unit/subsequent_export_test4.cxx | 20 sc/source/filter/excel/xeescher.cxx| 12 sc/source/filter/inc/xeescher.hxx |3 +++ 4 files changed, 35 insertions(+) New commits: commit 0acac1a2741d47b98ae600800e2db0e7a5fb3efe Author: Samuel Mehrbrodt AuthorDate: Thu Jun 27 09:23:08 2024 +0200 Commit: Samuel Mehrbrodt CommitDate: Thu Jun 27 13:49:05 2024 +0200 xlsx: Don't export notes author when in privacy mode Change-Id: Id0b3f0aca7bd4e21f41c2a8307964423debcf5bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169616 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt diff --git a/sc/qa/unit/data/xlsx/cell-note.xlsx b/sc/qa/unit/data/xlsx/cell-note.xlsx new file mode 100644 index ..9df212a2970f Binary files /dev/null and b/sc/qa/unit/data/xlsx/cell-note.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index a6e5802cf98f..fbf31673ada3 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -1917,6 +1917,26 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testChangesAuthorDateXLSX) pBatch->commit(); } +CPPUNIT_TEST_FIXTURE(ScExportTest4, testNotesAuthor) +{ +createScDoc("xlsx/cell-note.xlsx"); + +auto pBatch(comphelper::ConfigurationChanges::create()); +// Remove all personal info + officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::set(true, pBatch); +pBatch->commit(); + +save(u"Calc Office Open XML"_ustr); +xmlDocUniquePtr pXmlDoc = parseExport(u"xl/comments1.xml"_ustr); +CPPUNIT_ASSERT(pXmlDoc); + +assertXPathContent(pXmlDoc, "/x:comments/x:authors/x:author"_ostr, u"Author1"_ustr); + +// Reset config change + officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::set(false, pBatch); +pBatch->commit(); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 314f2ebe5b1c..625021e7555b 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -1639,6 +1640,7 @@ XclExpNote::XclExpNote(const XclExpRoot& rRoot, const ScAddress& rScPos, , mbAutoFill(false) , mbColHidden(false) , mbRowHidden(false) +, mpAuthorIDs(new SvtSecurityMapPersonalInfo) { // get the main note text OUString aNoteText; @@ -1681,8 +1683,18 @@ XclExpNote::XclExpNote(const XclExpRoot& rRoot, const ScAddress& rScPos, // stAuthor (variable): An XLUnicodeString that specifies the name of the comment // author. String length MUST be greater than or equal to 1 and less than or equal // to 54. +bool bRemovePersonalInfo += SvtSecurityOptions::IsOptionSet( + SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo) + && !SvtSecurityOptions::IsOptionSet( + SvtSecurityOptions::EOption::DocWarnKeepNoteAuthorDateInfo); if( pScNote->GetAuthor().isEmpty() ) maAuthor = XclExpString( u" "_ustr ); +else if (bRemovePersonalInfo) +maAuthor = XclExpString( +"Author" ++ OUString::number(mpAuthorIDs->GetInfoID(pScNote->GetAuthor())), +XclStrFlags::NONE, 54); else maAuthor = XclExpString( pScNote->GetAuthor(), XclStrFlags::NONE, 54 ); diff --git a/sc/source/filter/inc/xeescher.hxx b/sc/source/filter/inc/xeescher.hxx index c7adf1050b9b..2d7aefcf07d7 100644 --- a/sc/source/filter/inc/xeescher.hxx +++ b/sc/source/filter/inc/xeescher.hxx @@ -26,6 +26,7 @@ #include "xlformula.hxx" #include #include +#include #include #include #include @@ -382,6 +383,8 @@ private: boolmbRowHidden;/// Row containing the comment is hidden tools::Rectangle maCommentFrom; /// From and From Offset tools::Rectangle maCommentTo;/// To and To Offsets +/// map authors to remove personal info +std::unique_ptr mpAuthorIDs; }; class XclExpComments : public XclExpRecord
core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/change-tracking.xlsx|binary sc/qa/unit/subsequent_export_test4.cxx | 26 ++ sc/source/filter/inc/XclExpChangeTrack.hxx |5 + sc/source/filter/xcl97/XclExpChangeTrack.cxx | 13 - 4 files changed, 43 insertions(+), 1 deletion(-) New commits: commit 9d0d9d8aa0ba4bb465e376621b426fb9ff00507e Author: Samuel Mehrbrodt AuthorDate: Mon Jun 24 11:11:15 2024 +0200 Commit: Samuel Mehrbrodt CommitDate: Thu Jun 27 13:45:05 2024 +0200 xlsx: Don't export changes author/date when in privacy mode Change-Id: I1b1ef4dd75f02cc545721d5458617cfa92b26615 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169453 Reviewed-by: Samuel Mehrbrodt Tested-by: Jenkins diff --git a/sc/qa/unit/data/xlsx/change-tracking.xlsx b/sc/qa/unit/data/xlsx/change-tracking.xlsx new file mode 100644 index ..cba56b971d64 Binary files /dev/null and b/sc/qa/unit/data/xlsx/change-tracking.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index 0814c915d81b..a6e5802cf98f 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -1889,6 +1889,32 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testChangesAuthorDate) pXmlDoc, "/office:document-content/office:body/office:spreadsheet/table:tracked-changes/table:cell-content-change[1]/office:change-info/dc:date"_ostr, u"1970-01-01T12:00:00"_ustr); + +// Reset config change + officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::set(false, pBatch); +pBatch->commit(); +} + +CPPUNIT_TEST_FIXTURE(ScExportTest4, testChangesAuthorDateXLSX) +{ +createScDoc("xlsx/change-tracking.xlsx"); + +auto pBatch(comphelper::ConfigurationChanges::create()); +// Remove all personal info + officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::set(true, pBatch); +pBatch->commit(); + +save(u"Calc Office Open XML"_ustr); +xmlDocUniquePtr pXmlDoc = parseExport(u"xl/revisions/revisionHeaders.xml"_ustr); +CPPUNIT_ASSERT(pXmlDoc); + +assertXPath(pXmlDoc, "/x:headers/x:header[1]"_ostr, "userName"_ostr, u"Author1"_ustr); +assertXPath(pXmlDoc, "/x:headers/x:header[1]"_ostr, "dateTime"_ostr, +u"1970-01-01T12:00:00.0Z"_ustr); + +// Reset config change + officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::set(false, pBatch); +pBatch->commit(); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/inc/XclExpChangeTrack.hxx b/sc/source/filter/inc/XclExpChangeTrack.hxx index b23b6f8cdcaf..746125e50ab1 100644 --- a/sc/source/filter/inc/XclExpChangeTrack.hxx +++ b/sc/source/filter/inc/XclExpChangeTrack.hxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include "xelink.hxx" @@ -262,6 +263,10 @@ public: virtual void SaveXml( XclExpXmlStream& rStrm ) override; void AppendAction( std::unique_ptr pAction ); + +private: +/// map authors to remove personal info +std::unique_ptr mpAuthorIDs; }; // XclExpChTrInfo - header of action group of a user diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx index 52d2150e9f75..30812d7bb9e2 100644 --- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx @@ -37,6 +37,9 @@ #include #include #include +#include + +#include using namespace oox; @@ -395,7 +398,7 @@ XclExpXmlChTrHeader::XclExpXmlChTrHeader( OUString aUserName, const DateTime& rDateTime, const sal_uInt8* pGUID, sal_Int32 nLogNumber, const XclExpChTrTabIdBuffer& rBuf ) : maUserName(std::move(aUserName)), maDateTime(rDateTime), mnLogNumber(nLogNumber), -mnMinAction(0), mnMaxAction(0) +mnMinAction(0), mnMaxAction(0), mpAuthorIDs(new SvtSecurityMapPersonalInfo) { memcpy(maGUID, pGUID, 16); if (rBuf.GetBufferCount()) @@ -421,6 +424,14 @@ void XclExpXmlChTrHeader::SaveXml( XclExpXmlStream& rStrm ) &aRelId); tools::Guid aGuid(maGUID); +bool bRemovePersonalInfo += SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo) + && !SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo); +if (bRemovePersonalInfo) +{ +maDateTime = css::util::DateTime(0, 0, 0, 12, 1, 1, 1970, true); +maUserName = "Author" + OUString::number(mpAuthorIDs->GetInfoID(maUserName)); +} rStrm.WriteAttributes( XML_guid, aGuid.getString(), XML_dateTime, lcl_DateTimeToOString(maDateTime),
core.git: sc/qa sc/source
sc/qa/unit/data/ods/change-tracking.ods|binary sc/qa/unit/subsequent_export_test4.cxx | 23 + sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx | 19 ++ 3 files changed, 37 insertions(+), 5 deletions(-) New commits: commit 2d60017a66cca4668c87f64f6d048566656b3b1c Author: Samuel Mehrbrodt AuthorDate: Thu Jun 20 10:51:11 2024 +0200 Commit: Samuel Mehrbrodt CommitDate: Mon Jun 24 07:51:52 2024 +0200 ods: Don't export changes author/date when in privacy mode Change-Id: I8c542f398bb70da96a64b61a9931398b6a78ea72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169258 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt diff --git a/sc/qa/unit/data/ods/change-tracking.ods b/sc/qa/unit/data/ods/change-tracking.ods new file mode 100644 index ..01077fffc749 Binary files /dev/null and b/sc/qa/unit/data/ods/change-tracking.ods differ diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index 041a7b0bb9cf..0814c915d81b 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -1868,6 +1868,29 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf157318) static_cast(pDoc->GetRangeName(0)->size())); } +CPPUNIT_TEST_FIXTURE(ScExportTest4, testChangesAuthorDate) +{ +createScDoc("ods/change-tracking.ods"); + +auto pBatch(comphelper::ConfigurationChanges::create()); +// Remove all personal info + officecfg::Office::Common::Security::Scripting::RemovePersonalInfoOnSaving::set(true, pBatch); +pBatch->commit(); + +save(u"calc8"_ustr); +xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); +CPPUNIT_ASSERT(pXmlDoc); + +assertXPathContent( +pXmlDoc, + "/office:document-content/office:body/office:spreadsheet/table:tracked-changes/table:cell-content-change[1]/office:change-info/dc:creator"_ostr, +u"Author1"_ustr); +assertXPathContent( +pXmlDoc, + "/office:document-content/office:body/office:spreadsheet/table:tracked-changes/table:cell-content-change[1]/office:change-info/dc:date"_ostr, +u"1970-01-01T12:00:00"_ustr); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx index 1a3b22e6aad0..80f70da9f53e 100644 --- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx +++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx @@ -37,6 +37,8 @@ #include #include +#include + using namespace ::com::sun::star; using namespace xmloff::token; @@ -94,21 +96,28 @@ void ScChangeTrackingExportHelper::WriteBigRange(const ScBigRange& rBigRange, XM void ScChangeTrackingExportHelper::WriteChangeInfo(const ScChangeAction* pAction) { +bool bRemovePersonalInfo += SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo) + && !SvtSecurityOptions::IsOptionSet(SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo); + SvXMLElementExport aElemInfo (rExport, XML_NAMESPACE_OFFICE, XML_CHANGE_INFO, true, true); { SvXMLElementExport aCreatorElem( rExport, XML_NAMESPACE_DC, XML_CREATOR, true, false ); -rExport.Characters(pAction->GetUser()); +rExport.Characters(bRemovePersonalInfo + ? "Author" + OUString::number(rExport.GetInfoID(pAction->GetUser())) + : pAction->GetUser()); } { OUStringBuffer sDate; -ScXMLConverter::ConvertDateTimeToString(pAction->GetDateTimeUTC(), sDate); -SvXMLElementExport aDateElem( rExport, XML_NAMESPACE_DC, - XML_DATE, true, - false ); +ScXMLConverter::ConvertDateTimeToString(bRemovePersonalInfo +? util::DateTime(0, 0, 0, 12, 1, 1, 1970, true) +: pAction->GetDateTimeUTC(), +sDate); +SvXMLElementExport aDateElem(rExport, XML_NAMESPACE_DC, XML_DATE, true, false); rExport.Characters(sDate.makeStringAndClear()); }
core.git: sc/qa sc/source
sc/qa/unit/data/functions/spreadsheet/fods/let.fods | 408 ++-- sc/source/core/tool/interpr1.cxx| 50 +- 2 files changed, 321 insertions(+), 137 deletions(-) New commits: commit 5c9040c16506d5ef2708416ea280d97b707092b4 Author: Balazs Varga AuthorDate: Tue Jun 11 09:30:35 2024 +0200 Commit: Balazs Varga CommitDate: Tue Jun 11 12:23:56 2024 +0200 tdf#161496 - Fix single ocPush tokens in LET function Name values If the Name - Name Value pairs contains already an ocPush result no need to interpret, so the Calculation parameter can reuse it. Change-Id: I55465d674eb31aea7c3123c889250c9fa127f1fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168661 Tested-by: Jenkins Reviewed-by: Balazs Varga diff --git a/sc/qa/unit/data/functions/spreadsheet/fods/let.fods b/sc/qa/unit/data/functions/spreadsheet/fods/let.fods index 05cf82e93053..9e13c4556ed3 100644 --- a/sc/qa/unit/data/functions/spreadsheet/fods/let.fods +++ b/sc/qa/unit/data/functions/spreadsheet/fods/let.fods @@ -1,7 +1,7 @@ http://openoffice.org/2004/office"; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:rpt="http://openoffice.org/2005/report"; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/200 4/writer" xmlns:oooc="http://openoffice.org/2004/calc"; xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xforms="http://www.w3.org/2002/xforms"; xmlns:tableooo="http://openoffice.org/2009/table"; xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw"; xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML"; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:dom="http://www.w3.org/2001/xml-events"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xhtml="http://www.w3.org/1999/xhtml"; xmlns:grddl="http://www.w3.org/2003/g/data-view#"; xmlns :css3t="http://www.w3.org/TR/css3-text/"; xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.spreadsheet"> - 2024-01-16T18:30:06.27800PT7H26M30S110LibreOfficeDev/24.8.0.0.alpha1$Windows_X86_64 LibreOffice_project/a5610e052c7d070eb220dab40083edc311eea1482024-06-09T18:41:03.90300 + 2024-01-16T18:30:06.27800PT7H29M10S111LibreOfficeDev/24.8.0.0.alpha1$Windows_X86_64 LibreOffice_project/38dff367d75365eb75c80c73385ec818f9a5aabd2024-06-11T09:22:21.07200 0 @@ -14,7 +14,7 @@ 2 - 3 + 1 2 0 0 @@ -30,8 +30,8 @@ false - 9 - 32 + 7 + 47 2 0 0 @@ -48,7 +48,7 @@ Sheet1 - 1851 + 2495 0 75 60 @@ -3039,28 +3039,33 @@ - + - + - + - + - + + + + + + @@ -3068,47 +3073,42 @@ - + - + - - - - - - + - + - + - + - + - + @@ -3116,12 +3116,12 @@ - + - + @@ -3142,7 +3142,7 @@ - + @@ -3204,7 +3204,7 @@ ???(???) - .00.00, 00:00:00 + .00.00, 00:00:00 @@ -3221,10 +3221,10 @@ - + - + LET Function @@ -3236,10 +3236,10 @@ - + Result - + IGAZ @@ -3248,13 +3248,13 @@ - + Sheet - + Res
core.git: sc/qa sc/source
sc/qa/uitest/autofilter2/tdf161457.py | 42 + sc/qa/uitest/data/autofilter/tdf161457.ods |binary sc/source/core/tool/typedstrdata.cxx |8 ++--- 3 files changed, 46 insertions(+), 4 deletions(-) New commits: commit db153afbac7acc1ae46f78beef4221e9aad07305 Author: Balazs Varga AuthorDate: Sun Jun 9 19:00:53 2024 +0200 Commit: Balazs Varga CommitDate: Mon Jun 10 23:42:24 2024 +0200 tdf#161457 - Fix autofilter result is wrong when cells contain formatted rounded values. Filtered formatted values were not sorted with the rounded values but with the original values and the duplicated values caused wrong filter results. Regression from commit: 2d1df9f3dccc10f13b8585ad18afce1542ebc4d1 (tdf#117276 sc: Show hidden filter elements as inactive elements) Change-Id: I7540ba5fa98e6bbe0b014448bf2449432261d542 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168592 Tested-by: Jenkins Reviewed-by: Balazs Varga diff --git a/sc/qa/uitest/autofilter2/tdf161457.py b/sc/qa/uitest/autofilter2/tdf161457.py new file mode 100644 index ..400f4df9b584 --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf161457.py @@ -0,0 +1,42 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf161457(UITestCase): + +def test_tdf161457(self): + +with self.ui_test.load_file(get_url_for_data_file("tdf161457.ods")) as calc_doc: + +xCalcDoc = self.xUITest.getTopFocusWindow() +xGridWin = xCalcDoc.getChild("grid_window") + +# Click the autofilter dropdown in column B +xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("FilterDropDown") +xTreeList = xCheckListMenu.getChild("check_list_box") + +self.assertEqual(2, len(xTreeList.getChildren())) + +xEntry1 = xTreeList.getChild(0) +self.assertEqual("1.00", get_state_as_dict(xEntry1)['Text']) +self.assertEqual("true", get_state_as_dict(xEntry1)['IsChecked']) +self.assertEqual("false", get_state_as_dict(xEntry1)['IsSemiTransparent']) + +xEntry2 = xTreeList.getChild(1) +self.assertEqual("5.00", get_state_as_dict(xEntry2)['Text']) +self.assertEqual("true", get_state_as_dict(xEntry2)['IsChecked']) +# Without the fix in place, this test would have failed with +# AssertionError: 'true' != 'false' +self.assertEqual("false", get_state_as_dict(xEntry2)['IsSemiTransparent']) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter2/tdf46184.py b/sc/qa/uitest/autofilter2/tdf46184.py old mode 100755 new mode 100644 diff --git a/sc/qa/uitest/data/autofilter/tdf161457.ods b/sc/qa/uitest/data/autofilter/tdf161457.ods new file mode 100644 index ..6580b1d7daf6 Binary files /dev/null and b/sc/qa/uitest/data/autofilter/tdf161457.ods differ diff --git a/sc/source/core/tool/typedstrdata.cxx b/sc/source/core/tool/typedstrdata.cxx index 4e3f862ae3a4..14ea33ab9221 100644 --- a/sc/source/core/tool/typedstrdata.cxx +++ b/sc/source/core/tool/typedstrdata.cxx @@ -26,7 +26,7 @@ bool ScTypedStrData::LessCaseSensitive::operator() (const ScTypedStrData& left, if (left.meStrType == Value) { -if (left.mfValue == right.mfValue) +if (left.mfRoundedValue == right.mfRoundedValue) return left.mbIsHiddenByFilter < right.mbIsHiddenByFilter; return left.mfValue < right.mfValue; } @@ -50,7 +50,7 @@ bool ScTypedStrData::LessSortCaseSensitive::operator() (const ScTypedStrData& le if (left.meStrType == Value) { -if (left.mfValue == right.mfValue) +if (left.mfRoundedValue == right.mfRoundedValue) return left.mbIsHiddenByFilter < right.mbIsHiddenByFilter; return left.mfValue < right.mfValue; } @@ -73,7 +73,7 @@ bool ScTypedStrData::LessCaseInsensitive::operator() (const ScTypedStrData& left if (left.meStrType == Value) { -if (left.mfValue == right.mfValue) +if (left.mfRoundedValue == right.mfRoundedValue) return left.mbIsHiddenByFilter < right.mbIsHiddenByFilter; return left.mfValue < right.mfValue; } @@ -97,7 +97,7 @@ bool ScTypedStrData::LessSortCaseInsensitive::operator() (const ScTypedStrData&
core.git: sc/qa sc/source
sc/qa/unit/tiledrendering/data/right-aligned-with-overflow.ods |binary sc/qa/unit/tiledrendering/tiledrendering.cxx | 28 ++ sc/source/ui/view/tabview3.cxx |5 + 3 files changed, 31 insertions(+), 2 deletions(-) New commits: commit c8838d6dded9bcf77da657af50b48a7bfa90b85b Author: Jaume Pujantell AuthorDate: Thu May 23 15:30:42 2024 +0200 Commit: Miklos Vajna CommitDate: Mon May 27 11:58:27 2024 +0200 sc: don't overwrite Special Positioning on MakeEditView On LOK, calling UpdateEditPos after SetEditEngine overwrote the outer area of mpLOKSpecialPositioning, making the text show on the wrong position on right alined cells with overflowing content. Changing the order of the calls fixes that. Change-Id: I8ddb31103bb6f0bab1a9a6532af55797ef011214 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167991 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit 3009eebbad4b1d9883a68066d758a67eeaf3c379) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167946 Tested-by: Jenkins diff --git a/sc/qa/unit/tiledrendering/data/right-aligned-with-overflow.ods b/sc/qa/unit/tiledrendering/data/right-aligned-with-overflow.ods new file mode 100644 index ..6a32fdc579c2 Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/right-aligned-with-overflow.ods differ diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index cea5554d2f5c..f184251132e3 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -3964,6 +3964,34 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testNumberFormatLocaleMultiUser) } } +CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testLeftOverflowEdit) +{ + comphelper::LibreOfficeKit::setCompatFlag(comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs); +ScModelObj* pModelObj = createDoc("right-aligned-with-overflow.ods"); +ViewCallback aView; + +// Go to Cell B5000 +uno::Sequence aPropertyValues = { +comphelper::makePropertyValue("ToPoint", OUString("$B$5000")), +}; +dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues); + +// Enter edit mode and select all text. +aView.m_aTextSelectionResult.clear(); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::F2); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::F2); +Scheduler::ProcessEventsToIdle(); +// CTRL + A +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_MOD1 | awt::Key::A); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_MOD1 | awt::Key::A); +Scheduler::ProcessEventsToIdle(); + +// Without the accompanying fix this would fail with +// - Expected: 20 +// - Actual : 1300 +CPPUNIT_ASSERT_EQUAL(tools::Long(20), aView.m_aTextSelectionResult.m_aRefPoint.getX()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 0b8dcb4b8f61..8b075bf45cbc 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -2212,14 +2212,15 @@ void ScTabView::MakeEditView( ScEditEngineDefaulter* pEngine, SCCOL nCol, SCROW // MapMode must be set after HideCursor pGridWin[i]->SetMapMode(aViewData.GetLogicMode()); -aViewData.SetEditEngine( static_cast(i), pEngine, pGridWin[i], nCol, nRow ); - if ( !bPosVisible ) { // move the edit view area to the real (possibly negative) position, // or hide if completely above or left of the window pGridWin[i]->UpdateEditViewPos(); } + +aViewData.SetEditEngine(static_cast(i), pEngine, pGridWin[i], nCol, +nRow); } } }
core.git: sc/qa sc/source
sc/qa/uitest/pasteSpecial/tdf139858.py |7 sc/qa/uitest/pasteSpecial/tdf158110.py | 48 + sc/qa/uitest/pasteSpecial/tdf160765.py |9 +- sc/source/ui/miscdlgs/inscodlg.cxx |7 ++-- sc/source/ui/view/viewfun3.cxx | 21 -- 5 files changed, 78 insertions(+), 14 deletions(-) New commits: commit 76941af9837406b1526b2f2d13c89df7a2023072 Author: Andreas Heinisch AuthorDate: Mon May 6 14:53:19 2024 +0200 Commit: Andreas Heinisch CommitDate: Wed May 22 07:27:32 2024 +0200 tdf#158110 - Paste special: Remove special ADDNOTES flag handling Remove special ADDNOTES flag handling and just add it to existing NOTE flag to ensure no content will be deleted. However, the check for empty cells needs to be improved. Change-Id: I44ae75aa3997a0b1041447106bc3c07146043351 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167202 Reviewed-by: Andreas Heinisch Tested-by: Jenkins diff --git a/sc/qa/uitest/pasteSpecial/tdf139858.py b/sc/qa/uitest/pasteSpecial/tdf139858.py old mode 100755 new mode 100644 index ca81c7715cb6..b5689ec3fdca --- a/sc/qa/uitest/pasteSpecial/tdf139858.py +++ b/sc/qa/uitest/pasteSpecial/tdf139858.py @@ -12,6 +12,7 @@ from uitest.framework import UITestCase from libreoffice.calc.document import get_cell_by_position from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict from libreoffice.calc.paste_special import reset_default_values class tdf139858(UITestCase): @@ -51,6 +52,12 @@ class tdf139858(UITestCase): xCommentsChkBox = xPasteSpecialDlg.getChild("comments") xCommentsChkBox.executeAction("CLICK", tuple()) +# After tdf#158110 when an existing comment is overwritten, a confirmation dialog is shown +xCheckWarningDlg = self.xUITest.getTopFocusWindow() +if get_state_as_dict(xCheckWarningDlg)["ID"] == "CheckWarningDialog": +xYesBtn = xCheckWarningDlg.getChild("yes") +xYesBtn.executeAction("CLICK", tuple()) + # Without the fix in place, this test would have failed with # AssertionError: 'A1 sample text' != '' # i.e., the cell content was overwritten diff --git a/sc/qa/uitest/pasteSpecial/tdf158110.py b/sc/qa/uitest/pasteSpecial/tdf158110.py new file mode 100644 index ..9b0dba6ed8cd --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf158110.py @@ -0,0 +1,48 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.paste_special import reset_default_values + +class tdf158110(UITestCase): +def test_tdf158110_paste_special_multiple_cells(self): +with self.ui_test.create_doc_in_start_center("calc") as document: +xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + +# Insert a comment in cell A1 +xGridWin.executeAction("SELECT", mkPropertyValues({"CELL":"A1"})) +xArgs = mkPropertyValues({"Text": "Comment 1"}) +self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + +# Copy cell range A1:A2 to clipboard +xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) +self.xUITest.executeCommand(".uno:Copy") + +# Paste data using special options (check only comments) +xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) +with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xPasteSpecialDlg: +reset_default_values(self, xPasteSpecialDlg) +xDateTimeChkBox = xPasteSpecialDlg.getChild("datetime") +xDateTimeChkBox.executeAction("CLICK", tuple()) +xTextChkBox = xPasteSpecialDlg.getChild("text") +xTextChkBox.executeAction("CLICK", tuple()) +xNumbersChkBox = xPasteSpecialDlg.getChild("numbers") +xNumbersChkBox.executeAction("CLICK", tuple()) +xCommentsChkBox = xPasteSpecialDlg.getChild("comments") +xCommentsChkBox.executeAction("CLICK", tuple()) + +# Without the fix in place, this test would have failed with +# AssertionError: 'Comment 1' != '' +# i.e., the comment was not copied +self.assertEqual("Comment 1", get_cell_by_position
core.git: sc/qa sc/source
sc/qa/unit/data/functions/spreadsheet/fods/xmatch.fods | 1116 +++-- sc/source/core/tool/interpr1.cxx | 19 2 files changed, 771 insertions(+), 364 deletions(-) New commits: commit 204c5e14188022f34afb05776eb20669b01ea6d4 Author: Balazs Varga AuthorDate: Mon May 13 14:41:46 2024 +0200 Commit: Balazs Varga CommitDate: Tue May 14 11:57:14 2024 +0200 tdf#160753 - sc: fix XMATCH function in search for empty cell gave back a wrong result. With this fix the we can search for empty cells and return as a result. follow-up commit: 8df17c340193c89549d8c563b04d015156afa3fb (tdf#160711 - sc fix XLOOKUP function search for empty cell) Change-Id: I48a545125bdfa23c98a4fcb866ea782156a0b32b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167596 Tested-by: Jenkins Reviewed-by: Balazs Varga diff --git a/sc/qa/unit/data/functions/spreadsheet/fods/xmatch.fods b/sc/qa/unit/data/functions/spreadsheet/fods/xmatch.fods index ff328a91275f..1bcb37925d14 100644 --- a/sc/qa/unit/data/functions/spreadsheet/fods/xmatch.fods +++ b/sc/qa/unit/data/functions/spreadsheet/fods/xmatch.fods @@ -1,27 +1,27 @@ http://openoffice.org/2004/office"; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:rpt="http://openoffice.org/2005/report"; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/200 4/writer" xmlns:oooc="http://openoffice.org/2004/calc"; xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xforms="http://www.w3.org/2002/xforms"; xmlns:tableooo="http://openoffice.org/2009/table"; xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw"; xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML"; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:dom="http://www.w3.org/2001/xml-events"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xhtml="http://www.w3.org/1999/xhtml"; xmlns:grddl="http://www.w3.org/2003/g/data-view#"; xmlns :css3t="http://www.w3.org/TR/css3-text/"; xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.spreadsheet"> - 2024-01-16T18:30:06.27800PT2H40M39S47LibreOfficeDev/24.8.0.0.alpha0$Windows_X86_64 LibreOffice_project/7bc98a8f230280ef37ba925eecd9b656bf1022302024-02-15T18:47:52.94400 + 2024-01-16T18:30:06.27800PT2H45M21S49LibreOfficeDev/24.8.0.0.alpha0$Windows_X86_64 LibreOffice_project/8c4fe90c53a6a889e5d327b1d0fff5a74ce284cb2024-05-13T14:33:55.18300 0 0 - 47322 - 15804 + 15882 + 5013 view1 2 - 7 + 0 2 0 0 0 0 0 - 140 + 100 60 true false @@ -30,15 +30,15 @@ false - 2 - 21 + 0 + 32 2 0 0 0 0 0 - 140 + 100 60 true false @@ -48,18 +48,19 @@ Sheet1 - 1471 + 2479 0 - 140 + 100 60 false true true + true false true 12632256 - true 1 + true true true false @@ -119,6 +120,7 @@ false false true + true true true true @@ -136,12 +138,16 @@ - http://openoffice.org/2004/office"; xmlns:xlink="http://www.w3.org/1999/xlink"/> + http://openoffice.org/2004/office"; xmlns:xlink="http://www.w3.org/1999/xlink";> + + + + @@ -264,6 +270,10 @@ . + + + + @@ -296,6 +306,10 @@ ) + + + + @@ -1112,26 +1126,18 @@ - - - - - - - - - +
core.git: sc/qa sc/source
sc/qa/unit/data/ods/tdf160329_sortWithHiddenRows.ods |binary sc/qa/unit/scshapetest.cxx | 37 + sc/source/core/data/table3.cxx | 78 +-- 3 files changed, 109 insertions(+), 6 deletions(-) New commits: commit f0a2969d15e3101d7f96a7fe77bca06a5d70f57a Author: Regina Henschel AuthorDate: Sat Apr 27 19:25:32 2024 +0200 Commit: Noel Grandin CommitDate: Wed May 1 09:12:59 2024 +0200 tdf#160329 update objects after row sort is finished The problem was that when the object position was updated to the anchor values by recalcPos() method, the document did not yet have the new state of the hidden rows. As a result, incorrect positions were calculated. Therefore, the update of the position is moved to a place after the update of the visibility of the rows. Sorting rows must not change the visibility of objects. However, updating the visibility of rows sets all objects to visible. Now the visibility state of an object is saved and restored later so that the recalcPos() method receives the correct state for the object. Change-Id: Ia32698c1d45cd81702e6d00c5dfc100f6f6f399c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166799 Reviewed-by: Noel Grandin Tested-by: Noel Grandin diff --git a/sc/qa/unit/data/ods/tdf160329_sortWithHiddenRows.ods b/sc/qa/unit/data/ods/tdf160329_sortWithHiddenRows.ods new file mode 100644 index ..5ba746ad7baa Binary files /dev/null and b/sc/qa/unit/data/ods/tdf160329_sortWithHiddenRows.ods differ diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx index 5aa24ede6ea6..d434084519f3 100644 --- a/sc/qa/unit/scshapetest.cxx +++ b/sc/qa/unit/scshapetest.cxx @@ -62,6 +62,14 @@ static SdrObject* lcl_getSdrObjectWithAssert(ScDocument& rDoc, sal_uInt16 nObjNu return pObj; } +static SdrObject* lcl_getSdrObjectbyName(ScDocument& rDoc, std::u16string_view rName) +{ +ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); +const SdrPage* pPage = pDrawLayer->GetPage(0); +SdrObject* pObj = pPage->GetObjByName(rName); +return pObj; +} + CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf144242_OpenBezier_noSwapWH) { // Shapes, which have rotation incorporated in their points, got erroneously width-height @@ -1295,6 +1303,35 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf160369_groupshape) CPPUNIT_ASSERT_RECTANGLE_EQUAL_WITH_TOLERANCE(aOrigRect, aAfterRect, 1); } +CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf160329_sortWithHiddenRows) +{ +// Load a document, which has images anchored to cell and rows hidden +createScDoc("ods/tdf160329_sortWithHiddenRows.ods"); +ScDocument* pDoc = getScDoc(); + +// Sort the rows +uno::Sequence aArgs1 += { comphelper::makePropertyValue("DbName", u"myRange"_ustr) }; +dispatchCommand(mxComponent, ".uno:SelectDB", aArgs1); +uno::Sequence aArgs2 += { comphelper::makePropertyValue("ByRows", true), +comphelper::makePropertyValue("HasHeader", true), +comphelper::makePropertyValue("Col1", sal_Int32(1)), +comphelper::makePropertyValue("Ascending1", false), +comphelper::makePropertyValue("IncludeImages", true) }; +dispatchCommand(mxComponent, ".uno:DataSort", aArgs2); + +// Make sure objects are on correct position +SdrObject* pObj = lcl_getSdrObjectbyName(*pDoc, std::u16string_view(u"ImageD")); +Point aPos = pObj->GetSnapRect().TopLeft(); +// The position was (3000|2899) without fix. +CPPUNIT_ASSERT_POINT_EQUAL_WITH_TOLERANCE(Point(3000, 5898), aPos, 1); +pObj = lcl_getSdrObjectbyName(*pDoc, std::u16string_view(u"ImageE")); +aPos = pObj->GetSnapRect().TopLeft(); +// The position was (2600|2499) without fix. +CPPUNIT_ASSERT_POINT_EQUAL_WITH_TOLERANCE(Point(2600, 4399), aPos, 1); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 4e06aca8231a..ee00f2d58161 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -911,6 +911,50 @@ void ScTable::SortReorderByColumn( } } +static void backupObjectsVisibility(const std::vector>& rSortedCols, + std::vector>>& rBackup) +{ +size_t nSortedCols = rSortedCols.size(); +for (size_t iCol = 0; iCol < nSortedCols; ++iCol) +{ +std::vector>& rSingleColCellDrawObjects += rSortedCols[iCol]->maCellDrawObjects; +size_t nSingleColCellDrawObjects = rSingleColCellDrawObjects.size(); +std::vector> aColBackup; +for (size_t jRow = 0; jRow < nSingleColCellDrawObjects; ++jRow) +{ +std::vector& rCellDrawObjects = rSingleColCellDrawObjects[jRow]; +std::vector aCellBackup; +for (auto& pObject : rCellDrawObjects) +{ +
core.git: sc/qa sc/source
dev/null |binary sc/qa/unit/data/xlsx/enhancedProtectionRangeShorthand.xlsx |binary sc/qa/unit/subsequent_export_test2.cxx |9 -- sc/source/core/tool/rangelst.cxx |4 sc/source/filter/excel/xestream.cxx|3 sc/source/filter/inc/addressconverter.hxx | 25 - sc/source/filter/oox/addressconverter.cxx | 58 +++-- sc/source/filter/oox/autofilterbuffer.cxx |6 - sc/source/filter/oox/commentsbuffer.cxx|4 sc/source/filter/oox/pivotcachebuffer.cxx |4 sc/source/filter/oox/pivottablebuffer.cxx |4 sc/source/filter/oox/tablebuffer.cxx |4 sc/source/filter/oox/worksheetfragment.cxx |3 13 files changed, 38 insertions(+), 86 deletions(-) New commits: commit cfb913db1b2024f8ff6a55f45742b303107a1924 Author: Justin Luth AuthorDate: Tue Apr 23 20:15:27 2024 -0400 Commit: Miklos Vajna CommitDate: Mon Apr 29 15:59:45 2024 +0200 xlsx import: parse short-hand version of range address In order to indicate the entire row or column (for the benefit of a spreadsheet program that may eventually increase the supported number of rows or columns it supports) a short-handed form of the range can be used like "B:B" for the entire column, or "1:10" for the first 10 rows of all columns. Shorthand is nicer for humans and allows for future expansion of row/column space This reverts 24.8 commit a29d91ac403f1ed431ca95b8b9c290bd354c3ae7 xlsx export: never export short-hand version of range address which reduced the likelihood that we will ever see such a range, because Excel seems to always write out the full address. However, the shorthand version is definitely valid for Excel. Earlier patchsets checked that the new method and the old method returned the same values for all existing unit tests. Change-Id: I7677dfc207771a3095416f728f7cd34a4f75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166570 Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/sc/qa/unit/data/xlsx/enhancedProtectionRangeShorthand.xlsx b/sc/qa/unit/data/xlsx/enhancedProtectionRangeShorthand.xlsx new file mode 100644 index ..1f8a5675e796 Binary files /dev/null and b/sc/qa/unit/data/xlsx/enhancedProtectionRangeShorthand.xlsx differ diff --git a/sc/qa/unit/data/xlsx/protectedRange.xlsx b/sc/qa/unit/data/xlsx/protectedRange.xlsx deleted file mode 100644 index a185ac3598d0.. Binary files a/sc/qa/unit/data/xlsx/protectedRange.xlsx and /dev/null differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index c0b17e11aeb8..1f9ba48df12a 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -1263,15 +1263,14 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf126024XLSX) "External"); } -CPPUNIT_TEST_FIXTURE(ScExportTest2, testProtectedRange) +CPPUNIT_TEST_FIXTURE(ScExportTest2, testEnhancedProtectionRangeShorthand) { -createScDoc("xlsx/protectedRange.xlsx"); +createScDoc("xlsx/enhancedProtectionRangeShorthand.xlsx"); save("Calc Office Open XML"); - xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); -// entire row was being exported as shorthand 'B:B' which LO couldn't read back -assertXPath(pDoc, "//x:protectedRanges/x:protectedRange"_ostr, "sqref"_ostr, "B1:B1048576"); +// the shorthand version was not recognized as a valid range on import +assertXPath(pDoc, "//x:protectedRanges/x:protectedRange[1]"_ostr, "sqref"_ostr, "C:C"); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf91332) diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index 998187b42996..f84c92c7a7ae 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -133,10 +133,6 @@ void ScRangeList::Format( OUString& rStr, ScRefFlags nFlags, const ScDocument& r formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cDelimiter, bool bFullAddressNotation ) const { -// LO's AddressConverter::parseOoxAddress2d cannot import a short-hand address, -// so definitely do not export that way. -assert(eConv != FormulaGrammar::CONV_XL_OOX || bFullAddressNotation); - if (!cDelimiter) cDelimiter = ScCompiler::GetNativeSymbolChar(ocSep); diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index c93cf6f5f34d..32cecf352de3 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -748,8 +748,7 @@ OString XclXmlUtils::ToOString( c
core.git: sc/qa sc/source
sc/qa/uitest/pasteSpecial/tdf160765.py | 34 + sc/source/ui/miscdlgs/inscodlg.cxx |4 ++- 2 files changed, 37 insertions(+), 1 deletion(-) New commits: commit 7e30434655754277bfa7ce7d8ec37b07181d2c92 Author: Andreas Heinisch AuthorDate: Fri Apr 26 20:29:53 2024 +0200 Commit: Andreas Heinisch CommitDate: Mon Apr 29 15:57:20 2024 +0200 tdf#160765 - Paste Special Dialog: Remember comments checkbox After the change of tdf#139858 the comments checkbox was not remembered anymore after closing the dialog. In order to fix this issue, additionally check not only the NOTE flag but also for the ADDNOTES one. Change-Id: I8b24d231313b57a05b7e527c0865686762e5a2b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166762 Reviewed-by: Andreas Heinisch Tested-by: Jenkins diff --git a/sc/qa/uitest/pasteSpecial/tdf160765.py b/sc/qa/uitest/pasteSpecial/tdf160765.py index 0b56be4c2dfa..c0c264432ef4 100755 --- a/sc/qa/uitest/pasteSpecial/tdf160765.py +++ b/sc/qa/uitest/pasteSpecial/tdf160765.py @@ -13,8 +13,42 @@ from libreoffice.calc.document import get_cell_by_position from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.uihelper.calc import enter_text_to_cell from libreoffice.calc.paste_special import reset_default_values +from uitest.uihelper.common import get_state_as_dict class tdf160765(UITestCase): +def test_tdf160765_paste_special_comments_checked(self): +with self.ui_test.create_doc_in_start_center("calc"): +xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + +# Insert a comment in cell A1 +xGridWin.executeAction("SELECT", mkPropertyValues({"CELL":"A1"})) +xArgs = mkPropertyValues({"Text": "Comment 1"}) +self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + +# Copy cell A1 to clipboard +xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) +self.xUITest.executeCommand(".uno:Copy") + +# Paste data using special options (check only comments) +xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) +with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xPasteSpecialDlg: +reset_default_values(self, xPasteSpecialDlg) +xDateTimeChkBox = xPasteSpecialDlg.getChild("datetime") +xDateTimeChkBox.executeAction("CLICK", tuple()) +xTextChkBox = xPasteSpecialDlg.getChild("text") +xTextChkBox.executeAction("CLICK", tuple()) +xNumbersChkBox = xPasteSpecialDlg.getChild("numbers") +xNumbersChkBox.executeAction("CLICK", tuple()) +xCommentsChkBox = xPasteSpecialDlg.getChild("comments") +xCommentsChkBox.executeAction("CLICK", tuple()) + +with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xPasteSpecialDlg: +xCommentsChkBox = xPasteSpecialDlg.getChild("comments") +# Without the fix in place, this test would have failed with +# AssertionError: 'true' != 'false' +# i.e., the comments checkbox was not remembered + self.assertEqual(get_state_as_dict(xCommentsChkBox)["Selected"], "true") + def test_tdf160765_undo_paste_comment(self): with self.ui_test.create_doc_in_start_center("calc") as document: xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") diff --git a/sc/source/ui/miscdlgs/inscodlg.cxx b/sc/source/ui/miscdlgs/inscodlg.cxx index 84292dcd91c4..378b10f37fd0 100644 --- a/sc/source/ui/miscdlgs/inscodlg.cxx +++ b/sc/source/ui/miscdlgs/inscodlg.cxx @@ -231,7 +231,9 @@ void ScInsertContentsDlg::SetInsContentsCmdBits(const InsertDeleteFlags eFlags) mxBtnInsNumbers->set_active((InsertDeleteFlags::VALUE & eFlags) == InsertDeleteFlags::VALUE); mxBtnInsDateTime->set_active((InsertDeleteFlags::DATETIME & eFlags) == InsertDeleteFlags::DATETIME); mxBtnInsStrings->set_active((InsertDeleteFlags::STRING & eFlags) == InsertDeleteFlags::STRING); -mxBtnInsNotes->set_active((InsertDeleteFlags::NOTE & eFlags) == InsertDeleteFlags::NOTE); +// tdf#160765 - additionally check either NOTE or ADDNOTES +mxBtnInsNotes->set_active(((InsertDeleteFlags::NOTE | InsertDeleteFlags::ADDNOTES) & eFlags) + != InsertDeleteFlags::NONE); mxBtnInsFormulas->set_active((InsertDeleteFlags::FORMULA & eFlags) == InsertDeleteFlags::FORMULA); mxBtnInsAttrs->set_active((InsertDeleteFlags::ATTRIB & eFlags) == InsertDeleteFlags::ATTRIB); mxBtnInsObjects->set_active((InsertDeleteFlags::OBJECTS & eFlags) == InsertDeleteFlags::OBJECTS);
core.git: sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx |4 ++-- sc/qa/unit/tiledrendering2/tiledrendering2.cxx |8 sc/source/ui/view/viewfun3.cxx |2 +- 3 files changed, 11 insertions(+), 3 deletions(-) New commits: commit 9f7c961e1c6e7b6aec783ba55a6b8cb6ebcf811d Author: Miklos Vajna AuthorDate: Wed Apr 24 08:22:10 2024 +0200 Commit: Miklos Vajna CommitDate: Wed Apr 24 15:11:12 2024 +0200 cool#8789 sc lok: classify multi-selection with 2 cells as simple The trouble was that even if commit b13c7b31f9ce3c3a25cffd0c35e7ee6b8c2a1895 (cool#8789 sc lok: fix copy for multi-selections, 2024-04-19) made multi-selection copy work, just 2 cells in a multi-selection was classified as a complex selection at a LOK level, while 2 cells next to each other is a simple selection, which is inconsistent. (A LOK client can provide a simpler UI for simple selections.) What happens is that the multi-selection clipboard document had no selection ranges defined, so ScDocument::GetClipArea() returned early, so the numbers in the ScTransferObj ctor were left initialized, which at the end lead to a >1000 cells in ScTransferObj::isComplex(), because we were calculating uninitialized data. Fix the problem by passing a range (that covers all ranges of the multi-selection) to ScViewFunc::CopyToTransferable(), which avoids the wrong col/row start/length, so the selection is classified as simple. Also adapt testRowColumnSelections, which was just meant to check we don't crash, but now the cell under the cell cursor is returned, so the assert about the empty selection would fail. Change-Id: If98212c623fa75adb2ddf628a6e90f3eef450e59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166581 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 6368a7f68b2e..651df397cc71 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -214,7 +214,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testRowColumnSelections) // When we copy this, we don't get anything useful, but we must not crash // (used to happen) aResult = apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), "text/plain;charset=utf-8"_ostr); -CPPUNIT_ASSERT_EQUAL(OString(), aResult); +CPPUNIT_ASSERT_EQUAL("9"_ostr, aResult); // TODO check that we really selected what we wanted here @@ -226,7 +226,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testRowColumnSelections) // When we copy this, we don't get anything useful, but we must not crash // (used to happen) aResult = apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), "text/plain;charset=utf-8"_ostr); -CPPUNIT_ASSERT_EQUAL(OString(), aResult); +CPPUNIT_ASSERT_EQUAL("1"_ostr, aResult); // TODO check that we really selected what we wanted here diff --git a/sc/qa/unit/tiledrendering2/tiledrendering2.cxx b/sc/qa/unit/tiledrendering2/tiledrendering2.cxx index 65a85c685b33..737a0be6a3c8 100644 --- a/sc/qa/unit/tiledrendering2/tiledrendering2.cxx +++ b/sc/qa/unit/tiledrendering2/tiledrendering2.cxx @@ -11,6 +11,8 @@ #include +#include + #include #include #include @@ -203,6 +205,12 @@ CPPUNIT_TEST_FIXTURE(Test, testCopyMultiSelection) // Make sure we get A1+A3 instead of an error: CPPUNIT_ASSERT(xTransferable.is()); + +// Also make sure that just 2 cells is classified as a simple selection: +uno::Reference xTransferable2(xTransferable, uno::UNO_QUERY); +CPPUNIT_ASSERT(xTransferable2.is()); +// Without the fix, the text selection was complex. +CPPUNIT_ASSERT(!xTransferable2->isComplex()); } } diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 615fa4ae89af..e287609906b6 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -462,7 +462,7 @@ rtl::Reference ScViewFunc::CopyToTransferable() { ScDocumentUniquePtr pClipDoc(new ScDocument(SCDOCMODE_CLIP)); // This takes care of the input line and calls CopyToClipMultiRange() for us. -CopyToClip(pClipDoc.get(), /*bCut=*/false, /*bApi=*/true); +CopyToClip(pClipDoc.get(), aRange, /*bCut=*/false, /*bApi=*/true); TransferableObjectDescriptor aObjDesc; return new ScTransferObj(std::move(pClipDoc), std::move(aObjDesc)); }
core.git: sc/qa sc/source
sc/qa/uitest/pasteSpecial/tdf160765.py | 75 + sc/source/ui/view/viewfun3.cxx |3 - 2 files changed, 77 insertions(+), 1 deletion(-) New commits: commit a1694b194c2b3e89250c5b79a69e7dd184b69976 Author: Andreas Heinisch AuthorDate: Mon Apr 22 20:06:50 2024 +0200 Commit: Andreas Heinisch CommitDate: Wed Apr 24 10:06:48 2024 +0200 tdf#160765 - Save content for undo when pasting notes even if no content was changed after pasting special. Otherwise, the undo functionality crashes due to undoing a cell with no content where the annotation indicator will remain (unod/redo of note captions are handled via drawing undo). Change-Id: I7007fce510d6e9896cbda11a1e14a61b5ccb34a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166469 Tested-by: Jenkins Reviewed-by: Stéphane Guillou Reviewed-by: Andreas Heinisch diff --git a/sc/qa/uitest/pasteSpecial/tdf160765.py b/sc/qa/uitest/pasteSpecial/tdf160765.py new file mode 100755 index ..0b56be4c2dfa --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf160765.py @@ -0,0 +1,75 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.paste_special import reset_default_values + +class tdf160765(UITestCase): +def test_tdf160765_undo_paste_comment(self): +with self.ui_test.create_doc_in_start_center("calc") as document: +xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + +# Write text to cell A1 and B1 +enter_text_to_cell(xGridWin, "A1", "A1 sample text") +enter_text_to_cell(xGridWin, "B1", "B1 sample text") + +# Insert a comment in cell B1 +xArgs = mkPropertyValues({"Text": "Comment 1"}) +self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + +# Insert a comment in cell A2 +xGridWin.executeAction("SELECT", mkPropertyValues({"CELL":"A2"})) +xArgs = mkPropertyValues({"Text": "Comment 2"}) +self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + +# Copy cell A2 to clipboard +xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) +self.xUITest.executeCommand(".uno:Copy") + +# Set cursor to cells and paste data using special options (check only comments) +targetCells = ["A1", "B1"] +for index, targetCell in enumerate(targetCells): +xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": targetCell})) +with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xPasteSpecialDlg: +reset_default_values(self, xPasteSpecialDlg) +xDateTimeChkBox = xPasteSpecialDlg.getChild("datetime") +xDateTimeChkBox.executeAction("CLICK", tuple()) +xTextChkBox = xPasteSpecialDlg.getChild("text") +xTextChkBox.executeAction("CLICK", tuple()) +xNumbersChkBox = xPasteSpecialDlg.getChild("numbers") +xNumbersChkBox.executeAction("CLICK", tuple()) +xCommentsChkBox = xPasteSpecialDlg.getChild("comments") +xCommentsChkBox.executeAction("CLICK", tuple()) + +# Undo both inserted comments +self.xUITest.executeCommand(".uno:Undo") +# Without the fix in place, this test would have failed with +# AssertionError: 'Comment 1' != '' +# i.e., the cell does not contain any comment +self.assertEqual("Comment 1", get_cell_by_position(document, 0, 1, 0).Annotation.String) +self.xUITest.executeCommand(".uno:Undo") +self.assertEqual("", get_cell_by_position(document, 0, 0, 0).Annotation.String) + +# Redo both inserted comments +self.xUITest.executeCommand(".uno:Redo") +# Without the fix in place, this test would have failed with +# AssertionError: 'Comment 2' != '' +# i.e., the cell does not contain the restored comment +self.assertEqual("Comment 2", get_cell_by_position(document, 0, 0, 0).Annotation.String) +self.xUITest.executeCommand(".uno:Redo") +# Without the fix in place, this test would have failed with +# AssertionError: 'Comment 2' != '' +# i.e., the cell does not contain the r
core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/protectedRange.xlsx |binary sc/qa/unit/subsequent_export_test2.cxx | 11 +++ sc/source/core/tool/rangelst.cxx |4 sc/source/filter/excel/xestream.cxx |3 ++- 4 files changed, 17 insertions(+), 1 deletion(-) New commits: commit a29d91ac403f1ed431ca95b8b9c290bd354c3ae7 Author: Justin Luth AuthorDate: Thu Apr 18 17:30:06 2024 -0400 Commit: Miklos Vajna CommitDate: Tue Apr 23 08:40:49 2024 +0200 xlsx export: never export short-hand version of range address If all the columns are in focus, LO was exporting A10:XFD11 as 10:11. Amazingly, we can't read that. Seriously? Doesn't Microsoft ever export in shorthand? I thought it would be helpful to find any instances where LO is exporting shorthand, to verify that we really do break import of round-tripped files. I made a brief attempt at fixing the import, but it will require lots of changes and break lots of assumptions. Obviously it can't be a hugely common problem because I didn't find any bug reports about it... I abandoned my attempt because it is too prone to disaster. Change-Id: If59c316d0af466e5cf71ecc459bdf57bb2cd5144 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166269 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna diff --git a/sc/qa/unit/data/xlsx/protectedRange.xlsx b/sc/qa/unit/data/xlsx/protectedRange.xlsx new file mode 100644 index ..a185ac3598d0 Binary files /dev/null and b/sc/qa/unit/data/xlsx/protectedRange.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 9f281928c732..c0b17e11aeb8 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -1263,6 +1263,17 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf126024XLSX) "External"); } +CPPUNIT_TEST_FIXTURE(ScExportTest2, testProtectedRange) +{ +createScDoc("xlsx/protectedRange.xlsx"); +save("Calc Office Open XML"); + +xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pDoc); +// entire row was being exported as shorthand 'B:B' which LO couldn't read back +assertXPath(pDoc, "//x:protectedRanges/x:protectedRange"_ostr, "sqref"_ostr, "B1:B1048576"); +} + CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf91332) { createScDoc("xlsx/tdf91332.xlsx"); diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index f84c92c7a7ae..998187b42996 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -133,6 +133,10 @@ void ScRangeList::Format( OUString& rStr, ScRefFlags nFlags, const ScDocument& r formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cDelimiter, bool bFullAddressNotation ) const { +// LO's AddressConverter::parseOoxAddress2d cannot import a short-hand address, +// so definitely do not export that way. +assert(eConv != FormulaGrammar::CONV_XL_OOX || bFullAddressNotation); + if (!cDelimiter) cDelimiter = ScCompiler::GetNativeSymbolChar(ocSep); diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 32cecf352de3..c93cf6f5f34d 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -748,7 +748,8 @@ OString XclXmlUtils::ToOString( const ScDocument& rDoc, const ScRange& rRange, b OString XclXmlUtils::ToOString( const ScDocument& rDoc, const ScRangeList& rRangeList ) { OUString s; -rRangeList.Format(s, ScRefFlags::VALID, rDoc, FormulaGrammar::CONV_XL_OOX, ' '); +rRangeList.Format(s, ScRefFlags::VALID, rDoc, FormulaGrammar::CONV_XL_OOX, ' ', + /*FullAddressNotation=*/true); return s.toUtf8(); }
core.git: sc/qa sc/source
sc/qa/unit/tiledrendering2/data/multi-selection.ods |binary sc/qa/unit/tiledrendering2/tiledrendering2.cxx | 45 sc/source/ui/view/viewfun3.cxx |8 +++ 3 files changed, 53 insertions(+) New commits: commit 4ffe06a81866a2c9f8598d194e04c114cc083119 Author: Miklos Vajna AuthorDate: Fri Apr 19 08:51:34 2024 +0200 Commit: Miklos Vajna CommitDate: Fri Apr 19 17:14:37 2024 +0200 cool#8789 sc lok: fix copy for multi-selections Select A1+A3 in Calc, copy, try to paste in B1, nothing happens. This is because lok::Document::getSelectionTypeAndText() for a Calc document ends up in ScViewFunc::CopyToTransferable(), which only handles the SC_MARK_SIMPLE* cases. Fix the problem by implementing support for SC_MARK_MULTI, similar to what ScCellShell::ExecuteEdit() does in the SID_COPY case, which also calls CopyToClip(). Keep the test highlevel as the Calc shell doesn't seem to have an easy function to do the same as the Ctrl-click on a cell without duplicating lots of code in the testcase. Change-Id: I641d9db95ca391a4f39d96aeeb33422129262288 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166279 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/sc/qa/unit/tiledrendering2/data/multi-selection.ods b/sc/qa/unit/tiledrendering2/data/multi-selection.ods new file mode 100644 index ..9436aaf93c26 Binary files /dev/null and b/sc/qa/unit/tiledrendering2/data/multi-selection.ods differ diff --git a/sc/qa/unit/tiledrendering2/tiledrendering2.cxx b/sc/qa/unit/tiledrendering2/tiledrendering2.cxx index 058e7deb0883..65a85c685b33 100644 --- a/sc/qa/unit/tiledrendering2/tiledrendering2.cxx +++ b/sc/qa/unit/tiledrendering2/tiledrendering2.cxx @@ -17,6 +17,8 @@ #include #include #include +#include +#include #include @@ -79,6 +81,7 @@ class ViewCallback final public: std::map m_aStateChanges; +tools::Rectangle m_aCellCursorBounds; TestLokCallbackWrapper m_callbackWrapper; ViewCallback() @@ -108,6 +111,20 @@ public: { switch (nType) { +case LOK_CALLBACK_CELL_CURSOR: +{ +uno::Sequence aSeq = comphelper::string::convertCommaSeparated( +OUString::createFromAscii(pPayload)); +m_aCellCursorBounds = tools::Rectangle(); +if (aSeq.getLength() >= 4) +{ +m_aCellCursorBounds.SetLeft(aSeq[0].toInt32()); +m_aCellCursorBounds.SetTop(aSeq[1].toInt32()); +m_aCellCursorBounds.setWidth(aSeq[2].toInt32()); +m_aCellCursorBounds.setHeight(aSeq[3].toInt32()); +} +} +break; case LOK_CALLBACK_STATE_CHANGED: { std::stringstream aStream(pPayload); @@ -159,6 +176,34 @@ CPPUNIT_TEST_FIXTURE(Test, testSidebarLocale) std::string aLocale = it->second.get("locale"); CPPUNIT_ASSERT_EQUAL(std::string("de-DE"), aLocale); } + +CPPUNIT_TEST_FIXTURE(Test, testCopyMultiSelection) +{ +// Given a document with A1 and A3 as selected cells: +ScModelObj* pModelObj = createDoc("multi-selection.ods"); +ViewCallback aView1; +// Get the center of A3: +uno::Sequence aPropertyValues = { +comphelper::makePropertyValue("ToPoint", OUString("$A$3")), +}; +dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues); +Point aPoint = aView1.m_aCellCursorBounds.Center(); +// Go to A1: +aPropertyValues = { +comphelper::makePropertyValue("ToPoint", OUString("$A$1")), +}; +dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues); +// Ctrl-click on A3: +int nCtrl = KEY_MOD1; +pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, aPoint.getX(), aPoint.getY(), 1, + MOUSE_LEFT, nCtrl); + +// When getting the selection: +uno::Reference xTransferable = pModelObj->getSelection(); + +// Make sure we get A1+A3 instead of an error: +CPPUNIT_ASSERT(xTransferable.is()); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index ee2cccf72f35..1c918ff1c04d 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -458,6 +458,14 @@ rtl::Reference ScViewFunc::CopyToTransferable() return new ScTransferObj( std::move(pClipDoc), std::move(aObjDesc) ); } } +else if (eMarkType == SC_MARK_MULTI) +{ +ScDocumentUniquePtr pClipDoc(new ScDocument(SCDOCMODE_CLIP)); +// This takes care of the input line and calls CopyToClipMultiRange() for us. +CopyToClip(pClipDoc.get(), /*bCut=*/false, /*bApi=*/true); +TransferableObjectDescriptor aObjDesc; +return new ScTransferObj(std::move(pClipDoc), std::move(aObjDesc)); +}
core.git: sc/qa sc/source
sc/qa/unit/data/functions/spreadsheet/fods/xlookup.fods | 364 +++- sc/source/core/inc/interpre.hxx |1 sc/source/core/tool/interpr1.cxx| 16 3 files changed, 365 insertions(+), 16 deletions(-) New commits: commit 8df17c340193c89549d8c563b04d015156afa3fb Author: Balazs Varga AuthorDate: Thu Apr 18 19:35:42 2024 +0200 Commit: Balazs Varga CommitDate: Fri Apr 19 09:19:37 2024 +0200 tdf#160711 - sc fix XLOOKUP function search for empty cell Make XLOOKUP function able to search for empty cells. Change-Id: Iefa71b938fe658a59d52e0bf605dbef7a62742c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166263 Tested-by: Jenkins Reviewed-by: Balazs Varga diff --git a/sc/qa/unit/data/functions/spreadsheet/fods/xlookup.fods b/sc/qa/unit/data/functions/spreadsheet/fods/xlookup.fods index f6cfb74b24c5..8da1a44240bd 100644 --- a/sc/qa/unit/data/functions/spreadsheet/fods/xlookup.fods +++ b/sc/qa/unit/data/functions/spreadsheet/fods/xlookup.fods @@ -1,7 +1,7 @@ http://openoffice.org/2004/office"; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:rpt="http://openoffice.org/2005/report"; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/200 4/writer" xmlns:oooc="http://openoffice.org/2004/calc"; xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xforms="http://www.w3.org/2002/xforms"; xmlns:tableooo="http://openoffice.org/2009/table"; xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw"; xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML"; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:dom="http://www.w3.org/2001/xml-events"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xhtml="http://www.w3.org/1999/xhtml"; xmlns:grddl="http://www.w3.org/2003/g/data-view#"; xmlns :css3t="http://www.w3.org/TR/css3-text/"; xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.spreadsheet"> - 2024-01-16T18:30:06.27800PT1H22M11S26LibreOfficeDev/24.8.0.0.alpha0$Windows_X86_64 LibreOffice_project/3f63df475b9c7039d93d0d66c74c4d0ad79894862024-02-27T14:15:45.12500 + 2024-01-16T18:30:06.27800PT1H51M16S29LibreOfficeDev/24.8.0.0.alpha0$Windows_X86_64 LibreOffice_project/24914caa6013b41b6614710322a3084cf4a2aa102024-04-18T19:16:45.85500 0 @@ -14,7 +14,7 @@ 2 - 4 + 0 2 0 0 @@ -31,12 +31,12 @@ 0 - 128 + 133 2 0 0 0 - 46 + 90 0 65 60 @@ -48,7 +48,7 @@ Sheet1 - 2479 + 1677 0 65 60 @@ -1353,6 +1353,194 @@ + + +Ft + + + - + +Ft + + + + +Ft + + + + - + +Ft + + + + +Ft + + + - + +Ft + + + + +Ft + + + + - + +Ft + + + + + + + + - + + + + + + + + + + + - + + + + + + + + + + - + + + + + + + + + + + - + + + + + + + + + + + + - + + + + + + + + - + + + + + + + + + + + + + +Ft + + + - + + +Ft + + + + + - Ft + + + + + + + + + + + + + + + + + - + + + + + + + + - + + + + + + + + + + + + + + + +Ft + + + - + + +Ft + + + + + - + +Ft +
core.git: sc/qa sc/source
sc/qa/unit/ucalc_formula.cxx |2 +- sc/source/core/tool/compiler.cxx |9 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) New commits: commit 969ddf72824942be9755a8d14482d6549a2231ce Author: Balazs Varga AuthorDate: Wed Apr 10 17:48:20 2024 +0100 Commit: Gabor Kelemen CommitDate: Thu Apr 11 16:12:58 2024 +0200 tdf#160616 - Fix SUMPRODUCT calculation is broken in some cases Double refs with operators only trimmable in case of one root paramater. Follow up of: ba0ec4a5d2b025b675410cd18890d1cca3bc5a2f Change-Id: If61fb39696d9539ffc9d32a6ecad79bfa1bf92e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165957 Tested-by: Gabor Kelemen Tested-by: Jenkins Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index adbc9c121042..105c7e4a772d 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -1464,7 +1464,7 @@ CPPUNIT_TEST_FIXTURE(TestFormula, testFormulaAnnotateTrimOnDoubleRefs) { "=SUMPRODUCT(A:A=$C$1; 1-(A:A=$C$1))", -ScRange(0, 0, 0, 0, 1048575, 0), +ScRange(-1, -1, -1, -1, -1, -1), // Has no trimmable double-ref. 0.0, false// Not in matrix mode. }, diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 7b655d72c944..a0529fbe0f4e 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -6468,6 +6468,8 @@ void ScCompiler::AnnotateTrimOnDoubleRefs() // OpCode of the "root" operator (which is already in RPN array). OpCode eOpCode = (*(pCode - 1))->GetOpCode(); +// Param number of the "root" operator (which is already in RPN array). +sal_uInt8 nRootParam = (*(pCode - 1))->GetByte(); // eOpCode can be some operator which does not change with operands with or contains zero values. if (eOpCode == ocSum) { @@ -6560,7 +6562,8 @@ void ScCompiler::AnnotateTrimOnDoubleRefs() // such that one of the operands of ocEqual is a double-ref. // Examples of formula that matches this are: // SUMPRODUCT(IF($A:$A=$L12;$D:$D*G:G)) -// Also in case of DoubleRef arguments around other Binary operators can be trimmable: +// Also in case of DoubleRef arguments around other Binary operators can be trimmable inside one parameter +// of the root operator: // SUMPRODUCT(($D:$D>M47:M47)*($D:$DIsInForceArray()) +// tdf#160616: Double refs with these operators only +// trimmable in case of one paramater +if (!pTok->IsInForceArray() || nRootParam > 1) break; FormulaToken* pLHS = *(ppTok - 1); FormulaToken* pRHS = *(ppTok - 2);
core.git: sc/qa sc/source
sc/qa/unit/tiledrendering/data/two_sheets.ods |binary sc/qa/unit/tiledrendering/tiledrendering.cxx | 144 ++ sc/source/ui/view/tabview5.cxx|4 3 files changed, 104 insertions(+), 44 deletions(-) New commits: commit 834cbc4ccf09853b2830d7ebf6c5ce5c45a357cc Author: Caolán McNamara AuthorDate: Tue Apr 9 11:46:11 2024 +0100 Commit: Caolán McNamara CommitDate: Wed Apr 10 09:47:53 2024 +0200 kit: Update formulas when switching tabs we moved to not forcing a redraw on switching tabs at: commit 9f3ee2b27ceeab175fb865a55cfeabd66fbb128d Date: Sun Jan 14 16:29:56 2024 + don't invalidate when switching tabs but in a scenario (to which two_sheets.ods is updated to capture) where there is no view/user active on a sheet B that depends on cells in sheet A, then when A is updated, B does not update automatically to reflect the changes in A. So, on switching to a tab, do the check for out of date formulas on the switched to tab. Change-Id: Ibbba83119adbd323b42314dbd9bcba6f797e5934 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165911 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/qa/unit/tiledrendering/data/two_sheets.ods b/sc/qa/unit/tiledrendering/data/two_sheets.ods index 6aa1d03be62c..bd9be5f635fe 100644 Binary files a/sc/qa/unit/tiledrendering/data/two_sheets.ods and b/sc/qa/unit/tiledrendering/data/two_sheets.ods differ diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 6a5eb4a18e4a..6368a7f68b2e 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -635,6 +635,14 @@ public: break; } } + +void ClearAllInvalids() +{ +m_bInvalidateTiles = false; +m_aInvalidations.clear(); +m_aInvalidationsParts.clear(); +m_aInvalidationsMode.clear(); +} }; } //namespace @@ -1821,6 +1829,44 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testPageDownInvalidation) CPPUNIT_ASSERT_EQUAL(tools::Rectangle(15, 15, 1230, 225), aView1.m_aInvalidations[0]); } +static Bitmap getTile(ScModelObj* pModelObj, int nTilePosX, int nTilePosY, tools::Long nTileWidth, tools::Long nTileHeight) +{ +size_t nCanvasSize = 1024; +size_t nTileSize = 256; +std::vector aPixmap(nCanvasSize * nCanvasSize * 4, 0); +ScopedVclPtrInstance xDevice(DeviceFormat::WITHOUT_ALPHA); +xDevice->SetBackground(Wallpaper(COL_TRANSPARENT)); +xDevice->SetOutputSizePixelScaleOffsetAndLOKBuffer(Size(nCanvasSize, nCanvasSize), +Fraction(1.0), Point(), aPixmap.data()); +pModelObj->paintTile(*xDevice, nCanvasSize, nCanvasSize, nTilePosX, nTilePosY, nTileWidth, nTileHeight); +xDevice->EnableMapMode(false); +return xDevice->GetBitmap(Point(0, 0), Size(nTileSize, nTileSize)); +} + +namespace +{ +void lcl_typeCharsInCell(const std::string& aStr, SCCOL nCol, SCROW nRow, ScTabViewShell* pView, +ScModelObj* pModelObj, bool bInEdit = false, bool bCommit = true) +{ +if (!bInEdit) +pView->SetCursor(nCol, nRow); + +for (const char& cChar : aStr) +{ +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, cChar, 0); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, cChar, 0); +Scheduler::ProcessEventsToIdle(); +} + +if (bCommit) +{ +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::RETURN); +Scheduler::ProcessEventsToIdle(); +} +} +} //namespace + CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testSheetChangeNoInvalidation) { const bool oldPartInInvalidation = comphelper::LibreOfficeKit::isPartInInvalidation(); @@ -1830,20 +1876,70 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testSheetChangeNoInvalidation) ScViewData* pViewData = ScDocShell::GetViewData(); CPPUNIT_ASSERT(pViewData); +// Set View to initial 100% +pModelObj->setClientVisibleArea(tools::Rectangle(0, 0, 28050, 10605)); +pModelObj->setClientZoom(256, 256, 1920, 1920); + +ScTabViewShell* pView = dynamic_cast(SfxViewShell::Current()); +CPPUNIT_ASSERT(pView); + int nView1 = SfxLokHelper::getView(); ViewCallback aView1; CPPUNIT_ASSERT(!lcl_hasEditView(*pViewData)); SfxLokHelper::setView(nView1); -aView1.m_bInvalidateTiles = false; -aView1.m_aInvalidations.clear(); -aView1.m_aInvalidationsParts.clear(); -aView1.m_aInvalidationsMode.clear(); + +aView1.ClearAllInvalids(); + +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::PAGEDOWN | KEY_MOD1); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::PAGEDOWN | KEY_MOD1); +Scheduler::ProcessEventsToIdle(); +// switching sheets should trigger no unnecessary invalidations +CPPUNIT_ASSERT(!aView1.m_bInvali
core.git: sc/qa sc/source
sc/qa/extras/htmlexporttest.cxx |5 - sc/qa/extras/sccheck_data_pilot_field.cxx |1 - sc/qa/extras/sccheck_data_pilot_table.cxx |1 - sc/qa/extras/sccheck_xcell_ranges_query.cxx |1 - sc/qa/unit/dataproviders_test.cxx |1 - sc/qa/unit/filters-test.cxx |1 - sc/qa/unit/helper/debughelper.hxx |2 -- sc/qa/unit/opencl-test-1.cxx |1 - sc/qa/unit/opencl-test-2.cxx |1 - sc/qa/unit/pivottable_filters_test.cxx|1 - sc/qa/unit/subsequent_filters_test.cxx|1 - sc/qa/unit/ucalc_parallelism.cxx |1 - sc/source/core/opencl/op_addin.cxx|2 -- sc/source/core/opencl/op_array.cxx|2 -- sc/source/core/opencl/op_financial.cxx|2 -- sc/source/core/opencl/op_logical.cxx |2 -- sc/source/core/opencl/op_statistical.cxx |2 -- sc/source/core/tool/formulaparserpool.cxx |1 - sc/source/filter/excel/xepivot.cxx|2 -- sc/source/filter/oox/commentsbuffer.cxx |2 -- sc/source/filter/oox/pivotcachefragment.cxx |1 - sc/source/filter/oox/workbooksettings.cxx |1 - sc/source/ui/Accessibility/AccessibilityHints.cxx |2 -- sc/source/ui/dataprovider/sqldataprovider.cxx |1 - sc/source/ui/dataprovider/xmldataprovider.cxx |2 -- sc/source/ui/dbgui/dapitype.cxx |2 -- sc/source/ui/drawfunc/drawsh2.cxx |1 - sc/source/ui/unoobj/drdefuno.cxx |2 -- sc/source/ui/view/formatsh.cxx|2 -- 29 files changed, 46 deletions(-) New commits: commit d70f461d83e72bfea63526706a07c1e0c4dea66d Author: Gabor Kelemen AuthorDate: Mon Apr 1 09:11:08 2024 +0200 Commit: Gabor Kelemen CommitDate: Wed Apr 10 09:19:27 2024 +0200 tdf#146619 Drop unused 'using namespace' in: sc/ Change-Id: I03478dd4c8e3c2ac88c0fe5e51efd53b09888475 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165695 Tested-by: Jenkins Reviewed-by: Gabor Kelemen diff --git a/sc/qa/extras/htmlexporttest.cxx b/sc/qa/extras/htmlexporttest.cxx index 75d7d9e758ce..859b5a90d008 100644 --- a/sc/qa/extras/htmlexporttest.cxx +++ b/sc/qa/extras/htmlexporttest.cxx @@ -12,11 +12,6 @@ #include #include -using namespace css::uno; -using namespace css::lang; -using namespace css::frame; -using namespace utl; - class ScHTMLExportTest : public UnoApiXmlTest, public HtmlTestTools { public: diff --git a/sc/qa/extras/sccheck_data_pilot_field.cxx b/sc/qa/extras/sccheck_data_pilot_field.cxx index 52cc34481958..6d65b0e12a27 100644 --- a/sc/qa/extras/sccheck_data_pilot_field.cxx +++ b/sc/qa/extras/sccheck_data_pilot_field.cxx @@ -25,7 +25,6 @@ //check the DataPilot of Calc. using namespace css; -using namespace css::lang; namespace sc_apitest { diff --git a/sc/qa/extras/sccheck_data_pilot_table.cxx b/sc/qa/extras/sccheck_data_pilot_table.cxx index 92494fb5833f..1f60ab72d191 100644 --- a/sc/qa/extras/sccheck_data_pilot_table.cxx +++ b/sc/qa/extras/sccheck_data_pilot_table.cxx @@ -27,7 +27,6 @@ //check the DataPilot of Calc. using namespace css; -using namespace css::lang; namespace sc_apitest { diff --git a/sc/qa/extras/sccheck_xcell_ranges_query.cxx b/sc/qa/extras/sccheck_xcell_ranges_query.cxx index f0de7f7deff7..d5e9a5c8905f 100644 --- a/sc/qa/extras/sccheck_xcell_ranges_query.cxx +++ b/sc/qa/extras/sccheck_xcell_ranges_query.cxx @@ -17,7 +17,6 @@ #include using namespace css; -using namespace css::lang; namespace sc_apitest { diff --git a/sc/qa/unit/dataproviders_test.cxx b/sc/qa/unit/dataproviders_test.cxx index 5b1aa76b95ed..7de2e4597262 100644 --- a/sc/qa/unit/dataproviders_test.cxx +++ b/sc/qa/unit/dataproviders_test.cxx @@ -19,7 +19,6 @@ #include using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; class ScDataProvidersTest : public ScModelTestBase { diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index 671f9760d197..4c8661822c4a 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -23,7 +23,6 @@ #include using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; /* Implementation of Filters test */ diff --git a/sc/qa/unit/helper/debughelper.hxx b/sc/qa/unit/helper/debughelper.hxx index 56e9f075f933..2a16d532128a 100644 --- a/sc/qa/unit/helper/debughelper.hxx +++ b/sc/qa/unit/helper/debughelper.hxx @@ -24,6 +24,4 @@ #include -using namespace ::com::sun::star; - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/opencl-test-1.cxx b/sc/qa/unit/opencl-test-1.cxx index 03b4b27230e8..0c450d521120 100644 --- a/sc/qa/unit/opencl-test-1.cxx +++ b/sc/qa/unit/opencl-test-1.cxx @@ -8,7 +8,6 @@ #include using namespace ::com::sun:
core.git: sc/qa sc/source
sc/qa/unit/data/ods/tdf160369_groupshape.ods |binary sc/qa/unit/scshapetest.cxx | 68 +++ sc/source/core/data/drwlayer.cxx |4 + sc/source/filter/xml/xmlexprt.cxx| 41 +++- 4 files changed, 100 insertions(+), 13 deletions(-) New commits: commit 1e1b1d46155163380252093d9d2868351236ce0e Author: Regina Henschel AuthorDate: Sat Apr 6 14:59:38 2024 +0200 Commit: Regina Henschel CommitDate: Mon Apr 8 15:50:40 2024 +0200 tdf#160369 Do not broadcast temporarily group change The position and size of a group needs to be temporarily changed when saving because ODF does not treat hidden rows/cols as zero, but LO does. After saving, these changes have to be undone. The error was that the restore was performed with GetGeoDate/SetGeoData. But SetGeoData includes a broadcast that triggeres recalculations that should not be performed here. Now the change and restore are both done with NbcMove and NbcResize. The import had set a 'logical rectangle', but that is nonsense for a group, because a group does not have a 'logical rectangle'. For a group, none of the special corrections in ScDrawLayer::InitializeCellAnchoredObj are needed. Change-Id: I00adf39e8302492822d2900e41242d188e84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165872 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/sc/qa/unit/data/ods/tdf160369_groupshape.ods b/sc/qa/unit/data/ods/tdf160369_groupshape.ods new file mode 100644 index ..8c26fe8ce582 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf160369_groupshape.ods differ diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx index 98e98aee54f7..5aa24ede6ea6 100644 --- a/sc/qa/unit/scshapetest.cxx +++ b/sc/qa/unit/scshapetest.cxx @@ -1227,6 +1227,74 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf160003_copy_page_anchored) CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->GetObjCount()); } +CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf160369_groupshape) +{ +// The document contains a group spanning range C5:F12. It is currently anchored to page to +// make sure its position does not change. When the group was anchored 'To Cell' and rows or +// columns were hidden before the group, saving changed the anchor position and anchor +// offset. This happened both with using 'resize with cell' and not. +createScDoc("ods/tdf160369_groupshape.ods"); + +// Get document and group object +ScDocument* pDoc = getScDoc(); +SdrObject* pObj = lcl_getSdrObjectWithAssert(*pDoc, 0); + +// Anchor group 'To Cell (resize with cell)' to prepare the test. +ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *pDoc, 0 /*SCTAB*/, true /*bResizeWithCell*/); + +// Hide rows 3 and 4 (UI number), which are before the group +// Hide column D, which is inside the group +pDoc->SetRowHidden(2, 3, 0, true); +pDoc->SetDrawPageSize(0); // trigger recalcpos, otherwise shapes are not changed +pDoc->SetColHidden(3, 3, 0, true); +pDoc->SetDrawPageSize(0); + +// Get geometry of the group +ScDrawObjData* pObjData = ScDrawLayer::GetObjData(pObj); +ScAddress aOrigStart = (*pObjData).maStart; +ScAddress aOrigEnd = (*pObjData).maEnd; +tools::Rectangle aOrigRect = pObj->GetSnapRect(); + +// Save document but do not reload. Saving alone had already caused the error. +save("calc8"); + +// Get geometry of the group again +ScDrawObjData* pAfterObjData = ScDrawLayer::GetObjData(pObj); +ScAddress aAfterStart = (*pAfterObjData).maStart; +ScAddress aAfterEnd = (*pAfterObjData).maEnd; +tools::Rectangle aAfterRect = pObj->GetSnapRect(); + +// verify Orig equals After +CPPUNIT_ASSERT_EQUAL(aOrigStart, aAfterStart); +CPPUNIT_ASSERT_EQUAL(aOrigEnd, aAfterEnd); +CPPUNIT_ASSERT_RECTANGLE_EQUAL_WITH_TOLERANCE(aOrigRect, aAfterRect, 1); + +// The same but with saveAndReload. +createScDoc("ods/tdf160369_groupshape.ods"); +pDoc = getScDoc(); +pObj = lcl_getSdrObjectWithAssert(*pDoc, 0); +ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *pDoc, 0 /*SCTAB*/, true /*bResizeWithCell*/); +pDoc->SetRowHidden(2, 3, 0, true); +pDoc->SetDrawPageSize(0); // trigger recalcpos, otherwise shapes are not changed +pDoc->SetColHidden(3, 3, 0, true); +pDoc->SetDrawPageSize(0); + +saveAndReload("calc8"); + +// Verify geometry is same as before save +pDoc = getScDoc(); +pObj = lcl_getSdrObjectWithAssert(*pDoc, 0); +pAfterObjData = ScDrawLayer::GetObjData(pObj); +aAfterStart = (*pAfterObjData).maStart; +aAfterEnd = (*pAfterObjData).maEnd; +aAfterRect = pObj->GetSnapRect(); + +// verify Orig equals After +CPPUNIT_ASSERT_EQUAL(aOrigStart, aAfterStart); +CPPUNIT_ASSERT_EQUAL(aOrigEnd, aAfterEnd); +CPPUNIT_ASSERT_RECTANGLE_EQUAL_WITH_TOLERANCE(aOrigRect, aAfterRect, 1);
core.git: sc/qa sc/source
sc/qa/unit/data/functions/spreadsheet/fods/sort.fods | 537 ++- sc/source/core/tool/interpr3.cxx | 22 2 files changed, 422 insertions(+), 137 deletions(-) New commits: commit be938f2fb1c0a18658b4170396a22c64b77bf646 Author: Balazs Varga AuthorDate: Fri Apr 5 12:14:45 2024 +0200 Commit: Caolán McNamara CommitDate: Fri Apr 5 16:03:52 2024 +0200 Related tdf#126573 Add Excel2021 array function SORT to Calc In case of cell formulas which have a string result, we need to get the value from the formula result, for sorting/comparing. folow up of commit: 45435a680be065e44eba385bb2523b27b77fb451 Change-Id: I30502dfb013ef78de0e5f2f9d5151cfc60e46942 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165816 Tested-by: Jenkins Reviewed-by: Balazs Varga diff --git a/sc/qa/unit/data/functions/spreadsheet/fods/sort.fods b/sc/qa/unit/data/functions/spreadsheet/fods/sort.fods index af67e19b29cd..e24de0a1892f 100644 --- a/sc/qa/unit/data/functions/spreadsheet/fods/sort.fods +++ b/sc/qa/unit/data/functions/spreadsheet/fods/sort.fods @@ -1,7 +1,7 @@ http://openoffice.org/2004/office"; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:rpt="http://openoffice.org/2005/report"; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/200 4/writer" xmlns:oooc="http://openoffice.org/2004/calc"; xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xforms="http://www.w3.org/2002/xforms"; xmlns:tableooo="http://openoffice.org/2009/table"; xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw"; xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML"; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:dom="http://www.w3.org/2001/xml-events"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xhtml="http://www.w3.org/1999/xhtml"; xmlns:grddl="http://www.w3.org/2003/g/data-view#"; xmlns :css3t="http://www.w3.org/TR/css3-text/"; xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.spreadsheet"> - 2024-01-16T18:30:06.27800PT4H51M18S92LibreOfficeDev/24.8.0.0.alpha0$Windows_X86_64 LibreOffice_project/0437c500018c62f95ad3cd584ed57a6da47f60052024-03-15T12:32:38.48400 + 2024-01-16T18:30:06.27800PT4H58M22S93LibreOfficeDev/24.8.0.0.alpha0$Windows_X86_64 LibreOffice_project/3c10a1a4ce65496877d8fc78359f9b7e59d2703c2024-04-05T12:10:35.33200 0 @@ -14,14 +14,14 @@ 2 - 0 + 1 2 0 0 0 0 0 - 85 + 110 60 true false @@ -30,15 +30,15 @@ false - 0 - 4 + 8 + 98 2 - 0 + 4 0 0 - 0 + 96 0 - 85 + 110 60 true false @@ -48,9 +48,9 @@ Sheet1 - 2495 + 1353 0 - 85 + 110 60 false true @@ -3019,6 +3019,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3040,12 +3083,12 @@ - + - + @@ -3053,12 +3096,12 @@ - + - + @@ -3071,7 +3114,7 @@ - + @@ -3125,7 +3168,7 @@ ???(???) - .00.00, 00:00:00 + .00.00, 00:00:00 @@ -3142,7 +3185,7 @@ - + @@ -3172,7 +3215,7 @@ Sheet - + Result @
core.git: sc/qa sc/source
sc/qa/unit/tiledrendering/data/DocumentWithLongFirstColumn.ods |binary sc/source/ui/view/tabview.cxx |9 +++-- sc/source/ui/view/tabview3.cxx | 16 ++ 3 files changed, 16 insertions(+), 9 deletions(-) New commits: commit 73957dd866b6d5b7144a37ce1477b0c781d5fef6 Author: Caolán McNamara AuthorDate: Mon Mar 25 14:31:11 2024 + Commit: Caolán McNamara CommitDate: Tue Mar 26 18:25:44 2024 +0100 lok: The GridWindow can get reset to a smaller than wanted size This is the same problem as described in: commit 22a185a977f90d706c3e9d182adeaac310b6f348 Date: Thu Jan 11 15:08:21 2024 +0900 sc lok: set the GridWindow size to the client area size + test except that the size of the GridWindow gets reset by UpdateFormulas via UpdateHeaderWidth to the width of the "frame" which is remains at the nominal 800x600 initial size throughout. That only happens if there are enough rows in the document to trigger a check against this, so add some extra content into the test document to trigger the problem, and then guard against this reset for the kit case. Change-Id: Ibf80849929a4c987fd0fe977518336e5115ebdce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165240 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/qa/unit/tiledrendering/data/DocumentWithLongFirstColumn.ods b/sc/qa/unit/tiledrendering/data/DocumentWithLongFirstColumn.ods index 27fc3f45c543..9c03b5ae2f43 100644 Binary files a/sc/qa/unit/tiledrendering/data/DocumentWithLongFirstColumn.ods and b/sc/qa/unit/tiledrendering/data/DocumentWithLongFirstColumn.ods differ diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 79bd6d1e67ff..d82a8a1c7962 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -2760,9 +2760,6 @@ void lcl_ExtendTiledDimension(bool bColumn, const SCCOLROW nEnd, const SCCOLROW if (pModelObj) aNewSize = pModelObj->getDocumentSize(); -if (aOldSize == aNewSize) -return; - if (!pDocSh) return; @@ -2772,10 +2769,14 @@ void lcl_ExtendTiledDimension(bool bColumn, const SCCOLROW nEnd, const SCCOLROW if (pGridWindow) { Size aNewSizePx(aNewSize.Width() * rViewData.GetPPTX(), aNewSize.Height() * rViewData.GetPPTY()); -pGridWindow->SetOutputSizePixel(aNewSizePx); +if (aNewSizePx != pGridWindow->GetOutputSizePixel()) +pGridWindow->SetOutputSizePixel(aNewSizePx); } } +if (aOldSize == aNewSize) +return; + // New area extended to the right/bottom of the sheet after last col/row tools::Rectangle aNewArea(Point(0, 0), aNewSize); // excluding overlapping area with aNewArea diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 7a69d5d82af9..0b8dcb4b8f61 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -424,9 +424,6 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew ) if (pModelObj) aNewSize = pModelObj->getDocumentSize(); -if (aOldSize == aNewSize) -return; - if (!pDocSh) return; @@ -436,10 +433,14 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew ) if (pGridWindow) { Size aNewSizePx(aNewSize.Width() * aViewData.GetPPTX(), aNewSize.Height() * aViewData.GetPPTY()); -pGridWindow->SetOutputSizePixel(aNewSizePx); +if (aNewSizePx != pGridWindow->GetOutputSizePixel()) +pGridWindow->SetOutputSizePixel(aNewSizePx); } } +if (aOldSize == aNewSize) +return; + // New area extended to the right of the sheet after last column // including overlapping area with aNewRowArea tools::Rectangle aNewColArea(aOldSize.getWidth(), 0, aNewSize.getWidth(), aNewSize.getHeight()); @@ -2380,7 +2381,12 @@ void ScTabView::UpdateFormulas(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, if ( aViewData.IsPagebreakMode() ) UpdatePageBreakData(); //! asynchronous -UpdateHeaderWidth(); +bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive(); +// UpdateHeaderWidth can fit the GridWindow widths to the frame, something +// we don't want in kit-mode where we try and match the GridWindow width +// to the tiled area separately +if (!bIsTiledRendering) +UpdateHeaderWidth(); // if in edit mode, adjust edit view area because widths/heights may have changed if ( aViewData.HasEditView( aViewData.GetActivePart() ) )
core.git: sc/qa sc/source
sc/qa/unit/ucalc_formula.cxx |2 +- sc/source/core/tool/compiler.cxx | 35 +++ 2 files changed, 36 insertions(+), 1 deletion(-) New commits: commit ba0ec4a5d2b025b675410cd18890d1cca3bc5a2f Author: Balazs Varga AuthorDate: Wed Mar 20 18:32:44 2024 +0100 Commit: Balazs Varga CommitDate: Fri Mar 22 09:23:58 2024 +0100 tdf#159687 sc formula SUMPRODUCT performance fix: add more binary operators which need to be checked if they are next to a trimmable DoubleRef arguments or not. Example: =SUMPRODUCT(($D:$D>M47:M47)*($D:$D $D:$D and $I:$I columns are trimmable. Recalculation of formulas with a lot of SUMPRODUCT where we comparing full columns could take minutes during editing a sheet. With reducing the size of the compared ranges to the actual data could significantly speed up the recalculation. This takes the recalculation time from ~50 sec to <1 sec on my machine. Note: probabaly the same could be applied to the SUM function. Change-Id: I758660d0b638ef7255bd5a41a96755289b5a2b41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165074 Tested-by: Jenkins Reviewed-by: Noel Grandin Reviewed-by: Balazs Varga diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 105c7e4a772d..adbc9c121042 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -1464,7 +1464,7 @@ CPPUNIT_TEST_FIXTURE(TestFormula, testFormulaAnnotateTrimOnDoubleRefs) { "=SUMPRODUCT(A:A=$C$1; 1-(A:A=$C$1))", -ScRange(-1, -1, -1, -1, -1, -1), // Has no trimmable double-ref. +ScRange(0, 0, 0, 0, 1048575, 0), 0.0, false// Not in matrix mode. }, diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 5e0258b3fd21..152a75f949b1 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -6564,6 +6564,8 @@ void ScCompiler::AnnotateTrimOnDoubleRefs() // such that one of the operands of ocEqual is a double-ref. // Examples of formula that matches this are: // SUMPRODUCT(IF($A:$A=$L12;$D:$D*G:G)) +// Also in case of DoubleRef arguments around other Binary operators can be trimmable: +// SUMPRODUCT(($D:$D>M47:M47)*($D:$DIsInForceArray()) +break; +FormulaToken* pLHS = *(ppTok - 1); +FormulaToken* pRHS = *(ppTok - 2); +StackVar lhsType = pLHS->GetType(); +StackVar rhsType = pRHS->GetType(); +if (lhsType == svDoubleRef && (rhsType == svSingleRef || rhsType == svDoubleRef)) +{ +pLHS->GetDoubleRef()->SetTrimToData(true); +} +if (rhsType == svDoubleRef && (lhsType == svSingleRef || lhsType == svDoubleRef)) +{ +pRHS->GetDoubleRef()->SetTrimToData(true); +} +} +break; case ocPush: break; case ocClose:
core.git: sc/qa sc/source
sc/qa/unit/subsequent_export_test4.cxx | 20 sc/source/filter/excel/xename.cxx | 14 +++--- sc/source/filter/excel/xihelper.cxx|8 sc/source/filter/inc/xihelper.hxx |5 + 4 files changed, 44 insertions(+), 3 deletions(-) New commits: commit 2d472fae8f1223dc969172951d08ff6e4b4f98ba Author: Andreas Heinisch AuthorDate: Wed Mar 6 13:48:46 2024 +0100 Commit: Andreas Heinisch CommitDate: Wed Mar 13 09:28:43 2024 +0100 tdf#148170 - Convert print range to an excel cell range During export from Calc to XLS, ensure that the print range is converted to a valid XLS print range. If the print range exceeds XLS format limitations, it will be appropriately cropped to fit within the constraints. Change-Id: I2b233e4d57dfbe30f491448d2ee2972b8b717ea3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164469 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index 41d76cc9698d..ff453d2ca7ed 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -761,6 +761,26 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf51022_lostPrintRange) CPPUNIT_ASSERT_EQUAL(aRange2, *pDoc->GetPrintRange(0, 1)); } +CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf148170_ExceedXlsPrintRange) +{ +createScDoc(); + +// Create print range that exceeds the xls limitations +const auto aScSheeLimits = ScSheetLimits::CreateDefault(); +ScRange aCalcPrintRange(0, 0, 0, aScSheeLimits.MaxCol(), aScSheeLimits.MaxRow(), 0); +ScDocument* pDoc = getScDoc(); +pDoc->AddPrintRange(0, aCalcPrintRange); + +saveAndReload("MS Excel 97"); + +// Check if print range was shrunk to xls limitations +pDoc = getScDoc(); +CPPUNIT_ASSERT_EQUAL(static_cast(1), pDoc->GetPrintRangeCount(0)); +// Check sc/source/filter/inc/xlconst.hxx for xls limitations +ScRange aXlsPrintRange(0, 0, 0, 16383, 65535, 0); +CPPUNIT_ASSERT_EQUAL(aXlsPrintRange, *pDoc->GetPrintRange(0, 0)); +} + CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf138741_externalLinkSkipUnusedsCrash) { createScDoc("xlsx/tdf138741_externalLinkSkipUnusedsCrash.xlsx"); diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx index 84073da8ff90..8d97ffaadda9 100644 --- a/sc/source/filter/excel/xename.cxx +++ b/sc/source/filter/excel/xename.cxx @@ -36,6 +36,7 @@ #include #include #include +#include using namespace ::oox; using namespace ::com::sun::star; @@ -713,10 +714,17 @@ void XclExpNameManagerImpl::CreateBuiltInNames() aRange.aStart.SetTab( nScTab ); aRange.aEnd.SetTab( nScTab ); aRange.PutInOrder(); -aRangeList.push_back( aRange ); + +// tdf#148170 - convert print range to an excel cell range +XclRange aXclRange(ScAddress::UNINITIALIZED); +// create no warning if ranges are shrunken +if (GetAddressConverter().ConvertRange(aXclRange, aRange, false)) +{ +XclImpAddressConverter::FillRange(aXclRange, aRange); +aRangeList.push_back(aRange); +} } -// create the NAME record (do not warn if ranges are shrunken) -GetAddressConverter().ValidateRangeList( aRangeList, false ); +// create the NAME record if( !aRangeList.empty() ) GetNameManager().InsertBuiltInName( EXC_BUILTIN_PRINTAREA, aRangeList ); } diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx index e095d22018ac..2f05d6722d7a 100644 --- a/sc/source/filter/excel/xihelper.cxx +++ b/sc/source/filter/excel/xihelper.cxx @@ -98,6 +98,14 @@ ScAddress XclImpAddressConverter::CreateValidAddress( // cell range - +void XclImpAddressConverter::FillRange(const XclRange& rXclRange, ScRange& rScRange) +{ +const XclAddress aXclStartAdr = rXclRange.maFirst; +lclFillAddress(rScRange.aStart, aXclStartAdr.mnCol, aXclStartAdr.mnRow, rScRange.aStart.Tab()); +const XclAddress aXclEndAdr = rXclRange.maLast; +lclFillAddress(rScRange.aEnd, aXclEndAdr.mnCol, aXclEndAdr.mnRow, rScRange.aEnd.Tab()); +} + bool XclImpAddressConverter::ConvertRange( ScRange& rScRange, const XclRange& rXclRange, SCTAB nScTab1, SCTAB nScTab2, bool bWarn ) { diff --git a/sc/source/filter/inc/xihelper.hxx b/sc/source/filter/inc/xihelper.hxx index 746259e844e4..fe6ba7ce7a63 100644 --- a/sc/source/filter/inc/xihelper.hxx +++ b/sc/source/filter/inc/xihelper.hxx @@ -71,6 +71,11 @@ public: // cell range - +/** Fills
core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/tdf156814.xlsx|binary sc/qa/unit/ucalc_solver.cxx| 48 +++ sc/source/core/data/SolverSettings.cxx | 51 + 3 files changed, 87 insertions(+), 12 deletions(-) New commits: commit d3049ab4786005c6bd17c66f8edcb98210bf511c Author: Rafael Lima AuthorDate: Fri Mar 8 21:49:47 2024 +0100 Commit: Tomaž Vajngerl CommitDate: Tue Mar 12 15:36:28 2024 +0100 tdf#156814 Remove sheet name if range belongs to the same sheet (Solver) When solver models are imported from XLSX, ranges come with sheet names even when they belong to the same sheet, which clutter the solver dialog. This patch checks when this happens and remove sheet names when the solver model is imported. Change-Id: I3994f1312667946aab330c734ff820e94673d018 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164610 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/sc/qa/unit/data/xlsx/tdf156814.xlsx b/sc/qa/unit/data/xlsx/tdf156814.xlsx new file mode 100644 index ..49e430b41554 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf156814.xlsx differ diff --git a/sc/qa/unit/ucalc_solver.cxx b/sc/qa/unit/ucalc_solver.cxx index 7834597e9c07..f7db19cad59a 100644 --- a/sc/qa/unit/ucalc_solver.cxx +++ b/sc/qa/unit/ucalc_solver.cxx @@ -34,19 +34,19 @@ std::vector SolverTest::CreateConstraintsModelA() std::vector aConstraints; ModelConstraint aConstr1; -aConstr1.aLeftStr = "C1:C10"; +aConstr1.aLeftStr = "$C$1:$C$10"; aConstr1.nOperator = CO_LESS_EQUAL; aConstr1.aRightStr = "100"; aConstraints.push_back(aConstr1); ModelConstraint aConstr2; -aConstr2.aLeftStr = "F5"; +aConstr2.aLeftStr = "$F$5"; aConstr2.nOperator = CO_EQUAL; aConstr2.aRightStr = "500"; aConstraints.push_back(aConstr2); ModelConstraint aConstr3; -aConstr3.aLeftStr = "D1:D5"; +aConstr3.aLeftStr = "$D$1:$D$5"; aConstr3.nOperator = CO_BINARY; aConstr3.aRightStr = ""; aConstraints.push_back(aConstr3); @@ -59,15 +59,15 @@ void SolverTest::TestConstraintsModelA(SolverSettings* pSettings) { std::vector aConstraints = pSettings->GetConstraints(); -CPPUNIT_ASSERT_EQUAL(OUString("C1:C10"), aConstraints[0].aLeftStr); +CPPUNIT_ASSERT_EQUAL(OUString("$C$1:$C$10"), aConstraints[0].aLeftStr); CPPUNIT_ASSERT_EQUAL(CO_LESS_EQUAL, aConstraints[0].nOperator); CPPUNIT_ASSERT_EQUAL(OUString("100"), aConstraints[0].aRightStr); -CPPUNIT_ASSERT_EQUAL(OUString("F5"), aConstraints[1].aLeftStr); +CPPUNIT_ASSERT_EQUAL(OUString("$F$5"), aConstraints[1].aLeftStr); CPPUNIT_ASSERT_EQUAL(CO_EQUAL, aConstraints[1].nOperator); CPPUNIT_ASSERT_EQUAL(OUString("500"), aConstraints[1].aRightStr); -CPPUNIT_ASSERT_EQUAL(OUString("D1:D5"), aConstraints[2].aLeftStr); +CPPUNIT_ASSERT_EQUAL(OUString("$D$1:$D$5"), aConstraints[2].aLeftStr); CPPUNIT_ASSERT_EQUAL(CO_BINARY, aConstraints[2].nOperator); CPPUNIT_ASSERT_EQUAL(OUString(""), aConstraints[2].aRightStr); } @@ -93,19 +93,19 @@ CPPUNIT_TEST_FIXTURE(SolverTest, testSingleModel) CPPUNIT_ASSERT_EQUAL(sal_Int32(0), pSettings->GetParameter(SP_CONSTR_COUNT).toInt32()); // Create a simple model -pSettings->SetParameter(SP_OBJ_CELL, OUString("A1")); +pSettings->SetParameter(SP_OBJ_CELL, OUString("$A$1")); pSettings->SetParameter(SP_OBJ_TYPE, OUString::number(OT_MINIMIZE)); pSettings->SetParameter(SP_OBJ_VAL, OUString::number(0)); -pSettings->SetParameter(SP_VAR_CELLS, OUString("D1:D5")); +pSettings->SetParameter(SP_VAR_CELLS, OUString("$D$1:$D$5")); std::vector aConstraints = CreateConstraintsModelA(); pSettings->SetConstraints(aConstraints); // Test if the model parameters were set -CPPUNIT_ASSERT_EQUAL(OUString("A1"), pSettings->GetParameter(SP_OBJ_CELL)); +CPPUNIT_ASSERT_EQUAL(OUString("$A$1"), pSettings->GetParameter(SP_OBJ_CELL)); CPPUNIT_ASSERT_EQUAL(static_cast(OT_MINIMIZE), pSettings->GetParameter(SP_OBJ_TYPE).toInt32()); CPPUNIT_ASSERT_EQUAL(OUString("0"), pSettings->GetParameter(SP_OBJ_VAL)); -CPPUNIT_ASSERT_EQUAL(OUString("D1:D5"), pSettings->GetParameter(SP_VAR_CELLS)); +CPPUNIT_ASSERT_EQUAL(OUString("$D$1:$D$5"), pSettings->GetParameter(SP_VAR_CELLS)); // Test if the constraints were correctly set before saving CPPUNIT_ASSERT_EQUAL(sal_Int32(3), pSettings->GetParameter(SP_CONSTR_COUNT).toInt32()); @@ -120,11 +120,11 @@ CPPUNIT_TEST_FIXTURE(SolverTest, testSingleModel) CPPUNIT_ASSERT(pSettings); // Test if the model parameters remain set in the file -CPPUNIT_ASSERT_EQUAL(OUString("A1"), pSettings->GetParameter(SP_OBJ_CELL)); +CPPUNIT_ASSERT_EQUAL(OUString("$A$1"), pSettings->GetParameter(SP_OBJ_CELL)); CPPUNIT_ASSERT_EQUAL(static_cast(OT_MINIMIZE), pSettings->GetParameter(SP_O
core.git: sc/qa sc/source
sc/qa/filter/html/html.cxx| 26 ++ sc/source/filter/html/htmlexp.cxx |9 + 2 files changed, 35 insertions(+) New commits: commit 2efe362c99a9fa6e9a71b9b675b025c64b6c7f9d Author: Miklos Vajna AuthorDate: Mon Mar 4 15:00:51 2024 +0100 Commit: Miklos Vajna CommitDate: Mon Mar 4 17:21:17 2024 +0100 tdf#159483 sc HTML copy: handle data-sheets-formula attribute When a formula cell gets copied from Calc to google docs, only the formula result was copied, not the formula. There is a data-sheets-formula attribute on that can describe the formula we have. Fix the problem by extending ScHTMLExport::WriteCell() to emit that. This is more or less the export equivalent of commit 7812adb2ed11a3e08be24d3f2f94d14bfd740c55 (tdf#159483 sc HTML paste: handle data-sheets-formula attribute, 2024-02-12). Change-Id: Iab373ce8a028deb6a2874a8c690e928edf5d79f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164363 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/sc/qa/filter/html/html.cxx b/sc/qa/filter/html/html.cxx index 916dd23981ec..391806be0333 100644 --- a/sc/qa/filter/html/html.cxx +++ b/sc/qa/filter/html/html.cxx @@ -276,6 +276,32 @@ CPPUNIT_TEST_FIXTURE(Test, testCopyFormattedNumber) assertXPath(pHtmlDoc, "(//td)[2]"_ostr, "data-sheets-numberformat"_ostr, "{ \"1\": 2, \"2\": \"#,##0.00\", \"3\": 1}"); } + +CPPUNIT_TEST_FIXTURE(Test, testCopyFormula) +{ +// Given a document with a formula in A3: +createScDoc(); +ScDocument* pDoc = getScDoc(); +ScAddress aCellPos1(/*nColP=*/0, /*nRowP=*/0, /*nTabP=*/0); +pDoc->SetString(aCellPos1, "1000"); +ScAddress aCellPos2(/*nColP=*/0, /*nRowP=*/1, /*nTabP=*/0); +pDoc->SetString(aCellPos2, "2000"); +ScAddress aCellPos3(/*nColP=*/0, /*nRowP=*/2, /*nTabP=*/0); +pDoc->SetFormula(aCellPos3, "=SUM(A1:A2)", pDoc->GetGrammar()); + +// When copying those cells: +ScImportExport aExporter(*pDoc, ScRange(aCellPos1, aCellPos3)); +SvMemoryStream aStream; +CPPUNIT_ASSERT(aExporter.ExportStream(aStream, OUString(), SotClipboardFormatId::HTML)); + +// Then make sure the formula is exported in A3: +aStream.Seek(0); +htmlDocUniquePtr pHtmlDoc = parseHtmlStream(&aStream); +// Without the accompanying fix in place, this test would have failed with: +// - XPath '(//td)[3]' no attribute 'data-sheets-formula' exist +// i.e. only the formula result was exported, not the formula. +assertXPath(pHtmlDoc, "(//td)[3]"_ostr, "data-sheets-formula"_ostr, "=SUM(R[-2]C:R[-1]C)"); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index c2554b7612f1..4413d668b428 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -1172,6 +1172,15 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC } } } + +if (aCell.getType() == CELLTYPE_FORMULA) +{ +// If it's a formula, then also emit that, grammar is R1C1 reference style. +OUString aFormula = aCell.getFormula()->GetFormula( +formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1); +aStrTD.append(" " OOO_STRING_SVTOOLS_HTML_O_DSformula "=\"" ++ HTMLOutFuncs::ConvertStringToHTML(aFormula) + "\""); +} } else {
core.git: sc/qa sc/source
sc/qa/unit/data/ods/tdf160003_page_anchored_object.ods |binary sc/qa/unit/scshapetest.cxx | 24 + sc/source/core/data/drwlayer.cxx |2 - 3 files changed, 25 insertions(+), 1 deletion(-) New commits: commit 199523b553957936dc31b8c3556ef2e47c6bc3a1 Author: Regina Henschel AuthorDate: Sun Mar 3 17:19:49 2024 +0100 Commit: Regina Henschel CommitDate: Mon Mar 4 14:30:21 2024 +0100 tdf#160003 use correct sheet in clipboard for test ..whether a page anchored object is contained in the to be copied area. Change-Id: I816e342770332e6d751b57a38e5ebabe33feb16a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164307 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/sc/qa/unit/data/ods/tdf160003_page_anchored_object.ods b/sc/qa/unit/data/ods/tdf160003_page_anchored_object.ods new file mode 100644 index ..565eb1bf6a26 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf160003_page_anchored_object.ods differ diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx index b5083544f114..5e4827005388 100644 --- a/sc/qa/unit/scshapetest.cxx +++ b/sc/qa/unit/scshapetest.cxx @@ -1207,6 +1207,30 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf154821_shape_in_group) CPPUNIT_ASSERT_RECTANGLE_EQUAL_WITH_TOLERANCE(aRectOrig, aRectReload, 1); } +CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf160003_copy_page_anchored) +{ +// Load a document, which has a chart anchored to page on sheet2. Copy&paste to other document +// had lost the chart object. +createScDoc("ods/tdf160003_page_anchored_object.ods"); + +// copy range with chart +goToCell("$Sheet2.$A$1:$L$24"); +dispatchCommand(mxComponent, ".uno:Copy", {}); + +// close document and create new one +createScDoc(); + +// paste clipboard +goToCell("$Sheet1.$A$1"); +dispatchCommand(mxComponent, ".uno:Paste", {}); + +// Make sure the chart object exists. +ScDocument* pDoc = getScDoc(); +ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); +const SdrPage* pPage = pDrawLayer->GetPage(0); +CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->GetObjCount()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index ed4f4ff4076c..4fac946caf1d 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -1996,7 +1996,7 @@ void ScDrawLayer::CopyFromClip(ScDrawLayer* pClipModel, SCTAB nSourceTab, } else // Object is anchored to page. { -aSrcObjStart = pClipDoc->GetRange(nClipTab, pOldObject->GetCurrentBoundRect()).aStart; +aSrcObjStart = pClipDoc->GetRange(nSourceTab, pOldObject->GetCurrentBoundRect()).aStart; } if (!rSourceRange.Contains(aSrcObjStart)) continue;
core.git: sc/qa sc/source
sc/qa/filter/html/html.cxx| 37 + sc/source/filter/html/htmlexp.cxx | 22 ++ 2 files changed, 59 insertions(+) New commits: commit 17581e684ca701bfd96ed2bf16aa14c3903b74d4 Author: Miklos Vajna AuthorDate: Fri Mar 1 14:14:33 2024 +0100 Commit: Miklos Vajna CommitDate: Mon Mar 4 08:19:22 2024 +0100 tdf#159483 sc HTML copy: handle data-sheets-value attribute for the num case Type 1000 and 2000 into cells in Calc, format them as e.g. a HUF currency, the resulting formatted strings can be copied to google sheets, but the SUM() on them will be 0 (and not 3000). Our own import knows how to read metadata to get the original float value, but our exporter didn't emit these. Fix the problem by adding support for non-boolean float values + number formats in the HTML export. This is more or less export equivalent of commit 789964785a61daab5f8065f006dd7aaf843c7236 (tdf#159483 sc HTML import: handle data-sheets-value attribute for the num case, 2024-02-09). Change-Id: I5acb3724367ce38bd96056dbe4f846cd7bbc5fe2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164213 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sc/qa/filter/html/html.cxx b/sc/qa/filter/html/html.cxx index fb9a436c72a0..916dd23981ec 100644 --- a/sc/qa/filter/html/html.cxx +++ b/sc/qa/filter/html/html.cxx @@ -239,6 +239,43 @@ CPPUNIT_TEST_FIXTURE(Test, testCopyBoolean) assertXPath(pHtmlDoc, "(//td)[1]"_ostr, "data-sheets-value"_ostr, "{ \"1\": 4, \"4\": 1}"); assertXPath(pHtmlDoc, "(//td)[2]"_ostr, "data-sheets-value"_ostr, "{ \"1\": 4, \"4\": 0}"); } + +CPPUNIT_TEST_FIXTURE(Test, testCopyFormattedNumber) +{ +// Given a document with formatted numbers in A1-A2: +createScDoc(); +ScDocument* pDoc = getScDoc(); +sal_Int32 nCheckPos; +SvNumFormatType nType; +sal_uInt32 nFormat; +OUString aNumberFormat("#,##0.00"); +SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); +pFormatter->PutEntry(aNumberFormat, nCheckPos, nType, nFormat); +ScAddress aCellPos1(/*nColP=*/0, /*nRowP=*/0, /*nTabP=*/0); +pDoc->SetNumberFormat(aCellPos1, nFormat); +pDoc->SetString(aCellPos1, "1000"); +ScAddress aCellPos2(/*nColP=*/0, /*nRowP=*/1, /*nTabP=*/0); +pDoc->SetNumberFormat(aCellPos2, nFormat); +pDoc->SetString(aCellPos2, "2000"); + +// When copying those values: +ScImportExport aExporter(*pDoc, ScRange(aCellPos1, aCellPos2)); +SvMemoryStream aStream; +CPPUNIT_ASSERT(aExporter.ExportStream(aStream, OUString(), SotClipboardFormatId::HTML)); + +// Then make sure the values are numbers: +aStream.Seek(0); +htmlDocUniquePtr pHtmlDoc = parseHtmlStream(&aStream); +// Without the accompanying fix in place, this test would have failed with: +// - XPath '(//td)[1]' no attribute 'data-sheets-value' exist +// i.e. only a formatted number string was written, without a float value. +assertXPath(pHtmlDoc, "(//td)[1]"_ostr, "data-sheets-value"_ostr, "{ \"1\": 3, \"3\": 1000}"); +assertXPath(pHtmlDoc, "(//td)[1]"_ostr, "data-sheets-numberformat"_ostr, +"{ \"1\": 2, \"2\": \"#,##0.00\", \"3\": 1}"); +assertXPath(pHtmlDoc, "(//td)[2]"_ostr, "data-sheets-value"_ostr, "{ \"1\": 3, \"3\": 2000}"); +assertXPath(pHtmlDoc, "(//td)[2]"_ostr, "data-sheets-numberformat"_ostr, +"{ \"1\": 2, \"2\": \"#,##0.00\", \"3\": 1}"); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index 1e5dcf24b6c5..c2554b7612f1 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -1146,6 +1146,7 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC nFormat, *pFormatter, &aNonConvertibleChars)); std::optional oJson; +const SvNumberformat* pNumberFormat = nullptr; if (bValueData) { if (nFormat) @@ -1161,6 +1162,14 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC oJson->put("1", static_cast(4)); oJson->put("4", static_cast(fVal)); } +else +{ +// 3 is number. +oJson.emplace(); +oJson->put("1", static_cast(3)); +oJson->put("3", static_cast(fVal)); +pNumberFormat = pFormatEntry; +} } } } @@ -1179,6 +1188,19 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC + HTMLOutFuncs::ConvertStringToHTML(aJsonString) + "\""); } +if (pNumberFormat) +{ +// 2 is a number format. +oJson.emplace(); +oJson->put("1", static_cast(2)); +oJson->put("2", pNumberFormat->GetForma
core.git: sc/qa sc/source
sc/qa/unit/data/functions/spreadsheet/fods/xlookup.fods | 380 +++- sc/source/core/tool/interpr1.cxx| 10 sc/source/core/tool/interpr4.cxx|1 3 files changed, 375 insertions(+), 16 deletions(-) New commits: commit c7664873f8aff4e1fa4f857e87821a49f858a73b Author: Balazs Varga AuthorDate: Tue Feb 27 14:33:53 2024 +0100 Commit: Balazs Varga CommitDate: Wed Feb 28 15:31:23 2024 +0100 tdf#159467 XLOOKUP propagate error only for active paths because XLOOKUP have [if_not_found] optional attribute where a valid match is not found, return the [if_not_found] value you supply. Which can also return an error as a result from another function. If a valid match is not found, and [if_not_found] is missing, #N/A is returned. follow-up for tdf#127293: d9635e9bb42cf2b744b8d2f74633e2a209a8e3fd Change-Id: Ic8727c6b51e947ef767397c29095b93286bc7bd2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164042 Tested-by: Jenkins Tested-by: Gabor Kelemen Reviewed-by: Balazs Varga diff --git a/sc/qa/unit/data/functions/spreadsheet/fods/xlookup.fods b/sc/qa/unit/data/functions/spreadsheet/fods/xlookup.fods index fb464e08d008..f6cfb74b24c5 100644 --- a/sc/qa/unit/data/functions/spreadsheet/fods/xlookup.fods +++ b/sc/qa/unit/data/functions/spreadsheet/fods/xlookup.fods @@ -1,7 +1,7 @@ http://openoffice.org/2004/office"; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:rpt="http://openoffice.org/2005/report"; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/200 4/writer" xmlns:oooc="http://openoffice.org/2004/calc"; xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xforms="http://www.w3.org/2002/xforms"; xmlns:tableooo="http://openoffice.org/2009/table"; xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw"; xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML"; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:dom="http://www.w3.org/2001/xml-events"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xhtml="http://www.w3.org/1999/xhtml"; xmlns:grddl="http://www.w3.org/2003/g/data-view#"; xmlns :css3t="http://www.w3.org/TR/css3-text/"; xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.spreadsheet"> - 2024-01-16T18:30:06.27800PT1H14M20S23LibreOfficeDev/24.8.0.0.alpha0$Windows_X86_64 LibreOffice_project/578d9be50413a4bdc809f8b5f58cc177458f83252024-02-08T21:37:48.96900 + 2024-01-16T18:30:06.27800PT1H22M11S26LibreOfficeDev/24.8.0.0.alpha0$Windows_X86_64 LibreOffice_project/3f63df475b9c7039d93d0d66c74c4d0ad79894862024-02-27T14:15:45.12500 0 @@ -13,8 +13,8 @@ view1 - 4 - 17 + 2 + 4 2 0 0 @@ -30,13 +30,13 @@ false - 4 - 43 + 0 + 128 2 0 0 0 - 24 + 46 0 65 60 @@ -48,7 +48,7 @@ Sheet1 - 1851 + 2479 0 65 60 @@ -1114,6 +1114,245 @@ + + +Ft + + + - + +Ft + + + + +Ft + + + + - + +Ft + + + + +Ft + + + - + +Ft + + + + +Ft + + + + - + +Ft + + + + + . + + . + + + + + . + + . + + + + + . + + + + + . + + + + + : + + + + + + + : + + : + + + + + + + . + + . + + + + : + + + + + + + + - + + + + + + + + + + + - + + + +
core.git: sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx | 46 ++- sc/source/ui/app/inputhdl.cxx| 10 + 2 files changed, 48 insertions(+), 8 deletions(-) New commits: commit 9d3366f5b392418dc83bc0adbe3d215cff4b3605 Author: Caolán McNamara AuthorDate: Tue Feb 27 19:49:41 2024 + Commit: Caolán McNamara CommitDate: Wed Feb 28 10:10:44 2024 +0100 don't use EEControlBits::FORMAT100 in inline editengine for kit mode With multiple users the EditEngine for the first user is created during load of the document, before ScModelObj::initializeForTiledRendering is called, and that sets SetTextWysiwyg(true) ScInputHandler::UpdateRefDevice has... if ( bTextWysiwyg ... ) mpEditEngine->SetControlWord( ... | EEControlBits::FORMAT100 ); That FORMAT100 means that layout for such edit engines is done at a X/Y Scaling of 1 The first users editengine doesn't get any of that set, because TextWysiwyg is not true yet when it's created, and so matches the normal document rendering, but later joiners have TextWysiwyg set, so trigger this alternative path and so the mapmode doesn't match the other case and the two users have different results for the width of text in an active editengine. As it turns out, the results without FORMAT100 are the preferred ones, so make that explicit for kit. Change-Id: I76a78be1fca4af84c493d32bdd43f968ba072452 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164059 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index c9a005fd5136..d6eab7cafea2 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -3562,18 +3562,50 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testInputHandlerSyncedZoom) pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::F2); Scheduler::ProcessEventsToIdle(); -const ScViewData* pViewData = ScDocShell::GetViewData(); -CPPUNIT_ASSERT(pViewData); +const ScViewData* pViewData1 = ScDocShell::GetViewData(); +CPPUNIT_ASSERT(pViewData1); // Get that active EditView -EditView* pEditView = pViewData->GetEditView(SC_SPLIT_BOTTOMLEFT); -CPPUNIT_ASSERT(pEditView); -EditEngine& rEditEngine = pEditView->getEditEngine(); +EditView* pEditView1 = pViewData1->GetEditView(SC_SPLIT_BOTTOMLEFT); +CPPUNIT_ASSERT(pEditView1); +EditEngine& rEditEngine1 = pEditView1->getEditEngine(); // These must match, if they don't then text will have a different width in edit and view modes CPPUNIT_ASSERT_EQUAL_MESSAGE("EditEngine Ref Dev Zoom and ViewData Zoom should match", - pViewData->GetZoomX(), rEditEngine.GetRefMapMode().GetScaleX()); + pViewData1->GetZoomX(), rEditEngine1.GetRefMapMode().GetScaleX()); CPPUNIT_ASSERT_EQUAL_MESSAGE("EditEngine Ref Dev Zoom and ViewData Zoom should match", - pViewData->GetZoomY(), rEditEngine.GetRefMapMode().GetScaleY()); + pViewData1->GetZoomY(), rEditEngine1.GetRefMapMode().GetScaleY()); + +// Create a View #2 +SfxLokHelper::createView(); + pModelObj->initializeForTiledRendering(uno::Sequence()); + +// Set View #2 to the same zoom as View #1 +pModelObj->setClientVisibleArea(tools::Rectangle(0, 0, 17933, 4853)); +pModelObj->setClientZoom(256, 256, 1333, 1333); + +ScTabViewShell* pView2 = dynamic_cast(SfxViewShell::Current()); +CPPUNIT_ASSERT(pView2); +pView2->SetCursor(0, 5); // A6 + +Scheduler::ProcessEventsToIdle(); + +// Activate edit mode in that A6 cell +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::F2); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::F2); +Scheduler::ProcessEventsToIdle(); + +const ScViewData* pViewData2 = ScDocShell::GetViewData(); +CPPUNIT_ASSERT(pViewData2); + +// Get the View #2 EditView +EditView* pEditView2 = pViewData2->GetEditView(SC_SPLIT_BOTTOMLEFT); +CPPUNIT_ASSERT(pEditView2); +EditEngine& rEditEngine2 = pEditView2->getEditEngine(); +CPPUNIT_ASSERT(&rEditEngine1 != &rEditEngine2); +// Before the fix, these had different settings, resulting in the text +// dancing for the second user as they toggle in and out of edit mode, but +// each user should have the same settings. +CPPUNIT_ASSERT_EQUAL(rEditEngine1.GetControlWord(), rEditEngine2.GetControlWord()); } CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testStatusBarLocale) diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 8ea3f33157a9..1b261ac46d77 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -908,7 +908,15 @@ void ScInputHandler::UpdateRefDevice() bool bTextWysiwyg =
core.git: sc/qa sc/source
sc/qa/unit/tiledrendering/data/cell-edit-300zoom-settings.ods |binary sc/qa/unit/tiledrendering/tiledrendering.cxx | 36 ++ sc/source/ui/unoobj/docuno.cxx|3 3 files changed, 39 insertions(+) New commits: commit fa4a68dc3e62bb76bc29309e15741375f2663cb6 Author: Caolán McNamara AuthorDate: Tue Feb 13 17:19:59 2024 + Commit: Caolán McNamara CommitDate: Wed Feb 28 10:10:22 2024 +0100 sync InputHandler zoom on setClientZoom analogous to what SetZoom and ScTabViewShell::Activate do. Otherwise the InputHandler editengine ref device used for cell editing stays at the MapMode stored in the document and doesn't update to stay in sync with the desired rendering so there is a visible mismatch between normal rendering and cell editing rendering. Change-Id: Ifd9b21ab15cc123e0747fcebfdd55f2ddc44bd31 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163389 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/qa/unit/tiledrendering/data/cell-edit-300zoom-settings.ods b/sc/qa/unit/tiledrendering/data/cell-edit-300zoom-settings.ods new file mode 100644 index ..8cfbc4d227bc Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/cell-edit-300zoom-settings.ods differ diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index d371d817ffa5..c9a005fd5136 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -3540,6 +3540,42 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testCellInvalidationDocWithExistingZo 50); } +CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testInputHandlerSyncedZoom) +{ +ScModelObj* pModelObj = createDoc("cell-edit-300zoom-settings.ods"); + +// Set View #1 to initial 150% +pModelObj->setClientVisibleArea(tools::Rectangle(0, 0, 17933, 4853)); +// Before the fix, this zoom would leave the EditEngine reference device +// at the zoom level stored in the document, so normal rendering and +// editing rendering happened with different MapModes +pModelObj->setClientZoom(256, 256, 1333, 1333); + +ScTabViewShell* pView = dynamic_cast(SfxViewShell::Current()); +CPPUNIT_ASSERT(pView); +pView->SetCursor(0, 4); // A5 + +Scheduler::ProcessEventsToIdle(); + +// Activate edit mode in that A5 cell +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::F2); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::F2); +Scheduler::ProcessEventsToIdle(); + +const ScViewData* pViewData = ScDocShell::GetViewData(); +CPPUNIT_ASSERT(pViewData); + +// Get that active EditView +EditView* pEditView = pViewData->GetEditView(SC_SPLIT_BOTTOMLEFT); +CPPUNIT_ASSERT(pEditView); +EditEngine& rEditEngine = pEditView->getEditEngine(); +// These must match, if they don't then text will have a different width in edit and view modes +CPPUNIT_ASSERT_EQUAL_MESSAGE("EditEngine Ref Dev Zoom and ViewData Zoom should match", + pViewData->GetZoomX(), rEditEngine.GetRefMapMode().GetScaleX()); +CPPUNIT_ASSERT_EQUAL_MESSAGE("EditEngine Ref Dev Zoom and ViewData Zoom should match", + pViewData->GetZoomY(), rEditEngine.GetRefMapMode().GetScaleY()); +} + CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testStatusBarLocale) { // Given 2 views, the second's locale is set to German: diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index b59167efef3c..bb36b29068ac 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1081,6 +1081,9 @@ void ScModelObj::setClientZoom(int nTilePixelWidth_, int nTilePixelHeight_, int pViewData->SetZoom(newZoomX, newZoomY, true); if (ScTabViewShell* pViewShell = pViewData->GetViewShell()) pViewShell->SyncGridWindowMapModeFromDrawMapMode(); +// sync zoom to Input Handler like ScTabViewShell::Activate does +if (ScInputHandler* pHdl = SC_MOD()->GetInputHdl()) +pHdl->SetRefScale(pViewData->GetZoomX(), pViewData->GetZoomY()); // refresh our view's take on other view's cursors & selections pViewData->GetActiveWin()->updateKitOtherCursors();
core.git: sc/qa sc/source
sc/qa/unit/tiledrendering/data/edit-shape-text.ods |binary sc/qa/unit/tiledrendering/tiledrendering.cxx | 54 + sc/source/ui/view/gridwin4.cxx |7 +- 3 files changed, 59 insertions(+), 2 deletions(-) New commits: commit 021c93bbf36a9d25ad43da0aefd39d5e7bfdad19 Author: Caolán McNamara AuthorDate: Thu Feb 15 21:41:34 2024 + Commit: Caolán McNamara CommitDate: Sat Feb 17 20:17:58 2024 +0100 kit: editing text in shapes outside the topleft tile has misplaced text keep into account the zoom factor as we do elsewhere Change-Id: I024ba16c2ef47c01f05ffb8630ec0ae3b2d2e5a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163515 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163526 Tested-by: Jenkins diff --git a/sc/qa/unit/tiledrendering/data/edit-shape-text.ods b/sc/qa/unit/tiledrendering/data/edit-shape-text.ods new file mode 100644 index ..95fea6d3f738 Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/edit-shape-text.ods differ diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index c7d43a141a84..d371d817ffa5 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -3712,6 +3712,60 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testExtendedAreasDontOverlap) aView1.m_aInvalidations[1].Top()); } +static Bitmap getTile(ScModelObj* pModelObj, int nTilePosX, int nTilePosY, tools::Long nTileWidth, tools::Long nTileHeight) +{ +size_t nCanvasSize = 1024; +size_t nTileSize = 256; +std::vector aPixmap(nCanvasSize * nCanvasSize * 4, 0); +ScopedVclPtrInstance xDevice(DeviceFormat::WITHOUT_ALPHA); +xDevice->SetBackground(Wallpaper(COL_TRANSPARENT)); +xDevice->SetOutputSizePixelScaleOffsetAndLOKBuffer(Size(nCanvasSize, nCanvasSize), +Fraction(1.0), Point(), aPixmap.data()); +pModelObj->paintTile(*xDevice, nCanvasSize, nCanvasSize, nTilePosX, nTilePosY, nTileWidth, nTileHeight); +xDevice->EnableMapMode(false); +return xDevice->GetBitmap(Point(0, 0), Size(nTileSize, nTileSize)); +} + +// Ensure that editing a shape not in the topleft tile has its text shown inside the shape +// center while editing +CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testEditShapeText) +{ +ScModelObj* pModelObj = createDoc("edit-shape-text.ods"); + +// Set View to initial 100% +pModelObj->setClientVisibleArea(tools::Rectangle(0, 0, 28050, 10605)); +pModelObj->setClientZoom(256, 256, 1920, 1920); + +ScTabViewShell* pView = dynamic_cast(SfxViewShell::Current()); +CPPUNIT_ASSERT(pView); + +const bool bShapeSelected = pView->SelectObject(u"Shape 1"); +CPPUNIT_ASSERT(bShapeSelected); + + CPPUNIT_ASSERT(ScDocShell::GetViewData()->GetScDrawView()->AreObjectsMarked()); + +Scheduler::ProcessEventsToIdle(); + +// Enter editing mode, shape start with no text +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::F2); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::F2); + +Scheduler::ProcessEventsToIdle(); + +// Grab a snapshot of the center of the shape +Bitmap aBitmapBefore = getTile(pModelObj, 4096, 3584, 15360, 7680); + +// reuse this to type into the active shape edit +lcl_typeCharsInCell("MMM", 0, 0, pView, pModelObj, true, false); + +// Grab a new snapshot of the center of the shape +Bitmap aBitmapAfter = getTile(pModelObj, 4096, 3584, 15360, 7680); + +// Without the fix, the text is not inside this tile and the before and +// after are the same. +CPPUNIT_ASSERT_MESSAGE("Text is not visible", aBitmapBefore != aBitmapAfter); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 463b5ac32704..6cd017d271b2 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -1062,8 +1062,11 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI aOrigin.setY(o3tl::convert(aOrigin.getY(), o3tl::Length::twip, o3tl::Length::px) + aOutputData.nScrY); -aOrigin = Point(aOrigin.getX() * twipFactor, -aOrigin.getY() * twipFactor); + +// keep into account the zoom factor +aOrigin = Point((aOrigin.getX() * twipFactor) / static_cast(aDrawMode.GetScaleX()), + (aOrigin.getY() * twipFactor) / static_cast(aDrawMode.GetScaleY())); + MapMode aNew = rDevice.GetMapMode(); aNew.SetOrigin(aOrigin); rDevice.SetMapMode(aNew);
core.git: sc/qa sc/source
sc/qa/uitest/data/tdf129701.ods|binary sc/qa/uitest/pasteSpecial/tdf129701-PasteUnformated.py | 70 + sc/source/ui/docshell/impex.cxx| 19 +++- 3 files changed, 86 insertions(+), 3 deletions(-) New commits: commit e66ffda7c7f1e78dbca082ff7549ded121dc7356 Author: Laurent Balland AuthorDate: Thu Dec 7 19:38:54 2023 +0100 Commit: Laurent Balland CommitDate: Sat Feb 17 08:58:55 2024 +0100 tdf#129701 Skip empty cell: treat last column When pasting data as text, with "Skip empty cells" not checked, empty cells in the last column of the source do not empty cells in destination, because there is nothing anymore to paste and while loop stops. This commit adds a flag to check if the last cell of each line is empty, and treat it if "Skip empty cells" is not checked. Add UITest to Copy data with empty cells; Paste Unformatted text, without "Skip empty cells"; Check data with empty cells in last column. Change-Id: Idec823fb1c27b803f49c6d13d6c757ef0f41e437 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160951 Tested-by: Jenkins Reviewed-by: Laurent Balland diff --git a/sc/qa/uitest/data/tdf129701.ods b/sc/qa/uitest/data/tdf129701.ods new file mode 100644 index ..94407fcd566e Binary files /dev/null and b/sc/qa/uitest/data/tdf129701.ods differ diff --git a/sc/qa/uitest/pasteSpecial/tdf129701-PasteUnformated.py b/sc/qa/uitest/pasteSpecial/tdf129701-PasteUnformated.py new file mode 100644 index ..596cd62f8bc1 --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf129701-PasteUnformated.py @@ -0,0 +1,70 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_url_for_data_file +from uitest.uihelper.common import get_state_as_dict +from libreoffice.calc.document import get_cell_by_position + +class tdf129701(UITestCase): + +def test_tdf129701(self): + +with self.ui_test.load_file(get_url_for_data_file("tdf129701.ods")): +xCalcDoc = self.xUITest.getTopFocusWindow() +gridwin = xCalcDoc.getChild("grid_window") +gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "D21:F25"})) +self.xUITest.executeCommand(".uno:Copy") + +gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "J4"})) +with self.ui_test.execute_dialog_through_command(".uno:PasteUnformatted", close_button="ok") as xDialog: + +xSkipEmtyCells = xDialog.getChild("skipemptycells") +xSeparatedBy = xDialog.getChild("toseparatedby") +xTab = xDialog.getChild("tab") +xMergeDelimiters = xDialog.getChild("mergedelimiters") + +xSeparatedBy.executeAction("CLICK", tuple()) +if get_state_as_dict(xTab)['Selected'] == 'false': +xTab.executeAction("CLICK", tuple()) +if get_state_as_dict(xMergeDelimiters)['Selected'] == 'true': +xMergeDelimiters.executeAction("CLICK", tuple()) +if get_state_as_dict(xSkipEmtyCells)['Selected'] == 'true': +xSkipEmtyCells.executeAction("CLICK", tuple()) +# Check wether Skip empty cells is unselected +self.assertEqual('false', get_state_as_dict(xSkipEmtyCells)['Selected']) + +document = self.ui_test.get_component() +# Without the fix in place, this test would have failed with +# non empty cells in column 11 + +self.assertEqual( "x1", get_cell_by_position(document, 0, 9, 3).getString()) +self.assertEqual( "" , get_cell_by_position(document, 0,10, 3).getString()) +self.assertEqual( "" , get_cell_by_position(document, 0,11, 3).getString()) +self.assertEqual("A16", get_cell_by_position(document, 0,12, 3).getString()) +self.assertEqual( "" , get_cell_by_position(document, 0, 9, 4).getString()) +self.assertEqual( "x2", get_cell_by_position(document, 0,10, 4).getString()) +self.assertEqual( "" , get_cell_by_position(document, 0,11, 4).getString()) +self.assertEqual("A17", get_cell_by_position(document, 0,12, 4).getString()) +self.assertEqual( "" , get_cell_by_position(document, 0, 9, 5).getString()) +self.assertEqual( "" , get_cell_by_position(document, 0,10, 5).getString()) +self.assertEqual( "x3", get_cell_by_position(document, 0,11, 5).getString()) +self
core.git: sc/qa sc/source
sc/qa/filter/html/html.cxx| 25 + sc/source/filter/html/htmlexp.cxx | 35 ++- 2 files changed, 55 insertions(+), 5 deletions(-) New commits: commit 411158832462b1077a8f5dc6379f2056f2338249 Author: Miklos Vajna AuthorDate: Thu Feb 15 08:09:51 2024 +0100 Commit: Miklos Vajna CommitDate: Thu Feb 15 12:43:36 2024 +0100 tdf#159483 sc HTML copy: handle data-sheets-value attribute for the bool case Similar to commit f8c95cf93ce9ab8b9b78f3af03411d0cc2e195ba (tdf#159483 sc HTML import: handle data-sheets-value attribute for the bool case, 2024-02-08). Change-Id: I25ce8c81bd906ac0fb912e125e061516a604e786 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163419 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/sc/qa/filter/html/html.cxx b/sc/qa/filter/html/html.cxx index e0d7977c8000..fb9a436c72a0 100644 --- a/sc/qa/filter/html/html.cxx +++ b/sc/qa/filter/html/html.cxx @@ -214,6 +214,31 @@ CPPUNIT_TEST_FIXTURE(Test, testCopyText) htmlDocUniquePtr pHtmlDoc = parseHtmlStream(&aStream); assertXPath(pHtmlDoc, "//td"_ostr, "data-sheets-value"_ostr, "{ \"1\": 2, \"2\": \"01\"}"); } + +CPPUNIT_TEST_FIXTURE(Test, testCopyBoolean) +{ +// Given a document with boolean values in A1-A2: +createScDoc(); +ScDocument* pDoc = getScDoc(); +ScAddress aCellPos1(/*nColP=*/0, /*nRowP=*/0, /*nTabP=*/0); +pDoc->SetString(aCellPos1, "TRUE"); +ScAddress aCellPos2(/*nColP=*/0, /*nRowP=*/1, /*nTabP=*/0); +pDoc->SetString(aCellPos2, "FALSE"); + +// When copying those values: +ScImportExport aExporter(*pDoc, ScRange(aCellPos1, aCellPos2)); +SvMemoryStream aStream; +CPPUNIT_ASSERT(aExporter.ExportStream(aStream, OUString(), SotClipboardFormatId::HTML)); + +// Then make sure the values are booleans: +aStream.Seek(0); +htmlDocUniquePtr pHtmlDoc = parseHtmlStream(&aStream); +// Without the accompanying fix in place, this test would have failed with: +// - XPath '//td' no attribute 'data-sheets-value' exist +// i.e. metadata was missing to avoid converting TRUE to text. +assertXPath(pHtmlDoc, "(//td)[1]"_ostr, "data-sheets-value"_ostr, "{ \"1\": 4, \"4\": 1}"); +assertXPath(pHtmlDoc, "(//td)[2]"_ostr, "data-sheets-value"_ostr, "{ \"1\": 4, \"4\": 0}"); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index a2f14f6eff43..1e5dcf24b6c5 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -88,6 +88,8 @@ #include #include #include +#include +#include using ::editeng::SvxBorderLine; using namespace ::com::sun::star; @@ -1143,13 +1145,36 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC aStrTD.append(HTMLOutFuncs::CreateTableDataOptionsValNum(bValueData, fVal, nFormat, *pFormatter, &aNonConvertibleChars)); -if (!bValueData) +std::optional oJson; +if (bValueData) +{ +if (nFormat) +{ +const SvNumberformat* pFormatEntry = pFormatter->GetEntry(nFormat); +if (pFormatEntry) +{ +OUString aNumStr = pFormatEntry->GetFormatstring(); +if (aNumStr == "BOOLEAN") +{ +// 4 is boolean. +oJson.emplace(); +oJson->put("1", static_cast(4)); +oJson->put("4", static_cast(fVal)); +} +} +} +} +else { // 2 is text. -tools::JsonWriter aJson; -aJson.put("1", static_cast(2)); -aJson.put("2", pDoc->GetString(aPos)); -OUString aJsonString = OUString::fromUtf8(aJson.finishAndGetAsOString()); +oJson.emplace(); +oJson->put("1", static_cast(2)); +oJson->put("2", pDoc->GetString(aPos)); +} + +if (oJson) +{ +OUString aJsonString = OUString::fromUtf8(oJson->finishAndGetAsOString()); aStrTD.append(" " OOO_STRING_SVTOOLS_HTML_O_DSval "=\"" + HTMLOutFuncs::ConvertStringToHTML(aJsonString) + "\""); }
core.git: sc/qa sc/source
sc/qa/filter/html/html.cxx| 22 ++ sc/source/filter/html/htmlexp.cxx | 26 ++ 2 files changed, 48 insertions(+) New commits: commit 4e2a4fbeb7c44cc47b3cf803cbcc6cba63b3d481 Author: Miklos Vajna AuthorDate: Wed Feb 14 09:35:14 2024 +0100 Commit: Miklos Vajna CommitDate: Wed Feb 14 11:45:17 2024 +0100 tdf#159483 sc HTML export: handle data-sheets-value attribute for the text case HTML pasting "'01" from google sheets to Calc worked already, but HTML copying from Calc still converted 01 to 1. What's required is to emit a general marker in the HTML output and then the correct data-sheets-value attribute on the relevant element. Add a way to inject a marker in ScHTMLExport::WriteBody() (so data-sheets-* is considered at all) and extend ScHTMLExport::WriteCell() to write the data-sheets-value attribute for the text case as a start. Other types like booleans are not yet handled at export time. Change-Id: Ib66e92c84235797cb4731e73d0a5b6286b6f3ab3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163328 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/sc/qa/filter/html/html.cxx b/sc/qa/filter/html/html.cxx index c6112e357d80..e0d7977c8000 100644 --- a/sc/qa/filter/html/html.cxx +++ b/sc/qa/filter/html/html.cxx @@ -192,6 +192,28 @@ CPPUNIT_TEST_FIXTURE(Test, testPasteSingleCell) pDoc->GetFormula(/*col=*/2, /*row=*/0, /*tab=*/0)); CPPUNIT_ASSERT_EQUAL(static_cast(3), pDoc->GetValue(/*col=*/2, /*row=*/0, /*tab=*/0)); } + +CPPUNIT_TEST_FIXTURE(Test, testCopyText) +{ +// Given a document with 01 in A1: +createScDoc(); +ScDocument* pDoc = getScDoc(); +ScAddress aCellPos(/*nColP=*/0, /*nRowP=*/0, /*nTabP=*/0); +pDoc->SetString(aCellPos, "'01"); + +// When copying that text from A1: +ScImportExport aExporter(*pDoc, aCellPos); +SvMemoryStream aStream; +CPPUNIT_ASSERT(aExporter.ExportStream(aStream, OUString(), SotClipboardFormatId::HTML)); + +// Then make sure A1 is text: +// Without the accompanying fix in place, this test would have failed with: +// - XPath '//td' no attribute 'data-sheets-value' exist +// i.e. metadata was missing to avoid converting 01 to 1 (number). +aStream.Seek(0); +htmlDocUniquePtr pHtmlDoc = parseHtmlStream(&aStream); +assertXPath(pHtmlDoc, "//td"_ostr, "data-sheets-value"_ostr, "{ \"1\": 2, \"2\": \"01\"}"); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index 2a3cb6a4f8ae..a2f14f6eff43 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -87,6 +87,7 @@ #include #include #include +#include using ::editeng::SvxBorderLine; using namespace ::com::sun::star; @@ -671,6 +672,20 @@ void ScHTMLExport::WriteBody() } rStrm.WriteChar( '>' ); OUT_LF(); + +// A marker right after can be used, so that data-sheets-* attributes are considered +// at all. This is disabled by default. +OString aMarker; +char* pEnv = getenv("SC_DEBUG_HTML_MARKER"); +if (pEnv) +{ +aMarker = pEnv; +} +else if (comphelper::LibreOfficeKit::isActive()) +{ +aMarker = ""_ostr; +} +rStrm.WriteOString(aMarker); } if ( bAll ) @@ -1128,6 +1143,17 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC aStrTD.append(HTMLOutFuncs::CreateTableDataOptionsValNum(bValueData, fVal, nFormat, *pFormatter, &aNonConvertibleChars)); +if (!bValueData) +{ +// 2 is text. +tools::JsonWriter aJson; +aJson.put("1", static_cast(2)); +aJson.put("2", pDoc->GetString(aPos)); +OUString aJsonString = OUString::fromUtf8(aJson.finishAndGetAsOString()); +aStrTD.append(" " OOO_STRING_SVTOOLS_HTML_O_DSval "=\"" + + HTMLOutFuncs::ConvertStringToHTML(aJsonString) + "\""); +} + TAG_ON(aStrTD.makeStringAndClear()); //write the note for this as the first thing in the tag
core.git: sc/qa sc/source
sc/qa/filter/html/data/single-cell.html |1 sc/qa/filter/html/html.cxx | 24 + sc/source/filter/html/htmlpars.cxx | 57 +++- sc/source/filter/inc/htmlpars.hxx |4 ++ 4 files changed, 70 insertions(+), 16 deletions(-) New commits: commit c0da56cb3e9f9678cae7142dee03fb706a2aebd9 Author: Miklos Vajna AuthorDate: Tue Feb 13 08:11:54 2024 +0100 Commit: Miklos Vajna CommitDate: Tue Feb 13 11:48:25 2024 +0100 tdf#159483 sc HTML paste: handle data-sheets- attributes on a span Copy multiple cells, including a formula from google sheets to Calc, the formula is handled as a formula by the HTML paste. Do the same for a single cell, then only the result is pasted. The trouble is that the data-sheets-* attributes appear on elements for multiple cells, but they appear on a for a single cell. Fix the problem by extending ScHTMLLayoutParser::ProcToken() to handle the HtmlTokenId::SPAN_ON token and share the code between the and handler, so this markup works in both cases. Note that this is the paste handler, the no changes to the normal HTML import are made for now. Change-Id: Id749df9062d8fcb9a2f0acd928585a304efaae28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163291 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/sc/qa/filter/html/data/single-cell.html b/sc/qa/filter/html/data/single-cell.html new file mode 100644 index ..0b5613f7e2be --- /dev/null +++ b/sc/qa/filter/html/data/single-cell.html @@ -0,0 +1 @@ +3 diff --git a/sc/qa/filter/html/html.cxx b/sc/qa/filter/html/html.cxx index 83e35d9f8281..c6112e357d80 100644 --- a/sc/qa/filter/html/html.cxx +++ b/sc/qa/filter/html/html.cxx @@ -168,6 +168,30 @@ CPPUNIT_TEST_FIXTURE(Test, testPasteTdAsFormula) pDoc->GetFormula(/*col=*/2, /*row=*/0, /*tab=*/0)); CPPUNIT_ASSERT_EQUAL(static_cast(3), pDoc->GetValue(/*col=*/2, /*row=*/0, /*tab=*/0)); } + +CPPUNIT_TEST_FIXTURE(Test, testPasteSingleCell) +{ +// Given a document with '1' in A1 and '2' in B1: +createScDoc(); +ScDocument* pDoc = getScDoc(); +pDoc->SetValue(ScAddress(0, 0, 0), 1.0); +pDoc->SetValue(ScAddress(1, 0, 0), 2.0); + +// When pasting SUM(A1:B1) into C1: +ScAddress aCellPos(/*nColP=*/2, /*nRowP=*/0, /*nTabP=*/0); +ScImportExport aImporter(*pDoc, aCellPos); +SvFileStream aFile(createFileURL(u"single-cell.html"), StreamMode::READ); +CPPUNIT_ASSERT(aImporter.ImportStream(aFile, OUString(), SotClipboardFormatId::HTML)); + +// Then make sure C1 is a sum and it evaluates to 3: +// Without the accompanying fix in place, this test would have failed with: +// - Expected: =SUM(A1:B1) +// - Actual : +// i.e. data-sheets-* on worked, but not on . +CPPUNIT_ASSERT_EQUAL(OUString("=SUM(A1:B1)"), + pDoc->GetFormula(/*col=*/2, /*row=*/0, /*tab=*/0)); +CPPUNIT_ASSERT_EQUAL(static_cast(3), pDoc->GetValue(/*col=*/2, /*row=*/0, /*tab=*/0)); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 5db879db75dd..830dac6f6615 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -992,6 +992,34 @@ IMPL_LINK( ScHTMLLayoutParser, HTMLImportHdl, HtmlImportInfo&, rInfo, void ) } } +void ScHTMLLayoutParser::HandleDataSheetsAttributes(const HTMLOptions& rOptions) +{ +for (const auto& rOption : rOptions) +{ +switch (rOption.GetToken()) +{ +case HtmlOptionId::DSVAL: +{ +ParseDataSheetsValue(rOption.GetString(), mxActEntry->pValStr, mxActEntry->pNumStr); +break; +} +case HtmlOptionId::DSNUM: +{ +ParseDataSheetsNumberformat(rOption.GetString(), mxActEntry->pNumStr); +break; +} +case HtmlOptionId::DSFORMULA: +{ +ParseDataSheetsFormula(rOption.GetString(), mxActEntry->moFormulaStr, + mxActEntry->moFormulaGrammar); +break; +} +default: +break; +} +} +} + void ScHTMLLayoutParser::TableDataOn( HtmlImportInfo* pInfo ) { if ( bInCell ) @@ -1072,26 +1100,12 @@ void ScHTMLLayoutParser::TableDataOn( HtmlImportInfo* pInfo ) mxActEntry->pNumStr = rOption.GetString(); } break; -case HtmlOptionId::DSVAL: -{ -ParseDataSheetsValue(rOption.GetString(), mxActEntry->pValStr, mxActEntry->pNumStr); -} -break; -case HtmlOptionId::DSNUM: -{ -ParseDataSheetsNumberformat(rOption.GetString(), mxActEntry->pNumStr); -} -break; -case
core.git: sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx | 22 +- sc/source/ui/inc/tabview.hxx |1 + sc/source/ui/view/tabview3.cxx | 14 +- sc/source/ui/view/tabview5.cxx | 22 -- 4 files changed, 35 insertions(+), 24 deletions(-) New commits: commit 2004d0f616540d134845178cfe9f9e074131b3af Author: Caolán McNamara AuthorDate: Sun Jan 14 16:29:56 2024 + Commit: Caolán McNamara CommitDate: Tue Feb 13 11:19:11 2024 +0100 don't invalidate when switching tabs Change-Id: If013bb2a2d4de32da21ef6a86cc2237c6e75c0e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162049 Tested-by: Jenkins CollaboraOffice Reviewed-by: Michael Meeks (cherry picked from commit 9f3ee2b27ceeab175fb865a55cfeabd66fbb128d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163294 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 85f9c235f450..c7d43a141a84 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1824,13 +1824,12 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testPageDownInvalidation) CPPUNIT_ASSERT_EQUAL(tools::Rectangle(15, 15, 1230, 225), aView1.m_aInvalidations[0]); } -CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testSheetChangeInvalidation) +CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testSheetChangeNoInvalidation) { const bool oldPartInInvalidation = comphelper::LibreOfficeKit::isPartInInvalidation(); comphelper::LibreOfficeKit::setPartInInvalidation(true); ScModelObj* pModelObj = createDoc("two_sheets.ods"); -ScDocument* pDoc = pModelObj->GetDocument(); ScViewData* pViewData = ScDocShell::GetViewData(); CPPUNIT_ASSERT(pViewData); @@ -1846,19 +1845,8 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testSheetChangeInvalidation) pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::PAGEDOWN | KEY_MOD1); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::PAGEDOWN | KEY_MOD1); Scheduler::ProcessEventsToIdle(); -CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); -CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); -const ScSheetLimits& rLimits = pDoc->GetSheetLimits(); -CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1280 * rLimits.GetMaxColCount(), - 256 * rLimits.GetMaxRowCount()), - aView1.m_aInvalidations[0]); -CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 10, 10), aView1.m_aInvalidations[1]); -CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidationsParts.size()); -CPPUNIT_ASSERT_EQUAL(pModelObj->getPart(), aView1.m_aInvalidationsParts[0]); -CPPUNIT_ASSERT_EQUAL(pModelObj->getPart(), aView1.m_aInvalidationsParts[1]); -CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidationsMode.size()); -CPPUNIT_ASSERT_EQUAL(pModelObj->getEditMode(), aView1.m_aInvalidationsMode[0]); -CPPUNIT_ASSERT_EQUAL(pModelObj->getEditMode(), aView1.m_aInvalidationsMode[1]); +// switching sheets should trigger no invalidations +CPPUNIT_ASSERT(!aView1.m_bInvalidateTiles); comphelper::LibreOfficeKit::setPartInInvalidation(oldPartInInvalidation); } @@ -1884,7 +1872,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testInsertDeletePageInvalidation) })); dispatchCommand(mxComponent, ".uno:Insert", aArgs); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); -CPPUNIT_ASSERT_EQUAL(size_t(6), aView1.m_aInvalidations.size()); +CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 10, 10), aView1.m_aInvalidations[0]); CPPUNIT_ASSERT_EQUAL(2, pModelObj->getParts()); @@ -1896,7 +1884,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testInsertDeletePageInvalidation) })); dispatchCommand(mxComponent, ".uno:Remove", aArgs2); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); -CPPUNIT_ASSERT_EQUAL(size_t(5), aView1.m_aInvalidations.size()); +CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 10, 10), aView1.m_aInvalidations[0]); CPPUNIT_ASSERT_EQUAL(1, pModelObj->getParts()); } diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx index 93f1b60e5759..de8324898814 100644 --- a/sc/source/ui/inc/tabview.hxx +++ b/sc/source/ui/inc/tabview.hxx @@ -268,6 +268,7 @@ private: DECL_STATIC_LINK(ScTabView, InstallLOKNotifierHdl, void*, vcl::ILibreOfficeKitNotifier*); voidUpdateHighlightOverlay(); +voidImplTabChanged(bool bSameTabButMoved); protected: voidUpdateHeaderWidth( const ScVSplitPos* pWhich = nullptr, diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui
core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/PivotTable_CachedDefinitionAndDataInSync.xlsx |binary sc/qa/unit/data/xlsx/PivotTable_CachedDefinitionAndDataNotInSync_SheetColumnsRemoved_WithCacheData.xlsx |binary sc/qa/unit/data/xlsx/PivotTable_CachedDefinitionAndDataNotInSync_SheetColumnsRemoved_WithoutCacheData.xlsx |binary sc/qa/unit/pivottable_filters_test.cxx | 63 ++ sc/source/filter/oox/pivottablebuffer.cxx | 18 ++ 5 files changed, 78 insertions(+), 3 deletions(-) New commits: commit 9af4b5254cbe6a6770ebe78ba14074266b05471e Author: Tomaž Vajngerl AuthorDate: Sat Feb 10 00:38:35 2024 +0900 Commit: Tomaž Vajngerl CommitDate: Sat Feb 10 01:11:44 2024 +0100 sc: pivot table not correct when data and PT cache is not in sync It can happen that the pivot table is not updated and the sheet data is changed so much that it doesn't match the pivot table cached definitions. This is a perfectly valid scenario and nothing should be wrong (the pivot table can just be updated once loaded). At XLSX import we should always check the cached definitions, because the pivot table description is made using the cached data, not the actual data. The issue can occur when looking up the name of a PT field we however didn't check the cached definition but checked the sheet data, so because the indices changed so much (many columns were removed in the sheet data) we can not find the actual field name. The solution is simple - get the field name from the cached pivot table definition. Change-Id: I3b5b33f33f3c484f0b66b97ac97200d9913edcfe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163197 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/sc/qa/unit/data/xlsx/PivotTable_CachedDefinitionAndDataInSync.xlsx b/sc/qa/unit/data/xlsx/PivotTable_CachedDefinitionAndDataInSync.xlsx new file mode 100644 index ..f425f978cb50 Binary files /dev/null and b/sc/qa/unit/data/xlsx/PivotTable_CachedDefinitionAndDataInSync.xlsx differ diff --git a/sc/qa/unit/data/xlsx/PivotTable_CachedDefinitionAndDataNotInSync_SheetColumnsRemoved_WithCacheData.xlsx b/sc/qa/unit/data/xlsx/PivotTable_CachedDefinitionAndDataNotInSync_SheetColumnsRemoved_WithCacheData.xlsx new file mode 100644 index ..0cb21cd3259c Binary files /dev/null and b/sc/qa/unit/data/xlsx/PivotTable_CachedDefinitionAndDataNotInSync_SheetColumnsRemoved_WithCacheData.xlsx differ diff --git a/sc/qa/unit/data/xlsx/PivotTable_CachedDefinitionAndDataNotInSync_SheetColumnsRemoved_WithoutCacheData.xlsx b/sc/qa/unit/data/xlsx/PivotTable_CachedDefinitionAndDataNotInSync_SheetColumnsRemoved_WithoutCacheData.xlsx new file mode 100644 index ..91297320b985 Binary files /dev/null and b/sc/qa/unit/data/xlsx/PivotTable_CachedDefinitionAndDataNotInSync_SheetColumnsRemoved_WithoutCacheData.xlsx differ diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index 8d6b1ad5d39e..31fb49351c8c 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -2647,6 +2647,69 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testPivotTableCompactLayoutXLSX) testThis(*getScDoc()); } +CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, + testPivotTableXLSX_OutOfSyncPivotTableCachedDefinitionImport) +{ +// This tests that a out-of-sync sheet data and pivot table cached definitions +// still get imported correctly as expected. + +// It is perfectly valid that the sheet data and pivot table are out-of-sync, +// but even if the sheet data is heavily modified, the pivot table should still +// be imported. + +// The test document has columns named A-K where only A and K are used in the +// pivot table. The columns B-J were removed in the sheet data, but the pivot table +// was not updated, so the cached data still has those and the pivot table +// description still relies on those columns to be present. + +auto testThis = [](ScDocument& rDocument) { +ScDPCollection* pDPs = rDocument.GetDPCollection(); +CPPUNIT_ASSERT_MESSAGE("Failed to get a live ScDPCollection instance.", pDPs); +CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be exactly one pivot table instance.", size_t(1), + pDPs->GetCount()); + +const ScDPObject* pDPObj = &(*pDPs)[0]; +CPPUNIT_ASSERT(pDPObj); +ScDPSaveData* pSaveData = pDPObj->GetSaveData(); +CPPUNIT_ASSERT(pSaveData); + +// Do we have a dim named "A" +ScDPSaveDimension* pSaveDimA = pSaveData->GetExistingDimensionByName(u"A"); +CPPUNIT_ASSERT(pSaveDimA); + +// Do we have a dim named "K" +ScDPSaveDime
core.git: sc/qa sc/source
sc/qa/unit/data/functions/spreadsheet/fods/xlookup.fods | 79 +-- sc/source/core/tool/interpr1.cxx| 107 ++-- 2 files changed, 108 insertions(+), 78 deletions(-) New commits: commit 41192a36796155f8cd6ac733f5ef84767edf300f Author: Balazs Varga AuthorDate: Fri Feb 9 00:07:41 2024 +0100 Commit: Balazs Varga CommitDate: Fri Feb 9 13:23:51 2024 +0100 Related: tdf#127293 Fix function XLOOKUP with nested XLOOKUP functions to return reference of cells what other functions can use (e.g.:SUM): =SUM(XLOOKUP(B3,B6:B10,E6:E10):XLOOKUP(C3,B6:B10,E6:E10)) XLOOKUP function returns a reference to a range of cell(s). Change-Id: I06007aba7017315fc02a92b120f842244b7cc3c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163129 Tested-by: Jenkins Reviewed-by: Balazs Varga diff --git a/sc/qa/unit/data/functions/spreadsheet/fods/xlookup.fods b/sc/qa/unit/data/functions/spreadsheet/fods/xlookup.fods index 49ecf573b50c..fb464e08d008 100644 --- a/sc/qa/unit/data/functions/spreadsheet/fods/xlookup.fods +++ b/sc/qa/unit/data/functions/spreadsheet/fods/xlookup.fods @@ -1,7 +1,7 @@ http://openoffice.org/2004/office"; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:rpt="http://openoffice.org/2005/report"; xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/200 4/writer" xmlns:oooc="http://openoffice.org/2004/calc"; xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xforms="http://www.w3.org/2002/xforms"; xmlns:tableooo="http://openoffice.org/2009/table"; xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw"; xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML"; xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:dom="http://www.w3.org/2001/xml-events"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xhtml="http://www.w3.org/1999/xhtml"; xmlns:grddl="http://www.w3.org/2003/g/data-view#"; xmlns :css3t="http://www.w3.org/TR/css3-text/"; xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.spreadsheet"> - 2024-01-16T18:30:06.27800PT1H12M22LibreOfficeDev/24.8.0.0.alpha0$Windows_X86_64 LibreOffice_project/2b1f5fa987f02ec8014dbf6837c6b090faf11f2d2024-02-01T11:50:13.78900 + 2024-01-16T18:30:06.27800PT1H14M20S23LibreOfficeDev/24.8.0.0.alpha0$Windows_X86_64 LibreOffice_project/578d9be50413a4bdc809f8b5f58cc177458f83252024-02-08T21:37:48.96900 0 @@ -13,8 +13,8 @@ view1 - 2 - 0 + 4 + 17 2 0 0 @@ -30,13 +30,13 @@ false - 1 - 115 + 4 + 43 2 0 0 0 - 0 + 24 0 65 60 @@ -48,7 +48,7 @@ Sheet1 - 1837 + 1851 0 65 60 @@ -126,7 +126,7 @@ true - Munkalap1 + Sheet1 Sheet2 @@ -1612,9 +1612,6 @@ - - - @@ -1719,7 +1716,7 @@ ???(???) - .00.00, 00:00:00 + .00.00, 00:00:00 @@ -1998,10 +1995,10 @@ - #HIÁNYZIK + #N/A - #HIÁNYZIK + #N/A IGAZ @@ -2161,10 +2158,10 @@ - #HIÁNYZIK + #N/A - #HIÁNYZIK + #N/A IGAZ @@ -2509,10 +2506,10 @@ - #HIÁNYZIK + #N/A - #HIÁNYZIK + #N/A IGAZ @@ -2524,10 +2521,10 @@ - #HIÁNYZIK + #N/A - #HIÁNYZIK + #N/A IGAZ @@ -2712,7 +2709,7 @@ -
core.git: sc/qa sc/source
sc/qa/filter/html/data/bool.html |8 sc/qa/filter/html/html.cxx | 33 + sc/source/filter/html/htmlpars.cxx | 33 +++-- 3 files changed, 64 insertions(+), 10 deletions(-) New commits: commit f8c95cf93ce9ab8b9b78f3af03411d0cc2e195ba Author: Miklos Vajna AuthorDate: Thu Feb 8 08:20:53 2024 +0100 Commit: Miklos Vajna CommitDate: Thu Feb 8 15:00:51 2024 +0100 tdf#159483 sc HTML import: handle data-sheets-value attribute for the bool case Copy a cell with boolean TRUE and FALSE from google docs to Calc, the paste result is a TRUE and a FALSE string. The problem is that boolean is meant to be a float 0 or 1 with custom cell format, but we don't build this doc model. Fix the problem by ParseDataSheetsValue() to write the properties of the cell similar to what the normal HTML import would extract from our own markup, like: TRUE This requires passing around both the value and the numbering properties, since the cell format just decides it's a boolean, but the cell value will decide if it's TRUE or FALSE. Change-Id: Id558ced56e02bbe24330d82c3998b047dc8febdb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163108 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/sc/qa/filter/html/data/bool.html b/sc/qa/filter/html/data/bool.html new file mode 100644 index ..8fe27993f1ec --- /dev/null +++ b/sc/qa/filter/html/data/bool.html @@ -0,0 +1,8 @@ + + +WAHR + + +FALSCH + + diff --git a/sc/qa/filter/html/html.cxx b/sc/qa/filter/html/html.cxx index ba50361e927e..6ab2cc7fb0b7 100644 --- a/sc/qa/filter/html/html.cxx +++ b/sc/qa/filter/html/html.cxx @@ -15,6 +15,8 @@ #include #include +#include +#include #include #include @@ -83,6 +85,37 @@ CPPUNIT_TEST_FIXTURE(Test, testPasteTdAsText) // i.e. data-sheets-value was ignored on paste. CPPUNIT_ASSERT_EQUAL(CELLTYPE_STRING, eCellType); } + +CPPUNIT_TEST_FIXTURE(Test, testPasteTdAsBools) +{ +// Given an empty document: +createScDoc(); + +// When pasting HTML with bool cells: +ScDocument* pDoc = getScDoc(); +ScAddress aCellPos(/*nColP=*/0, /*nRowP=*/0, /*nTabP=*/0); +ScImportExport aImporter(*pDoc, aCellPos); +SvFileStream aFile(createFileURL(u"bool.html"), StreamMode::READ); +SvMemoryStream aMemory; +aMemory.WriteStream(aFile); +aMemory.Seek(0); +CPPUNIT_ASSERT(aImporter.ImportStream(aMemory, OUString(), SotClipboardFormatId::HTML)); + +// Then make sure A1's type is bool, value is true: +sal_uInt32 nNumberFormat = pDoc->GetNumberFormat(/*col=*/0, /*row=*/0, /*tab=*/0); +const SvNumberformat* pNumberFormat = pDoc->GetFormatTable()->GetEntry(nNumberFormat); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: BOOLEAN +// - Actual : General +// i.e. data-sheets-value's bool case was ignored. +CPPUNIT_ASSERT_EQUAL(OUString("BOOLEAN"), pNumberFormat->GetFormatstring()); +CPPUNIT_ASSERT_EQUAL(static_cast(1), pDoc->GetValue(/*col=*/0, /*row=*/0, /*tab=*/0)); +// And make sure A2's type is bool, value is true: +nNumberFormat = pDoc->GetNumberFormat(/*col=*/0, /*row=*/1, /*tab=*/0); +pNumberFormat = pDoc->GetFormatTable()->GetEntry(nNumberFormat); +CPPUNIT_ASSERT_EQUAL(OUString("BOOLEAN"), pNumberFormat->GetFormatstring()); +CPPUNIT_ASSERT_EQUAL(static_cast(0), pDoc->GetValue(/*col=*/0, /*row=*/1, /*tab=*/0)); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 1a7eff2d4ff8..12872dc7237f 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -78,7 +78,7 @@ using namespace ::com::sun::star; namespace { /// data-sheets-value from google sheets, value is a JSON. -void ParseDataSheetsValue(const OUString& rDataSheetsValue, sal_uInt32& rNumberFormat) +void ParseDataSheetsValue(const OUString& rDataSheetsValue, std::optional& rVal, std::optional& rNum) { // data-sheets-value from google sheets, value is a JSON. OString aEncodedOption = rDataSheetsValue.toUtf8(); @@ -91,10 +91,27 @@ void ParseDataSheetsValue(const OUString& rDataSheetsValue, sal_uInt32& rNumberF if (it != aTree.not_found()) { int nValueType = std::stoi(it->second.get_value()); -// 2 is text. -if (nValueType == 2) +switch (nValueType) { -rNumberFormat = NF_STANDARD_FORMAT_TEXT; +case 2: +{ +// 2 is text. +// See SfxHTMLParser::GetTableDataOptionsValNum(), we leave the parse and a number +// language unspecified. +rNum = ";;@"; +break; +} +case 4: +{ +// 4 is boolean. +
core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/tdf159581_optimalRowHeight.xlsx |binary sc/qa/unit/subsequent_filters_test2.cxx | 11 +++ sc/source/core/data/dociter.cxx |2 +- 3 files changed, 12 insertions(+), 1 deletion(-) New commits: commit 648c7c0f17125fd77d29be3c0611e1ab92f36b7f Author: Justin Luth AuthorDate: Tue Feb 6 21:08:36 2024 -0500 Commit: Justin Luth CommitDate: Wed Feb 7 17:40:16 2024 +0100 tdf#159581 sc: fix multi-sheet ScDocRowHeightUpdater Apparently it was caching the first sheet's row height, and applying it to every other sheet. AFAICS, the only time this ever ran against multiple sheets was during import time, so that is why it wasn't easily noticed before 24.2 when XLSX started using it on import. make CppunitTest_sc_subsequent_filters_test2 \ CPPUNIT_TEST_NAME=testTdf159581_optimalRowHeight Change-Id: Ic4e4dd335fa48d02acbc85cfad35feb8eca7597b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163066 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sc/qa/unit/data/xlsx/tdf159581_optimalRowHeight.xlsx b/sc/qa/unit/data/xlsx/tdf159581_optimalRowHeight.xlsx new file mode 100644 index ..8df77208045f Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf159581_optimalRowHeight.xlsx differ diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx index b0042d9878d6..7f6dae6df6ee 100644 --- a/sc/qa/unit/subsequent_filters_test2.cxx +++ b/sc/qa/unit/subsequent_filters_test2.cxx @@ -159,6 +159,17 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testTdf123026_optimalRowHeight) CPPUNIT_ASSERT_GREATER(2000, nHeight); } +CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testTdf159581_optimalRowHeight) +{ +createScDoc("xlsx/tdf159581_optimalRowHeight.xlsx"); +SCTAB nTab = 1; +SCROW nRow = 0; // row 1 +int nHeight = convertTwipToMm100(getScDoc()->GetRowHeight(nRow, nTab, false)); + +// Without the fix, this was 2027. It should be 450. +CPPUNIT_ASSERT_LESS(500, nHeight); +} + CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testCustomNumFormatHybridCellODS) { createScDoc("ods/custom-numfmt-hybrid-cell.ods"); diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 4fcbcb792cd9..bb4e77d27f1d 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -1683,13 +1683,13 @@ void ScDocRowHeightUpdater::updateAll(const bool bOnlyUsedRows) ScProgress aProgress(mrDoc.GetDocumentShell(), ScResId(STR_PROGRESS_HEIGHTING), nCellCount, true); Fraction aZoom(1, 1); -sc::RowHeightContext aCxt(mrDoc.MaxRow(), mfPPTX, mfPPTY, aZoom, aZoom, mpOutDev); sal_uInt64 nProgressStart = 0; for (SCTAB nTab = 0; nTab < mrDoc.GetTableCount(); ++nTab) { if (!ValidTab(nTab) || !mrDoc.maTabs[nTab]) continue; +sc::RowHeightContext aCxt(mrDoc.MaxRow(), mfPPTX, mfPPTY, aZoom, aZoom, mpOutDev); SCCOL nEndCol = 0; SCROW nEndRow = mrDoc.MaxRow(); if (!bOnlyUsedRows || mrDoc.GetPrintArea(nTab, nEndCol, nEndRow))
core.git: sc/qa sc/source
sc/qa/uitest/calc_tests8/navigator.py |3 +++ sc/source/ui/navipi/navipi.cxx|2 +- 2 files changed, 4 insertions(+), 1 deletion(-) New commits: commit 12d1c9a7000ac9bc816852d658562bb2c0de6bb1 Author: Caolán McNamara AuthorDate: Sun Jan 28 19:58:55 2024 + Commit: Caolán McNamara CommitDate: Mon Jan 29 16:31:16 2024 +0100 use existing timer to refresh notes later Change-Id: Ic91b8930216b4099ed8af0265497120f9aad0917 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162672 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/qa/uitest/calc_tests8/navigator.py b/sc/qa/uitest/calc_tests8/navigator.py index 9c1769dcf49d..3c4eb1fe1dff 100644 --- a/sc/qa/uitest/calc_tests8/navigator.py +++ b/sc/qa/uitest/calc_tests8/navigator.py @@ -185,6 +185,7 @@ class navigator(UITestCase): def test_tdf158652(self): with self.ui_test.create_doc_in_start_center("calc"): +xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') xCalcDoc = self.xUITest.getTopFocusWindow() xGridWin = xCalcDoc.getChild("grid_window") @@ -199,10 +200,12 @@ class navigator(UITestCase): commentText = mkPropertyValues({"Text":"CommentText"}) self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", commentText) +xToolkit.waitUntilAllIdlesDispatched() xComments = xContentBox.getChild("6") self.assertEqual(len(xComments.getChildren()), 1) self.xUITest.executeCommand(".uno:DeleteNote") +xToolkit.waitUntilAllIdlesDispatched() xComments = xContentBox.getChild("6") self.assertEqual(len(xComments.getChildren()), 0) diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index ae95220eeffb..a58491f58dd1 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -540,7 +540,7 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint ) m_xLbEntries->Refresh( ScContentId::GRAPHIC ); m_xLbEntries->Refresh( ScContentId::OLEOBJECT ); m_xLbEntries->Refresh( ScContentId::DRAWING ); -m_xLbEntries->Refresh( ScContentId::NOTE ); +aContentIdle.Start(); // Do not search notes immediately break; case SfxHintId::ScAreaLinksChanged:
core.git: sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx | 47 +-- sc/source/ui/view/tabview.cxx|8 ++-- 2 files changed, 49 insertions(+), 6 deletions(-) New commits: commit ac1cafad398b13a831de913e11143760fd6b822b Author: Caolán McNamara AuthorDate: Mon Jan 22 17:30:27 2024 + Commit: Caolán McNamara CommitDate: Tue Jan 23 20:26:21 2024 +0100 produce non-overlapping invalidation rects on extending calc tiled area the intent is to create two rects, one for the area extended to the right and another for the area extended to the bottom, but they overlap so they end up merged and a single rect of the entire sheet is created which is defeats the original intention. Change-Id: Ie5b46ee1a36780d9f7a90ed11ebfd1264c17477a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162412 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162448 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index eeaabd962b5f..702194664eb5 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1920,7 +1920,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testGetRowColumnHeadersInvalidation) Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); -CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 49725, 13005), aView1.m_aInvalidations[0]); +CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(26775, 0), Size(22950, 13005)), aView1.m_aInvalidations[0]); // Extend area top-to-bottom aView1.m_bInvalidateTiles = false; @@ -1931,7 +1931,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testGetRowColumnHeadersInvalidation) Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); -CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 49725, 19380), aView1.m_aInvalidations[0]); +CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(0, 13005), Size(49725, 6375)), aView1.m_aInvalidations[0]); // Extend area left-to-right aView1.m_bInvalidateTiles = false; @@ -1942,7 +1942,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testGetRowColumnHeadersInvalidation) Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); -CPPUNIT_ASSERT_EQUAL(tools::Rectangle(49725, 0, 75225, 19380), aView1.m_aInvalidations[0]); +CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(49725, 0), Size(25500, 19380)), aView1.m_aInvalidations[0]); } CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testJumpHorizontallyInvalidation) @@ -3706,6 +3706,47 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testLongFirstColumnMouseClick) CPPUNIT_ASSERT_EQUAL(SCROW(0), ScDocShell::GetViewData()->GetCurY()); } +// if we extend the tiled area to the right and bottom we want two resulting area +// that don't overlap. If they overlap that typically creates an unnecessary full +// screen invalidation. +CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testExtendedAreasDontOverlap) +{ +comphelper::LibreOfficeKit::setCompatFlag( +comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs); + +ScModelObj* pModelObj = createDoc("empty.ods"); +CPPUNIT_ASSERT(pModelObj); +ScTabViewShell* pView = dynamic_cast(SfxViewShell::Current()); +CPPUNIT_ASSERT(pView); + +// Set an arbitrary initial size smaller than the final size +pModelObj->setClientVisibleArea(tools::Rectangle(0, 0, 1000, 1000)); + +Scheduler::ProcessEventsToIdle(); + +// register to track View #1 invalidations +ViewCallback aView1; + +// extend to the right and bottom +pModelObj->setClientVisibleArea(tools::Rectangle(0, 0, 39750, 12780)); + +Scheduler::ProcessEventsToIdle(); + +// we should get two rectangles for the two new areas +CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); + +// And those should not overlap, otherwise they would merge to form +// a mega rectangle, which defeats the purpose of creating two rects +// in the first place. +CPPUNIT_ASSERT_MESSAGE("Invalidations should not overlap", +!aView1.m_aInvalidations[0].Overlaps(aView1.m_aInvalidations[1])); + +// But they should be adjacent +CPPUNIT_ASSERT_EQUAL(aView1.m_aInvalidations[0].Top() + + aView1.m_aInvalidations[0].GetSize().Height(), + aView1.m_aInvalidations[1].Top()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 1bf2b710ba01..a865acb71505 100644
core.git: sc/qa sc/source
sc/qa/unit/data/ods/tdf149940.ods|binary sc/qa/unit/opencl-test-2.cxx | 27 +++ sc/source/core/opencl/op_spreadsheet.cxx |4 +++- 3 files changed, 30 insertions(+), 1 deletion(-) New commits: commit 91ba7d22b0df33a3ca4102bc77869fe89921c34e Author: dholden AuthorDate: Mon Jan 22 02:25:11 2024 -0600 Commit: Noel Grandin CommitDate: Tue Jan 23 08:57:47 2024 +0100 tdf#149940 Fix vlookup result with OpenCL This patch fixes the vlookup result in sorted order using OpenCl. The issue was that the loop unrolling would cause the loop to exit early. This has been fixed to only happen in unsorted mode. Change-Id: I7aba7b301c87061bc33128c8930ef3c55dc3c386 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162363 Reviewed-by: Noel Grandin Tested-by: Noel Grandin diff --git a/sc/qa/unit/data/ods/tdf149940.ods b/sc/qa/unit/data/ods/tdf149940.ods new file mode 100644 index ..5e117ac469f7 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf149940.ods differ diff --git a/sc/qa/unit/opencl-test-2.cxx b/sc/qa/unit/opencl-test-2.cxx index 4c7fbdbcb96d..910e09b87ec3 100644 --- a/sc/qa/unit/opencl-test-2.cxx +++ b/sc/qa/unit/opencl-test-2.cxx @@ -1844,6 +1844,33 @@ CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testStatisticalFormulaStDevPA1) } } +CPPUNIT_TEST_FIXTURE(ScOpenCLTest2, testTdf149940_VLookup) +{ +initTestEnv(u"ods/tdf149940.ods"); +ScDocument* pDoc = getScDoc2(); +ScDocument* pDocRes = getScDoc(); +pDoc->CalcAll(); + +for (SCROW i = 4; i <= 12; ++i) +{ +double fLibre = pDoc->GetValue(ScAddress(1,i,1)); +double fExcel = pDocRes->GetValue(ScAddress(1,i,1)); +CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.1)); +} +for (SCROW i = 4; i <= 12; ++i) +{ +double fLibre = pDoc->GetValue(ScAddress(2,i,1)); +double fExcel = pDocRes->GetValue(ScAddress(2,i,1)); +CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.1)); +} +for (SCROW i = 4; i <= 12; ++i) +{ +double fLibre = pDoc->GetValue(ScAddress(3,i,1)); +double fExcel = pDocRes->GetValue(ScAddress(3,i,1)); +CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.1)); +} +} + ScOpenCLTest2::ScOpenCLTest2() : ScModelTestBase( "sc/qa/unit/data" ) { diff --git a/sc/source/core/opencl/op_spreadsheet.cxx b/sc/source/core/opencl/op_spreadsheet.cxx index db99a1e7cf74..815f95b1f39f 100644 --- a/sc/source/core/opencl/op_spreadsheet.cxx +++ b/sc/source/core/opencl/op_spreadsheet.cxx @@ -171,7 +171,9 @@ void OpVLookup::GenSlidingWindowFunction(outputstream &ss, } ss << "} "; -ss << "if(rowNum!=-1) "; +ss << "if(rowNum!=-1 && tmp"; +ss << 3 + (secondParaWidth - 1); +ss << " == 0) "; ss << "{ "; for (int j = 0; j < secondParaWidth; j++) {
core.git: sc/qa sc/source
sc/qa/uitest/autofilter2/tdf158314_EmptyError.py | 94 +++ sc/source/core/data/column3.cxx |4 sc/source/ui/view/gridwin.cxx|7 - 3 files changed, 100 insertions(+), 5 deletions(-) New commits: commit 89e032e9c4c51f52680c7d8bacf59ab2a34f2180 Author: Kevin Suo AuthorDate: Tue Jan 16 10:13:59 2024 +0800 Commit: Kevin Suo CommitDate: Thu Jan 18 13:08:22 2024 +0100 tdf#158314: show Empty and Error entries as non-selected and inactive... ...when hidden by autofilter. The "show hidden filter elements as inactive" feature was added and improved by: commit 2d1df9f3dccc10f13b8585ad18afce1542ebc4d1 (tdf#117276 sc: Show hidden filter elements as inactive elements) commit 2085e90fe8ac129bc4dbac4612d1ea7544335dae (FilteredRow is not a property of the column, tdf#117276 follow-up) commit 7321db3cadc8c0e4437ca04e5dcb652734ea9c26 (Related tdf#117276 sc: Show hidden filter elements as inactive elements) commit 19533948370dc1ccd7334dbe1a8b7fc8330b10c0 (Name FilteredRow what it is, not hidden; tdf#117276 follow-up) Those changes correctly made normal hidden filter elements as inactive, but failed to do so for Empty and Error entries. This patch shows the hidden Empty and Error entries as inactive and unselected. Also, do not show the Empty entry at the top of the list in case it is inactive. Change-Id: Ibcd758cebc0692b04b162cdfc3e06eceb86b17da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162166 Reviewed-by: Xisco Fauli Reviewed-by: Kevin Suo Tested-by: Kevin Suo diff --git a/sc/qa/uitest/autofilter2/tdf158314_EmptyError.py b/sc/qa/uitest/autofilter2/tdf158314_EmptyError.py new file mode 100644 index ..2ced88c80db3 --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf158314_EmptyError.py @@ -0,0 +1,94 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import is_row_hidden + +# Bug 158314 - Autofilter dropdown list always shows "Empty" entry as active + +class tdf158314_EmptyEntries(UITestCase): +def testTdf158314(self): +with self.ui_test.create_doc_in_start_center("calc") as calcDoc: +xCalcDoc = self.xUITest.getTopFocusWindow() +xGridWin = xCalcDoc.getChild("grid_window") + +# Fill the sheet with test data +enter_text_to_cell(xGridWin, "A1", "a") +enter_text_to_cell(xGridWin, "A2", "1") +enter_text_to_cell(xGridWin, "A3", "2") +enter_text_to_cell(xGridWin, "A4", "3") +enter_text_to_cell(xGridWin, "A5", "4") + +enter_text_to_cell(xGridWin, "B1", "b") +enter_text_to_cell(xGridWin, "B2", "5") +enter_text_to_cell(xGridWin, "B3", "") +enter_text_to_cell(xGridWin, "B4", "=1/0") +enter_text_to_cell(xGridWin, "B5", "8") + +# Select the data range and set autofilter +xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B5"})) +self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + +# Click the autofilter dropdown in column A +xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("FilterDropDown") +xTreeList = xCheckListMenu.getChild("check_list_box") + +# Select the first entry only. Uncheck all other entries. +for i in xTreeList.getChildren(): +if i != "0": +xEntry = xTreeList.getChild(i) +xEntry.executeAction("CLICK", tuple()) + +xOkButton = xFloatWindow.getChild("ok") +xOkButton.executeAction("CLICK", tuple()) + +# Check that only row#2 is visible +self.assertFalse(is_row_hidden(calcDoc, 1)) +self.assertTrue(is_row_hidden(calcDoc, 2)) +self.assertTrue(is_row_hidden(calcDoc, 3)) +self.assertTrue(is_row_hidden(calcDoc, 4)) + +# Click the autofilter dropdown in column B +xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) +xFloatWindow = self.xUITest.getFloatWindow() +xCheckListMenu = xFloatWindow.getChild("FilterDropDown") +xTreeList
core.git: sc/qa sc/source
sc/qa/extras/scpdfexport.cxx | 62 +++ sc/qa/extras/testdocuments/tdf159068.ods |binary sc/source/core/tool/detfunc.cxx |3 + 3 files changed, 65 insertions(+) New commits: commit 510e94913b87fd6a3ea6444da492f6428afa47d8 Author: Tibor Nagy AuthorDate: Sun Jan 14 21:33:02 2024 +0100 Commit: Nagy Tibor CommitDate: Mon Jan 15 10:10:23 2024 +0100 tdf#159068 sc: fix detective shapes (PDF/UA export) The detective shapes(DetectiveArrow,ValidationCircle) don't have the option to set alternative text, so it should be marked as decorative. Change-Id: If83b29eb071b25f9eaa92a23337e416048b6aa8b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162059 Tested-by: Jenkins Reviewed-by: Nagy Tibor diff --git a/sc/qa/extras/scpdfexport.cxx b/sc/qa/extras/scpdfexport.cxx index de888c083387..11211607c013 100644 --- a/sc/qa/extras/scpdfexport.cxx +++ b/sc/qa/extras/scpdfexport.cxx @@ -65,6 +65,7 @@ public: void testExportFitToPage_Tdf103516(); void testUnoCommands_Tdf120161(); void testTdf64703_hiddenPageBreak(); +void testTdf159068(); void testTdf159066(); void testTdf159065(); void testTdf123870(); @@ -79,6 +80,7 @@ public: CPPUNIT_TEST(testExportFitToPage_Tdf103516); CPPUNIT_TEST(testUnoCommands_Tdf120161); CPPUNIT_TEST(testTdf64703_hiddenPageBreak); +CPPUNIT_TEST(testTdf159068); CPPUNIT_TEST(testTdf159066); CPPUNIT_TEST(testTdf159065); CPPUNIT_TEST(testTdf123870); @@ -398,6 +400,66 @@ void ScPDFExportTest::testTdf64703_hiddenPageBreak() } } +void ScPDFExportTest::testTdf159068() +{ +loadFromFile(u"tdf159068.ods"); +uno::Reference xModel(mxComponent, uno::UNO_QUERY); + +// A1:C3 +ScRange range1(0, 0, 0, 2, 2, 0); +exportToPDF(xModel, range1); + +vcl::filter::PDFDocument aDocument; +SvFileStream aStream(maTempFile.GetURL(), StreamMode::READ); +CPPUNIT_ASSERT(aDocument.Read(aStream)); + +// The document has one page. +std::vector aPages = aDocument.GetPages(); +CPPUNIT_ASSERT_EQUAL(static_cast(1), aPages.size()); + +vcl::filter::PDFObjectElement* pContents = aPages[0]->LookupObject("Contents"_ostr); +CPPUNIT_ASSERT(pContents); +vcl::filter::PDFStreamElement* pStream = pContents->GetStream(); +CPPUNIT_ASSERT(pStream); + +SvMemoryStream& rObjectStream = pStream->GetMemory(); +// Uncompress it. +SvMemoryStream aUncompressed; +ZCodec aZCodec; +aZCodec.BeginCompression(); +rObjectStream.Seek(0); +aZCodec.Decompress(rObjectStream, aUncompressed); +CPPUNIT_ASSERT(aZCodec.EndCompression()); + +auto pStart = static_cast(aUncompressed.GetData()); +const char* const pEnd = pStart + aUncompressed.GetSize(); + +auto nArtifact(0); +auto nLine(0); +while (true) +{ +++nLine; +auto const pLine = ::std::find(pStart, pEnd, ' '); +if (pLine == pEnd) +{ +break; +} +std::string_view const line(pStart, pLine - pStart); +pStart = pLine + 1; +if (!line.empty() && line[0] != '%') +{ +::std::cerr << nLine << ": " << line << " "; +if (o3tl::starts_with(line, "/Artifact BMC")) +nArtifact++; +} +} + +// Without the fix in place, this test would have failed with +// - Expected: 5 (Artifact: Header, Footer, Rectangel, DetectiveArrow, ValidationCircle) +// - Actual : 2 (Artifact: Header, Footer) +CPPUNIT_ASSERT_EQUAL(static_cast(5), nArtifact); +} + void ScPDFExportTest::testTdf159066() { loadFromFile(u"tdf159066.ods"); diff --git a/sc/qa/extras/testdocuments/tdf159068.ods b/sc/qa/extras/testdocuments/tdf159068.ods new file mode 100644 index ..a0745d924c84 Binary files /dev/null and b/sc/qa/extras/testdocuments/tdf159068.ods differ diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index b5dc71b92a63..59efb5ad6469 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -373,6 +373,7 @@ void ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow, pBox->NbcSetStyleSheet(nullptr, true); pBox->SetMergedItemSetAndBroadcast(rData.GetBoxSet()); +pBox->SetDecorative(true); pBox->SetLayer( SC_LAYER_INTERN ); pPage->InsertObject( pBox.get() ); pModel->AddCalcUndo( std::make_unique( *pBox ) ); @@ -418,6 +419,7 @@ void ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow, pArrow->NbcSetLogicRect(tools::Rectangle::Normalize(aStartPos,aEndPos)); //TODO: needed ??? pArrow->SetMergedItemSetAndBroadcast(rAttrSet); +pArrow->SetDecorative(true); pArrow->SetLayer( SC_LAYER_INTERN ); pPage->InsertObject( pArrow.get() ); pModel->AddCalcUndo( std::make_unique( *pArrow ) ); @@ -561,6 +563,7 @@ void ScDetectiveFunc::DrawCircle( SCCOL nCol, SCROW nRow, ScDetectiveData& rD
core.git: sc/qa sc/source
sc/qa/unit/tiledrendering/data/split.ods |binary sc/qa/unit/tiledrendering/tiledrendering.cxx | 43 +++ sc/source/ui/view/gridwin.cxx| 17 ++ 3 files changed, 60 insertions(+) New commits: commit 3314d4f9a6461f569d12ad0fef51eef26c5510c2 Author: Caolán McNamara AuthorDate: Tue Dec 19 21:03:11 2023 + Commit: Caolán McNamara CommitDate: Thu Dec 28 21:30:01 2023 +0100 kit: update formulas in frozen area when the main pane has scrolled sufficiently that those areas are off screen from the main pane perspective. In kit mode while there can be (up to) 4 panes, each pane is considered to be at cell 0, 0 and of the same size as the window. Unlike desktop mode the information as to what ranges are shown when there are frozen rows/cols is instead available via LOKSheetFreezeIndex commit daaf101ffe683eb691418ec2df4adc260d7e6a15 Date: Mon May 7 12:49:22 2018 +0200 lok: sc: formulas were not updated correctly this patch fixes several issues: commit 0ef7bc8a1d2f00715d6849f1bbceb26e32382d41 Date: Fri Mar 29 09:01:05 2019 -0400 sc lok: avoid save incorrect data, whether the pane has ... horizontal / vertical splits commit 7b4802070ac6fb930255536bf3ed2c52428b4181 Date: Wed Jul 15 15:55:45 2020 +0530 lok-freezepanes: Generalize FreezePanes* uno-commands... commit 818b7e508bcabae48cb1c96c987a9f83d83ff6e0 Date: Wed Apr 21 18:28:13 2021 +0200 lok: calc: formula breaking to multiple lines partly shown in edit mode Change-Id: I1e55f7bbc0df5c6fd09a10e261d25c1ce00a243a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160995 Tested-by: Jenkins CollaboraOffice Reviewed-by: Michael Meeks Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161270 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/qa/unit/tiledrendering/data/split.ods b/sc/qa/unit/tiledrendering/data/split.ods new file mode 100644 index ..efe2c225a410 Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/split.ods differ diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index d72cb6457fb4..8446f07fc3b9 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -3141,6 +3141,49 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testOpenURL) CPPUNIT_ASSERT(!aView2.m_aHyperlinkClicked.isEmpty()); } +CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testInvalidateForSplitPanes) +{ +comphelper::LibreOfficeKit::setCompatFlag( +comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs); + +ScModelObj* pModelObj = createDoc("split.ods"); +CPPUNIT_ASSERT(pModelObj); +ScTabViewShell* pView = dynamic_cast(SfxViewShell::Current()); +CPPUNIT_ASSERT(pView); + +// view +ViewCallback aView; + +// move way over to the right where BP:20 exists, enough so that rows A and B +// would scroll off the page and not be visible, if they were not frozen +pModelObj->setClientVisibleArea(tools::Rectangle(73050, 0, 94019, 7034)); +Scheduler::ProcessEventsToIdle(); + +ScAddress aBP20(67, 19, 0); // BP:20 + +pView->SetCursor(aBP20.Col(), aBP20.Row()); +Scheduler::ProcessEventsToIdle(); + +aView.m_bInvalidateTiles = false; +aView.m_aInvalidations.clear(); + +lcl_typeCharsInCell("X", aBP20.Col(), aBP20.Row(), pView, pModelObj); // Type 'X' in A1 + +CPPUNIT_ASSERT(aView.m_bInvalidateTiles); + +// missing before fix +tools::Rectangle aTopLeftPane(0, 500, 3817, 742); +bool bFoundTopLeftPane = +std::find(aView.m_aInvalidations.begin(), aView.m_aInvalidations.end(), aTopLeftPane) != aView.m_aInvalidations.end(); +CPPUNIT_ASSERT_MESSAGE("The cell visible in the top left pane should be redrawn", bFoundTopLeftPane); + +// missing before fix +tools::Rectangle aBottomLeftPane(0, 500, 3817, 3242); +bool bFoundBottomLeftPane = +std::find(aView.m_aInvalidations.begin(), aView.m_aInvalidations.end(), aBottomLeftPane) != aView.m_aInvalidations.end(); +CPPUNIT_ASSERT_MESSAGE("The cell visible in the bottom left pane should be redrawn", bFoundBottomLeftPane); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index aa90b2183415..446badbb1244 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -5101,6 +5101,23 @@ void ScGridWindow::UpdateFormulas(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2) nY2 = pViewShell->GetLOKEndHeaderRow(); if (nX1 < 0 || nY1 < 0) return; + +// Consider frozen ranges not in main pane range as candidates +// for update +SCCOLROW nFreezeCol = mrViewData.GetLOK
core.git: sc/qa sc/source
sc/qa/uitest/calc_tests8/navigator.py | 27 +++ sc/source/ui/navipi/navipi.cxx|1 + 2 files changed, 28 insertions(+) New commits: commit 0097f8595791f4bbf499ebd423f4f80ec8e38dbe Author: Oliver Specht AuthorDate: Tue Dec 12 15:51:42 2023 +0100 Commit: Thorsten Behrens CommitDate: Fri Dec 22 09:59:04 2023 +0100 tdf#158652 notify navigator on insert/edit/delete comment links changes of the drawing engine to comments as it was done before with pictures, shapes and OLE objects ui unit test included Change-Id: I4fde3a82b80e73758fb3da94ed2553453d09e9ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160624 Tested-by: Jenkins Reviewed-by: Thorsten Behrens diff --git a/sc/qa/uitest/calc_tests8/navigator.py b/sc/qa/uitest/calc_tests8/navigator.py index ec8fa2ae9a2e..9c1769dcf49d 100644 --- a/sc/qa/uitest/calc_tests8/navigator.py +++ b/sc/qa/uitest/calc_tests8/navigator.py @@ -10,6 +10,7 @@ from uitest.framework import UITestCase from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.calc import enter_text_to_cell class navigator(UITestCase): @@ -181,4 +182,30 @@ class navigator(UITestCase): self.xUITest.executeCommand(".uno:Sidebar") + +def test_tdf158652(self): +with self.ui_test.create_doc_in_start_center("calc"): +xCalcDoc = self.xUITest.getTopFocusWindow() +xGridWin = xCalcDoc.getChild("grid_window") + +self.xUITest.executeCommand(".uno:Sidebar") + +xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"})) + +xCalcDoc = self.xUITest.getTopFocusWindow() +xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel") +xContentBox = xNavigatorPanel.getChild('contentbox') +enter_text_to_cell(xGridWin, "A1", "1") + +commentText = mkPropertyValues({"Text":"CommentText"}) +self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", commentText) +xComments = xContentBox.getChild("6") +self.assertEqual(len(xComments.getChildren()), 1) + +self.xUITest.executeCommand(".uno:DeleteNote") +xComments = xContentBox.getChild("6") +self.assertEqual(len(xComments.getChildren()), 0) + +self.xUITest.executeCommand(".uno:Sidebar") + # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 5fc6fee82122..ae95220eeffb 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -540,6 +540,7 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint ) m_xLbEntries->Refresh( ScContentId::GRAPHIC ); m_xLbEntries->Refresh( ScContentId::OLEOBJECT ); m_xLbEntries->Refresh( ScContentId::DRAWING ); +m_xLbEntries->Refresh( ScContentId::NOTE ); break; case SfxHintId::ScAreaLinksChanged:
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx | 14 +++--- sc/source/filter/excel/export/SparklineExt.cxx |2 +- sc/source/filter/excel/xeescher.cxx|4 ++-- sc/source/filter/excel/xepivotxml.cxx | 14 +++--- sc/source/filter/lotus/lotform.cxx |2 +- sc/source/ui/view/tabvwshc.cxx |6 +++--- 6 files changed, 21 insertions(+), 21 deletions(-) New commits: commit f4ce98bd1a1b183bb21c60b85e17dc6575f9ce98 Author: Stephan Bergmann AuthorDate: Wed Nov 29 14:39:38 2023 +0100 Commit: Stephan Bergmann CommitDate: Wed Nov 29 19:59:49 2023 +0100 Extended loplugin:ostr: sc Change-Id: I2b69249d6e0e35945e37e04ea885bb8ab3e781f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160103 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index b27664e5df41..b33960af5f22 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -173,7 +173,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testRowColumnSelections) // Check if all the rows from 5th to 10th get selected aResult = apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), "text/plain;charset=utf-8"_ostr); -aExpected = "1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\n2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\n3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\n4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\n5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\t25\n6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\t25\t26\n"; +aExpected = "1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\n2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\n3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\n4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\n5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\t25\n6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\t25\t26\n"_ostr; CPPUNIT_ASSERT_EQUAL(aExpected, aResult); // Select the 10th row with ctrl modifier @@ -218,7 +218,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testRowColumnSelections) // only row 5 should remain selected aResult = apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), "text/plain;charset=utf-8"_ostr); -aExpected = "1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\n"; +aExpected = "1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\n"_ostr; CPPUNIT_ASSERT_EQUAL(aExpected, aResult); } @@ -2305,7 +2305,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testDeleteCellMultilineContent) ViewCallback aView1; CPPUNIT_ASSERT(!lcl_hasEditView(*pViewData)); -aView1.m_sInvalidateHeader = ""; +aView1.m_sInvalidateHeader = ""_ostr; ScDocument& rDoc = pDocSh->GetDocument(); sal_uInt16 nRow1Height = rDoc.GetRowHeight(static_cast(0), static_cast(0), false); @@ -2370,7 +2370,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testPasteIntoWrapTextCell) // Go to A2 and paste. pView->SetCursor(0, 1); Scheduler::ProcessEventsToIdle(); -aView.m_sInvalidateSheetGeometry = ""; +aView.m_sInvalidateSheetGeometry = ""_ostr; pView->GetViewFrame().GetBindings().Execute(SID_PASTE); Scheduler::ProcessEventsToIdle(); @@ -2399,7 +2399,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testPasteIntoWrapTextCell) // Go to A3 and paste. pView->SetCursor(0, 2); Scheduler::ProcessEventsToIdle(); -aView.m_sInvalidateSheetGeometry = ""; +aView.m_sInvalidateSheetGeometry = ""_ostr; pView->GetViewFrame().GetBindings().Execute(SID_PASTE); Scheduler::ProcessEventsToIdle(); @@ -2424,7 +2424,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testSortAscendingDescending) pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEMOVE, 820, 1336, 1, MOUSE_LEFT, 0); pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, 820, 1359, 1, MOUSE_LEFT, 0); Scheduler::ProcessEventsToIdle(); -aView.m_sInvalidateSheetGeometry = ""; +aView.m_sInvalidateSheetGeometry = ""_ostr; // sort ascending uno::Sequence aArgs; @@ -2439,7 +2439,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testSortAscendingDescending) Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL("rows"_ostr, aView.m_sInvalidateSheetGeometry); -aView.m_sInvalidateSheetGeometry = ""; +aView.m_sInvalidateSheetGeometry = ""_ostr; // sort descending dispatchCommand(mxComponent, ".uno:SortDescending", aArgs); diff --git a/sc/s
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/extras/htmlexporttest.cxx | 14 sc/qa/extras/macros-test.cxx |8 sc/qa/unit/SparklineImportExportTest.cxx | 67 +- sc/qa/unit/ThemeImportExportTest.cxx | 62 +- sc/qa/unit/dataproviders_test.cxx|6 sc/qa/unit/jumbosheets-test.cxx | 14 sc/qa/unit/pivottable_filters_test.cxx | 687 ++- sc/qa/unit/screenshots/screenshots.cxx | 30 - sc/qa/unit/subsequent_export_test.cxx| 560 +++--- sc/qa/unit/subsequent_export_test2.cxx | 377 -- sc/qa/unit/subsequent_export_test3.cxx | 138 ++--- sc/qa/unit/subsequent_export_test4.cxx | 318 ++-- sc/qa/unit/tiledrendering/tiledrendering.cxx | 42 - sc/qa/unit/ucalc_copypaste.cxx | 10 sc/source/core/data/document10.cxx |2 sc/source/core/data/table7.cxx |4 sc/source/filter/excel/xecontent.cxx | 18 sc/source/filter/excel/xeescher.cxx |2 sc/source/filter/excel/xeextlst.cxx | 16 sc/source/filter/excel/xepivotxml.cxx| 24 sc/source/filter/excel/xeview.cxx|2 sc/source/filter/html/htmlexp.cxx|2 sc/source/ui/app/inputhdl.cxx|6 sc/source/ui/app/scmod.cxx |2 sc/source/ui/unoobj/docuno.cxx |8 sc/source/ui/view/drawview.cxx |2 sc/source/ui/view/gridwin.cxx| 26 - sc/source/ui/view/tabview3.cxx |2 sc/source/ui/view/tabvwsh4.cxx |8 29 files changed, 1310 insertions(+), 1147 deletions(-) New commits: commit 099be392bfc5ddba21370726fa887a2fd6c99cd5 Author: Stephan Bergmann AuthorDate: Sun Nov 19 17:31:36 2023 +0100 Commit: Stephan Bergmann CommitDate: Sun Nov 19 20:38:33 2023 +0100 Extended loplugin:ostr: sc Change-Id: I44536a13f4c31558671c1166d06b7f6216456641 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159680 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/sc/qa/extras/htmlexporttest.cxx b/sc/qa/extras/htmlexporttest.cxx index 6e28d791fbb3..774f75078a85 100644 --- a/sc/qa/extras/htmlexporttest.cxx +++ b/sc/qa/extras/htmlexporttest.cxx @@ -38,16 +38,16 @@ public: htmlDocUniquePtr pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT (pDoc); -assertXPath(pDoc, "/html/body", 1); -assertXPath(pDoc, "/html/body/table/tr/td/img", 1); +assertXPath(pDoc, "/html/body"_ostr, 1); +assertXPath(pDoc, "/html/body/table/tr/td/img"_ostr, 1); setFilterOptions("SkipImages"); save("HTML (StarCalc)"); pDoc = parseHtml(maTempFile); CPPUNIT_ASSERT (pDoc); -assertXPath(pDoc, "/html/body", 1); -assertXPath(pDoc, "/html/body/table/tr/td/img", 0); +assertXPath(pDoc, "/html/body"_ostr, 1); +assertXPath(pDoc, "/html/body/table/tr/td/img"_ostr, 0); } void testTdf155244() @@ -58,10 +58,10 @@ public: xmlDocUniquePtr pXmlDoc = parseXml(maTempFile); CPPUNIT_ASSERT(pXmlDoc); -assertXPath(pXmlDoc, "/xhtml:html", 1); +assertXPath(pXmlDoc, "/xhtml:html"_ostr, 1); // the problem was that there were 2 CSS styles named "Default" -assertXPath(pXmlDoc, "/xhtml:html/xhtml:body/xhtml:table/xhtml:tr/xhtml:td", "class", "cell-Default"); -OUString const styles = getXPathContent(pXmlDoc, "/xhtml:html/xhtml:head/xhtml:style"); +assertXPath(pXmlDoc, "/xhtml:html/xhtml:body/xhtml:table/xhtml:tr/xhtml:td"_ostr, "class"_ostr, "cell-Default"); +OUString const styles = getXPathContent(pXmlDoc, "/xhtml:html/xhtml:head/xhtml:style"_ostr); CPPUNIT_ASSERT(styles.indexOf(".graphic-Default{ background-color:#729fcf;") != -1); CPPUNIT_ASSERT(styles.indexOf(".cell-Default{ font-size:10pt; font-family:'Liberation Sans'; }") != -1); CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), styles.indexOf(".Default")); diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index f1602465f7d2..c483a05c9300 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -167,13 +167,13 @@ CPPUNIT_TEST_FIXTURE(ScMacrosTest, testMacroButtonFormControlXlsxExport) // Without the fix in place, this test would have failed with: // - XPath '//x:controlPr' no attribute 'macro' exist // i.e. the macro was lost on export. -assertXPath(pSheetDoc, "//x:controlPr", "macro", "Module1.Button1_Click"); +assertXPath(pSheetDoc, "//x:controlPr"_ostr, "macro"_ostr, "Module1.Button1_Click"); // Then also make sure that there is no defined name for the macro, which is only needed for // XLS: xmlDocUniquePtr pWorkbookDoc = parseExport("xl/workbook.xml"); CPPUNIT_ASSERT(pWorkbookDoc); -assertXPath(pWorkbookDoc, "//x:workbook/definedNames", 0); +
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/uicalc/data/tdf157897_linked.ods |binary sc/qa/unit/uicalc/data/tdf157897_main.ods |binary sc/qa/unit/uicalc/uicalc.cxx| 18 ++ sc/source/core/data/documen2.cxx|2 ++ 4 files changed, 20 insertions(+) New commits: commit 96b91357fb93028d35d70bdb52b4bac3ecbfbf57 Author: Andreas Heinisch AuthorDate: Mon Oct 23 23:13:51 2023 +0200 Commit: Andreas Heinisch CommitDate: Thu Oct 26 18:41:49 2023 +0200 tdf#157897 - Clear print ranges before adding additional ones Otherwise, additional print ranges will be added for linked files after the external link will be updated. Change-Id: I0556fda6609d3e18f1ca992dc6a0399be01bc841 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158365 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/sc/qa/unit/uicalc/data/tdf157897_linked.ods b/sc/qa/unit/uicalc/data/tdf157897_linked.ods new file mode 100755 index ..bb75c31d82ae Binary files /dev/null and b/sc/qa/unit/uicalc/data/tdf157897_linked.ods differ diff --git a/sc/qa/unit/uicalc/data/tdf157897_main.ods b/sc/qa/unit/uicalc/data/tdf157897_main.ods new file mode 100755 index ..1e1af575145f Binary files /dev/null and b/sc/qa/unit/uicalc/data/tdf157897_main.ods differ diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 4259f56a..15795baceaa1 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -1395,6 +1395,24 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf146994) CPPUNIT_ASSERT_EQUAL(OUString("Sheet1.D3:Sheet1.D4"), aMarkedAreaString); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf157897_duplicated_print_ranges) +{ +createScDoc("tdf157897_main.ods"); +ScDocument* pDoc = getScDoc(); + +const sal_uInt16 nPos = 0; +const SCTAB nFirstTab = 0; +// Ensure that there exists a print range in the first documents tab +CPPUNIT_ASSERT_EQUAL(static_cast(1), pDoc->GetPrintRangeCount(nFirstTab)); + +// Reload all links and check if the print range was not duplicated +const auto initialPrintRange = pDoc->GetPrintRange(nFirstTab, nPos); +pDoc->GetDocumentShell()->ReloadAllLinks(); + +// Without the fix in place, the print range in the linked tab will be duplicated +CPPUNIT_ASSERT_EQUAL(initialPrintRange, pDoc->GetPrintRange(nFirstTab, nPos)); +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf154991) { createScDoc("tdf154991.ods"); diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 4b07b0d33ff5..c53dc6b3e305 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -1040,6 +1040,8 @@ sal_uLong ScDocument::TransferTab( ScDocument& rSrcDoc, SCTAB nSrcPos, maTabs[nDestPos]->SetPrintEntireSheet(); else { +// tdf#157897 - clear print ranges before adding additional ones +maTabs[nDestPos]->ClearPrintRanges(); const auto nPrintRangeCount = rSrcDoc.maTabs[nSrcPos]->GetPrintRangeCount(); for (auto nPos = 0; nPos < nPrintRangeCount; nPos++) {
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/extras/macros-test.cxx | 12 ++-- sc/qa/unit/ThemeImportExportTest.cxx |2 sc/qa/unit/helper/shared_test_impl.hxx |2 sc/qa/unit/screenshots/screenshots.cxx |2 sc/qa/unit/ucalc.cxx |2 sc/source/core/data/dpobject.cxx |2 sc/source/core/data/tabprotection.cxx|6 +- sc/source/core/tool/addincol.cxx |6 +- sc/source/core/tool/autoform.cxx |2 sc/source/core/tool/compiler.cxx |6 +- sc/source/core/tool/stylehelper.cxx |2 sc/source/filter/excel/xechart.cxx |2 sc/source/filter/excel/xestream.cxx |2 sc/source/filter/excel/xiescher.cxx |4 - sc/source/filter/oox/defnamesbuffer.cxx |2 sc/source/filter/oox/pagesettings.cxx|4 - sc/source/filter/oox/querytablebuffer.cxx|2 sc/source/filter/xcl97/xcl97esc.cxx |2 sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx |2 sc/source/filter/xml/XMLCodeNameProvider.cxx |4 - sc/source/filter/xml/XMLExportDatabaseRanges.cxx |2 sc/source/filter/xml/XMLStylesExportHelper.cxx |2 sc/source/filter/xml/xmlexprt.cxx|8 +-- sc/source/filter/xml/xmlimprt.cxx|4 - sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx |2 sc/source/ui/StatisticsDialogs/FourierAnalysisDialog.cxx |2 sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx |2 sc/source/ui/dbgui/csvruler.cxx |4 - sc/source/ui/docshell/datastream.cxx |2 sc/source/ui/docshell/docsh.cxx | 10 +-- sc/source/ui/docshell/docsh4.cxx |8 +-- sc/source/ui/docshell/docsh8.cxx | 14 ++--- sc/source/ui/docshell/impex.cxx |2 sc/source/ui/miscdlgs/linkarea.cxx |4 - sc/source/ui/miscdlgs/solverutil.cxx |2 sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx |4 - sc/source/ui/unoobj/afmtuno.cxx |2 sc/source/ui/unoobj/appluno.cxx |6 +- sc/source/ui/unoobj/cellsuno.cxx | 18 +++ sc/source/ui/unoobj/confuno.cxx |2 sc/source/ui/unoobj/cursuno.cxx |4 - sc/source/ui/unoobj/dapiuno.cxx |2 sc/source/ui/unoobj/dispuno.cxx |2 sc/source/ui/unoobj/docuno.cxx |8 +-- sc/source/ui/unoobj/filtuno.cxx | 10 +-- sc/source/ui/unoobj/funcuno.cxx |4 - sc/source/ui/unoobj/nameuno.cxx |2 sc/source/ui/unoobj/shapeuno.cxx |8 +-- sc/source/ui/unoobj/srchuno.cxx |4 - sc/source/ui/unoobj/styleuno.cxx | 16 +++--- sc/source/ui/unoobj/viewuno.cxx |4 - sc/source/ui/vba/vbaaxis.cxx |6 +- sc/source/ui/vba/vbaborders.cxx |2 sc/source/ui/vba/vbachart.cxx| 28 +-- sc/source/ui/vba/vbaformat.cxx |4 - sc/source/ui/vba/vbainterior.cxx |6 +- sc/source/ui/vba/vbarange.cxx| 12 ++-- sc/source/ui/vba/vbasheetobject.cxx |4 - sc/source/ui/vba/vbastyle.cxx|2 sc/source/ui/view/formatsh.cxx |2 sc/source/ui/view/viewdata.cxx |2 61 files changed, 150 insertions(+), 150 deletions(-) New commits: commit da3a91e89f803d1c42b764c90071b30b547e686b Author: Stephan Bergmann AuthorDate: Thu Oct 19 10:30:24 2023 +0200 Commit: Stephan Bergmann CommitDate: Fri Oct 20 09:45:32 2023 +0200 Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: sc Change-Id: Ieed908bfa2cb6370ead922dfc00dbdb4f905f3cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158216 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index d8590804a165..f1602465f7d2 100644 --- a/sc/qa/extras/
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/tdf150815.ods |binary sc/qa/unit/subsequent_filters_test3.cxx | 22 +- sc/source/ui/inc/viewfunc.hxx |4 ++-- sc/source/ui/view/viewfunc.cxx | 22 ++ 4 files changed, 45 insertions(+), 3 deletions(-) New commits: commit d1411afab98f7b41e9e700ef26b43dc77242d917 Author: Tibor Nagy AuthorDate: Wed Aug 30 16:22:02 2023 +0200 Commit: László Németh CommitDate: Thu Aug 31 18:01:33 2023 +0200 tdf#150815 sc: fix repainting sparkline On Windows, if the input range of the sparkline is not in the same row as the output range, the sparkline wasn't repainted after changing the data within its range. Force the update to avoid of showing obsolete data. Change-Id: Id56209b20387ee68144507a0102d3a0d093ff1ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156304 Reviewed-by: László Németh Tested-by: László Németh diff --git a/sc/qa/unit/data/ods/tdf150815.ods b/sc/qa/unit/data/ods/tdf150815.ods new file mode 100644 index ..2dd407b6cea5 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf150815.ods differ diff --git a/sc/qa/unit/subsequent_filters_test3.cxx b/sc/qa/unit/subsequent_filters_test3.cxx index d277e0858905..ff19d3d55c3c 100644 --- a/sc/qa/unit/subsequent_filters_test3.cxx +++ b/sc/qa/unit/subsequent_filters_test3.cxx @@ -393,7 +393,8 @@ struct PaintListener : public SfxListener { if ((pPaintHint->GetStartCol() <= 0 && pPaintHint->GetEndCol() >= 0) && ((pPaintHint->GetStartRow() <= 9 && pPaintHint->GetEndRow() >= 9) -|| (pPaintHint->GetStartRow() == 2 && pPaintHint->GetEndRow() == 3))) +|| (pPaintHint->GetStartRow() == 2 && pPaintHint->GetEndRow() == 3) +|| (pPaintHint->GetStartRow() == 1 && pPaintHint->GetEndRow() == 1))) { mbCalled = true; } @@ -441,6 +442,25 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf131471) CPPUNIT_ASSERT(aListener.mbCalled); } +CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf150815_RepaintSparkline) +{ +createScDoc("ods/tdf150815.ods"); + +ScDocument* pDoc = getScDoc(); +ScDocShell* pDocSh = getScDocShell(); + +PaintListener aListener; +aListener.StartListening(*pDocSh); + +auto pSparkline = pDoc->GetSparkline(ScAddress(0, 1, 0)); +CPPUNIT_ASSERT(pSparkline); + +ScTabViewShell* pViewShell = getViewShell(); +pViewShell->EnterData(0, 0, 0, "10"); + +CPPUNIT_ASSERT(aListener.mbCalled); +} + CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf137091) { // Set the system locale to Turkish diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx index 0d8d7515441a..323e7cbbe793 100644 --- a/sc/source/ui/inc/viewfunc.hxx +++ b/sc/source/ui/inc/viewfunc.hxx @@ -90,8 +90,8 @@ public: boolAutoSum( const ScRange& rRange, bool bSubTotal, bool bSetCursor, bool bContinue, const OpCode eCode ); OUStringGetAutoSumFormula( const ScRangeList& rRangeList, bool bSubTotal, const ScAddress& rAddr, const OpCode eCode ); -voidEnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString& rString, - const EditTextObject* pData = nullptr, bool bMatrixExpand = false ); +SC_DLLPUBLIC void EnterData(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString& rString, +const EditTextObject* pData = nullptr, bool bMatrixExpand = false); voidEnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const EditTextObject& rData, bool bTestSimple = false ); voidEnterValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rValue ); diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 13c4ce63c6e7..af0dc57357f9 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -77,6 +77,7 @@ #include #include #include +#include #include @@ -103,6 +104,26 @@ static void lcl_PostRepaintCondFormat( const ScConditionalFormat *pCondFmt, ScDo } } +static void lcl_PostRepaintSparkLine(sc::SparklineList* pSparklineList, const ScRange& rRange, + ScDocShell* pDocSh) +{ +if (pSparklineList) +{ +for (auto& rSparkLineGroup : pSparklineList->getSparklineGroups()) +{ +for (auto& rSparkline : pSparklineList->getSparklinesFor(rSparkLineGroup)) +{ +if (rSparkline->getInputRange().Contains(rRange)) +{ +pDocSh->PostPaint( +ScRange(rSparkline->getColumn(), rSparkline->getRow(), rRange.aStart.Tab()), +PaintPartFlags::All, SC_PF_TESTMERGE); +} +} +} +} +} + ScViewFunc::ScViewFunc( vcl::Window* pParent, ScDocShell& rD
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/subsequent_export_test3.cxx |3 +-- sc/source/filter/oox/sheetdatabuffer.cxx |2 +- 2 files changed, 2 insertions(+), 3 deletions(-) New commits: commit 16d43b7c5396d6382926d514dc9ce10b3ce94cba Author: Paris Oplopoios AuthorDate: Mon Aug 28 20:40:33 2023 +0300 Commit: Paris Oplopoios CommitDate: Mon Aug 28 22:12:43 2023 +0200 Shared string shouldn't account preserve space property XLSX documents opened in Excel don't seem to account for the xml:space="preserve" value for whether the string is single line or not The test that was changed seems to have more accurate behavior now, where the second cell does not have multiple lines (like in Excel) Change-Id: Iad8f351c19102249e2cb1e1d063c8690dfb3d753 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156206 Tested-by: Jenkins Reviewed-by: Paris Oplopoios diff --git a/sc/qa/unit/subsequent_export_test3.cxx b/sc/qa/unit/subsequent_export_test3.cxx index ff8a27727a1b..45e65cf8bed8 100644 --- a/sc/qa/unit/subsequent_export_test3.cxx +++ b/sc/qa/unit/subsequent_export_test3.cxx @@ -1424,8 +1424,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testPreserveTextWhitespace2XLSX) xmlDocUniquePtr pDoc = parseExport("xl/sharedStrings.xml"); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/x:sst/x:si[1]/x:t", "space", "preserve"); -assertXPath(pDoc, "/x:sst/x:si[2]/x:r[1]/x:t", "space", "preserve"); -assertXPath(pDoc, "/x:sst/x:si[2]/x:r[2]/x:t", "space", "preserve"); +assertXPath(pDoc, "/x:sst/x:si[2]/x:t", "space", "preserve"); } CPPUNIT_TEST_FIXTURE(ScExportTest3, testHiddenShapeXLS) diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx index 76721ded0d17..d1410eb04970 100644 --- a/sc/source/filter/oox/sheetdatabuffer.cxx +++ b/sc/source/filter/oox/sheetdatabuffer.cxx @@ -122,7 +122,7 @@ void SheetDataBuffer::setStringCell( const CellModel& rModel, const RichStringRe OSL_ENSURE( rxString, "SheetDataBuffer::setStringCell - missing rich string object" ); const oox::xls::Font* pFirstPortionFont = getStyles().getFontFromCellXf( rModel.mnXfId ).get(); const Xf* pXf = getStyles().getCellXf( rModel.mnXfId ).get(); -bool bSingleLine = pXf ? !rxString->isPreserveSpace() && !pXf->getAlignment().getModel().mbWrapText : false; +bool bSingleLine = pXf ? !pXf->getAlignment().getModel().mbWrapText : false; OUString aText; if( rxString->extractPlainString( aText, pFirstPortionFont ) ) {
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/wrap-text.xlsx |binary sc/qa/unit/subsequent_export_test.cxx | 20 sc/source/filter/excel/xestyle.cxx|2 +- sc/source/filter/excel/xetable.cxx|2 +- 4 files changed, 22 insertions(+), 2 deletions(-) New commits: commit 1760ee4d328cfb6ba22a5b3c84016625b12adb25 Author: Paris Oplopoios AuthorDate: Wed Aug 23 12:31:15 2023 +0300 Commit: Paris Oplopoios CommitDate: Mon Aug 28 10:27:37 2023 +0200 sc: Fix wrapText not being applied correctly on export Change-Id: I03aaa36af8fe820fa07d2eea13c5b0f69ad74dad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155970 Tested-by: Jenkins Reviewed-by: Paris Oplopoios diff --git a/sc/qa/unit/data/xlsx/wrap-text.xlsx b/sc/qa/unit/data/xlsx/wrap-text.xlsx new file mode 100644 index ..961cfcbdc02e Binary files /dev/null and b/sc/qa/unit/data/xlsx/wrap-text.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx index 1ce8ef99c926..60b9f9fb1c0f 100644 --- a/sc/qa/unit/subsequent_export_test.cxx +++ b/sc/qa/unit/subsequent_export_test.cxx @@ -1805,6 +1805,26 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testRichTextCellFormatXLSX) assertXPath(pStyles, aXPath3, "val", "true"); } +CPPUNIT_TEST_FIXTURE(ScExportTest, testWrapText) +{ +createScDoc("xlsx/wrap-text.xlsx"); + +save("Calc Office Open XML"); + +xmlDocUniquePtr pStyles = parseExport("xl/styles.xml"); +CPPUNIT_ASSERT(pStyles); + +assertXPath(pStyles, "/x:styleSheet/x:cellXfs", "count", "7"); + +assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[1]/x:alignment", "wrapText", "false"); +assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment", "wrapText", "false"); +assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[3]/x:alignment", "wrapText", "false"); +assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[4]/x:alignment", "wrapText", "false"); +assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[5]/x:alignment", "wrapText", "true"); +assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[6]/x:alignment", "wrapText", "true"); +assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[7]/x:alignment", "wrapText", "true"); +} + CPPUNIT_TEST_FIXTURE(ScExportTest, testFormulaRefSheetNameODS) { createScDoc("ods/formula-quote-in-sheet-name.ods"); diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 191dab1822d9..f7f24c17d223 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -1507,7 +1507,7 @@ bool XclExpCellAlign::FillFromItemSet(const XclRoot& rRoot, const SfxItemSet& rI case EXC_BIFF3: // attributes new in BIFF3 { // text wrap -mbLineBreak = bForceLineBreak || rItemSet.Get( ATTR_LINEBREAK ).GetValue(); +mbLineBreak = bForceLineBreak; bUsed |= bForceLineBreak || ScfTools::CheckItem( rItemSet, ATTR_LINEBREAK, bStyle ); [[fallthrough]]; diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index 022da6cd754f..f7b9a81be9f0 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -745,7 +745,7 @@ void XclExpLabelCell::Init( const XclExpRoot& rRoot, if( GetXFId() == EXC_XFID_NOTFOUND ) { OSL_ENSURE( nXclFont != EXC_FONT_NOTFOUND, "XclExpLabelCell::Init - leading font not found" ); - bool bForceLineBreak = mxText->IsWrapped(); + bool bForceLineBreak = pPattern->GetItemSet().Get(ATTR_LINEBREAK ).GetValue(); SetXFId( rRoot.GetXFBuffer().InsertWithFont( pPattern, ApiScriptType::WEAK, nXclFont, bForceLineBreak ) ); }
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx |4 ++-- sc/source/ui/docshell/docsh3.cxx |5 - 2 files changed, 6 insertions(+), 3 deletions(-) New commits: commit 34d5abf464dfbf4bdc36f6b87e606c84a1f4d99d Author: Szymon Kłos AuthorDate: Tue Jul 25 14:35:49 2023 +0200 Commit: Caolán McNamara CommitDate: Sun Aug 27 20:42:13 2023 +0200 lok: notify only affected tabs on cell resize When row has automatic height and we type something into one cell - it may be resized. That caused sending document size changed callback to all the views, also affecting all the parts/tabs. This patch calls that only for affected views which are looking at modified parts. It will not invalidate all the tabs when only one is modified. Change-Id: I93e574cf967d608696c1a95ad8b5a7614973c3f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154891 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156156 Tested-by: Jenkins diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 35304683e724..76286912a698 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1054,7 +1054,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testInvalidateOnInserRowCol) aView.m_aInvalidations.clear(); dispatchCommand(mxComponent, ".uno:InsertRows", aArgs); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); -CPPUNIT_ASSERT_EQUAL(size_t(2), aView.m_aInvalidations.size()); +CPPUNIT_ASSERT_EQUAL(size_t(1), aView.m_aInvalidations.size()); CPPUNIT_ASSERT_EQUAL(tools::Rectangle(-75, 51240, 32212230, 63990), aView.m_aInvalidations[0]); // move on the right @@ -1070,7 +1070,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testInvalidateOnInserRowCol) aView.m_aInvalidations.clear(); dispatchCommand(mxComponent, ".uno:InsertColumns", aArgs); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); -CPPUNIT_ASSERT_EQUAL(size_t(2), aView.m_aInvalidations.size()); +CPPUNIT_ASSERT_EQUAL(size_t(1), aView.m_aInvalidations.size()); CPPUNIT_ASSERT_EQUAL(tools::Rectangle(254925, -15, 32212230, 63990), aView.m_aInvalidations[0]); } diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index 789737e5f824..50e99f36f109 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -109,6 +109,7 @@ void ScDocShell::PostPaint( SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, void ScDocShell::PostPaint( const ScRangeList& rRanges, PaintPartFlags nPart, sal_uInt16 nExtFlags ) { ScRangeList aPaintRanges; +std::set aTabsInvalidated; for (size_t i = 0, n = rRanges.size(); i < n; ++i) { const ScRange& rRange = rRanges[i]; @@ -167,6 +168,7 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, PaintPartFlags nPart, sa } } aPaintRanges.push_back(ScRange(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2)); +aTabsInvalidated.insert(nTab1); } Broadcast(ScPaintHint(aPaintRanges.Combine(), nPart)); @@ -176,7 +178,8 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, PaintPartFlags nPart, sa if ((nPart & (PaintPartFlags::Top | PaintPartFlags::Left)) && comphelper::LibreOfficeKit::isActive()) { ScModelObj* pModel = GetModel(); -SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel); +for (auto nTab : aTabsInvalidated) +SfxLokHelper::notifyPartSizeChangedAllViews(pModel, nTab); } }
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc_copypaste.cxx | 17 + sc/source/core/data/documen3.cxx |9 - 2 files changed, 25 insertions(+), 1 deletion(-) New commits: commit cb141564733eef078347b89ea657e46e193bd140 Author: Czeber László Ádám AuthorDate: Mon Jul 17 11:41:17 2023 +0200 Commit: László Németh CommitDate: Tue Aug 22 11:56:13 2023 +0200 tdf#103480 sc: fix lost hyperlink at merging an empty cell with its cell Merging a cell containing a hyperlink with an empty cell resulted the loss of the hyperlink, i.e. only the text content was kept. Change-Id: I5148ce55157e3ad7926f5b5a82a682b837a784ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154520 Reviewed-by: László Németh Tested-by: László Németh diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx index bad57d8646a7..575cfb90f9f7 100644 --- a/sc/qa/unit/ucalc_copypaste.cxx +++ b/sc/qa/unit/ucalc_copypaste.cxx @@ -10752,6 +10752,23 @@ CPPUNIT_TEST_FIXTURE(TestCopyPaste, testUndoBackgroundColor) m_pDoc->DeleteTab(0); } +CPPUNIT_TEST_FIXTURE(TestCopyPaste, testMergedHyperlink) +{ +m_pDoc->InsertTab(0, "Table1"); +m_pDoc->InitDrawLayer(m_xDocShell.get()); + +ScFieldEditEngine& pEE = m_pDoc->GetEditEngine(); +pEE.SetTextCurrentDefaults("https://libreoffice.org/";); +m_pDoc->SetEditText(ScAddress(1, 0, 0), pEE.CreateTextObject()); // B1 + +m_pDoc->DoMergeContents(0, 0, 1, 0, 0); // A1:B1 + +CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, m_pDoc->GetCellType(ScAddress(0, 0, 0))); // A1 +const EditTextObject* pEditObj = m_pDoc->GetEditText(ScAddress(0, 0, 0)); // A1 +CPPUNIT_ASSERT(pEditObj); +CPPUNIT_ASSERT_EQUAL(OUString("https://libreoffice.org/";), pEditObj->GetText(0)); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 73cf516c4d49..b52deed7d85b 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -2030,6 +2030,7 @@ void ScDocument::DoMergeContents( SCCOL nStartCol, SCROW nStartRow, OUString aCellStr; SCCOL nCol; SCROW nRow; +ScCellValue aCell; for (nRow=nStartRow; nRow<=nEndRow; nRow++) for (nCol=nStartCol; nCol<=nEndCol; nCol++) { @@ -2039,12 +2040,18 @@ void ScDocument::DoMergeContents( SCCOL nStartCol, SCROW nStartRow, if (!aTotal.isEmpty()) aTotal.append(' '); aTotal.append(aCellStr); +ScAddress aPos(nCol, nRow, nTab); +if ((GetCellType(aPos) == CELLTYPE_EDIT) && aCell.isEmpty()) +aCell = ScRefCellValue(*this, aPos); } if (nCol != nStartCol || nRow != nStartRow) SetString(nCol,nRow,nTab,""); } -SetString(nStartCol,nStartRow,nTab,aTotal.makeStringAndClear()); +if (aCell.isEmpty() || !GetString(nStartCol, nStartRow, nTab).isEmpty()) +SetString(nStartCol, nStartRow, nTab, aTotal.makeStringAndClear()); +else +aCell.release(*this, ScAddress(nStartCol, nStartRow, nTab)); } void ScDocument::DoEmptyBlock( SCCOL nStartCol, SCROW nStartRow,
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx |3 + sc/source/ui/inc/tabview.hxx |6 ++- sc/source/ui/view/cellsh4.cxx|8 ++-- sc/source/ui/view/tabview2.cxx | 47 +-- sc/source/ui/view/tabview3.cxx |4 +- 5 files changed, 56 insertions(+), 12 deletions(-) New commits: commit 6568a29fa256d143a332b424c0582b0e665b65d6 Author: Caolán McNamara AuthorDate: Tue Jul 25 14:16:39 2023 +0100 Commit: Caolán McNamara CommitDate: Wed Jul 26 09:54:03 2023 +0200 cool#6931 on ctrl+[right/down] don't leap to the limits of the document ...when there is no more data, instead jump a generous block of emptiness. Limit to direct interaction by user and the simple navigation case (leaving block selection alone) and only for LibreOfficeKit::isActive Change-Id: I66234394529785d3f0f8fe6a6524239dad8ffb32 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154892 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index fd2413e9f0af..254fb5e8a042 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1896,7 +1896,8 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testJumpToLastRowInvalidation) Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); -CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 26775, 267386880), aView1.m_aInvalidations[0]); +// 261375 because we limit how far we jump into empty space in online, 267386880 if we don't limit +CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 26775, 261375), aView1.m_aInvalidations[0]); } // We need to ensure that views are not perterbed by rendering (!?) hmm ... diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx index 3f270770ec89..edb9dd991971 100644 --- a/sc/source/ui/inc/tabview.hxx +++ b/sc/source/ui/inc/tabview.hxx @@ -241,7 +241,8 @@ private: static tools::Long GetScrollBarPos( const ScrollAdaptor& rScroll ); voidGetAreaMoveEndPosition(SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, - SCCOL& rAreaX, SCROW& rAreaY, ScFollowMode& rMode); + SCCOL& rAreaX, SCROW& rAreaY, ScFollowMode& rMode, + bool bInteractiveByUser = false); voidSkipCursorHorizontal(SCCOL& rCurX, SCROW& rCurY, SCCOL nOldX, SCCOL nMovX); voidSkipCursorVertical(SCCOL& rCurX, SCROW& rCurY, SCROW nOldY, SCROW nMovY); @@ -435,7 +436,8 @@ public: voidMoveCursorPage( SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, bool bShift, bool bKeepSel = false ); voidMoveCursorArea( SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, -bool bShift, bool bKeepSel = false ); +bool bShift, bool bKeepSel = false, +bool bInteractiveByUser = false ); voidMoveCursorEnd( SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, bool bShift, bool bKeepSel = false ); voidMoveCursorScreen( SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, bool bShift ); diff --git a/sc/source/ui/view/cellsh4.cxx b/sc/source/ui/view/cellsh4.cxx index e44dbe599dba..8cf13970bdeb 100644 --- a/sc/source/ui/view/cellsh4.cxx +++ b/sc/source/ui/view/cellsh4.cxx @@ -141,7 +141,7 @@ void ScCellShell::ExecuteCursor( SfxRequest& rReq ) break; case SID_CURSORBLKDOWN: -pTabViewShell->MoveCursorArea( 0, nRepeat, SC_FOLLOW_JUMP, bSel, bKeep ); +pTabViewShell->MoveCursorArea( 0, nRepeat, SC_FOLLOW_JUMP, bSel, bKeep, !rReq.IsAPI() ); break; case SID_CURSORUP: @@ -152,7 +152,7 @@ void ScCellShell::ExecuteCursor( SfxRequest& rReq ) break; case SID_CURSORBLKUP: -pTabViewShell->MoveCursorArea( 0, -nRepeat, SC_FOLLOW_JUMP, bSel, bKeep ); +pTabViewShell->MoveCursorArea( 0, -nRepeat, SC_FOLLOW_JUMP, bSel, bKeep, !rReq.IsAPI() ); break; case SID_CURSORLEFT: @@ -163,7 +163,7 @@ void ScCellShell::ExecuteCursor( SfxRequest& rReq ) break; case SID_CURSORBLKLEFT: -pTabViewShell->MoveCursorArea( static_cast(-nRepeat * nRTLSign), 0, SC_FOLLOW_JUMP, bSel, bKeep ); +pTabViewShell->MoveCursorArea( static_cast(-nRepeat * nRTLSign), 0, SC_FOLLOW_JUMP, bSel, bKeep, !rReq.IsAPI() ); break; case SID_CURSORRIGHT: @@ -174,7 +174,7 @@ void ScCellShell::ExecuteCursor( SfxRequest& rReq ) break; ca
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/tdf142905.xlsx |binary sc/qa/unit/subsequent_filters_test4.cxx | 12 sc/source/filter/oox/excelhandlers.cxx |4 +++- 3 files changed, 15 insertions(+), 1 deletion(-) New commits: commit 7ec4c6df68233b73b1e257e013583ca49fc2ec9b Author: Czeber László Ádám AuthorDate: Thu Jul 20 13:14:21 2023 +0200 Commit: László Németh CommitDate: Tue Jul 25 15:50:15 2023 +0200 tdf#142905 XLSX import: don't trim leading spaces in formula cell When importing an XLSX file, there was a discrepancy between the read and recalculated cell values if it contains leading/ending spaces. With this fix, trimming in worksheet files is only applied to elements that contain a parameter and do not have a space="preserved" parameter. Change-Id: I91e09eaa3cb79537ddbed36e1124e4afd124d8f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154674 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/data/xlsx/tdf142905.xlsx b/sc/qa/unit/data/xlsx/tdf142905.xlsx new file mode 100644 index ..b6e8296581c3 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf142905.xlsx differ diff --git a/sc/qa/unit/subsequent_filters_test4.cxx b/sc/qa/unit/subsequent_filters_test4.cxx index 646b1e66f5b7..27d9d6f29150 100644 --- a/sc/qa/unit/subsequent_filters_test4.cxx +++ b/sc/qa/unit/subsequent_filters_test4.cxx @@ -1918,6 +1918,18 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf155402) CPPUNIT_ASSERT_EQUAL(OUString("/[tdf155402.xlsx]Sheet1"), aFilename); } +CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf142905) +{ +createScDoc("xlsx/tdf142905.xlsx"); +ScDocument* pDoc = getScDoc(); + +// Without the fix, trims the spaces in cell C1 after reading the XLSX file. +// After recalculation it is fixed. +// - Expected: " 3M " +// - Actual : "3M" +CPPUNIT_ASSERT_EQUAL(OUString(" 3M "), pDoc->GetString(2, 0, 0)); +} + ScFiltersTest4::ScFiltersTest4() : ScModelTestBase("sc/qa/unit/data") { diff --git a/sc/source/filter/oox/excelhandlers.cxx b/sc/source/filter/oox/excelhandlers.cxx index ab39116b695b..77b5dda2ade7 100644 --- a/sc/source/filter/oox/excelhandlers.cxx +++ b/sc/source/filter/oox/excelhandlers.cxx @@ -30,9 +30,11 @@ WorkbookFragmentBase::WorkbookFragmentBase( { } +// tdf142905: Change mbEnableTrimSpace default value is false, +// because it will not trim members that do not have an attribute. WorksheetFragmentBase::WorksheetFragmentBase( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) : -FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ), +FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath, false ), WorksheetHelper( rHelper ) { }
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/uicalc/uicalc2.cxx| 26 ++ sc/source/core/tool/refupdat.cxx |7 +-- 2 files changed, 27 insertions(+), 6 deletions(-) New commits: commit 94ca402cd1fe2fd9776d08448f7216b7f638e69a Author: Tünde Tóth AuthorDate: Tue Jul 18 15:20:47 2023 +0200 Commit: László Németh CommitDate: Tue Jul 25 15:04:01 2023 +0200 tdf#156174 sc DBData: fix regression of database ranges Regression from commit 0c0444c44107f1a18f23dd0833d462d8dbf56569 "tdf#126926 sc DBData: delete the database range". Change-Id: If641af42a44cadbb8485bfa5b9a8eca5a757 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154582 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx index 44ebf12935bc..4e154f8bbb83 100644 --- a/sc/qa/unit/uicalc/uicalc2.cxx +++ b/sc/qa/unit/uicalc/uicalc2.cxx @@ -1446,6 +1446,32 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf155796) CPPUNIT_ASSERT_EQUAL(OUString("Sheet1.A1:Sheet1.A3"), aMarkedAreaString); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf156174) +{ +createScDoc(); +ScDocument* pDoc = getScDoc(); + +insertNewSheet(*pDoc); + +insertStringToCell("A1", u"1"); +insertStringToCell("A2", u"2"); +insertStringToCell("B1", u"3"); +insertStringToCell("B2", u"4"); + +ScDBData* pDBData = new ScDBData("testDB", 1, 0, 0, 1, 1); +bool bInserted += pDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr(pDBData)); +CPPUNIT_ASSERT(bInserted); + +insertNewSheet(*pDoc); +uno::Sequence aArgs( +comphelper::InitPropertySequence({ { "Index", uno::Any(sal_uInt16(3)) } })); +dispatchCommand(mxComponent, ".uno:Remove", aArgs); + +ScDBCollection* pDBs = pDoc->GetDBCollection(); +CPPUNIT_ASSERT(!pDBs->empty()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx index ef0902aab3f4..e05a14d0137f 100644 --- a/sc/source/core/tool/refupdat.cxx +++ b/sc/source/core/tool/refupdat.cxx @@ -286,12 +286,7 @@ ScRefUpdateRes ScRefUpdate::Update( const ScDocument* pDoc, UpdateRefMode eUpdat bool bExp = (bExpand && IsExpand( theTab1, theTab2, nTab1, nDz )); bCut1 = lcl_MoveStart( theTab1, nTab1, nDz, nMaxTab ); bCut2 = lcl_MoveEnd( theTab2, nTab1, nDz, nMaxTab ); -if ( theTab2 < theTab1 ) -{ -eRet = UR_INVALID; -theTab2 = theTab1; -} -else if ( bCut1 || bCut2 ) +if ( bCut1 || bCut2 ) eRet = UR_UPDATED; if ( bExp ) {
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc_condformat.cxx | 54 ++ sc/source/ui/docshell/docfunc.cxx |2 - 2 files changed, 55 insertions(+), 1 deletion(-) New commits: commit e384be0f6ea6453e57cd4a7c4402d26b49debc41 Author: Tibor Nagy AuthorDate: Thu Jul 13 14:54:55 2023 +0200 Commit: László Németh CommitDate: Tue Jul 25 14:12:34 2023 +0200 tdf#99808 sc: fix background of conditional formatting in merged cell The background color of conditional formatting is applied only to the first cell in the merged block, at least under Windows. Note: Undo/Redo is still not perfect, at least under Linux. Change-Id: Ic87983fa6e3279a64841babc565fbe97710ff730 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154390 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx index 634373b58ccc..6b79a4318501 100644 --- a/sc/qa/unit/ucalc_condformat.cxx +++ b/sc/qa/unit/ucalc_condformat.cxx @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -25,6 +26,23 @@ namespace { +struct PaintListener : public SfxListener +{ +bool mbPaintAllMergedCell = false; +virtual void Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) override +{ +const ScPaintHint* pPaintHint = dynamic_cast(&rHint); +if (pPaintHint) +{ +if (pPaintHint->GetStartCol() == 0 && pPaintHint->GetEndCol() == 0 +&& pPaintHint->GetStartRow() == 0 && pPaintHint->GetEndRow() == 1) +{ +mbPaintAllMergedCell = true; +} +} +} +}; + struct ScDataBarLengthData { double nVal; @@ -1361,6 +1379,42 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, testCondFormatVolatileFunctionRecalc) m_pDoc->DeleteTab(0); } +CPPUNIT_TEST_FIXTURE(TestCondformat, testConditionStyleInMergedCell) +{ +m_pDoc->InsertTab(0, "Test"); + +PaintListener aListener; +aListener.StartListening(*m_xDocShell); + +m_pDoc->DoMerge(0, 0, 0, 1, 0); // A1:A2 +CPPUNIT_ASSERT(m_pDoc->IsMerged(ScAddress(0, 0, 0))); + +m_pDoc->SetValue(ScAddress(0, 0, 0), 1.0); + +// Add a conditional format. +auto pFormat = std::make_unique(1, m_pDoc); +pFormat->SetRange(ScRange(0, 0, 0, 0, 0, 0)); +auto pFormatTmp = pFormat.get(); +sal_uLong nKey = m_pDoc->AddCondFormat(std::move(pFormat), 0); + +// Add condition in which if the value equals 1, set the "Good" style. +ScCondFormatEntry* pEntry = new ScCondFormatEntry( +ScConditionMode::Equal, "=1", "", *m_pDoc, ScAddress(0, 0, 0), ScResId(STR_STYLENAME_GOOD)); +pFormatTmp->AddEntry(pEntry); + +// Apply the format to the range. +m_pDoc->AddCondFormatData(pFormatTmp->GetRange(), 0, nKey); + +ScDocFunc& rFunc = m_xDocShell->GetDocFunc(); +sal_uInt32 nOldFormat = pFormatTmp->GetKey(); +const ScRangeList& rRangeList = pFormatTmp->GetRange(); +rFunc.ReplaceConditionalFormat(nOldFormat, pFormatTmp->Clone(), 0, rRangeList); + +CPPUNIT_ASSERT_EQUAL(true, aListener.mbPaintAllMergedCell); + +m_pDoc->DeleteTab(0); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 4d99824fe0a0..4d3288558c40 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -5670,7 +5670,7 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, std::unique_ptr< } if(pRepaintRange) -rDocShell.PostPaint(*pRepaintRange, PaintPartFlags::Grid); +rDocShell.PostPaint(*pRepaintRange, PaintPartFlags::Grid, SC_PF_TESTMERGE); aModificator.SetDocumentModified(); SfxGetpApp()->Broadcast(SfxHint(SfxHintId::ScAreasChanged));
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc_condformat.cxx | 52 +++ sc/source/core/data/fillinfo.cxx | 20 +++ 2 files changed, 72 insertions(+) New commits: commit ee4bd745be5dee15b68ca483f7f7771957ae3b3e Author: Tibor Nagy AuthorDate: Wed Jul 12 17:17:10 2023 +0200 Commit: László Németh CommitDate: Tue Jul 25 10:28:32 2023 +0200 tdf#155322 sc: fix conditional format color scale in merged cells Only first cell of a merged range got coloring, now all of them. See also commit f142b3e84f97ae678bd0a94614e867d369680458 "tdf#131471 sc: fix background color of conditional formatting style". Change-Id: I0e95bf49369de219e659295643aaf2659dd3de48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154362 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx index 78978daec33a..634373b58ccc 100644 --- a/sc/qa/unit/ucalc_condformat.cxx +++ b/sc/qa/unit/ucalc_condformat.cxx @@ -319,6 +319,58 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, testDataBarCondCopyPaste) m_pDoc->DeleteTab(0); } +CPPUNIT_TEST_FIXTURE(TestCondformat, testColorScaleInMergedCell) +{ +m_pDoc->InsertTab(0, "Test"); +m_pDoc->SetValue(ScAddress(0, 0, 0), 1.0); + +// Add a conditional format to A1. +auto pFormat = std::make_unique(1, m_pDoc); +pFormat->SetRange(ScRange(0, 0, 0, 0, 0, 0)); +auto pFormatTmp = pFormat.get(); +sal_uLong nKey = m_pDoc->AddCondFormat(std::move(pFormat), 0); + +// Add color scale entries. +// The coloring is based on the value. (BLUE (x <= 0), GREEN (x == 1), RED (x >= 2)) +ScColorScaleFormat* pColorScaleFormat = new ScColorScaleFormat(m_pDoc); +ScColorScaleEntry* pEntryBlue = new ScColorScaleEntry(0, COL_BLUE); +ScColorScaleEntry* pEntryGreen = new ScColorScaleEntry(1, COL_GREEN); +ScColorScaleEntry* pEntryRed = new ScColorScaleEntry(2, COL_RED); +pColorScaleFormat->AddEntry(pEntryBlue); +pColorScaleFormat->AddEntry(pEntryGreen); +pColorScaleFormat->AddEntry(pEntryRed); + +pFormatTmp->AddEntry(pColorScaleFormat); + +// Apply the format to the range. +m_pDoc->AddCondFormatData(pFormatTmp->GetRange(), 0, nKey); + +m_pDoc->DoMerge(0, 0, 0, 1, 0); // A1:A2 +CPPUNIT_ASSERT(m_pDoc->IsMerged(ScAddress(0, 0, 0))); + +ScTableInfo aTabInfo; +m_pDoc->FillInfo(aTabInfo, 0, 0, 0, 1, 0, 1, 1, false, false); +RowInfo* pRowInfo = aTabInfo.mpRowInfo.get(); + +RowInfo* pRowInfoA1 = &pRowInfo[1]; +ScCellInfo* pCellInfoA1 = &pRowInfoA1->cellInfo(0); +// Check if there is a color scale in A1. +CPPUNIT_ASSERT_EQUAL_MESSAGE("There is no color scale in cell A1!", true, + pCellInfoA1->mxColorScale.has_value()); + +RowInfo* pRowInfoA2 = &pRowInfo[2]; +ScCellInfo* pCellInfoA2 = &pRowInfoA2->cellInfo(0); +// Check if there is a color scale in A2. +CPPUNIT_ASSERT_EQUAL_MESSAGE("There is no color scale in cell A2!", true, + pCellInfoA2->mxColorScale.has_value()); + +// Check that cells A1 and A2 have the same color scale. (GREEN) + CPPUNIT_ASSERT(pCellInfoA1->mxColorScale.value().IsRGBEqual(pCellInfoA2->mxColorScale.value())); + +m_pDoc->DeleteTab(0); +} + + CPPUNIT_TEST_FIXTURE(TestCondformat, testColorScaleCondCopyPaste) { m_pDoc->InsertTab(0, "Test"); diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx index 94d79da68031..2e268239b048 100644 --- a/sc/source/core/data/fillinfo.cxx +++ b/sc/source/core/data/fillinfo.cxx @@ -743,6 +743,26 @@ void ScDocument::FillInfo( pInfo->pShadowAttr = pShadowItem; if (pInfo->pShadowAttr != pDefShadow) bAnyShadow = true; + +const ScCondFormatIndexes& rCondFormatIndex += pStartPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData(); + +if (pCondFormList && !pStartCond && !rCondFormatIndex.empty()) +{ +for (const auto& rItem : rCondFormatIndex) +{ +const ScConditionalFormat* pCondForm = pCondFormList->GetFormat(rItem); +if (pCondForm) +{ +ScCondFormatData aData = pCondForm->GetData( +pInfo->maCell, ScAddress(nStartX, nStartY, nTab)); + +// Color scale +if (aData.mxColorScale && !pInfo->mxColorScale) +pInfo->mxColorScale = aData.mxColorScale; +} +} +} } } }
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/tdf131471.ods |binary sc/qa/unit/subsequent_filters_test3.cxx | 25 +++-- sc/source/ui/unoobj/docuno.cxx |2 +- 3 files changed, 24 insertions(+), 3 deletions(-) New commits: commit f142b3e84f97ae678bd0a94614e867d369680458 Author: Tibor Nagy AuthorDate: Mon Jul 10 17:53:49 2023 +0200 Commit: László Németh CommitDate: Mon Jul 24 15:03:58 2023 +0200 tdf#131471 sc: fix background color of conditional formatting style The issue appears for merged cells when you trigger a change that causes the condition to be evaluated again. Manual test: open unit test document, put "1" in A1, and press Undo: the green background color of the condition was removed only partially. Change-Id: I8bb17c77ac49a1ee897c3e2b4902723d237765d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154277 Reviewed-by: László Németh Tested-by: László Németh diff --git a/sc/qa/unit/data/ods/tdf131471.ods b/sc/qa/unit/data/ods/tdf131471.ods new file mode 100644 index ..31f079274256 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf131471.ods differ diff --git a/sc/qa/unit/subsequent_filters_test3.cxx b/sc/qa/unit/subsequent_filters_test3.cxx index 44cd7024506c..54d5061d2cd9 100644 --- a/sc/qa/unit/subsequent_filters_test3.cxx +++ b/sc/qa/unit/subsequent_filters_test3.cxx @@ -391,8 +391,9 @@ struct PaintListener : public SfxListener const ScPaintHint* pPaintHint = dynamic_cast(&rHint); if (pPaintHint) { -if (pPaintHint->GetStartCol() <= 0 && pPaintHint->GetEndCol() >= 0 -&& pPaintHint->GetStartRow() <= 9 && pPaintHint->GetEndRow() >= 9) +if ((pPaintHint->GetStartCol() <= 0 && pPaintHint->GetEndCol() >= 0) +&& ((pPaintHint->GetStartRow() <= 9 && pPaintHint->GetEndRow() >= 9) +|| (pPaintHint->GetStartRow() == 2 && pPaintHint->GetEndRow() == 3))) { mbCalled = true; } @@ -420,6 +421,26 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testCondFormatFormulaListenerXLSX) CPPUNIT_ASSERT(aListener.mbCalled); } +CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf131471) +{ +// Repaint range of conditional format in merged cell. +createScDoc("ods/tdf131471.ods"); +ScDocShell* pDocSh = getScDocShell(); +PaintListener aListener; +aListener.StartListening(*pDocSh); +ScDocument* pDoc = getScDoc(); +ScConditionalFormatList* pList = pDoc->GetCondFormList(0); +CPPUNIT_ASSERT(pList); + +CPPUNIT_ASSERT_EQUAL(size_t(1), pList->size()); +ScConditionalFormat* pFormat = pList->begin()->get(); +CPPUNIT_ASSERT(pFormat); +pDoc->SetDocVisible(true); +pDoc->SetValue(0, 0, 0, 1.0); + +CPPUNIT_ASSERT(aListener.mbCalled); +} + CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf137091) { // Set the system locale to Turkish diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 33ffbd393f12..66c2667a1a1f 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -488,7 +488,7 @@ void ScModelObj::RepaintRange( const ScRange& rRange ) void ScModelObj::RepaintRange( const ScRangeList& rRange ) { if (pDocShell) -pDocShell->PostPaint( rRange, PaintPartFlags::Grid ); +pDocShell->PostPaint(rRange, PaintPartFlags::Grid, SC_PF_TESTMERGE); } static ScViewData* lcl_getViewMatchingDocZoomTab(const Fraction& rZoomX,
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/uicalc/uicalc2.cxx | 27 ++ sc/source/ui/view/tabview2.cxx | 375 +++-- 2 files changed, 245 insertions(+), 157 deletions(-) New commits: commit 341029de72cf957b7bc7775e51544070d4a49874 Author: Jaume Pujantell AuthorDate: Thu Jul 6 09:22:15 2023 +0200 Commit: Jaume Pujantell CommitDate: Fri Jul 7 08:59:31 2023 +0200 tdf#155796 sc: fix select with merged cells When selecting multiple cells or modifying a selection with shift+arrow make sure that a merge group is never partially selected. This also fixes tdf#128678 Change-Id: Ida00939cec11240c0d06375feb21afa82a6876da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154093 Tested-by: Jenkins Reviewed-by: Jaume Pujantell diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx index 3be123de219d..44ebf12935bc 100644 --- a/sc/qa/unit/uicalc/uicalc2.cxx +++ b/sc/qa/unit/uicalc/uicalc2.cxx @@ -1419,6 +1419,33 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf152577) CPPUNIT_ASSERT(!pDBs->empty()); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf155796) +{ +createScDoc(); + +goToCell("A1:A3"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); +goToCell("A4:A6"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); + +goToCell("A1:A6"); + +ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_SHIFT | KEY_UP); +Scheduler::ProcessEventsToIdle(); + +ScRangeList aMarkedArea = getViewShell()->GetViewData().GetMarkData().GetMarkedRanges(); +ScDocument* pDoc = getScDoc(); +OUString aMarkedAreaString; +ScRangeStringConverter::GetStringFromRangeList(aMarkedAreaString, &aMarkedArea, pDoc, + formula::FormulaGrammar::CONV_OOO); + +// Without the fix in place, this test would have failed with +// - Expected: Sheet1.A1:Sheet1.A3 +// - Actual : Sheet1.A1:Sheet1.A5 +CPPUNIT_ASSERT_EQUAL(OUString("Sheet1.A1:Sheet1.A3"), aMarkedAreaString); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 6b1cfef156f7..442dc92ccb73 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -58,6 +58,19 @@ bool isCellQualified(const ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, return true; } +bool areCellsQualified(const ScDocument* pDoc, SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, + SCROW nRowEnd, SCTAB nTab, bool bSelectLocked, bool bSelectUnlocked) +{ +PutInOrder(nColStart, nColEnd); +PutInOrder(nRowStart, nRowEnd); +for (SCCOL col = nColStart; col <= nColEnd; ++col) +for (SCROW row = nRowStart; row <= nRowEnd; ++row) +if (!isCellQualified(pDoc, col, row, nTab, bSelectLocked, bSelectUnlocked)) +return false; + +return true; +} + void moveCursorByProtRule( SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, const ScDocument* pDoc) { @@ -180,13 +193,9 @@ bool checkBoundary(const ScDocument* pDoc, SCCOL& rCol, SCROW& rRow) return bGood; } -void moveCursorByMergedCell( -SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, -const ScDocument* pDoc, const ScViewData& rViewData) +void moveCursorByMergedCell(SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCCOL nStartX, +SCROW nStartY, SCTAB nTab, const ScDocument* pDoc) { -SCCOL nOrigX = rViewData.GetCurX(); -SCROW nOrigY = rViewData.GetCurY(); - const ScTableProtection* pTabProtection = pDoc->GetTabProtection(nTab); bool bSelectLocked = true; bool bSelectUnlocked = true; @@ -196,108 +205,198 @@ void moveCursorByMergedCell( bSelectUnlocked = pTabProtection->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS); } -const ScMergeAttr* pMergeAttr = pDoc->GetAttr(nOrigX, nOrigY, nTab, ATTR_MERGE); - -bool bOriginMerged = false; -SCCOL nColSpan = 1; -SCROW nRowSpan = 1; -if (pMergeAttr && pMergeAttr->IsMerged()) -{ -nColSpan = pMergeAttr->GetColMerge(); -nRowSpan = pMergeAttr->GetRowMerge(); -bOriginMerged = true; -} - if (nMovX > 0) { -SCCOL nOld = rCol; -if (bOriginMerged) -{ -// Original cell is merged. Push the block end outside the merged region. -if (nOrigX < pDoc->MaxCol() && nOrigX < rCol && rCol <= nOrigX + nColSpan - 1) -rCol = nOrigX + nColSpan; -} -else -{ -pDoc->SkipOverlapped(rCol, rRow, nTab); -} +SCROW rowStart = std::min(rRow, nStartY); +SCROW rowEnd = std::max(rRow, nStartY); -if (nOld < rCol) +for (SCROW i = rowStart; i <= rowEnd &&
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ThemeImportExportTest.cxx | 34 +-- sc/qa/unit/subsequent_export_test4.cxx |2 sc/source/filter/excel/xestyle.cxx | 72 ++--- sc/source/filter/inc/xestyle.hxx | 20 + 4 files changed, 85 insertions(+), 43 deletions(-) New commits: commit 42bbc9fbdf940e55213ee2a259c1d31de2e4cbec Author: Tomaž Vajngerl AuthorDate: Sat Jul 1 14:26:08 2023 +0900 Commit: Tomaž Vajngerl CommitDate: Tue Jul 4 08:42:51 2023 +0200 sc: add border export and enable round-trip test Change-Id: I76071185d819b9645d97a3e599ea7f48b341a145 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153820 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/sc/qa/unit/ThemeImportExportTest.cxx b/sc/qa/unit/ThemeImportExportTest.cxx index 95e6d0e2351e..0cf03ea6c010 100644 --- a/sc/qa/unit/ThemeImportExportTest.cxx +++ b/sc/qa/unit/ThemeImportExportTest.cxx @@ -60,6 +60,12 @@ CPPUNIT_TEST_FIXTURE(ThemeImportExportTest, testThemeExport) assertXPath(pXmlDoc, "/x:styleSheet/x:fills/x:fill[4]/x:patternFill/x:fgColor", "theme", "4"); } +// Round 100th percent to percent value - so that small differences don't fail the test +sal_Int32 roundToPercent(sal_Int16 n100Percent) +{ +return sal_Int32(std::round(double(n100Percent) / 100.0)); +} + void checkCellBackgroundThemeColor(ScDocument* pDoc) { // A1 @@ -90,9 +96,9 @@ void checkCellBackgroundThemeColor(ScDocument* pDoc) auto& rTransformations = aComplexColor.getTransformations(); CPPUNIT_ASSERT_EQUAL(size_t(2), rTransformations.size()); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTransformations[0].meType); -CPPUNIT_ASSERT_EQUAL(20, sal_Int32(std::round(rTransformations[0].mnValue / 100.0))); +CPPUNIT_ASSERT_EQUAL(20, roundToPercent(rTransformations[0].mnValue)); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff, rTransformations[1].meType); -CPPUNIT_ASSERT_EQUAL(80, sal_Int32(std::round(rTransformations[1].mnValue / 100.0))); +CPPUNIT_ASSERT_EQUAL(80, roundToPercent(rTransformations[1].mnValue)); } // A3 @@ -109,7 +115,7 @@ void checkCellBackgroundThemeColor(ScDocument* pDoc) auto& rTransformations = aComplexColor.getTransformations(); CPPUNIT_ASSERT_EQUAL(size_t(1), rTransformations.size()); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTransformations[0].meType); -CPPUNIT_ASSERT_EQUAL(sal_Int16(5000), rTransformations[0].mnValue); +CPPUNIT_ASSERT_EQUAL(50, roundToPercent(rTransformations[0].mnValue)); } } @@ -151,9 +157,9 @@ void checkCellTextThemeColor(ScDocument* pDoc) auto& rTransformations = aComplexColor.getTransformations(); CPPUNIT_ASSERT_EQUAL(size_t(2), rTransformations.size()); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTransformations[0].meType); -CPPUNIT_ASSERT_EQUAL(60, sal_Int32(std::round(rTransformations[0].mnValue / 100.0))); +CPPUNIT_ASSERT_EQUAL(60, roundToPercent(rTransformations[0].mnValue)); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff, rTransformations[1].meType); -CPPUNIT_ASSERT_EQUAL(40, sal_Int32(std::round(rTransformations[1].mnValue / 100.0))); +CPPUNIT_ASSERT_EQUAL(40, roundToPercent(rTransformations[1].mnValue)); } // B3 @@ -170,7 +176,7 @@ void checkCellTextThemeColor(ScDocument* pDoc) auto& rTransformations = aComplexColor.getTransformations(); CPPUNIT_ASSERT_EQUAL(size_t(1), rTransformations.size()); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTransformations[0].meType); -CPPUNIT_ASSERT_EQUAL(sal_Int16(5000), rTransformations[0].mnValue); +CPPUNIT_ASSERT_EQUAL(50, roundToPercent(rTransformations[0].mnValue)); } } @@ -226,9 +232,9 @@ void checkCellBorderThemeColor(ScDocument* pDoc) auto& rTransformations = aComplexColor.getTransformations(); CPPUNIT_ASSERT_EQUAL(size_t(2), rTransformations.size()); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTransformations[0].meType); -CPPUNIT_ASSERT_EQUAL(sal_Int16(2000), rTransformations[0].mnValue); +CPPUNIT_ASSERT_EQUAL(20, roundToPercent(rTransformations[0].mnValue)); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff, rTransformations[1].meType); -CPPUNIT_ASSERT_EQUAL(sal_Int16(7999), rTransformations[1].mnValue); +CPPUNIT_ASSERT_EQUAL(80, roundToPercent(rTransformations[1].mnValue)); } { auto* pTop = pBoxItem->GetRight(); @@ -239,9 +245,9 @@ void checkCellBorderThemeColor(ScDocument* pDoc) auto& rTransformations = aComplexColor.getTransformations(); CPPUNIT_ASSERT_EQUAL(size_t(2), rTransformations.size()); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rT
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/helper/qahelper.cxx | 38 ++ sc/source/core/data/dpoutput.cxx |6 +- 2 files changed, 43 insertions(+), 1 deletion(-) New commits: commit 3551d18404cb19cdaa8edb170a549f5c5405d0cb Author: luigiiucci AuthorDate: Wed May 17 11:02:37 2023 +0200 Commit: Tomaž Vajngerl CommitDate: Wed Jun 28 02:07:03 2023 +0200 Header columns can disappear with filtered data in pivot tables When we set on a pivot table a filter that filters all the rows, the pivot table showed only the first header columns and computed column, but all the columns headers should still be shown so we can adjust the filter for the column. This fixes this issue. Also add more debug output and prevent a crash when running pivot table tests. Change-Id: I30b4ee72cf8436c4522ab4ba0781462b214816dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151871 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 890a330f147d..eff2c62d9aeb 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #include @@ -481,6 +482,43 @@ bool checkOutput( svl::GridPrinter printer(e.Row() - s.Row() + 1, e.Col() - s.Col() + 1, CALC_DEBUG_OUTPUT != 0); SCROW nOutRowSize = e.Row() - s.Row() + 1; SCCOL nOutColSize = e.Col() - s.Col() + 1; + +// Check if expected size iz smaller than actual size (and prevent a crash) +if (aCheck.size() < o3tl::make_unsigned(nOutRowSize) || aCheck[0].size() < o3tl::make_unsigned(nOutColSize)) +{ +// Dump the arrays to console, so we can compare +std::cout << "Expected data:" << std::endl; +for (size_t nRow = 0; nRow < aCheck.size(); ++nRow) +{ +for (size_t nCol = 0; nCol < aCheck[nRow].size(); ++nCol) +{ +const char* p = aCheck[nRow][nCol]; +if (p) +{ +OUString aCheckVal = OUString::createFromAscii(p); +std::cout << "'" << aCheckVal << "', "; +} +else +std::cout << "null, "; +} +std::cout << std::endl; +} + +std::cout << "Actual data:" << std::endl; +for (SCROW nRow = 0; nRow < nOutRowSize; ++nRow) +{ +for (SCCOL nCol = 0; nCol < nOutColSize; ++nCol) +{ +OUString aVal = pDoc->GetString(nCol + s.Col(), nRow + s.Row(), s.Tab()); +std::cout << "'" << aVal << "', "; +} +std::cout << std::endl; +} +std::cout << std::endl; + +return false; +} + for (SCROW nRow = 0; nRow < nOutRowSize; ++nRow) { for (SCCOL nCol = 0; nCol < nOutColSize; ++nCol) diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index 00d8f2aabeb4..c964dda14c7a 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -608,7 +608,11 @@ ScDPOutput::ScDPOutput( ScDocument* pD, uno::Reference aResult = xLevRes->getResults(); ++nRowDims; -if (!lcl_MemberEmpty(aResult)) +// We want only to remove the DATA column if it is empty +// and not any other empty columns (to still show the +// header columns) +bool bSkip = lcl_MemberEmpty(aResult) && bIsDataLayout; +if (!bSkip) { bool bFieldCompact = false; try
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/calc_tests8/tdf54768.py | 32 sc/qa/uitest/data/tdf54768.ods |binary sc/source/ui/view/drawvie4.cxx | 16 3 files changed, 36 insertions(+), 12 deletions(-) New commits: commit f5bf91ea73bf8a7cd3abc0f343ab2bdceaad905a Author: Tibor Nagy AuthorDate: Thu Jun 22 09:53:59 2023 +0200 Commit: László Németh CommitDate: Tue Jun 27 14:18:42 2023 +0200 tdf#54768 sc: fix resizing of cropped images to original size This is a follow up to commit a4e12cbfc69cfe668fa30756a3c5843e911e22b1 (tdf#155863 sd: fix resizing of cropped images to original size) Change-Id: I923ed8b1df6c6559d527d43e4abe842497c4c28f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153449 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/uitest/calc_tests8/tdf54768.py b/sc/qa/uitest/calc_tests8/tdf54768.py new file mode 100644 index ..a4342fb8e238 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf54768.py @@ -0,0 +1,32 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_url_for_data_file + +class tdf54768(UITestCase): +def test_tdf54768(self): +# This document contains an image with an original size of 7.99cm x 5.74cm. +# The image has been cropped 2.73cm at the top. +# Also, it has been resized to a width of 4.04cm. +with self.ui_test.load_file(get_url_for_data_file("tdf54768.ods")) as document: +xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + +# select the image +xGridWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Image"})) + +# click "Original Size" +self.xUITest.executeCommand(".uno:OriginalSize") + +# tdf#155863: Without the fix in place, the image stays cropped, +# but stretches to the size of original image +self.assertEqual(7988, document.DrawPages[0].getByIndex(0).Size.Width) +self.assertEqual(3005, document.DrawPages[0].getByIndex(0).Size.Height) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/tdf54768.ods b/sc/qa/uitest/data/tdf54768.ods new file mode 100644 index ..222481db8bb0 Binary files /dev/null and b/sc/qa/uitest/data/tdf54768.ods differ diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx index 5cc1655b83c4..2bd329098206 100644 --- a/sc/source/ui/view/drawvie4.cxx +++ b/sc/source/ui/view/drawvie4.cxx @@ -476,9 +476,9 @@ void ScDrawView::SetMarkedOriginalSize() } else if (nIdent == SdrObjKind::Graphic) { -const Graphic& rGraphic = static_cast(pObj)->GetGraphic(); +const SdrGrafObj* pSdrGrafObj = static_cast(pObj); -MapMode aSourceMap = rGraphic.GetPrefMapMode(); +MapMode aSourceMap = pSdrGrafObj->GetGraphic().GetPrefMapMode(); MapMode aDestMap( MapUnit::Map100thMM ); if (aSourceMap.GetMapUnit() == MapUnit::MapPixel) { @@ -488,16 +488,8 @@ void ScDrawView::SetMarkedOriginalSize() aDestMap.SetScaleX(aNormScaleX); aDestMap.SetScaleY(aNormScaleY); } -if (pViewData) -{ -vcl::Window* pActWin = pViewData->GetActiveWin(); -if (pActWin) -{ -aOriginalSize = pActWin->LogicToLogic( -rGraphic.GetPrefSize(), &aSourceMap, &aDestMap ); -bDo = true; -} -} +aOriginalSize = pSdrGrafObj->getOriginalSize(); +bDo = true; } if ( bDo )
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/tdf156028.xlsx|binary sc/qa/unit/subsequent_filters_test.cxx | 11 +++ sc/source/core/data/colorscale.cxx |2 +- 3 files changed, 12 insertions(+), 1 deletion(-) New commits: commit 3e0537a6e746db6ea746af6b91f94aeb9d2b05d9 Author: Tibor Nagy AuthorDate: Mon Jun 26 11:35:38 2023 +0200 Commit: László Németh CommitDate: Tue Jun 27 14:09:27 2023 +0200 tdf#156028 sc: use color of the highest value if only one value (in a single cell or the same value repeating in all cells of the data set) on percentile color scale, like other spreadsheets do. This is a follow up to commit 6a059f8d1b0a7a5b64bd272e1e7b8291979bcd56 (tdf#155321 sc: fix color of the highest value on percentile color scale if the highest value occurs multiple times in the data set.) Change-Id: I630df332e403705e8338e3441af093c2de95c280 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153577 Reviewed-by: László Németh Tested-by: László Németh diff --git a/sc/qa/unit/data/xlsx/tdf156028.xlsx b/sc/qa/unit/data/xlsx/tdf156028.xlsx new file mode 100644 index ..6fc2fc814fe3 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf156028.xlsx differ diff --git a/sc/qa/unit/subsequent_filters_test.cxx b/sc/qa/unit/subsequent_filters_test.cxx index f633073c85f9..d02ebc075e3e 100644 --- a/sc/qa/unit/subsequent_filters_test.cxx +++ b/sc/qa/unit/subsequent_filters_test.cxx @@ -134,6 +134,17 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest, testTdf155321_CondFormatColor_XLSX) CPPUNIT_ASSERT_EQUAL(Color(99, 190, 123), aColor); } +CPPUNIT_TEST_FIXTURE(ScFiltersTest, testTdf156028_ColorScale_XLSX) +{ +createScDoc("xlsx/tdf156028.xlsx"); + +ScDocument* pDoc = getScDoc(); +ScConditionalFormat* pCondFormat = pDoc->GetCondFormat(0, 0, 0); +ScRefCellValue aCellA1(*pDoc, ScAddress(0, 0, 0)); +Color aColor = pCondFormat->GetData(aCellA1, ScAddress(0, 0, 0)).mxColorScale.value(); +CPPUNIT_ASSERT_EQUAL(Color(99, 190, 123), aColor); +} + CPPUNIT_TEST_FIXTURE(ScFiltersTest, testTdf138601_CondFormatXLSX) { createScDoc("xlsx/tdf138601.xlsx"); diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index 4e61dbdbc228..20ea2b5186f6 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -647,7 +647,7 @@ std::optional ScColorScaleFormat::GetColor( const ScAddress& rAddr ) cons calcMinMax(nMin, nMax); // this check is for safety -if(nMin >= nMax) +if(nMin > nMax) return std::optional(); ScColorScaleEntries::const_iterator itr = begin();
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/tdf155402.xlsx |binary sc/qa/unit/subsequent_filters_test4.cxx | 13 sc/source/core/tool/interpr1.cxx| 50 +++- 3 files changed, 56 insertions(+), 7 deletions(-) New commits: commit 5c7196acbdd949005c1b52aeab34b5448e09011e Author: Balazs Varga AuthorDate: Wed Jun 14 23:01:26 2023 +0200 Commit: Balazs Varga CommitDate: Sat Jun 17 15:59:02 2023 +0200 tdf#155402 - sc improving CELL() function return value in case of OOXML In case of Excel/OOXML formula syntax: Before the patch =CELL("FILENAME";D2) returns 'file:///X:/dr/own.ods'#$Sheet1 After the patch =CELL("FILENAME";D2) returns file:///X:/dr/[own.ods]Sheet1 Change-Id: I34c805aef813632c45ac3fe930d690ae3c1d5d96 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153098 Tested-by: Jenkins Reviewed-by: Balazs Varga diff --git a/sc/qa/unit/data/xlsx/tdf155402.xlsx b/sc/qa/unit/data/xlsx/tdf155402.xlsx new file mode 100644 index ..c1f73562547f Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf155402.xlsx differ diff --git a/sc/qa/unit/subsequent_filters_test4.cxx b/sc/qa/unit/subsequent_filters_test4.cxx index d6b853607e51..646b1e66f5b7 100644 --- a/sc/qa/unit/subsequent_filters_test4.cxx +++ b/sc/qa/unit/subsequent_filters_test4.cxx @@ -1905,6 +1905,19 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testForcepoint107) pDocSh->DoHardRecalc(); } +CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf155402) +{ +createScDoc("xlsx/tdf155402.xlsx"); +ScDocument* pDoc = getScDoc(); + +// Before the fix =CELL("FILENAME"; D2) returns 'file:///X:/dr/own.ods'#$Sheet1 +// After the fix =CELL("FILENAME"; D2) returns file :///X:/dr/[own.ods]Sheet1 +OUString aFilename = pDoc->GetString(1, 0, 0); +sal_Int32 nPos = aFilename.lastIndexOf('/'); +aFilename = OUString::Concat(aFilename.subView(nPos)); +CPPUNIT_ASSERT_EQUAL(OUString("/[tdf155402.xlsx]Sheet1"), aFilename); +} + ScFiltersTest4::ScFiltersTest4() : ScModelTestBase("sc/qa/unit/data") { diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 2f48398827ed..bf8c89d0d125 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -2331,7 +2331,7 @@ void ScInterpreter::ScCell() PushString(aStr); } else if( aInfoType == "FILENAME" ) -{ // file name and table name: 'FILENAME'#$TABLE +{ SCTAB nTab = aCellPos.Tab(); OUString aFuncResult; if( nTab < mrDoc.GetTableCount() ) @@ -2346,9 +2346,27 @@ void ScInterpreter::ScCell() const INetURLObject& rURLObj = pShell->GetMedium()->GetURLObject(); OUString aTabName; mrDoc.GetName( nTab, aTabName ); -aFuncResult = "'" -+ rURLObj.GetMainURL(INetURLObject::DecodeMechanism::Unambiguous) -+ "'#$" + aTabName; + +FormulaGrammar::AddressConvention eConv = maCalcConfig.meStringRefAddressSyntax; +if (eConv == FormulaGrammar::CONV_UNSPECIFIED) +eConv = mrDoc.GetAddressConvention(); + +if (eConv == FormulaGrammar::CONV_XL_A1 || +eConv == FormulaGrammar::CONV_XL_R1C1 || +eConv == FormulaGrammar::CONV_XL_OOX) +{ +// file name and table name: FILEPATH/[FILENAME]TABLE +aFuncResult = rURLObj.GetPartBeforeLastName() ++ "[" + rURLObj.GetLastName(INetURLObject::DecodeMechanism::Unambiguous) ++ "]" + aTabName; +} +else +{ +// file name and table name: 'FILEPATH/FILENAME'#$TABLE +aFuncResult = "'" ++ rURLObj.GetMainURL(INetURLObject::DecodeMechanism::Unambiguous) ++ "'#$" + aTabName; +} } } } @@ -2515,8 +2533,6 @@ void ScInterpreter::ScCellExternal() } else if ( aInfoType == "FILENAME" ) { -// 'file URI'#$SheetName - const OUString* p = pRefMgr->getExternalFileName(nFileId); if (!p) { @@ -2525,7 +2541,27 @@ void ScInterpreter::ScCellExternal() return; } -OUString aBuf = "'" + *p + "'#$" + aTabName; +OUString aBuf; +FormulaGrammar::AddressConvention eConv = maCalcConfig.meStringRefAddressSyntax; +if (eConv == FormulaGrammar::CONV_UNSPECIFIED) +eConv = mrDoc.GetAddressConvention(); + +if (eConv == FormulaGrammar::CONV_XL_A1 || +eConv ==
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/calc_tests8/tdf132026.py | 44 ++ sc/qa/uitest/data/tdf132026.ods |binary sc/source/ui/view/tabvwsha.cxx| 12 ++--- 3 files changed, 53 insertions(+), 3 deletions(-) New commits: commit 0450c7177f61ba5be15f7b4175b9fb5e89f850ae Author: Baole Fang AuthorDate: Sun May 28 10:28:24 2023 -0400 Commit: Mike Kaganski CommitDate: Fri Jun 2 20:02:39 2023 +0200 tdf#132026: Fix selection in text cell Change-Id: Ic2bf869efa198cba83d1b781b419c3a9e0e606f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152356 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/qa/uitest/calc_tests8/tdf132026.py b/sc/qa/uitest/calc_tests8/tdf132026.py new file mode 100644 index ..abd3a86e720b --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf132026.py @@ -0,0 +1,44 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf132026(UITestCase): + +def test_tdf132026(self): +with self.ui_test.load_file(get_url_for_data_file("tdf132026.ods")) as calc_doc: +MainWindow = self.xUITest.getTopFocusWindow() +grid_window = MainWindow.getChild("grid_window") + +chars=["=","+","-"] +directions=["UP","DOWN","LEFT","RIGHT"] + +# format general, should select cell +for c in chars: +sign=-1 if c=="-" else 1 +for i,direction in enumerate(directions): +grid_window.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) +grid_window.executeAction("TYPE", mkPropertyValues({"TEXT": c})) +grid_window.executeAction("TYPE", mkPropertyValues({"KEYCODE": direction})) +grid_window.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) +self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getString(), str(sign*(i+1))) + +# format text, shouldn't select cell +for c in chars: +for direction in directions: +grid_window.executeAction("SELECT", mkPropertyValues({"CELL": "E2"})) +grid_window.executeAction("TYPE", mkPropertyValues({"TEXT": c})) +grid_window.executeAction("TYPE", mkPropertyValues({"KEYCODE": direction})) +grid_window.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) +self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 1).getString(), c) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/tdf132026.ods b/sc/qa/uitest/data/tdf132026.ods new file mode 100644 index ..03c6c654fdc5 Binary files /dev/null and b/sc/qa/uitest/data/tdf132026.ods differ diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 4021f1937f91..f1305672a096 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -640,13 +640,19 @@ bool ScTabViewShell::IsRefInputMode() const ScInputHandler* pHdl = pScMod->GetInputHdl(); if ( pHdl ) { +const ScViewData& rViewData = GetViewData(); +ScDocument& rDoc = rViewData.GetDocument(); +const ScAddress aPos( rViewData.GetCurPos() ); +const sal_uInt32 nIndex = rDoc.GetAttr(aPos, ATTR_VALUE_FORMAT )->GetValue(); +const SvNumFormatType nType = rDoc.GetFormatTable()->GetType(nIndex); +if (nType == SvNumFormatType::TEXT) +{ +return false; +} OUString aString = pHdl->GetEditString(); if ( !pHdl->GetSelIsRef() && aString.getLength() > 1 && ( aString[0] == '+' || aString[0] == '-' ) ) { -const ScViewData& rViewData = GetViewData(); -ScDocument& rDoc = rViewData.GetDocument(); -const ScAddress aPos( rViewData.GetCurPos() ); ScCompiler aComp( rDoc, aPos, rDoc.GetGrammar() ); aComp.SetCloseBrackets( false ); std::unique_ptr pArr(aComp.CompileString(aString));
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/calc_tests8/tdf131638.py | 26 ++ sc/qa/uitest/data/tdf131638.ods |binary sc/source/ui/view/viewfunc.cxx| 10 +- 3 files changed, 31 insertions(+), 5 deletions(-) New commits: commit 730e6fa063fccbd12913362dd5d3c74ea14957be Author: Baole Fang AuthorDate: Sat May 27 21:05:01 2023 -0400 Commit: Mike Kaganski CommitDate: Fri Jun 2 10:22:10 2023 +0200 tdf#131638: Fix text cell incorrect formula Change-Id: I086f077540f52c6ed5fb4df9f0ea64aa95aea152 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152348 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/sc/qa/uitest/calc_tests8/tdf131638.py b/sc/qa/uitest/calc_tests8/tdf131638.py new file mode 100644 index ..bafbfc5d8567 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf131638.py @@ -0,0 +1,26 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf137726(UITestCase): + +def test_tdf137726(self): +with self.ui_test.load_file(get_url_for_data_file("tdf131638.ods")) as calc_doc: +MainWindow = self.xUITest.getTopFocusWindow() +grid_window = MainWindow.getChild("grid_window") +grid_window.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) +grid_window.executeAction("TYPE", mkPropertyValues({"TEXT": "-/2"})) +grid_window.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) +self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getString(), "-/2") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/tdf131638.ods b/sc/qa/uitest/data/tdf131638.ods new file mode 100644 index ..a66a7e9c9de9 Binary files /dev/null and b/sc/qa/uitest/data/tdf131638.ods differ diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 78080364e928..bc149f62b40e 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -408,8 +408,11 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, bool bFormula = false; +// do not check formula if it is a text cell +sal_uInt32 format = rDoc.GetNumberFormat( nCol, nRow, nTab ); +SvNumberFormatter* pFormatter = rDoc.GetFormatTable(); // a single '=' character is handled as string (needed for special filters) -if ( rString.getLength() > 1 ) +if ( pFormatter->GetType(format) != SvNumFormatType::TEXT && rString.getLength() > 1 ) { if ( rString[0] == '=' ) { @@ -431,10 +434,8 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, // is non-empty and not a number, handle as formula if ( aString.getLength() > 1 ) { -sal_uInt32 nFormat = rDoc.GetNumberFormat( nCol, nRow, nTab ); -SvNumberFormatter* pFormatter = rDoc.GetFormatTable(); double fNumber = 0; -if ( !pFormatter->IsNumberFormat( aString, nFormat, fNumber ) ) +if ( !pFormatter->IsNumberFormat( aString, format, fNumber ) ) { bFormula = true; } @@ -568,7 +569,6 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, ScFormulaCell aCell(rDoc, aPos, std::move( pArr ), formula::FormulaGrammar::GRAM_DEFAULT, ScMatrixMode::NONE); -SvNumberFormatter* pFormatter = rDoc.GetFormatTable(); for (const auto& rTab : rMark) { i = rTab;
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc.cxx |4 sc/source/core/data/table1.cxx |6 ++ 2 files changed, 6 insertions(+), 4 deletions(-) New commits: commit 8731701481de649a65d59e018d0ba0c381f670c3 Author: Xisco Fauli AuthorDate: Tue May 30 11:34:21 2023 +0200 Commit: Noel Grandin CommitDate: Fri Jun 2 08:04:19 2023 +0200 sc: fix bug in GetPrintAreaVer it should return false when checking a non-exising column. Since ad2bc869bfe2d34bde7d42e10593db1c5ffccc2a "tdf#50916 : Refactor table1.cxx wherever there is column access" Change-Id: I01a53f5fec7e2029badc5c23c1e26fc0723ba0ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152386 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index a1951cdc5b95..f966fdecea18 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -5269,6 +5269,10 @@ CPPUNIT_TEST_FIXTURE(Test, testAreasWithNotes) CPPUNIT_ASSERT_MESSAGE("No PrintAreaVer found", dataFound); CPPUNIT_ASSERT_EQUAL_MESSAGE("PrintAreaVer wrong row for notes", static_cast(2), row); +dataFound = m_pDoc->GetPrintAreaVer(0,20,21,row, bNotes); // cols 20 & 21 +CPPUNIT_ASSERT_MESSAGE("PrintAreaVer found", !dataFound); +CPPUNIT_ASSERT_EQUAL_MESSAGE("PrintAreaVer wrong row for notes", static_cast(0), row); + bNotes = false; dataFound = m_pDoc->GetPrintAreaVer(0,0,1,row, bNotes); // col 0 & 1 CPPUNIT_ASSERT_MESSAGE("No PrintAreaVer should be found", !dataFound); diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 6cb5384c05f9..99e0c5f39b0d 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -756,13 +756,11 @@ bool ScTable::GetPrintAreaHor( SCROW nStartRow, SCROW nEndRow, bool ScTable::GetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol, SCROW& rEndRow, bool bNotes ) const { -nStartCol = std::min( nStartCol, aCol.size()-1 ); -nEndCol = std::min( nEndCol, aCol.size()-1 ); bool bFound = false; SCROW nMaxY = 0; SCCOL i; -for (i=nStartCol; i<=nEndCol; i++) // Test attribute +for (i=nStartCol; i<=nEndCol && i < aCol.size(); i++) // Test attribute { SCROW nLastRow; if (aCol[i].GetLastVisibleAttr( nLastRow )) @@ -773,7 +771,7 @@ bool ScTable::GetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol, } } -for (i=nStartCol; i<=nEndCol; i++) // Test data +for (i=nStartCol; i<=nEndCol && i < aCol.size(); i++) // Test data { if (!aCol[i].IsEmptyData()) {
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/calc_tests9/tdf154174.py | 35 ++ sc/source/ui/view/viewfunc.cxx|2 + 2 files changed, 37 insertions(+) New commits: commit a5c1b749a89b662f9a136d774b3dfd5fbd639c50 Author: Czeber László Ádám AuthorDate: Wed May 31 13:06:50 2023 +0200 Commit: László Németh CommitDate: Thu Jun 1 09:55:40 2023 +0200 tdf#154174 sc: fix input line to update to the repeated content Repeating the last text edit by Repeat, e.g. by pressing Ctrl-Shift-Y, the input line still contained the old content of the cell, and only updated to the new content after moving the cursor to another cell and back. Now the input line is updated automatically, and the actual content of the cell can be modified immediately by pressing F2 or clicking in the input line. Change-Id: Ia38b833ff77c75d37700715638aa71c7f1863e91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152423 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/uitest/calc_tests9/tdf154174.py b/sc/qa/uitest/calc_tests9/tdf154174.py new file mode 100644 index ..3cb0da9ea2a3 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf154174.py @@ -0,0 +1,35 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.calc import enter_text_to_cell + +#Bug 154174 - empty edit cell after fill (Ctrl+Shft+Y) + +class tdf154174(UITestCase): +def test_tdf154174_repeat_empty(self): +with self.ui_test.create_doc_in_start_center("calc") as document: +xCalcDoc = self.xUITest.getTopFocusWindow() +gridwin = xCalcDoc.getChild("grid_window") +# enter data +enter_text_to_cell(gridwin, "A1", "") +# focus on A2 +gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) +# repeat (Ctrl+Shft+Y) +gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+CTRL+Y"})) +# edit A2 data +gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F2"})) +# if is empty, then erased, else unchanged +gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"})) +gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) +# test A2 +self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 204d5d31bae7..78080364e928 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -832,6 +832,8 @@ void ScViewFunc::EnterDataAtCursor( const OUString& rString ) SCTAB nTab = GetViewData().GetTabNo(); EnterData( nPosX, nPosY, nTab, rString ); +// tdf#154174: update repeated data in the cell +GetViewData().GetViewShell()->UpdateInputHandler(); } void ScViewFunc::EnterMatrix( const OUString& rString, ::formula::FormulaGrammar::Grammar eGram )
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc_copypaste.cxx | 43 + sc/source/core/data/table1.cxx |9 ++-- 2 files changed, 50 insertions(+), 2 deletions(-) New commits: commit 7be7e1ff95af485a9cb00748800d3d084f96387c Author: Czeber László Ádám AuthorDate: Wed May 24 09:05:16 2023 +0200 Commit: László Németh CommitDate: Wed May 31 11:49:58 2023 +0200 tdf#153437 sc: fix broken formatting at Undo of row/column insertion Performance fix for the 16k rows resulted broken formatting during Undo of row insertion, e.g. rows with background color fell apart, highlighting partially also the row under the deleted row removed by Undo, or Undo of inserted/copied columns removed the background coloring at the place of the removed columns. Formatting was always deleted after the last column containing data, because the row was only allocated until then. When deleting row(s) or column(s), allocate the last column before updating the references. Regression from commit 2e86718626a07e1656661df3ad69a64848bf4614 "don't allocate unnecessary columns when inserting a row". Change-Id: I8d74d59ff0051fdfe183e14a16d987edc71d55e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152185 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx index 695b5b8f6214..bad57d8646a7 100644 --- a/sc/qa/unit/ucalc_copypaste.cxx +++ b/sc/qa/unit/ucalc_copypaste.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include @@ -10709,6 +10710,48 @@ CPPUNIT_TEST_FIXTURE(TestCopyPaste, testCopyPasteMatrixFormula) m_pDoc->DeleteTab(0); } +CPPUNIT_TEST_FIXTURE(TestCopyPaste, testUndoBackgroundColor) +{ +m_pDoc->InsertTab(0, "Table1"); + +ScDocument aClipDoc(SCDOCMODE_CLIP); +ScMarkData aMark(m_pDoc->GetSheetLimits()); + +// Set Values to B1, C2, D5 +m_pDoc->SetValue(ScAddress(1, 0, 0), 1.0); // B1 +m_pDoc->SetValue(ScAddress(2, 1, 0), 2.0); // C2 +m_pDoc->SetValue(ScAddress(3, 4, 0), 3.0); // D5 + +// Add patterns +ScPatternAttr aCellBlueColor(m_pDoc->GetPool()); +aCellBlueColor.GetItemSet().Put(SvxBrushItem(COL_BLUE, ATTR_BACKGROUND)); +m_pDoc->ApplyPatternAreaTab(0, 3, m_pDoc->MaxCol(), 3, 0, aCellBlueColor); + +// Insert a new row at row 3 +ScRange aRowOne(0, 2, 0, m_pDoc->MaxCol(), 2, 0); +aMark.SetMarkArea(aRowOne); +ScDocFunc& rFunc = m_xDocShell->GetDocFunc(); +rFunc.InsertCells(aRowOne, &aMark, INS_INSROWS_BEFORE, true, true); + +// Check patterns +const SfxPoolItem* pItem = nullptr; +m_pDoc->GetPattern(ScAddress(1000, 4, 0))->GetItemSet().HasItem(ATTR_BACKGROUND, &pItem); +CPPUNIT_ASSERT(pItem); +CPPUNIT_ASSERT_EQUAL(COL_BLUE, static_cast(pItem)->GetColor()); + +// Undo the new row +m_pDoc->GetUndoManager()->Undo(); + +// Check patterns +// Failed if row 3 is not blue all the way through +pItem = nullptr; +m_pDoc->GetPattern(ScAddress(1000, 3, 0))->GetItemSet().HasItem(ATTR_BACKGROUND, &pItem); +CPPUNIT_ASSERT(pItem); +CPPUNIT_ASSERT_EQUAL(COL_BLUE, static_cast(pItem)->GetColor()); + +m_pDoc->DeleteTab(0); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 78c49912bcc9..6cb5384c05f9 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -1851,8 +1851,13 @@ void ScTable::UpdateReference( } else { -for( SCCOL col : GetAllocatedColumnsRange( 0, rDocument.MaxCol())) -bUpdated |= aCol[col].UpdateReference(rCxt, pUndoDoc); +// When deleting row(s) or column(s), allocate the last column +// before updating the references +if (nDx < 0 || nDy < 0) +CreateColumnIfNotExists(rDocument.MaxCol()); + +for (SCCOL col : GetColumnsRange(0, rDocument.MaxCol())) +bUpdated |= CreateColumnIfNotExists(col).UpdateReference(rCxt, pUndoDoc); } if ( bIncludeDraw )
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/tdf100034.xlsx|binary sc/qa/unit/subsequent_export_test4.cxx | 16 sc/source/filter/excel/xename.cxx |5 + 3 files changed, 21 insertions(+) New commits: commit 639519dc2bad058197b6ff73c9e3df622f979f97 Author: Czeber László Ádám AuthorDate: Mon May 22 09:58:29 2023 +0200 Commit: László Németh CommitDate: Tue May 23 12:15:56 2023 +0200 tdf#100034: Fix to persistently remove print-range Don't save print range if the builtin index is unknow and sheet index is vaild (this is a deleted range). Change-Id: I10dfa98ad4f24d0f5958053974bd75cb19c85147 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152081 Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/data/xlsx/tdf100034.xlsx b/sc/qa/unit/data/xlsx/tdf100034.xlsx new file mode 100644 index ..b053a34bca43 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf100034.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index 46ea2547eadc..9d7dddc99c78 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -1697,6 +1697,22 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf152980) CPPUNIT_ASSERT_EQUAL(OUString("a\n\nb"), pDoc->GetString(0, 7, 0)); } +CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf100034) +{ +createScDoc("xlsx/tdf100034.xlsx"); +ScDocument* pDoc = getScDoc(); + +// Clear print ranges +pDoc->ClearPrintRanges(0); + +// Save and load back +saveAndReload("Calc Office Open XML"); + +// Check if the same print ranges are present +pDoc = getScDoc(); +CPPUNIT_ASSERT_EQUAL(static_cast(0), pDoc->GetPrintRangeCount(0)); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx index 4e837a97fadf..5ce4a2ff18c4 100644 --- a/sc/source/filter/excel/xename.cxx +++ b/sc/source/filter/excel/xename.cxx @@ -324,6 +324,11 @@ OUString XclExpName::GetWithDefaultRangeSeparator( const OUString& rSymbol ) con void XclExpName::SaveXml( XclExpXmlStream& rStrm ) { +// tdf#100034: Don't save print range if the built-in index is unknown +// and sheet index is valid (this is a deleted range) +if (mcBuiltIn == EXC_BUILTIN_UNKNOWN && mnScTab != SCTAB_GLOBAL) +return; + sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream(); rWorkbook->startElement( XML_definedName, // OOXTODO: XML_comment, "",
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xlsx/tablerefsnamed.xlsx |binary sc/qa/unit/subsequent_filters_test2.cxx | 15 ++ sc/source/core/tool/interpr1.cxx | 43 +++ 3 files changed, 48 insertions(+), 10 deletions(-) New commits: commit 4536694edb7e564ea1f4ae871e9107f52ed0972f Author: Dennis Francis AuthorDate: Sat May 13 13:37:39 2023 +0530 Commit: Dennis Francis CommitDate: Sat May 20 17:07:21 2023 +0200 tdf#155369 ScIndirect: handle names that resolve to... table structured references. Conflicts: sc/qa/unit/subsequent_filters_test2.cxx Change-Id: I897feeeb49e63c1758cf64450799acb192e2d593 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151888 Tested-by: Jenkins Reviewed-by: Dennis Francis diff --git a/sc/qa/unit/data/xlsx/tablerefsnamed.xlsx b/sc/qa/unit/data/xlsx/tablerefsnamed.xlsx new file mode 100644 index ..825103d54993 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tablerefsnamed.xlsx differ diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx index cd5f073f46c4..a00558730d0b 100644 --- a/sc/qa/unit/subsequent_filters_test2.cxx +++ b/sc/qa/unit/subsequent_filters_test2.cxx @@ -1565,6 +1565,21 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testBorderDirectionsXLSXML) } } +CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testNamedTableRef) +{ +createScDoc("xlsx/tablerefsnamed.xlsx"); +ScDocument* pDoc = getScDoc(); +for (sal_Int32 nRow = 1; nRow < 7; ++nRow) +{ +ScFormulaCell* pFC = pDoc->GetFormulaCell(ScAddress(5, nRow, 0)); +CPPUNIT_ASSERT(pFC); +// Without the fix there will be #REF in F2:F7. +CPPUNIT_ASSERT_EQUAL(FormulaError::NONE, pFC->GetErrCode()); +// Without the fix value will be 0 (FALSE). +CPPUNIT_ASSERT_EQUAL(1.0, pDoc->GetValue(ScAddress(6, nRow, 0))); +} +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 9e2277f60392..2f48398827ed 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -8187,6 +8187,12 @@ void ScInterpreter::ScDBVarP() PushDouble(fVal/fCount); } +static bool lcl_IsTableStructuredRef(const OUString& sRefStr, sal_Int32& nIndex) +{ +nIndex = ScGlobal::FindUnquoted(sRefStr, '['); +return (nIndex > 0 && ScGlobal::FindUnquoted(sRefStr, ']', nIndex + 1) > nIndex); +} + void ScInterpreter::ScIndirect() { sal_uInt8 nParamCount = GetByte(); @@ -8223,6 +8229,10 @@ void ScInterpreter::ScIndirect() const ScAddress::Details aDetailsXlA1( FormulaGrammar::CONV_XL_A1, aPos ); SCTAB nTab = aPos.Tab(); +bool bTableRefNamed = false; +sal_Int32 nTableRefNamedIndex = -1; +OUString sTabRefStr; + // Named expressions and DB range names need to be tried first, as older 1K // columns allowed names that would now match a 16k columns cell address. do @@ -8238,8 +8248,14 @@ void ScInterpreter::ScIndirect() // This is the usual way to treat named ranges containing // relative references. -if (!pData->IsReference( aRange, aPos)) +if (!pData->IsReference(aRange, aPos)) +{ +sTabRefStr = pData->GetSymbol(); +bTableRefNamed = lcl_IsTableStructuredRef(sTabRefStr, nTableRefNamedIndex); +// if bTableRefNamed is true, we have a name that maps to a table structured reference. +// Such a case is handled below. break; +} if (aRange.aStart == aRange.aEnd) PushSingleRef( aRange.aStart.Col(), aRange.aStart.Row(), @@ -8256,6 +8272,9 @@ void ScInterpreter::ScIndirect() do { +if (bTableRefNamed) +break; + const OUString & aName( sSharedRefStr.getIgnoreCaseString() ); ScDBCollection::NamedDBs& rDBs = mrDoc.GetDBCollection()->getNamedDBs(); const ScDBData* pData = rDBs.findByUpperName( aName); @@ -8291,9 +8310,10 @@ void ScInterpreter::ScIndirect() ScRefAddress aRefAd, aRefAd2; ScAddress::ExternalInfo aExtInfo; -if ( ConvertDoubleRef(mrDoc, sRefStr, nTab, aRefAd, aRefAd2, aDetails, &aExtInfo) || - ( bTryXlA1 && ConvertDoubleRef(mrDoc, sRefStr, nTab, aRefAd, -aRefAd2, aDetailsXlA1, &aExtInfo) ) ) +if ( !bTableRefNamed && + (ConvertDoubleRef(mrDoc, sRefStr, nTab, aRefAd, aRefAd2, aDetails, &aExtInfo) || +( bTryXlA1 && ConvertDoubleRef(mrDoc, sRefStr, nTab, aRefAd, + aRefAd2, aDetailsXlA1, &aExtInfo) ) ) ) { if (aExtInfo.mbExternal) { @@ -8305,9 +8325,10 @@ void ScInterpreter::ScIndirect() else PushDoubleRef( aRefAd, aRefAd2); } -else if ( ConvertSingleRef(mrDoc, sRefStr, nTab, aRefAd, aDetails, &aExtInfo) || -
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/ods/tdf154821_shape_in_group.ods |binary sc/qa/unit/scshapetest.cxx | 46 sc/source/core/data/drwlayer.cxx | 24 +- sc/source/filter/xml/xmlexprt.cxx| 230 +++ 4 files changed, 173 insertions(+), 127 deletions(-) New commits: commit 800f9233513a45aa8f8950cf929fd44cb9381d72 Author: Regina Henschel AuthorDate: Sat May 13 01:36:44 2023 +0200 Commit: Regina Henschel CommitDate: Thu May 18 14:45:48 2023 +0200 tdf#154821 improve shape export with hidden row/col XML needs shape geometry so as if no rows/cols are hidden. This had been calculated by using the shape start and end cell. But that did not work in some cases. Now the snap rectangle of the shape is used. During testing I noticed, that the fix in tdf#154005 does not work correctly. The fix had provided only a workaround for controls. It did not address the root cause that a shape was size protected but has an anchor 'To Cell (resize with cell)' at the same time. Such combination is no longer needed as we have 'To Cell' anchor now, but shapes using it still exist. The current solution catches such cases now in general. As large parts of the method are changed anyway, I have put existance tests at the beginning. That allows shorter conditions and flattens if-constructions. Change-Id: I6bd1e15dbdafc43e309a6e12c1c5e3218bb12675 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151717 Tested-by: Jenkins Reviewed-by: Regina Henschel diff --git a/sc/qa/unit/data/ods/tdf154821_shape_in_group.ods b/sc/qa/unit/data/ods/tdf154821_shape_in_group.ods new file mode 100644 index ..905a64418cf6 Binary files /dev/null and b/sc/qa/unit/data/ods/tdf154821_shape_in_group.ods differ diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx index 0e4f1b555f99..21406c52cc7d 100644 --- a/sc/qa/unit/scshapetest.cxx +++ b/sc/qa/unit/scshapetest.cxx @@ -1169,6 +1169,52 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf125938_anchor_after_copy_paste) CPPUNIT_ASSERT_EQUAL(aExpectedAddress, (*pObjData).maStart); } +CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf154821_shape_in_group) +{ +// The document contains a shape in A7, a group spanning rows 2 to 4 and a second group spanning +// rows 6 to 10. Error was, that when the document was saved with collapsed groups, the shape +// lost its position. +createScDoc("ods/tdf154821_shape_in_group.ods"); + +// Get snap rectangle before collapse and save +ScDocument* pDoc = getScDoc(); +SdrObject* pObj = lcl_getSdrObjectWithAssert(*pDoc, 0); +tools::Rectangle aRectOrig = pObj->GetSnapRect(); + +// Collapse the lower group +ScTabViewShell* pViewShell = getViewShell(); +pViewShell->GetViewData().SetCurX(0); +pViewShell->GetViewData().SetCurY(5); +pViewShell->GetViewData().GetDispatcher().Execute(SID_OUTLINE_HIDE); +// Collapse the upper group +pViewShell->GetViewData().SetCurX(0); +pViewShell->GetViewData().SetCurY(1); +pViewShell->GetViewData().GetDispatcher().Execute(SID_OUTLINE_HIDE); + +// Save and reload +// FIXME: validation fails with +// Error: unexpected attribute "drawooo:display" +skipValidation(); +saveAndReload("calc8"); + +// Expand the lower group +pViewShell = getViewShell(); +pViewShell->GetViewData().SetCurX(0); +pViewShell->GetViewData().SetCurY(5); +pViewShell->GetViewData().GetDispatcher().Execute(SID_OUTLINE_SHOW); +// Expande the upper group +pViewShell = getViewShell(); +pViewShell->GetViewData().SetCurX(0); +pViewShell->GetViewData().SetCurY(1); +pViewShell->GetViewData().GetDispatcher().Execute(SID_OUTLINE_SHOW); + +// Verify shape position is not changed besides rounding errors from twips<->mm +pDoc = getScDoc(); +pObj = lcl_getSdrObjectWithAssert(*pDoc, 0); +tools::Rectangle aRectReload = pObj->GetSnapRect(); +CPPUNIT_ASSERT_RECTANGLE_EQUAL_WITH_TOLERANCE(aRectOrig, aRectReload, 1); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 134c7258ed4a..8e989012b4e8 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -776,15 +776,6 @@ void lcl_SetLogicRectFromAnchor(SdrObject* pObj, const ScDrawObjData& rAnchor, c if (!pObj || !pDoc || !rAnchor.maEnd.IsValid() || !rAnchor.maStart.IsValid()) return; -SCROW nHiddenRows = 0; -SCCOL nHiddenCols = 0; -// tdf#154005: Handle hidden row/col: remove hidden row/cols size from the ScDrawObjData shape size in case of forms -if (pObj->GetObjIdentifier() == SdrObjKind::UNO && pObj->GetObjInventor() == SdrInventor::FmForm) -{ -nHiddenRows = pDoc->CountHiddenRows(rAnchor.maStart.Row(), rAnchor.maEnd.Row(), rAnch
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc_copypaste.cxx | 14 -- sc/qa/unit/uicalc/uicalc.cxx | 35 +++ sc/source/core/data/document.cxx |5 +++-- 3 files changed, 46 insertions(+), 8 deletions(-) New commits: commit 535f8fde0c33c435e4a8e9f768003516ce933666 Author: Andreas Heinisch AuthorDate: Mon May 15 09:01:21 2023 +0200 Commit: Andreas Heinisch CommitDate: Tue May 16 11:05:04 2023 +0200 tdf#141440 - Do not delete notes when pasting contents Contents include cells with values, datetimes, strings, formulas, outlines, and sparklines. Change-Id: I9acf3a33c7723300d6b85f0abe468db28de6ebcb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151759 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx index 43f9272a13c0..695b5b8f6214 100644 --- a/sc/qa/unit/ucalc_copypaste.cxx +++ b/sc/qa/unit/ucalc_copypaste.cxx @@ -9407,10 +9407,11 @@ CPPUNIT_TEST_FIXTURE(TestCopyPaste, testCopyPasteSkipEmpty) // Check the content after the paste. { +// tdf#141440 - do not delete notes when pasting contents static const Check aChecks[] = { -{ "Clip1", COL_YELLOW, false }, { "B", COL_BLUE, true }, -{ "Clip2", COL_YELLOW, false }, { "D", COL_BLUE, true }, -{ "Clip3", COL_YELLOW, false }, +{ "Clip1", COL_YELLOW, true }, { "B", COL_BLUE, true }, +{ "Clip2", COL_YELLOW, true }, { "D", COL_BLUE, true }, +{ "Clip3", COL_YELLOW, true }, }; bool bRes @@ -9434,10 +9435,11 @@ CPPUNIT_TEST_FIXTURE(TestCopyPaste, testCopyPasteSkipEmpty) // Redo, and check the content again. aUndo.Redo(); { +// tdf#141440 - do not delete notes when pasting contents static const Check aChecks[] = { -{ "Clip1", COL_YELLOW, false }, { "B", COL_BLUE, true }, -{ "Clip2", COL_YELLOW, false }, { "D", COL_BLUE, true }, -{ "Clip3", COL_YELLOW, false }, +{ "Clip1", COL_YELLOW, true }, { "B", COL_BLUE, true }, +{ "Clip2", COL_YELLOW, true }, { "D", COL_BLUE, true }, +{ "Clip3", COL_YELLOW, true }, }; bool bRes diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index d3ae6e4d02fe..a6854ae76d56 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -1893,6 +1893,41 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf150219) CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 0, 1))); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf141440) +{ +createScDoc(); +ScDocument* pDoc = getScDoc(); + +// Insert a note to cell A1 +goToCell("A1"); +uno::Sequence aArgs += comphelper::InitPropertySequence({ { "Text", uno::Any(OUString("Note in A1")) } }); +dispatchCommand(mxComponent, ".uno:InsertAnnotation", aArgs); + +// Insert a formula to cell A2 +insertStringToCell("A2", u"=1+1"); +CPPUNIT_ASSERT_EQUAL(OUString("2"), pDoc->GetString(ScAddress(0, 1, 0))); + +// Copy content of A2 to A1 using paste special command as a formula (Flags F) +goToCell("A2"); +dispatchCommand(mxComponent, ".uno:Copy", {}); +goToCell("A1"); +aArgs = comphelper::InitPropertySequence( +{ { "Flags", uno::Any(OUString("F")) }, + { "FormulaCommand", uno::Any(sal_uInt16(ScPasteFunc::ADD)) }, + { "SkipEmptyCells", uno::Any(false) }, + { "Transpose", uno::Any(false) }, + { "AsLink", uno::Any(false) }, + { "MoveMode", uno::Any(sal_uInt16(InsCellCmd::INS_NONE)) } }); +dispatchCommand(mxComponent, ".uno:InsertContents", aArgs); + +// Check if string in cell A2 was copied to cell A1 +CPPUNIT_ASSERT_EQUAL(OUString("2"), pDoc->GetString(ScAddress(0, 0, 0))); +// Without the fix in place, there would be no note in cell A1 after using paste special +CPPUNIT_ASSERT_MESSAGE("There should be a note on A1", pDoc->HasNote(ScAddress(0, 0, 0))); +CPPUNIT_ASSERT_EQUAL(OUString("Note in A1"), pDoc->GetNote(ScAddress(0, 0, 0))->GetText()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 25d0363c35f4..cab1dc364b31 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2905,8 +2905,9 @@ void ScDocument::CopyFromClip( InsertDeleteFlags nDelFlag = InsertDeleteFlags::NONE; if ( (nInsFlag & (InsertDeleteFlags::CONTENTS | InsertDeleteFlags::ADDNOTES)) == (InsertDeleteFlags::NOTE | InsertDeleteFlags::ADDNOTES) ) nDelFlag |= InsertDeleteFlags::NOTE; -else if ( nInsFlag & InsertDeleteFlags::CONTENTS ) -nDelFlag |= InsertDeleteFlags::CONTENTS; +// tdf#141440 - do not delete notes when pasting contents (see InsertDeleteFlags::CONTENTS) +else if
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/xls/tdf79542_radioGroupBox.xls |binary sc/qa/unit/subsequent_filters_test4.cxx| 20 sc/source/filter/excel/xiescher.cxx| 60 + sc/source/filter/inc/xiescher.hxx |6 ++ 4 files changed, 86 insertions(+) New commits: commit 25fed4ae027b9680597ea498c25acc3f854db4bf Author: Justin Luth AuthorDate: Thu Aug 4 19:52:23 2022 -0400 Commit: Justin Luth CommitDate: Tue May 16 01:01:27 2023 +0200 tdf#79542 xls: applyGroupBox to radiobutton groups A group box control links radiobuttons together, and so does a sheet. No matching unit tests were found. make CppunitTest_sc_subsequent_filters_test4 \ CPPUNIT_TEST_NAME=testLegacyOptionButtonGroupBox Change-Id: Ib5b03c68b5218649268f283d11981cc03fe4850a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137838 Tested-by: Jenkins Reviewed-by: Justin Luth diff --git a/sc/qa/unit/data/xls/tdf79542_radioGroupBox.xls b/sc/qa/unit/data/xls/tdf79542_radioGroupBox.xls new file mode 100644 index ..1861913020d3 Binary files /dev/null and b/sc/qa/unit/data/xls/tdf79542_radioGroupBox.xls differ diff --git a/sc/qa/unit/subsequent_filters_test4.cxx b/sc/qa/unit/subsequent_filters_test4.cxx index fcbc02ebe0a3..d6b853607e51 100644 --- a/sc/qa/unit/subsequent_filters_test4.cxx +++ b/sc/qa/unit/subsequent_filters_test4.cxx @@ -116,6 +116,26 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testControlImport) UNO_QUERY_THROW); } +CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testLegacyOptionButtonGroupBox) +{ +createScDoc("xls/tdf79542_radioGroupBox.xls"); +uno::Reference xDoc(mxComponent, UNO_QUERY_THROW); +uno::Reference xIA(xDoc->getSheets(), UNO_QUERY_THROW); +uno::Reference xDrawPageSupplier(xIA->getByIndex(0), + UNO_QUERY_THROW); +uno::Reference xIA_DrawPage(xDrawPageSupplier->getDrawPage(), + UNO_QUERY_THROW); + +OUString sGroupName; +uno::Reference xControlShape(xIA_DrawPage->getByIndex(1), + UNO_QUERY_THROW); +uno::Reference xPropertySet(xControlShape->getControl(), + uno::UNO_QUERY_THROW); +// The radio buttons are grouped by GroupBoxes - so the name comes from the group shape name +xPropertySet->getPropertyValue("GroupName") >>= sGroupName; +CPPUNIT_ASSERT_EQUAL(OUString("Casella di gruppo 1"), sGroupName); +} + CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testActiveXOptionButtonGroup) { createScDoc("xlsx/tdf111980_radioButtons.xlsx"); diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index e9a47fada31c..1805b7a26312 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -378,6 +378,11 @@ void XclImpDrawObjBase::SetAnchor( const XclObjAnchor& rAnchor ) mbHasAnchor = true; } +const tools::Rectangle& XclImpDrawObjBase::GetDffRect() const +{ +return maDffRect; +} + void XclImpDrawObjBase::SetDffData( const DffObjData& rDffObjData, const OUString& rObjName, const OUString& rHyperlink, bool bVisible, bool bAutoMargin ) @@ -388,6 +393,7 @@ void XclImpDrawObjBase::SetDffData( maHyperlink = rHyperlink; mbVisible = bVisible; mbAutoMargin = bAutoMargin; +maDffRect = rDffObjData.aChildAnchor; } OUString XclImpDrawObjBase::GetObjName() const @@ -2086,6 +2092,16 @@ void XclImpTbxObjBase::SetDffProperties( const DffPropSet& rDffPropSet ) ::set_flag( maLineData.mnAuto, EXC_OBJ_FILL_AUTO, false ); } +void XclImpControlHelper::SetStringProperty(const OUString& sName, const OUString& sVal) +{ +Reference xCtrlModel = XclControlHelper::GetControlModel(mxShape); +if (!xCtrlModel.is()) +return; + +ScfPropertySet aProps(xCtrlModel); +aProps.SetStringProperty(sName, sVal); +} + bool XclImpTbxObjBase::FillMacroDescriptor( ScriptEventDescriptor& rDescriptor ) const { return XclControlHelper::FillMacroDescriptor( rDescriptor, DoGetEventType(), GetMacroName(), GetDocShell() ); @@ -2393,6 +2409,11 @@ XclTbxEventType XclImpOptionButtonObj::DoGetEventType() const return EXC_TBX_EVENT_ACTION; } +bool XclImpOptionButtonObj::IsInGroup() const +{ +return mnNextInGroup; +} + XclImpLabelObj::XclImpLabelObj( const XclImpRoot& rRoot ) : XclImpTbxObjBase( rRoot ) { @@ -4070,6 +4091,43 @@ const XclImpObjTextData* XclImpDrawing::FindTextData( const DffRecordHeader& rHe return nullptr; } +void XclImpDrawing::ApplyGroupBoxes() +{ +// sorted: smallest to largest - looking for smallest contained-in GroupBox +// multimap: allows duplicate key values - may have identical areas. +std::multimap aGroupBoxAreaMap; +for (auto&
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/pasteSpecial/tdf139858.py | 60 + sc/source/ui/miscdlgs/inscodlg.cxx |3 + 2 files changed, 62 insertions(+), 1 deletion(-) New commits: commit 28bcb35b12f19858eca3d08559d7914e36ad1d2b Author: Andreas Heinisch AuthorDate: Wed May 10 09:08:47 2023 +0200 Commit: Andreas Heinisch CommitDate: Fri May 12 09:01:56 2023 +0200 tdf#139858 - Do not delete existing cell contents when pasting notes Change-Id: I9befa9e28f70ba767bbd9c4694521964a40c4463 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151603 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/sc/qa/uitest/pasteSpecial/tdf139858.py b/sc/qa/uitest/pasteSpecial/tdf139858.py new file mode 100755 index ..ca81c7715cb6 --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf139858.py @@ -0,0 +1,60 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.paste_special import reset_default_values + +class tdf139858(UITestCase): +def test_tdf139858_paste_comment(self): +with self.ui_test.create_doc_in_start_center("calc") as document: +xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + +# Write text to cell A1 and B1 +enter_text_to_cell(xGridWin, "A1", "A1 sample text") +enter_text_to_cell(xGridWin, "B1", "B1 sample text") + +# Insert a comment in cell B1 +xArgs = mkPropertyValues({"Text": "Comment 1"}) +self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + +# Insert a comment in cell A2 +xGridWin.executeAction("SELECT", mkPropertyValues({"CELL":"A2"})) +xArgs = mkPropertyValues({"Text": "Comment 2"}) +self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + +# Copy cell A2 to clipboard +xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) +self.xUITest.executeCommand(".uno:Copy") + +# Set cursor to cells and paste data using special options (check only comments) +targetCells = ["A1", "B1"] +for index, targetCell in enumerate(targetCells): +xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": targetCell})) +with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xPasteSpecialDlg: +reset_default_values(self, xPasteSpecialDlg) +xDateTimeChkBox = xPasteSpecialDlg.getChild("datetime") +xDateTimeChkBox.executeAction("CLICK", tuple()) +xTextChkBox = xPasteSpecialDlg.getChild("text") +xTextChkBox.executeAction("CLICK", tuple()) +xNumbersChkBox = xPasteSpecialDlg.getChild("numbers") +xNumbersChkBox.executeAction("CLICK", tuple()) +xCommentsChkBox = xPasteSpecialDlg.getChild("comments") +xCommentsChkBox.executeAction("CLICK", tuple()) + +# Without the fix in place, this test would have failed with +# AssertionError: 'A1 sample text' != '' +# i.e., the cell content was overwritten +self.assertEqual(targetCell + " sample text", get_cell_by_position(document, 0, index, 0).getString()) +self.assertEqual("Comment 2", get_cell_by_position(document, 0, index, 0).Annotation.String) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/source/ui/miscdlgs/inscodlg.cxx b/sc/source/ui/miscdlgs/inscodlg.cxx index ca4fd1cfa8bd..84292dcd91c4 100644 --- a/sc/source/ui/miscdlgs/inscodlg.cxx +++ b/sc/source/ui/miscdlgs/inscodlg.cxx @@ -213,8 +213,9 @@ InsertDeleteFlags ScInsertContentsDlg::GetInsContentsCmdBits() const ScInsertContentsDlg::nPreviousChecks |= InsertDeleteFlags::DATETIME; if ( mxBtnInsFormulas->get_active()) ScInsertContentsDlg::nPreviousChecks |= InsertDeleteFlags::FORMULA; +// tdf#139858 - do not delete existing cell contents when pasting notes if ( mxBtnInsNotes->get_active() ) -ScInsertContentsDlg::nPreviousChecks |= InsertDeleteFlags::NOTE; +ScInsertContentsDlg::nPreviousChecks |= InsertDeleteFlags::ADDNOTES; if ( mxBtnInsAttrs->get_active() ) ScInsertContentsDlg::nPreviousChecks |= InsertDeleteFlags::ATTRIB; if ( mxBtnInsObjects->get_active() )
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/csv/tdf152980.csv |9 ++ sc/qa/unit/subsequent_export_test4.cxx | 27 +++ sc/source/filter/oox/richstring.cxx| 112 - 3 files changed, 37 insertions(+), 111 deletions(-) New commits: commit 96965871f4cd2e4afbdf3bcae9dc0c43d1543e1d Author: Czeber László Ádám AuthorDate: Mon May 8 09:33:07 2023 +0200 Commit: Eike Rathke CommitDate: Tue May 9 00:05:57 2023 +0200 tdf#152980 CSV import: Fix control character length in XLSX save Converting from CSV to XLSX corrupts text that looks like a control character. Only 4 numeric length escape character allowed, in _x000D_ format, not _x0D_ for exampled. Change lcl_unEscapeUnicodeChars function to decodeXString. Delete not used functions and add multiple occurence for unit test. Change-Id: Id1d4bfcf7d27cf5005e7bea8e289303c5d9aca73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151494 Reviewed-by: Eike Rathke Tested-by: Eike Rathke diff --git a/sc/qa/unit/data/csv/tdf152980.csv b/sc/qa/unit/data/csv/tdf152980.csv new file mode 100644 index ..c5050b86d968 --- /dev/null +++ b/sc/qa/unit/data/csv/tdf152980.csv @@ -0,0 +1,9 @@ +"a_x1_b" +"a_x01_b" +"a_x001_b" +"a_x0001_b" +"a_xfoo b" +"a b" +"a +b" +"a b" diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index 79b5441c8f17..233195b2ebde 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -1638,6 +1638,33 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf119565) xShapeProps->getPropertyValue("LineJoint").get()); } +CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf152980) +{ +createScDoc("csv/tdf152980.csv"); +ScDocShell* pDocSh = getScDocShell(); +pDocSh->DoHardRecalc(); +saveAndReload("Calc Office Open XML"); +pDocSh = getScDocShell(); +pDocSh->DoHardRecalc(); + +ScDocument* pDoc = getScDoc(); + +// - Expected: The part between a and b does not change +// - Actual : Only the characters a and b remain +CPPUNIT_ASSERT_EQUAL(OUString("a_x1_b"), pDoc->GetString(0, 0, 0)); +CPPUNIT_ASSERT_EQUAL(OUString("a_x01_b"), pDoc->GetString(0, 1, 0)); +CPPUNIT_ASSERT_EQUAL(OUString("a_x001_b"), pDoc->GetString(0, 2, 0)); + +// The character code does not change in both cases +CPPUNIT_ASSERT_EQUAL(OUString("a_x0001_b"), pDoc->GetString(0, 3, 0)); + +// The escape characters are handled correctly in both cases +CPPUNIT_ASSERT_EQUAL(OUString("a_xfoo\nb"), pDoc->GetString(0, 4, 0)); +CPPUNIT_ASSERT_EQUAL(OUString("a\tb"), pDoc->GetString(0, 5, 0)); +CPPUNIT_ASSERT_EQUAL(OUString("a\nb"), pDoc->GetString(0, 6, 0)); +CPPUNIT_ASSERT_EQUAL(OUString("a\n\nb"), pDoc->GetString(0, 7, 0)); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/oox/richstring.cxx b/sc/source/filter/oox/richstring.cxx index a9b272d62a9a..8d2f964362d0 100644 --- a/sc/source/filter/oox/richstring.cxx +++ b/sc/source/filter/oox/richstring.cxx @@ -48,116 +48,6 @@ bool lclNeedsRichTextFormat( const oox::xls::Font* pFont ) return pFont && pFont->needsRichTextFormat(); } -sal_Int32 lcl_getHexLetterValue(sal_Unicode nCode) -{ -if (nCode >= '0' && nCode <= '9') -return nCode - '0'; - -if (nCode >= 'A' && nCode <= 'F') -return nCode - 'A' + 10; - -if (nCode >= 'a' && nCode <= 'f') -return nCode - 'a' + 10; - -return -1; -} - -bool lcl_validEscape(sal_Unicode nCode) -{ -// Valid XML chars that can be escaped (ignoring the restrictions) as in the OOX open spec -// 2.1.1742 Part 1 Section 22.9.2.19, ST_Xstring (Escaped String) -if (nCode == 0x000D || nCode == 0x000A || nCode == 0x0009 || nCode == 0x005F) -return true; - -// Other valid XML chars in basic multilingual plane that cannot be escaped. -if ((nCode >= 0x0020 && nCode <= 0xD7FF) || (nCode >= 0xE000 && nCode <= 0xFFFD)) -return false; - -return true; -} - -OUString lcl_unEscapeUnicodeChars(const OUString& rSrc) -{ -// Example: Escaped representation of unicode char 0x000D is _x000D_ - -sal_Int32 nLen = rSrc.getLength(); -if (!nLen) -return rSrc; - -sal_Int32 nStart = 0; -bool bFound = false; -const OUString aPrefix = "_x"; -sal_Int32 nPrefixStart = rSrc.indexOf(aPrefix, nStart); - -if (nPrefixStart == -1) -return rSrc; - -OUStringBuffer aBuf(rSrc); -sal_Int32 nOffset = 0; // index offset in aBuf w.r.t rSrc. - -do -{ -sal_Int32 nEnd = -1; -sal_Unicode nCode = 0; -bool bFoundThis = false; -for (sal_Int32 nIdx = 0; nIdx < 5; ++nIdx) -{ -sal_Int32 nThisIdx = nPrefixStart + nIdx + 2; -if (nThisIdx >= nLen) -break; - -sal_Unicode nThisCode = rSrc[nThisIdx]; -sal_Int32 nL
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/calc_tests6/moveCopySheet.py | 32 ++ sc/source/ui/inc/mvtabdlg.hxx |3 ++ sc/source/ui/miscdlgs/mvtabdlg.cxx| 15 ++ 3 files changed, 42 insertions(+), 8 deletions(-) New commits: commit 6f67eb36d035fa3fe4103e497207452602ff993b Author: Andreas Heinisch AuthorDate: Fri May 5 19:28:58 2023 +0200 Commit: Andreas Heinisch CommitDate: Sun May 7 13:39:12 2023 +0200 tdf#96854 - Remember last used option in copy/move sheet dialog Change-Id: Iebfd224091c108bb5068b716c39da0979a7ab3ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151437 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/sc/qa/uitest/calc_tests6/moveCopySheet.py b/sc/qa/uitest/calc_tests6/moveCopySheet.py index 80bd9f830a27..5b21e6e86cb0 100644 --- a/sc/qa/uitest/calc_tests6/moveCopySheet.py +++ b/sc/qa/uitest/calc_tests6/moveCopySheet.py @@ -23,8 +23,10 @@ class moveCopySheet(UITestCase): newName.executeAction("TYPE", mkPropertyValues({"TEXT":"newName"})) #verify, the file has 2 sheets; first one "newName" is selected self.assertEqual(document.Sheets.getCount(), 2) -# dialog move/copy sheet ; Move is selected; select -move to end position - ; New Name = moveName +# dialog move/copy sheet ; Copy is selected; Select move and -move to end position - ; New Name = moveName with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog: +xMoveButton = xDialog.getChild("move") +xMoveButton.executeAction("CLICK", tuple()) insertBefore = xDialog.getChild("insertBefore") xTreeEntry = insertBefore.getChild('2') @@ -76,6 +78,29 @@ class moveCopySheet(UITestCase): self.assertEqual(get_state_as_dict(xMoveButton)["Checked"], "false") self.assertEqual(get_state_as_dict(xMoveButton)["Enabled"], "false") +# tdf#96854 - remember last used option for copy/move sheet +def test_tdf96854_remember_copy_move_option(self): +with self.ui_test.create_doc_in_start_center("calc"): +# Add a second sheet to the calc document +with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog: +pass + +# Check if the copy option was remembered +with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog: +xCopyButton = xDialog.getChild("copy") +self.assertEqual(get_state_as_dict(xCopyButton)["Checked"], "true") +xMoveButton = xDialog.getChild("move") +self.assertEqual(get_state_as_dict(xMoveButton)["Checked"], "false") +# Move selected sheet and check if option was remembered +xMoveButton.executeAction("CLICK", tuple()) + +# Check if move option was remembered +with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog: +xCopyButton = xDialog.getChild("copy") +self.assertEqual(get_state_as_dict(xCopyButton)["Checked"], "false") +xMoveButton = xDialog.getChild("move") +self.assertEqual(get_state_as_dict(xMoveButton)["Checked"], "true") + #tdf#139464 Set OK button label to selected action: Move or Copy def test_tdf139464_move_sheet(self): with self.ui_test.create_doc_in_start_center("calc"): @@ -87,11 +112,10 @@ class moveCopySheet(UITestCase): xOkButton = xDialog.getChild("ok") xCopyButton = xDialog.getChild("copy") xMoveButton = xDialog.getChild("move") -self.assertEqual(get_state_as_dict(xMoveButton)['Text'], get_state_as_dict(xOkButton)['Text']) -xCopyButton.executeAction("CLICK", tuple()) self.assertEqual(get_state_as_dict(xCopyButton)['Text'], get_state_as_dict(xOkButton)['Text']) xMoveButton.executeAction("CLICK", tuple()) self.assertEqual(get_state_as_dict(xMoveButton)['Text'], get_state_as_dict(xOkButton)['Text']) - +xCopyButton.executeAction("CLICK", tuple()) +self.assertEqual(get_state_as_dict(xCopyButton)['Text'], get_state_as_dict(xOkButton)['Text']) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/source/ui/inc/mvtabdlg.hxx b/sc/source/ui/inc/mvtabdlg.hxx index c6e89ab9fed0..665d3cd46085 100644 --- a/sc/source/ui/inc/mvtabdlg.hxx +++ b/sc/source/ui/inc/mvtabdlg.hxx @@ -61,6 +61,9 @@ private: boolbRenameTable:1; boolmbEverEdited:1; +// tdf#96854 - remember last used option for copy/move sheet +static bool mbRememeberedCopy; + std::unique_ptr m_xBtnMove; std::unique_ptr m_xBtnCopy; std::unique_ptr m_xFtDoc; diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/uicalc/uicalc2.cxx| 24 sc/source/core/tool/refupdat.cxx |2 -- 2 files changed, 24 insertions(+), 2 deletions(-) New commits: commit b88d11ba05085002cf847d4828ded52a3dfb3b09 Author: Tünde Tóth AuthorDate: Wed Apr 26 15:31:46 2023 +0200 Commit: László Németh CommitDate: Thu Apr 27 18:58:32 2023 +0200 tdf#152577 sc DBData: fix regression of database ranges Regression from commit 0c0444c44107f1a18f23dd0833d462d8dbf56569 "tdf#126926 sc DBData: delete the database range". Change-Id: I04923decdc768770f98763e60cd295400d15c769 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151065 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx index a09c9b8e20e9..69db567f305c 100644 --- a/sc/qa/unit/uicalc/uicalc2.cxx +++ b/sc/qa/unit/uicalc/uicalc2.cxx @@ -1395,6 +1395,30 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testAutoSum) CPPUNIT_ASSERT_EQUAL(OUString("=SUM(B207:D207)"), pDoc->GetFormula(4, 206, 0)); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf152577) +{ +createScDoc(); +ScDocument* pDoc = getScDoc(); + +insertStringToCell("A1", u"1"); +insertStringToCell("A2", u"2"); +insertStringToCell("B1", u"3"); +insertStringToCell("B2", u"4"); + +ScDBData* pDBData = new ScDBData("testDB", 0, 0, 0, 1, 1); +bool bInserted += pDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr(pDBData)); +CPPUNIT_ASSERT(bInserted); + +insertNewSheet(*pDoc); +uno::Sequence aArgs( +comphelper::InitPropertySequence({ { "Index", uno::Any(sal_uInt16(2)) } })); +dispatchCommand(mxComponent, ".uno:Remove", aArgs); + +ScDBCollection* pDBs = pDoc->GetDBCollection(); +CPPUNIT_ASSERT(!pDBs->empty()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx index 3fce7c714423..ef0902aab3f4 100644 --- a/sc/source/core/tool/refupdat.cxx +++ b/sc/source/core/tool/refupdat.cxx @@ -291,8 +291,6 @@ ScRefUpdateRes ScRefUpdate::Update( const ScDocument* pDoc, UpdateRefMode eUpdat eRet = UR_INVALID; theTab2 = theTab1; } -else if (bCut2 && theTab2 == 0) -eRet = UR_INVALID; else if ( bCut1 || bCut2 ) eRet = UR_UPDATED; if ( bExp )
[Libreoffice-commits] core.git: sc/qa sc/source sd/source sfx2/source shell/source svx/source sw/source toolkit/source
sc/qa/unit/helper/debughelper.hxx|4 sc/qa/unit/helper/qahelper.cxx |3 +++ sc/qa/unit/pivottable_filters_test.cxx |3 +++ sc/qa/unit/subsequent_export_test3.cxx |2 ++ sc/qa/unit/ucalc.cxx |2 ++ sc/qa/unit/ucalc_copypaste.cxx |3 +++ sc/qa/unit/ucalc_formula.cxx |2 ++ sc/qa/unit/ucalc_formula2.cxx|3 +++ sc/qa/unit/ucalc_sharedformula.cxx |3 +++ sc/qa/unit/ucalc_sort.cxx|3 +++ sc/source/filter/excel/xeescher.cxx |1 - sc/source/filter/excel/xltracer.cxx |3 --- sc/source/filter/xml/XMLStylesImportHelper.cxx |1 - sc/source/filter/xml/XMLTableShapeResizer.cxx|1 - sc/source/filter/xml/xmltabi.cxx |1 - sc/source/ui/undo/undorangename.cxx |2 -- sd/source/core/drawdoc.cxx |1 - sd/source/ui/framework/module/ModuleController.cxx |1 - sfx2/source/doc/docmacromode.cxx |1 - shell/source/win32/simplemail/smplmailmsg.cxx|2 -- svx/source/accessibility/AccessibleFrameSelector.cxx |2 -- sw/source/core/access/accpara.cxx|1 - sw/source/filter/xml/XMLRedlineImportHelper.cxx |1 - sw/source/filter/xml/xmlitmpr.cxx|3 --- sw/source/uibase/inc/mailmergewizard.hxx |1 - toolkit/source/awt/vclxtopwindow.cxx |1 - toolkit/source/controls/unocontroltablemodel.cxx |1 - 27 files changed, 24 insertions(+), 28 deletions(-) New commits: commit d7e0247ed43091172c2cc3827399bb111416d617 Author: Gabor Kelemen AuthorDate: Wed Apr 12 00:27:47 2023 +0200 Commit: Gabor Kelemen CommitDate: Sun Apr 23 13:05:21 2023 +0200 Run clang-tidy with misc-unused-using-decls on modules [s-t]* To remove unneeded using declarations. Via the simple script: for i in $(find $dirname -name "*cxx" -o -name "*hxx" ); do clang-tidy-12 --checks="-*,misc-unused-using-decls" "$i"; done Change-Id: I596299084471b2904548d23875866f1583b00b2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150610 Tested-by: Jenkins Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/helper/debughelper.hxx b/sc/qa/unit/helper/debughelper.hxx index af7a11a65fdd..47d0e25e0842 100644 --- a/sc/qa/unit/helper/debughelper.hxx +++ b/sc/qa/unit/helper/debughelper.hxx @@ -28,9 +28,5 @@ #include using namespace ::com::sun::star; -using ::std::cout; -using ::std::cerr; -using ::std::endl; -using ::std::vector; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index dbfb6af398f2..af8e5ad8dca1 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -48,6 +48,9 @@ using namespace com::sun::star; using namespace ::com::sun::star::uno; +using ::std::cout; +using ::std::cerr; +using ::std::endl; FormulaGrammarSwitch::FormulaGrammarSwitch(ScDocument* pDoc, formula::FormulaGrammar::Grammar eGrammar) : mpDoc(pDoc), meOldGrammar(pDoc->GetGrammar()) diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index b9c92e252db5..372d81b83ec0 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -34,6 +34,9 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +using ::std::cerr; +using ::std::cout; +using ::std::endl; class ScPivotTableFiltersTest : public ScModelTestBase { diff --git a/sc/qa/unit/subsequent_export_test3.cxx b/sc/qa/unit/subsequent_export_test3.cxx index 4039f54547ef..b1ce4c1a6125 100644 --- a/sc/qa/unit/subsequent_export_test3.cxx +++ b/sc/qa/unit/subsequent_export_test3.cxx @@ -37,6 +37,8 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +using ::std::cerr; +using ::std::endl; class ScExportTest3 : public ScModelTestBase { diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 6ca40d64582e..a1951cdc5b95 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -69,6 +69,8 @@ class ScUndoPaste; class ScUndoCut; +using ::std::cerr; +using ::std::endl; namespace { diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx index c54107e08998..43f9272a13c0 100644 --- a/sc/qa/unit/ucalc_copypaste.cxx +++ b/sc/qa/unit/ucalc_copypaste.cxx @@ -32,6 +32,9 @@ #include +using ::std::cerr; +using ::std::endl; + class TestCopyPaste : public ScUcalcTestBase { protected: diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 0c0c5d4481ad..feb0e8fef22a 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -30
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/subsequent_export_test4.cxx |7 +-- sc/source/ui/unoobj/styleuno.cxx |7 +++ sc/source/ui/view/tabvwsha.cxx | 25 + 3 files changed, 37 insertions(+), 2 deletions(-) New commits: commit 0f6e6e82a4a693a6970540db6e98d0302f3fefa6 Author: Maxim Monastirsky AuthorDate: Wed Apr 19 01:47:10 2023 +0300 Commit: Maxim Monastirsky CommitDate: Wed Apr 19 13:31:17 2023 +0200 sc drawstyles: Fix export of transparency Change-Id: I1abf277223718ae2d650728e5bd141372a771a87 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150590 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index eb3af3a2b2bf..25eb30e19245 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -1499,8 +1499,9 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testShapeStyles) uno::Reference xStyle( xMSF->createInstance("com.sun.star.style.GraphicStyle"), uno::UNO_QUERY_THROW); xGraphicStyles->insertByName("MyStyle1", Any(xStyle)); -uno::Reference(xStyle, uno::UNO_QUERY_THROW) -->setPropertyValue("FillColor", Any(COL_RED)); +uno::Reference xPropertySet(xStyle, uno::UNO_QUERY_THROW); +xPropertySet->setPropertyValue("FillColor", Any(COL_RED)); +xPropertySet->setPropertyValue("FillTransparence", Any(sal_Int16(40))); xStyle.set(xMSF->createInstance("com.sun.star.style.GraphicStyle"), uno::UNO_QUERY_THROW); xGraphicStyles->insertByName("MyStyle2", Any(xStyle)); @@ -1540,6 +1541,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testShapeStyles) Color nColor; xShape->getPropertyValue("FillColor") >>= nColor; CPPUNIT_ASSERT_EQUAL(COL_RED, nColor); +CPPUNIT_ASSERT_EQUAL(sal_Int16(40), + xShape->getPropertyValue("FillTransparence").get()); } } diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index f4280dd2a679..a97c12e3dec5 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -2025,6 +2025,13 @@ uno::Any ScStyleObj::getPropertyValue_Impl( std::u16string_view aPropertyName ) { if (!SvxUnoTextRangeBase::GetPropertyValueHelper(*pItemSet, pResultEntry, aAny)) aAny = SvxItemPropertySet_getPropertyValue(pResultEntry, *pItemSet); + +// since the sfx uint16 item now exports a sal_Int32, we may have to fix this here +if (pResultEntry->aType == ::cppu::UnoType::get() && +aAny.getValueType() == ::cppu::UnoType::get()) +{ +aAny <<= static_cast(aAny.get()); +} } } } diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index a3eb7bd5403d..b309ac6156d5 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -40,6 +40,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -1587,6 +1594,24 @@ void ScTabViewShell::ExecStyle( SfxRequest& rReq ) SfxItemSet& rAttr = pStyleSheet->GetItemSet(); sdr::properties::CleanupFillProperties(rAttr); +// check for unique names of named items for xml +auto checkForUniqueItem = [&] (auto nWhichId) +{ +if (auto pOldItem = rAttr.GetItemIfSet(nWhichId, false)) +{ +if (auto pNewItem = pOldItem->checkForUniqueItem(&GetDrawView()->GetModel())) +rAttr.Put(std::move(pNewItem)); +} +}; + +checkForUniqueItem(XATTR_FILLBITMAP); +checkForUniqueItem(XATTR_LINEDASH); +checkForUniqueItem(XATTR_LINESTART); +checkForUniqueItem(XATTR_LINEEND); +checkForUniqueItem(XATTR_FILLGRADIENT); +checkForUniqueItem(XATTR_FILLFLOATTRANSPARENCE); +checkForUniqueItem(XATTR_FILLHATCH); + static_cast(pStyleSheet)->Broadcast(SfxHint(SfxHintId::DataChanged)); GetScDrawView()->InvalidateAttribs(); }
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/extras/macros-test.cxx| 32 sc/source/ui/unoobj/viewuno.cxx | 18 +- 2 files changed, 45 insertions(+), 5 deletions(-) New commits: commit 10f2e8363076fb9217b4fc8acf12b4d9c13328cc Author: Andreas Heinisch AuthorDate: Fri Apr 14 14:29:12 2023 +0200 Commit: Andreas Heinisch CommitDate: Tue Apr 18 12:40:49 2023 +0200 tdf#154803 - Check if range is entirely merged Regression from commit b9411e587586750f36ba9009b5f1e29fe461d8b5 where I missinterpreted the check to get merged cells. Regression: tdf#147122 - Return cell object when a simple selection is merged Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145378 Change-Id: I2e39599a206cf102b1da8c7fc4bb2d8c0a4b106c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150412 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index dd971e36dec1..1135fbd38f69 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -911,6 +911,38 @@ CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf147122) CPPUNIT_ASSERT_EQUAL(Any(OUString("This is a test")), aRet); } +CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf154803) +{ +mxComponent = loadFromDesktop("private:factory/scalc"); + +css::uno::Reference xDocScr(mxComponent, UNO_QUERY_THROW); +auto xLibs = xDocScr->getBasicLibraries(); +auto xLibrary = xLibs->createLibrary("TestLibrary"); +xLibrary->insertByName( +"TestModule", +uno::Any( +OUString("Function TestExtendedMergedSelection\n" + // Merge A1:B2 cell range + " oActiveSheet = ThisComponent.CurrentController.ActiveSheet\n" + " oRange = oActiveSheet.getCellRangeByName(\"A1:B2\")\n" + " ThisComponent.getCurrentController.Select(oRange)\n" + " oActiveCell = ThisComponent.CurrentSelection\n" + " oActiveCell.Merge(True)\n" + // Select A1:B3 range and check for its implementation name + " oRange = oActiveSheet.getCellRangeByName(\"A1:B3\")\n" + " ThisComponent.getCurrentController.Select(oRange)\n" + " TestExtendedMergedSelection = ThisComponent.CurrentSelection.ImplementationName\n" + "End Function\n"))); + +Any aRet = executeMacro("vnd.sun.Star.script:TestLibrary.TestModule.TestExtendedMergedSelection?" +"language=Basic&location=document"); +// Without the fix in place, this test would have failed with +// - Expected : ScCellRangeObj +// - Actual : ScCellObj +// i.e. the selection was interpreted as a single cell instead of a range +CPPUNIT_ASSERT_EQUAL(Any(OUString("ScCellRangeObj")), aRet); +} + CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf116127) { mxComponent = loadFromDesktop("private:factory/scalc"); diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index 96b055250c72..bfde44272010 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -873,13 +874,20 @@ uno::Any SAL_CALL ScTabViewObj::getSelection() ScMarkType eMarkType = rViewData.GetSimpleArea(aRange); if ( nTabs == 1 && (eMarkType == SC_MARK_SIMPLE) ) { -// tdf#147122 - return cell object when a simple selection is merged +// tdf#154803 - check if range is entirely merged ScDocument& rDoc = pDocSh->GetDocument(); -const ScPatternAttr* pMarkPattern = rDoc.GetPattern(aRange.aStart); +const ScMergeAttr* pMergeAttr = rDoc.GetAttr(aRange.aStart, ATTR_MERGE); +SCCOL nColSpan = 1; +SCROW nRowSpan = 1; +if (pMergeAttr && pMergeAttr->IsMerged()) +{ +nColSpan = pMergeAttr->GetColMerge(); +nRowSpan = pMergeAttr->GetRowMerge(); +} +// tdf#147122 - return cell object when a simple selection is entirely merged if (aRange.aStart == aRange.aEnd -|| (pMarkPattern -&& pMarkPattern->GetItemSet().GetItemState(ATTR_MERGE, false) - == SfxItemState::SET)) +|| (aRange.aEnd.Col() - aRange.aStart.Col() == nColSpan - 1 +&& aRange.aEnd.Row() - aRange.aStart.Row() == nRowSpan - 1)) pObj = new ScCellObj( pDocSh, aRange.aStart ); else pObj = new ScCellRangeObj( pDocSh, aRange );
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/subsequent_export_test4.cxx | 16 +++- sc/source/filter/excel/xlroot.cxx |1 + 2 files changed, 16 insertions(+), 1 deletion(-) New commits: commit 86cbbbccba19ba0433693e3e5c59c67e9dc6a003 Author: Maxim Monastirsky AuthorDate: Fri Apr 14 02:19:44 2023 +0300 Commit: Maxim Monastirsky CommitDate: Tue Apr 18 01:56:31 2023 +0200 sc drawstyles: Fix xlsx export for text attributes in comments Change-Id: Ic5b6099460bd5e978c04aff3233537059ce711b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150379 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index 5d629e83eb4a..663767c7374f 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -1583,7 +1583,21 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testCommentStyles) // Check that the style was imported, and survived copying CPPUNIT_ASSERT_EQUAL(OUString("MyStyle1"), pCaption->GetStyleSheet()->GetName()); -// Check that the style formatting is in effect +} + +saveAndReload("Calc Office Open XML"); + +{ +ScDocument* pDoc = getScDoc(); + +ScAddress aPos(0, 0, 0); +ScPostIt* pNote = pDoc->GetNote(aPos); +CPPUNIT_ASSERT(pNote); + +auto pCaption = pNote->GetOrCreateCaption(aPos); +CPPUNIT_ASSERT(pCaption); + +// Check that the style formatting is preserved CPPUNIT_ASSERT_EQUAL(sal_uInt32(1129), pCaption->GetMergedItemSet().Get(EE_CHAR_FONTHEIGHT).GetHeight()); } diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx index 47f5ff7806c1..71d308d2f29c 100644 --- a/sc/source/filter/excel/xlroot.cxx +++ b/sc/source/filter/excel/xlroot.cxx @@ -408,6 +408,7 @@ EditEngine& XclRoot::GetDrawEditEngine() const { mrData.mxDrawEditEng = std::make_shared( &GetDoc().GetDrawLayer()->GetItemPool() ); EditEngine& rEE = *mrData.mxDrawEditEng; + rEE.SetStyleSheetPool(static_cast(GetDoc().GetDrawLayer()->GetStyleSheetPool())); rEE.SetRefMapMode(MapMode(MapUnit::Map100thMM)); rEE.SetUpdateLayout( false ); rEE.EnableUndo( false );
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/subsequent_export_test4.cxx | 13 ++ sc/qa/unit/ucalc.cxx | 18 sc/source/core/data/document.cxx |7 - sc/source/core/data/drwlayer.cxx | 59 + sc/source/core/data/postit.cxx | 63 -- sc/source/core/tool/detfunc.cxx| 147 - sc/source/core/tool/stylehelper.cxx|1 7 files changed, 130 insertions(+), 178 deletions(-) New commits: commit 3e4b8463f288d87f91cd5bc864d30ae02d4f5579 Author: Maxim Monastirsky AuthorDate: Mon Apr 10 00:38:33 2023 +0300 Commit: Maxim Monastirsky CommitDate: Tue Apr 18 01:09:21 2023 +0200 sc drawstyles: Maintain comment formatting with styles Up to now the look of comments was maintained with the comment shape's DF, with the default formatting being reapplied on import (for hidden comments), on changing Tools > Options... > LibreOffice > AC > Notes background, and on changing the default cell style, while keeping the user-applied DF to some extent. However, as we attempt to support drawing styles, this approach is no longer viable, as applying DF on top of styles at random times makes styles useless in the context of comments. (One might argue, that the look of comments should ideally be treated as an app view setting, and not as a formatting of an individual shape. This definitely makes sense, but has compat. implications, as both LO and Excel allow formatting individual comments (e.g. show a comment, right click > Area...). However we will probably do it anyway if we ever implement threaded comments like in recent Excel [1], as the callout shape based approach seems to not scale to it.) One way around it could be to explicitly disable any style interaction with comments. But this will be unfortunate, as styles have a clear advantage of being able to consistently maintain the same formatting for several elements, much more that the fragile approach of mixing the default formatting and user-applied formatting in the same formatting layer. Not to mention the possibility to define several custom styles. In addition there is a request in tdf#55682 to disconnect the formatting of comments from the default cell style, having a dedicated style instead, which I find reasonable. So this commit introduces a comment style, and uses it for new comments instead of DF, making it easy to format all comments at once. And a style based formatting is never overriden with DF, unless explicitly set by the user. Changing Tools > Options... > LibreOffice > AC > Notes background still has an effect in two ways: (1) Sets the default background of the comment style for new documents, and (2) if changed while a document is open, changes also the comment style of the current document. An undo action is also added, in case changing the current document wasn't deliberate. Changing the default cell style no longer has any effect on comment formatting. One unfortunate side effect of this change, is that newly created and permanently visible comments will lose their default look when opened in an older version. But there is not much I can do here, as older versions don't support styles, and I believe the advantage of using styles outweigh this concern. Hidden comments are not affected by this. [1] see https://support.microsoft.com/en-us/office/the-difference-between-threaded-comments-and-notes-75a51eec-4092-42ab-abf8-7669077b7be3 Change-Id: I84215791b9e6ce393c6d979aa2b19ef70c76dff9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150352 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index 9d6e38ef8a09..5d629e83eb4a 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -1553,12 +1554,14 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testCommentStyles) ScPostIt* pNote = pDoc->GetNote(aPos); CPPUNIT_ASSERT(pNote); -pNote->ShowCaption(aPos, true); auto pCaption = pNote->GetCaption(); CPPUNIT_ASSERT(pCaption); auto pStyleSheet = &pDoc->GetStyleSheetPool()->Make("MyStyle1", SfxStyleFamily::Frame); -pCaption->SetStyleSheet(static_cast(pStyleSheet), true); +auto& rSet = pStyleSheet->GetItemSet(); +rSet.Put(SvxFontHeightItem(1129, 100, EE_CHAR_FONTHEIGHT)); + +pCaption->SetStyleSheet(static_cast(pStyleSheet), false); // Hidden comments use different code path on import pNote->ShowCaption(aPos, false); @@ -1575,12 +1578,14 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testCommentStyles) ScPostIt* pNot
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/ucalc.cxx| 26 ++ sc/source/core/tool/reffind.cxx |4 ++-- 2 files changed, 28 insertions(+), 2 deletions(-) New commits: commit 40e3e9fd1c501cc1978d4370b6392701ccd42a71 Author: Andreas Heinisch AuthorDate: Thu Apr 6 17:38:52 2023 +0200 Commit: Andreas Heinisch CommitDate: Fri Apr 7 14:00:42 2023 +0200 tdf#113027 - Allow cycling cell reference types including whitespaces A formula containing a remote reference to a sheet including a whitespace in its name does not correctly handle switching from relative to absolute cell references using the EXCEL R1C1 formular grammar. Change-Id: I3391f4e8f57993899b5e97f0a173b624b5ef0b22 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150109 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 8563ef8283c3..aa8dbc32b220 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -450,6 +450,32 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf66613) m_pDoc->DeleteTab(nSecondTab); } +CPPUNIT_TEST_FIXTURE(Test, testTdf113027) +{ +// Insert some sheets including a whitespace in their name and switch the grammar to R1C1 +CPPUNIT_ASSERT(m_pDoc->InsertTab(0, "Sheet 1")); +CPPUNIT_ASSERT(m_pDoc->InsertTab(1, "Sheet 2")); +FormulaGrammarSwitch aFGSwitch(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1); + +// Add a formula containing a remote reference, i.e., to another sheet +const ScAddress aScAddress(0, 0, 0); +const OUString aFormula = "='Sheet 2'!RC"; +m_pDoc->SetString(aScAddress, aFormula); + +// Switch from relative to absolute cell reference +ScRefFinder aFinder(aFormula, aScAddress, *m_pDoc, m_pDoc->GetAddressConvention()); +aFinder.ToggleRel(0, aFormula.getLength()); + +// Without the fix in place, this test would have failed with +// - Expected: ='Sheet 2'!R1C1 +// - Actual : ='Sheet 2'!RC +// i.e. the cell reference was not changed from relative to absolute +CPPUNIT_ASSERT_EQUAL(OUString("='Sheet 2'!R1C1"), aFinder.GetText()); + +m_pDoc->DeleteTab(0); +m_pDoc->DeleteTab(1); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf90698) { CPPUNIT_ASSERT(m_pDoc->InsertTab (0, "Test")); diff --git a/sc/source/core/tool/reffind.cxx b/sc/source/core/tool/reffind.cxx index ab276196d399..ac080ae5a56e 100644 --- a/sc/source/core/tool/reffind.cxx +++ b/sc/source/core/tool/reffind.cxx @@ -91,7 +91,7 @@ sal_Int32 FindEndPosR1C1(const sal_Unicode* p, sal_Int32 nStartPos, sal_Int32 nE if (*p == '\'') { // Skip until the closing quote. -for (; nNewEnd <= nEndPos; ++p, ++nNewEnd) +for (++p; nNewEnd <= nEndPos; ++p, ++nNewEnd) if (*p == '\'') break; if (nNewEnd > nEndPos) @@ -100,7 +100,7 @@ sal_Int32 FindEndPosR1C1(const sal_Unicode* p, sal_Int32 nStartPos, sal_Int32 nE else if (*p == '[') { // Skip until the closing bracket. -for (; nNewEnd <= nEndPos; ++p, ++nNewEnd) +for (++p; nNewEnd <= nEndPos; ++p, ++nNewEnd) if (*p == ']') break; if (nNewEnd > nEndPos)
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/contentCSV/statistical-functions.csv |6 +++--- sc/qa/unit/data/ods/functions.ods|binary sc/source/core/tool/interpr3.cxx |8 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) New commits: commit 74d39f5cff324d76092268418028bd882d8a4d60 Author: Eike Rathke AuthorDate: Thu Apr 6 14:41:39 2023 +0200 Commit: Eike Rathke CommitDate: Thu Apr 6 16:58:12 2023 +0200 Resolves: tdf#154627 RANK() query value not in data must return error For all RANK(), RANK.EQ(), RANK.AVG(). Also, use #N/A NotAvailable instead of #VALUE! NoValue. This made it necessary to adapt sc/qa/unit/data/ods/functions.ods and result check that had a totally senseless query value with arbitrary results. Change-Id: If835b5ed49caf16a813b4ea897e1d7dd1aa02954 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150067 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/sc/qa/unit/data/contentCSV/statistical-functions.csv b/sc/qa/unit/data/contentCSV/statistical-functions.csv index 2e3c45cdb4a3..b9dbe2f2fbd9 100644 --- a/sc/qa/unit/data/contentCSV/statistical-functions.csv +++ b/sc/qa/unit/data/contentCSV/statistical-functions.csv @@ -117,9 +117,9 @@ 1 -0.1225598712 -0.1363480926 -2 -9 -2 +10 +11 +10 0.5,0.1 121,216 120 diff --git a/sc/qa/unit/data/ods/functions.ods b/sc/qa/unit/data/ods/functions.ods index 04c6e6ed1274..1ef3a7217b34 100644 Binary files a/sc/qa/unit/data/ods/functions.ods and b/sc/qa/unit/data/ods/functions.ods differ diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index 0153ee612e1c..88b32b44af1e 100644 --- a/sc/source/core/tool/interpr3.cxx +++ b/sc/source/core/tool/interpr3.cxx @@ -4254,7 +4254,7 @@ void ScInterpreter::ScRank( bool bAverage ) else { if ( fVal < aSortArray[ 0 ] || fVal > aSortArray[ nSize - 1 ] ) -PushNoValue(); +PushError( FormulaError::NotAvailable); else { double fLastPos = 0; @@ -4279,7 +4279,11 @@ void ScInterpreter::ScRank( bool bAverage ) } if ( !bFinished ) fLastPos = i; -if ( !bAverage ) +if (fFirstPos <= 0) +{ +PushError( FormulaError::NotAvailable); +} +else if ( !bAverage ) { if ( bAscending ) PushDouble( fFirstPos );
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/uitest/autofilter/autofilter.py |2 ++ sc/qa/uitest/autofilter2/tdf97340.py |3 +++ sc/source/ui/cctrl/checklistmenu.cxx | 12 +++- sc/source/ui/inc/checklistmenu.hxx|4 4 files changed, 20 insertions(+), 1 deletion(-) New commits: commit 37928bef1c23f30df04bc7e95fcbc202c8cb4299 Author: Andreas Heinisch AuthorDate: Mon Apr 3 12:43:51 2023 +0200 Commit: Andreas Heinisch CommitDate: Tue Apr 4 18:13:08 2023 +0200 tdf#151206 - Sc Auto Filter: filter items after search edit timeout In addition, UI tests have been adapted to address the timeout of the search process. Change-Id: Id9d78896e45da43734346654762c3541b8c07ba2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149958 Tested-by: Andreas Heinisch Reviewed-by: Andreas Heinisch diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index f792c0fdad33..8ffba26539a5 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -154,6 +154,7 @@ class AutofilterTest(UITestCase): xSearchEdit = xFloatWindow.getChild("search_edit") xSearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT" : "11"})) +self.ui_test.wait_until_property_is_updated(xList, "Children", str(1)) self.assertEqual(1, len(xList.getChildren())) self.assertEqual("11", get_state_as_dict(xList.getChild('0'))['Text']) @@ -179,6 +180,7 @@ class AutofilterTest(UITestCase): xSearchEdit = xFloatWindow.getChild("search_edit") xSearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT" : "22"})) +self.ui_test.wait_until_property_is_updated(xList, "Children", str(1)) self.assertEqual(1, len(xList.getChildren())) self.assertEqual("22", get_state_as_dict(xList.getChild('0'))['Text']) diff --git a/sc/qa/uitest/autofilter2/tdf97340.py b/sc/qa/uitest/autofilter2/tdf97340.py index 31e41ff6c358..884caa00a5db 100644 --- a/sc/qa/uitest/autofilter2/tdf97340.py +++ b/sc/qa/uitest/autofilter2/tdf97340.py @@ -29,11 +29,14 @@ class tdf97340(UITestCase): xsearchEdit = xFloatWindow.getChild("search_edit") xsearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT":" "})) +self.ui_test.wait_until_property_is_updated(xTreeList, "Children", str(0)) self.assertEqual(0, len(xTreeList.getChildren())) xsearchEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) #tdf#133785, without the fix in place, it would have been 0 +self.ui_test.wait_until_property_is_updated(xTreeList, "Children", str(8)) +# Number of children differs due to xTreeList.getChildren() returns only direct descendants self.assertEqual(2, len(xTreeList.getChildren())) self.assertEqual("2016", get_state_as_dict(xTreeList.getChild('0'))['Text']) self.assertEqual("2017", get_state_as_dict(xTreeList.getChild('1'))['Text']) diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index a89d852e6de0..456b0fe8b76a 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -507,6 +507,7 @@ ScCheckListMenuControl::ScCheckListMenuControl(weld::Widget* pParent, ScViewData , mbIsPoppedUp(false) , maOpenTimer(this) , maCloseTimer(this) +, maSearchEditTimer("ScCheckListMenuControl maSearchEditTimer") { mxTreeChecks->set_clicks_to_toggle(1); mxListChecks->set_clicks_to_toggle(1); @@ -583,6 +584,9 @@ ScCheckListMenuControl::ScCheckListMenuControl(weld::Widget* pParent, ScViewData // bulk_insert_for_each mxTreeChecks->set_size_request(mnCheckWidthReq, nChecksHeight); mxListChecks->set_size_request(mnCheckWidthReq, nChecksHeight); + +maSearchEditTimer.SetTimeout(EDIT_UPDATEDATA_TIMEOUT); +maSearchEditTimer.SetInvokeHandler(LINK(this, ScCheckListMenuControl, SearchEditTimeoutHdl)); } void ScCheckListMenuControl::GrabFocus() @@ -612,6 +616,7 @@ void ScCheckListMenuControl::DropPendingEvents() ScCheckListMenuControl::~ScCheckListMenuControl() { +maSearchEditTimer.Stop(); EndPopupMode(); for (auto& rMenuItem : maMenuItems) rMenuItem.mxSubMenuWin.reset(); @@ -739,7 +744,7 @@ namespace } } -IMPL_LINK_NOARG(ScCheckListMenuControl, EdModifyHdl, weld::Entry&, void) +IMPL_LINK_NOARG(ScCheckListMenuControl, SearchEditTimeoutHdl, Timer*, void) { OUString aSearchText = mxEdSearch->get_text(); aSearchText = ScGlobal::getCharClass().lowercase( aSearchText ); @@ -875,6 +880,11 @@ IMPL_LINK_NOARG(ScCheckListMenuControl, EdModifyHdl, weld::Entry&, void) } } +IMPL_LINK_NOARG(ScCheckListMenuControl, EdModifyHdl, weld::Entry&, void) +{ +maSearchEditTimer.Start(); +} + IMPL_LINK_NOARG(ScCheckListMenuControl, EdActivateHdl, weld::Entry&, bool) {
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/extras/macros-test.cxx| 26 ++ sc/qa/extras/testdocuments/tdf89920.ods |binary sc/source/core/data/table6.cxx | 15 --- 3 files changed, 30 insertions(+), 11 deletions(-) New commits: commit 56ae7d01505fdae421109cfc78449230ba589d79 Author: Andreas Heinisch AuthorDate: Mon Mar 13 08:49:27 2023 +0100 Commit: Andreas Heinisch CommitDate: Mon Apr 3 08:43:06 2023 +0200 tdf#89920 - Handle embedded newline in Calc's search cell If the replaced string contains a newline after find and replace, insert an edit cell in order to handle an embedded line correctly regardless of the content in the source cell. Change-Id: Ic8a5fc80b85546897572a228511b319cd5a8b9aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148752 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index a77147504ae4..ec41a2fbe4a9 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -279,6 +279,32 @@ CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf142033) CPPUNIT_ASSERT_EQUAL(OUString(u"string with" + OUStringChar(u'\xA') + u"newlines"), rDoc.GetString(ScAddress(1,1,0))); } +CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf89920) +{ +loadFromURL(u"tdf89920.ods"); + + executeMacro("vnd.sun.Star.script:Standard.Module1.SearchAndReplaceNewline?language=Basic&" + "location=document"); + +// Export to ODS +saveAndReload("calc8"); + +xmlDocUniquePtr pContentXml = parseExport("content.xml"); +CPPUNIT_ASSERT(pContentXml); + +assertXPathContent(pContentXml, + "/office:document-content/office:body/office:spreadsheet/table:table[1]/" + "table:table-row[1]/table:table-cell[1]/text:p[1]", + "aa bb"); + +// Without the fix in place, this test would have failed here with +// - Expression: xmlXPathNodeSetGetLength(pXmlNodes) > 0 +assertXPathContent(pContentXml, + "/office:document-content/office:body/office:spreadsheet/table:table[1]/" + "table:table-row[1]/table:table-cell[1]/text:p[2]", + "cc dd"); +} + CPPUNIT_TEST_FIXTURE(ScMacrosTest, testPasswordProtectedUnicodeString) { const OUString sCorrectString(u"English Русский 中文"); diff --git a/sc/qa/extras/testdocuments/tdf89920.ods b/sc/qa/extras/testdocuments/tdf89920.ods new file mode 100644 index ..216a5cc75d9d Binary files /dev/null and b/sc/qa/extras/testdocuments/tdf89920.ods differ diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx index 1f0fc1efbf3d..1ea4a5ace99d 100644 --- a/sc/source/core/data/table6.cxx +++ b/sc/source/core/data/table6.cxx @@ -35,14 +35,11 @@ namespace { -bool lcl_GetTextWithBreaks( const EditTextObject& rData, ScDocument* pDoc, OUString& rVal ) +void lcl_GetTextWithBreaks( const EditTextObject& rData, ScDocument* pDoc, OUString& rVal ) { -// true = more than 1 paragraph - EditEngine& rEngine = pDoc->GetEditEngine(); rEngine.SetText(rData); rVal = rEngine.GetText(); -return ( rEngine.GetParagraphCount() > 1 ); } } @@ -81,7 +78,6 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, sc::Colum pNote = nullptr; } -bool bMultiLine = false; CellType eCellType = aCell.getType(); switch (rSearchItem.GetCellType()) { @@ -90,7 +86,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, sc::Colum if ( eCellType == CELLTYPE_FORMULA ) aString = aCell.getFormula()->GetFormula(rDocument.GetGrammar()); else if ( eCellType == CELLTYPE_EDIT ) -bMultiLine = lcl_GetTextWithBreaks(*aCell.getEditText(), &rDocument, aString); +lcl_GetTextWithBreaks(*aCell.getEditText(), &rDocument, aString); else { if( !bSearchFormatted ) @@ -102,7 +98,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, sc::Colum } case SvxSearchCellType::VALUE: if ( eCellType == CELLTYPE_EDIT ) -bMultiLine = lcl_GetTextWithBreaks(*aCell.getEditText(), &rDocument, aString); +lcl_GetTextWithBreaks(*aCell.getEditText(), &rDocument, aString); else { if( !bSearchFormatted ) @@ -114,10 +110,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, sc::Colum case SvxSearchCellType::NOTE: { if (pNote) -{ aString = pNote->GetText(); -bMultiLine = pNote->HasMultiLineText(); -} break; } default: @@ -264,7 +257,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, sc::Colum pFCel
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/subsequent_export_test4.cxx | 23 +++ sc/source/filter/xml/xmlexprt.cxx |6 -- 2 files changed, 27 insertions(+), 2 deletions(-) New commits: commit 8085a68be7604e7bd4e0d9445be5e266ffbb Author: Andreas Heinisch AuthorDate: Wed Mar 29 16:53:48 2023 +0200 Commit: Andreas Heinisch CommitDate: Wed Mar 29 17:22:55 2023 + tdf#154445 - Export all page styles even if they are not in use Change-Id: If0ca5ea97ad545058c6a70d223158a87bf9207ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149729 Tested-by: Jenkins Reviewed-by: Andreas Heinisch diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx index 3033ff4fef85..275493f61387 100644 --- a/sc/qa/unit/subsequent_export_test4.cxx +++ b/sc/qa/unit/subsequent_export_test4.cxx @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include #include @@ -418,6 +420,27 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testHeaderFontStyleXLSX) CPPUNIT_ASSERT_MESSAGE("Second line should be italic.", bHasItalic); } +CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf154445_unused_pagestyles) +{ +createScDoc("ods/tdf108188_pagestyle.ods"); + +// Check if the user defined page style is present +const OUString aTestPageStyle = "TestPageStyle"; +ScDocument* pDoc = getScDoc(); +CPPUNIT_ASSERT_EQUAL(aTestPageStyle, pDoc->GetPageStyle(0)); + +// Change page style to default so the user defined one is not used anymore +pDoc->SetPageStyle(0, ScResId(STR_STYLENAME_STANDARD)); + +// Save and reload the document to check if the unused page styles are still present +saveAndReload("calc8"); +pDoc = getScDoc(); + +// Without the accompanying fix in place, the unused page styles don't exist anymore +ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool(); +CPPUNIT_ASSERT(pStylePool->Find(aTestPageStyle, SfxStyleFamily::Page)); +} + CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf135828_Shape_Rect) { if (!IsDefaultDPI()) diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index cbf8dcf11a0a..4c306de2c907 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -2609,7 +2609,8 @@ void ScXMLExport::collectAutoStyles() } if (getExportFlags() & SvXMLExportFlags::MASTERSTYLES) -GetPageExport()->collectAutoStyles(true); +// tdf#154445 - export all page styles even if they are not in use +GetPageExport()->collectAutoStyles(false); mbAutoStylesCollected = true; } @@ -2671,7 +2672,8 @@ void ScXMLExport::ExportAutoStyles_() void ScXMLExport::ExportMasterStyles_() { -GetPageExport()->exportMasterStyles( true ); +// tdf#154445 - export all page styles even if they are not in use +GetPageExport()->exportMasterStyles( false ); } void ScXMLExport::CollectInternalShape( uno::Reference< drawing::XShape > const & xShape )
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/helper/qahelper.cxx |6 - sc/qa/unit/subsequent_export_test3.cxx | 21 + sc/source/core/data/documen4.cxx | 39 +- sc/source/core/data/document.cxx | 10 +- sc/source/core/data/documentimport.cxx | 39 +- sc/source/core/data/funcdesc.cxx | 61 +--- sc/source/core/tool/address.cxx |4 - sc/source/core/tool/chgtrack.cxx | 16 +--- sc/source/core/tool/compiler.cxx |4 - sc/source/core/tool/formulalogger.cxx| 41 -- sc/source/core/tool/rangeutl.cxx |3 sc/source/core/tool/reffind.cxx |3 sc/source/filter/dif/difexp.cxx | 55 ++ sc/source/filter/excel/read.cxx |5 - sc/source/filter/excel/xecontent.cxx | 10 -- sc/source/filter/excel/xetable.cxx |6 - sc/source/filter/excel/xipivot.cxx |3 sc/source/filter/html/htmlexp.cxx| 29 +++ sc/source/filter/oox/formulabase.cxx |3 sc/source/filter/xml/xmlexprt.cxx| 102 --- sc/source/ui/app/inputhdl.cxx| 23 ++ sc/source/ui/condformat/condformathelper.cxx | 38 -- sc/source/ui/dbgui/asciiopt.cxx |3 sc/source/ui/dbgui/csvruler.cxx |3 sc/source/ui/dbgui/dbnamdlg.cxx |9 -- sc/source/ui/view/cellsh3.cxx| 40 +- sc/source/ui/view/dbfunc3.cxx|6 - sc/source/ui/view/gridwin.cxx|8 -- sc/source/ui/view/viewfun2.cxx |4 - 29 files changed, 252 insertions(+), 342 deletions(-) New commits: commit 86313f053315cd0ba896e494d7bac14d2279c9b4 Author: Noel Grandin AuthorDate: Sat Mar 25 19:30:24 2023 +0200 Commit: Noel Grandin CommitDate: Sun Mar 26 11:24:13 2023 + loplugin:stringadd in sc after my patch to merge the bufferadd loplugin into stringadd Change-Id: Ifa70db5be4719fe66d3043e5e49403246f6aa8bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149582 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 27230e0d2b43..dbfb6af398f2 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -131,8 +131,7 @@ void ScModelTestBase::testFile(const OUString& aFileName, ScDocument& rDoc, SCTA catch (const orcus::parse_error& e) { std::cout << "reading csv content file failed: " << e.what() << std::endl; -OStringBuffer aErrorMsg("csv parser error: "); -aErrorMsg.append(e.what()); +OString aErrorMsg = OString::Concat("csv parser error: ") + e.what(); CPPUNIT_ASSERT_MESSAGE(aErrorMsg.getStr(), false); } } @@ -155,8 +154,7 @@ void ScModelTestBase::testCondFile( const OUString& aFileName, ScDocument* pDoc, catch (const orcus::parse_error& e) { std::cout << "reading csv content file failed: " << e.what() << std::endl; -OStringBuffer aErrorMsg("csv parser error: "); -aErrorMsg.append(e.what()); +OString aErrorMsg = OString::Concat("csv parser error: ") + e.what(); CPPUNIT_ASSERT_MESSAGE(aErrorMsg.getStr(), false); } } diff --git a/sc/qa/unit/subsequent_export_test3.cxx b/sc/qa/unit/subsequent_export_test3.cxx index f07f25b2e3a7..4039f54547ef 100644 --- a/sc/qa/unit/subsequent_export_test3.cxx +++ b/sc/qa/unit/subsequent_export_test3.cxx @@ -264,22 +264,11 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, testBordersExchangeXLSX) static OUString toString(const ScBigRange& rRange) { -OUStringBuffer aBuf; -aBuf.append("(columns:"); -aBuf.append(rRange.aStart.Col()); -aBuf.append('-'); -aBuf.append(rRange.aEnd.Col()); -aBuf.append(";rows:"); -aBuf.append(rRange.aStart.Row()); -aBuf.append('-'); -aBuf.append(rRange.aEnd.Row()); -aBuf.append(";sheets:"); -aBuf.append(rRange.aStart.Tab()); -aBuf.append('-'); -aBuf.append(rRange.aEnd.Tab()); -aBuf.append(')'); - -return aBuf.makeStringAndClear(); +return "(columns:" + OUString::number(rRange.aStart.Col()) + "-" + + OUString::number(rRange.aEnd.Col()) + ";rows:" + OUString::number(rRange.aStart.Row()) + + "-" + OUString::number(rRange.aEnd.Row()) + + ";sheets:" + OUString::number(rRange.aStart.Tab()) + "-" + + OUString::number(rRange.aEnd.Tab()) + ")"; } CPPUNIT_TEST_FIXTURE(ScExportTest3, testTrackChangesSimpleXLSX) diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index e7945b773d9d..0db93c0aeb5b 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -386,19 +386,18 @@ void ScDocument::InsertTableOp(const ScTabOpParam& rParam, // multiple (repeate } ScRefAddress aRef; -