summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-06-20 20:56:26 +0200
committerFridrich Strba <fridrich@documentfoundation.org>2013-06-23 04:19:14 +0000
commit34d278a5e6c40dd812480c09754fa1bcc53a71d6 (patch)
treedf05a9d03666cd42e04239a885fa3b71159ee6a6
parent85b05fac54b1b9ed87f5603001a4885a14f3a5ab (diff)
fdo#43641 oox: fix position/size of LineShapes inside lockedCanvas
Change-Id: Idf14d40f174ca87543a829ccfe22ed5cbb8e3cbc (cherry picked from commit 6ada1ddecd98a616114cb36651c0f0f48c6dd3c3) Reviewed-on: https://gerrit.libreoffice.org/4423 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
-rw-r--r--include/oox/drawingml/shape.hxx3
-rw-r--r--oox/source/drawingml/shape.cxx18
-rw-r--r--oox/source/drawingml/shapegroupcontext.cxx6
-rw-r--r--oox/source/shape/LockedCanvasContext.cxx2
4 files changed, 28 insertions, 1 deletions
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index f8a58ec5340b..94c8342ef465 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -172,6 +172,8 @@ public:
const ::std::vector<OUString>&
getExtDrawings() { return maExtDrawings; }
void addExtDrawingRelId( const OUString &rRelId ) { maExtDrawings.push_back( rRelId ); }
+ void setLockedCanvas(bool bLockedCanvas);
+ bool getLockedCanvas();
protected:
@@ -262,6 +264,7 @@ private:
sal_Bool mbHiddenMasterShape; // master shapes can be hidden in layout slides
// we need separate flag because we don't want
// to propagate it when applying reference shape
+ bool mbLockedCanvas; ///< Is this shape part of a locked canvas?
};
// ============================================================================
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;