LCOV - code coverage report
Current view: top level - idl/source/objects - types.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1138 0.0 %
Date: 2014-04-14 Functions: 0 145 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include <ctype.h>
      22             : #include <stdio.h>
      23             : 
      24             : #include <tools/debug.hxx>
      25             : 
      26             : #include <types.hxx>
      27             : #include <globals.hxx>
      28             : #include <database.hxx>
      29             : 
      30           0 : SV_IMPL_META_FACTORY1( SvMetaAttribute, SvMetaReference );
      31           0 : SvMetaAttribute::SvMetaAttribute()
      32             :     : aAutomation( sal_True, sal_False )
      33             :     , aExport( sal_True, sal_False )
      34             :     , aIsCollection ( sal_False, sal_False )
      35             :     , aReadOnlyDoc ( sal_True, sal_False )
      36             :     , aHidden( sal_False, sal_False )
      37           0 :     , bNewAttr( sal_False )
      38             : {
      39           0 : }
      40             : 
      41           0 : SvMetaAttribute::SvMetaAttribute( SvMetaType * pType )
      42             :     : aType( pType )
      43             :     , aAutomation( sal_True, sal_False )
      44             :     , aExport( sal_True, sal_False )
      45             :     , aIsCollection ( sal_False, sal_False)
      46             :     , aReadOnlyDoc ( sal_True, sal_False)
      47             :     , aHidden( sal_False, sal_False )
      48           0 :     , bNewAttr( sal_False )
      49             : {
      50           0 : }
      51             : 
      52           0 : void SvMetaAttribute::Load( SvPersistStream & rStm )
      53             : {
      54           0 :     SvMetaReference::Load( rStm );
      55             : 
      56             :     sal_uInt8 nMask;
      57           0 :     rStm.ReadUChar( nMask );
      58           0 :     if( nMask & 0x01 )
      59             :     {
      60             :         SvMetaType * pType;
      61           0 :         rStm >> pType;
      62           0 :         aType = pType;
      63             :     }
      64           0 :     if( nMask & 0x02 )  rStm >> aSlotId;
      65           0 :     if( nMask & 0x04 )  rStm >> aExport;
      66           0 :     if( nMask & 0x08 )  rStm >> aReadonly;
      67           0 :     if( nMask & 0x10 )  rStm >> aAutomation;
      68           0 :     if( nMask & 0x20 )  rStm >> aIsCollection;
      69           0 :     if( nMask & 0x40 )  rStm >> aReadOnlyDoc;
      70           0 :     if( nMask & 0x80 )  rStm >> aHidden;
      71           0 : }
      72             : 
      73           0 : void SvMetaAttribute::Save( SvPersistStream & rStm )
      74             : {
      75           0 :     SvMetaReference::Save( rStm );
      76             : 
      77             :     // create mask
      78           0 :     sal_uInt8 nMask = 0;
      79           0 :     if( aType.Is() )            nMask |= 0x1;
      80           0 :     if( aSlotId.IsSet() )       nMask |= 0x2;
      81           0 :     if( aExport.IsSet() )       nMask |= 0x4;
      82           0 :     if( aReadonly.IsSet() )     nMask |= 0x8;
      83           0 :     if( aAutomation.IsSet() )   nMask |= 0x10;
      84           0 :     if( aIsCollection.IsSet() ) nMask |= 0x20;
      85           0 :     if( aReadOnlyDoc.IsSet() )  nMask |= 0x40;
      86           0 :     if( aHidden.IsSet() )       nMask |= 0x80;
      87             : 
      88             :     // write data
      89           0 :     rStm.WriteUChar( nMask );
      90           0 :     if( nMask & 0x1 )   WriteSvPersistBase( rStm, aType );
      91           0 :     if( nMask & 0x2 )   WriteSvNumberIdentifier( rStm, aSlotId );
      92           0 :     if( nMask & 0x4 )   rStm.WriteUChar( aExport );
      93           0 :     if( nMask & 0x8 )   rStm.WriteUChar( aReadonly );
      94           0 :     if( nMask & 0x10 )  rStm.WriteUChar( aAutomation );
      95           0 :     if( nMask & 0x20 )  rStm.WriteUChar( aIsCollection );
      96           0 :     if( nMask & 0x40 )  rStm.WriteUChar( aReadOnlyDoc );
      97           0 :     if( nMask & 0x80 )  rStm.WriteUChar( aHidden );
      98           0 : }
      99             : 
     100           0 : SvMetaType * SvMetaAttribute::GetType() const
     101             : {
     102           0 :     if( aType.Is() || !GetRef() ) return aType;
     103           0 :     return ((SvMetaAttribute *)GetRef())->GetType();
     104             : }
     105             : 
     106           0 : const SvNumberIdentifier & SvMetaAttribute::GetSlotId() const
     107             : {
     108           0 :     if( aSlotId.IsSet() || !GetRef() ) return aSlotId;
     109           0 :     return ((SvMetaAttribute *)GetRef())->GetSlotId();
     110             : }
     111             : 
     112           0 : sal_Bool SvMetaAttribute::GetReadonly() const
     113             : {
     114           0 :     if( aReadonly.IsSet() || !GetRef() ) return aReadonly;
     115           0 :     return ((SvMetaAttribute *)GetRef())->GetReadonly();
     116             : }
     117             : 
     118           0 : sal_Bool SvMetaAttribute::GetExport() const
     119             : {
     120           0 :     if( aExport.IsSet() || !GetRef() ) return aExport;
     121           0 :     return ((SvMetaAttribute *)GetRef())->GetExport();
     122             : }
     123             : 
     124           0 : sal_Bool SvMetaAttribute::GetHidden() const
     125             : {
     126             :     // when export is set, but hidden is not the default is used
     127           0 :     if ( aExport.IsSet() && !aHidden.IsSet() )
     128           0 :         return !aExport;
     129           0 :     else if( aHidden.IsSet() || !GetRef() )
     130           0 :         return aHidden;
     131             :     else
     132           0 :         return ((SvMetaAttribute *)GetRef())->GetHidden();
     133             : }
     134             : 
     135           0 : sal_Bool SvMetaAttribute::GetAutomation() const
     136             : {
     137           0 :     if( aAutomation.IsSet() || !GetRef() ) return aAutomation;
     138           0 :     return ((SvMetaAttribute *)GetRef())->GetAutomation();
     139             : }
     140             : 
     141           0 : sal_Bool SvMetaAttribute::GetIsCollection() const
     142             : {
     143             :     sal_Bool bRet;
     144           0 :     if( aIsCollection.IsSet() || !GetRef() )
     145             :     {
     146           0 :         if ( aIsCollection.IsSet() )
     147             :         {
     148           0 :             bRet = aIsCollection;
     149           0 :             return bRet;
     150             :         }
     151             : 
     152           0 :         return aIsCollection;
     153             :     }
     154             : 
     155           0 :     return ((SvMetaSlot *)GetRef())->GetIsCollection();
     156             : }
     157             : 
     158           0 : sal_Bool SvMetaAttribute::GetReadOnlyDoc() const
     159             : {
     160           0 :     if( aReadOnlyDoc.IsSet() || !GetRef() ) return aReadOnlyDoc;
     161           0 :     return ((SvMetaSlot *)GetRef())->GetReadOnlyDoc();
     162             : }
     163             : 
     164           0 : sal_Bool SvMetaAttribute::IsMethod() const
     165             : {
     166           0 :     SvMetaType * pType = GetType();
     167             :     DBG_ASSERT( pType, "no type for attribute" );
     168           0 :     return pType->GetType() == TYPE_METHOD;
     169             : }
     170             : 
     171           0 : sal_Bool SvMetaAttribute::IsVariable() const
     172             : {
     173           0 :     SvMetaType * pType = GetType();
     174           0 :     return pType->GetType() != TYPE_METHOD;
     175             : }
     176             : 
     177           0 : OString SvMetaAttribute::GetMangleName( sal_Bool ) const
     178             : {
     179           0 :     return GetName().getString();
     180             : }
     181             : 
     182           0 : sal_Bool SvMetaAttribute::Test( SvIdlDataBase & rBase,
     183             :                             SvTokenStream & rInStm )
     184             : {
     185           0 :     sal_Bool bOk = sal_True;
     186           0 :     if( GetType()->IsItem() && !GetSlotId().IsSet() )
     187             :     {
     188           0 :         rBase.SetError( "slot without id declared", rInStm.GetToken() );
     189           0 :         rBase.WriteError( rInStm );
     190           0 :         bOk = sal_False;
     191             :     }
     192           0 :     return bOk;
     193             : }
     194             : 
     195           0 : sal_Bool SvMetaAttribute::ReadSvIdl( SvIdlDataBase & rBase,
     196             :                                      SvTokenStream & rInStm )
     197             : {
     198           0 :     sal_uInt32  nTokPos     = rInStm.Tell();
     199           0 :     if( !GetType() )
     200             :         // no type in ctor passed on
     201           0 :         aType = rBase.ReadKnownType( rInStm );
     202           0 :     sal_Bool bOk = sal_False;
     203           0 :     if( GetType() )
     204             :     {
     205           0 :         ReadNameSvIdl( rBase, rInStm );
     206           0 :         aSlotId.ReadSvIdl( rBase, rInStm );
     207             : 
     208           0 :         bOk = sal_True;
     209           0 :         SvToken * pTok  = rInStm.GetToken();
     210           0 :         if( bOk && pTok->IsChar() && pTok->GetChar() == '(' )
     211             :         {
     212           0 :             SvMetaTypeRef xT = new SvMetaType();
     213           0 :             xT->SetRef( GetType() );
     214           0 :             aType = xT;
     215           0 :             bOk = aType->ReadMethodArgs( rBase, rInStm );
     216             :         }
     217           0 :         if( bOk )
     218           0 :             bOk = SvMetaName::ReadSvIdl( rBase, rInStm );
     219             :     }
     220             :     else
     221             :     {
     222           0 :         SvToken *pTok = rInStm.GetToken();
     223             :         rBase.SetError( "unknown type of token. Each new SID needs an "
     224             :                         "item statement in an SDI file, eg. "
     225           0 :                         "SfxVoidItem FooItem  " + pTok->GetTokenAsString() +
     226           0 :                         " ... which describes the slot more fully", pTok );
     227             :     }
     228             : 
     229           0 :     if( !bOk )
     230           0 :         rInStm.Seek( nTokPos );
     231           0 :     return bOk;
     232             : }
     233             : 
     234           0 : void SvMetaAttribute::WriteSvIdl
     235             : (
     236             :     SvIdlDataBase & rBase,
     237             :     SvStream & rOutStm,
     238             :     sal_uInt16 nTab
     239             : )
     240             : {
     241           0 :     SvMetaType * pType = GetType();
     242           0 :     pType->WriteTypePrefix( rBase, rOutStm, nTab, WRITE_IDL );
     243           0 :     rOutStm.WriteChar( ' ' ).WriteCharPtr( GetName().getString().getStr() );
     244           0 :     if( aSlotId.IsSet() )
     245           0 :         rOutStm.WriteChar( ' ' ).WriteCharPtr( aSlotId.getString().getStr() );
     246           0 :     if( pType->GetType() == TYPE_METHOD )
     247           0 :         pType->WriteMethodArgs( rBase, rOutStm, nTab, WRITE_IDL );
     248           0 :     sal_uLong nPos = rOutStm.Tell();
     249           0 :     rOutStm << endl;
     250           0 :     SvMetaName::WriteSvIdl( rBase, rOutStm, nTab );
     251           0 :     TestAndSeekSpaceOnly( rOutStm, nPos );
     252           0 : }
     253             : 
     254           0 : void SvMetaAttribute::ReadAttributesSvIdl( SvIdlDataBase & rBase,
     255             :                                              SvTokenStream & rInStm )
     256             : {
     257           0 :     SvMetaReference::ReadAttributesSvIdl( rBase, rInStm );
     258           0 :     aSlotId.ReadSvIdl( rBase, SvHash_SlotId(), rInStm );
     259           0 :     aExport.ReadSvIdl( SvHash_Export(), rInStm );
     260           0 :     aHidden.ReadSvIdl( SvHash_Hidden(), rInStm );
     261           0 :     aAutomation.ReadSvIdl( SvHash_Automation(), rInStm );
     262           0 :     aIsCollection.ReadSvIdl( SvHash_IsCollection(), rInStm );
     263           0 :     aReadOnlyDoc.ReadSvIdl( SvHash_ReadOnlyDoc(), rInStm );
     264           0 :     if( aReadonly.ReadSvIdl( SvHash_Readonly(), rInStm ) )
     265             :     {
     266           0 :         if( GetType()->GetType() == TYPE_METHOD )
     267             :         {
     268             :             // set error
     269           0 :             rBase.SetError( "Readonly in function attribute", rInStm.GetToken() );
     270           0 :             rBase.WriteError( rInStm );
     271             :         }
     272             :     }
     273           0 : }
     274             : 
     275           0 : void SvMetaAttribute::WriteAttributesSvIdl
     276             : (
     277             :     SvIdlDataBase & rBase,
     278             :     SvStream & rOutStm,
     279             :     sal_uInt16 nTab
     280             : )
     281             : {
     282           0 :     SvMetaReference::WriteAttributesSvIdl( rBase, rOutStm, nTab );
     283             : 
     284           0 :     if( !aExport || !aAutomation || aReadonly )
     285             :     {
     286           0 :         WriteTab( rOutStm, nTab );
     287           0 :         rOutStm.WriteCharPtr( "//class SvMetaAttribute" ) << endl;
     288           0 :         if( !aExport )
     289             :         {
     290           0 :             WriteTab( rOutStm, nTab );
     291           0 :             aExport.WriteSvIdl( SvHash_Export(), rOutStm );
     292           0 :             rOutStm.WriteChar( ';' ) << endl;
     293             :         }
     294           0 :         if ( aHidden != aExport )
     295             :         {
     296           0 :             WriteTab( rOutStm, nTab );
     297           0 :             aExport.WriteSvIdl( SvHash_Hidden(), rOutStm );
     298           0 :             rOutStm.WriteChar( ';' ) << endl;
     299             :         }
     300           0 :         if( aReadonly )
     301             :         {
     302           0 :             WriteTab( rOutStm, nTab );
     303           0 :             aReadonly.WriteSvIdl( SvHash_Readonly(), rOutStm );
     304           0 :             rOutStm.WriteChar( ';' ) << endl;
     305             :         }
     306           0 :         if( !aAutomation )
     307             :         {
     308           0 :             WriteTab( rOutStm, nTab );
     309           0 :             aAutomation.WriteSvIdl( SvHash_Automation(), rOutStm );
     310           0 :             rOutStm.WriteChar( ';' ) << endl;
     311             :         }
     312           0 :         if( aIsCollection )
     313             :         {
     314           0 :             WriteTab( rOutStm, nTab );
     315           0 :             aIsCollection.WriteSvIdl( SvHash_IsCollection(), rOutStm );
     316           0 :             rOutStm.WriteChar( ';' ) << endl;
     317             :         }
     318           0 :         if( !aReadOnlyDoc )
     319             :         {
     320           0 :             WriteTab( rOutStm, nTab );
     321           0 :             aReadOnlyDoc.WriteSvIdl( SvHash_ReadOnlyDoc(), rOutStm );
     322           0 :             rOutStm.WriteChar( ';' ) << endl;
     323             :         }
     324             :     }
     325           0 : }
     326             : 
     327           0 : void SvMetaAttribute::WriteParam( SvIdlDataBase & rBase,
     328             :                                     SvStream & rOutStm,
     329             :                                     sal_uInt16 nTab,
     330             :                                     WriteType nT )
     331             : {
     332           0 :     SvMetaType * pType = GetType();
     333             :     DBG_ASSERT( pType, "no type for attribute" );
     334           0 :     SvMetaType * pBaseType = pType->GetBaseType();
     335             :     DBG_ASSERT( pBaseType, "no base type for attribute" );
     336             : 
     337           0 :     if( nT == WRITE_ODL || nT == WRITE_DOCU
     338           0 :        || nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
     339             :     {
     340           0 :         if( pBaseType->GetType() == TYPE_STRUCT )
     341             :         {
     342           0 :             const SvMetaAttributeMemberList & rList = pBaseType->GetAttrList();
     343           0 :             sal_uLong nCount = rList.size();
     344           0 :             for( sal_uLong i = 0; i < nCount; i++ )
     345             :             {
     346           0 :                 rList[i]->WriteParam( rBase, rOutStm, nTab, nT );
     347           0 :                 if( i+1<nCount )
     348             :                 {
     349           0 :                         rOutStm.WriteChar( ',' );
     350             :                 }
     351             :             }
     352             :         }
     353             :         else
     354             :         {
     355           0 :             if ( nT != WRITE_DOCU )
     356             :             {
     357           0 :                 WriteTab( rOutStm, nTab );
     358           0 :                 pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
     359             :             }
     360             : 
     361           0 :             if( !GetName().getString().isEmpty() )
     362             :             {
     363           0 :                 rOutStm.WriteChar( ' ' );
     364           0 :                 rOutStm.WriteCharPtr( GetName().getString().getStr() );
     365             :             }
     366             : 
     367           0 :             if ( nT == WRITE_DOCU )
     368             :             {
     369           0 :                 if( pBaseType->GetType() == TYPE_METHOD ||
     370           0 :                      pBaseType->GetType() == TYPE_STRUCT ||
     371           0 :                     pBaseType->GetType() == TYPE_ENUM )
     372             :                 {
     373             :                     OSL_FAIL( "Falscher Parametertyp!" );
     374             :                 }
     375             :                 else
     376           0 :                     rOutStm.WriteCharPtr( pBaseType->GetBasicPostfix().getStr() );
     377             :             }
     378             :         }
     379             :     }
     380           0 : }
     381             : 
     382           0 : sal_uLong SvMetaAttribute::MakeSlotValue( SvIdlDataBase & rBase, sal_Bool bVar ) const
     383             : {
     384           0 :     const SvNumberIdentifier & rId = GetSlotId();
     385           0 :     sal_uLong n = rId.GetValue();
     386           0 :     if( !rBase.aStructSlotId.getString().isEmpty() )
     387             :     {
     388           0 :         n = n << 20;
     389           0 :         n += rBase.aStructSlotId.GetValue();
     390             :     }
     391           0 :     if( PTR_CAST( SvMetaSlot, this ) )
     392           0 :         n |= 0x20000;
     393           0 :     if( !bVar )
     394           0 :         n += 0x10000;
     395           0 :     else if ( GetIsCollection() )
     396           0 :         n += 0x40000;
     397           0 :     return n;
     398             : }
     399             : 
     400           0 : void SvMetaAttribute::WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm,
     401             :                                       sal_uInt16 nTab,
     402             :                                       WriteType nT, WriteAttribute nA )
     403             : {
     404           0 :     if( nT == WRITE_ODL  )
     405             :     {
     406           0 :         const SvNumberIdentifier & rId = GetSlotId();
     407           0 :         sal_Bool bReadonly = GetReadonly() || ( nA & WA_READONLY );
     408           0 :         if( (rId.IsSet() && !(nA & WA_STRUCT)) || bReadonly )
     409             :         {
     410           0 :             sal_Bool bVar = IsVariable();
     411           0 :             if( nA & WA_VARIABLE )
     412           0 :                 bVar = sal_True;
     413           0 :             else if( nA & WA_METHOD )
     414           0 :                 bVar = sal_False;
     415             : 
     416           0 :             WriteTab( rOutStm, nTab );
     417           0 :             rOutStm.WriteCharPtr( "//class SvMetaAttribute" ) << endl;
     418           0 :             if( rId.IsSet() && !(nA & WA_STRUCT) )
     419             :             {
     420           0 :                 WriteTab( rOutStm, nTab );
     421           0 :                 rOutStm.WriteCharPtr( "id(" )
     422           0 :                    .WriteCharPtr( OString::number(MakeSlotValue(rBase,bVar)).getStr() )
     423           0 :                    .WriteCharPtr( ")," ) << endl;
     424             :             }
     425           0 :             if( bVar && (bReadonly || IsMethod()) )
     426             :             {
     427           0 :                 WriteTab( rOutStm, nTab );
     428           0 :                 rOutStm.WriteCharPtr( "readonly," ) << endl;
     429             :             }
     430             :         }
     431             :     }
     432           0 : }
     433             : 
     434           0 : void SvMetaAttribute::WriteCSource( SvIdlDataBase & rBase, SvStream & rOutStm,
     435             :                                     sal_Bool bSet )
     436             : {
     437           0 :     rOutStm << endl;
     438           0 :     SvMetaType * pType = GetType();
     439           0 :     SvMetaType * pBaseType = pType->GetBaseType();
     440             : 
     441             :     // for Set the return is always void
     442           0 :     sal_Bool bVoid = bSet;
     443           0 :     if( pBaseType->GetType() == TYPE_METHOD )
     444           0 :         bVoid = pBaseType->GetReturnType()->GetBaseType()->GetName().getString() == "void";
     445             : 
     446             :     // emit methods/functions body
     447           0 :     rOutStm.WriteChar( '{' ) << endl;
     448           0 :     WriteTab( rOutStm, 1 );
     449             : 
     450           0 :     if( !bVoid )
     451             :     {
     452           0 :         if ( pBaseType->GetCName() == "double" )
     453             :         {
     454           0 :             rOutStm.WriteCharPtr( "return *(double*)" );
     455             :         }
     456             :         else
     457             :         {
     458           0 :             rOutStm.WriteCharPtr( "return (" );
     459           0 :             pType->WriteTypePrefix( rBase, rOutStm, 2, WRITE_C_SOURCE );
     460           0 :             rOutStm.WriteCharPtr( ") " );
     461             :         }
     462             :     }
     463           0 :     rOutStm.WriteCharPtr( "pODKCallFunction( " )
     464           0 :        .WriteCharPtr( OString::number(MakeSlotValue(rBase, IsVariable())).getStr() );
     465           0 :     rOutStm.WriteChar( ',' ) << endl;
     466           0 :     WriteTab( rOutStm, 3 );
     467           0 :     rOutStm.WriteCharPtr( " h" ).WriteCharPtr( rBase.aIFaceName.getStr() ).WriteCharPtr( " , " );
     468             : 
     469           0 :     OString aParserStr;
     470           0 :     if( pBaseType->GetType() == TYPE_METHOD || bSet )
     471           0 :         aParserStr = pBaseType->GetParserString();
     472           0 :     if( !aParserStr.isEmpty() )
     473             :     {
     474           0 :         rOutStm.WriteChar( '\"' );
     475           0 :         rOutStm.WriteCharPtr( aParserStr.getStr() );
     476           0 :         rOutStm.WriteCharPtr( "\", " );
     477             :     }
     478             :     else
     479           0 :         rOutStm.WriteCharPtr( "NULL, " );
     480             : 
     481           0 :     if( pBaseType->GetType() == TYPE_METHOD && !bVoid )
     482             :     {
     483           0 :         rOutStm.WriteCharPtr( "'" );
     484           0 :         rOutStm.WriteChar( pBaseType->GetReturnType()->GetBaseType()->GetParserChar() );
     485           0 :         rOutStm.WriteCharPtr( "'" );
     486             :     }
     487           0 :     else if ( !bSet )
     488             :     {
     489           0 :         rOutStm.WriteCharPtr( "'" );
     490           0 :         rOutStm.WriteChar( pBaseType->GetParserChar() );
     491           0 :         rOutStm.WriteCharPtr( "'" );
     492             :     }
     493             :     else
     494           0 :         rOutStm.WriteChar( '0' );
     495             : 
     496           0 :     if( !aParserStr.isEmpty() )
     497             :     {
     498           0 :         rOutStm.WriteCharPtr( ", " );
     499           0 :         if( IsMethod() )
     500           0 :             pBaseType->WriteParamNames( rBase, rOutStm, OString() );
     501           0 :         else if( bSet )
     502           0 :             pBaseType->WriteParamNames( rBase, rOutStm, GetName().getString() );
     503             :     }
     504             : 
     505           0 :     rOutStm.WriteCharPtr( " );" ) << endl;
     506           0 :     rOutStm.WriteChar( '}' ) << endl;
     507           0 : }
     508             : 
     509           0 : void SvMetaAttribute::WriteRecursiv_Impl( SvIdlDataBase & rBase,
     510             :                             SvStream & rOutStm, sal_uInt16 nTab,
     511             :                              WriteType nT, WriteAttribute nA )
     512             : {
     513           0 :     const SvMetaAttributeMemberList & rList = GetType()->GetBaseType()->GetAttrList();
     514           0 :     sal_uLong nCount = rList.size();
     515             : 
     516           0 :     SvNumberIdentifier slotId = rBase.aStructSlotId;
     517           0 :     if ( !GetSlotId().getString().isEmpty() )
     518           0 :         rBase.aStructSlotId = GetSlotId();
     519             : 
     520             :     // offial hack interface by MM: special controls get passed with the WriteAttribute
     521           0 :     if ( GetReadonly() )
     522           0 :         nA |= WA_READONLY;
     523             : 
     524           0 :     for( sal_uLong i = 0; i < nCount; i++ )
     525             :     {
     526           0 :         SvMetaAttribute *pAttr = rList[i];
     527           0 :         if ( nT == WRITE_DOCU )
     528           0 :             pAttr->SetDescription( GetDescription().getString() );
     529           0 :         pAttr->Write( rBase, rOutStm, nTab, nT, nA );
     530           0 :         if( nT == WRITE_ODL && i +1 < nCount )
     531           0 :             rOutStm.WriteChar( ';' ) << endl;
     532             :     }
     533             : 
     534           0 :     rBase.aStructSlotId = slotId;
     535           0 : }
     536             : 
     537           0 : void SvMetaAttribute::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
     538             :                             sal_uInt16 nTab,
     539             :                              WriteType nT, WriteAttribute nA )
     540             : {
     541             :     // no attributes for automation
     542           0 :     if( nT == WRITE_DOCU )
     543             :     {
     544           0 :         if ( GetHidden() )
     545           0 :             return;
     546             :     }
     547           0 :     else if ( !GetAutomation() || !GetExport() )
     548           0 :         return;
     549             : 
     550             :     sal_Bool bVariable;
     551           0 :     if( nA & WA_VARIABLE )
     552           0 :         bVariable = sal_True;
     553           0 :     else if( nA & WA_METHOD )
     554           0 :         bVariable = sal_False;
     555             :     else
     556           0 :         bVariable = IsVariable();
     557             : 
     558           0 :     SvMetaType * pType = GetType();
     559             :     DBG_ASSERT( pType, "no type for attribute" );
     560           0 :     SvMetaType * pBaseType = pType->GetBaseType();
     561             :     DBG_ASSERT( pBaseType, "no base type for attribute" );
     562           0 :     int nBType = pBaseType->GetType();
     563             : 
     564           0 :     if( nT == WRITE_ODL )
     565             :     {
     566           0 :         if( (bVariable && IsVariable()) || (!bVariable && IsMethod()) )
     567             :         {
     568           0 :             if( nBType == TYPE_STRUCT )
     569           0 :                 WriteRecursiv_Impl( rBase, rOutStm, nTab, nT, nA );
     570             :             else
     571             :             {
     572           0 :                 SvMetaReference::Write( rBase, rOutStm, nTab, nT, nA );
     573           0 :                 WriteTab( rOutStm, nTab );
     574           0 :                 pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
     575             : 
     576           0 :                 if( !GetName().getString().isEmpty() )
     577             :                 {
     578           0 :                     rOutStm.WriteChar( ' ' );
     579           0 :                     rOutStm.WriteCharPtr( GetName().getString().getStr() );
     580             :                 }
     581           0 :                 if( pType->GetType() == TYPE_METHOD )
     582           0 :                     pType->WriteMethodArgs( rBase, rOutStm, nTab, nT );
     583             :             }
     584             :         }
     585             :     }
     586           0 :     else if( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
     587             :     {
     588           0 :         if( !bVariable && IsMethod() )
     589             :         {
     590           0 :             OString name = rBase.aIFaceName + GetName().getString();
     591           0 :             const char * pName = name.getStr();
     592           0 :             WriteTab( rOutStm, nTab );
     593           0 :             pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
     594           0 :             rOutStm.WriteChar( ' ' ).WriteCharPtr( pName );
     595           0 :             pType->WriteMethodArgs( rBase, rOutStm, nTab, nT );
     596           0 :             if( nT == WRITE_C_HEADER )
     597           0 :                 rOutStm.WriteChar( ';' ) << endl << endl;
     598             :             else
     599           0 :                 WriteCSource( rBase, rOutStm, sal_False );
     600             :         }
     601           0 :         else if ( bVariable && IsVariable() )
     602             :         {
     603           0 :               if( nBType == TYPE_STRUCT )
     604             :             {
     605             :                 // for assistance emit the name of the property as acomment
     606           0 :                 rOutStm.WriteCharPtr( "/* " ).WriteCharPtr( GetName().getString().getStr() ).WriteCharPtr( " */" ) << endl;
     607             : 
     608           0 :                 WriteRecursiv_Impl( rBase, rOutStm, nTab, nT, nA );
     609             :             }
     610             :             else
     611             :             {
     612           0 :                 OString name = GetName().getString();
     613             : 
     614           0 :                 sal_Bool bReadonly = GetReadonly() || ( nA & WA_READONLY );
     615           0 :                 if ( !bReadonly && !IsMethod() )
     616             :                 {
     617             :                     // allocation
     618           0 :                     WriteTab( rOutStm, nTab );
     619           0 :                     rOutStm.WriteCharPtr( "void " );
     620           0 :                     rOutStm.WriteCharPtr( rBase.aIFaceName.getStr() )
     621           0 :                            .WriteCharPtr( "Set" ).WriteCharPtr( name.getStr() ).WriteCharPtr( "( " ).WriteCharPtr( C_PREF )
     622           0 :                            .WriteCharPtr( "Object h" ).WriteCharPtr( rBase.aIFaceName.getStr() ).WriteCharPtr( ", " ) << endl;
     623           0 :                     WriteTab( rOutStm, nTab+1 );
     624           0 :                     pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
     625           0 :                     rOutStm.WriteChar( ' ' ).WriteCharPtr( name.getStr() ).WriteCharPtr( " )" );
     626           0 :                     if( nT == WRITE_C_HEADER )
     627           0 :                         rOutStm.WriteChar( ';' ) << endl << endl;
     628             :                     else
     629           0 :                         WriteCSource( rBase, rOutStm, sal_True );
     630             :                 }
     631             : 
     632             :                 // access
     633           0 :                 WriteTab( rOutStm, nTab );
     634           0 :                 pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
     635           0 :                 rOutStm.WriteChar( ' ' );
     636           0 :                 rOutStm.WriteCharPtr( rBase.aIFaceName.getStr() )
     637           0 :                        .WriteCharPtr( "Get" ).WriteCharPtr( name.getStr() ).WriteCharPtr( "( " ).WriteCharPtr( C_PREF )
     638           0 :                        .WriteCharPtr( "Object h" ).WriteCharPtr( rBase.aIFaceName.getStr() ).WriteCharPtr( " )" );
     639           0 :                 if( nT == WRITE_C_HEADER )
     640           0 :                     rOutStm.WriteChar( ';' ) << endl << endl;
     641             :                 else
     642           0 :                     WriteCSource( rBase, rOutStm, sal_False );
     643             :             }
     644           0 :         }
     645             :     }
     646           0 :     else if ( nT == WRITE_DOCU )
     647             :     {
     648           0 :         if( !bVariable && IsMethod() )
     649             :         {
     650           0 :             rOutStm.WriteCharPtr( "<METHOD>" ) << endl;
     651           0 :             rOutStm.WriteCharPtr( GetSlotId().getString().getStr() ) << endl;
     652           0 :             rOutStm.WriteCharPtr( GetName().getString().getStr() ) << endl
     653           0 :                     << endl;    // readonly
     654             : 
     655             :             // return type
     656           0 :             SvMetaType* pType2 = GetType();
     657           0 :             SvMetaType* pBaseType2 = pType2->GetBaseType();
     658           0 :             rOutStm.WriteCharPtr( pBaseType2->GetReturnType()->GetBaseType()->GetBasicName().getStr() ) << endl;
     659             : 
     660             :             DBG_ASSERT( !pBaseType2->GetReturnType()->GetBaseType()->GetBasicName().isEmpty(),
     661             :                 "Leerer BasicName" );
     662             : 
     663             :             // syntax
     664           0 :             rOutStm.WriteCharPtr( GetName().getString().getStr() );
     665           0 :             pType2->WriteMethodArgs( rBase, rOutStm, nTab, nT );
     666             : 
     667             :             // C return type
     668           0 :             pBaseType2->WriteTypePrefix( rBase, rOutStm, 0, WRITE_C_HEADER );
     669           0 :             rOutStm << endl;
     670             : 
     671             :             // for methods also C syntax
     672           0 :             rOutStm.WriteCharPtr( "<C-SYNTAX>" ) << endl;
     673           0 :             Write( rBase, rOutStm, 0, WRITE_C_HEADER, nA );
     674           0 :             rOutStm.WriteCharPtr( "</C-SYNTAX>" ) << endl;
     675             : 
     676             :             // description
     677           0 :             WriteDescription( rOutStm );
     678           0 :             rOutStm.WriteCharPtr( "</METHOD>" ) << endl << endl;
     679             :         }
     680           0 :         else if( bVariable && IsVariable() )
     681             :         {
     682           0 :             if( nBType == TYPE_STRUCT )
     683             :             {
     684           0 :                 WriteRecursiv_Impl( rBase, rOutStm, nTab, nT, nA );
     685             :             }
     686             :             else
     687             :             {
     688           0 :                 rOutStm.WriteCharPtr( "<PROPERTY>" ) << endl;
     689           0 :                 rOutStm.WriteCharPtr( GetSlotId().getString().getStr() ) << endl;
     690           0 :                 rOutStm.WriteCharPtr( GetName().getString().getStr() ) << endl;
     691           0 :                 if ( GetReadonly() )
     692           0 :                     rOutStm.WriteCharPtr( "(nur lesen)" ) << endl;
     693             :                 else
     694           0 :                     rOutStm << endl;
     695             : 
     696             :                 // for properties type instead of the return value
     697           0 :                 rOutStm.WriteCharPtr( pBaseType->GetBasicName().getStr() ) << endl;
     698             : 
     699             :                 DBG_ASSERT( !pBaseType->GetBasicName().isEmpty(),
     700             :                     "Leerer BasicName" );
     701             : 
     702             :                 // for properties no syntax
     703           0 :                 rOutStm << endl;
     704             : 
     705             :                 // C return type
     706           0 :                 pBaseType->WriteTypePrefix( rBase, rOutStm, 0, WRITE_C_HEADER );
     707           0 :                 rOutStm << endl;
     708             : 
     709             :                 // description
     710           0 :                 WriteDescription( rOutStm );
     711           0 :                 rOutStm.WriteCharPtr( "</PROPERTY>" ) << endl << endl;
     712             :             }
     713             :         }
     714             :     }
     715             : }
     716             : 
     717           0 : sal_uLong SvMetaAttribute::MakeSfx( OStringBuffer& rAttrArray )
     718             : {
     719           0 :     SvMetaType * pType = GetType();
     720             :     DBG_ASSERT( pType, "no type for attribute" );
     721           0 :     SvMetaType * pBaseType = pType->GetBaseType();
     722             :     DBG_ASSERT( pBaseType, "no base type for attribute" );
     723           0 :     if( pBaseType->GetType() == TYPE_STRUCT )
     724           0 :         return pBaseType->MakeSfx( rAttrArray );
     725             :     else
     726             :     {
     727           0 :         rAttrArray.append('{');
     728           0 :         rAttrArray.append(GetSlotId().getString());
     729           0 :         rAttrArray.append(",\"");
     730           0 :         rAttrArray.append(GetName().getString());
     731           0 :         rAttrArray.append("\"}");
     732           0 :         return 1;
     733             :     }
     734             : }
     735             : 
     736           0 : void SvMetaAttribute::Insert (SvSlotElementList&, const OString&, SvIdlDataBase&)
     737             : {
     738           0 : }
     739             : 
     740           0 : void SvMetaAttribute::WriteHelpId( SvIdlDataBase &, SvStream &, HelpIdTable& )
     741             : {
     742           0 : }
     743             : 
     744           0 : SV_IMPL_META_FACTORY1( SvMetaType, SvMetaExtern );
     745             : #define CTOR                            \
     746             :     : aCall0( CALL_VALUE, sal_False )       \
     747             :     , aCall1( CALL_VALUE, sal_False )       \
     748             :     , aSbxDataType( 0, sal_False )          \
     749             :     , pAttrList( NULL )                 \
     750             :     , nType( TYPE_BASE )                \
     751             :     , bIsItem( sal_False )                  \
     752             :     , bIsShell( sal_False )                 \
     753             :     , cParserChar( 'h' )
     754             : 
     755           0 : SvMetaType::SvMetaType()
     756           0 :     CTOR
     757             : {
     758           0 : }
     759             : 
     760           0 : SvMetaType::SvMetaType( const OString& rName, char cPC,
     761             :                         const OString& rCName )
     762           0 :     CTOR
     763             : {
     764           0 :     SetName( rName );
     765           0 :     cParserChar = cPC;
     766           0 :     aCName.setString(rCName);
     767           0 : }
     768             : 
     769           0 : SvMetaType::SvMetaType( const OString& rName,
     770             :                         const OString& rSbxName,
     771             :                         const OString& rOdlName,
     772             :                         char cPc,
     773             :                         const OString& rCName,
     774             :                         const OString& rBasicName,
     775             :                         const OString& rBasicPostfix )
     776           0 :     CTOR
     777             : {
     778           0 :     SetName( rName );
     779           0 :     aSbxName.setString(rSbxName);
     780           0 :     aOdlName.setString(rOdlName);
     781           0 :     cParserChar = cPc;
     782           0 :     aCName.setString(rCName);
     783           0 :     aBasicName.setString(rBasicName);
     784           0 :     aBasicPostfix.setString(rBasicPostfix);
     785           0 : }
     786             : 
     787           0 : void SvMetaType::Load( SvPersistStream & rStm )
     788             : {
     789           0 :     SvMetaExtern::Load( rStm );
     790             : 
     791             :     sal_uInt16 nMask;
     792           0 :     rStm.ReadUInt16( nMask );
     793           0 :     if( nMask & 0x0001 ) rStm >> aIn;
     794           0 :     if( nMask & 0x0002 ) rStm >> aOut;
     795           0 :     if( nMask & 0x0004 ) rStm >> aCall0;
     796           0 :     if( nMask & 0x0008 ) rStm >> aCall1;
     797           0 :     if( nMask & 0x0010 ) rStm >> aSbxDataType;
     798           0 :     if( nMask & 0x0020 ) rStm >> aSvName;
     799           0 :     if( nMask & 0x0040 ) rStm >> aSbxName;
     800           0 :     if( nMask & 0x0080 ) rStm >> aOdlName;
     801           0 :     if( nMask & 0x0100 ) rStm >> GetAttrList();
     802           0 :     if( nMask & 0x0200 ) bIsItem = sal_True;
     803           0 :     if( nMask & 0x0400 ) bIsShell = sal_True;
     804           0 :     if( nMask & 0x0800 )
     805             :     {
     806             :         sal_uInt16 nT;
     807           0 :         rStm.ReadUInt16( nT );
     808           0 :         nType = nT;
     809             :     }
     810           0 :     if( nMask & 0x1000 ) rStm.ReadChar( cParserChar );
     811           0 :     if( nMask & 0x2000 ) rStm >> aCName;
     812           0 :     if( nMask & 0x4000 ) rStm >> aBasicName;
     813           0 :     if( nMask & 0x8000 ) rStm >> aBasicPostfix;
     814           0 : }
     815             : 
     816           0 : void SvMetaType::Save( SvPersistStream & rStm )
     817             : {
     818           0 :     SvMetaExtern::Save( rStm );
     819             : 
     820             :     // create mask
     821           0 :     sal_uInt16 nMask = 0;
     822           0 :     if( aIn.IsSet() )               nMask |= 0x0001;
     823           0 :     if( aOut.IsSet() )              nMask |= 0x0002;
     824           0 :     if( aCall0.IsSet() )            nMask |= 0x0004;
     825           0 :     if( aCall1.IsSet() )            nMask |= 0x0008;
     826           0 :     if( aSbxDataType.IsSet() )      nMask |= 0x0010;
     827           0 :     if( aSvName.IsSet() )           nMask |= 0x0020;
     828           0 :     if( aSbxName.IsSet() )          nMask |= 0x0040;
     829           0 :     if( aOdlName.IsSet() )          nMask |= 0x0080;
     830           0 :     if( GetAttrCount() )            nMask |= 0x0100;
     831           0 :     if( bIsItem )                   nMask |= 0x0200;
     832           0 :     if( bIsShell )                  nMask |= 0x0400;
     833           0 :     if( nType != TYPE_BASE )        nMask |= 0x0800;
     834           0 :     if( cParserChar != 'h' )        nMask |= 0x1000;
     835           0 :     if( aCName.IsSet() )            nMask |= 0x2000;
     836           0 :     if( aBasicName.IsSet() )        nMask |= 0x4000;
     837           0 :     if( aBasicPostfix.IsSet() )     nMask |= 0x8000;
     838             : 
     839             :     // write data
     840           0 :     rStm.WriteUInt16( nMask );
     841           0 :     if( nMask & 0x0001 ) WriteSvBOOL( rStm, aIn );
     842           0 :     if( nMask & 0x0002 ) WriteSvBOOL( rStm, aOut );
     843           0 :     if( nMask & 0x0004 ) WriteSvint( rStm, aCall0 );
     844           0 :     if( nMask & 0x0008 ) WriteSvint( rStm, aCall1 );
     845           0 :     if( nMask & 0x0010 ) WriteSvint( rStm, aSbxDataType );
     846           0 :     if( nMask & 0x0020 ) WriteSvIdentifier( rStm, aSvName );
     847           0 :     if( nMask & 0x0040 ) WriteSvIdentifier( rStm, aSbxName );
     848           0 :     if( nMask & 0x0080 ) WriteSvIdentifier( rStm, aOdlName );
     849           0 :     if( nMask & 0x0100 ) WriteSvDeclPersistList( rStm, *pAttrList );
     850           0 :     if( nMask & 0x0800 ) rStm.WriteUInt16( (sal_uInt16)nType );
     851           0 :     if( nMask & 0x1000 ) rStm.WriteChar( cParserChar );
     852           0 :     if( nMask & 0x2000 ) WriteSvIdentifier( rStm, aCName );
     853           0 :     if( nMask & 0x4000 ) WriteSvIdentifier( rStm, aBasicName );
     854           0 :     if( nMask & 0x8000 ) WriteSvIdentifier( rStm, aBasicPostfix );
     855           0 : }
     856             : 
     857           0 : SvMetaAttributeMemberList & SvMetaType::GetAttrList() const
     858             : {
     859           0 :     if( !pAttrList )
     860           0 :         ((SvMetaType *)this)->pAttrList = new SvMetaAttributeMemberList();
     861           0 :     return *pAttrList;
     862             : }
     863             : 
     864           0 : void SvMetaType::SetType( int nT )
     865             : {
     866           0 :     nType = nT;
     867           0 :     if( nType == TYPE_ENUM )
     868             :     {
     869           0 :         aOdlName.setString("short");
     870             :     }
     871           0 :     else if( nType == TYPE_CLASS )
     872             :     {
     873           0 :         OStringBuffer aTmp(C_PREF);
     874           0 :         aTmp.append("Object *");
     875           0 :         aCName.setString(aTmp.makeStringAndClear());
     876             :     }
     877           0 : }
     878             : 
     879           0 : SvMetaType * SvMetaType::GetBaseType() const
     880             : {
     881           0 :     if( GetRef() && GetType() == TYPE_BASE )
     882           0 :         return ((SvMetaType *)GetRef())->GetBaseType();
     883           0 :     return (SvMetaType *)this;
     884             : }
     885             : 
     886           0 : SvMetaType * SvMetaType::GetReturnType() const
     887             : {
     888             :     DBG_ASSERT( GetType() == TYPE_METHOD, "no method" );
     889             :     DBG_ASSERT( GetRef(), "no return type" );
     890           0 :     return (SvMetaType *)GetRef();
     891             : }
     892             : 
     893           0 : const OString& SvMetaType::GetBasicName() const
     894             : {
     895           0 :     if( aBasicName.IsSet() || !GetRef() )
     896           0 :         return aBasicName.getString();
     897             :     else
     898           0 :         return ((SvMetaType*)GetRef())->GetBasicName();
     899             : }
     900             : 
     901           0 : OString SvMetaType::GetBasicPostfix() const
     902             : {
     903             :     // MBN and Co always want "As xxx"
     904             :     return OStringBuffer(" As ").
     905           0 :         append(GetBasicName()).
     906           0 :         makeStringAndClear();
     907             : }
     908             : 
     909           0 : sal_Bool SvMetaType::GetIn() const
     910             : {
     911           0 :     if( aIn.IsSet() || !GetRef() )
     912           0 :         return aIn;
     913             :     else
     914           0 :         return ((SvMetaType *)GetRef())->GetIn();
     915             : }
     916             : 
     917           0 : sal_Bool SvMetaType::GetOut() const
     918             : {
     919           0 :     if( aOut.IsSet() || !GetRef() )
     920           0 :         return aOut;
     921             :     else
     922           0 :         return ((SvMetaType *)GetRef())->GetOut();
     923             : }
     924             : 
     925           0 : void SvMetaType::SetCall0( int e )
     926             : {
     927           0 :     aCall0 = (int)e;
     928           0 :     if( aCall0 == CALL_VALUE && aCall1 == CALL_VALUE )
     929             :     {
     930           0 :           if( GetType() == TYPE_POINTER )
     931           0 :             SetType( TYPE_BASE );
     932             :     }
     933             :     else
     934             :     {
     935             :         DBG_ASSERT( nType == TYPE_POINTER || nType == TYPE_BASE,
     936             :                     "set no base type to pointer" );
     937           0 :         SetType( TYPE_POINTER );
     938             :     }
     939           0 : }
     940             : 
     941           0 : int SvMetaType::GetCall0() const
     942             : {
     943           0 :     if( aCall0.IsSet() || !GetRef() )
     944           0 :         return aCall0;
     945             :     else
     946           0 :         return ((SvMetaType *)GetRef())->GetCall0();
     947             : }
     948             : 
     949           0 : void SvMetaType::SetCall1( int e )
     950             : {
     951           0 :     aCall1 = (int)e;
     952           0 :     if( aCall0 == CALL_VALUE && aCall1 == CALL_VALUE )
     953             :     {
     954           0 :           if( GetType() == TYPE_POINTER )
     955           0 :             SetType( TYPE_BASE );
     956             :     }
     957             :     else
     958             :     {
     959             :         DBG_ASSERT( nType == TYPE_POINTER || nType == TYPE_BASE,
     960             :                     "set no base type to pointer" );
     961           0 :         SetType( TYPE_POINTER );
     962             :     }
     963           0 : }
     964             : 
     965           0 : int SvMetaType::GetCall1() const
     966             : {
     967           0 :     if( aCall1.IsSet() || !GetRef() )
     968           0 :         return aCall1;
     969             :     else
     970           0 :         return ((SvMetaType *)GetRef())->GetCall1();
     971             : }
     972             : 
     973           0 : const OString& SvMetaType::GetSvName() const
     974             : {
     975           0 :     if( aSvName.IsSet() || !GetRef() )
     976           0 :         return aSvName.getString();
     977             :     else
     978           0 :         return ((SvMetaType *)GetRef())->GetSvName();
     979             : }
     980             : 
     981           0 : const OString& SvMetaType::GetSbxName() const
     982             : {
     983           0 :     if( aSbxName.IsSet() || !GetRef() )
     984           0 :         return aSbxName.getString();
     985             :     else
     986           0 :         return ((SvMetaType *)GetRef())->GetSbxName();
     987             : }
     988             : 
     989           0 : const OString& SvMetaType::GetOdlName() const
     990             : {
     991           0 :     if( aOdlName.IsSet() || !GetRef() )
     992           0 :         return aOdlName.getString();
     993             :     else
     994           0 :         return ((SvMetaType *)GetRef())->GetOdlName();
     995             : }
     996             : 
     997           0 : const OString& SvMetaType::GetCName() const
     998             : {
     999           0 :     if( aCName.IsSet() || !GetRef() )
    1000           0 :         return aCName.getString();
    1001             :     else
    1002           0 :         return ((SvMetaType *)GetRef())->GetCName();
    1003             : }
    1004             : 
    1005           0 : sal_Bool SvMetaType::SetName( const OString& rName, SvIdlDataBase * pBase )
    1006             : {
    1007           0 :     aSvName.setString(rName);
    1008           0 :     aSbxName.setString(rName);
    1009           0 :     aCName.setString(rName);
    1010           0 :     if( GetType() != TYPE_ENUM )
    1011           0 :         aOdlName.setString(rName);
    1012           0 :     return SvMetaReference::SetName( rName, pBase );
    1013             : }
    1014             : 
    1015           0 : OString SvMetaType::GetCString() const
    1016             : {
    1017           0 :     OStringBuffer out( GetSvName() );
    1018           0 :     if( aCall0 == (int)CALL_POINTER )
    1019           0 :         out.append(" *");
    1020           0 :     else if( aCall0 == (int)CALL_REFERENCE )
    1021           0 :         out.append(" &");
    1022           0 :     if( aCall1 == (int)CALL_POINTER )
    1023           0 :         out.append('*');
    1024           0 :     else if( aCall1 == (int)CALL_REFERENCE )
    1025           0 :         out.append('&');
    1026           0 :     return out.makeStringAndClear();
    1027             : }
    1028             : 
    1029           0 : sal_Bool SvMetaType::ReadHeaderSvIdl( SvIdlDataBase & rBase,
    1030             :                                      SvTokenStream & rInStm )
    1031             : {
    1032           0 :     sal_Bool bOk = sal_False;
    1033           0 :     sal_uInt32  nTokPos = rInStm.Tell();
    1034           0 :     SvToken * pTok = rInStm.GetToken_Next();
    1035             : 
    1036           0 :     if( pTok->Is( SvHash_interface() )
    1037           0 :       || pTok->Is( SvHash_shell() ) )
    1038             :     {
    1039           0 :         if( pTok->Is( SvHash_shell() ) )
    1040           0 :             bIsShell = sal_True;
    1041           0 :         SetType( TYPE_CLASS );
    1042           0 :         bOk = ReadNamesSvIdl( rBase, rInStm );
    1043             : 
    1044             :     }
    1045           0 :     else if( pTok->Is( SvHash_struct() ) )
    1046             :     {
    1047           0 :         SetType( TYPE_STRUCT );
    1048           0 :         bOk = ReadNamesSvIdl( rBase, rInStm );
    1049             :     }
    1050           0 :     else if( pTok->Is( SvHash_union() ) )
    1051             :     {
    1052           0 :         SetType( TYPE_UNION );
    1053           0 :         if( ReadNameSvIdl( rBase, rInStm ) )
    1054           0 :             return sal_True;
    1055             :     }
    1056           0 :     else if( pTok->Is( SvHash_enum() ) )
    1057             :     {
    1058           0 :         SetType( TYPE_ENUM );
    1059           0 :         bOk = ReadNameSvIdl( rBase, rInStm );
    1060             :     }
    1061           0 :     else if( pTok->Is( SvHash_typedef() )
    1062           0 :       || pTok->Is( SvHash_item() ) )
    1063             :     {
    1064           0 :           if( pTok->Is( SvHash_item() ) )
    1065           0 :             bIsItem = sal_True;
    1066             : 
    1067           0 :         SvMetaType * pType = rBase.ReadKnownType( rInStm );
    1068           0 :         if( pType )
    1069             :         {
    1070           0 :             SetRef( pType );
    1071           0 :             if( ReadNameSvIdl( rBase, rInStm ) )
    1072             :             {
    1073           0 :                 if( rInStm.Read( '(' ) )
    1074             :                 {
    1075           0 :                     DoReadContextSvIdl( rBase, rInStm );
    1076           0 :                     if( rInStm.Read( ')' ) )
    1077             :                     {
    1078           0 :                         SetType( TYPE_METHOD );
    1079           0 :                         bOk = sal_True;
    1080             :                     }
    1081             :                 }
    1082             :                 else
    1083             :                 {
    1084           0 :                     bOk = sal_True;
    1085             :                 }
    1086             :             }
    1087             :         }
    1088             :         else
    1089             :         {
    1090           0 :             OString aStr("wrong typedef: ");
    1091           0 :             rBase.SetError( aStr, rInStm.GetToken() );
    1092           0 :             rBase.WriteError( rInStm );
    1093             :         }
    1094             :     }
    1095           0 :     if( bOk )
    1096           0 :         SetModule( rBase );
    1097             :     else
    1098           0 :         rInStm.Seek( nTokPos );
    1099           0 :     return bOk;
    1100             : }
    1101             : 
    1102           0 : sal_Bool SvMetaType::ReadSvIdl( SvIdlDataBase & rBase,
    1103             :                              SvTokenStream & rInStm )
    1104             : {
    1105           0 :     if( ReadHeaderSvIdl( rBase, rInStm ) )
    1106             :     {
    1107           0 :         rBase.Write(OString('.'));
    1108           0 :         return SvMetaExtern::ReadSvIdl( rBase, rInStm );
    1109             :     }
    1110           0 :     return sal_False;
    1111             : }
    1112             : 
    1113           0 : void SvMetaType::WriteSvIdl
    1114             : (
    1115             :     SvIdlDataBase & rBase,
    1116             :     SvStream & rOutStm,
    1117             :     sal_uInt16 nTab
    1118             : )
    1119             : {
    1120           0 :     WriteHeaderSvIdl( rBase, rOutStm, nTab );
    1121           0 :     if( GetType() == TYPE_METHOD )
    1122           0 :         WriteMethodArgs( rBase, rOutStm, nTab, WRITE_IDL );
    1123             : 
    1124           0 :     sal_uLong nOldPos = rOutStm.Tell();
    1125           0 :     rOutStm << endl;
    1126           0 :     SvMetaExtern::WriteSvIdl( rBase, rOutStm, nTab );
    1127           0 :     if( TestAndSeekSpaceOnly( rOutStm, nOldPos ) )
    1128             :         // nothin written
    1129           0 :         rOutStm.Seek( nOldPos );
    1130           0 :     rOutStm.WriteChar( ';' ) << endl;
    1131           0 : }
    1132             : 
    1133           0 : void SvMetaType::WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm,
    1134             :                                  sal_uInt16 nTab,
    1135             :                              WriteType nT, WriteAttribute nA )
    1136             : {
    1137           0 :     if( GetAttrCount() )
    1138             :     {
    1139           0 :         SvMetaAttributeMemberList::const_iterator it = pAttrList->begin();
    1140           0 :         while( it != pAttrList->end() )
    1141             :         {
    1142           0 :             SvMetaAttribute * pAttr = *it;
    1143           0 :             pAttr->Write( rBase, rOutStm, nTab, nT, nA );
    1144           0 :             if( GetType() == TYPE_METHOD )
    1145           0 :                 rOutStm.WriteChar( ',' ) << endl;
    1146             :             else
    1147           0 :                 rOutStm.WriteChar( ';' ) << endl;
    1148           0 :             ++it;
    1149             :         }
    1150             :     }
    1151           0 : }
    1152             : 
    1153           0 : void SvMetaType::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
    1154             :                           sal_uInt16 nTab,
    1155             :                          WriteType nT, WriteAttribute nA )
    1156             : {
    1157           0 :     if( nT == WRITE_C_HEADER && nType != TYPE_ENUM )
    1158             :         // write only enum
    1159           0 :         return;
    1160             : 
    1161           0 :     OString name = GetName().getString();
    1162           0 :     if( nT == WRITE_ODL || nT == WRITE_C_HEADER || nT == WRITE_CXX_HEADER )
    1163             :     {
    1164           0 :         switch( nType )
    1165             :         {
    1166             :         case TYPE_CLASS:
    1167             :             {
    1168             :             }
    1169           0 :             break;
    1170             :         case TYPE_STRUCT:
    1171             :         case TYPE_UNION:
    1172             :         case TYPE_ENUM:
    1173             :         {
    1174           0 :             WriteStars( rOutStm );
    1175           0 :             if( nType == TYPE_STRUCT || nType == TYPE_UNION )
    1176           0 :                 nA = WA_STRUCT;
    1177             : 
    1178           0 :             if( nT == WRITE_ODL || nT == WRITE_C_HEADER)
    1179             :             {
    1180           0 :                 if ( nT == WRITE_C_HEADER )
    1181             :                 {
    1182           0 :                     OString aStr = name.toAsciiUpperCase();
    1183           0 :                     rOutStm.WriteCharPtr( "#ifndef " ).WriteCharPtr( C_PREF ).WriteCharPtr( aStr.getStr() ).WriteCharPtr( "_DEF " ) << endl;
    1184           0 :                     rOutStm.WriteCharPtr( "#define " ).WriteCharPtr( C_PREF ).WriteCharPtr( aStr.getStr() ).WriteCharPtr( "_DEF " ) << endl;
    1185             :                 }
    1186             : 
    1187           0 :                 WriteTab( rOutStm, nTab );
    1188           0 :                 rOutStm.WriteCharPtr( "typedef" ) << endl;
    1189           0 :                 if ( nT == WRITE_ODL )
    1190           0 :                     SvMetaName::Write( rBase, rOutStm, nTab, nT, nA );
    1191             :             }
    1192           0 :             WriteTab( rOutStm, nTab );
    1193           0 :             if( nType == TYPE_STRUCT )
    1194           0 :                 rOutStm.WriteCharPtr( "struct" );
    1195           0 :             else if( nType == TYPE_UNION )
    1196           0 :                 rOutStm.WriteCharPtr( "union" );
    1197             :             else
    1198           0 :                 rOutStm.WriteCharPtr( "enum" );
    1199           0 :             if( nT != WRITE_ODL && nT != WRITE_C_HEADER)
    1200           0 :                 rOutStm.WriteChar( ' ' ).WriteCharPtr( name.getStr() );
    1201             : 
    1202           0 :             rOutStm << endl;
    1203           0 :             WriteTab( rOutStm, nTab );
    1204           0 :             rOutStm.WriteChar( '{' ) << endl;
    1205           0 :             WriteContext( rBase, rOutStm, nTab +1, nT, nA );
    1206           0 :             WriteTab( rOutStm, nTab );
    1207           0 :             rOutStm.WriteChar( '}' );
    1208           0 :             if( nT == WRITE_ODL || nT == WRITE_C_HEADER )
    1209             :             {
    1210           0 :                 rOutStm.WriteChar( ' ' ).WriteCharPtr( C_PREF ).WriteCharPtr( name.getStr() );
    1211             :             }
    1212           0 :             rOutStm.WriteChar( ';' ) << endl;
    1213             : 
    1214           0 :             if ( nT == WRITE_C_HEADER )
    1215           0 :                 rOutStm.WriteCharPtr( "#endif" );
    1216           0 :             rOutStm << endl;
    1217             :         }
    1218           0 :         break;
    1219             :         case TYPE_POINTER:
    1220             :         case TYPE_BASE:
    1221             :         {
    1222             :         }
    1223           0 :         break;
    1224             :         case TYPE_METHOD:
    1225             :         {
    1226             :         }
    1227           0 :         break;
    1228             :         }
    1229           0 :     }
    1230             : }
    1231             : 
    1232           0 : sal_Bool SvMetaType::ReadNamesSvIdl( SvIdlDataBase & rBase,
    1233             :                                      SvTokenStream & rInStm )
    1234             : {
    1235           0 :     sal_Bool bOk = ReadNameSvIdl( rBase, rInStm );
    1236             : 
    1237           0 :     return bOk;
    1238             : }
    1239             : 
    1240           0 : void SvMetaType::WriteHeaderSvIdl( SvIdlDataBase & rBase,
    1241             :                                    SvStream & rOutStm,
    1242             :                                    sal_uInt16 nTab )
    1243             : {
    1244           0 :     switch( nType )
    1245             :     {
    1246             :         case TYPE_CLASS:
    1247             :         {
    1248           0 :             if( IsShell() )
    1249           0 :                 rOutStm.WriteCharPtr( SvHash_shell()->GetName().getStr() );
    1250             :             else
    1251           0 :                 rOutStm.WriteCharPtr( SvHash_interface()->GetName().getStr() );
    1252           0 :             rOutStm.WriteChar( ' ' ).WriteCharPtr( GetName().getString().getStr() );
    1253             :         }
    1254           0 :         break;
    1255             :         case TYPE_STRUCT:
    1256             :         {
    1257           0 :             rOutStm.WriteCharPtr( SvHash_struct()->GetName().getStr() )
    1258           0 :                    .WriteChar( ' ' ).WriteCharPtr( GetName().getString().getStr() );
    1259             :         }
    1260           0 :         break;
    1261             :         case TYPE_UNION:
    1262             :         {
    1263           0 :             rOutStm.WriteCharPtr( SvHash_union()->GetName().getStr() )
    1264           0 :                    .WriteChar( ' ' ).WriteCharPtr( GetName().getString().getStr() );
    1265             :         }
    1266           0 :         break;
    1267             :         case TYPE_ENUM:
    1268             :         {
    1269           0 :             rOutStm.WriteCharPtr( SvHash_enum()->GetName().getStr() )
    1270           0 :                    .WriteChar( ' ' ).WriteCharPtr( GetName().getString().getStr() );
    1271             :         }
    1272           0 :         break;
    1273             :         case TYPE_POINTER:
    1274             :         case TYPE_BASE:
    1275             :         {
    1276           0 :             if( IsItem() )
    1277           0 :                 rOutStm.WriteCharPtr( SvHash_item()->GetName().getStr() ).WriteChar( ' ' );
    1278             :             else
    1279           0 :                 rOutStm.WriteCharPtr( SvHash_typedef()->GetName().getStr() ).WriteChar( ' ' );
    1280           0 :             if( GetRef() )
    1281             :             {
    1282           0 :                 ((SvMetaType *)GetRef())->WriteTheType( rBase, rOutStm, nTab, WRITE_IDL );
    1283           0 :                 rOutStm.WriteChar( ' ' );
    1284             :             }
    1285           0 :             rOutStm.WriteCharPtr( GetName().getString().getStr() );
    1286             :         }
    1287           0 :         break;
    1288             :         case TYPE_METHOD:
    1289             :         {
    1290           0 :             rOutStm.WriteCharPtr( SvHash_typedef()->GetName().getStr() ).WriteChar( ' ' );
    1291           0 :             ((SvMetaType *)GetRef())->WriteTheType( rBase, rOutStm, nTab, WRITE_IDL );
    1292           0 :             rOutStm.WriteChar( ' ' ).WriteCharPtr( GetName().getString().getStr() ).WriteCharPtr( "( " );
    1293           0 :             WriteContextSvIdl( rBase, rOutStm, nTab );
    1294           0 :             rOutStm.WriteCharPtr( " )" );
    1295             :         }
    1296           0 :         break;
    1297             :     }
    1298           0 : }
    1299             : 
    1300           0 : void SvMetaType::ReadAttributesSvIdl( SvIdlDataBase & rBase,
    1301             :                                       SvTokenStream & rInStm )
    1302             : {
    1303           0 :     SvMetaExtern::ReadAttributesSvIdl( rBase, rInStm );
    1304           0 :     aSvName.ReadSvIdl( SvHash_SvName(), rInStm );
    1305           0 :     aSbxName.ReadSvIdl( SvHash_SbxName(), rInStm );
    1306           0 :     aOdlName.ReadSvIdl( SvHash_OdlName(), rInStm );
    1307           0 : }
    1308             : 
    1309           0 : void SvMetaType::WriteAttributesSvIdl( SvIdlDataBase & rBase,
    1310             :                                        SvStream & rOutStm,
    1311             :                                        sal_uInt16 nTab )
    1312             : {
    1313           0 :     SvMetaExtern::WriteAttributesSvIdl( rBase, rOutStm, nTab );
    1314           0 :     OString name = GetName().getString();
    1315           0 :     if( aSvName.getString() != name || aSbxName.getString() != name || aOdlName.getString() != name )
    1316             :     {
    1317           0 :         WriteTab( rOutStm, nTab );
    1318           0 :         rOutStm.WriteCharPtr( "class SvMetaType" ) << endl;
    1319           0 :         if( aSvName.getString() != name )
    1320             :         {
    1321           0 :             WriteTab( rOutStm, nTab );
    1322           0 :             aSvName.WriteSvIdl( SvHash_SvName(), rOutStm, nTab );
    1323           0 :             rOutStm << endl;
    1324             :         }
    1325           0 :         if( aSbxName.getString() != name )
    1326             :         {
    1327           0 :             WriteTab( rOutStm, nTab );
    1328           0 :             aSbxName.WriteSvIdl( SvHash_SbxName(), rOutStm, nTab );
    1329           0 :             rOutStm << endl;
    1330             :         }
    1331           0 :         if( aOdlName.getString() != name )
    1332             :         {
    1333           0 :             WriteTab( rOutStm, nTab );
    1334           0 :             aOdlName.WriteSvIdl( SvHash_OdlName(), rOutStm, nTab );
    1335           0 :             rOutStm << endl;
    1336             :         }
    1337           0 :     }
    1338           0 : }
    1339             : 
    1340           0 : void SvMetaType::ReadContextSvIdl( SvIdlDataBase & rBase,
    1341             :                                       SvTokenStream & rInStm )
    1342             : {
    1343           0 :     SvMetaAttributeRef xAttr = new SvMetaAttribute();
    1344           0 :     if( xAttr->ReadSvIdl( rBase, rInStm ) )
    1345             :     {
    1346           0 :         if( xAttr->Test( rBase, rInStm ) )
    1347           0 :             GetAttrList().push_back( xAttr );
    1348           0 :     }
    1349           0 : }
    1350             : 
    1351           0 : void SvMetaType::WriteContextSvIdl
    1352             : (
    1353             :     SvIdlDataBase & rBase,
    1354             :     SvStream & rOutStm,
    1355             :     sal_uInt16 nTab
    1356             : )
    1357             : {
    1358           0 :     if( GetAttrCount() )
    1359             :     {
    1360           0 :         SvMetaAttributeMemberList::const_iterator it = pAttrList->begin();
    1361           0 :         while( it != pAttrList->end() )
    1362             :         {
    1363           0 :             SvMetaAttribute * pAttr = *it;
    1364           0 :             WriteTab( rOutStm, nTab );
    1365           0 :             pAttr->WriteSvIdl( rBase, rOutStm, nTab );
    1366           0 :             if( GetType() == TYPE_METHOD )
    1367           0 :                 rOutStm.WriteChar( ',' ) << endl;
    1368             :             else
    1369           0 :                 rOutStm.WriteChar( ';' ) << endl;
    1370           0 :             ++it;
    1371             :         }
    1372             :     }
    1373           0 : }
    1374             : 
    1375           0 : void SvMetaType::WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm,
    1376             :                                    sal_uInt16 nTab,
    1377             :                                  WriteType nT, WriteAttribute nA )
    1378             : {
    1379           0 :     SvMetaExtern::WriteAttributes( rBase, rOutStm, nTab, nT, nA );
    1380           0 : }
    1381             : 
    1382           0 : sal_uLong SvMetaType::MakeSfx( OStringBuffer& rAttrArray )
    1383             : {
    1384           0 :     sal_uLong nC = 0;
    1385             : 
    1386           0 :     if( GetBaseType()->GetType() == TYPE_STRUCT )
    1387             :     {
    1388           0 :         sal_uLong nAttrCount = GetAttrCount();
    1389             :         // write the single attributes
    1390           0 :         for( sal_uLong n = 0; n < nAttrCount; n++ )
    1391             :         {
    1392           0 :             nC += (*pAttrList)[n]->MakeSfx( rAttrArray );
    1393           0 :             if( n +1 < nAttrCount )
    1394           0 :                 rAttrArray.append(", ");
    1395             :         }
    1396             :     }
    1397           0 :     return nC;
    1398             : }
    1399             : 
    1400           0 : void SvMetaType::WriteSfxItem(
    1401             :     const OString& rItemName, SvIdlDataBase& rBase, SvStream& rOutStm )
    1402             : {
    1403           0 :     WriteStars( rOutStm );
    1404           0 :     OStringBuffer aVarName(" a");
    1405           0 :     aVarName.append(rItemName).append("_Impl");
    1406             : 
    1407           0 :     OStringBuffer aTypeName("SfxType");
    1408           0 :     OStringBuffer aAttrArray;
    1409           0 :     sal_uLong   nAttrCount = MakeSfx( aAttrArray );
    1410             :     OString aAttrCount(
    1411           0 :         OString::number(nAttrCount));
    1412           0 :     aTypeName.append(aAttrCount);
    1413             : 
    1414           0 :     bool bExport = false, bReturn = false;
    1415             :     // these are exported from sfx library
    1416           0 :     if (rItemName == "SfxBoolItem" ||
    1417           0 :         rItemName == "SfxStringItem" ||
    1418           0 :         rItemName == "SfxUInt16Item" ||
    1419           0 :         rItemName == "SfxUInt32Item" ||
    1420           0 :         rItemName == "SfxVoidItem")
    1421             :     {
    1422           0 :         bExport = true;
    1423           0 :         if (!rBase.sSlotMapFile.endsWith("sfxslots.hxx"))
    1424           0 :             bReturn = true;
    1425             :     }
    1426             : 
    1427           0 :     rOutStm.WriteCharPtr( "extern " );
    1428           0 :     if (bExport)
    1429           0 :         rOutStm.WriteCharPtr( "SFX2_DLLPUBLIC " );
    1430           0 :     rOutStm.WriteCharPtr( aTypeName.getStr() )
    1431           0 :            .WriteCharPtr( aVarName.getStr() ).WriteChar( ';' ) << endl;
    1432           0 :     if (bReturn)
    1433           0 :         return;
    1434             : 
    1435             :     // write the implementation part
    1436           0 :     rOutStm.WriteCharPtr( "#ifdef SFX_TYPEMAP" ) << endl;
    1437           0 :     rOutStm.WriteCharPtr( "#if !defined(_WIN32) && ((defined(DISABLE_DYNLOADING) && (defined(ANDROID) || defined(IOS))) || STATIC_LINKING)" ) << endl;
    1438           0 :     rOutStm.WriteCharPtr( "__attribute__((__weak__))" ) << endl;
    1439           0 :     rOutStm.WriteCharPtr( "#endif" ) << endl;
    1440           0 :     if (bExport)
    1441           0 :         rOutStm.WriteCharPtr( "SFX2_DLLPUBLIC " );
    1442           0 :     rOutStm.WriteCharPtr( aTypeName.getStr() ).WriteCharPtr( aVarName.getStr() )
    1443           0 :            .WriteCharPtr( " = " ) << endl;
    1444           0 :     rOutStm.WriteChar( '{' ) << endl;
    1445           0 :     rOutStm.WriteCharPtr( "\tTYPE(" ).WriteCharPtr( rItemName.getStr() ).WriteCharPtr( "), " )
    1446           0 :            .WriteCharPtr( aAttrCount.getStr() );
    1447           0 :     if( nAttrCount )
    1448             :     {
    1449           0 :         rOutStm.WriteCharPtr( ", { " );
    1450             :         // write the single attributes
    1451           0 :         rOutStm.WriteCharPtr( aAttrArray.getStr() );
    1452           0 :         rOutStm.WriteCharPtr( " }" );
    1453             :     }
    1454           0 :     rOutStm << endl;
    1455           0 :     rOutStm.WriteCharPtr( "};" ) << endl;
    1456           0 :     rOutStm.WriteCharPtr( "#endif" ) << endl << endl;
    1457             : }
    1458             : 
    1459           0 : void SvMetaType::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm )
    1460             : {
    1461           0 :     if( IsItem() )
    1462             :     {
    1463           0 :         if( GetBaseType()->GetType() == TYPE_STRUCT )
    1464           0 :             GetBaseType()->WriteSfxItem( GetName().getString(), rBase, rOutStm );
    1465             :         else
    1466           0 :             WriteSfxItem( GetName().getString(), rBase, rOutStm );
    1467             :     }
    1468           0 : }
    1469             : 
    1470           0 : sal_Bool SvMetaType::ReadMethodArgs( SvIdlDataBase & rBase,
    1471             :                                       SvTokenStream & rInStm )
    1472             : {
    1473           0 :     sal_uInt32  nTokPos = rInStm.Tell();
    1474           0 :     if( rInStm.Read( '(' ) )
    1475             :     {
    1476           0 :         DoReadContextSvIdl( rBase, rInStm );
    1477           0 :         if( rInStm.Read( ')' ) )
    1478             :         {
    1479           0 :             SetType( TYPE_METHOD );
    1480           0 :             return sal_True;
    1481             :         }
    1482             :     }
    1483           0 :     rInStm.Seek( nTokPos );
    1484           0 :     return sal_False;
    1485             : }
    1486             : 
    1487           0 : void SvMetaType::WriteMethodArgs
    1488             : (
    1489             :     SvIdlDataBase & rBase,
    1490             :     SvStream & rOutStm,
    1491             :     sal_uInt16 nTab, WriteType nT
    1492             : )
    1493             : {
    1494           0 :     if( nT == WRITE_IDL )
    1495             :     {
    1496           0 :         if( GetAttrCount() )
    1497             :         {
    1498           0 :             rOutStm << endl;
    1499           0 :             WriteTab( rOutStm, nTab );
    1500           0 :             rOutStm.WriteChar( '(' ) << endl;
    1501             : 
    1502           0 :             SvMetaAttributeMemberList::const_iterator it = pAttrList->begin();
    1503           0 :             while( it != pAttrList->end() )
    1504             :             {
    1505           0 :                 SvMetaAttribute * pAttr = *it;
    1506           0 :                 WriteTab( rOutStm, nTab +1 );
    1507           0 :                 pAttr->WriteSvIdl( rBase, rOutStm, nTab +1 );
    1508           0 :                 ++it;
    1509           0 :                 if( it != pAttrList->end() )
    1510           0 :                        rOutStm.WriteChar( ',' ) << endl;
    1511             :             }
    1512           0 :             rOutStm << endl;
    1513           0 :             WriteTab( rOutStm, nTab );
    1514           0 :             rOutStm.WriteChar( ')' );
    1515             :         }
    1516             :         else
    1517           0 :             rOutStm.WriteCharPtr( "()" );
    1518             :     }
    1519           0 :     else if ( nT == WRITE_DOCU )
    1520             :     {
    1521             : 
    1522           0 :         rOutStm.WriteChar( '(' );
    1523           0 :         if( GetAttrCount() )
    1524             :         {
    1525           0 :             SvMetaAttributeMemberList::const_iterator it = pAttrList->begin();
    1526           0 :             while( it != pAttrList->end() )
    1527             :             {
    1528           0 :                 SvMetaAttribute * pAttr = *it;
    1529           0 :                 pAttr->WriteParam( rBase, rOutStm, nTab+1, nT );
    1530           0 :                 ++it;
    1531           0 :                 if( it != pAttrList->end() )
    1532           0 :                     rOutStm.WriteChar( ',' );
    1533             :                 else
    1534           0 :                     rOutStm.WriteChar( ' ' );
    1535             :             }
    1536             :         }
    1537           0 :         rOutStm.WriteChar( ')' ) << endl;
    1538             :     }
    1539             :     else
    1540             :     {
    1541           0 :         rOutStm.WriteChar( '(' );
    1542           0 :         if( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
    1543             :         {
    1544           0 :             rOutStm.WriteChar( ' ' ).WriteCharPtr( C_PREF ).WriteCharPtr( "Object h" ).WriteCharPtr( rBase.aIFaceName.getStr() );
    1545           0 :             if( GetAttrCount() )
    1546           0 :                 rOutStm.WriteChar( ',' );
    1547             :             else
    1548           0 :                 rOutStm.WriteChar( ' ' );
    1549             :         }
    1550             : 
    1551           0 :         if( GetAttrCount() )
    1552             :         {
    1553           0 :             rOutStm << endl;
    1554           0 :             SvMetaAttributeMemberList::const_iterator it = pAttrList->begin();
    1555           0 :             while( it != pAttrList->end() )
    1556             :             {
    1557           0 :                 SvMetaAttribute* pAttr = *it;
    1558           0 :                 switch( nT )
    1559             :                 {
    1560             :                     case WRITE_C_HEADER:
    1561             :                     case WRITE_C_SOURCE:
    1562             :                     case WRITE_ODL:
    1563             :                     {
    1564           0 :                         pAttr->WriteParam( rBase, rOutStm, nTab +1, nT );
    1565             :                     }
    1566           0 :                     break;
    1567             : 
    1568             :                     default:
    1569             :                     {
    1570             :                         DBG_ASSERT( false, "WriteType not implemented" );
    1571             :                     }
    1572             :                 }
    1573           0 :                 ++it;
    1574           0 :                 if( it != pAttrList->end() )
    1575           0 :                        rOutStm.WriteChar( ',' ) << endl;
    1576             :             }
    1577           0 :             if( nT != WRITE_C_HEADER && nT != WRITE_C_SOURCE )
    1578             :             {
    1579           0 :                 rOutStm << endl;
    1580           0 :                 WriteTab( rOutStm, nTab +1 );
    1581             :             }
    1582           0 :             rOutStm.WriteChar( ' ' );
    1583             :         }
    1584           0 :         rOutStm.WriteChar( ')' );
    1585             :     }
    1586           0 : }
    1587             : 
    1588           0 : void SvMetaType::WriteTypePrefix( SvIdlDataBase & rBase, SvStream & rOutStm,
    1589             :                                  sal_uInt16 nTab, WriteType nT )
    1590             : {
    1591           0 :     switch( nT )
    1592             :     {
    1593             :         case WRITE_IDL:
    1594             :         {
    1595           0 :             if( GetIn() && GetOut() )
    1596           0 :                 rOutStm.WriteCharPtr( SvHash_inout()->GetName().getStr() ).WriteChar( ' ' );
    1597           0 :             else if( GetIn() )
    1598           0 :                 rOutStm.WriteCharPtr( SvHash_in()->GetName().getStr() ).WriteChar( ' ' );
    1599           0 :             else if( GetOut() )
    1600           0 :                 rOutStm.WriteCharPtr( SvHash_out()->GetName().getStr() ).WriteChar( ' ' );
    1601           0 :             rOutStm.WriteCharPtr( GetCString().getStr() );
    1602             :         }
    1603           0 :         break;
    1604             : 
    1605             :         case WRITE_ODL:
    1606             :         {
    1607           0 :             sal_Bool bIn = GetIn();
    1608           0 :             sal_Bool bOut = GetOut();
    1609           0 :             if( bIn || bOut )
    1610             :             {
    1611           0 :                 if( bIn && bOut )
    1612           0 :                     rOutStm.WriteCharPtr( "[in,out] " );
    1613           0 :                 else if( bIn )
    1614           0 :                     rOutStm.WriteCharPtr( "[in] " );
    1615           0 :                 else if( bOut )
    1616           0 :                     rOutStm.WriteCharPtr( "[out] " );
    1617             :             }
    1618             : 
    1619           0 :             OString out;
    1620           0 :             if( GetType() == TYPE_METHOD )
    1621           0 :                 out = GetReturnType()->GetBaseType()->GetOdlName();
    1622             :             else
    1623             :             {
    1624           0 :                 SvMetaType * pBType = GetBaseType();
    1625           0 :                 out = pBType->GetOdlName();
    1626             :             }
    1627           0 :             if( aCall0 == (int)CALL_POINTER
    1628           0 :               || aCall0 == (int)CALL_REFERENCE )
    1629           0 :                 rOutStm.WriteCharPtr( " *" );
    1630           0 :             if( aCall1 == (int)CALL_POINTER
    1631           0 :               || aCall1 == (int)CALL_REFERENCE )
    1632           0 :                 rOutStm.WriteCharPtr( " *" );
    1633           0 :             rOutStm.WriteCharPtr( out.getStr() );
    1634             :         }
    1635           0 :         break;
    1636             : 
    1637             :         case WRITE_C_HEADER:
    1638             :         case WRITE_C_SOURCE:
    1639             :         case WRITE_CXX_HEADER:
    1640             :         case WRITE_CXX_SOURCE:
    1641             :         {
    1642             : 
    1643           0 :             SvMetaType * pBaseType = GetBaseType();
    1644             :             DBG_ASSERT( pBaseType, "no base type for attribute" );
    1645             : 
    1646           0 :             if( pBaseType->GetType() == TYPE_METHOD )
    1647             :                 pBaseType->GetReturnType()->WriteTypePrefix(
    1648           0 :                     rBase, rOutStm, nTab, nT );
    1649           0 :             else if( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
    1650             :             {
    1651           0 :                 if( TYPE_STRUCT == pBaseType->GetType() )
    1652           0 :                     rOutStm.WriteCharPtr( C_PREF ).WriteCharPtr( pBaseType->GetName().getString().getStr() )
    1653           0 :                            .WriteCharPtr( " *" );
    1654             :                 else
    1655             :                 {
    1656           0 :                     if ( pBaseType->GetType() == TYPE_ENUM )
    1657           0 :                         rOutStm.WriteCharPtr( C_PREF );
    1658           0 :                     rOutStm.WriteCharPtr( pBaseType->GetCName().getStr() );
    1659             :                 }
    1660             :             }
    1661             :             else
    1662             :             {
    1663           0 :                 if( TYPE_STRUCT == pBaseType->GetType() )
    1664           0 :                     rOutStm.WriteCharPtr( pBaseType->GetName().getString().getStr() ).WriteCharPtr( " *" );
    1665             :                 else
    1666           0 :                     rOutStm.WriteCharPtr( pBaseType->GetName().getString().getStr() );
    1667             :             }
    1668             :         }
    1669           0 :         break;
    1670             : 
    1671             :         case WRITE_DOCU:
    1672             :         {
    1673             : 
    1674           0 :             SvMetaType * pBaseType = GetBaseType();
    1675             :             DBG_ASSERT( pBaseType, "no base type for attribute" );
    1676             : 
    1677           0 :             if( pBaseType->GetType() == TYPE_METHOD )
    1678             :             {
    1679             :                 pBaseType->GetReturnType()->WriteTypePrefix(
    1680           0 :                     rBase, rOutStm, nTab, nT );
    1681             :             }
    1682             :             else
    1683             :             {
    1684           0 :                 if( TYPE_STRUCT == pBaseType->GetType() )
    1685           0 :                     rOutStm.WriteCharPtr( "VARIANT" ).WriteCharPtr( pBaseType->GetName().getString().getStr() );
    1686           0 :                 else if ( pBaseType->GetType() == TYPE_ENUM )
    1687           0 :                     rOutStm.WriteCharPtr( "integer" );
    1688             :                 else
    1689           0 :                     rOutStm.WriteCharPtr( pBaseType->GetOdlName().getStr() );
    1690             :             }
    1691             :         }
    1692           0 :         break;
    1693             : 
    1694             :         default:
    1695             :         {
    1696             :             DBG_ASSERT( false, "WriteType not implemented" );
    1697             :         }
    1698             :     }
    1699           0 : }
    1700             : 
    1701           0 : void SvMetaType::WriteTheType( SvIdlDataBase & rBase, SvStream & rOutStm,
    1702             :                              sal_uInt16 nTab, WriteType nT )
    1703             : {
    1704           0 :     WriteTypePrefix( rBase, rOutStm, nTab, nT );
    1705           0 :     if( GetType() == TYPE_METHOD )
    1706           0 :         WriteMethodArgs( rBase, rOutStm, nTab +2, nT );
    1707           0 : }
    1708             : 
    1709           0 : OString SvMetaType::GetParserString() const
    1710             : {
    1711           0 :     SvMetaType * pBT = GetBaseType();
    1712           0 :     if( pBT != this )
    1713           0 :         return pBT->GetParserString();
    1714             : 
    1715           0 :     int type = GetType();
    1716           0 :     OString aPStr;
    1717             : 
    1718           0 :     if( TYPE_METHOD == type || TYPE_STRUCT == type )
    1719             :     {
    1720           0 :         sal_uLong nAttrCount = GetAttrCount();
    1721             :         // write the single attributes
    1722           0 :         for( sal_uLong n = 0; n < nAttrCount; n++ )
    1723             :         {
    1724           0 :             SvMetaAttribute * pT = (*pAttrList)[n];
    1725           0 :             aPStr += pT->GetType()->GetParserString();
    1726           0 :         }
    1727             :     }
    1728             :     else
    1729           0 :         aPStr = OString(GetParserChar());
    1730           0 :     return aPStr;
    1731             : }
    1732             : 
    1733           0 : void SvMetaType::WriteParamNames( SvIdlDataBase & rBase,
    1734             :                                    SvStream & rOutStm,
    1735             :                                    const OString& rChief )
    1736             : {
    1737           0 :     SvMetaType * pBT = GetBaseType();
    1738           0 :     if( pBT != this )
    1739           0 :         pBT->WriteParamNames( rBase, rOutStm, rChief );
    1740             :     else
    1741             :     {
    1742           0 :         int type = GetType();
    1743             : 
    1744           0 :         if( TYPE_METHOD == type || TYPE_STRUCT == type )
    1745             :         {
    1746           0 :             sal_uLong nAttrCount = GetAttrCount();
    1747             :             // write the single attributes
    1748           0 :             for( sal_uLong n = 0; n < nAttrCount; n++ )
    1749             :             {
    1750           0 :                 SvMetaAttribute * pA = (*pAttrList)[n];
    1751           0 :                 OString aStr = pA->GetName().getString();
    1752           0 :                 pA->GetType()->WriteParamNames( rBase, rOutStm, aStr );
    1753           0 :                 if( n +1 < nAttrCount )
    1754           0 :                     rOutStm.WriteCharPtr( ", " );
    1755           0 :             }
    1756             :         }
    1757             :         else
    1758           0 :             rOutStm.WriteCharPtr( rChief.getStr() );
    1759             :     }
    1760           0 : }
    1761             : 
    1762           0 : SV_IMPL_META_FACTORY1( SvMetaTypeString, SvMetaType );
    1763           0 : SvMetaTypeString::SvMetaTypeString()
    1764           0 :     : SvMetaType( "String", "SbxSTRING", "BSTR", 's', "char *", "String", "$" )
    1765             : {
    1766           0 : }
    1767             : 
    1768           0 : void SvMetaTypeString::Load( SvPersistStream & rStm )
    1769             : {
    1770           0 :     SvMetaType::Load( rStm );
    1771           0 : }
    1772             : 
    1773           0 : void SvMetaTypeString::Save( SvPersistStream & rStm )
    1774             : {
    1775           0 :     SvMetaType::Save( rStm );
    1776           0 : }
    1777             : 
    1778           0 : SV_IMPL_META_FACTORY1( SvMetaEnumValue, SvMetaName );
    1779           0 : SvMetaEnumValue::SvMetaEnumValue()
    1780             : {
    1781           0 : }
    1782             : 
    1783           0 : void SvMetaEnumValue::Load( SvPersistStream & rStm )
    1784             : {
    1785           0 :     SvMetaName::Load( rStm );
    1786             : 
    1787             :     sal_uInt8 nMask;
    1788           0 :     rStm.ReadUChar( nMask );
    1789           0 :     if( nMask >= 0x02 )
    1790             :     {
    1791           0 :         rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
    1792             :         OSL_FAIL( "wrong format" );
    1793           0 :         return;
    1794             :     }
    1795           0 :     if( nMask & 0x01 ) aEnumValue = read_uInt16_lenPrefixed_uInt8s_ToOString(rStm);
    1796             : }
    1797             : 
    1798           0 : void SvMetaEnumValue::Save( SvPersistStream & rStm )
    1799             : {
    1800           0 :     SvMetaName::Save( rStm );
    1801             : 
    1802             :     // create mask
    1803           0 :     sal_uInt8 nMask = 0;
    1804           0 :     if( !aEnumValue.isEmpty() ) nMask |= 0x01;
    1805             : 
    1806             :     // write data
    1807           0 :     rStm.WriteUChar( nMask );
    1808           0 :     if( nMask & 0x01 ) write_uInt16_lenPrefixed_uInt8s_FromOString(rStm, aEnumValue);
    1809           0 : }
    1810             : 
    1811           0 : sal_Bool SvMetaEnumValue::ReadSvIdl( SvIdlDataBase & rBase,
    1812             :                                  SvTokenStream & rInStm )
    1813             : {
    1814           0 :     if( !ReadNameSvIdl( rBase, rInStm ) )
    1815           0 :         return sal_False;
    1816           0 :     return sal_True;
    1817             : }
    1818             : 
    1819           0 : void SvMetaEnumValue::WriteSvIdl( SvIdlDataBase &, SvStream & rOutStm, sal_uInt16 )
    1820             : {
    1821           0 :     rOutStm.WriteCharPtr( GetName().getString().getStr() );
    1822           0 : }
    1823             : 
    1824           0 : void SvMetaEnumValue::Write( SvIdlDataBase &, SvStream & rOutStm, sal_uInt16,
    1825             :                              WriteType nT, WriteAttribute )
    1826             : {
    1827           0 :     if ( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
    1828           0 :         rOutStm.WriteCharPtr( C_PREF ).WriteCharPtr( GetName().getString().getStr() );
    1829             :     else
    1830           0 :         rOutStm.WriteCharPtr( GetName().getString().getStr() );
    1831           0 : }
    1832             : 
    1833           0 : SV_IMPL_META_FACTORY1( SvMetaTypeEnum, SvMetaType );
    1834           0 : SvMetaTypeEnum::SvMetaTypeEnum()
    1835             : {
    1836           0 :     SetBasicName("Integer");
    1837           0 : }
    1838             : 
    1839           0 : void SvMetaTypeEnum::Load( SvPersistStream & rStm )
    1840             : {
    1841           0 :     SvMetaType::Load( rStm );
    1842             : 
    1843             :     sal_uInt8 nMask;
    1844           0 :     rStm.ReadUChar( nMask );
    1845           0 :     if( nMask >= 0x04 )
    1846             :     {
    1847           0 :         rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
    1848             :         OSL_FAIL( "wrong format" );
    1849           0 :         return;
    1850             :     }
    1851           0 :     if( nMask & 0x01 ) rStm >> aEnumValueList;
    1852           0 :     if( nMask & 0x02 ) aPrefix = read_uInt16_lenPrefixed_uInt8s_ToOString(rStm);
    1853             : }
    1854             : 
    1855           0 : void SvMetaTypeEnum::Save( SvPersistStream & rStm )
    1856             : {
    1857           0 :     SvMetaType::Save( rStm );
    1858             : 
    1859             :     // create mask
    1860           0 :     sal_uInt8 nMask = 0;
    1861           0 :     if( !aEnumValueList.empty() )   nMask |= 0x01;
    1862           0 :     if( !aPrefix.isEmpty() )        nMask |= 0x02;
    1863             : 
    1864             :     // write data
    1865           0 :     rStm.WriteUChar( nMask );
    1866           0 :     if( nMask & 0x01 ) WriteSvDeclPersistList( rStm, aEnumValueList );
    1867           0 :     if( nMask & 0x02 ) write_uInt16_lenPrefixed_uInt8s_FromOString(rStm, aPrefix);
    1868           0 : }
    1869             : 
    1870             : namespace
    1871             : {
    1872           0 :     OString getCommonSubPrefix(const OString &rA, const OString &rB)
    1873             :     {
    1874           0 :         sal_Int32 nMax = std::min(rA.getLength(), rB.getLength());
    1875           0 :         sal_Int32 nI = 0;
    1876           0 :         while (nI < nMax)
    1877             :         {
    1878           0 :             if (rA[nI] != rB[nI])
    1879           0 :                 break;
    1880           0 :             ++nI;
    1881             :         }
    1882           0 :         return rA.copy(0, nI);
    1883             :     }
    1884             : }
    1885             : 
    1886           0 : void SvMetaTypeEnum::ReadContextSvIdl( SvIdlDataBase & rBase,
    1887             :                                        SvTokenStream & rInStm )
    1888             : {
    1889           0 :     sal_uInt32 nTokPos = rInStm.Tell();
    1890             : 
    1891           0 :     SvMetaEnumValueRef aEnumVal = new SvMetaEnumValue();
    1892           0 :     sal_Bool bOk = aEnumVal->ReadSvIdl( rBase, rInStm );
    1893           0 :     if( bOk )
    1894             :     {
    1895           0 :         if( aEnumValueList.empty() )
    1896             :         {
    1897             :            // the first
    1898           0 :            aPrefix = aEnumVal->GetName().getString();
    1899             :         }
    1900             :         else
    1901             :         {
    1902           0 :             aPrefix = getCommonSubPrefix(aPrefix, aEnumVal->GetName().getString());
    1903             :         }
    1904           0 :         aEnumValueList.push_back( aEnumVal );
    1905             :     }
    1906           0 :     if( !bOk )
    1907           0 :         rInStm.Seek( nTokPos );
    1908           0 : }
    1909             : 
    1910           0 : void SvMetaTypeEnum::WriteContextSvIdl( SvIdlDataBase & rBase,
    1911             :                                         SvStream & rOutStm,
    1912             :                                         sal_uInt16 nTab )
    1913             : {
    1914           0 :     WriteTab( rOutStm, nTab +1 );
    1915           0 :     for( sal_uLong n = 0; n < aEnumValueList.size(); n++ )
    1916             :     {
    1917           0 :         aEnumValueList[n]->WriteSvIdl( rBase, rOutStm, nTab );
    1918           0 :         if( n + 1 != aEnumValueList.size() )
    1919           0 :             rOutStm.WriteCharPtr( ", " );
    1920             :         else
    1921           0 :             rOutStm << endl;
    1922             :     }
    1923           0 : }
    1924             : 
    1925           0 : sal_Bool SvMetaTypeEnum::ReadSvIdl( SvIdlDataBase & rBase,
    1926             :                                 SvTokenStream & rInStm )
    1927             : {
    1928           0 :     sal_uInt32  nTokPos = rInStm.Tell();
    1929           0 :     if( SvMetaType::ReadHeaderSvIdl( rBase, rInStm )
    1930           0 :       && GetType() == TYPE_ENUM )
    1931             :     {
    1932           0 :         if( SvMetaName::ReadSvIdl( rBase, rInStm ) )
    1933           0 :              return sal_True;
    1934             :     }
    1935           0 :     rInStm.Seek( nTokPos );
    1936           0 :     return sal_False;
    1937             : }
    1938             : 
    1939           0 : void SvMetaTypeEnum::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
    1940             :                                    sal_uInt16 nTab )
    1941             : {
    1942           0 :     WriteHeaderSvIdl( rBase, rOutStm, nTab );
    1943           0 :     rOutStm << endl;
    1944           0 :     SvMetaName::WriteSvIdl( rBase, rOutStm, nTab );
    1945           0 :     rOutStm << endl;
    1946           0 : }
    1947             : 
    1948           0 : void SvMetaTypeEnum::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
    1949             :                             sal_uInt16 nTab,
    1950             :                              WriteType nT, WriteAttribute nA )
    1951             : {
    1952           0 :     SvMetaType::Write( rBase, rOutStm, nTab, nT, nA );
    1953           0 : }
    1954             : 
    1955           0 : void SvMetaTypeEnum::WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm,
    1956             :                                    sal_uInt16 nTab,
    1957             :                                  WriteType nT, WriteAttribute nA )
    1958             : {
    1959           0 :     WriteTab( rOutStm, nTab +1 );
    1960           0 :     for( sal_uLong n = 0; n < aEnumValueList.size(); n++ )
    1961             :     {
    1962           0 :         aEnumValueList[n]->Write( rBase, rOutStm, nTab +1, nT, nA );
    1963             : 
    1964           0 :         if( n + 1 != aEnumValueList.size() )
    1965             :         {
    1966           0 :             if( 2 == n % 3 )
    1967             :             {
    1968           0 :                 rOutStm.WriteChar( ',' ) << endl;
    1969           0 :                 WriteTab( rOutStm, nTab +1 );
    1970             :             }
    1971             :             else
    1972           0 :                 rOutStm.WriteCharPtr( ",\t" );
    1973             :         }
    1974             :         else
    1975           0 :             rOutStm << endl;
    1976             :     }
    1977           0 :     rOutStm << endl;
    1978           0 : }
    1979             : 
    1980           0 : SV_IMPL_META_FACTORY1( SvMetaTypevoid, SvMetaType );
    1981           0 : SvMetaTypevoid::SvMetaTypevoid()
    1982           0 :     : SvMetaType( "void", "SbxVOID", "void", 'v', "void", "", "" )
    1983             : {
    1984           0 : }
    1985             : 
    1986           0 : void SvMetaTypevoid::Load( SvPersistStream & rStm )
    1987             : {
    1988           0 :     SvMetaType::Load( rStm );
    1989           0 : }
    1990             : 
    1991           0 : void SvMetaTypevoid::Save( SvPersistStream & rStm )
    1992             : {
    1993           0 :     SvMetaType::Save( rStm );
    1994           0 : }
    1995             : 
    1996           0 : OString SvMetaAttribute::Compare( SvMetaAttribute* pAttr )
    1997             : {
    1998           0 :     OStringBuffer aStr;
    1999             : 
    2000           0 :     if ( aType.Is() )
    2001             :     {
    2002           0 :         if ( aType->GetType() == TYPE_METHOD )
    2003             :         {
    2004             :             // Test only when the attribute is a method not if it has one!
    2005           0 :             if ( pAttr->GetType()->GetType() != TYPE_METHOD )
    2006           0 :                 aStr.append("    IsMethod\n");
    2007           0 :             else if ( aType->GetReturnType() &&
    2008           0 :                 aType->GetReturnType()->GetType() != pAttr->GetType()->GetReturnType()->GetType() )
    2009             :             {
    2010           0 :                 aStr.append("    ReturnType\n");
    2011             :             }
    2012             : 
    2013           0 :             if ( aType->GetAttrCount() )
    2014             :             {
    2015           0 :                 sal_uLong nCount = aType->GetAttrCount();
    2016           0 :                 SvMetaAttributeMemberList& rList = aType->GetAttrList();
    2017           0 :                 SvMetaAttributeMemberList& rOtherList = pAttr->GetType()->GetAttrList();
    2018           0 :                 if ( pAttr->GetType()->GetAttrCount() != nCount )
    2019             :                 {
    2020           0 :                     aStr.append("    AttributeCount\n");
    2021             :                 }
    2022             :                 else
    2023             :                 {
    2024           0 :                     for ( sal_uInt16 n=0; n<nCount; n++ )
    2025             :                     {
    2026           0 :                         SvMetaAttribute *pAttr1 = rList[n];
    2027           0 :                         SvMetaAttribute *pAttr2 = rOtherList[n];
    2028           0 :                         pAttr1->Compare( pAttr2 );
    2029             :                     }
    2030             :                 }
    2031             :             }
    2032             :         }
    2033             : 
    2034           0 :         if ( GetType()->GetType() != pAttr->GetType()->GetType() )
    2035           0 :             aStr.append("    Type\n");
    2036             : 
    2037           0 :         if ( !GetType()->GetSvName().equals( pAttr->GetType()->GetSvName() ) )
    2038           0 :             aStr.append("    ItemType\n");
    2039             :     }
    2040             : 
    2041           0 :     if ( GetExport() != pAttr->GetExport() )
    2042           0 :         aStr.append("    Export\n");
    2043             : 
    2044           0 :     if ( GetAutomation() != pAttr->GetAutomation() )
    2045           0 :         aStr.append("    Automation\n");
    2046             : 
    2047           0 :     if ( GetIsCollection() != pAttr->GetIsCollection() )
    2048           0 :         aStr.append("    IsCollection\n");
    2049             : 
    2050           0 :     if ( GetReadOnlyDoc() != pAttr->GetReadOnlyDoc() )
    2051           0 :         aStr.append("    ReadOnlyDoc\n");
    2052             : 
    2053           0 :     if ( GetExport() && GetReadonly() != pAttr->GetReadonly() )
    2054           0 :         aStr.append("    Readonly\n");
    2055             : 
    2056           0 :     return aStr.makeStringAndClear();
    2057             : }
    2058             : 
    2059           0 : void SvMetaAttribute::WriteCSV( SvIdlDataBase&, SvStream& rStrm )
    2060             : {
    2061           0 :     rStrm.WriteCharPtr( GetType()->GetSvName().getStr() ).WriteChar( ' ' );
    2062           0 :     rStrm.WriteCharPtr( GetName().getString().getStr() ).WriteChar( ' ' );
    2063           0 :     rStrm.WriteCharPtr( GetSlotId().getString().getStr() );
    2064           0 : }
    2065             : 
    2066             : 
    2067             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10