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