xref: /AOO41X/main/chart2/source/inc/AxisHelper.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #ifndef _CHART2_TOOLS_AXISHELPER_HXX
28*cdf0e10cSrcweir #define _CHART2_TOOLS_AXISHELPER_HXX
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include "charttoolsdllapi.hxx"
31*cdf0e10cSrcweir #include "ReferenceSizeProvider.hxx"
32*cdf0e10cSrcweir #include "ExplicitCategoriesProvider.hxx"
33*cdf0e10cSrcweir #include <com/sun/star/chart2/XChartType.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/chart2/XCoordinateSystem.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/chart2/XDiagram.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #include <vector>
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir //.............................................................................
42*cdf0e10cSrcweir namespace chart
43*cdf0e10cSrcweir {
44*cdf0e10cSrcweir //.............................................................................
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir //-----------------------------------------------------------------------------
47*cdf0e10cSrcweir /**
48*cdf0e10cSrcweir */
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir class OOO_DLLPUBLIC_CHARTTOOLS AxisHelper
51*cdf0e10cSrcweir {
52*cdf0e10cSrcweir public:
53*cdf0e10cSrcweir     static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > createLinearScaling();
54*cdf0e10cSrcweir     static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > createLogarithmicScaling( double fBase = 10.0 );
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir     static ::com::sun::star::chart2::ScaleData createDefaultScale();
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir     static void removeExplicitScaling( ::com::sun::star::chart2::ScaleData& rScaleData );
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir     static bool isLogarithmic( const ::com::sun::star::uno::Reference<
61*cdf0e10cSrcweir                 ::com::sun::star::chart2::XScaling >& xScaling );
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir     static void checkDateAxis( ::com::sun::star::chart2::ScaleData& rScale, ExplicitCategoriesProvider* pExplicitCategoriesProvider, bool bChartTypeAllowsDateAxis );
64*cdf0e10cSrcweir     static ::com::sun::star::chart2::ScaleData getDateCheckedScale( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel );
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir     static sal_Int32 getExplicitNumberFormatKeyForAxis(
67*cdf0e10cSrcweir                   const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis
68*cdf0e10cSrcweir                 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& xCorrespondingCoordinateSystem
69*cdf0e10cSrcweir                 , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier
70*cdf0e10cSrcweir                 , bool bSearchForParallelAxisIfNothingIsFound );
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir     static ::com::sun::star::uno::Reference<
73*cdf0e10cSrcweir            ::com::sun::star::chart2::XAxis >
74*cdf0e10cSrcweir         createAxis( sal_Int32 nDimensionIndex, bool bMainAxis
75*cdf0e10cSrcweir                 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram
76*cdf0e10cSrcweir                 , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext
77*cdf0e10cSrcweir                 , ReferenceSizeProvider * pRefSizeProvider = 0 );
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir     static ::com::sun::star::uno::Reference<
80*cdf0e10cSrcweir            ::com::sun::star::chart2::XAxis >
81*cdf0e10cSrcweir         createAxis(
82*cdf0e10cSrcweir             sal_Int32 nDimensionIndex
83*cdf0e10cSrcweir             , sal_Int32 nAxisIndex // 0==main or 1==secondary axis
84*cdf0e10cSrcweir             , const ::com::sun::star::uno::Reference<
85*cdf0e10cSrcweir                     ::com::sun::star::chart2::XCoordinateSystem >& xCooSys
86*cdf0e10cSrcweir             , const ::com::sun::star::uno::Reference<
87*cdf0e10cSrcweir                     ::com::sun::star::uno::XComponentContext > & xContext
88*cdf0e10cSrcweir             , ReferenceSizeProvider * pRefSizeProvider = 0 );
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir     static void showAxis( sal_Int32 nDimensionIndex, bool bMainAxis
91*cdf0e10cSrcweir                 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram
92*cdf0e10cSrcweir                 , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext
93*cdf0e10cSrcweir                 , ReferenceSizeProvider * pRefSizeProvider = 0 );
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir     static void showGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
96*cdf0e10cSrcweir                 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram
97*cdf0e10cSrcweir                 , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir     static void hideAxis( sal_Int32 nDimensionIndex, bool bMainAxis
100*cdf0e10cSrcweir                 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
101*cdf0e10cSrcweir     static void hideGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
102*cdf0e10cSrcweir                 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir     static sal_Bool isAxisShown( sal_Int32 nDimensionIndex, bool bMainAxis
105*cdf0e10cSrcweir                 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
106*cdf0e10cSrcweir     static sal_Bool isGridShown( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
107*cdf0e10cSrcweir                 , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram );
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir     static void makeAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
110*cdf0e10cSrcweir     static void makeGridVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir     static void makeAxisInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
113*cdf0e10cSrcweir     static void makeGridInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir     static void hideAxisIfNoDataIsAttached( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis
116*cdf0e10cSrcweir                                           , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram);
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir     SAL_DLLPRIVATE static sal_Bool areAxisLabelsVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProperties );
119*cdf0e10cSrcweir     static sal_Bool isAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
120*cdf0e10cSrcweir     static sal_Bool isGridVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir     static ::com::sun::star::uno::Reference<
123*cdf0e10cSrcweir             ::com::sun::star::chart2::XCoordinateSystem >
124*cdf0e10cSrcweir         getCoordinateSystemByIndex(
125*cdf0e10cSrcweir             const ::com::sun::star::uno::Reference<
126*cdf0e10cSrcweir             ::com::sun::star::chart2::XDiagram >& xDiagram
127*cdf0e10cSrcweir             , sal_Int32 nIndex );
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir     static ::com::sun::star::uno::Reference<
130*cdf0e10cSrcweir             ::com::sun::star::chart2::XCoordinateSystem >
131*cdf0e10cSrcweir         getCoordinateSystemOfAxis(
132*cdf0e10cSrcweir               const ::com::sun::star::uno::Reference<
133*cdf0e10cSrcweir                 ::com::sun::star::chart2::XAxis >& xAxis
134*cdf0e10cSrcweir             , const ::com::sun::star::uno::Reference<
135*cdf0e10cSrcweir                 ::com::sun::star::chart2::XDiagram >& xDiagram );
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir     static ::com::sun::star::uno::Reference<
138*cdf0e10cSrcweir             ::com::sun::star::chart2::XAxis >
139*cdf0e10cSrcweir         getAxis( sal_Int32 nDimensionIndex, bool bMainAxis
140*cdf0e10cSrcweir                 , const ::com::sun::star::uno::Reference<
141*cdf0e10cSrcweir                     ::com::sun::star::chart2::XDiagram >& xDiagram );
142*cdf0e10cSrcweir     static ::com::sun::star::uno::Reference<
143*cdf0e10cSrcweir             ::com::sun::star::chart2::XAxis >
144*cdf0e10cSrcweir         getAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex
145*cdf0e10cSrcweir             , const ::com::sun::star::uno::Reference<
146*cdf0e10cSrcweir                     ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir     static ::com::sun::star::uno::Reference<
149*cdf0e10cSrcweir             ::com::sun::star::chart2::XAxis >
150*cdf0e10cSrcweir         getCrossingMainAxis( const ::com::sun::star::uno::Reference<
151*cdf0e10cSrcweir                 ::com::sun::star::chart2::XAxis >& xAxis
152*cdf0e10cSrcweir             , const ::com::sun::star::uno::Reference<
153*cdf0e10cSrcweir                     ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir     static ::com::sun::star::uno::Reference<
156*cdf0e10cSrcweir             ::com::sun::star::chart2::XAxis >
157*cdf0e10cSrcweir         getParallelAxis( const ::com::sun::star::uno::Reference<
158*cdf0e10cSrcweir                 ::com::sun::star::chart2::XAxis >& xAxis
159*cdf0e10cSrcweir             , const ::com::sun::star::uno::Reference<
160*cdf0e10cSrcweir                     ::com::sun::star::chart2::XDiagram >& xDiagram );
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir     static ::com::sun::star::uno::Reference<
163*cdf0e10cSrcweir             ::com::sun::star::beans::XPropertySet >
164*cdf0e10cSrcweir         getGridProperties( const ::com::sun::star::uno::Reference<
165*cdf0e10cSrcweir                     ::com::sun::star::chart2::XCoordinateSystem >& xCooSys
166*cdf0e10cSrcweir                 , sal_Int32 nDimensionIndex
167*cdf0e10cSrcweir                 , sal_Int32 nAxisIndex //0: Primary axies, 1: secondary axis
168*cdf0e10cSrcweir                 , sal_Int32 nSubGridIndex = -1 //-1: Main Grid; 0: First SubGrid etc
169*cdf0e10cSrcweir                 );
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir     static sal_Int32 getDimensionIndexOfAxis(
172*cdf0e10cSrcweir               const ::com::sun::star::uno::Reference<
173*cdf0e10cSrcweir                     ::com::sun::star::chart2::XAxis >& xAxis
174*cdf0e10cSrcweir             , const ::com::sun::star::uno::Reference<
175*cdf0e10cSrcweir                     ::com::sun::star::chart2::XDiagram >& xDiagram );
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir     static bool getIndicesForAxis(
178*cdf0e10cSrcweir               const ::com::sun::star::uno::Reference<
179*cdf0e10cSrcweir                     ::com::sun::star::chart2::XAxis >& xAxis
180*cdf0e10cSrcweir             , const ::com::sun::star::uno::Reference<
181*cdf0e10cSrcweir                     ::com::sun::star::chart2::XCoordinateSystem >& xCooSys
182*cdf0e10cSrcweir             , sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex );
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir     static bool getIndicesForAxis(
185*cdf0e10cSrcweir               const ::com::sun::star::uno::Reference<
186*cdf0e10cSrcweir                     ::com::sun::star::chart2::XAxis >& xAxis
187*cdf0e10cSrcweir             , const ::com::sun::star::uno::Reference<
188*cdf0e10cSrcweir                     ::com::sun::star::chart2::XDiagram >& xDiagram
189*cdf0e10cSrcweir             , sal_Int32& rOutCooSysIndex, sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex );
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir     /** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to
192*cdf0e10cSrcweir                </sal_True> are returned
193*cdf0e10cSrcweir      */
194*cdf0e10cSrcweir     static ::com::sun::star::uno::Sequence<
195*cdf0e10cSrcweir                 ::com::sun::star::uno::Reference<
196*cdf0e10cSrcweir                     ::com::sun::star::chart2::XAxis > >
197*cdf0e10cSrcweir             getAllAxesOfDiagram( const ::com::sun::star::uno::Reference<
198*cdf0e10cSrcweir                     ::com::sun::star::chart2::XDiagram >& xDiagram
199*cdf0e10cSrcweir             , bool bOnlyVisible = false );
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir     /** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to
202*cdf0e10cSrcweir                </sal_True> are returned
203*cdf0e10cSrcweir      */
204*cdf0e10cSrcweir     SAL_DLLPRIVATE static std::vector<
205*cdf0e10cSrcweir                 ::com::sun::star::uno::Reference<
206*cdf0e10cSrcweir                     ::com::sun::star::chart2::XAxis > >
207*cdf0e10cSrcweir             getAllAxesOfCoordinateSystem( const ::com::sun::star::uno::Reference<
208*cdf0e10cSrcweir                     ::com::sun::star::chart2::XCoordinateSystem >& xCooSys
209*cdf0e10cSrcweir             , bool bOnlyVisible = false );
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir     static ::com::sun::star::uno::Sequence<
212*cdf0e10cSrcweir                 ::com::sun::star::uno::Reference<
213*cdf0e10cSrcweir                     ::com::sun::star::beans::XPropertySet > >
214*cdf0e10cSrcweir             getAllGrids( const ::com::sun::star::uno::Reference<
215*cdf0e10cSrcweir                     ::com::sun::star::chart2::XDiagram >& xDiagram );
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir     static void getAxisOrGridPossibilities( ::com::sun::star::uno::Sequence< sal_Bool >& rPossibilityList
218*cdf0e10cSrcweir         , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram>& xDiagram, sal_Bool bAxis=sal_True );
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir     static void getAxisOrGridExcistence( ::com::sun::star::uno::Sequence< sal_Bool >& rExcistenceList
221*cdf0e10cSrcweir         , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram>& xDiagram, sal_Bool bAxis=sal_True );
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir     static bool changeVisibilityOfGrids( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram>& xDiagram
224*cdf0e10cSrcweir                         , const ::com::sun::star::uno::Sequence< sal_Bool >& rOldExistenceList
225*cdf0e10cSrcweir                         , const ::com::sun::star::uno::Sequence< sal_Bool >& rNewExistenceList
226*cdf0e10cSrcweir                         , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir     static bool changeVisibilityOfAxes( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram>& xDiagram
229*cdf0e10cSrcweir                         , const ::com::sun::star::uno::Sequence< sal_Bool >& rOldExistenceList
230*cdf0e10cSrcweir                         , const ::com::sun::star::uno::Sequence< sal_Bool >& rNewExistenceList
231*cdf0e10cSrcweir                         , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext
232*cdf0e10cSrcweir                         , ReferenceSizeProvider * pRefSizeProvider = 0 );
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir     static bool shouldAxisBeDisplayed( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis
235*cdf0e10cSrcweir                                        , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
236*cdf0e10cSrcweir     static bool isSecondaryYAxisNeeded( const ::com::sun::star::uno::Reference<
237*cdf0e10cSrcweir                     ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir     static ::com::sun::star::uno::Reference<
240*cdf0e10cSrcweir             ::com::sun::star::chart2::XChartType >
241*cdf0e10cSrcweir         getChartTypeByIndex( const ::com::sun::star::uno::Reference<
242*cdf0e10cSrcweir             ::com::sun::star::chart2::XCoordinateSystem >& xCooSys, sal_Int32 nIndex );
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir     static void setRTLAxisLayout( const ::com::sun::star::uno::Reference<
245*cdf0e10cSrcweir             ::com::sun::star::chart2::XCoordinateSystem >& xCooSys );
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir     static ::com::sun::star::uno::Reference<
248*cdf0e10cSrcweir             ::com::sun::star::chart2::XChartType >
249*cdf0e10cSrcweir         getFirstChartTypeWithSeriesAttachedToAxisIndex( const ::com::sun::star::uno::Reference<
250*cdf0e10cSrcweir             ::com::sun::star::chart2::XDiagram >& xDiagram, const sal_Int32 nAttachedAxisIndex );
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir     static bool isAxisPositioningEnabled();
253*cdf0e10cSrcweir };
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir //.............................................................................
256*cdf0e10cSrcweir } //namespace chart
257*cdf0e10cSrcweir //.............................................................................
258*cdf0e10cSrcweir #endif
259