LibreOffice Module chart2 (master) 1
ScaleAutomatism.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
21#include <com/sun/star/chart2/ScaleData.hpp>
22
23#include <tools/date.hxx>
24
25namespace chart { struct ExplicitIncrementData; }
26namespace chart { struct ExplicitScaleData; }
27
28namespace chart
29{
30
42{
43public:
44 explicit ScaleAutomatism(
45 const css::chart2::ScaleData& rSourceScale, const Date& rNullDate );
46
55 void expandValueRange( double fMinimum, double fMaximum );
56 void resetValueRange();
57
73 bool bExpandBorderToIncrementRhythm,
74 bool bExpandIfValuesCloseToBorder,
75 bool bExpandWideValuesToZero,
76 bool bExpandNarrowValuesTowardZero );
77
81 void setMaximumAutoMainIncrementCount( sal_Int32 nMaximumAutoMainIncrementCount );
82
85 void setAutomaticTimeResolution( sal_Int32 nTimeResolution );
86
96 ExplicitScaleData& rExplicitScale,
97 ExplicitIncrementData& rExplicitIncrement ) const;
98
99 const css::chart2::ScaleData& getScale() const { return m_aSourceScale;}
100 const Date& getNullDate() const { return m_aNullDate;}
101
102private:
105 ExplicitScaleData& rExplicitScale,
106 ExplicitIncrementData& rExplicitIncrement,
107 bool bAutoMinimum, bool bAutoMaximum ) const;
108
111 ExplicitScaleData& rExplicitScale,
112 ExplicitIncrementData& rExplicitIncrement,
113 bool bAutoMinimum, bool bAutoMaximum ) const;
114
117 ExplicitScaleData& rExplicitScale,
118 ExplicitIncrementData& rExplicitIncrement,
119 bool bAutoMinimum, bool bAutoMaximum ) const;
120
123 ExplicitScaleData& rExplicitScale,
124 ExplicitIncrementData& rExplicitIncrement,
125 bool bAutoMinimum, bool bAutoMaximum ) const;
126
127private:
128 css::chart2::ScaleData m_aSourceScale;
129
137 sal_Int32 m_nTimeResolution;// a constant out of css::chart::TimeUnit
138
140};
141
142} //namespace chart
143
144/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class implements the calculation of automatic axis limits.
const css::chart2::ScaleData & getScale() const
void calculateExplicitIncrementAndScaleForLinear(ExplicitScaleData &rExplicitScale, ExplicitIncrementData &rExplicitIncrement, bool bAutoMinimum, bool bAutoMaximum) const
Fills the passed scale data and increment data for linear scaling.
ScaleAutomatism(const css::chart2::ScaleData &rSourceScale, const Date &rNullDate)
bool m_bExpandBorderToIncrementRhythm
Maximum number of automatic main increments.
void calculateExplicitScaleAndIncrement(ExplicitScaleData &rExplicitScale, ExplicitIncrementData &rExplicitIncrement) const
Fills the passed scale data and increment data according to the own settings.
sal_Int32 m_nTimeResolution
true = Expand narrow range toward zero (add half of range).
void calculateExplicitIncrementAndScaleForDateTimeAxis(ExplicitScaleData &rExplicitScale, ExplicitIncrementData &rExplicitIncrement, bool bAutoMinimum, bool bAutoMaximum) const
Fills the passed scale data and increment data for date-time axis.
void setAutoScalingOptions(bool bExpandBorderToIncrementRhythm, bool bExpandIfValuesCloseToBorder, bool bExpandWideValuesToZero, bool bExpandNarrowValuesTowardZero)
Sets additional auto scaling options.
void calculateExplicitIncrementAndScaleForCategory(ExplicitScaleData &rExplicitScale, ExplicitIncrementData &rExplicitIncrement, bool bAutoMinimum, bool bAutoMaximum) const
Fills the passed scale data and increment data for category scaling.
void calculateExplicitIncrementAndScaleForLogarithmic(ExplicitScaleData &rExplicitScale, ExplicitIncrementData &rExplicitIncrement, bool bAutoMinimum, bool bAutoMaximum) const
Fills the passed scale data and increment data for logarithmic scaling.
void setMaximumAutoMainIncrementCount(sal_Int32 nMaximumAutoMainIncrementCount)
Sets the maximum allowed number of automatic main increments.
const Date & getNullDate() const
bool m_bExpandNarrowValuesTowardZero
true = Expand wide spread values to zero.
sal_Int32 m_nMaximumAutoMainIncrementCount
Maximum of all source values.
bool m_bExpandWideValuesToZero
true = Expand if values are too close to the borders.
void setAutomaticTimeResolution(sal_Int32 nTimeResolution)
Sets the time resolution to be used in case it is not set explicitly within the scale.
bool m_bExpandIfValuesCloseToBorder
true = Expand to main increments.
void expandValueRange(double fMinimum, double fMaximum)
Expands own value range with the passed minimum and maximum.
double m_fValueMaximum
Minimum of all source values.
css::chart2::ScaleData m_aSourceScale
describes how tickmarks are positioned on the scale of an axis.
This structure contains the explicit values for a scale like Minimum and Maximum.