[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sc/qa sc/source
sc/qa/unit/data/xlsx/testShapeDisplacementOnRotationImport.xlsx |binary sc/qa/unit/subsequent_filters-test.cxx | 19 ++ sc/source/filter/oox/drawingfragment.cxx|8 ++-- 3 files changed, 24 insertions(+), 3 deletions(-) New commits: commit 19bbd01b671877812928ba013d4828c213d2f68e Author: Regényi Balázs AuthorDate: Wed Aug 19 15:32:54 2020 +0200 Commit: Gabor Kelemen CommitDate: Wed Oct 14 12:27:22 2020 +0200 tdf#135918 XLSX DrawingML shape import: fix needless displacement Shape was displaced on rotation if it is placed next to the sheets upper/left edges. Co-authored-by: Szabolcs Tóth Change-Id: I987e7b0d863b89cfb5d8154e2f0a017e21248ee1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101001 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 3e85b22769a4b02744a7006d7dc772973c0093f5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104292 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/testShapeDisplacementOnRotationImport.xlsx b/sc/qa/unit/data/xlsx/testShapeDisplacementOnRotationImport.xlsx new file mode 100644 index ..a5fcd1ce2fbd Binary files /dev/null and b/sc/qa/unit/data/xlsx/testShapeDisplacementOnRotationImport.xlsx differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 99840eceaaae..149dbeb2b808 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -253,6 +253,7 @@ public: void testXLSDefColWidth(); void testPreviewMissingObjLink(); void testShapeRotationImport(); +void testShapeDisplacementOnRotationImport(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBooleanFormatXLSX); @@ -396,6 +397,7 @@ public: CPPUNIT_TEST(testXLSDefColWidth); CPPUNIT_TEST(testPreviewMissingObjLink); CPPUNIT_TEST(testShapeRotationImport); +CPPUNIT_TEST(testShapeDisplacementOnRotationImport); CPPUNIT_TEST_SUITE_END(); @@ -4393,6 +4395,23 @@ void ScFiltersTest::testShapeRotationImport() } } +void ScFiltersTest::testShapeDisplacementOnRotationImport() +{ +// tdf#135918 shape is displaced on rotation if it is placed next to the sheets upper/left edges +ScDocShellRef xDocSh = loadDoc("testShapeDisplacementOnRotationImport.", FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to load testShapeDisplacementOnRotationImport.xlsx", xDocSh.is()); + +uno::Reference xDoc(xDocSh->GetModel(), uno::UNO_QUERY_THROW); +uno::Reference xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW); +uno::Reference xShape(xPage->getByIndex(0), uno::UNO_QUERY_THROW); + +uno::Reference xShapeProperties(xShape, uno::UNO_QUERY_THROW); +uno::Any aRectProp = xShapeProperties->getPropertyValue("FrameRect"); +awt::Rectangle aRectangle = aRectProp.get(); +CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aRectangle.X); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aRectangle.Y); +} + ScFiltersTest::ScFiltersTest() : ScBootstrapFixture( "sc/qa/unit/data" ) { diff --git a/sc/source/filter/oox/drawingfragment.cxx b/sc/source/filter/oox/drawingfragment.cxx index 716c46d1f974..3ec32dcd0e42 100644 --- a/sc/source/filter/oox/drawingfragment.cxx +++ b/sc/source/filter/oox/drawingfragment.cxx @@ -294,9 +294,11 @@ void DrawingFragment::onEndElement() } // TODO: DrawingML implementation expects 32-bit coordinates for EMU rectangles (change that to EmuRectangle) +// tdf#135918: Negative X,Y position has to be allowed to avoid shape displacement on rotation. +// The negative values can exist because of previous lines where the anchor rectangle must be mirrored in some ranges. Rectangle aShapeRectEmu32( -getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.X, 0, SAL_MAX_INT32 ), -getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Y, 0, SAL_MAX_INT32 ), +getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.X, SAL_MIN_INT32, SAL_MAX_INT32 ), +getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Y, SAL_MIN_INT32, SAL_MAX_INT32 ), getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Width, 0, SAL_MAX_INT32 ), getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Height, 0, SAL_MAX_INT32 ) ); @@ -313,7 +315,7 @@ void DrawingFragment::onEndElement() /* Collect all shape positions in the WorksheetHelper base class. But first, scale EMUs to 1/100 mm. */ Rectangle aShapeRectHmm( -convertEmuToHmm(aShapeRectEmu32.X ), convertEmuToHmm(aShapeRectEmu32.Y ), +
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf123353.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 21 + sc/source/filter/excel/excrecds.cxx | 12 ++-- sc/source/filter/inc/excrecds.hxx |2 +- 4 files changed, 32 insertions(+), 3 deletions(-) New commits: commit ad9a1c8dc9b7c267126b8d7591812c6db3188fc9 Author: Tibor Nagy AuthorDate: Tue Sep 1 13:55:25 2020 +0200 Commit: Gabor Kelemen CommitDate: Fri Sep 18 10:15:06 2020 +0200 tdf#123353 XLSX export: fix lost AutoFilter on empty cells The AutoFilter button was lost during export when only the rows with empty cells were visible and everything else was hidden. The filter itself was still active, but the button itself was gone. Co-authored-by: Attila Szűcs (NISZ) Change-Id: Ia0b16bf4f15303d1320081cb62090368a0ce3908 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101847 Tested-by: László Németh Reviewed-by: László Németh Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102938 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/tdf123353.xlsx b/sc/qa/unit/data/xlsx/tdf123353.xlsx new file mode 100644 index ..f37f0724ca98 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf123353.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 9fdf9419f515..39c5027cc676 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -238,6 +238,7 @@ public: void testTdf134817_HeaderFooterTextWith2SectionXLSX(); void testHeaderFontStyleXLSX(); void testTdf135828_Shape_Rect(); +void testTdf123353(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -374,6 +375,7 @@ public: CPPUNIT_TEST(testTdf134817_HeaderFooterTextWith2SectionXLSX); CPPUNIT_TEST(testHeaderFontStyleXLSX); CPPUNIT_TEST(testTdf135828_Shape_Rect); +CPPUNIT_TEST(testTdf123353); CPPUNIT_TEST_SUITE_END(); @@ -4716,12 +4718,31 @@ void ScExportTest::testTdf135828_Shape_Rect() std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); xmlDocPtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); + CPPUNIT_ASSERT(pDrawing); assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cx", "294480"); // width assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cy", "1990440"); // height } +void ScExportTest::testTdf123353() +{ +ScDocShellRef xShell = loadDoc("tdf123353.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); + +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); + +xmlDocPtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pDoc); + +assertXPath(pDoc, "/x:worksheet/x:autoFilter/x:filterColumn/x:filters", "blank", "1"); + +xShell->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index 4fbe955d8b52..eb60a71e5040 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -649,9 +649,12 @@ bool XclExpAutofilter::HasCondition() const bool XclExpAutofilter::AddEntry( const ScQueryEntry& rEntry ) { const ScQueryEntry::QueryItemsType& rItems = rEntry.GetQueryItems(); -if (rItems.empty()) -return true; +if (GetOutput() != EXC_OUTPUT_BINARY && rItems.empty()) +{ +meType = BlankValue; +return false; +} if (GetOutput() != EXC_OUTPUT_BINARY && rItems.size() > 1) { AddMultiValueEntry(rEntry); @@ -817,6 +820,11 @@ void XclExpAutofilter::SaveXml( XclExpXmlStream& rStrm ) // XML_extLst, XML_filters, XML_iconFilter, XML_top10 } break; +case BlankValue: +{ +rWorksheet->singleElement(XML_filters, XML_blank, "1"); +} +break; case MultiValue: { rWorksheet->startElement(XML_filters); diff --git a/sc/source/filter/inc/excrecds.hxx b/sc/source/filter/inc/excrecds.hxx index 74a21cbfa563..65cc880f4051 100644 --- a/sc/source/filter/inc/excrecds.hxx +++ b/sc/source/filter/inc/excrecds.hxx @@ -361,7 +361,7 @@ public: class XclExpAutofilter : public XclExpRecord, protected XclExpRoot { private: -enum FilterType { FilterCondition, MultiValue }; +enum FilterType { FilterCondition, MultiValue, BlankValue }; FilterType meType; sal_uInt16 nCol; sal_uInt16 nFlags; ___ Libreoffice-commits mailing list
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf135828_Shape_Rect.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 20 sc/source/filter/xcl97/xcl97rec.cxx| 19 +++ 3 files changed, 39 insertions(+) New commits: commit b5adee6643a21d18a5fd865756017f7786fb79f7 Author: Szabolcs Toth AuthorDate: Mon Aug 17 10:55:43 2020 +0200 Commit: Gabor Kelemen CommitDate: Fri Sep 18 09:52:57 2020 +0200 tdf#135828 XLSX shape export: fix distortion of rotated shapes Shapes that were rotated at angles {[45, 135) U [225, 315)} need new anchor positions that does an extra 90 degrees rotation. See commit 130e6a3f4493b987a7d0b177cc84d65219b47d13 (tdf#83593 XLSX DrawingML shape import: fix missing rotation) Co-authored-by: Balázs Regényi Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100853 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 5e8875780d665b7ae0fee1a053b5ce78ec513f69) Change-Id: I42a5d203cf3b6f6e725d84dd5f39ac323f4f1ceb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102939 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/tdf135828_Shape_Rect.xlsx b/sc/qa/unit/data/xlsx/tdf135828_Shape_Rect.xlsx new file mode 100644 index ..c01c81ab6d74 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf135828_Shape_Rect.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 6769aab25f07..9fdf9419f515 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -237,6 +237,7 @@ public: void testTdf134459_HeaderFooterColorXLSX(); void testTdf134817_HeaderFooterTextWith2SectionXLSX(); void testHeaderFontStyleXLSX(); +void testTdf135828_Shape_Rect(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -372,6 +373,7 @@ public: CPPUNIT_TEST(testTdf134459_HeaderFooterColorXLSX); CPPUNIT_TEST(testTdf134817_HeaderFooterTextWith2SectionXLSX); CPPUNIT_TEST(testHeaderFontStyleXLSX); +CPPUNIT_TEST(testTdf135828_Shape_Rect); CPPUNIT_TEST_SUITE_END(); @@ -4702,6 +4704,24 @@ void ScExportTest::testHeaderFontStyleXLSX() xShell->DoClose(); } +void ScExportTest::testTdf135828_Shape_Rect() +{ +// tdf#135828 Check that the width and the height of rectangle of the shape +// is correct. +ScDocShellRef xShell = loadDoc("tdf135828_Shape_Rect.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); + +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); +xmlDocPtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); +CPPUNIT_ASSERT(pDrawing); + +assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cx", "294480"); // width +assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:spPr/a:xfrm/a:ext", "cy", "1990440"); // height +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 5597b635ecbd..17420fe5c69e 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1026,6 +1026,25 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >& awt::Point aTopLeft= rShape->getPosition(); awt::Size aSize = rShape->getSize(); + +uno::Reference< beans::XPropertySet > xShapeProperties(rShape, uno::UNO_QUERY_THROW); +uno::Any nRotProp = xShapeProperties->getPropertyValue("RotateAngle"); +sal_Int32 nRot = nRotProp.get(); + +if ((nRot >= 45 * 100 && nRot < 135 * 100) || (nRot >= 225 * 100 && nRot < 315 * 100)) +{ +// MSO changes the anchor positions at these angles and that does an extra 90 degrees +// rotation on our shapes, so we output it in such position that MSO +// can draw this shape correctly. + +sal_Int16 nHalfWidth = aSize.Width / 2; +sal_Int16 nHalfHeight = aSize.Height / 2; +aTopLeft.X = aTopLeft.X - nHalfHeight + nHalfWidth; +aTopLeft.Y = aTopLeft.Y - nHalfWidth + nHalfHeight; + +std::swap(aSize.Width, aSize.Height); +} + tools::Rectangle aLocation( aTopLeft.X, aTopLeft.Y, aTopLeft.X + aSize.Width, aTopLeft.Y + aSize.Height ); ScRange aRange = rStrm.GetRoot().GetDoc().GetRange( nTab, aLocation ); tools::Rectangle aRangeRect = rStrm.GetRoot().GetDoc().GetMMRect( aRange.aStart.Col(), aRange.aStart.Row(), ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf134826.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 32 sc/source/filter/oox/pagesettings.cxx |6 -- 3 files changed, 36 insertions(+), 2 deletions(-) New commits: commit 6e9ac1422a9cf042e179049ee97d3d0a69a39c5c Author: Tibor Nagy AuthorDate: Fri Jul 17 13:23:41 2020 +0200 Commit: Gabor Kelemen CommitDate: Fri Jul 31 20:05:24 2020 +0200 tdf#134826 XLSX import: extend localized bold/italic footer/header OOXML formatting code support with Hungarian "félkövér" (semibold) and "dőlt" (italic), similar to German, according to formatting code standard of OOXML 18.3.1.46 headerFooter (Header Footer Settings): "Both font-name and font-type can be localized values." Co-authored-by: Attila Szűcs (NISZ) Change-Id: I95de548fe27d4a6c4e9504dc1f746c8d4419222b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99016 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 055735fa8589670f67e016bc3b7835d4cf81641f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99910 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/tdf134826.xlsx b/sc/qa/unit/data/xlsx/tdf134826.xlsx new file mode 100644 index ..dd86afea2cd5 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf134826.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 71503f9d8ad6..a4d8b3802960 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -234,6 +234,7 @@ public: void testTdf120502(); void testTdf134459_HeaderFooterColorXLSX(); void testTdf134817_HeaderFooterTextWith2SectionXLSX(); +void testHeaderFontStyleXLSX(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -368,6 +369,7 @@ public: CPPUNIT_TEST(testTdf120502); CPPUNIT_TEST(testTdf134459_HeaderFooterColorXLSX); CPPUNIT_TEST(testTdf134817_HeaderFooterTextWith2SectionXLSX); +CPPUNIT_TEST(testHeaderFontStyleXLSX); CPPUNIT_TEST_SUITE_END(); @@ -4668,6 +4670,36 @@ void ScExportTest::testTdf134817_HeaderFooterTextWith2SectionXLSX() xDocSh->DoClose(); } +void ScExportTest::testHeaderFontStyleXLSX() +{ +ScDocShellRef xShell = loadDoc("tdf134826.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); + +ScDocument& rDoc = xShell->GetDocument(); +SfxStyleSheetBase* pStyleSheet = rDoc.GetStyleSheetPool()->Find(rDoc.GetPageStyle(0), SfxStyleFamily::Page); +const SfxItemSet& rItemSet = pStyleSheet->GetItemSet(); +const ScPageHFItem& rHFItem = rItemSet.Get(ATTR_PAGE_HEADERRIGHT); +const EditTextObject* pTextObj = rHFItem.GetLeftArea(); + +std::vector rLst; + +// first line is bold. +pTextObj->GetCharAttribs(0, rLst); +bool bHasBold = std::any_of(rLst.begin(), rLst.end(), [](const EECharAttrib& rAttrib) { +return rAttrib.pAttr->Which() == EE_CHAR_WEIGHT && +static_cast(*rAttrib.pAttr).GetWeight() == WEIGHT_BOLD; }); +CPPUNIT_ASSERT_MESSAGE("First line should be bold.", bHasBold); + +// second line is italic. +pTextObj->GetCharAttribs(1, rLst); +bool bHasItalic = std::any_of(rLst.begin(), rLst.end(), [](const EECharAttrib& rAttrib) { +return rAttrib.pAttr->Which() == EE_CHAR_ITALIC && +static_cast(*rAttrib.pAttr).GetPosture() == ITALIC_NORMAL; }); +CPPUNIT_ASSERT_MESSAGE("Second line should be italic.", bHasItalic); + +xShell->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx index f52d4f638d74..c53f76584918 100644 --- a/sc/source/filter/oox/pagesettings.cxx +++ b/sc/source/filter/oox/pagesettings.cxx @@ -448,7 +448,8 @@ static const sal_Char* const sppcBoldNames[] = "demibold", "halbfett", // German 'demibold' "black", -"heavy" +"heavy", +"f\303\251lk\303\266v\303\251r" // Hungarian 'bold' }; // different names for italic font style (lowercase) @@ -458,7 +459,8 @@ static const sal_Char* const sppcItalicNames[] = "kursiv", // German 'italic' "oblique", "schr\303\204g",// German 'oblique' with uppercase A umlaut -"schr\303\244g" // German 'oblique' with lowercase A umlaut +"schr\303\244g",// German 'oblique' with lowercase A umlaut +"d\305\221lt" // Hungarian 'italic' }; } // namespace ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf134817_HeaderFooterTextWith2Section.xlsx |binary sc/qa/unit/subsequent_export-test.cxx| 20 ++ sc/source/filter/excel/xehelper.cxx |2 - 3 files changed, 21 insertions(+), 1 deletion(-) New commits: commit 5fa0f639b8ab33aefe8f87b7125c7fe637374c55 Author: Attila Szűcs AuthorDate: Fri Jul 17 09:21:45 2020 +0200 Commit: Gabor Kelemen CommitDate: Fri Jul 31 19:42:35 2020 +0200 tdf#134817 XLSX export: fix partially lost header/footer When header/footer text contain text portions with different font setting, only the last text portion was exported. Co-authored-by: Tibor Nagy (NISZ) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98938 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit ba4bc66301e0cb30379f19b9c19e320a533daa42) Change-Id: Id4cba2b9188459cdaa0ade30c2217d8f59fe6316 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99849 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/tdf134817_HeaderFooterTextWith2Section.xlsx b/sc/qa/unit/data/xlsx/tdf134817_HeaderFooterTextWith2Section.xlsx new file mode 100644 index ..224ac8d18429 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf134817_HeaderFooterTextWith2Section.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 1d0a3c83ee54..71503f9d8ad6 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -233,6 +233,7 @@ public: void testTdf128976(); void testTdf120502(); void testTdf134459_HeaderFooterColorXLSX(); +void testTdf134817_HeaderFooterTextWith2SectionXLSX(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -366,6 +367,7 @@ public: CPPUNIT_TEST(testTdf128976); CPPUNIT_TEST(testTdf120502); CPPUNIT_TEST(testTdf134459_HeaderFooterColorXLSX); +CPPUNIT_TEST(testTdf134817_HeaderFooterTextWith2SectionXLSX); CPPUNIT_TEST_SUITE_END(); @@ -4648,6 +4650,24 @@ void ScExportTest::testTdf134459_HeaderFooterColorXLSX() xDocSh->DoClose(); } +void ScExportTest::testTdf134817_HeaderFooterTextWith2SectionXLSX() +{ +// Header/footer text with multiple selection should be exported, and imported properly +ScDocShellRef xShell = loadDoc("tdf134817_HeaderFooterTextWith2Section.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); + +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); +CPPUNIT_ASSERT(pDoc); + +assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddHeader", "&\"Abadi,Regular\"&11aaa&\"Bembo,Regular\"&20bbb"); +assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter", "&\"Cambria,Regular\"&14camb&\"Dante,Regular\"&18dant"); + +xDocSh->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index 4e0cdc58f275..61eb0ec3d776 100644 --- a/sc/source/filter/excel/xehelper.cxx +++ b/sc/source/filter/excel/xehelper.cxx @@ -739,7 +739,7 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico (aFontData.mbItalic != aNewData.mbItalic); if( bNewFont || (bNewStyle && pFontList) ) { -aParaText = "&\"" + aNewData.maName; +aParaText.append("&\"").append(aNewData.maName); if( pFontList ) { FontMetric aFontMetric( pFontList->Get( ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf134459_HeaderFooterColor.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 20 ++ sc/source/filter/excel/xehelper.cxx |7 ++ 3 files changed, 27 insertions(+) New commits: commit a8856d9b32c23151c7031282ba87dcdda4bbad89 Author: Attila Szűcs AuthorDate: Thu Jul 16 09:34:31 2020 +0200 Commit: Gabor Kelemen CommitDate: Fri Jul 31 19:22:46 2020 +0200 tdf#134459 XLSX export: fix missing font color in header/footer Co-authored-by: Tibor Nagy (NISZ) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98873 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 2abaaf97e95bf6149378c6cd5e58cdb2ce78dc4b) Change-Id: I7aacbad1c4052b2480630d0b98175b46cf2aeed0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99839 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/tdf134459_HeaderFooterColor.xlsx b/sc/qa/unit/data/xlsx/tdf134459_HeaderFooterColor.xlsx new file mode 100644 index ..fe799886c062 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf134459_HeaderFooterColor.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index e220803967cb..1d0a3c83ee54 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -232,6 +232,7 @@ public: void testRotatedImageODS(); void testTdf128976(); void testTdf120502(); +void testTdf134459_HeaderFooterColorXLSX(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -364,6 +365,7 @@ public: CPPUNIT_TEST(testRotatedImageODS); CPPUNIT_TEST(testTdf128976); CPPUNIT_TEST(testTdf120502); +CPPUNIT_TEST(testTdf134459_HeaderFooterColorXLSX); CPPUNIT_TEST_SUITE_END(); @@ -4628,6 +4630,24 @@ void ScExportTest::testTdf120502() assertXPath(pSheet1, "/x:worksheet/x:cols/x:col", "max", OUString::number(nMaxCol + 1)); } +void ScExportTest::testTdf134459_HeaderFooterColorXLSX() +{ +// Colors in header and footer should be exported, and imported properly +ScDocShellRef xShell = loadDoc("tdf134459_HeaderFooterColor.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); + +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); +CPPUNIT_ASSERT(pDoc); + +assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddHeader", ""); +assertXPathContent(pDoc, "/x:worksheet/x:headerFooter/x:oddFooter", ""); + +xDocSh->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index e75958935d69..4e0cdc58f275 100644 --- a/sc/source/filter/excel/xehelper.cxx +++ b/sc/source/filter/excel/xehelper.cxx @@ -780,6 +780,13 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico (nTmpUnderl == EXC_FONTUNDERL_SINGLE)? aParaText.append("") : aParaText.append(""); } +// font color +aNewData.maColor = aFont.GetColor(); +if ( !aFontData.maColor.IsRGBEqual( aNewData.maColor ) ) +{ + aParaText.append("").append(aNewData.maColor.AsRGBHexString()); +} + // strikeout aNewData.mbStrikeout = (aFont.GetStrikeout() != STRIKEOUT_NONE); if( aFontData.mbStrikeout != aNewData.mbStrikeout ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sc/qa sc/source
sc/qa/unit/data/xlsx/testShapeRotationImport.xlsx |binary sc/qa/unit/subsequent_filters-test.cxx| 49 ++ sc/source/filter/oox/drawingfragment.cxx | 37 ++-- 3 files changed, 82 insertions(+), 4 deletions(-) New commits: commit 5c62bdca7246d3ee64fa1380c2bdc30d4c8c8481 Author: Szabolcs Toth AuthorDate: Thu May 21 09:06:08 2020 +0200 Commit: Gabor Kelemen CommitDate: Fri Jun 12 10:26:22 2020 +0200 tdf#83593 XLSX DrawingML shape import: fix missing rotation caused by broken import of xdr:twoCellAnchor. Co-authored-by: Balázs Regényi Change-Id: I3f382c3c9b2428e825a3e6d954c65356942f9158 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94611 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 130e6a3f4493b987a7d0b177cc84d65219b47d13) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96136 Reviewed-by: Szabolcs Toth Reviewed-by: Gabor Kelemen Tested-by: Gabor Kelemen diff --git a/sc/qa/unit/data/xlsx/testShapeRotationImport.xlsx b/sc/qa/unit/data/xlsx/testShapeRotationImport.xlsx new file mode 100644 index ..125a3ccaabd0 Binary files /dev/null and b/sc/qa/unit/data/xlsx/testShapeRotationImport.xlsx differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index e005b258d979..99840eceaaae 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -77,6 +77,7 @@ #include "helper/qahelper.hxx" #include "helper/shared_test_impl.hxx" +#include namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } } @@ -251,6 +252,7 @@ public: void testAutoheight2Rows(); void testXLSDefColWidth(); void testPreviewMissingObjLink(); +void testShapeRotationImport(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBooleanFormatXLSX); @@ -393,6 +395,7 @@ public: CPPUNIT_TEST(testAutoheight2Rows); CPPUNIT_TEST(testXLSDefColWidth); CPPUNIT_TEST(testPreviewMissingObjLink); +CPPUNIT_TEST(testShapeRotationImport); CPPUNIT_TEST_SUITE_END(); @@ -4344,6 +4347,52 @@ void ScFiltersTest::testPreviewMissingObjLink() xDocSh->DoClose(); } +void ScFiltersTest::testShapeRotationImport() +{ +// tdf#83593 Incorrectly calculated bounding rectangles caused shapes to appear as if there +// were extra or missing rotations. Hence, we check the sizes of these rectangles. +ScDocShellRef xDocSh = loadDoc("testShapeRotationImport.", FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to load testShapeRotationImport.xlsx", xDocSh.is()); +uno::Reference< drawing::XDrawPagesSupplier > xDoc(xDocSh->GetModel(), uno::UNO_QUERY_THROW); +uno::Reference< drawing::XDrawPage > xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW); + +// The expected values are in the map below. Note that some of the angles are outside of the set which contains +// the value of the wrong angles. This is to check the border cases and one value on both sides. +std::map> aExpectedValues +{ +{ 4400, { { "x", 6832 }, { "y", 36893 }, { "width", 8898 }, { "height", 1163 } } }, +{ 4500, { { "x", 4490 }, { "y", 36400 }, { "width", 8898 }, { "height", 1163 } } }, +{ 4600, { { "x", 1673 }, { "y", 36270 }, { "width", 8862 }, { "height", 1144 } } }, +{ 13400, { { "x", 13762 }, { "y", 28403 }, { "width", 8863 }, { "height", 1194 } } }, +{ 13500, { { "x", 10817 }, { "y", 27951 }, { "width", 8863 }, { "height", 1170 } } }, +{ 13600, { { "x", 8449 }, { "y", 28336 }, { "width", 8897 }, { "height", 1164 } } }, +{ 22400, { { "x", 14948 }, { "y", 12978 }, { "width", 8898 }, { "height", 1164 } } }, +{ 22500, { { "x", 11765 }, { "y", 12834 }, { "width", 8898 }, { "height", 1164 } } }, +{ 22600, { { "x", 8253 }, { "y", 12919 }, { "width", 8863 }, { "height", 1171 } } }, +{ 31400, { { "x", 8099 }, { "y", 1160 }, { "width", 9815 }, { "height", 1171 } } }, +{ 31500, { { "x", 4427 }, { "y", 1274 }, { "width", 10238 }, { "height", 1171 } } }, +{ 31600, { { "x", 1964 }, { "y", 1878 }, { "width", 10307 }, { "height", 1164 } } }, +}; + +for (sal_Int32 ind = 0; ind < 12; ++ind) +{ +uno::Reference< drawing::XShape > xShape(xPage->getByIndex(ind), uno::UNO_QUERY_THROW); + +uno::Reference< beans::XPropertySet > xShapeProperties(xShape, uno::UNO_QUERY); +uno::Any nRotProp = xShapeProperties->getPropertyValue("RotateAngle"); +sal_Int32 nRot = nRotProp.get(); + +awt::Point aPosition = xShape->getPosition(); +awt::Size aSize = xShape->getSize(); + +CPPUNIT_ASSERT(aExpectedValues.find(nRot) != aExpectedValues.end()); +CPPUNIT_ASSERT_EQUAL(aExpectedValues[nRot]["x"], aPosition.X); +