[Libreoffice-commits] .: basic/source

Noel Power noelp at kemper.freedesktop.org
Fri Mar 9 10:48:43 PST 2012


 basic/source/classes/sbunoobj.cxx |   16 ++++++++++------
 basic/source/inc/sbunoobj.hxx     |    5 +++--
 basic/source/runtime/step1.cxx    |    8 +++++++-
 3 files changed, 20 insertions(+), 9 deletions(-)

New commits:
commit 7dafa7a3b14441c6a27ab051db01f53e2c434f0a
Author: Noel Power <noel.power at novell.com>
Date:   Fri Mar 9 18:44:44 2012 +0000

    fix error comparing a struct vs an uno prop containing a struct fdo#42819
    
    hack to fix the scenario where sometimes we get "Object required" error when comparing an uno property containing a struct with another struct ( if that property is "MAYBEVOID" )

diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 0988d79..9fb8b10 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -2616,6 +2616,7 @@ SbUnoProperty::SbUnoProperty
 (
     const rtl::OUString& aName_,
     SbxDataType eSbxType,
+    SbxDataType eRealSbxType,
     const Property& aUnoProp_,
     sal_Int32 nId_,
     bool bInvocation
@@ -2624,6 +2625,7 @@ SbUnoProperty::SbUnoProperty
     , aUnoProp( aUnoProp_ )
     , nId( nId_ )
     , mbInvocation( bInvocation )
+    , mRealType( eRealSbxType )
 {
     // as needed establish an dummy array so that SbiRuntime::CheckArray() works
     static SbxArrayRef xDummyArray = new SbxArray( SbxVARIANT );
@@ -2670,8 +2672,9 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
                 else
                     eSbxType = unoToSbxType( rProp.Type.getTypeClass() );
 
+                SbxDataType eRealSbxType = ( ( rProp.Attributes & PropertyAttribute::MAYBEVOID ) ? unoToSbxType( rProp.Type.getTypeClass() ) : eSbxType );
                 // create the property and superimpose it
-                SbxVariableRef xVarRef = new SbUnoProperty( rProp.Name, eSbxType, rProp, 0, false );
+                SbxVariableRef xVarRef = new SbUnoProperty( rProp.Name, eSbxType, eRealSbxType, rProp, 0, false );
                 QuickInsert( (SbxVariable*)xVarRef );
                 pRes = xVarRef;
             }
@@ -2740,7 +2743,7 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
                 if( mxInvocation->hasProperty( aUName ) )
                 {
                     // create a property and superimpose it
-                    SbxVariableRef xVarRef = new SbUnoProperty( aUName, SbxVARIANT, aDummyProp, 0, true );
+                    SbxVariableRef xVarRef = new SbUnoProperty( aUName, SbxVARIANT, SbxVARIANT, aDummyProp, 0, true );
                     QuickInsert( (SbxVariable*)xVarRef );
                     pRes = xVarRef;
                 }
@@ -2799,15 +2802,15 @@ void SbUnoObject::implCreateDbgProperties( void )
     Property aProp;
 
     // Id == -1: display the implemented interfaces corresponding the ClassProvider
-    SbxVariableRef xVarRef = new SbUnoProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ID_DBG_SUPPORTEDINTERFACES)), SbxSTRING, aProp, -1, false );
+    SbxVariableRef xVarRef = new SbUnoProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ID_DBG_SUPPORTEDINTERFACES)), SbxSTRING, SbxSTRING, aProp, -1, false );
     QuickInsert( (SbxVariable*)xVarRef );
 
     // Id == -2: output the properties
-    xVarRef = new SbUnoProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ID_DBG_PROPERTIES)), SbxSTRING, aProp, -2, false );
+    xVarRef = new SbUnoProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ID_DBG_PROPERTIES)), SbxSTRING, SbxSTRING, aProp, -2, false );
     QuickInsert( (SbxVariable*)xVarRef );
 
     // Id == -3: output the Methods
-    xVarRef = new SbUnoProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ID_DBG_METHODS)), SbxSTRING, aProp, -3, false );
+    xVarRef = new SbUnoProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ID_DBG_METHODS)), SbxSTRING, SbxSTRING, aProp, -3, false );
     QuickInsert( (SbxVariable*)xVarRef );
 }
 
@@ -2848,8 +2851,9 @@ void SbUnoObject::implCreateAll( void )
         else
             eSbxType = unoToSbxType( rProp.Type.getTypeClass() );
 
+        SbxDataType eRealSbxType = ( ( rProp.Attributes & PropertyAttribute::MAYBEVOID ) ? unoToSbxType( rProp.Type.getTypeClass() ) : eSbxType );
         // Create property and superimpose it
-        SbxVariableRef xVarRef = new SbUnoProperty( rProp.Name, eSbxType, rProp, i, false );
+        SbxVariableRef xVarRef = new SbUnoProperty( rProp.Name, eSbxType, eRealSbxType, rProp, i, false );
         QuickInsert( (SbxVariable*)xVarRef );
     }
 
diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx
index 5e833c2..f27e99a 100644
--- a/basic/source/inc/sbunoobj.hxx
+++ b/basic/source/inc/sbunoobj.hxx
@@ -138,15 +138,16 @@ class SbUnoProperty : public SbxProperty
     sal_Int32 nId;
 
     bool mbInvocation;      // Property is based on invocation
-
+    SbxDataType mRealType;
     virtual ~SbUnoProperty();
 public:
     TYPEINFO();
-    SbUnoProperty( const rtl::OUString& aName_, SbxDataType eSbxType,
+    SbUnoProperty( const rtl::OUString& aName_, SbxDataType eSbxType, SbxDataType eRealSbxType,
         const ::com::sun::star::beans::Property& aUnoProp_, sal_Int32 nId_, bool bInvocation );
 
     bool isInvocationBased( void )
         { return mbInvocation; }
+    SbxDataType getRealType() { return mRealType; }
 };
 
 // factory class to create uno-structs per DIM AS NEW
diff --git a/basic/source/runtime/step1.cxx b/basic/source/runtime/step1.cxx
index d90d8aa..a598997 100644
--- a/basic/source/runtime/step1.cxx
+++ b/basic/source/runtime/step1.cxx
@@ -459,10 +459,16 @@ bool SbiRuntime::checkClass_Impl( const SbxVariableRef& refVal,
     bool bOk = bDefault;
 
     SbxDataType t = refVal->GetType();
+    SbxVariable* pVal = (SbxVariable*)refVal;
+    // we don't know the type of uno properties that are (maybevoid)
+    if ( t == SbxEMPTY && refVal->ISA(SbUnoProperty) )
+    {
+        SbUnoProperty* pProp = (SbUnoProperty*)pVal;
+        t = pProp->getRealType();
+    }
     if( t == SbxOBJECT )
     {
         SbxObject* pObj;
-        SbxVariable* pVal = (SbxVariable*)refVal;
         if( pVal->IsA( TYPE(SbxObject) ) )
             pObj = (SbxObject*) pVal;
         else


More information about the Libreoffice-commits mailing list