bump product version to 5.0.4.1
[LibreOffice.git] / rsc / inc / rscconst.hxx
blobc6778f24f1edad7ac9c8d86c1945d126673f7727
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 INCLUDED_RSC_INC_RSCCONST_HXX
20 #define INCLUDED_RSC_INC_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 virtual ~RscConst();
40 virtual RSCCLASS_TYPE GetClassType() const SAL_OVERRIDE;
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 ) SAL_OVERRIDE;
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 ) SAL_OVERRIDE;
61 sal_uInt32 Size() SAL_OVERRIDE { return nSize; }
63 virtual void SetToDefault( const RSCINST & rInst ) SAL_OVERRIDE
65 reinterpret_cast<RscEnumInst*>(rInst.pData)->bDflt = true;
67 bool IsDefault( const RSCINST & rInst ) SAL_OVERRIDE
69 return reinterpret_cast<RscEnumInst*>(rInst.pData)->bDflt;
71 // Als Default setzen
72 bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) SAL_OVERRIDE;
74 ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId,
75 sal_Int32 nValue ) SAL_OVERRIDE;
76 ERRTYPE SetNumber( const RSCINST & rInst, sal_Int32 nValue ) SAL_OVERRIDE;
77 ERRTYPE GetConst( const RSCINST & rInst, Atom * ) SAL_OVERRIDE;
78 ERRTYPE GetNumber( const RSCINST & rInst, sal_Int32 * nValue ) SAL_OVERRIDE;
79 void WriteSrc( const RSCINST &rInst, FILE * fOutput,
80 RscTypCont * pTC, sal_uInt32 nTab, const char * ) SAL_OVERRIDE;
81 ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
82 RscTypCont * pTC, sal_uInt32, bool bExtra ) SAL_OVERRIDE;
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 // INCLUDED_RSC_INC_RSCCONST_HXX
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */