xref: /aoo42x/main/sc/source/filter/inc/excscen.hxx (revision 38d50f7b)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_EXCSCEN_HXX
25 #define SC_EXCSCEN_HXX
26 
27 #include <tools/solar.h>
28 #include <tools/list.hxx>
29 #include <tools/string.hxx>
30 
31 
32 struct RootData;
33 class XclImpRoot;
34 class XclImpStream;
35 class ScDocument;
36 
37 
38 
39 class ExcScenarioCell
40 {
41 private:
42 	String						aValue;
43 public:
44 	const sal_uInt16				nCol;
45 	const sal_uInt16				nRow;
46 
47 								ExcScenarioCell( const sal_uInt16 nC, const sal_uInt16 nR );
48 	void						SetValue( const String& rVal );
49 	inline const String&		GetValue( void ) const;
50 };
51 
52 
53 
54 
55 class ExcScenario : protected List
56 {
57 private:
58 	friend class ExcScenarioList;
59 protected:
60 	String*						pName;
61 	String*						pComment;
62 	String*						pUserName;
63 	sal_uInt8						nProtected;
64 
65 	const sal_uInt16				nTab;
66 
67     void                        Apply( const XclImpRoot& rRoot, const sal_Bool bLast = sal_False );
68 public:
69 								ExcScenario( XclImpStream& rIn, const RootData& rRoot );
70 	virtual						~ExcScenario();
71 };
72 
73 
74 
75 
76 class ExcScenarioList : protected List
77 {
78 private:
79 	sal_uInt16						nLastScenario;
_First(void)80 	inline ExcScenario*			_First( void )	{ return ( ExcScenario* ) List::First(); }
_Next(void)81 	inline ExcScenario*			_Next( void )	{ return ( ExcScenario* ) List::Next(); }
_Last(void)82 	inline ExcScenario*			_Last( void )	{ return ( ExcScenario* ) List::Last(); }
_Prev(void)83 	inline ExcScenario*			_Prev( void )	{ return ( ExcScenario* ) List::Prev(); }
84 protected:
85 public:
86                                 ExcScenarioList( void );
87 	virtual						~ExcScenarioList();
88 
89 	inline void					Append( ExcScenario* pNew );
90 
91 	inline void					SetLast( const sal_uInt16 nIndex4Last );
92 
93 	inline const ExcScenario*	First( void );
94 	inline const ExcScenario*	Next( void );
95 
96     using List::Count;
97 
98     void                        Apply( const XclImpRoot& rRoot );
99 };
100 
101 
102 
103 
GetValue(void) const104 inline const String& ExcScenarioCell::GetValue( void ) const
105 {
106 	return aValue;
107 }
108 
109 
110 
111 
ExcScenarioList(void)112 inline ExcScenarioList::ExcScenarioList( void )
113 {
114 	nLastScenario = 0;
115 }
116 
117 
Append(ExcScenario * p)118 inline void ExcScenarioList::Append( ExcScenario* p )
119 {
120 	List::Insert( p, LIST_APPEND );
121 }
122 
123 
First(void)124 inline const ExcScenario* ExcScenarioList::First( void )
125 {
126 	return ( const ExcScenario* ) List::First();
127 }
128 
129 
Next(void)130 inline const ExcScenario* ExcScenarioList::Next( void )
131 {
132 	return ( const ExcScenario* ) List::Next();
133 }
134 
135 
SetLast(const sal_uInt16 n)136 inline void ExcScenarioList::SetLast( const sal_uInt16 n )
137 {
138 	nLastScenario = n;
139 }
140 
141 
142 #endif
143 
144