summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Power <noel.power@novell.com>2012-03-09 18:44:44 +0000
committerNoel Power <noel.power@novell.com>2012-03-09 18:48:36 +0000
commit7dafa7a3b14441c6a27ab051db01f53e2c434f0a (patch)
tree5020ac048737dada2d26b414279eead7b9781721
parentbee742eb7a0d5dfe23e61d9ee49a29286de90256 (diff)
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" )
-rw-r--r--basic/source/classes/sbunoobj.cxx16
-rw-r--r--basic/source/inc/sbunoobj.hxx5
-rw-r--r--basic/source/runtime/step1.cxx8
3 files changed, 20 insertions, 9 deletions
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 0988d7941276..9fb8b1030da3 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 5e833c26795d..f27e99a272ed 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 d90d8aa79379..a598997b3540 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