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"
34 #include <tools/debug.hxx>
38 #include <globals.hxx>
39 #include <database.hxx>
41 /******************** class SvClassElement *******************************/
42 SV_IMPL_PERSIST1( SvClassElement
, SvPersistBase
);
44 /*************************************************************************
45 |* SvClassElement::SvClassElement()
48 *************************************************************************/
49 SvClassElement::SvClassElement()
53 /*************************************************************************
54 |* SvClassElement::Load()
57 *************************************************************************/
58 void SvClassElement::Load( SvPersistStream
& rStm
)
64 rStm
.SetError( SVSTREAM_FILEFORMAT_ERROR
);
65 DBG_ERROR( "wrong format" );
68 if( nMask
& 0x01 ) rStm
>> aAutomation
;
69 if( nMask
& 0x02 ) rStm
.ReadByteString( aPrefix
);
78 /*************************************************************************
79 |* SvClassElement::Save()
82 *************************************************************************/
83 void SvClassElement::Save( SvPersistStream
& rStm
)
87 if( aAutomation
.IsSet() ) nMask
|= 0x1;
88 if( aPrefix
.Len() ) nMask
|= 0x2;
89 if( xClass
.Is() ) nMask
|= 0x4;
93 if( nMask
& 0x01 ) rStm
<< aAutomation
;
94 if( nMask
& 0x02 ) rStm
.WriteByteString( aPrefix
);
95 if( nMask
& 0x04 ) rStm
<< xClass
;
98 /****************** SvMetaClass ******************************************/
99 SV_IMPL_META_FACTORY1( SvMetaClass
, SvMetaType
);
100 /*************************************************************************
101 |* SvMetaClass::SvMetaClass()
104 *************************************************************************/
105 SvMetaClass::SvMetaClass()
106 : aAutomation( sal_True
, sal_False
)
110 /*************************************************************************
111 |* SvMetaClass::Load()
114 *************************************************************************/
115 void SvMetaClass::Load( SvPersistStream
& rStm
)
117 SvMetaType::Load( rStm
);
123 rStm
.SetError( SVSTREAM_FILEFORMAT_ERROR
);
124 DBG_ERROR( "wrong format" );
127 if( nMask
& 0x01 ) rStm
>> aAttrList
;
130 SvMetaClass
* pSuper
;
132 aSuperClass
= pSuper
;
134 if( nMask
& 0x04 ) rStm
>> aClassList
;
139 xAutomationInterface
= p
;
141 if( nMask
& 0x10 ) rStm
>> aAutomation
;
144 /*************************************************************************
145 |* SvMetaClass::Save()
148 *************************************************************************/
149 void SvMetaClass::Save( SvPersistStream
& rStm
)
151 SvMetaType::Save( rStm
);
155 if( aAttrList
.Count() ) nMask
|= 0x1;
156 if( aSuperClass
.Is() ) nMask
|= 0x2;
157 if( aClassList
.Count() ) nMask
|= 0x4;
158 if( xAutomationInterface
.Is() ) nMask
|= 0x8;
159 if( aAutomation
.IsSet() ) nMask
|= 0x10;
163 if( nMask
& 0x01 ) rStm
<< aAttrList
;
164 if( nMask
& 0x02 ) rStm
<< aSuperClass
;
165 if( nMask
& 0x04 ) rStm
<< aClassList
;
166 if( nMask
& 0x08 ) rStm
<< xAutomationInterface
;
167 if( nMask
& 0x10 ) rStm
<< aAutomation
;
170 /*************************************************************************
171 |* SvMetaClass::FillSbxObject()
174 *************************************************************************/
176 void SvMetaClass::FillSbxMemberObject( SvIdlDataBase & rBase,
178 StringList & rSuperList,
181 // alle Attribute der Klasse schreiben
183 for( n = 0; n < aAttrList.Count(); n++ )
185 SvMetaAttribute * pAttr = aAttrList.GetObject( n );
187 ByteString aMangleName = pAttr->GetMangleName( bVariable );
188 ByteString * pS = SvIdlDataBase::FindName( aMangleName, rSuperList );
190 if( !pS && pAttr->GetExport() )
193 if( bVariable && pAttr->IsVariable() )
195 rSuperList.Insert( new ByteString( aMangleName ), LIST_APPEND );
196 pAttr->FillSbxObject( rBase, pObj, bVariable );
198 else if( !bVariable && pAttr->IsMethod() )
200 rSuperList.Insert( new ByteString( aMangleName ), LIST_APPEND );
201 pAttr->FillSbxObject( rBase, pObj, bVariable );
205 // alle Attribute der importierten Klassen schreiben
206 for( n = 0; n < aClassList.Count(); n++ )
208 SvClassElement * pEle = aClassList.GetObject( n );
209 SvMetaClass * pClass = pEle->GetClass();
210 pClass->FillSbxMemberObject( rBase, pObj, rSuperList, bVariable );
212 // alle Attribute der Superklassen schreiben
213 if( aSuperClass.Is() )
214 aSuperClass->FillSbxMemberObject( rBase, pObj, rSuperList, bVariable );
217 /*************************************************************************
218 |* SvMetaClass::FillSbxObject()
221 *************************************************************************/
223 void SvMetaClass::FillSbxObject( SvIdlDataBase & rBase, SbxObject * pObj )
225 StringList aSuperList;
226 FillSbxMemberObject( rBase, pObj, aSuperList, sal_True );
227 FillSbxMemberObject( rBase, pObj, aSuperList, sal_False );
229 ByteString * pStr = aSuperList.First();
233 pStr = aSuperList.Next();
238 /*************************************************************************
239 |* SvMetaClass::ReadAttributesSvIdl()
242 *************************************************************************/
243 void SvMetaClass::ReadAttributesSvIdl( SvIdlDataBase
& rBase
,
244 SvTokenStream
& rInStm
)
246 SvMetaType::ReadAttributesSvIdl( rBase
, rInStm
);
247 aAutomation
.ReadSvIdl( SvHash_Automation(), rInStm
);
250 /*************************************************************************
251 |* SvMetaClass::WriteAttributesSvIdl()
254 *************************************************************************/
255 void SvMetaClass::WriteAttributesSvIdl( SvIdlDataBase
& rBase
,
256 SvStream
& rOutStm
, sal_uInt16 nTab
)
258 SvMetaType::WriteAttributesSvIdl( rBase
, rOutStm
, nTab
);
262 WriteTab( rOutStm
, nTab
);
263 rOutStm
<< "//class SvMetaClass" << endl
;
266 WriteTab( rOutStm
, nTab
);
267 aAutomation
.WriteSvIdl( SvHash_Automation(), rOutStm
);
268 rOutStm
<< ';' << endl
;
273 /*************************************************************************
274 |* SvMetaClass::ReadContextSvIdl()
277 *************************************************************************/
278 void SvMetaClass::ReadContextSvIdl( SvIdlDataBase
& rBase
,
279 SvTokenStream
& rInStm
)
281 sal_uInt32 nTokPos
= rInStm
.Tell();
282 SvToken
* pTok
= rInStm
.GetToken_Next();
284 if( pTok
->Is( SvHash_import() ) )
286 SvMetaClass
* pClass
= rBase
.ReadKnownClass( rInStm
);
289 SvClassElementRef xEle
= new SvClassElement();
290 xEle
->SetClass( pClass
);
291 aClassList
.Append( xEle
);
293 if( rInStm
.Read( '[' ) )
295 pTok
= rInStm
.GetToken_Next();
296 if( pTok
->Is( SvHash_Automation() ) )
298 if( rInStm
.Read( ']' ) )
300 if( xAutomationInterface
.Is() )
303 rBase
.SetError( "Automation allready set",
305 rBase
.WriteError( rInStm
);
307 xAutomationInterface
= pClass
;
308 xEle
->SetAutomation( sal_True
);
313 rBase
.SetError( "missing ]", rInStm
.GetToken() );
314 rBase
.WriteError( rInStm
);
320 rBase
.SetError( "only attribute Automation allowed",
322 rBase
.WriteError( rInStm
);
325 pTok
= rInStm
.GetToken();
326 if( pTok
->IsString() )
328 xEle
->SetPrefix( pTok
->GetString() );
329 rInStm
.GetToken_Next();
336 rBase
.SetError( "unknown imported interface", rInStm
.GetToken() );
337 rBase
.WriteError( rInStm
);
342 rInStm
.Seek( nTokPos
);
343 SvMetaType
* pType
= rBase
.ReadKnownType( rInStm
);
345 sal_Bool bOk
= sal_False
;
346 SvMetaAttributeRef xAttr
;
347 if( !pType
|| pType
->IsItem() )
349 xAttr
= new SvMetaSlot( pType
);
350 if( xAttr
->ReadSvIdl( rBase
, rInStm
) )
351 bOk
= xAttr
->Test( rBase
, rInStm
);
355 xAttr
= new SvMetaAttribute( pType
);
356 if( xAttr
->ReadSvIdl( rBase
, rInStm
) )
357 bOk
= xAttr
->Test( rBase
, rInStm
);
361 bOk
= TestAttribute( rBase
, rInStm
, *xAttr
);
364 if( !xAttr
->GetSlotId().IsSet() )
366 SvNumberIdentifier aI
;
367 aI
.SetValue( rBase
.GetUniqueId() );
368 xAttr
->SetSlotId( aI
);
370 aAttrList
.Append( xAttr
);
374 rInStm
.Seek( nTokPos
);
377 /*************************************************************************
378 |* SvMetaClass::WriteContextSvIdl()
381 *************************************************************************/
382 void SvMetaClass::WriteContextSvIdl
384 SvIdlDataBase
& rBase
,
389 //SvMetaType::WriteContextSvIdl( rBase, rOutStm, nTab );
391 for( n
= 0; n
< aAttrList
.Count(); n
++ )
393 WriteTab( rOutStm
, nTab
);
394 aAttrList
.GetObject( n
)->WriteSvIdl( rBase
, rOutStm
, nTab
);
395 rOutStm
<< ';' << endl
;
397 for( n
= 0; n
< aClassList
.Count(); n
++ )
399 SvClassElement
* pEle
= aClassList
.GetObject( n
);
400 WriteTab( rOutStm
, nTab
);
401 rOutStm
<< SvHash_import()->GetName().GetBuffer() << ' '
402 << pEle
->GetPrefix().GetBuffer();
403 if( pEle
->GetAutomation() )
404 rOutStm
<< " [ " << SvHash_Automation()->GetName().GetBuffer()
406 if( pEle
->GetPrefix().Len() )
407 rOutStm
<< ' ' << pEle
->GetPrefix().GetBuffer();
408 rOutStm
<< ';' << endl
;
412 /*************************************************************************
413 |* SvMetaClass::ReadSvIdl()
416 *************************************************************************/
417 sal_Bool
SvMetaClass::ReadSvIdl( SvIdlDataBase
& rBase
, SvTokenStream
& rInStm
)
419 sal_uLong nTokPos
= rInStm
.Tell();
420 if( SvMetaType::ReadHeaderSvIdl( rBase
, rInStm
) && GetType() == TYPE_CLASS
)
422 sal_Bool bOk
= sal_True
;
423 if( rInStm
.Read( ':' ) )
425 aSuperClass
= rBase
.ReadKnownClass( rInStm
);
426 bOk
= aSuperClass
.Is();
430 rBase
.SetError( "unknown super class",
432 rBase
.WriteError( rInStm
);
438 bOk
= SvMetaName::ReadSvIdl( rBase
, rInStm
);
443 rInStm
.Seek( nTokPos
);
447 /*************************************************************************
448 |* SvMetaClass::TestAttribute()
451 *************************************************************************/
452 sal_Bool
SvMetaClass::TestAttribute( SvIdlDataBase
& rBase
, SvTokenStream
& rInStm
,
453 SvMetaAttribute
& rAttr
) const
455 if ( !rAttr
.GetRef() && rAttr
.IsA( TYPE( SvMetaSlot
) ) )
457 DBG_ERROR( "Neuer Slot : " );
458 DBG_ERROR( rAttr
.GetSlotId().GetBuffer() );
461 for( sal_uLong n
= 0; n
< aAttrList
.Count(); n
++ )
463 SvMetaAttribute
* pS
= aAttrList
.GetObject( n
);
464 if( pS
->GetName() == rAttr
.GetName() )
466 // Werte muessen uebereinstimmen
467 if( pS
->GetSlotId().GetValue() != rAttr
.GetSlotId().GetValue() )
469 DBG_ERROR( "Gleicher Name in MetaClass : " );
470 DBG_ERROR( pS
->GetName().GetBuffer() );
471 DBG_ERROR( pS
->GetSlotId().GetBuffer() );
472 DBG_ERROR( rAttr
.GetSlotId().GetBuffer() );
474 ByteString
aStr( "Attribute's " );
475 aStr
+= pS
->GetName();
476 aStr
+= " with different id's";
477 rBase
.SetError( aStr
, rInStm
.GetToken() );
478 rBase
.WriteError( rInStm
);
484 sal_uInt32 nId1
= pS
->GetSlotId().GetValue();
485 sal_uInt32 nId2
= rAttr
.GetSlotId().GetValue();
486 if( nId1
== nId2
&& nId1
!= 0 /*&& nId2 != 0 ist ueberfluessig*/ )
488 DBG_ERROR( "Gleiche Id in MetaClass : " );
489 DBG_ERROR( ByteString::CreateFromInt32( pS
->GetSlotId().GetValue() ).GetBuffer() );
490 DBG_ERROR( pS
->GetSlotId().GetBuffer() );
491 DBG_ERROR( rAttr
.GetSlotId().GetBuffer() );
493 ByteString
aStr( "Attribute " );
494 aStr
+= pS
->GetName();
495 aStr
+= " and Attribute ";
496 aStr
+= rAttr
.GetName();
497 aStr
+= " with equal id's";
498 rBase
.SetError( aStr
, rInStm
.GetToken() );
499 rBase
.WriteError( rInStm
);
504 SvMetaClass
* pSC
= aSuperClass
;
506 return pSC
->TestAttribute( rBase
, rInStm
, rAttr
);
510 /*************************************************************************
511 |* SvMetaClass::WriteSvIdl()
514 *************************************************************************/
515 void SvMetaClass::WriteSvIdl( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
518 WriteHeaderSvIdl( rBase
, rOutStm
, nTab
);
519 if( aSuperClass
.Is() )
520 rOutStm
<< " : " << aSuperClass
->GetName().GetBuffer();
522 SvMetaName::WriteSvIdl( rBase
, rOutStm
, nTab
);
526 /*************************************************************************
527 |* SvMetaClass::WriteOdlMember()
530 *************************************************************************/
532 void SvMetaClass::WriteOdlMembers( ByteStringList & rSuperList,
533 sal_Bool bVariable, sal_Bool bWriteTab,
534 SvIdlDataBase & rBase,
535 SvStream & rOutStm, sal_uInt16 nTab )
537 // alle Attribute schreiben
539 for( n = 0; n < aAttrList.Count(); n++ )
541 SvMetaAttribute * pAttr = aAttrList.GetObject( n );
543 ByteString aMangleName = pAttr->GetMangleName( bVariable );
544 ByteString * pS = rBase.FindName( aMangleName, rSuperList );
546 if( !pS && pAttr->GetExport() )
549 if( bVariable && pAttr->IsVariable() )
551 rSuperList.Insert( new ByteString( aMangleName ), LIST_APPEND );
552 pAttr->Write( rBase, rOutStm, nTab +1, WRITE_ODL,
554 rOutStm << ';' << endl;
556 else if( !bVariable && pAttr->IsMethod() )
558 rSuperList.Insert( new ByteString( aMangleName ), LIST_APPEND );
559 pAttr->Write( rBase, rOutStm, nTab +1, WRITE_ODL,
561 rOutStm << ';' << endl;
567 // alle Attribute der importierten Klassen schreiben
568 for( n = 0; n < aClassList.Count(); n++ )
570 SvClassElement * pEle = aClassList.GetObject( n );
571 SvMetaClass * pCl = pEle->GetClass();
572 pCl->WriteOdlMembers( rSuperList, bVariable, bWriteTab,
573 rBase, rOutStm, nTab );
575 // alle Attribute der Superklassen schreiben
576 SvMetaClass * pSC = aSuperClass;
578 pSC->WriteOdlMembers( rSuperList, bVariable, bWriteTab,
579 rBase, rOutStm, nTab );
583 /*************************************************************************
584 |* SvMetaClass::Write()
587 *************************************************************************/
588 void SvMetaClass::Write( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
590 WriteType nT
, WriteAttribute
)
592 rBase
.aIFaceName
= GetName();
597 DBG_ERROR( "Not supported anymore!" );
599 // Schreibt die Attribute
600 SvMetaName::Write( rBase, rOutStm, nTab, nT, nA );
602 WriteTab( rOutStm, nTab );
603 rOutStm << "dispinterface " << GetName().GetBuffer() << endl;
604 WriteTab( rOutStm, nTab );
605 rOutStm << '{' << endl;
607 WriteTab( rOutStm, nTab );
608 rOutStm << "properties:";
611 StringList aSuperList;
612 WriteOdlMembers( aSuperList, sal_True, sal_True, rBase, rOutStm, nTab );
614 WriteTab( rOutStm, nTab );
615 rOutStm << "methods:";
618 WriteOdlMembers( aSuperList, sal_False, sal_True, rBase, rOutStm, nTab );
620 ByteString * pStr = aSuperList.First();
624 pStr = aSuperList.Next();
627 WriteTab( rOutStm, 1 );
628 rOutStm << '}' << endl;
635 DBG_ERROR( "Not supported anymore!" );
637 StringList aSuperList;
638 if( nT == WRITE_C_SOURCE )
640 rOutStm << "#pragma code_seg (\"" << GetName().GetBuffer()
641 << "\",\"CODE\")" << endl;
643 WriteCFunctions( aSuperList, rBase, rOutStm, nTab, nT );
649 rOutStm
<< "<INTERFACE>" << endl
650 << GetName().GetBuffer();
651 if ( GetAutomation() )
652 rOutStm
<< " ( Automation ) ";
654 WriteDescription( rOutStm
);
655 rOutStm
<< "</INTERFACE>" << endl
<< endl
;
657 // alle Attribute schreiben
659 for( n
= 0; n
< aAttrList
.Count(); n
++ )
661 SvMetaAttribute
* pAttr
= aAttrList
.GetObject( n
);
662 if( !pAttr
->GetHidden() )
664 if( pAttr
->IsMethod() )
665 pAttr
->Write( rBase
, rOutStm
, nTab
, nT
, WA_METHOD
);
667 if( pAttr
->IsVariable() )
668 pAttr
->Write( rBase
, rOutStm
, nTab
, nT
, WA_VARIABLE
);
679 /*************************************************************************
680 |* SvMetaClass::WriteSlotParamArray()
683 *************************************************************************/
684 sal_uInt16
SvMetaClass::WriteSlotParamArray( SvIdlDataBase
& rBase
,
685 SvSlotElementList
& rSlotList
,
688 sal_uInt16 nCount
= 0;
689 for( sal_uLong n
= 0; n
< rSlotList
.Count(); n
++ )
691 SvSlotElement
*pEle
= rSlotList
.GetObject( n
);
692 SvMetaSlot
*pAttr
= pEle
->xSlot
;
693 nCount
= nCount
+ pAttr
->WriteSlotParamArray( rBase
, rOutStm
);
699 /*************************************************************************
700 |* SvMetaClass::WriteSlots()
703 *************************************************************************/
704 sal_uInt16
SvMetaClass::WriteSlots( const ByteString
& rShellName
,
705 sal_uInt16 nCount
, SvSlotElementList
& rSlotList
,
706 SvIdlDataBase
& rBase
,
709 sal_uInt16 nSCount
= 0;
710 for( sal_uLong n
= 0; n
< rSlotList
.Count(); n
++ )
713 SvSlotElement
* pEle
= rSlotList
.GetCurObject();
714 SvMetaSlot
* pAttr
= pEle
->xSlot
;
715 nSCount
= nSCount
+ pAttr
->WriteSlotMap( rShellName
, nCount
+ nSCount
,
716 rSlotList
, pEle
->aPrefix
, rBase
,
723 /*************************************************************************
724 |* SvMetaClass::InsertSlots()
727 *************************************************************************/
728 void SvMetaClass::InsertSlots( SvSlotElementList
& rList
, SvULongs
& rSuperList
,
729 SvMetaClassList
&rClassList
,
730 const ByteString
& rPrefix
, SvIdlDataBase
& rBase
)
732 // Wurde diese Klasse schon geschrieben ?
733 if ( rClassList
.GetPos(this) != LIST_ENTRY_NOTFOUND
)
736 rClassList
.Insert(this, LIST_APPEND
);
738 // alle direkten Attribute schreiben
740 for( n
= 0; n
< aAttrList
.Count(); n
++ )
742 SvMetaAttribute
* pAttr
= aAttrList
.GetObject( n
);
744 sal_uLong nId
= pAttr
->GetSlotId().GetValue();
746 for ( nPos
=0; nPos
< rSuperList
.Count(); nPos
++ )
748 if ( rSuperList
.GetObject(nPos
) == nId
)
752 if( nPos
== rSuperList
.Count() )
754 // nur schreiben, wenn nicht schon bei SubClass oder
755 // importiertem Interface geschrieben
756 rSuperList
.Insert( nId
, nPos
);
757 pAttr
->Insert(rList
, rPrefix
, rBase
);
761 // Alle schon von SuperShells importierten Interfaces sollen nicht
762 // mehr geschrieben werden
763 // Es ist also verboten, da\s Shell und SuperShell die gleiche Klasse
764 // direkt importieren !
765 if( IsShell() && aSuperClass
.Is() )
766 aSuperClass
->FillClasses( rClassList
);
768 // alle Attribute der importierten Klassen schreiben, sofern diese nicht
769 // schon von der Superklasse importiert wurden
770 for( n
= 0; n
< aClassList
.Count(); n
++ )
772 SvClassElement
* pEle
= aClassList
.GetObject( n
);
773 SvMetaClass
* pCl
= pEle
->GetClass();
774 ByteString rPre
= rPrefix
;
775 if( rPre
.Len() && pEle
->GetPrefix().Len() )
777 rPre
+= pEle
->GetPrefix();
779 // Zun"achst die direkt importierten Interfaces schreiben
780 pCl
->InsertSlots( rList
, rSuperList
, rClassList
, rPre
, rBase
);
783 // Superklassen nur schreiben, wenn keine Shell und nicht in der Liste
784 if( !IsShell() && aSuperClass
.Is() )
786 aSuperClass
->InsertSlots( rList
, rSuperList
, rClassList
, rPrefix
, rBase
);
790 /*************************************************************************
791 |* SvMetaClass::FillClasses()
794 *************************************************************************/
795 void SvMetaClass::FillClasses( SvMetaClassList
& rList
)
797 // Bin ich noch nicht drin ?
798 if ( rList
.GetPos(this) == LIST_ENTRY_NOTFOUND
)
800 rList
.Insert(this, LIST_APPEND
);
803 for( sal_uLong n
= 0; n
< aClassList
.Count(); n
++ )
805 SvClassElement
* pEle
= aClassList
.GetObject( n
);
806 SvMetaClass
* pCl
= pEle
->GetClass();
807 pCl
->FillClasses( rList
);
811 if( aSuperClass
.Is() )
812 aSuperClass
->FillClasses( rList
);
817 /*************************************************************************
818 |* SvMetaClass::WriteSlotStubs()
821 *************************************************************************/
822 void SvMetaClass::WriteSlotStubs( const ByteString
& rShellName
,
823 SvSlotElementList
& rSlotList
,
824 ByteStringList
& rList
,
827 // alle Attribute schreiben
828 for( sal_uLong n
= 0; n
< rSlotList
.Count(); n
++ )
830 SvSlotElement
*pEle
= rSlotList
.GetObject( n
);
831 SvMetaSlot
*pAttr
= pEle
->xSlot
;
832 pAttr
->WriteSlotStubs( rShellName
, rList
, rOutStm
);
836 /*************************************************************************
837 |* SvMetaClass::WriteSfx()
840 *************************************************************************/
841 void SvMetaClass::WriteSfx( SvIdlDataBase
& rBase
, SvStream
& rOutStm
)
843 WriteStars( rOutStm
);
845 rOutStm
<< "#ifdef " << GetName().GetBuffer() << endl
;
846 rOutStm
<< "#undef ShellClass" << endl
;
847 rOutStm
<< "#undef " << GetName().GetBuffer() << endl
;
848 rOutStm
<< "#define ShellClass " << GetName().GetBuffer() << endl
;
850 // rOutStm << "SFX_TYPELIB(" << GetName().GetBuffer() << ',' << endl
851 // << "\t/* library type */"
852 // << '"' << ByteString( GetModule()->GetUUId().GetHexName(), RTL_TEXTENCODING_UTF8 ).GetBuffer() << "\"," << endl
853 // << "\t\"" << GetModule()->GetTypeLibFileName().GetBuffer() << "\","
854 // << ByteString::CreateFromInt32( GetModule()->GetVersion().GetMajorVersion() ).GetBuffer() << ','
855 // << ByteString::CreateFromInt32( GetModule()->GetVersion().GetMinorVersion() ).GetBuffer() << ',' << endl
856 // << "\t/* shell type */"
858 // if( xAutomationInterface.Is() )
859 // rOutStm << ByteString( xAutomationInterface->GetUUId().GetHexName(), RTL_TEXTENCODING_UTF8 ).GetBuffer();
861 // rOutStm << ByteString( GetUUId().GetHexName(), RTL_TEXTENCODING_UTF8 ).GetBuffer();
862 // rOutStm << "\");" << endl << endl;
864 // Fuer Interfaces werden kein Slotmaps geschrieben
867 rOutStm
<< "#endif" << endl
<< endl
;
870 // Parameter Array schreiben
871 //rOutStm << "SfxArgList " << GetName().GetBuffer() << "ArgMap[] = {" << endl;
872 rOutStm
<< "SFX_ARGUMENTMAP(" << GetName().GetBuffer() << ')' << endl
876 SvMetaClassList classList
;
877 SvSlotElementList aSlotList
;
878 InsertSlots(aSlotList
, aSuperList
, classList
, ByteString(), rBase
);
880 for ( n
=0; n
<aSlotList
.Count(); n
++ )
882 SvSlotElement
*pEle
= aSlotList
.GetObject( n
);
883 SvMetaSlot
*pSlot
= pEle
->xSlot
;
884 pSlot
->SetListPos(n
);
887 sal_uLong nSlotCount
= aSlotList
.Count();
889 // alle Attribute schreiben
890 sal_uInt16 nArgCount
= WriteSlotParamArray( rBase
, aSlotList
, rOutStm
);
892 Back2Delemitter( rOutStm
);
895 // mindestens einen dummy
896 WriteTab( rOutStm
, 1 );
897 rOutStm
<< "SFX_ARGUMENT( 0, 0, SfxVoidItem )" << endl
;
899 rOutStm
<< endl
<< "};" << endl
<< endl
;
901 ByteStringList aStringList
;
902 WriteSlotStubs( GetName(), aSlotList
, aStringList
, rOutStm
);
903 ByteString
* pStr
= aStringList
.First();
907 pStr
= aStringList
.Next();
913 rOutStm
<< "SFX_SLOTMAP_ARG(" << GetName().GetBuffer() << ')' << endl
916 // alle Attribute schreiben
917 WriteSlots( GetName(), 0, aSlotList
, rBase
, rOutStm
);
919 Back2Delemitter( rOutStm
);
922 // mindestens einen dummy
923 WriteTab( rOutStm
, 1 );
924 rOutStm
<< "SFX_SLOT_ARG(" << GetName().GetBuffer()
926 << "SFX_STUB_PTR_EXEC_NONE,"
927 << "SFX_STUB_PTR_STATE_NONE,"
928 << "0, SfxVoidItem, 0, 0, \"\", 0 )" << endl
;
930 rOutStm
<< endl
<< "};" << endl
<< "#endif" << endl
<< endl
;
932 for( n
=0; n
<aSlotList
.Count(); n
++ )
935 SvSlotElement
* pEle
= aSlotList
.GetCurObject();
936 SvMetaSlot
* pAttr
= pEle
->xSlot
;
937 pAttr
->ResetSlotPointer();
940 for ( n
=0; n
<aSlotList
.Count(); n
++ )
941 delete aSlotList
.GetObject(n
);
944 void SvMetaClass::WriteHelpIds( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
947 for( sal_uLong n
=0; n
<aAttrList
.Count(); n
++ )
949 SvMetaAttribute
* pAttr
= aAttrList
.GetObject( n
);
950 pAttr
->WriteHelpId( rBase
, rOutStm
, pTable
);
954 /*************************************************************************
955 |* SvMetaShell::WriteSrc()
956 *************************************************************************/
957 void SvMetaClass::WriteSrc( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
960 for( sal_uLong n
=0; n
<aAttrList
.Count(); n
++ )
962 SvMetaAttribute
* pAttr
= aAttrList
.GetObject( n
);
963 pAttr
->WriteSrc( rBase
, rOutStm
, pTable
);
967 /*************************************************************************
968 |* SvMetaClass::WriteHxx()
971 *************************************************************************/
972 void SvMetaClass::WriteHxx( SvIdlDataBase
&, SvStream
& rOutStm
, sal_uInt16
)
974 ByteString
aSuperName( "SvDispatch" );
975 if( GetSuperClass() )
976 aSuperName
= GetSuperClass()->GetName();
977 const char * pSup
= aSuperName
.GetBuffer();
980 << "class " << GetSvName().GetBuffer()
981 << ": public " << pSup
<< endl
983 << "protected:" << endl
984 << "\tvirtual SvGlobalName GetTypeName() const;" << endl
985 << "\tvirtual sal_Bool FillTypeLibInfo( SvGlobalName *, sal_uInt16 * pMajor," << endl
986 << "\t sal_uInt16 * pMinor ) const;" << endl
987 << "\tvirtual sal_Bool FillTypeLibInfo( ByteString * pName, sal_uInt16 * pMajor," << endl
;
989 << "\t sal_uInt16 * pMinor ) const;" << endl
990 << "\tvirtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) = 0;" << endl
992 << "\t static SvGlobalName ClassName()" << endl
993 << "\t { return SvGlobalName( " << ByteString( GetUUId().GetctorName(), RTL_TEXTENCODING_UTF8
).GetBuffer() << " ); }" << endl
997 /*************************************************************************
998 |* SvMetaClass::WriteCxx()
1001 *************************************************************************/
1002 void SvMetaClass::WriteCxx( SvIdlDataBase
&, SvStream
& rOutStm
, sal_uInt16
)
1004 ByteString
aSuperName( "SvDispatch" );
1005 if( GetSuperClass() )
1006 aSuperName
= GetSuperClass()->GetName();
1007 const char * pSup
= aSuperName
.GetBuffer();
1009 ByteString name
= GetSvName();
1011 rOutStm
<< "SvGlobalName " << name
.GetBuffer() << "::GetTypeName() const" << endl
1013 << "\treturn ClassName();" << endl
1016 SvMetaModule
* pMod
= GetModule();
1018 rOutStm
<< "sal_Bool " << name
.GetBuffer() << "::FillTypeLibInfo( SvGlobalName * pGN," << endl
1019 << "\t sal_uInt16 * pMajor," << endl
1020 << "\t sal_uInt16 * pMinor ) const" << endl
1022 << "\tSvGlobalName aN( " << ByteString( pMod
->GetUUId().GetctorName(), RTL_TEXTENCODING_UTF8
).GetBuffer() << " );" << endl
;
1023 rOutStm
<< "\t*pGN = aN;" << endl
1024 << "\t*pMajor = " << ByteString::CreateFromInt32(pMod
->GetVersion().GetMajorVersion()).GetBuffer() << ';' << endl
1025 << "\t*pMinor = " << ByteString::CreateFromInt32(pMod
->GetVersion().GetMinorVersion()).GetBuffer() << ';' << endl
1026 << "\treturn sal_True;" << endl
1030 rOutStm
<< "sal_Bool " << name
.GetBuffer() << "::FillTypeLibInfo( ByteString * pName,"
1031 << "\t sal_uInt16 * pMajor," << endl
1032 << "\t sal_uInt16 * pMinor ) const" << endl
;
1033 rOutStm
<< '{' << endl
1034 << "\t*pName = \"" << pMod
->GetTypeLibFileName().GetBuffer() << "\";" << endl
1035 << "\t*pMajor = " << ByteString::CreateFromInt32(pMod
->GetVersion().GetMajorVersion()).GetBuffer() << ';' << endl
1036 << "\t*pMinor = " << ByteString::CreateFromInt32(pMod
->GetVersion().GetMinorVersion()).GetBuffer() << ';' << endl
1037 << "\treturn sal_True;" << endl
1040 rOutStm
<< "void " << name
.GetBuffer() << "::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )" << endl
1042 << "\t" << pSup
<< "::Notify( rBC, rHint );" << endl
1046 #endif // IDL_COMPILER