xref: /aoo41x/main/rsc/inc/rsctop.hxx (revision f7c60c9c)
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 #ifndef _RSCTOP_HXX
24 #define _RSCTOP_HXX
25 
26 #include <rscerror.h>
27 #include <rsctools.hxx>
28 #include <rschash.hxx>
29 #include <rscclobj.hxx>
30 
31 /****************** T Y P E S ********************************************/
32 typedef sal_uInt32 RSCVAR;
33 #define VAR_POINTER 	0x0001
34 #define VAR_HIDDEN		0x0002
35 #define VAR_NODATAINST	0x0004
36 #define VAR_NORC		0x0008
37 #define VAR_SVDYNAMIC	0x0010
38 #define VAR_NOENUM		0x0020
39 #define VAR_EXTENDABLE	0x0040	/* Auch die Ableitung einer Klasse kann angegeben werden */
40 
41 /****************** C L A S S E S ****************************************/
42 /******************* R s c C l a s s *************************************/
43 class RscTop : public RefNode
44 {
45 	RscTop *		pSuperClass;
46 	RSCINST 		aDfltInst;
47 	sal_uInt32			nTypId;
48 	RscTop *		pRefClass;
49 
50 protected:
51 					RscTop( Atom nId, sal_uInt32 nTypIdent,
52 							RscTop * pSuperCl = NULL );
53 
54 public:
55 	ByteString		aCallPar1;		// Klassenaufruf ohne Typen bis ResId
56 	ByteString		aCallPar2;		// Klassenaufruf ohne Typen ab ResId
57 	ByteString		aCallParType;	// Klassenaufruf mit Typen
58 
SetSuperClass(RscTop * pClass)59 			void	SetSuperClass( RscTop * pClass )
60 					{
61 						pSuperClass = pClass;
62 					}
GetSuperClass() const63 			RscTop* GetSuperClass() const
64 					{ return pSuperClass; }
65 					// Gibt den Typidentifier zurueck
GetTypId() const66 			sal_uInt32	GetTypId() const
67 					{ return nTypId; };
68 					// Gibt die Oberklasse zurueck
69 			sal_Bool	InHierarchy( RscTop * pClass );
IsCodeWriteable() const70 			sal_Bool	IsCodeWriteable() const
71 					{
72 						return( 0 != aCallParType.Len() );
73 					}
74 			void	SetCallPar( const ByteString & rPar1, const ByteString & rPar2,
75 								const ByteString & rParType );
SetRefClass(RscTop * pRef)76 			void	SetRefClass( RscTop * pRef ) { pRefClass = pRef; }
GetRefClass() const77 			RscTop* GetRefClass() const { return pRefClass; }
78 	virtual RSCCLASS_TYPE GetClassType() const = 0;
79 			RSCINST GetDefault();
80 
81 					// Vorbereitung auf den dtor aufruf
82 					// Da die Klassen gegenseitige Abhaengigkeiten
83 					// aufweisen koennen, kann man im dtor nicht davon
84 					// ausgehen, dass alle Klassenzeiger noch gueltig sind
85 	virtual void	Pre_dtor();
86 
87 	virtual Atom	GetConstant( sal_uInt32 );
88 
89 	virtual RscTop *	GetTypeClass() const;
90 
91 					// Gibt die Groesse der Klasse in Bytes
92 	virtual sal_uInt32	Size();
93 
94 					// Gibt die Referenz zurueck
95 	virtual ERRTYPE GetRef( const RSCINST & rInst, RscId * );
96 
97 					// Gibt die Referenz zurueck
98 	virtual ERRTYPE SetRef( const RSCINST & rInst, const RscId & rRefId );
99 
100 					// Variable anlegen
101 	virtual ERRTYPE SetVariable( Atom nVarName, RscTop * pClass,
102 								 RSCINST * pDflt = NULL,
103 								 RSCVAR nVarType = 0, sal_uInt32 nMask = 0,
104 								 Atom nDataBaseName = InvalidAtom );
105 
106 					// Zaehlt alle Variablen auf
107 	virtual void	EnumVariables( void * pData, VarEnumCallbackProc );
108 
109 					// Liefert Instanz der Variablen zurueck
110 					// pData, pClass im return koennen NULL sein
111 	virtual RSCINST GetVariable( const RSCINST & rInst, Atom nVarName,
112 								 const RSCINST & rInitInst,
113 								 sal_Bool nInitDflt = sal_False,
114 								 RscTop * pCreateClass = NULL );
115 	virtual RSCINST GetCopyVar( const RSCINST & rInst, Atom nVarName );
116 
117 	virtual RSCINST GetTupelVar( const RSCINST & rInst, sal_uInt32 nPos,
118 								 const RSCINST & rInitInst );
119 
120 					// Liefert Instanz aus einem Feld zurueck
121 					// pGetInst im return kann NULL sein
122 	virtual ERRTYPE GetElement( const RSCINST & rInst, const RscId & rEleName,
123 								RscTop *pCreateClass, const RSCINST & rCreateInst,
124 								RSCINST * pGetInst );
125 
126 					// Liefert Instanz aus einem Feld zurueck
127 					// pGetInst im return kann NULL sein
128 	virtual ERRTYPE GetValueEle( const RSCINST & rInst, sal_Int32 lValue,
129 								RscTop * pCreateClass,
130 								RSCINST * pGetInst );
131 
132 					// Liefert Instanz aus einem Feld zurueck
133 					// pGetInst im return kann NULL sein
134 	virtual ERRTYPE GetArrayEle( const RSCINST & rInst, Atom nId,
135 								RscTop * pCreateClass,
136 								RSCINST * pGetInst );
137 
138 	virtual RSCINST SearchEle( const RSCINST & rInst, const RscId & rEleName,
139 							   RscTop * pClass );
140 
141 					// Liefert Instanz an der Position zurueck
142 	virtual RSCINST GetPosEle( const RSCINST & rInst, sal_uInt32 nPos );
143 
144 					// verschiebt eine Instanz
145 	virtual ERRTYPE MovePosEle( const RSCINST & rInst, sal_uInt32 nDestPos,
146 								sal_uInt32 nSourcePos );
147 
148 					// aendert RscId an Position
149 	virtual ERRTYPE SetPosRscId( const RSCINST & rInst, sal_uInt32 nPos,
150 								 const RscId & rRscId);
151 
152 					// Liefert Information ueber Instanz
153 					// an der Position zurueck
154 	virtual SUBINFO_STRUCT GetInfoEle( const RSCINST & rInst, sal_uInt32 nPos );
155 
156 					// Anzahl der Eintraege
157 	virtual sal_uInt32 GetCount( const RSCINST & rInst );
158 
159 					// Eine Zuweisung an eine Variable
160 	virtual ERRTYPE SetNumber( const RSCINST & rInst, sal_Int32 lValue );
161 
162 					// Eine Zuweisung an eine Variable
163 	virtual ERRTYPE SetBool( const RSCINST & rInst, sal_Bool bValue );
164 
165 					// Eine Zuweisung an eine Variable
166 	virtual ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId,
167 							  sal_Int32 nValue );
168 
169 					// Eine Zuweisung an eine Variable
170 	virtual ERRTYPE SetNotConst( const RSCINST & rInst, Atom nId );
171 
172 	virtual ERRTYPE SetString( const RSCINST & rInst, const char * pStr );
173 
174 	virtual ERRTYPE GetNumber( const RSCINST & rInst, sal_Int32 * pN );
175 
176 	virtual ERRTYPE GetBool( const RSCINST & rInst, sal_Bool * pB );
177 
178 	virtual ERRTYPE GetConst( const RSCINST & rInst, Atom * pH );
179 
180 	virtual ERRTYPE GetString( const RSCINST & rInst, char ** ppStr );
181 
182 	virtual RSCINST Create( RSCINST * pInst,
183 							const RSCINST & rDefInst, sal_Bool bOwnClass = sal_False );
184 
185 					// Instanz zerstoeren
186 	virtual void	Destroy( const RSCINST & rInst );
187 
188 					// prueft auf konsistenz
189 	virtual sal_Bool	IsConsistent( const RSCINST & rInst,
190 								  RscInconsList * pList = NULL );
191 
192 					// Alles auf Default setzen
193 	virtual void	SetToDefault( const RSCINST & rInst );
194 
195 					// Ist Eingabe = Default
196 	virtual sal_Bool	IsDefault( const RSCINST & rInst );
197 
198 					// Gleiche Werte auf Default setzen
199 	virtual sal_Bool	IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
200 
201 					// Instanz auf Default setzen
202 	virtual void	SetDefault( const RSCINST & rInst, Atom nVarId );
203 
204 					// Default zu einer Variablen holen
205 	virtual RSCINST GetDefault( Atom nVarId );
206 
207 	virtual void	Delete( const RSCINST & rInst, RscTop * pClass,
208 							const RscId & rId );
209 
210 	virtual void	DeletePos( const RSCINST & rInst, sal_uInt32 nPos );
211 
212 					// Schreibt den Kopf und das Ende einer Resource
213 					// Script Datei
214 	virtual void	WriteSrcHeader( const RSCINST & rInst, FILE * fOutput,
215 									RscTypCont * pTC, sal_uInt32 nTab,
216 									const RscId & aId, const char * );
217 	virtual void	WriteSrc( const RSCINST & rInst, FILE * fOutput,
218 							  RscTypCont * pTC, sal_uInt32 nTab,const char * );
219 	virtual ERRTYPE WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem,
220 								   RscTypCont * pTC, const RscId & aId,
221 									sal_uInt32 nDeep, sal_Bool bExtra );
222 	virtual ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
223 							 RscTypCont * pTC, sal_uInt32 nDeep, sal_Bool bExtra );
224 
225 	// Weiterleitung an Superklassen wird unterbunden
226 	virtual ERRTYPE WriteHxxHeader( const RSCINST & rInst, FILE * fOutput,
227 									RscTypCont * pTC, const RscId & rId );
228 	virtual ERRTYPE WriteHxx( const RSCINST & rInst, FILE * fOutput,
229 							  RscTypCont * pTC, const RscId &rId );
230 	virtual ERRTYPE WriteCxxHeader( const RSCINST & rInst, FILE * fOutput,
231 									RscTypCont * pTC, const RscId &rId );
232 	virtual ERRTYPE WriteCxx( const RSCINST & rInst, FILE * fOutput,
233 							  RscTypCont * pTC, const RscId &rId );
234 
235 			void WriteSyntaxHeader( FILE * fOutput, RscTypCont * pTC  );
236 	virtual void WriteSyntax( FILE * fOutput, RscTypCont * pTC );
237 
238 	virtual void	WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
239 									const char * );
240 	virtual void	WriteRcCtor( FILE * fOutput, RscTypCont * pTC );
241 };
242 
243 #endif //_RSCTOP_HXX
244