From ccfbb5af4f24a0e12f7f78c801f32e6564a85d9e Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Thu, 18 Sep 2014 22:38:26 -0400 Subject: Scope level reduction. Change-Id: I4e2f25cdb9aef851724073d32e96c76c3416de3c --- chart2/source/view/main/ShapeFactory.cxx | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'chart2') diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx index 7cfef7eac9f4..865c95e8257c 100644 --- a/chart2/source/view/main/ShapeFactory.cxx +++ b/chart2/source/view/main/ShapeFactory.cxx @@ -63,19 +63,21 @@ namespace chart uno::Reference< drawing::XShapes > ShapeFactory::getOrCreateChartRootShape( const uno::Reference< drawing::XDrawPage>& xDrawPage ) { - uno::Reference< drawing::XShapes > xRet( ShapeFactory::getChartRootShape( xDrawPage ) ); - if( !xRet.is() ) - { - uno::Reference< drawing::XShape > xShape( m_xShapeFactory->createInstance( - "com.sun.star.drawing.GroupShape" ), uno::UNO_QUERY ); - uno::Reference< drawing::XShapes2 > xShapes2(xDrawPage, uno::UNO_QUERY_THROW); - xShapes2->addBottom(xShape); + uno::Reference xRet = ShapeFactory::getChartRootShape(xDrawPage); + if (xRet.is()) + return xRet; - setShapeName( xShape, "com.sun.star.chart2.shapes" ); - xShape->setSize(awt::Size(0,0)); + // Create a new root shape and set it to the bottom of the page. The root + // shape is identified by having the name com.sun.star.chart2.shapes. + uno::Reference xShape( + m_xShapeFactory->createInstance("com.sun.star.drawing.GroupShape"), uno::UNO_QUERY); + uno::Reference xShapes2(xDrawPage, uno::UNO_QUERY_THROW); + xShapes2->addBottom(xShape); - xRet = uno::Reference( xShape, uno::UNO_QUERY ); - } + setShapeName(xShape, "com.sun.star.chart2.shapes"); + xShape->setSize(awt::Size(0,0)); + + xRet = uno::Reference(xShape, uno::UNO_QUERY); return xRet; } -- cgit