xref: /aoo42x/main/idl/inc/object.hxx (revision 67e470da)
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 
24 #ifndef _OBJECT_HXX
25 #define _OBJECT_HXX
26 
27 #define _SVSTDARR_ULONGS
28 //#include <svtools/svstdarr.hxx>
29 #include <types.hxx>
30 #include <slot.hxx>
31 
32 struct SvSlotElement
33 {
34 	SvMetaSlotRef 	xSlot;
35 	ByteString			aPrefix;
SvSlotElementSvSlotElement36 			SvSlotElement( SvMetaSlot * pS, const ByteString & rPrefix )
37 				: xSlot( pS )
38 				, aPrefix( rPrefix )
39 		 	{}
40 };
41 DECLARE_LIST( SvSlotElementList, SvSlotElement* )
42 class SvMetaClass;
43 DECLARE_LIST( SvMetaClassList, SvMetaClass* )
44 
45 class SvULongs : public List
46 {
47 public:
Insert(sal_uLong & rId,sal_uLong nPos)48     void    Insert( sal_uLong& rId, sal_uLong nPos ) { sal_uLong nId(rId ); List::Insert( (void*) nId, nPos ); }
Remove(sal_uLong & rId)49     void    Remove( sal_uLong& rId ){ sal_uLong nId(rId ); List::Remove( (void*) nId ); }
GetObject(sal_uLong nPos)50     sal_uLong   GetObject( sal_uLong nPos ){ return (sal_uLong) List::GetObject( nPos ); }
51 };
52 
53 /******************** class SvClassElement *******************************/
54 SV_DECL_REF(SvMetaClass)
55 class SvClassElement : public SvPersistBase
56 {
57     SvBOOL          			aAutomation;
58 	ByteString						aPrefix;
59 	SvMetaClassRef				xClass;
60 public:
61             SV_DECL_PERSIST1( SvClassElement, SvPersistBase, 1 )
62             SvClassElement();
63 
SetPrefix(const ByteString & rPrefix)64 	void			SetPrefix( const ByteString & rPrefix )
65 					{ aPrefix = rPrefix; }
GetPrefix() const66 	const ByteString &	GetPrefix() const
67 					{ return aPrefix; }
68 
SetAutomation(sal_Bool rAutomation)69 	void			SetAutomation( sal_Bool rAutomation )
70 					{ aAutomation = rAutomation; }
GetAutomation() const71 	sal_Bool			GetAutomation() const
72 					{ return aAutomation; }
73 
SetClass(SvMetaClass * pClass)74 	void			SetClass( SvMetaClass * pClass )
75 					{ xClass = pClass; }
GetClass() const76 	SvMetaClass *	GetClass() const
77 					{ return xClass; }
78 };
79 
80 SV_DECL_IMPL_REF(SvClassElement)
81 SV_DECL_IMPL_PERSIST_LIST(SvClassElement,SvClassElement *)
82 
83 /******************** class SvMetaClass *********************************/
84 class SvMetaModule;
85 SV_DECL_PERSIST_LIST(SvMetaClass,SvMetaClass *)
86 class SvMetaClass : public SvMetaType
87 {
88     SvMetaAttributeMemberList 	aAttrList;
89     SvClassElementMemberList 	aClassList;
90 	SvMetaClassRef				aSuperClass;
91     SvBOOL          			aAutomation;
92 	SvMetaClassRef				xAutomationInterface;
93 
94 //    void                FillSbxMemberObject( SvIdlDataBase & rBase,
95 //                                            SbxObject *, StringList &,
96 //                                            sal_Bool bVariable );
97 	sal_Bool 				TestAttribute( SvIdlDataBase & rBase, SvTokenStream & rInStm,
98 									 SvMetaAttribute & rAttr ) const;
99 #ifdef IDL_COMPILER
100 	void 				WriteSlotStubs( const ByteString & rShellName,
101 										SvSlotElementList & rSlotList,
102                                         ByteStringList & rList,
103 										SvStream & rOutStm );
104 	sal_uInt16  			WriteSlotParamArray( SvIdlDataBase & rBase,
105 											SvSlotElementList & rSlotList,
106 											SvStream & rOutStm );
107 	sal_uInt16				WriteSlots( const ByteString & rShellName, sal_uInt16 nCount,
108 									SvSlotElementList & rSlotList,
109 									SvIdlDataBase & rBase,
110 									SvStream & rOutStm );
111 
112 	void				InsertSlots( SvSlotElementList& rList, SvULongs& rSuperList,
113 									SvMetaClassList & rClassList,
114 									const ByteString & rPrefix, SvIdlDataBase& rBase );
115 
116 protected:
117 	virtual void 	ReadAttributesSvIdl( SvIdlDataBase & rBase,
118 				 				 	SvTokenStream & rInStm );
119 	virtual void 	WriteAttributesSvIdl( SvIdlDataBase & rBase,
120 									SvStream & rOutStm, sal_uInt16 nTab );
121     virtual void    ReadContextSvIdl( SvIdlDataBase &,
122 					 				SvTokenStream & rInStm );
123     virtual void	WriteContextSvIdl( SvIdlDataBase & rBase,
124 									 SvStream & rOutStm, sal_uInt16 nTab );
125     void            WriteOdlMembers( ByteStringList & rSuperList,
126 									sal_Bool bVariable, sal_Bool bWriteTab,
127 									SvIdlDataBase & rBase,
128 									SvStream & rOutStm, sal_uInt16 nTab );
129 #endif
130 public:
131             SV_DECL_META_FACTORY1( SvMetaClass, SvMetaType, 6 )
132             SvMetaClass();
133 
GetAutomation() const134     sal_Bool                GetAutomation() const
135             			{ return aAutomation; }
GetSuperClass() const136 	SvMetaClass *		GetSuperClass() const
137 						{ return aSuperClass; }
138 
139 	void				FillClasses( SvMetaClassList & rList );
140 //    virtual void        FillSbxObject( SvIdlDataBase & rBase, SbxObject * );
141 
142     const SvClassElementMemberList&
GetClassList() const143 						GetClassList() const
144 						{ return aClassList; }
145 
146 #ifdef IDL_COMPILER
147     virtual sal_Bool        ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
148     virtual void        WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab );
149 	virtual void 		Write( SvIdlDataBase & rBase, SvStream & rOutStm,
150 			    			 	sal_uInt16 nTab,
151 	 						 	WriteType, WriteAttribute = 0 );
152 	virtual void		WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm );
153 	virtual void		WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm,
154 								Table* pTable );
155 	virtual void		WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm,
156                              	Table * pTable );
157 	virtual void        WriteCxx( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab );
158 	virtual void        WriteHxx( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab );
159 #endif
160 };
161 SV_IMPL_REF(SvMetaClass)
162 SV_IMPL_PERSIST_LIST(SvMetaClass,SvMetaClass *)
163 
164 
165 #endif // _OBJECT_HXX
166 
167