update dev300-m58
[ooovba.git] / rsc / inc / rscflag.hxx
blob934e78b008a8ade2272bf959dc89052ba21699a3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: rscflag.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _RSCFLAG_HXX
31 #define _RSCFLAG_HXX
33 #include <rscall.h>
34 #include <rscerror.h>
35 #include <rschash.hxx>
36 #include <rscconst.hxx>
38 /******************* R s c F l a g ***************************************/
39 class RscFlag : public RscConst {
40 struct RscFlagInst{
41 sal_uInt32 nFlags;
42 sal_uInt32 nDfltFlags;
44 RSCINST CreateBasic( RSCINST * pInst );
45 public:
46 RscFlag( Atom nId, sal_uInt32 nTypId );
47 RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, BOOL );
48 RSCINST CreateClient( RSCINST * pInst, const RSCINST & rDflt,
49 BOOL bOwnClass, Atom nConsId );
50 sal_uInt32 Size();
52 virtual void SetToDefault( const RSCINST & rInst );
53 BOOL IsDefault( const RSCINST & rInst );
54 BOOL IsDefault( const RSCINST & rInst, Atom nConstId );
56 // Ist das Flag gesetzt
57 BOOL IsSet( const RSCINST & rInst, Atom nConstId );
59 // Als Default setzen
60 BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
61 BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef,
62 Atom nConstId );
64 ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId,
65 INT32 nValue );
66 ERRTYPE SetNotConst( const RSCINST & rInst, Atom nConstId );
67 void WriteSrc( const RSCINST & rInst, FILE * fOutput,
68 RscTypCont * pTC, sal_uInt32 nTab, const char * );
69 ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
70 RscTypCont * pTC, sal_uInt32, BOOL bExtra );
73 /******************* R s c C l i e n t ***********************************/
74 class RscClient : public RscTop
76 RscFlag * pRefClass; //Klasse die als Server benutzt wird
77 Atom nConstId; //Id des zu setzenden Wertes
78 public:
79 RscClient( Atom nId, sal_uInt32 nTypId, RscFlag * pClass,
80 Atom nConstantId );
81 virtual RSCCLASS_TYPE GetClassType() const;
82 RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, BOOL );
83 sal_uInt32 Size(){ return( pRefClass->Size() ); };
85 // Eine Zuweisung an eine Variable
86 BOOL IsDefault( const RSCINST & rInst ){
87 return( pRefClass->IsDefault( rInst, nConstId ) );
89 // Als Default setzen
90 BOOL IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){
91 return pRefClass->IsValueDefault( rInst,
92 pDef, nConstId );
94 ERRTYPE SetBool( const RSCINST & rInst, BOOL bValue ){
95 if( bValue )
96 return( pRefClass->SetConst( rInst, nConstId, bValue ) );
97 else
98 return( pRefClass->
99 SetNotConst( rInst, nConstId ) );
101 ERRTYPE GetBool( const RSCINST & rInst, BOOL * pB ){
102 *pB = pRefClass->IsSet( rInst, nConstId );
103 return( ERR_OK );
105 void WriteSrc( const RSCINST & rInst, FILE * fOutput,
106 RscTypCont * pTC, sal_uInt32 nTab, const char * );
109 #endif // _RSCFLAG_HXX