Branch data 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 : :
20 : :
21 : : #include <ctype.h>
22 : : #include <stdio.h>
23 : :
24 : : #include <tools/debug.hxx>
25 : :
26 : : #include <types.hxx>
27 : : #include <globals.hxx>
28 : : #include <database.hxx>
29 : :
30 [ # # ][ # # ]: 9518 : SV_IMPL_META_FACTORY1( SvMetaAttribute, SvMetaReference );
[ # # ][ # # ]
[ # # ][ - + ]
[ - + ]
31 : 35102 : SvMetaAttribute::SvMetaAttribute()
32 : : : aAutomation( sal_True, sal_False )
33 : : , aExport( sal_True, sal_False )
34 : : , aIsCollection ( sal_False, sal_False )
35 : : , aReadOnlyDoc ( sal_True, sal_False )
36 : : , aHidden( sal_False, sal_False )
37 : 35102 : , bNewAttr( sal_False )
38 : : {
39 : 35102 : }
40 : :
41 : 8014 : SvMetaAttribute::SvMetaAttribute( SvMetaType * pType )
42 : : : aType( pType )
43 : : , aAutomation( sal_True, sal_False )
44 : : , aExport( sal_True, sal_False )
45 : : , aIsCollection ( sal_False, sal_False)
46 : : , aReadOnlyDoc ( sal_True, sal_False)
47 : : , aHidden( sal_False, sal_False )
48 : 8014 : , bNewAttr( sal_False )
49 : : {
50 : 8014 : }
51 : :
52 : 0 : void SvMetaAttribute::Load( SvPersistStream & rStm )
53 : : {
54 [ # # ]: 0 : SvMetaReference::Load( rStm );
55 : :
56 : : sal_uInt8 nMask;
57 [ # # ]: 0 : rStm >> nMask;
58 [ # # ]: 0 : if( nMask & 0x01 )
59 : : {
60 : : SvMetaType * pType;
61 [ # # ]: 0 : rStm >> pType;
62 [ # # ]: 0 : aType = pType;
63 : : }
64 [ # # ][ # # ]: 0 : if( nMask & 0x02 ) rStm >> aSlotId;
65 [ # # ][ # # ]: 0 : if( nMask & 0x04 ) rStm >> aExport;
66 [ # # ][ # # ]: 0 : if( nMask & 0x08 ) rStm >> aReadonly;
67 [ # # ][ # # ]: 0 : if( nMask & 0x10 ) rStm >> aAutomation;
68 [ # # ][ # # ]: 0 : if( nMask & 0x20 ) rStm >> aIsCollection;
69 [ # # ][ # # ]: 0 : if( nMask & 0x40 ) rStm >> aReadOnlyDoc;
70 [ # # ][ # # ]: 0 : if( nMask & 0x80 ) rStm >> aHidden;
71 : 0 : }
72 : :
73 : 33076 : void SvMetaAttribute::Save( SvPersistStream & rStm )
74 : : {
75 : 33076 : SvMetaReference::Save( rStm );
76 : :
77 : : // create mask
78 : 33076 : sal_uInt8 nMask = 0;
79 [ + + ]: 33076 : if( aType.Is() ) nMask |= 0x1;
80 [ + + ]: 33076 : if( aSlotId.IsSet() ) nMask |= 0x2;
81 [ + + ]: 33076 : if( aExport.IsSet() ) nMask |= 0x4;
82 [ + + ]: 33076 : if( aReadonly.IsSet() ) nMask |= 0x8;
83 [ - + ]: 33076 : if( aAutomation.IsSet() ) nMask |= 0x10;
84 [ + + ]: 33076 : if( aIsCollection.IsSet() ) nMask |= 0x20;
85 [ + + ]: 33076 : if( aReadOnlyDoc.IsSet() ) nMask |= 0x40;
86 [ - + ]: 33076 : if( aHidden.IsSet() ) nMask |= 0x80;
87 : :
88 : : // write data
89 : 33076 : rStm << nMask;
90 [ + + ]: 33076 : if( nMask & 0x1 ) rStm << aType;
91 [ + + ]: 33076 : if( nMask & 0x2 ) rStm << aSlotId;
92 [ + + ]: 33076 : if( nMask & 0x4 ) rStm << aExport;
93 [ + + ]: 33076 : if( nMask & 0x8 ) rStm << aReadonly;
94 [ - + ]: 33076 : if( nMask & 0x10 ) rStm << aAutomation;
95 [ + + ]: 33076 : if( nMask & 0x20 ) rStm << aIsCollection;
96 [ + + ]: 33076 : if( nMask & 0x40 ) rStm << aReadOnlyDoc;
97 [ - + ]: 33076 : if( nMask & 0x80 ) rStm << aHidden;
98 : 33076 : }
99 : :
100 : 526966 : SvMetaType * SvMetaAttribute::GetType() const
101 : : {
102 [ + + ][ + + ]: 526966 : if( aType.Is() || !GetRef() ) return aType;
[ + + ]
103 : 526966 : return ((SvMetaAttribute *)GetRef())->GetType();
104 : : }
105 : :
106 : 17414090 : const SvNumberIdentifier & SvMetaAttribute::GetSlotId() const
107 : : {
108 [ + + ][ + + ]: 17414090 : if( aSlotId.IsSet() || !GetRef() ) return aSlotId;
[ + + ]
109 : 17414090 : return ((SvMetaAttribute *)GetRef())->GetSlotId();
110 : : }
111 : :
112 : 8744 : sal_Bool SvMetaAttribute::GetReadonly() const
113 : : {
114 [ + + ][ + + ]: 8744 : if( aReadonly.IsSet() || !GetRef() ) return aReadonly;
[ + + ]
115 : 8744 : return ((SvMetaAttribute *)GetRef())->GetReadonly();
116 : : }
117 : :
118 : 82616 : sal_Bool SvMetaAttribute::GetExport() const
119 : : {
120 [ + + ][ + + ]: 82616 : if( aExport.IsSet() || !GetRef() ) return aExport;
[ + + ]
121 : 82616 : return ((SvMetaAttribute *)GetRef())->GetExport();
122 : : }
123 : :
124 : 3120 : sal_Bool SvMetaAttribute::GetHidden() const
125 : : {
126 : : // when export is set, but hidden is not the default is used
127 [ + - ][ + - ]: 3120 : if ( aExport.IsSet() && !aHidden.IsSet() )
[ + - ]
128 : 3120 : return !aExport;
129 [ # # ][ # # ]: 0 : else if( aHidden.IsSet() || !GetRef() )
[ # # ]
130 : 0 : return aHidden;
131 : : else
132 : 3120 : return ((SvMetaAttribute *)GetRef())->GetHidden();
133 : : }
134 : :
135 : 0 : sal_Bool SvMetaAttribute::GetAutomation() const
136 : : {
137 [ # # ][ # # ]: 0 : if( aAutomation.IsSet() || !GetRef() ) return aAutomation;
[ # # ]
138 : 0 : return ((SvMetaAttribute *)GetRef())->GetAutomation();
139 : : }
140 : :
141 : 0 : sal_Bool SvMetaAttribute::GetIsCollection() const
142 : : {
143 : : sal_Bool bRet;
144 [ # # ][ # # ]: 0 : if( aIsCollection.IsSet() || !GetRef() )
[ # # ]
145 : : {
146 [ # # ]: 0 : if ( aIsCollection.IsSet() )
147 : : {
148 : 0 : bRet = aIsCollection;
149 : 0 : return bRet;
150 : : }
151 : :
152 : 0 : return aIsCollection;
153 : : }
154 : :
155 : 0 : return ((SvMetaSlot *)GetRef())->GetIsCollection();
156 : : }
157 : :
158 : 21736 : sal_Bool SvMetaAttribute::GetReadOnlyDoc() const
159 : : {
160 [ + + ][ - + ]: 21736 : if( aReadOnlyDoc.IsSet() || !GetRef() ) return aReadOnlyDoc;
[ + + ]
161 : 21736 : return ((SvMetaSlot *)GetRef())->GetReadOnlyDoc();
162 : : }
163 : :
164 : 43596 : sal_Bool SvMetaAttribute::IsMethod() const
165 : : {
166 : 43596 : SvMetaType * pType = GetType();
167 : : DBG_ASSERT( pType, "no type for attribute" );
168 : 43596 : return pType->GetType() == TYPE_METHOD;
169 : : }
170 : :
171 : 30484 : sal_Bool SvMetaAttribute::IsVariable() const
172 : : {
173 : 30484 : SvMetaType * pType = GetType();
174 : 30484 : return pType->GetType() != TYPE_METHOD;
175 : : }
176 : :
177 : 0 : rtl::OString SvMetaAttribute::GetMangleName( sal_Bool ) const
178 : : {
179 : 0 : return GetName().getString();
180 : : }
181 : :
182 : 33076 : sal_Bool SvMetaAttribute::Test( SvIdlDataBase & rBase,
183 : : SvTokenStream & rInStm )
184 : : {
185 : 33076 : sal_Bool bOk = sal_True;
186 [ + + ][ - + ]: 33076 : if( GetType()->IsItem() && !GetSlotId().IsSet() )
[ - + ]
187 : : {
188 [ # # ]: 0 : rBase.SetError( "slot without id declared", rInStm.GetToken() );
189 : 0 : rBase.WriteError( rInStm );
190 : 0 : bOk = sal_False;
191 : : }
192 : 33076 : return bOk;
193 : : }
194 : :
195 : 35572 : sal_Bool SvMetaAttribute::ReadSvIdl( SvIdlDataBase & rBase,
196 : : SvTokenStream & rInStm )
197 : : {
198 : 35572 : sal_uInt32 nTokPos = rInStm.Tell();
199 [ + + ]: 35572 : if( !GetType() )
200 : : // no type in ctor passed on
201 : 35488 : aType = rBase.ReadKnownType( rInStm );
202 : 35572 : sal_Bool bOk = sal_False;
203 [ + + ]: 35572 : if( GetType() )
204 : : {
205 : 25532 : ReadNameSvIdl( rBase, rInStm );
206 : 25532 : aSlotId.ReadSvIdl( rBase, rInStm );
207 : :
208 : 25532 : bOk = sal_True;
209 : 25532 : SvToken * pTok = rInStm.GetToken();
210 [ + + ][ + + ]: 25532 : if( bOk && pTok->IsChar() && pTok->GetChar() == '(' )
[ + + ][ + - ]
211 : : {
212 [ + - ][ + - ]: 8758 : SvMetaTypeRef xT = new SvMetaType();
213 [ + - ][ + - ]: 8758 : xT->SetRef( GetType() );
214 [ + - ]: 8758 : aType = xT;
215 [ + - ][ + - ]: 8758 : bOk = aType->ReadMethodArgs( rBase, rInStm );
216 : : }
217 [ + - ]: 25532 : if( bOk )
218 : 25532 : bOk = SvMetaName::ReadSvIdl( rBase, rInStm );
219 : : }
220 : : else
221 [ + - ]: 10040 : rBase.SetError( "unknown type", rInStm.GetToken() );
222 : :
223 [ + + ]: 35572 : if( !bOk )
224 : 10040 : rInStm.Seek( nTokPos );
225 : 35572 : return bOk;
226 : : }
227 : :
228 : 36042 : void SvMetaAttribute::WriteSvIdl
229 : : (
230 : : SvIdlDataBase & rBase,
231 : : SvStream & rOutStm,
232 : : sal_uInt16 nTab
233 : : )
234 : : {
235 : 36042 : SvMetaType * pType = GetType();
236 : 36042 : pType->WriteTypePrefix( rBase, rOutStm, nTab, WRITE_IDL );
237 : 36042 : rOutStm << ' ' << GetName().getString().getStr();
238 [ + + ]: 36042 : if( aSlotId.IsSet() )
239 : 28498 : rOutStm << ' ' << aSlotId.getString().getStr();
240 [ + + ]: 36042 : if( pType->GetType() == TYPE_METHOD )
241 : 13256 : pType->WriteMethodArgs( rBase, rOutStm, nTab, WRITE_IDL );
242 : 36042 : sal_uLong nPos = rOutStm.Tell();
243 : 36042 : rOutStm << endl;
244 : 36042 : SvMetaName::WriteSvIdl( rBase, rOutStm, nTab );
245 : 36042 : TestAndSeekSpaceOnly( rOutStm, nPos );
246 : 36042 : }
247 : :
248 : 320560 : void SvMetaAttribute::ReadAttributesSvIdl( SvIdlDataBase & rBase,
249 : : SvTokenStream & rInStm )
250 : : {
251 : 320560 : SvMetaReference::ReadAttributesSvIdl( rBase, rInStm );
252 : 320560 : aSlotId.ReadSvIdl( rBase, SvHash_SlotId(), rInStm );
253 : 320560 : aExport.ReadSvIdl( SvHash_Export(), rInStm );
254 : 320560 : aHidden.ReadSvIdl( SvHash_Hidden(), rInStm );
255 : 320560 : aAutomation.ReadSvIdl( SvHash_Automation(), rInStm );
256 : 320560 : aIsCollection.ReadSvIdl( SvHash_IsCollection(), rInStm );
257 : 320560 : aReadOnlyDoc.ReadSvIdl( SvHash_ReadOnlyDoc(), rInStm );
258 [ + + ]: 320560 : if( aReadonly.ReadSvIdl( SvHash_Readonly(), rInStm ) )
259 : : {
260 [ - + ]: 6804 : if( GetType()->GetType() == TYPE_METHOD )
261 : : {
262 : : // set error
263 [ # # ]: 0 : rBase.SetError( "Readonly in function attribute", rInStm.GetToken() );
264 : 0 : rBase.WriteError( rInStm );
265 : : }
266 : : }
267 : 320560 : }
268 : :
269 : 36042 : void SvMetaAttribute::WriteAttributesSvIdl
270 : : (
271 : : SvIdlDataBase & rBase,
272 : : SvStream & rOutStm,
273 : : sal_uInt16 nTab
274 : : )
275 : : {
276 : 36042 : SvMetaReference::WriteAttributesSvIdl( rBase, rOutStm, nTab );
277 : :
278 [ + - ][ + + ]: 36042 : if( !aExport || !aAutomation || aReadonly )
[ + + ][ + + ]
279 : : {
280 : 1462 : WriteTab( rOutStm, nTab );
281 : 1462 : rOutStm << "//class SvMetaAttribute" << endl;
282 [ + + ]: 1462 : if( !aExport )
283 : : {
284 : 880 : WriteTab( rOutStm, nTab );
285 : 880 : aExport.WriteSvIdl( SvHash_Export(), rOutStm );
286 : 880 : rOutStm << ';' << endl;
287 : : }
288 [ + + ]: 1462 : if ( aHidden != aExport )
289 : : {
290 : 582 : WriteTab( rOutStm, nTab );
291 : 582 : aExport.WriteSvIdl( SvHash_Hidden(), rOutStm );
292 : 582 : rOutStm << ';' << endl;
293 : : }
294 [ + + ]: 1462 : if( aReadonly )
295 : : {
296 : 582 : WriteTab( rOutStm, nTab );
297 : 582 : aReadonly.WriteSvIdl( SvHash_Readonly(), rOutStm );
298 : 582 : rOutStm << ';' << endl;
299 : : }
300 [ - + ]: 1462 : if( !aAutomation )
301 : : {
302 : 0 : WriteTab( rOutStm, nTab );
303 : 0 : aAutomation.WriteSvIdl( SvHash_Automation(), rOutStm );
304 : 0 : rOutStm << ';' << endl;
305 : : }
306 [ + + ]: 1462 : if( aIsCollection )
307 : : {
308 : 2 : WriteTab( rOutStm, nTab );
309 : 2 : aIsCollection.WriteSvIdl( SvHash_IsCollection(), rOutStm );
310 : 2 : rOutStm << ';' << endl;
311 : : }
312 [ + + ]: 1462 : if( !aReadOnlyDoc )
313 : : {
314 : 68 : WriteTab( rOutStm, nTab );
315 : 68 : aReadOnlyDoc.WriteSvIdl( SvHash_ReadOnlyDoc(), rOutStm );
316 : 68 : rOutStm << ';' << endl;
317 : : }
318 : : }
319 : 36042 : }
320 : :
321 : 0 : void SvMetaAttribute::WriteParam( SvIdlDataBase & rBase,
322 : : SvStream & rOutStm,
323 : : sal_uInt16 nTab,
324 : : WriteType nT )
325 : : {
326 : 0 : SvMetaType * pType = GetType();
327 : : DBG_ASSERT( pType, "no type for attribute" );
328 : 0 : SvMetaType * pBaseType = pType->GetBaseType();
329 : : DBG_ASSERT( pBaseType, "no base type for attribute" );
330 : :
331 [ # # ][ # # ]: 0 : if( nT == WRITE_ODL || nT == WRITE_DOCU
[ # # ][ # # ]
332 : : || nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
333 : : {
334 [ # # ]: 0 : if( pBaseType->GetType() == TYPE_STRUCT )
335 : : {
336 : 0 : const SvMetaAttributeMemberList & rList = pBaseType->GetAttrList();
337 : 0 : sal_uLong nCount = rList.size();
338 [ # # ]: 0 : for( sal_uLong i = 0; i < nCount; i++ )
339 : : {
340 : 0 : rList[i]->WriteParam( rBase, rOutStm, nTab, nT );
341 [ # # ]: 0 : if( i+1<nCount )
342 : : {
343 : 0 : rOutStm << ',';
344 : : }
345 : : }
346 : : }
347 : : else
348 : : {
349 [ # # ]: 0 : if ( nT != WRITE_DOCU )
350 : : {
351 : 0 : WriteTab( rOutStm, nTab );
352 : 0 : pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
353 : : }
354 : :
355 [ # # ]: 0 : if( !GetName().getString().isEmpty() )
356 : : {
357 : 0 : rOutStm << ' ';
358 : 0 : rOutStm << GetName().getString().getStr();
359 : : }
360 : :
361 [ # # ]: 0 : if ( nT == WRITE_DOCU )
362 : : {
363 [ # # # # : 0 : if( pBaseType->GetType() == TYPE_METHOD ||
# # ][ # # ]
364 : 0 : pBaseType->GetType() == TYPE_STRUCT ||
365 : 0 : pBaseType->GetType() == TYPE_ENUM )
366 : : {
367 : : OSL_FAIL( "Falscher Parametertyp!" );
368 : : }
369 : : else
370 [ # # ]: 0 : rOutStm << pBaseType->GetBasicPostfix().getStr();
371 : : }
372 : : }
373 : : }
374 : 0 : }
375 : :
376 : 0 : sal_uLong SvMetaAttribute::MakeSlotValue( SvIdlDataBase & rBase, sal_Bool bVar ) const
377 : : {
378 : 0 : const SvNumberIdentifier & rId = GetSlotId();
379 : 0 : sal_uLong n = rId.GetValue();
380 [ # # ]: 0 : if( !rBase.aStructSlotId.getString().isEmpty() )
381 : : {
382 : 0 : n = n << 20;
383 : 0 : n += rBase.aStructSlotId.GetValue();
384 : : }
385 [ # # ][ # # ]: 0 : if( PTR_CAST( SvMetaSlot, this ) )
[ # # ][ # # ]
386 : 0 : n |= 0x20000;
387 [ # # ]: 0 : if( !bVar )
388 : 0 : n += 0x10000;
389 [ # # ]: 0 : else if ( GetIsCollection() )
390 : 0 : n += 0x40000;
391 : 0 : return n;
392 : : }
393 : :
394 : 0 : void SvMetaAttribute::WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm,
395 : : sal_uInt16 nTab,
396 : : WriteType nT, WriteAttribute nA )
397 : : {
398 [ # # ]: 0 : if( nT == WRITE_ODL )
399 : : {
400 : 0 : const SvNumberIdentifier & rId = GetSlotId();
401 [ # # ][ # # ]: 0 : sal_Bool bReadonly = GetReadonly() || ( nA & WA_READONLY );
402 [ # # ][ # # ]: 0 : if( (rId.IsSet() && !(nA & WA_STRUCT)) || bReadonly )
[ # # ][ # # ]
403 : : {
404 : 0 : sal_Bool bVar = IsVariable();
405 [ # # ]: 0 : if( nA & WA_VARIABLE )
406 : 0 : bVar = sal_True;
407 [ # # ]: 0 : else if( nA & WA_METHOD )
408 : 0 : bVar = sal_False;
409 : :
410 : 0 : WriteTab( rOutStm, nTab );
411 : 0 : rOutStm << "//class SvMetaAttribute" << endl;
412 [ # # ][ # # ]: 0 : if( rId.IsSet() && !(nA & WA_STRUCT) )
[ # # ]
413 : : {
414 : 0 : WriteTab( rOutStm, nTab );
415 [ # # ]: 0 : rOutStm << "id("
416 [ # # ]: 0 : << rtl::OString::valueOf(static_cast<sal_Int32>(MakeSlotValue(rBase,bVar))).getStr()
417 [ # # ][ # # ]: 0 : << ")," << endl;
418 : : }
419 [ # # ][ # # ]: 0 : if( bVar && (bReadonly || IsMethod()) )
[ # # ][ # # ]
420 : : {
421 : 0 : WriteTab( rOutStm, nTab );
422 : 0 : rOutStm << "readonly," << endl;
423 : : }
424 : : }
425 : : }
426 : 0 : }
427 : :
428 : 0 : void SvMetaAttribute::WriteCSource( SvIdlDataBase & rBase, SvStream & rOutStm,
429 : : sal_Bool bSet )
430 : : {
431 [ # # ]: 0 : rOutStm << endl;
432 [ # # ]: 0 : SvMetaType * pType = GetType();
433 [ # # ]: 0 : SvMetaType * pBaseType = pType->GetBaseType();
434 : :
435 : : // for Set the return is always void
436 : 0 : sal_Bool bVoid = bSet;
437 [ # # ]: 0 : if( pBaseType->GetType() == TYPE_METHOD )
438 [ # # ][ # # ]: 0 : bVoid = pBaseType->GetReturnType()->GetBaseType()->GetName().getString() == "void";
439 : :
440 : : // emit methods/functions body
441 [ # # ][ # # ]: 0 : rOutStm << '{' << endl;
442 [ # # ]: 0 : WriteTab( rOutStm, 1 );
443 : :
444 [ # # ]: 0 : if( !bVoid )
445 : : {
446 [ # # ][ # # ]: 0 : if ( pBaseType->GetCName() == "double" )
447 : : {
448 [ # # ]: 0 : rOutStm << "return *(double*)";
449 : : }
450 : : else
451 : : {
452 [ # # ]: 0 : rOutStm << "return (";
453 [ # # ]: 0 : pType->WriteTypePrefix( rBase, rOutStm, 2, WRITE_C_SOURCE );
454 [ # # ]: 0 : rOutStm << ") ";
455 : : }
456 : : }
457 [ # # ]: 0 : rOutStm << "pODKCallFunction( "
458 [ # # ][ # # ]: 0 : << rtl::OString::valueOf(static_cast<sal_Int32>(MakeSlotValue(rBase, IsVariable()))).getStr();
[ # # ]
459 [ # # ][ # # ]: 0 : rOutStm << ',' << endl;
460 [ # # ]: 0 : WriteTab( rOutStm, 3 );
461 [ # # ][ # # ]: 0 : rOutStm << " h" << rBase.aIFaceName.getStr() << " , ";
[ # # ]
462 : :
463 : 0 : rtl::OString aParserStr;
464 [ # # ][ # # ]: 0 : if( pBaseType->GetType() == TYPE_METHOD || bSet )
[ # # ]
465 [ # # ]: 0 : aParserStr = pBaseType->GetParserString();
466 [ # # ]: 0 : if( !aParserStr.isEmpty() )
467 : : {
468 [ # # ]: 0 : rOutStm << '\"';
469 [ # # ]: 0 : rOutStm << aParserStr.getStr();
470 [ # # ]: 0 : rOutStm << "\", ";
471 : : }
472 : : else
473 [ # # ]: 0 : rOutStm << "NULL, ";
474 : :
475 [ # # ][ # # ]: 0 : if( pBaseType->GetType() == TYPE_METHOD && !bVoid )
[ # # ]
476 : : {
477 [ # # ]: 0 : rOutStm << "'";
478 [ # # ][ # # ]: 0 : rOutStm << pBaseType->GetReturnType()->GetBaseType()->GetParserChar();
479 [ # # ]: 0 : rOutStm << "'";
480 : : }
481 [ # # ]: 0 : else if ( !bSet )
482 : : {
483 [ # # ]: 0 : rOutStm << "'";
484 [ # # ]: 0 : rOutStm << pBaseType->GetParserChar();
485 [ # # ]: 0 : rOutStm << "'";
486 : : }
487 : : else
488 [ # # ]: 0 : rOutStm << '0';
489 : :
490 [ # # ]: 0 : if( !aParserStr.isEmpty() )
491 : : {
492 [ # # ]: 0 : rOutStm << ", ";
493 [ # # ][ # # ]: 0 : if( IsMethod() )
494 [ # # ]: 0 : pBaseType->WriteParamNames( rBase, rOutStm, rtl::OString() );
495 [ # # ]: 0 : else if( bSet )
496 [ # # ][ # # ]: 0 : pBaseType->WriteParamNames( rBase, rOutStm, GetName().getString() );
497 : : }
498 : :
499 [ # # ][ # # ]: 0 : rOutStm << " );" << endl;
500 [ # # ][ # # ]: 0 : rOutStm << '}' << endl;
501 : 0 : }
502 : :
503 : 0 : void SvMetaAttribute::WriteRecursiv_Impl( SvIdlDataBase & rBase,
504 : : SvStream & rOutStm, sal_uInt16 nTab,
505 : : WriteType nT, WriteAttribute nA )
506 : : {
507 [ # # ][ # # ]: 0 : const SvMetaAttributeMemberList & rList = GetType()->GetBaseType()->GetAttrList();
[ # # ]
508 [ # # ]: 0 : sal_uLong nCount = rList.size();
509 : :
510 : 0 : SvNumberIdentifier slotId = rBase.aStructSlotId;
511 [ # # ][ # # ]: 0 : if ( !GetSlotId().getString().isEmpty() )
512 [ # # ]: 0 : rBase.aStructSlotId = GetSlotId();
513 : :
514 : : // offial hack interface by MM: special controls get passed with the WriteAttribute
515 [ # # ][ # # ]: 0 : if ( GetReadonly() )
516 : 0 : nA |= WA_READONLY;
517 : :
518 [ # # ]: 0 : for( sal_uLong i = 0; i < nCount; i++ )
519 : : {
520 : 0 : SvMetaAttribute *pAttr = rList[i];
521 [ # # ]: 0 : if ( nT == WRITE_DOCU )
522 [ # # ]: 0 : pAttr->SetDescription( GetDescription().getString() );
523 [ # # ]: 0 : pAttr->Write( rBase, rOutStm, nTab, nT, nA );
524 [ # # ][ # # ]: 0 : if( nT == WRITE_ODL && i +1 < nCount )
525 [ # # ][ # # ]: 0 : rOutStm << ';' << endl;
526 : : }
527 : :
528 : 0 : rBase.aStructSlotId = slotId;
529 : 0 : }
530 : :
531 : 0 : void SvMetaAttribute::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
532 : : sal_uInt16 nTab,
533 : : WriteType nT, WriteAttribute nA )
534 : : {
535 : : // no attributes for automation
536 [ # # ]: 0 : if( nT == WRITE_DOCU )
537 : : {
538 [ # # ]: 0 : if ( GetHidden() )
539 : 0 : return;
540 : : }
541 [ # # ][ # # ]: 0 : else if ( !GetAutomation() || !GetExport() )
[ # # ]
542 : 0 : return;
543 : :
544 : : sal_Bool bVariable;
545 [ # # ]: 0 : if( nA & WA_VARIABLE )
546 : 0 : bVariable = sal_True;
547 [ # # ]: 0 : else if( nA & WA_METHOD )
548 : 0 : bVariable = sal_False;
549 : : else
550 : 0 : bVariable = IsVariable();
551 : :
552 : 0 : SvMetaType * pType = GetType();
553 : : DBG_ASSERT( pType, "no type for attribute" );
554 : 0 : SvMetaType * pBaseType = pType->GetBaseType();
555 : : DBG_ASSERT( pBaseType, "no base type for attribute" );
556 : 0 : int nBType = pBaseType->GetType();
557 : :
558 [ # # ]: 0 : if( nT == WRITE_ODL )
559 : : {
560 [ # # ][ # # ]: 0 : if( (bVariable && IsVariable()) || (!bVariable && IsMethod()) )
[ # # ][ # # ]
[ # # ]
561 : : {
562 [ # # ]: 0 : if( nBType == TYPE_STRUCT )
563 : 0 : WriteRecursiv_Impl( rBase, rOutStm, nTab, nT, nA );
564 : : else
565 : : {
566 : 0 : SvMetaReference::Write( rBase, rOutStm, nTab, nT, nA );
567 : 0 : WriteTab( rOutStm, nTab );
568 : 0 : pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
569 : :
570 [ # # ]: 0 : if( !GetName().getString().isEmpty() )
571 : : {
572 : 0 : rOutStm << ' ';
573 : 0 : rOutStm << GetName().getString().getStr();
574 : : }
575 [ # # ]: 0 : if( pType->GetType() == TYPE_METHOD )
576 : 0 : pType->WriteMethodArgs( rBase, rOutStm, nTab, nT );
577 : : }
578 : : }
579 : : }
580 [ # # ][ # # ]: 0 : else if( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
581 : : {
582 [ # # ][ # # ]: 0 : if( !bVariable && IsMethod() )
[ # # ]
583 : : {
584 [ # # ]: 0 : rtl::OString name = rBase.aIFaceName + GetName().getString();
585 : 0 : const char * pName = name.getStr();
586 [ # # ]: 0 : WriteTab( rOutStm, nTab );
587 [ # # ]: 0 : pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
588 [ # # ][ # # ]: 0 : rOutStm << ' ' << pName;
589 [ # # ]: 0 : pType->WriteMethodArgs( rBase, rOutStm, nTab, nT );
590 [ # # ]: 0 : if( nT == WRITE_C_HEADER )
591 [ # # ][ # # ]: 0 : rOutStm << ';' << endl << endl;
[ # # ]
592 : : else
593 [ # # ]: 0 : WriteCSource( rBase, rOutStm, sal_False );
594 : : }
595 [ # # ][ # # ]: 0 : else if ( bVariable && IsVariable() )
[ # # ]
596 : : {
597 [ # # ]: 0 : if( nBType == TYPE_STRUCT )
598 : : {
599 : : // for assistance emit the name of the property as acomment
600 : 0 : rOutStm << "/* " << GetName().getString().getStr() << " */" << endl;
601 : :
602 : 0 : WriteRecursiv_Impl( rBase, rOutStm, nTab, nT, nA );
603 : : }
604 : : else
605 : : {
606 [ # # ]: 0 : rtl::OString name = GetName().getString();
607 : :
608 [ # # ][ # # ]: 0 : sal_Bool bReadonly = GetReadonly() || ( nA & WA_READONLY );
[ # # ]
609 [ # # ][ # # ]: 0 : if ( !bReadonly && !IsMethod() )
[ # # ][ # # ]
610 : : {
611 : : // allocation
612 [ # # ]: 0 : WriteTab( rOutStm, nTab );
613 [ # # ]: 0 : rOutStm << "void ";
614 [ # # ]: 0 : rOutStm << rBase.aIFaceName.getStr()
615 [ # # ][ # # ]: 0 : << "Set" << name.getStr() << "( " << C_PREF
[ # # ][ # # ]
616 [ # # ][ # # ]: 0 : << "Object h" << rBase.aIFaceName.getStr() << ", " << endl;
[ # # ][ # # ]
617 [ # # ]: 0 : WriteTab( rOutStm, nTab+1 );
618 [ # # ]: 0 : pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
619 [ # # ][ # # ]: 0 : rOutStm << ' ' << name.getStr() << " )";
[ # # ]
620 [ # # ]: 0 : if( nT == WRITE_C_HEADER )
621 [ # # ][ # # ]: 0 : rOutStm << ';' << endl << endl;
[ # # ]
622 : : else
623 [ # # ]: 0 : WriteCSource( rBase, rOutStm, sal_True );
624 : : }
625 : :
626 : : // access
627 [ # # ]: 0 : WriteTab( rOutStm, nTab );
628 [ # # ]: 0 : pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
629 [ # # ]: 0 : rOutStm << ' ';
630 [ # # ]: 0 : rOutStm << rBase.aIFaceName.getStr()
631 [ # # ][ # # ]: 0 : << "Get" << name.getStr() << "( " << C_PREF
[ # # ][ # # ]
632 [ # # ][ # # ]: 0 : << "Object h" << rBase.aIFaceName.getStr() << " )";
[ # # ]
633 [ # # ]: 0 : if( nT == WRITE_C_HEADER )
634 [ # # ][ # # ]: 0 : rOutStm << ';' << endl << endl;
[ # # ]
635 : : else
636 [ # # ]: 0 : WriteCSource( rBase, rOutStm, sal_False );
637 : : }
638 : 0 : }
639 : : }
640 [ # # ]: 0 : else if ( nT == WRITE_DOCU )
641 : : {
642 [ # # ][ # # ]: 0 : if( !bVariable && IsMethod() )
[ # # ]
643 : : {
644 : 0 : rOutStm << "<METHOD>" << endl
645 : 0 : << GetSlotId().getString().getStr() << endl
646 : 0 : << GetName().getString().getStr() << endl
647 : 0 : << endl; // readonly
648 : :
649 : : // return type
650 : 0 : SvMetaType* pType2 = GetType();
651 : 0 : SvMetaType* pBaseType2 = pType2->GetBaseType();
652 : 0 : rOutStm << pBaseType2->GetReturnType()->GetBaseType()->GetBasicName().getStr() << endl;
653 : :
654 : : DBG_ASSERT( !pBaseType2->GetReturnType()->GetBaseType()->GetBasicName().isEmpty(),
655 : : "Leerer BasicName" );
656 : :
657 : : // syntax
658 : 0 : rOutStm << GetName().getString().getStr();
659 : 0 : pType2->WriteMethodArgs( rBase, rOutStm, nTab, nT );
660 : :
661 : : // C return type
662 : 0 : pBaseType2->WriteTypePrefix( rBase, rOutStm, 0, WRITE_C_HEADER );
663 : 0 : rOutStm << endl;
664 : :
665 : : // for methods also C syntax
666 : 0 : rOutStm << "<C-SYNTAX>" << endl;
667 : 0 : Write( rBase, rOutStm, 0, WRITE_C_HEADER, nA );
668 : 0 : rOutStm << "</C-SYNTAX>" << endl;
669 : :
670 : : // description
671 : 0 : WriteDescription( rOutStm );
672 : 0 : rOutStm << "</METHOD>" << endl << endl;
673 : : }
674 [ # # ][ # # ]: 0 : else if( bVariable && IsVariable() )
[ # # ]
675 : : {
676 [ # # ]: 0 : if( nBType == TYPE_STRUCT )
677 : : {
678 : 0 : WriteRecursiv_Impl( rBase, rOutStm, nTab, nT, nA );
679 : : }
680 : : else
681 : : {
682 : 0 : rOutStm << "<PROPERTY>" << endl
683 : 0 : << GetSlotId().getString().getStr() << endl
684 : 0 : << GetName().getString().getStr() << endl;
685 [ # # ]: 0 : if ( GetReadonly() )
686 : 0 : rOutStm << "(nur lesen)" << endl;
687 : : else
688 : 0 : rOutStm << endl;
689 : :
690 : : // for properties type instead of the return value
691 : 0 : rOutStm << pBaseType->GetBasicName().getStr() << endl;
692 : :
693 : : DBG_ASSERT( !pBaseType->GetBasicName().isEmpty(),
694 : : "Leerer BasicName" );
695 : :
696 : : // for properties no syntax
697 : 0 : rOutStm << endl;
698 : :
699 : : // C return type
700 : 0 : pBaseType->WriteTypePrefix( rBase, rOutStm, 0, WRITE_C_HEADER );
701 : 0 : rOutStm << endl;
702 : :
703 : : // description
704 : 0 : WriteDescription( rOutStm );
705 : 0 : rOutStm << "</PROPERTY>" << endl << endl;
706 : : }
707 : : }
708 : : }
709 : : }
710 : :
711 : 1192 : sal_uLong SvMetaAttribute::MakeSfx( rtl::OStringBuffer& rAttrArray )
712 : : {
713 : 1192 : SvMetaType * pType = GetType();
714 : : DBG_ASSERT( pType, "no type for attribute" );
715 : 1192 : SvMetaType * pBaseType = pType->GetBaseType();
716 : : DBG_ASSERT( pBaseType, "no base type for attribute" );
717 [ - + ]: 1192 : if( pBaseType->GetType() == TYPE_STRUCT )
718 : 0 : return pBaseType->MakeSfx( rAttrArray );
719 : : else
720 : : {
721 : 1192 : rAttrArray.append('{');
722 : 1192 : rAttrArray.append(GetSlotId().getString());
723 : 1192 : rAttrArray.append(",\"");
724 : 1192 : rAttrArray.append(GetName().getString());
725 : 1192 : rAttrArray.append("\"}");
726 : 1192 : return 1;
727 : : }
728 : : }
729 : :
730 : 18 : void SvMetaAttribute::Insert (SvSlotElementList&, const rtl::OString&, SvIdlDataBase&)
731 : : {
732 : 18 : }
733 : :
734 : 32 : void SvMetaAttribute::WriteHelpId( SvIdlDataBase &, SvStream &, HelpIdTable& )
735 : : {
736 : 32 : }
737 : :
738 [ # # ][ # # ]: 145492 : SV_IMPL_META_FACTORY1( SvMetaType, SvMetaExtern );
[ # # ][ # # ]
[ # # ][ - + ]
[ - + ]
739 : : #define CTOR \
740 : : : aCall0( CALL_VALUE, sal_False ) \
741 : : , aCall1( CALL_VALUE, sal_False ) \
742 : : , aSbxDataType( 0, sal_False ) \
743 : : , pAttrList( NULL ) \
744 : : , nType( TYPE_BASE ) \
745 : : , bIsItem( sal_False ) \
746 : : , bIsShell( sal_False ) \
747 : : , cParserChar( 'h' )
748 : :
749 : 12458 : SvMetaType::SvMetaType()
750 : 12458 : CTOR
751 : : {
752 : 12458 : }
753 : :
754 : 0 : SvMetaType::SvMetaType( const rtl::OString& rName, char cPC,
755 : : const rtl::OString& rCName )
756 : 0 : CTOR
757 : : {
758 [ # # ]: 0 : SetName( rName );
759 : 0 : cParserChar = cPC;
760 : 0 : aCName.setString(rCName);
761 : 0 : }
762 : :
763 : 208 : SvMetaType::SvMetaType( const rtl::OString& rName,
764 : : const rtl::OString& rSbxName,
765 : : const rtl::OString& rOdlName,
766 : : char cPc,
767 : : const rtl::OString& rCName,
768 : : const rtl::OString& rBasicName,
769 : : const rtl::OString& rBasicPostfix )
770 : 208 : CTOR
771 : : {
772 [ + - ]: 208 : SetName( rName );
773 : 208 : aSbxName.setString(rSbxName);
774 : 208 : aOdlName.setString(rOdlName);
775 : 208 : cParserChar = cPc;
776 : 208 : aCName.setString(rCName);
777 : 208 : aBasicName.setString(rBasicName);
778 : 208 : aBasicPostfix.setString(rBasicPostfix);
779 : 208 : }
780 : :
781 : 0 : void SvMetaType::Load( SvPersistStream & rStm )
782 : : {
783 [ # # ]: 0 : SvMetaExtern::Load( rStm );
784 : :
785 : : sal_uInt16 nMask;
786 [ # # ]: 0 : rStm >> nMask;
787 [ # # ][ # # ]: 0 : if( nMask & 0x0001 ) rStm >> aIn;
788 [ # # ][ # # ]: 0 : if( nMask & 0x0002 ) rStm >> aOut;
789 [ # # ][ # # ]: 0 : if( nMask & 0x0004 ) rStm >> aCall0;
790 [ # # ][ # # ]: 0 : if( nMask & 0x0008 ) rStm >> aCall1;
791 [ # # ][ # # ]: 0 : if( nMask & 0x0010 ) rStm >> aSbxDataType;
792 [ # # ][ # # ]: 0 : if( nMask & 0x0020 ) rStm >> aSvName;
793 [ # # ][ # # ]: 0 : if( nMask & 0x0040 ) rStm >> aSbxName;
794 [ # # ][ # # ]: 0 : if( nMask & 0x0080 ) rStm >> aOdlName;
795 [ # # ][ # # ]: 0 : if( nMask & 0x0100 ) rStm >> GetAttrList();
[ # # ]
796 [ # # ]: 0 : if( nMask & 0x0200 ) bIsItem = sal_True;
797 [ # # ]: 0 : if( nMask & 0x0400 ) bIsShell = sal_True;
798 [ # # ]: 0 : if( nMask & 0x0800 )
799 : : {
800 : : sal_uInt16 nT;
801 [ # # ]: 0 : rStm >> nT;
802 : 0 : nType = nT;
803 : : }
804 [ # # ][ # # ]: 0 : if( nMask & 0x1000 ) rStm >> cParserChar;
805 [ # # ][ # # ]: 0 : if( nMask & 0x2000 ) rStm >> aCName;
806 [ # # ][ # # ]: 0 : if( nMask & 0x4000 ) rStm >> aBasicName;
807 [ # # ][ # # ]: 0 : if( nMask & 0x8000 ) rStm >> aBasicPostfix;
808 : 0 : }
809 : :
810 : 12666 : void SvMetaType::Save( SvPersistStream & rStm )
811 : : {
812 : 12666 : SvMetaExtern::Save( rStm );
813 : :
814 : : // create mask
815 : 12666 : sal_uInt16 nMask = 0;
816 [ - + ]: 12666 : if( aIn.IsSet() ) nMask |= 0x0001;
817 [ - + ]: 12666 : if( aOut.IsSet() ) nMask |= 0x0002;
818 [ - + ]: 12666 : if( aCall0.IsSet() ) nMask |= 0x0004;
819 [ - + ]: 12666 : if( aCall1.IsSet() ) nMask |= 0x0008;
820 [ - + ]: 12666 : if( aSbxDataType.IsSet() ) nMask |= 0x0010;
821 [ + + ]: 12666 : if( aSvName.IsSet() ) nMask |= 0x0020;
822 [ + + ]: 12666 : if( aSbxName.IsSet() ) nMask |= 0x0040;
823 [ + + ]: 12666 : if( aOdlName.IsSet() ) nMask |= 0x0080;
824 [ + + ]: 12666 : if( GetAttrCount() ) nMask |= 0x0100;
825 [ + + ]: 12666 : if( bIsItem ) nMask |= 0x0200;
826 [ + + ]: 12666 : if( bIsShell ) nMask |= 0x0400;
827 [ + + ]: 12666 : if( nType != TYPE_BASE ) nMask |= 0x0800;
828 [ + + ]: 12666 : if( cParserChar != 'h' ) nMask |= 0x1000;
829 [ + + ]: 12666 : if( aCName.IsSet() ) nMask |= 0x2000;
830 [ + + ]: 12666 : if( aBasicName.IsSet() ) nMask |= 0x4000;
831 [ + + ]: 12666 : if( aBasicPostfix.IsSet() ) nMask |= 0x8000;
832 : :
833 : : // write data
834 : 12666 : rStm << nMask;
835 [ - + ]: 12666 : if( nMask & 0x0001 ) rStm << aIn;
836 [ - + ]: 12666 : if( nMask & 0x0002 ) rStm << aOut;
837 [ - + ]: 12666 : if( nMask & 0x0004 ) rStm << aCall0;
838 [ - + ]: 12666 : if( nMask & 0x0008 ) rStm << aCall1;
839 [ - + ]: 12666 : if( nMask & 0x0010 ) rStm << aSbxDataType;
840 [ + + ]: 12666 : if( nMask & 0x0020 ) rStm << aSvName;
841 [ + + ]: 12666 : if( nMask & 0x0040 ) rStm << aSbxName;
842 [ + + ]: 12666 : if( nMask & 0x0080 ) rStm << aOdlName;
843 [ + + ]: 12666 : if( nMask & 0x0100 ) rStm << *pAttrList;
844 [ + + ]: 12666 : if( nMask & 0x0800 ) rStm << (sal_uInt16)nType;
845 [ + + ]: 12666 : if( nMask & 0x1000 ) rStm << cParserChar;
846 [ + + ]: 12666 : if( nMask & 0x2000 ) rStm << aCName;
847 [ + + ]: 12666 : if( nMask & 0x4000 ) rStm << aBasicName;
848 [ + + ]: 12666 : if( nMask & 0x8000 ) rStm << aBasicPostfix;
849 : 12666 : }
850 : :
851 : 15924 : SvMetaAttributeMemberList & SvMetaType::GetAttrList() const
852 : : {
853 [ + + ]: 15924 : if( !pAttrList )
854 [ + - ]: 6062 : ((SvMetaType *)this)->pAttrList = new SvMetaAttributeMemberList();
855 : 15924 : return *pAttrList;
856 : : }
857 : :
858 : 10168 : void SvMetaType::SetType( int nT )
859 : : {
860 : 10168 : nType = nT;
861 [ + + ]: 10168 : if( nType == TYPE_ENUM )
862 : : {
863 : 410 : aOdlName.setString("short");
864 : : }
865 [ + + ]: 9758 : else if( nType == TYPE_CLASS )
866 : : {
867 : 386 : rtl::OStringBuffer aTmp(C_PREF);
868 [ + - ]: 386 : aTmp.append(RTL_CONSTASCII_STRINGPARAM("Object *"));
869 : 386 : aCName.setString(aTmp.makeStringAndClear());
870 : : }
871 : 10168 : }
872 : :
873 : 28022 : SvMetaType * SvMetaType::GetBaseType() const
874 : : {
875 [ + + ][ + + ]: 28022 : if( GetRef() && GetType() == TYPE_BASE )
[ + + ]
876 : 10066 : return ((SvMetaType *)GetRef())->GetBaseType();
877 : 28022 : return (SvMetaType *)this;
878 : : }
879 : :
880 : 13248 : SvMetaType * SvMetaType::GetReturnType() const
881 : : {
882 : : DBG_ASSERT( GetType() == TYPE_METHOD, "no method" );
883 : : DBG_ASSERT( GetRef(), "no return type" );
884 : 13248 : return (SvMetaType *)GetRef();
885 : : }
886 : :
887 : 0 : const rtl::OString& SvMetaType::GetBasicName() const
888 : : {
889 [ # # ][ # # ]: 0 : if( aBasicName.IsSet() || !GetRef() )
[ # # ]
890 : 0 : return aBasicName.getString();
891 : : else
892 : 0 : return ((SvMetaType*)GetRef())->GetBasicName();
893 : : }
894 : :
895 : 0 : rtl::OString SvMetaType::GetBasicPostfix() const
896 : : {
897 : : // MBN and Co always want "As xxx"
898 : : return rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM(" As ")).
899 [ # # ]: 0 : append(GetBasicName()).
900 : 0 : makeStringAndClear();
901 : : }
902 : :
903 : 176628 : sal_Bool SvMetaType::GetIn() const
904 : : {
905 [ + - ][ + + ]: 176628 : if( aIn.IsSet() || !GetRef() )
[ + + ]
906 : 79856 : return aIn;
907 : : else
908 : 176628 : return ((SvMetaType *)GetRef())->GetIn();
909 : : }
910 : :
911 : 88314 : sal_Bool SvMetaType::GetOut() const
912 : : {
913 [ + - ][ + + ]: 88314 : if( aOut.IsSet() || !GetRef() )
[ + + ]
914 : 39928 : return aOut;
915 : : else
916 : 88314 : return ((SvMetaType *)GetRef())->GetOut();
917 : : }
918 : :
919 : 0 : void SvMetaType::SetCall0( int e )
920 : : {
921 : 0 : aCall0 = (int)e;
922 [ # # ][ # # ]: 0 : if( aCall0 == CALL_VALUE && aCall1 == CALL_VALUE )
[ # # ]
923 : : {
924 [ # # ]: 0 : if( GetType() == TYPE_POINTER )
925 : 0 : SetType( TYPE_BASE );
926 : : }
927 : : else
928 : : {
929 : : DBG_ASSERT( nType == TYPE_POINTER || nType == TYPE_BASE,
930 : : "set no base type to pointer" );
931 : 0 : SetType( TYPE_POINTER );
932 : : }
933 : 0 : }
934 : :
935 : 0 : int SvMetaType::GetCall0() const
936 : : {
937 [ # # ][ # # ]: 0 : if( aCall0.IsSet() || !GetRef() )
[ # # ]
938 : 0 : return aCall0;
939 : : else
940 : 0 : return ((SvMetaType *)GetRef())->GetCall0();
941 : : }
942 : :
943 : 0 : void SvMetaType::SetCall1( int e )
944 : : {
945 : 0 : aCall1 = (int)e;
946 [ # # ][ # # ]: 0 : if( aCall0 == CALL_VALUE && aCall1 == CALL_VALUE )
[ # # ]
947 : : {
948 [ # # ]: 0 : if( GetType() == TYPE_POINTER )
949 : 0 : SetType( TYPE_BASE );
950 : : }
951 : : else
952 : : {
953 : : DBG_ASSERT( nType == TYPE_POINTER || nType == TYPE_BASE,
954 : : "set no base type to pointer" );
955 : 0 : SetType( TYPE_POINTER );
956 : : }
957 : 0 : }
958 : :
959 : 0 : int SvMetaType::GetCall1() const
960 : : {
961 [ # # ][ # # ]: 0 : if( aCall1.IsSet() || !GetRef() )
[ # # ]
962 : 0 : return aCall1;
963 : : else
964 : 0 : return ((SvMetaType *)GetRef())->GetCall1();
965 : : }
966 : :
967 : 53184 : const rtl::OString& SvMetaType::GetSvName() const
968 : : {
969 [ + + ][ - + ]: 53184 : if( aSvName.IsSet() || !GetRef() )
[ + + ]
970 : 39928 : return aSvName.getString();
971 : : else
972 : 53184 : return ((SvMetaType *)GetRef())->GetSvName();
973 : : }
974 : :
975 : 0 : const rtl::OString& SvMetaType::GetSbxName() const
976 : : {
977 [ # # ][ # # ]: 0 : if( aSbxName.IsSet() || !GetRef() )
[ # # ]
978 : 0 : return aSbxName.getString();
979 : : else
980 : 0 : return ((SvMetaType *)GetRef())->GetSbxName();
981 : : }
982 : :
983 : 0 : const rtl::OString& SvMetaType::GetOdlName() const
984 : : {
985 [ # # ][ # # ]: 0 : if( aOdlName.IsSet() || !GetRef() )
[ # # ]
986 : 0 : return aOdlName.getString();
987 : : else
988 : 0 : return ((SvMetaType *)GetRef())->GetOdlName();
989 : : }
990 : :
991 : 0 : const rtl::OString& SvMetaType::GetCName() const
992 : : {
993 [ # # ][ # # ]: 0 : if( aCName.IsSet() || !GetRef() )
[ # # ]
994 : 0 : return aCName.getString();
995 : : else
996 : 0 : return ((SvMetaType *)GetRef())->GetCName();
997 : : }
998 : :
999 : 3908 : sal_Bool SvMetaType::SetName( const rtl::OString& rName, SvIdlDataBase * pBase )
1000 : : {
1001 : 3908 : aSvName.setString(rName);
1002 : 3908 : aSbxName.setString(rName);
1003 : 3908 : aCName.setString(rName);
1004 [ + + ]: 3908 : if( GetType() != TYPE_ENUM )
1005 : 3498 : aOdlName.setString(rName);
1006 : 3908 : return SvMetaReference::SetName( rName, pBase );
1007 : : }
1008 : :
1009 : 39928 : rtl::OString SvMetaType::GetCString() const
1010 : : {
1011 [ + - ][ + - ]: 39928 : rtl::OStringBuffer out( GetSvName() );
1012 [ - + ]: 39928 : if( aCall0 == (int)CALL_POINTER )
1013 [ # # ]: 0 : out.append(" *");
1014 [ - + ]: 39928 : else if( aCall0 == (int)CALL_REFERENCE )
1015 [ # # ]: 0 : out.append(" &");
1016 [ - + ]: 39928 : if( aCall1 == (int)CALL_POINTER )
1017 [ # # ]: 0 : out.append('*');
1018 [ - + ]: 39928 : else if( aCall1 == (int)CALL_REFERENCE )
1019 [ # # ]: 0 : out.append('&');
1020 : 39928 : return out.makeStringAndClear();
1021 : : }
1022 : :
1023 : 3700 : sal_Bool SvMetaType::ReadHeaderSvIdl( SvIdlDataBase & rBase,
1024 : : SvTokenStream & rInStm )
1025 : : {
1026 : 3700 : sal_Bool bOk = sal_False;
1027 : 3700 : sal_uInt32 nTokPos = rInStm.Tell();
1028 : 3700 : SvToken * pTok = rInStm.GetToken_Next();
1029 : :
1030 [ + + ]: 7186 : if( pTok->Is( SvHash_interface() )
[ + + + + ]
1031 : 3486 : || pTok->Is( SvHash_shell() ) )
1032 : : {
1033 [ + + ]: 386 : if( pTok->Is( SvHash_shell() ) )
1034 : 172 : bIsShell = sal_True;
1035 : 386 : SetType( TYPE_CLASS );
1036 : 386 : bOk = ReadNamesSvIdl( rBase, rInStm );
1037 : :
1038 : : }
1039 [ + + ]: 3314 : else if( pTok->Is( SvHash_struct() ) )
1040 : : {
1041 : 614 : SetType( TYPE_STRUCT );
1042 : 614 : bOk = ReadNamesSvIdl( rBase, rInStm );
1043 : : }
1044 [ - + ]: 2700 : else if( pTok->Is( SvHash_union() ) )
1045 : : {
1046 : 0 : SetType( TYPE_UNION );
1047 [ # # ]: 0 : if( ReadNameSvIdl( rBase, rInStm ) )
1048 : 0 : return sal_True;
1049 : : }
1050 [ + + ]: 2700 : else if( pTok->Is( SvHash_enum() ) )
1051 : : {
1052 : 410 : SetType( TYPE_ENUM );
1053 : 410 : bOk = ReadNameSvIdl( rBase, rInStm );
1054 : : }
1055 [ + - + - ]: 4580 : else if( pTok->Is( SvHash_typedef() )
[ + - ]
1056 : 2290 : || pTok->Is( SvHash_item() ) )
1057 : : {
1058 [ + - ]: 2290 : if( pTok->Is( SvHash_item() ) )
1059 : 2290 : bIsItem = sal_True;
1060 : :
1061 : 2290 : SvMetaType * pType = rBase.ReadKnownType( rInStm );
1062 [ + - ]: 2290 : if( pType )
1063 : : {
1064 : 2290 : SetRef( pType );
1065 [ + - ]: 2290 : if( ReadNameSvIdl( rBase, rInStm ) )
1066 : : {
1067 [ - + ]: 2290 : if( rInStm.Read( '(' ) )
1068 : : {
1069 : 0 : DoReadContextSvIdl( rBase, rInStm );
1070 [ # # ]: 0 : if( rInStm.Read( ')' ) )
1071 : : {
1072 : 0 : SetType( TYPE_METHOD );
1073 : 0 : bOk = sal_True;
1074 : : }
1075 : : }
1076 : : else
1077 : : {
1078 : 2290 : bOk = sal_True;
1079 : : }
1080 : : }
1081 : : }
1082 : : else
1083 : : {
1084 : 0 : rtl::OString aStr("wrong typedef: ");
1085 [ # # ][ # # ]: 0 : rBase.SetError( aStr, rInStm.GetToken() );
1086 [ # # ]: 0 : rBase.WriteError( rInStm );
1087 : : }
1088 : : }
1089 [ + - ]: 3700 : if( bOk )
1090 : 3700 : SetModule( rBase );
1091 : : else
1092 : 0 : rInStm.Seek( nTokPos );
1093 : 3700 : return bOk;
1094 : : }
1095 : :
1096 : 2904 : sal_Bool SvMetaType::ReadSvIdl( SvIdlDataBase & rBase,
1097 : : SvTokenStream & rInStm )
1098 : : {
1099 [ + - ]: 2904 : if( ReadHeaderSvIdl( rBase, rInStm ) )
1100 : : {
1101 [ + - ]: 2904 : rBase.Write(rtl::OString('.'));
1102 : 2904 : return SvMetaExtern::ReadSvIdl( rBase, rInStm );
1103 : : }
1104 : 2904 : return sal_False;
1105 : : }
1106 : :
1107 : 2904 : void SvMetaType::WriteSvIdl
1108 : : (
1109 : : SvIdlDataBase & rBase,
1110 : : SvStream & rOutStm,
1111 : : sal_uInt16 nTab
1112 : : )
1113 : : {
1114 : 2904 : WriteHeaderSvIdl( rBase, rOutStm, nTab );
1115 [ - + ]: 2904 : if( GetType() == TYPE_METHOD )
1116 : 0 : WriteMethodArgs( rBase, rOutStm, nTab, WRITE_IDL );
1117 : :
1118 : 2904 : sal_uLong nOldPos = rOutStm.Tell();
1119 : 2904 : rOutStm << endl;
1120 : 2904 : SvMetaExtern::WriteSvIdl( rBase, rOutStm, nTab );
1121 [ + + ]: 2904 : if( TestAndSeekSpaceOnly( rOutStm, nOldPos ) )
1122 : : // nothin written
1123 : 2290 : rOutStm.Seek( nOldPos );
1124 : 2904 : rOutStm << ';' << endl;
1125 : 2904 : }
1126 : :
1127 : 0 : void SvMetaType::WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm,
1128 : : sal_uInt16 nTab,
1129 : : WriteType nT, WriteAttribute nA )
1130 : : {
1131 [ # # ]: 0 : if( GetAttrCount() )
1132 : : {
1133 [ # # ]: 0 : SvMetaAttributeMemberList::const_iterator it = pAttrList->begin();
1134 [ # # ][ # # ]: 0 : while( it != pAttrList->end() )
1135 : : {
1136 : 0 : SvMetaAttribute * pAttr = *it;
1137 [ # # ]: 0 : pAttr->Write( rBase, rOutStm, nTab, nT, nA );
1138 [ # # ]: 0 : if( GetType() == TYPE_METHOD )
1139 [ # # ][ # # ]: 0 : rOutStm << ',' << endl;
1140 : : else
1141 [ # # ][ # # ]: 0 : rOutStm << ';' << endl;
1142 : 0 : ++it;
1143 : : }
1144 : : }
1145 : 0 : }
1146 : :
1147 : 0 : void SvMetaType::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
1148 : : sal_uInt16 nTab,
1149 : : WriteType nT, WriteAttribute nA )
1150 : : {
1151 [ # # ][ # # ]: 0 : if( nT == WRITE_C_HEADER && nType != TYPE_ENUM )
1152 : : // write only enum
1153 : 0 : return;
1154 : :
1155 [ # # ]: 0 : rtl::OString name = GetName().getString();
1156 [ # # ][ # # ]: 0 : if( nT == WRITE_ODL || nT == WRITE_C_HEADER || nT == WRITE_CXX_HEADER )
[ # # ]
1157 : : {
1158 [ # # # # : 0 : switch( nType )
# ]
1159 : : {
1160 : : case TYPE_CLASS:
1161 : : {
1162 : : }
1163 : 0 : break;
1164 : : case TYPE_STRUCT:
1165 : : case TYPE_UNION:
1166 : : case TYPE_ENUM:
1167 : : {
1168 [ # # ]: 0 : WriteStars( rOutStm );
1169 [ # # ][ # # ]: 0 : if( nType == TYPE_STRUCT || nType == TYPE_UNION )
1170 : 0 : nA = WA_STRUCT;
1171 : :
1172 [ # # ][ # # ]: 0 : if( nT == WRITE_ODL || nT == WRITE_C_HEADER)
1173 : : {
1174 [ # # ]: 0 : if ( nT == WRITE_C_HEADER )
1175 : : {
1176 : 0 : rtl::OString aStr = name.toAsciiUpperCase();
1177 [ # # ][ # # ]: 0 : rOutStm << "#ifndef " << C_PREF << aStr.getStr() << "_DEF " << endl;
[ # # ][ # # ]
[ # # ]
1178 [ # # ][ # # ]: 0 : rOutStm << "#define " << C_PREF << aStr.getStr() << "_DEF " << endl;
[ # # ][ # # ]
[ # # ]
1179 : : }
1180 : :
1181 [ # # ]: 0 : WriteTab( rOutStm, nTab );
1182 [ # # ][ # # ]: 0 : rOutStm << "typedef" << endl;
1183 [ # # ]: 0 : if ( nT == WRITE_ODL )
1184 [ # # ]: 0 : SvMetaName::Write( rBase, rOutStm, nTab, nT, nA );
1185 : : }
1186 [ # # ]: 0 : WriteTab( rOutStm, nTab );
1187 [ # # ]: 0 : if( nType == TYPE_STRUCT )
1188 [ # # ]: 0 : rOutStm << "struct";
1189 [ # # ]: 0 : else if( nType == TYPE_UNION )
1190 [ # # ]: 0 : rOutStm << "union";
1191 : : else
1192 [ # # ]: 0 : rOutStm << "enum";
1193 [ # # ][ # # ]: 0 : if( nT != WRITE_ODL && nT != WRITE_C_HEADER)
1194 [ # # ][ # # ]: 0 : rOutStm << ' ' << name.getStr();
1195 : :
1196 [ # # ]: 0 : rOutStm << endl;
1197 [ # # ]: 0 : WriteTab( rOutStm, nTab );
1198 [ # # ][ # # ]: 0 : rOutStm << '{' << endl;
1199 [ # # ]: 0 : WriteContext( rBase, rOutStm, nTab +1, nT, nA );
1200 [ # # ]: 0 : WriteTab( rOutStm, nTab );
1201 [ # # ]: 0 : rOutStm << '}';
1202 [ # # ][ # # ]: 0 : if( nT == WRITE_ODL || nT == WRITE_C_HEADER )
1203 : : {
1204 [ # # ][ # # ]: 0 : rOutStm << ' ' << C_PREF << name.getStr();
[ # # ]
1205 : : }
1206 [ # # ][ # # ]: 0 : rOutStm << ';' << endl;
1207 : :
1208 [ # # ]: 0 : if ( nT == WRITE_C_HEADER )
1209 [ # # ]: 0 : rOutStm << "#endif";
1210 [ # # ]: 0 : rOutStm << endl;
1211 : : }
1212 : 0 : break;
1213 : : case TYPE_POINTER:
1214 : : case TYPE_BASE:
1215 : : {
1216 : : }
1217 : 0 : break;
1218 : : case TYPE_METHOD:
1219 : : {
1220 : : }
1221 : 0 : break;
1222 : : }
1223 : 0 : }
1224 : : }
1225 : :
1226 : 1000 : sal_Bool SvMetaType::ReadNamesSvIdl( SvIdlDataBase & rBase,
1227 : : SvTokenStream & rInStm )
1228 : : {
1229 : 1000 : sal_Bool bOk = ReadNameSvIdl( rBase, rInStm );
1230 : :
1231 : 1000 : return bOk;
1232 : : }
1233 : :
1234 : 3700 : void SvMetaType::WriteHeaderSvIdl( SvIdlDataBase & rBase,
1235 : : SvStream & rOutStm,
1236 : : sal_uInt16 nTab )
1237 : : {
1238 [ + + - + : 3700 : switch( nType )
+ - - ]
1239 : : {
1240 : : case TYPE_CLASS:
1241 : : {
1242 [ + + ]: 386 : if( IsShell() )
1243 : 172 : rOutStm << SvHash_shell()->GetName().getStr();
1244 : : else
1245 : 214 : rOutStm << SvHash_interface()->GetName().getStr();
1246 : 386 : rOutStm << ' ' << GetName().getString().getStr();
1247 : : }
1248 : 386 : break;
1249 : : case TYPE_STRUCT:
1250 : : {
1251 : 614 : rOutStm << SvHash_struct()->GetName().getStr()
1252 : 1228 : << ' ' << GetName().getString().getStr();
1253 : : }
1254 : 614 : break;
1255 : : case TYPE_UNION:
1256 : : {
1257 : 0 : rOutStm << SvHash_union()->GetName().getStr()
1258 : 0 : << ' ' << GetName().getString().getStr();
1259 : : }
1260 : 0 : break;
1261 : : case TYPE_ENUM:
1262 : : {
1263 : 410 : rOutStm << SvHash_enum()->GetName().getStr()
1264 : 820 : << ' ' << GetName().getString().getStr();
1265 : : }
1266 : 410 : break;
1267 : : case TYPE_POINTER:
1268 : : case TYPE_BASE:
1269 : : {
1270 [ + - ]: 2290 : if( IsItem() )
1271 : 2290 : rOutStm << SvHash_item()->GetName().getStr() << ' ';
1272 : : else
1273 : 0 : rOutStm << SvHash_typedef()->GetName().getStr() << ' ';
1274 [ + - ]: 2290 : if( GetRef() )
1275 : : {
1276 : 2290 : ((SvMetaType *)GetRef())->WriteTheType( rBase, rOutStm, nTab, WRITE_IDL );
1277 : 2290 : rOutStm << ' ';
1278 : : }
1279 : 2290 : rOutStm << GetName().getString().getStr();
1280 : : }
1281 : 2290 : break;
1282 : : case TYPE_METHOD:
1283 : : {
1284 : 0 : rOutStm << SvHash_typedef()->GetName().getStr() << ' ';
1285 : 0 : ((SvMetaType *)GetRef())->WriteTheType( rBase, rOutStm, nTab, WRITE_IDL );
1286 : 0 : rOutStm << ' ' << GetName().getString().getStr() << "( ";
1287 : 0 : WriteContextSvIdl( rBase, rOutStm, nTab );
1288 : 0 : rOutStm << " )";
1289 : : }
1290 : 0 : break;
1291 : : }
1292 : 3700 : }
1293 : :
1294 : 364 : void SvMetaType::ReadAttributesSvIdl( SvIdlDataBase & rBase,
1295 : : SvTokenStream & rInStm )
1296 : : {
1297 : 364 : SvMetaExtern::ReadAttributesSvIdl( rBase, rInStm );
1298 : 364 : aSvName.ReadSvIdl( SvHash_SvName(), rInStm );
1299 : 364 : aSbxName.ReadSvIdl( SvHash_SbxName(), rInStm );
1300 : 364 : aOdlName.ReadSvIdl( SvHash_OdlName(), rInStm );
1301 : 364 : }
1302 : :
1303 : 3700 : void SvMetaType::WriteAttributesSvIdl( SvIdlDataBase & rBase,
1304 : : SvStream & rOutStm,
1305 : : sal_uInt16 nTab )
1306 : : {
1307 [ + - ]: 3700 : SvMetaExtern::WriteAttributesSvIdl( rBase, rOutStm, nTab );
1308 [ + - ]: 3700 : rtl::OString name = GetName().getString();
1309 [ + - ][ + + ]: 3700 : if( aSvName.getString() != name || aSbxName.getString() != name || aOdlName.getString() != name )
[ + + ][ + - ]
1310 : : {
1311 [ + - ]: 410 : WriteTab( rOutStm, nTab );
1312 [ + - ][ + - ]: 410 : rOutStm << "class SvMetaType" << endl;
1313 [ - + ]: 410 : if( aSvName.getString() != name )
1314 : : {
1315 [ # # ]: 0 : WriteTab( rOutStm, nTab );
1316 [ # # ][ # # ]: 0 : aSvName.WriteSvIdl( SvHash_SvName(), rOutStm, nTab );
1317 [ # # ]: 0 : rOutStm << endl;
1318 : : }
1319 [ - + ]: 410 : if( aSbxName.getString() != name )
1320 : : {
1321 [ # # ]: 0 : WriteTab( rOutStm, nTab );
1322 [ # # ][ # # ]: 0 : aSbxName.WriteSvIdl( SvHash_SbxName(), rOutStm, nTab );
1323 [ # # ]: 0 : rOutStm << endl;
1324 : : }
1325 [ + - ]: 410 : if( aOdlName.getString() != name )
1326 : : {
1327 [ + - ]: 410 : WriteTab( rOutStm, nTab );
1328 [ + - ][ + - ]: 410 : aOdlName.WriteSvIdl( SvHash_OdlName(), rOutStm, nTab );
1329 [ + - ]: 410 : rOutStm << endl;
1330 : : }
1331 : 3700 : }
1332 : 3700 : }
1333 : :
1334 : 18762 : void SvMetaType::ReadContextSvIdl( SvIdlDataBase & rBase,
1335 : : SvTokenStream & rInStm )
1336 : : {
1337 [ + - ][ + - ]: 18762 : SvMetaAttributeRef xAttr = new SvMetaAttribute();
1338 [ + + ][ + - ]: 18762 : if( xAttr->ReadSvIdl( rBase, rInStm ) )
1339 : : {
1340 [ + - ][ + - ]: 9390 : if( xAttr->Test( rBase, rInStm ) )
1341 [ + - ][ + - ]: 9390 : GetAttrList().push_back( xAttr );
1342 [ + - ]: 18762 : }
1343 : 18762 : }
1344 : :
1345 : 2904 : void SvMetaType::WriteContextSvIdl
1346 : : (
1347 : : SvIdlDataBase & rBase,
1348 : : SvStream & rOutStm,
1349 : : sal_uInt16 nTab
1350 : : )
1351 : : {
1352 [ + + ]: 2904 : if( GetAttrCount() )
1353 : : {
1354 [ + - ]: 614 : SvMetaAttributeMemberList::const_iterator it = pAttrList->begin();
1355 [ + - ][ + + ]: 3190 : while( it != pAttrList->end() )
1356 : : {
1357 : 2576 : SvMetaAttribute * pAttr = *it;
1358 [ + - ]: 2576 : WriteTab( rOutStm, nTab );
1359 [ + - ]: 2576 : pAttr->WriteSvIdl( rBase, rOutStm, nTab );
1360 [ - + ]: 2576 : if( GetType() == TYPE_METHOD )
1361 [ # # ][ # # ]: 0 : rOutStm << ',' << endl;
1362 : : else
1363 [ + - ][ + - ]: 2576 : rOutStm << ';' << endl;
1364 : 2576 : ++it;
1365 : : }
1366 : : }
1367 : 2904 : }
1368 : :
1369 : 0 : void SvMetaType::WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm,
1370 : : sal_uInt16 nTab,
1371 : : WriteType nT, WriteAttribute nA )
1372 : : {
1373 : 0 : SvMetaExtern::WriteAttributes( rBase, rOutStm, nTab, nT, nA );
1374 : 0 : }
1375 : :
1376 : 806 : sal_uLong SvMetaType::MakeSfx( rtl::OStringBuffer& rAttrArray )
1377 : : {
1378 : 806 : sal_uLong nC = 0;
1379 : :
1380 [ + + ]: 806 : if( GetBaseType()->GetType() == TYPE_STRUCT )
1381 : : {
1382 : 266 : sal_uLong nAttrCount = GetAttrCount();
1383 : : // write the single attributes
1384 [ + + ]: 1458 : for( sal_uLong n = 0; n < nAttrCount; n++ )
1385 : : {
1386 : 1192 : nC += (*pAttrList)[n]->MakeSfx( rAttrArray );
1387 [ + + ]: 1192 : if( n +1 < nAttrCount )
1388 : 926 : rAttrArray.append(", ");
1389 : : }
1390 : : }
1391 : 806 : return nC;
1392 : : }
1393 : :
1394 : 806 : void SvMetaType::WriteSfxItem(
1395 : : const rtl::OString& rItemName, SvIdlDataBase &, SvStream & rOutStm )
1396 : : {
1397 [ + - ]: 806 : WriteStars( rOutStm );
1398 [ + - ]: 806 : rtl::OStringBuffer aVarName(RTL_CONSTASCII_STRINGPARAM(" a"));
1399 [ + - ][ + - ]: 806 : aVarName.append(rItemName).append(RTL_CONSTASCII_STRINGPARAM("_Impl"));
1400 : :
1401 [ + - ]: 806 : rtl::OStringBuffer aTypeName(RTL_CONSTASCII_STRINGPARAM("SfxType"));
1402 : 806 : rtl::OStringBuffer aAttrArray;
1403 [ + - ]: 806 : sal_uLong nAttrCount = MakeSfx( aAttrArray );
1404 : : rtl::OString aAttrCount(
1405 : 806 : rtl::OString::valueOf(static_cast<sal_Int32>(nAttrCount)));
1406 [ + - ]: 806 : aTypeName.append(aAttrCount);
1407 : :
1408 [ + - ][ + - ]: 806 : rOutStm << "extern " << aTypeName.getStr()
1409 [ + - ][ + - ]: 1612 : << aVarName.getStr() << ';' << endl;
[ + - ]
1410 : :
1411 : : // write the implementation part
1412 [ + - ][ + - ]: 806 : rOutStm << "#ifdef SFX_TYPEMAP" << endl
1413 [ + - ][ + - ]: 1612 : << aTypeName.getStr() << aVarName.getStr()
1414 [ + - ][ + - ]: 806 : << " = " << endl;
1415 [ + - ][ + - ]: 806 : rOutStm << '{' << endl
1416 [ + - ][ + - ]: 1612 : << "\tTYPE(" << rItemName.getStr() << "), "
[ + - ]
1417 [ + - ]: 1612 : << aAttrCount.getStr();
1418 [ + + ]: 806 : if( nAttrCount )
1419 : : {
1420 [ + - ]: 266 : rOutStm << ", { ";
1421 : : // write the single attributes
1422 [ + - ]: 266 : rOutStm << aAttrArray.getStr();
1423 [ + - ]: 266 : rOutStm << " }";
1424 : : }
1425 [ + - ][ + - ]: 806 : rOutStm << endl << "};" << endl
[ + - ]
1426 [ + - ][ + - ]: 806 : << "#endif" << endl << endl;
[ + - ]
1427 : 806 : }
1428 : :
1429 : 4464 : void SvMetaType::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm )
1430 : : {
1431 [ + + ]: 4464 : if( IsItem() )
1432 : : {
1433 [ + + ]: 806 : if( GetBaseType()->GetType() == TYPE_STRUCT )
1434 : 266 : GetBaseType()->WriteSfxItem( GetName().getString(), rBase, rOutStm );
1435 : : else
1436 : 540 : WriteSfxItem( GetName().getString(), rBase, rOutStm );
1437 : : }
1438 : 4464 : }
1439 : :
1440 : 8758 : sal_Bool SvMetaType::ReadMethodArgs( SvIdlDataBase & rBase,
1441 : : SvTokenStream & rInStm )
1442 : : {
1443 : 8758 : sal_uInt32 nTokPos = rInStm.Tell();
1444 [ + - ]: 8758 : if( rInStm.Read( '(' ) )
1445 : : {
1446 : 8758 : DoReadContextSvIdl( rBase, rInStm );
1447 [ + - ]: 8758 : if( rInStm.Read( ')' ) )
1448 : : {
1449 : 8758 : SetType( TYPE_METHOD );
1450 : 8758 : return sal_True;
1451 : : }
1452 : : }
1453 : 0 : rInStm.Seek( nTokPos );
1454 : 8758 : return sal_False;
1455 : : }
1456 : :
1457 : 13256 : void SvMetaType::WriteMethodArgs
1458 : : (
1459 : : SvIdlDataBase & rBase,
1460 : : SvStream & rOutStm,
1461 : : sal_uInt16 nTab, WriteType nT
1462 : : )
1463 : : {
1464 [ + - ]: 13256 : if( nT == WRITE_IDL )
1465 : : {
1466 [ + + ]: 13256 : if( GetAttrCount() )
1467 : : {
1468 [ + - ]: 4114 : rOutStm << endl;
1469 [ + - ]: 4114 : WriteTab( rOutStm, nTab );
1470 [ + - ][ + - ]: 4114 : rOutStm << '(' << endl;
1471 : :
1472 [ + - ]: 4114 : SvMetaAttributeMemberList::const_iterator it = pAttrList->begin();
1473 [ + - ][ + + ]: 13894 : while( it != pAttrList->end() )
1474 : : {
1475 : 9780 : SvMetaAttribute * pAttr = *it;
1476 [ + - ]: 9780 : WriteTab( rOutStm, nTab +1 );
1477 [ + - ]: 9780 : pAttr->WriteSvIdl( rBase, rOutStm, nTab +1 );
1478 : 9780 : ++it;
1479 [ + + ][ + - ]: 9780 : if( it != pAttrList->end() )
1480 [ + - ][ + - ]: 5666 : rOutStm << ',' << endl;
1481 : : }
1482 [ + - ]: 4114 : rOutStm << endl;
1483 [ + - ]: 4114 : WriteTab( rOutStm, nTab );
1484 [ + - ]: 4114 : rOutStm << ')';
1485 : : }
1486 : : else
1487 : 9142 : rOutStm << "()";
1488 : : }
1489 [ # # ]: 0 : else if ( nT == WRITE_DOCU )
1490 : : {
1491 : :
1492 : 0 : rOutStm << '(';
1493 [ # # ]: 0 : if( GetAttrCount() )
1494 : : {
1495 [ # # ]: 0 : SvMetaAttributeMemberList::const_iterator it = pAttrList->begin();
1496 [ # # ][ # # ]: 0 : while( it != pAttrList->end() )
1497 : : {
1498 : 0 : SvMetaAttribute * pAttr = *it;
1499 [ # # ]: 0 : pAttr->WriteParam( rBase, rOutStm, nTab+1, nT );
1500 : 0 : ++it;
1501 [ # # ][ # # ]: 0 : if( it != pAttrList->end() )
1502 [ # # ]: 0 : rOutStm << ',';
1503 : : else
1504 [ # # ]: 0 : rOutStm << ' ';
1505 : : }
1506 : : }
1507 : 0 : rOutStm << ')' << endl;
1508 : : }
1509 : : else
1510 : : {
1511 : 0 : rOutStm << '(';
1512 [ # # ][ # # ]: 0 : if( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
1513 : : {
1514 : 0 : rOutStm << ' ' << C_PREF << "Object h" << rBase.aIFaceName.getStr();
1515 [ # # ]: 0 : if( GetAttrCount() )
1516 : 0 : rOutStm << ',';
1517 : : else
1518 : 0 : rOutStm << ' ';
1519 : : }
1520 : :
1521 [ # # ]: 0 : if( GetAttrCount() )
1522 : : {
1523 [ # # ]: 0 : rOutStm << endl;
1524 [ # # ]: 0 : SvMetaAttributeMemberList::const_iterator it = pAttrList->begin();
1525 [ # # ][ # # ]: 0 : while( it != pAttrList->end() )
1526 : : {
1527 : 0 : SvMetaAttribute* pAttr = *it;
1528 [ # # ]: 0 : switch( nT )
1529 : : {
1530 : : case WRITE_C_HEADER:
1531 : : case WRITE_C_SOURCE:
1532 : : case WRITE_ODL:
1533 : : {
1534 [ # # ]: 0 : pAttr->WriteParam( rBase, rOutStm, nTab +1, nT );
1535 : : }
1536 : 0 : break;
1537 : :
1538 : : default:
1539 : : {
1540 : : DBG_ASSERT( sal_False, "WriteType not implemented" );
1541 : : }
1542 : : }
1543 : 0 : ++it;
1544 [ # # ][ # # ]: 0 : if( it != pAttrList->end() )
1545 [ # # ][ # # ]: 0 : rOutStm << ',' << endl;
1546 : : }
1547 [ # # ][ # # ]: 0 : if( nT != WRITE_C_HEADER && nT != WRITE_C_SOURCE )
1548 : : {
1549 [ # # ]: 0 : rOutStm << endl;
1550 [ # # ]: 0 : WriteTab( rOutStm, nTab +1 );
1551 : : }
1552 [ # # ]: 0 : rOutStm << ' ';
1553 : : }
1554 : 0 : rOutStm << ')';
1555 : : }
1556 : 13256 : }
1557 : :
1558 : 39928 : void SvMetaType::WriteTypePrefix( SvIdlDataBase & rBase, SvStream & rOutStm,
1559 : : sal_uInt16 nTab, WriteType nT )
1560 : : {
1561 [ + - - - : 39928 : switch( nT )
- ]
1562 : : {
1563 : : case WRITE_IDL:
1564 : : {
1565 [ - + ][ # # ]: 39928 : if( GetIn() && GetOut() )
[ - + ]
1566 : 0 : rOutStm << SvHash_inout()->GetName().getStr() << ' ';
1567 [ - + ]: 39928 : else if( GetIn() )
1568 : 0 : rOutStm << SvHash_in()->GetName().getStr() << ' ';
1569 [ - + ]: 39928 : else if( GetOut() )
1570 : 0 : rOutStm << SvHash_out()->GetName().getStr() << ' ';
1571 [ + - ]: 39928 : rOutStm << GetCString().getStr();
1572 : : }
1573 : 39928 : break;
1574 : :
1575 : : case WRITE_ODL:
1576 : : {
1577 [ # # ]: 0 : sal_Bool bIn = GetIn();
1578 [ # # ]: 0 : sal_Bool bOut = GetOut();
1579 [ # # ][ # # ]: 0 : if( bIn || bOut )
1580 : : {
1581 [ # # ][ # # ]: 0 : if( bIn && bOut )
1582 [ # # ]: 0 : rOutStm << "[in,out] ";
1583 [ # # ]: 0 : else if( bIn )
1584 [ # # ]: 0 : rOutStm << "[in] ";
1585 [ # # ]: 0 : else if( bOut )
1586 [ # # ]: 0 : rOutStm << "[out] ";
1587 : : }
1588 : :
1589 : 0 : rtl::OString out;
1590 [ # # ]: 0 : if( GetType() == TYPE_METHOD )
1591 [ # # ][ # # ]: 0 : out = GetReturnType()->GetBaseType()->GetOdlName();
1592 : : else
1593 : : {
1594 [ # # ]: 0 : SvMetaType * pBType = GetBaseType();
1595 [ # # ]: 0 : out = pBType->GetOdlName();
1596 : : }
1597 [ # # # # ]: 0 : if( aCall0 == (int)CALL_POINTER
[ # # ]
1598 : 0 : || aCall0 == (int)CALL_REFERENCE )
1599 [ # # ]: 0 : rOutStm << " *";
1600 [ # # # # ]: 0 : if( aCall1 == (int)CALL_POINTER
[ # # ]
1601 : 0 : || aCall1 == (int)CALL_REFERENCE )
1602 [ # # ]: 0 : rOutStm << " *";
1603 [ # # ]: 0 : rOutStm << out.getStr();
1604 : : }
1605 : 0 : break;
1606 : :
1607 : : case WRITE_C_HEADER:
1608 : : case WRITE_C_SOURCE:
1609 : : case WRITE_CXX_HEADER:
1610 : : case WRITE_CXX_SOURCE:
1611 : : {
1612 : :
1613 : 0 : SvMetaType * pBaseType = GetBaseType();
1614 : : DBG_ASSERT( pBaseType, "no base type for attribute" );
1615 : :
1616 [ # # ]: 0 : if( pBaseType->GetType() == TYPE_METHOD )
1617 : : pBaseType->GetReturnType()->WriteTypePrefix(
1618 : 0 : rBase, rOutStm, nTab, nT );
1619 [ # # ][ # # ]: 0 : else if( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
1620 : : {
1621 [ # # ]: 0 : if( TYPE_STRUCT == pBaseType->GetType() )
1622 : 0 : rOutStm << C_PREF << pBaseType->GetName().getString().getStr()
1623 : 0 : << " *";
1624 : : else
1625 : : {
1626 [ # # ]: 0 : if ( pBaseType->GetType() == TYPE_ENUM )
1627 : 0 : rOutStm << C_PREF;
1628 : 0 : rOutStm << pBaseType->GetCName().getStr();
1629 : : }
1630 : : }
1631 : : else
1632 : : {
1633 [ # # ]: 0 : if( TYPE_STRUCT == pBaseType->GetType() )
1634 : 0 : rOutStm << pBaseType->GetName().getString().getStr() << " *";
1635 : : else
1636 : 0 : rOutStm << pBaseType->GetName().getString().getStr();
1637 : : }
1638 : : }
1639 : 0 : break;
1640 : :
1641 : : case WRITE_DOCU:
1642 : : {
1643 : :
1644 : 0 : SvMetaType * pBaseType = GetBaseType();
1645 : : DBG_ASSERT( pBaseType, "no base type for attribute" );
1646 : :
1647 [ # # ]: 0 : if( pBaseType->GetType() == TYPE_METHOD )
1648 : : {
1649 : : pBaseType->GetReturnType()->WriteTypePrefix(
1650 : 0 : rBase, rOutStm, nTab, nT );
1651 : : }
1652 : : else
1653 : : {
1654 [ # # ]: 0 : if( TYPE_STRUCT == pBaseType->GetType() )
1655 : 0 : rOutStm << "VARIANT" << pBaseType->GetName().getString().getStr();
1656 [ # # ]: 0 : else if ( pBaseType->GetType() == TYPE_ENUM )
1657 : 0 : rOutStm << "integer";
1658 : : else
1659 : 0 : rOutStm << pBaseType->GetOdlName().getStr();
1660 : : }
1661 : : }
1662 : :
1663 : : default:
1664 : : {
1665 : : DBG_ASSERT( sal_False, "WriteType not implemented" );
1666 : : }
1667 : : }
1668 : 39928 : }
1669 : :
1670 : 3886 : void SvMetaType::WriteTheType( SvIdlDataBase & rBase, SvStream & rOutStm,
1671 : : sal_uInt16 nTab, WriteType nT )
1672 : : {
1673 : 3886 : WriteTypePrefix( rBase, rOutStm, nTab, nT );
1674 [ - + ]: 3886 : if( GetType() == TYPE_METHOD )
1675 : 0 : WriteMethodArgs( rBase, rOutStm, nTab +2, nT );
1676 : 3886 : }
1677 : :
1678 : 0 : rtl::OString SvMetaType::GetParserString() const
1679 : : {
1680 [ # # ]: 0 : SvMetaType * pBT = GetBaseType();
1681 [ # # ]: 0 : if( pBT != this )
1682 [ # # ]: 0 : return pBT->GetParserString();
1683 : :
1684 : 0 : int type = GetType();
1685 : 0 : rtl::OString aPStr;
1686 : :
1687 [ # # ][ # # ]: 0 : if( TYPE_METHOD == type || TYPE_STRUCT == type )
1688 : : {
1689 [ # # ]: 0 : sal_uLong nAttrCount = GetAttrCount();
1690 : : // write the single attributes
1691 [ # # ]: 0 : for( sal_uLong n = 0; n < nAttrCount; n++ )
1692 : : {
1693 : 0 : SvMetaAttribute * pT = (*pAttrList)[n];
1694 [ # # ][ # # ]: 0 : aPStr += pT->GetType()->GetParserString();
1695 : 0 : }
1696 : : }
1697 : : else
1698 : 0 : aPStr = rtl::OString(GetParserChar());
1699 : 0 : return aPStr;
1700 : : }
1701 : :
1702 : 0 : void SvMetaType::WriteParamNames( SvIdlDataBase & rBase,
1703 : : SvStream & rOutStm,
1704 : : const rtl::OString& rChief )
1705 : : {
1706 : 0 : SvMetaType * pBT = GetBaseType();
1707 [ # # ]: 0 : if( pBT != this )
1708 : 0 : pBT->WriteParamNames( rBase, rOutStm, rChief );
1709 : : else
1710 : : {
1711 : 0 : int type = GetType();
1712 : :
1713 [ # # ][ # # ]: 0 : if( TYPE_METHOD == type || TYPE_STRUCT == type )
1714 : : {
1715 : 0 : sal_uLong nAttrCount = GetAttrCount();
1716 : : // write the single attributes
1717 [ # # ]: 0 : for( sal_uLong n = 0; n < nAttrCount; n++ )
1718 : : {
1719 : 0 : SvMetaAttribute * pA = (*pAttrList)[n];
1720 [ # # ]: 0 : rtl::OString aStr = pA->GetName().getString();
1721 [ # # ][ # # ]: 0 : pA->GetType()->WriteParamNames( rBase, rOutStm, aStr );
1722 [ # # ]: 0 : if( n +1 < nAttrCount )
1723 [ # # ]: 0 : rOutStm << ", ";
1724 : 0 : }
1725 : : }
1726 : : else
1727 : 0 : rOutStm << rChief.getStr();
1728 : : }
1729 : 0 : }
1730 : :
1731 [ # # ][ # # ]: 2298 : SV_IMPL_META_FACTORY1( SvMetaTypeString, SvMetaType );
[ # # ][ # # ]
[ # # ][ - + ]
[ - + ]
1732 : 16 : SvMetaTypeString::SvMetaTypeString()
1733 [ + - ]: 16 : : SvMetaType( "String", "SbxSTRING", "BSTR", 's', "char *", "String", "$" )
1734 : : {
1735 : 16 : }
1736 : :
1737 : 0 : void SvMetaTypeString::Load( SvPersistStream & rStm )
1738 : : {
1739 : 0 : SvMetaType::Load( rStm );
1740 : 0 : }
1741 : :
1742 : 16 : void SvMetaTypeString::Save( SvPersistStream & rStm )
1743 : : {
1744 : 16 : SvMetaType::Save( rStm );
1745 : 16 : }
1746 : :
1747 [ # # ][ # # ]: 2848 : SV_IMPL_META_FACTORY1( SvMetaEnumValue, SvMetaName );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1748 : 3258 : SvMetaEnumValue::SvMetaEnumValue()
1749 : : {
1750 : 3258 : }
1751 : :
1752 : 0 : void SvMetaEnumValue::Load( SvPersistStream & rStm )
1753 : : {
1754 [ # # ]: 0 : SvMetaName::Load( rStm );
1755 : :
1756 : : sal_uInt8 nMask;
1757 [ # # ]: 0 : rStm >> nMask;
1758 [ # # ]: 0 : if( nMask >= 0x02 )
1759 : : {
1760 [ # # ]: 0 : rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
1761 : : OSL_FAIL( "wrong format" );
1762 : 0 : return;
1763 : : }
1764 [ # # ][ # # ]: 0 : if( nMask & 0x01 ) aEnumValue = read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rStm);
1765 : : }
1766 : :
1767 : 2848 : void SvMetaEnumValue::Save( SvPersistStream & rStm )
1768 : : {
1769 : 2848 : SvMetaName::Save( rStm );
1770 : :
1771 : : // create mask
1772 : 2848 : sal_uInt8 nMask = 0;
1773 [ - + ]: 2848 : if( !aEnumValue.isEmpty() ) nMask |= 0x01;
1774 : :
1775 : : // write data
1776 : 2848 : rStm << nMask;
1777 [ - + ]: 2848 : if( nMask & 0x01 ) write_lenPrefixed_uInt8s_FromOString<sal_uInt16>(rStm, aEnumValue);
1778 : 2848 : }
1779 : :
1780 : 3258 : sal_Bool SvMetaEnumValue::ReadSvIdl( SvIdlDataBase & rBase,
1781 : : SvTokenStream & rInStm )
1782 : : {
1783 [ + + ]: 3258 : if( !ReadNameSvIdl( rBase, rInStm ) )
1784 : 410 : return sal_False;
1785 : 3258 : return sal_True;
1786 : : }
1787 : :
1788 : 2848 : void SvMetaEnumValue::WriteSvIdl( SvIdlDataBase &, SvStream & rOutStm, sal_uInt16 )
1789 : : {
1790 : 2848 : rOutStm << GetName().getString().getStr();
1791 : 2848 : }
1792 : :
1793 : 0 : void SvMetaEnumValue::Write( SvIdlDataBase &, SvStream & rOutStm, sal_uInt16,
1794 : : WriteType nT, WriteAttribute )
1795 : : {
1796 [ # # ][ # # ]: 0 : if ( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
1797 : 0 : rOutStm << C_PREF << GetName().getString().getStr();
1798 : : else
1799 : 0 : rOutStm << GetName().getString().getStr();
1800 : 0 : }
1801 : :
1802 [ # # ][ # # ]: 36260 : SV_IMPL_META_FACTORY1( SvMetaTypeEnum, SvMetaType );
[ # # ][ # # ]
[ # # ][ + - ]
[ # # ]
1803 [ + - ]: 410 : SvMetaTypeEnum::SvMetaTypeEnum()
1804 : : {
1805 : 410 : SetBasicName("Integer");
1806 : 410 : }
1807 : :
1808 : 0 : void SvMetaTypeEnum::Load( SvPersistStream & rStm )
1809 : : {
1810 [ # # ]: 0 : SvMetaType::Load( rStm );
1811 : :
1812 : : sal_uInt8 nMask;
1813 [ # # ]: 0 : rStm >> nMask;
1814 [ # # ]: 0 : if( nMask >= 0x04 )
1815 : : {
1816 [ # # ]: 0 : rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
1817 : : OSL_FAIL( "wrong format" );
1818 : 0 : return;
1819 : : }
1820 [ # # ][ # # ]: 0 : if( nMask & 0x01 ) rStm >> aEnumValueList;
1821 [ # # ][ # # ]: 0 : if( nMask & 0x02 ) aPrefix = read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rStm);
1822 : : }
1823 : :
1824 : 410 : void SvMetaTypeEnum::Save( SvPersistStream & rStm )
1825 : : {
1826 : 410 : SvMetaType::Save( rStm );
1827 : :
1828 : : // create mask
1829 : 410 : sal_uInt8 nMask = 0;
1830 [ + - ]: 410 : if( !aEnumValueList.empty() ) nMask |= 0x01;
1831 [ + - ]: 410 : if( !aPrefix.isEmpty() ) nMask |= 0x02;
1832 : :
1833 : : // write data
1834 : 410 : rStm << nMask;
1835 [ + - ]: 410 : if( nMask & 0x01 ) rStm << aEnumValueList;
1836 [ + - ]: 410 : if( nMask & 0x02 ) write_lenPrefixed_uInt8s_FromOString<sal_uInt16>(rStm, aPrefix);
1837 : 410 : }
1838 : :
1839 : : namespace
1840 : : {
1841 : 2438 : rtl::OString getCommonSubPrefix(const rtl::OString &rA, const rtl::OString &rB)
1842 : : {
1843 [ + - ]: 2438 : sal_Int32 nMax = std::min(rA.getLength(), rB.getLength());
1844 : 2438 : sal_Int32 nI = 0;
1845 [ + + ]: 28940 : while (nI < nMax)
1846 : : {
1847 [ + + ]: 26940 : if (rA[nI] != rB[nI])
1848 : 438 : break;
1849 : 26502 : ++nI;
1850 : : }
1851 : 2438 : return rA.copy(0, nI);
1852 : : }
1853 : : }
1854 : :
1855 : 3258 : void SvMetaTypeEnum::ReadContextSvIdl( SvIdlDataBase & rBase,
1856 : : SvTokenStream & rInStm )
1857 : : {
1858 [ + - ]: 3258 : sal_uInt32 nTokPos = rInStm.Tell();
1859 : :
1860 [ + - ][ + - ]: 3258 : SvMetaEnumValueRef aEnumVal = new SvMetaEnumValue();
1861 [ + - ]: 3258 : sal_Bool bOk = aEnumVal->ReadSvIdl( rBase, rInStm );
1862 [ + + ]: 3258 : if( bOk )
1863 : : {
1864 [ + + ]: 2848 : if( aEnumValueList.empty() )
1865 : : {
1866 : : // the first
1867 [ + - ]: 410 : aPrefix = aEnumVal->GetName().getString();
1868 : : }
1869 : : else
1870 : : {
1871 [ + - ][ + - ]: 2438 : aPrefix = getCommonSubPrefix(aPrefix, aEnumVal->GetName().getString());
1872 : : }
1873 [ + - ]: 2848 : aEnumValueList.push_back( aEnumVal );
1874 : : }
1875 [ + + ]: 3258 : if( !bOk )
1876 [ + - ][ + - ]: 3258 : rInStm.Seek( nTokPos );
1877 : 3258 : }
1878 : :
1879 : 410 : void SvMetaTypeEnum::WriteContextSvIdl( SvIdlDataBase & rBase,
1880 : : SvStream & rOutStm,
1881 : : sal_uInt16 nTab )
1882 : : {
1883 : 410 : WriteTab( rOutStm, nTab +1 );
1884 [ + + ]: 3258 : for( sal_uLong n = 0; n < aEnumValueList.size(); n++ )
1885 : : {
1886 : 2848 : aEnumValueList[n]->WriteSvIdl( rBase, rOutStm, nTab );
1887 [ + + ]: 2848 : if( n + 1 != aEnumValueList.size() )
1888 : 2438 : rOutStm << ", ";
1889 : : else
1890 : 410 : rOutStm << endl;
1891 : : }
1892 : 410 : }
1893 : :
1894 : 410 : sal_Bool SvMetaTypeEnum::ReadSvIdl( SvIdlDataBase & rBase,
1895 : : SvTokenStream & rInStm )
1896 : : {
1897 : 410 : sal_uInt32 nTokPos = rInStm.Tell();
1898 [ + - ]: 820 : if( SvMetaType::ReadHeaderSvIdl( rBase, rInStm )
[ + - + - ]
1899 : 410 : && GetType() == TYPE_ENUM )
1900 : : {
1901 [ + - ]: 410 : if( SvMetaName::ReadSvIdl( rBase, rInStm ) )
1902 : 410 : return sal_True;
1903 : : }
1904 : 0 : rInStm.Seek( nTokPos );
1905 : 410 : return sal_False;
1906 : : }
1907 : :
1908 : 410 : void SvMetaTypeEnum::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
1909 : : sal_uInt16 nTab )
1910 : : {
1911 : 410 : WriteHeaderSvIdl( rBase, rOutStm, nTab );
1912 : 410 : rOutStm << endl;
1913 : 410 : SvMetaName::WriteSvIdl( rBase, rOutStm, nTab );
1914 : 410 : rOutStm << endl;
1915 : 410 : }
1916 : :
1917 : 0 : void SvMetaTypeEnum::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
1918 : : sal_uInt16 nTab,
1919 : : WriteType nT, WriteAttribute nA )
1920 : : {
1921 : 0 : SvMetaType::Write( rBase, rOutStm, nTab, nT, nA );
1922 : 0 : }
1923 : :
1924 : 0 : void SvMetaTypeEnum::WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm,
1925 : : sal_uInt16 nTab,
1926 : : WriteType nT, WriteAttribute nA )
1927 : : {
1928 : 0 : WriteTab( rOutStm, nTab +1 );
1929 [ # # ]: 0 : for( sal_uLong n = 0; n < aEnumValueList.size(); n++ )
1930 : : {
1931 : 0 : aEnumValueList[n]->Write( rBase, rOutStm, nTab +1, nT, nA );
1932 : :
1933 [ # # ]: 0 : if( n + 1 != aEnumValueList.size() )
1934 : : {
1935 [ # # ]: 0 : if( 2 == n % 3 )
1936 : : {
1937 : 0 : rOutStm << ',' << endl;
1938 : 0 : WriteTab( rOutStm, nTab +1 );
1939 : : }
1940 : : else
1941 : 0 : rOutStm << ",\t";
1942 : : }
1943 : : else
1944 : 0 : rOutStm << endl;
1945 : : }
1946 : 0 : rOutStm << endl;
1947 : 0 : }
1948 : :
1949 [ # # ][ # # ]: 338 : SV_IMPL_META_FACTORY1( SvMetaTypevoid, SvMetaType );
[ # # ][ # # ]
[ # # ][ - + ]
[ - + ]
1950 : 16 : SvMetaTypevoid::SvMetaTypevoid()
1951 [ + - ]: 16 : : SvMetaType( "void", "SbxVOID", "void", 'v', "void", "", "" )
1952 : : {
1953 : 16 : }
1954 : :
1955 : 0 : void SvMetaTypevoid::Load( SvPersistStream & rStm )
1956 : : {
1957 : 0 : SvMetaType::Load( rStm );
1958 : 0 : }
1959 : :
1960 : 16 : void SvMetaTypevoid::Save( SvPersistStream & rStm )
1961 : : {
1962 : 16 : SvMetaType::Save( rStm );
1963 : 16 : }
1964 : :
1965 : 0 : rtl::OString SvMetaAttribute::Compare( SvMetaAttribute* pAttr )
1966 : : {
1967 : 0 : rtl::OStringBuffer aStr;
1968 : :
1969 [ # # ]: 0 : if ( aType.Is() )
1970 : : {
1971 [ # # ]: 0 : if ( aType->GetType() == TYPE_METHOD )
1972 : : {
1973 : : // Test only when the attribute is a method not if it has one!
1974 [ # # ][ # # ]: 0 : if ( !pAttr->GetType()->GetType() == TYPE_METHOD )
1975 [ # # ]: 0 : aStr.append(" IsMethod\n");
1976 [ # # # # ]: 0 : else if ( aType->GetReturnType() &&
[ # # ]
1977 [ # # ]: 0 : aType->GetReturnType()->GetType() != pAttr->GetType()->GetReturnType()->GetType() )
1978 : : {
1979 [ # # ]: 0 : aStr.append(" ReturnType\n");
1980 : : }
1981 : :
1982 [ # # ][ # # ]: 0 : if ( aType->GetAttrCount() )
1983 : : {
1984 [ # # ]: 0 : sal_uLong nCount = aType->GetAttrCount();
1985 [ # # ]: 0 : SvMetaAttributeMemberList& rList = aType->GetAttrList();
1986 [ # # ][ # # ]: 0 : SvMetaAttributeMemberList& rOtherList = pAttr->GetType()->GetAttrList();
1987 [ # # ][ # # ]: 0 : if ( pAttr->GetType()->GetAttrCount() != nCount )
[ # # ]
1988 : : {
1989 [ # # ]: 0 : aStr.append(" AttributeCount\n");
1990 : : }
1991 : : else
1992 : : {
1993 [ # # ]: 0 : for ( sal_uInt16 n=0; n<nCount; n++ )
1994 : : {
1995 : 0 : SvMetaAttribute *pAttr1 = rList[n];
1996 : 0 : SvMetaAttribute *pAttr2 = rOtherList[n];
1997 [ # # ]: 0 : pAttr1->Compare( pAttr2 );
1998 : : }
1999 : : }
2000 : : }
2001 : : }
2002 : :
2003 [ # # ][ # # ]: 0 : if ( GetType()->GetType() != pAttr->GetType()->GetType() )
[ # # ]
2004 [ # # ]: 0 : aStr.append(" Type\n");
2005 : :
2006 [ # # ][ # # ]: 0 : if ( !GetType()->GetSvName().equals( pAttr->GetType()->GetSvName() ) )
[ # # ][ # # ]
[ # # ]
2007 [ # # ]: 0 : aStr.append(" ItemType\n");
2008 : : }
2009 : :
2010 [ # # ][ # # ]: 0 : if ( GetExport() != pAttr->GetExport() )
[ # # ]
2011 [ # # ]: 0 : aStr.append(" Export\n");
2012 : :
2013 [ # # ][ # # ]: 0 : if ( GetAutomation() != pAttr->GetAutomation() )
[ # # ]
2014 [ # # ]: 0 : aStr.append(" Automation\n");
2015 : :
2016 [ # # ][ # # ]: 0 : if ( GetIsCollection() != pAttr->GetIsCollection() )
[ # # ]
2017 [ # # ]: 0 : aStr.append(" IsCollection\n");
2018 : :
2019 [ # # ][ # # ]: 0 : if ( GetReadOnlyDoc() != pAttr->GetReadOnlyDoc() )
[ # # ]
2020 [ # # ]: 0 : aStr.append(" ReadOnlyDoc\n");
2021 : :
2022 [ # # ][ # # ]: 0 : if ( GetExport() && GetReadonly() != pAttr->GetReadonly() )
[ # # ][ # # ]
[ # # ][ # # ]
2023 [ # # ]: 0 : aStr.append(" Readonly\n");
2024 : :
2025 : 0 : return aStr.makeStringAndClear();
2026 : : }
2027 : :
2028 : 0 : void SvMetaAttribute::WriteCSV( SvIdlDataBase&, SvStream& rStrm )
2029 : : {
2030 : 0 : rStrm << GetType()->GetSvName().getStr() << ' ';
2031 : 0 : rStrm << GetName().getString().getStr() << ' ';
2032 : 0 : rStrm << GetSlotId().getString().getStr();
2033 : 0 : }
2034 : :
2035 : :
2036 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|