merged tag ooo/OOO330_m14
[LibreOffice.git] / chart2 / source / inc / AxisHelper.hxx
blob75e69436a784c512e94d649a70db4b8d9ec29637
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
27 #ifndef _CHART2_TOOLS_AXISHELPER_HXX
28 #define _CHART2_TOOLS_AXISHELPER_HXX
30 #include "charttoolsdllapi.hxx"
31 #include "ReferenceSizeProvider.hxx"
32 #include <com/sun/star/chart2/XChartType.hpp>
33 #include <com/sun/star/chart2/XCoordinateSystem.hpp>
34 #include <com/sun/star/chart2/XDiagram.hpp>
35 #include <com/sun/star/uno/XComponentContext.hpp>
37 #include <vector>
39 //.............................................................................
40 namespace chart
42 //.............................................................................
44 //-----------------------------------------------------------------------------
45 /**
48 class OOO_DLLPUBLIC_CHARTTOOLS AxisHelper
50 public:
51 static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > createLinearScaling();
52 static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > createLogarithmicScaling( double fBase = 10.0 );
54 static ::com::sun::star::chart2::ScaleData createDefaultScale();
56 static void removeExplicitScaling( ::com::sun::star::chart2::ScaleData& rScaleData );
58 static bool isLogarithmic( const ::com::sun::star::uno::Reference<
59 ::com::sun::star::chart2::XScaling >& xScaling );
61 static ::com::sun::star::uno::Reference<
62 ::com::sun::star::chart2::XAxis >
63 createAxis( sal_Int32 nDimensionIndex, bool bMainAxis
64 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram
65 , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext
66 , ReferenceSizeProvider * pRefSizeProvider = 0 );
68 static ::com::sun::star::uno::Reference<
69 ::com::sun::star::chart2::XAxis >
70 createAxis(
71 sal_Int32 nDimensionIndex
72 , sal_Int32 nAxisIndex // 0==main or 1==secondary axis
73 , const ::com::sun::star::uno::Reference<
74 ::com::sun::star::chart2::XCoordinateSystem >& xCooSys
75 , const ::com::sun::star::uno::Reference<
76 ::com::sun::star::uno::XComponentContext > & xContext
77 , ReferenceSizeProvider * pRefSizeProvider = 0 );
79 static void showAxis( sal_Int32 nDimensionIndex, bool bMainAxis
80 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram
81 , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext
82 , ReferenceSizeProvider * pRefSizeProvider = 0 );
84 static void showGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
85 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram
86 , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
88 static void hideAxis( sal_Int32 nDimensionIndex, bool bMainAxis
89 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
90 static void hideGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
91 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
93 static sal_Bool isAxisShown( sal_Int32 nDimensionIndex, bool bMainAxis
94 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
95 static sal_Bool isGridShown( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
96 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
98 static void makeAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
99 static void makeGridVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
101 static void makeAxisInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
102 static void makeGridInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
104 static void hideAxisIfNoDataIsAttached( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis
105 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram);
107 SAL_DLLPRIVATE static sal_Bool areAxisLabelsVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProperties );
108 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