Kaydet (Commit) b6025e6c authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in GalleryTransferable

Change-Id: Iad9ca26bb94fb1d499d3ce028b2289c11c1771fa
Reviewed-on: https://gerrit.libreoffice.org/53711Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst e4376445
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <svx/svxdllapi.h> #include <svx/svxdllapi.h>
#include <tools/date.hxx> #include <tools/date.hxx>
#include <tools/time.hxx> #include <tools/time.hxx>
#include <memory>
class GalleryTheme; class GalleryTheme;
class SotStorageStream; class SotStorageStream;
...@@ -142,9 +143,9 @@ using TransferableHelper::CopyToClipboard; ...@@ -142,9 +143,9 @@ using TransferableHelper::CopyToClipboard;
GalleryTheme* mpTheme; GalleryTheme* mpTheme;
SgaObjKind meObjectKind; SgaObjKind meObjectKind;
sal_uInt32 mnObjectPos; sal_uInt32 mnObjectPos;
tools::SvRef<SotStorageStream> mxModelStream; tools::SvRef<SotStorageStream> mxModelStream;
GraphicObject* mpGraphicObject; std::unique_ptr<GraphicObject> mpGraphicObject;
INetURLObject* mpURL; std::unique_ptr<INetURLObject> mpURL;
GalleryTransferable( GalleryTheme* pTheme, sal_uInt32 nObjectPos, bool bLazy ); GalleryTransferable( GalleryTheme* pTheme, sal_uInt32 nObjectPos, bool bLazy );
virtual ~GalleryTransferable() override; virtual ~GalleryTransferable() override;
......
...@@ -403,7 +403,7 @@ void GalleryTransferable::InitData( bool bLazy ) ...@@ -403,7 +403,7 @@ void GalleryTransferable::InitData( bool bLazy )
Graphic aGraphic; Graphic aGraphic;
if( mpTheme->GetGraphic( mnObjectPos, aGraphic ) ) if( mpTheme->GetGraphic( mnObjectPos, aGraphic ) )
mpGraphicObject = new GraphicObject( aGraphic ); mpGraphicObject.reset(new GraphicObject( aGraphic ));
} }
if( !mxModelStream.is() ) if( !mxModelStream.is() )
...@@ -427,12 +427,11 @@ void GalleryTransferable::InitData( bool bLazy ) ...@@ -427,12 +427,11 @@ void GalleryTransferable::InitData( bool bLazy )
{ {
if( !mpURL ) if( !mpURL )
{ {
mpURL = new INetURLObject; mpURL.reset(new INetURLObject);
if( !mpTheme->GetURL( mnObjectPos, *mpURL ) ) if( !mpTheme->GetURL( mnObjectPos, *mpURL ) )
{ {
delete mpURL; mpURL.reset();
mpURL = nullptr;
} }
} }
...@@ -441,7 +440,7 @@ void GalleryTransferable::InitData( bool bLazy ) ...@@ -441,7 +440,7 @@ void GalleryTransferable::InitData( bool bLazy )
Graphic aGraphic; Graphic aGraphic;
if( mpTheme->GetGraphic( mnObjectPos, aGraphic ) ) if( mpTheme->GetGraphic( mnObjectPos, aGraphic ) )
mpGraphicObject = new GraphicObject( aGraphic ); mpGraphicObject.reset(new GraphicObject( aGraphic ));
} }
} }
break; break;
...@@ -544,10 +543,8 @@ void GalleryTransferable::DragFinished( sal_Int8 nDropAction ) ...@@ -544,10 +543,8 @@ void GalleryTransferable::DragFinished( sal_Int8 nDropAction )
void GalleryTransferable::ObjectReleased() void GalleryTransferable::ObjectReleased()
{ {
mxModelStream.clear(); mxModelStream.clear();
delete mpGraphicObject; mpGraphicObject.reset();
mpGraphicObject = nullptr; mpURL.reset();
delete mpURL;
mpURL = nullptr;
} }
void GalleryTransferable::StartDrag( vcl::Window* pWindow, sal_Int8 nDragSourceActions ) void GalleryTransferable::StartDrag( vcl::Window* pWindow, sal_Int8 nDragSourceActions )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment