summaryrefslogtreecommitdiff
path: root/chart2/source/view/charttypes/AreaChart.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/view/charttypes/AreaChart.cxx')
-rw-r--r--chart2/source/view/charttypes/AreaChart.cxx276
1 files changed, 114 insertions, 162 deletions
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
index 0d0105246b0a..3bab48585148 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -24,25 +24,25 @@
#include <ExplicitCategoriesProvider.hxx>
#include <ObjectIdentifier.hxx>
#include "Splines.hxx"
+#include <ChartType.hxx>
#include <ChartTypeHelper.hxx>
#include <LabelPositionHelper.hxx>
#include <Clipping.hxx>
#include <Stripe.hxx>
#include <DateHelper.hxx>
#include <unonames.hxx>
-#include <ConfigAccess.hxx>
#include <com/sun/star/chart2/Symbol.hpp>
#include <com/sun/star/chart/DataLabelPlacement.hpp>
#include <com/sun/star/chart/MissingValueTreatment.hpp>
#include <sal/log.hxx>
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
-#include <com/sun/star/drawing/DoubleSequence.hpp>
-#include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <officecfg/Office/Compatibility.hxx>
+#include <officecfg/Office/Chart.hxx>
#include <limits>
@@ -51,13 +51,12 @@ namespace chart
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
-AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel
+AreaChart::AreaChart( const rtl::Reference<ChartType>& xChartTypeModel
, sal_Int32 nDimensionCount
, bool bCategoryXAxis
, bool bNoArea
)
: VSeriesPlotter( xChartTypeModel, nDimensionCount, bCategoryXAxis )
- , m_pMainPosHelper(new PlottingPositionHelper())
, m_bArea(!bNoArea)
, m_bLine(bNoArea)
, m_bSymbol( ChartTypeHelper::isSupportingSymbolProperties(xChartTypeModel,nDimensionCount) )
@@ -65,19 +64,19 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel
, m_nCurveResolution(20)
, m_nSplineOrder(3)
{
+ PlotterBase::m_pPosHelper = &m_aMainPosHelper;
+ VSeriesPlotter::m_pMainPosHelper = &m_aMainPosHelper;
+
m_pMainPosHelper->AllowShiftXAxisPos(true);
m_pMainPosHelper->AllowShiftZAxisPos(true);
- PlotterBase::m_pPosHelper = m_pMainPosHelper.get();
- VSeriesPlotter::m_pMainPosHelper = m_pMainPosHelper.get();
-
try
{
- if( m_xChartTypeModelProps.is() )
+ if( m_xChartTypeModel.is() )
{
- m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_CURVE_STYLE) >>= m_eCurveStyle;
- m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_CURVE_RESOLUTION) >>= m_nCurveResolution;
- m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_SPLINE_ORDER) >>= m_nSplineOrder;
+ m_xChartTypeModel->getPropertyValue(CHART_UNONAME_CURVE_STYLE) >>= m_eCurveStyle;
+ m_xChartTypeModel->getPropertyValue(CHART_UNONAME_CURVE_RESOLUTION) >>= m_nCurveResolution;
+ m_xChartTypeModel->getPropertyValue(CHART_UNONAME_SPLINE_ORDER) >>= m_nSplineOrder;
}
}
catch( uno::Exception& e )
@@ -154,126 +153,95 @@ void AreaChart::addSeries( std::unique_ptr<VDataSeries> pSeries, sal_Int32 zSlot
VSeriesPlotter::addSeries( std::move(pSeries), zSlot, xSlot, ySlot );
}
-static void lcl_removeDuplicatePoints( drawing::PolyPolygonShape3D& rPolyPoly, PlottingPositionHelper& rPosHelper )
+static void lcl_removeDuplicatePoints( std::vector<std::vector<css::drawing::Position3D>>& rPolyPoly, PlottingPositionHelper& rPosHelper )
{
- sal_Int32 nPolyCount = rPolyPoly.SequenceX.getLength();
+ sal_Int32 nPolyCount = rPolyPoly.size();
if(!nPolyCount)
return;
- drawing::PolyPolygonShape3D aTmp;
- aTmp.SequenceX.realloc(nPolyCount);
- aTmp.SequenceY.realloc(nPolyCount);
- aTmp.SequenceZ.realloc(nPolyCount);
+ // TODO we could do with without a temporary array
+ std::vector<std::vector<css::drawing::Position3D>> aTmp;
+ aTmp.resize(nPolyCount);
for( sal_Int32 nPolygonIndex = 0; nPolygonIndex<nPolyCount; nPolygonIndex++ )
{
- drawing::DoubleSequence* pOuterSourceX = &rPolyPoly.SequenceX.getArray()[nPolygonIndex];
- drawing::DoubleSequence* pOuterSourceY = &rPolyPoly.SequenceY.getArray()[nPolygonIndex];
- drawing::DoubleSequence* pOuterSourceZ = &rPolyPoly.SequenceZ.getArray()[nPolygonIndex];
-
- drawing::DoubleSequence* pOuterTargetX = &aTmp.SequenceX.getArray()[nPolygonIndex];
- drawing::DoubleSequence* pOuterTargetY = &aTmp.SequenceY.getArray()[nPolygonIndex];
- drawing::DoubleSequence* pOuterTargetZ = &aTmp.SequenceZ.getArray()[nPolygonIndex];
+ std::vector<css::drawing::Position3D>* pOuterSource = &rPolyPoly[nPolygonIndex];
+ std::vector<css::drawing::Position3D>* pOuterTarget = &aTmp[nPolygonIndex];
- sal_Int32 nPointCount = pOuterSourceX->getLength();
+ sal_Int32 nPointCount = pOuterSource->size();
if( !nPointCount )
continue;
- pOuterTargetX->realloc(nPointCount);
- pOuterTargetY->realloc(nPointCount);
- pOuterTargetZ->realloc(nPointCount);
+ pOuterTarget->resize(nPointCount);
- double* pSourceX = pOuterSourceX->getArray();
- double* pSourceY = pOuterSourceY->getArray();
- double* pSourceZ = pOuterSourceZ->getArray();
-
- double* pTargetX = pOuterTargetX->getArray();
- double* pTargetY = pOuterTargetY->getArray();
- double* pTargetZ = pOuterTargetZ->getArray();
+ css::drawing::Position3D* pSource = pOuterSource->data();
+ css::drawing::Position3D* pTarget = pOuterTarget->data();
//copy first point
- *pTargetX=*pSourceX++;
- *pTargetY=*pSourceY++;
- *pTargetZ=*pSourceZ++;
+ *pTarget=*pSource++;
sal_Int32 nTargetPointCount=1;
for( sal_Int32 nSource=1; nSource<nPointCount; nSource++ )
{
- if( !rPosHelper.isSameForGivenResolution( *pTargetX, *pTargetY, *pTargetZ
- , *pSourceX, *pSourceY, *pSourceZ ) )
+ if( !rPosHelper.isSameForGivenResolution( pTarget->PositionX, pTarget->PositionY, pTarget->PositionZ
+ , pSource->PositionX, pSource->PositionY, pSource->PositionZ ) )
{
- pTargetX++; pTargetY++; pTargetZ++;
- *pTargetX=*pSourceX;
- *pTargetY=*pSourceY;
- *pTargetZ=*pSourceZ;
+ pTarget++;
+ *pTarget=*pSource;
nTargetPointCount++;
}
- pSourceX++; pSourceY++; pSourceZ++;
+ pSource++;
}
//free unused space
if( nTargetPointCount<nPointCount )
{
- pOuterTargetX->realloc(nTargetPointCount);
- pOuterTargetY->realloc(nTargetPointCount);
- pOuterTargetZ->realloc(nTargetPointCount);
+ pOuterTarget->resize(nTargetPointCount);
}
- pOuterSourceX->realloc(0);
- pOuterSourceY->realloc(0);
- pOuterSourceZ->realloc(0);
+ pOuterSource->clear();
}
//free space
- rPolyPoly.SequenceX.realloc(nPolyCount);
- rPolyPoly.SequenceY.realloc(nPolyCount);
- rPolyPoly.SequenceZ.realloc(nPolyCount);
+ rPolyPoly.resize(nPolyCount);
- rPolyPoly=aTmp;
+ rPolyPoly = std::move(aTmp);
}
-bool AreaChart::create_stepped_line( drawing::PolyPolygonShape3D aStartPoly, chart2::CurveStyle eCurveStyle, PlottingPositionHelper const * pPosHelper, drawing::PolyPolygonShape3D &aPoly )
+bool AreaChart::create_stepped_line(
+ std::vector<std::vector<css::drawing::Position3D>> aStartPoly,
+ chart2::CurveStyle eCurveStyle,
+ PlottingPositionHelper const * pPosHelper,
+ std::vector<std::vector<css::drawing::Position3D>> &aPoly )
{
- sal_uInt32 nOuterCount = aStartPoly.SequenceX.getLength();
+ sal_uInt32 nOuterCount = aStartPoly.size();
if ( !nOuterCount )
return false;
- drawing::PolyPolygonShape3D aSteppedPoly;
- aSteppedPoly.SequenceX.realloc(nOuterCount);
- aSteppedPoly.SequenceY.realloc(nOuterCount);
- aSteppedPoly.SequenceZ.realloc(nOuterCount);
+ std::vector<std::vector<css::drawing::Position3D>> aSteppedPoly;
+ aSteppedPoly.resize(nOuterCount);
- auto pSequenceX = aSteppedPoly.SequenceX.getArray();
- auto pSequenceY = aSteppedPoly.SequenceY.getArray();
- auto pSequenceZ = aSteppedPoly.SequenceZ.getArray();
+ auto pSequence = aSteppedPoly.data();
for( sal_uInt32 nOuter = 0; nOuter < nOuterCount; ++nOuter )
{
- if( aStartPoly.SequenceX[nOuter].getLength() <= 1 )
+ if( aStartPoly[nOuter].size() <= 1 )
continue; //we need at least two points
- sal_uInt32 nMaxIndexPoints = aStartPoly.SequenceX[nOuter].getLength()-1; // is >1
+ sal_uInt32 nMaxIndexPoints = aStartPoly[nOuter].size()-1; // is >1
sal_uInt32 nNewIndexPoints = 0;
if ( eCurveStyle==CurveStyle_STEP_START || eCurveStyle==CurveStyle_STEP_END)
nNewIndexPoints = nMaxIndexPoints * 2 + 1;
else
nNewIndexPoints = nMaxIndexPoints * 3 + 1;
- const double* pOldX = aStartPoly.SequenceX[nOuter].getConstArray();
- const double* pOldY = aStartPoly.SequenceY[nOuter].getConstArray();
- const double* pOldZ = aStartPoly.SequenceZ[nOuter].getConstArray();
+ const css::drawing::Position3D* pOld = aStartPoly[nOuter].data();
- pSequenceX[nOuter].realloc( nNewIndexPoints );
- pSequenceY[nOuter].realloc( nNewIndexPoints );
- pSequenceZ[nOuter].realloc( nNewIndexPoints );
+ pSequence[nOuter].resize( nNewIndexPoints );
- double* pNewX = pSequenceX[nOuter].getArray();
- double* pNewY = pSequenceY[nOuter].getArray();
- double* pNewZ = pSequenceZ[nOuter].getArray();
+ css::drawing::Position3D* pNew = pSequence[nOuter].data();
- pNewX[0] = pOldX[0];
- pNewY[0] = pOldY[0];
- pNewZ[0] = pOldZ[0];
+ pNew[0] = pOld[0];
for( sal_uInt32 oi = 0; oi < nMaxIndexPoints; oi++ )
{
switch ( eCurveStyle )
@@ -286,13 +254,11 @@ bool AreaChart::create_stepped_line( drawing::PolyPolygonShape3D aStartPoly, cha
O-----+
*/
// create the intermediate point
- pNewX[1+oi*2] = pOldX[oi+1];
- pNewY[1+oi*2] = pOldY[oi];
- pNewZ[1+oi*2] = pOldZ[oi];
+ pNew[1+oi*2].PositionX = pOld[oi+1].PositionX;
+ pNew[1+oi*2].PositionY = pOld[oi].PositionY;
+ pNew[1+oi*2].PositionZ = pOld[oi].PositionZ;
// and now the normal one
- pNewX[1+oi*2+1] = pOldX[oi+1];
- pNewY[1+oi*2+1] = pOldY[oi+1];
- pNewZ[1+oi*2+1] = pOldZ[oi+1];
+ pNew[1+oi*2+1] = pOld[oi+1];
break;
case CurveStyle_STEP_END:
/** +------O
@@ -302,13 +268,11 @@ bool AreaChart::create_stepped_line( drawing::PolyPolygonShape3D aStartPoly, cha
O
*/
// create the intermediate point
- pNewX[1+oi*2] = pOldX[oi];
- pNewY[1+oi*2] = pOldY[oi+1];
- pNewZ[1+oi*2] = pOldZ[oi];
+ pNew[1+oi*2].PositionX = pOld[oi].PositionX;
+ pNew[1+oi*2].PositionY = pOld[oi+1].PositionY;
+ pNew[1+oi*2].PositionZ = pOld[oi].PositionZ;
// and now the normal one
- pNewX[1+oi*2+1] = pOldX[oi+1];
- pNewY[1+oi*2+1] = pOldY[oi+1];
- pNewZ[1+oi*2+1] = pOldZ[oi+1];
+ pNew[1+oi*2+1] = pOld[oi+1];
break;
case CurveStyle_STEP_CENTER_X:
/** +--O
@@ -318,17 +282,15 @@ bool AreaChart::create_stepped_line( drawing::PolyPolygonShape3D aStartPoly, cha
O--+
*/
// create the first intermediate point
- pNewX[1+oi*3] = (pOldX[oi]+pOldX[oi+1])/2;
- pNewY[1+oi*3] = pOldY[oi];
- pNewZ[1+oi*3] = pOldZ[oi];
+ pNew[1+oi*3].PositionX = (pOld[oi].PositionX + pOld[oi+1].PositionX) / 2;
+ pNew[1+oi*3].PositionY = pOld[oi].PositionY;
+ pNew[1+oi*3].PositionZ = pOld[oi].PositionZ;
// create the second intermediate point
- pNewX[1+oi*3+1] = (pOldX[oi]+pOldX[oi+1])/2;
- pNewY[1+oi*3+1] = pOldY[oi+1];
- pNewZ[1+oi*3+1] = pOldZ[oi];
+ pNew[1+oi*3+1].PositionX = (pOld[oi].PositionX + pOld[oi+1].PositionX) / 2;
+ pNew[1+oi*3+1].PositionY = pOld[oi+1].PositionY;
+ pNew[1+oi*3+1].PositionZ = pOld[oi].PositionZ;
// and now the normal one
- pNewX[1+oi*3+2] = pOldX[oi+1];
- pNewY[1+oi*3+2] = pOldY[oi+1];
- pNewZ[1+oi*3+2] = pOldZ[oi+1];
+ pNew[1+oi*3+2] = pOld[oi+1];
break;
case CurveStyle_STEP_CENTER_Y:
/** O
@@ -338,17 +300,15 @@ bool AreaChart::create_stepped_line( drawing::PolyPolygonShape3D aStartPoly, cha
O
*/
// create the first intermediate point
- pNewX[1+oi*3] = pOldX[oi];
- pNewY[1+oi*3] = (pOldY[oi]+pOldY[oi+1])/2;
- pNewZ[1+oi*3] = pOldZ[oi];
+ pNew[1+oi*3].PositionX = pOld[oi].PositionX;
+ pNew[1+oi*3].PositionY = (pOld[oi].PositionY + pOld[oi+1].PositionY) / 2;
+ pNew[1+oi*3].PositionZ = pOld[oi].PositionZ;
// create the second intermediate point
- pNewX[1+oi*3+1] = pOldX[oi+1];
- pNewY[1+oi*3+1] = (pOldY[oi]+pOldY[oi+1])/2;
- pNewZ[1+oi*3+1] = pOldZ[oi];
+ pNew[1+oi*3+1].PositionX = pOld[oi+1].PositionX;
+ pNew[1+oi*3+1].PositionY = (pOld[oi].PositionY + pOld[oi+1].PositionY) / 2;
+ pNew[1+oi*3+1].PositionZ = pOld[oi].PositionZ;
// and now the normal one
- pNewX[1+oi*3+2] = pOldX[oi+1];
- pNewY[1+oi*3+2] = pOldY[oi+1];
- pNewZ[1+oi*3+2] = pOldZ[oi+1];
+ pNew[1+oi*3+2] = pOld[oi+1];
break;
default:
// this should never be executed
@@ -362,23 +322,23 @@ bool AreaChart::create_stepped_line( drawing::PolyPolygonShape3D aStartPoly, cha
}
bool AreaChart::impl_createLine( VDataSeries* pSeries
- , drawing::PolyPolygonShape3D const * pSeriesPoly
+ , std::vector<std::vector<css::drawing::Position3D>> const * pSeriesPoly
, PlottingPositionHelper* pPosHelper )
{
//return true if a line was created successfully
- uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeBackChild(pSeries, m_xSeriesTarget);
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesGroupShape_Shapes = getSeriesGroupShapeBackChild(pSeries, m_xSeriesTarget);
- drawing::PolyPolygonShape3D aPoly;
+ std::vector<std::vector<css::drawing::Position3D>> aPoly;
if(m_eCurveStyle==CurveStyle_CUBIC_SPLINES)
{
- drawing::PolyPolygonShape3D aSplinePoly;
+ std::vector<std::vector<css::drawing::Position3D>> aSplinePoly;
SplineCalculater::CalculateCubicSplines( *pSeriesPoly, aSplinePoly, m_nCurveResolution );
lcl_removeDuplicatePoints( aSplinePoly, *pPosHelper );
Clipping::clipPolygonAtRectangle( aSplinePoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
}
else if(m_eCurveStyle==CurveStyle_B_SPLINES)
{
- drawing::PolyPolygonShape3D aSplinePoly;
+ std::vector<std::vector<css::drawing::Position3D>> aSplinePoly;
SplineCalculater::CalculateBSplines( *pSeriesPoly, aSplinePoly, m_nCurveResolution, m_nSplineOrder );
lcl_removeDuplicatePoints( aSplinePoly, *pPosHelper );
Clipping::clipPolygonAtRectangle( aSplinePoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
@@ -407,26 +367,21 @@ bool AreaChart::impl_createLine( VDataSeries* pSeries
pPosHelper->transformScaledLogicToScene( aPoly );
//create line:
- uno::Reference< drawing::XShape > xShape;
+ rtl::Reference< SvxShape > xShape;
if(m_nDimension==3)
{
double fDepth = getTransformedDepth();
- sal_Int32 nPolyCount = aPoly.SequenceX.getLength();
+ sal_Int32 nPolyCount = aPoly.size();
for(sal_Int32 nPoly=0;nPoly<nPolyCount;nPoly++)
{
- sal_Int32 nPointCount = aPoly.SequenceX[nPoly].getLength();
+ sal_Int32 nPointCount = aPoly[nPoly].size();
for(sal_Int32 nPoint=0;nPoint<nPointCount-1;nPoint++)
{
drawing::Position3D aPoint1, aPoint2;
- aPoint1.PositionX = aPoly.SequenceX[nPoly][nPoint+1];
- aPoint1.PositionY = aPoly.SequenceY[nPoly][nPoint+1];
- aPoint1.PositionZ = aPoly.SequenceZ[nPoly][nPoint+1];
-
- aPoint2.PositionX = aPoly.SequenceX[nPoly][nPoint];
- aPoint2.PositionY = aPoly.SequenceY[nPoly][nPoint];
- aPoint2.PositionZ = aPoly.SequenceZ[nPoly][nPoint];
+ aPoint1 = aPoly[nPoly][nPoint+1];
+ aPoint2 = aPoly[nPoly][nPoint];
- m_pShapeFactory->createStripe(xSeriesGroupShape_Shapes
+ ShapeFactory::createStripe(xSeriesGroupShape_Shapes
, Stripe( aPoint1, aPoint2, fDepth )
, pSeries->getPropertiesOfSeries(), PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), true, 1 );
}
@@ -434,9 +389,8 @@ bool AreaChart::impl_createLine( VDataSeries* pSeries
}
else //m_nDimension!=3
{
- xShape = m_pShapeFactory->createLine2D( xSeriesGroupShape_Shapes
- , PolyToPointSequence( aPoly ) );
- setMappedProperties( xShape
+ xShape = ShapeFactory::createLine2D( xSeriesGroupShape_Shapes, aPoly );
+ PropertyMapper::setMappedProperties( *xShape
, pSeries->getPropertiesOfSeries()
, PropertyMapper::getPropertyNameMapForLineSeriesProperties() );
//because of this name this line will be used for marking
@@ -446,16 +400,16 @@ bool AreaChart::impl_createLine( VDataSeries* pSeries
}
bool AreaChart::impl_createArea( VDataSeries* pSeries
- , drawing::PolyPolygonShape3D const * pSeriesPoly
- , drawing::PolyPolygonShape3D const * pPreviousSeriesPoly
+ , std::vector<std::vector<css::drawing::Position3D>> const * pSeriesPoly
+ , std::vector<std::vector<css::drawing::Position3D>> const * pPreviousSeriesPoly
, PlottingPositionHelper const * pPosHelper )
{
//return true if an area was created successfully
- uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeBackChild(pSeries, m_xSeriesTarget);
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesGroupShape_Shapes = getSeriesGroupShapeBackChild(pSeries, m_xSeriesTarget);
double zValue = pSeries->m_fLogicZPos;
- drawing::PolyPolygonShape3D aPoly( *pSeriesPoly );
+ std::vector<std::vector<css::drawing::Position3D>> aPoly( *pSeriesPoly );
//add second part to the polygon (grounding points or previous series points)
if(!pPreviousSeriesPoly)
{
@@ -488,7 +442,7 @@ bool AreaChart::impl_createArea( VDataSeries* pSeries
//apply clipping
{
- drawing::PolyPolygonShape3D aClippedPoly;
+ std::vector<std::vector<css::drawing::Position3D>> aClippedPoly;
Clipping::clipPolygonAtRectangle( aPoly, pPosHelper->getScaledLogicClipDoubleRect(), aClippedPoly, false );
ShapeFactory::closePolygon(aClippedPoly); //again necessary after clipping
aPoly = aClippedPoly;
@@ -501,18 +455,18 @@ bool AreaChart::impl_createArea( VDataSeries* pSeries
pPosHelper->transformScaledLogicToScene( aPoly );
//create area:
- uno::Reference< drawing::XShape > xShape;
+ rtl::Reference< SvxShape > xShape;
if(m_nDimension==3)
{
- xShape = m_pShapeFactory->createArea3D( xSeriesGroupShape_Shapes
+ xShape = ShapeFactory::createArea3D( xSeriesGroupShape_Shapes
, aPoly, getTransformedDepth() );
}
else //m_nDimension!=3
{
- xShape = m_pShapeFactory->createArea2D( xSeriesGroupShape_Shapes
+ xShape = ShapeFactory::createArea2D( xSeriesGroupShape_Shapes
, aPoly );
}
- setMappedProperties( xShape
+ PropertyMapper::setMappedProperties( *xShape
, pSeries->getPropertiesOfSeries()
, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
//because of this name this line will be used for marking
@@ -529,8 +483,8 @@ void AreaChart::impl_createSeriesShapes()
{
for( auto const& rXSlot : rZSlot )
{
- std::map< sal_Int32, drawing::PolyPolygonShape3D* > aPreviousSeriesPolyMap;//a PreviousSeriesPoly for each different nAttachedAxisIndex
- drawing::PolyPolygonShape3D* pSeriesPoly = nullptr;
+ std::map< sal_Int32, std::vector<std::vector<css::drawing::Position3D>>* > aPreviousSeriesPolyMap;//a PreviousSeriesPoly for each different nAttachedAxisIndex
+ std::vector<std::vector<css::drawing::Position3D>>* pSeriesPoly = nullptr;
//iterate through all series
for( std::unique_ptr<VDataSeries> const & pSeries : rXSlot.m_aSeriesVector )
@@ -615,8 +569,8 @@ void AreaChart::createShapes()
if( officecfg::Office::Compatibility::View::ReverseSeriesOrderAreaAndNetChart::get() && m_nDimension == 2 && ( m_bArea || !m_bCategoryXAxis ) )
lcl_reorderSeries( m_aZSlots );
- OSL_ENSURE(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"AreaChart is not proper initialized");
- if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
+ OSL_ENSURE(m_xLogicTarget.is()&&m_xFinalTarget.is(),"AreaChart is not proper initialized");
+ if(!(m_xLogicTarget.is()&&m_xFinalTarget.is()))
return;
//the text labels should be always on top of the other series shapes
@@ -629,8 +583,8 @@ void AreaChart::createShapes()
m_xErrorBarTarget = createGroupShape( m_xLogicTarget );
else
m_xErrorBarTarget = m_xSeriesTarget;
- m_xTextTarget = m_pShapeFactory->createGroup2D( m_xFinalTarget );
- m_xRegressionCurveEquationTarget = m_pShapeFactory->createGroup2D( m_xFinalTarget );
+ m_xTextTarget = ShapeFactory::createGroup2D( m_xFinalTarget );
+ m_xRegressionCurveEquationTarget = ShapeFactory::createGroup2D( m_xFinalTarget );
//check necessary here that different Y axis can not be stacked in the same group? ... hm?
@@ -680,6 +634,8 @@ void AreaChart::createShapes()
}
}
+ const bool bUseErrorRectangle = officecfg::Office::Chart::ErrorProperties::ErrorRectangle::get();
+
sal_Int32 nZ=1;
for( auto const& rZSlot : m_aZSlots )
{
@@ -694,7 +650,7 @@ void AreaChart::createShapes()
if(!pSeries)
continue;
- uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeFrontChild(pSeries.get(), m_xSeriesTarget);
+ rtl::Reference<SvxShapeGroupAnyD> xSeriesGroupShape_Shapes = getSeriesGroupShapeFrontChild(pSeries.get(), m_xSeriesTarget);
sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
double fXMin, fXMax;
@@ -742,11 +698,11 @@ void AreaChart::createShapes()
{
if( pSeries->getMissingValueTreatment() == css::chart::MissingValueTreatment::LEAVE_GAP )
{
- drawing::PolyPolygonShape3D& rPolygon = pSeries->m_aPolyPolygonShape3D;
+ std::vector<std::vector<css::drawing::Position3D>>& rPolygon = pSeries->m_aPolyPolygonShape3D;
sal_Int32& rIndex = pSeries->m_nPolygonIndex;
- if( 0<= rIndex && rIndex < rPolygon.SequenceX.getLength() )
+ if( 0<= rIndex && o3tl::make_unsigned(rIndex) < rPolygon.size() )
{
- if( rPolygon.SequenceX[ rIndex ].hasElements() )
+ if( !rPolygon[ rIndex ].empty() )
rIndex++; //start a new polygon for the next point if the current poly is not empty
}
}
@@ -838,13 +794,6 @@ void AreaChart::createShapes()
!bCreateXErrorBar && !pSeries->getDataPointLabelIfLabel(nIndex) )
continue;
- //create a group shape for this point and add to the series shape:
- OUString aPointCID = ObjectIdentifier::createPointCID(
- pSeries->getPointCID_Stub(), nIndex );
- uno::Reference< drawing::XShapes > xPointGroupShape_Shapes(
- createGroupShape(xSeriesGroupShape_Shapes,aPointCID) );
- uno::Reference<drawing::XShape> xPointGroupShape_Shape( xPointGroupShape_Shapes, uno::UNO_QUERY );
-
{
nCreatedPoints++;
@@ -854,6 +803,13 @@ void AreaChart::createShapes()
{
if(m_nDimension!=3)
{
+ //create a group shape for this point and add to the series shape:
+ OUString aPointCID = ObjectIdentifier::createPointCID(
+ pSeries->getPointCID_Stub(), nIndex );
+ rtl::Reference<SvxShapeGroupAnyD> xPointGroupShape_Shapes;
+ if (pSymbolProperties->Style == SymbolStyle_STANDARD || pSymbolProperties->Style == SymbolStyle_GRAPHIC)
+ xPointGroupShape_Shapes = createGroupShape(xSeriesGroupShape_Shapes,aPointCID);
+
if (pSymbolProperties->Style != SymbolStyle_NONE)
{
aSymbolSize.DirectionX = pSymbolProperties->Size.Width;
@@ -863,14 +819,14 @@ void AreaChart::createShapes()
if (pSymbolProperties->Style == SymbolStyle_STANDARD)
{
sal_Int32 nSymbol = pSymbolProperties->StandardSymbol;
- m_pShapeFactory->createSymbol2D(
+ ShapeFactory::createSymbol2D(
xPointGroupShape_Shapes, aScenePosition, aSymbolSize,
nSymbol, pSymbolProperties->BorderColor,
pSymbolProperties->FillColor);
}
else if (pSymbolProperties->Style == SymbolStyle_GRAPHIC)
{
- m_pShapeFactory->createGraphic2D(xPointGroupShape_Shapes,
+ ShapeFactory::createGraphic2D(xPointGroupShape_Shapes,
aScenePosition, aSymbolSize,
pSymbolProperties->Graphic);
}
@@ -878,7 +834,7 @@ void AreaChart::createShapes()
}
}
//create error bars or rectangles, depending on configuration
- if ( ConfigAccess::getUseErrorRectangle() )
+ if ( bUseErrorRectangle )
{
if ( bCreateXErrorBar || bCreateYErrorBar )
{
@@ -953,7 +909,7 @@ void AreaChart::createShapes()
{
if(eAlignment==LABEL_ALIGN_CENTER || m_nDimension == 3 )
nOffset = 0;
- aScreenPosition2D = LabelPositionHelper(m_nDimension,m_xLogicTarget,m_pShapeFactory)
+ aScreenPosition2D = LabelPositionHelper(m_nDimension,m_xLogicTarget)
.transformSceneToScreenPosition( aScenePosition3D );
}
@@ -962,10 +918,6 @@ void AreaChart::createShapes()
, rLogicYSumMap[nAttachedAxisIndex], aScreenPosition2D, eAlignment, nOffset );
}
}
-
- //remove PointGroupShape if empty
- if(!xPointGroupShape_Shapes->getCount())
- xSeriesGroupShape_Shapes->remove(xPointGroupShape_Shape);
}
}//next series in x slot (next y slot)