tdf#89307: Removed T* SvRef::opeartor &()

Usage has been replaced with SvRef::get() or removed where applicable.

Change-Id: I49f108910b668466134c40940b53fc3ab2acd816
Reviewed-on: https://gerrit.libreoffice.org/29780
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 37bf1aa..6e29cae 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -1011,9 +1011,9 @@ bool BasicManager::ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) con
    bool bLoaded = false;
    if( xNew.Is() )
    {
        if( nullptr != dynamic_cast<const StarBASIC*>( &xNew ) )
        if( nullptr != dynamic_cast<const StarBASIC*>( xNew.get() ) )
        {
            StarBASIC* pNew = static_cast<StarBASIC*>(xNew.get());
            StarBASIC* pNew = static_cast<StarBASIC*>( xNew.get() );
            // Use the Parent of the old BASICs
            if( rOldBasic.Is() )
            {
diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx
index a90adf8..e5c428e 100644
--- a/basic/source/classes/eventatt.cxx
+++ b/basic/source/classes/eventatt.cxx
@@ -431,7 +431,7 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )

    // Get dialog
    SbxBaseRef pObj = rPar.Get( 1 )->GetObject();
    if( !(pObj.Is() && nullptr != dynamic_cast<const SbUnoObject*>( &pObj )) )
    if( !(pObj.Is() && nullptr != dynamic_cast<const SbUnoObject*>( pObj.get() )) )
    {
        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
        return;
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 561767a..141a308 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -868,7 +868,7 @@ Type getUnoTypeForSbxValue( const SbxValue* pVal )
            return aRetType;
        }

        if( nullptr != dynamic_cast<const SbxDimArray*>( &xObj) )
        if( nullptr != dynamic_cast<const SbxDimArray*>( xObj.get() ) )
        {
            SbxBase* pObj = xObj.get();
            SbxDimArray* pArray = static_cast<SbxDimArray*>(pObj);
@@ -962,12 +962,12 @@ Type getUnoTypeForSbxValue( const SbxValue* pVal )
            }
        }
        // No array, but ...
        else if( nullptr != dynamic_cast<const SbUnoObject*>( &xObj) )
        else if( nullptr != dynamic_cast<const SbUnoObject*>( xObj.get() ) )
        {
            aRetType = static_cast<SbUnoObject*>(xObj.get())->getUnoAny().getValueType();
        }
        // SbUnoAnyObject?
        else if( nullptr != dynamic_cast<const SbUnoAnyObject*>( &xObj) )
        else if( nullptr != dynamic_cast<const SbUnoAnyObject*>( xObj.get() ) )
        {
            aRetType = static_cast<SbUnoAnyObject*>(xObj.get())->getValue().getValueType();
        }
@@ -990,9 +990,9 @@ Any sbxToUnoValueImpl( const SbxValue* pVar, bool bBlockConversionToSmallestType
        SbxBaseRef xObj = pVar->GetObject();
        if( xObj.Is() )
        {
            if( nullptr != dynamic_cast<const SbUnoAnyObject*>( &xObj) )
            if( nullptr != dynamic_cast<const SbUnoAnyObject*>( xObj.get() ) )
                return static_cast<SbUnoAnyObject*>(xObj.get())->getValue();
            if( nullptr != dynamic_cast<const SbClassModuleObject*>( &xObj) )
            if( nullptr != dynamic_cast<const SbClassModuleObject*>( xObj.get() ) )
            {
                Any aRetAny;
                SbClassModuleObject* pClassModuleObj = static_cast<SbClassModuleObject*>(xObj.get());
@@ -1000,7 +1000,7 @@ Any sbxToUnoValueImpl( const SbxValue* pVar, bool bBlockConversionToSmallestType
                if( pClassModule->createCOMWrapperForIface( aRetAny, pClassModuleObj ) )
                    return aRetAny;
            }
            if( nullptr == dynamic_cast<const SbUnoObject*>( &xObj) )
            if( nullptr == dynamic_cast<const SbUnoObject*>( xObj.get() ) )
            {
                // Create NativeObjectWrapper to identify object in case of callbacks
                SbxObject* pObj = dynamic_cast<SbxObject*>( pVar->GetObject() );
@@ -1189,7 +1189,7 @@ Any sbxToUnoValue( const SbxValue* pVar, const Type& rType, Property* pUnoProper
    if( eBaseType == SbxOBJECT )
    {
        SbxBaseRef xObj = pVar->GetObject();
        if( xObj.Is() && nullptr != dynamic_cast<const SbUnoAnyObject*>( &xObj) )
        if( xObj.Is() && nullptr != dynamic_cast<const SbUnoAnyObject*>( xObj.get() ) )
        {
            return static_cast<SbUnoAnyObject*>(xObj.get())->getValue();
        }
@@ -1244,11 +1244,11 @@ Any sbxToUnoValue( const SbxValue* pVar, const Type& rType, Property* pUnoProper
                }

                SbxBaseRef pObj = pVar->GetObject();
                if( pObj.Is() && nullptr != dynamic_cast<const SbUnoObject*>( &pObj) )
                if( pObj.Is() && nullptr != dynamic_cast<const SbUnoObject*>( pObj.get() ) )
                {
                    aRetVal = static_cast<SbUnoObject*>(pObj.get())->getUnoAny();
                }
                else if( pObj.Is() && nullptr != dynamic_cast<const SbUnoStructRefObject*>( &pObj) )
                else if( pObj.Is() && nullptr != dynamic_cast<const SbUnoStructRefObject*>( pObj.get() ) )
                {
                    aRetVal = static_cast<SbUnoStructRefObject*>(pObj.get())->getUnoAny();
                }
@@ -1270,7 +1270,7 @@ Any sbxToUnoValue( const SbxValue* pVar, const Type& rType, Property* pUnoProper
                Reference< XIdlClass > xIdlClass;

                SbxBaseRef pObj = pVar->GetObject();
                if( pObj.Is() && nullptr != dynamic_cast<const SbUnoObject*>( &pObj) )
                if( pObj.Is() && nullptr != dynamic_cast<const SbUnoObject*>( pObj.get() ) )
                {
                    Any aUnoAny = static_cast<SbUnoObject*>( pObj.get() )->getUnoAny();
                    aUnoAny >>= xIdlClass;
@@ -1306,7 +1306,7 @@ Any sbxToUnoValue( const SbxValue* pVar, const Type& rType, Property* pUnoProper
        case TypeClass_SEQUENCE:
        {
            SbxBaseRef xObj = pVar->GetObject();
            if( xObj.Is() && nullptr != dynamic_cast<const SbxDimArray*>( &xObj) )
            if( xObj.Is() && nullptr != dynamic_cast<const SbxDimArray*>( xObj.get() ) )
            {
                SbxBase* pObj = xObj.get();
                SbxDimArray* pArray = static_cast<SbxDimArray*>(pObj);
@@ -3084,7 +3084,7 @@ void RTL_Impl_HasInterfaces( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )

    // get the Uno-Object
    SbxBaseRef pObj = rPar.Get( 1 )->GetObject();
    if( !(pObj.Is() && nullptr != dynamic_cast<const SbUnoObject*>( &pObj)) )
    if( !(pObj.Is() && nullptr != dynamic_cast<const SbUnoObject*>( pObj.get() )) )
    {
        return;
    }
@@ -3148,7 +3148,7 @@ void RTL_Impl_IsUnoStruct( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )
        return;
    }
    SbxBaseRef pObj = rPar.Get( 1 )->GetObject();
    if( !(pObj.Is() && nullptr != dynamic_cast<const SbUnoObject*>( &pObj)) )
    if( !(pObj.Is() && nullptr != dynamic_cast<const SbUnoObject*>( pObj.get() )) )
    {
        return;
    }
@@ -3183,7 +3183,7 @@ void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )
        return;
    }
    SbxBaseRef pObj1 = xParam1->GetObject();
    if( !(pObj1.Is() && nullptr != dynamic_cast<const SbUnoObject*>( &pObj1 )) )
    if( !(pObj1.Is() && nullptr != dynamic_cast<const SbUnoObject*>( pObj1.get() )) )
    {
        return;
    }
@@ -3202,7 +3202,7 @@ void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )
        return;
    }
    SbxBaseRef pObj2 = xParam2->GetObject();
    if( !(pObj2.Is() && nullptr != dynamic_cast<const SbUnoObject*>( &pObj2 )) )
    if( !(pObj2.Is() && nullptr != dynamic_cast<const SbUnoObject*>( pObj2.get() )) )
    {
        return;
    }
@@ -4192,7 +4192,7 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, bool bWrite )
            Reference< XIdlClass > xIdlClass;

            SbxBaseRef pObj = pVal->GetObject();
            if( pObj.Is() && nullptr != dynamic_cast<const SbUnoObject*>( &pObj) )
            if( pObj.Is() && nullptr != dynamic_cast<const SbUnoObject*>( pObj.get() ) )
            {
                Any aUnoAny = static_cast<SbUnoObject*>(pObj.get())->getUnoAny();
                aUnoAny >>= xIdlClass;
@@ -4286,7 +4286,7 @@ ModuleInvocationProxy::ModuleInvocationProxy( const OUString& aPrefix, SbxObject
    , m_xScopeObj( xScopeObj )
    , m_aListeners( m_aMutex )
{
    m_bProxyIsClassModuleObject = xScopeObj.Is() && nullptr != dynamic_cast<const SbClassModuleObject*>( &xScopeObj );
    m_bProxyIsClassModuleObject = xScopeObj.Is() && nullptr != dynamic_cast<const SbClassModuleObject*>( xScopeObj.get() );
}

Reference< XIntrospectionAccess > SAL_CALL ModuleInvocationProxy::getIntrospection() throw(std::exception)
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 068858f..1d9bacb 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -1596,11 +1596,11 @@ inline bool checkUnoStructCopy( bool bVBA, SbxVariableRef& refVal, SbxVariableRe
            return false;
    }
    // #115826: Exclude ProcedureProperties to avoid call to Property Get procedure
    else if( nullptr != dynamic_cast<const SbProcedureProperty*>( &refVar) )
    else if( nullptr != dynamic_cast<const SbProcedureProperty*>( refVar.get() ) )
        return false;

    SbxObjectRef xValObj = static_cast<SbxObject*>(refVal->GetObject());
    if( !xValObj.Is() || nullptr != dynamic_cast<const SbUnoAnyObject*>( &xValObj) )
    if( !xValObj.Is() || nullptr != dynamic_cast<const SbUnoAnyObject*>( xValObj.get() ) )
        return false;

    SbUnoObject* pUnoVal =  dynamic_cast<SbUnoObject*>( xValObj.get() );
@@ -1911,7 +1911,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
        }
        if ( bDimAsNew )
        {
            if( nullptr == dynamic_cast<const SbxObject*>( &refVar) )
            if( nullptr == dynamic_cast<const SbxObject*>( refVar.get() ) )
            {
                SbxBase* pValObjBase = refVal->GetObject();
                if( pValObjBase == nullptr )
@@ -2398,9 +2398,9 @@ void SbiRuntime::StepARGV()
        SbxVariableRef pVal = PopVar();

        // Before fix of #94916:
        if( nullptr != dynamic_cast<const SbxMethod*>( &pVal)
            || nullptr != dynamic_cast<const SbUnoProperty*>( &pVal)
            || nullptr != dynamic_cast<const SbProcedureProperty*>( &pVal) )
        if( nullptr != dynamic_cast<const SbxMethod*>( pVal.get() )
            || nullptr != dynamic_cast<const SbUnoProperty*>( pVal.get() )
            || nullptr != dynamic_cast<const SbProcedureProperty*>( pVal.get() ) )
        {
            // evaluate methods and properties!
            SbxVariable* pRes = new SbxVariable( *pVal );
@@ -2807,7 +2807,10 @@ void SbiRuntime::StepARGN( sal_uInt32 nOp1 )
    {
        OUString aAlias( pImg->GetString( static_cast<short>( nOp1 ) ) );
        SbxVariableRef pVal = PopVar();
        if( bVBAEnabled && ( nullptr != dynamic_cast<const SbxMethod*>( &pVal) || nullptr != dynamic_cast<const SbUnoProperty*>( &pVal) || nullptr != dynamic_cast<const SbProcedureProperty*>( &pVal) ) )
        if( bVBAEnabled &&
                ( nullptr != dynamic_cast<const SbxMethod*>( pVal.get())
                  || nullptr != dynamic_cast<const SbUnoProperty*>( pVal.get())
                  || nullptr != dynamic_cast<const SbProcedureProperty*>( pVal.get()) ) )
        {
            // named variables ( that are Any especially properties ) can be empty at this point and need a broadcast
            if ( pVal->GetType() == SbxEMPTY )
@@ -3186,7 +3189,7 @@ bool SbiRuntime::checkClass_Impl( const SbxVariableRef& refVal,
    SbxDataType t = refVal->GetType();
    SbxVariable* pVal = refVal.get();
    // we don't know the type of uno properties that are (maybevoid)
    if ( t == SbxEMPTY && nullptr != dynamic_cast<const SbUnoProperty*>( &refVal) )
    if ( t == SbxEMPTY && nullptr != dynamic_cast<const SbUnoProperty*>( refVal.get() ) )
    {
        SbUnoProperty* pProp = static_cast<SbUnoProperty*>(pVal);
        t = pProp->getRealType();
@@ -3675,7 +3678,7 @@ void SbiRuntime::SetupArgs( SbxVariable* p, sal_uInt32 nOp1 )
                {
                    // Check for default method with named parameters
                    SbxBaseRef xObj = p->GetObject();
                    if (SbUnoObject* pUnoObj = dynamic_cast<SbUnoObject*>(&xObj))
                    if (SbUnoObject* pUnoObj = dynamic_cast<SbUnoObject*>( xObj.get() ))
                    {
                        Any aAny = pUnoObj->getUnoAny();

diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx
index e96ac1a..8bf551a 100644
--- a/basic/source/sbx/sbxarray.cxx
+++ b/basic/source/sbx/sbxarray.cxx
@@ -293,7 +293,7 @@ void SbxArray::Remove( SbxVariable* pVar )
    {
        for( size_t i = 0; i < mVarEntries.size(); i++ )
        {
            if (&mVarEntries[i].mpVar == pVar)
            if (mVarEntries[i].mpVar.get() == pVar)
            {
                Remove( i ); break;
            }
@@ -359,7 +359,7 @@ SbxVariable* SbxArray::FindUserData( sal_uInt32 nData )

        if (rEntry.mpVar->IsVisible() && rEntry.mpVar->GetUserData() == nData)
        {
            p = &rEntry.mpVar;
            p = rEntry.mpVar.get();
            p->ResetFlag( SbxFlagBits::ExtFound );
            break;  // JSM 1995-10-06
        }
@@ -417,7 +417,7 @@ SbxVariable* SbxArray::Find( const OUString& rName, SbxClassType t )
            && (t == SbxClassType::DontCare || rEntry.mpVar->GetClass() == t)
            && (rEntry.mpVar->GetName().equalsIgnoreAsciiCase(rName)))
        {
            p = &rEntry.mpVar;
            p = rEntry.mpVar.get();
            p->ResetFlag(SbxFlagBits::ExtFound);
            break;
        }
diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx
index 7df24bd..bfd3d5b 100644
--- a/cui/source/dialogs/linkdlg.cxx
+++ b/cui/source/dialogs/linkdlg.cxx
@@ -438,7 +438,7 @@ IMPL_LINK_NOARG( SvBaseLinksDlg, BreakLinkClickHdl, Button*, void )

            // if somebody has forgotten to deregister himself
            if( xLink.Is() )
                pLinkMgr->Remove( &xLink );
                pLinkMgr->Remove( xLink.get() );

            if( bNewLnkMgr )
            {
@@ -477,7 +477,7 @@ IMPL_LINK_NOARG( SvBaseLinksDlg, BreakLinkClickHdl, Button*, void )
                xLink->Closed();

                // if somebody has forgotten to deregister himself
                pLinkMgr->Remove( &xLink );
                pLinkMgr->Remove( xLink.get() );
                bModified = true;
            }
            // then remove all selected entries
diff --git a/dbaccess/source/ui/browser/dbexchange.cxx b/dbaccess/source/ui/browser/dbexchange.cxx
index 00e9ab6..f3bd8e7 100644
--- a/dbaccess/source/ui/browser/dbexchange.cxx
+++ b/dbaccess/source/ui/browser/dbexchange.cxx
@@ -141,7 +141,7 @@ namespace dbaui
            ODatabaseImportExport* pExport = static_cast<ODatabaseImportExport*>(pUserObject);
            if ( pExport && rxOStm.Is() )
            {
                pExport->setStream(&rxOStm);
                pExport->setStream(rxOStm.get());
                return pExport->Write();
            }
        }
diff --git a/include/tools/ref.hxx b/include/tools/ref.hxx
index ff7175b..fd00dad 100644
--- a/include/tools/ref.hxx
+++ b/include/tools/ref.hxx
@@ -92,8 +92,6 @@ public:

    T * get()         const { return pObj; }

    T * operator &()  const { return pObj; }

    T * operator ->() const { assert(pObj != nullptr); return pObj; }

    T & operator *()  const { assert(pObj != nullptr); return *pObj; }
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 8701a6e..3a53e66 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -687,8 +687,8 @@ public:

    SCTAB           GetMaxTableNumber() { return static_cast<SCTAB>(maTabs.size()) - 1; }

    ScRangePairList*    GetColNameRanges() { return &xColNameRanges; }
    ScRangePairList*    GetRowNameRanges() { return &xRowNameRanges; }
    ScRangePairList*    GetColNameRanges() { return xColNameRanges.get(); }
    ScRangePairList*    GetRowNameRanges() { return xRowNameRanges.get(); }
    ScRangePairListRef& GetColNameRangesRef() { return xColNameRanges; }
    ScRangePairListRef& GetRowNameRangesRef() { return xRowNameRanges; }

diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 39cc31f60..5b70a5b 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -3164,7 +3164,7 @@ void ScExternalRefManager::transformUnsavedRefToSavedRef( SfxObjectShell* pShell
    DocShellMap::iterator itr = maUnsavedDocShells.begin();
    while( itr != maUnsavedDocShells.end() )
    {
        if (&(itr->second.maShell) == pShell)
        if ( itr->second.maShell.get() == pShell )
        {
            // found that the shell is marked as unsaved
            OUString aFileURL = pShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DECODE_TO_IURI);
diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index 61fa1ab..f0851b5 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -126,7 +126,7 @@ void ScDrawView::BeginDrag( vcl::Window* pWindow, const Point& rStartPos )
        ScDrawTransferObj* pTransferObj = new ScDrawTransferObj( pModel, pDocSh, aObjDesc );
        uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );

        pTransferObj->SetDrawPersist( &aDragShellRef );    // keep persist for ole objects alive
        pTransferObj->SetDrawPersist( aDragShellRef.get() );    // keep persist for ole objects alive
        pTransferObj->SetDragSource( this );               // copies selection

        SC_MOD()->SetDragObject( nullptr, pTransferObj );     // for internal D&D
diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx
index 40a423a..a1d8434 100644
--- a/sd/source/ui/app/sdxfer.cxx
+++ b/sd/source/ui/app/sdxfer.cxx
@@ -579,7 +579,7 @@ bool SdTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDo
                }

                maDocShellRef->SetVisArea( maVisArea );
                bOK = SetObject( &maDocShellRef, SDTRANSFER_OBJECTTYPE_DRAWOLE, rFlavor );
                bOK = SetObject( maDocShellRef.get(), SDTRANSFER_OBJECTTYPE_DRAWOLE, rFlavor );

                mpSdDrawDocumentIntern->SetSwapGraphicsMode( nOldSwapMode );
            }
diff --git a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
index 4f4c195..9c8b3c9 100644
--- a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
+++ b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
@@ -94,7 +94,7 @@ void InsertionIndicatorOverlay::Create (const SdTransferable* pTransferable)
        nSelectionCount = pTransferable->GetPageBookmarks().size();
    else
    {
        DrawDocShell* pDataDocShell = dynamic_cast<DrawDocShell*>(&pTransferable->GetDocShell());
        DrawDocShell* pDataDocShell = dynamic_cast<DrawDocShell*>(pTransferable->GetDocShell().get());
        if (pDataDocShell != nullptr)
        {
            SdDrawDocument* pDataDocument = pDataDocShell->GetDoc();
diff --git a/sfx2/source/appl/linksrc.cxx b/sfx2/source/appl/linksrc.cxx
index 3156a35..d146fe9 100644
--- a/sfx2/source/appl/linksrc.cxx
+++ b/sfx2/source/appl/linksrc.cxx
@@ -373,7 +373,7 @@ void SvLinkSource::RemoveAllDataAdvise( SvBaseLink * pLink )
{
    SvLinkSource_EntryIter_Impl aIter( pImpl->aArr );
    for( SvLinkSource_Entry_Impl* p = aIter.Curr(); p; p = aIter.Next() )
        if( p->bIsDataSink && &p->xSink == pLink )
        if( p->bIsDataSink && p->xSink.get() == pLink )
        {
            pImpl->aArr.DeleteAndDestroy( p );
        }
@@ -390,7 +390,7 @@ void SvLinkSource::RemoveConnectAdvise( SvBaseLink * pLink )
{
    SvLinkSource_EntryIter_Impl aIter( pImpl->aArr );
    for( SvLinkSource_Entry_Impl* p = aIter.Curr(); p; p = aIter.Next() )
        if( !p->bIsDataSink && &p->xSink == pLink )
        if( !p->bIsDataSink && p->xSink.get() == pLink )
        {
            pImpl->aArr.DeleteAndDestroy( p );
        }
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 13e762a..b93fd17 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1586,7 +1586,7 @@ SvKeyValueIterator* SfxObjectShell::GetHeaderAttributes()
        DBG_ASSERT( pMedium, "No Medium" );
        pImpl->xHeaderAttributes = new SfxHeaderAttributes_Impl( this );
    }
    return static_cast<SvKeyValueIterator*>( &pImpl->xHeaderAttributes );
    return static_cast<SvKeyValueIterator*>( pImpl->xHeaderAttributes.get() );
}

void SfxObjectShell::ClearHeaderAttributesForSourceViewHack()
diff --git a/starmath/source/eqnolefilehdr.cxx b/starmath/source/eqnolefilehdr.cxx
index 3cac2b3..5ffc66e 100644
--- a/starmath/source/eqnolefilehdr.cxx
+++ b/starmath/source/eqnolefilehdr.cxx
@@ -34,7 +34,7 @@ bool GetMathTypeVersion( SotStorage* pStor, sal_uInt8 &nVersion )
        StreamMode::STD_READ);
    if ( (!xSrc.Is()) || (SVSTREAM_OK != xSrc->GetError()))
        return bSuccess;
    SotStorageStream *pS = &xSrc;
    SotStorageStream *pS = xSrc.get();
    pS->SetEndian( SvStreamEndian::LITTLE );

    EQNOLEFILEHDR aHdr;
diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx
index 05af492..1e10715 100644
--- a/starmath/source/mathtype.cxx
+++ b/starmath/source/mathtype.cxx
@@ -560,7 +560,7 @@ bool MathType::Parse(SotStorage *pStor)
        StreamMode::STD_READ);
    if ( (!xSrc.Is()) || (SVSTREAM_OK != xSrc->GetError()))
        return false;
    pS = &xSrc;
    pS = xSrc.get();
    pS->SetEndian( SvStreamEndian::LITTLE );

    EQNOLEFILEHDR aHdr;
@@ -1921,7 +1921,7 @@ bool MathType::ConvertFromStarMath( SfxMedium& rMedium )
        if ( (!xSrc.Is()) || (SVSTREAM_OK != xSrc->GetError()))
            return false;

        pS = &xSrc;
        pS = xSrc.get();
        pS->SetEndian( SvStreamEndian::LITTLE );

        pS->SeekRel(EQNOLEFILEHDR_SIZE); //Skip 28byte Header and fill it in later
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index fbeec83..b6e46a8 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -2915,7 +2915,7 @@ CellController* DbGridControl::GetController(long /*nRow*/, sal_uInt16 nColumnId

    CellController* pReturn = nullptr;
    if (IsFilterMode())
        pReturn = &pColumn->GetController();
        pReturn = pColumn->GetController().get();
    else
    {
        if (::comphelper::hasProperty(FM_PROP_ENABLED, pColumn->getModel()))
@@ -2929,7 +2929,7 @@ CellController* DbGridControl::GetController(long /*nRow*/, sal_uInt16 nColumnId

        if ((bInsert && !pColumn->IsAutoValue()) || bUpdate)
        {
            pReturn = &pColumn->GetController();
            pReturn = pColumn->GetController().get();
        }
    }
    return pReturn;
@@ -3042,7 +3042,7 @@ void DbGridControl::Undo()
        EndCursorAction();

        m_xDataRow->SetState(m_pDataCursor, false);
        if (&m_xPaintRow == &m_xCurrentRow)
        if (m_xPaintRow == m_xCurrentRow)
            m_xPaintRow = m_xCurrentRow = m_xDataRow;
        else
            m_xCurrentRow = m_xDataRow;
@@ -3087,7 +3087,7 @@ void DbGridControl::resetCurrentRow()

        // update the rows
        m_xDataRow->SetState(m_pDataCursor, false);
        if (&m_xPaintRow == &m_xCurrentRow)
        if (m_xPaintRow == m_xCurrentRow)
            m_xPaintRow = m_xCurrentRow = m_xDataRow;
        else
            m_xCurrentRow = m_xDataRow;
diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx
index 48fdd15..26521a73 100644
--- a/svx/source/gallery2/galmisc.cxx
+++ b/svx/source/gallery2/galmisc.cxx
@@ -514,7 +514,7 @@ bool GalleryTransferable::GetData( const datatransfer::DataFlavor& rFlavor, cons

    if( ( SotClipboardFormatId::DRAWING == nFormat ) && ( SgaObjKind::SvDraw == meObjectKind ) )
    {
        bRet = ( mxModelStream.Is() && SetObject( &mxModelStream, SotClipboardFormatId::NONE, rFlavor ) );
        bRet = ( mxModelStream.Is() && SetObject( mxModelStream.get(), SotClipboardFormatId::NONE, rFlavor ) );
    }
    else if( ( SotClipboardFormatId::SVIM == nFormat ) && mpImageMap )
    {
diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx
index 83f2b93..920ef8c 100644
--- a/sw/inc/section.hxx
+++ b/sw/inc/section.hxx
@@ -213,8 +213,8 @@ public:

    // Data server methods.
    void SetRefObject( SwServerObject* pObj );
    const SwServerObject* GetObject() const {  return & m_RefObj; }
          SwServerObject* GetObject()       {  return & m_RefObj; }
    const SwServerObject* GetObject() const {  return m_RefObj.get(); }
          SwServerObject* GetObject()       {  return m_RefObj.get(); }
    bool IsServer() const                   {  return m_RefObj.Is(); }

    // Methods for linked ranges.
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index 5d31a43..6e4251bb 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -308,8 +308,8 @@ public:

    // Data server methods.
    void SetRefObject( SwServerObject* );
    const SwServerObject* GetObject() const     {  return &m_xRefObj; }
          SwServerObject* GetObject()           {  return &m_xRefObj; }
    const SwServerObject* GetObject() const     {  return m_xRefObj.get(); }
          SwServerObject* GetObject()           {  return m_xRefObj.get(); }

    // Fill data for chart.
    void UpdateCharts() const;
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index ec2f70b..2ba5c11 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -262,7 +262,7 @@ namespace sw { namespace mark
        {
            if(m_aRefObj->HasDataLinks())
            {
                ::sfx2::SvLinkSource* p = &m_aRefObj;
                ::sfx2::SvLinkSource* p = m_aRefObj.get();
                p->SendDataChanged();
            }
            m_aRefObj->SetNoServer();
diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx
index bef09f1..05fe51c 100644
--- a/sw/source/core/doc/swserv.cxx
+++ b/sw/source/core/doc/swserv.cxx
@@ -309,7 +309,7 @@ SwDataChanged::~SwDataChanged()
            // Any one else interested in the Object?
            if( refObj->HasDataLinks() && dynamic_cast<const SwServerObject*>( refObj.get() ) !=  nullptr)
            {
                SwServerObject& rObj = *static_cast<SwServerObject*>(&refObj);
                SwServerObject& rObj = *static_cast<SwServerObject*>( refObj.get() );
                if( pPos )
                    rObj.SendDataChanged( *pPos );
                else
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index c46e1ea..9504b74 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -248,7 +248,7 @@ SwSection::~SwSection()

        if (m_RefObj.Is())
        {
            pDoc->getIDocumentLinksAdministration().GetLinkManager().RemoveServer( &m_RefObj );
            pDoc->getIDocumentLinksAdministration().GetLinkManager().RemoveServer( m_RefObj.get() );
        }

        // If the Section is the last Client in the Format we can delete it
@@ -1275,7 +1275,7 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
                                    sFilter, 0, pDoc->GetDocShell() );
                if( nRet )
                {
                    SwDoc* pSrcDoc = static_cast<SwDocShell*>(&xDocSh)->GetDoc();
                    SwDoc* pSrcDoc = static_cast<SwDocShell*>( xDocSh.get() )->GetDoc();
                    eOldRedlineFlags = pSrcDoc->getIDocumentRedlineAccess().GetRedlineFlags();
                    pSrcDoc->getIDocumentRedlineAccess().SetRedlineFlags( RedlineFlags::ShowInsert );
                }
@@ -1298,7 +1298,7 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
                                static_cast<const SfxStringItem*>(pItem)->GetValue() );
                }

                SwDoc* pSrcDoc = static_cast<SwDocShell*>(&xDocSh)->GetDoc();
                SwDoc* pSrcDoc = static_cast<SwDocShell*>( xDocSh.get() )->GetDoc();

                if( !sRange.isEmpty() )
                {
@@ -1388,8 +1388,8 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
            {
                if( 2 == nRet )
                    xDocSh->DoClose();
                else if( static_cast<SwDocShell*>(&xDocSh)->GetDoc() )
                    static_cast<SwDocShell*>(&xDocSh)->GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags(
                else if( static_cast<SwDocShell*>( xDocSh.get() )->GetDoc() )
                    static_cast<SwDocShell*>( xDocSh.get() )->GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags(
                                eOldRedlineFlags );
            }
        }
@@ -1513,7 +1513,7 @@ void SwSection::CreateLink( LinkCreateType eCreateType )
    }

    SwIntrnlSectRefLink *const pLnk =
        static_cast<SwIntrnlSectRefLink*>(& m_RefLink);
        static_cast<SwIntrnlSectRefLink*>( m_RefLink.get() );

    const OUString sCmd(SwSectionData::CollapseWhiteSpaces(m_Data.GetLinkFileName()));
    pLnk->SetUpdateMode( nUpdateType );
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 36e1e37..c1c747d 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -131,7 +131,7 @@ SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
            FStatHelper::IsDocument( aUrl.GetMainURL( INetURLObject::NO_DECODE ) ))
        {
            // file exists, so create connection without an update
            static_cast<SwBaseLink*>(&refLink)->Connect();
            static_cast<SwBaseLink*>( refLink.get() )->Connect();
        }
    }
}
@@ -172,7 +172,7 @@ bool SwGrfNode::ReRead(
                if( nNewType != refLink->GetObjType() )
                {
                    refLink->Disconnect();
                    static_cast<SwBaseLink*>(&refLink)->SetObjType( nNewType );
                    static_cast<SwBaseLink*>( refLink.get() )->SetObjType( nNewType );
                }
            }

@@ -214,7 +214,7 @@ bool SwGrfNode::ReRead(
                else if ( bNewGrf )
                {
                    //TODO refLink->setInputStream(getInputStream());
                    static_cast<SwBaseLink*>(&refLink)->SwapIn();
                    static_cast<SwBaseLink*>( refLink.get() )->SwapIn();
                }
            }
            onGraphicChanged();
@@ -249,7 +249,7 @@ bool SwGrfNode::ReRead(
                onGraphicChanged();
                bReadGrf = true;
                // create connection without update, as we have the graphic
                static_cast<SwBaseLink*>(&refLink)->Connect();
                static_cast<SwBaseLink*>( refLink.get() )->Connect();
            }
            else if( pGrfObj )
            {
@@ -258,7 +258,7 @@ bool SwGrfNode::ReRead(
                onGraphicChanged();
                bReadGrf = true;
                // create connection without update, as we have the graphic
                static_cast<SwBaseLink*>(&refLink)->Connect();
                static_cast<SwBaseLink*>( refLink.get() )->Connect();
            }
            else
            {
@@ -268,7 +268,7 @@ bool SwGrfNode::ReRead(
                onGraphicChanged();
                if ( bNewGrf )
                {
                    static_cast<SwBaseLink*>(&refLink)->SwapIn();
                    static_cast<SwBaseLink*>( refLink.get() )->SwapIn();
                }
            }
        }
diff --git a/sw/source/core/inc/bookmrk.hxx b/sw/source/core/inc/bookmrk.hxx
index 8972d7d..6e18660 100644
--- a/sw/source/core/inc/bookmrk.hxx
+++ b/sw/source/core/inc/bookmrk.hxx
@@ -139,13 +139,10 @@ namespace sw {
        public:
            DdeBookmark(const SwPaM& rPaM);

            const SwServerObject* GetRefObject() const
                { return &m_aRefObj; }
            SwServerObject* GetRefObject()
                { return &m_aRefObj; }
            const SwServerObject* GetRefObject() const { return m_aRefObj.get(); }
            SwServerObject* GetRefObject() { return m_aRefObj.get(); }

            bool IsServer() const
                { return m_aRefObj.Is(); }
            bool IsServer() const { return m_aRefObj.Is(); }

            void SetRefObject( SwServerObject* pObj );

diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 5558fa8..f56f9bb 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -244,7 +244,7 @@ SwTable::~SwTable()
    {
        SwDoc* pDoc = GetFrameFormat()->GetDoc();
        if( !pDoc->IsInDtor() )         // then remove from the list
            pDoc->getIDocumentLinksAdministration().GetLinkManager().RemoveServer( &m_xRefObj );
            pDoc->getIDocumentLinksAdministration().GetLinkManager().RemoveServer( m_xRefObj.get() );

        m_xRefObj->Closed();
    }
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 224f961..7afa944 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3230,9 +3230,9 @@ void WW8Export::ExportDocument_Impl()
    xTableStrm->SetEndian( SvStreamEndian::LITTLE );
    xDataStrm->SetEndian( SvStreamEndian::LITTLE );

    GetWriter().SetStream( & *xWwStrm );
    pTableStrm = &xTableStrm;
    pDataStrm = &xDataStrm;
    GetWriter().SetStream( xWwStrm.get() );
    pTableStrm = xTableStrm.get();
    pDataStrm = xDataStrm.get();

    Strm().SetEndian( SvStreamEndian::LITTLE );

@@ -3311,9 +3311,9 @@ void WW8Export::ExportDocument_Impl()
    if ( bEncrypt )
    {
        SvStream *pStrmTemp, *pTableStrmTemp, *pDataStrmTemp;
        pStrmTemp = &xWwStrm;
        pTableStrmTemp = &xTableStrm;
        pDataStrmTemp = &xDataStrm;
        pStrmTemp = xWwStrm.get();
        pTableStrmTemp = xTableStrm.get();
        pDataStrmTemp = xDataStrm.get();

        if ( pDataStrmTemp && pDataStrmTemp != pStrmTemp)
            EncryptRC4(aCtx, *pDataStrm, *pDataStrmTemp);
diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx
index f25d66e..3b335d1 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.get(), &rStrm, *pD, rBlocks.GetBaseURL(),
                    pGlossary->m_nVersion, xStg.get(), rStrm.get(), *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 1bb031e..35320c4 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5440,7 +5440,7 @@ sal_uLong SwWW8ImplReader::SetSubStreams(tools::SvRef<SotStorageStream> &rTableS
                m_pWwFib->m_fWhichTableStm ? SL::a1Table : SL::a0Table),
                StreamMode::STD_READ);

            m_pTableStream = &rTableStream;
            m_pTableStream = rTableStream.get();
            m_pTableStream->SetEndian( SvStreamEndian::LITTLE );

            rDataStream = m_pStg->OpenSotStream(OUString(SL::aData),
@@ -5448,7 +5448,7 @@ sal_uLong SwWW8ImplReader::SetSubStreams(tools::SvRef<SotStorageStream> &rTableS

            if (rDataStream.Is() && SVSTREAM_OK == rDataStream->GetError())
            {
                m_pDataStream = &rDataStream;
                m_pDataStream = rDataStream.get();
                m_pDataStream->SetEndian(SvStreamEndian::LITTLE);
            }
            else
@@ -6218,7 +6218,7 @@ sal_uLong WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, co
        if( pStg.Is() )
        {
            nRet = OpenMainStream( refStrm, nOldBuffSize );
            pIn = &refStrm;
            pIn = refStrm.get();
        }
        else
        {
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 3f7c245..36e01d1 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -242,7 +242,7 @@ SwTransferable::~SwTransferable()
    // the DDELink still needs the WrtShell!
    if( m_xDdeLink.Is() )
    {
        static_cast<SwTrnsfrDdeLink*>(&m_xDdeLink)->Disconnect( true );
        static_cast<SwTrnsfrDdeLink*>( m_xDdeLink.get() )->Disconnect( true );
        m_xDdeLink.Clear();
    }

@@ -522,7 +522,7 @@ bool SwTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDo
        {
        case SotClipboardFormatId::LINK:
            if( m_xDdeLink.Is() )
                bOK = SetObject( &m_xDdeLink, SWTRANSFER_OBJECTTYPE_DDE, rFlavor );
                bOK = SetObject( m_xDdeLink.get(), SWTRANSFER_OBJECTTYPE_DDE, rFlavor );
            break;

        case SotClipboardFormatId::OBJECTDESCRIPTOR:
@@ -1659,7 +1659,7 @@ bool SwTransferable::PasteFileContent( TransferableDataHelper& rData,
            }
            else
            {
                pStream = &xStrm;
                pStream = xStrm.get();
                if( SotClipboardFormatId::RTF == nFormat )
                    pRead = SwReaderWriter::GetRtfReader();
                else if( !pRead )
@@ -3733,7 +3733,7 @@ bool SwTrnsfrDdeLink::WriteData( SvStream& rStrm )
        // the mark is still a DdeBookmark
        // we replace it with a Bookmark, so it will get saved etc.
        ::sw::mark::IMark* const pMark = ppMark->get();
        ::sfx2::SvLinkSource* p = &refObj;
        ::sfx2::SvLinkSource* p = refObj.get();
        SwServerObject& rServerObject = dynamic_cast<SwServerObject&>(*p);

        // collecting state of old mark
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index d4a3514..8cdd2b8 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -1516,17 +1516,17 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
            SbxArrayRef xArgs = new SbxArray;
            SbxVariableRef xVar = new SbxVariable;
            xVar->PutString( pFlyFormat->GetName() );
            xArgs->Put( &xVar, 1 );
            xArgs->Put( xVar.get(), 1 );

            xVar = new SbxVariable;
            if( SW_EVENT_FRM_KEYINPUT_ALPHA == nEvent )
                xVar->PutChar( aCh );
            else
                xVar->PutUShort( rKeyCode.GetModifier() | rKeyCode.GetCode() );
            xArgs->Put( &xVar, 2 );
            xArgs->Put( xVar.get(), 2 );

            OUString sRet;
            rSh.ExecMacro( *pMacro, &sRet, &xArgs );
            rSh.ExecMacro( *pMacro, &sRet, xArgs.get() );
            if( !sRet.isEmpty() && sRet.toInt32()!=0 )
                return ;
        }
@@ -4086,27 +4086,27 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
                            SbxArrayRef xArgs = new SbxArray;
                            SbxVariableRef xVar = new SbxVariable;
                            xVar->PutString( pFlyFormat->GetName() );
                            xArgs->Put( &xVar, ++nPos );
                            xArgs->Put( xVar.get(), ++nPos );

                            if( SW_EVENT_FRM_RESIZE == nEvent )
                            {
                                xVar = new SbxVariable;
                                xVar->PutUShort( static_cast< sal_uInt16 >(g_eSdrMoveHdl) );
                                xArgs->Put( &xVar, ++nPos );
                                xArgs->Put( xVar.get(), ++nPos );
                            }

                            xVar = new SbxVariable;
                            xVar->PutLong( aDocPt.X() - aSttPt.X() );
                            xArgs->Put( &xVar, ++nPos );
                            xArgs->Put( xVar.get(), ++nPos );
                            xVar = new SbxVariable;
                            xVar->PutLong( aDocPt.Y() - aSttPt.Y() );
                            xArgs->Put( &xVar, ++nPos );
                            xArgs->Put( xVar.get(), ++nPos );

                            OUString sRet;

                            ReleaseMouse();

                            rSh.ExecMacro( *pMacro, &sRet, &xArgs );
                            rSh.ExecMacro( *pMacro, &sRet, xArgs.get() );

                            CaptureMouse();

@@ -4549,29 +4549,29 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
                            SbxArrayRef xArgs = new SbxArray;
                            SbxVariableRef xVar = new SbxVariable;
                            xVar->PutString( pFlyFormat->GetName() );
                            xArgs->Put( &xVar, ++nPos );
                            xArgs->Put( xVar.get(), ++nPos );

                            if( SW_EVENT_FRM_RESIZE == nEvent )
                            {
                                xVar = new SbxVariable;
                                xVar->PutUShort( static_cast< sal_uInt16 >(eOldSdrMoveHdl) );
                                xArgs->Put( &xVar, ++nPos );
                                xArgs->Put( xVar.get(), ++nPos );
                            }

                            xVar = new SbxVariable;
                            xVar->PutLong( aDocPt.X() - aSttPt.X() );
                            xArgs->Put( &xVar, ++nPos );
                            xArgs->Put( xVar.get(), ++nPos );
                            xVar = new SbxVariable;
                            xVar->PutLong( aDocPt.Y() - aSttPt.Y() );
                            xArgs->Put( &xVar, ++nPos );
                            xArgs->Put( xVar.get(), ++nPos );

                            xVar = new SbxVariable;
                            xVar->PutUShort( 1 );
                            xArgs->Put( &xVar, ++nPos );
                            xArgs->Put( xVar.get(), ++nPos );

                            ReleaseMouse();

                            rSh.ExecMacro( *pMacro, nullptr, &xArgs );
                            rSh.ExecMacro( *pMacro, nullptr, xArgs.get() );

                            CaptureMouse();
                        }
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index bc1a231..428b12e 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -2266,9 +2266,9 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe
            m_pWrtShell->EnterStdMode(); // delete selections

            if( bCompare )
                nFound = m_pWrtShell->CompareDoc( *static_cast<SwDocShell*>(&xDocSh)->GetDoc() );
                nFound = m_pWrtShell->CompareDoc( *static_cast<SwDocShell*>( xDocSh.get() )->GetDoc() );
            else
                nFound = m_pWrtShell->MergeDoc( *static_cast<SwDocShell*>(&xDocSh)->GetDoc() );
                nFound = m_pWrtShell->MergeDoc( *static_cast<SwDocShell*>( xDocSh.get() )->GetDoc() );

            m_pWrtShell->EndAllAction();

diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx
index e61116d0..47a09f9 100644
--- a/sw/source/uibase/uno/unoatxt.cxx
+++ b/sw/source/uibase/uno/unoatxt.cxx
@@ -751,7 +751,7 @@ void SwXAutoTextEntry::implFlushDocument( bool _bCloseDoc )
        if ( _bCloseDoc )
        {
            // stop listening at the document
            EndListening( *&xDocSh );
            EndListening( *xDocSh );

            xDocSh->DoClose();
            xDocSh.Clear();
@@ -761,7 +761,7 @@ void SwXAutoTextEntry::implFlushDocument( bool _bCloseDoc )

void SwXAutoTextEntry::Notify( SfxBroadcaster& _rBC, const SfxHint& _rHint )
{
    if ( &_rBC == &xDocSh )
    if ( &_rBC == xDocSh.get() )
    {   // it's our document
        if (const SfxEventHint* pEventHint = dynamic_cast<const SfxEventHint*>(&_rHint))
        {
@@ -769,7 +769,7 @@ void SwXAutoTextEntry::Notify( SfxBroadcaster& _rBC, const SfxHint& _rHint )
            {
                implFlushDocument();
                xBodyText = nullptr;
                EndListening( *&xDocSh );
                EndListening( *xDocSh );
                xDocSh.Clear();
            }
        }
@@ -780,7 +780,7 @@ void SwXAutoTextEntry::Notify( SfxBroadcaster& _rBC, const SfxHint& _rHint )
                // our document is dying (possibly because we're shuting down, and the document was notified
                // earlier than we are?)
                // stop listening at the docu
                EndListening( *&xDocSh );
                EndListening( *xDocSh );
                // and release our reference
                xDocSh.Clear();
            }
@@ -796,7 +796,7 @@ void SwXAutoTextEntry::GetBodyText ()
    OSL_ENSURE( xDocSh.Is(), "SwXAutoTextEntry::GetBodyText: unexpected: no doc returned by EditGroupDoc!" );

    // start listening at the document
    StartListening( *&xDocSh );
    StartListening( *xDocSh );

    pBodyText = new SwXBodyText ( xDocSh->GetDoc() );
    xBodyText.set( *pBodyText, uno::UNO_QUERY);