[Libreoffice-commits] core.git: 3 commits - include/oox oox/source sw/qa

Jacobo Aragunde Pérez jaragunde at igalia.com
Tue May 13 01:29:28 PDT 2014


 include/oox/drawingml/shape3dproperties.hxx                     |    9 +
 include/oox/export/drawingml.hxx                                |    4 
 oox/source/drawingml/scene3dcontext.cxx                         |    7 
 oox/source/drawingml/shape.cxx                                  |    2 
 oox/source/drawingml/shape3dproperties.cxx                      |   72 +++++++++-
 oox/source/export/drawingml.cxx                                 |   71 +++++++++
 sw/qa/extras/ooxmlexport/data/shape-3d-effect-preservation.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx                     |   27 +++
 8 files changed, 181 insertions(+), 11 deletions(-)

New commits:
commit fe88fac28afac3ec0b837c1e2e38d9f8cf152080
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Mon May 12 19:18:05 2014 +0200

    oox: Use references to prevent unnecessary object copies
    
    Change-Id: I5113bc581a8ac98b97c6598a5355e050c7ad7860

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 852387d..2b3eb9e 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -123,8 +123,8 @@ public:
     OUString WriteImage( const Graphic &rGraphic , bool bRelPathToMedia = false);
 
     void WriteColor( sal_uInt32 nColor, sal_Int32 nAlpha = MAX_PERCENT );
-    void WriteColor( const OUString& sColorSchemeName, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aTransformations );
-    void WriteColorTransformations( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aTransformations );
+    void WriteColor( const OUString& sColorSchemeName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aTransformations );
+    void WriteColorTransformations( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aTransformations );
     void WriteGradientStop( sal_uInt16 nStop, sal_uInt32 nColor );
     void WriteLineArrow( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, bool bLineStart );
     void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID );
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 99deb82..eff1d2b 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -181,7 +181,7 @@ void DrawingML::WriteColor( sal_uInt32 nColor, sal_Int32 nAlpha )
     }
 }
 
-void DrawingML::WriteColor( const OUString& sColorSchemeName, Sequence< PropertyValue > aTransformations )
+void DrawingML::WriteColor( const OUString& sColorSchemeName, const Sequence< PropertyValue >& aTransformations )
 {
     // prevent writing a tag with empty val attribute
     if( sColorSchemeName.isEmpty() )
@@ -201,7 +201,7 @@ void DrawingML::WriteColor( const OUString& sColorSchemeName, Sequence< Property
                               FSEND );
 }
 
-void DrawingML::WriteColorTransformations( Sequence< PropertyValue > aTransformations )
+void DrawingML::WriteColorTransformations( const Sequence< PropertyValue >& aTransformations )
 {
     for( sal_Int32 i = 0; i < aTransformations.getLength(); i++ )
     {
commit 4b4f7e17ad5571482111f1574f7e4b313531cfde
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Mon May 12 19:13:06 2014 +0200

    ooxml: Preserve shape 3d effects: extrusion and contour colors
    
    Shapes 3D effects can specify colors for extrusion and contours like
    in the following example:
    
      <a:sp3d extrusionH="25400" prstMaterial="metal">
        <a:extrusionClr>
          <a:schemeClr val="accent5">
            <a:lumMod val="40000"/>
            <a:lumOff val="60000"/>
          </a:schemeClr>
        </a:extrusionClr>
        <a:contourClr>
          <a:srgbClr val="3333FF"/>
        </a:contourClr>
      </a:sp3d>
    
    Colors can be theme-defined or set in RGB and can contain
    transformations.
    
    This patch preserves all the color information using the shape grab
    bag and modifies an existing unit test to add this check.
    
    Change-Id: Ida168affd4ca2135d0bd8f97135dc1cd1e74165a

diff --git a/include/oox/drawingml/shape3dproperties.hxx b/include/oox/drawingml/shape3dproperties.hxx
index e57ac94..5c3eaa0 100644
--- a/include/oox/drawingml/shape3dproperties.hxx
+++ b/include/oox/drawingml/shape3dproperties.hxx
@@ -64,6 +64,8 @@ struct Shape3DProperties
     OptValue< sal_Int32 > mnContourW;
     OptValue< sal_Int32 > mnShapeZ;
     OptValue< sal_Int32 > mnMaterial;
+    Color maExtrusionColor;
+    Color maContourColor;
 
     OptValue< BevelProperties > maTopBevelProperties;
     OptValue< BevelProperties > maBottomBevelProperties;
@@ -79,8 +81,11 @@ struct Shape3DProperties
 
     css::uno::Sequence< css::beans::PropertyValue > getCameraAttributes();
     css::uno::Sequence< css::beans::PropertyValue > getLightRigAttributes();
-    css::uno::Sequence< css::beans::PropertyValue > getShape3DAttributes();
+    css::uno::Sequence< css::beans::PropertyValue > getShape3DAttributes(
+            const GraphicHelper& rGraphicHelper, sal_Int32 rPhClr = API_RGB_TRANSPARENT );
     css::uno::Sequence< css::beans::PropertyValue > getBevelAttributes( BevelProperties rProps );
+    css::uno::Sequence< css::beans::PropertyValue > getColorAttributes(
+            const Color& rColor, const GraphicHelper& rGraphicHelper, sal_Int32 rPhClr );
 };
 
 
diff --git a/oox/source/drawingml/scene3dcontext.cxx b/oox/source/drawingml/scene3dcontext.cxx
index ec9204b..c8d9dd5 100644
--- a/oox/source/drawingml/scene3dcontext.cxx
+++ b/oox/source/drawingml/scene3dcontext.cxx
@@ -104,6 +104,11 @@ ContextHandlerRef Shape3DPropertiesContext::onCreateContext( sal_Int32 aElementT
 
         break;
     }
+    case A_TOKEN( extrusionClr ):
+        return new ColorContext( *this, mr3DProperties.maExtrusionColor );
+
+    case A_TOKEN( contourClr ):
+        return new ColorContext( *this, mr3DProperties.maContourColor );
     }
     return 0;
 }
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index da125cf..6d13868 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -940,7 +940,7 @@ Reference< XShape > Shape::createAndInsert(
             // add 3D effects if any
             Sequence< PropertyValue > aCamera3DEffects = get3DProperties().getCameraAttributes();
             Sequence< PropertyValue > aLightRig3DEffects = get3DProperties().getLightRigAttributes();
-            Sequence< PropertyValue > aShape3DEffects = get3DProperties().getShape3DAttributes();
+            Sequence< PropertyValue > aShape3DEffects = get3DProperties().getShape3DAttributes( rGraphicHelper, nFillPhClr );
             if( aCamera3DEffects.getLength() > 0 || aLightRig3DEffects.getLength() > 0 )
             {
                 Sequence< PropertyValue > a3DEffectsGrabBag( 3 );
diff --git a/oox/source/drawingml/shape3dproperties.cxx b/oox/source/drawingml/shape3dproperties.cxx
index 9bb434a..e3f39b6 100644
--- a/oox/source/drawingml/shape3dproperties.cxx
+++ b/oox/source/drawingml/shape3dproperties.cxx
@@ -325,9 +325,34 @@ css::uno::Sequence< css::beans::PropertyValue > Shape3DProperties::getBevelAttri
     return aSeq;
 }
 
-css::uno::Sequence< css::beans::PropertyValue > Shape3DProperties::getShape3DAttributes()
+css::uno::Sequence< css::beans::PropertyValue > Shape3DProperties::getColorAttributes(
+        const Color& rColor, const GraphicHelper& rGraphicHelper, sal_Int32 rPhClr )
 {
-    css::uno::Sequence<css::beans::PropertyValue> aSeq(6);
+    css::uno::Sequence<css::beans::PropertyValue> aSeq(2);
+    OUString sColorScheme = rColor.getSchemeName();
+    if( sColorScheme.isEmpty() )
+    {
+        // RGB color and transparency value
+        aSeq[0].Name = "rgbClr";
+        aSeq[0].Value = css::uno::Any( rColor.getColor( rGraphicHelper, rPhClr ) );
+        aSeq[1].Name = "rgbClrTransparency";
+        aSeq[1].Value = css::uno::Any( rColor.getTransparency() );
+    }
+    else
+    {
+        // scheme color with name and transformations
+        aSeq[0].Name = "schemeClr";
+        aSeq[0].Value = css::uno::Any( sColorScheme );
+        aSeq[1].Name = "schemeClrTransformations";
+        aSeq[1].Value = css::uno::Any( rColor.getTransformations() );
+    }
+    return aSeq;
+}
+
+css::uno::Sequence< css::beans::PropertyValue > Shape3DProperties::getShape3DAttributes(
+        const GraphicHelper& rGraphicHelper, sal_Int32 rPhClr )
+{
+    css::uno::Sequence<css::beans::PropertyValue> aSeq(8);
     sal_Int32 nSize = 0;
     if( mnExtrusionH.has() )
     {
@@ -365,6 +390,18 @@ css::uno::Sequence< css::beans::PropertyValue > Shape3DProperties::getShape3DAtt
         aSeq[nSize].Value = css::uno::Any( getBevelAttributes( maBottomBevelProperties.use() ) );
         nSize++;
     }
+    if( maExtrusionColor.isUsed() )
+    {
+        aSeq[nSize].Name = "extrusionClr";
+        aSeq[nSize].Value = css::uno::Any( getColorAttributes( maExtrusionColor, rGraphicHelper, rPhClr ) );
+        nSize++;
+    }
+    if( maContourColor.isUsed() )
+    {
+        aSeq[nSize].Name = "contourClr";
+        aSeq[nSize].Value = css::uno::Any( getColorAttributes( maContourColor, rGraphicHelper, rPhClr ) );
+        nSize++;
+    }
     aSeq.realloc( nSize );
     return aSeq;
 }
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 17d2273..99deb82 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2409,6 +2409,7 @@ void DrawingML::WriteShape3DEffects( Reference< XPropertySet > xPropSet )
         return;
 
     bool bBevelTPresent = false, bBevelBPresent = false;
+    Sequence< PropertyValue > aExtrusionColorProps, aContourColorProps;
     sax_fastparser::FastAttributeList *aBevelTAttrList = mpFS->createAttrList();
     sax_fastparser::FastAttributeList *aBevelBAttrList = mpFS->createAttrList();
     sax_fastparser::FastAttributeList *aShape3DAttrList = mpFS->createAttrList();
@@ -2432,6 +2433,14 @@ void DrawingML::WriteShape3DEffects( Reference< XPropertySet > xPropSet )
             aShape3DProps[i].Value >>= sVal;
             aShape3DAttrList->add( XML_prstMaterial, OUStringToOString( sVal, RTL_TEXTENCODING_UTF8 ).getStr() );
         }
+        else if( aShape3DProps[i].Name == "extrusionClr" )
+        {
+            aShape3DProps[i].Value >>= aExtrusionColorProps;
+        }
+        else if( aShape3DProps[i].Name == "contourClr" )
+        {
+            aShape3DProps[i].Value >>= aContourColorProps;
+        }
         else if( aShape3DProps[i].Name == "bevelT" || aShape3DProps[i].Name == "bevelB" )
         {
             Sequence< PropertyValue > aBevelProps;
@@ -2485,6 +2494,56 @@ void DrawingML::WriteShape3DEffects( Reference< XPropertySet > xPropSet )
         sax_fastparser::XFastAttributeListRef xBevelAttrList( aBevelBAttrList );
         mpFS->singleElementNS( XML_a, XML_bevelB, xBevelAttrList );
     }
+    if( aExtrusionColorProps.getLength() > 0 )
+    {
+        OUString sSchemeClr;
+        sal_Int32 nColor, nTransparency;
+        Sequence< PropertyValue > aColorTransformations;
+        for( sal_Int32 i=0; i < aExtrusionColorProps.getLength(); ++i )
+        {
+            if( aExtrusionColorProps[i].Name == "schemeClr" )
+                aExtrusionColorProps[i].Value >>= sSchemeClr;
+            else if( aExtrusionColorProps[i].Name == "schemeClrTransformations" )
+                aExtrusionColorProps[i].Value >>= aColorTransformations;
+            else if( aExtrusionColorProps[i].Name == "rgbClr" )
+                aExtrusionColorProps[i].Value >>= nColor;
+            else if( aExtrusionColorProps[i].Name == "rgbClrTransparency" )
+                aExtrusionColorProps[i].Value >>= nTransparency;
+        }
+        mpFS->startElementNS( XML_a, XML_extrusionClr, FSEND );
+
+        if( sSchemeClr.isEmpty() )
+            WriteColor( nColor, MAX_PERCENT - ( PER_PERCENT * nTransparency ) );
+        else
+            WriteColor( sSchemeClr, aColorTransformations );
+
+        mpFS->endElementNS( XML_a, XML_extrusionClr );
+    }
+    if( aContourColorProps.getLength() > 0 )
+    {
+        OUString sSchemeClr;
+        sal_Int32 nColor, nTransparency;
+        Sequence< PropertyValue > aColorTransformations;
+        for( sal_Int32 i=0; i < aContourColorProps.getLength(); ++i )
+        {
+            if( aContourColorProps[i].Name == "schemeClr" )
+                aContourColorProps[i].Value >>= sSchemeClr;
+            else if( aContourColorProps[i].Name == "schemeClrTransformations" )
+                aContourColorProps[i].Value >>= aColorTransformations;
+            else if( aContourColorProps[i].Name == "rgbClr" )
+                aContourColorProps[i].Value >>= nColor;
+            else if( aContourColorProps[i].Name == "rgbClrTransparency" )
+                aContourColorProps[i].Value >>= nTransparency;
+        }
+        mpFS->startElementNS( XML_a, XML_contourClr, FSEND );
+
+        if( sSchemeClr.isEmpty() )
+            WriteColor( nColor, MAX_PERCENT - ( PER_PERCENT * nTransparency ) );
+        else
+            WriteColor( sSchemeClr, aContourColorProps );
+
+        mpFS->endElementNS( XML_a, XML_contourClr );
+    }
     mpFS->endElementNS( XML_a, XML_sp3d );
 }
 
diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
index 3a6782c..7996d64 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
@@ -1214,6 +1214,15 @@ DECLARE_OOXMLEXPORT_TEST(testShape3DEffectPreservation, "shape-3d-effect-preserv
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
             "prstMaterial", "metal");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:extrusionClr/a:schemeClr",
+            "val", "accent5");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:extrusionClr/a:schemeClr/a:lumMod",
+            "val", "40000");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:extrusionClr/a:schemeClr/a:lumOff",
+            "val", "60000");
 
     // third shape: colored countour and top and bottom bevel, plastic material
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
@@ -1237,6 +1246,9 @@ DECLARE_OOXMLEXPORT_TEST(testShape3DEffectPreservation, "shape-3d-effect-preserv
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:bevelB",
             "prst", "relaxedInset");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:contourClr/a:srgbClr",
+            "val", "3333ff");
 
     // fourth shape: wireframe
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
commit e8679367c9020c22a787f441c4d5a43647986e0f
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Mon May 12 11:46:50 2014 +0200

    ooxml: Preserve shape 3d effects: material
    
    Shapes 3D effects can specify a material like in the following example:
    
      <a:sp3d prstMaterial="metal" z="488950" />
    
    This patch preserves the prstMaterial attribute in the sp3d tag using
    the shape grab bag and modifies an existing unit test to add this
    check.
    
    Change-Id: I7be2dbbcc7e599d5f0fb8fa53ec1d180c18d8ebd

diff --git a/include/oox/drawingml/shape3dproperties.hxx b/include/oox/drawingml/shape3dproperties.hxx
index 32e0f27..e57ac94 100644
--- a/include/oox/drawingml/shape3dproperties.hxx
+++ b/include/oox/drawingml/shape3dproperties.hxx
@@ -63,6 +63,7 @@ struct Shape3DProperties
     OptValue< sal_Int32 > mnExtrusionH;
     OptValue< sal_Int32 > mnContourW;
     OptValue< sal_Int32 > mnShapeZ;
+    OptValue< sal_Int32 > mnMaterial;
 
     OptValue< BevelProperties > maTopBevelProperties;
     OptValue< BevelProperties > maBottomBevelProperties;
@@ -74,6 +75,7 @@ struct Shape3DProperties
     OUString            getLightRigName( sal_Int32 nElement );
     OUString            getLightRigDirName( sal_Int32 nElement );
     OUString            getBevelPresetTypeString( sal_Int32 nType );
+    OUString            getPresetMaterialTypeString( sal_Int32 nType );
 
     css::uno::Sequence< css::beans::PropertyValue > getCameraAttributes();
     css::uno::Sequence< css::beans::PropertyValue > getLightRigAttributes();
diff --git a/oox/source/drawingml/scene3dcontext.cxx b/oox/source/drawingml/scene3dcontext.cxx
index 124a741..ec9204b 100644
--- a/oox/source/drawingml/scene3dcontext.cxx
+++ b/oox/source/drawingml/scene3dcontext.cxx
@@ -78,6 +78,8 @@ Shape3DPropertiesContext::Shape3DPropertiesContext( ContextHandler2Helper& rPare
         mr3DProperties.mnContourW = rAttribs.getInteger( XML_contourW, 0 );
     if( rAttribs.hasAttribute( XML_z ) )
         mr3DProperties.mnShapeZ = rAttribs.getInteger( XML_z, 0 );
+    if( rAttribs.hasAttribute( XML_prstMaterial ) )
+        mr3DProperties.mnMaterial = rAttribs.getToken( XML_prstMaterial, XML_none );
 }
 
 ContextHandlerRef Shape3DPropertiesContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
diff --git a/oox/source/drawingml/shape3dproperties.cxx b/oox/source/drawingml/shape3dproperties.cxx
index 28d9079..9bb434a 100644
--- a/oox/source/drawingml/shape3dproperties.cxx
+++ b/oox/source/drawingml/shape3dproperties.cxx
@@ -192,6 +192,31 @@ OUString Shape3DProperties::getBevelPresetTypeString( sal_Int32 nType )
     return OUString();
 }
 
+OUString Shape3DProperties::getPresetMaterialTypeString( sal_Int32 nType )
+{
+    switch (nType)
+    {
+        case XML_legacyMatte:       return OUString("legacyMatte");
+        case XML_legacyPlastic:     return OUString("legacyPlastic");
+        case XML_legacyMetal:       return OUString("legacyMetal");
+        case XML_legacyWireframe:   return OUString("legacyWireframe");
+        case XML_matte:             return OUString("matte");
+        case XML_plastic:           return OUString("plastic");
+        case XML_metal:             return OUString("metal");
+        case XML_warmMatte:         return OUString("warmMatte");
+        case XML_translucentPowder: return OUString("translucentPowder");
+        case XML_powder:            return OUString("powder");
+        case XML_dkEdge:            return OUString("dkEdge");
+        case XML_softEdge:          return OUString("softEdge");
+        case XML_clear:             return OUString("clear");
+        case XML_flat:              return OUString("flat");
+        case XML_softmetal:         return OUString("softmetal");
+        case XML_none:              return OUString("none");
+    }
+    SAL_WARN( "oox.drawingml", "Shape3DProperties::getPresetMaterialTypeString - unexpected token" );
+    return OUString();
+}
+
 css::uno::Sequence< css::beans::PropertyValue > Shape3DProperties::getCameraAttributes()
 {
     css::uno::Sequence<css::beans::PropertyValue> aSeq(6);
@@ -302,7 +327,7 @@ css::uno::Sequence< css::beans::PropertyValue > Shape3DProperties::getBevelAttri
 
 css::uno::Sequence< css::beans::PropertyValue > Shape3DProperties::getShape3DAttributes()
 {
-    css::uno::Sequence<css::beans::PropertyValue> aSeq(5);
+    css::uno::Sequence<css::beans::PropertyValue> aSeq(6);
     sal_Int32 nSize = 0;
     if( mnExtrusionH.has() )
     {
@@ -322,6 +347,12 @@ css::uno::Sequence< css::beans::PropertyValue > Shape3DProperties::getShape3DAtt
         aSeq[nSize].Value = css::uno::Any( mnShapeZ.use() );
         nSize++;
     }
+    if( mnMaterial.has() )
+    {
+        aSeq[nSize].Name = "prstMaterial";
+        aSeq[nSize].Value = css::uno::Any( getPresetMaterialTypeString( mnMaterial.use() ) );
+        nSize++;
+    }
     if( maTopBevelProperties.has() )
     {
         aSeq[nSize].Name = "bevelT";
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 90000a1..17d2273 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2426,7 +2426,13 @@ void DrawingML::WriteShape3DEffects( Reference< XPropertySet > xPropSet )
                 nToken = XML_z;
             aShape3DAttrList->add( nToken, OString::number( nVal ).getStr() );
         }
-        if( aShape3DProps[i].Name == "bevelT" || aShape3DProps[i].Name == "bevelB" )
+        else if( aShape3DProps[i].Name == "prstMaterial" )
+        {
+            OUString sVal;
+            aShape3DProps[i].Value >>= sVal;
+            aShape3DAttrList->add( XML_prstMaterial, OUStringToOString( sVal, RTL_TEXTENCODING_UTF8 ).getStr() );
+        }
+        else if( aShape3DProps[i].Name == "bevelT" || aShape3DProps[i].Name == "bevelB" )
         {
             Sequence< PropertyValue > aBevelProps;
             aShape3DProps[i].Value >>= aBevelProps;
diff --git a/sw/qa/extras/ooxmlexport/data/shape-3d-effect-preservation.docx b/sw/qa/extras/ooxmlexport/data/shape-3d-effect-preservation.docx
index dd4a522..1e361bd 100644
Binary files a/sw/qa/extras/ooxmlexport/data/shape-3d-effect-preservation.docx and b/sw/qa/extras/ooxmlexport/data/shape-3d-effect-preservation.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
index 1bee43ea..3a6782c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
@@ -1191,7 +1191,7 @@ DECLARE_OOXMLEXPORT_TEST(testShape3DEffectPreservation, "shape-3d-effect-preserv
             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
             "z", "488950");
 
-    // second shape: extrusion with theme color, no camera or light rotation
+    // second shape: extrusion with theme color, no camera or light rotation, metal material
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera",
             "prst", "isometricLeftDown");
@@ -1211,12 +1211,18 @@ DECLARE_OOXMLEXPORT_TEST(testShape3DEffectPreservation, "shape-3d-effect-preserv
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
             "extrusionH", "25400");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
+            "prstMaterial", "metal");
 
-    // third shape: colored countour and top and bottom bevel
+    // third shape: colored countour and top and bottom bevel, plastic material
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
             "contourW", "50800");
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
+            "prstMaterial", "plastic");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:bevelT",
             "w", "139700");
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
@@ -1231,6 +1237,11 @@ DECLARE_OOXMLEXPORT_TEST(testShape3DEffectPreservation, "shape-3d-effect-preserv
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:bevelB",
             "prst", "relaxedInset");
+
+    // fourth shape: wireframe
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
+            "prstMaterial", "legacyWireframe");
 }
 
 DECLARE_OOXMLEXPORT_TEST(fdo77719, "fdo77719.docx")


More information about the Libreoffice-commits mailing list