summaryrefslogtreecommitdiff
path: root/sw
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 /sw
parent423dacde87cbb3cba466c9701ed10dadc2b8b4e0 (diff)
Use unique_ptr for SfxPrinter::pOptions
Change-Id: I46be77225c0323f8b7f293de9c022f0de6f425b7
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/DocumentDeviceManager.cxx10
-rw-r--r--sw/source/ui/config/optpage.cxx9
-rw-r--r--sw/source/ui/dialog/ascfldlg.cxx9
-rw-r--r--sw/source/uibase/misc/glshell.cxx7
-rw-r--r--sw/source/uibase/uno/SwXDocumentSettings.cxx9
5 files changed, 30 insertions, 14 deletions
diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx b/sw/source/core/doc/DocumentDeviceManager.cxx
index fbcfdb7dfe2d..b5ccaa5aead6 100644
--- a/sw/source/core/doc/DocumentDeviceManager.cxx
+++ b/sw/source/core/doc/DocumentDeviceManager.cxx
@@ -20,6 +20,7 @@
#include <DocumentDeviceManager.hxx>
#include <memory>
+#include <utility>
#include <IDocumentDeviceAccess.hxx>
#include <doc.hxx>
@@ -27,6 +28,7 @@
#include <IDocumentDrawModelAccess.hxx>
#include <IDocumentState.hxx>
#include <IDocumentLayoutAccess.hxx>
+#include <o3tl/make_unique.hxx>
#include <sfx2/printer.hxx>
#include <vcl/virdev.hxx>
#include <vcl/outdev.hxx>
@@ -204,13 +206,13 @@ void DocumentDeviceManager::setJobsetup(/*[in]*/ const JobSetup &rJobSetup )
if( !mpPrt )
{
//The ItemSet is deleted by Sfx!
- SfxItemSet *pSet = new SfxItemSet( m_rDoc.GetAttrPool(),
+ auto pSet = o3tl::make_unique<SfxItemSet>( m_rDoc.GetAttrPool(),
FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
SID_HTML_MODE, SID_HTML_MODE,
SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
0 );
- VclPtr<SfxPrinter> p = VclPtr<SfxPrinter>::Create( pSet, rJobSetup );
+ VclPtr<SfxPrinter> p = VclPtr<SfxPrinter>::Create( std::move(pSet), rJobSetup );
if ( bCheckPageDescs )
setPrinter( p, true, true );
else
@@ -288,14 +290,14 @@ SfxPrinter& DocumentDeviceManager::CreatePrinter_() const
// We create a default SfxPrinter.
// The ItemSet is deleted by Sfx!
- SfxItemSet *pSet = new SfxItemSet( m_rDoc.GetAttrPool(),
+ auto pSet = o3tl::make_unique<SfxItemSet>( m_rDoc.GetAttrPool(),
FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
SID_HTML_MODE, SID_HTML_MODE,
SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
0 );
- VclPtr<SfxPrinter> pNewPrt = VclPtr<SfxPrinter>::Create( pSet );
+ VclPtr<SfxPrinter> pNewPrt = VclPtr<SfxPrinter>::Create( std::move(pSet) );
const_cast<DocumentDeviceManager*>(this)->setPrinter( pNewPrt, true, true );
return *mpPrt.get();
}
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 8c6306eb839b..83e249172f0e 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <utility>
+
#include <optpage.hxx>
#include <doc.hxx>
#include <hintids.hxx>
@@ -49,6 +53,7 @@
#include <editeng/fontitem.hxx>
#include <editeng/langitem.hxx>
#include <editeng/svxenum.hxx>
+#include <o3tl/make_unique.hxx>
#include <sal/macros.h>
#include <sfx2/dialoghelper.hxx>
#include <sfx2/request.hxx>
@@ -806,11 +811,11 @@ void SwStdFontTabPage::Reset( const SfxItemSet* rSet)
}
else
{
- SfxItemSet* pPrinterSet = new SfxItemSet( *rSet->GetPool(),
+ auto pPrinterSet = o3tl::make_unique<SfxItemSet>( *rSet->GetPool(),
SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
0 );
- m_pPrt = VclPtr<SfxPrinter>::Create(pPrinterSet);
+ m_pPrt = VclPtr<SfxPrinter>::Create(std::move(pPrinterSet));
}
delete m_pFontList;
m_pFontList = new FontList( m_pPrt );
diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx
index 75e518af1657..665bd8d7a331 100644
--- a/sw/source/ui/dialog/ascfldlg.cxx
+++ b/sw/source/ui/dialog/ascfldlg.cxx
@@ -17,7 +17,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <utility>
+
#include <hintids.hxx>
+#include <o3tl/make_unique.hxx>
#include <rtl/textenc.h>
#include <i18nlangtag/mslangid.hxx>
#include <com/sun/star/i18n/ScriptType.hpp>
@@ -177,11 +182,11 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh,
VclPtr<SfxPrinter> pPrt = pDoc ? pDoc->getIDocumentDeviceAccess().getPrinter(false) : nullptr;
if( !pPrt )
{
- SfxItemSet* pSet = new SfxItemSet( rDocSh.GetPool(),
+ auto pSet = o3tl::make_unique<SfxItemSet>( rDocSh.GetPool(),
SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
0 );
- pPrt = VclPtr<SfxPrinter>::Create( pSet );
+ pPrt = VclPtr<SfxPrinter>::Create( std::move(pSet) );
bDelPrinter = true;
}
diff --git a/sw/source/uibase/misc/glshell.cxx b/sw/source/uibase/misc/glshell.cxx
index e3e6273a9fb5..f9be5953fe7c 100644
--- a/sw/source/uibase/misc/glshell.cxx
+++ b/sw/source/uibase/misc/glshell.cxx
@@ -18,7 +18,7 @@
*/
#include <com/sun/star/frame/XTitle.hpp>
-
+#include <o3tl/make_unique.hxx>
#include <svl/eitem.hxx>
#include <svl/stritem.hxx>
#include <sfx2/printer.hxx>
@@ -53,6 +53,7 @@
#include <sfx2/msg.hxx>
#include <swslots.hxx>
#include <memory>
+#include <utility>
using namespace ::com::sun::star;
@@ -239,12 +240,12 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const OUString& rGroup, const OUString
{
// we create a default SfxPrinter.
// ItemSet is deleted by Sfx!
- SfxItemSet *pSet = new SfxItemSet( xDocSh->GetDoc()->GetAttrPool(),
+ auto pSet = o3tl::make_unique<SfxItemSet>( xDocSh->GetDoc()->GetAttrPool(),
FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
0 );
- VclPtr<SfxPrinter> pPrinter = VclPtr<SfxPrinter>::Create( pSet );
+ VclPtr<SfxPrinter> pPrinter = VclPtr<SfxPrinter>::Create( std::move(pSet) );
// and append it to the document.
xDocSh->GetDoc()->getIDocumentDeviceAccess().setPrinter( pPrinter, true, true );
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index dfc3586184e7..7c314d82fc08 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.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/sfxbasecontroller.hxx>
#include <SwXDocumentSettings.hxx>
@@ -388,7 +391,7 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
SfxPrinter* pPrinter = mpDoc->getIDocumentDeviceAccess().getPrinter( true );
if ( pPrinter->GetName() != sPrinterName )
{
- VclPtrInstance<SfxPrinter> pNewPrinter( pPrinter->GetOptions().Clone(), sPrinterName );
+ VclPtrInstance<SfxPrinter> pNewPrinter( std::unique_ptr<SfxItemSet>(pPrinter->GetOptions().Clone()), sPrinterName );
assert (! pNewPrinter->isDisposed() );
if( pNewPrinter->IsKnown() )
{
@@ -425,8 +428,8 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
0
};
- SfxItemSet *pItemSet = new SfxItemSet( mpDoc->GetAttrPool(), nRange );
- VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, pItemSet );
+ auto pItemSet = o3tl::make_unique<SfxItemSet>( mpDoc->GetAttrPool(), nRange );
+ VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, std::move(pItemSet) );
assert (! pPrinter->isDisposed() );
// set printer only once; in _postSetValues
mpPrinter.disposeAndClear();