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