fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / idl / inc / basobj.hxx
blob0bb8a79d93a437f47d91c5c0a9cad090cba87e66
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _BASOBJ_HXX
21 #define _BASOBJ_HXX
23 #include <tools/ref.hxx>
24 #include <bastype.hxx>
25 #include <tools/pstm.hxx>
27 class SvTokenStream;
28 class SvMetaObject;
29 class SvIdlDataBase;
31 typedef SvMetaObject * (*CreateMetaObjectType)();
32 #define IDL_WRITE_COMPILER 0x8000
33 #define IDL_WRITE_BROWSER 0x4000
34 #define IDL_WRITE_CALLING 0x2000
35 #define IDL_WRITE_MASK 0xE000
37 #define C_PREF "C_"
39 enum WriteType
41 WRITE_IDL, WRITE_ODL, WRITE_SLOTMAP, WRITE_C_HEADER, WRITE_C_SOURCE,
42 WRITE_CXX_HEADER, WRITE_CXX_SOURCE, WRITE_DOCU
45 enum
47 WA_METHOD = 0x1, WA_VARIABLE = 0x2, WA_ARGUMENT = 0x4,
48 WA_STRUCT = 0x8, WA_READONLY = 0x10
50 typedef int WriteAttribute;
52 #define SV_DECL_META_FACTORY1( Class, Super1, CLASS_ID ) \
53 SV_DECL_PERSIST1( Class, Super1, CLASS_ID )
55 #define SV_IMPL_META_FACTORY1( Class, Super1 ) \
56 SV_IMPL_PERSIST1( Class, Super1 )
58 class SvMetaObject : public SvPersistBase
60 public:
61 SV_DECL_META_FACTORY1( SvMetaObject, SvPersistBase, 14 )
62 SvMetaObject();
64 static void WriteTab( SvStream & rOutStm, sal_uInt16 nTab );
65 static sal_Bool TestAndSeekSpaceOnly( SvStream &, sal_uLong nBegPos );
66 static void Back2Delemitter( SvStream & );
67 static void WriteStars( SvStream & );
69 virtual sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
70 virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab );
72 virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
73 WriteType, WriteAttribute = 0 );
75 SV_DECL_IMPL_REF(SvMetaObject)
77 class SvMetaObjectMemberList : public SvDeclPersistList<SvMetaObject *> {};
79 class SvMetaObjectMemberStack
81 SvMetaObjectMemberList aList;
82 public:
83 SvMetaObjectMemberStack() {;}
85 void Push( SvMetaObject * pObj )
86 { aList.push_back( pObj ); }
87 SvMetaObject * Pop() { return aList.pop_back(); }
88 SvMetaObject * Top() const { return aList.back(); }
89 void Clear() { aList.clear(); }
90 sal_uLong Count() const { return aList.size(); }
92 SvMetaObject * Get( TypeId nType )
94 for( SvMetaObjectMemberList::reverse_iterator it = aList.rbegin(); it != aList.rend(); ++it )
95 if( (*it)->IsA( nType ) )
96 return *it;
97 return NULL;
101 class SvMetaName : public SvMetaObject
103 SvString aName;
104 SvHelpContext aHelpContext;
105 SvHelpText aHelpText;
106 SvString aConfigName;
107 SvString aDescription;
109 protected:
110 virtual sal_Bool ReadNameSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
111 void DoReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm,
112 char c = '\0' );
113 virtual void ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
114 virtual void WriteContextSvIdl( SvIdlDataBase & rBase,
115 SvStream & rOutStm, sal_uInt16 nTab );
116 virtual void ReadAttributesSvIdl( SvIdlDataBase & rBase,
117 SvTokenStream & rInStm );
118 virtual void WriteAttributesSvIdl( SvIdlDataBase & rBase,
119 SvStream & rOutStm, sal_uInt16 nTab );
120 virtual void WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
121 WriteType, WriteAttribute = 0);
122 virtual void WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
123 WriteType, WriteAttribute = 0);
124 public:
125 SV_DECL_META_FACTORY1( SvMetaName, SvMetaObject, 15 )
126 SvMetaName();
128 virtual sal_Bool SetName( const OString& rName, SvIdlDataBase * = NULL );
129 void SetDescription( const OString& rText )
130 { aDescription.setString(rText); }
131 const SvHelpContext& GetHelpContext() const { return aHelpContext; }
132 virtual const SvString & GetName() const { return aName; }
133 virtual const SvString & GetHelpText() const { return aHelpText; }
134 virtual const SvString & GetConfigName() const{ return aConfigName; }
135 virtual const SvString& GetDescription() const{ return aDescription; }
137 virtual sal_Bool Test( SvIdlDataBase &, SvTokenStream & rInStm );
138 virtual sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
139 virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab );
140 virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
141 WriteType, WriteAttribute = 0);
142 void WriteDescription( SvStream& rOutStm );
144 SV_DECL_IMPL_REF(SvMetaName)
146 class SvMetaNameMemberList : public SvDeclPersistList<SvMetaName *> {};
149 SV_DECL_REF(SvMetaReference)
150 class SvMetaReference : public SvMetaName
152 protected:
153 SvMetaReferenceRef aRef;
154 public:
155 SV_DECL_META_FACTORY1( SvMetaReference, SvMetaName, 17 )
156 SvMetaReference();
158 const SvString & GetName() const
160 return ( !aRef.Is()
161 || !SvMetaName::GetName().getString().isEmpty() )
162 ? SvMetaName::GetName()
163 : aRef->GetName();
166 const SvString & GetHelpText() const
168 return ( !aRef.Is()
169 || !SvMetaName::GetHelpText().getString().isEmpty() )
170 ? SvMetaName::GetHelpText()
171 : aRef->GetHelpText();
174 const SvString & GetConfigName() const
176 return ( !aRef.Is()
177 || !SvMetaName::GetConfigName().getString().isEmpty() )
178 ? SvMetaName::GetConfigName()
179 : aRef->GetConfigName();
182 const SvString & GetDescription() const
184 return ( !aRef.Is()
185 || !SvMetaName::GetDescription().getString().isEmpty() )
186 ? SvMetaName::GetDescription()
187 : aRef->GetDescription();
189 SvMetaReference * GetRef() const { return aRef; }
190 void SetRef( SvMetaReference * pRef )
191 { aRef = pRef; }
193 SV_IMPL_REF(SvMetaReference)
195 class SvMetaReferenceMemberList : public SvDeclPersistList<SvMetaReference *> {};
198 class SvMetaModule;
199 class SvMetaExtern : public SvMetaReference
201 SvMetaModule * pModule; // included in which module
203 SvUUId aUUId;
204 SvVersion aVersion;
205 sal_Bool bReadUUId;
206 sal_Bool bReadVersion;
207 public:
208 SV_DECL_META_FACTORY1( SvMetaExtern, SvMetaName, 16 )
209 SvMetaExtern();
211 SvMetaModule * GetModule() const;
213 const SvGlobalName &GetUUId() const;
214 const SvVersion & GetVersion() const { return aVersion; }
215 void SetModule( SvIdlDataBase & rBase );
216 virtual sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
217 virtual void WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab );
219 virtual void Write( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
220 WriteType, WriteAttribute = 0);
221 protected:
222 virtual void ReadAttributesSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
223 virtual void WriteAttributesSvIdl( SvIdlDataBase & rBase,
224 SvStream & rOutStm, sal_uInt16 nTab );
225 virtual void WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm, sal_uInt16 nTab,
226 WriteType, WriteAttribute = 0);
228 SV_DECL_IMPL_REF(SvMetaExtern)
230 class SvMetaExternMemberList : public SvDeclPersistList<SvMetaExtern *> {};
232 #endif // _BASOBJ_HXX
235 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */