[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - svx/qa xmloff/source

Regina Henschel (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 23 10:25:13 UTC 2021


 svx/qa/unit/customshapes.cxx                    |   18 ++++++++++++++++++
 svx/qa/unit/data/tdf141127_defaultSkewAngle.odp |binary
 xmloff/source/draw/ximpcustomshape.cxx          |    9 +++++++++
 3 files changed, 27 insertions(+)

New commits:
commit 7c4a797148a68b342b17f2d34854d6bacf51cb85
Author:     Regina Henschel <rb.henschel at t-online.de>
AuthorDate: Sat Mar 20 20:05:19 2021 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Mar 23 11:24:39 2021 +0100

    tdf#141127 Use ODF default values for draw:extrusion-skew
    
    The default value for extrusion skew angle is 45 in ODF and -135 in
    binary MS Office. LO had used -135 in case the draw:extrusion-skew
    attribute was missing on import. This could be fixed in GetSkew() in
    EnhancedCustomShape3d.cxx#92. But that would break import of ppt files.
    So I have decided not to search, were the binary import would need to
    be tweaked, but I set the default values directly in file open in case
    the attribute is missing.
    
    Change-Id: Ieeffa64099fdbdbe0ba9d4dab7ed2f19d397a6e3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112819
    Tested-by: Jenkins
    Reviewed-by: Regina Henschel <rb.henschel at t-online.de>
    (cherry picked from commit 2bf8c1e0e211601a70b6b28fdb92f636c7969513)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112809
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index db7808a16f2f..036aff90543f 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -933,6 +933,24 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf136176)
         }
     }
 }
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf141127WrongSkewDefault)
+{
+    // Load a document that has a shape in extrusion mode, but no draw:extrusion-skew attribute.
+    // Error was, that the shape uses the MS Office binary defaults and so the extruded side faces
+    // were not left/bottom, but top/right.
+    OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + "tdf141127_defaultSkewAngle.odp";
+    mxComponent = loadFromDesktop(sURL, "com.sun.star.comp.presentation.PresentationDocument");
+    CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
+    uno::Reference<drawing::XShape> xShape(getShape(0));
+    SdrObjCustomShape& rSdrCustomShape(
+        static_cast<SdrObjCustomShape&>(*GetSdrObjectFromXShape(xShape)));
+
+    // Check left/bottom of bound rect. Without fix it would be left=15994, bottom=6999.
+    tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect());
+    CPPUNIT_ASSERT_EQUAL(tools::Long(15371), aBoundRect.Left());
+    CPPUNIT_ASSERT_EQUAL(tools::Long(7622), aBoundRect.Bottom());
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf141127_defaultSkewAngle.odp b/svx/qa/unit/data/tdf141127_defaultSkewAngle.odp
new file mode 100644
index 000000000000..5cd0da96ec20
Binary files /dev/null and b/svx/qa/unit/data/tdf141127_defaultSkewAngle.odp differ
diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx
index 3bd71eae268d..ef58c7664baa 100644
--- a/xmloff/source/draw/ximpcustomshape.cxx
+++ b/xmloff/source/draw/ximpcustomshape.cxx
@@ -1291,6 +1291,15 @@ void XMLEnhancedCustomShapeContext::endFastElement(sal_Int32 )
         }
     }
 
+    //tdf#141127 Add ODF default values. Otherwise defaults from MS Office binary format are used.
+    if (!maExtrusion.empty())
+    {
+        auto it = std::find_if(maExtrusion.begin(), maExtrusion.end(), 
+            [](css::beans::PropertyValue& rProp){return EASGet(rProp.Name) == EAS_Skew;} );
+        if (it == maExtrusion.end())
+            GetEnhancedParameterPair(maExtrusion, "50 45", EAS_Skew);
+    }
+
     SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maExtrusion, EASGet( EAS_Extrusion ) );
     SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maPath,      EASGet( EAS_Path ) );
     SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maTextPath,  EASGet( EAS_TextPath ) );


More information about the Libreoffice-commits mailing list