summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-04-16 22:09:41 +0100
committerMichael Meeks <michael.meeks@collabora.com>2015-04-16 22:09:41 +0100
commita461467a3edc1452835447ff075fda7420aaf153 (patch)
treed56f03c08335a554b8b8573a89f7535ffda6633b
parent5252a1d81eb69d3de443d2988367359c9174e36d (diff)
drawinglayer, editeng, forms, fpicker: convert new to ::Create.
Change-Id: I5144ac74a09a3ac5679abca89e7d87386f2484fd
-rw-r--r--drawinglayer/source/primitive2d/textlayoutdevice.cxx2
-rw-r--r--drawinglayer/source/processor2d/vclhelperbufferdevice.cxx2
-rw-r--r--editeng/source/editeng/impedit.cxx2
-rw-r--r--forms/source/richtext/richtextcontrol.cxx2
-rw-r--r--forms/source/richtext/richtextimplcontrol.cxx8
-rw-r--r--forms/source/solar/component/navbarcontrol.cxx2
-rw-r--r--forms/source/solar/control/navtoolbar.cxx8
-rw-r--r--fpicker/source/office/OfficeFilePicker.cxx4
-rw-r--r--fpicker/source/office/OfficeFilePicker.hxx2
-rw-r--r--fpicker/source/office/OfficeFolderPicker.cxx4
-rw-r--r--fpicker/source/office/OfficeFolderPicker.hxx2
-rw-r--r--fpicker/source/office/PlacesListBox.cxx8
-rw-r--r--fpicker/source/office/commonpicker.cxx2
-rw-r--r--fpicker/source/office/commonpicker.hxx2
-rw-r--r--fpicker/source/office/iodlg.cxx12
-rw-r--r--fpicker/test/svdem.cxx3
16 files changed, 32 insertions, 33 deletions
diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index d34403d819aa..f42be2e45bd7 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -97,7 +97,7 @@ namespace
{
if(!mpVirDev)
{
- mpVirDev = new VirtualDevice();
+ mpVirDev = VclPtr<VirtualDevice>::Create();
mpVirDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 );
}
diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index 4c22ca4f1c5b..93919c0019a2 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -163,7 +163,7 @@ namespace
// no success yet, create new buffer
if(!pRetval)
{
- pRetval = new VirtualDevice(rOutDev, nBits);
+ pRetval = VclPtr<VirtualDevice>::Create(rOutDev, nBits);
pRetval->SetOutputSizePixel(rSizePixel, bClear);
}
else
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 8866f994dd0a..b0fbc1f28d8d 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -1589,7 +1589,7 @@ void ImpEditView::ShowDDCursor( const Rectangle& rRect )
#endif
if ( !pDragAndDropInfo->pBackground )
{
- pDragAndDropInfo->pBackground = new VirtualDevice( *GetWindow() );
+ pDragAndDropInfo->pBackground = VclPtr<VirtualDevice>::Create( *GetWindow() );
MapMode aMapMode( GetWindow()->GetMapMode() );
aMapMode.SetOrigin( Point( 0, 0 ) );
pDragAndDropInfo->pBackground->SetMapMode( aMapMode );
diff --git a/forms/source/richtext/richtextcontrol.cxx b/forms/source/richtext/richtextcontrol.cxx
index 66b27de3a346..03d708752ae5 100644
--- a/forms/source/richtext/richtextcontrol.cxx
+++ b/forms/source/richtext/richtextcontrol.cxx
@@ -290,7 +290,7 @@ namespace frm
pPeer->acquire(); // by definition, the returned object is acquired once
// the VCL control for the peer
- RichTextControl* pRichTextControl = new RichTextControl( pEngine, _pParentWindow, _nStyle, NULL, pPeer );
+ VclPtrInstance<RichTextControl> pRichTextControl( pEngine, _pParentWindow, _nStyle, nullptr, pPeer );
// some knittings
pRichTextControl->SetComponentInterface( pPeer );
diff --git a/forms/source/richtext/richtextimplcontrol.cxx b/forms/source/richtext/richtextimplcontrol.cxx
index b292f642dfe0..d47ff3467022 100644
--- a/forms/source/richtext/richtextimplcontrol.cxx
+++ b/forms/source/richtext/richtextimplcontrol.cxx
@@ -56,7 +56,7 @@ namespace frm
OSL_ENSURE( m_pAntiImpl, "RichTextControlImpl::RichTextControlImpl: invalid window!" );
OSL_ENSURE( m_pEngine, "RichTextControlImpl::RichTextControlImpl: invalid edit engine! This will *definitely* crash!" );
- m_pViewport = new RichTextViewPort( m_pAntiImpl );
+ m_pViewport = VclPtr<RichTextViewPort>::Create( m_pAntiImpl );
m_pViewport->setAttributeInvalidationHandler( LINK( this, RichTextControlImpl, OnInvalidateAllAttributes ) );
m_pViewport->Show();
@@ -348,7 +348,7 @@ namespace frm
}
else
{
- m_pVScroll = new ScrollBar( m_pAntiImpl, WB_VSCROLL | WB_DRAG | WB_REPEAT );
+ m_pVScroll = VclPtr<ScrollBar>::Create( m_pAntiImpl, WB_VSCROLL | WB_DRAG | WB_REPEAT );
m_pVScroll->SetScrollHdl ( LINK( this, RichTextControlImpl, OnVScroll ) );
m_pVScroll->Show();
}
@@ -359,7 +359,7 @@ namespace frm
}
else
{
- m_pHScroll = new ScrollBar( m_pAntiImpl, WB_HSCROLL | WB_DRAG | WB_REPEAT );
+ m_pHScroll = VclPtr<ScrollBar>::Create( m_pAntiImpl, WB_HSCROLL | WB_DRAG | WB_REPEAT );
m_pHScroll->SetScrollHdl ( LINK( this, RichTextControlImpl, OnHScroll ) );
m_pHScroll->Show();
}
@@ -367,7 +367,7 @@ namespace frm
if ( m_pHScroll && m_pVScroll )
{
m_pScrollCorner.disposeAndClear();
- m_pScrollCorner = new ScrollBarBox( m_pAntiImpl );
+ m_pScrollCorner = VclPtr<ScrollBarBox>::Create( m_pAntiImpl );
m_pScrollCorner->Show();
}
else
diff --git a/forms/source/solar/component/navbarcontrol.cxx b/forms/source/solar/component/navbarcontrol.cxx
index 695aadcd3bb2..6d335d9bf3de 100644
--- a/forms/source/solar/component/navbarcontrol.cxx
+++ b/forms/source/solar/component/navbarcontrol.cxx
@@ -223,7 +223,7 @@ namespace frm
// the VCL control for the peer
Reference< XModel > xContextDocument( getXModel( _rxModel ) );
- NavigationToolBar* pNavBar = new NavigationToolBar(
+ VclPtrInstance<NavigationToolBar> pNavBar(
_pParentWindow,
lcl_getWinBits_nothrow( _rxModel ),
createDocumentCommandImageProvider( _rxORB, xContextDocument ),
diff --git a/forms/source/solar/control/navtoolbar.cxx b/forms/source/solar/control/navtoolbar.cxx
index 88b854bf9155..19bcd6937d5f 100644
--- a/forms/source/solar/control/navtoolbar.cxx
+++ b/forms/source/solar/control/navtoolbar.cxx
@@ -236,7 +236,7 @@ namespace frm
void NavigationToolBar::implInit( )
{
- m_pToolbar = new ImplNavToolBar( this );
+ m_pToolbar = VclPtr<ImplNavToolBar>::Create( this );
m_pToolbar->SetOutStyle( TOOLBOX_STYLE_FLAT );
m_pToolbar->Show();
@@ -301,17 +301,17 @@ namespace frm
vcl::Window* pItemWindow = NULL;
if ( FormFeature::MoveAbsolute == pSupportedFeatures->nId )
{
- pItemWindow = new RecordPositionInput( m_pToolbar );
+ pItemWindow = VclPtr<RecordPositionInput>::Create( m_pToolbar );
static_cast< RecordPositionInput* >( pItemWindow )->setDispatcher( m_pDispatcher );
}
else if ( LID_RECORD_FILLER == pSupportedFeatures->nId )
{
- pItemWindow = new FixedText( m_pToolbar, WB_CENTER | WB_VCENTER );
+ pItemWindow = VclPtr<FixedText>::Create( m_pToolbar, WB_CENTER | WB_VCENTER );
pItemWindow->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
}
else
{
- pItemWindow = new FixedText( m_pToolbar, WB_VCENTER );
+ pItemWindow = VclPtr<FixedText>::Create( m_pToolbar, WB_VCENTER );
pItemWindow->SetBackground();
pItemWindow->SetPaintTransparent(true);
}
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<SvtFileDialog> SvtFilePicker::implCreateDialog( vcl::Window* _pParent )
{
WinBits nExtraBits;
WinBits nBits = getWinBits( nExtraBits );
- SvtFileDialog* dialog = new SvtFileDialog( _pParent, nBits, nExtraBits );
+ VclPtrInstance<SvtFileDialog> 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<SvtFileDialog> 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<SvtFileDialog> SvtFolderPicker::implCreateDialog( vcl::Window* _pParent )
{
- return new SvtFileDialog( _pParent, SFXWB_PATHDIALOG );
+ return VclPtr<SvtFileDialog>::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<SvtFileDialog> 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<HeaderBar>::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<PlacesListBox_Impl>::Create( this, rTitle );
mpImpl->SetSelectHdl( LINK( this, PlacesListBox, Selection ) );
mpImpl->SetDoubleClickHdl( LINK( this, PlacesListBox, DoubleClick ) ) ;
- mpAddBtn = new ImageButton( this, 0 );
+ mpAddBtn.reset( VclPtr<ImageButton>::Create( this, 0 ) );
mpAddBtn->SetText( OUString( "+" ) );
mpAddBtn->SetPosSizePixel( Point( 0, 0 ), Size( 22, 22 ) );
mpAddBtn->Show();
- mpDelBtn = new ImageButton( this, 0 );
+ mpDelBtn.reset( VclPtr<ImageButton>::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<SvtFileDialog> 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<vcl::Window>("up");
- _pImp->_pBtnUp = new SvtUpButton_Impl(pUpContainer, this, 0);
+ _pImp->_pBtnUp = VclPtr<SvtUpButton_Impl>::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<vcl::Window>("container"));
+ _pContainer.reset(VclPtr<CustomContainer>::Create(get<vcl::Window>("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<SvtFileView>::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<Splitter>::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<FixedBitmap>::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<PlacesListBox>::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<SvtFileDialog> pDlg(this,SFXWB_PATHDIALOG);
pDlg->Execute();
- delete pDlg;
printf("ok\n");
}