build fix
[LibreOffice.git] / sc / inc / chartarr.hxx
blob6165290ee5b2c90a7f9fea0e68d5997c2aa26990
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>
27 #include <vector>
29 class ScDocument;
31 // ScMemChart is a stripped-down SchMemChart from old chart,
32 // used only to transport a rectangular data array for the UNO API,
33 // contains only column/row header text and data values.
35 class ScMemChart
37 SCROW nRowCnt;
38 SCCOL nColCnt;
39 double* pData;
40 OUString* pColText;
41 OUString* pRowText;
43 ScMemChart(const ScMemChart& rMemChart) = delete;
45 public:
46 ScMemChart(SCCOL nCols, SCROW nRows);
47 ~ScMemChart();
49 SCCOL GetColCount() const { return nColCnt; }
50 SCROW GetRowCount() const { return nRowCnt; }
51 const OUString& GetColText(SCCOL nCol) const { return pColText[nCol]; }
52 const OUString& GetRowText(SCROW nRow) const { return pRowText[nRow]; }
53 double GetData(SCCOL nCol, SCROW nRow) const { return pData[nCol * nRowCnt + nRow]; }
54 void SetData(SCCOL nCol, SCROW nRow, const double& rVal) { pData[nCol * nRowCnt + nRow] = rVal; }
55 void SetColText(SCCOL nCol, const OUString& rText) { pColText[nCol] = rText; }
56 void SetRowText(SCROW nRow, const OUString& rText) { pRowText[nRow] = rText; }
59 class SC_DLLPUBLIC ScChartArray // only parameter-struct
61 OUString aName;
62 ScDocument* pDocument;
63 ScChartPositioner aPositioner;
65 private:
66 ScMemChart* CreateMemChartSingle();
67 ScMemChart* CreateMemChartMulti();
68 public:
69 ScChartArray( ScDocument* pDoc, SCTAB nTab,
70 SCCOL nStartColP, SCROW nStartRowP,
71 SCCOL nEndColP, SCROW nEndRowP,
72 const OUString& rChartName );
73 ScChartArray( ScDocument* pDoc, const ScRangeListRef& rRangeList,
74 const OUString& rChartName );
75 ScChartArray( const ScChartArray& rArr );
76 ~ScChartArray();
78 const ScRangeListRef& GetRangeList() const { return aPositioner.GetRangeList(); }
79 const ScChartPositionMap* GetPositionMap() { return aPositioner.GetPositionMap(); }
81 void SetHeaders(bool bCol, bool bRow) { aPositioner.SetHeaders(bCol, bRow); }
82 bool HasColHeaders() const { return aPositioner.HasColHeaders(); }
83 bool HasRowHeaders() const { return aPositioner.HasRowHeaders(); }
84 const OUString& GetName() const { return aName; }
86 ScMemChart* CreateMemChart();
89 class ScChartCollection
91 typedef ::std::vector<std::unique_ptr<ScChartArray>> DataType;
92 DataType m_Data;
94 public:
95 ScChartCollection();
96 ScChartCollection(const ScChartCollection& rColl);
98 SC_DLLPUBLIC void push_back(ScChartArray* p);
99 void clear();
100 size_t size() const;
101 bool empty() const;
102 ScChartArray* operator[](size_t nIndex);
103 const ScChartArray* operator[](size_t nIndex) const;
106 #endif
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */