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 @@
#include <svx/svxdllapi.h>
#include <tools/date.hxx>
#include <tools/time.hxx>
#include <memory>
class GalleryTheme;
class SotStorageStream;
......@@ -142,9 +143,9 @@ using TransferableHelper::CopyToClipboard;
GalleryTheme* mpTheme;
SgaObjKind meObjectKind;
sal_uInt32 mnObjectPos;
tools::SvRef<SotStorageStream> mxModelStream;
GraphicObject* mpGraphicObject;
INetURLObject* mpURL;
tools::SvRef<SotStorageStream> mxModelStream;
std::unique_ptr<GraphicObject> mpGraphicObject;
std::unique_ptr<INetURLObject> mpURL;
GalleryTransferable( GalleryTheme* pTheme, sal_uInt32 nObjectPos, bool bLazy );
virtual ~GalleryTransferable() override;
......
......@@ -403,7 +403,7 @@ void GalleryTransferable::InitData( bool bLazy )
Graphic aGraphic;
if( mpTheme->GetGraphic( mnObjectPos, aGraphic ) )
mpGraphicObject = new GraphicObject( aGraphic );
mpGraphicObject.reset(new GraphicObject( aGraphic ));
}
if( !mxModelStream.is() )
......@@ -427,12 +427,11 @@ void GalleryTransferable::InitData( bool bLazy )
{
if( !mpURL )
{
mpURL = new INetURLObject;
mpURL.reset(new INetURLObject);
if( !mpTheme->GetURL( mnObjectPos, *mpURL ) )
{
delete mpURL;
mpURL = nullptr;
mpURL.reset();
}
}
......@@ -441,7 +440,7 @@ void GalleryTransferable::InitData( bool bLazy )
Graphic aGraphic;
if( mpTheme->GetGraphic( mnObjectPos, aGraphic ) )
mpGraphicObject = new GraphicObject( aGraphic );
mpGraphicObject.reset(new GraphicObject( aGraphic ));
}
}
break;
......@@ -544,10 +543,8 @@ void GalleryTransferable::DragFinished( sal_Int8 nDropAction )
void GalleryTransferable::ObjectReleased()
{
mxModelStream.clear();
delete mpGraphicObject;
mpGraphicObject = nullptr;
delete mpURL;
mpURL = nullptr;
mpGraphicObject.reset();
mpURL.reset();
}
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