summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarper Akdemir <sarper.akdemir@collabora.com>2022-01-11 02:06:52 +0300
committerAndras Timar <andras.timar@collabora.com>2022-01-20 16:56:33 +0100
commit7120797571a4e6c2b6da2d2cef38ad3b2023df2e (patch)
treede183f5b9d7e4bc687ceb83a84cb6ad046c3a875
parentUpdate git submodules (diff)
downloadcore-7120797571a4e6c2b6da2d2cef38ad3b2023df2e.tar.gz
core-7120797571a4e6c2b6da2d2cef38ad3b2023df2e.zip
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>
-rwxr-xr-xoox/qa/unit/data/endParaRPr-newline-textsize.pptxbin0 -> 13349 bytes
-rw-r--r--oox/qa/unit/export.cxx22
-rw-r--r--oox/source/export/drawingml.cxx5
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
new file mode 100755
index 000000000000..109f818ec8a7
--- /dev/null
+++ b/oox/qa/unit/data/endParaRPr-newline-textsize.pptx
Binary files differ
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;
}