bump product version to 4.1.6.2
[LibreOffice.git] / rsc / inc / rscconst.hxx
blob3cba043db1fca356ad6bc2729ab46c478466108f
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 .
19 #ifndef _RSCCONST_HXX
20 #define _RSCCONST_HXX
22 #include <rscall.h>
23 #include <rscerror.h>
24 #include <rschash.hxx>
25 #include <rsctop.hxx>
27 class RscConst : public RscTop
29 protected:
30 struct VarEle {
31 Atom nId; // Name der Konstante
32 sal_Int32 lValue; // Wert der Konstante
34 VarEle * pVarArray; // Zeiger auf das Feld mit Konstanten
35 sal_uInt32 nEntries; // Anzahle der Eintraege im Feld
36 public:
37 RscConst( Atom nId, sal_uInt32 nTypId );
38 ~RscConst();
39 virtual RSCCLASS_TYPE GetClassType() const;
40 sal_uInt32 GetEntryCount() const { return nEntries; }
41 // Die erlaubten Werte werden gesetzt
42 ERRTYPE SetConstant( Atom nVarName, sal_Int32 lValue );
43 Atom GetConstant( sal_uInt32 nPos );
44 sal_Bool GetConstValue( Atom nConstId, sal_Int32 * pVal ) const;
45 sal_Bool GetValueConst( sal_Int32 nValue, Atom * pConstId ) const;
46 sal_uInt32 GetConstPos( Atom nConstId );
49 class RscEnum : public RscConst {
50 struct RscEnumInst {
51 sal_uInt32 nValue; // Position der Konstanten im Array
52 sal_Bool bDflt; // Ist Default
54 sal_uInt32 nSize;
55 public:
56 RscEnum( Atom nId, sal_uInt32 nTypId );
57 RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, sal_Bool );
58 sal_uInt32 Size(){ return nSize; }
60 virtual void SetToDefault( const RSCINST & rInst )
62 ((RscEnumInst*)rInst.pData)->bDflt = sal_True;
64 sal_Bool IsDefault( const RSCINST & rInst )
66 return( ((RscEnumInst*)rInst.pData)->bDflt );
68 // Als Default setzen
69 sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
71 ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId,
72 sal_Int32 nValue );
73 ERRTYPE SetNumber( const RSCINST & rInst, sal_Int32 nValue );
74 ERRTYPE GetConst( const RSCINST & rInst, Atom * );
75 ERRTYPE GetNumber( const RSCINST & rInst, sal_Int32 * nValue );
76 void WriteSrc( const RSCINST &rInst, FILE * fOutput,
77 RscTypCont * pTC, sal_uInt32 nTab, const char * );
78 ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
79 RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
82 class RscNameTable;
84 sal_uInt32 GetLangId( const OString& rLang);
86 class RscLangEnum : public RscEnum
88 long mnLangId;
89 public:
90 RscLangEnum();
92 void Init( RscNameTable& rNames );
94 Atom AddLanguage( const char* pLang, RscNameTable& rNames );
97 #endif // _RSCCONST_HXX
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */