Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / chart2 / source / inc / AxisHelper.hxx
blob2cbe2d82e381838dd8f9a64077f030981ed05b02
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 INCLUDED_CHART2_SOURCE_INC_AXISHELPER_HXX
20 #define INCLUDED_CHART2_SOURCE_INC_AXISHELPER_HXX
22 #include "charttoolsdllapi.hxx"
23 #include <com/sun/star/chart2/ScaleData.hpp>
25 #include <vector>
27 namespace chart { class ChartModel; }
28 namespace chart { class ExplicitCategoriesProvider; }
29 namespace chart { class ReferenceSizeProvider; }
30 namespace com { namespace sun { namespace star { namespace beans { class XPropertySet; } } } }
31 namespace com { namespace sun { namespace star { namespace chart2 { class XAxis; } } } }
32 namespace com { namespace sun { namespace star { namespace chart2 { class XChartDocument; } } } }
33 namespace com { namespace sun { namespace star { namespace chart2 { class XChartType; } } } }
34 namespace com { namespace sun { namespace star { namespace chart2 { class XCoordinateSystem; } } } }
35 namespace com { namespace sun { namespace star { namespace chart2 { class XDiagram; } } } }
36 namespace com { namespace sun { namespace star { namespace chart2 { class XScaling; } } } }
37 namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } }
39 namespace chart
42 class OOO_DLLPUBLIC_CHARTTOOLS AxisHelper
44 public:
45 static css::uno::Reference< css::chart2::XScaling > createLinearScaling();
46 static css::uno::Reference< css::chart2::XScaling > createLogarithmicScaling( double fBase = 10.0 );
48 static css::chart2::ScaleData createDefaultScale();
50 static void removeExplicitScaling( css::chart2::ScaleData& rScaleData );
52 static bool isLogarithmic( const css::uno::Reference< css::chart2::XScaling >& xScaling );
54 static void checkDateAxis( css::chart2::ScaleData& rScale, ExplicitCategoriesProvider* pExplicitCategoriesProvider, bool bChartTypeAllowsDateAxis );
55 static css::chart2::ScaleData getDateCheckedScale( const css::uno::Reference< css::chart2::XAxis >& xAxis, ChartModel& rModel );
57 static sal_Int32 getExplicitNumberFormatKeyForAxis(
58 const css::uno::Reference< css::chart2::XAxis >& xAxis
59 , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCorrespondingCoordinateSystem
60 , const css::uno::Reference< css::chart2::XChartDocument>& xChartDoc
61 , bool bSearchForParallelAxisIfNothingIsFound );
63 static css::uno::Reference<
64 css::chart2::XAxis >
65 createAxis( sal_Int32 nDimensionIndex, bool bMainAxis
66 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram
67 , const css::uno::Reference< css::uno::XComponentContext >& xContext
68 , ReferenceSizeProvider * pRefSizeProvider = nullptr );
70 static css::uno::Reference< css::chart2::XAxis >
71 createAxis(
72 sal_Int32 nDimensionIndex
73 , sal_Int32 nAxisIndex // 0==main or 1==secondary axis
74 , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys
75 , const css::uno::Reference< css::uno::XComponentContext > & xContext
76 , ReferenceSizeProvider * pRefSizeProvider = nullptr );
78 static void showAxis( sal_Int32 nDimensionIndex, bool bMainAxis
79 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram
80 , const css::uno::Reference< css::uno::XComponentContext >& xContext
81 , ReferenceSizeProvider * pRefSizeProvider = nullptr );
83 static void showGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
84 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
86 static void hideAxis( sal_Int32 nDimensionIndex, bool bMainAxis
87 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
88 static void hideGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
89 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
91 static bool isAxisShown( sal_Int32 nDimensionIndex, bool bMainAxis
92 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
93 static bool isGridShown( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
94 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
96 static void makeAxisVisible( const css::uno::Reference< css::chart2::XAxis >& xAxis );
97 static void makeGridVisible( const css::uno::Reference< css::beans::XPropertySet >& xGridProperties );
99 static void makeAxisInvisible( const css::uno::Reference< css::chart2::XAxis >& xAxis );
100 static void makeGridInvisible( const css::uno::Reference< css::beans::XPropertySet >& xGridProperties );
102 static void hideAxisIfNoDataIsAttached( const css::uno::Reference< css::chart2::XAxis >& xAxis
103 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram);
105 SAL_DLLPRIVATE static bool areAxisLabelsVisible( const css::uno::Reference< css::beans::XPropertySet >& xAxisProperties );
106 static bool isAxisVisible( const css::uno::Reference< css::chart2::XAxis >& xAxis );
107 static bool isGridVisible( const css::uno::Reference< css::beans::XPropertySet >& xGridProperties );
109 static css::uno::Reference< css::chart2::XCoordinateSystem >
110 getCoordinateSystemByIndex(
111 const css::uno::Reference< css::chart2::XDiagram >& xDiagram
112 , sal_Int32 nIndex );
114 static css::uno::Reference< css::chart2::XCoordinateSystem >
115 getCoordinateSystemOfAxis(
116 const css::uno::Reference< css::chart2::XAxis >& xAxis
117 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
119 static css::uno::Reference< css::chart2::XAxis >
120 getAxis( sal_Int32 nDimensionIndex, bool bMainAxis
121 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
122 static css::uno::Reference< css::chart2::XAxis >
123 getAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex
124 , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys );
126 static css::uno::Reference< css::chart2::XAxis >
127 getCrossingMainAxis( const css::uno::Reference< css::chart2::XAxis >& xAxis
128 , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys );
130 static css::uno::Reference< css::chart2::XAxis >
131 getParallelAxis( const css::uno::Reference< css::chart2::XAxis >& xAxis
132 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
134 static css::uno::Reference< css::beans::XPropertySet >
135 getGridProperties( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys
136 , sal_Int32 nDimensionIndex
137 , sal_Int32 nAxisIndex //0: Primary axis, 1: secondary axis
138 , sal_Int32 nSubGridIndex //-1: Main Grid; 0: First SubGrid etc
141 static sal_Int32 getDimensionIndexOfAxis(
142 const css::uno::Reference< css::chart2::XAxis >& xAxis
143 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
145 static bool getIndicesForAxis(
146 const css::uno::Reference< css::chart2::XAxis >& xAxis
147 , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys
148 , sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex );
150 static bool getIndicesForAxis(
151 const css::uno::Reference< css::chart2::XAxis >& xAxis
152 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram
153 , sal_Int32& rOutCooSysIndex, sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex );
155 /** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to
156 </sal_True> are returned
158 static css::uno::Sequence< css::uno::Reference< css::chart2::XAxis > >
159 getAllAxesOfDiagram( const css::uno::Reference< css::chart2::XDiagram >& xDiagram
160 , bool bOnlyVisible = false );
162 /** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to
163 </sal_True> are returned
165 SAL_DLLPRIVATE static std::vector< css::uno::Reference< css::chart2::XAxis > >
166 getAllAxesOfCoordinateSystem( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys
167 , bool bOnlyVisible = false );
169 static css::uno::Sequence< css::uno::Reference< css::beans::XPropertySet > >
170 getAllGrids( const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
172 static void getAxisOrGridPossibilities( css::uno::Sequence< sal_Bool >& rPossibilityList
173 , const css::uno::Reference< css::chart2::XDiagram>& xDiagram, bool bAxis=true );
175 static void getAxisOrGridExcistence( css::uno::Sequence< sal_Bool >& rExcistenceList
176 , const css::uno::Reference< css::chart2::XDiagram>& xDiagram, bool bAxis=true );
178 static bool changeVisibilityOfGrids( const css::uno::Reference< css::chart2::XDiagram>& xDiagram
179 , const css::uno::Sequence< sal_Bool >& rOldExistenceList
180 , const css::uno::Sequence< sal_Bool >& rNewExistenceList );
182 static bool changeVisibilityOfAxes( const css::uno::Reference< css::chart2::XDiagram>& xDiagram
183 , const css::uno::Sequence< sal_Bool >& rOldExistenceList
184 , const css::uno::Sequence< sal_Bool >& rNewExistenceList
185 , const css::uno::Reference< css::uno::XComponentContext >& xContext
186 , ReferenceSizeProvider * pRefSizeProvider );
188 static bool shouldAxisBeDisplayed( const css::uno::Reference< css::chart2::XAxis >& xAxis
189 , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys );
190 static bool isSecondaryYAxisNeeded( const css::uno::Reference<
191 css::chart2::XCoordinateSystem >& xCooSys );
193 static css::uno::Reference< css::chart2::XChartType >
194 getChartTypeByIndex( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys,
195 sal_Int32 nIndex );
197 static void setRTLAxisLayout( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys );
199 static css::uno::Reference< css::chart2::XChartType >
200 getFirstChartTypeWithSeriesAttachedToAxisIndex( const css::uno::Reference< css::chart2::XDiagram >& xDiagram, const sal_Int32 nAttachedAxisIndex );
202 static bool isAxisPositioningEnabled();
205 } //namespace chart
206 #endif
208 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */