diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-10-08 00:17:37 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-11-19 13:47:34 +0100 |
commit | a66097b7f92cb91fdc07d3e04bd9eb0d4a821369 (patch) | |
tree | 28241f468c50c4482f167191fc64bb7f03c82d6b /chart2 | |
parent | a3604b24962ffdb02dee78a13db9eb9d977de376 (diff) |
only one createInstance call left
Change-Id: Iabefaea11e9190f84cecc1991585c4a958802fae
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/view/charttypes/CandleStickChart.cxx | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/chart2/source/view/charttypes/CandleStickChart.cxx b/chart2/source/view/charttypes/CandleStickChart.cxx index 88cb2c2c9035..3c62b264e9bf 100644 --- a/chart2/source/view/charttypes/CandleStickChart.cxx +++ b/chart2/source/view/charttypes/CandleStickChart.cxx @@ -231,37 +231,33 @@ void CandleStickChart::createShapes() //create min-max line if( isValidPosition(aPosMiddleMinimum) && isValidPosition(aPosMiddleMaximum) ) { - uno::Reference< drawing::XShape > xShape( - m_xShapeFactory->createInstance( "com.sun.star.drawing.PolyLineShape" ), - uno::UNO_QUERY ); - xPointGroupShape_Shapes->add(xShape); - uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY ); - if(xProp.is()) - { - drawing::PolyPolygonShape3D aPoly; - sal_Int32 nLineIndex =0; - AddPointToPoly( aPoly, aPosMiddleMinimum, nLineIndex); - AddPointToPoly( aPoly, aPosMiddleMaximum, nLineIndex); - xProp->setPropertyValue( UNO_NAME_POLYPOLYGON, uno::makeAny( PolyToPointSequence(aPoly) ) ); - } + drawing::PolyPolygonShape3D aPoly; + sal_Int32 nLineIndex =0; + AddPointToPoly( aPoly, aPosMiddleMinimum, nLineIndex); + AddPointToPoly( aPoly, aPosMiddleMaximum, nLineIndex); + + uno::Reference< drawing::XShape > xShape = + m_pShapeFactory->createLine2D( xPointGroupShape_Shapes, + PolyToPointSequence(aPoly), NULL); this->setMappedProperties( xShape, xPointProp, PropertyMapper::getPropertyNameMapForLineSeriesProperties() ); } //create first-last shape if(bJapaneseStyle && isValidPosition(aPosLeftFirst) && isValidPosition(aPosRightLast) ) { - uno::Reference< drawing::XShape > xShape( - m_xShapeFactory->createInstance( "com.sun.star.drawing.RectangleShape" ), - uno::UNO_QUERY ); - xLossGainTarget->add(xShape); - - xShape->setPosition( Position3DToAWTPoint( aPosLeftFirst ) ); drawing::Direction3D aDiff = aPosRightLast-aPosLeftFirst; awt::Size aAWTSize( Direction3DToAWTSize( aDiff )); // workaround for bug in drawing: if height is 0 the box gets infinitely large if( aAWTSize.Height == 0 ) aAWTSize.Height = 1; - xShape->setSize( aAWTSize ); + + tNameSequence aNames; + tAnySequence aValues; + + uno::Reference< drawing::XShape > xShape = + m_pShapeFactory->createRectangle( xLossGainTarget, + aAWTSize, Position3DToAWTPoint( aPosLeftFirst ), + aNames, aValues); uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY ); if(xProp.is()) @@ -292,14 +288,12 @@ void CandleStickChart::createShapes() if( aPoly.SequenceX.getLength() ) { - uno::Reference< drawing::XShape > xShape( - m_xShapeFactory->createInstance( "com.sun.star.drawing.PolyLineShape" ), - uno::UNO_QUERY ); - xPointGroupShape_Shapes->add(xShape); + uno::Reference< drawing::XShape > xShape = + m_pShapeFactory->createLine2D( xPointGroupShape_Shapes, + PolyToPointSequence(aPoly), NULL ); uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY ); if(xProp.is()) { - xProp->setPropertyValue( UNO_NAME_POLYPOLYGON, uno::makeAny( PolyToPointSequence(aPoly) ) ); this->setMappedProperties( xShape, xPointProp, PropertyMapper::getPropertyNameMapForLineSeriesProperties() ); } } |