bump product version to 4.2.0.1
[LibreOffice.git] / rsc / inc / rscdb.hxx
blob545f328cb46e4267732fb2327dde00171c914f86
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _RSCDB_HXX
21 #define _RSCDB_HXX
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>
32 #include <vector>
33 #include <map>
35 class RscError;
36 class RscTupel;
37 class RscCont;
38 class RscCmdLine;
40 struct WriteRcContext
42 FILE * fOutput;
43 OString aOutputRc;
44 OString aOutputSysList;
45 RscCmdLine* pCmdLine;
48 // Liste die alle Basistypen enthaelt
49 typedef ::std::vector< RscTop* > RscBaseList;
51 // Tabelle fuer Systemabhaengige Resourcen
52 struct RscSysEntry
54 sal_uInt32 nKey;
55 sal_uInt32 nRscTyp;
56 OString aFileName;
57 sal_uInt32 nTyp;
58 sal_uInt32 nRefId;
61 typedef ::std::vector< RscSysEntry* > RscSysList;
63 class RscTypCont
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
79 RscBaseList aBaseLst; // Liste der einfachen Resourceklasse
80 RscSysList aSysLst; // Liste der Systemresourcen
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;
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 );
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 );
208 RscTop * InitClassPatternFormatter( RscTop * pSuper );
209 RscTop * InitClassNumericFormatter( RscTop * pSuper );
210 RscTop * InitClassMetricFormatter( RscTop * pSuper,
211 RscEnum * pFieldUnits );
212 RscTop * InitClassCurrencyFormatter( RscTop * pSuper );
213 RscTop * InitClassDateFormatter( RscTop * pSuper, RscTop * pClassDate );
214 RscTop * InitClassTimeFormatter( RscTop * pSuper, RscTop * pClassTime,
215 RscEnum * pTimeFieldFormat );
217 RscTop * InitClassSpinField( RscTop * pSuper );
218 RscTop * InitClassPatternField( RscTop * pSuper );
219 RscTop * InitClassNumericField( RscTop * pSuper );
220 RscTop * InitClassMetricField( RscTop * pSuper );
221 RscTop * InitClassCurrencyField( const char * pClassName, sal_uInt32 nRT,
222 RscTop * pSuper );
223 RscTop * InitClassDateField( RscTop * pSuper, RscTop * pClassDate );
224 RscTop * InitClassTimeField( RscTop * pSuper, RscTop * pClassTime );
225 RscTop * InitClassPatternBox( RscTop * pSuper );
226 RscTop * InitClassNumericBox( RscTop * pSuper );
227 RscTop * InitClassMetricBox( RscTop * pSuper );
228 RscTop * InitClassCurrencyBox( const char * pClassName, sal_uInt32 nRT,
229 RscTop * pSuper );
230 RscTop * InitClassDateBox( RscTop * pSuper );
231 RscTop * InitClassTimeBox( RscTop * pSuper );
233 RscTop * InitClassDockingWindow( RscTop * pSuper,
234 RscEnum * pMapUnit );
235 RscTop * InitClassToolBoxItem( RscTop * pSuper, RscTop * pClassBitmap,
236 RscTop * pClassImage,
237 RscEnum * pTriState );
238 RscTop * InitClassToolBox( RscTop * pSuper, RscTop * pClassToolBoxItem,
239 RscTop * pClassImageList );
240 RscTop * InitClassStatusBar( RscTop * pSuper );
241 RscTop * InitClassMoreButton( RscTop * pSuper, RscEnum * pMapUnit );
242 RscTop * InitClassFloatingWindow( RscTop * pSuper,
243 RscEnum * pMapUnit );
244 RscTop * InitClassTabControlItem( RscTop * pSuper );
245 RscTop * InitClassTabControl( RscTop * pSuper,
246 RscTop * pClassTabControlItem );
247 RscTop * InitClassSfxStyleFamilyItem( RscTop * pSuper,
248 RscTop * pClassBitmap,
249 RscTop * pClassImage,
250 RscArray * pStrLst );
251 RscTop * InitClassSfxTemplateDialog( RscTop * pSuper,
252 RscTop * pStyleFamily );
253 RscTop * InitClassSfxSlotInfo( RscTop * pSuper );
255 void InsWinBit( RscTop * pClass, const OString& rName,
256 Atom nVal );
257 void WriteInc( FILE * fOutput, sal_uLong lKey );
259 public:
260 RscBool aBool;
261 RscRange aShort;
262 RscRange aUShort;
263 RscLongRange aLong;
264 RscLongEnumRange aEnumLong;
265 RscIdRange aIdUShort;
266 RscIdRange aIdNoZeroUShort;
267 RscBreakRange aNoZeroShort;
268 RscRange a1to12Short;
269 RscRange a0to23Short;
270 RscRange a1to31Short;
271 RscRange a0to59Short;
272 RscRange a0to99Short;
273 RscRange a0to9999Short;
274 RscIdRange aIdLong;
275 RscString aString;
276 RscString aStringLiteral;
277 RscFlag aWinBits;
278 RscLangEnum aLangType;
279 RscLangArray aLangString;
280 RscLangArray aLangShort;
282 Atom nAcceleratorType;
284 RscError* pEH; // Fehlerhandler
285 RscNameTable aNmTb; // Tabelle fuer Namen
286 RscFileTab aFileTab; // Tabelle der Dateinamen
287 sal_uInt32 nFlags;
288 std::map<sal_uInt64, sal_uLong> aIdTranslator; //Ordnet Resourcetypen und Id's einen Id zu
289 //(unter PM), oder eine Dateiposition (MTF)
291 RscTypCont( RscError *, RSCBYTEORDER_TYPE, const OString& rSearchPath, sal_uInt32 nFlags );
292 ~RscTypCont();
294 Atom AddLanguage( const char* );
296 bool IsPreload() const
297 { return (nFlags & PRELOAD_FLAG) ? true : false; }
298 bool IsSysResTest() const
299 { return (nFlags & NOSYSRESTEST_FLAG) ? false : true; }
300 bool IsSrsDefault() const
301 { return (nFlags & SRSDEFAULT_FLAG) ? true : false; }
302 OString ChangeLanguage(const OString & rNewLang);
303 const std::vector< sal_uInt32 >& GetFallbacks() const
304 { return aLangFallbacks; }
306 RSCBYTEORDER_TYPE GetByteOrder() const { return nByteOrder; }
307 rtl_TextEncoding GetSourceCharSet() const { return nSourceCharSet; }
308 rtl_TextEncoding SetSourceCharSet( rtl_TextEncoding aCharSet )
310 rtl_TextEncoding aOld = nSourceCharSet;
311 nSourceCharSet = aCharSet;
312 return aOld;
314 void SetSearchPath( const OString& rStr) { aSearchPath = rStr; }
315 OString GetSearchPath() const { return aSearchPath; }
316 void SetSysSearchPath( const OString& rStr ) { aSysSearchPath = rStr; }
317 void InsertType( RscTop * pType )
319 aBaseLst.push_back( pType );
321 RscTop * SearchType( Atom nTypId );
322 // loescht alle Resourceobjekte diese Datei
323 void Delete( sal_uLong lFileKey );
324 RscTop * GetRoot() { return pRoot; }
325 sal_uInt32 PutSysName( sal_uInt32 nRscTyp, char * pName, sal_uInt32 nConst,
326 sal_uInt32 nId, bool bFirst );
327 void ClearSysNames();
328 ERRTYPE WriteRc( WriteRcContext& rContext );
329 void WriteSrc( FILE * fOutput, sal_uLong nFileIndex,
330 bool bName = true );
331 sal_uInt32 PutTranslatorKey( sal_uInt64 nKey );
332 void IncFilePos( sal_uLong nOffset ){ nFilePos += nOffset; }
335 #endif
337 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */