xref: /aoo41x/main/rsc/inc/rscclass.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _RSCCLASS_HXX
28 #define _RSCCLASS_HXX
29 
30 #include <rscall.h>
31 #include <rscerror.h>
32 #include <rschash.hxx>
33 #include <rsctop.hxx>
34 
35 /******************* R s c C l a s s *************************************/
36 class RscClass : public RscTop
37 {
38 protected:
39     struct RscClassInst{
40         sal_uLong   nVarDflt;
41     };
42     struct VARTYPE_STRUCT {
43         Atom            nVarName;   // Variablenname
44         RSCVAR          nVarType;   // Variablentyp
45         sal_uInt32      nMask;      // Maskierungsbit
46         sal_uInt32      nOffset;    // Beginn der Instanzdaten
47         RscTop *        pClass;     // Klasse
48         CLASS_DATA      pDefault;   // Zeiger auf DefaultDaten
49         Atom            nDataBaseName;//Name fuer Fremddatenbereich
50     };
51     sal_uInt32              nSuperSize; // Groesse der Instanzdaten der SuperKl.
52     sal_uInt32              nSize;      // Groesse der Instanzdaten dieser Klasse
53                                     // mit Superklassen
54     sal_uInt32              nEntries;   // Eintraege in pVarTypeList
55     VARTYPE_STRUCT *    pVarTypeList;   // Variablenliste
56     RSCINST             GetInstData( CLASS_DATA pData, sal_uInt32 nEle,
57                                      sal_Bool bGetCopy = sal_False );
58     CLASS_DATA          GetDfltData( sal_uInt32 nEle );
59     sal_Bool                IsDflt( CLASS_DATA pData, sal_uInt32 nEle );
60     sal_Bool                IsValueDflt( CLASS_DATA pData, sal_uInt32 nEle );
61     void                SetVarDflt( CLASS_DATA pData, sal_uInt32 nEle,
62                                     sal_Bool bSet );
63     sal_Int32               GetCorrectValues( const RSCINST & rInst, sal_uInt32 nVarPos,
64                                         sal_uInt32 nTupelIdx, RscTypCont * pTC );
65 public:
66                     RscClass( Atom nId, sal_uInt32 nTypId, RscTop * pSuperCl );
67                     ~RscClass();
68 
69     virtual RSCCLASS_TYPE   GetClassType() const;
70 
71     void            Pre_dtor();
72     ERRTYPE         SetVariable( Atom nVarName, RscTop * pClass,
73                                  RSCINST * pDflt,
74                                  RSCVAR nVarType, sal_uInt32 nMask,
75                                  Atom nDataBaseName );
76     virtual void    EnumVariables( void * pData, VarEnumCallbackProc );
77     RSCINST         GetVariable( const RSCINST & rInst, Atom nVarName,
78                                  const RSCINST & rInitInst,
79                                  sal_Bool nInitDflt = sal_False,
80 								 RscTop * pCreateClass = NULL );
81     RSCINST         GetCopyVar( const RSCINST & rInst, Atom nVarName );
82 
83                     // Gibt die Groesse der Klasse in Bytes
84     sal_uInt32          Size(){ return( nSize ); };
85 
86     sal_Bool            IsConsistent( const RSCINST & rInst, RscInconsList * pList );
87     void            SetToDefault( const RSCINST & rInst );
88     sal_Bool            IsDefault( const RSCINST & rInst );
89     sal_Bool            IsValueDefault( const RSCINST & rInst, CLASS_DATA pDef );
90     void            SetDefault( const RSCINST & rData, Atom nVarId );
91     using RscTop::GetDefault;
92     RSCINST         GetDefault( Atom nVarId );
93 
94     RSCINST         Create( RSCINST * pInst, const RSCINST & rDflt, sal_Bool );
95     void            Destroy( const RSCINST & rInst );
96     void            WriteSrc( const RSCINST & rInst, FILE * fOutput,
97                               RscTypCont * pTC, sal_uInt32 nTab, const char * );
98     ERRTYPE         WriteInstRc( const RSCINST & rInst, RscWriteRc & aMem,
99                                  RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
100     ERRTYPE         WriteRc( const RSCINST & rInst, RscWriteRc & aMem,
101                              RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
102     void            WriteSyntax( FILE * fOutput, RscTypCont * pTC );
103 
104 	void			WriteRcAccess( FILE * fOutput, RscTypCont * pTC,
105 								const char * );
106 	void			WriteRcCtor( FILE * fOutput, RscTypCont * pTC );
107 };
108 
109 class RscSysDepend : public RscClass
110 {
111 public:
112                     RscSysDepend( Atom nId, sal_uInt32 nTypId, RscTop * pSuper );
113     ERRTYPE         WriteSysDependRc( const RSCINST &, RscWriteRc & aMem,
114                                     RscTypCont * pTC, sal_uInt32, sal_Bool bExtra,
115                                     sal_Bool bFirst = sal_False );
116     ERRTYPE         WriteRc( const RSCINST &, RscWriteRc & aMem,
117                              RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
118 };
119 
120 class RscFirstSysDepend : public RscSysDepend
121 {
122 public:
123                     RscFirstSysDepend( Atom nId, sal_uInt32 nTypId,
124                                         RscTop * pSuper );
125     ERRTYPE         WriteRc( const RSCINST &, RscWriteRc & aMem,
126                              RscTypCont * pTC, sal_uInt32, sal_Bool bExtra );
127 };
128 
129 class RscTupel : public RscClass
130 {
131 public:
132     RscTupel( Atom nId, sal_uInt32 nTypId, RscTop * pSuper );
133     RSCINST         GetTupelVar( const RSCINST & rInst, sal_uInt32 nPos,
134                                 const RSCINST & rInitInst );
135     void            WriteSrc( const RSCINST & rInst, FILE * fOutput,
136                               RscTypCont * pTC, sal_uInt32 nTab, const char * );
137 };
138 
139 #endif //_RSCCLASS_HXX
140