diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-04-20 15:35:54 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-20 15:35:54 +0100 |
commit | 4fed8865be56ac431fb91e2432c6e93ce3f781c7 (patch) | |
tree | 67b0982f8910bc8bfbc92cb6245520a26f6366dc /vcl | |
parent | f12488405cdfd8555078d15807aafc5ffd1b037b (diff) |
vcl: convert new to ::Create
Change-Id: Ifd52953086ea923fa1770892d13f32c2263aec54
Diffstat (limited to 'vcl')
44 files changed, 112 insertions, 112 deletions
diff --git a/vcl/generic/print/prtsetup.cxx b/vcl/generic/print/prtsetup.cxx index b44678700f28..738d00de721a 100644 --- a/vcl/generic/print/prtsetup.cxx +++ b/vcl/generic/print/prtsetup.cxx @@ -117,9 +117,9 @@ IMPL_LINK( RTSDialog, ActivatePage, TabControl*, pTabCtrl ) { TabPage *pPage = NULL; if (sPage == "paper") - pPage = m_pPaperPage = new RTSPaperPage( this ); + pPage = m_pPaperPage = VclPtr<RTSPaperPage>::Create( this ); else if (sPage == "device") - pPage = m_pDevicePage = new RTSDevicePage( this ); + pPage = m_pDevicePage = VclPtr<RTSDevicePage>::Create( this ); if( pPage ) m_pTabControl->SetTabPage( nId, pPage ); } diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx index a6330e4880c8..7e3550bf2c43 100644 --- a/vcl/qa/cppunit/complextext.cxx +++ b/vcl/qa/cppunit/complextext.cxx @@ -43,10 +43,10 @@ void VclComplexTextTest::testArabic() OUString aOneTwoThree( reinterpret_cast<char const *>(pOneTwoThreeUTF8), SAL_N_ELEMENTS( pOneTwoThreeUTF8 ) - 1, RTL_TEXTENCODING_UTF8 ); - vcl::Window* pWin = new WorkWindow( (vcl::Window *)NULL ); + VclPtr<vcl::Window> pWin = VclPtr<WorkWindow>::Create( (vcl::Window *)nullptr ); CPPUNIT_ASSERT( pWin != NULL ); - OutputDevice *pOutDev = static_cast< OutputDevice * >( pWin ); + OutputDevice *pOutDev = static_cast< OutputDevice * >( pWin.get() ); vcl::Font aFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_SPREADSHEET, diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx index cb0b0a208ebc..80687af4bb65 100644 --- a/vcl/qa/cppunit/outdev.cxx +++ b/vcl/qa/cppunit/outdev.cxx @@ -73,7 +73,7 @@ void VclOutdevTest::testVirtualDevice() CPPUNIT_ASSERT_EQUAL(COL_WHITE, Color(pAcc->GetPixel(31,30)).GetColor()); #if 0 - vcl::Window* pWin = new WorkWindow( (vcl::Window *)NULL ); + VclPtr<vcl::Window> pWin = VclPtr<WorkWindow>::Create( (vcl::Window *)nullptr ); CPPUNIT_ASSERT( pWin != NULL ); OutputDevice *pOutDev = static_cast< OutputDevice * >( pWin ); #endif diff --git a/vcl/quartz/cairo_quartz_cairo.cxx b/vcl/quartz/cairo_quartz_cairo.cxx index cec50a21b60d..0b0835c8fb05 100644 --- a/vcl/quartz/cairo_quartz_cairo.cxx +++ b/vcl/quartz/cairo_quartz_cairo.cxx @@ -250,7 +250,7 @@ namespace cairo aSystemGraphicsData.nSize = sizeof(SystemGraphicsData); aSystemGraphicsData.rCGContext = getCGContext(); return VclPtr<VirtualDevice>( - new VirtualDevice( &aSystemGraphicsData, Size(1, 1), getDepth() )); + VclPtr<VirtualDevice>::Create( &aSystemGraphicsData, Size(1, 1), getDepth() )); } } // namespace cairo diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx index a3578fbd4afd..e8d27ae769eb 100644 --- a/vcl/source/app/dbggui.cxx +++ b/vcl/source/app/dbggui.cxx @@ -244,13 +244,13 @@ private: DbgDialog::DbgDialog() : ModalDialog( NULL, WB_STDMODAL | WB_SYSTEMWINDOW ), - maRes(new CheckBox(this)), - maDialog(new CheckBox(this)), - maBoldAppFont(new CheckBox(this)), - maBox3(new GroupBox(this)), - maOKButton(new OKButton(this, WB_DEFBUTTON)), - maCancelButton(new CancelButton(this)), - maHelpButton(new HelpButton(this)) + maRes(VclPtr<CheckBox>::Create(this)), + maDialog(VclPtr<CheckBox>::Create(this)), + maBoldAppFont(VclPtr<CheckBox>::Create(this)), + maBox3(VclPtr<GroupBox>::Create(this)), + maOKButton(VclPtr<OKButton>::Create(this, WB_DEFBUTTON)), + maCancelButton(VclPtr<CancelButton>::Create(this)), + maHelpButton(VclPtr<HelpButton>::Create(this)) { DbgData* pData = DbgGetData(); MapMode aAppMap( MAP_APPFONT ); @@ -397,8 +397,8 @@ void DbgDialog::dispose() DbgInfoDialog::DbgInfoDialog( vcl::Window* pParent, bool bHelpText ) : ModalDialog( pParent, WB_STDMODAL ), - maListBox(new ListBox( this, WB_BORDER | WB_AUTOHSCROLL )), - maOKButton(new OKButton(this, WB_DEFBUTTON)) + maListBox(VclPtr<ListBox>::Create( this, WB_BORDER | WB_AUTOHSCROLL )), + maOKButton(VclPtr<OKButton>::Create(this, WB_DEFBUTTON)) { mbHelpText = bHelpText; diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx index c13acfa7e113..8812ee4bf3f1 100644 --- a/vcl/source/app/help.cxx +++ b/vcl/source/app/help.cxx @@ -204,9 +204,9 @@ sal_uIntPtr Help::ShowTip( vcl::Window* pParent, const Rectangle& rScreenRect, const OUString& rText, sal_uInt16 nStyle ) { sal_uInt16 nHelpWinStyle = ( ( nStyle & QUICKHELP_TIP_STYLE_BALLOON ) != 0 ) ? HELPWINSTYLE_BALLOON : HELPWINSTYLE_QUICK; - HelpTextWindow* pHelpWin = new HelpTextWindow( pParent, rText, nHelpWinStyle, nStyle ); + VclPtrInstance<HelpTextWindow> pHelpWin( pParent, rText, nHelpWinStyle, nStyle ); - sal_uIntPtr nId = reinterpret_cast< sal_uIntPtr >( pHelpWin ); + sal_uIntPtr nId = reinterpret_cast< sal_uIntPtr >( pHelpWin.get() ); UpdateTip( nId, pParent, rScreenRect, rText ); pHelpWin->ShowHelp( HELPDELAY_NONE ); @@ -530,7 +530,7 @@ void ImplShowHelpWindow( vcl::Window* pParent, sal_uInt16 nHelpWinStyle, sal_uIn nDelayMode = HELPDELAY_NONE; DBG_ASSERT( !pHelpWin, "Noch ein HelpWin ?!" ); - pHelpWin = new HelpTextWindow( pParent, rHelpText, nHelpWinStyle, nStyle ); + pHelpWin = VclPtr<HelpTextWindow>::Create( pParent, rHelpText, nHelpWinStyle, nStyle ); pSVData->maHelpData.mpHelpWin = pHelpWin; pHelpWin->SetStatusText( rStatusText ); if ( pHelpArea ) diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index 3a4920ac4921..14cf94de9dd2 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -136,7 +136,7 @@ vcl::Window* ImplGetDefaultWindow() if ( !pSVData->mpDefaultWin && !pSVData->mbDeInit ) { DBG_WARNING( "ImplGetDefaultWindow(): No AppWindow" ); - pSVData->mpDefaultWin = new WorkWindow( 0, WB_DEFAULTWIN ); + pSVData->mpDefaultWin = VclPtr<WorkWindow>::Create( nullptr, WB_DEFAULTWIN ); pSVData->mpDefaultWin->SetText( OUString( "VCL ImplGetDefaultWindow" ) ); // Add a reference to the default context so it never gets deleted diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 2c785078841b..94b8f3cfaa36 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -147,11 +147,11 @@ void ComboBox::ImplInit( vcl::Window* pParent, WinBits nStyle ) WinBits nListStyle = nStyle; if( nStyle & WB_DROPDOWN ) { - mpFloatWin = new ImplListBoxFloatingWindow( this ); + mpFloatWin = VclPtr<ImplListBoxFloatingWindow>::Create( this ); mpFloatWin->SetAutoWidth( true ); mpFloatWin->SetPopupModeEndHdl( LINK( this, ComboBox, ImplPopupModeEndHdl ) ); - mpBtn = new ImplBtn( this, WB_NOLIGHTBORDER | WB_RECTSTYLE ); + mpBtn = VclPtr<ImplBtn>::Create( this, WB_NOLIGHTBORDER | WB_RECTSTYLE ); ImplInitDropDownButton( mpBtn ); mpBtn->buttonDownSignal.connect( boost::bind( &ComboBox::ImplClickButtonHandler, this, _1 )); mpBtn->Show(); @@ -170,7 +170,7 @@ void ComboBox::ImplInit( vcl::Window* pParent, WinBits nStyle ) } } - mpSubEdit.set( new Edit( this, nEditStyle ) ); + mpSubEdit.set( VclPtr<Edit>::Create( this, nEditStyle ) ); mpSubEdit->EnableRTL( false ); SetSubEdit( mpSubEdit ); mpSubEdit->SetPosPixel( Point() ); @@ -180,7 +180,7 @@ void ComboBox::ImplInit( vcl::Window* pParent, WinBits nStyle ) vcl::Window* pLBParent = this; if ( mpFloatWin ) pLBParent = mpFloatWin; - mpImplLB = new ImplListBox( pLBParent, nListStyle|WB_SIMPLEMODE|WB_AUTOHSCROLL ); + mpImplLB = VclPtr<ImplListBox>::Create( pLBParent, nListStyle|WB_SIMPLEMODE|WB_AUTOHSCROLL ); mpImplLB->SetPosPixel( Point() ); mpImplLB->SetSelectHdl( LINK( this, ComboBox, ImplSelectHdl ) ); mpImplLB->SetCancelHdl( LINK( this, ComboBox, ImplCancelHdl ) ); diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index dc09182ffd5c..83d76a3c8b7f 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -2141,16 +2141,16 @@ sal_uInt16 ImplListBoxWindow::ImplGetTextStyle() const ImplListBox::ImplListBox( vcl::Window* pParent, WinBits nWinStyle ) : Control( pParent, nWinStyle ), - maLBWindow(new ImplListBoxWindow( this, nWinStyle&(~WB_BORDER) )) + maLBWindow(VclPtr<ImplListBoxWindow>::Create( this, nWinStyle&(~WB_BORDER) )) { maLBWindow->userDrawSignal.connect( userDrawSignal ); // for native widget rendering we must be able to detect this window type SetType( WINDOW_LISTBOXWINDOW ); - mpVScrollBar = new ScrollBar( this, WB_VSCROLL | WB_DRAG ); - mpHScrollBar = new ScrollBar( this, WB_HSCROLL | WB_DRAG ); - mpScrollBarBox = new ScrollBarBox( this ); + mpVScrollBar = VclPtr<ScrollBar>::Create( this, WB_VSCROLL | WB_DRAG ); + mpHScrollBar = VclPtr<ScrollBar>::Create( this, WB_HSCROLL | WB_DRAG ); + mpScrollBarBox = VclPtr<ScrollBarBox>::Create( this ); Link aLink( LINK( this, ImplListBox, ScrollBarHdl ) ); mpVScrollBar->SetScrollHdl( aLink ); diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 03af006bcc89..f26845d0205c 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -311,11 +311,11 @@ void SpinField::ImplInit( vcl::Window* pParent, WinBits nWinStyle ) if ( (nWinStyle & WB_SPIN) && ImplUseNativeBorder( nWinStyle ) ) { SetBackground(); - mpEdit.set( new Edit( this, WB_NOBORDER ) ); + mpEdit.set( VclPtr<Edit>::Create( this, WB_NOBORDER ) ); mpEdit->SetBackground(); } else - mpEdit.set( new Edit( this, WB_NOBORDER ) ); + mpEdit.set( VclPtr<Edit>::Create( this, WB_NOBORDER ) ); mpEdit->EnableRTL( false ); mpEdit->SetPosPixel( Point() ); diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 90184ecd7ec4..d03446f2cf69 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -112,7 +112,7 @@ void TabControl::ImplInit( vcl::Window* pParent, WinBits nStyle ) if( (nStyle & WB_DROPDOWN) ) { - mpTabCtrlData->mpListBox = new ListBox( this, WB_DROPDOWN ); + mpTabCtrlData->mpListBox = VclPtr<ListBox>::Create( this, WB_DROPDOWN ); mpTabCtrlData->mpListBox->SetPosSizePixel( Point( 0, 0 ), Size( 200, 20 ) ); mpTabCtrlData->mpListBox->SetSelectHdl( LINK( this, TabControl, ImplListBoxSelectHdl ) ); mpTabCtrlData->mpListBox->Show(); diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx index 6371297691dc..cc3a5898cab7 100644 --- a/vcl/source/edit/vclmedit.cxx +++ b/vcl/source/edit/vclmedit.cxx @@ -153,7 +153,7 @@ ImpVclMEdit::ImpVclMEdit( VclMultiLineEdit* pEdt, WinBits nWinStyle ) { pVclMultiLineEdit = pEdt; mnTextWidth = 0; - mpTextWindow = new TextWindow( pEdt ); + mpTextWindow = VclPtr<TextWindow>::Create( pEdt ); mpTextWindow->Show(); InitFromStyle( nWinStyle ); StartListening( *mpTextWindow->GetTextEngine() ); @@ -185,7 +185,7 @@ void ImpVclMEdit::ImpUpdateSrollBarVis( WinBits nWinStyle ) if ( bHaveVScroll != bNeedVScroll ) { mpVScrollBar.disposeAndClear(); - mpVScrollBar = bNeedVScroll ? new ScrollBar( pVclMultiLineEdit, WB_VSCROLL|WB_DRAG ) : NULL; + mpVScrollBar = bNeedVScroll ? VclPtr<ScrollBar>::Create( pVclMultiLineEdit, WB_VSCROLL|WB_DRAG ) : nullptr; if ( bNeedVScroll ) { @@ -199,7 +199,7 @@ void ImpVclMEdit::ImpUpdateSrollBarVis( WinBits nWinStyle ) if ( bHaveHScroll != bNeedHScroll ) { mpHScrollBar.disposeAndClear(); - mpHScrollBar = bNeedHScroll ? new ScrollBar( pVclMultiLineEdit, WB_HSCROLL|WB_DRAG ) : NULL; + mpHScrollBar = bNeedHScroll ? VclPtr<ScrollBar>::Create( pVclMultiLineEdit, WB_HSCROLL|WB_DRAG ) : nullptr; if ( bNeedHScroll ) { @@ -213,7 +213,7 @@ void ImpVclMEdit::ImpUpdateSrollBarVis( WinBits nWinStyle ) if ( bHaveScrollBox != bNeedScrollBox ) { mpScrollBox.disposeAndClear(); - mpScrollBox = bNeedScrollBox ? new ScrollBarBox( pVclMultiLineEdit, WB_SIZEABLE ) : NULL; + mpScrollBox = bNeedScrollBox ? VclPtr<ScrollBarBox>::Create( pVclMultiLineEdit, WB_SIZEABLE ) : nullptr; if ( bNeedScrollBox ) mpScrollBox->Show(); diff --git a/vcl/source/filter/wmf/emfwr.hxx b/vcl/source/filter/wmf/emfwr.hxx index 3e9f2fc151fb..d037bdeb9d6c 100644 --- a/vcl/source/filter/wmf/emfwr.hxx +++ b/vcl/source/filter/wmf/emfwr.hxx @@ -90,7 +90,7 @@ private: public: EMFWriter(SvStream &rStream) - : maVDev( new VirtualDevice() ) + : maVDev( VclPtr<VirtualDevice>::Create() ) , m_rStm(rStream) , mpHandlesUsed(NULL) , mnHandleCount(0) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index ba5a0bf5f5c3..9ed2d19e1644 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -2220,7 +2220,7 @@ OutputDevice* PDFWriterImpl::getReferenceDevice() { if( ! m_pReferenceDevice ) { - VirtualDevice* pVDev = new VirtualDevice( 0 ); + VclPtrInstance<VirtualDevice> pVDev( 0 ); m_pReferenceDevice = pVDev; diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 74db239b7715..b3d6b6b7a239 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -247,7 +247,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa ScopedVclPtr<VirtualDevice> xPrivateDevice; if( ! pDummyVDev ) { - xPrivateDevice.reset(new VirtualDevice()); + xPrivateDevice.reset(VclPtr<VirtualDevice>::Create()); pDummyVDev = xPrivateDevice.get(); pDummyVDev->EnableOutput( false ); pDummyVDev->SetMapMode( i_rMtf.GetPrefMapMode() ); diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 3cbc34d08839..85da52306f63 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -792,9 +792,9 @@ void Printer::ImplInitDisplay( const vcl::Window* pWindow ) mpJobGraphics = NULL; if ( pWindow ) - mpDisplayDev = new VirtualDevice( *pWindow ); + mpDisplayDev = VclPtr<VirtualDevice>::Create( *pWindow ); else - mpDisplayDev = new VirtualDevice(); + mpDisplayDev = VclPtr<VirtualDevice>::Create(); mpFontCollection = pSVData->maGDIData.mpScreenFontList; mpFontCache = pSVData->maGDIData.mpScreenFontCache; mnDPIX = mpDisplayDev->mnDPIX; diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 56809dabfa10..bf5c5eef4ae8 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -1661,7 +1661,7 @@ void PrinterController::createProgressDialog() if( bShow && ! Application::IsHeadlessModeEnabled() ) { - mpImplData->mpProgress = new PrintProgressDialog( NULL, getPageCountProtected() ); + mpImplData->mpProgress = VclPtr<PrintProgressDialog>::Create( nullptr, getPageCountProtected() ); mpImplData->mpProgress->Show(); } } diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index 748eba0f46c1..25655e011dec 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -405,7 +405,7 @@ bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, if( !mpAlphaVDev ) { - mpAlphaVDev = new VirtualDevice( *this, mnAlphaDepth ); + mpAlphaVDev = VclPtr<VirtualDevice>::Create( *this, mnAlphaDepth ); mpAlphaVDev->InnerImplSetOutputSizePixel(rNewSize, bErase, basebmp::RawMemorySharedArray(), bTopDown ); diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index e61231e035f3..a619f93de61e 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -658,7 +658,7 @@ bool OpenGLContext::init( vcl::Window* pParent ) if(mbInitialized) return true; - m_xWindow.reset(pParent ? NULL : new vcl::Window(0, WB_NOBORDER|WB_NODIALOGCONTROL)); + m_xWindow.reset(pParent ? nullptr : VclPtr<vcl::Window>::Create(nullptr, WB_NOBORDER|WB_NODIALOGCONTROL)); mpWindow = pParent ? pParent : m_xWindow.get(); if(m_xWindow) m_xWindow->setPosSizePixel(0,0,0,0); @@ -1081,7 +1081,7 @@ bool OpenGLContext::initWindow() if( !m_pChildWindow ) { SystemWindowData winData = generateWinData(mpWindow, false); - m_pChildWindow = new SystemChildWindow(mpWindow, 0, &winData, false); + m_pChildWindow = VclPtr<SystemChildWindow>::Create(mpWindow, 0, &winData, false); } if( m_pChildWindow ) @@ -1108,7 +1108,7 @@ bool OpenGLContext::initWindow() if( !m_pChildWindow ) { SystemWindowData winData = generateWinData(mpWindow, mbRequestLegacyContext); - m_pChildWindow = new SystemChildWindow(mpWindow, 0, &winData, false); + m_pChildWindow = VclPtr<SystemChildWindow>::Create(mpWindow, 0, &winData, false); } if( m_pChildWindow ) diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index acbfd4b03c76..a9db317a24b5 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -236,7 +236,7 @@ bool OutputDevice::ImplDrawRotateText( SalLayout& rSalLayout ) // cache virtual device for rotation if (!mpOutDevData->mpRotateDev) - mpOutDevData->mpRotateDev = new VirtualDevice( *this, 1 ); + mpOutDevData->mpRotateDev = VclPtr<VirtualDevice>::Create( *this, 1 ); VirtualDevice* pVDev = mpOutDevData->mpRotateDev; // size it accordingly diff --git a/vcl/source/window/btndlg.cxx b/vcl/source/window/btndlg.cxx index 3acbad51932d..2e8532cecba7 100644 --- a/vcl/source/window/btndlg.cxx +++ b/vcl/source/window/btndlg.cxx @@ -81,13 +81,13 @@ PushButton* ButtonDialog::ImplCreatePushButton( sal_uInt16 nBtnFlags ) if ( nBtnFlags & BUTTONDIALOG_DEFBUTTON ) nStyle |= WB_DEFBUTTON; if ( nBtnFlags & BUTTONDIALOG_CANCELBUTTON ) - pBtn = new CancelButton( this, nStyle ); + pBtn = VclPtr<CancelButton>::Create( this, nStyle ); else if ( nBtnFlags & BUTTONDIALOG_OKBUTTON ) - pBtn = new OKButton( this, nStyle ); + pBtn = VclPtr<OKButton>::Create( this, nStyle ); else if ( nBtnFlags & BUTTONDIALOG_HELPBUTTON ) - pBtn = new HelpButton( this, nStyle ); + pBtn = VclPtr<HelpButton>::Create( this, nStyle ); else - pBtn = new PushButton( this, nStyle ); + pBtn = VclPtr<PushButton>::Create( this, nStyle ); if ( !(nBtnFlags & BUTTONDIALOG_HELPBUTTON) ) pBtn->SetClickHdl( LINK( this, ButtonDialog, ImplClickHdl ) ); diff --git a/vcl/source/window/clipping.cxx b/vcl/source/window/clipping.cxx index 0e11542000c4..38efc376c7ef 100644 --- a/vcl/source/window/clipping.cxx +++ b/vcl/source/window/clipping.cxx @@ -842,7 +842,7 @@ void Window::ImplSaveOverlapBackground() if ( nSaveBackSize+mpWindowImpl->mpFrameData->mnAllSaveBackSize <= IMPL_MAXALLSAVEBACKSIZE ) { Size aOutSize( mnOutWidth, mnOutHeight ); - mpWindowImpl->mpOverlapData->mpSaveBackDev = new VirtualDevice( *mpWindowImpl->mpFrameWindow ); + mpWindowImpl->mpOverlapData->mpSaveBackDev = VclPtr<VirtualDevice>::Create( *mpWindowImpl->mpFrameWindow ); if ( mpWindowImpl->mpOverlapData->mpSaveBackDev->SetOutputSizePixel( aOutSize ) ) { mpWindowImpl->mpFrameWindow->ImplUpdateAll(); diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 54fb42dc508c..9e6d4bf12dae 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -403,7 +403,7 @@ void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle ) // create window with a small border ? if ( (nStyle & (WB_BORDER | WB_NOBORDER | WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE)) == WB_BORDER ) { - ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle, BORDERWINDOW_STYLE_FRAME ); + VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle, BORDERWINDOW_STYLE_FRAME ); SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, NULL ); pBorderWin->mpWindowImpl->mpClientWindow = this; pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder ); @@ -421,7 +421,7 @@ void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle ) } else { - ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle, BORDERWINDOW_STYLE_OVERLAP | BORDERWINDOW_STYLE_BORDER ); + VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle, BORDERWINDOW_STYLE_OVERLAP | BORDERWINDOW_STYLE_BORDER ); SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, NULL ); pBorderWin->mpWindowImpl->mpClientWindow = this; pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder ); diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx index c5726af5bd40..aaf84270d803 100644 --- a/vcl/source/window/dockmgr.cxx +++ b/vcl/source/window/dockmgr.cxx @@ -860,7 +860,7 @@ bool ImplDockingWindowWrapper::ImplStartDocking( const Point& rPos ) if ( mpFloatWin ) pWin = mpFloatWin; else - pWin = new ImplDockFloatWin2( mpParent, mnFloatBits, NULL ); + pWin = VclPtr<ImplDockFloatWin2>::Create( mpParent, mnFloatBits, nullptr ); pWin->GetBorder( mnDockLeft, mnDockTop, mnDockRight, mnDockBottom ); if ( !mpFloatWin ) pWin.disposeAndClear(); @@ -1116,7 +1116,7 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, sal_uLon mpOldBorderWin = NULL; // no border window found // the new parent for popup mode - ImplPopupFloatWin* pWin = new ImplPopupFloatWin( mpParent, this, (nFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF) != 0 ); + VclPtrInstance<ImplPopupFloatWin> pWin( mpParent, this, (nFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF) != 0 ); pWin->SetPopupModeEndHdl( LINK( this, ImplDockingWindowWrapper, PopupModeEnd ) ); pWin->SetText( GetWindow()->GetText() ); @@ -1225,7 +1225,8 @@ void ImplDockingWindowWrapper::SetFloatingMode( bool bFloatMode ) mpOldBorderWin = NULL; // no border window found ImplDockFloatWin2* pWin = - new ImplDockFloatWin2( + VclPtr<ImplDockFloatWin2>::Create( + mpParent, mnFloatBits & ( WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE ) ? mnFloatBits | WB_SYSTEMWINDOW diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index 6cc6301730b2..d6ed20d672da 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -268,7 +268,7 @@ bool DockingWindow::ImplStartDocking( const Point& rPos ) if ( mpFloatWin ) pWin = mpFloatWin; else - pWin = new ImplDockFloatWin( mpImplData->mpParent, mnFloatBits, NULL ); + pWin = VclPtr<ImplDockFloatWin>::Create( mpImplData->mpParent, mnFloatBits, nullptr ); pWin->GetBorder( mnDockLeft, mnDockTop, mnDockRight, mnDockBottom ); if ( !mpFloatWin ) pWin.disposeAndClear(); @@ -801,7 +801,8 @@ void DockingWindow::SetFloatingMode( bool bFloatMode ) mpOldBorderWin = mpWindowImpl->mpBorderWindow; ImplDockFloatWin* pWin = - new ImplDockFloatWin( + VclPtr<ImplDockFloatWin>::Create( + mpImplData->mpParent, mnFloatBits & ( WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE ) ? mnFloatBits | WB_SYSTEMWINDOW : mnFloatBits, this ); diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 3b41ab0d4b53..65a5ef452458 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -107,7 +107,7 @@ void FloatingWindow::ImplInit( vcl::Window* pParent, WinBits nStyle ) nBorderStyle |= BORDERWINDOW_STYLE_FRAME; nStyle |= WB_CLOSEABLE; // make undecorated floaters closeable } - pBorderWin = new ImplBorderWindow( pParent, nStyle, nBorderStyle ); + pBorderWin = VclPtr<ImplBorderWindow>::Create( pParent, nStyle, nBorderStyle ); SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, NULL ); pBorderWin->mpWindowImpl->mpClientWindow = this; pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder ); diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 309a8b72d34c..cb983d5a7a1b 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -1627,9 +1627,9 @@ IMPL_LINK( VclExpander, ClickHdl, DisclosureButton*, pBtn ) VclScrolledWindow::VclScrolledWindow(vcl::Window *pParent, WinBits nStyle) : VclBin(pParent, nStyle) , m_bUserManagedScrolling(false) - , m_pVScroll(new ScrollBar(this, WB_HIDE | WB_VERT)) - , m_pHScroll(new ScrollBar(this, WB_HIDE | WB_HORZ)) - , m_aScrollBarBox(new ScrollBarBox(this, WB_HIDE)) + , m_pVScroll(VclPtr<ScrollBar>::Create(this, WB_HIDE | WB_VERT)) + , m_pHScroll(VclPtr<ScrollBar>::Create(this, WB_HIDE | WB_HORZ)) + , m_aScrollBarBox(VclPtr<ScrollBarBox>::Create(this, WB_HIDE)) { SetType(WINDOW_SCROLLWINDOW); @@ -1975,10 +1975,10 @@ bool VclSizeGroup::set_property(const OString &rKey, const OString &rValue) void MessageDialog::create_owned_areas() { set_border_width(12); - m_pOwnedContentArea.set(new VclVBox(this, false, 24)); + m_pOwnedContentArea.set(VclPtr<VclVBox>::Create(this, false, 24)); set_content_area(m_pOwnedContentArea); m_pOwnedContentArea->Show(); - m_pOwnedActionArea.set( new VclHButtonBox(m_pOwnedContentArea) ); + m_pOwnedActionArea.set( VclPtr<VclHButtonBox>::Create(m_pOwnedContentArea) ); set_action_area(m_pOwnedActionArea); m_pOwnedActionArea->Show(); } @@ -2134,12 +2134,12 @@ short MessageDialog::Execute() VclContainer *pContainer = get_content_area(); assert(pContainer); - m_pGrid.set( new VclGrid(pContainer) ); + m_pGrid.set( VclPtr<VclGrid>::Create(pContainer) ); m_pGrid->reorderWithinParent(0); m_pGrid->set_column_spacing(12); m_pGrid->set_row_spacing(GetTextHeight()); - m_pImage = new FixedImage(m_pGrid, WB_CENTER | WB_VCENTER | WB_3DLOOK); + m_pImage = VclPtr<FixedImage>::Create(m_pGrid, WB_CENTER | WB_VCENTER | WB_3DLOOK); switch (m_eMessageType) { case VCL_MESSAGE_INFO: @@ -2164,7 +2164,7 @@ short MessageDialog::Execute() bool bHasSecondaryText = !m_sSecondaryString.isEmpty(); - m_pPrimaryMessage = new VclMultiLineEdit(m_pGrid, nWinStyle); + m_pPrimaryMessage = VclPtr<VclMultiLineEdit>::Create(m_pGrid, nWinStyle); m_pPrimaryMessage->SetPaintTransparent(true); m_pPrimaryMessage->EnableCursor(false); @@ -2174,7 +2174,7 @@ short MessageDialog::Execute() m_pPrimaryMessage->SetText(m_sPrimaryString); m_pPrimaryMessage->Show(!m_sPrimaryString.isEmpty()); - m_pSecondaryMessage = new VclMultiLineEdit(m_pGrid, nWinStyle); + m_pSecondaryMessage = VclPtr<VclMultiLineEdit>::Create(m_pGrid, nWinStyle); m_pSecondaryMessage->SetPaintTransparent(true); m_pSecondaryMessage->EnableCursor(false); m_pSecondaryMessage->set_grid_left_attach(1); @@ -2194,33 +2194,33 @@ short MessageDialog::Execute() case VCL_BUTTONS_NONE: break; case VCL_BUTTONS_OK: - pBtn.set( new OKButton(pButtonBox) ); + pBtn.set( VclPtr<OKButton>::Create(pButtonBox) ); pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON); pBtn->Show(); m_aOwnedButtons.push_back(pBtn); m_aResponses[pBtn] = RET_OK; break; case VCL_BUTTONS_CLOSE: - pBtn.set( new CloseButton(pButtonBox) ); + pBtn.set( VclPtr<CloseButton>::Create(pButtonBox) ); pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON); pBtn->Show(); m_aOwnedButtons.push_back(pBtn); m_aResponses[pBtn] = RET_CLOSE; break; case VCL_BUTTONS_CANCEL: - pBtn.set( new CancelButton(pButtonBox) ); + pBtn.set( VclPtr<CancelButton>::Create(pButtonBox) ); pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON); m_aOwnedButtons.push_back(pBtn); m_aResponses[pBtn] = RET_CANCEL; break; case VCL_BUTTONS_YES_NO: - pBtn = new PushButton(pButtonBox); + pBtn = VclPtr<PushButton>::Create(pButtonBox); pBtn->SetText(Button::GetStandardText(StandardButtonType::Yes)); pBtn->Show(); m_aOwnedButtons.push_back(pBtn); m_aResponses[pBtn] = RET_YES; - pBtn.set( new PushButton(pButtonBox) ); + pBtn.set( VclPtr<PushButton>::Create(pButtonBox) ); pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON); pBtn->SetText(Button::GetStandardText(StandardButtonType::No)); pBtn->Show(); @@ -2228,12 +2228,12 @@ short MessageDialog::Execute() m_aResponses[pBtn] = RET_NO; break; case VCL_BUTTONS_OK_CANCEL: - pBtn.set( new OKButton(pButtonBox) ); + pBtn.set( VclPtr<OKButton>::Create(pButtonBox) ); pBtn->Show(); m_aOwnedButtons.push_back(pBtn); m_aResponses[pBtn] = RET_OK; - pBtn.set( new CancelButton(pButtonBox) ); + pBtn.set( VclPtr<CancelButton>::Create(pButtonBox) ); pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON); pBtn->Show(); m_aOwnedButtons.push_back(pBtn); diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 7323c14460d3..40a254547698 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2505,7 +2505,7 @@ vcl::Window* MenuBar::ImplCreate(vcl::Window* pParent, vcl::Window* pWindow, Men MenuBarWindow *pMenuBarWindow = dynamic_cast<MenuBarWindow*>(pWindow); if (!pMenuBarWindow) { - pWindow = pMenuBarWindow = new MenuBarWindow( pParent ); + pWindow = pMenuBarWindow = VclPtr<MenuBarWindow>::Create( pParent ); } pMenu->pStartedFrom = 0; @@ -2929,7 +2929,7 @@ sal_uInt16 PopupMenu::ImplExecute( vcl::Window* pW, const Rectangle& rRect, sal_ CreateAutoMnemonics(); } - MenuFloatingWindow* pWin = new MenuFloatingWindow( this, pW, nStyle | WB_SYSTEMWINDOW ); + VclPtrInstance<MenuFloatingWindow> pWin( this, pW, nStyle | WB_SYSTEMWINDOW ); if( pSVData->maNWFData.mbFlatMenu ) pWin->SetBorderStyle( WindowBorderStyle::NOBORDER ); else diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index 7c0bca777f06..47f61ad6829d 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -119,9 +119,9 @@ void DecoToolBox::SetImages( long nMaxHeight, bool bForce ) MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) : Window( pParent, 0 ), - aCloseBtn(new DecoToolBox(this)), - aFloatBtn(new PushButton( this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE )), - aHideBtn(new PushButton(this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE )) + aCloseBtn(VclPtr<DecoToolBox>::Create(this)), + aFloatBtn(VclPtr<PushButton>::Create( this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE )), + aHideBtn(VclPtr<PushButton>::Create(this, WB_NOPOINTERFOCUS | WB_SMALLSTYLE | WB_RECTSTYLE )) { SetType( WINDOW_MENUBARWINDOW ); pMenu = NULL; diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx index a96011be5cd9..9f2fd75973c7 100644 --- a/vcl/source/window/msgbox.cxx +++ b/vcl/source/window/msgbox.cxx @@ -231,7 +231,7 @@ void MessBox::ImplPosControls() aImageSize.Width() += 4; aImageSize.Height() += 4; aTextPos.X() += aImageSize.Width()+IMPL_SEP_MSGBOX_IMAGE; - mpFixedImage = new FixedImage( this ); + mpFixedImage = VclPtr<FixedImage>::Create( this ); mpFixedImage->SetPosSizePixel( Point( IMPL_DIALOG_OFFSET-2+IMPL_MSGBOX_OFFSET_EXTRA_X, IMPL_DIALOG_OFFSET-2+IMPL_MSGBOX_OFFSET_EXTRA_Y ), aImageSize ); @@ -321,7 +321,7 @@ void MessBox::ImplPosControls() } } - mpCheckBox = new CheckBox( this ); + mpCheckBox = VclPtr<CheckBox>::Create( this ); mpCheckBox->Check( mbCheck ); mpCheckBox->SetText( aMnemonicString ); mpCheckBox->SetStyle( mpCheckBox->GetStyle() | WB_WORDBREAK ); @@ -343,7 +343,7 @@ void MessBox::ImplPosControls() mpCheckBox->Show(); } - mpVCLMultiLineEdit = new VclMultiLineEdit( this, nWinStyle ); + mpVCLMultiLineEdit = VclPtr<VclMultiLineEdit>::Create( this, nWinStyle ); mpVCLMultiLineEdit->SetText( aMessText ); mpVCLMultiLineEdit->SetPosSizePixel( aTextPos, aMEditSize ); mpVCLMultiLineEdit->Show(); diff --git a/vcl/source/window/openglwin.cxx b/vcl/source/window/openglwin.cxx index bb7ef2723cdb..1ef46dabc828 100644 --- a/vcl/source/window/openglwin.cxx +++ b/vcl/source/window/openglwin.cxx @@ -25,7 +25,7 @@ private: OpenGLWindowImpl::OpenGLWindowImpl(vcl::Window* pWindow) { SystemWindowData aData = OpenGLContext::generateWinData(pWindow, false); - mxChildWindow.reset(new SystemChildWindow(pWindow, 0, &aData)); + mxChildWindow.reset(VclPtr<SystemChildWindow>::Create(pWindow, 0, &aData)); mxChildWindow->Show(); maContext.init(mxChildWindow.get()); pWindow->SetMouseTransparent(false); diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index f173ad36915d..f24755d92904 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -64,11 +64,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeShowNupOrderWindow(vcl PrintDialog::PrintPreviewWindow::PrintPreviewWindow( vcl::Window* i_pParent ) : Window( i_pParent, 0 ) , maOrigSize( 10, 10 ) - , maPageVDev( new VirtualDevice(*this) ) + , maPageVDev( VclPtr<VirtualDevice>::Create(*this) ) , maToolTipString(VclResId( SV_PRINT_PRINTPREVIEW_TXT).toString()) , mbGreyscale( false ) - , maHorzDim(new FixedLine(this, WB_HORZ | WB_CENTER)) - , maVertDim(new FixedLine(this, WB_VERT | WB_VCENTER)) + , maHorzDim(VclPtr<FixedLine>::Create(this, WB_HORZ | WB_CENTER)) + , maVertDim(VclPtr<FixedLine>::Create(this, WB_VERT | WB_VCENTER)) { SetPaintTransparent( true ); SetBackground(); diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index 0cfbbaa5b4c8..7f43c18e2b1a 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -123,7 +123,7 @@ void StatusBar::ImplInit( vcl::Window* pParent, WinBits nStyle ) // remember WinBits mpItemList = new ImplStatusItemList; - mpImplData->mpVirDev = new VirtualDevice( *this ); + mpImplData->mpVirDev = VclPtr<VirtualDevice>::Create( *this ); mnCurItemId = 0; mbFormat = true; mbVisibleItems = true; diff --git a/vcl/source/window/tabdlg.cxx b/vcl/source/window/tabdlg.cxx index 3f317677ea06..e5c9061389e3 100644 --- a/vcl/source/window/tabdlg.cxx +++ b/vcl/source/window/tabdlg.cxx @@ -197,7 +197,7 @@ void TabDialog::ImplPosControls() { Size aDlgSize = GetOutputSizePixel(); if ( !mpFixedLine ) - mpFixedLine = new FixedLine( this ); + mpFixedLine = VclPtr<FixedLine>::Create( this ); mpFixedLine->SetPosSizePixel( Point( 0, nOffY ), Size( aDlgSize.Width(), 2 ) ); mpFixedLine->Show(); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 1ec060b59372..b596026331fc 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -904,7 +904,7 @@ void Window::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* p nBorderTypeStyle |= BORDERWINDOW_STYLE_FRAME; nStyle |= WB_BORDER; } - ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_NEEDSFOCUS), nBorderTypeStyle ); + VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_NEEDSFOCUS), nBorderTypeStyle ); ((vcl::Window*)pBorderWin)->mpWindowImpl->mpClientWindow = this; pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder ); mpWindowImpl->mpBorderWindow = pBorderWin; diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index cf8fd3f930a0..bd64654f2e4b 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -457,7 +457,7 @@ void Window::StartAutoScroll( sal_uInt16 nFlags ) pSVData->maWinData.mpAutoScrollWin = this; pSVData->maWinData.mnAutoScrollFlags = nFlags; - pSVData->maAppData.mpWheelWindow = new ImplWheelWindow( this ); + pSVData->maAppData.mpWheelWindow = VclPtr<ImplWheelWindow>::Create( this ); } void Window::EndAutoScroll() diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx index cdd4be98f6cf..136adc859d84 100644 --- a/vcl/source/window/wrkwin.cxx +++ b/vcl/source/window/wrkwin.cxx @@ -49,7 +49,7 @@ void WorkWindow::ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentDat if ( nStyle & WB_APP ) nFrameStyle |= BORDERWINDOW_STYLE_APP; - ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, pSystemParentData, nStyle, nFrameStyle ); + VclPtrInstance<ImplBorderWindow> pBorderWin( pParent, pSystemParentData, nStyle, nFrameStyle ); Window::ImplInit( pBorderWin, nStyle & (WB_3DLOOK | WB_CLIPCHILDREN | WB_DIALOGCONTROL | WB_SYSTEMFLOATWIN), NULL ); pBorderWin->mpWindowImpl->mpClientWindow = this; pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder ); diff --git a/vcl/unx/generic/app/i18n_status.cxx b/vcl/unx/generic/app/i18n_status.cxx index 13cfdb1b911b..5df56b0d9362 100644 --- a/vcl/unx/generic/app/i18n_status.cxx +++ b/vcl/unx/generic/app/i18n_status.cxx @@ -111,7 +111,7 @@ public: XIMStatusWindow::XIMStatusWindow( bool bOn ) : StatusWindow( WB_BORDER | WB_SYSTEMFLOATWIN | WB_TOOLTIPWIN ), - m_aStatusText(new FixedText(this, 0)), + m_aStatusText(VclPtr<FixedText>::Create(this, 0)), m_pLastParent( NULL ), m_bAnchoredAtRight( false ), m_bDelayedShow( false ), @@ -330,7 +330,7 @@ public: IIIMPStatusWindow::IIIMPStatusWindow( SalFrame* pParent, bool bOn ) : StatusWindow( WB_MOVEABLE ), - m_aStatusBtn(new MenuButton(this, WB_BORDER)), + m_aStatusBtn(VclPtr<MenuButton>::Create(this, WB_BORDER)), m_pResetFocus( pParent ), m_bShow( true ), m_bOn( bOn ) @@ -535,10 +535,10 @@ void I18NStatus::setParent( SalFrame* pParent ) { bool bIIIMPmode = m_aChoices.begin() != m_aChoices.end(); if( bIIIMPmode ) - m_pStatusWindow = new IIIMPStatusWindow( pParent, + m_pStatusWindow = VclPtr<IIIMPStatusWindow>::Create( pParent, getStatusWindowMode() ); else - m_pStatusWindow = new XIMStatusWindow( getStatusWindowMode() ); + m_pStatusWindow = VclPtr<XIMStatusWindow>::Create( getStatusWindowMode() ); setStatusText( m_aCurrentIM ); } m_pStatusWindow->setPosition( m_pParent ); diff --git a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx index 99944d1909b6..0bc8004c58b8 100644 --- a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx +++ b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx @@ -269,7 +269,7 @@ namespace cairo int height = cairo_xlib_surface_get_height(mpSurface.get()); return VclPtr<VirtualDevice>( - new VirtualDevice(&aSystemGraphicsData, + VclPtr<VirtualDevice>::Create(&aSystemGraphicsData, Size(width, height), std::max(getDepth(), 0))); } diff --git a/vcl/win/source/gdi/cairo_win32_cairo.cxx b/vcl/win/source/gdi/cairo_win32_cairo.cxx index 357106724e1a..65dd478bd1dc 100644 --- a/vcl/win/source/gdi/cairo_win32_cairo.cxx +++ b/vcl/win/source/gdi/cairo_win32_cairo.cxx @@ -173,11 +173,9 @@ namespace cairo VclPtr<VirtualDevice> Win32Surface::createVirtualDevice() const { SystemGraphicsData aSystemGraphicsData; - aSystemGraphicsData.nSize = sizeof(SystemGraphicsData); + aSystemGraphicsData.nSize = sizeof( SystemGraphicsData ); aSystemGraphicsData.hDC = cairo_win32_surface_get_dc( mpSurface.get() ); - - return VclPtr<VirtualDevice>( - new VirtualDevice( &aSystemGraphicsData, Size(1, 1), sal::static_int_cast<USHORT>(getDepth()) )); + return VclPtr<VirtualDevice>::Create( &aSystemGraphicsData, Size(1, 1), sal::static_int_cast<USHORT>( getDepth() ) ); } } // namespace cairo diff --git a/vcl/workben/icontest.cxx b/vcl/workben/icontest.cxx index 8562feb214f6..cef8ac6755c8 100644 --- a/vcl/workben/icontest.cxx +++ b/vcl/workben/icontest.cxx @@ -186,12 +186,12 @@ void IconTestApp::DoItWithVcl( const OUString& sImageFile) { try { - MyWorkWindow *pWindow = new MyWorkWindow( NULL, WB_APP | WB_STDWORK | WB_SIZEABLE | WB_CLOSEABLE | WB_CLIPCHILDREN ); + VclPtrInstance<MyWorkWindow> pWindow( nullptr, WB_APP | WB_STDWORK | WB_SIZEABLE | WB_CLOSEABLE | WB_CLIPCHILDREN ); pWindow->SetText(OUString("VCL Image Test")); pWindow->LoadGraphic( sImageFile ); - pWindow->mpFixedBitmap = new FixedBitmap( pWindow ); + pWindow->mpFixedBitmap = VclPtr<FixedBitmap>::Create( pWindow ); pWindow->mpFixedBitmap->SetPosPixel( Point( 0, 0 ) ); pWindow->mpFixedBitmap->Show(); diff --git a/vcl/workben/mtfdemo.cxx b/vcl/workben/mtfdemo.cxx index 54c64ffadf4a..05ab64430972 100644 --- a/vcl/workben/mtfdemo.cxx +++ b/vcl/workben/mtfdemo.cxx @@ -88,7 +88,7 @@ public: { try { - mpWin = new DemoMtfWin(maFileName); + mpWin = VclPtr<DemoMtfWin>::Create(maFileName); mpWin->SetText(OUString("Display metafile")); mpWin->Show(); diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx index 428cfa7dbc6e..01ad3e9d5f08 100644 --- a/vcl/workben/svpclient.cxx +++ b/vcl/workben/svpclient.cxx @@ -130,10 +130,10 @@ void Main() MyWin::MyWin( vcl::Window* pParent, WinBits nWinStyle ) : WorkWindow( pParent, nWinStyle ), - m_aListButton(new PushButton(this, 0)), - m_aSvpBitmaps(new ListBox(this, WB_BORDER)), - m_aImage(new ImageControl(this, WB_BORDER)), - m_aQuitButton(new PushButton(this, 0)) + m_aListButton(VclPtr<PushButton>::Create(this, 0)), + m_aSvpBitmaps(VclPtr<ListBox>::Create(this, WB_BORDER)), + m_aImage(VclPtr<ImageControl>::Create(this, WB_BORDER)), + m_aQuitButton(VclPtr<PushButton>::Create(this, 0)) { m_aListButton->SetPosSizePixel( Point( 10, 10 ), Size( 120, 25 ) ); m_aListButton->SetText( OUString( "List Elements" ) ); diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 33682e17df13..4f42f9353445 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -777,9 +777,9 @@ public: ScopedVclPtr<VirtualDevice> pNested; if ((int)eType < RENDER_AS_BITMAPEX) - pNested = new VirtualDevice(rDev); + pNested = VclPtr<VirtualDevice>::Create(rDev).get(); else - pNested = new VirtualDevice(rDev,0,0); + pNested = VclPtr<VirtualDevice>::Create(rDev,0,0).get(); pNested->SetOutputSizePixel(r.GetSize()); Rectangle aWhole(Point(0,0), r.GetSize()); @@ -1230,8 +1230,8 @@ bool DemoRenderer::MouseButtonDown(const MouseEvent& rMEvt) // otherwise bounce floating windows if (!mpButton) { - mpButtonWin = new FloatingWindow(this); - mpButton = new PushButton(mpButtonWin); + mpButtonWin = VclPtr<FloatingWindow>::Create(this); + mpButton = VclPtr<PushButton>::Create(mpButtonWin); mpButton->SetSymbol(SymbolType::HELP); mpButton->SetText("PushButton demo"); mpButton->SetPosSizePixel(Point(0,0), mpButton->GetOptimalSize()); @@ -1406,7 +1406,7 @@ public: } else { // spawn another window - DemoWin *pNewWin = new DemoWin(mrRenderer, testThreads); + VclPtrInstance<DemoWin> pNewWin(mrRenderer, testThreads); pNewWin->SetText("Another interactive VCL demo window"); pNewWin->Show(); } |