summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Bregas <ab@openoffice.org>2010-09-08 16:34:55 +0200
committerAndreas Bregas <ab@openoffice.org>2010-09-08 16:34:55 +0200
commitb5e8ee7b05c4703cb8bc3b6f6556c8497b51d660 (patch)
treea5e2cc9e44aa8222fb886649d4d28e17f6e74a96
parentd4aca024ba8ff204cebe7e917064d8b204a3795b (diff)
mib19: #163573# NativeObjectWrapper implementation (deactivated)
-rwxr-xr-xbasic/source/classes/sbunoobj.cxx63
-rwxr-xr-xbasic/source/classes/sbxmod.cxx2
-rw-r--r--basic/source/inc/sbunoobj.hxx3
3 files changed, 68 insertions, 0 deletions
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 5227f78566c6..09fdb7dc70bf 100755
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -47,6 +47,7 @@
#include <rtl/strbuf.hxx>
#include <com/sun/star/script/ArrayWrapper.hpp>
+#include <com/sun/star/script/NativeObjectWrapper.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/uno/DeploymentException.hpp>
@@ -514,6 +515,44 @@ static void implHandleAnyException( const Any& _rCaughtException )
}
}
+
+// NativeObjectWrapper handling
+struct ObjectItem
+{
+ SbxObjectRef m_xNativeObj;
+
+ ObjectItem( void )
+ {}
+ ObjectItem( SbxObject* pNativeObj )
+ : m_xNativeObj( pNativeObj )
+ {}
+};
+static std::vector< ObjectItem > GaNativeObjectWrapperVector;
+
+void clearNativeObjectWrapperVector( void )
+{
+ GaNativeObjectWrapperVector.clear();
+}
+
+sal_uInt32 lcl_registerNativeObjectWrapper( SbxObject* pNativeObj )
+{
+ sal_uInt32 nIndex = GaNativeObjectWrapperVector.size();
+ GaNativeObjectWrapperVector.push_back( ObjectItem( pNativeObj ) );
+ return nIndex;
+}
+
+SbxObject* lcl_getNativeObject( sal_uInt32 nIndex )
+{
+ SbxObjectRef xRetObj;
+ if( nIndex < GaNativeObjectWrapperVector.size() )
+ {
+ ObjectItem& rItem = GaNativeObjectWrapperVector[ nIndex ];
+ xRetObj = rItem.m_xNativeObj;
+ }
+ return xRetObj;
+}
+
+
// Von Uno nach Sbx wandeln
SbxDataType unoToSbxType( TypeClass eType )
{
@@ -700,6 +739,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
if( eTypeClass == TypeClass_STRUCT )
{
ArrayWrapper aWrap;
+ //NativeObjectWrapper aNativeObjectWrapper;
if ( (aValue >>= aWrap) )
{
SbxDimArray* pArray = NULL;
@@ -719,6 +759,15 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
pVar->PutEmpty();
break;
}
+ //else if ( (aValue >>= aNativeObjectWrapper) )
+ //{
+ // sal_uInt32 nIndex;
+ // if( (aNativeObjectWrapper.ObjectId >>= nIndex) )
+ // {
+ // SbxObject* pObj = lcl_getNativeObject( nIndex );
+ // pVar->PutObject( pObj );
+ // }
+ //}
else
{
SbiInstance* pInst = pINST;
@@ -1095,6 +1144,20 @@ Any sbxToUnoValueImpl( SbxVariable* pVar, bool bBlockConversionToSmallestType =
if( pClassModule->createCOMWrapperForIface( aRetAny, pClassModuleObj ) )
return aRetAny;
}
+ //if( !xObj->ISA(SbUnoObject) )
+ //{
+ // // Create NativeObjectWrapper to identify object in case of callbacks
+ // SbxObject* pObj = PTR_CAST(SbxObject,pVar->GetObject());
+ // if( pObj != NULL )
+ // {
+ // NativeObjectWrapper aNativeObjectWrapper;
+ // sal_uInt32 nIndex = lcl_registerNativeObjectWrapper( pObj );
+ // aNativeObjectWrapper.ObjectId <<= nIndex;
+ // Any aRetAny;
+ // aRetAny <<= aNativeObjectWrapper;
+ // return aRetAny;
+ // }
+ //}
}
}
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index c324e3db1f50..daeb1707b974 100755
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -1180,6 +1180,8 @@ USHORT SbModule::Run( SbMethod* pMeth )
// beim Programm-Ende freigeben, damit nichts gehalten wird.
ClearUnoObjectsInRTL_Impl( xBasic );
+ clearNativeObjectWrapperVector();
+
DBG_ASSERT(pINST->nCallLvl==0,"BASIC-Call-Level > 0");
delete pINST, pINST = NULL, bDelInst = FALSE;
diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx
index d576db0ddab8..8fc4d06a2796 100644
--- a/basic/source/inc/sbunoobj.hxx
+++ b/basic/source/inc/sbunoobj.hxx
@@ -296,6 +296,9 @@ void RTL_Impl_IsUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
+void disposeComVariablesForBasic( StarBASIC* pBasic );
+void clearNativeObjectWrapperVector( void );
+
//========================================================================
// #118116 Collection object