summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2015-04-21 15:56:56 +0900
committerCaolán McNamara <caolanm@redhat.com>2015-04-21 13:04:14 +0000
commita497b913ba36ff52ad294223a1fda843c16ececf (patch)
tree4898e5b82ca4688669477adac545558ada74ddb6
parent0a43d7c4859345d7d2aced1309175e974e6e75be (diff)
use std::unique_ptr<> to simplify ctor and dtor
Change-Id: Icfb02807cb9370e72149cdb9122b3b108eb3e4a5 Reviewed-on: https://gerrit.libreoffice.org/15456 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--starmath/inc/unomodel.hxx4
-rw-r--r--starmath/source/unomodel.cxx9
-rw-r--r--starmath/source/view.cxx23
3 files changed, 10 insertions, 26 deletions
diff --git a/starmath/inc/unomodel.hxx b/starmath/inc/unomodel.hxx
index 7e4223ffeb8e..9dc6812877e6 100644
--- a/starmath/inc/unomodel.hxx
+++ b/starmath/inc/unomodel.hxx
@@ -29,7 +29,7 @@
#include <vcl/print.hxx>
#include <oox/mathml/export.hxx>
#include <oox/mathml/import.hxx>
-
+#include <memory>
#define PRTUIOPT_TITLE_ROW "TitleRow"
@@ -55,7 +55,7 @@ class SmModel : public SfxBaseModel,
public oox::FormulaExportBase,
public oox::FormulaImportBase
{
- SmPrintUIOptions* m_pPrintUIOptions;
+ std::unique_ptr<SmPrintUIOptions> m_pPrintUIOptions;
protected:
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;
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index fe337b41ff54..f4bfcab8b8a9 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -311,14 +311,11 @@ static PropertySetInfo * lcl_createModelPropertyInfo ()
SmModel::SmModel( SfxObjectShell *pObjSh )
: SfxBaseModel(pObjSh)
, PropertySetHelper ( lcl_createModelPropertyInfo () )
-, m_pPrintUIOptions( NULL )
-
{
}
SmModel::~SmModel() throw ()
{
- delete m_pPrintUIOptions;
}
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(
rValue.Value <<= aPageSize;
if (!m_pPrintUIOptions)
- m_pPrintUIOptions = new SmPrintUIOptions();
+ m_pPrintUIOptions.reset(new SmPrintUIOptions);
m_pPrintUIOptions->appendPrintUIOptions( aRenderer );
return aRenderer;
@@ -1081,7 +1078,7 @@ void SAL_CALL SmModel::render(
(aPrtPageOffset.X() + OutputRect.Right()));
if (!m_pPrintUIOptions)
- m_pPrintUIOptions = new SmPrintUIOptions();
+ m_pPrintUIOptions.reset(new SmPrintUIOptions);
m_pPrintUIOptions->processProperties( rxOptions );
pView->Impl_Print( *pOut, *m_pPrintUIOptions, Rectangle( OutputRect ), Point() );
@@ -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.
if (m_pPrintUIOptions->getBoolValue( "IsLastPage", false ))
{
- delete m_pPrintUIOptions; m_pPrintUIOptions = 0;
+ m_pPrintUIOptions.reset();
}
}
}
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 8a8eb2d53a47..4b22180b6ac3 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -908,20 +908,9 @@ SmCmdBoxWrapper::~SmCmdBoxWrapper()
struct SmViewShell_Impl
{
- sfx2::DocumentInserter* pDocInserter;
- SfxRequest* pRequest;
+ std::unique_ptr<sfx2::DocumentInserter> pDocInserter;
+ std::unique_ptr<SfxRequest> pRequest;
SvtMiscOptions aOpts;
-
- SmViewShell_Impl() :
- pDocInserter( NULL )
- , pRequest( NULL )
- {}
-
- ~SmViewShell_Impl()
- {
- delete pDocInserter;
- delete pRequest;
- }
};
TYPEINIT1( SmViewShell, SfxViewShell );
@@ -1679,11 +1668,9 @@ void SmViewShell::Execute(SfxRequest& rReq)
case SID_IMPORT_FORMULA:
{
- delete pImpl->pRequest;
- pImpl->pRequest = new SfxRequest( rReq );
- delete pImpl->pDocInserter;
- pImpl->pDocInserter = new ::sfx2::DocumentInserter(
- GetDoc()->GetFactory().GetFactoryName(), false );
+ pImpl->pRequest.reset(new SfxRequest( rReq ));
+ pImpl->pDocInserter.reset(new ::sfx2::DocumentInserter(
+ GetDoc()->GetFactory().GetFactoryName(), false ));
pImpl->pDocInserter->StartExecuteModal( LINK( this, SmViewShell, DialogClosedHdl ) );
break;
}