summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorAndreas Bregas <ab@openoffice.org>2010-08-11 14:18:10 +0200
committerAndreas Bregas <ab@openoffice.org>2010-08-11 14:18:10 +0200
commit2419889e37a924cef564e363e4931a26cb15e48f (patch)
treefa84c89d1cdce3b2910c2370c4bd64a8b3348387 /basic
parent6f1d21b2d2d239cd6253e7b8b36b2adf6571bfac (diff)
mib18: #163237# Changed error handling in StepSET
Diffstat (limited to 'basic')
-rw-r--r--basic/source/runtime/step0.cxx229
1 files changed, 114 insertions, 115 deletions
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index 112c88bd3b..e0b53ba868 100644
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -431,144 +431,143 @@ void SbiRuntime::StepPUT()
void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, bool bHandleDefaultProp )
{
// #67733 Typen mit Array-Flag sind auch ok
- SbxDataType eValType = refVal->GetType();
+
+ // Check var, !object is no error for sure if, only if type is fixed
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
-
- && !bHandleDefaultProp
- && !(eValType & SbxARRAY)) ||
- (eVarType != SbxOBJECT
- && eVarType != SbxEMPTY
- && !bHandleDefaultProp
- && !(eVarType & SbxARRAY) ) )
+ if( !bHandleDefaultProp && eVarType != SbxOBJECT && !(eVarType & SbxARRAY) && refVar->IsFixed() )
{
Error( SbERR_INVALID_USAGE_OBJECT );
+ return;
}
- else
+
+ // Check value, !object is no error for sure if, only if type is fixed
+ SbxDataType eValType = refVal->GetType();
+ bool bGetValObject = false;
+ if( !bHandleDefaultProp && eValType != SbxOBJECT && !(eValType & SbxARRAY) && refVal->IsFixed() )
+ {
+ Error( SbERR_INVALID_USAGE_OBJECT );
+ return;
+ }
+
+ // Getting in here causes problems with objects with default properties
+ // if they are SbxEMPTY I guess
+ if ( !bHandleDefaultProp || ( bHandleDefaultProp && eValType == SbxOBJECT ) )
{
- // Getting in here causes problems with objects with default properties
- // if they are SbxEMPTY I guess
- if ( !bHandleDefaultProp || ( bHandleDefaultProp && refVal->GetType() == SbxOBJECT ) )
+ // Auf refVal GetObject fuer Collections ausloesen
+ SbxBase* pObjVarObj = refVal->GetObject();
+ if( pObjVarObj )
{
- // Auf refVal GetObject fuer Collections ausloesen
- SbxBase* pObjVarObj = refVal->GetObject();
- if( pObjVarObj )
- {
- SbxVariableRef refObjVal = PTR_CAST(SbxObject,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;
- }
+ // #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 )
+ // #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 )
{
- Error( SbERR_INVALID_USAGE_OBJECT );
+ bFlagsChanged = TRUE;
+ n = refVar->GetFlags();
+ refVar->SetFlag( SBX_WRITE );
}
- 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 );
+ SbProcedureProperty* pProcProperty = PTR_CAST(SbProcedureProperty,(SbxVariable*)refVar);
+ if( pProcProperty )
+ pProcProperty->setSet( true );
- if ( bHandleDefaultProp )
+ 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 )
{
- // 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 )
{
- SbxVariable* pDflt = getDefaultProp( refVar );
- if ( pDflt )
- {
- refVar = pDflt;
- bLHSHasDefaultProp = true;
- }
+ 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 )
+ }
+ // RHS only get a default prop is the rhs has one
+ if ( refVal->GetType() == SbxOBJECT )
{
- Reference< XInterface > xComListener;
+ // check if lhs is a null object
+ // if it is then use the object not the default property
+ SbxObject* pObj = NULL;
- 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
- }
+
+ pObj = PTR_CAST(SbxObject,(SbxVariable*)refVar);
- *refVar = *refVal;
+ // 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;
}
- else
+ }
+
+ // 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 )
{
- *refVar = *refVal;
+ 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
}
- // 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 );
}
}