summaryrefslogtreecommitdiff
path: root/sd
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 /sd
parent423dacde87cbb3cba466c9701ed10dadc2b8b4e0 (diff)
Use unique_ptr for SfxPrinter::pOptions
Change-Id: I46be77225c0323f8b7f293de9c022f0de6f425b7
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/docshell/docshel4.cxx5
-rw-r--r--sd/source/ui/unoidl/UnoDocumentSettings.cxx15
2 files changed, 13 insertions, 7 deletions
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index 1e4c7c885d94..3f680f6871f2 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -20,6 +20,7 @@
#include <sal/config.h>
#include <memory>
+#include <utility>
#include "DrawDocShell.hxx"
#include <com/sun/star/document/PrinterIndependentLayout.hpp>
@@ -98,7 +99,7 @@ SfxPrinter* DrawDocShell::GetPrinter(bool bCreate)
if (bCreate && !mpPrinter)
{
// create ItemSet with special pool area
- SfxItemSet* pSet = new SfxItemSet( GetPool(),
+ auto pSet = o3tl::make_unique<SfxItemSet>( GetPool(),
SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
ATTR_OPTIONS_PRINT, ATTR_OPTIONS_PRINT,
@@ -115,7 +116,7 @@ SfxPrinter* DrawDocShell::GetPrinter(bool bCreate)
pSet->Put( SfxBoolItem( SID_PRINTER_NOTFOUND_WARN, aPrintItem.GetOptionsPrint().IsWarningPrinter() ) );
pSet->Put( aFlagItem );
- mpPrinter = VclPtr<SfxPrinter>::Create(pSet);
+ mpPrinter = VclPtr<SfxPrinter>::Create(std::move(pSet));
mbOwnPrinter = true;
// set output quality
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
index 0a5fd35da367..3958c469867a 100644
--- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <memory>
+#include <utility>
#include <vector>
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
@@ -29,6 +33,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/propertysethelper.hxx>
#include <comphelper/propertysetinfo.hxx>
+#include <o3tl/make_unique.hxx>
#include <tools/urlobj.hxx>
#include <svx/xtable.hxx>
#include <osl/mutex.hxx>
@@ -722,7 +727,7 @@ DocumentSettings::_setPropertyValues(const PropertyMapEntry** ppEntries,
SfxPrinter *pTempPrinter = pDocSh->GetPrinter( true );
if (pTempPrinter)
{
- VclPtr<SfxPrinter> pNewPrinter = VclPtr<SfxPrinter>::Create( pTempPrinter->GetOptions().Clone(), aPrinterName );
+ VclPtr<SfxPrinter> pNewPrinter = VclPtr<SfxPrinter>::Create( std::unique_ptr<SfxItemSet>(pTempPrinter->GetOptions().Clone()), aPrinterName );
pDocSh->SetPrinter( pNewPrinter );
}
}
@@ -740,22 +745,22 @@ DocumentSettings::_setPropertyValues(const PropertyMapEntry** ppEntries,
{
SvMemoryStream aStream (aSequence.getArray(), nSize, StreamMode::READ );
aStream.Seek ( STREAM_SEEK_TO_BEGIN );
- SfxItemSet* pItemSet;
+ std::unique_ptr<SfxItemSet> pItemSet;
if( pPrinter )
{
- pItemSet = pPrinter->GetOptions().Clone();
+ pItemSet.reset(pPrinter->GetOptions().Clone());
}
else
{
- pItemSet = new SfxItemSet(pDoc->GetPool(),
+ pItemSet = o3tl::make_unique<SfxItemSet>(pDoc->GetPool(),
SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
ATTR_OPTIONS_PRINT, ATTR_OPTIONS_PRINT,
0 );
}
- pPrinter = SfxPrinter::Create ( aStream, pItemSet );
+ pPrinter = SfxPrinter::Create ( aStream, std::move(pItemSet) );
MapMode aMM (pPrinter->GetMapMode());
aMM.SetMapUnit(MapUnit::Map100thMM);