oox/qa/unit/data/endParaRPr-newline-textsize.pptx |binary
 oox/qa/unit/export.cxx                            |   21 +++++++++++++++++++++
 oox/source/export/drawingml.cxx                   |    4 ++++
 3 files changed, 25 insertions(+)

New commits:
commit c6dc94b147fdf522552640918cc1d1ef246eb04d
Author:     Sarper Akdemir <sarper.akde...@collabora.com>
AuthorDate: Tue Jan 11 02:06:52 2022 +0300
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Feb 21 17:33:55 2022 +0100

    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/+/128265
    Tested-by: Jenkins
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130240

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
Binary files /dev/null and b/oox/qa/unit/data/endParaRPr-newline-textsize.pptx 
differ
diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx
index 83bd05c6f286..dd722cd04e79 100644
--- a/oox/qa/unit/export.cxx
+++ b/oox/qa/unit/export.cxx
@@ -353,6 +353,27 @@ 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 a PPTX file that contains references to a theme:
+    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 shape text color is a scheme color:
+    // 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 0bcb8b4e1f92..69f210cfe325 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3058,7 +3058,11 @@ 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>();
+                    rnCharHeight = 100 * fFirstCharHeight;
+                    rbOverridingCharHeight = true;
+                }
                 WriteParagraphProperties(rParagraph, fFirstCharHeight, 
XML_pPr);
                 bPropertiesWritten = true;
             }

Reply via email to