diff options
Diffstat (limited to 'chart2/source/view/charttypes/AreaChart.cxx')
-rw-r--r-- | chart2/source/view/charttypes/AreaChart.cxx | 67 |
1 files changed, 30 insertions, 37 deletions
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index e5409ce5dff1..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 ) @@ -456,26 +455,22 @@ bool AreaChart::impl_createArea( VDataSeries* pSeries pPosHelper->transformScaledLogicToScene( aPoly ); //create area: + rtl::Reference< SvxShape > xShape; if(m_nDimension==3) { - rtl::Reference< SvxShape > xShape = ShapeFactory::createArea3D( xSeriesGroupShape_Shapes + xShape = ShapeFactory::createArea3D( xSeriesGroupShape_Shapes , aPoly, getTransformedDepth() ); - PropertyMapper::setMappedProperties( *xShape - , pSeries->getPropertiesOfSeries() - , PropertyMapper::getPropertyNameMapForFilledSeriesProperties() ); - //because of this name this line will be used for marking - ShapeFactory::setShapeName(xShape, "MarkHandles"); } else //m_nDimension!=3 { - SdrPathObj* pShape = ShapeFactory::createArea2D( xSeriesGroupShape_Shapes + xShape = ShapeFactory::createArea2D( xSeriesGroupShape_Shapes , aPoly ); - PropertyMapper::setPropertyNameMapForFilledSeriesProperties( - pShape - , pSeries->getPropertiesOfSeries()); - //because of this name this line will be used for marking - ShapeFactory::setShapeName(pShape, "MarkHandles"); } + PropertyMapper::setMappedProperties( *xShape + , pSeries->getPropertiesOfSeries() + , PropertyMapper::getPropertyNameMapForFilledSeriesProperties() ); + //because of this name this line will be used for marking + ::chart::ShapeFactory::setShapeName(xShape, "MarkHandles"); return true; } @@ -639,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 ) { @@ -703,7 +700,7 @@ void AreaChart::createShapes() { std::vector<std::vector<css::drawing::Position3D>>& rPolygon = pSeries->m_aPolyPolygonShape3D; sal_Int32& rIndex = pSeries->m_nPolygonIndex; - if( 0<= rIndex && rIndex < static_cast<sal_Int32>(rPolygon.size()) ) + if( 0<= rIndex && o3tl::make_unsigned(rIndex) < rPolygon.size() ) { if( !rPolygon[ rIndex ].empty() ) rIndex++; //start a new polygon for the next point if the current poly is not empty @@ -797,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 ); - rtl::Reference<SvxShapeGroupAnyD> xPointGroupShape_Shapes( - createGroupShape(xSeriesGroupShape_Shapes,aPointCID) ); - uno::Reference<drawing::XShape> xPointGroupShape_Shape( static_cast<cppu::OWeakObject*>(xPointGroupShape_Shapes.get()), uno::UNO_QUERY ); - { nCreatedPoints++; @@ -813,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; @@ -837,7 +834,7 @@ void AreaChart::createShapes() } } //create error bars or rectangles, depending on configuration - if ( ConfigAccess::getUseErrorRectangle() ) + if ( bUseErrorRectangle ) { if ( bCreateXErrorBar || bCreateYErrorBar ) { @@ -921,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) |