tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / chart2 / source / inc / AxisHelper.hxx
blobf39e54c1fc00da64fd06d322998d6cd3b1ccc6a9
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 <config_options.h>
22 #include "charttoolsdllapi.hxx"
23 #include <com/sun/star/chart2/ScaleData.hpp>
24 #include <rtl/ref.hxx>
25 #include "GridProperties.hxx"
27 #include <vector>
29 namespace chart { class ChartModel; }
30 namespace chart { class ExplicitCategoriesProvider; }
31 namespace chart { class ReferenceSizeProvider; }
32 namespace com::sun::star::beans { class XPropertySet; }
33 namespace com::sun::star::chart2 { class XAxis; }
34 namespace com::sun::star::chart2 { class XChartDocument; }
35 namespace com::sun::star::chart2 { class XChartType; }
36 namespace com::sun::star::chart2 { class XCoordinateSystem; }
37 namespace com::sun::star::chart2 { class XDiagram; }
38 namespace com::sun::star::chart2 { class XScaling; }
39 namespace com::sun::star::uno { class XComponentContext; }
41 namespace chart
43 class Axis;
44 class BaseCoordinateSystem;
45 class ChartType;
46 class Diagram;
48 class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) AxisHelper
50 public:
51 static css::uno::Reference< css::chart2::XScaling > createLinearScaling();
52 static css::uno::Reference< css::chart2::XScaling > createLogarithmicScaling( double fBase = 10.0 );
54 static css::chart2::ScaleData createDefaultScale();
56 static void removeExplicitScaling( css::chart2::ScaleData& rScaleData );
58 static bool isLogarithmic( const css::uno::Reference< css::chart2::XScaling >& xScaling );
60 static void checkDateAxis( css::chart2::ScaleData& rScale, ExplicitCategoriesProvider* pExplicitCategoriesProvider, bool bChartTypeAllowsDateAxis );
61 static css::chart2::ScaleData getDateCheckedScale( const rtl::Reference< ::chart::Axis >& xAxis, ChartModel& rModel );
63 static sal_Int32 getExplicitNumberFormatKeyForAxis(
64 const rtl::Reference< ::chart::Axis >& xAxis
65 , const rtl::Reference< ::chart::BaseCoordinateSystem >& xCorrespondingCoordinateSystem
66 , const rtl::Reference< ::chart::ChartModel>& xChartDoc
67 , bool bSearchForParallelAxisIfNothingIsFound );
69 static rtl::Reference< ::chart::Axis >
70 createAxis( sal_Int32 nDimensionIndex, bool bMainAxis
71 , const rtl::Reference< ::chart::Diagram >& xDiagram
72 , const css::uno::Reference< css::uno::XComponentContext >& xContext
73 , ReferenceSizeProvider * pRefSizeProvider = nullptr );
75 static rtl::Reference< ::chart::Axis >
76 createAxis(
77 sal_Int32 nDimensionIndex
78 , sal_Int32 nAxisIndex // 0==main or 1==secondary axis
79 , const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys
80 , const css::uno::Reference< css::uno::XComponentContext > & xContext
81 , ReferenceSizeProvider * pRefSizeProvider = nullptr );
83 static void showAxis( sal_Int32 nDimensionIndex, bool bMainAxis
84 , const rtl::Reference< ::chart::Diagram >& xDiagram
85 , const css::uno::Reference< css::uno::XComponentContext >& xContext
86 , ReferenceSizeProvider * pRefSizeProvider = nullptr );
88 static void showGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
89 , const rtl::Reference< ::chart::Diagram >& xDiagram );
91 static void hideAxis( sal_Int32 nDimensionIndex, bool bMainAxis
92 , const rtl::Reference< ::chart::Diagram >& xDiagram );
93 static void hideGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
94 , const rtl::Reference< ::chart::Diagram >& xDiagram );
96 static bool isAxisShown( sal_Int32 nDimensionIndex, bool bMainAxis
97 , const rtl::Reference< ::chart::Diagram >& xDiagram );
98 static bool isGridShown( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
99 , const rtl::Reference< ::chart::Diagram >& xDiagram );
101 static void makeAxisVisible( const rtl::Reference< ::chart::Axis >& xAxis );
102 static void makeGridVisible( const rtl::Reference< ::chart::GridProperties >& xGridProperties );
104 static void makeAxisInvisible( const rtl::Reference< ::chart::Axis >& xAxis );
105 static void makeGridInvisible( const rtl::Reference< ::chart::GridProperties >& xGridProperties );
107 static void hideAxisIfNoDataIsAttached( const rtl::Reference< ::chart::Axis >& xAxis
108 , const rtl::Reference< ::chart::Diagram >& xDiagram);
110 SAL_DLLPRIVATE static bool areAxisLabelsVisible( const rtl::Reference< ::chart::Axis >& xAxisProperties );
111 static bool isAxisVisible( const rtl::Reference< ::chart::Axis >& xAxis );
112 static bool isGridVisible( const rtl::Reference< ::chart::GridProperties >& xGridProperties );
114 static rtl::Reference< ::chart::BaseCoordinateSystem >
115 getCoordinateSystemByIndex(
116 const rtl::Reference< ::chart::Diagram >& xDiagram
117 , sal_Int32 nIndex );
119 static rtl::Reference< ::chart::BaseCoordinateSystem >
120 getCoordinateSystemOfAxis(
121 const rtl::Reference< ::chart::Axis >& xAxis
122 , const rtl::Reference< ::chart::Diagram >& xDiagram );
124 static rtl::Reference< ::chart::Axis >
125 getAxis( sal_Int32 nDimensionIndex, bool bMainAxis
126 , const rtl::Reference< ::chart::Diagram >& xDiagram );
127 static rtl::Reference< ::chart::Axis >
128 getAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex
129 , const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys );
131 static rtl::Reference< ::chart::Axis >
132 getCrossingMainAxis( const rtl::Reference< ::chart::Axis >& xAxis
133 , const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys );
135 static rtl::Reference< ::chart::Axis >
136 getParallelAxis( const rtl::Reference< ::chart::Axis >& xAxis
137 , const rtl::Reference< ::chart::Diagram >& xDiagram );
139 static rtl::Reference< ::chart::GridProperties >
140 getGridProperties( const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys
141 , sal_Int32 nDimensionIndex
142 , sal_Int32 nAxisIndex //0: Primary axis, 1: secondary axis
143 , sal_Int32 nSubGridIndex //-1: Main Grid; 0: First SubGrid etc
146 static sal_Int32 getDimensionIndexOfAxis(
147 const rtl::Reference< ::chart::Axis >& xAxis
148 , const rtl::Reference< ::chart::Diagram >& xDiagram );
150 static bool getIndicesForAxis(
151 const rtl::Reference< ::chart::Axis >& xAxis
152 , const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys
153 , sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex );
155 static bool getIndicesForAxis(
156 const rtl::Reference< ::chart::Axis >& xAxis
157 , const rtl::Reference< ::chart::Diagram >& xDiagram
158 , sal_Int32& rOutCooSysIndex, sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex );
160 /** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to
161 </sal_True> are returned
163 static std::vector< rtl::Reference< ::chart::Axis > >
164 getAllAxesOfDiagram( const rtl::Reference< ::chart::Diagram >& xDiagram
165 , bool bOnlyVisible = false );
167 /** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to
168 </sal_True> are returned
170 SAL_DLLPRIVATE static std::vector< rtl::Reference< ::chart::Axis > >
171 getAllAxesOfCoordinateSystem( const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys
172 , bool bOnlyVisible = false );
174 static std::vector< rtl::Reference< ::chart::GridProperties > >
175 getAllGrids( const rtl::Reference< ::chart::Diagram >& xDiagram );
177 static void getAxisOrGridPossibilities( css::uno::Sequence< sal_Bool >& rPossibilityList
178 , const rtl::Reference< ::chart::Diagram>& xDiagram, bool bAxis=true );
180 static void getAxisOrGridExistence( css::uno::Sequence< sal_Bool >& rExistenceList
181 , const rtl::Reference< ::chart::Diagram>& xDiagram, bool bAxis=true );
183 static bool changeVisibilityOfGrids( const rtl::Reference< ::chart::Diagram>& xDiagram
184 , const css::uno::Sequence< sal_Bool >& rOldExistenceList
185 , const css::uno::Sequence< sal_Bool >& rNewExistenceList );
187 static bool changeVisibilityOfAxes( const rtl::Reference< ::chart::Diagram>& xDiagram
188 , const css::uno::Sequence< sal_Bool >& rOldExistenceList
189 , const css::uno::Sequence< sal_Bool >& rNewExistenceList
190 , const css::uno::Reference< css::uno::XComponentContext >& xContext
191 , ReferenceSizeProvider * pRefSizeProvider );
193 static bool shouldAxisBeDisplayed( const rtl::Reference< ::chart::Axis >& xAxis
194 , const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys );
195 static bool isSecondaryYAxisNeeded( const rtl::Reference<
196 ::chart::BaseCoordinateSystem >& xCooSys );
198 static rtl::Reference< ::chart::ChartType >
199 getChartTypeByIndex( const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys,
200 sal_Int32 nIndex );
202 static void setRTLAxisLayout( const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys );
204 static rtl::Reference< ::chart::ChartType >
205 getFirstChartTypeWithSeriesAttachedToAxisIndex( const rtl::Reference< ::chart::Diagram >& xDiagram, const sal_Int32 nAttachedAxisIndex );
207 static bool isAxisPositioningEnabled();
210 } //namespace chart
212 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */