diff options
141 files changed, 685 insertions, 684 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 11872eb4e3f6..7ece04118eb8 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -285,7 +285,7 @@ void ModulWindow::CheckCompileBasic() if ( bDone ) { - GetBreakPoints().SetBreakPointsInBasic( m_xModule ); + GetBreakPoints().SetBreakPointsInBasic( m_xModule.get() ); } GetShell()->GetViewFrame()->GetWindow().LeaveWait(); @@ -1280,7 +1280,7 @@ void ModulWindow::BasicStarted() if ( rList.size() ) { rList.ResetHitCount(); - rList.SetBreakPointsInBasic( m_xModule ); + rList.SetBreakPointsInBasic( m_xModule.get() ); for ( sal_uInt16 nMethod = 0; nMethod < m_xModule->GetMethods()->Count(); nMethod++ ) { SbMethod* pMethod = static_cast<SbMethod*>(m_xModule->GetMethods()->Get( nMethod )); @@ -1400,7 +1400,7 @@ void ModulWindow::UpdateModule () OUString const aModule = getTextEngineText(*GetEditEngine()); // update module in basic - assert(m_xModule); + assert(m_xModule.Is()); // update module in module window SetModule(aModule); diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index 23976945e3f8..c8bf2e6a53ca 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -344,9 +344,9 @@ public: virtual void SetReadOnly (bool bReadOnly) override; virtual bool IsReadOnly() override; - StarBASIC* GetBasic() { XModule(); return m_xBasic; } + StarBASIC* GetBasic() { XModule(); return m_xBasic.get(); } - SbModule* GetSbModule() { return m_xModule; } + SbModule* GetSbModule() { return m_xModule.get(); } void SetSbModule( SbModule* pModule ) { m_xModule = pModule; } OUString GetSbModuleName(); diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 57f04b0f1492..c83bc7bb70fc 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -645,7 +645,7 @@ void EditorWindow::HandleAutoCorrect() else { //autocorrect procedures - SbxArray* pArr = rModulWindow.GetSbModule()->GetMethods(); + SbxArray* pArr = rModulWindow.GetSbModule()->GetMethods().get(); for( sal_uInt32 i=0; i < pArr->Count32(); ++i ) { if( pArr->Get32(i)->GetName().equalsIgnoreAsciiCase( sStr ) ) @@ -1724,7 +1724,7 @@ SbxDimArray* WatchItem::GetRootArray() WatchItem* pRootItem = GetRootItem(); SbxDimArray* pRet = nullptr; if( pRootItem ) - pRet = pRootItem->mpArray; + pRet = pRootItem->mpArray.get(); return pRet; } @@ -2132,7 +2132,7 @@ void WatchTreeListBox::RequestingChildren( SvTreeListEntry * pParent ) SvTreeListEntry* pEntry = pParent; WatchItem* pItem = static_cast<WatchItem*>(pEntry->GetUserData()); - SbxDimArray* pArray = pItem->mpArray; + SbxDimArray* pArray = pItem->mpArray.get(); SbxDimArray* pRootArray = pItem->GetRootArray(); bool bArrayIsRootArray = false; if( !pArray && pRootArray ) @@ -2141,7 +2141,7 @@ void WatchTreeListBox::RequestingChildren( SvTreeListEntry * pParent ) bArrayIsRootArray = true; } - SbxObject* pObj = pItem->mpObject; + SbxObject* pObj = pItem->mpObject.get(); if( pObj ) { createAllObjectProperties( pObj ); @@ -2231,7 +2231,7 @@ SbxBase* WatchTreeListBox::ImplGetSBXForEntry( SvTreeListEntry* pEntry, bool& rb WatchItem* pParentItem = pParentEntry ? static_cast<WatchItem*>(pParentEntry->GetUserData()) : nullptr; if( pParentItem ) { - SbxObject* pObj = pParentItem->mpObject; + SbxObject* pObj = pParentItem->mpObject.get(); SbxDimArray* pArray; if( pObj ) { @@ -2272,7 +2272,7 @@ bool WatchTreeListBox::EditingEntry( SvTreeListEntry* pEntry, Selection& ) if (IsSbxVariable(pSbx) || bArrayElement) { // Accept no objects and only end nodes of arrays for editing - if( !pItem->mpObject && (pItem->mpArray == nullptr || pItem->nDimLevel == pItem->nDimCount) ) + if( !pItem->mpObject.Is() && ( !pItem->mpArray.Is() || pItem->nDimLevel == pItem->nDimCount ) ) { aEditingRes = SvHeaderTabListBox::GetEntryText( pEntry, ITEM_ID_VALUE-1 ); aEditingRes = comphelper::string::strip(aEditingRes, ' '); @@ -2349,7 +2349,7 @@ OUString implCreateTypeStringForDimArray( WatchItem* pItem, SbxDataType eType ) { OUString aRetStr = getBasicTypeName( eType ); - SbxDimArray* pArray = pItem->mpArray; + SbxDimArray* pArray = pItem->mpArray.get(); if( !pArray ) pArray = pItem->GetRootArray(); if( pArray ) @@ -2427,7 +2427,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped ) // consider multidimensinal arrays! if (SbxDimArray* pNewArray = dynamic_cast<SbxDimArray*>(pVar->GetObject())) { - SbxDimArray* pOldArray = pItem->mpArray; + SbxDimArray* pOldArray = pItem->mpArray.get(); bool bArrayChanged = false; if( pNewArray != nullptr && pOldArray != nullptr ) @@ -2494,7 +2494,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped ) { if (SbxObject* pObj = dynamic_cast<SbxObject*>(pVar->GetObject())) { - if (pItem->mpObject && !pItem->maMemberList.empty()) + if ( pItem->mpObject.Is() && !pItem->maMemberList.empty() ) { bool bObjChanged = false; // Check if member list has changed SbxArray* pProps = pObj->GetProperties(); @@ -2522,7 +2522,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped ) else { aWatchStr = "Null"; - if( pItem->mpObject != nullptr ) + if( pItem->mpObject.Is() ) { bCollapse = true; pItem->clearWatchItem(); @@ -2533,7 +2533,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped ) } else { - if( pItem->mpObject != nullptr ) + if( pItem->mpObject.Is() ) { bCollapse = true; pItem->clearWatchItem(); @@ -2575,7 +2575,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped ) } else if( bBasicStopped ) { - if( pItem->mpObject || pItem->mpArray ) + if( pItem->mpObject.Is() || pItem->mpArray.Is() ) { implCollapseModifiedObjectEntry( pEntry, this ); pItem->mpObject = nullptr; diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index 5f41f798bc24..59c3006377ab 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -311,7 +311,7 @@ void Shell::ExecuteGlobal( SfxRequest& rReq ) pModule = pBasic->FindModule( aModName ); } else - pModule = pBasic->GetModules().front(); + pModule = pBasic->GetModules().front().get(); } DBG_ASSERT( pModule, "Kein Modul!" ); if ( pModule && !pModule->GetMethods()->Find( rInfo.GetMethod(), SbxClassType::Method ) ) diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx index 0f383e436b23..5d939a7134c0 100644 --- a/basctl/source/basicide/basobj2.cxx +++ b/basctl/source/basicide/basobj2.cxx @@ -227,7 +227,7 @@ namespace if ( pData->aDocument.isDocument() ) pUndoGuard.reset( new ::framework::DocumentUndoGuard( pData->aDocument.getDocument() ) ); - RunMethod(pData->xMethod); + RunMethod( pData->xMethod.get() ); } } @@ -374,7 +374,7 @@ Sequence< OUString > GetMethodNames( const ScriptDocument& rDocument, const OUSt { xModule = new SbModule( rModName ); xModule->SetSource32( aOUSource ); - pMod = xModule; + pMod = xModule.get(); } sal_uInt16 nCount = pMod->GetMethods()->Count(); @@ -424,9 +424,9 @@ bool HasMethod ( { xModule = new SbModule( rModName ); xModule->SetSource32( aOUSource ); - pMod = xModule; + pMod = xModule.get(); } - SbxArray* pMethods = pMod->GetMethods(); + SbxArray* pMethods = pMod->GetMethods().get(); if ( pMethods ) { SbMethod* pMethod = static_cast<SbMethod*>(pMethods->Find( rMethName, SbxClassType::Method )); diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx index a14f9847ac0a..dcbccac9efcd 100644 --- a/basctl/source/basicide/macrodlg.cxx +++ b/basctl/source/basicide/macrodlg.cxx @@ -361,7 +361,7 @@ SbMethod* MacroChooser::CreateMacro() pModule = pBasic->FindModule( aModName ); } else if ( !pBasic->GetModules().empty() ) - pModule = pBasic->GetModules().front(); + pModule = pBasic->GetModules().front().get(); if ( !pModule ) { 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; } diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx index b6c7df5ae441..5e67f52b1bff 100644 --- a/chart2/source/controller/dialogs/DataBrowser.cxx +++ b/chart2/source/controller/dialogs/DataBrowser.cxx @@ -1032,10 +1032,10 @@ bool DataBrowser::IsTabAllowed( bool bForward ) const { m_aNumberEditField->UseInputStringForFormatting(); m_aNumberEditField->SetFormatKey( GetNumberFormatKey( nRow, nCol )); - return m_rNumberEditController; + return m_rNumberEditController.get(); } - return m_rTextEditController; + return m_rTextEditController.get(); } void DataBrowser::InitController( diff --git a/dbaccess/source/ui/misc/TableCopyHelper.cxx b/dbaccess/source/ui/misc/TableCopyHelper.cxx index 527072d59c04..40ce52a4a74a 100644 --- a/dbaccess/source/ui/misc/TableCopyHelper.cxx +++ b/dbaccess/source/ui/misc/TableCopyHelper.cxx @@ -242,7 +242,7 @@ bool OTableCopyHelper::copyTagTable(OTableCopyHelper::DropDescriptor& _rDesc, bo pImport = new ORTFImportExport(_xConnection,getNumberFormatter(_xConnection, m_pController->getORB()),m_pController->getORB()); xEvt = pImport; - SvStream* pStream = static_cast<SvStream*>(static_cast<SotStorageStream*>(_rDesc.aHtmlRtfStorage)); + SvStream* pStream = static_cast<SvStream*>(_rDesc.aHtmlRtfStorage.get()); if ( _bCheck ) pImport->enableCheckOnly(); @@ -288,7 +288,7 @@ bool OTableCopyHelper::copyTagTable(const TransferableDataHelper& _aDroppedData _rAsyncDrop.aUrl = aTmp.GetURL(); ::tools::SvRef<SotStorageStream> aNew = new SotStorageStream( aTmp.GetFileName() ); _rAsyncDrop.aHtmlRtfStorage->Seek(STREAM_SEEK_TO_BEGIN); - _rAsyncDrop.aHtmlRtfStorage->CopyTo( aNew ); + _rAsyncDrop.aHtmlRtfStorage->CopyTo( aNew.get() ); aNew->Commit(); _rAsyncDrop.aHtmlRtfStorage = aNew; } diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 60e6ea3b62ec..4f26fc9287df 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -1162,7 +1162,7 @@ bool OSelectionBrowseBox::SaveModified() bAppendRow = true; } } - if(!bError && Controller()) + if( !bError && Controller().Is() ) Controller()->ClearModified(); RowModified(GetCurRow(), GetCurColumnId()); diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 2ba8dfd20a31..92e887d7e1fd 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -6792,7 +6792,7 @@ bool SvxMSDffManager::ConvertToOle2( SvStream& rStm, sal_uInt32 nReadLen, if( ERRCODE_NONE == GraphicConverter::Import( rStm, aGraphic ) && aGraphic.GetType() != GraphicType::NONE ) { const GDIMetaFile& rMtf = aGraphic.GetGDIMetaFile(); - MakeContentStream( rDest, rMtf ); + MakeContentStream( rDest.get(), rMtf ); bMtfRead = true; } // set behind the data @@ -6805,7 +6805,7 @@ bool SvxMSDffManager::ConvertToOle2( SvStream& rStm, sal_uInt32 nReadLen, if( !bMtfRead && pMtf ) { - MakeContentStream( rDest, *pMtf ); + MakeContentStream( rDest.get(), *pMtf ); return true; } @@ -6947,7 +6947,7 @@ css::uno::Reference < css::embed::XEmbeddedObject > SvxMSDffManager::CheckForCo { SfxFilterMatcher aMatch( sStarName ); tools::SvRef<SotStorage> xStorage = new SotStorage( false, *xMemStream ); - rSrcStg.CopyTo( xStorage ); + rSrcStg.CopyTo( xStorage.get() ); xStorage->Commit(); xStorage.Clear(); OUString aType = SfxFilter::GetTypeFromStorage( rSrcStg ); @@ -7146,7 +7146,7 @@ SdrOle2Obj* SvxMSDffManager::CreateSdrOLEFromStorage( if ( xObjStor.Is() ) { tools::SvRef<SotStorage> xSrcStor = rSrcStorage->OpenSotStorage( rStorageName, StreamMode::READ ); - xSrcStor->CopyTo( xObjStor ); + xSrcStor->CopyTo( xObjStor.get() ); if( !xObjStor->GetError() ) xObjStor->Commit(); diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 01b3366e2fd1..479c374fd665 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -1901,7 +1901,7 @@ SdrObject* SdrPowerPointImport::ImportOLE( long nOLEId, tools::SvRef<SotStorage> xTarget = SotStorage::OpenOLEStorage( pOe->pShell->GetStorage(), aNm, StreamMode::READWRITE ); if ( xObjStor.Is() && xTarget.Is() ) { - xObjStor->CopyTo( xTarget ); + xObjStor->CopyTo( xTarget.get() ); if( !xTarget->GetError() ) xTarget->Commit(); } @@ -2034,7 +2034,7 @@ void SdrPowerPointImport::SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOpt for ( i = 0; i < aList.size(); i++ ) // copy all entries { const SvStorageInfo& rInfo = aList[ i ]; - if ( !xSource->CopyTo( rInfo.GetName(), xMacros, rInfo.GetName() ) ) + if ( !xSource->CopyTo( rInfo.GetName(), xMacros.get(), rInfo.GetName() ) ) bCopied = false; } if ( i && bCopied ) diff --git a/filter/source/msfilter/svxmsbas2.cxx b/filter/source/msfilter/svxmsbas2.cxx index e9aa27764f91..1ea178aed5a7 100644 --- a/filter/source/msfilter/svxmsbas2.cxx +++ b/filter/source/msfilter/svxmsbas2.cxx @@ -47,7 +47,7 @@ ErrCode SvxImportMSVBasic::SaveOrDelMSVBAStorage( bool bSaveInto, #endif tools::SvRef<SotStorage> xSrc = SotStorage::OpenOLEStorage( xSrcRoot, aDstStgName, StreamMode::STD_READ ); tools::SvRef<SotStorage> xDst = xRoot->OpenSotStorage( rStorageName, StreamMode::READWRITE | StreamMode::TRUNC ); - xSrc->CopyTo( xDst ); + xSrc->CopyTo( xDst.get() ); xDst->Commit(); ErrCode nError = xDst->GetError(); if ( nError == ERRCODE_NONE ) diff --git a/idl/inc/basobj.hxx b/idl/inc/basobj.hxx index d6adb8d809ad..44de0278c36b 100644 --- a/idl/inc/basobj.hxx +++ b/idl/inc/basobj.hxx @@ -121,7 +121,7 @@ public: : aRef->GetName(); } - SvMetaReference * GetRef() const { return aRef; } + SvMetaReference * GetRef() const { return aRef.get(); } void SetRef( SvMetaReference * pRef ) { aRef = pRef; } }; diff --git a/idl/inc/globals.hxx b/idl/inc/globals.hxx index e49e81ef07f5..ad8aee0c2e45 100644 --- a/idl/inc/globals.hxx +++ b/idl/inc/globals.hxx @@ -88,7 +88,7 @@ inline SvStringHashEntry * SvHash_##Name() \ { \ if( !GetIdlApp().pGlobalNames ) \ GetIdlApp().pGlobalNames = new SvGlobalHashNames(); \ - return GetIdlApp().pGlobalNames->MM_##Name; \ + return GetIdlApp().pGlobalNames->MM_##Name.get(); \ } HASH_INLINE(module) diff --git a/idl/inc/object.hxx b/idl/inc/object.hxx index d6c39055973a..6c8c90b3a74a 100644 --- a/idl/inc/object.hxx +++ b/idl/inc/object.hxx @@ -43,7 +43,7 @@ public: void SetClass( SvMetaClass * pClass ) { xClass = pClass; } SvMetaClass * GetClass() const - { return xClass; } + { return xClass.get(); } }; diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx index efa7f17bef5b..7b0e648e7a41 100644 --- a/idl/source/objects/object.cxx +++ b/idl/source/objects/object.cxx @@ -91,7 +91,7 @@ void SvMetaClass::ReadContextSvIdl( SvIdlDataBase & rBase, aI.SetValue( rBase.GetUniqueId() ); xAttr->SetSlotId( aI ); } - aAttrList.push_back( xAttr ); + aAttrList.push_back( xAttr.get() ); return; } } @@ -129,7 +129,7 @@ bool SvMetaClass::TestAttribute( SvIdlDataBase & rBase, SvTokenStream & rInStm, } } } - SvMetaClass * pSC = aSuperClass; + SvMetaClass * pSC = aSuperClass.get(); if( pSC ) return pSC->TestAttribute( rBase, rInStm, rAttr ); return true; diff --git a/idl/source/objects/slot.cxx b/idl/source/objects/slot.cxx index a4df0c89dbb1..d72e996eba68 100644 --- a/idl/source/objects/slot.cxx +++ b/idl/source/objects/slot.cxx @@ -110,12 +110,12 @@ OString SvMetaSlot::GetMangleName() const /** reference disbandment **/ SvMetaType * SvMetaSlot::GetSlotType() const { - if( aSlotType.Is() || !GetRef() ) return aSlotType; + if( aSlotType.Is() || !GetRef() ) return aSlotType.get(); return static_cast<SvMetaSlot *>(GetRef())->GetSlotType(); } SvMetaAttribute * SvMetaSlot::GetMethod() const { - if( aMethod.Is() || !GetRef() ) return aMethod; + if( aMethod.Is() || !GetRef() ) return aMethod.get(); return static_cast<SvMetaSlot *>(GetRef())->GetMethod(); } const OString& SvMetaSlot::GetGroupId() const @@ -510,7 +510,7 @@ void SvMetaSlot::Insert( SvSlotElementList& rList, const OString& rPrefix, xEnumSlot->SetEnumValue(enumValue); if ( !pFirstEnumSlot || xEnumSlot->GetSlotId().GetValue() < pFirstEnumSlot->GetSlotId().GetValue() ) - pFirstEnumSlot = xEnumSlot; + pFirstEnumSlot = xEnumSlot.get(); // insert the created slave as well xEnumSlot->Insert( rList, rPrefix, rBase); diff --git a/idl/source/objects/types.cxx b/idl/source/objects/types.cxx index d40230a5b2e1..ca5bb4d01844 100644 --- a/idl/source/objects/types.cxx +++ b/idl/source/objects/types.cxx @@ -39,7 +39,7 @@ SvMetaAttribute::SvMetaAttribute( SvMetaType * pType ) SvMetaType * SvMetaAttribute::GetType() const { - if( aType.Is() || !GetRef() ) return aType; + if( aType.Is() || !GetRef() ) return aType.get(); return static_cast<SvMetaAttribute *>(GetRef())->GetType(); } @@ -208,7 +208,7 @@ void SvMetaType::ReadContextSvIdl( SvIdlDataBase & rBase, if( xAttr->ReadSvIdl( rBase, rInStm ) ) { if( xAttr->Test( rInStm ) ) - GetAttrList().push_back( xAttr ); + GetAttrList().push_back( xAttr.get() ); } } diff --git a/idl/source/prj/parser.cxx b/idl/source/prj/parser.cxx index 43bc649dfec6..d21e334a3c51 100644 --- a/idl/source/prj/parser.cxx +++ b/idl/source/prj/parser.cxx @@ -40,7 +40,7 @@ void SvIdlParser::ReadSvIdl( const OUString & rPath ) Read( SvHash_module() ); tools::SvRef<SvMetaModule> aModule = new SvMetaModule; ReadModuleHeader(*aModule); - rBase.GetModuleList().push_back( aModule ); + rBase.GetModuleList().push_back( aModule.get() ); } } @@ -119,7 +119,7 @@ void SvIdlParser::ReadModuleElement( SvMetaModule& rModule ) if( xSlot->Test( rInStm ) ) { // announce globally - rBase.AppendSlot( xSlot ); + rBase.AppendSlot( xSlot.get() ); } } } @@ -192,7 +192,7 @@ void SvIdlParser::ReadStruct() if( !rBase.FindId( xAttr->aSlotId.getString(), &n ) ) throw SvParseException( rInStm, "no value for identifier <" + xAttr->aSlotId.getString() + "> " ); xAttr->aSlotId.SetValue(n); - xStruct->GetAttrList().push_back( xAttr ); + xStruct->GetAttrList().push_back( xAttr.get() ); if( !ReadIfDelimiter() ) break; if( rInStm.GetToken().IsChar() && rInStm.GetToken().GetChar() == '}') @@ -201,7 +201,7 @@ void SvIdlParser::ReadStruct() Read( '}' ); ReadDelimiter(); // announce globally - rBase.GetTypeList().push_back( xStruct ); + rBase.GetTypeList().push_back( xStruct.get() ); } void SvIdlParser::ReadItem() @@ -211,7 +211,7 @@ void SvIdlParser::ReadItem() xItem->SetRef( ReadKnownType() ); xItem->SetName( ReadIdentifier() ); // announce globally - rBase.GetTypeList().push_back( xItem ); + rBase.GetTypeList().push_back( xItem.get() ); } void SvIdlParser::ReadEnum() @@ -229,7 +229,7 @@ void SvIdlParser::ReadEnum() } Read( '}' ); // announce globally - rBase.GetTypeList().push_back( xEnum ); + rBase.GetTypeList().push_back( xEnum.get() ); } static OString getCommonSubPrefix(const OString &rA, const OString &rB) @@ -258,7 +258,7 @@ void SvIdlParser::ReadEnumValue( SvMetaTypeEnum& rEnum ) { rEnum.aPrefix = getCommonSubPrefix(rEnum.aPrefix, aEnumVal->GetName()); } - rEnum.aEnumValueList.push_back( aEnumVal ); + rEnum.aEnumValueList.push_back( aEnumVal.get() ); } void SvIdlParser::ReadInterfaceOrShell( SvMetaModule& rModule, MetaTypeType aMetaTypeType ) @@ -284,9 +284,9 @@ void SvIdlParser::ReadInterfaceOrShell( SvMetaModule& rModule, MetaTypeType aMet } Read( '}' ); } - rModule.aClassList.push_back( aClass ); + rModule.aClassList.push_back( aClass.get() ); // announce globally - rBase.GetClassList().push_back( aClass ); + rBase.GetClassList().push_back( aClass.get() ); } void SvIdlParser::ReadInterfaceOrShellEntry(SvMetaClass& rClass) @@ -327,7 +327,7 @@ void SvIdlParser::ReadInterfaceOrShellEntry(SvMetaClass& rClass) { if( !xAttr->GetSlotId().IsSet() ) xAttr->SetSlotId( SvIdentifier(rBase.GetUniqueId()) ); - rClass.aAttrList.push_back( xAttr ); + rClass.aAttrList.push_back( xAttr.get() ); } } } @@ -488,7 +488,7 @@ void SvIdlParser::ReadInterfaceOrShellMethod( SvMetaAttribute& rAttr ) xParamAttr->aType = ReadKnownType(); xParamAttr->SetName( ReadIdentifier() ); ReadSlotId(xParamAttr->aSlotId); - rAttr.aType->GetAttrList().push_back( xParamAttr ); + rAttr.aType->GetAttrList().push_back( xParamAttr.get() ); if (!ReadIfDelimiter()) break; } diff --git a/include/basic/sbmeth.hxx b/include/basic/sbmeth.hxx index 49f22199b37e..1eb6654b6bea 100644 --- a/include/basic/sbmeth.hxx +++ b/include/basic/sbmeth.hxx @@ -80,7 +80,7 @@ public: {} virtual ~SbIfaceMapperMethod() override; SbMethod* getImplMethod() - { return mxImplMeth; } + { return mxImplMeth.get(); } }; #endif diff --git a/include/basic/sbstar.hxx b/include/basic/sbstar.hxx index 814e47812daa..52a05181d1f4 100644 --- a/include/basic/sbstar.hxx +++ b/include/basic/sbstar.hxx @@ -116,7 +116,7 @@ public: virtual bool Call( const OUString&, SbxArray* = nullptr ) override; SbModules& GetModules() { return pModules; } - SbxObject* GetRtl() { return pRtl; } + SbxObject* GetRtl() { return pRtl.get(); } SbModule* FindModule( const OUString& ); // Run init code of all modules (including the inserted Doc-Basics) void InitAllModules( StarBASIC* pBasicNotToInit = nullptr ); diff --git a/include/basic/sbxobj.hxx b/include/basic/sbxobj.hxx index 6a0cf20ca2c9..65176320dd57 100644 --- a/include/basic/sbxobj.hxx +++ b/include/basic/sbxobj.hxx @@ -74,9 +74,9 @@ public: virtual void Remove( SbxVariable* ); // Direct access on arrays - SbxArray* GetMethods() { return pMethods; } - SbxArray* GetProperties() { return pProps; } - SbxArray* GetObjects() { return pObjs; } + SbxArray* GetMethods() { return pMethods.get(); } + SbxArray* GetProperties() { return pProps.get(); } + SbxArray* GetObjects() { return pObjs.get(); } // Debugging void Dump( SvStream&, bool bDumpAll ); }; diff --git a/include/sfx2/lnkbase.hxx b/include/sfx2/lnkbase.hxx index ad5c7c3eebd8..6c81fff9b2de 100644 --- a/include/sfx2/lnkbase.hxx +++ b/include/sfx2/lnkbase.hxx @@ -105,7 +105,7 @@ protected: { if( !xObj.Is() ) GetRealObject_(); - return xObj; + return xObj.get(); } public: @@ -120,7 +120,7 @@ public: sal_uInt16 GetObjType() const { return nObjType; } void SetObj( SvLinkSource * pObj ); - SvLinkSource* GetObj() const { return xObj; } + SvLinkSource* GetObj() const { return xObj.get(); } void SetLinkSourceName( const OUString & rName ); const OUString& GetLinkSourceName() const { return aLinkName;} diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx index bc18c91fa974..bb7ffd58d883 100644 --- a/include/sfx2/viewfrm.hxx +++ b/include/sfx2/viewfrm.hxx @@ -120,8 +120,7 @@ public: SfxProgress* GetProgress() const; - SfxObjectShell* GetObjectShell() const - { return m_xObjSh; } + SfxObjectShell* GetObjectShell() const { return m_xObjSh.get(); } void LockAdjustPosSizePixel() { m_nAdjustPosPixelLock++; } diff --git a/include/svl/lckbitem.hxx b/include/svl/lckbitem.hxx index ef54a090fd8a..b6548256c559 100644 --- a/include/svl/lckbitem.hxx +++ b/include/svl/lckbitem.hxx @@ -39,7 +39,7 @@ public: virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nItemVersion) const override; virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const override; - SvLockBytes* GetValue() const { return _xVal; } + SvLockBytes* GetValue() const { return _xVal.get(); } virtual bool PutValue ( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; diff --git a/include/svx/gridctrl.hxx b/include/svx/gridctrl.hxx index c328dd9fb0bb..5e44375c0029 100644 --- a/include/svx/gridctrl.hxx +++ b/include/svx/gridctrl.hxx @@ -563,7 +563,7 @@ protected: OUString GetCurrentRowCellText(DbGridColumn* pCol,const DbGridRowRef& _rRow) const; virtual void DeleteSelectedRows(); - static bool IsValid(const DbGridRowRef& _xRow) { return _xRow && _xRow->IsValid(); } + static bool IsValid(const DbGridRowRef& _xRow) { return _xRow.Is() && _xRow->IsValid(); } // row which is currently being appended bool IsCurrentAppending() const; diff --git a/include/tools/inetmsg.hxx b/include/tools/inetmsg.hxx index 7c3748effe01..b62b53e609ef 100644 --- a/include/tools/inetmsg.hxx +++ b/include/tools/inetmsg.hxx @@ -137,7 +137,7 @@ public: } } - SvLockBytes* GetDocumentLB() const { return m_xDocLB; } + SvLockBytes* GetDocumentLB() const { return m_xDocLB.get(); } void SetDocumentLB (SvLockBytes *pDocLB) { m_xDocLB = pDocLB; } static bool ParseDateField ( diff --git a/include/tools/ref.hxx b/include/tools/ref.hxx index 170e53ae7837..30abab3e5a29 100644 --- a/include/tools/ref.hxx +++ b/include/tools/ref.hxx @@ -98,7 +98,8 @@ public: T & operator *() const { assert(pObj != nullptr); return *pObj; } - operator T *() const { return pObj; } + bool operator ==(const SvRef<T> &rhs) const { return pObj == rhs.pObj; } + bool operator !=(const SvRef<T> &rhs) const { return !(*this == rhs); } protected: T * pObj; @@ -203,7 +204,7 @@ public: ~SvCompatWeakBase() { _xHdl->ResetWeakBase(); } - SvCompatWeakHdl<T>* GetHdl() { return _xHdl; } + SvCompatWeakHdl<T>* GetHdl() { return _xHdl.get(); } }; /** We only have one weak reference in LO, in include/sfx2/frame.hxx, class SfxFrameWeak. diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx index 1268eab0338f..44af335b2e0e 100644 --- a/include/tools/stream.hxx +++ b/include/tools/stream.hxx @@ -205,7 +205,7 @@ public: SvStream( SvLockBytes *pLockBytes); virtual ~SvStream(); - SvLockBytes* GetLockBytes() const { return m_xLockBytes; } + SvLockBytes* GetLockBytes() const { return m_xLockBytes.get(); } sal_uInt32 GetError() const { return ERRCODE_TOERROR(m_nError); } sal_uInt32 GetErrorCode() const { return m_nError; } diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx index f1fe0d224470..d1f933c12c99 100644 --- a/reportdesign/source/filter/xml/xmlfilter.cxx +++ b/reportdesign/source/filter/xml/xmlfilter.cxx @@ -449,7 +449,7 @@ bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) tools::SvRef<SfxMedium> pMedium = new SfxMedium( sFileName, ( StreamMode::READ | StreamMode::NOCREATE ) ); - if( pMedium ) + if( pMedium.Is() ) { try { diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx index 5475a1977987..d757587b18d4 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -484,7 +484,7 @@ bool OFieldExpressionControl::SaveModified() m_pParent->m_pController->getUndoManager().LeaveListAction(); } - if ( Controller() ) + if ( Controller().Is() ) Controller()->ClearModified(); if ( GetRowCount() == m_pParent->getGroups()->getCount() ) { diff --git a/sc/qa/unit/bugfix-test.cxx b/sc/qa/unit/bugfix-test.cxx index 9a22d48abef2..6213593868b2 100644 --- a/sc/qa/unit/bugfix-test.cxx +++ b/sc/qa/unit/bugfix-test.cxx @@ -194,7 +194,7 @@ void ScFiltersTest::testTdf91979() CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); ScDocShellRef xDocSh = dynamic_cast<ScDocShell*>(pFoundShell); - CPPUNIT_ASSERT(xDocSh != nullptr); + CPPUNIT_ASSERT(xDocSh.get() != nullptr); // Get the document controller ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false); diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx index 8f7b95934485..1a27357f4f35 100644 --- a/sc/qa/unit/copy_paste_test.cxx +++ b/sc/qa/unit/copy_paste_test.cxx @@ -111,7 +111,7 @@ void ScCopyPasteTest::testCopyPasteXLS() CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); xDocSh = dynamic_cast<ScDocShell*>(pFoundShell); - CPPUNIT_ASSERT(xDocSh != nullptr); + CPPUNIT_ASSERT(xDocSh.get() != nullptr); // Get the document controller pViewShell = xDocSh->GetBestViewShell(false); @@ -169,7 +169,7 @@ void ScCopyPasteTest::testTdf84411() CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); ScDocShellRef xDocSh = dynamic_cast<ScDocShell*>(pFoundShell); - CPPUNIT_ASSERT(xDocSh != nullptr); + CPPUNIT_ASSERT(xDocSh.get() != nullptr); uno::Reference< frame::XModel2 > xModel2 ( xDocSh->GetModel(), UNO_QUERY ); CPPUNIT_ASSERT( xModel2.is() ); diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 0f19e5904883..9c451752d3cb 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -425,7 +425,7 @@ void ScExportTest::testColorScaleExportODS() ScDocShellRef xShell = loadDoc("colorscale.", FORMAT_ODS); CPPUNIT_ASSERT(xShell.Is()); - ScDocShellRef xDocSh = saveAndReload(xShell, FORMAT_ODS); + ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_ODS); CPPUNIT_ASSERT(xDocSh.Is()); ScDocument& rDoc = xDocSh->GetDocument(); @@ -441,7 +441,7 @@ void ScExportTest::testColorScaleExportXLSX() ScDocShellRef xShell = loadDoc("colorscale.", FORMAT_XLSX); CPPUNIT_ASSERT(xShell.Is()); - ScDocShellRef xDocSh = saveAndReload(xShell, FORMAT_XLSX); + ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.Is()); ScDocument& rDoc = xDocSh->GetDocument(); @@ -457,7 +457,7 @@ void ScExportTest::testDataBarExportODS() ScDocShellRef xShell = loadDoc("databar.", FORMAT_ODS); CPPUNIT_ASSERT(xShell.Is()); - ScDocShellRef xDocSh = saveAndReload(xShell, FORMAT_ODS); + ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_ODS); CPPUNIT_ASSERT(xDocSh.Is()); ScDocument& rDoc = xDocSh->GetDocument(); @@ -472,7 +472,7 @@ void ScExportTest::testFormatExportODS() ScDocShellRef xShell = loadDoc("formats.", FORMAT_ODS); CPPUNIT_ASSERT(xShell.Is()); - ScDocShellRef xDocSh = saveAndReload(xShell, FORMAT_ODS); + ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_ODS); CPPUNIT_ASSERT(xDocSh.Is()); ScDocument& rDoc = xDocSh->GetDocument(); @@ -790,7 +790,7 @@ void ScExportTest::testDataBarExportXLSX() ScDocShellRef xShell = loadDoc("databar.", FORMAT_XLSX); CPPUNIT_ASSERT(xShell.Is()); - ScDocShellRef xDocSh = saveAndReload(xShell, FORMAT_XLSX); + ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.Is()); ScDocument& rDoc = xDocSh->GetDocument(); @@ -932,7 +932,7 @@ void ScExportTest::testNamedRangeBugfdo62729() rDoc.DeleteTab(0); //should be still a single named range CPPUNIT_ASSERT_EQUAL(size_t(1), pNames->size()); - ScDocShellRef xDocSh = saveAndReload(xShell, FORMAT_ODS); + ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_ODS); xShell->DoClose(); CPPUNIT_ASSERT(xDocSh.Is()); @@ -1326,7 +1326,7 @@ void ScExportTest::testRichTextExportODS() } // Now, save and reload this document. - ScDocShellRef xNewDocSh = saveAndReload(xOrigDocSh, FORMAT_ODS); + ScDocShellRef xNewDocSh = saveAndReload(xOrigDocSh.get(), FORMAT_ODS); { xOrigDocSh->DoClose(); CPPUNIT_ASSERT(xNewDocSh.Is()); @@ -1346,7 +1346,7 @@ void ScExportTest::testRichTextExportODS() } // Reload the doc again, and check the content of B2 and B4. - ScDocShellRef xNewDocSh2 = saveAndReload(xNewDocSh, FORMAT_ODS); + ScDocShellRef xNewDocSh2 = saveAndReload(xNewDocSh.get(), FORMAT_ODS); { ScDocument& rDoc3 = xNewDocSh2->GetDocument(); ScFieldEditEngine* pEE = &rDoc3.GetEditEngine(); @@ -1402,7 +1402,7 @@ void ScExportTest::testRichTextExportODS() } // Reload the doc again, and check the content of B2, B4, B6 and B7. - ScDocShellRef xNewDocSh3 = saveAndReload(xNewDocSh2, FORMAT_ODS); + ScDocShellRef xNewDocSh3 = saveAndReload(xNewDocSh2.get(), FORMAT_ODS); ScDocument& rDoc4 = xNewDocSh3->GetDocument(); xNewDocSh2->DoClose(); @@ -1468,7 +1468,7 @@ void ScExportTest::testFormulaRefSheetNameODS() CPPUNIT_FAIL("Wrong formula"); } // Now, save and reload this document. - ScDocShellRef xNewDocSh = saveAndReload(xDocSh, FORMAT_ODS); + ScDocShellRef xNewDocSh = saveAndReload(xDocSh.get(), FORMAT_ODS); xDocSh->DoClose(); ScDocument& rDoc = xNewDocSh->GetDocument(); @@ -1511,7 +1511,7 @@ void ScExportTest::testCellValuesExportODS() rDoc.SetString(ScAddress(0,7,0), "=$A$6"); //A8 } // save and reload - ScDocShellRef xNewDocSh = saveAndReload(xOrigDocSh, FORMAT_ODS); + ScDocShellRef xNewDocSh = saveAndReload(xOrigDocSh.get(), FORMAT_ODS); xOrigDocSh->DoClose(); CPPUNIT_ASSERT(xNewDocSh.Is()); ScDocument& rDoc = xNewDocSh->GetDocument(); @@ -1570,7 +1570,7 @@ void ScExportTest::testCellNoteExportODS() CPPUNIT_ASSERT_MESSAGE("There should be a note at A2.", rDoc.HasNote(aPos)); } // save and reload - ScDocShellRef xNewDocSh = saveAndReload(xOrigDocSh, FORMAT_ODS); + ScDocShellRef xNewDocSh = saveAndReload(xOrigDocSh.get(), FORMAT_ODS); xOrigDocSh->DoClose(); CPPUNIT_ASSERT(xNewDocSh.Is()); ScDocument& rDoc = xNewDocSh->GetDocument(); @@ -1605,7 +1605,7 @@ void ScExportTest::testCellNoteExportXLS() CPPUNIT_ASSERT( rDoc.HasNote(ScAddress(0,2,2))); } // save and reload as XLS. - ScDocShellRef xNewDocSh = saveAndReload(xOrigDocSh, FORMAT_XLS); + ScDocShellRef xNewDocSh = saveAndReload(xOrigDocSh.get(), FORMAT_XLS); { xOrigDocSh->DoClose(); CPPUNIT_ASSERT(xNewDocSh.Is()); @@ -1660,7 +1660,7 @@ void ScExportTest::testInlineArrayXLS() ScDocShellRef xShell = loadDoc("inline-array.", FORMAT_XLS); CPPUNIT_ASSERT(xShell.Is()); - ScDocShellRef xDocSh = saveAndReload(xShell, FORMAT_XLS); + ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLS); xShell->DoClose(); CPPUNIT_ASSERT(xDocSh.Is()); @@ -1683,7 +1683,7 @@ void ScExportTest::testEmbeddedChartXLS() ScDocShellRef xShell = loadDoc("embedded-chart.", FORMAT_XLS); CPPUNIT_ASSERT(xShell.Is()); - ScDocShellRef xDocSh = saveAndReload(xShell, FORMAT_XLS); + ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLS); xShell->DoClose(); CPPUNIT_ASSERT(xDocSh.Is()); @@ -1737,7 +1737,7 @@ void ScExportTest::testFormulaReferenceXLS() ScDocShellRef xShell = loadDoc("formula-reference.", FORMAT_XLS); CPPUNIT_ASSERT(xShell.Is()); - ScDocShellRef xDocSh = saveAndReload(xShell, FORMAT_XLS); + ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLS); xShell->DoClose(); CPPUNIT_ASSERT(xDocSh.Is()); @@ -1775,7 +1775,7 @@ void ScExportTest::testSheetProtectionXLSX() ScDocShellRef xShell = loadDoc("ProtecteSheet1234Pass.", FORMAT_XLSX); CPPUNIT_ASSERT(xShell.Is()); - ScDocShellRef xDocSh = saveAndReload(xShell, FORMAT_XLSX); + ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.Is()); ScDocument& rDoc = xDocSh->GetDocument(); @@ -1857,7 +1857,7 @@ void ScExportTest::testExcelCellBorders( sal_uLong nFormatType ) } } - ScDocShellRef xNewDocSh = saveAndReload(xDocSh, nFormatType); + ScDocShellRef xNewDocSh = saveAndReload(xDocSh.get(), nFormatType); xDocSh->DoClose(); ScDocument& rDoc = xNewDocSh->GetDocument(); for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i) @@ -2178,7 +2178,7 @@ void ScExportTest::testTrackChangesSimpleXLSX() bool bGood = aTest.check(*pDoc); CPPUNIT_ASSERT_MESSAGE("Initial check failed (xls).", bGood); - ScDocShellRef xDocSh2 = saveAndReload(xDocSh, FORMAT_XLS); + ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLS); xDocSh->DoClose(); pDoc = &xDocSh2->GetDocument(); bGood = aTest.check(*pDoc); @@ -2206,7 +2206,7 @@ void ScExportTest::testTrackChangesSimpleXLSX() aTest.check(*pDoc); CPPUNIT_ASSERT_MESSAGE("Initial check failed (xlsx).", bGood); - xDocSh2 = saveAndReload(xDocSh, FORMAT_XLSX); + xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLSX); xDocSh->DoClose(); pDoc = &xDocSh2->GetDocument(); bGood = aTest.check(*pDoc); @@ -2275,7 +2275,7 @@ void ScExportTest::testSheetTabColorsXLSX() CPPUNIT_ASSERT_MESSAGE("Failed on the initial content check.", bRes); } - ScDocShellRef xDocSh2 = saveAndReload(xDocSh, FORMAT_XLSX); + ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLSX); CPPUNIT_ASSERT_MESSAGE("Failed to reload file.", xDocSh2.Is()); xDocSh->DoClose(); ScDocument& rDoc = xDocSh2->GetDocument(); @@ -2364,7 +2364,7 @@ void ScExportTest::testSharedFormulaExportXLS() CPPUNIT_ASSERT_MESSAGE("Content check on the original document failed.", bRes); } - ScDocShellRef xDocSh2 = saveAndReload(xDocSh, FORMAT_XLS); + ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLS); xDocSh->DoClose(); CPPUNIT_ASSERT_MESSAGE("Failed to reload file.", xDocSh2.Is()); @@ -2459,7 +2459,7 @@ void ScExportTest::testSharedFormulaExportXLSX() } // Save and reload, and check the content again. - ScDocShellRef xDocSh2 = saveAndReload(xDocSh, FORMAT_XLSX); + ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLSX); xDocSh->DoClose(); CPPUNIT_ASSERT_MESSAGE("Failed to load file.", xDocSh2.Is()); @@ -2530,7 +2530,7 @@ void ScExportTest::testSharedFormulaStringResultExportXLSX() CPPUNIT_ASSERT_MESSAGE("Content check on the initial recalculated document failed.", bRes); } // Reload and check again. - ScDocShellRef xDocSh2 = saveAndReload(xDocSh, FORMAT_XLSX); + ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLSX); xDocSh->DoClose(); CPPUNIT_ASSERT_MESSAGE("Failed to re-load file.", xDocSh2.Is()); ScDocument& rDoc = xDocSh2->GetDocument(); @@ -2546,7 +2546,7 @@ void ScExportTest::testFunctionsExcel2010( sal_uLong nFormatType ) ScDocShellRef xShell = loadDoc("functions-excel-2010.", FORMAT_XLSX); CPPUNIT_ASSERT_MESSAGE("Failed to load the document.", xShell.Is()); - ScDocShellRef xDocSh = saveAndReload(xShell, nFormatType); + ScDocShellRef xDocSh = saveAndReload(xShell.get(), nFormatType); ScDocument& rDoc = xDocSh->GetDocument(); rDoc.CalcAll(); // perform hard re-calculation. @@ -2570,7 +2570,7 @@ void ScExportTest::testCeilingFloor( sal_uLong nFormatType ) ScDocShellRef xShell = loadDoc("ceiling-floor.", FORMAT_XLSX); CPPUNIT_ASSERT_MESSAGE("Failed to load the document.", xShell.Is()); - ScDocShellRef xDocSh = saveAndReload(xShell, nFormatType); + ScDocShellRef xDocSh = saveAndReload(xShell.get(), nFormatType); ScDocument& rDoc = xDocSh->GetDocument(); rDoc.CalcAll(); // perform hard re-calculation. @@ -2630,7 +2630,7 @@ void ScExportTest::testSheetProtection() testSheetProtection_Impl(rDoc); } - ScDocShellRef xDocSh2 = saveAndReload(xDocSh, FORMAT_ODS); + ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_ODS); { ScDocument& rDoc = xDocSh2->GetDocument(); testSheetProtection_Impl(rDoc); @@ -2765,7 +2765,7 @@ void ScExportTest::testPivotTableXLSX() bool bCheck = aTest.check(*pDoc); CPPUNIT_ASSERT_MESSAGE("Initial check failed.", bCheck); - ScDocShellRef xDocSh2 = saveAndReload(xDocSh, FORMAT_XLSX); + ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLSX); xDocSh->DoClose(); CPPUNIT_ASSERT(xDocSh2.Is()); pDoc = &xDocSh2->GetDocument(); @@ -2885,7 +2885,7 @@ void ScExportTest::testPivotTableTwoDataFieldsXLSX() bool bCheck = aTest.check(*pDoc); CPPUNIT_ASSERT_MESSAGE("Initial check failed.", bCheck); - ScDocShellRef xDocSh2 = saveAndReload(xDocSh, FORMAT_XLSX); + ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLSX); xDocSh->DoClose(); CPPUNIT_ASSERT(xDocSh2.Is()); pDoc = &xDocSh2->GetDocument(); @@ -2925,7 +2925,7 @@ void ScExportTest::testSwappedOutImageExport() CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xDocSh.Is()); // Export the document and import again for a check - ScDocShellRef xDocSh2 = saveAndReload(xDocSh, nFilter); + ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), nFilter); xDocSh->DoClose(); // Check whether graphic exported well after it was swapped out @@ -3002,7 +3002,7 @@ void ScExportTest::testSupBookVirtualPath() ScDocShellRef xShell = loadDoc("external-ref.", FORMAT_XLS); CPPUNIT_ASSERT(xShell.Is()); - ScDocShellRef xDocSh = saveAndReload(xShell, FORMAT_XLS); + ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLS); xShell->DoClose(); CPPUNIT_ASSERT(xDocSh.Is()); @@ -3031,7 +3031,7 @@ void ScExportTest::testLinkedGraphicRT() const OString sFailedMessage = OString("Failed on filter: ") + aFilterNames[nFilter]; // Export the document and import again for a check - ScDocShellRef xDocSh2 = saveAndReload(xDocSh, nFilter); + ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), nFilter); xDocSh->DoClose(); // Check whether graphic imported well after export @@ -3075,7 +3075,7 @@ void ScExportTest::testImageWithSpecialID() CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xDocSh.Is()); // Export the document and import again for a check - ScDocShellRef xDocSh2 = saveAndReload(xDocSh, nFilter); + ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), nFilter); xDocSh->DoClose(); // Check whether graphic was exported well @@ -3129,7 +3129,7 @@ void ScExportTest::testSheetLocalRangeNameXLS() { ScDocShellRef xDocSh = loadDoc("named-ranges-local.", FORMAT_XLS); xDocSh->DoHardRecalc(true); - ScDocShellRef xDocSh2 = saveAndReload(xDocSh, FORMAT_XLS); + ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLS); xDocSh->DoClose(); xDocSh2->DoHardRecalc(true); diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index 46971e08ac8e..9eeca6d7a7f9 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -340,7 +340,7 @@ bool ScValidationData::DoMacro( const ScAddress& rPos, const OUString& rInput, if ( pCell ) pDocument->LockTable( rPos.Tab() ); SbxVariableRef refRes = new SbxVariable; - ErrCode eRet = pDocSh->CallBasic( aMacroStr.makeStringAndClear(), aBasicStr, refPar, refRes ); + ErrCode eRet = pDocSh->CallBasic( aMacroStr.makeStringAndClear(), aBasicStr, refPar.get(), refRes.get() ); if ( pCell ) pDocument->UnlockTable( rPos.Tab() ); diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 6175d8725a9a..f9b2350dda93 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -3112,8 +3112,8 @@ static bool lcl_setVBARange( ScRange& aRange, ScDocument* pDok, SbxVariable* pPa if ( xVBARange.is() ) { SbxObjectRef aObj = GetSbUnoObject( "A-Range", uno::Any( xVBARange ) ); - SetSbUnoObjectDfltPropName( aObj ); - bOk = pPar->PutObject( aObj ); + SetSbUnoObjectDfltPropName( aObj.get() ); + bOk = pPar->PutObject( aObj.get() ); } } catch( uno::Exception& ) @@ -3278,7 +3278,7 @@ void ScInterpreter::ScMacro() bOk = SetSbxVariable( p, aAdr ); } } - pPar->PutObject( refArray ); + pPar->PutObject( refArray.get() ); } } } @@ -3312,7 +3312,7 @@ void ScInterpreter::ScMacro() } } } - pPar->PutObject( refArray ); + pPar->PutObject( refArray.get() ); } else { @@ -3330,7 +3330,7 @@ void ScInterpreter::ScMacro() pDok->LockTable( aPos.Tab() ); SbxVariableRef refRes = new SbxVariable; pDok->IncMacroInterpretLevel(); - ErrCode eRet = pDocSh->CallBasic( aMacroStr, aBasicStr, refPar, refRes ); + ErrCode eRet = pDocSh->CallBasic( aMacroStr, aBasicStr, refPar.get(), refRes.get() ); pDok->DecMacroInterpretLevel(); pDok->UnlockTable( aPos.Tab() ); diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx index 73ee93ed3773..781b02549c9c 100644 --- a/sc/source/filter/excel/excel.cxx +++ b/sc/source/filter/excel/excel.cxx @@ -104,7 +104,7 @@ FltError ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument eBiff = eBookBiff; } - pBookStrm = xStrgStrm; + pBookStrm = xStrgStrm.get(); } // no "Book" or "Workbook" stream found, try plain input stream from medium (even for BIFF5+) diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index 7649c17674a1..c83ecc7409e2 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -463,7 +463,7 @@ void ImportExcel8::LoadDocumentProperties() { uno::Reference< document::XDocumentPropertiesSupplier > xDPS( pShell->GetModel(), uno::UNO_QUERY_THROW ); uno::Reference< document::XDocumentProperties > xDocProps( xDPS->getDocumentProperties(), uno::UNO_SET_THROW ); - sfx2::LoadOlePropertySet( xDocProps, xRootStrg ); + sfx2::LoadOlePropertySet( xDocProps, xRootStrg.get() ); } catch( uno::Exception& ) { diff --git a/sc/source/filter/excel/expop2.cxx b/sc/source/filter/excel/expop2.cxx index cc51946ddff6..9b77c6514507 100644 --- a/sc/source/filter/excel/expop2.cxx +++ b/sc/source/filter/excel/expop2.cxx @@ -99,7 +99,7 @@ FltError ExportBiff5::Write() if (aExport.containsVBAProject()) { tools::SvRef<SotStorage> xVBARoot = xRootStrg->OpenSotStorage("_VBA_PROJECT_CUR"); - aExport.exportVBA(xVBARoot); + aExport.exportVBA( xVBARoot.get() ); } } else if( pDocShell && xRootStrg.Is() && eVbaExportMode == VBAExportMode::REEXPORT_STREAM ) @@ -126,10 +126,10 @@ FltError ExportBiff5::Write() pDocShell->GetPreviewMetaFile(); uno::Sequence<sal_Int8> metaFile( sfx2::convertMetaFile(xMetaFile.get())); - sfx2::SaveOlePropertySet(xDocProps, xRootStrg, &metaFile); + sfx2::SaveOlePropertySet( xDocProps, xRootStrg.get(), &metaFile ); } else - sfx2::SaveOlePropertySet(xDocProps, xRootStrg ); + sfx2::SaveOlePropertySet( xDocProps, xRootStrg.get() ); } const XclExpAddressConverter& rAddrConv = GetAddressConverter(); diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index adebb97ad352..d70bee34b43f 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -1103,7 +1103,7 @@ bool XclExpXmlStream::exportDocument() { SvMemoryStream aVbaStream(4096, 4096); tools::SvRef<SotStorage> pVBAStorage(new SotStorage(aVbaStream)); - aExport.exportVBA(pVBAStorage); + aExport.exportVBA( pVBAStorage.get() ); aVbaStream.Seek(0); css::uno::Reference<css::io::XInputStream> xVBAStream( new utl::OInputStreamWrapper(aVbaStream)); diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx index 1a8e3cfee6cf..5b889cc44ce0 100644 --- a/sc/source/filter/ftools/ftools.cxx +++ b/sc/source/filter/ftools/ftools.cxx @@ -191,7 +191,7 @@ tools::SvRef<SotStorageStream> ScfTools::OpenStorageStreamRead( tools::SvRef<Sot tools::SvRef<SotStorageStream> ScfTools::OpenStorageStreamWrite( tools::SvRef<SotStorage> const & xStrg, const OUString& rStrmName ) { - OSL_ENSURE( !xStrg || !xStrg->IsContained( rStrmName ), "ScfTools::OpenStorageStreamWrite - stream exists already" ); + OSL_ENSURE( !xStrg.Is() || !xStrg->IsContained( rStrmName ), "ScfTools::OpenStorageStreamWrite - stream exists already" ); tools::SvRef<SotStorageStream> xStrm; if( xStrg.Is() ) xStrm = xStrg->OpenSotStream( rStrmName, StreamMode::STD_WRITE | StreamMode::TRUNC ); diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 11e6fe9f131c..8ab731057ca3 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -283,7 +283,7 @@ sal_uLong ScHTMLLayoutParser::Read( SvStream& rStream, const OUString& rBaseURL xValues = new SvKeyValueIterator; xValues->Append( SvKeyValue( OUString( OOO_STRING_SVTOOLS_HTML_META_content_type ), aContentType ) ); - pAttributes = xValues; + pAttributes = xValues.get(); } } @@ -2865,7 +2865,7 @@ sal_uLong ScHTMLQueryParser::Read( SvStream& rStrm, const OUString& rBaseURL ) xValues = new SvKeyValueIterator; xValues->Append( SvKeyValue( OUString( OOO_STRING_SVTOOLS_HTML_META_content_type ), aContentType ) ); - pAttributes = xValues; + pAttributes = xValues.get(); } } diff --git a/sc/source/filter/oox/worksheetsettings.cxx b/sc/source/filter/oox/worksheetsettings.cxx index 0651c455884b..a2eb39666fa3 100644 --- a/sc/source/filter/oox/worksheetsettings.cxx +++ b/sc/source/filter/oox/worksheetsettings.cxx @@ -158,7 +158,8 @@ void WorksheetSettings::importProtectedRange( const AttributeList& rAttribs ) getAddressConverter().convertToCellRangeList( aRangeList, aRefs, getSheetIndex(), true ); if (!aRangeList.empty()) { - ScRangeList* pRangeList = aProt.maRangeList = new ScRangeList; + aProt.maRangeList = new ScRangeList; + ScRangeList* pRangeList = aProt.maRangeList.get(); for (::std::vector< css::table::CellRangeAddress >::const_iterator itr( aRangeList.begin()), end( aRangeList.end()); itr != end; ++itr) { ScRange aRange; diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 8017afe57c08..991355dc9230 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -874,7 +874,7 @@ std::size_t XclTxo::GetLen() const XclObjOle::XclObjOle( XclExpObjectManager& rObjMgr, const SdrObject& rObj ) : XclObj( rObjMgr, EXC_OBJTYPE_PICTURE ), rOleObj( rObj ), - pRootStorage( rObjMgr.GetRoot().GetRootStorage() ) + pRootStorage( rObjMgr.GetRoot().GetRootStorage().get() ) { } diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index d28fea37ac85..b7f5a10e3dea 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -3387,7 +3387,7 @@ void ScXMLExport::ExportShape(const uno::Reference < drawing::XShape >& xShape, const ScRangeListRef& rRangeList = pListener->GetRangeList(); if ( rRangeList.Is() ) { - ScRangeStringConverter::GetStringFromRangeList( sRanges, rRangeList, pDoc, FormulaGrammar::CONV_OOO ); + ScRangeStringConverter::GetStringFromRangeList( sRanges, rRangeList.get(), pDoc, FormulaGrammar::CONV_OOO ); if ( !sRanges.isEmpty() ) { bIsChart = true; diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx index 69e21d8e4e49..0f7d5b257521 100644 --- a/sc/source/ui/app/drwtrans.cxx +++ b/sc/source/ui/app/drwtrans.cxx @@ -435,7 +435,7 @@ bool ScDrawTransferObj::GetData( const css::datatransfer::DataFlavor& rFlavor, c //TODO/LATER: needs new Format, because now single OLE and "this" are different InitDocShell(); // set aDocShellRef - SfxObjectShell* pEmbObj = aDocShellRef; + SfxObjectShell* pEmbObj = aDocShellRef.get(); bOK = SetObject( pEmbObj, SCDRAWTRANS_TYPE_DOCUMENT, rFlavor ); } } diff --git a/sc/source/ui/app/seltrans.cxx b/sc/source/ui/app/seltrans.cxx index 35e7542ee646..8060b1ad3be6 100644 --- a/sc/source/ui/app/seltrans.cxx +++ b/sc/source/ui/app/seltrans.cxx @@ -277,7 +277,7 @@ void ScSelectionTransferObj::CreateCellData() aDragShellRef = new ScDocShell; // DocShell needs a Ref immediately aDragShellRef->DoInitNew(); } - ScDrawLayer::SetGlobalDrawPersist(aDragShellRef); + ScDrawLayer::SetGlobalDrawPersist( aDragShellRef.get() ); ScDocument* pClipDoc = new ScDocument( SCDOCMODE_CLIP ); // bApi = sal_True -> no error messages @@ -300,7 +300,7 @@ void ScSelectionTransferObj::CreateCellData() // SetDragHandlePos is not used - there is no mouse position //? pTransferObj->SetVisibleTab( nTab ); - SfxObjectShellRef aPersistRef( aDragShellRef ); + SfxObjectShellRef aPersistRef( aDragShellRef.get() ); pTransferObj->SetDrawPersist( aPersistRef ); // keep persist for ole objects alive pTransferObj->SetDragSource( pDocSh, aNewMark ); @@ -336,7 +336,7 @@ void ScSelectionTransferObj::CreateDrawData() aDragShellRef->DoInitNew(); } - ScDrawLayer::SetGlobalDrawPersist(aDragShellRef); + ScDrawLayer::SetGlobalDrawPersist( aDragShellRef.get() ); SdrModel* pModel = pDrawView->GetMarkedObjModel(); ScDrawLayer::SetGlobalDrawPersist(nullptr); @@ -351,7 +351,7 @@ void ScSelectionTransferObj::CreateDrawData() ScDrawTransferObj* pTransferObj = new ScDrawTransferObj( pModel, pDocSh, aObjDesc ); uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj ); - SfxObjectShellRef aPersistRef( aDragShellRef ); + SfxObjectShellRef aPersistRef( aDragShellRef.get() ); pTransferObj->SetDrawPersist( aPersistRef ); // keep persist for ole objects alive pTransferObj->SetDragSource( pDrawView ); // copies selection diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index aa5df7fbec83..e8025d72c94e 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -364,7 +364,7 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt // created. InitDocShell(false); - SfxObjectShell* pEmbObj = aDocShellRef; + SfxObjectShell* pEmbObj = aDocShellRef.get(); // like SvEmbeddedTransfer::GetData: GDIMetaFile aMtf; @@ -391,7 +391,7 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt // #i123405# Do limit visual size calculation to PageSize InitDocShell(true); // set aDocShellRef - SfxObjectShell* pEmbObj = aDocShellRef; + SfxObjectShell* pEmbObj = aDocShellRef.get(); bOK = SetObject( pEmbObj, SCTRANS_TYPE_EMBOBJ, rFlavor ); } } diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index e75dca660985..ce381dee395b 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -2640,7 +2640,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos, aDragShellRef = new ScDocShell; // DocShell needs a Ref immediately aDragShellRef->DoInitNew(); } - ScDrawLayer::SetGlobalDrawPersist(aDragShellRef); + ScDrawLayer::SetGlobalDrawPersist( aDragShellRef.get() ); ScClipParam aClipParam(ScRange(nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nStartTab), bCut); rDoc.CopyToClip(aClipParam, pClipDoc, &aSourceMark, bScenariosAdded, true); diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index dcb08bad4ca6..85db59dc18b0 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -248,7 +248,7 @@ void ScDocShell::UnlockPaint_Impl(bool bDoc) pPaintLockData = nullptr; // nicht weitersammeln ScRangeListRef xRangeList = pPaint->GetRangeList(); - if (xRangeList) + if ( xRangeList.Is() ) { PaintPartFlags nParts = pPaint->GetParts(); for ( size_t i = 0, nCount = xRangeList->size(); i < nCount; i++ ) diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index fdb84ef5feb2..d3f2a4e0517f 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -2429,7 +2429,7 @@ ScDocument* ScExternalRefManager::getSrcDocument(sal_uInt16 nFileId) { // document already loaded. - SfxObjectShell* p = itr->second.maShell; + SfxObjectShell* p = itr->second.maShell.get(); itr->second.maLastAccess = tools::Time( tools::Time::SYSTEM ); return &static_cast<ScDocShell*>(p)->GetDocument(); } @@ -2440,7 +2440,7 @@ ScDocument* ScExternalRefManager::getSrcDocument(sal_uInt16 nFileId) { //document is unsaved document - SfxObjectShell* p = itr->second.maShell; + SfxObjectShell* p = itr->second.maShell.get(); itr->second.maLastAccess = tools::Time( tools::Time::SYSTEM ); return &static_cast<ScDocShell*>(p)->GetDocument(); } diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx index d2bc314226b4..1165a857cbe5 100644 --- a/sc/source/ui/pagedlg/areasdlg.cxx +++ b/sc/source/ui/pagedlg/areasdlg.cxx @@ -412,7 +412,7 @@ void ScPrintAreasDlg::Impl_FillLists() else { ScRangeListRef aList( new ScRangeList ); - pViewData->GetMarkData().FillRangeListWithMarks( aList, false ); + pViewData->GetMarkData().FillRangeListWithMarks( aList.get(), false ); aList->Format(aStrRange, ScRefFlags::RANGE_ABS, pDoc, eConv); } diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index f7eb7561ede5..79d77b8ed5a1 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -950,7 +950,7 @@ uno::Any SAL_CALL ScTabViewObj::getSelection() // bei mehreren Tabellen Ranges kopieren //! sollte eigentlich schon in ScMarkData::FillRangeListWithMarks passieren? if ( nTabs > 1 ) - rMark.ExtendRangeListTables( xRanges ); + rMark.ExtendRangeListTables( xRanges.get() ); pObj = new ScCellRangesObj( pDocSh, *xRanges ); } diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index cf2c12191738..67cafa4da83f 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -460,12 +460,12 @@ ScVbaApplication::wait( double time ) throw (uno::RuntimeException, std::excepti SbxArrayRef aArgs = new SbxArray; SbxVariableRef aRef = new SbxVariable; aRef->PutDouble( time ); - aArgs->Put( aRef, 1 ); + aArgs->Put( aRef.get(), 1 ); SbMethod* pMeth = static_cast<SbMethod*>(pBasic->GetRtl()->Find( "WaitUntil", SbxClassType::Method )); if ( pMeth ) { - pMeth->SetParameters( aArgs ); + pMeth->SetParameters( aArgs.get() ); SbxVariableRef refTemp = pMeth; // forces a broadcast SbxVariableRef pNew = new SbxMethod( *static_cast<SbxMethod*>(pMeth)); @@ -1268,7 +1268,7 @@ ScVbaApplication::Caller( const uno::Any& /*aIndex*/ ) throw ( uno::RuntimeExcep // forces a broadcast SbxVariableRef pNew = new SbxMethod( *static_cast<SbxMethod*>(pMeth)); OSL_TRACE("pNew has type %d and string value %s", pNew->GetType(), OUStringToOString( pNew->GetOUString(), RTL_TEXTENCODING_UTF8 ).getStr() ); - aRet = sbxToUnoValue( pNew ); + aRet = sbxToUnoValue( pNew.get() ); } return aRet; } diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx index 839f47d7bc7c..61fa1ab921f3 100644 --- a/sc/source/ui/view/drawvie4.cxx +++ b/sc/source/ui/view/drawvie4.cxx @@ -107,7 +107,7 @@ void ScDrawView::BeginDrag( vcl::Window* pWindow, const Point& rStartPos ) aDragShellRef = new ScDocShell; // DocShell needs a Ref immediately aDragShellRef->DoInitNew(); } - ScDrawLayer::SetGlobalDrawPersist(aDragShellRef); + ScDrawLayer::SetGlobalDrawPersist( aDragShellRef.get() ); SdrModel* pModel = GetMarkedObjModel(); ScDrawLayer::SetGlobalDrawPersist(nullptr); diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 27a7d24d4359..6d329cbcab49 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -199,7 +199,7 @@ static void lcl_DrawScenarioFrames( OutputDevice* pDev, ScViewData* pViewData, S for (SCTAB i=nTab+1; i<nTabCount && pDoc->IsScenario(i); i++) pDoc->MarkScenario( i, nTab, aMarks, false, ScScenarioFlags::ShowFrame ); ScRangeListRef xRanges = new ScRangeList; - aMarks.FillRangeListWithMarks( xRanges, false ); + aMarks.FillRangeListWithMarks( xRanges.get(), false ); bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); long nLayoutSign = bLayoutRTL ? -1 : 1; diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 614bd5f2f4be..3cb30c71f392 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -822,7 +822,7 @@ void ScViewData::GetMultiArea( ScRangeListRef& rRange ) const if (bMulti) { rRange = new ScRangeList; - aNewMark.FillRangeListWithMarks( rRange, false ); + aNewMark.FillRangeListWithMarks( rRange.get(), false ); } else { diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 9944f4465209..15291d100942 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -947,7 +947,7 @@ void ScViewFunc::SetPrintRanges( bool bEntireSheet, const OUString* pPrint, { rMark.MarkToMulti(); ScRangeListRef pList( new ScRangeList ); - rMark.FillRangeListWithMarks( pList, false ); + rMark.FillRangeListWithMarks( pList.get(), false ); for (size_t i = 0, n = pList->size(); i < n; ++i) { ScRange* pR = (*pList)[i]; diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 7081075e892e..389ed2490926 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -274,7 +274,7 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj ); if ( ScGlobal::xDrawClipDocShellRef.Is() ) { - SfxObjectShellRef aPersistRef( ScGlobal::xDrawClipDocShellRef ); + SfxObjectShellRef aPersistRef( ScGlobal::xDrawClipDocShellRef.get() ); pTransferObj->SetDrawPersist( aPersistRef );// keep persist for ole objects alive } @@ -383,7 +383,7 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b if ( ScGlobal::xDrawClipDocShellRef.Is() ) { - SfxObjectShellRef aPersistRef( ScGlobal::xDrawClipDocShellRef ); + SfxObjectShellRef aPersistRef( ScGlobal::xDrawClipDocShellRef.get() ); pTransferObj->SetDrawPersist( aPersistRef ); // keep persist for ole objects alive } @@ -921,7 +921,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, aTransShellRef = new ScDocShell; // DocShell needs a Ref immediately aTransShellRef->DoInitNew(); } - ScDrawLayer::SetGlobalDrawPersist(aTransShellRef); + ScDrawLayer::SetGlobalDrawPersist( aTransShellRef.get() ); xTransClip.reset( new ScDocument( SCDOCMODE_CLIP )); pClipDoc->TransposeClip( xTransClip.get(), nFlags, bAsLink ); diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index 56684efc5055..6903e9ae3a24 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -491,7 +491,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId, ScDocShellRef aDragShellRef( new ScDocShell ); aDragShellRef->DoInitNew(); - std::unique_ptr<FmFormModel> pModel(new FmFormModel( aPath, nullptr, aDragShellRef )); + std::unique_ptr<FmFormModel> pModel(new FmFormModel( aPath, nullptr, aDragShellRef.get() )); pModel->GetItemPool().FreezeIdRanges(); xStm->Seek(0); diff --git a/scripting/source/basprov/basmodnode.cxx b/scripting/source/basprov/basmodnode.cxx index a08def174eda..b1ee7d495790 100644 --- a/scripting/source/basprov/basmodnode.cxx +++ b/scripting/source/basprov/basmodnode.cxx @@ -79,7 +79,7 @@ namespace basprov if ( m_pModule ) { - SbxArray* pMethods = m_pModule->GetMethods(); + SbxArray* pMethods = m_pModule->GetMethods().get(); if ( pMethods ) { sal_Int32 nCount = pMethods->Count(); @@ -114,7 +114,7 @@ namespace basprov bool bReturn = false; if ( m_pModule ) { - SbxArray* pMethods = m_pModule->GetMethods(); + SbxArray* pMethods = m_pModule->GetMethods().get(); if ( pMethods && pMethods->Count() > 0 ) bReturn = true; } diff --git a/scripting/source/basprov/basscript.cxx b/scripting/source/basprov/basscript.cxx index 37a2554ac955..6e71cfbd223b 100644 --- a/scripting/source/basprov/basscript.cxx +++ b/scripting/source/basprov/basscript.cxx @@ -163,7 +163,7 @@ namespace basprov Any aReturn; - if ( m_xMethod ) + if ( m_xMethod.Is() ) { // check if compiled SbModule* pModule = static_cast< SbModule* >( m_xMethod->GetParent() ); @@ -206,8 +206,8 @@ namespace basprov 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 ) @@ -215,7 +215,7 @@ namespace basprov } } if ( xSbxParams.Is() ) - m_xMethod->SetParameters( xSbxParams ); + m_xMethod->SetParameters( xSbxParams.get() ); // call method SbxVariableRef xReturn = new SbxVariable; @@ -229,11 +229,11 @@ namespace basprov if ( m_caller.getLength() && m_caller[ 0 ].hasValue() ) { SbxVariableRef xCallerVar = new SbxVariable( SbxVARIANT ); - unoToSbxValue( static_cast< SbxVariable* >( xCallerVar ), m_caller[ 0 ] ); - nErr = m_xMethod->Call( xReturn, xCallerVar ); + unoToSbxValue( xCallerVar.get(), m_caller[ 0 ] ); + nErr = m_xMethod->Call( xReturn.get(), xCallerVar.get() ); } else - nErr = m_xMethod->Call( xReturn ); + nErr = m_xMethod->Call( xReturn.get() ); if ( m_documentBasicManager && m_xDocumentScriptContext.is() ) m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", aOldThisComponent ); @@ -259,7 +259,7 @@ namespace basprov if ( pVar ) { SbxVariableRef xVar = pVar; - aOutParamMap.insert( OutParamMap::value_type( n - 1, sbxToUnoValue( xVar ) ) ); + aOutParamMap.insert( OutParamMap::value_type( n - 1, sbxToUnoValue( xVar.get() ) ) ); } } } @@ -277,7 +277,7 @@ namespace basprov } // get return value - aReturn = sbxToUnoValue( xReturn ); + aReturn = sbxToUnoValue( xReturn.get() ); // reset parameters m_xMethod->SetParameters( nullptr ); diff --git a/sd/qa/unit/HtmlExportTest.cxx b/sd/qa/unit/HtmlExportTest.cxx index 976f3dbf2e2a..70407bc60ec6 100644 --- a/sd/qa/unit/HtmlExportTest.cxx +++ b/sd/qa/unit/HtmlExportTest.cxx @@ -23,7 +23,7 @@ private: OUString aExt = "." + OUString::createFromAscii(pFormat->pName); utl::TempFile aTempFile(OUString(), true, &aExt); aTempFile.EnableKillingFile(); - exportTo(xDocShRef, pFormat, aTempFile); + exportTo(xDocShRef.get(), pFormat, aTempFile); return parseHtml(aTempFile); } diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 402f03b254b3..db2d760065af 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -187,7 +187,7 @@ void checkFontAttributes( const SdrTextObj* pObj, ItemValue nVal) void SdOOXMLExportTest1::testBnc870233_1() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_1.pptx"), PPTX); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -213,7 +213,7 @@ void SdOOXMLExportTest1::testBnc870233_1() void SdOOXMLExportTest1::testBnc870233_2() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_2.pptx"), PPTX); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -245,7 +245,7 @@ void SdOOXMLExportTest1::testN828390_4() bool bPassed = false; ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/n828390_4.odp"), ODP ); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); { @@ -280,7 +280,7 @@ void SdOOXMLExportTest1::testN828390_5() { ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/n828390_5.odp"), ODP ); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); { @@ -300,7 +300,7 @@ void SdOOXMLExportTest1::testFdo71961() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/fdo71961.odp"), ODP); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); // Export to .pptx changes all text frames to custom shape objects, which obey TextWordWrap property @@ -328,7 +328,7 @@ void SdOOXMLExportTest1::testN828390() bool bPassed = false; ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/n828390.pptx"), PPTX ); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); { @@ -360,7 +360,7 @@ void SdOOXMLExportTest1::testN828390() void SdOOXMLExportTest1::testBnc880763() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc880763.pptx"), PPTX); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -381,7 +381,7 @@ void SdOOXMLExportTest1::testBnc880763() void SdOOXMLExportTest1::testBnc862510_5() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_5.pptx"), PPTX); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -402,7 +402,7 @@ void SdOOXMLExportTest1::testBnc862510_5() void SdOOXMLExportTest1::testBnc822347_EmptyBullet() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/bnc822347_EmptyBullet.odp"), ODP); - xDocShRef = saveAndReload(xDocShRef, PPTX); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX); SdDrawDocument* pDoc = xDocShRef->GetDoc(); SdrOutliner* pOutliner = pDoc->GetInternalOutliner(); @@ -431,7 +431,7 @@ void SdOOXMLExportTest1::testBnc822347_EmptyBullet() void SdOOXMLExportTest1::testFdo90607() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/fdo90607.pptx"), PPTX); - xDocShRef = saveAndReload(xDocShRef, PPTX); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pPage->GetObj(1) ); @@ -445,7 +445,7 @@ void SdOOXMLExportTest1::testFdo90607() void SdOOXMLExportTest1::testFdo83751() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/fdo83751.pptx"), PPTX); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr ); @@ -462,7 +462,7 @@ void SdOOXMLExportTest1::testFdo83751() void SdOOXMLExportTest1::testFdo79731() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/fdo79731.odp"), ODP); - xDocShRef = saveAndReload(xDocShRef, PPTX); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); SdDrawDocument *pDoc = xDocShRef->GetDoc(); CPPUNIT_ASSERT(pDoc); xDocShRef->DoClose(); @@ -520,7 +520,7 @@ void SdOOXMLExportTest1::testTableCellFillProperties() void SdOOXMLExportTest1::testBulletStartNumber() { ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/n90255.pptx"), PPTX ); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pPage->GetObj(0) ); @@ -535,7 +535,7 @@ void SdOOXMLExportTest1::testBulletStartNumber() void SdOOXMLExportTest1::testLineStyle() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/lineStyle.pptx"), PPTX); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); SdrObject const* pShape = pPage->GetObj(0); @@ -552,7 +552,7 @@ void SdOOXMLExportTest1::testRightToLeftParaghraph() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/rightToLeftParagraph.pptx"), PPTX); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); // Get first paragraph @@ -570,7 +570,7 @@ void SdOOXMLExportTest1::testTextboxWithHyperlink() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/hyperlinktest.pptx"), PPTX); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); // Get first paragraph @@ -596,7 +596,7 @@ void SdOOXMLExportTest1::testBulletColor() { ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bulletColor.pptx"), PPTX ); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -614,7 +614,7 @@ void SdOOXMLExportTest1::testBulletColor() void SdOOXMLExportTest1::testBulletCharAndFont() { ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/odp/bulletCharAndFont.odp"), ODP); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); uno::Reference<text::XTextRange> const xParagraph( getParagraphFromShape( 0, xShape ) ); @@ -642,7 +642,7 @@ void SdOOXMLExportTest1::testBulletCharAndFont() void SdOOXMLExportTest1::testBulletMarginAndIndentation() { ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/bulletMarginAndIndent.pptx"), PPTX ); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -663,7 +663,7 @@ void SdOOXMLExportTest1::testParaMarginAndindentation() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/paraMarginAndIndentation.pptx"), PPTX); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); // Get first paragraph @@ -684,7 +684,7 @@ void SdOOXMLExportTest1::testParaMarginAndindentation() void SdOOXMLExportTest1::testCellLeftAndRightMargin() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/n90223.pptx"), PPTX); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); sal_Int32 nLeftMargin, nRightMargin; const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -715,7 +715,7 @@ void SdOOXMLExportTest1::testCellLeftAndRightMargin() void SdOOXMLExportTest1::testMergedCells() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/cellspan.odp"), ODP); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); sdr::table::SdrTableObj *pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0)); @@ -732,7 +732,7 @@ void SdOOXMLExportTest1::testMergedCells() void SdOOXMLExportTest1::testTableCellBorder() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/n90190.pptx"), PPTX); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); const SdrPage *pPage = GetPage( 1, xDocShRef ); diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index fdf5d0453460..4bc7585d9b3d 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -161,7 +161,7 @@ public: void SdOOXMLExportTest2::testTdf93883() { ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf93883.odp"), ODP); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); uno::Reference<text::XTextRange> const xParagraph( getParagraphFromShape( 0, xShape ) ); uno::Reference< beans::XPropertySet > xPropSet( xParagraph, uno::UNO_QUERY_THROW ); @@ -175,7 +175,7 @@ void SdOOXMLExportTest2::testBnc822341() // Check import / export of embedded text document ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/bnc822341.odp"), ODP); utl::TempFile tempFile1; - xDocShRef = saveAndReload( xDocShRef, PPTX, &tempFile1 ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile1 ); // Export an LO specific ole object (imported from an ODP document) { @@ -197,7 +197,7 @@ void SdOOXMLExportTest2::testBnc822341() "progId", "Word.Document.12"); - const SdrPage *pPage = GetPage( 1, xDocShRef ); + const SdrPage *pPage = GetPage( 1, xDocShRef.get() ); const SdrObject* pObj = dynamic_cast<SdrObject*>( pPage->GetObj(0) ); CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr); @@ -205,7 +205,7 @@ void SdOOXMLExportTest2::testBnc822341() } utl::TempFile tempFile2; - xDocShRef = saveAndReload( xDocShRef, PPTX, &tempFile2 ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile2 ); // Export an MS specific ole object (imported from a PPTX document) { @@ -246,7 +246,7 @@ void SdOOXMLExportTest2::testMathObject() // Check import / export of math object ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/math.odp"), ODP); utl::TempFile tempFile1; - xDocShRef = saveAndReload(xDocShRef, PPTX, &tempFile1); + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile1); // Export an LO specific ole object (imported from an ODP document) { @@ -266,7 +266,7 @@ void SdOOXMLExportTest2::testMathObject() } utl::TempFile tempFile2; - xDocShRef = saveAndReload( xDocShRef, PPTX, &tempFile2 ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile2 ); // Export an MS specific ole object (imported from a PPTX document) { @@ -293,7 +293,7 @@ void SdOOXMLExportTest2::testMathObjectPPT2010() // Check import / export of math object ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/Math.pptx"), PPTX); utl::TempFile tempFile1; - xDocShRef = saveAndReload(xDocShRef, PPTX, &tempFile1); + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile1); // Export an MS specific ole object (imported from a PPTX document) { @@ -318,7 +318,7 @@ void SdOOXMLExportTest2::testMathObjectPPT2010() void SdOOXMLExportTest2::testTdf80224() { ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf80224.odp"), ODP); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); uno::Reference<text::XTextRange> const xParagraph( getParagraphFromShape( 0, xShape ) ); @@ -345,7 +345,7 @@ void SdOOXMLExportTest2::testTdf91378() OUString propValue; xUDProps->getPropertyValue("Testing") >>= propValue; CPPUNIT_ASSERT(propValue.isEmpty()); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); } xDocShRef->DoClose(); } @@ -394,7 +394,7 @@ bool checkTransitionOnPage(uno::Reference<drawing::XDrawPagesSupplier> const & x void SdOOXMLExportTest2::testExportTransitionsPPTX() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/AllTransitions.odp"), ODP); - xDocShRef = saveAndReload(xDocShRef, PPTX); + xDocShRef = saveAndReload(xDocShRef.get(), PPTX); uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW); // WIPE TRANSITIONS @@ -499,7 +499,7 @@ void SdOOXMLExportTest2::testPresetShapesExport() }; utl::TempFile tempFile; - xDocShRef = saveAndReload( xDocShRef, PPTX, &tempFile ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile ); xmlDocPtr pXmlDocCT = parseExport(tempFile, "ppt/slides/slide1.xml"); const OString sPattern( "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom[@prst='_T_']/a:avLst/a:gd[_N_]" ); @@ -539,7 +539,7 @@ void SdOOXMLExportTest2::testTdf92527() uno::Reference<beans::XPropertySet> xPropertySet1(xShape1, uno::UNO_QUERY); xPropertySet1->setPropertyValue("CustomShapeGeometry", uno::makeAny(aShapeGeometry)); - xDocShRef = saveAndReload(xDocShRef, PPTX); + xDocShRef = saveAndReload(xDocShRef.get(), PPTX); uno::Reference<drawing::XDrawPagesSupplier> xDoc2(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW); uno::Reference<drawing::XDrawPage> xPage2(xDoc2->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW); @@ -605,7 +605,7 @@ void SdOOXMLExportTest2::testDatetimeFieldNumberFormat() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/numfmt.odp"), ODP); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); for(sal_uInt16 i = 0; i <= 6; ++i) { @@ -619,7 +619,7 @@ void SdOOXMLExportTest2::testDatetimeFieldNumberFormatPPTX() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/numfmt.pptx"), PPTX); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); for(sal_uInt16 i = 0; i <= 6; ++i) { @@ -633,7 +633,7 @@ void SdOOXMLExportTest2::testSlideNumberField() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/slidenum_field.odp"), ODP); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 0, xDocShRef); CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() ); @@ -645,7 +645,7 @@ void SdOOXMLExportTest2::testSlideNumberFieldPPTX() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/slidenum_field.pptx"), PPTX); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 0, xDocShRef); CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() ); @@ -657,7 +657,7 @@ void SdOOXMLExportTest2::testSlideCountField() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/slidecount_field.odp"), ODP); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 0, xDocShRef); CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() ); @@ -669,7 +669,7 @@ void SdOOXMLExportTest2::testSlideNameField() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/slidename_field.odp"), ODP); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 0, xDocShRef); CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() ); @@ -681,7 +681,7 @@ void SdOOXMLExportTest2::testExtFileField() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/extfile_field.odp"), ODP); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); for(sal_uInt16 i = 0; i <= 3; ++i) { @@ -714,7 +714,7 @@ void SdOOXMLExportTest2::testAuthorField() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/author_field.odp"), ODP); - xDocShRef = saveAndReload( xDocShRef, PPTX ); + xDocShRef = saveAndReload( xDocShRef.get(), PPTX ); uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 0, xDocShRef); CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() ); @@ -725,7 +725,7 @@ void SdOOXMLExportTest2::testAuthorField() void SdOOXMLExportTest2::testTdf99224() { sd::DrawDocShellRef xShell = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/tdf99224.odp"), ODP); - xShell = saveAndReload(xShell, PPTX); + xShell = saveAndReload(xShell.get(), PPTX); uno::Reference<drawing::XDrawPage> xPage = getPage(0, xShell); // This was 0: the image with text was lost on export. CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xPage->getCount()); diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 5ecb651313d9..014720e1f7d6 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -141,7 +141,7 @@ void SdExportTest::testN821567() OUString bgImage; ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/n821567.pptx"), PPTX ); - xDocShRef = saveAndReload( xDocShRef, ODP ); + xDocShRef = saveAndReload( xDocShRef.get(), ODP ); uno::Reference< drawing::XDrawPagesSupplier > xDoc( xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW ); CPPUNIT_ASSERT_MESSAGE( "not exactly one page", xDoc->getDrawPages()->getCount() == 1 ); @@ -185,7 +185,7 @@ void checkFontAttributes( const SdrTextObj* pObj, ItemValue nVal) void SdExportTest::testTransparentBackground() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/transparent_background.odp"), ODP); - xDocShRef = saveAndReload( xDocShRef, ODP ); + xDocShRef = saveAndReload( xDocShRef.get(), ODP ); const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -206,7 +206,7 @@ void SdExportTest::testMediaEmbedding() ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/media_embedding.odp"), ODP); #if HAVE_FEATURE_GLTF - xDocShRef = saveAndReload( xDocShRef, ODP ); + xDocShRef = saveAndReload( xDocShRef.get(), ODP ); #endif const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -236,7 +236,7 @@ void SdExportTest::testMediaEmbedding() void SdExportTest::testFdo84043() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/fdo84043.odp"), ODP); - xDocShRef = saveAndReload( xDocShRef, ODP ); + xDocShRef = saveAndReload( xDocShRef.get(), ODP ); // the bug was duplicate attributes, causing crash in a build with asserts const SdrPage *pPage = GetPage( 1, xDocShRef ); @@ -356,7 +356,7 @@ void SdExportTest::testTdf80020() uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("graphics"), uno::UNO_QUERY); uno::Reference<style::XStyle> xStyle(xStyleFamily->getByName("Test Style"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("text"), xStyle->getParentStyle()); - xDocShRef = saveAndReload( xDocShRef, ODP ); + xDocShRef = saveAndReload( xDocShRef.get(), ODP ); } uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xDocShRef->GetModel(), uno::UNO_QUERY); uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); @@ -516,7 +516,7 @@ void SdExportTest::testTdf62176() CPPUNIT_ASSERT_EQUAL(OUString("Hello World"), xParagraph->getString()); //Saving and Reloading the file - xDocShRef = saveAndReload(xDocShRef, ODP); + xDocShRef = saveAndReload( xDocShRef.get(), ODP ); uno::Reference<drawing::XDrawPage> xPage2( getPage(0, xDocShRef ) ); //there should be only *one* shape CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xPage2->getCount()); @@ -542,7 +542,7 @@ void SdExportTest::testEmbeddedPdf() { #if HAVE_FEATURE_PDFIMPORT sd::DrawDocShellRef xShell = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/embedded-pdf.odp"), ODP); - xShell = saveAndReload(xShell, ODP); + xShell = saveAndReload( xShell.get(), ODP ); uno::Reference<drawing::XDrawPage> xPage = getPage(0, xShell); uno::Reference<beans::XPropertySet> xShape(xPage->getByIndex(0), uno::UNO_QUERY); OUString aReplacementGraphicURL; diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index fb5c5e67540e..c85fda8f5cfe 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -237,7 +237,7 @@ void SdImportTest::testDocumentLayout() sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc( "/sd/qa/unit/data/" ) + OUString::createFromAscii( aFilesToCompare[i].pInput ), aFilesToCompare[i].nFormat ); if( aFilesToCompare[i].nExportType >= 0 ) - xDocShRef = saveAndReload( xDocShRef, aFilesToCompare[i].nExportType ); + xDocShRef = saveAndReload( xDocShRef.get(), aFilesToCompare[i].nExportType ); compareWithShapesDump( xDocShRef, m_directories.getPathFromSrc( "/sd/qa/unit/data/" ) + OUString::createFromAscii( aFilesToCompare[i].pDump ), i == nUpdateMe ); diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index 6726f3736d9e..4a061d0b133b 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -483,7 +483,7 @@ SdDrawDocument* SdDrawDocument::AllocSdDrawDocument() const mpCreatingTransferable->SetDocShell( new ::sd::GraphicDocShell( SfxObjectCreateMode::EMBEDDED, true, meDocType ) ); - pNewDocSh = static_cast< ::sd::DrawDocShell*>( pObj = mpCreatingTransferable->GetDocShell() ); + pNewDocSh = static_cast< ::sd::DrawDocShell*>( pObj = mpCreatingTransferable->GetDocShell().get() ); pNewDocSh->DoInitNew(); pNewModel = pNewDocSh->GetDoc(); diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx index 8d6cf4d51988..96556e6280a7 100644 --- a/sd/source/filter/eppt/eppt.cxx +++ b/sd/source/filter/eppt/eppt.cxx @@ -531,12 +531,12 @@ bool PPTWriter::ImplCreateDocumentSummaryInformation() { aThumbSeq = *o3tl::doAccess<uno::Sequence<sal_Int8>>(mAny); } - sfx2::SaveOlePropertySet( xDocProps, mrStg, + sfx2::SaveOlePropertySet( xDocProps, mrStg.get(), &aThumbSeq, &aGuidSeq, &aHyperSeq); } else { - sfx2::SaveOlePropertySet( xDocProps, mrStg, + sfx2::SaveOlePropertySet( xDocProps, mrStg.get(), nullptr, &aGuidSeq, &aHyperSeq ); } } @@ -1268,7 +1268,7 @@ void PPTWriter::ImplWriteOLE( ) OUString aPersistStream( SVEXT_PERSIST_STREAM ); SvMemoryStream aStream; tools::SvRef<SotStorage> xCleanStorage( new SotStorage( false, aStream ) ); - xTempStorage->CopyTo( xCleanStorage ); + xTempStorage->CopyTo( xCleanStorage.get() ); // create a dummy content stream, the dummy content is necessary for ppt, but not for // doc files, so we can't share code. tools::SvRef<SotStorageStream> xStm = xCleanStorage->OpenSotStream( aPersistStream ); diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index b58e1cbc9bfc..bd7ce099cce7 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -2762,7 +2762,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportPPT(const OUString &rURL return false; tools::SvRef<SotStorageStream> xDocStream(xStorage->OpenSotStream( "PowerPoint Document", StreamMode::STD_READ)); - if (!xDocStream) + if ( !xDocStream.Is() ) return false; SdDLL::Init(); diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx index f91888b08fc8..49bb5e5fb43e 100644 --- a/sd/source/filter/ppt/propread.cxx +++ b/sd/source/filter/ppt/propread.cxx @@ -553,7 +553,7 @@ PropRead::PropRead( SotStorage& rStorage, const OUString& rName ) : if ( rStorage.IsStream( rName ) ) { mpSvStream = rStorage.OpenSotStream( rName, StreamMode::STD_READ ); - if ( mpSvStream ) + if ( mpSvStream.Is() ) { mpSvStream->SetEndian( SvStreamEndian::LITTLE ); memset( mApplicationCLSID, 0, 16 ); @@ -604,7 +604,7 @@ void PropRead::Read() nCurrent = mpSvStream->Tell(); mpSvStream->Seek( nSectionOfs ); Section aSection( pSectCLSID ); - aSection.Read( mpSvStream ); + aSection.Read( mpSvStream.get() ); AddSection( aSection ); mpSvStream->Seek( nCurrent ); } diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index c699a563fcd7..a92573d7739b 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -127,7 +127,7 @@ SdTransferable::~SdTransferable() if( maDocShellRef.Is() ) { - SfxObjectShell* pObj = maDocShellRef; + SfxObjectShell* pObj = maDocShellRef.get(); ::sd::DrawDocShell* pDocSh = static_cast< ::sd::DrawDocShell*>(pObj); pDocSh->DoClose(); } diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx index a926f04434d8..4dec3b3e5808 100644 --- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx +++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx @@ -325,7 +325,7 @@ sal_Int32 Clipboard::PasteTransferable (sal_Int32 nInsertPosition) } else { - SfxObjectShell* pShell = pClipTransferable->GetDocShell(); + SfxObjectShell* pShell = pClipTransferable->GetDocShell().get(); DrawDocShell* pDataDocSh = static_cast<DrawDocShell*>(pShell); SdDrawDocument* pDataDoc = pDataDocSh->GetDoc(); diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx index b297daad4693..e65729257426 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -358,7 +358,7 @@ void SlotManager::FuSupport (SfxRequest& rRequest) SdTransferable* pTransferClip = SD_MOD()->pTransferClip; if( pTransferClip ) { - SfxObjectShell* pTransferDocShell = pTransferClip->GetDocShell(); + SfxObjectShell* pTransferDocShell = pTransferClip->GetDocShell().get(); DrawDocShell* pDocShell = dynamic_cast<DrawDocShell*>(pTransferDocShell); if (pDocShell && pDocShell->GetDoc()->GetPageCount() > 1) @@ -698,14 +698,14 @@ void SlotManager::GetClipboardState ( SfxItemSet& rSet) || rSet.GetItemState(SID_PASTE_SPECIAL) == SfxItemState::DEFAULT) { // no own clipboard data? - if ( !pTransferClip || !pTransferClip->GetDocShell() ) + if ( !pTransferClip || !pTransferClip->GetDocShell().Is() ) { rSet.DisableItem(SID_PASTE); rSet.DisableItem(SID_PASTE_SPECIAL); } else { - SfxObjectShell* pTransferDocShell = pTransferClip->GetDocShell(); + SfxObjectShell* pTransferDocShell = pTransferClip->GetDocShell().get(); if( !pTransferDocShell || static_cast<DrawDocShell*>(pTransferDocShell)->GetDoc()->GetPageCount() <= 1 ) { diff --git a/sd/source/ui/view/ViewClipboard.cxx b/sd/source/ui/view/ViewClipboard.cxx index d6fd07e9cb16..ef088734f3c8 100644 --- a/sd/source/ui/view/ViewClipboard.cxx +++ b/sd/source/ui/view/ViewClipboard.cxx @@ -200,7 +200,7 @@ sal_uInt16 ViewClipboard::InsertSlides ( { // Otherwise all pages of the document of the transferable are // inserted. - SfxObjectShell* pShell = rTransferable.GetDocShell(); + SfxObjectShell* pShell = rTransferable.GetDocShell().get(); pDataDocSh = static_cast<DrawDocShell*>(pShell); SdDrawDocument* pDataDoc = pDataDocSh->GetDoc(); diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index 452a7e4bc5da..e15d320cc6f2 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -363,7 +363,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, // Paste only if SfxClassificationHelper recommends so. const SfxObjectShellRef& pSource = pOwnData->GetDocShell(); SfxObjectShell* pDestination = mrDoc.GetDocSh(); - if (pSource && pDestination) + if (pSource.Is() && pDestination) { SfxClassificationCheckPasteResult eResult = SfxClassificationHelper::CheckPaste(pSource->getDocProperties(), pDestination->getDocProperties()); if (!SfxClassificationHelper::ShowPasteInfo(eResult)) @@ -375,7 +375,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, { const View* pSourceView = pOwnData->GetView(); - if( pOwnData->GetDocShell() && pOwnData->IsPageTransferable() ) + if( pOwnData->GetDocShell().Is() && pOwnData->IsPageTransferable() ) { mpClipboard->HandlePageDrop (*pOwnData); bReturn = true; diff --git a/sfx2/source/appl/macroloader.cxx b/sfx2/source/appl/macroloader.cxx index 9cf3dade9e30..3ab011f3dac0 100644 --- a/sfx2/source/appl/macroloader.cxx +++ b/sfx2/source/appl/macroloader.cxx @@ -290,9 +290,9 @@ ErrCode SfxMacroLoader::loadMacro( const OUString& rURL, css::uno::Any& rRetval, // execute the method SbxVariableRef retValRef = new SbxVariable; - nErr = pBasMgr->ExecuteMacro( aQualifiedMethod, aArgs, retValRef ); + nErr = pBasMgr->ExecuteMacro( aQualifiedMethod, aArgs, retValRef.get() ); if ( nErr == ERRCODE_NONE ) - rRetval = sbxToUnoValue( retValRef ); + rRetval = sbxToUnoValue( retValRef.get() ); } if ( bSetGlobalThisComponent ) diff --git a/sfx2/source/appl/xpackcreator.cxx b/sfx2/source/appl/xpackcreator.cxx index 5297d927b009..8e1a2eec043d 100644 --- a/sfx2/source/appl/xpackcreator.cxx +++ b/sfx2/source/appl/xpackcreator.cxx @@ -85,7 +85,7 @@ void SAL_CALL OPackageStructureCreator::convertToPackage( const OUString& aFolde { pTempStream = new SvFileStream( aTempURL, StreamMode::STD_READWRITE ); tools::SvRef<SotStorage> aTargetStorage = new SotStorage( true, *pTempStream ); - aStorage->CopyTo( aTargetStorage ); + aStorage->CopyTo( aTargetStorage.get() ); aTargetStorage->Commit(); if ( aStorage->GetError() || aTargetStorage->GetError() || pTempStream->GetError() ) diff --git a/sfx2/source/bastyp/progress.cxx b/sfx2/source/bastyp/progress.cxx index a9bcff553e61..be387aa711ec 100644 --- a/sfx2/source/bastyp/progress.cxx +++ b/sfx2/source/bastyp/progress.cxx @@ -74,7 +74,7 @@ struct SfxProgress_Impl void SfxProgress_Impl::Enable_Impl() { - SfxObjectShell* pDoc = static_cast<SfxObjectShell*>(xObjSh); + SfxObjectShell* pDoc = xObjSh.get(); SfxViewFrame *pFrame = SfxViewFrame::GetFirst(pDoc); while ( pFrame ) { @@ -249,7 +249,7 @@ void SfxProgress::SetState { // get the active ViewFrame of the document this progress is working on // if it doesn't work on a document, take the current ViewFrame - SfxObjectShell* pObjSh = pImpl->xObjSh; + SfxObjectShell* pObjSh = pImpl->xObjSh.get(); pImpl->pView = SfxViewFrame::Current(); DBG_ASSERT( pImpl->pView || pObjSh, "Can't make progress bar!"); if ( pObjSh && ( !pImpl->pView || pObjSh != pImpl->pView->GetObjectShell() ) ) @@ -321,16 +321,16 @@ void SfxProgress::Resume() { if ( pImpl->xObjSh.Is() ) { - for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(pImpl->xObjSh); + for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(pImpl->xObjSh.get() ); pFrame; - pFrame = SfxViewFrame::GetNext( *pFrame, pImpl->xObjSh ) ) + pFrame = SfxViewFrame::GetNext( *pFrame, pImpl->xObjSh.get() ) ) pFrame->GetWindow().EnterWait(); } } - if ( pImpl->xObjSh ) + if ( pImpl->xObjSh.Is() ) { - SfxViewFrame *pFrame = SfxViewFrame::GetFirst(pImpl->xObjSh); + SfxViewFrame *pFrame = SfxViewFrame::GetFirst(pImpl->xObjSh.get()); if ( pFrame ) pFrame->GetBindings().ENTERREGISTRATIONS(); } @@ -366,14 +366,14 @@ void SfxProgress::Suspend() if ( pImpl->xObjSh.Is() ) { for ( SfxViewFrame *pFrame = - SfxViewFrame::GetFirst(pImpl->xObjSh); + SfxViewFrame::GetFirst(pImpl->xObjSh.get()); pFrame; - pFrame = SfxViewFrame::GetNext( *pFrame, pImpl->xObjSh ) ) + pFrame = SfxViewFrame::GetNext( *pFrame, pImpl->xObjSh.get() ) ) pFrame->GetWindow().LeaveWait(); } if ( pImpl->xObjSh.Is() ) { - SfxViewFrame *pFrame = SfxViewFrame::GetFirst(pImpl->xObjSh); + SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pImpl->xObjSh.get() ); if ( pFrame ) pFrame->GetBindings().LEAVEREGISTRATIONS(); } diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 42b1fda5068c..cae3a9e89623 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -3185,7 +3185,7 @@ SvKeyValueIterator* SfxMedium::GetHeaderAttributes_Impl() } } - return pImpl->xAttributes; + return pImpl->xAttributes.get(); } css::uno::Reference< css::io::XInputStream > SfxMedium::GetInputStream() diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx index 24933ce425ae..a1c31340f74c 100644 --- a/sfx2/source/doc/doctempl.cxx +++ b/sfx2/source/doc/doctempl.cxx @@ -975,7 +975,7 @@ bool SfxDocumentTemplates::InsertDir if ( xTemplates->addGroup( rText ) ) { - RegionData_Impl* pNewRegion = new RegionData_Impl( pImp, rText ); + RegionData_Impl* pNewRegion = new RegionData_Impl( pImp.get(), rText ); if ( ! pImp->InsertRegion( pNewRegion, nRegion ) ) { diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index 29c9458acf8b..d84f56b556a2 100644 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -260,12 +260,12 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxPrintHelper::getPrinter() thro // search for any view of this document that is currently printing const Printer *pPrinter = nullptr; - SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? SfxViewFrame::GetFirst( m_pData->m_pObjectShell, false ) : nullptr; + SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? SfxViewFrame::GetFirst( m_pData->m_pObjectShell.get(), false ) : nullptr; SfxViewFrame* pFirst = pViewFrm; while ( pViewFrm && !pPrinter ) { pPrinter = pViewFrm->GetViewShell()->GetActivePrinter(); - pViewFrm = SfxViewFrame::GetNext( *pViewFrm, m_pData->m_pObjectShell, false ); + pViewFrm = SfxViewFrame::GetNext( *pViewFrm, m_pData->m_pObjectShell.get(), false ); } // if no view is printing currently, use the permanent SfxPrinter instance @@ -320,7 +320,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue > { // Get old Printer SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? - SfxViewFrame::GetFirst( m_pData->m_pObjectShell, false ) : nullptr; + SfxViewFrame::GetFirst( m_pData->m_pObjectShell.get(), false ) : nullptr; if ( !pViewFrm ) return; @@ -595,7 +595,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& // get view for sfx printing capabilities SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? - SfxViewFrame::GetFirst( m_pData->m_pObjectShell, false ) : nullptr; + SfxViewFrame::GetFirst( m_pData->m_pObjectShell.get(), false ) : nullptr; if ( !pViewFrm ) return; SfxViewShell* pView = pViewFrm->GetViewShell(); @@ -796,7 +796,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& void IMPL_PrintListener_DataContainer::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { const SfxPrintingHint* pPrintHint = dynamic_cast<const SfxPrintingHint*>(&rHint); - if ( &rBC != m_pObjectShell + if ( &rBC != m_pObjectShell.get() || !pPrintHint || pPrintHint->GetWhich() == SFX_PRINTABLESTATE_CANCELJOB ) return; diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index a4c1c25f424d..0381dc047f95 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -256,8 +256,8 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument { if (!m_xDocumentMetadata.is()) { - OSL_ENSURE(m_pObjectShell, "GetDMA: no object shell?"); - if (!m_pObjectShell) + OSL_ENSURE(m_pObjectShell.Is(), "GetDMA: no object shell?"); + if (!m_pObjectShell.Is()) { return nullptr; } @@ -297,7 +297,7 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument Reference<rdf::XDocumentMetadataAccess> CreateDMAUninitialized() { - return (m_pObjectShell) + return (m_pObjectShell.Is()) ? new ::sfx2::DocumentMetadataAccess( ::comphelper::getProcessComponentContext(), *m_pObjectShell) : nullptr; @@ -456,15 +456,15 @@ class SfxSaveGuard SfxSaveGuard::SfxSaveGuard(const Reference< frame::XModel >& xModel , IMPL_SfxBaseModel_DataContainer* pData) - : m_xModel (xModel) - , m_pData (pData ) - , m_pFramesLock(nullptr ) + : m_xModel ( xModel ) + , m_pData ( pData ) + , m_pFramesLock( nullptr ) { if ( m_pData->m_bClosed ) throw lang::DisposedException("Object already disposed."); m_pData->m_bSaving = true; - m_pFramesLock = new SfxOwnFramesLocker(m_pData->m_pObjectShell); + m_pFramesLock = new SfxOwnFramesLocker( m_pData->m_pObjectShell.get() ); } SfxSaveGuard::~SfxSaveGuard() @@ -624,7 +624,7 @@ Reference< container::XNameContainer > SAL_CALL SfxBaseModel::getLibraryContaine Reference< script::XStarBasicAccess >& rxAccess = m_pData->m_xStarBasicAccess; if( !rxAccess.is() && m_pData->m_pObjectShell.Is() ) - rxAccess = implGetStarBasicAccess( m_pData->m_pObjectShell ); + rxAccess = implGetStarBasicAccess( m_pData->m_pObjectShell.get() ); Reference< container::XNameContainer > xRet; if( rxAccess.is() ) @@ -650,7 +650,7 @@ void SAL_CALL SfxBaseModel::createLibrary( const OUString& LibName, const OUStri Reference< script::XStarBasicAccess >& rxAccess = m_pData->m_xStarBasicAccess; if( !rxAccess.is() && m_pData->m_pObjectShell.Is() ) - rxAccess = implGetStarBasicAccess( m_pData->m_pObjectShell ); + rxAccess = implGetStarBasicAccess( m_pData->m_pObjectShell.get() ); if( rxAccess.is() ) rxAccess->createLibrary( LibName, Password, ExternalSourceURL, LinkTargetURL ); @@ -674,7 +674,7 @@ void SAL_CALL SfxBaseModel::addModule( const OUString& LibraryName, const OUStri Reference< script::XStarBasicAccess >& rxAccess = m_pData->m_xStarBasicAccess; if( !rxAccess.is() && m_pData->m_pObjectShell.Is() ) - rxAccess = implGetStarBasicAccess( m_pData->m_pObjectShell ); + rxAccess = implGetStarBasicAccess( m_pData->m_pObjectShell.get() ); if( rxAccess.is() ) rxAccess->addModule( LibraryName, ModuleName, Language, Source ); @@ -697,7 +697,7 @@ void SAL_CALL SfxBaseModel::addDialog( const OUString& LibraryName, const OUStri Reference< script::XStarBasicAccess >& rxAccess = m_pData->m_xStarBasicAccess; if( !rxAccess.is() && m_pData->m_pObjectShell.Is() ) - rxAccess = implGetStarBasicAccess( m_pData->m_pObjectShell ); + rxAccess = implGetStarBasicAccess( m_pData->m_pObjectShell.get() ); if( rxAccess.is() ) rxAccess->addDialog( LibraryName, DialogName, Data ); @@ -884,7 +884,7 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const OUString& { m_pData->m_sURL = rURL; - SfxObjectShell* pObjectShell = m_pData->m_pObjectShell; + SfxObjectShell* pObjectShell = m_pData->m_pObjectShell.get(); ::comphelper::NamedValueCollection aArgs( rArgs ); @@ -1002,7 +1002,7 @@ Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getArgs() throw(RuntimeE seqArgsNew[ nNewLength - 1 ].Value <<= m_pData->m_aPreusedFilterName; } - SfxViewFrame* pFrame = SfxViewFrame::GetFirst( m_pData->m_pObjectShell ); + SfxViewFrame* pFrame = SfxViewFrame::GetFirst( m_pData->m_pObjectShell.get() ); if ( pFrame ) { SvBorder aBorder = pFrame->GetBorderPixelImpl(); @@ -1549,7 +1549,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const Sequence< beans::PropertyValue > SfxAllItemSet *pParams = new SfxAllItemSet( SfxGetpApp()->GetPool() ); TransformParameters( nSlotId, aArgs, *pParams ); - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOC, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOC), m_pData->m_pObjectShell ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOC, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOC), m_pData->m_pObjectShell.get() ) ); bool bRet = false; @@ -1590,7 +1590,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const Sequence< beans::PropertyValue > m_pData->m_pObjectShell->AddLog( OSL_LOG_PREFIX "successful saving." ); m_pData->m_aPreusedFilterName = GetMediumFilterName_Impl(); - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCDONE, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOCDONE), m_pData->m_pObjectShell ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCDONE, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOCDONE), m_pData->m_pObjectShell.get() ) ); } else { @@ -1598,7 +1598,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const Sequence< beans::PropertyValue > m_pData->m_pObjectShell->StoreLog(); // write the contents of the logger to the file - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCFAILED, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOCFAILED), m_pData->m_pObjectShell ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCFAILED, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOCFAILED), m_pData->m_pObjectShell.get() ) ); throw task::ErrorCodeIOException( "SfxBaseModel::storeSelf: 0x" + OUString::number(nErrCode, 16), @@ -2293,7 +2293,7 @@ Reference< container::XNameReplace > SAL_CALL SfxBaseModel::getEvents() throw( R if ( ! m_pData->m_xEvents.is() ) { - m_pData->m_xEvents = new SfxEvents_Impl( m_pData->m_pObjectShell, this ); + m_pData->m_xEvents = new SfxEvents_Impl( m_pData->m_pObjectShell.get(), this ); } return m_pData->m_xEvents; @@ -2308,7 +2308,7 @@ Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::getBas SfxModelGuard aGuard( *this ); Reference< script::XStorageBasedLibraryContainer > xBasicLibraries; - if ( m_pData->m_pObjectShell ) + if ( m_pData->m_pObjectShell.Is() ) xBasicLibraries.set( m_pData->m_pObjectShell->GetBasicContainer(), UNO_QUERY_THROW ); return xBasicLibraries; } @@ -2318,7 +2318,7 @@ Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::getDia SfxModelGuard aGuard( *this ); Reference< script::XStorageBasedLibraryContainer > xDialogLibraries; - if ( m_pData->m_pObjectShell ) + if ( m_pData->m_pObjectShell.Is() ) xDialogLibraries.set( m_pData->m_pObjectShell->GetDialogContainer(), UNO_QUERY_THROW ); return xDialogLibraries; } @@ -2327,7 +2327,7 @@ sal_Bool SAL_CALL SfxBaseModel::getAllowMacroExecution() throw (RuntimeException { SfxModelGuard aGuard( *this ); - if ( m_pData->m_pObjectShell ) + if ( m_pData->m_pObjectShell.Is() ) return m_pData->m_pObjectShell->AdjustMacroMode(); return false; } @@ -2574,7 +2574,7 @@ uno::Sequence< document::CmisVersion > SAL_CALL SfxBaseModel::getAllVersions( ) bool SfxBaseModel::getBoolPropertyValue( const OUString& rName ) throw ( RuntimeException ) { bool bValue = false; - if ( m_pData->m_pObjectShell ) + if ( m_pData->m_pObjectShell.Is() ) { SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium(); if ( pMedium ) @@ -2724,7 +2724,7 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , if ( !m_pData ) return; - if ( &rBC == m_pData->m_pObjectShell ) + if ( &rBC == m_pData->m_pObjectShell.get() ) { if ( rHint.GetId() == SFX_HINT_DOCCHANGED ) changing(); @@ -2850,7 +2850,7 @@ void SfxBaseModel::changing() SfxObjectShell* SfxBaseModel::GetObjectShell() const { - return m_pData ? static_cast<SfxObjectShell*>(m_pData->m_pObjectShell) : nullptr; + return m_pData ? m_pData->m_pObjectShell.get() : nullptr; } @@ -2859,7 +2859,7 @@ SfxObjectShell* SfxBaseModel::GetObjectShell() const bool SfxBaseModel::IsInitialized() const { - if ( !m_pData || !m_pData->m_pObjectShell ) + if ( !m_pData || !m_pData->m_pObjectShell.Is() ) { OSL_FAIL( "SfxBaseModel::IsInitialized: this should have been caught earlier!" ); return false; @@ -2906,7 +2906,7 @@ void SfxBaseModel::impl_store( const OUString& sURL throw frame::IllegalArgumentIOException(); bool bSaved = false; - if ( !bSaveTo && m_pData->m_pObjectShell && !sURL.isEmpty() + if ( !bSaveTo && m_pData->m_pObjectShell.Is() && !sURL.isEmpty() && !sURL.startsWith( "private:stream" ) && ::utl::UCBContentHelper::EqualURLs( getLocation(), sURL ) ) { @@ -2980,10 +2980,10 @@ void SfxBaseModel::impl_store( const OUString& sURL } } - if ( !bSaved && m_pData->m_pObjectShell ) + if ( !bSaved && m_pData->m_pObjectShell.Is() ) { SfxGetpApp()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOC : SFX_EVENT_SAVEASDOC, GlobalEventConfig::GetEventName( bSaveTo ? GlobalEventId::SAVETODOC : GlobalEventId::SAVEASDOC ), - m_pData->m_pObjectShell ) ); + m_pData->m_pObjectShell.get() ) ); std::unique_ptr<SfxAllItemSet> pItemSet(new SfxAllItemSet(SfxGetpApp()->GetPool())); pItemSet->Put(SfxStringItem(SID_FILE_NAME, sURL)); @@ -3082,14 +3082,14 @@ void SfxBaseModel::impl_store( const OUString& sURL m_pData->m_aPreusedFilterName = GetMediumFilterName_Impl(); m_pData->m_pObjectShell->SetModifyPasswordEntered(); - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEASDOCDONE, GlobalEventConfig::GetEventName(GlobalEventId::SAVEASDOCDONE), m_pData->m_pObjectShell ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEASDOCDONE, GlobalEventConfig::GetEventName(GlobalEventId::SAVEASDOCDONE), m_pData->m_pObjectShell.get() ) ); } else { m_pData->m_pObjectShell->SetModifyPasswordHash( nOldModifyPasswordHash ); m_pData->m_pObjectShell->SetModifyPasswordInfo( aOldModifyPasswordInfo ); - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVETODOCDONE, GlobalEventConfig::GetEventName(GlobalEventId::SAVETODOCDONE), m_pData->m_pObjectShell ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVETODOCDONE, GlobalEventConfig::GetEventName(GlobalEventId::SAVETODOCDONE), m_pData->m_pObjectShell.get() ) ); } } else @@ -3103,7 +3103,7 @@ void SfxBaseModel::impl_store( const OUString& sURL SfxGetpApp()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOCFAILED : SFX_EVENT_SAVEASDOCFAILED, GlobalEventConfig::GetEventName( bSaveTo ? GlobalEventId::SAVETODOCFAILED : GlobalEventId::SAVEASDOCFAILED), - m_pData->m_pObjectShell ) ); + m_pData->m_pObjectShell.get() ) ); throw task::ErrorCodeIOException( ("SfxBaseModel::impl_store <" + sURL + "> failed: 0x" @@ -3185,8 +3185,8 @@ Reference < container::XIndexAccess > SAL_CALL SfxBaseModel::getViewData() throw if ( m_pData->m_pObjectShell.Is() && !m_pData->m_contViewData.is() ) { SfxViewFrame *pActFrame = SfxViewFrame::Current(); - if ( !pActFrame || pActFrame->GetObjectShell() != m_pData->m_pObjectShell ) - pActFrame = SfxViewFrame::GetFirst( m_pData->m_pObjectShell ); + if ( !pActFrame || pActFrame->GetObjectShell() != m_pData->m_pObjectShell.get() ) + pActFrame = SfxViewFrame::GetFirst( m_pData->m_pObjectShell.get() ); if ( !pActFrame || !pActFrame->GetViewShell() ) // currently no frame for this document at all or View is under construction @@ -3204,8 +3204,8 @@ Reference < container::XIndexAccess > SAL_CALL SfxBaseModel::getViewData() throw Reference < container::XIndexContainer > xCont( m_pData->m_contViewData, UNO_QUERY ); sal_Int32 nCount = 0; Sequence < beans::PropertyValue > aSeq; - for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst( m_pData->m_pObjectShell ); pFrame; - pFrame = SfxViewFrame::GetNext( *pFrame, m_pData->m_pObjectShell ) ) + for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst( m_pData->m_pObjectShell.get() ); pFrame; + pFrame = SfxViewFrame::GetNext( *pFrame, m_pData->m_pObjectShell.get() ) ) { bool bIsActive = ( pFrame == pActFrame ); pFrame->GetViewShell()->WriteUserDataSequence( aSeq ); @@ -3607,7 +3607,7 @@ void SAL_CALL SfxBaseModel::setVisualAreaSize( sal_Int64 nAspect, const awt::Siz if ( !m_pData->m_pObjectShell.Is() ) throw Exception(); // TODO: error handling - SfxViewFrame* pViewFrm = SfxViewFrame::GetFirst( m_pData->m_pObjectShell, false ); + SfxViewFrame* pViewFrm = SfxViewFrame::GetFirst( m_pData->m_pObjectShell.get(), false ); if ( pViewFrm && m_pData->m_pObjectShell->GetCreateMode() == SfxObjectCreateMode::EMBEDDED && !pViewFrm->GetFrame().IsInPlace() ) { vcl::Window* pWindow = VCLUnoHelper::GetWindow( pViewFrm->GetFrame().GetFrameInterface()->getContainerWindow() ); @@ -3882,7 +3882,7 @@ bool SfxBaseModel::impl_getPrintHelper() SfxModelGuard aGuard( *this ); if (!m_pData->m_sModuleIdentifier.isEmpty()) return m_pData->m_sModuleIdentifier; - if (m_pData->m_pObjectShell) + if (m_pData->m_pObjectShell.Is()) return m_pData->m_pObjectShell->GetFactory().GetDocumentServiceName(); return OUString(); } @@ -3935,7 +3935,7 @@ OUString SAL_CALL SfxBaseModel::getTitle() SfxModelGuard aGuard( *this ); OUString aResult = impl_getTitleHelper()->getTitle (); - if ( !m_pData->m_bExternalTitle && m_pData->m_pObjectShell ) + if ( !m_pData->m_bExternalTitle && m_pData->m_pObjectShell.get() ) { SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium(); if ( pMedium ) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 4fb03e400b09..ef4f10d22a82 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1701,7 +1701,7 @@ void SfxViewFrame::SetQuietMode_Impl( bool bOn ) SfxObjectShell* SfxViewFrame::GetObjectShell() { - return m_xObjSh; + return m_xObjSh.get(); } const Size& SfxViewFrame::GetMargin_Impl() const @@ -2330,8 +2330,8 @@ void SfxViewFrame::SetModalMode( bool bModal ) m_pImpl->bModal = bModal; if ( m_xObjSh.Is() ) { - for ( SfxViewFrame* pFrame = SfxViewFrame::GetFirst( m_xObjSh ); - !bModal && pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, m_xObjSh ) ) + for ( SfxViewFrame* pFrame = SfxViewFrame::GetFirst( m_xObjSh.get() ); + !bModal && pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, m_xObjSh.get() ) ) bModal = pFrame->m_pImpl->bModal; m_xObjSh->SetModalMode_Impl( bModal ); } diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx index 1c3d5807726a..cba36422b3bc 100644 --- a/sot/source/sdstor/storage.cxx +++ b/sot/source/sdstor/storage.cxx @@ -57,7 +57,7 @@ SvLockBytesRef MakeLockBytes_Impl( const OUString & rName, StreamMode nMode ) } SotStorageStream::SotStorageStream( const OUString & rName, StreamMode nMode ) - : SvStream( MakeLockBytes_Impl( rName, nMode ) ) + : SvStream( MakeLockBytes_Impl( rName, nMode ).get() ) , pOwnStm( nullptr ) { if( nMode & StreamMode::WRITE ) @@ -466,7 +466,7 @@ SvMemoryStream * SotStorage::CreateMemoryStream() SvMemoryStream * pStm = nullptr; pStm = new SvMemoryStream( 0x8000, 0x8000 ); tools::SvRef<SotStorage> aStg = new SotStorage( *pStm ); - if( CopyTo( aStg ) ) + if( CopyTo( aStg.get() ) ) { aStg->Commit(); } diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index 7ecd607a08d9..f0555e5eeb58 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -1816,7 +1816,7 @@ void UCBStorage_Impl::ReadContent() { // older files didn't have that special content type, so they must be detected OpenStream( pElement, StreamMode::STD_READ, m_bDirect ); - if ( Storage::IsStorageFile( pElement->m_xStream ) ) + if ( Storage::IsStorageFile( pElement->m_xStream.get() ) ) pElement->m_bIsStorage = true; else pElement->m_xStream->Free(); @@ -2666,7 +2666,7 @@ BaseStorageStream* UCBStorage::OpenStream( const OUString& rEleName, StreamMode { pElement->m_xStream->PrepareCachedForReopen( nMode ); - return new UCBStorageStream( pElement->m_xStream ); + return new UCBStorageStream( pElement->m_xStream.get() ); } } } @@ -2676,7 +2676,7 @@ BaseStorageStream* UCBStorage::OpenStream( const OUString& rEleName, StreamMode // if name has been changed before creating the stream: set name! pElement->m_xStream->m_aName = rEleName; - return new UCBStorageStream( pElement->m_xStream ); + return new UCBStorageStream( pElement->m_xStream.get() ); } return nullptr; @@ -2795,7 +2795,7 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const OUString& rEleName, StreamMode } else { - return new UCBStorage( pElement->m_xStorage ); + return new UCBStorage( pElement->m_xStorage.get() ); } } } diff --git a/starmath/qa/cppunit/test_cursor.cxx b/starmath/qa/cppunit/test_cursor.cxx index 51e555f777fd..6cbc4fe2ef41 100644 --- a/starmath/qa/cppunit/test_cursor.cxx +++ b/starmath/qa/cppunit/test_cursor.cxx @@ -71,7 +71,7 @@ void Test::testCopyPaste() std::unique_ptr<SmNode> xTree(SmParser().Parse(sInput)); xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); - SmCursor aCursor(xTree.get(), xDocShRef); + SmCursor aCursor(xTree.get(), xDocShRef.get()); ScopedVclPtrInstance<VirtualDevice> pOutputDevice; // go to the position at "*" @@ -94,7 +94,7 @@ void Test::testCopySelectPaste() std::unique_ptr<SmNode> xTree(SmParser().Parse(sInput)); xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); - SmCursor aCursor(xTree.get(), xDocShRef); + SmCursor aCursor(xTree.get(), xDocShRef.get()); ScopedVclPtrInstance<VirtualDevice> pOutputDevice; // go to the right end @@ -121,7 +121,7 @@ void Test::testCutPaste() std::unique_ptr<SmNode> xTree(SmParser().Parse(sInput)); xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); - SmCursor aCursor(xTree.get(), xDocShRef); + SmCursor aCursor(xTree.get(), xDocShRef.get()); ScopedVclPtrInstance<VirtualDevice> pOutputDevice; // go to the position at "*" @@ -144,7 +144,7 @@ void Test::testCutSelectPaste() std::unique_ptr<SmNode> xTree(SmParser().Parse(sInput)); xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); - SmCursor aCursor(xTree.get(), xDocShRef); + SmCursor aCursor(xTree.get(), xDocShRef.get()); ScopedVclPtrInstance<VirtualDevice> pOutputDevice; // go to the right end diff --git a/starmath/qa/cppunit/test_node.cxx b/starmath/qa/cppunit/test_node.cxx index b07f26ca039a..fbeca91dbdc1 100644 --- a/starmath/qa/cppunit/test_node.cxx +++ b/starmath/qa/cppunit/test_node.cxx @@ -55,7 +55,7 @@ void NodeTest::setUp() void NodeTest::tearDown() { - if (mxDocShell) + if (mxDocShell.Is()) mxDocShell->DoClose(); BootstrapFixture::tearDown(); } diff --git a/starmath/qa/cppunit/test_nodetotextvisitors.cxx b/starmath/qa/cppunit/test_nodetotextvisitors.cxx index f6f82918eee1..c3c17f96cb7a 100644 --- a/starmath/qa/cppunit/test_nodetotextvisitors.cxx +++ b/starmath/qa/cppunit/test_nodetotextvisitors.cxx @@ -521,7 +521,7 @@ void Test::testBinomInBinHor() pTree = SmParser().Parse(sInput); pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); - SmCursor aCursor(pTree, xDocShRef); + SmCursor aCursor(pTree, xDocShRef.get()); ScopedVclPtrInstance< VirtualDevice > pOutputDevice; // move forward (more than) enough places to be at the end @@ -549,7 +549,7 @@ void Test::testBinVerInUnary() pTree = SmParser().Parse(sInput); pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); - SmCursor aCursor(pTree, xDocShRef); + SmCursor aCursor(pTree, xDocShRef.get()); ScopedVclPtrInstance< VirtualDevice > pOutputDevice; // move forward (more than) enough places to be at the end @@ -578,7 +578,7 @@ void Test::testBinHorInSubSup() SmNode* pTree = SmParser().Parse(sInput); pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); - SmCursor aCursor(pTree, xDocShRef); + SmCursor aCursor(pTree, xDocShRef.get()); ScopedVclPtrInstance< VirtualDevice > pOutputDevice; // Insert an RSup expression with a BinHor for the exponent @@ -606,7 +606,7 @@ void Test::testUnaryInMixedNumberAsNumerator() SmNode* pTree = SmParser().Parse(sInput); pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); - SmCursor aCursor(pTree, xDocShRef); + SmCursor aCursor(pTree, xDocShRef.get()); ScopedVclPtrInstance< VirtualDevice > pOutputDevice; // move forward (more than) enough places to be at the end diff --git a/starmath/qa/cppunit/test_parse.cxx b/starmath/qa/cppunit/test_parse.cxx index fd601c1d4463..2aff581cf375 100644 --- a/starmath/qa/cppunit/test_parse.cxx +++ b/starmath/qa/cppunit/test_parse.cxx @@ -52,7 +52,7 @@ void ParseTest::setUp() void ParseTest::tearDown() { - if (mxDocShell) + if (mxDocShell.Is()) mxDocShell->DoClose(); BootstrapFixture::tearDown(); } diff --git a/starmath/qa/extras/mmlexport-test.cxx b/starmath/qa/extras/mmlexport-test.cxx index 3a2d222f18e4..1266ca0ec3e5 100644 --- a/starmath/qa/extras/mmlexport-test.cxx +++ b/starmath/qa/extras/mmlexport-test.cxx @@ -63,7 +63,7 @@ void MathMLExportTest::setUp() void MathMLExportTest::tearDown() { - if (mxDocShell) + if (mxDocShell.Is()) mxDocShell->DoClose(); BootstrapFixture::tearDown(); } diff --git a/starmath/qa/extras/mmlimport-test.cxx b/starmath/qa/extras/mmlimport-test.cxx index fcb6be9e6d8a..5ca5d70e8012 100644 --- a/starmath/qa/extras/mmlimport-test.cxx +++ b/starmath/qa/extras/mmlimport-test.cxx @@ -80,7 +80,7 @@ void Test::setUp() void Test::tearDown() { - if (mxDocShell) mxDocShell->DoClose(); + if (mxDocShell.Is()) mxDocShell->DoClose(); BootstrapFixture::tearDown(); } diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index deb7d1514003..64847fd591e0 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -702,7 +702,7 @@ bool SmDocShell::ConvertFrom(SfxMedium &rMedium) { // is this a MathType Storage? MathType aEquation( maText ); - bSuccess = aEquation.Parse( aStorage ); + bSuccess = aEquation.Parse( aStorage.get() ); if ( bSuccess ) Parse(); } diff --git a/starmath/source/smdetect.cxx b/starmath/source/smdetect.cxx index 058f387124b2..18dfa736bd51 100644 --- a/starmath/source/smdetect.cxx +++ b/starmath/source/smdetect.cxx @@ -76,7 +76,7 @@ OUString SAL_CALL SmFilterDetect::detect( Sequence< PropertyValue >& lDescriptor if ( aStorage->IsStream("Equation Native") ) { sal_uInt8 nVersion; - if ( GetMathTypeVersion( aStorage, nVersion ) && nVersion <=3 ) + if ( GetMathTypeVersion( aStorage.get(), nVersion ) && nVersion <=3 ) return OUString("math_MathType_3x"); } } diff --git a/starmath/source/unofilter.cxx b/starmath/source/unofilter.cxx index e5369e2d3d98..8caf72ef308a 100644 --- a/starmath/source/unofilter.cxx +++ b/starmath/source/unofilter.cxx @@ -76,7 +76,7 @@ sal_Bool MathTypeFilter::filter(const uno::Sequence<beans::PropertyValue>& rDesc SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell()); OUString aText = pDocShell->GetText(); MathType aEquation(aText); - bSuccess = aEquation.Parse(aStorage); + bSuccess = aEquation.Parse(aStorage.get()); if (bSuccess) { pDocShell->SetText(aText); diff --git a/svl/source/items/lckbitem.cxx b/svl/source/items/lckbitem.cxx index bda67f85936a..224272595908 100644 --- a/svl/source/items/lckbitem.cxx +++ b/svl/source/items/lckbitem.cxx @@ -39,7 +39,7 @@ SfxLockBytesItem::SfxLockBytesItem( sal_uInt16 nW, SvStream &rStream ) rStream.Seek( 0L ); _xVal = new SvLockBytes( new SvMemoryStream(), true ); - SvStream aLockBytesStream( _xVal ); + SvStream aLockBytesStream( _xVal.get() ); rStream.ReadStream( aLockBytesStream ); } @@ -94,7 +94,7 @@ SfxPoolItem* SfxLockBytesItem::Create( SvStream &rStream, sal_uInt16 ) const SvStream& SfxLockBytesItem::Store(SvStream &rStream, sal_uInt16 ) const { - SvStream aLockBytesStream( _xVal ); + SvStream aLockBytesStream( _xVal.get() ); sal_uInt32 nSize = aLockBytesStream.Seek( STREAM_SEEK_TO_END ); aLockBytesStream.Seek( 0L ); diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx index caf0c31ef5d6..bcc7ceff90ef 100644 --- a/svx/source/dialog/charmap.cxx +++ b/svx/source/dialog/charmap.cxx @@ -655,8 +655,8 @@ void SvxShowCharSet::OutputIndex( int nNewIndex ) void SvxShowCharSet::SelectCharacter( sal_UCS4 cNew ) { - if (mxFontCharMap == nullptr) - RecalculateFont(*this); + if ( !mxFontCharMap.Is() ) + RecalculateFont( *this ); // get next available char of current font sal_UCS4 cNext = mxFontCharMap->GetNextChar( (cNew > 0) ? cNew - 1 : cNew ); @@ -1621,7 +1621,7 @@ void SubsetMap::InitList() void SubsetMap::ApplyCharMap( const FontCharMapRef& rxFontCharMap ) { - if( !rxFontCharMap ) + if( !rxFontCharMap.Is() ) return; // remove subsets that are not matched in any range diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index a14585b6b967..c940c1435559 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -1332,7 +1332,7 @@ Sequence< Any > SAL_CALL FmXGridPeer::queryFieldData( sal_Int32 nRow, const Type // Strings are dealt with directly by the GetFieldText case TypeClass_STRING : { - OUString sText = aColumns[ nModelPos ]->GetCellText( xPaintRow, pGrid->getNumberFormatter() ); + OUString sText = aColumns[ nModelPos ]->GetCellText( xPaintRow.get(), pGrid->getNumberFormatter() ); pReturnArray[i] <<= sText; } break; diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index fdab1a3b2a1a..fbeec83f3213 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -1286,7 +1286,7 @@ void DbGridControl::EnableNavigationBar(bool bEnable) DbGridControlOptions DbGridControl::SetOptions(DbGridControlOptions nOpt) { - DBG_ASSERT(!m_xCurrentRow || !m_xCurrentRow->IsModified(), + DBG_ASSERT(!m_xCurrentRow.Is() || !m_xCurrentRow->IsModified(), "DbGridControl::SetOptions : please do not call when editing a record (things are much easier this way ;) !"); // for the next setDataSource (which is triggered by a refresh, for instance) @@ -2049,7 +2049,7 @@ void DbGridControl::PaintCell(OutputDevice& rDev, const Rectangle& rRect, sal_uI aArea.Top() += 1; aArea.Bottom() -= 1; } - pColumn->Paint(rDev, aArea, m_xPaintRow, getNumberFormatter()); + pColumn->Paint(rDev, aArea, m_xPaintRow.get(), getNumberFormatter()); } } @@ -2112,7 +2112,7 @@ bool DbGridControl::SetCurrent(long nNewRow) if ( !m_pSeekCursor->isBeforeFirst() && !m_pSeekCursor->isAfterLast() ) { Any aBookmark = m_pSeekCursor->getBookmark(); - if (!m_xCurrentRow || m_xCurrentRow->IsNew() || !CompareBookmark(aBookmark, m_pDataCursor->getBookmark())) + if (!m_xCurrentRow.Is() || m_xCurrentRow->IsNew() || !CompareBookmark(aBookmark, m_pDataCursor->getBookmark())) { // adjust the cursor to the new desired row if (!m_pDataCursor->moveToBookmark(aBookmark)) @@ -2247,7 +2247,7 @@ void DbGridControl::AdjustDataSource(bool bFull) m_xPaintRow = m_xSeekRow; // not up-to-date row, thus, adjust completely - if (!m_xCurrentRow) + if (!m_xCurrentRow.Is()) AdjustRows(); sal_Int32 nNewPos = AlignSeekCursor(); @@ -2676,7 +2676,7 @@ OUString DbGridControl::GetCurrentRowCellText(DbGridColumn* pColumn,const DbGrid // text output for a single row OUString aText; if ( pColumn && IsValid(_rRow) ) - aText = pColumn->GetCellText(_rRow, m_xFormatter); + aText = pColumn->GetCellText(_rRow.get(), m_xFormatter); return aText; } @@ -3611,7 +3611,7 @@ void DbGridControl::FieldValueChanged(sal_uInt16 _nId, const PropertyChangeEvent } // and finally do the update ... - pColumn->UpdateFromField(m_xCurrentRow, m_xFormatter); + pColumn->UpdateFromField(m_xCurrentRow.get(), m_xFormatter); RowModified(GetCurRow(), _nId); } } diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index 4829fb3c06bb..57f6f54a35bf 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -574,7 +574,7 @@ void GalleryTheme::Actualize( const Link<const INetURLObject&, void>& rActualize const OUString aStmName( GetSvDrawStreamNameFromURL( pEntry->aURL ) ); tools::SvRef<SotStorageStream> pIStm = aSvDrawStorageRef->OpenSotStream( aStmName, StreamMode::READ ); - if( pIStm && !pIStm->GetError() ) + if( pIStm.Is() && !pIStm->GetError() ) { pIStm->SetBufferSize( 16384 ); @@ -657,7 +657,7 @@ void GalleryTheme::Actualize( const Link<const INetURLObject&, void>& rActualize try { tools::SvRef<SotStorage> aTempStorageRef( new SotStorage( false, aTmpURL.GetMainURL( INetURLObject::NO_DECODE ), StreamMode::STD_READWRITE ) ); - aSvDrawStorageRef->CopyTo( aTempStorageRef ); + aSvDrawStorageRef->CopyTo( aTempStorageRef.get() ); nStorErr = aSvDrawStorageRef->GetError(); } catch (const css::ucb::ContentCreationException& e) diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index b5364d2b7c0d..ec2f70b29ebc 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -253,7 +253,7 @@ namespace sw { namespace mark void DdeBookmark::DeregisterFromDoc(SwDoc* const pDoc) { if(m_aRefObj.Is()) - pDoc->getIDocumentLinksAdministration().GetLinkManager().RemoveServer(m_aRefObj); + pDoc->getIDocumentLinksAdministration().GetLinkManager().RemoveServer(m_aRefObj.get()); } DdeBookmark::~DdeBookmark() diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx index 0949aa77d582..1255eccc5433 100644 --- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx +++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx @@ -75,7 +75,7 @@ namespace tools::SvRef<sfx2::SvBaseLink> xLink = pLnk; OUString sFName; - sfx2::LinkManager::GetDisplayNames( xLink, nullptr, &sFName ); + sfx2::LinkManager::GetDisplayNames( xLink.get(), nullptr, &sFName ); INetURLObject aURL( sFName ); if( INetProtocol::File == aURL.GetProtocol() || @@ -417,7 +417,7 @@ bool DocumentLinksAdministrationManager::EmbedAllLinks() // if one forgot to remove itself if( xLink.Is() ) - rLnkMgr.Remove( xLink ); + rLnkMgr.Remove( xLink.get() ); bRet = true; } diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index cae15e316a47..c46e1ea633aa 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -243,7 +243,7 @@ SwSection::~SwSection() if (CONTENT_SECTION != m_Data.GetType()) { - pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( m_RefLink ); + pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( m_RefLink.get() ); } if (m_RefObj.Is()) @@ -559,7 +559,7 @@ OUString SwSection::GetLinkFileName() const OUString sFilter; if (m_RefLink->GetLinkManager() && sfx2::LinkManager::GetDisplayNames( - m_RefLink, nullptr, &sTmp, &sRange, &sFilter )) + m_RefLink.get(), nullptr, &sTmp, &sRange, &sFilter )) { sTmp += OUStringLiteral1(sfx2::cTokenSeparator) + sFilter + OUStringLiteral1(sfx2::cTokenSeparator) + sRange; @@ -1509,7 +1509,7 @@ void SwSection::CreateLink( LinkCreateType eCreateType ) } else { - pFormat->GetDoc()->getIDocumentLinksAdministration().GetLinkManager().Remove( m_RefLink ); + pFormat->GetDoc()->getIDocumentLinksAdministration().GetLinkManager().Remove( m_RefLink.get() ); } SwIntrnlSectRefLink *const pLnk = @@ -1574,7 +1574,7 @@ void SwSection::BreakLink() OSL_ENSURE(pFormat, "SwSection::BreakLink: no format?"); if (pFormat) { - pFormat->GetDoc()->getIDocumentLinksAdministration().GetLinkManager().Remove( m_RefLink ); + pFormat->GetDoc()->getIDocumentLinksAdministration().GetLinkManager().Remove( m_RefLink.get() ); } m_RefLink.Clear(); } diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx index 69493290342d..413b904e6f77 100644 --- a/sw/source/core/fields/ddefld.cxx +++ b/sw/source/core/fields/ddefld.cxx @@ -243,7 +243,7 @@ SwDDEFieldType::SwDDEFieldType(const OUString& rName, SwDDEFieldType::~SwDDEFieldType() { if( pDoc && !pDoc->IsInDtor() ) - pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( refLink ); + pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( refLink.get() ); refLink->Disconnect(); } @@ -286,14 +286,14 @@ void SwDDEFieldType::SetDoc( SwDoc* pNewDoc ) if( pDoc && refLink.Is() ) { OSL_ENSURE( !nRefCnt, "How do we get the references?" ); - pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( refLink ); + pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( refLink.get() ); } pDoc = pNewDoc; if( pDoc && nRefCnt ) { refLink->SetVisible( pDoc->getIDocumentLinksAdministration().IsVisibleLinks() ); - pDoc->getIDocumentLinksAdministration().GetLinkManager().InsertDDELink( refLink ); + pDoc->getIDocumentLinksAdministration().GetLinkManager().InsertDDELink( refLink.get() ); } } @@ -302,14 +302,14 @@ void SwDDEFieldType::RefCntChgd() if( nRefCnt ) { refLink->SetVisible( pDoc->getIDocumentLinksAdministration().IsVisibleLinks() ); - pDoc->getIDocumentLinksAdministration().GetLinkManager().InsertDDELink( refLink ); + pDoc->getIDocumentLinksAdministration().GetLinkManager().InsertDDELink( refLink.get() ); if( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ) UpdateNow(); } else { Disconnect(); - pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( refLink ); + pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( refLink.get() ); } } diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index a5575c2172a4..36e1e37ba2d4 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -180,7 +180,7 @@ bool SwGrfNode::ReRead( } else // no name anymore, so remove link { - GetDoc()->getIDocumentLinksAdministration().GetLinkManager().Remove( refLink ); + GetDoc()->getIDocumentLinksAdministration().GetLinkManager().Remove( refLink.get() ); refLink.Clear(); } @@ -301,7 +301,7 @@ SwGrfNode::~SwGrfNode() if( refLink.Is() ) { OSL_ENSURE( !bInSwapIn, "DTOR: I am still in SwapIn" ); - pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( refLink ); + pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( refLink.get() ); refLink->Disconnect(); } else @@ -522,7 +522,7 @@ bool SwGrfNode::SwapIn( bool bWaitForData ) bool bRet = false; bInSwapIn = true; - SwBaseLink* pLink = static_cast<SwBaseLink*>(static_cast<sfx2::SvBaseLink*>(refLink)); + SwBaseLink* pLink = static_cast<SwBaseLink*>( refLink.get() ); if( pLink ) { @@ -632,14 +632,14 @@ bool SwGrfNode::GetFileFilterNms( OUString* pFileNm, OUString* pFilterNm ) const sal_uInt16 nType = refLink->GetObjType(); if( OBJECT_CLIENT_GRF == nType ) bRet = sfx2::LinkManager::GetDisplayNames( - refLink, nullptr, pFileNm, nullptr, pFilterNm ); + refLink.get(), nullptr, pFileNm, nullptr, pFilterNm ); else if( OBJECT_CLIENT_DDE == nType && pFileNm && pFilterNm ) { OUString sApp; OUString sTopic; OUString sItem; if( sfx2::LinkManager::GetDisplayNames( - refLink, &sApp, &sTopic, &sItem ) ) + refLink.get(), &sApp, &sTopic, &sItem ) ) { *pFileNm = sApp + OUStringLiteral1(sfx2::cTokenSeparator) + sTopic + OUStringLiteral1(sfx2::cTokenSeparator) @@ -661,7 +661,7 @@ bool SwGrfNode::SavePersistentData() if( refLink.Is() ) { OSL_ENSURE( !bInSwapIn, "SavePersistentData: I am still in SwapIn" ); - GetDoc()->getIDocumentLinksAdministration().GetLinkManager().Remove( refLink ); + GetDoc()->getIDocumentLinksAdministration().GetLinkManager().Remove( refLink.get() ); return true; } @@ -690,7 +690,7 @@ bool SwGrfNode::RestorePersistentData() { IDocumentLinksAdministration& rIDLA = getIDocumentLinksAdministration(); refLink->SetVisible( rIDLA.IsVisibleLinks() ); - rIDLA.GetLinkManager().InsertDDELink( refLink ); + rIDLA.GetLinkManager().InsertDDELink( refLink.get() ); if( getIDocumentLayoutAccess().GetCurrentLayout() ) refLink->Update(); } @@ -712,7 +712,7 @@ void SwGrfNode::InsertLink( const OUString& rGrfName, const OUString& rFltName ) sApp = rGrfName.getToken( 0, sfx2::cTokenSeparator, nTmp ); sTopic = rGrfName.getToken( 0, sfx2::cTokenSeparator, nTmp ); sItem = rGrfName.copy( nTmp ); - rIDLA.GetLinkManager().InsertDDELink( refLink, + rIDLA.GetLinkManager().InsertDDELink( refLink.get(), sApp, sTopic, sItem ); } else @@ -739,12 +739,12 @@ void SwGrfNode::ReleaseLink() { bInSwapIn = true; - SwBaseLink* pLink = static_cast<SwBaseLink*>(static_cast<sfx2::SvBaseLink*>(refLink)); + SwBaseLink* pLink = static_cast<SwBaseLink*>( refLink.get() ); pLink->SwapIn( true, true ); bInSwapIn = false; } - getIDocumentLinksAdministration().GetLinkManager().Remove( refLink ); + getIDocumentLinksAdministration().GetLinkManager().Remove( refLink.get() ); refLink.Clear(); maGrfObj.SetLink(); @@ -937,11 +937,11 @@ SwContentNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const OUString sFile, sFilter; if( IsLinkedFile() ) - sfx2::LinkManager::GetDisplayNames( refLink, nullptr, &sFile, nullptr, &sFilter ); + sfx2::LinkManager::GetDisplayNames( refLink.get(), nullptr, &sFile, nullptr, &sFilter ); else if( IsLinkedDDE() ) { OUString sTmp1, sTmp2; - sfx2::LinkManager::GetDisplayNames( refLink, &sTmp1, &sTmp2, &sFilter ); + sfx2::LinkManager::GetDisplayNames( refLink.get(), &sTmp1, &sTmp2, &sFilter ); sfx2::MakeLnkName( sFile, &sTmp1, sTmp2, sFilter ); sFilter = "DDE"; } @@ -1097,7 +1097,7 @@ void SwGrfNode::TriggerAsyncRetrieveInputStream() mpThreadConsumer.reset( new SwAsyncRetrieveInputStreamThreadConsumer( *this ) ); OUString sGrfNm; - sfx2::LinkManager::GetDisplayNames( refLink, nullptr, &sGrfNm ); + sfx2::LinkManager::GetDisplayNames( refLink.get(), nullptr, &sGrfNm ); OUString sReferer; SfxObjectShell * sh = GetDoc()->GetPersist(); if (sh != nullptr && sh->HasName()) @@ -1152,7 +1152,7 @@ bool SwGrfNode::IsAsyncRetrieveInputStreamPossible() const if ( IsLinkedFile() ) { OUString sGrfNm; - sfx2::LinkManager::GetDisplayNames( refLink, nullptr, &sGrfNm ); + sfx2::LinkManager::GetDisplayNames( refLink.get(), nullptr, &sGrfNm ); if ( !sGrfNm.startsWith( "vnd.sun.star.pkg:" ) ) { bRet = true; diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 929c0f32cc97..35cd05255983 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -864,7 +864,7 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const OUString* pRealFileName ) sal_uLong nError = 0; if( pMedium ) nError = rxWriter->Write( *pPam, *pMedium, pRealFileName ); - else if( pStg ) + else if( pStg.Is() ) nError = rxWriter->Write( *pPam, *pStg, pRealFileName ); else if( pStrm ) nError = rxWriter->Write( *pPam, *pStrm, pRealFileName ); diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index 75ee64c144ae..6f00814e47b5 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -332,7 +332,7 @@ void WW8Export::OutputLinkedOLE( const OUString& rOleId ) { tools::SvRef<SotStorage> xOleDst = xObjStg->OpenSotStorage( rOleId ); if ( xOleDst.Is() ) - xObjSrc->CopyTo( xOleDst ); + xObjSrc->CopyTo( xOleDst.get() ); if ( !xOleDst->GetError( ) ) { diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx index 35e01924d294..f25d66e4e956 100644 --- a/sw/source/filter/ww8/ww8glsy.cxx +++ b/sw/source/filter/ww8/ww8glsy.cxx @@ -222,7 +222,7 @@ bool WW8Glossary::Load( SwTextBlocks &rBlocks, bool bSaveRelFile ) aPamo.GetPoint()->nContent.Assign(aIdx.GetNode().GetContentNode(), 0); std::unique_ptr<SwWW8ImplReader> xRdr(new SwWW8ImplReader( - pGlossary->m_nVersion, xStg, &rStrm, *pD, rBlocks.GetBaseURL(), + pGlossary->m_nVersion, xStg.get(), &rStrm, *pD, rBlocks.GetBaseURL(), true, false, *aPamo.GetPoint())); xRdr->LoadDoc(this); bRet = MakeEntries(pD, rBlocks, bSaveRelFile, aStrings, aData); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 40b610fbb046..0d67089799ca 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -4902,7 +4902,7 @@ void SwWW8ImplReader::ReadGlobalTemplateSettings( const OUString& sCreatedFrom, if (xTableStream.Is() && SVSTREAM_OK == xTableStream->GetError()) { xTableStream->SetEndian(SvStreamEndian::LITTLE); - WW8Customizations aGblCustomisations( xTableStream, aWwFib ); + WW8Customizations aGblCustomisations( xTableStream.get(), aWwFib ); aGblCustomisations.Import( m_pDocShell ); } } @@ -6168,7 +6168,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportDOC(const OUString &rURL sal_uLong WW8Reader::OpenMainStream( tools::SvRef<SotStorageStream>& rRef, sal_uInt16& rBuffSize ) { sal_uLong nRet = ERR_SWG_READ_ERROR; - OSL_ENSURE( pStg, "Where is my Storage?" ); + OSL_ENSURE( pStg.get(), "Where is my Storage?" ); rRef = pStg->OpenSotStream( "WordDocument", StreamMode::READ | StreamMode::SHARE_DENYALL); if( rRef.Is() ) @@ -6215,7 +6215,7 @@ sal_uLong WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, co else if ( sFltName=="CWW7" ) nVersion = 7; - if( pStg ) + if( pStg.Is() ) { nRet = OpenMainStream( refStrm, nOldBuffSize ); pIn = &refStrm; @@ -6229,7 +6229,7 @@ sal_uLong WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, co if( !nRet ) { - std::unique_ptr<SwWW8ImplReader> pRdr(new SwWW8ImplReader(nVersion, pStg, pIn, rDoc, + std::unique_ptr<SwWW8ImplReader> pRdr(new SwWW8ImplReader(nVersion, pStg.get(), pIn, rDoc, rBaseURL, bNew, bSkipImages, *rPaM.GetPoint())); if (bNew) { @@ -6283,7 +6283,7 @@ bool WW8Reader::ReadGlossaries(SwTextBlocks& rBlocks, bool bSaveRelFiles) const tools::SvRef<SotStorageStream> refStrm; if (!pThis->OpenMainStream(refStrm, nOldBuffSize)) { - WW8Glossary aGloss( refStrm, 8, pStg ); + WW8Glossary aGloss( refStrm, 8, pStg.get() ); bRet = aGloss.Load( rBlocks, bSaveRelFiles ); } return bRet; diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx index 7f88b578b634..b48c94af0516 100644 --- a/sw/source/filter/ww8/ww8par4.cxx +++ b/sw/source/filter/ww8/ww8par4.cxx @@ -84,7 +84,7 @@ static bool SwWw8ReadScaling(long& rX, long& rY, tools::SvRef<SotStorage>& rSrc1 tools::SvRef<SotStorageStream> xSrc3 = rSrc1->OpenSotStream( "\3PIC", StreamMode::STD_READ ); - SotStorageStream* pS = xSrc3; + SotStorageStream* pS = xSrc3.get(); pS->SetEndian( SvStreamEndian::LITTLE ); pS->Seek( STREAM_SEEK_TO_END ); @@ -129,7 +129,7 @@ static bool SwWw6ReadMetaStream(GDIMetaFile& rWMF, OLE_MFP* pMfp, { tools::SvRef<SotStorageStream> xSrc2 = rSrc1->OpenSotStream( "\3META", StreamMode::STD_READ ); - SotStorageStream* pSt = xSrc2; + SotStorageStream* pSt = xSrc2.get(); pSt->SetEndian( SvStreamEndian::LITTLE ); size_t const nRead = pSt->ReadBytes(pMfp, sizeof(*pMfp)); // read mini-placable-header @@ -182,7 +182,7 @@ static bool SwWw6ReadMacPICTStream(Graphic& rGraph, tools::SvRef<SotStorage>& rS { // 03-META-stream does not exist. Maybe a 03-PICT? tools::SvRef<SotStorageStream> xSrc4 = rSrc1->OpenSotStream("\3PICT"); - SotStorageStream* pStp = xSrc4; + SotStorageStream* pStp = xSrc4.get(); pStp->SetEndian( SvStreamEndian::LITTLE ); sal_uInt8 aTestA[10]; // Does the 01Ole-stream even exist? size_t const nReadTst = pStp->ReadBytes(aTestA, sizeof(aTestA)); diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 94167640764a..503f83ef11b4 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -641,7 +641,7 @@ sal_uInt16 SwWW8ImplReader::End_Field() if ( xObjDst.Is() ) { - xSrc1->CopyTo( xObjDst ); + xSrc1->CopyTo( xObjDst.get() ); if ( !xObjDst->GetError() ) xObjDst->Commit(); diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 52421db6dc87..cf34f85c11a1 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -3986,7 +3986,7 @@ void SwEntryBrowseBox::PaintCell(OutputDevice& rDev, ::svt::CellController* SwEntryBrowseBox::GetController(long /*nRow*/, sal_uInt16 nCol) { - return nCol < ITEM_CASE ? m_xController : m_xCheckController; + return nCol < ITEM_CASE ? m_xController.get() : m_xCheckController.get(); } bool SwEntryBrowseBox::SaveModified() @@ -4000,12 +4000,12 @@ bool SwEntryBrowseBox::SaveModified() ::svt::CellController* pController = nullptr; if(nCol < ITEM_CASE) { - pController = m_xController; + pController = m_xController.get(); sNew = static_cast< ::svt::EditCellController*>(pController)->GetEditImplementation()->GetText( LINEEND_LF ); } else { - pController = m_xCheckController; + pController = m_xCheckController.get(); bVal = static_cast< ::svt::CheckBoxCellController*>(pController)->GetCheckBox().IsChecked(); } AutoMarkEntry* pEntry = (nRow >= m_Entries.size()) ? new AutoMarkEntry @@ -4040,13 +4040,13 @@ void SwEntryBrowseBox::InitController( if(nCol < ITEM_CASE) { rController = m_xController; - ::svt::CellController* pController = m_xController; + ::svt::CellController* pController = m_xController.get(); static_cast< ::svt::EditCellController*>(pController)->GetEditImplementation()->SetText( rText ); } else { rController = m_xCheckController; - ::svt::CellController* pController = m_xCheckController; + ::svt::CellController* pController = m_xCheckController.get(); static_cast< ::svt::CheckBoxCellController*>(pController)->GetCheckBox().Check( rText == m_sYes ); } @@ -4109,9 +4109,9 @@ void SwEntryBrowseBox::WriteEntries(SvStream& rOutStr) const sal_uInt16 nCol = GetCurColumnId(); ::svt::CellController* pController; if(nCol < ITEM_CASE) - pController = m_xController; + pController = m_xController.get(); else - pController = m_xCheckController; + pController = m_xCheckController.get(); if(pController ->IsModified()) GoToColumnId(nCol + (nCol < ITEM_CASE ? 1 : -1 )); @@ -4145,9 +4145,9 @@ bool SwEntryBrowseBox::IsModified()const const sal_uInt16 nCol = GetCurColumnId(); ::svt::CellController* pController; if(nCol < ITEM_CASE) - pController = m_xController; + pController = m_xController.get(); else - pController = m_xCheckController; + pController = m_xCheckController.get(); return pController->IsModified(); } diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 781ca39149ca..2bf4ed906eb8 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -1027,7 +1027,7 @@ static SfxObjectShell* lcl_CreateWorkingDocument( if( pWrtShell ) *pWrtShell = pWorkWrtShell; if( pDoc ) *pDoc = pWorkDoc; - return xWorkObjectShell; + return xWorkObjectShell.get(); } uno::Reference< mail::XMailMessage > lcl_CreateMailFromDoc( @@ -1240,7 +1240,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, *pSourceShell, bMT_SHELL ? pSourceWindow : nullptr, nullptr, &pTargetView, &pTargetShell, &pTargetDoc ); if (nMaxDumpDocs) - lcl_SaveDebugDoc( xTargetDocShell, "MergeDoc" ); + lcl_SaveDebugDoc( xTargetDocShell.get(), "MergeDoc" ); } else if( pTargetView ) { @@ -1444,7 +1444,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, targetDocPageCount += pWorkShell->GetPageCnt(); if ( (nMaxDumpDocs < 0) || (nDocNo <= nMaxDumpDocs) ) - lcl_SaveDebugDoc( xTargetDocShell, "MergeDoc" ); + lcl_SaveDebugDoc( xTargetDocShell.get(), "MergeDoc" ); if (bMT_SHELL) { @@ -1577,7 +1577,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, } if( !lcl_SaveDoc( &aTempFileURL, pStoreToFilter, pStoreToFilterOptions, &rMergeDescriptor.aSaveToFilterData, - bIsPDFexport, xTargetDocShell, *pTargetShell ) ) + bIsPDFexport, xTargetDocShell.get(), *pTargetShell ) ) { m_aMergeStatus = MergeStatus::ERROR; } @@ -1595,7 +1595,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, if( !IsMergeError() && bMT_SHELL ) // leave docshell available for caller (e.g. MM wizard) rMergeDescriptor.pMailMergeConfigItem->SetTargetView( pTargetView ); - else if( xTargetDocShell ) + else if( xTargetDocShell.Is() ) xTargetDocShell->DoClose(); rescheduleGui(); @@ -2865,7 +2865,7 @@ void SwDBManager::ExecuteFormLetter( SwWrtShell& rSh, // SfxObjectShellRef is ok, since there should be no control over the document lifetime here SfxObjectShellRef xDocShell = rSh.GetView().GetViewFrame()->GetObjectShell(); - EMIT_SW_EVENT(MAIL_MERGE, xDocShell); + EMIT_SW_EVENT(MAIL_MERGE, xDocShell.get()); // prepare mail merge descriptor SwMergeDescriptor aMergeDesc( pImpl->pMergeDialog->GetMergeType(), rSh, aDescriptor ); @@ -2879,7 +2879,7 @@ void SwDBManager::ExecuteFormLetter( SwWrtShell& rSh, Merge( aMergeDesc ); - EMIT_SW_EVENT(MAIL_MERGE_END, xDocShell); + EMIT_SW_EVENT(MAIL_MERGE_END, xDocShell.get()); // reset the cursor inside xResSet = nullptr; diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx index aa667ef23aad..f081461d0366 100644 --- a/sw/source/uibase/uno/unomailmerge.cxx +++ b/sw/source/uibase/uno/unomailmerge.cxx @@ -599,7 +599,7 @@ uno::Any SAL_CALL SwXMailMerge::execute( aCurSelection = aTranslated; } - SfxViewFrame* pFrame = SfxViewFrame::GetFirst( xCurDocSh, false); + SfxViewFrame* pFrame = SfxViewFrame::GetFirst( xCurDocSh.get(), false); SwView *pView = pFrame ? dynamic_cast<SwView*>( pFrame->GetViewShell() ) : nullptr; if (!pView) throw RuntimeException(); @@ -803,9 +803,9 @@ uno::Any SAL_CALL SwXMailMerge::execute( OSL_ENSURE( !pOldSrc || pOldSrc == this, "Ooops... different event source already set." ); pMgr->SetMailMergeEvtSrc( this ); // launch events for listeners - SfxGetpApp()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), xCurDocSh)); + SfxGetpApp()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), xCurDocSh.get())); bool bSucc = pMgr->Merge( aMergeDesc ); - SfxGetpApp()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), xCurDocSh)); + SfxGetpApp()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), xCurDocSh.get())); pMgr->SetMailMergeEvtSrc( pOldSrc ); diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx index f3a556e06be1..70dd91ff6ffb 100644 --- a/unotools/source/ucbhelper/ucblockbytes.cxx +++ b/unotools/source/ucbhelper/ucblockbytes.cxx @@ -1395,9 +1395,9 @@ UcbLockBytesRef UcbLockBytes::CreateLockBytes( const Reference < XContent >& xCo xLockBytes->SetSynchronMode(); Reference< XActiveDataControl > xSink; if ( eOpenMode & StreamMode::WRITE ) - xSink = static_cast<XActiveDataControl*>(new UcbStreamer_Impl( xLockBytes )); + xSink = static_cast<XActiveDataControl*>(new UcbStreamer_Impl( xLockBytes.get() )); else - xSink = static_cast<XActiveDataControl*>(new UcbDataSink_Impl( xLockBytes )); + xSink = static_cast<XActiveDataControl*>(new UcbDataSink_Impl( xLockBytes.get() )); if ( rProps.getLength() ) { diff --git a/unotools/source/ucbhelper/ucbstreamhelper.cxx b/unotools/source/ucbhelper/ucbstreamhelper.cxx index e4a399058c59..8628634d59ac 100644 --- a/unotools/source/ucbhelper/ucbstreamhelper.cxx +++ b/unotools/source/ucbhelper/ucbstreamhelper.cxx @@ -122,7 +122,7 @@ static SvStream* lcl_CreateStream( const OUString& rFileName, StreamMode eOpenMo eOpenMode, xInteractionHandler ); if ( xLockBytes.Is() ) { - pStream = new SvStream( xLockBytes ); + pStream = new SvStream( xLockBytes.get() ); pStream->SetBufferSize( 4096 ); pStream->SetError( xLockBytes->GetError() ); } @@ -164,13 +164,14 @@ SvStream* UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode e return lcl_CreateStream( rFileName, eOpenMode, xIHScoped,!bFileExists ); } + SvStream* UcbStreamHelper::CreateStream( const Reference < XInputStream >& xStream ) { SvStream* pStream = nullptr; UcbLockBytesRef xLockBytes = UcbLockBytes::CreateInputLockBytes( xStream ); if ( xLockBytes.Is() ) { - pStream = new SvStream( xLockBytes ); + pStream = new SvStream( xLockBytes.get() ); pStream->SetBufferSize( 4096 ); pStream->SetError( xLockBytes->GetError() ); } @@ -186,7 +187,7 @@ SvStream* UcbStreamHelper::CreateStream( const Reference < XStream >& xStream ) UcbLockBytesRef xLockBytes = UcbLockBytes::CreateLockBytes( xStream ); if ( xLockBytes.Is() ) { - pStream = new SvStream( xLockBytes ); + pStream = new SvStream( xLockBytes.get() ); pStream->SetBufferSize( 4096 ); pStream->SetError( xLockBytes->GetError() ); } @@ -206,7 +207,7 @@ SvStream* UcbStreamHelper::CreateStream( const Reference < XInputStream >& xStre if ( !bCloseStream ) xLockBytes->setDontClose_Impl(); - pStream = new SvStream( xLockBytes ); + pStream = new SvStream( xLockBytes.get() ); pStream->SetBufferSize( 4096 ); pStream->SetError( xLockBytes->GetError() ); } @@ -225,7 +226,7 @@ SvStream* UcbStreamHelper::CreateStream( const Reference < XStream >& xStream, b if ( !bCloseStream ) xLockBytes->setDontClose_Impl(); - pStream = new SvStream( xLockBytes ); + pStream = new SvStream( xLockBytes.get() ); pStream->SetBufferSize( 4096 ); pStream->SetError( xLockBytes->GetError() ); } diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 0d39e962e70e..7aa50af968c1 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -61,7 +61,7 @@ CoreTextFontFace::CoreTextFontFace( const CoreTextFontFace& rSrc ) , mbHasOs2Table( rSrc.mbHasOs2Table ) , mbCmapEncodingRead( rSrc.mbCmapEncodingRead ) { - if( rSrc.mxCharMap ) + if( rSrc.mxCharMap.Is() ) mxCharMap = rSrc.mxCharMap; } @@ -77,7 +77,7 @@ CoreTextFontFace::CoreTextFontFace( const FontAttributes& rDFA, sal_IntPtr nFont CoreTextFontFace::~CoreTextFontFace() { - if( mxCharMap ) + if( mxCharMap.Is() ) { mxCharMap = nullptr; } @@ -93,7 +93,7 @@ static unsigned GetUShort( const unsigned char* p ){return((p[0]<<8)+p[1]);} const FontCharMapRef CoreTextFontFace::GetFontCharMap() const { // return the cached charmap - if( mxCharMap ) + if( mxCharMap.Is() ) return mxCharMap; // set the default charmap @@ -741,7 +741,7 @@ void AquaSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFontData, bool bV } FontCharMapRef xFCMap = mpFontData->GetFontCharMap(); - SAL_WARN_IF( !xFCMap || !xFCMap->GetCharCount(), "vcl", "no charmap" ); + SAL_WARN_IF( !xFCMap.Is() || !xFCMap->GetCharCount(), "vcl", "no charmap" ); // get unicode<->glyph encoding // TODO? avoid sft mapping by using the xFCMap itself diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 36f1602de603..1492fb70164b 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -250,7 +250,7 @@ bool OutputDevice::GetFontCharMap( FontCharMapRef& rxFontCharMap ) const return false; FontCharMapRef xFontCharMap ( mpGraphics->GetFontCharMap() ); - if (!xFontCharMap) + if (!xFontCharMap.Is()) { FontCharMapRef xDefaultMap( new FontCharMap() ); rxFontCharMap = xDefaultMap; diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx index 55df59ef0bab..bc46febae7da 100644 --- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx +++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx @@ -222,8 +222,8 @@ FreetypeFontInfo::FreetypeFontInfo( const FontAttributes& rDevFontAttributes, FreetypeFontInfo::~FreetypeFontInfo() { - if( mxFontCharMap ) - mxFontCharMap = nullptr; + if( mxFontCharMap.Is() ) + mxFontCharMap.Clear(); delete mpChar2Glyph; delete mpGlyph2Char; #if ENABLE_GRAPHITE @@ -979,7 +979,7 @@ const FontCharMapRef ServerFont::GetFontCharMap() const const FontCharMapRef& FreetypeFontInfo::GetFontCharMap() { // check if the charmap is already cached - if( mxFontCharMap ) + if( mxFontCharMap.Is() ) return mxFontCharMap; // get the charmap and cache it diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index ee3ea8342853..b76102176969 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -307,7 +307,7 @@ bool WinGlyphFallbackSubstititution::HasMissingChars( PhysicalFontFace* pFace, c { WinFontFace* pWinFont = static_cast< WinFontFace* >(pFace); FontCharMapRef xFontCharMap = pWinFont->GetFontCharMap(); - if( !xFontCharMap ) + if( !xFontCharMap.Is() ) { // construct a Size structure as the parameter of constructor of class FontSelectPattern const Size aSize( pFace->GetWidth(), pFace->GetHeight() ); @@ -334,7 +334,7 @@ bool WinGlyphFallbackSubstititution::HasMissingChars( PhysicalFontFace* pFace, c } // avoid fonts with unknown CMAP subtables for glyph fallback - if( !xFontCharMap || xFontCharMap->IsDefaultMap() ) + if( !xFontCharMap.Is() || xFontCharMap->IsDefaultMap() ) return false; int nMatchCount = 0; @@ -899,7 +899,7 @@ WinFontFace::WinFontFace( const FontAttributes& rDFS, WinFontFace::~WinFontFace() { - if( mxUnicodeMap ) + if( mxUnicodeMap.Is() ) mxUnicodeMap = 0; #if ENABLE_GRAPHITE if (mpGraphiteData) @@ -922,7 +922,7 @@ static inline DWORD CalcTag( const char p[4]) { return (p[0]+(p[1]<<8)+(p[2]<<16 void WinFontFace::UpdateFromHDC( HDC hDC ) const { // short circuit if already initialized - if( mxUnicodeMap != NULL ) + if( mxUnicodeMap.Is() ) return; ReadCmapTable( hDC ); @@ -1036,7 +1036,7 @@ void WinFontFace::ReadGsubTable( HDC hDC ) const void WinFontFace::ReadCmapTable( HDC hDC ) const { - if( mxUnicodeMap != NULL ) + if( mxUnicodeMap.Is() ) return; bool bIsSymbolFont = (meWinCharSet == SYMBOL_CHARSET); @@ -1055,7 +1055,7 @@ void WinFontFace::ReadCmapTable( HDC hDC ) const } } - if( !mxUnicodeMap ) + if( !mxUnicodeMap.Is() ) { mxUnicodeMap = FontCharMap::GetDefaultMap( bIsSymbolFont ); } @@ -2403,7 +2403,7 @@ void WinSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont, } const WinFontFace* pWinFont = static_cast<const WinFontFace*>(pFont); FontCharMapRef xFCMap = pWinFont->GetFontCharMap(); - SAL_WARN_IF( !xFCMap || !xFCMap->GetCharCount(), "vcl", "no map" ); + SAL_WARN_IF( !xFCMap.Is() || !xFCMap->GetCharCount(), "vcl", "no map" ); int nCharCount = xFCMap->GetCharCount(); sal_uInt32 nChar = xFCMap->GetFirstChar(); diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx index f6bf5864393b..2c6b062d990b 100644 --- a/writerperfect/source/common/WPXSvInputStream.cxx +++ b/writerperfect/source/common/WPXSvInputStream.cxx @@ -735,7 +735,7 @@ librevenge::RVNGInputStream *WPXSvInputStreamImpl::createWPXStream(const tools:: { if (rxStorage.Is()) { - Reference < XInputStream > xContents(new utl::OSeekableInputStreamWrapper(rxStorage)); + Reference < XInputStream > xContents(new utl::OSeekableInputStreamWrapper(rxStorage.get())); return new WPXSvInputStream(xContents); } return nullptr; |