summaryrefslogtreecommitdiff
path: root/idl/source/objects
diff options
context:
space:
mode:
Diffstat (limited to 'idl/source/objects')
-rw-r--r--idl/source/objects/basobj.cxx863
-rw-r--r--idl/source/objects/bastype.cxx1045
-rw-r--r--idl/source/objects/makefile.mk103
-rw-r--r--idl/source/objects/module.cxx732
-rw-r--r--idl/source/objects/object.cxx1091
-rw-r--r--idl/source/objects/slot.cxx2011
-rw-r--r--idl/source/objects/types.cxx2840
7 files changed, 8685 insertions, 0 deletions
diff --git a/idl/source/objects/basobj.cxx b/idl/source/objects/basobj.cxx
new file mode 100644
index 000000000000..1cfa683cb170
--- /dev/null
+++ b/idl/source/objects/basobj.cxx
@@ -0,0 +1,863 @@
+/*************************************************************************
+ *
+ * $RCSfile: basobj.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <ctype.h>
+#include <stdio.h>
+
+#include <tools/debug.hxx>
+
+#include <attrib.hxx>
+#include <basobj.hxx>
+#include <module.hxx>
+#include <globals.hxx>
+#include <database.hxx>
+#pragma hdrstop
+
+/****************** SvMetaObject *****************************************/
+SV_IMPL_META_FACTORY1( SvMetaObject, SvRttiBase )
+#ifdef IDL_COMPILER
+SvAttributeList & SvMetaObject::GetAttributeList()
+{
+ if( !pAttribList )
+ {
+ pAttribList = new SvAttributeList();
+ }
+ return *pAttribList;
+}
+#endif
+/*************************************************************************
+|* SvMetaObject::SvMetaObject()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaObject::SvMetaObject()
+{
+}
+
+void SvMetaObject::Load( SvPersistStream & )
+{
+}
+
+void SvMetaObject::Save( SvPersistStream & )
+{
+}
+
+/*************************************************************************
+|* SvMetaObject::WriteTab()
+|*
+|* Beschreibung
+*************************************************************************/
+#ifdef IDL_COMPILER
+void SvMetaObject::WriteTab( SvStream & rOutStm, USHORT nTab )
+{
+ while( nTab-- )
+ rOutStm << " ";
+// rOutStm << '\t';
+}
+
+/*************************************************************************
+|* SvMetaObject::WriteStart()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaObject::WriteStars( SvStream & rOutStm )
+{
+ rOutStm << '/';
+ for( int i = 6; i > 0; i-- )
+ rOutStm << "**********";
+ rOutStm << '/' << endl;
+}
+
+/*************************************************************************
+|* SvMetaObject::TestAndSeekSpaceOnly()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaObject::TestAndSeekSpaceOnly( SvStream & rOutStm, ULONG nBegPos )
+{
+ // keine leeren Klammern schreiben
+ ULONG nPos = rOutStm.Tell();
+ rOutStm.Seek( nBegPos );
+ BOOL bOnlySpace = TRUE;
+ while( bOnlySpace && rOutStm.Tell() < nPos )
+ {
+ char c;
+ rOutStm >> c;
+ if( !isspace( c ) )
+ bOnlySpace = FALSE;
+ }
+ if( bOnlySpace )
+ // nichts geschrieben
+ rOutStm.Seek( nBegPos );
+ else
+ rOutStm.Seek( nPos );
+ return bOnlySpace;
+}
+
+/*************************************************************************
+|* SvMetaObject::Back2Delemitter()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaObject::Back2Delemitter( SvStream & rOutStm )
+{
+ // keine leeren Klammern schreiben
+ ULONG nPos = rOutStm.Tell();
+ rOutStm.SeekRel( -1 );
+ char c = 0;
+ rOutStm >> c;
+
+ while( isspace( c ) && rOutStm.Tell() != 1 )
+ {
+ rOutStm.SeekRel( -2 );
+ rOutStm >> c;
+ }
+
+ if( c == ';' || c == ',' )
+ rOutStm.SeekRel( -1 );
+ else
+ rOutStm.Seek( nPos );
+}
+
+/*************************************************************************
+|* SvMetaObject::ReadSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaObject::ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm )
+{
+ return FALSE;
+}
+
+/*************************************************************************
+|* SvMetaObject::WriteSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaObject::WriteSvIdl( SvIdlDataBase &, SvStream &, USHORT /*nTab */ )
+{
+}
+
+/*************************************************************************
+|* SvMetaObject::Write()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaObject::Write( SvIdlDataBase &, SvStream &, USHORT /*nTab */,
+ WriteType, WriteAttribute )
+{
+}
+
+/*************************************************************************
+|* SvMetaObject::WriteCxx()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaObject::WriteCxx( SvIdlDataBase &, SvStream &, USHORT /*nTab */ )
+{
+}
+
+/*************************************************************************
+|* SvMetaObject::WriteHxx()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaObject::WriteHxx( SvIdlDataBase &, SvStream &, USHORT /*nTab */ )
+{
+}
+
+#endif
+
+/****************** SvMetaName *****************************************/
+SV_IMPL_META_FACTORY1( SvMetaName, SvMetaObject );
+#ifdef IDL_COMPILER
+SvAttributeList & SvMetaName::GetAttributeList()
+{
+ if( !pAttribList )
+ {
+ pAttribList = new SvAttributeList();
+ pAttribList->Append( new SV_ATTRIBUTE( Name, Name ) );
+ }
+ return *pAttribList;
+}
+#endif
+/*************************************************************************
+|* SvMetaName::SvMetaName()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaName::SvMetaName()
+{
+}
+
+void SvMetaName::Load( SvPersistStream & rStm )
+{
+ SvMetaObject::Load( rStm );
+ BYTE nMask;
+ rStm >> nMask;
+
+ if( nMask >= 0x20 )
+ {
+ rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ DBG_ERROR( "wrong format" )
+ return;
+ }
+ if( nMask & 0x01 ) rStm >> aName;
+ if( nMask & 0x02 ) rStm >> aHelpContext;
+ if( nMask & 0x04 ) rStm >> aHelpText;
+ if( nMask & 0x08 ) rStm >> aConfigName;
+ if( nMask & 0x10 ) rStm >> aDescription;
+}
+
+void SvMetaName::Save( SvPersistStream & rStm )
+{
+ SvMetaObject::Save( rStm );
+ BYTE nMask = 0;
+ if( aName.IsSet() ) nMask |= 0x01;
+ if( aHelpContext.IsSet() ) nMask |= 0x02;
+ if( aHelpText.IsSet() ) nMask |= 0x04;
+ if( aConfigName.IsSet() ) nMask |= 0x08;
+ if( aDescription.IsSet() ) nMask |= 0x10;
+
+ rStm << nMask;
+ if( nMask & 0x01 ) rStm << aName;
+ if( nMask & 0x02 ) rStm << aHelpContext;
+ if( nMask & 0x04 ) rStm << aHelpText;
+ if( nMask & 0x08 ) rStm << aConfigName;
+ if( nMask & 0x10 ) rStm << aDescription;
+}
+
+/*************************************************************************
+|*
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaName::SetName( const ByteString & rName, SvIdlDataBase * )
+{
+ aName = rName;
+ return TRUE;
+}
+
+#ifdef IDL_COMPILER
+/*************************************************************************
+|* SvMetaName::ReadNameSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaName::ReadNameSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ UINT32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+
+ // Modulnamen lesen
+ if( pTok->IsIdentifier() )
+ if( SetName( pTok->GetString(), &rBase ) )
+ return TRUE;
+
+ rInStm.Seek( nTokPos );
+ return FALSE;
+}
+
+/*************************************************************************
+|* SvMetaName::ReadSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaName::ReadAttributesSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ UINT32 nTokPos = rInStm.Tell();
+ if( aName.ReadSvIdl( SvHash_Name(), rInStm ) )
+ {
+ if( !SetName( aName, &rBase ) )
+ rInStm.Seek( nTokPos );
+ }
+ aHelpContext.ReadSvIdl( rBase, SvHash_HelpContext(), rInStm );
+ aHelpText.ReadSvIdl( rBase, rInStm );
+ aConfigName.ReadSvIdl( SvHash_ConfigName(), rInStm );
+ aDescription.ReadSvIdl( SvHash_Description(), rInStm );
+/*
+ aHelpContext.ReadSvIdl( GetModule()->GetInfo()->GetHelpContextContainer(),
+ rInStm );
+*/
+}
+
+/*************************************************************************
+|* SvMetaName::DoReadContextSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaName::DoReadContextSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm, char cDel )
+{
+ UINT32 nBeginPos = 0; // kann mit Tell nicht vorkommen
+ while( nBeginPos != rInStm.Tell() )
+ {
+ nBeginPos = rInStm.Tell();
+ ReadContextSvIdl( rBase, rInStm );
+ if( cDel == '\0' )
+ rInStm.ReadDelemiter();
+ else
+ rInStm.Read( cDel );
+ }
+}
+
+/*************************************************************************
+|* SvMetaName::ReadSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaName::ReadContextSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+}
+
+/*************************************************************************
+|* SvMetaName::Test()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaName::Test( SvIdlDataBase &, SvTokenStream & )
+{
+ return TRUE;
+}
+
+/*************************************************************************
+|* SvMetaName::WriteContextSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaName::WriteContextSvIdl( SvIdlDataBase & rBase,
+ SvStream & rOutStm,
+ USHORT nTab )
+{
+}
+
+/*************************************************************************
+|* SvMetaName::WriteDescription()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaName::WriteDescription( SvIdlDataBase & rBase,
+ SvStream & rOutStm )
+{
+ rOutStm << "<DESCRIPTION>" << endl;
+
+ ByteString aDescription( GetDescription() );
+ USHORT nPos = aDescription.Search( '\n' );
+ while ( nPos != STRING_NOTFOUND )
+ {
+ rOutStm << aDescription.Copy( 0, nPos ).GetBuffer() << endl;
+ aDescription.Erase(0,nPos+1);
+ nPos = aDescription.Search( '\n' );
+ }
+
+ rOutStm << aDescription.GetBuffer() << endl
+ << "</DESCRIPTION>" << endl;
+}
+
+/*************************************************************************
+|* SvMetaName::WriteAttributesIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaName::WriteAttributesSvIdl( SvIdlDataBase & rBase,
+ SvStream & rOutStm,
+ USHORT nTab )
+{
+ if( aHelpContext.IsSet() || aHelpText.IsSet() || aConfigName.IsSet() )
+ {
+ WriteTab( rOutStm, nTab );
+ rOutStm << "// class SvMetaName" << endl;
+ }
+ if( aHelpContext.IsSet() )
+ {
+ WriteTab( rOutStm, nTab );
+ aHelpContext.WriteSvIdl( SvHash_HelpContext(), rOutStm, nTab );
+ rOutStm << ';' << endl;
+ }
+ if( aHelpText.IsSet() )
+ {
+ WriteTab( rOutStm, nTab );
+ aHelpText.WriteSvIdl( rBase, rOutStm, nTab );
+ rOutStm << ';' << endl;
+ }
+ if( aConfigName.IsSet() )
+ {
+ WriteTab( rOutStm, nTab );
+ aConfigName.WriteSvIdl( SvHash_ConfigName(), rOutStm, nTab );
+ rOutStm << ';' << endl;
+ }
+}
+
+/*************************************************************************
+|* SvMetaName::ReadSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaName::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
+{
+ UINT32 nTokPos = rInStm.Tell();
+ BOOL bOk = TRUE;
+ if( rInStm.Read( '[' ) )
+ {
+ UINT32 nBeginPos = 0; // kann mit Tell nicht vorkommen
+ while( nBeginPos != rInStm.Tell() )
+ {
+ nBeginPos = rInStm.Tell();
+ ReadAttributesSvIdl( rBase, rInStm );
+ rInStm.ReadDelemiter();
+ }
+ bOk = rInStm.Read( ']' );
+ }
+
+ if( bOk )
+ {
+ if( rInStm.Read( '{' ) )
+ {
+ DoReadContextSvIdl( rBase, rInStm );
+ bOk = rInStm.Read( '}' );
+ }
+ }
+
+ if( !bOk )
+ rInStm.Seek( nTokPos );
+ return bOk;
+}
+
+/*************************************************************************
+|* SvMetaName::WriteSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaName::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab )
+{
+ ULONG nBeginPos = rOutStm.Tell();
+ WriteTab( rOutStm, nTab );
+ rOutStm << '[' << endl;
+ ULONG nOldPos = rOutStm.Tell();
+ WriteAttributesSvIdl( rBase, rOutStm, nTab +1 );
+
+ // keine leeren Klammern schreiben
+ if( TestAndSeekSpaceOnly( rOutStm, nOldPos ) )
+ // nichts geschrieben
+ rOutStm.Seek( nBeginPos );
+ else
+ {
+ WriteTab( rOutStm, nTab );
+ rOutStm << ']';
+ nBeginPos = rOutStm.Tell();
+ rOutStm << endl;
+ }
+
+ WriteTab( rOutStm, nTab );
+ rOutStm << '{' << endl;
+ nOldPos = rOutStm.Tell();
+ WriteContextSvIdl( rBase, rOutStm, nTab +1 );
+
+ // keine leeren Klammern schreiben
+ if( TestAndSeekSpaceOnly( rOutStm, nOldPos ) )
+ // nichts geschrieben
+ rOutStm.Seek( nBeginPos );
+ else
+ {
+ WriteTab( rOutStm, nTab );
+ rOutStm << '}';
+ }
+}
+
+/*************************************************************************
+|* SvMetaName::Write()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaName::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ ULONG nBeginPos = rOutStm.Tell();
+ WriteTab( rOutStm, nTab );
+ rOutStm << '[' << endl;
+ ULONG nOldPos = rOutStm.Tell();
+ WriteAttributes( rBase, rOutStm, nTab +1, nT, nA );
+
+ // keine leeren Klammern schreiben
+ ULONG nPos = rOutStm.Tell();
+ rOutStm.Seek( nOldPos );
+ BOOL bOnlySpace = TRUE;
+ while( bOnlySpace && rOutStm.Tell() < nPos )
+ {
+ char c;
+ rOutStm >> c;
+ if( !isspace( c ) )
+ bOnlySpace = FALSE;
+ }
+ if( bOnlySpace )
+ // nichts geschrieben
+ rOutStm.Seek( nBeginPos );
+ else
+ {
+ rOutStm.Seek( nPos );
+ WriteTab( rOutStm, nTab );
+ rOutStm << ']' << endl;
+ }
+}
+
+/*************************************************************************
+|* SvMetaName::WriteAttributes()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaName::WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ if( GetHelpText().IsSet() || GetHelpContext().IsSet() )
+ {
+ WriteTab( rOutStm, nTab );
+ rOutStm << "// class SvMetaName" << endl;
+ }
+ if( GetHelpText().IsSet() )
+ {
+ WriteTab( rOutStm, nTab );
+ rOutStm << "helpstring(\"" << GetHelpText().GetBuffer() << "\")," << endl;
+ }
+ if( GetHelpContext().IsSet() )
+ {
+ WriteTab( rOutStm, nTab );
+ rOutStm << "helpcontext("
+ << ByteString( GetHelpContext().GetValue() ).GetBuffer()
+ << ")," << endl;
+ }
+}
+
+/*************************************************************************
+|* SvMetaName::WriteContext()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaName::WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab,
+ WriteType nT, WriteAttribute nA )
+{
+}
+#endif // IDL_COMPILER
+
+/****************** SvMetaReference *****************************************/
+SV_IMPL_META_FACTORY1( SvMetaReference, SvMetaName );
+#ifdef IDL_COMPILER
+SvAttributeList & SvMetaReference::GetAttributeList()
+{
+ if( !pAttribList )
+ {
+ pAttribList = new SvAttributeList();
+ }
+ return *pAttribList;
+}
+#endif
+
+/*************************************************************************
+|* SvMetaReference::SvMetaReference()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaReference::SvMetaReference()
+{
+}
+
+void SvMetaReference::Load( SvPersistStream & rStm )
+{
+ SvMetaName::Load( rStm );
+
+ BYTE nMask;
+ rStm >> nMask;
+ if( nMask >= 0x2 )
+ {
+ rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ DBG_ERROR( "wrong format" )
+ return;
+ }
+ if( nMask & 0x01 )
+ {
+ SvMetaReference * pRef;
+ rStm >> pRef;
+ aRef = pRef;
+ }
+}
+
+void SvMetaReference::Save( SvPersistStream & rStm )
+{
+ SvMetaName::Save( rStm );
+
+ // Maske erstellen
+ BYTE nMask = 0;
+ if( aRef.Is() )
+ nMask |= 0x01;
+
+ // Daten schreiben
+ rStm << nMask;
+ if( nMask & 0x01 ) rStm << aRef;
+}
+
+/**************************************************************************/
+/****************** SvMetaExtern ******************************************/
+SV_IMPL_META_FACTORY1( SvMetaExtern, SvMetaReference );
+#ifdef IDL_COMPILER
+SvAttributeList & SvMetaExtern::GetAttributeList()
+{
+ if( !pAttribList )
+ {
+ pAttribList = new SvAttributeList();
+ }
+ return *pAttribList;
+}
+#endif
+
+/*************************************************************************
+|* SvMetaExtern::SvMetaExtern()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaExtern::SvMetaExtern()
+ : pModule( NULL )
+ , bReadUUId( FALSE )
+ , bReadVersion( FALSE )
+{
+}
+
+void SvMetaExtern::Load( SvPersistStream & rStm )
+{
+ SvMetaReference::Load( rStm );
+
+ BYTE nMask;
+ rStm >> nMask;
+ if( nMask >= 0x20 )
+ {
+ rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ DBG_ERROR( "wrong format" )
+ return;
+ }
+ if( nMask & 0x01 ) rStm >> pModule;
+ if( nMask & 0x02 ) rStm >> aUUId;
+ if( nMask & 0x04 ) rStm >> aVersion;
+ if( nMask & 0x08 ) bReadUUId = TRUE;
+ if( nMask & 0x10 ) bReadVersion = TRUE;
+}
+
+void SvMetaExtern::Save( SvPersistStream & rStm )
+{
+ SvMetaReference::Save( rStm );
+
+ // Maske erstellen
+ BYTE nMask = 0;
+ if( pModule ) nMask |= 0x01;
+ if( aUUId != SvGlobalName() ) nMask |= 0x02;
+ if( aVersion != SvVersion() ) nMask |= 0x04;
+ if( bReadUUId ) nMask |= 0x08;
+ if( bReadVersion ) nMask |= 0x10;
+
+ // Daten schreiben
+ rStm << nMask;
+ if( nMask & 0x01 ) rStm << pModule;
+ if( nMask & 0x02 ) rStm << aUUId;
+ if( nMask & 0x04 ) rStm << aVersion;
+}
+
+/*************************************************************************
+|* SvMetaExtern::GetModule()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaModule * SvMetaExtern::GetModule() const
+{
+ DBG_ASSERT( pModule != NULL, "module not set" )
+ return pModule;
+}
+
+/*************************************************************************
+|* SvMetaExtern::GetUUId()
+|*
+|* Beschreibung
+*************************************************************************/
+const SvGlobalName & SvMetaExtern::GetUUId() const
+{
+#ifdef IDL_COMPILER
+ if( aUUId == SvGlobalName() )
+ GetModule()->FillNextName( &((SvMetaExtern *)this)->aUUId );
+#endif
+ return aUUId;
+}
+
+#ifdef IDL_COMPILER
+/*************************************************************************
+|* SvMetaExtern::SetModule()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaExtern::SetModule( SvIdlDataBase & rBase )
+{
+ pModule = (SvMetaModule *)rBase.GetStack().Get( TYPE( SvMetaModule ) );
+}
+
+/*************************************************************************
+|* SvMetaExtern::ReadAttributesSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaExtern::ReadAttributesSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ SvMetaReference::ReadAttributesSvIdl( rBase, rInStm );
+ if( aUUId.ReadSvIdl( rBase, rInStm ) )
+ bReadUUId = TRUE;
+ if( aVersion.ReadSvIdl( rInStm ) )
+ bReadVersion = TRUE;
+}
+
+/*************************************************************************
+|* SvMetaExtern::WriteAttributesSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaExtern::WriteAttributesSvIdl( SvIdlDataBase & rBase,
+ SvStream & rOutStm, USHORT nTab )
+{
+ SvMetaReference::WriteAttributesSvIdl( rBase, rOutStm, nTab );
+ if( bReadUUId || bReadVersion )
+ {
+ WriteTab( rOutStm, nTab );
+ rOutStm << "// class SvMetaExtern" << endl;
+
+ if( bReadUUId )
+ {
+ WriteTab( rOutStm, nTab );
+ aUUId.WriteSvIdl( rOutStm );
+ rOutStm << ';' << endl;
+ }
+ if( bReadVersion )
+ {
+ WriteTab( rOutStm, nTab );
+ aVersion.WriteSvIdl( rOutStm );
+ rOutStm << ';' << endl;
+ }
+ }
+}
+
+/*************************************************************************
+|* SvMetaExtern::ReadSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaExtern::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
+{
+ SetModule( rBase );
+ GetUUId(); // Id wird angelegt
+ return SvMetaReference::ReadSvIdl( rBase, rInStm );
+}
+
+/*************************************************************************
+|* SvMetaExtern::WriteSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaExtern::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab )
+{
+ SvMetaReference::WriteSvIdl( rBase, rOutStm, nTab );
+}
+
+/*************************************************************************
+|* SvMetaExtern::Write()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaExtern::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ SvMetaReference::Write( rBase, rOutStm, nTab, nT, nA );
+}
+
+/*************************************************************************
+|* SvMetaExtern::WriteAttributes()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaExtern::WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ SvMetaReference::WriteAttributes( rBase, rOutStm, nTab, nT, nA );
+
+ WriteTab( rOutStm, nTab );
+ rOutStm << "// class SvMetaExtern" << endl;
+ WriteTab( rOutStm, nTab );
+ rOutStm << "uuid(" << ByteString( GetUUId().GetHexName(), RTL_TEXTENCODING_UTF8 ).GetBuffer() << ")," << endl;
+ WriteTab( rOutStm, nTab );
+ rOutStm << "version(" << ByteString::CreateFromInt32( aVersion.GetMajorVersion() ).GetBuffer() << '.'
+ << ByteString::CreateFromInt32( aVersion.GetMinorVersion() ).GetBuffer() << ")," << endl;
+}
+
+#endif // IDL_COMPILER
+
+
diff --git a/idl/source/objects/bastype.cxx b/idl/source/objects/bastype.cxx
new file mode 100644
index 000000000000..9bdc05520cc3
--- /dev/null
+++ b/idl/source/objects/bastype.cxx
@@ -0,0 +1,1045 @@
+/*************************************************************************
+ *
+ * $RCSfile: bastype.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <tools/debug.hxx>
+
+#include <limits.h>
+#include <ctype.h>
+#include <bastype.hxx>
+#include <lex.hxx>
+#include <globals.hxx>
+#include <hash.hxx>
+#include <database.hxx>
+#pragma hdrstop
+
+/************************************************************************/
+ByteString MakeDefineName( const ByteString & rName )
+{
+ ByteString aDefName;
+ if( rName.Len() )
+ {
+ char * pStr = (char *)rName.GetBuffer();
+ aDefName = *pStr;
+ while( *++pStr )
+ {
+ if( isupper( *pStr ) )
+ aDefName += '_';
+ aDefName += (char)toupper( *pStr );
+ }
+ }
+ return aDefName;
+}
+
+#ifdef IDL_COMPILER
+/************************************************************************/
+static BOOL ReadRangeSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm,
+ long nMin, ULONG nMax, long * pValue )
+{
+ UINT32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+
+ if( pTok->Is( pName ) )
+ {
+ BOOL bOk = TRUE;
+ BOOL bBraket = rInStm.Read( '(' );
+ if( bBraket || rInStm.Read( '=' ) )
+ {
+ short nSign = 1;
+ pTok = rInStm.GetToken_Next();
+ if( pTok->IsChar() && pTok->GetChar() == '-' )
+ {
+ nSign = -1;
+ pTok = rInStm.GetToken_Next();
+ }
+ else if( pTok->IsChar() && pTok->GetChar() == '+' )
+ pTok = rInStm.GetToken_Next();
+
+ if( pTok->IsInteger() )
+ {
+ ULONG n = pTok->GetNumber();
+ if( nSign == -1 || n <= nMax )
+ { // nich tueber dem Maximum
+ if( (nSign == -1 && n < 0x8000000
+ && -(long)n >= nMin)
+ || (nSign == 1 && n >= 0x8000000 || (long)n > nMin) )
+ {
+ *pValue = (long)n;
+ }
+ else
+ bOk = FALSE;
+ }
+ if( bOk && bBraket )
+ bOk = rInStm.Read( ')' );
+ }
+ else
+ bOk = pTok->IsChar() && pTok->GetChar() == ')';
+ }
+ if( bOk )
+ return TRUE;
+ }
+ rInStm.Seek( nTokPos );
+ return FALSE;
+}
+#endif
+
+/************************************************************************/
+/*************************************************************************
+|*
+|* RangeUniqueIdContainer::RangeUniqueIdContainer()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+RangeUniqueIdContainer::RangeUniqueIdContainer( const Range & rRange )
+ : UniqueIdContainer( rRange.Min() ),
+ nMax( rRange.Max() ), nMin( rRange.Min() )
+{
+}
+
+/*************************************************************************
+|*
+|* RangeUniqueIdContainer::RangeUniqueIdContainer()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+RangeUniqueIdContainer::RangeUniqueIdContainer()
+ : UniqueIdContainer( 0 ),
+ nMax( 0 ), nMin( 0 )
+{
+}
+
+RangeUniqueIdContainer::~RangeUniqueIdContainer()
+{
+}
+
+/*************************************************************************
+|*
+|* RangeUniqueIdContainer:: opearator =()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+RangeUniqueIdContainer & RangeUniqueIdContainer::operator =
+ ( const RangeUniqueIdContainer & rObj )
+{
+ UniqueIdContainer::operator = ( rObj );
+ nMin = rObj.nMin;
+ nMax = rObj.nMax;
+ return *this;
+}
+
+/*************************************************************************
+|*
+|* RangeUniqueIdContainer::CreateId()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL RangeUniqueIdContainer::CreateId( UniqueItemId * pId )
+{
+ {
+ // wegen Scope von aId
+ UniqueItemId aId = UniqueIdContainer::CreateId();
+ if( aId.GetId() <= nMax )
+ {
+ *pId = aId;
+ return TRUE;
+ }
+ }
+ Clear( FALSE ); // nicht gebrauchte freigeben
+ // noch einmal versuchen
+ {
+ // wegen Scope von aId
+ UniqueItemId aId = UniqueIdContainer::CreateId();
+ if( aId.GetId() <= nMax )
+ {
+ *pId = aId;
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* RangeUniqueIdContainer::CreateId()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL RangeUniqueIdContainer::CreateId( UINT32 nIdValue, UniqueItemId * pId )
+{
+ if( nIdValue >= nMin && nIdValue <= nMax )
+ {
+ if( IsIndexValid( nIdValue ) )
+ return FALSE;
+ *pId = CreateIdProt( nIdValue );
+ return TRUE;
+ }
+ *pId = UniqueIdContainer::CreateFreeId( nIdValue );
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* SvUINT32::Read()
+|* SvUINT32::Write()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+UINT32 SvUINT32::Read( SvStream & rStm )
+{
+ return SvPersistStream::ReadCompressed( rStm );
+}
+
+void SvUINT32::Write( SvStream & rStm, UINT32 nVal )
+{
+ SvPersistStream::WriteCompressed( rStm, nVal );
+}
+
+/*************************************************************************
+|*
+|* SvStream& operator << ( SvBOOL )
+|* SvStream& operator >> ( SvBOOL )
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+SvStream& operator << (SvStream & rStm, const SvBOOL & rb )
+{
+ BYTE n = rb.nVal;
+ if( rb.bSet )
+ n |= 0x02;
+ rStm << n;
+ return rStm;
+}
+SvStream& operator >> (SvStream & rStm, SvBOOL & rb )
+{
+ BYTE n;
+ rStm >> n;
+ rb.nVal = (n & 0x01) ? TRUE : FALSE;
+ rb.bSet = (n & 0x02) ? TRUE : FALSE;
+ if( n & ~0x03 )
+ {
+ rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ DBG_ERROR( "format error" )
+ }
+ return rStm;
+}
+
+/*************************************************************************
+|*
+|* SvStream& operator << ( SvVersion )
+|* SvStream& operator >> ( SvVersion )
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+SvStream& operator << (SvStream & rStm, const SvVersion & r )
+{
+ if( (r.GetMajorVersion() || r.GetMinorVersion())
+ && r.GetMajorVersion() <= 0x0F && r.GetMinorVersion() <= 0x0F )
+ { // Versionsnummer in 1 Byte komprimieren
+ // Format 4 Bit fuer Major, dann 4 Bit fuer Minor.
+ // 0.0 wird nicht komprimiert
+
+ BYTE n = r.GetMajorVersion() << 4;
+ n |= r.GetMinorVersion();
+ rStm << n;
+ }
+ else
+ {
+ rStm << (BYTE)0;
+ rStm << r.GetMajorVersion();
+ rStm << r.GetMinorVersion();
+ }
+ return rStm;
+}
+
+SvStream& operator >> (SvStream & rStm, SvVersion & r )
+{
+ BYTE n;
+ rStm >> n;
+ if( n == 0 )
+ { // nicht komprimiert
+ rStm >> r.nMajorVersion;
+ rStm >> r.nMinorVersion;
+ }
+ else
+ { // komprimiert
+ r.nMajorVersion = (n >> 4) & 0x0F;
+ r.nMinorVersion = n & 0x0F;
+ }
+ return rStm;
+}
+
+
+#ifdef IDL_COMPILER
+/************************************************************************/
+/*************************************************************************
+|*
+|* SvINT16::ReadSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL SvINT16::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm )
+{
+ long n;
+
+ if( ReadRangeSvIdl( pName, rInStm, -(long)0x8000, 0x7FFF, &n ) )
+ {
+ nVal = (short)n;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* SvINT16::WriteSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL SvINT16::WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm )
+{
+ rOutStm << pName->GetName().GetBuffer() << "(\""
+ << ByteString::CreateFromInt32( nVal ).GetBuffer() << "\")";
+ return TRUE;
+}
+
+
+/*************************************************************************
+|*
+|* SvUINT16::ReadSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL SvUINT16::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm )
+{
+ long n;
+
+ if( ReadRangeSvIdl( pName, rInStm, 0, 0xFFFF, &n ) )
+ {
+ nVal = (UINT16)n;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* SvUINT16::WriteSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL SvUINT16::WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm )
+{
+ rOutStm << pName->GetName().GetBuffer() << "(\""
+ << ByteString::CreateFromInt32( nVal ).GetBuffer() << "\")";
+ return TRUE;
+}
+
+
+/*************************************************************************
+|*
+|* SvINT32::ReadSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL SvINT32::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm )
+{
+ long n;
+
+ if( ReadRangeSvIdl( pName, rInStm, (-2147483647L-1L), 0x7FFFFFFF, &n ) )
+ {
+ nVal = (INT32)n;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* SvINT32::WriteSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL SvINT32::WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm )
+{
+ rOutStm << pName->GetName().GetBuffer() << "(\""
+ << ByteString::CreateFromInt32( nVal ).GetBuffer() << "\")";
+ return TRUE;
+}
+
+
+/*************************************************************************
+|*
+|* SvUINT32::ReadSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL SvUINT32::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm )
+{
+ long n;
+
+ if( ReadRangeSvIdl( pName, rInStm, 0, 0xFFFFFFFF, &n ) )
+ {
+ nVal = (UINT32)n;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* SvUINT32::WriteSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL SvUINT32::WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm )
+{
+ rOutStm << pName->GetName().GetBuffer() << "(\""
+ << ByteString::CreateFromInt32( nVal ).GetBuffer() << "\")";
+ return TRUE;
+}
+
+
+/************************************************************************/
+/*************************************************************************
+|*
+|* Svint::ReadSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL Svint::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm )
+{
+ long n;
+
+ if( ReadRangeSvIdl( pName, rInStm, INT_MIN, INT_MAX, &n ) )
+ {
+ nVal = (int)n;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* Svint::WriteSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL Svint::WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm )
+{
+ rOutStm << pName->GetName().GetBuffer() << "(\""
+ << ByteString::CreateFromInt32( nVal ).GetBuffer() << "\")";
+ return TRUE;
+}
+
+
+/*************************************************************************
+|*
+|* SvBOOL::ReadSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL SvBOOL::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm )
+{
+ UINT32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+
+ if( pTok->Is( pName ) )
+ {
+ BOOL bOk = TRUE;
+ BOOL bBraket = rInStm.Read( '(' );
+ if( bBraket || rInStm.Read( '=' ) )
+ {
+ pTok = rInStm.GetToken();
+ if( pTok->IsBool() )
+ {
+ *this = pTok->GetBool();
+
+ rInStm.GetToken_Next();
+ }
+ if( bOk && bBraket )
+ bOk = rInStm.Read( ')' );
+ }
+ else
+ *this = TRUE; //Defaultaktion ist auf TRUE setzen
+ if( bOk )
+ return TRUE;
+ }
+ rInStm.Seek( nTokPos );
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* SvBOOL::WriteSvIdl()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+BOOL SvBOOL::WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm )
+{
+ if( nVal )
+ rOutStm << pName->GetName().GetBuffer();
+ else
+ rOutStm << pName->GetName().GetBuffer() << "(FALSE)";
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* SvBOOL::WriteSvIdl()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+ByteString SvBOOL::GetSvIdlString( SvStringHashEntry * pName )
+{
+ if( nVal )
+ return pName->GetName();
+ else
+ {
+ ByteString aTmp( pName->GetName() );
+ aTmp += "(FALSE)";
+ return aTmp;
+ }
+}
+
+
+/************************************************************************/
+/*************************************************************************
+|*
+|* SvIdentifier::ReadSvIdl()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+BOOL SvIdentifier::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm )
+{
+ UINT32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+
+ if( pTok->Is( pName ) )
+ {
+ BOOL bOk = TRUE;
+ BOOL bBraket = rInStm.Read( '(' );
+ if( bBraket || rInStm.Read( '=' ) )
+ {
+ pTok = rInStm.GetToken();
+ if( pTok->IsIdentifier() )
+ {
+ *(ByteString *)this = pTok->GetString();
+ rInStm.GetToken_Next();
+ }
+ if( bOk && bBraket )
+ bOk = rInStm.Read( ')' );
+ }
+ if( bOk )
+ return TRUE;
+ }
+ rInStm.Seek( nTokPos );
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* SvIdentifier::WriteSvIdl()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+BOOL SvIdentifier::WriteSvIdl( SvStringHashEntry * pName,
+ SvStream & rOutStm,
+ USHORT /*nTab */ )
+{
+ rOutStm << pName->GetName().GetBuffer() << '(';
+ rOutStm << GetBuffer() << ')';
+ return TRUE;
+}
+
+SvStream& operator << (SvStream & rStm, const SvIdentifier & r )
+{
+ rStm.WriteByteString( r );
+ return rStm;
+}
+
+SvStream& operator >> (SvStream & rStm, SvIdentifier & r )
+{
+ rStm.ReadByteString( r );
+ return rStm;
+}
+
+
+/************************************************************************/
+/*************************************************************************
+|*
+|* SvNumberIdentifier::ReadSvIdl()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+BOOL SvNumberIdentifier::ReadSvIdl( SvIdlDataBase & rBase,
+ SvStringHashEntry * pName,
+ SvTokenStream & rInStm )
+{
+ if( SvIdentifier::ReadSvIdl( pName, rInStm ) )
+ {
+ ULONG n;
+ if( rBase.FindId( *this, &n ) )
+ {
+ nValue = n;
+ return TRUE;
+ }
+ else
+ {
+ ByteString aStr ("no value for identifier <");
+ aStr += *this;
+ aStr += "> ";
+ rBase.SetError( aStr, rInStm.GetToken() );
+ rBase.WriteError( rInStm );
+ }
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* SvNumberIdentifier::ReadSvIdl()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+BOOL SvNumberIdentifier::ReadSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ UINT32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+
+ if( pTok->IsIdentifier() )
+ {
+ ULONG n;
+ if( rBase.FindId( pTok->GetString(), &n ) )
+ {
+ *(ByteString *)this = pTok->GetString();
+ nValue = n;
+ return TRUE;
+ }
+ else
+ {
+ ByteString aStr ("no value for identifier <");
+ aStr += *this;
+ aStr += "> ";
+ rBase.SetError( aStr, rInStm.GetToken() );
+ rBase.WriteError( rInStm );
+ }
+ }
+ rInStm.Seek( nTokPos );
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* SvStream& operator << ( SvNumberIdentifier )
+|* SvStream& operator >> ( SvNumberIdentifier )
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+SvStream& operator << (SvStream & rStm, const SvNumberIdentifier & r )
+{
+ rStm << (SvIdentifier &)r;
+ SvPersistStream::WriteCompressed( rStm, r.nValue );
+ return rStm;
+}
+
+SvStream& operator >> (SvStream & rStm, SvNumberIdentifier & r )
+{
+ rStm >> (SvIdentifier &)r;
+ r.nValue = SvPersistStream::ReadCompressed( rStm );
+ return rStm;
+}
+
+
+/************************************************************************/
+/*************************************************************************
+|*
+|* SvString::ReadSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL SvString::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm )
+{
+ UINT32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+
+ if( pTok->Is( pName ) )
+ {
+ BOOL bOk = TRUE;
+ BOOL bBraket = rInStm.Read( '(' );
+ if( bBraket || rInStm.Read( '=' ) )
+ {
+ pTok = rInStm.GetToken();
+ if( pTok->IsString() )
+ {
+ *(ByteString *)this = pTok->GetString();
+ rInStm.GetToken_Next();
+ }
+ if( bOk && bBraket )
+ bOk = rInStm.Read( ')' );
+ }
+ if( bOk )
+ return TRUE;
+ }
+ rInStm.Seek( nTokPos );
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* SvString::WriteSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL SvString::WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm,
+ USHORT /*nTab */ )
+{
+ rOutStm << pName->GetName().GetBuffer() << "(\"";
+ rOutStm << GetBuffer() << "\")";
+ return TRUE;
+}
+
+SvStream& operator << (SvStream & rStm, const SvString & r )
+{
+ rStm.WriteByteString( r );
+ return rStm;
+}
+
+SvStream& operator >> (SvStream & rStm, SvString & r )
+{
+ rStm.ReadByteString( r );
+ return rStm;
+}
+
+
+/*************************************************************************
+|*
+|* SvHelpText::ReadSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL SvHelpText::ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm )
+{
+ return SvString::ReadSvIdl( SvHash_HelpText(), rInStm );
+}
+
+/*************************************************************************
+|*
+|* SvHelpText::WriteSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL SvHelpText::WriteSvIdl( SvIdlDataBase &, SvStream & rOutStm, USHORT nTab )
+{
+ return SvString::WriteSvIdl( SvHash_HelpText(), rOutStm, nTab );
+}
+
+#ifdef sdvnmsd
+/*************************************************************************
+|*
+|* SvHelpContext::ReadSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL SvHelpContext::ReadSvIdl( RangeUniqueIdContainer & rCont,
+ SvTokenStream & rInStm )
+{
+ UINT32 nTokPos = rInStm.Tell();
+ long n = 0;
+
+ if( ReadRangeSvIdl( SvHash_HelpContext(), rInStm, 0, 0xFFFFFFFF, &n ) )
+ {
+ if( n == 0 )
+ {
+ //if( rCont.CreateId( &aId ) )
+ // erst beim Schreiben anlegen
+ bSet = TRUE;
+ return TRUE;
+ }
+ else
+ {
+ if( (UINT32)n <= rCont.GetMax() && (UINT32)n >= rCont.GetMin() )
+ {
+ aId = UniqueIdContainer::CreateFreeId( (UINT32)n );
+ bSet = TRUE;
+ return TRUE;
+ }
+ else if( rCont.CreateId( (UINT32)n, &aId ) )
+ {
+ bSet = TRUE;
+ return TRUE;
+ }
+ }
+ }
+
+ rInStm.Seek( nTokPos );
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* SvHelpContext::WriteSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL SvHelpContext::WriteSvIdl( RangeUniqueIdContainer & rCont,
+ SvStream & rOutStm, USHORT )
+{
+ if( IsSet() && GetId() == 0 )
+ if( !rCont.CreateId( &aId ) )
+ return FALSE;
+ rOutStm << (const char *)SvHash_HelpContext()->GetName() << '('
+ << (const char *)ByteString( GetId() ) << ')';
+ return TRUE;
+}
+#endif
+
+/************************************************************************/
+/*************************************************************************
+|*
+|* SvUUId::ReadSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL SvUUId::ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm )
+{
+ UINT32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+
+ if( pTok->Is( SvHash_uuid() ) )
+ {
+ BOOL bOk = TRUE;
+ BOOL bBraket = rInStm.Read( '(' );
+ if( bBraket || rInStm.Read( '=' ) )
+ {
+ pTok = rInStm.GetToken();
+ if( pTok->IsString() )
+ {
+ pTok = rInStm.GetToken_Next();
+ bOk = MakeId( String::CreateFromAscii( pTok->GetString().GetBuffer() ) );
+ }
+ if( bOk && bBraket )
+ bOk = rInStm.Read( ')' );
+ }
+ if( bOk )
+ return TRUE;
+ }
+ rInStm.Seek( nTokPos );
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* SvMetaObject::WriteSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL SvUUId::WriteSvIdl( SvStream & rOutStm )
+{
+ // Global Id schreiben
+ rOutStm << SvHash_uuid()->GetName().GetBuffer() << "(\"";
+ rOutStm << ByteString( GetHexName(), RTL_TEXTENCODING_UTF8 ).GetBuffer() << "\")";
+ return TRUE;
+}
+
+
+/************************************************************************/
+/*************************************************************************
+|*
+|* SvVersion::ReadSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL SvVersion::ReadSvIdl( SvTokenStream & rInStm )
+{
+ long n;
+
+ UINT32 nTokPos = rInStm.Tell();
+ if( ReadRangeSvIdl( SvHash_Version(), rInStm, 0 , 0xFFFF, &n ) )
+ {
+ nMajorVersion = (USHORT)n;
+ if( rInStm.Read( '.' ) )
+ {
+ SvToken * pTok = rInStm.GetToken_Next();
+ if( pTok->IsInteger() && pTok->GetNumber() <= 0xFFFF )
+ {
+ nMinorVersion = (USHORT)pTok->GetNumber();
+ return TRUE;
+ }
+ }
+ else
+ return TRUE;
+ }
+ rInStm.Seek( nTokPos );
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* SvVersion::WriteSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL SvVersion::WriteSvIdl( SvStream & rOutStm )
+{
+ rOutStm << SvHash_Version()->GetName().GetBuffer() << '('
+ << ByteString::CreateFromInt32( nMajorVersion ).GetBuffer() << '.'
+ << ByteString::CreateFromInt32( nMinorVersion ).GetBuffer() << ')';
+ return TRUE;
+}
+#endif //IDL_COMPILER
+
+
diff --git a/idl/source/objects/makefile.mk b/idl/source/objects/makefile.mk
new file mode 100644
index 000000000000..8c57d435177b
--- /dev/null
+++ b/idl/source/objects/makefile.mk
@@ -0,0 +1,103 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:30:41 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PROJECTPCH4DLL=TRUE
+PROJECTPCH=idlpch
+PROJECTPCHSOURCE=$(PRJ)$/util$/idlpch
+
+PRJNAME=SVIDL
+TARGET=objects
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+.IF "$(COM)"=="WTC"
+CFLAGS+=-od
+.ENDIF
+
+CDEFS+=-DIDL_COMPILER
+# --- Files --------------------------------------------------------------
+
+CXXFILES= bastype.cxx \
+ basobj.cxx \
+ types.cxx \
+ object.cxx \
+ slot.cxx \
+ module.cxx \
+ $(PROJECTPCHSOURCE).cxx
+
+OBJFILES= $(OBJ)$/bastype.obj \
+ $(OBJ)$/basobj.obj \
+ $(OBJ)$/types.obj \
+ $(OBJ)$/object.obj \
+ $(OBJ)$/slot.obj \
+ $(OBJ)$/module.obj
+
+# --- Targets ------------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/idl/source/objects/module.cxx b/idl/source/objects/module.cxx
new file mode 100644
index 000000000000..d795f5cacb72
--- /dev/null
+++ b/idl/source/objects/module.cxx
@@ -0,0 +1,732 @@
+/*************************************************************************
+ *
+ * $RCSfile: module.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <ctype.h>
+#include <stdio.h>
+
+#include <attrib.hxx>
+#include <module.hxx>
+#include <globals.hxx>
+#include <database.hxx>
+
+#ifndef _FSYS_HXX //autogen
+#include <tools/fsys.hxx>
+#endif
+#include <tools/debug.hxx>
+
+#pragma hdrstop
+
+
+/****************** SvMetaModule ******************************************/
+SV_IMPL_META_FACTORY1( SvMetaModule, SvMetaExtern );
+#ifdef IDL_COMPILER
+SvAttributeList & SvMetaModule::GetAttributeList()
+{
+ if( !pAttribList )
+ {
+ pAttribList = new SvAttributeList();
+ }
+ return *pAttribList;
+}
+#endif
+
+/*************************************************************************
+|*
+|* SvMetaModule::SvMetaModule()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+SvMetaModule::SvMetaModule()
+#ifdef IDL_COMPILER
+ : bImported( FALSE )
+ , bIsModified( FALSE )
+#endif
+{
+}
+
+#ifdef IDL_COMPILER
+SvMetaModule::SvMetaModule( const String & rIdlFileName, BOOL bImp )
+ : aIdlFileName( rIdlFileName )
+ , bImported( bImp ), bIsModified( FALSE )
+{
+}
+#endif
+
+/*************************************************************************
+|*
+|* SvMetaModule::Load()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+#define MODULE_VER 0x0001
+void SvMetaModule::Load( SvPersistStream & rStm )
+{
+ bImported = TRUE; // immer importiert
+ SvMetaExtern::Load( rStm );
+
+ USHORT nVer;
+
+ rStm >> nVer; // Version
+ DBG_ASSERT( (nVer & ~IDL_WRITE_MASK) == MODULE_VER, "false version" )
+
+ rStm >> aClassList;
+ rStm >> aTypeList;
+ rStm >> aAttrList;
+ // Browser
+ rStm.ReadByteString( aIdlFileName );
+ rStm.ReadByteString( aHelpFileName );
+ rStm.ReadByteString( aSlotIdFile );
+ rStm.ReadByteString( aModulePrefix );
+
+ // Compiler Daten lesen
+ USHORT nCmpLen;
+ rStm >> nCmpLen;
+#ifdef IDL_COMPILER
+ DBG_ASSERT( (nVer & IDL_WRITE_MASK) == IDL_WRITE_COMPILER,
+ "no idl compiler format" )
+ rStm >> aBeginName;
+ rStm >> aEndName;
+ rStm >> aNextName;
+#else
+ rStm->SeekRel( nCmpLen );
+#endif
+}
+
+/*************************************************************************
+|*
+|* SvMetaModule::Save()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+void SvMetaModule::Save( SvPersistStream & rStm )
+{
+ SvMetaExtern::Save( rStm );
+
+ rStm << (USHORT)(MODULE_VER | IDL_WRITE_COMPILER); // Version
+
+ rStm << aClassList;
+ rStm << aTypeList;
+ rStm << aAttrList;
+ // Browser
+ rStm.WriteByteString( aIdlFileName );
+ rStm.WriteByteString( aHelpFileName );
+ rStm.WriteByteString( aSlotIdFile );
+ rStm.WriteByteString( aModulePrefix );
+
+ // Compiler Daten schreiben
+ USHORT nCmpLen = 0;
+ ULONG nLenPos = rStm.Tell();
+ rStm << nCmpLen;
+#ifdef IDL_COMPILER
+ rStm << aBeginName;
+ rStm << aEndName;
+ rStm << aNextName;
+ // Laenge der Compiler Daten schreiben
+ ULONG nPos = rStm.Tell();
+ rStm.Seek( nLenPos );
+ rStm << (USHORT)( nPos - nLenPos - sizeof( USHORT ) );
+ rStm.Seek( nPos );
+#endif
+}
+
+/*************************************************************************
+|*
+|* SvMetaModule::SetName()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+BOOL SvMetaModule::SetName( const ByteString & rName, SvIdlDataBase * pBase )
+{
+ if( pBase )
+ {
+ if( pBase->GetModule( rName ) )
+ return FALSE;
+ }
+ return SvMetaExtern::SetName( rName );
+}
+
+#ifdef IDL_COMPILER
+/*************************************************************************
+|* SvMetaModule::GetNextName()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaModule::FillNextName( SvGlobalName * pName )
+{
+ *pName = aNextName;
+
+ if( aNextName < aEndName )
+ {
+ ++aNextName;
+ bIsModified = TRUE;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|* SvMetaModule::ReadSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaModule::ReadAttributesSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ SvMetaExtern::ReadAttributesSvIdl( rBase, rInStm );
+
+ aHelpFileName.ReadSvIdl( SvHash_HelpFile(), rInStm );
+ if( aSlotIdFile.ReadSvIdl( SvHash_SlotIdFile(), rInStm ) )
+ {
+ UINT32 nTokPos = rInStm.Tell();
+ if( !rBase.ReadIdFile( String::CreateFromAscii( aSlotIdFile.GetBuffer() ) ) )
+ {
+ ByteString aStr = "cannot read file: ";
+ aStr += aSlotIdFile;
+ rBase.SetError( aStr, rInStm.GetToken() );
+ rBase.WriteError( rInStm );
+
+ rInStm.Seek( nTokPos );
+ }
+ }
+ aTypeLibFile.ReadSvIdl( SvHash_TypeLibFile(), rInStm );
+ aModulePrefix.ReadSvIdl( SvHash_ModulePrefix(), rInStm );
+}
+
+/*************************************************************************
+|* SvMetaModule::WriteAttributesSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaModule::WriteAttributesSvIdl( SvIdlDataBase & rBase,
+ SvStream & rOutStm,
+ USHORT nTab )
+{
+ SvMetaExtern::WriteAttributesSvIdl( rBase, rOutStm, nTab );
+ if( aTypeLibFile.Len() || aSlotIdFile.Len() || aTypeLibFile.Len() )
+ {
+ if( aHelpFileName.Len() )
+ {
+ WriteTab( rOutStm, nTab );
+ aHelpFileName.WriteSvIdl( SvHash_HelpFile(), rOutStm, nTab +1 );
+ rOutStm << ';' << endl;
+ }
+ if( aSlotIdFile.Len() )
+ {
+ WriteTab( rOutStm, nTab );
+ aSlotIdFile.WriteSvIdl( SvHash_SlotIdFile(), rOutStm, nTab +1 );
+ rOutStm << ';' << endl;
+ }
+ if( aTypeLibFile.Len() )
+ {
+ WriteTab( rOutStm, nTab );
+ aTypeLibFile.WriteSvIdl( SvHash_TypeLibFile(), rOutStm, nTab +1 );
+ rOutStm << ';' << endl;
+ }
+ }
+}
+
+/*************************************************************************
+|* SvMetaModule::ReadContextSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaModule::ReadContextSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ UINT32 nTokPos = rInStm.Tell();
+ if( rInStm.GetToken()->Is( SvHash_interface() )
+ || rInStm.GetToken()->Is( SvHash_shell() ) )
+ {
+ SvMetaClassRef aClass = new SvMetaClass();
+ if( aClass->ReadSvIdl( rBase, rInStm ) )
+ {
+ aClassList.Append( aClass );
+ // Global bekanntgeben
+ rBase.GetClassList().Append( aClass );
+ }
+ }
+ else if( rInStm.GetToken()->Is( SvHash_enum() ) )
+ {
+ SvMetaTypeEnumRef aEnum = new SvMetaTypeEnum();
+
+ if( aEnum->ReadSvIdl( rBase, rInStm ) )
+ {
+ // Im Modul deklariert
+ aTypeList.Append( aEnum );
+ // Global bekanntgeben
+ rBase.GetTypeList().Append( aEnum );
+ }
+ }
+ else if( rInStm.GetToken()->Is( SvHash_item() )
+ || rInStm.GetToken()->Is( SvHash_struct() )
+ || rInStm.GetToken()->Is( SvHash_typedef() ) )
+ {
+ SvMetaTypeRef xItem = new SvMetaType();
+
+ if( xItem->ReadSvIdl( rBase, rInStm ) )
+ {
+ // Im Modul deklariert
+ aTypeList.Append( xItem );
+ // Global bekanntgeben
+ rBase.GetTypeList().Append( xItem );
+ }
+ }
+ else if( rInStm.GetToken()->Is( SvHash_include() ) )
+ {
+ BOOL bOk = FALSE;
+ rInStm.GetToken_Next();
+ SvToken * pTok = rInStm.GetToken_Next();
+ if( pTok->IsString() )
+ {
+ DirEntry aFullName( String::CreateFromAscii( pTok->GetString().GetBuffer() ) );
+ rBase.StartNewFile( aFullName.GetFull() );
+ if( aFullName.Find( rBase.GetPath() ) )
+ {
+ SvTokenStream aTokStm( aFullName.GetFull() );
+ if( SVSTREAM_OK == aTokStm.GetStream().GetError() )
+ {
+ // Fehler aus alter Datei retten
+ SvIdlError aOldErr = rBase.GetError();
+ // Fehler zuruecksetzen
+ rBase.SetError( SvIdlError() );
+
+ UINT32 nBeginPos = 0xFFFFFFFF; // kann mit Tell nicht vorkommen
+ while( nBeginPos != aTokStm.Tell() )
+ {
+ nBeginPos = aTokStm.Tell();
+ ReadContextSvIdl( rBase, aTokStm );
+ aTokStm.ReadDelemiter();
+ }
+ bOk = aTokStm.GetToken()->IsEof();
+ if( !bOk )
+ {
+ rBase.WriteError( aTokStm );
+ }
+ // Fehler aus alter Datei wieder herstellen
+ rBase.SetError( aOldErr );
+ }
+ else
+ {
+ ByteString aStr = "cannot open file: ";
+ aStr += ByteString( aFullName.GetFull(), RTL_TEXTENCODING_UTF8 );
+ rBase.SetError( aStr, pTok );
+ }
+ }
+ else
+ {
+ ByteString aStr = "cannot find file: ";
+ aStr += ByteString( aFullName.GetFull(), RTL_TEXTENCODING_UTF8 );
+ rBase.SetError( aStr, pTok );
+ }
+ }
+ if( !bOk )
+ rInStm.Seek( nTokPos );
+ }
+ else
+ {
+ SvMetaSlotRef xSlot = new SvMetaSlot();
+
+ if( xSlot->ReadSvIdl( rBase, rInStm ) )
+ {
+ if( xSlot->Test( rBase, rInStm ) )
+ {
+ // Im Modul deklariert
+ aAttrList.Append( xSlot );
+ // Global bekanntgeben
+ rBase.AppendAttr( xSlot );
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|* SvMetaModule::WriteContextSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaModule::WriteContextSvIdl( SvIdlDataBase & rBase,
+ SvStream & rOutStm,
+ USHORT nTab )
+{
+ SvMetaExtern::WriteContextSvIdl( rBase, rOutStm, nTab );
+ ULONG n;
+ for( n = 0; n < aTypeList.Count(); n++ )
+ {
+ WriteTab( rOutStm, nTab );
+ aTypeList.GetObject( n )->WriteSvIdl( rBase, rOutStm, nTab );
+ }
+ rOutStm << endl;
+ 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++ )
+ {
+ WriteTab( rOutStm, nTab );
+ aClassList.GetObject( n )->WriteSvIdl( rBase, rOutStm, nTab );
+ }
+}
+
+/*************************************************************************
+|*
+|* SvMetaModule::ReadSvIdl()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+BOOL SvMetaModule::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
+{
+ bIsModified = TRUE; // bisher immer wenn Compiler laueft
+
+ UINT32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+ BOOL bOk = FALSE;
+ bOk = pTok->Is( SvHash_module() );
+ if( bOk )
+ {
+ pTok = rInStm.GetToken_Next();
+ if( pTok->IsString() )
+ bOk = aBeginName.MakeId( String::CreateFromAscii( pTok->GetString().GetBuffer() ) );
+ }
+ rInStm.ReadDelemiter();
+ if( bOk )
+ {
+ pTok = rInStm.GetToken_Next();
+ if( pTok->IsString() )
+ bOk = aEndName.MakeId( String::CreateFromAscii( pTok->GetString().GetBuffer() ) );
+ }
+ rInStm.ReadDelemiter();
+ if( bOk )
+ {
+ aNextName = aBeginName;
+
+ rBase.Push( this ); // auf den Context Stack
+
+ if( ReadNameSvIdl( rBase, rInStm ) )
+ {
+ // Zeiger auf sich selbst setzen
+ SetModule( rBase );
+ bOk = SvMetaName::ReadSvIdl( rBase, rInStm );
+ }
+ rBase.GetStack().Pop(); // und runter
+ }
+ if( !bOk )
+ rInStm.Seek( nTokPos );
+ return bOk;
+}
+
+/*************************************************************************
+|*
+|* SvMetaModule::WriteSvIdl()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void SvMetaModule::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab )
+{
+ rOutStm << SvHash_module()->GetName().GetBuffer() << endl
+ << '\"';
+ rOutStm.WriteByteString( aBeginName.GetHexName() );
+ rOutStm << '\"' << endl << '\"';
+ rOutStm.WriteByteString( aEndName.GetHexName() );
+ rOutStm << '\"' << endl;
+ SvMetaExtern::WriteSvIdl( rBase, rOutStm, nTab );
+}
+
+/*************************************************************************
+|* SvMetaModule::WriteSfx()
+*************************************************************************/
+void SvMetaModule::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm )
+{
+ for( ULONG n = 0; n < aClassList.Count(); n++ )
+ {
+ SvMetaClass * pClass = aClassList.GetObject( n );
+ pClass->WriteSfx( rBase, rOutStm );
+ }
+}
+
+void SvMetaModule::WriteHelpIds( SvIdlDataBase & rBase, SvStream & rOutStm,
+ Table* pTable )
+{
+ for( ULONG n = 0; n < aClassList.Count(); n++ )
+ {
+ SvMetaClass * pClass = aClassList.GetObject( n );
+ pClass->WriteHelpIds( rBase, rOutStm, pTable );
+ }
+}
+
+/*************************************************************************
+|* SvMetaModule::WriteAttributes()
+*************************************************************************/
+void SvMetaModule::WriteAttributes( SvIdlDataBase & rBase,
+ SvStream & rOutStm,
+ USHORT nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ SvMetaExtern::WriteAttributes( rBase, rOutStm, nTab, nT, nA );
+ if( aHelpFileName.Len() )
+ {
+ WriteTab( rOutStm, nTab );
+ rOutStm << "// class SvMetaModule" << endl;
+ WriteTab( rOutStm, nTab );
+ rOutStm << "helpfile(\"" << aHelpFileName.GetBuffer() << "\");" << endl;
+ }
+}
+
+/*************************************************************************
+|* SvMetaModule::WriteSbx()
+*************************************************************************/
+/*
+void SvMetaModule::WriteSbx( SvIdlDataBase & rBase, SvStream & rOutStm,
+ SvNamePosList & rList )
+{
+ for( ULONG n = 0; n < aClassList.Count(); n++ )
+ {
+ SvMetaClass * pClass = aClassList.GetObject( n );
+ if( !pClass->IsShell() && pClass->GetAutomation() )
+ {
+ rList.Insert( new SvNamePos( pClass->GetUUId(), rOutStm.Tell() ),
+ LIST_APPEND );
+ SbxObjectRef xSbxObj = new SbxObject( pClass->GetName() );
+ pClass->FillSbxObject( rBase, xSbxObj );
+ xSbxObj->Store( rOutStm );
+ }
+ }
+}
+ */
+
+/*************************************************************************
+|* SvMetaModule::Write()
+*************************************************************************/
+void SvMetaModule::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ switch ( nT )
+ {
+ case WRITE_ODL:
+ {
+ if( aSlotIdFile.Len() )
+ {
+ WriteTab( rOutStm, nTab );
+ rOutStm << "#include \"" << aSlotIdFile.GetBuffer() << '"' << endl << endl;
+ }
+ SvMetaExtern::Write( rBase, rOutStm, nTab, nT, nA );
+ rOutStm << endl;
+ WriteTab( rOutStm, nTab );
+ rOutStm << "library " << GetName().GetBuffer() << endl;
+ WriteTab( rOutStm, nTab );
+ rOutStm << '{' << endl;
+ WriteTab( rOutStm, nTab );
+ rOutStm << "importlib(\"STDOLE.TLB\");" << endl;
+
+ /*
+ for( ULONG n = 0; n < aTypeList.Count(); n++ )
+ {
+ SvMetaType * pType = aTypeList.GetObject( n );
+ if( !pType ->Write( rBase, rOutStm, nTab +1, nT, nA ) )
+ return FALSE;
+ }
+ */
+ /*
+ for( ULONG n = 0; n < rBase.GetModuleList().Count(); n++ )
+ {
+ SvMetaModule * pModule = rBase.GetModuleList().GetObject( n );
+ const SvMetaTypeMemberList &rTypeList = pModule->GetTypeList();
+ for( ULONG n = 0; n < rTypeList.Count(); n++ )
+ {
+ SvMetaType * pType = rTypeList.GetObject( n );
+ pType->Write( rBase, rOutStm, nTab +1, nT, nA );
+ }
+ }
+ */
+
+ for( ULONG n = 0; n < aClassList.Count(); n++ )
+ {
+ SvMetaClass * pClass = aClassList.GetObject( n );
+ if( !pClass->IsShell() && pClass->GetAutomation() )
+ {
+ WriteTab( rOutStm, nTab );
+ WriteStars( rOutStm );
+ pClass->Write( rBase, rOutStm, nTab +1, nT, nA );
+ if( n +1 < aClassList.Count() )
+ rOutStm << endl;
+ }
+ }
+
+ rOutStm << '}' << endl;
+ }
+ break;
+ case WRITE_DOCU:
+ {
+ rOutStm << "SvIDL interface documentation" << endl << endl;
+ rOutStm << "<MODULE>" << endl << GetName().GetBuffer() << endl;
+ WriteDescription( rBase, rOutStm );
+ rOutStm << "</MODULE>" << endl << endl;
+
+ rOutStm << "<CLASSES>" << endl;
+ for( ULONG n = 0; n < aClassList.Count(); n++ )
+ {
+ SvMetaClass * pClass = aClassList.GetObject( n );
+ if( !pClass->IsShell() )
+ {
+ rOutStm << pClass->GetName().GetBuffer();
+ SvMetaClass* pSC = pClass->GetSuperClass();
+ if( pSC )
+ rOutStm << " : " << pSC->GetName().GetBuffer();
+
+ // Importierte Klassen
+ const SvClassElementMemberList& rClassList = pClass->GetClassList();
+ if ( rClassList.Count() )
+ {
+ rOutStm << " ( ";
+
+ for( ULONG m=0; m<rClassList.Count(); m++ )
+ {
+ SvClassElement *pEle = rClassList.GetObject(m);
+ SvMetaClass *pCl = pEle->GetClass();
+ rOutStm << pCl->GetName().GetBuffer();
+ if ( m+1 == rClassList.Count() )
+ rOutStm << " )";
+ else
+ rOutStm << " , ";
+ }
+ }
+
+ rOutStm << endl;
+ }
+ }
+ rOutStm << "</CLASSES>" << endl << endl;
+ // kein Break!
+ }
+
+ case WRITE_C_SOURCE:
+ case WRITE_C_HEADER:
+ {
+ for( ULONG n = 0; n < aClassList.Count(); n++ )
+ {
+ SvMetaClass * pClass = aClassList.GetObject( n );
+ if( !pClass->IsShell() /* && pClass->GetAutomation() */ )
+ pClass->Write( rBase, rOutStm, nTab, nT, nA );
+ }
+ }
+ break;
+ }
+}
+
+/*************************************************************************
+|* SvMetaModule::WriteSrc()
+*************************************************************************/
+void SvMetaModule::WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm,
+ Table * pTable )
+{
+// rOutStm << "#pragma CHARSET IBMPC" << endl;
+ if( aSlotIdFile.Len() )
+ rOutStm << "//#include <" << aSlotIdFile.GetBuffer() << '>' << endl;
+ for( ULONG n = 0; n < aClassList.Count(); n++ )
+ {
+ aClassList.GetObject( n )->WriteSrc( rBase, rOutStm, pTable );
+ }
+}
+
+/*************************************************************************
+|* SvMetaModule::WriteHxx()
+*************************************************************************/
+void SvMetaModule::WriteHxx( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab )
+{
+ for( ULONG n = 0; n < aClassList.Count(); n++ )
+ {
+ SvMetaClass * pClass = aClassList.GetObject( n );
+ pClass->WriteHxx( rBase, rOutStm, nTab );
+ }
+}
+
+/*************************************************************************
+|* SvMetaModule::WriteCxx()
+*************************************************************************/
+void SvMetaModule::WriteCxx( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab )
+{
+ for( ULONG n = 0; n < aClassList.Count(); n++ )
+ {
+ SvMetaClass * pClass = aClassList.GetObject( n );
+ pClass->WriteCxx( rBase, rOutStm, nTab );
+ }
+}
+
+#endif // IDL_COMPILER
+
diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx
new file mode 100644
index 000000000000..6e885d525542
--- /dev/null
+++ b/idl/source/objects/object.cxx
@@ -0,0 +1,1091 @@
+/*************************************************************************
+ *
+ * $RCSfile: object.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <ctype.h>
+#include <stdio.h>
+
+#include <tools/debug.hxx>
+
+#include <attrib.hxx>
+#include <object.hxx>
+#include <globals.hxx>
+#include <database.hxx>
+#pragma hdrstop
+
+
+/******************** class SvClassElement *******************************/
+SV_IMPL_PERSIST1( SvClassElement, SvPersistBase );
+
+/*************************************************************************
+|* SvClassElement::SvClassElement()
+|*
+|* Beschreibung
+*************************************************************************/
+SvClassElement::SvClassElement()
+{
+};
+
+/*************************************************************************
+|* SvClassElement::Load()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvClassElement::Load( SvPersistStream & rStm )
+{
+ BYTE nMask;
+ rStm >> nMask;
+ if( nMask >= 0x08 )
+ {
+ rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ DBG_ERROR( "wrong format" )
+ 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
+ BYTE nMask = 0;
+ 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 );
+#ifdef IDL_COMPILER
+SvAttributeList & SvMetaClass::GetAttributeList()
+{
+ if( !pAttribList )
+ {
+ pAttribList = new SvAttributeList();
+ }
+ return *pAttribList;
+}
+#endif
+/*************************************************************************
+|* SvMetaClass::SvMetaClass()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaClass::SvMetaClass()
+ : aAutomation( TRUE, FALSE )
+{
+}
+
+/*************************************************************************
+|* SvMetaClass::Load()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaClass::Load( SvPersistStream & rStm )
+{
+ SvMetaType::Load( rStm );
+
+ BYTE nMask;
+ rStm >> nMask;
+ if( nMask >= 0x20 )
+ {
+ rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ DBG_ERROR( "wrong format" )
+ 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
+ BYTE nMask = 0;
+ 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,
+ BOOL bVariable )
+{
+ // alle Attribute der Klasse schreiben
+ ULONG n ;
+ 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;
+ FillSbxMemberObject( rBase, pObj, aSuperList, TRUE );
+ FillSbxMemberObject( rBase, pObj, aSuperList, FALSE );
+
+ 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,
+ SvStream & rOutStm, USHORT nTab )
+{
+ 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 )
+{
+ UINT32 nTokPos = rInStm.Tell();
+ 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;
+ xEle->SetAutomation( TRUE );
+ }
+ 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 );
+
+ BOOL bOk = FALSE;
+ 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,
+ USHORT nTab
+)
+{
+ //SvMetaType::WriteContextSvIdl( rBase, rOutStm, nTab );
+ ULONG n;
+ 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 );
+ SvMetaClass * pCl = pEle->GetClass();
+ 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
+*************************************************************************/
+BOOL SvMetaClass::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
+{
+ ULONG nTokPos = rInStm.Tell();
+ if( SvMetaType::ReadHeaderSvIdl( rBase, rInStm ) && GetType() == TYPE_CLASS )
+ {
+ BOOL bOk = TRUE;
+ 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 );
+ return FALSE;
+}
+
+/*************************************************************************
+|* SvMetaClass::TestAttribute()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaClass::TestAttribute( SvIdlDataBase & rBase, SvTokenStream & rInStm,
+ SvMetaAttribute & rAttr ) const
+{
+ if ( !rAttr.GetRef() && rAttr.IsA( TYPE( SvMetaSlot ) ) )
+ {
+ DBG_ERROR( "Neuer Slot : " );
+ DBG_ERROR( rAttr.GetSlotId().GetBuffer() );
+ }
+
+ for( ULONG n = 0; n < aAttrList.Count(); n++ )
+ {
+ 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 );
+ return FALSE;
+ }
+ }
+ else
+ {
+ UINT32 nId1 = pS->GetSlotId().GetValue();
+ UINT32 nId2 = rAttr.GetSlotId().GetValue();
+ 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 );
+ return FALSE;
+ }
+ }
+ }
+ SvMetaClass * pSC = aSuperClass;
+ if( pSC )
+ return pSC->TestAttribute( rBase, rInStm, rAttr );
+ return TRUE;
+}
+
+/*************************************************************************
+|* SvMetaClass::WriteSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaClass::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab )
+{
+ 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,
+ BOOL bVariable, BOOL bWriteTab,
+ SvIdlDataBase & rBase,
+ SvStream & rOutStm, USHORT nTab )
+{
+ // alle Attribute schreiben
+ ULONG n;
+ 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,
+ USHORT nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ rBase.aIFaceName = GetName();
+ switch( nT )
+ {
+ case WRITE_ODL:
+ {
+ DBG_ERROR( "Not supported anymore!" )
+/*
+ // 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;
+ WriteOdlMembers( aSuperList, TRUE, TRUE, rBase, rOutStm, nTab );
+
+ WriteTab( rOutStm, nTab );
+ rOutStm << "methods:";
+ rOutStm << endl;
+
+ WriteOdlMembers( aSuperList, FALSE, TRUE, rBase, rOutStm, nTab );
+
+ 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:
+ {
+ DBG_ERROR( "Not supported anymore!" )
+/*
+ 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;
+ WriteDescription( rBase, rOutStm );
+ rOutStm << "</INTERFACE>" << endl << endl;
+
+ // alle Attribute schreiben
+ ULONG n;
+ 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;
+ }
+ }
+}
+
+/*************************************************************************
+|* SvMetaClass::WriteSlotParamArray()
+|*
+|* Beschreibung
+*************************************************************************/
+USHORT SvMetaClass::WriteSlotParamArray( SvIdlDataBase & rBase,
+ SvSlotElementList & rSlotList,
+ SvStream & rOutStm )
+{
+ USHORT nCount = 0;
+ for( ULONG n = 0; n < rSlotList.Count(); n++ )
+ {
+ SvSlotElement *pEle = rSlotList.GetObject( n );
+ SvMetaSlot *pAttr = pEle->xSlot;
+ nCount += pAttr->WriteSlotParamArray( rBase, rOutStm );
+ }
+
+ return nCount;
+}
+
+/*************************************************************************
+|* SvMetaClass::WriteSlots()
+|*
+|* Beschreibung
+*************************************************************************/
+USHORT SvMetaClass::WriteSlots( const ByteString & rShellName,
+ USHORT nCount, SvSlotElementList & rSlotList,
+ SvIdlDataBase & rBase,
+ SvStream & rOutStm )
+{
+ USHORT nSCount = 0;
+ for( ULONG n = 0; n < rSlotList.Count(); n++ )
+ {
+ rSlotList.Seek(n);
+ SvSlotElement * pEle = rSlotList.GetCurObject();
+ SvMetaSlot * pAttr = pEle->xSlot;
+ nSCount += pAttr->WriteSlotMap( rShellName, nCount + nSCount,
+ 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
+ ULONG n;
+ for( n = 0; n < aAttrList.Count(); n++ )
+ {
+ SvMetaAttribute * pAttr = aAttrList.GetObject( n );
+
+ ULONG nId = pAttr->GetSlotId().GetValue();
+ USHORT nPos;
+ 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
+ for( ULONG n = 0; n < aClassList.Count(); n++ )
+ {
+ 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
+ for( ULONG n = 0; n < rSlotList.Count(); n++ )
+ {
+ 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;
+ SvMetaClassList aClassList;
+ SvSlotElementList aSlotList;
+ InsertSlots(aSlotList, aSuperList, aClassList, ByteString(), rBase);
+ ULONG n;
+ for ( n=0; n<aSlotList.Count(); n++ )
+ {
+ SvSlotElement *pEle = aSlotList.GetObject( n );
+ SvMetaSlot *pSlot = pEle->xSlot;
+ pSlot->SetListPos(n);
+ }
+
+ ULONG nSlotCount = aSlotList.Count();
+
+ // alle Attribute schreiben
+ USHORT nArgCount = WriteSlotParamArray( rBase, aSlotList, rOutStm );
+ 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 )
+{
+ for( ULONG n=0; n<aAttrList.Count(); n++ )
+ {
+ SvMetaAttribute * pAttr = aAttrList.GetObject( n );
+ pAttr->WriteHelpId( rBase, rOutStm, pTable );
+ }
+}
+
+/*************************************************************************
+|* SvMetaShell::WriteSrc()
+*************************************************************************/
+void SvMetaClass::WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm,
+ Table * pTable )
+{
+ for( ULONG n=0; n<aAttrList.Count(); n++ )
+ {
+ SvMetaAttribute * pAttr = aAttrList.GetObject( n );
+ pAttr->WriteSrc( rBase, rOutStm, pTable );
+ }
+}
+
+/*************************************************************************
+|* SvMetaClass::WriteHxx()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaClass::WriteHxx( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab )
+{
+ 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
+ << "\tvirtual BOOL FillTypeLibInfo( SvGlobalName *, USHORT * pMajor," << endl
+ << "\t USHORT * pMinor ) const;" << endl
+ << "\tvirtual BOOL FillTypeLibInfo( ByteString * pName, USHORT * pMajor," << endl;
+ rOutStm
+ << "\t USHORT * pMinor ) const;" << endl
+ << "\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
+*************************************************************************/
+void SvMetaClass::WriteCxx( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab )
+{
+ ByteString aSuperName( "SvDispatch" );
+ if( GetSuperClass() )
+ aSuperName = GetSuperClass()->GetName();
+ const char * pSup = aSuperName.GetBuffer();
+
+ ByteString aName = GetSvName();
+ // GetTypeName
+ rOutStm << "SvGlobalName " << aName.GetBuffer() << "::GetTypeName() const" << endl
+ << '{' << endl
+ << "\treturn ClassName();" << endl
+ << '}' << endl;
+
+ SvMetaModule * pMod = GetModule();
+ // FillTypeLibInfo
+ rOutStm << "BOOL " << aName.GetBuffer() << "::FillTypeLibInfo( SvGlobalName * pGN," << endl
+ << "\t USHORT * pMajor," << endl
+ << "\t USHORT * pMinor ) const" << endl
+ << '{' << 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
+ << "\treturn TRUE;" << endl
+ << '}' << endl;
+
+ // FillTypeLibInfo
+ rOutStm << "BOOL " << aName.GetBuffer() << "::FillTypeLibInfo( ByteString * pName,"
+ << "\t USHORT * pMajor," << endl
+ << "\t USHORT * pMinor ) const" << endl;
+ 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
+ << "\treturn TRUE;" << endl
+ << '}' << endl;
+
+ rOutStm << "void " << aName.GetBuffer() << "::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )" << endl
+ << '{' << endl
+ << "\t" << pSup << "::Notify( rBC, rHint );" << endl
+ << '}' << endl;
+}
+
+#endif // IDL_COMPILER
+
diff --git a/idl/source/objects/slot.cxx b/idl/source/objects/slot.cxx
new file mode 100644
index 000000000000..3f6fc3a2015f
--- /dev/null
+++ b/idl/source/objects/slot.cxx
@@ -0,0 +1,2011 @@
+/*************************************************************************
+ *
+ * $RCSfile: slot.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <ctype.h>
+#include <stdio.h>
+#include <tools/debug.hxx>
+#include <attrib.hxx>
+#include <slot.hxx>
+#include <globals.hxx>
+#include <database.hxx>
+#pragma hdrstop
+
+
+/****************** SvMetaSlot *****************************************/
+SV_IMPL_META_FACTORY1( SvMetaSlot, SvMetaAttribute );
+#ifdef IDL_COMPILER
+SvAttributeList & SvMetaSlot::GetAttributeList()
+{
+ if( !pAttribList )
+ {
+ pAttribList = new SvAttributeList();
+ }
+ return *pAttribList;
+}
+#endif
+
+/*************************************************************************
+|* SvMetaSlot::SvMetaSlot()
+|*
+|* Beschreibung Zweites FALSE bei den SvBOOL-Objekten bedeutet,
+|* IsSet() liefert FALSE (Defaultinitialisierung).
+*************************************************************************/
+SvMetaSlot::SvMetaSlot()
+ : aCachable( TRUE, FALSE )
+ , aSynchron( TRUE, FALSE )
+ , aRecordPerSet( TRUE, FALSE )
+ , aRecordAbsolute( FALSE, FALSE )
+ , pLinkedSlot(0)
+ , pNextSlot(0)
+ , pEnumValue(0)
+{
+}
+
+SvMetaSlot::SvMetaSlot( SvMetaType * pType )
+ : SvMetaAttribute( pType )
+ , aCachable( TRUE, FALSE )
+ , aSynchron( TRUE, FALSE )
+ , aRecordPerSet( TRUE, FALSE )
+ , aRecordAbsolute( FALSE, FALSE )
+ , pLinkedSlot(0)
+ , pNextSlot(0)
+ , pEnumValue(0)
+{
+}
+
+/*
+#define TEST_READ \
+{ \
+ UINT32 nPos; \
+ rStm >> nPos; \
+ DBG_ASSERT( nPos +4 == rStm.Tell(), "stream pos error" ); \
+}
+
+#define TEST_WRITE \
+ rStm << (UINT32)rStm.Tell();
+*/
+#define TEST_READ
+#define TEST_WRITE
+
+void SvMetaSlot::Load( SvPersistStream & rStm )
+{
+ SvMetaAttribute::Load( rStm );
+
+ USHORT nMask;
+ rStm >> nMask;
+
+ TEST_READ
+ if( nMask & 0x0001 )
+ {
+ SvMetaAttribute * pMeth;
+ rStm >> pMeth;
+ aMethod = pMeth;
+ }
+
+ TEST_READ
+ if( nMask & 0x0002 ) rStm >> aGroupId;
+ TEST_READ
+ if( nMask & 0x0004 ) rStm >> aHasCoreId;
+ TEST_READ
+ if( nMask & 0x0008 ) rStm >> aConfigId;
+ TEST_READ
+ if( nMask & 0x0010 ) rStm >> aExecMethod;
+ TEST_READ
+ if( nMask & 0x0020 ) rStm >> aStateMethod;
+ TEST_READ
+ if( nMask & 0x0040 ) rStm >> aDefault;
+ TEST_READ
+ if( nMask & 0x0080 ) rStm >> aPseudoSlots;
+ TEST_READ
+ if( nMask & 0x0100 ) rStm >> aGet;
+ TEST_READ
+ if( nMask & 0x0200 ) rStm >> aSet;
+ TEST_READ
+ if( nMask & 0x0400 ) rStm >> aCachable;
+ TEST_READ
+ if( nMask & 0x0800 ) rStm >> aVolatile;
+ TEST_READ
+ if( nMask & 0x1000 ) rStm >> aToggle;
+ TEST_READ
+ if( nMask & 0x2000 ) rStm >> aAutoUpdate;
+ TEST_READ
+ if( nMask & 0x4000 ) rStm >> aSynchron;
+ TEST_READ
+ if( nMask & 0x8000 ) rStm >> aAsynchron;
+
+ nMask = 0;
+ rStm >> nMask;
+
+ TEST_READ
+ if( nMask & 0x0001 ) rStm >> aRecordPerItem;
+ TEST_READ
+ if( nMask & 0x0002 ) rStm >> aRecordManual;
+ TEST_READ
+ if( nMask & 0x0004 ) rStm >> aNoRecord;
+ TEST_READ
+ if( nMask & 0x0008 ) rStm >> aHasDialog;
+ TEST_READ
+ if( nMask & 0x0010 ) rStm >> aDisableFlags;
+ TEST_READ
+ if( nMask & 0x0020 ) rStm >> aPseudoPrefix;
+ TEST_READ
+ if( nMask & 0x0040 ) rStm >> aRecordPerSet;
+ TEST_READ
+ if( nMask & 0x0080 ) rStm >> aMenuConfig;
+ TEST_READ
+ if( nMask & 0x0100 ) rStm >> aToolBoxConfig;
+ TEST_READ
+ if( nMask & 0x0200 ) rStm >> aStatusBarConfig;
+ TEST_READ
+ if( nMask & 0x0400 ) rStm >> aAccelConfig;
+ TEST_READ
+ if( nMask & 0x0800 ) rStm >> aFastCall;
+ TEST_READ
+ if( nMask & 0x1000 ) rStm >> aContainer;
+ TEST_READ
+
+ if( nMask & 0x2000 )
+ {
+ SvMetaType * pT;
+ rStm >> pT;
+ aSlotType = pT;
+ }
+
+ TEST_READ
+ if( nMask & 0x4000 ) rStm >> aRecordAbsolute;
+ TEST_READ
+ if( nMask & 0x8000 ) rStm >> aPlugComm;
+
+ nMask = 0;
+ rStm >> nMask;
+
+ TEST_READ
+ if( nMask & 0x0001 ) rStm >> aUnoName;
+}
+
+void SvMetaSlot::Save( SvPersistStream & rStm )
+{
+ SvMetaAttribute::Save( rStm );
+
+ // Maske erstellen
+ USHORT nMask = 0;
+ if( aMethod.Is() ) nMask |= 0x0001;
+ if( aGroupId.Len() ) nMask |= 0x0002;
+ if( aHasCoreId.IsSet() ) nMask |= 0x0004;
+ if( aConfigId.Len() ) nMask |= 0x0008;
+ if( aExecMethod.Len() ) nMask |= 0x0010;
+ if( aStateMethod.Len() ) nMask |= 0x0020;
+ if( aDefault.Len() ) nMask |= 0x0040;
+ if( aPseudoSlots.IsSet() ) nMask |= 0x0080;
+ if( aGet.IsSet() ) nMask |= 0x0100;
+ if( aSet.IsSet() ) nMask |= 0x0200;
+ if( aCachable.IsSet() ) nMask |= 0x0400;
+ if( aVolatile.IsSet() ) nMask |= 0x0800;
+ if( aToggle.IsSet() ) nMask |= 0x1000;
+ if( aAutoUpdate.IsSet() ) nMask |= 0x2000;
+ if( aSynchron.IsSet() ) nMask |= 0x4000;
+ if( aAsynchron.IsSet() ) nMask |= 0x8000;
+
+ // Daten schreiben
+ rStm << nMask;
+ TEST_WRITE
+ if( nMask & 0x0001 ) rStm << aMethod;
+ TEST_WRITE
+ if( nMask & 0x0002 ) rStm << aGroupId;
+ TEST_WRITE
+ if( nMask & 0x0004 ) rStm << aHasCoreId;
+ TEST_WRITE
+ if( nMask & 0x0008 ) rStm << aConfigId;
+ TEST_WRITE
+ if( nMask & 0x0010 ) rStm << aExecMethod;
+ TEST_WRITE
+ if( nMask & 0x0020 ) rStm << aStateMethod;
+ TEST_WRITE
+ if( nMask & 0x0040 ) rStm << aDefault;
+ TEST_WRITE
+ if( nMask & 0x0080 ) rStm << aPseudoSlots;
+ TEST_WRITE
+ if( nMask & 0x0100 ) rStm << aGet;
+ TEST_WRITE
+ if( nMask & 0x0200 ) rStm << aSet;
+ TEST_WRITE
+ if( nMask & 0x0400 ) rStm << aCachable;
+ TEST_WRITE
+ if( nMask & 0x0800 ) rStm << aVolatile;
+ TEST_WRITE
+ if( nMask & 0x1000 ) rStm << aToggle;
+ TEST_WRITE
+ if( nMask & 0x2000 ) rStm << aAutoUpdate;
+ TEST_WRITE
+ if( nMask & 0x4000 ) rStm << aSynchron;
+ TEST_WRITE
+ if( nMask & 0x8000 ) rStm << aAsynchron;
+
+ // naechste Fuhre schreiben
+ // Maske erstellen
+ nMask = 0;
+ if( aRecordPerItem.IsSet() ) nMask |= 0x0001;
+ if( aRecordManual.IsSet() ) nMask |= 0x0002;
+ if( aNoRecord.IsSet() ) nMask |= 0x0004;
+ if( aHasDialog.IsSet() ) nMask |= 0x0008;
+ if ( aDisableFlags.IsSet() ) nMask |= 0x0010;
+ if( aPseudoPrefix.Len() ) nMask |= 0x0020;
+ if( aRecordPerSet.IsSet() ) nMask |= 0x0040;
+ if( aMenuConfig.IsSet() ) nMask |= 0x0080;
+ if( aToolBoxConfig.IsSet() ) nMask |= 0x0100;
+ if( aStatusBarConfig.IsSet() )nMask |= 0x0200;
+ if( aAccelConfig.IsSet() ) nMask |= 0x0400;
+ if( aFastCall.IsSet() ) nMask |= 0x0800;
+ if( aContainer.IsSet() ) nMask |= 0x1000;
+ if( aSlotType.Is() ) nMask |= 0x2000;
+ if( aRecordAbsolute.IsSet() ) nMask |= 0x4000;
+ if( aPlugComm.IsSet() ) nMask |= 0x8000;
+
+ // Daten schreiben
+ rStm << nMask;
+ TEST_WRITE
+ if( nMask & 0x0001 ) rStm << aRecordPerItem;
+ TEST_WRITE
+ if( nMask & 0x0002 ) rStm << aRecordManual;
+ TEST_WRITE
+ if( nMask & 0x0004 ) rStm << aNoRecord;
+ TEST_WRITE
+ if( nMask & 0x0008 ) rStm << aHasDialog;
+ TEST_WRITE
+ if( nMask & 0x0010 ) rStm << aDisableFlags;
+ TEST_WRITE
+ if( nMask & 0x0020 ) rStm << aPseudoPrefix;
+ TEST_WRITE
+ if( nMask & 0x0040 ) rStm << aRecordPerSet;
+ TEST_WRITE
+ if( nMask & 0x0080 ) rStm << aMenuConfig;
+ TEST_WRITE
+ if( nMask & 0x0100 ) rStm << aToolBoxConfig;
+ TEST_WRITE
+ if( nMask & 0x0200 ) rStm << aStatusBarConfig;
+ TEST_WRITE
+ if( nMask & 0x0400 ) rStm << aAccelConfig;
+ TEST_WRITE
+ if( nMask & 0x0800 ) rStm << aFastCall;
+ TEST_WRITE
+ if( nMask & 0x1000 ) rStm << aContainer;
+ TEST_WRITE
+ if( nMask & 0x2000 ) rStm << aSlotType;
+ TEST_WRITE
+ if( nMask & 0x4000 ) rStm << aRecordAbsolute;
+ TEST_WRITE
+ if( nMask & 0x8000 ) rStm << aPlugComm;
+
+ nMask = 0;
+ if( aUnoName.IsSet() ) nMask |= 0x0001;
+
+ rStm << nMask;
+ TEST_WRITE
+ if( nMask & 0x0001 ) rStm << aUnoName;
+}
+
+/*************************************************************************
+|* SvMetaSlot::IsVariable()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaSlot::IsVariable() const
+{
+ return SvMetaAttribute::IsVariable();
+}
+
+/*************************************************************************
+|* SvMetaSlot::IsMethod()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaSlot::IsMethod() const
+{
+ BOOL b = SvMetaAttribute::IsMethod();
+ b |= NULL != GetMethod();
+ return b;
+}
+
+/*************************************************************************
+|* SvMetaSlot::HasMethods()
+|*
+|* Beschreibung
+*************************************************************************/
+ByteString SvMetaSlot::GetMangleName( BOOL bVariable ) const
+{
+ if( !bVariable )
+ {
+ SvMetaAttribute * pMeth = GetMethod();
+ if( pMeth )
+ return pMeth->GetName();
+ }
+ return GetName();
+}
+
+/*************************************************************************
+|* Referenz
+|*
+|* Beschreibung Zweites FALSE bei den SvBOOL-Objekten bedeutet,
+|* IsSet() liefert FALSE (Defaultinitialisierung).
+*************************************************************************/
+/** Referenz Aufloesung **/
+SvMetaType * SvMetaSlot::GetSlotType() const
+{
+ if( aSlotType.Is() || !GetRef() ) return aSlotType;
+ return ((SvMetaSlot *)GetRef())->GetSlotType();
+}
+SvMetaAttribute * SvMetaSlot::GetMethod() const
+{
+ if( aMethod.Is() || !GetRef() ) return aMethod;
+ return ((SvMetaSlot *)GetRef())->GetMethod();
+}
+BOOL SvMetaSlot::GetHasCoreId() const
+{
+ if( aHasCoreId.IsSet() || !GetRef() ) return aHasCoreId;
+ return ((SvMetaSlot *)GetRef())->GetHasCoreId();
+}
+const ByteString & SvMetaSlot::GetGroupId() const
+{
+ if( aGroupId.Len() || !GetRef() ) return aGroupId;
+ return ((SvMetaSlot *)GetRef())->GetGroupId();
+}
+const ByteString & SvMetaSlot::GetDisableFlags() const
+{
+ if( aDisableFlags.Len() || !GetRef() ) return aDisableFlags;
+ return ((SvMetaSlot *)GetRef())->GetDisableFlags();
+}
+const ByteString & SvMetaSlot::GetConfigId() const
+{
+ if( aConfigId.Len() || !GetRef() ) return aConfigId;
+ return ((SvMetaSlot *)GetRef())->GetConfigId();
+}
+const ByteString & SvMetaSlot::GetExecMethod() const
+{
+ if( aExecMethod.Len() || !GetRef() ) return aExecMethod;
+ return ((SvMetaSlot *)GetRef())->GetExecMethod();
+}
+const ByteString & SvMetaSlot::GetStateMethod() const
+{
+ if( aStateMethod.Len() || !GetRef() ) return aStateMethod;
+ return ((SvMetaSlot *)GetRef())->GetStateMethod();
+}
+const ByteString & SvMetaSlot::GetDefault() const
+{
+ if( aDefault.Len() || !GetRef() ) return aDefault;
+ return ((SvMetaSlot *)GetRef())->GetDefault();
+}
+BOOL SvMetaSlot::GetPseudoSlots() const
+{
+ if( aPseudoSlots.IsSet() || !GetRef() ) return aPseudoSlots;
+ return ((SvMetaSlot *)GetRef())->GetPseudoSlots();
+}
+/*
+BOOL SvMetaSlot::GetGet() const
+{
+ if( aGet.IsSet() || !GetRef() ) return aGet;
+ return ((SvMetaSlot *)GetRef())->GetGet();
+}
+BOOL SvMetaSlot::GetSet() const
+{
+ if( aSet.IsSet() || !GetRef() ) return aSet;
+ return ((SvMetaSlot *)GetRef())->GetSet();
+}
+*/
+BOOL SvMetaSlot::GetCachable() const
+{
+ // Cachable und Volatile sind exclusiv
+ if( !GetRef() || aCachable.IsSet() || aVolatile.IsSet() )
+ return aCachable;
+ return ((SvMetaSlot *)GetRef())->GetCachable();
+}
+BOOL SvMetaSlot::GetVolatile() const
+{
+ // Cachable und Volatile sind exclusiv
+ if( !GetRef() || aVolatile.IsSet() || aCachable.IsSet() )
+ return aVolatile;
+ return ((SvMetaSlot *)GetRef())->GetVolatile();
+}
+BOOL SvMetaSlot::GetToggle() const
+{
+ if( aToggle.IsSet() || !GetRef() ) return aToggle;
+ return ((SvMetaSlot *)GetRef())->GetToggle();
+}
+BOOL SvMetaSlot::GetAutoUpdate() const
+{
+ if( aAutoUpdate.IsSet() || !GetRef() ) return aAutoUpdate;
+ return ((SvMetaSlot *)GetRef())->GetAutoUpdate();
+}
+BOOL SvMetaSlot::GetSynchron() const
+{
+ // Synchron und Asynchron sind exclusiv
+ if( !GetRef() || aSynchron.IsSet() || aAsynchron.IsSet() )
+ return aSynchron;
+ return ((SvMetaSlot *)GetRef())->GetSynchron();
+}
+BOOL SvMetaSlot::GetAsynchron() const
+{
+ // Synchron und Asynchron sind exclusiv
+ if( !GetRef() || aAsynchron.IsSet() || aSynchron.IsSet() )
+ return aAsynchron;
+ return ((SvMetaSlot *)GetRef())->GetAsynchron();
+}
+BOOL SvMetaSlot::GetRecordPerItem() const
+{
+ // Record- PerItem, No, PerSet und Manual sind exclusiv
+ if( !GetRef() || aRecordPerItem.IsSet() || aNoRecord.IsSet()
+ || aRecordPerSet.IsSet() || aRecordManual.IsSet() )
+ return aRecordPerItem;
+ return ((SvMetaSlot *)GetRef())->GetRecordPerItem();
+}
+BOOL SvMetaSlot::GetRecordPerSet() const
+{
+ // Record- PerItem, No, PerSet und Manual sind exclusiv
+ if( !GetRef() || aRecordPerItem.IsSet() || aNoRecord.IsSet()
+ || aRecordPerSet.IsSet() || aRecordManual.IsSet() )
+ return aRecordPerSet;
+ return ((SvMetaSlot *)GetRef())->GetRecordPerSet();
+}
+BOOL SvMetaSlot::GetRecordManual() const
+{
+ // Record- PerItem, No, PerSet und Manual sind exclusiv
+ if( !GetRef() || aRecordPerItem.IsSet() || aNoRecord.IsSet()
+ || aRecordPerSet.IsSet() || aRecordManual.IsSet() )
+ return aRecordManual;
+ return ((SvMetaSlot *)GetRef())->GetRecordManual();
+}
+BOOL SvMetaSlot::GetNoRecord() const
+{
+ // Record- PerItem, No, PerSet und Manual sind exclusiv
+ if( !GetRef() || aRecordPerItem.IsSet() || aNoRecord.IsSet()
+ || aRecordPerSet.IsSet() || aRecordManual.IsSet() )
+ return aNoRecord;
+ return ((SvMetaSlot *)GetRef())->GetNoRecord();
+}
+BOOL SvMetaSlot::GetRecordAbsolute() const
+{
+ if( !GetRef() || aRecordAbsolute.IsSet() )
+ return aRecordAbsolute;
+ return ((SvMetaSlot *)GetRef())->GetRecordAbsolute();
+}
+BOOL SvMetaSlot::GetHasDialog() const
+{
+ if( aHasDialog.IsSet() || !GetRef() ) return aHasDialog;
+ return ((SvMetaSlot *)GetRef())->GetHasDialog();
+}
+const ByteString & SvMetaSlot::GetPseudoPrefix() const
+{
+ if( aPseudoPrefix.Len() || !GetRef() ) return aPseudoPrefix;
+ return ((SvMetaSlot *)GetRef())->GetPseudoPrefix();
+}
+BOOL SvMetaSlot::GetMenuConfig() const
+{
+ if( aMenuConfig.IsSet() || !GetRef() ) return aMenuConfig;
+ return ((SvMetaSlot *)GetRef())->GetMenuConfig();
+}
+BOOL SvMetaSlot::GetToolBoxConfig() const
+{
+ if( aToolBoxConfig.IsSet() || !GetRef() ) return aToolBoxConfig;
+ return ((SvMetaSlot *)GetRef())->GetToolBoxConfig();
+}
+BOOL SvMetaSlot::GetStatusBarConfig() const
+{
+ if( aStatusBarConfig.IsSet() || !GetRef() ) return aStatusBarConfig;
+ return ((SvMetaSlot *)GetRef())->GetStatusBarConfig();
+}
+BOOL SvMetaSlot::GetAccelConfig() const
+{
+ if( aAccelConfig.IsSet() || !GetRef() ) return aAccelConfig;
+ return ((SvMetaSlot *)GetRef())->GetAccelConfig();
+}
+BOOL SvMetaSlot::GetFastCall() const
+{
+ if( aFastCall.IsSet() || !GetRef() ) return aFastCall;
+ return ((SvMetaSlot *)GetRef())->GetFastCall();
+}
+BOOL SvMetaSlot::GetContainer() const
+{
+ if( aContainer.IsSet() || !GetRef() ) return aContainer;
+ return ((SvMetaSlot *)GetRef())->GetContainer();
+}
+
+BOOL SvMetaSlot::GetPlugComm() const
+{
+ if( aPlugComm.IsSet() || !GetRef() ) return aPlugComm;
+ return ((SvMetaSlot *)GetRef())->GetPlugComm();
+}
+
+const ByteString& SvMetaSlot::GetUnoName() const
+{
+ if( aUnoName.IsSet() || !GetRef() ) return aUnoName;
+ return ((SvMetaSlot *)GetRef())->GetUnoName();
+}
+
+/*************************************************************************
+|* SvMetaSlot::FillSbxObject()
+|*
+|* Beschreibung
+*************************************************************************/
+/*
+void SvMetaSlot::FillSbxObject( SvIdlDataBase & rBase, SbxObject * pObj,
+ BOOL bVariable )
+{
+ // keine Attribut fuer Automation
+ if( !GetAutomation() || !GetExport() )
+ return;
+
+ if( !bVariable )
+ {
+ SvMetaAttributeRef xM = GetMethod();
+ if( xM.Is() )
+ {
+ SvMetaType * pType = xM->GetType();
+ SvMetaType * pRetBaseType = pType->GetReturnType()->GetBaseType();
+ ByteString aName = xM->GetName();
+
+ SbxMethodRef xMeth = new SbxMethod( aName,
+ pRetBaseType->GetSbxDataType() );
+ pType->FillSbxObject( xMeth, bVariable );
+ xMeth->SetUserData( MakeSlotValue(rBase, FALSE) );
+
+ pObj->Insert( &xMeth );
+ return;
+ }
+ }
+
+ SvMetaAttribute::FillSbxObject( rBase, pObj, bVariable );
+}
+ */
+
+#ifdef IDL_COMPILER
+/*************************************************************************
+|* SvMetaSlot::ReadAttributesSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaSlot::ReadAttributesSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ SvMetaAttribute::ReadAttributesSvIdl( rBase, rInStm );
+
+ BOOL bOk = FALSE;
+ bOk |= aDefault.ReadSvIdl( SvHash_Default(), rInStm );
+ bOk |= aPseudoSlots.ReadSvIdl( SvHash_PseudoSlots(), rInStm );
+ bOk |= aHasCoreId.ReadSvIdl( SvHash_HasCoreId(), rInStm );
+ bOk |= aGroupId.ReadSvIdl( SvHash_GroupId(), rInStm );
+ bOk |= aExecMethod.ReadSvIdl( SvHash_ExecMethod(), rInStm );
+ bOk |= aStateMethod.ReadSvIdl( SvHash_StateMethod(), rInStm );
+ bOk |= aDisableFlags.ReadSvIdl( SvHash_DisableFlags(), rInStm );
+ if( aGet.ReadSvIdl( SvHash_Get(), rInStm ) )
+ {
+ rBase.WriteError( "warning", ByteString( rInStm.GetFileName(), RTL_TEXTENCODING_UTF8 ),
+ "<Get> old style, use Readonly",
+ rInStm.GetToken()->GetLine(),
+ rInStm.GetToken()->GetColumn() );
+ }
+ if( aSet.ReadSvIdl( SvHash_Set(), rInStm ) )
+ {
+ rBase.WriteError( "warning", ByteString( rInStm.GetFileName(), RTL_TEXTENCODING_UTF8 ),
+ "<Set> old style, use method declaration",
+ rInStm.GetToken()->GetLine(),
+ rInStm.GetToken()->GetColumn() );
+ }
+
+ if( aCachable.ReadSvIdl( SvHash_Cachable(), rInStm ) )
+ SetCachable( aCachable ), bOk = TRUE;
+ if( aVolatile.ReadSvIdl( SvHash_Volatile(), rInStm ) )
+ SetVolatile( aVolatile ), bOk = TRUE;
+ if( aToggle.ReadSvIdl( SvHash_Toggle(), rInStm ) )
+ SetToggle( aToggle ), bOk = TRUE;
+ if( aAutoUpdate.ReadSvIdl( SvHash_AutoUpdate(), rInStm ) )
+ SetAutoUpdate( aAutoUpdate ), bOk = TRUE;
+
+ if( aSynchron.ReadSvIdl( SvHash_Synchron(), rInStm ) )
+ SetSynchron( aSynchron ), bOk = TRUE;
+ if( aAsynchron.ReadSvIdl( SvHash_Asynchron(), rInStm ) )
+ SetAsynchron( aAsynchron ), bOk = TRUE;
+
+ if( aRecordAbsolute.ReadSvIdl( SvHash_RecordAbsolute(), rInStm ) )
+ SetRecordAbsolute( aRecordAbsolute), bOk = TRUE;
+ if( aRecordPerItem.ReadSvIdl( SvHash_RecordPerItem(), rInStm ) )
+ SetRecordPerItem( aRecordPerItem ), bOk = TRUE;
+ if( aRecordPerSet.ReadSvIdl( SvHash_RecordPerSet(), rInStm ) )
+ SetRecordPerSet( aRecordPerSet ), bOk = TRUE;
+ if( aRecordManual.ReadSvIdl( SvHash_RecordManual(), rInStm ) )
+ SetRecordManual( aRecordManual ), bOk = TRUE;
+ if( aNoRecord.ReadSvIdl( SvHash_NoRecord(), rInStm ) )
+ SetNoRecord( aNoRecord ), bOk = TRUE;
+
+ bOk |= aHasDialog.ReadSvIdl( SvHash_HasDialog(), rInStm );
+ bOk |= aPseudoPrefix.ReadSvIdl( SvHash_PseudoPrefix(), rInStm );
+ bOk |= aMenuConfig.ReadSvIdl( SvHash_MenuConfig(), rInStm );
+ bOk |= aToolBoxConfig.ReadSvIdl( SvHash_ToolBoxConfig(), rInStm );
+ bOk |= aStatusBarConfig.ReadSvIdl( SvHash_StatusBarConfig(), rInStm );
+ bOk |= aAccelConfig.ReadSvIdl( SvHash_AccelConfig(), rInStm );
+
+ SvBOOL aAllConfig;
+ if( aAllConfig.ReadSvIdl( SvHash_AllConfig(), rInStm ) )
+ SetAllConfig( aAllConfig ), bOk = TRUE;
+ bOk |= aFastCall.ReadSvIdl( SvHash_FastCall(), rInStm );
+ bOk |= aContainer.ReadSvIdl( SvHash_Container(), rInStm );
+ bOk |= aPlugComm.ReadSvIdl( SvHash_PlugComm(), rInStm );
+ bOk |= aUnoName.ReadSvIdl( SvHash_UnoName(), rInStm );
+
+ if( !bOk )
+ {
+ if( !aSlotType.Is() )
+ {
+ UINT32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+ if( pTok->Is( SvHash_SlotType() ) )
+ {
+ BOOL bBraket = rInStm.Read( '(' );
+ if( bBraket || rInStm.Read( '=' ) )
+ {
+ aSlotType = rBase.ReadKnownType( rInStm );
+ if( aSlotType.Is() )
+ {
+ if( aSlotType->IsItem() )
+ {
+ if( bBraket )
+ {
+ if( rInStm.Read( ')' ) )
+ return;
+ }
+ else
+ return;
+ }
+ rBase.SetError( "the SlotType is not a item", rInStm.GetToken() );
+ rBase.WriteError( rInStm );
+ }
+ rBase.SetError( "SlotType with unknown item type", rInStm.GetToken() );
+ rBase.WriteError( rInStm );
+ }
+ }
+ rInStm.Seek( nTokPos );
+
+ }
+ if( !aMethod.Is() )
+ {
+ SvToken * pTok = rInStm.GetToken();
+ if( pTok->IsIdentifier() )
+ {
+ aMethod = new SvMetaSlot();
+ UINT32 nTokPos = rInStm.Tell();
+ if( aMethod->ReadSvIdl( rBase, rInStm ) )
+ {
+ if( aMethod->IsMethod() )
+ {
+ aMethod->SetSlotId( GetSlotId() );
+ if( aMethod->Test( rBase, rInStm ) )
+ return;
+ }
+ rInStm.Seek( nTokPos );
+ }
+ aMethod.Clear();
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|* SvMetaSlot::WriteAttributesSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaSlot::WriteAttributesSvIdl( SvIdlDataBase & rBase,
+ SvStream & rOutStm,
+ USHORT nTab )
+{
+ SvMetaAttribute::WriteAttributesSvIdl( rBase, rOutStm, nTab );
+
+ if( aSlotType.Is() )
+ {
+ WriteTab( rOutStm, nTab );
+ rOutStm << SvHash_SlotType()->GetName().GetBuffer() << '(';
+ aSlotType->WriteTheType( rBase, rOutStm, nTab, WRITE_IDL );
+ rOutStm << ");" << endl;
+ }
+ if( aMethod.Is() )
+ {
+ WriteTab( rOutStm, nTab );
+ aMethod->WriteSvIdl( rBase, rOutStm, nTab );
+ rOutStm << ';' << endl;
+ }
+ if( aHasCoreId )
+ {
+ aHasCoreId.WriteSvIdl( SvHash_HasCoreId(), rOutStm );
+ rOutStm << ';' << endl;
+ }
+ if( aGroupId.Len() )
+ {
+ WriteTab( rOutStm, nTab );
+ aGroupId.WriteSvIdl( SvHash_GroupId(), rOutStm, nTab +1);
+ rOutStm << ';' << endl;
+ }
+ if( aExecMethod.Len() )
+ {
+ WriteTab( rOutStm, nTab );
+ aExecMethod.WriteSvIdl( SvHash_ExecMethod(), rOutStm, nTab +1);
+ rOutStm << ';' << endl;
+ }
+ if( aStateMethod.Len() )
+ {
+ WriteTab( rOutStm, nTab );
+ aStateMethod.WriteSvIdl( SvHash_StateMethod(), rOutStm, nTab +1);
+ rOutStm << ';' << endl;
+ }
+
+ if( aDisableFlags.Len() )
+ {
+ WriteTab( rOutStm, nTab );
+ aDisableFlags.WriteSvIdl( SvHash_DisableFlags(), rOutStm, nTab +1);
+ rOutStm << ';' << endl;
+ }
+
+ if( aSet || aGet || aPseudoSlots )
+ {
+ WriteTab( rOutStm, nTab );
+ char * p = "";
+ if( aPseudoSlots )
+ {
+ aPseudoSlots.WriteSvIdl( SvHash_PseudoSlots(), rOutStm );
+ p = ", ";
+ }
+ if( aGet )
+ {
+ rOutStm << p;
+ aGet.WriteSvIdl( SvHash_Get(), rOutStm );
+ p = ", ";
+ }
+ if( aSet )
+ {
+ rOutStm << p;
+ aSet.WriteSvIdl( SvHash_Set(), rOutStm );
+ }
+ rOutStm << ';' << endl;
+ }
+
+ ByteString aDel( ", " );
+ ByteString aOut;
+ if( aVolatile )
+ aOut += aVolatile.GetSvIdlString( SvHash_Volatile() );
+ else if( !aCachable )
+ // wegen Default == TRUE, nur wenn kein anderer gesetzt
+ aOut += aCachable.GetSvIdlString( SvHash_Cachable() );
+ else
+ aDel.Erase();
+
+ if( aToggle )
+ {
+ ( aOut += aDel ) += aToggle.GetSvIdlString( SvHash_Toggle() );
+ aDel = ", ";
+ }
+ if( aAutoUpdate )
+ {
+ (aOut += aDel ) += aAutoUpdate.GetSvIdlString( SvHash_AutoUpdate() );
+ aDel = ", ";
+ }
+
+ ByteString aDel1( ", " );
+ if( aAsynchron )
+ ( aOut += aDel ) += aAsynchron.GetSvIdlString( SvHash_Asynchron() );
+ else if( !aSynchron )
+ // wegen Default == TRUE, nur wenn kein anderer gesetzt
+ ( aOut += aDel ) += aSynchron.GetSvIdlString( SvHash_Synchron() );
+ else
+ aDel1 = aDel;
+
+ aDel = ", ";
+ if( aRecordManual )
+ ( aOut += aDel1 ) += aRecordManual.GetSvIdlString( SvHash_RecordManual() );
+ else if( aNoRecord )
+ ( aOut += aDel1 ) += aNoRecord.GetSvIdlString( SvHash_NoRecord() );
+ else if( !aRecordPerSet )
+ // wegen Default == TRUE, nur wenn kein anderer gesetzt
+ ( aOut += aDel1 ) += aRecordPerSet.GetSvIdlString( SvHash_RecordPerSet() );
+ else if( aRecordPerItem )
+ ( aOut += aDel1 ) += aRecordPerItem.GetSvIdlString( SvHash_RecordPerItem() );
+ else
+ aDel = aDel1;
+
+ if( aRecordAbsolute )
+ {
+ ( aOut += aDel ) += aRecordAbsolute.GetSvIdlString( SvHash_RecordAbsolute() );
+ aDel = ", ";
+ }
+ if( aHasDialog )
+ {
+ ( aOut += aDel ) += aHasDialog.GetSvIdlString( SvHash_HasDialog() );
+ aDel = ", ";
+ }
+ if( aMenuConfig )
+ {
+ ( aOut += aDel ) += aMenuConfig.GetSvIdlString( SvHash_MenuConfig() );
+ aDel = ", ";
+ }
+ if( aToolBoxConfig )
+ {
+ ( aOut += aDel ) += aToolBoxConfig.GetSvIdlString( SvHash_ToolBoxConfig() );
+ aDel = ", ";
+ }
+ if( aStatusBarConfig )
+ {
+ ( aOut += aDel ) += aStatusBarConfig.GetSvIdlString( SvHash_StatusBarConfig() );
+ aDel = ", ";
+ }
+ if( aAccelConfig )
+ {
+ ( aOut += aDel ) += aAccelConfig.GetSvIdlString( SvHash_AccelConfig() );
+ aDel = ", ";
+ }
+ if( aFastCall )
+ {
+ ( aOut += aDel ) += aFastCall.GetSvIdlString( SvHash_FastCall() );
+ aDel = ", ";
+ }
+ if( aContainer )
+ {
+ ( aOut += aDel ) += aContainer.GetSvIdlString( SvHash_Container() );
+ aDel = ", ";
+ }
+ if( aPlugComm )
+ {
+ ( aOut += aDel ) += aPlugComm.GetSvIdlString( SvHash_PlugComm() );
+ aDel = ", ";
+ }
+
+ if( aOut.Len() )
+ {
+ WriteTab( rOutStm, nTab );
+ rOutStm << aOut.GetBuffer() << endl;
+ }
+}
+
+
+/*************************************************************************
+|* SvMetaSlot::Test()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaSlot::Test( SvIdlDataBase & rBase, SvTokenStream & rInStm )
+{
+ BOOL bOk = SvMetaAttribute::Test( rBase, rInStm );
+ if( bOk )
+ {
+ SvMetaType * pType = GetType();
+ if( pType->GetType() == TYPE_METHOD )
+ pType = pType->GetReturnType();
+ SvMetaType * pBaseType = pType->GetBaseType();
+ if( !pType->IsItem() )
+ {
+ rBase.SetError( "this attribute is not a slot", rInStm.GetToken() );
+ rBase.WriteError( rInStm );
+ bOk = FALSE;
+ }
+ }
+
+/*
+ if ( bOk )
+ {
+ SvMetaSlot* pRef = (SvMetaSlot*) GetRef();
+ if ( pRef )
+ CompareSlotAttributes( pRef );
+ }
+*/
+ return bOk;
+}
+
+/*************************************************************************
+|* SvMetaSlot::ReadSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaSlot::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
+{
+ UINT32 nTokPos = rInStm.Tell();
+ BOOL bOk = TRUE;
+
+ SvMetaAttribute * pAttr = rBase.ReadKnownAttr( rInStm, GetType() );
+ if( pAttr )
+ {
+ // F"ur Testzwecke: Referenz bei Kurz-Syntax
+ SvMetaSlot * pKnownSlot = PTR_CAST( SvMetaSlot, pAttr );
+ if( pKnownSlot )
+ {
+ SetRef( pKnownSlot );
+ SetName( pKnownSlot->GetName(), &rBase );
+ bOk = SvMetaName::ReadSvIdl( rBase, rInStm );
+ }
+ else
+ {
+ ByteString aStr( "attribute " );
+ aStr += pAttr->GetName();
+ aStr += " is method or variable but not a slot";
+ rBase.SetError( aStr, rInStm.GetToken() );
+ rBase.WriteError( rInStm );
+ bOk = FALSE;
+ }
+ }
+ else
+ {
+ bOk = SvMetaAttribute::ReadSvIdl( rBase, rInStm );
+
+ SvMetaAttribute *pAttr = rBase.SearchKnownAttr( GetSlotId() );
+ if( pAttr )
+ {
+ // F"ur Testzwecke: Referenz bei kompletter Definition
+ SvMetaSlot * pKnownSlot = PTR_CAST( SvMetaSlot, pAttr );
+ if( pKnownSlot )
+ {
+ SetRef( pKnownSlot );
+
+ // Namen d"urfen abweichen, da mit angegeben
+// SetName( pKnownSlot->GetName(), &rBase );
+ }
+ else
+ {
+ ByteString aStr( "attribute " );
+ aStr += pAttr->GetName();
+ aStr += " is method or variable but not a slot";
+ rBase.SetError( aStr, rInStm.GetToken() );
+ rBase.WriteError( rInStm );
+ bOk = FALSE;
+ }
+ }
+ }
+
+ if( !bOk )
+ rInStm.Seek( nTokPos );
+
+ return bOk;
+}
+
+/*************************************************************************
+|* SvMetaSlot::WriteSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaSlot::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab )
+{
+ SvMetaAttribute::WriteSvIdl( rBase, rOutStm, nTab );
+}
+
+/*************************************************************************
+|* SvMetaSlot::Write()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaSlot::Write( SvIdlDataBase & rBase,
+ SvStream & rOutStm, USHORT nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ if ( nT == WRITE_DOCU )
+ {
+ if ( GetHidden() )
+ return;
+ }
+ else
+ {
+ // keine Attribut fuer Automation
+ if( !GetAutomation() || !GetExport() )
+ return;
+ }
+
+ if( !(nA & WA_VARIABLE) )
+ {
+ SvMetaAttributeRef xM = GetMethod();
+ if( xM.Is() )
+ {
+ xM->SetSlotId( GetSlotId() );
+ xM->SetDescription( GetDescription() );
+ xM->Write( rBase, rOutStm, nTab, nT, nA );
+ return;
+ }
+ }
+
+ SvMetaAttribute::Write( rBase, rOutStm, nTab, nT, nA );
+}
+
+
+void SvMetaSlot::Insert( SvSlotElementList& rList, const ByteString & rPrefix,
+ SvIdlDataBase& rBase)
+{
+ // Einf"ugeposition durch bin"are Suche in der SlotListe ermitteln
+ USHORT nId = (USHORT) GetSlotId().GetValue();
+ USHORT nListCount = (USHORT) rList.Count();
+ USHORT nPos;
+ if ( !nListCount )
+ nPos = 0;
+ else if ( nListCount == 1 )
+ nPos = rList.GetObject(0)->xSlot->GetSlotId().GetValue() >= nId ? 0 : 1;
+ else
+ {
+ USHORT nMid, nLow = 0;
+ USHORT nHigh = nListCount - 1;
+ BOOL bFound = FALSE;
+ while ( !bFound && nLow <= nHigh )
+ {
+ nMid = (nLow + nHigh) >> 1;
+ DBG_ASSERT( nMid < nListCount, "bsearch ist buggy" );
+ int nDiff = (int) nId - (int) rList.GetObject(nMid)->xSlot->GetSlotId().GetValue();
+ if ( nDiff < 0)
+ {
+ if ( nMid == 0 )
+ break;
+ nHigh = nMid - 1;
+ }
+ else if ( nDiff > 0 )
+ {
+ nLow = nMid + 1;
+ if ( nLow == 0 )
+ break;
+ }
+ else
+ bFound = TRUE;
+ }
+
+ DBG_ASSERT(!bFound, "SlotId ist doppelt !");
+ nPos = bFound ? nMid : nLow;
+ }
+
+ DBG_ASSERT( nPos <= nListCount,
+ "nPos zu gro" );
+ DBG_ASSERT( nPos == nListCount || nId <=
+ (USHORT) rList.GetObject(nPos)->xSlot->GetSlotId().GetValue(),
+ "Nachfolger hat kleinere SlotId" );
+ DBG_ASSERT( nPos == 0 || nId >
+ (USHORT) rList.GetObject(nPos-1)->xSlot->GetSlotId().GetValue(),
+ "Vorgnger hat grere SlotId" );
+ DBG_ASSERT( nPos+1 >= nListCount || nId <
+ (USHORT) rList.GetObject(nPos+1)->xSlot->GetSlotId().GetValue(),
+ "Nachfolger hat kleinere SlotId" );
+
+ rList.Insert( new SvSlotElement( this, rPrefix ), nPos );
+
+ // EnumSlots plattklopfen
+ SvMetaTypeEnum * pEnum = NULL;
+ SvMetaType * pBType = GetType()->GetBaseType();
+ pEnum = PTR_CAST( SvMetaTypeEnum, pBType );
+ if( GetPseudoSlots() && pEnum && pEnum->Count() )
+ {
+ // Den MasterSlot clonen
+ SvMetaSlotRef xEnumSlot = Clone();
+ SvMetaSlot *pFirstEnumSlot = xEnumSlot;
+ for( ULONG n = 0; n < pEnum->Count(); n++ )
+ {
+ // Die Slaves sind kein Master !
+ xEnumSlot->aPseudoSlots = FALSE;
+
+ // Die SlotId erzeugen
+ SvMetaEnumValue *pEnumValue = pEnum->GetObject(n);
+ xEnumSlot->SetEnumValue(pEnumValue);
+ ByteString aValName = pEnumValue->GetName();
+ ByteString aSId( GetSlotId() );
+ if( GetPseudoPrefix().Len() )
+ aSId = GetPseudoPrefix();
+ aSId += '_';
+ USHORT nLen = pEnum->GetPrefix().Len();
+ aSId += aValName.Copy( pEnum->GetPrefix().Len() );
+
+ ULONG nValue;
+ if ( rBase.FindId(aSId , &nValue) )
+ {
+ SvNumberIdentifier aId;
+ *((SvIdentifier*)&aId) = aSId;
+ aId.SetValue(nValue);
+ xEnumSlot->SetSlotId(aId);
+ }
+
+ if ( xEnumSlot->GetSlotId().GetValue() <
+ pFirstEnumSlot->GetSlotId().GetValue() )
+ {
+ pFirstEnumSlot = xEnumSlot;
+ }
+
+ // Den erzeugten Slave ebenfalls einf"ugen
+ xEnumSlot->Insert( rList, rPrefix, rBase);
+
+ // Die EnumSlots mit dem Master verketten
+ xEnumSlot->pLinkedSlot = this;
+
+ // N"achster EnumSlot
+ if ( n != pEnum->Count() - 1 )
+ xEnumSlot = Clone();
+ }
+
+ // Master zeigt auf den ersten Slave
+ pLinkedSlot = pFirstEnumSlot;
+
+ // Slaves untereinander verketten
+ rList.Seek(0UL);
+ xEnumSlot = pFirstEnumSlot;
+ SvSlotElement *pEle;
+ do
+ {
+ pEle = rList.Next();
+ if ( pEle && pEle->xSlot->pLinkedSlot == this )
+ {
+ xEnumSlot->pNextSlot = pEle->xSlot;
+ xEnumSlot = pEle->xSlot;
+ }
+ }
+ while ( pEle );
+ xEnumSlot->pNextSlot = pFirstEnumSlot;
+ }
+}
+
+
+/*************************************************************************
+|* SvMetaSlot::WriteSlotMap()
+|*
+|* Beschreibung
+*************************************************************************/
+static ByteString MakeSlotName( SvStringHashEntry * pEntry )
+{
+ ByteString aName( "SFX_SLOT_" );
+ aName += pEntry->GetName();
+ return aName.ToUpperAscii();
+};
+
+void SvMetaSlot::WriteSlotStubs( const ByteString & rShellName,
+ ByteStringList & rList,
+ SvStream & rOutStm )
+{
+/*
+ ByteString aName = GetName();
+ SvMetaAttribute * pAttr = rAttrList.First();
+ while( pAttr )
+ {
+ if( pAttr->GetName() == aName )
+ break;
+ pAttr = rAttrList.Next();
+ }
+ if( pAttr )
+ return;
+*/
+ if ( !GetExport() && !GetHidden() )
+ return;
+
+ ByteString aMethodName( GetExecMethod() );
+ if ( aMethodName.Len() && aMethodName != "NoExec" )
+ {
+ BOOL bIn = FALSE;
+ for( USHORT n = 0; n < rList.Count(); n++ )
+ {
+ if( *(rList.GetObject(n)) == aMethodName )
+ {
+ bIn=TRUE;
+ break;
+ }
+ }
+
+ if ( !bIn )
+ {
+ rList.Insert( new ByteString(aMethodName), LIST_APPEND );
+ rOutStm << "SFX_EXEC_STUB("
+ << rShellName.GetBuffer()
+ << ','
+ << aMethodName.GetBuffer()
+ << ')' << endl;
+ }
+ }
+
+ aMethodName = GetStateMethod();
+ if ( aMethodName.Len() && aMethodName != "NoState" )
+ {
+ BOOL bIn = FALSE;
+ for ( USHORT n=0; n < rList.Count(); n++ )
+ {
+ if ( *(rList.GetObject(n)) == aMethodName )
+ {
+ bIn=TRUE;
+ break;
+ }
+ }
+
+ if ( !bIn )
+ {
+ rList.Insert( new ByteString(aMethodName), LIST_APPEND );
+ rOutStm << "SFX_STATE_STUB("
+ << rShellName.GetBuffer()
+ << ','
+ << aMethodName.GetBuffer()
+ << ')' << endl;
+ }
+ }
+}
+
+void SvMetaSlot::WriteSlot( const ByteString & rShellName, USHORT nCount,
+ const ByteString & rSlotId,
+ const ByteString & rValueName,
+ SvSlotElementList& rSlotList,
+ const ByteString & rPrefix,
+ SvIdlDataBase & rBase, SvStream & rOutStm )
+{
+ if ( !GetExport() && !GetHidden() )
+ return;
+
+// BOOL bIsEnumSlot = 0 != rValueName.Len();
+ BOOL bIsEnumSlot = 0 != pEnumValue;
+
+ rOutStm << "// Slot Nr. " << ByteString::CreateFromInt32(nListPos).GetBuffer() << " : ";
+ ByteString aSlotIdValue( ByteString::CreateFromInt32( GetSlotId().GetValue() ) );
+ rOutStm << aSlotIdValue.GetBuffer() << endl;
+ WriteTab( rOutStm, 1 );
+ if( bIsEnumSlot )
+ rOutStm << "SFX_NEW_SLOT_ENUM( ";
+ else
+ rOutStm << "SFX_NEW_SLOT_ARG( " << rShellName.GetBuffer() << ',' ;
+
+ rOutStm << rSlotId.GetBuffer() << ',';
+ const SvHelpContext& rHlpCtx = GetHelpContext();
+ if( rHlpCtx.IsSet() )
+ rOutStm << rHlpCtx.GetBuffer() << ',';
+ else
+ rOutStm << rSlotId.GetBuffer() << ',';
+
+ // GroupId
+ if( GetGroupId().Len() )
+ rOutStm << GetGroupId().GetBuffer();
+ else
+ rOutStm << '0';
+ rOutStm << ',' << endl;
+ WriteTab( rOutStm, 4 );
+
+ if( bIsEnumSlot )
+ {
+ rOutStm << "&a" << rShellName.GetBuffer() << "Slots_Impl["
+ << ByteString::CreateFromInt32(pLinkedSlot->GetListPos()).GetBuffer()
+ << "] /*Offset Master*/, " << endl;
+ WriteTab( rOutStm, 4 );
+ rOutStm << "&a" << rShellName.GetBuffer() << "Slots_Impl["
+ << ByteString::CreateFromInt32(pNextSlot->GetListPos()).GetBuffer()
+ << "] /*Offset Next*/, " << endl;
+
+ WriteTab( rOutStm, 4 );
+
+ // SlotId
+ if( GetSlotId().Len() )
+ rOutStm << pLinkedSlot->GetSlotId().GetBuffer();
+ else
+ rOutStm << '0';
+ rOutStm << ',';
+ rOutStm << pEnumValue->GetName().GetBuffer();
+ }
+ else
+ {
+ // Den n"achsten Slot suchen, der die gleiche StateMethod hat wie ich
+ // Die SlotList ist auf den aktuellen Slot geseekt
+ SvSlotElement * pEle = rSlotList.Next();
+ pNextSlot = pEle ? &pEle->xSlot : NULL;
+ while ( pNextSlot )
+ {
+ if ( !pNextSlot->pNextSlot &&
+ pNextSlot->GetStateMethod() == GetStateMethod() )
+ break;
+ pEle = rSlotList.Next();
+ pNextSlot = pEle ? &pEle->xSlot : NULL;
+ }
+
+ if ( !pNextSlot )
+ {
+ // Es gibt nach mir keinen Slot mehr, der die gleiche ExecMethode
+ // hat. Also suche ich den ersten Slot, der diese hatte (das
+ // k"onnte auch ich selbst sein)
+ pEle = rSlotList.First();
+ pNextSlot = pEle ? &pEle->xSlot : NULL;
+ while ( pNextSlot != this )
+ {
+ if ( !pNextSlot->pEnumValue &&
+ pNextSlot->GetStateMethod() == GetStateMethod() )
+ break;
+ pEle = rSlotList.Next();
+ pNextSlot = pEle ? &pEle->xSlot : NULL;
+ }
+ }
+
+ if ( !pLinkedSlot )
+ {
+ rOutStm << "0 ,";
+ }
+ else
+ {
+ rOutStm << "&a" << rShellName.GetBuffer() << "Slots_Impl["
+ << ByteString::CreateFromInt32(pLinkedSlot->GetListPos()).GetBuffer()
+ << "] /*Offset Linked*/, " << endl;
+ WriteTab( rOutStm, 4 );
+ }
+
+ rOutStm << "&a" << rShellName.GetBuffer() << "Slots_Impl["
+ << ByteString::CreateFromInt32(pNextSlot->GetListPos()).GetBuffer()
+ << "] /*Offset Next*/, " << endl;
+
+ WriteTab( rOutStm, 4 );
+
+ // ExecMethod schreiben, wenn nicht angegeben, standard Namen
+ if( GetExecMethod().Len() && GetExecMethod() != "NoExec")
+ rOutStm << "SFX_STUB_PTR(" << rShellName.GetBuffer() << ','
+ << GetExecMethod().GetBuffer() << ')';
+ else
+ rOutStm << "SFX_STUB_PTR_EXEC_NONE";
+ rOutStm << ',';
+
+ // StateMethod schreiben, wenn nicht angegeben, standard Namen
+ if( GetStateMethod().Len() && GetStateMethod() != "NoState")
+ rOutStm << "SFX_STUB_PTR(" << rShellName.GetBuffer() << ','
+ << GetStateMethod().GetBuffer() << ')';
+ else
+ rOutStm << "SFX_STUB_PTR_STATE_NONE";
+ }
+ rOutStm << ',' << endl;
+ WriteTab( rOutStm, 4 );
+
+ // Flags schreiben
+ if( GetHasCoreId() )
+ rOutStm << MakeSlotName( SvHash_HasCoreId() ).GetBuffer() << '|';
+ if( GetCachable() )
+ rOutStm << MakeSlotName( SvHash_Cachable() ).GetBuffer() << '|';
+ if( GetVolatile() )
+ rOutStm << MakeSlotName( SvHash_Volatile() ).GetBuffer() << '|';
+ if( GetToggle() )
+ rOutStm << MakeSlotName( SvHash_Toggle() ).GetBuffer() << '|';
+ if( GetAutoUpdate() )
+ rOutStm << MakeSlotName( SvHash_AutoUpdate() ).GetBuffer() << '|';
+ if( GetSynchron() )
+ rOutStm << MakeSlotName( SvHash_Synchron() ).GetBuffer() << '|';
+ if( GetAsynchron() )
+ rOutStm << MakeSlotName( SvHash_Asynchron() ).GetBuffer() << '|';
+ if( GetRecordPerItem() )
+ rOutStm << MakeSlotName( SvHash_RecordPerItem() ).GetBuffer() << '|';
+ if( GetRecordPerSet() )
+ rOutStm << MakeSlotName( SvHash_RecordPerSet() ).GetBuffer() << '|';
+ if( GetRecordManual() )
+ rOutStm << MakeSlotName( SvHash_RecordManual() ).GetBuffer() << '|';
+ if( GetNoRecord() )
+ rOutStm << MakeSlotName( SvHash_NoRecord() ).GetBuffer() << '|';
+ if( GetRecordAbsolute() )
+ rOutStm << MakeSlotName( SvHash_RecordAbsolute() ).GetBuffer() << '|';
+ if( GetHasDialog() )
+ rOutStm << MakeSlotName( SvHash_HasDialog() ).GetBuffer() << '|';
+ if( GetMenuConfig() )
+ rOutStm << MakeSlotName( SvHash_MenuConfig() ).GetBuffer() << '|';
+ if( GetToolBoxConfig() )
+ rOutStm << MakeSlotName( SvHash_ToolBoxConfig() ).GetBuffer() << '|';
+ if( GetStatusBarConfig() )
+ rOutStm << MakeSlotName( SvHash_StatusBarConfig() ).GetBuffer() << '|';
+ if( GetAccelConfig() )
+ rOutStm << MakeSlotName( SvHash_AccelConfig() ).GetBuffer() << '|';
+ if( GetFastCall() )
+ rOutStm << MakeSlotName( SvHash_FastCall() ).GetBuffer() << '|';
+ if( GetContainer() )
+ rOutStm << MakeSlotName( SvHash_Container() ).GetBuffer() << '|';
+ if ( GetReadOnlyDoc() )
+ rOutStm << MakeSlotName( SvHash_ReadOnlyDoc() ).GetBuffer() << '|';
+ if( GetPlugComm() )
+ rOutStm << MakeSlotName( SvHash_PlugComm() ).GetBuffer() << '|';
+
+ rOutStm << '0';
+
+ rOutStm << ',' << endl;
+ WriteTab( rOutStm, 4 );
+ if ( !GetDisableFlags().Len() )
+ rOutStm << "0";
+ else
+ rOutStm << GetDisableFlags().GetBuffer();
+
+ // Attribut Typ schreiben
+ if( !bIsEnumSlot )
+ {
+ rOutStm << ',' << endl;
+ WriteTab( rOutStm, 4 );
+
+ SvMetaType * pT = GetSlotType();
+ if( !pT )
+ {
+ if( !IsVariable() )
+ pT = rBase.FindType( "SfxVoidItem" );
+ else
+ pT = GetType();
+ }
+ if( pT )
+ {
+ rOutStm << pT->GetName().GetBuffer();
+ if( !rBase.FindType( pT, rBase.aUsedTypes ) )
+ rBase.aUsedTypes.Append( pT );
+ }
+ else
+ rOutStm << "SfxVoidItem not defined";
+ }
+ else
+ {
+ SvMetaType *pT = rBase.FindType( "SfxBoolItem" );
+ if ( pT && !rBase.FindType( pT, rBase.aUsedTypes ) )
+ rBase.aUsedTypes.Append( pT );
+ }
+
+ if( !bIsEnumSlot )
+ {
+ rOutStm << ',' << endl;
+ WriteTab( rOutStm, 4 );
+ rOutStm << ByteString::CreateFromInt32( nCount ).GetBuffer() << "/*Offset*/, ";
+
+ if( IsMethod() )
+ {
+ SvMetaAttribute * pMethod = GetMethod();
+ SvMetaType * pType;
+ if( pMethod )
+ pType = pMethod->GetType();
+ else
+ pType = GetType();
+ ULONG nSCount = pType->GetAttrCount();
+ rOutStm << ByteString::CreateFromInt32( nSCount ).GetBuffer() << "/*Count*/";
+ }
+ else
+ rOutStm << '0';
+
+ // Name f"urs Recording
+ if ( GetExport() )
+ {
+ rOutStm << ",\"";
+ if( rPrefix.Len() )
+ rOutStm << rPrefix.GetBuffer();
+ rOutStm << '.';
+ if ( !IsVariable() || !GetType() ||
+ GetType()->GetBaseType()->GetType() != TYPE_STRUCT )
+ rOutStm << GetMangleName( FALSE ).GetBuffer();
+ rOutStm << "\",";
+ }
+ else
+ rOutStm << ", 0, ";
+
+ // Method/Property Flags
+ if( IsMethod() )
+ rOutStm << "SFX_SLOT_METHOD|";
+ if( IsVariable() )
+ {
+ rOutStm << "SFX_SLOT_PROPGET|";
+ if( !GetReadonly() )
+ rOutStm << "SFX_SLOT_PROPSET|";
+ }
+
+ rOutStm << '0';
+ }
+
+ if ( GetUnoName().Len() )
+ {
+ rOutStm << ",\"";
+ rOutStm << GetUnoName().GetBuffer();
+ rOutStm << "\"";
+ }
+ else
+ rOutStm << ", 0";
+
+ rOutStm << " )," << endl;
+}
+
+USHORT SvMetaSlot::WriteSlotParamArray( SvIdlDataBase & rBase, SvStream & rOutStm )
+{
+ if ( !GetExport() && !GetHidden() )
+ return 0;
+
+ SvMetaAttribute * pMethod = GetMethod();
+ if( IsMethod() )
+ {
+ SvMetaType * pType;
+ if( pMethod )
+ pType = pMethod->GetType();
+ else
+ pType = GetType();
+
+ if( !rBase.FindType( pType, rBase.aUsedTypes ) )
+ rBase.aUsedTypes.Append( pType );
+
+ const SvMetaAttributeMemberList & rList =
+ pType->GetAttrList();
+ for( ULONG n = 0; n < rList.Count(); n++ )
+ {
+ SvMetaAttribute * pPar = rList.GetObject( n );
+ SvMetaType * pPType = pPar->GetType();
+ WriteTab( rOutStm, 1 );
+ rOutStm << "SFX_ARGUMENT("
+ << pPar->GetSlotId().GetBuffer() << ',' // SlodId
+ // Parameter Name
+ << "\"" << pPar->GetName().GetBuffer() << "\","
+ // Item Name
+ << pPType->GetName().GetBuffer() << ")," << endl;
+ if( !rBase.FindType( pPType, rBase.aUsedTypes ) )
+ rBase.aUsedTypes.Append( pPType );
+ }
+ return (USHORT)rList.Count();
+ }
+ return 0;
+}
+
+USHORT SvMetaSlot::WriteSlotMap( const ByteString & rShellName, USHORT nCount,
+ SvSlotElementList& rSlotList,
+ const ByteString & rPrefix,
+ SvIdlDataBase & rBase,
+ SvStream & rOutStm )
+{
+ // SlotId, wenn nicht angegeben, aus Namen generieren
+ ByteString aSlotId = GetSlotId();
+
+ USHORT nSCount = 0;
+ if( IsMethod() )
+ {
+ SvMetaType * pType;
+ SvMetaAttribute * pMethod = GetMethod();
+ if( pMethod )
+ pType = pMethod->GetType();
+ else
+ pType = GetType();
+
+ nSCount = (USHORT)pType->GetAttrCount();
+ }
+
+ WriteSlot( rShellName, nCount, aSlotId, ByteString(),
+ rSlotList, rPrefix, rBase, rOutStm );
+/*
+ SvMetaTypeEnum * pEnum = NULL;
+ SvMetaType * pBType = GetType()->GetBaseType();
+ pEnum = PTR_CAST( SvMetaTypeEnum, pBType );
+ if( aPseudoSlots && pEnum )
+ {
+ rBase.nMasterPos = rBase.nSlotPos-1;
+ rBase.nEnumPos = rBase.nMasterPos + pEnum->Count() + 1;
+
+ for( ULONG n = 0; n < pEnum->Count(); n++ )
+ {
+ ByteString aValName = pEnum->GetObject( n )->GetName();
+ ByteString aSId( aSlotId );
+ if( GetPseudoPrefix().Len() )
+ aSId = GetPseudoPrefix();
+ aSId += '_';
+ USHORT nLen = pEnum->GetPrefix().Len();
+ aSId += aValName.Copy( pEnum->GetPrefix().Len() );
+ WriteSlot( rShellName, nCount + nSCount, aSId, aValName, rSlotList, rBase, rOutStm );
+ }
+ }
+*/
+ return nSCount;
+}
+
+/*************************************************************************
+|* SvMetaSlot::WriteSrc()
+*************************************************************************/
+void SvMetaSlot::WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm,
+ Table * pTable )
+{
+ if (!GetToolBoxConfig() && !GetAccelConfig() && !GetMenuConfig() && !GetStatusBarConfig() )
+ return;
+
+ ULONG nSId = GetSlotId().GetValue();
+ if( !pTable->IsKeyValid( nSId ) )
+ {
+ pTable->Insert( nSId, this );
+ rOutStm << "SfxSlotInfo " << ByteString::CreateFromInt32( nSId ).GetBuffer()
+ << endl << '{' << endl;
+
+ WriteTab( rOutStm, 1 );
+ ByteString aStr = GetConfigName();
+ if( !aStr.Len() )
+ aStr = GetName();
+
+ rOutStm << "SlotName = \"" << aStr.GetBuffer() << "\";" << endl;
+
+ aStr = GetHelpText();
+ if( aStr.Len() )
+ {
+ WriteTab( rOutStm, 1 );
+ rOutStm << "HelpText = \"" << aStr.GetBuffer() << "\";" << endl;
+ }
+
+ rOutStm << "};" << endl;
+ }
+
+ SvMetaTypeEnum * pEnum = PTR_CAST( SvMetaTypeEnum, GetType() );
+ if( GetPseudoSlots() && pEnum )
+ {
+ for( ULONG n = 0; n < pEnum->Count(); n++ )
+ {
+ ByteString aValName = pEnum->GetObject( n )->GetName();
+ ByteString aSId( GetSlotId() );
+ if( GetPseudoPrefix().Len() )
+ aSId = GetPseudoPrefix();
+ aSId += '_';
+ USHORT nLen = pEnum->GetPrefix().Len();
+ aSId += aValName.Copy( pEnum->GetPrefix().Len() );
+
+ ULONG nSId;
+ BOOL bIdOk = FALSE;
+ if( rBase.FindId( aSId, &nSId ) )
+ {
+ aSId = ByteString::CreateFromInt32( nSId );
+ bIdOk = TRUE;
+ }
+
+ // wenn Id nicht gefunden, immer schreiben
+ if( !bIdOk || !pTable->IsKeyValid( nSId ) )
+ {
+ pTable->Insert( nSId, this );
+ rOutStm << "SfxSlotInfo " << aSId.GetBuffer()
+ << endl << '{' << endl;
+
+ WriteTab( rOutStm, 1 );
+ rOutStm << "SlotName = \"" << aValName.GetBuffer() << "\";" << endl;
+
+ ByteString aStr = GetHelpText();
+ if( aStr.Len() )
+ {
+ WriteTab( rOutStm, 1 );
+ rOutStm << "HelpText = \"" << aStr.GetBuffer() << "\";" << endl;
+ }
+ rOutStm << "};" << endl;
+ }
+ }
+ }
+}
+
+void SvMetaSlot::WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm,
+ Table * pTable )
+{
+ ULONG nSId = GetSlotId().GetValue();
+ if( !pTable->IsKeyValid( nSId ) )
+ {
+ pTable->Insert( nSId, this );
+ rOutStm << "#define " << GetSlotId().GetBuffer() << '\t' << ByteString::CreateFromInt32( nSId ).GetBuffer() << endl;
+ }
+
+ SvMetaTypeEnum * pEnum = PTR_CAST( SvMetaTypeEnum, GetType() );
+ if( GetPseudoSlots() && pEnum )
+ {
+ for( ULONG n = 0; n < pEnum->Count(); n++ )
+ {
+ ByteString aValName = pEnum->GetObject( n )->GetName();
+ ByteString aSId( GetSlotId() );
+ if( GetPseudoPrefix().Len() )
+ aSId = GetPseudoPrefix();
+ aSId += '_';
+ USHORT nLen = pEnum->GetPrefix().Len();
+ aSId += aValName.Copy( pEnum->GetPrefix().Len() );
+
+ ULONG nSId;
+ BOOL bIdOk = FALSE;
+ if( rBase.FindId( aSId, &nSId ) )
+ {
+ aSId = ByteString::CreateFromInt32( nSId );
+ bIdOk = TRUE;
+ }
+
+ // wenn Id nicht gefunden, immer schreiben
+ if( !bIdOk || !pTable->IsKeyValid( nSId ) )
+ {
+ pTable->Insert( nSId, this );
+
+ rOutStm << "#define " << aSId.GetBuffer() << '\t'
+ << ByteString::CreateFromInt32( nSId ).GetBuffer() << endl;
+ }
+ }
+ }
+}
+
+
+void SvMetaSlot::CompareSlotAttributes( SvMetaSlot* pSlot )
+{
+ ByteString aStr = Compare( pSlot );
+
+ if ( GetMenuConfig() || GetToolBoxConfig() || GetAccelConfig() || GetStatusBarConfig() )
+ {
+ if ( GetHelpText().Len() )
+ {
+ ByteString aRefText( pSlot->GetHelpText() );
+ ByteString aText( GetHelpText() );
+ if ( !aText.Equals( aRefText ) )
+ {
+ aStr += " HelpText\n";
+ aStr += aText;
+ aStr += '\n';
+ aStr += aRefText;
+ aStr += '\n';
+ }
+ }
+
+ if ( GetConfigName().Len() )
+ {
+ ByteString aRefText( pSlot->GetConfigName() );
+ ByteString aText( GetConfigName() );
+ if ( !aText.Equals( aRefText ) )
+ {
+ aStr += " ConfigName\n";
+ aStr += aText;
+ aStr += '\n';
+ aStr += aRefText;
+ aStr += '\n';
+ }
+ }
+ }
+
+ if ( GetExport() && !GetName().Equals( pSlot->GetName() ) )
+ {
+ aStr += " Name\n";
+ aStr += GetName();
+ aStr += '\n';
+ aStr += pSlot->GetName();
+ aStr += '\n';
+ }
+
+ if ( (SvMetaType *)GetSlotType() != (SvMetaType *)pSlot->GetSlotType() )
+ aStr += " SlotType\n";
+
+ if ( GetMethod() && !pSlot->GetMethod() ||
+ !GetMethod() && pSlot->GetMethod() )
+ aStr += " Method\n";
+
+ if ( GetMethod() && pSlot->GetMethod() )
+ GetMethod()->Compare( pSlot->GetMethod() );
+
+ if ( !GetGroupId().Equals( pSlot->GetGroupId() ) )
+ aStr += " GroupId\n";
+
+ if ( GetHasCoreId() != (BOOL) pSlot->GetHasCoreId() )
+ aStr += " HasCoreId\n";
+
+ if ( !GetConfigId().Equals( pSlot->GetConfigId() ) )
+ aStr += " ConfigId\n";
+
+ if ( !GetDefault().Equals( pSlot->GetDefault() ) )
+ aStr += " Default\n";
+
+ if ( GetPseudoSlots() != pSlot->GetPseudoSlots() )
+ aStr += " PseudoSlots\n";
+
+ if ( GetCachable() != pSlot->GetCachable() )
+ aStr += " Cachable\n";
+
+ if ( GetVolatile() != pSlot->GetVolatile() )
+ aStr += " Volatile";
+
+ if ( GetToggle() != pSlot->GetToggle() )
+ aStr += " Toggle\n";
+
+ if ( GetAutoUpdate() != pSlot->GetAutoUpdate() )
+ aStr += " AutoUpdate\n";
+
+ if ( GetSynchron() != pSlot->GetSynchron() )
+ aStr += " Synchron\n";
+
+ if ( GetAsynchron() != pSlot->GetAsynchron() )
+ aStr += " Asynchron\n";
+
+ if ( GetRecordPerItem() != pSlot->GetRecordPerItem() )
+ aStr += " RecordPerItem\n";
+
+ if ( GetRecordPerSet() != pSlot->GetRecordPerSet() )
+ aStr += " RecordPerSet\n";
+
+ if ( GetRecordManual() != pSlot->GetRecordManual() )
+ aStr += " RecordManual\n";
+
+ if ( GetNoRecord() != pSlot->GetNoRecord() )
+ aStr += " NoRecord\n";
+
+ if ( GetRecordAbsolute() != pSlot->GetRecordAbsolute() )
+ aStr += " RecordAbsolute\n";
+
+ if ( GetHasDialog() != pSlot->GetHasDialog() )
+ aStr += " HasDialog\n";
+
+ if ( GetMenuConfig() != pSlot->GetMenuConfig() )
+ aStr += " MenuConfig\n";
+
+ if ( GetToolBoxConfig() != pSlot->GetToolBoxConfig() )
+ aStr += " ToolBoxConfig\n";
+
+ if ( GetStatusBarConfig() != pSlot->GetStatusBarConfig() )
+ aStr += " StatusBarConfig\n";
+
+ if ( GetAccelConfig() != pSlot->GetAccelConfig() )
+ aStr += " AccelConfig\n";
+
+ if ( pSlot->GetFastCall() && !GetFastCall() )
+ aStr += " FastCall\n";
+
+ if ( GetContainer() != pSlot->GetContainer() )
+ aStr += " Container\n";
+
+ if ( GetPlugComm() != pSlot->GetPlugComm() )
+ aStr += " PlugComm\n";
+
+ if ( !GetPseudoPrefix().Equals( pSlot->GetPseudoPrefix() ) )
+ aStr += " PseudoPrefix\n";
+
+ if ( IsVariable() != pSlot->IsVariable() )
+ aStr += " Variable\n";
+
+ if ( aStr.Len() )
+ {
+ DBG_ERROR( GetSlotId().GetBuffer() );
+ DBG_ERROR( aStr.GetBuffer() );
+ }
+}
+
+void WriteBool( BOOL bSet, SvStream& rStream )
+{
+ if ( bSet )
+ rStream << "TRUE" << ',';
+ else
+ rStream << "FALSE" << ',';
+}
+
+void SvMetaSlot::WriteCSV( SvIdlDataBase& rBase, SvStream& rStrm )
+{
+ rStrm << "PROJECT" << ",,";
+ if ( GetSlotType() )
+ rStrm << GetSlotType()->GetName().GetBuffer() << ',';
+ else
+ rStrm << ',';
+
+ rStrm << GetType()->GetSvName().GetBuffer() << ',';
+ rStrm << GetName().GetBuffer() << ',';
+ rStrm << GetUnoName().GetBuffer() << ',';
+ rStrm << GetSlotId().GetBuffer() << ',';
+ USHORT nId = (USHORT) GetSlotId().GetValue();
+ rStrm << ByteString::CreateFromInt32( GetSlotId().GetValue() ).GetBuffer() << ',';
+ rStrm << "\"" << GetConfigName().GetBuffer() << "\"" << ',';
+ rStrm << "\"" << GetHelpText().GetBuffer() << "\"" << ',';
+
+ rStrm << ",,,";
+
+ WriteBool( GetAccelConfig(), rStrm );
+ WriteBool( GetAutomation(), rStrm );
+ WriteBool( GetAutoUpdate(), rStrm );
+
+ if ( GetCachable() )
+ rStrm << "Cachable" << ',';
+ else
+ rStrm << "Volatile" << ',';
+
+ WriteBool( GetContainer(), rStrm );
+ WriteBool( GetExport(), rStrm );
+ WriteBool( GetFastCall(), rStrm );
+ WriteBool( GetHidden(), rStrm );
+
+ rStrm << GetGroupId().GetBuffer() << ',';
+
+ rStrm << ',';
+ rStrm << GetDisableFlags().GetBuffer() << ',';
+
+ WriteBool( GetHasCoreId(), rStrm );
+ WriteBool( GetHasDialog(), rStrm );
+ WriteBool( GetIsCollection(), rStrm );
+ WriteBool( GetMenuConfig(), rStrm );
+ WriteBool( GetPlugComm(), rStrm );
+ WriteBool( GetReadonly(), rStrm );
+ WriteBool( GetReadOnlyDoc(), rStrm );
+
+ if( GetRecordPerSet() )
+ rStrm << "RecordPerSet" << ',';
+ else
+ rStrm << "RecordPerItem" << ',';
+
+ WriteBool( GetRecordAbsolute(), rStrm );
+
+ rStrm << ',';
+
+ WriteBool( GetStatusBarConfig(), rStrm );
+
+ if( GetSynchron() )
+ rStrm << "Synchron" << ',';
+ else
+ rStrm << "Asynchron" << ',';
+
+ WriteBool( GetToggle(), rStrm );
+ WriteBool( GetToolBoxConfig(), rStrm );
+
+ if ( GetPseudoPrefix().Len() )
+ rStrm << GetPseudoPrefix().GetBuffer() << ',';
+ else
+ rStrm << ',';
+
+ rStrm << ',';
+
+ if ( GetType()->GetType() != TYPE_METHOD && GetMethod() )
+ {
+ rStrm << GetMethod()->GetType()->GetReturnType()->GetName().GetBuffer() << ',';
+ rStrm << GetMethod()->GetName().GetBuffer() << ',';
+ }
+ else
+ {
+ rStrm << ",,";
+ }
+
+ rStrm << "TRUE,";
+
+ if ( GetType()->GetType() == TYPE_METHOD || GetMethod() )
+ {
+ SvMetaAttributeMemberList *pList = &GetType()->GetAttrList();
+ if ( GetMethod() )
+ pList = &GetMethod()->GetType()->GetAttrList();
+
+ if( pList && pList->Count() )
+ {
+ rStrm << "\"(";
+ SvMetaAttribute* pAttr = pList->First();
+ while( pAttr )
+ {
+ pAttr->WriteCSV( rBase, rStrm );
+ pAttr = pList->Next();
+ if( pAttr )
+ rStrm << ',';
+ }
+ rStrm << ")\"";
+ }
+ else
+ rStrm << "()";
+ }
+
+ rStrm << endl;
+}
+
+#endif // IDL_COMPILER
+
+
diff --git a/idl/source/objects/types.cxx b/idl/source/objects/types.cxx
new file mode 100644
index 000000000000..82ea116b4d39
--- /dev/null
+++ b/idl/source/objects/types.cxx
@@ -0,0 +1,2840 @@
+/*************************************************************************
+ *
+ * $RCSfile: types.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:30:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <ctype.h>
+#include <stdio.h>
+
+#include <tools/debug.hxx>
+
+#include <attrib.hxx>
+#include <types.hxx>
+#include <globals.hxx>
+#include <database.hxx>
+#pragma hdrstop
+
+/****************** SvMetaAttribute *************************************/
+/************************************************************************/
+SV_IMPL_META_FACTORY1( SvMetaAttribute, SvMetaReference );
+#ifdef IDL_COMPILER
+SvAttributeList & SvMetaAttribute::GetAttributeList()
+{
+ if( !pAttribList )
+ {
+ pAttribList = new SvAttributeList();
+ }
+ return *pAttribList;
+}
+#endif
+/*************************************************************************
+|* SvMetaAttribute::SvMetaAttribute()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaAttribute::SvMetaAttribute()
+ : aExport( TRUE, FALSE )
+ , aHidden( FALSE, FALSE )
+ , aIsCollection ( FALSE, FALSE )
+ , aReadOnlyDoc ( TRUE, FALSE )
+ , aAutomation( TRUE, FALSE )
+ , bNewAttr( FALSE )
+{
+}
+
+SvMetaAttribute::SvMetaAttribute( SvMetaType * pType )
+ : aExport( TRUE, FALSE )
+ , aHidden( FALSE, FALSE )
+ , aAutomation( TRUE, FALSE )
+ , aIsCollection ( FALSE, FALSE)
+ , aReadOnlyDoc ( TRUE, FALSE)
+ , aType( pType )
+ , bNewAttr( FALSE )
+{
+}
+
+/*************************************************************************
+|* SvMetaAttribute::Load()
+|* SvMetaAttribute::Save()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaAttribute::Load( SvPersistStream & rStm )
+{
+ SvMetaReference::Load( rStm );
+
+ BYTE nMask;
+ rStm >> nMask;
+ if( nMask >= 0x100 )
+ {
+ rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ DBG_ERROR( "wrong format" )
+ return;
+ }
+ if( nMask & 0x01 )
+ {
+ SvMetaType * pType;
+ rStm >> pType;
+ aType = pType;
+ }
+ if( nMask & 0x02 ) rStm >> aSlotId;
+ if( nMask & 0x04 ) rStm >> aExport;
+ if( nMask & 0x08 ) rStm >> aReadonly;
+ if( nMask & 0x10 ) rStm >> aAutomation;
+ if( nMask & 0x20 ) rStm >> aIsCollection;
+ if( nMask & 0x40 ) rStm >> aReadOnlyDoc;
+ if( nMask & 0x80 ) rStm >> aHidden;
+}
+
+void SvMetaAttribute::Save( SvPersistStream & rStm )
+{
+ SvMetaReference::Save( rStm );
+
+ // Maske erstellen
+ BYTE nMask = 0;
+ if( aType.Is() ) nMask |= 0x1;
+ if( aSlotId.IsSet() ) nMask |= 0x2;
+ if( aExport.IsSet() ) nMask |= 0x4;
+ if( aReadonly.IsSet() ) nMask |= 0x8;
+ if( aAutomation.IsSet() ) nMask |= 0x10;
+ if( aIsCollection.IsSet() ) nMask |= 0x20;
+ if( aReadOnlyDoc.IsSet() ) nMask |= 0x40;
+ if( aHidden.IsSet() ) nMask |= 0x80;
+
+ // Daten schreiben
+ rStm << nMask;
+ if( nMask & 0x1 ) rStm << aType;
+ if( nMask & 0x2 ) rStm << aSlotId;
+ if( nMask & 0x4 ) rStm << aExport;
+ if( nMask & 0x8 ) rStm << aReadonly;
+ if( nMask & 0x10 ) rStm << aAutomation;
+ if( nMask & 0x20 ) rStm << aIsCollection;
+ if( nMask & 0x40 ) rStm << aReadOnlyDoc;
+ if( nMask & 0x80 ) rStm << aHidden;
+}
+
+/*************************************************************************
+|* SvMetaAttribute::GetType()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaType * SvMetaAttribute::GetType() const
+{
+ if( aType.Is() || !GetRef() ) return aType;
+ return ((SvMetaAttribute *)GetRef())->GetType();
+}
+
+/*************************************************************************
+|* SvMetaAttribute::GetSlotId()
+|*
+|* Beschreibung
+*************************************************************************/
+const SvNumberIdentifier & SvMetaAttribute::GetSlotId() const
+{
+ if( aSlotId.IsSet() || !GetRef() ) return aSlotId;
+ return ((SvMetaAttribute *)GetRef())->GetSlotId();
+}
+
+/*************************************************************************
+|* SvMetaAttribute::GetReadonly()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaAttribute::GetReadonly() const
+{
+ if( aReadonly.IsSet() || !GetRef() ) return aReadonly;
+ return ((SvMetaAttribute *)GetRef())->GetReadonly();
+}
+
+/*************************************************************************
+|* SvMetaAttribute::GetExport()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaAttribute::GetExport() const
+{
+ if( aExport.IsSet() || !GetRef() ) return aExport;
+ return ((SvMetaAttribute *)GetRef())->GetExport();
+}
+
+/*************************************************************************
+|* SvMetaAttribute::GetHidden()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaAttribute::GetHidden() const
+{
+ // Wenn Export gesetzt wurde, aber Hidden nicht, gilt der Default
+ // aHidden = !aExport
+ if ( aExport.IsSet() && !aHidden.IsSet() )
+ return !aExport;
+ else if( aHidden.IsSet() || !GetRef() )
+ return aHidden;
+ else
+ return ((SvMetaAttribute *)GetRef())->GetHidden();
+}
+
+/*************************************************************************
+|* SvMetaAttribute::GetAutomation()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaAttribute::GetAutomation() const
+{
+ if( aAutomation.IsSet() || !GetRef() ) return aAutomation;
+ return ((SvMetaAttribute *)GetRef())->GetAutomation();
+}
+
+BOOL SvMetaAttribute::GetIsCollection() const
+{
+ BOOL bRet;
+ if( aIsCollection.IsSet() || !GetRef() )
+ {
+ if ( aIsCollection.IsSet() )
+ {
+ bRet = aIsCollection;
+ return bRet;
+ }
+
+ return aIsCollection;
+ }
+
+ return ((SvMetaSlot *)GetRef())->GetIsCollection();
+}
+
+BOOL SvMetaAttribute::GetReadOnlyDoc() const
+{
+ if( aReadOnlyDoc.IsSet() || !GetRef() ) return aReadOnlyDoc;
+ return ((SvMetaSlot *)GetRef())->GetReadOnlyDoc();
+}
+
+/*************************************************************************
+|* SvMetaAttribute::IsMethod()
+|* SvMetaAttribute::IsVariable()
+|* SvMetaAttribute::GetMangleName()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaAttribute::IsMethod() const
+{
+ SvMetaType * pType = GetType();
+ DBG_ASSERT( pType, "no type for attribute" )
+ return pType->GetType() == TYPE_METHOD;
+}
+
+BOOL SvMetaAttribute::IsVariable() const
+{
+ SvMetaType * pType = GetType();
+ return pType->GetType() != TYPE_METHOD;
+}
+
+ByteString SvMetaAttribute::GetMangleName( BOOL bVariable ) const
+{
+ return GetName();
+}
+
+/*************************************************************************
+|* SvMetaAttribute::FillSbxObject()
+|*
+|* Beschreibung
+*************************************************************************/
+/*
+void SvMetaAttribute::FillSbxObject( SbxInfo * pInfo, USHORT nSbxFlags )
+{
+ SvMetaType * pType = GetType();
+ DBG_ASSERT( pType, "no type for attribute" )
+ if( !nSbxFlags )
+ { // Flags koennen vom Aufrufer ueberschrieben werden
+ if( pType->GetOut() )
+ {
+ nSbxFlags |= SBX_WRITE;
+ if( pType->GetIn() )
+ nSbxFlags |= SBX_READ;
+ }
+ else
+ nSbxFlags |= SBX_READ;
+ }
+ SvMetaType * pBaseType = pType->GetBaseType();
+ DBG_ASSERT( pBaseType, "no base type for attribute" )
+ if( pBaseType->GetType() == TYPE_STRUCT )
+ {
+ const SvMetaAttributeMemberList & rList = pBaseType->GetAttrList();
+ ULONG nCount = rList.Count();
+ for( ULONG i = 0; i < nCount; i++ )
+ rList.GetObject( i )->FillSbxObject( pInfo, nSbxFlags );
+ }
+ else
+ //MI: pInfo->AddParam( GetName(), pBaseType->GetSbxDataType(), nSbxFlags );
+ pInfo->AddParam( GetName(), SbxVARIANT, nSbxFlags );
+}
+*/
+
+/*************************************************************************
+|* SvMetaAttribute::FillSbxObject()
+|*
+|* Beschreibung
+*************************************************************************/
+/*
+void SvMetaAttribute::FillSbxObject( SvIdlDataBase & rBase,
+ SbxObject * pObj, BOOL bVariable )
+{
+ // keine Attribut fuer Automation
+ if( !GetAutomation() || !GetExport() )
+ return;
+
+ if( bVariable && IsVariable() )
+ {
+ SvMetaType * pType = GetType();
+ DBG_ASSERT( pType, "no type for attribute" )
+ SvMetaType * pBaseType = pType->GetBaseType();
+ DBG_ASSERT( pBaseType, "no base type for attribute" )
+
+ if( pBaseType->GetType() == TYPE_STRUCT )
+ {
+ SvNumberIdentifier aSlotId = rBase.aStructSlotId;
+ if ( GetSlotId().Len() )
+ rBase.aStructSlotId = GetSlotId();
+ const SvMetaAttributeMemberList & rList = pBaseType->GetAttrList();
+ ULONG nCount = rList.Count();
+ for( ULONG i = 0; i < nCount; i++ )
+ rList.GetObject( i )->FillSbxObject( rBase, pObj, bVariable );
+ rBase.aStructSlotId = aSlotId;
+ }
+ else
+ {
+ SbxPropertyRef xProp = new SbxProperty( GetName(), SbxVARIANT );
+ //MI: pBaseType->GetSbxDataType() );
+ if ( GetReadonly() || IsMethod() )
+ xProp->ResetFlag( SBX_WRITE );
+ xProp->SetUserData( MakeSlotValue( rBase, TRUE ) );
+ pType->FillSbxObject( xProp, bVariable );
+
+ pObj->Insert( &xProp );
+ }
+ }
+ else if( !bVariable && IsMethod() )
+ {
+ SvMetaType * pType = GetType();
+ SvMetaType * pRetBaseType = GetType()->GetReturnType()->GetBaseType();
+ SbxMethodRef xMeth = new SbxMethod( GetName(),
+ pRetBaseType->GetSbxDataType() );
+ xMeth->ResetFlag( SBX_WRITE );
+ xMeth->SetUserData( MakeSlotValue( rBase, FALSE ) );
+ pType->FillSbxObject( xMeth, bVariable );
+
+ pObj->Insert( &xMeth );
+ }
+}
+*/
+#ifdef IDL_COMPILER
+/*************************************************************************
+|* SvMetaAttribute::Test()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaAttribute::Test( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ BOOL bOk = TRUE;
+ if( GetType()->IsItem() && !GetSlotId().IsSet() )
+ {
+ rBase.SetError( "slot without id declared", rInStm.GetToken() );
+ rBase.WriteError( rInStm );
+ bOk = FALSE;
+ }
+ /*
+ if( !GetType()->IsItem() && GetSlotId().IsSet() )
+ {
+ rBase.SetError( "slot without item declared", rInStm.GetToken() );
+ rBase.WriteError( rInStm );
+ bOk = FALSE;
+ }
+ */
+ return bOk;
+}
+
+/*************************************************************************
+|* SvMetaAttribute::ReadSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaAttribute::ReadSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ UINT32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken();
+ if( !GetType() )
+ // Es wurde kein Typ im ctor mitgegeben
+ aType = rBase.ReadKnownType( rInStm );
+ BOOL bOk = FALSE;
+ if( GetType() )
+ {
+ ReadNameSvIdl( rBase, rInStm );
+ aSlotId.ReadSvIdl( rBase, rInStm );
+
+ bOk = TRUE;
+ SvToken * pTok = rInStm.GetToken();
+ if( bOk && pTok->IsChar() && pTok->GetChar() == '(' )
+ {
+ SvMetaTypeRef xT = new SvMetaType();
+ xT->SetRef( GetType() );
+ aType = xT;
+ bOk = aType->ReadMethodArgs( rBase, rInStm );
+ }
+ if( bOk )
+ bOk = SvMetaName::ReadSvIdl( rBase, rInStm );
+ }
+ else
+ rBase.SetError( "unknown type", rInStm.GetToken() );
+
+ if( !bOk )
+ rInStm.Seek( nTokPos );
+ return bOk;
+}
+
+/*************************************************************************
+|* SvMetaAttribute::WriteSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaAttribute::WriteSvIdl
+(
+ SvIdlDataBase & rBase,
+ SvStream & rOutStm,
+ USHORT nTab
+)
+{
+ SvMetaType * pType = GetType();
+ pType->WriteTypePrefix( rBase, rOutStm, nTab, WRITE_IDL );
+ rOutStm << ' ' << GetName().GetBuffer();
+ if( aSlotId.IsSet() )
+ rOutStm << ' ' << aSlotId.GetBuffer();
+ if( pType->GetType() == TYPE_METHOD )
+ pType->WriteMethodArgs( rBase, rOutStm, nTab, WRITE_IDL );
+ ULONG nPos = rOutStm.Tell();
+ rOutStm << endl;
+ SvMetaName::WriteSvIdl( rBase, rOutStm, nTab );
+ TestAndSeekSpaceOnly( rOutStm, nPos );
+}
+
+/*************************************************************************
+|* SvMetaAttribute::ReadAttributesSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaAttribute::ReadAttributesSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ SvMetaReference::ReadAttributesSvIdl( rBase, rInStm );
+ aSlotId.ReadSvIdl( rBase, SvHash_SlotId(), rInStm );
+ aExport.ReadSvIdl( SvHash_Export(), rInStm );
+ aHidden.ReadSvIdl( SvHash_Hidden(), rInStm );
+ aAutomation.ReadSvIdl( SvHash_Automation(), rInStm );
+ aIsCollection.ReadSvIdl( SvHash_IsCollection(), rInStm );
+ aReadOnlyDoc.ReadSvIdl( SvHash_ReadOnlyDoc(), rInStm );
+ if( aReadonly.ReadSvIdl( SvHash_Readonly(), rInStm ) )
+ {
+ if( GetType()->GetType() == TYPE_METHOD )
+ {
+ // Fehler setzen
+ rBase.SetError( "Readonly in function attribute", rInStm.GetToken() );
+ rBase.WriteError( rInStm );
+ }
+ }
+}
+
+/*************************************************************************
+|* SvMetaAttribute::WriteAttributesSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaAttribute::WriteAttributesSvIdl
+(
+ SvIdlDataBase & rBase,
+ SvStream & rOutStm,
+ USHORT nTab
+)
+{
+ SvMetaReference::WriteAttributesSvIdl( rBase, rOutStm, nTab );
+
+ //aSlotId.WriteSvIdl( SvHash_SlotId(), rOutStm, nTab );
+ if( !aExport || !aAutomation || aReadonly )
+ {
+ WriteTab( rOutStm, nTab );
+ rOutStm << "//class SvMetaAttribute" << endl;
+ if( !aExport )
+ {
+ WriteTab( rOutStm, nTab );
+ aExport.WriteSvIdl( SvHash_Export(), rOutStm );
+ rOutStm << ';' << endl;
+ }
+ if ( aHidden != aExport )
+ {
+ WriteTab( rOutStm, nTab );
+ aExport.WriteSvIdl( SvHash_Hidden(), rOutStm );
+ rOutStm << ';' << endl;
+ }
+ if( aReadonly )
+ {
+ WriteTab( rOutStm, nTab );
+ aReadonly.WriteSvIdl( SvHash_Readonly(), rOutStm );
+ rOutStm << ';' << endl;
+ }
+ if( !aAutomation )
+ {
+ WriteTab( rOutStm, nTab );
+ aAutomation.WriteSvIdl( SvHash_Automation(), rOutStm );
+ rOutStm << ';' << endl;
+ }
+ if( aIsCollection )
+ {
+ WriteTab( rOutStm, nTab );
+ aIsCollection.WriteSvIdl( SvHash_IsCollection(), rOutStm );
+ rOutStm << ';' << endl;
+ }
+ if( !aReadOnlyDoc )
+ {
+ WriteTab( rOutStm, nTab );
+ aReadOnlyDoc.WriteSvIdl( SvHash_ReadOnlyDoc(), rOutStm );
+ rOutStm << ';' << endl;
+ }
+ }
+}
+
+/*************************************************************************
+|* SvMetaAttribute::WriteParam()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaAttribute::WriteParam( SvIdlDataBase & rBase,
+ SvStream & rOutStm,
+ USHORT nTab,
+ WriteType nT )
+{
+ SvMetaType * pType = GetType();
+ DBG_ASSERT( pType, "no type for attribute" )
+ SvMetaType * pBaseType = pType->GetBaseType();
+ DBG_ASSERT( pBaseType, "no base type for attribute" )
+
+ if( nT == WRITE_ODL || nT == WRITE_DOCU
+ || nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
+ {
+ if( pBaseType->GetType() == TYPE_STRUCT )
+ {
+ const SvMetaAttributeMemberList & rList = pBaseType->GetAttrList();
+ ULONG nCount = rList.Count();
+ for( ULONG i = 0; i < nCount; i++ )
+ {
+ rList.GetObject( i )->WriteParam( rBase, rOutStm, nTab, nT );
+ if( i+1<nCount )
+ {
+// if ( nT == WRITE_DOCU )
+ rOutStm << ',';
+// else
+// rOutStm << ',' << endl;
+ }
+ }
+ }
+ else
+ {
+ if ( nT != WRITE_DOCU )
+ {
+ WriteTab( rOutStm, nTab );
+ pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
+ }
+
+ if( GetName().Len() )
+ {
+ rOutStm << ' ';
+ rOutStm << GetName().GetBuffer();
+ }
+
+ if ( nT == WRITE_DOCU )
+ {
+ if( pBaseType->GetType() == TYPE_METHOD ||
+ pBaseType->GetType() == TYPE_STRUCT ||
+ pBaseType->GetType() == TYPE_ENUM )
+ {
+ DBG_ERROR( "Falscher Parametertyp!" );
+ }
+ else
+ rOutStm << pBaseType->GetBasicPostfix().GetBuffer();
+ }
+ }
+ }
+/*
+ else if( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
+ {
+ pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
+ rOutStm << ' ';
+ rOutStm << GetName().GetBuffer();
+ }
+*/
+}
+
+/*************************************************************************
+|* SvMetaSlot::WriteSlotId()
+|*
+|* Beschreibung
+*************************************************************************/
+ULONG SvMetaAttribute::MakeSlotValue( SvIdlDataBase & rBase, BOOL bVar ) const
+{
+ const SvNumberIdentifier & rId = GetSlotId();
+ ULONG n = rId.GetValue();
+ if( rBase.aStructSlotId.Len() )
+ {
+ n = n << 20;
+ n += rBase.aStructSlotId.GetValue();
+ }
+ if( PTR_CAST( SvMetaSlot, this ) )
+ n |= 0x20000;
+ if( !bVar )
+ n += 0x10000;
+ else if ( GetIsCollection() )
+ n += 0x40000;
+ return n;
+}
+
+/*************************************************************************
+|* SvMetaSlot::WriteAttributes()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaAttribute::WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ if( nT == WRITE_ODL )
+ {
+ const SvNumberIdentifier & rId = GetSlotId();
+ BOOL bReadonly = GetReadonly() || ( nA & WA_READONLY );
+ if( (rId.IsSet() && !(nA & WA_STRUCT)) || bReadonly )
+ {
+ BOOL bVar = IsVariable();
+ if( nA & WA_VARIABLE )
+ bVar = TRUE;
+ else if( nA & WA_METHOD )
+ bVar = FALSE;
+
+ WriteTab( rOutStm, nTab );
+ rOutStm << "//class SvMetaAttribute" << endl;
+ if( rId.IsSet() && !(nA & WA_STRUCT) )
+ {
+ WriteTab( rOutStm, nTab );
+ rOutStm << "id("
+ << ByteString::CreateFromInt32(MakeSlotValue( rBase, bVar )).GetBuffer()
+ << ")," << endl;
+ }
+ if( bVar && (bReadonly || IsMethod()) )
+ {
+ WriteTab( rOutStm, nTab );
+ rOutStm << "readonly," << endl;
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|* SvMetaAttribute::WriteCSource()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaAttribute::WriteCSource( SvIdlDataBase & rBase, SvStream & rOutStm,
+ BOOL bSet )
+{
+ rOutStm << endl;
+ SvMetaType * pType = GetType();
+ SvMetaType * pBaseType = pType->GetBaseType();
+
+ // Bei Set ist der Return immer void
+ BOOL bVoid = bSet;
+ if( pBaseType->GetType() == TYPE_METHOD )
+ bVoid = pBaseType->GetReturnType()->GetBaseType()->GetName() == "void";
+
+ // Methoden/Funktions-Body ausgeben
+ rOutStm << '{' << endl;
+ WriteTab( rOutStm, 1 );
+// rOutStm << "if( SvIPCIsConnected() )" << endl;
+// WriteTab( rOutStm, 1 );
+// rOutStm << '{' << endl;
+// WriteTab( rOutStm, 2 );
+
+ if( !bVoid )
+ {
+ if ( pBaseType->GetCName() == "double" )
+ {
+ rOutStm << "return *(double*)";
+ }
+ else
+ {
+ rOutStm << "return (";
+ pType->WriteTypePrefix( rBase, rOutStm, 2, WRITE_C_SOURCE );
+ rOutStm << ") ";
+ }
+ }
+ rOutStm << "pODKCallFunction( "
+ << ByteString::CreateFromInt32(MakeSlotValue( rBase, IsVariable() )).GetBuffer();
+ rOutStm << ',' << endl;
+ WriteTab( rOutStm, 3 );
+ rOutStm << " h" << rBase.aIFaceName.GetBuffer() << " , ";
+
+ ByteString aParserStr;
+ if( pBaseType->GetType() == TYPE_METHOD || bSet )
+ aParserStr = pBaseType->GetParserString();
+ if( aParserStr.Len() )
+ {
+ rOutStm << '\"';
+ rOutStm << aParserStr.GetBuffer();
+ rOutStm << "\", ";
+ }
+ else
+ rOutStm << "NULL, ";
+
+ if( pBaseType->GetType() == TYPE_METHOD && !bVoid )
+ {
+ rOutStm << "'";
+ rOutStm << pBaseType->GetReturnType()->GetBaseType()->GetParserChar();
+ rOutStm << "'";
+ }
+ else if ( !bSet )
+ {
+ rOutStm << "'";
+ rOutStm << pBaseType->GetParserChar();
+ rOutStm << "'";
+ }
+ else
+ rOutStm << '0';
+
+ if( aParserStr.Len() )
+ {
+ rOutStm << ", ";
+ if( IsMethod() )
+ // void SetPosSize( C_Object *, C_Rectangle * pRect );
+ pBaseType->WriteParamNames( rBase, rOutStm, ByteString() );
+ else if( bSet )
+ pBaseType->WriteParamNames( rBase, rOutStm, GetName() );
+ }
+
+ rOutStm << " );" << endl;
+// WriteTab( rOutStm, 1 );
+// rOutStm << '}' << endl;
+// if( !bVoid )
+// {
+// WriteTab( rOutStm, 1 );
+// rOutStm << "return 0;" << endl;
+// }
+ rOutStm << '}' << endl;
+}
+
+/*************************************************************************
+|* SvMetaAttribute::WriteRecursiv_Impl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaAttribute::WriteRecursiv_Impl( SvIdlDataBase & rBase,
+ SvStream & rOutStm, USHORT nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ const SvMetaAttributeMemberList & rList = GetType()->GetBaseType()->GetAttrList();
+ ULONG nCount = rList.Count();
+
+ SvNumberIdentifier aSlotId = rBase.aStructSlotId;
+ if ( GetSlotId().Len() )
+ rBase.aStructSlotId = GetSlotId();
+
+ // Offizielle Hack-Schnittstelle von MM: spezielle Schalter werden "uber
+ // die WriteAttribute "ubergeben
+ if ( GetReadonly() )
+ nA |= WA_READONLY;
+
+ for( ULONG i = 0; i < nCount; i++ )
+ {
+ SvMetaAttribute *pAttr = rList.GetObject( i );
+ if ( nT == WRITE_DOCU )
+ pAttr->SetDescription( GetDescription() );
+ pAttr->Write( rBase, rOutStm, nTab, nT, nA );
+ if( nT == WRITE_ODL && i +1 < nCount )
+ rOutStm << ';' << endl;
+ }
+
+ rBase.aStructSlotId = aSlotId;
+}
+
+/*************************************************************************
+|* SvMetaAttribute::Write()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaAttribute::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ // keine Attribut fuer Automation
+ if( nT == WRITE_DOCU )
+ {
+ if ( GetHidden() )
+ return;
+ }
+ else if ( !GetAutomation() || !GetExport() )
+ return;
+
+ BOOL bVariable;
+ if( nA & WA_VARIABLE )
+ bVariable = TRUE;
+ else if( nA & WA_METHOD )
+ bVariable = FALSE;
+ else
+ bVariable = IsVariable();
+
+ SvMetaType * pType = GetType();
+ DBG_ASSERT( pType, "no type for attribute" )
+ SvMetaType * pBaseType = pType->GetBaseType();
+ DBG_ASSERT( pBaseType, "no base type for attribute" )
+ int nBType = pBaseType->GetType();
+
+ if( nT == WRITE_ODL )
+ {
+ if( (bVariable && IsVariable()) || (!bVariable && IsMethod()) )
+ {
+ if( nBType == TYPE_STRUCT )
+ WriteRecursiv_Impl( rBase, rOutStm, nTab, nT, nA );
+ else
+ {
+ SvMetaReference::Write( rBase, rOutStm, nTab, nT, nA );
+ WriteTab( rOutStm, nTab );
+ pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
+
+ if( GetName().Len() )
+ {
+ rOutStm << ' ';
+ rOutStm << GetName().GetBuffer();
+ }
+ if( pType->GetType() == TYPE_METHOD )
+ pType->WriteMethodArgs( rBase, rOutStm, nTab, nT );
+ }
+ }
+ }
+ else if( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
+ {
+ if( !bVariable && IsMethod() )
+ {
+ ByteString aName; // (rBase.GetActModulePrefix());
+ aName += rBase.aIFaceName;
+ aName += GetName();
+ const char * pName = aName.GetBuffer();
+ // Beispiel
+ // void SetPosSize( C_Object *, C_Rectangle * );
+ WriteTab( rOutStm, nTab );
+ pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
+// rOutStm << " SYSCALL";
+ rOutStm << ' ' << pName;
+ pType->WriteMethodArgs( rBase, rOutStm, nTab, nT );
+ if( nT == WRITE_C_HEADER )
+ rOutStm << ';' << endl << endl;
+ else
+ WriteCSource( rBase, rOutStm, FALSE );
+ }
+ else if ( bVariable && IsVariable() )
+ {
+ if( nBType == TYPE_STRUCT )
+ {
+ // Zur Hilfe den Namen des Properties als Kommentar ausgeben
+ rOutStm << "/* " << GetName().GetBuffer() << " */" << endl;
+
+ WriteRecursiv_Impl( rBase, rOutStm, nTab, nT, nA );
+ }
+ else
+ {
+ // Beispiel
+ // void SetValue( C_Object *, USHORT n );
+ ByteString aName = GetName();
+
+ BOOL bReadonly = GetReadonly() || ( nA & WA_READONLY );
+ if ( !bReadonly && !IsMethod() )
+ {
+ // Zuweisung
+ WriteTab( rOutStm, nTab );
+ rOutStm << "void ";
+// rOutStm << "SYSCALL ";
+// if ( rBase.GetActModulePrefix().Len() )
+// rOutStm << rBase.GetActModulePrefix().GetBuffer();
+ rOutStm << rBase.aIFaceName.GetBuffer()
+ << "Set" << aName.GetBuffer() << "( " << C_PREF
+ << "Object h" << rBase.aIFaceName.GetBuffer() << ", " << endl;
+ WriteTab( rOutStm, nTab+1 );
+ pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
+ rOutStm << ' ' << aName.GetBuffer() << " )";
+ if( nT == WRITE_C_HEADER )
+ rOutStm << ';' << endl << endl;
+ else
+ WriteCSource( rBase, rOutStm, TRUE );
+ }
+
+ // Zugriff
+ WriteTab( rOutStm, nTab );
+ pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
+ rOutStm << ' ';
+// rOutStm << "SYSCALL ";
+// if ( rBase.GetActModulePrefix().Len() )
+// rOutStm << rBase.GetActModulePrefix().GetBuffer();
+ rOutStm << rBase.aIFaceName.GetBuffer()
+ << "Get" << aName.GetBuffer() << "( " << C_PREF
+ << "Object h" << rBase.aIFaceName.GetBuffer() << " )";
+ if( nT == WRITE_C_HEADER )
+ rOutStm << ';' << endl << endl;
+ else
+ WriteCSource( rBase, rOutStm, FALSE );
+ }
+ }
+ }
+ else if ( nT == WRITE_DOCU )
+ {
+ if( !bVariable && IsMethod() )
+ {
+ rOutStm << "<METHOD>" << endl
+ << GetSlotId().GetBuffer() << endl
+ << GetName().GetBuffer() << endl
+ << endl; // readonly
+
+ // Returntype
+ SvMetaType* pType = GetType();
+ SvMetaType* pBaseType = pType->GetBaseType();
+ rOutStm << pBaseType->GetReturnType()->GetBaseType()->GetBasicName().GetBuffer() << endl;
+
+ DBG_ASSERT( pBaseType->GetReturnType()->GetBaseType()->GetBasicName().Len(),
+ "Leerer BasicName" );
+
+ // Syntax
+ rOutStm << GetName().GetBuffer();
+ pType->WriteMethodArgs( rBase, rOutStm, nTab, nT );
+
+ // C-Returntype
+ pBaseType->WriteTypePrefix( rBase, rOutStm, 0, WRITE_C_HEADER );
+ rOutStm << endl;
+
+ // Bei Methoden auch C-Syntax
+ rOutStm << "<C-SYNTAX>" << endl;
+ Write( rBase, rOutStm, 0, WRITE_C_HEADER, nA );
+ rOutStm << "</C-SYNTAX>" << endl;
+
+ // Description
+ WriteDescription( rBase, rOutStm );
+ rOutStm << "</METHOD>" << endl << endl;
+ }
+ else if( bVariable && IsVariable() )
+ {
+ if( nBType == TYPE_STRUCT )
+ {
+ WriteRecursiv_Impl( rBase, rOutStm, nTab, nT, nA );
+ }
+ else
+ {
+ rOutStm << "<PROPERTY>" << endl
+ << GetSlotId().GetBuffer() << endl
+ << GetName().GetBuffer() << endl;
+ if ( GetReadonly() )
+ rOutStm << "(nur lesen)" << endl;
+ else
+ rOutStm << endl;
+
+ // Bei properties Type anstelle des return value
+ rOutStm << pBaseType->GetBasicName().GetBuffer() << endl;
+
+ DBG_ASSERT( pBaseType->GetBasicName().Len(),
+ "Leerer BasicName" );
+
+ // Bei properties keine Syntax
+ rOutStm << endl;
+
+ // C-Returntype
+ pBaseType->WriteTypePrefix( rBase, rOutStm, 0, WRITE_C_HEADER );
+ rOutStm << endl;
+
+ // Description
+ WriteDescription( rBase, rOutStm );
+ rOutStm << "</PROPERTY>" << endl << endl;
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|* SvMetaAttribute::MakeSfx()
+|*
+|* Beschreibung
+*************************************************************************/
+ULONG SvMetaAttribute::MakeSfx( ByteString * pAttrArray )
+{
+ SvMetaType * pType = GetType();
+ DBG_ASSERT( pType, "no type for attribute" )
+ SvMetaType * pBaseType = pType->GetBaseType();
+ DBG_ASSERT( pBaseType, "no base type for attribute" )
+ if( pBaseType->GetType() == TYPE_STRUCT )
+ return pBaseType->MakeSfx( pAttrArray );
+ else
+ {
+ *pAttrArray += '{';
+ *pAttrArray += GetSlotId();
+ *pAttrArray += ",\"";
+ *pAttrArray += GetName();
+ *pAttrArray += "\"}";
+ return 1;
+ }
+}
+
+void SvMetaAttribute::Insert (SvSlotElementList&, const ByteString &, SvIdlDataBase&)
+{
+}
+
+/*************************************************************************
+|* SvMetaAttribute::WriteSrc()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaAttribute::WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm,
+ Table * pIdTable )
+{
+}
+
+void SvMetaAttribute::WriteHelpId( SvIdlDataBase & rBase, SvStream & rOutStm,
+ Table * pIdTable )
+{
+}
+
+#endif // IDL_COMPILER
+
+/****************** SvMetaType *************************************/
+/************************************************************************/
+SV_IMPL_META_FACTORY1( SvMetaType, SvMetaExtern );
+#ifdef IDL_COMPILER
+SvAttributeList & SvMetaType::GetAttributeList()
+{
+ if( !pAttribList )
+ {
+ pAttribList = new SvAttributeList();
+ }
+ return *pAttribList;
+}
+#endif
+/*************************************************************************
+|* SvMetaType::SvMetaType()
+|*
+|* Beschreibung
+*************************************************************************/
+#define CTOR \
+ : aCall0( CALL_VALUE, FALSE ) \
+ , aCall1( CALL_VALUE, FALSE ) \
+ , aSbxDataType( 0, FALSE ) \
+ , pAttrList( NULL ) \
+ , nType( TYPE_BASE ) \
+ , bIsShell( FALSE ) \
+ , bIsItem( FALSE ) \
+ , cParserChar( 'h' )
+
+SvMetaType::SvMetaType()
+ CTOR
+{
+}
+
+SvMetaType::SvMetaType( const ByteString & rName, char cPC,
+ const ByteString & rCName )
+ CTOR
+{
+ SetName( rName );
+ cParserChar = cPC;
+ aCName = rCName;
+}
+
+SvMetaType::SvMetaType( const ByteString & rName,
+ const ByteString & rSbxName,
+ const ByteString & rOdlName,
+ char cPc,
+ const ByteString & rCName,
+ const ByteString & rBasicName,
+ const ByteString & rBasicPostfix )
+ CTOR
+{
+// aSbxDataType = (int)nT;
+ SetName( rName );
+ aSbxName = rSbxName;
+ aOdlName = rOdlName;
+ cParserChar = cPc;
+ aCName = rCName;
+ aBasicName = rBasicName;
+ aBasicPostfix = rBasicPostfix;
+}
+
+void SvMetaType::Load( SvPersistStream & rStm )
+{
+ SvMetaExtern::Load( rStm );
+
+ USHORT nMask;
+ rStm >> nMask;
+ if( nMask & 0x0001 ) rStm >> aIn;
+ if( nMask & 0x0002 ) rStm >> aOut;
+ if( nMask & 0x0004 ) rStm >> aCall0;
+ if( nMask & 0x0008 ) rStm >> aCall1;
+ if( nMask & 0x0010 ) rStm >> aSbxDataType;
+ if( nMask & 0x0020 ) rStm >> aSvName;
+ if( nMask & 0x0040 ) rStm >> aSbxName;
+ if( nMask & 0x0080 ) rStm >> aOdlName;
+ if( nMask & 0x0100 ) rStm >> GetAttrList();
+ if( nMask & 0x0200 ) bIsItem = TRUE;
+ if( nMask & 0x0400 ) bIsShell = TRUE;
+ if( nMask & 0x0800 )
+ {
+ USHORT nT;
+ rStm >> nT;
+ nType = nT;
+ }
+ if( nMask & 0x1000 ) rStm >> cParserChar;
+ if( nMask & 0x2000 ) rStm >> aCName;
+ if( nMask & 0x4000 ) rStm >> aBasicName;
+ if( nMask & 0x8000 ) rStm >> aBasicPostfix;
+}
+
+void SvMetaType::Save( SvPersistStream & rStm )
+{
+ SvMetaExtern::Save( rStm );
+
+ // Maske erstellen
+ USHORT nMask = 0;
+ if( aIn.IsSet() ) nMask |= 0x0001;
+ if( aOut.IsSet() ) nMask |= 0x0002;
+ if( aCall0.IsSet() ) nMask |= 0x0004;
+ if( aCall1.IsSet() ) nMask |= 0x0008;
+ if( aSbxDataType.IsSet() ) nMask |= 0x0010;
+ if( aSvName.IsSet() ) nMask |= 0x0020;
+ if( aSbxName.IsSet() ) nMask |= 0x0040;
+ if( aOdlName.IsSet() ) nMask |= 0x0080;
+ if( GetAttrCount() ) nMask |= 0x0100;
+ if( bIsItem ) nMask |= 0x0200;
+ if( bIsShell ) nMask |= 0x0400;
+ if( nType != TYPE_BASE ) nMask |= 0x0800;
+ if( cParserChar != 'h' ) nMask |= 0x1000;
+ if( aCName.IsSet() ) nMask |= 0x2000;
+ if( aBasicName.IsSet() ) nMask |= 0x4000;
+ if( aBasicPostfix.IsSet() ) nMask |= 0x8000;
+
+ // Daten schreiben
+ rStm << nMask;
+ if( nMask & 0x0001 ) rStm << aIn;
+ if( nMask & 0x0002 ) rStm << aOut;
+ if( nMask & 0x0004 ) rStm << aCall0;
+ if( nMask & 0x0008 ) rStm << aCall1;
+ if( nMask & 0x0010 ) rStm << aSbxDataType;
+ if( nMask & 0x0020 ) rStm << aSvName;
+ if( nMask & 0x0040 ) rStm << aSbxName;
+ if( nMask & 0x0080 ) rStm << aOdlName;
+ if( nMask & 0x0100 ) rStm << *pAttrList;
+ if( nMask & 0x0800 ) rStm << (USHORT)nType;
+ if( nMask & 0x1000 ) rStm << cParserChar;
+ if( nMask & 0x2000 ) rStm << aCName;
+ if( nMask & 0x4000 ) rStm << aBasicName;
+ if( nMask & 0x8000 ) rStm << aBasicPostfix;
+}
+
+/*************************************************************************
+|* SvMetaType::GetAttrList()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaAttributeMemberList & SvMetaType::GetAttrList() const
+{
+ if( !pAttrList )
+ ((SvMetaType *)this)->pAttrList = new SvMetaAttributeMemberList();
+ return *pAttrList;
+}
+
+/*************************************************************************
+|* SvMetaType::SetType()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::SetType( int nT )
+{
+ nType = nT;
+ if( nType == TYPE_ENUM )
+ {
+ aOdlName = "short";
+// aSbxDataType = SbxINTEGER;
+ }
+ else if( nType == TYPE_CLASS )
+ {
+ aCName = C_PREF;
+ aCName += "Object *";
+ }
+}
+
+/*************************************************************************
+|* SvMetaType::GetBaseType()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaType * SvMetaType::GetBaseType() const
+{
+ if( GetRef() && GetType() == TYPE_BASE )
+ return ((SvMetaType *)GetRef())->GetBaseType();
+ return (SvMetaType *)this;
+}
+
+/*************************************************************************
+|* SvMetaType::GetReturnType()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaType * SvMetaType::GetReturnType() const
+{
+ DBG_ASSERT( GetType() == TYPE_METHOD, "no method" )
+ DBG_ASSERT( GetRef(), "no return type" )
+ return (SvMetaType *)GetRef();
+}
+
+/*************************************************************************
+|* SvMetaType::GetSbxDataType()
+|*
+|* Beschreibung
+*************************************************************************/
+/*
+SbxDataType SvMetaType::GetSbxDataType() const
+{
+ if( aSbxDataType.IsSet() || !GetRef() )
+ return (SbxDataType)(int)aSbxDataType;
+ else
+ return ((SvMetaType *)GetRef())->GetSbxDataType();
+}
+*/
+/*************************************************************************
+|* SvMetaType::GetBasicName()
+|*
+|* Beschreibung
+*************************************************************************/
+const ByteString& SvMetaType::GetBasicName() const
+{
+ if( aBasicName.IsSet() || !GetRef() )
+ return aBasicName;
+ else
+ return ((SvMetaType*)GetRef())->GetBasicName();
+}
+
+/*************************************************************************
+|* SvMetaType::GetBasicPostfix()
+|*
+|* Beschreibung
+*************************************************************************/
+ByteString SvMetaType::GetBasicPostfix() const
+{
+
+ ByteString aRet;
+
+ // MBN und Co wollen immer "As xxx"
+/*
+ if( aBasicPostfix.IsSet() || !GetRef() )
+ aRet = aBasicPostfix;
+ else
+ aRet = ((SvMetaType*)GetRef())->GetBasicPostfix();
+
+ if ( !aRet.Len() && GetBasicName().Len() )
+*/
+ {
+
+ aRet = " As ";
+ aRet += GetBasicName();
+ }
+
+ return aRet;
+}
+
+/*************************************************************************
+|* SvMetaType::GetIn()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaType::GetIn() const
+{
+ if( aIn.IsSet() || !GetRef() )
+ return aIn;
+ else
+ return ((SvMetaType *)GetRef())->GetIn();
+}
+
+/*************************************************************************
+|* SvMetaType::GetOut()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaType::GetOut() const
+{
+ if( aOut.IsSet() || !GetRef() )
+ return aOut;
+ else
+ return ((SvMetaType *)GetRef())->GetOut();
+}
+
+/*************************************************************************
+|* SvMetaType::SetCall0()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::SetCall0( int e )
+{
+ aCall0 = (int)e;
+ if( aCall0 == CALL_VALUE && aCall1 == CALL_VALUE )
+ {
+ if( GetType() == TYPE_POINTER )
+ SetType( TYPE_BASE );
+ }
+ else
+ {
+ DBG_ASSERT( nType == TYPE_POINTER || nType == TYPE_BASE,
+ "set no base type to pointer" )
+ SetType( TYPE_POINTER );
+ }
+}
+
+/*************************************************************************
+|* SvMetaType::GetCall0()
+|*
+|* Beschreibung
+*************************************************************************/
+int SvMetaType::GetCall0() const
+{
+ if( aCall0.IsSet() || !GetRef() )
+ return aCall0;
+ else
+ return ((SvMetaType *)GetRef())->GetCall0();
+}
+
+/*************************************************************************
+|* SvMetaType::SetCall1()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::SetCall1( int e )
+{
+ aCall1 = (int)e;
+ if( aCall0 == CALL_VALUE && aCall1 == CALL_VALUE )
+ {
+ if( GetType() == TYPE_POINTER )
+ SetType( TYPE_BASE );
+ }
+ else
+ {
+ DBG_ASSERT( nType == TYPE_POINTER || nType == TYPE_BASE,
+ "set no base type to pointer" )
+ SetType( TYPE_POINTER );
+ }
+}
+
+/*************************************************************************
+|* SvMetaType::GetCall1()
+|*
+|* Beschreibung
+*************************************************************************/
+int SvMetaType::GetCall1() const
+{
+ if( aCall1.IsSet() || !GetRef() )
+ return aCall1;
+ else
+ return ((SvMetaType *)GetRef())->GetCall1();
+}
+
+/*************************************************************************
+|* SvMetaType::GetSvName()
+|*
+|* Beschreibung
+*************************************************************************/
+const ByteString & SvMetaType::GetSvName() const
+{
+ if( aSvName.IsSet() || !GetRef() )
+ return aSvName;
+ else
+ return ((SvMetaType *)GetRef())->GetSvName();
+}
+
+/*************************************************************************
+|* SvMetaType::GetSbxName()
+|*
+|* Beschreibung
+*************************************************************************/
+const ByteString & SvMetaType::GetSbxName() const
+{
+ if( aSbxName.IsSet() || !GetRef() )
+ return aSbxName;
+ else
+ return ((SvMetaType *)GetRef())->GetSbxName();
+}
+
+/*************************************************************************
+|* SvMetaType::GetOdlName()
+|*
+|* Beschreibung
+*************************************************************************/
+const ByteString & SvMetaType::GetOdlName() const
+{
+ if( aOdlName.IsSet() || !GetRef() )
+ return aOdlName;
+ else
+ return ((SvMetaType *)GetRef())->GetOdlName();
+}
+
+/*************************************************************************
+|* SvMetaType::GetCName()
+|*
+|* Beschreibung
+*************************************************************************/
+const ByteString & SvMetaType::GetCName() const
+{
+ if( aCName.IsSet() || !GetRef() )
+ return aCName;
+ else
+ return ((SvMetaType *)GetRef())->GetCName();
+}
+
+/*************************************************************************
+|* SvMetaType::SetName()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaType::SetName( const ByteString & rName, SvIdlDataBase * pBase )
+{
+ aSvName = rName;
+ aSbxName = rName;
+ aCName = rName;
+ if( GetType() != TYPE_ENUM )
+ aOdlName = rName;
+ return SvMetaReference::SetName( rName, pBase );
+}
+
+/*************************************************************************
+|* SvMetaType::FillSbxObject()
+|*
+|* Beschreibung
+*************************************************************************/
+/*
+void SvMetaType::FillSbxObject( SbxVariable * pObj, BOOL bVariable )
+{
+ if( PTR_CAST( SbxMethod, pObj ) )
+ {
+ if( GetType() == TYPE_METHOD )
+ {
+ ULONG nCount = GetAttrCount();
+ if( nCount )
+ {
+ SbxInfoRef xInfo = pObj->GetInfo();
+ if( !xInfo.Is() )
+ {
+ xInfo = new SbxInfo();
+ pObj->SetInfo( xInfo );
+ }
+ for( ULONG n = nCount; n > 0; n-- )
+ pAttrList->GetObject( n -1 )->FillSbxObject( xInfo );
+ }
+ }
+ }
+}
+*/
+#ifdef IDL_COMPILER
+/*************************************************************************
+|* SvMetaType::GetString()
+|*
+|* Beschreibung
+*************************************************************************/
+ByteString SvMetaType::GetCString() const
+{
+ ByteString aOut( GetSvName() );
+ if( aCall0 == (int)CALL_POINTER )
+ aOut += " *";
+ else if( aCall0 == (int)CALL_REFERENCE )
+ aOut += " &";
+ if( aCall1 == (int)CALL_POINTER )
+ aOut += '*';
+ else if( aCall1 == (int)CALL_REFERENCE )
+ aOut += '&';
+ return aOut;
+}
+
+/*************************************************************************
+|* SvMetaType::ReadHeaderSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaType::ReadHeaderSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ BOOL bOk = FALSE;
+ UINT32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+
+ if( pTok->Is( SvHash_interface() )
+ || pTok->Is( SvHash_shell() ) )
+ {
+ if( pTok->Is( SvHash_shell() ) )
+ bIsShell = TRUE;
+ SetType( TYPE_CLASS );
+ bOk = ReadNamesSvIdl( rBase, rInStm );
+
+ }
+ else if( pTok->Is( SvHash_struct() ) )
+ {
+ SetType( TYPE_STRUCT );
+ bOk = ReadNamesSvIdl( rBase, rInStm );
+ }
+ else if( pTok->Is( SvHash_union() ) )
+ {
+ SetType( TYPE_UNION );
+ if( ReadNameSvIdl( rBase, rInStm ) )
+ return TRUE;
+ }
+ else if( pTok->Is( SvHash_enum() ) )
+ {
+ SetType( TYPE_ENUM );
+ bOk = ReadNameSvIdl( rBase, rInStm );
+ }
+ else if( pTok->Is( SvHash_typedef() )
+ || pTok->Is( SvHash_item() ) )
+ {
+ if( pTok->Is( SvHash_item() ) )
+ bIsItem = TRUE;
+
+ SvMetaType * pType = rBase.ReadKnownType( rInStm );
+ if( pType )
+ {
+ SetRef( pType );
+ if( ReadNameSvIdl( rBase, rInStm ) )
+ {
+ /* // um aufwaertskompatibel zu bleiben
+ aOdlName = pType->GetOdlName();
+ */
+ if( rInStm.Read( '(' ) )
+ {
+ //DoReadContextSvIdl( rBase, rInStm, ',' );
+ DoReadContextSvIdl( rBase, rInStm );
+ if( rInStm.Read( ')' ) )
+ {
+ SetType( TYPE_METHOD );
+ bOk = TRUE;
+ }
+ }
+ else
+ {
+ bOk = TRUE;
+ }
+ }
+ }
+ else
+ {
+ ByteString aStr = "wrong typedef: ";
+ rBase.SetError( aStr, rInStm.GetToken() );
+ rBase.WriteError( rInStm );
+ }
+ }
+ if( bOk )
+ SetModule( rBase );
+ else
+ rInStm.Seek( nTokPos );
+ return bOk;
+}
+
+/*************************************************************************
+|* SvMetaType::ReadSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaType::ReadSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ if( ReadHeaderSvIdl( rBase, rInStm ) )
+ {
+ rBase.Write( '.' );
+ return SvMetaExtern::ReadSvIdl( rBase, rInStm );
+ }
+ return FALSE;
+}
+
+/*************************************************************************
+|* SvMetaType::WriteSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::WriteSvIdl
+(
+ SvIdlDataBase & rBase,
+ SvStream & rOutStm,
+ USHORT nTab
+)
+{
+ WriteHeaderSvIdl( rBase, rOutStm, nTab );
+ if( GetType() == TYPE_METHOD )
+ WriteMethodArgs( rBase, rOutStm, nTab, WRITE_IDL );
+
+ ULONG nOldPos = rOutStm.Tell();
+ rOutStm << endl;
+ SvMetaExtern::WriteSvIdl( rBase, rOutStm, nTab );
+ if( TestAndSeekSpaceOnly( rOutStm, nOldPos ) )
+ // nichts geschrieben
+ rOutStm.Seek( nOldPos );
+ rOutStm << ';' << endl;
+}
+
+/*************************************************************************
+|* SvMetaType::WriteContext()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ if( GetAttrCount() )
+ {
+ SvMetaAttribute * pAttr = pAttrList->First();
+ while( pAttr )
+ {
+ pAttr->Write( rBase, rOutStm, nTab, nT, nA );
+ if( GetType() == TYPE_METHOD )
+ rOutStm << ',' << endl;
+ else
+ rOutStm << ';' << endl;
+ pAttr = pAttrList->Next();
+ }
+ }
+}
+
+/*************************************************************************
+|* SvMetaType::Write()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ if( nT == WRITE_C_HEADER && nType != TYPE_ENUM )
+ // nur enum schreiben
+ return;
+
+ ByteString aName = GetName();
+ if( nT == WRITE_ODL || nT == WRITE_C_HEADER || nT == WRITE_CXX_HEADER )
+ {
+ switch( nType )
+ {
+ case TYPE_CLASS:
+ {
+ }
+ break;
+ case TYPE_STRUCT:
+ case TYPE_UNION:
+ case TYPE_ENUM:
+ {
+ WriteStars( rOutStm );
+ if( nType == TYPE_STRUCT || nType == TYPE_UNION )
+ nA = WA_STRUCT;
+
+ if( nT == WRITE_ODL || nT == WRITE_C_HEADER)
+ {
+ if ( nT == WRITE_C_HEADER )
+ {
+ ByteString aStr = aName;
+ aStr.ToUpperAscii();
+ rOutStm << "#ifndef " << C_PREF << aStr.GetBuffer() << "_DEF " << endl;
+ rOutStm << "#define " << C_PREF << aStr.GetBuffer() << "_DEF " << endl;
+ }
+
+ WriteTab( rOutStm, nTab );
+ rOutStm << "typedef" << endl;
+ if ( nT == WRITE_ODL )
+ SvMetaName::Write( rBase, rOutStm, nTab, nT, nA );
+ }
+ WriteTab( rOutStm, nTab );
+ if( nType == TYPE_STRUCT )
+ rOutStm << "struct";
+ else if( nType == TYPE_UNION )
+ rOutStm << "union";
+ else
+ rOutStm << "enum";
+ if( nT != WRITE_ODL && nT != WRITE_C_HEADER)
+ rOutStm << ' ' << aName.GetBuffer();
+
+ rOutStm << endl;
+ WriteTab( rOutStm, nTab );
+ rOutStm << '{' << endl;
+ WriteContext( rBase, rOutStm, nTab +1, nT, nA );
+ WriteTab( rOutStm, nTab );
+ rOutStm << '}';
+ if( nT == WRITE_ODL || nT == WRITE_C_HEADER )
+ {
+ rOutStm << ' ' << C_PREF << aName.GetBuffer();
+ }
+ rOutStm << ';' << endl;
+
+ if ( nT == WRITE_C_HEADER )
+ rOutStm << "#endif";
+
+/*keine Funktionen fuer New und Delete
+ if( nT == WRITE_C_HEADER && nType != TYPE_ENUM )
+ {
+ rOutStm << aName.GetBuffer() << " * New_"
+ << aName.GetBuffer() << "();" << endl;
+ rOutStm << "void Delete_"
+ << aName.GetBuffer() << "( "
+ << aName.GetBuffer() <<" * );" << endl;
+ }
+*/
+ rOutStm << endl;
+ }
+ break;
+ case TYPE_POINTER:
+ case TYPE_BASE:
+ {
+ }
+ break;
+ case TYPE_METHOD:
+ {
+ }
+ break;
+ }
+ }
+
+/*keine Funktionen fuer New und Delete
+ if( nT == WRITE_C_SOURCE )
+ {
+ switch( nType )
+ {
+ case TYPE_STRUCT:
+ case TYPE_UNION:
+ {
+ rOutStm << aName.GetBuffer() << " * New_"
+ << aName.GetBuffer() << "() { return new "
+ << aName.GetBuffer() << "; }" << endl;
+ rOutStm << "void Delete_"
+ << aName.GetBuffer() << "( "
+ << aName.GetBuffer() <<" * ) { delete "
+ << aName.GetBuffer() << "; }" << endl;
+ }
+ break;
+ }
+ }
+*/
+}
+
+/*************************************************************************
+|* SvMetaType::ReadNamesSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaType::ReadNamesSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ BOOL bOk = ReadNameSvIdl( rBase, rInStm );
+/*
+ if( bOk )
+ {
+ UINT32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+
+ if( pTok->IsIdentifier() )
+ {
+ aSbxName = pTok->GetString();
+
+ nTokPos = rInStm.Tell();
+ pTok = rInStm.GetToken_Next();
+ if( pTok->IsIdentifier() )
+ {
+ aItemName = pTok->GetString();
+ nTokPos = rInStm.Tell();
+ }
+ }
+ rInStm.Seek( nTokPos );
+ }
+*/
+ return bOk;
+}
+
+/*************************************************************************
+|* SvMetaType::WriteHeaderSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::WriteHeaderSvIdl( SvIdlDataBase & rBase,
+ SvStream & rOutStm,
+ USHORT nTab )
+{
+ switch( nType )
+ {
+ case TYPE_CLASS:
+ {
+ if( IsShell() )
+ rOutStm << SvHash_shell()->GetName().GetBuffer();
+ else
+ rOutStm << SvHash_interface()->GetName().GetBuffer();
+ rOutStm << ' ' << GetName().GetBuffer();
+ }
+ break;
+ case TYPE_STRUCT:
+ {
+ rOutStm << SvHash_struct()->GetName().GetBuffer()
+ << ' ' << GetName().GetBuffer();
+ }
+ break;
+ case TYPE_UNION:
+ {
+ rOutStm << SvHash_union()->GetName().GetBuffer()
+ << ' ' << GetName().GetBuffer();
+ }
+ break;
+ case TYPE_ENUM:
+ {
+ rOutStm << SvHash_enum()->GetName().GetBuffer()
+ << ' ' << GetName().GetBuffer();
+ }
+ break;
+ case TYPE_POINTER:
+ case TYPE_BASE:
+ {
+ if( IsItem() )
+ rOutStm << SvHash_item()->GetName().GetBuffer() << ' ';
+ else
+ rOutStm << SvHash_typedef()->GetName().GetBuffer() << ' ';
+ if( GetRef() )
+ {
+ ((SvMetaType *)GetRef())->WriteTheType( rBase, rOutStm, nTab, WRITE_IDL );
+ rOutStm << ' ';
+ }
+ rOutStm << GetName().GetBuffer();
+ }
+ break;
+ case TYPE_METHOD:
+ {
+ rOutStm << SvHash_typedef()->GetName().GetBuffer() << ' ';
+ ((SvMetaType *)GetRef())->WriteTheType( rBase, rOutStm, nTab, WRITE_IDL );
+ rOutStm << ' ' << GetName().GetBuffer() << "( ";
+ WriteContextSvIdl( rBase, rOutStm, nTab );
+ rOutStm << " )";
+ }
+ break;
+ }
+}
+
+/*************************************************************************
+|* SvMetaType::ReadAttributesSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::ReadAttributesSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ SvMetaExtern::ReadAttributesSvIdl( rBase, rInStm );
+ aSvName.ReadSvIdl( SvHash_SvName(), rInStm );
+ aSbxName.ReadSvIdl( SvHash_SbxName(), rInStm );
+ aOdlName.ReadSvIdl( SvHash_OdlName(), rInStm );
+}
+
+/*************************************************************************
+|* SvMetaType::WriteAttributesSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::WriteAttributesSvIdl( SvIdlDataBase & rBase,
+ SvStream & rOutStm,
+ USHORT nTab )
+{
+ SvMetaExtern::WriteAttributesSvIdl( rBase, rOutStm, nTab );
+ ByteString aName = GetName();
+ if( aSvName != aName || aSbxName != aName || aOdlName != aName )
+ {
+ WriteTab( rOutStm, nTab );
+ rOutStm << "class SvMetaType" << endl;
+ if( aSvName != aName )
+ {
+ WriteTab( rOutStm, nTab );
+ aSvName.WriteSvIdl( SvHash_SvName(), rOutStm, nTab );
+ rOutStm << endl;
+ }
+ if( aSbxName != aName )
+ {
+ WriteTab( rOutStm, nTab );
+ aSbxName.WriteSvIdl( SvHash_SbxName(), rOutStm, nTab );
+ rOutStm << endl;
+ }
+ if( aOdlName != aName )
+ {
+ WriteTab( rOutStm, nTab );
+ aOdlName.WriteSvIdl( SvHash_OdlName(), rOutStm, nTab );
+ rOutStm << endl;
+ }
+ }
+}
+
+/*************************************************************************
+|* SvMetaType::ReadContextSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::ReadContextSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ SvMetaAttributeRef xAttr = new SvMetaAttribute();
+ if( xAttr->ReadSvIdl( rBase, rInStm ) )
+ {
+ if( xAttr->Test( rBase, rInStm ) )
+ GetAttrList().Append( xAttr );
+ }
+}
+
+/*************************************************************************
+|* SvMetaType::WriteContextSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::WriteContextSvIdl
+(
+ SvIdlDataBase & rBase,
+ SvStream & rOutStm,
+ USHORT nTab
+)
+{
+ if( GetAttrCount() )
+ {
+ SvMetaAttribute * pAttr = pAttrList->First();
+ while( pAttr )
+ {
+ WriteTab( rOutStm, nTab );
+ pAttr->WriteSvIdl( rBase, rOutStm, nTab );
+ if( GetType() == TYPE_METHOD )
+ rOutStm << ',' << endl;
+ else
+ rOutStm << ';' << endl;
+ pAttr = pAttrList->Next();
+ }
+ }
+}
+
+/*************************************************************************
+|* SvMetaType::WriteAttributes()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ SvMetaExtern::WriteAttributes( rBase, rOutStm, nTab, nT, nA );
+}
+
+/*************************************************************************
+|* SvMetaType::MakeSfx()
+|*
+|* Beschreibung
+*************************************************************************/
+ULONG SvMetaType::MakeSfx( ByteString * pAttrArray )
+{
+ ULONG nC = 0;
+
+ if( GetBaseType()->GetType() == TYPE_STRUCT )
+ {
+ ULONG nAttrCount = GetAttrCount();
+ // Die einzelnen Attribute schreiben
+ for( ULONG n = 0; n < nAttrCount; n++ )
+ {
+ nC += pAttrList->GetObject( n )->MakeSfx( pAttrArray );
+ if( n +1 < nAttrCount )
+ *pAttrArray += ", ";
+ }
+ }
+ return nC;
+}
+
+/*************************************************************************
+|* SvMetaType::WriteSfx()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::WriteSfx( const ByteString & rItemName, SvIdlDataBase & rBase,
+ SvStream & rOutStm )
+{
+ WriteStars( rOutStm );
+ ByteString aVarName = " a";
+ aVarName += rItemName;
+ aVarName += "_Impl";
+
+ ByteString aTypeName = "SfxType";
+ ByteString aAttrArray;
+ ULONG nAttrCount = MakeSfx( &aAttrArray );
+ //ULONG nAttrCount = GetAttrCount();
+ ByteString aAttrCount( ByteString::CreateFromInt32( nAttrCount ) );
+ aTypeName += aAttrCount;
+
+ rOutStm << "extern " << aTypeName.GetBuffer()
+ << aVarName.GetBuffer() << ';' << endl;
+
+ // Den Implementationsteil schreiben
+ rOutStm << "#ifdef SFX_TYPEMAP" << endl
+ << aTypeName.GetBuffer() << aVarName.GetBuffer()
+ << " = " << endl;
+ rOutStm << '{' << endl
+ << "\tTYPE(" << rItemName.GetBuffer() << "), "
+ << aAttrCount.GetBuffer();
+ if( nAttrCount )
+ {
+ rOutStm << ", { ";
+ // Die einzelnen Attribute schreiben
+ rOutStm << aAttrArray.GetBuffer();
+ rOutStm << " }";
+ }
+ rOutStm << endl << "};" << endl
+ << "#endif" << endl << endl;
+}
+
+/*************************************************************************
+|* SvMetaType::WriteSfx()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::WriteSfx( SvIdlDataBase & rBase, SvStream & rOutStm )
+{
+ if( IsItem() )
+ {
+ if( GetBaseType()->GetType() == TYPE_STRUCT )
+ GetBaseType()->WriteSfx( GetName(), rBase, rOutStm );
+ else
+ WriteSfx( GetName(), rBase, rOutStm );
+ }
+}
+
+/*************************************************************************
+|* SvMetaType::ReadMethodArgs()
+|*
+|* Beschreibung
+*************************************************************************/
+BOOL SvMetaType::ReadMethodArgs( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ UINT32 nTokPos = rInStm.Tell();
+ if( rInStm.Read( '(' ) )
+ {
+ //DoReadContextSvIdl( rBase, rInStm, ',' );
+ DoReadContextSvIdl( rBase, rInStm );
+ if( rInStm.Read( ')' ) )
+ {
+ SetType( TYPE_METHOD );
+ return TRUE;
+ }
+ }
+ rInStm.Seek( nTokPos );
+ return FALSE;
+}
+
+/*************************************************************************
+|* SvMetaType::WriteMethodArgs()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::WriteMethodArgs
+(
+ SvIdlDataBase & rBase,
+ SvStream & rOutStm,
+ USHORT nTab, WriteType nT
+)
+{
+ if( nT == WRITE_IDL )
+ {
+ if( GetAttrCount() )
+ {
+ rOutStm << endl;
+ WriteTab( rOutStm, nTab );
+ rOutStm << '(' << endl;
+
+ SvMetaAttribute * pAttr = pAttrList->First();
+ while( pAttr )
+ {
+ WriteTab( rOutStm, nTab +1 );
+ pAttr->WriteSvIdl( rBase, rOutStm, nTab +1 );
+ pAttr = pAttrList->Next();
+ if( pAttr )
+ rOutStm << ',' << endl;
+ }
+ rOutStm << endl;
+ WriteTab( rOutStm, nTab );
+ rOutStm << ')';
+ }
+ else
+ rOutStm << "()";
+ }
+ else if ( nT == WRITE_DOCU )
+ {
+
+ rOutStm << '(';
+ if( GetAttrCount() )
+ {
+ SvMetaAttribute * pAttr = pAttrList->First();
+ while( pAttr )
+ {
+ pAttr->WriteParam( rBase, rOutStm, nTab+1, nT );
+ pAttr = pAttrList->Next();
+ if( pAttr )
+ rOutStm << ',';
+ else
+ rOutStm << ' ';
+ }
+ }
+ rOutStm << ')' << endl;
+ }
+ else
+ {
+ rOutStm << '(';
+ if( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
+ {
+ rOutStm << ' ' << C_PREF << "Object h" << rBase.aIFaceName.GetBuffer();
+ if( GetAttrCount() )
+ rOutStm << ',';
+ else
+ rOutStm << ' ';
+ }
+
+ if( GetAttrCount() )
+ {
+ rOutStm << endl;
+ SvMetaAttribute * pAttr = pAttrList->First();
+ while( pAttr )
+ {
+ switch( nT )
+ {
+ case WRITE_C_HEADER:
+ case WRITE_C_SOURCE:
+ case WRITE_ODL:
+ {
+ pAttr->WriteParam( rBase, rOutStm, nTab +1, nT );
+ }
+ break;
+
+ default:
+ {
+ DBG_ASSERT( FALSE, "WriteType not implemented" )
+ }
+ }
+ pAttr = pAttrList->Next();
+ if( pAttr )
+ rOutStm << ',' << endl;
+ }
+ if( nT != WRITE_C_HEADER && nT != WRITE_C_SOURCE )
+ {
+ rOutStm << endl;
+ WriteTab( rOutStm, nTab +1 );
+ }
+ rOutStm << ' ';
+ }
+ rOutStm << ')';
+ }
+}
+
+/*************************************************************************
+|* SvMetaType::WriteTypePrefix()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::WriteTypePrefix( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab, WriteType nT )
+{
+ switch( nT )
+ {
+ case WRITE_IDL:
+ {
+ if( GetIn() && GetOut() )
+ rOutStm << SvHash_inout()->GetName().GetBuffer() << ' ';
+ else if( GetIn() )
+ rOutStm << SvHash_in()->GetName().GetBuffer() << ' ';
+ else if( GetOut() )
+ rOutStm << SvHash_out()->GetName().GetBuffer() << ' ';
+ rOutStm << GetCString().GetBuffer();
+ }
+ break;
+
+ case WRITE_ODL:
+ {
+ BOOL bIn = GetIn();
+ BOOL bOut = GetOut();
+ if( bIn || bOut )
+ {
+ if( bIn && bOut )
+ rOutStm << "[in,out] ";
+ else if( bIn )
+ rOutStm << "[in] ";
+ else if( bOut )
+ rOutStm << "[out] ";
+ }
+
+ ByteString aOut;
+ if( GetType() == TYPE_METHOD )
+ aOut = GetReturnType()->GetBaseType()->GetOdlName();
+ else
+ {
+ SvMetaType * pBType = GetBaseType();
+ aOut = pBType->GetOdlName();
+ }
+ if( aCall0 == (int)CALL_POINTER
+ || aCall0 == (int)CALL_REFERENCE )
+ rOutStm << " *";
+ if( aCall1 == (int)CALL_POINTER
+ || aCall1 == (int)CALL_REFERENCE )
+ rOutStm << " *";
+ rOutStm << aOut.GetBuffer();
+ }
+ break;
+
+ case WRITE_C_HEADER:
+ case WRITE_C_SOURCE:
+ case WRITE_CXX_HEADER:
+ case WRITE_CXX_SOURCE:
+ {
+
+ SvMetaType * pBaseType = GetBaseType();
+ DBG_ASSERT( pBaseType, "no base type for attribute" )
+
+ if( pBaseType->GetType() == TYPE_METHOD )
+ pBaseType->GetReturnType()->WriteTypePrefix(
+ rBase, rOutStm, nTab, nT );
+ else if( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
+ {
+ if( TYPE_STRUCT == pBaseType->GetType() )
+ rOutStm << C_PREF << pBaseType->GetName().GetBuffer()
+ << " *";
+ else
+ {
+ if ( pBaseType->GetType() == TYPE_ENUM )
+ rOutStm << C_PREF;
+ rOutStm << pBaseType->GetCName().GetBuffer();
+ }
+ }
+ else
+ {
+ if( TYPE_STRUCT == pBaseType->GetType() )
+ rOutStm << pBaseType->GetName().GetBuffer() << " *";
+ else
+ rOutStm << pBaseType->GetName().GetBuffer();
+ }
+ }
+ break;
+
+ case WRITE_DOCU:
+ {
+
+ SvMetaType * pBaseType = GetBaseType();
+ DBG_ASSERT( pBaseType, "no base type for attribute" )
+
+ if( pBaseType->GetType() == TYPE_METHOD )
+ {
+ pBaseType->GetReturnType()->WriteTypePrefix(
+ rBase, rOutStm, nTab, nT );
+ }
+ else
+ {
+ if( TYPE_STRUCT == pBaseType->GetType() )
+ rOutStm << "VARIANT" << pBaseType->GetName().GetBuffer();
+ else if ( pBaseType->GetType() == TYPE_ENUM )
+ rOutStm << "integer";
+ else
+ rOutStm << pBaseType->GetOdlName().GetBuffer();
+ }
+ }
+
+ default:
+ {
+ DBG_ASSERT( FALSE, "WriteType not implemented" )
+ }
+ }
+}
+
+/*************************************************************************
+|* SvMetaType::WriteTheType()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::WriteTheType( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab, WriteType nT )
+{
+ WriteTypePrefix( rBase, rOutStm, nTab, nT );
+ if( GetType() == TYPE_METHOD )
+ WriteMethodArgs( rBase, rOutStm, nTab +2, nT );
+}
+
+/*************************************************************************
+|* SvMetaType::GetParserString()
+|*
+|* Beschreibung
+*************************************************************************/
+ByteString SvMetaType::GetParserString() const
+{
+ SvMetaType * pBT = GetBaseType();
+ if( pBT != this )
+ return pBT->GetParserString();
+
+ int nType = GetType();
+ ByteString aPStr;
+
+ if( TYPE_METHOD == nType || TYPE_STRUCT == nType )
+ {
+ ULONG nAttrCount = GetAttrCount();
+ // Die einzelnen Attribute schreiben
+ for( ULONG n = 0; n < nAttrCount; n++ )
+ {
+ SvMetaAttribute * pT = pAttrList->GetObject( n );
+ aPStr += pT->GetType()->GetParserString();
+ }
+ }
+ else
+ aPStr = GetParserChar();
+ return aPStr;
+}
+
+/*************************************************************************
+|* SvMetaType::WriteParamNames()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::WriteParamNames( SvIdlDataBase & rBase,
+ SvStream & rOutStm,
+ const ByteString & rChief )
+{
+ SvMetaType * pBT = GetBaseType();
+ if( pBT != this )
+ pBT->WriteParamNames( rBase, rOutStm, rChief );
+ else
+ {
+ int nType = GetType();
+ ByteString aPStr;
+
+ if( TYPE_METHOD == nType || TYPE_STRUCT == nType )
+ {
+ ULONG nAttrCount = GetAttrCount();
+ // Die einzelnen Attribute schreiben
+ for( ULONG n = 0; n < nAttrCount; n++ )
+ {
+ SvMetaAttribute * pA = pAttrList->GetObject( n );
+ // Fuer Methoden ist rChief immer ""
+ ByteString aStr = /*rChief;
+ if( aStr.Len() )
+ aStr += "->";
+ aStr += */pA->GetName();
+ pA->GetType()->WriteParamNames( rBase, rOutStm, aStr );
+ if( n +1 < nAttrCount )
+ rOutStm << ", ";
+ }
+ }
+ else
+ rOutStm << rChief.GetBuffer();
+ }
+}
+
+#endif // IDL_COMPILER
+
+/************************************************************************/
+/************************************************************************/
+SV_IMPL_META_FACTORY1( SvMetaTypeString, SvMetaType );
+#ifdef IDL_COMPILER
+SvAttributeList & SvMetaTypeString::GetAttributeList()
+{
+ if( !pAttribList )
+ {
+ pAttribList = new SvAttributeList();
+ }
+ return *pAttribList;
+}
+#endif
+/*************************************************************************
+|*
+|* SvMetaTypeString::SvMetaTypeString()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+SvMetaTypeString::SvMetaTypeString()
+ : SvMetaType( "String", "SbxSTRING", "BSTR", 's', "char *", "String", "$" )
+{
+}
+
+void SvMetaTypeString::Load( SvPersistStream & rStm )
+{
+ SvMetaType::Load( rStm );
+}
+
+void SvMetaTypeString::Save( SvPersistStream & rStm )
+{
+ SvMetaType::Save( rStm );
+}
+
+/************************************************************************/
+/************************************************************************/
+SV_IMPL_META_FACTORY1( SvMetaEnumValue, SvMetaName );
+#ifdef IDL_COMPILER
+SvAttributeList & SvMetaEnumValue::GetAttributeList()
+{
+ if( !pAttribList )
+ {
+ pAttribList = new SvAttributeList();
+ }
+ return *pAttribList;
+}
+#endif
+/*************************************************************************
+|*
+|* SvMetaEnumValue::SvMetaEnumValue()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+SvMetaEnumValue::SvMetaEnumValue()
+{
+}
+
+void SvMetaEnumValue::Load( SvPersistStream & rStm )
+{
+ SvMetaName::Load( rStm );
+
+ BYTE nMask;
+ rStm >> nMask;
+ if( nMask >= 0x02 )
+ {
+ rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ DBG_ERROR( "wrong format" )
+ return;
+ }
+ if( nMask & 0x01 ) rStm.ReadByteString( aEnumValue );
+}
+
+void SvMetaEnumValue::Save( SvPersistStream & rStm )
+{
+ SvMetaName::Save( rStm );
+
+ // Maske erstellen
+ BYTE nMask = 0;
+ if( aEnumValue.Len() ) nMask |= 0x01;
+
+ // Daten schreiben
+ rStm << nMask;
+ if( nMask & 0x01 ) rStm.WriteByteString( aEnumValue );
+}
+
+#ifdef IDL_COMPILER
+/*************************************************************************
+|*
+|* SvMetaEnumValue::ReadSvIdl()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+BOOL SvMetaEnumValue::ReadSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ if( !ReadNameSvIdl( rBase, rInStm ) )
+ return FALSE;
+ return TRUE;
+}
+
+/*************************************************************************
+|*
+|* SvMetaEnumValue::WriteSvIdl()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void SvMetaEnumValue::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab )
+{
+ rOutStm << GetName().GetBuffer();
+}
+
+/*************************************************************************
+|*
+|* SvMetaEnumValue::Write()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void SvMetaEnumValue::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ if ( nT == WRITE_C_HEADER || nT == WRITE_C_SOURCE )
+ rOutStm << C_PREF << GetName().GetBuffer();
+ else
+ rOutStm << GetName().GetBuffer();
+}
+#endif // IDL_COMPILER
+
+/************************************************************************/
+/************************************************************************/
+SV_IMPL_META_FACTORY1( SvMetaTypeEnum, SvMetaType );
+#ifdef IDL_COMPILER
+SvAttributeList & SvMetaTypeEnum::GetAttributeList()
+{
+ if( !pAttribList )
+ {
+ pAttribList = new SvAttributeList();
+ }
+ return *pAttribList;
+}
+#endif
+/*************************************************************************
+|*
+|* SvMetaTypeEnum::SvMetaTypeEnum()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+SvMetaTypeEnum::SvMetaTypeEnum()
+{
+ SetBasicName( "Integer" );
+}
+
+void SvMetaTypeEnum::Load( SvPersistStream & rStm )
+{
+ SvMetaType::Load( rStm );
+
+ BYTE nMask;
+ rStm >> nMask;
+ if( nMask >= 0x04 )
+ {
+ rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ DBG_ERROR( "wrong format" )
+ return;
+ }
+ if( nMask & 0x01 ) rStm >> aEnumValueList;
+ if( nMask & 0x02 ) rStm.ReadByteString( aPrefix );
+}
+
+void SvMetaTypeEnum::Save( SvPersistStream & rStm )
+{
+ SvMetaType::Save( rStm );
+
+ // Maske erstellen
+ BYTE nMask = 0;
+ if( aEnumValueList.Count() ) nMask |= 0x01;
+ if( aPrefix.Len() ) nMask |= 0x02;
+
+ // Daten schreiben
+ rStm << nMask;
+ if( nMask & 0x01 ) rStm << aEnumValueList;
+ if( nMask & 0x02 ) rStm.WriteByteString( aPrefix );
+}
+
+/*************************************************************************
+|*
+|* SvMetaTypeEnum::GetMaxValue()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+/*
+USHORT SvMetaTypeEnum::GetMaxValue() const
+{
+ USHORT nMax = 0;
+ for( ULONG n = 0; n < aEnumValueList.Count(); n++ )
+ {
+ SvMetaEnumValue * pObj = aEnumValueList.GetObject( n );
+ if( nMax < pObj->GetValue() )
+ nMax = pObj->GetValue();
+ }
+ return nMax;
+}
+*/
+
+#ifdef IDL_COMPILER
+/*************************************************************************
+|*
+|* SvMetaTypeEnum::ReadContextSvIdl()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void SvMetaTypeEnum::ReadContextSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ UINT32 nTokPos = rInStm.Tell();
+
+ SvMetaEnumValueRef aEnumVal = new SvMetaEnumValue();
+ BOOL bOk = aEnumVal->ReadSvIdl( rBase, rInStm );
+ if( bOk )
+ {
+ if( 0 == aEnumValueList.Count() )
+ // der Erste
+ aPrefix = aEnumVal->GetName();
+ else
+ {
+ USHORT nPos = aPrefix.Match( aEnumVal->GetName() );
+ if( nPos != aPrefix.Len() && nPos != STRING_MATCH )
+ aPrefix.Erase( nPos );
+ }
+ aEnumValueList.Append( aEnumVal );
+ }
+ if( !bOk )
+ rInStm.Seek( nTokPos );
+}
+
+/*************************************************************************
+|*
+|* SvMetaTypeEnum::WriteSvIdl()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void SvMetaTypeEnum::WriteContextSvIdl( SvIdlDataBase & rBase,
+ SvStream & rOutStm,
+ USHORT nTab )
+{
+ WriteTab( rOutStm, nTab +1 );
+ for( ULONG n = 0; n < aEnumValueList.Count(); n++ )
+ {
+ aEnumValueList.GetObject( n )->WriteSvIdl( rBase, rOutStm, nTab );
+ if( n +1 != aEnumValueList.Count() )
+ rOutStm << ", ";
+ else
+ rOutStm << endl;
+ }
+}
+
+/*************************************************************************
+|*
+|* SvMetaTypeEnum::ReadSvIdl()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+BOOL SvMetaTypeEnum::ReadSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ UINT32 nTokPos = rInStm.Tell();
+ if( SvMetaType::ReadHeaderSvIdl( rBase, rInStm )
+ && GetType() == TYPE_ENUM )
+ {
+ if( SvMetaName::ReadSvIdl( rBase, rInStm ) )
+ return TRUE;
+ }
+ rInStm.Seek( nTokPos );
+ return FALSE;
+}
+
+/*************************************************************************
+|*
+|* SvMetaTypeEnum::WriteSvIdl()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void SvMetaTypeEnum::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab )
+{
+ WriteHeaderSvIdl( rBase, rOutStm, nTab );
+ rOutStm << endl;
+ SvMetaName::WriteSvIdl( rBase, rOutStm, nTab );
+ rOutStm << endl;
+}
+
+/*************************************************************************
+|*
+|* SvMetaTypeEnum::Write()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void SvMetaTypeEnum::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ SvMetaType::Write( rBase, rOutStm, nTab, nT, nA );
+}
+
+/*************************************************************************
+|* SvMetaTypeEnum::WriteContext()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaTypeEnum::WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm,
+ USHORT nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ WriteTab( rOutStm, nTab +1 );
+ for( ULONG n = 0; n < aEnumValueList.Count(); n++ )
+ {
+ aEnumValueList.GetObject( n )->Write( rBase, rOutStm, nTab +1, nT, nA );
+
+ if( n +1 != aEnumValueList.Count() )
+ {
+ if( 2 == n % 3 )
+ {
+ rOutStm << ',' << endl;
+ WriteTab( rOutStm, nTab +1 );
+ }
+ else
+ rOutStm << ",\t";
+ }
+ else
+ rOutStm << endl;
+ }
+ rOutStm << endl;
+}
+
+#endif // IDL_COMPILER
+
+/************************************************************************/
+/************************************************************************/
+SV_IMPL_META_FACTORY1( SvMetaTypevoid, SvMetaType );
+#ifdef IDL_COMPILER
+SvAttributeList & SvMetaTypevoid::GetAttributeList()
+{
+ if( !pAttribList )
+ {
+ pAttribList = new SvAttributeList();
+ }
+ return *pAttribList;
+}
+#endif
+/*************************************************************************
+|*
+|* SvMetaTypevoid::SvMetaTypevoid()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+SvMetaTypevoid::SvMetaTypevoid()
+ : SvMetaType( "void", "SbxVOID", "void", 'v', "void", "", "" )
+{
+}
+
+void SvMetaTypevoid::Load( SvPersistStream & rStm )
+{
+ SvMetaType::Load( rStm );
+}
+
+void SvMetaTypevoid::Save( SvPersistStream & rStm )
+{
+ SvMetaType::Save( rStm );
+}
+
+ByteString SvMetaAttribute::Compare( SvMetaAttribute* pAttr )
+{
+ ByteString aStr;
+
+ if ( aType.Is() )
+ {
+ if ( aType->GetType() == TYPE_METHOD )
+ {
+ // Nur testen, wenn das Attribut eine Methode ist, nicht wenn es
+ // eine hat !!
+ if ( !pAttr->GetType()->GetType() == TYPE_METHOD )
+ aStr += " IsMethod\n";
+ else if ( aType->GetReturnType() &&
+ aType->GetReturnType()->GetType() != pAttr->GetType()->GetReturnType()->GetType() )
+ aStr += " ReturnType\n";
+
+ if ( aType->GetAttrCount() )
+ {
+ USHORT nCount = aType->GetAttrCount();
+ SvMetaAttributeMemberList& rList = aType->GetAttrList();
+ SvMetaAttributeMemberList& rOtherList = pAttr->GetType()->GetAttrList();
+ USHORT nOtherCount = pAttr->GetType()->GetAttrCount();
+ if ( nOtherCount != nCount )
+ {
+ aStr += " AttributeCount\n";
+ }
+ else
+ {
+ for ( USHORT n=0; n<nCount; n++ )
+ {
+ SvMetaAttribute *pAttr1 = rList.GetObject(n);
+ SvMetaAttribute *pAttr2 = rOtherList.GetObject(n);
+ pAttr1->Compare( pAttr2 );
+ }
+ }
+ }
+ }
+
+ if ( GetType()->GetType() != pAttr->GetType()->GetType() )
+ aStr += " Type\n";
+
+ if ( !GetType()->GetSvName().Equals( pAttr->GetType()->GetSvName() ) )
+ aStr += " ItemType\n";
+ }
+
+ if ( GetExport() != pAttr->GetExport() )
+ aStr += " Export\n";
+
+ if ( GetAutomation() != pAttr->GetAutomation() )
+ aStr += " Automation\n";
+
+ if ( GetIsCollection() != pAttr->GetIsCollection() )
+ aStr += " IsCollection\n";
+
+ if ( GetReadOnlyDoc() != pAttr->GetReadOnlyDoc() )
+ aStr += " ReadOnlyDoc\n";
+
+ if ( GetExport() && GetReadonly() != pAttr->GetReadonly() )
+ aStr += " Readonly\n";
+
+ return aStr;
+}
+
+void SvMetaAttribute::WriteCSV( SvIdlDataBase& rBase, SvStream& rStrm )
+{
+ rStrm << GetType()->GetSvName().GetBuffer() << ' ';
+ rStrm << GetName().GetBuffer() << ' ';
+ rStrm << GetSlotId().GetBuffer();
+}
+
+