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

loplugin:useuniqueptr in DocShell_Impl

Change-Id: I171dbce9ad9790e887a6618812eadfb746dee42f
Reviewed-on: https://gerrit.libreoffice.org/52646Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst bd8dc772
...@@ -451,10 +451,9 @@ SfxPrinter* ScDocShell::GetPrinter(bool bCreateIfNotExist) ...@@ -451,10 +451,9 @@ SfxPrinter* ScDocShell::GetPrinter(bool bCreateIfNotExist)
void ScDocShell::UpdateFontList() void ScDocShell::UpdateFontList()
{ {
delete pImpl->pFontList;
// pImpl->pFontList = new FontList( GetPrinter(), Application::GetDefaultDevice() ); // pImpl->pFontList = new FontList( GetPrinter(), Application::GetDefaultDevice() );
pImpl->pFontList = new FontList(GetRefDevice(), nullptr); pImpl->pFontList.reset(new FontList(GetRefDevice(), nullptr));
SvxFontListItem aFontListItem( pImpl->pFontList, SID_ATTR_CHAR_FONTLIST ); SvxFontListItem aFontListItem( pImpl->pFontList.get(), SID_ATTR_CHAR_FONTLIST );
PutItem( aFontListItem ); PutItem( aFontListItem );
CalcOutputFactor(); CalcOutputFactor();
......
...@@ -763,15 +763,14 @@ void ScDocShell::Execute( SfxRequest& rReq ) ...@@ -763,15 +763,14 @@ void ScDocShell::Execute( SfxRequest& rReq )
: sfx2::DocumentInserter::Mode::Merge}; : sfx2::DocumentInserter::Mode::Merge};
// start file dialog asynchronous // start file dialog asynchronous
pImpl->bIgnoreLostRedliningWarning = true; pImpl->bIgnoreLostRedliningWarning = true;
delete pImpl->pRequest; pImpl->pRequest.reset(new SfxRequest( rReq ));
pImpl->pRequest = new SfxRequest( rReq ); pImpl->pDocInserter.reset();
delete pImpl->pDocInserter;
ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell(); ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
vcl::Window* pParent = pViewSh ? pViewSh->GetDialogParent() : nullptr; vcl::Window* pParent = pViewSh ? pViewSh->GetDialogParent() : nullptr;
pImpl->pDocInserter = new ::sfx2::DocumentInserter(pParent ? pParent->GetFrameWeld() : nullptr, pImpl->pDocInserter.reset( new ::sfx2::DocumentInserter(pParent ? pParent->GetFrameWeld() : nullptr,
ScDocShell::Factory().GetFactoryName(), mode ); ScDocShell::Factory().GetFactoryName(), mode ) );
pImpl->pDocInserter->StartExecuteModal( LINK( this, ScDocShell, DialogClosedHdl ) ); pImpl->pDocInserter->StartExecuteModal( LINK( this, ScDocShell, DialogClosedHdl ) );
return ; return ;
} }
...@@ -1990,7 +1989,7 @@ void ScDocShell::GetState( SfxItemSet &rSet ) ...@@ -1990,7 +1989,7 @@ void ScDocShell::GetState( SfxItemSet &rSet )
break; break;
case SID_ATTR_CHAR_FONTLIST: case SID_ATTR_CHAR_FONTLIST:
rSet.Put( SvxFontListItem( pImpl->pFontList, nWhich ) ); rSet.Put( SvxFontListItem( pImpl->pFontList.get(), nWhich ) );
break; break;
case SID_NOTEBOOKBAR: case SID_NOTEBOOKBAR:
......
...@@ -26,23 +26,14 @@ ...@@ -26,23 +26,14 @@
struct DocShell_Impl struct DocShell_Impl
{ {
bool bIgnoreLostRedliningWarning; bool bIgnoreLostRedliningWarning;
FontList* pFontList; std::unique_ptr<FontList> pFontList;
sfx2::DocumentInserter* pDocInserter; std::unique_ptr<sfx2::DocumentInserter> pDocInserter;
SfxRequest* pRequest; std::unique_ptr<SfxRequest> pRequest;
DocShell_Impl() : DocShell_Impl() :
bIgnoreLostRedliningWarning( false ) bIgnoreLostRedliningWarning( false )
, pFontList( nullptr )
, pDocInserter( nullptr )
, pRequest( nullptr )
{} {}
~DocShell_Impl()
{
delete pFontList;
delete pDocInserter;
delete pRequest;
}
}; };
#endif #endif
......
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