1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: rscdb.hxx,v $
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 ************************************************************************/
36 #include <rscconst.hxx>
37 #include <rscflag.hxx>
38 #include <rscrange.hxx>
40 #include <rscarray.hxx>
55 rtl::OString aOutputRc
;
56 rtl::OString aOutputSysList
;
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
73 DECLARE_LIST( RscSysList
, RscSysEntry
* )
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
129 Atom nHideWhenDeactivateId
;
132 Atom nDDExtraWidthId
;
140 Atom nEnableResizingId
;
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();
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
,
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
,
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
,
272 void WriteInc( FILE * fOutput
, ULONG lKey
);
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
;
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
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
);
308 Atom
AddLanguage( const char* );
310 BOOL
IsPreload() const
311 { return (nFlags
& PRELOAD_FLAG
) ? TRUE
: FALSE
; }
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
;
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
; }