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 INCLUDED_RSC_INC_RSCDB_HXX
21 : #define INCLUDED_RSC_INC_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 : enum class SymbolType : sal_uInt16;
40 : enum class ToolBoxItemBits;
41 : enum class WindowBorderStyle : sal_Int16;
42 : enum class TimeFieldFormat : sal_Int32;
43 : enum class KeyFuncType : sal_Int32;
44 : enum class MenuItemBits : sal_Int16;
45 :
46 112 : struct WriteRcContext
47 : {
48 : FILE * fOutput;
49 : OString aOutputRc;
50 : OString aOutputSysList;
51 : RscCmdLine* pCmdLine;
52 : };
53 :
54 : // Liste die alle Basistypen enthaelt
55 : typedef ::std::vector< RscTop* > RscBaseList;
56 :
57 : // Tabelle fuer Systemabhaengige Resourcen
58 1898 : struct RscSysEntry
59 : {
60 : sal_uInt32 nKey;
61 : sal_uInt32 nRscTyp;
62 : OString aFileName;
63 : sal_uInt32 nTyp;
64 : sal_uInt32 nRefId;
65 : };
66 :
67 : typedef ::std::vector< RscSysEntry* > RscSysList;
68 :
69 : class RscTypCont
70 : {
71 : rtl_TextEncoding nSourceCharSet;
72 : sal_uInt32 nMachineId; // Globaler Maschinentyp
73 : RSCBYTEORDER_TYPE nByteOrder; // Intel oder
74 : OString aLanguage; // output language
75 : std::vector< sal_uInt32 > aLangFallbacks; // language fallback list (entry 0 is language itself)
76 : OString aSearchPath; // Suchen der Bitmap, Icon, Pointer
77 : OString aSysSearchPath; // aSearchPath plus language specific paths
78 : sal_uInt32 nUniqueId; // eindeutiger Id fuer Systemresourcen
79 : sal_uLong nFilePos; // Position in der Datei ( MTF )
80 : sal_uInt32 nPMId; // eindeutiger Id fuer PM-Rseourcefile
81 : // muss groesser als RSC_VERSIONCONTROL_ID sein
82 : RscTop * pRoot; // Zeiger auf die Wurzel vom Typenbaum
83 : RSCINST aVersion; // Versionskontrollinstanz
84 :
85 : RscBaseList aBaseLst; // Liste der einfachen Resourceklasse
86 : RscSysList aSysLst; // Liste der Systemresourcen
87 :
88 : Atom nWinBitVarId; // Name der Winbitvariablen
89 : Atom nBorderId;
90 : Atom nHideId;
91 : Atom nClipChildrenId;
92 : Atom nSizeableId;
93 : Atom nMoveableId;
94 : Atom nMinimizeId;
95 : Atom nMaximizeId;
96 : Atom nCloseableId;
97 : Atom nStdPopupId;
98 : Atom nAppId;
99 : Atom nTabstopId;
100 : Atom nGroupId;
101 : Atom nSysmodalId;
102 : Atom nLeftId;
103 : Atom nCenterId;
104 : Atom nRightId;
105 : Atom nTopId;
106 : Atom nVCenterId;
107 : Atom nBottomId;
108 : Atom nHScrollId;
109 : Atom nVScrollId;
110 : Atom nSortId;
111 : Atom nDefaultId;
112 : Atom nSVLookId;
113 : Atom nRepeatId;
114 : Atom nDropDownId;
115 : Atom nPassWordId;
116 : Atom nReadOnlyId;
117 : Atom nAutoSizeId;
118 : Atom nSpinId;
119 : Atom nTabControlId;
120 : Atom nSimpleModeId;
121 : Atom nDragId;
122 : Atom nScrollId;
123 : Atom nZoomableId;
124 : Atom nHideWhenDeactivateId;
125 : Atom nAutoHScrollId;
126 : Atom nAutoVScrollId;
127 : Atom nDDExtraWidthId;
128 : Atom nWordBreakId;
129 : Atom nLeftLabelId;
130 : Atom nHasLinesId;
131 : Atom nHasButtonsId;
132 : Atom nRectStyleId;
133 : Atom nLineSpacingId;
134 : Atom nSmallStyleId;
135 : Atom nEnableResizingId;
136 : Atom nDockableId;
137 : Atom nScaleId;
138 : Atom nIgnoreTabId;
139 : Atom nNoSplitDrawId;
140 : Atom nTopImageId;
141 : Atom nNoLabelId;
142 : Atom nVertId;
143 : Atom nSysWinId;
144 :
145 : void Init(); // Initialisiert Klassen und Tabelle
146 : void SETCONST( RscConst *, const char *, sal_uInt32 );
147 : void SETCONST( RscConst *, Atom, sal_uInt32 );
148 10056 : inline void SETCONST( RscConst *p1, const char * p2, SymbolType p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); }
149 2514 : inline void SETCONST( RscConst *p1, Atom p2, ToolBoxItemBits p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); }
150 1676 : inline void SETCONST( RscConst *p1, Atom p2, WindowBorderStyle p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); }
151 7961 : inline void SETCONST( RscConst *p1, const char * p2, KeyFuncType p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); }
152 : inline void SETCONST( RscConst *p1, Atom p2, TimeFieldFormat p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); }
153 1257 : inline void SETCONST( RscConst *p1, const char * p2, TimeFieldFormat p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); }
154 : inline void SETCONST( RscConst *p1, const char * p2, MenuItemBits p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); }
155 2095 : inline void SETCONST( RscConst *p1, Atom p2, MenuItemBits p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); }
156 : RscEnum * InitLangType();
157 : RscEnum * InitFieldUnitsType();
158 : RscEnum * InitTimeFieldFormat();
159 : RscEnum * InitColor();
160 : RscEnum * InitMapUnit();
161 : RscEnum * InitKey();
162 : RscEnum * InitTriState();
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 );
174 :
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,
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 * InitClassControl( RscTop * pSuper );
188 : RscTop * InitClassCheckBox( RscTop * pSuper );
189 : RscTop * InitClassPushButton( RscTop * pSuper );
190 : RscTop * InitClassImageButton( RscTop * pSuper, RscTop * pClassImage,
191 : RscEnum * pTriState );
192 : RscTop * InitClassEdit( RscTop * pSuper );
193 : RscTop * InitClassScrollBar( RscTop * pSuper );
194 : RscTop * InitClassListBox( RscTop * pSuper, RscArray * pStrLst );
195 : RscTop * InitClassComboBox( RscTop * pSuper, RscArray * pStrLst );
196 : RscTop * InitClassFixedText( RscTop * pSuper );
197 : RscTop * InitClassFixedImage( RscTop * pSuper, RscTop * pClassImage );
198 : RscTop * InitClassRadioButton( RscTop * pSuper );
199 : RscTop * InitClassKeyCode( RscTop * pSuper, RscEnum * pKey );
200 : RscTop * InitClassAccelItem( RscTop * pSuper, RscTop * pKeyCode );
201 : RscTop * InitClassAccel( RscTop * pSuper, RscTop * pClassAccelItem );
202 : RscTop * InitClassMenuItem( RscTop * pSuper, RscTop * pClassBitmap,
203 : RscTop * pClassKeyCode );
204 : RscTop * InitClassMenu( RscTop * pSuper, RscTop * pMenuItem );
205 : RscTop * InitClassSplitter( RscTop * pSuper );
206 : RscTop * InitClassSplitWindow( RscTop * pSuper );
207 : RscTop * InitClassTime( RscTop * pSuper );
208 : RscTop * InitClassDate( RscTop * pSuper );
209 :
210 : RscTop * InitClassNumericFormatter( RscTop * pSuper );
211 : RscTop * InitClassMetricFormatter( RscTop * pSuper,
212 : RscEnum * pFieldUnits );
213 : RscTop * InitClassDateFormatter( RscTop * pSuper, RscTop * pClassDate );
214 : RscTop * InitClassTimeFormatter( RscTop * pSuper, RscTop * pClassTime,
215 : RscEnum * pTimeFieldFormat );
216 :
217 : RscTop * InitClassSpinField( 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 :
223 : RscTop * InitClassDockingWindow( RscTop * pSuper,
224 : RscEnum * pMapUnit );
225 : RscTop * InitClassToolBoxItem( RscTop * pSuper, RscTop * pClassBitmap,
226 : RscTop * pClassImage,
227 : RscEnum * pTriState );
228 : RscTop * InitClassToolBox( RscTop * pSuper, RscTop * pClassToolBoxItem,
229 : RscTop * pClassImageList );
230 : RscTop * InitClassSfxStyleFamilyItem( RscTop * pSuper,
231 : RscTop * pClassBitmap,
232 : RscTop * pClassImage,
233 : RscArray * pStrLst );
234 : RscTop * InitClassSfxTemplateDialog( RscTop * pSuper,
235 : RscTop * pStyleFamily );
236 : RscTop * InitClassSfxSlotInfo( RscTop * pSuper );
237 :
238 : void InsWinBit( RscTop * pClass, const OString& rName,
239 : Atom nVal );
240 : void WriteInc( FILE * fOutput, sal_uLong lKey );
241 :
242 : public:
243 : RscBool aBool;
244 : RscRange aShort;
245 : RscRange aUShort;
246 : RscLongRange aLong;
247 : RscLongEnumRange aEnumLong;
248 : RscIdRange aIdUShort;
249 : RscIdRange aIdNoZeroUShort;
250 : RscBreakRange aNoZeroShort;
251 : RscRange a1to12Short;
252 : RscRange a0to23Short;
253 : RscRange a1to31Short;
254 : RscRange a0to59Short;
255 : RscRange a0to99Short;
256 : RscRange a0to9999Short;
257 : RscIdRange aIdLong;
258 : RscString aString;
259 : RscString aStringLiteral;
260 : RscFlag aWinBits;
261 : RscLangEnum aLangType;
262 : RscLangArray aLangString;
263 : RscLangArray aLangShort;
264 :
265 : Atom nAcceleratorType;
266 :
267 : RscError* pEH; // Fehlerhandler
268 : RscNameTable aNmTb; // Tabelle fuer Namen
269 : RscFileTab aFileTab; // Tabelle der Dateinamen
270 : sal_uInt32 nFlags;
271 : std::map<sal_uInt64, sal_uLong> aIdTranslator; //Ordnet Resourcetypen und Id's einen Id zu
272 : //(unter PM), oder eine Dateiposition (MTF)
273 :
274 : RscTypCont( RscError *, RSCBYTEORDER_TYPE, const OString& rSearchPath, sal_uInt32 nFlags );
275 : ~RscTypCont();
276 :
277 : Atom AddLanguage( const char* );
278 :
279 : bool IsPreload() const
280 : { return (nFlags & PRELOAD_FLAG) ? true : false; }
281 : bool IsSysResTest() const
282 : { return (nFlags & NOSYSRESTEST_FLAG) ? false : true; }
283 38272 : bool IsSrsDefault() const
284 38272 : { return (nFlags & SRSDEFAULT_FLAG) ? true : false; }
285 : OString ChangeLanguage(const OString & rNewLang);
286 31782 : const std::vector< sal_uInt32 >& GetFallbacks() const
287 31782 : { return aLangFallbacks; }
288 :
289 9533 : RSCBYTEORDER_TYPE GetByteOrder() const { return nByteOrder; }
290 25982 : rtl_TextEncoding GetSourceCharSet() const { return nSourceCharSet; }
291 56 : rtl_TextEncoding SetSourceCharSet( rtl_TextEncoding aCharSet )
292 : {
293 56 : rtl_TextEncoding aOld = nSourceCharSet;
294 56 : nSourceCharSet = aCharSet;
295 56 : return aOld;
296 : }
297 : void SetSearchPath( const OString& rStr) { aSearchPath = rStr; }
298 56 : OString GetSearchPath() const { return aSearchPath; }
299 56 : void SetSysSearchPath( const OString& rStr ) { aSysSearchPath = rStr; }
300 0 : void InsertType( RscTop * pType )
301 : {
302 0 : aBaseLst.push_back( pType );
303 0 : }
304 : RscTop * SearchType( Atom nTypId );
305 : // loescht alle Resourceobjekte diese Datei
306 : void Delete( sal_uLong lFileKey );
307 0 : RscTop * GetRoot() { return pRoot; }
308 : sal_uInt32 PutSysName( sal_uInt32 nRscTyp, char * pName, sal_uInt32 nConst,
309 : sal_uInt32 nId, bool bFirst );
310 : void ClearSysNames();
311 : ERRTYPE WriteRc( WriteRcContext& rContext );
312 : void WriteSrc( FILE * fOutput, sal_uLong nFileIndex,
313 : bool bName = true );
314 : sal_uInt32 PutTranslatorKey( sal_uInt64 nKey );
315 9589 : void IncFilePos( sal_uLong nOffset ){ nFilePos += nOffset; }
316 : };
317 :
318 : #endif
319 :
320 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|