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