diff options
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r-- | vcl/source/gdi/animate.cxx | 6 | ||||
-rw-r--r-- | vcl/source/gdi/bitmapex.cxx | 14 | ||||
-rw-r--r-- | vcl/source/gdi/cvtsvm.cxx | 26 | ||||
-rw-r--r-- | vcl/source/gdi/gdimetafiletools.cxx | 20 | ||||
-rw-r--r-- | vcl/source/gdi/gdimtf.cxx | 180 | ||||
-rw-r--r-- | vcl/source/gdi/impanmvw.cxx | 22 | ||||
-rw-r--r-- | vcl/source/gdi/impanmvw.hxx | 6 | ||||
-rw-r--r-- | vcl/source/gdi/impgraph.cxx | 16 | ||||
-rw-r--r-- | vcl/source/gdi/impvect.cxx | 4 | ||||
-rw-r--r-- | vcl/source/gdi/oldprintadaptor.cxx | 6 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 16 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.hxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl2.cxx | 6 | ||||
-rw-r--r-- | vcl/source/gdi/print.cxx | 19 | ||||
-rw-r--r-- | vcl/source/gdi/print2.cxx | 94 | ||||
-rw-r--r-- | vcl/source/gdi/print3.cxx | 37 | ||||
-rw-r--r-- | vcl/source/gdi/virdev.cxx | 13 |
17 files changed, 255 insertions, 232 deletions
diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx index f83581fd8bba..4ab246f0d713 100644 --- a/vcl/source/gdi/animate.cxx +++ b/vcl/source/gdi/animate.cxx @@ -802,4 +802,10 @@ SvStream& ReadAnimation( SvStream& rIStm, Animation& rAnimation ) return rIStm; } +AInfo::AInfo() : pOutDev( NULL ), + pViewData( NULL ), + nExtraData( 0L ), + bWithSize( false ), + bPause( false ) {} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index 79ae295b3f74..80cb6f832b29 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -706,16 +706,16 @@ BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize Size aStdSize( aStandardSize, aStandardSize ); Rectangle aRect(aEmptyPoint, aStdSize ); - VirtualDevice aVirDevice( *Application::GetDefaultDevice(), 0, 1 ); - aVirDevice.SetOutputSizePixel( aStdSize ); - aVirDevice.SetFillColor( COL_TRANSPARENT ); - aVirDevice.SetLineColor( COL_TRANSPARENT ); + ScopedVclPtrInstance< VirtualDevice > aVirDevice( *Application::GetDefaultDevice(), 0, 1 ); + aVirDevice->SetOutputSizePixel( aStdSize ); + aVirDevice->SetFillColor( COL_TRANSPARENT ); + aVirDevice->SetLineColor( COL_TRANSPARENT ); // Draw a rect into virDevice - aVirDevice.DrawRect( aRect ); + aVirDevice->DrawRect( aRect ); Point aPointPixel( (long)imgposX, (long)imgposY ); - aVirDevice.DrawBitmapEx( aPointPixel, aRet ); - aRet = aVirDevice.GetBitmapEx( aEmptyPoint, aStdSize ); + aVirDevice->DrawBitmapEx( aPointPixel, aRet ); + aRet = aVirDevice->GetBitmapEx( aEmptyPoint, aStdSize ); return aRet; } diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx index 3ef048230e30..8509f66d8eaf 100644 --- a/vcl/source/gdi/cvtsvm.cxx +++ b/vcl/source/gdi/cvtsvm.cxx @@ -497,8 +497,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) } LineInfo aLineInfo( LINE_NONE, 0 ); - ::std::stack< LineInfo* > aLIStack; - VirtualDevice aFontVDev; + ::std::stack< LineInfo* > aLIStack; + ScopedVclPtrInstance< VirtualDevice > aFontVDev; rtl_TextEncoding eActualCharSet = osl_getThreadTextEncoding(); bool bFatLine = false; @@ -848,7 +848,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) rMtf.AddAction( new MetaTextFillColorAction( aFont.GetFillColor(), !aFont.IsTransparent() ) ); // #106172# Track font relevant data in shadow VDev - aFontVDev.SetFont( aFont ); + aFontVDev->SetFont( aFont ); } break; @@ -904,7 +904,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) { boost::scoped_array<long> pTmpAry(new long[nStrLen]); - aFontVDev.GetTextArray( aStr, pTmpAry.get(), nIndex, nLen ); + aFontVDev->GetTextArray( aStr, pTmpAry.get(), nIndex, nLen ); // now, the difference between the // last and the second last DX array @@ -1022,7 +1022,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) rMtf.AddAction( new MetaMapModeAction( aMapMode ) ); // #106172# Track font relevant data in shadow VDev - aFontVDev.SetMapMode( aMapMode ); + aFontVDev->SetMapMode( aMapMode ); } break; @@ -1132,7 +1132,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) rMtf.AddAction( new MetaPushAction( PushFlags::ALL ) ); // #106172# Track font relevant data in shadow VDev - aFontVDev.Push(); + aFontVDev->Push(); } break; @@ -1159,7 +1159,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) rMtf.AddAction( new MetaPopAction() ); // #106172# Track font relevant data in shadow VDev - aFontVDev.Pop(); + aFontVDev->Pop(); } break; @@ -1259,9 +1259,9 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) // #106172# Track font relevant data in shadow VDev if( bSet ) - aFontVDev.SetRefPoint( aRefPoint ); + aFontVDev->SetRefPoint( aRefPoint ); else - aFontVDev.SetRefPoint(); + aFontVDev->SetRefPoint(); } break; @@ -1374,7 +1374,7 @@ void SVMConverter::ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf ) rtl_TextEncoding eActualCharSet = osl_getThreadTextEncoding(); const Size aPrefSize( rMtf.GetPrefSize() ); bool bRop_0_1 = false; - VirtualDevice aSaveVDev; + ScopedVclPtrInstance< VirtualDevice > aSaveVDev; Color aLineCol( COL_BLACK ); ::std::stack< Color* > aLineColStack; @@ -1392,7 +1392,7 @@ void SVMConverter::ImplConvertToSVM1( SvStream& rOStm, GDIMetaFile& rMtf ) nCountPos = rOStm.Tell(); rOStm.SeekRel( 4L ); - const sal_Int32 nActCount = ImplWriteActions( rOStm, rMtf, aSaveVDev, bRop_0_1, aLineCol, aLineColStack, eActualCharSet ); + const sal_Int32 nActCount = ImplWriteActions( rOStm, rMtf, *aSaveVDev.get(), bRop_0_1, aLineCol, aLineColStack, eActualCharSet ); const sal_uLong nActPos = rOStm.Tell(); rOStm.Seek( nCountPos ); @@ -2311,10 +2311,10 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { // write actions for hatch - VirtualDevice aVDev; + ScopedVclPtrInstance< VirtualDevice > aVDev; GDIMetaFile aTmpMtf; - aVDev.AddHatchActions( rPolyPoly, rHatch, aTmpMtf ); + aVDev->AddHatchActions( rPolyPoly, rHatch, aTmpMtf ); nAddCount = ImplWriteActions( rOStm, aTmpMtf, rSaveVDev, rRop_0_1, rLineCol, rLineColStack, rActualCharSet ); nNewPos = rOStm.Tell(); rOStm.Seek( nOldPos ); diff --git a/vcl/source/gdi/gdimetafiletools.cxx b/vcl/source/gdi/gdimetafiletools.cxx index 3fa559a6abb8..1c19a11a4305 100644 --- a/vcl/source/gdi/gdimetafiletools.cxx +++ b/vcl/source/gdi/gdimetafiletools.cxx @@ -161,23 +161,23 @@ namespace // in pixel mode for alpha channel painting (black is transparent, // white to paint 100% opacity) const Size aSizePixel(rBitmapEx.GetSizePixel()); - VirtualDevice aVDev; + ScopedVclPtrInstance< VirtualDevice > aVDev; - aVDev.SetOutputSizePixel(aSizePixel); - aVDev.EnableMapMode(false); - aVDev.SetFillColor(COL_WHITE); - aVDev.SetLineColor(); + aVDev->SetOutputSizePixel(aSizePixel); + aVDev->EnableMapMode(false); + aVDev->SetFillColor(COL_WHITE); + aVDev->SetLineColor(); if(rBitmapEx.IsTransparent()) { // use given alpha channel - aVDev.DrawBitmap(Point(0, 0), rBitmapEx.GetAlpha().GetBitmap()); + aVDev->DrawBitmap(Point(0, 0), rBitmapEx.GetAlpha().GetBitmap()); } else { // reset alpha channel - aVDev.SetBackground(Wallpaper(Color(COL_BLACK))); - aVDev.Erase(); + aVDev->SetBackground(Wallpaper(Color(COL_BLACK))); + aVDev->Erase(); } // transform polygon from clipping to pixel coordinates @@ -203,11 +203,11 @@ namespace aInvertPixelPoly.append(aPixelPoly); // paint as alpha - aVDev.DrawPolyPolygon(aInvertPixelPoly); + aVDev->DrawPolyPolygon(aInvertPixelPoly); // get created alpha mask and set defaults AlphaMask aAlpha( - aVDev.GetBitmap( + aVDev->GetBitmap( Point(0, 0), aSizePixel)); diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index a761a5d07516..0eafc4f67e38 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -723,10 +723,10 @@ void GDIMetaFile::Move( long nX, long nY ) { const Size aBaseOffset( nX, nY ); Size aOffset( aBaseOffset ); - VirtualDevice aMapVDev; + ScopedVclPtrInstance< VirtualDevice > aMapVDev; - aMapVDev.EnableOutput( false ); - aMapVDev.SetMapMode( GetPrefMapMode() ); + aMapVDev->EnableOutput( false ); + aMapVDev->SetMapMode( GetPrefMapMode() ); for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() ) { @@ -745,8 +745,8 @@ void GDIMetaFile::Move( long nX, long nY ) ( META_PUSH_ACTION == nType ) || ( META_POP_ACTION == nType ) ) { - pModAct->Execute( &aMapVDev ); - aOffset = OutputDevice::LogicToLogic( aBaseOffset, GetPrefMapMode(), aMapVDev.GetMapMode() ); + pModAct->Execute( aMapVDev.get() ); + aOffset = OutputDevice::LogicToLogic( aBaseOffset, GetPrefMapMode(), aMapVDev->GetMapMode() ); } pModAct->Move( aOffset.Width(), aOffset.Height() ); @@ -757,11 +757,11 @@ void GDIMetaFile::Move( long nX, long nY, long nDPIX, long nDPIY ) { const Size aBaseOffset( nX, nY ); Size aOffset( aBaseOffset ); - VirtualDevice aMapVDev; + ScopedVclPtrInstance< VirtualDevice > aMapVDev; - aMapVDev.EnableOutput( false ); - aMapVDev.SetReferenceDevice( nDPIX, nDPIY ); - aMapVDev.SetMapMode( GetPrefMapMode() ); + aMapVDev->EnableOutput( false ); + aMapVDev->SetReferenceDevice( nDPIX, nDPIY ); + aMapVDev->SetMapMode( GetPrefMapMode() ); for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() ) { @@ -780,16 +780,16 @@ void GDIMetaFile::Move( long nX, long nY, long nDPIX, long nDPIY ) ( META_PUSH_ACTION == nType ) || ( META_POP_ACTION == nType ) ) { - pModAct->Execute( &aMapVDev ); - if( aMapVDev.GetMapMode().GetMapUnit() == MAP_PIXEL ) + pModAct->Execute( aMapVDev.get() ); + if( aMapVDev->GetMapMode().GetMapUnit() == MAP_PIXEL ) { - aOffset = aMapVDev.LogicToPixel( aBaseOffset, GetPrefMapMode() ); - MapMode aMap( aMapVDev.GetMapMode() ); + aOffset = aMapVDev->LogicToPixel( aBaseOffset, GetPrefMapMode() ); + MapMode aMap( aMapVDev->GetMapMode() ); aOffset.Width() = static_cast<long>(aOffset.Width() * (double)aMap.GetScaleX()); aOffset.Height() = static_cast<long>(aOffset.Height() * (double)aMap.GetScaleY()); } else - aOffset = OutputDevice::LogicToLogic( aBaseOffset, GetPrefMapMode(), aMapVDev.GetMapMode() ); + aOffset = OutputDevice::LogicToLogic( aBaseOffset, GetPrefMapMode(), aMapVDev->GetMapMode() ); } pModAct->Move( aOffset.Width(), aOffset.Height() ); @@ -825,10 +825,10 @@ void GDIMetaFile::Scale( const Fraction& rScaleX, const Fraction& rScaleY ) void GDIMetaFile::Clip( const Rectangle& i_rClipRect ) { Rectangle aCurRect( i_rClipRect ); - VirtualDevice aMapVDev; + ScopedVclPtrInstance< VirtualDevice > aMapVDev; - aMapVDev.EnableOutput( false ); - aMapVDev.SetMapMode( GetPrefMapMode() ); + aMapVDev->EnableOutput( false ); + aMapVDev->SetMapMode( GetPrefMapMode() ); for( MetaAction* pAct = FirstAction(); pAct; pAct = NextAction() ) { @@ -838,8 +838,8 @@ void GDIMetaFile::Clip( const Rectangle& i_rClipRect ) ( META_PUSH_ACTION == nType ) || ( META_POP_ACTION == nType ) ) { - pAct->Execute( &aMapVDev ); - aCurRect = OutputDevice::LogicToLogic( i_rClipRect, GetPrefMapMode(), aMapVDev.GetMapMode() ); + pAct->Execute( aMapVDev.get() ); + aCurRect = OutputDevice::LogicToLogic( i_rClipRect, GetPrefMapMode(), aMapVDev->GetMapMode() ); } else if( nType == META_CLIPREGION_ACTION ) { @@ -892,12 +892,12 @@ void GDIMetaFile::ImplAddGradientEx( GDIMetaFile& rMtf, const Gradient& rGrad ) { // Generate comment, GradientEx and Gradient actions (within DrawGradient) - VirtualDevice aVDev( rMapDev, 0 ); - aVDev.EnableOutput( false ); + ScopedVclPtrInstance< VirtualDevice > aVDev( rMapDev, 0 ); + aVDev->EnableOutput( false ); GDIMetaFile aGradMtf; - aGradMtf.Record( &aVDev ); - aVDev.DrawGradient( rPolyPoly, rGrad ); + aGradMtf.Record( aVDev.get() ); + aVDev->DrawGradient( rPolyPoly, rGrad ); aGradMtf.Stop(); size_t i, nAct( aGradMtf.GetActionSize() ); @@ -917,7 +917,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) if( nAngle10 ) { GDIMetaFile aMtf; - VirtualDevice aMapVDev; + ScopedVclPtrInstance< VirtualDevice > aMapVDev; const double fAngle = F_PI1800 * nAngle10; const double fSin = sin( fAngle ); const double fCos = cos( fAngle ); @@ -926,8 +926,8 @@ void GDIMetaFile::Rotate( long nAngle10 ) aPoly.Rotate( Point(), fSin, fCos ); - aMapVDev.EnableOutput( false ); - aMapVDev.SetMapMode( GetPrefMapMode() ); + aMapVDev->EnableOutput( false ); + aMapVDev->SetMapMode( GetPrefMapMode() ); const Rectangle aNewBound( aPoly.GetBoundRect() ); @@ -1130,7 +1130,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) { MetaGradientAction* pAct = static_cast<MetaGradientAction*>(pAction); - ImplAddGradientEx( aMtf, aMapVDev, + ImplAddGradientEx( aMtf, *aMapVDev.get(), ImplGetRotatedPolygon( pAct->GetRect(), aRotAnchor, aRotOffset, fSin, fCos ), pAct->GetGradient() ); } @@ -1162,7 +1162,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) { // Add rotated gradientex MetaGradientExAction* pAct = static_cast<MetaGradientExAction*>(pAction); - ImplAddGradientEx( aMtf, aMapVDev, + ImplAddGradientEx( aMtf, *aMapVDev.get(), ImplGetRotatedPolyPolygon( pAct->GetPolyPolygon(), aRotAnchor, aRotOffset, fSin, fCos ), pAct->GetGradient() ); } @@ -1225,7 +1225,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) else if ( pCommentAct->GetComment() == "XPATHSTROKE_SEQ_END" || pCommentAct->GetComment() == "XPATHFILL_SEQ_END" ) { - pAction->Execute( &aMapVDev ); + pAction->Execute( aMapVDev.get() ); pAction->Duplicate(); aMtf.AddAction( pAction ); } @@ -1348,7 +1348,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) default: { - pAction->Execute( &aMapVDev ); + pAction->Execute( aMapVDev.get() ); pAction->Duplicate(); aMtf.AddAction( pAction ); @@ -1357,8 +1357,8 @@ void GDIMetaFile::Rotate( long nAngle10 ) ( META_PUSH_ACTION == nActionType ) || ( META_POP_ACTION == nActionType ) ) { - aRotAnchor = OutputDevice::LogicToLogic( aOrigin, aPrefMapMode, aMapVDev.GetMapMode() ); - aRotOffset = OutputDevice::LogicToLogic( aOffset, aPrefMapMode, aMapVDev.GetMapMode() ); + aRotAnchor = OutputDevice::LogicToLogic( aOrigin, aPrefMapMode, aMapVDev->GetMapMode() ); + aRotOffset = OutputDevice::LogicToLogic( aOffset, aPrefMapMode, aMapVDev->GetMapMode() ); } } break; @@ -1400,10 +1400,10 @@ static void ImplActionBounds( Rectangle& o_rOutBounds, Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHairline ) const { GDIMetaFile aMtf; - VirtualDevice aMapVDev( i_rReference ); + ScopedVclPtrInstance< VirtualDevice > aMapVDev( i_rReference ); - aMapVDev.EnableOutput( false ); - aMapVDev.SetMapMode( GetPrefMapMode() ); + aMapVDev->EnableOutput( false ); + aMapVDev->SetMapMode( GetPrefMapMode() ); std::vector<Rectangle> aClipStack( 1, Rectangle() ); std::vector<PushFlags> aPushFlagStack; @@ -1419,7 +1419,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai { MetaAction* pAction = GetAction(a); const sal_uInt16 nActionType = pAction->GetType(); - Rectangle* pUseHairline = (pHairline && aMapVDev.IsLineColor()) ? pHairline : 0; + Rectangle* pUseHairline = (pHairline && aMapVDev->IsLineColor()) ? pHairline : 0; switch( nActionType ) { @@ -1427,8 +1427,8 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai { MetaPixelAction* pAct = static_cast<MetaPixelAction*>(pAction); ImplActionBounds( aBound, - Rectangle( OutputDevice::LogicToLogic( pAct->GetPoint(), aMapVDev.GetMapMode(), GetPrefMapMode() ), - aMapVDev.PixelToLogic( Size( 1, 1 ), GetPrefMapMode() ) ), + Rectangle( OutputDevice::LogicToLogic( pAct->GetPoint(), aMapVDev->GetMapMode(), GetPrefMapMode() ), + aMapVDev->PixelToLogic( Size( 1, 1 ), GetPrefMapMode() ) ), aClipStack, pUseHairline ); } break; @@ -1437,8 +1437,8 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai { MetaPointAction* pAct = static_cast<MetaPointAction*>(pAction); ImplActionBounds( aBound, - Rectangle( OutputDevice::LogicToLogic( pAct->GetPoint(), aMapVDev.GetMapMode(), GetPrefMapMode() ), - aMapVDev.PixelToLogic( Size( 1, 1 ), GetPrefMapMode() ) ), + Rectangle( OutputDevice::LogicToLogic( pAct->GetPoint(), aMapVDev->GetMapMode(), GetPrefMapMode() ), + aMapVDev->PixelToLogic( Size( 1, 1 ), GetPrefMapMode() ) ), aClipStack, pUseHairline ); } break; @@ -1458,28 +1458,28 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai pUseHairline = 0; } - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); } break; case( META_RECT_ACTION ): { MetaRectAction* pAct = static_cast<MetaRectAction*>(pAction); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); } break; case( META_ROUNDRECT_ACTION ): { MetaRoundRectAction* pAct = static_cast<MetaRoundRectAction*>(pAction); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); } break; case( META_ELLIPSE_ACTION ): { MetaEllipseAction* pAct = static_cast<MetaEllipseAction*>(pAction); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); } break; @@ -1488,7 +1488,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai MetaArcAction* pAct = static_cast<MetaArcAction*>(pAction); // FIXME: this is imprecise // e.g. for small arcs the whole rectangle is WAY too large - ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); } break; @@ -1497,7 +1497,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai MetaPieAction* pAct = static_cast<MetaPieAction*>(pAction); // FIXME: this is imprecise // e.g. for small arcs the whole rectangle is WAY too large - ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); } break; @@ -1506,7 +1506,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai MetaChordAction* pAct = static_cast<MetaChordAction*>(pAction); // FIXME: this is imprecise // e.g. for small arcs the whole rectangle is WAY too large - ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); } break; @@ -1523,7 +1523,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai pUseHairline = 0; } - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); } break; @@ -1531,7 +1531,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai { MetaPolygonAction* pAct = static_cast<MetaPolygonAction*>(pAction); Rectangle aRect( pAct->GetPolygon().GetBoundRect() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); } break; @@ -1539,7 +1539,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai { MetaPolyPolygonAction* pAct = static_cast<MetaPolyPolygonAction*>(pAction); Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); } break; @@ -1548,10 +1548,10 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai MetaTextAction* pAct = static_cast<MetaTextAction*>(pAction); Rectangle aRect; // hdu said base = index - aMapVDev.GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen() ); + aMapVDev->GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen() ); Point aPt( pAct->GetPoint() ); aRect.Move( aPt.X(), aPt.Y() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; @@ -1560,11 +1560,11 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai MetaTextArrayAction* pAct = static_cast<MetaTextArrayAction*>(pAction); Rectangle aRect; // hdu said base = index - aMapVDev.GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen(), + aMapVDev->GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen(), 0, pAct->GetDXArray() ); Point aPt( pAct->GetPoint() ); aRect.Move( aPt.X(), aPt.Y() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; @@ -1573,11 +1573,11 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai MetaStretchTextAction* pAct = static_cast<MetaStretchTextAction*>(pAction); Rectangle aRect; // hdu said base = index - aMapVDev.GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen(), + aMapVDev->GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen(), pAct->GetWidth(), NULL ); Point aPt( pAct->GetPoint() ); aRect.Move( aPt.X(), aPt.Y() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; @@ -1589,11 +1589,11 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai OUString aStr( pStr ); Rectangle aRect; - aMapVDev.GetTextBoundRect( aRect, aStr, 0, 0, aStr.getLength(), 0, NULL ); + aMapVDev->GetTextBoundRect( aRect, aStr, 0, 0, aStr.getLength(), 0, NULL ); Point aPt( pAct->GetStartPoint() ); aRect.Move( aPt.X(), aPt.Y() ); aRect.Right() = aRect.Left() + pAct->GetWidth(); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; @@ -1601,7 +1601,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai { MetaBmpScaleAction* pAct = static_cast<MetaBmpScaleAction*>(pAction); Rectangle aRect( pAct->GetPoint(), pAct->GetSize() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; @@ -1609,7 +1609,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai { MetaBmpScalePartAction* pAct = static_cast<MetaBmpScalePartAction*>(pAction); Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; @@ -1617,7 +1617,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai { MetaBmpExScaleAction* pAct = static_cast<MetaBmpExScaleAction*>(pAction); Rectangle aRect( pAct->GetPoint(), pAct->GetSize() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; @@ -1625,7 +1625,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai { MetaBmpExScalePartAction* pAct = static_cast<MetaBmpExScalePartAction*>(pAction); Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; @@ -1633,7 +1633,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai { MetaGradientAction* pAct = static_cast<MetaGradientAction*>(pAction); Rectangle aRect( pAct->GetRect() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; @@ -1641,7 +1641,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai { MetaGradientExAction* pAct = static_cast<MetaGradientExAction*>(pAction); Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; @@ -1655,7 +1655,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai { MetaHatchAction* pAct = static_cast<MetaHatchAction*>(pAction); Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; @@ -1663,7 +1663,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai { MetaTransparentAction* pAct = static_cast<MetaTransparentAction*>(pAction); Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; @@ -1673,7 +1673,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai // MetaFloatTransparentAction is defined limiting it's content Metafile // to it's geometry definition(Point, Size), so use these directly const Rectangle aRect( pAct->GetPoint(), pAct->GetSize() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; @@ -1681,7 +1681,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai { MetaEPSAction* pAct = static_cast<MetaEPSAction*>(pAction); Rectangle aRect( pAct->GetPoint(), pAct->GetSize() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; @@ -1689,7 +1689,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai { MetaClipRegionAction* pAct = static_cast<MetaClipRegionAction*>(pAction); if( pAct->IsClipping() ) - aClipStack.back() = OutputDevice::LogicToLogic( pAct->GetRegion().GetBoundRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ); + aClipStack.back() = OutputDevice::LogicToLogic( pAct->GetRegion().GetBoundRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ); else aClipStack.back() = Rectangle(); } @@ -1698,7 +1698,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai case( META_ISECTRECTCLIPREGION_ACTION ): { MetaISectRectClipRegionAction* pAct = static_cast<MetaISectRectClipRegionAction*>(pAction); - Rectangle aRect( OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ) ); + Rectangle aRect( OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ) ); if( aClipStack.back().IsEmpty() ) aClipStack.back() = aRect; else @@ -1709,7 +1709,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai case( META_ISECTREGIONCLIPREGION_ACTION ): { MetaISectRegionClipRegionAction* pAct = static_cast<MetaISectRegionClipRegionAction*>(pAction); - Rectangle aRect( OutputDevice::LogicToLogic( pAct->GetRegion().GetBoundRect(), aMapVDev.GetMapMode(), GetPrefMapMode() ) ); + Rectangle aRect( OutputDevice::LogicToLogic( pAct->GetRegion().GetBoundRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ) ); if( aClipStack.back().IsEmpty() ) aClipStack.back() = aRect; else @@ -1720,24 +1720,24 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai case( META_BMP_ACTION ): { MetaBmpAction* pAct = static_cast<MetaBmpAction*>(pAction); - Rectangle aRect( pAct->GetPoint(), aMapVDev.PixelToLogic( pAct->GetBitmap().GetSizePixel() ) ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + Rectangle aRect( pAct->GetPoint(), aMapVDev->PixelToLogic( pAct->GetBitmap().GetSizePixel() ) ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; case( META_BMPEX_ACTION ): { MetaBmpExAction* pAct = static_cast<MetaBmpExAction*>(pAction); - Rectangle aRect( pAct->GetPoint(), aMapVDev.PixelToLogic( pAct->GetBitmapEx().GetSizePixel() ) ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + Rectangle aRect( pAct->GetPoint(), aMapVDev->PixelToLogic( pAct->GetBitmapEx().GetSizePixel() ) ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; case( META_MASK_ACTION ): { MetaMaskAction* pAct = static_cast<MetaMaskAction*>(pAction); - Rectangle aRect( pAct->GetPoint(), aMapVDev.PixelToLogic( pAct->GetBitmap().GetSizePixel() ) ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + Rectangle aRect( pAct->GetPoint(), aMapVDev->PixelToLogic( pAct->GetBitmap().GetSizePixel() ) ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; @@ -1745,7 +1745,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai { MetaMaskScalePartAction* pAct = static_cast<MetaMaskScalePartAction*>(pAction); Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; @@ -1753,7 +1753,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai { MetaMaskScalePartAction* pAct = static_cast<MetaMaskScalePartAction*>(pAction); Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; @@ -1761,7 +1761,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai { MetaWallpaperAction* pAct = static_cast<MetaWallpaperAction*>(pAction); Rectangle aRect( pAct->GetRect() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; @@ -1769,7 +1769,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai { MetaTextRectAction* pAct = static_cast<MetaTextRectAction*>(pAction); Rectangle aRect( pAct->GetRect() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev.GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, 0 ); } break; @@ -1779,7 +1779,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai if( ! aClipStack.back().IsEmpty() ) { Size aDelta( pAct->GetHorzMove(), pAct->GetVertMove() ); - aDelta = OutputDevice::LogicToLogic( aDelta, aMapVDev.GetMapMode(), GetPrefMapMode() ); + aDelta = OutputDevice::LogicToLogic( aDelta, aMapVDev->GetMapMode(), GetPrefMapMode() ); aClipStack.back().Move( aDelta.Width(), aDelta.Width() ); } } @@ -1787,7 +1787,7 @@ Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHai default: { - pAction->Execute( &aMapVDev ); + pAction->Execute( aMapVDev.get() ); if( nActionType == META_PUSH_ACTION ) { @@ -2890,11 +2890,11 @@ SvStream& GDIMetaFile::Write( SvStream& rOStm ) bool GDIMetaFile::CreateThumbnail(BitmapEx& rBitmapEx, sal_uInt32 nMaximumExtent, BmpConversion eColorConversion, long nScaleFlag) const { // initialization seems to be complicated but is used to avoid rounding errors - VirtualDevice aVDev; + ScopedVclPtrInstance< VirtualDevice > aVDev; const Point aNullPt; - const Point aTLPix( aVDev.LogicToPixel( aNullPt, GetPrefMapMode() ) ); - const Point aBRPix( aVDev.LogicToPixel( Point( GetPrefSize().Width() - 1, GetPrefSize().Height() - 1 ), GetPrefMapMode() ) ); - Size aDrawSize( aVDev.LogicToPixel( GetPrefSize(), GetPrefMapMode() ) ); + const Point aTLPix( aVDev->LogicToPixel( aNullPt, GetPrefMapMode() ) ); + const Point aBRPix( aVDev->LogicToPixel( Point( GetPrefSize().Width() - 1, GetPrefSize().Height() - 1 ), GetPrefMapMode() ) ); + Size aDrawSize( aVDev->LogicToPixel( GetPrefSize(), GetPrefMapMode() ) ); Size aSizePix( labs( aBRPix.X() - aTLPix.X() ) + 1, labs( aBRPix.Y() - aTLPix.Y() ) + 1 ); if (!rBitmapEx.IsEmpty()) @@ -2929,7 +2929,7 @@ bool GDIMetaFile::CreateThumbnail(BitmapEx& rBitmapEx, sal_uInt32 nMaximumExtent // draw image(s) into VDev and get resulting image // do it 4x larger to be able to scale it down & get beautiful antialias Size aAntialiasSize(aSizePix.Width() * 4, aSizePix.Height() * 4); - if (aVDev.SetOutputSizePixel(aAntialiasSize)) + if (aVDev->SetOutputSizePixel(aAntialiasSize)) { // antialias: provide 4x larger size, and then scale down the result Size aAntialias(aDrawSize.Width() * 4, aDrawSize.Height() * 4); @@ -2937,10 +2937,10 @@ bool GDIMetaFile::CreateThumbnail(BitmapEx& rBitmapEx, sal_uInt32 nMaximumExtent // draw metafile into VDev Point aBackPosPix; const_cast<GDIMetaFile *>(this)->WindStart(); - const_cast<GDIMetaFile *>(this)->Play(&aVDev, aBackPosPix, aAntialias); + const_cast<GDIMetaFile *>(this)->Play(aVDev.get(), aBackPosPix, aAntialias); // get paint bitmap - Bitmap aBitmap( aVDev.GetBitmap( aNullPt, aVDev.GetOutputSizePixel() ) ); + Bitmap aBitmap( aVDev->GetBitmap( aNullPt, aVDev->GetOutputSizePixel() ) ); // scale down the image to the desired size - use the input scaler for the scaling operation aBitmap.Scale(aDrawSize, nScaleFlag); diff --git a/vcl/source/gdi/impanmvw.cxx b/vcl/source/gdi/impanmvw.cxx index c3e7b793580c..b225280a6102 100644 --- a/vcl/source/gdi/impanmvw.cxx +++ b/vcl/source/gdi/impanmvw.cxx @@ -77,7 +77,7 @@ ImplAnimView::ImplAnimView( Animation* pParent, OutputDevice* pOut, MapMode aTempMap( mpOut->GetMapMode() ); aTempMap.SetOrigin( Point() ); mpBackground->SetMapMode( aTempMap ); - static_cast<vcl::Window*>( mpOut )->SaveBackground( maDispPt, maDispSz, Point(), *mpBackground ); + static_cast<vcl::Window*>( mpOut.get() )->SaveBackground( maDispPt, maDispSz, Point(), *mpBackground ); mpBackground->SetMapMode( MapMode() ); } else @@ -93,8 +93,8 @@ ImplAnimView::ImplAnimView( Animation* pParent, OutputDevice* pOut, ImplAnimView::~ImplAnimView() { - delete mpBackground; - delete mpRestore; + mpBackground.disposeAndClear(); + mpRestore.disposeAndClear(); Animation::ImplDecAnimCount(); } @@ -153,19 +153,19 @@ void ImplAnimView::getPosSize( const AnimationBitmap& rAnm, Point& rPosPix, Size void ImplAnimView::drawToPos( sal_uLong nPos ) { - VirtualDevice aVDev; + ScopedVclPtrInstance<VirtualDevice> aVDev; std::unique_ptr<vcl::Region> xOldClip(!maClip.IsNull() ? new vcl::Region( mpOut->GetClipRegion() ) : NULL); - aVDev.SetOutputSizePixel( maSzPix, false ); + aVDev->SetOutputSizePixel( maSzPix, false ); nPos = std::min( nPos, (sal_uLong) mpParent->Count() - 1UL ); for( sal_uLong i = 0UL; i <= nPos; i++ ) - draw( i, &aVDev ); + draw( i, aVDev.get() ); if (xOldClip) mpOut->SetClipRegion( maClip ); - mpOut->DrawOutDev( maDispPt, maDispSz, Point(), maSzPix, aVDev ); + mpOut->DrawOutDev( maDispPt, maDispSz, Point(), maSzPix, *aVDev.get() ); if (xOldClip) mpOut->SetClipRegion(*xOldClip); @@ -180,7 +180,7 @@ void ImplAnimView::draw( sal_uLong nPos, VirtualDevice* pVDev ) setMarked( true ); else if( !mbPause ) { - VirtualDevice* pDev; + VclPtr<VirtualDevice> pDev; Point aPosPix; Point aBmpPosPix; Size aSizePix; @@ -273,10 +273,10 @@ void ImplAnimView::draw( sal_uLong nPos, VirtualDevice* pVDev ) xOldClip.reset(); } - delete pDev; + pDev.disposeAndClear(); if( mpOut->GetOutDevType() == OUTDEV_WINDOW ) - static_cast<vcl::Window*>( mpOut )->Sync(); + static_cast<vcl::Window*>( mpOut.get() )->Sync(); } } } @@ -290,7 +290,7 @@ void ImplAnimView::repaint() MapMode aTempMap( mpOut->GetMapMode() ); aTempMap.SetOrigin( Point() ); mpBackground->SetMapMode( aTempMap ); - static_cast<vcl::Window*>( mpOut )->SaveBackground( maDispPt, maDispSz, Point(), *mpBackground ); + static_cast<vcl::Window*>( mpOut.get() )->SaveBackground( maDispPt, maDispSz, Point(), *mpBackground ); mpBackground->SetMapMode( MapMode() ); } else diff --git a/vcl/source/gdi/impanmvw.hxx b/vcl/source/gdi/impanmvw.hxx index ce49476e0718..0955046d7f30 100644 --- a/vcl/source/gdi/impanmvw.hxx +++ b/vcl/source/gdi/impanmvw.hxx @@ -34,7 +34,7 @@ private: friend class Animation; Animation* mpParent; - OutputDevice* mpOut; + VclPtr<OutputDevice> mpOut; long mnExtraData; Point maPt; Point maDispPt; @@ -45,8 +45,8 @@ private: Size maRestSz; MapMode maMap; vcl::Region maClip; - VirtualDevice* mpBackground; - VirtualDevice* mpRestore; + VclPtr<VirtualDevice> mpBackground; + VclPtr<VirtualDevice> mpRestore; sal_uLong mnActPos; Disposal meLastDisposal; bool mbPause; diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 3f65281a7163..0aace4e88651 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -467,8 +467,8 @@ Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters) if(maEx.IsEmpty()) { // calculate size - VirtualDevice aVDev; - Size aDrawSize(aVDev.LogicToPixel(maMetaFile.GetPrefSize(), maMetaFile.GetPrefMapMode())); + ScopedVclPtrInstance< VirtualDevice > aVDev; + Size aDrawSize(aVDev->LogicToPixel(maMetaFile.GetPrefSize(), maMetaFile.GetPrefMapMode())); if(rParameters.getSizePixel().Width() && rParameters.getSizePixel().Height()) { @@ -502,7 +502,7 @@ Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters) { // get hairline and full bound rect Rectangle aHairlineRect; - const Rectangle aRect(maMetaFile.GetBoundRect(aVDev, &aHairlineRect)); + const Rectangle aRect(maMetaFile.GetBoundRect(*aVDev.get(), &aHairlineRect)); if(!aRect.IsEmpty() && !aHairlineRect.IsEmpty()) { @@ -519,22 +519,22 @@ Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters) } } - if(aVDev.SetOutputSizePixel(aPixelSize)) + if(aVDev->SetOutputSizePixel(aPixelSize)) { if(rParameters.getAntiAliase()) { - aVDev.SetAntialiasing(aVDev.GetAntialiasing() | ANTIALIASING_ENABLE_B2DDRAW); + aVDev->SetAntialiasing(aVDev->GetAntialiasing() | ANTIALIASING_ENABLE_B2DDRAW); } if(rParameters.getSnapHorVerLines()) { - aVDev.SetAntialiasing(aVDev.GetAntialiasing() | ANTIALIASING_PIXELSNAPHAIRLINE); + aVDev->SetAntialiasing(aVDev->GetAntialiasing() | ANTIALIASING_PIXELSNAPHAIRLINE); } - ImplDraw( &aVDev, Point(), aDrawSize ); + ImplDraw( aVDev.get(), Point(), aDrawSize ); // use maEx as local buffer for rendered metafile - const_cast< ImpGraphic* >(this)->maEx = aVDev.GetBitmap( Point(), aVDev.GetOutputSizePixel() ); + const_cast< ImpGraphic* >(this)->maEx = aVDev->GetBitmap( Point(), aVDev->GetOutputSizePixel() ); } } diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx index 9a71a241fd65..bdb5f3114eeb 100644 --- a/vcl/source/gdi/impvect.cxx +++ b/vcl/source/gdi/impvect.cxx @@ -717,8 +717,8 @@ bool ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf, if( rMtf.GetActionSize() ) { MapMode aMap( MAP_100TH_MM ); - VirtualDevice aVDev; - const Size aLogSize1( aVDev.PixelToLogic( Size( 1, 1 ), aMap ) ); + ScopedVclPtrInstance< VirtualDevice > aVDev; + const Size aLogSize1( aVDev->PixelToLogic( Size( 1, 1 ), aMap ) ); rMtf.SetPrefMapMode( aMap ); rMtf.SetPrefSize( Size( nWidth + 2, nHeight + 2 ) ); diff --git a/vcl/source/gdi/oldprintadaptor.cxx b/vcl/source/gdi/oldprintadaptor.cxx index b1485a945f00..b71d9dd15654 100644 --- a/vcl/source/gdi/oldprintadaptor.cxx +++ b/vcl/source/gdi/oldprintadaptor.cxx @@ -44,8 +44,8 @@ using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::beans; -OldStylePrintAdaptor::OldStylePrintAdaptor(const std::shared_ptr< Printer >& i_xPrinter) - : PrinterController(i_xPrinter) +OldStylePrintAdaptor::OldStylePrintAdaptor( const VclPtr< Printer >& i_xPrinter ) + : PrinterController( i_xPrinter ) , mpData( new ImplOldStyleAdaptorData() ) { } @@ -64,7 +64,7 @@ void OldStylePrintAdaptor::StartPage() getPrinter()->SetConnectMetaFile( &mpData->maPages.back().maPage ); // copy state into metafile - std::shared_ptr<Printer> xPrinter(getPrinter()); + VclPtr<Printer> xPrinter( getPrinter() ); xPrinter->SetMapMode(xPrinter->GetMapMode()); xPrinter->SetFont(xPrinter->GetFont()); xPrinter->SetDrawMode(xPrinter->GetDrawMode()); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 2a4166f4b951..9ed2d19e1644 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -1874,7 +1874,7 @@ PDFWriterImpl::~PDFWriterImpl() { if( m_aDocDigest ) rtl_digest_destroyMD5( m_aDocDigest ); - delete static_cast<VirtualDevice*>(m_pReferenceDevice); + m_pReferenceDevice.disposeAndClear(); if( m_aCipher ) rtl_cipher_destroyARCFOUR( m_aCipher ); @@ -2220,7 +2220,7 @@ OutputDevice* PDFWriterImpl::getReferenceDevice() { if( ! m_pReferenceDevice ) { - VirtualDevice* pVDev = new VirtualDevice( 0 ); + VclPtrInstance<VirtualDevice> pVDev( 0 ); m_pReferenceDevice = pVDev; @@ -10938,16 +10938,16 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject ) sal_Int32 nFunctionObject = createObject(); CHECK_RETURN( updateObject( nFunctionObject ) ); - VirtualDevice aDev; - aDev.SetOutputSizePixel( rObject.m_aSize ); - aDev.SetMapMode( MapMode( MAP_PIXEL ) ); + ScopedVclPtrInstance< VirtualDevice > aDev; + aDev->SetOutputSizePixel( rObject.m_aSize ); + aDev->SetMapMode( MapMode( MAP_PIXEL ) ); if( m_aContext.ColorMode == PDFWriter::DrawGreyscale ) - aDev.SetDrawMode( aDev.GetDrawMode() | + aDev->SetDrawMode( aDev->GetDrawMode() | ( DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_GRAYTEXT | DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT ) ); - aDev.DrawGradient( Rectangle( Point( 0, 0 ), rObject.m_aSize ), rObject.m_aGradient ); + aDev->DrawGradient( Rectangle( Point( 0, 0 ), rObject.m_aSize ), rObject.m_aGradient ); - Bitmap aSample = aDev.GetBitmap( Point( 0, 0 ), rObject.m_aSize ); + Bitmap aSample = aDev->GetBitmap( Point( 0, 0 ), rObject.m_aSize ); BitmapReadAccess* pAccess = aSample.AcquireReadAccess(); AccessReleaser aReleaser( pAccess ); diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 1f2ac6b1558a..60e12f58786b 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -590,7 +590,7 @@ public: private: static const BuiltinFont m_aBuiltinFonts[14]; - OutputDevice* m_pReferenceDevice; + VclPtr<OutputDevice> m_pReferenceDevice; MapMode m_aMapMode; // PDFWriterImpl scaled units std::vector< PDFPage > m_aPages; diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index e6bd287f6393..09c8d1b27997 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -244,10 +244,10 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa { bool bAssertionFired( false ); - std::unique_ptr<VirtualDevice> xPrivateDevice; + ScopedVclPtr<VirtualDevice> xPrivateDevice; if( ! pDummyVDev ) { - xPrivateDevice.reset(new VirtualDevice()); + xPrivateDevice.reset(VclPtr<VirtualDevice>::Create()); pDummyVDev = xPrivateDevice.get(); pDummyVDev->EnableOutput( false ); pDummyVDev->SetMapMode( i_rMtf.GetPrefMapMode() ); @@ -431,7 +431,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa if ( nPixelX && nPixelY ) { Size aDstSizePixel( nPixelX, nPixelY ); - std::unique_ptr<VirtualDevice> xVDev(new VirtualDevice); + ScopedVclPtrInstance<VirtualDevice> xVDev; if( xVDev->SetOutputSizePixel( aDstSizePixel ) ) { Bitmap aPaint, aMask; diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index e96e14bc9c68..10d27223d22e 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -792,9 +792,9 @@ void Printer::ImplInitDisplay( const vcl::Window* pWindow ) mpJobGraphics = NULL; if ( pWindow ) - mpDisplayDev = new VirtualDevice( *pWindow ); + mpDisplayDev = VclPtr<VirtualDevice>::Create( *pWindow ); else - mpDisplayDev = new VirtualDevice(); + mpDisplayDev = VclPtr<VirtualDevice>::Create(); mpFontCollection = pSVData->maGDIData.mpScreenFontList; mpFontCache = pSVData->maGDIData.mpScreenFontCache; mnDPIX = mpDisplayDev->mnDPIX; @@ -1015,16 +1015,22 @@ Printer::Printer( const OUString& rPrinterName ) Printer::~Printer() { + disposeOnce(); +} + +void Printer::dispose() +{ DBG_ASSERT( !IsPrinting(), "Printer::~Printer() - Job is printing" ); DBG_ASSERT( !IsJobActive(), "Printer::~Printer() - Job is active" ); delete mpPrinterOptions; + mpPrinterOptions = NULL; ReleaseGraphics(); if ( mpInfoPrinter ) ImplGetSVData()->mpDefInst->DestroyInfoPrinter( mpInfoPrinter ); if ( mpDisplayDev ) - delete mpDisplayDev; + mpDisplayDev.disposeAndClear(); else { // OutputDevice Dtor is tryig the same thing; that why we need to set @@ -1060,6 +1066,10 @@ Printer::~Printer() mpNext->mpPrev = mpPrev; else pSVData->maGDIData.mpLastPrinter = mpPrev; + + mpPrev.clear(); + mpNext.clear(); + OutputDevice::dispose(); } sal_uLong Printer::GetCapabilities( sal_uInt16 nType ) const @@ -1215,8 +1225,7 @@ bool Printer::SetPrinterProps( const Printer* pPrinter ) ReleaseGraphics(); if ( mpDisplayDev ) { - delete mpDisplayDev; - mpDisplayDev = NULL; + mpDisplayDev.disposeAndClear(); } else { diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index 4b5a2f1505b9..c8470ac55d09 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -728,10 +728,10 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, ConnectedComponents aBackgroundComponent; // create an OutputDevice to record mapmode changes and the like - VirtualDevice aMapModeVDev; - aMapModeVDev.mnDPIX = mnDPIX; - aMapModeVDev.mnDPIY = mnDPIY; - aMapModeVDev.EnableOutput(false); + ScopedVclPtrInstance< VirtualDevice > aMapModeVDev; + aMapModeVDev->mnDPIX = mnDPIX; + aMapModeVDev->mnDPIY = mnDPIY; + aMapModeVDev->EnableOutput(false); int nLastBgAction, nActionNum; @@ -766,7 +766,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, aBackgroundComponent.aBounds, aBackgroundComponent.aBgColor, static_cast<const MetaRectAction*>(pCurrAct)->GetRect(), - aMapModeVDev) ) + *aMapModeVDev.get()) ) bStillBackground=false; // incomplete occlusion of background else nLastBgAction=nActionNum; // this _is_ background @@ -782,7 +782,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, aBackgroundComponent.aBounds, aBackgroundComponent.aBgColor, aPoly.GetBoundRect(), - aMapModeVDev) ) + *aMapModeVDev.get()) ) bStillBackground=false; // incomplete occlusion of background else nLastBgAction=nActionNum; // this _is_ background @@ -799,7 +799,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, aBackgroundComponent.aBounds, aBackgroundComponent.aBgColor, aPoly.GetBoundRect(), - aMapModeVDev) ) + *aMapModeVDev.get()) ) bStillBackground=false; // incomplete occlusion of background else nLastBgAction=nActionNum; // this _is_ background @@ -811,7 +811,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, aBackgroundComponent.aBounds, aBackgroundComponent.aBgColor, static_cast<const MetaWallpaperAction*>(pCurrAct)->GetRect(), - aMapModeVDev) ) + *aMapModeVDev.get()) ) bStillBackground=false; // incomplete occlusion of background else nLastBgAction=nActionNum; // this _is_ background @@ -820,29 +820,29 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, default: { if( ImplIsNotTransparent( *pCurrAct, - aMapModeVDev ) ) + *aMapModeVDev.get() ) ) bStillBackground=false; // non-transparent action, possibly // not uniform else // extend current bounds (next uniform action // needs to fully cover this area) aBackgroundComponent.aBounds.Union( - ImplCalcActionBounds(*pCurrAct, aMapModeVDev) ); + ImplCalcActionBounds(*pCurrAct, *aMapModeVDev.get()) ); break; } } // execute action to get correct MapModes etc. - pCurrAct->Execute( &aMapModeVDev ); + pCurrAct->Execute( aMapModeVDev.get() ); pCurrAct=const_cast<GDIMetaFile&>(rInMtf).NextAction(); ++nActionNum; } // clean up aMapModeVDev - sal_uInt32 nCount = aMapModeVDev.GetGCStackDepth(); + sal_uInt32 nCount = aMapModeVDev->GetGCStackDepth(); while( nCount-- ) - aMapModeVDev.Pop(); + aMapModeVDev->Pop(); ConnectedComponentsList aCCList; // list containing distinct sets of connected components as elements. @@ -859,7 +859,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, pCurrAct, nActionNum) ); // execute action to get correct MapModes etc. - pCurrAct->Execute( &aMapModeVDev ); + pCurrAct->Execute( aMapModeVDev.get() ); pCurrAct=const_cast<GDIMetaFile&>(rInMtf).NextAction(); ++nActionNum; } @@ -873,10 +873,10 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, pCurrAct=const_cast<GDIMetaFile&>(rInMtf).NextAction(), ++nActionNum ) { // execute action to get correct MapModes etc. - pCurrAct->Execute( &aMapModeVDev ); + pCurrAct->Execute( aMapModeVDev.get() ); // cache bounds of current action - const Rectangle aBBCurrAct( ImplCalcActionBounds(*pCurrAct, aMapModeVDev) ); + const Rectangle aBBCurrAct( ImplCalcActionBounds(*pCurrAct, *aMapModeVDev.get()) ); // accumulate collected bounds here, initialize with current action Rectangle aTotalBounds( aBBCurrAct ); // thus, @@ -902,7 +902,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, // not be considered for connected components, // too. Just put each of them into a separate // component. - aTotalComponents.bIsFullyTransparent = !ImplIsNotTransparent(*pCurrAct, aMapModeVDev); + aTotalComponents.bIsFullyTransparent = !ImplIsNotTransparent(*pCurrAct, *aMapModeVDev.get()); if( !aBBCurrAct.IsEmpty() && !aTotalComponents.bIsFullyTransparent ) @@ -1155,16 +1155,16 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, Point aDstPtPix( aBoundRect.TopLeft() ); Size aDstSzPix; - VirtualDevice aMapVDev; // here, we record only mapmode information - aMapVDev.EnableOutput(false); + ScopedVclPtrInstance<VirtualDevice> aMapVDev; // here, we record only mapmode information + aMapVDev->EnableOutput(false); - VirtualDevice aPaintVDev; // into this one, we render. - aPaintVDev.SetBackground( aBackgroundComponent.aBgColor ); + ScopedVclPtrInstance<VirtualDevice> aPaintVDev; // into this one, we render. + aPaintVDev->SetBackground( aBackgroundComponent.aBgColor ); rOutMtf.AddAction( new MetaPushAction( PushFlags::MAPMODE ) ); rOutMtf.AddAction( new MetaMapModeAction() ); - aPaintVDev.SetDrawMode( GetDrawMode() ); + aPaintVDev->SetDrawMode( GetDrawMode() ); while( aDstPtPix.Y() <= aBoundRect.Bottom() ) { @@ -1180,15 +1180,15 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, aDstSzPix.Width() = aBoundRect.Right() - aDstPtPix.X() + 1L; if( !Rectangle( aDstPtPix, aDstSzPix ).Intersection( aBoundRect ).IsEmpty() && - aPaintVDev.SetOutputSizePixel( aDstSzPix ) ) + aPaintVDev->SetOutputSizePixel( aDstSzPix ) ) { - aPaintVDev.Push(); - aMapVDev.Push(); + aPaintVDev->Push(); + aMapVDev->Push(); - aMapVDev.mnDPIX = aPaintVDev.mnDPIX = mnDPIX; - aMapVDev.mnDPIY = aPaintVDev.mnDPIY = mnDPIY; + aMapVDev->mnDPIX = aPaintVDev->mnDPIX = mnDPIX; + aMapVDev->mnDPIY = aPaintVDev->mnDPIY = mnDPIY; - aPaintVDev.EnableOutput(false); + aPaintVDev->EnableOutput(false); // iterate over all actions for( pCurrAct=const_cast<GDIMetaFile&>(rInMtf).FirstAction(), nActionNum=0; @@ -1200,38 +1200,38 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, // the current aCCList element // (aCurr) if( aCCList_MemberMap[nActionNum] == &(*aCurr) ) - aPaintVDev.EnableOutput(true); + aPaintVDev->EnableOutput(true); // but process every action const sal_uInt16 nType( pCurrAct->GetType() ); if( META_MAPMODE_ACTION == nType ) { - pCurrAct->Execute( &aMapVDev ); + pCurrAct->Execute( aMapVDev.get() ); - MapMode aMtfMap( aMapVDev.GetMapMode() ); - const Point aNewOrg( aMapVDev.PixelToLogic( aDstPtPix ) ); + MapMode aMtfMap( aMapVDev->GetMapMode() ); + const Point aNewOrg( aMapVDev->PixelToLogic( aDstPtPix ) ); aMtfMap.SetOrigin( Point( -aNewOrg.X(), -aNewOrg.Y() ) ); - aPaintVDev.SetMapMode( aMtfMap ); + aPaintVDev->SetMapMode( aMtfMap ); } else if( ( META_PUSH_ACTION == nType ) || ( META_POP_ACTION ) == nType ) { - pCurrAct->Execute( &aMapVDev ); - pCurrAct->Execute( &aPaintVDev ); + pCurrAct->Execute( aMapVDev.get() ); + pCurrAct->Execute( aPaintVDev.get() ); } else if( META_GRADIENT_ACTION == nType ) { MetaGradientAction* pGradientAction = static_cast<MetaGradientAction*>(pCurrAct); Printer* pPrinter = dynamic_cast< Printer* >(this); if( pPrinter ) - pPrinter->DrawGradientEx( &aPaintVDev, pGradientAction->GetRect(), pGradientAction->GetGradient() ); + pPrinter->DrawGradientEx( aPaintVDev.get(), pGradientAction->GetRect(), pGradientAction->GetGradient() ); else DrawGradient( pGradientAction->GetRect(), pGradientAction->GetGradient() ); } else { - pCurrAct->Execute( &aPaintVDev ); + pCurrAct->Execute( aPaintVDev.get() ); } if( !( nActionNum % 8 ) ) @@ -1239,9 +1239,9 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, } const bool bOldMap = mbMap; - mbMap = aPaintVDev.mbMap = false; + mbMap = aPaintVDev->mbMap = false; - Bitmap aBandBmp( aPaintVDev.GetBitmap( Point(), aDstSzPix ) ); + Bitmap aBandBmp( aPaintVDev->GetBitmap( Point(), aDstSzPix ) ); // scale down bitmap, if requested if( bDownsampleBitmaps ) @@ -1255,10 +1255,10 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, rOutMtf.AddAction( new MetaBmpScaleAction( aDstPtPix, aDstSzPix, aBandBmp ) ); rOutMtf.AddAction( new MetaCommentAction( "PRNSPOOL_TRANSPARENTBITMAP_END" ) ); - aPaintVDev.mbMap = true; + aPaintVDev->mbMap = true; mbMap = bOldMap; - aMapVDev.Pop(); - aPaintVDev.Pop(); + aMapVDev->Pop(); + aPaintVDev->Pop(); } // overlapping bands to avoid missing lines (e.g. PostScript) @@ -1276,9 +1276,9 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, } // clean up aMapModeVDev - nCount = aMapModeVDev.GetGCStackDepth(); + nCount = aMapModeVDev->GetGCStackDepth(); while( nCount-- ) - aMapModeVDev.Pop(); + aMapModeVDev->Pop(); // STAGE 4: Copy actions to output metafile @@ -1309,7 +1309,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, // given background color ImplConvertTransparentAction(rOutMtf, *pCurrAct, - aMapModeVDev, + *aMapModeVDev.get(), aBackgroundComponent.aBgColor); } else @@ -1318,7 +1318,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, rOutMtf.AddAction( ( pCurrAct->Duplicate(), pCurrAct ) ); } - pCurrAct->Execute(&aMapModeVDev); + pCurrAct->Execute(aMapModeVDev.get()); } } @@ -1335,7 +1335,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, else rOutMtf.AddAction( new MetaLineColorAction( COL_BLUE, true) ); - rOutMtf.AddAction( new MetaRectAction( aMapModeVDev.PixelToLogic( aCurr->aBounds ) ) ); + rOutMtf.AddAction( new MetaRectAction( aMapModeVDev->PixelToLogic( aCurr->aBounds ) ) ); } #endif } diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 543ab88ad245..bf5c5eef4ae8 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -140,7 +140,7 @@ public: typedef std::unordered_map< OUString, ControlDependency, OUStringHash > ControlDependencyMap; typedef std::unordered_map< OUString, Sequence< sal_Bool >, OUStringHash > ChoiceDisableMap; - std::shared_ptr<Printer> mxPrinter; + VclPtr< Printer > mxPrinter; Sequence< PropertyValue > maUIOptions; std::vector< PropertyValue > maUIProperties; std::vector< bool > maUIPropertyEnabled; @@ -156,7 +156,7 @@ public: vcl::PrinterController::MultiPageSetup maMultiPage; - vcl::PrintProgressDialog* mpProgress; + VclPtr<vcl::PrintProgressDialog> mpProgress; ImplPageCache maPageCache; @@ -191,7 +191,7 @@ public: mnDefaultPaperBin( -1 ), mnFixedPaperBin( -1 ) {} - ~ImplPrinterControllerData() { delete mpProgress; } + ~ImplPrinterControllerData() { mpProgress.disposeAndClear(); } Size getRealPaperSize( const Size& i_rPageSize, bool bNoNUP ) const { @@ -207,7 +207,7 @@ public: void resetPaperToLastConfigured(); }; -PrinterController::PrinterController(const std::shared_ptr<Printer>& i_xPrinter) +PrinterController::PrinterController( const VclPtr<Printer>& i_xPrinter ) : mpImplData( new ImplPrinterControllerData ) { mpImplData->mxPrinter = i_xPrinter; @@ -305,9 +305,10 @@ void Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, { if (xController->isShowDialogs()) { - MessageDialog aBox(NULL, "ErrorNoPrinterDialog", + ScopedVclPtrInstance<MessageDialog> aBox( + nullptr, "ErrorNoPrinterDialog", "vcl/ui/errornoprinterdialog.ui"); - aBox.Execute(); + aBox->Execute(); } xController->setValue( OUString( "IsDirect" ), makeAny( false ) ); @@ -320,7 +321,7 @@ void Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, if (!xController->getPrinter()) { OUString aPrinterName( i_rInitSetup.GetPrinterName() ); - std::shared_ptr<Printer> xPrinter(std::make_shared<Printer>(aPrinterName)); + VclPtrInstance<Printer> xPrinter( aPrinterName ); xPrinter->SetJobSetup(i_rInitSetup); xController->setPrinter(xPrinter); } @@ -454,9 +455,10 @@ void Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, { if( xController->getFilteredPageCount() == 0 ) { - MessageDialog aBox(NULL, "ErrorNoContentDialog", + ScopedVclPtrInstance<MessageDialog> aBox( + nullptr, "ErrorNoContentDialog", "vcl/ui/errornocontentdialog.ui"); - aBox.Execute(); + aBox->Execute(); return; } } @@ -470,13 +472,13 @@ void Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, { try { - PrintDialog aDlg( NULL, xController ); - if( ! aDlg.Execute() ) + ScopedVclPtrInstance< PrintDialog > aDlg( nullptr, xController ); + if( ! aDlg->Execute() ) { xController->abortJob(); return; } - if( aDlg.isPrintToFile() ) + if( aDlg->isPrintToFile() ) { OUString aFile = queryFile( xController->getPrinter().get() ); if( aFile.isEmpty() ) @@ -487,7 +489,7 @@ void Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController, xController->setValue( OUString( "LocalFileName" ), makeAny( aFile ) ); } - else if( aDlg.isSingleJobs() ) + else if( aDlg->isSingleJobs() ) { xController->setValue( OUString( "PrintCollateAsSingleJobs" ), makeAny( true ) ); @@ -771,12 +773,12 @@ void PrinterController::setJobState( view::PrintableState i_eState ) mpImplData->meJobState = i_eState; } -const std::shared_ptr<Printer>& PrinterController::getPrinter() const +const VclPtr<Printer>& PrinterController::getPrinter() const { return mpImplData->mxPrinter; } -void PrinterController::setPrinter(const std::shared_ptr<Printer>& i_rPrinter) +void PrinterController::setPrinter( const VclPtr<Printer>& i_rPrinter ) { mpImplData->mxPrinter = i_rPrinter; setValue( OUString( "Name" ), @@ -1332,8 +1334,7 @@ void PrinterController::abortJob() // applications (well, sw) depend on a page request with "IsLastPage" = true // to free resources, else they (well, sw) will crash eventually setLastPage( true ); - delete mpImplData->mpProgress; - mpImplData->mpProgress = NULL; + mpImplData->mpProgress.disposeAndClear(); GDIMetaFile aMtf; getPageFile( 0, aMtf, false ); } @@ -1660,7 +1661,7 @@ void PrinterController::createProgressDialog() if( bShow && ! Application::IsHeadlessModeEnabled() ) { - mpImplData->mpProgress = new PrintProgressDialog( NULL, getPageCountProtected() ); + mpImplData->mpProgress = VclPtr<PrintProgressDialog>::Create( nullptr, getPageCountProtected() ); mpImplData->mpProgress->Show(); } } diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index b94b6c20e1d6..c453d91ef81d 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -255,6 +255,12 @@ VirtualDevice::VirtualDevice(const SystemGraphicsData *pData, const Size &rSize, VirtualDevice::~VirtualDevice() { SAL_INFO( "vcl.gdi", "VirtualDevice::~VirtualDevice()" ); + disposeOnce(); +} + +void VirtualDevice::dispose() +{ + SAL_INFO( "vcl.gdi", "VirtualDevice::dispose()" ); ImplSVData* pSVData = ImplGetSVData(); @@ -272,6 +278,8 @@ VirtualDevice::~VirtualDevice() mpNext->mpPrev = mpPrev; else pSVData->maGDIData.mpLastVirDev = mpPrev; + + OutputDevice::dispose(); } bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bErase, @@ -392,13 +400,12 @@ bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, // #110958# Setup alpha bitmap if(mpAlphaVDev && mpAlphaVDev->GetOutputSizePixel() != rNewSize) { - delete mpAlphaVDev; - mpAlphaVDev = 0L; + mpAlphaVDev.disposeAndClear(); } if( !mpAlphaVDev ) { - mpAlphaVDev = new VirtualDevice( *this, mnAlphaDepth ); + mpAlphaVDev = VclPtr<VirtualDevice>::Create( *this, mnAlphaDepth ); mpAlphaVDev->InnerImplSetOutputSizePixel(rNewSize, bErase, basebmp::RawMemorySharedArray(), bTopDown ); |