xref: /aoo42x/main/rsc/source/res/rscflag.cxx (revision 477794c1)
1*477794c1SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*477794c1SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*477794c1SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*477794c1SAndrew Rist  * distributed with this work for additional information
6*477794c1SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*477794c1SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*477794c1SAndrew Rist  * "License"); you may not use this file except in compliance
9*477794c1SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*477794c1SAndrew Rist  *
11*477794c1SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*477794c1SAndrew Rist  *
13*477794c1SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*477794c1SAndrew Rist  * software distributed under the License is distributed on an
15*477794c1SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*477794c1SAndrew Rist  * KIND, either express or implied.  See the License for the
17*477794c1SAndrew Rist  * specific language governing permissions and limitations
18*477794c1SAndrew Rist  * under the License.
19*477794c1SAndrew Rist  *
20*477794c1SAndrew Rist  *************************************************************/
21*477794c1SAndrew Rist 
22*477794c1SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_rsc.hxx"
26cdf0e10cSrcweir /****************** I N C L U D E S **************************************/
27cdf0e10cSrcweir 
28cdf0e10cSrcweir // C and C++ Includes.
29cdf0e10cSrcweir #include <stdlib.h>
30cdf0e10cSrcweir #include <stdio.h>
31cdf0e10cSrcweir #include <string.h>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <rscflag.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir /****************** C O D E **********************************************/
36cdf0e10cSrcweir /****************** R s c F l a g ****************************************/
37cdf0e10cSrcweir /*************************************************************************
38cdf0e10cSrcweir |*
39cdf0e10cSrcweir |*    RscFlag::RscFlag()
40cdf0e10cSrcweir |*
41cdf0e10cSrcweir |*    Beschreibung
42cdf0e10cSrcweir |*    Ersterstellung    MM 03.04.91
43cdf0e10cSrcweir |*    Letzte Aenderung  MM 03.04.91
44cdf0e10cSrcweir |*
45cdf0e10cSrcweir *************************************************************************/
RscFlag(Atom nId,sal_uInt32 nTypeId)46cdf0e10cSrcweir RscFlag::RscFlag( Atom nId, sal_uInt32 nTypeId )
47cdf0e10cSrcweir 			: RscConst( nId, nTypeId )
48cdf0e10cSrcweir {}
49cdf0e10cSrcweir 
50cdf0e10cSrcweir /*************************************************************************
51cdf0e10cSrcweir |*
52cdf0e10cSrcweir |*    RscFlag::Size()
53cdf0e10cSrcweir |*
54cdf0e10cSrcweir |*    Beschreibung      Die Groe�e der Instanzdaten richtet sich nach
55cdf0e10cSrcweir |*                      der Anzahl der Flags
56cdf0e10cSrcweir |*    Ersterstellung    MM 03.04.91
57cdf0e10cSrcweir |*    Letzte Aenderung  MM 03.04.91
58cdf0e10cSrcweir |*
59cdf0e10cSrcweir *************************************************************************/
Size()60cdf0e10cSrcweir sal_uInt32 RscFlag::Size()
61cdf0e10cSrcweir {
62cdf0e10cSrcweir     return( ALIGNED_SIZE( sizeof( RscFlagInst ) *
63cdf0e10cSrcweir             ( 1 + (nEntries -1) / (sizeof( sal_uInt32 ) * 8) ) ) );
64cdf0e10cSrcweir }
65cdf0e10cSrcweir 
66cdf0e10cSrcweir /*************************************************************************
67cdf0e10cSrcweir |*
68cdf0e10cSrcweir |*    RscFlag::SetNotConst()
69cdf0e10cSrcweir |*
70cdf0e10cSrcweir |*    Beschreibung
71cdf0e10cSrcweir |*    Ersterstellung    MM 03.04.91
72cdf0e10cSrcweir |*    Letzte Aenderung  MM 03.04.91
73cdf0e10cSrcweir |*
74cdf0e10cSrcweir *************************************************************************/
SetNotConst(const RSCINST & rInst,Atom nConst)75cdf0e10cSrcweir ERRTYPE RscFlag::SetNotConst( const RSCINST & rInst, Atom nConst )
76cdf0e10cSrcweir {
77cdf0e10cSrcweir     sal_uInt32 i = 0, nFlag = 0;
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     if( nEntries != (i = GetConstPos( nConst )) ){
80cdf0e10cSrcweir         nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) );
81cdf0e10cSrcweir         i = i / (sizeof( sal_uInt32 ) * 8);
82cdf0e10cSrcweir         ((RscFlagInst *)rInst.pData)[ i ].nFlags     &= ~nFlag;
83cdf0e10cSrcweir         ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags &= ~nFlag;
84cdf0e10cSrcweir         return( ERR_OK );
85cdf0e10cSrcweir     };
86cdf0e10cSrcweir 
87cdf0e10cSrcweir     return( ERR_RSCFLAG );
88cdf0e10cSrcweir }
89cdf0e10cSrcweir 
90cdf0e10cSrcweir /*************************************************************************
91cdf0e10cSrcweir |*
92cdf0e10cSrcweir |*    RscFlag::SetConst()
93cdf0e10cSrcweir |*
94cdf0e10cSrcweir |*    Beschreibung
95cdf0e10cSrcweir |*    Ersterstellung    MM 03.04.91
96cdf0e10cSrcweir |*    Letzte Aenderung  MM 03.04.91
97cdf0e10cSrcweir |*
98cdf0e10cSrcweir *************************************************************************/
SetConst(const RSCINST & rInst,Atom nConst,sal_Int32)99cdf0e10cSrcweir ERRTYPE RscFlag::SetConst( const RSCINST & rInst, Atom nConst, sal_Int32 /*nVal*/ )
100cdf0e10cSrcweir {
101cdf0e10cSrcweir     sal_uInt32 i = 0, nFlag = 0;
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     if( nEntries != (i = GetConstPos( nConst )) ){
104cdf0e10cSrcweir         nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) );
105cdf0e10cSrcweir         i = i / (sizeof( sal_uInt32 ) * 8);
106cdf0e10cSrcweir         ((RscFlagInst *)rInst.pData)[ i ].nFlags     |= nFlag;
107cdf0e10cSrcweir         ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags &= ~nFlag;
108cdf0e10cSrcweir         return( ERR_OK );
109cdf0e10cSrcweir     };
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     return( ERR_RSCFLAG );
112cdf0e10cSrcweir }
113cdf0e10cSrcweir 
114cdf0e10cSrcweir /*************************************************************************
115cdf0e10cSrcweir |*
116cdf0e10cSrcweir |*    RscFlag::CreateBasic()
117cdf0e10cSrcweir |*
118cdf0e10cSrcweir |*    Beschreibung
119cdf0e10cSrcweir |*    Ersterstellung    MM 16.01.92
120cdf0e10cSrcweir |*    Letzte Aenderung  MM 16.01.92
121cdf0e10cSrcweir |*
122cdf0e10cSrcweir *************************************************************************/
CreateBasic(RSCINST * pInst)123cdf0e10cSrcweir RSCINST RscFlag::CreateBasic( RSCINST * pInst )
124cdf0e10cSrcweir {
125cdf0e10cSrcweir     RSCINST aInst;
126cdf0e10cSrcweir 
127cdf0e10cSrcweir     if( !pInst ){
128cdf0e10cSrcweir         aInst.pClass = this;
129cdf0e10cSrcweir         aInst.pData = (CLASS_DATA) rtl_allocateMemory( Size() );
130cdf0e10cSrcweir     }
131cdf0e10cSrcweir     else
132cdf0e10cSrcweir         aInst = *pInst;
133cdf0e10cSrcweir 
134cdf0e10cSrcweir     return( aInst );
135cdf0e10cSrcweir }
136cdf0e10cSrcweir 
137cdf0e10cSrcweir /*************************************************************************
138cdf0e10cSrcweir |*
139cdf0e10cSrcweir |*    RscFlag::Create()
140cdf0e10cSrcweir |*
141cdf0e10cSrcweir |*    Beschreibung
142cdf0e10cSrcweir |*    Ersterstellung    MM 03.04.91
143cdf0e10cSrcweir |*    Letzte Aenderung  MM 16.01.92
144cdf0e10cSrcweir |*
145cdf0e10cSrcweir *************************************************************************/
Create(RSCINST * pInst,const RSCINST & rDflt,sal_Bool bOwnClass)146cdf0e10cSrcweir RSCINST RscFlag::Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool bOwnClass )
147cdf0e10cSrcweir {
148cdf0e10cSrcweir     RSCINST aInst = CreateBasic( pInst );
149cdf0e10cSrcweir     sal_uInt32  i = 0;
150cdf0e10cSrcweir 
151cdf0e10cSrcweir     if( !bOwnClass && rDflt.IsInst() )
152cdf0e10cSrcweir         bOwnClass = rDflt.pClass->InHierarchy( this );
153cdf0e10cSrcweir 
154cdf0e10cSrcweir     if( bOwnClass )
155cdf0e10cSrcweir         memmove( aInst.pData, rDflt.pData, Size() );
156cdf0e10cSrcweir     else
157cdf0e10cSrcweir 	{
158cdf0e10cSrcweir         for( i = 0; i < Size() / sizeof( RscFlagInst ); i++ )
159cdf0e10cSrcweir 		{
160cdf0e10cSrcweir             ((RscFlagInst *)aInst.pData)[ i ].nFlags = 0;
161cdf0e10cSrcweir             ((RscFlagInst *)aInst.pData)[ i ].nDfltFlags = 0xFFFFFFFF;
162cdf0e10cSrcweir         }
163cdf0e10cSrcweir     };
164cdf0e10cSrcweir 
165cdf0e10cSrcweir     return( aInst );
166cdf0e10cSrcweir }
167cdf0e10cSrcweir 
168cdf0e10cSrcweir /*************************************************************************
169cdf0e10cSrcweir |*
170cdf0e10cSrcweir |*    RscFlag::CreateClient()
171cdf0e10cSrcweir |*
172cdf0e10cSrcweir |*    Beschreibung
173cdf0e10cSrcweir |*    Ersterstellung    MM 16.01.92
174cdf0e10cSrcweir |*    Letzte Aenderung  MM 16.01.92
175cdf0e10cSrcweir |*
176cdf0e10cSrcweir *************************************************************************/
CreateClient(RSCINST * pInst,const RSCINST & rDfltI,sal_Bool bOwnClass,Atom nConstId)177cdf0e10cSrcweir RSCINST RscFlag::CreateClient( RSCINST * pInst, const RSCINST & rDfltI,
178cdf0e10cSrcweir                                sal_Bool bOwnClass, Atom nConstId )
179cdf0e10cSrcweir {
180cdf0e10cSrcweir     RSCINST aInst = CreateBasic( pInst );
181cdf0e10cSrcweir     sal_uInt32 i = 0, nFlag = 0;
182cdf0e10cSrcweir 
183cdf0e10cSrcweir     if( !bOwnClass && rDfltI.IsInst() )
184cdf0e10cSrcweir         bOwnClass = rDfltI.pClass->InHierarchy( this );
185cdf0e10cSrcweir 
186cdf0e10cSrcweir     if( nEntries != (i = GetConstPos( nConstId )) ){
187cdf0e10cSrcweir         nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) );
188cdf0e10cSrcweir         i = i / (sizeof( sal_uInt32 ) * 8);
189cdf0e10cSrcweir         if( bOwnClass ){
190cdf0e10cSrcweir             ((RscFlagInst *)aInst.pData)[ i ].nFlags &=
191cdf0e10cSrcweir             ~nFlag | ((RscFlagInst *)rDfltI.pData)[ i ].nFlags;
192cdf0e10cSrcweir             ((RscFlagInst *)aInst.pData)[ i ].nDfltFlags &=
193cdf0e10cSrcweir             ~nFlag | ((RscFlagInst *)rDfltI.pData)[ i ].nDfltFlags;
194cdf0e10cSrcweir         }
195cdf0e10cSrcweir         else{
196cdf0e10cSrcweir             ((RscFlagInst *)aInst.pData)[ i ].nFlags &= ~nFlag;
197cdf0e10cSrcweir             ((RscFlagInst *)aInst.pData)[ i ].nDfltFlags |= nFlag;
198cdf0e10cSrcweir         }
199cdf0e10cSrcweir     }
200cdf0e10cSrcweir 
201cdf0e10cSrcweir     return( aInst );
202cdf0e10cSrcweir }
203cdf0e10cSrcweir 
204cdf0e10cSrcweir /*************************************************************************
205cdf0e10cSrcweir |*
206cdf0e10cSrcweir |*    RscFlag::SetToDefault()
207cdf0e10cSrcweir |*
208cdf0e10cSrcweir |*    Beschreibung
209cdf0e10cSrcweir |*    Ersterstellung    MM 03.04.91
210cdf0e10cSrcweir |*    Letzte Aenderung  MM 03.04.91
211cdf0e10cSrcweir |*
212cdf0e10cSrcweir *************************************************************************/
SetToDefault(const RSCINST & rInst)213cdf0e10cSrcweir void RscFlag::SetToDefault( const RSCINST & rInst )
214cdf0e10cSrcweir {
215cdf0e10cSrcweir 	sal_uInt32 i = 0;
216cdf0e10cSrcweir 
217cdf0e10cSrcweir 	for( i = 0; i < Size() / sizeof( RscFlagInst ); i++ )
218cdf0e10cSrcweir 		((RscFlagInst *)rInst.pData)[ i ].nDfltFlags = 0xFFFFFFFF;
219cdf0e10cSrcweir }
220cdf0e10cSrcweir 
221cdf0e10cSrcweir /*************************************************************************
222cdf0e10cSrcweir |*
223cdf0e10cSrcweir |*    RscFlag::IsDlft()
224cdf0e10cSrcweir |*
225cdf0e10cSrcweir |*    Beschreibung
226cdf0e10cSrcweir |*    Ersterstellung    MM 03.04.91
227cdf0e10cSrcweir |*    Letzte Aenderung  MM 03.04.91
228cdf0e10cSrcweir |*
229cdf0e10cSrcweir *************************************************************************/
IsDefault(const RSCINST & rInst)230cdf0e10cSrcweir sal_Bool RscFlag::IsDefault( const RSCINST & rInst )
231cdf0e10cSrcweir {
232cdf0e10cSrcweir     sal_uInt32 i = 0;
233cdf0e10cSrcweir 
234cdf0e10cSrcweir     for( i = 0; i < Size() / sizeof( RscFlagInst ); i++ )
235cdf0e10cSrcweir         if( ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags != 0xFFFFFFFF )
236cdf0e10cSrcweir             return( sal_False );
237cdf0e10cSrcweir     return( sal_True );
238cdf0e10cSrcweir }
239cdf0e10cSrcweir 
IsDefault(const RSCINST & rInst,Atom nConstId)240cdf0e10cSrcweir sal_Bool RscFlag::IsDefault( const RSCINST & rInst, Atom nConstId )
241cdf0e10cSrcweir {
242cdf0e10cSrcweir     sal_uInt32 i = 0, nFlag = 0;
243cdf0e10cSrcweir 
244cdf0e10cSrcweir     if( nEntries != (i = GetConstPos( nConstId )) ){
245cdf0e10cSrcweir         nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) );
246cdf0e10cSrcweir         i = i / (sizeof( sal_uInt32 ) * 8);
247cdf0e10cSrcweir         if( ((RscFlagInst *)rInst.pData)[ i ].nDfltFlags & nFlag )
248cdf0e10cSrcweir             return( sal_True );
249cdf0e10cSrcweir         else
250cdf0e10cSrcweir             return( sal_False );
251cdf0e10cSrcweir     };
252cdf0e10cSrcweir     return( sal_True );
253cdf0e10cSrcweir }
254cdf0e10cSrcweir 
255cdf0e10cSrcweir /*************************************************************************
256cdf0e10cSrcweir |*
257cdf0e10cSrcweir |*    RscFlag::IsValueDefault()
258cdf0e10cSrcweir |*
259cdf0e10cSrcweir |*    Beschreibung
260cdf0e10cSrcweir |*    Ersterstellung    MM 25.04.91
261cdf0e10cSrcweir |*    Letzte Aenderung  MM 25.04.91
262cdf0e10cSrcweir |*
263cdf0e10cSrcweir *************************************************************************/
IsValueDefault(const RSCINST & rInst,CLASS_DATA pDef,Atom nConstId)264cdf0e10cSrcweir sal_Bool RscFlag::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef,
265cdf0e10cSrcweir                               Atom nConstId )
266cdf0e10cSrcweir {
267cdf0e10cSrcweir     sal_uInt32 i = 0, nFlag = 0;
268cdf0e10cSrcweir 
269cdf0e10cSrcweir     if( nEntries != (i = GetConstPos( nConstId )) ){
270cdf0e10cSrcweir         nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) );
271cdf0e10cSrcweir         i = i / (sizeof( sal_uInt32 ) * 8);
272cdf0e10cSrcweir 
273cdf0e10cSrcweir         if( pDef ){
274cdf0e10cSrcweir             if( (((RscFlagInst *)rInst.pData)[ i ].nFlags & nFlag)
275cdf0e10cSrcweir               == (((RscFlagInst *)pDef)[ i ].nFlags & nFlag) )
276cdf0e10cSrcweir             {
277cdf0e10cSrcweir                 return sal_True;
278cdf0e10cSrcweir             }
279cdf0e10cSrcweir         }
280cdf0e10cSrcweir     };
281cdf0e10cSrcweir 
282cdf0e10cSrcweir     return sal_False;
283cdf0e10cSrcweir }
284cdf0e10cSrcweir 
IsValueDefault(const RSCINST & rInst,CLASS_DATA pDef)285cdf0e10cSrcweir sal_Bool RscFlag::IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef )
286cdf0e10cSrcweir {
287cdf0e10cSrcweir     sal_uInt32 i = 0;
288cdf0e10cSrcweir 
289cdf0e10cSrcweir     if( pDef ){
290cdf0e10cSrcweir         sal_uInt32  Flag = 0, nIndex = 0;
291cdf0e10cSrcweir 
292cdf0e10cSrcweir         Flag = 1;
293cdf0e10cSrcweir         for( i = 0; i < nEntries; i++ ){
294cdf0e10cSrcweir             nIndex = i / (sizeof( sal_uInt32 ) * 8);
295cdf0e10cSrcweir             if( (((RscFlagInst *)rInst.pData)[ nIndex ].nFlags & Flag)
296cdf0e10cSrcweir               != (((RscFlagInst *)pDef)[ nIndex ].nFlags & Flag)  )
297cdf0e10cSrcweir             {
298cdf0e10cSrcweir                 return sal_False;
299cdf0e10cSrcweir             }
300cdf0e10cSrcweir             Flag <<= 1;
301cdf0e10cSrcweir             if( !Flag )
302cdf0e10cSrcweir                 Flag = 1;
303cdf0e10cSrcweir         };
304cdf0e10cSrcweir     }
305cdf0e10cSrcweir     else
306cdf0e10cSrcweir         return sal_False;
307cdf0e10cSrcweir 
308cdf0e10cSrcweir     return sal_True;
309cdf0e10cSrcweir }
310cdf0e10cSrcweir 
311cdf0e10cSrcweir /*************************************************************************
312cdf0e10cSrcweir |*
313cdf0e10cSrcweir |*    RscFlag::IsSet()
314cdf0e10cSrcweir |*
315cdf0e10cSrcweir |*    Beschreibung
316cdf0e10cSrcweir |*    Ersterstellung    MM 10.04.91
317cdf0e10cSrcweir |*    Letzte Aenderung  MM 10.04.91
318cdf0e10cSrcweir |*
319cdf0e10cSrcweir *************************************************************************/
IsSet(const RSCINST & rInst,Atom nConstId)320cdf0e10cSrcweir sal_Bool RscFlag::IsSet( const RSCINST & rInst, Atom nConstId )
321cdf0e10cSrcweir {
322cdf0e10cSrcweir     sal_uInt32 i = 0, nFlag = 0;
323cdf0e10cSrcweir 
324cdf0e10cSrcweir     if( nEntries != (i = GetConstPos( nConstId )) ){
325cdf0e10cSrcweir         nFlag = 1 << (i % (sizeof( sal_uInt32 ) * 8) );
326cdf0e10cSrcweir         i = i / (sizeof( sal_uInt32 ) * 8);
327cdf0e10cSrcweir         if( ((RscFlagInst *)rInst.pData)[ i ].nFlags & nFlag )
328cdf0e10cSrcweir             return( sal_True );
329cdf0e10cSrcweir         else
330cdf0e10cSrcweir             return( sal_False );
331cdf0e10cSrcweir     };
332cdf0e10cSrcweir     return( sal_True );
333cdf0e10cSrcweir }
334cdf0e10cSrcweir 
335cdf0e10cSrcweir /*************************************************************************
336cdf0e10cSrcweir |*
337cdf0e10cSrcweir |*    RscFlag::WriteSrc()
338cdf0e10cSrcweir |*
339cdf0e10cSrcweir |*    Beschreibung
340cdf0e10cSrcweir |*    Ersterstellung    MM 08.04.91
341cdf0e10cSrcweir |*    Letzte Aenderung  MM 08.04.91
342cdf0e10cSrcweir |*
343cdf0e10cSrcweir *************************************************************************/
WriteSrc(const RSCINST & rInst,FILE * fOutput,RscTypCont *,sal_uInt32,const char *)344cdf0e10cSrcweir void RscFlag::WriteSrc( const RSCINST & rInst, FILE * fOutput,
345cdf0e10cSrcweir                         RscTypCont *, sal_uInt32, const char * )
346cdf0e10cSrcweir {
347cdf0e10cSrcweir     sal_uInt32  i = 0, Flag = 0, nIndex = 0;
348cdf0e10cSrcweir     sal_Bool    bComma = sal_False;
349cdf0e10cSrcweir 
350cdf0e10cSrcweir     Flag = 1;
351cdf0e10cSrcweir     for( i = 0; i < nEntries; i++ ){
352cdf0e10cSrcweir         nIndex = i / (sizeof( sal_uInt32 ) * 8);
353cdf0e10cSrcweir         if( !( ((RscFlagInst *)rInst.pData)[ nIndex ].nDfltFlags & Flag) ){
354cdf0e10cSrcweir             if( bComma )
355cdf0e10cSrcweir                 fprintf( fOutput, ", " );
356cdf0e10cSrcweir             if( ((RscFlagInst *)rInst.pData)[ nIndex ].nFlags & Flag )
357cdf0e10cSrcweir                 fprintf( fOutput, "%s", pHS->getString( pVarArray[ i ].nId ).getStr() );
358cdf0e10cSrcweir             else{
359cdf0e10cSrcweir                 fprintf( fOutput, "not " );
360cdf0e10cSrcweir                 fprintf( fOutput, "%s", pHS->getString( pVarArray[ i ].nId ).getStr() );
361cdf0e10cSrcweir             }
362cdf0e10cSrcweir             bComma = sal_True;
363cdf0e10cSrcweir         }
364cdf0e10cSrcweir         Flag <<= 1;
365cdf0e10cSrcweir         if( !Flag )
366cdf0e10cSrcweir             Flag = 1;
367cdf0e10cSrcweir     };
368cdf0e10cSrcweir }
369cdf0e10cSrcweir 
370cdf0e10cSrcweir /*************************************************************************
371cdf0e10cSrcweir |*
372cdf0e10cSrcweir |*    RscFlag::WriteRc()
373cdf0e10cSrcweir |*
374cdf0e10cSrcweir |*    Beschreibung
375cdf0e10cSrcweir |*    Ersterstellung    MM 15.04.91
376cdf0e10cSrcweir |*    Letzte Aenderung  MM 15.04.91
377cdf0e10cSrcweir |*
378cdf0e10cSrcweir *************************************************************************/
WriteRc(const RSCINST & rInst,RscWriteRc & aMem,RscTypCont *,sal_uInt32,sal_Bool)379cdf0e10cSrcweir ERRTYPE RscFlag::WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
380cdf0e10cSrcweir                           RscTypCont *, sal_uInt32, sal_Bool )
381cdf0e10cSrcweir {
382cdf0e10cSrcweir     sal_Int32	lVal = 0;
383cdf0e10cSrcweir     sal_uInt32  i = 0, Flag = 0, nIndex = 0;
384cdf0e10cSrcweir 
385cdf0e10cSrcweir     Flag = 1;
386cdf0e10cSrcweir     for( i = 0; i < nEntries; i++ ){
387cdf0e10cSrcweir         nIndex = i / (sizeof( sal_uInt32 ) * 8);
388cdf0e10cSrcweir         if( ((RscFlagInst *)rInst.pData)[ nIndex ].nFlags & Flag )
389cdf0e10cSrcweir             lVal |= pVarArray[ i ].lValue;
390cdf0e10cSrcweir 
391cdf0e10cSrcweir         Flag <<= 1;
392cdf0e10cSrcweir         if( !Flag )
393cdf0e10cSrcweir             Flag = 1;
394cdf0e10cSrcweir     };
395cdf0e10cSrcweir 
396cdf0e10cSrcweir 	aMem.Put( (sal_Int32)lVal );
397cdf0e10cSrcweir     return( ERR_OK );
398cdf0e10cSrcweir }
399cdf0e10cSrcweir 
400cdf0e10cSrcweir /*************************************************************************
401cdf0e10cSrcweir |*
402cdf0e10cSrcweir |*    RscClient::RscClient()
403cdf0e10cSrcweir |*
404cdf0e10cSrcweir |*    Beschreibung
405cdf0e10cSrcweir |*    Ersterstellung    MM 08.04.91
406cdf0e10cSrcweir |*    Letzte Aenderung  MM 08.04.91
407cdf0e10cSrcweir |*
408cdf0e10cSrcweir *************************************************************************/
RscClient(Atom nId,sal_uInt32 nTypeId,RscFlag * pClass,Atom nConstantId)409cdf0e10cSrcweir RscClient::RscClient( Atom nId, sal_uInt32 nTypeId, RscFlag * pClass,
410cdf0e10cSrcweir 					   Atom nConstantId )
411cdf0e10cSrcweir 		   : RscTop ( nId, nTypeId )
412cdf0e10cSrcweir {
413cdf0e10cSrcweir    pRefClass = pClass;
414cdf0e10cSrcweir    nConstId = nConstantId;
415cdf0e10cSrcweir }
416cdf0e10cSrcweir 
417cdf0e10cSrcweir /*************************************************************************
418cdf0e10cSrcweir |*
419cdf0e10cSrcweir |*    RscClient::GetClassType()
420cdf0e10cSrcweir |*
421cdf0e10cSrcweir |*    Beschreibung
422cdf0e10cSrcweir |*    Ersterstellung    MM 08.04.91
423cdf0e10cSrcweir |*    Letzte Aenderung  MM 08.04.91
424cdf0e10cSrcweir |*
425cdf0e10cSrcweir *************************************************************************/
GetClassType() const426cdf0e10cSrcweir RSCCLASS_TYPE RscClient::GetClassType() const
427cdf0e10cSrcweir {
428cdf0e10cSrcweir 	return RSCCLASS_BOOL;
429cdf0e10cSrcweir }
430cdf0e10cSrcweir 
431cdf0e10cSrcweir /*************************************************************************
432cdf0e10cSrcweir |*
433cdf0e10cSrcweir |*    RscClient::WriteSrc()
434cdf0e10cSrcweir |*
435cdf0e10cSrcweir |*    Beschreibung
436cdf0e10cSrcweir |*    Ersterstellung    MM 08.04.91
437cdf0e10cSrcweir |*    Letzte Aenderung  MM 08.04.91
438cdf0e10cSrcweir |*
439cdf0e10cSrcweir *************************************************************************/
WriteSrc(const RSCINST & rInst,FILE * fOutput,RscTypCont *,sal_uInt32,const char *)440cdf0e10cSrcweir void RscClient::WriteSrc( const RSCINST & rInst, FILE * fOutput,
441cdf0e10cSrcweir                           RscTypCont *, sal_uInt32, const char * )
442cdf0e10cSrcweir {
443cdf0e10cSrcweir     if( pRefClass->IsSet( rInst, nConstId ) )
444cdf0e10cSrcweir         fprintf( fOutput, "TRUE" );
445cdf0e10cSrcweir     else
446cdf0e10cSrcweir         fprintf( fOutput, "FALSE" );
447cdf0e10cSrcweir }
448cdf0e10cSrcweir 
449cdf0e10cSrcweir /*************************************************************************
450cdf0e10cSrcweir |*
451cdf0e10cSrcweir |*    RscClient::Create()
452cdf0e10cSrcweir |*
453cdf0e10cSrcweir |*    Beschreibung
454cdf0e10cSrcweir |*    Ersterstellung    MM 08.04.91
455cdf0e10cSrcweir |*    Letzte Aenderung  MM 08.04.91
456cdf0e10cSrcweir |*
457cdf0e10cSrcweir *************************************************************************/
Create(RSCINST * pInst,const RSCINST & rDflt,sal_Bool bOwnClass)458cdf0e10cSrcweir RSCINST RscClient::Create( RSCINST * pInst, const RSCINST & rDflt,
459cdf0e10cSrcweir                            sal_Bool bOwnClass )
460cdf0e10cSrcweir {
461cdf0e10cSrcweir     RSCINST aTmpI, aDfltI;
462cdf0e10cSrcweir 
463cdf0e10cSrcweir     if( pInst ){
464cdf0e10cSrcweir         aTmpI.pClass = pRefClass;
465cdf0e10cSrcweir         aTmpI.pData  = pInst->pData;
466cdf0e10cSrcweir     }
467cdf0e10cSrcweir 
468cdf0e10cSrcweir     if( !bOwnClass && rDflt.IsInst() ){
469cdf0e10cSrcweir         bOwnClass = rDflt.pClass->InHierarchy( this );
470cdf0e10cSrcweir         if( bOwnClass ){
471cdf0e10cSrcweir             aDfltI.pClass = pRefClass;
472cdf0e10cSrcweir             aDfltI.pData = rDflt.pData;
473cdf0e10cSrcweir         }
474cdf0e10cSrcweir     }
475cdf0e10cSrcweir 
476cdf0e10cSrcweir     if( pInst )
477cdf0e10cSrcweir         aTmpI = pRefClass->CreateClient( &aTmpI, aDfltI,
478cdf0e10cSrcweir                                          bOwnClass, nConstId );
479cdf0e10cSrcweir     else
480cdf0e10cSrcweir         aTmpI = pRefClass->CreateClient( NULL, aDfltI,
481cdf0e10cSrcweir                                          bOwnClass, nConstId );
482cdf0e10cSrcweir     aTmpI.pClass = this;
483cdf0e10cSrcweir 
484cdf0e10cSrcweir     return( aTmpI );
485cdf0e10cSrcweir }
486cdf0e10cSrcweir 
487