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 0 : 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 0 : 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 * InitClassKeyCode( RscTop * pSuper, RscEnum * pKey );
195 : RscTop * InitClassAccelItem( RscTop * pSuper, RscTop * pKeyCode );
196 : RscTop * InitClassAccel( RscTop * pSuper, RscTop * pClassAccelItem );
197 : RscTop * InitClassMenuItem( RscTop * pSuper, RscTop * pClassBitmap,
198 : RscTop * pClassKeyCode );
199 : RscTop * InitClassMenu( RscTop * pSuper, RscTop * pMenuItem );
200 : RscTop * InitClassMessBox( RscTop * pSuper,
201 : RscEnum * pMessButtons,
202 : RscEnum * pMessDefButton );
203 : RscTop * InitClassSplitter( RscTop * pSuper );
204 : RscTop * InitClassSplitWindow( RscTop * pSuper );
205 : RscTop * InitClassTime( RscTop * pSuper );
206 : RscTop * InitClassDate( RscTop * pSuper );
207 :
208 : RscTop * InitClassPatternFormatter( RscTop * pSuper );
209 : RscTop * InitClassNumericFormatter( RscTop * pSuper );
210 : RscTop * InitClassMetricFormatter( RscTop * pSuper,
211 : RscEnum * pFieldUnits );
212 : RscTop * InitClassDateFormatter( RscTop * pSuper, RscTop * pClassDate );
213 : RscTop * InitClassTimeFormatter( RscTop * pSuper, RscTop * pClassTime,
214 : RscEnum * pTimeFieldFormat );
215 :
216 : RscTop * InitClassSpinField( RscTop * pSuper );
217 : RscTop * InitClassPatternField( RscTop * pSuper );
218 : RscTop * InitClassNumericField( RscTop * pSuper );
219 : RscTop * InitClassMetricField( RscTop * pSuper );
220 : RscTop * InitClassDateField( RscTop * pSuper, RscTop * pClassDate );
221 : RscTop * InitClassTimeField( RscTop * pSuper, RscTop * pClassTime );
222 : RscTop * InitClassPatternBox( RscTop * pSuper );
223 : RscTop * InitClassNumericBox( RscTop * pSuper );
224 :
225 : RscTop * InitClassDockingWindow( RscTop * pSuper,
226 : RscEnum * pMapUnit );
227 : RscTop * InitClassToolBoxItem( RscTop * pSuper, RscTop * pClassBitmap,
228 : RscTop * pClassImage,
229 : RscEnum * pTriState );
230 : RscTop * InitClassToolBox( RscTop * pSuper, RscTop * pClassToolBoxItem,
231 : RscTop * pClassImageList );
232 : RscTop * InitClassStatusBar( RscTop * pSuper );
233 : RscTop * InitClassFloatingWindow( RscTop * pSuper,
234 : RscEnum * pMapUnit );
235 : RscTop * InitClassTabControlItem( RscTop * pSuper );
236 : RscTop * InitClassTabControl( RscTop * pSuper,
237 : RscTop * pClassTabControlItem );
238 : RscTop * InitClassSfxStyleFamilyItem( RscTop * pSuper,
239 : RscTop * pClassBitmap,
240 : RscTop * pClassImage,
241 : RscArray * pStrLst );
242 : RscTop * InitClassSfxTemplateDialog( RscTop * pSuper,
243 : RscTop * pStyleFamily );
244 : RscTop * InitClassSfxSlotInfo( RscTop * pSuper );
245 :
246 : void InsWinBit( RscTop * pClass, const OString& rName,
247 : Atom nVal );
248 : void WriteInc( FILE * fOutput, sal_uLong lKey );
249 :
250 : public:
251 : RscBool aBool;
252 : RscRange aShort;
253 : RscRange aUShort;
254 : RscLongRange aLong;
255 : RscLongEnumRange aEnumLong;
256 : RscIdRange aIdUShort;
257 : RscIdRange aIdNoZeroUShort;
258 : RscBreakRange aNoZeroShort;
259 : RscRange a1to12Short;
260 : RscRange a0to23Short;
261 : RscRange a1to31Short;
262 : RscRange a0to59Short;
263 : RscRange a0to99Short;
264 : RscRange a0to9999Short;
265 : RscIdRange aIdLong;
266 : RscString aString;
267 : RscString aStringLiteral;
268 : RscFlag aWinBits;
269 : RscLangEnum aLangType;
270 : RscLangArray aLangString;
271 : RscLangArray aLangShort;
272 :
273 : Atom nAcceleratorType;
274 :
275 : RscError* pEH; // Fehlerhandler
276 : RscNameTable aNmTb; // Tabelle fuer Namen
277 : RscFileTab aFileTab; // Tabelle der Dateinamen
278 : sal_uInt32 nFlags;
279 : std::map<sal_uInt64, sal_uLong> aIdTranslator; //Ordnet Resourcetypen und Id's einen Id zu
280 : //(unter PM), oder eine Dateiposition (MTF)
281 :
282 : RscTypCont( RscError *, RSCBYTEORDER_TYPE, const OString& rSearchPath, sal_uInt32 nFlags );
283 : ~RscTypCont();
284 :
285 : Atom AddLanguage( const char* );
286 :
287 : bool IsPreload() const
288 : { return (nFlags & PRELOAD_FLAG) ? true : false; }
289 : bool IsSysResTest() const
290 : { return (nFlags & NOSYSRESTEST_FLAG) ? false : true; }
291 0 : bool IsSrsDefault() const
292 0 : { return (nFlags & SRSDEFAULT_FLAG) ? true : false; }
293 : OString ChangeLanguage(const OString & rNewLang);
294 0 : const std::vector< sal_uInt32 >& GetFallbacks() const
295 0 : { return aLangFallbacks; }
296 :
297 0 : RSCBYTEORDER_TYPE GetByteOrder() const { return nByteOrder; }
298 0 : rtl_TextEncoding GetSourceCharSet() const { return nSourceCharSet; }
299 0 : rtl_TextEncoding SetSourceCharSet( rtl_TextEncoding aCharSet )
300 : {
301 0 : rtl_TextEncoding aOld = nSourceCharSet;
302 0 : nSourceCharSet = aCharSet;
303 0 : return aOld;
304 : }
305 : void SetSearchPath( const OString& rStr) { aSearchPath = rStr; }
306 0 : OString GetSearchPath() const { return aSearchPath; }
307 0 : void SetSysSearchPath( const OString& rStr ) { aSysSearchPath = rStr; }
308 0 : void InsertType( RscTop * pType )
309 : {
310 0 : aBaseLst.push_back( pType );
311 0 : }
312 : RscTop * SearchType( Atom nTypId );
313 : // loescht alle Resourceobjekte diese Datei
314 : void Delete( sal_uLong lFileKey );
315 0 : RscTop * GetRoot() { return pRoot; }
316 : sal_uInt32 PutSysName( sal_uInt32 nRscTyp, char * pName, sal_uInt32 nConst,
317 : sal_uInt32 nId, bool bFirst );
318 : void ClearSysNames();
319 : ERRTYPE WriteRc( WriteRcContext& rContext );
320 : void WriteSrc( FILE * fOutput, sal_uLong nFileIndex,
321 : bool bName = true );
322 : sal_uInt32 PutTranslatorKey( sal_uInt64 nKey );
323 0 : void IncFilePos( sal_uLong nOffset ){ nFilePos += nOffset; }
324 : };
325 :
326 : #endif
327 :
328 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|