update dev300-m58
[ooovba.git] / chart2 / source / inc / AxisHelper.hxx
blobc1091317676aec53f45b6c80b4434630e0174f0b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: AxisHelper.hxx,v $
10 * $Revision: 1.4 $
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_TOOLS_AXISHELPER_HXX
31 #define _CHART2_TOOLS_AXISHELPER_HXX
33 #include "charttoolsdllapi.hxx"
34 #include "ReferenceSizeProvider.hxx"
35 #include <com/sun/star/chart2/XChartType.hpp>
36 #include <com/sun/star/chart2/XCoordinateSystem.hpp>
37 #include <com/sun/star/chart2/XDiagram.hpp>
38 #include <com/sun/star/uno/XComponentContext.hpp>
40 #include <vector>
42 //.............................................................................
43 namespace chart
45 //.............................................................................
47 //-----------------------------------------------------------------------------
48 /**
51 class OOO_DLLPUBLIC_CHARTTOOLS AxisHelper
53 public:
54 static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > createLinearScaling();
55 static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > createLogarithmicScaling( double fBase = 10.0 );
57 static ::com::sun::star::chart2::ScaleData createDefaultScale();
59 static void removeExplicitScaling( ::com::sun::star::chart2::ScaleData& rScaleData );
61 static bool isLogarithmic( const ::com::sun::star::uno::Reference<
62 ::com::sun::star::chart2::XScaling >& xScaling );
64 static ::com::sun::star::uno::Reference<
65 ::com::sun::star::chart2::XAxis >
66 createAxis( sal_Int32 nDimensionIndex, bool bMainAxis
67 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram
68 , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext
69 , ReferenceSizeProvider * pRefSizeProvider = 0 );
71 static ::com::sun::star::uno::Reference<
72 ::com::sun::star::chart2::XAxis >
73 createAxis(
74 sal_Int32 nDimensionIndex
75 , sal_Int32 nAxisIndex // 0==main or 1==secondary axis
76 , const ::com::sun::star::uno::Reference<
77 ::com::sun::star::chart2::XCoordinateSystem >& xCooSys
78 , const ::com::sun::star::uno::Reference<
79 ::com::sun::star::uno::XComponentContext > & xContext
80 , ReferenceSizeProvider * pRefSizeProvider = 0 );
82 static void showAxis( sal_Int32 nDimensionIndex, bool bMainAxis
83 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram
84 , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext
85 , ReferenceSizeProvider * pRefSizeProvider = 0 );
87 static void showGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
88 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram
89 , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
91 static void hideAxis( sal_Int32 nDimensionIndex, bool bMainAxis
92 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
93 static void hideGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
94 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
96 static sal_Bool isAxisShown( sal_Int32 nDimensionIndex, bool bMainAxis
97 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
98 static sal_Bool isGridShown( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
99 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
101 SAL_DLLPRIVATE static void makeAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
102 static void makeGridVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
104 SAL_DLLPRIVATE static void makeAxisInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
105 SAL_DLLPRIVATE static void makeGridInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
107 SAL_DLLPRIVATE static sal_Bool areAxisLabelsVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProperties );
108 SAL_DLLPRIVATE static sal_Bool isAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
109 static sal_Bool isGridVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
111 static ::com::sun::star::uno::Reference<
112 ::com::sun::star::chart2::XCoordinateSystem >
113 getCoordinateSystemByIndex(
114 const ::com::sun::star::uno::Reference<
115 ::com::sun::star::chart2::XDiagram >& xDiagram
116 , sal_Int32 nIndex );
118 static ::com::sun::star::uno::Reference<
119 ::com::sun::star::chart2::XCoordinateSystem >
120 getCoordinateSystemOfAxis(
121 const ::com::sun::star::uno::Reference<
122 ::com::sun::star::chart2::XAxis >& xAxis
123 , const ::com::sun::star::uno::Reference<
124 ::com::sun::star::chart2::XDiagram >& xDiagram );
126 static ::com::sun::star::uno::Reference<
127 ::com::sun::star::chart2::XAxis >
128 getAxis( sal_Int32 nDimensionIndex, bool bMainAxis
129 , const ::com::sun::star::uno::Reference<
130 ::com::sun::star::chart2::XDiagram >& xDiagram );
131 static ::com::sun::star::uno::Reference<
132 ::com::sun::star::chart2::XAxis >
133 getAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex
134 , const ::com::sun::star::uno::Reference<
135 ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
137 static ::com::sun::star::uno::Reference<
138 ::com::sun::star::chart2::XAxis >
139 getCrossingMainAxis( const ::com::sun::star::uno::Reference<
140 ::com::sun::star::chart2::XAxis >& xAxis
141 , const ::com::sun::star::uno::Reference<
142 ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
144 static ::com::sun::star::uno::Reference<
145 ::com::sun::star::chart2::XAxis >
146 getParallelAxis( const ::com::sun::star::uno::Reference<
147 ::com::sun::star::chart2::XAxis >& xAxis
148 , const ::com::sun::star::uno::Reference<
149 ::com::sun::star::chart2::XDiagram >& xDiagram );
151 static ::com::sun::star::uno::Reference<
152 ::com::sun::star::beans::XPropertySet >
153 getGridProperties( const ::com::sun::star::uno::Reference<
154 ::com::sun::star::chart2::XCoordinateSystem >& xCooSys
155 , sal_Int32 nDimensionIndex
156 , sal_Int32 nAxisIndex //0: Primary axies, 1: secondary axis
157 , sal_Int32 nSubGridIndex = -1 //-1: Main Grid; 0: First SubGrid etc
160 static sal_Int32 getDimensionIndexOfAxis(
161 const ::com::sun::star::uno::Reference<
162 ::com::sun::star::chart2::XAxis >& xAxis
163 , const ::com::sun::star::uno::Reference<
164 ::com::sun::star::chart2::XDiagram >& xDiagram );
166 static bool getIndicesForAxis(
167 const ::com::sun::star::uno::Reference<
168 ::com::sun::star::chart2::XAxis >& xAxis
169 , const ::com::sun::star::uno::Reference<
170 ::com::sun::star::chart2::XCoordinateSystem >& xCooSys
171 , sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex );
173 static bool getIndicesForAxis(
174 const ::com::sun::star::uno::Reference<
175 ::com::sun::star::chart2::XAxis >& xAxis
176 , const ::com::sun::star::uno::Reference<
177 ::com::sun::star::chart2::XDiagram >& xDiagram
178 , sal_Int32& rOutCooSysIndex, sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex );
180 /** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to
181 </TRUE> are returned
183 static ::com::sun::star::uno::Sequence<
184 ::com::sun::star::uno::Reference<
185 ::com::sun::star::chart2::XAxis > >
186 getAllAxesOfDiagram( const ::com::sun::star::uno::Reference<
187 ::com::sun::star::chart2::XDiagram >& xDiagram
188 , bool bOnlyVisible = false );
190 /** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to
191 </TRUE> are returned
193 SAL_DLLPRIVATE static std::vector<
194 ::com::sun::star::uno::Reference<
195 ::com::sun::star::chart2::XAxis > >
196 getAllAxesOfCoordinateSystem( const ::com::sun::star::uno::Reference<
197 ::com::sun::star::chart2::XCoordinateSystem >& xCooSys
198 , bool bOnlyVisible = false );
200 static ::com::sun::star::uno::Sequence<
201 ::com::sun::star::uno::Reference<
202 ::com::sun::star::beans::XPropertySet > >
203 getAllGrids( const ::com::sun::star::uno::Reference<
204 ::com::sun::star::chart2::XDiagram >& xDiagram );
206 static void getAxisOrGridPossibilities( ::com::sun::star::uno::Sequence< sal_Bool >& rPossibilityList
207 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram>& xDiagram, sal_Bool bAxis=sal_True );
209 static void getAxisOrGridExcistence( ::com::sun::star::uno::Sequence< sal_Bool >& rExcistenceList
210 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram>& xDiagram, sal_Bool bAxis=sal_True );
212 static bool changeVisibilityOfGrids( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram>& xDiagram
213 , const ::com::sun::star::uno::Sequence< sal_Bool >& rOldExistenceList
214 , const ::com::sun::star::uno::Sequence< sal_Bool >& rNewExistenceList
215 , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
217 static bool changeVisibilityOfAxes( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram>& xDiagram
218 , const ::com::sun::star::uno::Sequence< sal_Bool >& rOldExistenceList
219 , const ::com::sun::star::uno::Sequence< sal_Bool >& rNewExistenceList
220 , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext
221 , ReferenceSizeProvider * pRefSizeProvider = 0 );
223 static bool shouldAxisBeDisplayed( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis
224 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
225 static bool isSecondaryYAxisNeeded( const ::com::sun::star::uno::Reference<
226 ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
228 static ::com::sun::star::uno::Reference<
229 ::com::sun::star::chart2::XChartType >
230 getChartTypeByIndex( const ::com::sun::star::uno::Reference<
231 ::com::sun::star::chart2::XCoordinateSystem >& xCooSys, sal_Int32 nIndex );
233 static void setRTLAxisLayout( const ::com::sun::star::uno::Reference<
234 ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
236 static ::com::sun::star::uno::Reference<
237 ::com::sun::star::chart2::XChartType >
238 getFirstChartTypeWithSeriesAttachedToAxisIndex( const ::com::sun::star::uno::Reference<
239 ::com::sun::star::chart2::XDiagram >& xDiagram, const sal_Int32 nAttachedAxisIndex );
241 static bool isAxisPositioningEnabled();
244 //.............................................................................
245 } //namespace chart
246 //.............................................................................
247 #endif