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