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