Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #ifndef _RSCDB_HXX
21 : : #define _RSCDB_HXX
22 : :
23 : : #include <rscall.h>
24 : : #include <rsckey.hxx>
25 : : #include <rscconst.hxx>
26 : : #include <rscflag.hxx>
27 : : #include <rscrange.hxx>
28 : : #include <rscstr.hxx>
29 : : #include <rscarray.hxx>
30 : : #include <rscdef.hxx>
31 : : #include <tools/string.hxx>
32 : :
33 : : #include <vector>
34 : : #include <map>
35 : :
36 : : class RscError;
37 : : class RscTupel;
38 : : class RscCont;
39 : : class RscCmdLine;
40 : :
41 : 120 : struct WriteRcContext
42 : : {
43 : : FILE * fOutput;
44 : : rtl::OString aOutputRc;
45 : : rtl::OString aOutputSysList;
46 : : RscCmdLine* pCmdLine;
47 : : };
48 : :
49 : : /****************** R s c T y p C o n ************************************/
50 : : // Liste die alle Basistypen enthaelt
51 : : typedef ::std::vector< RscTop* > RscBaseList;
52 : :
53 : : // Tabelle fuer Systemabhaengige Resourcen
54 : 3204 : struct RscSysEntry
55 : : {
56 : : sal_uInt32 nKey;
57 : : sal_uInt32 nRscTyp;
58 : : rtl::OString aFileName;
59 : : sal_uInt32 nTyp;
60 : : sal_uInt32 nRefId;
61 : : };
62 : :
63 : : typedef ::std::vector< RscSysEntry* > RscSysList;
64 : :
65 : : class RscTypCont
66 : : {
67 : : CharSet nSourceCharSet;
68 : : sal_uInt32 nMachineId; // Globaler Maschinentyp
69 : : RSCBYTEORDER_TYPE nByteOrder; // Intel oder
70 : : rtl::OString aLanguage; // output language
71 : : std::vector< sal_uInt32 > aLangFallbacks; // language fallback list (entry 0 is language itself)
72 : : rtl::OString aSearchPath; // Suchen der Bitmap, Icon, Pointer
73 : : rtl::OString aSysSearchPath; // aSearchPath plus language specific paths
74 : : sal_uInt32 nUniqueId; // eindeutiger Id fuer Systemresourcen
75 : : sal_uLong nFilePos; // Position in der Datei ( MTF )
76 : : sal_uInt32 nPMId; // eindeutiger Id fuer PM-Rseourcefile
77 : : // muss groesser als RSC_VERSIONCONTROL_ID sein
78 : : RscTop * pRoot; // Zeiger auf die Wurzel vom Typenbaum
79 : : RSCINST aVersion; // Versionskontrollinstanz
80 : :
81 : : RscBaseList aBaseLst; // Liste der einfachen Resourceklasse
82 : : RscSysList aSysLst; // Liste der Systemresourcen
83 : :
84 : : Atom nWinBitVarId; // Name der Winbitvariablen
85 : : Atom nBorderId;
86 : : Atom nHideId;
87 : : Atom nClipChildrenId;
88 : : Atom nSizeableId;
89 : : Atom nMoveableId;
90 : : Atom nMinimizeId;
91 : : Atom nMaximizeId;
92 : : Atom nCloseableId;
93 : : Atom nStdPopupId;
94 : : Atom nAppId;
95 : : Atom nTabstopId;
96 : : Atom nGroupId;
97 : : Atom nSysmodalId;
98 : : Atom nLeftId;
99 : : Atom nCenterId;
100 : : Atom nRightId;
101 : : Atom nTopId;
102 : : Atom nVCenterId;
103 : : Atom nBottomId;
104 : : Atom nHScrollId;
105 : : Atom nVScrollId;
106 : : Atom nSortId;
107 : : Atom nDefaultId;
108 : : Atom nSVLookId;
109 : : Atom nRepeatId;
110 : : Atom nDropDownId;
111 : : Atom nPassWordId;
112 : : Atom nReadOnlyId;
113 : : Atom nAutoSizeId;
114 : : Atom nSpinId;
115 : : Atom nTabControlId;
116 : : Atom nSimpleModeId;
117 : : Atom nDragId;
118 : : Atom nScrollId;
119 : : Atom nZoomableId;
120 : : Atom nHideWhenDeactivateId;
121 : : Atom nAutoHScrollId;
122 : : Atom nAutoVScrollId;
123 : : Atom nDDExtraWidthId;
124 : : Atom nWordBreakId;
125 : : Atom nLeftLabelId;
126 : : Atom nHasLinesId;
127 : : Atom nHasButtonsId;
128 : : Atom nRectStyleId;
129 : : Atom nLineSpacingId;
130 : : Atom nSmallStyleId;
131 : : Atom nEnableResizingId;
132 : : Atom nDockableId;
133 : : Atom nScaleId;
134 : : Atom nIgnoreTabId;
135 : : Atom nNoSplitDrawId;
136 : : Atom nTopImageId;
137 : : Atom nNoLabelId;
138 : : Atom nVertId;
139 : : Atom nSysWinId;
140 : :
141 : : void Init(); // Initialisiert Klassen und Tabelle
142 : : void SETCONST( RscConst *, const char *, sal_uInt32 );
143 : : void SETCONST( RscConst *, Atom, sal_uInt32 );
144 : : RscEnum * InitLangType();
145 : : RscEnum * InitFieldUnitsType();
146 : : RscEnum * InitTimeFieldFormat();
147 : : RscEnum * InitColor();
148 : : RscEnum * InitMapUnit();
149 : : RscEnum * InitKey();
150 : : RscEnum * InitTriState();
151 : : RscEnum * InitMessButtons();
152 : : RscEnum * InitMessDefButton();
153 : : RscTupel * InitGeometry();
154 : : RscArray * InitLangGeometry( RscTupel * pGeo );
155 : : RscArray * InitSystemGeometry( RscTupel * pGeo );
156 : : RscCont * InitStringList();
157 : : RscArray * InitLangStringList( RscCont * pStrLst );
158 : : RscTupel * InitStringTupel();
159 : : RscTupel * InitStringLongTupel();
160 : : RscCont * InitStringTupelList( RscTupel * pStringTupel );
161 : : RscCont * InitStringLongTupelList( RscTupel * pStringLongTupel );
162 : : RscArray * InitLangStringTupelList( RscCont * pStrTupelLst );
163 : : RscArray * InitLangStringLongTupelList( RscCont * pStrLongTupelLst );
164 : :
165 : : RscTop * InitClassMgr();
166 : : RscTop * InitClassString( RscTop * pSuper );
167 : : RscTop * InitClassBitmap( RscTop * pSuper );
168 : : RscTop * InitClassColor( RscTop * pSuper, RscEnum * pColor );
169 : : RscTop * InitClassImage( RscTop * pSuper, RscTop *pClassBitmap,
170 : : RscTop * pClassColor );
171 : : RscTop * InitClassImageList( RscTop * pSuper,
172 : : RscTop * pClassColor, RscCont * pStrLst );
173 : : RscTop * InitClassWindow( RscTop * pSuper, RscEnum * pMapUnit,
174 : : RscArray * pLangGeo );
175 : : RscTop * InitClassSystemWindow( RscTop * pSuper );
176 : : RscTop * InitClassWorkWindow( RscTop * pSuper );
177 : : RscTop * InitClassModalDialog( RscTop * pSuper );
178 : : RscTop * InitClassModelessDialog( RscTop * pSuper );
179 : : RscTop * InitClassControl( RscTop * pSuper );
180 : : RscTop * InitClassCheckBox( RscTop * pSuper );
181 : : RscTop * InitClassPushButton( RscTop * pSuper );
182 : : RscTop * InitClassTriStateBox( RscTop * pSuper, RscEnum * pTriState );
183 : : RscTop * InitClassMenuButton( RscTop * pSuper, RscTop * pClasMenu );
184 : : RscTop * InitClassImageButton( RscTop * pSuper, RscTop * pClassImage,
185 : : RscEnum * pTriState );
186 : : RscTop * InitClassEdit( RscTop * pSuper );
187 : : RscTop * InitClassMultiLineEdit( RscTop * pSuper );
188 : : RscTop * InitClassScrollBar( RscTop * pSuper );
189 : : RscTop * InitClassListBox( RscTop * pSuper, RscArray * pStrLst );
190 : : RscTop * InitClassMultiListBox( RscTop * pSuper );
191 : : RscTop * InitClassComboBox( RscTop * pSuper, RscArray * pStrLst );
192 : : RscTop * InitClassFixedText( RscTop * pSuper );
193 : : RscTop * InitClassFixedBitmap( RscTop * pSuper, RscTop * pClassBitmap );
194 : : RscTop * InitClassFixedImage( RscTop * pSuper, RscTop * pClassImage );
195 : : RscTop * InitClassRadioButton( RscTop * pSuper );
196 : : RscTop * InitClassImageRadioButton( RscTop * pSuper, RscTop * pClassImage );
197 : : RscTop * InitClassKeyCode( RscTop * pSuper, RscEnum * pKey );
198 : : RscTop * InitClassAccelItem( RscTop * pSuper, RscTop * pKeyCode );
199 : : RscTop * InitClassAccel( RscTop * pSuper, RscTop * pClassAccelItem );
200 : : RscTop * InitClassMenuItem( RscTop * pSuper, RscTop * pClassBitmap,
201 : : RscTop * pClassKeyCode );
202 : : RscTop * InitClassMenu( RscTop * pSuper, RscTop * pMenuItem );
203 : : RscTop * InitClassMessBox( RscTop * pSuper,
204 : : RscEnum * pMessButtons,
205 : : RscEnum * pMessDefButton );
206 : : RscTop * InitClassSplitter( RscTop * pSuper );
207 : : RscTop * InitClassSplitWindow( RscTop * pSuper );
208 : : RscTop * InitClassTime( RscTop * pSuper );
209 : : RscTop * InitClassDate( RscTop * pSuper );
210 : :
211 : : RscTop * InitClassPatternFormatter( RscTop * pSuper );
212 : : RscTop * InitClassNumericFormatter( RscTop * pSuper );
213 : : RscTop * InitClassMetricFormatter( RscTop * pSuper,
214 : : RscEnum * pFieldUnits );
215 : : RscTop * InitClassCurrencyFormatter( RscTop * pSuper );
216 : : RscTop * InitClassDateFormatter( RscTop * pSuper, RscTop * pClassDate );
217 : : RscTop * InitClassTimeFormatter( RscTop * pSuper, RscTop * pClassTime,
218 : : RscEnum * pTimeFieldFormat );
219 : :
220 : : RscTop * InitClassSpinField( RscTop * pSuper );
221 : : RscTop * InitClassPatternField( RscTop * pSuper );
222 : : RscTop * InitClassNumericField( RscTop * pSuper );
223 : : RscTop * InitClassMetricField( RscTop * pSuper );
224 : : RscTop * InitClassCurrencyField( const char * pClassName, sal_uInt32 nRT,
225 : : RscTop * pSuper );
226 : : RscTop * InitClassDateField( RscTop * pSuper, RscTop * pClassDate );
227 : : RscTop * InitClassTimeField( RscTop * pSuper, RscTop * pClassTime );
228 : : RscTop * InitClassPatternBox( RscTop * pSuper );
229 : : RscTop * InitClassNumericBox( RscTop * pSuper );
230 : : RscTop * InitClassMetricBox( RscTop * pSuper );
231 : : RscTop * InitClassCurrencyBox( const char * pClassName, sal_uInt32 nRT,
232 : : RscTop * pSuper );
233 : : RscTop * InitClassDateBox( RscTop * pSuper );
234 : : RscTop * InitClassTimeBox( RscTop * pSuper );
235 : :
236 : : RscTop * InitClassDockingWindow( RscTop * pSuper,
237 : : RscEnum * pMapUnit );
238 : : RscTop * InitClassToolBoxItem( RscTop * pSuper, RscTop * pClassBitmap,
239 : : RscTop * pClassImage,
240 : : RscEnum * pTriState );
241 : : RscTop * InitClassToolBox( RscTop * pSuper, RscTop * pClassToolBoxItem,
242 : : RscTop * pClassImageList );
243 : : RscTop * InitClassStatusBar( RscTop * pSuper );
244 : : RscTop * InitClassMoreButton( RscTop * pSuper, RscEnum * pMapUnit );
245 : : RscTop * InitClassFloatingWindow( RscTop * pSuper,
246 : : RscEnum * pMapUnit );
247 : : RscTop * InitClassTabControlItem( RscTop * pSuper );
248 : : RscTop * InitClassTabControl( RscTop * pSuper,
249 : : RscTop * pClassTabControlItem );
250 : : RscTop * InitClassSfxStyleFamilyItem( RscTop * pSuper,
251 : : RscTop * pClassBitmap,
252 : : RscTop * pClassImage,
253 : : RscArray * pStrLst );
254 : : RscTop * InitClassSfxTemplateDialog( RscTop * pSuper,
255 : : RscTop * pStyleFamily );
256 : : RscTop * InitClassSfxSlotInfo( RscTop * pSuper );
257 : :
258 : : void InsWinBit( RscTop * pClass, const rtl::OString& rName,
259 : : Atom nVal );
260 : : void WriteInc( FILE * fOutput, sal_uLong lKey );
261 : :
262 : : public:
263 : : RscBool aBool;
264 : : RscRange aShort;
265 : : RscRange aUShort;
266 : : RscLongRange aLong;
267 : : RscLongEnumRange aEnumLong;
268 : : RscIdRange aIdUShort;
269 : : RscIdRange aIdNoZeroUShort;
270 : : RscBreakRange aNoZeroShort;
271 : : RscRange a1to12Short;
272 : : RscRange a0to23Short;
273 : : RscRange a1to31Short;
274 : : RscRange a0to59Short;
275 : : RscRange a0to99Short;
276 : : RscRange a0to9999Short;
277 : : RscIdRange aIdLong;
278 : : RscString aString;
279 : : RscString aStringLiteral;
280 : : RscFlag aWinBits;
281 : : RscLangEnum aLangType;
282 : : RscLangArray aLangString;
283 : : RscLangArray aLangShort;
284 : :
285 : : Atom nAcceleratorType;
286 : :
287 : : RscError* pEH; // Fehlerhandler
288 : : RscNameTable aNmTb; // Tabelle fuer Namen
289 : : RscFileTab aFileTab; // Tabelle der Dateinamen
290 : : sal_uInt32 nFlags;
291 : : std::map<sal_uInt64, sal_uLong> aIdTranslator; //Ordnet Resourcetypen und Id's einen Id zu
292 : : //(unter PM), oder eine Dateiposition (MTF)
293 : :
294 : : RscTypCont( RscError *, RSCBYTEORDER_TYPE, const rtl::OString& rSearchPath, sal_uInt32 nFlags );
295 : : ~RscTypCont();
296 : :
297 : : Atom AddLanguage( const char* );
298 : :
299 : : sal_Bool IsPreload() const
300 : : { return (nFlags & PRELOAD_FLAG) ? sal_True : sal_False; }
301 : 0 : sal_Bool IsSmart() const
302 [ # # ]: 0 : { return (nFlags & SMART_FLAG) ? sal_True : sal_False; }
303 : : sal_Bool IsSysResTest() const
304 : : { return (nFlags & NOSYSRESTEST_FLAG) ? sal_False : sal_True; }
305 : 97024 : sal_Bool IsSrsDefault() const
306 [ - + ]: 97024 : { return (nFlags & SRSDEFAULT_FLAG) ? sal_True : sal_False; }
307 : : rtl::OString ChangeLanguage(const rtl::OString & rNewLang);
308 : 86124 : const std::vector< sal_uInt32 >& GetFallbacks() const
309 : 86124 : { return aLangFallbacks; }
310 : :
311 : 18372 : RSCBYTEORDER_TYPE GetByteOrder() const { return nByteOrder; }
312 : 73494 : CharSet GetSourceCharSet() const { return nSourceCharSet; }
313 : 60 : CharSet SetSourceCharSet( CharSet aCharSet )
314 : : {
315 : 60 : CharSet aOld = nSourceCharSet;
316 : 60 : nSourceCharSet = aCharSet;
317 : 60 : return aOld;
318 : : }
319 : : void SetSearchPath( const rtl::OString& rStr) { aSearchPath = rStr; }
320 : 60 : rtl::OString GetSearchPath() const { return aSearchPath; }
321 : 60 : void SetSysSearchPath( const rtl::OString& rStr ) { aSysSearchPath = rStr; }
322 : 0 : void InsertType( RscTop * pType )
323 : : {
324 : 0 : aBaseLst.push_back( pType );
325 : 0 : }
326 : : RscTop * SearchType( Atom nTypId );
327 : : // loescht alle Resourceobjekte diese Datei
328 : : void Delete( sal_uLong lFileKey );
329 : 0 : RscTop * GetRoot() { return( pRoot ); };
330 : : sal_uInt32 PutSysName( sal_uInt32 nRscTyp, char * pName, sal_uInt32 nConst,
331 : : sal_uInt32 nId, sal_Bool bFirst );
332 : : void ClearSysNames();
333 : : ERRTYPE WriteRc( WriteRcContext& rContext );
334 : : void WriteSrc( FILE * fOutput, sal_uLong nFileIndex,
335 : : sal_Bool bName = sal_True );
336 : : ERRTYPE WriteHxx( FILE * fOutput, sal_uLong nFileKey);
337 : : ERRTYPE WriteCxx( FILE * fOutput, sal_uLong nFileKey,
338 : : const rtl::OString& rHxxName );
339 : : void WriteSyntax( FILE * fOutput );
340 : : void WriteRcCtor( FILE * fOutput );
341 : : sal_uInt32 PutTranslatorKey( sal_uInt64 nKey );
342 : 18492 : void IncFilePos( sal_uLong nOffset ){ nFilePos += nOffset; }
343 : : };
344 : :
345 : : #endif
346 : :
347 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|