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

use unique_ptr in SfxChildWinContextCtor

Change-Id: I5ad26f30704708aac42f2c48fa38382c38f98b2a
Reviewed-on: https://gerrit.libreoffice.org/64998
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 0bab9c02
......@@ -88,7 +88,7 @@ typedef std::unique_ptr<SfxChildWindow> (*SfxChildWinCtor)( vcl::Window *pParent
SfxChildWinInfo *pInfo);
// ChildWindowsContexts factory methods
typedef SfxChildWindowContext* (*SfxChildWinContextCtor)( vcl::Window *pParentWindow,
typedef std::unique_ptr<SfxChildWindowContext> (*SfxChildWinContextCtor)( vcl::Window *pParentWindow,
SfxBindings *pBindings,
SfxChildWinInfo *pInfo);
struct SfxChildWinContextFactory
......@@ -218,7 +218,7 @@ public:
//! The Macro of the future ...
#define SFX_DECL_CHILDWINDOWCONTEXT(Class) \
static SfxChildWindowContext* CreateImpl(vcl::Window *pParent, \
static std::unique_ptr<SfxChildWindowContext> CreateImpl(vcl::Window *pParent, \
SfxBindings *pBindings, SfxChildWinInfo* pInfo ); \
static void RegisterChildWindowContext(sal_uInt16, SfxModule *pMod=nullptr); \
......@@ -227,11 +227,10 @@ public:
// factory. As long as Id is set to 0 and patched in
// SfxChildWindow::CreateContext
#define SFX_IMPL_CHILDWINDOWCONTEXT(Class, MyID) \
SfxChildWindowContext* Class::CreateImpl( vcl::Window *pParent, \
std::unique_ptr<SfxChildWindowContext> Class::CreateImpl( vcl::Window *pParent, \
SfxBindings *pBindings, SfxChildWinInfo* pInfo ) \
{ \
SfxChildWindowContext *pContext = new Class(pParent,0,pBindings,pInfo);\
return pContext; \
return o3tl::make_unique<Class>(pParent,0,pBindings,pInfo);\
} \
void Class::RegisterChildWindowContext(sal_uInt16 nId, SfxModule* pMod) \
{ \
......
......@@ -433,7 +433,7 @@ void SfxChildWindow::InitializeChildWinFactory_Impl(sal_uInt16 nId, SfxChildWinI
void SfxChildWindow::CreateContext( sal_uInt16 nContextId, SfxBindings& rBindings )
{
SfxChildWindowContext *pCon = nullptr;
std::unique_ptr<SfxChildWindowContext> pCon;
SfxChildWinFactory* pFact=nullptr;
SfxApplication *pApp = SfxGetpApp();
SfxDispatcher *pDisp = rBindings.GetDispatcher_Impl();
......@@ -508,7 +508,7 @@ void SfxChildWindow::CreateContext( sal_uInt16 nContextId, SfxBindings& rBinding
return;
}
pContext.reset(pCon);
pContext = std::move(pCon);
pContext->GetWindow()->SetSizePixel( pWindow->GetOutputSizePixel() );
pContext->GetWindow()->Show();
}
......
......@@ -170,7 +170,7 @@ public:
SfxBindings* );
//! soon obsolete !
static SfxChildWindowContext* CreateImpl(vcl::Window *pParent,
static std::unique_ptr<SfxChildWindowContext> CreateImpl(vcl::Window *pParent,
SfxBindings *pBindings, SfxChildWinInfo* pInfo );
static void RegisterChildWindowContext(SfxModule *pMod);
};
......
......@@ -63,13 +63,12 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::frame;
//! soon obsolete !
SfxChildWindowContext* SwNavigationChild::CreateImpl( vcl::Window *pParent,
std::unique_ptr<SfxChildWindowContext> SwNavigationChild::CreateImpl( vcl::Window *pParent,
SfxBindings *pBindings, SfxChildWinInfo* /*pInfo*/ )
{
SfxChildWindowContext *pContext = new SwNavigationChild(pParent,
return o3tl::make_unique<SwNavigationChild>(pParent,
/* cast is safe here! */static_cast< sal_uInt16 >(SwView::GetInterfaceId()),
pBindings);
return pContext;
}
void SwNavigationChild::RegisterChildWindowContext(SfxModule* pMod)
{
......
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