xref: /AOO41X/main/idl/source/objects/slot.cxx (revision 79aad27f7f29270c03e208e3d687e8e3850af11d)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_idl.hxx"
26 
27 #include <ctype.h>
28 #include <stdio.h>
29 #include <tools/debug.hxx>
30 #include <attrib.hxx>
31 #include <slot.hxx>
32 #include <globals.hxx>
33 #include <database.hxx>
34 
35 /****************** SvMetaSlot *****************************************/
36 SV_IMPL_META_FACTORY1( SvMetaSlot, SvMetaAttribute );
37 
MakeClone() const38 SvMetaObject *SvMetaSlot::MakeClone() const
39 {
40         return new SvMetaSlot( *this );
41 }
42 
43 /*************************************************************************
44 |*    SvMetaSlot::SvMetaSlot()
45 |*
46 |*    Beschreibung      Zweites sal_False bei den SvBOOL-Objekten bedeutet,
47 |*                      IsSet() liefert sal_False (Defaultinitialisierung).
48 *************************************************************************/
SvMetaSlot()49 SvMetaSlot::SvMetaSlot()
50     : aCachable( sal_True, sal_False )
51     , aSynchron( sal_True, sal_False )
52     , aRecordPerSet( sal_True, sal_False )
53     , aRecordAbsolute( sal_False, sal_False )
54     , pLinkedSlot(0)
55     , pNextSlot(0)
56     , pEnumValue(0)
57 {
58 }
59 
SvMetaSlot(SvMetaType * pType)60 SvMetaSlot::SvMetaSlot( SvMetaType * pType )
61     : SvMetaAttribute( pType )
62     , aCachable( sal_True, sal_False )
63     , aSynchron( sal_True, sal_False )
64     , aRecordPerSet( sal_True, sal_False )
65     , aRecordAbsolute( sal_False, sal_False )
66     , pLinkedSlot(0)
67     , pNextSlot(0)
68     , pEnumValue(0)
69 {
70 }
71 
72 /*
73 #define TEST_READ                                               \
74 {                                                               \
75     sal_uInt32  nPos;                                               \
76     rStm >> nPos;                                               \
77     DBG_ASSERT( nPos +4 == rStm.Tell(), "stream pos error" );   \
78 }
79 
80 #define TEST_WRITE                                              \
81     rStm << (sal_uInt32)rStm.Tell();
82 */
83 #define TEST_READ
84 #define TEST_WRITE
85 
Load(SvPersistStream & rStm)86 void SvMetaSlot::Load( SvPersistStream & rStm )
87 {
88     SvMetaAttribute::Load( rStm );
89 
90     sal_uInt16 nMask;
91     rStm >> nMask;
92 
93     TEST_READ
94     if( nMask & 0x0001 )
95     {
96         SvMetaAttribute * pMeth;
97         rStm >> pMeth;
98         aMethod = pMeth;
99     }
100 
101     TEST_READ
102     if( nMask & 0x0002 ) rStm >> aGroupId;
103     TEST_READ
104     if( nMask & 0x0004 ) rStm >> aHasCoreId;
105     TEST_READ
106     if( nMask & 0x0008 ) rStm >> aConfigId;
107     TEST_READ
108     if( nMask & 0x0010 ) rStm >> aExecMethod;
109     TEST_READ
110     if( nMask & 0x0020 ) rStm >> aStateMethod;
111     TEST_READ
112     if( nMask & 0x0040 ) rStm >> aDefault;
113     TEST_READ
114     if( nMask & 0x0080 ) rStm >> aPseudoSlots;
115     TEST_READ
116     if( nMask & 0x0100 ) rStm >> aGet;
117     TEST_READ
118     if( nMask & 0x0200 ) rStm >> aSet;
119     TEST_READ
120     if( nMask & 0x0400 ) rStm >> aCachable;
121     TEST_READ
122     if( nMask & 0x0800 ) rStm >> aVolatile;
123     TEST_READ
124     if( nMask & 0x1000 ) rStm >> aToggle;
125     TEST_READ
126     if( nMask & 0x2000 ) rStm >> aAutoUpdate;
127     TEST_READ
128     if( nMask & 0x4000 ) rStm >> aSynchron;
129     TEST_READ
130     if( nMask & 0x8000 ) rStm >> aAsynchron;
131 
132     nMask = 0;
133     rStm >> nMask;
134 
135     TEST_READ
136     if( nMask & 0x0001 ) rStm >> aRecordPerItem;
137     TEST_READ
138     if( nMask & 0x0002 ) rStm >> aRecordManual;
139     TEST_READ
140     if( nMask & 0x0004 ) rStm >> aNoRecord;
141     TEST_READ
142     if( nMask & 0x0008 ) rStm >> aHasDialog;
143     TEST_READ
144     if( nMask & 0x0010 ) rStm >> aDisableFlags;
145     TEST_READ
146     if( nMask & 0x0020 ) rStm >> aPseudoPrefix;
147     TEST_READ
148     if( nMask & 0x0040 ) rStm >> aRecordPerSet;
149     TEST_READ
150     if( nMask & 0x0080 ) rStm >> aMenuConfig;
151     TEST_READ
152     if( nMask & 0x0100 ) rStm >> aToolBoxConfig;
153     TEST_READ
154     if( nMask & 0x0200 ) rStm >> aStatusBarConfig;
155     TEST_READ
156     if( nMask & 0x0400 ) rStm >> aAccelConfig;
157     TEST_READ
158     if( nMask & 0x0800 ) rStm >> aFastCall;
159     TEST_READ
160     if( nMask & 0x1000 ) rStm >> aContainer;
161     TEST_READ
162 
163     if( nMask & 0x2000 )
164     {
165         SvMetaType * pT;
166         rStm >> pT;
167         aSlotType = pT;
168     }
169 
170     TEST_READ
171     if( nMask & 0x4000 ) rStm >> aRecordAbsolute;
172     TEST_READ
173     if( nMask & 0x8000 ) rStm >> aImageRotation;
174 
175     nMask = 0;
176     rStm >> nMask;
177 
178     TEST_READ
179     if( nMask & 0x0001 ) rStm >> aUnoName;
180     if( nMask & 0x0002 ) rStm >> aImageReflection;
181 }
182 
Save(SvPersistStream & rStm)183 void SvMetaSlot::Save( SvPersistStream & rStm )
184 {
185     SvMetaAttribute::Save( rStm );
186 
187     // Maske erstellen
188     sal_uInt16 nMask = 0;
189     if( aMethod.Is() )          nMask |= 0x0001;
190     if( aGroupId.Len() )        nMask |= 0x0002;
191     if( aHasCoreId.IsSet() )    nMask |= 0x0004;
192     if( aConfigId.Len() )       nMask |= 0x0008;
193     if( aExecMethod.Len() )     nMask |= 0x0010;
194     if( aStateMethod.Len() )    nMask |= 0x0020;
195     if( aDefault.Len() )        nMask |= 0x0040;
196     if( aPseudoSlots.IsSet() )  nMask |= 0x0080;
197     if( aGet.IsSet() )          nMask |= 0x0100;
198     if( aSet.IsSet() )          nMask |= 0x0200;
199     if( aCachable.IsSet() )     nMask |= 0x0400;
200     if( aVolatile.IsSet() )     nMask |= 0x0800;
201     if( aToggle.IsSet() )       nMask |= 0x1000;
202     if( aAutoUpdate.IsSet() )   nMask |= 0x2000;
203     if( aSynchron.IsSet() )     nMask |= 0x4000;
204     if( aAsynchron.IsSet() )    nMask |= 0x8000;
205 
206     // Daten schreiben
207     rStm << nMask;
208     TEST_WRITE
209     if( nMask & 0x0001 ) rStm << aMethod;
210     TEST_WRITE
211     if( nMask & 0x0002 ) rStm << aGroupId;
212     TEST_WRITE
213     if( nMask & 0x0004 ) rStm << aHasCoreId;
214     TEST_WRITE
215     if( nMask & 0x0008 ) rStm << aConfigId;
216     TEST_WRITE
217     if( nMask & 0x0010 ) rStm << aExecMethod;
218     TEST_WRITE
219     if( nMask & 0x0020 ) rStm << aStateMethod;
220     TEST_WRITE
221     if( nMask & 0x0040 ) rStm << aDefault;
222     TEST_WRITE
223     if( nMask & 0x0080 ) rStm << aPseudoSlots;
224     TEST_WRITE
225     if( nMask & 0x0100 ) rStm << aGet;
226     TEST_WRITE
227     if( nMask & 0x0200 ) rStm << aSet;
228     TEST_WRITE
229     if( nMask & 0x0400 ) rStm << aCachable;
230     TEST_WRITE
231     if( nMask & 0x0800 ) rStm << aVolatile;
232     TEST_WRITE
233     if( nMask & 0x1000 ) rStm << aToggle;
234     TEST_WRITE
235     if( nMask & 0x2000 ) rStm << aAutoUpdate;
236     TEST_WRITE
237     if( nMask & 0x4000 ) rStm << aSynchron;
238     TEST_WRITE
239     if( nMask & 0x8000 ) rStm << aAsynchron;
240 
241     // naechste Fuhre schreiben
242     // Maske erstellen
243     nMask = 0;
244     if( aRecordPerItem.IsSet() )  nMask |= 0x0001;
245     if( aRecordManual.IsSet() )   nMask |= 0x0002;
246     if( aNoRecord.IsSet() )       nMask |= 0x0004;
247     if( aHasDialog.IsSet() )      nMask |= 0x0008;
248     if ( aDisableFlags.IsSet() )      nMask |= 0x0010;
249     if( aPseudoPrefix.Len() )     nMask |= 0x0020;
250     if( aRecordPerSet.IsSet() )   nMask |= 0x0040;
251     if( aMenuConfig.IsSet() )     nMask |= 0x0080;
252     if( aToolBoxConfig.IsSet() )  nMask |= 0x0100;
253     if( aStatusBarConfig.IsSet() )nMask |= 0x0200;
254     if( aAccelConfig.IsSet() )    nMask |= 0x0400;
255     if( aFastCall.IsSet() )       nMask |= 0x0800;
256     if( aContainer.IsSet() )      nMask |= 0x1000;
257     if( aSlotType.Is() )          nMask |= 0x2000;
258     if( aRecordAbsolute.IsSet() ) nMask |= 0x4000;
259     if( aImageRotation.IsSet() )       nMask |= 0x8000;
260 
261     // Daten schreiben
262     rStm << nMask;
263     TEST_WRITE
264     if( nMask & 0x0001 ) rStm << aRecordPerItem;
265     TEST_WRITE
266     if( nMask & 0x0002 ) rStm << aRecordManual;
267     TEST_WRITE
268     if( nMask & 0x0004 ) rStm << aNoRecord;
269     TEST_WRITE
270     if( nMask & 0x0008 ) rStm << aHasDialog;
271     TEST_WRITE
272     if( nMask & 0x0010 ) rStm << aDisableFlags;
273     TEST_WRITE
274     if( nMask & 0x0020 ) rStm << aPseudoPrefix;
275     TEST_WRITE
276     if( nMask & 0x0040 ) rStm << aRecordPerSet;
277     TEST_WRITE
278     if( nMask & 0x0080 ) rStm << aMenuConfig;
279     TEST_WRITE
280     if( nMask & 0x0100 ) rStm << aToolBoxConfig;
281     TEST_WRITE
282     if( nMask & 0x0200 ) rStm << aStatusBarConfig;
283     TEST_WRITE
284     if( nMask & 0x0400 ) rStm << aAccelConfig;
285     TEST_WRITE
286     if( nMask & 0x0800 ) rStm << aFastCall;
287     TEST_WRITE
288     if( nMask & 0x1000 ) rStm << aContainer;
289     TEST_WRITE
290     if( nMask & 0x2000 ) rStm << aSlotType;
291     TEST_WRITE
292     if( nMask & 0x4000 ) rStm << aRecordAbsolute;
293     TEST_WRITE
294     if( nMask & 0x8000 ) rStm << aImageRotation;
295 
296     nMask = 0;
297     if( aUnoName.IsSet() )          nMask |= 0x0001;
298     if( aImageReflection.IsSet() )  nMask |= 0x0002;
299     rStm << nMask;
300     TEST_WRITE
301     if( nMask & 0x0001 ) rStm << aUnoName;
302     TEST_WRITE
303     if( nMask & 0x0002 ) rStm << aImageReflection;
304 }
305 
306 /*************************************************************************
307 |*    SvMetaSlot::IsVariable()
308 |*
309 |*    Beschreibung
310 *************************************************************************/
IsVariable() const311 sal_Bool SvMetaSlot::IsVariable() const
312 {
313     return SvMetaAttribute::IsVariable();
314 }
315 
316 /*************************************************************************
317 |*    SvMetaSlot::IsMethod()
318 |*
319 |*    Beschreibung
320 *************************************************************************/
IsMethod() const321 sal_Bool SvMetaSlot::IsMethod() const
322 {
323     sal_Bool b = SvMetaAttribute::IsMethod();
324     b |= NULL != GetMethod();
325     return b;
326 }
327 
328 /*************************************************************************
329 |*    SvMetaSlot::HasMethods()
330 |*
331 |*    Beschreibung
332 *************************************************************************/
GetMangleName(sal_Bool bVariable) const333 ByteString SvMetaSlot::GetMangleName( sal_Bool bVariable ) const
334 {
335     if( !bVariable )
336     {
337         SvMetaAttribute * pMeth = GetMethod();
338         if( pMeth )
339             return pMeth->GetName();
340     }
341     return GetName();
342 }
343 
344 /*************************************************************************
345 |*    Referenz
346 |*
347 |*    Beschreibung      Zweites sal_False bei den SvBOOL-Objekten bedeutet,
348 |*                      IsSet() liefert sal_False (Defaultinitialisierung).
349 *************************************************************************/
350 /** Referenz Aufloesung **/
GetSlotType() const351 SvMetaType * SvMetaSlot::GetSlotType() const
352 {
353     if( aSlotType.Is() || !GetRef() ) return aSlotType;
354     return ((SvMetaSlot *)GetRef())->GetSlotType();
355 }
GetMethod() const356 SvMetaAttribute * SvMetaSlot::GetMethod() const
357 {
358     if( aMethod.Is() || !GetRef() ) return aMethod;
359     return ((SvMetaSlot *)GetRef())->GetMethod();
360 }
GetHasCoreId() const361 sal_Bool SvMetaSlot::GetHasCoreId() const
362 {
363     if( aHasCoreId.IsSet() || !GetRef() ) return aHasCoreId;
364     return ((SvMetaSlot *)GetRef())->GetHasCoreId();
365 }
GetGroupId() const366 const ByteString & SvMetaSlot::GetGroupId() const
367 {
368     if( aGroupId.Len() || !GetRef() ) return aGroupId;
369     return ((SvMetaSlot *)GetRef())->GetGroupId();
370 }
GetDisableFlags() const371 const ByteString & SvMetaSlot::GetDisableFlags() const
372 {
373     if( aDisableFlags.Len() || !GetRef() ) return aDisableFlags;
374     return ((SvMetaSlot *)GetRef())->GetDisableFlags();
375 }
GetConfigId() const376 const ByteString & SvMetaSlot::GetConfigId() const
377 {
378     if( aConfigId.Len() || !GetRef() ) return aConfigId;
379     return ((SvMetaSlot *)GetRef())->GetConfigId();
380 }
GetExecMethod() const381 const ByteString & SvMetaSlot::GetExecMethod() const
382 {
383     if( aExecMethod.Len() || !GetRef() ) return aExecMethod;
384     return ((SvMetaSlot *)GetRef())->GetExecMethod();
385 }
GetStateMethod() const386 const ByteString & SvMetaSlot::GetStateMethod() const
387 {
388     if( aStateMethod.Len() || !GetRef() ) return aStateMethod;
389     return ((SvMetaSlot *)GetRef())->GetStateMethod();
390 }
GetDefault() const391 const ByteString & SvMetaSlot::GetDefault() const
392 {
393     if( aDefault.Len() || !GetRef() ) return aDefault;
394     return ((SvMetaSlot *)GetRef())->GetDefault();
395 }
GetPseudoSlots() const396 sal_Bool SvMetaSlot::GetPseudoSlots() const
397 {
398     if( aPseudoSlots.IsSet() || !GetRef() ) return aPseudoSlots;
399     return ((SvMetaSlot *)GetRef())->GetPseudoSlots();
400 }
401 /*
402 sal_Bool SvMetaSlot::GetGet() const
403 {
404     if( aGet.IsSet() || !GetRef() ) return aGet;
405     return ((SvMetaSlot *)GetRef())->GetGet();
406 }
407 sal_Bool SvMetaSlot::GetSet() const
408 {
409     if( aSet.IsSet() || !GetRef() ) return aSet;
410     return ((SvMetaSlot *)GetRef())->GetSet();
411 }
412 */
GetCachable() const413 sal_Bool SvMetaSlot::GetCachable() const
414 {
415     // Cachable und Volatile sind exclusiv
416     if( !GetRef() || aCachable.IsSet() || aVolatile.IsSet() )
417          return aCachable;
418     return ((SvMetaSlot *)GetRef())->GetCachable();
419 }
GetVolatile() const420 sal_Bool SvMetaSlot::GetVolatile() const
421 {
422     // Cachable und Volatile sind exclusiv
423     if( !GetRef() || aVolatile.IsSet() || aCachable.IsSet() )
424         return aVolatile;
425     return ((SvMetaSlot *)GetRef())->GetVolatile();
426 }
GetToggle() const427 sal_Bool SvMetaSlot::GetToggle() const
428 {
429     if( aToggle.IsSet() || !GetRef() ) return aToggle;
430     return ((SvMetaSlot *)GetRef())->GetToggle();
431 }
GetAutoUpdate() const432 sal_Bool SvMetaSlot::GetAutoUpdate() const
433 {
434     if( aAutoUpdate.IsSet() || !GetRef() ) return aAutoUpdate;
435     return ((SvMetaSlot *)GetRef())->GetAutoUpdate();
436 }
GetSynchron() const437 sal_Bool SvMetaSlot::GetSynchron() const
438 {
439     // Synchron und Asynchron sind exclusiv
440     if( !GetRef() || aSynchron.IsSet() || aAsynchron.IsSet() )
441         return aSynchron;
442     return ((SvMetaSlot *)GetRef())->GetSynchron();
443 }
GetAsynchron() const444 sal_Bool SvMetaSlot::GetAsynchron() const
445 {
446     // Synchron und Asynchron sind exclusiv
447     if( !GetRef() || aAsynchron.IsSet() || aSynchron.IsSet() )
448         return aAsynchron;
449     return ((SvMetaSlot *)GetRef())->GetAsynchron();
450 }
GetRecordPerItem() const451 sal_Bool SvMetaSlot::GetRecordPerItem() const
452 {
453     // Record- PerItem, No, PerSet und Manual sind exclusiv
454     if( !GetRef() || aRecordPerItem.IsSet() || aNoRecord.IsSet()
455       || aRecordPerSet.IsSet() || aRecordManual.IsSet() )
456         return aRecordPerItem;
457     return ((SvMetaSlot *)GetRef())->GetRecordPerItem();
458 }
GetRecordPerSet() const459 sal_Bool SvMetaSlot::GetRecordPerSet() const
460 {
461     // Record- PerItem, No, PerSet und Manual sind exclusiv
462     if( !GetRef() || aRecordPerItem.IsSet() || aNoRecord.IsSet()
463       || aRecordPerSet.IsSet() || aRecordManual.IsSet() )
464         return aRecordPerSet;
465     return ((SvMetaSlot *)GetRef())->GetRecordPerSet();
466 }
GetRecordManual() const467 sal_Bool SvMetaSlot::GetRecordManual() const
468 {
469     // Record- PerItem, No, PerSet und Manual sind exclusiv
470     if( !GetRef() || aRecordPerItem.IsSet() || aNoRecord.IsSet()
471       || aRecordPerSet.IsSet() || aRecordManual.IsSet() )
472         return aRecordManual;
473     return ((SvMetaSlot *)GetRef())->GetRecordManual();
474 }
GetNoRecord() const475 sal_Bool SvMetaSlot::GetNoRecord() const
476 {
477     // Record- PerItem, No, PerSet und Manual sind exclusiv
478     if( !GetRef() || aRecordPerItem.IsSet() || aNoRecord.IsSet()
479       || aRecordPerSet.IsSet() || aRecordManual.IsSet() )
480         return aNoRecord;
481     return ((SvMetaSlot *)GetRef())->GetNoRecord();
482 }
GetRecordAbsolute() const483 sal_Bool SvMetaSlot::GetRecordAbsolute() const
484 {
485     if( !GetRef() || aRecordAbsolute.IsSet() )
486         return aRecordAbsolute;
487     return ((SvMetaSlot *)GetRef())->GetRecordAbsolute();
488 }
GetHasDialog() const489 sal_Bool SvMetaSlot::GetHasDialog() const
490 {
491     if( aHasDialog.IsSet() || !GetRef() ) return aHasDialog;
492     return ((SvMetaSlot *)GetRef())->GetHasDialog();
493 }
GetPseudoPrefix() const494 const ByteString & SvMetaSlot::GetPseudoPrefix() const
495 {
496     if( aPseudoPrefix.Len() || !GetRef() ) return aPseudoPrefix;
497     return ((SvMetaSlot *)GetRef())->GetPseudoPrefix();
498 }
GetMenuConfig() const499 sal_Bool SvMetaSlot::GetMenuConfig() const
500 {
501     if( aMenuConfig.IsSet() || !GetRef() ) return aMenuConfig;
502     return ((SvMetaSlot *)GetRef())->GetMenuConfig();
503 }
GetToolBoxConfig() const504 sal_Bool SvMetaSlot::GetToolBoxConfig() const
505 {
506     if( aToolBoxConfig.IsSet() || !GetRef() ) return aToolBoxConfig;
507     return ((SvMetaSlot *)GetRef())->GetToolBoxConfig();
508 }
GetStatusBarConfig() const509 sal_Bool SvMetaSlot::GetStatusBarConfig() const
510 {
511     if( aStatusBarConfig.IsSet() || !GetRef() ) return aStatusBarConfig;
512     return ((SvMetaSlot *)GetRef())->GetStatusBarConfig();
513 }
GetAccelConfig() const514 sal_Bool SvMetaSlot::GetAccelConfig() const
515 {
516     if( aAccelConfig.IsSet() || !GetRef() ) return aAccelConfig;
517     return ((SvMetaSlot *)GetRef())->GetAccelConfig();
518 }
GetFastCall() const519 sal_Bool SvMetaSlot::GetFastCall() const
520 {
521     if( aFastCall.IsSet() || !GetRef() ) return aFastCall;
522     return ((SvMetaSlot *)GetRef())->GetFastCall();
523 }
GetContainer() const524 sal_Bool SvMetaSlot::GetContainer() const
525 {
526     if( aContainer.IsSet() || !GetRef() ) return aContainer;
527     return ((SvMetaSlot *)GetRef())->GetContainer();
528 }
529 
GetImageRotation() const530 sal_Bool SvMetaSlot::GetImageRotation() const
531 {
532     if( aImageRotation.IsSet() || !GetRef() ) return aImageRotation;
533     return ((SvMetaSlot *)GetRef())->GetImageRotation();
534 }
535 
GetImageReflection() const536 sal_Bool SvMetaSlot::GetImageReflection() const
537 {
538     if( aImageReflection.IsSet() || !GetRef() ) return aImageReflection;
539     return ((SvMetaSlot *)GetRef())->GetImageReflection();
540 }
541 
GetUnoName() const542 const ByteString& SvMetaSlot::GetUnoName() const
543 {
544     if( aUnoName.IsSet() || !GetRef() ) return aUnoName;
545     return ((SvMetaSlot *)GetRef())->GetUnoName();
546 }
547 
548 /*************************************************************************
549 |*    SvMetaSlot::FillSbxObject()
550 |*
551 |*    Beschreibung
552 *************************************************************************/
553 /*
554 void SvMetaSlot::FillSbxObject( SvIdlDataBase & rBase, SbxObject * pObj,
555                                 sal_Bool bVariable )
556 {
557     // keine Attribut fuer Automation
558     if( !GetAutomation() || !GetExport() )
559         return;
560 
561     if( !bVariable )
562     {
563         SvMetaAttributeRef xM = GetMethod();
564         if( xM.Is() )
565         {
566             SvMetaType *    pType = xM->GetType();
567             SvMetaType *    pRetBaseType = pType->GetReturnType()->GetBaseType();
568             ByteString          aName = xM->GetName();
569 
570             SbxMethodRef xMeth = new SbxMethod( aName,
571                                     pRetBaseType->GetSbxDataType() );
572             pType->FillSbxObject( xMeth, bVariable );
573             xMeth->SetUserData( MakeSlotValue(rBase, sal_False) );
574 
575             pObj->Insert( &xMeth );
576             return;
577         }
578     }
579 
580     SvMetaAttribute::FillSbxObject( rBase, pObj, bVariable );
581 }
582  */
583 
584 #ifdef IDL_COMPILER
585 /*************************************************************************
586 |*    SvMetaSlot::ReadAttributesSvIdl()
587 |*
588 |*    Beschreibung
589 *************************************************************************/
ReadAttributesSvIdl(SvIdlDataBase & rBase,SvTokenStream & rInStm)590 void SvMetaSlot::ReadAttributesSvIdl( SvIdlDataBase & rBase,
591                                     SvTokenStream & rInStm )
592 {
593     SvMetaAttribute::ReadAttributesSvIdl( rBase, rInStm );
594 
595     sal_Bool bOk = sal_False;
596     bOk |= aDefault.ReadSvIdl( SvHash_Default(), rInStm );
597     bOk |= aPseudoSlots.ReadSvIdl( SvHash_PseudoSlots(), rInStm );
598     bOk |= aHasCoreId.ReadSvIdl( SvHash_HasCoreId(), rInStm );
599     bOk |= aGroupId.ReadSvIdl( SvHash_GroupId(), rInStm );
600     bOk |= aExecMethod.ReadSvIdl( SvHash_ExecMethod(), rInStm );
601     bOk |= aStateMethod.ReadSvIdl( SvHash_StateMethod(), rInStm );
602     bOk |= aDisableFlags.ReadSvIdl( SvHash_DisableFlags(), rInStm );
603     if( aGet.ReadSvIdl( SvHash_Get(), rInStm ) )
604     {
605         rBase.WriteError( "warning", ByteString( rInStm.GetFileName(), RTL_TEXTENCODING_UTF8 ),
606                     "<Get> old style, use Readonly",
607                     rInStm.GetToken()->GetLine(),
608                     rInStm.GetToken()->GetColumn() );
609     }
610     if( aSet.ReadSvIdl( SvHash_Set(), rInStm ) )
611     {
612         rBase.WriteError( "warning", ByteString( rInStm.GetFileName(), RTL_TEXTENCODING_UTF8 ),
613                     "<Set> old style, use method declaration",
614                     rInStm.GetToken()->GetLine(),
615                     rInStm.GetToken()->GetColumn() );
616     }
617 
618     if( aCachable.ReadSvIdl( SvHash_Cachable(), rInStm ) )
619         SetCachable( aCachable ), bOk = sal_True;
620     if( aVolatile.ReadSvIdl( SvHash_Volatile(), rInStm ) )
621         SetVolatile( aVolatile ), bOk = sal_True;
622     if( aToggle.ReadSvIdl( SvHash_Toggle(), rInStm ) )
623         SetToggle( aToggle ), bOk = sal_True;
624     if( aAutoUpdate.ReadSvIdl( SvHash_AutoUpdate(), rInStm ) )
625         SetAutoUpdate( aAutoUpdate ), bOk = sal_True;
626 
627     if( aSynchron.ReadSvIdl( SvHash_Synchron(), rInStm ) )
628         SetSynchron( aSynchron ), bOk = sal_True;
629     if( aAsynchron.ReadSvIdl( SvHash_Asynchron(), rInStm ) )
630         SetAsynchron( aAsynchron ), bOk = sal_True;
631 
632     if( aRecordAbsolute.ReadSvIdl( SvHash_RecordAbsolute(), rInStm ) )
633         SetRecordAbsolute( aRecordAbsolute), bOk = sal_True;
634     if( aRecordPerItem.ReadSvIdl( SvHash_RecordPerItem(), rInStm ) )
635         SetRecordPerItem( aRecordPerItem ), bOk = sal_True;
636     if( aRecordPerSet.ReadSvIdl( SvHash_RecordPerSet(), rInStm ) )
637         SetRecordPerSet( aRecordPerSet ), bOk = sal_True;
638     if( aRecordManual.ReadSvIdl( SvHash_RecordManual(), rInStm ) )
639         SetRecordManual( aRecordManual ), bOk = sal_True;
640     if( aNoRecord.ReadSvIdl( SvHash_NoRecord(), rInStm ) )
641         SetNoRecord( aNoRecord ), bOk = sal_True;
642 
643     bOk |= aHasDialog.ReadSvIdl( SvHash_HasDialog(), rInStm );
644     bOk |= aPseudoPrefix.ReadSvIdl( SvHash_PseudoPrefix(), rInStm );
645     bOk |= aMenuConfig.ReadSvIdl( SvHash_MenuConfig(), rInStm );
646     bOk |= aToolBoxConfig.ReadSvIdl( SvHash_ToolBoxConfig(), rInStm );
647     bOk |= aStatusBarConfig.ReadSvIdl( SvHash_StatusBarConfig(), rInStm );
648     bOk |= aAccelConfig.ReadSvIdl( SvHash_AccelConfig(), rInStm );
649 
650     SvBOOL aAllConfig;
651     if( aAllConfig.ReadSvIdl( SvHash_AllConfig(), rInStm ) )
652         SetAllConfig( aAllConfig ), bOk = sal_True;
653     bOk |= aFastCall.ReadSvIdl( SvHash_FastCall(), rInStm );
654     bOk |= aContainer.ReadSvIdl( SvHash_Container(), rInStm );
655     bOk |= aImageRotation.ReadSvIdl( SvHash_ImageRotation(), rInStm );
656     bOk |= aImageReflection.ReadSvIdl( SvHash_ImageReflection(), rInStm );
657     bOk |= aUnoName.ReadSvIdl( SvHash_UnoName(), rInStm );
658 
659     if( !bOk )
660     {
661         if( !aSlotType.Is() )
662         {
663             sal_uInt32 nTokPos = rInStm.Tell();
664             SvToken * pTok = rInStm.GetToken_Next();
665             if( pTok->Is( SvHash_SlotType() ) )
666             {
667                 sal_Bool bBraket = rInStm.Read( '(' );
668                 if( bBraket || rInStm.Read( '=' ) )
669                 {
670                     aSlotType = rBase.ReadKnownType( rInStm );
671                     if( aSlotType.Is() )
672                     {
673                         if( aSlotType->IsItem() )
674                         {
675                             if( bBraket )
676                             {
677                                 if( rInStm.Read( ')' ) )
678                                     return;
679                             }
680                             else
681                                 return;
682                         }
683                         rBase.SetError( "the SlotType is not a item", rInStm.GetToken() );
684                         rBase.WriteError( rInStm );
685                     }
686                     rBase.SetError( "SlotType with unknown item type", rInStm.GetToken() );
687                     rBase.WriteError( rInStm );
688                 }
689             }
690             rInStm.Seek( nTokPos );
691 
692         }
693         if( !aMethod.Is() )
694         {
695             SvToken * pTok = rInStm.GetToken();
696             if( pTok->IsIdentifier() )
697             {
698                 aMethod = new SvMetaSlot();
699                 sal_uInt32 nTokPos = rInStm.Tell();
700                 if( aMethod->ReadSvIdl( rBase, rInStm ) )
701                 {
702                     if( aMethod->IsMethod() )
703                     {
704                         aMethod->SetSlotId( GetSlotId() );
705                         if( aMethod->Test( rBase, rInStm ) )
706                             return;
707                     }
708                     rInStm.Seek( nTokPos );
709                 }
710                 aMethod.Clear();
711             }
712         }
713     }
714 }
715 
716 /*************************************************************************
717 |*    SvMetaSlot::WriteAttributesSvIdl()
718 |*
719 |*    Beschreibung
720 *************************************************************************/
WriteAttributesSvIdl(SvIdlDataBase & rBase,SvStream & rOutStm,sal_uInt16 nTab)721 void SvMetaSlot::WriteAttributesSvIdl( SvIdlDataBase & rBase,
722                        SvStream & rOutStm,
723                        sal_uInt16 nTab )
724 {
725     SvMetaAttribute::WriteAttributesSvIdl( rBase, rOutStm, nTab );
726 
727     if( aSlotType.Is() )
728     {
729         WriteTab( rOutStm, nTab );
730         rOutStm << SvHash_SlotType()->GetName().GetBuffer() << '(';
731         aSlotType->WriteTheType( rBase, rOutStm, nTab, WRITE_IDL );
732         rOutStm << ");" << endl;
733     }
734     if( aMethod.Is() )
735     {
736         WriteTab( rOutStm, nTab );
737         aMethod->WriteSvIdl( rBase, rOutStm, nTab );
738         rOutStm << ';' << endl;
739     }
740     if( aHasCoreId )
741     {
742         aHasCoreId.WriteSvIdl( SvHash_HasCoreId(), rOutStm );
743         rOutStm << ';' << endl;
744     }
745     if( aGroupId.Len() )
746     {
747         WriteTab( rOutStm, nTab );
748         aGroupId.WriteSvIdl( SvHash_GroupId(), rOutStm, nTab +1);
749         rOutStm << ';' << endl;
750     }
751     if( aExecMethod.Len() )
752     {
753         WriteTab( rOutStm, nTab );
754         aExecMethod.WriteSvIdl( SvHash_ExecMethod(), rOutStm, nTab +1);
755         rOutStm << ';' << endl;
756     }
757     if( aStateMethod.Len() )
758     {
759         WriteTab( rOutStm, nTab );
760         aStateMethod.WriteSvIdl( SvHash_StateMethod(), rOutStm, nTab +1);
761         rOutStm << ';' << endl;
762     }
763 
764     if( aDisableFlags.Len() )
765     {
766         WriteTab( rOutStm, nTab );
767         aDisableFlags.WriteSvIdl( SvHash_DisableFlags(), rOutStm, nTab +1);
768         rOutStm << ';' << endl;
769     }
770 
771     if( aSet || aGet || aPseudoSlots )
772     {
773         WriteTab( rOutStm, nTab );
774         char const * p = "";
775         if( aPseudoSlots )
776         {
777             aPseudoSlots.WriteSvIdl( SvHash_PseudoSlots(), rOutStm );
778             p = ", ";
779         }
780         if( aGet )
781         {
782             rOutStm << p;
783             aGet.WriteSvIdl( SvHash_Get(), rOutStm );
784             p = ", ";
785         }
786         if( aSet )
787         {
788             rOutStm << p;
789             aSet.WriteSvIdl( SvHash_Set(), rOutStm );
790         }
791         rOutStm << ';' << endl;
792     }
793 
794     ByteString aDel( ", " );
795     ByteString aOut;
796     if( aVolatile )
797         aOut += aVolatile.GetSvIdlString( SvHash_Volatile() );
798     else if( !aCachable )
799         // wegen Default == sal_True, nur wenn kein anderer gesetzt
800         aOut += aCachable.GetSvIdlString( SvHash_Cachable() );
801     else
802         aDel.Erase();
803 
804     if( aToggle )
805     {
806         ( aOut += aDel ) += aToggle.GetSvIdlString( SvHash_Toggle() );
807         aDel = ", ";
808     }
809     if( aAutoUpdate )
810     {
811         (aOut += aDel ) += aAutoUpdate.GetSvIdlString( SvHash_AutoUpdate() );
812         aDel = ", ";
813     }
814 
815     ByteString aDel1( ", " );
816     if( aAsynchron )
817         ( aOut += aDel ) += aAsynchron.GetSvIdlString( SvHash_Asynchron() );
818     else if( !aSynchron )
819         // wegen Default == sal_True, nur wenn kein anderer gesetzt
820         ( aOut += aDel ) += aSynchron.GetSvIdlString( SvHash_Synchron() );
821     else
822         aDel1 = aDel;
823 
824     aDel = ", ";
825     if( aRecordManual )
826         ( aOut += aDel1 ) += aRecordManual.GetSvIdlString( SvHash_RecordManual() );
827     else if( aNoRecord )
828         ( aOut += aDel1 ) += aNoRecord.GetSvIdlString( SvHash_NoRecord() );
829     else if( !aRecordPerSet )
830         // wegen Default == sal_True, nur wenn kein anderer gesetzt
831         ( aOut += aDel1 ) += aRecordPerSet.GetSvIdlString( SvHash_RecordPerSet() );
832     else if( aRecordPerItem )
833         ( aOut += aDel1 ) += aRecordPerItem.GetSvIdlString( SvHash_RecordPerItem() );
834     else
835         aDel = aDel1;
836 
837     if( aRecordAbsolute )
838     {
839         ( aOut += aDel ) += aRecordAbsolute.GetSvIdlString( SvHash_RecordAbsolute() );
840         aDel = ", ";
841     }
842     if( aHasDialog )
843     {
844         ( aOut += aDel ) += aHasDialog.GetSvIdlString( SvHash_HasDialog() );
845         aDel = ", ";
846     }
847     if( aMenuConfig )
848     {
849         ( aOut += aDel ) += aMenuConfig.GetSvIdlString( SvHash_MenuConfig() );
850         aDel = ", ";
851     }
852     if( aToolBoxConfig )
853     {
854         ( aOut += aDel ) += aToolBoxConfig.GetSvIdlString( SvHash_ToolBoxConfig() );
855         aDel = ", ";
856     }
857     if( aStatusBarConfig )
858     {
859         ( aOut += aDel ) += aStatusBarConfig.GetSvIdlString( SvHash_StatusBarConfig() );
860         aDel = ", ";
861     }
862     if( aAccelConfig )
863     {
864         ( aOut += aDel ) += aAccelConfig.GetSvIdlString( SvHash_AccelConfig() );
865         aDel = ", ";
866     }
867     if( aFastCall )
868     {
869         ( aOut += aDel ) += aFastCall.GetSvIdlString( SvHash_FastCall() );
870         aDel = ", ";
871     }
872     if( aContainer )
873     {
874         ( aOut += aDel ) += aContainer.GetSvIdlString( SvHash_Container() );
875         aDel = ", ";
876     }
877     if( aImageRotation )
878     {
879         ( aOut += aDel ) += aImageRotation.GetSvIdlString( SvHash_ImageRotation() );
880         aDel = ", ";
881     }
882 
883     if( aImageReflection )
884     {
885         ( aOut += aDel ) += aImageReflection.GetSvIdlString( SvHash_ImageReflection() );
886         aDel = ", ";
887     }
888 
889     if( aOut.Len() )
890     {
891         WriteTab( rOutStm, nTab );
892         rOutStm << aOut.GetBuffer() << endl;
893     }
894 }
895 
896 
897 /*************************************************************************
898 |*    SvMetaSlot::Test()
899 |*
900 |*    Beschreibung
901 *************************************************************************/
Test(SvIdlDataBase & rBase,SvTokenStream & rInStm)902 sal_Bool SvMetaSlot::Test( SvIdlDataBase & rBase, SvTokenStream & rInStm )
903 {
904     sal_Bool bOk = SvMetaAttribute::Test( rBase, rInStm );
905     if( bOk )
906     {
907         SvMetaType * pType = GetType();
908         if( pType->GetType() == TYPE_METHOD )
909             pType = pType->GetReturnType();
910         if( !pType->IsItem() )
911         {
912             rBase.SetError( "this attribute is not a slot", rInStm.GetToken() );
913             rBase.WriteError( rInStm );
914             bOk = sal_False;
915         }
916     }
917 
918     return bOk;
919 }
920 
921 /*************************************************************************
922 |*    SvMetaSlot::ReadSvIdl()
923 |*
924 |*    Beschreibung
925 *************************************************************************/
ReadSvIdl(SvIdlDataBase & rBase,SvTokenStream & rInStm)926 sal_Bool SvMetaSlot::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
927 {
928     sal_uInt32  nTokPos     = rInStm.Tell();
929     sal_Bool bOk = sal_True;
930 
931     SvMetaAttribute * pAttr = rBase.ReadKnownAttr( rInStm, GetType() );
932     if( pAttr )
933     {
934         // F"ur Testzwecke: Referenz bei Kurz-Syntax
935         SvMetaSlot * pKnownSlot = PTR_CAST( SvMetaSlot, pAttr );
936         if( pKnownSlot )
937         {
938             SetRef( pKnownSlot );
939             SetName( pKnownSlot->GetName(), &rBase );
940             bOk = SvMetaName::ReadSvIdl( rBase, rInStm );
941         }
942         else
943         {
944             ByteString aStr( "attribute " );
945             aStr += pAttr->GetName();
946             aStr += " is method or variable but not a slot";
947             rBase.SetError( aStr, rInStm.GetToken() );
948             rBase.WriteError( rInStm );
949             bOk = sal_False;
950         }
951     }
952     else
953     {
954         bOk = SvMetaAttribute::ReadSvIdl( rBase, rInStm );
955 
956         SvMetaAttribute *pAttr2 = rBase.SearchKnownAttr( GetSlotId() );
957         if( pAttr2 )
958         {
959             // F"ur Testzwecke: Referenz bei kompletter Definition
960             SvMetaSlot * pKnownSlot = PTR_CAST( SvMetaSlot, pAttr2 );
961             if( pKnownSlot )
962             {
963                 SetRef( pKnownSlot );
964 
965                 // Namen d"urfen abweichen, da mit angegeben
966                 if ( pKnownSlot->GetName() != GetName() )
967                 {
968                     DBG_ERROR("Illegal definition!");
969                     rInStm.Seek( nTokPos );
970                     return sal_False;
971                 }
972 
973                 SetName( pKnownSlot->GetName(), &rBase );
974             }
975             else
976             {
977                 ByteString aStr( "attribute " );
978                 aStr += pAttr2->GetName();
979                 aStr += " is method or variable but not a slot";
980                 rBase.SetError( aStr, rInStm.GetToken() );
981                 rBase.WriteError( rInStm );
982                 bOk = sal_False;
983             }
984         }
985     }
986 
987     if( !bOk )
988         rInStm.Seek( nTokPos );
989 
990     return bOk;
991 }
992 
993 /*************************************************************************
994 |*    SvMetaSlot::WriteSvIdl()
995 |*
996 |*    Beschreibung
997 *************************************************************************/
WriteSvIdl(SvIdlDataBase & rBase,SvStream & rOutStm,sal_uInt16 nTab)998 void SvMetaSlot::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
999                             sal_uInt16 nTab )
1000 {
1001     SvMetaAttribute::WriteSvIdl( rBase, rOutStm, nTab );
1002 }
1003 
1004 /*************************************************************************
1005 |*    SvMetaSlot::Write()
1006 |*
1007 |*    Beschreibung
1008 *************************************************************************/
Write(SvIdlDataBase & rBase,SvStream & rOutStm,sal_uInt16 nTab,WriteType nT,WriteAttribute nA)1009 void SvMetaSlot::Write( SvIdlDataBase & rBase,
1010                         SvStream & rOutStm, sal_uInt16 nTab,
1011                         WriteType nT, WriteAttribute nA )
1012 {
1013     if ( nT == WRITE_DOCU )
1014     {
1015         if ( GetHidden() )
1016             return;
1017     }
1018     else
1019     {
1020         // keine Attribut fuer Automation
1021         if( !GetAutomation() || !GetExport() )
1022             return;
1023     }
1024 
1025     if( !(nA & WA_VARIABLE) )
1026     {
1027         SvMetaAttributeRef xM = GetMethod();
1028         if( xM.Is() )
1029         {
1030             xM->SetSlotId( GetSlotId() );
1031             xM->SetDescription( GetDescription() );
1032             xM->Write( rBase, rOutStm, nTab, nT, nA );
1033             return;
1034         }
1035     }
1036 
1037     SvMetaAttribute::Write( rBase, rOutStm, nTab, nT, nA );
1038 }
1039 
1040 
Insert(SvSlotElementList & rList,const ByteString & rPrefix,SvIdlDataBase & rBase)1041 void SvMetaSlot::Insert( SvSlotElementList& rList, const ByteString & rPrefix,
1042                         SvIdlDataBase& rBase)
1043 {
1044     // Einf"ugeposition durch bin"are Suche in der SlotListe ermitteln
1045     sal_uInt16 nId = (sal_uInt16) GetSlotId().GetValue();
1046     sal_uInt16 nListCount = (sal_uInt16) rList.Count();
1047     sal_uInt16 nPos;
1048     sal_uLong m;  // for inner "for" loop
1049 
1050     if ( !nListCount )
1051         nPos = 0;
1052     else if ( nListCount == 1 )
1053         nPos = rList.GetObject(0)->xSlot->GetSlotId().GetValue() >= nId ? 0 : 1;
1054     else
1055     {
1056         sal_uInt16 nMid = 0, nLow = 0;
1057         sal_uInt16 nHigh = nListCount - 1;
1058         sal_Bool bFound = sal_False;
1059         while ( !bFound && nLow <= nHigh )
1060         {
1061             nMid = (nLow + nHigh) >> 1;
1062             DBG_ASSERT( nMid < nListCount, "bsearch ist buggy" );
1063             int nDiff = (int) nId - (int) rList.GetObject(nMid)->xSlot->GetSlotId().GetValue();
1064             if ( nDiff < 0)
1065             {
1066                 if ( nMid == 0 )
1067                     break;
1068                 nHigh = nMid - 1;
1069             }
1070             else if ( nDiff > 0 )
1071             {
1072                 nLow = nMid + 1;
1073                 if ( nLow == 0 )
1074                 break;
1075             }
1076             else
1077                 bFound = sal_True;
1078         }
1079 
1080         DBG_ASSERT(!bFound, "Duplicate SlotId!");
1081         nPos = bFound ? nMid : nLow;
1082     }
1083 
1084     DBG_ASSERT( nPos <= nListCount,
1085         "nPos too large" );
1086     DBG_ASSERT( nPos == nListCount || nId <=
1087         (sal_uInt16) rList.GetObject(nPos)->xSlot->GetSlotId().GetValue(),
1088         "Successor has lower SlotId" );
1089     DBG_ASSERT( nPos == 0 || nId >
1090         (sal_uInt16) rList.GetObject(nPos-1)->xSlot->GetSlotId().GetValue(),
1091         "Predecessor has higher SlotId" );
1092     DBG_ASSERT( nPos+1 >= nListCount || nId <
1093         (sal_uInt16) rList.GetObject(nPos+1)->xSlot->GetSlotId().GetValue(),
1094         "Successor has lower SlotId" );
1095 
1096     rList.Insert( new SvSlotElement( this, rPrefix ), nPos );
1097 
1098     // EnumSlots plattklopfen
1099     SvMetaTypeEnum * pEnum = NULL;
1100     SvMetaType * pBType = GetType()->GetBaseType();
1101     pEnum = PTR_CAST( SvMetaTypeEnum, pBType );
1102     if( GetPseudoSlots() && pEnum && pEnum->Count() )
1103     {
1104         // Den MasterSlot clonen
1105         SvMetaSlotRef xEnumSlot;
1106         SvMetaSlot *pFirstEnumSlot = NULL;
1107         for( sal_uLong n = 0; n < pEnum->Count(); n++ )
1108         {
1109             // Die SlotId erzeugen
1110             SvMetaEnumValue *enumValue = pEnum->GetObject(n);
1111             ByteString aValName = enumValue->GetName();
1112             ByteString aSId( GetSlotId() );
1113             if( GetPseudoPrefix().Len() )
1114                 aSId = GetPseudoPrefix();
1115             aSId += '_';
1116             aSId += aValName.Copy( pEnum->GetPrefix().Len() );
1117 
1118             xEnumSlot = NULL;
1119             for( m=0; m<rBase.GetAttrList().Count(); m++ )
1120             {
1121                 SvMetaAttribute * pAttr = rBase.GetAttrList().GetObject( m );
1122                 if( pAttr->GetSlotId() == aSId )
1123                 {
1124                     SvMetaSlot* pSlot = PTR_CAST( SvMetaSlot, pAttr );
1125                     xEnumSlot = pSlot->Clone();
1126                     break;
1127                 }
1128             }
1129 
1130             if ( m == rBase.GetAttrList().Count() )
1131             {
1132                 DBG_ERROR("Invalid EnumSlot!");
1133                 xEnumSlot = Clone();
1134                 sal_uLong nValue;
1135                 if ( rBase.FindId(aSId , &nValue) )
1136                 {
1137                     SvNumberIdentifier aId;
1138                     *((SvIdentifier*)&aId) = aSId;
1139                     aId.SetValue(nValue);
1140                     xEnumSlot->SetSlotId(aId);
1141                 }
1142             }
1143 
1144             // Die Slaves sind kein Master !
1145             xEnumSlot->aPseudoSlots = sal_False;
1146             xEnumSlot->SetEnumValue(enumValue);
1147 
1148             if ( !pFirstEnumSlot || xEnumSlot->GetSlotId().GetValue() < pFirstEnumSlot->GetSlotId().GetValue() )
1149                 pFirstEnumSlot = xEnumSlot;
1150 
1151             // Den erzeugten Slave ebenfalls einf"ugen
1152             xEnumSlot->Insert( rList, rPrefix, rBase);
1153 
1154             // Die EnumSlots mit dem Master verketten
1155             xEnumSlot->pLinkedSlot = this;
1156         }
1157 
1158         // Master zeigt auf den ersten Slave
1159         pLinkedSlot = pFirstEnumSlot;
1160 
1161         // Slaves untereinander verketten
1162         rList.Seek((sal_uLong)0);
1163         xEnumSlot = pFirstEnumSlot;
1164         SvSlotElement *pEle;
1165         do
1166         {
1167             pEle = rList.Next();
1168             if ( pEle && pEle->xSlot->pLinkedSlot == this )
1169             {
1170                 xEnumSlot->pNextSlot = pEle->xSlot;
1171                 xEnumSlot = pEle->xSlot;
1172             }
1173         }
1174         while ( pEle );
1175         xEnumSlot->pNextSlot = pFirstEnumSlot;
1176     }
1177 }
1178 
1179 
1180 /*************************************************************************
1181 |*    SvMetaSlot::WriteSlotMap()
1182 |*
1183 |*    Beschreibung
1184 *************************************************************************/
MakeSlotName(SvStringHashEntry * pEntry)1185 static ByteString MakeSlotName( SvStringHashEntry * pEntry )
1186 {
1187     ByteString aName( "SFX_SLOT_" );
1188     aName += pEntry->GetName();
1189     return aName.ToUpperAscii();
1190 };
1191 
WriteSlotStubs(const ByteString & rShellName,ByteStringList & rList,SvStream & rOutStm)1192 void SvMetaSlot::WriteSlotStubs( const ByteString & rShellName,
1193                                 ByteStringList & rList,
1194                                 SvStream & rOutStm )
1195 {
1196 /*
1197     ByteString aName = GetName();
1198     SvMetaAttribute * pAttr = rAttrList.First();
1199     while( pAttr )
1200     {
1201         if( pAttr->GetName() == aName )
1202             break;
1203         pAttr = rAttrList.Next();
1204     }
1205     if( pAttr )
1206         return;
1207 */
1208     if ( !GetExport() && !GetHidden() )
1209         return;
1210 
1211     ByteString aMethodName( GetExecMethod() );
1212     if ( aMethodName.Len() && aMethodName != "NoExec" )
1213     {
1214         sal_Bool bIn = sal_False;
1215         for( sal_uInt16 n = 0; n < rList.Count(); n++ )
1216         {
1217             if( *(rList.GetObject(n)) == aMethodName )
1218             {
1219                 bIn=sal_True;
1220                 break;
1221             }
1222         }
1223 
1224         if ( !bIn )
1225         {
1226             rList.Insert( new ByteString(aMethodName), LIST_APPEND );
1227             rOutStm << "SFX_EXEC_STUB("
1228                     << rShellName.GetBuffer()
1229                     << ','
1230                     << aMethodName.GetBuffer()
1231                     << ')' << endl;
1232         }
1233     }
1234 
1235     aMethodName = GetStateMethod();
1236     if ( aMethodName.Len() && aMethodName != "NoState" )
1237     {
1238         sal_Bool bIn = sal_False;
1239         for ( sal_uInt16 n=0; n < rList.Count(); n++ )
1240         {
1241             if ( *(rList.GetObject(n)) == aMethodName )
1242             {
1243                 bIn=sal_True;
1244                 break;
1245             }
1246         }
1247 
1248         if ( !bIn )
1249         {
1250             rList.Insert( new ByteString(aMethodName), LIST_APPEND );
1251             rOutStm << "SFX_STATE_STUB("
1252                     << rShellName.GetBuffer()
1253                     << ','
1254                     << aMethodName.GetBuffer()
1255                     << ')' << endl;
1256         }
1257     }
1258 }
1259 
WriteSlot(const ByteString & rShellName,sal_uInt16 nCount,const ByteString & rSlotId,SvSlotElementList & rSlotList,const ByteString & rPrefix,SvIdlDataBase & rBase,SvStream & rOutStm)1260 void SvMetaSlot::WriteSlot( const ByteString & rShellName, sal_uInt16 nCount,
1261                             const ByteString & rSlotId,
1262                             SvSlotElementList& rSlotList,
1263                             const ByteString & rPrefix,
1264                             SvIdlDataBase & rBase, SvStream & rOutStm )
1265 {
1266     if ( !GetExport() && !GetHidden() )
1267         return;
1268 
1269 //  sal_Bool bIsEnumSlot = 0 != rValueName.Len();
1270     sal_Bool bIsEnumSlot = 0 != pEnumValue;
1271 
1272     rOutStm << "// Slot Nr. " << ByteString::CreateFromInt32(nListPos).GetBuffer() << " : ";
1273     ByteString aSlotIdValue( ByteString::CreateFromInt32( GetSlotId().GetValue() ) );
1274     rOutStm << aSlotIdValue.GetBuffer() << endl;
1275     WriteTab( rOutStm, 1 );
1276     if( bIsEnumSlot )
1277         rOutStm << "SFX_NEW_SLOT_ENUM( ";
1278     else
1279         rOutStm << "SFX_NEW_SLOT_ARG( " << rShellName.GetBuffer() << ',' ;
1280 
1281     rOutStm << rSlotId.GetBuffer() << ',';
1282     const SvHelpContext& rHlpCtx = GetHelpContext();
1283     if( rHlpCtx.IsSet() )
1284         rOutStm << rHlpCtx.GetBuffer() << ',';
1285     else
1286         rOutStm << rSlotId.GetBuffer() << ',';
1287 
1288     // GroupId
1289     if( GetGroupId().Len() )
1290         rOutStm << GetGroupId().GetBuffer();
1291     else
1292         rOutStm << '0';
1293     rOutStm << ',' << endl;
1294     WriteTab( rOutStm, 4 );
1295 
1296     if( bIsEnumSlot )
1297     {
1298         rOutStm << "&a" << rShellName.GetBuffer() << "Slots_Impl["
1299                 << ByteString::CreateFromInt32(pLinkedSlot->GetListPos()).GetBuffer()
1300                 << "] /*Offset Master*/, " << endl;
1301         WriteTab( rOutStm, 4 );
1302         rOutStm << "&a" << rShellName.GetBuffer() << "Slots_Impl["
1303                 << ByteString::CreateFromInt32(pNextSlot->GetListPos()).GetBuffer()
1304                 << "] /*Offset Next*/, " << endl;
1305 
1306         WriteTab( rOutStm, 4 );
1307 
1308         // SlotId
1309         if( GetSlotId().Len() )
1310             rOutStm << pLinkedSlot->GetSlotId().GetBuffer();
1311         else
1312             rOutStm << '0';
1313         rOutStm << ',';
1314         rOutStm << pEnumValue->GetName().GetBuffer();
1315     }
1316     else
1317     {
1318         // Den n"achsten Slot suchen, der die gleiche StateMethod hat wie ich
1319         // Die SlotList ist auf den aktuellen Slot geseekt
1320         SvSlotElement * pEle = rSlotList.Next();
1321         pNextSlot = pEle ? &pEle->xSlot : NULL;
1322         while ( pNextSlot )
1323         {
1324             if ( !pNextSlot->pNextSlot &&
1325                 pNextSlot->GetStateMethod() == GetStateMethod() )
1326                 break;
1327             pEle = rSlotList.Next();
1328             pNextSlot = pEle ? &pEle->xSlot : NULL;
1329         }
1330 
1331         if ( !pNextSlot )
1332         {
1333             // Es gibt nach mir keinen Slot mehr, der die gleiche ExecMethode
1334             // hat. Also suche ich den ersten Slot, der diese hatte (das
1335             // k"onnte auch ich selbst sein)
1336             pEle = rSlotList.First();
1337             pNextSlot = pEle ? &pEle->xSlot : NULL;
1338             while ( pNextSlot != this )
1339             {
1340                 if ( !pNextSlot->pEnumValue &&
1341                     pNextSlot->GetStateMethod() == GetStateMethod() )
1342                     break;
1343                 pEle = rSlotList.Next();
1344                 pNextSlot = pEle ? &pEle->xSlot : NULL;
1345             }
1346         }
1347 
1348         if ( !pLinkedSlot )
1349         {
1350             rOutStm << "0 ,";
1351         }
1352         else
1353         {
1354             rOutStm << "&a" << rShellName.GetBuffer() << "Slots_Impl["
1355                 << ByteString::CreateFromInt32(pLinkedSlot->GetListPos()).GetBuffer()
1356                 << "] /*Offset Linked*/, " << endl;
1357             WriteTab( rOutStm, 4 );
1358         }
1359 
1360         rOutStm << "&a" << rShellName.GetBuffer() << "Slots_Impl["
1361                 << ByteString::CreateFromInt32(pNextSlot->GetListPos()).GetBuffer()
1362                 << "] /*Offset Next*/, " << endl;
1363 
1364         WriteTab( rOutStm, 4 );
1365 
1366         // ExecMethod schreiben, wenn nicht angegeben, standard Namen
1367         if( GetExecMethod().Len() && GetExecMethod() != "NoExec")
1368             rOutStm << "SFX_STUB_PTR(" << rShellName.GetBuffer() << ','
1369                     << GetExecMethod().GetBuffer() << ')';
1370         else
1371             rOutStm << "SFX_STUB_PTR_EXEC_NONE";
1372         rOutStm << ',';
1373 
1374         // StateMethod schreiben, wenn nicht angegeben, standard Namen
1375         if( GetStateMethod().Len() && GetStateMethod() != "NoState")
1376             rOutStm << "SFX_STUB_PTR(" << rShellName.GetBuffer() << ','
1377                     << GetStateMethod().GetBuffer() << ')';
1378         else
1379             rOutStm << "SFX_STUB_PTR_STATE_NONE";
1380     }
1381     rOutStm << ',' << endl;
1382     WriteTab( rOutStm, 4 );
1383 
1384     // Flags schreiben
1385     if( GetHasCoreId() )
1386         rOutStm << MakeSlotName( SvHash_HasCoreId() ).GetBuffer() << '|';
1387     if( GetCachable() )
1388         rOutStm << MakeSlotName( SvHash_Cachable() ).GetBuffer() << '|';
1389     if( GetVolatile() )
1390         rOutStm << MakeSlotName( SvHash_Volatile() ).GetBuffer() << '|';
1391     if( GetToggle() )
1392         rOutStm << MakeSlotName( SvHash_Toggle() ).GetBuffer() << '|';
1393     if( GetAutoUpdate() )
1394         rOutStm << MakeSlotName( SvHash_AutoUpdate() ).GetBuffer() << '|';
1395     if( GetSynchron() )
1396         rOutStm << MakeSlotName( SvHash_Synchron() ).GetBuffer() << '|';
1397     if( GetAsynchron() )
1398         rOutStm << MakeSlotName( SvHash_Asynchron() ).GetBuffer() << '|';
1399     if( GetRecordPerItem() )
1400         rOutStm << MakeSlotName( SvHash_RecordPerItem() ).GetBuffer() << '|';
1401     if( GetRecordPerSet() )
1402         rOutStm << MakeSlotName( SvHash_RecordPerSet() ).GetBuffer() << '|';
1403     if( GetRecordManual() )
1404         rOutStm << MakeSlotName( SvHash_RecordManual() ).GetBuffer() << '|';
1405     if( GetNoRecord() )
1406         rOutStm << MakeSlotName( SvHash_NoRecord() ).GetBuffer() << '|';
1407     if( GetRecordAbsolute() )
1408         rOutStm << MakeSlotName( SvHash_RecordAbsolute() ).GetBuffer() << '|';
1409     if( GetHasDialog() )
1410         rOutStm << MakeSlotName( SvHash_HasDialog() ).GetBuffer() << '|';
1411     if( GetMenuConfig() )
1412         rOutStm << MakeSlotName( SvHash_MenuConfig() ).GetBuffer() << '|';
1413     if( GetToolBoxConfig() )
1414         rOutStm << MakeSlotName( SvHash_ToolBoxConfig() ).GetBuffer() << '|';
1415     if( GetStatusBarConfig() )
1416         rOutStm << MakeSlotName( SvHash_StatusBarConfig() ).GetBuffer() << '|';
1417     if( GetAccelConfig() )
1418         rOutStm << MakeSlotName( SvHash_AccelConfig() ).GetBuffer() << '|';
1419     if( GetFastCall() )
1420         rOutStm << MakeSlotName( SvHash_FastCall() ).GetBuffer() << '|';
1421     if( GetContainer() )
1422         rOutStm << MakeSlotName( SvHash_Container() ).GetBuffer() << '|';
1423     if ( GetReadOnlyDoc() )
1424         rOutStm << MakeSlotName( SvHash_ReadOnlyDoc() ).GetBuffer() << '|';
1425     if( GetImageRotation() )
1426         rOutStm << MakeSlotName( SvHash_ImageRotation() ).GetBuffer() << '|';
1427     if( GetImageReflection() )
1428         rOutStm << MakeSlotName( SvHash_ImageReflection() ).GetBuffer() << '|';
1429     rOutStm << '0';
1430 
1431     rOutStm << ',' << endl;
1432     WriteTab( rOutStm, 4 );
1433     if ( !GetDisableFlags().Len() )
1434         rOutStm << "0";
1435     else
1436         rOutStm << GetDisableFlags().GetBuffer();
1437 
1438     // Attribut Typ schreiben
1439     if( !bIsEnumSlot )
1440     {
1441         rOutStm << ',' << endl;
1442         WriteTab( rOutStm, 4 );
1443 
1444         SvMetaType * pT = GetSlotType();
1445         if( !pT )
1446         {
1447             if( !IsVariable() )
1448                 pT = rBase.FindType( "SfxVoidItem" );
1449             else
1450                 pT = GetType();
1451         }
1452         if( pT )
1453         {
1454             rOutStm << pT->GetName().GetBuffer();
1455             if( !rBase.FindType( pT, rBase.aUsedTypes ) )
1456                 rBase.aUsedTypes.Append( pT );
1457         }
1458         else
1459             rOutStm << "SfxVoidItem not defined";
1460     }
1461     else
1462     {
1463         SvMetaType *pT = rBase.FindType( "SfxBoolItem" );
1464         if ( pT && !rBase.FindType( pT, rBase.aUsedTypes ) )
1465             rBase.aUsedTypes.Append( pT );
1466     }
1467 
1468     if( !bIsEnumSlot )
1469     {
1470         rOutStm << ',' << endl;
1471         WriteTab( rOutStm, 4 );
1472         rOutStm << ByteString::CreateFromInt32( nCount ).GetBuffer() << "/*Offset*/, ";
1473 
1474         if( IsMethod() )
1475         {
1476             SvMetaAttribute * pMethod = GetMethod();
1477             SvMetaType * pType;
1478             if( pMethod )
1479                 pType = pMethod->GetType();
1480             else
1481                 pType = GetType();
1482             sal_uLong nSCount = pType->GetAttrCount();
1483             rOutStm << ByteString::CreateFromInt32( nSCount ).GetBuffer() << "/*Count*/";
1484         }
1485         else
1486             rOutStm << '0';
1487 
1488         // Name f"urs Recording
1489         if ( GetExport() )
1490         {
1491             rOutStm << ",\"";
1492             if( rPrefix.Len() )
1493                 rOutStm << rPrefix.GetBuffer();
1494             rOutStm << '.';
1495             if ( !IsVariable() || !GetType() ||
1496                  GetType()->GetBaseType()->GetType() != TYPE_STRUCT )
1497                 rOutStm << GetMangleName( sal_False ).GetBuffer();
1498             rOutStm << "\",";
1499         }
1500         else
1501             rOutStm << ", 0, ";
1502 
1503         // Method/Property Flags
1504         if( IsMethod() )
1505             rOutStm << "SFX_SLOT_METHOD|";
1506         if( IsVariable() )
1507         {
1508             rOutStm << "SFX_SLOT_PROPGET|";
1509             if( !GetReadonly() )
1510                 rOutStm << "SFX_SLOT_PROPSET|";
1511         }
1512 
1513         rOutStm << '0';
1514     }
1515 
1516 //    if ( GetUnoName().Len() )
1517     {
1518         rOutStm << ",\"";
1519         rOutStm << GetMangleName( sal_False ).GetBuffer();
1520         //rOutStm << GetUnoName().GetBuffer();
1521         rOutStm << "\"";
1522     }
1523 //    else
1524 //        rOutStm << ", 0";
1525 
1526     rOutStm << " )," << endl;
1527 }
1528 
WriteSlotParamArray(SvIdlDataBase & rBase,SvStream & rOutStm)1529 sal_uInt16 SvMetaSlot::WriteSlotParamArray( SvIdlDataBase & rBase, SvStream & rOutStm )
1530 {
1531     if ( !GetExport() && !GetHidden() )
1532         return 0;
1533 
1534     SvMetaAttribute * pMethod = GetMethod();
1535     if( IsMethod() )
1536     {
1537         SvMetaType * pType;
1538         if( pMethod )
1539             pType = pMethod->GetType();
1540         else
1541             pType = GetType();
1542 
1543         if( !rBase.FindType( pType, rBase.aUsedTypes ) )
1544             rBase.aUsedTypes.Append( pType );
1545 
1546         const SvMetaAttributeMemberList & rList =
1547                     pType->GetAttrList();
1548         for( sal_uLong n = 0; n < rList.Count(); n++ )
1549         {
1550             SvMetaAttribute * pPar  = rList.GetObject( n );
1551             SvMetaType * pPType     = pPar->GetType();
1552             WriteTab( rOutStm, 1 );
1553             rOutStm << "SFX_ARGUMENT("
1554                 << pPar->GetSlotId().GetBuffer() << ',' // SlodId
1555                 // Parameter Name
1556                 << "\"" << pPar->GetName().GetBuffer() << "\","
1557                 // Item Name
1558                 << pPType->GetName().GetBuffer() << ")," << endl;
1559             if( !rBase.FindType( pPType, rBase.aUsedTypes ) )
1560                 rBase.aUsedTypes.Append( pPType );
1561         }
1562         return (sal_uInt16)rList.Count();
1563     }
1564     return 0;
1565 }
1566 
WriteSlotMap(const ByteString & rShellName,sal_uInt16 nCount,SvSlotElementList & rSlotList,const ByteString & rPrefix,SvIdlDataBase & rBase,SvStream & rOutStm)1567 sal_uInt16 SvMetaSlot::WriteSlotMap( const ByteString & rShellName, sal_uInt16 nCount,
1568                                 SvSlotElementList& rSlotList,
1569                                 const ByteString & rPrefix,
1570                                 SvIdlDataBase & rBase,
1571                                 SvStream & rOutStm )
1572 {
1573     // SlotId, wenn nicht angegeben, aus Namen generieren
1574     ByteString slotId = GetSlotId();
1575 
1576     sal_uInt16 nSCount = 0;
1577     if( IsMethod() )
1578     {
1579         SvMetaType * pType;
1580         SvMetaAttribute * pMethod = GetMethod();
1581         if( pMethod )
1582             pType = pMethod->GetType();
1583         else
1584             pType = GetType();
1585 
1586         nSCount = (sal_uInt16)pType->GetAttrCount();
1587     }
1588 
1589     WriteSlot( rShellName, nCount, slotId, rSlotList, rPrefix, rBase, rOutStm );
1590     return nSCount;
1591 }
1592 
1593 /*************************************************************************
1594 |*    SvMetaSlot::WriteSrc()
1595 *************************************************************************/
WriteSrc(SvIdlDataBase & rBase,SvStream & rOutStm,Table * pTable)1596 void SvMetaSlot::WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm,
1597                              Table * pTable )
1598 {
1599     if (!GetToolBoxConfig() && !GetAccelConfig() && !GetMenuConfig() && !GetStatusBarConfig() )
1600         return;
1601 
1602     sal_uLong nSId = GetSlotId().GetValue();
1603     if( !pTable->IsKeyValid( nSId ) )
1604     {
1605         pTable->Insert( nSId, this );
1606         rOutStm << "SfxSlotInfo " << ByteString::CreateFromInt32( nSId ).GetBuffer()
1607                 << endl << '{' << endl;
1608 
1609         WriteTab( rOutStm, 1 );
1610         ByteString aStr = GetConfigName();
1611         if( !aStr.Len() )
1612             aStr = GetName();
1613 
1614         rOutStm << "SlotName = \"" << aStr.GetBuffer() << "\";" << endl;
1615 
1616         aStr = GetHelpText();
1617         if( aStr.Len() )
1618         {
1619             WriteTab( rOutStm, 1 );
1620             rOutStm << "HelpText = \"" << aStr.GetBuffer() << "\";" << endl;
1621         }
1622 
1623         rOutStm << "};" << endl;
1624     }
1625 
1626     SvMetaTypeEnum * pEnum = PTR_CAST( SvMetaTypeEnum, GetType() );
1627     if( GetPseudoSlots() && pEnum )
1628     {
1629         for( sal_uLong n = 0; n < pEnum->Count(); n++ )
1630         {
1631             ByteString aValName = pEnum->GetObject( n )->GetName();
1632             ByteString aSId( GetSlotId() );
1633             if( GetPseudoPrefix().Len() )
1634                 aSId = GetPseudoPrefix();
1635             aSId += '_';
1636             aSId += aValName.Copy( pEnum->GetPrefix().Len() );
1637 
1638             sal_uLong nSId2;
1639             sal_Bool bIdOk = sal_False;
1640             if( rBase.FindId( aSId, &nSId2 ) )
1641             {
1642                 aSId = ByteString::CreateFromInt32( nSId2 );
1643                 bIdOk = sal_True;
1644             }
1645 
1646             // wenn Id nicht gefunden, immer schreiben
1647             if( !bIdOk || !pTable->IsKeyValid( nSId2 ) )
1648             {
1649                 pTable->Insert( nSId2, this );
1650                 rOutStm << "SfxSlotInfo " << aSId.GetBuffer()
1651                         << endl << '{' << endl;
1652 
1653                 WriteTab( rOutStm, 1 );
1654                 rOutStm << "SlotName = \"" << aValName.GetBuffer() << "\";" << endl;
1655 
1656                 ByteString aStr = GetHelpText();
1657                 if( aStr.Len() )
1658                 {
1659                     WriteTab( rOutStm, 1 );
1660                     rOutStm << "HelpText = \"" << aStr.GetBuffer() << "\";" << endl;
1661                 }
1662                 rOutStm << "};" << endl;
1663             }
1664         }
1665     }
1666 }
1667 
WriteHelpId(SvIdlDataBase & rBase,SvStream & rOutStm,Table * pTable)1668 void SvMetaSlot::WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm,
1669                              Table * pTable )
1670 {
1671     sal_uLong nSId = GetSlotId().GetValue();
1672     if( !pTable->IsKeyValid( nSId ) )
1673     {
1674         pTable->Insert( nSId, this );
1675         rOutStm << "#define " << GetSlotId().GetBuffer() << '\t' << ByteString::CreateFromInt32( nSId ).GetBuffer() << endl;
1676     }
1677 
1678     SvMetaTypeEnum * pEnum = PTR_CAST( SvMetaTypeEnum, GetType() );
1679     if( GetPseudoSlots() && pEnum )
1680     {
1681         for( sal_uLong n = 0; n < pEnum->Count(); n++ )
1682         {
1683             ByteString aValName = pEnum->GetObject( n )->GetName();
1684             ByteString aSId( GetSlotId() );
1685             if( GetPseudoPrefix().Len() )
1686                 aSId = GetPseudoPrefix();
1687             aSId += '_';
1688             aSId += aValName.Copy( pEnum->GetPrefix().Len() );
1689 
1690             sal_uLong nSId2;
1691             sal_Bool bIdOk = sal_False;
1692             if( rBase.FindId( aSId, &nSId2 ) )
1693             {
1694                 aSId = ByteString::CreateFromInt32( nSId2 );
1695                 bIdOk = sal_True;
1696             }
1697 
1698             // wenn Id nicht gefunden, immer schreiben
1699             if( !bIdOk || !pTable->IsKeyValid( nSId2 ) )
1700             {
1701                 pTable->Insert( nSId2, this );
1702 
1703                 rOutStm << "#define " << aSId.GetBuffer() << '\t'
1704                         << ByteString::CreateFromInt32( nSId2 ).GetBuffer() << endl;
1705             }
1706         }
1707     }
1708 }
1709 
WriteBool(sal_Bool bSet,SvStream & rStream)1710 void WriteBool( sal_Bool bSet, SvStream& rStream )
1711 {
1712     if ( bSet )
1713         rStream << "sal_True" << ',';
1714     else
1715         rStream << "sal_False" << ',';
1716 }
1717 
WriteCSV(SvIdlDataBase & rBase,SvStream & rStrm)1718 void SvMetaSlot::WriteCSV( SvIdlDataBase& rBase, SvStream& rStrm )
1719 {
1720     rStrm << "PROJECT,";
1721     rStrm << GetSlotId().GetBuffer() << ',';
1722     rStrm << ByteString::CreateFromInt32( GetSlotId().GetValue() ).GetBuffer() << ',';
1723 
1724     if ( GetPseudoPrefix().Len() )
1725         rStrm << GetPseudoPrefix().GetBuffer() << ',';
1726     else
1727         rStrm << ',';
1728 
1729     rStrm << GetGroupId().GetBuffer() << ',';
1730 
1731     WriteBool( GetAccelConfig(), rStrm );
1732     WriteBool( GetMenuConfig(), rStrm );
1733     WriteBool( GetStatusBarConfig(), rStrm );
1734     WriteBool( GetToolBoxConfig(), rStrm );
1735 
1736     if ( GetSlotType() )
1737         rStrm << GetSlotType()->GetName().GetBuffer() << ',';
1738     else
1739         rStrm << ',';
1740 
1741     WriteBool( GetAutoUpdate(), rStrm );
1742     if ( GetCachable() )
1743         rStrm << "Cachable" << ',';
1744     else
1745         rStrm << "Volatile" << ',';
1746 
1747     WriteBool( GetContainer(), rStrm );
1748     WriteBool( GetFastCall(), rStrm );
1749     WriteBool( GetHasCoreId(), rStrm );
1750     WriteBool( GetHasDialog(), rStrm );
1751     WriteBool( GetReadOnlyDoc(), rStrm );
1752     WriteBool( GetImageRotation(), rStrm );
1753     WriteBool( GetImageReflection(), rStrm );
1754     rStrm << GetDisableFlags().GetBuffer() << ',';
1755 
1756     if( GetSynchron() )
1757         rStrm << "Synchron" << ',';
1758     else
1759         rStrm << "Asynchron" << ',';
1760 
1761     WriteBool( GetToggle(), rStrm );
1762     WriteBool( GetReadonly(), rStrm );
1763     WriteBool( GetExport(), rStrm );
1764     if( GetRecordPerItem() )
1765         rStrm << "RecordPerItem" << ',';
1766     else if ( GetNoRecord() )
1767         rStrm << "NoRecord" << ',';
1768     else if ( GetRecordManual() )
1769         rStrm << "RecordManual" << ',';
1770     else
1771         rStrm << "RecordPerSet" << ',';
1772 
1773     WriteBool( GetRecordAbsolute(), rStrm );
1774 
1775     if ( GetType()->GetType() != TYPE_METHOD && GetMethod() )
1776     {
1777         rStrm << GetMethod()->GetType()->GetReturnType()->GetName().GetBuffer() << ',';
1778         rStrm << GetMethod()->GetName().GetBuffer() << ',';
1779     }
1780     else
1781     {
1782         rStrm << ",,";
1783     }
1784 
1785     rStrm << GetType()->GetSvName().GetBuffer() << ',';
1786     rStrm << GetName().GetBuffer() << ',';
1787 
1788     if ( GetType()->GetType() == TYPE_METHOD || GetMethod() )
1789     {
1790         SvMetaAttributeMemberList *pList = &GetType()->GetAttrList();
1791         if ( GetMethod() )
1792             pList = &GetMethod()->GetType()->GetAttrList();
1793 
1794         if( pList && pList->Count() )
1795         {
1796             rStrm << "\"(";
1797             SvMetaAttribute* pAttr = pList->First();
1798             while( pAttr )
1799             {
1800                 pAttr->WriteCSV( rBase, rStrm );
1801                 pAttr = pList->Next();
1802                 if( pAttr )
1803                     rStrm << ',';
1804             }
1805             rStrm << ")\"";
1806         }
1807         else
1808             rStrm << "()";
1809     }
1810 
1811     rStrm << endl;
1812 }
1813 
1814 #endif // IDL_COMPILER
1815 
1816 
1817