xref: /aoo41x/main/sc/inc/chartarr.hxx (revision 38d50f7b)
1*38d50f7bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*38d50f7bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*38d50f7bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*38d50f7bSAndrew Rist  * distributed with this work for additional information
6*38d50f7bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*38d50f7bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*38d50f7bSAndrew Rist  * "License"); you may not use this file except in compliance
9*38d50f7bSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*38d50f7bSAndrew Rist  *
11*38d50f7bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*38d50f7bSAndrew Rist  *
13*38d50f7bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*38d50f7bSAndrew Rist  * software distributed under the License is distributed on an
15*38d50f7bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*38d50f7bSAndrew Rist  * KIND, either express or implied.  See the License for the
17*38d50f7bSAndrew Rist  * specific language governing permissions and limitations
18*38d50f7bSAndrew Rist  * under the License.
19*38d50f7bSAndrew Rist  *
20*38d50f7bSAndrew Rist  *************************************************************/
21*38d50f7bSAndrew Rist 
22*38d50f7bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SC_CHARTARR_HXX
25cdf0e10cSrcweir #define SC_CHARTARR_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir // -----------------------------------------------------------------------
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include "collect.hxx"
30cdf0e10cSrcweir #include "rangelst.hxx"
31cdf0e10cSrcweir #include "chartpos.hxx"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir class ScAddress;
34cdf0e10cSrcweir class Table;
35cdf0e10cSrcweir class ScDocument;
36cdf0e10cSrcweir 
37cdf0e10cSrcweir 
38cdf0e10cSrcweir // ScMemChart is a stripped-down SchMemChart from old chart,
39cdf0e10cSrcweir // used only to transport a rectangular data array for the UNO API,
40cdf0e10cSrcweir // contains only column/row header text and data values.
41cdf0e10cSrcweir 
42cdf0e10cSrcweir class ScMemChart
43cdf0e10cSrcweir {
44cdf0e10cSrcweir     short           nRowCnt;
45cdf0e10cSrcweir     short           nColCnt;
46cdf0e10cSrcweir     double*         pData;
47cdf0e10cSrcweir     String*         pColText;
48cdf0e10cSrcweir     String*         pRowText;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir     ScMemChart(const ScMemChart& rMemChart);      // not implemented
51cdf0e10cSrcweir 
52cdf0e10cSrcweir public:
53cdf0e10cSrcweir     ScMemChart(short nCols, short nRows);
54cdf0e10cSrcweir     ~ScMemChart();
55cdf0e10cSrcweir 
GetColCount() const56cdf0e10cSrcweir     short GetColCount() const { return nColCnt;	}
GetRowCount() const57cdf0e10cSrcweir     short GetRowCount() const {	return nRowCnt;	}
GetColText(short nCol) const58cdf0e10cSrcweir     const String& GetColText(short nCol) const { return pColText[nCol]; }
GetRowText(short nRow) const59cdf0e10cSrcweir     const String& GetRowText(short nRow) const { return pRowText[nRow]; }
GetData(short nCol,short nRow) const60cdf0e10cSrcweir     double GetData(short nCol, short nRow) const { return pData[nCol * nRowCnt + nRow]; }
SetData(short nCol,short nRow,const double & rVal)61cdf0e10cSrcweir     void SetData(short nCol, short nRow, const double& rVal) { pData[nCol * nRowCnt + nRow] = rVal; }
SetColText(short nCol,const String & rText)62cdf0e10cSrcweir     void SetColText(short nCol, const String& rText) { pColText[nCol] = rText; }
SetRowText(short nRow,const String & rText)63cdf0e10cSrcweir     void SetRowText(short nRow, const String& rText) { pRowText[nRow] = rText; }
64cdf0e10cSrcweir };
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 
67cdf0e10cSrcweir class SC_DLLPUBLIC ScChartArray : public ScDataObject				// nur noch Parameter-Struct
68cdf0e10cSrcweir {
69cdf0e10cSrcweir 	String		aName;
70cdf0e10cSrcweir 	ScDocument*	pDocument;
71cdf0e10cSrcweir 	ScChartPositioner aPositioner;
72cdf0e10cSrcweir 	sal_Bool		bValid;				// fuer Erzeugung aus SchMemChart
73cdf0e10cSrcweir 
74cdf0e10cSrcweir private:
75cdf0e10cSrcweir     ScMemChart* CreateMemChartSingle();
76cdf0e10cSrcweir     ScMemChart* CreateMemChartMulti();
77cdf0e10cSrcweir public:
78cdf0e10cSrcweir 	ScChartArray( ScDocument* pDoc, SCTAB nTab,
79cdf0e10cSrcweir 					SCCOL nStartColP, SCROW nStartRowP,
80cdf0e10cSrcweir 					SCCOL nEndColP, SCROW nEndRowP,
81cdf0e10cSrcweir 					const String& rChartName );
82cdf0e10cSrcweir 	ScChartArray( ScDocument* pDoc, const ScRangeListRef& rRangeList,
83cdf0e10cSrcweir 					const String& rChartName );
84cdf0e10cSrcweir 	ScChartArray( const ScChartArray& rArr );
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	virtual	~ScChartArray();
87cdf0e10cSrcweir 	virtual	ScDataObject* Clone() const;
88cdf0e10cSrcweir 
GetRangeList() const89cdf0e10cSrcweir 	const ScRangeListRef&	GetRangeList() const { return aPositioner.GetRangeList(); }
SetRangeList(const ScRangeListRef & rNew)90cdf0e10cSrcweir 	void	SetRangeList( const ScRangeListRef& rNew ) { aPositioner.SetRangeList(rNew); }
SetRangeList(const ScRange & rNew)91cdf0e10cSrcweir 	void	SetRangeList( const ScRange& rNew ) { aPositioner.SetRangeList(rNew); }
GetPositionMap()92cdf0e10cSrcweir     const   ScChartPositionMap* GetPositionMap() { return aPositioner.GetPositionMap(); }
93cdf0e10cSrcweir 
SetHeaders(sal_Bool bCol,sal_Bool bRow)94cdf0e10cSrcweir 	void	SetHeaders(sal_Bool bCol, sal_Bool bRow) { aPositioner.SetHeaders(bCol, bRow); }
HasColHeaders() const95cdf0e10cSrcweir 	sal_Bool	HasColHeaders() const			 { return aPositioner.HasColHeaders(); }
HasRowHeaders() const96cdf0e10cSrcweir 	sal_Bool	HasRowHeaders() const			 { return aPositioner.HasRowHeaders(); }
IsValid() const97cdf0e10cSrcweir 	sal_Bool	IsValid() const					 { return bValid; }
SetName(const String & rNew)98cdf0e10cSrcweir 	void	SetName(const String& rNew)		 { aName = rNew; }
GetName() const99cdf0e10cSrcweir 	const String& GetName() const			 { return aName; }
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 	sal_Bool	operator==(const ScChartArray& rCmp) const;
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     ScMemChart* CreateMemChart();
104cdf0e10cSrcweir };
105cdf0e10cSrcweir 
106cdf0e10cSrcweir class ScChartCollection : public ScCollection
107cdf0e10cSrcweir {
108cdf0e10cSrcweir public:
ScChartCollection()109cdf0e10cSrcweir 	ScChartCollection() : ScCollection( 4,4 ) {}
ScChartCollection(const ScChartCollection & rColl)110cdf0e10cSrcweir 	ScChartCollection( const ScChartCollection& rColl ):
111cdf0e10cSrcweir 			ScCollection( rColl ) {}
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	virtual	ScDataObject*	Clone() const;
operator [](sal_uInt16 nIndex) const114cdf0e10cSrcweir 	ScChartArray*		operator[](sal_uInt16 nIndex) const
115cdf0e10cSrcweir 						{ return (ScChartArray*)At(nIndex); }
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	sal_Bool	operator==(const ScChartCollection& rCmp) const;
118cdf0e10cSrcweir };
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 
122cdf0e10cSrcweir #endif
123cdf0e10cSrcweir 
124