diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-03-18 20:52:22 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-10 12:02:53 +0100 |
commit | cf06c0135d44b8f553940d0fabe03918d61d8a8f (patch) | |
tree | 6477e25690a605b75a4c163fd6d74022f4b90c32 /sw | |
parent | 4f72ab022425318b109e52a641e63f673fce653d (diff) |
start of unwinding reference OutputDevice & Printer lifecycle.
Change-Id: I066337f46a3c39d1eaba5e7a1f4e1278816a0b27
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/DocumentDeviceManager.cxx | 22 | ||||
-rw-r--r-- | sw/source/core/inc/DocumentDeviceManager.hxx | 6 |
2 files changed, 14 insertions, 14 deletions
diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx b/sw/source/core/doc/DocumentDeviceManager.cxx index f2f751779ff9..5d38a936b13a 100644 --- a/sw/source/core/doc/DocumentDeviceManager.cxx +++ b/sw/source/core/doc/DocumentDeviceManager.cxx @@ -55,8 +55,8 @@ DocumentDeviceManager::DocumentDeviceManager( SwDoc& i_rSwdoc ) : m_rDoc( i_rSwd SfxPrinter* DocumentDeviceManager::getPrinter(/*[in]*/ bool bCreate ) const { SfxPrinter* pRet = 0; - if ( !bCreate || mpPrt ) - pRet = mpPrt; + if ( !bCreate || mpPrt ) + pRet = mpPrt; else pRet = &CreatePrinter_(); @@ -65,10 +65,10 @@ SfxPrinter* DocumentDeviceManager::getPrinter(/*[in]*/ bool bCreate ) const void DocumentDeviceManager::setPrinter(/*[in]*/ SfxPrinter *pP,/*[in]*/ bool bDeleteOld,/*[in]*/ bool bCallPrtDataChanged ) { - if ( pP != mpPrt ) + if ( pP != mpPrt ) { if ( bDeleteOld ) - delete mpPrt; + mpPrt.disposeAndClear(); mpPrt = pP; // our printer should always use TWIP. Don't rely on this being set in SwViewShell::InitPrt, there @@ -78,7 +78,7 @@ void DocumentDeviceManager::setPrinter(/*[in]*/ SfxPrinter *pP,/*[in]*/ bool bDe { MapMode aMapMode( mpPrt->GetMapMode() ); aMapMode.SetMapUnit( MAP_TWIP ); - mpPrt->SetMapMode( aMapMode ); + mpPrt->SetMapMode( aMapMode ); } if ( m_rDoc.getIDocumentDrawModelAccess().GetDrawModel() && !m_rDoc.GetDocumentSettingManager().get( DocumentSettingId::USE_VIRTUAL_DEVICE ) ) @@ -105,10 +105,10 @@ VirtualDevice* DocumentDeviceManager::getVirtualDevice(/*[in]*/ bool bCreate ) c void DocumentDeviceManager::setVirtualDevice(/*[in]*/ VirtualDevice* pVd,/*[in]*/ bool bDeleteOld, /*[in]*/ bool ) { - if ( mpVirDev != pVd ) + if ( mpVirDev.get() != pVd ) { if ( bDeleteOld ) - delete mpVirDev; + mpVirDev.disposeAndClear(); mpVirDev = pVd; if ( m_rDoc.getIDocumentDrawModelAccess().GetDrawModel() && m_rDoc.GetDocumentSettingManager().get( DocumentSettingId::USE_VIRTUAL_DEVICE ) ) @@ -193,7 +193,7 @@ void DocumentDeviceManager::setJobsetup(/*[in]*/ const JobSetup &rJobSetup ) } } else - delete mpPrt, mpPrt = 0; + mpPrt.disposeAndClear(); } if( !mpPrt ) @@ -247,8 +247,8 @@ void DocumentDeviceManager::setPrintData(/*[in]*/ const SwPrintData& rPrtData ) DocumentDeviceManager::~DocumentDeviceManager() { delete mpPrtData; - delete mpVirDev; - DELETEZ( mpPrt ); + mpVirDev.disposeAndClear(); + mpPrt.disposeAndClear(); } VirtualDevice& DocumentDeviceManager::CreateVirtualDevice_() const @@ -292,7 +292,7 @@ SfxPrinter& DocumentDeviceManager::CreatePrinter_() const SfxPrinter* pNewPrt = new SfxPrinter( pSet ); const_cast<DocumentDeviceManager*>(this)->setPrinter( pNewPrt, true, true ); - return *mpPrt; + return *mpPrt.get(); } void DocumentDeviceManager::PrtDataChanged() diff --git a/sw/source/core/inc/DocumentDeviceManager.hxx b/sw/source/core/inc/DocumentDeviceManager.hxx index 1440b63897b6..f388b4d8d273 100644 --- a/sw/source/core/inc/DocumentDeviceManager.hxx +++ b/sw/source/core/inc/DocumentDeviceManager.hxx @@ -22,7 +22,7 @@ #include <IDocumentDeviceAccess.hxx> #include <boost/utility.hpp> #include <sal/types.h> - +#include <vcl/vclptr.hxx> class SwDoc; class SfxPrinter; @@ -72,8 +72,8 @@ private: invalidations and notifications. */ SwDoc& m_rDoc; - SfxPrinter* mpPrt; - VirtualDevice* mpVirDev; + VclPtr<SfxPrinter> mpPrt; + VclPtr<VirtualDevice> mpVirDev; SwPrintData* mpPrtData; }; |