Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_RSC_INC_RSCCONST_HXX
20 : #define INCLUDED_RSC_INC_RSCCONST_HXX
21 :
22 : #include <rscall.h>
23 : #include <rscerror.h>
24 : #include <rschash.hxx>
25 : #include <rsctop.hxx>
26 :
27 : class RscConst : public RscTop
28 : {
29 : protected:
30 : struct VarEle
31 : {
32 : Atom nId; // Name der Konstante
33 : sal_Int32 lValue; // Wert der Konstante
34 : };
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 );
48 : };
49 :
50 11259 : class RscEnum : public RscConst
51 : {
52 : struct RscEnumInst
53 : {
54 : sal_uInt32 nValue; // Position der Konstanten im Array
55 : bool bDflt; // Ist Default
56 : };
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 13344 : sal_uInt32 Size() SAL_OVERRIDE { return nSize; }
62 :
63 0 : virtual void SetToDefault( const RSCINST & rInst ) SAL_OVERRIDE
64 : {
65 0 : reinterpret_cast<RscEnumInst*>(rInst.pData)->bDflt = true;
66 0 : }
67 0 : bool IsDefault( const RSCINST & rInst ) SAL_OVERRIDE
68 : {
69 0 : return reinterpret_cast<RscEnumInst*>(rInst.pData)->bDflt;
70 : };
71 : // Als Default setzen
72 : bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) SAL_OVERRIDE;
73 :
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;
83 : };
84 :
85 : class RscNameTable;
86 :
87 : sal_uInt32 GetLangId( const OString& rLang);
88 :
89 417 : class RscLangEnum : public RscEnum
90 : {
91 : long mnLangId;
92 : public:
93 : RscLangEnum();
94 :
95 : void Init( RscNameTable& rNames );
96 :
97 : Atom AddLanguage( const char* pLang, RscNameTable& rNames );
98 : };
99 :
100 : #endif // INCLUDED_RSC_INC_RSCCONST_HXX
101 :
102 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|