1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_VIEW_AXES_VAXISPROPERTIES_HXX
20 #define INCLUDED_CHART2_SOURCE_VIEW_AXES_VAXISPROPERTIES_HXX
22 #include "TickmarkProperties.hxx"
23 #include "PlottingPositionHelper.hxx"
24 #include "LabelAlignment.hxx"
25 #include "ExplicitCategoriesProvider.hxx"
27 #include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
28 #include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
29 #include <com/sun/star/chart/ChartAxisPosition.hpp>
30 #include <com/sun/star/chart2/XAxis.hpp>
31 #include <com/sun/star/chart2/AxisType.hpp>
32 #include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
33 #include <com/sun/star/awt/Rectangle.hpp>
34 #include <com/sun/star/awt/Size.hpp>
35 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
36 #include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
37 #include <com/sun/star/lang/Locale.hpp>
40 #include <boost/optional.hpp>
48 //These properties describe how a couple of labels are arranged one to another.
49 //The couple can contain all labels for all tickmark depth or just the labels for one single depth or
50 //the labels from an coherent range of tick depths (e.g. the major and first minor tickmarks should be handled together).
51 //... only allow side by side for different tick depth
52 enum AxisLabelStaggering
60 struct AxisLabelProperties SAL_FINAL
62 AxisLabelProperties();
64 ::com::sun::star::awt::Size m_aFontReferenceSize
;//reference size to calculate the font height
65 ::com::sun::star::awt::Rectangle m_aMaximumSpaceForLabels
;//Labels need to be clipped in order to fit into this rectangle
67 sal_Int32 nNumberFormatKey
;
69 AxisLabelStaggering eStaggering
;
71 bool bLineBreakAllowed
;
74 bool bStackCharacters
;
75 double fRotationAngleDegree
;
77 sal_Int32 nRhythm
; //show only each nth label with n==nRhythm
78 bool bRhythmIsFix
; //states whether the given rhythm is fix or may be changed
81 void init( const ::com::sun::star::uno::Reference
<
82 ::com::sun::star::chart2::XAxis
>& xAxisModel
);
84 bool isStaggered() const;
89 struct AxisLabelAlignment
91 double mfLabelDirection
; /// which direction the labels are to be drawn.
92 double mfInnerTickDirection
; /// which direction the inner tickmarks are to be drawn.
94 LabelAlignment meAlignment
;
99 struct AxisProperties SAL_FINAL
101 css::uno::Reference
<css::chart2::XAxis
> m_xAxisModel
;
103 sal_Int32 m_nDimensionIndex
;
104 bool m_bIsMainAxis
;//not secondary axis
107 css::chart::ChartAxisPosition m_eCrossoverType
;
108 css::chart::ChartAxisLabelPosition m_eLabelPos
;
109 css::chart::ChartAxisMarkPosition m_eTickmarkPos
;
111 boost::optional
<double> m_pfMainLinePositionAtOtherAxis
;
112 boost::optional
<double> m_pfExrtaLinePositionAtOtherAxis
;
114 bool m_bCrossingAxisHasReverseDirection
;
115 bool m_bCrossingAxisIsCategoryAxes
;
117 AxisLabelAlignment maLabelAlignment
;
119 bool m_bDisplayLabels
;
121 sal_Int32 m_nNumberFormatKey
;
124 0: no tickmarks 1: inner tickmarks
125 2: outer tickmarks 3: inner and outer tickmarks
127 sal_Int32 m_nMajorTickmarks
;
128 sal_Int32 m_nMinorTickmarks
;
129 ::std::vector
<TickmarkProperties
> m_aTickmarkPropertiesList
;
131 VLineProperties m_aLineProperties
;
133 //for category axes ->
134 sal_Int32 m_nAxisType
;//REALNUMBER, CATEGORY etc. type ::com::sun::star::chart2::AxisType
135 bool m_bComplexCategories
;
136 ExplicitCategoriesProvider
* m_pExplicitCategoriesProvider
;/*no ownership here*/
137 css::uno::Reference
<css::chart2::data::XTextualDataSequence
> m_xAxisTextProvider
; //for categories or series names
142 AxisProperties( const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XAxis
>& xAxisModel
143 , ExplicitCategoriesProvider
* pExplicitCategoriesProvider
);
144 AxisProperties( const AxisProperties
& rAxisProperties
);
146 void init(bool bCartesian
=false);//init from model data (m_xAxisModel)
148 void initAxisPositioning( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& xAxisProp
);
150 static TickmarkProperties
getBiggestTickmarkProperties();
151 TickmarkProperties
makeTickmarkPropertiesForComplexCategories( sal_Int32 nTickLength
, sal_Int32 nTickStartDistanceToAxis
, sal_Int32 nTextLevel
) const;
156 TickmarkProperties
makeTickmarkProperties( sal_Int32 nDepth
) const;
157 //@todo get this from somewhere; maybe for each subincrement
158 //so far the model does not offer different settings for each tick depth
159 VLineProperties
makeLinePropertiesForDepth( sal_Int32
/*nDepth*/ ) const { return m_aLineProperties
; }
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */