Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sc / inc / chartarr.hxx
blobb24745bc73887b01e171103546c401bf5a66bb65
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 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_INC_CHARTARR_HXX
21 #define INCLUDED_SC_INC_CHARTARR_HXX
23 #include "rangelst.hxx"
24 #include "chartpos.hxx"
26 #include <memory>
28 class ScDocument;
30 // ScMemChart is a stripped-down SchMemChart from old chart,
31 // used only to transport a rectangular data array for the UNO API,
32 // contains only column/row header text and data values.
34 class ScMemChart
36 SCROW nRowCnt;
37 SCCOL nColCnt;
38 std::unique_ptr<double[]> pData;
39 std::unique_ptr<OUString[]> pColText;
40 std::unique_ptr<OUString[]> pRowText;
42 ScMemChart(const ScMemChart& rMemChart) = delete;
44 public:
45 ScMemChart(SCCOL nCols, SCROW nRows);
46 ~ScMemChart();
48 SCCOL GetColCount() const { return nColCnt; }
49 SCROW GetRowCount() const { return nRowCnt; }
50 const OUString& GetColText(SCCOL nCol) const { return pColText[nCol]; }
51 const OUString& GetRowText(SCROW nRow) const { return pRowText[nRow]; }
52 double GetData(SCCOL nCol, SCROW nRow) const { return pData[nCol * nRowCnt + nRow]; }
53 void SetData(SCCOL nCol, SCROW nRow, const double& rVal) { pData[nCol * nRowCnt + nRow] = rVal; }
54 void SetColText(SCCOL nCol, const OUString& rText) { pColText[nCol] = rText; }
55 void SetRowText(SCROW nRow, const OUString& rText) { pRowText[nRow] = rText; }
58 class SC_DLLPUBLIC ScChartArray // only parameter-struct
60 ScDocument* pDocument;
61 ScChartPositioner aPositioner;
63 private:
64 ScMemChart* CreateMemChartSingle();
65 ScMemChart* CreateMemChartMulti();
66 public:
67 ScChartArray( ScDocument* pDoc, const ScRangeListRef& rRangeList );
69 const ScRangeListRef& GetRangeList() const { return aPositioner.GetRangeList(); }
70 const ScChartPositionMap* GetPositionMap() { return aPositioner.GetPositionMap(); }
72 void SetHeaders(bool bCol, bool bRow) { aPositioner.SetHeaders(bCol, bRow); }
73 bool HasColHeaders() const { return aPositioner.HasColHeaders(); }
74 bool HasRowHeaders() const { return aPositioner.HasRowHeaders(); }
76 ScMemChart* CreateMemChart();
79 #endif
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */