Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / chart2 / source / view / inc / VCoordinateSystem.hxx
blobb6c199d66947299b357a86ca65afaaa3be54fc99
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 #ifndef _CHART2_VCOORDINATESYSTEM_HXX
20 #define _CHART2_VCOORDINATESYSTEM_HXX
22 #include "MinimumAndMaximumSupplier.hxx"
23 #include "ScaleAutomatism.hxx"
24 #include "ThreeDHelper.hxx"
25 #include "ExplicitCategoriesProvider.hxx"
26 #include "chartview/ExplicitScaleValues.hxx"
28 #include <com/sun/star/chart2/XCoordinateSystem.hpp>
29 #include "comphelper/implementationreference.hxx"
30 #include <com/sun/star/awt/Rectangle.hpp>
31 #include <com/sun/star/drawing/HomogenMatrix.hpp>
32 #include <com/sun/star/drawing/XShapes.hpp>
33 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
36 #include<map>
37 #include <vector>
38 #include <boost/shared_ptr.hpp>
39 #include <boost/scoped_ptr.hpp>
41 //.............................................................................
42 namespace chart
44 //.............................................................................
46 //-----------------------------------------------------------------------------
47 /**
49 class VAxisBase;
50 class VCoordinateSystem
52 public:
53 virtual ~VCoordinateSystem();
55 static VCoordinateSystem* createCoordinateSystem( const ::com::sun::star::uno::Reference<
56 ::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel );
58 virtual void initPlottingTargets(
59 const ::com::sun::star::uno::Reference<
60 ::com::sun::star::drawing::XShapes >& xLogicTarget
61 , const ::com::sun::star::uno::Reference<
62 ::com::sun::star::drawing::XShapes >& xFinalTarget
63 , const ::com::sun::star::uno::Reference<
64 ::com::sun::star::lang::XMultiServiceFactory >& xFactory
65 , ::com::sun::star::uno::Reference<
66 ::com::sun::star::drawing::XShapes >& xLogicTargetForSeriesBehindAxis )
67 throw (::com::sun::star::uno::RuntimeException);
69 void setParticle( const rtl::OUString& rCooSysParticle );
71 virtual void setTransformationSceneToScreen( const ::com::sun::star::drawing::HomogenMatrix& rMatrix );
72 ::com::sun::star::drawing::HomogenMatrix getTransformationSceneToScreen();
74 //better performance for big data
75 virtual ::com::sun::star::uno::Sequence< sal_Int32 > getCoordinateSystemResolution( const ::com::sun::star::awt::Size& rPageSize
76 , const ::com::sun::star::awt::Size& rPageResolution );
78 ExplicitScaleData getExplicitScale( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
79 ExplicitIncrementData getExplicitIncrement( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
81 void setExplicitCategoriesProvider( ExplicitCategoriesProvider* /*takes ownership*/ );
82 ExplicitCategoriesProvider* getExplicitCategoriesProvider();
84 // 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
85 ::std::vector< ExplicitScaleData > getExplicitScales( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
86 // 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
87 ::std::vector< ExplicitIncrementData > getExplicitIncrements( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
89 void addMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier );
90 bool hasMinimumAndMaximumSupplier( MinimumAndMaximumSupplier* pMinimumAndMaximumSupplier );
91 void clearMinimumAndMaximumSupplierList();
93 void prepareScaleAutomatismForDimensionAndIndex( ScaleAutomatism& rScaleAutomatism, sal_Int32 nDimIndex, sal_Int32 nAxisIndex );
95 void setExplicitScaleAndIncrement( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex
96 , const ExplicitScaleData& rExplicitScale
97 , const ExplicitIncrementData& rExplicitIncrement );
99 void set3DWallPositions( CuboidPlanePosition eLeftWallPos, CuboidPlanePosition eBackWallPos, CuboidPlanePosition eBottomPos );
101 ::com::sun::star::uno::Reference<
102 ::com::sun::star::chart2::XCoordinateSystem >
103 getModel() const;
105 virtual void createVAxisList(
106 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xNumberFormatsSupplier
107 , const ::com::sun::star::awt::Size& rFontReferenceSize
108 , const ::com::sun::star::awt::Rectangle& rMaximumSpaceForLabels );
110 virtual void initVAxisInList();
111 virtual void updateScalesAndIncrementsOnAxes();
113 virtual void createMaximumAxesLabels();
114 virtual void createAxesLabels();
115 virtual void updatePositions();
116 virtual void createAxesShapes();
118 virtual void createGridShapes();
120 virtual bool getPropertySwapXAndYAxis() const;
122 sal_Int32 getMaximumAxisIndexByDimension( sal_Int32 nDimensionIndex ) const;
124 virtual bool needSeriesNamesForAxis() const;
125 void setSeriesNamesForAxis( const ::com::sun::star::uno::Sequence< rtl::OUString >& rSeriesNames );
127 protected: //methods
128 VCoordinateSystem( const ::com::sun::star::uno::Reference<
129 ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
131 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >
132 getAxisByDimension( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ) const;
133 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > >
134 getGridListFromAxis( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
136 VAxisBase* getVAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
138 rtl::OUString createCIDForAxis( const ::com::sun::star::uno::Reference<
139 ::com::sun::star::chart2::XAxis >& xAxis
140 , sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
141 rtl::OUString createCIDForGrid( const ::com::sun::star::uno::Reference<
142 ::com::sun::star::chart2::XAxis >& xAxis
143 , sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
145 sal_Int32 getNumberFormatKeyForAxis( const ::com::sun::star::uno::Reference<
146 ::com::sun::star::chart2::XAxis >& xAxis
147 , const ::com::sun::star::uno::Reference<
148 ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
150 private: //methods
151 void impl_adjustDimension( sal_Int32& rDimensionIndex ) const;
152 void impl_adjustDimensionAndIndex( sal_Int32& rDimensionIndex, sal_Int32& rAxisIndex ) const;
154 protected: //member
155 ::com::sun::star::uno::Reference<
156 ::com::sun::star::chart2::XCoordinateSystem > m_xCooSysModel;
158 rtl::OUString m_aCooSysParticle;
160 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
163 ::com::sun::star::uno::Reference<
164 ::com::sun::star::drawing::XShapes > m_xLogicTargetForGrids;
165 ::com::sun::star::uno::Reference<
166 ::com::sun::star::drawing::XShapes > m_xLogicTargetForAxes;
167 ::com::sun::star::uno::Reference<
168 ::com::sun::star::drawing::XShapes > m_xFinalTarget;
169 ::com::sun::star::uno::Reference<
170 ::com::sun::star::lang::XMultiServiceFactory> m_xShapeFactory;
171 ::com::sun::star::drawing::HomogenMatrix m_aMatrixSceneToScreen;
173 CuboidPlanePosition m_eLeftWallPos;
174 CuboidPlanePosition m_eBackWallPos;
175 CuboidPlanePosition m_eBottomPos;
178 MergedMinimumAndMaximumSupplier m_aMergedMinimumAndMaximumSupplier; //this is used only for autoscaling purpose
180 ::com::sun::star::uno::Sequence< rtl::OUString > m_aSeriesNamesForZAxis;
182 typedef std::map< tFullAxisIndex, ::boost::shared_ptr< VAxisBase > > tVAxisMap;
184 tVAxisMap m_aAxisMap;
186 private:
187 std::vector< ExplicitScaleData > m_aExplicitScales;
188 std::vector< ExplicitIncrementData > m_aExplicitIncrements;
190 typedef std::map< tFullAxisIndex, ExplicitScaleData > tFullExplicitScaleMap;
191 typedef std::map< tFullAxisIndex, ExplicitIncrementData > tFullExplicitIncrementMap;
193 tFullExplicitScaleMap m_aSecondaryExplicitScales;
194 tFullExplicitIncrementMap m_aSecondaryExplicitIncrements;
196 boost::scoped_ptr< ExplicitCategoriesProvider > m_apExplicitCategoriesProvider;
199 //.............................................................................
200 } //namespace chart
201 //.............................................................................
202 #endif
204 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */