summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-01-25 13:12:03 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-01-25 15:06:21 +0000
commitf08d33f87799848597e2818cd5e173ab3fdc510b (patch)
treec73af29c668efe4819cf557d5d29166cbc5d56f1 /sd
parent160e11fed1ebc4df8e3ce0afdb636ef42e5b54fe (diff)
use a std::unique_ptr
Change-Id: I1ab99995e35714d6ef3358400b0805723c44678c
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/docshell/docshel4.cxx22
1 files changed, 10 insertions, 12 deletions
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index 697323db60c1..686ce6aa411e 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -603,47 +603,45 @@ bool DrawDocShell::ConvertTo( SfxMedium& rMedium )
{
std::shared_ptr<const SfxFilter> pMediumFilter = rMedium.GetFilter();
const OUString aTypeName( pMediumFilter->GetTypeName() );
- SdFilter* pFilter = nullptr;
+ std::unique_ptr<SdFilter> xFilter;
if( aTypeName.indexOf( "graphic_HTML" ) >= 0 )
{
- pFilter = new SdHTMLFilter( rMedium, *this );
+ xFilter = std::make_unique<SdHTMLFilter>(rMedium, *this);
}
else if( aTypeName.indexOf( "MS_PowerPoint_97" ) >= 0 )
{
- pFilter = new SdPPTFilter( rMedium, *this );
- static_cast<SdPPTFilter*>(pFilter)->PreSaveBasic();
+ xFilter = std::make_unique<SdPPTFilter>(rMedium, *this);
+ static_cast<SdPPTFilter*>(xFilter.get())->PreSaveBasic();
}
else if ( aTypeName.indexOf( "CGM_Computer_Graphics_Metafile" ) >= 0 )
{
- pFilter = new SdCGMFilter( rMedium, *this );
+ xFilter = std::make_unique<SdCGMFilter>(rMedium, *this);
}
else if( aTypeName.indexOf( "draw8" ) >= 0 ||
aTypeName.indexOf( "impress8" ) >= 0 )
{
- pFilter = new SdXMLFilter( rMedium, *this );
+ xFilter = std::make_unique<SdXMLFilter>(rMedium, *this);
}
else if( aTypeName.indexOf( "StarOffice_XML_Impress" ) >= 0 ||
aTypeName.indexOf( "StarOffice_XML_Draw" ) >= 0 )
{
- pFilter = new SdXMLFilter( rMedium, *this, SDXMLMODE_Normal, SOFFICE_FILEFORMAT_60 );
+ xFilter = std::make_unique<SdXMLFilter>(rMedium, *this, SDXMLMODE_Normal, SOFFICE_FILEFORMAT_60);
}
else
{
- pFilter = new SdGRFFilter( rMedium, *this );
+ xFilter = std::make_unique<SdGRFFilter>(rMedium, *this);
}
- if( pFilter )
+ if (xFilter)
{
const SdrSwapGraphicsMode nOldSwapMode = mpDoc->GetSwapGraphicsMode();
mpDoc->SetSwapGraphicsMode( SdrSwapGraphicsMode::TEMP );
- bRet = pFilter->Export();
+ bRet = xFilter->Export();
if( !bRet )
mpDoc->SetSwapGraphicsMode( nOldSwapMode );
-
- delete pFilter;
}
}