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