1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: slot.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_idl.hxx"
36 #include <tools/debug.hxx>
39 #include <globals.hxx>
40 #include <database.hxx>
42 /****************** SvMetaSlot *****************************************/
43 SV_IMPL_META_FACTORY1( SvMetaSlot
, SvMetaAttribute
);
45 SvMetaObject
*SvMetaSlot::MakeClone() const
47 return new SvMetaSlot( *this );
50 /*************************************************************************
51 |* SvMetaSlot::SvMetaSlot()
53 |* Beschreibung Zweites FALSE bei den SvBOOL-Objekten bedeutet,
54 |* IsSet() liefert FALSE (Defaultinitialisierung).
55 *************************************************************************/
56 SvMetaSlot::SvMetaSlot()
57 : aCachable( TRUE
, FALSE
)
58 , aSynchron( TRUE
, FALSE
)
59 , aRecordPerSet( TRUE
, FALSE
)
60 , aRecordAbsolute( FALSE
, FALSE
)
67 SvMetaSlot::SvMetaSlot( SvMetaType
* pType
)
68 : SvMetaAttribute( pType
)
69 , aCachable( TRUE
, FALSE
)
70 , aSynchron( TRUE
, FALSE
)
71 , aRecordPerSet( TRUE
, FALSE
)
72 , aRecordAbsolute( FALSE
, FALSE
)
84 DBG_ASSERT( nPos +4 == rStm.Tell(), "stream pos error" ); \
88 rStm << (UINT32)rStm.Tell();
93 void SvMetaSlot::Load( SvPersistStream
& rStm
)
95 SvMetaAttribute::Load( rStm
);
103 SvMetaAttribute
* pMeth
;
109 if( nMask
& 0x0002 ) rStm
>> aGroupId
;
111 if( nMask
& 0x0004 ) rStm
>> aHasCoreId
;
113 if( nMask
& 0x0008 ) rStm
>> aConfigId
;
115 if( nMask
& 0x0010 ) rStm
>> aExecMethod
;
117 if( nMask
& 0x0020 ) rStm
>> aStateMethod
;
119 if( nMask
& 0x0040 ) rStm
>> aDefault
;
121 if( nMask
& 0x0080 ) rStm
>> aPseudoSlots
;
123 if( nMask
& 0x0100 ) rStm
>> aGet
;
125 if( nMask
& 0x0200 ) rStm
>> aSet
;
127 if( nMask
& 0x0400 ) rStm
>> aCachable
;
129 if( nMask
& 0x0800 ) rStm
>> aVolatile
;
131 if( nMask
& 0x1000 ) rStm
>> aToggle
;
133 if( nMask
& 0x2000 ) rStm
>> aAutoUpdate
;
135 if( nMask
& 0x4000 ) rStm
>> aSynchron
;
137 if( nMask
& 0x8000 ) rStm
>> aAsynchron
;
143 if( nMask
& 0x0001 ) rStm
>> aRecordPerItem
;
145 if( nMask
& 0x0002 ) rStm
>> aRecordManual
;
147 if( nMask
& 0x0004 ) rStm
>> aNoRecord
;
149 if( nMask
& 0x0008 ) rStm
>> aHasDialog
;
151 if( nMask
& 0x0010 ) rStm
>> aDisableFlags
;
153 if( nMask
& 0x0020 ) rStm
>> aPseudoPrefix
;
155 if( nMask
& 0x0040 ) rStm
>> aRecordPerSet
;
157 if( nMask
& 0x0080 ) rStm
>> aMenuConfig
;
159 if( nMask
& 0x0100 ) rStm
>> aToolBoxConfig
;
161 if( nMask
& 0x0200 ) rStm
>> aStatusBarConfig
;
163 if( nMask
& 0x0400 ) rStm
>> aAccelConfig
;
165 if( nMask
& 0x0800 ) rStm
>> aFastCall
;
167 if( nMask
& 0x1000 ) rStm
>> aContainer
;
178 if( nMask
& 0x4000 ) rStm
>> aRecordAbsolute
;
180 if( nMask
& 0x8000 ) rStm
>> aImageRotation
;
186 if( nMask
& 0x0001 ) rStm
>> aUnoName
;
187 if( nMask
& 0x0002 ) rStm
>> aImageReflection
;
190 void SvMetaSlot::Save( SvPersistStream
& rStm
)
192 SvMetaAttribute::Save( rStm
);
196 if( aMethod
.Is() ) nMask
|= 0x0001;
197 if( aGroupId
.Len() ) nMask
|= 0x0002;
198 if( aHasCoreId
.IsSet() ) nMask
|= 0x0004;
199 if( aConfigId
.Len() ) nMask
|= 0x0008;
200 if( aExecMethod
.Len() ) nMask
|= 0x0010;
201 if( aStateMethod
.Len() ) nMask
|= 0x0020;
202 if( aDefault
.Len() ) nMask
|= 0x0040;
203 if( aPseudoSlots
.IsSet() ) nMask
|= 0x0080;
204 if( aGet
.IsSet() ) nMask
|= 0x0100;
205 if( aSet
.IsSet() ) nMask
|= 0x0200;
206 if( aCachable
.IsSet() ) nMask
|= 0x0400;
207 if( aVolatile
.IsSet() ) nMask
|= 0x0800;
208 if( aToggle
.IsSet() ) nMask
|= 0x1000;
209 if( aAutoUpdate
.IsSet() ) nMask
|= 0x2000;
210 if( aSynchron
.IsSet() ) nMask
|= 0x4000;
211 if( aAsynchron
.IsSet() ) nMask
|= 0x8000;
216 if( nMask
& 0x0001 ) rStm
<< aMethod
;
218 if( nMask
& 0x0002 ) rStm
<< aGroupId
;
220 if( nMask
& 0x0004 ) rStm
<< aHasCoreId
;
222 if( nMask
& 0x0008 ) rStm
<< aConfigId
;
224 if( nMask
& 0x0010 ) rStm
<< aExecMethod
;
226 if( nMask
& 0x0020 ) rStm
<< aStateMethod
;
228 if( nMask
& 0x0040 ) rStm
<< aDefault
;
230 if( nMask
& 0x0080 ) rStm
<< aPseudoSlots
;
232 if( nMask
& 0x0100 ) rStm
<< aGet
;
234 if( nMask
& 0x0200 ) rStm
<< aSet
;
236 if( nMask
& 0x0400 ) rStm
<< aCachable
;
238 if( nMask
& 0x0800 ) rStm
<< aVolatile
;
240 if( nMask
& 0x1000 ) rStm
<< aToggle
;
242 if( nMask
& 0x2000 ) rStm
<< aAutoUpdate
;
244 if( nMask
& 0x4000 ) rStm
<< aSynchron
;
246 if( nMask
& 0x8000 ) rStm
<< aAsynchron
;
248 // naechste Fuhre schreiben
251 if( aRecordPerItem
.IsSet() ) nMask
|= 0x0001;
252 if( aRecordManual
.IsSet() ) nMask
|= 0x0002;
253 if( aNoRecord
.IsSet() ) nMask
|= 0x0004;
254 if( aHasDialog
.IsSet() ) nMask
|= 0x0008;
255 if ( aDisableFlags
.IsSet() ) nMask
|= 0x0010;
256 if( aPseudoPrefix
.Len() ) nMask
|= 0x0020;
257 if( aRecordPerSet
.IsSet() ) nMask
|= 0x0040;
258 if( aMenuConfig
.IsSet() ) nMask
|= 0x0080;
259 if( aToolBoxConfig
.IsSet() ) nMask
|= 0x0100;
260 if( aStatusBarConfig
.IsSet() )nMask
|= 0x0200;
261 if( aAccelConfig
.IsSet() ) nMask
|= 0x0400;
262 if( aFastCall
.IsSet() ) nMask
|= 0x0800;
263 if( aContainer
.IsSet() ) nMask
|= 0x1000;
264 if( aSlotType
.Is() ) nMask
|= 0x2000;
265 if( aRecordAbsolute
.IsSet() ) nMask
|= 0x4000;
266 if( aImageRotation
.IsSet() ) nMask
|= 0x8000;
271 if( nMask
& 0x0001 ) rStm
<< aRecordPerItem
;
273 if( nMask
& 0x0002 ) rStm
<< aRecordManual
;
275 if( nMask
& 0x0004 ) rStm
<< aNoRecord
;
277 if( nMask
& 0x0008 ) rStm
<< aHasDialog
;
279 if( nMask
& 0x0010 ) rStm
<< aDisableFlags
;
281 if( nMask
& 0x0020 ) rStm
<< aPseudoPrefix
;
283 if( nMask
& 0x0040 ) rStm
<< aRecordPerSet
;
285 if( nMask
& 0x0080 ) rStm
<< aMenuConfig
;
287 if( nMask
& 0x0100 ) rStm
<< aToolBoxConfig
;
289 if( nMask
& 0x0200 ) rStm
<< aStatusBarConfig
;
291 if( nMask
& 0x0400 ) rStm
<< aAccelConfig
;
293 if( nMask
& 0x0800 ) rStm
<< aFastCall
;
295 if( nMask
& 0x1000 ) rStm
<< aContainer
;
297 if( nMask
& 0x2000 ) rStm
<< aSlotType
;
299 if( nMask
& 0x4000 ) rStm
<< aRecordAbsolute
;
301 if( nMask
& 0x8000 ) rStm
<< aImageRotation
;
304 if( aUnoName
.IsSet() ) nMask
|= 0x0001;
305 if( aImageReflection
.IsSet() ) nMask
|= 0x0002;
308 if( nMask
& 0x0001 ) rStm
<< aUnoName
;
310 if( nMask
& 0x0002 ) rStm
<< aImageReflection
;
313 /*************************************************************************
314 |* SvMetaSlot::IsVariable()
317 *************************************************************************/
318 BOOL
SvMetaSlot::IsVariable() const
320 return SvMetaAttribute::IsVariable();
323 /*************************************************************************
324 |* SvMetaSlot::IsMethod()
327 *************************************************************************/
328 BOOL
SvMetaSlot::IsMethod() const
330 BOOL b
= SvMetaAttribute::IsMethod();
331 b
|= NULL
!= GetMethod();
335 /*************************************************************************
336 |* SvMetaSlot::HasMethods()
339 *************************************************************************/
340 ByteString
SvMetaSlot::GetMangleName( BOOL bVariable
) const
344 SvMetaAttribute
* pMeth
= GetMethod();
346 return pMeth
->GetName();
351 /*************************************************************************
354 |* Beschreibung Zweites FALSE bei den SvBOOL-Objekten bedeutet,
355 |* IsSet() liefert FALSE (Defaultinitialisierung).
356 *************************************************************************/
357 /** Referenz Aufloesung **/
358 SvMetaType
* SvMetaSlot::GetSlotType() const
360 if( aSlotType
.Is() || !GetRef() ) return aSlotType
;
361 return ((SvMetaSlot
*)GetRef())->GetSlotType();
363 SvMetaAttribute
* SvMetaSlot::GetMethod() const
365 if( aMethod
.Is() || !GetRef() ) return aMethod
;
366 return ((SvMetaSlot
*)GetRef())->GetMethod();
368 BOOL
SvMetaSlot::GetHasCoreId() const
370 if( aHasCoreId
.IsSet() || !GetRef() ) return aHasCoreId
;
371 return ((SvMetaSlot
*)GetRef())->GetHasCoreId();
373 const ByteString
& SvMetaSlot::GetGroupId() const
375 if( aGroupId
.Len() || !GetRef() ) return aGroupId
;
376 return ((SvMetaSlot
*)GetRef())->GetGroupId();
378 const ByteString
& SvMetaSlot::GetDisableFlags() const
380 if( aDisableFlags
.Len() || !GetRef() ) return aDisableFlags
;
381 return ((SvMetaSlot
*)GetRef())->GetDisableFlags();
383 const ByteString
& SvMetaSlot::GetConfigId() const
385 if( aConfigId
.Len() || !GetRef() ) return aConfigId
;
386 return ((SvMetaSlot
*)GetRef())->GetConfigId();
388 const ByteString
& SvMetaSlot::GetExecMethod() const
390 if( aExecMethod
.Len() || !GetRef() ) return aExecMethod
;
391 return ((SvMetaSlot
*)GetRef())->GetExecMethod();
393 const ByteString
& SvMetaSlot::GetStateMethod() const
395 if( aStateMethod
.Len() || !GetRef() ) return aStateMethod
;
396 return ((SvMetaSlot
*)GetRef())->GetStateMethod();
398 const ByteString
& SvMetaSlot::GetDefault() const
400 if( aDefault
.Len() || !GetRef() ) return aDefault
;
401 return ((SvMetaSlot
*)GetRef())->GetDefault();
403 BOOL
SvMetaSlot::GetPseudoSlots() const
405 if( aPseudoSlots
.IsSet() || !GetRef() ) return aPseudoSlots
;
406 return ((SvMetaSlot
*)GetRef())->GetPseudoSlots();
409 BOOL SvMetaSlot::GetGet() const
411 if( aGet.IsSet() || !GetRef() ) return aGet;
412 return ((SvMetaSlot *)GetRef())->GetGet();
414 BOOL SvMetaSlot::GetSet() const
416 if( aSet.IsSet() || !GetRef() ) return aSet;
417 return ((SvMetaSlot *)GetRef())->GetSet();
420 BOOL
SvMetaSlot::GetCachable() const
422 // Cachable und Volatile sind exclusiv
423 if( !GetRef() || aCachable
.IsSet() || aVolatile
.IsSet() )
425 return ((SvMetaSlot
*)GetRef())->GetCachable();
427 BOOL
SvMetaSlot::GetVolatile() const
429 // Cachable und Volatile sind exclusiv
430 if( !GetRef() || aVolatile
.IsSet() || aCachable
.IsSet() )
432 return ((SvMetaSlot
*)GetRef())->GetVolatile();
434 BOOL
SvMetaSlot::GetToggle() const
436 if( aToggle
.IsSet() || !GetRef() ) return aToggle
;
437 return ((SvMetaSlot
*)GetRef())->GetToggle();
439 BOOL
SvMetaSlot::GetAutoUpdate() const
441 if( aAutoUpdate
.IsSet() || !GetRef() ) return aAutoUpdate
;
442 return ((SvMetaSlot
*)GetRef())->GetAutoUpdate();
444 BOOL
SvMetaSlot::GetSynchron() const
446 // Synchron und Asynchron sind exclusiv
447 if( !GetRef() || aSynchron
.IsSet() || aAsynchron
.IsSet() )
449 return ((SvMetaSlot
*)GetRef())->GetSynchron();
451 BOOL
SvMetaSlot::GetAsynchron() const
453 // Synchron und Asynchron sind exclusiv
454 if( !GetRef() || aAsynchron
.IsSet() || aSynchron
.IsSet() )
456 return ((SvMetaSlot
*)GetRef())->GetAsynchron();
458 BOOL
SvMetaSlot::GetRecordPerItem() const
460 // Record- PerItem, No, PerSet und Manual sind exclusiv
461 if( !GetRef() || aRecordPerItem
.IsSet() || aNoRecord
.IsSet()
462 || aRecordPerSet
.IsSet() || aRecordManual
.IsSet() )
463 return aRecordPerItem
;
464 return ((SvMetaSlot
*)GetRef())->GetRecordPerItem();
466 BOOL
SvMetaSlot::GetRecordPerSet() const
468 // Record- PerItem, No, PerSet und Manual sind exclusiv
469 if( !GetRef() || aRecordPerItem
.IsSet() || aNoRecord
.IsSet()
470 || aRecordPerSet
.IsSet() || aRecordManual
.IsSet() )
471 return aRecordPerSet
;
472 return ((SvMetaSlot
*)GetRef())->GetRecordPerSet();
474 BOOL
SvMetaSlot::GetRecordManual() const
476 // Record- PerItem, No, PerSet und Manual sind exclusiv
477 if( !GetRef() || aRecordPerItem
.IsSet() || aNoRecord
.IsSet()
478 || aRecordPerSet
.IsSet() || aRecordManual
.IsSet() )
479 return aRecordManual
;
480 return ((SvMetaSlot
*)GetRef())->GetRecordManual();
482 BOOL
SvMetaSlot::GetNoRecord() const
484 // Record- PerItem, No, PerSet und Manual sind exclusiv
485 if( !GetRef() || aRecordPerItem
.IsSet() || aNoRecord
.IsSet()
486 || aRecordPerSet
.IsSet() || aRecordManual
.IsSet() )
488 return ((SvMetaSlot
*)GetRef())->GetNoRecord();
490 BOOL
SvMetaSlot::GetRecordAbsolute() const
492 if( !GetRef() || aRecordAbsolute
.IsSet() )
493 return aRecordAbsolute
;
494 return ((SvMetaSlot
*)GetRef())->GetRecordAbsolute();
496 BOOL
SvMetaSlot::GetHasDialog() const
498 if( aHasDialog
.IsSet() || !GetRef() ) return aHasDialog
;
499 return ((SvMetaSlot
*)GetRef())->GetHasDialog();
501 const ByteString
& SvMetaSlot::GetPseudoPrefix() const
503 if( aPseudoPrefix
.Len() || !GetRef() ) return aPseudoPrefix
;
504 return ((SvMetaSlot
*)GetRef())->GetPseudoPrefix();
506 BOOL
SvMetaSlot::GetMenuConfig() const
508 if( aMenuConfig
.IsSet() || !GetRef() ) return aMenuConfig
;
509 return ((SvMetaSlot
*)GetRef())->GetMenuConfig();
511 BOOL
SvMetaSlot::GetToolBoxConfig() const
513 if( aToolBoxConfig
.IsSet() || !GetRef() ) return aToolBoxConfig
;
514 return ((SvMetaSlot
*)GetRef())->GetToolBoxConfig();
516 BOOL
SvMetaSlot::GetStatusBarConfig() const
518 if( aStatusBarConfig
.IsSet() || !GetRef() ) return aStatusBarConfig
;
519 return ((SvMetaSlot
*)GetRef())->GetStatusBarConfig();
521 BOOL
SvMetaSlot::GetAccelConfig() const
523 if( aAccelConfig
.IsSet() || !GetRef() ) return aAccelConfig
;
524 return ((SvMetaSlot
*)GetRef())->GetAccelConfig();
526 BOOL
SvMetaSlot::GetFastCall() const
528 if( aFastCall
.IsSet() || !GetRef() ) return aFastCall
;
529 return ((SvMetaSlot
*)GetRef())->GetFastCall();
531 BOOL
SvMetaSlot::GetContainer() const
533 if( aContainer
.IsSet() || !GetRef() ) return aContainer
;
534 return ((SvMetaSlot
*)GetRef())->GetContainer();
537 BOOL
SvMetaSlot::GetImageRotation() const
539 if( aImageRotation
.IsSet() || !GetRef() ) return aImageRotation
;
540 return ((SvMetaSlot
*)GetRef())->GetImageRotation();
543 BOOL
SvMetaSlot::GetImageReflection() const
545 if( aImageReflection
.IsSet() || !GetRef() ) return aImageReflection
;
546 return ((SvMetaSlot
*)GetRef())->GetImageReflection();
549 const ByteString
& SvMetaSlot::GetUnoName() const
551 if( aUnoName
.IsSet() || !GetRef() ) return aUnoName
;
552 return ((SvMetaSlot
*)GetRef())->GetUnoName();
555 /*************************************************************************
556 |* SvMetaSlot::FillSbxObject()
559 *************************************************************************/
561 void SvMetaSlot::FillSbxObject( SvIdlDataBase & rBase, SbxObject * pObj,
564 // keine Attribut fuer Automation
565 if( !GetAutomation() || !GetExport() )
570 SvMetaAttributeRef xM = GetMethod();
573 SvMetaType * pType = xM->GetType();
574 SvMetaType * pRetBaseType = pType->GetReturnType()->GetBaseType();
575 ByteString aName = xM->GetName();
577 SbxMethodRef xMeth = new SbxMethod( aName,
578 pRetBaseType->GetSbxDataType() );
579 pType->FillSbxObject( xMeth, bVariable );
580 xMeth->SetUserData( MakeSlotValue(rBase, FALSE) );
582 pObj->Insert( &xMeth );
587 SvMetaAttribute::FillSbxObject( rBase, pObj, bVariable );
592 /*************************************************************************
593 |* SvMetaSlot::ReadAttributesSvIdl()
596 *************************************************************************/
597 void SvMetaSlot::ReadAttributesSvIdl( SvIdlDataBase
& rBase
,
598 SvTokenStream
& rInStm
)
600 SvMetaAttribute::ReadAttributesSvIdl( rBase
, rInStm
);
603 bOk
|= aDefault
.ReadSvIdl( SvHash_Default(), rInStm
);
604 bOk
|= aPseudoSlots
.ReadSvIdl( SvHash_PseudoSlots(), rInStm
);
605 bOk
|= aHasCoreId
.ReadSvIdl( SvHash_HasCoreId(), rInStm
);
606 bOk
|= aGroupId
.ReadSvIdl( SvHash_GroupId(), rInStm
);
607 bOk
|= aExecMethod
.ReadSvIdl( SvHash_ExecMethod(), rInStm
);
608 bOk
|= aStateMethod
.ReadSvIdl( SvHash_StateMethod(), rInStm
);
609 bOk
|= aDisableFlags
.ReadSvIdl( SvHash_DisableFlags(), rInStm
);
610 if( aGet
.ReadSvIdl( SvHash_Get(), rInStm
) )
612 rBase
.WriteError( "warning", ByteString( rInStm
.GetFileName(), RTL_TEXTENCODING_UTF8
),
613 "<Get> old style, use Readonly",
614 rInStm
.GetToken()->GetLine(),
615 rInStm
.GetToken()->GetColumn() );
617 if( aSet
.ReadSvIdl( SvHash_Set(), rInStm
) )
619 rBase
.WriteError( "warning", ByteString( rInStm
.GetFileName(), RTL_TEXTENCODING_UTF8
),
620 "<Set> old style, use method declaration",
621 rInStm
.GetToken()->GetLine(),
622 rInStm
.GetToken()->GetColumn() );
625 if( aCachable
.ReadSvIdl( SvHash_Cachable(), rInStm
) )
626 SetCachable( aCachable
), bOk
= TRUE
;
627 if( aVolatile
.ReadSvIdl( SvHash_Volatile(), rInStm
) )
628 SetVolatile( aVolatile
), bOk
= TRUE
;
629 if( aToggle
.ReadSvIdl( SvHash_Toggle(), rInStm
) )
630 SetToggle( aToggle
), bOk
= TRUE
;
631 if( aAutoUpdate
.ReadSvIdl( SvHash_AutoUpdate(), rInStm
) )
632 SetAutoUpdate( aAutoUpdate
), bOk
= TRUE
;
634 if( aSynchron
.ReadSvIdl( SvHash_Synchron(), rInStm
) )
635 SetSynchron( aSynchron
), bOk
= TRUE
;
636 if( aAsynchron
.ReadSvIdl( SvHash_Asynchron(), rInStm
) )
637 SetAsynchron( aAsynchron
), bOk
= TRUE
;
639 if( aRecordAbsolute
.ReadSvIdl( SvHash_RecordAbsolute(), rInStm
) )
640 SetRecordAbsolute( aRecordAbsolute
), bOk
= TRUE
;
641 if( aRecordPerItem
.ReadSvIdl( SvHash_RecordPerItem(), rInStm
) )
642 SetRecordPerItem( aRecordPerItem
), bOk
= TRUE
;
643 if( aRecordPerSet
.ReadSvIdl( SvHash_RecordPerSet(), rInStm
) )
644 SetRecordPerSet( aRecordPerSet
), bOk
= TRUE
;
645 if( aRecordManual
.ReadSvIdl( SvHash_RecordManual(), rInStm
) )
646 SetRecordManual( aRecordManual
), bOk
= TRUE
;
647 if( aNoRecord
.ReadSvIdl( SvHash_NoRecord(), rInStm
) )
648 SetNoRecord( aNoRecord
), bOk
= TRUE
;
650 bOk
|= aHasDialog
.ReadSvIdl( SvHash_HasDialog(), rInStm
);
651 bOk
|= aPseudoPrefix
.ReadSvIdl( SvHash_PseudoPrefix(), rInStm
);
652 bOk
|= aMenuConfig
.ReadSvIdl( SvHash_MenuConfig(), rInStm
);
653 bOk
|= aToolBoxConfig
.ReadSvIdl( SvHash_ToolBoxConfig(), rInStm
);
654 bOk
|= aStatusBarConfig
.ReadSvIdl( SvHash_StatusBarConfig(), rInStm
);
655 bOk
|= aAccelConfig
.ReadSvIdl( SvHash_AccelConfig(), rInStm
);
658 if( aAllConfig
.ReadSvIdl( SvHash_AllConfig(), rInStm
) )
659 SetAllConfig( aAllConfig
), bOk
= TRUE
;
660 bOk
|= aFastCall
.ReadSvIdl( SvHash_FastCall(), rInStm
);
661 bOk
|= aContainer
.ReadSvIdl( SvHash_Container(), rInStm
);
662 bOk
|= aImageRotation
.ReadSvIdl( SvHash_ImageRotation(), rInStm
);
663 bOk
|= aImageReflection
.ReadSvIdl( SvHash_ImageReflection(), rInStm
);
664 bOk
|= aUnoName
.ReadSvIdl( SvHash_UnoName(), rInStm
);
668 if( !aSlotType
.Is() )
670 UINT32 nTokPos
= rInStm
.Tell();
671 SvToken
* pTok
= rInStm
.GetToken_Next();
672 if( pTok
->Is( SvHash_SlotType() ) )
674 BOOL bBraket
= rInStm
.Read( '(' );
675 if( bBraket
|| rInStm
.Read( '=' ) )
677 aSlotType
= rBase
.ReadKnownType( rInStm
);
680 if( aSlotType
->IsItem() )
684 if( rInStm
.Read( ')' ) )
690 rBase
.SetError( "the SlotType is not a item", rInStm
.GetToken() );
691 rBase
.WriteError( rInStm
);
693 rBase
.SetError( "SlotType with unknown item type", rInStm
.GetToken() );
694 rBase
.WriteError( rInStm
);
697 rInStm
.Seek( nTokPos
);
702 SvToken
* pTok
= rInStm
.GetToken();
703 if( pTok
->IsIdentifier() )
705 aMethod
= new SvMetaSlot();
706 UINT32 nTokPos
= rInStm
.Tell();
707 if( aMethod
->ReadSvIdl( rBase
, rInStm
) )
709 if( aMethod
->IsMethod() )
711 aMethod
->SetSlotId( GetSlotId() );
712 if( aMethod
->Test( rBase
, rInStm
) )
715 rInStm
.Seek( nTokPos
);
723 /*************************************************************************
724 |* SvMetaSlot::WriteAttributesSvIdl()
727 *************************************************************************/
728 void SvMetaSlot::WriteAttributesSvIdl( SvIdlDataBase
& rBase
,
732 SvMetaAttribute::WriteAttributesSvIdl( rBase
, rOutStm
, nTab
);
736 WriteTab( rOutStm
, nTab
);
737 rOutStm
<< SvHash_SlotType()->GetName().GetBuffer() << '(';
738 aSlotType
->WriteTheType( rBase
, rOutStm
, nTab
, WRITE_IDL
);
739 rOutStm
<< ");" << endl
;
743 WriteTab( rOutStm
, nTab
);
744 aMethod
->WriteSvIdl( rBase
, rOutStm
, nTab
);
745 rOutStm
<< ';' << endl
;
749 aHasCoreId
.WriteSvIdl( SvHash_HasCoreId(), rOutStm
);
750 rOutStm
<< ';' << endl
;
754 WriteTab( rOutStm
, nTab
);
755 aGroupId
.WriteSvIdl( SvHash_GroupId(), rOutStm
, nTab
+1);
756 rOutStm
<< ';' << endl
;
758 if( aExecMethod
.Len() )
760 WriteTab( rOutStm
, nTab
);
761 aExecMethod
.WriteSvIdl( SvHash_ExecMethod(), rOutStm
, nTab
+1);
762 rOutStm
<< ';' << endl
;
764 if( aStateMethod
.Len() )
766 WriteTab( rOutStm
, nTab
);
767 aStateMethod
.WriteSvIdl( SvHash_StateMethod(), rOutStm
, nTab
+1);
768 rOutStm
<< ';' << endl
;
771 if( aDisableFlags
.Len() )
773 WriteTab( rOutStm
, nTab
);
774 aDisableFlags
.WriteSvIdl( SvHash_DisableFlags(), rOutStm
, nTab
+1);
775 rOutStm
<< ';' << endl
;
778 if( aSet
|| aGet
|| aPseudoSlots
)
780 WriteTab( rOutStm
, nTab
);
784 aPseudoSlots
.WriteSvIdl( SvHash_PseudoSlots(), rOutStm
);
790 aGet
.WriteSvIdl( SvHash_Get(), rOutStm
);
796 aSet
.WriteSvIdl( SvHash_Set(), rOutStm
);
798 rOutStm
<< ';' << endl
;
801 ByteString
aDel( ", " );
804 aOut
+= aVolatile
.GetSvIdlString( SvHash_Volatile() );
805 else if( !aCachable
)
806 // wegen Default == TRUE, nur wenn kein anderer gesetzt
807 aOut
+= aCachable
.GetSvIdlString( SvHash_Cachable() );
813 ( aOut
+= aDel
) += aToggle
.GetSvIdlString( SvHash_Toggle() );
818 (aOut
+= aDel
) += aAutoUpdate
.GetSvIdlString( SvHash_AutoUpdate() );
822 ByteString
aDel1( ", " );
824 ( aOut
+= aDel
) += aAsynchron
.GetSvIdlString( SvHash_Asynchron() );
825 else if( !aSynchron
)
826 // wegen Default == TRUE, nur wenn kein anderer gesetzt
827 ( aOut
+= aDel
) += aSynchron
.GetSvIdlString( SvHash_Synchron() );
833 ( aOut
+= aDel1
) += aRecordManual
.GetSvIdlString( SvHash_RecordManual() );
835 ( aOut
+= aDel1
) += aNoRecord
.GetSvIdlString( SvHash_NoRecord() );
836 else if( !aRecordPerSet
)
837 // wegen Default == TRUE, nur wenn kein anderer gesetzt
838 ( aOut
+= aDel1
) += aRecordPerSet
.GetSvIdlString( SvHash_RecordPerSet() );
839 else if( aRecordPerItem
)
840 ( aOut
+= aDel1
) += aRecordPerItem
.GetSvIdlString( SvHash_RecordPerItem() );
844 if( aRecordAbsolute
)
846 ( aOut
+= aDel
) += aRecordAbsolute
.GetSvIdlString( SvHash_RecordAbsolute() );
851 ( aOut
+= aDel
) += aHasDialog
.GetSvIdlString( SvHash_HasDialog() );
856 ( aOut
+= aDel
) += aMenuConfig
.GetSvIdlString( SvHash_MenuConfig() );
861 ( aOut
+= aDel
) += aToolBoxConfig
.GetSvIdlString( SvHash_ToolBoxConfig() );
864 if( aStatusBarConfig
)
866 ( aOut
+= aDel
) += aStatusBarConfig
.GetSvIdlString( SvHash_StatusBarConfig() );
871 ( aOut
+= aDel
) += aAccelConfig
.GetSvIdlString( SvHash_AccelConfig() );
876 ( aOut
+= aDel
) += aFastCall
.GetSvIdlString( SvHash_FastCall() );
881 ( aOut
+= aDel
) += aContainer
.GetSvIdlString( SvHash_Container() );
886 ( aOut
+= aDel
) += aImageRotation
.GetSvIdlString( SvHash_ImageRotation() );
890 if( aImageReflection
)
892 ( aOut
+= aDel
) += aImageReflection
.GetSvIdlString( SvHash_ImageReflection() );
898 WriteTab( rOutStm
, nTab
);
899 rOutStm
<< aOut
.GetBuffer() << endl
;
904 /*************************************************************************
905 |* SvMetaSlot::Test()
908 *************************************************************************/
909 BOOL
SvMetaSlot::Test( SvIdlDataBase
& rBase
, SvTokenStream
& rInStm
)
911 BOOL bOk
= SvMetaAttribute::Test( rBase
, rInStm
);
914 SvMetaType
* pType
= GetType();
915 if( pType
->GetType() == TYPE_METHOD
)
916 pType
= pType
->GetReturnType();
917 if( !pType
->IsItem() )
919 rBase
.SetError( "this attribute is not a slot", rInStm
.GetToken() );
920 rBase
.WriteError( rInStm
);
928 /*************************************************************************
929 |* SvMetaSlot::ReadSvIdl()
932 *************************************************************************/
933 BOOL
SvMetaSlot::ReadSvIdl( SvIdlDataBase
& rBase
, SvTokenStream
& rInStm
)
935 UINT32 nTokPos
= rInStm
.Tell();
938 SvMetaAttribute
* pAttr
= rBase
.ReadKnownAttr( rInStm
, GetType() );
941 // F"ur Testzwecke: Referenz bei Kurz-Syntax
942 SvMetaSlot
* pKnownSlot
= PTR_CAST( SvMetaSlot
, pAttr
);
945 SetRef( pKnownSlot
);
946 SetName( pKnownSlot
->GetName(), &rBase
);
947 bOk
= SvMetaName::ReadSvIdl( rBase
, rInStm
);
951 ByteString
aStr( "attribute " );
952 aStr
+= pAttr
->GetName();
953 aStr
+= " is method or variable but not a slot";
954 rBase
.SetError( aStr
, rInStm
.GetToken() );
955 rBase
.WriteError( rInStm
);
961 bOk
= SvMetaAttribute::ReadSvIdl( rBase
, rInStm
);
963 SvMetaAttribute
*pAttr2
= rBase
.SearchKnownAttr( GetSlotId() );
966 // F"ur Testzwecke: Referenz bei kompletter Definition
967 SvMetaSlot
* pKnownSlot
= PTR_CAST( SvMetaSlot
, pAttr2
);
970 SetRef( pKnownSlot
);
972 // Namen d"urfen abweichen, da mit angegeben
973 if ( pKnownSlot
->GetName() != GetName() )
975 DBG_ERROR("Illegal definition!");
976 rInStm
.Seek( nTokPos
);
980 SetName( pKnownSlot
->GetName(), &rBase
);
984 ByteString
aStr( "attribute " );
985 aStr
+= pAttr2
->GetName();
986 aStr
+= " is method or variable but not a slot";
987 rBase
.SetError( aStr
, rInStm
.GetToken() );
988 rBase
.WriteError( rInStm
);
995 rInStm
.Seek( nTokPos
);
1000 /*************************************************************************
1001 |* SvMetaSlot::WriteSvIdl()
1004 *************************************************************************/
1005 void SvMetaSlot::WriteSvIdl( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
1008 SvMetaAttribute::WriteSvIdl( rBase
, rOutStm
, nTab
);
1011 /*************************************************************************
1012 |* SvMetaSlot::Write()
1015 *************************************************************************/
1016 void SvMetaSlot::Write( SvIdlDataBase
& rBase
,
1017 SvStream
& rOutStm
, USHORT nTab
,
1018 WriteType nT
, WriteAttribute nA
)
1020 if ( nT
== WRITE_DOCU
)
1027 // keine Attribut fuer Automation
1028 if( !GetAutomation() || !GetExport() )
1032 if( !(nA
& WA_VARIABLE
) )
1034 SvMetaAttributeRef xM
= GetMethod();
1037 xM
->SetSlotId( GetSlotId() );
1038 xM
->SetDescription( GetDescription() );
1039 xM
->Write( rBase
, rOutStm
, nTab
, nT
, nA
);
1044 SvMetaAttribute::Write( rBase
, rOutStm
, nTab
, nT
, nA
);
1048 void SvMetaSlot::Insert( SvSlotElementList
& rList
, const ByteString
& rPrefix
,
1049 SvIdlDataBase
& rBase
)
1051 // Einf"ugeposition durch bin"are Suche in der SlotListe ermitteln
1052 USHORT nId
= (USHORT
) GetSlotId().GetValue();
1053 USHORT nListCount
= (USHORT
) rList
.Count();
1055 ULONG m
; // for inner "for" loop
1059 else if ( nListCount
== 1 )
1060 nPos
= rList
.GetObject(0)->xSlot
->GetSlotId().GetValue() >= nId
? 0 : 1;
1063 USHORT nMid
= 0, nLow
= 0;
1064 USHORT nHigh
= nListCount
- 1;
1065 BOOL bFound
= FALSE
;
1066 while ( !bFound
&& nLow
<= nHigh
)
1068 nMid
= (nLow
+ nHigh
) >> 1;
1069 DBG_ASSERT( nMid
< nListCount
, "bsearch ist buggy" );
1070 int nDiff
= (int) nId
- (int) rList
.GetObject(nMid
)->xSlot
->GetSlotId().GetValue();
1077 else if ( nDiff
> 0 )
1087 DBG_ASSERT(!bFound
, "Duplicate SlotId!");
1088 nPos
= bFound
? nMid
: nLow
;
1091 DBG_ASSERT( nPos
<= nListCount
,
1093 DBG_ASSERT( nPos
== nListCount
|| nId
<=
1094 (USHORT
) rList
.GetObject(nPos
)->xSlot
->GetSlotId().GetValue(),
1095 "Successor has lower SlotId" );
1096 DBG_ASSERT( nPos
== 0 || nId
>
1097 (USHORT
) rList
.GetObject(nPos
-1)->xSlot
->GetSlotId().GetValue(),
1098 "Predecessor has higher SlotId" );
1099 DBG_ASSERT( nPos
+1 >= nListCount
|| nId
<
1100 (USHORT
) rList
.GetObject(nPos
+1)->xSlot
->GetSlotId().GetValue(),
1101 "Successor has lower SlotId" );
1103 rList
.Insert( new SvSlotElement( this, rPrefix
), nPos
);
1105 // EnumSlots plattklopfen
1106 SvMetaTypeEnum
* pEnum
= NULL
;
1107 SvMetaType
* pBType
= GetType()->GetBaseType();
1108 pEnum
= PTR_CAST( SvMetaTypeEnum
, pBType
);
1109 if( GetPseudoSlots() && pEnum
&& pEnum
->Count() )
1111 // Den MasterSlot clonen
1112 SvMetaSlotRef xEnumSlot
;
1113 SvMetaSlot
*pFirstEnumSlot
= NULL
;
1114 for( ULONG n
= 0; n
< pEnum
->Count(); n
++ )
1116 // Die SlotId erzeugen
1117 SvMetaEnumValue
*enumValue
= pEnum
->GetObject(n
);
1118 ByteString aValName
= enumValue
->GetName();
1119 ByteString
aSId( GetSlotId() );
1120 if( GetPseudoPrefix().Len() )
1121 aSId
= GetPseudoPrefix();
1123 aSId
+= aValName
.Copy( pEnum
->GetPrefix().Len() );
1126 for( m
=0; m
<rBase
.GetAttrList().Count(); m
++ )
1128 SvMetaAttribute
* pAttr
= rBase
.GetAttrList().GetObject( m
);
1129 if( pAttr
->GetSlotId() == aSId
)
1131 SvMetaSlot
* pSlot
= PTR_CAST( SvMetaSlot
, pAttr
);
1132 xEnumSlot
= pSlot
->Clone();
1137 if ( m
== rBase
.GetAttrList().Count() )
1139 DBG_ERROR("Invalid EnumSlot!");
1140 xEnumSlot
= Clone();
1142 if ( rBase
.FindId(aSId
, &nValue
) )
1144 SvNumberIdentifier aId
;
1145 *((SvIdentifier
*)&aId
) = aSId
;
1146 aId
.SetValue(nValue
);
1147 xEnumSlot
->SetSlotId(aId
);
1151 // Die Slaves sind kein Master !
1152 xEnumSlot
->aPseudoSlots
= FALSE
;
1153 xEnumSlot
->SetEnumValue(enumValue
);
1155 if ( !pFirstEnumSlot
|| xEnumSlot
->GetSlotId().GetValue() < pFirstEnumSlot
->GetSlotId().GetValue() )
1156 pFirstEnumSlot
= xEnumSlot
;
1158 // Den erzeugten Slave ebenfalls einf"ugen
1159 xEnumSlot
->Insert( rList
, rPrefix
, rBase
);
1161 // Die EnumSlots mit dem Master verketten
1162 xEnumSlot
->pLinkedSlot
= this;
1165 // Master zeigt auf den ersten Slave
1166 pLinkedSlot
= pFirstEnumSlot
;
1168 // Slaves untereinander verketten
1169 rList
.Seek((ULONG
)0);
1170 xEnumSlot
= pFirstEnumSlot
;
1171 SvSlotElement
*pEle
;
1174 pEle
= rList
.Next();
1175 if ( pEle
&& pEle
->xSlot
->pLinkedSlot
== this )
1177 xEnumSlot
->pNextSlot
= pEle
->xSlot
;
1178 xEnumSlot
= pEle
->xSlot
;
1182 xEnumSlot
->pNextSlot
= pFirstEnumSlot
;
1187 /*************************************************************************
1188 |* SvMetaSlot::WriteSlotMap()
1191 *************************************************************************/
1192 static ByteString
MakeSlotName( SvStringHashEntry
* pEntry
)
1194 ByteString
aName( "SFX_SLOT_" );
1195 aName
+= pEntry
->GetName();
1196 return aName
.ToUpperAscii();
1199 void SvMetaSlot::WriteSlotStubs( const ByteString
& rShellName
,
1200 ByteStringList
& rList
,
1201 SvStream
& rOutStm
)
1204 ByteString aName = GetName();
1205 SvMetaAttribute * pAttr = rAttrList.First();
1208 if( pAttr->GetName() == aName )
1210 pAttr = rAttrList.Next();
1215 if ( !GetExport() && !GetHidden() )
1218 ByteString
aMethodName( GetExecMethod() );
1219 if ( aMethodName
.Len() && aMethodName
!= "NoExec" )
1222 for( USHORT n
= 0; n
< rList
.Count(); n
++ )
1224 if( *(rList
.GetObject(n
)) == aMethodName
)
1233 rList
.Insert( new ByteString(aMethodName
), LIST_APPEND
);
1234 rOutStm
<< "SFX_EXEC_STUB("
1235 << rShellName
.GetBuffer()
1237 << aMethodName
.GetBuffer()
1242 aMethodName
= GetStateMethod();
1243 if ( aMethodName
.Len() && aMethodName
!= "NoState" )
1246 for ( USHORT n
=0; n
< rList
.Count(); n
++ )
1248 if ( *(rList
.GetObject(n
)) == aMethodName
)
1257 rList
.Insert( new ByteString(aMethodName
), LIST_APPEND
);
1258 rOutStm
<< "SFX_STATE_STUB("
1259 << rShellName
.GetBuffer()
1261 << aMethodName
.GetBuffer()
1267 void SvMetaSlot::WriteSlot( const ByteString
& rShellName
, USHORT nCount
,
1268 const ByteString
& rSlotId
,
1269 SvSlotElementList
& rSlotList
,
1270 const ByteString
& rPrefix
,
1271 SvIdlDataBase
& rBase
, SvStream
& rOutStm
)
1273 if ( !GetExport() && !GetHidden() )
1276 // BOOL bIsEnumSlot = 0 != rValueName.Len();
1277 BOOL bIsEnumSlot
= 0 != pEnumValue
;
1279 rOutStm
<< "// Slot Nr. " << ByteString::CreateFromInt32(nListPos
).GetBuffer() << " : ";
1280 ByteString
aSlotIdValue( ByteString::CreateFromInt32( GetSlotId().GetValue() ) );
1281 rOutStm
<< aSlotIdValue
.GetBuffer() << endl
;
1282 WriteTab( rOutStm
, 1 );
1284 rOutStm
<< "SFX_NEW_SLOT_ENUM( ";
1286 rOutStm
<< "SFX_NEW_SLOT_ARG( " << rShellName
.GetBuffer() << ',' ;
1288 rOutStm
<< rSlotId
.GetBuffer() << ',';
1289 const SvHelpContext
& rHlpCtx
= GetHelpContext();
1290 if( rHlpCtx
.IsSet() )
1291 rOutStm
<< rHlpCtx
.GetBuffer() << ',';
1293 rOutStm
<< rSlotId
.GetBuffer() << ',';
1296 if( GetGroupId().Len() )
1297 rOutStm
<< GetGroupId().GetBuffer();
1300 rOutStm
<< ',' << endl
;
1301 WriteTab( rOutStm
, 4 );
1305 rOutStm
<< "&a" << rShellName
.GetBuffer() << "Slots_Impl["
1306 << ByteString::CreateFromInt32(pLinkedSlot
->GetListPos()).GetBuffer()
1307 << "] /*Offset Master*/, " << endl
;
1308 WriteTab( rOutStm
, 4 );
1309 rOutStm
<< "&a" << rShellName
.GetBuffer() << "Slots_Impl["
1310 << ByteString::CreateFromInt32(pNextSlot
->GetListPos()).GetBuffer()
1311 << "] /*Offset Next*/, " << endl
;
1313 WriteTab( rOutStm
, 4 );
1316 if( GetSlotId().Len() )
1317 rOutStm
<< pLinkedSlot
->GetSlotId().GetBuffer();
1321 rOutStm
<< pEnumValue
->GetName().GetBuffer();
1325 // Den n"achsten Slot suchen, der die gleiche StateMethod hat wie ich
1326 // Die SlotList ist auf den aktuellen Slot geseekt
1327 SvSlotElement
* pEle
= rSlotList
.Next();
1328 pNextSlot
= pEle
? &pEle
->xSlot
: NULL
;
1331 if ( !pNextSlot
->pNextSlot
&&
1332 pNextSlot
->GetStateMethod() == GetStateMethod() )
1334 pEle
= rSlotList
.Next();
1335 pNextSlot
= pEle
? &pEle
->xSlot
: NULL
;
1340 // Es gibt nach mir keinen Slot mehr, der die gleiche ExecMethode
1341 // hat. Also suche ich den ersten Slot, der diese hatte (das
1342 // k"onnte auch ich selbst sein)
1343 pEle
= rSlotList
.First();
1344 pNextSlot
= pEle
? &pEle
->xSlot
: NULL
;
1345 while ( pNextSlot
!= this )
1347 if ( !pNextSlot
->pEnumValue
&&
1348 pNextSlot
->GetStateMethod() == GetStateMethod() )
1350 pEle
= rSlotList
.Next();
1351 pNextSlot
= pEle
? &pEle
->xSlot
: NULL
;
1361 rOutStm
<< "&a" << rShellName
.GetBuffer() << "Slots_Impl["
1362 << ByteString::CreateFromInt32(pLinkedSlot
->GetListPos()).GetBuffer()
1363 << "] /*Offset Linked*/, " << endl
;
1364 WriteTab( rOutStm
, 4 );
1367 rOutStm
<< "&a" << rShellName
.GetBuffer() << "Slots_Impl["
1368 << ByteString::CreateFromInt32(pNextSlot
->GetListPos()).GetBuffer()
1369 << "] /*Offset Next*/, " << endl
;
1371 WriteTab( rOutStm
, 4 );
1373 // ExecMethod schreiben, wenn nicht angegeben, standard Namen
1374 if( GetExecMethod().Len() && GetExecMethod() != "NoExec")
1375 rOutStm
<< "SFX_STUB_PTR(" << rShellName
.GetBuffer() << ','
1376 << GetExecMethod().GetBuffer() << ')';
1378 rOutStm
<< "SFX_STUB_PTR_EXEC_NONE";
1381 // StateMethod schreiben, wenn nicht angegeben, standard Namen
1382 if( GetStateMethod().Len() && GetStateMethod() != "NoState")
1383 rOutStm
<< "SFX_STUB_PTR(" << rShellName
.GetBuffer() << ','
1384 << GetStateMethod().GetBuffer() << ')';
1386 rOutStm
<< "SFX_STUB_PTR_STATE_NONE";
1388 rOutStm
<< ',' << endl
;
1389 WriteTab( rOutStm
, 4 );
1392 if( GetHasCoreId() )
1393 rOutStm
<< MakeSlotName( SvHash_HasCoreId() ).GetBuffer() << '|';
1395 rOutStm
<< MakeSlotName( SvHash_Cachable() ).GetBuffer() << '|';
1397 rOutStm
<< MakeSlotName( SvHash_Volatile() ).GetBuffer() << '|';
1399 rOutStm
<< MakeSlotName( SvHash_Toggle() ).GetBuffer() << '|';
1400 if( GetAutoUpdate() )
1401 rOutStm
<< MakeSlotName( SvHash_AutoUpdate() ).GetBuffer() << '|';
1403 rOutStm
<< MakeSlotName( SvHash_Synchron() ).GetBuffer() << '|';
1404 if( GetAsynchron() )
1405 rOutStm
<< MakeSlotName( SvHash_Asynchron() ).GetBuffer() << '|';
1406 if( GetRecordPerItem() )
1407 rOutStm
<< MakeSlotName( SvHash_RecordPerItem() ).GetBuffer() << '|';
1408 if( GetRecordPerSet() )
1409 rOutStm
<< MakeSlotName( SvHash_RecordPerSet() ).GetBuffer() << '|';
1410 if( GetRecordManual() )
1411 rOutStm
<< MakeSlotName( SvHash_RecordManual() ).GetBuffer() << '|';
1413 rOutStm
<< MakeSlotName( SvHash_NoRecord() ).GetBuffer() << '|';
1414 if( GetRecordAbsolute() )
1415 rOutStm
<< MakeSlotName( SvHash_RecordAbsolute() ).GetBuffer() << '|';
1416 if( GetHasDialog() )
1417 rOutStm
<< MakeSlotName( SvHash_HasDialog() ).GetBuffer() << '|';
1418 if( GetMenuConfig() )
1419 rOutStm
<< MakeSlotName( SvHash_MenuConfig() ).GetBuffer() << '|';
1420 if( GetToolBoxConfig() )
1421 rOutStm
<< MakeSlotName( SvHash_ToolBoxConfig() ).GetBuffer() << '|';
1422 if( GetStatusBarConfig() )
1423 rOutStm
<< MakeSlotName( SvHash_StatusBarConfig() ).GetBuffer() << '|';
1424 if( GetAccelConfig() )
1425 rOutStm
<< MakeSlotName( SvHash_AccelConfig() ).GetBuffer() << '|';
1427 rOutStm
<< MakeSlotName( SvHash_FastCall() ).GetBuffer() << '|';
1428 if( GetContainer() )
1429 rOutStm
<< MakeSlotName( SvHash_Container() ).GetBuffer() << '|';
1430 if ( GetReadOnlyDoc() )
1431 rOutStm
<< MakeSlotName( SvHash_ReadOnlyDoc() ).GetBuffer() << '|';
1432 if( GetImageRotation() )
1433 rOutStm
<< MakeSlotName( SvHash_ImageRotation() ).GetBuffer() << '|';
1434 if( GetImageReflection() )
1435 rOutStm
<< MakeSlotName( SvHash_ImageReflection() ).GetBuffer() << '|';
1438 rOutStm
<< ',' << endl
;
1439 WriteTab( rOutStm
, 4 );
1440 if ( !GetDisableFlags().Len() )
1443 rOutStm
<< GetDisableFlags().GetBuffer();
1445 // Attribut Typ schreiben
1448 rOutStm
<< ',' << endl
;
1449 WriteTab( rOutStm
, 4 );
1451 SvMetaType
* pT
= GetSlotType();
1455 pT
= rBase
.FindType( "SfxVoidItem" );
1461 rOutStm
<< pT
->GetName().GetBuffer();
1462 if( !rBase
.FindType( pT
, rBase
.aUsedTypes
) )
1463 rBase
.aUsedTypes
.Append( pT
);
1466 rOutStm
<< "SfxVoidItem not defined";
1470 SvMetaType
*pT
= rBase
.FindType( "SfxBoolItem" );
1471 if ( pT
&& !rBase
.FindType( pT
, rBase
.aUsedTypes
) )
1472 rBase
.aUsedTypes
.Append( pT
);
1477 rOutStm
<< ',' << endl
;
1478 WriteTab( rOutStm
, 4 );
1479 rOutStm
<< ByteString::CreateFromInt32( nCount
).GetBuffer() << "/*Offset*/, ";
1483 SvMetaAttribute
* pMethod
= GetMethod();
1486 pType
= pMethod
->GetType();
1489 ULONG nSCount
= pType
->GetAttrCount();
1490 rOutStm
<< ByteString::CreateFromInt32( nSCount
).GetBuffer() << "/*Count*/";
1495 // Name f"urs Recording
1500 rOutStm
<< rPrefix
.GetBuffer();
1502 if ( !IsVariable() || !GetType() ||
1503 GetType()->GetBaseType()->GetType() != TYPE_STRUCT
)
1504 rOutStm
<< GetMangleName( FALSE
).GetBuffer();
1510 // Method/Property Flags
1512 rOutStm
<< "SFX_SLOT_METHOD|";
1515 rOutStm
<< "SFX_SLOT_PROPGET|";
1516 if( !GetReadonly() )
1517 rOutStm
<< "SFX_SLOT_PROPSET|";
1523 // if ( GetUnoName().Len() )
1526 rOutStm
<< GetMangleName( FALSE
).GetBuffer();
1527 //rOutStm << GetUnoName().GetBuffer();
1531 // rOutStm << ", 0";
1533 rOutStm
<< " )," << endl
;
1536 USHORT
SvMetaSlot::WriteSlotParamArray( SvIdlDataBase
& rBase
, SvStream
& rOutStm
)
1538 if ( !GetExport() && !GetHidden() )
1541 SvMetaAttribute
* pMethod
= GetMethod();
1546 pType
= pMethod
->GetType();
1550 if( !rBase
.FindType( pType
, rBase
.aUsedTypes
) )
1551 rBase
.aUsedTypes
.Append( pType
);
1553 const SvMetaAttributeMemberList
& rList
=
1554 pType
->GetAttrList();
1555 for( ULONG n
= 0; n
< rList
.Count(); n
++ )
1557 SvMetaAttribute
* pPar
= rList
.GetObject( n
);
1558 SvMetaType
* pPType
= pPar
->GetType();
1559 WriteTab( rOutStm
, 1 );
1560 rOutStm
<< "SFX_ARGUMENT("
1561 << pPar
->GetSlotId().GetBuffer() << ',' // SlodId
1563 << "\"" << pPar
->GetName().GetBuffer() << "\","
1565 << pPType
->GetName().GetBuffer() << ")," << endl
;
1566 if( !rBase
.FindType( pPType
, rBase
.aUsedTypes
) )
1567 rBase
.aUsedTypes
.Append( pPType
);
1569 return (USHORT
)rList
.Count();
1574 USHORT
SvMetaSlot::WriteSlotMap( const ByteString
& rShellName
, USHORT nCount
,
1575 SvSlotElementList
& rSlotList
,
1576 const ByteString
& rPrefix
,
1577 SvIdlDataBase
& rBase
,
1578 SvStream
& rOutStm
)
1580 // SlotId, wenn nicht angegeben, aus Namen generieren
1581 ByteString slotId
= GetSlotId();
1587 SvMetaAttribute
* pMethod
= GetMethod();
1589 pType
= pMethod
->GetType();
1593 nSCount
= (USHORT
)pType
->GetAttrCount();
1596 WriteSlot( rShellName
, nCount
, slotId
, rSlotList
, rPrefix
, rBase
, rOutStm
);
1600 /*************************************************************************
1601 |* SvMetaSlot::WriteSrc()
1602 *************************************************************************/
1603 void SvMetaSlot::WriteSrc( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
1606 if (!GetToolBoxConfig() && !GetAccelConfig() && !GetMenuConfig() && !GetStatusBarConfig() )
1609 ULONG nSId
= GetSlotId().GetValue();
1610 if( !pTable
->IsKeyValid( nSId
) )
1612 pTable
->Insert( nSId
, this );
1613 rOutStm
<< "SfxSlotInfo " << ByteString::CreateFromInt32( nSId
).GetBuffer()
1614 << endl
<< '{' << endl
;
1616 WriteTab( rOutStm
, 1 );
1617 ByteString aStr
= GetConfigName();
1621 rOutStm
<< "SlotName = \"" << aStr
.GetBuffer() << "\";" << endl
;
1623 aStr
= GetHelpText();
1626 WriteTab( rOutStm
, 1 );
1627 rOutStm
<< "HelpText = \"" << aStr
.GetBuffer() << "\";" << endl
;
1630 rOutStm
<< "};" << endl
;
1633 SvMetaTypeEnum
* pEnum
= PTR_CAST( SvMetaTypeEnum
, GetType() );
1634 if( GetPseudoSlots() && pEnum
)
1636 for( ULONG n
= 0; n
< pEnum
->Count(); n
++ )
1638 ByteString aValName
= pEnum
->GetObject( n
)->GetName();
1639 ByteString
aSId( GetSlotId() );
1640 if( GetPseudoPrefix().Len() )
1641 aSId
= GetPseudoPrefix();
1643 aSId
+= aValName
.Copy( pEnum
->GetPrefix().Len() );
1647 if( rBase
.FindId( aSId
, &nSId2
) )
1649 aSId
= ByteString::CreateFromInt32( nSId2
);
1653 // wenn Id nicht gefunden, immer schreiben
1654 if( !bIdOk
|| !pTable
->IsKeyValid( nSId2
) )
1656 pTable
->Insert( nSId2
, this );
1657 rOutStm
<< "SfxSlotInfo " << aSId
.GetBuffer()
1658 << endl
<< '{' << endl
;
1660 WriteTab( rOutStm
, 1 );
1661 rOutStm
<< "SlotName = \"" << aValName
.GetBuffer() << "\";" << endl
;
1663 ByteString aStr
= GetHelpText();
1666 WriteTab( rOutStm
, 1 );
1667 rOutStm
<< "HelpText = \"" << aStr
.GetBuffer() << "\";" << endl
;
1669 rOutStm
<< "};" << endl
;
1675 void SvMetaSlot::WriteHelpId( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
1678 ULONG nSId
= GetSlotId().GetValue();
1679 if( !pTable
->IsKeyValid( nSId
) )
1681 pTable
->Insert( nSId
, this );
1682 rOutStm
<< "#define " << GetSlotId().GetBuffer() << '\t' << ByteString::CreateFromInt32( nSId
).GetBuffer() << endl
;
1685 SvMetaTypeEnum
* pEnum
= PTR_CAST( SvMetaTypeEnum
, GetType() );
1686 if( GetPseudoSlots() && pEnum
)
1688 for( ULONG n
= 0; n
< pEnum
->Count(); n
++ )
1690 ByteString aValName
= pEnum
->GetObject( n
)->GetName();
1691 ByteString
aSId( GetSlotId() );
1692 if( GetPseudoPrefix().Len() )
1693 aSId
= GetPseudoPrefix();
1695 aSId
+= aValName
.Copy( pEnum
->GetPrefix().Len() );
1699 if( rBase
.FindId( aSId
, &nSId2
) )
1701 aSId
= ByteString::CreateFromInt32( nSId2
);
1705 // wenn Id nicht gefunden, immer schreiben
1706 if( !bIdOk
|| !pTable
->IsKeyValid( nSId2
) )
1708 pTable
->Insert( nSId2
, this );
1710 rOutStm
<< "#define " << aSId
.GetBuffer() << '\t'
1711 << ByteString::CreateFromInt32( nSId2
).GetBuffer() << endl
;
1717 void WriteBool( BOOL bSet
, SvStream
& rStream
)
1720 rStream
<< "TRUE" << ',';
1722 rStream
<< "FALSE" << ',';
1725 void SvMetaSlot::WriteCSV( SvIdlDataBase
& rBase
, SvStream
& rStrm
)
1727 rStrm
<< "PROJECT,";
1728 rStrm
<< GetSlotId().GetBuffer() << ',';
1729 rStrm
<< ByteString::CreateFromInt32( GetSlotId().GetValue() ).GetBuffer() << ',';
1731 if ( GetPseudoPrefix().Len() )
1732 rStrm
<< GetPseudoPrefix().GetBuffer() << ',';
1736 rStrm
<< GetGroupId().GetBuffer() << ',';
1738 WriteBool( GetAccelConfig(), rStrm
);
1739 WriteBool( GetMenuConfig(), rStrm
);
1740 WriteBool( GetStatusBarConfig(), rStrm
);
1741 WriteBool( GetToolBoxConfig(), rStrm
);
1743 if ( GetSlotType() )
1744 rStrm
<< GetSlotType()->GetName().GetBuffer() << ',';
1748 WriteBool( GetAutoUpdate(), rStrm
);
1749 if ( GetCachable() )
1750 rStrm
<< "Cachable" << ',';
1752 rStrm
<< "Volatile" << ',';
1754 WriteBool( GetContainer(), rStrm
);
1755 WriteBool( GetFastCall(), rStrm
);
1756 WriteBool( GetHasCoreId(), rStrm
);
1757 WriteBool( GetHasDialog(), rStrm
);
1758 WriteBool( GetReadOnlyDoc(), rStrm
);
1759 WriteBool( GetImageRotation(), rStrm
);
1760 WriteBool( GetImageReflection(), rStrm
);
1761 rStrm
<< GetDisableFlags().GetBuffer() << ',';
1764 rStrm
<< "Synchron" << ',';
1766 rStrm
<< "Asynchron" << ',';
1768 WriteBool( GetToggle(), rStrm
);
1769 WriteBool( GetReadonly(), rStrm
);
1770 WriteBool( GetExport(), rStrm
);
1771 if( GetRecordPerItem() )
1772 rStrm
<< "RecordPerItem" << ',';
1773 else if ( GetNoRecord() )
1774 rStrm
<< "NoRecord" << ',';
1775 else if ( GetRecordManual() )
1776 rStrm
<< "RecordManual" << ',';
1778 rStrm
<< "RecordPerSet" << ',';
1780 WriteBool( GetRecordAbsolute(), rStrm
);
1782 if ( GetType()->GetType() != TYPE_METHOD
&& GetMethod() )
1784 rStrm
<< GetMethod()->GetType()->GetReturnType()->GetName().GetBuffer() << ',';
1785 rStrm
<< GetMethod()->GetName().GetBuffer() << ',';
1792 rStrm
<< GetType()->GetSvName().GetBuffer() << ',';
1793 rStrm
<< GetName().GetBuffer() << ',';
1795 if ( GetType()->GetType() == TYPE_METHOD
|| GetMethod() )
1797 SvMetaAttributeMemberList
*pList
= &GetType()->GetAttrList();
1799 pList
= &GetMethod()->GetType()->GetAttrList();
1801 if( pList
&& pList
->Count() )
1804 SvMetaAttribute
* pAttr
= pList
->First();
1807 pAttr
->WriteCSV( rBase
, rStrm
);
1808 pAttr
= pList
->Next();
1821 #endif // IDL_COMPILER