sync master with lastest vba changes
[ooovba.git] / rsc / inc / rscinst.hxx
blobc8f5a6148456e6f3921177c257146f265e4292cb
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: rscinst.hxx,v $
10 * $Revision: 1.6 $
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 ************************************************************************/
30 #ifndef _RSCINST_HXX
31 #define _RSCINST_HXX
33 #include <rscall.h>
34 #include <rscerror.h>
35 #include <rsctools.hxx>
37 /******************* C l a s s e s F o r w a r d s *********************/
38 class RscTypCont;
39 class RscCmdLine;
40 class REResourceList;
41 class RscTop;
42 class RscInstCopy;
44 /******************* F u n c t i o n F o r w a r d s *******************/
45 Atom HashId( const char * ); // Gibt zu einem String eine HashId
46 const char * GetHashString( Atom ); // Gibt zu einer Atom einen String
47 // NULL, wenn kein Eintrag vorhanden
49 /******************* S t r u c t s ***************************************/
51 /****************** C L A S S E S ****************************************/
52 class RscInst
54 void MakeCopy( RSCINST aCopyInst );
55 static RSCINST GetSysLangInst( RSCINST & rInst );
56 public:
57 RSCINST aInst;
59 RscInst();
60 RscInst( const RscInst & rInst );
61 RscInst( RSCINST aTmpI );
62 RscInst& operator = ( const RscInst& rRscInst );
63 ~RscInst();
64 void OverWrite( RscInstCopy & rInst );
65 BOOL IsInst() const { return( aInst.IsInst() ); }
67 // Listen Methoden
68 ERRTYPE SetElement( const RscId & rName, RscInstCopy & rInst );
69 ERRTYPE SetPosEle( sal_uInt32 nPos, RscInstCopy & rInst );
70 ERRTYPE SetPosRscId( sal_uInt32 nPos, const RscId & rId );
71 SUBINFO_STRUCT GetInfoEle( sal_uInt32 nPos );
72 sal_uInt32 GetCount();
73 RscInst GetElement( RscTop * pClass, const RscId & rName );
74 RscInst GetPosEle( sal_uInt32 nPos );
75 ERRTYPE MovePosEle( sal_uInt32 nDestPos, sal_uInt32 nSourcePos );
76 ERRTYPE DeleteElement( RscTop * pClass, const RscId & rName );
77 ERRTYPE DeletePosEle( sal_uInt32 nPos );
79 ERRTYPE SetVar( Atom nVarName, RscInstCopy & rInst );
80 ERRTYPE SetConst( Atom nVarName, Atom nConstId );
81 ERRTYPE SetBool( Atom nVarName, BOOL );
83 // Hack fuer X, Y, Width, Height
84 static ERRTYPE SetCorrectValues( RSCINST & rInst, RSCINST & rVarInst,
85 INT32 lValue, sal_uInt32 nTupelIdx );
86 ERRTYPE SetNumber( Atom nVarName, INT32 );
88 ERRTYPE SetString( Atom nVarName, const char * );
89 ERRTYPE SetConst( Atom nConstId );
90 ERRTYPE SetBool( BOOL );
91 ERRTYPE SetNumber( INT32 );
92 ERRTYPE SetString( const char * );
93 ERRTYPE SetRef( const RscId & rRscId );
94 ERRTYPE SetDefault( Atom nVarName );
96 RscInst GetVar( Atom nVarName );
97 Atom GetConst( Atom nVarName = InvalidAtom );
98 sal_uInt32 GetConstPos( Atom nVarName = InvalidAtom );
99 BOOL GetBool( Atom nVarName = InvalidAtom );
101 // Hack fuer X, Y, Width, Height
102 static INT32 GetCorrectValues( RSCINST & rInst, RSCINST & rVarInst,
103 sal_uInt32 nTupelIdx );
104 INT32 GetNumber( Atom nVarName = InvalidAtom );
106 const char *GetString( Atom nVarName = InvalidAtom );
107 RscId GetRef();
108 BOOL IsDefault( Atom nVarName );
109 BOOL IsConsistent( RscInconsList * pList );
111 Atom GetClassEnum( Atom nVarName, sal_uInt32 nPos );
112 Atom GetClassEnum( sal_uInt32 nPos );
113 RscTop * GetClassType(){ return aInst.pClass; };
114 Atom GetClassName();
115 void EnumClassVariables( void * pData, VarEnumCallbackProc ) const;
116 ERRTYPE WriteRc( RscWriteRc & aMem );
119 class RscInstCopy : public RscInst {
120 void MakeCopy( RSCINST aCopyInst );
121 public:
122 RscInstCopy();
123 RscInstCopy( const RscInstCopy & rInst );
124 RscInstCopy( const RscInst & rInst );
125 RscInstCopy( RSCINST aTmpI );
126 RscInstCopy( RscTop * pNewType, const RscInst & rInst );
127 RscInstCopy& operator = ( const RscInstCopy & rRscInst );
128 RscInstCopy& operator = ( const RscInst & rRscInst );
129 ~RscInstCopy();
132 class RscDataBase
134 friend class RscHrc;
135 friend class RscSrc;
136 friend class RscInst;
138 RscCmdLine * pCmdLine;
139 RscTypCont * pTC;
140 LanguageType nLangType;
141 public:
142 RscDataBase( RscError * );
143 ~RscDataBase();
145 // void SetLanguage( LanguageType nTyp ) { nLangType = nTyp; }
146 void SetLanguage( Atom nId );
147 Atom GetLanguage() const;
149 ByteString GetPath() const;
150 void SetPath( const ByteString & rPath );
151 // Konvertiert einen Namen in einen Typ
152 RscTop* GetClassType( Atom nClassName );
153 // Instanz einer Klasse erzeugen
154 BOOL MakeConsistent( RscInconsList * pList );
155 // Array mit Dateinamen
156 RscFileTab* GetFileTab();
157 // Eine Dateinamen-Instanz holen
158 RscFile * GetFileStruct( ULONG lKey );
160 ULONG AddSrcFile( const ByteString & rFileName );
161 ULONG AddHrcFile( const ByteString & rFileName );
162 // Traegt die Include-Dateien in die Abhaengigkeitsliste
163 // von lFileKey ein
164 void ScanForIncFiles( ULONG lFileKey );
165 void RemoveFile( ULONG lKey );
167 // Suche ueber alle DEFINES
168 RscDefine * FindDef( const ByteString & rName );
169 ULONG GetFileKey( const ByteString & rFileName );
172 class RscHrc
174 protected:
175 ULONG lFileKey; // Index der Instanz
176 RscDataBase * pDataBase;// Datenbasis
177 public:
179 // Kompilerinstanz erzeugen
180 RscHrc( RscDataBase * pDBase, ULONG lKey );
181 ~RscHrc();
183 // Daten von Datei uebernehmen
184 ERRTYPE ReadFile();
186 ULONG GetFileKey() const { return lFileKey; }
188 void SetDirty( BOOL bSet );
189 BOOL IsDirty();
190 void SetPathName( const ByteString & );
191 ByteString GetPathName();
192 void SetFileName( const ByteString & );
193 ByteString GetFileName();
195 //Depend-Datei anhaengen
196 void InsertDepend( ULONG lKey, ULONG lPos );
198 // DefineList holen
199 RscDefineList * GetDefineList();
200 // Suche ueber all DEFINES im Zugriff
201 RscDefine * FindDef( const ByteString & rName );
202 ERRTYPE NewDef( const ByteString & rMacroName, INT32 lValue,
203 ULONG lPos );
204 ERRTYPE NewDef( const ByteString & rMacroName, const ByteString & rMacro,
205 ULONG lPos );
206 ERRTYPE ChangeDef( const ByteString & rMacroName, INT32 lValue );
207 ERRTYPE ChangeDef( const ByteString & rMacroName,
208 const ByteString & rMacro );
209 BOOL IsDefUsed( const ByteString & );
210 void DeleteDef( const ByteString & rMacroName );
211 ERRTYPE ChangeDefName( const ByteString & rMacroName,
212 const ByteString & rNewName );
214 // Dateinamen-Instanz holen
215 RscFile * GetFileStruct();
216 //Abhaengigkeitsliste holen holen
217 RscDependList * GetDependList();
219 // Datei schreiben
220 ERRTYPE WriteFile();
223 class RscSrc : public RscHrc {
224 public:
225 // Kompilerinstanz erzeugen
226 RscSrc( RscDataBase * pDBase, ULONG lKey );
227 ~RscSrc();
230 RscInstCopy CreateRscInst( RscTop * pClass );
231 // Instanz loeschen
232 ERRTYPE DeleteRscInst( RscTop * pClass, const RscId & rInstName );
233 // Datenbasis nach Define Veraenderung wiederherstellen
234 //Instanz global zur Verfuegung stellen
235 ERRTYPE SetRscInst( const RscId & rInstName, RscInstCopy & );
236 //Instanz holen
237 RscInst GetRscInst( RscTop* pClass, const RscId & rInstName );
239 // Namen und Identifier Liste fuellen
240 void FillNameIdList( REResourceList * pList );
242 // C++ Resourcekonstruktor schreiben
243 ERRTYPE WriteCxxFile( const ByteString &, const ByteString & rHxxName );
244 ERRTYPE WriteHxxFile( const ByteString & ); // C++ Klasskopf schreiben
247 #endif //_RSCINST_HXX