Kaydet (Commit) a461467a authored tarafından Michael Meeks's avatar Michael Meeks

drawinglayer, editeng, forms, fpicker: convert new to ::Create.

Change-Id: I5144ac74a09a3ac5679abca89e7d87386f2484fd
üst 5252a1d8
...@@ -97,7 +97,7 @@ namespace ...@@ -97,7 +97,7 @@ namespace
{ {
if(!mpVirDev) if(!mpVirDev)
{ {
mpVirDev = new VirtualDevice(); mpVirDev = VclPtr<VirtualDevice>::Create();
mpVirDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 ); mpVirDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 );
} }
......
...@@ -163,7 +163,7 @@ namespace ...@@ -163,7 +163,7 @@ namespace
// no success yet, create new buffer // no success yet, create new buffer
if(!pRetval) if(!pRetval)
{ {
pRetval = new VirtualDevice(rOutDev, nBits); pRetval = VclPtr<VirtualDevice>::Create(rOutDev, nBits);
pRetval->SetOutputSizePixel(rSizePixel, bClear); pRetval->SetOutputSizePixel(rSizePixel, bClear);
} }
else else
......
...@@ -1589,7 +1589,7 @@ void ImpEditView::ShowDDCursor( const Rectangle& rRect ) ...@@ -1589,7 +1589,7 @@ void ImpEditView::ShowDDCursor( const Rectangle& rRect )
#endif #endif
if ( !pDragAndDropInfo->pBackground ) if ( !pDragAndDropInfo->pBackground )
{ {
pDragAndDropInfo->pBackground = new VirtualDevice( *GetWindow() ); pDragAndDropInfo->pBackground = VclPtr<VirtualDevice>::Create( *GetWindow() );
MapMode aMapMode( GetWindow()->GetMapMode() ); MapMode aMapMode( GetWindow()->GetMapMode() );
aMapMode.SetOrigin( Point( 0, 0 ) ); aMapMode.SetOrigin( Point( 0, 0 ) );
pDragAndDropInfo->pBackground->SetMapMode( aMapMode ); pDragAndDropInfo->pBackground->SetMapMode( aMapMode );
......
...@@ -290,7 +290,7 @@ namespace frm ...@@ -290,7 +290,7 @@ namespace frm
pPeer->acquire(); // by definition, the returned object is acquired once pPeer->acquire(); // by definition, the returned object is acquired once
// the VCL control for the peer // 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 // some knittings
pRichTextControl->SetComponentInterface( pPeer ); pRichTextControl->SetComponentInterface( pPeer );
......
...@@ -56,7 +56,7 @@ namespace frm ...@@ -56,7 +56,7 @@ namespace frm
OSL_ENSURE( m_pAntiImpl, "RichTextControlImpl::RichTextControlImpl: invalid window!" ); OSL_ENSURE( m_pAntiImpl, "RichTextControlImpl::RichTextControlImpl: invalid window!" );
OSL_ENSURE( m_pEngine, "RichTextControlImpl::RichTextControlImpl: invalid edit engine! This will *definitely* crash!" ); 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->setAttributeInvalidationHandler( LINK( this, RichTextControlImpl, OnInvalidateAllAttributes ) );
m_pViewport->Show(); m_pViewport->Show();
...@@ -348,7 +348,7 @@ namespace frm ...@@ -348,7 +348,7 @@ namespace frm
} }
else 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->SetScrollHdl ( LINK( this, RichTextControlImpl, OnVScroll ) );
m_pVScroll->Show(); m_pVScroll->Show();
} }
...@@ -359,7 +359,7 @@ namespace frm ...@@ -359,7 +359,7 @@ namespace frm
} }
else 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->SetScrollHdl ( LINK( this, RichTextControlImpl, OnHScroll ) );
m_pHScroll->Show(); m_pHScroll->Show();
} }
...@@ -367,7 +367,7 @@ namespace frm ...@@ -367,7 +367,7 @@ namespace frm
if ( m_pHScroll && m_pVScroll ) if ( m_pHScroll && m_pVScroll )
{ {
m_pScrollCorner.disposeAndClear(); m_pScrollCorner.disposeAndClear();
m_pScrollCorner = new ScrollBarBox( m_pAntiImpl ); m_pScrollCorner = VclPtr<ScrollBarBox>::Create( m_pAntiImpl );
m_pScrollCorner->Show(); m_pScrollCorner->Show();
} }
else else
......
...@@ -223,7 +223,7 @@ namespace frm ...@@ -223,7 +223,7 @@ namespace frm
// the VCL control for the peer // the VCL control for the peer
Reference< XModel > xContextDocument( getXModel( _rxModel ) ); Reference< XModel > xContextDocument( getXModel( _rxModel ) );
NavigationToolBar* pNavBar = new NavigationToolBar( VclPtrInstance<NavigationToolBar> pNavBar(
_pParentWindow, _pParentWindow,
lcl_getWinBits_nothrow( _rxModel ), lcl_getWinBits_nothrow( _rxModel ),
createDocumentCommandImageProvider( _rxORB, xContextDocument ), createDocumentCommandImageProvider( _rxORB, xContextDocument ),
......
...@@ -236,7 +236,7 @@ namespace frm ...@@ -236,7 +236,7 @@ namespace frm
void NavigationToolBar::implInit( ) void NavigationToolBar::implInit( )
{ {
m_pToolbar = new ImplNavToolBar( this ); m_pToolbar = VclPtr<ImplNavToolBar>::Create( this );
m_pToolbar->SetOutStyle( TOOLBOX_STYLE_FLAT ); m_pToolbar->SetOutStyle( TOOLBOX_STYLE_FLAT );
m_pToolbar->Show(); m_pToolbar->Show();
...@@ -301,17 +301,17 @@ namespace frm ...@@ -301,17 +301,17 @@ namespace frm
vcl::Window* pItemWindow = NULL; vcl::Window* pItemWindow = NULL;
if ( FormFeature::MoveAbsolute == pSupportedFeatures->nId ) if ( FormFeature::MoveAbsolute == pSupportedFeatures->nId )
{ {
pItemWindow = new RecordPositionInput( m_pToolbar ); pItemWindow = VclPtr<RecordPositionInput>::Create( m_pToolbar );
static_cast< RecordPositionInput* >( pItemWindow )->setDispatcher( m_pDispatcher ); static_cast< RecordPositionInput* >( pItemWindow )->setDispatcher( m_pDispatcher );
} }
else if ( LID_RECORD_FILLER == pSupportedFeatures->nId ) 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))); pItemWindow->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
} }
else else
{ {
pItemWindow = new FixedText( m_pToolbar, WB_VCENTER ); pItemWindow = VclPtr<FixedText>::Create( m_pToolbar, WB_VCENTER );
pItemWindow->SetBackground(); pItemWindow->SetBackground();
pItemWindow->SetPaintTransparent(true); pItemWindow->SetPaintTransparent(true);
} }
......
...@@ -463,12 +463,12 @@ sal_Int16 SvtFilePicker::implExecutePicker( ) ...@@ -463,12 +463,12 @@ sal_Int16 SvtFilePicker::implExecutePicker( )
} }
SvtFileDialog* SvtFilePicker::implCreateDialog( vcl::Window* _pParent ) VclPtr<SvtFileDialog> SvtFilePicker::implCreateDialog( vcl::Window* _pParent )
{ {
WinBits nExtraBits; WinBits nExtraBits;
WinBits nBits = getWinBits( nExtraBits ); WinBits nBits = getWinBits( nExtraBits );
SvtFileDialog* dialog = new SvtFileDialog( _pParent, nBits, nExtraBits ); VclPtrInstance<SvtFileDialog> dialog( _pParent, nBits, nExtraBits );
// Set StandardDir if present // Set StandardDir if present
if ( !m_aStandardDir.isEmpty()) if ( !m_aStandardDir.isEmpty())
......
...@@ -205,7 +205,7 @@ protected: ...@@ -205,7 +205,7 @@ protected:
// OCommonPicker overridables // 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 sal_Int16 implExecutePicker( ) SAL_OVERRIDE;
virtual bool implHandleInitializationArgument( virtual bool implHandleInitializationArgument(
const OUString& _rName, const OUString& _rName,
......
...@@ -69,9 +69,9 @@ void SAL_CALL SvtFolderPicker::startExecuteModal( const Reference< ::com::sun::s ...@@ -69,9 +69,9 @@ void SAL_CALL SvtFolderPicker::startExecuteModal( const Reference< ::com::sun::s
getDialog()->StartExecuteModal( LINK( this, SvtFolderPicker, DialogClosedHdl ) ); 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( ) sal_Int16 SvtFolderPicker::implExecutePicker( )
......
...@@ -99,7 +99,7 @@ protected: ...@@ -99,7 +99,7 @@ protected:
// OCommonPicker overridables // 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 sal_Int16 implExecutePicker( ) SAL_OVERRIDE;
}; };
......
...@@ -24,7 +24,7 @@ PlacesListBox_Impl::PlacesListBox_Impl( PlacesListBox* pParent, const OUString& ...@@ -24,7 +24,7 @@ PlacesListBox_Impl::PlacesListBox_Impl( PlacesListBox* pParent, const OUString&
mpParent( pParent ) mpParent( pParent )
{ {
Size aBoxSize = pParent->GetSizePixel( ); 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 ) ); mpHeaderBar->SetPosSizePixel( Point( 0, 0 ), Size( 600, 16 ) );
long pTabs[] = { 2, 20, 600 }; long pTabs[] = { 2, 20, 600 };
...@@ -70,17 +70,17 @@ PlacesListBox::PlacesListBox( vcl::Window* pParent, SvtFileDialog* pFileDlg, con ...@@ -70,17 +70,17 @@ PlacesListBox::PlacesListBox( vcl::Window* pParent, SvtFileDialog* pFileDlg, con
mbUpdated( false ), mbUpdated( false ),
mbSelectionChanged( false ) mbSelectionChanged( false )
{ {
mpImpl = new PlacesListBox_Impl( this, rTitle ); mpImpl = VclPtr<PlacesListBox_Impl>::Create( this, rTitle );
mpImpl->SetSelectHdl( LINK( this, PlacesListBox, Selection ) ); mpImpl->SetSelectHdl( LINK( this, PlacesListBox, Selection ) );
mpImpl->SetDoubleClickHdl( LINK( this, PlacesListBox, DoubleClick ) ) ; mpImpl->SetDoubleClickHdl( LINK( this, PlacesListBox, DoubleClick ) ) ;
mpAddBtn = new ImageButton( this, 0 ); mpAddBtn.reset( VclPtr<ImageButton>::Create( this, 0 ) );
mpAddBtn->SetText( OUString( "+" ) ); mpAddBtn->SetText( OUString( "+" ) );
mpAddBtn->SetPosSizePixel( Point( 0, 0 ), Size( 22, 22 ) ); mpAddBtn->SetPosSizePixel( Point( 0, 0 ), Size( 22, 22 ) );
mpAddBtn->Show(); mpAddBtn->Show();
mpDelBtn = new ImageButton( this, 0 ); mpDelBtn.reset( VclPtr<ImageButton>::Create( this, 0 ) );
mpDelBtn->SetText( OUString( "-" ) ); mpDelBtn->SetText( OUString( "-" ) );
mpDelBtn->SetPosSizePixel( Point( 0, 0 ), Size( 22, 22 ) ); mpDelBtn->SetPosSizePixel( Point( 0, 0 ), Size( 22, 22 ) );
mpDelBtn->Show(); mpDelBtn->Show();
......
...@@ -201,7 +201,7 @@ namespace svt ...@@ -201,7 +201,7 @@ namespace svt
{ {
if ( !m_pDlg ) 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!" ); DBG_ASSERT( m_pDlg, "OCommonPicker::createPicker: invalid dialog returned!" );
if ( m_pDlg ) if ( m_pDlg )
......
...@@ -93,7 +93,7 @@ namespace svt ...@@ -93,7 +93,7 @@ namespace svt
// overridables // overridables
// will be called with locked SolarMutex // 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; virtual sal_Int16 implExecutePicker( ) = 0;
// do NOT override XExecutableDialog::execute! We need to do some stuff there ourself ... // do NOT override XExecutableDialog::execute! We need to do some stuff there ourself ...
......
...@@ -499,7 +499,7 @@ void SvtFileDialog::Init_Impl ...@@ -499,7 +499,7 @@ void SvtFileDialog::Init_Impl
m_aImages = ImageList( SvtResId( RID_FILEPICKER_IMAGES ) ); m_aImages = ImageList( SvtResId( RID_FILEPICKER_IMAGES ) );
vcl::Window *pUpContainer = get<vcl::Window>("up"); 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->SetHelpId( HID_FILEOPEN_LEVELUP );
_pImp->_pBtnUp->set_vexpand(true); _pImp->_pBtnUp->set_vexpand(true);
_pImp->_pBtnUp->Show(); _pImp->_pBtnUp->Show();
...@@ -541,7 +541,7 @@ void SvtFileDialog::Init_Impl ...@@ -541,7 +541,7 @@ void SvtFileDialog::Init_Impl
if ( ( nStyle & SFXWB_MULTISELECTION ) == SFXWB_MULTISELECTION ) if ( ( nStyle & SFXWB_MULTISELECTION ) == SFXWB_MULTISELECTION )
_pImp->_bMultiSelection = true; _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)); Size aSize(LogicToPixel(Size(270, 85), MAP_APPFONT));
_pContainer->set_height_request(aSize.Height()); _pContainer->set_height_request(aSize.Height());
_pContainer->set_width_request(aSize.Width()); _pContainer->set_width_request(aSize.Width());
...@@ -549,7 +549,7 @@ void SvtFileDialog::Init_Impl ...@@ -549,7 +549,7 @@ void SvtFileDialog::Init_Impl
_pContainer->set_vexpand(true); _pContainer->set_vexpand(true);
_pContainer->SetStyle( _pContainer->GetStyle() | WB_TABSTOP ); _pContainer->SetStyle( _pContainer->GetStyle() | WB_TABSTOP );
_pFileView = new SvtFileView( _pContainer, WB_BORDER, _pFileView = VclPtr<SvtFileView>::Create( _pContainer, WB_BORDER,
FILEDLG_TYPE_PATHDLG == _pImp->_eDlgType, FILEDLG_TYPE_PATHDLG == _pImp->_eDlgType,
_pImp->_bMultiSelection ); _pImp->_bMultiSelection );
_pFileView->Show(); _pFileView->Show();
...@@ -557,7 +557,7 @@ void SvtFileDialog::Init_Impl ...@@ -557,7 +557,7 @@ void SvtFileDialog::Init_Impl
_pFileView->SetHelpId( HID_FILEDLG_STANDARD ); _pFileView->SetHelpId( HID_FILEDLG_STANDARD );
_pFileView->SetStyle( _pFileView->GetStyle() | WB_TABSTOP ); _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->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() ));
_pSplitter->SetSplitHdl( LINK( this, SvtFileDialog, Split_Hdl ) ); _pSplitter->SetSplitHdl( LINK( this, SvtFileDialog, Split_Hdl ) );
...@@ -2547,7 +2547,7 @@ void SvtFileDialog::AddControls_Impl( ) ...@@ -2547,7 +2547,7 @@ void SvtFileDialog::AddControls_Impl( )
_pPrevWin->SetOutputSizePixel(Size(200, 300)); _pPrevWin->SetOutputSizePixel(Size(200, 300));
_pPrevWin->Show(); _pPrevWin->Show();
_pPrevBmp = new FixedBitmap( _pPrevWin, WinBits( WB_BORDER ) ); _pPrevBmp = VclPtr<FixedBitmap>::Create( _pPrevWin, WinBits( WB_BORDER ) );
_pPrevBmp->SetBackground( Wallpaper( Color( COL_WHITE ) ) ); _pPrevBmp->SetBackground( Wallpaper( Color( COL_WHITE ) ) );
_pPrevBmp->SetSizePixel(_pPrevWin->GetSizePixel()); _pPrevBmp->SetSizePixel(_pPrevWin->GetSizePixel());
_pPrevBmp->Show(); _pPrevBmp->Show();
...@@ -2612,7 +2612,7 @@ void SvtFileDialog::AddControls_Impl( ) ...@@ -2612,7 +2612,7 @@ void SvtFileDialog::AddControls_Impl( )
_pImp->_pLbImageTemplates->Show(); _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"); _pImp->_pPlaces->SetHelpId("SVT_HID_FILESAVE_PLACES_LISTBOX");
Size aSize(LogicToPixel(Size(50, 85), MAP_APPFONT)); Size aSize(LogicToPixel(Size(50, 85), MAP_APPFONT));
_pImp->_pPlaces->set_height_request(aSize.Height()); _pImp->_pPlaces->set_height_request(aSize.Height());
......
...@@ -185,9 +185,8 @@ IMPL_LINK( MyWin, Test, PushButton*, pBtn ) ...@@ -185,9 +185,8 @@ IMPL_LINK( MyWin, Test, PushButton*, pBtn )
printf("Test\n"); printf("Test\n");
if ( pBtn == &aOKBtn ) if ( pBtn == &aOKBtn )
{ {
SvtFileDialog* pDlg = new SvtFileDialog( this,SFXWB_PATHDIALOG); ScopedVclPtrInstance<SvtFileDialog> pDlg(this,SFXWB_PATHDIALOG);
pDlg->Execute(); pDlg->Execute();
delete pDlg;
printf("ok\n"); printf("ok\n");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment