[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - oox/source sd/qa

Gülşah Köse (via logerrit) logerrit at kemper.freedesktop.org
Thu Nov 28 07:47:42 UTC 2019


 oox/source/export/drawingml.cxx    |   13 ++++++++-----
 sd/qa/unit/data/pptx/tdf127090.odp |binary
 sd/qa/unit/export-tests-ooxml1.cxx |   14 ++++++++++++++
 3 files changed, 22 insertions(+), 5 deletions(-)

New commits:
commit 5b5f58f395d1b6c1d007dcc6dc29535c5678f851
Author:     Gülşah Köse <gulsah.kose at collabora.com>
AuthorDate: Wed Nov 27 13:35:29 2019 +0300
Commit:     Gülşah Köse <gulsah.kose at collabora.com>
CommitDate: Thu Nov 28 08:47:07 2019 +0100

    tdf#127090 Export textbox rotation attribute.
    
    In case "rotated textbox in a custom shape" handle
    draw:text-rotate-angle attribute while exporting
    ODP to PPTX.
    
    Change-Id: I13b99da586af5e77e51a7cc93a751ab21bed7170
    Reviewed-on: https://gerrit.libreoffice.org/83888
    Tested-by: Jenkins
    Reviewed-by: Gülşah Köse <gulsah.kose at collabora.com>
    (cherry picked from commit 9b2f5d27cf0a0adcced813e18108d5878061d1ee)
    Reviewed-on: https://gerrit.libreoffice.org/83950

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 6ca1e78d3dfb..d844d6f8242b 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2644,7 +2644,8 @@ void DrawingML::WriteText( const Reference< XInterface >& rXIface, const OUStrin
     if( !xXText.is() )
         return;
 
-    sal_Int32 nTextRotateAngle = 0;
+    sal_Int32 nTextPreRotateAngle = 0;
+    double nTextRotateAngle = 0;
     bool bIsFontworkShape(presetWarp.startsWith("text") && (presetWarp != "textNoShape"));
 
 #define DEFLRINS 254
@@ -2695,14 +2696,14 @@ void DrawingML::WriteText( const Reference< XInterface >& rXIface, const OUStrin
         {
             for ( const auto& rProp : std::as_const(aProps) )
             {
-                if ( rProp.Name == "TextPreRotateAngle" && ( rProp.Value >>= nTextRotateAngle ) )
+                if ( rProp.Name == "TextPreRotateAngle" && ( rProp.Value >>= nTextPreRotateAngle ) )
                 {
-                    if ( nTextRotateAngle == -90 )
+                    if ( nTextPreRotateAngle == -90 )
                     {
                         sWritingMode = "vert";
                         bVertical = true;
                     }
-                    else if ( nTextRotateAngle == -270 )
+                    else if ( nTextPreRotateAngle == -270 )
                     {
                         sWritingMode = "vert270";
                         bVertical = true;
@@ -2712,6 +2713,8 @@ void DrawingML::WriteText( const Reference< XInterface >& rXIface, const OUStrin
                 }
                 else if (rProp.Name == "AdjustmentValues")
                     rProp.Value >>= aAdjustmentSeq;
+                else if( rProp.Name == "TextRotateAngle" )
+                    rProp.Value >>= nTextRotateAngle;
                 else if (rProp.Name == "TextPath")
                 {
                     rProp.Value >>= aTextPathSeq;
@@ -2769,7 +2772,7 @@ void DrawingML::WriteText( const Reference< XInterface >& rXIface, const OUStrin
                                XML_anchor, sVerticalAlignment,
                                XML_anchorCtr, bHorizontalCenter ? "1" : nullptr,
                                XML_vert, sWritingMode,
-                               XML_rot, (nTextRotateAngle != 0) ? oox::drawingml::calcRotationValue( nTextRotateAngle * 100 ).getStr() : nullptr );
+                               XML_rot, ((nTextPreRotateAngle + nTextRotateAngle) != 0) ? oox::drawingml::calcRotationValue( (nTextPreRotateAngle + nTextRotateAngle) * 100 ).getStr() : nullptr );
         if (bIsFontworkShape)
         {
             if (aAdjustmentSeq.hasElements())
diff --git a/sd/qa/unit/data/pptx/tdf127090.odp b/sd/qa/unit/data/pptx/tdf127090.odp
new file mode 100644
index 000000000000..bbdc7995853f
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf127090.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index ddc41b563c99..79b18b7cb914 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -81,6 +81,7 @@ public:
     void testTdf111884();
     void testTdf112633();
     void testTdf128952();
+    void testTdf127090();
     void testCustomXml();
     void testTdf94238();
     void testPictureTransparency();
@@ -118,6 +119,7 @@ public:
     CPPUNIT_TEST(testTdf111884);
     CPPUNIT_TEST(testTdf112633);
     CPPUNIT_TEST(testTdf128952);
+    CPPUNIT_TEST(testTdf127090);
     CPPUNIT_TEST(testCustomXml);
     CPPUNIT_TEST(testTdf94238);
     CPPUNIT_TEST(testTdf125554);
@@ -829,6 +831,18 @@ void SdOOXMLExportTest1::testTdf128952()
     assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:xfrm/a:ext", "cy", "1462680");
 }
 
+void SdOOXMLExportTest1::testTdf127090()
+{
+    ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf127090.odp"), ODP);
+    utl::TempFile tempFile;
+    xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+    xDocShRef->DoClose();
+
+    xmlDocPtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml");
+
+    assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr", "rot", "-5400000");
+}
+
 void SdOOXMLExportTest1::testCustomXml()
 {
     // Load document and export it to a temporary file


More information about the Libreoffice-commits mailing list