Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / inc / SparklineAttributes.hxx
blob04a6c0abb69695c909221589e250b56f4e4ddc45
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 */
11 #pragma once
13 #include "scdllapi.h"
14 #include <sal/types.h>
15 #include <tools/color.hxx>
16 #include <docmodel/color/ComplexColor.hxx>
17 #include <optional>
18 #include <o3tl/cow_wrapper.hxx>
20 namespace sc
22 /** Supported sparkline types */
23 enum class SparklineType
25 Line,
26 Column,
27 Stacked
30 /** The method of calculating the axis min or max value */
31 enum class AxisType
33 Individual, // calculate the min/max of a sparkline
34 Group, // calculate the min or max of the whole sparkline group
35 Custom // user defined
38 /** Determines how to display the empty cells */
39 enum class DisplayEmptyCellsAs
41 Span,
42 Gap,
43 Zero // empty cell equals zero
46 /** Common properties for a group of sparklines */
47 class SC_DLLPUBLIC SparklineAttributes
49 private:
50 class Implementation;
51 o3tl::cow_wrapper<Implementation> m_aImplementation;
53 public:
54 SparklineAttributes();
55 ~SparklineAttributes();
56 SparklineAttributes(const SparklineAttributes& rOther);
57 SparklineAttributes(SparklineAttributes&& rOther);
58 SparklineAttributes& operator=(const SparklineAttributes& rOther);
59 SparklineAttributes& operator=(SparklineAttributes&& rOther);
61 bool operator==(const SparklineAttributes& rOther) const;
62 bool operator!=(const SparklineAttributes& rOther) const
64 return !(SparklineAttributes::operator==(rOther));
67 void resetColors();
69 model::ComplexColor getColorSeries() const;
70 void setColorSeries(model::ComplexColor const& rColorSeries);
72 model::ComplexColor getColorNegative() const;
73 void setColorNegative(model::ComplexColor const& rColorSeries);
75 model::ComplexColor getColorAxis() const;
76 void setColorAxis(model::ComplexColor const& rColorSeries);
78 model::ComplexColor getColorMarkers() const;
79 void setColorMarkers(model::ComplexColor const& rColorSeries);
81 model::ComplexColor getColorFirst() const;
82 void setColorFirst(model::ComplexColor const& rColorSeries);
84 model::ComplexColor getColorLast() const;
85 void setColorLast(model::ComplexColor const& rColorSeries);
87 model::ComplexColor getColorHigh() const;
88 void setColorHigh(model::ComplexColor const& rColorSeries);
90 model::ComplexColor getColorLow() const;
91 void setColorLow(model::ComplexColor const& rColorSeries);
93 AxisType getMinAxisType() const;
94 void setMinAxisType(AxisType eAxisType);
96 AxisType getMaxAxisType() const;
97 void setMaxAxisType(AxisType eAxisType);
99 /** Line weight or width in points */
100 double getLineWeight() const;
101 void setLineWeight(double nWeight);
103 SparklineType getType() const;
104 void setType(SparklineType eType);
106 bool isDateAxis() const;
107 void setDateAxis(bool bValue);
109 DisplayEmptyCellsAs getDisplayEmptyCellsAs() const;
110 void setDisplayEmptyCellsAs(DisplayEmptyCellsAs eValue);
112 bool isMarkers() const;
113 void setMarkers(bool bValue);
115 bool isHigh() const;
116 void setHigh(bool bValue);
118 bool isLow() const;
119 void setLow(bool bValue);
121 bool isFirst() const;
122 void setFirst(bool bValue);
124 bool isLast() const;
125 void setLast(bool bValue);
127 bool isNegative() const;
128 void setNegative(bool bValue);
130 bool shouldDisplayXAxis() const;
131 void setDisplayXAxis(bool bValue);
133 bool shouldDisplayHidden() const;
134 void setDisplayHidden(bool bValue);
136 bool isRightToLeft() const;
137 void setRightToLeft(bool bValue);
139 std::optional<double> getManualMax() const;
140 void setManualMax(std::optional<double> aValue);
142 std::optional<double> getManualMin() const;
143 void setManualMin(std::optional<double> aValue);
146 } // end sc
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */