nss: upgrade to release 3.73
[LibreOffice.git] / chart2 / source / view / axes / VAxisProperties.hxx
blob454ea1097c862f7ed19594ea33011a87ed6b49c5
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 "TickmarkProperties.hxx"
22 #include <LabelAlignment.hxx>
24 #include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
25 #include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
26 #include <com/sun/star/chart/ChartAxisPosition.hpp>
27 #include <com/sun/star/awt/Rectangle.hpp>
28 #include <com/sun/star/awt/Size.hpp>
29 #include <com/sun/star/uno/Any.hxx>
31 #include <vector>
32 #include <optional>
34 namespace chart { class ExplicitCategoriesProvider; }
35 namespace com::sun::star::beans { class XPropertySet; }
36 namespace com::sun::star::chart2 { class XAxis; }
37 namespace com::sun::star::chart2::data { class XTextualDataSequence; }
39 namespace chart
42 //These properties describe how a couple of labels are arranged one to another.
43 //The couple can contain all labels for all tickmark depth or just the labels for one single depth or
44 //the labels from a coherent range of tick depths (e.g. the major and first minor tickmarks should be handled together).
45 //... only allow side by side for different tick depth
46 enum class AxisLabelStaggering
48 SideBySide
49 , StaggerEven
50 , StaggerOdd
51 , StaggerAuto
54 struct AxisLabelProperties final
56 AxisLabelProperties();
58 css::awt::Size m_aFontReferenceSize;//reference size to calculate the font height
59 css::awt::Rectangle m_aMaximumSpaceForLabels;//Labels need to be clipped in order to fit into this rectangle
61 sal_Int32 nNumberFormatKey;
63 AxisLabelStaggering eStaggering;
65 bool bLineBreakAllowed;
66 bool bOverlapAllowed;
68 bool bStackCharacters;
69 double fRotationAngleDegree;
71 sal_Int32 nRhythm; //show only each nth label with n==nRhythm
73 //methods:
74 void init( const css::uno::Reference< css::chart2::XAxis >& xAxisModel );
76 bool isStaggered() const;
78 void autoRotate45();
81 struct AxisLabelAlignment
83 double mfLabelDirection; /// which direction the labels are to be drawn.
84 double mfInnerTickDirection; /// which direction the inner tickmarks are to be drawn.
86 LabelAlignment meAlignment;
88 AxisLabelAlignment();
91 struct AxisProperties final
93 css::uno::Reference<css::chart2::XAxis> m_xAxisModel;
95 sal_Int32 m_nDimensionIndex;
96 bool m_bIsMainAxis;//not secondary axis
97 bool m_bSwapXAndY;
99 css::chart::ChartAxisPosition m_eCrossoverType;
100 css::chart::ChartAxisLabelPosition m_eLabelPos;
101 css::chart::ChartAxisMarkPosition m_eTickmarkPos;
103 std::optional<double> m_pfMainLinePositionAtOtherAxis;
104 std::optional<double> m_pfExrtaLinePositionAtOtherAxis;
106 bool m_bCrossingAxisHasReverseDirection;
107 bool m_bCrossingAxisIsCategoryAxes;
109 AxisLabelAlignment maLabelAlignment;
111 bool m_bDisplayLabels;
113 // Compatibility option: starting from LibreOffice 5.1 the rotated
114 // layout is preferred to staggering for axis labels.
115 // So the default value of this flag for new documents is `false`.
116 bool m_bTryStaggeringFirst;
118 sal_Int32 m_nNumberFormatKey;
121 0: no tickmarks 1: inner tickmarks
122 2: outer tickmarks 3: inner and outer tickmarks
124 sal_Int32 m_nMajorTickmarks;
125 sal_Int32 m_nMinorTickmarks;
126 std::vector<TickmarkProperties> m_aTickmarkPropertiesList;
128 VLineProperties m_aLineProperties;
130 //for category axes ->
131 sal_Int32 m_nAxisType;//REALNUMBER, CATEGORY etc. type css::chart2::AxisType
132 bool m_bComplexCategories;
133 ExplicitCategoriesProvider* m_pExplicitCategoriesProvider;/*no ownership here*/
134 css::uno::Reference<css::chart2::data::XTextualDataSequence> m_xAxisTextProvider; //for categories or series names
135 //<- category axes
137 bool m_bLimitSpaceForLabels;
139 //methods:
141 AxisProperties( const css::uno::Reference< css::chart2::XAxis >& xAxisModel
142 , ExplicitCategoriesProvider* pExplicitCategoriesProvider );
144 void init(bool bCartesian=false);//init from model data (m_xAxisModel)
146 void initAxisPositioning( const css::uno::Reference< css::beans::XPropertySet >& xAxisProp );
148 static TickmarkProperties getBiggestTickmarkProperties();
149 TickmarkProperties makeTickmarkPropertiesForComplexCategories( sal_Int32 nTickLength, sal_Int32 nTickStartDistanceToAxis ) const;
151 private:
152 AxisProperties() = delete;
154 TickmarkProperties makeTickmarkProperties( sal_Int32 nDepth ) const;
155 //@todo get this from somewhere; maybe for each subincrement
156 //so far the model does not offer different settings for each tick depth
157 const VLineProperties& makeLinePropertiesForDepth() const { return m_aLineProperties; }
160 } //namespace chart
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */