xref: /aoo42x/main/rsc/inc/rscarray.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #ifndef _RSCARRAY_HXX
28*cdf0e10cSrcweir #define _RSCARRAY_HXX
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include <rscall.h>
31*cdf0e10cSrcweir #include <rscerror.h>
32*cdf0e10cSrcweir #include <rsctop.hxx>
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir class RscEnum;
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir /******************* R s c A r r a y ************************************/
37*cdf0e10cSrcweir class RscInstNode : public IdNode
38*cdf0e10cSrcweir {
39*cdf0e10cSrcweir 	sal_uInt32	nTypeId;
40*cdf0e10cSrcweir protected:
41*cdf0e10cSrcweir     using NameNode::Search;
42*cdf0e10cSrcweir public:
43*cdf0e10cSrcweir 	RSCINST	aInst;
44*cdf0e10cSrcweir 	RscInstNode( sal_uInt32 nId );
45*cdf0e10cSrcweir 	~RscInstNode();
46*cdf0e10cSrcweir 	virtual sal_uInt32	GetId() const;
47*cdf0e10cSrcweir 	RscInstNode *   Left() const { return (RscInstNode *)pLeft  ; };
48*cdf0e10cSrcweir 	RscInstNode *   Right() const{ return (RscInstNode *)pRight ; };
49*cdf0e10cSrcweir 	RscInstNode *	Search( sal_uInt32 nId ) const
50*cdf0e10cSrcweir 					{
51*cdf0e10cSrcweir 						return (RscInstNode *)IdNode::Search( nId );
52*cdf0e10cSrcweir 					}
53*cdf0e10cSrcweir };
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir struct RscArrayInst
56*cdf0e10cSrcweir {
57*cdf0e10cSrcweir 	RscInstNode *	pNode;
58*cdf0e10cSrcweir };
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir /* Der Baum wird ueber die Werte des Enums sortiert, nicht ueber
61*cdf0e10cSrcweir 	seine HashId.
62*cdf0e10cSrcweir */
63*cdf0e10cSrcweir class RscArray : public RscTop
64*cdf0e10cSrcweir {
65*cdf0e10cSrcweir protected:
66*cdf0e10cSrcweir     RscEnum *       pTypeClass; // Typ der Eintraege
67*cdf0e10cSrcweir     sal_uInt32          nSize;      // Groesse der Instanzdaten dieser Klasse
68*cdf0e10cSrcweir                                 // mit Superklassen
69*cdf0e10cSrcweir     sal_uInt32          nOffInstData;// Offset auf eigen Instanzdaten
70*cdf0e10cSrcweir     void            WriteSrcArray( const RSCINST & rInst, FILE * fOutput,
71*cdf0e10cSrcweir                               	RscTypCont * pTC, sal_uInt32 nTab, const char * );
72*cdf0e10cSrcweir public:
73*cdf0e10cSrcweir                     RscArray( Atom nId, sal_uInt32 nTypId,
74*cdf0e10cSrcweir                                 RscTop * pSuper, RscEnum * pTypeClass );
75*cdf0e10cSrcweir                     ~RscArray();
76*cdf0e10cSrcweir 	virtual RSCCLASS_TYPE	GetClassType() const;
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir     void            SetTypeClass( RscEnum * pClass )
79*cdf0e10cSrcweir 					{
80*cdf0e10cSrcweir                         pTypeClass = pClass;
81*cdf0e10cSrcweir                     }
82*cdf0e10cSrcweir     virtual RscTop *    GetTypeClass() const;
83*cdf0e10cSrcweir     RSCINST         Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool );
84*cdf0e10cSrcweir     void            Destroy( const RSCINST & rInst );
85*cdf0e10cSrcweir     virtual ERRTYPE GetValueEle( const RSCINST & rInst, sal_Int32 lValue,
86*cdf0e10cSrcweir 								RscTop * pCreateClass,
87*cdf0e10cSrcweir                                 RSCINST * pGetInst );
88*cdf0e10cSrcweir     virtual ERRTYPE GetArrayEle( const RSCINST & rInst, Atom nId,
89*cdf0e10cSrcweir 								RscTop * pCreateClass,
90*cdf0e10cSrcweir                                 RSCINST * pGetInst );
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir                     // Gibt die Groesse der Klasse in Bytes
93*cdf0e10cSrcweir     sal_uInt32          Size(){ return( nSize ); };
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir     sal_Bool            IsConsistent( const RSCINST & rInst, RscInconsList * pList );
96*cdf0e10cSrcweir 	virtual void	SetToDefault( const RSCINST & rInst );
97*cdf0e10cSrcweir     sal_Bool            IsDefault( const RSCINST & rInst );
98*cdf0e10cSrcweir     sal_Bool            IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir     virtual void    WriteSrcHeader( const RSCINST & rInst, FILE * fOutput,
101*cdf0e10cSrcweir                                     RscTypCont * pTC, sal_uInt32 nTab,
102*cdf0e10cSrcweir                                     const RscId & aId, const char * );
103*cdf0e10cSrcweir     void            WriteSrc( const RSCINST & rInst, FILE * fOutput,
104*cdf0e10cSrcweir                               RscTypCont * pTC, sal_uInt32 nTab, const char * );
105*cdf0e10cSrcweir     ERRTYPE         WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
106*cdf0e10cSrcweir                              RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
107*cdf0e10cSrcweir 	virtual void	WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
108*cdf0e10cSrcweir 									const char * );
109*cdf0e10cSrcweir };
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir class RscClassArray : public RscArray
112*cdf0e10cSrcweir {
113*cdf0e10cSrcweir public:
114*cdf0e10cSrcweir                     RscClassArray( Atom nId, sal_uInt32 nTypId,
115*cdf0e10cSrcweir                                 RscTop * pSuper, RscEnum * pTypeClass );
116*cdf0e10cSrcweir                     ~RscClassArray();
117*cdf0e10cSrcweir     virtual void    WriteSrcHeader( const RSCINST & rInst, FILE * fOutput,
118*cdf0e10cSrcweir                                     RscTypCont * pTC, sal_uInt32 nTab,
119*cdf0e10cSrcweir                                     const RscId & aId, const char * );
120*cdf0e10cSrcweir     void            WriteSrc( const RSCINST & rInst, FILE * fOutput,
121*cdf0e10cSrcweir                               RscTypCont * pTC, sal_uInt32 nTab, const char * );
122*cdf0e10cSrcweir     virtual ERRTYPE WriteRcHeader( const RSCINST & rInst, RscWriteRc & aMem,
123*cdf0e10cSrcweir                                    RscTypCont * pTC, const RscId & aId,
124*cdf0e10cSrcweir                     				sal_uInt32 nDeep, sal_Bool bExtra );
125*cdf0e10cSrcweir };
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir class RscLangArray : public RscArray
129*cdf0e10cSrcweir {
130*cdf0e10cSrcweir public:
131*cdf0e10cSrcweir                     RscLangArray( Atom nId, sal_uInt32 nTypId,
132*cdf0e10cSrcweir                                 RscTop * pSuper, RscEnum * pTypeClass );
133*cdf0e10cSrcweir 	virtual RSCCLASS_TYPE	GetClassType() const;
134*cdf0e10cSrcweir };
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir #endif //_RSCARRAY
137