include/oox/drawingml/shape.hxx | 3 +++ oox/source/drawingml/shape.cxx | 18 ++++++++++++++++++ oox/source/drawingml/shapegroupcontext.cxx | 6 +++++- oox/source/shape/LockedCanvasContext.cxx | 2 ++ sw/qa/extras/ooxmlimport/data/fdo43641.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 13 +++++++++++++ 6 files changed, 41 insertions(+), 1 deletion(-)
New commits: commit 832612bb6bd013cf68a64e33827158f96e6d03d3 Author: Miklos Vajna <vmik...@suse.cz> Date: Fri Jun 21 10:31:19 2013 +0200 fdo#43641 testcase Change-Id: I3426c7c23eb23fa7f91320ac036b0eb565bbc330 diff --git a/sw/qa/extras/ooxmlimport/data/fdo43641.docx b/sw/qa/extras/ooxmlimport/data/fdo43641.docx new file mode 100644 index 0000000..90622f8 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo43641.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 676fbbb..4f23d92 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -43,6 +43,7 @@ #include <bordertest.hxx> #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) +#define EMU_TO_MM100(EMU) (EMU / 360) class Test : public SwModelTestBase { @@ -119,6 +120,7 @@ public: void testN820509(); void testN820788(); void testN820504(); + void testFdo43641(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -205,6 +207,7 @@ void Test::run() {"n820509.docx", &Test::testN820509}, {"n820788.docx", &Test::testN820788}, {"n820504.docx", &Test::testN820504}, + {"fdo43641.docx", &Test::testFdo43641}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -1449,6 +1452,16 @@ void Test::testN820504() CPPUNIT_ASSERT_EQUAL(sal_Int32(4040635), getProperty<sal_Int32>(xStyle, "CharColor")); } +void Test::testFdo43641() +{ + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xGroupShape(xDraws->getByIndex(0), uno::UNO_QUERY); + uno::Reference<drawing::XShape> xLine(xGroupShape->getByIndex(1), uno::UNO_QUERY); + // This was 2200, not 2579 in mm100, i.e. the size of the line shape was incorrect. + CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(928694)), xLine->getSize().Width); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit 76a90e69d15104f76193647050948528caf6ff8d Author: Miklos Vajna <vmik...@suse.cz> Date: Thu Jun 20 20:56:26 2013 +0200 fdo#43641 oox: fix position/size of LineShapes inside lockedCanvas Change-Id: Idf14d40f174ca87543a829ccfe22ed5cbb8e3cbc 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits