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

New commits:
commit 7120797571a4e6c2b6da2d2cef38ad3b2023df2e
Author:     Sarper Akdemir <[email protected]>
AuthorDate: Tue Jan 11 02:06:52 2022 +0300
Commit:     Andras Timar <[email protected]>
CommitDate: Thu Jan 20 16:56:33 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/+/128280
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Andras Timar <[email protected]>

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 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;
             }

Reply via email to