summaryrefslogtreecommitdiffstats
path: root/sc/inc/SparklineAttributes.hxx
blob: 04a6c0abb69695c909221589e250b56f4e4ddc45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 */

#pragma once

#include "scdllapi.h"
#include <sal/types.h>
#include <tools/color.hxx>
#include <docmodel/color/ComplexColor.hxx>
#include <optional>
#include <o3tl/cow_wrapper.hxx>

namespace sc
{
/** Supported sparkline types */
enum class SparklineType
{
    Line,
    Column,
    Stacked
};

/** The method of calculating the axis min or max value */
enum class AxisType
{
    Individual, // calculate the min/max of a sparkline
    Group, // calculate the min or max of the whole sparkline group
    Custom // user defined
};

/** Determines how to display the empty cells */
enum class DisplayEmptyCellsAs
{
    Span,
    Gap,
    Zero // empty cell equals zero
};

/** Common properties for a group of sparklines */
class SC_DLLPUBLIC SparklineAttributes
{
private:
    class Implementation;
    o3tl::cow_wrapper<Implementation> m_aImplementation;

public:
    SparklineAttributes();
    ~SparklineAttributes();
    SparklineAttributes(const SparklineAttributes& rOther);
    SparklineAttributes(SparklineAttributes&& rOther);
    SparklineAttributes& operator=(const SparklineAttributes& rOther);
    SparklineAttributes& operator=(SparklineAttributes&& rOther);

    bool operator==(const SparklineAttributes& rOther) const;
    bool operator!=(const SparklineAttributes& rOther) const
    {
        return !(SparklineAttributes::operator==(rOther));
    }

    void resetColors();

    model::ComplexColor getColorSeries() const;
    void setColorSeries(model::ComplexColor const& rColorSeries);

    model::ComplexColor getColorNegative() const;
    void setColorNegative(model::ComplexColor const& rColorSeries);

    model::ComplexColor getColorAxis() const;
    void setColorAxis(model::ComplexColor const& rColorSeries);

    model::ComplexColor getColorMarkers() const;
    void setColorMarkers(model::ComplexColor const& rColorSeries);

    model::ComplexColor getColorFirst() const;
    void setColorFirst(model::ComplexColor const& rColorSeries);

    model::ComplexColor getColorLast() const;
    void setColorLast(model::ComplexColor const& rColorSeries);

    model::ComplexColor getColorHigh() const;
    void setColorHigh(model::ComplexColor const& rColorSeries);

    model::ComplexColor getColorLow() const;
    void setColorLow(model::ComplexColor const& rColorSeries);

    AxisType getMinAxisType() const;
    void setMinAxisType(AxisType eAxisType);

    AxisType getMaxAxisType() const;
    void setMaxAxisType(AxisType eAxisType);

    /** Line weight or width in points */
    double getLineWeight() const;
    void setLineWeight(double nWeight);

    SparklineType getType() const;
    void setType(SparklineType eType);

    bool isDateAxis() const;
    void setDateAxis(bool bValue);

    DisplayEmptyCellsAs getDisplayEmptyCellsAs() const;
    void setDisplayEmptyCellsAs(DisplayEmptyCellsAs eValue);

    bool isMarkers() const;
    void setMarkers(bool bValue);

    bool isHigh() const;
    void setHigh(bool bValue);

    bool isLow() const;
    void setLow(bool bValue);

    bool isFirst() const;
    void setFirst(bool bValue);

    bool isLast() const;
    void setLast(bool bValue);

    bool isNegative() const;
    void setNegative(bool bValue);

    bool shouldDisplayXAxis() const;
    void setDisplayXAxis(bool bValue);

    bool shouldDisplayHidden() const;
    void setDisplayHidden(bool bValue);

    bool isRightToLeft() const;
    void setRightToLeft(bool bValue);

    std::optional<double> getManualMax() const;
    void setManualMax(std::optional<double> aValue);

    std::optional<double> getManualMin() const;
    void setManualMin(std::optional<double> aValue);
};

} // end sc

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */