1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_idl.hxx"
33 #include <tools/debug.hxx>
36 #include <globals.hxx>
37 #include <database.hxx>
39 /****************** SvMetaSlot *****************************************/
40 SV_IMPL_META_FACTORY1( SvMetaSlot
, SvMetaAttribute
);
42 SvMetaObject
*SvMetaSlot::MakeClone() const
44 return new SvMetaSlot( *this );
47 /*************************************************************************
48 |* SvMetaSlot::SvMetaSlot()
50 |* Beschreibung Zweites sal_False bei den SvBOOL-Objekten bedeutet,
51 |* IsSet() liefert sal_False (Defaultinitialisierung).
52 *************************************************************************/
53 SvMetaSlot::SvMetaSlot()
54 : aCachable( sal_True
, sal_False
)
55 , aSynchron( sal_True
, sal_False
)
56 , aRecordPerSet( sal_True
, sal_False
)
57 , aRecordAbsolute( sal_False
, sal_False
)
64 SvMetaSlot::SvMetaSlot( SvMetaType
* pType
)
65 : SvMetaAttribute( pType
)
66 , aCachable( sal_True
, sal_False
)
67 , aSynchron( sal_True
, sal_False
)
68 , aRecordPerSet( sal_True
, sal_False
)
69 , aRecordAbsolute( sal_False
, sal_False
)
81 DBG_ASSERT( nPos +4 == rStm.Tell(), "stream pos error" ); \
85 rStm << (sal_uInt32)rStm.Tell();
90 void SvMetaSlot::Load( SvPersistStream
& rStm
)
92 SvMetaAttribute::Load( rStm
);
100 SvMetaAttribute
* pMeth
;
106 if( nMask
& 0x0002 ) rStm
>> aGroupId
;
108 if( nMask
& 0x0004 ) rStm
>> aHasCoreId
;
110 if( nMask
& 0x0008 ) rStm
>> aConfigId
;
112 if( nMask
& 0x0010 ) rStm
>> aExecMethod
;
114 if( nMask
& 0x0020 ) rStm
>> aStateMethod
;
116 if( nMask
& 0x0040 ) rStm
>> aDefault
;
118 if( nMask
& 0x0080 ) rStm
>> aPseudoSlots
;
120 if( nMask
& 0x0100 ) rStm
>> aGet
;
122 if( nMask
& 0x0200 ) rStm
>> aSet
;
124 if( nMask
& 0x0400 ) rStm
>> aCachable
;
126 if( nMask
& 0x0800 ) rStm
>> aVolatile
;
128 if( nMask
& 0x1000 ) rStm
>> aToggle
;
130 if( nMask
& 0x2000 ) rStm
>> aAutoUpdate
;
132 if( nMask
& 0x4000 ) rStm
>> aSynchron
;
134 if( nMask
& 0x8000 ) rStm
>> aAsynchron
;
140 if( nMask
& 0x0001 ) rStm
>> aRecordPerItem
;
142 if( nMask
& 0x0002 ) rStm
>> aRecordManual
;
144 if( nMask
& 0x0004 ) rStm
>> aNoRecord
;
146 if( nMask
& 0x0008 ) rStm
>> aHasDialog
;
148 if( nMask
& 0x0010 ) rStm
>> aDisableFlags
;
150 if( nMask
& 0x0020 ) rStm
>> aPseudoPrefix
;
152 if( nMask
& 0x0040 ) rStm
>> aRecordPerSet
;
154 if( nMask
& 0x0080 ) rStm
>> aMenuConfig
;
156 if( nMask
& 0x0100 ) rStm
>> aToolBoxConfig
;
158 if( nMask
& 0x0200 ) rStm
>> aStatusBarConfig
;
160 if( nMask
& 0x0400 ) rStm
>> aAccelConfig
;
162 if( nMask
& 0x0800 ) rStm
>> aFastCall
;
164 if( nMask
& 0x1000 ) rStm
>> aContainer
;
175 if( nMask
& 0x4000 ) rStm
>> aRecordAbsolute
;
177 if( nMask
& 0x8000 ) rStm
>> aImageRotation
;
183 if( nMask
& 0x0001 ) rStm
>> aUnoName
;
184 if( nMask
& 0x0002 ) rStm
>> aImageReflection
;
187 void SvMetaSlot::Save( SvPersistStream
& rStm
)
189 SvMetaAttribute::Save( rStm
);
192 sal_uInt16 nMask
= 0;
193 if( aMethod
.Is() ) nMask
|= 0x0001;
194 if( aGroupId
.Len() ) nMask
|= 0x0002;
195 if( aHasCoreId
.IsSet() ) nMask
|= 0x0004;
196 if( aConfigId
.Len() ) nMask
|= 0x0008;
197 if( aExecMethod
.Len() ) nMask
|= 0x0010;
198 if( aStateMethod
.Len() ) nMask
|= 0x0020;
199 if( aDefault
.Len() ) nMask
|= 0x0040;
200 if( aPseudoSlots
.IsSet() ) nMask
|= 0x0080;
201 if( aGet
.IsSet() ) nMask
|= 0x0100;
202 if( aSet
.IsSet() ) nMask
|= 0x0200;
203 if( aCachable
.IsSet() ) nMask
|= 0x0400;
204 if( aVolatile
.IsSet() ) nMask
|= 0x0800;
205 if( aToggle
.IsSet() ) nMask
|= 0x1000;
206 if( aAutoUpdate
.IsSet() ) nMask
|= 0x2000;
207 if( aSynchron
.IsSet() ) nMask
|= 0x4000;
208 if( aAsynchron
.IsSet() ) nMask
|= 0x8000;
213 if( nMask
& 0x0001 ) rStm
<< aMethod
;
215 if( nMask
& 0x0002 ) rStm
<< aGroupId
;
217 if( nMask
& 0x0004 ) rStm
<< aHasCoreId
;
219 if( nMask
& 0x0008 ) rStm
<< aConfigId
;
221 if( nMask
& 0x0010 ) rStm
<< aExecMethod
;
223 if( nMask
& 0x0020 ) rStm
<< aStateMethod
;
225 if( nMask
& 0x0040 ) rStm
<< aDefault
;
227 if( nMask
& 0x0080 ) rStm
<< aPseudoSlots
;
229 if( nMask
& 0x0100 ) rStm
<< aGet
;
231 if( nMask
& 0x0200 ) rStm
<< aSet
;
233 if( nMask
& 0x0400 ) rStm
<< aCachable
;
235 if( nMask
& 0x0800 ) rStm
<< aVolatile
;
237 if( nMask
& 0x1000 ) rStm
<< aToggle
;
239 if( nMask
& 0x2000 ) rStm
<< aAutoUpdate
;
241 if( nMask
& 0x4000 ) rStm
<< aSynchron
;
243 if( nMask
& 0x8000 ) rStm
<< aAsynchron
;
245 // naechste Fuhre schreiben
248 if( aRecordPerItem
.IsSet() ) nMask
|= 0x0001;
249 if( aRecordManual
.IsSet() ) nMask
|= 0x0002;
250 if( aNoRecord
.IsSet() ) nMask
|= 0x0004;
251 if( aHasDialog
.IsSet() ) nMask
|= 0x0008;
252 if ( aDisableFlags
.IsSet() ) nMask
|= 0x0010;
253 if( aPseudoPrefix
.Len() ) nMask
|= 0x0020;
254 if( aRecordPerSet
.IsSet() ) nMask
|= 0x0040;
255 if( aMenuConfig
.IsSet() ) nMask
|= 0x0080;
256 if( aToolBoxConfig
.IsSet() ) nMask
|= 0x0100;
257 if( aStatusBarConfig
.IsSet() )nMask
|= 0x0200;
258 if( aAccelConfig
.IsSet() ) nMask
|= 0x0400;
259 if( aFastCall
.IsSet() ) nMask
|= 0x0800;
260 if( aContainer
.IsSet() ) nMask
|= 0x1000;
261 if( aSlotType
.Is() ) nMask
|= 0x2000;
262 if( aRecordAbsolute
.IsSet() ) nMask
|= 0x4000;
263 if( aImageRotation
.IsSet() ) nMask
|= 0x8000;
268 if( nMask
& 0x0001 ) rStm
<< aRecordPerItem
;
270 if( nMask
& 0x0002 ) rStm
<< aRecordManual
;
272 if( nMask
& 0x0004 ) rStm
<< aNoRecord
;
274 if( nMask
& 0x0008 ) rStm
<< aHasDialog
;
276 if( nMask
& 0x0010 ) rStm
<< aDisableFlags
;
278 if( nMask
& 0x0020 ) rStm
<< aPseudoPrefix
;
280 if( nMask
& 0x0040 ) rStm
<< aRecordPerSet
;
282 if( nMask
& 0x0080 ) rStm
<< aMenuConfig
;
284 if( nMask
& 0x0100 ) rStm
<< aToolBoxConfig
;
286 if( nMask
& 0x0200 ) rStm
<< aStatusBarConfig
;
288 if( nMask
& 0x0400 ) rStm
<< aAccelConfig
;
290 if( nMask
& 0x0800 ) rStm
<< aFastCall
;
292 if( nMask
& 0x1000 ) rStm
<< aContainer
;
294 if( nMask
& 0x2000 ) rStm
<< aSlotType
;
296 if( nMask
& 0x4000 ) rStm
<< aRecordAbsolute
;
298 if( nMask
& 0x8000 ) rStm
<< aImageRotation
;
301 if( aUnoName
.IsSet() ) nMask
|= 0x0001;
302 if( aImageReflection
.IsSet() ) nMask
|= 0x0002;
305 if( nMask
& 0x0001 ) rStm
<< aUnoName
;
307 if( nMask
& 0x0002 ) rStm
<< aImageReflection
;
310 /*************************************************************************
311 |* SvMetaSlot::IsVariable()
314 *************************************************************************/
315 sal_Bool
SvMetaSlot::IsVariable() const
317 return SvMetaAttribute::IsVariable();
320 /*************************************************************************
321 |* SvMetaSlot::IsMethod()
324 *************************************************************************/
325 sal_Bool
SvMetaSlot::IsMethod() const
327 sal_Bool b
= SvMetaAttribute::IsMethod();
328 b
|= NULL
!= GetMethod();
332 /*************************************************************************
333 |* SvMetaSlot::HasMethods()
336 *************************************************************************/
337 ByteString
SvMetaSlot::GetMangleName( sal_Bool bVariable
) const
341 SvMetaAttribute
* pMeth
= GetMethod();
343 return pMeth
->GetName();
348 /*************************************************************************
351 |* Beschreibung Zweites sal_False bei den SvBOOL-Objekten bedeutet,
352 |* IsSet() liefert sal_False (Defaultinitialisierung).
353 *************************************************************************/
354 /** Referenz Aufloesung **/
355 SvMetaType
* SvMetaSlot::GetSlotType() const
357 if( aSlotType
.Is() || !GetRef() ) return aSlotType
;
358 return ((SvMetaSlot
*)GetRef())->GetSlotType();
360 SvMetaAttribute
* SvMetaSlot::GetMethod() const
362 if( aMethod
.Is() || !GetRef() ) return aMethod
;
363 return ((SvMetaSlot
*)GetRef())->GetMethod();
365 sal_Bool
SvMetaSlot::GetHasCoreId() const
367 if( aHasCoreId
.IsSet() || !GetRef() ) return aHasCoreId
;
368 return ((SvMetaSlot
*)GetRef())->GetHasCoreId();
370 const ByteString
& SvMetaSlot::GetGroupId() const
372 if( aGroupId
.Len() || !GetRef() ) return aGroupId
;
373 return ((SvMetaSlot
*)GetRef())->GetGroupId();
375 const ByteString
& SvMetaSlot::GetDisableFlags() const
377 if( aDisableFlags
.Len() || !GetRef() ) return aDisableFlags
;
378 return ((SvMetaSlot
*)GetRef())->GetDisableFlags();
380 const ByteString
& SvMetaSlot::GetConfigId() const
382 if( aConfigId
.Len() || !GetRef() ) return aConfigId
;
383 return ((SvMetaSlot
*)GetRef())->GetConfigId();
385 const ByteString
& SvMetaSlot::GetExecMethod() const
387 if( aExecMethod
.Len() || !GetRef() ) return aExecMethod
;
388 return ((SvMetaSlot
*)GetRef())->GetExecMethod();
390 const ByteString
& SvMetaSlot::GetStateMethod() const
392 if( aStateMethod
.Len() || !GetRef() ) return aStateMethod
;
393 return ((SvMetaSlot
*)GetRef())->GetStateMethod();
395 const ByteString
& SvMetaSlot::GetDefault() const
397 if( aDefault
.Len() || !GetRef() ) return aDefault
;
398 return ((SvMetaSlot
*)GetRef())->GetDefault();
400 sal_Bool
SvMetaSlot::GetPseudoSlots() const
402 if( aPseudoSlots
.IsSet() || !GetRef() ) return aPseudoSlots
;
403 return ((SvMetaSlot
*)GetRef())->GetPseudoSlots();
406 sal_Bool SvMetaSlot::GetGet() const
408 if( aGet.IsSet() || !GetRef() ) return aGet;
409 return ((SvMetaSlot *)GetRef())->GetGet();
411 sal_Bool SvMetaSlot::GetSet() const
413 if( aSet.IsSet() || !GetRef() ) return aSet;
414 return ((SvMetaSlot *)GetRef())->GetSet();
417 sal_Bool
SvMetaSlot::GetCachable() const
419 // Cachable und Volatile sind exclusiv
420 if( !GetRef() || aCachable
.IsSet() || aVolatile
.IsSet() )
422 return ((SvMetaSlot
*)GetRef())->GetCachable();
424 sal_Bool
SvMetaSlot::GetVolatile() const
426 // Cachable und Volatile sind exclusiv
427 if( !GetRef() || aVolatile
.IsSet() || aCachable
.IsSet() )
429 return ((SvMetaSlot
*)GetRef())->GetVolatile();
431 sal_Bool
SvMetaSlot::GetToggle() const
433 if( aToggle
.IsSet() || !GetRef() ) return aToggle
;
434 return ((SvMetaSlot
*)GetRef())->GetToggle();
436 sal_Bool
SvMetaSlot::GetAutoUpdate() const
438 if( aAutoUpdate
.IsSet() || !GetRef() ) return aAutoUpdate
;
439 return ((SvMetaSlot
*)GetRef())->GetAutoUpdate();
441 sal_Bool
SvMetaSlot::GetSynchron() const
443 // Synchron und Asynchron sind exclusiv
444 if( !GetRef() || aSynchron
.IsSet() || aAsynchron
.IsSet() )
446 return ((SvMetaSlot
*)GetRef())->GetSynchron();
448 sal_Bool
SvMetaSlot::GetAsynchron() const
450 // Synchron und Asynchron sind exclusiv
451 if( !GetRef() || aAsynchron
.IsSet() || aSynchron
.IsSet() )
453 return ((SvMetaSlot
*)GetRef())->GetAsynchron();
455 sal_Bool
SvMetaSlot::GetRecordPerItem() const
457 // Record- PerItem, No, PerSet und Manual sind exclusiv
458 if( !GetRef() || aRecordPerItem
.IsSet() || aNoRecord
.IsSet()
459 || aRecordPerSet
.IsSet() || aRecordManual
.IsSet() )
460 return aRecordPerItem
;
461 return ((SvMetaSlot
*)GetRef())->GetRecordPerItem();
463 sal_Bool
SvMetaSlot::GetRecordPerSet() const
465 // Record- PerItem, No, PerSet und Manual sind exclusiv
466 if( !GetRef() || aRecordPerItem
.IsSet() || aNoRecord
.IsSet()
467 || aRecordPerSet
.IsSet() || aRecordManual
.IsSet() )
468 return aRecordPerSet
;
469 return ((SvMetaSlot
*)GetRef())->GetRecordPerSet();
471 sal_Bool
SvMetaSlot::GetRecordManual() const
473 // Record- PerItem, No, PerSet und Manual sind exclusiv
474 if( !GetRef() || aRecordPerItem
.IsSet() || aNoRecord
.IsSet()
475 || aRecordPerSet
.IsSet() || aRecordManual
.IsSet() )
476 return aRecordManual
;
477 return ((SvMetaSlot
*)GetRef())->GetRecordManual();
479 sal_Bool
SvMetaSlot::GetNoRecord() const
481 // Record- PerItem, No, PerSet und Manual sind exclusiv
482 if( !GetRef() || aRecordPerItem
.IsSet() || aNoRecord
.IsSet()
483 || aRecordPerSet
.IsSet() || aRecordManual
.IsSet() )
485 return ((SvMetaSlot
*)GetRef())->GetNoRecord();
487 sal_Bool
SvMetaSlot::GetRecordAbsolute() const
489 if( !GetRef() || aRecordAbsolute
.IsSet() )
490 return aRecordAbsolute
;
491 return ((SvMetaSlot
*)GetRef())->GetRecordAbsolute();
493 sal_Bool
SvMetaSlot::GetHasDialog() const
495 if( aHasDialog
.IsSet() || !GetRef() ) return aHasDialog
;
496 return ((SvMetaSlot
*)GetRef())->GetHasDialog();
498 const ByteString
& SvMetaSlot::GetPseudoPrefix() const
500 if( aPseudoPrefix
.Len() || !GetRef() ) return aPseudoPrefix
;
501 return ((SvMetaSlot
*)GetRef())->GetPseudoPrefix();
503 sal_Bool
SvMetaSlot::GetMenuConfig() const
505 if( aMenuConfig
.IsSet() || !GetRef() ) return aMenuConfig
;
506 return ((SvMetaSlot
*)GetRef())->GetMenuConfig();
508 sal_Bool
SvMetaSlot::GetToolBoxConfig() const
510 if( aToolBoxConfig
.IsSet() || !GetRef() ) return aToolBoxConfig
;
511 return ((SvMetaSlot
*)GetRef())->GetToolBoxConfig();
513 sal_Bool
SvMetaSlot::GetStatusBarConfig() const
515 if( aStatusBarConfig
.IsSet() || !GetRef() ) return aStatusBarConfig
;
516 return ((SvMetaSlot
*)GetRef())->GetStatusBarConfig();
518 sal_Bool
SvMetaSlot::GetAccelConfig() const
520 if( aAccelConfig
.IsSet() || !GetRef() ) return aAccelConfig
;
521 return ((SvMetaSlot
*)GetRef())->GetAccelConfig();
523 sal_Bool
SvMetaSlot::GetFastCall() const
525 if( aFastCall
.IsSet() || !GetRef() ) return aFastCall
;
526 return ((SvMetaSlot
*)GetRef())->GetFastCall();
528 sal_Bool
SvMetaSlot::GetContainer() const
530 if( aContainer
.IsSet() || !GetRef() ) return aContainer
;
531 return ((SvMetaSlot
*)GetRef())->GetContainer();
534 sal_Bool
SvMetaSlot::GetImageRotation() const
536 if( aImageRotation
.IsSet() || !GetRef() ) return aImageRotation
;
537 return ((SvMetaSlot
*)GetRef())->GetImageRotation();
540 sal_Bool
SvMetaSlot::GetImageReflection() const
542 if( aImageReflection
.IsSet() || !GetRef() ) return aImageReflection
;
543 return ((SvMetaSlot
*)GetRef())->GetImageReflection();
546 const ByteString
& SvMetaSlot::GetUnoName() const
548 if( aUnoName
.IsSet() || !GetRef() ) return aUnoName
;
549 return ((SvMetaSlot
*)GetRef())->GetUnoName();
552 /*************************************************************************
553 |* SvMetaSlot::FillSbxObject()
556 *************************************************************************/
558 void SvMetaSlot::FillSbxObject( SvIdlDataBase & rBase, SbxObject * pObj,
561 // keine Attribut fuer Automation
562 if( !GetAutomation() || !GetExport() )
567 SvMetaAttributeRef xM = GetMethod();
570 SvMetaType * pType = xM->GetType();
571 SvMetaType * pRetBaseType = pType->GetReturnType()->GetBaseType();
572 ByteString aName = xM->GetName();
574 SbxMethodRef xMeth = new SbxMethod( aName,
575 pRetBaseType->GetSbxDataType() );
576 pType->FillSbxObject( xMeth, bVariable );
577 xMeth->SetUserData( MakeSlotValue(rBase, sal_False) );
579 pObj->Insert( &xMeth );
584 SvMetaAttribute::FillSbxObject( rBase, pObj, bVariable );
589 /*************************************************************************
590 |* SvMetaSlot::ReadAttributesSvIdl()
593 *************************************************************************/
594 void SvMetaSlot::ReadAttributesSvIdl( SvIdlDataBase
& rBase
,
595 SvTokenStream
& rInStm
)
597 SvMetaAttribute::ReadAttributesSvIdl( rBase
, rInStm
);
599 sal_Bool bOk
= sal_False
;
600 bOk
|= aDefault
.ReadSvIdl( SvHash_Default(), rInStm
);
601 bOk
|= aPseudoSlots
.ReadSvIdl( SvHash_PseudoSlots(), rInStm
);
602 bOk
|= aHasCoreId
.ReadSvIdl( SvHash_HasCoreId(), rInStm
);
603 bOk
|= aGroupId
.ReadSvIdl( SvHash_GroupId(), rInStm
);
604 bOk
|= aExecMethod
.ReadSvIdl( SvHash_ExecMethod(), rInStm
);
605 bOk
|= aStateMethod
.ReadSvIdl( SvHash_StateMethod(), rInStm
);
606 bOk
|= aDisableFlags
.ReadSvIdl( SvHash_DisableFlags(), rInStm
);
607 if( aGet
.ReadSvIdl( SvHash_Get(), rInStm
) )
609 rBase
.WriteError( "warning", ByteString( rInStm
.GetFileName(), RTL_TEXTENCODING_UTF8
),
610 "<Get> old style, use Readonly",
611 rInStm
.GetToken()->GetLine(),
612 rInStm
.GetToken()->GetColumn() );
614 if( aSet
.ReadSvIdl( SvHash_Set(), rInStm
) )
616 rBase
.WriteError( "warning", ByteString( rInStm
.GetFileName(), RTL_TEXTENCODING_UTF8
),
617 "<Set> old style, use method declaration",
618 rInStm
.GetToken()->GetLine(),
619 rInStm
.GetToken()->GetColumn() );
622 if( aCachable
.ReadSvIdl( SvHash_Cachable(), rInStm
) )
623 SetCachable( aCachable
), bOk
= sal_True
;
624 if( aVolatile
.ReadSvIdl( SvHash_Volatile(), rInStm
) )
625 SetVolatile( aVolatile
), bOk
= sal_True
;
626 if( aToggle
.ReadSvIdl( SvHash_Toggle(), rInStm
) )
627 SetToggle( aToggle
), bOk
= sal_True
;
628 if( aAutoUpdate
.ReadSvIdl( SvHash_AutoUpdate(), rInStm
) )
629 SetAutoUpdate( aAutoUpdate
), bOk
= sal_True
;
631 if( aSynchron
.ReadSvIdl( SvHash_Synchron(), rInStm
) )
632 SetSynchron( aSynchron
), bOk
= sal_True
;
633 if( aAsynchron
.ReadSvIdl( SvHash_Asynchron(), rInStm
) )
634 SetAsynchron( aAsynchron
), bOk
= sal_True
;
636 if( aRecordAbsolute
.ReadSvIdl( SvHash_RecordAbsolute(), rInStm
) )
637 SetRecordAbsolute( aRecordAbsolute
), bOk
= sal_True
;
638 if( aRecordPerItem
.ReadSvIdl( SvHash_RecordPerItem(), rInStm
) )
639 SetRecordPerItem( aRecordPerItem
), bOk
= sal_True
;
640 if( aRecordPerSet
.ReadSvIdl( SvHash_RecordPerSet(), rInStm
) )
641 SetRecordPerSet( aRecordPerSet
), bOk
= sal_True
;
642 if( aRecordManual
.ReadSvIdl( SvHash_RecordManual(), rInStm
) )
643 SetRecordManual( aRecordManual
), bOk
= sal_True
;
644 if( aNoRecord
.ReadSvIdl( SvHash_NoRecord(), rInStm
) )
645 SetNoRecord( aNoRecord
), bOk
= sal_True
;
647 bOk
|= aHasDialog
.ReadSvIdl( SvHash_HasDialog(), rInStm
);
648 bOk
|= aPseudoPrefix
.ReadSvIdl( SvHash_PseudoPrefix(), rInStm
);
649 bOk
|= aMenuConfig
.ReadSvIdl( SvHash_MenuConfig(), rInStm
);
650 bOk
|= aToolBoxConfig
.ReadSvIdl( SvHash_ToolBoxConfig(), rInStm
);
651 bOk
|= aStatusBarConfig
.ReadSvIdl( SvHash_StatusBarConfig(), rInStm
);
652 bOk
|= aAccelConfig
.ReadSvIdl( SvHash_AccelConfig(), rInStm
);
655 if( aAllConfig
.ReadSvIdl( SvHash_AllConfig(), rInStm
) )
656 SetAllConfig( aAllConfig
), bOk
= sal_True
;
657 bOk
|= aFastCall
.ReadSvIdl( SvHash_FastCall(), rInStm
);
658 bOk
|= aContainer
.ReadSvIdl( SvHash_Container(), rInStm
);
659 bOk
|= aImageRotation
.ReadSvIdl( SvHash_ImageRotation(), rInStm
);
660 bOk
|= aImageReflection
.ReadSvIdl( SvHash_ImageReflection(), rInStm
);
661 bOk
|= aUnoName
.ReadSvIdl( SvHash_UnoName(), rInStm
);
665 if( !aSlotType
.Is() )
667 sal_uInt32 nTokPos
= rInStm
.Tell();
668 SvToken
* pTok
= rInStm
.GetToken_Next();
669 if( pTok
->Is( SvHash_SlotType() ) )
671 sal_Bool bBraket
= rInStm
.Read( '(' );
672 if( bBraket
|| rInStm
.Read( '=' ) )
674 aSlotType
= rBase
.ReadKnownType( rInStm
);
677 if( aSlotType
->IsItem() )
681 if( rInStm
.Read( ')' ) )
687 rBase
.SetError( "the SlotType is not a item", rInStm
.GetToken() );
688 rBase
.WriteError( rInStm
);
690 rBase
.SetError( "SlotType with unknown item type", rInStm
.GetToken() );
691 rBase
.WriteError( rInStm
);
694 rInStm
.Seek( nTokPos
);
699 SvToken
* pTok
= rInStm
.GetToken();
700 if( pTok
->IsIdentifier() )
702 aMethod
= new SvMetaSlot();
703 sal_uInt32 nTokPos
= rInStm
.Tell();
704 if( aMethod
->ReadSvIdl( rBase
, rInStm
) )
706 if( aMethod
->IsMethod() )
708 aMethod
->SetSlotId( GetSlotId() );
709 if( aMethod
->Test( rBase
, rInStm
) )
712 rInStm
.Seek( nTokPos
);
720 /*************************************************************************
721 |* SvMetaSlot::WriteAttributesSvIdl()
724 *************************************************************************/
725 void SvMetaSlot::WriteAttributesSvIdl( SvIdlDataBase
& rBase
,
729 SvMetaAttribute::WriteAttributesSvIdl( rBase
, rOutStm
, nTab
);
733 WriteTab( rOutStm
, nTab
);
734 rOutStm
<< SvHash_SlotType()->GetName().GetBuffer() << '(';
735 aSlotType
->WriteTheType( rBase
, rOutStm
, nTab
, WRITE_IDL
);
736 rOutStm
<< ");" << endl
;
740 WriteTab( rOutStm
, nTab
);
741 aMethod
->WriteSvIdl( rBase
, rOutStm
, nTab
);
742 rOutStm
<< ';' << endl
;
746 aHasCoreId
.WriteSvIdl( SvHash_HasCoreId(), rOutStm
);
747 rOutStm
<< ';' << endl
;
751 WriteTab( rOutStm
, nTab
);
752 aGroupId
.WriteSvIdl( SvHash_GroupId(), rOutStm
, nTab
+1);
753 rOutStm
<< ';' << endl
;
755 if( aExecMethod
.Len() )
757 WriteTab( rOutStm
, nTab
);
758 aExecMethod
.WriteSvIdl( SvHash_ExecMethod(), rOutStm
, nTab
+1);
759 rOutStm
<< ';' << endl
;
761 if( aStateMethod
.Len() )
763 WriteTab( rOutStm
, nTab
);
764 aStateMethod
.WriteSvIdl( SvHash_StateMethod(), rOutStm
, nTab
+1);
765 rOutStm
<< ';' << endl
;
768 if( aDisableFlags
.Len() )
770 WriteTab( rOutStm
, nTab
);
771 aDisableFlags
.WriteSvIdl( SvHash_DisableFlags(), rOutStm
, nTab
+1);
772 rOutStm
<< ';' << endl
;
775 if( aSet
|| aGet
|| aPseudoSlots
)
777 WriteTab( rOutStm
, nTab
);
781 aPseudoSlots
.WriteSvIdl( SvHash_PseudoSlots(), rOutStm
);
787 aGet
.WriteSvIdl( SvHash_Get(), rOutStm
);
793 aSet
.WriteSvIdl( SvHash_Set(), rOutStm
);
795 rOutStm
<< ';' << endl
;
798 ByteString
aDel( ", " );
801 aOut
+= aVolatile
.GetSvIdlString( SvHash_Volatile() );
802 else if( !aCachable
)
803 // wegen Default == sal_True, nur wenn kein anderer gesetzt
804 aOut
+= aCachable
.GetSvIdlString( SvHash_Cachable() );
810 ( aOut
+= aDel
) += aToggle
.GetSvIdlString( SvHash_Toggle() );
815 (aOut
+= aDel
) += aAutoUpdate
.GetSvIdlString( SvHash_AutoUpdate() );
819 ByteString
aDel1( ", " );
821 ( aOut
+= aDel
) += aAsynchron
.GetSvIdlString( SvHash_Asynchron() );
822 else if( !aSynchron
)
823 // wegen Default == sal_True, nur wenn kein anderer gesetzt
824 ( aOut
+= aDel
) += aSynchron
.GetSvIdlString( SvHash_Synchron() );
830 ( aOut
+= aDel1
) += aRecordManual
.GetSvIdlString( SvHash_RecordManual() );
832 ( aOut
+= aDel1
) += aNoRecord
.GetSvIdlString( SvHash_NoRecord() );
833 else if( !aRecordPerSet
)
834 // wegen Default == sal_True, nur wenn kein anderer gesetzt
835 ( aOut
+= aDel1
) += aRecordPerSet
.GetSvIdlString( SvHash_RecordPerSet() );
836 else if( aRecordPerItem
)
837 ( aOut
+= aDel1
) += aRecordPerItem
.GetSvIdlString( SvHash_RecordPerItem() );
841 if( aRecordAbsolute
)
843 ( aOut
+= aDel
) += aRecordAbsolute
.GetSvIdlString( SvHash_RecordAbsolute() );
848 ( aOut
+= aDel
) += aHasDialog
.GetSvIdlString( SvHash_HasDialog() );
853 ( aOut
+= aDel
) += aMenuConfig
.GetSvIdlString( SvHash_MenuConfig() );
858 ( aOut
+= aDel
) += aToolBoxConfig
.GetSvIdlString( SvHash_ToolBoxConfig() );
861 if( aStatusBarConfig
)
863 ( aOut
+= aDel
) += aStatusBarConfig
.GetSvIdlString( SvHash_StatusBarConfig() );
868 ( aOut
+= aDel
) += aAccelConfig
.GetSvIdlString( SvHash_AccelConfig() );
873 ( aOut
+= aDel
) += aFastCall
.GetSvIdlString( SvHash_FastCall() );
878 ( aOut
+= aDel
) += aContainer
.GetSvIdlString( SvHash_Container() );
883 ( aOut
+= aDel
) += aImageRotation
.GetSvIdlString( SvHash_ImageRotation() );
887 if( aImageReflection
)
889 ( aOut
+= aDel
) += aImageReflection
.GetSvIdlString( SvHash_ImageReflection() );
895 WriteTab( rOutStm
, nTab
);
896 rOutStm
<< aOut
.GetBuffer() << endl
;
901 /*************************************************************************
902 |* SvMetaSlot::Test()
905 *************************************************************************/
906 sal_Bool
SvMetaSlot::Test( SvIdlDataBase
& rBase
, SvTokenStream
& rInStm
)
908 sal_Bool bOk
= SvMetaAttribute::Test( rBase
, rInStm
);
911 SvMetaType
* pType
= GetType();
912 if( pType
->GetType() == TYPE_METHOD
)
913 pType
= pType
->GetReturnType();
914 if( !pType
->IsItem() )
916 rBase
.SetError( "this attribute is not a slot", rInStm
.GetToken() );
917 rBase
.WriteError( rInStm
);
925 /*************************************************************************
926 |* SvMetaSlot::ReadSvIdl()
929 *************************************************************************/
930 sal_Bool
SvMetaSlot::ReadSvIdl( SvIdlDataBase
& rBase
, SvTokenStream
& rInStm
)
932 sal_uInt32 nTokPos
= rInStm
.Tell();
933 sal_Bool bOk
= sal_True
;
935 SvMetaAttribute
* pAttr
= rBase
.ReadKnownAttr( rInStm
, GetType() );
938 // F"ur Testzwecke: Referenz bei Kurz-Syntax
939 SvMetaSlot
* pKnownSlot
= PTR_CAST( SvMetaSlot
, pAttr
);
942 SetRef( pKnownSlot
);
943 SetName( pKnownSlot
->GetName(), &rBase
);
944 bOk
= SvMetaName::ReadSvIdl( rBase
, rInStm
);
948 ByteString
aStr( "attribute " );
949 aStr
+= pAttr
->GetName();
950 aStr
+= " is method or variable but not a slot";
951 rBase
.SetError( aStr
, rInStm
.GetToken() );
952 rBase
.WriteError( rInStm
);
958 bOk
= SvMetaAttribute::ReadSvIdl( rBase
, rInStm
);
960 SvMetaAttribute
*pAttr2
= rBase
.SearchKnownAttr( GetSlotId() );
963 // F"ur Testzwecke: Referenz bei kompletter Definition
964 SvMetaSlot
* pKnownSlot
= PTR_CAST( SvMetaSlot
, pAttr2
);
967 SetRef( pKnownSlot
);
969 // Namen d"urfen abweichen, da mit angegeben
970 if ( pKnownSlot
->GetName() != GetName() )
972 DBG_ERROR("Illegal definition!");
973 rInStm
.Seek( nTokPos
);
977 SetName( pKnownSlot
->GetName(), &rBase
);
981 ByteString
aStr( "attribute " );
982 aStr
+= pAttr2
->GetName();
983 aStr
+= " is method or variable but not a slot";
984 rBase
.SetError( aStr
, rInStm
.GetToken() );
985 rBase
.WriteError( rInStm
);
992 rInStm
.Seek( nTokPos
);
997 /*************************************************************************
998 |* SvMetaSlot::WriteSvIdl()
1001 *************************************************************************/
1002 void SvMetaSlot::WriteSvIdl( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
1005 SvMetaAttribute::WriteSvIdl( rBase
, rOutStm
, nTab
);
1008 /*************************************************************************
1009 |* SvMetaSlot::Write()
1012 *************************************************************************/
1013 void SvMetaSlot::Write( SvIdlDataBase
& rBase
,
1014 SvStream
& rOutStm
, sal_uInt16 nTab
,
1015 WriteType nT
, WriteAttribute nA
)
1017 if ( nT
== WRITE_DOCU
)
1024 // keine Attribut fuer Automation
1025 if( !GetAutomation() || !GetExport() )
1029 if( !(nA
& WA_VARIABLE
) )
1031 SvMetaAttributeRef xM
= GetMethod();
1034 xM
->SetSlotId( GetSlotId() );
1035 xM
->SetDescription( GetDescription() );
1036 xM
->Write( rBase
, rOutStm
, nTab
, nT
, nA
);
1041 SvMetaAttribute::Write( rBase
, rOutStm
, nTab
, nT
, nA
);
1045 void SvMetaSlot::Insert( SvSlotElementList
& rList
, const ByteString
& rPrefix
,
1046 SvIdlDataBase
& rBase
)
1048 // Einf"ugeposition durch bin"are Suche in der SlotListe ermitteln
1049 sal_uInt16 nId
= (sal_uInt16
) GetSlotId().GetValue();
1050 sal_uInt16 nListCount
= (sal_uInt16
) rList
.Count();
1052 sal_uLong m
; // for inner "for" loop
1056 else if ( nListCount
== 1 )
1057 nPos
= rList
.GetObject(0)->xSlot
->GetSlotId().GetValue() >= nId
? 0 : 1;
1060 sal_uInt16 nMid
= 0, nLow
= 0;
1061 sal_uInt16 nHigh
= nListCount
- 1;
1062 sal_Bool bFound
= sal_False
;
1063 while ( !bFound
&& nLow
<= nHigh
)
1065 nMid
= (nLow
+ nHigh
) >> 1;
1066 DBG_ASSERT( nMid
< nListCount
, "bsearch ist buggy" );
1067 int nDiff
= (int) nId
- (int) rList
.GetObject(nMid
)->xSlot
->GetSlotId().GetValue();
1074 else if ( nDiff
> 0 )
1084 DBG_ASSERT(!bFound
, "Duplicate SlotId!");
1085 nPos
= bFound
? nMid
: nLow
;
1088 DBG_ASSERT( nPos
<= nListCount
,
1090 DBG_ASSERT( nPos
== nListCount
|| nId
<=
1091 (sal_uInt16
) rList
.GetObject(nPos
)->xSlot
->GetSlotId().GetValue(),
1092 "Successor has lower SlotId" );
1093 DBG_ASSERT( nPos
== 0 || nId
>
1094 (sal_uInt16
) rList
.GetObject(nPos
-1)->xSlot
->GetSlotId().GetValue(),
1095 "Predecessor has higher SlotId" );
1096 DBG_ASSERT( nPos
+1 >= nListCount
|| nId
<
1097 (sal_uInt16
) rList
.GetObject(nPos
+1)->xSlot
->GetSlotId().GetValue(),
1098 "Successor has lower SlotId" );
1100 rList
.Insert( new SvSlotElement( this, rPrefix
), nPos
);
1102 // EnumSlots plattklopfen
1103 SvMetaTypeEnum
* pEnum
= NULL
;
1104 SvMetaType
* pBType
= GetType()->GetBaseType();
1105 pEnum
= PTR_CAST( SvMetaTypeEnum
, pBType
);
1106 if( GetPseudoSlots() && pEnum
&& pEnum
->Count() )
1108 // Den MasterSlot clonen
1109 SvMetaSlotRef xEnumSlot
;
1110 SvMetaSlot
*pFirstEnumSlot
= NULL
;
1111 for( sal_uLong n
= 0; n
< pEnum
->Count(); n
++ )
1113 // Die SlotId erzeugen
1114 SvMetaEnumValue
*enumValue
= pEnum
->GetObject(n
);
1115 ByteString aValName
= enumValue
->GetName();
1116 ByteString
aSId( GetSlotId() );
1117 if( GetPseudoPrefix().Len() )
1118 aSId
= GetPseudoPrefix();
1120 aSId
+= aValName
.Copy( pEnum
->GetPrefix().Len() );
1123 for( m
=0; m
<rBase
.GetAttrList().Count(); m
++ )
1125 SvMetaAttribute
* pAttr
= rBase
.GetAttrList().GetObject( m
);
1126 if( pAttr
->GetSlotId() == aSId
)
1128 SvMetaSlot
* pSlot
= PTR_CAST( SvMetaSlot
, pAttr
);
1129 xEnumSlot
= pSlot
->Clone();
1134 if ( m
== rBase
.GetAttrList().Count() )
1136 DBG_ERROR("Invalid EnumSlot!");
1137 xEnumSlot
= Clone();
1139 if ( rBase
.FindId(aSId
, &nValue
) )
1141 SvNumberIdentifier aId
;
1142 *((SvIdentifier
*)&aId
) = aSId
;
1143 aId
.SetValue(nValue
);
1144 xEnumSlot
->SetSlotId(aId
);
1148 // Die Slaves sind kein Master !
1149 xEnumSlot
->aPseudoSlots
= sal_False
;
1150 xEnumSlot
->SetEnumValue(enumValue
);
1152 if ( !pFirstEnumSlot
|| xEnumSlot
->GetSlotId().GetValue() < pFirstEnumSlot
->GetSlotId().GetValue() )
1153 pFirstEnumSlot
= xEnumSlot
;
1155 // Den erzeugten Slave ebenfalls einf"ugen
1156 xEnumSlot
->Insert( rList
, rPrefix
, rBase
);
1158 // Die EnumSlots mit dem Master verketten
1159 xEnumSlot
->pLinkedSlot
= this;
1162 // Master zeigt auf den ersten Slave
1163 pLinkedSlot
= pFirstEnumSlot
;
1165 // Slaves untereinander verketten
1166 rList
.Seek((sal_uLong
)0);
1167 xEnumSlot
= pFirstEnumSlot
;
1168 SvSlotElement
*pEle
;
1171 pEle
= rList
.Next();
1172 if ( pEle
&& pEle
->xSlot
->pLinkedSlot
== this )
1174 xEnumSlot
->pNextSlot
= pEle
->xSlot
;
1175 xEnumSlot
= pEle
->xSlot
;
1179 xEnumSlot
->pNextSlot
= pFirstEnumSlot
;
1184 /*************************************************************************
1185 |* SvMetaSlot::WriteSlotMap()
1188 *************************************************************************/
1189 static ByteString
MakeSlotName( SvStringHashEntry
* pEntry
)
1191 ByteString
aName( "SFX_SLOT_" );
1192 aName
+= pEntry
->GetName();
1193 return aName
.ToUpperAscii();
1196 void SvMetaSlot::WriteSlotStubs( const ByteString
& rShellName
,
1197 ByteStringList
& rList
,
1198 SvStream
& rOutStm
)
1201 ByteString aName = GetName();
1202 SvMetaAttribute * pAttr = rAttrList.First();
1205 if( pAttr->GetName() == aName )
1207 pAttr = rAttrList.Next();
1212 if ( !GetExport() && !GetHidden() )
1215 ByteString
aMethodName( GetExecMethod() );
1216 if ( aMethodName
.Len() && aMethodName
!= "NoExec" )
1218 sal_Bool bIn
= sal_False
;
1219 for( sal_uInt16 n
= 0; n
< rList
.Count(); n
++ )
1221 if( *(rList
.GetObject(n
)) == aMethodName
)
1230 rList
.Insert( new ByteString(aMethodName
), LIST_APPEND
);
1231 rOutStm
<< "SFX_EXEC_STUB("
1232 << rShellName
.GetBuffer()
1234 << aMethodName
.GetBuffer()
1239 aMethodName
= GetStateMethod();
1240 if ( aMethodName
.Len() && aMethodName
!= "NoState" )
1242 sal_Bool bIn
= sal_False
;
1243 for ( sal_uInt16 n
=0; n
< rList
.Count(); n
++ )
1245 if ( *(rList
.GetObject(n
)) == aMethodName
)
1254 rList
.Insert( new ByteString(aMethodName
), LIST_APPEND
);
1255 rOutStm
<< "SFX_STATE_STUB("
1256 << rShellName
.GetBuffer()
1258 << aMethodName
.GetBuffer()
1264 void SvMetaSlot::WriteSlot( const ByteString
& rShellName
, sal_uInt16 nCount
,
1265 const ByteString
& rSlotId
,
1266 SvSlotElementList
& rSlotList
,
1267 const ByteString
& rPrefix
,
1268 SvIdlDataBase
& rBase
, SvStream
& rOutStm
)
1270 if ( !GetExport() && !GetHidden() )
1273 // sal_Bool bIsEnumSlot = 0 != rValueName.Len();
1274 sal_Bool bIsEnumSlot
= 0 != pEnumValue
;
1276 rOutStm
<< "// Slot Nr. " << ByteString::CreateFromInt32(nListPos
).GetBuffer() << " : ";
1277 ByteString
aSlotIdValue( ByteString::CreateFromInt32( GetSlotId().GetValue() ) );
1278 rOutStm
<< aSlotIdValue
.GetBuffer() << endl
;
1279 WriteTab( rOutStm
, 1 );
1281 rOutStm
<< "SFX_NEW_SLOT_ENUM( ";
1283 rOutStm
<< "SFX_NEW_SLOT_ARG( " << rShellName
.GetBuffer() << ',' ;
1285 rOutStm
<< rSlotId
.GetBuffer() << ',';
1286 const SvHelpContext
& rHlpCtx
= GetHelpContext();
1287 if( rHlpCtx
.IsSet() )
1288 rOutStm
<< rHlpCtx
.GetBuffer() << ',';
1290 rOutStm
<< rSlotId
.GetBuffer() << ',';
1293 if( GetGroupId().Len() )
1294 rOutStm
<< GetGroupId().GetBuffer();
1297 rOutStm
<< ',' << endl
;
1298 WriteTab( rOutStm
, 4 );
1302 rOutStm
<< "&a" << rShellName
.GetBuffer() << "Slots_Impl["
1303 << ByteString::CreateFromInt32(pLinkedSlot
->GetListPos()).GetBuffer()
1304 << "] /*Offset Master*/, " << endl
;
1305 WriteTab( rOutStm
, 4 );
1306 rOutStm
<< "&a" << rShellName
.GetBuffer() << "Slots_Impl["
1307 << ByteString::CreateFromInt32(pNextSlot
->GetListPos()).GetBuffer()
1308 << "] /*Offset Next*/, " << endl
;
1310 WriteTab( rOutStm
, 4 );
1313 if( GetSlotId().Len() )
1314 rOutStm
<< pLinkedSlot
->GetSlotId().GetBuffer();
1318 rOutStm
<< pEnumValue
->GetName().GetBuffer();
1322 // Den n"achsten Slot suchen, der die gleiche StateMethod hat wie ich
1323 // Die SlotList ist auf den aktuellen Slot geseekt
1324 SvSlotElement
* pEle
= rSlotList
.Next();
1325 pNextSlot
= pEle
? &pEle
->xSlot
: NULL
;
1328 if ( !pNextSlot
->pNextSlot
&&
1329 pNextSlot
->GetStateMethod() == GetStateMethod() )
1331 pEle
= rSlotList
.Next();
1332 pNextSlot
= pEle
? &pEle
->xSlot
: NULL
;
1337 // Es gibt nach mir keinen Slot mehr, der die gleiche ExecMethode
1338 // hat. Also suche ich den ersten Slot, der diese hatte (das
1339 // k"onnte auch ich selbst sein)
1340 pEle
= rSlotList
.First();
1341 pNextSlot
= pEle
? &pEle
->xSlot
: NULL
;
1342 while ( pNextSlot
!= this )
1344 if ( !pNextSlot
->pEnumValue
&&
1345 pNextSlot
->GetStateMethod() == GetStateMethod() )
1347 pEle
= rSlotList
.Next();
1348 pNextSlot
= pEle
? &pEle
->xSlot
: NULL
;
1358 rOutStm
<< "&a" << rShellName
.GetBuffer() << "Slots_Impl["
1359 << ByteString::CreateFromInt32(pLinkedSlot
->GetListPos()).GetBuffer()
1360 << "] /*Offset Linked*/, " << endl
;
1361 WriteTab( rOutStm
, 4 );
1364 rOutStm
<< "&a" << rShellName
.GetBuffer() << "Slots_Impl["
1365 << ByteString::CreateFromInt32(pNextSlot
->GetListPos()).GetBuffer()
1366 << "] /*Offset Next*/, " << endl
;
1368 WriteTab( rOutStm
, 4 );
1370 // ExecMethod schreiben, wenn nicht angegeben, standard Namen
1371 if( GetExecMethod().Len() && GetExecMethod() != "NoExec")
1372 rOutStm
<< "SFX_STUB_PTR(" << rShellName
.GetBuffer() << ','
1373 << GetExecMethod().GetBuffer() << ')';
1375 rOutStm
<< "SFX_STUB_PTR_EXEC_NONE";
1378 // StateMethod schreiben, wenn nicht angegeben, standard Namen
1379 if( GetStateMethod().Len() && GetStateMethod() != "NoState")
1380 rOutStm
<< "SFX_STUB_PTR(" << rShellName
.GetBuffer() << ','
1381 << GetStateMethod().GetBuffer() << ')';
1383 rOutStm
<< "SFX_STUB_PTR_STATE_NONE";
1385 rOutStm
<< ',' << endl
;
1386 WriteTab( rOutStm
, 4 );
1389 if( GetHasCoreId() )
1390 rOutStm
<< MakeSlotName( SvHash_HasCoreId() ).GetBuffer() << '|';
1392 rOutStm
<< MakeSlotName( SvHash_Cachable() ).GetBuffer() << '|';
1394 rOutStm
<< MakeSlotName( SvHash_Volatile() ).GetBuffer() << '|';
1396 rOutStm
<< MakeSlotName( SvHash_Toggle() ).GetBuffer() << '|';
1397 if( GetAutoUpdate() )
1398 rOutStm
<< MakeSlotName( SvHash_AutoUpdate() ).GetBuffer() << '|';
1400 rOutStm
<< MakeSlotName( SvHash_Synchron() ).GetBuffer() << '|';
1401 if( GetAsynchron() )
1402 rOutStm
<< MakeSlotName( SvHash_Asynchron() ).GetBuffer() << '|';
1403 if( GetRecordPerItem() )
1404 rOutStm
<< MakeSlotName( SvHash_RecordPerItem() ).GetBuffer() << '|';
1405 if( GetRecordPerSet() )
1406 rOutStm
<< MakeSlotName( SvHash_RecordPerSet() ).GetBuffer() << '|';
1407 if( GetRecordManual() )
1408 rOutStm
<< MakeSlotName( SvHash_RecordManual() ).GetBuffer() << '|';
1410 rOutStm
<< MakeSlotName( SvHash_NoRecord() ).GetBuffer() << '|';
1411 if( GetRecordAbsolute() )
1412 rOutStm
<< MakeSlotName( SvHash_RecordAbsolute() ).GetBuffer() << '|';
1413 if( GetHasDialog() )
1414 rOutStm
<< MakeSlotName( SvHash_HasDialog() ).GetBuffer() << '|';
1415 if( GetMenuConfig() )
1416 rOutStm
<< MakeSlotName( SvHash_MenuConfig() ).GetBuffer() << '|';
1417 if( GetToolBoxConfig() )
1418 rOutStm
<< MakeSlotName( SvHash_ToolBoxConfig() ).GetBuffer() << '|';
1419 if( GetStatusBarConfig() )
1420 rOutStm
<< MakeSlotName( SvHash_StatusBarConfig() ).GetBuffer() << '|';
1421 if( GetAccelConfig() )
1422 rOutStm
<< MakeSlotName( SvHash_AccelConfig() ).GetBuffer() << '|';
1424 rOutStm
<< MakeSlotName( SvHash_FastCall() ).GetBuffer() << '|';
1425 if( GetContainer() )
1426 rOutStm
<< MakeSlotName( SvHash_Container() ).GetBuffer() << '|';
1427 if ( GetReadOnlyDoc() )
1428 rOutStm
<< MakeSlotName( SvHash_ReadOnlyDoc() ).GetBuffer() << '|';
1429 if( GetImageRotation() )
1430 rOutStm
<< MakeSlotName( SvHash_ImageRotation() ).GetBuffer() << '|';
1431 if( GetImageReflection() )
1432 rOutStm
<< MakeSlotName( SvHash_ImageReflection() ).GetBuffer() << '|';
1435 rOutStm
<< ',' << endl
;
1436 WriteTab( rOutStm
, 4 );
1437 if ( !GetDisableFlags().Len() )
1440 rOutStm
<< GetDisableFlags().GetBuffer();
1442 // Attribut Typ schreiben
1445 rOutStm
<< ',' << endl
;
1446 WriteTab( rOutStm
, 4 );
1448 SvMetaType
* pT
= GetSlotType();
1452 pT
= rBase
.FindType( "SfxVoidItem" );
1458 rOutStm
<< pT
->GetName().GetBuffer();
1459 if( !rBase
.FindType( pT
, rBase
.aUsedTypes
) )
1460 rBase
.aUsedTypes
.Append( pT
);
1463 rOutStm
<< "SfxVoidItem not defined";
1467 SvMetaType
*pT
= rBase
.FindType( "SfxBoolItem" );
1468 if ( pT
&& !rBase
.FindType( pT
, rBase
.aUsedTypes
) )
1469 rBase
.aUsedTypes
.Append( pT
);
1474 rOutStm
<< ',' << endl
;
1475 WriteTab( rOutStm
, 4 );
1476 rOutStm
<< ByteString::CreateFromInt32( nCount
).GetBuffer() << "/*Offset*/, ";
1480 SvMetaAttribute
* pMethod
= GetMethod();
1483 pType
= pMethod
->GetType();
1486 sal_uLong nSCount
= pType
->GetAttrCount();
1487 rOutStm
<< ByteString::CreateFromInt32( nSCount
).GetBuffer() << "/*Count*/";
1492 // Name f"urs Recording
1497 rOutStm
<< rPrefix
.GetBuffer();
1499 if ( !IsVariable() || !GetType() ||
1500 GetType()->GetBaseType()->GetType() != TYPE_STRUCT
)
1501 rOutStm
<< GetMangleName( sal_False
).GetBuffer();
1507 // Method/Property Flags
1509 rOutStm
<< "SFX_SLOT_METHOD|";
1512 rOutStm
<< "SFX_SLOT_PROPGET|";
1513 if( !GetReadonly() )
1514 rOutStm
<< "SFX_SLOT_PROPSET|";
1520 // if ( GetUnoName().Len() )
1523 rOutStm
<< GetMangleName( sal_False
).GetBuffer();
1524 //rOutStm << GetUnoName().GetBuffer();
1528 // rOutStm << ", 0";
1530 rOutStm
<< " )," << endl
;
1533 sal_uInt16
SvMetaSlot::WriteSlotParamArray( SvIdlDataBase
& rBase
, SvStream
& rOutStm
)
1535 if ( !GetExport() && !GetHidden() )
1538 SvMetaAttribute
* pMethod
= GetMethod();
1543 pType
= pMethod
->GetType();
1547 if( !rBase
.FindType( pType
, rBase
.aUsedTypes
) )
1548 rBase
.aUsedTypes
.Append( pType
);
1550 const SvMetaAttributeMemberList
& rList
=
1551 pType
->GetAttrList();
1552 for( sal_uLong n
= 0; n
< rList
.Count(); n
++ )
1554 SvMetaAttribute
* pPar
= rList
.GetObject( n
);
1555 SvMetaType
* pPType
= pPar
->GetType();
1556 WriteTab( rOutStm
, 1 );
1557 rOutStm
<< "SFX_ARGUMENT("
1558 << pPar
->GetSlotId().GetBuffer() << ',' // SlodId
1560 << "\"" << pPar
->GetName().GetBuffer() << "\","
1562 << pPType
->GetName().GetBuffer() << ")," << endl
;
1563 if( !rBase
.FindType( pPType
, rBase
.aUsedTypes
) )
1564 rBase
.aUsedTypes
.Append( pPType
);
1566 return (sal_uInt16
)rList
.Count();
1571 sal_uInt16
SvMetaSlot::WriteSlotMap( const ByteString
& rShellName
, sal_uInt16 nCount
,
1572 SvSlotElementList
& rSlotList
,
1573 const ByteString
& rPrefix
,
1574 SvIdlDataBase
& rBase
,
1575 SvStream
& rOutStm
)
1577 // SlotId, wenn nicht angegeben, aus Namen generieren
1578 ByteString slotId
= GetSlotId();
1580 sal_uInt16 nSCount
= 0;
1584 SvMetaAttribute
* pMethod
= GetMethod();
1586 pType
= pMethod
->GetType();
1590 nSCount
= (sal_uInt16
)pType
->GetAttrCount();
1593 WriteSlot( rShellName
, nCount
, slotId
, rSlotList
, rPrefix
, rBase
, rOutStm
);
1597 /*************************************************************************
1598 |* SvMetaSlot::WriteSrc()
1599 *************************************************************************/
1600 void SvMetaSlot::WriteSrc( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
1603 if (!GetToolBoxConfig() && !GetAccelConfig() && !GetMenuConfig() && !GetStatusBarConfig() )
1606 sal_uLong nSId
= GetSlotId().GetValue();
1607 if( !pTable
->IsKeyValid( nSId
) )
1609 pTable
->Insert( nSId
, this );
1610 rOutStm
<< "SfxSlotInfo " << ByteString::CreateFromInt32( nSId
).GetBuffer()
1611 << endl
<< '{' << endl
;
1613 WriteTab( rOutStm
, 1 );
1614 ByteString aStr
= GetConfigName();
1618 rOutStm
<< "SlotName = \"" << aStr
.GetBuffer() << "\";" << endl
;
1620 aStr
= GetHelpText();
1623 WriteTab( rOutStm
, 1 );
1624 rOutStm
<< "HelpText = \"" << aStr
.GetBuffer() << "\";" << endl
;
1627 rOutStm
<< "};" << endl
;
1630 SvMetaTypeEnum
* pEnum
= PTR_CAST( SvMetaTypeEnum
, GetType() );
1631 if( GetPseudoSlots() && pEnum
)
1633 for( sal_uLong n
= 0; n
< pEnum
->Count(); n
++ )
1635 ByteString aValName
= pEnum
->GetObject( n
)->GetName();
1636 ByteString
aSId( GetSlotId() );
1637 if( GetPseudoPrefix().Len() )
1638 aSId
= GetPseudoPrefix();
1640 aSId
+= aValName
.Copy( pEnum
->GetPrefix().Len() );
1643 sal_Bool bIdOk
= sal_False
;
1644 if( rBase
.FindId( aSId
, &nSId2
) )
1646 aSId
= ByteString::CreateFromInt32( nSId2
);
1650 // wenn Id nicht gefunden, immer schreiben
1651 if( !bIdOk
|| !pTable
->IsKeyValid( nSId2
) )
1653 pTable
->Insert( nSId2
, this );
1654 rOutStm
<< "SfxSlotInfo " << aSId
.GetBuffer()
1655 << endl
<< '{' << endl
;
1657 WriteTab( rOutStm
, 1 );
1658 rOutStm
<< "SlotName = \"" << aValName
.GetBuffer() << "\";" << endl
;
1660 ByteString aStr
= GetHelpText();
1663 WriteTab( rOutStm
, 1 );
1664 rOutStm
<< "HelpText = \"" << aStr
.GetBuffer() << "\";" << endl
;
1666 rOutStm
<< "};" << endl
;
1672 void SvMetaSlot::WriteHelpId( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
1675 sal_uLong nSId
= GetSlotId().GetValue();
1676 if( !pTable
->IsKeyValid( nSId
) )
1678 pTable
->Insert( nSId
, this );
1679 rOutStm
<< "#define " << GetSlotId().GetBuffer() << '\t' << ByteString::CreateFromInt32( nSId
).GetBuffer() << endl
;
1682 SvMetaTypeEnum
* pEnum
= PTR_CAST( SvMetaTypeEnum
, GetType() );
1683 if( GetPseudoSlots() && pEnum
)
1685 for( sal_uLong n
= 0; n
< pEnum
->Count(); n
++ )
1687 ByteString aValName
= pEnum
->GetObject( n
)->GetName();
1688 ByteString
aSId( GetSlotId() );
1689 if( GetPseudoPrefix().Len() )
1690 aSId
= GetPseudoPrefix();
1692 aSId
+= aValName
.Copy( pEnum
->GetPrefix().Len() );
1695 sal_Bool bIdOk
= sal_False
;
1696 if( rBase
.FindId( aSId
, &nSId2
) )
1698 aSId
= ByteString::CreateFromInt32( nSId2
);
1702 // wenn Id nicht gefunden, immer schreiben
1703 if( !bIdOk
|| !pTable
->IsKeyValid( nSId2
) )
1705 pTable
->Insert( nSId2
, this );
1707 rOutStm
<< "#define " << aSId
.GetBuffer() << '\t'
1708 << ByteString::CreateFromInt32( nSId2
).GetBuffer() << endl
;
1714 void WriteBool( sal_Bool bSet
, SvStream
& rStream
)
1717 rStream
<< "sal_True" << ',';
1719 rStream
<< "sal_False" << ',';
1722 void SvMetaSlot::WriteCSV( SvIdlDataBase
& rBase
, SvStream
& rStrm
)
1724 rStrm
<< "PROJECT,";
1725 rStrm
<< GetSlotId().GetBuffer() << ',';
1726 rStrm
<< ByteString::CreateFromInt32( GetSlotId().GetValue() ).GetBuffer() << ',';
1728 if ( GetPseudoPrefix().Len() )
1729 rStrm
<< GetPseudoPrefix().GetBuffer() << ',';
1733 rStrm
<< GetGroupId().GetBuffer() << ',';
1735 WriteBool( GetAccelConfig(), rStrm
);
1736 WriteBool( GetMenuConfig(), rStrm
);
1737 WriteBool( GetStatusBarConfig(), rStrm
);
1738 WriteBool( GetToolBoxConfig(), rStrm
);
1740 if ( GetSlotType() )
1741 rStrm
<< GetSlotType()->GetName().GetBuffer() << ',';
1745 WriteBool( GetAutoUpdate(), rStrm
);
1746 if ( GetCachable() )
1747 rStrm
<< "Cachable" << ',';
1749 rStrm
<< "Volatile" << ',';
1751 WriteBool( GetContainer(), rStrm
);
1752 WriteBool( GetFastCall(), rStrm
);
1753 WriteBool( GetHasCoreId(), rStrm
);
1754 WriteBool( GetHasDialog(), rStrm
);
1755 WriteBool( GetReadOnlyDoc(), rStrm
);
1756 WriteBool( GetImageRotation(), rStrm
);
1757 WriteBool( GetImageReflection(), rStrm
);
1758 rStrm
<< GetDisableFlags().GetBuffer() << ',';
1761 rStrm
<< "Synchron" << ',';
1763 rStrm
<< "Asynchron" << ',';
1765 WriteBool( GetToggle(), rStrm
);
1766 WriteBool( GetReadonly(), rStrm
);
1767 WriteBool( GetExport(), rStrm
);
1768 if( GetRecordPerItem() )
1769 rStrm
<< "RecordPerItem" << ',';
1770 else if ( GetNoRecord() )
1771 rStrm
<< "NoRecord" << ',';
1772 else if ( GetRecordManual() )
1773 rStrm
<< "RecordManual" << ',';
1775 rStrm
<< "RecordPerSet" << ',';
1777 WriteBool( GetRecordAbsolute(), rStrm
);
1779 if ( GetType()->GetType() != TYPE_METHOD
&& GetMethod() )
1781 rStrm
<< GetMethod()->GetType()->GetReturnType()->GetName().GetBuffer() << ',';
1782 rStrm
<< GetMethod()->GetName().GetBuffer() << ',';
1789 rStrm
<< GetType()->GetSvName().GetBuffer() << ',';
1790 rStrm
<< GetName().GetBuffer() << ',';
1792 if ( GetType()->GetType() == TYPE_METHOD
|| GetMethod() )
1794 SvMetaAttributeMemberList
*pList
= &GetType()->GetAttrList();
1796 pList
= &GetMethod()->GetType()->GetAttrList();
1798 if( pList
&& pList
->Count() )
1801 SvMetaAttribute
* pAttr
= pList
->First();
1804 pAttr
->WriteCSV( rBase
, rStrm
);
1805 pAttr
= pList
->Next();
1818 #endif // IDL_COMPILER