merged tag ooo/DEV300_m102
[LibreOffice.git] / rsc / inc / rscconst.hxx
bloba48ec3c05ab32cd83f542a494acf052e9bf4f4ee
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
27 #ifndef _RSCCONST_HXX
28 #define _RSCCONST_HXX
30 #include <rscall.h>
31 #include <rscerror.h>
32 #include <rschash.hxx>
33 #include <rsctop.hxx>
35 /******************* R s c C o n s t *************************************/
36 class RscConst : public RscTop
38 protected:
39 struct VarEle {
40 Atom nId; // Name der Konstante
41 sal_Int32 lValue; // Wert der Konstante
43 VarEle * pVarArray; // Zeiger auf das Feld mit Konstanten
44 sal_uInt32 nEntries; // Anzahle der Eintraege im Feld
45 public:
46 RscConst( Atom nId, sal_uInt32 nTypId );
47 ~RscConst();
48 virtual RSCCLASS_TYPE GetClassType() const;
49 sal_uInt32 GetEntryCount() const { return nEntries; }
50 // Die erlaubten Werte werden gesetzt
51 ERRTYPE SetConstant( Atom nVarName, sal_Int32 lValue );
52 Atom GetConstant( sal_uInt32 nPos );
53 sal_Bool GetConstValue( Atom nConstId, sal_Int32 * pVal ) const;
54 sal_Bool GetValueConst( sal_Int32 nValue, Atom * pConstId ) const;
55 sal_uInt32 GetConstPos( Atom nConstId );
56 virtual void WriteSyntax( FILE * fOutput, RscTypCont * pTC );
57 virtual void WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
58 const char * );
61 /******************* R s c E n u m ***************************************/
62 class RscEnum : public RscConst {
63 struct RscEnumInst {
64 sal_uInt32 nValue; // Position der Konstanten im Array
65 sal_Bool bDflt; // Ist Default
67 sal_uInt32 nSize;
68 public:
69 RscEnum( Atom nId, sal_uInt32 nTypId );
70 RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool );
71 sal_uInt32 Size(){ return nSize; }
73 virtual void SetToDefault( const RSCINST & rInst )
75 ((RscEnumInst*)rInst.pData)->bDflt = sal_True;
77 sal_Bool IsDefault( const RSCINST & rInst )
79 return( ((RscEnumInst*)rInst.pData)->bDflt );
81 // Als Default setzen
82 sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
84 ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId,
85 sal_Int32 nValue );
86 ERRTYPE SetNumber( const RSCINST & rInst, sal_Int32 nValue );
87 ERRTYPE GetConst( const RSCINST & rInst, Atom * );
88 ERRTYPE GetNumber( const RSCINST & rInst, sal_Int32 * nValue );
89 void WriteSrc( const RSCINST &rInst, FILE * fOutput,
90 RscTypCont * pTC, sal_uInt32 nTab, const char * );
91 ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
92 RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
95 class RscNameTable;
97 sal_uInt32 GetLangId( const ByteString& alang);
99 class RscLangEnum : public RscEnum
101 long mnLangId;
102 public:
103 RscLangEnum();
105 void Init( RscNameTable& rNames );
107 Atom AddLanguage( const char* pLang, RscNameTable& rNames );
110 #endif // _RSCCONST_HXX