diff options
author | Muthu Subramanian <sumuthu@suse.com> | 2012-09-06 12:34:14 +0530 |
---|---|---|
committer | Muthu Subramanian <sumuthu@suse.com> | 2012-09-06 12:42:06 +0530 |
commit | 5ca197ce7a2a845933e17fc90195c929cbc7e062 (patch) | |
tree | bac9d22e237acb5315ecd77da7e19d0e5cefb30c /oox/source/drawingml/transform2dcontext.cxx | |
parent | c75af8578d921040e1baf8414edd7239969bcd45 (diff) |
n#771549: Import text offsets in shapes.
* Also fixed a bug where the (offset) increment was conditional.
* Reusing Transform2D for <txXfrm> as well.
* This is a kind of hack where the margins are adjusted
for the give offset values.
Diffstat (limited to 'oox/source/drawingml/transform2dcontext.cxx')
-rw-r--r-- | oox/source/drawingml/transform2dcontext.cxx | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/oox/source/drawingml/transform2dcontext.cxx b/oox/source/drawingml/transform2dcontext.cxx index 9ded1df5080e..d35c5d3c921a 100644 --- a/oox/source/drawingml/transform2dcontext.cxx +++ b/oox/source/drawingml/transform2dcontext.cxx @@ -20,6 +20,7 @@ #include "oox/drawingml/transform2dcontext.hxx" #include "oox/helper/attributelist.hxx" #include "oox/drawingml/shape.hxx" +#include "oox/drawingml/textbody.hxx" using ::com::sun::star::awt::Point; using ::com::sun::star::awt::Size; @@ -36,17 +37,45 @@ namespace drawingml { // ============================================================================ /** context to import a CT_Transform2D */ -Transform2DContext::Transform2DContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, Shape& rShape ) throw() +Transform2DContext::Transform2DContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, Shape& rShape, bool btxXfrm ) throw() : ContextHandler( rParent ) , mrShape( rShape ) +, mbtxXfrm ( btxXfrm ) { AttributeList aAttributeList( xAttribs ); - mrShape.setRotation( aAttributeList.getInteger( XML_rot, 0 ) ); // 60000ths of a degree Positive angles are clockwise; negative angles are counter-clockwise - mrShape.setFlip( aAttributeList.getBool( XML_flipH, sal_False ), aAttributeList.getBool( XML_flipV, sal_False ) ); + if( !btxXfrm ) + { + mrShape.setRotation( aAttributeList.getInteger( XML_rot, 0 ) ); // 60000ths of a degree Positive angles are clockwise; negative angles are counter-clockwise + mrShape.setFlip( aAttributeList.getBool( XML_flipH, sal_False ), aAttributeList.getBool( XML_flipV, sal_False ) ); + } + else + { + mrShape.getTextBody()->getTextProperties().moRotation = aAttributeList.getInteger( XML_rot ); + } } Reference< XFastContextHandler > Transform2DContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) { + if( mbtxXfrm ) + { + switch( aElementToken ) + { + case A_TOKEN( off ): + { + OUString sXValue = xAttribs->getOptionalValue( XML_x ); + OUString sYValue = xAttribs->getOptionalValue( XML_y ); + if( !sXValue.isEmpty() ) + mrShape.getTextBody()->getTextProperties().moTextOffX = GetCoordinate( sXValue.toInt32() - mrShape.getPosition().X ); + if( !sYValue.isEmpty() ) + mrShape.getTextBody()->getTextProperties().moTextOffY = GetCoordinate( sYValue.toInt32() - mrShape.getPosition().Y ); + } + break; + case A_TOKEN( ext ): + break; + } + return 0; + } + switch( aElementToken ) { case A_TOKEN( off ): // horz/vert translation |