bump product version to 4.2.0.1
[LibreOffice.git] / rsc / inc / rscconst.hxx
blob1e48f27bfcce020b593a8ff9f5d659f90d3730cc
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
32 Atom nId; // Name der Konstante
33 sal_Int32 lValue; // Wert der Konstante
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 bool GetConstValue( Atom nConstId, sal_Int32 * pVal ) const;
46 bool GetValueConst( sal_Int32 nValue, Atom * pConstId ) const;
47 sal_uInt32 GetConstPos( Atom nConstId );
50 class RscEnum : public RscConst
52 struct RscEnumInst
54 sal_uInt32 nValue; // Position der Konstanten im Array
55 bool bDflt; // Ist Default
57 sal_uInt32 nSize;
58 public:
59 RscEnum( Atom nId, sal_uInt32 nTypId );
60 RSCINST Create( RSCINST * pInst, const RSCINST & rDfltInst, bool );
61 sal_uInt32 Size(){ return nSize; }
63 virtual void SetToDefault( const RSCINST & rInst )
65 ((RscEnumInst*)rInst.pData)->bDflt = true;
67 bool IsDefault( const RSCINST & rInst )
69 return( ((RscEnumInst*)rInst.pData)->bDflt );
71 // Als Default setzen
72 bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
74 ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId,
75 sal_Int32 nValue );
76 ERRTYPE SetNumber( const RSCINST & rInst, sal_Int32 nValue );
77 ERRTYPE GetConst( const RSCINST & rInst, Atom * );
78 ERRTYPE GetNumber( const RSCINST & rInst, sal_Int32 * nValue );
79 void WriteSrc( const RSCINST &rInst, FILE * fOutput,
80 RscTypCont * pTC, sal_uInt32 nTab, const char * );
81 ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
82 RscTypCont * pTC, sal_uInt32, bool bExtra );
85 class RscNameTable;
87 sal_uInt32 GetLangId( const OString& rLang);
89 class RscLangEnum : public RscEnum
91 long mnLangId;
92 public:
93 RscLangEnum();
95 void Init( RscNameTable& rNames );
97 Atom AddLanguage( const char* pLang, RscNameTable& rNames );
100 #endif // _RSCCONST_HXX
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */