diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-06-20 20:56:26 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-06-21 10:43:51 +0200 |
commit | 76a90e69d15104f76193647050948528caf6ff8d (patch) | |
tree | 577cf0865855c7f5e723ac0a6a2db1cd91046638 /oox | |
parent | 422ce23ea6cb7ddad6db97d752ffe5fdf6ce0d3a (diff) |
fdo#43641 oox: fix position/size of LineShapes inside lockedCanvas
Change-Id: Idf14d40f174ca87543a829ccfe22ed5cbb8e3cbc
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/shape.cxx | 18 | ||||
-rw-r--r-- | oox/source/drawingml/shapegroupcontext.cxx | 6 | ||||
-rw-r--r-- | oox/source/shape/LockedCanvasContext.cxx | 2 |
3 files changed, 25 insertions, 1 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index acb71281b6a7..0d3a2868dd3e 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -81,6 +81,7 @@ Shape::Shape( const sal_Char* pServiceName ) , mbFlipV( false ) , mbHidden( false ) , mbHiddenMasterShape( false ) +, mbLockedCanvas( false ) { if ( pServiceName ) msServiceName = OUString::createFromAscii( pServiceName ); @@ -115,6 +116,7 @@ Shape::Shape( const ShapePtr& pSourceShape ) , mbFlipV( pSourceShape->mbFlipV ) , mbHidden( pSourceShape->mbHidden ) , mbHiddenMasterShape( pSourceShape->mbHiddenMasterShape ) +, mbLockedCanvas( pSourceShape->mbLockedCanvas ) {} @@ -223,6 +225,16 @@ void Shape::addShape( } } +void Shape::setLockedCanvas(bool bLockedCanvas) +{ + mbLockedCanvas = bLockedCanvas; +} + +bool Shape::getLockedCanvas() +{ + return mbLockedCanvas; +} + void Shape::applyShapeReference( const Shape& rReferencedShape, bool bUseText ) { SAL_INFO("oox", "apply shape reference: " << rReferencedShape.msId << " to shape id: " << msId); @@ -560,6 +572,12 @@ Reference< XShape > Shape::createAndInsert( if( aServiceName != "com.sun.star.drawing.GroupShape" ) { PropertySet( xSet ).setProperties( aShapeProps ); + if (mbLockedCanvas && aServiceName == "com.sun.star.drawing.LineShape") + { + // It seems the position and size for lines inside a locked canvas is absolute. + mxShape->setPosition(awt::Point(aShapeRectHmm.X, aShapeRectHmm.Y)); + mxShape->setSize(awt::Size(aShapeRectHmm.Width, aShapeRectHmm.Height)); + } } if( bIsCustomShape ) diff --git a/oox/source/drawingml/shapegroupcontext.cxx b/oox/source/drawingml/shapegroupcontext.cxx index 308a5006c70d..831d72b6c5e7 100644 --- a/oox/source/drawingml/shapegroupcontext.cxx +++ b/oox/source/drawingml/shapegroupcontext.cxx @@ -86,7 +86,11 @@ Reference< XFastContextHandler > ShapeGroupContext::createFastChildContext( sal_ break; */ case XML_cxnSp: // connector shape - xRet.set( new ConnectorShapeContext( *this, mpGroupShapePtr, ShapePtr( new Shape( "com.sun.star.drawing.ConnectorShape" ) ) ) ); + { + ShapePtr pShape(new Shape("com.sun.star.drawing.ConnectorShape")); + pShape->setLockedCanvas(mpGroupShapePtr->getLockedCanvas()); + xRet.set( new ConnectorShapeContext( *this, mpGroupShapePtr, pShape ) ); + } break; case XML_grpSp: // group shape xRet.set( new ShapeGroupContext( *this, mpGroupShapePtr, ShapePtr( new Shape( "com.sun.star.drawing.GroupShape" ) ) ) ); diff --git a/oox/source/shape/LockedCanvasContext.cxx b/oox/source/shape/LockedCanvasContext.cxx index 9a7e9c0ff55c..0f1e9b4c8af8 100644 --- a/oox/source/shape/LockedCanvasContext.cxx +++ b/oox/source/shape/LockedCanvasContext.cxx @@ -44,6 +44,7 @@ uno::Reference< xml::sax::XFastContextHandler > LockedCanvasContext::createFastC { oox::drawingml::ShapePtr pMasterShape; mpShape.reset(new oox::drawingml::Shape("com.sun.star.drawing.CustomShape")); + mpShape->setLockedCanvas(true); xRet = new oox::drawingml::ShapeContext( *this, pMasterShape, mpShape ); } break; @@ -51,6 +52,7 @@ uno::Reference< xml::sax::XFastContextHandler > LockedCanvasContext::createFastC { oox::drawingml::ShapePtr pMasterShape; mpShape.reset(new oox::drawingml::Shape("com.sun.star.drawing.GroupShape")); + mpShape->setLockedCanvas(true); xRet = new oox::drawingml::ShapeGroupContext( *this, pMasterShape, mpShape ); } break; |