xref: /aoo42x/main/rsc/inc/rsccont.hxx (revision f7c60c9c)
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 _RSCCONT_HXX
24cdf0e10cSrcweir #define _RSCCONT_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <rscall.h>
27cdf0e10cSrcweir #include <rscerror.h>
28cdf0e10cSrcweir #include <rsctop.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir /******************* R s c B a s e C o n t *******************************/
31cdf0e10cSrcweir struct ENTRY_STRUCT {
32cdf0e10cSrcweir     RscId   aName;
33cdf0e10cSrcweir     RSCINST aInst;
CreateENTRY_STRUCT34cdf0e10cSrcweir     void Create(){ aName.Create(); aInst = RSCINST(); }
35cdf0e10cSrcweir     void Destroy();
36cdf0e10cSrcweir };
37cdf0e10cSrcweir struct RscBaseContInst {
38cdf0e10cSrcweir     sal_uInt32          nEntries;
39cdf0e10cSrcweir     ENTRY_STRUCT *  pEntries;
40cdf0e10cSrcweir     sal_Bool            bDflt;
41cdf0e10cSrcweir };
42cdf0e10cSrcweir 
43cdf0e10cSrcweir class RscBaseCont : public RscTop
44cdf0e10cSrcweir {
45cdf0e10cSrcweir protected:
46cdf0e10cSrcweir     RscTop *        pTypeClass; // Typ der Eintraege
47cdf0e10cSrcweir     RscTop *        pTypeClass1;// Zwei verschiedene Typen moeglich
48cdf0e10cSrcweir     sal_Bool            bNoId;      // Keine Identifier
49cdf0e10cSrcweir     sal_uInt32          nSize;      // Groesse der Instanzdaten dieser Klasse
50cdf0e10cSrcweir                                 // mit Superklassen
51cdf0e10cSrcweir     sal_uInt32          nOffInstData;// Offset auf eigen Instanzdaten
52cdf0e10cSrcweir     void            DestroyElements( RscBaseContInst * pClassData );
53cdf0e10cSrcweir     RSCINST         SearchElePos( const RSCINST & rInst, const RscId & rEleName,
54cdf0e10cSrcweir                                   RscTop * pClass, sal_uInt32 nPos );
55cdf0e10cSrcweir protected:
56cdf0e10cSrcweir     void            ContWriteSrc( const RSCINST & rInst, FILE * fOutput,
57cdf0e10cSrcweir                                   RscTypCont * pTC, sal_uInt32 nTab, const char * );
58cdf0e10cSrcweir     ERRTYPE         ContWriteRc( const RSCINST & rInst, RscWriteRc & aMem,
59cdf0e10cSrcweir                                  RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
60cdf0e10cSrcweir 	void			ContWriteRcAccess( FILE * fOutput, RscTypCont * pTC,
61cdf0e10cSrcweir 										const char *, sal_Bool nWriteSize );
62cdf0e10cSrcweir public:
63cdf0e10cSrcweir                     RscBaseCont( Atom nId, sal_uInt32 nTypId,
64cdf0e10cSrcweir                                  RscTop * pSuper = NULL,
65cdf0e10cSrcweir                                  sal_Bool bNoId = sal_True );
66cdf0e10cSrcweir                     ~RscBaseCont();
67cdf0e10cSrcweir 	virtual RSCCLASS_TYPE   GetClassType() const;
SetTypeClass(RscTop * pClass,RscTop * pClass1=NULL)68cdf0e10cSrcweir     void            SetTypeClass( RscTop * pClass, RscTop * pClass1 = NULL )
69cdf0e10cSrcweir 					{
70cdf0e10cSrcweir                         pTypeClass = pClass;
71cdf0e10cSrcweir                         pTypeClass1 = pClass1;
72cdf0e10cSrcweir                     };
73cdf0e10cSrcweir     RSCINST         Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool );
74cdf0e10cSrcweir     void            Destroy( const RSCINST & rInst );
75cdf0e10cSrcweir     ERRTYPE         GetElement( const RSCINST & rInst, const RscId & rEleName,
76cdf0e10cSrcweir                                 RscTop * pCreateClass, const RSCINST & rCreateInst,
77cdf0e10cSrcweir                                 RSCINST * pGetInst );
78cdf0e10cSrcweir     RSCINST         SearchEle( const RSCINST & rInst, const RscId & rEleName,
79cdf0e10cSrcweir                                RscTop * pClass );
80cdf0e10cSrcweir     sal_uInt32          GetCount( const RSCINST & rInst );
81cdf0e10cSrcweir     RSCINST         GetPosEle( const RSCINST & rInst, sal_uInt32 nPos );
82cdf0e10cSrcweir     ERRTYPE         MovePosEle( const RSCINST & rInst, sal_uInt32 nDestPos,
83cdf0e10cSrcweir                                 sal_uInt32 nSourcePos );
84cdf0e10cSrcweir     virtual ERRTYPE SetPosRscId( const RSCINST & rInst, sal_uInt32 nPos,
85cdf0e10cSrcweir                                  const RscId & rRscId);
86cdf0e10cSrcweir     SUBINFO_STRUCT  GetInfoEle( const RSCINST & rInst, sal_uInt32 nPos );
87cdf0e10cSrcweir     ERRTYPE         SetString( const RSCINST &, const char * pStr );
88cdf0e10cSrcweir     ERRTYPE         SetNumber( const RSCINST &, sal_Int32 lValue );
89cdf0e10cSrcweir 	ERRTYPE 		SetBool( const RSCINST & rInst, sal_Bool bValue );
90cdf0e10cSrcweir 	ERRTYPE 		SetConst( const RSCINST & rInst, Atom nValueId,
91cdf0e10cSrcweir 							  sal_Int32 nValue );
92cdf0e10cSrcweir     ERRTYPE         SetRef( const RSCINST & rInst, const RscId & rRefId );
93cdf0e10cSrcweir 
94cdf0e10cSrcweir                     // Gibt die Groesse der Klasse in Bytes
Size()95cdf0e10cSrcweir     sal_uInt32          Size(){ return( nSize ); };
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     sal_Bool            IsConsistent( const RSCINST & rInst, RscInconsList * pList );
98cdf0e10cSrcweir 	void			SetToDefault( const RSCINST & rInst );
99cdf0e10cSrcweir     sal_Bool            IsDefault( const RSCINST & rInst );
100cdf0e10cSrcweir     sal_Bool            IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
101cdf0e10cSrcweir 
102cdf0e10cSrcweir     void            Delete( const RSCINST & rInst, RscTop * pClass,
103cdf0e10cSrcweir                             const RscId & rId );
104cdf0e10cSrcweir     void            DeletePos( const RSCINST & rInst, sal_uInt32 nPos );
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     void            WriteSrc( const RSCINST & rInst, FILE * fOutput,
107cdf0e10cSrcweir                               RscTypCont * pTC, sal_uInt32 nTab, const char * );
108cdf0e10cSrcweir     ERRTYPE         WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
109cdf0e10cSrcweir                              RscTypCont * pTC, sal_uInt32 , sal_Bool bExtra);
110cdf0e10cSrcweir     ERRTYPE         WriteHxx( const RSCINST & rInst, FILE * fOutput,
111cdf0e10cSrcweir                               RscTypCont * pTC, const RscId & rId );
112cdf0e10cSrcweir     ERRTYPE         WriteCxx( const RSCINST & rInst, FILE * fOutput,
113cdf0e10cSrcweir                               RscTypCont * pTC, const RscId &rId );
114cdf0e10cSrcweir };
115cdf0e10cSrcweir 
116cdf0e10cSrcweir /******************* R s c C o n t W r i t e S r c ***********************/
117cdf0e10cSrcweir class RscContWriteSrc : public RscBaseCont
118cdf0e10cSrcweir {
119cdf0e10cSrcweir public:
120cdf0e10cSrcweir                     RscContWriteSrc( Atom nId, sal_uInt32 nTypId,
121cdf0e10cSrcweir                                      RscTop * pSuper = NULL,
122cdf0e10cSrcweir                                      sal_Bool bNoId = sal_True );
123cdf0e10cSrcweir     void            WriteSrc( const RSCINST & rInst, FILE * fOutput,
124cdf0e10cSrcweir                               RscTypCont * pTC, sal_uInt32 nTab, const char * );
125cdf0e10cSrcweir };
126cdf0e10cSrcweir 
127cdf0e10cSrcweir /******************* R s c C o n t ***************************************/
128cdf0e10cSrcweir class RscCont : public RscContWriteSrc {
129cdf0e10cSrcweir public:
130cdf0e10cSrcweir                     RscCont( Atom nId, sal_uInt32 nTypId,
131cdf0e10cSrcweir                              RscTop * pSuper = NULL,
132cdf0e10cSrcweir                              sal_Bool bNoId = sal_True );
133cdf0e10cSrcweir     ERRTYPE         WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
134cdf0e10cSrcweir                              RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
135cdf0e10cSrcweir 	void			WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
136cdf0e10cSrcweir 									const char * );
137cdf0e10cSrcweir };
138cdf0e10cSrcweir 
139cdf0e10cSrcweir /******************* R s c C o n t E x t r a D a t a *********************/
140cdf0e10cSrcweir class RscContExtraData : public RscContWriteSrc {
141cdf0e10cSrcweir public:
142cdf0e10cSrcweir                     RscContExtraData( Atom nId, sal_uInt32 nTypId,
143cdf0e10cSrcweir                              RscTop * pSuper = NULL,
144cdf0e10cSrcweir                              sal_Bool bNoId = sal_True );
145cdf0e10cSrcweir     ERRTYPE         WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
146cdf0e10cSrcweir                              RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
147cdf0e10cSrcweir };
148cdf0e10cSrcweir 
149cdf0e10cSrcweir #endif //_RSCCONT_HXX
150