diff options
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/scene3dcontext.cxx | 24 | ||||
-rw-r--r-- | oox/source/drawingml/shape3dproperties.cxx | 20 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 22 |
3 files changed, 63 insertions, 3 deletions
diff --git a/oox/source/drawingml/scene3dcontext.cxx b/oox/source/drawingml/scene3dcontext.cxx index c9855e116f7e..21c564cd5a62 100644 --- a/oox/source/drawingml/scene3dcontext.cxx +++ b/oox/source/drawingml/scene3dcontext.cxx @@ -52,8 +52,9 @@ ContextHandlerRef Scene3DPropertiesContext::onCreateContext( sal_Int32 aElementT mr3DProperties.mfZoom = rAttribs.getInteger( XML_zoom, 100000 ) / 100000.0; if( rAttribs.hasAttribute( XML_prst ) ) mr3DProperties.mnPreset = rAttribs.getToken( XML_prst, XML_none ); - // TODO: nested element XML_rot - break; + + return new Scene3DRotationPropertiesContext( *this, mr3DProperties.maCameraRotation ); + case A_TOKEN( lightRig ): mr3DProperties.mnLightRigDirection = rAttribs.getToken( XML_dir, XML_none ); mr3DProperties.mnLightRigType = rAttribs.getToken( XML_rig, XML_none ); @@ -66,6 +67,25 @@ ContextHandlerRef Scene3DPropertiesContext::onCreateContext( sal_Int32 aElementT return 0; } +Scene3DRotationPropertiesContext::Scene3DRotationPropertiesContext( ContextHandler2Helper& rParent, RotationProperties& rRotationProperties ) throw() +: ContextHandler2( rParent ) +, mrRotationProperties( rRotationProperties ) +{ +} + +ContextHandlerRef Scene3DRotationPropertiesContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) +{ + switch( aElementToken ) + { + case A_TOKEN( rot ): + mrRotationProperties.mnLatitude = rAttribs.getInteger( XML_lat, 0 ); + mrRotationProperties.mnLongitude = rAttribs.getInteger( XML_lon, 0 ); + mrRotationProperties.mnRevolution = rAttribs.getInteger( XML_rev, 0 ); + break; + } + return 0; +} + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/shape3dproperties.cxx b/oox/source/drawingml/shape3dproperties.cxx index 86498aa3507e..853ed4643285 100644 --- a/oox/source/drawingml/shape3dproperties.cxx +++ b/oox/source/drawingml/shape3dproperties.cxx @@ -120,7 +120,7 @@ OUString Shape3DProperties::getCameraPrstName( sal_Int32 nElement ) css::uno::Sequence< css::beans::PropertyValue > Shape3DProperties::getCameraAttributes() { - css::uno::Sequence<css::beans::PropertyValue> aSeq(3); + css::uno::Sequence<css::beans::PropertyValue> aSeq(6); sal_Int32 nSize = 0; if( mfFieldOfVision.has() ) { @@ -140,6 +140,24 @@ css::uno::Sequence< css::beans::PropertyValue > Shape3DProperties::getCameraAttr aSeq[nSize].Value = css::uno::Any( getCameraPrstName( mnPreset.use() ) ); nSize++; } + if( maCameraRotation.mnLatitude.has() ) + { + aSeq[nSize].Name = "rotLat"; + aSeq[nSize].Value = css::uno::Any( maCameraRotation.mnLatitude.use() ); + nSize++; + } + if( maCameraRotation.mnLongitude.has() ) + { + aSeq[nSize].Name = "rotLon"; + aSeq[nSize].Value = css::uno::Any( maCameraRotation.mnLongitude.use() ); + nSize++; + } + if( maCameraRotation.mnRevolution.has() ) + { + aSeq[nSize].Name = "rotRev"; + aSeq[nSize].Value = css::uno::Any( maCameraRotation.mnRevolution.use() ); + nSize++; + } aSeq.realloc( nSize ); return aSeq; } diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 6f61016bc387..5d08216cb1e3 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2288,7 +2288,9 @@ void DrawingML::WriteShape3DEffects( Reference< XPropertySet > xPropSet ) if( aEffectProps.getLength() == 0 ) return; + bool bCameraRotationPresent = false; sax_fastparser::FastAttributeList *aCameraAttrList = mpFS->createAttrList(); + sax_fastparser::FastAttributeList *aCameraRotationAttrList = mpFS->createAttrList(); for( sal_Int32 i=0; i < aEffectProps.getLength(); ++i ) { if( aEffectProps[i].Name == "prst" ) @@ -2309,12 +2311,32 @@ void DrawingML::WriteShape3DEffects( Reference< XPropertySet > xPropSet ) aEffectProps[i].Value >>= fVal; aCameraAttrList->add( XML_zoom, OString::number( fVal * 100000 ).getStr() ); } + else if( aEffectProps[i].Name == "rotLat" || + aEffectProps[i].Name == "rotLon" || + aEffectProps[i].Name == "rotRev" ) + { + sal_Int32 nVal = 0, nToken = XML_none; + aEffectProps[i].Value >>= nVal; + if( aEffectProps[i].Name == "rotLat" ) + nToken = XML_lat; + else if( aEffectProps[i].Name == "rotLon" ) + nToken = XML_lon; + else if( aEffectProps[i].Name == "rotRev" ) + nToken = XML_rev; + aCameraRotationAttrList->add( nToken, OString::number( nVal ).getStr() ); + bCameraRotationPresent = true; + } } mpFS->startElementNS( XML_a, XML_scene3d, FSEND ); sax_fastparser::XFastAttributeListRef xAttrList( aCameraAttrList ); mpFS->startElementNS( XML_a, XML_camera, xAttrList ); + if( bCameraRotationPresent ) + { + sax_fastparser::XFastAttributeListRef xRotAttrList( aCameraRotationAttrList ); + mpFS->singleElementNS( XML_a, XML_rot, xRotAttrList ); + } mpFS->endElementNS( XML_a, XML_camera ); // a:lightRig with Word default values - Word won't open the document if this is not present |