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 <rtl/strbuf.hxx>
25 :
26 : #include <object.hxx>
27 : #include <globals.hxx>
28 : #include <database.hxx>
29 :
30 112 : SV_IMPL_PERSIST1( SvClassElement, SvPersistBase );
31 :
32 112 : SvClassElement::SvClassElement()
33 : {
34 112 : };
35 :
36 0 : void SvClassElement::Load( SvPersistStream & rStm )
37 : {
38 : sal_uInt8 nMask;
39 0 : rStm >> nMask;
40 0 : if( nMask >= 0x08 )
41 : {
42 0 : rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
43 : OSL_FAIL( "wrong format" );
44 0 : return;
45 : }
46 0 : if( nMask & 0x01 ) rStm >> aAutomation;
47 0 : if( nMask & 0x02 ) aPrefix = read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rStm);
48 0 : if( nMask & 0x04 )
49 : {
50 : SvMetaClass * p;
51 0 : rStm >> p;
52 0 : xClass = p;
53 : }
54 : }
55 :
56 112 : void SvClassElement::Save( SvPersistStream & rStm )
57 : {
58 : // create mask
59 112 : sal_uInt8 nMask = 0;
60 112 : if( aAutomation.IsSet() ) nMask |= 0x1;
61 112 : if( !aPrefix.isEmpty() ) nMask |= 0x2;
62 112 : if( xClass.Is() ) nMask |= 0x4;
63 :
64 : // write data
65 112 : rStm << nMask;
66 112 : if( nMask & 0x01 ) rStm << aAutomation;
67 112 : if( nMask & 0x02 ) write_lenPrefixed_uInt8s_FromOString<sal_uInt16>(rStm, aPrefix);
68 112 : if( nMask & 0x04 ) rStm << xClass;
69 112 : }
70 :
71 620 : SV_IMPL_META_FACTORY1( SvMetaClass, SvMetaType );
72 194 : SvMetaClass::SvMetaClass()
73 194 : : aAutomation( sal_True, sal_False )
74 : {
75 194 : }
76 :
77 0 : void SvMetaClass::Load( SvPersistStream & rStm )
78 : {
79 0 : SvMetaType::Load( rStm );
80 :
81 : sal_uInt8 nMask;
82 0 : rStm >> nMask;
83 0 : if( nMask >= 0x20 )
84 : {
85 0 : rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
86 : OSL_FAIL( "wrong format" );
87 0 : return;
88 : }
89 0 : if( nMask & 0x01 ) rStm >> aAttrList;
90 0 : if( nMask & 0x02 )
91 : {
92 : SvMetaClass * pSuper;
93 0 : rStm >> pSuper;
94 0 : aSuperClass = pSuper;
95 : }
96 0 : if( nMask & 0x04 ) rStm >> aClassList;
97 0 : if( nMask & 0x8 )
98 : {
99 : SvMetaClass * p;
100 0 : rStm >> p;
101 0 : xAutomationInterface = p;
102 : }
103 0 : if( nMask & 0x10 ) rStm >> aAutomation;
104 : }
105 :
106 194 : void SvMetaClass::Save( SvPersistStream & rStm )
107 : {
108 194 : SvMetaType::Save( rStm );
109 :
110 : // create mask
111 194 : sal_uInt8 nMask = 0;
112 194 : if( !aAttrList.empty() ) nMask |= 0x1;
113 194 : if( aSuperClass.Is() ) nMask |= 0x2;
114 194 : if( !aClassList.empty() ) nMask |= 0x4;
115 194 : if( xAutomationInterface.Is() ) nMask |= 0x8;
116 194 : if( aAutomation.IsSet() ) nMask |= 0x10;
117 :
118 : // write data
119 194 : rStm << nMask;
120 194 : if( nMask & 0x01 ) rStm << aAttrList;
121 194 : if( nMask & 0x02 ) rStm << aSuperClass;
122 194 : if( nMask & 0x04 ) rStm << aClassList;
123 194 : if( nMask & 0x08 ) rStm << xAutomationInterface;
124 194 : if( nMask & 0x10 ) rStm << aAutomation;
125 194 : }
126 :
127 182 : void SvMetaClass::ReadAttributesSvIdl( SvIdlDataBase & rBase,
128 : SvTokenStream & rInStm )
129 : {
130 182 : SvMetaType::ReadAttributesSvIdl( rBase, rInStm );
131 182 : aAutomation.ReadSvIdl( SvHash_Automation(), rInStm );
132 182 : }
133 :
134 194 : void SvMetaClass::WriteAttributesSvIdl( SvIdlDataBase & rBase,
135 : SvStream & rOutStm, sal_uInt16 nTab )
136 : {
137 194 : SvMetaType::WriteAttributesSvIdl( rBase, rOutStm, nTab );
138 :
139 194 : if( !aAutomation )
140 : {
141 23 : WriteTab( rOutStm, nTab );
142 23 : rOutStm << "//class SvMetaClass" << endl;
143 23 : if( !aAutomation )
144 : {
145 23 : WriteTab( rOutStm, nTab );
146 23 : aAutomation.WriteSvIdl( SvHash_Automation(), rOutStm );
147 23 : rOutStm << ';' << endl;
148 : }
149 : }
150 194 : }
151 :
152 4143 : void SvMetaClass::ReadContextSvIdl( SvIdlDataBase & rBase,
153 : SvTokenStream & rInStm )
154 : {
155 4143 : sal_uInt32 nTokPos = rInStm.Tell();
156 4143 : SvToken * pTok = rInStm.GetToken_Next();
157 :
158 4143 : if( pTok->Is( SvHash_import() ) )
159 : {
160 112 : SvMetaClass * pClass = rBase.ReadKnownClass( rInStm );
161 112 : if( pClass )
162 : {
163 112 : SvClassElementRef xEle = new SvClassElement();
164 112 : xEle->SetClass( pClass );
165 112 : aClassList.push_back( xEle );
166 :
167 112 : if( rInStm.Read( '[' ) )
168 : {
169 61 : pTok = rInStm.GetToken_Next();
170 61 : if( pTok->Is( SvHash_Automation() ) )
171 : {
172 61 : if( rInStm.Read( ']' ) )
173 : {
174 61 : if( xAutomationInterface.Is() )
175 : {
176 : // set error
177 : rBase.SetError( "Automation allready set",
178 0 : rInStm.GetToken() );
179 0 : rBase.WriteError( rInStm );
180 : }
181 61 : xAutomationInterface = pClass;
182 61 : xEle->SetAutomation( sal_True );
183 : }
184 : else
185 : {
186 : // set error
187 0 : rBase.SetError( "missing ]", rInStm.GetToken() );
188 0 : rBase.WriteError( rInStm );
189 : }
190 : }
191 : else
192 : {
193 : // set error
194 : rBase.SetError( "only attribute Automation allowed",
195 0 : rInStm.GetToken() );
196 0 : rBase.WriteError( rInStm );
197 : }
198 : }
199 112 : pTok = rInStm.GetToken();
200 112 : if( pTok->IsString() )
201 : {
202 7 : xEle->SetPrefix( pTok->GetString() );
203 7 : rInStm.GetToken_Next();
204 : }
205 112 : return;
206 : }
207 : else
208 : {
209 : // set error
210 0 : rBase.SetError( "unknown imported interface", rInStm.GetToken() );
211 0 : rBase.WriteError( rInStm );
212 : }
213 : }
214 : else
215 : {
216 4031 : rInStm.Seek( nTokPos );
217 4031 : SvMetaType * pType = rBase.ReadKnownType( rInStm );
218 :
219 4031 : sal_Bool bOk = sal_False;
220 4031 : SvMetaAttributeRef xAttr;
221 4031 : if( !pType || pType->IsItem() )
222 : {
223 4015 : xAttr = new SvMetaSlot( pType );
224 4015 : if( xAttr->ReadSvIdl( rBase, rInStm ) )
225 3821 : bOk = xAttr->Test( rBase, rInStm );
226 : }
227 : else
228 : {
229 16 : xAttr = new SvMetaAttribute( pType );
230 16 : if( xAttr->ReadSvIdl( rBase, rInStm ) )
231 16 : bOk = xAttr->Test( rBase, rInStm );
232 : }
233 :
234 4031 : if( bOk )
235 3837 : bOk = TestAttribute( rBase, rInStm, *xAttr );
236 4031 : if( bOk )
237 : {
238 3837 : if( !xAttr->GetSlotId().IsSet() )
239 : {
240 5 : SvNumberIdentifier aI;
241 5 : aI.SetValue( rBase.GetUniqueId() );
242 5 : xAttr->SetSlotId( aI );
243 : }
244 3837 : aAttrList.push_back( xAttr );
245 : return;
246 4031 : }
247 : }
248 194 : rInStm.Seek( nTokPos );
249 : }
250 :
251 194 : void SvMetaClass::WriteContextSvIdl
252 : (
253 : SvIdlDataBase & rBase,
254 : SvStream & rOutStm,
255 : sal_uInt16 nTab
256 : )
257 : {
258 : sal_uLong n;
259 4031 : for( n = 0; n < aAttrList.size(); n++ )
260 : {
261 3837 : WriteTab( rOutStm, nTab );
262 3837 : aAttrList[n]->WriteSvIdl( rBase, rOutStm, nTab );
263 3837 : rOutStm << ';' << endl;
264 : }
265 306 : for( n = 0; n < aClassList.size(); n++ )
266 : {
267 112 : SvClassElement * pEle = aClassList[n];
268 112 : WriteTab( rOutStm, nTab );
269 112 : rOutStm << SvHash_import()->GetName().getStr() << ' '
270 224 : << pEle->GetPrefix().getStr();
271 112 : if( pEle->GetAutomation() )
272 61 : rOutStm << " [ " << SvHash_Automation()->GetName().getStr()
273 61 : << " ]";
274 112 : if( !pEle->GetPrefix().isEmpty() )
275 7 : rOutStm << ' ' << pEle->GetPrefix().getStr();
276 112 : rOutStm << ';' << endl;
277 : }
278 194 : }
279 :
280 194 : sal_Bool SvMetaClass::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
281 : {
282 194 : sal_uLong nTokPos = rInStm.Tell();
283 194 : if( SvMetaType::ReadHeaderSvIdl( rBase, rInStm ) && GetType() == TYPE_CLASS )
284 : {
285 194 : sal_Bool bOk = sal_True;
286 194 : if( rInStm.Read( ':' ) )
287 : {
288 59 : aSuperClass = rBase.ReadKnownClass( rInStm );
289 59 : bOk = aSuperClass.Is();
290 59 : if( !bOk )
291 : {
292 : // set error
293 : rBase.SetError( "unknown super class",
294 0 : rInStm.GetToken() );
295 0 : rBase.WriteError( rInStm );
296 : }
297 : }
298 194 : if( bOk )
299 : {
300 194 : rBase.Write(rtl::OString('.'));
301 194 : bOk = SvMetaName::ReadSvIdl( rBase, rInStm );
302 : }
303 194 : if( bOk )
304 194 : return bOk;
305 : }
306 0 : rInStm.Seek( nTokPos );
307 0 : return sal_False;
308 : }
309 :
310 4194 : sal_Bool SvMetaClass::TestAttribute( SvIdlDataBase & rBase, SvTokenStream & rInStm,
311 : SvMetaAttribute & rAttr ) const
312 : {
313 4194 : if ( !rAttr.GetRef() && rAttr.IsA( TYPE( SvMetaSlot ) ) )
314 : {
315 : OSL_FAIL( "Neuer Slot : " );
316 : OSL_FAIL( rAttr.GetSlotId().getString().getStr() );
317 : }
318 :
319 375614 : for( sal_uLong n = 0; n < aAttrList.size(); n++ )
320 : {
321 371420 : SvMetaAttribute * pS = aAttrList[n];
322 371420 : if( pS->GetName().getString() == rAttr.GetName().getString() )
323 : {
324 : // values have to match
325 10 : if( pS->GetSlotId().GetValue() != rAttr.GetSlotId().GetValue() )
326 : {
327 : OSL_FAIL( "Gleicher Name in MetaClass : " );
328 : OSL_FAIL( pS->GetName().getString().getStr() );
329 : OSL_FAIL( pS->GetSlotId().getString().getStr() );
330 : OSL_FAIL( rAttr.GetSlotId().getString().getStr() );
331 :
332 0 : rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("Attribute's "));
333 0 : aStr.append(pS->GetName().getString());
334 0 : aStr.append(RTL_CONSTASCII_STRINGPARAM(" with different id's"));
335 0 : rBase.SetError(aStr.makeStringAndClear(), rInStm.GetToken());
336 0 : rBase.WriteError( rInStm );
337 0 : return sal_False;
338 : }
339 : }
340 : else
341 : {
342 371410 : sal_uInt32 nId1 = pS->GetSlotId().GetValue();
343 371410 : sal_uInt32 nId2 = rAttr.GetSlotId().GetValue();
344 371410 : if( nId1 == nId2 && nId1 != 0 )
345 : {
346 : OSL_FAIL( "Gleiche Id in MetaClass : " );
347 : OSL_FAIL(rtl::OString::valueOf(static_cast<sal_Int32>(
348 : pS->GetSlotId().GetValue())).getStr());
349 : OSL_FAIL( pS->GetSlotId().getString().getStr() );
350 : OSL_FAIL( rAttr.GetSlotId().getString().getStr() );
351 :
352 0 : rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("Attribute "));
353 0 : aStr.append(pS->GetName().getString());
354 0 : aStr.append(RTL_CONSTASCII_STRINGPARAM(" and Attribute "));
355 0 : aStr.append(rAttr.GetName().getString());
356 0 : aStr.append(RTL_CONSTASCII_STRINGPARAM(" with equal id's"));
357 0 : rBase.SetError(aStr.makeStringAndClear(), rInStm.GetToken());
358 0 : rBase.WriteError( rInStm );
359 0 : return sal_False;
360 : }
361 : }
362 : }
363 4194 : SvMetaClass * pSC = aSuperClass;
364 4194 : if( pSC )
365 357 : return pSC->TestAttribute( rBase, rInStm, rAttr );
366 3837 : return sal_True;
367 : }
368 :
369 194 : void SvMetaClass::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
370 : sal_uInt16 nTab )
371 : {
372 194 : WriteHeaderSvIdl( rBase, rOutStm, nTab );
373 194 : if( aSuperClass.Is() )
374 59 : rOutStm << " : " << aSuperClass->GetName().getString().getStr();
375 194 : rOutStm << endl;
376 194 : SvMetaName::WriteSvIdl( rBase, rOutStm, nTab );
377 194 : rOutStm << endl;
378 194 : }
379 :
380 0 : void SvMetaClass::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
381 : sal_uInt16 nTab,
382 : WriteType nT, WriteAttribute )
383 : {
384 0 : rBase.aIFaceName = GetName().getString();
385 0 : switch( nT )
386 : {
387 : case WRITE_ODL:
388 : {
389 : OSL_FAIL( "Not supported anymore!" );
390 0 : break;
391 : }
392 : case WRITE_C_SOURCE:
393 : case WRITE_C_HEADER:
394 : {
395 : OSL_FAIL( "Not supported anymore!" );
396 0 : break;
397 : }
398 : case WRITE_DOCU:
399 : {
400 0 : rOutStm << "<INTERFACE>" << endl
401 0 : << GetName().getString().getStr();
402 0 : if ( GetAutomation() )
403 0 : rOutStm << " ( Automation ) ";
404 0 : rOutStm << endl;
405 0 : WriteDescription( rOutStm );
406 0 : rOutStm << "</INTERFACE>" << endl << endl;
407 :
408 : // write all attributes
409 : sal_uLong n;
410 0 : for( n = 0; n < aAttrList.size(); n++ )
411 : {
412 0 : SvMetaAttribute * pAttr = aAttrList[n];
413 0 : if( !pAttr->GetHidden() )
414 : {
415 0 : if( pAttr->IsMethod() )
416 0 : pAttr->Write( rBase, rOutStm, nTab, nT, WA_METHOD );
417 :
418 0 : if( pAttr->IsVariable() )
419 0 : pAttr->Write( rBase, rOutStm, nTab, nT, WA_VARIABLE );
420 : }
421 : }
422 :
423 0 : break;
424 : }
425 : default:
426 0 : break;
427 : }
428 0 : }
429 :
430 86 : sal_uInt16 SvMetaClass::WriteSlotParamArray( SvIdlDataBase & rBase,
431 : SvSlotElementList & rSlotList,
432 : SvStream & rOutStm )
433 : {
434 86 : sal_uInt16 nCount = 0;
435 5595 : for ( size_t i = 0, n = rSlotList.size(); i < n; ++i )
436 : {
437 5509 : SvSlotElement *pEle = rSlotList[ i ];
438 5509 : SvMetaSlot *pAttr = pEle->xSlot;
439 5509 : nCount = nCount + pAttr->WriteSlotParamArray( rBase, rOutStm );
440 : }
441 :
442 86 : return nCount;
443 : }
444 :
445 86 : sal_uInt16 SvMetaClass::WriteSlots( const rtl::OString& rShellName,
446 : sal_uInt16 nCount, SvSlotElementList & rSlotList,
447 : SvIdlDataBase & rBase,
448 : SvStream & rOutStm )
449 : {
450 86 : sal_uInt16 nSCount = 0;
451 5595 : for ( size_t i = 0, n = rSlotList.size(); i < n; ++i )
452 : {
453 5509 : SvSlotElement * pEle = rSlotList[ i ];
454 5509 : SvMetaSlot * pAttr = pEle->xSlot;
455 : nSCount = nSCount + pAttr->WriteSlotMap( rShellName, nCount + nSCount,
456 : rSlotList, i, pEle->aPrefix, rBase,
457 5509 : rOutStm );
458 : }
459 :
460 86 : return nSCount;
461 : }
462 :
463 214 : void SvMetaClass::InsertSlots( SvSlotElementList& rList, std::vector<sal_uLong>& rSuperList,
464 : SvMetaClassList &rClassList,
465 : const rtl::OString& rPrefix, SvIdlDataBase& rBase)
466 : {
467 : // was this class already written?
468 562 : for ( size_t i = 0, n = rClassList.size(); i < n ; ++i )
469 365 : if ( rClassList[ i ] == this )
470 231 : return;
471 :
472 197 : rClassList.push_back( this );
473 :
474 : // write all direct attributes
475 : sal_uLong n;
476 5666 : for( n = 0; n < aAttrList.size(); n++ )
477 : {
478 5469 : SvMetaAttribute * pAttr = aAttrList[n];
479 :
480 5469 : sal_uLong nId = pAttr->GetSlotId().GetValue();
481 :
482 : std::vector<sal_uLong>::iterator iter = std::find(rSuperList.begin(),
483 5469 : rSuperList.end(),nId);
484 :
485 5469 : if( iter == rSuperList.end() )
486 : {
487 : // Write only if not already written by subclass or
488 : // imported interface.
489 5450 : rSuperList.push_back(nId);
490 5450 : pAttr->Insert(rList, rPrefix, rBase);
491 : }
492 : }
493 :
494 : // All Interfaces already imported by SuperShells should not be
495 : // written any more.
496 : // It is prohibited that Shell and SuperShell directly import the same
497 : //class.
498 197 : if( IsShell() && aSuperClass.Is() )
499 27 : aSuperClass->FillClasses( rClassList );
500 :
501 : // Write all attributes of the imported classes, as long as they have
502 : // not already been imported by the superclass.
503 291 : for( n = 0; n < aClassList.size(); n++ )
504 : {
505 94 : SvClassElement * pEle = aClassList[n];
506 94 : SvMetaClass * pCl = pEle->GetClass();
507 94 : rtl::OStringBuffer rPre(rPrefix);
508 94 : if( rPre.getLength() && pEle->GetPrefix().getLength() )
509 0 : rPre.append('.');
510 94 : rPre.append(pEle->GetPrefix());
511 :
512 : // first of all write direct imported interfaces
513 : pCl->InsertSlots( rList, rSuperList, rClassList,
514 94 : rPre.makeStringAndClear(), rBase );
515 94 : }
516 :
517 : // only write superclass if no shell and not in the list
518 197 : if( !IsShell() && aSuperClass.Is() )
519 : {
520 34 : aSuperClass->InsertSlots( rList, rSuperList, rClassList, rPrefix, rBase );
521 : }
522 : }
523 :
524 96 : void SvMetaClass::FillClasses( SvMetaClassList & rList )
525 : {
526 : // Am I not yet in?
527 333 : for ( size_t i = 0, n = rList.size(); i < n; ++i )
528 242 : if ( rList[ i ] == this )
529 101 : return;
530 :
531 91 : rList.push_back( this );
532 :
533 : // my imports
534 129 : for( sal_uInt32 n = 0; n < aClassList.size(); n++ )
535 : {
536 38 : SvClassElement * pEle = aClassList[n];
537 38 : SvMetaClass * pCl = pEle->GetClass();
538 38 : pCl->FillClasses( rList );
539 : }
540 :
541 : // my superclass
542 91 : if( aSuperClass.Is() )
543 31 : aSuperClass->FillClasses( rList );
544 : }
545 :
546 :
547 86 : void SvMetaClass::WriteSlotStubs( const rtl::OString& rShellName,
548 : SvSlotElementList & rSlotList,
549 : ByteStringList & rList,
550 : SvStream & rOutStm )
551 : {
552 : // write all attributes
553 5595 : for ( size_t i = 0, n = rSlotList.size(); i < n; ++i )
554 : {
555 5509 : SvSlotElement *pEle = rSlotList[ i ];
556 5509 : SvMetaSlot *pAttr = pEle->xSlot;
557 5509 : pAttr->WriteSlotStubs( rShellName, rList, rOutStm );
558 : }
559 86 : }
560 :
561 194 : void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm )
562 : {
563 194 : WriteStars( rOutStm );
564 : // define class
565 194 : rOutStm << "#ifdef " << GetName().getString().getStr() << endl;
566 194 : rOutStm << "#undef ShellClass" << endl;
567 194 : rOutStm << "#undef " << GetName().getString().getStr() << endl;
568 194 : rOutStm << "#define ShellClass " << GetName().getString().getStr() << endl;
569 :
570 : // no slotmaps get written for interfaces
571 194 : if( !IsShell() )
572 : {
573 108 : rOutStm << "#endif" << endl << endl;
574 194 : return;
575 : }
576 : // write parameter array
577 86 : rOutStm << "SFX_ARGUMENTMAP(" << GetName().getString().getStr() << ')' << endl
578 86 : << '{' << endl;
579 :
580 86 : std::vector<sal_uLong> aSuperList;
581 86 : SvMetaClassList classList;
582 86 : SvSlotElementList aSlotList;
583 86 : InsertSlots(aSlotList, aSuperList, classList, rtl::OString(), rBase);
584 5595 : for ( size_t i = 0, n = aSlotList.size(); i < n; ++i )
585 : {
586 5509 : SvSlotElement *pEle = aSlotList[ i ];
587 5509 : SvMetaSlot *pSlot = pEle->xSlot;
588 5509 : pSlot->SetListPos( i );
589 : }
590 :
591 86 : size_t nSlotCount = aSlotList.size();
592 :
593 : // write all attributes
594 86 : sal_uInt16 nArgCount = WriteSlotParamArray( rBase, aSlotList, rOutStm );
595 86 : if( nArgCount )
596 62 : Back2Delemitter( rOutStm );
597 : else
598 : {
599 : // at leaast one dummy
600 24 : WriteTab( rOutStm, 1 );
601 24 : rOutStm << "SFX_ARGUMENT( 0, 0, SfxVoidItem )" << endl;
602 : }
603 86 : rOutStm << endl << "};" << endl << endl;
604 :
605 86 : ByteStringList aStringList;
606 86 : WriteSlotStubs( GetName().getString(), aSlotList, aStringList, rOutStm );
607 691 : for ( size_t i = 0, n = aStringList.size(); i < n; ++i )
608 605 : delete aStringList[ i ];
609 86 : aStringList.clear();
610 :
611 86 : rOutStm << endl;
612 :
613 : // write slotmap
614 86 : rOutStm << "SFX_SLOTMAP_ARG(" << GetName().getString().getStr() << ')' << endl
615 86 : << '{' << endl;
616 :
617 : // write all attributes
618 86 : WriteSlots( GetName().getString(), 0, aSlotList, rBase, rOutStm );
619 86 : if( nSlotCount )
620 78 : Back2Delemitter( rOutStm );
621 : else
622 : {
623 : // at least one dummy
624 8 : WriteTab( rOutStm, 1 );
625 8 : rOutStm << "SFX_SLOT_ARG(" << GetName().getString().getStr()
626 8 : << ", 0, 0, "
627 8 : << "SFX_STUB_PTR_EXEC_NONE,"
628 8 : << "SFX_STUB_PTR_STATE_NONE,"
629 8 : << "0, SfxVoidItem, 0, 0, \"\", 0 )" << endl;
630 : }
631 86 : rOutStm << endl << "};" << endl << "#endif" << endl << endl;
632 :
633 5595 : for( size_t i = 0, n = aSlotList.size(); i < n; ++i )
634 : {
635 5509 : SvSlotElement* pEle = aSlotList[ i ];
636 5509 : SvMetaSlot* pAttr = pEle->xSlot;
637 5509 : pAttr->ResetSlotPointer();
638 : }
639 :
640 5595 : for( size_t i = 0, n = aSlotList.size(); i < n; ++i )
641 5509 : delete aSlotList[ i ];
642 86 : aSlotList.clear();
643 : }
644 :
645 194 : void SvMetaClass::WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm,
646 : HelpIdTable& rTable )
647 : {
648 4031 : for( sal_uLong n=0; n<aAttrList.size(); n++ )
649 : {
650 3837 : SvMetaAttribute * pAttr = aAttrList[n];
651 3837 : pAttr->WriteHelpId( rBase, rOutStm, rTable );
652 : }
653 194 : }
654 :
655 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|