diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-02-21 12:32:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-02-21 16:13:06 +0100 |
commit | 8f231fc5df201c45d16bce0b4b17f727842b2121 (patch) | |
tree | 1eba8f98d459e1f261dc9edc791e67b9675aec4b /sd/source/ui/view/sdview2.cxx | |
parent | 98173f6222cec22170b53c7d9c94c6ce5b08b4d9 (diff) |
loplugin:refcounting in sd
Change-Id: Ic95aa7a3c1fdab1baef744ec85ffc9c98dee5f1e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111272
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/view/sdview2.cxx')
-rw-r--r-- | sd/source/ui/view/sdview2.cxx | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index 7f5caafe6733..f71246ea651e 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -81,12 +81,11 @@ css::uno::Reference< css::datatransfer::XTransferable > View::CreateClipboardDat { // since SdTransferable::CopyToClipboard is called, this // dynamically created object is destroyed automatically - SdTransferable* pTransferable = new SdTransferable( &mrDoc, nullptr, false ); - css::uno::Reference< css::datatransfer::XTransferable > xRet( pTransferable ); + rtl::Reference<SdTransferable> pTransferable = new SdTransferable( &mrDoc, nullptr, false ); - SD_MOD()->pTransferClip = pTransferable; + SD_MOD()->pTransferClip = pTransferable.get(); - mrDoc.CreatingDataObj( pTransferable ); + mrDoc.CreatingDataObj( pTransferable.get() ); pTransferable->SetWorkDocument( static_cast<SdDrawDocument*>(CreateMarkedObjModel().release()) ); mrDoc.CreatingDataObj( nullptr ); @@ -138,15 +137,14 @@ css::uno::Reference< css::datatransfer::XTransferable > View::CreateClipboardDat pTransferable->SetObjectDescriptor( std::move(pObjDesc) ); pTransferable->CopyToClipboard( mpViewSh->GetActiveWindow() ); - return xRet; + return pTransferable; } css::uno::Reference< css::datatransfer::XTransferable > View::CreateDragDataObject( View* pWorkView, vcl::Window& rWindow, const Point& rDragPos ) { - SdTransferable* pTransferable = new SdTransferable( &mrDoc, pWorkView, false ); - css::uno::Reference< css::datatransfer::XTransferable > xRet( pTransferable ); + rtl::Reference<SdTransferable> pTransferable = new SdTransferable( &mrDoc, pWorkView, false ); - SD_MOD()->pTransferDrag = pTransferable; + SD_MOD()->pTransferDrag = pTransferable.get(); std::unique_ptr<TransferableObjectDescriptor> pObjDesc(new TransferableObjectDescriptor); OUString aDisplayName; @@ -187,17 +185,16 @@ css::uno::Reference< css::datatransfer::XTransferable > View::CreateDragDataObje pTransferable->SetObjectDescriptor( std::move(pObjDesc) ); pTransferable->StartDrag( &rWindow, DND_ACTION_COPYMOVE | DND_ACTION_LINK ); - return xRet; + return pTransferable; } css::uno::Reference< css::datatransfer::XTransferable > View::CreateSelectionDataObject( View* pWorkView, vcl::Window& rWindow ) { - SdTransferable* pTransferable = new SdTransferable( &mrDoc, pWorkView, true ); - css::uno::Reference< css::datatransfer::XTransferable > xRet( pTransferable ); + rtl::Reference<SdTransferable> pTransferable = new SdTransferable( &mrDoc, pWorkView, true ); std::unique_ptr<TransferableObjectDescriptor> pObjDesc(new TransferableObjectDescriptor); const ::tools::Rectangle aMarkRect( GetAllMarkedRect() ); - SD_MOD()->pTransferSelection = pTransferable; + SD_MOD()->pTransferSelection = pTransferable.get(); if( mpDocSh ) { @@ -211,7 +208,7 @@ css::uno::Reference< css::datatransfer::XTransferable > View::CreateSelectionDat pTransferable->SetObjectDescriptor( std::move(pObjDesc) ); pTransferable->CopyToSelection( &rWindow ); - return xRet; + return pTransferable; } void View::UpdateSelectionClipboard( bool bForceDeselect ) |