1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _RSCFLAG_HXX 24 #define _RSCFLAG_HXX 25 26 #include <rscall.h> 27 #include <rscerror.h> 28 #include <rschash.hxx> 29 #include <rscconst.hxx> 30 31 /******************* R s c F l a g ***************************************/ 32 class RscFlag : public RscConst { 33 struct RscFlagInst{ 34 sal_uInt32 nFlags; 35 sal_uInt32 nDfltFlags; 36 }; 37 RSCINST CreateBasic( RSCINST * pInst ); 38 public: 39 RscFlag( Atom nId, sal_uInt32 nTypId ); 40 RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool ); 41 RSCINST CreateClient( RSCINST * pInst, const RSCINST & rDflt, 42 sal_Bool bOwnClass, Atom nConsId ); 43 sal_uInt32 Size(); 44 45 virtual void SetToDefault( const RSCINST & rInst ); 46 sal_Bool IsDefault( const RSCINST & rInst ); 47 sal_Bool IsDefault( const RSCINST & rInst, Atom nConstId ); 48 49 // Ist das Flag gesetzt 50 sal_Bool IsSet( const RSCINST & rInst, Atom nConstId ); 51 52 // Als Default setzen 53 sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ); 54 sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef, 55 Atom nConstId ); 56 57 ERRTYPE SetConst( const RSCINST & rInst, Atom nValueId, 58 sal_Int32 nValue ); 59 ERRTYPE SetNotConst( const RSCINST & rInst, Atom nConstId ); 60 void WriteSrc( const RSCINST & rInst, FILE * fOutput, 61 RscTypCont * pTC, sal_uInt32 nTab, const char * ); 62 ERRTYPE WriteRc( const RSCINST & rInst, RscWriteRc & aMem, 63 RscTypCont * pTC, sal_uInt32, sal_Bool bExtra ); 64 }; 65 66 /******************* R s c C l i e n t ***********************************/ 67 class RscClient : public RscTop 68 { 69 RscFlag * pRefClass; //Klasse die als Server benutzt wird 70 Atom nConstId; //Id des zu setzenden Wertes 71 public: 72 RscClient( Atom nId, sal_uInt32 nTypId, RscFlag * pClass, 73 Atom nConstantId ); 74 virtual RSCCLASS_TYPE GetClassType() const; 75 RSCINST Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool ); Size()76 sal_uInt32 Size(){ return( pRefClass->Size() ); }; 77 78 // Eine Zuweisung an eine Variable IsDefault(const RSCINST & rInst)79 sal_Bool IsDefault( const RSCINST & rInst ){ 80 return( pRefClass->IsDefault( rInst, nConstId ) ); 81 }; 82 // Als Default setzen IsValueDefault(const RSCINST & rInst,CLASS_DATA pDef)83 sal_Bool IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef ){ 84 return pRefClass->IsValueDefault( rInst, 85 pDef, nConstId ); 86 } SetBool(const RSCINST & rInst,sal_Bool bValue)87 ERRTYPE SetBool( const RSCINST & rInst, sal_Bool bValue ){ 88 if( bValue ) 89 return( pRefClass->SetConst( rInst, nConstId, bValue ) ); 90 else 91 return( pRefClass-> 92 SetNotConst( rInst, nConstId ) ); 93 }; GetBool(const RSCINST & rInst,sal_Bool * pB)94 ERRTYPE GetBool( const RSCINST & rInst, sal_Bool * pB ){ 95 *pB = pRefClass->IsSet( rInst, nConstId ); 96 return( ERR_OK ); 97 }; 98 void WriteSrc( const RSCINST & rInst, FILE * fOutput, 99 RscTypCont * pTC, sal_uInt32 nTab, const char * ); 100 }; 101 102 #endif // _RSCFLAG_HXX 103