Fix OutputDevice members / stack allocation.

Change-Id: Ie57434607b61085a882af40b63d6a4b7aac0d4d3
diff --git a/canvas/source/vcl/spritecanvashelper.cxx b/canvas/source/vcl/spritecanvashelper.cxx
index 8855dd5..51a234f 100644
--- a/canvas/source/vcl/spritecanvashelper.cxx
+++ b/canvas/source/vcl/spritecanvashelper.cxx
@@ -324,7 +324,7 @@ namespace vclcanvas
            mpRedrawManager->forEachSprite(
                ::boost::bind(
                    &spriteRedraw,
                    ::boost::ref( maVDev.get() ),
                    ::boost::ref( *maVDev.get() ),
                    _1 ) );

            // flush to screen
@@ -582,7 +582,7 @@ namespace vclcanvas
        ::std::for_each( rSortedUpdateSprites.begin(),
                         rSortedUpdateSprites.end(),
                         ::boost::bind( &spriteRedrawStub2,
                                        ::boost::ref( maVDev.get() ),
                                        ::boost::ref( *maVDev.get() ),
                                        ::vcl::unotools::b2DPointFromPoint(
                                            aOutputPosition),
                                        _1 ) );
diff --git a/canvas/source/vcl/spritecanvashelper.hxx b/canvas/source/vcl/spritecanvashelper.hxx
index 0396217..a6b3c03 100644
--- a/canvas/source/vcl/spritecanvashelper.hxx
+++ b/canvas/source/vcl/spritecanvashelper.hxx
@@ -41,7 +41,7 @@ namespace vclcanvas
    {
    public:
        SpriteCanvasHelper();
        ~SpriteCanvasHelper()
        ~SpriteCanvasHelper();

        void init( const OutDevProviderSharedPtr& rOutDev,
                   SpriteCanvas&                  rOwningSpriteCanvas,
diff --git a/include/svx/sdrpaintwindow.hxx b/include/svx/sdrpaintwindow.hxx
index 3a1f1ef..d8f0918 100644
--- a/include/svx/sdrpaintwindow.hxx
+++ b/include/svx/sdrpaintwindow.hxx
@@ -50,10 +50,10 @@ PaintTransparentChildren(vcl::Window & rWindow, Rectangle const& rPixelRect);
class SdrPreRenderDevice
{
    // The original OutputDevice
    OutputDevice&                                       mrOutputDevice;
    OutputDevice&          mrOutputDevice;

    // The VirtualDevice for PreRendering
    VirtualDevice                                       maPreRenderDevice;
    VclPtr<VirtualDevice>  mpPreRenderDevice;

public:
    explicit SdrPreRenderDevice(OutputDevice& rOriginal);
@@ -63,7 +63,7 @@ public:
    void OutputPreRenderDevice(const vcl::Region& rExpandedRegion);

    OutputDevice& GetOriginalOutputDevice() const { return mrOutputDevice; }
    OutputDevice& GetPreRenderDevice() { return maPreRenderDevice; }
    OutputDevice& GetPreRenderDevice() { return *mpPreRenderDevice.get(); }
};


diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index 971c5b2..95019f2 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -24,6 +24,7 @@
#include <com/sun/star/uno/Any.hxx>
#include <cppuhelper/weakref.hxx>
#include <rtl/ustring.hxx>
#include <vcl/vclptr.hxx>
#include <svl/lstner.hxx>
#include <svl/poolitem.hxx>
#include <svx/svdtypes.hxx>
@@ -174,7 +175,7 @@ class SVX_DLLPUBLIC SdrObjMacroHitRec
public:
    Point                       aPos;
    Point                       aDownPos;
    OutputDevice*               pOut;
    VclPtr<OutputDevice>        pOut;
    const SetOfByte*            pVisiLayer;
    const SdrPageView*          pPageView;
    sal_uInt16                  nTol;
diff --git a/include/svx/svdpntv.hxx b/include/svx/svdpntv.hxx
index 0959f1c..49ecbe9 100644
--- a/include/svx/svdpntv.hxx
+++ b/include/svx/svdpntv.hxx
@@ -135,8 +135,8 @@ protected:
#ifdef DBG_UTIL
    VclPtr<SdrItemBrowser>      pItemBrowser;
#endif
    const OutputDevice*         pActualOutDev; // Nur zum vergleichen
    OutputDevice*               pDragWin;
    VclPtr<OutputDevice>        pActualOutDev; // Nur zum vergleichen
    VclPtr<OutputDevice>        pDragWin;
    SfxStyleSheet*              pDefaultStyleSheet;

    OUString                    aAktLayer;     // Aktueller Zeichenlayer
diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx
index 22e4167..d9cfce3 100644
--- a/svx/source/svdraw/sdrpaintwindow.cxx
+++ b/svx/source/svdraw/sdrpaintwindow.cxx
@@ -113,31 +113,33 @@ void CandidateMgr::PaintTransparentChildren(vcl::Window & rWindow, Rectangle con
}

SdrPreRenderDevice::SdrPreRenderDevice(OutputDevice& rOriginal)
:   mrOutputDevice(rOriginal)
:   mrOutputDevice(rOriginal),
    mpPreRenderDevice(new VirtualDevice())
{
}

SdrPreRenderDevice::~SdrPreRenderDevice()
{
    mpPreRenderDevice.disposeAndClear();
}

void SdrPreRenderDevice::PreparePreRenderDevice()
{
    // compare size of maPreRenderDevice with size of visible area
    if(maPreRenderDevice.GetOutputSizePixel() != mrOutputDevice.GetOutputSizePixel())
    // compare size of mpPreRenderDevice with size of visible area
    if(mpPreRenderDevice->GetOutputSizePixel() != mrOutputDevice.GetOutputSizePixel())
    {
        maPreRenderDevice.SetOutputSizePixel(mrOutputDevice.GetOutputSizePixel());
        mpPreRenderDevice->SetOutputSizePixel(mrOutputDevice.GetOutputSizePixel());
    }

    // Also compare the MapModes for zoom/scroll changes
    if(maPreRenderDevice.GetMapMode() != mrOutputDevice.GetMapMode())
    if(mpPreRenderDevice->GetMapMode() != mrOutputDevice.GetMapMode())
    {
        maPreRenderDevice.SetMapMode(mrOutputDevice.GetMapMode());
        mpPreRenderDevice->SetMapMode(mrOutputDevice.GetMapMode());
    }

    // #i29186#
    maPreRenderDevice.SetDrawMode(mrOutputDevice.GetDrawMode());
    maPreRenderDevice.SetSettings(mrOutputDevice.GetSettings());
    mpPreRenderDevice->SetDrawMode(mrOutputDevice.GetDrawMode());
    mpPreRenderDevice->SetSettings(mrOutputDevice.GetSettings());
}

void SdrPreRenderDevice::OutputPreRenderDevice(const vcl::Region& rExpandedRegion)
@@ -149,9 +151,9 @@ void SdrPreRenderDevice::OutputPreRenderDevice(const vcl::Region& rExpandedRegio

    // MapModes off
    bool bMapModeWasEnabledDest(mrOutputDevice.IsMapModeEnabled());
    bool bMapModeWasEnabledSource(maPreRenderDevice.IsMapModeEnabled());
    bool bMapModeWasEnabledSource(mpPreRenderDevice->IsMapModeEnabled());
    mrOutputDevice.EnableMapMode(false);
    maPreRenderDevice.EnableMapMode(false);
    mpPreRenderDevice->EnableMapMode(false);

    RectangleVector aRectangles;
    aRegionPixel.GetRegionRectangles(aRectangles);
@@ -165,7 +167,7 @@ void SdrPreRenderDevice::OutputPreRenderDevice(const vcl::Region& rExpandedRegio
        mrOutputDevice.DrawOutDev(
            aTopLeft, aSize,
            aTopLeft, aSize,
            maPreRenderDevice);
            *mpPreRenderDevice.get());

#ifdef DBG_UTIL
        // #i74769#
@@ -186,7 +188,7 @@ void SdrPreRenderDevice::OutputPreRenderDevice(const vcl::Region& rExpandedRegio
    }

    mrOutputDevice.EnableMapMode(bMapModeWasEnabledDest);
    maPreRenderDevice.EnableMapMode(bMapModeWasEnabledSource);
    mpPreRenderDevice->EnableMapMode(bMapModeWasEnabledSource);
}


diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 660bb90..f46b07d 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -1733,7 +1733,7 @@ void SdrObjEditView::ImpMacroUp(const Point& rUpPos)
        aHitRec.nTol=nMacroTol;
        aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
        aHitRec.pPageView=pMacroPV;
        aHitRec.pOut=pMacroWin;
        aHitRec.pOut=pMacroWin.get();
        pMacroObj->PaintMacro(*pMacroWin,Rectangle(),aHitRec);
        bMacroDown=false;
    }
@@ -1750,7 +1750,7 @@ void SdrObjEditView::ImpMacroDown(const Point& rDownPos)
        aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
        aHitRec.pPageView=pMacroPV;
        aHitRec.bDown=true;
        aHitRec.pOut=pMacroWin;
        aHitRec.pOut=pMacroWin.get();
        pMacroObj->PaintMacro(*pMacroWin,Rectangle(),aHitRec);
        bMacroDown=true;
    }
@@ -1766,7 +1766,7 @@ void SdrObjEditView::MovMacroObj(const Point& rPnt)
        aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
        aHitRec.pPageView=pMacroPV;
        aHitRec.bDown=bMacroDown;
        aHitRec.pOut=pMacroWin;
        aHitRec.pOut=pMacroWin.get();
        bool bDown=pMacroObj->IsMacroHit(aHitRec);
        if (bDown) ImpMacroDown(rPnt);
        else ImpMacroUp(rPnt);
@@ -1794,7 +1794,7 @@ bool SdrObjEditView::EndMacroObj()
        aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
        aHitRec.pPageView=pMacroPV;
        aHitRec.bDown=true;
        aHitRec.pOut=pMacroWin;
        aHitRec.pOut=pMacroWin.get();
        bool bRet=pMacroObj->DoMacro(aHitRec);
        pMacroObj=NULL;
        pMacroPV=NULL;
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index 7ee54bf..f058b4e 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -406,7 +406,7 @@ sal_uInt16 SdrPaintView::ImpGetHitTolLogic(short nHitTol, const OutputDevice* pO

void SdrPaintView::TheresNewMapMode()
{
    if (pActualOutDev!=NULL) {
    if (pActualOutDev) {
        nHitTolLog=(sal_uInt16)pActualOutDev->PixelToLogic(Size(nHitTolPix,0)).Width();
        nMinMovLog=(sal_uInt16)pActualOutDev->PixelToLogic(Size(nMinMovPix,0)).Width();
    }
@@ -414,7 +414,7 @@ void SdrPaintView::TheresNewMapMode()

void SdrPaintView::SetActualWin(const OutputDevice* pWin)
{
    pActualOutDev=pWin;
    pActualOutDev = const_cast<OutputDevice *>(pWin);
    TheresNewMapMode();
}

diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx
index 44cb7f0..e2dd8d4 100644
--- a/svx/source/svdraw/svdview.cxx
+++ b/svx/source/svdraw/svdview.cxx
@@ -488,7 +488,7 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co
                // we currently don't account for ticker text
                if(pActualOutDev && pActualOutDev->GetOutDevType() == OUTDEV_WINDOW)
                {
                    OutlinerView aOLV(pOutliner, const_cast<vcl::Window*>(static_cast<const vcl::Window*>(pActualOutDev)));
                    OutlinerView aOLV(pOutliner, const_cast<vcl::Window*>(static_cast<const vcl::Window*>(pActualOutDev.get())));
                    const EditView& aEV=aOLV.GetEditView();
                    const SvxFieldItem* pItem=aEV.GetField(aTemporaryTextRelativePosition);
                    if (pItem!=NULL) {
@@ -822,7 +822,7 @@ bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt)
                    if (eHit==SDRHIT_TEXTEDIT)
                    {
                        bool bRet2(pActualOutDev && OUTDEV_WINDOW == pActualOutDev->GetOutDevType() &&
                            SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, const_cast<vcl::Window*>(static_cast<const vcl::Window*>(pActualOutDev)), false, (SdrOutliner*)0L));
                            SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, const_cast<vcl::Window*>(static_cast<const vcl::Window*>(pActualOutDev.get())), false, (SdrOutliner*)0L));

                        if(bRet2)
                        {
@@ -906,7 +906,7 @@ bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt)
            } else bRet=BegCreateObj(aLogicPos);
        } break;
        case SDREVENT_BEGMACROOBJ: {
            bRet=BegMacroObj(aLogicPos,nHitTolLog,rVEvt.pObj,rVEvt.pPV,const_cast<vcl::Window*>(static_cast<const vcl::Window*>(pActualOutDev)));
            bRet=BegMacroObj(aLogicPos,nHitTolLog,rVEvt.pObj,rVEvt.pPV,const_cast<vcl::Window*>(static_cast<const vcl::Window*>(pActualOutDev.get())));
        } break;
        case SDREVENT_BEGTEXTEDIT: {
            if (!IsObjMarked(rVEvt.pObj)) {
@@ -915,7 +915,7 @@ bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt)
            }

            bRet = pActualOutDev && OUTDEV_WINDOW == pActualOutDev->GetOutDevType()&&
                 SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, const_cast<vcl::Window*>(static_cast<const vcl::Window*>(pActualOutDev)), false, (SdrOutliner*)0L);
                 SdrBeginTextEdit(rVEvt.pObj, rVEvt.pPV, const_cast<vcl::Window*>(static_cast<const vcl::Window*>(pActualOutDev.get())), false, (SdrOutliner*)0L);

            if(bRet)
            {
@@ -927,8 +927,8 @@ bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt)
        } break;
        default: break;
    } // switch
    if (bRet && pActualOutDev!=NULL && pActualOutDev->GetOutDevType()==OUTDEV_WINDOW) {
        vcl::Window* pWin=const_cast<vcl::Window*>(static_cast<const vcl::Window*>(pActualOutDev));
    if (bRet && pActualOutDev && pActualOutDev->GetOutDevType()==OUTDEV_WINDOW) {
        vcl::Window* pWin=const_cast<vcl::Window*>(static_cast<const vcl::Window*>(pActualOutDev.get()));
        // left mouse button pressed?
        bool bLeftDown=(rVEvt.nMouseCode&MOUSE_LEFT)!=0 && rVEvt.bMouseDown;
        // left mouse button released?
@@ -970,7 +970,7 @@ Pointer SdrView::GetPreferredPointer(const Point& rMousePos, const OutputDevice*
        aHitRec.nTol=nMacroTol;
        aHitRec.pVisiLayer=&pMacroPV->GetVisibleLayers();
        aHitRec.pPageView=pMacroPV;
        aHitRec.pOut=pMacroWin;
        aHitRec.pOut=pMacroWin.get();
        aHitRec.bDown=bMacroDown;
        return pMacroObj->GetMacroPointer(aHitRec);
    }
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index cc58203..9c10297 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -624,7 +624,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, 
    if( !pPage )
        return false;

    VirtualDevice       aVDev;
    ScopedVclPtr<VirtualDevice> aVDev( new VirtualDevice() );
    const MapMode       aMap( mpDoc->GetScaleUnit(), Point(), rSettings.maScaleX, rSettings.maScaleY );

    SdrOutliner& rOutl=mpDoc->GetDrawOutliner(NULL);
@@ -704,15 +704,15 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, 
                boost::scoped_ptr< SdrView > pLocalView;
                if( PTR_CAST( FmFormModel, mpDoc ) )
                {
                    pLocalView.reset( new FmFormView( PTR_CAST( FmFormModel, mpDoc ), &aVDev ) );
                    pLocalView.reset( new FmFormView( PTR_CAST( FmFormModel, mpDoc ), aVDev ) );
                }
                else
                {
                    pLocalView.reset( new SdrView( mpDoc, &aVDev ) );
                    pLocalView.reset( new SdrView( mpDoc, aVDev ) );
                }


                boost::scoped_ptr<VirtualDevice> pVDev(CreatePageVDev( pPage, nWidthPix, nHeightPix ));
                ScopedVclPtr<VirtualDevice> pVDev(CreatePageVDev( pPage, nWidthPix, nHeightPix ));

                if( pVDev )
                {
@@ -726,22 +726,22 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, 
            {
                GDIMetaFile aMtf;

                aVDev.SetMapMode( aMap );
                aVDev->SetMapMode( aMap );
                if( rSettings.mbUseHighContrast )
                    aVDev.SetDrawMode( aVDev.GetDrawMode() | DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT );
                aVDev.EnableOutput( false );
                aMtf.Record( &aVDev );
                    aVDev->SetDrawMode( aVDev->GetDrawMode() | DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT );
                aVDev->EnableOutput( false );
                aMtf.Record( aVDev );
                Size aNewSize;

                // create a view
                boost::scoped_ptr< SdrView > pView;
                if( PTR_CAST( FmFormModel, mpDoc ) )
                {
                    pView.reset(new FmFormView( PTR_CAST( FmFormModel, mpDoc ), &aVDev ));
                    pView.reset(new FmFormView( PTR_CAST( FmFormModel, mpDoc ), aVDev ));
                }
                else
                {
                    pView.reset(new SdrView( mpDoc, &aVDev ));
                    pView.reset(new SdrView( mpDoc, aVDev ));
                }

                pView->SetBordVisible( false );
@@ -754,17 +754,17 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, 
                const Rectangle aClipRect( aNewOrg, aNewSize );
                MapMode         aVMap( aMap );

                aVDev.Push();
                aVDev->Push();
                aVMap.SetOrigin( Point( -aNewOrg.X(), -aNewOrg.Y() ) );
                aVDev.SetRelativeMapMode( aVMap );
                aVDev.IntersectClipRegion( aClipRect );
                aVDev->SetRelativeMapMode( aVMap );
                aVDev->IntersectClipRegion( aClipRect );

                // Use new StandardCheckVisisbilityRedirector
                ImplExportCheckVisisbilityRedirector aRedirector( mpCurrentPage );

                pView->CompleteRedraw(&aVDev, vcl::Region(Rectangle(aNewOrg, aNewSize)), &aRedirector);
                pView->CompleteRedraw(aVDev, vcl::Region(Rectangle(aNewOrg, aNewSize)), &aRedirector);

                aVDev.Pop();
                aVDev->Pop();

                aMtf.Stop();
                aMtf.WindStart();
@@ -907,7 +907,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, 
        if( !bSingleGraphic )
        {
            // create a metafile for all shapes
            VirtualDevice   aOut;
            ScopedVclPtr<VirtualDevice> aOut;

            // calculate bound rect for all shapes
            Rectangle aBound;
@@ -927,18 +927,18 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, 
                }
            }

            aOut.EnableOutput( false );
            aOut.SetMapMode( aMap );
            aOut->EnableOutput( false );
            aOut->SetMapMode( aMap );
            if( rSettings.mbUseHighContrast )
                aOut.SetDrawMode( aOut.GetDrawMode() | DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT );
                aOut->SetDrawMode( aOut->GetDrawMode() | DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT );

            GDIMetaFile aMtf;
            aMtf.Clear();
            aMtf.Record( &aOut );
            aMtf.Record( aOut );

            MapMode aOutMap( aMap );
            aOutMap.SetOrigin( Point( -aBound.TopLeft().X(), -aBound.TopLeft().Y() ) );
            aOut.SetRelativeMapMode( aOutMap );
            aOut->SetRelativeMapMode( aOutMap );

            sdr::contact::DisplayInfo aDisplayInfo;

@@ -956,7 +956,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, 
            {
                // more effective way to paint a vector of SdrObjects. Hand over the processed page
                // to have it in the
                sdr::contact::ObjectContactOfObjListPainter aMultiObjectPainter(aOut, aShapes, mpCurrentPage);
                sdr::contact::ObjectContactOfObjListPainter aMultiObjectPainter(*aOut.get(), aShapes, mpCurrentPage);
                ImplExportCheckVisisbilityRedirector aCheckVisibilityRedirector(mpCurrentPage);
                aMultiObjectPainter.SetViewObjectContactRedirector(&aCheckVisibilityRedirector);

@@ -966,7 +966,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, 
            aMtf.Stop();
            aMtf.WindStart();

            const Size  aExtSize( aOut.PixelToLogic( Size( 0, 0  ) ) );
            const Size  aExtSize( aOut->PixelToLogic( Size( 0, 0  ) ) );
            Size        aBoundSize( aBound.GetWidth() + ( aExtSize.Width() ),
                                    aBound.GetHeight() + ( aExtSize.Height() ) );

diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 58a3e7d..9c1981e 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -670,13 +670,13 @@ uno::Any SvxShape::GetBitmap( bool bMetaFile /* = false */ ) const
    if( !mpObj.is() || mpModel == NULL || !mpObj->IsInserted() || NULL == mpObj->GetPage() )
        return aAny;

    VirtualDevice aVDev;
    aVDev.SetMapMode(MapMode(MAP_100TH_MM));
    ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice() );
    pVDev->SetMapMode(MapMode(MAP_100TH_MM));

    SdrModel* pModel = mpObj->GetModel();
    SdrPage* pPage = mpObj->GetPage();

    boost::scoped_ptr<E3dView> pView(new E3dView( pModel, &aVDev ));
    boost::scoped_ptr<E3dView> pView(new E3dView( pModel, pVDev.get() ));
    pView->hideMarkHandles();
    SdrPageView* pPageView = pView->ShowSdrPage(pPage);

diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index 1f39734..5e4a7e7 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -250,27 +250,27 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileNam
                    {
                        if( pMtfSize_100TH_MM && ( rGraphic.GetType() != GRAPHIC_BITMAP ) )
                        {
                            VirtualDevice aVDev;
                            const Size    aSize( aVDev.LogicToPixel( *pMtfSize_100TH_MM, MAP_100TH_MM ) );
                            ScopedVclPtr< VirtualDevice > pVDev(new VirtualDevice());
                            const Size    aSize( pVDev->LogicToPixel( *pMtfSize_100TH_MM, MAP_100TH_MM ) );

                            if( aVDev.SetOutputSizePixel( aSize ) )
                            if( pVDev->SetOutputSizePixel( aSize ) )
                            {
                                const Wallpaper aWallpaper( aVDev.GetBackground() );
                                const Wallpaper aWallpaper( pVDev->GetBackground() );
                                const Point     aPt;

                                aVDev.SetBackground( Wallpaper( Color( COL_BLACK ) ) );
                                aVDev.Erase();
                                rGraphic.Draw( &aVDev, aPt, aSize );
                                pVDev->SetBackground( Wallpaper( Color( COL_BLACK ) ) );
                                pVDev->Erase();
                                rGraphic.Draw( pVDev.get(), aPt, aSize );

                                const Bitmap aBitmap( aVDev.GetBitmap( aPt, aSize ) );
                                const Bitmap aBitmap( pVDev->GetBitmap( aPt, aSize ) );

                                aVDev.SetBackground( aWallpaper );
                                aVDev.Erase();
                                rGraphic.Draw( &aVDev, aPt, aSize );
                                pVDev->SetBackground( aWallpaper );
                                pVDev->Erase();
                                rGraphic.Draw( pVDev.get(), aPt, aSize );

                                aVDev.SetRasterOp( ROP_XOR );
                                aVDev.DrawBitmap( aPt, aSize, aBitmap );
                                aGraphic = BitmapEx( aBitmap, aVDev.GetBitmap( aPt, aSize ) );
                                pVDev->SetRasterOp( ROP_XOR );
                                pVDev->DrawBitmap( aPt, aSize, aBitmap );
                                aGraphic = BitmapEx( aBitmap, pVDev->GetBitmap( aPt, aSize ) );
                            }
                            else
                                aGraphic = rGraphic.GetBitmapEx();
@@ -283,13 +283,13 @@ sal_uInt16 XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileNam
                {
                    if( pMtfSize_100TH_MM && ( rGraphic.GetType() != GRAPHIC_BITMAP ) )
                    {
                        VirtualDevice   aVDev;
                        const Size      aSize( aVDev.LogicToPixel( *pMtfSize_100TH_MM, MAP_100TH_MM ) );
                        ScopedVclPtr< VirtualDevice > pVDev(new VirtualDevice());
                        const Size      aSize( pVDev->LogicToPixel( *pMtfSize_100TH_MM, MAP_100TH_MM ) );

                        if( aVDev.SetOutputSizePixel( aSize ) )
                        if( pVDev->SetOutputSizePixel( aSize ) )
                        {
                            rGraphic.Draw( &aVDev, Point(), aSize );
                            aGraphic =  aVDev.GetBitmap( Point(), aSize );
                            rGraphic.Draw( pVDev.get(), Point(), aSize );
                            aGraphic = pVDev->GetBitmap( Point(), aSize );
                        }
                        else
                            aGraphic = rGraphic.GetBitmap();
diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx
index 0518bdd..cecfc7c 100644
--- a/svx/source/xoutdev/xattrbmp.cxx
+++ b/svx/source/xoutdev/xattrbmp.cxx
@@ -140,7 +140,7 @@ const GraphicObject& XOBitmap::GetGraphicObject() const

void XOBitmap::Bitmap2Array()
{
    VirtualDevice   aVD;
    ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice() );
    bool            bPixelColor = false;
    const Bitmap    aBitmap( GetBitmap() );
    const sal_uInt16    nLines = 8; // type dependent
@@ -148,23 +148,23 @@ void XOBitmap::Bitmap2Array()
    if( !pPixelArray )
        pPixelArray = new sal_uInt16[ nLines * nLines ];

    aVD.SetOutputSizePixel( aBitmap.GetSizePixel() );
    aVD.DrawBitmap( Point(), aBitmap );
    aPixelColor = aBckgrColor = aVD.GetPixel( Point() );
    pVDev->SetOutputSizePixel( aBitmap.GetSizePixel() );
    pVDev->DrawBitmap( Point(), aBitmap );
    aPixelColor = aBckgrColor = pVDev->GetPixel( Point() );

    // create array and determine foreground and background color
    for( sal_uInt16 i = 0; i < nLines; i++ )
    {
        for( sal_uInt16 j = 0; j < nLines; j++ )
        {
            if ( aVD.GetPixel( Point( j, i ) ) == aBckgrColor )
            if ( pVDev->GetPixel( Point( j, i ) ) == aBckgrColor )
                *( pPixelArray + j + i * nLines ) = 0;
            else
            {
                *( pPixelArray + j + i * nLines ) = 1;
                if( !bPixelColor )
                {
                    aPixelColor = aVD.GetPixel( Point( j, i ) );
                    aPixelColor = pVDev->GetPixel( Point( j, i ) );
                    bPixelColor = true;
                }
            }
@@ -175,13 +175,13 @@ void XOBitmap::Bitmap2Array()
/// convert array, fore- and background color into a bitmap
void XOBitmap::Array2Bitmap()
{
    VirtualDevice   aVD;
    sal_uInt16          nLines = 8; // type dependent
    ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice() );
    sal_uInt16 nLines = 8; // type dependent

    if( !pPixelArray )
        return;

    aVD.SetOutputSizePixel( Size( nLines, nLines ) );
    pVDev->SetOutputSizePixel( Size( nLines, nLines ) );

    // create bitmap
    for( sal_uInt16 i = 0; i < nLines; i++ )
@@ -189,13 +189,13 @@ void XOBitmap::Array2Bitmap()
        for( sal_uInt16 j = 0; j < nLines; j++ )
        {
            if( *( pPixelArray + j + i * nLines ) == 0 )
                aVD.DrawPixel( Point( j, i ), aBckgrColor );
                pVDev->DrawPixel( Point( j, i ), aBckgrColor );
            else
                aVD.DrawPixel( Point( j, i ), aPixelColor );
                pVDev->DrawPixel( Point( j, i ), aPixelColor );
        }
    }

    aGraphicObject = GraphicObject( aVD.GetBitmap( Point(), Size( nLines, nLines ) ) );
    aGraphicObject = GraphicObject( pVDev->GetBitmap( Point(), Size( nLines, nLines ) ) );
    bGraphicDirty = false;
}

diff --git a/svx/source/xoutdev/xtabdash.cxx b/svx/source/xoutdev/xtabdash.cxx
index 129490a..07d02a1 100644
--- a/svx/source/xoutdev/xtabdash.cxx
+++ b/svx/source/xoutdev/xtabdash.cxx
@@ -135,11 +135,11 @@ Bitmap XDashList::ImpCreateBitmapForXDash(const XDash* pDash)
            aStrokeAttribute));

    // prepare VirtualDevice
    VirtualDevice aVirtualDevice;
    ScopedVclPtr< VirtualDevice > pVirtualDevice(new VirtualDevice());
    const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;

    aVirtualDevice.SetOutputSizePixel(aSize);
    aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode()
    pVirtualDevice->SetOutputSizePixel(aSize);
    pVirtualDevice->SetDrawMode(rStyleSettings.GetHighContrastMode()
        ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
        : DRAWMODE_DEFAULT);

@@ -150,17 +150,17 @@ Bitmap XDashList::ImpCreateBitmapForXDash(const XDash* pDash)
        static const Color aW(COL_WHITE);
        static const Color aG(0xef, 0xef, 0xef);

        aVirtualDevice.DrawCheckered(aNull, aSize, nLen, aW, aG);
        pVirtualDevice->DrawCheckered(aNull, aSize, nLen, aW, aG);
    }
    else
    {
        aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor());
        aVirtualDevice.Erase();
        pVirtualDevice->SetBackground(rStyleSettings.GetFieldColor());
        pVirtualDevice->Erase();
    }

    // create processor and draw primitives
    boost::scoped_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(
        aVirtualDevice,
        *pVirtualDevice.get(),
        aNewViewInformation2D));

    if(pProcessor2D)
@@ -172,7 +172,7 @@ Bitmap XDashList::ImpCreateBitmapForXDash(const XDash* pDash)
    }

    // get result bitmap and scale
    Bitmap aRetval(aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel()));
    Bitmap aRetval(pVirtualDevice->GetBitmap(Point(0, 0), pVirtualDevice->GetOutputSizePixel()));

    if(1 != nFactor)
    {
diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx
index f25a215..5607659 100644
--- a/svx/source/xoutdev/xtabgrdt.cxx
+++ b/svx/source/xoutdev/xtabgrdt.cxx
@@ -181,17 +181,17 @@ Bitmap XGradientList::CreateBitmapForUI( long nIndex )
                aBlack));

        // prepare VirtualDevice
        VirtualDevice aVirtualDevice;
        ScopedVclPtr< VirtualDevice > pVirtualDevice(new VirtualDevice());
        const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;

        aVirtualDevice.SetOutputSizePixel(rSize);
        aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode()
        pVirtualDevice->SetOutputSizePixel(rSize);
        pVirtualDevice->SetDrawMode(rStyleSettings.GetHighContrastMode()
            ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
            : DRAWMODE_DEFAULT);

        // create processor and draw primitives
        boost::scoped_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(
            aVirtualDevice,
            *pVirtualDevice.get(),
            aNewViewInformation2D));

        if(pProcessor2D)
@@ -206,7 +206,7 @@ Bitmap XGradientList::CreateBitmapForUI( long nIndex )
        }

        // get result bitmap and scale
        aRetval = aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel());
        aRetval = pVirtualDevice->GetBitmap(Point(0, 0), pVirtualDevice->GetOutputSizePixel());
    }

    return aRetval;
diff --git a/svx/source/xoutdev/xtabhtch.cxx b/svx/source/xoutdev/xtabhtch.cxx
index ba73c5c..5553476 100644
--- a/svx/source/xoutdev/xtabhtch.cxx
+++ b/svx/source/xoutdev/xtabhtch.cxx
@@ -142,11 +142,11 @@ Bitmap XHatchList::CreateBitmapForUI( long nIndex )
                aBlack));

        // prepare VirtualDevice
        VirtualDevice aVirtualDevice;
        ScopedVclPtr< VirtualDevice > pVirtualDevice(new VirtualDevice());
        const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;

        aVirtualDevice.SetOutputSizePixel(rSize);
        aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode()
        pVirtualDevice->SetOutputSizePixel(rSize);
        pVirtualDevice->SetDrawMode(rStyleSettings.GetHighContrastMode()
            ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
            : DRAWMODE_DEFAULT);

@@ -156,17 +156,17 @@ Bitmap XHatchList::CreateBitmapForUI( long nIndex )
            static const sal_uInt32 nLen(8);
            static const Color aW(COL_WHITE);
            static const Color aG(0xef, 0xef, 0xef);
            aVirtualDevice.DrawCheckered(aNull, rSize, nLen, aW, aG);
            pVirtualDevice->DrawCheckered(aNull, rSize, nLen, aW, aG);
        }
        else
        {
            aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor());
            aVirtualDevice.Erase();
            pVirtualDevice->SetBackground(rStyleSettings.GetFieldColor());
            pVirtualDevice->Erase();
        }

        // create processor and draw primitives
        boost::scoped_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(
            aVirtualDevice,
            *pVirtualDevice.get(),
            aNewViewInformation2D));

        if(pProcessor2D)
@@ -180,7 +180,7 @@ Bitmap XHatchList::CreateBitmapForUI( long nIndex )
        }

        // get result bitmap and scale
        aRetval = aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel());
        aRetval = pVirtualDevice->GetBitmap(Point(0, 0), pVirtualDevice->GetOutputSizePixel());
    }

    return aRetval;
diff --git a/svx/source/xoutdev/xtablend.cxx b/svx/source/xoutdev/xtablend.cxx
index cd4dae3..1c5b8a8 100644
--- a/svx/source/xoutdev/xtablend.cxx
+++ b/svx/source/xoutdev/xtablend.cxx
@@ -125,11 +125,11 @@ Bitmap XLineEndList::CreateBitmapForUI( long nIndex )
                aLineStartEndAttribute));

        // prepare VirtualDevice
        VirtualDevice aVirtualDevice;
        ScopedVclPtr< VirtualDevice > pVirtualDevice(new VirtualDevice());
        const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;

        aVirtualDevice.SetOutputSizePixel(aSize);
        aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode()
        pVirtualDevice->SetOutputSizePixel(aSize);
        pVirtualDevice->SetDrawMode(rStyleSettings.GetHighContrastMode()
            ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
            : DRAWMODE_DEFAULT);

@@ -139,17 +139,17 @@ Bitmap XLineEndList::CreateBitmapForUI( long nIndex )
            static const sal_uInt32 nLen(8);
            static const Color aW(COL_WHITE);
            static const Color aG(0xef, 0xef, 0xef);
            aVirtualDevice.DrawCheckered(aNull, aSize, nLen, aW, aG);
            pVirtualDevice->DrawCheckered(aNull, aSize, nLen, aW, aG);
        }
        else
        {
            aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor());
            aVirtualDevice.Erase();
            pVirtualDevice->SetBackground(rStyleSettings.GetFieldColor());
            pVirtualDevice->Erase();
        }

        // create processor and draw primitives
        boost::scoped_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(
            aVirtualDevice,
            *pVirtualDevice.get(),
            aNewViewInformation2D));

        if(pProcessor2D)
@@ -161,7 +161,7 @@ Bitmap XLineEndList::CreateBitmapForUI( long nIndex )
        }

        // get result bitmap and scale
        aRetval = aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel());
        aRetval = pVirtualDevice->GetBitmap(Point(0, 0), pVirtualDevice->GetOutputSizePixel());
    }

    return aRetval;
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 7ad04e5..610d963 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -125,12 +125,12 @@ class SW_DLLPUBLIC SwViewShell : public sw::Ring<SwViewShell>
    SwRect        maInvalidRect;

    SfxViewShell *mpSfxViewShell;
    SwViewShellImp    *mpImp;             // Core-internals of SwViewShell.
                                    // The pointer is never 0.
    SwViewShellImp *mpImp;           // Core-internals of SwViewShell.
                                     // The pointer is never 0.

    VclPtr<::vcl::Window> mpWin;             ///< = 0 during printing or pdf export
    OutputDevice *mpOut;              ///< Window, Printer, VirtDev, ...
    OutputDevice* mpTmpRef;           // Temporariy reference device. Is used
    VclPtr<::vcl::Window> mpWin;     ///< = 0 during printing or pdf export
    VclPtr<OutputDevice>  mpOut;     ///< Window, Printer, VirtDev, ...
    VclPtr<OutputDevice>  mpTmpRef;  // Temporariy reference device. Is used
                                     // during (printer depending) prospect
                                     // and page preview printing
                                     // (because a scaling has to be set at
@@ -161,7 +161,7 @@ class SW_DLLPUBLIC SwViewShell : public sw::Ring<SwViewShell>
    bool mbInConstructor:1;

    SdrPaintWindow*         mpTargetPaintWindow;
    OutputDevice*           mpBufferedOut;
    VclPtr<OutputDevice>    mpBufferedOut;

    SwRootFrmPtr            mpLayout;

@@ -236,7 +236,7 @@ public:
    // #i72754# set of Pre/PostPaints with lock counter and initial target OutDev
protected:
    std::stack<vcl::Region> mPrePostPaintRegions; // acts also as a lock counter (empty == not locked)
    OutputDevice*           mpPrePostOutDev;
    VclPtr<OutputDevice>    mpPrePostOutDev;
    MapMode                 maPrePostMapMode;
public:
    void PrePaint();
diff --git a/sw/qa/tiledrendering/tiledrendering.cxx b/sw/qa/tiledrendering/tiledrendering.cxx
index dfedd6b..c89d6f4 100644
--- a/sw/qa/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/tiledrendering/tiledrendering.cxx
@@ -131,13 +131,13 @@ IMPL_LINK ( TiledRenderingDialog, RenderHdl, Button *, EMPTYARG )
        // SystemGraphicsData aData;
        // [setup the aData]
        // VirtualDevice aDevice(&aData, [color depth]);
        VirtualDevice aDevice;
        ScopedVclPtr< VirtualDevice > pDevice(new VirtualDevice());

        // paint to it
        pViewShell->PaintTile(aDevice, contextWidth, contextHeight, tilePosX, tilePosY, tileWidth, tileHeight);
        pViewShell->PaintTile(*pDevice.get(), contextWidth, contextHeight, tilePosX, tilePosY, tileWidth, tileHeight);

        // copy the aDevice content to mpImage
        Bitmap aBitmap(aDevice.GetBitmap(aDevice.PixelToLogic(Point(0,0)), aDevice.PixelToLogic(Size(contextWidth, contextHeight))));
        Bitmap aBitmap(pDevice->GetBitmap(aDevice->PixelToLogic(Point(0,0)), pDevice->PixelToLogic(Size(contextWidth, contextHeight))));
        mpImage->SetImage(Image(aBitmap));

        // update the dialog size
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 0e36a90..91ac529 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -1239,15 +1239,15 @@ bool SwFEShell::GetDrawObjGraphic( SotClipboardFormatId nFmt, Graphic& rGrf ) co
                            Point aPt;
                            GetGrfSize( aSz );

                            VirtualDevice aVirtDev;
                            aVirtDev.EnableOutput( false );
                            ScopedVclPtr< VirtualDevice > pVirtDev(new VirtualDevice());
                            pVirtDev->EnableOutput( false );

                            MapMode aTmp( GetWin()->GetMapMode() );
                            aTmp.SetOrigin( aPt );
                            aVirtDev.SetMapMode( aTmp );
                            pVirtDev->SetMapMode( aTmp );

                            GDIMetaFile aMtf;
                            aMtf.Record( &aVirtDev );
                            aMtf.Record( pVirtDev.get() );
                            aGrf.Draw( &aVirtDev, aPt, aSz );
                            aMtf.Stop();
                            aMtf.SetPrefMapMode( aTmp );
@@ -1266,14 +1266,14 @@ bool SwFEShell::GetDrawObjGraphic( SotClipboardFormatId nFmt, Graphic& rGrf ) co
                        // Otherwise it could happen that for vector graphics
                        // many MB's of memory are allocated.
                        const Size aSz( FindFlyFrm()->Prt().SSize() );
                        VirtualDevice aVirtDev( *GetWin() );
                        ScopedVclPtr< VirtualDevice > pVirtDev(new VirtualDevice(*GetWin()));

                        MapMode aTmp( MAP_TWIP );
                        aVirtDev.SetMapMode( aTmp );
                        if( aVirtDev.SetOutputSize( aSz ) )
                        pVirtDev->SetMapMode( aTmp );
                        if( pVirtDev->SetOutputSize( aSz ) )
                        {
                            aGrf.Draw( &aVirtDev, Point(), aSz );
                            rGrf = aVirtDev.GetBitmap( Point(), aSz );
                            aGrf.Draw( pVirtDev.get(), Point(), aSz );
                            rGrf = pVirtDev->GetBitmap( Point(), aSz );
                        }
                        else
                        {
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 2f129a3..00ce384 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -7640,21 +7640,21 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap )
        SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pFirst);

        OutputDevice *pOld = pSh->GetOut();
        VirtualDevice aDev( *pOld );
        aDev.EnableOutput( false );
        ScopedVclPtr< VirtualDevice > pDev( new VirtualDevice( *pOld ) );
        pDev->EnableOutput( false );

        GDIMetaFile aMet;
        MapMode aMap( pOld->GetMapMode().GetMapUnit() );
        aDev.SetMapMode( aMap );
        pDev->SetMapMode( aMap );
        aMet.SetPrefMapMode( aMap );

        ::SwCalcPixStatics( pSh->GetOut() );
        aMet.SetPrefSize( pFly->Frm().SSize() );

        aMet.Record( &aDev );
        aDev.SetLineColor();
        aDev.SetFillColor();
        aDev.SetFont( pOld->GetFont() );
        aMet.Record( pDev.get() );
        pDev->SetLineColor();
        pDev->SetFillColor();
        pDev->SetFont( pOld->GetFont() );

        //Enlarge the rectangle if needed, so the border is painted too.
        SwRect aOut( pFly->Frm() );
diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx
index 5fdaf05..cd7bd85 100644
--- a/sw/source/core/view/vnew.cxx
+++ b/sw/source/core/view/vnew.cxx
@@ -371,7 +371,7 @@ SwViewShell::~SwViewShell()
        }
    }

    delete mpTmpRef;
    mpTmpRef.disposeAndClear();
    delete mpAccOptions;
}

diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index 355ef9b..2d3db2b 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -726,9 +726,9 @@ void SwWW8WrGrf::WriteGrfFromGrfNode(SvStream& rStrm, const SwGrfNode &rGrfNd,
            {
                case GRAPHIC_BITMAP:        // Bitmap -> play in Metafile
                    {
                        VirtualDevice aVirt;
                        aMeta.Record(&aVirt);
                        aVirt.DrawBitmap( Point( 0,0 ), rGrf.GetBitmap() );
                        ScopedVclPtr< VirtualDevice > pVirt(new VirtualDevice());
                        aMeta.Record(pVirt.get());
                        pVirt->DrawBitmap( Point( 0,0 ), rGrf.GetBitmap() );
                        aMeta.Stop();
                        aMeta.WindStart();
                        aMeta.SetPrefMapMode( rGrf.GetPrefMapMode());
@@ -854,9 +854,9 @@ void SwWW8WrGrf::WriteGrfForBullet(SvStream& rStrm, const Graphic &rGrf, sal_uIn
        {
            case GRAPHIC_BITMAP:        // Bitmap -> in Metafile abspielen
            {
                VirtualDevice aVirt;
                aMeta.Record(&aVirt);
                aVirt.DrawBitmap( Point( 0,0 ), rGrf.GetBitmap() );
                ScopedVclPtr< VirtualDevice > pVirt(new VirtualDevice());
                aMeta.Record(pVirt.get());
                pVirt->DrawBitmap( Point( 0,0 ), rGrf.GetBitmap() );
                aMeta.Stop();
                aMeta.WindStart();
                aMeta.SetPrefMapMode( rGrf.GetPrefMapMode());
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index 23daa29..508d38f 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -945,7 +945,8 @@ public:
        BitmapEx AlphaRecovery(OutputDevice &rDev, Point aPt, BitmapEx &aSrc)
        {
            // Compositing onto 2x colors beyond our control
            VirtualDevice aWhite, aBlack;
            ScopedVclPtr< VirtualDevice > aWhite(new VirtualDevice());
            ScopedVclPtr< VirtualDevice > aBlack(new VirtualDevice());
            aWhite.SetOutputSizePixel(aSrc.GetSizePixel());
            aWhite.SetBackground(Wallpaper(COL_WHITE));
            aWhite.Erase();
@@ -1503,7 +1504,7 @@ public:
        DrawWallpaper(aWholeSize, aWallpaper);
        Pop();

        VirtualDevice aDev(*this);
        ScopedVclPtr< VirtualDevice > aDev(new VirtualDevice(*this));
        aDev.EnableRTL(IsRTLEnabled());
        aDev.SetOutputSizePixel(aExclude.GetSize());