32#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
33#include <com/sun/star/chart2/AxisType.hpp>
39using ::com::sun::star::uno::Reference;
43class TextualDataProvider :
public ::cppu::WeakImplHelper<
44 css::chart2::data::XTextualDataSequence
48 explicit TextualDataProvider(
const uno::Sequence< OUString >& rTextSequence )
54 virtual uno::Sequence< OUString > SAL_CALL getTextualData()
override
66 : VCoordinateSystem(xCooSys)
70VCartesianCoordinateSystem::~VCartesianCoordinateSystem()
74void VCartesianCoordinateSystem::createGridShapes()
76 if(!m_xLogicTargetForGrids.is() || !m_xFinalTarget.is() )
79 sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
80 bool bSwapXAndY = getPropertySwapXAndYAxis();
82 for( sal_Int32 nDimensionIndex=0; nDimensionIndex<3; nDimensionIndex++)
86 if(!xAxis.is() || !AxisHelper::shouldAxisBeDisplayed( xAxis, m_xCooSysModel ))
89 VCartesianGrid aGrid(nDimensionIndex,nDimensionCount, getGridListFromAxis( xAxis ));
91 , getExplicitIncrement(nDimensionIndex,nAxisIndex) );
94 aGrid.
initPlotter(m_xLogicTargetForGrids,m_xFinalTarget
95 , createCIDForGrid( nDimensionIndex,nAxisIndex ) );
96 if(nDimensionCount==2)
98 aGrid.
setScales( getExplicitScales(nDimensionIndex,nAxisIndex), bSwapXAndY );
103void VCartesianCoordinateSystem::createVAxisList(
105 const awt::Size& rFontReferenceSize,
106 const awt::Rectangle& rMaximumSpaceForLabels,
107 bool bLimitSpaceForLabels,
108 std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList,
114 xChartDoc->getNumberFormatsSupplier());
118 sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
119 bool bSwapXAndY = getPropertySwapXAndYAxis();
121 if(nDimensionCount<=0)
124 sal_Int32 nDimensionIndex = 0;
127 for( nDimensionIndex = 0; nDimensionIndex < nDimensionCount; nDimensionIndex++ )
130 sal_Int32 nMaxAxisIndex = m_xCooSysModel->getMaximumAxisIndexByDimension(nDimensionIndex);
131 for( sal_Int32 nAxisIndex = 0; nAxisIndex <= nMaxAxisIndex; nAxisIndex++ )
134 if(!xAxis.is() || !AxisHelper::shouldAxisBeDisplayed( xAxis, m_xCooSysModel ))
138 AxisProperties aAxisProperties(xAxis, getExplicitCategoriesProvider(), xDiagram->getDataTableRef());
144 if( xCrossingMainAxis.is() )
146 ScaleData aCrossingScale( xCrossingMainAxis->getScaleData() );
149 if( aCrossingScale.AxisType == AxisType::CATEGORY )
153 if( nDimensionIndex == 2 )
158 rtl::Reference< Axis > xSisterAxis = AxisHelper::getCrossingMainAxis( xCrossingMainAxis, m_xCooSysModel );
161 aAxisProperties.
init(
true);
165 auto apVAxis = std::make_shared<VCartesianAxis>(aAxisProperties,xNumberFormatsSupplier,nDimensionIndex,nDimensionCount);
167 m_aAxisMap[aFullAxisIndex] = apVAxis;
168 apVAxis->set3DWallPositions( m_eLeftWallPos, m_eBackWallPos, m_eBottomPos );
170 apVAxis->initAxisLabelProperties(rFontReferenceSize,rMaximumSpaceForLabels);
171 apVAxis->createDataTableView(rSeriesPlotterList, xNumberFormatsSupplier, xChartDoc, rComponentContext);
176void VCartesianCoordinateSystem::initVAxisInList()
178 if(!m_xLogicTargetForAxes.is() || !m_xFinalTarget.is() || !m_xCooSysModel.is() )
181 sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
182 bool bSwapXAndY = getPropertySwapXAndYAxis();
184 for (
auto const& [nIndexPair, pVAxis] : m_aAxisMap)
188 auto [nDimensionIndex, nAxisIndex] = nIndexPair;
189 pVAxis->setExplicitScaleAndIncrement( getExplicitScale( nDimensionIndex, nAxisIndex ), getExplicitIncrement( nDimensionIndex, nAxisIndex ) );
190 pVAxis->initPlotter(m_xLogicTargetForAxes, m_xFinalTarget, createCIDForAxis( nDimensionIndex, nAxisIndex ) );
191 if(nDimensionCount==2)
192 pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
193 pVAxis->setScales( getExplicitScales(nDimensionIndex,nAxisIndex), bSwapXAndY );
198void VCartesianCoordinateSystem::updateScalesAndIncrementsOnAxes()
200 if(!m_xLogicTargetForAxes.is() || !m_xFinalTarget.is() || !m_xCooSysModel.is() )
203 sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
204 bool bSwapXAndY = getPropertySwapXAndYAxis();
206 for (
auto const& [nIndexPair, pVAxis] : m_aAxisMap)
210 auto [nDimensionIndex, nAxisIndex] = nIndexPair;
212 pVAxis->setExplicitScaleAndIncrement( getExplicitScale( nDimensionIndex, nAxisIndex ), getExplicitIncrement( nDimensionIndex, nAxisIndex ) );
213 if(nDimensionCount==2)
214 pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
215 pVAxis->setScales( getExplicitScales(nDimensionIndex,nAxisIndex), bSwapXAndY );
uno::Sequence< OUString > m_aTextSequence
virtual void setScales(std::vector< ExplicitScaleData > &&rScales, bool bSwapXAndYAxis)
virtual void initPlotter(const rtl::Reference< SvxShapeGroupAnyD > &xLogicTarget, const rtl::Reference< SvxShapeGroupAnyD > &xFinalTarget, const OUString &rCID)
void set3DWallPositions(CuboidPlanePosition eLeftWallPos, CuboidPlanePosition eBackWallPos, CuboidPlanePosition eBottomPos)
virtual void setExplicitScaleAndIncrement(const ExplicitScaleData &rScale, const ExplicitIncrementData &rIncrement)
virtual void setTransformationSceneToScreen(const css::drawing::HomogenMatrix &rMatrix) override
VCartesianCoordinateSystem()=delete
virtual void createShapes() override
std::pair< sal_Int32, sal_Int32 > tFullAxisIndex
const sal_Int32 MAIN_AXIS_INDEX
css::uno::Reference< css::chart2::data::XTextualDataSequence > m_xAxisTextProvider
void init(bool bCartesian=false)
bool m_bCrossingAxisHasReverseDirection
sal_Int32 m_nNumberFormatKey
sal_Int32 m_nDimensionIndex
void initAxisPositioning(const css::uno::Reference< css::beans::XPropertySet > &xAxisProp)
bool m_bLimitSpaceForLabels
bool m_bCrossingAxisIsCategoryAxes