[Libreoffice-commits] core.git: oox/source sd/qa

Paul Trojahn paul.trojahn at gmail.com
Fri Jul 14 06:51:41 UTC 2017


 oox/source/drawingml/fillproperties.cxx |    4 ++--
 oox/source/export/drawingml.cxx         |    6 +++---
 sd/qa/unit/data/pptx/tdf109067.pptx     |binary
 sd/qa/unit/import-tests.cxx             |   13 +++++++++++++
 4 files changed, 18 insertions(+), 5 deletions(-)

New commits:
commit 1b08f129677c1109aae1fadc72ae68ebb7df7cb0
Author: Paul Trojahn <paul.trojahn at gmail.com>
Date:   Thu Jul 6 13:36:58 2017 +0200

    tdf#109067 Fix default value of rotWithShape
    
    According to the OOXML standard the default value is true, so for
    the export of gradients and blips it has to be set explicitly to
    false.
    
    Change-Id: I3c9f67787cb11d6d9b58f07377b03167df669ed8
    Reviewed-on: https://gerrit.libreoffice.org/39725
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 314ff5822695..41ab6ae222bc 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -362,8 +362,8 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
                     if ( bFlipV )
                         nShapeRotation = -nShapeRotation;
 
-                    // "rotate with shape" not set, or set to false -> do not rotate
-                    if ( !maGradientProps.moRotateWithShape.get( false ) )
+                    // "rotate with shape" set to false -> do not rotate
+                    if ( !maGradientProps.moRotateWithShape.get( true ) )
                         nShapeRotation = 0;
 
                     if( maGradientProps.moGradientPath.has() )
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index ddb91babb7c5..ee151225f122 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -386,14 +386,14 @@ void DrawingML::WriteGradientFill( const Reference< XPropertySet >& rXPropSet )
             // If we have no gradient stops that means original gradient were defined by a theme.
             if( aGradientStops.hasElements() )
             {
-                mpFS->startElementNS( XML_a, XML_gradFill, FSEND );
+                mpFS->startElementNS( XML_a, XML_gradFill, XML_rotWithShape, "0", FSEND );
                 WriteGrabBagGradientFill(aGradientStops, aGradient);
                 mpFS->endElementNS( XML_a, XML_gradFill );
             }
         }
         else
         {
-            mpFS->startElementNS( XML_a, XML_gradFill, FSEND );
+            mpFS->startElementNS( XML_a, XML_gradFill, XML_rotWithShape, "0", FSEND );
             WriteGradientFill(aGradient);
             mpFS->endElementNS( XML_a, XML_gradFill );
         }
@@ -1053,7 +1053,7 @@ void DrawingML::WriteBlipFill( const Reference< XPropertySet >& rXPropSet, const
     {
         SAL_INFO("oox.shape", "URL: " << sBitmapURL);
 
-        mpFS->startElementNS( nXmlNamespace , XML_blipFill, FSEND );
+        mpFS->startElementNS( nXmlNamespace , XML_blipFill, XML_rotWithShape, "0", FSEND );
 
         WriteBlip( rXPropSet, sBitmapURL, bRelPathToMedia );
 
diff --git a/sd/qa/unit/data/pptx/tdf109067.pptx b/sd/qa/unit/data/pptx/tdf109067.pptx
new file mode 100644
index 000000000000..ef213774cbd8
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf109067.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index a4d8253399a6..b71b4aec4e8e 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -161,6 +161,7 @@ public:
     void testTdf100926();
     void testTdf89064();
     void testTdf108925();
+    void testTdf109067();
 
     bool checkPattern(sd::DrawDocShellRef& rDocRef, int nShapeNumber, std::vector<sal_uInt8>& rExpected);
     void testPatternImport();
@@ -230,6 +231,7 @@ public:
     CPPUNIT_TEST(testPatternImport);
     CPPUNIT_TEST(testTdf89064);
     CPPUNIT_TEST(testTdf108925);
+    CPPUNIT_TEST(testTdf109067);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -2206,6 +2208,17 @@ void SdImportTest::testTdf108925()
     xDocShRef->DoClose();
 }
 
+void SdImportTest::testTdf109067()
+{
+    sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf109067.pptx"), PPTX);
+    uno::Reference< beans::XPropertySet > xShape(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW);
+    awt::Gradient gradient;
+    CPPUNIT_ASSERT(xShape->getPropertyValue("FillGradient") >>= gradient);
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(450), gradient.Angle);
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list