Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_VCOORDINATESYSTEM_HXX
20 : #define INCLUDED_CHART2_SOURCE_VIEW_INC_VCOORDINATESYSTEM_HXX
21 :
22 : #include "MinimumAndMaximumSupplier.hxx"
23 : #include "ScaleAutomatism.hxx"
24 : #include "ThreeDHelper.hxx"
25 : #include "ExplicitCategoriesProvider.hxx"
26 : #include "chartview/ExplicitScaleValues.hxx"
27 :
28 : #include <com/sun/star/chart2/XCoordinateSystem.hpp>
29 : #include <com/sun/star/awt/Rectangle.hpp>
30 : #include <com/sun/star/drawing/HomogenMatrix.hpp>
31 : #include <com/sun/star/drawing/XShapes.hpp>
32 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 : #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
34 :
35 : #include <map>
36 : #include <vector>
37 : #include <boost/shared_ptr.hpp>
38 : #include <boost/scoped_ptr.hpp>
39 :
40 : namespace chart
41 : {
42 :
43 : /**
44 : */
45 : class VAxisBase;
46 : class VCoordinateSystem
47 : {
48 : public:
49 : virtual ~VCoordinateSystem();
50 :
51 : static VCoordinateSystem* createCoordinateSystem( const ::com::sun::star::uno::Reference<
52 : ::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel );
53 :
54 : virtual void initPlottingTargets(
55 : const ::com::sun::star::uno::Reference<
56 : ::com::sun::star::drawing::XShapes >& xLogicTarget
57 : , const ::com::sun::star::uno::Reference<
58 : ::com::sun::star::drawing::XShapes >& xFinalTarget
59 : , const ::com::sun::star::uno::Reference<
60 : ::com::sun::star::lang::XMultiServiceFactory >& xFactory
61 : , ::com::sun::star::uno::Reference<
62 : ::com::sun::star::drawing::XShapes >& xLogicTargetForSeriesBehindAxis )
63 : throw (::com::sun::star::uno::RuntimeException);
64 :
65 : void setParticle( const OUString& rCooSysParticle );
66 :
67 : virtual void setTransformationSceneToScreen( const ::com::sun::star::drawing::HomogenMatrix& rMatrix );
68 531 : ::com::sun::star::drawing::HomogenMatrix getTransformationSceneToScreen() { return m_aMatrixSceneToScreen;}
69 :
70 : //better performance for big data
71 : virtual ::com::sun::star::uno::Sequence< sal_Int32 > getCoordinateSystemResolution( const ::com::sun::star::awt::Size& rPageSize
72 : , const ::com::sun::star::awt::Size& rPageResolution );
73 :
74 : ExplicitScaleData getExplicitScale( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
75 : ExplicitIncrementData getExplicitIncrement( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
76 :
77 : void setExplicitCategoriesProvider( ExplicitCategoriesProvider* /*takes ownership*/ );
78 : ExplicitCategoriesProvider* getExplicitCategoriesProvider();
79 :
80 : // returns a coplete 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
81 : ::std::vector< ExplicitScaleData > getExplicitScales( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
82 : // returns a coplete 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
83 : ::std::vector< ExplicitIncrementData > getExplicitIncrements( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
84 :
85 : void addMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier );
86 : bool hasMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier );
87 : void clearMinimumAndMaximumSupplierList();
88 :
89 : void prepareAutomaticAxisScaling( ScaleAutomatism& rScaleAutomatism, sal_Int32 nDimIndex, sal_Int32 nAxisIndex );
90 :
91 : void setExplicitScaleAndIncrement( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex
92 : , const ExplicitScaleData& rExplicitScale
93 : , const ExplicitIncrementData& rExplicitIncrement );
94 :
95 : void set3DWallPositions( CuboidPlanePosition eLeftWallPos, CuboidPlanePosition eBackWallPos, CuboidPlanePosition eBottomPos );
96 :
97 : ::com::sun::star::uno::Reference<
98 : ::com::sun::star::chart2::XCoordinateSystem >
99 3534 : getModel() const { return m_xCooSysModel;}
100 :
101 : /**
102 : * Create "view" axis obejcts 'VAxis' from the coordinate system model.
103 : */
104 : virtual void createVAxisList(
105 : const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument> & xChartDoc
106 : , const ::com::sun::star::awt::Size& rFontReferenceSize
107 : , const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels );
108 :
109 : virtual void initVAxisInList();
110 : virtual void updateScalesAndIncrementsOnAxes();
111 :
112 : virtual void createMaximumAxesLabels();
113 : virtual void createAxesLabels();
114 : virtual void updatePositions();
115 : virtual void createAxesShapes();
116 :
117 : virtual void createGridShapes();
118 :
119 : virtual bool getPropertySwapXAndYAxis() const;
120 :
121 : sal_Int32 getMaximumAxisIndexByDimension( sal_Int32 nDimensionIndex ) const;
122 :
123 : virtual bool needSeriesNamesForAxis() const;
124 : void setSeriesNamesForAxis( const ::com::sun::star::uno::Sequence< OUString >& rSeriesNames );
125 :
126 : protected: //methods
127 : VCoordinateSystem( const ::com::sun::star::uno::Reference<
128 : ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
129 :
130 : ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >
131 : getAxisByDimension( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
132 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > >
133 : getGridListFromAxis( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
134 :
135 : VAxisBase* getVAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
136 :
137 : OUString createCIDForAxis( const ::com::sun::star::uno::Reference<
138 : ::com::sun::star::chart2::XAxis >& xAxis
139 : , sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
140 : OUString createCIDForGrid( const ::com::sun::star::uno::Reference<
141 : ::com::sun::star::chart2::XAxis >& xAxis
142 : , sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
143 :
144 : sal_Int32 getNumberFormatKeyForAxis( const ::com::sun::star::uno::Reference<
145 : ::com::sun::star::chart2::XAxis >& xAxis
146 : , const ::com::sun::star::uno::Reference<
147 : ::com::sun::star::chart2::XChartDocument>& xChartDoc);
148 :
149 : private: //methods
150 : void impl_adjustDimension( sal_Int32& rDimensionIndex ) const;
151 : void impl_adjustDimensionAndIndex( sal_Int32& rDimensionIndex, sal_Int32& rAxisIndex ) const;
152 :
153 : protected: //member
154 : ::com::sun::star::uno::Reference<
155 : ::com::sun::star::chart2::XCoordinateSystem > m_xCooSysModel;
156 :
157 : OUString m_aCooSysParticle;
158 :
159 : 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
160 :
161 : ::com::sun::star::uno::Reference<
162 : ::com::sun::star::drawing::XShapes > m_xLogicTargetForGrids;
163 : ::com::sun::star::uno::Reference<
164 : ::com::sun::star::drawing::XShapes > m_xLogicTargetForAxes;
165 : ::com::sun::star::uno::Reference<
166 : ::com::sun::star::drawing::XShapes > m_xFinalTarget;
167 : ::com::sun::star::uno::Reference<
168 : ::com::sun::star::lang::XMultiServiceFactory> m_xShapeFactory;
169 : ::com::sun::star::drawing::HomogenMatrix m_aMatrixSceneToScreen;
170 :
171 : CuboidPlanePosition m_eLeftWallPos;
172 : CuboidPlanePosition m_eBackWallPos;
173 : CuboidPlanePosition m_eBottomPos;
174 :
175 : /**
176 : * Collection of min-max suppliers which are basically different chart
177 : * types present in the same coordinate system. This is used only for
178 : * auto-scaling purposes.
179 : */
180 : MergedMinimumAndMaximumSupplier m_aMergedMinMaxSupplier;
181 :
182 : ::com::sun::star::uno::Sequence< OUString > m_aSeriesNamesForZAxis;
183 :
184 : typedef std::map< tFullAxisIndex, ::boost::shared_ptr< VAxisBase > > tVAxisMap;
185 :
186 : tVAxisMap m_aAxisMap;
187 :
188 : private:
189 : std::vector< ExplicitScaleData > m_aExplicitScales;
190 : std::vector< ExplicitIncrementData > m_aExplicitIncrements;
191 :
192 : typedef std::map< tFullAxisIndex, ExplicitScaleData > tFullExplicitScaleMap;
193 : typedef std::map< tFullAxisIndex, ExplicitIncrementData > tFullExplicitIncrementMap;
194 :
195 : tFullExplicitScaleMap m_aSecondaryExplicitScales;
196 : tFullExplicitIncrementMap m_aSecondaryExplicitIncrements;
197 :
198 : boost::scoped_ptr< ExplicitCategoriesProvider > m_apExplicitCategoriesProvider;
199 : };
200 :
201 : } //namespace chart
202 : #endif
203 :
204 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|