Commits

Anonymous committed 749f005 Merge

rebased to m88.

Comments (0)

Files changed (579)

 c605e94568651ba1b2626a6f37aa4c7ca4b4710f OOO330_m3
 03cf80e29979c28332a36bcb00a8947032433b3d OOO330_m4
 d9859c6e249e31fbd651f9a98c2fbe85d6f2df80 OOO330_m5
+b50d17df62fbe1557311243a12ca1bced5c1c28b OOO330_m6
+ca1b98fb0dd4add032396c9f1d37a3f6764e3909 OOO330_m7
+850e10cf801ede046f962443383ae239a28be675 OOO330_m8
+467bdca2a6aee659c46ad740255356e3af43a0d0 DEV300_m87

basctl/source/basicide/baside2.cxx

 						break;
 					}
 				}
-				else if  ( !pMethod || ( nStart < nCurMethodStart ) )
+				else if  ( !pMethod || ( nStart < nCurMethodStart && !pM->IsHidden() ) )
 				{
 					pMethod = pM;
 					nCurMethodStart = nStart;

basctl/source/basicide/basidesh.cxx

 
 TYPEINIT1( BasicIDEShell, SfxViewShell );
 
-SFX_IMPL_VIEWFACTORY( BasicIDEShell, IDEResId( SVX_INTERFACE_BASIDE_VIEWSH ) )
+SFX_IMPL_NAMED_VIEWFACTORY( BasicIDEShell, "Default" )
 {
 	SFX_VIEW_REGISTRATION( BasicDocShell );
 }

basctl/source/basicide/basobj2.cxx

 	    SbModuleRef xModule = new SbModule( rModName );
 	    xModule->SetSource32( aOUSource );
 	    USHORT nCount = xModule->GetMethods()->Count();
-        aSeqMethods.realloc( nCount );
-
+		USHORT nRealCount = nCount;
 	    for ( USHORT i = 0; i < nCount; i++ )
 	    {
 		    SbMethod* pMethod = (SbMethod*)xModule->GetMethods()->Get( i );
+			if( pMethod->IsHidden() )
+				--nRealCount;
+	    }
+        aSeqMethods.realloc( nRealCount );
+
+		USHORT iTarget = 0;
+	    for ( USHORT i = 0 ; i < nCount; ++i )
+	    {
+		    SbMethod* pMethod = (SbMethod*)xModule->GetMethods()->Get( i );
+			if( pMethod->IsHidden() )
+				continue;
 		    DBG_ASSERT( pMethod, "Method not found! (NULL)" );
-		    aSeqMethods.getArray()[ i ] = pMethod->GetName();
+		    aSeqMethods.getArray()[ iTarget++ ] = pMethod->GetName();
 	    }
     }
 
         if ( pMethods )
         {
             SbMethod* pMethod = (SbMethod*)pMethods->Find( rMethName, SbxCLASS_METHOD );
-            if ( pMethod )
+            if ( pMethod && !pMethod->IsHidden() )
                 bHasMethod = TRUE;
         }
     }

basctl/source/basicide/macrodlg.cxx

 		// Die Macros sollen in der Reihenfolge angezeigt werden,
 		// wie sie im Modul stehen.
 		MacroList aMacros;
-		USHORT nMacros = pModule->GetMethods()->Count();
-		USHORT nMethod;
-		for ( nMethod = 0; nMethod  < nMacros; nMethod++ )
+		USHORT nMacroCount = pModule->GetMethods()->Count();
+		USHORT nRealMacroCount = 0;
+		USHORT iMeth;
+		for ( iMeth = 0; iMeth  < nMacroCount; iMeth++ )
 		{
-			SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Get( nMethod );
+			SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Get( iMeth );
+			if( pMethod->IsHidden() )
+				continue;
+			++nRealMacroCount;
 			DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" );
 			ULONG nPos = LIST_APPEND;
 			// Eventuell weiter vorne ?
 		}
 
 		aMacroBox.SetUpdateMode( FALSE );
-		for ( nMethod = 0; nMethod < nMacros; nMethod++ )
-			aMacroBox.InsertEntry( aMacros.GetObject( nMethod )->GetName() );
+		for ( iMeth = 0; iMeth < nRealMacroCount; iMeth++ )
+			aMacroBox.InsertEntry( aMacros.GetObject( iMeth )->GetName() );
 		aMacroBox.SetUpdateMode( TRUE );
 
 		if ( aMacroBox.GetEntryCount() )

basic/inc/basic/sbmod.hxx

 class SbIfaceMapperMethod;
 class SbClassModuleObject;
 
+struct ClassModuleRunInitItem;
 struct SbClassData;
 class SbModuleImpl;
 
 	SbxObjectRef pDocObject; // an impl object ( used by Document Modules )
 	bool 	bIsProxyModule;
 
+	static void		implProcessModuleRunInit( ClassModuleRunInitItem& rItem );
 	void			StartDefinitions();
 	SbMethod*		GetMethod( const String&, SbxDataType );
 	SbProperty*		GetProperty( const String&, SbxDataType );
     void SetVBACompat( BOOL bCompat );
     INT32 GetModuleType() { return mnType; }
     void SetModuleType( INT32 nType ) { mnType = nType; }
-	bool GetIsProxyModule() { return bIsProxyModule; }
+	bool isProxyModule() { return bIsProxyModule; }
 	void AddVarName( const String& aName );
 	void RemoveVars();
     ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > GetUnoModule();

basic/inc/basic/sbxvar.hxx

 		sal_uInt64      uInt64;
 		int             nInt;
 		unsigned int    nUInt;
-		String*         pString;
+		::rtl::OUString* pOUString;
 		SbxDecimal*		pDecimal;
 
 		SbxBase*        pObj;
 	SbxValues( double _nDouble ): nDouble( _nDouble ), eType(SbxDOUBLE) {}
 	SbxValues( int _nInt ): nInt( _nInt ), eType(SbxINT) {}
 	SbxValues( unsigned int _nUInt ): nUInt( _nUInt ), eType(SbxUINT) {}
-	SbxValues( const String* _pString ): pString( (String*) _pString ), eType(SbxSTRING) {}
+	SbxValues( const ::rtl::OUString* _pString ): pOUString( (::rtl::OUString*)_pString ), eType(SbxSTRING) {}
 	SbxValues( SbxBase* _pObj ): pObj( _pObj ), eType(SbxOBJECT) {}
 	SbxValues( sal_Unicode* _pChar ): pChar( _pChar ), eType(SbxLPSTR) {}
 	SbxValues( void* _pData ): pData( _pData ), eType(SbxPOINTER) {}
 	SbxValue* TheRealValue() const;
 protected:
 	SbxValues aData; // Data
-	String    aPic;  // Picture-String
+	::rtl::OUString aPic;  // Picture-String
+	String          aToolString;  // tool string copy
 
 	virtual void Broadcast( ULONG );   	// Broadcast-Call
 	virtual ~SbxValue();
 	UINT16 GetErr() const;
 	const  String& GetString() const;
 	const  String& GetCoreString() const;
+    ::rtl::OUString GetOUString() const;
 	SbxDecimal* GetDecimal() const;
 	SbxBase* GetObject() const;
 	BOOL	 HasObject() const;
 	BOOL PutDate( double );
 	BOOL PutBool( BOOL );
 	BOOL PutErr( USHORT );
-	BOOL PutStringExt( const String& );     // with extended analysis (International, "TRUE"/"FALSE")
-	BOOL PutString( const String& );
+	BOOL PutStringExt( const ::rtl::OUString& );     // with extended analysis (International, "TRUE"/"FALSE")
+	BOOL PutString( const ::rtl::OUString& );
 	BOOL PutString( const sal_Unicode* );   // Type = SbxSTRING
 	BOOL PutpChar( const sal_Unicode* );    // Type = SbxLPSTR
 	BOOL PutDecimal( SbxDecimal* pDecimal );

basic/source/classes/sb.cxx

 #include <vos/mutex.hxx>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include "errobject.hxx"
+#include <hash_map>
 
 #include <com/sun/star/script/ModuleType.hpp>
 #include <com/sun/star/script/ModuleInfo.hpp>
 				USHORT nFlags_ = pProp->GetFlags();
 				pProp->SetFlag( SBX_NO_BROADCAST );
 				SbxProperty* pNewProp = new SbxProperty( *pProp );
+
+				// Special handling for modules instances and collections, they need
+				// to be instantiated, otherwise all refer to the same base object
+				SbxDataType eVarType = pProp->GetType();
+				if( eVarType == SbxOBJECT )
+				{
+					SbxBase* pObjBase = pProp->GetObject();
+					SbxObject* pObj = PTR_CAST(SbxObject,pObjBase);
+					if( pObj != NULL )
+					{
+						String aObjClass = pObj->GetClassName();
+						(void)aObjClass;
+
+						SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pObjBase);
+						if( pClassModuleObj != NULL )
+						{
+							SbModule* pLclClassModule = pClassModuleObj->getClassModule();
+							SbClassModuleObject* pNewObj = new SbClassModuleObject( pLclClassModule );
+							pNewObj->SetName( pProp->GetName() );
+							pNewObj->SetParent( pLclClassModule->pParent );
+							pNewProp->PutObject( pNewObj );
+						}
+						else if( aObjClass.EqualsIgnoreCaseAscii( "Collection" ) )
+						{
+							String aCollectionName( RTL_CONSTASCII_USTRINGPARAM("Collection") );
+							BasicCollection* pNewCollection = new BasicCollection( aCollectionName );
+							pNewCollection->SetName( pProp->GetName() );
+							pNewCollection->SetParent( pClassModule->pParent );
+							pNewProp->PutObject( pNewCollection );
+						}
+					}
+				}
+
 				pNewProp->ResetFlag( SBX_NO_BROADCAST );
 				pNewProp->SetParent( this );
 				pProps->PutDirect( pNewProp, i );
 void SbClassData::clear( void )
 {
 	mxIfaces->Clear(); 
+	maRequiredTypes.clear();
 }
 
 SbClassFactory::SbClassFactory( void )
 	return NULL;
 }
 
+
+struct ClassModuleRunInitItem
+{
+	SbModule*		m_pModule;
+	bool			m_bProcessing;
+	bool			m_bRunInitDone;
+	//ModuleVector	m_vModulesDependingOnThisModule;
+
+	ClassModuleRunInitItem( void )
+		: m_pModule( NULL )
+		, m_bProcessing( false )
+		, m_bRunInitDone( false )
+	{}
+	ClassModuleRunInitItem( SbModule* pModule )
+		: m_pModule( pModule )
+		, m_bProcessing( false )
+		, m_bRunInitDone( false )
+	{}
+};
+
+typedef std::hash_map< ::rtl::OUString, ClassModuleRunInitItem,
+	::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInitDependencyMap;
+
+static ModuleInitDependencyMap* GpMIDMap = NULL;
+
+void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem )
+{
+	ModuleInitDependencyMap& rMIDMap = *GpMIDMap;
+
+	rItem.m_bProcessing = true;
+
+	//bool bAnyDependencies = true;
+	SbModule* pModule = rItem.m_pModule;
+	if( pModule->pClassData != NULL )
+	{
+		StringVector& rReqTypes = pModule->pClassData->maRequiredTypes;
+		if( rReqTypes.size() > 0 )
+		{
+			for( StringVector::iterator it = rReqTypes.begin() ; it != rReqTypes.end() ; ++it )
+			{
+				String& rStr = *it;
+
+				// Is required type a class module?
+				ModuleInitDependencyMap::iterator itFind = rMIDMap.find( rStr );
+				if( itFind != rMIDMap.end() )
+				{
+					ClassModuleRunInitItem& rParentItem = itFind->second;
+					if( rParentItem.m_bProcessing )
+					{
+						// TODO: raise error?
+						DBG_ERROR( "Cyclic module dependency detected" );
+						continue;
+					}
+
+					if( !rParentItem.m_bRunInitDone )
+						implProcessModuleRunInit( rParentItem );
+				}
+			}
+		}
+	}
+
+	pModule->RunInit();
+	rItem.m_bRunInitDone = true;
+	rItem.m_bProcessing = false;
+}
+
 // Run Init-Code of all modules (including inserted libraries)
 void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit )
 {
 	// compile modules first then RunInit ( otherwise there is 
 	// can be order dependency, e.g. classmodule A has a member
 	// of of type classmodule B and classmodule B hasn't been compiled yet )
+
+	// Consider required types to init in right order. Class modules
+	// that are required by other modules have to be initialized first.
+	ModuleInitDependencyMap aMIDMap;
+	GpMIDMap = &aMIDMap;
 	for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ )
 	{
 		SbModule* pModule = (SbModule*)pModules->Get( nMod );
-		pModule->RunInit();
+		String aModuleName = pModule->GetName();
+		if( pModule->isProxyModule() )
+			aMIDMap[aModuleName] = ClassModuleRunInitItem( pModule );
+	}
+
+	ModuleInitDependencyMap::iterator it;
+	for( it = aMIDMap.begin() ; it != aMIDMap.end(); ++it )
+	{
+		ClassModuleRunInitItem& rItem = it->second;
+		SbModule::implProcessModuleRunInit( rItem );
+	}
+	GpMIDMap = NULL;
+
+	// Call RunInit on standard modules
+	for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ )
+	{
+		SbModule* pModule = (SbModule*)pModules->Get( nMod );
+		if( !pModule->isProxyModule() )
+			pModule->RunInit();
 	}
 
     // Check all objects if they are BASIC,
 	if( nIndex >= 0 && nIndex < (INT32)xItemArray->Count32() )
 		pRes = xItemArray->Get32( nIndex );
 	if( !pRes )
-		SetError( SbxERR_BAD_INDEX );
+		SetError( SbERR_BAD_ARGUMENT );
 	else
 		*(pPar_->Get(0)) = *pRes;
 }
 	if( nIndex >= 0 && nIndex < (INT32)xItemArray->Count32() )
 		xItemArray->Remove32( nIndex );
 	else
-		SetError( SbxERR_BAD_INDEX );
+		SetError( SbERR_BAD_ARGUMENT );
 }
 

basic/source/classes/sbunoobj.cxx

 #include <com/sun/star/bridge/oleautomation/Date.hpp>
 #include <com/sun/star/bridge/oleautomation/Decimal.hpp>
 #include <com/sun/star/bridge/oleautomation/Currency.hpp>
+#include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
 
 
 using com::sun::star::uno::Reference;
 	SbUnoObject* pUnoObj = NULL;
 	if( xOLEFactory.is() )
 	{
-		Reference< XInterface > xOLEObject = xOLEFactory->createInstance( aType );
+        // some type names available in VBA can not be directly used in COM
+        ::rtl::OUString aOLEType = aType;
+        if ( aOLEType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SAXXMLReader30" ) ) ) )
+            aOLEType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Msxml2.SAXXMLReader.3.0" ) );
+
+		Reference< XInterface > xOLEObject = xOLEFactory->createInstance( aOLEType );
 		if( xOLEObject.is() )
 		{
 			Any aAny;
 			aRetVal.setValue( &c , getCharCppuType() );
 			break;
 		}
-		case TypeClass_STRING:			aRetVal <<= ::rtl::OUString( pVar->GetString() ); break;
+		case TypeClass_STRING:			aRetVal <<= pVar->GetOUString(); break;
 		case TypeClass_FLOAT:			aRetVal <<= pVar->GetSingle(); break;
 		case TypeClass_DOUBLE:			aRetVal <<= pVar->GetDouble(); break;
 		//case TypeClass_OCTET:			break;
 SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
 	: SbxObject( aName_ )
 	, bNeedIntrospection( TRUE )
+	, bIgnoreNativeCOMObjectMembers( FALSE )
 {
 	static Reference< XIntrospection > xIntrospection;
 
 			bNeedIntrospection = FALSE;
 			return;
 		}
+
+		// Ignore introspection based members for COM objects to avoid
+		// hiding of equally named COM symbols, e.g. XInvocation::getValue
+		Reference< oleautomation::XAutomationObject > xAutomationObject( aUnoObj_, UNO_QUERY );
+		if( xAutomationObject.is() )
+			bIgnoreNativeCOMObjectMembers = TRUE;
 	}
 
 	maTmpUnoObj = aUnoObj_;
 	if( !pRes )
 	{
 		::rtl::OUString aUName( rName );
-		if( mxUnoAccess.is() )
+		if( mxUnoAccess.is() && !bIgnoreNativeCOMObjectMembers )
 		{
 			if( mxExactName.is() )
 			{
 
 	// Instrospection besorgen
 	Reference< XIntrospectionAccess > xAccess = mxUnoAccess;
-	if( !xAccess.is() )
+	if( !xAccess.is() || bIgnoreNativeCOMObjectMembers )
 	{
 		if( mxInvocation.is() )
 			xAccess = mxInvocation->getIntrospection();
+		else if( bIgnoreNativeCOMObjectMembers )
+			return;
 	}
 	if( !xAccess.is() )
 		return;

basic/source/comp/codegen.cxx

 		pCLASSFAC->AddClassModule( &rMod );
 
 		nIfaceCount = pParser->aIfaceVector.size();
+		if( !rMod.pClassData )
+			rMod.pClassData = new SbClassData;
 		if( nIfaceCount )
 		{
-			if( !rMod.pClassData )
-				rMod.pClassData = new SbClassData;
-
 			for( int i = 0 ; i < nIfaceCount ; i++ )
 			{
 				const String& rIfaceName = pParser->aIfaceVector[i];
 				pIfaces->Insert( pIfaceVar, pIfaces->Count() );
 			}
 		}
+
+		rMod.pClassData->maRequiredTypes = pParser->aRequiredTypes;
 	}
 	else
 	{
 			rMod.mnType = com::sun::star::script::ModuleType::NORMAL;
 		rMod.bIsProxyModule = false;
 	}
+
 	if( pParser->bText )
 		p->SetFlag( SBIMG_COMPARETEXT );
 	// GlobalCode-Flag
 					if( !pProc->IsPublic() )
 						pMeth->SetFlag( SBX_PRIVATE );
 
+					// Declare? -> Hidden
+					if( pProc->GetLib().Len() > 0 )
+						pMeth->SetFlag( SBX_HIDDEN );
+
 					pMeth->nStart = pProc->GetAddr();
 					pMeth->nLine1 = pProc->GetLine1();
 					pMeth->nLine2 = pProc->GetLine2();

basic/source/comp/dim.cxx

 
 					// In den String-Pool uebernehmen
 					rDef.SetTypeId( aGblStrings.Add( aCompleteName ) );
+
+					if( rDef.IsNew() && pProc == NULL )
+						aRequiredTypes.push_back( aCompleteName );
 				}
 				eType = SbxOBJECT;
 				break;
 			}
 			if( bCompatible && Peek() == PARAMARRAY )
 			{
-				if( bByVal || bByVal || bOptional )
+				if( bByVal || bOptional )
 					Error( SbERR_UNEXPECTED, PARAMARRAY );
 				Next();
 				bParamArray = TRUE;
 	  Error( SbERR_UNEXPECTED, eCurTok );
 	else
 	{
+		bool bFunction = (eCurTok == FUNCTION);
+
 		SbiProcDef* pDef = ProcDecl( TRUE );
 		if( pDef )
 		{
 				aPublics.Add( pDef );
 
 			if ( pDef )
+			{
 				pDef->SetPublic( !bPrivate );
+
+				// New declare handling
+				if( pDef->GetLib().Len() > 0 )
+				{
+					if( bNewGblDefs && nGblChain == 0 )
+					{
+						nGblChain = aGen.Gen( _JUMP, 0 );
+						bNewGblDefs = FALSE;
+					}
+
+					USHORT nSavLine = nLine;
+					aGen.Statement();
+					pDef->Define();
+					pDef->SetLine1( nSavLine );
+					pDef->SetLine2( nSavLine );
+
+					SbiSymPool& rPool = pDef->GetParams();
+					USHORT nParCount = rPool.GetSize();
+
+					SbxDataType eType = pDef->GetType();
+					if( bFunction )
+						aGen.Gen( _PARAM, 0, sal::static_int_cast< UINT16 >( eType ) );
+
+					if( nParCount > 1 )
+					{
+						aGen.Gen( _ARGC );
+
+						for( USHORT i = 1 ; i < nParCount ; ++i )
+						{
+							SbiSymDef* pParDef = rPool.Get( i );
+							SbxDataType eParType = pParDef->GetType();
+
+							aGen.Gen( _PARAM, i, sal::static_int_cast< UINT16 >( eParType ) );
+							aGen.Gen( _ARGV );
+
+							USHORT nTyp = sal::static_int_cast< USHORT >( pParDef->GetType() );
+							if( pParDef->IsByVal() )
+							{
+								// Reset to avoid additional byval in call to wrapper function
+								pParDef->SetByVal( FALSE );
+								nTyp |= 0x8000;
+							}
+							aGen.Gen( _ARGTYP, nTyp );
+						}
+					}
+
+					aGen.Gen( _LIB, aGblStrings.Add( pDef->GetLib() ) );
+
+					SbiOpcode eOp = pDef->IsCdecl() ? _CALLC : _CALL;
+					USHORT nId = pDef->GetId();
+					if( pDef->GetAlias().Len() )
+						nId = ( nId & 0x8000 ) | aGblStrings.Add( pDef->GetAlias() );
+					if( nParCount > 1 )
+						nId |= 0x8000;
+					aGen.Gen( eOp, nId, sal::static_int_cast< UINT16 >( eType ) );
+
+					if( bFunction )
+						aGen.Gen( _PUT );
+
+					aGen.Gen( _LEAVE );
+				}
+			}
 		}
 	}
 }

basic/source/comp/exprgen.cxx

 		}
 		else
 		{
-			SbiProcDef* pProc = aVar.pDef->GetProcDef();
-			// per DECLARE definiert?
-			if( pProc && pProc->GetLib().Len() )
-				eOp = pProc->IsCdecl() ? _CALLC : _CALL;
-			else
-                eOp = ( aVar.pDef->GetScope() == SbRTL ) ? _RTL : 
-                    (aVar.pDef->IsGlobal() ? _FIND_G : _FIND);
+            eOp = ( aVar.pDef->GetScope() == SbRTL ) ? _RTL : 
+                (aVar.pDef->IsGlobal() ? _FIND_G : _FIND);
 		}
 
 		if( eOp == _FIND )
 		aVar.pPar->Gen();
 	}
 		
-	SbiProcDef* pProc = aVar.pDef->GetProcDef();
-	// per DECLARE definiert?
-	if( pProc )
-	{
-		// Dann evtl. einen LIB-Befehl erzeugen
-		if( pProc->GetLib().Len() )
-			pGen->Gen( _LIB, pGen->GetParser()->aGblStrings.Add( pProc->GetLib() ) );
-		// und den Aliasnamen nehmen
-		if( pProc->GetAlias().Len() )
-			nId = ( nId & 0x8000 ) | pGen->GetParser()->aGblStrings.Add( pProc->GetAlias() );
-	}
 	pGen->Gen( eOp, nId, sal::static_int_cast< UINT16 >( GetType() ) );
 
 	if( aVar.pvMorePar )
 	{
 		pParser->aGen.Gen( _ARGC );
 		// AB 10.1.96: Typ-Anpassung bei DECLARE
-		USHORT nCount = 1, nParAnz = 0;
-		SbiSymPool* pPool = NULL;
-		if( pProc )
-		{
-			pPool = &pProc->GetParams();
-			nParAnz = pPool->GetSize();
-		}
+		USHORT nCount = 1 /*, nParAnz = 0*/;
+//		SbiSymPool* pPool = NULL;
 		for( SbiExpression* pExpr = pFirst; pExpr; pExpr = pExpr->pNext,nCount++ )
 		{
 			pExpr->Gen();
 				USHORT nSid = pParser->aGblStrings.Add( pExpr->GetName() );
 				pParser->aGen.Gen( _ARGN, nSid );
 
+				/* TODO: Check after Declare concept change
 				// AB 10.1.96: Typanpassung bei named -> passenden Parameter suchen
 				if( pProc )
 				{
 					pParser->Error( SbERR_NO_NAMED_ARGS );
 
 					// Spaeter, wenn Named Args bei DECLARE moeglich
-					/*
-					for( USHORT i = 1 ; i < nParAnz ; i++ )
-					{
-						SbiSymDef* pDef = pPool->Get( i );
-						const String& rName = pDef->GetName();
-						if( rName.Len() )
-						{
-							if( pExpr->GetName().ICompare( rName )
-								== COMPARE_EQUAL )
-							{
-								pParser->aGen.Gen( _ARGTYP, pDef->GetType() );
-								break;
-							}
-						}
-					}
-					*/
+					//for( USHORT i = 1 ; i < nParAnz ; i++ )
+					//{
+					//	SbiSymDef* pDef = pPool->Get( i );
+					//	const String& rName = pDef->GetName();
+					//	if( rName.Len() )
+					//	{
+					//		if( pExpr->GetName().ICompare( rName )
+					//			== COMPARE_EQUAL )
+					//		{
+					//			pParser->aGen.Gen( _ARGTYP, pDef->GetType() );
+					//			break;
+					//		}
+					//	}
+					//}
 				}
+				*/
 			}
 			else
 			{
 				pParser->aGen.Gen( _ARGV );
-
-				// Funktion mit DECLARE -> Typ-Anpassung
-				if( pProc && nCount < nParAnz )
-				{
-					SbiSymDef* pDef = pPool->Get( nCount );
-					USHORT nTyp = sal::static_int_cast< USHORT >(
-                        pDef->GetType() );
-					// Zus�tzliches Flag f�r BYVAL einbauen
-					if( pDef->IsByVal() )
-						nTyp |= 0x8000;
-					pParser->aGen.Gen( _ARGTYP, nTyp );
-				}
 			}
 		}
 	}

basic/source/comp/exprtree.cxx

 				// damit erwischen wir n% = 5 : print n
 				eType = eDefType;
 		}
-		// Funktion?
-		if( pDef->GetProcDef() )
-		{
-			SbiProcDef* pProc = pDef->GetProcDef();
-			if( pPar && pProc->GetLib().Len() )		// DECLARE benutzt?
-				pPar->SetProc( pProc );
-			// Wenn keine Pars, vorerst nichts machen
-			// Pruefung auf Typ-Anzahl waere denkbar
-		}
 		// Typcheck bei Variablen:
 		// ist explizit im Scanner etwas anderes angegeben?
 		// Bei Methoden ist dies OK!
 {
 	pParser = p;
 	pFirst = NULL;
-	pProc = NULL;
 	nExpr  =
 	nDim   = 0;
 	bError =

basic/source/comp/makefile.mk

 
 .INCLUDE :  settings.mk
 
-CXXFILES= \
-	sbcomp.cxx   \
-    dim.cxx      \
-    exprtree.cxx \
-    exprnode.cxx \
-    exprgen.cxx  \
-    codegen.cxx	 \
-	io.cxx       \
-    loops.cxx    \
-    parser.cxx   \
-    scanner.cxx  \
-    token.cxx    \
-    symtbl.cxx	 \
-    buffer.cxx
-
 SLOFILES= \
-	$(SLO)$/sbcomp.obj		\
+    $(SLO)$/buffer.obj      \
+    $(SLO)$/codegen.obj		\
     $(SLO)$/dim.obj			\
-    $(SLO)$/exprtree.obj		\
-    $(SLO)$/exprnode.obj		\
     $(SLO)$/exprgen.obj		\
-    $(SLO)$/codegen.obj		\
+    $(SLO)$/exprnode.obj	\
+    $(SLO)$/exprtree.obj	\
 	$(SLO)$/io.obj			\
     $(SLO)$/loops.obj		\
     $(SLO)$/parser.obj		\
+	$(SLO)$/sbcomp.obj		\
     $(SLO)$/scanner.obj		\
-    $(SLO)$/token.obj		\
     $(SLO)$/symtbl.obj		\
-    $(SLO)$/buffer.obj
+    $(SLO)$/token.obj
 
 EXCEPTIONSFILES= \
-    $(SLO)$/parser.obj \
-    $(SLO)$/exprtree.obj
+    $(SLO)$/codegen.obj     \
+    $(SLO)$/dim.obj         \
+    $(SLO)$/exprtree.obj    \
+    $(SLO)$/parser.obj
 
 # --- Targets --------------------------------------------------------------
 

basic/source/comp/sbcomp.cxx

 	{
 		aStr.AppendAscii( "Entering " );
 	}
-	String aModuleName = pModule->GetName();
+	String aModuleName = pTraceMod->GetName();
 	aStr += aModuleName;
 	if( pMethod != NULL )
 	{

basic/source/inc/expr.hxx

 protected:
 	SbiParser* pParser;				// Parser
 	SbiExpression* pFirst;          // Expressions
-	SbiProcDef* pProc;				// DECLARE-Funktion (Parameter-Anpassung)
 	short nExpr;                    // Anzahl Expressions
 	short nDim;						// Anzahl Dimensionen
 	BOOL  bError;                   // TRUE: Fehler
 	SbiExpression* Get( short );
 	BOOL  Test( const SbiProcDef& );	// Parameter-Checks
 	void  Gen();                    // Code-Erzeugung
-	// Setzen einer Funktionsdefinition zum Abgleich der Parameter
-	void SetProc( SbiProcDef* p )	{ pProc = p; }
 	void addExpression( SbiExpression* pExpr );
 };
 

basic/source/inc/parser.hxx

 
 
 #include <vector>
-typedef ::std::vector< String > IfaceVector;
+typedef ::std::vector< String > StringVector;
 
 struct SbiParseStack;
 
 	BOOL		  bText;			// OPTION COMPARE TEXT
 	BOOL          bExplicit; 		// TRUE: OPTION EXPLICIT
 	BOOL          bClassModule;		// TRUE: OPTION ClassModule
-	IfaceVector   aIfaceVector;		// Holds all interfaces implemented by a class module
+	StringVector  aIfaceVector;		// Holds all interfaces implemented by a class module
+	StringVector  aRequiredTypes;   // Types used in Dim As New <type> outside subs
 	SbxDataType   eDefTypes[26];	// DEFxxx-Datentypen
 
 	SbiParser( StarBASIC*, SbModule* );

basic/source/inc/sbintern.hxx

 	virtual SbxObject* CreateObject( const String& );
 };
 
+typedef ::std::vector< String > StringVector;
+
 struct SbClassData
 {
 	SbxArrayRef		mxIfaces;
 
+	// types this module depends on because of use in Dim As New <type>
+	// needed for initialization order of class modules
+	StringVector	maRequiredTypes;
+
 	SbClassData( void );
 	~SbClassData( void )
 		{ clear(); }

basic/source/inc/sbunoobj.hxx

 	::com::sun::star::uno::Reference< ::com::sun::star::beans::XExactName > mxExactName;
 	::com::sun::star::uno::Reference< ::com::sun::star::beans::XExactName > mxExactNameInvocation;
 	BOOL bNeedIntrospection;
+	BOOL bIgnoreNativeCOMObjectMembers;
 	::com::sun::star::uno::Any maTmpUnoObj;	// Only to save obj for doIntrospection!
 
 	// Hilfs-Methode zum Anlegen der dbg_-Properties

basic/source/inc/symtbl.hxx

 	void	   SetOptional()   	{ bOpt = TRUE;		}
 	void	   SetParamArray() 	{ bParamArray = TRUE;		}
 	void	   SetWithEvents() 	{ bWithEvents = TRUE;		}
-	void	   SetByVal()		{ bByVal = TRUE;	}
+	void	   SetByVal( BOOL bByVal_ = TRUE )
+				{ bByVal = bByVal_; }
 	void	   SetStatic( BOOL bAsStatic = TRUE )		{ bStatic = bAsStatic;	}
 	void	   SetNew()			{ bNew = TRUE;		}
 	void	   SetDefinedAs()	{ bAs = TRUE;		}

basic/source/runtime/methods1.cxx

 	(void)pBasic;
 	(void)bWrite;
 	(void)rPar;
-    Timer aTimer;
-    aTimer.SetTimeout( 1 );
-    aTimer.Start();
-    while ( aTimer.IsActive() )
-        Application::Yield();
+	// Dummy implementation as the following code leads
+	// to performance problems for unknown reasons
+	//Timer aTimer;
+	//aTimer.SetTimeout( 1 );
+	//aTimer.Start();
+	//while ( aTimer.IsActive() )
+	//	Application::Reschedule();
 }
 
 RTLFUNC(GetGUIVersion)
 }
 
 
-typedef ::std::vector< String > StringVector;
-
 RTLFUNC(Split)
 {
     (void)pBasic;

basic/source/runtime/step0.cxx

 void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, bool bHandleDefaultProp )
 {
 	// #67733 Typen mit Array-Flag sind auch ok
+
+	// Check var, !object is no error for sure if, only if type is fixed
+	SbxDataType eVarType = refVar->GetType();
+	if( !bHandleDefaultProp && eVarType != SbxOBJECT && !(eVarType & SbxARRAY) && refVar->IsFixed() )
+	{
+		Error( SbERR_INVALID_USAGE_OBJECT );
+		return;
+	}
+
+	// Check value, !object is no error for sure if, only if type is fixed
 	SbxDataType eValType = refVal->GetType();
-	SbxDataType eVarType = refVar->GetType();
-        if( (eValType != SbxOBJECT 
-			&& eValType != SbxEMPTY 
-// seems like when using the default method its possible for objects
-// to be empty ( no broadcast has taken place yet ) or the actual value is
+//	bool bGetValObject = false;
+	if( !bHandleDefaultProp && eValType != SbxOBJECT && !(eValType & SbxARRAY) && refVal->IsFixed() )
+	{
+		Error( SbERR_INVALID_USAGE_OBJECT );
+		return;
+	}
 
-			&& !bHandleDefaultProp
-			&& !(eValType & SbxARRAY)) ||
-            (eVarType != SbxOBJECT 
-			&& eVarType != SbxEMPTY 
-			&& !bHandleDefaultProp
-			&& !(eVarType & SbxARRAY) ) )
+	// Getting in here causes problems with objects with default properties
+	// if they are SbxEMPTY I guess
+	if ( !bHandleDefaultProp || ( bHandleDefaultProp && eValType == SbxOBJECT ) )
+	{
+	// Auf refVal GetObject fuer Collections ausloesen
+		SbxBase* pObjVarObj = refVal->GetObject();
+		if( pObjVarObj )
+		{
+			SbxVariableRef refObjVal = PTR_CAST(SbxObject,pObjVarObj);
+
+			// #67733 Typen mit Array-Flag sind auch ok
+			if( refObjVal )
+				refVal = refObjVal;
+			else if( !(eValType & SbxARRAY) )
+				refVal = NULL;
+		}
+	}
+
+	// #52896 Wenn Uno-Sequences bzw. allgemein Arrays einer als
+	// Object deklarierten Variable zugewiesen werden, kann hier
+	// refVal ungueltig sein!
+	if( !refVal )
 	{
 		Error( SbERR_INVALID_USAGE_OBJECT );
 	}
 	else
 	{
-		// Getting in here causes problems with objects with default properties
-		// if they are SbxEMPTY I guess
-		if ( !bHandleDefaultProp || ( bHandleDefaultProp && refVal->GetType() == SbxOBJECT ) )
+		// Store auf die eigene Methode (innerhalb einer Function)?
+		BOOL bFlagsChanged = FALSE;
+		USHORT n = 0;
+		if( (SbxVariable*) refVar == (SbxVariable*) pMeth )
 		{
-		// Auf refVal GetObject fuer Collections ausloesen
-			SbxBase* pObjVarObj = refVal->GetObject();
-			if( pObjVarObj )
+			bFlagsChanged = TRUE;
+			n = refVar->GetFlags();
+			refVar->SetFlag( SBX_WRITE );
+		}
+		SbProcedureProperty* pProcProperty = PTR_CAST(SbProcedureProperty,(SbxVariable*)refVar);
+		if( pProcProperty )
+			pProcProperty->setSet( true );
+
+		if ( bHandleDefaultProp )
+		{
+			// get default properties for lhs & rhs where necessary
+			// SbxVariable* defaultProp = NULL; unused variable
+			bool bLHSHasDefaultProp = false;
+			// LHS try determine if a default prop exists
+			if ( refVar->GetType() == SbxOBJECT )
 			{
-				SbxVariableRef refObjVal = PTR_CAST(SbxObject,pObjVarObj);
+				SbxVariable* pDflt = getDefaultProp( refVar );
+				if ( pDflt )
+				{
+					refVar = pDflt;
+					bLHSHasDefaultProp = true;
+				}
+			}
+			// RHS only get a default prop is the rhs has one
+			if (  refVal->GetType() == SbxOBJECT )
+			{
+				// check if lhs is a null object
+				// if it is then use the object not the default property
+				SbxObject* pObj = NULL;
 
-				// #67733 Typen mit Array-Flag sind auch ok
-				if( refObjVal )
-					refVal = refObjVal;
-				else if( !(eValType & SbxARRAY) )
-					refVal = NULL;
+				
+				pObj = PTR_CAST(SbxObject,(SbxVariable*)refVar);
+
+				// calling GetObject on a SbxEMPTY variable raises
+				// object not set errors, make sure its an Object
+				if ( !pObj && refVar->GetType() == SbxOBJECT )
+				{
+					SbxBase* pObjVarObj = refVar->GetObject();
+					pObj = PTR_CAST(SbxObject,pObjVarObj);
+				}	
+				SbxVariable* pDflt = NULL;
+				if ( pObj || bLHSHasDefaultProp )
+					// lhs is either a valid object || or has a defaultProp
+					pDflt = getDefaultProp( refVal );
+				if ( pDflt )
+					refVal = pDflt;
 			}
-		}
+		}	
+		
+		// Handle withevents
+		BOOL bWithEvents = refVar->IsSet( SBX_WITH_EVENTS );
+        if ( bWithEvents )
+        {
+            Reference< XInterface > xComListener;
 
-		// #52896 Wenn Uno-Sequences bzw. allgemein Arrays einer als
-		// Object deklarierten Variable zugewiesen werden, kann hier
-		// refVal ungueltig sein!
-		if( !refVal )
-		{
-			Error( SbERR_INVALID_USAGE_OBJECT );
-		}
-		else
-		{
-			// Store auf die eigene Methode (innerhalb einer Function)?
-			BOOL bFlagsChanged = FALSE;
-			USHORT n = 0;
-			if( (SbxVariable*) refVar == (SbxVariable*) pMeth )
-			{
-				bFlagsChanged = TRUE;
-				n = refVar->GetFlags();
-				refVar->SetFlag( SBX_WRITE );
-			}
-			SbProcedureProperty* pProcProperty = PTR_CAST(SbProcedureProperty,(SbxVariable*)refVar);
-			if( pProcProperty )
-				pProcProperty->setSet( true );
+            SbxBase* pObj = refVal->GetObject();
+            SbUnoObject* pUnoObj = (pObj != NULL) ? PTR_CAST(SbUnoObject,pObj) : NULL;
+            if( pUnoObj != NULL )
+            {
+                Any aControlAny = pUnoObj->getUnoAny();
+                String aDeclareClassName = refVar->GetDeclareClassName();
+                ::rtl::OUString aVBAType = aDeclareClassName;
+                ::rtl::OUString aPrefix = refVar->GetName();
+                SbxObjectRef xScopeObj = refVar->GetParent();
+                xComListener = createComListener( aControlAny, aVBAType, aPrefix, xScopeObj );
 
-			if ( bHandleDefaultProp )
-			{
-				// get default properties for lhs & rhs where necessary
-				// SbxVariable* defaultProp = NULL; unused variable
-				bool bLHSHasDefaultProp = false;
-				// LHS try determine if a default prop exists
-				if ( refVar->GetType() == SbxOBJECT )
-				{
-					SbxVariable* pDflt = getDefaultProp( refVar );
-					if ( pDflt )
-					{
-						refVar = pDflt;
-						bLHSHasDefaultProp = true;
-					}
-				}
-				// RHS only get a default prop is the rhs has one
-				if (  refVal->GetType() == SbxOBJECT )
-				{
-					// check if lhs is a null object
-					// if it is then use the object not the default property
-					SbxObject* pObj = NULL;
-	
-					
-					pObj = PTR_CAST(SbxObject,(SbxVariable*)refVar);
-
-					// calling GetObject on a SbxEMPTY variable raises
-					// object not set errors, make sure its an Object
-					if ( !pObj && refVar->GetType() == SbxOBJECT )
-					{
-						SbxBase* pObjVarObj = refVar->GetObject();
-						pObj = PTR_CAST(SbxObject,pObjVarObj);
-					}	
-					SbxVariable* pDflt = NULL;
-					if ( pObj || bLHSHasDefaultProp )
-						// lhs is either a valid object || or has a defaultProp
-						pDflt = getDefaultProp( refVal );
-					if ( pDflt )
-						refVal = pDflt;
-				}
-			}	
-			
-			// Handle withevents
-			BOOL bWithEvents = refVar->IsSet( SBX_WITH_EVENTS );
-            if ( bWithEvents )
-            {
-                Reference< XInterface > xComListener;
-
-                SbxBase* pObj = refVal->GetObject();
-                SbUnoObject* pUnoObj = (pObj != NULL) ? PTR_CAST(SbUnoObject,pObj) : NULL;
-                if( pUnoObj != NULL )
-                {
-                    Any aControlAny = pUnoObj->getUnoAny();
-                    String aDeclareClassName = refVar->GetDeclareClassName();
-                    ::rtl::OUString aVBAType = aDeclareClassName;
-                    ::rtl::OUString aPrefix = refVar->GetName();
-                    SbxObjectRef xScopeObj = refVar->GetParent();
-                    xComListener = createComListener( aControlAny, aVBAType, aPrefix, xScopeObj );
-
-                    refVal->SetDeclareClassName( aDeclareClassName );
-                    refVal->SetComListener( xComListener );		// Hold reference
-                }
-
-                *refVar = *refVal;
-            }
-            else
-            {
-                *refVar = *refVal;
+                refVal->SetDeclareClassName( aDeclareClassName );
+                refVal->SetComListener( xComListener );		// Hold reference
             }
 
-			// lhs is a property who's value is currently (Empty e.g. no broadcast yet)
-			// in this case if there is a default prop involved the value of the 
-			// default property may infact be void so the type will also be SbxEMPTY
-			// in this case we do not want to call checkUnoStructCopy 'cause that will
-			// cause an error also
-			if ( !bHandleDefaultProp || ( bHandleDefaultProp && ( refVar->GetType() != SbxEMPTY ) ) )
-			// #67607 Uno-Structs kopieren
-				checkUnoStructCopy( refVal, refVar );
-			if( bFlagsChanged )
-				refVar->SetFlags( n );
-		}
+            *refVar = *refVal;
+        }
+        else
+        {
+            *refVar = *refVal;
+        }
+
+		// lhs is a property who's value is currently (Empty e.g. no broadcast yet)
+		// in this case if there is a default prop involved the value of the 
+		// default property may infact be void so the type will also be SbxEMPTY
+		// in this case we do not want to call checkUnoStructCopy 'cause that will
+		// cause an error also
+		if ( !bHandleDefaultProp || ( bHandleDefaultProp && ( refVar->GetType() != SbxEMPTY ) ) )
+		// #67607 Uno-Structs kopieren
+			checkUnoStructCopy( refVal, refVar );
+		if( bFlagsChanged )
+			refVar->SetFlags( n );
 	}
 }
 

basic/source/sbx/sbxbool.cxx

 		case SbxSTRING:
 		case SbxLPSTR:
 			nRes = SbxFALSE;
-			if( p->pString )
-			{
-				if( p->pString->EqualsIgnoreCaseAscii( SbxRes( STRING_TRUE ) ) )
-					nRes = SbxTRUE;
-				else if( !p->pString->EqualsIgnoreCaseAscii( SbxRes( STRING_FALSE ) ) )
-				{
-					// Jetzt kann es noch in eine Zahl konvertierbar sein
-					BOOL bError = TRUE;
-					double n;
-					SbxDataType t;
-					USHORT nLen = 0;
-					String s( *p->pString );
-					if( ImpScan( s, n, t, &nLen ) == SbxERR_OK )
-					{
-						if( nLen == s.Len() )
-						{
-							bError = FALSE;
-							if( n != 0.0 )
-								nRes = SbxTRUE;
-						}
-					}
-					if( bError )
-						SbxBase::SetError( SbxERR_CONVERSION );
-				}
-			}
+            if ( p->pOUString )
+            {
+                if( p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_TRUE ) ) )
+                    nRes = SbxTRUE;
+                else if( p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_FALSE ) ) )
+                {
+                    // Jetzt kann es noch in eine Zahl konvertierbar sein
+                    BOOL bError = TRUE;
+                    double n;
+                    SbxDataType t;
+                    USHORT nLen = 0;
+                    if( ImpScan( *p->pOUString, n, t, &nLen ) == SbxERR_OK )
+                    {
+                        if( nLen == p->pOUString->getLength() )
+                        {
+                            bError = FALSE;
+                            if( n != 0.0 )
+                                nRes = SbxTRUE;
+                        }
+                    }
+                    if( bError )
+                        SbxBase::SetError( SbxERR_CONVERSION );
+                }
+            }
 			break;
 		case SbxOBJECT:
 		{
 		case SbxBYREF | SbxSTRING:
 		case SbxSTRING:
 		case SbxLPSTR:
-			if( !p->pString )
-				p->pString = new XubString;
-			*p->pString = SbxRes( n ? STRING_TRUE : STRING_FALSE );
+            if ( !p->pOUString )
+                p->pOUString = new ::rtl::OUString( SbxRes( n ? STRING_TRUE : STRING_FALSE ) );
+            else 
+                *p->pOUString = SbxRes( n ? STRING_TRUE : STRING_FALSE );
 			break;
 
 		case SbxOBJECT:

basic/source/sbx/sbxbyte.cxx

 		case SbxBYREF | SbxSTRING:
 		case SbxSTRING:
 		case SbxLPSTR:
-			if( !p->pString )
+			if( !p->pOUString )
 				nRes = 0;
 			else
 			{
 				double d;
 				SbxDataType t;
-				if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
+				if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
 					nRes = 0;
 				else if( d > SbxMAXBYTE )
 				{
 		case SbxBYREF | SbxSTRING:
 		case SbxSTRING:
 		case SbxLPSTR:
-			if( !p->pString )
-				p->pString = new XubString;
-			ImpCvtNum( (double) n, 0, *p->pString );
+			if( !p->pOUString )
+				p->pOUString = new ::rtl::OUString;
+			ImpCvtNum( (double) n, 0, *p->pOUString );
 			break;
 		case SbxOBJECT:
 		{

basic/source/sbx/sbxchar.cxx

 xub_Unicode ImpGetChar( const SbxValues* p )
 {
 	SbxValues aTmp;
-	xub_Unicode nRes;
+	xub_Unicode nRes = 0;
 start:
 	switch( +p->eType )
 	{
 		case SbxBYREF | SbxSTRING:
 		case SbxSTRING:
 		case SbxLPSTR:
-			if( !p->pString )
-				nRes = 0;
-			else
-			{
-				double d;
-				SbxDataType t;
-				if( ImpScan( *p->pString, d, t, NULL ) != SbxERR_OK )
-					nRes = 0;
-				else if( d > SbxMAXCHAR )
-				{
-					SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXCHAR;
-				}
-				else if( d < SbxMINCHAR )
-				{
-					SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMINCHAR;
-				}
-				else
-					nRes = (xub_Unicode) ImpRound( d );
-			}
+            if ( p->pOUString )
+            {
+                double d;
+                SbxDataType t;
+                if( ImpScan( *p->pOUString, d, t, NULL ) != SbxERR_OK )
+                    nRes = 0;
+                else if( d > SbxMAXCHAR )
+                {
+                    SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMAXCHAR;
+                }
+                else if( d < SbxMINCHAR )
+                {
+                    SbxBase::SetError( SbxERR_OVERFLOW ); nRes = SbxMINCHAR;
+                }
+                else
+                    nRes = (xub_Unicode) ImpRound( d );
+            }
 			break;
 		case SbxOBJECT:
 		{
 		case SbxBYREF | SbxSTRING:
 		case SbxSTRING:
 		case SbxLPSTR:
-			if( !p->pString )
-				p->pString = new XubString;
-			*p->pString = n;
+            if ( !p->pOUString )
+                p->pOUString = new ::rtl::OUString( n );
+            else
+                *p->pOUString = ::rtl::OUString( n );
 			break;
 		case SbxOBJECT:
 		{

basic/source/sbx/sbxconv.hxx