automated VclPtrInstance conversion.

Change-Id: I9a1d47202e2794461f6ec44f3e72ee1dd2fde09d
diff --git a/include/vcl/vclptr.hxx b/include/vcl/vclptr.hxx
index 0c29f11..c4c210b 100644
--- a/include/vcl/vclptr.hxx
+++ b/include/vcl/vclptr.hxx
@@ -97,6 +97,12 @@ public:
        : m_rInnerRef(pBody)
    {}

    /** Constructor... that doesn't take a ref.
     */
    inline VclPtr (reference_type * pBody, __sal_NoAcquire)
        : m_rInnerRef(pBody, SAL_NO_ACQUIRE)
    {}

    /** Copy constructor...
     */
    inline VclPtr (const VclPtr<reference_type> & handle)
@@ -215,11 +221,6 @@ public:
    {
        return (m_rInnerRef > handle.m_rInnerRef);
    }

protected:
    inline VclPtr (reference_type * pBody, __sal_NoAcquire)
        : m_rInnerRef(pBody, SAL_NO_ACQUIRE)
    {}
}; // class VclPtr

/**
diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx
index 689d931..5e0b7a7 100644
--- a/vcl/generic/print/genprnpsp.cxx
+++ b/vcl/generic/print/genprnpsp.cxx
@@ -144,7 +144,7 @@ namespace
    int QueryFaxNumber(OUString& rNumber)
    {
        OUString aTmpString(VclResId(SV_PRINT_QUERYFAXNUMBER_TXT));
        ScopedVclPtr<QueryString> aQuery(new QueryString(NULL, aTmpString, rNumber));
        ScopedVclPtrInstance< QueryString > aQuery( nullptr, aTmpString, rNumber );
        return aQuery->Execute();
    }
}
diff --git a/vcl/generic/print/prtsetup.cxx b/vcl/generic/print/prtsetup.cxx
index 3d34bb1..b446787 100644
--- a/vcl/generic/print/prtsetup.cxx
+++ b/vcl/generic/print/prtsetup.cxx
@@ -502,7 +502,7 @@ void RTSDevicePage::FillValueBox( const PPDKey* pKey )
int SetupPrinterDriver(::psp::PrinterInfo& rJobData)
{
    int nRet = 0;
    ScopedVclPtr<RTSDialog> aDialog(new RTSDialog( rJobData, NULL ) );
    ScopedVclPtrInstance< RTSDialog > aDialog(  rJobData, nullptr  );

    if( aDialog->Execute() )
    {
diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx
index 4b1a446..cb0b0a2 100644
--- a/vcl/qa/cppunit/outdev.cxx
+++ b/vcl/qa/cppunit/outdev.cxx
@@ -32,7 +32,7 @@ public:

void VclOutdevTest::testVirtualDevice()
{
    ScopedVclPtr<VirtualDevice> pVDev( new VirtualDevice() );
    ScopedVclPtrInstance< VirtualDevice > pVDev;
    pVDev->SetOutputSizePixel(Size(32,32));
    pVDev->SetBackground(Wallpaper(COL_WHITE));
    pVDev->Erase();
diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx
index 7d099d6..b421606 100644
--- a/vcl/source/app/dbggui.cxx
+++ b/vcl/source/app/dbggui.cxx
@@ -369,7 +369,7 @@ void DbgDialog::RequestHelp( const HelpEvent& rHEvt )
{
    if ( rHEvt.GetMode() & HelpEventMode::CONTEXT )
    {
        ScopedVclPtr<DbgInfoDialog> aInfoDialog(new DbgInfoDialog( this, true ) );
        ScopedVclPtrInstance< DbgInfoDialog > aInfoDialog(  this, true  );
        OUString aHelpText;
        const sal_Char** pHelpStrs = pDbgHelpText;
        while ( *pHelpStrs )
@@ -833,7 +833,7 @@ void DbgGUIStart()

    if ( pData )
    {
        ScopedVclPtr<DbgDialog> pDialog(new DbgDialog);
        ScopedVclPtrInstance< DbgDialog > pDialog;
        // we switch off dialog tests for the debug dialog
        sal_uLong nOldFlags = pData->nTestFlags;
        pData->nTestFlags &= ~DBG_TEST_DIALOG;
diff --git a/vcl/source/app/stdtext.cxx b/vcl/source/app/stdtext.cxx
index dcd8c9e..fcf7b9d 100644
--- a/vcl/source/app/stdtext.cxx
+++ b/vcl/source/app/stdtext.cxx
@@ -39,7 +39,7 @@ void ShowServiceNotAvailableError(vcl::Window* pParent,
{
    OUString aText  = GetStandardText(STANDARD_TEXT_SERVICE_NOT_AVAILABLE).
        replaceAll("%s", rServiceName);
    ScopedVclPtr<MessageDialog> aBox(new MessageDialog(pParent, aText, bError ? VCL_MESSAGE_ERROR : VCL_MESSAGE_WARNING));
    ScopedVclPtrInstance< MessageDialog > aBox( pParent, aText, bError ? VCL_MESSAGE_ERROR : VCL_MESSAGE_WARNING );
    aBox->Execute();
}

diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index b8563c5..3a4920a 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -172,7 +172,7 @@ ResMgr* ImplGetResMgr()
                "Missing vcl resource. This indicates that files vital to localization are missing. "
                "You might have a corrupt installation.";
            fprintf( stderr, "%s\n", pMsg );
            ScopedVclPtr<MessageDialog> aBox(new MessageDialog(NULL, OUString(pMsg, strlen(pMsg), RTL_TEXTENCODING_ASCII_US)));
            ScopedVclPtrInstance< MessageDialog > aBox( nullptr, OUString(pMsg, strlen(pMsg), RTL_TEXTENCODING_ASCII_US) );
            aBox->Execute();
        }
    }
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 246df6e..6809481 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -805,7 +805,7 @@ void Edit::ShowTruncationWarning( vcl::Window* pParent )
    ResMgr* pResMgr = ImplGetResMgr();
    if( pResMgr )
    {
        ScopedVclPtr<MessageDialog> aBox(new MessageDialog(pParent, ResId(SV_EDIT_WARNING_STR, *pResMgr), VCL_MESSAGE_WARNING));
        ScopedVclPtrInstance< MessageDialog > aBox( pParent, ResId(SV_EDIT_WARNING_STR, *pResMgr), VCL_MESSAGE_WARNING );
        aBox->Execute();
    }
}
@@ -2784,7 +2784,7 @@ Size Edit::CalcMinimumSize() const
Size Edit::GetMinimumEditSize()
{
    vcl::Window* pDefWin = ImplGetDefaultWindow();
    ScopedVclPtr<Edit> aEdit(new Edit( pDefWin, WB_BORDER ) );
    ScopedVclPtrInstance< Edit > aEdit(  pDefWin, WB_BORDER  );
    Size aSize( aEdit->CalcMinimumSize() );
    return aSize;
}
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 8cc8d9d..9616797 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1892,7 +1892,7 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString
        {
            Size aSizePixel;
            sal_uLong nColorCount,nBitsPerPixel,nNeededMem,nMaxMem;
            ScopedVclPtr<VirtualDevice> aVirDev( new VirtualDevice() );
            ScopedVclPtrInstance< VirtualDevice > aVirDev;

            nMaxMem = 1024;
            nMaxMem *= 1024; // In Bytes
diff --git a/vcl/source/filter/sgfbram.cxx b/vcl/source/filter/sgfbram.cxx
index 95ae3fa..277e4af 100644
--- a/vcl/source/filter/sgfbram.cxx
+++ b/vcl/source/filter/sgfbram.cxx
@@ -390,7 +390,7 @@ Color Hpgl2SvFarbe( sal_uInt8 nFarb )

bool SgfFilterVect(SvStream& rInp, SgfHeader& rHead, SgfEntry&, GDIMetaFile& rMtf)
{
    ScopedVclPtr<VirtualDevice> aOutDev( new VirtualDevice() );
    ScopedVclPtrInstance< VirtualDevice > aOutDev;
    SgfVector aVect;
    sal_uInt8      nFarb;
    sal_uInt8      nFrb0=7;
diff --git a/vcl/source/filter/sgvmain.cxx b/vcl/source/filter/sgvmain.cxx
index 88020be..ca754c2 100644
--- a/vcl/source/filter/sgvmain.cxx
+++ b/vcl/source/filter/sgvmain.cxx
@@ -794,7 +794,7 @@ bool SgfFilterSDrw( SvStream& rInp, SgfHeader&, SgfEntry&, GDIMetaFile& rMtf )
{
    bool          bRet = false;
    PageType      aPage;
    ScopedVclPtr<VirtualDevice> aOutDev( new VirtualDevice() );
    ScopedVclPtrInstance< VirtualDevice > aOutDev;
    OutputDevice* pOutDev;
    sal_uLong         nStdPos;
    sal_uLong         nCharPos;
diff --git a/vcl/source/filter/sgvtext.cxx b/vcl/source/filter/sgvtext.cxx
index 19d4620..290ff14 100644
--- a/vcl/source/filter/sgvtext.cxx
+++ b/vcl/source/filter/sgvtext.cxx
@@ -660,7 +660,7 @@ void FormatLine(UCHAR* TBuf, sal_uInt16& Index, ObjTextType& Atr0, ObjTextType& 
                double, double,
                UCHAR* cLine, bool TextFit)
{
    ScopedVclPtr<VirtualDevice> vOut( new VirtualDevice() );
    ScopedVclPtrInstance< VirtualDevice > vOut;
    UCHAR        c,c0;
    bool         First;               // first char ?
    sal_uInt8    Just = 0;            // paragraph format
diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index 1e807f1..740ac49 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -236,8 +236,7 @@ WinMtfFontStyle::WinMtfFontStyle( LOGFONTW& rFont )
    {
        // #i117968# VirtualDevice is not thread safe, but filter is used in multithreading
        SolarMutexGuard aGuard;
        VclPtr<VirtualDevice> pVDev = new VirtualDevice();

        VclPtrInstance< VirtualDevice > pVDev;
        // converting the cell height into a font height
        aFont.SetSize( aFontSize );
        pVDev->SetFont( aFont );
@@ -1448,8 +1447,7 @@ void WinMtfOutput::DrawText( Point& rPosition, OUString& rText, long* pDXArry, b
    {
        // #i117968# VirtualDevice is not thread safe, but filter is used in multithreading
        SolarMutexGuard aGuard;
        VclPtr<VirtualDevice> pVDev = new VirtualDevice();

        VclPtrInstance< VirtualDevice > pVDev;
        sal_Int32 nTextWidth;
        pVDev->SetMapMode( MapMode( MAP_100TH_MM ) );
        pVDev->SetFont( maFont );
@@ -1497,8 +1495,7 @@ void WinMtfOutput::DrawText( Point& rPosition, OUString& rText, long* pDXArry, b
        {
            // #i117968# VirtualDevice is not thread safe, but filter is used in multithreading
            SolarMutexGuard aGuard;
            VclPtr<VirtualDevice> pVDev = new VirtualDevice();

            VclPtrInstance< VirtualDevice > pVDev;
            pDX = new long[ rText.getLength() ];
            pVDev->SetMapMode( MAP_100TH_MM );
            pVDev->SetFont( maLatestFont );
@@ -1516,7 +1513,7 @@ void WinMtfOutput::ImplDrawBitmap( const Point& rPos, const Size& rSize, const B
    BitmapEx aBmpEx( rBitmap );
    if ( mbComplexClip )
    {
        VclPtr<VirtualDevice> pVDev = new VirtualDevice();
        VclPtrInstance< VirtualDevice > pVDev;
        MapMode aMapMode( MAP_100TH_MM );
        aMapMode.SetOrigin( Point( -rPos.X(), -rPos.Y() ) );
        const Size aOutputSizePixel( pVDev->LogicToPixel( rSize, aMapMode ) );
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index 157e506..de3358c 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -706,7 +706,7 @@ BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize
    Size aStdSize( aStandardSize, aStandardSize );
    Rectangle aRect(aEmptyPoint, aStdSize );

    ScopedVclPtr<VirtualDevice> aVirDevice( new VirtualDevice(*Application::GetDefaultDevice(), 0, 1) );
    ScopedVclPtrInstance< VirtualDevice > aVirDevice( *Application::GetDefaultDevice(), 0, 1 );
    aVirDevice->SetOutputSizePixel( aStdSize );
    aVirDevice->SetFillColor( COL_TRANSPARENT );
    aVirDevice->SetLineColor( COL_TRANSPARENT );
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx
index c1b33ce..0c76698 100644
--- a/vcl/source/gdi/cvtsvm.cxx
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -498,7 +498,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )

    LineInfo            aLineInfo( LINE_NONE, 0 );
    ::std::stack< LineInfo* >    aLIStack;
    ScopedVclPtr<VirtualDevice>  aFontVDev( new VirtualDevice() );
    ScopedVclPtrInstance< VirtualDevice > aFontVDev;
    rtl_TextEncoding    eActualCharSet = osl_getThreadTextEncoding();
    bool                bFatLine = false;

@@ -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;
    ScopedVclPtr<VirtualDevice>  aSaveVDev( new VirtualDevice() );
    ScopedVclPtrInstance< VirtualDevice > aSaveVDev;
    Color               aLineCol( COL_BLACK );
    ::std::stack< Color* >  aLineColStack;

@@ -2311,7 +2311,7 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,

                {
                    // write actions for hatch
                    ScopedVclPtr<VirtualDevice> aVDev( new VirtualDevice() );
                    ScopedVclPtrInstance< VirtualDevice > aVDev;
                    GDIMetaFile     aTmpMtf;

                    aVDev->AddHatchActions( rPolyPoly, rHatch, aTmpMtf );
diff --git a/vcl/source/gdi/gdimetafiletools.cxx b/vcl/source/gdi/gdimetafiletools.cxx
index 4bb3240..1c19a11 100644
--- a/vcl/source/gdi/gdimetafiletools.cxx
+++ b/vcl/source/gdi/gdimetafiletools.cxx
@@ -161,7 +161,7 @@ namespace
        // in pixel mode for alpha channel painting (black is transparent,
        // white to paint 100% opacity)
        const Size aSizePixel(rBitmapEx.GetSizePixel());
        ScopedVclPtr<VirtualDevice> aVDev( new VirtualDevice() );
        ScopedVclPtrInstance< VirtualDevice > aVDev;

        aVDev->SetOutputSizePixel(aSizePixel);
        aVDev->EnableMapMode(false);
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 0720b7f..0eafc4f 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -723,7 +723,7 @@ void GDIMetaFile::Move( long nX, long nY )
{
    const Size      aBaseOffset( nX, nY );
    Size            aOffset( aBaseOffset );
    ScopedVclPtr<VirtualDevice> aMapVDev( new VirtualDevice() );
    ScopedVclPtrInstance< VirtualDevice > aMapVDev;

    aMapVDev->EnableOutput( false );
    aMapVDev->SetMapMode( GetPrefMapMode() );
@@ -757,7 +757,7 @@ void GDIMetaFile::Move( long nX, long nY, long nDPIX, long nDPIY )
{
    const Size      aBaseOffset( nX, nY );
    Size            aOffset( aBaseOffset );
    ScopedVclPtr<VirtualDevice> aMapVDev( new VirtualDevice() );
    ScopedVclPtrInstance< VirtualDevice > aMapVDev;

    aMapVDev->EnableOutput( false );
    aMapVDev->SetReferenceDevice( nDPIX, nDPIY );
@@ -825,7 +825,7 @@ void GDIMetaFile::Scale( const Fraction& rScaleX, const Fraction& rScaleY )
void GDIMetaFile::Clip( const Rectangle& i_rClipRect )
{
    Rectangle aCurRect( i_rClipRect );
    ScopedVclPtr<VirtualDevice> aMapVDev( new VirtualDevice() );
    ScopedVclPtrInstance< VirtualDevice > aMapVDev;

    aMapVDev->EnableOutput( false );
    aMapVDev->SetMapMode( GetPrefMapMode() );
@@ -892,7 +892,7 @@ void GDIMetaFile::ImplAddGradientEx( GDIMetaFile&         rMtf,
                                     const Gradient&      rGrad     )
{
    // Generate comment, GradientEx and Gradient actions (within DrawGradient)
    ScopedVclPtr<VirtualDevice> aVDev( new VirtualDevice( rMapDev, 0 ) );
    ScopedVclPtrInstance< VirtualDevice > aVDev(  rMapDev, 0  );
    aVDev->EnableOutput( false );
    GDIMetaFile aGradMtf;

@@ -917,7 +917,7 @@ void GDIMetaFile::Rotate( long nAngle10 )
    if( nAngle10 )
    {
        GDIMetaFile     aMtf;
        ScopedVclPtr<VirtualDevice> aMapVDev( new VirtualDevice() );
        ScopedVclPtrInstance< VirtualDevice > aMapVDev;
        const double    fAngle = F_PI1800 * nAngle10;
        const double    fSin = sin( fAngle );
        const double    fCos = cos( fAngle );
@@ -1400,7 +1400,7 @@ static void ImplActionBounds( Rectangle& o_rOutBounds,
Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, Rectangle* pHairline ) const
{
    GDIMetaFile     aMtf;
    ScopedVclPtr<VirtualDevice> aMapVDev( new VirtualDevice( i_rReference ) );
    ScopedVclPtrInstance< VirtualDevice > aMapVDev(  i_rReference  );

    aMapVDev->EnableOutput( false );
    aMapVDev->SetMapMode( GetPrefMapMode() );
@@ -2890,7 +2890,7 @@ 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
    ScopedVclPtr<VirtualDevice> aVDev( new VirtualDevice() );
    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() ) );
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index b7d7b36..0aace4e 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -467,7 +467,7 @@ Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters)
        if(maEx.IsEmpty())
        {
            // calculate size
            ScopedVclPtr<VirtualDevice> aVDev( new VirtualDevice() );
            ScopedVclPtrInstance< VirtualDevice > aVDev;
            Size aDrawSize(aVDev->LogicToPixel(maMetaFile.GetPrefSize(), maMetaFile.GetPrefMapMode()));

            if(rParameters.getSizePixel().Width() && rParameters.getSizePixel().Height())
diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx
index 6775985..bdb5f31 100644
--- a/vcl/source/gdi/impvect.cxx
+++ b/vcl/source/gdi/impvect.cxx
@@ -717,7 +717,7 @@ bool ImplVectorize( const Bitmap& rColorBmp, GDIMetaFile& rMtf,
        if( rMtf.GetActionSize() )
        {
            MapMode         aMap( MAP_100TH_MM );
            ScopedVclPtr<VirtualDevice> aVDev( new VirtualDevice() );
            ScopedVclPtrInstance< VirtualDevice > aVDev;
            const Size      aLogSize1( aVDev->PixelToLogic( Size( 1, 1 ), aMap ) );

            rMtf.SetPrefMapMode( aMap );
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index e7edf47..ba5a0bf 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -10938,7 +10938,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject )
    sal_Int32 nFunctionObject = createObject();
    CHECK_RETURN( updateObject( nFunctionObject ) );

    ScopedVclPtr<VirtualDevice> aDev( new VirtualDevice() );
    ScopedVclPtrInstance< VirtualDevice > aDev;
    aDev->SetOutputSizePixel( rObject.m_aSize );
    aDev->SetMapMode( MapMode( MAP_PIXEL ) );
    if( m_aContext.ColorMode == PDFWriter::DrawGreyscale )
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index c632f29..74db239 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -431,7 +431,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
                        if ( nPixelX && nPixelY )
                        {
                            Size aDstSizePixel( nPixelX, nPixelY );
                            ScopedVclPtr<VirtualDevice> xVDev(new VirtualDevice);
                            ScopedVclPtrInstance<VirtualDevice> xVDev;
                            if( xVDev->SetOutputSizePixel( aDstSizePixel ) )
                            {
                                Bitmap          aPaint, aMask;
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index f66c139..9e363aa 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -728,7 +728,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, 
        ConnectedComponents aBackgroundComponent;

        // create an OutputDevice to record mapmode changes and the like
        ScopedVclPtr<VirtualDevice> aMapModeVDev( new VirtualDevice() );
        ScopedVclPtrInstance< VirtualDevice > aMapModeVDev;
        aMapModeVDev->mnDPIX = mnDPIX;
        aMapModeVDev->mnDPIY = mnDPIY;
        aMapModeVDev->EnableOutput(false);
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index d3f5211..56809da 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -321,7 +321,7 @@ void Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController,
    if (!xController->getPrinter())
    {
        OUString aPrinterName( i_rInitSetup.GetPrinterName() );
        VclPtr<Printer> xPrinter( new Printer( aPrinterName ) );
        VclPtrInstance<Printer> xPrinter( aPrinterName );
        xPrinter->SetJobSetup(i_rInitSetup);
        xController->setPrinter(xPrinter);
    }
@@ -472,7 +472,7 @@ void Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController,
    {
        try
        {
            ScopedVclPtrInstance<PrintDialog> aDlg( nullptr, xController );
            ScopedVclPtrInstance< PrintDialog > aDlg( nullptr, xController );
            if( ! aDlg->Execute() )
            {
                xController->abortJob();
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 289fb1b..8ee76b8 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -410,7 +410,7 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const
                // If the visible part has been clipped, we have to create a
                // Bitmap with the correct size in which we copy the clipped
                // Bitmap to the correct position.
                ScopedVclPtr<VirtualDevice> aVDev( new VirtualDevice( *this ) );
                ScopedVclPtrInstance< VirtualDevice > aVDev(  *this  );

                if ( aVDev->SetOutputSizePixel( aRect.GetSize() ) )
                {
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 62a92f4..acbfd4b 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -2493,7 +2493,7 @@ bool OutputDevice::GetTextBoundRect( Rectangle& rRect,

    // fall back to bitmap method to get the bounding rectangle,
    // so we need a monochrome virtual device with matching font
    ScopedVclPtr<VirtualDevice> aVDev(new VirtualDevice( 1 ));
    ScopedVclPtrInstance< VirtualDevice > aVDev(  1  );
    vcl::Font aFont( GetFont() );
    aFont.SetShadow( false );
    aFont.SetOutline( false );
@@ -2717,7 +2717,7 @@ bool OutputDevice::GetTextOutlines( ::basegfx::B2DPolyPolygonVector& rVector,
        + mnEmphasisDescent;
    pSalLayout->Release();

    ScopedVclPtr<VirtualDevice> aVDev(new VirtualDevice(1));
    ScopedVclPtrInstance< VirtualDevice > aVDev( 1 );

    vcl::Font aFont(GetFont());
    aFont.SetShadow(false);
diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx
index 81e8d8c..9f160f7 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -431,7 +431,7 @@ void OutputDevice::EmulateDrawTransparent ( const tools::PolyPolygon& rPolyPoly,

        if( !bDrawn )
        {
            ScopedVclPtr<VirtualDevice> aVDev( new VirtualDevice( *this, 1 ) );
            ScopedVclPtrInstance< VirtualDevice > aVDev(  *this, 1  );
            const Size aDstSz( aDstRect.GetSize() );
            const sal_uInt8 cTrans = (sal_uInt8) MinMax( FRound( nTransparencePercent * 2.55 ), 0, 255 );

@@ -682,7 +682,7 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,

        if( !aDstRect.IsEmpty() )
        {
            ScopedVclPtrInstance<VirtualDevice> xVDev;
            ScopedVclPtrInstance< VirtualDevice > xVDev;

            ((OutputDevice*)xVDev.get())->mnDPIX = mnDPIX;
            ((OutputDevice*)xVDev.get())->mnDPIY = mnDPIY;
diff --git a/vcl/source/outdev/wallpaper.cxx b/vcl/source/outdev/wallpaper.cxx
index 5d01f31..ba7928b 100644
--- a/vcl/source/outdev/wallpaper.cxx
+++ b/vcl/source/outdev/wallpaper.cxx
@@ -129,7 +129,7 @@ void OutputDevice::DrawBitmapWallpaper( long nX, long nY,
        {
            if( !pCached && !rWallpaper.GetColor().GetTransparency() )
            {
                ScopedVclPtr<VirtualDevice> aVDev( new VirtualDevice( *this ) );
                ScopedVclPtrInstance< VirtualDevice > aVDev(  *this  );
                aVDev->SetBackground( rWallpaper.GetColor() );
                aVDev->SetOutputSizePixel( Size( nBmpWidth, nBmpHeight ) );
                aVDev->DrawBitmapEx( Point(), aBmpEx );
diff --git a/vcl/source/uipreviewer/previewer.cxx b/vcl/source/uipreviewer/previewer.cxx
index 2007429..bb93b12 100644
--- a/vcl/source/uipreviewer/previewer.cxx
+++ b/vcl/source/uipreviewer/previewer.cxx
@@ -68,8 +68,7 @@ int UIPreviewApp::Main()

    try
    {
        VclPtr<Dialog> pDialog = new Dialog(DIALOG_NO_PARENT, WB_STDDIALOG | WB_SIZEABLE);

        VclPtrInstance<Dialog> pDialog(DIALOG_NO_PARENT, WB_STDDIALOG | WB_SIZEABLE);
        {
            VclBuilder aBuilder(pDialog, OUString(), uifiles[0]);
            vcl::Window *pRoot = aBuilder.get_widget_root();
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index e6cb65a..21532c3 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1770,7 +1770,7 @@ vcl::Window *VclBuilder::makeObject(vcl::Window *pParent, const OString &name, c
    SAL_WARN_IF(!pWindow, "vcl.layout", "probably need to implement " << name.getStr() << " or add a make" << name.getStr() << " function");
    if (pWindow)
    {
        VclPtr< Window > xWindow( pWindow, SAL_NO_ACQUIRE );
        VclPtr< vcl::Window > xWindow( pWindow, SAL_NO_ACQUIRE );
        pWindow->SetHelpId(m_sHelpRoot + id);
        SAL_INFO("vcl.layout", "for " << name.getStr() <<
            ", created " << pWindow << " child of " <<
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 0e29d4a..54fb42d 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1092,7 +1092,7 @@ void Dialog::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal

    if (!( GetStyle() & WB_NOBORDER ))
    {
        ScopedVclPtr<ImplBorderWindow> aImplWin( new ImplBorderWindow(this, WB_BORDER|WB_STDWORK, BORDERWINDOW_STYLE_OVERLAP) );
        ScopedVclPtrInstance< ImplBorderWindow > aImplWin( this, WB_BORDER|WB_STDWORK, BORDERWINDOW_STYLE_OVERLAP );
        aImplWin->SetText( GetText() );
        aImplWin->setPosSizePixel( aPos.X(), aPos.Y(), aSize.Width(), aSize.Height() );
        aImplWin->SetDisplayActive( true );
diff --git a/vcl/workben/svdem.cxx b/vcl/workben/svdem.cxx
index f2cdb6e..e349934 100644
--- a/vcl/workben/svdem.cxx
+++ b/vcl/workben/svdem.cxx
@@ -81,7 +81,7 @@ public:

void Main()
{
    ScopedVclPtr<MyWin> aMainWin(new MyWin(NULL, WB_APP | WB_STDWORK) );
    ScopedVclPtrInstance< MyWin > aMainWin( nullptr, WB_APP | WB_STDWORK );
    aMainWin->SetText(OUString("VCL - Workbench"));
    aMainWin->Show();

diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx
index cda0b34..428cfa7 100644
--- a/vcl/workben/svpclient.cxx
+++ b/vcl/workben/svpclient.cxx
@@ -121,7 +121,7 @@ public:

void Main()
{
    ScopedVclPtr<MyWin> aMainWin(new MyWin(NULL, WB_STDWORK) );
    ScopedVclPtrInstance< MyWin > aMainWin( nullptr, WB_STDWORK );
    aMainWin->SetText( OUString( "SvpClient" ) );
    aMainWin->Show();

diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx
index 70c769b..ac2c552 100644
--- a/vcl/workben/svptest.cxx
+++ b/vcl/workben/svptest.cxx
@@ -91,7 +91,7 @@ public:

void Main()
{
    ScopedVclPtr<MyWin> aMainWin(new MyWin(NULL, WB_APP | WB_STDWORK) );
    ScopedVclPtrInstance< MyWin > aMainWin( nullptr, WB_APP | WB_STDWORK );
    aMainWin->SetText( OUString( "VCL - Workbench" ) );
    aMainWin->Show();