update dev300-m57
[ooovba.git] / rsc / inc / rscdb.hxx
blob2623527c430a338163d6aa5622f1a9541ba47215
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: rscdb.hxx,v $
10 * $Revision: 1.17 $
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 _RSCDB_HXX
32 #define _RSCDB_HXX
34 #include <rscall.h>
35 #include <rsckey.hxx>
36 #include <rscconst.hxx>
37 #include <rscflag.hxx>
38 #include <rscrange.hxx>
39 #include <rscstr.hxx>
40 #include <rscarray.hxx>
41 #include <rscdef.hxx>
43 #include <vector>
44 #include <map>
46 class RscError;
47 class REResourceList;
48 class RscTupel;
49 class RscCont;
50 class RscCmdLine;
52 struct WriteRcContext
54 FILE * fOutput;
55 rtl::OString aOutputRc;
56 rtl::OString aOutputSysList;
57 RscCmdLine* pCmdLine;
60 /****************** R s c T y p C o n ************************************/
61 // Liste die alle Basistypen enthaelt
62 DECLARE_LIST( RscBaseList, RscTop * )
64 // Tabelle fuer Systemabhaengige Resourcen
65 struct RscSysEntry
67 sal_uInt32 nKey;
68 sal_uInt32 nRscTyp;
69 ByteString aFileName;
70 sal_uInt32 nTyp;
71 sal_uInt32 nRefId;
73 DECLARE_LIST( RscSysList, RscSysEntry * )
75 class RscTypCont
77 CharSet nSourceCharSet;
78 sal_uInt32 nMachineId; // Globaler Maschinentyp
79 RSCBYTEORDER_TYPE nByteOrder; // Intel oder
80 ByteString aLanguage; // output language
81 std::vector< sal_uInt32 > aLangFallbacks; // language fallback list (entry 0 is language itself)
82 ByteString aSearchPath; // Suchen der Bitmap, Icon, Pointer
83 ByteString aSysSearchPath; // aSearchPath plus language specific paths
84 sal_uInt32 nUniqueId; // eindeutiger Id fuer Systemresourcen
85 ULONG nFilePos; // Position in der Datei ( MTF )
86 sal_uInt32 nPMId; // eindeutiger Id fuer PM-Rseourcefile
87 // muss groesser als RSC_VERSIONCONTROL_ID sein
88 RscTop * pRoot; // Zeiger auf die Wurzel vom Typenbaum
89 RSCINST aVersion; // Versionskontrollinstanz
91 RscBaseList aBaseLst; // Liste der einfachen Resourceklasse
92 RscSysList aSysLst; // Liste der Systemresourcen
94 Atom nWinBitVarId; // Name der Winbitvariablen
95 Atom nBorderId;
96 Atom nHideId;
97 Atom nClipChildrenId;
98 Atom nSizeableId;
99 Atom nMoveableId;
100 Atom nMinimizeId;
101 Atom nMaximizeId;
102 Atom nCloseableId;
103 Atom nAppId;
104 Atom nTabstopId;
105 Atom nGroupId;
106 Atom nSysmodalId;
107 Atom nLeftId;
108 Atom nCenterId;
109 Atom nRightId;
110 Atom nTopId;
111 Atom nVCenterId;
112 Atom nBottomId;
113 Atom nHScrollId;
114 Atom nVScrollId;
115 Atom nSortId;
116 Atom nDefaultId;
117 Atom nSVLookId;
118 Atom nRepeatId;
119 Atom nDropDownId;
120 Atom nPassWordId;
121 Atom nReadOnlyId;
122 Atom nAutoSizeId;
123 Atom nSpinId;
124 Atom nTabControlId;
125 Atom nSimpleModeId;
126 Atom nDragId;
127 Atom nScrollId;
128 Atom nZoomableId;
129 Atom nHideWhenDeactivateId;
130 Atom nAutoHScrollId;
131 Atom nAutoVScrollId;
132 Atom nDDExtraWidthId;
133 Atom nWordBreakId;
134 Atom nLeftLabelId;
135 Atom nHasLinesId;
136 Atom nHasButtonsId;
137 Atom nRectStyleId;
138 Atom nLineSpacingId;
139 Atom nSmallStyleId;
140 Atom nEnableResizingId;
141 Atom nDockableId;
142 Atom nScaleId;
143 Atom nIgnoreTabId;
144 Atom nNoSplitDrawId;
145 Atom nTopImageId;
146 Atom nNoLabelId;
147 Atom nVertId;
148 Atom nSingleLineId;
149 Atom nSysWinId;
151 void Init(); // Initialisiert Klassen und Tabelle
152 void SETCONST( RscConst *, const char *, UINT32 );
153 void SETCONST( RscConst *, Atom, UINT32 );
154 RscEnum * InitLangType();
155 RscEnum * InitFieldUnitsType();
156 RscEnum * InitTimeFieldFormat();
157 RscEnum * InitColor();
158 RscEnum * InitMapUnit();
159 RscEnum * InitKey();
160 RscEnum * InitTriState();
161 RscEnum * InitMessButtons();
162 RscEnum * InitMessDefButton();
163 RscTupel * InitGeometry();
164 RscArray * InitLangGeometry( RscTupel * pGeo );
165 RscArray * InitSystemGeometry( RscTupel * pGeo );
166 RscCont * InitStringList();
167 RscArray * InitLangStringList( RscCont * pStrLst );
168 RscTupel * InitStringTupel();
169 RscTupel * InitStringLongTupel();
170 RscCont * InitStringTupelList( RscTupel * pStringTupel );
171 RscCont * InitStringLongTupelList( RscTupel * pStringLongTupel );
172 RscArray * InitLangStringTupelList( RscCont * pStrTupelLst );
173 RscArray * InitLangStringLongTupelList( RscCont * pStrLongTupelLst );
175 RscTop * InitClassMgr();
176 RscTop * InitClassString( RscTop * pSuper );
177 RscTop * InitClassBitmap( RscTop * pSuper );
178 RscTop * InitClassColor( RscTop * pSuper, RscEnum * pColor );
179 RscTop * InitClassImage( RscTop * pSuper, RscTop *pClassBitmap,
180 RscTop * pClassColor );
181 RscTop * InitClassImageList( RscTop * pSuper, RscTop *pClassBitmap,
182 RscTop * pClassColor, RscCont * pStrLst );
183 RscTop * InitClassWindow( RscTop * pSuper, RscEnum * pMapUnit,
184 RscArray * pLangGeo );
185 RscTop * InitClassSystemWindow( RscTop * pSuper );
186 RscTop * InitClassWorkWindow( RscTop * pSuper );
187 RscTop * InitClassModalDialog( RscTop * pSuper );
188 RscTop * InitClassModelessDialog( RscTop * pSuper );
189 RscTop * InitClassControl( RscTop * pSuper );
190 RscTop * InitClassCheckBox( RscTop * pSuper );
191 RscTop * InitClassPushButton( RscTop * pSuper );
192 RscTop * InitClassTriStateBox( RscTop * pSuper, RscEnum * pTriState );
193 RscTop * InitClassMenuButton( RscTop * pSuper, RscTop * pClasMenu );
194 RscTop * InitClassImageButton( RscTop * pSuper, RscTop * pClassImage,
195 RscEnum * pTriState );
196 RscTop * InitClassEdit( RscTop * pSuper );
197 RscTop * InitClassMultiLineEdit( RscTop * pSuper );
198 RscTop * InitClassScrollBar( RscTop * pSuper );
199 RscTop * InitClassListBox( RscTop * pSuper, RscArray * pStrLst );
200 RscTop * InitClassMultiListBox( RscTop * pSuper );
201 RscTop * InitClassComboBox( RscTop * pSuper, RscArray * pStrLst );
202 RscTop * InitClassFixedText( RscTop * pSuper );
203 RscTop * InitClassFixedBitmap( RscTop * pSuper, RscTop * pClassBitmap );
204 RscTop * InitClassFixedImage( RscTop * pSuper, RscTop * pClassImage );
205 RscTop * InitClassRadioButton( RscTop * pSuper );
206 RscTop * InitClassImageRadioButton( RscTop * pSuper, RscTop * pClassImage );
207 RscTop * InitClassKeyCode( RscTop * pSuper, RscEnum * pKey );
208 RscTop * InitClassAccelItem( RscTop * pSuper, RscTop * pKeyCode );
209 RscTop * InitClassAccel( RscTop * pSuper, RscTop * pClassAccelItem );
210 RscTop * InitClassMenuItem( RscTop * pSuper, RscTop * pClassBitmap,
211 RscTop * pClassKeyCode );
212 RscTop * InitClassMenu( RscTop * pSuper, RscTop * pMenuItem );
213 RscTop * InitClassMessBox( RscTop * pSuper,
214 RscEnum * pMessButtons,
215 RscEnum * pMessDefButton );
216 RscTop * InitClassSplitter( RscTop * pSuper );
217 RscTop * InitClassSplitWindow( RscTop * pSuper );
218 RscTop * InitClassTime( RscTop * pSuper );
219 RscTop * InitClassDate( RscTop * pSuper );
221 RscTop * InitClassPatternFormatter( RscTop * pSuper );
222 RscTop * InitClassNumericFormatter( RscTop * pSuper );
223 RscTop * InitClassMetricFormatter( RscTop * pSuper,
224 RscEnum * pFieldUnits );
225 RscTop * InitClassCurrencyFormatter( RscTop * pSuper,
226 RscEnum * pFieldUnits );
227 RscTop * InitClassDateFormatter( RscTop * pSuper, RscTop * pClassDate );
228 RscTop * InitClassTimeFormatter( RscTop * pSuper, RscTop * pClassTime,
229 RscEnum * pTimeFieldFormat );
231 RscTop * InitClassSpinField( RscTop * pSuper );
232 RscTop * InitClassPatternField( RscTop * pSuper );
233 RscTop * InitClassNumericField( RscTop * pSuper );
234 RscTop * InitClassMetricField( RscTop * pSuper );
235 RscTop * InitClassCurrencyField( const char * pClassName, sal_uInt32 nRT,
236 RscTop * pSuper );
237 RscTop * InitClassDateField( RscTop * pSuper, RscTop * pClassDate );
238 RscTop * InitClassTimeField( RscTop * pSuper, RscTop * pClassTime );
239 RscTop * InitClassPatternBox( RscTop * pSuper );
240 RscTop * InitClassNumericBox( RscTop * pSuper );
241 RscTop * InitClassMetricBox( RscTop * pSuper );
242 RscTop * InitClassCurrencyBox( const char * pClassName, sal_uInt32 nRT,
243 RscTop * pSuper );
244 RscTop * InitClassDateBox( RscTop * pSuper, RscTop * pClassDate );
245 RscTop * InitClassTimeBox( RscTop * pSuper, RscTop * pClassTime );
247 RscTop * InitClassDockingWindow( RscTop * pSuper,
248 RscEnum * pMapUnit );
249 RscTop * InitClassToolBoxItem( RscTop * pSuper, RscTop * pClassBitmap,
250 RscTop * pClassImage,
251 RscEnum * pTriState );
252 RscTop * InitClassToolBox( RscTop * pSuper, RscTop * pClassToolBoxItem,
253 RscTop * pClassImageList );
254 RscTop * InitClassStatusBar( RscTop * pSuper );
255 RscTop * InitClassMoreButton( RscTop * pSuper, RscEnum * pMapUnit );
256 RscTop * InitClassFloatingWindow( RscTop * pSuper,
257 RscEnum * pMapUnit );
258 RscTop * InitClassTabControlItem( RscTop * pSuper,
259 RscTop * pClassTabPage );
260 RscTop * InitClassTabControl( RscTop * pSuper,
261 RscTop * pClassTabControlItem );
262 RscTop * InitClassSfxStyleFamilyItem( RscTop * pSuper,
263 RscTop * pClassBitmap,
264 RscTop * pClassImage,
265 RscArray * pStrLst );
266 RscTop * InitClassSfxTemplateDialog( RscTop * pSuper,
267 RscTop * pStyleFamily );
268 RscTop * InitClassSfxSlotInfo( RscTop * pSuper );
270 void InsWinBit( RscTop * pClass, const ByteString & rName,
271 Atom nVal );
272 void WriteInc( FILE * fOutput, ULONG lKey );
274 public:
275 RscBool aBool;
276 RscRange aShort;
277 RscRange aUShort;
278 RscLongRange aLong;
279 RscLongEnumRange aEnumLong;
280 RscIdRange aIdUShort;
281 RscIdRange aIdNoZeroUShort;
282 RscBreakRange aNoZeroShort;
283 RscRange a1to12Short;
284 RscRange a0to23Short;
285 RscRange a1to31Short;
286 RscRange a0to59Short;
287 RscRange a0to99Short;
288 RscRange a0to9999Short;
289 RscIdRange aIdLong;
290 RscString aString;
291 RscFlag aWinBits;
292 RscLangEnum aLangType;
293 RscLangArray aLangString;
294 RscLangArray aLangShort;
296 Atom nAcceleratorType;
298 RscError* pEH; // Fehlerhandler
299 RscNameTable aNmTb; // Tabelle fuer Namen
300 RscFileTab aFileTab; // Tabelle der Dateinamen
301 sal_uInt32 nFlags;
302 std::map<sal_uInt64, ULONG> aIdTranslator; //Ordnet Resourcetypen und Id's einen Id zu
303 //(unter PM), oder eine Dateiposition (MTF)
305 RscTypCont( RscError *, RSCBYTEORDER_TYPE, const ByteString & rSearchPath, sal_uInt32 nFlags );
306 ~RscTypCont();
308 Atom AddLanguage( const char* );
310 BOOL IsPreload() const
311 { return (nFlags & PRELOAD_FLAG) ? TRUE : FALSE; }
312 BOOL IsSmart() const
313 { return (nFlags & SMART_FLAG) ? TRUE : FALSE; }
314 BOOL IsSysResTest() const
315 { return (nFlags & NOSYSRESTEST_FLAG) ? FALSE : TRUE; }
316 BOOL IsSrsDefault() const
317 { return (nFlags & SRSDEFAULT_FLAG) ? TRUE : FALSE; }
318 ByteString ChangeLanguage( const ByteString& rNewLang );
319 const std::vector< sal_uInt32 >& GetFallbacks() const
320 { return aLangFallbacks; }
322 RSCBYTEORDER_TYPE GetByteOrder() const { return nByteOrder; }
323 CharSet GetSourceCharSet() const { return nSourceCharSet; }
324 CharSet SetSourceCharSet( CharSet aCharSet )
326 CharSet aOld = nSourceCharSet;
327 nSourceCharSet = aCharSet;
328 return aOld;
330 void SetSearchPath( const ByteString & rStr) { aSearchPath = rStr; }
331 ByteString GetSearchPath() const { return aSearchPath; }
332 void SetSysSearchPath( const ByteString& rStr ) { aSysSearchPath = rStr; }
333 ByteString GetSysSearchPath() const { return aSysSearchPath; }
334 void InsertType( RscTop * pType )
336 aBaseLst.Insert( pType, LIST_APPEND );
338 RscTop * SearchType( Atom nTypId );
339 RscTop * Search( Atom typ );
340 CLASS_DATA Search( Atom typ, const RscId & rId );
341 void Delete( Atom typ, const RscId & rId );
342 // loescht alle Resourceobjekte diese Datei
343 void Delete( ULONG lFileKey );
344 RscTop * GetRoot() { return( pRoot ); };
345 sal_uInt32 PutSysName( sal_uInt32 nRscTyp, char * pName, sal_uInt32 nConst,
346 sal_uInt32 nId, BOOL bFirst );
347 void ClearSysNames();
348 ERRTYPE WriteRc( WriteRcContext& rContext );
349 void WriteSrc( FILE * fOutput, ULONG nFileIndex,
350 CharSet nCharSet, BOOL bName = TRUE );
351 ERRTYPE WriteHxx( FILE * fOutput, ULONG nFileKey);
352 ERRTYPE WriteCxx( FILE * fOutput, ULONG nFileKey,
353 const ByteString & rHxxName );
354 void WriteSyntax( FILE * fOutput );
355 void WriteRcCtor( FILE * fOutput );
356 void FillNameIdList( REResourceList * pList, ULONG lFileKey );
357 BOOL MakeConsistent( RscInconsList * pList );
358 sal_uInt32 PutTranslatorKey( sal_uInt64 nKey );
359 void IncFilePos( ULONG nOffset ){ nFilePos += nOffset; }
362 #endif