[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - include/oox oox/source
Miklos Vajna
vmiklos at suse.cz
Sat Jun 22 21:19:33 PDT 2013
include/oox/drawingml/shape.hxx | 3 +++
oox/source/drawingml/shape.cxx | 18 ++++++++++++++++++
oox/source/drawingml/shapegroupcontext.cxx | 6 +++++-
oox/source/shape/LockedCanvasContext.cxx | 2 ++
4 files changed, 28 insertions(+), 1 deletion(-)
New commits:
commit 34d278a5e6c40dd812480c09754fa1bcc53a71d6
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Thu Jun 20 20:56:26 2013 +0200
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 at documentfoundation.org>
Tested-by: Fridrich Strba <fridrich at documentfoundation.org>
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index f8a58ec..94c8342 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 acb7128..0d3a286 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 308a500..831d72b 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 9a7e9c0..0f1e9b4 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;
More information about the Libreoffice-commits
mailing list