[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - 2 commits - oox/source sc/qa sc/source
oox/source/helper/attributelist.cxx|3 sc/qa/unit/data/csv/tdf152980.csv |9 ++ sc/qa/unit/subsequent_export_test2.cxx | 29 sc/source/filter/oox/richstring.cxx| 112 - 4 files changed, 42 insertions(+), 111 deletions(-) New commits: commit 47b30728db3ad47f1b4d0d8b027ba0a55607ac1e Author: Czeber László Ádám AuthorDate: Mon May 8 09:33:07 2023 +0200 Commit: Xisco Fauli CommitDate: Tue May 9 12:28:34 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 Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151562 Reviewed-by: Michael Stahl Tested-by: Jenkins 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_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 56d7ac158151..d1920de3c3cb 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -193,6 +193,7 @@ public: void testTotalsRowFunction(); void testAutofilterHiddenButton(); void testTdf119565(); +void testTdf152980(); CPPUNIT_TEST_SUITE(ScExportTest2); @@ -325,6 +326,7 @@ public: CPPUNIT_TEST(testTotalsRowFunction); CPPUNIT_TEST(testAutofilterHiddenButton); CPPUNIT_TEST(testTdf119565); +CPPUNIT_TEST(testTdf152980); CPPUNIT_TEST_SUITE_END(); }; @@ -2969,6 +2971,33 @@ void ScExportTest2::testTdf119565() xShapeProps->getPropertyValue("LineJoint").get()); } +void ScExportTest2::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_TEST_SUITE_REGISTRATION(ScExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); 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 =
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - 2 commits - oox/source sc/qa sc/source sd/qa
oox/source/export/shapes.cxx | 10 ++ sc/qa/uitest/autofilter2/tdf151152.py | 52 ++ sc/source/ui/view/gridwin.cxx | 14 +++-- sd/qa/unit/data/pptx/ole-emf_min.pptx |binary sd/qa/unit/export-tests-ooxml3.cxx| 11 +++ 5 files changed, 84 insertions(+), 3 deletions(-) New commits: commit b3ed83265c1ba0c6d15be0bafd6d16b9a87cc64a Author: Tünde Tóth AuthorDate: Tue Dec 13 11:08:52 2022 +0100 Commit: László Németh CommitDate: Tue Dec 20 07:50:25 2022 + tdf#152436 PPTX export regression: fix lost shape at missing object If the object is missing, it's still possible to keep its shape by exporting its preview graphic, as before the regression. Regression from commit adc042f95d3dbd65b778260025d59283146916e5 "tdf#124333 PPTX import: fix Z-order of embedded OLE objects". Change-Id: Ib2fd00f53a80572cfc9acaefea55015780c57da8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144040 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 907da02bf8b33c080538731864225b3c44251328) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144486 Tested-by: Jenkins diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 70466d17fdb1..4b41f56d79cd 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -2537,6 +2537,16 @@ ShapeExport& ShapeExport::WriteOLE2Shape( const Reference< XShape >& xShape ) if (!xObj.is()) { SAL_WARN("oox.shape", "ShapeExport::WriteOLE2Shape: no object"); + +// tdf#152436 Export the preview graphic of the object if the object is missing. +SdrObject* pSdrOLE2(SdrObject::getSdrObjectFromXShape(xShape)); +if (auto pOle2Obj = dynamic_cast(pSdrOLE2)) +{ +const Graphic* pGraphic = pOle2Obj->GetGraphic(); +if (pGraphic) +WriteGraphicObjectShapePart(xShape, pGraphic); +} + return *this; } diff --git a/sd/qa/unit/data/pptx/ole-emf_min.pptx b/sd/qa/unit/data/pptx/ole-emf_min.pptx new file mode 100644 index ..0f97208fbebc Binary files /dev/null and b/sd/qa/unit/data/pptx/ole-emf_min.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml3.cxx b/sd/qa/unit/export-tests-ooxml3.cxx index 2e6a600ec686..309709317821 100644 --- a/sd/qa/unit/export-tests-ooxml3.cxx +++ b/sd/qa/unit/export-tests-ooxml3.cxx @@ -130,6 +130,7 @@ public: void testTdf124333(); void testAutofittedTextboxIndent(); void testTdf151622_oleIcon(); +void testTdf152436(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest3); @@ -221,6 +222,7 @@ public: CPPUNIT_TEST(testTdf124333); CPPUNIT_TEST(testAutofittedTextboxIndent); CPPUNIT_TEST(testTdf151622_oleIcon); +CPPUNIT_TEST(testTdf152436); CPPUNIT_TEST_SUITE_END(); virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override @@ -2105,6 +2107,15 @@ void SdOOXMLExportTest3::testTdf151622_oleIcon() assertXPath(pXml, "//p:oleObj", "showAsIcon", "1"); } +void SdOOXMLExportTest3::testTdf152436() +{ +createSdImpressDoc("pptx/ole-emf_min.pptx"); +saveAndReload("Impress Office Open XML"); + +// Check number of shapes after export. +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getPage(0)->getCount()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest3); CPPUNIT_PLUGIN_IMPLEMENT(); commit 438192f4947669e6c514bc25ce95d9eba38ce39c Author: Tünde Tóth AuthorDate: Wed Dec 7 13:34:37 2022 +0100 Commit: László Németh CommitDate: Tue Dec 20 07:50:12 2022 + tdf#151152 sc filter: fix string entry checking When a column was filtered for values that included 0, the all string entries were always checked in the Autofilter dropdown (because their conversion to number, i.e. value 0 was used to check their existence in the filtered values instead of their string value). Regression from commit f6b143a57d9bd8f5d7b29febcb4e01ee1eb2ff1d "tdf#142910 sc filter: fix "greater than" or "smaller than" etc". Change-Id: Ib659aba9d6f3d6bc3557547b1a27963f51e3eca3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143777 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 2298087db28ee1b4251cac6e12c1d4806b395a1e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144479 Tested-by: Jenkins diff --git a/sc/qa/uitest/autofilter2/tdf151152.py b/sc/qa/uitest/autofilter2/tdf151152.py new file mode 100644 index ..6971096e9844 --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf151152.py @@ -0,0 +1,52 @@ +# -*- 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