Skip to content

Commit

Permalink
drawinglayer, editeng, forms, fpicker: convert new to ::Create.
Browse files Browse the repository at this point in the history
Change-Id: I5144ac74a09a3ac5679abca89e7d87386f2484fd
  • Loading branch information
mmeeks committed Apr 16, 2015
1 parent 5252a1d commit a461467
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 33 deletions.
2 changes: 1 addition & 1 deletion drawinglayer/source/primitive2d/textlayoutdevice.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ namespace
{
if(!mpVirDev)
{
mpVirDev = new VirtualDevice();
mpVirDev = VclPtr<VirtualDevice>::Create();
mpVirDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 );
}

Expand Down
2 changes: 1 addition & 1 deletion drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion editeng/source/editeng/impedit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion forms/source/richtext/richtextcontrol.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
8 changes: 4 additions & 4 deletions forms/source/richtext/richtextimplcontrol.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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();
}
Expand All @@ -359,15 +359,15 @@ 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();
}

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
Expand Down
2 changes: 1 addition & 1 deletion forms/source/solar/component/navbarcontrol.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 ),
Expand Down
8 changes: 4 additions & 4 deletions forms/source/solar/control/navtoolbar.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions fpicker/source/office/OfficeFilePicker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion fpicker/source/office/OfficeFilePicker.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions fpicker/source/office/OfficeFolderPicker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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( )
Expand Down
2 changes: 1 addition & 1 deletion fpicker/source/office/OfficeFolderPicker.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
8 changes: 4 additions & 4 deletions fpicker/source/office/PlacesListBox.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion fpicker/source/office/commonpicker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion fpicker/source/office/commonpicker.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...

Expand Down
12 changes: 6 additions & 6 deletions fpicker/source/office/iodlg.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -541,23 +541,23 @@ 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());
_pContainer->set_hexpand(true);
_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();
_pFileView->EnableAutoResize();
_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 ) );

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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());
Expand Down
3 changes: 1 addition & 2 deletions fpicker/test/svdem.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down

0 comments on commit a461467

Please sign in to comment.