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 _RSCFLAG_HXX
20 : #define _RSCFLAG_HXX
21 :
22 : #include <rscall.h>
23 : #include <rscerror.h>
24 : #include <rschash.hxx>
25 : #include <rscconst.hxx>
26 :
27 : /******************* R s c F l a g ***************************************/
28 0 : class RscFlag : public RscConst
29 : {
30 : struct RscFlagInst
31 : {
32 : sal_uInt32 nFlags;
33 : sal_uInt32 nDfltFlags;
34 : };
35 : RSCINST CreateBasic( RSCINST * pInst );
36 : public:
37 : RscFlag( Atom nId, sal_uInt32 nTypId );
38 : RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, bool ) SAL_OVERRIDE;
39 : RSCINST CreateClient( RSCINST * pInst, const RSCINST & rDflt,
40 : bool bOwnClass, Atom nConsId );
41 : sal_uInt32 Size() SAL_OVERRIDE;
42 :
43 : virtual void SetToDefault( const RSCINST & rInst ) SAL_OVERRIDE;
44 : bool IsDefault( const RSCINST & rInst ) SAL_OVERRIDE;
45 : bool IsDefault( const RSCINST & rInst, Atom nConstId );
46 :
47 : // Ist das Flag gesetzt
48 : bool IsSet( const RSCINST & rInst, Atom nConstId );
49 :
50 : // Als Default setzen
51 : bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) SAL_OVERRIDE;
52 : bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef,
53 : Atom nConstId );
54 :
55 : ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId,
56 : sal_Int32 nValue ) SAL_OVERRIDE;
57 : ERRTYPE SetNotConst( const RSCINST & rInst, Atom nConstId ) SAL_OVERRIDE;
58 : void WriteSrc( const RSCINST & rInst, FILE * fOutput,
59 : RscTypCont * pTC, sal_uInt32 nTab, const char * ) SAL_OVERRIDE;
60 : ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
61 : RscTypCont * pTC, sal_uInt32, bool bExtra ) SAL_OVERRIDE;
62 : };
63 :
64 : /******************* R s c C l i e n t ***********************************/
65 0 : class RscClient : public RscTop
66 : {
67 : RscFlag * pRefClass; //Klasse die als Server benutzt wird
68 : Atom nConstId; //Id des zu setzenden Wertes
69 : public:
70 : RscClient( Atom nId, sal_uInt32 nTypId, RscFlag * pClass,
71 : Atom nConstantId );
72 : virtual RSCCLASS_TYPE GetClassType() const SAL_OVERRIDE;
73 : RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, bool ) SAL_OVERRIDE;
74 0 : sal_uInt32 Size() SAL_OVERRIDE { return( pRefClass->Size() ); };
75 :
76 : // Eine Zuweisung an eine Variable
77 0 : bool IsDefault( const RSCINST & rInst ) SAL_OVERRIDE {
78 0 : return( pRefClass->IsDefault( rInst, nConstId ) );
79 : };
80 : // Als Default setzen
81 0 : bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ) SAL_OVERRIDE
82 : {
83 : return pRefClass->IsValueDefault( rInst,
84 0 : pDef, nConstId );
85 : }
86 0 : ERRTYPE SetBool( const RSCINST & rInst, bool bValue ) SAL_OVERRIDE
87 : {
88 0 : if( bValue )
89 0 : return( pRefClass->SetConst( rInst, nConstId, sal_Int32(bValue) ) );
90 : else
91 : return( pRefClass->
92 0 : SetNotConst( rInst, nConstId ) );
93 : }
94 0 : ERRTYPE GetBool( const RSCINST & rInst, bool * pB ) SAL_OVERRIDE
95 : {
96 0 : *pB = pRefClass->IsSet( rInst, nConstId );
97 0 : return( ERR_OK );
98 : }
99 : void WriteSrc( const RSCINST & rInst, FILE * fOutput,
100 : RscTypCont * pTC, sal_uInt32 nTab, const char * ) SAL_OVERRIDE;
101 : };
102 :
103 : #endif // _RSCFLAG_HXX
104 :
105 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|