LibreOffice Module chart2 (master) 1
VAxisProperties.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#pragma once
20
22#include <Axis.hxx>
23#include <LabelAlignment.hxx>
24#include <DataTable.hxx>
25
26#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
27#include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
28#include <com/sun/star/chart/ChartAxisPosition.hpp>
29#include <com/sun/star/awt/Rectangle.hpp>
30#include <com/sun/star/awt/Size.hpp>
31#include <com/sun/star/uno/Any.hxx>
32#include <rtl/ref.hxx>
33
34#include <vector>
35#include <optional>
36
37namespace chart { class ExplicitCategoriesProvider; }
38namespace com::sun::star::beans { class XPropertySet; }
39namespace com::sun::star::chart2 { class XAxis; }
40namespace com::sun::star::chart2::data { class XTextualDataSequence; }
41
42namespace chart
43{
44
45//These properties describe how a couple of labels are arranged one to another.
46//The couple can contain all labels for all tickmark depth or just the labels for one single depth or
47//the labels from a coherent range of tick depths (e.g. the major and first minor tickmarks should be handled together).
48//... only allow side by side for different tick depth
50{
55};
56
58{
60
61 css::awt::Size m_aFontReferenceSize;//reference size to calculate the font height
62 css::awt::Rectangle m_aMaximumSpaceForLabels;//Labels need to be clipped in order to fit into this rectangle
63
65
67
70
73
74 sal_Int32 m_nRhythm; //show only each nth label with n==nRhythm
75
76 //methods:
77 void init( const rtl::Reference< ::chart::Axis >& xAxisModel );
78
79 bool isStaggered() const;
80
81 void autoRotate45();
82};
83
85{
88
90
92};
93
94struct AxisProperties final
95{
97
99 bool m_bIsMainAxis;//not secondary axis
101
102 css::chart::ChartAxisPosition m_eCrossoverType;
103 css::chart::ChartAxisLabelPosition m_eLabelPos;
104 css::chart::ChartAxisMarkPosition m_eTickmarkPos;
105
106 std::optional<double> m_pfMainLinePositionAtOtherAxis;
107 std::optional<double> m_pfExrtaLinePositionAtOtherAxis;
108
111
113
114 // Data table
117
119
120 // Compatibility option: starting from LibreOffice 5.1 the rotated
121 // layout is preferred to staggering for axis labels.
122 // So the default value of this flag for new documents is `false`.
124
126
127 /*
128 0: no tickmarks 1: inner tickmarks
129 2: outer tickmarks 3: inner and outer tickmarks
130 */
133 std::vector<TickmarkProperties> m_aTickmarkPropertiesList;
134
136
137 //for category axes ->
138 sal_Int32 m_nAxisType;//REALNUMBER, CATEGORY etc. type css::chart2::AxisType
141 css::uno::Reference<css::chart2::data::XTextualDataSequence> m_xAxisTextProvider; //for categories or series names
142 //<- category axes
143
145
147
148 //methods:
149
151 ExplicitCategoriesProvider* pExplicitCategoriesProvider,
152 rtl::Reference<::chart::DataTable> const& xDataTableModel);
153
154 void init(bool bCartesian=false);//init from model data (m_xAxisModel)
155
156 void initAxisPositioning( const css::uno::Reference< css::beans::XPropertySet >& xAxisProp );
157
159 TickmarkProperties makeTickmarkPropertiesForComplexCategories( sal_Int32 nTickLength, sal_Int32 nTickStartDistanceToAxis ) const;
160
161private:
162 AxisProperties() = delete;
163
164 TickmarkProperties makeTickmarkProperties( sal_Int32 nDepth ) const;
165 //@todo get this from somewhere; maybe for each subincrement
166 //so far the model does not offer different settings for each tick depth
168};
169
170} //namespace chart
171
172/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
class SAL_NO_VTABLE XPropertySet
double mfInnerTickDirection
which direction the labels are to be drawn.
LabelAlignment meAlignment
which direction the inner tickmarks are to be drawn.
css::awt::Size m_aFontReferenceSize
AxisLabelStaggering m_eStaggering
void init(const rtl::Reference< ::chart::Axis > &xAxisModel)
css::awt::Rectangle m_aMaximumSpaceForLabels
const VLineProperties & makeLinePropertiesForDepth() const
std::optional< double > m_pfExrtaLinePositionAtOtherAxis
css::uno::Reference< css::chart2::data::XTextualDataSequence > m_xAxisTextProvider
std::optional< double > m_pfMainLinePositionAtOtherAxis
static TickmarkProperties getBiggestTickmarkProperties()
VLineProperties m_aLineProperties
void init(bool bCartesian=false)
AxisLabelAlignment maLabelAlignment
ExplicitCategoriesProvider * m_pExplicitCategoriesProvider
TickmarkProperties makeTickmarkPropertiesForComplexCategories(sal_Int32 nTickLength, sal_Int32 nTickStartDistanceToAxis) const
css::chart::ChartAxisMarkPosition m_eTickmarkPos
void initAxisPositioning(const css::uno::Reference< css::beans::XPropertySet > &xAxisProp)
rtl::Reference<::chart::Axis > m_xAxisModel
TickmarkProperties makeTickmarkProperties(sal_Int32 nDepth) const
std::vector< TickmarkProperties > m_aTickmarkPropertiesList
css::chart::ChartAxisLabelPosition m_eLabelPos
css::chart::ChartAxisPosition m_eCrossoverType
rtl::Reference<::chart::DataTable > m_xDataTableModel