Kaydet (Commit) a66097b7 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

only one createInstance call left

Change-Id: Iabefaea11e9190f84cecc1991585c4a958802fae
üst a3604b24
...@@ -231,37 +231,33 @@ void CandleStickChart::createShapes() ...@@ -231,37 +231,33 @@ void CandleStickChart::createShapes()
//create min-max line //create min-max line
if( isValidPosition(aPosMiddleMinimum) && isValidPosition(aPosMiddleMaximum) ) if( isValidPosition(aPosMiddleMinimum) && isValidPosition(aPosMiddleMaximum) )
{ {
uno::Reference< drawing::XShape > xShape( drawing::PolyPolygonShape3D aPoly;
m_xShapeFactory->createInstance( "com.sun.star.drawing.PolyLineShape" ), sal_Int32 nLineIndex =0;
uno::UNO_QUERY ); AddPointToPoly( aPoly, aPosMiddleMinimum, nLineIndex);
xPointGroupShape_Shapes->add(xShape); AddPointToPoly( aPoly, aPosMiddleMaximum, nLineIndex);
uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
if(xProp.is()) uno::Reference< drawing::XShape > xShape =
{ m_pShapeFactory->createLine2D( xPointGroupShape_Shapes,
drawing::PolyPolygonShape3D aPoly; PolyToPointSequence(aPoly), NULL);
sal_Int32 nLineIndex =0;
AddPointToPoly( aPoly, aPosMiddleMinimum, nLineIndex);
AddPointToPoly( aPoly, aPosMiddleMaximum, nLineIndex);
xProp->setPropertyValue( UNO_NAME_POLYPOLYGON, uno::makeAny( PolyToPointSequence(aPoly) ) );
}
this->setMappedProperties( xShape, xPointProp, PropertyMapper::getPropertyNameMapForLineSeriesProperties() ); this->setMappedProperties( xShape, xPointProp, PropertyMapper::getPropertyNameMapForLineSeriesProperties() );
} }
//create first-last shape //create first-last shape
if(bJapaneseStyle && isValidPosition(aPosLeftFirst) && isValidPosition(aPosRightLast) ) 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; drawing::Direction3D aDiff = aPosRightLast-aPosLeftFirst;
awt::Size aAWTSize( Direction3DToAWTSize( aDiff )); awt::Size aAWTSize( Direction3DToAWTSize( aDiff ));
// workaround for bug in drawing: if height is 0 the box gets infinitely large // workaround for bug in drawing: if height is 0 the box gets infinitely large
if( aAWTSize.Height == 0 ) if( aAWTSize.Height == 0 )
aAWTSize.Height = 1; 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 ); uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
if(xProp.is()) if(xProp.is())
...@@ -292,14 +288,12 @@ void CandleStickChart::createShapes() ...@@ -292,14 +288,12 @@ void CandleStickChart::createShapes()
if( aPoly.SequenceX.getLength() ) if( aPoly.SequenceX.getLength() )
{ {
uno::Reference< drawing::XShape > xShape( uno::Reference< drawing::XShape > xShape =
m_xShapeFactory->createInstance( "com.sun.star.drawing.PolyLineShape" ), m_pShapeFactory->createLine2D( xPointGroupShape_Shapes,
uno::UNO_QUERY ); PolyToPointSequence(aPoly), NULL );
xPointGroupShape_Shapes->add(xShape);
uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY ); uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
if(xProp.is()) if(xProp.is())
{ {
xProp->setPropertyValue( UNO_NAME_POLYPOLYGON, uno::makeAny( PolyToPointSequence(aPoly) ) );
this->setMappedProperties( xShape, xPointProp, PropertyMapper::getPropertyNameMapForLineSeriesProperties() ); this->setMappedProperties( xShape, xPointProp, PropertyMapper::getPropertyNameMapForLineSeriesProperties() );
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment