nss: upgrade to release 3.73
[LibreOffice.git] / chart2 / source / inc / AxisHelper.hxx
blobb16673f97fcbc2953b5135650f09fb480993d38a
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 #pragma once
21 #include "charttoolsdllapi.hxx"
22 #include <com/sun/star/chart2/ScaleData.hpp>
24 #include <vector>
26 namespace chart { class ChartModel; }
27 namespace chart { class ExplicitCategoriesProvider; }
28 namespace chart { class ReferenceSizeProvider; }
29 namespace com::sun::star::beans { class XPropertySet; }
30 namespace com::sun::star::chart2 { class XAxis; }
31 namespace com::sun::star::chart2 { class XChartDocument; }
32 namespace com::sun::star::chart2 { class XChartType; }
33 namespace com::sun::star::chart2 { class XCoordinateSystem; }
34 namespace com::sun::star::chart2 { class XDiagram; }
35 namespace com::sun::star::chart2 { class XScaling; }
36 namespace com::sun::star::uno { class XComponentContext; }
38 namespace chart
41 class OOO_DLLPUBLIC_CHARTTOOLS AxisHelper
43 public:
44 static css::uno::Reference< css::chart2::XScaling > createLinearScaling();
45 static css::uno::Reference< css::chart2::XScaling > createLogarithmicScaling( double fBase = 10.0 );
47 static css::chart2::ScaleData createDefaultScale();
49 static void removeExplicitScaling( css::chart2::ScaleData& rScaleData );
51 static bool isLogarithmic( const css::uno::Reference< css::chart2::XScaling >& xScaling );
53 static void checkDateAxis( css::chart2::ScaleData& rScale, ExplicitCategoriesProvider* pExplicitCategoriesProvider, bool bChartTypeAllowsDateAxis );
54 static css::chart2::ScaleData getDateCheckedScale( const css::uno::Reference< css::chart2::XAxis >& xAxis, ChartModel& rModel );
56 static sal_Int32 getExplicitNumberFormatKeyForAxis(
57 const css::uno::Reference< css::chart2::XAxis >& xAxis
58 , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCorrespondingCoordinateSystem
59 , const css::uno::Reference< css::chart2::XChartDocument>& xChartDoc
60 , bool bSearchForParallelAxisIfNothingIsFound );
62 static css::uno::Reference<
63 css::chart2::XAxis >
64 createAxis( sal_Int32 nDimensionIndex, bool bMainAxis
65 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram
66 , const css::uno::Reference< css::uno::XComponentContext >& xContext
67 , ReferenceSizeProvider * pRefSizeProvider = nullptr );
69 static css::uno::Reference< css::chart2::XAxis >
70 createAxis(
71 sal_Int32 nDimensionIndex
72 , sal_Int32 nAxisIndex // 0==main or 1==secondary axis
73 , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys
74 , const css::uno::Reference< css::uno::XComponentContext > & xContext
75 , ReferenceSizeProvider * pRefSizeProvider = nullptr );
77 static void showAxis( sal_Int32 nDimensionIndex, bool bMainAxis
78 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram
79 , const css::uno::Reference< css::uno::XComponentContext >& xContext
80 , ReferenceSizeProvider * pRefSizeProvider = nullptr );
82 static void showGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
83 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
85 static void hideAxis( sal_Int32 nDimensionIndex, bool bMainAxis
86 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
87 static void hideGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
88 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
90 static bool isAxisShown( sal_Int32 nDimensionIndex, bool bMainAxis
91 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
92 static bool isGridShown( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
93 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
95 static void makeAxisVisible( const css::uno::Reference< css::chart2::XAxis >& xAxis );
96 static void makeGridVisible( const css::uno::Reference< css::beans::XPropertySet >& xGridProperties );
98 static void makeAxisInvisible( const css::uno::Reference< css::chart2::XAxis >& xAxis );
99 static void makeGridInvisible( const css::uno::Reference< css::beans::XPropertySet >& xGridProperties );
101 static void hideAxisIfNoDataIsAttached( const css::uno::Reference< css::chart2::XAxis >& xAxis
102 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram);
104 SAL_DLLPRIVATE static bool areAxisLabelsVisible( const css::uno::Reference< css::beans::XPropertySet >& xAxisProperties );
105 static bool isAxisVisible( const css::uno::Reference< css::chart2::XAxis >& xAxis );
106 static bool isGridVisible( const css::uno::Reference< css::beans::XPropertySet >& xGridProperties );
108 static css::uno::Reference< css::chart2::XCoordinateSystem >
109 getCoordinateSystemByIndex(
110 const css::uno::Reference< css::chart2::XDiagram >& xDiagram
111 , sal_Int32 nIndex );
113 static css::uno::Reference< css::chart2::XCoordinateSystem >
114 getCoordinateSystemOfAxis(
115 const css::uno::Reference< css::chart2::XAxis >& xAxis
116 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
118 static css::uno::Reference< css::chart2::XAxis >
119 getAxis( sal_Int32 nDimensionIndex, bool bMainAxis
120 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
121 static css::uno::Reference< css::chart2::XAxis >
122 getAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex
123 , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys );
125 static css::uno::Reference< css::chart2::XAxis >
126 getCrossingMainAxis( const css::uno::Reference< css::chart2::XAxis >& xAxis
127 , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys );
129 static css::uno::Reference< css::chart2::XAxis >
130 getParallelAxis( const css::uno::Reference< css::chart2::XAxis >& xAxis
131 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
133 static css::uno::Reference< css::beans::XPropertySet >
134 getGridProperties( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys
135 , sal_Int32 nDimensionIndex
136 , sal_Int32 nAxisIndex //0: Primary axis, 1: secondary axis
137 , sal_Int32 nSubGridIndex //-1: Main Grid; 0: First SubGrid etc
140 static sal_Int32 getDimensionIndexOfAxis(
141 const css::uno::Reference< css::chart2::XAxis >& xAxis
142 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
144 static bool getIndicesForAxis(
145 const css::uno::Reference< css::chart2::XAxis >& xAxis
146 , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys
147 , sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex );
149 static bool getIndicesForAxis(
150 const css::uno::Reference< css::chart2::XAxis >& xAxis
151 , const css::uno::Reference< css::chart2::XDiagram >& xDiagram
152 , sal_Int32& rOutCooSysIndex, sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex );
154 /** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to
155 </sal_True> are returned
157 static css::uno::Sequence< css::uno::Reference< css::chart2::XAxis > >
158 getAllAxesOfDiagram( const css::uno::Reference< css::chart2::XDiagram >& xDiagram
159 , bool bOnlyVisible = false );
161 /** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to
162 </sal_True> are returned
164 SAL_DLLPRIVATE static std::vector< css::uno::Reference< css::chart2::XAxis > >
165 getAllAxesOfCoordinateSystem( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys
166 , bool bOnlyVisible = false );
168 static css::uno::Sequence< css::uno::Reference< css::beans::XPropertySet > >
169 getAllGrids( const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
171 static void getAxisOrGridPossibilities( css::uno::Sequence< sal_Bool >& rPossibilityList
172 , const css::uno::Reference< css::chart2::XDiagram>& xDiagram, bool bAxis=true );
174 static void getAxisOrGridExistence( css::uno::Sequence< sal_Bool >& rExistenceList
175 , const css::uno::Reference< css::chart2::XDiagram>& xDiagram, bool bAxis=true );
177 static bool changeVisibilityOfGrids( const css::uno::Reference< css::chart2::XDiagram>& xDiagram
178 , const css::uno::Sequence< sal_Bool >& rOldExistenceList
179 , const css::uno::Sequence< sal_Bool >& rNewExistenceList );
181 static bool changeVisibilityOfAxes( const css::uno::Reference< css::chart2::XDiagram>& xDiagram
182 , const css::uno::Sequence< sal_Bool >& rOldExistenceList
183 , const css::uno::Sequence< sal_Bool >& rNewExistenceList
184 , const css::uno::Reference< css::uno::XComponentContext >& xContext
185 , ReferenceSizeProvider * pRefSizeProvider );
187 static bool shouldAxisBeDisplayed( const css::uno::Reference< css::chart2::XAxis >& xAxis
188 , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys );
189 static bool isSecondaryYAxisNeeded( const css::uno::Reference<
190 css::chart2::XCoordinateSystem >& xCooSys );
192 static css::uno::Reference< css::chart2::XChartType >
193 getChartTypeByIndex( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys,
194 sal_Int32 nIndex );
196 static void setRTLAxisLayout( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys );
198 static css::uno::Reference< css::chart2::XChartType >
199 getFirstChartTypeWithSeriesAttachedToAxisIndex( const css::uno::Reference< css::chart2::XDiagram >& xDiagram, const sal_Int32 nAttachedAxisIndex );
201 static bool isAxisPositioningEnabled();
204 } //namespace chart
206 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */