merge the formfield patch from ooo-build
[ooovba.git] / sc / inc / chartarr.hxx
blobca54cfe686bdecb9060bbb46a0ab39f031edd6f0
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: chartarr.hxx,v $
10 * $Revision: 1.7.32.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_CHARTARR_HXX
32 #define SC_CHARTARR_HXX
34 // -----------------------------------------------------------------------
36 #include "collect.hxx"
37 #include "rangelst.hxx"
38 #include "chartpos.hxx"
40 class ScAddress;
41 class Table;
42 class ScDocument;
45 // ScMemChart is a stripped-down SchMemChart from old chart,
46 // used only to transport a rectangular data array for the UNO API,
47 // contains only column/row header text and data values.
49 class ScMemChart
51 short nRowCnt;
52 short nColCnt;
53 double* pData;
54 String* pColText;
55 String* pRowText;
57 ScMemChart(const ScMemChart& rMemChart); // not implemented
59 public:
60 ScMemChart(short nCols, short nRows);
61 ~ScMemChart();
63 short GetColCount() const { return nColCnt; }
64 short GetRowCount() const { return nRowCnt; }
65 const String& GetColText(short nCol) const { return pColText[nCol]; }
66 const String& GetRowText(short nRow) const { return pRowText[nRow]; }
67 double GetData(short nCol, short nRow) const { return pData[nCol * nRowCnt + nRow]; }
68 void SetData(short nCol, short nRow, const double& rVal) { pData[nCol * nRowCnt + nRow] = rVal; }
69 void SetColText(short nCol, const String& rText) { pColText[nCol] = rText; }
70 void SetRowText(short nRow, const String& rText) { pRowText[nRow] = rText; }
74 class SC_DLLPUBLIC ScChartArray : public ScDataObject // nur noch Parameter-Struct
76 String aName;
77 ScDocument* pDocument;
78 ScChartPositioner aPositioner;
79 BOOL bValid; // fuer Erzeugung aus SchMemChart
81 private:
82 ScMemChart* CreateMemChartSingle();
83 ScMemChart* CreateMemChartMulti();
84 public:
85 ScChartArray( ScDocument* pDoc, SCTAB nTab,
86 SCCOL nStartColP, SCROW nStartRowP,
87 SCCOL nEndColP, SCROW nEndRowP,
88 const String& rChartName );
89 ScChartArray( ScDocument* pDoc, const ScRangeListRef& rRangeList,
90 const String& rChartName );
91 ScChartArray( const ScChartArray& rArr );
93 virtual ~ScChartArray();
94 virtual ScDataObject* Clone() const;
96 const ScRangeListRef& GetRangeList() const { return aPositioner.GetRangeList(); }
97 void SetRangeList( const ScRangeListRef& rNew ) { aPositioner.SetRangeList(rNew); }
98 void SetRangeList( const ScRange& rNew ) { aPositioner.SetRangeList(rNew); }
99 const ScChartPositionMap* GetPositionMap() { return aPositioner.GetPositionMap(); }
101 void SetHeaders(BOOL bCol, BOOL bRow) { aPositioner.SetHeaders(bCol, bRow); }
102 BOOL HasColHeaders() const { return aPositioner.HasColHeaders(); }
103 BOOL HasRowHeaders() const { return aPositioner.HasRowHeaders(); }
104 BOOL IsValid() const { return bValid; }
105 void SetName(const String& rNew) { aName = rNew; }
106 const String& GetName() const { return aName; }
108 BOOL operator==(const ScChartArray& rCmp) const;
110 ScMemChart* CreateMemChart();
113 class ScChartCollection : public ScCollection
115 public:
116 ScChartCollection() : ScCollection( 4,4 ) {}
117 ScChartCollection( const ScChartCollection& rColl ):
118 ScCollection( rColl ) {}
120 virtual ScDataObject* Clone() const;
121 ScChartArray* operator[](USHORT nIndex) const
122 { return (ScChartArray*)At(nIndex); }
124 BOOL operator==(const ScChartCollection& rCmp) const;
129 #endif