2000-09-18 15:33:13 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 08:40:06 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 15:33:13 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 15:33:13 +00:00
|
|
|
*
|
2008-04-11 08:40:06 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 15:33:13 +00:00
|
|
|
*
|
2008-04-11 08:40:06 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 15:33:13 +00:00
|
|
|
*
|
2008-04-11 08:40:06 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 15:33:13 +00:00
|
|
|
*
|
2008-04-11 08:40:06 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 15:33:13 +00:00
|
|
|
*
|
2008-04-11 08:40:06 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 15:33:13 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 11:47:56 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_idl.hxx"
|
|
|
|
|
2000-09-18 15:33:13 +00:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <tools/debug.hxx>
|
|
|
|
|
|
|
|
#include <attrib.hxx>
|
|
|
|
#include <object.hxx>
|
|
|
|
#include <globals.hxx>
|
|
|
|
#include <database.hxx>
|
|
|
|
|
|
|
|
/******************** class SvClassElement *******************************/
|
|
|
|
SV_IMPL_PERSIST1( SvClassElement, SvPersistBase );
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvClassElement::SvClassElement()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
|
|
|
SvClassElement::SvClassElement()
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvClassElement::Load()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
|
|
|
void SvClassElement::Load( SvPersistStream & rStm )
|
|
|
|
{
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt8 nMask;
|
2000-09-18 15:33:13 +00:00
|
|
|
rStm >> nMask;
|
|
|
|
if( nMask >= 0x08 )
|
|
|
|
{
|
|
|
|
rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
|
2008-11-10 15:06:12 +00:00
|
|
|
DBG_ERROR( "wrong format" );
|
2000-09-18 15:33:13 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if( nMask & 0x01 ) rStm >> aAutomation;
|
|
|
|
if( nMask & 0x02 ) rStm.ReadByteString( aPrefix );
|
|
|
|
if( nMask & 0x04 )
|
|
|
|
{
|
|
|
|
SvMetaClass * p;
|
|
|
|
rStm >> p;
|
|
|
|
xClass = p;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvClassElement::Save()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
|
|
|
void SvClassElement::Save( SvPersistStream & rStm )
|
|
|
|
{
|
|
|
|
// Maske erstellen
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt8 nMask = 0;
|
2000-09-18 15:33:13 +00:00
|
|
|
if( aAutomation.IsSet() ) nMask |= 0x1;
|
|
|
|
if( aPrefix.Len() ) nMask |= 0x2;
|
|
|
|
if( xClass.Is() ) nMask |= 0x4;
|
|
|
|
|
|
|
|
// Daten schreiben
|
|
|
|
rStm << nMask;
|
|
|
|
if( nMask & 0x01 ) rStm << aAutomation;
|
|
|
|
if( nMask & 0x02 ) rStm.WriteByteString( aPrefix );
|
|
|
|
if( nMask & 0x04 ) rStm << xClass;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************** SvMetaClass ******************************************/
|
|
|
|
SV_IMPL_META_FACTORY1( SvMetaClass, SvMetaType );
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::SvMetaClass()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
|
|
|
SvMetaClass::SvMetaClass()
|
2010-11-03 15:49:08 +01:00
|
|
|
: aAutomation( sal_True, sal_False )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::Load()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
|
|
|
void SvMetaClass::Load( SvPersistStream & rStm )
|
|
|
|
{
|
|
|
|
SvMetaType::Load( rStm );
|
|
|
|
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt8 nMask;
|
2000-09-18 15:33:13 +00:00
|
|
|
rStm >> nMask;
|
|
|
|
if( nMask >= 0x20 )
|
|
|
|
{
|
|
|
|
rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
|
2008-11-10 15:06:12 +00:00
|
|
|
DBG_ERROR( "wrong format" );
|
2000-09-18 15:33:13 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if( nMask & 0x01 ) rStm >> aAttrList;
|
|
|
|
if( nMask & 0x02 )
|
|
|
|
{
|
|
|
|
SvMetaClass * pSuper;
|
|
|
|
rStm >> pSuper;
|
|
|
|
aSuperClass = pSuper;
|
|
|
|
}
|
|
|
|
if( nMask & 0x04 ) rStm >> aClassList;
|
|
|
|
if( nMask & 0x8 )
|
|
|
|
{
|
|
|
|
SvMetaClass * p;
|
|
|
|
rStm >> p;
|
|
|
|
xAutomationInterface = p;
|
|
|
|
}
|
|
|
|
if( nMask & 0x10 ) rStm >> aAutomation;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::Save()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
|
|
|
void SvMetaClass::Save( SvPersistStream & rStm )
|
|
|
|
{
|
|
|
|
SvMetaType::Save( rStm );
|
|
|
|
|
|
|
|
// Maske erstellen
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt8 nMask = 0;
|
2000-09-18 15:33:13 +00:00
|
|
|
if( aAttrList.Count() ) nMask |= 0x1;
|
|
|
|
if( aSuperClass.Is() ) nMask |= 0x2;
|
|
|
|
if( aClassList.Count() ) nMask |= 0x4;
|
|
|
|
if( xAutomationInterface.Is() ) nMask |= 0x8;
|
|
|
|
if( aAutomation.IsSet() ) nMask |= 0x10;
|
|
|
|
|
|
|
|
// Daten schreiben
|
|
|
|
rStm << nMask;
|
|
|
|
if( nMask & 0x01 ) rStm << aAttrList;
|
|
|
|
if( nMask & 0x02 ) rStm << aSuperClass;
|
|
|
|
if( nMask & 0x04 ) rStm << aClassList;
|
|
|
|
if( nMask & 0x08 ) rStm << xAutomationInterface;
|
|
|
|
if( nMask & 0x10 ) rStm << aAutomation;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::FillSbxObject()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
|
|
|
/*
|
|
|
|
void SvMetaClass::FillSbxMemberObject( SvIdlDataBase & rBase,
|
|
|
|
SbxObject * pObj,
|
|
|
|
StringList & rSuperList,
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_Bool bVariable )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
// alle Attribute der Klasse schreiben
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uIntPtr n ;
|
2000-09-18 15:33:13 +00:00
|
|
|
for( n = 0; n < aAttrList.Count(); n++ )
|
|
|
|
{
|
|
|
|
SvMetaAttribute * pAttr = aAttrList.GetObject( n );
|
|
|
|
|
|
|
|
ByteString aMangleName = pAttr->GetMangleName( bVariable );
|
|
|
|
ByteString * pS = SvIdlDataBase::FindName( aMangleName, rSuperList );
|
|
|
|
|
|
|
|
if( !pS && pAttr->GetExport() )
|
|
|
|
{
|
|
|
|
// nicht doppelt
|
|
|
|
if( bVariable && pAttr->IsVariable() )
|
|
|
|
{
|
|
|
|
rSuperList.Insert( new ByteString( aMangleName ), LIST_APPEND );
|
|
|
|
pAttr->FillSbxObject( rBase, pObj, bVariable );
|
|
|
|
}
|
|
|
|
else if( !bVariable && pAttr->IsMethod() )
|
|
|
|
{
|
|
|
|
rSuperList.Insert( new ByteString( aMangleName ), LIST_APPEND );
|
|
|
|
pAttr->FillSbxObject( rBase, pObj, bVariable );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// alle Attribute der importierten Klassen schreiben
|
|
|
|
for( n = 0; n < aClassList.Count(); n++ )
|
|
|
|
{
|
|
|
|
SvClassElement * pEle = aClassList.GetObject( n );
|
|
|
|
SvMetaClass * pClass = pEle->GetClass();
|
|
|
|
pClass->FillSbxMemberObject( rBase, pObj, rSuperList, bVariable );
|
|
|
|
}
|
|
|
|
// alle Attribute der Superklassen schreiben
|
|
|
|
if( aSuperClass.Is() )
|
|
|
|
aSuperClass->FillSbxMemberObject( rBase, pObj, rSuperList, bVariable );
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::FillSbxObject()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
|
|
|
/*
|
|
|
|
void SvMetaClass::FillSbxObject( SvIdlDataBase & rBase, SbxObject * pObj )
|
|
|
|
{
|
|
|
|
StringList aSuperList;
|
2010-11-03 15:49:08 +01:00
|
|
|
FillSbxMemberObject( rBase, pObj, aSuperList, sal_True );
|
|
|
|
FillSbxMemberObject( rBase, pObj, aSuperList, sal_False );
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
ByteString * pStr = aSuperList.First();
|
|
|
|
while( pStr )
|
|
|
|
{
|
|
|
|
delete pStr;
|
|
|
|
pStr = aSuperList.Next();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
#ifdef IDL_COMPILER
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::ReadAttributesSvIdl()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
|
|
|
void SvMetaClass::ReadAttributesSvIdl( SvIdlDataBase & rBase,
|
|
|
|
SvTokenStream & rInStm )
|
|
|
|
{
|
|
|
|
SvMetaType::ReadAttributesSvIdl( rBase, rInStm );
|
|
|
|
aAutomation.ReadSvIdl( SvHash_Automation(), rInStm );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::WriteAttributesSvIdl()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
|
|
|
void SvMetaClass::WriteAttributesSvIdl( SvIdlDataBase & rBase,
|
2010-11-03 15:49:08 +01:00
|
|
|
SvStream & rOutStm, sal_uInt16 nTab )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
SvMetaType::WriteAttributesSvIdl( rBase, rOutStm, nTab );
|
|
|
|
|
|
|
|
if( !aAutomation )
|
|
|
|
{
|
|
|
|
WriteTab( rOutStm, nTab );
|
|
|
|
rOutStm << "//class SvMetaClass" << endl;
|
|
|
|
if( !aAutomation )
|
|
|
|
{
|
|
|
|
WriteTab( rOutStm, nTab );
|
|
|
|
aAutomation.WriteSvIdl( SvHash_Automation(), rOutStm );
|
|
|
|
rOutStm << ';' << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::ReadContextSvIdl()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
|
|
|
void SvMetaClass::ReadContextSvIdl( SvIdlDataBase & rBase,
|
|
|
|
SvTokenStream & rInStm )
|
|
|
|
{
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt32 nTokPos = rInStm.Tell();
|
2000-09-18 15:33:13 +00:00
|
|
|
SvToken * pTok = rInStm.GetToken_Next();
|
|
|
|
|
|
|
|
if( pTok->Is( SvHash_import() ) )
|
|
|
|
{
|
|
|
|
SvMetaClass * pClass = rBase.ReadKnownClass( rInStm );
|
|
|
|
if( pClass )
|
|
|
|
{
|
|
|
|
SvClassElementRef xEle = new SvClassElement();
|
|
|
|
xEle->SetClass( pClass );
|
|
|
|
aClassList.Append( xEle );
|
|
|
|
|
|
|
|
if( rInStm.Read( '[' ) )
|
|
|
|
{
|
|
|
|
pTok = rInStm.GetToken_Next();
|
|
|
|
if( pTok->Is( SvHash_Automation() ) )
|
|
|
|
{
|
|
|
|
if( rInStm.Read( ']' ) )
|
|
|
|
{
|
|
|
|
if( xAutomationInterface.Is() )
|
|
|
|
{
|
|
|
|
// Fehler setzen
|
|
|
|
rBase.SetError( "Automation allready set",
|
|
|
|
rInStm.GetToken() );
|
|
|
|
rBase.WriteError( rInStm );
|
|
|
|
}
|
|
|
|
xAutomationInterface = pClass;
|
2010-11-03 15:49:08 +01:00
|
|
|
xEle->SetAutomation( sal_True );
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Fehler setzen
|
|
|
|
rBase.SetError( "missing ]", rInStm.GetToken() );
|
|
|
|
rBase.WriteError( rInStm );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Fehler setzen
|
|
|
|
rBase.SetError( "only attribute Automation allowed",
|
|
|
|
rInStm.GetToken() );
|
|
|
|
rBase.WriteError( rInStm );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pTok = rInStm.GetToken();
|
|
|
|
if( pTok->IsString() )
|
|
|
|
{
|
|
|
|
xEle->SetPrefix( pTok->GetString() );
|
|
|
|
rInStm.GetToken_Next();
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Fehler setzen
|
|
|
|
rBase.SetError( "unknown imported interface", rInStm.GetToken() );
|
|
|
|
rBase.WriteError( rInStm );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rInStm.Seek( nTokPos );
|
|
|
|
SvMetaType * pType = rBase.ReadKnownType( rInStm );
|
|
|
|
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_Bool bOk = sal_False;
|
2000-09-18 15:33:13 +00:00
|
|
|
SvMetaAttributeRef xAttr;
|
|
|
|
if( !pType || pType->IsItem() )
|
|
|
|
{
|
|
|
|
xAttr = new SvMetaSlot( pType );
|
|
|
|
if( xAttr->ReadSvIdl( rBase, rInStm ) )
|
|
|
|
bOk = xAttr->Test( rBase, rInStm );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xAttr = new SvMetaAttribute( pType );
|
|
|
|
if( xAttr->ReadSvIdl( rBase, rInStm ) )
|
|
|
|
bOk = xAttr->Test( rBase, rInStm );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bOk )
|
|
|
|
bOk = TestAttribute( rBase, rInStm, *xAttr );
|
|
|
|
if( bOk )
|
|
|
|
{
|
|
|
|
if( !xAttr->GetSlotId().IsSet() )
|
|
|
|
{
|
|
|
|
SvNumberIdentifier aI;
|
|
|
|
aI.SetValue( rBase.GetUniqueId() );
|
|
|
|
xAttr->SetSlotId( aI );
|
|
|
|
}
|
|
|
|
aAttrList.Append( xAttr );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rInStm.Seek( nTokPos );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::WriteContextSvIdl()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
|
|
|
void SvMetaClass::WriteContextSvIdl
|
|
|
|
(
|
|
|
|
SvIdlDataBase & rBase,
|
|
|
|
SvStream & rOutStm,
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 nTab
|
2000-09-18 15:33:13 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
//SvMetaType::WriteContextSvIdl( rBase, rOutStm, nTab );
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uIntPtr n;
|
2000-09-18 15:33:13 +00:00
|
|
|
for( n = 0; n < aAttrList.Count(); n++ )
|
|
|
|
{
|
|
|
|
WriteTab( rOutStm, nTab );
|
|
|
|
aAttrList.GetObject( n )->WriteSvIdl( rBase, rOutStm, nTab );
|
|
|
|
rOutStm << ';' << endl;
|
|
|
|
}
|
|
|
|
for( n = 0; n < aClassList.Count(); n++ )
|
|
|
|
{
|
|
|
|
SvClassElement * pEle = aClassList.GetObject( n );
|
|
|
|
WriteTab( rOutStm, nTab );
|
|
|
|
rOutStm << SvHash_import()->GetName().GetBuffer() << ' '
|
|
|
|
<< pEle->GetPrefix().GetBuffer();
|
|
|
|
if( pEle->GetAutomation() )
|
|
|
|
rOutStm << " [ " << SvHash_Automation()->GetName().GetBuffer()
|
|
|
|
<< " ]";
|
|
|
|
if( pEle->GetPrefix().Len() )
|
|
|
|
rOutStm << ' ' << pEle->GetPrefix().GetBuffer();
|
|
|
|
rOutStm << ';' << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::ReadSvIdl()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_Bool SvMetaClass::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uIntPtr nTokPos = rInStm.Tell();
|
2000-09-18 15:33:13 +00:00
|
|
|
if( SvMetaType::ReadHeaderSvIdl( rBase, rInStm ) && GetType() == TYPE_CLASS )
|
|
|
|
{
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_Bool bOk = sal_True;
|
2000-09-18 15:33:13 +00:00
|
|
|
if( rInStm.Read( ':' ) )
|
|
|
|
{
|
|
|
|
aSuperClass = rBase.ReadKnownClass( rInStm );
|
|
|
|
bOk = aSuperClass.Is();
|
|
|
|
if( !bOk )
|
|
|
|
{
|
|
|
|
// Fehler setzen
|
|
|
|
rBase.SetError( "unknown super class",
|
|
|
|
rInStm.GetToken() );
|
|
|
|
rBase.WriteError( rInStm );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( bOk )
|
|
|
|
{
|
|
|
|
rBase.Write( '.' );
|
|
|
|
bOk = SvMetaName::ReadSvIdl( rBase, rInStm );
|
|
|
|
}
|
|
|
|
if( bOk )
|
|
|
|
return bOk;
|
|
|
|
}
|
|
|
|
rInStm.Seek( nTokPos );
|
2010-11-03 15:49:08 +01:00
|
|
|
return sal_False;
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::TestAttribute()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_Bool SvMetaClass::TestAttribute( SvIdlDataBase & rBase, SvTokenStream & rInStm,
|
2000-09-18 15:33:13 +00:00
|
|
|
SvMetaAttribute & rAttr ) const
|
|
|
|
{
|
|
|
|
if ( !rAttr.GetRef() && rAttr.IsA( TYPE( SvMetaSlot ) ) )
|
|
|
|
{
|
|
|
|
DBG_ERROR( "Neuer Slot : " );
|
|
|
|
DBG_ERROR( rAttr.GetSlotId().GetBuffer() );
|
|
|
|
}
|
|
|
|
|
2010-11-03 15:49:08 +01:00
|
|
|
for( sal_uIntPtr n = 0; n < aAttrList.Count(); n++ )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
SvMetaAttribute * pS = aAttrList.GetObject( n );
|
|
|
|
if( pS->GetName() == rAttr.GetName() )
|
|
|
|
{
|
|
|
|
// Werte muessen uebereinstimmen
|
|
|
|
if( pS->GetSlotId().GetValue() != rAttr.GetSlotId().GetValue() )
|
|
|
|
{
|
|
|
|
DBG_ERROR( "Gleicher Name in MetaClass : " );
|
|
|
|
DBG_ERROR( pS->GetName().GetBuffer() );
|
|
|
|
DBG_ERROR( pS->GetSlotId().GetBuffer() );
|
|
|
|
DBG_ERROR( rAttr.GetSlotId().GetBuffer() );
|
|
|
|
|
|
|
|
ByteString aStr( "Attribute's " );
|
|
|
|
aStr += pS->GetName();
|
|
|
|
aStr += " with different id's";
|
|
|
|
rBase.SetError( aStr, rInStm.GetToken() );
|
|
|
|
rBase.WriteError( rInStm );
|
2010-11-03 15:49:08 +01:00
|
|
|
return sal_False;
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt32 nId1 = pS->GetSlotId().GetValue();
|
|
|
|
sal_uInt32 nId2 = rAttr.GetSlotId().GetValue();
|
2000-09-18 15:33:13 +00:00
|
|
|
if( nId1 == nId2 && nId1 != 0 /*&& nId2 != 0 ist ueberfluessig*/ )
|
|
|
|
{
|
|
|
|
DBG_ERROR( "Gleiche Id in MetaClass : " );
|
|
|
|
DBG_ERROR( ByteString::CreateFromInt32( pS->GetSlotId().GetValue() ).GetBuffer() );
|
|
|
|
DBG_ERROR( pS->GetSlotId().GetBuffer() );
|
|
|
|
DBG_ERROR( rAttr.GetSlotId().GetBuffer() );
|
|
|
|
|
|
|
|
ByteString aStr( "Attribute " );
|
|
|
|
aStr += pS->GetName();
|
|
|
|
aStr += " and Attribute ";
|
|
|
|
aStr += rAttr.GetName();
|
|
|
|
aStr += " with equal id's";
|
|
|
|
rBase.SetError( aStr, rInStm.GetToken() );
|
|
|
|
rBase.WriteError( rInStm );
|
2010-11-03 15:49:08 +01:00
|
|
|
return sal_False;
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SvMetaClass * pSC = aSuperClass;
|
|
|
|
if( pSC )
|
|
|
|
return pSC->TestAttribute( rBase, rInStm, rAttr );
|
2010-11-03 15:49:08 +01:00
|
|
|
return sal_True;
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::WriteSvIdl()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
|
|
|
void SvMetaClass::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 nTab )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
WriteHeaderSvIdl( rBase, rOutStm, nTab );
|
|
|
|
if( aSuperClass.Is() )
|
|
|
|
rOutStm << " : " << aSuperClass->GetName().GetBuffer();
|
|
|
|
rOutStm << endl;
|
|
|
|
SvMetaName::WriteSvIdl( rBase, rOutStm, nTab );
|
|
|
|
rOutStm << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::WriteOdlMember()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
|
|
|
/*
|
|
|
|
void SvMetaClass::WriteOdlMembers( ByteStringList & rSuperList,
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_Bool bVariable, sal_Bool bWriteTab,
|
2000-09-18 15:33:13 +00:00
|
|
|
SvIdlDataBase & rBase,
|
2010-11-03 15:49:08 +01:00
|
|
|
SvStream & rOutStm, sal_uInt16 nTab )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
// alle Attribute schreiben
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uIntPtr n;
|
2000-09-18 15:33:13 +00:00
|
|
|
for( n = 0; n < aAttrList.Count(); n++ )
|
|
|
|
{
|
|
|
|
SvMetaAttribute * pAttr = aAttrList.GetObject( n );
|
|
|
|
|
|
|
|
ByteString aMangleName = pAttr->GetMangleName( bVariable );
|
|
|
|
ByteString * pS = rBase.FindName( aMangleName, rSuperList );
|
|
|
|
|
|
|
|
if( !pS && pAttr->GetExport() )
|
|
|
|
{
|
|
|
|
// nicht doppelt
|
|
|
|
if( bVariable && pAttr->IsVariable() )
|
|
|
|
{
|
|
|
|
rSuperList.Insert( new ByteString( aMangleName ), LIST_APPEND );
|
|
|
|
pAttr->Write( rBase, rOutStm, nTab +1, WRITE_ODL,
|
|
|
|
WA_VARIABLE );
|
|
|
|
rOutStm << ';' << endl;
|
|
|
|
}
|
|
|
|
else if( !bVariable && pAttr->IsMethod() )
|
|
|
|
{
|
|
|
|
rSuperList.Insert( new ByteString( aMangleName ), LIST_APPEND );
|
|
|
|
pAttr->Write( rBase, rOutStm, nTab +1, WRITE_ODL,
|
|
|
|
WA_METHOD );
|
|
|
|
rOutStm << ';' << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
// alle Attribute der importierten Klassen schreiben
|
|
|
|
for( n = 0; n < aClassList.Count(); n++ )
|
|
|
|
{
|
|
|
|
SvClassElement * pEle = aClassList.GetObject( n );
|
|
|
|
SvMetaClass * pCl = pEle->GetClass();
|
|
|
|
pCl->WriteOdlMembers( rSuperList, bVariable, bWriteTab,
|
|
|
|
rBase, rOutStm, nTab );
|
|
|
|
}
|
|
|
|
// alle Attribute der Superklassen schreiben
|
|
|
|
SvMetaClass * pSC = aSuperClass;
|
|
|
|
if( pSC )
|
|
|
|
pSC->WriteOdlMembers( rSuperList, bVariable, bWriteTab,
|
|
|
|
rBase, rOutStm, nTab );
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::Write()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
|
|
|
void SvMetaClass::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 nTab,
|
2006-06-19 09:42:24 +00:00
|
|
|
WriteType nT, WriteAttribute )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
rBase.aIFaceName = GetName();
|
|
|
|
switch( nT )
|
|
|
|
{
|
|
|
|
case WRITE_ODL:
|
|
|
|
{
|
2008-11-10 15:06:12 +00:00
|
|
|
DBG_ERROR( "Not supported anymore!" );
|
2000-09-18 15:33:13 +00:00
|
|
|
/*
|
|
|
|
// Schreibt die Attribute
|
|
|
|
SvMetaName::Write( rBase, rOutStm, nTab, nT, nA );
|
|
|
|
|
|
|
|
WriteTab( rOutStm, nTab );
|
|
|
|
rOutStm << "dispinterface " << GetName().GetBuffer() << endl;
|
|
|
|
WriteTab( rOutStm, nTab );
|
|
|
|
rOutStm << '{' << endl;
|
|
|
|
|
|
|
|
WriteTab( rOutStm, nTab );
|
|
|
|
rOutStm << "properties:";
|
|
|
|
rOutStm << endl;
|
|
|
|
|
|
|
|
StringList aSuperList;
|
2010-11-03 15:49:08 +01:00
|
|
|
WriteOdlMembers( aSuperList, sal_True, sal_True, rBase, rOutStm, nTab );
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
WriteTab( rOutStm, nTab );
|
|
|
|
rOutStm << "methods:";
|
|
|
|
rOutStm << endl;
|
|
|
|
|
2010-11-03 15:49:08 +01:00
|
|
|
WriteOdlMembers( aSuperList, sal_False, sal_True, rBase, rOutStm, nTab );
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
ByteString * pStr = aSuperList.First();
|
|
|
|
while( pStr )
|
|
|
|
{
|
|
|
|
delete pStr;
|
|
|
|
pStr = aSuperList.Next();
|
|
|
|
}
|
|
|
|
|
|
|
|
WriteTab( rOutStm, 1 );
|
|
|
|
rOutStm << '}' << endl;
|
|
|
|
*/
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case WRITE_C_SOURCE:
|
|
|
|
case WRITE_C_HEADER:
|
|
|
|
{
|
2008-11-10 15:06:12 +00:00
|
|
|
DBG_ERROR( "Not supported anymore!" );
|
2000-09-18 15:33:13 +00:00
|
|
|
/*
|
|
|
|
StringList aSuperList;
|
|
|
|
if( nT == WRITE_C_SOURCE )
|
|
|
|
{
|
|
|
|
rOutStm << "#pragma code_seg (\"" << GetName().GetBuffer()
|
|
|
|
<< "\",\"CODE\")" << endl;
|
|
|
|
}
|
|
|
|
WriteCFunctions( aSuperList, rBase, rOutStm, nTab, nT );
|
|
|
|
*/
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case WRITE_DOCU:
|
|
|
|
{
|
|
|
|
rOutStm << "<INTERFACE>" << endl
|
|
|
|
<< GetName().GetBuffer();
|
|
|
|
if ( GetAutomation() )
|
|
|
|
rOutStm << " ( Automation ) ";
|
|
|
|
rOutStm << endl;
|
2006-06-19 09:42:24 +00:00
|
|
|
WriteDescription( rOutStm );
|
2000-09-18 15:33:13 +00:00
|
|
|
rOutStm << "</INTERFACE>" << endl << endl;
|
|
|
|
|
|
|
|
// alle Attribute schreiben
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uIntPtr n;
|
2000-09-18 15:33:13 +00:00
|
|
|
for( n = 0; n < aAttrList.Count(); n++ )
|
|
|
|
{
|
|
|
|
SvMetaAttribute * pAttr = aAttrList.GetObject( n );
|
|
|
|
if( !pAttr->GetHidden() )
|
|
|
|
{
|
|
|
|
if( pAttr->IsMethod() )
|
|
|
|
pAttr->Write( rBase, rOutStm, nTab, nT, WA_METHOD );
|
|
|
|
|
|
|
|
if( pAttr->IsVariable() )
|
|
|
|
pAttr->Write( rBase, rOutStm, nTab, nT, WA_VARIABLE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2006-06-19 09:42:24 +00:00
|
|
|
default:
|
|
|
|
break;
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::WriteSlotParamArray()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 SvMetaClass::WriteSlotParamArray( SvIdlDataBase & rBase,
|
2000-09-18 15:33:13 +00:00
|
|
|
SvSlotElementList & rSlotList,
|
|
|
|
SvStream & rOutStm )
|
|
|
|
{
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 nCount = 0;
|
|
|
|
for( sal_uIntPtr n = 0; n < rSlotList.Count(); n++ )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
SvSlotElement *pEle = rSlotList.GetObject( n );
|
|
|
|
SvMetaSlot *pAttr = pEle->xSlot;
|
2006-06-19 09:42:24 +00:00
|
|
|
nCount = nCount + pAttr->WriteSlotParamArray( rBase, rOutStm );
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return nCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::WriteSlots()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 SvMetaClass::WriteSlots( const ByteString & rShellName,
|
|
|
|
sal_uInt16 nCount, SvSlotElementList & rSlotList,
|
2000-09-18 15:33:13 +00:00
|
|
|
SvIdlDataBase & rBase,
|
|
|
|
SvStream & rOutStm )
|
|
|
|
{
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 nSCount = 0;
|
|
|
|
for( sal_uIntPtr n = 0; n < rSlotList.Count(); n++ )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
rSlotList.Seek(n);
|
|
|
|
SvSlotElement * pEle = rSlotList.GetCurObject();
|
|
|
|
SvMetaSlot * pAttr = pEle->xSlot;
|
2006-06-19 09:42:24 +00:00
|
|
|
nSCount = nSCount + pAttr->WriteSlotMap( rShellName, nCount + nSCount,
|
2000-09-18 15:33:13 +00:00
|
|
|
rSlotList, pEle->aPrefix, rBase,
|
|
|
|
rOutStm );
|
|
|
|
}
|
|
|
|
|
|
|
|
return nSCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::InsertSlots()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
|
|
|
void SvMetaClass::InsertSlots( SvSlotElementList& rList, SvULongs& rSuperList,
|
|
|
|
SvMetaClassList &rClassList,
|
|
|
|
const ByteString & rPrefix, SvIdlDataBase& rBase)
|
|
|
|
{
|
|
|
|
// Wurde diese Klasse schon geschrieben ?
|
|
|
|
if ( rClassList.GetPos(this) != LIST_ENTRY_NOTFOUND )
|
|
|
|
return;
|
|
|
|
|
|
|
|
rClassList.Insert(this, LIST_APPEND);
|
|
|
|
|
|
|
|
// alle direkten Attribute schreiben
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uIntPtr n;
|
2000-09-18 15:33:13 +00:00
|
|
|
for( n = 0; n < aAttrList.Count(); n++ )
|
|
|
|
{
|
|
|
|
SvMetaAttribute * pAttr = aAttrList.GetObject( n );
|
|
|
|
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uIntPtr nId = pAttr->GetSlotId().GetValue();
|
|
|
|
sal_uInt16 nPos;
|
2000-09-18 15:33:13 +00:00
|
|
|
for ( nPos=0; nPos < rSuperList.Count(); nPos++ )
|
|
|
|
{
|
|
|
|
if ( rSuperList.GetObject(nPos) == nId )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( nPos == rSuperList.Count() )
|
|
|
|
{
|
|
|
|
// nur schreiben, wenn nicht schon bei SubClass oder
|
|
|
|
// importiertem Interface geschrieben
|
|
|
|
rSuperList.Insert( nId, nPos );
|
|
|
|
pAttr->Insert(rList, rPrefix, rBase);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Alle schon von SuperShells importierten Interfaces sollen nicht
|
|
|
|
// mehr geschrieben werden
|
|
|
|
// Es ist also verboten, da\s Shell und SuperShell die gleiche Klasse
|
|
|
|
// direkt importieren !
|
|
|
|
if( IsShell() && aSuperClass.Is() )
|
|
|
|
aSuperClass->FillClasses( rClassList );
|
|
|
|
|
|
|
|
// alle Attribute der importierten Klassen schreiben, sofern diese nicht
|
|
|
|
// schon von der Superklasse importiert wurden
|
|
|
|
for( n = 0; n < aClassList.Count(); n++ )
|
|
|
|
{
|
|
|
|
SvClassElement * pEle = aClassList.GetObject( n );
|
|
|
|
SvMetaClass * pCl = pEle->GetClass();
|
|
|
|
ByteString rPre = rPrefix;
|
|
|
|
if( rPre.Len() && pEle->GetPrefix().Len() )
|
|
|
|
rPre += '.';
|
|
|
|
rPre += pEle->GetPrefix();
|
|
|
|
|
|
|
|
// Zun"achst die direkt importierten Interfaces schreiben
|
|
|
|
pCl->InsertSlots( rList, rSuperList, rClassList, rPre, rBase );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Superklassen nur schreiben, wenn keine Shell und nicht in der Liste
|
|
|
|
if( !IsShell() && aSuperClass.Is() )
|
|
|
|
{
|
|
|
|
aSuperClass->InsertSlots( rList, rSuperList, rClassList, rPrefix, rBase );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::FillClasses()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
|
|
|
void SvMetaClass::FillClasses( SvMetaClassList & rList )
|
|
|
|
{
|
|
|
|
// Bin ich noch nicht drin ?
|
|
|
|
if ( rList.GetPos(this) == LIST_ENTRY_NOTFOUND )
|
|
|
|
{
|
|
|
|
rList.Insert(this, LIST_APPEND);
|
|
|
|
|
|
|
|
// Meine Imports
|
2010-11-03 15:49:08 +01:00
|
|
|
for( sal_uIntPtr n = 0; n < aClassList.Count(); n++ )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
SvClassElement * pEle = aClassList.GetObject( n );
|
|
|
|
SvMetaClass * pCl = pEle->GetClass();
|
|
|
|
pCl->FillClasses( rList );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Meine Superklasse
|
|
|
|
if( aSuperClass.Is() )
|
|
|
|
aSuperClass->FillClasses( rList );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::WriteSlotStubs()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
|
|
|
void SvMetaClass::WriteSlotStubs( const ByteString & rShellName,
|
|
|
|
SvSlotElementList & rSlotList,
|
|
|
|
ByteStringList & rList,
|
|
|
|
SvStream & rOutStm )
|
|
|
|
{
|
|
|
|
// alle Attribute schreiben
|
2010-11-03 15:49:08 +01:00
|
|
|
for( sal_uIntPtr n = 0; n < rSlotList.Count(); n++ )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
SvSlotElement *pEle = rSlotList.GetObject( n );
|
|
|
|
SvMetaSlot *pAttr = pEle->xSlot;
|
|
|
|
pAttr->WriteSlotStubs( rShellName, rList, rOutStm );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::WriteSfx()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
|
|
|
void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm )
|
|
|
|
{
|
|
|
|
WriteStars( rOutStm );
|
|
|
|
// Klasse definieren
|
|
|
|
rOutStm << "#ifdef " << GetName().GetBuffer() << endl;
|
|
|
|
rOutStm << "#undef ShellClass" << endl;
|
|
|
|
rOutStm << "#undef " << GetName().GetBuffer() << endl;
|
|
|
|
rOutStm << "#define ShellClass " << GetName().GetBuffer() << endl;
|
|
|
|
|
|
|
|
// rOutStm << "SFX_TYPELIB(" << GetName().GetBuffer() << ',' << endl
|
|
|
|
// << "\t/* library type */"
|
|
|
|
// << '"' << ByteString( GetModule()->GetUUId().GetHexName(), RTL_TEXTENCODING_UTF8 ).GetBuffer() << "\"," << endl
|
|
|
|
// << "\t\"" << GetModule()->GetTypeLibFileName().GetBuffer() << "\","
|
|
|
|
// << ByteString::CreateFromInt32( GetModule()->GetVersion().GetMajorVersion() ).GetBuffer() << ','
|
|
|
|
// << ByteString::CreateFromInt32( GetModule()->GetVersion().GetMinorVersion() ).GetBuffer() << ',' << endl
|
|
|
|
// << "\t/* shell type */"
|
|
|
|
// << '"';
|
|
|
|
// if( xAutomationInterface.Is() )
|
|
|
|
// rOutStm << ByteString( xAutomationInterface->GetUUId().GetHexName(), RTL_TEXTENCODING_UTF8 ).GetBuffer();
|
|
|
|
// else
|
|
|
|
// rOutStm << ByteString( GetUUId().GetHexName(), RTL_TEXTENCODING_UTF8 ).GetBuffer();
|
|
|
|
// rOutStm << "\");" << endl << endl;
|
|
|
|
|
|
|
|
// Fuer Interfaces werden kein Slotmaps geschrieben
|
|
|
|
if( !IsShell() )
|
|
|
|
{
|
|
|
|
rOutStm << "#endif" << endl << endl;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Parameter Array schreiben
|
|
|
|
//rOutStm << "SfxArgList " << GetName().GetBuffer() << "ArgMap[] = {" << endl;
|
|
|
|
rOutStm << "SFX_ARGUMENTMAP(" << GetName().GetBuffer() << ')' << endl
|
|
|
|
<< '{' << endl;
|
|
|
|
|
|
|
|
SvULongs aSuperList;
|
2006-06-19 09:42:24 +00:00
|
|
|
SvMetaClassList classList;
|
2000-09-18 15:33:13 +00:00
|
|
|
SvSlotElementList aSlotList;
|
2006-06-19 09:42:24 +00:00
|
|
|
InsertSlots(aSlotList, aSuperList, classList, ByteString(), rBase);
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uIntPtr n;
|
2000-09-18 15:33:13 +00:00
|
|
|
for ( n=0; n<aSlotList.Count(); n++ )
|
|
|
|
{
|
|
|
|
SvSlotElement *pEle = aSlotList.GetObject( n );
|
|
|
|
SvMetaSlot *pSlot = pEle->xSlot;
|
|
|
|
pSlot->SetListPos(n);
|
|
|
|
}
|
|
|
|
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uIntPtr nSlotCount = aSlotList.Count();
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
// alle Attribute schreiben
|
2010-11-03 15:49:08 +01:00
|
|
|
sal_uInt16 nArgCount = WriteSlotParamArray( rBase, aSlotList, rOutStm );
|
2000-09-18 15:33:13 +00:00
|
|
|
if( nArgCount )
|
|
|
|
Back2Delemitter( rOutStm );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// mindestens einen dummy
|
|
|
|
WriteTab( rOutStm, 1 );
|
|
|
|
rOutStm << "SFX_ARGUMENT( 0, 0, SfxVoidItem )" << endl;
|
|
|
|
}
|
|
|
|
rOutStm << endl << "};" << endl << endl;
|
|
|
|
|
|
|
|
ByteStringList aStringList;
|
|
|
|
WriteSlotStubs( GetName(), aSlotList, aStringList, rOutStm );
|
|
|
|
ByteString * pStr = aStringList.First();
|
|
|
|
while( pStr )
|
|
|
|
{
|
|
|
|
delete pStr;
|
|
|
|
pStr = aStringList.Next();
|
|
|
|
}
|
|
|
|
|
|
|
|
rOutStm << endl;
|
|
|
|
|
|
|
|
// Slotmap schreiben
|
|
|
|
rOutStm << "SFX_SLOTMAP_ARG(" << GetName().GetBuffer() << ')' << endl
|
|
|
|
<< '{' << endl;
|
|
|
|
|
|
|
|
// alle Attribute schreiben
|
|
|
|
WriteSlots( GetName(), 0, aSlotList, rBase, rOutStm );
|
|
|
|
if( nSlotCount )
|
|
|
|
Back2Delemitter( rOutStm );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// mindestens einen dummy
|
|
|
|
WriteTab( rOutStm, 1 );
|
|
|
|
rOutStm << "SFX_SLOT_ARG(" << GetName().GetBuffer()
|
|
|
|
<< ", 0, 0, "
|
|
|
|
<< "SFX_STUB_PTR_EXEC_NONE,"
|
|
|
|
<< "SFX_STUB_PTR_STATE_NONE,"
|
|
|
|
<< "0, SfxVoidItem, 0, 0, \"\", 0 )" << endl;
|
|
|
|
}
|
|
|
|
rOutStm << endl << "};" << endl << "#endif" << endl << endl;
|
|
|
|
|
|
|
|
for( n=0; n<aSlotList.Count(); n++ )
|
|
|
|
{
|
|
|
|
aSlotList.Seek(n);
|
|
|
|
SvSlotElement* pEle = aSlotList.GetCurObject();
|
|
|
|
SvMetaSlot* pAttr = pEle->xSlot;
|
|
|
|
pAttr->ResetSlotPointer();
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( n=0; n<aSlotList.Count(); n++ )
|
|
|
|
delete aSlotList.GetObject(n);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvMetaClass::WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm,
|
|
|
|
Table* pTable )
|
|
|
|
{
|
2010-11-03 15:49:08 +01:00
|
|
|
for( sal_uIntPtr n=0; n<aAttrList.Count(); n++ )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
SvMetaAttribute * pAttr = aAttrList.GetObject( n );
|
|
|
|
pAttr->WriteHelpId( rBase, rOutStm, pTable );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaShell::WriteSrc()
|
|
|
|
*************************************************************************/
|
|
|
|
void SvMetaClass::WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm,
|
|
|
|
Table * pTable )
|
|
|
|
{
|
2010-11-03 15:49:08 +01:00
|
|
|
for( sal_uIntPtr n=0; n<aAttrList.Count(); n++ )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
SvMetaAttribute * pAttr = aAttrList.GetObject( n );
|
|
|
|
pAttr->WriteSrc( rBase, rOutStm, pTable );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::WriteHxx()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
2010-11-03 15:49:08 +01:00
|
|
|
void SvMetaClass::WriteHxx( SvIdlDataBase &, SvStream & rOutStm, sal_uInt16 )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
ByteString aSuperName( "SvDispatch" );
|
|
|
|
if( GetSuperClass() )
|
|
|
|
aSuperName = GetSuperClass()->GetName();
|
|
|
|
const char * pSup = aSuperName.GetBuffer();
|
|
|
|
|
|
|
|
rOutStm
|
|
|
|
<< "class " << GetSvName().GetBuffer()
|
|
|
|
<< ": public " << pSup << endl
|
|
|
|
<< '{' << endl
|
|
|
|
<< "protected:" << endl
|
|
|
|
<< "\tvirtual SvGlobalName GetTypeName() const;" << endl
|
2010-11-03 15:49:08 +01:00
|
|
|
<< "\tvirtual sal_Bool FillTypeLibInfo( SvGlobalName *, sal_uInt16 * pMajor," << endl
|
|
|
|
<< "\t sal_uInt16 * pMinor ) const;" << endl
|
|
|
|
<< "\tvirtual sal_Bool FillTypeLibInfo( ByteString * pName, sal_uInt16 * pMajor," << endl;
|
2000-09-18 15:33:13 +00:00
|
|
|
rOutStm
|
2010-11-03 15:49:08 +01:00
|
|
|
<< "\t sal_uInt16 * pMinor ) const;" << endl
|
2000-09-18 15:33:13 +00:00
|
|
|
<< "\tvirtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) = 0;" << endl
|
|
|
|
<< "public:" << endl
|
|
|
|
<< "\t static SvGlobalName ClassName()" << endl
|
|
|
|
<< "\t { return SvGlobalName( " << ByteString( GetUUId().GetctorName(), RTL_TEXTENCODING_UTF8 ).GetBuffer() << " ); }" << endl
|
|
|
|
<< "};" << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|* SvMetaClass::WriteCxx()
|
|
|
|
|*
|
|
|
|
|* Beschreibung
|
|
|
|
*************************************************************************/
|
2010-11-03 15:49:08 +01:00
|
|
|
void SvMetaClass::WriteCxx( SvIdlDataBase &, SvStream & rOutStm, sal_uInt16 )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
ByteString aSuperName( "SvDispatch" );
|
|
|
|
if( GetSuperClass() )
|
|
|
|
aSuperName = GetSuperClass()->GetName();
|
|
|
|
const char * pSup = aSuperName.GetBuffer();
|
|
|
|
|
2006-06-19 09:42:24 +00:00
|
|
|
ByteString name = GetSvName();
|
2000-09-18 15:33:13 +00:00
|
|
|
// GetTypeName
|
2006-06-19 09:42:24 +00:00
|
|
|
rOutStm << "SvGlobalName " << name.GetBuffer() << "::GetTypeName() const" << endl
|
2000-09-18 15:33:13 +00:00
|
|
|
<< '{' << endl
|
|
|
|
<< "\treturn ClassName();" << endl
|
|
|
|
<< '}' << endl;
|
|
|
|
|
|
|
|
SvMetaModule * pMod = GetModule();
|
|
|
|
// FillTypeLibInfo
|
2010-11-03 15:49:08 +01:00
|
|
|
rOutStm << "sal_Bool " << name.GetBuffer() << "::FillTypeLibInfo( SvGlobalName * pGN," << endl
|
|
|
|
<< "\t sal_uInt16 * pMajor," << endl
|
|
|
|
<< "\t sal_uInt16 * pMinor ) const" << endl
|
2000-09-18 15:33:13 +00:00
|
|
|
<< '{' << endl
|
|
|
|
<< "\tSvGlobalName aN( " << ByteString( pMod->GetUUId().GetctorName(), RTL_TEXTENCODING_UTF8 ).GetBuffer() << " );" << endl;
|
|
|
|
rOutStm << "\t*pGN = aN;" << endl
|
|
|
|
<< "\t*pMajor = " << ByteString::CreateFromInt32(pMod->GetVersion().GetMajorVersion()).GetBuffer() << ';' << endl
|
|
|
|
<< "\t*pMinor = " << ByteString::CreateFromInt32(pMod->GetVersion().GetMinorVersion()).GetBuffer() << ';' << endl
|
2010-11-03 15:49:08 +01:00
|
|
|
<< "\treturn sal_True;" << endl
|
2000-09-18 15:33:13 +00:00
|
|
|
<< '}' << endl;
|
|
|
|
|
|
|
|
// FillTypeLibInfo
|
2010-11-03 15:49:08 +01:00
|
|
|
rOutStm << "sal_Bool " << name.GetBuffer() << "::FillTypeLibInfo( ByteString * pName,"
|
|
|
|
<< "\t sal_uInt16 * pMajor," << endl
|
|
|
|
<< "\t sal_uInt16 * pMinor ) const" << endl;
|
2000-09-18 15:33:13 +00:00
|
|
|
rOutStm << '{' << endl
|
|
|
|
<< "\t*pName = \"" << pMod->GetTypeLibFileName().GetBuffer() << "\";" << endl
|
|
|
|
<< "\t*pMajor = " << ByteString::CreateFromInt32(pMod->GetVersion().GetMajorVersion()).GetBuffer() << ';' << endl
|
|
|
|
<< "\t*pMinor = " << ByteString::CreateFromInt32(pMod->GetVersion().GetMinorVersion()).GetBuffer() << ';' << endl
|
2010-11-03 15:49:08 +01:00
|
|
|
<< "\treturn sal_True;" << endl
|
2000-09-18 15:33:13 +00:00
|
|
|
<< '}' << endl;
|
|
|
|
|
2006-06-19 09:42:24 +00:00
|
|
|
rOutStm << "void " << name.GetBuffer() << "::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )" << endl
|
2000-09-18 15:33:13 +00:00
|
|
|
<< '{' << endl
|
|
|
|
<< "\t" << pSup << "::Notify( rBC, rHint );" << endl
|
|
|
|
<< '}' << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // IDL_COMPILER
|
|
|
|
|