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 10cdf0e10cSrcweir * 11*724893d4SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 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. 19cdf0e10cSrcweir * 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 <basobj.hxx> 34cdf0e10cSrcweir #include <module.hxx> 35cdf0e10cSrcweir #include <globals.hxx> 36cdf0e10cSrcweir #include <database.hxx> 37cdf0e10cSrcweir 38cdf0e10cSrcweir /****************** SvMetaObject *****************************************/ 39cdf0e10cSrcweir SV_IMPL_META_FACTORY1( SvMetaObject, SvRttiBase ) 40cdf0e10cSrcweir /************************************************************************* 41cdf0e10cSrcweir |* SvMetaObject::SvMetaObject() 42cdf0e10cSrcweir |* 43cdf0e10cSrcweir |* Beschreibung 44cdf0e10cSrcweir *************************************************************************/ 45cdf0e10cSrcweir SvMetaObject::SvMetaObject() 46cdf0e10cSrcweir { 47cdf0e10cSrcweir } 48cdf0e10cSrcweir 49cdf0e10cSrcweir void SvMetaObject::Load( SvPersistStream & ) 50cdf0e10cSrcweir { 51cdf0e10cSrcweir } 52cdf0e10cSrcweir 53cdf0e10cSrcweir void SvMetaObject::Save( SvPersistStream & ) 54cdf0e10cSrcweir { 55cdf0e10cSrcweir } 56cdf0e10cSrcweir 57cdf0e10cSrcweir /************************************************************************* 58cdf0e10cSrcweir |* SvMetaObject::WriteTab() 59cdf0e10cSrcweir |* 60cdf0e10cSrcweir |* Beschreibung 61cdf0e10cSrcweir *************************************************************************/ 62cdf0e10cSrcweir #ifdef IDL_COMPILER 63cdf0e10cSrcweir void SvMetaObject::WriteTab( SvStream & rOutStm, sal_uInt16 nTab ) 64cdf0e10cSrcweir { 65cdf0e10cSrcweir while( nTab-- ) 66cdf0e10cSrcweir rOutStm << " "; 67cdf0e10cSrcweir // rOutStm << '\t'; 68cdf0e10cSrcweir } 69cdf0e10cSrcweir 70cdf0e10cSrcweir /************************************************************************* 71cdf0e10cSrcweir |* SvMetaObject::WriteStart() 72cdf0e10cSrcweir |* 73cdf0e10cSrcweir |* Beschreibung 74cdf0e10cSrcweir *************************************************************************/ 75cdf0e10cSrcweir void SvMetaObject::WriteStars( SvStream & rOutStm ) 76cdf0e10cSrcweir { 77cdf0e10cSrcweir rOutStm << '/'; 78cdf0e10cSrcweir for( int i = 6; i > 0; i-- ) 79cdf0e10cSrcweir rOutStm << "**********"; 80cdf0e10cSrcweir rOutStm << '/' << endl; 81cdf0e10cSrcweir } 82cdf0e10cSrcweir 83cdf0e10cSrcweir /************************************************************************* 84cdf0e10cSrcweir |* SvMetaObject::TestAndSeekSpaceOnly() 85cdf0e10cSrcweir |* 86cdf0e10cSrcweir |* Beschreibung 87cdf0e10cSrcweir *************************************************************************/ 88cdf0e10cSrcweir sal_Bool SvMetaObject::TestAndSeekSpaceOnly( SvStream & rOutStm, sal_uLong nBegPos ) 89cdf0e10cSrcweir { 90cdf0e10cSrcweir // keine leeren Klammern schreiben 91cdf0e10cSrcweir sal_uLong nPos = rOutStm.Tell(); 92cdf0e10cSrcweir rOutStm.Seek( nBegPos ); 93cdf0e10cSrcweir sal_Bool bOnlySpace = sal_True; 94cdf0e10cSrcweir while( bOnlySpace && rOutStm.Tell() < nPos ) 95cdf0e10cSrcweir { 96cdf0e10cSrcweir char c; 97cdf0e10cSrcweir rOutStm >> c; 98cdf0e10cSrcweir if( !isspace( c ) ) 99cdf0e10cSrcweir bOnlySpace = sal_False; 100cdf0e10cSrcweir } 101cdf0e10cSrcweir if( bOnlySpace ) 102cdf0e10cSrcweir // nichts geschrieben 103cdf0e10cSrcweir rOutStm.Seek( nBegPos ); 104cdf0e10cSrcweir else 105cdf0e10cSrcweir rOutStm.Seek( nPos ); 106cdf0e10cSrcweir return bOnlySpace; 107cdf0e10cSrcweir } 108cdf0e10cSrcweir 109cdf0e10cSrcweir /************************************************************************* 110cdf0e10cSrcweir |* SvMetaObject::Back2Delemitter() 111cdf0e10cSrcweir |* 112cdf0e10cSrcweir |* Beschreibung 113cdf0e10cSrcweir *************************************************************************/ 114cdf0e10cSrcweir void SvMetaObject::Back2Delemitter( SvStream & rOutStm ) 115cdf0e10cSrcweir { 116cdf0e10cSrcweir // keine leeren Klammern schreiben 117cdf0e10cSrcweir sal_uLong nPos = rOutStm.Tell(); 118cdf0e10cSrcweir rOutStm.SeekRel( -1 ); 119cdf0e10cSrcweir char c = 0; 120cdf0e10cSrcweir rOutStm >> c; 121cdf0e10cSrcweir 122cdf0e10cSrcweir while( isspace( c ) && rOutStm.Tell() != 1 ) 123cdf0e10cSrcweir { 124cdf0e10cSrcweir rOutStm.SeekRel( -2 ); 125cdf0e10cSrcweir rOutStm >> c; 126cdf0e10cSrcweir } 127cdf0e10cSrcweir 128cdf0e10cSrcweir if( c == ';' || c == ',' ) 129cdf0e10cSrcweir rOutStm.SeekRel( -1 ); 130cdf0e10cSrcweir else 131cdf0e10cSrcweir rOutStm.Seek( nPos ); 132cdf0e10cSrcweir } 133cdf0e10cSrcweir 134cdf0e10cSrcweir /************************************************************************* 135cdf0e10cSrcweir |* SvMetaObject::ReadSvIdl() 136cdf0e10cSrcweir |* 137cdf0e10cSrcweir |* Beschreibung 138cdf0e10cSrcweir *************************************************************************/ 139cdf0e10cSrcweir sal_Bool SvMetaObject::ReadSvIdl( SvIdlDataBase &, SvTokenStream & ) 140cdf0e10cSrcweir { 141cdf0e10cSrcweir return sal_False; 142cdf0e10cSrcweir } 143cdf0e10cSrcweir 144cdf0e10cSrcweir /************************************************************************* 145cdf0e10cSrcweir |* SvMetaObject::WriteSvIdl() 146cdf0e10cSrcweir |* 147cdf0e10cSrcweir |* Beschreibung 148cdf0e10cSrcweir *************************************************************************/ 149cdf0e10cSrcweir void SvMetaObject::WriteSvIdl( SvIdlDataBase &, SvStream &, sal_uInt16 /*nTab */ ) 150cdf0e10cSrcweir { 151cdf0e10cSrcweir } 152cdf0e10cSrcweir 153cdf0e10cSrcweir /************************************************************************* 154cdf0e10cSrcweir |* SvMetaObject::Write() 155cdf0e10cSrcweir |* 156cdf0e10cSrcweir |* Beschreibung 157cdf0e10cSrcweir *************************************************************************/ 158cdf0e10cSrcweir void SvMetaObject::Write( SvIdlDataBase &, SvStream &, sal_uInt16 /*nTab */, 159cdf0e10cSrcweir WriteType, WriteAttribute ) 160cdf0e10cSrcweir { 161cdf0e10cSrcweir } 162cdf0e10cSrcweir 163cdf0e10cSrcweir /************************************************************************* 164cdf0e10cSrcweir |* SvMetaObject::WriteCxx() 165cdf0e10cSrcweir |* 166cdf0e10cSrcweir |* Beschreibung 167cdf0e10cSrcweir *************************************************************************/ 168cdf0e10cSrcweir void SvMetaObject::WriteCxx( SvIdlDataBase &, SvStream &, sal_uInt16 /*nTab */ ) 169cdf0e10cSrcweir { 170cdf0e10cSrcweir } 171cdf0e10cSrcweir 172cdf0e10cSrcweir /************************************************************************* 173cdf0e10cSrcweir |* SvMetaObject::WriteHxx() 174cdf0e10cSrcweir |* 175cdf0e10cSrcweir |* Beschreibung 176cdf0e10cSrcweir *************************************************************************/ 177cdf0e10cSrcweir void SvMetaObject::WriteHxx( SvIdlDataBase &, SvStream &, sal_uInt16 /*nTab */ ) 178cdf0e10cSrcweir { 179cdf0e10cSrcweir } 180cdf0e10cSrcweir 181cdf0e10cSrcweir #endif 182cdf0e10cSrcweir 183cdf0e10cSrcweir /****************** SvMetaName *****************************************/ 184cdf0e10cSrcweir SV_IMPL_META_FACTORY1( SvMetaName, SvMetaObject ); 185cdf0e10cSrcweir /************************************************************************* 186cdf0e10cSrcweir |* SvMetaName::SvMetaName() 187cdf0e10cSrcweir |* 188cdf0e10cSrcweir |* Beschreibung 189cdf0e10cSrcweir *************************************************************************/ 190cdf0e10cSrcweir SvMetaName::SvMetaName() 191cdf0e10cSrcweir { 192cdf0e10cSrcweir } 193cdf0e10cSrcweir 194cdf0e10cSrcweir void SvMetaName::Load( SvPersistStream & rStm ) 195cdf0e10cSrcweir { 196cdf0e10cSrcweir SvMetaObject::Load( rStm ); 197cdf0e10cSrcweir sal_uInt8 nMask; 198cdf0e10cSrcweir rStm >> nMask; 199cdf0e10cSrcweir 200cdf0e10cSrcweir if( nMask >= 0x20 ) 201cdf0e10cSrcweir { 202cdf0e10cSrcweir rStm.SetError( SVSTREAM_FILEFORMAT_ERROR ); 203cdf0e10cSrcweir DBG_ERROR( "wrong format" ); 204cdf0e10cSrcweir return; 205cdf0e10cSrcweir } 206cdf0e10cSrcweir if( nMask & 0x01 ) rStm >> aName; 207cdf0e10cSrcweir if( nMask & 0x02 ) rStm >> aHelpContext; 208cdf0e10cSrcweir if( nMask & 0x04 ) rStm >> aHelpText; 209cdf0e10cSrcweir if( nMask & 0x08 ) rStm >> aConfigName; 210cdf0e10cSrcweir if( nMask & 0x10 ) rStm >> aDescription; 211cdf0e10cSrcweir } 212cdf0e10cSrcweir 213cdf0e10cSrcweir void SvMetaName::Save( SvPersistStream & rStm ) 214cdf0e10cSrcweir { 215cdf0e10cSrcweir SvMetaObject::Save( rStm ); 216cdf0e10cSrcweir sal_uInt8 nMask = 0; 217cdf0e10cSrcweir if( aName.IsSet() ) nMask |= 0x01; 218cdf0e10cSrcweir if( aHelpContext.IsSet() ) nMask |= 0x02; 219cdf0e10cSrcweir if( aHelpText.IsSet() ) nMask |= 0x04; 220cdf0e10cSrcweir if( aConfigName.IsSet() ) nMask |= 0x08; 221cdf0e10cSrcweir if( aDescription.IsSet() ) nMask |= 0x10; 222cdf0e10cSrcweir 223cdf0e10cSrcweir rStm << nMask; 224cdf0e10cSrcweir if( nMask & 0x01 ) rStm << aName; 225cdf0e10cSrcweir if( nMask & 0x02 ) rStm << aHelpContext; 226cdf0e10cSrcweir if( nMask & 0x04 ) rStm << aHelpText; 227cdf0e10cSrcweir if( nMask & 0x08 ) rStm << aConfigName; 228cdf0e10cSrcweir if( nMask & 0x10 ) rStm << aDescription; 229cdf0e10cSrcweir } 230cdf0e10cSrcweir 231cdf0e10cSrcweir /************************************************************************* 232cdf0e10cSrcweir |* 233cdf0e10cSrcweir |* 234cdf0e10cSrcweir |* Beschreibung 235cdf0e10cSrcweir *************************************************************************/ 236cdf0e10cSrcweir sal_Bool SvMetaName::SetName( const ByteString & rName, SvIdlDataBase * ) 237cdf0e10cSrcweir { 238cdf0e10cSrcweir aName = rName; 239cdf0e10cSrcweir return sal_True; 240cdf0e10cSrcweir } 241cdf0e10cSrcweir 242cdf0e10cSrcweir #ifdef IDL_COMPILER 243cdf0e10cSrcweir /************************************************************************* 244cdf0e10cSrcweir |* SvMetaName::ReadNameSvIdl() 245cdf0e10cSrcweir |* 246cdf0e10cSrcweir |* Beschreibung 247cdf0e10cSrcweir *************************************************************************/ 248cdf0e10cSrcweir sal_Bool SvMetaName::ReadNameSvIdl( SvIdlDataBase & rBase, 249cdf0e10cSrcweir SvTokenStream & rInStm ) 250cdf0e10cSrcweir { 251cdf0e10cSrcweir sal_uInt32 nTokPos = rInStm.Tell(); 252cdf0e10cSrcweir SvToken * pTok = rInStm.GetToken_Next(); 253cdf0e10cSrcweir 254cdf0e10cSrcweir // Modulnamen lesen 255cdf0e10cSrcweir if( pTok->IsIdentifier() ) 256cdf0e10cSrcweir if( SetName( pTok->GetString(), &rBase ) ) 257cdf0e10cSrcweir return sal_True; 258cdf0e10cSrcweir 259cdf0e10cSrcweir rInStm.Seek( nTokPos ); 260cdf0e10cSrcweir return sal_False; 261cdf0e10cSrcweir } 262cdf0e10cSrcweir 263cdf0e10cSrcweir /************************************************************************* 264cdf0e10cSrcweir |* SvMetaName::ReadSvIdl() 265cdf0e10cSrcweir |* 266cdf0e10cSrcweir |* Beschreibung 267cdf0e10cSrcweir *************************************************************************/ 268cdf0e10cSrcweir void SvMetaName::ReadAttributesSvIdl( SvIdlDataBase & rBase, 269cdf0e10cSrcweir SvTokenStream & rInStm ) 270cdf0e10cSrcweir { 271cdf0e10cSrcweir sal_uInt32 nTokPos = rInStm.Tell(); 272cdf0e10cSrcweir if( aName.ReadSvIdl( SvHash_Name(), rInStm ) ) 273cdf0e10cSrcweir { 274cdf0e10cSrcweir if( !SetName( aName, &rBase ) ) 275cdf0e10cSrcweir rInStm.Seek( nTokPos ); 276cdf0e10cSrcweir } 277cdf0e10cSrcweir aHelpContext.ReadSvIdl( rBase, SvHash_HelpContext(), rInStm ); 278cdf0e10cSrcweir aHelpText.ReadSvIdl( rBase, rInStm ); 279cdf0e10cSrcweir aConfigName.ReadSvIdl( SvHash_ConfigName(), rInStm ); 280cdf0e10cSrcweir aDescription.ReadSvIdl( SvHash_Description(), rInStm ); 281cdf0e10cSrcweir /* 282cdf0e10cSrcweir aHelpContext.ReadSvIdl( GetModule()->GetInfo()->GetHelpContextContainer(), 283cdf0e10cSrcweir rInStm ); 284cdf0e10cSrcweir */ 285cdf0e10cSrcweir } 286cdf0e10cSrcweir 287cdf0e10cSrcweir /************************************************************************* 288cdf0e10cSrcweir |* SvMetaName::DoReadContextSvIdl() 289cdf0e10cSrcweir |* 290cdf0e10cSrcweir |* Beschreibung 291cdf0e10cSrcweir *************************************************************************/ 292cdf0e10cSrcweir void SvMetaName::DoReadContextSvIdl( SvIdlDataBase & rBase, 293cdf0e10cSrcweir SvTokenStream & rInStm, char cDel ) 294cdf0e10cSrcweir { 295cdf0e10cSrcweir sal_uInt32 nBeginPos = 0; // kann mit Tell nicht vorkommen 296cdf0e10cSrcweir while( nBeginPos != rInStm.Tell() ) 297cdf0e10cSrcweir { 298cdf0e10cSrcweir nBeginPos = rInStm.Tell(); 299cdf0e10cSrcweir ReadContextSvIdl( rBase, rInStm ); 300cdf0e10cSrcweir if( cDel == '\0' ) 301cdf0e10cSrcweir rInStm.ReadDelemiter(); 302cdf0e10cSrcweir else 303cdf0e10cSrcweir rInStm.Read( cDel ); 304cdf0e10cSrcweir } 305cdf0e10cSrcweir } 306cdf0e10cSrcweir 307cdf0e10cSrcweir /************************************************************************* 308cdf0e10cSrcweir |* SvMetaName::ReadSvIdl() 309cdf0e10cSrcweir |* 310cdf0e10cSrcweir |* Beschreibung 311cdf0e10cSrcweir *************************************************************************/ 312cdf0e10cSrcweir void SvMetaName::ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & ) 313cdf0e10cSrcweir { 314cdf0e10cSrcweir } 315cdf0e10cSrcweir 316cdf0e10cSrcweir /************************************************************************* 317cdf0e10cSrcweir |* SvMetaName::Test() 318cdf0e10cSrcweir |* 319cdf0e10cSrcweir |* Beschreibung 320cdf0e10cSrcweir *************************************************************************/ 321cdf0e10cSrcweir sal_Bool SvMetaName::Test( SvIdlDataBase &, SvTokenStream & ) 322cdf0e10cSrcweir { 323cdf0e10cSrcweir return sal_True; 324cdf0e10cSrcweir } 325cdf0e10cSrcweir 326cdf0e10cSrcweir /************************************************************************* 327cdf0e10cSrcweir |* SvMetaName::WriteContextSvIdl() 328cdf0e10cSrcweir |* 329cdf0e10cSrcweir |* Beschreibung 330cdf0e10cSrcweir *************************************************************************/ 331cdf0e10cSrcweir void SvMetaName::WriteContextSvIdl( SvIdlDataBase &, SvStream &, sal_uInt16 ) 332cdf0e10cSrcweir { 333cdf0e10cSrcweir } 334cdf0e10cSrcweir 335cdf0e10cSrcweir /************************************************************************* 336cdf0e10cSrcweir |* SvMetaName::WriteDescription() 337cdf0e10cSrcweir |* 338cdf0e10cSrcweir |* Beschreibung 339cdf0e10cSrcweir *************************************************************************/ 340cdf0e10cSrcweir void SvMetaName::WriteDescription( SvStream & rOutStm ) 341cdf0e10cSrcweir { 342cdf0e10cSrcweir rOutStm << "<DESCRIPTION>" << endl; 343cdf0e10cSrcweir 344cdf0e10cSrcweir ByteString aDesc( GetDescription() ); 345cdf0e10cSrcweir sal_uInt16 nPos = aDesc.Search( '\n' ); 346cdf0e10cSrcweir while ( nPos != STRING_NOTFOUND ) 347cdf0e10cSrcweir { 348cdf0e10cSrcweir rOutStm << aDesc.Copy( 0, nPos ).GetBuffer() << endl; 349cdf0e10cSrcweir aDesc.Erase(0,nPos+1); 350cdf0e10cSrcweir nPos = aDesc.Search( '\n' ); 351cdf0e10cSrcweir } 352cdf0e10cSrcweir 353cdf0e10cSrcweir rOutStm << aDesc.GetBuffer() << endl << "</DESCRIPTION>" << endl; 354cdf0e10cSrcweir } 355cdf0e10cSrcweir 356cdf0e10cSrcweir /************************************************************************* 357cdf0e10cSrcweir |* SvMetaName::WriteAttributesIdl() 358cdf0e10cSrcweir |* 359cdf0e10cSrcweir |* Beschreibung 360cdf0e10cSrcweir *************************************************************************/ 361cdf0e10cSrcweir void SvMetaName::WriteAttributesSvIdl( SvIdlDataBase & rBase, 362cdf0e10cSrcweir SvStream & rOutStm, 363cdf0e10cSrcweir sal_uInt16 nTab ) 364cdf0e10cSrcweir { 365cdf0e10cSrcweir if( aHelpContext.IsSet() || aHelpText.IsSet() || aConfigName.IsSet() ) 366cdf0e10cSrcweir { 367cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 368cdf0e10cSrcweir rOutStm << "// class SvMetaName" << endl; 369cdf0e10cSrcweir } 370cdf0e10cSrcweir if( aHelpContext.IsSet() ) 371cdf0e10cSrcweir { 372cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 373cdf0e10cSrcweir aHelpContext.WriteSvIdl( SvHash_HelpContext(), rOutStm, nTab ); 374cdf0e10cSrcweir rOutStm << ';' << endl; 375cdf0e10cSrcweir } 376cdf0e10cSrcweir if( aHelpText.IsSet() ) 377cdf0e10cSrcweir { 378cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 379cdf0e10cSrcweir aHelpText.WriteSvIdl( rBase, rOutStm, nTab ); 380cdf0e10cSrcweir rOutStm << ';' << endl; 381cdf0e10cSrcweir } 382cdf0e10cSrcweir if( aConfigName.IsSet() ) 383cdf0e10cSrcweir { 384cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 385cdf0e10cSrcweir aConfigName.WriteSvIdl( SvHash_ConfigName(), rOutStm, nTab ); 386cdf0e10cSrcweir rOutStm << ';' << endl; 387cdf0e10cSrcweir } 388cdf0e10cSrcweir } 389cdf0e10cSrcweir 390cdf0e10cSrcweir /************************************************************************* 391cdf0e10cSrcweir |* SvMetaName::ReadSvIdl() 392cdf0e10cSrcweir |* 393cdf0e10cSrcweir |* Beschreibung 394cdf0e10cSrcweir *************************************************************************/ 395cdf0e10cSrcweir sal_Bool SvMetaName::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) 396cdf0e10cSrcweir { 397cdf0e10cSrcweir sal_uInt32 nTokPos = rInStm.Tell(); 398cdf0e10cSrcweir sal_Bool bOk = sal_True; 399cdf0e10cSrcweir if( rInStm.Read( '[' ) ) 400cdf0e10cSrcweir { 401cdf0e10cSrcweir sal_uInt32 nBeginPos = 0; // kann mit Tell nicht vorkommen 402cdf0e10cSrcweir while( nBeginPos != rInStm.Tell() ) 403cdf0e10cSrcweir { 404cdf0e10cSrcweir nBeginPos = rInStm.Tell(); 405cdf0e10cSrcweir ReadAttributesSvIdl( rBase, rInStm ); 406cdf0e10cSrcweir rInStm.ReadDelemiter(); 407cdf0e10cSrcweir } 408cdf0e10cSrcweir bOk = rInStm.Read( ']' ); 409cdf0e10cSrcweir } 410cdf0e10cSrcweir 411cdf0e10cSrcweir if( bOk ) 412cdf0e10cSrcweir { 413cdf0e10cSrcweir if( rInStm.Read( '{' ) ) 414cdf0e10cSrcweir { 415cdf0e10cSrcweir DoReadContextSvIdl( rBase, rInStm ); 416cdf0e10cSrcweir bOk = rInStm.Read( '}' ); 417cdf0e10cSrcweir } 418cdf0e10cSrcweir } 419cdf0e10cSrcweir 420cdf0e10cSrcweir if( !bOk ) 421cdf0e10cSrcweir rInStm.Seek( nTokPos ); 422cdf0e10cSrcweir return bOk; 423cdf0e10cSrcweir } 424cdf0e10cSrcweir 425cdf0e10cSrcweir /************************************************************************* 426cdf0e10cSrcweir |* SvMetaName::WriteSvIdl() 427cdf0e10cSrcweir |* 428cdf0e10cSrcweir |* Beschreibung 429cdf0e10cSrcweir *************************************************************************/ 430cdf0e10cSrcweir void SvMetaName::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, 431cdf0e10cSrcweir sal_uInt16 nTab ) 432cdf0e10cSrcweir { 433cdf0e10cSrcweir sal_uLong nBeginPos = rOutStm.Tell(); 434cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 435cdf0e10cSrcweir rOutStm << '[' << endl; 436cdf0e10cSrcweir sal_uLong nOldPos = rOutStm.Tell(); 437cdf0e10cSrcweir WriteAttributesSvIdl( rBase, rOutStm, nTab +1 ); 438cdf0e10cSrcweir 439cdf0e10cSrcweir // keine leeren Klammern schreiben 440cdf0e10cSrcweir if( TestAndSeekSpaceOnly( rOutStm, nOldPos ) ) 441cdf0e10cSrcweir // nichts geschrieben 442cdf0e10cSrcweir rOutStm.Seek( nBeginPos ); 443cdf0e10cSrcweir else 444cdf0e10cSrcweir { 445cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 446cdf0e10cSrcweir rOutStm << ']'; 447cdf0e10cSrcweir nBeginPos = rOutStm.Tell(); 448cdf0e10cSrcweir rOutStm << endl; 449cdf0e10cSrcweir } 450cdf0e10cSrcweir 451cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 452cdf0e10cSrcweir rOutStm << '{' << endl; 453cdf0e10cSrcweir nOldPos = rOutStm.Tell(); 454cdf0e10cSrcweir WriteContextSvIdl( rBase, rOutStm, nTab +1 ); 455cdf0e10cSrcweir 456cdf0e10cSrcweir // keine leeren Klammern schreiben 457cdf0e10cSrcweir if( TestAndSeekSpaceOnly( rOutStm, nOldPos ) ) 458cdf0e10cSrcweir // nichts geschrieben 459cdf0e10cSrcweir rOutStm.Seek( nBeginPos ); 460cdf0e10cSrcweir else 461cdf0e10cSrcweir { 462cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 463cdf0e10cSrcweir rOutStm << '}'; 464cdf0e10cSrcweir } 465cdf0e10cSrcweir } 466cdf0e10cSrcweir 467cdf0e10cSrcweir /************************************************************************* 468cdf0e10cSrcweir |* SvMetaName::Write() 469cdf0e10cSrcweir |* 470cdf0e10cSrcweir |* Beschreibung 471cdf0e10cSrcweir *************************************************************************/ 472cdf0e10cSrcweir void SvMetaName::Write( SvIdlDataBase & rBase, SvStream & rOutStm, 473cdf0e10cSrcweir sal_uInt16 nTab, 474cdf0e10cSrcweir WriteType nT, WriteAttribute nA ) 475cdf0e10cSrcweir { 476cdf0e10cSrcweir sal_uLong nBeginPos = rOutStm.Tell(); 477cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 478cdf0e10cSrcweir rOutStm << '[' << endl; 479cdf0e10cSrcweir sal_uLong nOldPos = rOutStm.Tell(); 480cdf0e10cSrcweir WriteAttributes( rBase, rOutStm, nTab +1, nT, nA ); 481cdf0e10cSrcweir 482cdf0e10cSrcweir // keine leeren Klammern schreiben 483cdf0e10cSrcweir sal_uLong nPos = rOutStm.Tell(); 484cdf0e10cSrcweir rOutStm.Seek( nOldPos ); 485cdf0e10cSrcweir sal_Bool bOnlySpace = sal_True; 486cdf0e10cSrcweir while( bOnlySpace && rOutStm.Tell() < nPos ) 487cdf0e10cSrcweir { 488cdf0e10cSrcweir char c; 489cdf0e10cSrcweir rOutStm >> c; 490cdf0e10cSrcweir if( !isspace( c ) ) 491cdf0e10cSrcweir bOnlySpace = sal_False; 492cdf0e10cSrcweir } 493cdf0e10cSrcweir if( bOnlySpace ) 494cdf0e10cSrcweir // nichts geschrieben 495cdf0e10cSrcweir rOutStm.Seek( nBeginPos ); 496cdf0e10cSrcweir else 497cdf0e10cSrcweir { 498cdf0e10cSrcweir rOutStm.Seek( nPos ); 499cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 500cdf0e10cSrcweir rOutStm << ']' << endl; 501cdf0e10cSrcweir } 502cdf0e10cSrcweir } 503cdf0e10cSrcweir 504cdf0e10cSrcweir /************************************************************************* 505cdf0e10cSrcweir |* SvMetaName::WriteAttributes() 506cdf0e10cSrcweir |* 507cdf0e10cSrcweir |* Beschreibung 508cdf0e10cSrcweir *************************************************************************/ 509cdf0e10cSrcweir void SvMetaName::WriteAttributes( SvIdlDataBase &, SvStream & rOutStm, 510cdf0e10cSrcweir sal_uInt16 nTab, 511cdf0e10cSrcweir WriteType, WriteAttribute ) 512cdf0e10cSrcweir { 513cdf0e10cSrcweir if( GetHelpText().IsSet() || GetHelpContext().IsSet() ) 514cdf0e10cSrcweir { 515cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 516cdf0e10cSrcweir rOutStm << "// class SvMetaName" << endl; 517cdf0e10cSrcweir } 518cdf0e10cSrcweir if( GetHelpText().IsSet() ) 519cdf0e10cSrcweir { 520cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 521cdf0e10cSrcweir rOutStm << "helpstring(\"" << GetHelpText().GetBuffer() << "\")," << endl; 522cdf0e10cSrcweir } 523cdf0e10cSrcweir if( GetHelpContext().IsSet() ) 524cdf0e10cSrcweir { 525cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 526cdf0e10cSrcweir rOutStm << "helpcontext(" 527cdf0e10cSrcweir << ByteString::CreateFromInt64( 528cdf0e10cSrcweir GetHelpContext().GetValue() ).GetBuffer() 529cdf0e10cSrcweir << ")," << endl; 530cdf0e10cSrcweir } 531cdf0e10cSrcweir } 532cdf0e10cSrcweir 533cdf0e10cSrcweir /************************************************************************* 534cdf0e10cSrcweir |* SvMetaName::WriteContext() 535cdf0e10cSrcweir |* 536cdf0e10cSrcweir |* Beschreibung 537cdf0e10cSrcweir *************************************************************************/ 538cdf0e10cSrcweir void SvMetaName::WriteContext( SvIdlDataBase &, SvStream &, 539cdf0e10cSrcweir sal_uInt16, 540cdf0e10cSrcweir WriteType, WriteAttribute ) 541cdf0e10cSrcweir { 542cdf0e10cSrcweir } 543cdf0e10cSrcweir #endif // IDL_COMPILER 544cdf0e10cSrcweir 545cdf0e10cSrcweir /****************** SvMetaReference *****************************************/ 546cdf0e10cSrcweir SV_IMPL_META_FACTORY1( SvMetaReference, SvMetaName ); 547cdf0e10cSrcweir 548cdf0e10cSrcweir /************************************************************************* 549cdf0e10cSrcweir |* SvMetaReference::SvMetaReference() 550cdf0e10cSrcweir |* 551cdf0e10cSrcweir |* Beschreibung 552cdf0e10cSrcweir *************************************************************************/ 553cdf0e10cSrcweir SvMetaReference::SvMetaReference() 554cdf0e10cSrcweir { 555cdf0e10cSrcweir } 556cdf0e10cSrcweir 557cdf0e10cSrcweir void SvMetaReference::Load( SvPersistStream & rStm ) 558cdf0e10cSrcweir { 559cdf0e10cSrcweir SvMetaName::Load( rStm ); 560cdf0e10cSrcweir 561cdf0e10cSrcweir sal_uInt8 nMask; 562cdf0e10cSrcweir rStm >> nMask; 563cdf0e10cSrcweir if( nMask >= 0x2 ) 564cdf0e10cSrcweir { 565cdf0e10cSrcweir rStm.SetError( SVSTREAM_FILEFORMAT_ERROR ); 566cdf0e10cSrcweir DBG_ERROR( "wrong format" ); 567cdf0e10cSrcweir return; 568cdf0e10cSrcweir } 569cdf0e10cSrcweir if( nMask & 0x01 ) 570cdf0e10cSrcweir { 571cdf0e10cSrcweir SvMetaReference * pRef; 572cdf0e10cSrcweir rStm >> pRef; 573cdf0e10cSrcweir aRef = pRef; 574cdf0e10cSrcweir } 575cdf0e10cSrcweir } 576cdf0e10cSrcweir 577cdf0e10cSrcweir void SvMetaReference::Save( SvPersistStream & rStm ) 578cdf0e10cSrcweir { 579cdf0e10cSrcweir SvMetaName::Save( rStm ); 580cdf0e10cSrcweir 581cdf0e10cSrcweir // Maske erstellen 582cdf0e10cSrcweir sal_uInt8 nMask = 0; 583cdf0e10cSrcweir if( aRef.Is() ) 584cdf0e10cSrcweir nMask |= 0x01; 585cdf0e10cSrcweir 586cdf0e10cSrcweir // Daten schreiben 587cdf0e10cSrcweir rStm << nMask; 588cdf0e10cSrcweir if( nMask & 0x01 ) rStm << aRef; 589cdf0e10cSrcweir } 590cdf0e10cSrcweir 591cdf0e10cSrcweir /**************************************************************************/ 592cdf0e10cSrcweir /****************** SvMetaExtern ******************************************/ 593cdf0e10cSrcweir SV_IMPL_META_FACTORY1( SvMetaExtern, SvMetaReference ); 594cdf0e10cSrcweir 595cdf0e10cSrcweir /************************************************************************* 596cdf0e10cSrcweir |* SvMetaExtern::SvMetaExtern() 597cdf0e10cSrcweir |* 598cdf0e10cSrcweir |* Beschreibung 599cdf0e10cSrcweir *************************************************************************/ 600cdf0e10cSrcweir SvMetaExtern::SvMetaExtern() 601cdf0e10cSrcweir : pModule( NULL ) 602cdf0e10cSrcweir , bReadUUId( sal_False ) 603cdf0e10cSrcweir , bReadVersion( sal_False ) 604cdf0e10cSrcweir { 605cdf0e10cSrcweir } 606cdf0e10cSrcweir 607cdf0e10cSrcweir void SvMetaExtern::Load( SvPersistStream & rStm ) 608cdf0e10cSrcweir { 609cdf0e10cSrcweir SvMetaReference::Load( rStm ); 610cdf0e10cSrcweir 611cdf0e10cSrcweir sal_uInt8 nMask; 612cdf0e10cSrcweir rStm >> nMask; 613cdf0e10cSrcweir if( nMask >= 0x20 ) 614cdf0e10cSrcweir { 615cdf0e10cSrcweir rStm.SetError( SVSTREAM_FILEFORMAT_ERROR ); 616cdf0e10cSrcweir DBG_ERROR( "wrong format" ); 617cdf0e10cSrcweir return; 618cdf0e10cSrcweir } 619cdf0e10cSrcweir if( nMask & 0x01 ) rStm >> pModule; 620cdf0e10cSrcweir if( nMask & 0x02 ) rStm >> aUUId; 621cdf0e10cSrcweir if( nMask & 0x04 ) rStm >> aVersion; 622cdf0e10cSrcweir if( nMask & 0x08 ) bReadUUId = sal_True; 623cdf0e10cSrcweir if( nMask & 0x10 ) bReadVersion = sal_True; 624cdf0e10cSrcweir } 625cdf0e10cSrcweir 626cdf0e10cSrcweir void SvMetaExtern::Save( SvPersistStream & rStm ) 627cdf0e10cSrcweir { 628cdf0e10cSrcweir SvMetaReference::Save( rStm ); 629cdf0e10cSrcweir 630cdf0e10cSrcweir // Maske erstellen 631cdf0e10cSrcweir sal_uInt8 nMask = 0; 632cdf0e10cSrcweir if( pModule ) nMask |= 0x01; 633cdf0e10cSrcweir if( aUUId != SvGlobalName() ) nMask |= 0x02; 634cdf0e10cSrcweir if( aVersion != SvVersion() ) nMask |= 0x04; 635cdf0e10cSrcweir if( bReadUUId ) nMask |= 0x08; 636cdf0e10cSrcweir if( bReadVersion ) nMask |= 0x10; 637cdf0e10cSrcweir 638cdf0e10cSrcweir // Daten schreiben 639cdf0e10cSrcweir rStm << nMask; 640cdf0e10cSrcweir if( nMask & 0x01 ) rStm << pModule; 641cdf0e10cSrcweir if( nMask & 0x02 ) rStm << aUUId; 642cdf0e10cSrcweir if( nMask & 0x04 ) rStm << aVersion; 643cdf0e10cSrcweir } 644cdf0e10cSrcweir 645cdf0e10cSrcweir /************************************************************************* 646cdf0e10cSrcweir |* SvMetaExtern::GetModule() 647cdf0e10cSrcweir |* 648cdf0e10cSrcweir |* Beschreibung 649cdf0e10cSrcweir *************************************************************************/ 650cdf0e10cSrcweir SvMetaModule * SvMetaExtern::GetModule() const 651cdf0e10cSrcweir { 652cdf0e10cSrcweir DBG_ASSERT( pModule != NULL, "module not set" ); 653cdf0e10cSrcweir return pModule; 654cdf0e10cSrcweir } 655cdf0e10cSrcweir 656cdf0e10cSrcweir /************************************************************************* 657cdf0e10cSrcweir |* SvMetaExtern::GetUUId() 658cdf0e10cSrcweir |* 659cdf0e10cSrcweir |* Beschreibung 660cdf0e10cSrcweir *************************************************************************/ 661cdf0e10cSrcweir const SvGlobalName & SvMetaExtern::GetUUId() const 662cdf0e10cSrcweir { 663cdf0e10cSrcweir #ifdef IDL_COMPILER 664cdf0e10cSrcweir if( aUUId == SvGlobalName() ) 665cdf0e10cSrcweir GetModule()->FillNextName( &((SvMetaExtern *)this)->aUUId ); 666cdf0e10cSrcweir #endif 667cdf0e10cSrcweir return aUUId; 668cdf0e10cSrcweir } 669cdf0e10cSrcweir 670cdf0e10cSrcweir #ifdef IDL_COMPILER 671cdf0e10cSrcweir /************************************************************************* 672cdf0e10cSrcweir |* SvMetaExtern::SetModule() 673cdf0e10cSrcweir |* 674cdf0e10cSrcweir |* Beschreibung 675cdf0e10cSrcweir *************************************************************************/ 676cdf0e10cSrcweir void SvMetaExtern::SetModule( SvIdlDataBase & rBase ) 677cdf0e10cSrcweir { 678cdf0e10cSrcweir pModule = (SvMetaModule *)rBase.GetStack().Get( TYPE( SvMetaModule ) ); 679cdf0e10cSrcweir } 680cdf0e10cSrcweir 681cdf0e10cSrcweir /************************************************************************* 682cdf0e10cSrcweir |* SvMetaExtern::ReadAttributesSvIdl() 683cdf0e10cSrcweir |* 684cdf0e10cSrcweir |* Beschreibung 685cdf0e10cSrcweir *************************************************************************/ 686cdf0e10cSrcweir void SvMetaExtern::ReadAttributesSvIdl( SvIdlDataBase & rBase, 687cdf0e10cSrcweir SvTokenStream & rInStm ) 688cdf0e10cSrcweir { 689cdf0e10cSrcweir SvMetaReference::ReadAttributesSvIdl( rBase, rInStm ); 690cdf0e10cSrcweir if( aUUId.ReadSvIdl( rBase, rInStm ) ) 691cdf0e10cSrcweir bReadUUId = sal_True; 692cdf0e10cSrcweir if( aVersion.ReadSvIdl( rInStm ) ) 693cdf0e10cSrcweir bReadVersion = sal_True; 694cdf0e10cSrcweir } 695cdf0e10cSrcweir 696cdf0e10cSrcweir /************************************************************************* 697cdf0e10cSrcweir |* SvMetaExtern::WriteAttributesSvIdl() 698cdf0e10cSrcweir |* 699cdf0e10cSrcweir |* Beschreibung 700cdf0e10cSrcweir *************************************************************************/ 701cdf0e10cSrcweir void SvMetaExtern::WriteAttributesSvIdl( SvIdlDataBase & rBase, 702cdf0e10cSrcweir SvStream & rOutStm, sal_uInt16 nTab ) 703cdf0e10cSrcweir { 704cdf0e10cSrcweir SvMetaReference::WriteAttributesSvIdl( rBase, rOutStm, nTab ); 705cdf0e10cSrcweir if( bReadUUId || bReadVersion ) 706cdf0e10cSrcweir { 707cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 708cdf0e10cSrcweir rOutStm << "// class SvMetaExtern" << endl; 709cdf0e10cSrcweir 710cdf0e10cSrcweir if( bReadUUId ) 711cdf0e10cSrcweir { 712cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 713cdf0e10cSrcweir aUUId.WriteSvIdl( rOutStm ); 714cdf0e10cSrcweir rOutStm << ';' << endl; 715cdf0e10cSrcweir } 716cdf0e10cSrcweir if( bReadVersion ) 717cdf0e10cSrcweir { 718cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 719cdf0e10cSrcweir aVersion.WriteSvIdl( rOutStm ); 720cdf0e10cSrcweir rOutStm << ';' << endl; 721cdf0e10cSrcweir } 722cdf0e10cSrcweir } 723cdf0e10cSrcweir } 724cdf0e10cSrcweir 725cdf0e10cSrcweir /************************************************************************* 726cdf0e10cSrcweir |* SvMetaExtern::ReadSvIdl() 727cdf0e10cSrcweir |* 728cdf0e10cSrcweir |* Beschreibung 729cdf0e10cSrcweir *************************************************************************/ 730cdf0e10cSrcweir sal_Bool SvMetaExtern::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) 731cdf0e10cSrcweir { 732cdf0e10cSrcweir SetModule( rBase ); 733cdf0e10cSrcweir GetUUId(); // Id wird angelegt 734cdf0e10cSrcweir return SvMetaReference::ReadSvIdl( rBase, rInStm ); 735cdf0e10cSrcweir } 736cdf0e10cSrcweir 737cdf0e10cSrcweir /************************************************************************* 738cdf0e10cSrcweir |* SvMetaExtern::WriteSvIdl() 739cdf0e10cSrcweir |* 740cdf0e10cSrcweir |* Beschreibung 741cdf0e10cSrcweir *************************************************************************/ 742cdf0e10cSrcweir void SvMetaExtern::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm, 743cdf0e10cSrcweir sal_uInt16 nTab ) 744cdf0e10cSrcweir { 745cdf0e10cSrcweir SvMetaReference::WriteSvIdl( rBase, rOutStm, nTab ); 746cdf0e10cSrcweir } 747cdf0e10cSrcweir 748cdf0e10cSrcweir /************************************************************************* 749cdf0e10cSrcweir |* SvMetaExtern::Write() 750cdf0e10cSrcweir |* 751cdf0e10cSrcweir |* Beschreibung 752cdf0e10cSrcweir *************************************************************************/ 753cdf0e10cSrcweir void SvMetaExtern::Write( SvIdlDataBase & rBase, SvStream & rOutStm, 754cdf0e10cSrcweir sal_uInt16 nTab, 755cdf0e10cSrcweir WriteType nT, WriteAttribute nA ) 756cdf0e10cSrcweir { 757cdf0e10cSrcweir SvMetaReference::Write( rBase, rOutStm, nTab, nT, nA ); 758cdf0e10cSrcweir } 759cdf0e10cSrcweir 760cdf0e10cSrcweir /************************************************************************* 761cdf0e10cSrcweir |* SvMetaExtern::WriteAttributes() 762cdf0e10cSrcweir |* 763cdf0e10cSrcweir |* Beschreibung 764cdf0e10cSrcweir *************************************************************************/ 765cdf0e10cSrcweir void SvMetaExtern::WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm, 766cdf0e10cSrcweir sal_uInt16 nTab, 767cdf0e10cSrcweir WriteType nT, WriteAttribute nA ) 768cdf0e10cSrcweir { 769cdf0e10cSrcweir SvMetaReference::WriteAttributes( rBase, rOutStm, nTab, nT, nA ); 770cdf0e10cSrcweir 771cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 772cdf0e10cSrcweir rOutStm << "// class SvMetaExtern" << endl; 773cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 774cdf0e10cSrcweir rOutStm << "uuid(" << ByteString( GetUUId().GetHexName(), RTL_TEXTENCODING_UTF8 ).GetBuffer() << ")," << endl; 775cdf0e10cSrcweir WriteTab( rOutStm, nTab ); 776cdf0e10cSrcweir rOutStm << "version(" << ByteString::CreateFromInt32( aVersion.GetMajorVersion() ).GetBuffer() << '.' 777cdf0e10cSrcweir << ByteString::CreateFromInt32( aVersion.GetMinorVersion() ).GetBuffer() << ")," << endl; 778cdf0e10cSrcweir } 779cdf0e10cSrcweir 780cdf0e10cSrcweir #endif // IDL_COMPILER 781cdf0e10cSrcweir 782cdf0e10cSrcweir 783