xref: /aoo4110/main/rsc/inc/rsccont.hxx (revision b1cdbd2c)
1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski  *
3*b1cdbd2cSJim Jagielski  * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski  * or more contributor license agreements.  See the NOTICE file
5*b1cdbd2cSJim Jagielski  * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski  * regarding copyright ownership.  The ASF licenses this file
7*b1cdbd2cSJim Jagielski  * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski  * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski  * with the License.  You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski  *
11*b1cdbd2cSJim Jagielski  *   http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski  *
13*b1cdbd2cSJim Jagielski  * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski  * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski  * KIND, either express or implied.  See the License for the
17*b1cdbd2cSJim Jagielski  * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski  * under the License.
19*b1cdbd2cSJim Jagielski  *
20*b1cdbd2cSJim Jagielski  *************************************************************/
21*b1cdbd2cSJim Jagielski 
22*b1cdbd2cSJim Jagielski 
23*b1cdbd2cSJim Jagielski #ifndef _RSCCONT_HXX
24*b1cdbd2cSJim Jagielski #define _RSCCONT_HXX
25*b1cdbd2cSJim Jagielski 
26*b1cdbd2cSJim Jagielski #include <rscall.h>
27*b1cdbd2cSJim Jagielski #include <rscerror.h>
28*b1cdbd2cSJim Jagielski #include <rsctop.hxx>
29*b1cdbd2cSJim Jagielski 
30*b1cdbd2cSJim Jagielski /******************* R s c B a s e C o n t *******************************/
31*b1cdbd2cSJim Jagielski struct ENTRY_STRUCT {
32*b1cdbd2cSJim Jagielski     RscId   aName;
33*b1cdbd2cSJim Jagielski     RSCINST aInst;
CreateENTRY_STRUCT34*b1cdbd2cSJim Jagielski     void Create(){ aName.Create(); aInst = RSCINST(); }
35*b1cdbd2cSJim Jagielski     void Destroy();
36*b1cdbd2cSJim Jagielski };
37*b1cdbd2cSJim Jagielski struct RscBaseContInst {
38*b1cdbd2cSJim Jagielski     sal_uInt32          nEntries;
39*b1cdbd2cSJim Jagielski     ENTRY_STRUCT *  pEntries;
40*b1cdbd2cSJim Jagielski     sal_Bool            bDflt;
41*b1cdbd2cSJim Jagielski };
42*b1cdbd2cSJim Jagielski 
43*b1cdbd2cSJim Jagielski class RscBaseCont : public RscTop
44*b1cdbd2cSJim Jagielski {
45*b1cdbd2cSJim Jagielski protected:
46*b1cdbd2cSJim Jagielski     RscTop *        pTypeClass; // Typ der Eintraege
47*b1cdbd2cSJim Jagielski     RscTop *        pTypeClass1;// Zwei verschiedene Typen moeglich
48*b1cdbd2cSJim Jagielski     sal_Bool            bNoId;      // Keine Identifier
49*b1cdbd2cSJim Jagielski     sal_uInt32          nSize;      // Groesse der Instanzdaten dieser Klasse
50*b1cdbd2cSJim Jagielski                                 // mit Superklassen
51*b1cdbd2cSJim Jagielski     sal_uInt32          nOffInstData;// Offset auf eigen Instanzdaten
52*b1cdbd2cSJim Jagielski     void            DestroyElements( RscBaseContInst * pClassData );
53*b1cdbd2cSJim Jagielski     RSCINST         SearchElePos( const RSCINST & rInst, const RscId & rEleName,
54*b1cdbd2cSJim Jagielski                                   RscTop * pClass, sal_uInt32 nPos );
55*b1cdbd2cSJim Jagielski protected:
56*b1cdbd2cSJim Jagielski     void            ContWriteSrc( const RSCINST & rInst, FILE * fOutput,
57*b1cdbd2cSJim Jagielski                                   RscTypCont * pTC, sal_uInt32 nTab, const char * );
58*b1cdbd2cSJim Jagielski     ERRTYPE         ContWriteRc( const RSCINST & rInst, RscWriteRc & aMem,
59*b1cdbd2cSJim Jagielski                                  RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
60*b1cdbd2cSJim Jagielski 	void			ContWriteRcAccess( FILE * fOutput, RscTypCont * pTC,
61*b1cdbd2cSJim Jagielski 										const char *, sal_Bool nWriteSize );
62*b1cdbd2cSJim Jagielski public:
63*b1cdbd2cSJim Jagielski                     RscBaseCont( Atom nId, sal_uInt32 nTypId,
64*b1cdbd2cSJim Jagielski                                  RscTop * pSuper = NULL,
65*b1cdbd2cSJim Jagielski                                  sal_Bool bNoId = sal_True );
66*b1cdbd2cSJim Jagielski                     ~RscBaseCont();
67*b1cdbd2cSJim Jagielski 	virtual RSCCLASS_TYPE   GetClassType() const;
SetTypeClass(RscTop * pClass,RscTop * pClass1=NULL)68*b1cdbd2cSJim Jagielski     void            SetTypeClass( RscTop * pClass, RscTop * pClass1 = NULL )
69*b1cdbd2cSJim Jagielski 					{
70*b1cdbd2cSJim Jagielski                         pTypeClass = pClass;
71*b1cdbd2cSJim Jagielski                         pTypeClass1 = pClass1;
72*b1cdbd2cSJim Jagielski                     };
73*b1cdbd2cSJim Jagielski     RSCINST         Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool );
74*b1cdbd2cSJim Jagielski     void            Destroy( const RSCINST & rInst );
75*b1cdbd2cSJim Jagielski     ERRTYPE         GetElement( const RSCINST & rInst, const RscId & rEleName,
76*b1cdbd2cSJim Jagielski                                 RscTop * pCreateClass, const RSCINST & rCreateInst,
77*b1cdbd2cSJim Jagielski                                 RSCINST * pGetInst );
78*b1cdbd2cSJim Jagielski     RSCINST         SearchEle( const RSCINST & rInst, const RscId & rEleName,
79*b1cdbd2cSJim Jagielski                                RscTop * pClass );
80*b1cdbd2cSJim Jagielski     sal_uInt32          GetCount( const RSCINST & rInst );
81*b1cdbd2cSJim Jagielski     RSCINST         GetPosEle( const RSCINST & rInst, sal_uInt32 nPos );
82*b1cdbd2cSJim Jagielski     ERRTYPE         MovePosEle( const RSCINST & rInst, sal_uInt32 nDestPos,
83*b1cdbd2cSJim Jagielski                                 sal_uInt32 nSourcePos );
84*b1cdbd2cSJim Jagielski     virtual ERRTYPE SetPosRscId( const RSCINST & rInst, sal_uInt32 nPos,
85*b1cdbd2cSJim Jagielski                                  const RscId & rRscId);
86*b1cdbd2cSJim Jagielski     SUBINFO_STRUCT  GetInfoEle( const RSCINST & rInst, sal_uInt32 nPos );
87*b1cdbd2cSJim Jagielski     ERRTYPE         SetString( const RSCINST &, const char * pStr );
88*b1cdbd2cSJim Jagielski     ERRTYPE         SetNumber( const RSCINST &, sal_Int32 lValue );
89*b1cdbd2cSJim Jagielski 	ERRTYPE 		SetBool( const RSCINST & rInst, sal_Bool bValue );
90*b1cdbd2cSJim Jagielski 	ERRTYPE 		SetConst( const RSCINST & rInst, Atom nValueId,
91*b1cdbd2cSJim Jagielski 							  sal_Int32 nValue );
92*b1cdbd2cSJim Jagielski     ERRTYPE         SetRef( const RSCINST & rInst, const RscId & rRefId );
93*b1cdbd2cSJim Jagielski 
94*b1cdbd2cSJim Jagielski                     // Gibt die Groesse der Klasse in Bytes
Size()95*b1cdbd2cSJim Jagielski     sal_uInt32          Size(){ return( nSize ); };
96*b1cdbd2cSJim Jagielski 
97*b1cdbd2cSJim Jagielski     sal_Bool            IsConsistent( const RSCINST & rInst, RscInconsList * pList );
98*b1cdbd2cSJim Jagielski 	void			SetToDefault( const RSCINST & rInst );
99*b1cdbd2cSJim Jagielski     sal_Bool            IsDefault( const RSCINST & rInst );
100*b1cdbd2cSJim Jagielski     sal_Bool            IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
101*b1cdbd2cSJim Jagielski 
102*b1cdbd2cSJim Jagielski     void            Delete( const RSCINST & rInst, RscTop * pClass,
103*b1cdbd2cSJim Jagielski                             const RscId & rId );
104*b1cdbd2cSJim Jagielski     void            DeletePos( const RSCINST & rInst, sal_uInt32 nPos );
105*b1cdbd2cSJim Jagielski 
106*b1cdbd2cSJim Jagielski     void            WriteSrc( const RSCINST & rInst, FILE * fOutput,
107*b1cdbd2cSJim Jagielski                               RscTypCont * pTC, sal_uInt32 nTab, const char * );
108*b1cdbd2cSJim Jagielski     ERRTYPE         WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
109*b1cdbd2cSJim Jagielski                              RscTypCont * pTC, sal_uInt32 , sal_Bool bExtra);
110*b1cdbd2cSJim Jagielski     ERRTYPE         WriteHxx( const RSCINST & rInst, FILE * fOutput,
111*b1cdbd2cSJim Jagielski                               RscTypCont * pTC, const RscId & rId );
112*b1cdbd2cSJim Jagielski     ERRTYPE         WriteCxx( const RSCINST & rInst, FILE * fOutput,
113*b1cdbd2cSJim Jagielski                               RscTypCont * pTC, const RscId &rId );
114*b1cdbd2cSJim Jagielski };
115*b1cdbd2cSJim Jagielski 
116*b1cdbd2cSJim Jagielski /******************* R s c C o n t W r i t e S r c ***********************/
117*b1cdbd2cSJim Jagielski class RscContWriteSrc : public RscBaseCont
118*b1cdbd2cSJim Jagielski {
119*b1cdbd2cSJim Jagielski public:
120*b1cdbd2cSJim Jagielski                     RscContWriteSrc( Atom nId, sal_uInt32 nTypId,
121*b1cdbd2cSJim Jagielski                                      RscTop * pSuper = NULL,
122*b1cdbd2cSJim Jagielski                                      sal_Bool bNoId = sal_True );
123*b1cdbd2cSJim Jagielski     void            WriteSrc( const RSCINST & rInst, FILE * fOutput,
124*b1cdbd2cSJim Jagielski                               RscTypCont * pTC, sal_uInt32 nTab, const char * );
125*b1cdbd2cSJim Jagielski };
126*b1cdbd2cSJim Jagielski 
127*b1cdbd2cSJim Jagielski /******************* R s c C o n t ***************************************/
128*b1cdbd2cSJim Jagielski class RscCont : public RscContWriteSrc {
129*b1cdbd2cSJim Jagielski public:
130*b1cdbd2cSJim Jagielski                     RscCont( Atom nId, sal_uInt32 nTypId,
131*b1cdbd2cSJim Jagielski                              RscTop * pSuper = NULL,
132*b1cdbd2cSJim Jagielski                              sal_Bool bNoId = sal_True );
133*b1cdbd2cSJim Jagielski     ERRTYPE         WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
134*b1cdbd2cSJim Jagielski                              RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
135*b1cdbd2cSJim Jagielski 	void			WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
136*b1cdbd2cSJim Jagielski 									const char * );
137*b1cdbd2cSJim Jagielski };
138*b1cdbd2cSJim Jagielski 
139*b1cdbd2cSJim Jagielski /******************* R s c C o n t E x t r a D a t a *********************/
140*b1cdbd2cSJim Jagielski class RscContExtraData : public RscContWriteSrc {
141*b1cdbd2cSJim Jagielski public:
142*b1cdbd2cSJim Jagielski                     RscContExtraData( Atom nId, sal_uInt32 nTypId,
143*b1cdbd2cSJim Jagielski                              RscTop * pSuper = NULL,
144*b1cdbd2cSJim Jagielski                              sal_Bool bNoId = sal_True );
145*b1cdbd2cSJim Jagielski     ERRTYPE         WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
146*b1cdbd2cSJim Jagielski                              RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
147*b1cdbd2cSJim Jagielski };
148*b1cdbd2cSJim Jagielski 
149*b1cdbd2cSJim Jagielski #endif //_RSCCONT_HXX
150