diff options
author | Noel Power <noel.power@suse.com> | 2013-02-08 11:09:44 +0000 |
---|---|---|
committer | Noel Power <noel.power@suse.com> | 2013-02-11 12:23:38 +0000 |
commit | 6865445a5ec90b49c5fde58531def4b9a64f26e8 (patch) | |
tree | 0c5470eafd7b72063c2d0ea29e3209048132d650 /basic/source | |
parent | 324709b6e3f6529924043b0cb2aa995478372ec3 (diff) |
fix basic access to nested uno structures fdo#60117
Although basic might appear to correctly change nested struct elements
fdo#60117 shows that basic can be fooled ( and even the watch(ed) variable
in the debugger shows the expected values ). The problem stems from the
fact that the uno object held by basic isn't infact modified when changed
via the introspection uno service.
Additionally pimp the existing tests to check the actual uno struct to see
if the changes made are *really* reflected in the object
Change-Id: Iff007e17df87148ea81e69d3567c8cf9857fdcaa
Diffstat (limited to 'basic/source')
-rw-r--r-- | basic/source/classes/sbunoobj.cxx | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index e5ec362a66a9..d773965b5c38 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -2100,18 +2100,27 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, { try { - if ( pProp->isUnoStruct() && maStructInfo.get() ) + if ( maStructInfo.get() ) { - StructRefInfo aMemberStruct = maStructInfo->getStructMember( pProp->GetName() ); - if ( aMemberStruct.isEmpty() ) + StructRefInfo aMember = maStructInfo->getStructMember( pProp->GetName() ); + if ( aMember.isEmpty() ) { StarBASIC::Error( SbERR_PROPERTY_NOT_FOUND ); } else { - SbUnoStructRefObject* pSbUnoObject = new SbUnoStructRefObject( pProp->GetName(), aMemberStruct ); - SbxObjectRef xWrapper = (SbxObject*)pSbUnoObject; - pVar->PutObject( xWrapper ); + if ( pProp->isUnoStruct() ) + { + SbUnoStructRefObject* pSbUnoObject = new SbUnoStructRefObject( pProp->GetName(), aMember ); + SbxObjectRef xWrapper = (SbxObject*)pSbUnoObject; + pVar->PutObject( xWrapper ); + } + else + { + Any aRetAny = aMember.getValue(); + // take over the value from Uno to Sbx + unoToSbxValue( pVar, aRetAny ); + } return; } } @@ -2168,7 +2177,20 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, StarBASIC::Error( SbERR_PROP_READONLY ); return; } - + if ( maStructInfo.get() ) + { + StructRefInfo aMember = maStructInfo->getStructMember( pProp->GetName() ); + if ( aMember.isEmpty() ) + { + StarBASIC::Error( SbERR_PROPERTY_NOT_FOUND ); + } + else + { + Any aAnyValue = sbxToUnoValue( pVar, pProp->aUnoProp.Type, &pProp->aUnoProp ); + aMember.setValue( aAnyValue ); + } + return; + } // take over the value from Uno to Sbx Any aAnyValue = sbxToUnoValue( pVar, pProp->aUnoProp.Type, &pProp->aUnoProp ); try @@ -2875,7 +2897,9 @@ Any SbUnoObject::getUnoAny( void ) { Any aRetAny; if( bNeedIntrospection ) doIntrospection(); - if( mxMaterialHolder.is() ) + if ( maStructInfo.get() ) + aRetAny = maTmpUnoObj; + else if( mxMaterialHolder.is() ) aRetAny = mxMaterialHolder->getMaterial(); else if( mxInvocation.is() ) aRetAny <<= mxInvocation; |