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 : #ifndef _RSCCONST_HXX
20 : #define _RSCCONST_HXX
21 :
22 : #include <rscall.h>
23 : #include <rscerror.h>
24 : #include <rschash.hxx>
25 : #include <rsctop.hxx>
26 :
27 : /******************* R s c C o n s t *************************************/
28 : class RscConst : public RscTop
29 : {
30 : protected:
31 : struct VarEle {
32 : Atom nId; // Name der Konstante
33 : sal_Int32 lValue; // Wert der Konstante
34 : };
35 : VarEle * pVarArray; // Zeiger auf das Feld mit Konstanten
36 : sal_uInt32 nEntries; // Anzahle der Eintraege im Feld
37 : public:
38 : RscConst( Atom nId, sal_uInt32 nTypId );
39 : ~RscConst();
40 : virtual RSCCLASS_TYPE GetClassType() const;
41 : sal_uInt32 GetEntryCount() const { return nEntries; }
42 : // Die erlaubten Werte werden gesetzt
43 : ERRTYPE SetConstant( Atom nVarName, sal_Int32 lValue );
44 : Atom GetConstant( sal_uInt32 nPos );
45 : sal_Bool GetConstValue( Atom nConstId, sal_Int32 * pVal ) const;
46 : sal_Bool GetValueConst( sal_Int32 nValue, Atom * pConstId ) const;
47 : sal_uInt32 GetConstPos( Atom nConstId );
48 : virtual void WriteSyntax( FILE * fOutput, RscTypCont * pTC );
49 : virtual void WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
50 : const char * );
51 : };
52 :
53 : /******************* R s c E n u m ***************************************/
54 22803 : class RscEnum : public RscConst {
55 : struct RscEnumInst {
56 : sal_uInt32 nValue; // Position der Konstanten im Array
57 : sal_Bool bDflt; // Ist Default
58 : };
59 : sal_uInt32 nSize;
60 : public:
61 : RscEnum( Atom nId, sal_uInt32 nTypId );
62 : RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool );
63 33537 : sal_uInt32 Size(){ return nSize; }
64 :
65 0 : virtual void SetToDefault( const RSCINST & rInst )
66 : {
67 0 : ((RscEnumInst*)rInst.pData)->bDflt = sal_True;
68 0 : }
69 0 : sal_Bool IsDefault( const RSCINST & rInst )
70 : {
71 0 : return( ((RscEnumInst*)rInst.pData)->bDflt );
72 : };
73 : // Als Default setzen
74 : sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
75 :
76 : ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId,
77 : sal_Int32 nValue );
78 : ERRTYPE SetNumber( const RSCINST & rInst, sal_Int32 nValue );
79 : ERRTYPE GetConst( const RSCINST & rInst, Atom * );
80 : ERRTYPE GetNumber( const RSCINST & rInst, sal_Int32 * nValue );
81 : void WriteSrc( const RSCINST &rInst, FILE * fOutput,
82 : RscTypCont * pTC, sal_uInt32 nTab, const char * );
83 : ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
84 : RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
85 : };
86 :
87 : class RscNameTable;
88 :
89 : sal_uInt32 GetLangId( const rtl::OString& rLang);
90 :
91 691 : class RscLangEnum : public RscEnum
92 : {
93 : long mnLangId;
94 : public:
95 : RscLangEnum();
96 :
97 : void Init( RscNameTable& rNames );
98 :
99 : Atom AddLanguage( const char* pLang, RscNameTable& rNames );
100 : };
101 :
102 : #endif // _RSCCONST_HXX
103 :
104 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|