summaryrefslogtreecommitdiff
path: root/idl/source
diff options
context:
space:
mode:
Diffstat (limited to 'idl/source')
-rwxr-xr-xidl/source/cmptools/char.cxx107
-rwxr-xr-xidl/source/cmptools/hash.cxx327
-rwxr-xr-xidl/source/cmptools/lex.cxx503
-rw-r--r--idl/source/cmptools/makefile.mk47
-rwxr-xr-xidl/source/objects/basobj.cxx786
-rwxr-xr-xidl/source/objects/bastype.cxx611
-rw-r--r--idl/source/objects/makefile.mk50
-rwxr-xr-xidl/source/objects/module.cxx688
-rwxr-xr-xidl/source/objects/object.cxx1047
-rwxr-xr-xidl/source/objects/slot.cxx1820
-rwxr-xr-xidl/source/objects/types.cxx2699
-rwxr-xr-xidl/source/prj/command.cxx437
-rwxr-xr-xidl/source/prj/database.cxx1039
-rwxr-xr-xidl/source/prj/globals.cxx189
-rw-r--r--idl/source/prj/makefile.mk49
-rwxr-xr-xidl/source/prj/svidl.cxx447
-rw-r--r--idl/source/svidl.datbin0 -> 204 bytes
17 files changed, 10846 insertions, 0 deletions
diff --git a/idl/source/cmptools/char.cxx b/idl/source/cmptools/char.cxx
new file mode 100755
index 000000000000..6e0049240bbb
--- /dev/null
+++ b/idl/source/cmptools/char.cxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_idl.hxx"
+
+/****************** I N C L U D E S **************************************/
+#include <ctype.h>
+#include <string.h>
+
+#ifndef _TABLE_HXX //autogen
+#include <tools/table.hxx>
+#endif
+
+#include <char.hxx>
+
+/****************** D A T E N ********************************************/
+static unsigned char EqualTab[ 256 ] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
+ 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
+ 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
+100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
+110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
+120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
+130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
+140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
+150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
+160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
+170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
+180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
+190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
+200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
+210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
+220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
+230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
+240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
+250, 251, 252, 253, 254, 255 };
+
+
+/*************************************************************************
+|*
+|* RscChar::GetTable()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.08.91
+|* Letzte Aenderung MM 08.08.91
+|*
+*************************************************************************/
+Table * pCharTable = NULL;
+unsigned char * pChange = EqualTab;
+char * SvChar::GetTable( CharSet nSource , CharSet nDest )
+{
+ if( nSource == nDest )
+ return (char *)EqualTab;
+
+ if( !pCharTable )
+ pCharTable = new Table();
+
+ sal_uInt8 * pSet;
+ pSet = (sal_uInt8 *)pCharTable->Get( ((sal_uLong)nSource << 16) + (sal_uLong)nDest );
+
+ if( !pSet )
+ {
+ pSet = new sal_uInt8[ 256 ];
+ memcpy( pSet, EqualTab, sizeof( EqualTab ) );
+ for( sal_uInt16 i = 128; i < 256; i++ )
+ {
+ char c = ByteString::Convert( pSet[i], nSource, nDest );
+ if( c )
+ pSet[ i ] = (sal_uInt8)c;
+ }
+ pCharTable->Insert( ((sal_uLong)nSource << 16) + (sal_uLong)nDest, pSet );
+ }
+
+ return (char *)pSet;
+};
diff --git a/idl/source/cmptools/hash.cxx b/idl/source/cmptools/hash.cxx
new file mode 100755
index 000000000000..f919a1074efa
--- /dev/null
+++ b/idl/source/cmptools/hash.cxx
@@ -0,0 +1,327 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_idl.hxx"
+
+/****************** I N C L U D E S **************************************/
+// C and C++ Includes.
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+
+// Programmabh�ngige Includes.
+#include <hash.hxx>
+#include <tools/debug.hxx>
+
+/****************** C O D E **********************************************/
+/*************************************************************************
+|*
+|* SvStringHashEntry::~SvStringHashEntry()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+SvStringHashEntry::~SvStringHashEntry() { };
+
+/*************************************************************************
+|*
+|* SvHashTable::SvHashTable()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+SvHashTable::SvHashTable( sal_uInt32 nMaxEntries )
+{
+ nMax = nMaxEntries; // set max entries
+ nFill = 0; // no entries
+ lTry = 0;
+ lAsk = 0;
+}
+
+/*************************************************************************
+|*
+|* SvHashTable::~SvHashTable()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+SvHashTable::~SvHashTable()
+{
+#ifdef DOS_NIE
+ printf( "Maximum: %ld, F�llung: %ld\n", (sal_uLong)nMax, (sal_uLong)nFill );
+ printf( "Anfragen: %ld, Versuche: %ld", (sal_uLong)lAsk, (sal_uLong)lTry );
+ if( lTry != 0 )
+ printf( ", V/E = %ld\n", lTry / lAsk );
+#endif
+}
+
+/*************************************************************************
+|*
+|* SvHashTable::Test_Insert()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+sal_Bool SvHashTable::Test_Insert( const void * pElement, sal_Bool bInsert,
+ sal_uInt32 * pInsertPos )
+{
+ sal_uInt32 nHash;
+ sal_uInt32 nIndex;
+ sal_uInt32 nLoop;
+
+ lAsk++;
+ lTry++;
+
+ nHash = HashFunc( pElement );
+ nIndex = nHash % nMax;
+
+// const char* s = ((ByteString*) pElement)->GetStr();
+// fprintf(stderr,"### Hash: %lu , Name: %s\n",nIndex,s );
+
+ nLoop = 0; // divide to range
+ while( (nMax != nLoop) && IsEntry( nIndex ) )
+ { // is place occupied
+ if( COMPARE_EQUAL == Compare( pElement, nIndex ) )
+ {
+ if( pInsertPos )
+ *pInsertPos = nIndex; // place of Element
+ return sal_True;
+ }
+ nLoop++;
+ lTry++;
+ nIndex = (sal_uInt16)(nIndex + nHash + 7) % nMax;
+ }
+
+ if( bInsert )
+ {
+ DBG_ASSERT( nMax != nLoop, "Hash table full" );
+ if( nMax != nLoop )
+ {
+ nFill++;
+ *pInsertPos = nIndex; // return free place
+ return sal_True;
+ }
+ }
+ return( sal_False );
+}
+
+/************************************************************************/
+/*************************************************************************
+|*
+|* SvStringHashTable::SvStringHashTable()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+SvStringHashTable::SvStringHashTable( sal_uInt32 nMaxEntries )
+ : SvHashTable( nMaxEntries )
+{
+ pEntries = new SvStringHashEntry[ nMaxEntries ];
+
+ // RefCount auf eins setzen
+ SvStringHashEntry * pPos, *pEnd;
+ pPos = pEntries;
+ pEnd = pEntries + nMaxEntries;
+ while( pPos != pEnd )
+ {
+ pPos->AddRef();
+ pPos++;
+ }
+}
+
+/*************************************************************************
+|*
+|* ~SvStringHashTable::SvStringHashTable()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+SvStringHashTable::~SvStringHashTable()
+{
+ // RefCount auf eins setzen
+ SvStringHashEntry * pPos, *pEnd;
+ pPos = pEntries;
+ pEnd = pEntries + GetMax();
+#ifdef DBG_UTIL
+ while( pPos != pEnd )
+ {
+ DBG_ASSERT( pPos->GetRefCount() == 1, "Reference count != 1" );
+ pPos++;
+ }
+#endif
+
+#ifdef MPW
+ // der MPW-Compiler ruft sonst keine Dtoren!
+ for ( sal_uInt16 n = 0; n < GetMax(); ++n )
+ (pEntries+n)->SvStringHashEntry::~SvStringHashEntry();
+ delete (void*) pEntries;
+#else
+ delete [] pEntries;
+#endif
+}
+
+/*************************************************************************
+|*
+|* SvStringHashTable::HashFunc()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+sal_uInt32 SvStringHashTable::HashFunc( const void * pElement ) const
+{
+ sal_uInt32 nHash = 0; // hash value
+ const char * pStr = ((const ByteString * )pElement)->GetBuffer();
+
+ int nShift = 0;
+ while( *pStr )
+ {
+ if( isupper( *pStr ) )
+ nHash ^= sal_uInt32(*pStr - 'A' + 26) << nShift;
+ else
+ nHash ^= sal_uInt32(*pStr - 'a') << nShift;
+ if( nShift == 28 )
+ nShift = 0;
+ else
+ nShift += 4;
+ pStr++;
+ }
+ return( nHash );
+}
+
+/*************************************************************************
+|*
+|* SvStringHashTable::GetNearString()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+ByteString SvStringHashTable::GetNearString( const ByteString & rName ) const
+{
+ for( sal_uInt32 i = 0; i < GetMax(); i++ )
+ {
+ SvStringHashEntry * pE = Get( i );
+ if( pE )
+ {
+ if( pE->GetName().EqualsIgnoreCaseAscii( rName ) && !pE->GetName().Equals( rName ) )
+ return pE->GetName();
+ }
+ }
+ return ByteString();
+}
+
+/*************************************************************************
+|*
+|* SvStringHashTable::IsEntry()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+sal_Bool SvStringHashTable::IsEntry( sal_uInt32 nIndex ) const
+{
+ if( nIndex >= GetMax() )
+ return sal_False;
+ return pEntries[ nIndex ].HasId();
+}
+
+/*************************************************************************
+|*
+|* SvStringHashTable::Insert()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+sal_Bool SvStringHashTable::Insert( const ByteString & rName, sal_uInt32 * pIndex )
+{
+ sal_uInt32 nIndex;
+
+ if( !pIndex ) pIndex = &nIndex;
+
+ if( !SvHashTable::Test_Insert( &rName, sal_True, pIndex ) )
+ return sal_False;
+
+ if( !IsEntry( *pIndex ) )
+ pEntries[ *pIndex ] = SvStringHashEntry( rName, *pIndex );
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* SvStringHashTable::Test()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+sal_Bool SvStringHashTable::Test( const ByteString & rName, sal_uInt32 * pPos ) const
+{
+ return ((SvStringHashTable *)this)->SvHashTable::
+ Test_Insert( &rName, sal_False, pPos );
+}
+
+/*************************************************************************
+|*
+|* SvStringHashTable::Get()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+SvStringHashEntry * SvStringHashTable::Get( sal_uInt32 nIndex ) const
+{
+ if( IsEntry( nIndex ) )
+ return pEntries + nIndex;
+ return( NULL );
+}
+
+/*************************************************************************
+|*
+|* SvStringHashTable::Get()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+StringCompare SvStringHashTable::Compare( const void * pElement,
+ sal_uInt32 nIndex ) const
+{
+ return ((const ByteString *)pElement)->CompareTo( pEntries[ nIndex ].GetName() );
+}
+
+/*************************************************************************
+|*
+|* SvStringHashTable::FillHashList()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void SvStringHashTable::FillHashList( SvStringHashList * pList ) const
+{
+ for( sal_uInt32 n = 0; n < GetMax(); n++ )
+ {
+ if( IsEntry( n ) )
+ pList->Insert( Get( n ), LIST_APPEND );
+ }
+ // Hash Reihenfolge, jetzt sortieren
+}
diff --git a/idl/source/cmptools/lex.cxx b/idl/source/cmptools/lex.cxx
new file mode 100755
index 000000000000..24991489841c
--- /dev/null
+++ b/idl/source/cmptools/lex.cxx
@@ -0,0 +1,503 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_idl.hxx"
+
+
+#include <ctype.h>
+#include <stdio.h>
+
+#include <char.hxx>
+#include <hash.hxx>
+#include <lex.hxx>
+#include <globals.hxx>
+#include <tools/bigint.hxx>
+
+/****************** SvToken **********************************************/
+/*************************************************************************
+|*
+|* SvToken::Print()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+ByteString SvToken::GetTokenAsString() const
+{
+ ByteString aStr;
+ switch( nType )
+ {
+ case SVTOKEN_EMPTY:
+ break;
+ case SVTOKEN_COMMENT:
+ aStr = aString;
+ break;
+ case SVTOKEN_INTEGER:
+ aStr = ByteString::CreateFromInt64(nLong);
+ break;
+ case SVTOKEN_STRING:
+ aStr = aString;
+ break;
+ case SVTOKEN_BOOL:
+ aStr = bBool ? "TRUE" : "FALSE";
+ break;
+ case SVTOKEN_IDENTIFIER:
+ aStr = aString;
+ break;
+ case SVTOKEN_CHAR:
+ aStr = cChar;
+ break;
+ case SVTOKEN_RTTIBASE:
+ aStr = "RTTIBASE";//(ULONG)pComplexObj;
+ break;
+ case SVTOKEN_EOF:
+ case SVTOKEN_HASHID:
+ break;
+ }
+
+ return aStr;
+}
+
+/*************************************************************************
+|*
+|* SvToken::SvToken()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+SvToken::SvToken( const SvToken & rObj )
+{
+ nLine = rObj.nLine;
+ nColumn = rObj.nColumn;
+ nType = rObj.nType;
+ aString = rObj.aString;
+/*
+ if( SVTOKEN_RTTIBASE = nType )
+ {
+ pComplexObj = rObj.pComplexObj;
+ pComplexObj->AddRef();
+ }
+ else
+*/
+ nLong = rObj.nLong;
+}
+
+/*************************************************************************
+|*
+|* SvToken::operator = ()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+SvToken & SvToken::operator = ( const SvToken & rObj )
+{
+ if( this != &rObj )
+ {
+/*
+ if( SVTOKEN_RTTIBASE = nType )
+ pComplexObj->ReleaseRef();
+*/
+ nLine = rObj.nLine;
+ nColumn = rObj.nColumn;
+ nType = rObj.nType;
+ aString = rObj.aString;
+/*
+ if( SVTOKEN_RTTIBASE = nType )
+ {
+ pComplexObj = rObj.pComplexObj;
+ pComplexObj->AddRef();
+ }
+ else
+*/
+ nLong = rObj.nLong;
+ }
+ return *this;
+}
+
+/****************** SvTokenStream ****************************************/
+/*************************************************************************
+|* SvTokenStream::InitCtor()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvTokenStream::InitCtor()
+{
+ SetCharSet( gsl_getSystemTextEncoding() );
+ aStrTrue = "TRUE";
+ aStrFalse = "FALSE";
+ nLine = nColumn = 0;
+ nBufPos = 0;
+ nTabSize = 4;
+ pCurToken = NULL;
+ nMaxPos = 0;
+ c = GetNextChar();
+ FillTokenList();
+}
+
+/*************************************************************************
+|* SvTokenStream::SvTokenStream()
+|*
+|* Beschreibung
+*************************************************************************/
+SvTokenStream::SvTokenStream( const String & rFileName )
+ : pInStream( new SvFileStream( rFileName, STREAM_STD_READ | STREAM_NOCREATE ) )
+ , rInStream( *pInStream )
+ , aFileName( rFileName )
+ , aTokList( 0x8000, 0x8000 )
+{
+ InitCtor();
+}
+
+/*************************************************************************
+|* SvTokenStream::SvTokenStream()
+|*
+|* Beschreibung
+*************************************************************************/
+SvTokenStream::SvTokenStream( SvStream & rStream, const String & rFileName )
+ : pInStream( NULL )
+ , rInStream( rStream )
+ , aFileName( rFileName )
+ , aTokList( 0x8000, 0x8000 )
+{
+ InitCtor();
+}
+
+/*************************************************************************
+|* SvTokenStream::~SvTokenStream()
+|*
+|* Beschreibung
+*************************************************************************/
+SvTokenStream::~SvTokenStream()
+{
+ delete pInStream;
+ SvToken * pTok = aTokList.Last();
+ while( pTok )
+ {
+ delete pTok;
+ pTok = aTokList.Prev();
+ }
+}
+
+/*************************************************************************
+|* SvTokenStream::FillTokenList()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvTokenStream::FillTokenList()
+{
+ SvToken * pToken = new SvToken();
+ aTokList.Insert( pToken, LIST_APPEND );
+ do
+ {
+ if( !MakeToken( *pToken ) )
+ {
+ SvToken * p = aTokList.Prev();
+ *pToken = SvToken();
+ if( p )
+ {
+ pToken->SetLine( p->GetLine() );
+ pToken->SetColumn( p->GetColumn() );
+ }
+ break;
+ }
+ else if( pToken->IsComment() )
+ *pToken = SvToken();
+ else if( pToken->IsEof() )
+ break;
+ else
+ {
+ pToken = new SvToken();
+ aTokList.Insert( pToken, LIST_APPEND );
+ }
+ }
+ while( !pToken->IsEof() );
+ pCurToken = aTokList.First();
+}
+
+/*************************************************************************
+|* SvTokenStrem::SetCharSet()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvTokenStream::SetCharSet( CharSet nSet )
+{
+ nCharSet = nSet;
+
+ pCharTab = SvChar::GetTable( nSet, gsl_getSystemTextEncoding() );
+}
+
+/*************************************************************************
+|* SvTokeStream::GetNextChar()
+|*
+|* Beschreibung
+*************************************************************************/
+int SvTokenStream::GetNextChar()
+{
+ int nChar;
+ if( (int)aBufStr.Len() < nBufPos )
+ {
+ if( rInStream.ReadLine( aBufStr ) )
+ {
+ nLine++;
+ nColumn = 0;
+ nBufPos = 0;
+ }
+ else
+ {
+ aBufStr.Erase();
+ nColumn = 0;
+ nBufPos = 0;
+ return '\0';
+ }
+ }
+ nChar = aBufStr.GetChar( (sal_uInt16)nBufPos++ );
+ nColumn += nChar == '\t' ? nTabSize : 1;
+ return nChar;
+}
+
+/*************************************************************************
+|* SvTokenStrem::GetNumber()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_uLong SvTokenStream::GetNumber()
+{
+ sal_uLong l = 0;
+ short nLog = 10;
+
+ if( '0' == c )
+ {
+ c = GetFastNextChar();
+ if( 'x' == c )
+ {
+ nLog = 16;
+ c = GetFastNextChar();
+ }
+ };
+
+ if( nLog == 16 )
+ {
+ while( isxdigit( c ) )
+ {
+ if( isdigit( c ) )
+ l = l * nLog + (c - '0');
+ else
+ l = l * nLog + (toupper( c ) - 'A' + 10 );
+ c = GetFastNextChar();
+ }
+ }
+ else
+ {
+ while( isdigit( c ) || 'x' == c )
+ {
+ l = l * nLog + (c - '0');
+ c = GetFastNextChar();
+ }
+ }
+
+ return( l );
+}
+
+/*************************************************************************
+|* SvTokenStream::MakeToken()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvTokenStream::MakeToken( SvToken & rToken )
+{
+ int c1;
+ sal_uInt16 i;
+
+ do
+ {
+ if( 0 == c )
+ c = GetNextChar();
+ // Leerzeichen ueberlesen
+ while( isspace( c ) || 26 == c )
+ {
+ c = GetFastNextChar();
+ nColumn += c == '\t' ? nTabSize : 1;
+ }
+ }
+ while( 0 == c && !IsEof() && ( SVSTREAM_OK == rInStream.GetError() ) );
+
+ sal_uLong nLastLine = nLine;
+ sal_uLong nLastColumn = nColumn;
+ // Kommentar
+ if( '/' == c )
+ {
+ // Zeit Optimierung, keine Kommentare
+ //ByteString aComment( (char)c );
+ c1 = c;
+ c = GetFastNextChar();
+ if( '/' == c )
+ {
+ while( '\0' != c )
+ {
+ //aComment += (char)c;
+ c = GetFastNextChar();
+ }
+ c = GetNextChar();
+ rToken.nType = SVTOKEN_COMMENT;
+ //rToken.aString = aComment;
+ }
+ else if( '*' == c )
+ {
+ //aComment += (char)c;
+ c = GetFastNextChar();
+ do
+ {
+ //aComment += (char)c;
+ while( '*' != c )
+ {
+ if( '\0' == c )
+ {
+ c = GetNextChar();
+ if( IsEof() )
+ return sal_False;
+ }
+ else
+ c = GetFastNextChar();
+ //aComment += (char)c;
+ }
+ c = GetFastNextChar();
+ }
+ while( '/' != c && !IsEof() && ( SVSTREAM_OK == rInStream.GetError() ) );
+ if( IsEof() || ( SVSTREAM_OK != rInStream.GetError() ) )
+ return sal_False;
+ //aComment += (char)c;
+ c = GetNextChar();
+ rToken.nType = SVTOKEN_COMMENT;
+ //rToken.aString = aComment;
+ CalcColumn();
+ }
+ else
+ {
+ rToken.nType = SVTOKEN_CHAR;
+ rToken.cChar = (char)c1;
+ }
+ }
+ else if( c == '"' )
+ {
+ ByteString aStr;
+ i = 0;
+ sal_Bool bDone = sal_False;
+ while( !bDone && !IsEof() && c )
+ {
+ c = GetFastNextChar();
+ if( '\0' == c )
+ {
+ // Strings auch "uber das Zeilenende hinauslesen
+ aStr += '\n';
+ c = GetNextChar();
+ if( IsEof() )
+ return sal_False;
+ }
+ if( c == '"' )
+ {
+ c = GetFastNextChar();
+ if( c == '"' )
+ {
+ aStr += '"';
+ aStr += '"';
+ }
+ else
+ bDone = sal_True;
+ }
+ else if( c == '\\' )
+ {
+ aStr += '\\';
+ c = GetFastNextChar();
+ if( c )
+ aStr += (char)c;
+ }
+ else
+ aStr += (char)c;
+ }
+ if( IsEof() || ( SVSTREAM_OK != rInStream.GetError() ) )
+ return sal_False;
+ char * pStr = (char *)aStr.GetBuffer();
+ while( *pStr )
+ {
+ *pStr = pCharTab[ (unsigned char)*pStr ];
+ pStr++;
+ };
+ rToken.nType = SVTOKEN_STRING;
+ rToken.aString = aStr;
+ }
+ else if( isdigit( c ) )
+ {
+ rToken.nType = SVTOKEN_INTEGER;
+ rToken.nLong = GetNumber();
+
+ }
+ else if( isalpha (c) || (c == '_') )
+ {
+ ByteString aStr;
+
+ while( isalnum( c ) || c == '_' )
+ {
+ aStr += (char)c;
+ c = GetFastNextChar();
+ }
+ if( aStr.EqualsIgnoreCaseAscii( aStrTrue ) )
+ {
+ rToken.nType = SVTOKEN_BOOL;
+ rToken.bBool = sal_True;
+ }
+ else if( aStr.EqualsIgnoreCaseAscii( aStrFalse ) )
+ {
+ rToken.nType = SVTOKEN_BOOL;
+ rToken.bBool = sal_False;
+ }
+ else
+ {
+ sal_uInt32 nHashId;
+ if( IDLAPP->pHashTable->Test( aStr, &nHashId ) )
+ rToken.SetHash( IDLAPP->pHashTable->Get( nHashId ) );
+ else
+ {
+ rToken.nType = SVTOKEN_IDENTIFIER;
+ rToken.aString = aStr;
+ }
+ }
+ }
+ else if( IsEof() )
+ {
+ rToken.nType = SVTOKEN_EOF;
+ }
+ else
+ {
+ rToken.nType = SVTOKEN_CHAR;
+ rToken.cChar = (char)c;
+ c = GetFastNextChar();
+ }
+ rToken.SetLine( nLastLine );
+ rToken.SetColumn( nLastColumn );
+ return rInStream.GetError() == SVSTREAM_OK;
+}
+
diff --git a/idl/source/cmptools/makefile.mk b/idl/source/cmptools/makefile.mk
new file mode 100644
index 000000000000..bf53623dfd0d
--- /dev/null
+++ b/idl/source/cmptools/makefile.mk
@@ -0,0 +1,47 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=idl
+TARGET=cmptools
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+CDEFS+=-DIDL_COMPILER
+# --- Files --------------------------------------------------------------
+
+OBJFILES= $(OBJ)$/lex.obj \
+ $(OBJ)$/char.obj \
+ $(OBJ)$/hash.obj
+
+# --- Targets ------------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/idl/source/objects/basobj.cxx b/idl/source/objects/basobj.cxx
new file mode 100755
index 000000000000..09b9a317e07a
--- /dev/null
+++ b/idl/source/objects/basobj.cxx
@@ -0,0 +1,786 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_idl.hxx"
+
+#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>
+
+/****************** SvMetaObject *****************************************/
+SV_IMPL_META_FACTORY1( SvMetaObject, SvRttiBase )
+/*************************************************************************
+|* SvMetaObject::SvMetaObject()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaObject::SvMetaObject()
+{
+}
+
+void SvMetaObject::Load( SvPersistStream & )
+{
+}
+
+void SvMetaObject::Save( SvPersistStream & )
+{
+}
+
+/*************************************************************************
+|* SvMetaObject::WriteTab()
+|*
+|* Beschreibung
+*************************************************************************/
+#ifdef IDL_COMPILER
+void SvMetaObject::WriteTab( SvStream & rOutStm, sal_uInt16 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
+*************************************************************************/
+sal_Bool SvMetaObject::TestAndSeekSpaceOnly( SvStream & rOutStm, sal_uLong nBegPos )
+{
+ // keine leeren Klammern schreiben
+ sal_uLong nPos = rOutStm.Tell();
+ rOutStm.Seek( nBegPos );
+ sal_Bool bOnlySpace = sal_True;
+ while( bOnlySpace && rOutStm.Tell() < nPos )
+ {
+ char c;
+ rOutStm >> c;
+ if( !isspace( c ) )
+ bOnlySpace = sal_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
+ sal_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
+*************************************************************************/
+sal_Bool SvMetaObject::ReadSvIdl( SvIdlDataBase &, SvTokenStream & )
+{
+ return sal_False;
+}
+
+/*************************************************************************
+|* SvMetaObject::WriteSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaObject::WriteSvIdl( SvIdlDataBase &, SvStream &, sal_uInt16 /*nTab */ )
+{
+}
+
+/*************************************************************************
+|* SvMetaObject::Write()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaObject::Write( SvIdlDataBase &, SvStream &, sal_uInt16 /*nTab */,
+ WriteType, WriteAttribute )
+{
+}
+
+/*************************************************************************
+|* SvMetaObject::WriteCxx()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaObject::WriteCxx( SvIdlDataBase &, SvStream &, sal_uInt16 /*nTab */ )
+{
+}
+
+/*************************************************************************
+|* SvMetaObject::WriteHxx()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaObject::WriteHxx( SvIdlDataBase &, SvStream &, sal_uInt16 /*nTab */ )
+{
+}
+
+#endif
+
+/****************** SvMetaName *****************************************/
+SV_IMPL_META_FACTORY1( SvMetaName, SvMetaObject );
+/*************************************************************************
+|* SvMetaName::SvMetaName()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaName::SvMetaName()
+{
+}
+
+void SvMetaName::Load( SvPersistStream & rStm )
+{
+ SvMetaObject::Load( rStm );
+ sal_uInt8 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 );
+ sal_uInt8 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
+*************************************************************************/
+sal_Bool SvMetaName::SetName( const ByteString & rName, SvIdlDataBase * )
+{
+ aName = rName;
+ return sal_True;
+}
+
+#ifdef IDL_COMPILER
+/*************************************************************************
+|* SvMetaName::ReadNameSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvMetaName::ReadNameSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ sal_uInt32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+
+ // Modulnamen lesen
+ if( pTok->IsIdentifier() )
+ if( SetName( pTok->GetString(), &rBase ) )
+ return sal_True;
+
+ rInStm.Seek( nTokPos );
+ return sal_False;
+}
+
+/*************************************************************************
+|* SvMetaName::ReadSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaName::ReadAttributesSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ sal_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 )
+{
+ sal_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 &, SvTokenStream & )
+{
+}
+
+/*************************************************************************
+|* SvMetaName::Test()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvMetaName::Test( SvIdlDataBase &, SvTokenStream & )
+{
+ return sal_True;
+}
+
+/*************************************************************************
+|* SvMetaName::WriteContextSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaName::WriteContextSvIdl( SvIdlDataBase &, SvStream &, sal_uInt16 )
+{
+}
+
+/*************************************************************************
+|* SvMetaName::WriteDescription()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaName::WriteDescription( SvStream & rOutStm )
+{
+ rOutStm << "<DESCRIPTION>" << endl;
+
+ ByteString aDesc( GetDescription() );
+ sal_uInt16 nPos = aDesc.Search( '\n' );
+ while ( nPos != STRING_NOTFOUND )
+ {
+ rOutStm << aDesc.Copy( 0, nPos ).GetBuffer() << endl;
+ aDesc.Erase(0,nPos+1);
+ nPos = aDesc.Search( '\n' );
+ }
+
+ rOutStm << aDesc.GetBuffer() << endl << "</DESCRIPTION>" << endl;
+}
+
+/*************************************************************************
+|* SvMetaName::WriteAttributesIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaName::WriteAttributesSvIdl( SvIdlDataBase & rBase,
+ SvStream & rOutStm,
+ sal_uInt16 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
+*************************************************************************/
+sal_Bool SvMetaName::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
+{
+ sal_uInt32 nTokPos = rInStm.Tell();
+ sal_Bool bOk = sal_True;
+ if( rInStm.Read( '[' ) )
+ {
+ sal_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,
+ sal_uInt16 nTab )
+{
+ sal_uLong nBeginPos = rOutStm.Tell();
+ WriteTab( rOutStm, nTab );
+ rOutStm << '[' << endl;
+ sal_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,
+ sal_uInt16 nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ sal_uLong nBeginPos = rOutStm.Tell();
+ WriteTab( rOutStm, nTab );
+ rOutStm << '[' << endl;
+ sal_uLong nOldPos = rOutStm.Tell();
+ WriteAttributes( rBase, rOutStm, nTab +1, nT, nA );
+
+ // keine leeren Klammern schreiben
+ sal_uLong nPos = rOutStm.Tell();
+ rOutStm.Seek( nOldPos );
+ sal_Bool bOnlySpace = sal_True;
+ while( bOnlySpace && rOutStm.Tell() < nPos )
+ {
+ char c;
+ rOutStm >> c;
+ if( !isspace( c ) )
+ bOnlySpace = sal_False;
+ }
+ if( bOnlySpace )
+ // nichts geschrieben
+ rOutStm.Seek( nBeginPos );
+ else
+ {
+ rOutStm.Seek( nPos );
+ WriteTab( rOutStm, nTab );
+ rOutStm << ']' << endl;
+ }
+}
+
+/*************************************************************************
+|* SvMetaName::WriteAttributes()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaName::WriteAttributes( SvIdlDataBase &, SvStream & rOutStm,
+ sal_uInt16 nTab,
+ WriteType, WriteAttribute )
+{
+ 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::CreateFromInt64(
+ GetHelpContext().GetValue() ).GetBuffer()
+ << ")," << endl;
+ }
+}
+
+/*************************************************************************
+|* SvMetaName::WriteContext()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaName::WriteContext( SvIdlDataBase &, SvStream &,
+ sal_uInt16,
+ WriteType, WriteAttribute )
+{
+}
+#endif // IDL_COMPILER
+
+/****************** SvMetaReference *****************************************/
+SV_IMPL_META_FACTORY1( SvMetaReference, SvMetaName );
+
+/*************************************************************************
+|* SvMetaReference::SvMetaReference()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaReference::SvMetaReference()
+{
+}
+
+void SvMetaReference::Load( SvPersistStream & rStm )
+{
+ SvMetaName::Load( rStm );
+
+ sal_uInt8 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
+ sal_uInt8 nMask = 0;
+ if( aRef.Is() )
+ nMask |= 0x01;
+
+ // Daten schreiben
+ rStm << nMask;
+ if( nMask & 0x01 ) rStm << aRef;
+}
+
+/**************************************************************************/
+/****************** SvMetaExtern ******************************************/
+SV_IMPL_META_FACTORY1( SvMetaExtern, SvMetaReference );
+
+/*************************************************************************
+|* SvMetaExtern::SvMetaExtern()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaExtern::SvMetaExtern()
+ : pModule( NULL )
+ , bReadUUId( sal_False )
+ , bReadVersion( sal_False )
+{
+}
+
+void SvMetaExtern::Load( SvPersistStream & rStm )
+{
+ SvMetaReference::Load( rStm );
+
+ sal_uInt8 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 = sal_True;
+ if( nMask & 0x10 ) bReadVersion = sal_True;
+}
+
+void SvMetaExtern::Save( SvPersistStream & rStm )
+{
+ SvMetaReference::Save( rStm );
+
+ // Maske erstellen
+ sal_uInt8 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 = sal_True;
+ if( aVersion.ReadSvIdl( rInStm ) )
+ bReadVersion = sal_True;
+}
+
+/*************************************************************************
+|* SvMetaExtern::WriteAttributesSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaExtern::WriteAttributesSvIdl( SvIdlDataBase & rBase,
+ SvStream & rOutStm, sal_uInt16 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
+*************************************************************************/
+sal_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,
+ sal_uInt16 nTab )
+{
+ SvMetaReference::WriteSvIdl( rBase, rOutStm, nTab );
+}
+
+/*************************************************************************
+|* SvMetaExtern::Write()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaExtern::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
+ sal_uInt16 nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ SvMetaReference::Write( rBase, rOutStm, nTab, nT, nA );
+}
+
+/*************************************************************************
+|* SvMetaExtern::WriteAttributes()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaExtern::WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm,
+ sal_uInt16 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 100755
index 000000000000..19df1c0967b2
--- /dev/null
+++ b/idl/source/objects/bastype.cxx
@@ -0,0 +1,611 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_idl.hxx"
+
+#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>
+
+#ifdef IDL_COMPILER
+/************************************************************************/
+static sal_Bool ReadRangeSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm,
+ sal_uLong nMin, sal_uLong nMax, sal_uLong* pValue )
+{
+ sal_uInt32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+ if( pTok->Is( pName ) )
+ {
+ sal_Bool bOk = sal_False;
+ if( rInStm.Read( '=' ) )
+ {
+ pTok = rInStm.GetToken_Next();
+ if( pTok->IsInteger() )
+ {
+ sal_uLong n = pTok->GetNumber();
+ if ( n >= nMin && n <= nMax )
+ {
+ *pValue = n;
+ bOk = sal_True;
+ }
+ }
+ }
+
+ if( bOk )
+ return sal_True;
+ }
+
+ rInStm.Seek( nTokPos );
+ return sal_False;
+}
+#endif
+
+/*************************************************************************
+|*
+|* SvUINT32::Read()
+|* SvUINT32::Write()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+sal_uInt32 SvUINT32::Read( SvStream & rStm )
+{
+ return SvPersistStream::ReadCompressed( rStm );
+}
+
+void SvUINT32::Write( SvStream & rStm, sal_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 )
+{
+ sal_uInt8 n = rb.nVal;
+ if( rb.bSet )
+ n |= 0x02;
+ rStm << n;
+ return rStm;
+}
+SvStream& operator >> (SvStream & rStm, SvBOOL & rb )
+{
+ sal_uInt8 n;
+ rStm >> n;
+ rb.nVal = (n & 0x01) ? sal_True : sal_False;
+ rb.bSet = (n & 0x02) ? sal_True : sal_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
+
+ int n = r.GetMajorVersion() << 4;
+ n |= r.GetMinorVersion();
+ rStm << (sal_uInt8)n;
+ }
+ else
+ {
+ rStm << (sal_uInt8)0;
+ rStm << r.GetMajorVersion();
+ rStm << r.GetMinorVersion();
+ }
+ return rStm;
+}
+
+SvStream& operator >> (SvStream & rStm, SvVersion & r )
+{
+ sal_uInt8 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
+/************************************************************************/
+
+/*************************************************************************
+|*
+|* SvBOOL::ReadSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+sal_Bool SvBOOL::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm )
+{
+ sal_uInt32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+
+ if( pTok->Is( pName ) )
+ {
+ sal_Bool bOk = sal_True;
+ sal_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 = sal_True; //Defaultaktion ist auf sal_True setzen
+ if( bOk )
+ return sal_True;
+ }
+ rInStm.Seek( nTokPos );
+ return sal_False;
+}
+
+/*************************************************************************
+|*
+|* SvBOOL::WriteSvIdl()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+sal_Bool SvBOOL::WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm )
+{
+ if( nVal )
+ rOutStm << pName->GetName().GetBuffer();
+ else
+ rOutStm << pName->GetName().GetBuffer() << "(FALSE)";
+ return sal_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
+|*
+*************************************************************************/
+sal_Bool SvIdentifier::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm )
+{
+ sal_uInt32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+
+ if( pTok->Is( pName ) )
+ {
+ sal_Bool bOk = sal_True;
+ sal_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 sal_True;
+ }
+ rInStm.Seek( nTokPos );
+ return sal_False;
+}
+
+/*************************************************************************
+|*
+|* SvIdentifier::WriteSvIdl()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+sal_Bool SvIdentifier::WriteSvIdl( SvStringHashEntry * pName,
+ SvStream & rOutStm,
+ sal_uInt16 /*nTab */ )
+{
+ rOutStm << pName->GetName().GetBuffer() << '(';
+ rOutStm << GetBuffer() << ')';
+ return sal_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
+|*
+*************************************************************************/
+sal_Bool SvNumberIdentifier::ReadSvIdl( SvIdlDataBase & rBase,
+ SvStringHashEntry * pName,
+ SvTokenStream & rInStm )
+{
+ if( SvIdentifier::ReadSvIdl( pName, rInStm ) )
+ {
+ sal_uLong n;
+ if( rBase.FindId( *this, &n ) )
+ {
+ nValue = n;
+ return sal_True;
+ }
+ else
+ {
+ ByteString aStr ("no value for identifier <");
+ aStr += *this;
+ aStr += "> ";
+ rBase.SetError( aStr, rInStm.GetToken() );
+ rBase.WriteError( rInStm );
+ }
+ }
+ return sal_False;
+}
+
+/*************************************************************************
+|*
+|* SvNumberIdentifier::ReadSvIdl()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+sal_Bool SvNumberIdentifier::ReadSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ sal_uInt32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+
+ if( pTok->IsIdentifier() )
+ {
+ sal_uLong n;
+ if( rBase.FindId( pTok->GetString(), &n ) )
+ {
+ *(ByteString *)this = pTok->GetString();
+ nValue = n;
+ return sal_True;
+ }
+ else
+ {
+ ByteString aStr ("no value for identifier <");
+ aStr += *this;
+ aStr += "> ";
+ rBase.SetError( aStr, rInStm.GetToken() );
+ rBase.WriteError( rInStm );
+ }
+ }
+ rInStm.Seek( nTokPos );
+ return sal_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
+|*
+*************************************************************************/
+sal_Bool SvString::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm )
+{
+ sal_uInt32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+
+ if( pTok->Is( pName ) )
+ {
+ sal_Bool bOk = sal_True;
+ sal_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 sal_True;
+ }
+ rInStm.Seek( nTokPos );
+ return sal_False;
+}
+
+/*************************************************************************
+|*
+|* SvString::WriteSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+sal_Bool SvString::WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm,
+ sal_uInt16 /*nTab */ )
+{
+ rOutStm << pName->GetName().GetBuffer() << "(\"";
+ rOutStm << GetBuffer() << "\")";
+ return sal_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
+|*
+*************************************************************************/
+sal_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
+|*
+*************************************************************************/
+sal_Bool SvHelpText::WriteSvIdl( SvIdlDataBase &, SvStream & rOutStm, sal_uInt16 nTab )
+{
+ return SvString::WriteSvIdl( SvHash_HelpText(), rOutStm, nTab );
+}
+
+/************************************************************************/
+/*************************************************************************
+|*
+|* SvUUId::ReadSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+sal_Bool SvUUId::ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm )
+{
+ sal_uInt32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+
+ if( pTok->Is( SvHash_uuid() ) )
+ {
+ sal_Bool bOk = sal_True;
+ sal_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 sal_True;
+ }
+ rInStm.Seek( nTokPos );
+ return sal_False;
+}
+
+/*************************************************************************
+|*
+|* SvMetaObject::WriteSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+sal_Bool SvUUId::WriteSvIdl( SvStream & rOutStm )
+{
+ // Global Id schreiben
+ rOutStm << SvHash_uuid()->GetName().GetBuffer() << "(\"";
+ rOutStm << ByteString( GetHexName(), RTL_TEXTENCODING_UTF8 ).GetBuffer() << "\")";
+ return sal_True;
+}
+
+
+/************************************************************************/
+/*************************************************************************
+|*
+|* SvVersion::ReadSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+sal_Bool SvVersion::ReadSvIdl( SvTokenStream & rInStm )
+{
+ sal_uLong n = 0;
+
+ sal_uInt32 nTokPos = rInStm.Tell();
+ if( ReadRangeSvIdl( SvHash_Version(), rInStm, 0 , 0xFFFF, &n ) )
+ {
+ nMajorVersion = (sal_uInt16)n;
+ if( rInStm.Read( '.' ) )
+ {
+ SvToken * pTok = rInStm.GetToken_Next();
+ if( pTok->IsInteger() && pTok->GetNumber() <= 0xFFFF )
+ {
+ nMinorVersion = (sal_uInt16)pTok->GetNumber();
+ return sal_True;
+ }
+ }
+ else
+ return sal_True;
+ }
+ rInStm.Seek( nTokPos );
+ return sal_False;
+}
+
+/*************************************************************************
+|*
+|* SvVersion::WriteSvIdl()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+sal_Bool SvVersion::WriteSvIdl( SvStream & rOutStm )
+{
+ rOutStm << SvHash_Version()->GetName().GetBuffer() << '('
+ << ByteString::CreateFromInt32( nMajorVersion ).GetBuffer() << '.'
+ << ByteString::CreateFromInt32( nMinorVersion ).GetBuffer() << ')';
+ return sal_True;
+}
+#endif //IDL_COMPILER
+
+
diff --git a/idl/source/objects/makefile.mk b/idl/source/objects/makefile.mk
new file mode 100644
index 000000000000..e141d85540de
--- /dev/null
+++ b/idl/source/objects/makefile.mk
@@ -0,0 +1,50 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=idl
+TARGET=objects
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+CDEFS+=-DIDL_COMPILER
+# --- Files --------------------------------------------------------------
+
+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 100755
index 000000000000..f8d68dabbbf6
--- /dev/null
+++ b/idl/source/objects/module.cxx
@@ -0,0 +1,688 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_idl.hxx"
+
+#include <ctype.h>
+#include <stdio.h>
+
+#include <attrib.hxx>
+#include <module.hxx>
+#include <globals.hxx>
+#include <database.hxx>
+#include <tools/fsys.hxx>
+#include <tools/debug.hxx>
+
+/****************** SvMetaModule ******************************************/
+SV_IMPL_META_FACTORY1( SvMetaModule, SvMetaExtern );
+
+/*************************************************************************
+|*
+|* SvMetaModule::SvMetaModule()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+SvMetaModule::SvMetaModule()
+#ifdef IDL_COMPILER
+ : bImported( sal_False )
+ , bIsModified( sal_False )
+#endif
+{
+}
+
+#ifdef IDL_COMPILER
+SvMetaModule::SvMetaModule( const String & rIdlFileName, sal_Bool bImp )
+ : aIdlFileName( rIdlFileName )
+ , bImported( bImp ), bIsModified( sal_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 = sal_True; // immer importiert
+ SvMetaExtern::Load( rStm );
+
+ sal_uInt16 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
+ sal_uInt16 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 << (sal_uInt16)(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
+ sal_uInt16 nCmpLen = 0;
+ sal_uLong nLenPos = rStm.Tell();
+ rStm << nCmpLen;
+#ifdef IDL_COMPILER
+ rStm << aBeginName;
+ rStm << aEndName;
+ rStm << aNextName;
+ // Laenge der Compiler Daten schreiben
+ sal_uLong nPos = rStm.Tell();
+ rStm.Seek( nLenPos );
+ rStm << (sal_uInt16)( nPos - nLenPos - sizeof( sal_uInt16 ) );
+ rStm.Seek( nPos );
+#endif
+}
+
+/*************************************************************************
+|*
+|* SvMetaModule::SetName()
+|*
+|* Beschreibung
+|* Ersterstellung MM 12.12.94
+|* Letzte Aenderung MM 12.12.94
+|*
+*************************************************************************/
+sal_Bool SvMetaModule::SetName( const ByteString & rName, SvIdlDataBase * pBase )
+{
+ if( pBase )
+ {
+ if( pBase->GetModule( rName ) )
+ return sal_False;
+ }
+ return SvMetaExtern::SetName( rName );
+}
+
+#ifdef IDL_COMPILER
+/*************************************************************************
+|* SvMetaModule::GetNextName()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvMetaModule::FillNextName( SvGlobalName * pName )
+{
+ *pName = aNextName;
+
+ if( aNextName < aEndName )
+ {
+ ++aNextName;
+ bIsModified = sal_True;
+ return sal_True;
+ }
+ return sal_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 ) )
+ {
+ sal_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,
+ sal_uInt16 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 )
+{
+ sal_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() ) )
+ {
+ sal_Bool bOk = sal_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() );
+
+ sal_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,
+ sal_uInt16 nTab )
+{
+ SvMetaExtern::WriteContextSvIdl( rBase, rOutStm, nTab );
+ sal_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
+|*
+*************************************************************************/
+sal_Bool SvMetaModule::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
+{
+ bIsModified = sal_True; // bisher immer wenn Compiler laueft
+
+ sal_uInt32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+ sal_Bool bOk = sal_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,
+ sal_uInt16 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( sal_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( sal_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,
+ sal_uInt16 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( sal_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,
+ sal_uInt16 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( sal_uLong n = 0; n < aTypeList.Count(); n++ )
+ {
+ SvMetaType * pType = aTypeList.GetObject( n );
+ if( !pType ->Write( rBase, rOutStm, nTab +1, nT, nA ) )
+ return sal_False;
+ }
+ */
+ /*
+ for( sal_uLong n = 0; n < rBase.GetModuleList().Count(); n++ )
+ {
+ SvMetaModule * pModule = rBase.GetModuleList().GetObject( n );
+ const SvMetaTypeMemberList &rTypeList = pModule->GetTypeList();
+ for( sal_uLong n = 0; n < rTypeList.Count(); n++ )
+ {
+ SvMetaType * pType = rTypeList.GetObject( n );
+ pType->Write( rBase, rOutStm, nTab +1, nT, nA );
+ }
+ }
+ */
+
+ for( sal_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( rOutStm );
+ rOutStm << "</MODULE>" << endl << endl;
+
+ rOutStm << "<CLASSES>" << endl;
+ for( sal_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( sal_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( sal_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;
+
+ default:
+ 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( sal_uLong n = 0; n < aClassList.Count(); n++ )
+ {
+ aClassList.GetObject( n )->WriteSrc( rBase, rOutStm, pTable );
+ }
+}
+
+/*************************************************************************
+|* SvMetaModule::WriteHxx()
+*************************************************************************/
+void SvMetaModule::WriteHxx( SvIdlDataBase & rBase, SvStream & rOutStm,
+ sal_uInt16 nTab )
+{
+ for( sal_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,
+ sal_uInt16 nTab )
+{
+ for( sal_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 100755
index 000000000000..e9bddda61f9a
--- /dev/null
+++ b/idl/source/objects/object.cxx
@@ -0,0 +1,1047 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_idl.hxx"
+
+#include <ctype.h>
+#include <stdio.h>
+
+#include <tools/debug.hxx>
+
+#include <attrib.hxx>
+#include <object.hxx>
+#include <globals.hxx>
+#include <database.hxx>
+
+/******************** class SvClassElement *******************************/
+SV_IMPL_PERSIST1( SvClassElement, SvPersistBase );
+
+/*************************************************************************
+|* SvClassElement::SvClassElement()
+|*
+|* Beschreibung
+*************************************************************************/
+SvClassElement::SvClassElement()
+{
+};
+
+/*************************************************************************
+|* SvClassElement::Load()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvClassElement::Load( SvPersistStream & rStm )
+{
+ sal_uInt8 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
+ sal_uInt8 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 );
+/*************************************************************************
+|* SvMetaClass::SvMetaClass()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaClass::SvMetaClass()
+ : aAutomation( sal_True, sal_False )
+{
+}
+
+/*************************************************************************
+|* SvMetaClass::Load()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaClass::Load( SvPersistStream & rStm )
+{
+ SvMetaType::Load( rStm );
+
+ sal_uInt8 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
+ sal_uInt8 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,
+ sal_Bool bVariable )
+{
+ // alle Attribute der Klasse schreiben
+ sal_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, sal_True );
+ FillSbxMemberObject( rBase, pObj, aSuperList, sal_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, sal_uInt16 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 )
+{
+ sal_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( sal_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 );
+
+ sal_Bool bOk = sal_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,
+ sal_uInt16 nTab
+)
+{
+ //SvMetaType::WriteContextSvIdl( rBase, rOutStm, nTab );
+ sal_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 );
+ 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
+*************************************************************************/
+sal_Bool SvMetaClass::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
+{
+ sal_uLong nTokPos = rInStm.Tell();
+ if( SvMetaType::ReadHeaderSvIdl( rBase, rInStm ) && GetType() == TYPE_CLASS )
+ {
+ sal_Bool bOk = sal_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 sal_False;
+}
+
+/*************************************************************************
+|* SvMetaClass::TestAttribute()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_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( sal_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 sal_False;
+ }
+ }
+ else
+ {
+ sal_uInt32 nId1 = pS->GetSlotId().GetValue();
+ sal_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 sal_False;
+ }
+ }
+ }
+ SvMetaClass * pSC = aSuperClass;
+ if( pSC )
+ return pSC->TestAttribute( rBase, rInStm, rAttr );
+ return sal_True;
+}
+
+/*************************************************************************
+|* SvMetaClass::WriteSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaClass::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
+ sal_uInt16 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,
+ sal_Bool bVariable, sal_Bool bWriteTab,
+ SvIdlDataBase & rBase,
+ SvStream & rOutStm, sal_uInt16 nTab )
+{
+ // alle Attribute schreiben
+ sal_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,
+ sal_uInt16 nTab,
+ WriteType nT, WriteAttribute )
+{
+ 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, sal_True, sal_True, rBase, rOutStm, nTab );
+
+ WriteTab( rOutStm, nTab );
+ rOutStm << "methods:";
+ rOutStm << endl;
+
+ WriteOdlMembers( aSuperList, sal_False, sal_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( rOutStm );
+ rOutStm << "</INTERFACE>" << endl << endl;
+
+ // alle Attribute schreiben
+ sal_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;
+ }
+ default:
+ break;
+ }
+}
+
+/*************************************************************************
+|* SvMetaClass::WriteSlotParamArray()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_uInt16 SvMetaClass::WriteSlotParamArray( SvIdlDataBase & rBase,
+ SvSlotElementList & rSlotList,
+ SvStream & rOutStm )
+{
+ sal_uInt16 nCount = 0;
+ for( sal_uLong n = 0; n < rSlotList.Count(); n++ )
+ {
+ SvSlotElement *pEle = rSlotList.GetObject( n );
+ SvMetaSlot *pAttr = pEle->xSlot;
+ nCount = nCount + pAttr->WriteSlotParamArray( rBase, rOutStm );
+ }
+
+ return nCount;
+}
+
+/*************************************************************************
+|* SvMetaClass::WriteSlots()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_uInt16 SvMetaClass::WriteSlots( const ByteString & rShellName,
+ sal_uInt16 nCount, SvSlotElementList & rSlotList,
+ SvIdlDataBase & rBase,
+ SvStream & rOutStm )
+{
+ sal_uInt16 nSCount = 0;
+ for( sal_uLong n = 0; n < rSlotList.Count(); n++ )
+ {
+ rSlotList.Seek(n);
+ SvSlotElement * pEle = rSlotList.GetCurObject();
+ SvMetaSlot * pAttr = pEle->xSlot;
+ nSCount = 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
+ sal_uLong n;
+ for( n = 0; n < aAttrList.Count(); n++ )
+ {
+ SvMetaAttribute * pAttr = aAttrList.GetObject( n );
+
+ sal_uLong nId = pAttr->GetSlotId().GetValue();
+ sal_uInt16 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( sal_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( sal_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 classList;
+ SvSlotElementList aSlotList;
+ InsertSlots(aSlotList, aSuperList, classList, ByteString(), rBase);
+ sal_uLong n;
+ for ( n=0; n<aSlotList.Count(); n++ )
+ {
+ SvSlotElement *pEle = aSlotList.GetObject( n );
+ SvMetaSlot *pSlot = pEle->xSlot;
+ pSlot->SetListPos(n);
+ }
+
+ sal_uLong nSlotCount = aSlotList.Count();
+
+ // alle Attribute schreiben
+ sal_uInt16 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( sal_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( sal_uLong n=0; n<aAttrList.Count(); n++ )
+ {
+ SvMetaAttribute * pAttr = aAttrList.GetObject( n );
+ pAttr->WriteSrc( rBase, rOutStm, pTable );
+ }
+}
+
+/*************************************************************************
+|* SvMetaClass::WriteHxx()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaClass::WriteHxx( SvIdlDataBase &, SvStream & rOutStm, sal_uInt16 )
+{
+ 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 sal_Bool FillTypeLibInfo( SvGlobalName *, sal_uInt16 * pMajor," << endl
+ << "\t sal_uInt16 * pMinor ) const;" << endl
+ << "\tvirtual sal_Bool FillTypeLibInfo( ByteString * pName, sal_uInt16 * pMajor," << endl;
+ rOutStm
+ << "\t sal_uInt16 * 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 &, SvStream & rOutStm, sal_uInt16 )
+{
+ ByteString aSuperName( "SvDispatch" );
+ if( GetSuperClass() )
+ aSuperName = GetSuperClass()->GetName();
+ const char * pSup = aSuperName.GetBuffer();
+
+ ByteString name = GetSvName();
+ // GetTypeName
+ rOutStm << "SvGlobalName " << name.GetBuffer() << "::GetTypeName() const" << endl
+ << '{' << endl
+ << "\treturn ClassName();" << endl
+ << '}' << endl;
+
+ SvMetaModule * pMod = GetModule();
+ // FillTypeLibInfo
+ rOutStm << "sal_Bool " << name.GetBuffer() << "::FillTypeLibInfo( SvGlobalName * pGN," << endl
+ << "\t sal_uInt16 * pMajor," << endl
+ << "\t sal_uInt16 * 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 sal_True;" << endl
+ << '}' << endl;
+
+ // FillTypeLibInfo
+ rOutStm << "sal_Bool " << name.GetBuffer() << "::FillTypeLibInfo( ByteString * pName,"
+ << "\t sal_uInt16 * pMajor," << endl
+ << "\t sal_uInt16 * 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 sal_True;" << endl
+ << '}' << endl;
+
+ rOutStm << "void " << name.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 100755
index 000000000000..6c7018959a9d
--- /dev/null
+++ b/idl/source/objects/slot.cxx
@@ -0,0 +1,1820 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_idl.hxx"
+
+#include <ctype.h>
+#include <stdio.h>
+#include <tools/debug.hxx>
+#include <attrib.hxx>
+#include <slot.hxx>
+#include <globals.hxx>
+#include <database.hxx>
+
+/****************** SvMetaSlot *****************************************/
+SV_IMPL_META_FACTORY1( SvMetaSlot, SvMetaAttribute );
+
+SvMetaObject *SvMetaSlot::MakeClone() const
+{
+ return new SvMetaSlot( *this );
+}
+
+/*************************************************************************
+|* SvMetaSlot::SvMetaSlot()
+|*
+|* Beschreibung Zweites sal_False bei den SvBOOL-Objekten bedeutet,
+|* IsSet() liefert sal_False (Defaultinitialisierung).
+*************************************************************************/
+SvMetaSlot::SvMetaSlot()
+ : aCachable( sal_True, sal_False )
+ , aSynchron( sal_True, sal_False )
+ , aRecordPerSet( sal_True, sal_False )
+ , aRecordAbsolute( sal_False, sal_False )
+ , pLinkedSlot(0)
+ , pNextSlot(0)
+ , pEnumValue(0)
+{
+}
+
+SvMetaSlot::SvMetaSlot( SvMetaType * pType )
+ : SvMetaAttribute( pType )
+ , aCachable( sal_True, sal_False )
+ , aSynchron( sal_True, sal_False )
+ , aRecordPerSet( sal_True, sal_False )
+ , aRecordAbsolute( sal_False, sal_False )
+ , pLinkedSlot(0)
+ , pNextSlot(0)
+ , pEnumValue(0)
+{
+}
+
+/*
+#define TEST_READ \
+{ \
+ sal_uInt32 nPos; \
+ rStm >> nPos; \
+ DBG_ASSERT( nPos +4 == rStm.Tell(), "stream pos error" ); \
+}
+
+#define TEST_WRITE \
+ rStm << (sal_uInt32)rStm.Tell();
+*/
+#define TEST_READ
+#define TEST_WRITE
+
+void SvMetaSlot::Load( SvPersistStream & rStm )
+{
+ SvMetaAttribute::Load( rStm );
+
+ sal_uInt16 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 >> aImageRotation;
+
+ nMask = 0;
+ rStm >> nMask;
+
+ TEST_READ
+ if( nMask & 0x0001 ) rStm >> aUnoName;
+ if( nMask & 0x0002 ) rStm >> aImageReflection;
+}
+
+void SvMetaSlot::Save( SvPersistStream & rStm )
+{
+ SvMetaAttribute::Save( rStm );
+
+ // Maske erstellen
+ sal_uInt16 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( aImageRotation.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 << aImageRotation;
+
+ nMask = 0;
+ if( aUnoName.IsSet() ) nMask |= 0x0001;
+ if( aImageReflection.IsSet() ) nMask |= 0x0002;
+ rStm << nMask;
+ TEST_WRITE
+ if( nMask & 0x0001 ) rStm << aUnoName;
+ TEST_WRITE
+ if( nMask & 0x0002 ) rStm << aImageReflection;
+}
+
+/*************************************************************************
+|* SvMetaSlot::IsVariable()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvMetaSlot::IsVariable() const
+{
+ return SvMetaAttribute::IsVariable();
+}
+
+/*************************************************************************
+|* SvMetaSlot::IsMethod()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvMetaSlot::IsMethod() const
+{
+ sal_Bool b = SvMetaAttribute::IsMethod();
+ b |= NULL != GetMethod();
+ return b;
+}
+
+/*************************************************************************
+|* SvMetaSlot::HasMethods()
+|*
+|* Beschreibung
+*************************************************************************/
+ByteString SvMetaSlot::GetMangleName( sal_Bool bVariable ) const
+{
+ if( !bVariable )
+ {
+ SvMetaAttribute * pMeth = GetMethod();
+ if( pMeth )
+ return pMeth->GetName();
+ }
+ return GetName();
+}
+
+/*************************************************************************
+|* Referenz
+|*
+|* Beschreibung Zweites sal_False bei den SvBOOL-Objekten bedeutet,
+|* IsSet() liefert sal_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();
+}
+sal_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();
+}
+sal_Bool SvMetaSlot::GetPseudoSlots() const
+{
+ if( aPseudoSlots.IsSet() || !GetRef() ) return aPseudoSlots;
+ return ((SvMetaSlot *)GetRef())->GetPseudoSlots();
+}
+/*
+sal_Bool SvMetaSlot::GetGet() const
+{
+ if( aGet.IsSet() || !GetRef() ) return aGet;
+ return ((SvMetaSlot *)GetRef())->GetGet();
+}
+sal_Bool SvMetaSlot::GetSet() const
+{
+ if( aSet.IsSet() || !GetRef() ) return aSet;
+ return ((SvMetaSlot *)GetRef())->GetSet();
+}
+*/
+sal_Bool SvMetaSlot::GetCachable() const
+{
+ // Cachable und Volatile sind exclusiv
+ if( !GetRef() || aCachable.IsSet() || aVolatile.IsSet() )
+ return aCachable;
+ return ((SvMetaSlot *)GetRef())->GetCachable();
+}
+sal_Bool SvMetaSlot::GetVolatile() const
+{
+ // Cachable und Volatile sind exclusiv
+ if( !GetRef() || aVolatile.IsSet() || aCachable.IsSet() )
+ return aVolatile;
+ return ((SvMetaSlot *)GetRef())->GetVolatile();
+}
+sal_Bool SvMetaSlot::GetToggle() const
+{
+ if( aToggle.IsSet() || !GetRef() ) return aToggle;
+ return ((SvMetaSlot *)GetRef())->GetToggle();
+}
+sal_Bool SvMetaSlot::GetAutoUpdate() const
+{
+ if( aAutoUpdate.IsSet() || !GetRef() ) return aAutoUpdate;
+ return ((SvMetaSlot *)GetRef())->GetAutoUpdate();
+}
+sal_Bool SvMetaSlot::GetSynchron() const
+{
+ // Synchron und Asynchron sind exclusiv
+ if( !GetRef() || aSynchron.IsSet() || aAsynchron.IsSet() )
+ return aSynchron;
+ return ((SvMetaSlot *)GetRef())->GetSynchron();
+}
+sal_Bool SvMetaSlot::GetAsynchron() const
+{
+ // Synchron und Asynchron sind exclusiv
+ if( !GetRef() || aAsynchron.IsSet() || aSynchron.IsSet() )
+ return aAsynchron;
+ return ((SvMetaSlot *)GetRef())->GetAsynchron();
+}
+sal_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();
+}
+sal_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();
+}
+sal_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();
+}
+sal_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();
+}
+sal_Bool SvMetaSlot::GetRecordAbsolute() const
+{
+ if( !GetRef() || aRecordAbsolute.IsSet() )
+ return aRecordAbsolute;
+ return ((SvMetaSlot *)GetRef())->GetRecordAbsolute();
+}
+sal_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();
+}
+sal_Bool SvMetaSlot::GetMenuConfig() const
+{
+ if( aMenuConfig.IsSet() || !GetRef() ) return aMenuConfig;
+ return ((SvMetaSlot *)GetRef())->GetMenuConfig();
+}
+sal_Bool SvMetaSlot::GetToolBoxConfig() const
+{
+ if( aToolBoxConfig.IsSet() || !GetRef() ) return aToolBoxConfig;
+ return ((SvMetaSlot *)GetRef())->GetToolBoxConfig();
+}
+sal_Bool SvMetaSlot::GetStatusBarConfig() const
+{
+ if( aStatusBarConfig.IsSet() || !GetRef() ) return aStatusBarConfig;
+ return ((SvMetaSlot *)GetRef())->GetStatusBarConfig();
+}
+sal_Bool SvMetaSlot::GetAccelConfig() const
+{
+ if( aAccelConfig.IsSet() || !GetRef() ) return aAccelConfig;
+ return ((SvMetaSlot *)GetRef())->GetAccelConfig();
+}
+sal_Bool SvMetaSlot::GetFastCall() const
+{
+ if( aFastCall.IsSet() || !GetRef() ) return aFastCall;
+ return ((SvMetaSlot *)GetRef())->GetFastCall();
+}
+sal_Bool SvMetaSlot::GetContainer() const
+{
+ if( aContainer.IsSet() || !GetRef() ) return aContainer;
+ return ((SvMetaSlot *)GetRef())->GetContainer();
+}
+
+sal_Bool SvMetaSlot::GetImageRotation() const
+{
+ if( aImageRotation.IsSet() || !GetRef() ) return aImageRotation;
+ return ((SvMetaSlot *)GetRef())->GetImageRotation();
+}
+
+sal_Bool SvMetaSlot::GetImageReflection() const
+{
+ if( aImageReflection.IsSet() || !GetRef() ) return aImageReflection;
+ return ((SvMetaSlot *)GetRef())->GetImageReflection();
+}
+
+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,
+ sal_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, sal_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 );
+
+ sal_Bool bOk = sal_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 = sal_True;
+ if( aVolatile.ReadSvIdl( SvHash_Volatile(), rInStm ) )
+ SetVolatile( aVolatile ), bOk = sal_True;
+ if( aToggle.ReadSvIdl( SvHash_Toggle(), rInStm ) )
+ SetToggle( aToggle ), bOk = sal_True;
+ if( aAutoUpdate.ReadSvIdl( SvHash_AutoUpdate(), rInStm ) )
+ SetAutoUpdate( aAutoUpdate ), bOk = sal_True;
+
+ if( aSynchron.ReadSvIdl( SvHash_Synchron(), rInStm ) )
+ SetSynchron( aSynchron ), bOk = sal_True;
+ if( aAsynchron.ReadSvIdl( SvHash_Asynchron(), rInStm ) )
+ SetAsynchron( aAsynchron ), bOk = sal_True;
+
+ if( aRecordAbsolute.ReadSvIdl( SvHash_RecordAbsolute(), rInStm ) )
+ SetRecordAbsolute( aRecordAbsolute), bOk = sal_True;
+ if( aRecordPerItem.ReadSvIdl( SvHash_RecordPerItem(), rInStm ) )
+ SetRecordPerItem( aRecordPerItem ), bOk = sal_True;
+ if( aRecordPerSet.ReadSvIdl( SvHash_RecordPerSet(), rInStm ) )
+ SetRecordPerSet( aRecordPerSet ), bOk = sal_True;
+ if( aRecordManual.ReadSvIdl( SvHash_RecordManual(), rInStm ) )
+ SetRecordManual( aRecordManual ), bOk = sal_True;
+ if( aNoRecord.ReadSvIdl( SvHash_NoRecord(), rInStm ) )
+ SetNoRecord( aNoRecord ), bOk = sal_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 = sal_True;
+ bOk |= aFastCall.ReadSvIdl( SvHash_FastCall(), rInStm );
+ bOk |= aContainer.ReadSvIdl( SvHash_Container(), rInStm );
+ bOk |= aImageRotation.ReadSvIdl( SvHash_ImageRotation(), rInStm );
+ bOk |= aImageReflection.ReadSvIdl( SvHash_ImageReflection(), rInStm );
+ bOk |= aUnoName.ReadSvIdl( SvHash_UnoName(), rInStm );
+
+ if( !bOk )
+ {
+ if( !aSlotType.Is() )
+ {
+ sal_uInt32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+ if( pTok->Is( SvHash_SlotType() ) )
+ {
+ sal_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();
+ sal_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,
+ sal_uInt16 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 const * 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 == sal_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 == sal_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 == sal_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( aImageRotation )
+ {
+ ( aOut += aDel ) += aImageRotation.GetSvIdlString( SvHash_ImageRotation() );
+ aDel = ", ";
+ }
+
+ if( aImageReflection )
+ {
+ ( aOut += aDel ) += aImageReflection.GetSvIdlString( SvHash_ImageReflection() );
+ aDel = ", ";
+ }
+
+ if( aOut.Len() )
+ {
+ WriteTab( rOutStm, nTab );
+ rOutStm << aOut.GetBuffer() << endl;
+ }
+}
+
+
+/*************************************************************************
+|* SvMetaSlot::Test()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvMetaSlot::Test( SvIdlDataBase & rBase, SvTokenStream & rInStm )
+{
+ sal_Bool bOk = SvMetaAttribute::Test( rBase, rInStm );
+ if( bOk )
+ {
+ SvMetaType * pType = GetType();
+ if( pType->GetType() == TYPE_METHOD )
+ pType = pType->GetReturnType();
+ if( !pType->IsItem() )
+ {
+ rBase.SetError( "this attribute is not a slot", rInStm.GetToken() );
+ rBase.WriteError( rInStm );
+ bOk = sal_False;
+ }
+ }
+
+ return bOk;
+}
+
+/*************************************************************************
+|* SvMetaSlot::ReadSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvMetaSlot::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
+{
+ sal_uInt32 nTokPos = rInStm.Tell();
+ sal_Bool bOk = sal_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 = sal_False;
+ }
+ }
+ else
+ {
+ bOk = SvMetaAttribute::ReadSvIdl( rBase, rInStm );
+
+ SvMetaAttribute *pAttr2 = rBase.SearchKnownAttr( GetSlotId() );
+ if( pAttr2 )
+ {
+ // F"ur Testzwecke: Referenz bei kompletter Definition
+ SvMetaSlot * pKnownSlot = PTR_CAST( SvMetaSlot, pAttr2 );
+ if( pKnownSlot )
+ {
+ SetRef( pKnownSlot );
+
+ // Namen d"urfen abweichen, da mit angegeben
+ if ( pKnownSlot->GetName() != GetName() )
+ {
+ DBG_ERROR("Illegal definition!");
+ rInStm.Seek( nTokPos );
+ return sal_False;
+ }
+
+ SetName( pKnownSlot->GetName(), &rBase );
+ }
+ else
+ {
+ ByteString aStr( "attribute " );
+ aStr += pAttr2->GetName();
+ aStr += " is method or variable but not a slot";
+ rBase.SetError( aStr, rInStm.GetToken() );
+ rBase.WriteError( rInStm );
+ bOk = sal_False;
+ }
+ }
+ }
+
+ if( !bOk )
+ rInStm.Seek( nTokPos );
+
+ return bOk;
+}
+
+/*************************************************************************
+|* SvMetaSlot::WriteSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaSlot::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
+ sal_uInt16 nTab )
+{
+ SvMetaAttribute::WriteSvIdl( rBase, rOutStm, nTab );
+}
+
+/*************************************************************************
+|* SvMetaSlot::Write()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaSlot::Write( SvIdlDataBase & rBase,
+ SvStream & rOutStm, sal_uInt16 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
+ sal_uInt16 nId = (sal_uInt16) GetSlotId().GetValue();
+ sal_uInt16 nListCount = (sal_uInt16) rList.Count();
+ sal_uInt16 nPos;
+ sal_uLong m; // for inner "for" loop
+
+ if ( !nListCount )
+ nPos = 0;
+ else if ( nListCount == 1 )
+ nPos = rList.GetObject(0)->xSlot->GetSlotId().GetValue() >= nId ? 0 : 1;
+ else
+ {
+ sal_uInt16 nMid = 0, nLow = 0;
+ sal_uInt16 nHigh = nListCount - 1;
+ sal_Bool bFound = sal_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 = sal_True;
+ }
+
+ DBG_ASSERT(!bFound, "Duplicate SlotId!");
+ nPos = bFound ? nMid : nLow;
+ }
+
+ DBG_ASSERT( nPos <= nListCount,
+ "nPos too large" );
+ DBG_ASSERT( nPos == nListCount || nId <=
+ (sal_uInt16) rList.GetObject(nPos)->xSlot->GetSlotId().GetValue(),
+ "Successor has lower SlotId" );
+ DBG_ASSERT( nPos == 0 || nId >
+ (sal_uInt16) rList.GetObject(nPos-1)->xSlot->GetSlotId().GetValue(),
+ "Predecessor has higher SlotId" );
+ DBG_ASSERT( nPos+1 >= nListCount || nId <
+ (sal_uInt16) rList.GetObject(nPos+1)->xSlot->GetSlotId().GetValue(),
+ "Successor has lower 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;
+ SvMetaSlot *pFirstEnumSlot = NULL;
+ for( sal_uLong n = 0; n < pEnum->Count(); n++ )
+ {
+ // Die SlotId erzeugen
+ SvMetaEnumValue *enumValue = pEnum->GetObject(n);
+ ByteString aValName = enumValue->GetName();
+ ByteString aSId( GetSlotId() );
+ if( GetPseudoPrefix().Len() )
+ aSId = GetPseudoPrefix();
+ aSId += '_';
+ aSId += aValName.Copy( pEnum->GetPrefix().Len() );
+
+ xEnumSlot = NULL;
+ for( m=0; m<rBase.GetAttrList().Count(); m++ )
+ {
+ SvMetaAttribute * pAttr = rBase.GetAttrList().GetObject( m );
+ if( pAttr->GetSlotId() == aSId )
+ {
+ SvMetaSlot* pSlot = PTR_CAST( SvMetaSlot, pAttr );
+ xEnumSlot = pSlot->Clone();
+ break;
+ }
+ }
+
+ if ( m == rBase.GetAttrList().Count() )
+ {
+ DBG_ERROR("Invalid EnumSlot!");
+ xEnumSlot = Clone();
+ sal_uLong nValue;
+ if ( rBase.FindId(aSId , &nValue) )
+ {
+ SvNumberIdentifier aId;
+ *((SvIdentifier*)&aId) = aSId;
+ aId.SetValue(nValue);
+ xEnumSlot->SetSlotId(aId);
+ }
+ }
+
+ // Die Slaves sind kein Master !
+ xEnumSlot->aPseudoSlots = sal_False;
+ xEnumSlot->SetEnumValue(enumValue);
+
+ if ( !pFirstEnumSlot || 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;
+ }
+
+ // Master zeigt auf den ersten Slave
+ pLinkedSlot = pFirstEnumSlot;
+
+ // Slaves untereinander verketten
+ rList.Seek((sal_uLong)0);
+ 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" )
+ {
+ sal_Bool bIn = sal_False;
+ for( sal_uInt16 n = 0; n < rList.Count(); n++ )
+ {
+ if( *(rList.GetObject(n)) == aMethodName )
+ {
+ bIn=sal_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" )
+ {
+ sal_Bool bIn = sal_False;
+ for ( sal_uInt16 n=0; n < rList.Count(); n++ )
+ {
+ if ( *(rList.GetObject(n)) == aMethodName )
+ {
+ bIn=sal_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, sal_uInt16 nCount,
+ const ByteString & rSlotId,
+ SvSlotElementList& rSlotList,
+ const ByteString & rPrefix,
+ SvIdlDataBase & rBase, SvStream & rOutStm )
+{
+ if ( !GetExport() && !GetHidden() )
+ return;
+
+// sal_Bool bIsEnumSlot = 0 != rValueName.Len();
+ sal_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( GetImageRotation() )
+ rOutStm << MakeSlotName( SvHash_ImageRotation() ).GetBuffer() << '|';
+ if( GetImageReflection() )
+ rOutStm << MakeSlotName( SvHash_ImageReflection() ).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();
+ sal_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( sal_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 << GetMangleName( sal_False ).GetBuffer();
+ //rOutStm << GetUnoName().GetBuffer();
+ rOutStm << "\"";
+ }
+// else
+// rOutStm << ", 0";
+
+ rOutStm << " )," << endl;
+}
+
+sal_uInt16 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( sal_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 (sal_uInt16)rList.Count();
+ }
+ return 0;
+}
+
+sal_uInt16 SvMetaSlot::WriteSlotMap( const ByteString & rShellName, sal_uInt16 nCount,
+ SvSlotElementList& rSlotList,
+ const ByteString & rPrefix,
+ SvIdlDataBase & rBase,
+ SvStream & rOutStm )
+{
+ // SlotId, wenn nicht angegeben, aus Namen generieren
+ ByteString slotId = GetSlotId();
+
+ sal_uInt16 nSCount = 0;
+ if( IsMethod() )
+ {
+ SvMetaType * pType;
+ SvMetaAttribute * pMethod = GetMethod();
+ if( pMethod )
+ pType = pMethod->GetType();
+ else
+ pType = GetType();
+
+ nSCount = (sal_uInt16)pType->GetAttrCount();
+ }
+
+ WriteSlot( rShellName, nCount, slotId, rSlotList, rPrefix, rBase, rOutStm );
+ return nSCount;
+}
+
+/*************************************************************************
+|* SvMetaSlot::WriteSrc()
+*************************************************************************/
+void SvMetaSlot::WriteSrc( SvIdlDataBase & rBase, SvStream & rOutStm,
+ Table * pTable )
+{
+ if (!GetToolBoxConfig() && !GetAccelConfig() && !GetMenuConfig() && !GetStatusBarConfig() )
+ return;
+
+ sal_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( sal_uLong n = 0; n < pEnum->Count(); n++ )
+ {
+ ByteString aValName = pEnum->GetObject( n )->GetName();
+ ByteString aSId( GetSlotId() );
+ if( GetPseudoPrefix().Len() )
+ aSId = GetPseudoPrefix();
+ aSId += '_';
+ aSId += aValName.Copy( pEnum->GetPrefix().Len() );
+
+ sal_uLong nSId2;
+ sal_Bool bIdOk = sal_False;
+ if( rBase.FindId( aSId, &nSId2 ) )
+ {
+ aSId = ByteString::CreateFromInt32( nSId2 );
+ bIdOk = sal_True;
+ }
+
+ // wenn Id nicht gefunden, immer schreiben
+ if( !bIdOk || !pTable->IsKeyValid( nSId2 ) )
+ {
+ pTable->Insert( nSId2, 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 )
+{
+ sal_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( sal_uLong n = 0; n < pEnum->Count(); n++ )
+ {
+ ByteString aValName = pEnum->GetObject( n )->GetName();
+ ByteString aSId( GetSlotId() );
+ if( GetPseudoPrefix().Len() )
+ aSId = GetPseudoPrefix();
+ aSId += '_';
+ aSId += aValName.Copy( pEnum->GetPrefix().Len() );
+
+ sal_uLong nSId2;
+ sal_Bool bIdOk = sal_False;
+ if( rBase.FindId( aSId, &nSId2 ) )
+ {
+ aSId = ByteString::CreateFromInt32( nSId2 );
+ bIdOk = sal_True;
+ }
+
+ // wenn Id nicht gefunden, immer schreiben
+ if( !bIdOk || !pTable->IsKeyValid( nSId2 ) )
+ {
+ pTable->Insert( nSId2, this );
+
+ rOutStm << "#define " << aSId.GetBuffer() << '\t'
+ << ByteString::CreateFromInt32( nSId2 ).GetBuffer() << endl;
+ }
+ }
+ }
+}
+
+void WriteBool( sal_Bool bSet, SvStream& rStream )
+{
+ if ( bSet )
+ rStream << "sal_True" << ',';
+ else
+ rStream << "sal_False" << ',';
+}
+
+void SvMetaSlot::WriteCSV( SvIdlDataBase& rBase, SvStream& rStrm )
+{
+ rStrm << "PROJECT,";
+ rStrm << GetSlotId().GetBuffer() << ',';
+ rStrm << ByteString::CreateFromInt32( GetSlotId().GetValue() ).GetBuffer() << ',';
+
+ if ( GetPseudoPrefix().Len() )
+ rStrm << GetPseudoPrefix().GetBuffer() << ',';
+ else
+ rStrm << ',';
+
+ rStrm << GetGroupId().GetBuffer() << ',';
+
+ WriteBool( GetAccelConfig(), rStrm );
+ WriteBool( GetMenuConfig(), rStrm );
+ WriteBool( GetStatusBarConfig(), rStrm );
+ WriteBool( GetToolBoxConfig(), rStrm );
+
+ if ( GetSlotType() )
+ rStrm << GetSlotType()->GetName().GetBuffer() << ',';
+ else
+ rStrm << ',';
+
+ WriteBool( GetAutoUpdate(), rStrm );
+ if ( GetCachable() )
+ rStrm << "Cachable" << ',';
+ else
+ rStrm << "Volatile" << ',';
+
+ WriteBool( GetContainer(), rStrm );
+ WriteBool( GetFastCall(), rStrm );
+ WriteBool( GetHasCoreId(), rStrm );
+ WriteBool( GetHasDialog(), rStrm );
+ WriteBool( GetReadOnlyDoc(), rStrm );
+ WriteBool( GetImageRotation(), rStrm );
+ WriteBool( GetImageReflection(), rStrm );
+ rStrm << GetDisableFlags().GetBuffer() << ',';
+
+ if( GetSynchron() )
+ rStrm << "Synchron" << ',';
+ else
+ rStrm << "Asynchron" << ',';
+
+ WriteBool( GetToggle(), rStrm );
+ WriteBool( GetReadonly(), rStrm );
+ WriteBool( GetExport(), rStrm );
+ if( GetRecordPerItem() )
+ rStrm << "RecordPerItem" << ',';
+ else if ( GetNoRecord() )
+ rStrm << "NoRecord" << ',';
+ else if ( GetRecordManual() )
+ rStrm << "RecordManual" << ',';
+ else
+ rStrm << "RecordPerSet" << ',';
+
+ WriteBool( GetRecordAbsolute(), rStrm );
+
+ if ( GetType()->GetType() != TYPE_METHOD && GetMethod() )
+ {
+ rStrm << GetMethod()->GetType()->GetReturnType()->GetName().GetBuffer() << ',';
+ rStrm << GetMethod()->GetName().GetBuffer() << ',';
+ }
+ else
+ {
+ rStrm << ",,";
+ }
+
+ rStrm << GetType()->GetSvName().GetBuffer() << ',';
+ rStrm << GetName().GetBuffer() << ',';
+
+ 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 100755
index 000000000000..48b08da96962
--- /dev/null
+++ b/idl/source/objects/types.cxx
@@ -0,0 +1,2699 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_idl.hxx"
+
+#include <ctype.h>
+#include <stdio.h>
+
+#include <tools/debug.hxx>
+
+#include <attrib.hxx>
+#include <types.hxx>
+#include <globals.hxx>
+#include <database.hxx>
+
+/****************** SvMetaAttribute *************************************/
+/************************************************************************/
+SV_IMPL_META_FACTORY1( SvMetaAttribute, SvMetaReference );
+/*************************************************************************
+|* SvMetaAttribute::SvMetaAttribute()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaAttribute::SvMetaAttribute()
+ : aAutomation( sal_True, sal_False )
+ , aExport( sal_True, sal_False )
+ , aIsCollection ( sal_False, sal_False )
+ , aReadOnlyDoc ( sal_True, sal_False )
+ , aHidden( sal_False, sal_False )
+ , bNewAttr( sal_False )
+{
+}
+
+SvMetaAttribute::SvMetaAttribute( SvMetaType * pType )
+ : aType( pType )
+ , aAutomation( sal_True, sal_False )
+ , aExport( sal_True, sal_False )
+ , aIsCollection ( sal_False, sal_False)
+ , aReadOnlyDoc ( sal_True, sal_False)
+ , aHidden( sal_False, sal_False )
+ , bNewAttr( sal_False )
+{
+}
+
+/*************************************************************************
+|* SvMetaAttribute::Load()
+|* SvMetaAttribute::Save()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaAttribute::Load( SvPersistStream & rStm )
+{
+ SvMetaReference::Load( rStm );
+
+ sal_uInt8 nMask;
+ rStm >> nMask;
+ 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
+ sal_uInt8 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
+*************************************************************************/
+sal_Bool SvMetaAttribute::GetReadonly() const
+{
+ if( aReadonly.IsSet() || !GetRef() ) return aReadonly;
+ return ((SvMetaAttribute *)GetRef())->GetReadonly();
+}
+
+/*************************************************************************
+|* SvMetaAttribute::GetExport()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvMetaAttribute::GetExport() const
+{
+ if( aExport.IsSet() || !GetRef() ) return aExport;
+ return ((SvMetaAttribute *)GetRef())->GetExport();
+}
+
+/*************************************************************************
+|* SvMetaAttribute::GetHidden()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_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
+*************************************************************************/
+sal_Bool SvMetaAttribute::GetAutomation() const
+{
+ if( aAutomation.IsSet() || !GetRef() ) return aAutomation;
+ return ((SvMetaAttribute *)GetRef())->GetAutomation();
+}
+
+sal_Bool SvMetaAttribute::GetIsCollection() const
+{
+ sal_Bool bRet;
+ if( aIsCollection.IsSet() || !GetRef() )
+ {
+ if ( aIsCollection.IsSet() )
+ {
+ bRet = aIsCollection;
+ return bRet;
+ }
+
+ return aIsCollection;
+ }
+
+ return ((SvMetaSlot *)GetRef())->GetIsCollection();
+}
+
+sal_Bool SvMetaAttribute::GetReadOnlyDoc() const
+{
+ if( aReadOnlyDoc.IsSet() || !GetRef() ) return aReadOnlyDoc;
+ return ((SvMetaSlot *)GetRef())->GetReadOnlyDoc();
+}
+
+/*************************************************************************
+|* SvMetaAttribute::IsMethod()
+|* SvMetaAttribute::IsVariable()
+|* SvMetaAttribute::GetMangleName()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvMetaAttribute::IsMethod() const
+{
+ SvMetaType * pType = GetType();
+ DBG_ASSERT( pType, "no type for attribute" );
+ return pType->GetType() == TYPE_METHOD;
+}
+
+sal_Bool SvMetaAttribute::IsVariable() const
+{
+ SvMetaType * pType = GetType();
+ return pType->GetType() != TYPE_METHOD;
+}
+
+ByteString SvMetaAttribute::GetMangleName( sal_Bool ) const
+{
+ return GetName();
+}
+
+/*************************************************************************
+|* SvMetaAttribute::FillSbxObject()
+|*
+|* Beschreibung
+*************************************************************************/
+/*
+void SvMetaAttribute::FillSbxObject( SbxInfo * pInfo, sal_uInt16 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();
+ sal_uLong nCount = rList.Count();
+ for( sal_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, sal_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();
+ sal_uLong nCount = rList.Count();
+ for( sal_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, sal_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, sal_False ) );
+ pType->FillSbxObject( xMeth, bVariable );
+
+ pObj->Insert( &xMeth );
+ }
+}
+*/
+#ifdef IDL_COMPILER
+/*************************************************************************
+|* SvMetaAttribute::Test()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvMetaAttribute::Test( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ sal_Bool bOk = sal_True;
+ if( GetType()->IsItem() && !GetSlotId().IsSet() )
+ {
+ rBase.SetError( "slot without id declared", rInStm.GetToken() );
+ rBase.WriteError( rInStm );
+ bOk = sal_False;
+ }
+ /*
+ if( !GetType()->IsItem() && GetSlotId().IsSet() )
+ {
+ rBase.SetError( "slot without item declared", rInStm.GetToken() );
+ rBase.WriteError( rInStm );
+ bOk = sal_False;
+ }
+ */
+ return bOk;
+}
+
+/*************************************************************************
+|* SvMetaAttribute::ReadSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvMetaAttribute::ReadSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ sal_uInt32 nTokPos = rInStm.Tell();
+ if( !GetType() )
+ // Es wurde kein Typ im ctor mitgegeben
+ aType = rBase.ReadKnownType( rInStm );
+ sal_Bool bOk = sal_False;
+ if( GetType() )
+ {
+ ReadNameSvIdl( rBase, rInStm );
+ aSlotId.ReadSvIdl( rBase, rInStm );
+
+ bOk = sal_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,
+ sal_uInt16 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 );
+ sal_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,
+ sal_uInt16 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,
+ sal_uInt16 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();
+ sal_uLong nCount = rList.Count();
+ for( sal_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
+*************************************************************************/
+sal_uLong SvMetaAttribute::MakeSlotValue( SvIdlDataBase & rBase, sal_Bool bVar ) const
+{
+ const SvNumberIdentifier & rId = GetSlotId();
+ sal_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,
+ sal_uInt16 nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ if( nT == WRITE_ODL )
+ {
+ const SvNumberIdentifier & rId = GetSlotId();
+ sal_Bool bReadonly = GetReadonly() || ( nA & WA_READONLY );
+ if( (rId.IsSet() && !(nA & WA_STRUCT)) || bReadonly )
+ {
+ sal_Bool bVar = IsVariable();
+ if( nA & WA_VARIABLE )
+ bVar = sal_True;
+ else if( nA & WA_METHOD )
+ bVar = sal_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,
+ sal_Bool bSet )
+{
+ rOutStm << endl;
+ SvMetaType * pType = GetType();
+ SvMetaType * pBaseType = pType->GetBaseType();
+
+ // Bei Set ist der Return immer void
+ sal_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, sal_uInt16 nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ const SvMetaAttributeMemberList & rList = GetType()->GetBaseType()->GetAttrList();
+ sal_uLong nCount = rList.Count();
+
+ SvNumberIdentifier slotId = 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( sal_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 = slotId;
+}
+
+/*************************************************************************
+|* SvMetaAttribute::Write()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaAttribute::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
+ sal_uInt16 nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ // keine Attribut fuer Automation
+ if( nT == WRITE_DOCU )
+ {
+ if ( GetHidden() )
+ return;
+ }
+ else if ( !GetAutomation() || !GetExport() )
+ return;
+
+ sal_Bool bVariable;
+ if( nA & WA_VARIABLE )
+ bVariable = sal_True;
+ else if( nA & WA_METHOD )
+ bVariable = sal_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 name; // (rBase.GetActModulePrefix());
+ name += rBase.aIFaceName;
+ name += GetName();
+ const char * pName = name.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, sal_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 *, sal_uInt16 n );
+ ByteString name = GetName();
+
+ sal_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" << name.GetBuffer() << "( " << C_PREF
+ << "Object h" << rBase.aIFaceName.GetBuffer() << ", " << endl;
+ WriteTab( rOutStm, nTab+1 );
+ pBaseType->WriteTypePrefix( rBase, rOutStm, nTab, nT );
+ rOutStm << ' ' << name.GetBuffer() << " )";
+ if( nT == WRITE_C_HEADER )
+ rOutStm << ';' << endl << endl;
+ else
+ WriteCSource( rBase, rOutStm, sal_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" << name.GetBuffer() << "( " << C_PREF
+ << "Object h" << rBase.aIFaceName.GetBuffer() << " )";
+ if( nT == WRITE_C_HEADER )
+ rOutStm << ';' << endl << endl;
+ else
+ WriteCSource( rBase, rOutStm, sal_False );
+ }
+ }
+ }
+ else if ( nT == WRITE_DOCU )
+ {
+ if( !bVariable && IsMethod() )
+ {
+ rOutStm << "<METHOD>" << endl
+ << GetSlotId().GetBuffer() << endl
+ << GetName().GetBuffer() << endl
+ << endl; // readonly
+
+ // Returntype
+ SvMetaType* pType2 = GetType();
+ SvMetaType* pBaseType2 = pType2->GetBaseType();
+ rOutStm << pBaseType2->GetReturnType()->GetBaseType()->GetBasicName().GetBuffer() << endl;
+
+ DBG_ASSERT( pBaseType2->GetReturnType()->GetBaseType()->GetBasicName().Len(),
+ "Leerer BasicName" );
+
+ // Syntax
+ rOutStm << GetName().GetBuffer();
+ pType2->WriteMethodArgs( rBase, rOutStm, nTab, nT );
+
+ // C-Returntype
+ pBaseType2->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( 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( rOutStm );
+ rOutStm << "</PROPERTY>" << endl << endl;
+ }
+ }
+ }
+}
+
+/*************************************************************************
+|* SvMetaAttribute::MakeSfx()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_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 &, SvStream &, Table * )
+{
+}
+
+void SvMetaAttribute::WriteHelpId( SvIdlDataBase &, SvStream &, Table * )
+{
+}
+
+#endif // IDL_COMPILER
+
+/****************** SvMetaType *************************************/
+/************************************************************************/
+SV_IMPL_META_FACTORY1( SvMetaType, SvMetaExtern );
+/*************************************************************************
+|* SvMetaType::SvMetaType()
+|*
+|* Beschreibung
+*************************************************************************/
+#define CTOR \
+ : aCall0( CALL_VALUE, sal_False ) \
+ , aCall1( CALL_VALUE, sal_False ) \
+ , aSbxDataType( 0, sal_False ) \
+ , pAttrList( NULL ) \
+ , nType( TYPE_BASE ) \
+ , bIsItem( sal_False ) \
+ , bIsShell( sal_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 );
+
+ sal_uInt16 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 = sal_True;
+ if( nMask & 0x0400 ) bIsShell = sal_True;
+ if( nMask & 0x0800 )
+ {
+ sal_uInt16 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
+ sal_uInt16 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 << (sal_uInt16)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
+*************************************************************************/
+sal_Bool SvMetaType::GetIn() const
+{
+ if( aIn.IsSet() || !GetRef() )
+ return aIn;
+ else
+ return ((SvMetaType *)GetRef())->GetIn();
+}
+
+/*************************************************************************
+|* SvMetaType::GetOut()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_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
+*************************************************************************/
+sal_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, sal_Bool bVariable )
+{
+ if( PTR_CAST( SbxMethod, pObj ) )
+ {
+ if( GetType() == TYPE_METHOD )
+ {
+ sal_uLong nCount = GetAttrCount();
+ if( nCount )
+ {
+ SbxInfoRef xInfo = pObj->GetInfo();
+ if( !xInfo.Is() )
+ {
+ xInfo = new SbxInfo();
+ pObj->SetInfo( xInfo );
+ }
+ for( sal_uLong n = nCount; n > 0; n-- )
+ pAttrList->GetObject( n -1 )->FillSbxObject( xInfo );
+ }
+ }
+ }
+}
+*/
+#ifdef IDL_COMPILER
+/*************************************************************************
+|* SvMetaType::GetString()
+|*
+|* Beschreibung
+*************************************************************************/
+ByteString SvMetaType::GetCString() const
+{
+ ByteString out( GetSvName() );
+ if( aCall0 == (int)CALL_POINTER )
+ out += " *";
+ else if( aCall0 == (int)CALL_REFERENCE )
+ out += " &";
+ if( aCall1 == (int)CALL_POINTER )
+ out += '*';
+ else if( aCall1 == (int)CALL_REFERENCE )
+ out += '&';
+ return out;
+}
+
+/*************************************************************************
+|* SvMetaType::ReadHeaderSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvMetaType::ReadHeaderSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ sal_Bool bOk = sal_False;
+ sal_uInt32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+
+ if( pTok->Is( SvHash_interface() )
+ || pTok->Is( SvHash_shell() ) )
+ {
+ if( pTok->Is( SvHash_shell() ) )
+ bIsShell = sal_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 sal_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 = sal_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 = sal_True;
+ }
+ }
+ else
+ {
+ bOk = sal_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
+*************************************************************************/
+sal_Bool SvMetaType::ReadSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ if( ReadHeaderSvIdl( rBase, rInStm ) )
+ {
+ rBase.Write( '.' );
+ return SvMetaExtern::ReadSvIdl( rBase, rInStm );
+ }
+ return sal_False;
+}
+
+/*************************************************************************
+|* SvMetaType::WriteSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::WriteSvIdl
+(
+ SvIdlDataBase & rBase,
+ SvStream & rOutStm,
+ sal_uInt16 nTab
+)
+{
+ WriteHeaderSvIdl( rBase, rOutStm, nTab );
+ if( GetType() == TYPE_METHOD )
+ WriteMethodArgs( rBase, rOutStm, nTab, WRITE_IDL );
+
+ sal_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,
+ sal_uInt16 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,
+ sal_uInt16 nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ if( nT == WRITE_C_HEADER && nType != TYPE_ENUM )
+ // nur enum schreiben
+ return;
+
+ ByteString name = 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 = name;
+ 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 << ' ' << name.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 << name.GetBuffer();
+ }
+ rOutStm << ';' << endl;
+
+ if ( nT == WRITE_C_HEADER )
+ rOutStm << "#endif";
+ rOutStm << endl;
+ }
+ break;
+ case TYPE_POINTER:
+ case TYPE_BASE:
+ {
+ }
+ break;
+ case TYPE_METHOD:
+ {
+ }
+ break;
+ }
+ }
+}
+
+/*************************************************************************
+|* SvMetaType::ReadNamesSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvMetaType::ReadNamesSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ sal_Bool bOk = ReadNameSvIdl( rBase, rInStm );
+/*
+ if( bOk )
+ {
+ sal_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,
+ sal_uInt16 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,
+ sal_uInt16 nTab )
+{
+ SvMetaExtern::WriteAttributesSvIdl( rBase, rOutStm, nTab );
+ ByteString name = GetName();
+ if( aSvName != name || aSbxName != name || aOdlName != name )
+ {
+ WriteTab( rOutStm, nTab );
+ rOutStm << "class SvMetaType" << endl;
+ if( aSvName != name )
+ {
+ WriteTab( rOutStm, nTab );
+ aSvName.WriteSvIdl( SvHash_SvName(), rOutStm, nTab );
+ rOutStm << endl;
+ }
+ if( aSbxName != name )
+ {
+ WriteTab( rOutStm, nTab );
+ aSbxName.WriteSvIdl( SvHash_SbxName(), rOutStm, nTab );
+ rOutStm << endl;
+ }
+ if( aOdlName != name )
+ {
+ 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,
+ sal_uInt16 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,
+ sal_uInt16 nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ SvMetaExtern::WriteAttributes( rBase, rOutStm, nTab, nT, nA );
+}
+
+/*************************************************************************
+|* SvMetaType::MakeSfx()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_uLong SvMetaType::MakeSfx( ByteString * pAttrArray )
+{
+ sal_uLong nC = 0;
+
+ if( GetBaseType()->GetType() == TYPE_STRUCT )
+ {
+ sal_uLong nAttrCount = GetAttrCount();
+ // Die einzelnen Attribute schreiben
+ for( sal_uLong n = 0; n < nAttrCount; n++ )
+ {
+ nC += pAttrList->GetObject( n )->MakeSfx( pAttrArray );
+ if( n +1 < nAttrCount )
+ *pAttrArray += ", ";
+ }
+ }
+ return nC;
+}
+
+void SvMetaType::WriteSfxItem(
+ const ByteString & rItemName, SvIdlDataBase &, SvStream & rOutStm )
+{
+ WriteStars( rOutStm );
+ ByteString aVarName = " a";
+ aVarName += rItemName;
+ aVarName += "_Impl";
+
+ ByteString aTypeName = "SfxType";
+ ByteString aAttrArray;
+ sal_uLong nAttrCount = MakeSfx( &aAttrArray );
+ //sal_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()->WriteSfxItem( GetName(), rBase, rOutStm );
+ else
+ WriteSfxItem( GetName(), rBase, rOutStm );
+ }
+}
+
+/*************************************************************************
+|* SvMetaType::ReadMethodArgs()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvMetaType::ReadMethodArgs( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ sal_uInt32 nTokPos = rInStm.Tell();
+ if( rInStm.Read( '(' ) )
+ {
+ //DoReadContextSvIdl( rBase, rInStm, ',' );
+ DoReadContextSvIdl( rBase, rInStm );
+ if( rInStm.Read( ')' ) )
+ {
+ SetType( TYPE_METHOD );
+ return sal_True;
+ }
+ }
+ rInStm.Seek( nTokPos );
+ return sal_False;
+}
+
+/*************************************************************************
+|* SvMetaType::WriteMethodArgs()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::WriteMethodArgs
+(
+ SvIdlDataBase & rBase,
+ SvStream & rOutStm,
+ sal_uInt16 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( sal_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,
+ sal_uInt16 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:
+ {
+ sal_Bool bIn = GetIn();
+ sal_Bool bOut = GetOut();
+ if( bIn || bOut )
+ {
+ if( bIn && bOut )
+ rOutStm << "[in,out] ";
+ else if( bIn )
+ rOutStm << "[in] ";
+ else if( bOut )
+ rOutStm << "[out] ";
+ }
+
+ ByteString out;
+ if( GetType() == TYPE_METHOD )
+ out = GetReturnType()->GetBaseType()->GetOdlName();
+ else
+ {
+ SvMetaType * pBType = GetBaseType();
+ out = pBType->GetOdlName();
+ }
+ if( aCall0 == (int)CALL_POINTER
+ || aCall0 == (int)CALL_REFERENCE )
+ rOutStm << " *";
+ if( aCall1 == (int)CALL_POINTER
+ || aCall1 == (int)CALL_REFERENCE )
+ rOutStm << " *";
+ rOutStm << out.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( sal_False, "WriteType not implemented" );
+ }
+ }
+}
+
+/*************************************************************************
+|* SvMetaType::WriteTheType()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaType::WriteTheType( SvIdlDataBase & rBase, SvStream & rOutStm,
+ sal_uInt16 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 type = GetType();
+ ByteString aPStr;
+
+ if( TYPE_METHOD == type || TYPE_STRUCT == type )
+ {
+ sal_uLong nAttrCount = GetAttrCount();
+ // Die einzelnen Attribute schreiben
+ for( sal_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 type = GetType();
+ ByteString aPStr;
+
+ if( TYPE_METHOD == type || TYPE_STRUCT == type )
+ {
+ sal_uLong nAttrCount = GetAttrCount();
+ // Die einzelnen Attribute schreiben
+ for( sal_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 );
+/*************************************************************************
+|*
+|* 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 );
+/*************************************************************************
+|*
+|* SvMetaEnumValue::SvMetaEnumValue()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+SvMetaEnumValue::SvMetaEnumValue()
+{
+}
+
+void SvMetaEnumValue::Load( SvPersistStream & rStm )
+{
+ SvMetaName::Load( rStm );
+
+ sal_uInt8 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
+ sal_uInt8 nMask = 0;
+ if( aEnumValue.Len() ) nMask |= 0x01;
+
+ // Daten schreiben
+ rStm << nMask;
+ if( nMask & 0x01 ) rStm.WriteByteString( aEnumValue );
+}
+
+#ifdef IDL_COMPILER
+/*************************************************************************
+|*
+|* SvMetaEnumValue::ReadSvIdl()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+sal_Bool SvMetaEnumValue::ReadSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ if( !ReadNameSvIdl( rBase, rInStm ) )
+ return sal_False;
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* SvMetaEnumValue::WriteSvIdl()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void SvMetaEnumValue::WriteSvIdl( SvIdlDataBase &, SvStream & rOutStm, sal_uInt16 )
+{
+ rOutStm << GetName().GetBuffer();
+}
+
+/*************************************************************************
+|*
+|* SvMetaEnumValue::Write()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void SvMetaEnumValue::Write( SvIdlDataBase &, SvStream & rOutStm, sal_uInt16,
+ WriteType nT, WriteAttribute )
+{
+ 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 );
+/*************************************************************************
+|*
+|* SvMetaTypeEnum::SvMetaTypeEnum()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+SvMetaTypeEnum::SvMetaTypeEnum()
+{
+ SetBasicName( "Integer" );
+}
+
+void SvMetaTypeEnum::Load( SvPersistStream & rStm )
+{
+ SvMetaType::Load( rStm );
+
+ sal_uInt8 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
+ sal_uInt8 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
+|*
+*************************************************************************/
+/*
+sal_uInt16 SvMetaTypeEnum::GetMaxValue() const
+{
+ sal_uInt16 nMax = 0;
+ for( sal_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 )
+{
+ sal_uInt32 nTokPos = rInStm.Tell();
+
+ SvMetaEnumValueRef aEnumVal = new SvMetaEnumValue();
+ sal_Bool bOk = aEnumVal->ReadSvIdl( rBase, rInStm );
+ if( bOk )
+ {
+ if( 0 == aEnumValueList.Count() )
+ // der Erste
+ aPrefix = aEnumVal->GetName();
+ else
+ {
+ sal_uInt16 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,
+ sal_uInt16 nTab )
+{
+ WriteTab( rOutStm, nTab +1 );
+ for( sal_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
+|*
+*************************************************************************/
+sal_Bool SvMetaTypeEnum::ReadSvIdl( SvIdlDataBase & rBase,
+ SvTokenStream & rInStm )
+{
+ sal_uInt32 nTokPos = rInStm.Tell();
+ if( SvMetaType::ReadHeaderSvIdl( rBase, rInStm )
+ && GetType() == TYPE_ENUM )
+ {
+ if( SvMetaName::ReadSvIdl( rBase, rInStm ) )
+ return sal_True;
+ }
+ rInStm.Seek( nTokPos );
+ return sal_False;
+}
+
+/*************************************************************************
+|*
+|* SvMetaTypeEnum::WriteSvIdl()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void SvMetaTypeEnum::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
+ sal_uInt16 nTab )
+{
+ WriteHeaderSvIdl( rBase, rOutStm, nTab );
+ rOutStm << endl;
+ SvMetaName::WriteSvIdl( rBase, rOutStm, nTab );
+ rOutStm << endl;
+}
+
+/*************************************************************************
+|*
+|* SvMetaTypeEnum::Write()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void SvMetaTypeEnum::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
+ sal_uInt16 nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ SvMetaType::Write( rBase, rOutStm, nTab, nT, nA );
+}
+
+/*************************************************************************
+|* SvMetaTypeEnum::WriteContext()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvMetaTypeEnum::WriteContext( SvIdlDataBase & rBase, SvStream & rOutStm,
+ sal_uInt16 nTab,
+ WriteType nT, WriteAttribute nA )
+{
+ WriteTab( rOutStm, nTab +1 );
+ for( sal_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 );
+/*************************************************************************
+|*
+|* 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() )
+ {
+ sal_uLong nCount = aType->GetAttrCount();
+ SvMetaAttributeMemberList& rList = aType->GetAttrList();
+ SvMetaAttributeMemberList& rOtherList = pAttr->GetType()->GetAttrList();
+ if ( pAttr->GetType()->GetAttrCount() != nCount )
+ {
+ aStr += " AttributeCount\n";
+ }
+ else
+ {
+ for ( sal_uInt16 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&, SvStream& rStrm )
+{
+ rStrm << GetType()->GetSvName().GetBuffer() << ' ';
+ rStrm << GetName().GetBuffer() << ' ';
+ rStrm << GetSlotId().GetBuffer();
+}
+
+
diff --git a/idl/source/prj/command.cxx b/idl/source/prj/command.cxx
new file mode 100755
index 000000000000..616ed98d182a
--- /dev/null
+++ b/idl/source/prj/command.cxx
@@ -0,0 +1,437 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_idl.hxx"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+#include <command.hxx>
+#include <globals.hxx>
+#include <database.hxx>
+#include <tools/fsys.hxx>
+
+/*************************************************************************
+|*
+|* Syntaxbeschreibung
+|*
+*************************************************************************/
+char const * SyntaxStrings[] = {
+"basic-type:",
+"\tvoid| char| int| float| double|",
+"\tUINT16| INT16| UINT32| INT32| BOOL|",
+"\tBYTE| String| SbxObject",
+"",
+"{ import \"filename\" }\n",
+"module definition:",
+"module",
+"\tunique id range (ask MM)",
+"modul-name",
+"'['",
+"\tSlotIdFile( \"filename\" )",
+"']'",
+"'{'",
+"\t{ include \"filename\" }\n",
+
+"\titem definition:",
+"\titem type item-name;\n",
+
+"\ttype definition:",
+"\tstruct | union identifier",
+"\t'{'",
+"\t\t{ type idetifier }",
+"\t'}'",
+"\t|",
+"\tenum identifier",
+"\t'{'",
+"\t\t{ identifier, }",
+"\t'}'",
+"\t|",
+"\ttypedef type identifier\n",
+
+"\titem-method:",
+"\titem identifier item-method-args\n",
+
+"\titem-method-args:",
+"\t( { item parameter-name SLOT_ID } )\n",
+
+"\tslot definition:",
+"\titem identifier SLOT_ID [ item-method-args ]",
+"\t'['\n",
+
+"\t\titem-method-args",
+"\t\tAccelConfig, MenuConfig, StatusBarConfig, ToolbarConfig",
+"\t\tAutomation*",
+"\t\tAutoUpdate",
+// "\t\tCachable*, Volatile",
+"\t\tContainer",
+"\t\tDefault = Identifier",
+"\t\tExecMethod = Identifier",
+"\t\tExport*",
+"\t\tFastCall",
+"\t\tGet, Set",
+"\t\tGroupId = Identifier",
+"\t\tHasCoreId",
+"\t\tHasDialog",
+"\t\tIsCollection",
+"\t\tImageRotation",
+"\t\tImageReflection",
+"\t\tPseudoPrefix = Identifier",
+"\t\tPseudoSlots",
+"\t\tReadOnly",
+"\t\tReadOnlyDoc*",
+"\t\tRecordPerSet*, RecordPerItem, RecordManual, NoRecord",
+"\t\tRecordAbsolute",
+"\t\tStateMethod = Identifier",
+"\t\tSynchron*, Asynchron",
+"\t\tToggle",
+"\t']'\n",
+
+"\tinterface definition:",
+"\tshell | interface identifier ':' interface",
+"\t'{'",
+"\t\t{ slot }",
+"\t'}'\n",
+"---syntax example is sfx.idl---\n",
+NULL };
+
+char CommandLineSyntax[] =
+"-fs<slotmap file> -fl<listing file>\n"
+"-fo<odl file> -fd<data base file>\n"
+"-fi<item implementation> -ft<type library file> (not OLE)\n"
+"-fr<ressource file> -fm<makefile target file>\n"
+"-fC<c++ source file> -fH<c++ header file>\n"
+"-fc<c source file> -fh<c header file>\n"
+"-rsc <*.srs header line>\n"
+"-help, ? @<file> response file\n"
+" <filenames>\n";
+
+/*************************************************************************
+|*
+|* Init()
+|*
+|* Beschreibung
+|* Ersterstellung MM 15.12.94
+|* Letzte Aenderung MM 15.12.94
+|*
+*************************************************************************/
+void Init()
+{
+ if( !IDLAPP->pHashTable )
+ IDLAPP->pHashTable = new SvStringHashTable( 2801 );
+ if( !IDLAPP->pGlobalNames )
+ IDLAPP->pGlobalNames = new SvGlobalHashNames();
+}
+
+/*************************************************************************
+|*
+|* DeInit()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void DeInit()
+{
+ delete IDLAPP;
+}
+
+/*************************************************************************
+|*
+|* DeInit()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+sal_Bool ReadIdl( SvIdlWorkingBase * pDataBase, const SvCommand & rCommand )
+{
+ for( sal_uInt16 n = 0; n < rCommand.aInFileList.Count(); n++ )
+ {
+ String aFileName ( *rCommand.aInFileList.GetObject( n ) );
+ SvFileStream aStm( aFileName, STREAM_STD_READ | STREAM_NOCREATE );
+ if( aStm.GetError() == SVSTREAM_OK )
+ {
+ if( pDataBase->IsBinaryFormat( aStm ) )
+ {
+ pDataBase->Load( aStm );
+ if( aStm.GetError() != SVSTREAM_OK )
+ {
+ ByteString aStr;
+ if( aStm.GetError() == SVSTREAM_FILEFORMAT_ERROR )
+ aStr = "error: incompatible format, file ";
+ else if( aStm.GetError() == SVSTREAM_WRONGVERSION )
+ aStr = "error: wrong version, file ";
+ else
+ aStr = "error during load, file ";
+ aStr += ByteString( aFileName, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ return sal_False;
+ }
+ }
+ else
+ {
+ SvTokenStream aTokStm( aStm, aFileName );
+ if( !pDataBase->ReadSvIdl( aTokStm, sal_False, rCommand.aPath ) )
+ return sal_False;
+ }
+ }
+ else
+ {
+ const ByteString aStr( aFileName, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "unable to read input file: %s\n", aStr.GetBuffer() );
+ return sal_False;
+ }
+ }
+ return sal_True;
+}
+
+/*************************************************************************
+|*
+|* SvCommand::SvCommand()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+static sal_Bool ResponseFile( StringList * pList, int argc, char ** argv )
+{
+ // Programmname
+ pList->Insert( new String( String::CreateFromAscii(*argv) ), LIST_APPEND );
+ for( int i = 1; i < argc; i++ )
+ {
+ if( '@' == **(argv +i) )
+ { // wenn @, dann Response-Datei
+ SvFileStream aStm( String::CreateFromAscii((*(argv +i)) +1), STREAM_STD_READ | STREAM_NOCREATE );
+ if( aStm.GetError() != SVSTREAM_OK )
+ return sal_False;
+
+ ByteString aStr;
+ while( aStm.ReadLine( aStr ) )
+ {
+ sal_uInt16 n = 0;
+ sal_uInt16 nPos = 1;
+ while( n != nPos )
+ {
+ while( aStr.GetChar(n) && isspace( aStr.GetChar(n) ) )
+ n++;
+ nPos = n;
+ while( aStr.GetChar(n) && !isspace( aStr.GetChar(n) ) )
+ n++;
+ if( n != nPos )
+ pList->Insert( new String( String::CreateFromAscii( aStr.Copy( nPos, n - nPos ).GetBuffer() ) ), LIST_APPEND );
+ }
+ }
+ }
+ else if( argv[ i ] )
+ pList->Insert( new String( String::CreateFromAscii( argv[ i ] ) ), LIST_APPEND );
+ }
+ return sal_True;
+}
+
+/*************************************************************************
+|* SvCommand::SvCommand()
+|*
+|* Beschreibung
+*************************************************************************/
+SvCommand::SvCommand( int argc, char ** argv )
+ : nVerbosity(1), nFlags( 0 )
+{
+ StringList aList;
+
+ if( ResponseFile( &aList, argc, argv ) )
+ for( sal_uLong i = 1; i < aList.Count(); i++ )
+ {
+ String aParam( *aList.GetObject( i ) );
+ sal_Unicode aFirstChar( aParam.GetChar(0) );
+ if( '-' == aFirstChar )
+ {
+ aParam.Erase( 0, 1 );
+ aFirstChar = aParam.GetChar(0);
+ if( aFirstChar == 'F' || aFirstChar == 'f' )
+ {
+ aParam.Erase( 0, 1 );
+ aFirstChar = aParam.GetChar(0);
+ String aName( aParam.Copy( 1 ) );
+ if( 's' == aFirstChar )
+ { // Name der Slot-Ausgabe
+ aSlotMapFile = aName;
+ }
+ else if( 'l' == aFirstChar )
+ { // Name der Listing
+ aListFile = aName;
+ }
+ else if( 'i' == aFirstChar )
+ { // Name der Item-Datei
+// aSfxItemFile = aName;
+ }
+ else if( 'o' == aFirstChar )
+ { // Name der ODL-Datei
+// aODLFile = aName;
+ }
+ else if( 'd' == aFirstChar )
+ { // Name der Datenbasis-Datei
+ aDataBaseFile = aName;
+ }
+ else if( 'D' == aFirstChar )
+ { // Name der Docu-Datei f"ur das API
+// aDocuFile = aName;
+ }
+ else if( 'C' == aFirstChar )
+ { // Name der cxx-Datei
+// aCxxFile = aName;
+ }
+ else if( 'H' == aFirstChar )
+ { // Name der hxx-Datei
+// aHxxFile = aName;
+ }
+ else if( 'c' == aFirstChar )
+ { // Name der C-Header-Datei
+// aCSourceFile = aName;
+ }
+ else if( 'h' == aFirstChar )
+ { // Name der C-Header-Datei
+// aCHeaderFile = aName;
+ }
+ else if( 't' == aFirstChar )
+ { // Name der Info-Datei
+// aCallingFile = aName;
+ }
+ else if( 'm' == aFirstChar )
+ { // Name der Info-Datei
+ aTargetFile = aName;
+ }
+ else if( 'r' == aFirstChar )
+ { // Name der Resource-Datei
+// aSrcFile = aName;
+ }
+ else if( 'z' == aFirstChar )
+ { // Name der HelpId-Datei
+ aHelpIdFile = aName;
+ }
+ else if( 'y' == aFirstChar )
+ { // Name der CSV-Datei
+ aCSVFile = aName;
+ }
+ else if( 'x' == aFirstChar )
+ { // Name der IDL-Datei fuer die CSV-Datei
+ aExportFile = aName;
+ }
+ else
+ {
+ printf(
+ "unknown switch: %s\n",
+ rtl::OUStringToOString(
+ aParam, RTL_TEXTENCODING_UTF8).getStr());
+ exit( -1 );
+ }
+ }
+ else if( aParam.EqualsIgnoreCaseAscii( "help" ) || aParam.EqualsIgnoreCaseAscii( "?" ) )
+ { // Hilfe
+ printf( "%s", CommandLineSyntax );
+ }
+ else if( aParam.EqualsIgnoreCaseAscii( "quiet" ) )
+ {
+ nVerbosity = 0;
+ }
+ else if( aParam.EqualsIgnoreCaseAscii( "verbose" ) )
+ {
+ nVerbosity = 2;
+ }
+ else if( aParam.EqualsIgnoreCaseAscii( "syntax" ) )
+ { // Hilfe
+ int j = 0;
+ while(SyntaxStrings[j])
+ printf("%s\n",SyntaxStrings[j++]);
+ }
+ else if( aParam.EqualsIgnoreCaseAscii( "i", 0, 1 ) )
+ { // Include-Pfade definieren
+ String aName( aParam.Copy( 1 ) );
+ if( aPath.Len() )
+ aPath += DirEntry::GetSearchDelimiter();
+ aPath += aName;
+ }
+ else if( aParam.EqualsIgnoreCaseAscii( "rsc", 0, 3 ) )
+ { // erste Zeile im *.srs File
+ if( aList.GetObject( i +1 ) )
+ {
+ aSrsLine = ByteString( *aList.GetObject( i +1 ), RTL_TEXTENCODING_UTF8 );
+ i++;
+ }
+ }
+ else
+ {
+ // temporary compatibility hack
+ printf(
+ "unknown switch: %s\n",
+ rtl::OUStringToOString(
+ aParam, RTL_TEXTENCODING_UTF8).getStr());
+ exit( -1 );
+ }
+ }
+ else
+ {
+ aInFileList.Insert( new String( aParam ), LIST_APPEND );
+ }
+ }
+ else
+ {
+ printf( "%s", CommandLineSyntax );
+ }
+
+ String * pStr = aList.First();
+ while( pStr )
+ {
+ delete pStr;
+ pStr = aList.Next();
+ }
+
+ ByteString aInc( getenv( "INCLUDE" ) );
+ // Include Environmentvariable anhaengen
+ if( aInc.Len() )
+ {
+ if( aPath.Len() )
+ aPath += DirEntry::GetSearchDelimiter();
+ aPath += String::CreateFromAscii( aInc.GetBuffer() );
+ }
+}
+
+/*************************************************************************
+|*
+|* SvCommand::~SvCommand()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+SvCommand::~SvCommand()
+{
+ // ByteString Liste freigeben
+ String * pStr;
+ while( NULL != (pStr = aInFileList.Remove()) )
+ delete pStr;
+}
+
diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx
new file mode 100755
index 000000000000..dd199ea4261d
--- /dev/null
+++ b/idl/source/prj/database.cxx
@@ -0,0 +1,1039 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_idl.hxx"
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <tools/fsys.hxx>
+#include <tools/debug.hxx>
+#include <database.hxx>
+#include <globals.hxx>
+
+/****************** SvIdlDataBase ****************************************/
+/*************************************************************************
+|* SvIdlDataBase::SvIdlDataBase()
+|*
+|* Beschreibung
+*************************************************************************/
+/*
+void PrimeNumber(){
+ sal_uInt16 i, n;
+ for( i = 5001; i < 5500; i += 2 ){
+ for( n = 2; n < i && ((i % n) != 0); n++ );
+ if( n == i ){
+ printf( "\nPrimzahl: %d\n", i );
+ return;
+ }
+ }
+}
+*/
+
+SvIdlDataBase::SvIdlDataBase( const SvCommand& rCmd )
+ : bExport( sal_False )
+ , nUniqueId( 0 )
+ , nVerbosity( rCmd.nVerbosity )
+ , bIsModified( sal_False )
+ , aPersStream( *IDLAPP->pClassMgr, NULL )
+ , pIdTable( NULL )
+{
+ //PrimeNumber();
+}
+
+/*************************************************************************
+|* SvIdlDataBase::~SvIdlDataBase()
+|*
+|* Beschreibung
+*************************************************************************/
+SvIdlDataBase::~SvIdlDataBase()
+{
+ String * pStr = aIdFileList.First();
+ while( pStr )
+ {
+ delete pStr;
+ pStr = aIdFileList.Next();
+ }
+ delete pIdTable;
+}
+
+/*************************************************************************
+|* SvIdlDataBase::GetTypeList()
+|*
+|* Beschreibung
+*************************************************************************/
+#define ADD_TYPE( Name, OdlName, ParserChar, CName, BasName, BasPost ) \
+ aTypeList.Append( new SvMetaType( SvHash_##Name()->GetName(), \
+ BasName, OdlName, ParserChar, CName, BasName, BasPost ) );
+
+SvMetaTypeMemberList & SvIdlDataBase::GetTypeList()
+{
+ if( aTypeList.Count() == 0 )
+ { // Initial fuellen
+ aTypeList.Append( new SvMetaTypeString() );
+ aTypeList.Append( new SvMetaTypevoid() );
+
+ // MI: IDispatch::Invoke kann keine unsigned
+ ADD_TYPE( UINT16, "long", 'h', "unsigned short", "Long", "&" );
+ ADD_TYPE( INT16, "short", 'h', "short", "Integer", "%" );
+ ADD_TYPE( UINT32, "long", 'l', "unsigned long", "Long", "&" );
+ ADD_TYPE( INT32, "long", 'l', "long", "Long", "&" );
+ ADD_TYPE( int, "int", 'i', "int", "Integer", "%" );
+ ADD_TYPE( BOOL, "boolean", 'b', "unsigned char", "Boolean", "" );
+ ADD_TYPE( char, "char", 'c', "char", "Integer", "%" );
+ ADD_TYPE( BYTE, "char", 'c', "unsigned char", "Integer", "%" );
+ ADD_TYPE( float, "float", 'f', "float", "Single", "!" );
+ ADD_TYPE( double, "double", 'F', "double", "Double", "#" );
+ ADD_TYPE( SbxObject, "VARIANT", 'o', "C_Object", "Object", "" );
+
+
+ // A c h t u n g !!!, bei hinzufuegen von Typen werden alle
+ // bin�ren Datenbasen inkompatibel
+
+ /*
+ // So tun als ob die Init-Daten auf einem Stream gelesen wurden
+ SvMemoryStream aStm;
+ aPersStream.SetStream( &aStm );
+ // Alle Init-Daten Streamen
+ aPersStream << aTypeList;
+ // Nur die Id-Zuordnung merken
+ aPersStream.SetStream( NULL );
+ */
+ }
+ return aTypeList;
+}
+
+/*************************************************************************
+|*
+|* SvIdlDataBase::GetModuleInfo()
+|*
+|* Beschreibung
+|* Ersterstellung MM 13.12.94
+|* Letzte Aenderung MM 13.12.94
+|*
+*************************************************************************/
+SvMetaModule * SvIdlDataBase::GetModule( const ByteString & rName )
+{
+ for( sal_uLong n = 0; n < aModuleList.Count(); n++ )
+ if( aModuleList.GetObject( n )->GetName() == rName )
+ return aModuleList.GetObject( n );
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* SvIdlDataBase::IsBinaryFormat()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+#define DATABASE_SIGNATURE (sal_uInt32)0x13B799F2
+#define DATABASE_VER 0x0006
+sal_Bool SvIdlDataBase::IsBinaryFormat( SvStream & rStm )
+{
+ sal_uInt32 nSig = 0;
+ sal_uLong nPos = rStm.Tell();
+ rStm >> nSig;
+ rStm.Seek( nPos );
+
+ return nSig == DATABASE_SIGNATURE;
+}
+
+/*************************************************************************
+|*
+|* SvIdlDataBase::Load()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+void SvIdlDataBase::Load( SvStream & rStm )
+{
+ DBG_ASSERT( aTypeList.Count() == 0, "type list already initialized" );
+ SvPersistStream aPStm( *IDLAPP->pClassMgr, &rStm );
+
+ sal_uInt16 nVersion = 0;
+ sal_uInt32 nSig = 0;
+
+ aPStm >> nSig;
+ aPStm >> nVersion;
+ if( nSig != DATABASE_SIGNATURE )
+ {
+ aPStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
+ return;
+ }
+ if( nVersion != DATABASE_VER )
+ {
+ aPStm.SetError( SVSTREAM_WRONGVERSION );
+ return;
+ }
+ aPStm >> aClassList;
+ aPStm >> aTypeList;
+ aPStm >> aAttrList;
+ aPStm >> aModuleList;
+ aPStm >> nUniqueId;
+
+ if( aPStm.IsEof() )
+ aPStm.SetError( SVSTREAM_GENERALERROR );
+}
+
+/*************************************************************************
+|* SvIdlDataBase::Save()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvIdlDataBase::Save( SvStream & rStm, sal_uInt32 nFlags )
+{
+ SvPersistStream aPStm( *IDLAPP->pClassMgr, &rStm );
+ aPStm.SetContextFlags( nFlags );
+
+ aPStm << (sal_uInt32)DATABASE_SIGNATURE;
+ aPStm << (sal_uInt16)DATABASE_VER;
+
+ sal_Bool bOnlyStreamedObjs = sal_False;
+ if( nFlags & IDL_WRITE_CALLING )
+ bOnlyStreamedObjs = sal_True;
+
+ if( bOnlyStreamedObjs )
+ {
+ SvMetaClassMemberList aList;
+ for( sal_uLong n = 0; n < GetModuleList().Count(); n++ )
+ {
+ SvMetaModule * pModule = GetModuleList().GetObject( n );
+ if( !pModule->IsImported() )
+ aList.Append( pModule->GetClassList() );
+ }
+ aPStm << aList;
+ }
+ else
+ aPStm << aClassList;
+
+ //aClassList.WriteObjects( aPStm, bOnlyStreamedObjs );
+ aTypeList.WriteObjects( aPStm, bOnlyStreamedObjs );
+ aAttrList.WriteObjects( aPStm, bOnlyStreamedObjs );
+ aModuleList.WriteObjects( aPStm, bOnlyStreamedObjs );
+ aPStm << nUniqueId;
+}
+
+/*************************************************************************
+|* SvIdlDataBase::SetError()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvIdlDataBase::SetError( const ByteString & rError, SvToken * pTok )
+{
+ if( pTok->GetLine() > 10000 )
+ aError.SetText( "hgchcg" );
+
+ if( aError.nLine < pTok->GetLine()
+ || (aError.nLine == pTok->GetLine() && aError.nColumn < pTok->GetColumn()) )
+ {
+ aError = SvIdlError( pTok->GetLine(), pTok->GetColumn() );
+ aError.SetText( rError );
+ }
+}
+
+/*************************************************************************
+|* SvIdlDataBase::Push()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvIdlDataBase::Push( SvMetaObject * pObj )
+{
+ GetStack().Push( pObj );
+}
+
+#ifdef IDL_COMPILER
+/*************************************************************************
+|*
+|* SvIdlDataBase::FindId()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+sal_Bool SvIdlDataBase::FindId( const ByteString & rIdName, sal_uLong * pVal )
+{
+ if( pIdTable )
+ {
+ sal_uInt32 nHash;
+ if( pIdTable->Test( rIdName, &nHash ) )
+ {
+ *pVal = pIdTable->Get( nHash )->GetValue();
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+
+/*************************************************************************
+|*
+|* SvIdlDataBase::InsertId()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+sal_Bool SvIdlDataBase::InsertId( const ByteString & rIdName, sal_uLong nVal )
+{
+ if( !pIdTable )
+ pIdTable = new SvStringHashTable( 20003 );
+
+ sal_uInt32 nHash;
+ if( pIdTable->Insert( rIdName, &nHash ) )
+ {
+ pIdTable->Get( nHash )->SetValue( nVal );
+ return sal_True;
+ }
+ return sal_False;
+}
+
+/*************************************************************************
+|* SvIdlDataBase::ReadIdFile()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvIdlDataBase::ReadIdFile( const String & rFileName )
+{
+ DirEntry aFullName( rFileName );
+ aFullName.Find( GetPath() );
+
+ String * pIdFile = aIdFileList.First();
+ while( pIdFile )
+ {
+ if( *pIdFile == rFileName )
+ return sal_True; // schon eingelesen
+ pIdFile = aIdFileList.Next();
+ }
+
+ aIdFileList.Insert( new String( rFileName ), LIST_APPEND );
+
+ SvTokenStream aTokStm( aFullName.GetFull() );
+ if( aTokStm.GetStream().GetError() == SVSTREAM_OK )
+ {
+ SvToken * pTok = aTokStm.GetToken_Next();
+
+ while( !pTok->IsEof() )
+ {
+ if( pTok->IsChar() && pTok->GetChar() == '#' )
+ {
+ pTok = aTokStm.GetToken_Next();
+ if( pTok->Is( SvHash_define() ) )
+ {
+ pTok = aTokStm.GetToken_Next();
+ ByteString aDefName;
+ if( pTok->IsIdentifier() )
+ aDefName = pTok->GetString();
+ else
+ {
+ ByteString aStr( "unexpected token after define" );
+ // Fehler setzen
+ SetError( aStr, pTok );
+ WriteError( aTokStm );
+ return sal_False;
+ }
+
+ sal_uLong nVal = 0;
+ sal_Bool bOk = sal_True;
+ while( bOk )
+ {
+ pTok = aTokStm.GetToken_Next();
+ if( pTok->IsIdentifier() )
+ {
+ sal_uLong n;
+ if( FindId( pTok->GetString(), &n ) )
+ nVal += n;
+ else
+ bOk = sal_False;
+ }
+ else if( pTok->IsChar() )
+ {
+ if( pTok->GetChar() == '-'
+ || pTok->GetChar() == '/'
+ || pTok->GetChar() == '*'
+ || pTok->GetChar() == '&'
+ || pTok->GetChar() == '|'
+ || pTok->GetChar() == '^'
+ || pTok->GetChar() == '~' )
+ {
+ ByteString aStr( "unknown operator '" );
+ aStr += pTok->GetChar();
+ aStr += "'in define";
+ // Fehler setzen
+ SetError( aStr, pTok );
+ WriteError( aTokStm );
+ return sal_False;
+ }
+ if( pTok->GetChar() != '+'
+ && pTok->GetChar() != '('
+ && pTok->GetChar() != ')' )
+ // nur + erlaubt, Klammern spielen kein Rolle,
+ // da + komutativ ist
+ break;
+ }
+ else if( pTok->IsInteger() )
+ {
+ nVal += pTok->GetNumber();
+ }
+ else
+ break;
+ }
+ if( bOk )
+ {
+ if( !InsertId( aDefName, nVal ) )
+ {
+ ByteString aStr = "hash table overflow: ";
+ SetError( aStr, pTok );
+ WriteError( aTokStm );
+ return sal_False;
+ }
+ }
+ }
+ else if( pTok->Is( SvHash_include() ) )
+ {
+ pTok = aTokStm.GetToken_Next();
+ ByteString aName;
+ if( pTok->IsString() )
+ aName = pTok->GetString();
+ else if( pTok->IsChar() && pTok->GetChar() == '<' )
+ {
+ pTok = aTokStm.GetToken_Next();
+ while( !pTok->IsEof()
+ && !(pTok->IsChar() && pTok->GetChar() == '>') )
+ {
+ aName += pTok->GetTokenAsString();
+ pTok = aTokStm.GetToken_Next();
+ }
+ if( pTok->IsEof() )
+ {
+ ByteString aStr( "unexpected eof in #include" );
+ // Fehler setzen
+ SetError( aStr, pTok );
+ WriteError( aTokStm );
+ return sal_False;
+ }
+ }
+ if( !ReadIdFile( String::CreateFromAscii(aName.GetBuffer()) ) )
+ {
+ ByteString aStr = "cannot read file: ";
+ aStr += aName;
+ SetError( aStr, pTok );
+ WriteError( aTokStm );
+ return sal_False;
+ }
+ }
+ }
+ else
+ pTok = aTokStm.GetToken_Next();
+ }
+ }
+ else
+ return sal_False;
+ return sal_True;
+}
+
+/*************************************************************************
+|* SvIdlDataBase::FindType()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaType * SvIdlDataBase::FindType( const SvMetaType * pPType,
+ SvMetaTypeMemberList & rList )
+{
+ SvMetaType * pType = rList.First();
+ while( pType && pPType != pType )
+ pType = rList.Next();
+ return pType;
+}
+
+SvMetaType * SvIdlDataBase::FindType( const ByteString & rName )
+{
+ SvMetaType * pType = aTypeList.First();
+ while( pType && rName != pType->GetName() )
+ pType = aTypeList.Next();
+ return pType;
+}
+
+/*************************************************************************
+|* SvIdlDataBase::ReadKnownType()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaType * SvIdlDataBase::ReadKnownType( SvTokenStream & rInStm )
+{
+ sal_Bool bIn = sal_False;
+ sal_Bool bOut = sal_False;
+ int nCall0 = CALL_VALUE;
+ int nCall1 = CALL_VALUE;
+ sal_Bool bSet = sal_False; //irgent ein Attribut gesetzt
+
+ sal_uInt32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+
+ if( pTok->HasHash() )
+ {
+ sal_uInt32 nBeginPos = 0; // kann mit Tell nicht vorkommen
+ while( nBeginPos != rInStm.Tell() )
+ {
+ nBeginPos = rInStm.Tell();
+ if( pTok->Is( SvHash_in() ) )
+ {
+ bIn = sal_True;
+ pTok = rInStm.GetToken_Next();
+ bSet = sal_True;
+ }
+ if( pTok->Is( SvHash_out() ) )
+ {
+ bOut = sal_True;
+ pTok = rInStm.GetToken_Next();
+ bSet = sal_True;
+ }
+ if( pTok->Is( SvHash_inout() ) )
+ {
+ bIn = sal_True;
+ bOut = sal_True;
+ pTok = rInStm.GetToken_Next();
+ bSet = sal_True;
+ }
+ }
+ }
+/*
+ SvMetaTypeList aTmpTypeList;
+ if( FillTypeList( aTmpTypeList, pTok ) )
+*/
+ if( pTok->IsIdentifier() )
+ {
+ ByteString aName = pTok->GetString();
+ SvMetaTypeMemberList & rList = GetTypeList();
+ SvMetaType * pType = rList.First();
+ while( pType )
+ {
+ if( pType->GetName() == aName )
+ break;
+ pType = rList.Next();
+ }
+ if( pType )
+ {
+ pTok = rInStm.GetToken();
+ if( pTok->IsChar() )
+ {
+ if( pTok->GetChar() == '&' || pTok->GetChar() == '*' )
+ {
+ nCall0 = (pTok->GetChar() == '&') ? CALL_REFERENCE :
+ CALL_POINTER;
+ rInStm.GetToken_Next();
+ pTok = rInStm.GetToken();
+ if( pTok->GetChar() == '&' || pTok->GetChar() == '*' )
+ {
+ nCall1 = (pTok->GetChar() == '&') ? CALL_REFERENCE :
+ CALL_POINTER;
+ rInStm.GetToken_Next();
+ }
+ bSet = sal_True;
+ }
+ }
+ /*
+ SvMetaType * pMetaType = aTmpTypeList.First();
+ while( pMetaType )
+ {
+ if( pMetaType->GetIn() == bIn
+ && pMetaType->GetOut() == bOut
+ && pMetaType->GetCall0() == nCall0
+ && pMetaType->GetCall1() == nCall1 )
+ {
+ return pMetaType;
+ }
+ pMetaType = aTmpTypeList.Next();
+ }
+ */
+ //SvMetaType * pType = aTmpTypeList.First();
+ if( !bSet )
+ // Ist genau dieser Typ
+ return pType;
+
+ DBG_ASSERT( aTmpTypeList.First(), "mindestens ein Element" );
+ SvMetaTypeRef xType = new SvMetaType( pType->GetName(), 'h', "dummy" );
+ xType->SetRef( pType );
+ xType->SetIn( bIn );
+ xType->SetOut( bOut );
+ xType->SetCall0( nCall0 );
+ xType->SetCall1( nCall1 );
+
+ aTmpTypeList.Append( xType );
+ return xType;
+ }
+ }
+ rInStm.Seek( nTokPos );
+ return NULL;
+}
+
+/*************************************************************************
+|*
+|* SvIdlDataBase::ReadKnownAttr()
+|*
+|* Beschreibung
+|*
+*************************************************************************/
+SvMetaAttribute * SvIdlDataBase::ReadKnownAttr
+(
+ SvTokenStream & rInStm,
+ SvMetaType * pType /* Wenn der pType == NULL, dann muss der Typ
+ noch gelesen werden. */
+)
+{
+ sal_uInt32 nTokPos = rInStm.Tell();
+
+ if( !pType )
+ pType = ReadKnownType( rInStm );
+
+ if( pType )
+ {
+ // Wenn wir Slots auf die Wiese stellen, d"urfen wir nicht voraussetzen,
+ // da\s jeder Slot einen anderen Namen hat!
+/*
+ SvToken * pTok = rInStm.GetToken_Next();
+ if( pTok->IsIdentifier() )
+ for( sal_uLong n = 0; n < aAttrList.Count(); n++ )
+ {
+ SvMetaAttribute * pAttr = aAttrList.GetObject( n );
+ if( pAttr->GetName() == pTok->GetString() )
+ return pAttr;
+ }
+*/
+ }
+ else
+ {
+ // sonst SlotId?
+ SvToken * pTok = rInStm.GetToken_Next();
+ if( pTok->IsIdentifier() )
+ {
+ sal_uLong n;
+ if( FindId( pTok->GetString(), &n ) )
+ {
+ for( sal_uLong i = 0; i < aAttrList.Count(); i++ )
+ {
+ SvMetaAttribute * pAttr = aAttrList.GetObject( i );
+ if( pAttr->GetSlotId() == pTok->GetString() )
+ return pAttr;
+ }
+ }
+
+ ByteString aStr( "Nicht gefunden : " );
+ aStr += pTok->GetString();
+ DBG_ERROR( aStr.GetBuffer() );
+ }
+ }
+
+ rInStm.Seek( nTokPos );
+ return NULL;
+}
+
+SvMetaAttribute* SvIdlDataBase::SearchKnownAttr
+(
+ const SvNumberIdentifier& rId
+)
+{
+ sal_uLong n;
+ if( FindId( rId, &n ) )
+ {
+ for( sal_uLong i = 0; i < aAttrList.Count(); i++ )
+ {
+ SvMetaAttribute * pAttr = aAttrList.GetObject( i );
+ if( pAttr->GetSlotId() == rId )
+ return pAttr;
+ }
+ }
+
+ return NULL;
+}
+
+/*************************************************************************
+|* SvIdlDataBase::ReadKnownClass()
+|*
+|* Beschreibung
+*************************************************************************/
+SvMetaClass * SvIdlDataBase::ReadKnownClass( SvTokenStream & rInStm )
+{
+ sal_uInt32 nTokPos = rInStm.Tell();
+ SvToken * pTok = rInStm.GetToken_Next();
+
+ if( pTok->IsIdentifier() )
+ for( sal_uLong n = 0; n < aClassList.Count(); n++ )
+ {
+ SvMetaClass * pClass = aClassList.GetObject( n );
+ if( pClass->GetName() == pTok->GetString() )
+ return pClass;
+ }
+
+ rInStm.Seek( nTokPos );
+ return NULL;
+}
+
+/*************************************************************************
+|* SvIdlDataBase::Write()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvIdlDataBase::Write( const ByteString & rText )
+{
+ if( nVerbosity != 0 )
+ fprintf( stdout, "%s", rText.GetBuffer() );
+}
+
+/*************************************************************************
+|* SvIdlDataBase::WriteError()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvIdlDataBase::WriteError( const ByteString & rErrWrn,
+ const ByteString & rFileName,
+ const ByteString & rErrorText,
+ sal_uLong nRow, sal_uLong nColumn ) const
+{
+ //Fehlerbehandlung
+ fprintf( stderr, "\n%s --- %s: ( %ld, %ld )\n",
+ rFileName.GetBuffer(), rErrWrn.GetBuffer(), nRow, nColumn );
+
+ if( rErrorText.Len() )
+ { // Fehler gesetzt
+ fprintf( stderr, "\t%s\n", rErrorText.GetBuffer() );
+ }
+}
+
+/*************************************************************************
+|* SvIdlDataBase::WriteError()
+|*
+|* Beschreibung
+*************************************************************************/
+void SvIdlDataBase::WriteError( SvTokenStream & rInStm )
+{
+ //Fehlerbehandlung
+ String aFileName( rInStm.GetFileName() );
+ ByteString aErrorText;
+ sal_uLong nRow = 0, nColumn = 0;
+
+ rInStm.SeekEnd();
+ SvToken *pTok = rInStm.GetToken();
+
+ // Fehlerposition
+ nRow = pTok->GetLine();
+ nColumn = pTok->GetColumn();
+
+ if( aError.IsError() )
+ { // Fehler gesetzt
+ // Fehler Token suchen
+ // Fehlertext
+ if( aError.GetText().Len() )
+ {
+ aErrorText = "may be <";
+ aErrorText += aError.GetText();
+ }
+ SvToken * pPrevTok = NULL;
+ while( pTok != pPrevTok )
+ {
+ pPrevTok = pTok;
+ if( pTok->GetLine() == aError.nLine
+ && pTok->GetColumn() == aError.nColumn )
+ break;
+ pTok = rInStm.GetToken_PrevAll();
+ }
+
+ // Fehlerposition
+ aErrorText += "> at ( ";
+ aErrorText += ByteString::CreateFromInt64(aError.nLine);
+ aErrorText += ", ";
+ aErrorText += ByteString::CreateFromInt64(aError.nColumn);
+ aErrorText += " )";
+
+ // Fehler zuruecksetzen
+ aError = SvIdlError();
+ }
+
+ WriteError( "error", ByteString( aFileName, RTL_TEXTENCODING_UTF8 ), aErrorText, nRow, nColumn );
+
+ DBG_ASSERT( pTok, "token must be found" );
+ if( !pTok )
+ return;
+
+ // Identifier in der Naehe suchen
+ if( !pTok->IsIdentifier() )
+ {
+ rInStm.GetToken_PrevAll();
+ pTok = rInStm.GetToken();
+ }
+ if( pTok && pTok->IsIdentifier() )
+ {
+ ByteString aN = IDLAPP->pHashTable->GetNearString( pTok->GetString() );
+ if( aN.Len() )
+ fprintf( stderr, "%s versus %s\n", pTok->GetString().GetBuffer(), aN.GetBuffer() );
+ }
+}
+
+/****************** SvIdlWorkingBase ****************************************/
+/*************************************************************************
+|* SvIdlWorkingBase::SvIdlWorkingBase()
+|*
+|* Beschreibung
+*************************************************************************/
+SvIdlWorkingBase::SvIdlWorkingBase(const SvCommand& rCmd) : SvIdlDataBase(rCmd)
+{
+}
+
+/*************************************************************************
+|* SvIdlWorkingBase::ReadSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvIdlWorkingBase::ReadSvIdl( SvTokenStream & rInStm, sal_Bool bImported, const String & rPath )
+{
+ aPath = rPath; // nur fuer den durchlauf gueltig
+ SvToken * pTok;
+ sal_Bool bOk = sal_True;
+ pTok = rInStm.GetToken();
+ // nur ein import ganz am Anfang
+ if( pTok->Is( SvHash_import() ) )
+ {
+ rInStm.GetToken_Next();
+ rInStm.Read( '(' ); // optional
+ pTok = rInStm.GetToken_Next();
+ if( pTok->IsString() )
+ {
+ DirEntry aFullName( String::CreateFromAscii( pTok->GetString().GetBuffer() ) );
+ if( aFullName.Find( rPath ) )
+ {
+ SvFileStream aStm( aFullName.GetFull(),
+ STREAM_STD_READ | STREAM_NOCREATE );
+ Load( aStm );
+ if( aStm.GetError() != SVSTREAM_OK )
+ {
+ if( aStm.GetError() == SVSTREAM_WRONGVERSION )
+ {
+ ByteString aStr( "wrong version, file " );
+ aStr += ByteString( aFullName.GetFull(), RTL_TEXTENCODING_UTF8 );
+ SetError( aStr, pTok );
+ WriteError( rInStm );
+ bOk = sal_False;
+ }
+ else
+ {
+ aStm.Seek( 0 );
+ aStm.ResetError();
+ SvTokenStream aTokStm( aStm, aFullName.GetFull() );
+ bOk = ReadSvIdl( aTokStm, sal_True, rPath );
+ }
+ }
+ }
+ else
+ bOk = sal_False;
+ }
+ else
+ bOk = sal_False;
+ }
+
+ sal_uInt32 nBeginPos = 0xFFFFFFFF; // kann mit Tell nicht vorkommen
+
+ while( bOk && nBeginPos != rInStm.Tell() )
+ {
+ nBeginPos = rInStm.Tell();
+ pTok = rInStm.GetToken();
+ if( pTok->IsEof() )
+ return sal_True;
+ if( pTok->IsEmpty() )
+ bOk = sal_False;
+
+ // nur ein import ganz am Anfang
+ /*else */if( pTok->Is( SvHash_module() ) )
+ {
+ SvMetaModuleRef aModule = new SvMetaModule( rInStm.GetFileName(), bImported );
+ if( aModule->ReadSvIdl( *this, rInStm ) )
+ GetModuleList().Append( aModule );
+ else
+ bOk = sal_False;
+ }
+ else
+ bOk = sal_False;
+ }
+ if( !bOk || !pTok->IsEof() )
+ {
+ //Fehlerbehandlung
+ WriteError( rInStm );
+ return sal_False;
+ }
+ return sal_True;
+}
+
+/*************************************************************************
+|* SvIdlWorkingBase::WriteSvIdl()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvIdlWorkingBase::WriteSvIdl( SvStream & rOutStm )
+{
+ if( rOutStm.GetError() != SVSTREAM_OK )
+ return sal_False;
+
+ SvStringHashList aList;
+ if( GetIdTable() )
+ {
+ GetIdTable()->FillHashList( &aList );
+ SvStringHashEntry * pEntry = aList.First();
+ while( pEntry )
+ {
+ rOutStm << "#define " << pEntry->GetName().GetBuffer()
+ << '\t'
+ << ByteString::CreateFromInt64(
+ pEntry->GetValue() ).GetBuffer()
+ << endl;
+ pEntry = aList.Next();
+ }
+ }
+
+ for( sal_uLong n = 0; n < GetModuleList().Count(); n++ )
+ {
+ SvMetaModule * pModule = GetModuleList().GetObject( n );
+ //if( !pModule->IsImported() )
+ pModule->WriteSvIdl( *this, rOutStm, 0 );
+ }
+ return sal_True;
+}
+
+/*************************************************************************
+|* SvIdlWorkingBase::WriteSfx()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvIdlWorkingBase::WriteSfx( SvStream & rOutStm )
+{
+ if( rOutStm.GetError() != SVSTREAM_OK )
+ return sal_False;
+
+ // alle Tmp-Variablen fuer das Schreiben zuruecksetzen
+ WriteReset();
+ SvMemoryStream aTmpStm( 256000, 256000 );
+ sal_uLong n;
+ for( n = 0; n < GetModuleList().Count(); n++ )
+ {
+ SvMetaModule * pModule = GetModuleList().GetObject( n );
+ if( !pModule->IsImported() )
+ pModule->WriteSfx( *this, aTmpStm );
+ aTmpStm.Seek( 0 );
+ }
+ for( n = 0; n < aUsedTypes.Count(); n++ )
+ {
+ SvMetaType * pType = aUsedTypes.GetObject( n );
+ pType->WriteSfx( *this, rOutStm );
+ }
+ aUsedTypes.Clear();
+ rOutStm << aTmpStm;
+ return sal_True;
+}
+
+sal_Bool SvIdlWorkingBase::WriteHelpIds( SvStream& rOutStm )
+{
+ if( rOutStm.GetError() != SVSTREAM_OK )
+ return sal_False;
+
+ Table aIdTable;
+ sal_uLong n;
+ for( n = 0; n < GetModuleList().Count(); n++ )
+ {
+ SvMetaModule * pModule = GetModuleList().GetObject( n );
+ //if( !pModule->IsImported() )
+ pModule->WriteHelpIds( *this, rOutStm, &aIdTable );
+ }
+
+ const SvMetaAttributeMemberList & rAttrList = GetAttrList();
+ for( n = 0; n < rAttrList.Count(); n++ )
+ {
+ SvMetaAttribute * pAttr = rAttrList.GetObject( n );
+ pAttr->WriteHelpId( *this, rOutStm, &aIdTable );
+ }
+
+ return sal_True;
+}
+
+/*************************************************************************
+|* SvIdlWorkingBase::WriteSfxItem()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvIdlWorkingBase::WriteSfxItem( SvStream & )
+{
+ return sal_False;
+}
+
+void SvIdlDataBase::StartNewFile( const String& rName )
+{
+ bExport = ( aExportFile.EqualsIgnoreCaseAscii( rName ) );
+}
+
+void SvIdlDataBase::AppendAttr( SvMetaAttribute *pAttr )
+{
+ aAttrList.Append( pAttr );
+ if ( bExport )
+ pAttr->SetNewAttribute( sal_True );
+}
+
+sal_Bool SvIdlWorkingBase::WriteCSV( SvStream& rStrm )
+{
+ SvMetaAttributeMemberList &rList = GetAttrList();
+ sal_uLong nCount = rList.Count();
+ for ( sal_uLong n=0; n<nCount; n++ )
+ {
+ if ( rList.GetObject(n)->IsNewAttribute() )
+ {
+ rList.GetObject(n)->WriteCSV( *this, rStrm );
+ }
+ }
+
+ if ( rStrm.GetError() != SVSTREAM_OK )
+ return sal_False;
+ else
+ return sal_True;
+}
+
+/*************************************************************************
+|* SvIdlWorkingBase::WriteDocumentation()
+|*
+|* Beschreibung
+*************************************************************************/
+sal_Bool SvIdlWorkingBase::WriteDocumentation( SvStream & rOutStm )
+{
+ if( rOutStm.GetError() != SVSTREAM_OK )
+ return sal_False;
+
+ for( sal_uLong n = 0; n < GetModuleList().Count(); n++ )
+ {
+ SvMetaModule * pModule = GetModuleList().GetObject( n );
+ if( !pModule->IsImported() )
+ pModule->Write( *this, rOutStm, 0, WRITE_DOCU );
+ }
+ return sal_True;
+}
+
+
+
+#endif // IDL_COMPILER
+
diff --git a/idl/source/prj/globals.cxx b/idl/source/prj/globals.cxx
new file mode 100755
index 000000000000..d213fc06b16a
--- /dev/null
+++ b/idl/source/prj/globals.cxx
@@ -0,0 +1,189 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_idl.hxx"
+
+/****************** I N C L U D E S **************************************/
+#include <tools/shl.hxx>
+
+#include <globals.hxx>
+#include <database.hxx>
+
+/****************** G L O B A L S ****************************************/
+IdlDll * GetIdlApp()
+{
+ if( !(*(IdlDll**)GetAppData(SHL_IDL)) )
+ {
+ (*(IdlDll**)GetAppData(SHL_IDL)) = new IdlDll();
+ // Temporaer, sonst nur wenn Compiler
+ //GetIdlApp()->pHashTable = new SvStringHashTable( 2801 );
+ //GetIdlApp()->pGlobalNames = new SvGlobalHashNames();
+ }
+ return (*(IdlDll**)GetAppData(SHL_IDL));
+}
+
+IdlDll::IdlDll()
+ : pHashTable( NULL )
+ , pClassMgr( NULL )
+ , pGlobalNames( NULL )
+
+{
+ pClassMgr = new SvClassManager();
+ // File OBJECT.HXX:
+ pClassMgr->SV_CLASS_REGISTER( SvMetaAttribute );
+ pClassMgr->SV_CLASS_REGISTER( SvMetaClass );
+ //File SLOT.HXX:
+ pClassMgr->SV_CLASS_REGISTER( SvMetaSlot );
+ //File MODULE.HXX:
+ pClassMgr->SV_CLASS_REGISTER( SvMetaModule );
+ //File BASOBJ.HXX:
+ pClassMgr->SV_CLASS_REGISTER( SvMetaObject );
+ pClassMgr->SV_CLASS_REGISTER( SvMetaName );
+ pClassMgr->SV_CLASS_REGISTER( SvMetaExtern );
+ pClassMgr->SV_CLASS_REGISTER( SvMetaReference );
+ //File TYPES.HXX:
+ pClassMgr->SV_CLASS_REGISTER( SvMetaType );
+ pClassMgr->SV_CLASS_REGISTER( SvMetaTypeString );
+ pClassMgr->SV_CLASS_REGISTER( SvMetaEnumValue );
+ pClassMgr->SV_CLASS_REGISTER( SvMetaTypeEnum );
+ pClassMgr->SV_CLASS_REGISTER( SvMetaTypevoid );
+ pClassMgr->SV_CLASS_REGISTER( SvClassElement );
+}
+
+IdlDll::~IdlDll()
+{
+ delete pGlobalNames;
+ delete pClassMgr;
+ delete pHashTable;
+}
+
+/*************************************************************************
+|*
+|* SvGlobalHashNames::SvGlobalHashNames()
+|*
+|* Beschreibung
+|* Ersterstellung MM 08.08.91
+|* Letzte Aenderung MM 08.08.91
+|*
+*************************************************************************/
+inline SvStringHashEntry * INS( const ByteString & rName )
+{
+ sal_uInt32 nIdx;
+ IDLAPP->pHashTable->Insert( rName, &nIdx );
+ return (SvStringHashEntry * )IDLAPP->pHashTable->Get( nIdx );
+}
+#define A_ENTRY( Name ) , MM_##Name( INS( #Name ) )
+
+SvGlobalHashNames::SvGlobalHashNames()
+ : MM_Name( INS( "Name" ) )
+ , MM_module( INS( "module" ) )
+ , MM_interface( INS( "interface" ) )
+ , MM_in( INS( "in" ) )
+ , MM_out( INS( "out" ) )
+ , MM_inout( INS( "inout" ) )
+ , MM_String( INS( "String" ) )
+ , MM_UCHAR( INS( "UCHAR" ) )
+ , MM_USHORT( INS( "USHORT" ) )
+ , MM_uuid( INS( "uuid" ) )
+ , MM_HelpContext( INS( "HelpContext" ) )
+ , MM_HelpText( INS( "HelpText" ) )
+ , MM_void( INS( "void" ) )
+ , MM_shell( INS( "shell" ) )
+ , MM_Get( INS( "Get" ) )
+ , MM_Set( INS( "Set" ) )
+ , MM_SlotId( INS( "SlotId" ) )
+ , MM_HasCoreId( INS( "HasCoreId" ) )
+ , MM_Cachable( INS( "Cachable" ) )
+// , MM_Volatile( INS( "Volatile" ) )
+ , MM_Toggle( INS( "Toggle" ) )
+ , MM_AutoUpdate( INS( "AutoUpdate" ) )
+ , MM_Synchron( INS( "Synchron" ) )
+ , MM_Asynchron( INS( "Asynchron" ) )
+ A_ENTRY(RecordPerSet)
+ A_ENTRY(RecordPerItem)
+ A_ENTRY(RecordManual)
+ A_ENTRY(NoRecord)
+ A_ENTRY(RecordAbsolute)
+ A_ENTRY(enum)
+ A_ENTRY(UINT16)
+ A_ENTRY(INT16)
+ A_ENTRY(UINT32)
+ A_ENTRY(INT32)
+ A_ENTRY(int)
+ A_ENTRY(BOOL)
+ A_ENTRY(char)
+ A_ENTRY(BYTE)
+ A_ENTRY(float)
+ A_ENTRY(double)
+ A_ENTRY(item)
+ A_ENTRY(PseudoSlots)
+ A_ENTRY(map)
+ A_ENTRY(Default)
+ A_ENTRY(HelpFile)
+ A_ENTRY(Version)
+ A_ENTRY(import)
+ A_ENTRY(SlotIdFile)
+ A_ENTRY(SvName)
+ A_ENTRY(SbxName)
+ A_ENTRY(ItemName)
+ A_ENTRY(OdlName)
+ A_ENTRY(include)
+ A_ENTRY(ExecMethod)
+ A_ENTRY(StateMethod)
+ A_ENTRY(GroupId)
+ A_ENTRY(HasDialog)
+ A_ENTRY(TypeLibFile)
+ A_ENTRY(Export)
+ A_ENTRY(Automation)
+ A_ENTRY(PseudoPrefix)
+ A_ENTRY(define)
+ A_ENTRY(MenuConfig)
+ A_ENTRY(ToolBoxConfig)
+ A_ENTRY(StatusBarConfig)
+ A_ENTRY(AccelConfig)
+ A_ENTRY(AllConfig)
+ A_ENTRY(FastCall)
+ A_ENTRY(SbxObject)
+ A_ENTRY(Container)
+ A_ENTRY(ImageRotation)
+ A_ENTRY(ImageReflection)
+ A_ENTRY(IsCollection)
+ A_ENTRY(ReadOnlyDoc)
+ A_ENTRY(ConfigName)
+ A_ENTRY(union)
+ A_ENTRY(struct)
+ A_ENTRY(typedef)
+ A_ENTRY(Readonly)
+ A_ENTRY(SlotType)
+ A_ENTRY(ModulePrefix)
+ A_ENTRY(DisableFlags)
+ A_ENTRY(Hidden)
+ A_ENTRY(Description)
+ A_ENTRY(UnoName)
+{}
+
diff --git a/idl/source/prj/makefile.mk b/idl/source/prj/makefile.mk
new file mode 100644
index 000000000000..c33d2e9f3d7a
--- /dev/null
+++ b/idl/source/prj/makefile.mk
@@ -0,0 +1,49 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=idl
+TARGET=prj
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+
+CDEFS+=-DIDL_COMPILER
+# --- Files --------------------------------------------------------------
+
+OBJFILES= $(OBJ)$/command.obj \
+ $(OBJ)$/svidl.obj \
+ $(OBJ)$/globals.obj \
+ $(OBJ)$/database.obj
+
+# --- Targets ------------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/idl/source/prj/svidl.cxx b/idl/source/prj/svidl.cxx
new file mode 100755
index 000000000000..d2884464b5a7
--- /dev/null
+++ b/idl/source/prj/svidl.cxx
@@ -0,0 +1,447 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_idl.hxx"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <database.hxx>
+#include <globals.hxx>
+#include <command.hxx>
+#include <tools/fsys.hxx>
+#include <tools/string.hxx>
+
+#define BR 0x8000
+sal_Bool FileMove_Impl( const String & rFile1, const String & rFile2, sal_Bool bImmerVerschieben )
+{
+ //printf( "Move from %s to %s\n", rFile2.GetStr(), rFile1.GetStr() );
+ sal_uLong nC1 = 0;
+ sal_uLong nC2 = 1;
+ if( !bImmerVerschieben )
+ {
+ SvFileStream aOutStm1( rFile1, STREAM_STD_READ );
+ SvFileStream aOutStm2( rFile2, STREAM_STD_READ );
+ if( aOutStm1.GetError() == SVSTREAM_OK )
+ {
+ sal_uInt8 * pBuf1 = new sal_uInt8[ BR ];
+ sal_uInt8 * pBuf2 = new sal_uInt8[ BR ];
+ nC1 = aOutStm1.Read( pBuf1, BR );
+ nC2 = aOutStm2.Read( pBuf2, BR );
+ while( nC1 == nC2 )
+ {
+ if( memcmp( pBuf1, pBuf2, nC1 ) )
+ {
+ nC1++;
+ break;
+ }
+ else
+ {
+ if( 0x8000 != nC1 )
+ break;
+ nC1 = aOutStm1.Read( pBuf1, BR );
+ nC2 = aOutStm2.Read( pBuf2, BR );
+ }
+ }
+ delete[] pBuf1;
+ delete[] pBuf2;
+ }
+ }
+ DirEntry aF2( rFile2 );
+ if( nC1 != nC2 )
+ {// es hat sich etwas geaendert
+ DirEntry aF1( rFile1 );
+ aF1.Kill();
+ // Datei verschieben
+ if( aF2.MoveTo( aF1 ) )
+ {
+ // Beide Dateien loeschen
+ aF1.Kill();
+ aF2.Kill();
+ return sal_False;
+ }
+/*
+ else
+ {
+ printf( "%s to %s moved\n",
+ rFile2.GetStr(), rFile1.GetStr() );
+ }
+*/
+ return sal_True;
+ }
+ return 0 == aF2.Kill();
+}
+
+/*************************************************************************
+|* main()
+|*
+|* Beschreibung
+*************************************************************************/
+#if defined( UNX ) || (defined( PM2 ) && defined( CSET )) || defined (WTC) || defined (MTW) || defined (__MINGW32__) || defined( OS2 )
+int main ( int argc, char ** argv)
+{
+#else
+int cdecl main ( int argc, char ** argv)
+{
+#endif
+
+/*
+ pStr = ::ResponseFile( &aCmdLine, argv, argc );
+ if( pStr )
+ {
+ printf( "Cannot open response file <%s>\n", pStr );
+ return( 1 );
+ };
+*/
+
+ String aTmpListFile;
+ String aTmpSlotMapFile;
+ String aTmpSfxItemFile;
+ String aTmpDataBaseFile;
+ String aTmpCallingFile;
+ String aTmpSrcFile;
+ String aTmpCxxFile;
+ String aTmpHxxFile;
+ String aTmpHelpIdFile;
+ String aTmpCSVFile;
+ String aTmpDocuFile;
+
+ SvCommand aCommand( argc, argv );
+
+ if( aCommand.nVerbosity != 0 )
+ printf( "StarView Interface Definition Language (IDL) Compiler 3.0\n" );
+
+ Init();
+ SvIdlWorkingBase * pDataBase = new SvIdlWorkingBase(aCommand);
+
+ int nExit = 0;
+ if( aCommand.aExportFile.Len() )
+ {
+ DirEntry aDE( aCommand.aExportFile );
+ pDataBase->SetExportFile( aDE.GetName() );
+ }
+
+ if( ReadIdl( pDataBase, aCommand ) )
+ {
+ if( nExit == 0 && aCommand.aDocuFile.Len() )
+ {
+ DirEntry aDE( aCommand.aDocuFile );
+ aDE.ToAbs();
+ aTmpDocuFile = aDE.GetPath().TempName().GetFull();
+ SvFileStream aOutStm( aTmpDocuFile, STREAM_READWRITE | STREAM_TRUNC );
+ if( !pDataBase->WriteDocumentation( aOutStm ) )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write documentation file: ";
+ aStr += ByteString( aCommand.aDocuFile, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ }
+ }
+ if( nExit == 0 && aCommand.aListFile.Len() )
+ {
+ DirEntry aDE( aCommand.aListFile );
+ aDE.ToAbs();
+ aTmpListFile = aDE.GetPath().TempName().GetFull();
+ SvFileStream aOutStm( aTmpListFile, STREAM_READWRITE | STREAM_TRUNC );
+ if( !pDataBase->WriteSvIdl( aOutStm ) )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write list file: ";
+ aStr += ByteString( aCommand.aListFile, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ }
+ }
+ if( nExit == 0 && aCommand.aSlotMapFile.Len() )
+ {
+ DirEntry aDE( aCommand.aSlotMapFile );
+ aDE.ToAbs();
+ aTmpSlotMapFile = aDE.GetPath().TempName().GetFull();
+ SvFileStream aOutStm( aTmpSlotMapFile, STREAM_READWRITE | STREAM_TRUNC );
+ if( !pDataBase->WriteSfx( aOutStm ) )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write slotmap file: ";
+ aStr += ByteString( aCommand.aSlotMapFile, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ }
+ }
+ if( nExit == 0 && aCommand.aHelpIdFile.Len() )
+ {
+ DirEntry aDE( aCommand.aHelpIdFile );
+ aDE.ToAbs();
+ aTmpHelpIdFile = aDE.GetPath().TempName().GetFull();
+ SvFileStream aStm( aTmpHelpIdFile, STREAM_READWRITE | STREAM_TRUNC );
+ if (!pDataBase->WriteHelpIds( aStm ) )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write help ID file: ";
+ aStr += ByteString( aCommand.aHelpIdFile, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ }
+ }
+ if( nExit == 0 && aCommand.aCSVFile.Len() )
+ {
+ DirEntry aDE( aCommand.aCSVFile );
+ aDE.ToAbs();
+ aTmpCSVFile = aDE.GetPath().TempName().GetFull();
+ SvFileStream aStm( aTmpCSVFile, STREAM_READWRITE | STREAM_TRUNC );
+ if (!pDataBase->WriteCSV( aStm ) )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write CSV file: ";
+ aStr += ByteString( aCommand.aCSVFile, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ }
+ }
+ if( nExit == 0 && aCommand.aSfxItemFile.Len() )
+ {
+ DirEntry aDE( aCommand.aSfxItemFile );
+ aDE.ToAbs();
+ aTmpSfxItemFile = aDE.GetPath().TempName().GetFull();
+ SvFileStream aOutStm( aTmpSfxItemFile, STREAM_READWRITE | STREAM_TRUNC );
+ if( !pDataBase->WriteSfxItem( aOutStm ) )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write item file: ";
+ aStr += ByteString( aCommand.aSfxItemFile, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ }
+ }
+ if( nExit == 0 && aCommand.aDataBaseFile.Len() )
+ {
+ DirEntry aDE( aCommand.aDataBaseFile );
+ aDE.ToAbs();
+ aTmpDataBaseFile = aDE.GetPath().TempName().GetFull();
+ SvFileStream aOutStm( aTmpDataBaseFile, STREAM_READWRITE | STREAM_TRUNC );
+ pDataBase->Save( aOutStm, aCommand.nFlags );
+ if( aOutStm.GetError() != SVSTREAM_OK )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write database file: ";
+ aStr += ByteString( aCommand.aDataBaseFile, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ }
+ }
+/*
+ if( nExit == 0 && aCommand.aCallingFile.Len() )
+ {
+ DirEntry aDE( aCommand.aCallingFile );
+ aDE.ToAbs();
+ aTmpCallingFile = aDE.GetPath().TempName().GetFull();
+ SvFileStream aOutStm( aTmpCallingFile, STREAM_READWRITE | STREAM_TRUNC );
+ pDataBase->WriteSbx( aOutStm );
+ //pDataBase->Save( aOutStm, aCommand.nFlags | IDL_WRITE_CALLING );
+ if( aOutStm.GetError() != SVSTREAM_OK )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write calling file: ";
+ aStr += aCommand.aCallingFile;
+ fprintf( stderr, "%s\n", aStr.GetStr() );
+ }
+ }
+ if( nExit == 0 && aCommand.aCxxFile.Len() )
+ {
+ DirEntry aDE( aCommand.aCxxFile );
+ aDE.ToAbs();
+ aTmpCxxFile = aDE.GetPath().TempName().GetFull();
+ SvFileStream aOutStm( aTmpCxxFile, STREAM_READWRITE | STREAM_TRUNC );
+
+ aOutStm << "#pragma hdrstop" << endl;
+ aOutStm << "#include <";
+ if( aCommand.aHxxFile.Len() )
+ aOutStm << DirEntry(aCommand.aHxxFile).GetName().GetBuffer();
+ else
+ {
+ DirEntry aDE( aCommand.aCxxFile );
+ aDE.SetExtension( "hxx" );
+ aOutStm << aDE.GetName().GetBuffer);
+ }
+ aOutStm << '>' << endl;
+ if( !pDataBase->WriteCxx( aOutStm ) )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write cxx file: ";
+ aStr += ByteString( aCommand.aCxxFile, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ }
+ }
+ if( nExit == 0 && aCommand.aHxxFile.Len() )
+ {
+ DirEntry aDE( aCommand.aHxxFile );
+ aDE.ToAbs();
+ aTmpHxxFile = aDE.GetPath().TempName().GetFull();
+ SvFileStream aOutStm( aTmpHxxFile, STREAM_READWRITE | STREAM_TRUNC );
+
+ aOutStm << "#include <somisc.hxx>" << endl;
+ if( !pDataBase->WriteHxx( aOutStm ) )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot write cxx file: ";
+ aStr += ByteString( aCommand.aHxxFile, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ }
+ }
+ */
+ }
+ else
+ nExit = -1;
+
+ if( nExit == 0 )
+ {
+ sal_Bool bErr = sal_False;
+ sal_Bool bDoMove = aCommand.aTargetFile.Len() == 0;
+ String aErrFile, aErrFile2;
+ if( !bErr && aCommand.aListFile.Len() )
+ {
+ bErr |= !FileMove_Impl( aCommand.aListFile, aTmpListFile, bDoMove );
+ if( bErr ) {
+ aErrFile = aCommand.aListFile;
+ aErrFile2 = aTmpListFile;
+ }
+ }
+ if( !bErr && aCommand.aSlotMapFile.Len() )
+ {
+ bErr |= !FileMove_Impl( aCommand.aSlotMapFile, aTmpSlotMapFile, bDoMove );
+ if( bErr ) {
+ aErrFile = aCommand.aSlotMapFile;
+ aErrFile2 = aTmpSlotMapFile;
+ }
+ }
+ if( !bErr && aCommand.aSfxItemFile.Len() )
+ {
+ bErr |= !FileMove_Impl( aCommand.aSfxItemFile, aTmpSfxItemFile, bDoMove );
+ if( bErr ) {
+ aErrFile = aCommand.aSfxItemFile;
+ aErrFile2 = aTmpSfxItemFile;
+ }
+ }
+ if( !bErr && aCommand.aDataBaseFile.Len() )
+ {
+ bErr |= !FileMove_Impl( aCommand.aDataBaseFile, aTmpDataBaseFile, bDoMove );
+ if( bErr ) {
+ aErrFile = aCommand.aDataBaseFile;
+ aErrFile2 = aTmpDataBaseFile;
+ }
+ }
+ if( !bErr && aCommand.aCallingFile.Len() )
+ {
+ bErr |= !FileMove_Impl( aCommand.aCallingFile, aTmpCallingFile, bDoMove );
+ if( bErr ) {
+ aErrFile = aCommand.aCallingFile;
+ aErrFile2 = aTmpCallingFile;
+ }
+ }
+ if( !bErr && aCommand.aCxxFile.Len() )
+ {
+ bErr |= !FileMove_Impl( aCommand.aCxxFile, aTmpCxxFile, bDoMove );
+ if( bErr ) {
+ aErrFile = aCommand.aCxxFile;
+ aErrFile2 = aTmpCxxFile;
+ }
+ }
+ if( !bErr && aCommand.aHxxFile.Len() )
+ {
+ bErr |= !FileMove_Impl( aCommand.aHxxFile, aTmpHxxFile, bDoMove );
+ if( bErr ) {
+ aErrFile = aCommand.aHxxFile;
+ aErrFile2 = aTmpHxxFile;
+ }
+ }
+ if( !bErr && aCommand.aHelpIdFile.Len() )
+ {
+ bErr |= !FileMove_Impl( aCommand.aHelpIdFile, aTmpHelpIdFile, bDoMove );
+ if( bErr ) {
+ aErrFile = aCommand.aHelpIdFile;
+ aErrFile2 = aTmpHelpIdFile;
+ }
+ }
+ if( !bErr && aCommand.aCSVFile.Len() )
+ {
+ bErr |= !FileMove_Impl( aCommand.aCSVFile, aTmpCSVFile, bDoMove );
+ if( bErr ) {
+ aErrFile = aCommand.aCSVFile;
+ aErrFile2 = aTmpCSVFile;
+ }
+ }
+ if( !bErr && aCommand.aDocuFile.Len() )
+ {
+ bErr |= !FileMove_Impl( aCommand.aDocuFile, aTmpDocuFile, bDoMove );
+ if( bErr ) {
+ aErrFile = aCommand.aDocuFile;
+ aErrFile2 = aTmpDocuFile;
+ }
+ }
+
+ if( bErr )
+ {
+ nExit = -1;
+ ByteString aStr = "cannot move file from: ";
+ aStr += ByteString( aErrFile2, RTL_TEXTENCODING_UTF8 );
+ aStr += "\n to file: ";
+ aStr += ByteString( aErrFile, RTL_TEXTENCODING_UTF8 );
+ fprintf( stderr, "%s\n", aStr.GetBuffer() );
+ }
+ else
+ {
+ if( aCommand.aTargetFile.Len() )
+ {
+#ifdef ICC
+ DirEntry aT(aCommand.aTargetFile);
+ aT.Kill();
+#endif
+ // Datei stempeln, da idl korrekt durchlaufen wurde
+ SvFileStream aOutStm( aCommand.aTargetFile,
+ STREAM_READWRITE | STREAM_TRUNC );
+ }
+ }
+ }
+
+ if( nExit != 0 )
+ {
+ if( aCommand.aListFile.Len() )
+ DirEntry( aTmpListFile ).Kill();
+ if( aCommand.aSlotMapFile.Len() )
+ DirEntry( aTmpSlotMapFile ).Kill();
+ if( aCommand.aSfxItemFile.Len() )
+ DirEntry( aTmpSfxItemFile ).Kill();
+ if( aCommand.aDataBaseFile.Len() )
+ DirEntry( aTmpDataBaseFile ).Kill();
+ if( aCommand.aCallingFile.Len() )
+ DirEntry( aTmpCallingFile ).Kill();
+ if( aCommand.aCxxFile.Len() )
+ DirEntry( aTmpCxxFile ).Kill();
+ if( aCommand.aHxxFile.Len() )
+ DirEntry( aTmpHxxFile ).Kill();
+ }
+
+ delete pDataBase;
+ DeInit();
+ if( nExit != 0 )
+ fprintf( stderr, "svidl terminated with errors\n" );
+ return nExit;
+}
+
diff --git a/idl/source/svidl.dat b/idl/source/svidl.dat
new file mode 100644
index 000000000000..4750475c7462
--- /dev/null
+++ b/idl/source/svidl.dat
Binary files differ