bump product version to 5.0.4.1
[LibreOffice.git] / rsc / inc / rscdb.hxx
blob7428785fca7b797f1b741e56e744caca6cc3f239
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 INCLUDED_RSC_INC_RSCDB_HXX
21 #define INCLUDED_RSC_INC_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;
39 enum class SymbolType : sal_uInt16;
40 enum class ToolBoxItemBits;
41 enum class WindowBorderStyle : sal_Int16;
42 enum class KeyFuncType : sal_Int32;
43 enum class MenuItemBits : sal_Int16;
44 enum class ToolBoxItemType;
45 enum class ButtonType;
47 struct WriteRcContext
49 FILE * fOutput;
50 OString aOutputRc;
51 OString aOutputSysList;
52 RscCmdLine* pCmdLine;
55 // Liste die alle Basistypen enthaelt
56 typedef ::std::vector< RscTop* > RscBaseList;
58 // Tabelle fuer Systemabhaengige Resourcen
59 struct RscSysEntry
61 sal_uInt32 nKey;
62 sal_uInt32 nRscTyp;
63 OString aFileName;
64 sal_uInt32 nTyp;
65 sal_uInt32 nRefId;
68 typedef ::std::vector< RscSysEntry* > RscSysList;
70 class RscTypCont
72 rtl_TextEncoding nSourceCharSet;
73 sal_uInt32 nMachineId; // Globaler Maschinentyp
74 RSCBYTEORDER_TYPE nByteOrder; // Intel oder
75 OString aLanguage; // output language
76 std::vector< sal_uInt32 > aLangFallbacks; // language fallback list (entry 0 is language itself)
77 OString aSearchPath; // Suchen der Bitmap, Icon, Pointer
78 OString aSysSearchPath; // aSearchPath plus language specific paths
79 sal_uInt32 nUniqueId; // eindeutiger Id fuer Systemresourcen
80 sal_uLong nFilePos; // Position in der Datei ( MTF )
81 sal_uInt32 nPMId; // eindeutiger Id fuer PM-Rseourcefile
82 // muss groesser als RSC_VERSIONCONTROL_ID sein
83 RscTop * pRoot; // Zeiger auf die Wurzel vom Typenbaum
84 RSCINST aVersion; // Versionskontrollinstanz
86 RscBaseList aBaseLst; // Liste der einfachen Resourceklasse
87 RscSysList aSysLst; // Liste der Systemresourcen
89 Atom nWinBitVarId; // Name der Winbitvariablen
90 Atom nBorderId;
91 Atom nHideId;
92 Atom nClipChildrenId;
93 Atom nSizeableId;
94 Atom nMoveableId;
95 Atom nMinimizeId;
96 Atom nMaximizeId;
97 Atom nCloseableId;
98 Atom nStdPopupId;
99 Atom nAppId;
100 Atom nTabstopId;
101 Atom nGroupId;
102 Atom nSysmodalId;
103 Atom nLeftId;
104 Atom nCenterId;
105 Atom nRightId;
106 Atom nTopId;
107 Atom nVCenterId;
108 Atom nBottomId;
109 Atom nHScrollId;
110 Atom nVScrollId;
111 Atom nSortId;
112 Atom nDefaultId;
113 Atom nSVLookId;
114 Atom nRepeatId;
115 Atom nDropDownId;
116 Atom nPassWordId;
117 Atom nReadOnlyId;
118 Atom nAutoSizeId;
119 Atom nSpinId;
120 Atom nTabControlId;
121 Atom nSimpleModeId;
122 Atom nDragId;
123 Atom nScrollId;
124 Atom nZoomableId;
125 Atom nHideWhenDeactivateId;
126 Atom nAutoHScrollId;
127 Atom nAutoVScrollId;
128 Atom nDDExtraWidthId;
129 Atom nWordBreakId;
130 Atom nLeftLabelId;
131 Atom nHasLinesId;
132 Atom nHasButtonsId;
133 Atom nRectStyleId;
134 Atom nLineSpacingId;
135 Atom nSmallStyleId;
136 Atom nEnableResizingId;
137 Atom nDockableId;
138 Atom nScaleId;
139 Atom nIgnoreTabId;
140 Atom nNoSplitDrawId;
141 Atom nTopImageId;
142 Atom nNoLabelId;
143 Atom nVertId;
144 Atom nSysWinId;
146 void Init(); // Initialisiert Klassen und Tabelle
147 void SETCONST( RscConst *, const char *, sal_uInt32 );
148 void SETCONST( RscConst *, Atom, sal_uInt32 );
149 inline void SETCONST( RscConst *p1, const char * p2, SymbolType p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); }
150 inline void SETCONST( RscConst *p1, Atom p2, ToolBoxItemBits p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); }
151 inline void SETCONST( RscConst *p1, Atom p2, WindowBorderStyle p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); }
152 inline void SETCONST( RscConst *p1, const char * p2, KeyFuncType p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); }
153 inline void SETCONST( RscConst *p1, const char * p2, MenuItemBits p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); }
154 inline void SETCONST( RscConst *p1, Atom p2, MenuItemBits p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); }
155 inline void SETCONST( RscConst *p1, const char * p2, ToolBoxItemType p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); }
156 inline void SETCONST( RscConst *p1, Atom p2, ButtonType p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); }
157 inline void SETCONST( RscConst *p1, const char * p2, ButtonType p3 ) { SETCONST(p1, p2, static_cast<sal_uInt32>(p3)); }
158 RscEnum * InitLangType();
159 RscEnum * InitFieldUnitsType();
160 RscEnum * InitColor();
161 RscEnum * InitMapUnit();
162 RscEnum * InitKey();
163 RscEnum * InitTriState();
164 RscTupel * InitGeometry();
165 RscArray * InitLangGeometry( RscTupel * pGeo );
166 RscArray * InitSystemGeometry( RscTupel * pGeo );
167 RscCont * InitStringList();
168 RscArray * InitLangStringList( RscCont * pStrLst );
169 RscTupel * InitStringTupel();
170 RscTupel * InitStringLongTupel();
171 static RscCont * InitStringTupelList( RscTupel * pStringTupel );
172 static RscCont * InitStringLongTupelList( RscTupel * pStringLongTupel );
173 RscArray * InitLangStringTupelList( RscCont * pStrTupelLst );
174 RscArray * InitLangStringLongTupelList( RscCont * pStrLongTupelLst );
176 RscTop * InitClassMgr();
177 RscTop * InitClassString( RscTop * pSuper );
178 RscTop * InitClassBitmap( RscTop * pSuper );
179 RscTop * InitClassColor( RscTop * pSuper, RscEnum * pColor );
180 RscTop * InitClassImage( RscTop * pSuper, RscTop *pClassBitmap,
181 RscTop * pClassColor );
182 RscTop * InitClassImageList( RscTop * pSuper,
183 RscTop * pClassColor, RscCont * pStrLst );
184 RscTop * InitClassWindow( RscTop * pSuper, RscEnum * pMapUnit,
185 RscArray * pLangGeo );
186 RscTop * InitClassSystemWindow( RscTop * pSuper );
187 RscTop * InitClassWorkWindow( RscTop * pSuper );
188 RscTop * InitClassControl( RscTop * pSuper );
189 RscTop * InitClassCheckBox( RscTop * pSuper );
190 RscTop * InitClassPushButton( RscTop * pSuper );
191 RscTop * InitClassImageButton( RscTop * pSuper, RscTop * pClassImage,
192 RscEnum * pTriState );
193 RscTop * InitClassEdit( RscTop * pSuper );
194 RscTop * InitClassScrollBar( RscTop * pSuper );
195 RscTop * InitClassListBox( RscTop * pSuper, RscArray * pStrLst );
196 RscTop * InitClassComboBox( RscTop * pSuper, RscArray * pStrLst );
197 RscTop * InitClassFixedText( RscTop * pSuper );
198 RscTop * InitClassFixedImage( RscTop * pSuper, RscTop * pClassImage );
199 RscTop * InitClassRadioButton( RscTop * pSuper );
200 RscTop * InitClassKeyCode( RscTop * pSuper, RscEnum * pKey );
201 RscTop * InitClassAccelItem( RscTop * pSuper, RscTop * pKeyCode );
202 RscTop * InitClassAccel( RscTop * pSuper, RscTop * pClassAccelItem );
203 RscTop * InitClassMenuItem( RscTop * pSuper, RscTop * pClassBitmap,
204 RscTop * pClassKeyCode );
205 RscTop * InitClassMenu( RscTop * pSuper, RscTop * pMenuItem );
206 RscTop * InitClassSplitWindow( RscTop * pSuper );
208 RscTop * InitClassNumericFormatter( RscTop * pSuper );
209 RscTop * InitClassMetricFormatter( RscTop * pSuper,
210 RscEnum * pFieldUnits );
212 RscTop * InitClassSpinField( RscTop * pSuper );
213 RscTop * InitClassNumericField( RscTop * pSuper );
214 RscTop * InitClassMetricField( RscTop * pSuper );
216 RscTop * InitClassDockingWindow( RscTop * pSuper,
217 RscEnum * pMapUnit );
218 RscTop * InitClassToolBoxItem( RscTop * pSuper, RscTop * pClassBitmap,
219 RscTop * pClassImage,
220 RscEnum * pTriState );
221 RscTop * InitClassToolBox( RscTop * pSuper, RscTop * pClassToolBoxItem,
222 RscTop * pClassImageList );
223 RscTop * InitClassSfxStyleFamilyItem( RscTop * pSuper,
224 RscTop * pClassBitmap,
225 RscTop * pClassImage,
226 RscArray * pStrLst );
227 RscTop * InitClassSfxTemplateDialog( RscTop * pSuper,
228 RscTop * pStyleFamily );
229 RscTop * InitClassSfxSlotInfo( RscTop * pSuper );
231 void InsWinBit( RscTop * pClass, const OString& rName,
232 Atom nVal );
233 void WriteInc( FILE * fOutput, sal_uLong lKey );
235 public:
236 RscBool aBool;
237 RscRange aShort;
238 RscRange aUShort;
239 RscLongRange aLong;
240 RscLongEnumRange aEnumLong;
241 RscIdRange aIdUShort;
242 RscIdRange aIdNoZeroUShort;
243 RscBreakRange aNoZeroShort;
244 RscIdRange aIdLong;
245 RscString aString;
246 RscString aStringLiteral;
247 RscFlag aWinBits;
248 RscLangEnum aLangType;
249 RscLangArray aLangString;
250 RscLangArray aLangShort;
252 Atom nAcceleratorType;
254 RscError* pEH; // Fehlerhandler
255 RscNameTable aNmTb; // Tabelle fuer Namen
256 RscFileTab aFileTab; // Tabelle der Dateinamen
257 sal_uInt32 nFlags;
258 std::map<sal_uInt64, sal_uLong> aIdTranslator; //Ordnet Resourcetypen und Id's einen Id zu
259 //(unter PM), oder eine Dateiposition (MTF)
261 RscTypCont( RscError *, RSCBYTEORDER_TYPE, const OString& rSearchPath, sal_uInt32 nFlags );
262 ~RscTypCont();
264 Atom AddLanguage( const char* );
266 bool IsPreload() const
267 { return (nFlags & PRELOAD_FLAG) != 0; }
268 bool IsSysResTest() const
269 { return (nFlags & NOSYSRESTEST_FLAG) == 0; }
270 bool IsSrsDefault() const
271 { return (nFlags & SRSDEFAULT_FLAG) != 0; }
272 OString ChangeLanguage(const OString & rNewLang);
273 const std::vector< sal_uInt32 >& GetFallbacks() const
274 { return aLangFallbacks; }
276 RSCBYTEORDER_TYPE GetByteOrder() const { return nByteOrder; }
277 rtl_TextEncoding GetSourceCharSet() const { return nSourceCharSet; }
278 rtl_TextEncoding SetSourceCharSet( rtl_TextEncoding aCharSet )
280 rtl_TextEncoding aOld = nSourceCharSet;
281 nSourceCharSet = aCharSet;
282 return aOld;
284 void SetSearchPath( const OString& rStr) { aSearchPath = rStr; }
285 OString GetSearchPath() const { return aSearchPath; }
286 void SetSysSearchPath( const OString& rStr ) { aSysSearchPath = rStr; }
287 void InsertType( RscTop * pType )
289 aBaseLst.push_back( pType );
291 RscTop * SearchType( Atom nTypId );
292 // loescht alle Resourceobjekte diese Datei
293 void Delete( sal_uLong lFileKey );
294 RscTop * GetRoot() { return pRoot; }
295 sal_uInt32 PutSysName( sal_uInt32 nRscTyp, char * pName, sal_uInt32 nConst,
296 sal_uInt32 nId, bool bFirst );
297 void ClearSysNames();
298 ERRTYPE WriteRc( WriteRcContext& rContext );
299 void WriteSrc( FILE * fOutput, sal_uLong nFileIndex,
300 bool bName = true );
301 sal_uInt32 PutTranslatorKey( sal_uInt64 nKey );
302 void IncFilePos( sal_uLong nOffset ){ nFilePos += nOffset; }
305 #endif
307 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */