1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 SC_CHARTARR_HXX
21 #define SC_CHARTARR_HXX
23 // -----------------------------------------------------------------------
25 #include "rangelst.hxx"
26 #include "chartpos.hxx"
28 #include <boost/ptr_container/ptr_vector.hpp>
32 // ScMemChart is a stripped-down SchMemChart from old chart,
33 // used only to transport a rectangular data array for the UNO API,
34 // contains only column/row header text and data values.
44 ScMemChart(const ScMemChart
& rMemChart
); // not implemented
47 ScMemChart(short nCols
, short nRows
);
50 short GetColCount() const { return nColCnt
; }
51 short GetRowCount() const { return nRowCnt
; }
52 const OUString
& GetColText(short nCol
) const { return pColText
[nCol
]; }
53 const OUString
& GetRowText(short nRow
) const { return pRowText
[nRow
]; }
54 double GetData(short nCol
, short nRow
) const { return pData
[nCol
* nRowCnt
+ nRow
]; }
55 void SetData(short nCol
, short nRow
, const double& rVal
) { pData
[nCol
* nRowCnt
+ nRow
] = rVal
; }
56 void SetColText(short nCol
, const OUString
& rText
) { pColText
[nCol
] = rText
; }
57 void SetRowText(short nRow
, const OUString
& rText
) { pRowText
[nRow
] = rText
; }
60 class SC_DLLPUBLIC ScChartArray
// only parameter-struct
63 ScDocument
* pDocument
;
64 ScChartPositioner aPositioner
;
65 bool bValid
; // for creation out of SchMemChart
68 ScMemChart
* CreateMemChartSingle();
69 ScMemChart
* CreateMemChartMulti();
71 ScChartArray( ScDocument
* pDoc
, SCTAB nTab
,
72 SCCOL nStartColP
, SCROW nStartRowP
,
73 SCCOL nEndColP
, SCROW nEndRowP
,
74 const OUString
& rChartName
);
75 ScChartArray( ScDocument
* pDoc
, const ScRangeListRef
& rRangeList
,
76 const OUString
& rChartName
);
77 ScChartArray( const ScChartArray
& rArr
);
80 const ScRangeListRef
& GetRangeList() const { return aPositioner
.GetRangeList(); }
81 void SetRangeList( const ScRangeListRef
& rNew
) { aPositioner
.SetRangeList(rNew
); }
82 void SetRangeList( const ScRange
& rNew
) { aPositioner
.SetRangeList(rNew
); }
83 const ScChartPositionMap
* GetPositionMap() { return aPositioner
.GetPositionMap(); }
85 void SetHeaders(bool bCol
, bool bRow
) { aPositioner
.SetHeaders(bCol
, bRow
); }
86 bool HasColHeaders() const { return aPositioner
.HasColHeaders(); }
87 bool HasRowHeaders() const { return aPositioner
.HasRowHeaders(); }
88 bool IsValid() const { return bValid
; }
89 void SetName(const OUString
& rNew
) { aName
= rNew
; }
90 const OUString
& GetName() const { return aName
; }
92 bool operator==(const ScChartArray
& rCmp
) const;
94 ScMemChart
* CreateMemChart();
97 class ScChartCollection
99 typedef ::boost::ptr_vector
<ScChartArray
> DataType
;
103 ScChartCollection(const ScChartCollection
& rColl
);
105 SC_DLLPUBLIC
void push_back(ScChartArray
* p
);
109 ScChartArray
* operator[](size_t nIndex
);
110 const ScChartArray
* operator[](size_t nIndex
) const;
112 bool operator==(const ScChartCollection
& rCmp
) const;
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */