tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / chart2 / source / view / inc / VCoordinateSystem.hxx
blob61dda842d02b044d0861ad5348cc1c28366ff7dd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #pragma once
21 #include "MinimumAndMaximumSupplier.hxx"
22 #include <ThreeDHelper.hxx>
23 #include "VSeriesPlotter.hxx"
24 #include <chartview/ExplicitScaleValues.hxx>
25 #include <com/sun/star/drawing/HomogenMatrix.hpp>
26 #include <com/sun/star/uno/Sequence.h>
27 #include <rtl/ref.hxx>
28 #include <svx/unoshape.hxx>
30 #include <map>
31 #include <memory>
32 #include <vector>
34 namespace com::sun::star::awt { struct Rectangle; }
35 namespace com::sun::star::awt { struct Size; }
36 namespace com::sun::star::beans { class XPropertySet; }
37 namespace com::sun::star::chart2 { class XAxis; }
38 namespace com::sun::star::chart2 { class XChartDocument; }
39 namespace com::sun::star::chart2 { class XCoordinateSystem; }
40 namespace com::sun::star::drawing { class XShapes; }
41 namespace com::sun::star::lang { class XMultiServiceFactory; }
42 namespace com::sun::star::uno { class XComponentContext; }
44 namespace chart
46 class ExplicitCategoriesProvider;
47 class ScaleAutomatism;
48 class ChartModel;
49 class Axis;
50 class BaseCoordinateSystem;
51 class GridProperties;
52 class VAxisBase;
54 class VCoordinateSystem
56 public:
57 virtual ~VCoordinateSystem();
59 static std::unique_ptr<VCoordinateSystem> createCoordinateSystem( const rtl::Reference<
60 ::chart::BaseCoordinateSystem >& xCooSysModel );
62 /// @throws css::uno::RuntimeException
63 void initPlottingTargets(
64 const rtl::Reference< SvxShapeGroupAnyD >& xLogicTarget
65 , const rtl::Reference< SvxShapeGroupAnyD >& xFinalTarget
66 , rtl::Reference<SvxShapeGroupAnyD>& xLogicTargetForSeriesBehindAxis );
68 void setParticle( const OUString& rCooSysParticle );
70 void setTransformationSceneToScreen( const css::drawing::HomogenMatrix& rMatrix );
71 const css::drawing::HomogenMatrix& getTransformationSceneToScreen() const { return m_aMatrixSceneToScreen;}
73 //better performance for big data
74 virtual css::uno::Sequence< sal_Int32 > getCoordinateSystemResolution( const css::awt::Size& rPageSize
75 , const css::awt::Size& rPageResolution );
77 ExplicitScaleData getExplicitScale( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
78 ExplicitIncrementData getExplicitIncrement( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
80 void setExplicitCategoriesProvider( ExplicitCategoriesProvider* /*takes ownership*/ );
81 ExplicitCategoriesProvider* getExplicitCategoriesProvider();
83 // returns a complete scale set for a given dimension and index; for example if nDimensionIndex==1 and nAxisIndex==2 you get returned the secondary x axis, main y axis and main z axis
84 std::vector< ExplicitScaleData > getExplicitScales( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
85 // returns a complete increment set for a given dimension and index; for example if nDimensionIndex==1 and nAxisIndex==2 you get returned the secondary x axis, main y axis and main z axis
86 std::vector< ExplicitIncrementData > getExplicitIncrements( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
88 void addMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier );
89 bool hasMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier );
90 void clearMinimumAndMaximumSupplierList();
92 /**
93 * It sets the scaling parameters for the passed `ScaleAutomatism` object.
94 * Especially it sets the `m_fValueMinimum` and the `m_fValueMaximum`
95 * parameters (see `ScaleAutomatism::expandValueRange`).
96 * The value to be assigned to these two parameters is retrieved by
97 * invoking the `getMinimum` and `getMaximum` methods of the minimum-maximum
98 * supplier object that belongs to the given coordinate system.
99 * The minimum-maximum supplier object is set in the
100 * `SeriesPlotterContainer::initializeCooSysAndSeriesPlotter` method to the
101 * series plotter which is based on the coordinate system (see notes for
102 * the method). For instance for a pie chart the `m_fValueMinimum` and the
103 * `m_fValueMaximum` parameters are initialized by the `PieChart::getMinimum`
104 * and `PieChart::getMaximum` methods.
106 void prepareAutomaticAxisScaling( ScaleAutomatism& rScaleAutomatism, sal_Int32 nDimIndex, sal_Int32 nAxisIndex );
108 void setExplicitScaleAndIncrement( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex
109 , const ExplicitScaleData& rExplicitScale
110 , const ExplicitIncrementData& rExplicitIncrement );
112 void set3DWallPositions( CuboidPlanePosition eLeftWallPos, CuboidPlanePosition eBackWallPos, CuboidPlanePosition eBottomPos );
114 const rtl::Reference< ::chart::BaseCoordinateSystem >&
115 getModel() const { return m_xCooSysModel;}
118 * Create "view" axis objects 'VAxis' from the coordinate system model.
120 virtual void createVAxisList(
121 const rtl::Reference<::chart::ChartModel> & xChartDoc,
122 const css::awt::Size& rFontReferenceSize,
123 const css::awt::Rectangle& rMaximumSpaceForLabels,
124 bool bLimitSpaceForLabels,
125 std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList,
126 css::uno::Reference<css::uno::XComponentContext> const& rComponentContext);
128 virtual void initVAxisInList();
129 virtual void updateScalesAndIncrementsOnAxes();
131 void createMaximumAxesLabels();
132 void createAxesLabels();
133 void updatePositions();
134 void createAxesShapes();
136 virtual void createGridShapes();
138 bool getPropertySwapXAndYAxis() const;
140 sal_Int32 getMaximumAxisIndexByDimension( sal_Int32 nDimensionIndex ) const;
142 bool needSeriesNamesForAxis() const;
143 void setSeriesNamesForAxis( const css::uno::Sequence< OUString >& rSeriesNames );
145 protected: //methods
146 VCoordinateSystem( rtl::Reference< ::chart::BaseCoordinateSystem > xCooSys );
148 rtl::Reference< ::chart::Axis >
149 getAxisByDimension( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
150 static std::vector< rtl::Reference< ::chart::GridProperties > >
151 getGridListFromAxis( const rtl::Reference< ::chart::Axis >& xAxis );
153 VAxisBase* getVAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
155 OUString createCIDForAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
156 OUString createCIDForGrid( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
158 sal_Int32 getNumberFormatKeyForAxis( const rtl::Reference< ::chart::Axis >& xAxis
159 , const rtl::Reference<::chart::ChartModel>& xChartDoc);
161 private: //methods
162 static void impl_adjustDimension( sal_Int32& rDimensionIndex );
163 void impl_adjustDimensionAndIndex( sal_Int32& rDimensionIndex, sal_Int32& rAxisIndex ) const;
165 protected: //member
166 rtl::Reference< ::chart::BaseCoordinateSystem > m_xCooSysModel;
168 OUString m_aCooSysParticle;
170 typedef std::pair< sal_Int32, sal_Int32 > tFullAxisIndex; //first index is the dimension, second index is the axis index that indicates whether this is a main or secondary axis
172 rtl::Reference<SvxShapeGroupAnyD> m_xLogicTargetForGrids;
173 rtl::Reference<SvxShapeGroupAnyD> m_xLogicTargetForAxes;
174 rtl::Reference<SvxShapeGroupAnyD> m_xFinalTarget;
175 css::drawing::HomogenMatrix m_aMatrixSceneToScreen;
177 CuboidPlanePosition m_eLeftWallPos;
178 CuboidPlanePosition m_eBackWallPos;
179 CuboidPlanePosition m_eBottomPos;
182 * Collection of min-max suppliers which are basically different chart
183 * types present in the same coordinate system. This is used only for
184 * auto-scaling purposes.
186 MergedMinimumAndMaximumSupplier m_aMergedMinMaxSupplier;
188 css::uno::Sequence< OUString > m_aSeriesNamesForZAxis;
190 typedef std::map< tFullAxisIndex, std::shared_ptr< VAxisBase > > tVAxisMap;
192 tVAxisMap m_aAxisMap;
194 private:
195 std::vector< ExplicitScaleData > m_aExplicitScales;
196 std::vector< ExplicitIncrementData > m_aExplicitIncrements;
198 typedef std::map< tFullAxisIndex, ExplicitScaleData > tFullExplicitScaleMap;
199 typedef std::map< tFullAxisIndex, ExplicitIncrementData > tFullExplicitIncrementMap;
201 tFullExplicitScaleMap m_aSecondaryExplicitScales;
202 tFullExplicitIncrementMap m_aSecondaryExplicitIncrements;
204 std::unique_ptr< ExplicitCategoriesProvider > m_apExplicitCategoriesProvider;
207 } //namespace chart
209 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */