Update ooo320-m1
[ooovba.git] / rsc / inc / rscconst.hxx
blob496020c2e010516f0f39c24f6b9d164c4c41e700
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: rscconst.hxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _RSCCONST_HXX
31 #define _RSCCONST_HXX
33 #include <rscall.h>
34 #include <rscerror.h>
35 #include <rschash.hxx>
36 #include <rsctop.hxx>
38 /******************* R s c C o n s t *************************************/
39 class RscConst : public RscTop
41 protected:
42 struct VarEle {
43 Atom nId; // Name der Konstante
44 INT32 lValue; // Wert der Konstante
46 VarEle * pVarArray; // Zeiger auf das Feld mit Konstanten
47 sal_uInt32 nEntries; // Anzahle der Eintraege im Feld
48 public:
49 RscConst( Atom nId, sal_uInt32 nTypId );
50 ~RscConst();
51 virtual RSCCLASS_TYPE GetClassType() const;
52 sal_uInt32 GetEntryCount() const { return nEntries; }
53 // Die erlaubten Werte werden gesetzt
54 ERRTYPE SetConstant( Atom nVarName, INT32 lValue );
55 Atom GetConstant( sal_uInt32 nPos );
56 BOOL GetConstValue( Atom nConstId, INT32 * pVal ) const;
57 BOOL GetValueConst( INT32 nValue, Atom * pConstId ) const;
58 sal_uInt32 GetConstPos( Atom nConstId );
59 virtual void WriteSyntax( FILE * fOutput, RscTypCont * pTC );
60 virtual void WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
61 const char * );
64 /******************* R s c E n u m ***************************************/
65 class RscEnum : public RscConst {
66 struct RscEnumInst {
67 sal_uInt32 nValue; // Position der Konstanten im Array
68 BOOL bDflt; // Ist Default
70 sal_uInt32 nSize;
71 public:
72 RscEnum( Atom nId, sal_uInt32 nTypId );
73 RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, BOOL );
74 sal_uInt32 Size(){ return nSize; }
76 virtual void SetToDefault( const RSCINST & rInst )
78 ((RscEnumInst*)rInst.pData)->bDflt = TRUE;
80 BOOL IsDefault( const RSCINST & rInst )
82 return( ((RscEnumInst*)rInst.pData)->bDflt );
84 // Als Default setzen
85 BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
87 ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId,
88 INT32 nValue );
89 ERRTYPE SetNumber( const RSCINST & rInst, INT32 nValue );
90 ERRTYPE GetConst( const RSCINST & rInst, Atom * );
91 ERRTYPE GetNumber( const RSCINST & rInst, INT32 * nValue );
92 void WriteSrc( const RSCINST &rInst, FILE * fOutput,
93 RscTypCont * pTC, sal_uInt32 nTab, const char * );
94 ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
95 RscTypCont * pTC, sal_uInt32, BOOL bExtra );
98 class RscNameTable;
100 sal_uInt32 GetLangId( const ByteString& alang);
102 class RscLangEnum : public RscEnum
104 long mnLangId;
105 public:
106 RscLangEnum();
108 void Init( RscNameTable& rNames );
110 Atom AddLanguage( const char* pLang, RscNameTable& rNames );
113 #endif // _RSCCONST_HXX