1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: VCoordinateSystem.hxx,v $
10 * $Revision: 1.7.36.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _CHART2_VCOORDINATESYSTEM_HXX
31 #define _CHART2_VCOORDINATESYSTEM_HXX
33 #include "MinimumAndMaximumSupplier.hxx"
34 #include "ScaleAutomatism.hxx"
35 #include "ThreeDHelper.hxx"
37 #include <com/sun/star/chart2/ExplicitIncrementData.hpp>
38 #include <com/sun/star/chart2/ExplicitScaleData.hpp>
39 #include <com/sun/star/chart2/XCoordinateSystem.hpp>
40 #include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
41 #include "comphelper/implementationreference.hxx"
42 #include <com/sun/star/awt/Rectangle.hpp>
43 #include <com/sun/star/drawing/HomogenMatrix.hpp>
44 #include <com/sun/star/drawing/XShapes.hpp>
45 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
46 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
50 #include <boost/shared_ptr.hpp>
52 //.............................................................................
55 //.............................................................................
57 class ExplicitCategoriesProvider
;
59 //-----------------------------------------------------------------------------
63 class VCoordinateSystem
66 virtual ~VCoordinateSystem();
68 static VCoordinateSystem
* createCoordinateSystem( const ::com::sun::star::uno::Reference
<
69 ::com::sun::star::chart2::XCoordinateSystem
>& xCooSysModel
);
71 virtual void SAL_CALL
initPlottingTargets(
72 const ::com::sun::star::uno::Reference
<
73 ::com::sun::star::drawing::XShapes
>& xLogicTarget
74 , const ::com::sun::star::uno::Reference
<
75 ::com::sun::star::drawing::XShapes
>& xFinalTarget
76 , const ::com::sun::star::uno::Reference
<
77 ::com::sun::star::lang::XMultiServiceFactory
>& xFactory
78 , ::com::sun::star::uno::Reference
<
79 ::com::sun::star::drawing::XShapes
>& xLogicTargetForSeriesBehindAxis
)
80 throw (::com::sun::star::uno::RuntimeException
);
82 void setParticle( const rtl::OUString
& rCooSysParticle
);
84 virtual void setTransformationSceneToScreen( const ::com::sun::star::drawing::HomogenMatrix
& rMatrix
);
85 ::com::sun::star::drawing::HomogenMatrix
getTransformationSceneToScreen();
87 //better performance for big data
88 virtual ::com::sun::star::uno::Sequence
< sal_Int32
> getCoordinateSystemResolution( const ::com::sun::star::awt::Size
& rPageSize
89 , const ::com::sun::star::awt::Size
& rPageResolution
);
91 ::com::sun::star::chart2::ExplicitScaleData
getExplicitScale( sal_Int32 nDimensionIndex
, sal_Int32 nAxisIndex
) const;
92 ::com::sun::star::chart2::ExplicitIncrementData
getExplicitIncrement( sal_Int32 nDimensionIndex
, sal_Int32 nAxisIndex
) const;
93 ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::data::XTextualDataSequence
> getExplicitCategoriesProvider();
95 // 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
96 ::com::sun::star::uno::Sequence
< ::com::sun::star::chart2::ExplicitScaleData
> getExplicitScales( sal_Int32 nDimensionIndex
, sal_Int32 nAxisIndex
) const;
97 // 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
98 ::com::sun::star::uno::Sequence
< ::com::sun::star::chart2::ExplicitIncrementData
> getExplicitIncrements( sal_Int32 nDimensionIndex
, sal_Int32 nAxisIndex
) const;
100 void addMinimumAndMaximumSupplier( MinimumAndMaximumSupplier
* pMinimumAndMaximumSupplier
);
101 bool hasMinimumAndMaximumSupplier( MinimumAndMaximumSupplier
* pMinimumAndMaximumSupplier
);
102 void clearMinimumAndMaximumSupplierList();
104 void prepareScaleAutomatismForDimensionAndIndex( ScaleAutomatism
& rScaleAutomatism
, sal_Int32 nDimIndex
, sal_Int32 nAxisIndex
);
106 void setExplicitScaleAndIncrement( sal_Int32 nDimensionIndex
, sal_Int32 nAxisIndex
107 , const ::com::sun::star::chart2::ExplicitScaleData
& rExplicitScale
108 , const ::com::sun::star::chart2::ExplicitIncrementData
& rExplicitIncrement
);
110 void set3DWallPositions( CuboidPlanePosition eLeftWallPos
, CuboidPlanePosition eBackWallPos
, CuboidPlanePosition eBottomPos
);
112 ::com::sun::star::uno::Reference
<
113 ::com::sun::star::chart2::XCoordinateSystem
>
116 virtual void createVAxisList(
117 const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
> & xNumberFormatsSupplier
118 , const ::com::sun::star::awt::Size
& rFontReferenceSize
119 , const ::com::sun::star::awt::Rectangle
& rMaximumSpaceForLabels
);
121 virtual void initVAxisInList();
122 virtual void updateScalesAndIncrementsOnAxes();
124 virtual void createMaximumAxesLabels();
125 virtual void createAxesLabels();
126 virtual void updatePositions();
127 virtual void createAxesShapes();
129 virtual void createGridShapes();
131 virtual bool getPropertySwapXAndYAxis() const;
133 sal_Int32
getMaximumAxisIndexByDimension( sal_Int32 nDimensionIndex
) const;
135 virtual bool needSeriesNamesForAxis() const;
136 void setSeriesNamesForAxis( const ::com::sun::star::uno::Sequence
< rtl::OUString
>& rSeriesNames
);
139 VCoordinateSystem( const ::com::sun::star::uno::Reference
<
140 ::com::sun::star::chart2::XCoordinateSystem
>& xCooSys
);
142 ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XAxis
>
143 getAxisByDimension( sal_Int32 nDimensionIndex
, sal_Int32 nAxisIndex
) const;
144 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> >
145 getGridListFromAxis( const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XAxis
>& xAxis
);
147 VAxisBase
* getVAxis( sal_Int32 nDimensionIndex
, sal_Int32 nAxisIndex
);
149 void prepareScaleAutomatism( ScaleAutomatism
& rScaleAutomatism
, double fMin
, double fMax
, sal_Int32 nDimIndex
, sal_Int32 nAxisIndex
);
151 rtl::OUString
createCIDForAxis( const ::com::sun::star::uno::Reference
<
152 ::com::sun::star::chart2::XAxis
>& xAxis
153 , sal_Int32 nDimensionIndex
, sal_Int32 nAxisIndex
);
154 rtl::OUString
createCIDForGrid( const ::com::sun::star::uno::Reference
<
155 ::com::sun::star::chart2::XAxis
>& xAxis
156 , sal_Int32 nDimensionIndex
, sal_Int32 nAxisIndex
);
158 sal_Int32
getNumberFormatKeyForAxis( const ::com::sun::star::uno::Reference
<
159 ::com::sun::star::chart2::XAxis
>& xAxis
160 , const ::com::sun::star::uno::Reference
<
161 ::com::sun::star::util::XNumberFormatsSupplier
>& xNumberFormatsSupplier
);
164 void impl_adjustDimension( sal_Int32
& rDimensionIndex
) const;
165 void impl_adjustDimensionAndIndex( sal_Int32
& rDimensionIndex
, sal_Int32
& rAxisIndex
) const;
168 ::com::sun::star::uno::Reference
<
169 ::com::sun::star::chart2::XCoordinateSystem
> m_xCooSysModel
;
171 rtl::OUString m_aCooSysParticle
;
173 typedef std::pair
< sal_Int32
, sal_Int32
> tFullAxisIndex
; //first index is the dimension, second index is the axis index that indicates wether this is a main or secondary axis
176 ::com::sun::star::uno::Reference
<
177 ::com::sun::star::drawing::XShapes
> m_xLogicTargetForGrids
;
178 ::com::sun::star::uno::Reference
<
179 ::com::sun::star::drawing::XShapes
> m_xLogicTargetForAxes
;
180 ::com::sun::star::uno::Reference
<
181 ::com::sun::star::drawing::XShapes
> m_xFinalTarget
;
182 ::com::sun::star::uno::Reference
<
183 ::com::sun::star::lang::XMultiServiceFactory
> m_xShapeFactory
;
184 ::com::sun::star::drawing::HomogenMatrix m_aMatrixSceneToScreen
;
186 CuboidPlanePosition m_eLeftWallPos
;
187 CuboidPlanePosition m_eBackWallPos
;
188 CuboidPlanePosition m_eBottomPos
;
191 MergedMinimumAndMaximumSupplier m_aMergedMinimumAndMaximumSupplier
; //this is used only for autoscaling purpose
193 ::com::sun::star::uno::Sequence
< rtl::OUString
> m_aSeriesNamesForZAxis
;
195 typedef std::map
< tFullAxisIndex
, ::boost::shared_ptr
< VAxisBase
> > tVAxisMap
;
197 tVAxisMap m_aAxisMap
;
200 ::com::sun::star::uno::Sequence
< ::com::sun::star::chart2::ExplicitScaleData
> m_aExplicitScales
;
201 ::com::sun::star::uno::Sequence
< ::com::sun::star::chart2::ExplicitIncrementData
> m_aExplicitIncrements
;
203 typedef std::map
< tFullAxisIndex
, ::com::sun::star::chart2::ExplicitScaleData
> tFullExplicitScaleMap
;
204 typedef std::map
< tFullAxisIndex
, ::com::sun::star::chart2::ExplicitIncrementData
> tFullExplicitIncrementMap
;
206 tFullExplicitScaleMap m_aSecondaryExplicitScales
;
207 tFullExplicitIncrementMap m_aSecondaryExplicitIncrements
;
209 comphelper::ImplementationReference
< ExplicitCategoriesProvider
, ::com::sun::star::chart2::data::XTextualDataSequence
>
210 m_aExplicitCategoriesProvider
;
213 //.............................................................................
215 //.............................................................................