summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-06-13 18:03:18 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-06-13 18:03:18 +0200
commitcbdd3c32703fd21b6911b5a6fc5803faeed9befb (patch)
tree34d88820a086096e8f36c00c0c68dad1269ffc41 /starmath
parent423dacde87cbb3cba466c9701ed10dadc2b8b4e0 (diff)
Use unique_ptr for SfxPrinter::pOptions
Change-Id: I46be77225c0323f8b7f293de9c022f0de6f425b7
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/document.cxx6
-rw-r--r--starmath/source/unomodel.cxx9
2 files changed, 10 insertions, 5 deletions
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index 1e9e2ee0c7a6..90720004064e 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -24,6 +24,7 @@
#include <comphelper/accessibletexthelper.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/storagehelper.hxx>
+#include <o3tl/make_unique.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/ustring.hxx>
#include <unotools/eventcfg.hxx>
@@ -94,6 +95,7 @@
#include "accessibility.hxx"
#include "cfgitem.hxx"
#include <memory>
+#include <utility>
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
@@ -558,7 +560,7 @@ Printer* SmDocShell::GetPrt()
}
else if (!mpPrinter)
{
- SfxItemSet* pOptions = new SfxItemSet(GetPool(),
+ auto pOptions = o3tl::make_unique<SfxItemSet>(GetPool(),
SID_PRINTSIZE, SID_PRINTSIZE,
SID_PRINTZOOM, SID_PRINTZOOM,
SID_PRINTTITLE, SID_PRINTTITLE,
@@ -570,7 +572,7 @@ Printer* SmDocShell::GetPrt()
0);
SmModule *pp = SM_MOD();
pp->GetConfig()->ConfigToItemSet(*pOptions);
- mpPrinter = VclPtr<SfxPrinter>::Create(pOptions);
+ mpPrinter = VclPtr<SfxPrinter>::Create(std::move(pOptions));
mpPrinter->SetMapMode(MapMode(MapUnit::Map100thMM));
}
return mpPrinter;
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index 5b2fbf89f60b..53423f4160fc 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -19,7 +19,10 @@
#include <sal/config.h>
+#include <utility>
+
#include <o3tl/any.hxx>
+#include <o3tl/make_unique.hxx>
#include <osl/mutex.hxx>
#include <sfx2/printer.hxx>
#include <vcl/svapp.hxx>
@@ -591,7 +594,7 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any*
{
if ( !sPrinterName.isEmpty() )
{
- VclPtrInstance<SfxPrinter> pNewPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
+ VclPtrInstance<SfxPrinter> pNewPrinter( std::unique_ptr<SfxItemSet>(pPrinter->GetOptions().Clone()), sPrinterName );
if (pNewPrinter->IsKnown())
pDocSh->SetPrinter ( pNewPrinter );
else
@@ -624,10 +627,10 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any*
SID_AUTO_CLOSE_BRACKETS, SID_AUTO_CLOSE_BRACKETS,
0
};
- SfxItemSet *pItemSet = new SfxItemSet( SmDocShell::GetPool(), nRange );
+ auto pItemSet = o3tl::make_unique<SfxItemSet>( SmDocShell::GetPool(), nRange );
SmModule *pp = SM_MOD();
pp->GetConfig()->ConfigToItemSet(*pItemSet);
- VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, pItemSet );
+ VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, std::move(pItemSet) );
pDocSh->SetPrinter( pPrinter );
}