Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / inc / Sparkline.hxx
blob236c4dc3657e2d1ac84a6ac499f5f79b91e69d6f
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 "rangelst.hxx"
15 #include <memory>
16 #include <utility>
18 namespace sc
20 class SparklineGroup;
22 /** Sparkline data, used for rendering the content of a cell
24 * Contains the input range of the data that is being drawn and a reference
25 * to the SparklineGroup, which includes common properties of multiple
26 * sparklines.
28 class SC_DLLPUBLIC Sparkline
30 SCCOL m_nColumn;
31 SCROW m_nRow;
33 ScRangeList m_aInputRange;
34 std::shared_ptr<SparklineGroup> m_pSparklineGroup;
36 public:
37 Sparkline(SCCOL nColumn, SCROW nRow, std::shared_ptr<SparklineGroup> pSparklineGroup)
38 : m_nColumn(nColumn)
39 , m_nRow(nRow)
40 , m_pSparklineGroup(std::move(pSparklineGroup))
44 Sparkline(const Sparkline&) = delete;
45 Sparkline& operator=(const Sparkline&) = delete;
47 void setInputRange(ScRangeList const& rInputRange) { m_aInputRange = rInputRange; }
49 ScRangeList const& getInputRange() const { return m_aInputRange; }
51 std::shared_ptr<SparklineGroup> const& getSparklineGroup() const { return m_pSparklineGroup; }
53 SCCOL getColumn() const { return m_nColumn; }
55 SCROW getRow() const { return m_nRow; }
58 } // end sc
60 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */