include/vcl/vclptr.hxx               |   11 ++++++-----
 vcl/generic/print/genprnpsp.cxx      |    2 +-
 vcl/generic/print/prtsetup.cxx       |    2 +-
 vcl/qa/cppunit/lifecycle.cxx         |    7 +++----
 vcl/qa/cppunit/outdev.cxx            |    2 +-
 vcl/source/app/dbggui.cxx            |    8 ++++----
 vcl/source/app/stdtext.cxx           |    2 +-
 vcl/source/app/svdata.cxx            |    2 +-
 vcl/source/control/edit.cxx          |    4 ++--
 vcl/source/filter/graphicfilter.cxx  |    2 +-
 vcl/source/filter/sgfbram.cxx        |    2 +-
 vcl/source/filter/sgvmain.cxx        |    2 +-
 vcl/source/filter/sgvtext.cxx        |    2 +-
 vcl/source/filter/wmf/winmtf.cxx     |   11 ++++-------
 vcl/source/gdi/bitmapex.cxx          |    2 +-
 vcl/source/gdi/cvtsvm.cxx            |    6 +++---
 vcl/source/gdi/gdimetafiletools.cxx  |    2 +-
 vcl/source/gdi/gdimtf.cxx            |   14 +++++++-------
 vcl/source/gdi/impanmvw.cxx          |    2 +-
 vcl/source/gdi/impgraph.cxx          |    2 +-
 vcl/source/gdi/impvect.cxx           |    2 +-
 vcl/source/gdi/pdfwriter_impl.cxx    |    2 +-
 vcl/source/gdi/pdfwriter_impl2.cxx   |    2 +-
 vcl/source/gdi/print2.cxx            |    6 +++---
 vcl/source/gdi/print3.cxx            |   14 ++++++++------
 vcl/source/outdev/bitmap.cxx         |    2 +-
 vcl/source/outdev/map.cxx            |    3 +--
 vcl/source/outdev/text.cxx           |    4 ++--
 vcl/source/outdev/transparent.cxx    |    4 ++--
 vcl/source/outdev/wallpaper.cxx      |    2 +-
 vcl/source/uipreviewer/previewer.cxx |    3 +--
 vcl/source/window/builder.cxx        |    3 ++-
 vcl/source/window/dialog.cxx         |    2 +-
 vcl/source/window/window.cxx         |    1 -
 vcl/workben/svdem.cxx                |    2 +-
 vcl/workben/svpclient.cxx            |    2 +-
 vcl/workben/svptest.cxx              |    2 +-
 vcl/workben/vcldemo.cxx              |    2 +-
 38 files changed, 71 insertions(+), 74 deletions(-)

New commits:
commit 309343a20873772df2a05c52dc56e857c7ca3ecb
Author: Michael Meeks <michael.me...@collabora.com>
Date:   Tue Mar 31 20:25:31 2015 +0100

    vcl: stop vcl::Window clobbering mnRefCnt itself.
    
    Change-Id: If1926c8ecc94c3b9786a3f255371b440c482a155

diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx
index cbe0ef6..5f5f4e3 100644
--- a/vcl/qa/cppunit/lifecycle.cxx
+++ b/vcl/qa/cppunit/lifecycle.cxx
@@ -68,8 +68,7 @@ void LifecycleTest::testVirtualDevice()
 
 void LifecycleTest::testMultiDispose()
 {
-    VclPtrInstance<WorkWindow> xWin((vcl::Window *)NULL,
-                                    WB_APP|WB_STDWORK);
+    VclPtrInstance<WorkWindow> xWin(nullptr, WB_APP|WB_STDWORK);
     CPPUNIT_ASSERT(xWin.get() != NULL);
     xWin->disposeOnce();
     xWin->disposeOnce();
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index c80e180..fb8b6f1 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1211,7 +1211,6 @@ void Window::ImplInitAppFontData( vcl::Window* pWindow )
 
 void Window::ImplInitWindowData( WindowType nType )
 {
-    mnRefCnt = 0;
     mpWindowImpl = new WindowImpl( nType );
 
     meOutDevType        = OUTDEV_WINDOW;
commit 2170610f68cb3f69001820164a21edd44d0feb54
Author: Michael Meeks <michael.me...@collabora.com>
Date:   Mon Mar 30 22:38:15 2015 +0100

    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 d4e9cbb..5cb6478 100644
--- a/vcl/generic/print/genprnpsp.cxx
+++ b/vcl/generic/print/genprnpsp.cxx
@@ -143,7 +143,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 4442979..d0d23c5 100644
--- a/vcl/generic/print/prtsetup.cxx
+++ b/vcl/generic/print/prtsetup.cxx
@@ -509,7 +509,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 8377a19..e2085b7 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 d43c9bc..c75444d 100644
--- a/vcl/source/app/dbggui.cxx
+++ b/vcl/source/app/dbggui.cxx
@@ -370,7 +370,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 )
@@ -834,7 +834,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 cb779cd..a10f66a 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -166,7 +166,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 ca65435..6bbcf26 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 04acf2f..30e234f 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1889,7 +1889,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 575eb29..bea8b28 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 d02c2f9..492878b2 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 fe83362..d0ecf0c 100644
--- a/vcl/source/filter/sgvtext.cxx
+++ b/vcl/source/filter/sgvtext.cxx
@@ -664,7 +664,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;
     UCHAR        ct;
     bool         First;               // first char ?
diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index ce43576..1bc7b67 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -230,8 +230,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 );
@@ -1436,8 +1435,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 );
@@ -1485,8 +1483,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 );
@@ -1504,7 +1501,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 d6e3f4c..4c2635f 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -705,7 +705,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 3e7b937..167fecc 100644
--- a/vcl/source/gdi/cvtsvm.cxx
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -479,7 +479,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;
 
@@ -1355,7 +1355,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;
 
@@ -2292,7 +2292,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 ec6c17a..2d80d06 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 4a3c6d6..19b907b 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/impanmvw.cxx b/vcl/source/gdi/impanmvw.cxx
index 913c9c7..963e451 100644
--- a/vcl/source/gdi/impanmvw.cxx
+++ b/vcl/source/gdi/impanmvw.cxx
@@ -154,7 +154,7 @@ void ImplAnimView::getPosSize( const AnimationBitmap& rAnm, 
Point& rPosPix, Size
 
 void ImplAnimView::drawToPos( sal_uLong nPos )
 {
-    ScopedVclPtr<VirtualDevice> aVDev( new VirtualDevice() );
+    ScopedVclPtrInstance< VirtualDevice > aVDev;
     boost::scoped_ptr<vcl::Region> pOldClip(!maClip.IsNull() ? new 
vcl::Region( mpOut->GetClipRegion() ) : NULL);
 
     aVDev->SetOutputSizePixel( maSzPix, false );
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index eaade7c..82d6f44 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 adde24c..d2cc046 100644
--- a/vcl/source/gdi/impvect.cxx
+++ b/vcl/source/gdi/impvect.cxx
@@ -712,7 +712,7 @@ bool ImplVectorizer::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 1234821..33b1428 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9672,7 +9672,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 e7bd366..ce3d4f6 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> pVDev(new 
VirtualDevice);
+                            ScopedVclPtrInstance< VirtualDevice > pVDev;
                             if( pVDev->SetOutputSizePixel( aDstSizePixel ) )
                             {
                                 Bitmap          aPaint, aMask;
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index 9d63e70..2a27213 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 688d360..139d768 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -328,7 +328,7 @@ void Printer::ImplPrintJob( const 
boost::shared_ptr<PrinterController>& i_pContr
     if( ! pController->getPrinter() )
     {
         OUString aPrinterName( i_rInitSetup.GetPrinterName() );
-        VclPtr<Printer> pPrinter( new Printer( aPrinterName ) );
+        VclPtrInstance< Printer > pPrinter(  aPrinterName  );
         pPrinter->SetJobSetup( i_rInitSetup );
         pController->setPrinter( pPrinter );
     }
@@ -479,7 +479,7 @@ void Printer::ImplPrintJob( const 
boost::shared_ptr<PrinterController>& i_pContr
     {
         try
         {
-            ScopedVclPtr<PrintDialog> aDlg(new PrintDialog( NULL, 
i_pController ));
+            ScopedVclPtrInstance< PrintDialog > aDlg(  nullptr, i_pController  
);
             if( ! aDlg->Execute() )
             {
                 i_pController->abortJob();
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index ab527d0..de3c7d3 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 1409a5a..a19201c 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -2464,7 +2464,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 );
@@ -2685,7 +2685,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 9d782c5..add1bda 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() )
         {
-            ScopedVclPtr<VirtualDevice> pVDev(new VirtualDevice);
+            ScopedVclPtrInstance< VirtualDevice > pVDev;
 
             ((OutputDevice*)pVDev.get())->mnDPIX = mnDPIX;
             ((OutputDevice*)pVDev.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 e28f0b0..32a2ab3 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1704,7 +1704,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 4bca694..89d00c2 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1137,7 +1137,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 b71c7a7..e56f0df 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 6e8edce..e5ddaf0 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();
 
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index 8db41bf..f031b0a 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -1357,7 +1357,7 @@ public:
                     bWidgets = true;
             }
 
-            ScopedVclPtr<DemoWin> aMainWin(new DemoWin(aRenderer));
+            ScopedVclPtrInstance< DemoWin > aMainWin( aRenderer );
             VclPtr<DemoWidgets> aWidgets;
 
             aMainWin->SetText("Interactive VCL demo #1");
commit ef8fac692ac79a90f7d35b85ac166adc5b62455c
Author: Michael Meeks <michael.me...@collabora.com>
Date:   Mon Mar 30 21:49:04 2015 +0100

    Convert more sites to VclPtrInstance.
    
    Change-Id: I364c5eb176d5003deb1938810cccf4f2aaedbd59

diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx
index 7c1b1c2..cbe0ef6 100644
--- a/vcl/qa/cppunit/lifecycle.cxx
+++ b/vcl/qa/cppunit/lifecycle.cxx
@@ -68,8 +68,8 @@ void LifecycleTest::testVirtualDevice()
 
 void LifecycleTest::testMultiDispose()
 {
-    VclPtr<WorkWindow> xWin(new WorkWindow((vcl::Window *)NULL,
-                                           WB_APP|WB_STDWORK));
+    VclPtrInstance<WorkWindow> xWin((vcl::Window *)NULL,
+                                    WB_APP|WB_STDWORK);
     CPPUNIT_ASSERT(xWin.get() != NULL);
     xWin->disposeOnce();
     xWin->disposeOnce();
@@ -122,8 +122,8 @@ public:
 
 void LifecycleTest::testChildDispose()
 {
-    VclPtr<WorkWindow> xWin(new WorkWindow((vcl::Window *)NULL,
-                                                 WB_APP|WB_STDWORK));
+    VclPtrInstance<WorkWindow> xWin((vcl::Window *)NULL,
+                                    WB_APP|WB_STDWORK);
     CPPUNIT_ASSERT(xWin.get() != NULL);
     VclPtr<DisposableChild> xChild(new DisposableChild(xWin.get()));
     xWin->Show();
diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx
index db0e6c5..d43c9bc 100644
--- a/vcl/source/app/dbggui.cxx
+++ b/vcl/source/app/dbggui.cxx
@@ -355,9 +355,9 @@ IMPL_LINK( DbgDialog, ClickHdl, Button*, pButton )
         }
         if( (aData.nTestFlags & ~IMMEDIATE_FLAGS) != (pData->nTestFlags & 
~IMMEDIATE_FLAGS) )
         {
-            ScopedVclPtr<MessageDialog> aBox(new MessageDialog(this, OUString(
+            ScopedVclPtrInstance<MessageDialog> aBox(this, OUString(
                 "Some of the changed settings will only be active after "
-                "restarting the process"), VCL_MESSAGE_INFO));
+                "restarting the process"), VCL_MESSAGE_INFO);
             aBox->Execute();
         }
         EndDialog( RET_OK );
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index 60b3e16..9d63e70 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -1155,10 +1155,10 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( 
const GDIMetaFile& rInMtf,
                         Point           aDstPtPix( aBoundRect.TopLeft() );
                         Size            aDstSzPix;
 
-                        ScopedVclPtr<VirtualDevice> aMapVDev( new 
VirtualDevice() );   // here, we record only mapmode information
+                        ScopedVclPtrInstance<VirtualDevice> aMapVDev;   // 
here, we record only mapmode information
                         aMapVDev->EnableOutput(false);
 
-                        ScopedVclPtr<VirtualDevice> aPaintVDev( new 
VirtualDevice() ); // into this one, we render.
+                        ScopedVclPtrInstance<VirtualDevice> aPaintVDev; // 
into this one, we render.
                         aPaintVDev->SetBackground( 
aBackgroundComponent.aBgColor );
 
                         rOutMtf.AddAction( new MetaPushAction( 
PushFlags::MAPMODE ) );
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 69a20d0..688d360 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -312,8 +312,9 @@ void Printer::ImplPrintJob( const 
boost::shared_ptr<PrinterController>& i_pContr
              // && ! pController->isDirectPrint()
            )
         {
-            ScopedVclPtr<MessageDialog> aBox(new MessageDialog(NULL, 
"ErrorNoPrinterDialog",
-                "vcl/ui/errornoprinterdialog.ui"));
+            ScopedVclPtrInstance<MessageDialog> aBox(
+                nullptr, "ErrorNoPrinterDialog",
+                "vcl/ui/errornoprinterdialog.ui");
             aBox->Execute();
         }
         pController->setValue( OUString( "IsDirect" ),
@@ -461,8 +462,9 @@ void Printer::ImplPrintJob( const 
boost::shared_ptr<PrinterController>& i_pContr
     {
         if( pController->getFilteredPageCount() == 0 )
         {
-            ScopedVclPtr<MessageDialog> aBox(new MessageDialog(NULL, 
"ErrorNoContentDialog",
-                "vcl/ui/errornocontentdialog.ui"));
+            ScopedVclPtrInstance<MessageDialog> aBox(
+                nullptr, "ErrorNoContentDialog",
+                "vcl/ui/errornocontentdialog.ui");
             aBox->Execute();
             return;
         }
diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index dc57390..86b5197 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -228,9 +228,8 @@ static void ImplCalcMapResolution( const MapMode& rMapMode,
                     vcl::Window::ImplInitAppFontData( 
pSVData->maWinData.mpFirstFrame );
                 else
                 {
-                    VclPtr<WorkWindow> pWin = new WorkWindow( NULL, 0 );
+                    ScopedVclPtrInstance<WorkWindow> pWin( nullptr, 0 );
                     vcl::Window::ImplInitAppFontData( pWin );
-                    pWin.disposeAndClear();
                 }
             }
             rMapRes.mnMapScNumX   = pSVData->maGDIData.mnAppFontX;
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index c54a551..e28f0b0 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1704,6 +1704,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 );
         pWindow->SetHelpId(m_sHelpRoot + id);
         SAL_INFO("vcl.layout", "for " << name.getStr() <<
             ", created " << pWindow << " child of " <<
@@ -1711,7 +1712,7 @@ vcl::Window *VclBuilder::makeObject(vcl::Window *pParent, 
const OString &name, c
             pWindow->mpWindowImpl->mpRealParent.get() << "/" <<
             pWindow->mpWindowImpl->mpBorderWindow.get() << ") with helpid " <<
             pWindow->GetHelpId().getStr());
-        m_aChildren.push_back(WinAndId(id, pWindow, bVertical));
+        m_aChildren.push_back(WinAndId(id, xWindow, bVertical));
     }
     return pWindow;
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to