diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-09-06 13:38:47 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-09-06 14:31:32 +0200 |
commit | 77e39d55457385eb1585034e8e461ad9ba77e707 (patch) | |
tree | 65251b5ad85da5538f099aad6f50c6b811c3c8b7 /vcl | |
parent | 77902a3cb2ab3af542e62253cc9f4dc12e099293 (diff) |
use unique_ptr in CreatePrintGraphics
Change-Id: Ib9ca0173f3b5bb090ae71f8622fef717a47e8a2b
Reviewed-on: https://gerrit.libreoffice.org/78704
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/headless/svpprn.cxx | 4 | ||||
-rw-r--r-- | vcl/inc/headless/svpinst.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/qt5/Qt5Instance.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/unx/geninst.h | 2 | ||||
-rw-r--r-- | vcl/inc/unx/genprn.h | 2 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtkinst.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/unx/salinst.h | 2 | ||||
-rw-r--r-- | vcl/ios/dummies.cxx | 4 | ||||
-rw-r--r-- | vcl/qt5/Qt5Instance_Print.cxx | 5 | ||||
-rw-r--r-- | vcl/unx/generic/app/salinst.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/generic/print/genprnpsp.cxx | 9 | ||||
-rw-r--r-- | vcl/unx/gtk/gtkinst.cxx | 4 |
12 files changed, 22 insertions, 20 deletions
diff --git a/vcl/headless/svpprn.cxx b/vcl/headless/svpprn.cxx index 03c24eba8217..aa8cd59de2d2 100644 --- a/vcl/headless/svpprn.cxx +++ b/vcl/headless/svpprn.cxx @@ -251,9 +251,9 @@ void SvpSalInstance::PostPrintersChanged() pInst->PostEvent( pSalFrame, nullptr, SalEvent::PrinterChanged ); } -GenPspGraphics *SvpSalInstance::CreatePrintGraphics() +std::unique_ptr<GenPspGraphics> SvpSalInstance::CreatePrintGraphics() { - return new GenPspGraphics(); + return std::make_unique<GenPspGraphics>(); } bool SvpSalInfoPrinter::Setup( weld::Window*, ImplJobSetup* ) diff --git a/vcl/inc/headless/svpinst.hxx b/vcl/inc/headless/svpinst.hxx index 546a374750c6..04e4de84cad7 100644 --- a/vcl/inc/headless/svpinst.hxx +++ b/vcl/inc/headless/svpinst.hxx @@ -176,7 +176,7 @@ public: virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) override; - virtual GenPspGraphics *CreatePrintGraphics() override; + virtual std::unique_ptr<GenPspGraphics> CreatePrintGraphics() override; }; inline void SvpSalInstance::registerFrame( SalFrame* pFrame ) diff --git a/vcl/inc/qt5/Qt5Instance.hxx b/vcl/inc/qt5/Qt5Instance.hxx index e6a80728b596..361eca0fc519 100644 --- a/vcl/inc/qt5/Qt5Instance.hxx +++ b/vcl/inc/qt5/Qt5Instance.hxx @@ -135,7 +135,7 @@ public: virtual void AddToRecentDocumentList(const OUString& rFileUrl, const OUString& rMimeType, const OUString& rDocumentService) override; - virtual GenPspGraphics* CreatePrintGraphics() override; + virtual std::unique_ptr<GenPspGraphics> CreatePrintGraphics() override; virtual bool IsMainThread() const override; diff --git a/vcl/inc/unx/geninst.h b/vcl/inc/unx/geninst.h index 95992ec383fc..dcd8bdd6fe95 100644 --- a/vcl/inc/unx/geninst.h +++ b/vcl/inc/unx/geninst.h @@ -61,7 +61,7 @@ public: virtual void jobStartedPrinterUpdate() override; virtual void jobEndedPrinterUpdate() override; bool isPrinterInit() const { return mbPrinterInit; } - virtual GenPspGraphics *CreatePrintGraphics() = 0; + virtual std::unique_ptr<GenPspGraphics> CreatePrintGraphics() = 0; virtual OUString getOSVersion() override; diff --git a/vcl/inc/unx/genprn.h b/vcl/inc/unx/genprn.h index 9f382e178a20..00e174932851 100644 --- a/vcl/inc/unx/genprn.h +++ b/vcl/inc/unx/genprn.h @@ -59,7 +59,7 @@ public: OUString m_aFileName; OUString m_aTmpFile; SalInfoPrinter* m_pInfoPrinter; - GenPspGraphics* m_pGraphics; + std::unique_ptr<GenPspGraphics> m_xGraphics; psp::PrinterJob m_aPrintJob; psp::JobData m_aJobData; psp::PrinterGfx m_aPrinterGfx; diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx index e7543c52d0ff..65caa384c0ae 100644 --- a/vcl/inc/unx/gtk/gtkinst.hxx +++ b/vcl/inc/unx/gtk/gtkinst.hxx @@ -224,7 +224,7 @@ public: // impossible to handle correctly, as "main thread" depends on the dispatch mutex virtual bool IsMainThread() const override { return false; } - virtual GenPspGraphics *CreatePrintGraphics() override; + virtual std::unique_ptr<GenPspGraphics> CreatePrintGraphics() override; virtual bool hasNativeFileSelection() const override { return true; } diff --git a/vcl/inc/unx/salinst.h b/vcl/inc/unx/salinst.h index e91e179f069a..bd28d6895f78 100644 --- a/vcl/inc/unx/salinst.h +++ b/vcl/inc/unx/salinst.h @@ -64,7 +64,7 @@ public: long &nDX, long &nDY, DeviceFormat eFormat, const SystemGraphicsData *pData = nullptr ) override; virtual void PostPrintersChanged() override; - virtual GenPspGraphics *CreatePrintGraphics() override; + virtual std::unique_ptr<GenPspGraphics> CreatePrintGraphics() override; virtual SalTimer* CreateSalTimer() override; virtual SalSystem* CreateSalSystem() override; diff --git a/vcl/ios/dummies.cxx b/vcl/ios/dummies.cxx index 0a42b8307887..efc0daae0f86 100644 --- a/vcl/ios/dummies.cxx +++ b/vcl/ios/dummies.cxx @@ -37,9 +37,9 @@ OUString SvpSalInstance::GetDefaultPrinter() return OUString(); } -GenPspGraphics *SvpSalInstance::CreatePrintGraphics() +std::unique_ptr<GenPspGraphics> SvpSalInstance::CreatePrintGraphics() { - return NULL; + return nullptr; } void SvpSalInstance::PostPrintersChanged() diff --git a/vcl/qt5/Qt5Instance_Print.cxx b/vcl/qt5/Qt5Instance_Print.cxx index 1a0410844976..cab5757a31f4 100644 --- a/vcl/qt5/Qt5Instance_Print.cxx +++ b/vcl/qt5/Qt5Instance_Print.cxx @@ -124,6 +124,9 @@ OUString Qt5Instance::GetDefaultPrinter() void Qt5Instance::PostPrintersChanged() {} -GenPspGraphics* Qt5Instance::CreatePrintGraphics() { return new GenPspGraphics(); } +std::unique_ptr<GenPspGraphics> Qt5Instance::CreatePrintGraphics() +{ + return std::make_unique<GenPspGraphics>(); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx index d56f6f728e79..13219e28fbe3 100644 --- a/vcl/unx/generic/app/salinst.cxx +++ b/vcl/unx/generic/app/salinst.cxx @@ -216,9 +216,9 @@ void X11SalInstance::PostPrintersChanged() pDisp->PostEvent( pSalFrame, nullptr, SalEvent::PrinterChanged ); } -GenPspGraphics *X11SalInstance::CreatePrintGraphics() +std::unique_ptr<GenPspGraphics> X11SalInstance::CreatePrintGraphics() { - return new GenPspGraphics(); + return std::make_unique<GenPspGraphics>(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx index 405e4e464b69..7e1d1a33c8ba 100644 --- a/vcl/unx/generic/print/genprnpsp.cxx +++ b/vcl/unx/generic/print/genprnpsp.cxx @@ -479,7 +479,7 @@ SalGraphics* PspSalInfoPrinter::AcquireGraphics() SalGraphics* pRet = nullptr; if( ! m_pGraphics ) { - m_pGraphics.reset( GetGenericInstance()->CreatePrintGraphics() ); + m_pGraphics = GetGenericInstance()->CreatePrintGraphics(); m_pGraphics->Init(&m_aJobData, &m_aPrinterGfx); pRet = m_pGraphics.get(); } @@ -792,7 +792,6 @@ sal_uInt32 PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, Pr */ PspSalPrinter::PspSalPrinter( SalInfoPrinter* pInfoPrinter ) : m_pInfoPrinter( pInfoPrinter ) - , m_pGraphics( nullptr ) , m_nCopies( 1 ) , m_bCollate( false ) , m_bPdf( false ) @@ -885,8 +884,8 @@ SalGraphics* PspSalPrinter::StartPage( ImplJobSetup* pJobSetup, bool ) SAL_INFO( "vcl.unx.print", "PspSalPrinter::StartPage"); JobData::constructFromStreamBuffer( pJobSetup->GetDriverData(), pJobSetup->GetDriverDataLen(), m_aJobData ); - m_pGraphics = GetGenericInstance()->CreatePrintGraphics(); - m_pGraphics->Init(&m_aJobData, &m_aPrinterGfx); + m_xGraphics = GetGenericInstance()->CreatePrintGraphics(); + m_xGraphics->Init(&m_aJobData, &m_aPrinterGfx); if( m_nCopies > 1 ) { @@ -899,7 +898,7 @@ SalGraphics* PspSalPrinter::StartPage( ImplJobSetup* pJobSetup, bool ) m_aPrintJob.StartPage( m_aJobData ); m_aPrinterGfx.Init( m_aPrintJob ); - return m_pGraphics; + return m_xGraphics.get(); } void PspSalPrinter::EndPage() diff --git a/vcl/unx/gtk/gtkinst.cxx b/vcl/unx/gtk/gtkinst.cxx index 40cd9769b861..2a31b87e45cf 100644 --- a/vcl/unx/gtk/gtkinst.cxx +++ b/vcl/unx/gtk/gtkinst.cxx @@ -438,10 +438,10 @@ bool GtkInstance::AnyInput( VclInputFlags nType ) return bRet; } -GenPspGraphics *GtkInstance::CreatePrintGraphics() +std::unique_ptr<GenPspGraphics> GtkInstance::CreatePrintGraphics() { EnsureInit(); - return new GenPspGraphics(); + return std::make_unique<GenPspGraphics>(); } std::shared_ptr<vcl::unx::GtkPrintWrapper> const & |