summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-04-17 09:11:51 +0100
committerMichael Meeks <michael.meeks@collabora.com>2015-04-17 09:15:06 +0100
commit5cc560f6c27dc60764f644d6b5fb5ccb1b8072be (patch)
tree7ecc9dbe064ece9599e5b99891bc00f5efaef07b
parent5d5f447e738f159297b3d7bf10220c3cdfe7e2fa (diff)
basctl, basic: convert new to ::Create.
Change-Id: I1fc2c69640ed625425a679380d6f25178bc5aeb1
-rw-r--r--basctl/source/basicide/baside2.cxx6
-rw-r--r--basctl/source/basicide/baside2b.cxx22
-rw-r--r--basctl/source/basicide/baside3.cxx2
-rw-r--r--basctl/source/basicide/basides2.cxx4
-rw-r--r--basctl/source/basicide/basides3.cxx4
-rw-r--r--basctl/source/basicide/basidesh.cxx10
-rw-r--r--basctl/source/basicide/layout.cxx4
-rw-r--r--basctl/source/basicide/moduldl2.cxx2
-rw-r--r--basctl/source/basicide/moduldlg.cxx14
-rw-r--r--basctl/source/basicide/objdlg.cxx4
-rw-r--r--basic/source/runtime/inputbox.cxx4
-rw-r--r--basic/source/runtime/iosys.cxx4
-rw-r--r--basic/source/runtime/methods.cxx10
-rw-r--r--vcl/README.lifecycle7
14 files changed, 52 insertions, 45 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index df27e30983a8..48f9eabc07d7 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -192,7 +192,7 @@ ModulWindow::ModulWindow (
BaseWindow(pParent, rDocument, aLibName, aName),
rLayout(*pParent),
nValid(ValidWindow),
- aXEditorWindow(new ComplexEditorWindow(this)),
+ aXEditorWindow(VclPtr<ComplexEditorWindow>::Create(this)),
m_aModule(aModule)
{
aXEditorWindow->Show();
@@ -1470,8 +1470,8 @@ void ModulWindow::UpdateModule ()
ModulWindowLayout::ModulWindowLayout (vcl::Window* pParent, ObjectCatalog& rObjectCatalog_) :
Layout(pParent),
pChild(0),
- aWatchWindow(new WatchWindow(this)),
- aStackWindow(new StackWindow(this)),
+ aWatchWindow(VclPtr<WatchWindow>::Create(this)),
+ aStackWindow(VclPtr<StackWindow>::Create(this)),
rObjectCatalog(rObjectCatalog_)
{ }
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 076aa3e08506..f44fb4e28aac 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -227,7 +227,7 @@ EditorWindow::EditorWindow (vcl::Window* pParent, ModulWindow* pModulWindow) :
bHighlightning(false),
bDoSyntaxHighlight(true),
bDelayHighlight(true),
- pCodeCompleteWnd(new CodeCompleteWindow(this))
+ pCodeCompleteWnd(VclPtr<CodeCompleteWindow>::Create(this))
{
SetBackground(Wallpaper(GetSettings().GetStyleSettings().GetFieldColor()));
SetPointer( Pointer( POINTER_TEXT ) );
@@ -1599,11 +1599,11 @@ namespace
WatchWindow::WatchWindow (Layout* pParent) :
DockingWindow(pParent),
aWatchStr( IDEResId( RID_STR_REMOVEWATCH ) ),
- aXEdit( new ExtendedEdit(this, IDEResId( RID_EDT_WATCHEDIT )) ),
- aRemoveWatchButton( new ImageButton(this, IDEResId( RID_IMGBTN_REMOVEWATCH )) ),
- aTreeListBox( new WatchTreeListBox(this, WB_BORDER | WB_3DLOOK | WB_HASBUTTONS | WB_HASLINES | WB_HSCROLL | WB_TABSTOP
+ aXEdit( VclPtr<ExtendedEdit>::Create(this, IDEResId( RID_EDT_WATCHEDIT )) ),
+ aRemoveWatchButton( VclPtr<ImageButton>::Create(this, IDEResId( RID_IMGBTN_REMOVEWATCH )) ),
+ aTreeListBox( VclPtr<WatchTreeListBox>::Create(this, WB_BORDER | WB_3DLOOK | WB_HASBUTTONS | WB_HASLINES | WB_HSCROLL | WB_TABSTOP
| WB_HASLINESATROOT | WB_HASBUTTONSATROOT) ),
- aHeaderBar( new HeaderBar( this, WB_BUTTONSTYLE | WB_BORDER ) )
+ aHeaderBar( VclPtr<HeaderBar>::Create( this, WB_BUTTONSTYLE | WB_BORDER ) )
{
aXEdit->SetAccessibleName(IDEResId(RID_STR_WATCHNAME).toString());
aTreeListBox->SetAccessibleName(IDEResId(RID_STR_WATCHNAME).toString());
@@ -1902,7 +1902,7 @@ void WatchWindow::UpdateWatches( bool bBasicStopped )
StackWindow::StackWindow (Layout* pParent) :
DockingWindow(pParent),
- aTreeListBox( new SvTreeListBox(this, WB_BORDER | WB_3DLOOK | WB_HSCROLL | WB_TABSTOP) ),
+ aTreeListBox( VclPtr<SvTreeListBox>::Create(this, WB_BORDER | WB_3DLOOK | WB_HSCROLL | WB_TABSTOP) ),
aStackStr( IDEResId( RID_STR_STACK ) )
{
aTreeListBox->SetHelpId(HID_BASICIDE_STACKWINDOW_LIST);
@@ -2044,10 +2044,10 @@ void StackWindow::UpdateCalls()
ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) :
Window( pParent, WB_3DLOOK | WB_CLIPCHILDREN ),
- aBrkWindow(new BreakPointWindow(this, pParent)),
- aLineNumberWindow(new LineNumberWindow(this, pParent)),
- aEdtWindow(new EditorWindow(this, pParent)),
- aEWVScrollBar( new ScrollBar(this, WB_VSCROLL | WB_DRAG) )
+ aBrkWindow(VclPtr<BreakPointWindow>::Create(this, pParent)),
+ aLineNumberWindow(VclPtr<LineNumberWindow>::Create(this, pParent)),
+ aEdtWindow(VclPtr<EditorWindow>::Create(this, pParent)),
+ aEWVScrollBar( VclPtr<ScrollBar>::Create(this, WB_VSCROLL | WB_DRAG) )
{
aEdtWindow->Show();
aBrkWindow->Show();
@@ -2862,7 +2862,7 @@ void CodeCompleteListBox::HideAndRestoreFocus()
CodeCompleteWindow::CodeCompleteWindow( EditorWindow* pPar )
: Window( pPar ),
pParent( pPar ),
-pListBox( new CodeCompleteListBox(this) )
+pListBox( VclPtr<CodeCompleteListBox>::Create(this) )
{
SetSizePixel( Size(151,151) ); //default, later it changes
InitListBox();
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index fb497e153318..fd82a982f55e 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -1427,7 +1427,7 @@ void DialogWindowLayout::ShowPropertyBrowser ()
if (!pPropertyBrowser)
{
// creating
- pPropertyBrowser = new PropBrw(*this);
+ pPropertyBrowser = VclPtr<PropBrw>::Create(*this);
pPropertyBrowser->Show();
// after OnFirstSize():
if (HasSize())
diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx
index 3e88d55a9e98..43d57abeea7a 100644
--- a/basctl/source/basicide/basides2.cxx
+++ b/basctl/source/basicide/basides2.cxx
@@ -166,8 +166,8 @@ ModulWindow* Shell::CreateBasWin( const ScriptDocument& rDocument, const OUStrin
{
// new module window
if (!pModulLayout)
- pModulLayout.reset(new ModulWindowLayout(&GetViewFrame()->GetWindow(), *aObjectCatalog.get()));
- pWin = new ModulWindow(pModulLayout.get(), rDocument, aLibName, aModName, aModule);
+ pModulLayout.reset(VclPtr<ModulWindowLayout>::Create(&GetViewFrame()->GetWindow(), *aObjectCatalog.get()));
+ pWin = VclPtr<ModulWindow>::Create(pModulLayout.get(), rDocument, aLibName, aModName, aModule);
nKey = InsertWindowInTable( pWin );
}
else // we've gotten called recursively ( via listener from createModule above ), get outta here
diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx
index 5b2f93d3beca..8479fd8a39a2 100644
--- a/basctl/source/basicide/basides3.cxx
+++ b/basctl/source/basicide/basides3.cxx
@@ -77,8 +77,8 @@ DialogWindow* Shell::CreateDlgWin( const ScriptDocument& rDocument, const OUStri
// new dialog window
if (!pDialogLayout)
- pDialogLayout.reset(new DialogWindowLayout(&GetViewFrame()->GetWindow(), *aObjectCatalog.get()));
- pWin = new DialogWindow(pDialogLayout.get(), rDocument, aLibName, aDlgName, xDialogModel);
+ pDialogLayout.reset(VclPtr<DialogWindowLayout>::Create(&GetViewFrame()->GetWindow(), *aObjectCatalog.get()));
+ pWin = VclPtr<DialogWindow>::Create(pDialogLayout.get(), rDocument, aLibName, aDlgName, xDialogModel);
nKey = InsertWindowInTable( pWin );
}
}
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index 7715de063057..1a72774c5bbc 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -155,11 +155,11 @@ unsigned Shell::nShellCount = 0;
Shell::Shell( SfxViewFrame* pFrame_, SfxViewShell* /* pOldShell */ ) :
SfxViewShell( pFrame_, ShellFlags ),
m_aCurDocument( ScriptDocument::getApplicationScriptDocument() ),
- aHScrollBar( new ScrollBar(&GetViewFrame()->GetWindow(), WinBits( WB_HSCROLL | WB_DRAG )) ),
- aVScrollBar( new ScrollBar(&GetViewFrame()->GetWindow(), WinBits( WB_VSCROLL | WB_DRAG )) ),
- aScrollBarBox( new ScrollBarBox(&GetViewFrame()->GetWindow(), WinBits( WB_SIZEABLE )) ),
+ aHScrollBar( VclPtr<ScrollBar>::Create(&GetViewFrame()->GetWindow(), WinBits( WB_HSCROLL | WB_DRAG )) ),
+ aVScrollBar( VclPtr<ScrollBar>::Create(&GetViewFrame()->GetWindow(), WinBits( WB_VSCROLL | WB_DRAG )) ),
+ aScrollBarBox( VclPtr<ScrollBarBox>::Create(&GetViewFrame()->GetWindow(), WinBits( WB_SIZEABLE )) ),
pLayout(0),
- aObjectCatalog(new ObjectCatalog(&GetViewFrame()->GetWindow())),
+ aObjectCatalog(VclPtr<ObjectCatalog>::Create(&GetViewFrame()->GetWindow())),
m_bAppBasicModified( false ),
m_aNotifier( *this )
{
@@ -195,7 +195,7 @@ void Shell::Init()
m_aCurDocument = ScriptDocument::getApplicationScriptDocument();
bCreatingWindow = false;
- pTabBar.reset(new TabBar(&GetViewFrame()->GetWindow()));
+ pTabBar.reset(VclPtr<TabBar>::Create(&GetViewFrame()->GetWindow()));
pTabBar->SetSplitHdl( LINK( this, Shell, TabBarSplitHdl ) );
bTabBarSplitted = false;
diff --git a/basctl/source/basicide/layout.cxx b/basctl/source/basicide/layout.cxx
index 0c7a40dda941..2bca3ce4349b 100644
--- a/basctl/source/basicide/layout.cxx
+++ b/basctl/source/basicide/layout.cxx
@@ -173,7 +173,7 @@ Layout::SplittedSide::SplittedSide (Layout* pParent, Side eSide) :
bVertical(eSide == Left || eSide == Right),
bLower(eSide == Left || eSide == Top),
nSize(0),
- aSplitter(new Splitter(pParent, bVertical ? WB_HSCROLL : WB_VSCROLL))
+ aSplitter(VclPtr<Splitter>::Create(pParent, bVertical ? WB_HSCROLL : WB_VSCROLL))
{
InitSplitter(*aSplitter.get());
}
@@ -195,7 +195,7 @@ void Layout::SplittedSide::Add (DockingWindow* pWin, Size const& rSize)
// splitter
if (!vItems.empty())
{
- aItem.pSplit = new Splitter(&rLayout, bVertical ? WB_VSCROLL : WB_HSCROLL);
+ aItem.pSplit = VclPtr<Splitter>::Create(&rLayout, bVertical ? WB_VSCROLL : WB_HSCROLL);
aItem.pSplit->SetSplitPosPixel(aItem.nStartPos - nSplitThickness);
InitSplitter(*aItem.pSplit);
}
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index a4abe70644af..00baa2e0c0e1 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -838,7 +838,7 @@ void LibPage::InsertLib()
// library import dialog
if ( !pLibDlg )
{
- pLibDlg.reset(new LibDialog( this ));
+ pLibDlg.reset(VclPtr<LibDialog>::Create( this ));
pLibDlg->SetStorageName( aURLObj.getName() );
pLibDlg->GetLibBox().SetMode(ObjectMode::Library);
}
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index 2e633512832c..44b8c02120df 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -518,25 +518,25 @@ IMPL_LINK( OrganizeDialog, ActivatePageHdl, TabControl *, pTabCtrl )
if ( !pTabCtrl->GetTabPage( nId ) )
{
OString sPageName(pTabCtrl->GetPageName(nId));
- TabPage* pNewTabPage = 0;
+ VclPtr<TabPage> pNewTabPage;
if (sPageName == "modules")
{
- ObjectPage* pObjectPage = new ObjectPage(pTabCtrl, "ModulePage", BROWSEMODE_MODULES);
- pNewTabPage = pObjectPage;
+ VclPtrInstance<ObjectPage> pObjectPage(pTabCtrl, "ModulePage", BROWSEMODE_MODULES);
+ pNewTabPage.reset(pObjectPage);
pObjectPage->SetTabDlg(this);
pObjectPage->SetCurrentEntry(m_aCurEntry);
}
else if (sPageName == "dialogs")
{
- ObjectPage* pObjectPage = new ObjectPage( pTabCtrl, "DialogPage", BROWSEMODE_DIALOGS );
- pNewTabPage = pObjectPage;
+ VclPtrInstance<ObjectPage> pObjectPage( pTabCtrl, "DialogPage", BROWSEMODE_DIALOGS );
+ pNewTabPage.reset(pObjectPage);
pObjectPage->SetTabDlg(this);
pObjectPage->SetCurrentEntry(m_aCurEntry);
}
else if (sPageName == "libraries")
{
- LibPage* pLibPage = new LibPage( pTabCtrl );
- pNewTabPage = pLibPage;
+ VclPtrInstance<LibPage> pLibPage( pTabCtrl );
+ pNewTabPage.reset(pLibPage);
pLibPage->SetTabDlg( this );
}
else
diff --git a/basctl/source/basicide/objdlg.cxx b/basctl/source/basicide/objdlg.cxx
index e0dc7059d02f..d8b9538aff3d 100644
--- a/basctl/source/basicide/objdlg.cxx
+++ b/basctl/source/basicide/objdlg.cxx
@@ -30,8 +30,8 @@ namespace basctl
ObjectCatalog::ObjectCatalog (vcl::Window* pParent) :
DockingWindow(pParent),
- aTitle(new FixedText(this)),
- aTree(new TreeListBox(this, IDEResId(RID_TLB_MACROS)))
+ aTitle(VclPtr<FixedText>::Create(this)),
+ aTree(VclPtr<TreeListBox>::Create(this, IDEResId(RID_TLB_MACROS)))
{
SetHelpId("basctl:FloatingWindow:RID_BASICIDE_OBJCAT");
SetText(IDEResId(RID_BASICIDE_OBJCAT).toString());
diff --git a/basic/source/runtime/inputbox.cxx b/basic/source/runtime/inputbox.cxx
index 21f677e5cab8..97208770c0a1 100644
--- a/basic/source/runtime/inputbox.cxx
+++ b/basic/source/runtime/inputbox.cxx
@@ -55,8 +55,8 @@ SvRTLInputBox::SvRTLInputBox( vcl::Window* pParent, const OUString& rPrompt,
const OUString& rTitle, const OUString& rDefault,
long nXTwips, long nYTwips ) :
ModalDialog( pParent,WB_3DLOOK | WB_MOVEABLE | WB_CLOSEABLE ),
- aEdit( new Edit(this, WB_LEFT | WB_BORDER) ),
- aOk( new OKButton(this) ), aCancel( new CancelButton(this) ), aPromptText( new FixedText(this, WB_WORDBREAK) )
+ aEdit( VclPtr<Edit>::Create(this, WB_LEFT | WB_BORDER) ),
+ aOk( new OKButton(this) ), aCancel( new CancelButton(this) ), aPromptText( VclPtr<FixedText>::Create(this, WB_WORDBREAK) )
{
SetMapMode( MapMode( MAP_APPFONT ) );
Size aDlgSizeApp( 280, 80 );
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 45a273fb0e02..9a3874c7ba2b 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -81,8 +81,8 @@ public:
SbiInputDialog::SbiInputDialog( vcl::Window* pParent, const OUString& rPrompt )
:ModalDialog( pParent, WB_3DLOOK | WB_MOVEABLE | WB_CLOSEABLE ),
- aInput( new Edit(this, WB_3DLOOK | WB_LEFT | WB_BORDER) ),
- aOk( new OKButton(this) ), aCancel( new CancelButton(this) )
+ aInput( VclPtr<Edit>::Create(this, WB_3DLOOK | WB_LEFT | WB_BORDER) ),
+ aOk( new OKButton(this) ), aCancel( VclPtr<CancelButton>::Create(this) )
{
SetText( rPrompt );
aOk->SetClickHdl( LINK( this, SbiInputDialog, Ok ) );
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 19bc0bf7b25e..226c5ad1dbcc 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -4615,19 +4615,19 @@ RTLFUNC(MsgBox)
switch( nType )
{
case 16:
- pBox.reset(new ErrorBox( pParent, nWinBits, aMsg ));
+ pBox.reset(VclPtr<ErrorBox>::Create( pParent, nWinBits, aMsg ));
break;
case 32:
- pBox.reset(new QueryBox( pParent, nWinBits, aMsg ));
+ pBox.reset(VclPtr<QueryBox>::Create( pParent, nWinBits, aMsg ));
break;
case 48:
- pBox.reset(new WarningBox( pParent, nWinBits, aMsg ));
+ pBox.reset(VclPtr<WarningBox>::Create( pParent, nWinBits, aMsg ));
break;
case 64:
- pBox.reset(new InfoBox( pParent, nWinBits, aMsg ));
+ pBox.reset(VclPtr<InfoBox>::Create( pParent, nWinBits, aMsg ));
break;
default:
- pBox.reset(new MessBox( pParent, nWinBits, aTitle, aMsg ));
+ pBox.reset(VclPtr<MessBox>::Create( pParent, nWinBits, aTitle, aMsg ));
}
pBox->SetText( aTitle );
sal_uInt16 nRet = (sal_uInt16)pBox->Execute();
diff --git a/vcl/README.lifecycle b/vcl/README.lifecycle
index 7e3402649ebc..1f609172e7fc 100644
--- a/vcl/README.lifecycle
+++ b/vcl/README.lifecycle
@@ -189,6 +189,12 @@ or:
in 'get()' calls - to avoid needing explicit 'clear'
code in destructors.
+ * VclBuilder 'makeFoo' methods
+ + these should return VclPtr<> types and have their
+ signatures adjusted en-masse.
+ + currently we use a VclPtr<> constructor with
+ SAL_NO_ACQUIRE inside the builder.
+
---------- FAQ / debugging hints ----------
** Compile with dbgutil
@@ -253,3 +259,4 @@ or:
In simple cases, if we allocate the widget with VclPtrInstance
or VclPtr<Foo>::Create - then we need to disposeAndClear it too.
+