Kaydet (Commit) a497b913 authored tarafından Takeshi Abe's avatar Takeshi Abe Kaydeden (comit) Caolán McNamara

use std::unique_ptr<> to simplify ctor and dtor

Change-Id: Icfb02807cb9370e72149cdb9122b3b108eb3e4a5
Reviewed-on: https://gerrit.libreoffice.org/15456Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 0a43d7c4
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <vcl/print.hxx> #include <vcl/print.hxx>
#include <oox/mathml/export.hxx> #include <oox/mathml/export.hxx>
#include <oox/mathml/import.hxx> #include <oox/mathml/import.hxx>
#include <memory>
#define PRTUIOPT_TITLE_ROW "TitleRow" #define PRTUIOPT_TITLE_ROW "TitleRow"
...@@ -55,7 +55,7 @@ class SmModel : public SfxBaseModel, ...@@ -55,7 +55,7 @@ class SmModel : public SfxBaseModel,
public oox::FormulaExportBase, public oox::FormulaExportBase,
public oox::FormulaImportBase public oox::FormulaImportBase
{ {
SmPrintUIOptions* m_pPrintUIOptions; std::unique_ptr<SmPrintUIOptions> m_pPrintUIOptions;
protected: protected:
virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues )
throw (css::uno::RuntimeException, css::beans::UnknownPropertyException, css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException, std::exception) SAL_OVERRIDE; throw (css::uno::RuntimeException, css::beans::UnknownPropertyException, css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException, std::exception) SAL_OVERRIDE;
......
...@@ -311,14 +311,11 @@ static PropertySetInfo * lcl_createModelPropertyInfo () ...@@ -311,14 +311,11 @@ static PropertySetInfo * lcl_createModelPropertyInfo ()
SmModel::SmModel( SfxObjectShell *pObjSh ) SmModel::SmModel( SfxObjectShell *pObjSh )
: SfxBaseModel(pObjSh) : SfxBaseModel(pObjSh)
, PropertySetHelper ( lcl_createModelPropertyInfo () ) , PropertySetHelper ( lcl_createModelPropertyInfo () )
, m_pPrintUIOptions( NULL )
{ {
} }
SmModel::~SmModel() throw () SmModel::~SmModel() throw ()
{ {
delete m_pPrintUIOptions;
} }
uno::Any SAL_CALL SmModel::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException, std::exception) uno::Any SAL_CALL SmModel::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException, std::exception)
...@@ -991,7 +988,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer( ...@@ -991,7 +988,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer(
rValue.Value <<= aPageSize; rValue.Value <<= aPageSize;
if (!m_pPrintUIOptions) if (!m_pPrintUIOptions)
m_pPrintUIOptions = new SmPrintUIOptions(); m_pPrintUIOptions.reset(new SmPrintUIOptions);
m_pPrintUIOptions->appendPrintUIOptions( aRenderer ); m_pPrintUIOptions->appendPrintUIOptions( aRenderer );
return aRenderer; return aRenderer;
...@@ -1081,7 +1078,7 @@ void SAL_CALL SmModel::render( ...@@ -1081,7 +1078,7 @@ void SAL_CALL SmModel::render(
(aPrtPageOffset.X() + OutputRect.Right())); (aPrtPageOffset.X() + OutputRect.Right()));
if (!m_pPrintUIOptions) if (!m_pPrintUIOptions)
m_pPrintUIOptions = new SmPrintUIOptions(); m_pPrintUIOptions.reset(new SmPrintUIOptions);
m_pPrintUIOptions->processProperties( rxOptions ); m_pPrintUIOptions->processProperties( rxOptions );
pView->Impl_Print( *pOut, *m_pPrintUIOptions, Rectangle( OutputRect ), Point() ); pView->Impl_Print( *pOut, *m_pPrintUIOptions, Rectangle( OutputRect ), Point() );
...@@ -1090,7 +1087,7 @@ void SAL_CALL SmModel::render( ...@@ -1090,7 +1087,7 @@ void SAL_CALL SmModel::render(
// That way, when SmPrintUIOptions is needed again it will read the latest configuration settings in its c-tor. // That way, when SmPrintUIOptions is needed again it will read the latest configuration settings in its c-tor.
if (m_pPrintUIOptions->getBoolValue( "IsLastPage", false )) if (m_pPrintUIOptions->getBoolValue( "IsLastPage", false ))
{ {
delete m_pPrintUIOptions; m_pPrintUIOptions = 0; m_pPrintUIOptions.reset();
} }
} }
} }
......
...@@ -908,20 +908,9 @@ SmCmdBoxWrapper::~SmCmdBoxWrapper() ...@@ -908,20 +908,9 @@ SmCmdBoxWrapper::~SmCmdBoxWrapper()
struct SmViewShell_Impl struct SmViewShell_Impl
{ {
sfx2::DocumentInserter* pDocInserter; std::unique_ptr<sfx2::DocumentInserter> pDocInserter;
SfxRequest* pRequest; std::unique_ptr<SfxRequest> pRequest;
SvtMiscOptions aOpts; SvtMiscOptions aOpts;
SmViewShell_Impl() :
pDocInserter( NULL )
, pRequest( NULL )
{}
~SmViewShell_Impl()
{
delete pDocInserter;
delete pRequest;
}
}; };
TYPEINIT1( SmViewShell, SfxViewShell ); TYPEINIT1( SmViewShell, SfxViewShell );
...@@ -1679,11 +1668,9 @@ void SmViewShell::Execute(SfxRequest& rReq) ...@@ -1679,11 +1668,9 @@ void SmViewShell::Execute(SfxRequest& rReq)
case SID_IMPORT_FORMULA: case SID_IMPORT_FORMULA:
{ {
delete pImpl->pRequest; pImpl->pRequest.reset(new SfxRequest( rReq ));
pImpl->pRequest = new SfxRequest( rReq ); pImpl->pDocInserter.reset(new ::sfx2::DocumentInserter(
delete pImpl->pDocInserter; GetDoc()->GetFactory().GetFactoryName(), false ));
pImpl->pDocInserter = new ::sfx2::DocumentInserter(
GetDoc()->GetFactory().GetFactoryName(), false );
pImpl->pDocInserter->StartExecuteModal( LINK( this, SmViewShell, DialogClosedHdl ) ); pImpl->pDocInserter->StartExecuteModal( LINK( this, SmViewShell, DialogClosedHdl ) );
break; break;
} }
......
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