diff options
Diffstat (limited to 'toolkit/source/awt/vclxdevice.cxx')
-rw-r--r-- | toolkit/source/awt/vclxdevice.cxx | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/toolkit/source/awt/vclxdevice.cxx b/toolkit/source/awt/vclxdevice.cxx index 57cd040d40e0..da7ad04a0b18 100644 --- a/toolkit/source/awt/vclxdevice.cxx +++ b/toolkit/source/awt/vclxdevice.cxx @@ -43,8 +43,7 @@ // class VCLXDevice VCLXDevice::VCLXDevice() - : mpOutputDevice(NULL) - , pDummy(NULL) + : pDummy(NULL) , nFlags(0) { } @@ -53,12 +52,6 @@ VCLXDevice::~VCLXDevice() { } -void VCLXDevice::DestroyOutputDevice() -{ - delete mpOutputDevice; - mpOutputDevice = NULL; -} - void VCLXDevice::SetCreatedWithToolkit( bool bCreatedWithToolkit ) { if ( bCreatedWithToolkit ) @@ -109,7 +102,7 @@ IMPL_XTYPEPROVIDER_END if ( GetOutputDevice() ) { VCLXVirtualDevice* pVDev = new VCLXVirtualDevice; - VirtualDevice* pVclVDev = new VirtualDevice( *GetOutputDevice() ); + VclPtrInstance<VirtualDevice> pVclVDev( *GetOutputDevice() ); pVclVDev->SetOutputSizePixel( Size( nWidth, nHeight ) ); pVDev->SetVirtualDevice( pVclVDev ); xRef = pVDev; @@ -129,14 +122,14 @@ IMPL_XTYPEPROVIDER_END OutDevType eDevType = mpOutputDevice->GetOutDevType(); if ( eDevType == OUTDEV_WINDOW ) { - aDevSz = static_cast<vcl::Window*>(mpOutputDevice)->GetSizePixel(); - static_cast<vcl::Window*>(mpOutputDevice)->GetBorder( aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset ); + aDevSz = static_cast<vcl::Window*>(mpOutputDevice.get())->GetSizePixel(); + static_cast<vcl::Window*>(mpOutputDevice.get())->GetBorder( aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset ); } else if ( eDevType == OUTDEV_PRINTER ) { - aDevSz = static_cast<Printer*>(mpOutputDevice)->GetPaperSizePixel(); + aDevSz = static_cast<Printer*>(mpOutputDevice.get())->GetPaperSizePixel(); Size aOutSz = mpOutputDevice->GetOutputSizePixel(); - Point aOffset = static_cast<Printer*>(mpOutputDevice)->GetPageOffset(); + Point aOffset = static_cast<Printer*>(mpOutputDevice.get())->GetPageOffset(); aInfo.LeftInset = aOffset.X(); aInfo.TopInset = aOffset.Y(); aInfo.RightInset = aDevSz.Width() - aOutSz.Width() - aOffset.X(); @@ -228,19 +221,15 @@ IMPL_XTYPEPROVIDER_END return xDBmp; } - VCLXVirtualDevice::~VCLXVirtualDevice() { SolarMutexGuard aGuard; - DestroyOutputDevice(); + mpOutputDevice.disposeAndClear(); } - - // Interface implementation of ::com::sun::star::awt::XUnitConversion - ::com::sun::star::awt::Point SAL_CALL VCLXDevice::convertPointToLogic( const ::com::sun::star::awt::Point& aPoint, ::sal_Int16 TargetUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) { (void)aPoint; |