diff options
-rw-r--r-- | include/oox/drawingml/shape3dproperties.hxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/scene3dcontext.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/shape3dproperties.cxx | 33 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 8 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/shape-3d-effect-preservation.docx | bin | 18317 -> 19676 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx | 15 |
6 files changed, 56 insertions, 4 deletions
diff --git a/include/oox/drawingml/shape3dproperties.hxx b/include/oox/drawingml/shape3dproperties.hxx index 32e0f27ae56b..e57ac942bf8a 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 124a74183f48..ec9204b94a25 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 28d907922b31..9bb434ab3718 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 90000a1b78ea..17d22737dce9 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 Binary files differindex dd4a522aad12..1e361bd4e4ad 100644 --- a/sw/qa/extras/ooxmlexport/data/shape-3d-effect-preservation.docx +++ b/sw/qa/extras/ooxmlexport/data/shape-3d-effect-preservation.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx index 1bee43eaabf9..3a6782cea8cc 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") |