summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorJacek Fraczek <fraczek.jacek@gmail.com>2016-10-05 22:00:51 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-10-10 08:48:30 +0000
commitf004aa99514d385f3ee254bba735f5eaeb7d9ad8 (patch)
treeaacd5792f553b8e9cbf029cc7e0797ed0dd423fe /basic
parent728c7327bd97602a38723553ed044ea4c01d13b2 (diff)
tdf#89307: Removed SvRef::operator T*()
Conditional statements are using SvRef::Is() method. Changed static_cast<T*>(svRef<T>) occurances to svRef.get(). Added operator == and != to SvRef. SbxObject::Execute is using SbxVariableRef internally. SbxObject::FindQualified is using SbxVariableRef internally. Change-Id: I45b553e35d8fca9bf71163e6eefc60802a066395 Reviewed-on: https://gerrit.libreoffice.org/29621 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'basic')
-rw-r--r--basic/qa/cppunit/basic_coverage.cxx2
-rw-r--r--basic/qa/cppunit/basictest.cxx6
-rw-r--r--basic/qa/cppunit/test_nested_struct.cxx10
-rw-r--r--basic/qa/cppunit/test_vba.cxx8
-rw-r--r--basic/source/basmgr/basmgr.cxx24
-rw-r--r--basic/source/classes/errobject.cxx3
-rw-r--r--basic/source/classes/eventatt.cxx21
-rw-r--r--basic/source/classes/image.cxx2
-rw-r--r--basic/source/classes/sb.cxx23
-rw-r--r--basic/source/classes/sbunoobj.cxx154
-rw-r--r--basic/source/classes/sbxmod.cxx54
-rw-r--r--basic/source/comp/codegen.cxx2
-rw-r--r--basic/source/runtime/methods.cxx14
-rw-r--r--basic/source/runtime/methods1.cxx4
-rw-r--r--basic/source/runtime/props.cxx2
-rw-r--r--basic/source/runtime/runtime.cxx113
-rw-r--r--basic/source/sbx/sbxarray.cxx22
-rw-r--r--basic/source/sbx/sbxexec.cxx24
-rw-r--r--basic/source/sbx/sbxobj.cxx61
-rw-r--r--basic/source/sbx/sbxvar.cxx8
20 files changed, 278 insertions, 279 deletions
diff --git a/basic/qa/cppunit/basic_coverage.cxx b/basic/qa/cppunit/basic_coverage.cxx
index 34f6ae3e729b..17612c4f749c 100644
--- a/basic/qa/cppunit/basic_coverage.cxx
+++ b/basic/qa/cppunit/basic_coverage.cxx
@@ -77,7 +77,7 @@ void Coverage::run_test(const OUString& sFileURL)
if( !testMacro.HasError() )
{
SbxVariableRef pResult = testMacro.Run();
- if( pResult && pResult->GetInteger() == 1 )
+ if( pResult.Is() && pResult->GetInteger() == 1 )
{
bResult = true;
}
diff --git a/basic/qa/cppunit/basictest.cxx b/basic/qa/cppunit/basictest.cxx
index 7b5aa22a1927..2c4e86f0ea17 100644
--- a/basic/qa/cppunit/basictest.cxx
+++ b/basic/qa/cppunit/basictest.cxx
@@ -78,7 +78,7 @@ SbxVariableRef MacroSnippet::Run( const css::uno::Sequence< css::uno::Any >& rAr
SbxVariableRef pReturn = nullptr;
if ( !Compile() )
return pReturn;
- SbMethod* pMeth = mpMod ? static_cast<SbMethod*>(mpMod->Find( "doUnitTest", SbxClassType::Method )) : nullptr;
+ SbMethod* pMeth = mpMod.Is() ? static_cast<SbMethod*>(mpMod->Find( "doUnitTest", SbxClassType::Method )) : nullptr;
if ( pMeth )
{
if ( rArgs.getLength() )
@@ -90,7 +90,7 @@ SbxVariableRef MacroSnippet::Run( const css::uno::Sequence< css::uno::Any >& rAr
unoToSbxValue( pVar, rArgs[ i ] );
aArgs->Put( pVar, i + 1 );
}
- pMeth->SetParameters( aArgs );
+ pMeth->SetParameters( aArgs.get() );
}
pReturn = new SbxMethod( *static_cast<SbxMethod*>(pMeth));
}
@@ -105,7 +105,7 @@ SbxVariableRef MacroSnippet::Run()
bool MacroSnippet::Compile()
{
- CPPUNIT_ASSERT_MESSAGE("module is NULL", mpMod != nullptr );
+ CPPUNIT_ASSERT_MESSAGE("module is NULL", mpMod.get() != nullptr );
mpMod->Compile();
return !mbError;
}
diff --git a/basic/qa/cppunit/test_nested_struct.cxx b/basic/qa/cppunit/test_nested_struct.cxx
index 2fc06005072e..b1f060d8f152 100644
--- a/basic/qa/cppunit/test_nested_struct.cxx
+++ b/basic/qa/cppunit/test_nested_struct.cxx
@@ -182,7 +182,7 @@ void Nested_Struct::testAssign1Alt()
myMacro.Compile();
CPPUNIT_ASSERT_MESSAGE("testAssign1Alt fails with compile error",!myMacro.HasError() );
SbxVariableRef pNew = myMacro.Run();
- uno::Any aRet = sbxToUnoValue( pNew );
+ uno::Any aRet = sbxToUnoValue( pNew.get() );
table::TableBorder aBorder;
aRet >>= aBorder;
@@ -205,7 +205,7 @@ void Nested_Struct::testOldAssignAlt()
myMacro.Compile();
CPPUNIT_ASSERT_MESSAGE("testOldAssign fails with compile error",!myMacro.HasError() );
SbxVariableRef pNew = myMacro.Run();
- uno::Any aRet = sbxToUnoValue( pNew );
+ uno::Any aRet = sbxToUnoValue( pNew.get() );
table::TableBorder aBorder;
aRet >>= aBorder;
@@ -229,7 +229,7 @@ void Nested_Struct::testUnfixedVarAssignAlt()
myMacro.Compile();
CPPUNIT_ASSERT_MESSAGE("testUnfixedVarAssignAlt fails with compile error",!myMacro.HasError() );
SbxVariableRef pNew = myMacro.Run();
- uno::Any aRet = sbxToUnoValue( pNew );
+ uno::Any aRet = sbxToUnoValue( pNew.get() );
uno::Sequence< uno::Any > aResult;
bool bRes = aRet >>= aResult;
@@ -265,7 +265,7 @@ void Nested_Struct::testFixedVarAssignAlt()
myMacro.Compile();
CPPUNIT_ASSERT_MESSAGE("testFixedVarAssignAlt fails with compile error",!myMacro.HasError() );
SbxVariableRef pNew = myMacro.Run();
- uno::Any aRet = sbxToUnoValue( pNew );
+ uno::Any aRet = sbxToUnoValue( pNew.get() );
uno::Sequence< uno::Any > aResult;
bool bRes = aRet >>= aResult;
@@ -292,7 +292,7 @@ void Nested_Struct::testUnoAccess()
myMacro.Compile();
CPPUNIT_ASSERT_MESSAGE("testUnoAccess fails with compile error",!myMacro.HasError() );
SbxVariableRef pNew = myMacro.Run();
- uno::Any aRet = sbxToUnoValue( pNew );
+ uno::Any aRet = sbxToUnoValue( pNew.get() );
awt::WindowDescriptor aWinDesc;
aRet >>= aWinDesc;
diff --git a/basic/qa/cppunit/test_vba.cxx b/basic/qa/cppunit/test_vba.cxx
index 7673f85e1e29..40ed2253330b 100644
--- a/basic/qa/cppunit/test_vba.cxx
+++ b/basic/qa/cppunit/test_vba.cxx
@@ -75,12 +75,12 @@ void VBATest::testMiscVBAFunctions()
MacroSnippet myMacro;
myMacro.LoadSourceFromFile( sMacroURL );
SbxVariableRef pReturn = myMacro.Run();
- if ( pReturn )
+ if ( pReturn.Is() )
{
fprintf(stderr, "macro result for %s\n", macroSource[ i ] );
fprintf(stderr, "macro returned:\n%s\n", OUStringToOString( pReturn->GetOUString(), RTL_TEXTENCODING_UTF8 ).getStr() );
}
- CPPUNIT_ASSERT_MESSAGE("No return variable huh?", pReturn != nullptr );
+ CPPUNIT_ASSERT_MESSAGE("No return variable huh?", pReturn.get() != nullptr );
CPPUNIT_ASSERT_EQUAL_MESSAGE("Result not as expected", OUString("OK"), pReturn->GetOUString() );
}
}
@@ -146,12 +146,12 @@ void VBATest::testMiscOLEStuff()
MacroSnippet myMacro;
myMacro.LoadSourceFromFile( sMacroURL );
SbxVariableRef pReturn = myMacro.Run( aArgs );
- if ( pReturn )
+ if ( pReturn.Is() )
{
fprintf(stderr, "macro result for %s\n", macroSource[ i ] );
fprintf(stderr, "macro returned:\n%s\n", OUStringToOString( pReturn->GetOUString(), RTL_TEXTENCODING_UTF8 ).getStr() );
}
- CPPUNIT_ASSERT_MESSAGE("No return variable huh?", pReturn != NULL );
+ CPPUNIT_ASSERT_MESSAGE("No return variable huh?", pReturn.get() != NULL );
CPPUNIT_ASSERT_MESSAGE("Result not as expected", pReturn->GetOUString() == "OK" );
}
#else
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 66e16c5b5a5e..37bf1aaf048b 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -599,12 +599,12 @@ void BasicManager::SetLibraryContainerInfo( const LibraryContainerInfo& rInfo )
// No libs? Maybe an 5.2 document already loaded
for (auto const& rpBasLibInfo : mpImpl->aLibs)
{
- StarBASIC* pLib = rpBasLibInfo->GetLib();
+ StarBASIC* pLib = rpBasLibInfo->GetLib().get();
if( !pLib )
{
bool bLoaded = ImpLoadLibrary( rpBasLibInfo.get(), nullptr );
if( bLoaded )
- pLib = rpBasLibInfo->GetLib();
+ pLib = rpBasLibInfo->GetLib().get();
}
if( pLib )
{
@@ -973,7 +973,7 @@ bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStora
pLibInfo->SetPassword( aPassword );
}
xBasicStream->SetCryptMaskKey(OString());
- CheckModules( pLibInfo->GetLib(), pLibInfo->IsReference() );
+ CheckModules( pLibInfo->GetLib().get(), pLibInfo->IsReference() );
}
return bLoaded;
}
@@ -1013,7 +1013,7 @@ bool BasicManager::ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) con
{
if( nullptr != dynamic_cast<const StarBASIC*>( &xNew ) )
{
- StarBASIC* pNew = static_cast<StarBASIC*>(static_cast<SbxBase*>(xNew));
+ StarBASIC* pNew = static_cast<StarBASIC*>(xNew.get());
// Use the Parent of the old BASICs
if( rOldBasic.Is() )
{
@@ -1050,7 +1050,7 @@ void BasicManager::CheckModules( StarBASIC* pLib, bool bReference )
for ( const auto& pModule: pLib->GetModules() )
{
- DBG_ASSERT( pModule, "Module not received!" );
+ DBG_ASSERT( pModule.get(), "Module not received!" );
if ( !pModule->IsCompiled() && !StarBASIC::GetErrorCode() )
{
pModule->Compile();
@@ -1212,7 +1212,7 @@ bool BasicManager::RemoveLib( sal_uInt16 nLib, bool bDelBasicFromStorage )
}
if ((*itLibInfo)->GetLib().Is())
{
- GetStdLib()->Remove( (*itLibInfo)->GetLib() );
+ GetStdLib()->Remove( (*itLibInfo)->GetLib().get() );
}
mpImpl->aLibs.erase(itLibInfo);
return true; // Remove was successful, del unimportant
@@ -1228,7 +1228,7 @@ StarBASIC* BasicManager::GetLib( sal_uInt16 nLib ) const
DBG_ASSERT( nLib < mpImpl->aLibs.size(), "Lib does not exist!" );
if ( nLib < mpImpl->aLibs.size() )
{
- return mpImpl->aLibs[nLib]->GetLib();
+ return mpImpl->aLibs[nLib]->GetLib().get();
}
return nullptr;
}
@@ -1245,7 +1245,7 @@ StarBASIC* BasicManager::GetLib( const OUString& rName ) const
{
if (rpLib->GetLibName().equalsIgnoreAsciiCase(rName)) // Check if available...
{
- return rpLib->GetLib();
+ return rpLib->GetLib().get();
}
}
return nullptr;
@@ -1331,7 +1331,7 @@ StarBASIC* BasicManager::CreateLib( const OUString& rLibName )
pLibInfo->SetLib( pNew );
pLibInfo->SetLibName( rLibName );
pLibInfo->GetLib()->SetName( rLibName );
- return pLibInfo->GetLib();
+ return pLibInfo->GetLib().get();
}
// For XML import/export:
@@ -1395,7 +1395,7 @@ BasicLibInfo* BasicManager::FindLibInfo( StarBASIC* pBasic )
{
for (auto const& rpLib : mpImpl->aLibs)
{
- if (rpLib->GetLib() == pBasic)
+ if (rpLib->GetLib().get() == pBasic)
{
return rpLib.get();
}
@@ -1443,7 +1443,7 @@ uno::Any BasicManager::SetGlobalUNOConstant( const OUString& rName, const uno::A
SbxObjectRef xUnoObj = GetSbUnoObject( rName, _rValue );
xUnoObj->SetFlag( SbxFlagBits::DontStore );
- pStandardLib->Insert( xUnoObj );
+ pStandardLib->Insert( xUnoObj.get() );
return aOldValue;
}
@@ -1992,7 +1992,7 @@ void DialogContainer_Impl::insertByName( const OUString& aName, const uno::Any&
uno::Reference< script::XStarBasicDialogInfo > xMod;
aElement >>= xMod;
SbxObjectRef xDialog = implCreateDialog( xMod->getData() );
- mpLib->Insert( xDialog );
+ mpLib->Insert( xDialog.get() );
}
void DialogContainer_Impl::removeByName( const OUString& Name )
diff --git a/basic/source/classes/errobject.cxx b/basic/source/classes/errobject.cxx
index 23914649a187..ddeb1aee585b 100644
--- a/basic/source/classes/errobject.cxx
+++ b/basic/source/classes/errobject.cxx
@@ -192,8 +192,7 @@ SbxErrObject::~SbxErrObject()
uno::Reference< vba::XErrObject > const &
SbxErrObject::getUnoErrObject()
{
- SbxVariable* pVar = getErrObject();
- SbxErrObject* pGlobErr = static_cast< SbxErrObject* >( pVar );
+ SbxErrObject* pGlobErr = static_cast< SbxErrObject* >( getErrObject().get() );
return pGlobErr->m_xErr;
}
diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx
index c89e3523f9a7..a90adf8bd385 100644
--- a/basic/source/classes/eventatt.cxx
+++ b/basic/source/classes/eventatt.cxx
@@ -208,7 +208,7 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any
aMacro = aMacro.copy( nLast );
}
- SbxObject* p = maBasicRef;
+ SbxObject* p = maBasicRef.get();
SbxObject* pParent = p->GetParent();
SbxObject* pParentParent = pParent ? pParent->GetParent() : nullptr;
@@ -253,14 +253,13 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any
// Be still tolerant and make default search if no search basic exists
if( bSearchLib && xLibSearchBasic.Is() )
{
- StarBASICRef xLibBasic;
sal_Int16 nCount = xLibSearchBasic->GetObjects()->Count();
for( sal_Int16 nObj = -1; nObj < nCount ; nObj++ )
{
StarBASIC* pBasic;
if( nObj == -1 )
{
- pBasic = static_cast<StarBASIC*>(xLibSearchBasic);
+ pBasic = xLibSearchBasic.get();
}
else
{
@@ -303,8 +302,8 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any
for( sal_Int32 i = 0; i < nCnt; i++ )
{
SbxVariableRef xVar = new SbxVariable( SbxVARIANT );
- unoToSbxValue( static_cast<SbxVariable*>(xVar), pArgs[i] );
- xArray->Put( xVar, sal::static_int_cast< sal_uInt16 >(i+1) );
+ unoToSbxValue( xVar.get(), pArgs[i] );
+ xArray->Put( xVar.get(), sal::static_int_cast< sal_uInt16 >(i+1) );
}
}
@@ -312,12 +311,12 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any
SbxVariableRef xValue = pRet ? new SbxVariable : nullptr;
if( xArray.Is() )
{
- pMeth->SetParameters( xArray );
+ pMeth->SetParameters( xArray.get() );
}
- pMeth->Call( xValue );
+ pMeth->Call( xValue.get() );
if( pRet )
{
- *pRet = sbxToUnoValue( xValue );
+ *pRet = sbxToUnoValue( xValue.get() );
}
pMeth->SetParameters( nullptr );
}
@@ -432,12 +431,12 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )
// Get dialog
SbxBaseRef pObj = rPar.Get( 1 )->GetObject();
- if( !(pObj && nullptr != dynamic_cast<const SbUnoObject*>( &pObj )) )
+ if( !(pObj.Is() && nullptr != dynamic_cast<const SbUnoObject*>( &pObj )) )
{
StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
return;
}
- SbUnoObject* pUnoObj = static_cast<SbUnoObject*>(static_cast<SbxBase*>(pObj));
+ SbUnoObject* pUnoObj = static_cast<SbUnoObject*>(pObj.get());
Any aAnyISP = pUnoObj->getUnoAny();
TypeClass eType = aAnyISP.getValueType().getTypeClass();
@@ -556,7 +555,7 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )
Any aRetVal;
aRetVal <<= xCntrl;
SbxVariableRef refVar = rPar.Get(0);
- unoToSbxValue( static_cast<SbxVariable*>(refVar), aRetVal );
+ unoToSbxValue( refVar.get(), aRetVal );
}
diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index 05ec8a2f8f8e..7c079a8b531c 100644
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -462,7 +462,7 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
SbiCloseRecord( r, nPos );
}
// User defined types
- if (rTypes)
+ if ( rTypes.Is() )
{
sal_uInt16 nTypes = rTypes->Count();
if (nTypes > 0 )
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index b47c3a864104..704169bac8b8 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -232,7 +232,7 @@ StarBASIC* lclGetDocBasicForModule( SbModule* pModule )
SbxObject* StarBASIC::getVBAGlobals( )
{
- if ( !pVBAGlobals )
+ if ( !pVBAGlobals.Is() )
{
Any aThisDoc;
if ( GetUNOConstant("ThisComponent", aThisDoc) )
@@ -253,7 +253,7 @@ SbxObject* StarBASIC::getVBAGlobals( )
const OUString aVBAHook("VBAGlobals");
pVBAGlobals = static_cast<SbUnoObject*>(Find( aVBAHook , SbxClassType::DontCare ));
}
- return pVBAGlobals;
+ return pVBAGlobals.get();
}
// i#i68894#
@@ -641,7 +641,7 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
ResetFlag( SbxFlagBits::GlobalSearch );
// Copy the methods from original class module
- SbxArray* pClassMethods = pClassModule->GetMethods();
+ SbxArray* pClassMethods = pClassModule->GetMethods().get();
sal_uInt32 nMethodCount = pClassMethods->Count32();
sal_uInt32 i;
for( i = 0 ; i < nMethodCount ; i++ )
@@ -1098,11 +1098,12 @@ void StarBASIC::Insert( SbxVariable* pVar )
void StarBASIC::Remove( SbxVariable* pVar )
{
- if( dynamic_cast<const SbModule*>(pVar) != nullptr)
+ SbModule* pModule = dynamic_cast<SbModule*>(pVar);
+ if( pModule )
{
// #87540 Can be last reference!
- SbxVariableRef xVar = pVar;
- pModules.erase(std::remove(pModules.begin(), pModules.end(), pVar));
+ SbModuleRef xVar = pModule;
+ pModules.erase(std::remove(pModules.begin(), pModules.end(), xVar));
pVar->SetParent( nullptr );
EndListening( pVar->GetBroadcaster() );
}
@@ -1290,12 +1291,12 @@ SbxVariable* StarBASIC::Find( const OUString& rName, SbxClassType t )
{
if( rName.equalsIgnoreAsciiCase( RTLNAME ) )
{
- pRes = pRtl;
+ pRes = pRtl.get();
}
}
if( !pRes )
{
- pRes = static_cast<SbiStdObject*>(static_cast<SbxObject*>(pRtl))->Find( rName, t );
+ pRes = static_cast<SbiStdObject*>(pRtl.get())->Find( rName, t );
}
if( pRes )
{
@@ -2106,12 +2107,12 @@ void BasicCollection::Notify( SfxBroadcaster& rCst, const SfxHint& rHint )
if( pVar->GetHashCode() == nAddHash
&& aVarName.equalsIgnoreAsciiCase( pAddStr ) )
{
- pVar->SetInfo( xAddInfo );
+ pVar->SetInfo( xAddInfo.get() );
}
else if( pVar->GetHashCode() == nItemHash
&& aVarName.equalsIgnoreAsciiCase( pItemStr ) )
{
- pVar->SetInfo( xItemInfo );
+ pVar->SetInfo( xItemInfo.get() );
}
}
}
@@ -2219,7 +2220,7 @@ void BasicCollection::CollAdd( SbxArray* pPar_ )
}
}
pNewItem->SetFlag( SbxFlagBits::ReadWrite );
- xItemArray->Insert32( pNewItem, nNextIndex );
+ xItemArray->Insert32( pNewItem.get(), nNextIndex );
}
else
{
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 8d24420bdd4d..561767afe199 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -473,7 +473,7 @@ static SbxObject* lcl_getNativeObject( sal_uInt32 nIndex )
ObjectItem& rItem = rNativeObjectWrapperVector[ nIndex ];
xRetObj = rItem.m_xNativeObj;
}
- return xRetObj;
+ return xRetObj.get();
}
// convert from Uno to Sbx
@@ -632,7 +632,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
}
else
{
- pVar->PutObject( xWrapper );
+ pVar->PutObject( xWrapper.get() );
}
}
break;
@@ -657,7 +657,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
SbxDimArrayRef xArray = pArray;
SbxFlagBits nFlags = pVar->GetFlags();
pVar->ResetFlag( SbxFlagBits::Fixed );
- pVar->PutObject( static_cast<SbxDimArray*>(xArray) );
+ pVar->PutObject( xArray.get() );
pVar->SetFlags( nFlags );
}
else
@@ -733,7 +733,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
}
else
{
- pVar->PutObject( xWrapper );
+ pVar->PutObject( xWrapper.get() );
}
}
break;
@@ -787,7 +787,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
// return the Array
SbxFlagBits nFlags = pVar->GetFlags();
pVar->ResetFlag( SbxFlagBits::Fixed );
- pVar->PutObject( static_cast<SbxDimArray*>(xArray) );
+ pVar->PutObject( xArray.get() );
pVar->SetFlags( nFlags );
}
@@ -862,7 +862,7 @@ Type getUnoTypeForSbxValue( const SbxValue* pVal )
if( eBaseType == SbxOBJECT )
{
SbxBaseRef xObj = pVal->GetObject();
- if( !xObj )
+ if( !xObj.Is() )
{
aRetType = cppu::UnoType<XInterface>::get();
return aRetType;
@@ -870,7 +870,7 @@ Type getUnoTypeForSbxValue( const SbxValue* pVal )
if( nullptr != dynamic_cast<const SbxDimArray*>( &xObj) )
{
- SbxBase* pObj = static_cast<SbxBase*>(xObj);
+ SbxBase* pObj = xObj.get();
SbxDimArray* pArray = static_cast<SbxDimArray*>(pObj);
short nDims = pArray->GetDims();
@@ -964,12 +964,12 @@ Type getUnoTypeForSbxValue( const SbxValue* pVal )
// No array, but ...
else if( nullptr != dynamic_cast<const SbUnoObject*>( &xObj) )
{
- aRetType = static_cast<SbUnoObject*>(static_cast<SbxBase*>(xObj))->getUnoAny().getValueType();
+ aRetType = static_cast<SbUnoObject*>(xObj.get())->getUnoAny().getValueType();
}
// SbUnoAnyObject?
else if( nullptr != dynamic_cast<const SbUnoAnyObject*>( &xObj) )
{
- aRetType = static_cast<SbUnoAnyObject*>(static_cast<SbxBase*>(xObj))->getValue().getValueType();
+ aRetType = static_cast<SbUnoAnyObject*>(xObj.get())->getValue().getValueType();
}
// Otherwise it is a No-Uno-Basic-Object -> default==deliver void
}
@@ -991,11 +991,11 @@ Any sbxToUnoValueImpl( const SbxValue* pVar, bool bBlockConversionToSmallestType
if( xObj.Is() )
{
if( nullptr != dynamic_cast<const SbUnoAnyObject*>( &xObj) )
- return static_cast<SbUnoAnyObject*>(static_cast<SbxBase*>(xObj))->getValue();
+ return static_cast<SbUnoAnyObject*>(xObj.get())->getValue();
if( nullptr != dynamic_cast<const SbClassModuleObject*>( &xObj) )
{
Any aRetAny;
- SbClassModuleObject* pClassModuleObj = static_cast<SbClassModuleObject*>(static_cast<SbxBase*>(xObj));
+ SbClassModuleObject* pClassModuleObj = static_cast<SbClassModuleObject*>(xObj.get());
SbModule* pClassModule = pClassModuleObj->getClassModule();
if( pClassModule->createCOMWrapperForIface( aRetAny, pClassModuleObj ) )
return aRetAny;
@@ -1191,7 +1191,7 @@ Any sbxToUnoValue( const SbxValue* pVar, const Type& rType, Property* pUnoProper
SbxBaseRef xObj = pVar->GetObject();
if( xObj.Is() && nullptr != dynamic_cast<const SbUnoAnyObject*>( &xObj) )
{
- return static_cast<SbUnoAnyObject*>(static_cast<SbxBase*>(xObj))->getValue();
+ return static_cast<SbUnoAnyObject*>(xObj.get())->getValue();
}
}
@@ -1244,13 +1244,13 @@ Any sbxToUnoValue( const SbxValue* pVar, const Type& rType, Property* pUnoProper
}
SbxBaseRef pObj = pVar->GetObject();
- if( pObj && nullptr != dynamic_cast<const SbUnoObject*>( &pObj) )
+ if( pObj.Is() && nullptr != dynamic_cast<const SbUnoObject*>( &pObj) )
{
- aRetVal = static_cast<SbUnoObject*>(static_cast<SbxBase*>(pObj))->getUnoAny();
+ aRetVal = static_cast<SbUnoObject*>(pObj.get())->getUnoAny();
}
- else if( pObj && nullptr != dynamic_cast<const SbUnoStructRefObject*>( &pObj) )
+ else if( pObj.Is() && nullptr != dynamic_cast<const SbUnoStructRefObject*>( &pObj) )
{
- aRetVal = static_cast<SbUnoStructRefObject*>(static_cast<SbxBase*>(pObj))->getUnoAny();
+ aRetVal = static_cast<SbUnoStructRefObject*>(pObj.get())->getUnoAny();
}
else
{
@@ -1270,9 +1270,9 @@ Any sbxToUnoValue( const SbxValue* pVar, const Type& rType, Property* pUnoProper
Reference< XIdlClass > xIdlClass;
SbxBaseRef pObj = pVar->GetObject();
- if( pObj && nullptr != dynamic_cast<const SbUnoObject*>( &pObj) )
+ if( pObj.Is() && nullptr != dynamic_cast<const SbUnoObject*>( &pObj) )
{
- Any aUnoAny = static_cast<SbUnoObject*>(static_cast<SbxBase*>(pObj))->getUnoAny();
+ Any aUnoAny = static_cast<SbUnoObject*>( pObj.get() )->getUnoAny();
aUnoAny >>= xIdlClass;
}
@@ -1306,9 +1306,9 @@ Any sbxToUnoValue( const SbxValue* pVar, const Type& rType, Property* pUnoProper
case TypeClass_SEQUENCE:
{
SbxBaseRef xObj = pVar->GetObject();
- if( xObj && nullptr != dynamic_cast<const SbxDimArray*>( &xObj) )
+ if( xObj.Is() && nullptr != dynamic_cast<const SbxDimArray*>( &xObj) )
{
- SbxBase* pObj = static_cast<SbxBase*>(xObj);
+ SbxBase* pObj = xObj.get();
SbxDimArray* pArray = static_cast<SbxDimArray*>(pObj);
short nDims = pArray->GetDims();
@@ -2055,7 +2055,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
{
SbUnoStructRefObject* pSbUnoObject = new SbUnoStructRefObject( pProp->GetName(), aMember );
SbxObjectRef xWrapper = static_cast<SbxObject*>(pSbUnoObject);
- pVar->PutObject( xWrapper );
+ pVar->PutObject( xWrapper.get() );
}
else
{
@@ -2532,7 +2532,7 @@ SbUnoMethod::~SbUnoMethod()
SbxInfo* SbUnoMethod::GetInfo()
{
- if( !pInfo && m_xUnoMethod.is() )
+ if( !pInfo.Is() && m_xUnoMethod.is() )
{
SbiInstance* pInst = GetSbData()->pInst;
if( pInst && pInst->IsCompatibility() )
@@ -2554,7 +2554,7 @@ SbxInfo* SbUnoMethod::GetInfo()
}
}
}
- return pInfo;
+ return pInfo.get();
}
const Sequence<ParamInfo>& SbUnoMethod::getParamInfos()
@@ -2589,7 +2589,7 @@ SbUnoProperty::SbUnoProperty
// as needed establish an dummy array so that SbiRuntime::CheckArray() works
static SbxArrayRef xDummyArray = new SbxArray( SbxVARIANT );
if( eSbxType & SbxARRAY )
- PutObject( xDummyArray );
+ PutObject( xDummyArray.get() );
}
SbUnoProperty::~SbUnoProperty()
@@ -2637,7 +2637,7 @@ SbxVariable* SbUnoObject::Find( const OUString& rName, SbxClassType t )
// create the property and superimpose it
auto pProp = tools::make_ref<SbUnoProperty>( rProp.Name, eSbxType, eRealSbxType, rProp, 0, false, ( rProp.Type.getTypeClass() == css::uno::TypeClass_STRUCT ) );
QuickInsert( pProp.get() );
- pRes = pProp;
+ pRes = pProp.get();
}
else if( mxUnoAccess->hasMethod( aUName,
MethodConcept::ALL - MethodConcept::DANGEROUS ) )
@@ -2650,7 +2650,7 @@ SbxVariable* SbUnoObject::Find( const OUString& rName, SbxClassType t )
auto xMethRef = tools::make_ref<SbUnoMethod>( rxMethod->getName(),
unoToSbxType( rxMethod->getReturnType() ), rxMethod, false );
QuickInsert( xMethRef.get() );
- pRes = xMethRef;
+ pRes = xMethRef.get();
}
// If nothing was found check via XNameAccess
@@ -2707,14 +2707,14 @@ SbxVariable* SbUnoObject::Find( const OUString& rName, SbxClassType t )
// create a property and superimpose it
auto xVarRef = tools::make_ref<SbUnoProperty>( aUName, SbxVARIANT, SbxVARIANT, aDummyProp, 0, true, false );
QuickInsert( xVarRef.get() );
- pRes = xVarRef;
+ pRes = xVarRef.get();
}
else if( mxInvocation->hasMethod( aUName ) )
{
// create SbUnoMethode and superimpose it
auto xMethRef = tools::make_ref<SbUnoMethod>( aUName, SbxVARIANT, xDummyMethod, true );
QuickInsert( xMethRef.get() );
- pRes = xMethRef;
+ pRes = xMethRef.get();
}
else
{
@@ -2723,7 +2723,7 @@ SbxVariable* SbUnoObject::Find( const OUString& rName, SbxClassType t )
{
auto xMethRef = tools::make_ref<SbUnoMethod>( aUName, SbxVARIANT, xDummyMethod, true );
QuickInsert( xMethRef.get() );
- pRes = xMethRef;
+ pRes = xMethRef.get();
}
}
@@ -2941,7 +2941,7 @@ void RTL_Impl_CreateUnoStruct( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )
// try to create Struct with the same name
SbUnoObjectRef xUnoObj = Impl_CreateUnoStruct( aClassName );
- if( !xUnoObj )
+ if( !xUnoObj.Is() )
{
return;
}
@@ -2985,7 +2985,7 @@ void RTL_Impl_CreateUnoService( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )
if( xUnoObj->getUnoAny().hasValue() )
{
// return the object
- refVar->PutObject( static_cast<SbUnoObject*>(xUnoObj) );
+ refVar->PutObject( xUnoObj.get() );
}
else
{
@@ -3037,7 +3037,7 @@ void RTL_Impl_CreateUnoServiceWithArguments( StarBASIC* pBasic, SbxArray& rPar,
if( xUnoObj->getUnoAny().hasValue() )
{
// return the object
- refVar->PutObject( static_cast<SbUnoObject*>(xUnoObj) );
+ refVar->PutObject( xUnoObj.get() );
}
else
{
@@ -3062,7 +3062,7 @@ void RTL_Impl_GetProcessServiceManager( StarBASIC* pBasic, SbxArray& rPar, bool
// Create a SbUnoObject out of it and return it
SbUnoObjectRef xUnoObj = new SbUnoObject( OUString( "ProcessServiceManager" ), Any(xFactory) );
- refVar->PutObject( static_cast<SbUnoObject*>(xUnoObj) );
+ refVar->PutObject( xUnoObj.get() );
}
void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )
@@ -3084,11 +3084,11 @@ void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )
// get the Uno-Object
SbxBaseRef pObj = rPar.Get( 1 )->GetObject();
- if( !(pObj && nullptr != dynamic_cast<const SbUnoObject*>( &pObj)) )
+ if( !(pObj.Is() && nullptr != dynamic_cast<const SbUnoObject*>( &pObj)) )
{
return;
}
- Any aAny = static_cast<SbUnoObject*>(static_cast<SbxBase*>(pObj))->getUnoAny();
+ Any aAny = static_cast<SbUnoObject*>(pObj.get())->getUnoAny();
auto x = o3tl::tryAccess<Reference<XInterface>>(aAny);
if( !x )
{
@@ -3148,11 +3148,11 @@ void RTL_Impl_IsUnoStruct( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )
return;
}
SbxBaseRef pObj = rPar.Get( 1 )->GetObject();
- if( !(pObj && nullptr != dynamic_cast<const SbUnoObject*>( &pObj)) )
+ if( !(pObj.Is() && nullptr != dynamic_cast<const SbUnoObject*>( &pObj)) )
{
return;
}
- Any aAny = static_cast<SbUnoObject*>(static_cast<SbxBase*>(pObj))->getUnoAny();
+ Any aAny = static_cast<SbUnoObject*>(pObj.get())->getUnoAny();
TypeClass eType = aAny.getValueType().getTypeClass();
if( eType == TypeClass_STRUCT )
{
@@ -3183,11 +3183,11 @@ void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )
return;
}
SbxBaseRef pObj1 = xParam1->GetObject();
- if( !(pObj1 && nullptr != dynamic_cast<const SbUnoObject*>( &pObj1 )) )
+ if( !(pObj1.Is() && nullptr != dynamic_cast<const SbUnoObject*>( &pObj1 )) )
{
return;
}
- Any aAny1 = static_cast<SbUnoObject*>(static_cast<SbxBase*>(pObj1))->getUnoAny();
+ Any aAny1 = static_cast<SbUnoObject*>(pObj1.get())->getUnoAny();
TypeClass eType1 = aAny1.getValueType().getTypeClass();
if( eType1 != TypeClass_INTERFACE )
{
@@ -3202,11 +3202,11 @@ void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )
return;
}
SbxBaseRef pObj2 = xParam2->GetObject();
- if( !(pObj2 && nullptr != dynamic_cast<const SbUnoObject*>( &pObj2 )) )
+ if( !(pObj2.Is() && nullptr != dynamic_cast<const SbUnoObject*>( &pObj2 )) )
{
return;
}
- Any aAny2 = static_cast<SbUnoObject*>(static_cast<SbxBase*>(pObj2))->getUnoAny();
+ Any aAny2 = static_cast<SbUnoObject*>(pObj2.get())->getUnoAny();
TypeClass eType2 = aAny2.getValueType().getTypeClass();
if( eType2 != TypeClass_INTERFACE )
{
@@ -3421,7 +3421,7 @@ SbxVariable* SbUnoClass::Find( const OUString& rName, SbxClassType )
{
pRes = new SbxVariable( SbxVARIANT );
SbxObjectRef xWrapper = static_cast<SbxObject*>(new SbUnoClass( aNewName, xClass ));
- pRes->PutObject( xWrapper );
+ pRes->PutObject( xWrapper.get() );
}
}
else
@@ -3443,7 +3443,7 @@ SbxVariable* SbUnoClass::Find( const OUString& rName, SbxClassType )
{
pRes = new SbxVariable( SbxVARIANT );
SbxObjectRef xWrapper = static_cast<SbxObject*>(pNewClass);
- pRes->PutObject( xWrapper );
+ pRes->PutObject( xWrapper.get() );
}
}
@@ -3455,7 +3455,7 @@ SbxVariable* SbUnoClass::Find( const OUString& rName, SbxClassType )
{
pRes = new SbxVariable( SbxVARIANT );
SbxObjectRef xWrapper = static_cast<SbxObject*>(pUnoService);
- pRes->PutObject( xWrapper );
+ pRes->PutObject( xWrapper.get() );
}
}
@@ -3467,7 +3467,7 @@ SbxVariable* SbUnoClass::Find( const OUString& rName, SbxClassType )
{
pRes = new SbxVariable( SbxVARIANT );
SbxObjectRef xWrapper = static_cast<SbxObject*>(pUnoSingleton);
- pRes->PutObject( xWrapper );
+ pRes->PutObject( xWrapper.get() );
}
}
}
@@ -3546,7 +3546,7 @@ SbxVariable* SbUnoService::Find( const OUString& rName, SbxClassType )
{
// Create and insert SbUnoServiceCtor
SbxVariableRef xSbCtorRef = new SbUnoServiceCtor( aName, xCtor );
- QuickInsert( static_cast<SbxVariable*>(xSbCtorRef) );
+ QuickInsert( xSbCtorRef.get() );
}
}
pRes = SbxObject::Find( rName, SbxClassType::Method );
@@ -3766,7 +3766,7 @@ SbUnoSingleton::SbUnoSingleton( const OUString& aName_ )
: SbxObject( aName_ )
{
SbxVariableRef xGetMethodRef = new SbxMethod( OUString( "get" ), SbxOBJECT );
- QuickInsert( static_cast<SbxVariable*>(xGetMethodRef) );
+ QuickInsert( xGetMethodRef.get() );
}
void SbUnoSingleton::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
@@ -3861,7 +3861,7 @@ void BasicAllListener_Impl::firing_impl( const AllEventObject& Event, Any* pRet
OUString aMethodName = aPrefixName;
aMethodName = aMethodName + Event.MethodName;
- SbxVariable * pP = xSbxObj;
+ SbxVariable * pP = xSbxObj.get();
while( pP->GetParent() )
{
pP = pP->GetParent();
@@ -3876,11 +3876,11 @@ void BasicAllListener_Impl::firing_impl( const AllEventObject& Event, Any* pRet
{
// Convert elements
SbxVariableRef xVar = new SbxVariable( SbxVARIANT );
- unoToSbxValue( static_cast<SbxVariable*>(xVar), pArgs[i] );
- xSbxArray->Put( xVar, sal::static_int_cast< sal_uInt16 >(i+1) );
+ unoToSbxValue( xVar.get(), pArgs[i] );
+ xSbxArray->Put( xVar.get(), sal::static_int_cast< sal_uInt16 >(i+1) );
}
- pLib->Call( aMethodName, xSbxArray );
+ pLib->Call( aMethodName, xSbxArray.get() );
// get the return value from the Param-Array, if requested
if( pRet )
@@ -4138,7 +4138,7 @@ void SbRtl_CreateUnoListener( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )
// return the object
SbxVariableRef refVar = rPar.Get(0);
- refVar->PutObject( p->xSbxObj );
+ refVar->PutObject( p->xSbxObj.get() );
}
@@ -4154,7 +4154,7 @@ void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, bool bWrite
Any aContextAny( comphelper::getProcessComponentContext() );
SbUnoObjectRef xUnoObj = new SbUnoObject( OUString( "DefaultContext" ), aContextAny );
- refVar->PutObject( static_cast<SbUnoObject*>(xUnoObj) );
+ refVar->PutObject( xUnoObj.get() );
}
@@ -4192,9 +4192,9 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )
Reference< XIdlClass > xIdlClass;
SbxBaseRef pObj = pVal->GetObject();
- if( pObj && nullptr != dynamic_cast<const SbUnoObject*>( &pObj) )
+ if( pObj.Is() && nullptr != dynamic_cast<const SbUnoObject*>( &pObj) )
{
- Any aUnoAny = static_cast<SbUnoObject*>(static_cast<SbxBase*>(pObj))->getUnoAny();
+ Any aUnoAny = static_cast<SbUnoObject*>(pObj.get())->getUnoAny();
aUnoAny >>= xIdlClass;
}
@@ -4210,7 +4210,7 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )
Any aTypeAny( aType );
SbxVariableRef refVar = rPar.Get(0);
SbxObjectRef xUnoAnyObject = new SbUnoAnyObject( aTypeAny );
- refVar->PutObject( xUnoAnyObject );
+ refVar->PutObject( xUnoAnyObject.get() );
}
return;
}
@@ -4240,7 +4240,7 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )
SbxVariableRef refVar = rPar.Get(0);
SbxObjectRef xUnoAnyObject = new SbUnoAnyObject( aConvertedVal );
- refVar->PutObject( xUnoAnyObject );
+ refVar->PutObject( xUnoAnyObject.get() );
}
@@ -4318,13 +4318,13 @@ void SAL_CALL ModuleInvocationProxy::setValue(const OUString& rProperty, const A
// Setup parameter
SbxArrayRef xArray = new SbxArray;
SbxVariableRef xVar = new SbxVariable( SbxVARIANT );
- unoToSbxValue( static_cast<SbxVariable*>(xVar), rValue );
- xArray->Put( xVar, 1 );
+ unoToSbxValue( xVar.get(), rValue );
+ xArray->Put( xVar.get(), 1 );
// Call property method
SbxVariableRef xValue = new SbxVariable;
- pMeth->SetParameters( xArray );
- pMeth->Call( xValue );
+ pMeth->SetParameters( xArray.get() );
+ pMeth->Call( xValue.get() );
pMeth->SetParameters( nullptr );
// TODO: OutParameter?
@@ -4356,8 +4356,8 @@ Any SAL_CALL ModuleInvocationProxy::getValue(const OUString& rProperty)
// Call method
SbxVariableRef xValue = new SbxVariable;
- pMeth->Call( xValue );
- Any aRet = sbxToUnoValue( xValue );
+ pMeth->Call( xValue.get() );
+ Any aRet = sbxToUnoValue( xValue.get() );
return aRet;
}
@@ -4421,17 +4421,17 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const OUString& rFunction,
for( sal_Int32 i = 0 ; i < nParamCount ; i++ )
{
SbxVariableRef xVar = new SbxVariable( SbxVARIANT );
- unoToSbxValue( static_cast<SbxVariable*>(xVar), pArgs[i] );
- xArray->Put( xVar, sal::static_int_cast< sal_uInt16 >(i+1) );
+ unoToSbxValue( xVar.get(), pArgs[i] );
+ xArray->Put( xVar.get(), sal::static_int_cast< sal_uInt16 >(i+1) );
}
}
// Call method
SbxVariableRef xValue = new SbxVariable;
if( xArray.Is() )
- pMeth->SetParameters( xArray );
- pMeth->Call( xValue );
- aRet = sbxToUnoValue( xValue );
+ pMeth->SetParameters( xArray.get() );
+ pMeth->Call( xValue.get() );
+ aRet = sbxToUnoValue( xValue.get() );
pMeth->SetParameters( nullptr );
if( bSetRescheduleBack )
@@ -4549,7 +4549,7 @@ void registerComponentToBeDisposedForBasic
void registerComListenerVariableForBasic( SbxVariable* pVar, StarBASIC* pBasic )
{
StarBasicDisposeItem* pItem = lcl_getOrCreateItemForBasic( pBasic );
- SbxArray* pArray = pItem->m_pRegisteredVariables;
+ SbxArray* pArray = pItem->m_pRegisteredVariables.get();
pArray->Put( pVar, pArray->Count() );
}
@@ -4560,7 +4560,7 @@ void disposeComVariablesForBasic( StarBASIC* pBasic )
{
StarBasicDisposeItem* pItem = *it;
- SbxArray* pArray = pItem->m_pRegisteredVariables;
+ SbxArray* pArray = pItem->m_pRegisteredVariables.get();
sal_uInt16 nCount = pArray->Count();
for( sal_uInt16 i = 0 ; i < nCount ; ++i )
{
@@ -4602,7 +4602,7 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP
bool bSuccess = false;
- SbxArray* pModIfaces = pClassData->mxIfaces;
+ SbxArray* pModIfaces = pClassData->mxIfaces.get();
sal_uInt16 nCount = pModIfaces->Count();
for( sal_uInt16 i = 0 ; i < nCount ; ++i )
{
@@ -4786,8 +4786,8 @@ SbxVariable* SbUnoStructRefObject::Find( const OUString& rName, SbxClassType t )
aProp.Type = css::uno::Type( it->second->getTypeClass(), it->second->getTypeName() );
SbUnoProperty* pProp = new SbUnoProperty( rName, eSbxType, eRealSbxType, aProp, 0, false, ( aProp.Type.getTypeClass() == css::uno::TypeClass_STRUCT) );
SbxVariableRef xVarRef = pProp;
- QuickInsert( static_cast<SbxVariable*>(xVarRef) );
- pRes = xVarRef;
+ QuickInsert( xVarRef.get() );
+ pRes = xVarRef.get();
}
}
@@ -4815,15 +4815,15 @@ void SbUnoStructRefObject::implCreateDbgProperties()
// Id == -1: display the implemented interfaces corresponding the ClassProvider
SbxVariableRef xVarRef = new SbUnoProperty( OUString(ID_DBG_SUPPORTEDINTERFACES), SbxSTRING, SbxSTRING, aProp, -1, false, false );
- QuickInsert( static_cast<SbxVariable*>(xVarRef) );
+ QuickInsert( xVarRef.get() );
// Id == -2: output the properties
xVarRef = new SbUnoProperty( OUString(ID_DBG_PROPERTIES), SbxSTRING, SbxSTRING, aProp, -2, false, false );
- QuickInsert( static_cast<SbxVariable*>(xVarRef) );
+ QuickInsert( xVarRef.get() );
// Id == -3: output the Methods
xVarRef = new SbUnoProperty( OUString(ID_DBG_METHODS), SbxSTRING, SbxSTRING, aProp, -3, false, false );
- QuickInsert( static_cast<SbxVariable*>(xVarRef) );
+ QuickInsert( xVarRef.get() );
}
void SbUnoStructRefObject::implCreateAll()
@@ -4846,7 +4846,7 @@ void SbUnoStructRefObject::implCreateAll()
aProp.Type = css::uno::Type( it->second->getTypeClass(), it->second->getTypeName() );
SbUnoProperty* pProp = new SbUnoProperty( rName, eSbxType, eRealSbxType, aProp, 0, false, ( aProp.Type.getTypeClass() == css::uno::TypeClass_STRUCT) );
SbxVariableRef xVarRef = pProp;
- QuickInsert( static_cast<SbxVariable*>(xVarRef) );
+ QuickInsert( xVarRef.get() );
}
// Create Dbg_-Properties
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 6388ef712ed9..b7d9d5937b73 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -228,7 +228,7 @@ DocObjectWrapper::invoke( const OUString& aFunctionName, const Sequence< Any >&
if ( m_xAggInv.is() && m_xAggInv->hasMethod( aFunctionName ) )
return m_xAggInv->invoke( aFunctionName, aParams, aOutParamIndex, aOutParam );
SbMethodRef pMethod = getMethod( aFunctionName );
- if ( !pMethod )
+ if ( !pMethod.Is() )
throw RuntimeException();
// check number of parameters
sal_Int32 nParamsCount = aParams.getLength();
@@ -259,8 +259,8 @@ DocObjectWrapper::invoke( const OUString& aFunctionName, const Sequence< Any >&
for ( sal_Int32 i = 0; i < nParamsCount; ++i )
{
SbxVariableRef xSbxVar = new SbxVariable( SbxVARIANT );
- unoToSbxValue( static_cast< SbxVariable* >( xSbxVar ), pParams[i] );
- xSbxParams->Put( xSbxVar, static_cast< sal_uInt16 >( i ) + 1 );
+ unoToSbxValue( xSbxVar.get(), pParams[i] );
+ xSbxParams->Put( xSbxVar.get(), static_cast< sal_uInt16 >( i ) + 1 );
// Enable passing by ref
if ( xSbxVar->GetType() != SbxVARIANT )
@@ -268,12 +268,12 @@ DocObjectWrapper::invoke( const OUString& aFunctionName, const Sequence< Any >&
}
}
if ( xSbxParams.Is() )
- pMethod->SetParameters( xSbxParams );
+ pMethod->SetParameters( xSbxParams.get() );
// call method
SbxVariableRef xReturn = new SbxVariable;
- pMethod->Call( xReturn );
+ pMethod->Call( xReturn.get() );
Any aReturn;
// get output parameters
if ( xSbxParams.Is() )
@@ -291,7 +291,7 @@ DocObjectWrapper::invoke( const OUString& aFunctionName, const Sequence< Any >&
if ( pVar )
{
SbxVariableRef xVar = pVar;
- aOutParamMap.insert( OutParamMap::value_type( n - 1, sbxToUnoValue( xVar ) ) );
+ aOutParamMap.insert( OutParamMap::value_type( n - 1, sbxToUnoValue( xVar.get() ) ) );
}
}
}
@@ -309,7 +309,7 @@ DocObjectWrapper::invoke( const OUString& aFunctionName, const Sequence< Any >&
}
// get return value
- aReturn = sbxToUnoValue( xReturn );
+ aReturn = sbxToUnoValue( xReturn.get() );
pMethod->SetParameters( nullptr );
@@ -325,7 +325,7 @@ DocObjectWrapper::setValue( const OUString& aPropertyName, const Any& aValue ) t
SbPropertyRef pProperty = getProperty( aPropertyName );
if ( !pProperty.Is() )
throw UnknownPropertyException();
- unoToSbxValue( static_cast<SbxVariable*>(pProperty), aValue );
+ unoToSbxValue( pProperty.get(), aValue );
}
Any SAL_CALL
@@ -338,7 +338,7 @@ DocObjectWrapper::getValue( const OUString& aPropertyName ) throw (UnknownProper
if ( !pProperty.Is() )
throw UnknownPropertyException();
- SbxVariable* pProp = static_cast<SbxVariable*>(pProperty);
+ SbxVariable* pProp = pProperty.get();
if ( pProp->GetType() == SbxEMPTY )
pProperty->Broadcast( SBX_HINT_DATAWANTED );
@@ -763,7 +763,7 @@ void SbModule::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
xMethParameters->Put( pPar, i );
}
- pMethVar->SetParameters( xMethParameters );
+ pMethVar->SetParameters( xMethParameters.get() );
pMethVar->Get( aVals );
pMethVar->SetParameters( nullptr );
}
@@ -801,7 +801,7 @@ void SbModule::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
SbxArrayRef xArray = new SbxArray;
xArray->Put( pMethVar, 0 ); // Method as parameter 0
xArray->Put( pVar, 1 );
- pMethVar->SetParameters( xArray );
+ pMethVar->SetParameters( xArray.get() );
SbxValues aVals;
pMethVar->Get( aVals );
@@ -1197,7 +1197,7 @@ void SbModule::Run( SbMethod* pMeth )
{
// #57841 Clear Uno-Objects, which were helt in RTL functions,
// at the end of the program, so that nothing were helt.
- ClearUnoObjectsInRTL_Impl( xBasic );
+ ClearUnoObjectsInRTL_Impl( xBasic.get() );
clearNativeObjectWrapperVector();
@@ -1242,7 +1242,7 @@ void SbModule::Run( SbMethod* pMeth )
{
// #57841 Clear Uno-Objects, which were helt in RTL functions,
// the end of the program, so that nothing were helt.
- ClearUnoObjectsInRTL_Impl( xBasic );
+ ClearUnoObjectsInRTL_Impl( xBasic.get() );
delete GetSbData()->pInst;
GetSbData()->pInst = nullptr;
@@ -1309,7 +1309,7 @@ void SbModule::RemoveVars()
// which would cause basic to be re-run in the middle of the init ( and remember RemoveVars is called from compile and we don't want code to run as part of the compile )
SbxVariableRef p = SbModule::Find( rModuleVariableName, SbxClassType::Property );
if( p.Is() )
- Remove (p);
+ Remove( p.get() );
}
}
@@ -1838,7 +1838,7 @@ void SbModule::LoadBinaryData( SvStream& rStrm )
bool SbModule::LoadCompleted()
{
- SbxArray* p = GetMethods();
+ SbxArray* p = GetMethods().get();
sal_uInt16 i;
for( i = 0; i < p->Count(); i++ )
{
@@ -1892,7 +1892,7 @@ void SbModule::handleProcedureProperties( SfxBroadcaster& rBC, const SfxHint& rH
xMethParameters->Put( pPar, i );
}
- pMeth->SetParameters( xMethParameters );
+ pMeth->SetParameters( xMethParameters.get() );
pMeth->Get( aVals );
pMeth->SetParameters( nullptr );
}
@@ -1930,7 +1930,7 @@ void SbModule::handleProcedureProperties( SfxBroadcaster& rBC, const SfxHint& rH
SbxArrayRef xArray = new SbxArray;
xArray->Put( pMeth, 0 ); // Method as parameter 0
xArray->Put( pVar, 1 );
- pMeth->SetParameters( xArray );
+ pMeth->SetParameters( xArray.get() );
SbxValues aVals;
pMeth->Get( aVals );
@@ -2015,7 +2015,7 @@ void SbMethod::ClearStatics()
}
SbxArray* SbMethod::GetStatics()
{
- return refStatics;
+ return refStatics.get();
}
bool SbMethod::LoadData( SvStream& rStrm, sal_uInt16 nVer )
@@ -2083,7 +2083,7 @@ void SbMethod::GetLineRange( sal_uInt16& l1, sal_uInt16& l2 )
SbxInfo* SbMethod::GetInfo()
{
- return pInfo;
+ return pInfo.get();
}
// Interface to execute a method of the applications
@@ -2198,7 +2198,7 @@ SbObjModule::~SbObjModule()
void
SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException, std::exception )
{
- SbUnoObject* pUnoObj = dynamic_cast<SbUnoObject*>( static_cast<SbxVariable*>(pDocObject) );
+ SbUnoObject* pUnoObj = dynamic_cast<SbUnoObject*>( pDocObject.get() );
if ( pUnoObj && pUnoObj->getUnoAny() == aObj ) // object is equal, nothing to do
return;
pDocObject = new SbUnoObject( GetName(), aObj );
@@ -2217,13 +2217,13 @@ SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException,
SbxVariable*
SbObjModule::GetObject()
{
- return pDocObject;
+ return pDocObject.get();
}
SbxVariable*
SbObjModule::Find( const OUString& rName, SbxClassType t )
{
SbxVariable* pVar = nullptr;
- if ( pDocObject)
+ if ( pDocObject.get() )
pVar = pDocObject->Find( rName, t );
if ( !pVar )
pVar = SbModule::Find( rName, t );
@@ -2489,14 +2489,14 @@ void SbUserFormModule::triggerMethod( const OUString& aMethodToRun, Sequence< An
for ( sal_Int32 i = 0; i < aArguments.getLength(); ++i )
{
auto xSbxVar = tools::make_ref<SbxVariable>( SbxVARIANT );
- unoToSbxValue( static_cast< SbxVariable* >( xSbxVar ), aArguments[i] );
- xArray->Put( xSbxVar, static_cast< sal_uInt16 >( i ) + 1 );
+ unoToSbxValue( xSbxVar.get(), aArguments[i] );
+ xArray->Put( xSbxVar.get(), static_cast< sal_uInt16 >( i ) + 1 );
// Enable passing by ref
if ( xSbxVar->GetType() != SbxVARIANT )
xSbxVar->SetFlag( SbxFlagBits::Fixed );
}
- pMeth->SetParameters( xArray );
+ pMeth->SetParameters( xArray.get() );
SbxValues aVals;
pMeth->Get( aVals );
@@ -2585,7 +2585,7 @@ void SbUserFormModule::Load()
{
SAL_INFO("basic", "** load() ");
// forces a load
- if ( !pDocObject )
+ if ( !pDocObject.Is() )
InitObject();
}
@@ -2711,7 +2711,7 @@ void SbUserFormModule::InitObject()
SbxVariable*
SbUserFormModule::Find( const OUString& rName, SbxClassType t )
{
- if ( !pDocObject && !GetSbData()->bRunInit && GetSbData()->pInst )
+ if ( !pDocObject.Is() && !GetSbData()->bRunInit && GetSbData()->pInst )
InitObject();
return SbObjModule::Find( rName, t );
}
diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx
index 3ad73e04ce0a..c114d6068fbc 100644
--- a/basic/source/comp/codegen.cxx
+++ b/basic/source/comp/codegen.cxx
@@ -158,7 +158,7 @@ void SbiCodeGen::Save()
const OUString& rIfaceName = pParser->aIfaceVector[i];
SbxVariable* pIfaceVar = new SbxVariable( SbxVARIANT );
pIfaceVar->SetName( rIfaceName );
- SbxArray* pIfaces = rMod.pClassData->mxIfaces;
+ SbxArray* pIfaces = rMod.pClassData->mxIfaces.get();
pIfaces->Insert( pIfaceVar, pIfaces->Count() );
}
}
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 5d0da4276806..335c99a77287 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -185,13 +185,13 @@ RTLFUNC(CreateObject)
OUString aClass( rPar.Get( 1 )->GetOUString() );
SbxObjectRef p = SbxBase::CreateObject( aClass );
- if( !p )
+ if( !p.Is() )
StarBASIC::Error( ERRCODE_BASIC_CANNOT_LOAD );
else
{
// Convenience: enter BASIC as parent
p->SetParent( pBasic );
- rPar.Get( 0 )->PutObject( p );
+ rPar.Get( 0 )->PutObject( p.get() );
}
}
@@ -633,8 +633,8 @@ RTLFUNC(MkDir)
SbxArrayRef pPar = new SbxArray();
SbxVariableRef pResult = new SbxVariable();
SbxVariableRef pParam = new SbxVariable();
- pPar->Insert( pResult, pPar->Count() );
- pPar->Insert( pParam, pPar->Count() );
+ pPar->Insert( pResult.get(), pPar->Count() );
+ pPar->Insert( pParam.get(), pPar->Count() );
SbRtl_CurDir( pBasic, *pPar, bWrite );
rtl::OUString sCurPathURL;
@@ -1461,7 +1461,7 @@ RTLFUNC(RTL)
(void)pBasic;
(void)bWrite;
- rPar.Get( 0 )->PutObject( pBasic->getRTL() );
+ rPar.Get( 0 )->PutObject( pBasic->getRTL().get() );
}
RTLFUNC(RTrim)
@@ -4474,8 +4474,8 @@ RTLFUNC(LoadPicture)
Graphic aGraphic(aBmp);
SbxObjectRef xRef = new SbStdPicture;
- static_cast<SbStdPicture*>(static_cast<SbxObject*>(xRef))->SetGraphic( aGraphic );
- rPar.Get(0)->PutObject( xRef );
+ static_cast<SbStdPicture*>(xRef.get())->SetGraphic( aGraphic );
+ rPar.Get(0)->PutObject( xRef.get() );
}
}
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 8a385c2a3d9b..836451d81bc0 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -215,8 +215,8 @@ RTLFUNC(CallByName)
// Call method
SbxVariableRef refVar = rPar.Get(0);
if( xArray.Is() )
- pMeth->SetParameters( xArray );
- pMeth->Call( refVar );
+ pMeth->SetParameters( xArray.get() );
+ pMeth->Call( refVar.get() );
pMeth->SetParameters( nullptr );
}
break;
diff --git a/basic/source/runtime/props.cxx b/basic/source/runtime/props.cxx
index 276bc425d961..ce994947389e 100644
--- a/basic/source/runtime/props.cxx
+++ b/basic/source/runtime/props.cxx
@@ -44,7 +44,7 @@ RTLFUNC(Err)
if( SbiRuntime::isVBAEnabled() )
{
- rPar.Get( 0 )->PutObject( SbxErrObject::getErrObject() );
+ rPar.Get( 0 )->PutObject( SbxErrObject::getErrObject().get() );
}
else
{
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 643c1a28512a..068858f76a65 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -888,7 +888,7 @@ void SbiRuntime::Error( SbError n, bool bVBATranslationAlreadyDone )
{
OUString aMsg = pInst->GetErrorMsg();
sal_Int32 nVBAErrorNumber = translateErrorToVba( nError, aMsg );
- SbxVariable* pSbxErrObjVar = SbxErrObject::getErrObject();
+ SbxVariable* pSbxErrObjVar = SbxErrObject::getErrObject().get();
SbxErrObject* pGlobErr = static_cast< SbxErrObject* >( pSbxErrObjVar );
if( pGlobErr != nullptr )
{
@@ -1324,13 +1324,13 @@ void SbiRuntime::StepCompare( SbxOperator eOp )
// Compare )
if ( p1Type == SbxOBJECT )
{
- SbxVariable* pDflt = getDefaultProp( p1 );
+ SbxVariable* pDflt = getDefaultProp( p1.get() );
if ( pDflt )
{
p1 = pDflt;
p1->Broadcast( SBX_HINT_DATAWANTED );
}
- pDflt = getDefaultProp( p2 );
+ pDflt = getDefaultProp( p2.get() );
if ( pDflt )
{
p2 = pDflt;
@@ -1604,7 +1604,7 @@ inline bool checkUnoStructCopy( bool bVBA, SbxVariableRef& refVal, SbxVariableRe
return false;
SbUnoObject* pUnoVal = dynamic_cast<SbUnoObject*>( xValObj.get() );
- SbUnoStructRefObject* pUnoStructVal = dynamic_cast<SbUnoStructRefObject*>( static_cast<SbxObject*>(xValObj) );
+ SbUnoStructRefObject* pUnoStructVal = dynamic_cast<SbUnoStructRefObject*>( xValObj.get() );
Any aAny;
// make doubly sure value is either an Uno object or
// an uno struct
@@ -1683,7 +1683,7 @@ void SbiRuntime::StepPUT()
{
if ( dynamic_cast<const SbxMethod *>(refVar.get()) != nullptr || ! refVar->GetParent() )
{
- SbxVariable* pDflt = getDefaultProp( refVar );
+ SbxVariable* pDflt = getDefaultProp( refVar.get() );
if ( pDflt )
refVar = pDflt;
@@ -1693,7 +1693,7 @@ void SbiRuntime::StepPUT()
}
if ( refVal->GetType() == SbxOBJECT && !bObjAssign && ( dynamic_cast<const SbxMethod *>(refVal.get()) != nullptr || ! refVal->GetParent() ) )
{
- SbxVariable* pDflt = getDefaultProp( refVal );
+ SbxVariable* pDflt = getDefaultProp( refVal.get() );
if ( pDflt )
refVal = pDflt;
}
@@ -1788,7 +1788,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
{
SbxVariableRef refObjVal = dynamic_cast<SbxObject*>( pObjVarObj );
- if( refObjVal )
+ if( refObjVal.Is() )
{
refVal = refObjVal;
}
@@ -1802,7 +1802,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
// #52896 refVal can be invalid here, if uno-sequences - or more
// general arrays - are assigned to variables that are declared
// as an object!
- if( !refVal )
+ if( !refVal.Is() )
{
Error( ERRCODE_BASIC_INVALID_USAGE_OBJECT );
}
@@ -1835,7 +1835,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
{
if ( dynamic_cast<const SbxMethod *>(refVar.get()) != nullptr || ! refVar->GetParent() )
{
- SbxVariable* pDflt = getDefaultProp( refVar );
+ SbxVariable* pDflt = getDefaultProp( refVar.get() );
if ( pDflt )
{
refVar = pDflt;
@@ -1849,10 +1849,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
{
// check if lhs is a null object
// if it is then use the object not the default property
- SbxObject* pObj = nullptr;
-
-
- pObj = dynamic_cast<SbxObject*>( refVar.get() );
+ SbxObject* pObj = dynamic_cast<SbxObject*>( refVar.get() );
// calling GetObject on a SbxEMPTY variable raises
// object not set errors, make sure it's an Object
@@ -1865,7 +1862,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
if ( pObj && !bObjAssign )
{
// lhs is either a valid object || or has a defaultProp
- pDflt = getDefaultProp( refVal );
+ pDflt = getDefaultProp( refVal.get() );
}
if ( pDflt )
{
@@ -1923,7 +1920,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
{
// Object is overwritten with NULL, instantiate init object
DimAsNewRecoverHash &rDimAsNewRecoverHash = GaDimAsNewRecoverHash::get();
- DimAsNewRecoverHash::iterator it = rDimAsNewRecoverHash.find( refVar );
+ DimAsNewRecoverHash::iterator it = rDimAsNewRecoverHash.find( refVar.get() );
if( it != rDimAsNewRecoverHash.end() )
{
const DimAsNewRecoverItem& rItem = it->second;
@@ -1961,12 +1958,12 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
if( pClassModuleObj != nullptr )
{
SbModule* pClassModule = pClassModuleObj->getClassModule();
- rDimAsNewRecoverHash[refVar] =
+ rDimAsNewRecoverHash[refVar.get()] =
DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), pClassModule );
}
else if( aObjClass.equalsIgnoreAsciiCase( "Collection" ) )
{
- rDimAsNewRecoverHash[refVar] =
+ rDimAsNewRecoverHash[refVar.get()] =
DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), nullptr );
}
}
@@ -2099,9 +2096,9 @@ void SbiRuntime::DimImpl( SbxVariableRef refVar )
// If refDim then this DIM statement is terminating a ReDIM and
// previous StepERASE_CLEAR for an array, the following actions have
// been delayed from ( StepERASE_CLEAR ) 'till here
- if ( refRedim )
+ if ( refRedim.Is() )
{
- if ( !refRedimpArray ) // only erase the array not ReDim Preserve
+ if ( !refRedimpArray.Is() ) // only erase the array not ReDim Preserve
{
lcl_eraseImpl( refVar, bVBAEnabled );
}
@@ -2205,7 +2202,7 @@ void SbiRuntime::StepREDIMP()
{
SbxBase* pElemObj = refVar->GetObject();
SbxDimArray* pNewArray = dynamic_cast<SbxDimArray*>( pElemObj );
- SbxDimArray* pOldArray = static_cast<SbxDimArray*>(static_cast<SbxArray*>(refRedimpArray));
+ SbxDimArray* pOldArray = static_cast<SbxDimArray*>(refRedimpArray.get());
if( pNewArray )
{
short nDimsNew = pNewArray->GetDims();
@@ -2355,14 +2352,14 @@ void SbiRuntime::StepERASE_CLEAR()
void SbiRuntime::StepARRAYACCESS()
{
- if( !refArgv )
+ if( !refArgv.Is() )
{
StarBASIC::FatalError( ERRCODE_BASIC_INTERNAL_ERROR );
}
SbxVariableRef refVar = PopVar();
- refVar->SetParameters( refArgv );
+ refVar->SetParameters( refArgv.get() );
PopArgv();
- PushVar( CheckArray( refVar ) );
+ PushVar( CheckArray( refVar.get() ) );
}
void SbiRuntime::StepBYVAL()
@@ -2392,7 +2389,7 @@ void SbiRuntime::StepARGC()
void SbiRuntime::StepARGV()
{
- if( !refArgv )
+ if( !refArgv.Is() )
{
StarBASIC::FatalError( ERRCODE_BASIC_INTERNAL_ERROR );
}
@@ -2409,7 +2406,7 @@ void SbiRuntime::StepARGV()
SbxVariable* pRes = new SbxVariable( *pVal );
pVal = pRes;
}
- refArgv->Put( pVal, nArgc++ );
+ refArgv->Put( pVal.get(), nArgc++ );
}
}
@@ -2580,14 +2577,14 @@ void SbiRuntime::StepCASE()
refCaseStk = new SbxArray;
}
SbxVariableRef xVar = PopVar();
- refCaseStk->Put( xVar, refCaseStk->Count() );
+ refCaseStk->Put( xVar.get(), refCaseStk->Count() );
}
// end CASE: free variable
void SbiRuntime::StepENDCASE()
{
- if( !refCaseStk || !refCaseStk->Count() )
+ if( !refCaseStk.Is() || !refCaseStk->Count() )
{
StarBASIC::FatalError( ERRCODE_BASIC_INTERNAL_ERROR );
}
@@ -2742,7 +2739,7 @@ void SbiRuntime::StepEMPTY()
// to simplify matters.
SbxVariableRef xVar = new SbxVariable( SbxVARIANT );
xVar->PutErr( 448 );
- PushVar( xVar );
+ PushVar( xVar.get() );
}
// TOS = error code
@@ -2804,7 +2801,7 @@ void SbiRuntime::StepLOADI( sal_uInt32 nOp1 )
void SbiRuntime::StepARGN( sal_uInt32 nOp1 )
{
- if( !refArgv )
+ if( !refArgv.Is() )
StarBASIC::FatalError( ERRCODE_BASIC_INTERNAL_ERROR );
else
{
@@ -2819,7 +2816,7 @@ void SbiRuntime::StepARGN( sal_uInt32 nOp1 )
SbxVariable* pRes = new SbxVariable( *pVal );
pVal = pRes;
}
- refArgv->Put( pVal, nArgc );
+ refArgv->Put( pVal.get(), nArgc );
refArgv->PutAlias( aAlias, nArgc++ );
}
}
@@ -2828,7 +2825,7 @@ void SbiRuntime::StepARGN( sal_uInt32 nOp1 )
void SbiRuntime::StepARGTYP( sal_uInt32 nOp1 )
{
- if( !refArgv )
+ if( !refArgv.Is() )
StarBASIC::FatalError( ERRCODE_BASIC_INTERNAL_ERROR );
else
{
@@ -2995,7 +2992,7 @@ void SbiRuntime::StepTESTFOR( sal_uInt32 nOp1 )
}
else
{
- SbxDimArray* pArray = reinterpret_cast<SbxDimArray*>(static_cast<SbxVariable*>(p->refEnd));
+ SbxDimArray* pArray = reinterpret_cast<SbxDimArray*>(p->refEnd.get());
short nDims = pArray->GetDims();
// Empty array?
@@ -3029,7 +3026,7 @@ void SbiRuntime::StepTESTFOR( sal_uInt32 nOp1 )
}
case ForType::EachCollection:
{
- BasicCollection* pCollection = static_cast<BasicCollection*>(static_cast<SbxVariable*>(pForStk->refEnd));
+ BasicCollection* pCollection = static_cast<BasicCollection*>(pForStk->refEnd.get());
SbxArrayRef xItemArray = pCollection->xItemArray;
sal_Int32 nCount = xItemArray->Count32();
if( pForStk->nCurCollectionIndex < nCount )
@@ -3072,7 +3069,7 @@ void SbiRuntime::StepTESTFOR( sal_uInt32 nOp1 )
void SbiRuntime::StepCASETO( sal_uInt32 nOp1 )
{
- if( !refCaseStk || !refCaseStk->Count() )
+ if( !refCaseStk.Is() || !refCaseStk->Count() )
StarBASIC::FatalError( ERRCODE_BASIC_INTERNAL_ERROR );
else
{
@@ -3300,7 +3297,7 @@ void SbiRuntime::StepBASED( sal_uInt32 nOp1 )
p1->PutInteger( uBase );
if( !bCompatible )
x2->Compute( SbxPLUS, *p1 );
- PushVar( x2 ); // first the Expr
+ PushVar( x2.get() ); // first the Expr
PushVar( p1 ); // then the Base
}
@@ -3465,7 +3462,7 @@ SbxVariable* SbiRuntime::FindElement( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt
{
xDummyVar = new SbxVariable( SbxVARIANT );
}
- pElem = xDummyVar;
+ pElem = xDummyVar.get();
ClearArgvStack();
@@ -3564,7 +3561,7 @@ SbxBase* SbiRuntime::FindElementExtern( const OUString& rName )
{
return nullptr;
}
- if( refLocals )
+ if( refLocals.Is() )
{
pElem = refLocals->Find( rName, SbxClassType::DontCare );
}
@@ -3579,7 +3576,7 @@ SbxBase* SbiRuntime::FindElementExtern( const OUString& rName )
if( !pElem && pMeth )
{
SbxInfo* pInfo = pMeth->GetInfo();
- if( pInfo && refParams )
+ if( pInfo && refParams.Is() )
{
sal_uInt16 nParamCount = refParams->Count();
sal_uInt16 j = 1;
@@ -3621,7 +3618,7 @@ void SbiRuntime::SetupArgs( SbxVariable* p, sal_uInt32 nOp1 )
{
if( nOp1 & 0x8000 )
{
- if( !refArgv )
+ if( !refArgv.Is() )
{
StarBASIC::FatalError( ERRCODE_BASIC_INTERNAL_ERROR );
}
@@ -3745,7 +3742,7 @@ void SbiRuntime::SetupArgs( SbxVariable* p, sal_uInt32 nOp1 )
}
// own var as parameter 0
refArgv->Put( p, 0 );
- p->SetParameters( refArgv );
+ p->SetParameters( refArgv.get() );
PopArgv();
}
else
@@ -3804,9 +3801,9 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
{
// is it an uno-object?
SbxBaseRef pObj = pElem->GetObject();
- if( pObj )
+ if( pObj.Is() )
{
- if (SbUnoObject* pUnoObj = dynamic_cast<SbUnoObject*>(static_cast<SbxBase*>(pObj)))
+ if (SbUnoObject* pUnoObj = dynamic_cast<SbUnoObject*>( pObj.get()))
{
Any aAny = pUnoObj->getUnoAny();
@@ -3848,7 +3845,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
// #67173 don't specify a name so that the real class name is entered
OUString aName;
SbxObjectRef xWrapper = static_cast<SbxObject*>(new SbUnoObject( aName, aAny ));
- pElem->PutObject( xWrapper );
+ pElem->PutObject( xWrapper.get() );
}
else
{
@@ -3870,9 +3867,9 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
{
pDflt->Broadcast( SBX_HINT_DATAWANTED );
SbxBaseRef pDfltObj = pDflt->GetObject();
- if( pDfltObj )
+ if( pDfltObj.Is() )
{
- if (SbUnoObject* pSbObj = dynamic_cast<SbUnoObject*>(static_cast<SbxBase*>(pDfltObj)))
+ if (SbUnoObject* pSbObj = dynamic_cast<SbUnoObject*>(pDfltObj.get()))
{
pUnoObj = pSbObj;
Any aUnoAny = pUnoObj->getUnoAny();
@@ -3899,7 +3896,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
{
SbxVariable* meth = pUnoObj->Find( sDefaultMethod, SbxClassType::Method );
SbxVariableRef refTemp = meth;
- if ( refTemp )
+ if ( refTemp.Is() )
{
meth->SetParameters( pPar );
SbxVariable* pNew = new SbxMethod( *static_cast<SbxMethod*>(meth) );
@@ -3912,7 +3909,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
// #42940, set parameter 0 to NULL so that var doesn't contain itself
pPar->Put( nullptr, 0 );
}
- else if (BasicCollection* pCol = dynamic_cast<BasicCollection*>(static_cast<SbxBase*>(pObj)))
+ else if (BasicCollection* pCol = dynamic_cast<BasicCollection*>(pObj.get()))
{
pElem = new SbxVariable( SbxVARIANT );
pPar->Put( pElem, 0 );
@@ -3937,13 +3934,13 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
void SbiRuntime::StepRTL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
- PushVar( FindElement( rBasic.pRtl, nOp1, nOp2, ERRCODE_BASIC_PROC_UNDEFINED, false ) );
+ PushVar( FindElement( rBasic.pRtl.get(), nOp1, nOp2, ERRCODE_BASIC_PROC_UNDEFINED, false ) );
}
void SbiRuntime::StepFIND_Impl( SbxObject* pObj, sal_uInt32 nOp1, sal_uInt32 nOp2,
SbError nNotFound, bool bStatic )
{
- if( !refLocals )
+ if( !refLocals.Is() )
{
refLocals = new SbxArray;
}
@@ -4094,7 +4091,7 @@ void SbiRuntime::StepPARAM( sal_uInt32 nOp1, sal_uInt32 nOp2 )
void SbiRuntime::StepCASEIS( sal_uInt32 nOp1, sal_uInt32 nOp2 )
{
- if( !refCaseStk || !refCaseStk->Count() )
+ if( !refCaseStk.Is() || !refCaseStk->Count() )
{
StarBASIC::FatalError( ERRCODE_BASIC_INTERNAL_ERROR );
}
@@ -4118,7 +4115,7 @@ void SbiRuntime::StepCALL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
SbxArray* pArgs = nullptr;
if( nOp1 & 0x8000 )
{
- pArgs = refArgv;
+ pArgs = refArgv.get();
}
DllCall( aName, aLibName, pArgs, (SbxDataType) nOp2, false );
aLibName.clear();
@@ -4136,7 +4133,7 @@ void SbiRuntime::StepCALLC( sal_uInt32 nOp1, sal_uInt32 nOp2 )
SbxArray* pArgs = nullptr;
if( nOp1 & 0x8000 )
{
- pArgs = refArgv;
+ pArgs = refArgv.get();
}
DllCall( aName, aLibName, pArgs, (SbxDataType) nOp2, true );
aLibName.clear();
@@ -4323,13 +4320,13 @@ void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
// fill the array with instances of the requested class
SbxBaseRef xObj = refVar->GetObject();
- if( !xObj )
+ if( !xObj.Is() )
{
StarBASIC::Error( ERRCODE_BASIC_INVALID_OBJECT );
return;
}
- SbxDimArray* pArray = dynamic_cast<SbxDimArray*>(static_cast<SbxBase*>(xObj));
+ SbxDimArray* pArray = dynamic_cast<SbxDimArray*>(xObj.get());
if (pArray)
{
short nDims = pArray->GetDims();
@@ -4373,7 +4370,7 @@ void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
}
}
- SbxDimArray* pOldArray = static_cast<SbxDimArray*>(static_cast<SbxArray*>(refRedimpArray));
+ SbxDimArray* pOldArray = static_cast<SbxDimArray*>(refRedimpArray.get());
if( pArray && pOldArray )
{
short nDimsNew = pArray->GetDims();
@@ -4497,7 +4494,7 @@ void SbiRuntime::StepPUBLIC_Impl( sal_uInt32 nOp1, sal_uInt32 nOp2, bool bUsedFo
SbxVariableRef p = pMod->Find( aName, SbxClassType::Property );
if( p.Is() )
{
- pMod->Remove (p);
+ pMod->Remove (p.get());
}
SbProperty* pProp = pMod->GetProperty( aName, t );
if( !bUsedForClassModule )
@@ -4560,14 +4557,14 @@ void SbiRuntime::StepGLOBAL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
SbxVariableRef p = pStorage->Find( aName, SbxClassType::Property );
if( p.Is() )
{
- pStorage->Remove (p);
+ pStorage->Remove (p.get());
}
p = pStorage->Make( aName, SbxClassType::Property, t );
if( !bFlag )
{
pStorage->ResetFlag( SbxFlagBits::NoModify );
}
- if( p )
+ if( p.Is() )
{
p->SetFlag( SbxFlagBits::DontStore );
// from 2.7.1996: HACK because of 'reference can't be saved'
diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx
index 8748d2d0f861..e96ac1aa0737 100644
--- a/basic/source/sbx/sbxarray.cxx
+++ b/basic/source/sbx/sbxarray.cxx
@@ -61,7 +61,7 @@ SbxArray& SbxArray::operator=( const SbxArray& rArray )
for( const auto& rpSrcRef : rArray.mVarEntries )
{
SbxVariableRef pSrc_ = rpSrcRef.mpVar;
- if( !pSrc_ )
+ if( !pSrc_.Is() )
continue;
if( eType != SbxVARIANT )
@@ -153,7 +153,7 @@ SbxVariable* SbxArray::Get32( sal_uInt32 nIdx )
if ( !rRef.Is() )
rRef = new SbxVariable( eType );
- return rRef;
+ return rRef.get();
}
SbxVariable* SbxArray::Get( sal_uInt16 nIdx )
@@ -168,7 +168,7 @@ SbxVariable* SbxArray::Get( sal_uInt16 nIdx )
if ( !rRef.Is() )
rRef = new SbxVariable( eType );
- return rRef;
+ return rRef.get();
}
void SbxArray::Put32( SbxVariable* pVar, sal_uInt32 nIdx )
@@ -183,7 +183,7 @@ void SbxArray::Put32( SbxVariable* pVar, sal_uInt32 nIdx )
if( eType != SbxOBJECT || pVar->GetClass() != SbxClassType::Object )
pVar->Convert( eType );
SbxVariableRef& rRef = GetRef32( nIdx );
- if( static_cast<SbxVariable*>(rRef) != pVar )
+ if( rRef.get() != pVar )
{
rRef = pVar;
SetFlag( SbxFlagBits::Modified );
@@ -311,7 +311,7 @@ void SbxArray::Merge( SbxArray* p )
for (auto& rEntry1: p->mVarEntries)
{
- if (!rEntry1.mpVar)
+ if (!rEntry1.mpVar.Is())
continue;
OUString aName = rEntry1.mpVar->GetName();
@@ -321,7 +321,7 @@ void SbxArray::Merge( SbxArray* p )
// Then overwrite!
for (auto& rEntry2: mVarEntries)
{
- if (!rEntry2.mpVar)
+ if (!rEntry2.mpVar.Is())
continue;
if (rEntry2.mpVar->GetHashCode() == nHash &&
@@ -334,7 +334,7 @@ void SbxArray::Merge( SbxArray* p )
}
}
- if (rEntry1.mpVar)
+ if (rEntry1.mpVar.Is())
{
// We don't have element with the same name. Add a new entry.
SbxVarEntry aNewEntry;
@@ -354,7 +354,7 @@ SbxVariable* SbxArray::FindUserData( sal_uInt32 nData )
SbxVariable* p = nullptr;
for (auto& rEntry : mVarEntries)
{
- if (!rEntry.mpVar)
+ if (!rEntry.mpVar.Is())
continue;
if (rEntry.mpVar->IsVisible() && rEntry.mpVar->GetUserData() == nData)
@@ -408,7 +408,7 @@ SbxVariable* SbxArray::Find( const OUString& rName, SbxClassType t )
sal_uInt16 nHash = SbxVariable::MakeHashCode( rName );
for (auto& rEntry : mVarEntries)
{
- if (!rEntry.mpVar || !rEntry.mpVar->IsVisible())
+ if (!rEntry.mpVar.Is() || !rEntry.mpVar->IsVisible())
continue;
// The very secure search works as well, if there is no hashcode!
@@ -489,14 +489,14 @@ bool SbxArray::StoreData( SvStream& rStrm ) const
// Which elements are even defined?
for( auto& rEntry: mVarEntries )
{
- if (rEntry.mpVar && !(rEntry.mpVar->GetFlags() & SbxFlagBits::DontStore))
+ if (rEntry.mpVar.Is() && !(rEntry.mpVar->GetFlags() & SbxFlagBits::DontStore))
nElem++;
}
rStrm.WriteUInt16( nElem );
for( size_t n = 0; n < mVarEntries.size(); n++ )
{
const SbxVarEntry& rEntry = mVarEntries[n];
- if (rEntry.mpVar && !(rEntry.mpVar->GetFlags() & SbxFlagBits::DontStore))
+ if (rEntry.mpVar.Is() && !(rEntry.mpVar->GetFlags() & SbxFlagBits::DontStore))
{
rStrm.WriteUInt16( n );
if (!rEntry.mpVar->Store(rStrm))
diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx
index 9507f47f84e3..47775b02a554 100644
--- a/basic/source/sbx/sbxexec.cxx
+++ b/basic/source/sbx/sbxexec.cxx
@@ -94,7 +94,7 @@ static SbxVariableRef QualifiedName
{
// It follows still an objectelement. The current element
// had to be a SBX-Object or had to deliver such an object!
- pObj = dynamic_cast<SbxObject*>( static_cast<SbxVariable*>(refVar) );
+ pObj = dynamic_cast<SbxObject*>( refVar.get() );
if( !pObj )
// Then it had to deliver an object
pObj = dynamic_cast<SbxObject*>( refVar->GetObject() );
@@ -183,7 +183,7 @@ static SbxVariableRef MulDiv( SbxObject* pObj, SbxObject* pGbl, const sal_Unicod
if( refVar2.Is() )
{
// temporary variable!
- SbxVariable* pVar = refVar;
+ SbxVariable* pVar = refVar.get();
pVar = new SbxVariable( *pVar );
refVar = pVar;
if( cOp == '*' )
@@ -213,7 +213,7 @@ static SbxVariableRef PlusMinus( SbxObject* pObj, SbxObject* pGbl, const sal_Uni
if( refVar2.Is() )
{
// temporaere Variable!
- SbxVariable* pVar = refVar;
+ SbxVariable* pVar = refVar.get();
pVar = new SbxVariable( *pVar );
refVar = pVar;
if( cOp == '+' )
@@ -252,8 +252,8 @@ static SbxVariableRef Assign( SbxObject* pObj, SbxObject* pGbl, const sal_Unicod
SbxVariableRef refVar2( PlusMinus( pObj, pGbl, &p ) );
if( refVar2.Is() )
{
- SbxVariable* pVar = refVar;
- SbxVariable* pVar2 = refVar2;
+ SbxVariable* pVar = refVar.get();
+ SbxVariable* pVar2 = refVar2.get();
*pVar = *pVar2;
pVar->SetParameters( nullptr );
}
@@ -303,7 +303,7 @@ static SbxVariableRef Element
while( *p && *p != ')' && *p != ']' )
{
SbxVariableRef refArg = PlusMinus( pGbl, pGbl, &p );
- if( !refArg )
+ if( !refArg.Is() )
{
// Error during the parsing
refVar.Clear(); break;
@@ -322,7 +322,7 @@ static SbxVariableRef Element
if( *p == ')' )
p++;
if( refVar.Is() )
- refVar->SetParameters( refPar );
+ refVar->SetParameters( refPar.get() );
}
}
else
@@ -336,7 +336,7 @@ static SbxVariableRef Element
SbxVariable* SbxObject::Execute( const OUString& rTxt )
{
- SbxVariable* pVar = nullptr;
+ SbxVariableRef pVar = nullptr;
const sal_Unicode* p = rTxt.getStr();
for( ;; )
{
@@ -350,7 +350,7 @@ SbxVariable* SbxObject::Execute( const OUString& rTxt )
SetError( ERRCODE_SBX_SYNTAX ); break;
}
pVar = Assign( this, this, &p );
- if( !pVar )
+ if( !pVar.Is() )
{
break;
}
@@ -360,12 +360,12 @@ SbxVariable* SbxObject::Execute( const OUString& rTxt )
SetError( ERRCODE_SBX_SYNTAX ); break;
}
}
- return pVar;
+ return pVar.get();
}
SbxVariable* SbxObject::FindQualified( const OUString& rName, SbxClassType t )
{
- SbxVariable* pVar = nullptr;
+ SbxVariableRef pVar = nullptr;
const sal_Unicode* p = rName.getStr();
p = SkipWhitespace( p );
if( !*p )
@@ -378,7 +378,7 @@ SbxVariable* SbxObject::FindQualified( const OUString& rName, SbxClassType t )
{
SetError( ERRCODE_SBX_SYNTAX );
}
- return pVar;
+ return pVar.get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index 5382b499cc18..e4e7e3827493 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -98,9 +98,9 @@ static void CheckParentsOnDelete( SbxObject* pObj, SbxArray* p )
SbxObject::~SbxObject()
{
- CheckParentsOnDelete( this, pProps );
- CheckParentsOnDelete( this, pMethods );
- CheckParentsOnDelete( this, pObjs );
+ CheckParentsOnDelete( this, pProps.get() );
+ CheckParentsOnDelete( this, pMethods.get() );
+ CheckParentsOnDelete( this, pObjs.get() );
// avoid handling in ~SbxVariable as SbxFlagBits::DimAsNew == SbxFlagBits::GlobalSearch
ResetFlag( SbxFlagBits::DimAsNew );
@@ -239,9 +239,9 @@ SbxVariable* SbxObject::Find( const OUString& rName, SbxClassType t )
switch( t )
{
case SbxClassType::Variable:
- case SbxClassType::Property: pArray = pProps; break;
- case SbxClassType::Method: pArray = pMethods; break;
- case SbxClassType::Object: pArray = pObjs; break;
+ case SbxClassType::Property: pArray = pProps.get(); break;
+ case SbxClassType::Method: pArray = pMethods.get(); break;
+ case SbxClassType::Object: pArray = pObjs.get(); break;
default: SAL_WARN( "basic", "Invalid SBX-Class" ); break;
}
if( pArray )
@@ -332,13 +332,16 @@ void SbxObject::SetDfltProperty( const OUString& rName )
SbxArray* SbxObject::FindVar( SbxVariable* pVar, sal_uInt16& nArrayIdx )
{
SbxArray* pArray = nullptr;
- if( pVar ) switch( pVar->GetClass() )
+ if( pVar )
{
- case SbxClassType::Variable:
- case SbxClassType::Property: pArray = pProps; break;
- case SbxClassType::Method: pArray = pMethods; break;
- case SbxClassType::Object: pArray = pObjs; break;
- default: SAL_WARN( "basic", "Invalid SBX-Class" ); break;
+ switch( pVar->GetClass() )
+ {
+ case SbxClassType::Variable:
+ case SbxClassType::Property: pArray = pProps.get(); break;
+ case SbxClassType::Method: pArray = pMethods.get(); break;
+ case SbxClassType::Object: pArray = pObjs.get(); break;
+ default: SAL_WARN( "basic", "Invalid SBX-Class" ); break;
+ }
}
if( pArray )
{
@@ -351,7 +354,7 @@ SbxArray* SbxObject::FindVar( SbxVariable* pVar, sal_uInt16& nArrayIdx )
for( sal_uInt16 i = 0; i < pArray->Count(); i++ )
{
SbxVariableRef& rRef = pArray->GetRef( i );
- if( static_cast<SbxVariable*>(rRef) == pOld )
+ if( rRef.get() == pOld )
{
nArrayIdx = i; break;
}
@@ -371,9 +374,9 @@ SbxVariable* SbxObject::Make( const OUString& rName, SbxClassType ct, SbxDataTyp
switch( ct )
{
case SbxClassType::Variable:
- case SbxClassType::Property: pArray = pProps; break;
- case SbxClassType::Method: pArray = pMethods; break;
- case SbxClassType::Object: pArray = pObjs; break;
+ case SbxClassType::Property: pArray = pProps.get(); break;
+ case SbxClassType::Method: pArray = pMethods.get(); break;
+ case SbxClassType::Object: pArray = pObjs.get(); break;
default: SAL_WARN( "basic", "Invalid SBX-Class" ); break;
}
if( !pArray )
@@ -425,7 +428,7 @@ void SbxObject::Insert( SbxVariable* pVar )
{
// Then this element exists already
// There are objects of the same name allowed at collections
- if( pArray == pObjs && nullptr != dynamic_cast<const SbxCollection*>( this ) )
+ if( pArray == pObjs.get() && nullptr != dynamic_cast<const SbxCollection*>( this ) )
{
nIdx = pArray->Count();
}
@@ -484,9 +487,9 @@ void SbxObject::QuickInsert( SbxVariable* pVar )
switch( pVar->GetClass() )
{
case SbxClassType::Variable:
- case SbxClassType::Property: pArray = pProps; break;
- case SbxClassType::Method: pArray = pMethods; break;
- case SbxClassType::Object: pArray = pObjs; break;
+ case SbxClassType::Property: pArray = pProps.get(); break;
+ case SbxClassType::Method: pArray = pMethods.get(); break;
+ case SbxClassType::Object: pArray = pObjs.get(); break;
default: SAL_WARN( "basic", "Invalid SBX-Class" ); break;
}
}
@@ -544,7 +547,7 @@ void SbxObject::Remove( SbxVariable* pVar )
{
EndListening( pVar_->GetBroadcaster(), true );
}
- if( static_cast<SbxVariable*>(pVar_) == pDfltProp )
+ if( pVar_.get() == pDfltProp )
{
pDfltProp = nullptr;
}
@@ -568,14 +571,14 @@ static bool LoadArray( SvStream& rStrm, SbxObject* pThis, SbxArray* pArray )
for( sal_uInt16 i = 0; i < p->Count(); i++ )
{
SbxVariableRef& r = p->GetRef( i );
- SbxVariable* pVar = r;
+ SbxVariable* pVar = r.get();
if( pVar )
{
pVar->SetParent( pThis );
pThis->StartListening( pVar->GetBroadcaster(), true );
}
}
- pArray->Merge( p );
+ pArray->Merge( p.get() );
return true;
}
@@ -612,9 +615,9 @@ bool SbxObject::LoadData( SvStream& rStrm, sal_uInt16 nVer )
{
rStrm.Seek( nPos );
}
- if( !LoadArray( rStrm, this, pMethods ) ||
- !LoadArray( rStrm, this, pProps ) ||
- !LoadArray( rStrm, this, pObjs ) )
+ if( !LoadArray( rStrm, this, pMethods.get() ) ||
+ !LoadArray( rStrm, this, pProps.get() ) ||
+ !LoadArray( rStrm, this, pObjs.get() ) )
{
return false;
}
@@ -758,7 +761,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
for( sal_uInt16 i = 0; i < pMethods->Count(); i++ )
{
SbxVariableRef& r = pMethods->GetRef( i );
- SbxVariable* pVar = r;
+ SbxVariable* pVar = r.get();
if( pVar )
{
OUString aLine = aIndent + " - " + pVar->GetName( SbxNAME_SHORT_TYPES );
@@ -795,7 +798,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
for( sal_uInt16 i = 0; i < pProps->Count(); i++ )
{
SbxVariableRef& r = pProps->GetRef( i );
- SbxVariable* pVar = r;
+ SbxVariable* pVar = r.get();
if( pVar )
{
OUString aLine = aIndent + " - " + pVar->GetName( SbxNAME_SHORT_TYPES );
@@ -833,7 +836,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
for( sal_uInt16 i = 0; i < pObjs->Count(); i++ )
{
SbxVariableRef& r = pObjs->GetRef( i );
- SbxVariable* pVar = r;
+ SbxVariable* pVar = r.get();
if ( pVar )
{
rStrm.WriteCharPtr( aIndentNameStr.getStr() ).WriteCharPtr( " - Sub" );
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index ff8c7e07fccc..27766dfc7fd4 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -148,7 +148,7 @@ SfxBroadcaster& SbxVariable::GetBroadcaster()
SbxArray* SbxVariable::GetParameters() const
{
- return mpPar;
+ return mpPar.get();
}
@@ -199,7 +199,7 @@ void SbxVariable::Broadcast( sal_uInt32 nHintId )
SbxInfo* SbxVariable::GetInfo()
{
- if( !pInfo )
+ if( !pInfo.Is() )
{
Broadcast( SBX_HINT_INFOWANTED );
if( pInfo.Is() )
@@ -207,7 +207,7 @@ SbxInfo* SbxVariable::GetInfo()
SetModified( true );
}
}
- return pInfo;
+ return pInfo.get();
}
void SbxVariable::SetInfo( SbxInfo* p )
@@ -239,7 +239,7 @@ const OUString& SbxVariable::GetName( SbxNameType t ) const
// Request parameter-information (not for objects)
const_cast<SbxVariable*>(this)->GetInfo();
// Append nothing, if it is a simple property (no empty brackets)
- if (!pInfo || (pInfo->m_Params.empty() && GetClass() == SbxClassType::Property))
+ if (!pInfo.Is() || (pInfo->m_Params.empty() && GetClass() == SbxClassType::Property))
{
return maName;
}