[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/source sd/qa
oox/source/drawingml/textcharacterproperties.cxx |8 +++- sd/qa/unit/data/pptx/tdf151547-transparent-white-text.pptx |binary sd/qa/unit/import-tests2.cxx | 23 + 3 files changed, 30 insertions(+), 1 deletion(-) New commits: commit d4c5a887b107636dc1e5b854ca02391c4e8d0c46 Author: Sarper Akdemir AuthorDate: Mon Oct 17 09:06:20 2022 +0300 Commit: Miklos Vajna CommitDate: Wed Oct 26 11:30:33 2022 +0200 tdf#151547 pptx import: workaround for COL_AUTO collision In the current implementation of ::Color, it is not possible to have fully transparent white text (since it collides with COL_AUTO and gets interpreted as Automatic Color). Implement a workaround for import of fully transparent white text color so that it isn't interpreted as the magic value COL_AUTO (i.e. instead of fully transparent #FF import as fully transparent #FE). Change-Id: Ide750093ef8a89f1424ddd8f4e9ee1e18209f2ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141439 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit adfdd2bee4d1d59bf1ee372d9c242cf0b691e423) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141779 Reviewed-by: Andras Timar diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index be2409f5795c..1ed3e7499f0c 100644 --- a/oox/source/drawingml/textcharacterproperties.cxx +++ b/oox/source/drawingml/textcharacterproperties.cxx @@ -136,7 +136,13 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil if (aColor.hasTransparency()) { -rPropMap.setProperty(PROP_CharTransparence, aColor.getTransparency()); +const auto nTransparency = aColor.getTransparency(); +rPropMap.setProperty(PROP_CharTransparence, nTransparency); + +// WORKAROUND: Fully transparent white has the same value as COL_AUTO, avoid collision +if (nTransparency == 100 +&& aColor.getColor(rFilter.getGraphicHelper()).GetRGBColor() == COL_AUTO.GetRGBColor()) +rPropMap.setProperty(PROP_CharColor, ::Color(ColorTransparency, 0xFFFE)); } } diff --git a/sd/qa/unit/data/pptx/tdf151547-transparent-white-text.pptx b/sd/qa/unit/data/pptx/tdf151547-transparent-white-text.pptx new file mode 100644 index ..1bb723c2afe0 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf151547-transparent-white-text.pptx differ diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index 142599fa945d..e0e9d8d44b80 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -175,6 +175,7 @@ public: void testTdf112209(); void testDefaultTabStop(); void testCropToZero(); +void testTdf151547TransparentWhiteText(); CPPUNIT_TEST_SUITE(SdImportTest2); @@ -242,6 +243,7 @@ public: CPPUNIT_TEST(testTdf112209); CPPUNIT_TEST(testDefaultTabStop); CPPUNIT_TEST(testCropToZero); +CPPUNIT_TEST(testTdf151547TransparentWhiteText); CPPUNIT_TEST_SUITE_END(); }; @@ -2000,6 +2002,27 @@ void SdImportTest2::testCropToZero() loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/croppedTo0.pptx"), PPTX); } +void SdImportTest2::testTdf151547TransparentWhiteText() +{ +sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf151547-transparent-white-text.pptx"), +PPTX); + +uno::Reference xShape(getShapeFromPage(0, 0, xDocShRef)); +uno::Reference xParagraph(getParagraphFromShape(0, xShape)); +uno::Reference xRun(getRunFromParagraph(0, xParagraph)); +uno::Reference xPropSet(xRun, uno::UNO_QUERY_THROW); + +Color nCharColor; +xPropSet->getPropertyValue("CharColor") >>= nCharColor; +// Without the accompanying fix in place, this test would have failed with: +// - Expected: Color: R:255 G:255 B:254 A:255 +// - Actual : Color: R:255 G:255 B:255 A:255 +// i.e. fully transparent white text color was interpreted as COL_AUTO +CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0xFFFE), nCharColor); +xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest2); CPPUNIT_PLUGIN_IMPLEMENT();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/source sd/qa
oox/source/drawingml/textparagraphproperties.cxx |3 ++- sd/qa/unit/data/pptx/tdf147586.pptx |binary sd/qa/unit/export-tests-ooxml3.cxx | 22 ++ 3 files changed, 24 insertions(+), 1 deletion(-) New commits: commit 74a42203fc1f90726cf1219139df5c00e6978914 Author: Xisco Fauli AuthorDate: Tue Apr 26 00:00:18 2022 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Tue Apr 26 17:42:48 2022 +0200 tdf#147586: Initialize mbBulletColorFollowText to false Otherwise, once it's set to true, it's never reset Change-Id: Ie8a752da4162775f40c2f84f480e6a103eb55942 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133422 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit a0bae88a9cd47185a71cbfd4c86bbd86ae44d30e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133404 Reviewed-by: Adolfo Jayme Barrientos diff --git a/oox/source/drawingml/textparagraphproperties.cxx b/oox/source/drawingml/textparagraphproperties.cxx index 70f1ac0c937b..07624e83d1fa 100644 --- a/oox/source/drawingml/textparagraphproperties.cxx +++ b/oox/source/drawingml/textparagraphproperties.cxx @@ -57,7 +57,8 @@ using ::com::sun::star::awt::FontDescriptor; namespace oox::drawingml { BulletList::BulletList( ) -: maBulletColorPtr( std::make_shared() ) +: maBulletColorPtr( std::make_shared() ), + mbBulletColorFollowText ( false ) { } diff --git a/sd/qa/unit/data/pptx/tdf147586.pptx b/sd/qa/unit/data/pptx/tdf147586.pptx new file mode 100644 index ..723facf82071 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf147586.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml3.cxx b/sd/qa/unit/export-tests-ooxml3.cxx index 96642cdc73ec..84366e1be9f3 100644 --- a/sd/qa/unit/export-tests-ooxml3.cxx +++ b/sd/qa/unit/export-tests-ooxml3.cxx @@ -55,6 +55,7 @@ class SdOOXMLExportTest3 : public SdModelTestBaseXML public: void testTdf129430(); void testTdf114848(); +void testTdf147586(); void testTdf68759(); void testTdf127901(); void testTdf48735(); @@ -135,6 +136,7 @@ public: CPPUNIT_TEST(testTdf129430); CPPUNIT_TEST(testTdf114848); +CPPUNIT_TEST(testTdf147586); CPPUNIT_TEST(testTdf68759); CPPUNIT_TEST(testTdf127901); CPPUNIT_TEST(testTdf48735); @@ -246,6 +248,26 @@ void SdOOXMLExportTest3::testTdf114848() "1f497d"); } +void SdOOXMLExportTest3::testTdf147586() +{ +::sd::DrawDocShellRef xDocShRef += loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf147586.pptx"), PPTX); +utl::TempFile tempFile; +xDocShRef = saveAndReload(xDocShRef.get(), PPTX, ); +xDocShRef->DoClose(); + +xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); +// Without the fix in place, this test would have failed with +// - Expected: 227fc7 +// - Actual : 4f4f4f +assertXPath(pXmlDocContent, + "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:p[1]/a:pPr/a:buClr/a:srgbClr", "val", +"227fc7"); +assertXPath(pXmlDocContent, + "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:p[2]/a:pPr/a:buClr/a:srgbClr", "val", +"227fc7"); +} + void SdOOXMLExportTest3::testTdf68759() { ::sd::DrawDocShellRef xDocShRef
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/source sd/qa
oox/source/drawingml/textcharacterproperties.cxx |6 +++ sd/qa/unit/data/pptx/tdf148685.pptx |binary sd/qa/unit/import-tests2.cxx | 43 +++ 3 files changed, 49 insertions(+) New commits: commit 696677a36182062dfa3d157130904a6cf9fc73b1 Author: Xisco Fauli AuthorDate: Wed Apr 20 17:58:15 2022 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Sat Apr 23 13:02:35 2022 +0200 tdf#148685: Unset CharUnderlineColor and CharUnderlineHasColor properties Change-Id: Iebf482434cd393f55ae3e4690580b573624d78b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133219 Tested-by: Xisco Fauli Reviewed-by: Xisco Fauli (cherry picked from commit 1c924efe1f80207a5e104d755615b1eb9a91d418) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133282 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index 7ffeaeba8da2..be2409f5795c 100644 --- a/oox/source/drawingml/textcharacterproperties.cxx +++ b/oox/source/drawingml/textcharacterproperties.cxx @@ -195,6 +195,12 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil rPropMap.setProperty( PROP_CharUnderlineHasColor, true); rPropMap.setProperty( PROP_CharUnderlineColor, maUnderlineColor.getColor( rFilter.getGraphicHelper() )); } +else +{ +rPropMap.setProperty( PROP_CharUnderlineHasColor, false); +rPropMap.setProperty( PROP_CharUnderlineColor, sal_Int32(-1)); +} + // TODO If bUnderlineFillFollowText uFillTx (CT_TextUnderlineFillFollowText) is set, fill color of the underline should be the same color as the text if (maHighlightColor.isUsed() && maHighlightColor.getTransparency() != 100) diff --git a/sd/qa/unit/data/pptx/tdf148685.pptx b/sd/qa/unit/data/pptx/tdf148685.pptx new file mode 100644 index ..80af5a9bbf46 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf148685.pptx differ diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index 3ecbec200c6e..ee0d110df24d 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -116,6 +116,7 @@ public: void testAoo124143(); void testTdf103567(); void testTdf103792(); +void testTdf148685(); void testTdf103876(); void testTdf79007(); void testTdf118776(); @@ -184,6 +185,7 @@ public: CPPUNIT_TEST(testAoo124143); CPPUNIT_TEST(testTdf103567); CPPUNIT_TEST(testTdf103792); +CPPUNIT_TEST(testTdf148685); CPPUNIT_TEST(testTdf103876); CPPUNIT_TEST(testTdf79007); CPPUNIT_TEST(testTdf118776); @@ -476,6 +478,47 @@ void SdImportTest2::testTdf103792() xDocShRef->DoClose(); } +void SdImportTest2::testTdf148685() +{ +sd::DrawDocShellRef xDocShRef += loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf148685.pptx"), PPTX); +uno::Reference xShape(getShapeFromPage(1, 0, xDocShRef)); + +uno::Reference const xParagraph(getParagraphFromShape(0, xShape)); + +uno::Reference xRun(getRunFromParagraph(0, xParagraph)); +CPPUNIT_ASSERT_EQUAL(OUString("TEXT "), xRun->getString()); + +uno::Reference xPropSet(xRun, uno::UNO_QUERY_THROW); + +Color nCharUnderlineColor; +xPropSet->getPropertyValue("CharUnderlineColor") >>= nCharUnderlineColor; +CPPUNIT_ASSERT_EQUAL(Color(0xA1467E), nCharUnderlineColor); + +xRun.set(getRunFromParagraph(1, xParagraph)); + +CPPUNIT_ASSERT_EQUAL(OUString("TE"), xRun->getString()); + +xPropSet.set(xRun, uno::UNO_QUERY_THROW); + +xPropSet->getPropertyValue("CharUnderlineColor") >>= nCharUnderlineColor; + +// Without the fix in place, this test would have failed with +// - Expected: Color: R:255 G:255 B:255 A:255 +// - Actual : Color: R:161 G:70 B:126 A:0 +CPPUNIT_ASSERT_EQUAL(COL_AUTO, nCharUnderlineColor); + +xRun.set(getRunFromParagraph(2, xParagraph)); +CPPUNIT_ASSERT_EQUAL(OUString("XT"), xRun->getString()); + +xPropSet.set(xRun, uno::UNO_QUERY_THROW); + +xPropSet->getPropertyValue("CharUnderlineColor") >>= nCharUnderlineColor; +CPPUNIT_ASSERT_EQUAL(COL_AUTO, nCharUnderlineColor); + +xDocShRef->DoClose(); +} + void SdImportTest2::testTdf103876() { // Title text shape's placeholder text did not inherit the corresponding text properties
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/source sd/qa
oox/source/export/shapes.cxx |6 +-- sd/qa/unit/data/odp/tdf109169_Diamond.odp |binary sd/qa/unit/data/odp/tdf109169_Octagon.odp |binary sd/qa/unit/export-tests-ooxml3.cxx| 46 ++ 4 files changed, 49 insertions(+), 3 deletions(-) New commits: commit b51e9f32410d346a9b5cba1bf3e6a485e17f119d Author: Regina Henschel AuthorDate: Fri Apr 15 15:04:16 2022 +0200 Commit: Xisco Fauli CommitDate: Mon Apr 18 13:28:09 2022 +0200 tdf#109169 use custGeom for Octagon Bevel shape The shapes 'Octagon Bevel', type col_60da8460, and 'Diamond Bevel', type col-502ad400, are LO specific preset shapes. They have neither a counterpart in MS binary nor in OOXML. So they need to be exported with custGeom. To force custGeom these shape types are moved from vDenylist to vAllowlist. These shapes were exported as prst='rect' before. Change-Id: I9619345812b6dba8f14ec2cc6a92ae808a56b595 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133069 Tested-by: Jenkins Reviewed-by: Regina Henschel Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133113 diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 97d09ca1be2e..5f0f04bf6bda 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -551,8 +551,6 @@ static bool lcl_IsOnDenylist(OUString const & rShapeType) u"flower", u"bracket-pair", u"brace-pair", -u"col-60da8460", -u"col-502ad400", u"quad-bevel", u"round-rectangular-callout", u"rectangular-callout", @@ -605,7 +603,9 @@ static bool lcl_IsOnAllowlist(OUString const & rShapeType) { static const std::initializer_list vAllowlist = { u"heart", -u"puzzle" +u"puzzle", +u"col-60da8460", +u"col-502ad400" }; return std::find(vAllowlist.begin(), vAllowlist.end(), rShapeType) != vAllowlist.end(); diff --git a/sd/qa/unit/data/odp/tdf109169_Diamond.odp b/sd/qa/unit/data/odp/tdf109169_Diamond.odp new file mode 100644 index ..cd6a18d1b318 Binary files /dev/null and b/sd/qa/unit/data/odp/tdf109169_Diamond.odp differ diff --git a/sd/qa/unit/data/odp/tdf109169_Octagon.odp b/sd/qa/unit/data/odp/tdf109169_Octagon.odp new file mode 100644 index ..f35e746f3b28 Binary files /dev/null and b/sd/qa/unit/data/odp/tdf109169_Octagon.odp differ diff --git a/sd/qa/unit/export-tests-ooxml3.cxx b/sd/qa/unit/export-tests-ooxml3.cxx index 40031977345d..96642cdc73ec 100644 --- a/sd/qa/unit/export-tests-ooxml3.cxx +++ b/sd/qa/unit/export-tests-ooxml3.cxx @@ -11,6 +11,7 @@ #include "sdmodeltestbase.hxx" #include #include +#include #include #include #include @@ -34,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -126,6 +128,8 @@ public: void testTdf147121(); void testTdf140912_PicturePlaceholder(); void testEnhancedPathViewBox(); +void testTdf109169_OctagonBevel(); +void testTdf109169_DiamondBevel(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest3); @@ -202,6 +206,8 @@ public: CPPUNIT_TEST(testTdf147121); CPPUNIT_TEST(testTdf140912_PicturePlaceholder); CPPUNIT_TEST(testEnhancedPathViewBox); +CPPUNIT_TEST(testTdf109169_OctagonBevel); +CPPUNIT_TEST(testTdf109169_DiamondBevel); CPPUNIT_TEST_SUITE_END(); virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override @@ -1912,6 +1918,46 @@ void SdOOXMLExportTest3::testEnhancedPathViewBox() CPPUNIT_ASSERT_EQUAL(sal_Int32(2045), aBoundRectangle.Width); } +void SdOOXMLExportTest3::testTdf109169_OctagonBevel() +{ +// The document has a shape 'Octagon Bevel'. It consists of an octagon with 8 points and eight +// facets with 4 points each, total 8+8*4=40 points. Without the patch it was exported as +// rectangle and thus had 4 points. +::sd::DrawDocShellRef xDocShRef += loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf109169_Octagon.odp"), ODP); +xDocShRef = saveAndReload(xDocShRef.get(), PPTX); + +auto xPropSet(getShapeFromPage(0, 0, xDocShRef)); +auto aGeomPropSeq = xPropSet->getPropertyValue("CustomShapeGeometry") +.get>(); +comphelper::SequenceAsHashMap aCustomShapeGeometry(aGeomPropSeq); +auto aPathSeq((aCustomShapeGeometry["Path"]).get>()); +comphelper::SequenceAsHashMap aPath(aPathSeq); +auto aCoordinates( + (aPath["Coordinates"]).get>()); +CPPUNIT_ASSERT_EQUAL(sal_Int32(40), aCoordinates.getLength()); +} + +void SdOOXMLExportTest3::testTdf109169_DiamondBevel() +{ +// The document has a shape 'Diamond Bevel'. It consists of a diamond with 4 points and four +// facets with 4 points each, total 4+4*4=20 points. Without the patch it was exported as +// rectangle and thus had 4 points. +::sd::DrawDocShellRef
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/source sd/qa
oox/source/drawingml/table/tablecell.cxx | 10 +- oox/source/export/shapes.cxx |6 ++ sd/qa/unit/export-tests.cxx |3 ++- sd/qa/unit/import-tests.cxx |2 +- 4 files changed, 10 insertions(+), 11 deletions(-) New commits: commit 6bf805ffb62a13f2f44a26f47f732f05c954ef49 Author: Gülşah Köse AuthorDate: Mon Mar 14 14:52:59 2022 +0300 Commit: Gülşah Köse CommitDate: Wed Apr 13 08:26:30 2022 +0200 tdf#147766 Export empty lines as line with noFill We have a case that 0 width line but has auto color. If that case exported there is no line over there, LO handles normally but MSO draws back borders as default. To prevent this we have to export them as line with noFill. testTableBorderLineStyle change reverts a workaround for 3faf005a367cbd28077403bf93810bbaf4805851 testBnc480256 Cell(1,0) still invisible. We are just checking this with another way. Change-Id: If5f6d2dbdba5c295d58307fcfe3b37629ede8a8e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131532 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Gülşah Köse Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132886 diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx index 15ab06303e3b..fdf7950dcf2c 100644 --- a/oox/source/drawingml/table/tablecell.cxx +++ b/oox/source/drawingml/table/tablecell.cxx @@ -73,20 +73,12 @@ static void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase, aBorderLine.LineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 2 ); aBorderLine.LineDistance = 0; } -else if ( rLineProperties.moLineWidth.get(0)!=0 ) -{ -aBorderLine.Color = sal_Int32( COL_AUTO ); -aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 ); -aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 ); -aBorderLine.LineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 2 ); -aBorderLine.LineDistance = 0; -} else { aBorderLine.Color = sal_Int32( COL_AUTO ); aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 ); aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 ); -aBorderLine.LineWidth = 12700; +aBorderLine.LineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 2 ); aBorderLine.LineDistance = 0; } diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 138106938ee2..97d09ca1be2e 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -1975,6 +1975,12 @@ void ShapeExport::WriteBorderLine(const sal_Int32 XML_line, const BorderLine2& r DrawingML::WriteSolidFill( ::Color(ColorTransparency, rBorderLine.Color) ); mpFS->endElementNS( XML_a, XML_line ); } +else if( nBorderWidth == 0) +{ +mpFS->startElementNS(XML_a, XML_line); +mpFS->singleElementNS(XML_a, XML_noFill); +mpFS->endElementNS( XML_a, XML_line ); +} } void ShapeExport::WriteTableCellBorders(const Reference< XPropertySet>& xCellPropSet) diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index f1d0281aab0d..729d9f154b12 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -602,9 +602,10 @@ void SdExportTest::testBnc480256() xCell->getPropertyValue("FillColor") >>= nColor; CPPUNIT_ASSERT_EQUAL(Color(0x4697e0), nColor); +// This border should be invisible. xCell.set(xTable->getCellByPosition(1, 0), uno::UNO_QUERY_THROW); xCell->getPropertyValue("BottomBorder") >>= aBorderLine; -CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, aBorderLine.Color)); +CPPUNIT_ASSERT_EQUAL(sal_Int32(0), sal_Int32(aBorderLine.LineWidth)); xDocShRef->DoClose(); } diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index c7b508de5dc3..e49892d3a738 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -1474,7 +1474,7 @@ void SdImportTest::testTableBorderLineStyle() xTable.set(pTableObj->getTable(), uno::UNO_QUERY_THROW); xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW); xCell->getPropertyValue("TopBorder") >>= aBorderLine; -if (aBorderLine.Color != -1) { +if (aBorderLine.LineWidth > 0) { CPPUNIT_ASSERT_EQUAL(nObjBorderLineStyles[i], aBorderLine.LineStyle); } }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/source sd/qa
oox/source/export/drawingml.cxx |4 ++-- sd/qa/unit/data/odp/tdf53970_linked.odp |binary sd/qa/unit/export-tests-ooxml2.cxx | 27 +-- 3 files changed, 23 insertions(+), 8 deletions(-) New commits: commit 85adc43540f75f2e3ce51fb438e5efd777a5b8f7 Author: Tünde Tóth AuthorDate: Thu Mar 31 13:11:04 2022 +0200 Commit: Xisco Fauli CommitDate: Mon Apr 4 17:05:04 2022 +0200 tdf#53970 PPTX: fix broken export of linked media files Missing TargetMode="External" in the export of linked media files resulted corrupted PPTX. Change-Id: I76246db331d199810a5b413d44bec95283e88e47 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132402 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit c2e8a96a8107a37901e475c65a8e61211fc3b132) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132383 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 4d0317be921d..d4dbef899b96 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1378,8 +1378,8 @@ void DrawingML::WriteMediaNonVisualProperties(const css::uno::ReferenceaddRelation(mpFS->getOutputStream(), oox::getRelationship(eMediaType), rURL); -aMediaRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(Relationship::MEDIA), rURL); +aVideoFileRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(eMediaType), rURL, true); +aMediaRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(Relationship::MEDIA), rURL, true); } GetFS()->startElementNS(XML_p, XML_nvPr); diff --git a/sd/qa/unit/data/odp/tdf53970_linked.odp b/sd/qa/unit/data/odp/tdf53970_linked.odp new file mode 100644 index ..3ddb7933463f Binary files /dev/null and b/sd/qa/unit/data/odp/tdf53970_linked.odp differ diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 6afe97292ea8..dc6498ec614d 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -1814,15 +1814,30 @@ void SdOOXMLExportTest2::testTdf59323_slideFooters() void SdOOXMLExportTest2::testTdf53970() { -::sd::DrawDocShellRef xDocShRef -= loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970.odp"), ODP); -xDocShRef = saveAndReload(xDocShRef.get(), PPTX); +// Embedded media file +{ +::sd::DrawDocShellRef xDocShRef += loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970.odp"), ODP); +xDocShRef = saveAndReload(xDocShRef.get(), PPTX); +// Without fix in place, the media shape was lost on export. +CPPUNIT_ASSERT(getPage(0, xDocShRef)->hasElements()); -// Without fix in place, the media shape was lost on export. -CPPUNIT_ASSERT(getPage(0, xDocShRef)->hasElements()); +xDocShRef->DoClose(); +} -xDocShRef->DoClose(); +// Linked media file +{ +::sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970_linked.odp"), ODP); +utl::TempFile tempFile; +xDocShRef = saveAndReload(xDocShRef.get(), PPTX, ); +xDocShRef->DoClose(); + +xmlDocUniquePtr pXmlRels = parseExport(tempFile, "ppt/slides/_rels/slide1.xml.rels"); +CPPUNIT_ASSERT(pXmlRels); +assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@TargetMode='External']", 2); +} } CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/source sd/qa
oox/source/export/drawingml.cxx |5 + oox/source/export/shapes.cxx |1 + sd/qa/unit/data/odp/tdf53970.odp |binary 3 files changed, 6 insertions(+) New commits: commit b64c55169d72bfde6aee00673a56d5c25acfd4d4 Author: Tünde Tóth AuthorDate: Thu Mar 24 16:54:01 2022 +0100 Commit: Xisco Fauli CommitDate: Wed Mar 30 20:47:06 2022 +0200 tdf#53970 PPTX: fix export of embedded media files Embedded media files lost in documents created with Impress after PPTX export. Change-Id: I453b58f9cfa6a33653e9216fb82b66970a9ec31b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132095 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132319 diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 708aea6fb29a..4d0317be921d 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1343,6 +1343,11 @@ void DrawingML::WriteMediaNonVisualProperties(const css::uno::Reference
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/source sd/qa
oox/source/export/drawingml.cxx | 15 ++- sd/qa/unit/data/pptx/tdf147121.pptx |binary sd/qa/unit/export-tests-ooxml3.cxx | 32 3 files changed, 46 insertions(+), 1 deletion(-) New commits: commit 2c06fba68d3cd194edfddf49cd2779c761b6bd38 Author: Attila Bakos (NISZ) AuthorDate: Wed Feb 16 16:09:00 2022 +0100 Commit: Xisco Fauli CommitDate: Mon Mar 7 10:55:42 2022 +0100 tdf#147121 PPTX: fix regression of font size export of empty lines If the empty line has got direct formatted font size, don't forget to export it, unless the master setting is applied. Regression from commit b6b02e0b4c9d739836e1f61a886ea45b01e6696e "tdf#111903 tdf#137152 PPTX export: fix placeholders". Change-Id: If686e487bca9c198fd7c96860a21e4efe91381bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130005 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit f29c14e8c36819296d0c66bb995201acf0a2647e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130675 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 69f210cfe325..c457e65ac0c8 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2450,6 +2450,10 @@ void DrawingML::WriteRun( const Reference< XTextRange >& rRun, if (GetProperty(rXPropSet, "NumberingIsNumber")) mAny >>= bNumberingIsNumber; +float nFontSize = -1; +if (GetProperty(rXPropSet, "CharHeight")) +mAny >>= nFontSize; + bool bIsURLField = false; OUString sFieldValue = GetFieldValue( rRun, bIsURLField ); bool bWriteField = !( sFieldValue.isEmpty() || bIsURLField ); @@ -2482,7 +2486,16 @@ void DrawingML::WriteRun( const Reference< XTextRange >& rRun, if (sText == "\n") { -mpFS->singleElementNS(XML_a, XML_br); +// Empty run? Do not forget to write the font size in case of pptx: +if ((GetDocumentType() == DOCUMENT_PPTX) && (nFontSize != -1)) +{ +mpFS->startElementNS(XML_a, XML_br); +mpFS->singleElementNS(XML_a, XML_rPr, XML_sz, + OString::number(nFontSize * 100).getStr()); +mpFS->endElementNS(XML_a, XML_br); +} +else +mpFS->singleElementNS(XML_a, XML_br); } else { diff --git a/sd/qa/unit/data/pptx/tdf147121.pptx b/sd/qa/unit/data/pptx/tdf147121.pptx new file mode 100644 index ..5762a4b9216b Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf147121.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml3.cxx b/sd/qa/unit/export-tests-ooxml3.cxx index 1650680a2c30..db33ac9b88c4 100644 --- a/sd/qa/unit/export-tests-ooxml3.cxx +++ b/sd/qa/unit/export-tests-ooxml3.cxx @@ -123,6 +123,7 @@ public: void testTdf143222_embeddedWorksheet(); void testTdf142235_TestPlaceholderTextAlignment(); void testTdf143315(); +void testTdf147121(); void testTdf140912_PicturePlaceholder(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest3); @@ -197,6 +198,7 @@ public: CPPUNIT_TEST(testTdf143222_embeddedWorksheet); CPPUNIT_TEST(testTdf142235_TestPlaceholderTextAlignment); CPPUNIT_TEST(testTdf143315); +CPPUNIT_TEST(testTdf147121); CPPUNIT_TEST(testTdf140912_PicturePlaceholder); CPPUNIT_TEST_SUITE_END(); @@ -1847,6 +1849,36 @@ void SdOOXMLExportTest3::testTdf143315() assertXPath(pXml, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr/a:buChar", 0); } +void SdOOXMLExportTest3::testTdf147121() +{ +// Get the bugdoc +::sd::DrawDocShellRef xDocShRef += loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf147121.pptx"), PPTX); + +CPPUNIT_ASSERT(xDocShRef); +// Get the second line props of the placeholder +uno::Reference xPage(getPage(0, xDocShRef)); +uno::Reference xShape(xPage->getByIndex(0), uno::UNO_QUERY_THROW); +uno::Reference xRun( +getRunFromParagraph(2, getParagraphFromShape(0, xShape)), uno::UNO_QUERY_THROW); + +// Save the font size +const auto nFontSizeBefore = xRun->getPropertyValue("CharHeight").get() * 100; + +// Save and reload +utl::TempFile tmpfile; +xDocShRef = saveAndReload(xDocShRef.get(), PPTX, ); +xDocShRef->DoClose(); + +// Parse the export +xmlDocUniquePtr pXml = parseExport(tmpfile, "ppt/slides/slide1.xml"); +const auto nFontSizeAfter += getXPath(pXml, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:br[1]/a:rPr", "sz").toFloat(); + +// The font size was not saved before now it must be equal with the saved one. +CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected font size", nFontSizeBefore, nFontSizeAfter); +} + void SdOOXMLExportTest3::testTdf140912_PicturePlaceholder() { ::sd::DrawDocShellRef xDocShRef = loadURL(
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/source sd/qa
oox/source/drawingml/fillproperties.cxx |3 +++ sd/qa/unit/data/pptx/tdf112209.pptx |binary sd/qa/unit/import-tests2.cxx| 26 ++ 3 files changed, 29 insertions(+) New commits: commit 5a0ad13545197a4a66e0bc4933418110f73c1e9e Author: Tünde Tóth AuthorDate: Wed Jan 19 14:53:50 2022 +0100 Commit: Xisco Fauli CommitDate: Thu Feb 3 11:50:29 2022 +0100 tdf#112209 PPTX import: fix grayscale effect on image filled shape Some image filled shapes with grayscale effect in PPTX documents created with PowerPoint were not grayscale in Impress. Change-Id: I0a89f283f525eb47c21c5d5fa788484d8074a7e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128616 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 1bce0e3004e3ec9d62a3c43801f8f2e8ef5f7fdb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129342 Reviewed-by: Xisco Fauli diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 480bbe641737..5d17c321d0f8 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -722,6 +722,9 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, if (xGraphic.is()) { +if (maBlipProps.moColorEffect.get(XML_TOKEN_INVALID) == XML_grayscl) +xGraphic = lclGreysScaleGraphic(xGraphic); + if (rPropMap.supportsProperty(ShapeProperty::FillBitmapName) && rPropMap.setProperty(ShapeProperty::FillBitmapName, xGraphic)) { diff --git a/sd/qa/unit/data/pptx/tdf112209.pptx b/sd/qa/unit/data/pptx/tdf112209.pptx new file mode 100644 index ..80865820dfad Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf112209.pptx differ diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index c299ad4303dd..b62573ec354b 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -171,6 +171,7 @@ public: void testTdf49856(); void testTdf103347(); void testHyperlinksOnShapes(); +void testTdf112209(); CPPUNIT_TEST_SUITE(SdImportTest2); @@ -234,6 +235,7 @@ public: CPPUNIT_TEST(testTdf134210CropPosition); CPPUNIT_TEST(testTdf103347); CPPUNIT_TEST(testHyperlinksOnShapes); +CPPUNIT_TEST(testTdf112209); CPPUNIT_TEST_SUITE_END(); }; @@ -1908,6 +1910,30 @@ void SdImportTest2::testHyperlinksOnShapes() xDocShRef->DoClose(); } +void SdImportTest2::testTdf112209() +{ +sd::DrawDocShellRef xDocShRef += loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf112209.pptx"), PPTX); +uno::Reference xShape(getShapeFromPage(0, 0, xDocShRef), + uno::UNO_SET_THROW); +CPPUNIT_ASSERT(xShape.is()); + +uno::Reference xGraphic; +xShape->getPropertyValue("FillBitmap") >>= xGraphic; +CPPUNIT_ASSERT(xGraphic.is()); + +Graphic aGraphic(xGraphic); +BitmapEx aBitmap(aGraphic.GetBitmapEx()); + +// Without the accompanying fix in place, this test would have failed with: +// - Expected: Color: R:132 G:132 B:132 A:0 +// - Actual : Color: R:21 G:170 B:236 A:0 +// i.e. the image color was blue instead of grey. +CPPUNIT_ASSERT_EQUAL(Color(0x848484), aBitmap.GetPixelColor(0, 0)); + +xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest2); CPPUNIT_PLUGIN_IMPLEMENT();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/source sd/qa
oox/source/export/drawingml.cxx |6 ++ sd/qa/unit/data/pptx/tdf137675.pptx |binary sd/qa/unit/export-tests-ooxml1.cxx | 14 ++ 3 files changed, 20 insertions(+) New commits: commit 59b16fdf4e25db134ed52457c857eae5241a75e5 Author: Tibor Nagy AuthorDate: Tue Jan 4 14:38:47 2022 +0100 Commit: Xisco Fauli CommitDate: Thu Feb 3 10:04:46 2022 +0100 tdf#137675 PPTX export: adding missing fill="none" to a:path Follow-up to commit 9310e47e2ce71348a16e5412131946348833f4b2 "tdf#101122 DOCX custom shape export: remove bad fill". Change-Id: I2acdae3964c31ee366387d9938fe366405dcace9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127944 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 22b66d4083d34cbce2b7b48daeed3152bf9877b7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129330 Reviewed-by: Xisco Fauli diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 4731f556967e..e1062795e3ae 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -3712,9 +3712,14 @@ bool DrawingML::WriteCustomGeometry( XML_r, "r", XML_b, "b"); mpFS->startElementNS(XML_a, XML_pathLst); +std::optional sFill; +if (HasEnhancedCustomShapeSegmentCommand(rXShape, css::drawing::EnhancedCustomShapeSegmentCommand::NOFILL)) +sFill = "none"; // for possible values see ST_PathFillMode in OOXML standard + if ( aPathSize.hasElements() ) { mpFS->startElementNS( XML_a, XML_path, + XML_fill, sFill, XML_w, OString::number(aPathSize[0].Width), XML_h, OString::number(aPathSize[0].Height) ); } @@ -3741,6 +3746,7 @@ bool DrawingML::WriteCustomGeometry( nYMax = nY; } mpFS->startElementNS( XML_a, XML_path, + XML_fill, sFill, XML_w, OString::number(nXMax - nXMin), XML_h, OString::number(nYMax - nYMin) ); } diff --git a/sd/qa/unit/data/pptx/tdf137675.pptx b/sd/qa/unit/data/pptx/tdf137675.pptx new file mode 100644 index ..d4d767aa5246 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf137675.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 3b50dcf0b793..16c50457e846 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -126,6 +126,7 @@ public: void testTdf143126(); void testTdf143129(); void testTdf118045(); +void testTdf137675(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest1); @@ -194,6 +195,7 @@ public: CPPUNIT_TEST(testTdf143126); CPPUNIT_TEST(testTdf143129); CPPUNIT_TEST(testTdf118045); +CPPUNIT_TEST(testTdf137675); CPPUNIT_TEST_SUITE_END(); @@ -1762,6 +1764,18 @@ void SdOOXMLExportTest1::testTdf118045() "11"); } +void SdOOXMLExportTest1::testTdf137675() +{ +sd::DrawDocShellRef xDocShRef += loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf137675.pptx"), PPTX); +utl::TempFile tempFile; +xDocShRef = saveAndReload(xDocShRef.get(), PPTX, ); +xDocShRef->DoClose(); + +xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); +assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path", "fill", "none"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest1); CPPUNIT_PLUGIN_IMPLEMENT();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/source sd/qa
oox/source/ppt/slidefragmenthandler.cxx |5 + sd/qa/unit/data/pptx/tdf146223.pptx |binary sd/qa/unit/import-tests.cxx | 20 3 files changed, 25 insertions(+) New commits: commit 3698a523d7ce3278ac4e285e32d737951f317978 Author: Tibor Nagy AuthorDate: Tue Dec 14 14:44:15 2021 +0100 Commit: Xisco Fauli CommitDate: Tue Jan 4 10:45:58 2022 +0100 tdf#146223 PPTX import: fix master objects visible property Master objects were always visible after the import, which could change the background of the slides. Change-Id: Idc5260718f2916e207f751286044e9a7fabdee89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126833 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 4574a1ea408c2ac30042dca32d02207ec7add4da) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/12 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx index 4512ee156261..79ea427b5227 100644 --- a/oox/source/ppt/slidefragmenthandler.cxx +++ b/oox/source/ppt/slidefragmenthandler.cxx @@ -78,9 +78,14 @@ SlideFragmentHandler::~SlideFragmentHandler() case PPT_TOKEN( sld ): // CT_CommonSlideData { Reference< XDrawPage > xSlide( mpSlidePersistPtr->getPage() ); +Reference< css::beans::XPropertySet > xSet(xSlide, UNO_QUERY); PropertyMap aPropMap; PropertySet aSlideProp( xSlide ); +OptValue aShowMasterShapes = rAttribs.getBool(XML_showMasterSp); +if (aShowMasterShapes.has() && !aShowMasterShapes.get()) +xSet->setPropertyValue("IsBackgroundObjectsVisible", Any(false)); + aPropMap.setProperty( PROP_Visible, rAttribs.getBool( XML_show, true )); aSlideProp.setProperties( aPropMap ); diff --git a/sd/qa/unit/data/pptx/tdf146223.pptx b/sd/qa/unit/data/pptx/tdf146223.pptx new file mode 100644 index ..73d5eea144cc Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf146223.pptx differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 92b08ef32094..303ab76bed7b 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -123,6 +123,7 @@ public: virtual void setUp() override; void testDocumentLayout(); +void testTdf146223(); void testTdf144918(); void testTdf144917(); void testHyperlinkOnImage(); @@ -190,6 +191,7 @@ public: CPPUNIT_TEST_SUITE(SdImportTest); CPPUNIT_TEST(testDocumentLayout); +CPPUNIT_TEST(testTdf146223); CPPUNIT_TEST(testTdf144918); CPPUNIT_TEST(testTdf144917); CPPUNIT_TEST(testHyperlinkOnImage); @@ -335,6 +337,24 @@ void SdImportTest::testDocumentLayout() } } +void SdImportTest::testTdf146223() +{ +sd::DrawDocShellRef xDocShRef += loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf146223.pptx"), PPTX); + +uno::Reference xDoc(xDocShRef->GetDoc()->getUnoModel(), + uno::UNO_QUERY_THROW); + +uno::Reference xPage1(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY); +uno::Reference xSet(xPage1, uno::UNO_QUERY_THROW); + +bool bBackgroundObjectsVisible; +xSet->getPropertyValue("IsBackgroundObjectsVisible") >>= bBackgroundObjectsVisible; +CPPUNIT_ASSERT_EQUAL(false, bBackgroundObjectsVisible); + +xDocShRef->DoClose(); +} + void SdImportTest::testTdf144918() { sd::DrawDocShellRef xDocShRef
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/source sd/qa
oox/source/export/drawingml.cxx |6 ++ sd/qa/unit/data/pptx/tdf145162.pptx |binary sd/qa/unit/export-tests-ooxml3.cxx | 16 3 files changed, 22 insertions(+) New commits: commit 97ce03ccf1287c1fa79d5741a85fa419e03d9a35 Author: Attila Bakos (NISZ) AuthorDate: Wed Dec 8 10:22:37 2021 +0100 Commit: Xisco Fauli CommitDate: Thu Dec 9 15:25:48 2021 +0100 tdf#145162 PPTX export: fix extra bullet regression Placeholders have bullet by default in MSO, so write for paragraphs where numbering/bullet is disabled to avoid extra bullets in Impress. Regression from commit b6b02e0b4c9d739836e1f61a886ea45b01e6696e (tdf#111903 tdf#137152 PPTX export: fix placeholders). Change-Id: Ib4c563cba475d61bc475ca05623e7c7b20fded30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126528 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit f57cfddb51b7d7409b7b425dc200aa73406a13bd) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126524 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index fbe13359dd9b..008e6ff9cf12 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2549,7 +2549,13 @@ static OUString GetAutoNumType(SvxNumType nNumberingType, bool bSDot, bool bPBeh void DrawingML::WriteParagraphNumbering(const Reference< XPropertySet >& rXPropSet, float fFirstCharHeight, sal_Int16 nLevel ) { if (nLevel < 0 || !GetProperty(rXPropSet, "NumberingRules")) +{ +if (GetDocumentType() == DOCUMENT_PPTX) +{ +mpFS->singleElementNS(XML_a, XML_buNone); +} return; +} Reference< XIndexAccess > rXIndexAccess; diff --git a/sd/qa/unit/data/pptx/tdf145162.pptx b/sd/qa/unit/data/pptx/tdf145162.pptx new file mode 100644 index ..3746740f327c Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf145162.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml3.cxx b/sd/qa/unit/export-tests-ooxml3.cxx index 900716e20093..fbf39e111f71 100644 --- a/sd/qa/unit/export-tests-ooxml3.cxx +++ b/sd/qa/unit/export-tests-ooxml3.cxx @@ -70,6 +70,7 @@ public: void testTdf118806(); void testTdf130058(); void testTdf111789(); +void testTdf145162(); void testTdf100348_convert_Fontwork2TextWarp(); void testTdf1225573_FontWorkScaleX(); void testTdf99497_keepAppearanceOfCircleKind(); @@ -143,6 +144,7 @@ public: CPPUNIT_TEST(testTdf118806); CPPUNIT_TEST(testTdf130058); CPPUNIT_TEST(testTdf111789); +CPPUNIT_TEST(testTdf145162); CPPUNIT_TEST(testTdf100348_convert_Fontwork2TextWarp); CPPUNIT_TEST(testTdf1225573_FontWorkScaleX); CPPUNIT_TEST(testTdf99497_keepAppearanceOfCircleKind); @@ -612,6 +614,20 @@ void SdOOXMLExportTest3::testTdf111789() xDocShRef->DoClose(); } +void SdOOXMLExportTest3::testTdf145162() +{ +sd::DrawDocShellRef xDocShRef += loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf145162.pptx"), PPTX); +utl::TempFile tempFile; +xDocShRef = saveAndReload(xDocShRef.get(), PPTX, ); +xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + +assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p[2]/a:pPr/a:buNone"); +// Before the fix, that tag was missing so PP put bullet to each para. + +xDocShRef->DoClose(); +} + void SdOOXMLExportTest3::testTdf100348_convert_Fontwork2TextWarp() { ::sd::DrawDocShellRef xDocShRef = loadURL(
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/source sd/qa
oox/source/drawingml/shape.cxx | 30 oox/source/token/properties.txt |1 sd/qa/unit/data/pptx/tdfpictureplaceholder.pptx |binary sd/qa/unit/export-tests-ooxml3.cxx | 20 4 files changed, 51 insertions(+) New commits: commit 0fa00d879995d498d1f04efe72f3413a3c15601b Author: gulsahkose AuthorDate: Wed Dec 1 10:46:41 2021 +0300 Commit: Miklos Vajna CommitDate: Fri Dec 3 09:30:01 2021 +0100 tdf#140912 Better handling of the picture placeholders. To see icon and placeholder text at the center of picture placeholder shape, we set the TextContourFrame and GraphicCrop properties. Change-Id: I49e3d08c9020e593232c60c97af3f45fb620075e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126165 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 7b3be7f6f3d800e2ad86f5a043e6e9b21ed4409f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126141 diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 9aed4d3588d0..78a27f8a0c9c 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -88,6 +88,7 @@ #include #include #include +#include #include #include #include @@ -1337,6 +1338,35 @@ Reference< XShape > const & Shape::createAndInsert( propertySet->setPropertyValue("InteropGrabBag",uno::makeAny(aGrabBag)); } +// If the shape is a picture placeholder. +if (aServiceName == "com.sun.star.presentation.GraphicObjectShape" && !bClearText) +{ +// Placeholder text should be in center of the shape. +aShapeProps.setProperty(PROP_TextContourFrame, false); + +/* Placeholder icon should be at the center of the parent shape. + * We use negative graphic crop property because of that we don't + * have padding support. + */ +uno::Reference xGraphic(xSet->getPropertyValue("Graphic"), uno::UNO_QUERY); +if (xGraphic.is()) +{ +awt::Size aBitmapSize; +xGraphic->getPropertyValue("Size100thMM") >>= aBitmapSize; +sal_Int32 nXMargin = (aShapeRectHmm.Width - aBitmapSize.Width) / 2; +sal_Int32 nYMargin = (aShapeRectHmm.Height - aBitmapSize.Height) / 2; +if (nXMargin > 0 && nYMargin > 0) +{ +text::GraphicCrop aGraphicCrop; +aGraphicCrop.Top = nYMargin * -1; +aGraphicCrop.Bottom = nYMargin * -1; +aGraphicCrop.Left = nXMargin * -1; +aGraphicCrop.Right = nXMargin * -1; +aShapeProps.setProperty(PROP_GraphicCrop, aGraphicCrop); +} +} +} + PropertySet( xSet ).setProperties( aShapeProps ); if (mbLockedCanvas) { diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 5d261469ca42..87a6700bd35a 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -541,6 +541,7 @@ TextBreak TextCameraZRotateAngle TextColor TextColumns +TextContourFrame TextFitToSize TextFrames TextHorizontalAdjust diff --git a/sd/qa/unit/data/pptx/tdfpictureplaceholder.pptx b/sd/qa/unit/data/pptx/tdfpictureplaceholder.pptx new file mode 100644 index ..d681c749cab0 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdfpictureplaceholder.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml3.cxx b/sd/qa/unit/export-tests-ooxml3.cxx index a9a740eb4588..900716e20093 100644 --- a/sd/qa/unit/export-tests-ooxml3.cxx +++ b/sd/qa/unit/export-tests-ooxml3.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #include @@ -120,6 +121,7 @@ public: void testTdf143222_embeddedWorksheet(); void testTdf142235_TestPlaceholderTextAlignment(); void testTdf143315(); +void testTdf140912_PicturePlaceholder(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest3); @@ -191,6 +193,7 @@ public: CPPUNIT_TEST(testTdf143222_embeddedWorksheet); CPPUNIT_TEST(testTdf142235_TestPlaceholderTextAlignment); CPPUNIT_TEST(testTdf143315); +CPPUNIT_TEST(testTdf140912_PicturePlaceholder); CPPUNIT_TEST_SUITE_END(); virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override @@ -1813,6 +1816,23 @@ void SdOOXMLExportTest3::testTdf143315() assertXPath(pXml, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr/a:buChar", 0); } +void SdOOXMLExportTest3::testTdf140912_PicturePlaceholder() +{ +::sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdfpictureplaceholder.pptx"), PPTX); + +uno::Reference
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - oox/source sd/qa
oox/source/export/drawingml.cxx|7 +-- sd/qa/unit/data/odp/tdf118045.odp |binary sd/qa/unit/export-tests-ooxml1.cxx | 15 +++ 3 files changed, 20 insertions(+), 2 deletions(-) New commits: commit c22f1ceba99b2ff4fa23728eb8581294e9414016 Author: Tibor Nagy AuthorDate: Thu Nov 18 09:05:30 2021 +0100 Commit: Xisco Fauli CommitDate: Mon Nov 29 11:37:52 2021 +0100 tdf#118045 PPTX export: fix proportional line spacing If line spacing differs from the default 100%, export it as direct paragraph formatting (similar to the other paragraph style properties). Change-Id: Id5db9ae36018c8a20b832470685bdfbba19d80f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125438 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 5db7694a6377d32bdef293b4ece27b471c3ea427) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125992 Tested-by: Jenkins Reviewed-by: Xisco Fauli diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index af96b14f1ac6..fbe13359dd9b 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2877,8 +2877,11 @@ bool DrawingML::WriteParagraphProperties( const Reference< XTextContent >& rPara bool bHasLinespacing = false; LineSpacing aLineSpacing; if (GetPropertyAndState(rXPropSet, rXPropState, "ParaLineSpacing", eState) -&& eState == beans::PropertyState_DIRECT_VALUE) -bHasLinespacing = ( mAny >>= aLineSpacing ); +&& (mAny >>= aLineSpacing) +&& (eState == beans::PropertyState_DIRECT_VALUE || +// only export if it differs from the default 100% line spacing +aLineSpacing.Mode != LineSpacingMode::PROP || aLineSpacing.Height != 100)) +bHasLinespacing = true; bool bRtl = false; if (GetProperty(rXPropSet, "WritingMode")) diff --git a/sd/qa/unit/data/odp/tdf118045.odp b/sd/qa/unit/data/odp/tdf118045.odp new file mode 100644 index ..8b5fac36af4f Binary files /dev/null and b/sd/qa/unit/data/odp/tdf118045.odp differ diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 52b580a95e05..9efb79ae9cf1 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -124,6 +124,7 @@ public: void testPlaceholderFillAndOutlineExport(); void testTdf143126(); void testTdf143129(); +void testTdf118045(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest1); @@ -190,6 +191,7 @@ public: CPPUNIT_TEST(testPlaceholderFillAndOutlineExport); CPPUNIT_TEST(testTdf143126); CPPUNIT_TEST(testTdf143129); +CPPUNIT_TEST(testTdf118045); CPPUNIT_TEST_SUITE_END(); @@ -1733,6 +1735,19 @@ void SdOOXMLExportTest1::testTdf143129() assertXPath(pXmlDoc, "/p:presentationPr/p:showPr/p:custShow", "id", "0" ); } +void SdOOXMLExportTest1::testTdf118045() +{ +sd::DrawDocShellRef xDocShRef += loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf118045.odp"), ODP); +utl::TempFile tempFile; +xDocShRef = saveAndReload(xDocShRef.get(), PPTX, ); +xDocShRef->DoClose(); + +xmlDocUniquePtr pXmlDoc1 = parseExport(tempFile, "ppt/slides/slide1.xml"); +assertXPath(pXmlDoc1, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:pPr/a:lnSpc/a:spcPct", "val", +"11"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest1); CPPUNIT_PLUGIN_IMPLEMENT();