diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-06-13 18:03:18 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-06-13 18:03:18 +0200 |
commit | cbdd3c32703fd21b6911b5a6fc5803faeed9befb (patch) | |
tree | 34d88820a086096e8f36c00c0c68dad1269ffc41 /sc | |
parent | 423dacde87cbb3cba466c9701ed10dadc2b8b4e0 (diff) |
Use unique_ptr for SfxPrinter::pOptions
Change-Id: I46be77225c0323f8b7f293de9c022f0de6f425b7
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/documen8.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/unoobj/confuno.cxx | 11 |
2 files changed, 13 insertions, 7 deletions
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index a3f81f202d2b..d01155961a13 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -19,7 +19,7 @@ #include "scitems.hxx" #include <editeng/eeitem.hxx> - +#include <o3tl/make_unique.hxx> #include <tools/urlobj.hxx> #include <editeng/editobj.hxx> #include <editeng/editstat.hxx> @@ -88,6 +88,7 @@ #include <scopetools.hxx> #include <memory> +#include <utility> using namespace com::sun::star; @@ -117,8 +118,8 @@ SfxPrinter* ScDocument::GetPrinter(bool bCreateIfNotExist) { if ( !pPrinter && bCreateIfNotExist ) { - SfxItemSet* pSet = - new SfxItemSet( *xPoolHelper->GetDocPool(), + auto pSet = + o3tl::make_unique<SfxItemSet>( *xPoolHelper->GetDocPool(), SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, SID_PRINT_SELECTEDSHEET, SID_PRINT_SELECTEDSHEET, @@ -134,7 +135,7 @@ SfxPrinter* ScDocument::GetPrinter(bool bCreateIfNotExist) pSet->Put( SfxFlagItem( SID_PRINTER_CHANGESTODOC, static_cast<int>(nFlags) ) ); pSet->Put( SfxBoolItem( SID_PRINTER_NOTFOUND_WARN, aMisc.IsNotFoundWarning() ) ); - pPrinter = VclPtr<SfxPrinter>::Create( pSet ); + pPrinter = VclPtr<SfxPrinter>::Create( std::move(pSet) ); pPrinter->SetMapMode( MapUnit::Map100thMM ); UpdateDrawPrinter(); pPrinter->SetDigitLanguage( SC_MOD()->GetOptDigitLanguage() ); diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx index ea4fa66be20e..1cbab301bb6d 100644 --- a/sc/source/ui/unoobj/confuno.cxx +++ b/sc/source/ui/unoobj/confuno.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <utility> + #include <config_features.h> #include "confuno.hxx" @@ -33,6 +37,7 @@ #include <com/sun/star/document/LinkUpdateModes.hpp> #include <cppuhelper/supportsservice.hxx> #include <formula/grammar.hxx> +#include <o3tl/make_unique.hxx> #include <sfx2/printer.hxx> #include <xmloff/xmluconv.hxx> #include <rtl/ustrbuf.hxx> @@ -207,7 +212,7 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue( { if (pPrinter->GetName() != sPrinterName) { - VclPtrInstance<SfxPrinter> pNewPrinter( pPrinter->GetOptions().Clone(), sPrinterName ); + VclPtrInstance<SfxPrinter> pNewPrinter( std::unique_ptr<SfxItemSet>(pPrinter->GetOptions().Clone()), sPrinterName ); if (pNewPrinter->IsKnown()) pDocShell->SetPrinter( pNewPrinter, SfxPrinterChangeFlags::PRINTER ); else @@ -232,13 +237,13 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue( { SvMemoryStream aStream (aSequence.getArray(), nSize, StreamMode::READ ); aStream.Seek ( STREAM_SEEK_TO_BEGIN ); - SfxItemSet* pSet = new SfxItemSet( *rDoc.GetPool(), + auto pSet = o3tl::make_unique<SfxItemSet>( *rDoc.GetPool(), SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, SID_PRINT_SELECTEDSHEET, SID_PRINT_SELECTEDSHEET, SID_SCPRINTOPTIONS, SID_SCPRINTOPTIONS, nullptr ); - pDocShell->SetPrinter( SfxPrinter::Create( aStream, pSet ) ); + pDocShell->SetPrinter( SfxPrinter::Create( aStream, std::move(pSet) ) ); } } } |