diff options
author | Sarper Akdemir <sarper.akdemir@collabora.com> | 2022-01-11 02:06:52 +0300 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-01-20 16:56:33 +0100 |
commit | 7120797571a4e6c2b6da2d2cef38ad3b2023df2e (patch) | |
tree | de183f5b9d7e4bc687ceb83a84cb6ad046c3a875 /oox | |
parent | 7d2d443269186cb6352a04531a7e7d30f721cbfe (diff) |
tdf#146690: pptx export: fix endParaRPr size value for empty paragraphs
Fixes paragraphs made from a single new line, not getting the
correct sz(text size) value in EndParagraphRunProperties on pptx
export
Change-Id: I31ebb5735ad392e081aa2f43b0b60a845e4de9c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128280
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'oox')
-rwxr-xr-x | oox/qa/unit/data/endParaRPr-newline-textsize.pptx | bin | 0 -> 13349 bytes | |||
-rw-r--r-- | oox/qa/unit/export.cxx | 22 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 5 |
3 files changed, 27 insertions, 0 deletions
diff --git a/oox/qa/unit/data/endParaRPr-newline-textsize.pptx b/oox/qa/unit/data/endParaRPr-newline-textsize.pptx Binary files differnew file mode 100755 index 000000000000..109f818ec8a7 --- /dev/null +++ b/oox/qa/unit/data/endParaRPr-newline-textsize.pptx diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 897eec7284b6..a4b1e78f352d 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -173,6 +173,28 @@ CPPUNIT_TEST_FIXTURE(Test, testCameraRevolutionGrabBag) assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:bodyPr/a:scene3d/a:camera/a:rot", 0); assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:bodyPr/a:scene3d/a:camera/a:rot", 0); } + +CPPUNIT_TEST_FIXTURE(Test, testTdf146690_endParagraphRunPropertiesNewLinesTextSize) +{ + // Given PPTX file contains a shape with a textbody populated with new lines + // and the text size isn't the default size. + OUString aURL + = m_directories.getURLFromSrc(DATA_DIRECTORY) + "endParaRPr-newline-textsize.pptx"; + + // When saving that document: + loadAndSave(aURL, "Impress Office Open XML"); + + std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml"); + xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); + // Then make sure the endParaRPr has the correct values exported for 'sz' + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 500 + // - Actual : 1800 + // i.e. the endParaRPr 'size' wasn't exported correctly + assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p[1]/a:endParaRPr", "sz", "500"); + assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p[2]/a:endParaRPr", "sz", "500"); + assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p[3]/a:endParaRPr", "sz", "500"); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index bf5d6011bc50..07e1496408fa 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2930,7 +2930,12 @@ void DrawingML::WriteParagraph( const Reference< XTextContent >& rParagraph, Reference< XPropertySet > xFirstRunPropSet (run, UNO_QUERY); Reference< XPropertySetInfo > xFirstRunPropSetInfo = xFirstRunPropSet->getPropertySetInfo(); if( xFirstRunPropSetInfo->hasPropertyByName("CharHeight") ) + { fFirstCharHeight = xFirstRunPropSet->getPropertyValue("CharHeight").get<float>(); + // store the char height to export later into XML_endParaRPr + rnCharHeight = static_cast<sal_Int32>(100 * fFirstCharHeight); // get the OOXML char height equivalent + rbOverridingCharHeight = true; + } WriteParagraphProperties( rParagraph, fFirstCharHeight ); bPropertiesWritten = true; } |