diff options
author | Jacobo Aragunde Pérez <jaragunde@igalia.com> | 2014-05-06 12:45:54 +0200 |
---|---|---|
committer | Jacobo Aragunde Pérez <jaragunde@igalia.com> | 2014-05-06 16:32:28 +0200 |
commit | 36e22e83a1ca3106d6ef3fbb6ba066a447a65601 (patch) | |
tree | 6c51dd7865be3f57dabe33412c87294c561a51af /oox/source/export | |
parent | 1b7773cb071c7bbf60ea023551f35375b6120d4a (diff) |
oox: preserve camera rotation on shape 3D effects.
Camera options in shape 3D effects can have rotation settings like in
the following example:
<a:camera prst="perspectiveRelaxedModerately" zoom="150000">
<a:rot lat="19490639" lon="0" rev="12900001"/>
</a:camera>
This patch preserves the a:rot tag and its attributes using the
shape grab bag. We created the class Scene3DRotationPropertiesContext
to be piled on top of a Scene3DPropertiesContext and process the
contents of the child item. It also adds a unit test for this case.
Change-Id: Id6bf58ad05fe5b49061619b6750ed0658badc9af
Diffstat (limited to 'oox/source/export')
-rw-r--r-- | oox/source/export/drawingml.cxx | 22 |
1 files changed, 22 insertions, 0 deletions
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 |