From a461467a3edc1452835447ff075fda7420aaf153 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Thu, 16 Apr 2015 22:09:41 +0100 Subject: drawinglayer, editeng, forms, fpicker: convert new to ::Create. Change-Id: I5144ac74a09a3ac5679abca89e7d87386f2484fd --- fpicker/source/office/OfficeFilePicker.cxx | 4 ++-- fpicker/source/office/OfficeFilePicker.hxx | 2 +- fpicker/source/office/OfficeFolderPicker.cxx | 4 ++-- fpicker/source/office/OfficeFolderPicker.hxx | 2 +- fpicker/source/office/PlacesListBox.cxx | 8 ++++---- fpicker/source/office/commonpicker.cxx | 2 +- fpicker/source/office/commonpicker.hxx | 2 +- fpicker/source/office/iodlg.cxx | 12 ++++++------ fpicker/test/svdem.cxx | 3 +-- 9 files changed, 19 insertions(+), 20 deletions(-) (limited to 'fpicker') diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx index f9d755ac4fcc..6fd28edfd242 100644 --- a/fpicker/source/office/OfficeFilePicker.cxx +++ b/fpicker/source/office/OfficeFilePicker.cxx @@ -463,12 +463,12 @@ sal_Int16 SvtFilePicker::implExecutePicker( ) } -SvtFileDialog* SvtFilePicker::implCreateDialog( vcl::Window* _pParent ) +VclPtr SvtFilePicker::implCreateDialog( vcl::Window* _pParent ) { WinBits nExtraBits; WinBits nBits = getWinBits( nExtraBits ); - SvtFileDialog* dialog = new SvtFileDialog( _pParent, nBits, nExtraBits ); + VclPtrInstance dialog( _pParent, nBits, nExtraBits ); // Set StandardDir if present if ( !m_aStandardDir.isEmpty()) diff --git a/fpicker/source/office/OfficeFilePicker.hxx b/fpicker/source/office/OfficeFilePicker.hxx index 65e4eab4b970..fa8313e16a85 100644 --- a/fpicker/source/office/OfficeFilePicker.hxx +++ b/fpicker/source/office/OfficeFilePicker.hxx @@ -205,7 +205,7 @@ protected: // OCommonPicker overridables - virtual SvtFileDialog* implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE; + virtual VclPtr implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE; virtual sal_Int16 implExecutePicker( ) SAL_OVERRIDE; virtual bool implHandleInitializationArgument( const OUString& _rName, diff --git a/fpicker/source/office/OfficeFolderPicker.cxx b/fpicker/source/office/OfficeFolderPicker.cxx index de062ac8e7cc..8f524856884c 100644 --- a/fpicker/source/office/OfficeFolderPicker.cxx +++ b/fpicker/source/office/OfficeFolderPicker.cxx @@ -69,9 +69,9 @@ void SAL_CALL SvtFolderPicker::startExecuteModal( const Reference< ::com::sun::s getDialog()->StartExecuteModal( LINK( this, SvtFolderPicker, DialogClosedHdl ) ); } -SvtFileDialog* SvtFolderPicker::implCreateDialog( vcl::Window* _pParent ) +VclPtr SvtFolderPicker::implCreateDialog( vcl::Window* _pParent ) { - return new SvtFileDialog( _pParent, SFXWB_PATHDIALOG ); + return VclPtr::Create( _pParent, SFXWB_PATHDIALOG ); } sal_Int16 SvtFolderPicker::implExecutePicker( ) diff --git a/fpicker/source/office/OfficeFolderPicker.hxx b/fpicker/source/office/OfficeFolderPicker.hxx index 6261c50f74f0..266c99cbef8a 100644 --- a/fpicker/source/office/OfficeFolderPicker.hxx +++ b/fpicker/source/office/OfficeFolderPicker.hxx @@ -99,7 +99,7 @@ protected: // OCommonPicker overridables - virtual SvtFileDialog* implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE; + virtual VclPtr implCreateDialog( vcl::Window* _pParent ) SAL_OVERRIDE; virtual sal_Int16 implExecutePicker( ) SAL_OVERRIDE; }; diff --git a/fpicker/source/office/PlacesListBox.cxx b/fpicker/source/office/PlacesListBox.cxx index 537a773f7ebd..24ef10516b33 100644 --- a/fpicker/source/office/PlacesListBox.cxx +++ b/fpicker/source/office/PlacesListBox.cxx @@ -24,7 +24,7 @@ PlacesListBox_Impl::PlacesListBox_Impl( PlacesListBox* pParent, const OUString& mpParent( pParent ) { Size aBoxSize = pParent->GetSizePixel( ); - mpHeaderBar = new HeaderBar( pParent, WB_BUTTONSTYLE | WB_BOTTOMBORDER ); + mpHeaderBar = VclPtr::Create( pParent, WB_BUTTONSTYLE | WB_BOTTOMBORDER ); mpHeaderBar->SetPosSizePixel( Point( 0, 0 ), Size( 600, 16 ) ); long pTabs[] = { 2, 20, 600 }; @@ -70,17 +70,17 @@ PlacesListBox::PlacesListBox( vcl::Window* pParent, SvtFileDialog* pFileDlg, con mbUpdated( false ), mbSelectionChanged( false ) { - mpImpl = new PlacesListBox_Impl( this, rTitle ); + mpImpl = VclPtr::Create( this, rTitle ); mpImpl->SetSelectHdl( LINK( this, PlacesListBox, Selection ) ); mpImpl->SetDoubleClickHdl( LINK( this, PlacesListBox, DoubleClick ) ) ; - mpAddBtn = new ImageButton( this, 0 ); + mpAddBtn.reset( VclPtr::Create( this, 0 ) ); mpAddBtn->SetText( OUString( "+" ) ); mpAddBtn->SetPosSizePixel( Point( 0, 0 ), Size( 22, 22 ) ); mpAddBtn->Show(); - mpDelBtn = new ImageButton( this, 0 ); + mpDelBtn.reset( VclPtr::Create( this, 0 ) ); mpDelBtn->SetText( OUString( "-" ) ); mpDelBtn->SetPosSizePixel( Point( 0, 0 ), Size( 22, 22 ) ); mpDelBtn->Show(); diff --git a/fpicker/source/office/commonpicker.cxx b/fpicker/source/office/commonpicker.cxx index f23756858a43..53f87afb5049 100644 --- a/fpicker/source/office/commonpicker.cxx +++ b/fpicker/source/office/commonpicker.cxx @@ -201,7 +201,7 @@ namespace svt { if ( !m_pDlg ) { - m_pDlg = implCreateDialog( VCLUnoHelper::GetWindow( m_xDialogParent ) ); + m_pDlg.reset( implCreateDialog( VCLUnoHelper::GetWindow( m_xDialogParent ) ) ); DBG_ASSERT( m_pDlg, "OCommonPicker::createPicker: invalid dialog returned!" ); if ( m_pDlg ) diff --git a/fpicker/source/office/commonpicker.hxx b/fpicker/source/office/commonpicker.hxx index 52141c54598c..a08c31ee2ba0 100644 --- a/fpicker/source/office/commonpicker.hxx +++ b/fpicker/source/office/commonpicker.hxx @@ -93,7 +93,7 @@ namespace svt // overridables // will be called with locked SolarMutex - virtual SvtFileDialog* implCreateDialog( vcl::Window* _pParent ) = 0; + virtual VclPtr implCreateDialog( vcl::Window* _pParent ) = 0; virtual sal_Int16 implExecutePicker( ) = 0; // do NOT override XExecutableDialog::execute! We need to do some stuff there ourself ... diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 8b0e552e4168..e4ff146f2463 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -499,7 +499,7 @@ void SvtFileDialog::Init_Impl m_aImages = ImageList( SvtResId( RID_FILEPICKER_IMAGES ) ); vcl::Window *pUpContainer = get("up"); - _pImp->_pBtnUp = new SvtUpButton_Impl(pUpContainer, this, 0); + _pImp->_pBtnUp = VclPtr::Create(pUpContainer, this, 0); _pImp->_pBtnUp->SetHelpId( HID_FILEOPEN_LEVELUP ); _pImp->_pBtnUp->set_vexpand(true); _pImp->_pBtnUp->Show(); @@ -541,7 +541,7 @@ void SvtFileDialog::Init_Impl if ( ( nStyle & SFXWB_MULTISELECTION ) == SFXWB_MULTISELECTION ) _pImp->_bMultiSelection = true; - _pContainer = new CustomContainer(get("container")); + _pContainer.reset(VclPtr::Create(get("container"))); Size aSize(LogicToPixel(Size(270, 85), MAP_APPFONT)); _pContainer->set_height_request(aSize.Height()); _pContainer->set_width_request(aSize.Width()); @@ -549,7 +549,7 @@ void SvtFileDialog::Init_Impl _pContainer->set_vexpand(true); _pContainer->SetStyle( _pContainer->GetStyle() | WB_TABSTOP ); - _pFileView = new SvtFileView( _pContainer, WB_BORDER, + _pFileView = VclPtr::Create( _pContainer, WB_BORDER, FILEDLG_TYPE_PATHDLG == _pImp->_eDlgType, _pImp->_bMultiSelection ); _pFileView->Show(); @@ -557,7 +557,7 @@ void SvtFileDialog::Init_Impl _pFileView->SetHelpId( HID_FILEDLG_STANDARD ); _pFileView->SetStyle( _pFileView->GetStyle() | WB_TABSTOP ); - _pSplitter = new Splitter( _pContainer, WB_HSCROLL ); + _pSplitter = VclPtr::Create( _pContainer, WB_HSCROLL ); _pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() )); _pSplitter->SetSplitHdl( LINK( this, SvtFileDialog, Split_Hdl ) ); @@ -2547,7 +2547,7 @@ void SvtFileDialog::AddControls_Impl( ) _pPrevWin->SetOutputSizePixel(Size(200, 300)); _pPrevWin->Show(); - _pPrevBmp = new FixedBitmap( _pPrevWin, WinBits( WB_BORDER ) ); + _pPrevBmp = VclPtr::Create( _pPrevWin, WinBits( WB_BORDER ) ); _pPrevBmp->SetBackground( Wallpaper( Color( COL_WHITE ) ) ); _pPrevBmp->SetSizePixel(_pPrevWin->GetSizePixel()); _pPrevBmp->Show(); @@ -2612,7 +2612,7 @@ void SvtFileDialog::AddControls_Impl( ) _pImp->_pLbImageTemplates->Show(); } - _pImp->_pPlaces = new PlacesListBox(_pContainer, this, SVT_RESSTR(STR_PLACES_TITLE), WB_BORDER); + _pImp->_pPlaces = VclPtr::Create(_pContainer, this, SVT_RESSTR(STR_PLACES_TITLE), WB_BORDER); _pImp->_pPlaces->SetHelpId("SVT_HID_FILESAVE_PLACES_LISTBOX"); Size aSize(LogicToPixel(Size(50, 85), MAP_APPFONT)); _pImp->_pPlaces->set_height_request(aSize.Height()); diff --git a/fpicker/test/svdem.cxx b/fpicker/test/svdem.cxx index 1f4bc6b58e9f..61217a7c692a 100644 --- a/fpicker/test/svdem.cxx +++ b/fpicker/test/svdem.cxx @@ -185,9 +185,8 @@ IMPL_LINK( MyWin, Test, PushButton*, pBtn ) printf("Test\n"); if ( pBtn == &aOKBtn ) { - SvtFileDialog* pDlg = new SvtFileDialog( this,SFXWB_PATHDIALOG); + ScopedVclPtrInstance pDlg(this,SFXWB_PATHDIALOG); pDlg->Execute(); - delete pDlg; printf("ok\n"); } -- cgit