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 ************************************************************************/
32 #include <rschash.hxx>
35 /******************* R s c C o n s t *************************************/
36 class RscConst
: public RscTop
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
46 RscConst( Atom nId
, sal_uInt32 nTypId
);
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
,
61 /******************* R s c E n u m ***************************************/
62 class RscEnum
: public RscConst
{
64 sal_uInt32 nValue
; // Position der Konstanten im Array
65 sal_Bool bDflt
; // Ist Default
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
);
82 sal_Bool
IsValueDefault( const RSCINST
& rInst
, CLASS_DATA pDef
);
84 ERRTYPE
SetConst( const RSCINST
& rInst
, Atom nValueId
,
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
);
97 sal_uInt32
GetLangId( const ByteString
& alang
);
99 class RscLangEnum
: public RscEnum
105 void Init( RscNameTable
& rNames
);
107 Atom
AddLanguage( const char* pLang
, RscNameTable
& rNames
);
110 #endif // _RSCCONST_HXX