summaryrefslogtreecommitdiffstats
path: root/sc/source/ui/sparklines/SparklineAttributes.cxx
blob: 20b8bf6feee6637240e7f8988c586ea8338c9397 (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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
/* -*- 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/.
 *
 */

#include <SparklineAttributes.hxx>

namespace sc
{
/** Holder of sparkline attributes */
class SparklineAttributes::Implementation
{
public:
    Color m_aColorSeries;
    Color m_aColorNegative;
    Color m_aColorAxis;
    Color m_aColorMarkers;
    Color m_aColorFirst;
    Color m_aColorLast;
    Color m_aColorHigh;
    Color m_aColorLow;

    AxisType m_eMinAxisType;
    AxisType m_eMaxAxisType;

    double m_fLineWeight; // In pt

    SparklineType m_eType;

    bool m_bDateAxis;

    DisplayEmptyCellsAs m_eDisplayEmptyCellsAs; // span, gap, zero

    bool m_bMarkers;
    bool m_bHigh;
    bool m_bLow;
    bool m_bFirst;
    bool m_bLast;
    bool m_bNegative;
    bool m_bDisplayXAxis;
    bool m_bDisplayHidden;
    bool m_bRightToLeft;

    std::optional<double> m_aManualMax;
    std::optional<double> m_aManualMin;

    static constexpr ::Color COL_STANDARD_RED = 0xff0000;
    static constexpr ::Color COL_STANDARD_BLUE = 0x2a6099;

    Implementation()
        : m_aColorSeries(COL_STANDARD_BLUE)
        , m_aColorNegative(COL_STANDARD_RED)
        , m_aColorAxis(COL_STANDARD_RED)
        , m_aColorMarkers(COL_STANDARD_RED)
        , m_aColorFirst(COL_STANDARD_RED)
        , m_aColorLast(COL_STANDARD_RED)
        , m_aColorHigh(COL_STANDARD_RED)
        , m_aColorLow(COL_STANDARD_RED)
        , m_eMinAxisType(AxisType::Individual)
        , m_eMaxAxisType(AxisType::Individual)
        , m_fLineWeight(0.75)
        , m_eType(SparklineType::Line)
        , m_bDateAxis(false)
        , m_eDisplayEmptyCellsAs(DisplayEmptyCellsAs::Zero)
        , m_bMarkers(false)
        , m_bHigh(false)
        , m_bLow(false)
        , m_bFirst(false)
        , m_bLast(false)
        , m_bNegative(false)
        , m_bDisplayXAxis(false)
        , m_bDisplayHidden(false)
        , m_bRightToLeft(false)
    {
    }

    Implementation(Implementation const& pOther)
        : m_aColorSeries(pOther.m_aColorSeries)
        , m_aColorNegative(pOther.m_aColorNegative)
        , m_aColorAxis(pOther.m_aColorAxis)
        , m_aColorMarkers(pOther.m_aColorMarkers)
        , m_aColorFirst(pOther.m_aColorFirst)
        , m_aColorLast(pOther.m_aColorLast)
        , m_aColorHigh(pOther.m_aColorHigh)
        , m_aColorLow(pOther.m_aColorLow)
        , m_eMinAxisType(pOther.m_eMinAxisType)
        , m_eMaxAxisType(pOther.m_eMaxAxisType)
        , m_fLineWeight(pOther.m_fLineWeight)
        , m_eType(pOther.m_eType)
        , m_bDateAxis(pOther.m_bDateAxis)
        , m_eDisplayEmptyCellsAs(pOther.m_eDisplayEmptyCellsAs)
        , m_bMarkers(pOther.m_bMarkers)
        , m_bHigh(pOther.m_bHigh)
        , m_bLow(pOther.m_bLow)
        , m_bFirst(pOther.m_bFirst)
        , m_bLast(pOther.m_bLast)
        , m_bNegative(pOther.m_bNegative)
        , m_bDisplayXAxis(pOther.m_bDisplayXAxis)
        , m_bDisplayHidden(pOther.m_bDisplayHidden)
        , m_bRightToLeft(pOther.m_bRightToLeft)
        , m_aManualMax(pOther.m_aManualMax)
        , m_aManualMin(pOther.m_aManualMin)
    {
    }

    bool operator==(const Implementation& rImpl) const
    {
        return (m_aColorSeries == rImpl.m_aColorSeries)
               && (m_aColorNegative == rImpl.m_aColorNegative)
               && (m_aColorAxis == rImpl.m_aColorAxis) && (m_aColorMarkers == rImpl.m_aColorMarkers)
               && (m_aColorFirst == rImpl.m_aColorFirst) && (m_aColorLast == rImpl.m_aColorLast)
               && (m_aColorHigh == rImpl.m_aColorHigh) && (m_aColorLow == rImpl.m_aColorLow)
               && (m_eMinAxisType == rImpl.m_eMinAxisType)
               && (m_eMaxAxisType == rImpl.m_eMaxAxisType) && (m_fLineWeight == rImpl.m_fLineWeight)
               && (m_eType == rImpl.m_eType) && (m_bDateAxis == rImpl.m_bDateAxis)
               && (m_eDisplayEmptyCellsAs == rImpl.m_eDisplayEmptyCellsAs)
               && (m_bMarkers == rImpl.m_bMarkers) && (m_bHigh == rImpl.m_bHigh)
               && (m_bLow == rImpl.m_bLow) && (m_bFirst == rImpl.m_bFirst)
               && (m_bLast == rImpl.m_bLast) && (m_bNegative == rImpl.m_bNegative)
               && (m_bDisplayXAxis == rImpl.m_bDisplayXAxis)
               && (m_bDisplayHidden == rImpl.m_bDisplayHidden)
               && (m_bRightToLeft == rImpl.m_bRightToLeft) && (m_aManualMax == rImpl.m_aManualMax)
               && (m_aManualMin == rImpl.m_aManualMin);
    }
};

SparklineAttributes::SparklineAttributes() = default;

SparklineAttributes::~SparklineAttributes() = default;

SparklineAttributes::SparklineAttributes(SparklineAttributes const&) = default;

SparklineAttributes::SparklineAttributes(SparklineAttributes&&) = default;

SparklineAttributes& SparklineAttributes::operator=(SparklineAttributes const&) = default;

SparklineAttributes& SparklineAttributes::operator=(SparklineAttributes&&) = default;

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

Color SparklineAttributes::getColorSeries() const { return m_aImplementation->m_aColorSeries; }

void SparklineAttributes::setColorSeries(Color aColor)
{
    m_aImplementation->m_aColorSeries = aColor;
}

Color SparklineAttributes::getColorNegative() const { return m_aImplementation->m_aColorNegative; }

void SparklineAttributes::setColorNegative(Color aColor)
{
    m_aImplementation->m_aColorNegative = aColor;
}

Color SparklineAttributes::getColorAxis() const { return m_aImplementation->m_aColorAxis; }

void SparklineAttributes::setColorAxis(Color aColor) { m_aImplementation->m_aColorAxis = aColor; }

Color SparklineAttributes::getColorMarkers() const { return m_aImplementation->m_aColorMarkers; }
void SparklineAttributes::setColorMarkers(Color aColor)
{
    m_aImplementation->m_aColorMarkers = aColor;
}

Color SparklineAttributes::getColorFirst() const { return m_aImplementation->m_aColorFirst; }
void SparklineAttributes::setColorFirst(Color aColor) { m_aImplementation->m_aColorFirst = aColor; }

Color SparklineAttributes::getColorLast() const { return m_aImplementation->m_aColorLast; }
void SparklineAttributes::setColorLast(Color aColor) { m_aImplementation->m_aColorLast = aColor; }

Color SparklineAttributes::getColorHigh() const { return m_aImplementation->m_aColorHigh; }
void SparklineAttributes::setColorHigh(Color aColor) { m_aImplementation->m_aColorHigh = aColor; }

Color SparklineAttributes::getColorLow() const { return m_aImplementation->m_aColorLow; }
void SparklineAttributes::setColorLow(Color aColor) { m_aImplementation->m_aColorLow = aColor; }

AxisType SparklineAttributes::getMinAxisType() const { return m_aImplementation->m_eMinAxisType; }
void SparklineAttributes::setMinAxisType(AxisType eAxisType)
{
    m_aImplementation->m_eMinAxisType = eAxisType;
}

AxisType SparklineAttributes::getMaxAxisType() const { return m_aImplementation->m_eMaxAxisType; }
void SparklineAttributes::setMaxAxisType(AxisType eAxisType)
{
    m_aImplementation->m_eMaxAxisType = eAxisType;
}

double SparklineAttributes::getLineWeight() const { return m_aImplementation->m_fLineWeight; }
void SparklineAttributes::setLineWeight(double nWeight)
{
    m_aImplementation->m_fLineWeight = nWeight;
}

SparklineType SparklineAttributes::getType() const { return m_aImplementation->m_eType; }
void SparklineAttributes::setType(SparklineType eType) { m_aImplementation->m_eType = eType; }

bool SparklineAttributes::isDateAxis() const { return m_aImplementation->m_bDateAxis; }
void SparklineAttributes::setDateAxis(bool bValue) { m_aImplementation->m_bDateAxis = bValue; }

DisplayEmptyCellsAs SparklineAttributes::getDisplayEmptyCellsAs() const
{
    return m_aImplementation->m_eDisplayEmptyCellsAs;
}
void SparklineAttributes::setDisplayEmptyCellsAs(DisplayEmptyCellsAs eValue)
{
    m_aImplementation->m_eDisplayEmptyCellsAs = eValue;
}

bool SparklineAttributes::isMarkers() const { return m_aImplementation->m_bMarkers; }
void SparklineAttributes::setMarkers(bool bValue) { m_aImplementation->m_bMarkers = bValue; }

bool SparklineAttributes::isHigh() const { return m_aImplementation->m_bHigh; }
void SparklineAttributes::setHigh(bool bValue) { m_aImplementation->m_bHigh = bValue; }

bool SparklineAttributes::isLow() const { return m_aImplementation->m_bLow; }
void SparklineAttributes::setLow(bool bValue) { m_aImplementation->m_bLow = bValue; }

bool SparklineAttributes::isFirst() const { return m_aImplementation->m_bFirst; }
void SparklineAttributes::setFirst(bool bValue) { m_aImplementation->m_bFirst = bValue; }

bool SparklineAttributes::isLast() const { return m_aImplementation->m_bLast; }
void SparklineAttributes::setLast(bool bValue) { m_aImplementation->m_bLast = bValue; }

bool SparklineAttributes::isNegative() const { return m_aImplementation->m_bNegative; }
void SparklineAttributes::setNegative(bool bValue) { m_aImplementation->m_bNegative = bValue; }

bool SparklineAttributes::shouldDisplayXAxis() const { return m_aImplementation->m_bDisplayXAxis; }
void SparklineAttributes::setDisplayXAxis(bool bValue)
{
    m_aImplementation->m_bDisplayXAxis = bValue;
}

bool SparklineAttributes::shouldDisplayHidden() const
{
    return m_aImplementation->m_bDisplayHidden;
}
void SparklineAttributes::setDisplayHidden(bool bValue)
{
    m_aImplementation->m_bDisplayHidden = bValue;
}

bool SparklineAttributes::isRightToLeft() const { return m_aImplementation->m_bRightToLeft; }
void SparklineAttributes::setRightToLeft(bool bValue)
{
    m_aImplementation->m_bRightToLeft = bValue;
}

std::optional<double> SparklineAttributes::getManualMax() const
{
    return m_aImplementation->m_aManualMax;
}
void SparklineAttributes::setManualMax(std::optional<double> aValue)
{
    m_aImplementation->m_aManualMax = aValue;
}

std::optional<double> SparklineAttributes::getManualMin() const
{
    return m_aImplementation->m_aManualMin;
}
void SparklineAttributes::setManualMin(std::optional<double> aValue)
{
    m_aImplementation->m_aManualMin = aValue;
}

} // end sc

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