1*724893d4SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*724893d4SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*724893d4SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*724893d4SAndrew Rist * distributed with this work for additional information 6*724893d4SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*724893d4SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*724893d4SAndrew Rist * "License"); you may not use this file except in compliance 9*724893d4SAndrew Rist * with the License. You may obtain a copy of the License at 10*724893d4SAndrew Rist * 11*724893d4SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*724893d4SAndrew Rist * 13*724893d4SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*724893d4SAndrew Rist * software distributed under the License is distributed on an 15*724893d4SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*724893d4SAndrew Rist * KIND, either express or implied. See the License for the 17*724893d4SAndrew Rist * specific language governing permissions and limitations 18*724893d4SAndrew Rist * under the License. 19*724893d4SAndrew Rist * 20*724893d4SAndrew Rist *************************************************************/ 21*724893d4SAndrew Rist 22*724893d4SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_idl.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <ctype.h> 28cdf0e10cSrcweir #include <stdio.h> 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include <tools/debug.hxx> 31cdf0e10cSrcweir 32cdf0e10cSrcweir #include <attrib.hxx> 33cdf0e10cSrcweir #include <object.hxx> 34cdf0e10cSrcweir #include <globals.hxx> 35cdf0e10cSrcweir #include <database.hxx> 36cdf0e10cSrcweir 37cdf0e10cSrcweir /******************** class SvClassElement *******************************/ 38cdf0e10cSrcweir SV_IMPL_PERSIST1( SvClassElement, SvPersistBase ); 39cdf0e10cSrcweir 40cdf0e10cSrcweir /************************************************************************* 41cdf0e10cSrcweir |* SvClassElement::SvClassElement() 42cdf0e10cSrcweir |* 43cdf0e10cSrcweir |* Beschreibung 44cdf0e10cSrcweir *************************************************************************/ 45cdf0e10cSrcweir SvClassElement::SvClassElement() 46cdf0e10cSrcweir { 47cdf0e10cSrcweir }; 48cdf0e10cSrcweir 49cdf0e10cSrcweir /************************************************************************* 50cdf0e10cSrcweir |* SvClassElement::Load() 51cdf0e10cSrcweir |* 52cdf0e10cSrcweir |* Beschreibung 53cdf0e10cSrcweir *************************************************************************/ 54cdf0e10cSrcweir void SvClassElement::Load( SvPersistStream & rStm ) 55cdf0e10cSrcweir { 56cdf0e10cSrcweir sal_uInt8 nMask; 57cdf0e10cSrcweir rStm >> nMask; 58cdf0e10cSrcweir if( nMask >= 0x08 ) 59cdf0e10cSrcweir { 60cdf0e10cSrcweir rStm.SetError( SVSTREAM_FILEFORMAT_ERROR ); 61cdf0e10cSrcweir DBG_ERROR( "wrong format" ); 62cdf0e10cSrcweir return; 63cdf0e10cSrcweir } 64cdf0e10cSrcweir if( nMask & 0x01 ) rStm >> aAutomation; 65cdf0e10cSrcweir if( nMask & 0x02 ) rStm.ReadByteString( aPrefix ); 66cdf0e10cSrcweir if( nMask & 0x04 ) 67cdf0e10cSrcweir { 68cdf0e10cSrcweir SvMetaClass * p; 69cdf0e10cSrcweir rStm >> p; 70cdf0e10cSrcweir xClass = p; 71cdf0e10cSrcweir } 72cdf0e10cSrcweir } 73cdf0e10cSrcweir 74cdf0e10cSrcweir /************************************************************************* 75cdf0e10cSrcweir |* SvClassElement::Save() 76cdf0e10cSrcweir |* 77cdf0e10cSrcweir |* Beschreibung 78cdf0e10cSrcweir *************************************************************************/ 79cdf0e10cSrcweir void SvClassElement::Save( SvPersistStream & rStm ) 80cdf0e10cSrcweir { 81cdf0e10cSrcweir // Maske erstellen 82cdf0e10cSrcweir sal_uInt8 nMask = 0; 83cdf0e10cSrcweir if( aAutomation.IsSet() ) nMask |= 0x1; 84cdf0e10cSrcweir if( aPrefix.Len() ) nMask |= 0x2; 85cdf0e10cSrcweir if( xClass.Is() ) nMask |= 0x4; 86cdf0e10cSrcweir 87cdf0e10cSrcweir // Daten schreiben 88cdf0e10cSrcweir rStm << nMask; 89cdf0e10cSrcweir if( nMask & 0x01 ) rStm << aAutomation; 90cdf0e10cSrcweir if( nMask & 0x02 ) rStm.WriteByteString( aPrefix ); 91cdf0e10cSrcweir if( nMask & 0x04 ) rStm << xClass; 92cdf0e10cSrcweir } 93cdf0e10cSrcweir 94cdf0e10cSrcweir /****************** SvMetaClass ******************************************/ 95cdf0e10cSrcweir SV_IMPL_META_FACTORY1( SvMetaClass, SvMetaType ); 96cdf0e10cSrcweir /************************************************************************* 97cdf0e10cSrcweir |* SvMetaClass::SvMetaClass() 98cdf0e10cSrcweir |* 99cdf0e10cSrcweir |* Beschreibung 100cdf0e10cSrcweir *************************************************************************/ 101cdf0e10cSrcweir SvMetaClass::SvMetaClass() 102cdf0e10cSrcweir : aAutomation( sal_True, sal_False ) 103cdf0e10cSrcweir { 104cdf0e10cSrcweir } 105cdf0e10cSrcweir 106cdf0e10cSrcweir /************************************************************************* 107cdf0e10cSrcweir |* SvMetaClass::Load() 108cdf0e10cSrcweir |* 109cdf0e10cSrcweir |* Beschreibung 110cdf0e10cSrcweir *************************************************************************/ 111cdf0e10cSrcweir void SvMetaClass::Load( SvPersistStream & rStm ) 112cdf0e10cSrcweir { 113cdf0e10cSrcweir SvMetaType::Load( rStm ); 114cdf0e10cSrcweir 115cdf0e10cSrcweir sal_uInt8 nMask; 116cdf0e10cSrcweir rStm >> nMask; 117cdf0e10cSrcweir if( nMask >= 0x20 ) 118cdf0e10cSrcweir { 119cdf0e10cSrcweir rStm.SetError( SVSTREAM_FILEFORMAT_ERROR ); 120cdf0e10cSrcweir DBG_ERROR( "wrong format" ); 121cdf0e10cSrcweir return; 122cdf0e10cSrcweir } 123cdf0e10cSrcweir if( nMask & 0x01 ) rStm >> aAttrList; 124cdf0e10cSrcweir if( nMask & 0x02 ) 125cdf0e10cSrcweir { 126cdf0e10cSrcweir SvMetaClass * pSuper; 127cdf0e10cSrcweir rStm >> pSuper; 128cdf0e10cSrcweir aSuperClass = pSuper; 129cdf0e10cSrcweir } 130cdf0e10cSrcweir if( nMask & 0x04 ) rStm >> aClassList; 131cdf0e10cSrcweir if( nMask & 0x8 ) 132cdf0e10cSrcweir { 133cdf0e10cSrcweir SvMetaClass * p; 134cdf0e10cSrcweir rStm >> p; 135cdf0e10cSrcweir xAutomationInterface = p; 136cdf0e10cSrcweir } 137cdf0e10cSrcweir if( nMask & 0x10 ) rStm >> aAutomation; 138cdf0e10cSrcweir } 139cdf0e10cSrcweir 140cdf0e10cSrcweir /************************************************************************* 141cdf0e10cSrcweir |* SvMetaClass::Save() 142cdf0e10cSrcweir |* 143cdf0e10cSrcweir |* Beschreibung 144cdf0e10cSrcweir *************************************************************************/ 145cdf0e10cSrcweir void SvMetaClass::Save( SvPersistStream & rStm ) 146cdf0e10cSrcweir { 147cdf0e10cSrcweir SvMetaType::Save( rStm ); 148cdf0e10cSrcweir 149cdf0e10cSrcweir // Maske erstellen 150cdf0e10cSrcweir sal_uInt8 nMask = 0; 151cdf0e10cSrcweir if( aAttrList.Count() ) nMask |= 0x1; 152cdf0e10cSrcweir if( aSuperClass.Is() ) nMask |= 0x2; 153cdf0e10cSrcweir if( aClassList.Count() ) nMask |= 0x4; 154cdf0e10cSrcweir if( xAutomationInterface.Is() ) nMask |= 0x8; 155cdf0e10cSrcweir if( aAutomation.IsSet() ) nMask |= 0x10; 156cdf0e10cSrcweir 157cdf0e10cSrcweir // Daten schreiben 158cdf0e10cSrcweir rStm << nMask; 159cdf0e10cSrcweir if( nMask & 0x01 ) rStm << aAttrList; 160cdf0e10cSrcweir if( nMask & 0x02 ) rStm << aSuperClass; 161cdf0e10cSrcweir if( nMask & 0x04 ) rStm << aClassList; 162cdf0e10cSrcweir if( nMask & 0x08 ) rStm << xAutomationInterface; 163cdf0e10cSrcweir if( nMask & 0x10 ) rStm << aAutomation; 164cdf0e10cSrcweir } 165cdf0e10cSrcweir 166cdf0e10cSrcweir /************************************************************************* 167cdf0e10cSrcweir |* SvMetaClass::FillSbxObject() 168cdf0e10cSrcweir |* 169cdf0e10cSrcweir |* Beschreibung 170cdf0e10cSrcweir *************************************************************************/ 171cdf0e10cSrcweir /* 172cdf0e10cSrcweir void SvMetaClass::FillSbxMemberObject( SvIdlDataBase & rBase, 173cdf0e10cSrcweir SbxObject * pObj, 174cdf0e10cSrcweir StringList & rSuperList, 175cdf0e10cSrcweir sal_Bool bVariable ) 176cdf0e10cSrcweir { 177cdf0e10cSrcweir // alle Attribute der Klasse schreiben 178cdf0e10cSrcweir sal_uLong n ; 179cdf0e10cSrcweir for( n = 0; n < aAttrList.Count(); n++ ) 180cdf0e10cSrcweir { 181cdf0e10cSrcweir SvMetaAttribute * pAttr = aAttrList.GetObject( n ); 182cdf0e10cSrcweir 183cdf0e10cSrcweir ByteString aMangleName = pAttr->GetMangleName( bVariable ); 184cdf0e10cSrcweir ByteString * pS = SvIdlDataBase::FindName( aMangleName, rSuperList ); 185cdf0e10cSrcweir 186cdf0e10cSrcweir if( !pS && pAttr->GetExport() ) 187cdf0e10cSrcweir { 188cdf0e10cSrcweir // nicht doppelt 189cdf0e10cSrcweir if( bVariable && pAttr->IsVariable() ) 190cdf0e10cSrcweir { 191cdf0e10cSrcweir rSuperList.Insert( new ByteString( aMangleName ), LIST_APPEND ); 192cdf0e10cSrcweir pAttr->FillSbxObject( rBase, pObj, bVariable ); 193cdf0e10cSrcweir } 194cdf0e10cSrcweir else if( !bVariable && pAttr->IsMethod() ) 195cdf0e10cSrcweir { 196cdf0e10cSrcweir rSuperList.Insert( new ByteString( aMangleName ), LIST_APPEND ); 197cdf0e10cSrcweir pAttr->FillSbxObject( rBase, pObj, bVariable ); 198cdf0e10cSrcweir } 199cdf0e10cSrcweir } 200cdf0e10cSrcweir } 201cdf0e10cSrcweir // alle Attribute der importierten Klassen schreiben 202cdf0e10cSrcweir for( n = 0; n < aClassList.Count(); n++ ) 203cdf0e10cSrcweir { 204cdf0e10cSrcweir SvClassElement * pEle = aClassList.GetObject( n ); 205cdf0e10cSrcweir SvMetaClass * pClass = pEle->GetClass(); 206cdf0e10cSrcweir pClass->FillSbxMemberObject( rBase, pObj, rSuperList, bVariable ); 207cdf0e10cSrcweir } 208cdf0e10cSrcweir // alle Attribute der Superklassen schreiben 209cdf0e10cSrcweir if( aSuperClass.Is() ) 210cdf0e10cSrcweir aSuperClass->FillSbxMemberObject( rBase, pObj, rSuperList, bVariable ); 211cdf0e10cSrcweir } 212cdf0e10cSrcweir */ 213cdf0e10cSrcweir /************************************************************************* 214cdf0e10cSrcweir |* SvMetaClass::FillSbxObject() 215cdf0e10cSrcweir |* 216cdf0e10cSrcweir |* Beschreibung 217cdf0e10cSrcweir *************************************************************************/ 218cdf0e10cSrcweir /* 219cdf0e10cSrcweir void SvMetaClass::FillSbxObject( SvIdlDataBase & rBase, SbxObject * pObj ) 220cdf0e10cSrcweir { 221cdf0e10cSrcweir StringList aSuperList; 222cdf0e10cSrcweir FillSbxMemberObject( rBase, pObj, aSuperList, sal_True ); 223cdf0e10cSrcweir FillSbxMemberObject( rBase, pObj, aSuperList, sal_False ); 224cdf0e10cSrcweir 225cdf0e10cSrcweir ByteString * pStr = aSuperList.First(); 226cdf0e10cSrcweir while( pStr ) 227cdf0e10cSrcweir { 228cdf0e10cSrcweir delete pStr; 229cdf0e10cSrcweir pStr = aSuperList.Next(); 230cdf0e10cSrcweir } 231cdf0e10cSrcweir } 232cdf0e10cSrcweir */ 233cdf0e10cSrcweir #ifdef IDL_COMPILER 234cdf0e10cSrcweir /************************************************************************* 235cdf0e10cSrcweir |* SvMetaClass::ReadAttributesSvIdl() 236cdf0e10cSrcweir |* 237cdf0e10cSrcweir |* Beschreibung 238cdf0e10cSrcweir *************************************************************************/ 239cdf0e10cSrcweir void SvMetaClass::ReadAttributesSvIdl( SvIdlDataBase & rBase, 240cdf0e10cSrcweir SvTokenStream & rInStm ) 241cdf0e10cSrcweir { 242cdf0e10cSrcweir SvMetaType::ReadAttributesSvIdl( rBase, rInStm ); 243cdf0e10cSrcweir aAutomation.ReadSvIdl( SvHash_Automation(), rInStm ); 244cdf0e10cSrcweir } 245cdf0e10cSrcweir 246cdf0e10cSrcweir /************************************************************************* 247cdf0e10cSrcweir |* SvMetaClass::WriteAttributesSvIdl() 248cdf0e10cSrcweir |* 249cdf0e10cSrcweir |* Beschreibung 250cdf0e10cSrcweir *************************************************************************/ 251cdf0e10cSrcweir void SvMetaClass::WriteAttributesSvIdl( SvIdlDataBase & rBase, 252cdf0e10cSrcweir SvStream & rOutStm, sal_uInt16 nTab ) 253cdf0e10cSrcweir { 254cdf0e10cSrcweir SvMetaType::WriteAttributesSvIdl( rBase, rOutStm, nTab ); 255cdf0e10cSrcweir 256cdf0e10cSrcweir if( !aAutomation ) 257cdf0e10cSrcweir { 258cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 259cdf0e10cSrcweir rOutStm << "//class SvMetaClass" << endl; 260cdf0e10cSrcweir if( !aAutomation ) 261cdf0e10cSrcweir { 262cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 263cdf0e10cSrcweir aAutomation.WriteSvIdl( SvHash_Automation(), rOutStm ); 264cdf0e10cSrcweir rOutStm << ';' << endl; 265cdf0e10cSrcweir } 266cdf0e10cSrcweir } 267cdf0e10cSrcweir } 268cdf0e10cSrcweir 269cdf0e10cSrcweir /************************************************************************* 270cdf0e10cSrcweir |* SvMetaClass::ReadContextSvIdl() 271cdf0e10cSrcweir |* 272cdf0e10cSrcweir |* Beschreibung 273cdf0e10cSrcweir *************************************************************************/ 274cdf0e10cSrcweir void SvMetaClass::ReadContextSvIdl( SvIdlDataBase & rBase, 275cdf0e10cSrcweir SvTokenStream & rInStm ) 276cdf0e10cSrcweir { 277cdf0e10cSrcweir sal_uInt32 nTokPos = rInStm.Tell(); 278cdf0e10cSrcweir SvToken * pTok = rInStm.GetToken_Next(); 279cdf0e10cSrcweir 280cdf0e10cSrcweir if( pTok->Is( SvHash_import() ) ) 281cdf0e10cSrcweir { 282cdf0e10cSrcweir SvMetaClass * pClass = rBase.ReadKnownClass( rInStm ); 283cdf0e10cSrcweir if( pClass ) 284cdf0e10cSrcweir { 285cdf0e10cSrcweir SvClassElementRef xEle = new SvClassElement(); 286cdf0e10cSrcweir xEle->SetClass( pClass ); 287cdf0e10cSrcweir aClassList.Append( xEle ); 288cdf0e10cSrcweir 289cdf0e10cSrcweir if( rInStm.Read( '[' ) ) 290cdf0e10cSrcweir { 291cdf0e10cSrcweir pTok = rInStm.GetToken_Next(); 292cdf0e10cSrcweir if( pTok->Is( SvHash_Automation() ) ) 293cdf0e10cSrcweir { 294cdf0e10cSrcweir if( rInStm.Read( ']' ) ) 295cdf0e10cSrcweir { 296cdf0e10cSrcweir if( xAutomationInterface.Is() ) 297cdf0e10cSrcweir { 298cdf0e10cSrcweir // Fehler setzen 299cdf0e10cSrcweir rBase.SetError( "Automation allready set", 300cdf0e10cSrcweir rInStm.GetToken() ); 301cdf0e10cSrcweir rBase.WriteError( rInStm ); 302cdf0e10cSrcweir } 303cdf0e10cSrcweir xAutomationInterface = pClass; 304cdf0e10cSrcweir xEle->SetAutomation( sal_True ); 305cdf0e10cSrcweir } 306cdf0e10cSrcweir else 307cdf0e10cSrcweir { 308cdf0e10cSrcweir // Fehler setzen 309cdf0e10cSrcweir rBase.SetError( "missing ]", rInStm.GetToken() ); 310cdf0e10cSrcweir rBase.WriteError( rInStm ); 311cdf0e10cSrcweir } 312cdf0e10cSrcweir } 313cdf0e10cSrcweir else 314cdf0e10cSrcweir { 315cdf0e10cSrcweir // Fehler setzen 316cdf0e10cSrcweir rBase.SetError( "only attribute Automation allowed", 317cdf0e10cSrcweir rInStm.GetToken() ); 318cdf0e10cSrcweir rBase.WriteError( rInStm ); 319cdf0e10cSrcweir } 320cdf0e10cSrcweir } 321cdf0e10cSrcweir pTok = rInStm.GetToken(); 322cdf0e10cSrcweir if( pTok->IsString() ) 323cdf0e10cSrcweir { 324cdf0e10cSrcweir xEle->SetPrefix( pTok->GetString() ); 325cdf0e10cSrcweir rInStm.GetToken_Next(); 326cdf0e10cSrcweir } 327cdf0e10cSrcweir return; 328cdf0e10cSrcweir } 329cdf0e10cSrcweir else 330cdf0e10cSrcweir { 331cdf0e10cSrcweir // Fehler setzen 332cdf0e10cSrcweir rBase.SetError( "unknown imported interface", rInStm.GetToken() ); 333cdf0e10cSrcweir rBase.WriteError( rInStm ); 334cdf0e10cSrcweir } 335cdf0e10cSrcweir } 336cdf0e10cSrcweir else 337cdf0e10cSrcweir { 338cdf0e10cSrcweir rInStm.Seek( nTokPos ); 339cdf0e10cSrcweir SvMetaType * pType = rBase.ReadKnownType( rInStm ); 340cdf0e10cSrcweir 341cdf0e10cSrcweir sal_Bool bOk = sal_False; 342cdf0e10cSrcweir SvMetaAttributeRef xAttr; 343cdf0e10cSrcweir if( !pType || pType->IsItem() ) 344cdf0e10cSrcweir { 345cdf0e10cSrcweir xAttr = new SvMetaSlot( pType ); 346cdf0e10cSrcweir if( xAttr->ReadSvIdl( rBase, rInStm ) ) 347cdf0e10cSrcweir bOk = xAttr->Test( rBase, rInStm ); 348cdf0e10cSrcweir } 349cdf0e10cSrcweir else 350cdf0e10cSrcweir { 351cdf0e10cSrcweir xAttr = new SvMetaAttribute( pType ); 352cdf0e10cSrcweir if( xAttr->ReadSvIdl( rBase, rInStm ) ) 353cdf0e10cSrcweir bOk = xAttr->Test( rBase, rInStm ); 354cdf0e10cSrcweir } 355cdf0e10cSrcweir 356cdf0e10cSrcweir if( bOk ) 357cdf0e10cSrcweir bOk = TestAttribute( rBase, rInStm, *xAttr ); 358cdf0e10cSrcweir if( bOk ) 359cdf0e10cSrcweir { 360cdf0e10cSrcweir if( !xAttr->GetSlotId().IsSet() ) 361cdf0e10cSrcweir { 362cdf0e10cSrcweir SvNumberIdentifier aI; 363cdf0e10cSrcweir aI.SetValue( rBase.GetUniqueId() ); 364cdf0e10cSrcweir xAttr->SetSlotId( aI ); 365cdf0e10cSrcweir } 366cdf0e10cSrcweir aAttrList.Append( xAttr ); 367cdf0e10cSrcweir return; 368cdf0e10cSrcweir } 369cdf0e10cSrcweir } 370cdf0e10cSrcweir rInStm.Seek( nTokPos ); 371cdf0e10cSrcweir } 372cdf0e10cSrcweir 373cdf0e10cSrcweir /************************************************************************* 374cdf0e10cSrcweir |* SvMetaClass::WriteContextSvIdl() 375cdf0e10cSrcweir |* 376cdf0e10cSrcweir |* Beschreibung 377cdf0e10cSrcweir *************************************************************************/ 378cdf0e10cSrcweir void SvMetaClass::WriteContextSvIdl 379cdf0e10cSrcweir ( 380cdf0e10cSrcweir SvIdlDataBase & rBase, 381cdf0e10cSrcweir SvStream & rOutStm, 382cdf0e10cSrcweir sal_uInt16 nTab 383cdf0e10cSrcweir ) 384cdf0e10cSrcweir { 385cdf0e10cSrcweir //SvMetaType::WriteContextSvIdl( rBase, rOutStm, nTab ); 386cdf0e10cSrcweir sal_uLong n; 387cdf0e10cSrcweir for( n = 0; n < aAttrList.Count(); n++ ) 388cdf0e10cSrcweir { 389cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 390cdf0e10cSrcweir aAttrList.GetObject( n )->WriteSvIdl( rBase, rOutStm, nTab ); 391cdf0e10cSrcweir rOutStm << ';' << endl; 392cdf0e10cSrcweir } 393cdf0e10cSrcweir for( n = 0; n < aClassList.Count(); n++ ) 394cdf0e10cSrcweir { 395cdf0e10cSrcweir SvClassElement * pEle = aClassList.GetObject( n ); 396cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 397cdf0e10cSrcweir rOutStm << SvHash_import()->GetName().GetBuffer() << ' ' 398cdf0e10cSrcweir << pEle->GetPrefix().GetBuffer(); 399cdf0e10cSrcweir if( pEle->GetAutomation() ) 400cdf0e10cSrcweir rOutStm << " [ " << SvHash_Automation()->GetName().GetBuffer() 401cdf0e10cSrcweir << " ]"; 402cdf0e10cSrcweir if( pEle->GetPrefix().Len() ) 403cdf0e10cSrcweir rOutStm << ' ' << pEle->GetPrefix().GetBuffer(); 404cdf0e10cSrcweir rOutStm << ';' << endl; 405cdf0e10cSrcweir } 406cdf0e10cSrcweir } 407cdf0e10cSrcweir 408cdf0e10cSrcweir /************************************************************************* 409cdf0e10cSrcweir |* SvMetaClass::ReadSvIdl() 410cdf0e10cSrcweir |* 411cdf0e10cSrcweir |* Beschreibung 412cdf0e10cSrcweir *************************************************************************/ 413cdf0e10cSrcweir sal_Bool SvMetaClass::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) 414cdf0e10cSrcweir { 415cdf0e10cSrcweir sal_uLong nTokPos = rInStm.Tell(); 416cdf0e10cSrcweir if( SvMetaType::ReadHeaderSvIdl( rBase, rInStm ) && GetType() == TYPE_CLASS ) 417cdf0e10cSrcweir { 418cdf0e10cSrcweir sal_Bool bOk = sal_True; 419cdf0e10cSrcweir if( rInStm.Read( ':' ) ) 420cdf0e10cSrcweir { 421cdf0e10cSrcweir aSuperClass = rBase.ReadKnownClass( rInStm ); 422cdf0e10cSrcweir bOk = aSuperClass.Is(); 423cdf0e10cSrcweir if( !bOk ) 424cdf0e10cSrcweir { 425cdf0e10cSrcweir // Fehler setzen 426cdf0e10cSrcweir rBase.SetError( "unknown super class", 427cdf0e10cSrcweir rInStm.GetToken() ); 428cdf0e10cSrcweir rBase.WriteError( rInStm ); 429cdf0e10cSrcweir } 430cdf0e10cSrcweir } 431cdf0e10cSrcweir if( bOk ) 432cdf0e10cSrcweir { 433cdf0e10cSrcweir rBase.Write( '.' ); 434cdf0e10cSrcweir bOk = SvMetaName::ReadSvIdl( rBase, rInStm ); 435cdf0e10cSrcweir } 436cdf0e10cSrcweir if( bOk ) 437cdf0e10cSrcweir return bOk; 438cdf0e10cSrcweir } 439cdf0e10cSrcweir rInStm.Seek( nTokPos ); 440cdf0e10cSrcweir return sal_False; 441cdf0e10cSrcweir } 442cdf0e10cSrcweir 443cdf0e10cSrcweir /************************************************************************* 444cdf0e10cSrcweir |* SvMetaClass::TestAttribute() 445cdf0e10cSrcweir |* 446cdf0e10cSrcweir |* Beschreibung 447cdf0e10cSrcweir *************************************************************************/ 448cdf0e10cSrcweir sal_Bool SvMetaClass::TestAttribute( SvIdlDataBase & rBase, SvTokenStream & rInStm, 449cdf0e10cSrcweir SvMetaAttribute & rAttr ) const 450cdf0e10cSrcweir { 451cdf0e10cSrcweir if ( !rAttr.GetRef() && rAttr.IsA( TYPE( SvMetaSlot ) ) ) 452cdf0e10cSrcweir { 453cdf0e10cSrcweir DBG_ERROR( "Neuer Slot : " ); 454cdf0e10cSrcweir DBG_ERROR( rAttr.GetSlotId().GetBuffer() ); 455cdf0e10cSrcweir } 456cdf0e10cSrcweir 457cdf0e10cSrcweir for( sal_uLong n = 0; n < aAttrList.Count(); n++ ) 458cdf0e10cSrcweir { 459cdf0e10cSrcweir SvMetaAttribute * pS = aAttrList.GetObject( n ); 460cdf0e10cSrcweir if( pS->GetName() == rAttr.GetName() ) 461cdf0e10cSrcweir { 462cdf0e10cSrcweir // Werte muessen uebereinstimmen 463cdf0e10cSrcweir if( pS->GetSlotId().GetValue() != rAttr.GetSlotId().GetValue() ) 464cdf0e10cSrcweir { 465cdf0e10cSrcweir DBG_ERROR( "Gleicher Name in MetaClass : " ); 466cdf0e10cSrcweir DBG_ERROR( pS->GetName().GetBuffer() ); 467cdf0e10cSrcweir DBG_ERROR( pS->GetSlotId().GetBuffer() ); 468cdf0e10cSrcweir DBG_ERROR( rAttr.GetSlotId().GetBuffer() ); 469cdf0e10cSrcweir 470cdf0e10cSrcweir ByteString aStr( "Attribute's " ); 471cdf0e10cSrcweir aStr += pS->GetName(); 472cdf0e10cSrcweir aStr += " with different id's"; 473cdf0e10cSrcweir rBase.SetError( aStr, rInStm.GetToken() ); 474cdf0e10cSrcweir rBase.WriteError( rInStm ); 475cdf0e10cSrcweir return sal_False; 476cdf0e10cSrcweir } 477cdf0e10cSrcweir } 478cdf0e10cSrcweir else 479cdf0e10cSrcweir { 480cdf0e10cSrcweir sal_uInt32 nId1 = pS->GetSlotId().GetValue(); 481cdf0e10cSrcweir sal_uInt32 nId2 = rAttr.GetSlotId().GetValue(); 482cdf0e10cSrcweir if( nId1 == nId2 && nId1 != 0 /*&& nId2 != 0 ist ueberfluessig*/ ) 483cdf0e10cSrcweir { 484cdf0e10cSrcweir DBG_ERROR( "Gleiche Id in MetaClass : " ); 485cdf0e10cSrcweir DBG_ERROR( ByteString::CreateFromInt32( pS->GetSlotId().GetValue() ).GetBuffer() ); 486cdf0e10cSrcweir DBG_ERROR( pS->GetSlotId().GetBuffer() ); 487cdf0e10cSrcweir DBG_ERROR( rAttr.GetSlotId().GetBuffer() ); 488cdf0e10cSrcweir 489cdf0e10cSrcweir ByteString aStr( "Attribute " ); 490cdf0e10cSrcweir aStr += pS->GetName(); 491cdf0e10cSrcweir aStr += " and Attribute "; 492cdf0e10cSrcweir aStr += rAttr.GetName(); 493cdf0e10cSrcweir aStr += " with equal id's"; 494cdf0e10cSrcweir rBase.SetError( aStr, rInStm.GetToken() ); 495cdf0e10cSrcweir rBase.WriteError( rInStm ); 496cdf0e10cSrcweir return sal_False; 497cdf0e10cSrcweir } 498cdf0e10cSrcweir } 499cdf0e10cSrcweir } 500cdf0e10cSrcweir SvMetaClass * pSC = aSuperClass; 501cdf0e10cSrcweir if( pSC ) 502cdf0e10cSrcweir return pSC->TestAttribute( rBase, rInStm, rAttr ); 503cdf0e10cSrcweir return sal_True; 504cdf0e10cSrcweir } 505cdf0e10cSrcweir 506cdf0e10cSrcweir /************************************************************************* 507cdf0e10cSrcweir |* SvMetaClass::WriteSvIdl() 508cdf0e10cSrcweir |* 509cdf0e10cSrcweir |* Beschreibung 510cdf0e10cSrcweir *************************************************************************/ 511cdf0e10cSrcweir void SvMetaClass::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, 512cdf0e10cSrcweir sal_uInt16 nTab ) 513cdf0e10cSrcweir { 514cdf0e10cSrcweir WriteHeaderSvIdl( rBase, rOutStm, nTab ); 515cdf0e10cSrcweir if( aSuperClass.Is() ) 516cdf0e10cSrcweir rOutStm << " : " << aSuperClass->GetName().GetBuffer(); 517cdf0e10cSrcweir rOutStm << endl; 518cdf0e10cSrcweir SvMetaName::WriteSvIdl( rBase, rOutStm, nTab ); 519cdf0e10cSrcweir rOutStm << endl; 520cdf0e10cSrcweir } 521cdf0e10cSrcweir 522cdf0e10cSrcweir /************************************************************************* 523cdf0e10cSrcweir |* SvMetaClass::WriteOdlMember() 524cdf0e10cSrcweir |* 525cdf0e10cSrcweir |* Beschreibung 526cdf0e10cSrcweir *************************************************************************/ 527cdf0e10cSrcweir /* 528cdf0e10cSrcweir void SvMetaClass::WriteOdlMembers( ByteStringList & rSuperList, 529cdf0e10cSrcweir sal_Bool bVariable, sal_Bool bWriteTab, 530cdf0e10cSrcweir SvIdlDataBase & rBase, 531cdf0e10cSrcweir SvStream & rOutStm, sal_uInt16 nTab ) 532cdf0e10cSrcweir { 533cdf0e10cSrcweir // alle Attribute schreiben 534cdf0e10cSrcweir sal_uLong n; 535cdf0e10cSrcweir for( n = 0; n < aAttrList.Count(); n++ ) 536cdf0e10cSrcweir { 537cdf0e10cSrcweir SvMetaAttribute * pAttr = aAttrList.GetObject( n ); 538cdf0e10cSrcweir 539cdf0e10cSrcweir ByteString aMangleName = pAttr->GetMangleName( bVariable ); 540cdf0e10cSrcweir ByteString * pS = rBase.FindName( aMangleName, rSuperList ); 541cdf0e10cSrcweir 542cdf0e10cSrcweir if( !pS && pAttr->GetExport() ) 543cdf0e10cSrcweir { 544cdf0e10cSrcweir // nicht doppelt 545cdf0e10cSrcweir if( bVariable && pAttr->IsVariable() ) 546cdf0e10cSrcweir { 547cdf0e10cSrcweir rSuperList.Insert( new ByteString( aMangleName ), LIST_APPEND ); 548cdf0e10cSrcweir pAttr->Write( rBase, rOutStm, nTab +1, WRITE_ODL, 549cdf0e10cSrcweir WA_VARIABLE ); 550cdf0e10cSrcweir rOutStm << ';' << endl; 551cdf0e10cSrcweir } 552cdf0e10cSrcweir else if( !bVariable && pAttr->IsMethod() ) 553cdf0e10cSrcweir { 554cdf0e10cSrcweir rSuperList.Insert( new ByteString( aMangleName ), LIST_APPEND ); 555cdf0e10cSrcweir pAttr->Write( rBase, rOutStm, nTab +1, WRITE_ODL, 556cdf0e10cSrcweir WA_METHOD ); 557cdf0e10cSrcweir rOutStm << ';' << endl; 558cdf0e10cSrcweir } 559cdf0e10cSrcweir } 560cdf0e10cSrcweir else 561cdf0e10cSrcweir continue; 562cdf0e10cSrcweir } 563cdf0e10cSrcweir // alle Attribute der importierten Klassen schreiben 564cdf0e10cSrcweir for( n = 0; n < aClassList.Count(); n++ ) 565cdf0e10cSrcweir { 566cdf0e10cSrcweir SvClassElement * pEle = aClassList.GetObject( n ); 567cdf0e10cSrcweir SvMetaClass * pCl = pEle->GetClass(); 568cdf0e10cSrcweir pCl->WriteOdlMembers( rSuperList, bVariable, bWriteTab, 569cdf0e10cSrcweir rBase, rOutStm, nTab ); 570cdf0e10cSrcweir } 571cdf0e10cSrcweir // alle Attribute der Superklassen schreiben 572cdf0e10cSrcweir SvMetaClass * pSC = aSuperClass; 573cdf0e10cSrcweir if( pSC ) 574cdf0e10cSrcweir pSC->WriteOdlMembers( rSuperList, bVariable, bWriteTab, 575cdf0e10cSrcweir rBase, rOutStm, nTab ); 576cdf0e10cSrcweir } 577cdf0e10cSrcweir */ 578cdf0e10cSrcweir 579cdf0e10cSrcweir /************************************************************************* 580cdf0e10cSrcweir |* SvMetaClass::Write() 581cdf0e10cSrcweir |* 582cdf0e10cSrcweir |* Beschreibung 583cdf0e10cSrcweir *************************************************************************/ 584cdf0e10cSrcweir void SvMetaClass::Write( SvIdlDataBase & rBase, SvStream & rOutStm, 585cdf0e10cSrcweir sal_uInt16 nTab, 586cdf0e10cSrcweir WriteType nT, WriteAttribute ) 587cdf0e10cSrcweir { 588cdf0e10cSrcweir rBase.aIFaceName = GetName(); 589cdf0e10cSrcweir switch( nT ) 590cdf0e10cSrcweir { 591cdf0e10cSrcweir case WRITE_ODL: 592cdf0e10cSrcweir { 593cdf0e10cSrcweir DBG_ERROR( "Not supported anymore!" ); 594cdf0e10cSrcweir /* 595cdf0e10cSrcweir // Schreibt die Attribute 596cdf0e10cSrcweir SvMetaName::Write( rBase, rOutStm, nTab, nT, nA ); 597cdf0e10cSrcweir 598cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 599cdf0e10cSrcweir rOutStm << "dispinterface " << GetName().GetBuffer() << endl; 600cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 601cdf0e10cSrcweir rOutStm << '{' << endl; 602cdf0e10cSrcweir 603cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 604cdf0e10cSrcweir rOutStm << "properties:"; 605cdf0e10cSrcweir rOutStm << endl; 606cdf0e10cSrcweir 607cdf0e10cSrcweir StringList aSuperList; 608cdf0e10cSrcweir WriteOdlMembers( aSuperList, sal_True, sal_True, rBase, rOutStm, nTab ); 609cdf0e10cSrcweir 610cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 611cdf0e10cSrcweir rOutStm << "methods:"; 612cdf0e10cSrcweir rOutStm << endl; 613cdf0e10cSrcweir 614cdf0e10cSrcweir WriteOdlMembers( aSuperList, sal_False, sal_True, rBase, rOutStm, nTab ); 615cdf0e10cSrcweir 616cdf0e10cSrcweir ByteString * pStr = aSuperList.First(); 617cdf0e10cSrcweir while( pStr ) 618cdf0e10cSrcweir { 619cdf0e10cSrcweir delete pStr; 620cdf0e10cSrcweir pStr = aSuperList.Next(); 621cdf0e10cSrcweir } 622cdf0e10cSrcweir 623cdf0e10cSrcweir WriteTab( rOutStm, 1 ); 624cdf0e10cSrcweir rOutStm << '}' << endl; 625cdf0e10cSrcweir */ 626cdf0e10cSrcweir break; 627cdf0e10cSrcweir } 628cdf0e10cSrcweir case WRITE_C_SOURCE: 629cdf0e10cSrcweir case WRITE_C_HEADER: 630cdf0e10cSrcweir { 631cdf0e10cSrcweir DBG_ERROR( "Not supported anymore!" ); 632cdf0e10cSrcweir /* 633cdf0e10cSrcweir StringList aSuperList; 634cdf0e10cSrcweir if( nT == WRITE_C_SOURCE ) 635cdf0e10cSrcweir { 636cdf0e10cSrcweir rOutStm << "#pragma code_seg (\"" << GetName().GetBuffer() 637cdf0e10cSrcweir << "\",\"CODE\")" << endl; 638cdf0e10cSrcweir } 639cdf0e10cSrcweir WriteCFunctions( aSuperList, rBase, rOutStm, nTab, nT ); 640cdf0e10cSrcweir */ 641cdf0e10cSrcweir break; 642cdf0e10cSrcweir } 643cdf0e10cSrcweir case WRITE_DOCU: 644cdf0e10cSrcweir { 645cdf0e10cSrcweir rOutStm << "<INTERFACE>" << endl 646cdf0e10cSrcweir << GetName().GetBuffer(); 647cdf0e10cSrcweir if ( GetAutomation() ) 648cdf0e10cSrcweir rOutStm << " ( Automation ) "; 649cdf0e10cSrcweir rOutStm << endl; 650cdf0e10cSrcweir WriteDescription( rOutStm ); 651cdf0e10cSrcweir rOutStm << "</INTERFACE>" << endl << endl; 652cdf0e10cSrcweir 653cdf0e10cSrcweir // alle Attribute schreiben 654cdf0e10cSrcweir sal_uLong n; 655cdf0e10cSrcweir for( n = 0; n < aAttrList.Count(); n++ ) 656cdf0e10cSrcweir { 657cdf0e10cSrcweir SvMetaAttribute * pAttr = aAttrList.GetObject( n ); 658cdf0e10cSrcweir if( !pAttr->GetHidden() ) 659cdf0e10cSrcweir { 660cdf0e10cSrcweir if( pAttr->IsMethod() ) 661cdf0e10cSrcweir pAttr->Write( rBase, rOutStm, nTab, nT, WA_METHOD ); 662cdf0e10cSrcweir 663cdf0e10cSrcweir if( pAttr->IsVariable() ) 664cdf0e10cSrcweir pAttr->Write( rBase, rOutStm, nTab, nT, WA_VARIABLE ); 665cdf0e10cSrcweir } 666cdf0e10cSrcweir } 667cdf0e10cSrcweir 668cdf0e10cSrcweir break; 669cdf0e10cSrcweir } 670cdf0e10cSrcweir default: 671cdf0e10cSrcweir break; 672cdf0e10cSrcweir } 673cdf0e10cSrcweir } 674cdf0e10cSrcweir 675cdf0e10cSrcweir /************************************************************************* 676cdf0e10cSrcweir |* SvMetaClass::WriteSlotParamArray() 677cdf0e10cSrcweir |* 678cdf0e10cSrcweir |* Beschreibung 679cdf0e10cSrcweir *************************************************************************/ 680cdf0e10cSrcweir sal_uInt16 SvMetaClass::WriteSlotParamArray( SvIdlDataBase & rBase, 681cdf0e10cSrcweir SvSlotElementList & rSlotList, 682cdf0e10cSrcweir SvStream & rOutStm ) 683cdf0e10cSrcweir { 684cdf0e10cSrcweir sal_uInt16 nCount = 0; 685cdf0e10cSrcweir for( sal_uLong n = 0; n < rSlotList.Count(); n++ ) 686cdf0e10cSrcweir { 687cdf0e10cSrcweir SvSlotElement *pEle = rSlotList.GetObject( n ); 688cdf0e10cSrcweir SvMetaSlot *pAttr = pEle->xSlot; 689cdf0e10cSrcweir nCount = nCount + pAttr->WriteSlotParamArray( rBase, rOutStm ); 690cdf0e10cSrcweir } 691cdf0e10cSrcweir 692cdf0e10cSrcweir return nCount; 693cdf0e10cSrcweir } 694cdf0e10cSrcweir 695cdf0e10cSrcweir /************************************************************************* 696cdf0e10cSrcweir |* SvMetaClass::WriteSlots() 697cdf0e10cSrcweir |* 698cdf0e10cSrcweir |* Beschreibung 699cdf0e10cSrcweir *************************************************************************/ 700cdf0e10cSrcweir sal_uInt16 SvMetaClass::WriteSlots( const ByteString & rShellName, 701cdf0e10cSrcweir sal_uInt16 nCount, SvSlotElementList & rSlotList, 702cdf0e10cSrcweir SvIdlDataBase & rBase, 703cdf0e10cSrcweir SvStream & rOutStm ) 704cdf0e10cSrcweir { 705cdf0e10cSrcweir sal_uInt16 nSCount = 0; 706cdf0e10cSrcweir for( sal_uLong n = 0; n < rSlotList.Count(); n++ ) 707cdf0e10cSrcweir { 708cdf0e10cSrcweir rSlotList.Seek(n); 709cdf0e10cSrcweir SvSlotElement * pEle = rSlotList.GetCurObject(); 710cdf0e10cSrcweir SvMetaSlot * pAttr = pEle->xSlot; 711cdf0e10cSrcweir nSCount = nSCount + pAttr->WriteSlotMap( rShellName, nCount + nSCount, 712cdf0e10cSrcweir rSlotList, pEle->aPrefix, rBase, 713cdf0e10cSrcweir rOutStm ); 714cdf0e10cSrcweir } 715cdf0e10cSrcweir 716cdf0e10cSrcweir return nSCount; 717cdf0e10cSrcweir } 718cdf0e10cSrcweir 719cdf0e10cSrcweir /************************************************************************* 720cdf0e10cSrcweir |* SvMetaClass::InsertSlots() 721cdf0e10cSrcweir |* 722cdf0e10cSrcweir |* Beschreibung 723cdf0e10cSrcweir *************************************************************************/ 724cdf0e10cSrcweir void SvMetaClass::InsertSlots( SvSlotElementList& rList, SvULongs& rSuperList, 725cdf0e10cSrcweir SvMetaClassList &rClassList, 726cdf0e10cSrcweir const ByteString & rPrefix, SvIdlDataBase& rBase) 727cdf0e10cSrcweir { 728cdf0e10cSrcweir // Wurde diese Klasse schon geschrieben ? 729cdf0e10cSrcweir if ( rClassList.GetPos(this) != LIST_ENTRY_NOTFOUND ) 730cdf0e10cSrcweir return; 731cdf0e10cSrcweir 732cdf0e10cSrcweir rClassList.Insert(this, LIST_APPEND); 733cdf0e10cSrcweir 734cdf0e10cSrcweir // alle direkten Attribute schreiben 735cdf0e10cSrcweir sal_uLong n; 736cdf0e10cSrcweir for( n = 0; n < aAttrList.Count(); n++ ) 737cdf0e10cSrcweir { 738cdf0e10cSrcweir SvMetaAttribute * pAttr = aAttrList.GetObject( n ); 739cdf0e10cSrcweir 740cdf0e10cSrcweir sal_uLong nId = pAttr->GetSlotId().GetValue(); 741cdf0e10cSrcweir sal_uInt16 nPos; 742cdf0e10cSrcweir for ( nPos=0; nPos < rSuperList.Count(); nPos++ ) 743cdf0e10cSrcweir { 744cdf0e10cSrcweir if ( rSuperList.GetObject(nPos) == nId ) 745cdf0e10cSrcweir break; 746cdf0e10cSrcweir } 747cdf0e10cSrcweir 748cdf0e10cSrcweir if( nPos == rSuperList.Count() ) 749cdf0e10cSrcweir { 750cdf0e10cSrcweir // nur schreiben, wenn nicht schon bei SubClass oder 751cdf0e10cSrcweir // importiertem Interface geschrieben 752cdf0e10cSrcweir rSuperList.Insert( nId, nPos ); 753cdf0e10cSrcweir pAttr->Insert(rList, rPrefix, rBase); 754cdf0e10cSrcweir } 755cdf0e10cSrcweir } 756cdf0e10cSrcweir 757cdf0e10cSrcweir // Alle schon von SuperShells importierten Interfaces sollen nicht 758cdf0e10cSrcweir // mehr geschrieben werden 759cdf0e10cSrcweir // Es ist also verboten, da\s Shell und SuperShell die gleiche Klasse 760cdf0e10cSrcweir // direkt importieren ! 761cdf0e10cSrcweir if( IsShell() && aSuperClass.Is() ) 762cdf0e10cSrcweir aSuperClass->FillClasses( rClassList ); 763cdf0e10cSrcweir 764cdf0e10cSrcweir // alle Attribute der importierten Klassen schreiben, sofern diese nicht 765cdf0e10cSrcweir // schon von der Superklasse importiert wurden 766cdf0e10cSrcweir for( n = 0; n < aClassList.Count(); n++ ) 767cdf0e10cSrcweir { 768cdf0e10cSrcweir SvClassElement * pEle = aClassList.GetObject( n ); 769cdf0e10cSrcweir SvMetaClass * pCl = pEle->GetClass(); 770cdf0e10cSrcweir ByteString rPre = rPrefix; 771cdf0e10cSrcweir if( rPre.Len() && pEle->GetPrefix().Len() ) 772cdf0e10cSrcweir rPre += '.'; 773cdf0e10cSrcweir rPre += pEle->GetPrefix(); 774cdf0e10cSrcweir 775cdf0e10cSrcweir // Zun"achst die direkt importierten Interfaces schreiben 776cdf0e10cSrcweir pCl->InsertSlots( rList, rSuperList, rClassList, rPre, rBase ); 777cdf0e10cSrcweir } 778cdf0e10cSrcweir 779cdf0e10cSrcweir // Superklassen nur schreiben, wenn keine Shell und nicht in der Liste 780cdf0e10cSrcweir if( !IsShell() && aSuperClass.Is() ) 781cdf0e10cSrcweir { 782cdf0e10cSrcweir aSuperClass->InsertSlots( rList, rSuperList, rClassList, rPrefix, rBase ); 783cdf0e10cSrcweir } 784cdf0e10cSrcweir } 785cdf0e10cSrcweir 786cdf0e10cSrcweir /************************************************************************* 787cdf0e10cSrcweir |* SvMetaClass::FillClasses() 788cdf0e10cSrcweir |* 789cdf0e10cSrcweir |* Beschreibung 790cdf0e10cSrcweir *************************************************************************/ 791cdf0e10cSrcweir void SvMetaClass::FillClasses( SvMetaClassList & rList ) 792cdf0e10cSrcweir { 793cdf0e10cSrcweir // Bin ich noch nicht drin ? 794cdf0e10cSrcweir if ( rList.GetPos(this) == LIST_ENTRY_NOTFOUND ) 795cdf0e10cSrcweir { 796cdf0e10cSrcweir rList.Insert(this, LIST_APPEND); 797cdf0e10cSrcweir 798cdf0e10cSrcweir // Meine Imports 799cdf0e10cSrcweir for( sal_uLong n = 0; n < aClassList.Count(); n++ ) 800cdf0e10cSrcweir { 801cdf0e10cSrcweir SvClassElement * pEle = aClassList.GetObject( n ); 802cdf0e10cSrcweir SvMetaClass * pCl = pEle->GetClass(); 803cdf0e10cSrcweir pCl->FillClasses( rList ); 804cdf0e10cSrcweir } 805cdf0e10cSrcweir 806cdf0e10cSrcweir // Meine Superklasse 807cdf0e10cSrcweir if( aSuperClass.Is() ) 808cdf0e10cSrcweir aSuperClass->FillClasses( rList ); 809cdf0e10cSrcweir } 810cdf0e10cSrcweir } 811cdf0e10cSrcweir 812cdf0e10cSrcweir 813cdf0e10cSrcweir /************************************************************************* 814cdf0e10cSrcweir |* SvMetaClass::WriteSlotStubs() 815cdf0e10cSrcweir |* 816cdf0e10cSrcweir |* Beschreibung 817cdf0e10cSrcweir *************************************************************************/ 818cdf0e10cSrcweir void SvMetaClass::WriteSlotStubs( const ByteString & rShellName, 819cdf0e10cSrcweir SvSlotElementList & rSlotList, 820cdf0e10cSrcweir ByteStringList & rList, 821cdf0e10cSrcweir SvStream & rOutStm ) 822cdf0e10cSrcweir { 823cdf0e10cSrcweir // alle Attribute schreiben 824cdf0e10cSrcweir for( sal_uLong n = 0; n < rSlotList.Count(); n++ ) 825cdf0e10cSrcweir { 826cdf0e10cSrcweir SvSlotElement *pEle = rSlotList.GetObject( n ); 827cdf0e10cSrcweir SvMetaSlot *pAttr = pEle->xSlot; 828cdf0e10cSrcweir pAttr->WriteSlotStubs( rShellName, rList, rOutStm ); 829cdf0e10cSrcweir } 830cdf0e10cSrcweir } 831cdf0e10cSrcweir 832cdf0e10cSrcweir /************************************************************************* 833cdf0e10cSrcweir |* SvMetaClass::WriteSfx() 834cdf0e10cSrcweir |* 835cdf0e10cSrcweir |* Beschreibung 836cdf0e10cSrcweir *************************************************************************/ 837cdf0e10cSrcweir void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm ) 838cdf0e10cSrcweir { 839cdf0e10cSrcweir WriteStars( rOutStm ); 840cdf0e10cSrcweir // Klasse definieren 841cdf0e10cSrcweir rOutStm << "#ifdef " << GetName().GetBuffer() << endl; 842cdf0e10cSrcweir rOutStm << "#undef ShellClass" << endl; 843cdf0e10cSrcweir rOutStm << "#undef " << GetName().GetBuffer() << endl; 844cdf0e10cSrcweir rOutStm << "#define ShellClass " << GetName().GetBuffer() << endl; 845cdf0e10cSrcweir 846cdf0e10cSrcweir // rOutStm << "SFX_TYPELIB(" << GetName().GetBuffer() << ',' << endl 847cdf0e10cSrcweir // << "\t/* library type */" 848cdf0e10cSrcweir // << '"' << ByteString( GetModule()->GetUUId().GetHexName(), RTL_TEXTENCODING_UTF8 ).GetBuffer() << "\"," << endl 849cdf0e10cSrcweir // << "\t\"" << GetModule()->GetTypeLibFileName().GetBuffer() << "\"," 850cdf0e10cSrcweir // << ByteString::CreateFromInt32( GetModule()->GetVersion().GetMajorVersion() ).GetBuffer() << ',' 851cdf0e10cSrcweir // << ByteString::CreateFromInt32( GetModule()->GetVersion().GetMinorVersion() ).GetBuffer() << ',' << endl 852cdf0e10cSrcweir // << "\t/* shell type */" 853cdf0e10cSrcweir // << '"'; 854cdf0e10cSrcweir // if( xAutomationInterface.Is() ) 855cdf0e10cSrcweir // rOutStm << ByteString( xAutomationInterface->GetUUId().GetHexName(), RTL_TEXTENCODING_UTF8 ).GetBuffer(); 856cdf0e10cSrcweir // else 857cdf0e10cSrcweir // rOutStm << ByteString( GetUUId().GetHexName(), RTL_TEXTENCODING_UTF8 ).GetBuffer(); 858cdf0e10cSrcweir // rOutStm << "\");" << endl << endl; 859cdf0e10cSrcweir 860cdf0e10cSrcweir // Fuer Interfaces werden kein Slotmaps geschrieben 861cdf0e10cSrcweir if( !IsShell() ) 862cdf0e10cSrcweir { 863cdf0e10cSrcweir rOutStm << "#endif" << endl << endl; 864cdf0e10cSrcweir return; 865cdf0e10cSrcweir } 866cdf0e10cSrcweir // Parameter Array schreiben 867cdf0e10cSrcweir //rOutStm << "SfxArgList " << GetName().GetBuffer() << "ArgMap[] = {" << endl; 868cdf0e10cSrcweir rOutStm << "SFX_ARGUMENTMAP(" << GetName().GetBuffer() << ')' << endl 869cdf0e10cSrcweir << '{' << endl; 870cdf0e10cSrcweir 871cdf0e10cSrcweir SvULongs aSuperList; 872cdf0e10cSrcweir SvMetaClassList classList; 873cdf0e10cSrcweir SvSlotElementList aSlotList; 874cdf0e10cSrcweir InsertSlots(aSlotList, aSuperList, classList, ByteString(), rBase); 875cdf0e10cSrcweir sal_uLong n; 876cdf0e10cSrcweir for ( n=0; n<aSlotList.Count(); n++ ) 877cdf0e10cSrcweir { 878cdf0e10cSrcweir SvSlotElement *pEle = aSlotList.GetObject( n ); 879cdf0e10cSrcweir SvMetaSlot *pSlot = pEle->xSlot; 880cdf0e10cSrcweir pSlot->SetListPos(n); 881cdf0e10cSrcweir } 882cdf0e10cSrcweir 883cdf0e10cSrcweir sal_uLong nSlotCount = aSlotList.Count(); 884cdf0e10cSrcweir 885cdf0e10cSrcweir // alle Attribute schreiben 886cdf0e10cSrcweir sal_uInt16 nArgCount = WriteSlotParamArray( rBase, aSlotList, rOutStm ); 887cdf0e10cSrcweir if( nArgCount ) 888cdf0e10cSrcweir Back2Delemitter( rOutStm ); 889cdf0e10cSrcweir else 890cdf0e10cSrcweir { 891cdf0e10cSrcweir // mindestens einen dummy 892cdf0e10cSrcweir WriteTab( rOutStm, 1 ); 893cdf0e10cSrcweir rOutStm << "SFX_ARGUMENT( 0, 0, SfxVoidItem )" << endl; 894cdf0e10cSrcweir } 895cdf0e10cSrcweir rOutStm << endl << "};" << endl << endl; 896cdf0e10cSrcweir 897cdf0e10cSrcweir ByteStringList aStringList; 898cdf0e10cSrcweir WriteSlotStubs( GetName(), aSlotList, aStringList, rOutStm ); 899cdf0e10cSrcweir ByteString * pStr = aStringList.First(); 900cdf0e10cSrcweir while( pStr ) 901cdf0e10cSrcweir { 902cdf0e10cSrcweir delete pStr; 903cdf0e10cSrcweir pStr = aStringList.Next(); 904cdf0e10cSrcweir } 905cdf0e10cSrcweir 906cdf0e10cSrcweir rOutStm << endl; 907cdf0e10cSrcweir 908cdf0e10cSrcweir // Slotmap schreiben 909cdf0e10cSrcweir rOutStm << "SFX_SLOTMAP_ARG(" << GetName().GetBuffer() << ')' << endl 910cdf0e10cSrcweir << '{' << endl; 911cdf0e10cSrcweir 912cdf0e10cSrcweir // alle Attribute schreiben 913cdf0e10cSrcweir WriteSlots( GetName(), 0, aSlotList, rBase, rOutStm ); 914cdf0e10cSrcweir if( nSlotCount ) 915cdf0e10cSrcweir Back2Delemitter( rOutStm ); 916cdf0e10cSrcweir else 917cdf0e10cSrcweir { 918cdf0e10cSrcweir // mindestens einen dummy 919cdf0e10cSrcweir WriteTab( rOutStm, 1 ); 920cdf0e10cSrcweir rOutStm << "SFX_SLOT_ARG(" << GetName().GetBuffer() 921cdf0e10cSrcweir << ", 0, 0, " 922cdf0e10cSrcweir << "SFX_STUB_PTR_EXEC_NONE," 923cdf0e10cSrcweir << "SFX_STUB_PTR_STATE_NONE," 924cdf0e10cSrcweir << "0, SfxVoidItem, 0, 0, \"\", 0 )" << endl; 925cdf0e10cSrcweir } 926cdf0e10cSrcweir rOutStm << endl << "};" << endl << "#endif" << endl << endl; 927cdf0e10cSrcweir 928cdf0e10cSrcweir for( n=0; n<aSlotList.Count(); n++ ) 929cdf0e10cSrcweir { 930cdf0e10cSrcweir aSlotList.Seek(n); 931cdf0e10cSrcweir SvSlotElement* pEle = aSlotList.GetCurObject(); 932cdf0e10cSrcweir SvMetaSlot* pAttr = pEle->xSlot; 933cdf0e10cSrcweir pAttr->ResetSlotPointer(); 934cdf0e10cSrcweir } 935cdf0e10cSrcweir 936cdf0e10cSrcweir for ( n=0; n<aSlotList.Count(); n++ ) 937cdf0e10cSrcweir delete aSlotList.GetObject(n); 938cdf0e10cSrcweir } 939cdf0e10cSrcweir 940cdf0e10cSrcweir void SvMetaClass::WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm, 941cdf0e10cSrcweir Table* pTable ) 942cdf0e10cSrcweir { 943cdf0e10cSrcweir for( sal_uLong n=0; n<aAttrList.Count(); n++ ) 944cdf0e10cSrcweir { 945cdf0e10cSrcweir SvMetaAttribute * pAttr = aAttrList.GetObject( n ); 946cdf0e10cSrcweir pAttr->WriteHelpId( rBase, rOutStm, pTable ); 947cdf0e10cSrcweir } 948cdf0e10cSrcweir } 949cdf0e10cSrcweir 950cdf0e10cSrcweir /************************************************************************* 951cdf0e10cSrcweir |* SvMetaShell::WriteSrc() 952cdf0e10cSrcweir *************************************************************************/ 953cdf0e10cSrcweir void SvMetaClass::WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm, 954cdf0e10cSrcweir Table * pTable ) 955cdf0e10cSrcweir { 956cdf0e10cSrcweir for( sal_uLong n=0; n<aAttrList.Count(); n++ ) 957cdf0e10cSrcweir { 958cdf0e10cSrcweir SvMetaAttribute * pAttr = aAttrList.GetObject( n ); 959cdf0e10cSrcweir pAttr->WriteSrc( rBase, rOutStm, pTable ); 960cdf0e10cSrcweir } 961cdf0e10cSrcweir } 962cdf0e10cSrcweir 963cdf0e10cSrcweir /************************************************************************* 964cdf0e10cSrcweir |* SvMetaClass::WriteHxx() 965cdf0e10cSrcweir |* 966cdf0e10cSrcweir |* Beschreibung 967cdf0e10cSrcweir *************************************************************************/ 968cdf0e10cSrcweir void SvMetaClass::WriteHxx( SvIdlDataBase &, SvStream & rOutStm, sal_uInt16 ) 969cdf0e10cSrcweir { 970cdf0e10cSrcweir ByteString aSuperName( "SvDispatch" ); 971cdf0e10cSrcweir if( GetSuperClass() ) 972cdf0e10cSrcweir aSuperName = GetSuperClass()->GetName(); 973cdf0e10cSrcweir const char * pSup = aSuperName.GetBuffer(); 974cdf0e10cSrcweir 975cdf0e10cSrcweir rOutStm 976cdf0e10cSrcweir << "class " << GetSvName().GetBuffer() 977cdf0e10cSrcweir << ": public " << pSup << endl 978cdf0e10cSrcweir << '{' << endl 979cdf0e10cSrcweir << "protected:" << endl 980cdf0e10cSrcweir << "\tvirtual SvGlobalName GetTypeName() const;" << endl 981cdf0e10cSrcweir << "\tvirtual sal_Bool FillTypeLibInfo( SvGlobalName *, sal_uInt16 * pMajor," << endl 982cdf0e10cSrcweir << "\t sal_uInt16 * pMinor ) const;" << endl 983cdf0e10cSrcweir << "\tvirtual sal_Bool FillTypeLibInfo( ByteString * pName, sal_uInt16 * pMajor," << endl; 984cdf0e10cSrcweir rOutStm 985cdf0e10cSrcweir << "\t sal_uInt16 * pMinor ) const;" << endl 986cdf0e10cSrcweir << "\tvirtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) = 0;" << endl 987cdf0e10cSrcweir << "public:" << endl 988cdf0e10cSrcweir << "\t static SvGlobalName ClassName()" << endl 989cdf0e10cSrcweir << "\t { return SvGlobalName( " << ByteString( GetUUId().GetctorName(), RTL_TEXTENCODING_UTF8 ).GetBuffer() << " ); }" << endl 990cdf0e10cSrcweir << "};" << endl; 991cdf0e10cSrcweir } 992cdf0e10cSrcweir 993cdf0e10cSrcweir /************************************************************************* 994cdf0e10cSrcweir |* SvMetaClass::WriteCxx() 995cdf0e10cSrcweir |* 996cdf0e10cSrcweir |* Beschreibung 997cdf0e10cSrcweir *************************************************************************/ 998cdf0e10cSrcweir void SvMetaClass::WriteCxx( SvIdlDataBase &, SvStream & rOutStm, sal_uInt16 ) 999cdf0e10cSrcweir { 1000cdf0e10cSrcweir ByteString aSuperName( "SvDispatch" ); 1001cdf0e10cSrcweir if( GetSuperClass() ) 1002cdf0e10cSrcweir aSuperName = GetSuperClass()->GetName(); 1003cdf0e10cSrcweir const char * pSup = aSuperName.GetBuffer(); 1004cdf0e10cSrcweir 1005cdf0e10cSrcweir ByteString name = GetSvName(); 1006cdf0e10cSrcweir // GetTypeName 1007cdf0e10cSrcweir rOutStm << "SvGlobalName " << name.GetBuffer() << "::GetTypeName() const" << endl 1008cdf0e10cSrcweir << '{' << endl 1009cdf0e10cSrcweir << "\treturn ClassName();" << endl 1010cdf0e10cSrcweir << '}' << endl; 1011cdf0e10cSrcweir 1012cdf0e10cSrcweir SvMetaModule * pMod = GetModule(); 1013cdf0e10cSrcweir // FillTypeLibInfo 1014cdf0e10cSrcweir rOutStm << "sal_Bool " << name.GetBuffer() << "::FillTypeLibInfo( SvGlobalName * pGN," << endl 1015cdf0e10cSrcweir << "\t sal_uInt16 * pMajor," << endl 1016cdf0e10cSrcweir << "\t sal_uInt16 * pMinor ) const" << endl 1017cdf0e10cSrcweir << '{' << endl 1018cdf0e10cSrcweir << "\tSvGlobalName aN( " << ByteString( pMod->GetUUId().GetctorName(), RTL_TEXTENCODING_UTF8 ).GetBuffer() << " );" << endl; 1019cdf0e10cSrcweir rOutStm << "\t*pGN = aN;" << endl 1020cdf0e10cSrcweir << "\t*pMajor = " << ByteString::CreateFromInt32(pMod->GetVersion().GetMajorVersion()).GetBuffer() << ';' << endl 1021cdf0e10cSrcweir << "\t*pMinor = " << ByteString::CreateFromInt32(pMod->GetVersion().GetMinorVersion()).GetBuffer() << ';' << endl 1022cdf0e10cSrcweir << "\treturn sal_True;" << endl 1023cdf0e10cSrcweir << '}' << endl; 1024cdf0e10cSrcweir 1025cdf0e10cSrcweir // FillTypeLibInfo 1026cdf0e10cSrcweir rOutStm << "sal_Bool " << name.GetBuffer() << "::FillTypeLibInfo( ByteString * pName," 1027cdf0e10cSrcweir << "\t sal_uInt16 * pMajor," << endl 1028cdf0e10cSrcweir << "\t sal_uInt16 * pMinor ) const" << endl; 1029cdf0e10cSrcweir rOutStm << '{' << endl 1030cdf0e10cSrcweir << "\t*pName = \"" << pMod->GetTypeLibFileName().GetBuffer() << "\";" << endl 1031cdf0e10cSrcweir << "\t*pMajor = " << ByteString::CreateFromInt32(pMod->GetVersion().GetMajorVersion()).GetBuffer() << ';' << endl 1032cdf0e10cSrcweir << "\t*pMinor = " << ByteString::CreateFromInt32(pMod->GetVersion().GetMinorVersion()).GetBuffer() << ';' << endl 1033cdf0e10cSrcweir << "\treturn sal_True;" << endl 1034cdf0e10cSrcweir << '}' << endl; 1035cdf0e10cSrcweir 1036cdf0e10cSrcweir rOutStm << "void " << name.GetBuffer() << "::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )" << endl 1037cdf0e10cSrcweir << '{' << endl 1038cdf0e10cSrcweir << "\t" << pSup << "::Notify( rBC, rHint );" << endl 1039cdf0e10cSrcweir << '}' << endl; 1040cdf0e10cSrcweir } 1041cdf0e10cSrcweir 1042cdf0e10cSrcweir #endif // IDL_COMPILER 1043cdf0e10cSrcweir 1044