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

loplugin:useuniqueptr in FlashExporter

Change-Id: Ie03889d482bc7504db2e35f9ee667157f18bcc3a
Reviewed-on: https://gerrit.libreoffice.org/53874Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 945642c2
......@@ -102,9 +102,7 @@ FlashExporter::~FlashExporter()
void FlashExporter::Flush()
{
delete mpWriter;
mpWriter = nullptr;
mpWriter.reset();
maPagesMap.clear();
}
......@@ -148,8 +146,7 @@ bool FlashExporter::exportAll( const Reference< XComponent >& xDoc, Reference< X
sal_Int32 nOutputWidth = 14400;
sal_Int32 nOutputHeight = (nOutputWidth * mnDocHeight ) / mnDocWidth;
delete mpWriter;
mpWriter = new Writer( nOutputWidth, nOutputHeight, mnDocWidth, mnDocHeight, mnJPEGcompressMode );
mpWriter.reset(new Writer( nOutputWidth, nOutputHeight, mnDocWidth, mnDocHeight, mnJPEGcompressMode ));
}
catch( const Exception& )
{
......@@ -264,12 +261,12 @@ bool FlashExporter::exportSlides( const Reference< XDrawPage >& xDrawPage, Refer
try
{
if( nullptr == mpWriter )
if( !mpWriter )
{
xPropSet->getPropertyValue( "Width" ) >>= mnDocWidth;
xPropSet->getPropertyValue( "Height" ) >>= mnDocHeight;
mpWriter = new Writer( 14400, 10800, mnDocWidth, mnDocHeight, mnJPEGcompressMode );
mpWriter.reset(new Writer( 14400, 10800, mnDocWidth, mnDocHeight, mnJPEGcompressMode ));
}
if( mbPresentation )
......@@ -298,12 +295,12 @@ sal_uInt16 FlashExporter::exportBackgrounds( const Reference< XDrawPage >& xDraw
if( !xDrawPage.is() || !xPropSet.is() )
return 0;
if( nullptr == mpWriter )
if( !mpWriter )
{
xPropSet->getPropertyValue( "Width" ) >>= mnDocWidth;
xPropSet->getPropertyValue( "Height" ) >>= mnDocHeight;
mpWriter = new Writer( 14400, 10800, mnDocWidth, mnDocHeight, mnJPEGcompressMode );
mpWriter.reset(new Writer( 14400, 10800, mnDocWidth, mnDocHeight, mnJPEGcompressMode ));
}
sal_uInt16 ret = exportBackgrounds(xDrawPage, nPage, bExportObjects);
......
......@@ -28,6 +28,7 @@
#include <vector>
#include <map>
#include <memory>
typedef ::std::map<BitmapChecksum, sal_uInt16> ChecksumCache;
......@@ -115,7 +116,7 @@ private:
bool getMetaFile( css::uno::Reference< css::lang::XComponent > const &xComponent, GDIMetaFile& rMtf, bool bOnlyBackground = false, bool bExportAsJPEG = false );
Writer* mpWriter;
std::unique_ptr<Writer> mpWriter;
sal_Int32 mnDocWidth;
sal_Int32 mnDocHeight;
......
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