summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/appl/appopen.cxx10
-rw-r--r--sfx2/source/appl/appserv.cxx12
-rw-r--r--sfx2/source/appl/childwin.cxx24
-rw-r--r--sfx2/source/appl/fileobj.hxx2
-rw-r--r--sfx2/source/appl/helpinterceptor.hxx3
-rw-r--r--sfx2/source/appl/impldde.cxx30
-rw-r--r--sfx2/source/appl/lnkbase2.cxx4
-rw-r--r--sfx2/source/appl/module.cxx5
-rw-r--r--sfx2/source/appl/newhelp.cxx285
-rw-r--r--sfx2/source/appl/newhelp.hxx93
-rw-r--r--sfx2/source/appl/opengrf.cxx4
-rw-r--r--sfx2/source/appl/openuriexternally.cxx6
-rw-r--r--sfx2/source/appl/sfxhelp.cxx12
-rw-r--r--sfx2/source/appl/workwin.cxx29
-rw-r--r--sfx2/source/bastyp/fltfnc.cxx4
-rw-r--r--sfx2/source/control/ctrlitem.cxx9
-rw-r--r--sfx2/source/control/recentdocsview.cxx4
-rw-r--r--sfx2/source/control/templateabstractview.cxx36
-rw-r--r--sfx2/source/control/templatedefaultview.cxx4
-rw-r--r--sfx2/source/control/templatelocalview.cxx18
-rw-r--r--sfx2/source/control/templateremoteview.cxx6
-rw-r--r--sfx2/source/control/templatesearchview.cxx4
-rw-r--r--sfx2/source/control/thumbnailview.cxx14
-rw-r--r--sfx2/source/control/thumbnailviewacc.cxx2
-rw-r--r--sfx2/source/control/thumbnailviewacc.hxx3
-rw-r--r--sfx2/source/control/thumbnailviewitem.cxx13
-rw-r--r--sfx2/source/dialog/alienwarn.cxx9
-rw-r--r--sfx2/source/dialog/backingcomp.cxx12
-rw-r--r--sfx2/source/dialog/backingwindow.cxx44
-rw-r--r--sfx2/source/dialog/backingwindow.hxx47
-rw-r--r--sfx2/source/dialog/basedlgs.cxx56
-rw-r--r--sfx2/source/dialog/checkin.cxx13
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx478
-rw-r--r--sfx2/source/dialog/dockwin.cxx27
-rw-r--r--sfx2/source/dialog/documentfontsdialog.cxx15
-rw-r--r--sfx2/source/dialog/filedlgimpl.hxx2
-rw-r--r--sfx2/source/dialog/infobar.cxx71
-rw-r--r--sfx2/source/dialog/inputdlg.cxx14
-rw-r--r--sfx2/source/dialog/mailmodel.cxx4
-rw-r--r--sfx2/source/dialog/mgetempl.cxx52
-rw-r--r--sfx2/source/dialog/navigat.cxx4
-rw-r--r--sfx2/source/dialog/newstyle.cxx15
-rw-r--r--sfx2/source/dialog/partwnd.cxx16
-rw-r--r--sfx2/source/dialog/passwd.cxx26
-rw-r--r--sfx2/source/dialog/printopt.cxx30
-rw-r--r--sfx2/source/dialog/recfloat.cxx17
-rw-r--r--sfx2/source/dialog/securitypage.cxx30
-rw-r--r--sfx2/source/dialog/splitwin.cxx30
-rw-r--r--sfx2/source/dialog/srchdlg.cxx12
-rw-r--r--sfx2/source/dialog/styledlg.cxx5
-rw-r--r--sfx2/source/dialog/tabdlg.cxx64
-rw-r--r--sfx2/source/dialog/taskpane.cxx63
-rw-r--r--sfx2/source/dialog/templateinfodlg.cxx12
-rw-r--r--sfx2/source/dialog/templdlg.cxx265
-rw-r--r--sfx2/source/dialog/titledockwin.cxx45
-rw-r--r--sfx2/source/dialog/versdlg.cxx53
-rw-r--r--sfx2/source/doc/QuerySaveDocument.cxx6
-rw-r--r--sfx2/source/doc/docinsert.cxx8
-rw-r--r--sfx2/source/doc/doctemplates.cxx14
-rw-r--r--sfx2/source/doc/guisaveas.cxx8
-rw-r--r--sfx2/source/doc/iframe.cxx2
-rw-r--r--sfx2/source/doc/new.cxx28
-rw-r--r--sfx2/source/doc/objcont.cxx20
-rw-r--r--sfx2/source/doc/objserv.cxx28
-rw-r--r--sfx2/source/doc/objstor.cxx4
-rw-r--r--sfx2/source/doc/plugin.cxx2
-rw-r--r--sfx2/source/doc/printhelper.cxx6
-rw-r--r--sfx2/source/doc/templatedlg.cxx84
-rw-r--r--sfx2/source/inc/alienwarn.hxx7
-rw-r--r--sfx2/source/inc/documentfontsdialog.hxx6
-rw-r--r--sfx2/source/inc/inputdlg.hxx10
-rw-r--r--sfx2/source/inc/partwnd.hxx1
-rw-r--r--sfx2/source/inc/recfloat.hxx3
-rw-r--r--sfx2/source/inc/splitwin.hxx11
-rw-r--r--sfx2/source/inc/templatesearchview.hxx2
-rw-r--r--sfx2/source/inc/templdgi.hxx17
-rw-r--r--sfx2/source/inc/versdlg.hxx42
-rw-r--r--sfx2/source/inc/workwin.hxx14
-rw-r--r--sfx2/source/inet/inettbc.cxx7
-rw-r--r--sfx2/source/sidebar/ControlFactory.cxx8
-rw-r--r--sfx2/source/sidebar/ControllerItem.cxx8
-rw-r--r--sfx2/source/sidebar/Deck.cxx67
-rw-r--r--sfx2/source/sidebar/Deck.hxx16
-rw-r--r--sfx2/source/sidebar/DeckLayouter.cxx4
-rw-r--r--sfx2/source/sidebar/DeckTitleBar.cxx14
-rw-r--r--sfx2/source/sidebar/DeckTitleBar.hxx1
-rw-r--r--sfx2/source/sidebar/FocusManager.cxx24
-rw-r--r--sfx2/source/sidebar/FocusManager.hxx10
-rw-r--r--sfx2/source/sidebar/MenuButton.cxx4
-rw-r--r--sfx2/source/sidebar/MenuButton.hxx1
-rw-r--r--sfx2/source/sidebar/Panel.cxx10
-rw-r--r--sfx2/source/sidebar/Panel.hxx8
-rw-r--r--sfx2/source/sidebar/PanelTitleBar.cxx31
-rw-r--r--sfx2/source/sidebar/PanelTitleBar.hxx3
-rw-r--r--sfx2/source/sidebar/SidebarChildWindow.cxx6
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx83
-rw-r--r--sfx2/source/sidebar/SidebarController.hxx12
-rw-r--r--sfx2/source/sidebar/SidebarDockingWindow.cxx6
-rw-r--r--sfx2/source/sidebar/SidebarDockingWindow.hxx1
-rw-r--r--sfx2/source/sidebar/SidebarPanelBase.cxx16
-rw-r--r--sfx2/source/sidebar/SidebarToolBox.cxx8
-rw-r--r--sfx2/source/sidebar/TabBar.cxx25
-rw-r--r--sfx2/source/sidebar/TabBar.hxx7
-rw-r--r--sfx2/source/sidebar/TabItem.cxx4
-rw-r--r--sfx2/source/sidebar/TabItem.hxx1
-rw-r--r--sfx2/source/sidebar/TitleBar.cxx21
-rw-r--r--sfx2/source/sidebar/TitleBar.hxx7
-rw-r--r--sfx2/source/statbar/stbitem.cxx2
-rw-r--r--sfx2/source/toolbox/imgmgr.cxx2
-rw-r--r--sfx2/source/toolbox/tbxitem.cxx48
-rw-r--r--sfx2/source/view/frame.cxx2
-rw-r--r--sfx2/source/view/frame2.cxx9
-rw-r--r--sfx2/source/view/impframe.hxx14
-rw-r--r--sfx2/source/view/impviewframe.hxx4
-rw-r--r--sfx2/source/view/printer.cxx27
-rw-r--r--sfx2/source/view/sfxbasecontroller.cxx2
-rw-r--r--sfx2/source/view/viewfrm.cxx20
-rw-r--r--sfx2/source/view/viewprn.cxx57
-rw-r--r--sfx2/source/view/viewsh.cxx12
119 files changed, 1845 insertions, 1257 deletions
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 582a4b8e935d..47938744425e 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -462,8 +462,8 @@ void SfxApplication::NewDocExec_Impl( SfxRequest& rReq )
bool bNewWin = false;
vcl::Window* pTopWin = GetTopWindow();
- SfxTemplateManagerDlg aTemplDlg;
- int nRet = aTemplDlg.Execute();
+ ScopedVclPtrInstance< SfxTemplateManagerDlg > aTemplDlg;
+ int nRet = aTemplDlg->Execute();
if ( nRet == RET_OK )
{
rReq.Done();
@@ -831,11 +831,11 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
SolarMutexGuard aGuard;
vcl::Window *pWindow = SfxGetpApp()->GetTopWindow();
- MessageDialog aSecurityWarningBox(pWindow,
+ ScopedVclPtrInstance<MessageDialog> aSecurityWarningBox(pWindow,
SfxResId(STR_SECURITY_WARNING_NO_HYPERLINKS),
VCL_MESSAGE_WARNING);
- aSecurityWarningBox.SetText( SfxResId(RID_SECURITY_WARNING_TITLE).toString() );
- aSecurityWarningBox.Execute();
+ aSecurityWarningBox->SetText( SfxResId(RID_SECURITY_WARNING_TITLE).toString() );
+ aSecurityWarningBox->Execute();
return;
}
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index d985a1efdc14..b60da280bf12 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -451,8 +451,8 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
case SID_SHOW_LICENSE:
{
- LicenseDialog aDialog;
- aDialog.Execute();
+ ScopedVclPtrInstance< LicenseDialog > aDialog;
+ aDialog->Execute();
break;
}
@@ -539,16 +539,16 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
case SID_TEMPLATE_MANAGER:
{
- SfxTemplateManagerDlg dlg;
- dlg.Execute();
+ ScopedVclPtrInstance< SfxTemplateManagerDlg > dlg;
+ dlg->Execute();
bDone = true;
break;
}
case SID_TEMPLATE_ADDRESSBOKSOURCE:
{
- svt::AddressBookSourceDialog aDialog(GetTopWindow(), ::comphelper::getProcessComponentContext());
- aDialog.Execute();
+ ScopedVclPtrInstance< svt::AddressBookSourceDialog > aDialog(GetTopWindow(), ::comphelper::getProcessComponentContext());
+ aDialog->Execute();
bDone = true;
break;
}
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx
index 2a904ca2421c..e1f2ecd40809 100644
--- a/sfx2/source/appl/childwin.cxx
+++ b/sfx2/source/appl/childwin.cxx
@@ -160,7 +160,6 @@ SfxChildWindow::SfxChildWindow(vcl::Window *pParentWindow, sal_uInt16 nId)
: pParent(pParentWindow)
, nType(nId)
, eChildAlignment(SfxChildAlignment::NOALIGNMENT)
- , pWindow(0L)
{
pImp = new SfxChildWindow_Impl;
pImp->pFact = 0L;
@@ -199,7 +198,7 @@ void SfxChildWindow::Destroy()
SfxChildWindow::~SfxChildWindow()
{
delete pContext;
- delete pWindow;
+ pWindow.disposeAndClear();
delete pImp;
}
@@ -336,16 +335,16 @@ SfxChildWinInfo SfxChildWindow::GetInfo() const
sal_uIntPtr nMask = WINDOWSTATE_MASK_POS | WINDOWSTATE_MASK_STATE;
if ( pWindow->GetStyle() & WB_SIZEABLE )
nMask |= ( WINDOWSTATE_MASK_WIDTH | WINDOWSTATE_MASK_HEIGHT );
- aInfo.aWinState = static_cast<SystemWindow*>(pWindow)->GetWindowState( nMask );
+ aInfo.aWinState = static_cast<SystemWindow*>(pWindow.get())->GetWindowState( nMask );
}
else if ( pWindow->GetType() == RSC_DOCKINGWINDOW )
{
- if (static_cast<DockingWindow*>(pWindow)->GetFloatingWindow() )
- aInfo.aWinState = static_cast<DockingWindow*>(pWindow)->GetFloatingWindow()->GetWindowState();
+ if (static_cast<DockingWindow*>(pWindow.get())->GetFloatingWindow() )
+ aInfo.aWinState = static_cast<DockingWindow*>(pWindow.get())->GetFloatingWindow()->GetWindowState();
else
{
SfxChildWinInfo aTmpInfo;
- static_cast<SfxDockingWindow*>(pWindow)->FillInfo( aTmpInfo );
+ static_cast<SfxDockingWindow*>(pWindow.get())->FillInfo( aTmpInfo );
aInfo.aExtraString = aTmpInfo.aExtraString;
}
}
@@ -511,14 +510,13 @@ void SfxChildWindow::CreateContext( sal_uInt16 nContextId, SfxBindings& rBinding
}
SfxChildWindowContext::SfxChildWindowContext( sal_uInt16 nId )
- : pWindow( NULL )
- , nContextId( nId )
+ : nContextId( nId )
{
}
SfxChildWindowContext::~SfxChildWindowContext()
{
- delete pWindow;
+ pWindow.disposeAndClear();
}
FloatingWindow* SfxChildWindowContext::GetFloatingWindow() const
@@ -654,10 +652,10 @@ void SfxChildWindow::Hide()
switch ( pWindow->GetType() )
{
case RSC_DOCKINGWINDOW :
- static_cast<DockingWindow*>(pWindow)->Hide();
+ static_cast<DockingWindow*>(pWindow.get())->Hide();
break;
case RSC_TOOLBOX :
- static_cast<ToolBox*>(pWindow)->Hide();
+ static_cast<ToolBox*>(pWindow.get())->Hide();
break;
default:
pWindow->Hide();
@@ -670,10 +668,10 @@ void SfxChildWindow::Show( sal_uInt16 nFlags )
switch ( pWindow->GetType() )
{
case RSC_DOCKINGWINDOW :
- static_cast<DockingWindow*>(pWindow)->Show( true, nFlags );
+ static_cast<DockingWindow*>(pWindow.get())->Show( true, nFlags );
break;
case RSC_TOOLBOX :
- static_cast<ToolBox*>(pWindow)->Show( true, nFlags );
+ static_cast<ToolBox*>(pWindow.get())->Show( true, nFlags );
break;
default:
pWindow->Show( true, nFlags );
diff --git a/sfx2/source/appl/fileobj.hxx b/sfx2/source/appl/fileobj.hxx
index 85fb53b33a9c..5e2a5fddfcc1 100644
--- a/sfx2/source/appl/fileobj.hxx
+++ b/sfx2/source/appl/fileobj.hxx
@@ -35,7 +35,7 @@ class SvFileObject : public sfx2::SvLinkSource
SfxMediumRef xMed;
ImplSVEvent* nPostUserEventId;
SfxMediumRef* pDelMed;
- vcl::Window* pOldParent;
+ VclPtr<vcl::Window> pOldParent;
sal_uInt8 nType;
diff --git a/sfx2/source/appl/helpinterceptor.hxx b/sfx2/source/appl/helpinterceptor.hxx
index e34686e7b40d..a990518bc7a4 100644
--- a/sfx2/source/appl/helpinterceptor.hxx
+++ b/sfx2/source/appl/helpinterceptor.hxx
@@ -28,6 +28,7 @@
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/frame/XStatusListener.hpp>
#include <tools/link.hxx>
+#include <vcl/vclptr.hxx>
#include <vector>
struct HelpHistoryEntry_Impl
@@ -63,7 +64,7 @@ friend class SfxHelpWindow_Impl;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > m_xListener;
HelpHistoryList_Impl* m_pHistory;
- SfxHelpWindow_Impl* m_pWindow;
+ VclPtr<SfxHelpWindow_Impl> m_pWindow;
sal_uIntPtr m_nCurPos;
OUString m_aCurrentURL;
com::sun::star::uno::Any m_aViewData;
diff --git a/sfx2/source/appl/impldde.cxx b/sfx2/source/appl/impldde.cxx
index aa829e21a54f..11aecd90473f 100644
--- a/sfx2/source/appl/impldde.cxx
+++ b/sfx2/source/appl/impldde.cxx
@@ -57,14 +57,16 @@ namespace sfx2
class SvDDELinkEditDialog : public ModalDialog
{
- Edit *m_pEdDdeApp;
- Edit *m_pEdDdeTopic;
- Edit *m_pEdDdeItem;
- OKButton *m_pOKButton;
+ VclPtr<Edit> m_pEdDdeApp;
+ VclPtr<Edit> m_pEdDdeTopic;
+ VclPtr<Edit> m_pEdDdeItem;
+ VclPtr<OKButton> m_pOKButton;
DECL_STATIC_LINK( SvDDELinkEditDialog, EditHdl_Impl, Edit* );
public:
SvDDELinkEditDialog( vcl::Window* pParent, SvBaseLink* );
+ virtual ~SvDDELinkEditDialog();
+ virtual void dispose() SAL_OVERRIDE;
OUString GetCmd() const;
};
@@ -90,6 +92,20 @@ SvDDELinkEditDialog::SvDDELinkEditDialog( vcl::Window* pParent, SvBaseLink* pLin
m_pOKButton->Enable( !sServer.isEmpty() && !sTopic.isEmpty() && !sItem.isEmpty() );
}
+SvDDELinkEditDialog::~SvDDELinkEditDialog()
+{
+ disposeOnce();
+}
+
+void SvDDELinkEditDialog::dispose()
+{
+ m_pEdDdeApp.clear();
+ m_pEdDdeTopic.clear();
+ m_pEdDdeItem.clear();
+ m_pOKButton.clear();
+ ModalDialog::dispose();
+}
+
OUString SvDDELinkEditDialog::GetCmd() const
{
OUString sCmd( m_pEdDdeApp->GetText() ), sRet;
@@ -255,10 +271,10 @@ bool SvDDEObject::Connect( SvBaseLink * pSvLink )
void SvDDEObject::Edit( vcl::Window* pParent, sfx2::SvBaseLink* pBaseLink, const Link& rEndEditHdl )
{
- SvDDELinkEditDialog aDlg( pParent, pBaseLink );
- if ( RET_OK == aDlg.Execute() && rEndEditHdl.IsSet() )
+ ScopedVclPtrInstance< SvDDELinkEditDialog > aDlg(pParent, pBaseLink);
+ if ( RET_OK == aDlg->Execute() && rEndEditHdl.IsSet() )
{
- OUString sCommand = aDlg.GetCmd();
+ OUString sCommand = aDlg->GetCmd();
rEndEditHdl.Call( &sCommand );
}
}
diff --git a/sfx2/source/appl/lnkbase2.cxx b/sfx2/source/appl/lnkbase2.cxx
index d06c54df8e4f..8834962b8762 100644
--- a/sfx2/source/appl/lnkbase2.cxx
+++ b/sfx2/source/appl/lnkbase2.cxx
@@ -45,8 +45,8 @@ class ImplDdeItem;
struct BaseLink_Impl
{
Link m_aEndEditLink;
- LinkManager* m_pLinkMgr;
- vcl::Window* m_pParentWin;
+ LinkManager* m_pLinkMgr;
+ VclPtr<vcl::Window> m_pParentWin;
FileDialogHelper* m_pFileDlg;
bool m_bIsConnect;
diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx
index 7ea881fa76a8..150563429e07 100644
--- a/sfx2/source/appl/module.cxx
+++ b/sfx2/source/appl/module.cxx
@@ -33,6 +33,7 @@
#include <sfx2/docfac.hxx>
#include <sfx2/objface.hxx>
#include <sfx2/viewfrm.hxx>
+#include <sfx2/tabdlg.hxx>
#include <svl/intitem.hxx>
#include <sfx2/taskpane.hxx>
#include <tools/diagnose_ex.h>
@@ -331,9 +332,9 @@ ImageList* SfxModule::GetImageList_Impl( bool bBig )
return pImpl->GetImageList( pResMgr, bBig );
}
-SfxTabPage* SfxModule::CreateTabPage( sal_uInt16, vcl::Window*, const SfxItemSet& )
+VclPtr<SfxTabPage> SfxModule::CreateTabPage( sal_uInt16, vcl::Window*, const SfxItemSet& )
{
- return NULL;
+ return VclPtr<SfxTabPage>();
}
SfxModuleArr_Impl& SfxModule::GetModules_Impl()
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 9d92d78820cc..25a45ce97baf 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -303,6 +303,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeContentListBox(vcl::Wi
ContentListBox_Impl::~ContentListBox_Impl()
{
+ disposeOnce();
+}
+
+void ContentListBox_Impl::dispose()
+{
sal_uInt16 nPos = 0;
SvTreeListEntry* pEntry = GetEntry( nPos++ );
while ( pEntry )
@@ -311,6 +316,7 @@ ContentListBox_Impl::~ContentListBox_Impl()
delete static_cast<ContentEntry_Impl*>(pEntry->GetUserData());
pEntry = GetEntry( nPos++ );
}
+ SvTreeListBox::dispose();
}
void ContentListBox_Impl::InitRoot()
@@ -426,6 +432,17 @@ HelpTabPage_Impl::HelpTabPage_Impl(vcl::Window* pParent, SfxHelpIndexWindow_Impl
{
}
+HelpTabPage_Impl::~HelpTabPage_Impl()
+{
+ disposeOnce();
+}
+
+void HelpTabPage_Impl::dispose()
+{
+ m_pIdxWin.clear();
+ TabPage::dispose();
+}
+
// class ContentTabPage_Impl ---------------------------------------------
ContentTabPage_Impl::ContentTabPage_Impl(vcl::Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin)
: HelpTabPage_Impl(pParent, _pIdxWin, "HelpContentPage",
@@ -437,6 +454,17 @@ ContentTabPage_Impl::ContentTabPage_Impl(vcl::Window* pParent, SfxHelpIndexWindo
m_pContentBox->set_height_request(aSize.Height());
}
+ContentTabPage_Impl::~ContentTabPage_Impl()
+{
+ disposeOnce();
+}
+
+void ContentTabPage_Impl::dispose()
+{
+ m_pContentBox.clear();
+ HelpTabPage_Impl::dispose();
+}
+
void ContentTabPage_Impl::ActivatePage()
{
if ( !m_pIdxWin->WasCursorLeftOrRight() )
@@ -545,7 +573,15 @@ IndexTabPage_Impl::IndexTabPage_Impl(vcl::Window* pParent, SfxHelpIndexWindow_Im
IndexTabPage_Impl::~IndexTabPage_Impl()
{
+ disposeOnce();
+}
+
+void IndexTabPage_Impl::dispose()
+{
ClearIndex();
+ m_pIndexCB.clear();
+ m_pOpenBtn.clear();
+ HelpTabPage_Impl::dispose();
}
@@ -946,6 +982,11 @@ SearchTabPage_Impl::SearchTabPage_Impl(vcl::Window* pParent, SfxHelpIndexWindow_
SearchTabPage_Impl::~SearchTabPage_Impl()
{
+ disposeOnce();
+}
+
+void SearchTabPage_Impl::dispose()
+{
SvtViewOptions aViewOpt( E_TABPAGE, CONFIGNAME_SEARCHPAGE );
sal_Int32 nChecked = m_pFullWordsCB->IsChecked() ? 1 : 0;
OUString aUserData = OUString::number( nChecked );
@@ -967,6 +1008,14 @@ SearchTabPage_Impl::~SearchTabPage_Impl()
aUserData = comphelper::string::stripEnd(aUserData, ';');
Any aUserItem = makeAny( OUString( aUserData ) );
aViewOpt.SetUserItem( USERITEM_NAME, aUserItem );
+
+ m_pSearchED.clear();
+ m_pSearchBtn.clear();
+ m_pFullWordsCB.clear();
+ m_pScopeCB.clear();
+ m_pResultsLB.clear();
+ m_pOpenBtn.clear();
+ HelpTabPage_Impl::dispose();
}
@@ -1030,8 +1079,8 @@ IMPL_LINK_NOARG(SearchTabPage_Impl, SearchHdl)
if ( aFactories.empty() )
{
- MessageDialog aBox( this, SfxResId( STR_INFO_NOSEARCHRESULTS ), VCL_MESSAGE_INFO );
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(this, SfxResId( STR_INFO_NOSEARCHRESULTS ), VCL_MESSAGE_INFO);
+ aBox->Execute();
}
}
return 0;
@@ -1141,6 +1190,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeBookmarksBox(vcl::Wind
BookmarksBox_Impl::~BookmarksBox_Impl()
{
+ disposeOnce();
+}
+
+void BookmarksBox_Impl::dispose()
+{
// save bookmarks to configuration
SvtHistoryOptions aHistOpt;
aHistOpt.Clear( eHELPBOOKMARKS );
@@ -1153,6 +1207,7 @@ BookmarksBox_Impl::~BookmarksBox_Impl()
aHistOpt.AppendItem(eHELPBOOKMARKS, *pURL, sEmpty, aTitle, sEmpty, sEmpty);
delete pURL;
}
+ ListBox::dispose();
}
@@ -1170,15 +1225,15 @@ void BookmarksBox_Impl::DoAction( sal_uInt16 nAction )
sal_Int32 nPos = GetSelectEntryPos();
if ( nPos != LISTBOX_ENTRY_NOTFOUND )
{
- SfxAddHelpBookmarkDialog_Impl aDlg( this, true );
- aDlg.SetTitle( GetEntry( nPos ) );
- if ( aDlg.Execute() == RET_OK )
+ ScopedVclPtrInstance< SfxAddHelpBookmarkDialog_Impl > aDlg(this, true);
+ aDlg->SetTitle( GetEntry( nPos ) );
+ if ( aDlg->Execute() == RET_OK )
{
OUString* pURL = static_cast<OUString*>(GetEntryData( nPos ));
RemoveEntry( nPos );
OUString aImageURL = IMAGE_URL;
aImageURL += INetURLObject( *pURL ).GetHost();
- nPos = InsertEntry( aDlg.GetTitle(), SvFileInformationManager::GetImage( INetURLObject(aImageURL), false ) );
+ nPos = InsertEntry( aDlg->GetTitle(), SvFileInformationManager::GetImage( INetURLObject(aImageURL), false ) );
SetEntryData( nPos, new OUString( *pURL ) );
SelectEntryPos( nPos );
delete pURL;
@@ -1271,6 +1326,17 @@ BookmarksTabPage_Impl::BookmarksTabPage_Impl(vcl::Window* pParent, SfxHelpIndexW
}
}
+BookmarksTabPage_Impl::~BookmarksTabPage_Impl()
+{
+ disposeOnce();
+}
+
+void BookmarksTabPage_Impl::dispose()
+{
+ m_pBookmarksBox.clear();
+ m_pBookmarksPB.clear();
+ HelpTabPage_Impl::dispose();
+}
IMPL_LINK_NOARG(BookmarksTabPage_Impl, OpenHdl)
@@ -1416,18 +1482,29 @@ SfxHelpIndexWindow_Impl::SfxHelpIndexWindow_Impl(SfxHelpWindow_Impl* _pParent)
SfxHelpIndexWindow_Impl::~SfxHelpIndexWindow_Impl()
{
+ disposeOnce();
+}
+
+void SfxHelpIndexWindow_Impl::dispose()
+{
sfx2::RemoveFromTaskPaneList( this );
- DELETEZ( pCPage );
- DELETEZ( pIPage );
- DELETEZ( pSPage );
- DELETEZ( pBPage );
+ pCPage.disposeAndClear();
+ pIPage.disposeAndClear();
+ pSPage.disposeAndClear();
+ pBPage.disposeAndClear();
for ( sal_uInt16 i = 0; i < m_pActiveLB->GetEntryCount(); ++i )
delete static_cast<OUString*>(m_pActiveLB->GetEntryData(i));
SvtViewOptions aViewOpt( E_TABDIALOG, CONFIGNAME_INDEXWIN );
aViewOpt.SetPageID( (sal_Int32)m_pTabCtrl->GetCurPageId() );
+
+ disposeBuilder();
+ m_pActiveLB.clear();
+ m_pTabCtrl.clear();
+ pParentWin.clear();
+ vcl::Window::dispose();
}
@@ -1805,10 +1882,6 @@ TextWin_Impl::TextWin_Impl( vcl::Window* p ) : DockingWindow( p, 0 )
{
}
-TextWin_Impl::~TextWin_Impl()
-{
-}
-
bool TextWin_Impl::Notify( NotifyEvent& rNEvt )
{
if( ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ) && rNEvt.GetKeyEvent()->GetKeyCode().GetCode() == KEY_TAB )
@@ -1830,15 +1903,15 @@ SfxHelpTextWindow_Impl::SfxHelpTextWindow_Impl( SfxHelpWindow_Impl* pParent ) :
Window( pParent, WB_CLIPCHILDREN | WB_TABSTOP | WB_DIALOGCONTROL ),
- aToolBox ( this, 0 ),
- aOnStartupCB ( this, SfxResId( RID_HELP_ONSTARTUP_BOX ) ),
+ aToolBox ( VclPtr<ToolBox>::Create(this, 0) ),
+ aOnStartupCB ( VclPtr<CheckBox>::Create(this, SfxResId( RID_HELP_ONSTARTUP_BOX )) ),
aIndexOnImage ( SfxResId( IMG_HELP_TOOLBOX_INDEX_ON ) ),
aIndexOffImage ( SfxResId( IMG_HELP_TOOLBOX_INDEX_OFF ) ),
aIndexOnText ( SfxResId( STR_HELP_BUTTON_INDEX_ON ).toString() ),
aIndexOffText ( SfxResId( STR_HELP_BUTTON_INDEX_OFF ).toString() ),
aOnStartupText ( SfxResId( RID_HELP_ONSTARTUP_TEXT ).toString() ),
pHelpWin ( pParent ),
- pTextWin ( new TextWin_Impl( this ) ),
+ pTextWin ( VclPtr<TextWin_Impl>::Create( this ) ),
pSrchDlg ( NULL ),
nMinPos ( 0 ),
bIsDebug ( false ),
@@ -1847,36 +1920,36 @@ SfxHelpTextWindow_Impl::SfxHelpTextWindow_Impl( SfxHelpWindow_Impl* pParent ) :
bIsFullWordSearch ( false )
{
- sfx2::AddToTaskPaneList( &aToolBox );
+ sfx2::AddToTaskPaneList( aToolBox.get() );
xFrame = Frame::create( ::comphelper::getProcessComponentContext() );
xFrame->initialize( VCLUnoHelper::GetInterface ( pTextWin ) );
xFrame->setName( "OFFICE_HELP" );
lcl_disableLayoutOfFrame(xFrame);
- aToolBox.SetHelpId( HID_HELP_TOOLBOX );
-
- aToolBox.InsertItem( TBI_INDEX, aIndexOffText );
- aToolBox.SetHelpId( TBI_INDEX, HID_HELP_TOOLBOXITEM_INDEX );
- aToolBox.InsertSeparator();
- aToolBox.InsertItem( TBI_BACKWARD, SfxResId( STR_HELP_BUTTON_PREV ).toString() );
- aToolBox.SetHelpId( TBI_BACKWARD, HID_HELP_TOOLBOXITEM_BACKWARD );
- aToolBox.InsertItem( TBI_FORWARD, SfxResId( STR_HELP_BUTTON_NEXT ).toString() );
- aToolBox.SetHelpId( TBI_FORWARD, HID_HELP_TOOLBOXITEM_FORWARD );
- aToolBox.InsertItem( TBI_START, SfxResId( STR_HELP_BUTTON_START ).toString() );
- aToolBox.SetHelpId( TBI_START, HID_HELP_TOOLBOXITEM_START );
- aToolBox.InsertSeparator();
- aToolBox.InsertItem( TBI_PRINT, SfxResId( STR_HELP_BUTTON_PRINT ).toString() );
- aToolBox.SetHelpId( TBI_PRINT, HID_HELP_TOOLBOXITEM_PRINT );
- aToolBox.InsertItem( TBI_BOOKMARKS, SfxResId( STR_HELP_BUTTON_ADDBOOKMARK ).toString() );
- aToolBox.SetHelpId( TBI_BOOKMARKS, HID_HELP_TOOLBOXITEM_BOOKMARKS );
- aToolBox.InsertItem( TBI_SEARCHDIALOG, SfxResId( STR_HELP_BUTTON_SEARCHDIALOG ).toString() );
- aToolBox.SetHelpId( TBI_SEARCHDIALOG, HID_HELP_TOOLBOXITEM_SEARCHDIALOG );
+ aToolBox->SetHelpId( HID_HELP_TOOLBOX );
+
+ aToolBox->InsertItem( TBI_INDEX, aIndexOffText );
+ aToolBox->SetHelpId( TBI_INDEX, HID_HELP_TOOLBOXITEM_INDEX );
+ aToolBox->InsertSeparator();
+ aToolBox->InsertItem( TBI_BACKWARD, SfxResId( STR_HELP_BUTTON_PREV ).toString() );
+ aToolBox->SetHelpId( TBI_BACKWARD, HID_HELP_TOOLBOXITEM_BACKWARD );
+ aToolBox->InsertItem( TBI_FORWARD, SfxResId( STR_HELP_BUTTON_NEXT ).toString() );
+ aToolBox->SetHelpId( TBI_FORWARD, HID_HELP_TOOLBOXITEM_FORWARD );
+ aToolBox->InsertItem( TBI_START, SfxResId( STR_HELP_BUTTON_START ).toString() );
+ aToolBox->SetHelpId( TBI_START, HID_HELP_TOOLBOXITEM_START );
+ aToolBox->InsertSeparator();
+ aToolBox->InsertItem( TBI_PRINT, SfxResId( STR_HELP_BUTTON_PRINT ).toString() );
+ aToolBox->SetHelpId( TBI_PRINT, HID_HELP_TOOLBOXITEM_PRINT );
+ aToolBox->InsertItem( TBI_BOOKMARKS, SfxResId( STR_HELP_BUTTON_ADDBOOKMARK ).toString() );
+ aToolBox->SetHelpId( TBI_BOOKMARKS, HID_HELP_TOOLBOXITEM_BOOKMARKS );
+ aToolBox->InsertItem( TBI_SEARCHDIALOG, SfxResId( STR_HELP_BUTTON_SEARCHDIALOG ).toString() );
+ aToolBox->SetHelpId( TBI_SEARCHDIALOG, HID_HELP_TOOLBOXITEM_SEARCHDIALOG );
InitToolBoxImages();
- aToolBox.Show();
+ aToolBox->Show();
InitOnStartupBox( false );
- aOnStartupCB.SetClickHdl( LINK( this, SfxHelpTextWindow_Impl, CheckHdl ) );
+ aOnStartupCB->SetClickHdl( LINK( this, SfxHelpTextWindow_Impl, CheckHdl ) );
aSelectIdle.SetIdleHdl( LINK( this, SfxHelpTextWindow_Impl, SelectHdl ) );
aSelectIdle.SetPriority( SchedulerPriority::LOWEST );
@@ -1887,19 +1960,29 @@ SfxHelpTextWindow_Impl::SfxHelpTextWindow_Impl( SfxHelpWindow_Impl* pParent ) :
SvtMiscOptions().AddListenerLink( LINK( this, SfxHelpTextWindow_Impl, NotifyHdl ) );
- if ( !aOnStartupCB.GetHelpId().getLength() )
- aOnStartupCB.SetHelpId( HID_HELP_ONSTARTUP_BOX );
+ if ( !aOnStartupCB->GetHelpId().getLength() )
+ aOnStartupCB->SetHelpId( HID_HELP_ONSTARTUP_BOX );
}
SfxHelpTextWindow_Impl::~SfxHelpTextWindow_Impl()
{
- sfx2::RemoveFromTaskPaneList( &aToolBox );
+ disposeOnce();
+}
+
+void SfxHelpTextWindow_Impl::dispose()
+{
+ sfx2::RemoveFromTaskPaneList( aToolBox.get() );
bIsInClose = true;
SvtMiscOptions().RemoveListenerLink( LINK( this, SfxHelpTextWindow_Impl, NotifyHdl ) );
- delete pSrchDlg;
+ pSrchDlg.disposeAndClear();
+ aToolBox.disposeAndClear();
+ aOnStartupCB.disposeAndClear();
+ pHelpWin.clear();
+ pTextWin.disposeAndClear();
+ vcl::Window::dispose();
}
@@ -1928,39 +2011,39 @@ void SfxHelpTextWindow_Impl::InitToolBoxImages()
aIndexOnImage = Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_INDEX_ON : IMG_HELP_TOOLBOX_INDEX_ON ) );
aIndexOffImage = Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_INDEX_OFF : IMG_HELP_TOOLBOX_INDEX_OFF ) );
- aToolBox.SetItemImage( TBI_INDEX, bIsIndexOn ? aIndexOffImage : aIndexOnImage );
+ aToolBox->SetItemImage( TBI_INDEX, bIsIndexOn ? aIndexOffImage : aIndexOnImage );
- aToolBox.SetItemImage( TBI_BACKWARD,
+ aToolBox->SetItemImage( TBI_BACKWARD,
Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_PREV : IMG_HELP_TOOLBOX_PREV ) )
);
- aToolBox.SetItemImage( TBI_FORWARD,
+ aToolBox->SetItemImage( TBI_FORWARD,
Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_NEXT : IMG_HELP_TOOLBOX_NEXT ) )
);
- aToolBox.SetItemImage( TBI_START,
+ aToolBox->SetItemImage( TBI_START,
Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_START : IMG_HELP_TOOLBOX_START ) )
);
- aToolBox.SetItemImage( TBI_PRINT,
+ aToolBox->SetItemImage( TBI_PRINT,
Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_PRINT : IMG_HELP_TOOLBOX_PRINT ) )
);
- aToolBox.SetItemImage( TBI_BOOKMARKS,
+ aToolBox->SetItemImage( TBI_BOOKMARKS,
Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_BOOKMARKS : IMG_HELP_TOOLBOX_BOOKMARKS ) )
);
- aToolBox.SetItemImage( TBI_SEARCHDIALOG,
+ aToolBox->SetItemImage( TBI_SEARCHDIALOG,
Image( SfxResId( bLarge ? IMG_HELP_TOOLBOX_L_SEARCHDIALOG : IMG_HELP_TOOLBOX_SEARCHDIALOG ) )
);
- Size aSize = aToolBox.CalcWindowSizePixel();
+ Size aSize = aToolBox->CalcWindowSizePixel();
aSize.Height() += TOOLBOX_OFFSET;
- aToolBox.SetPosSizePixel( Point( 0, TOOLBOX_OFFSET ), aSize );
+ aToolBox->SetPosSizePixel( Point( 0, TOOLBOX_OFFSET ), aSize );
SvtMiscOptions aMiscOptions;
- if ( aMiscOptions.GetToolboxStyle() != aToolBox.GetOutStyle() )
- aToolBox.SetOutStyle( aMiscOptions.GetToolboxStyle() );
+ if ( aMiscOptions.GetToolboxStyle() != aToolBox->GetOutStyle() )
+ aToolBox->SetOutStyle( aMiscOptions.GetToolboxStyle() );
}
@@ -1998,7 +2081,7 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox( bool bOnlyText )
}
if ( bHideBox )
- aOnStartupCB.Hide();
+ aOnStartupCB->Hide();
else
{
// detect module name
@@ -2025,20 +2108,20 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox( bool bOnlyText )
// set module name in checkbox text
OUString sText( aOnStartupText );
sText = sText.replaceFirst( "%MODULENAME", sModuleName );
- aOnStartupCB.SetText( sText );
+ aOnStartupCB->SetText( sText );
// and show it
- aOnStartupCB.Show();
+ aOnStartupCB->Show();
// set check state
- aOnStartupCB.Check( bHelpAtStartup );
- aOnStartupCB.SaveValue();
+ aOnStartupCB->Check( bHelpAtStartup );
+ aOnStartupCB->SaveValue();
// calculate and set optimal width of the onstartup checkbox
OUString sCBText( "XXX" );
- sCBText += aOnStartupCB.GetText();
- long nTextWidth = aOnStartupCB.GetTextWidth( sCBText );
- Size aSize = aOnStartupCB.GetSizePixel();
+ sCBText += aOnStartupCB->GetText();
+ long nTextWidth = aOnStartupCB->GetTextWidth( sCBText );
+ Size aSize = aOnStartupCB->GetSizePixel();
aSize.Width() = nTextWidth;
- aOnStartupCB.SetSizePixel( aSize );
+ aOnStartupCB->SetSizePixel( aSize );
SetOnStartupBoxPosition();
}
@@ -2046,12 +2129,12 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox( bool bOnlyText )
{
// set position of the checkbox
Size a3Size = LogicToPixel( Size( 3, 3 ), MAP_APPFONT );
- Size aTBSize = aToolBox.GetSizePixel();
- Size aCBSize = aOnStartupCB.GetSizePixel();
- Point aPnt = aToolBox.GetPosPixel();
+ Size aTBSize = aToolBox->GetSizePixel();
+ Size aCBSize = aOnStartupCB->GetSizePixel();
+ Point aPnt = aToolBox->GetPosPixel();
aPnt.X() += aTBSize.Width() + a3Size.Width();
aPnt.Y() += ( ( aTBSize.Height() - aCBSize.Height() ) / 2 );
- aOnStartupCB.SetPosPixel( aPnt );
+ aOnStartupCB->SetPosPixel( aPnt );
nMinPos = aPnt.X();
}
}
@@ -2061,10 +2144,10 @@ void SfxHelpTextWindow_Impl::InitOnStartupBox( bool bOnlyText )
void SfxHelpTextWindow_Impl::SetOnStartupBoxPosition()
{
- long nX = std::max( GetOutputSizePixel().Width() - aOnStartupCB.GetSizePixel().Width(), nMinPos );
- Point aPos = aOnStartupCB.GetPosPixel();
+ long nX = std::max( GetOutputSizePixel().Width() - aOnStartupCB->GetSizePixel().Width(), nMinPos );
+ Point aPos = aOnStartupCB->GetPosPixel();
aPos.X() = nX;
- aOnStartupCB.SetPosPixel( aPos );
+ aOnStartupCB->SetPosPixel( aPos );
}
@@ -2181,7 +2264,7 @@ IMPL_LINK( SfxHelpTextWindow_Impl, NotifyHdl, SvtMiscOptions*, pOptions )
(void)pOptions; // unused variable
InitToolBoxImages();
Resize();
- aToolBox.Invalidate();
+ aToolBox->Invalidate();
return 0;
}
@@ -2254,8 +2337,8 @@ IMPL_LINK( SfxHelpTextWindow_Impl, FindHdl, sfx2::SearchDialog*, pDlg )
else
{
DBG_ASSERT( pSrchDlg, "no search dialog" );
- MessageDialog aBox( pSrchDlg, SfxResId( STR_INFO_NOSEARCHTEXTFOUND ), VCL_MESSAGE_INFO );
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(pSrchDlg, SfxResId( STR_INFO_NOSEARCHTEXTFOUND ), VCL_MESSAGE_INFO);
+ aBox->Execute();
pSrchDlg->SetFocusOnEdit();
}
}
@@ -2271,11 +2354,9 @@ IMPL_LINK( SfxHelpTextWindow_Impl, FindHdl, sfx2::SearchDialog*, pDlg )
-IMPL_LINK( SfxHelpTextWindow_Impl, CloseHdl, sfx2::SearchDialog*, pDlg )
+IMPL_LINK( SfxHelpTextWindow_Impl, CloseHdl, sfx2::SearchDialog*, /*pDlg*/ )
{
- if ( pDlg )
- delete pSrchDlg;
- pSrchDlg = NULL;
+ pSrchDlg.clear();
return 0;
}
@@ -2308,7 +2389,7 @@ IMPL_LINK( SfxHelpTextWindow_Impl, CheckHdl, CheckBox*, pBox )
void SfxHelpTextWindow_Impl::Resize()
{
Size aSize = GetOutputSizePixel();
- long nToolBoxHeight = aToolBox.GetSizePixel().Height() + TOOLBOX_OFFSET;
+ long nToolBoxHeight = aToolBox->GetSizePixel().Height() + TOOLBOX_OFFSET;
aSize.Height() -= nToolBoxHeight;
pTextWin->SetPosSizePixel( Point( 0, nToolBoxHeight ), aSize );
SetOnStartupBoxPosition();
@@ -2325,7 +2406,7 @@ bool SfxHelpTextWindow_Impl::PreNotify( NotifyEvent& rNEvt )
const CommandEvent* pCmdEvt = rNEvt.GetCommandEvent();
vcl::Window* pCmdWin = rNEvt.GetWindow();
- if ( pCmdEvt->GetCommand() == COMMAND_CONTEXTMENU && pCmdWin != this && pCmdWin != &aToolBox )
+ if ( pCmdEvt->GetCommand() == COMMAND_CONTEXTMENU && pCmdWin != this && pCmdWin != aToolBox.get() )
{
Point aPos;
if ( pCmdEvt->IsMouseEvent() )
@@ -2430,9 +2511,9 @@ bool SfxHelpTextWindow_Impl::PreNotify( NotifyEvent& rNEvt )
pHelpWin->CloseWindow();
nDone = true;
}
- else if ( KEY_TAB == nKey && aOnStartupCB.HasChildPathFocus() )
+ else if ( KEY_TAB == nKey && aOnStartupCB->HasChildPathFocus() )
{
- aToolBox.GrabFocus();
+ aToolBox->GrabFocus();
nDone = true;
}
}
@@ -2484,13 +2565,13 @@ void SfxHelpTextWindow_Impl::ToggleIndex( bool bOn )
bIsIndexOn = bOn;
if ( bIsIndexOn )
{
- aToolBox.SetItemImage( TBI_INDEX, aIndexOffImage );
- aToolBox.SetItemText( TBI_INDEX, aIndexOffText );
+ aToolBox->SetItemImage( TBI_INDEX, aIndexOffImage );
+ aToolBox->SetItemText( TBI_INDEX, aIndexOffText );
}
else
{
- aToolBox.SetItemImage( TBI_INDEX, aIndexOnImage );
- aToolBox.SetItemText( TBI_INDEX, aIndexOnText );
+ aToolBox->SetItemImage( TBI_INDEX, aIndexOnImage );
+ aToolBox->SetItemText( TBI_INDEX, aIndexOnText );
}
}
@@ -2587,7 +2668,7 @@ void SfxHelpTextWindow_Impl::DoSearch()
if ( !pSrchDlg )
{
// create the search dialog
- pSrchDlg = new sfx2::SearchDialog( pTextWin, "HelpSearchDialog" );
+ pSrchDlg = VclPtr<sfx2::SearchDialog>::Create( pTextWin, "HelpSearchDialog" );
// set handler
pSrchDlg->SetFindHdl( LINK( this, SfxHelpTextWindow_Impl, FindHdl ) );
pSrchDlg->SetCloseHdl( LINK( this, SfxHelpTextWindow_Impl, CloseHdl ) );
@@ -2974,12 +3055,12 @@ SfxHelpWindow_Impl::SfxHelpWindow_Impl(
SetStyle( GetStyle() | WB_DIALOGCONTROL );
pHelpInterceptor->InitWaiter( this );
- pIndexWin = new SfxHelpIndexWindow_Impl( this );
+ pIndexWin = VclPtr<SfxHelpIndexWindow_Impl>::Create( this );
pIndexWin->SetDoubleClickHdl( LINK( this, SfxHelpWindow_Impl, OpenHdl ) );
pIndexWin->SetSelectFactoryHdl( LINK( this, SfxHelpWindow_Impl, SelectFactoryHdl ) );
pIndexWin->SetSizePixel(LogicToPixel(Size(120, 200), MAP_APPFONT));
pIndexWin->Show();
- pTextWin = new SfxHelpTextWindow_Impl( this );
+ pTextWin = VclPtr<SfxHelpTextWindow_Impl>::Create( this );
Reference < XFrames > xFrames = rFrame->getFrames();
xFrames->append( Reference<XFrame>(pTextWin->getFrame(), UNO_QUERY_THROW) );
pTextWin->SetSelectHdl( LINK( this, SfxHelpWindow_Impl, SelectHdl ) );
@@ -2993,13 +3074,16 @@ SfxHelpWindow_Impl::SfxHelpWindow_Impl(
SfxHelpWindow_Impl::~SfxHelpWindow_Impl()
{
- SaveConfig();
- vcl::Window* pDel = pIndexWin;
- pIndexWin = NULL;
- delete pDel;
+ disposeOnce();
+}
+void SfxHelpWindow_Impl::dispose()
+{
+ SaveConfig();
+ pIndexWin.disposeAndClear();
pTextWin->CloseFrame();
- delete pTextWin;
+ pTextWin.disposeAndClear();
+ SplitWindow::dispose();
}
bool SfxHelpWindow_Impl::PreNotify( NotifyEvent& rNEvt )
@@ -3127,11 +3211,11 @@ void SfxHelpWindow_Impl::DoAction( sal_uInt16 nActionId )
if ( aAny >>= aValue )
{
OUString aTitle( aValue );
- SfxAddHelpBookmarkDialog_Impl aDlg( this, false );
- aDlg.SetTitle( aTitle );
- if ( aDlg.Execute() == RET_OK )
+ ScopedVclPtrInstance< SfxAddHelpBookmarkDialog_Impl > aDlg(this, false);
+ aDlg->SetTitle( aTitle );
+ if ( aDlg->Execute() == RET_OK )
{
- aTitle = aDlg.GetTitle();
+ aTitle = aDlg->GetTitle();
pIndexWin->AddBookmarks( aTitle, aURL );
}
}
@@ -3206,7 +3290,16 @@ SfxAddHelpBookmarkDialog_Impl::SfxAddHelpBookmarkDialog_Impl(vcl::Window* pParen
SetText(get<FixedText>("alttitle")->GetText());
}
+SfxAddHelpBookmarkDialog_Impl::~SfxAddHelpBookmarkDialog_Impl()
+{
+ disposeOnce();
+}
+void SfxAddHelpBookmarkDialog_Impl::dispose()
+{
+ m_pTitleED.clear();
+ ModalDialog::dispose();
+}
void SfxAddHelpBookmarkDialog_Impl::SetTitle( const OUString& rTitle )
{
diff --git a/sfx2/source/appl/newhelp.hxx b/sfx2/source/appl/newhelp.hxx
index 4ccf236b2049..add82d178f9b 100644
--- a/sfx2/source/appl/newhelp.hxx
+++ b/sfx2/source/appl/newhelp.hxx
@@ -60,7 +60,7 @@ private:
public:
ContentListBox_Impl(vcl::Window* pParent, WinBits nStyle);
virtual ~ContentListBox_Impl();
-
+ virtual void dispose() SAL_OVERRIDE;
virtual void RequestingChildren( SvTreeListEntry* pParent ) SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -76,11 +76,13 @@ class SfxHelpIndexWindow_Impl;
class HelpTabPage_Impl : public TabPage
{
protected:
- SfxHelpIndexWindow_Impl* m_pIdxWin;
+ VclPtr<SfxHelpIndexWindow_Impl> m_pIdxWin;
public:
HelpTabPage_Impl(vcl::Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin,
const OString& rID, const OUString& rUIXMLDescription);
+ virtual ~HelpTabPage_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual Control* GetLastFocusControl() = 0;
};
@@ -90,10 +92,12 @@ public:
class ContentTabPage_Impl : public HelpTabPage_Impl
{
private:
- ContentListBox_Impl* m_pContentBox;
+ VclPtr<ContentListBox_Impl> m_pContentBox;
public:
ContentTabPage_Impl(vcl::Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin);
+ virtual ~ContentTabPage_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void ActivatePage() SAL_OVERRIDE;
virtual Control* GetLastFocusControl() SAL_OVERRIDE;
@@ -119,8 +123,8 @@ public:
class IndexTabPage_Impl : public HelpTabPage_Impl
{
private:
- IndexBox_Impl* m_pIndexCB;
- PushButton* m_pOpenBtn;
+ VclPtr<IndexBox_Impl> m_pIndexCB;
+ VclPtr<PushButton> m_pOpenBtn;
Idle aFactoryIdle;
Timer aKeywordTimer;
@@ -141,6 +145,7 @@ private:
public:
IndexTabPage_Impl( vcl::Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin );
virtual ~IndexTabPage_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void ActivatePage() SAL_OVERRIDE;
virtual Control* GetLastFocusControl() SAL_OVERRIDE;
@@ -195,12 +200,12 @@ public:
class SearchTabPage_Impl : public HelpTabPage_Impl
{
private:
- SearchBox_Impl* m_pSearchED;
- PushButton* m_pSearchBtn;
- CheckBox* m_pFullWordsCB;
- CheckBox* m_pScopeCB;
- SearchResultsBox_Impl* m_pResultsLB;
- PushButton* m_pOpenBtn;
+ VclPtr<SearchBox_Impl> m_pSearchED;
+ VclPtr<PushButton> m_pSearchBtn;
+ VclPtr<CheckBox> m_pFullWordsCB;
+ VclPtr<CheckBox> m_pScopeCB;
+ VclPtr<SearchResultsBox_Impl> m_pResultsLB;
+ VclPtr<PushButton> m_pOpenBtn;
OUString aFactory;
@@ -217,6 +222,7 @@ private:
public:
SearchTabPage_Impl( vcl::Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin );
virtual ~SearchTabPage_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void ActivatePage() SAL_OVERRIDE;
virtual Control* GetLastFocusControl() SAL_OVERRIDE;
@@ -242,6 +248,7 @@ private:
public:
BookmarksBox_Impl(vcl::Window* pParent, WinBits nStyle);
virtual ~BookmarksBox_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
};
@@ -249,13 +256,15 @@ public:
class BookmarksTabPage_Impl : public HelpTabPage_Impl
{
private:
- BookmarksBox_Impl* m_pBookmarksBox;
- PushButton* m_pBookmarksPB;
+ VclPtr<BookmarksBox_Impl> m_pBookmarksBox;
+ VclPtr<PushButton> m_pBookmarksPB;
DECL_LINK(OpenHdl, void *);
public:
BookmarksTabPage_Impl( vcl::Window* pParent, SfxHelpIndexWindow_Impl* _pIdxWin );
+ virtual ~BookmarksTabPage_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void ActivatePage() SAL_OVERRIDE;
virtual Control* GetLastFocusControl() SAL_OVERRIDE;
@@ -273,8 +282,8 @@ class SfxHelpWindow_Impl;
class SfxHelpIndexWindow_Impl : public vcl::Window, public VclBuilderContainer
{
private:
- ListBox* m_pActiveLB;
- TabControl* m_pTabCtrl;
+ VclPtr<ListBox> m_pActiveLB;
+ VclPtr<TabControl> m_pTabCtrl;
Idle aIdle;
@@ -283,12 +292,12 @@ private:
Link aIndexKeywordLink;
OUString sKeyword;
- SfxHelpWindow_Impl* pParentWin;
+ VclPtr<SfxHelpWindow_Impl> pParentWin;
- ContentTabPage_Impl* pCPage;
- IndexTabPage_Impl* pIPage;
- SearchTabPage_Impl* pSPage;
- BookmarksTabPage_Impl* pBPage;
+ VclPtr<ContentTabPage_Impl> pCPage;
+ VclPtr<IndexTabPage_Impl> pIPage;
+ VclPtr<SearchTabPage_Impl> pSPage;
+ VclPtr<BookmarksTabPage_Impl> pBPage;
long nMinWidth;
bool bWasCursorLeftOrRight;
@@ -312,6 +321,7 @@ private:
public:
SfxHelpIndexWindow_Impl( SfxHelpWindow_Impl* pParent );
virtual ~SfxHelpIndexWindow_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
virtual Size GetOptimalSize() const SAL_OVERRIDE;
@@ -343,7 +353,7 @@ ContentTabPage_Impl* SfxHelpIndexWindow_Impl::GetContentPage()
{
if ( !pCPage )
{
- pCPage = new ContentTabPage_Impl( m_pTabCtrl, this );
+ pCPage = VclPtr<ContentTabPage_Impl>::Create( m_pTabCtrl, this );
pCPage->SetOpenHdl( aPageDoubleClickLink );
}
return pCPage;
@@ -352,7 +362,7 @@ IndexTabPage_Impl* SfxHelpIndexWindow_Impl::GetIndexPage()
{
if ( !pIPage )
{
- pIPage = new IndexTabPage_Impl( m_pTabCtrl, this );
+ pIPage = VclPtr<IndexTabPage_Impl>::Create( m_pTabCtrl, this );
pIPage->SetDoubleClickHdl( aPageDoubleClickLink );
pIPage->SetKeywordHdl( aIndexKeywordLink );
}
@@ -363,7 +373,7 @@ SearchTabPage_Impl* SfxHelpIndexWindow_Impl::GetSearchPage()
{
if ( !pSPage )
{
- pSPage = new SearchTabPage_Impl( m_pTabCtrl, this );
+ pSPage = VclPtr<SearchTabPage_Impl>::Create( m_pTabCtrl, this );
pSPage->SetDoubleClickHdl( aPageDoubleClickLink );
}
return pSPage;
@@ -373,7 +383,7 @@ BookmarksTabPage_Impl* SfxHelpIndexWindow_Impl::GetBookmarksPage()
{
if ( !pBPage )
{
- pBPage = new BookmarksTabPage_Impl( m_pTabCtrl, this );
+ pBPage = VclPtr<BookmarksTabPage_Impl>::Create( m_pTabCtrl, this );
pBPage->SetDoubleClickHdl( aPageDoubleClickLink );
}
return pBPage;
@@ -392,7 +402,6 @@ class TextWin_Impl : public DockingWindow
{
public:
TextWin_Impl( vcl::Window* pParent );
- virtual ~TextWin_Impl();
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
};
@@ -405,8 +414,8 @@ class SfxHelpWindow_Impl;
class SfxHelpTextWindow_Impl : public vcl::Window
{
private:
- ToolBox aToolBox;
- CheckBox aOnStartupCB;
+ VclPtr<ToolBox> aToolBox;
+ VclPtr<CheckBox> aOnStartupCB;
Idle aSelectIdle;
Image aIndexOnImage;
Image aIndexOffImage;
@@ -416,9 +425,9 @@ private:
OUString aOnStartupText;
OUString sCurrentFactory;
- SfxHelpWindow_Impl* pHelpWin;
- vcl::Window* pTextWin;
- sfx2::SearchDialog* pSrchDlg;
+ VclPtr<SfxHelpWindow_Impl> pHelpWin;
+ VclPtr<vcl::Window> pTextWin;
+ VclPtr<sfx2::SearchDialog> pSrchDlg;
::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame2 >
xFrame;
::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator >
@@ -426,12 +435,12 @@ private:
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
xConfiguration;
long nMinPos;
- bool bIsDebug;
- bool bIsIndexOn;
- bool bIsInClose;
- bool bIsFullWordSearch;
+ bool bIsDebug;
+ bool bIsIndexOn;
+ bool bIsInClose;
+ bool bIsFullWordSearch;
- bool HasSelection() const;
+ bool HasSelection() const;
void InitToolBoxImages();
void InitOnStartupBox( bool bOnlyText );
void SetOnStartupBoxPosition();
@@ -451,6 +460,7 @@ private:
public:
SfxHelpTextWindow_Impl( SfxHelpWindow_Impl* pParent );
virtual ~SfxHelpTextWindow_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -460,11 +470,11 @@ public:
inline ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame2 >
getFrame() const { return xFrame; }
- inline void SetSelectHdl( const Link& rLink ) { aToolBox.SetSelectHdl( rLink ); }
+ inline void SetSelectHdl( const Link& rLink ) { aToolBox->SetSelectHdl( rLink ); }
void ToggleIndex( bool bOn );
void SelectSearchText( const OUString& rSearchText, bool _bIsFullWordSearch );
void SetPageStyleHeaderOff() const;
- inline ToolBox& GetToolBox() { return aToolBox; }
+ inline ToolBox& GetToolBox() { return *aToolBox.get(); }
void CloseFrame();
void DoSearch();
};
@@ -485,8 +495,8 @@ friend class SfxHelpIndexWindow_Impl;
::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame2 >
xFrame;
- SfxHelpIndexWindow_Impl* pIndexWin;
- SfxHelpTextWindow_Impl* pTextWin;
+ VclPtr<SfxHelpIndexWindow_Impl> pIndexWin;
+ VclPtr<SfxHelpTextWindow_Impl> pTextWin;
HelpInterceptor_Impl* pHelpInterceptor;
HelpListener_Impl* pHelpListener;
@@ -519,6 +529,7 @@ public:
SfxHelpWindow_Impl( const ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame2 >& rFrame,
vcl::Window* pParent, WinBits nBits );
virtual ~SfxHelpWindow_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -556,9 +567,11 @@ public:
class SfxAddHelpBookmarkDialog_Impl : public ModalDialog
{
private:
- Edit* m_pTitleED;
+ VclPtr<Edit> m_pTitleED;
public:
SfxAddHelpBookmarkDialog_Impl( vcl::Window* pParent, bool bRename = true );
+ virtual ~SfxAddHelpBookmarkDialog_Impl();
+ virtual void dispose() SAL_OVERRIDE;
void SetTitle( const OUString& rTitle );
OUString GetTitle() const { return m_pTitleED->GetText(); }
diff --git a/sfx2/source/appl/opengrf.cxx b/sfx2/source/appl/opengrf.cxx
index 8c18f4028bf3..4c001886d296 100644
--- a/sfx2/source/appl/opengrf.cxx
+++ b/sfx2/source/appl/opengrf.cxx
@@ -158,8 +158,8 @@ short SvxOpenGraphicDialog::Execute()
// could not load?
if ( nFound == USHRT_MAX )
{
- WarningBox aWarningBox( NULL, WB_3DLOOK | WB_RETRY_CANCEL, SfxResId( SvxOpenGrfErr2ResId(nImpRet) ).toString() );
- bQuitLoop = aWarningBox.Execute() != RET_RETRY;
+ ScopedVclPtrInstance< WarningBox > aWarningBox(nullptr, WB_3DLOOK | WB_RETRY_CANCEL, SfxResId( SvxOpenGrfErr2ResId(nImpRet) ).toString());
+ bQuitLoop = aWarningBox->Execute() != RET_RETRY;
}
else
{
diff --git a/sfx2/source/appl/openuriexternally.cxx b/sfx2/source/appl/openuriexternally.cxx
index ecc347eddd27..beb4deed9ec3 100644
--- a/sfx2/source/appl/openuriexternally.cxx
+++ b/sfx2/source/appl/openuriexternally.cxx
@@ -44,10 +44,10 @@ bool sfx2::openUriExternally(
"unexpected IllegalArgumentException: " + e.Message);
}
SolarMutexGuard g;
- MessageDialog eb(
+ ScopedVclPtrInstance<MessageDialog> eb(
SfxGetpApp()->GetTopWindow(), SfxResId(STR_NO_ABS_URI_REF));
- eb.set_primary_text(eb.get_primary_text().replaceFirst("$(ARG1)", uri));
- eb.Execute();
+ eb->set_primary_text(eb->get_primary_text().replaceFirst("$(ARG1)", uri));
+ eb->Execute();
} catch (css::system::SystemShellExecuteException &) {
if (!handleSystemShellExecuteException) {
throw;
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 247e80e140af..21e56b4c1920 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -402,8 +402,8 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame2 >& rHelpTask ,
// create all internal windows and sub frames ...
Reference< ::com::sun::star::awt::XWindow > xParentWindow = xHelpTask->getContainerWindow();
- vcl::Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
- SfxHelpWindow_Impl* pHelpWindow = new SfxHelpWindow_Impl( xHelpTask, pParentWindow, WB_DOCKBORDER );
+ vcl::Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
+ VclPtrInstance<SfxHelpWindow_Impl> pHelpWindow( xHelpTask, pParentWindow, WB_DOCKBORDER );
Reference< ::com::sun::star::awt::XWindow > xHelpWindow = VCLUnoHelper::GetInterface( pHelpWindow );
Reference< XFrame > xHelpContent;
@@ -429,7 +429,7 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame2 >& rHelpTask ,
if (!xHelpContent.is())
{
- delete pHelpWindow;
+ pHelpWindow.disposeAndClear();
return NULL;
}
@@ -605,8 +605,8 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const
if ( impl_showOnlineHelp( aHelpURL ) )
return true;
- NoHelpErrorBox aErrBox( const_cast< vcl::Window* >( pWindow ) );
- aErrBox.Execute();
+ ScopedVclPtrInstance< NoHelpErrorBox > aErrBox(const_cast< vcl::Window* >( pWindow ));
+ aErrBox->Execute();
return false;
}
@@ -626,7 +626,7 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const
if (!xHelp.is())
pHelpWindow = impl_createHelp(xHelp, xHelpContent);
else
- pHelpWindow = static_cast<SfxHelpWindow_Impl*>(VCLUnoHelper::GetWindow(xHelp->getComponentWindow()));
+ pHelpWindow = static_cast<SfxHelpWindow_Impl*>(VCLUnoHelper::GetWindow(xHelp->getComponentWindow()).get());
if (!xHelp.is() || !xHelpContent.is() || !pHelpWindow)
return false;
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index 7f3920dcc088..d6ec61c5ff3c 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -569,7 +569,7 @@ SfxFrameWorkWin_Impl::SfxFrameWorkWin_Impl( vcl::Window *pWin, SfxFrame *pFrm, S
n == SFX_SPLITWINDOWS_RIGHT ? SfxChildAlignment::RIGHT :
n == SFX_SPLITWINDOWS_TOP ? SfxChildAlignment::TOP :
SfxChildAlignment::BOTTOM );
- SfxSplitWindow *pSplitWin = new SfxSplitWindow(pWorkWin, eAlign, this, pParent==0 );
+ VclPtr<SfxSplitWindow> pSplitWin = VclPtr<SfxSplitWindow>::Create(pWorkWin, eAlign, this, pParent==0 );
pSplit[n] = pSplitWin;
}
@@ -606,7 +606,6 @@ SfxWorkWindow::SfxWorkWindow( vcl::Window *pWin, SfxBindings& rB, SfxWorkWindow*
m_aTbxTypeName( "private:resource/toolbar/" ),
m_aProgressBarResName( "private:resource/progressbar/progressbar" )
{
- memset(pSplit, 0, sizeof(pSplit));
DBG_ASSERT (pBindings, "No Bindings!");
pBindings->SetWorkWindow_Impl( this );
@@ -633,10 +632,10 @@ SfxWorkWindow::~SfxWorkWindow()
// Delete SplitWindows
for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
{
- SfxSplitWindow *p = pSplit[n];
+ VclPtr<SfxSplitWindow> p = pSplit[n];
if (p->GetWindowCount())
ReleaseChild_Impl(*p);
- delete p;
+ pSplit[n].disposeAndClear();
}
// Delete help structure for Child-Windows
@@ -677,8 +676,8 @@ void SfxWorkWindow::DeleteControllers_Impl()
for ( n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
{
SfxSplitWindow *p = pSplit[n];
- if (p->GetWindowCount())
- p->Lock();
+ if (p->GetWindowCount())
+ p->Lock();
}
// Delete Child-Windows
@@ -853,7 +852,7 @@ SvBorder SfxWorkWindow::Arrange_Impl()
case SfxChildAlignment::LOWESTTOP:
aSize.Width() = aTmp.GetWidth();
if ( pCli->pWin->GetType() == WINDOW_SPLITWINDOW )
- aSize = static_cast<SplitWindow *>(pCli->pWin)->CalcLayoutSizePixel( aSize );
+ aSize = static_cast<SplitWindow *>(pCli->pWin.get())->CalcLayoutSizePixel( aSize );
bAllowHiding = false;
aBorder.Top() += aSize.Height();
aPos = aTmp.TopLeft();
@@ -868,7 +867,7 @@ SvBorder SfxWorkWindow::Arrange_Impl()
case SfxChildAlignment::HIGHESTBOTTOM:
aSize.Width() = aTmp.GetWidth();
if ( pCli->pWin->GetType() == WINDOW_SPLITWINDOW )
- aSize = static_cast<SplitWindow *>(pCli->pWin)->CalcLayoutSizePixel( aSize );
+ aSize = static_cast<SplitWindow *>(pCli->pWin.get())->CalcLayoutSizePixel( aSize );
aBorder.Bottom() += aSize.Height();
aPos = aTmp.BottomLeft();
aPos.Y() -= (aSize.Height()-1);
@@ -883,7 +882,7 @@ SvBorder SfxWorkWindow::Arrange_Impl()
case SfxChildAlignment::TOOLBOXLEFT:
aSize.Height() = aTmp.GetHeight();
if ( pCli->pWin->GetType() == WINDOW_SPLITWINDOW )
- aSize = static_cast<SplitWindow *>(pCli->pWin)->CalcLayoutSizePixel( aSize );
+ aSize = static_cast<SplitWindow *>(pCli->pWin.get())->CalcLayoutSizePixel( aSize );
bAllowHiding = false;
aBorder.Left() += aSize.Width();
aPos = aTmp.TopLeft();
@@ -898,7 +897,7 @@ SvBorder SfxWorkWindow::Arrange_Impl()
case SfxChildAlignment::TOOLBOXRIGHT:
aSize.Height() = aTmp.GetHeight();
if ( pCli->pWin->GetType() == WINDOW_SPLITWINDOW )
- aSize = static_cast<SplitWindow *>(pCli->pWin)->CalcLayoutSizePixel( aSize );
+ aSize = static_cast<SplitWindow *>(pCli->pWin.get())->CalcLayoutSizePixel( aSize );
aBorder.Right() += aSize.Width();
aPos = aTmp.TopRight();
aPos.X() -= (aSize.Width()-1);
@@ -1071,10 +1070,10 @@ void SfxWorkWindow::ShowChildren_Impl()
switch ( pCli->pWin->GetType() )
{
case RSC_DOCKINGWINDOW :
- static_cast<DockingWindow*>(pCli->pWin)->Show( true, nFlags );
+ static_cast<DockingWindow*>(pCli->pWin.get())->Show( true, nFlags );
break;
case RSC_SPLITWINDOW :
- static_cast<SplitWindow*>(pCli->pWin)->Show( true, nFlags );
+ static_cast<SplitWindow*>(pCli->pWin.get())->Show( true, nFlags );
break;
default:
pCli->pWin->Show( true, nFlags );
@@ -1088,7 +1087,7 @@ void SfxWorkWindow::ShowChildren_Impl()
switch ( pCli->pWin->GetType() )
{
case RSC_DOCKINGWINDOW :
- static_cast<DockingWindow*>(pCli->pWin)->Hide();
+ static_cast<DockingWindow*>(pCli->pWin.get())->Hide();
break;
default:
pCli->pWin->Hide();
@@ -1111,7 +1110,7 @@ void SfxWorkWindow::HideChildren_Impl()
switch ( pChild->pWin->GetType() )
{
case RSC_DOCKINGWINDOW :
- static_cast<DockingWindow*>(pChild->pWin)->Hide();
+ static_cast<DockingWindow*>(pChild->pWin.get())->Hide();
break;
default:
pChild->pWin->Hide();
@@ -2534,7 +2533,7 @@ bool SfxWorkWindow::IsAutoHideMode( const SfxSplitWindow *pSplitWin )
{
for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
{
- if ( pSplit[n] != pSplitWin && pSplit[n]->IsAutoHide( true ) )
+ if ( pSplit[n].get() != pSplitWin && pSplit[n]->IsAutoHide( true ) )
return true;
}
return false;
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx
index 9e0f8de67342..6db9950b47e0 100644
--- a/sfx2/source/bastyp/fltfnc.cxx
+++ b/sfx2/source/bastyp/fltfnc.cxx
@@ -534,8 +534,8 @@ bool SfxFilterMatcher::IsFilterInstalled_Impl( const SfxFilter* pFilter )
// Here could a re-installation be offered
OUString aText( SfxResId(STR_FILTER_NOT_INSTALLED).toString() );
aText = aText.replaceFirst( "$(FILTER)", pFilter->GetUIName() );
- QueryBox aQuery( NULL, WB_YES_NO | WB_DEF_YES, aText );
- short nRet = aQuery.Execute();
+ ScopedVclPtrInstance< QueryBox > aQuery(nullptr, WB_YES_NO | WB_DEF_YES, aText);
+ short nRet = aQuery->Execute();
if ( nRet == RET_YES )
{
#ifdef DBG_UTIL
diff --git a/sfx2/source/control/ctrlitem.cxx b/sfx2/source/control/ctrlitem.cxx
index c1fa1624daa5..0be5e36658b7 100644
--- a/sfx2/source/control/ctrlitem.cxx
+++ b/sfx2/source/control/ctrlitem.cxx
@@ -218,16 +218,19 @@ SfxControllerItem::SfxControllerItem( sal_uInt16 nID, SfxBindings &rBindings ):
}
-// unregisteres the item in the bindings
+// unregisters the item in the bindings
SfxControllerItem::~SfxControllerItem()
{
+ dispose();
+}
+
+void SfxControllerItem::dispose()
+{
if ( IsBound() )
pBindings->Release(*this);
}
-
-
void SfxControllerItem::StateChanged
(
sal_uInt16, // <SID> of the triggering slot
diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx
index 9b68a0e09908..dc22fddc1910 100644
--- a/sfx2/source/control/recentdocsview.cxx
+++ b/sfx2/source/control/recentdocsview.cxx
@@ -62,10 +62,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeRecentDocsView(vcl::Wi
return new RecentDocsView(pParent);
}
-RecentDocsView::~RecentDocsView()
-{
-}
-
bool RecentDocsView::typeMatchesExtension(ApplicationType type, const OUString &rExt)
{
bool bRet = false;
diff --git a/sfx2/source/control/templateabstractview.cxx b/sfx2/source/control/templateabstractview.cxx
index 51b213d7d7e3..408fccb50059 100644
--- a/sfx2/source/control/templateabstractview.cxx
+++ b/sfx2/source/control/templateabstractview.cxx
@@ -128,29 +128,37 @@ bool ViewFilter_Keyword::operator ()(const ThumbnailViewItem *pItem)
TemplateAbstractView::TemplateAbstractView (vcl::Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren)
: ThumbnailView(pParent,nWinStyle,bDisableTransientChildren),
mnCurRegionId(0),
- maAllButton(this, SfxResId(BTN_ALL_TEMPLATES)),
- maFTName(this, SfxResId(FT_NAME))
+ maAllButton(VclPtr<PushButton>::Create(this, SfxResId(BTN_ALL_TEMPLATES))),
+ maFTName(VclPtr<FixedText>::Create(this, SfxResId(FT_NAME)))
{
- maAllButton.Hide();
- maAllButton.SetStyle(maAllButton.GetStyle() | WB_FLATBUTTON);
- maAllButton.SetClickHdl(LINK(this,TemplateAbstractView,ShowRootRegionHdl));
- maFTName.Hide();
+ maAllButton->Hide();
+ maAllButton->SetStyle(maAllButton->GetStyle() | WB_FLATBUTTON);
+ maAllButton->SetClickHdl(LINK(this,TemplateAbstractView,ShowRootRegionHdl));
+ maFTName->Hide();
}
TemplateAbstractView::TemplateAbstractView(vcl::Window *pParent)
: ThumbnailView(pParent),
mnCurRegionId(0),
- maAllButton(this, SfxResId(BTN_ALL_TEMPLATES)),
- maFTName(this, SfxResId(FT_NAME))
+ maAllButton(VclPtr<PushButton>::Create(this, SfxResId(BTN_ALL_TEMPLATES))),
+ maFTName(VclPtr<FixedText>::Create(this, SfxResId(FT_NAME)))
{
- maAllButton.Hide();
- maAllButton.SetStyle(maAllButton.GetStyle() | WB_FLATBUTTON);
- maAllButton.SetClickHdl(LINK(this,TemplateAbstractView,ShowRootRegionHdl));
- maFTName.Hide();
+ maAllButton->Hide();
+ maAllButton->SetStyle(maAllButton->GetStyle() | WB_FLATBUTTON);
+ maAllButton->SetClickHdl(LINK(this,TemplateAbstractView,ShowRootRegionHdl));
+ maFTName->Hide();
}
-TemplateAbstractView::~TemplateAbstractView ()
+TemplateAbstractView::~TemplateAbstractView()
{
+ disposeOnce();
+}
+
+void TemplateAbstractView::dispose()
+{
+ maAllButton.disposeAndClear();
+ maFTName.disposeAndClear();
+ ThumbnailView::dispose();
}
void TemplateAbstractView::insertItem(const TemplateItemProperties &rTemplate)
@@ -283,7 +291,7 @@ void TemplateAbstractView::OnItemDblClicked (ThumbnailViewItem *pItem)
mnCurRegionId = pContainerItem->mnRegionId+1;
maCurRegionName = pContainerItem->maTitle;
- maFTName.SetText(maCurRegionName);
+ maFTName->SetText(maCurRegionName);
showRegion(pItem);
}
else
diff --git a/sfx2/source/control/templatedefaultview.cxx b/sfx2/source/control/templatedefaultview.cxx
index 9e2f83a14378..3c42d29b508c 100644
--- a/sfx2/source/control/templatedefaultview.cxx
+++ b/sfx2/source/control/templatedefaultview.cxx
@@ -28,10 +28,6 @@ TemplateDefaultView::TemplateDefaultView( Window* pParent)
ThumbnailView::setItemDimensions( mnItemMaxSize, mnItemMaxSize, mnTextHeight, mnItemPadding );
}
-TemplateDefaultView::~TemplateDefaultView()
-{
-}
-
void TemplateDefaultView::reload()
{
TemplateLocalView::reload();
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index ad14ae841b50..c2e42d9a7eae 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -45,12 +45,18 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeTemplateLocalView(vcl:
TemplateLocalView::~TemplateLocalView()
{
+ disposeOnce();
+}
+
+void TemplateLocalView::dispose()
+{
for (size_t i = 0; i < maRegions.size(); ++i)
delete maRegions[i];
maRegions.clear();
delete mpDocTemplates;
+ TemplateAbstractView::dispose();
}
void TemplateLocalView::Populate ()
@@ -141,8 +147,8 @@ void TemplateLocalView::showRootRegion()
items[i] = pItem;
}
- maAllButton.Show(false);
- maFTName.Show(false);
+ maAllButton->Show(false);
+ maFTName->Show(false);
updateItems(items);
@@ -151,12 +157,12 @@ void TemplateLocalView::showRootRegion()
void TemplateLocalView::showRegion(ThumbnailViewItem *pItem)
{
- mnHeaderHeight = maAllButton.GetSizePixel().getHeight() + maAllButton.GetPosPixel().Y() * 2;
+ mnHeaderHeight = maAllButton->GetSizePixel().getHeight() + maAllButton->GetPosPixel().Y() * 2;
mnCurRegionId = static_cast<TemplateContainerItem*>(pItem)->mnRegionId+1;
maCurRegionName = pItem->maTitle;
- maAllButton.Show(true);
- maFTName.Show(true);
+ maAllButton->Show(true);
+ maFTName->Show(true);
insertItems(reinterpret_cast<TemplateContainerItem*>(pItem)->maTemplates);
@@ -169,7 +175,7 @@ void TemplateLocalView::showRegion(const OUString &rName)
{
if (maRegions[i]->maTitle == rName)
{
- maFTName.SetText(rName);
+ maFTName->SetText(rName);
showRegion(maRegions[i]);
break;
}
diff --git a/sfx2/source/control/templateremoteview.cxx b/sfx2/source/control/templateremoteview.cxx
index 0729a6bdf53c..f33407a8e5f8 100644
--- a/sfx2/source/control/templateremoteview.cxx
+++ b/sfx2/source/control/templateremoteview.cxx
@@ -59,10 +59,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeTemplateRemoteView(vcl
return new TemplateRemoteView(pParent, WB_VSCROLL, false);
}
-TemplateRemoteView::~TemplateRemoteView ()
-{
-}
-
void TemplateRemoteView::showRootRegion()
{
//TODO:
@@ -86,7 +82,7 @@ bool TemplateRemoteView::loadRepository (TemplateRepository* pItem, bool bRefres
mnCurRegionId = pItem->mnId;
maCurRegionName = pItem->maTitle;
- maFTName.SetText(maCurRegionName);
+ maFTName->SetText(maCurRegionName);
OUString aURL = pItem->getURL();
diff --git a/sfx2/source/control/templatesearchview.cxx b/sfx2/source/control/templatesearchview.cxx
index fb21ac654812..582dd5ad2c2f 100644
--- a/sfx2/source/control/templatesearchview.cxx
+++ b/sfx2/source/control/templatesearchview.cxx
@@ -22,10 +22,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeTemplateSearchView(vcl
return new TemplateSearchView(pParent);
}
-TemplateSearchView::~TemplateSearchView ()
-{
-}
-
void TemplateSearchView::setOpenTemplateHdl(const Link &rLink)
{
maOpenTemplateHdl = rLink;
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index d85561438987..8c6a30e60d0b 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -66,6 +66,11 @@ ThumbnailView::ThumbnailView (vcl::Window *pParent, WinBits nWinStyle, bool bDis
ThumbnailView::~ThumbnailView()
{
+ disposeOnce();
+}
+
+void ThumbnailView::dispose()
+{
com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>
xComponent(GetAccessible(false),
com::sun::star::uno::UNO_QUERY);
@@ -73,11 +78,12 @@ ThumbnailView::~ThumbnailView()
if (xComponent.is())
xComponent->dispose ();
- delete mpScrBar;
+ mpScrBar.disposeAndClear();
delete mpItemAttrs;
delete mpProcessor;
ImplDeleteItems();
+ Control::dispose();
}
void ThumbnailView::MouseMove(const MouseEvent& rMEvt)
@@ -230,7 +236,7 @@ void ThumbnailView::ImplInitScrollBar()
{
if ( !mpScrBar )
{
- mpScrBar = new ScrollBar( this, WB_VSCROLL | WB_DRAG );
+ mpScrBar = VclPtr<ScrollBar>::Create( this, WB_VSCROLL | WB_DRAG );
mpScrBar->SetScrollHdl( LINK( this, ThumbnailView, ImplScrollHdl ) );
}
else
@@ -270,7 +276,7 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed)
Size aWinSize = GetOutputSizePixel();
size_t nItemCount = mFilteredItemList.size();
WinBits nStyle = GetStyle();
- ScrollBar* pDelScrBar = NULL;
+ VclPtr<ScrollBar> pDelScrBar;
// consider the scrolling
if ( nStyle & WB_VSCROLL )
@@ -435,7 +441,7 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed)
}
// delete ScrollBar
- delete pDelScrBar;
+ pDelScrBar.disposeAndClear();
}
size_t ThumbnailView::ImplGetItem( const Point& rPos ) const
diff --git a/sfx2/source/control/thumbnailviewacc.cxx b/sfx2/source/control/thumbnailviewacc.cxx
index c29e797b4c47..598e3034b4e2 100644
--- a/sfx2/source/control/thumbnailviewacc.cxx
+++ b/sfx2/source/control/thumbnailviewacc.cxx
@@ -593,7 +593,7 @@ void ThumbnailViewAcc::ThrowIfDisposed()
}
else
{
- DBG_ASSERT (mpParent!=NULL, "ValueSetAcc not disposed but mpParent == NULL");
+ DBG_ASSERT (mpParent!=nullptr, "ValueSetAcc not disposed but mpParent == NULL");
}
}
diff --git a/sfx2/source/control/thumbnailviewacc.hxx b/sfx2/source/control/thumbnailviewacc.hxx
index f6f8f1a7c090..dbff7e29048d 100644
--- a/sfx2/source/control/thumbnailviewacc.hxx
+++ b/sfx2/source/control/thumbnailviewacc.hxx
@@ -33,6 +33,7 @@
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
+#include <vcl/vclptr.hxx>
#include <vector>
class ThumbnailView;
@@ -121,7 +122,7 @@ public:
private:
::std::vector< ::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessibleEventListener > > mxEventListeners;
- ThumbnailView* mpParent;
+ VclPtr<ThumbnailView> mpParent;
bool mbIsTransientChildrenDisabled;
/// The current FOCUSED state.
bool mbIsFocused;
diff --git a/sfx2/source/control/thumbnailviewitem.cxx b/sfx2/source/control/thumbnailviewitem.cxx
index 040eb186cce2..c6543906639c 100644
--- a/sfx2/source/control/thumbnailviewitem.cxx
+++ b/sfx2/source/control/thumbnailviewitem.cxx
@@ -53,7 +53,6 @@ class ResizableMultiLineEdit : public VclMultiLineEdit
public:
ResizableMultiLineEdit (vcl::Window* pParent, ThumbnailViewItem* pItem);
- virtual ~ResizableMultiLineEdit ();
void SetInGrabFocus(bool bInGrabFocus) { mbIsInGrabFocus = bInGrabFocus; }
@@ -68,10 +67,6 @@ ResizableMultiLineEdit::ResizableMultiLineEdit (vcl::Window* pParent, ThumbnailV
{
}
-ResizableMultiLineEdit::~ResizableMultiLineEdit ()
-{
-}
-
bool ResizableMultiLineEdit::PreNotify(NotifyEvent& rNEvt)
{
bool nDone = false;
@@ -117,12 +112,12 @@ ThumbnailViewItem::ThumbnailViewItem(ThumbnailView &rView, sal_uInt16 nId)
, mpTitleED(NULL)
, maTextEditMaxArea()
{
- mpTitleED = new ResizableMultiLineEdit(&rView, this);
+ mpTitleED = VclPtr<ResizableMultiLineEdit>::Create(&rView, this);
}
ThumbnailViewItem::~ThumbnailViewItem()
{
- delete mpTitleED;
+ mpTitleED.disposeAndClear();
if( mpxAcc )
{
static_cast< ThumbnailViewItemAcc* >( mpxAcc->get() )->ParentDestroyed();
@@ -183,9 +178,9 @@ void ThumbnailViewItem::setEditTitle (bool edit, bool bChangeFocus)
{
mpTitleED->SetText(maTitle);
updateTitleEditSize();
- static_cast<ResizableMultiLineEdit*>(mpTitleED)->SetInGrabFocus(true);
+ static_cast<ResizableMultiLineEdit*>(mpTitleED.get())->SetInGrabFocus(true);
mpTitleED->GrabFocus();
- static_cast<ResizableMultiLineEdit*>(mpTitleED)->SetInGrabFocus(false);
+ static_cast<ResizableMultiLineEdit*>(mpTitleED.get())->SetInGrabFocus(false);
}
else if (bChangeFocus)
{
diff --git a/sfx2/source/dialog/alienwarn.cxx b/sfx2/source/dialog/alienwarn.cxx
index 09f59c14de94..7421173023f0 100644
--- a/sfx2/source/dialog/alienwarn.cxx
+++ b/sfx2/source/dialog/alienwarn.cxx
@@ -68,11 +68,20 @@ SfxAlienWarningDialog::SfxAlienWarningDialog(vcl::Window* pParent, const OUStrin
SfxAlienWarningDialog::~SfxAlienWarningDialog()
{
+ disposeOnce();
+}
+
+void SfxAlienWarningDialog::dispose()
+{
// save value of "warning off" checkbox, if necessary
SvtSaveOptions aSaveOpt;
bool bChecked = m_pWarningOnBox->IsChecked();
if ( aSaveOpt.IsWarnAlienFormat() != bChecked )
aSaveOpt.SetWarnAlienFormat( bChecked );
+ m_pKeepCurrentBtn.clear();
+ m_pUseDefaultFormatBtn.clear();
+ m_pWarningOnBox.clear();
+ MessageDialog::dispose();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/backingcomp.cxx b/sfx2/source/dialog/backingcomp.cxx
index e8f49fb42652..f11d9ffac79d 100644
--- a/sfx2/source/dialog/backingcomp.cxx
+++ b/sfx2/source/dialog/backingcomp.cxx
@@ -403,8 +403,8 @@ void SAL_CALL BackingComp::attachFrame( /*IN*/ const css::uno::Reference< css::f
// initialize the component and its parent window
css::uno::Reference< css::awt::XWindow > xParentWindow = xFrame->getContainerWindow();
- WorkWindow* pParent = static_cast<WorkWindow*>(VCLUnoHelper::GetWindow(xParentWindow));
- vcl::Window* pWindow = VCLUnoHelper::GetWindow(m_xWindow);
+ VclPtr< WorkWindow > pParent = static_cast<WorkWindow*>(VCLUnoHelper::GetWindow(xParentWindow).get());
+ VclPtr< vcl::Window > pWindow = VCLUnoHelper::GetWindow(m_xWindow);
// disable full screen mode of the frame!
if (pParent && pParent->IsFullScreenMode())
@@ -431,7 +431,7 @@ void SAL_CALL BackingComp::attachFrame( /*IN*/ const css::uno::Reference< css::f
}
// inform BackingWindow about frame
- BackingWindow* pBack = dynamic_cast<BackingWindow*>(pWindow );
+ BackingWindow* pBack = dynamic_cast<BackingWindow*>(pWindow.get());
if( pBack )
pBack->setOwningFrame( m_xFrame );
@@ -719,8 +719,8 @@ void SAL_CALL BackingComp::initialize( /*IN*/ const css::uno::Sequence< css::uno
// create the component window
vcl::Window* pParent = VCLUnoHelper::GetWindow(xParentWindow);
- vcl::Window* pWindow = new BackingWindow(pParent);
- m_xWindow = VCLUnoHelper::GetInterface(pWindow);
+ VclPtr<vcl::Window> pWindow = VclPtr<BackingWindow>::Create(pParent);
+ m_xWindow = VCLUnoHelper::GetInterface(pWindow);
if (!m_xWindow.is())
throw css::uno::RuntimeException(
@@ -800,7 +800,7 @@ void SAL_CALL BackingComp::dispatch( const css::util::URL& aURL, const css::uno:
// Recalculate minimum width
css::uno::Reference< css::awt::XWindow > xParentWindow = m_xFrame->getContainerWindow();
- WorkWindow* pParent = static_cast<WorkWindow*>(VCLUnoHelper::GetWindow(xParentWindow));
+ VclPtr< WorkWindow > pParent = static_cast<WorkWindow*>(VCLUnoHelper::GetWindow(xParentWindow).get());
if( pParent )
{
pParent->SetMinOutputSizePixel( Size(
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index ad9f98f769c2..103391877907 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -195,11 +195,15 @@ BackingWindow::BackingWindow( vcl::Window* i_pParent ) :
BackingWindow::~BackingWindow()
{
+ disposeOnce();
+}
+
+void BackingWindow::dispose()
+{
// deregister drag&drop helper
if (mxDropTargetListener.is())
{
- for (std::vector<vcl::Window*>::iterator aI = maDndWindows.begin(),
- aEnd = maDndWindows.end(); aI != aEnd; ++aI)
+ for (auto aI = maDndWindows.begin(), aEnd = maDndWindows.end(); aI != aEnd; ++aI)
{
vcl::Window *pDndWin = *aI;
css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget =
@@ -212,6 +216,29 @@ BackingWindow::~BackingWindow()
}
mxDropTargetListener = css::uno::Reference< css::datatransfer::dnd::XDropTargetListener >();
}
+ disposeBuilder();
+ mpOpenButton.clear();
+ mpRecentButton.clear();
+ mpTemplateButton.clear();
+ mpCreateLabel.clear();
+ mpWriterAllButton.clear();
+ mpCalcAllButton.clear();
+ mpImpressAllButton.clear();
+ mpDrawAllButton.clear();
+ mpDBAllButton.clear();
+ mpMathAllButton.clear();
+ mpHelpButton.clear();
+ mpExtensionsButton.clear();
+ mpAllButtonsBox.clear();
+ mpButtonsBox.clear();
+ mpSmallButtonsBox.clear();
+ mpThinBox1.clear();
+ mpThinBox2.clear();
+ mpHelpBox.clear();
+ mpExtensionsBox.clear();
+ mpAllRecentThumbnails.clear();
+ mpLocalView.clear();
+ vcl::Window::dispose();
}
void BackingWindow::initControls()
@@ -368,15 +395,15 @@ void BackingWindow::Paint( const Rectangle& )
DrawWallpaper( Rectangle( Point( 0, 0 ), GetOutputSizePixel() ), aBack );
Pop();
- VirtualDevice aDev( *this );
- aDev.EnableRTL( IsRTLEnabled() );
- aDev.SetOutputSizePixel( maStartCentButtons.GetSize() );
+ ScopedVclPtrInstance< VirtualDevice > pVDev( *this );
+ pVDev->EnableRTL( IsRTLEnabled() );
+ pVDev->SetOutputSizePixel( maStartCentButtons.GetSize() );
Point aOffset( Point( 0, 0 ) - maStartCentButtons.TopLeft());
- aDev.DrawWallpaper( Rectangle( aOffset, GetOutputSizePixel() ), aBack );
+ pVDev->DrawWallpaper( Rectangle( aOffset, GetOutputSizePixel() ), aBack );
DrawOutDev( maStartCentButtons.TopLeft(), maStartCentButtons.GetSize(),
Point( 0, 0 ), maStartCentButtons.GetSize(),
- aDev );
+ *pVDev.get() );
}
bool BackingWindow::PreNotify( NotifyEvent& rNEvt )
@@ -462,8 +489,7 @@ void BackingWindow::setOwningFrame( const com::sun::star::uno::Reference< com::s
// establish drag&drop mode
mxDropTargetListener.set(new OpenFileDropTargetListener(mxContext, mxFrame));
- for (std::vector<vcl::Window*>::iterator aI = maDndWindows.begin(),
- aEnd = maDndWindows.end(); aI != aEnd; ++aI)
+ for (auto aI = maDndWindows.begin(), aEnd = maDndWindows.end(); aI != aEnd; ++aI)
{
vcl::Window *pDndWin = *aI;
css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget =
diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx
index aa6e498a281d..a9a07f662e45 100644
--- a/sfx2/source/dialog/backingwindow.hxx
+++ b/sfx2/source/dialog/backingwindow.hxx
@@ -61,35 +61,35 @@ class BackingWindow
/** helper for drag&drop. */
com::sun::star::uno::Reference< com::sun::star::datatransfer::dnd::XDropTargetListener > mxDropTargetListener;
- PushButton* mpOpenButton;
- PushButton* mpRecentButton;
- MenuButton* mpTemplateButton;
+ VclPtr<PushButton> mpOpenButton;
+ VclPtr<PushButton> mpRecentButton;
+ VclPtr<MenuButton> mpTemplateButton;
- FixedText* mpCreateLabel;
+ VclPtr<FixedText> mpCreateLabel;
- PushButton* mpWriterAllButton;
- PushButton* mpCalcAllButton;
- PushButton* mpImpressAllButton;
- PushButton* mpDrawAllButton;
- PushButton* mpDBAllButton;
- PushButton* mpMathAllButton;
+ VclPtr<PushButton> mpWriterAllButton;
+ VclPtr<PushButton> mpCalcAllButton;
+ VclPtr<PushButton> mpImpressAllButton;
+ VclPtr<PushButton> mpDrawAllButton;
+ VclPtr<PushButton> mpDBAllButton;
+ VclPtr<PushButton> mpMathAllButton;
- PushButton* mpHelpButton;
- PushButton* mpExtensionsButton;
+ VclPtr<PushButton> mpHelpButton;
+ VclPtr<PushButton> mpExtensionsButton;
- VclBox* mpAllButtonsBox;
- VclBox* mpButtonsBox;
- VclBox* mpSmallButtonsBox;
- VclBox* mpThinBox1;
- VclBox* mpThinBox2;
- VclBox* mpHelpBox;
- VclBox* mpExtensionsBox;
+ VclPtr<VclBox> mpAllButtonsBox;
+ VclPtr<VclBox> mpButtonsBox;
+ VclPtr<VclBox> mpSmallButtonsBox;
+ VclPtr<VclBox> mpThinBox1;
+ VclPtr<VclBox> mpThinBox2;
+ VclPtr<VclBox> mpHelpBox;
+ VclPtr<VclBox> mpExtensionsBox;
- RecentDocsView* mpAllRecentThumbnails;
- TemplateDefaultView* mpLocalView;
- bool mbLocalViewInitialized;
+ VclPtr<RecentDocsView> mpAllRecentThumbnails;
+ VclPtr<TemplateDefaultView> mpLocalView;
+ bool mbLocalViewInitialized;
- std::vector<vcl::Window*> maDndWindows;
+ std::vector<VclPtr<vcl::Window> > maDndWindows;
Rectangle maStartCentButtons;
@@ -125,6 +125,7 @@ class BackingWindow
public:
BackingWindow( vcl::Window* pParent );
virtual ~BackingWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE;
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index 566227863f72..285e618b398f 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -45,6 +45,12 @@ using namespace ::com::sun::star::uno;
#define USERITEM_NAME OUString("UserItem")
+SingleTabDlgImpl::SingleTabDlgImpl()
+ : m_pSfxPage(NULL)
+ , m_pLine(NULL)
+ {
+ }
+
class SfxModelessDialog_Impl : public SfxListener
{
public:
@@ -163,15 +169,15 @@ SfxModalDialog::SfxModalDialog(vcl::Window *pParent, const OUString& rID, const
}
SfxModalDialog::~SfxModalDialog()
+{
+ disposeOnce();
+}
-/* [Description]
-
- Destructor; writes the Dialog position in the ini-file.
-*/
-
+void SfxModalDialog::dispose()
{
SetDialogData_Impl();
delete pOutputSet;
+ ModalDialog::dispose();
}
void SfxModalDialog::CreateOutputItemSet( SfxItemPool& rPool )
@@ -355,16 +361,16 @@ bool SfxModelessDialog::Notify( NotifyEvent& rEvt )
SfxModelessDialog::~SfxModelessDialog()
+{
+ disposeOnce();
+}
-/* [Description]
-
- Destructor
-*/
-
+void SfxModelessDialog::dispose()
{
if ( pImp->pMgr->GetFrame().is() && pImp->pMgr->GetFrame() == pBindings->GetActiveFrame() )
pBindings->SetActiveFrame( NULL );
delete pImp;
+ ModelessDialog::dispose();
}
@@ -505,20 +511,19 @@ bool SfxFloatingWindow::Close()
SfxFloatingWindow::~SfxFloatingWindow()
+{
+ disposeOnce();
+}
-/* [Description]
-
- Destructor
-*/
-
+void SfxFloatingWindow::dispose()
{
- if ( pImp->pMgr->GetFrame() == pBindings->GetActiveFrame() )
+ if ( pImp && pImp->pMgr->GetFrame() == pBindings->GetActiveFrame() )
pBindings->SetActiveFrame( NULL );
delete pImp;
+ pImp = NULL;
+ FloatingWindow::dispose();
}
-
-
void SfxFloatingWindow::Resize()
/* [Description]
@@ -702,9 +707,18 @@ SfxSingleTabDialog::SfxSingleTabDialog(vcl::Window* pParent, const SfxItemSet* p
SfxSingleTabDialog::~SfxSingleTabDialog()
{
- delete pImpl->m_pSfxPage;
- delete pImpl->m_pLine;
+ disposeOnce();
+}
+
+void SfxSingleTabDialog::dispose()
+{
+ pImpl->m_pSfxPage.disposeAndClear();
+ pImpl->m_pLine.disposeAndClear();
delete pImpl;
+ pOKBtn.clear();
+ pCancelBtn.clear();
+ pHelpBtn.clear();
+ SfxModalDialog::dispose();
}
void SfxSingleTabDialog::SetTabPage(SfxTabPage* pTabPage,
@@ -718,7 +732,7 @@ void SfxSingleTabDialog::SetTabPage(SfxTabPage* pTabPage,
{
SetUniqId(nSettingsId);
- delete pImpl->m_pSfxPage;
+ pImpl->m_pSfxPage.disposeAndClear();
pImpl->m_pSfxPage = pTabPage;
fnGetRanges = pRangesFunc;
diff --git a/sfx2/source/dialog/checkin.cxx b/sfx2/source/dialog/checkin.cxx
index 61d963ef8a5e..e628476df652 100644
--- a/sfx2/source/dialog/checkin.cxx
+++ b/sfx2/source/dialog/checkin.cxx
@@ -20,6 +20,19 @@ SfxCheckinDialog::SfxCheckinDialog( vcl::Window* pParent ) :
m_pOKBtn->SetClickHdl( LINK( this, SfxCheckinDialog, OKHdl ) );
}
+SfxCheckinDialog::~SfxCheckinDialog()
+{
+ disposeOnce();
+}
+
+void SfxCheckinDialog::dispose()
+{
+ m_pCommentED.clear();
+ m_pMajorCB.clear();
+ m_pOKBtn.clear();
+ ModalDialog::dispose();
+}
+
OUString SfxCheckinDialog::GetComment( )
{
return m_pCommentED->GetText( );
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 5627c40bfc9a..55261037a376 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -626,11 +626,24 @@ SfxDocumentDescPage::SfxDocumentDescPage( vcl::Window * pParent, const SfxItemSe
m_pCommentEd->set_height_request(m_pCommentEd->GetTextHeight() * 16);
}
-SfxTabPage *SfxDocumentDescPage::Create(vcl::Window *pParent, const SfxItemSet *rItemSet)
+SfxDocumentDescPage::~SfxDocumentDescPage()
{
- return new SfxDocumentDescPage(pParent, *rItemSet);
+ disposeOnce();
}
+void SfxDocumentDescPage::dispose()
+{
+ m_pTitleEd.clear();
+ m_pThemaEd.clear();
+ m_pKeywordsEd.clear();
+ m_pCommentEd.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> SfxDocumentDescPage::Create(vcl::Window *pParent, const SfxItemSet *rItemSet)
+{
+ return VclPtr<SfxDocumentDescPage>::Create(pParent, *rItemSet);
+}
bool SfxDocumentDescPage::FillItemSet(SfxItemSet *rSet)
{
@@ -789,6 +802,32 @@ SfxDocumentPage::SfxDocumentPage(vcl::Window* pParent, const SfxItemSet& rItemSe
m_pSignatureBtn->Disable();
}
+SfxDocumentPage::~SfxDocumentPage()
+{
+ disposeOnce();
+}
+
+void SfxDocumentPage::dispose()
+{
+ m_pBmp.clear();
+ m_pNameED.clear();
+ m_pChangePassBtn.clear();
+ m_pShowTypeFT.clear();
+ m_pFileValEd.clear();
+ m_pShowSizeFT.clear();
+ m_pCreateValFt.clear();
+ m_pChangeValFt.clear();
+ m_pSignedValFt.clear();
+ m_pSignatureBtn.clear();
+ m_pPrintValFt.clear();
+ m_pTimeLogValFt.clear();
+ m_pDocNoValFt.clear();
+ m_pUseUserDataCB.clear();
+ m_pDeleteBtn.clear();
+ m_pTemplFt.clear();
+ m_pTemplValFt.clear();
+ SfxTabPage::dispose();
+}
IMPL_LINK_NOARG(SfxDocumentPage, DeleteHdl)
@@ -901,11 +940,9 @@ void SfxDocumentPage::ImplCheckPasswordState()
m_pChangePassBtn->Disable();
}
-
-
-SfxTabPage* SfxDocumentPage::Create( vcl::Window* pParent, const SfxItemSet* rItemSet )
+VclPtr<SfxTabPage> SfxDocumentPage::Create( vcl::Window* pParent, const SfxItemSet* rItemSet )
{
- return new SfxDocumentPage( pParent, *rItemSet );
+ return VclPtr<SfxDocumentPage>::Create( pParent, *rItemSet );
}
void SfxDocumentPage::EnableUseUserData()
@@ -1182,33 +1219,47 @@ void SfxDocumentInfoDialog::AddFontTabPage()
CustomPropertiesYesNoButton::CustomPropertiesYesNoButton( vcl::Window* pParent, const ResId& rResId ) :
Control( pParent, rResId ),
- m_aYesButton( this, ResId( RB_PROPERTY_YES, *rResId.GetResMgr() ) ),
- m_aNoButton ( this, ResId( RB_PROPERTY_NO, *rResId.GetResMgr() ) )
+ m_aYesButton( VclPtr<RadioButton>::Create(this, ResId( RB_PROPERTY_YES, *rResId.GetResMgr() )) ),
+ m_aNoButton ( VclPtr<RadioButton>::Create(this, ResId( RB_PROPERTY_NO, *rResId.GetResMgr() )) )
{
FreeResource();
Wallpaper aWall( Color( COL_TRANSPARENT ) );
SetBackground( aWall );
SetBorderStyle( WindowBorderStyle::MONO );
CheckNo();
- m_aYesButton.SetBackground( aWall );
- m_aNoButton.SetBackground( aWall );
+ m_aYesButton->SetBackground( aWall );
+ m_aNoButton->SetBackground( aWall );
+}
+
+
+CustomPropertiesYesNoButton::~CustomPropertiesYesNoButton()
+{
+ disposeOnce();
+}
+
+void CustomPropertiesYesNoButton::dispose()
+{
+ m_aYesButton.disposeAndClear();
+ m_aNoButton.disposeAndClear();
+ Control::dispose();
}
class DurationDialog_Impl : public ModalDialog
{
- CheckBox* m_pNegativeCB;
- NumericField* m_pYearNF;
- NumericField* m_pMonthNF;
- NumericField* m_pDayNF;
- NumericField* m_pHourNF;
- NumericField* m_pMinuteNF;
- NumericField* m_pSecondNF;
- NumericField* m_pMSecondNF;
+ VclPtr<CheckBox> m_pNegativeCB;
+ VclPtr<NumericField> m_pYearNF;
+ VclPtr<NumericField> m_pMonthNF;
+ VclPtr<NumericField> m_pDayNF;
+ VclPtr<NumericField> m_pHourNF;
+ VclPtr<NumericField> m_pMinuteNF;
+ VclPtr<NumericField> m_pSecondNF;
+ VclPtr<NumericField> m_pMSecondNF;
public:
DurationDialog_Impl( vcl::Window* pParent, const util::Duration& rDuration );
-
+ virtual ~DurationDialog_Impl();
+ virtual void dispose() SAL_OVERRIDE;
util::Duration GetDuration() const;
};
@@ -1236,6 +1287,24 @@ DurationDialog_Impl::DurationDialog_Impl(vcl::Window* pParent,
m_pMSecondNF->SetValue(rDuration.NanoSeconds);
}
+DurationDialog_Impl::~DurationDialog_Impl()
+{
+ disposeOnce();
+}
+
+void DurationDialog_Impl::dispose()
+{
+ m_pNegativeCB.clear();
+ m_pYearNF.clear();
+ m_pMonthNF.clear();
+ m_pDayNF.clear();
+ m_pHourNF.clear();
+ m_pMinuteNF.clear();
+ m_pSecondNF.clear();
+ m_pMSecondNF.clear();
+ ModalDialog::dispose();
+}
+
util::Duration DurationDialog_Impl::GetDuration() const
{
util::Duration aRet;
@@ -1259,10 +1328,6 @@ CustomPropertiesDurationField::CustomPropertiesDurationField(vcl::Window* pParen
SetDuration( util::Duration(false, 0, 0, 0, 0, 0, 0, 0) );
}
-CustomPropertiesDurationField::~CustomPropertiesDurationField()
-{
-}
-
void CustomPropertiesDurationField::RequestHelp( const HelpEvent& rHEvt )
{
if ( rHEvt.GetMode() & HelpEventMode::QUICK )
@@ -1299,15 +1364,11 @@ CustomPropertiesEditButton::CustomPropertiesEditButton(vcl::Window* pParent, Win
SetClickHdl( LINK( this, CustomPropertiesEditButton, ClickHdl ));
}
-CustomPropertiesEditButton::~CustomPropertiesEditButton()
-{
-}
-
IMPL_LINK_NOARG(CustomPropertiesEditButton, ClickHdl)
{
- boost::scoped_ptr<DurationDialog_Impl> pDurationDlg(new DurationDialog_Impl( this, m_pLine->m_aDurationField.GetDuration() ));
+ VclPtrInstance< DurationDialog_Impl > pDurationDlg( this, m_pLine->m_aDurationField->GetDuration() );
if ( RET_OK == pDurationDlg->Execute() )
- m_pLine->m_aDurationField.SetDuration( pDurationDlg->GetDuration() );
+ m_pLine->m_aDurationField->SetDuration( pDurationDlg->GetDuration() );
return 1;
}
@@ -1316,54 +1377,54 @@ void CustomPropertiesYesNoButton::Resize()
const long nWidth = GetSizePixel().Width();
const long n3Width = LogicToPixel( Size( 3, 3 ), MAP_APPFONT ).Width();
const long nNewWidth = ( nWidth / 2 ) - n3Width - 2;
- Size aSize = m_aYesButton.GetSizePixel();
+ Size aSize = m_aYesButton->GetSizePixel();
const long nDelta = aSize.Width() - nNewWidth;
aSize.Width() = nNewWidth;
- m_aYesButton.SetSizePixel( aSize );
- Point aPos = m_aNoButton.GetPosPixel();
+ m_aYesButton->SetSizePixel( aSize );
+ Point aPos = m_aNoButton->GetPosPixel();
aPos.X() -= nDelta;
- m_aNoButton.SetPosSizePixel( aPos, aSize );
+ m_aNoButton->SetPosSizePixel( aPos, aSize );
}
// struct CustomPropertyLine ---------------------------------------------
CustomPropertyLine::CustomPropertyLine( vcl::Window* pParent ) :
- m_aNameBox ( pParent, SfxResId( SFX_CB_PROPERTY_NAME ) ),
- m_aTypeBox ( pParent, SfxResId( SFX_LB_PROPERTY_TYPE ), this ),
- m_aValueEdit ( pParent, WB_BORDER|WB_TABSTOP|WB_LEFT, this ),
- m_aDateField ( pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT, this ),
- m_aTimeField ( pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT, this ),
+ m_aNameBox ( VclPtr<ComboBox>::Create(pParent, SfxResId( SFX_CB_PROPERTY_NAME )) ),
+ m_aTypeBox ( VclPtr<CustomPropertiesTypeBox>::Create(pParent, SfxResId( SFX_LB_PROPERTY_TYPE ), this) ),
+ m_aValueEdit ( VclPtr<CustomPropertiesEdit>::Create(pParent, WB_BORDER|WB_TABSTOP|WB_LEFT, this ) ),
+ m_aDateField ( VclPtr<CustomPropertiesDateField>::Create(pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT, this ) ),
+ m_aTimeField ( VclPtr<CustomPropertiesTimeField>::Create(pParent, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT, this ) ),
m_sDurationFormat( SfxResId( SFX_ST_DURATION_FORMAT ).toString() ),
- m_aDurationField( pParent, WB_BORDER|WB_TABSTOP|WB_READONLY, this ),
- m_aEditButton ( pParent, WB_TABSTOP, this ),
- m_aYesNoButton ( pParent, SfxResId( SFX_WIN_PROPERTY_YESNO ) ),
- m_aRemoveButton ( pParent, 0, this ),
+ m_aDurationField( VclPtr<CustomPropertiesDurationField>::Create(pParent, WB_BORDER|WB_TABSTOP|WB_READONLY, this ) ),
+ m_aEditButton ( VclPtr<CustomPropertiesEditButton>::Create(pParent, WB_TABSTOP, this) ),
+ m_aYesNoButton ( VclPtr<CustomPropertiesYesNoButton>::Create(pParent, SfxResId( SFX_WIN_PROPERTY_YESNO )) ),
+ m_aRemoveButton ( VclPtr<CustomPropertiesRemoveButton>::Create(pParent, 0, this) ),
m_bIsDate ( false ),
m_bIsRemoved ( false ),
m_bTypeLostFocus( false )
{
- m_aTimeField.SetExtFormat( EXTTIMEF_24H_LONG );
- m_aDateField.SetExtDateFormat( XTDATEF_SYSTEM_SHORT_YYYY );
+ m_aTimeField->SetExtFormat( EXTTIMEF_24H_LONG );
+ m_aDateField->SetExtDateFormat( XTDATEF_SYSTEM_SHORT_YYYY );
- m_aRemoveButton.SetModeImage(Image(SfxResId(SFX_IMG_PROPERTY_REMOVE)));
- m_aRemoveButton.SetQuickHelpText(SfxResId(STR_SFX_REMOVE_PROPERTY).toString());
+ m_aRemoveButton->SetModeImage(Image(SfxResId(SFX_IMG_PROPERTY_REMOVE)));
+ m_aRemoveButton->SetQuickHelpText(SfxResId(STR_SFX_REMOVE_PROPERTY).toString());
- m_aEditButton.SetText(SfxResId(SFX_ST_EDIT).toString());
+ m_aEditButton->SetText(SfxResId(SFX_ST_EDIT).toString());
}
void CustomPropertyLine::SetRemoved()
{
DBG_ASSERT( !m_bIsRemoved, "CustomPropertyLine::SetRemoved(): line already removed" );
m_bIsRemoved = true;
- m_aNameBox.Hide();
- m_aTypeBox.Hide();
- m_aValueEdit.Hide();
- m_aDateField.Hide();
- m_aTimeField.Hide();
- m_aDurationField.Hide();
- m_aEditButton.Hide();
- m_aYesNoButton.Hide();
- m_aRemoveButton.Hide();
+ m_aNameBox->Hide();
+ m_aTypeBox->Hide();
+ m_aValueEdit->Hide();
+ m_aDateField->Hide();
+ m_aTimeField->Hide();
+ m_aDurationField->Hide();
+ m_aEditButton->Hide();
+ m_aYesNoButton->Hide();
+ m_aRemoveButton->Hide();
}
CustomPropertiesWindow::CustomPropertiesWindow(vcl::Window* pParent,
@@ -1374,27 +1435,27 @@ CustomPropertiesWindow::CustomPropertiesWindow(vcl::Window* pParent,
m_pHeaderAccName(pHeaderAccName),
m_pHeaderAccType(pHeaderAccType),
m_pHeaderAccValue(pHeaderAccValue),
- m_aNameBox ( this, SfxResId( SFX_CB_PROPERTY_NAME ) ),
- m_aTypeBox ( this, SfxResId( SFX_LB_PROPERTY_TYPE ) ),
- m_aValueEdit ( this, WB_BORDER|WB_TABSTOP|WB_LEFT ),
- m_aDateField ( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ),
- m_aTimeField ( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ),
- m_aDurationField( this, WB_BORDER|WB_TABSTOP|WB_READONLY ),
- m_aEditButton( this, WB_TABSTOP ),
- m_aYesNoButton ( this, SfxResId( SFX_WIN_PROPERTY_YESNO ) ),
- m_aRemoveButton ( this, 0 ),
+ m_aNameBox ( VclPtr<ComboBox>::Create( this, SfxResId( SFX_CB_PROPERTY_NAME ) ) ),
+ m_aTypeBox ( VclPtr<ListBox>::Create( this, SfxResId( SFX_LB_PROPERTY_TYPE ) ) ),
+ m_aValueEdit ( VclPtr<Edit>::Create( this, WB_BORDER|WB_TABSTOP|WB_LEFT ) ),
+ m_aDateField ( VclPtr<DateField>::Create( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ) ),
+ m_aTimeField ( VclPtr<TimeField>::Create( this, WB_BORDER|WB_TABSTOP|WB_SPIN|WB_LEFT ) ),
+ m_aDurationField( VclPtr<Edit>::Create( this, WB_BORDER|WB_TABSTOP|WB_READONLY ) ),
+ m_aEditButton ( VclPtr<PushButton>::Create( this, WB_TABSTOP ) ),
+ m_aYesNoButton ( VclPtr<CustomPropertiesYesNoButton>::Create( this, SfxResId( SFX_WIN_PROPERTY_YESNO )) ),
+ m_aRemoveButton ( VclPtr<ImageButton>::Create( this, 0 ) ),
m_nScrollPos (0),
m_pCurrentLine (NULL),
m_aNumberFormatter( ::comphelper::getProcessComponentContext(),
Application::GetSettings().GetLanguageTag().getLanguageType() )
{
- m_aEditButton.SetPosSizePixel(
+ m_aEditButton->SetPosSizePixel(
LogicToPixel(Point(159, 2), MAP_APPFONT),
LogicToPixel(Size(RSC_CD_TEXTBOX_HEIGHT, RSC_CD_TEXTBOX_HEIGHT), MAP_APPFONT));
- m_aRemoveButton.SetSizePixel(LogicToPixel(Size(RSC_CD_PUSHBUTTON_HEIGHT, RSC_CD_PUSHBUTTON_HEIGHT), MAP_APPFONT));
+ m_aRemoveButton->SetSizePixel(LogicToPixel(Size(RSC_CD_PUSHBUTTON_HEIGHT, RSC_CD_PUSHBUTTON_HEIGHT), MAP_APPFONT));
- m_aValueEdit.SetPosSizePixel(
+ m_aValueEdit->SetPosSizePixel(
LogicToPixel(Point(159, 2), MAP_APPFONT),
LogicToPixel(Size(61, RSC_CD_TEXTBOX_HEIGHT), MAP_APPFONT));
@@ -1403,57 +1464,75 @@ CustomPropertiesWindow::CustomPropertiesWindow(vcl::Window* pParent,
m_aBoxLoseFocusIdle.SetPriority( SchedulerPriority::LOWEST );
m_aBoxLoseFocusIdle.SetIdleHdl( LINK( this, CustomPropertiesWindow, BoxTimeoutHdl ) );
- m_aNameBox.add_mnemonic_label(m_pHeaderAccName);
- m_aNameBox.SetAccessibleName(m_pHeaderAccName->GetText());
- m_aTypeBox.add_mnemonic_label(m_pHeaderAccType);
- m_aTypeBox.SetAccessibleName(m_pHeaderAccType->GetText());
- m_aValueEdit.add_mnemonic_label(m_pHeaderAccValue);
- m_aValueEdit.SetAccessibleName(m_pHeaderAccValue->GetText());
-
- m_aNameBox.Hide();
- m_aTypeBox.Hide();
- m_aValueEdit.Hide();
- m_aDateField.Hide();
- m_aTimeField.Hide();
- m_aDurationField.Hide();
- m_aEditButton.Hide();
- m_aYesNoButton.Hide();
- m_aRemoveButton.Hide();
+ m_aNameBox->add_mnemonic_label(m_pHeaderAccName);
+ m_aNameBox->SetAccessibleName(m_pHeaderAccName->GetText());
+ m_aTypeBox->add_mnemonic_label(m_pHeaderAccType);
+ m_aTypeBox->SetAccessibleName(m_pHeaderAccType->GetText());
+ m_aValueEdit->add_mnemonic_label(m_pHeaderAccValue);
+ m_aValueEdit->SetAccessibleName(m_pHeaderAccValue->GetText());
+
+ m_aNameBox->Hide();
+ m_aTypeBox->Hide();
+ m_aValueEdit->Hide();
+ m_aDateField->Hide();
+ m_aTimeField->Hide();
+ m_aDurationField->Hide();
+ m_aEditButton->Hide();
+ m_aYesNoButton->Hide();
+ m_aRemoveButton->Hide();
m_nLineHeight =
- ( m_aRemoveButton.GetPosPixel().Y() * 2 ) + m_aRemoveButton.GetSizePixel().Height();
+ ( m_aRemoveButton->GetPosPixel().Y() * 2 ) + m_aRemoveButton->GetSizePixel().Height();
}
CustomPropertiesWindow::~CustomPropertiesWindow()
{
+ disposeOnce();
+}
+
+void CustomPropertiesWindow::dispose()
+{
m_aEditLoseFocusIdle.Stop();
m_aBoxLoseFocusIdle.Stop();
ClearAllLines();
+ m_aNameBox.disposeAndClear();
+ m_aTypeBox.disposeAndClear();
+ m_aValueEdit.disposeAndClear();
+ m_aDateField.disposeAndClear();
+ m_aTimeField.disposeAndClear();
+ m_aDurationField.disposeAndClear();
+ m_aEditButton.disposeAndClear();
+ m_aYesNoButton.disposeAndClear();
+ m_aRemoveButton.disposeAndClear();
+ m_pHeaderAccName.clear();
+ m_pHeaderAccType.clear();
+ m_pHeaderAccValue.clear();
+ vcl::Window::dispose();
}
IMPL_LINK( CustomPropertiesWindow, TypeHdl, CustomPropertiesTypeBox*, pBox )
{
long nType = reinterpret_cast<long>( pBox->GetSelectEntryData() );
CustomPropertyLine* pLine = pBox->GetLine();
- pLine->m_aValueEdit.Show( (CUSTOM_TYPE_TEXT == nType) || (CUSTOM_TYPE_NUMBER == nType) );
- pLine->m_aDateField.Show( (CUSTOM_TYPE_DATE == nType) || (CUSTOM_TYPE_DATETIME == nType) );
- pLine->m_aTimeField.Show( CUSTOM_TYPE_DATETIME == nType );
- pLine->m_aDurationField.Show( CUSTOM_TYPE_DURATION == nType );
- pLine->m_aEditButton.Show( CUSTOM_TYPE_DURATION == nType );
- pLine->m_aYesNoButton.Show( CUSTOM_TYPE_BOOLEAN == nType );
+ pLine->m_aValueEdit->Show( (CUSTOM_TYPE_TEXT == nType) || (CUSTOM_TYPE_NUMBER == nType) );
+ pLine->m_aDateField->Show( (CUSTOM_TYPE_DATE == nType) || (CUSTOM_TYPE_DATETIME == nType) );
+ pLine->m_aTimeField->Show( CUSTOM_TYPE_DATETIME == nType );
+ pLine->m_aDurationField->Show( CUSTOM_TYPE_DURATION == nType );
+ pLine->m_aEditButton->Show( CUSTOM_TYPE_DURATION == nType );
+ pLine->m_aYesNoButton->Show( CUSTOM_TYPE_BOOLEAN == nType );
//adjust positions of date and time controls
if ( nType == CUSTOM_TYPE_DATE )
{
pLine->m_bIsDate = true;
- pLine->m_aDateField.SetSizePixel( pLine->m_aValueEdit.GetSizePixel() );
+ pLine->m_aDateField->SetSizePixel( pLine->m_aValueEdit->GetSizePixel() );
}
else if ( nType == CUSTOM_TYPE_DATETIME)
{
// because m_aDateField and m_aTimeField have the same size for type "DateTime",
// we just rely on m_aTimeField here.
pLine->m_bIsDate = false;
- pLine->m_aDateField.SetSizePixel( pLine->m_aTimeField.GetSizePixel() );
+ pLine->m_aDateField->SetSizePixel( pLine->m_aTimeField->GetSizePixel() );
}
return 0;
@@ -1476,10 +1555,10 @@ IMPL_LINK( CustomPropertiesWindow, RemoveHdl, CustomPropertiesRemoveButton*, pBu
if ( pLine->m_bIsRemoved )
continue;
- vcl::Window* pWindows[] = { &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit,
- &pLine->m_aDateField, &pLine->m_aTimeField,
- &pLine->m_aDurationField, &pLine->m_aEditButton,
- &pLine->m_aYesNoButton, &pLine->m_aRemoveButton, NULL };
+ vcl::Window* pWindows[] = { pLine->m_aNameBox.get(), pLine->m_aTypeBox.get(), pLine->m_aValueEdit.get(),
+ pLine->m_aDateField.get(), pLine->m_aTimeField.get(),
+ pLine->m_aDurationField.get(), pLine->m_aEditButton.get(),
+ pLine->m_aYesNoButton.get(), pLine->m_aRemoveButton.get(), NULL };
vcl::Window** pCurrent = pWindows;
while ( *pCurrent )
{
@@ -1539,8 +1618,8 @@ bool CustomPropertiesWindow::IsLineValid( CustomPropertyLine* pLine ) const
bool bIsValid = true;
pLine->m_bTypeLostFocus = false;
long nType = reinterpret_cast<long>(
- pLine->m_aTypeBox.GetSelectEntryData() );
- OUString sValue = pLine->m_aValueEdit.GetText();
+ pLine->m_aTypeBox->GetSelectEntryData() );
+ OUString sValue = pLine->m_aValueEdit->GetText();
if ( sValue.isEmpty() )
return true;
@@ -1574,9 +1653,9 @@ void CustomPropertiesWindow::ValidateLine( CustomPropertyLine* pLine, bool bIsFr
pLine->m_bTypeLostFocus = true;
vcl::Window* pParent = GetParent()->GetParent();
if (MessageDialog(pParent, SfxResId(STR_SFX_QUERY_WRONG_TYPE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_OK_CANCEL).Execute() == RET_OK)
- pLine->m_aTypeBox.SelectEntryPos( m_aTypeBox.GetEntryPos( reinterpret_cast<void*>(CUSTOM_TYPE_TEXT) ) );
+ pLine->m_aTypeBox->SelectEntryPos( m_aTypeBox->GetEntryPos( reinterpret_cast<void*>(CUSTOM_TYPE_TEXT) ) );
else
- pLine->m_aValueEdit.GrabFocus();
+ pLine->m_aValueEdit->GrabFocus();
}
}
@@ -1589,8 +1668,8 @@ bool CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBa
const long nOffset = 4;
const long nScrollBarWidth = pScrollBar->GetSizePixel().Width();
- const long nButtonWidth = m_aRemoveButton.GetSizePixel().Width() + nScrollBarWidth + nOffset;
- long nTypeWidth = m_aTypeBox.CalcMinimumSize().Width() + ( 2 * nOffset );
+ const long nButtonWidth = m_aRemoveButton->GetSizePixel().Width() + nScrollBarWidth + nOffset;
+ long nTypeWidth = m_aTypeBox->CalcMinimumSize().Width() + ( 2 * nOffset );
long nFullWidth = pHeaderBar->GetSizePixel().Width();
long nItemWidth = ( nFullWidth - nTypeWidth - nButtonWidth ) / 2;
pHeaderBar->SetItemSize( HI_NAME, nItemWidth );
@@ -1598,7 +1677,7 @@ bool CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBa
pHeaderBar->SetItemSize( HI_VALUE, nItemWidth );
pHeaderBar->SetItemSize( HI_ACTION, nButtonWidth );
- vcl::Window* pWindows[] = { &m_aNameBox, &m_aTypeBox, &m_aValueEdit, &m_aRemoveButton, NULL };
+ vcl::Window* pWindows[] = { m_aNameBox.get(), m_aTypeBox.get(), m_aValueEdit.get(), m_aRemoveButton.get(), NULL };
vcl::Window** pCurrent = pWindows;
sal_uInt16 nPos = 0;
while ( *pCurrent )
@@ -1609,7 +1688,7 @@ bool CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBa
Size aSize(aOrigSize);
Point aPos(aOrigPos);
long nWidth = aRect.GetWidth() - nOffset;
- if ( *pCurrent == &m_aRemoveButton )
+ if ( *pCurrent == m_aRemoveButton.get() )
nWidth -= pScrollBar->GetSizePixel().Width();
aSize.Width() = nWidth;
aPos.X() = aRect.getX() + ( nOffset / 2 );
@@ -1620,23 +1699,23 @@ bool CustomPropertiesWindow::InitControls( HeaderBar* pHeaderBar, const ScrollBa
bChanged = true;
}
- if ( *pCurrent == &m_aValueEdit )
+ if ( *pCurrent == m_aValueEdit.get() )
{
Point aDurationPos( aPos );
- m_aDurationField.SetPosPixel( aDurationPos );
+ m_aDurationField->SetPosPixel( aDurationPos );
Size aDurationSize(aSize);
- aDurationSize.Width() -= (m_aEditButton.GetSizePixel().Width() + 3 );
- m_aDurationField.SetSizePixel(aDurationSize);
- aDurationPos.X() = aPos.X() - m_aEditButton.GetSizePixel().Width() + aSize.Width();
- m_aEditButton.SetPosPixel(aDurationPos);
+ aDurationSize.Width() -= (m_aEditButton->GetSizePixel().Width() + 3 );
+ m_aDurationField->SetSizePixel(aDurationSize);
+ aDurationPos.X() = aPos.X() - m_aEditButton->GetSizePixel().Width() + aSize.Width();
+ m_aEditButton->SetPosPixel(aDurationPos);
- m_aYesNoButton.SetPosSizePixel( aPos, aSize );
+ m_aYesNoButton->SetPosSizePixel( aPos, aSize );
aSize.Width() /= 2;
aSize.Width() -= 2;
- m_aDateField.SetPosSizePixel( aPos, aSize );
+ m_aDateField->SetPosSizePixel( aPos, aSize );
aPos.X() += aSize.Width() + 4;
- m_aTimeField.SetPosSizePixel( aPos, aSize );
+ m_aTimeField->SetPosSizePixel( aPos, aSize );
}
pCurrent++;
@@ -1660,10 +1739,10 @@ sal_uInt16 CustomPropertiesWindow::GetVisibleLineCount() const
void CustomPropertiesWindow::updateLineWidth()
{
- vcl::Window* pWindows[] = { &m_aNameBox, &m_aTypeBox, &m_aValueEdit,
- &m_aDateField, &m_aTimeField,
- &m_aDurationField, &m_aEditButton,
- &m_aYesNoButton, &m_aRemoveButton, NULL };
+ vcl::Window* pWindows[] = { m_aNameBox.get(), m_aTypeBox.get(), m_aValueEdit.get(),
+ m_aDateField.get(), m_aTimeField.get(),
+ m_aDurationField.get(), m_aEditButton.get(),
+ m_aYesNoButton.get(), m_aRemoveButton.get(), NULL };
for (std::vector< CustomPropertyLine* >::iterator aI =
m_aCustomPropertiesLines.begin(), aEnd = m_aCustomPropertiesLines.end();
@@ -1672,10 +1751,10 @@ void CustomPropertiesWindow::updateLineWidth()
CustomPropertyLine* pNewLine = *aI;
vcl::Window* pNewWindows[] =
- { &pNewLine->m_aNameBox, &pNewLine->m_aTypeBox, &pNewLine->m_aValueEdit,
- &pNewLine->m_aDateField, &pNewLine->m_aTimeField,
- &pNewLine->m_aDurationField, &pNewLine->m_aEditButton,
- &pNewLine->m_aYesNoButton, &pNewLine->m_aRemoveButton, NULL };
+ { pNewLine->m_aNameBox.get(), pNewLine->m_aTypeBox.get(), pNewLine->m_aValueEdit.get(),
+ pNewLine->m_aDateField.get(), pNewLine->m_aTimeField.get(),
+ pNewLine->m_aDurationField.get(), pNewLine->m_aEditButton.get(),
+ pNewLine->m_aYesNoButton.get(), pNewLine->m_aRemoveButton.get(), NULL };
vcl::Window** pCurrent = pWindows;
vcl::Window** pNewCurrent = pNewWindows;
@@ -1691,38 +1770,38 @@ void CustomPropertiesWindow::updateLineWidth()
// if we have type "Date", we use the full width, not only the half
if (pNewLine->m_bIsDate)
- pNewLine->m_aDateField.SetSizePixel( pNewLine->m_aValueEdit.GetSizePixel() );
+ pNewLine->m_aDateField->SetSizePixel( pNewLine->m_aValueEdit->GetSizePixel() );
}
}
void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
{
CustomPropertyLine* pNewLine = new CustomPropertyLine( this );
- pNewLine->m_aTypeBox.SetSelectHdl( LINK( this, CustomPropertiesWindow, TypeHdl ) );
- pNewLine->m_aRemoveButton.SetClickHdl( LINK( this, CustomPropertiesWindow, RemoveHdl ) );
- pNewLine->m_aValueEdit.SetLoseFocusHdl( LINK( this, CustomPropertiesWindow, EditLoseFocusHdl ) );
+ pNewLine->m_aTypeBox->SetSelectHdl( LINK( this, CustomPropertiesWindow, TypeHdl ) );
+ pNewLine->m_aRemoveButton->SetClickHdl( LINK( this, CustomPropertiesWindow, RemoveHdl ) );
+ pNewLine->m_aValueEdit->SetLoseFocusHdl( LINK( this, CustomPropertiesWindow, EditLoseFocusHdl ) );
//add lose focus handlers of date/time fields
- pNewLine->m_aTypeBox.SetLoseFocusHdl( LINK( this, CustomPropertiesWindow, BoxLoseFocusHdl ) );
+ pNewLine->m_aTypeBox->SetLoseFocusHdl( LINK( this, CustomPropertiesWindow, BoxLoseFocusHdl ) );
- pNewLine->m_aNameBox.add_mnemonic_label(m_pHeaderAccName);
- pNewLine->m_aNameBox.SetAccessibleName(m_pHeaderAccName->GetText());
- pNewLine->m_aTypeBox.add_mnemonic_label(m_pHeaderAccType);
- pNewLine->m_aTypeBox.SetAccessibleName(m_pHeaderAccType->GetText());
- pNewLine->m_aValueEdit.add_mnemonic_label(m_pHeaderAccValue);
- pNewLine->m_aValueEdit.SetAccessibleName(m_pHeaderAccValue->GetText());
+ pNewLine->m_aNameBox->add_mnemonic_label(m_pHeaderAccName);
+ pNewLine->m_aNameBox->SetAccessibleName(m_pHeaderAccName->GetText());
+ pNewLine->m_aTypeBox->add_mnemonic_label(m_pHeaderAccType);
+ pNewLine->m_aTypeBox->SetAccessibleName(m_pHeaderAccType->GetText());
+ pNewLine->m_aValueEdit->add_mnemonic_label(m_pHeaderAccValue);
+ pNewLine->m_aValueEdit->SetAccessibleName(m_pHeaderAccValue->GetText());
sal_Int32 nPos = GetVisibleLineCount() * GetLineHeight();
m_aCustomPropertiesLines.push_back( pNewLine );
- vcl::Window* pWindows[] = { &m_aNameBox, &m_aTypeBox, &m_aValueEdit,
- &m_aDateField, &m_aTimeField,
- &m_aDurationField, &m_aEditButton,
- &m_aYesNoButton, &m_aRemoveButton, NULL };
+ vcl::Window* pWindows[] = { m_aNameBox.get(), m_aTypeBox.get(), m_aValueEdit.get(),
+ m_aDateField.get(), m_aTimeField.get(),
+ m_aDurationField.get(), m_aEditButton.get(),
+ m_aYesNoButton.get(), m_aRemoveButton.get(), NULL };
vcl::Window* pNewWindows[] =
- { &pNewLine->m_aNameBox, &pNewLine->m_aTypeBox, &pNewLine->m_aValueEdit,
- &pNewLine->m_aDateField, &pNewLine->m_aTimeField,
- &pNewLine->m_aDurationField, &pNewLine->m_aEditButton,
- &pNewLine->m_aYesNoButton, &pNewLine->m_aRemoveButton, NULL };
+ { pNewLine->m_aNameBox.get(), pNewLine->m_aTypeBox.get(), pNewLine->m_aValueEdit.get(),
+ pNewLine->m_aDateField.get(), pNewLine->m_aTimeField.get(),
+ pNewLine->m_aDurationField.get(), pNewLine->m_aEditButton.get(),
+ pNewLine->m_aYesNoButton.get(), pNewLine->m_aRemoveButton.get(), NULL };
vcl::Window** pCurrent = pWindows;
vcl::Window** pNewCurrent = pNewWindows;
while ( *pCurrent )
@@ -1747,7 +1826,7 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
util::Duration aTmpDuration;
SvtSysLocale aSysLocale;
const LocaleDataWrapper& rLocaleWrapper = aSysLocale.GetLocaleData();
- pNewLine->m_aNameBox.SetText( sName );
+ pNewLine->m_aNameBox->SetText( sName );
sal_IntPtr nType = CUSTOM_TYPE_UNKNOWN;
OUString sValue;
@@ -1755,7 +1834,7 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
{
sal_uInt32 nIndex = m_aNumberFormatter.GetFormatIndex( NF_NUMBER_SYSTEM );
m_aNumberFormatter.GetInputLineString( nTmpValue, nIndex, sValue );
- pNewLine->m_aValueEdit.SetText( sValue );
+ pNewLine->m_aValueEdit->SetText( sValue );
nType = CUSTOM_TYPE_NUMBER;
}
else if ( rAny >>= bTmpValue )
@@ -1765,41 +1844,41 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
}
else if ( rAny >>= sTmpValue )
{
- pNewLine->m_aValueEdit.SetText( sTmpValue );
+ pNewLine->m_aValueEdit->SetText( sTmpValue );
nType = CUSTOM_TYPE_TEXT;
}
else if ( rAny >>= aTmpDate )
{
- pNewLine->m_aDateField.SetDate( Date( aTmpDate ) );
+ pNewLine->m_aDateField->SetDate( Date( aTmpDate ) );
nType = CUSTOM_TYPE_DATE;
}
else if ( rAny >>= aTmpDateTime )
{
- pNewLine->m_aDateField.SetDate( Date( aTmpDateTime ) );
- pNewLine->m_aTimeField.SetTime( tools::Time( aTmpDateTime ) );
- pNewLine->m_aTimeField.m_isUTC = aTmpDateTime.IsUTC;
+ pNewLine->m_aDateField->SetDate( Date( aTmpDateTime ) );
+ pNewLine->m_aTimeField->SetTime( tools::Time( aTmpDateTime ) );
+ pNewLine->m_aTimeField->m_isUTC = aTmpDateTime.IsUTC;
nType = CUSTOM_TYPE_DATETIME;
}
else if ( rAny >>= aTmpDateTZ )
{
- pNewLine->m_aDateField.SetDate( Date( aTmpDateTZ.DateInTZ.Day,
+ pNewLine->m_aDateField->SetDate( Date( aTmpDateTZ.DateInTZ.Day,
aTmpDateTZ.DateInTZ.Month, aTmpDateTZ.DateInTZ.Year ) );
- pNewLine->m_aDateField.m_TZ = aTmpDateTZ.Timezone;
+ pNewLine->m_aDateField->m_TZ = aTmpDateTZ.Timezone;
nType = CUSTOM_TYPE_DATE;
}
else if ( rAny >>= aTmpDateTimeTZ )
{
util::DateTime const& rDT(aTmpDateTimeTZ.DateTimeInTZ);
- pNewLine->m_aDateField.SetDate( Date( rDT ) );
- pNewLine->m_aTimeField.SetTime( tools::Time( rDT ) );
- pNewLine->m_aTimeField.m_isUTC = rDT.IsUTC;
- pNewLine->m_aDateField.m_TZ = aTmpDateTimeTZ.Timezone;
+ pNewLine->m_aDateField->SetDate( Date( rDT ) );
+ pNewLine->m_aTimeField->SetTime( tools::Time( rDT ) );
+ pNewLine->m_aTimeField->m_isUTC = rDT.IsUTC;
+ pNewLine->m_aDateField->m_TZ = aTmpDateTimeTZ.Timezone;
nType = CUSTOM_TYPE_DATETIME;
}
else if ( rAny >>= aTmpDuration )
{
nType = CUSTOM_TYPE_DURATION;
- pNewLine->m_aDurationField.SetDuration( aTmpDuration );
+ pNewLine->m_aDurationField->SetDuration( aTmpDuration );
}
if ( nType != CUSTOM_TYPE_UNKNOWN )
@@ -1807,15 +1886,15 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
if ( CUSTOM_TYPE_BOOLEAN == nType )
{
if ( bTmpValue )
- pNewLine->m_aYesNoButton.CheckYes();
+ pNewLine->m_aYesNoButton->CheckYes();
else
- pNewLine->m_aYesNoButton.CheckNo();
+ pNewLine->m_aYesNoButton->CheckNo();
}
- pNewLine->m_aTypeBox.SelectEntryPos( m_aTypeBox.GetEntryPos( reinterpret_cast<void*>(nType) ) );
+ pNewLine->m_aTypeBox->SelectEntryPos( m_aTypeBox->GetEntryPos( reinterpret_cast<void*>(nType) ) );
}
- TypeHdl( &pNewLine->m_aTypeBox );
- pNewLine->m_aNameBox.GrabFocus();
+ TypeHdl( pNewLine->m_aTypeBox.get() );
+ pNewLine->m_aNameBox->GrabFocus();
}
bool CustomPropertiesWindow::AreAllLinesValid() const
@@ -1861,8 +1940,8 @@ void CustomPropertiesWindow::DoScroll( sal_Int32 nNewPos )
if ( pLine->m_bIsRemoved )
continue;
- vcl::Window* pWindows[] = { &pLine->m_aNameBox, &pLine->m_aTypeBox, &pLine->m_aValueEdit, &pLine->m_aDateField, &pLine->m_aTimeField,
- &pLine->m_aDurationField, &pLine->m_aEditButton, &pLine->m_aYesNoButton, &pLine->m_aRemoveButton, NULL };
+ vcl::Window* pWindows[] = { pLine->m_aNameBox.get(), pLine->m_aTypeBox.get(), pLine->m_aValueEdit.get(), pLine->m_aDateField.get(), pLine->m_aTimeField.get(),
+ pLine->m_aDurationField.get(), pLine->m_aEditButton.get(), pLine->m_aYesNoButton.get(), pLine->m_aRemoveButton.get(), NULL };
vcl::Window** pCurrent = pWindows;
while ( *pCurrent )
{
@@ -1886,39 +1965,39 @@ Sequence< beans::PropertyValue > CustomPropertiesWindow::GetCustomProperties() c
if ( pLine->m_bIsRemoved )
continue;
- OUString sPropertyName = pLine->m_aNameBox.GetText();
+ OUString sPropertyName = pLine->m_aNameBox->GetText();
if ( !sPropertyName.isEmpty() )
{
aPropertiesSeq[i].Name = sPropertyName;
long nType = reinterpret_cast<long>(
- pLine->m_aTypeBox.GetSelectEntryData() );
+ pLine->m_aTypeBox->GetSelectEntryData() );
if ( CUSTOM_TYPE_NUMBER == nType )
{
double nValue = 0;
sal_uInt32 nIndex = const_cast< SvNumberFormatter& >(
m_aNumberFormatter ).GetFormatIndex( NF_NUMBER_SYSTEM );
bool bIsNum = const_cast< SvNumberFormatter& >( m_aNumberFormatter ).
- IsNumberFormat( pLine->m_aValueEdit.GetText(), nIndex, nValue );
+ IsNumberFormat( pLine->m_aValueEdit->GetText(), nIndex, nValue );
if ( bIsNum )
aPropertiesSeq[i].Value <<= makeAny( nValue );
}
else if ( CUSTOM_TYPE_BOOLEAN == nType )
{
- bool bValue = pLine->m_aYesNoButton.IsYesChecked();
+ bool bValue = pLine->m_aYesNoButton->IsYesChecked();
aPropertiesSeq[i].Value <<= makeAny( bValue );
}
else if ( CUSTOM_TYPE_DATETIME == nType )
{
- Date aTmpDate = pLine->m_aDateField.GetDate();
- tools::Time aTmpTime = pLine->m_aTimeField.GetTime();
+ Date aTmpDate = pLine->m_aDateField->GetDate();
+ tools::Time aTmpTime = pLine->m_aTimeField->GetTime();
util::DateTime const aDateTime(aTmpTime.GetNanoSec(),
aTmpTime.GetSec(), aTmpTime.GetMin(), aTmpTime.GetHour(),
aTmpDate.GetDay(), aTmpDate.GetMonth(), aTmpDate.GetYear(),
- pLine->m_aTimeField.m_isUTC);
- if (pLine->m_aDateField.m_TZ.is_initialized())
+ pLine->m_aTimeField->m_isUTC);
+ if (pLine->m_aDateField->m_TZ.is_initialized())
{
aPropertiesSeq[i].Value <<= util::DateTimeWithTimezone(
- aDateTime, pLine->m_aDateField.m_TZ.get());
+ aDateTime, pLine->m_aDateField->m_TZ.get());
}
else
{
@@ -1927,13 +2006,13 @@ Sequence< beans::PropertyValue > CustomPropertiesWindow::GetCustomProperties() c
}
else if ( CUSTOM_TYPE_DATE == nType )
{
- Date aTmpDate = pLine->m_aDateField.GetDate();
+ Date aTmpDate = pLine->m_aDateField->GetDate();
util::Date const aDate(aTmpDate.GetDay(), aTmpDate.GetMonth(),
aTmpDate.GetYear());
- if (pLine->m_aDateField.m_TZ.is_initialized())
+ if (pLine->m_aDateField->m_TZ.is_initialized())
{
aPropertiesSeq[i].Value <<= util::DateWithTimezone(
- aDate, pLine->m_aDateField.m_TZ.get());
+ aDate, pLine->m_aDateField->m_TZ.get());
}
else
{
@@ -1942,11 +2021,11 @@ Sequence< beans::PropertyValue > CustomPropertiesWindow::GetCustomProperties() c
}
else if ( CUSTOM_TYPE_DURATION == nType )
{
- aPropertiesSeq[i].Value <<= pLine->m_aDurationField.GetDuration();
+ aPropertiesSeq[i].Value <<= pLine->m_aDurationField->GetDuration();
}
else
{
- OUString sValue( pLine->m_aValueEdit.GetText() );
+ OUString sValue( pLine->m_aValueEdit->GetText() );
aPropertiesSeq[i].Value <<= makeAny( sValue );
}
}
@@ -1968,17 +2047,17 @@ CustomPropertiesControl::CustomPropertiesControl(vcl::Window* pParent)
void CustomPropertiesControl::Init(VclBuilderContainer& rBuilder)
{
- m_pVBox = new VclVBox(this);
- m_pHeaderBar = new HeaderBar(m_pVBox, WB_BUTTONSTYLE | WB_BOTTOMBORDER);
- m_pBody = new VclHBox(m_pVBox);
+ m_pVBox = VclPtr<VclVBox>::Create(this);
+ m_pHeaderBar = VclPtr<HeaderBar>::Create(m_pVBox, WB_BUTTONSTYLE | WB_BOTTOMBORDER);
+ m_pBody = VclPtr<VclHBox>::Create(m_pVBox);
FixedText* pName = rBuilder.get<FixedText>("name");
FixedText* pType = rBuilder.get<FixedText>("type");
FixedText* pValue = rBuilder.get<FixedText>("value");
OUString sName = pName->GetText();
OUString sType = pType->GetText();
OUString sValue = pValue->GetText();
- m_pPropertiesWin = new CustomPropertiesWindow(m_pBody, pName, pType, pValue);
- m_pVertScroll = new ScrollBar(m_pBody, WB_VERT);
+ m_pPropertiesWin = VclPtr<CustomPropertiesWindow>::Create(m_pBody, pName, pType, pValue);
+ m_pVertScroll = VclPtr<ScrollBar>::Create(m_pBody, WB_VERT);
set_hexpand(true);
set_vexpand(true);
@@ -2055,11 +2134,17 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeCustomPropertiesContro
CustomPropertiesControl::~CustomPropertiesControl()
{
- delete m_pVertScroll;
- delete m_pPropertiesWin;
- delete m_pBody;
- delete m_pHeaderBar;
- delete m_pVBox;
+ disposeOnce();
+}
+
+void CustomPropertiesControl::dispose()
+{
+ m_pVertScroll.disposeAndClear();
+ m_pPropertiesWin.disposeAndClear();
+ m_pBody.disposeAndClear();
+ m_pHeaderBar.disposeAndClear();
+ m_pVBox.disposeAndClear();
+ vcl::Window::dispose();
}
IMPL_LINK( CustomPropertiesControl, ScrollHdl, ScrollBar*, pScrollBar )
@@ -2098,6 +2183,17 @@ SfxCustomPropertiesPage::SfxCustomPropertiesPage( vcl::Window* pParent, const Sf
get<PushButton>("add")->SetClickHdl(LINK(this, SfxCustomPropertiesPage, AddHdl));
}
+SfxCustomPropertiesPage::~SfxCustomPropertiesPage()
+{
+ disposeOnce();
+}
+
+void SfxCustomPropertiesPage::dispose()
+{
+ m_pPropertiesCtrl.clear();
+ SfxTabPage::dispose();
+}
+
IMPL_LINK_NOARG(SfxCustomPropertiesPage, AddHdl)
{
Any aAny;
@@ -2175,9 +2271,9 @@ SfxTabPage::sfxpg SfxCustomPropertiesPage::DeactivatePage( SfxItemSet* /*pSet*/
return nRet;
}
-SfxTabPage* SfxCustomPropertiesPage::Create( vcl::Window* pParent, const SfxItemSet* rItemSet )
+VclPtr<SfxTabPage> SfxCustomPropertiesPage::Create( vcl::Window* pParent, const SfxItemSet* rItemSet )
{
- return new SfxCustomPropertiesPage( pParent, *rItemSet );
+ return VclPtr<SfxCustomPropertiesPage>::Create( pParent, *rItemSet );
}
CmisValue::CmisValue( vcl::Window* pParent, const OUString& aStr )
@@ -2274,7 +2370,7 @@ CmisPropertiesWindow::CmisPropertiesWindow(SfxTabPage* pParent):
pParent->get(m_pBox, "CmisWindow");
CmisPropertyLine aTemp( m_pBox );
m_nItemHeight = aTemp.getItemHeight();
-};
+}
CmisPropertiesWindow::~CmisPropertiesWindow()
{
@@ -2671,9 +2767,9 @@ SfxTabPage::sfxpg SfxCmisPropertiesPage::DeactivatePage( SfxItemSet* /*pSet*/ )
return LEAVE_PAGE;
}
-SfxTabPage* SfxCmisPropertiesPage::Create( vcl::Window* pParent, const SfxItemSet* rItemSet )
+VclPtr<SfxTabPage> SfxCmisPropertiesPage::Create( vcl::Window* pParent, const SfxItemSet* rItemSet )
{
- return new SfxCmisPropertiesPage( pParent, *rItemSet );
+ return VclPtr<SfxCmisPropertiesPage>::Create( pParent, *rItemSet );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index 7118b2824e74..0ad3e754ca40 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -62,7 +62,7 @@ static const int NUM_OF_DOCKINGWINDOWS = 10;
class SfxTitleDockingWindow : public SfxDockingWindow
{
- vcl::Window* m_pWrappedWindow;
+ VclPtr<vcl::Window> m_pWrappedWindow;
public:
SfxTitleDockingWindow(
@@ -71,8 +71,9 @@ public:
vcl::Window* pParent ,
WinBits nBits);
virtual ~SfxTitleDockingWindow();
+ virtual void dispose() SAL_OVERRIDE;
- vcl::Window* GetWrappedWindow() const { return m_pWrappedWindow; }
+ vcl::Window* GetWrappedWindow() const { return m_pWrappedWindow; }
void SetWrappedWindow(vcl::Window* const pWindow);
virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
@@ -129,7 +130,7 @@ SfxDockingWrapper::SfxDockingWrapper( vcl::Window* pParentWnd ,
uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
const OUString aDockWindowResourceURL( "private:resource/dockingwindow/" );
- SfxTitleDockingWindow* pTitleDockWindow = new SfxTitleDockingWindow( pBindings, this, pParentWnd,
+ VclPtr<SfxTitleDockingWindow> pTitleDockWindow = VclPtr<SfxTitleDockingWindow>::Create( pBindings, this, pParentWnd,
WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE);
pWindow = pTitleDockWindow;
eChildAlignment = SfxChildAlignment::NOALIGNMENT;
@@ -207,7 +208,7 @@ SfxDockingWrapper::SfxDockingWrapper( vcl::Window* pParentWnd ,
pWindow->SetOutputSizePixel( Size( 270, 240 ) );
- static_cast<SfxDockingWindow*>( pWindow )->Initialize( pInfo );
+ static_cast<SfxDockingWindow*>( pWindow.get() )->Initialize( pInfo );
SetHideNotDelete( true );
}
@@ -252,7 +253,13 @@ SfxTitleDockingWindow::SfxTitleDockingWindow( SfxBindings* pBind ,
SfxTitleDockingWindow::~SfxTitleDockingWindow()
{
- delete m_pWrappedWindow;
+ disposeOnce();
+}
+
+void SfxTitleDockingWindow::dispose()
+{
+ m_pWrappedWindow.disposeAndClear();
+ SfxDockingWindow::dispose();
}
void SfxTitleDockingWindow::SetWrappedWindow( vcl::Window* const pWindow )
@@ -402,7 +409,7 @@ friend class SfxDockingWindow;
SfxChildAlignment eDockAlignment;
bool bConstructed;
Size aMinSize;
- SfxSplitWindow* pSplitWin;
+ VclPtr<SfxSplitWindow> pSplitWin;
bool bSplitable;
Idle aMoveIdle;
@@ -1267,8 +1274,14 @@ void SfxDockingWindow::FillInfo(SfxChildWinInfo& rInfo) const
SfxDockingWindow::~SfxDockingWindow()
{
+ disposeOnce();
+}
+
+void SfxDockingWindow::dispose()
+{
ReleaseChildWindow_Impl();
- delete pImp;
+ delete pImp; pImp = NULL;
+ DockingWindow::dispose();
}
void SfxDockingWindow::ReleaseChildWindow_Impl()
diff --git a/sfx2/source/dialog/documentfontsdialog.cxx b/sfx2/source/dialog/documentfontsdialog.cxx
index c942fd25c059..22b495c3cab3 100644
--- a/sfx2/source/dialog/documentfontsdialog.cxx
+++ b/sfx2/source/dialog/documentfontsdialog.cxx
@@ -23,9 +23,9 @@
using namespace ::com::sun::star;
-SfxTabPage* SfxDocumentFontsPage::Create( vcl::Window* parent, const SfxItemSet* set )
+VclPtr<SfxTabPage> SfxDocumentFontsPage::Create( vcl::Window* parent, const SfxItemSet* set )
{
- return new SfxDocumentFontsPage( parent, *set );
+ return VclPtr<SfxDocumentFontsPage>::Create( parent, *set );
}
SfxDocumentFontsPage::SfxDocumentFontsPage( vcl::Window* parent, const SfxItemSet& set )
@@ -34,6 +34,17 @@ SfxDocumentFontsPage::SfxDocumentFontsPage( vcl::Window* parent, const SfxItemSe
get( embedFontsCheckbox, "embedFonts" );
}
+SfxDocumentFontsPage::~SfxDocumentFontsPage()
+{
+ disposeOnce();
+}
+
+void SfxDocumentFontsPage::dispose()
+{
+ embedFontsCheckbox.clear();
+ SfxTabPage::dispose();
+}
+
void SfxDocumentFontsPage::Reset( const SfxItemSet* )
{
bool bVal = false;
diff --git a/sfx2/source/dialog/filedlgimpl.hxx b/sfx2/source/dialog/filedlgimpl.hxx
index 00c2d358d0c5..f07113288a37 100644
--- a/sfx2/source/dialog/filedlgimpl.hxx
+++ b/sfx2/source/dialog/filedlgimpl.hxx
@@ -54,7 +54,7 @@ namespace sfx2
SfxFilterMatcher* mpMatcher;
GraphicFilter* mpGraphicFilter;
FileDialogHelper* mpAntiImpl;
- vcl::Window* mpPreferredParentWindow;
+ VclPtr<vcl::Window> mpPreferredParentWindow;
::std::vector< OUString > mlLastURLs;
diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx
index 6d3924ce5459..2bf43410a487 100644
--- a/sfx2/source/dialog/infobar.cxx
+++ b/sfx2/source/dialog/infobar.cxx
@@ -118,8 +118,8 @@ SfxInfoBarWindow::SfxInfoBarWindow(vcl::Window* pParent, const OUString& sId,
const OUString& sMessage) :
Window(pParent, 0),
m_sId(sId),
- m_pMessage(new FixedText(this, 0)),
- m_pCloseBtn(new SfxCloseButton(this)),
+ m_pMessage(VclPtr<FixedText>::Create(this, 0)),
+ m_pCloseBtn(VclPtr<SfxCloseButton>::Create(this)),
m_aActionBtns()
{
sal_Int32 nScaleFactor = GetDPIScaleFactor();
@@ -136,9 +136,6 @@ SfxInfoBarWindow::SfxInfoBarWindow(vcl::Window* pParent, const OUString& sId,
Resize();
}
-SfxInfoBarWindow::~SfxInfoBarWindow()
-{}
-
void SfxInfoBarWindow::addButton(PushButton* pButton) {
pButton->SetParent(this);
pButton->Show();
@@ -146,6 +143,22 @@ void SfxInfoBarWindow::addButton(PushButton* pButton) {
Resize();
}
+SfxInfoBarWindow::~SfxInfoBarWindow()
+{
+ disposeOnce();
+}
+
+void SfxInfoBarWindow::dispose()
+{
+ for ( auto it = m_aActionBtns.begin( ); it != m_aActionBtns.end( ); ++it )
+ it->disposeAndClear();
+
+ m_pMessage.disposeAndClear();
+ m_pCloseBtn.disposeAndClear();
+ m_aActionBtns.clear( );
+ vcl::Window::dispose();
+}
+
void SfxInfoBarWindow::Paint(const Rectangle& rPaintRect)
{
const ViewInformation2D aNewViewInfos;
@@ -203,12 +216,11 @@ void SfxInfoBarWindow::Resize()
long nX = m_pCloseBtn->GetPosPixel().getX() - 15 * nScaleFactor;
long nButtonGap = 5 * nScaleFactor;
- boost::ptr_vector<PushButton>::iterator it;
- for (it = m_aActionBtns.begin(); it != m_aActionBtns.end(); ++it)
+ for (auto it = m_aActionBtns.begin(); it != m_aActionBtns.end(); ++it)
{
- long nButtonWidth = it->GetSizePixel().getWidth();
+ long nButtonWidth = (*it)->GetSizePixel().getWidth();
nX -= nButtonWidth;
- it->SetPosSizePixel(Point(nX, 5 * nScaleFactor), Size(nButtonWidth, 30 * nScaleFactor));
+ (*it)->SetPosSizePixel(Point(nX, 5 * nScaleFactor), Size(nButtonWidth, 30 * nScaleFactor));
nX -= nButtonGap;
}
@@ -233,13 +245,22 @@ SfxInfoBarContainerWindow::SfxInfoBarContainerWindow(SfxInfoBarContainerChild* p
SfxInfoBarContainerWindow::~SfxInfoBarContainerWindow()
{
+ disposeOnce();
+}
+
+void SfxInfoBarContainerWindow::dispose()
+{
+ for ( auto it = m_pInfoBars.begin( ); it != m_pInfoBars.end( ); ++it )
+ it->disposeAndClear();
+ m_pInfoBars.clear( );
+ Window::dispose();
}
SfxInfoBarWindow* SfxInfoBarContainerWindow::appendInfoBar(const OUString& sId, const OUString& sMessage)
{
Size aSize = GetSizePixel();
- SfxInfoBarWindow* pInfoBar = new SfxInfoBarWindow(this, sId, sMessage);
+ VclPtrInstance<SfxInfoBarWindow> pInfoBar(this, sId, sMessage);
pInfoBar->SetPosPixel(Point(0, aSize.getHeight()));
pInfoBar->Show();
m_pInfoBars.push_back(pInfoBar);
@@ -252,32 +273,31 @@ SfxInfoBarWindow* SfxInfoBarContainerWindow::appendInfoBar(const OUString& sId,
SfxInfoBarWindow* SfxInfoBarContainerWindow::getInfoBar(const OUString& sId)
{
- boost::ptr_vector<SfxInfoBarWindow>::iterator it;
- for (it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it)
+ for (auto it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it)
{
- if (it->getId() == sId)
- return &(*it);
+ if ((*it)->getId() == sId)
+ return it->get();
}
return NULL;
}
void SfxInfoBarContainerWindow::removeInfoBar(SfxInfoBarWindow* pInfoBar)
{
- boost::ptr_vector<SfxInfoBarWindow>::iterator it;
- for (it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it)
+ for (auto it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it)
{
- if (pInfoBar == &(*it))
+ if (pInfoBar == it->get())
{
m_pInfoBars.erase(it);
break;
}
}
+ pInfoBar->disposeOnce();
long nY = 0;
- for (it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it)
+ for (auto it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it)
{
- it->SetPosPixel(Point(0, nY));
- nY += it->GetSizePixel().getHeight();
+ (*it)->SetPosPixel(Point(0, nY));
+ nY += (*it)->GetSizePixel().getHeight();
}
Size aSize = GetSizePixel();
@@ -292,13 +312,12 @@ void SfxInfoBarContainerWindow::Resize()
// Only need to change the width of the infobars
long nWidth = GetSizePixel().getWidth();
- boost::ptr_vector<SfxInfoBarWindow>::iterator it;
- for (it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it)
+ for (auto it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it)
{
- Size aSize = it->GetSizePixel();
+ Size aSize = (*it)->GetSizePixel();
aSize.setWidth(nWidth);
- it->SetSizePixel(aSize);
- it->Resize();
+ (*it)->SetSizePixel(aSize);
+ (*it)->Resize();
}
}
@@ -308,7 +327,7 @@ SfxInfoBarContainerChild::SfxInfoBarContainerChild( vcl::Window* _pParent, sal_u
SfxChildWindow(_pParent, nId),
m_pBindings(pBindings)
{
- pWindow = new SfxInfoBarContainerWindow(this);
+ pWindow = VclPtr<SfxInfoBarContainerWindow>::Create(this);
pWindow->SetPosSizePixel(Point(0, 0), Size(_pParent->GetSizePixel().getWidth(), 0));
pWindow->Show();
diff --git a/sfx2/source/dialog/inputdlg.cxx b/sfx2/source/dialog/inputdlg.cxx
index 6f1ab9288205..faa591d89f6a 100644
--- a/sfx2/source/dialog/inputdlg.cxx
+++ b/sfx2/source/dialog/inputdlg.cxx
@@ -26,6 +26,20 @@ InputDialog::InputDialog(const OUString &rLabelText, vcl::Window *pParent)
m_pCancel->SetClickHdl(LINK(this,InputDialog,ClickHdl));
}
+InputDialog::~InputDialog()
+{
+ disposeOnce();
+}
+
+void InputDialog::dispose()
+{
+ m_pEntry.clear();
+ m_pLabel.clear();
+ m_pOK.clear();
+ m_pCancel.clear();
+ ModalDialog::dispose();
+}
+
OUString InputDialog::getEntryText() const
{
return m_pEntry->GetText();
diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx
index 28233e47dcac..b0cdda7e85f9 100644
--- a/sfx2/source/dialog/mailmodel.cxx
+++ b/sfx2/source/dialog/mailmodel.cxx
@@ -858,8 +858,8 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css:
SolarMutexGuard aGuard;
vcl::Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
- MessageDialog aBox(pParentWindow, "ErrorFindEmailDialog", "sfx/ui/errorfindemaildialog.ui");
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(pParentWindow, "ErrorFindEmailDialog", "sfx/ui/errorfindemaildialog.ui");
+ aBox->Execute();
eResult = SEND_MAIL_CANCELLED;
}
else
diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index 6ad49be51c67..47c59880a8b3 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -27,6 +27,7 @@
#include <sfx2/styfitem.hxx>
#include <sfx2/styledlg.hxx>
+#include <sfx2/tabdlg.hxx>
#include <sfx2/app.hxx>
#include <sfx2/mgetempl.hxx>
#include <sfx2/objsh.hxx>
@@ -249,19 +250,30 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(vcl::Window* pParent, const Sfx
SfxManageStyleSheetPage::~SfxManageStyleSheetPage()
+{
+ disposeOnce();
+}
-/* [Description]
-
- Destructor, release of the data
-*/
-
+void SfxManageStyleSheetPage::dispose()
{
m_pNameRw->SetGetFocusHdl( Link() );
m_pNameRw->SetLoseFocusHdl( Link() );
delete pFamilies;
pItem = 0;
pStyle = 0;
-
+ m_pNameRo.clear();
+ m_pNameRw.clear();
+ m_pAutoCB.clear();
+ m_pFollowFt.clear();
+ m_pFollowLb.clear();
+ m_pEditStyleBtn.clear();
+ m_pBaseFt.clear();
+ m_pBaseLb.clear();
+ m_pEditLinkStyleBtn.clear();
+ m_pFilterFt.clear();
+ m_pFilterLb.clear();
+ m_pDescFt.clear();
+ SfxTabPage::dispose();
}
@@ -558,20 +570,10 @@ void SfxManageStyleSheetPage::Reset( const SfxItemSet* /*rAttrSet*/ )
-SfxTabPage* SfxManageStyleSheetPage::Create( vcl::Window* pParent,
- const SfxItemSet *rAttrSet )
-
-/* [Description]
-
- Factory for the creation of the page.
-
- [Cross-reference]
-
- <class SfxTabDialog>
-*/
-
+VclPtr<SfxTabPage> SfxManageStyleSheetPage::Create( vcl::Window* pParent,
+ const SfxItemSet *rAttrSet )
{
- return new SfxManageStyleSheetPage( pParent, *rAttrSet );
+ return VclPtr<SfxManageStyleSheetPage>::Create( pParent, *rAttrSet );
}
@@ -634,8 +636,8 @@ SfxTabPage::sfxpg SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet
if (!pStyle->SetName(comphelper::string::stripStart(m_pNameRw->GetText(), ' ')))
{
- MessageDialog aBox( this, SfxResId( STR_TABPAGE_INVALIDNAME ), VCL_MESSAGE_INFO );
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(this, SfxResId( STR_TABPAGE_INVALIDNAME ), VCL_MESSAGE_INFO);
+ aBox->Execute();
m_pNameRw->GrabFocus();
m_pNameRw->SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
return SfxTabPage::KEEP_PAGE;
@@ -651,8 +653,8 @@ SfxTabPage::sfxpg SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet
{
if ( !pStyle->SetFollow( aFollowEntry ) )
{
- MessageDialog aBox( this, SfxResId( STR_TABPAGE_INVALIDSTYLE ), VCL_MESSAGE_INFO );
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(this, SfxResId( STR_TABPAGE_INVALIDSTYLE ), VCL_MESSAGE_INFO);
+ aBox->Execute();
m_pFollowLb->GrabFocus();
return SfxTabPage::KEEP_PAGE;
}
@@ -671,8 +673,8 @@ SfxTabPage::sfxpg SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet
{
if ( !pStyle->SetParent( aParentEntry ) )
{
- MessageDialog aBox( this, SfxResId( STR_TABPAGE_INVALIDPARENT ), VCL_MESSAGE_INFO );
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(this, SfxResId( STR_TABPAGE_INVALIDPARENT ), VCL_MESSAGE_INFO);
+ aBox->Execute();
m_pBaseLb->GrabFocus();
return SfxTabPage::KEEP_PAGE;
}
diff --git a/sfx2/source/dialog/navigat.cxx b/sfx2/source/dialog/navigat.cxx
index 415c347d4970..98870a6981f1 100644
--- a/sfx2/source/dialog/navigat.cxx
+++ b/sfx2/source/dialog/navigat.cxx
@@ -34,14 +34,14 @@ SfxNavigatorWrapper::SfxNavigatorWrapper( vcl::Window* pParentWnd ,
SfxChildWinInfo* pInfo )
: SfxChildWindow( pParentWnd , nId )
{
- pWindow = new SfxNavigator( pBindings, this, pParentWnd,
+ pWindow = VclPtr<SfxNavigator>::Create( pBindings, this, pParentWnd,
WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE);
eChildAlignment = SfxChildAlignment::NOALIGNMENT;
pWindow->SetHelpId ( HID_NAVIGATOR_WINDOW );
pWindow->SetOutputSizePixel( Size( 270, 240 ) );
- static_cast<SfxDockingWindow*>( pWindow )->Initialize( pInfo );
+ static_cast<SfxDockingWindow*>( pWindow.get() )->Initialize( pInfo );
SetHideNotDelete( true );
}
diff --git a/sfx2/source/dialog/newstyle.cxx b/sfx2/source/dialog/newstyle.cxx
index a2f43fb10ab3..d3f26dc748cb 100644
--- a/sfx2/source/dialog/newstyle.cxx
+++ b/sfx2/source/dialog/newstyle.cxx
@@ -41,7 +41,7 @@ IMPL_LINK( SfxNewStyleDlg, OKHdl, Control *, pControl )
return 0;
}
- if ( RET_YES == aQueryOverwriteBox.Execute() )
+ if ( RET_YES == aQueryOverwriteBox->Execute() )
EndDialog( RET_OK );
}
else
@@ -59,8 +59,8 @@ IMPL_LINK_INLINE_END( SfxNewStyleDlg, ModifyHdl, ComboBox *, pBox )
SfxNewStyleDlg::SfxNewStyleDlg( vcl::Window* pParent, SfxStyleSheetBasePool& rInPool )
: ModalDialog(pParent, "CreateStyleDialog", "sfx/ui/newstyle.ui")
- , aQueryOverwriteBox(this, SfxResId(STR_QUERY_OVERWRITE),
- VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO)
+ , aQueryOverwriteBox(VclPtr<MessageDialog>::Create(this, SfxResId(STR_QUERY_OVERWRITE),
+ VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO))
, rPool(rInPool)
{
get(m_pColBox, "stylename");
@@ -82,6 +82,15 @@ SfxNewStyleDlg::SfxNewStyleDlg( vcl::Window* pParent, SfxStyleSheetBasePool& rIn
SfxNewStyleDlg::~SfxNewStyleDlg()
{
+ disposeOnce();
+}
+
+void SfxNewStyleDlg::dispose()
+{
+ aQueryOverwriteBox.disposeAndClear();
+ m_pColBox.clear();
+ m_pOKBtn.clear();
+ ModalDialog::dispose();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/partwnd.cxx b/sfx2/source/dialog/partwnd.cxx
index 0a168d8305b1..f16288d4a1c7 100644
--- a/sfx2/source/dialog/partwnd.cxx
+++ b/sfx2/source/dialog/partwnd.cxx
@@ -59,16 +59,16 @@ SfxPartChildWnd_Impl::SfxPartChildWnd_Impl
: SfxChildWindow( pParentWnd, nId )
{
// Create Window
- pWindow = new SfxPartDockWnd_Impl( pBindings, this, pParentWnd, WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK );
+ pWindow = VclPtr<SfxPartDockWnd_Impl>::Create( pBindings, this, pParentWnd, WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK );
eChildAlignment = SfxChildAlignment::TOP;
assert(pInfo);
pInfo->nFlags |= SfxChildWindowFlags::FORCEDOCK;
- static_cast<SfxDockingWindow*>(pWindow)->SetFloatingSize( Size( 175, 175 ) );
+ static_cast<SfxDockingWindow*>(pWindow.get())->SetFloatingSize( Size( 175, 175 ) );
pWindow->SetSizePixel( Size( 175, 175 ) );
- static_cast<SfxDockingWindow*>(pWindow)->Initialize( pInfo );
+ static_cast<SfxDockingWindow*>(pWindow.get())->Initialize( pInfo );
SetHideNotDelete( true );
}
@@ -82,7 +82,7 @@ SfxPartChildWnd_Impl::~SfxPartChildWnd_Impl()
// But don't do it, if xFrame already exist. Then dispose() must come from inside ...
// and we need a valid pMgr for further operations ...
- SfxPartDockWnd_Impl* pWin = static_cast<SfxPartDockWnd_Impl*>(pWindow);
+ SfxPartDockWnd_Impl* pWin = static_cast<SfxPartDockWnd_Impl*>(pWindow.get());
if ( pWin && xFrame == pWin->GetBindings().GetActiveFrame() )
pWin->GetBindings().SetActiveFrame( NULL );
@@ -90,7 +90,7 @@ SfxPartChildWnd_Impl::~SfxPartChildWnd_Impl()
bool SfxPartChildWnd_Impl::QueryClose()
{
- return static_cast<SfxPartDockWnd_Impl*>(pWindow)->QueryClose();
+ return static_cast<SfxPartDockWnd_Impl*>(pWindow.get())->QueryClose();
}
@@ -140,12 +140,6 @@ SfxPartDockWnd_Impl::SfxPartDockWnd_Impl
-SfxPartDockWnd_Impl::~SfxPartDockWnd_Impl()
-{
-}
-
-
-
void SfxPartDockWnd_Impl::Resize()
/* [Description]
diff --git a/sfx2/source/dialog/passwd.cxx b/sfx2/source/dialog/passwd.cxx
index 237f8eb7eb7c..0b6a20278a13 100644
--- a/sfx2/source/dialog/passwd.cxx
+++ b/sfx2/source/dialog/passwd.cxx
@@ -71,8 +71,8 @@ IMPL_LINK_NOARG(SfxPasswordDialog, OKHdl)
bConfirmFailed = true;
if ( bConfirmFailed )
{
- MessageDialog aBox(this, SfxResId(STR_ERROR_WRONG_CONFIRM));
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(this, SfxResId(STR_ERROR_WRONG_CONFIRM));
+ aBox->Execute();
mpConfirm1ED->SetText( OUString() );
mpConfirm1ED->GrabFocus();
}
@@ -125,7 +125,29 @@ SfxPasswordDialog::SfxPasswordDialog(vcl::Window* pParent, const OUString* pGrou
SetPasswdText();
}
+SfxPasswordDialog::~SfxPasswordDialog()
+{
+ disposeOnce();
+}
+void SfxPasswordDialog::dispose()
+{
+ mpPassword1Box.clear();
+ mpUserFT.clear();
+ mpUserED.clear();
+ mpPassword1FT.clear();
+ mpPassword1ED.clear();
+ mpConfirm1FT.clear();
+ mpConfirm1ED.clear();
+ mpPassword2Box.clear();
+ mpPassword2FT.clear();
+ mpPassword2ED.clear();
+ mpConfirm2FT.clear();
+ mpConfirm2ED.clear();
+ mpMinLengthFT.clear();
+ mpOKBtn.clear();
+ ModalDialog::dispose();
+}
void SfxPasswordDialog::SetPasswdText( )
{
diff --git a/sfx2/source/dialog/printopt.cxx b/sfx2/source/dialog/printopt.cxx
index 3a3ce1b75720..851509941889 100644
--- a/sfx2/source/dialog/printopt.cxx
+++ b/sfx2/source/dialog/printopt.cxx
@@ -87,11 +87,37 @@ SfxCommonPrintOptionsTabPage::SfxCommonPrintOptionsTabPage( vcl::Window* pParent
SfxCommonPrintOptionsTabPage::~SfxCommonPrintOptionsTabPage()
{
+ disposeOnce();
}
-SfxTabPage* SfxCommonPrintOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+void SfxCommonPrintOptionsTabPage::dispose()
{
- return( new SfxCommonPrintOptionsTabPage( pParent, *rAttrSet ) );
+ m_pPrinterOutputRB.clear();
+ m_pPrintFileOutputRB.clear();
+ m_pReduceTransparencyCB.clear();
+ m_pReduceTransparencyAutoRB.clear();
+ m_pReduceTransparencyNoneRB.clear();
+ m_pReduceGradientsCB.clear();
+ m_pReduceGradientsStripesRB.clear();
+ m_pReduceGradientsColorRB.clear();
+ m_pReduceGradientsStepCountNF.clear();
+ m_pReduceBitmapsCB.clear();
+ m_pReduceBitmapsOptimalRB.clear();
+ m_pReduceBitmapsNormalRB.clear();
+ m_pReduceBitmapsResolutionRB.clear();
+ m_pReduceBitmapsResolutionLB.clear();
+ m_pReduceBitmapsTransparencyCB.clear();
+ m_pConvertToGreyscalesCB.clear();
+ m_pPDFCB.clear();
+ m_pPaperSizeCB.clear();
+ m_pPaperOrientationCB.clear();
+ m_pTransparencyCB.clear();
+ SfxTabPage::dispose();
+}
+
+VclPtr<SfxTabPage> SfxCommonPrintOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
+{
+ return VclPtr<SfxCommonPrintOptionsTabPage>::Create( pParent, *rAttrSet );
}
vcl::Window* SfxCommonPrintOptionsTabPage::GetParentLabeledBy( const vcl::Window* pWindow ) const
diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx
index d051bb3fa055..742aa883900a 100644
--- a/sfx2/source/dialog/recfloat.cxx
+++ b/sfx2/source/dialog/recfloat.cxx
@@ -131,10 +131,10 @@ SfxRecordingFloatWrapper_Impl::SfxRecordingFloatWrapper_Impl( vcl::Window* pPare
: SfxChildWindow( pParentWnd, nId )
, pBindings( pBind )
{
- pWindow = new SfxRecordingFloat_Impl( pBindings, this, pParentWnd );
+ pWindow = VclPtr<SfxRecordingFloat_Impl>::Create( pBindings, this, pParentWnd );
SetWantsFocus( false );
eChildAlignment = SfxChildAlignment::NOALIGNMENT;
- static_cast<SfxFloatingWindow*>(pWindow)->Initialize( pInfo );
+ static_cast<SfxFloatingWindow*>(pWindow.get())->Initialize( pInfo );
}
SfxRecordingFloatWrapper_Impl::~SfxRecordingFloatWrapper_Impl()
@@ -152,9 +152,9 @@ bool SfxRecordingFloatWrapper_Impl::QueryClose()
com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder = pBindings->GetRecorder();
if ( xRecorder.is() && !xRecorder->getRecordedMacro().isEmpty() )
{
- QueryBox aBox( GetWindow(), WB_YES_NO | WB_DEF_NO , SfxResId(STR_MACRO_LOSS).toString() );
- aBox.SetText( SfxResId(STR_CANCEL_RECORDING).toString() );
- bRet = ( aBox.Execute() == RET_YES );
+ ScopedVclPtrInstance< QueryBox > aBox(GetWindow(), WB_YES_NO | WB_DEF_NO , SfxResId(STR_MACRO_LOSS).toString());
+ aBox->SetText( SfxResId(STR_CANCEL_RECORDING).toString() );
+ bRet = ( aBox->Execute() == RET_YES );
}
return bRet;
@@ -200,6 +200,11 @@ SfxRecordingFloat_Impl::SfxRecordingFloat_Impl(
SfxRecordingFloat_Impl::~SfxRecordingFloat_Impl()
{
+ disposeOnce();
+}
+
+void SfxRecordingFloat_Impl::dispose()
+{
try
{
if ( xStopRecTbxCtrl.is() )
@@ -211,6 +216,8 @@ SfxRecordingFloat_Impl::~SfxRecordingFloat_Impl()
catch ( uno::Exception& )
{
}
+ m_pTbx.clear();
+ SfxFloatingWindow::dispose();
}
bool SfxRecordingFloat_Impl::Close()
diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx
index 7fb1d0c4cfb6..e5de1d3c99c5 100644
--- a/sfx2/source/dialog/securitypage.cxx
+++ b/sfx2/source/dialog/securitypage.cxx
@@ -99,13 +99,13 @@ static bool lcl_GetPassword(
/*out*/OUString &rPassword )
{
bool bRes = false;
- SfxPasswordDialog aPasswdDlg( pParent );
- aPasswdDlg.SetMinLen( 1 );
+ ScopedVclPtrInstance< SfxPasswordDialog > aPasswdDlg(pParent);
+ aPasswdDlg->SetMinLen( 1 );
if (bProtect)
- aPasswdDlg.ShowExtras( SfxShowExtras::CONFIRM );
- if (RET_OK == aPasswdDlg.Execute() && !aPasswdDlg.GetPassword().isEmpty())
+ aPasswdDlg->ShowExtras( SfxShowExtras::CONFIRM );
+ if (RET_OK == aPasswdDlg->Execute() && !aPasswdDlg->GetPassword().isEmpty())
{
- rPassword = aPasswdDlg.GetPassword();
+ rPassword = aPasswdDlg->GetPassword();
bRes = true;
}
return bRes;
@@ -136,10 +136,10 @@ struct SfxSecurityPage_Impl
{
SfxSecurityPage & m_rMyTabPage;
- CheckBox* m_pOpenReadonlyCB;
- CheckBox* m_pRecordChangesCB; // for record changes
- PushButton* m_pProtectPB; // for record changes
- PushButton* m_pUnProtectPB; // for record changes
+ VclPtr<CheckBox> m_pOpenReadonlyCB;
+ VclPtr<CheckBox> m_pRecordChangesCB; // for record changes
+ VclPtr<PushButton> m_pProtectPB; // for record changes
+ VclPtr<PushButton> m_pUnProtectPB; // for record changes
RedliningMode m_eRedlingMode; // for record changes
bool m_bOrigPasswordIsConfirmed;
@@ -335,9 +335,9 @@ IMPL_LINK_NOARG(SfxSecurityPage_Impl, RecordChangesCBToggleHdl)
bool bAlreadyDone = false;
if (!m_bEndRedliningWarningDone)
{
- WarningBox aBox( m_rMyTabPage.GetParent(), WinBits(WB_YES_NO | WB_DEF_NO),
+ ScopedVclPtrInstance<WarningBox> aBox(m_rMyTabPage.GetParent(), WinBits(WB_YES_NO | WB_DEF_NO),
m_aEndRedliningWarning );
- if (aBox.Execute() != RET_YES)
+ if (aBox->Execute() != RET_YES)
bAlreadyDone = true;
else
m_bEndRedliningWarningDone = true;
@@ -420,9 +420,9 @@ IMPL_LINK_NOARG(SfxSecurityPage_Impl, ChangeProtectionPBHdl)
}
-SfxTabPage* SfxSecurityPage::Create( vcl::Window * pParent, const SfxItemSet * rItemSet )
+VclPtr<SfxTabPage> SfxSecurityPage::Create( vcl::Window * pParent, const SfxItemSet * rItemSet )
{
- return new SfxSecurityPage( pParent, *rItemSet );
+ return VclPtr<SfxSecurityPage>::Create( pParent, *rItemSet );
}
@@ -433,10 +433,6 @@ SfxSecurityPage::SfxSecurityPage( vcl::Window* pParent, const SfxItemSet& rItemS
}
-SfxSecurityPage::~SfxSecurityPage()
-{
-}
-
bool SfxSecurityPage::FillItemSet( SfxItemSet * rItemSet )
{
diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx
index 461feacf5031..a3bcb853134c 100644
--- a/sfx2/source/dialog/splitwin.cxx
+++ b/sfx2/source/dialog/splitwin.cxx
@@ -87,15 +87,16 @@ class SfxEmptySplitWin_Impl : public SplitWindow
*/
friend class SfxSplitWindow;
- SfxSplitWindow* pOwner;
- bool bFadeIn;
- bool bAutoHide;
- bool bSplit;
- bool bEndAutoHide;
- Timer aTimer;
- Point aLastPos;
+ VclPtr<SfxSplitWindow> pOwner;
+ bool bFadeIn;
+ bool bAutoHide;
+ bool bSplit;
+ bool bEndAutoHide;
+ Timer aTimer;
+ Point aLastPos;
sal_uInt16 nState;
+public:
SfxEmptySplitWin_Impl( SfxSplitWindow *pParent )
: SplitWindow( pParent->GetParent(), WinBits( WB_BORDER | WB_3DLOOK ) )
, pOwner( pParent )
@@ -115,8 +116,12 @@ friend class SfxSplitWindow;
}
virtual ~SfxEmptySplitWin_Impl()
+ { disposeOnce(); }
+ virtual void dispose() SAL_OVERRIDE
{
aTimer.Stop();
+ pOwner.clear();
+ SplitWindow::dispose();
}
virtual void MouseMove( const MouseEvent& ) SAL_OVERRIDE;
@@ -232,7 +237,7 @@ SfxSplitWindow::SfxSplitWindow( vcl::Window* pParent, SfxChildAlignment eAl,
}
SetAlign (eTbxAlign);
- pEmptyWin = new SfxEmptySplitWin_Impl( this );
+ pEmptyWin = VclPtr<SfxEmptySplitWin_Impl>::Create( this );
if ( bPinned )
{
pEmptyWin->bFadeIn = true;
@@ -299,6 +304,11 @@ SfxSplitWindow::SfxSplitWindow( vcl::Window* pParent, SfxChildAlignment eAl,
SfxSplitWindow::~SfxSplitWindow()
{
+ disposeOnce();
+}
+
+void SfxSplitWindow::dispose()
+{
if ( !pWorkWin->GetParent_Impl() )
SaveConfig_Impl();
@@ -307,10 +317,12 @@ SfxSplitWindow::~SfxSplitWindow()
// Set pOwner to NULL, otherwise try to delete pEmptyWin once more. The
// window that is just being docked is always deleted from the outside.
pEmptyWin->pOwner = NULL;
- delete pEmptyWin;
}
+ pEmptyWin.disposeAndClear();
delete pDockArr;
+ pActive.clear();
+ SplitWindow::dispose();
}
void SfxSplitWindow::SaveConfig_Impl()
diff --git a/sfx2/source/dialog/srchdlg.cxx b/sfx2/source/dialog/srchdlg.cxx
index efc3c78009db..0da322cbbcfb 100644
--- a/sfx2/source/dialog/srchdlg.cxx
+++ b/sfx2/source/dialog/srchdlg.cxx
@@ -62,8 +62,20 @@ SearchDialog::SearchDialog(vcl::Window* pWindow, const OUString& rConfigName)
SearchDialog::~SearchDialog()
{
+ disposeOnce();
+}
+
+void SearchDialog::dispose()
+{
SaveConfig();
m_aCloseHdl.Call( NULL );
+ m_pSearchEdit.clear();
+ m_pWholeWordsBox.clear();
+ m_pMatchCaseBox.clear();
+ m_pWrapAroundBox.clear();
+ m_pBackwardsBox.clear();
+ m_pFindBtn.clear();
+ ModelessDialog::dispose();
}
void SearchDialog::LoadConfig()
diff --git a/sfx2/source/dialog/styledlg.cxx b/sfx2/source/dialog/styledlg.cxx
index dc0d5f00d774..1735f1b28371 100644
--- a/sfx2/source/dialog/styledlg.cxx
+++ b/sfx2/source/dialog/styledlg.cxx
@@ -71,6 +71,9 @@ SfxStyleDialog::SfxStyleDialog
SfxStyleDialog::~SfxStyleDialog()
+{
+ disposeOnce();
+}
/* [Description]
@@ -78,9 +81,11 @@ SfxStyleDialog::~SfxStyleDialog()
the Set from Style.
*/
+void SfxStyleDialog::dispose()
{
pExampleSet = 0;
pStyle = 0;
+ SfxTabDialog::dispose();
}
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 9434ab9184ed..af240ce76b44 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -60,7 +60,7 @@ struct Data_Impl
sal_uInt16 nId; // The ID
CreateTabPage fnCreatePage; // Pointer to Factory
GetTabPageRanges fnGetRanges; // Pointer to Ranges-Function
- SfxTabPage* pTabPage; // The TabPage itself
+ VclPtr<SfxTabPage> pTabPage; // The TabPage itself
bool bOnDemand; // Flag: ItemSet onDemand
bool bRefresh; // Flag: Page must be re-initialized
@@ -171,12 +171,14 @@ SfxTabPage::SfxTabPage(vcl::Window *pParent, const OString& rID, const OUString&
}
SfxTabPage::~SfxTabPage()
-/* [Description]
+{
+ disposeOnce();
+}
- Destructor
-*/
+void SfxTabPage::dispose()
{
delete pImpl;
+ TabPage::dispose();
}
bool SfxTabPage::FillItemSet( SfxItemSet* rSet )
@@ -363,6 +365,11 @@ SfxTabDialog::SfxTabDialog
SfxTabDialog::~SfxTabDialog()
{
+ disposeOnce();
+}
+
+void SfxTabDialog::dispose()
+{
SavePosAndId();
for ( SfxTabDlgData_Impl::const_iterator it = pImpl->aData.begin(); it != pImpl->aData.end(); ++it )
@@ -391,7 +398,7 @@ SfxTabDialog::~SfxTabDialog()
if ( pDataObject->bOnDemand )
delete &pDataObject->pTabPage->GetItemSet();
- delete pDataObject->pTabPage;
+ pDataObject->pTabPage.disposeAndClear();
}
delete pDataObject;
}
@@ -403,15 +410,26 @@ SfxTabDialog::~SfxTabDialog()
delete [] pRanges;
if (m_bOwnsBaseFmtBtn)
- delete m_pBaseFmtBtn;
+ m_pBaseFmtBtn.disposeAndClear();
if (m_bOwnsResetBtn)
- delete m_pResetBtn;
+ m_pResetBtn.disposeAndClear();
if (m_bOwnsHelpBtn)
- delete m_pHelpBtn;
+ m_pHelpBtn.disposeAndClear();
if (m_bOwnsCancelBtn)
- delete m_pCancelBtn;
+ m_pCancelBtn.disposeAndClear();
if (m_bOwnsOKBtn)
- delete m_pOKBtn;
+ m_pOKBtn.disposeAndClear();
+ m_pBox.clear();
+ m_pTabCtrl.clear();
+ m_pOKBtn.clear();
+ m_pApplyBtn.clear();
+ m_pUserBtn.clear();
+ m_pCancelBtn.clear();
+ m_pHelpBtn.clear();
+ m_pResetBtn.clear();
+ m_pBaseFmtBtn.clear();
+ m_pActionArea.clear();
+ TabDialog::dispose();
}
void SfxTabDialog::Init_Impl(bool bFmtFlag)
@@ -430,33 +448,33 @@ void SfxTabDialog::Init_Impl(bool bFmtFlag)
assert(m_pActionArea);
m_pOKBtn = m_pUIBuilder->get<PushButton>("ok");
- m_bOwnsOKBtn = m_pOKBtn == NULL;
+ m_bOwnsOKBtn = m_pOKBtn == nullptr;
if (m_bOwnsOKBtn)
- m_pOKBtn = new OKButton(m_pActionArea);
+ m_pOKBtn = VclPtr<OKButton>::Create(m_pActionArea);
m_pApplyBtn = m_pUIBuilder->get<PushButton>("apply");
m_pUserBtn = m_pUIBuilder->get<PushButton>("user");
m_pCancelBtn = m_pUIBuilder->get<CancelButton>("cancel");
- m_bOwnsCancelBtn = m_pCancelBtn == NULL;
+ m_bOwnsCancelBtn = m_pCancelBtn == nullptr;
if (m_bOwnsCancelBtn)
- m_pCancelBtn = new CancelButton(m_pActionArea);
+ m_pCancelBtn = VclPtr<CancelButton>::Create(m_pActionArea);
m_pHelpBtn = m_pUIBuilder->get<HelpButton>("help");
- m_bOwnsHelpBtn = m_pHelpBtn == NULL;
+ m_bOwnsHelpBtn = m_pHelpBtn == nullptr;
if (m_bOwnsHelpBtn)
- m_pHelpBtn = new HelpButton(m_pActionArea);
+ m_pHelpBtn = VclPtr<HelpButton>::Create(m_pActionArea);
m_pResetBtn = m_pUIBuilder->get<PushButton>("reset");
- m_bOwnsResetBtn = m_pResetBtn == NULL;
+ m_bOwnsResetBtn = m_pResetBtn == nullptr;
if (m_bOwnsResetBtn)
- m_pResetBtn = new PushButton(m_pActionArea);
+ m_pResetBtn = VclPtr<PushButton>::Create(m_pActionArea.get());
else
pImpl->bHideResetBtn = !m_pResetBtn->IsVisible();
m_pBaseFmtBtn = m_pUIBuilder->get<PushButton>("standard");
- m_bOwnsBaseFmtBtn = m_pBaseFmtBtn == NULL;
+ m_bOwnsBaseFmtBtn = m_pBaseFmtBtn == nullptr;
if (m_bOwnsBaseFmtBtn)
- m_pBaseFmtBtn = new PushButton(m_pActionArea);
+ m_pBaseFmtBtn = VclPtr<PushButton>::Create(m_pActionArea.get());
m_pOKBtn->SetClickHdl( LINK( this, SfxTabDialog, OkHdl ) );
m_pCancelBtn->SetClickHdl( LINK( this, SfxTabDialog, CancelHdl ) );
@@ -690,7 +708,7 @@ void SfxTabDialog::RemoveTabPage( sal_uInt16 nId )
if ( pDataObject->bOnDemand )
delete &pDataObject->pTabPage->GetItemSet();
- delete pDataObject->pTabPage;
+ pDataObject->pTabPage.disposeAndClear();
}
delete pDataObject;
@@ -1127,7 +1145,7 @@ IMPL_LINK( SfxTabDialog, ActivatePageHdl, TabControl *, pTabCtrl )
else
pTabPage = (pDataObject->fnCreatePage)
( pTabCtrl, CreateInputItemSet( nId ) );
- DBG_ASSERT( NULL == pDataObject->pTabPage, "create TabPage more than once" );
+ DBG_ASSERT( nullptr == pDataObject->pTabPage, "create TabPage more than once" );
pDataObject->pTabPage = pTabPage;
OUString sConfigId = OStringToOUString(pTabPage->GetConfigId(), RTL_TEXTENCODING_UTF8);
@@ -1247,7 +1265,7 @@ IMPL_LINK( SfxTabDialog, DeactivatePageHdl, TabControl *, pTabCtrl )
{
Data_Impl* pObj = *it;
- if ( pObj->pTabPage != pPage ) // Do not refresh own Page anymore
+ if ( pObj->pTabPage.get() != pPage ) // Do not refresh own Page anymore
pObj->bRefresh = true;
else
pObj->bRefresh = false;
diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx
index c5273b485fab..a032f1569690 100644
--- a/sfx2/source/dialog/taskpane.cxx
+++ b/sfx2/source/dialog/taskpane.cxx
@@ -202,13 +202,24 @@ namespace sfx2
TaskPaneDockingWindow::TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, vcl::Window* i_pParent, WinBits i_nBits )
:TitledDockingWindow( i_pBindings, &i_rWrapper, i_pParent, i_nBits )
- ,m_aTaskPane( GetContentWindow(), lcl_getFrame( i_pBindings ) )
- ,m_aPaneController( m_aTaskPane, *this )
+ ,m_aTaskPane( VclPtr<ModuleTaskPane>::Create(GetContentWindow(), lcl_getFrame( i_pBindings )) )
+ ,m_aPaneController( *m_aTaskPane.get(), *this )
{
- m_aTaskPane.Show();
+ m_aTaskPane->Show();
SetText( SfxResId( SID_TASKPANE ).toString() );
}
+ TaskPaneDockingWindow::~TaskPaneDockingWindow()
+ {
+ disposeOnce();
+ }
+
+ void TaskPaneDockingWindow::dispose()
+ {
+ m_aTaskPane.disposeAndClear();
+ TitledDockingWindow::dispose();
+ }
+
void TaskPaneDockingWindow::ActivateToolPanel( const OUString& i_rPanelURL )
{
@@ -219,13 +230,13 @@ namespace sfx2
void TaskPaneDockingWindow::GetFocus()
{
TitledDockingWindow::GetFocus();
- m_aTaskPane.GrabFocus();
+ m_aTaskPane->GrabFocus();
}
void TaskPaneDockingWindow::onLayoutDone()
{
- m_aTaskPane.SetPosSizePixel( Point(), GetContentWindow().GetOutputSizePixel() );
+ m_aTaskPane->SetPosSizePixel( Point(), GetContentWindow().GetOutputSizePixel() );
}
@@ -238,7 +249,7 @@ namespace sfx2
TaskPaneWrapper::TaskPaneWrapper( vcl::Window* i_pParent, sal_uInt16 i_nId, SfxBindings* i_pBindings, SfxChildWinInfo* i_pInfo )
:SfxChildWindow( i_pParent, i_nId )
{
- pWindow = new TaskPaneDockingWindow( i_pBindings, *this, i_pParent,
+ pWindow = VclPtr<TaskPaneDockingWindow>::Create( i_pBindings, *this, i_pParent,
WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE);
eChildAlignment = SfxChildAlignment::RIGHT;
@@ -507,9 +518,9 @@ namespace sfx2
:m_rAntiImpl( i_rAntiImpl )
,m_sModuleIdentifier( lcl_identifyModule( i_rDocumentFrame ) )
,m_xFrame( i_rDocumentFrame )
- ,m_aPanelDeck( i_rAntiImpl )
+ ,m_aPanelDeck( new ::svt::ToolPanelDeck(i_rAntiImpl) )
{
- m_aPanelDeck.Show();
+ m_aPanelDeck->Show();
OnResize();
impl_initFromConfiguration();
}
@@ -523,7 +534,7 @@ namespace sfx2
static bool ModuleHasToolPanels( const OUString& i_rModuleIdentifier );
- ::svt::ToolPanelDeck& GetPanelDeck() { return m_aPanelDeck; }
+ ::svt::ToolPanelDeck& GetPanelDeck() { return *m_aPanelDeck.get(); }
::boost::optional< size_t >
GetPanelPos( const OUString& i_rResourceURL );
@@ -540,28 +551,28 @@ namespace sfx2
DECL_LINK( OnActivatePanel, void* );
private:
- ModuleTaskPane& m_rAntiImpl;
- const OUString m_sModuleIdentifier;
- const Reference< XFrame > m_xFrame;
- ::svt::ToolPanelDeck m_aPanelDeck;
+ ModuleTaskPane& m_rAntiImpl;
+ const OUString m_sModuleIdentifier;
+ const Reference< XFrame > m_xFrame;
+ VclPtr<::svt::ToolPanelDeck> m_aPanelDeck;
};
void ModuleTaskPane_Impl::OnResize()
{
- m_aPanelDeck.SetPosSizePixel( Point(), m_rAntiImpl.GetOutputSizePixel() );
+ m_aPanelDeck->SetPosSizePixel( Point(), m_rAntiImpl.GetOutputSizePixel() );
}
void ModuleTaskPane_Impl::OnGetFocus()
{
- m_aPanelDeck.GrabFocus();
+ m_aPanelDeck->GrabFocus();
}
IMPL_LINK( ModuleTaskPane_Impl, OnActivatePanel, void*, i_pArg )
{
- m_aPanelDeck.ActivatePanel( reinterpret_cast< size_t >( i_pArg ) );
+ m_aPanelDeck->ActivatePanel( reinterpret_cast< size_t >( i_pArg ) );
return 1L;
}
@@ -595,8 +606,8 @@ namespace sfx2
::utl::OConfigurationNode aResourceNode( aWindowStateConfig.openNode( *resource ) );
::svt::PToolPanel pCustomPanel( new CustomToolPanel( aResourceNode, m_xFrame ) );
- size_t nPanelPos = m_aPanelDeck.GetPanelCount();
- nPanelPos = m_aPanelDeck.InsertPanel( pCustomPanel, nPanelPos );
+ size_t nPanelPos = m_aPanelDeck->GetPanelCount();
+ nPanelPos = m_aPanelDeck->InsertPanel( pCustomPanel, nPanelPos );
if ( ::comphelper::getBOOL( aResourceNode.getNodeValue( "Visible" ) ) )
sFirstVisiblePanelResource = *resource;
@@ -637,9 +648,9 @@ namespace sfx2
::boost::optional< size_t > ModuleTaskPane_Impl::GetPanelPos( const OUString& i_rResourceURL )
{
::boost::optional< size_t > aPanelPos;
- for ( size_t i = 0; i < m_aPanelDeck.GetPanelCount(); ++i )
+ for ( size_t i = 0; i < m_aPanelDeck->GetPanelCount(); ++i )
{
- const ::svt::PToolPanel pPanel( m_aPanelDeck.GetPanel( i ) );
+ const ::svt::PToolPanel pPanel( m_aPanelDeck->GetPanel( i ) );
const CustomToolPanel* pCustomPanel = dynamic_cast< const CustomToolPanel* >( pPanel.get() );
if ( !pCustomPanel )
{
@@ -656,21 +667,20 @@ namespace sfx2
return aPanelPos;
}
-
void ModuleTaskPane_Impl::SetDrawersLayout()
{
- const ::svt::PDeckLayouter pLayouter( m_aPanelDeck.GetLayouter() );
+ const ::svt::PDeckLayouter pLayouter( m_aPanelDeck->GetLayouter() );
const ::svt::DrawerDeckLayouter* pDrawerLayouter = dynamic_cast< const ::svt::DrawerDeckLayouter* >( pLayouter.get() );
if ( pDrawerLayouter != NULL )
// already have the proper layout
return;
- m_aPanelDeck.SetLayouter( new ::svt::DrawerDeckLayouter( m_aPanelDeck, m_aPanelDeck ) );
+ m_aPanelDeck->SetLayouter( new ::svt::DrawerDeckLayouter( *m_aPanelDeck.get(), *m_aPanelDeck.get() ) );
}
void ModuleTaskPane_Impl::SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent )
{
- ::svt::PDeckLayouter pLayouter( m_aPanelDeck.GetLayouter() );
+ ::svt::PDeckLayouter pLayouter( m_aPanelDeck->GetLayouter() );
::svt::TabDeckLayouter* pTabLayouter = dynamic_cast< ::svt::TabDeckLayouter* >( pLayouter.get() );
if ( ( pTabLayouter != NULL )
&& ( pTabLayouter->GetTabAlignment() == i_eTabAlignment )
@@ -686,7 +696,7 @@ namespace sfx2
return;
}
- m_aPanelDeck.SetLayouter( new ::svt::TabDeckLayouter( m_aPanelDeck, m_aPanelDeck, i_eTabAlignment, i_eTabContent ) );
+ m_aPanelDeck->SetLayouter( new ::svt::TabDeckLayouter( *m_aPanelDeck.get(), *m_aPanelDeck.get(), i_eTabAlignment, i_eTabContent ) );
}
@@ -699,12 +709,11 @@ namespace sfx2
{
}
-
ModuleTaskPane::~ModuleTaskPane()
{
+ disposeOnce();
}
-
bool ModuleTaskPane::ModuleHasToolPanels( const Reference< XFrame >& i_rDocumentFrame )
{
return ModuleTaskPane_Impl::ModuleHasToolPanels( lcl_identifyModule( i_rDocumentFrame ) );
diff --git a/sfx2/source/dialog/templateinfodlg.cxx b/sfx2/source/dialog/templateinfodlg.cxx
index 1f6f9935aaf8..df195c8efdb2 100644
--- a/sfx2/source/dialog/templateinfodlg.cxx
+++ b/sfx2/source/dialog/templateinfodlg.cxx
@@ -38,7 +38,7 @@ SfxTemplateInfoDlg::SfxTemplateInfoDlg (vcl::Window *pParent)
get(mpBtnClose, "close");
get(mpBox, "box");
get(mpInfoView, "infoDrawingArea");
- mpPreviewView = new vcl::Window(mpBox);
+ mpPreviewView = VclPtr<vcl::Window>::Create(mpBox.get());
Size aSize(LogicToPixel(Size(250, 160), MAP_APPFONT));
mpBox->set_width_request(aSize.Width());
@@ -54,7 +54,17 @@ SfxTemplateInfoDlg::SfxTemplateInfoDlg (vcl::Window *pParent)
SfxTemplateInfoDlg::~SfxTemplateInfoDlg()
{
+ disposeOnce();
+}
+
+void SfxTemplateInfoDlg::dispose()
+{
m_xFrame->dispose();
+ mpBtnClose.clear();
+ mpBox.clear();
+ mpPreviewView.clear();
+ mpInfoView.clear();
+ ModalDialog::dispose();
}
void SfxTemplateInfoDlg::loadDocument(const OUString &rURL)
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 76ab7dbc9fc4..1a922bba75b8 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -355,6 +355,13 @@ SfxTemplatePanelControl::SfxTemplatePanelControl(SfxBindings* pBindings, vcl::Wi
SfxTemplatePanelControl::~SfxTemplatePanelControl()
{
+ disposeOnce();
+}
+
+void SfxTemplatePanelControl::dispose()
+{
+ pImpl.reset();
+ DockingWindow::dispose();
}
void SfxTemplatePanelControl::DataChanged( const DataChangedEvent& _rDCEvt )
@@ -657,8 +664,8 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, vcl
, xModuleManager(frame::ModuleManager::create(::comphelper::getProcessComponentContext()))
, m_pDeletionWatcher(NULL)
- , aFmtLb(this, WB_BORDER | WB_TABSTOP | WB_SORT | WB_QUICK_SEARCH)
- , aFilterLb(pW, WB_BORDER | WB_DROPDOWN | WB_TABSTOP)
+ , aFmtLb( VclPtr<SfxActionListBox>::Create(this, WB_BORDER | WB_TABSTOP | WB_SORT | WB_QUICK_SEARCH) )
+ , aFilterLb( VclPtr<ListBox>::Create(pW, WB_BORDER | WB_DROPDOWN | WB_TABSTOP) )
, nActFamily(0xffff)
, nActFilter(0)
@@ -682,13 +689,13 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, vcl
, m_bWantHierarchical(false)
, bBindingUpdate(true)
{
- aFmtLb.SetAccessibleName(SfxResId(STR_STYLE_ELEMTLIST).toString());
- aFmtLb.SetHelpId( HID_TEMPLATE_FMT );
- aFilterLb.SetHelpId( HID_TEMPLATE_FILTER );
- aFmtLb.SetStyle( aFmtLb.GetStyle() | WB_SORT | WB_HIDESELECTION );
- vcl::Font aFont = aFmtLb.GetFont();
+ aFmtLb->SetAccessibleName(SfxResId(STR_STYLE_ELEMTLIST).toString());
+ aFmtLb->SetHelpId( HID_TEMPLATE_FMT );
+ aFilterLb->SetHelpId( HID_TEMPLATE_FILTER );
+ aFmtLb->SetStyle( aFmtLb->GetStyle() | WB_SORT | WB_HIDESELECTION );
+ vcl::Font aFont = aFmtLb->GetFont();
aFont.SetWeight( WEIGHT_NORMAL );
- aFmtLb.SetFont( aFont );
+ aFmtLb->SetFont( aFont );
memset(pBoundItems, 0, sizeof(pBoundItems));
memset(pFamilyState, 0, sizeof(pFamilyState));
@@ -850,15 +857,15 @@ void SfxCommonTemplateDialog_Impl::Initialize()
Update_Impl();
- aFilterLb.SetSelectHdl( LINK( this, SfxCommonTemplateDialog_Impl, FilterSelectHdl ) );
- aFmtLb.SetDoubleClickHdl( LINK( this, SfxCommonTemplateDialog_Impl, ApplyHdl ) );
- aFmtLb.SetSelectHdl( LINK( this, SfxCommonTemplateDialog_Impl, FmtSelectHdl ) );
- aFmtLb.SetSelectionMode(MULTIPLE_SELECTION);
+ aFilterLb->SetSelectHdl( LINK( this, SfxCommonTemplateDialog_Impl, FilterSelectHdl ) );
+ aFmtLb->SetDoubleClickHdl( LINK( this, SfxCommonTemplateDialog_Impl, ApplyHdl ) );
+ aFmtLb->SetSelectHdl( LINK( this, SfxCommonTemplateDialog_Impl, FmtSelectHdl ) );
+ aFmtLb->SetSelectionMode(MULTIPLE_SELECTION);
- aFilterLb.Show();
+ aFilterLb->Show();
if (!bHierarchical)
- aFmtLb.Show();
+ aFmtLb->Show();
}
SfxCommonTemplateDialog_Impl::~SfxCommonTemplateDialog_Impl()
@@ -876,10 +883,12 @@ SfxCommonTemplateDialog_Impl::~SfxCommonTemplateDialog_Impl()
if ( pStyleSheetPool )
EndListening(*pStyleSheetPool);
pStyleSheetPool = NULL;
- delete pTreeBox;
+ pTreeBox.disposeAndClear();
delete pIdle;
if ( m_pDeletionWatcher )
m_pDeletionWatcher->signal();
+ aFmtLb.disposeAndClear();
+ aFilterLb.disposeAndClear();
}
namespace SfxTemplate
@@ -979,19 +988,19 @@ void SfxCommonTemplateDialog_Impl::SelectStyle(const OUString &rStr)
bool bSelect = ! rStr.isEmpty();
if ( bSelect )
{
- SvTreeListEntry* pEntry = (SvTreeListEntry*)aFmtLb.FirstVisible();
- while ( pEntry && aFmtLb.GetEntryText( pEntry ) != rStr )
- pEntry = (SvTreeListEntry*)aFmtLb.NextVisible( pEntry );
+ SvTreeListEntry* pEntry = (SvTreeListEntry*)aFmtLb->FirstVisible();
+ while ( pEntry && aFmtLb->GetEntryText( pEntry ) != rStr )
+ pEntry = (SvTreeListEntry*)aFmtLb->NextVisible( pEntry );
if ( !pEntry )
bSelect = false;
else
{
- if (!aFmtLb.IsSelected(pEntry))
+ if (!aFmtLb->IsSelected(pEntry))
{
- aFmtLb.MakeVisible( pEntry );
- aFmtLb.SelectAll(false);
- aFmtLb.Select( pEntry );
- bWaterDisabled = !(pTreeBox || aFmtLb.GetSelectionCount() <= 1);
+ aFmtLb->MakeVisible( pEntry );
+ aFmtLb->SelectAll(false);
+ aFmtLb->Select( pEntry );
+ bWaterDisabled = !(pTreeBox || aFmtLb->GetSelectionCount() <= 1);
FmtSelectHdl( NULL );
}
}
@@ -999,7 +1008,7 @@ void SfxCommonTemplateDialog_Impl::SelectStyle(const OUString &rStr)
if ( !bSelect )
{
- aFmtLb.SelectAll( false );
+ aFmtLb->SelectAll( false );
EnableEdit(false);
EnableHide( false );
EnableShow( false );
@@ -1018,9 +1027,9 @@ OUString SfxCommonTemplateDialog_Impl::GetSelectedEntry() const
}
else
{
- SvTreeListEntry* pEntry = aFmtLb.FirstSelected();
+ SvTreeListEntry* pEntry = aFmtLb->FirstSelected();
if ( pEntry )
- aRet = aFmtLb.GetEntryText( pEntry );
+ aRet = aFmtLb->GetEntryText( pEntry );
}
return aRet;
}
@@ -1104,7 +1113,7 @@ void SfxCommonTemplateDialog_Impl::FillTreeBox()
bool SfxCommonTemplateDialog_Impl::HasSelectedStyle() const
{
return pTreeBox? pTreeBox->FirstSelected() != 0:
- aFmtLb.GetSelectionCount() != 0;
+ aFmtLb->GetSelectionCount() != 0;
}
// internal: Refresh the display
@@ -1145,24 +1154,24 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
if((nFlags & UPDATE_FAMILY) == UPDATE_FAMILY) // Update view type list (Hierarchical, All, etc.
{
CheckItem(nActFamily, true); // check Button in Toolbox
- aFilterLb.SetUpdateMode(false);
- aFilterLb.Clear();
+ aFilterLb->SetUpdateMode(false);
+ aFilterLb->Clear();
//insert hierarchical at the beginning
- sal_uInt16 nPos = aFilterLb.InsertEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString(), 0);
- aFilterLb.SetEntryData( nPos, reinterpret_cast<void*>(SFXSTYLEBIT_ALL) );
+ sal_uInt16 nPos = aFilterLb->InsertEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString(), 0);
+ aFilterLb->SetEntryData( nPos, reinterpret_cast<void*>(SFXSTYLEBIT_ALL) );
const SfxStyleFilter& rFilter = pItem->GetFilterList();
for( size_t i = 0; i < rFilter.size(); ++i)
{
sal_uIntPtr nFilterFlags = rFilter[ i ]->nFlags;
- nPos = aFilterLb.InsertEntry( rFilter[ i ]->aName );
- aFilterLb.SetEntryData( nPos, reinterpret_cast<void*>(nFilterFlags) );
+ nPos = aFilterLb->InsertEntry( rFilter[ i ]->aName );
+ aFilterLb->SetEntryData( nPos, reinterpret_cast<void*>(nFilterFlags) );
}
- if(nActFilter < aFilterLb.GetEntryCount() - 1)
- aFilterLb.SelectEntryPos(nActFilter + 1);
+ if(nActFilter < aFilterLb->GetEntryCount() - 1)
+ aFilterLb->SelectEntryPos(nActFilter + 1);
else
{
nActFilter = 0;
- aFilterLb.SelectEntryPos(1);
+ aFilterLb->SelectEntryPos(1);
SfxFilterTupel* pActT = ( nActFilter < rFilter.size() ) ? rFilter[ nActFilter ] : NULL;
sal_uInt16 nFilterFlags = pActT ? pActT->nFlags : 0;
pStyleSheetPool->SetSearchMask(eFam, nFilterFlags);
@@ -1171,22 +1180,22 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
// if the tree view again, select family hierarchy
if (pTreeBox || m_bWantHierarchical)
{
- aFilterLb.SelectEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString());
+ aFilterLb->SelectEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString());
EnableHierarchical(true);
}
// show maximum 14 entries
- aFilterLb.SetDropDownLineCount( MAX_FILTER_ENTRIES );
- aFilterLb.SetUpdateMode(true);
+ aFilterLb->SetDropDownLineCount( MAX_FILTER_ENTRIES );
+ aFilterLb->SetUpdateMode(true);
}
else
{
- if (nActFilter < aFilterLb.GetEntryCount() - 1)
- aFilterLb.SelectEntryPos(nActFilter + 1);
+ if (nActFilter < aFilterLb->GetEntryCount() - 1)
+ aFilterLb->SelectEntryPos(nActFilter + 1);
else
{
nActFilter = 0;
- aFilterLb.SelectEntryPos(1);
+ aFilterLb->SelectEntryPos(1);
}
}
@@ -1195,7 +1204,7 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
EnableItem(SID_STYLE_WATERCAN,false);
SfxStyleSheetBase *pStyle = pStyleSheetPool->First();
- SvTreeListEntry* pEntry = aFmtLb.First();
+ SvTreeListEntry* pEntry = aFmtLb->First();
std::vector<OUString> aStrings;
comphelper::string::NaturalStringSorter aSorter(
@@ -1215,27 +1224,27 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
size_t nCount = aStrings.size();
size_t nPos = 0;
while(nPos < nCount && pEntry &&
- aStrings[nPos] == aFmtLb.GetEntryText(pEntry))
+ aStrings[nPos] == aFmtLb->GetEntryText(pEntry))
{
++nPos;
- pEntry = aFmtLb.Next( pEntry );
+ pEntry = aFmtLb->Next( pEntry );
}
if( nPos < nCount || pEntry )
{
// Fills the display box
- aFmtLb.SetUpdateMode(false);
- aFmtLb.Clear();
+ aFmtLb->SetUpdateMode(false);
+ aFmtLb->Clear();
for(nPos = 0; nPos < nCount; ++nPos)
{
- SvTreeListEntry* pTreeListEntry = aFmtLb.InsertEntry(aStrings[nPos], 0, false, nPos);
+ SvTreeListEntry* pTreeListEntry = aFmtLb->InsertEntry(aStrings[nPos], 0, false, nPos);
StyleLBoxString* pStyleLBoxString = new StyleLBoxString(pTreeListEntry, 0, aStrings[nPos], eFam);
pTreeListEntry->ReplaceItem(pStyleLBoxString, 1);
- aFmtLb.GetModel()->InvalidateEntry(pTreeListEntry);
+ aFmtLb->GetModel()->InvalidateEntry(pTreeListEntry);
}
- aFmtLb.Recalc();
- aFmtLb.SetUpdateMode(true);
+ aFmtLb->Recalc();
+ aFmtLb->SetUpdateMode(true);
}
// Selects the current style if any
SfxTemplateItem *pState = pFamilyState[nActFamily-1];
@@ -1262,7 +1271,7 @@ void SfxCommonTemplateDialog_Impl::SetWaterCanState(const SfxBoolItem *pItem)
if(!bWaterDisabled)
//make sure the watercan is only activated when there is (only) one selection
- bWaterDisabled = !(pTreeBox || aFmtLb.GetSelectionCount() <= 1);
+ bWaterDisabled = pTreeBox || aFmtLb->GetSelectionCount() <= 1;
if(pItem && !bWaterDisabled)
{
@@ -1597,7 +1606,7 @@ bool SfxCommonTemplateDialog_Impl::Execute_Impl(
if ( !pItem || aDeleted )
return false;
- if ( (nId == SID_STYLE_NEW || SID_STYLE_EDIT == nId) && (pTreeBox || aFmtLb.GetSelectionCount() <= 1) )
+ if ( (nId == SID_STYLE_NEW || SID_STYLE_EDIT == nId) && (pTreeBox || aFmtLb->GetSelectionCount() <= 1) )
{
const SfxUInt16Item *pFilterItem = PTR_CAST(SfxUInt16Item, pItem);
OSL_ENSURE(pFilterItem, "SfxUINT16Item expected");
@@ -1631,15 +1640,16 @@ void SfxCommonTemplateDialog_Impl::EnableHierarchical(bool const bEnable)
m_bWantHierarchical = true;
SaveSelection(); // fdo#61429 store "hierarchical"
const OUString aSelectEntry( GetSelectedEntry());
- aFmtLb.Hide();
+ aFmtLb->Hide();
+
+ pTreeBox = VclPtr<StyleTreeListBox_Impl>::Create(
- pTreeBox = new StyleTreeListBox_Impl(
this, WB_HASBUTTONS | WB_HASLINES |
WB_BORDER | WB_TABSTOP | WB_HASLINESATROOT |
WB_HASBUTTONSATROOT | WB_HIDESELECTION | WB_QUICK_SEARCH );
- pTreeBox->SetFont( aFmtLb.GetFont() );
+ pTreeBox->SetFont( aFmtLb->GetFont() );
- pTreeBox->SetPosSizePixel(aFmtLb.GetPosPixel(), aFmtLb.GetSizePixel());
+ pTreeBox->SetPosSizePixel(aFmtLb->GetPosPixel(), aFmtLb->GetSizePixel());
pTreeBox->SetNodeDefaultImages();
pTreeBox->SetSelectHdl(
LINK(this, SfxCommonTemplateDialog_Impl, FmtSelectHdl));
@@ -1655,12 +1665,12 @@ void SfxCommonTemplateDialog_Impl::EnableHierarchical(bool const bEnable)
}
else
{
- DELETEZ(pTreeBox);
- aFmtLb.Show();
+ pTreeBox.disposeAndClear();
+ aFmtLb->Show();
// If bHierarchical, then the family can have changed
// minus one since hierarchical is inserted at the start
m_bWantHierarchical = false; // before FilterSelect
- FilterSelect(aFilterLb.GetSelectEntryPos() - 1, bHierarchical );
+ FilterSelect(aFilterLb->GetSelectEntryPos() - 1, bHierarchical );
bHierarchical=false;
}
}
@@ -1742,8 +1752,8 @@ void SfxCommonTemplateDialog_Impl::ActionSelect(sal_uInt16 nEntry)
nFilter=pStyleSheetPool->GetSearchMask();
pStyleSheetPool->SetSearchMask( eFam, SFXSTYLEBIT_USERDEF );
- std::unique_ptr<SfxNewStyleDlg> pDlg(new SfxNewStyleDlg(pWindow, *pStyleSheetPool));
- // why? : FloatingWindow must not be parent of a modal dialog
+ ScopedVclPtrInstance< SfxNewStyleDlg > pDlg(pWindow, *pStyleSheetPool);
+ // why? : FloatingWindow must not be parent of a modal dialog
if(RET_OK == pDlg->Execute())
{
pStyleSheetPool->SetSearchMask(eFam, nFilter);
@@ -1847,7 +1857,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, DropHdl, StyleTreeListBox_Impl *, pBox
void SfxCommonTemplateDialog_Impl::NewHdl(void *)
{
OUString aEmpty;
- if ( nActFamily != 0xffff && (pTreeBox || aFmtLb.GetSelectionCount() <= 1))
+ if ( nActFamily != 0xffff && (pTreeBox || aFmtLb->GetSelectionCount() <= 1))
{
vcl::Window* pTmp;
pTmp = Application::GetDefDialogParent();
@@ -1910,7 +1920,7 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *)
bool bUsedStyle = false; // one of the selected styles are used in the document?
std::vector<SvTreeListEntry*> aList;
- SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb.FirstSelected();
+ SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb->FirstSelected();
const SfxStyleFamilyItem* pItem = GetFamilyItem_Impl();
OUString aMsg = SfxResId(STR_DELETE_STYLE_USED).toString();
@@ -1920,7 +1930,7 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *)
{
aList.push_back( pEntry );
// check the style is used or not
- const OUString aTemplName(pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb.GetEntryText(pEntry));
+ const OUString aTemplName(pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb->GetEntryText(pEntry));
SfxStyleSheetBase* pStyle = pStyleSheetPool->Find( aTemplName, pItem->GetFamily(), SFXSTYLEBIT_ALL );
@@ -1932,7 +1942,7 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *)
bUsedStyle = true;
}
- pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb.NextSelected(pEntry);
+ pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb->NextSelected(pEntry);
}
bool aApproved = false;
@@ -1941,13 +1951,13 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *)
if ( bUsedStyle )
{
#if defined UNX
- MessageDialog aBox(SfxGetpApp()->GetTopWindow(), aMsg,
+ ScopedVclPtrInstance<MessageDialog> aBox(SfxGetpApp()->GetTopWindow(), aMsg,
VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
#else
- MessageDialog aBox(GetWindow(), aMsg,
+ ScopedVclPtrInstance<MessageDialog> aBox(GetWindow(), aMsg,
VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
#endif
- aApproved = aBox.Execute() == RET_YES;
+ aApproved = aBox->Execute() == RET_YES;
}
// if there are no used styles selected or the user approved the changes
@@ -1957,7 +1967,7 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *)
for (; it != itEnd; ++it)
{
- const OUString aTemplName(pTreeBox ? pTreeBox->GetEntryText(*it) : aFmtLb.GetEntryText(*it));
+ const OUString aTemplName(pTreeBox ? pTreeBox->GetEntryText(*it) : aFmtLb->GetEntryText(*it));
bDontUpdate = true; // To prevent the Treelistbox to shut down while deleting
Execute_Impl( SID_STYLE_DELETE, aTemplName,
OUString(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily() );
@@ -1978,16 +1988,16 @@ void SfxCommonTemplateDialog_Impl::HideHdl(void *)
{
if ( IsInitialized() && HasSelectedStyle() )
{
- SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb.FirstSelected();
+ SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb->FirstSelected();
while (pEntry)
{
- OUString aTemplName = pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb.GetEntryText(pEntry);
+ OUString aTemplName = pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb->GetEntryText(pEntry);
Execute_Impl( SID_STYLE_HIDE, aTemplName,
OUString(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily() );
- pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb.NextSelected(pEntry);
+ pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb->NextSelected(pEntry);
}
}
}
@@ -1997,16 +2007,16 @@ void SfxCommonTemplateDialog_Impl::ShowHdl(void *)
if ( IsInitialized() && HasSelectedStyle() )
{
- SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb.FirstSelected();
+ SvTreeListEntry* pEntry = pTreeBox ? pTreeBox->FirstSelected() : aFmtLb->FirstSelected();
while (pEntry)
{
- OUString aTemplName = pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb.GetEntryText(pEntry);
+ OUString aTemplName = pTreeBox ? pTreeBox->GetEntryText(pEntry) : aFmtLb->GetEntryText(pEntry);
Execute_Impl( SID_STYLE_SHOW, aTemplName,
OUString(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily() );
- pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb.NextSelected(pEntry);
+ pEntry = pTreeBox ? pTreeBox->NextSelected(pEntry) : aFmtLb->NextSelected(pEntry);
}
}
}
@@ -2064,7 +2074,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, ApplyHdl, Control *, pControl )
if ( IsInitialized() && 0 != pFamilyState[nActFamily-1] &&
!GetSelectedEntry().isEmpty() )
{
- sal_uInt16 nModifier = aFmtLb.GetModifier();
+ sal_uInt16 nModifier = aFmtLb->GetModifier();
Execute_Impl(SID_STYLE_APPLY,
GetSelectedEntry(), OUString(),
( sal_uInt16 )GetFamilyItem_Impl()->GetFamily(),
@@ -2084,7 +2094,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FmtSelectHdl, SvTreeListBox *, pListBox
if ( IsInitialized() &&
IsCheckedItem(SID_STYLE_WATERCAN) &&
// only if that region is allowed
- 0 != pFamilyState[nActFamily-1] && (pTreeBox || aFmtLb.GetSelectionCount() <= 1) )
+ 0 != pFamilyState[nActFamily-1] && (pTreeBox || aFmtLb->GetSelectionCount() <= 1) )
{
OUString aEmpty;
Execute_Impl(SID_STYLE_WATERCAN,
@@ -2100,7 +2110,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FmtSelectHdl, SvTreeListBox *, pListBox
{
SelectStyle( pListBox->GetEntryText( pListBox->GetHdlEntry() ));
#if defined STYLESPREVIEW
- sal_uInt16 nModifier = aFmtLb.GetModifier();
+ sal_uInt16 nModifier = aFmtLb->GetModifier();
if ( mbIgnoreSelect )
{
Execute_Impl(SID_STYLE_END_PREVIEW,
@@ -2155,10 +2165,10 @@ void SfxCommonTemplateDialog_Impl::EnableExample_Impl(sal_uInt16 nId, bool bEnab
{
if( nId == SID_STYLE_NEW_BY_EXAMPLE )
{
- bNewByExampleDisabled = !(pTreeBox || aFmtLb.GetSelectionCount() <= 1) || !bEnable;
+ bNewByExampleDisabled = !(pTreeBox || aFmtLb->GetSelectionCount() <= 1) || !bEnable;
}
else if( nId == SID_STYLE_UPDATE_BY_EXAMPLE )
- bUpdateByExampleDisabled = !(pTreeBox || aFmtLb.GetSelectionCount() <= 1) || !bEnable;
+ bUpdateByExampleDisabled = !(pTreeBox || aFmtLb->GetSelectionCount() <= 1) || !bEnable;
EnableItem(nId, bEnable);
}
@@ -2186,8 +2196,8 @@ SfxTemplateDialog_Impl::SfxTemplateDialog_Impl(SfxBindings* pB, SfxTemplatePanel
: SfxCommonTemplateDialog_Impl(pB, pDlgWindow, true)
, m_pFloat(pDlgWindow)
, m_bZoomIn(false)
- , m_aActionTbL(pDlgWindow, this)
- , m_aActionTbR(pDlgWindow, SfxResId(TB_ACTION))
+ , m_aActionTbL(VclPtrInstance<DropToolBox_Impl>(pDlgWindow, this))
+ , m_aActionTbR(VclPtrInstance<ToolBox> (pDlgWindow, SfxResId(TB_ACTION)))
{
pDlgWindow->FreeResource();
Initialize();
@@ -2197,20 +2207,20 @@ void SfxTemplateDialog_Impl::Initialize()
{
SfxCommonTemplateDialog_Impl::Initialize();
- m_aActionTbL.SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxLSelect));
- m_aActionTbR.SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxRSelect));
- m_aActionTbR.SetDropdownClickHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxRClick));
- m_aActionTbL.Show();
- m_aActionTbR.Show();
- vcl::Font aFont = aFilterLb.GetFont();
- aFont.SetWeight(WEIGHT_NORMAL);
- aFilterLb.SetFont(aFont);
- m_aActionTbL.SetHelpId(HID_TEMPLDLG_TOOLBOX_LEFT);
+ m_aActionTbL->SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxLSelect));
+ m_aActionTbR->SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxRSelect));
+ m_aActionTbR->SetDropdownClickHdl(LINK(this, SfxTemplateDialog_Impl, ToolBoxRClick));
+ m_aActionTbL->Show();
+ m_aActionTbR->Show();
+ vcl::Font aFont = aFilterLb->GetFont();
+ aFont.SetWeight( WEIGHT_NORMAL );
+ aFilterLb->SetFont( aFont );
+ m_aActionTbL->SetHelpId( HID_TEMPLDLG_TOOLBOX_LEFT );
}
void SfxTemplateDialog_Impl::EnableFamilyItem( sal_uInt16 nId, bool bEnable )
{
- m_aActionTbL.EnableItem( nId, bEnable );
+ m_aActionTbL->EnableItem( nId, bEnable );
}
// Insert element into dropdown filter "Frame Styles", "List Styles", etc.
@@ -2226,15 +2236,15 @@ void SfxTemplateDialog_Impl::InsertFamilyItem(sal_uInt16 nId,const SfxStyleFamil
case SFX_STYLE_FAMILY_PSEUDO: sHelpId = ".uno:ListStyle"; break;
default: OSL_FAIL("unknown StyleFamily"); break;
}
- m_aActionTbL.InsertItem( nId, pItem->GetImage(), pItem->GetText(), ToolBoxItemBits::NONE, 0);
- m_aActionTbL.SetHelpId( nId, sHelpId );
+ m_aActionTbL->InsertItem( nId, pItem->GetImage(), pItem->GetText(), ToolBoxItemBits::NONE, 0);
+ m_aActionTbL->SetHelpId( nId, sHelpId );
}
void SfxTemplateDialog_Impl::ReplaceUpdateButtonByMenu()
{
- m_aActionTbR.HideItem(SID_STYLE_UPDATE_BY_EXAMPLE);
- m_aActionTbR.SetItemBits(SID_STYLE_NEW_BY_EXAMPLE,
- ToolBoxItemBits::DROPDOWNONLY | m_aActionTbR.GetItemBits( SID_STYLE_NEW_BY_EXAMPLE ));
+ m_aActionTbR->HideItem(SID_STYLE_UPDATE_BY_EXAMPLE);
+ m_aActionTbR->SetItemBits( SID_STYLE_NEW_BY_EXAMPLE,
+ ToolBoxItemBits::DROPDOWNONLY|m_aActionTbR->GetItemBits( SID_STYLE_NEW_BY_EXAMPLE ));
}
void SfxTemplateDialog_Impl::updateFamilyImages()
@@ -2252,18 +2262,18 @@ void SfxTemplateDialog_Impl::updateFamilyImages()
{
const SfxStyleFamilyItem *pItem = pStyleFamilies->at( nLoop );
sal_uInt16 nId = SfxTemplate::SfxFamilyIdToNId( pItem->GetFamily() );
- m_aActionTbL.SetItemImage( nId, pItem->GetImage() );
+ m_aActionTbL->SetItemImage( nId, pItem->GetImage() );
}
}
void SfxTemplateDialog_Impl::updateNonFamilyImages()
{
- m_aActionTbR.SetImageList( ImageList( SfxResId( DLG_STYLE_DESIGNER ) ) );
+ m_aActionTbR->SetImageList( ImageList( SfxResId( DLG_STYLE_DESIGNER ) ) );
}
void SfxTemplateDialog_Impl::ClearFamilyList()
{
- m_aActionTbL.Clear();
+ m_aActionTbL->Clear();
}
void SfxCommonTemplateDialog_Impl::InvalidateBindings()
@@ -2282,6 +2292,9 @@ void SfxCommonTemplateDialog_Impl::InvalidateBindings()
SfxTemplateDialog_Impl::~SfxTemplateDialog_Impl()
{
+ m_pFloat.clear();
+ m_aActionTbL.disposeAndClear();
+ m_aActionTbR.disposeAndClear();
}
void SfxTemplateDialog_Impl::LoadedFamilies()
@@ -2294,7 +2307,7 @@ void SfxTemplateDialog_Impl::LoadedFamilies()
// The size of the Listboxen is adjusted
void SfxTemplateDialog_Impl::Resize()
{
- SfxDockingWindow* pDockingWindow = dynamic_cast<SfxDockingWindow*>(m_pFloat);
+ SfxDockingWindow* pDockingWindow = dynamic_cast<SfxDockingWindow*>(m_pFloat.get());
FloatingWindow *pF = pDockingWindow!=NULL ? pDockingWindow->GetFloatingWindow() : NULL;
if (pF)
{
@@ -2303,30 +2316,30 @@ void SfxTemplateDialog_Impl::Resize()
return;
}
- if (m_pFloat == NULL)
+ if (m_pFloat == nullptr)
return;
Size aDlgSize=m_pFloat->PixelToLogic(m_pFloat->GetOutputSizePixel());
- Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL.CalcWindowSizePixel());
- Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR.CalcWindowSizePixel());
+ Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL->CalcWindowSizePixel());
+ Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR->CalcWindowSizePixel());
Size aMinSize = GetMinOutputSizePixel();
- long nListHeight = m_pFloat->PixelToLogic( aFilterLb.GetSizePixel() ).Height();
+ long nListHeight = m_pFloat->PixelToLogic( aFilterLb->GetSizePixel() ).Height();
long nWidth = aDlgSize.Width()- 2 * SFX_TEMPLDLG_HFRAME;
- m_aActionTbL.SetPosSizePixel(m_pFloat->LogicToPixel(Point(SFX_TEMPLDLG_HFRAME,SFX_TEMPLDLG_VTOPFRAME)),
+ m_aActionTbL->SetPosSizePixel(m_pFloat->LogicToPixel(Point(SFX_TEMPLDLG_HFRAME,SFX_TEMPLDLG_VTOPFRAME)),
m_pFloat->LogicToPixel(aSizeATL));
// only change the position of the right toolbox, when the window is wide
// enough
Point aPosATR(aDlgSize.Width()-SFX_TEMPLDLG_HFRAME-aSizeATR.Width(),SFX_TEMPLDLG_VTOPFRAME);
if(aDlgSize.Width() >= aMinSize.Width())
- m_aActionTbR.SetPosPixel(m_pFloat->LogicToPixel(aPosATR));
+ m_aActionTbR->SetPosPixel(m_pFloat->LogicToPixel(aPosATR));
else
- m_aActionTbR.SetPosPixel( m_pFloat->LogicToPixel(
+ m_aActionTbR->SetPosPixel( m_pFloat->LogicToPixel(
Point( SFX_TEMPLDLG_HFRAME + aSizeATL.Width() + SFX_TEMPLDLG_MIDHSPACE,
SFX_TEMPLDLG_VTOPFRAME ) ) );
- m_aActionTbR.SetSizePixel(m_pFloat->LogicToPixel(aSizeATR));
+ m_aActionTbR->SetSizePixel(m_pFloat->LogicToPixel(aSizeATR));
Point aFilterPos(
m_pFloat->LogicToPixel(Point(SFX_TEMPLDLG_HFRAME,
@@ -2347,26 +2360,26 @@ void SfxTemplateDialog_Impl::Resize()
// only change the position of the listbox, when the window is high enough
if(aDlgSize.Height() >= aMinSize.Height())
{
- aFilterLb.SetPosPixel(aFilterPos);
- aFmtLb.SetPosPixel( aFmtPos );
+ aFilterLb->SetPosPixel(aFilterPos);
+ aFmtLb->SetPosPixel( aFmtPos );
if(pTreeBox)
pTreeBox->SetPosPixel(aFmtPos);
}
else
aFmtSize.Height() += aFilterSize.Height();
- aFilterLb.SetSizePixel(aFilterSize);
- aFmtLb.SetSizePixel( aFmtSize );
+ aFilterLb->SetSizePixel(aFilterSize);
+ aFmtLb->SetSizePixel( aFmtSize );
if(pTreeBox)
pTreeBox->SetSizePixel(aFmtSize);
}
Size SfxTemplateDialog_Impl::GetMinOutputSizePixel()
{
- if (m_pFloat != NULL)
+ if (m_pFloat != nullptr)
{
- Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL.CalcWindowSizePixel());
- Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR.CalcWindowSizePixel());
+ Size aSizeATL=m_pFloat->PixelToLogic(m_aActionTbL->CalcWindowSizePixel());
+ Size aSizeATR=m_pFloat->PixelToLogic(m_aActionTbR->CalcWindowSizePixel());
Size aMinSize=Size(
aSizeATL.Width()+aSizeATR.Width()+
2*SFX_TEMPLDLG_HFRAME + SFX_TEMPLDLG_MIDHSPACE,
@@ -2388,7 +2401,7 @@ void SfxTemplateDialog_Impl::EnableItem(sal_uInt16 nMesId, bool bCheck)
//fall-through
case SID_STYLE_NEW_BY_EXAMPLE:
case SID_STYLE_UPDATE_BY_EXAMPLE:
- m_aActionTbR.EnableItem(nMesId,bCheck);
+ m_aActionTbR->EnableItem(nMesId,bCheck);
break;
}
}
@@ -2399,10 +2412,10 @@ void SfxTemplateDialog_Impl::CheckItem(sal_uInt16 nMesId, bool bCheck)
{
case SID_STYLE_WATERCAN :
bIsWater=bCheck;
- m_aActionTbR.CheckItem(SID_STYLE_WATERCAN,bCheck);
+ m_aActionTbR->CheckItem(SID_STYLE_WATERCAN,bCheck);
break;
default:
- m_aActionTbL.CheckItem(nMesId,bCheck); break;
+ m_aActionTbL->CheckItem(nMesId,bCheck); break;
}
}
@@ -2411,9 +2424,9 @@ bool SfxTemplateDialog_Impl::IsCheckedItem(sal_uInt16 nMesId)
switch(nMesId)
{
case SID_STYLE_WATERCAN :
- return m_aActionTbR.GetItemState(SID_STYLE_WATERCAN)==TRISTATE_TRUE;
+ return m_aActionTbR->GetItemState(SID_STYLE_WATERCAN)==TRISTATE_TRUE;
default:
- return m_aActionTbL.GetItemState(nMesId)==TRISTATE_TRUE;
+ return m_aActionTbL->GetItemState(nMesId)==TRISTATE_TRUE;
}
}
@@ -2542,7 +2555,7 @@ void SfxCommonTemplateDialog_Impl::UpdateFamily_Impl()
}
bWaterDisabled = false;
- bCanNew = pTreeBox || aFmtLb.GetSelectionCount() <= 1;
+ bCanNew = pTreeBox || aFmtLb->GetSelectionCount() <= 1;
bTreeDrag = true;
bUpdateByExampleDisabled = false;
@@ -2582,10 +2595,6 @@ DropToolBox_Impl::DropToolBox_Impl(vcl::Window* pParent, SfxTemplateDialog_Impl*
{
}
-DropToolBox_Impl::~DropToolBox_Impl()
-{
-}
-
sal_Int8 DropToolBox_Impl::AcceptDrop( const AcceptDropEvent& rEvt )
{
sal_Int8 nReturn = DND_ACTION_NONE;
@@ -2608,7 +2617,7 @@ sal_Int8 DropToolBox_Impl::AcceptDrop( const AcceptDropEvent& rEvt )
sal_Int8 DropToolBox_Impl::ExecuteDrop( const ExecuteDropEvent& rEvt )
{
- return rParent.aFmtLb.ExecuteDrop(rEvt);
+ return rParent.aFmtLb->ExecuteDrop(rEvt);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/titledockwin.cxx b/sfx2/source/dialog/titledockwin.cxx
index 66aa91b1f218..6b3c98945139 100644
--- a/sfx2/source/dialog/titledockwin.cxx
+++ b/sfx2/source/dialog/titledockwin.cxx
@@ -35,8 +35,8 @@ namespace sfx2
WinBits i_nStyle )
:SfxDockingWindow( i_pBindings, i_pChildWindow, i_pParent, i_nStyle )
,m_sTitle()
- ,m_aToolbox( this )
- ,m_aContentWindow( this, WB_DIALOGCONTROL )
+ ,m_aToolbox( VclPtr<ToolBox>::Create(this) )
+ ,m_aContentWindow( VclPtr<vcl::Window>::Create(this, WB_DIALOGCONTROL) )
,m_aBorder( 3, 1, 3, 3 )
,m_bLayoutPending( false )
,m_nTitleBarHeight(0)
@@ -48,19 +48,26 @@ namespace sfx2
{
SetBackground( Wallpaper() );
- m_aToolbox.SetSelectHdl( LINK( this, TitledDockingWindow, OnToolboxItemSelected ) );
- m_aToolbox.SetOutStyle( TOOLBOX_STYLE_FLAT );
- m_aToolbox.SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetDialogColor() ) );
- m_aToolbox.Show();
+ m_aToolbox->SetSelectHdl( LINK( this, TitledDockingWindow, OnToolboxItemSelected ) );
+ m_aToolbox->SetOutStyle( TOOLBOX_STYLE_FLAT );
+ m_aToolbox->SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetDialogColor() ) );
+ m_aToolbox->Show();
impl_resetToolBox();
- m_aContentWindow.Show();
+ m_aContentWindow->Show();
}
TitledDockingWindow::~TitledDockingWindow()
{
+ disposeOnce();
}
+ void TitledDockingWindow::dispose()
+ {
+ m_aToolbox.disposeAndClear();
+ m_aContentWindow.disposeAndClear();
+ SfxDockingWindow::dispose();
+ }
void TitledDockingWindow::SetTitle( const OUString& i_rTitle )
{
@@ -101,16 +108,16 @@ namespace sfx2
{
m_bLayoutPending = false;
- m_aToolbox.ShowItem( 1, !IsFloatingMode() );
+ m_aToolbox->ShowItem( 1, !IsFloatingMode() );
- const Size aToolBoxSize( m_aToolbox.CalcWindowSizePixel() );
+ const Size aToolBoxSize( m_aToolbox->CalcWindowSizePixel() );
Size aWindowSize( GetOutputSizePixel() );
// position the tool box
m_nTitleBarHeight = GetSettings().GetStyleSettings().GetTitleHeight();
if ( aToolBoxSize.Height() > m_nTitleBarHeight )
m_nTitleBarHeight = aToolBoxSize.Height();
- m_aToolbox.SetPosSizePixel(
+ m_aToolbox->SetPosSizePixel(
Point(
aWindowSize.Width() - aToolBoxSize.Width(),
( m_nTitleBarHeight - aToolBoxSize.Height() ) / 2
@@ -122,7 +129,7 @@ namespace sfx2
if ( m_nTitleBarHeight < aToolBoxSize.Height() )
m_nTitleBarHeight = aToolBoxSize.Height();
aWindowSize.Height() -= m_nTitleBarHeight;
- m_aContentWindow.SetPosSizePixel(
+ m_aContentWindow->SetPosSizePixel(
Point( m_aBorder.Left(), m_nTitleBarHeight + m_aBorder.Top() ),
Size(
aWindowSize.Width() - m_aBorder.Left() - m_aBorder.Right(),
@@ -209,24 +216,24 @@ namespace sfx2
void TitledDockingWindow::impl_resetToolBox()
{
- m_aToolbox.Clear();
+ m_aToolbox->Clear();
// Get the closer bitmap and set it as right most button.
Image aImage( SfxResId( SFX_IMG_CLOSE_DOC ) );
- m_aToolbox.InsertItem( 1, aImage );
- m_aToolbox.ShowItem( 1 );
+ m_aToolbox->InsertItem( 1, aImage );
+ m_aToolbox->ShowItem( 1 );
}
sal_uInt16 TitledDockingWindow::impl_addDropDownToolBoxItem( const OUString& i_rItemText, const OString& i_nHelpId, const Link& i_rCallback )
{
// Add the menu before the closer button.
- const sal_uInt16 nItemCount( m_aToolbox.GetItemCount() );
+ const sal_uInt16 nItemCount( m_aToolbox->GetItemCount() );
const sal_uInt16 nItemId( nItemCount + 1 );
- m_aToolbox.InsertItem( nItemId, i_rItemText, ToolBoxItemBits::DROPDOWNONLY, nItemCount > 0 ? nItemCount - 1 : TOOLBOX_APPEND );
- m_aToolbox.SetHelpId( nItemId, i_nHelpId );
- m_aToolbox.SetClickHdl( i_rCallback );
- m_aToolbox.SetDropdownClickHdl( i_rCallback );
+ m_aToolbox->InsertItem( nItemId, i_rItemText, ToolBoxItemBits::DROPDOWNONLY, nItemCount > 0 ? nItemCount - 1 : TOOLBOX_APPEND );
+ m_aToolbox->SetHelpId( nItemId, i_nHelpId );
+ m_aToolbox->SetClickHdl( i_rCallback );
+ m_aToolbox->SetDropdownClickHdl( i_rCallback );
// The tool box has likely changed its size. The title bar has to be
// resized.
diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx
index 8da102ca1355..687a6cdd298e 100644
--- a/sfx2/source/dialog/versdlg.cxx
+++ b/sfx2/source/dialog/versdlg.cxx
@@ -213,7 +213,7 @@ SfxVersionDialog::SfxVersionDialog ( SfxViewFrame* pVwFrame, bool bIsSaveVersion
pContainer->set_width_request(aControlSize.Width());
pContainer->set_height_request(aControlSize.Height());
- m_pVersionBox = new SfxVersionsTabListBox_Impl(*pContainer, WB_TABSTOP);
+ m_pVersionBox = VclPtr<SfxVersionsTabListBox_Impl>::Create(*pContainer, WB_TABSTOP);
Link aClickLink = LINK( this, SfxVersionDialog, ButtonHdl_Impl );
m_pViewButton->SetClickHdl ( aClickLink );
@@ -329,8 +329,21 @@ void SfxVersionDialog::Init_Impl()
SfxVersionDialog::~SfxVersionDialog()
{
+ disposeOnce();
+}
+
+void SfxVersionDialog::dispose()
+{
delete m_pTable;
- delete m_pVersionBox;
+ m_pVersionBox.disposeAndClear();
+ m_pSaveButton.clear();
+ m_pSaveCheckBox.clear();
+ m_pOpenButton.clear();
+ m_pViewButton.clear();
+ m_pDeleteButton.clear();
+ m_pCompareButton.clear();
+ m_pCmisButton.clear();
+ SfxModalDialog::dispose();
}
void SfxVersionDialog::Open_Impl()
@@ -394,7 +407,7 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton )
{
SfxVersionInfo aInfo;
aInfo.aAuthor = SvtUserOptions().GetFullName();
- boost::scoped_ptr<SfxViewVersionDialog_Impl> pDlg(new SfxViewVersionDialog_Impl(this, aInfo, true));
+ VclPtrInstance< SfxViewVersionDialog_Impl > pDlg(this, aInfo, true);
short nRet = pDlg->Execute();
if ( nRet == RET_OK )
{
@@ -426,7 +439,7 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton )
else if (pButton == m_pViewButton && pEntry)
{
SfxVersionInfo* pInfo = static_cast<SfxVersionInfo*>(pEntry->GetUserData());
- boost::scoped_ptr<SfxViewVersionDialog_Impl> pDlg(new SfxViewVersionDialog_Impl(this, *pInfo, false));
+ VclPtrInstance<SfxViewVersionDialog_Impl> pDlg(this, *pInfo, false);
pDlg->Execute();
}
else if (pEntry && pButton == m_pCompareButton)
@@ -449,7 +462,7 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton )
}
else if (pButton == m_pCmisButton)
{
- boost::scoped_ptr<SfxCmisVersionsDialog> pDlg(new SfxCmisVersionsDialog(pViewFrame, false));
+ VclPtrInstance< SfxCmisVersionsDialog > pDlg(pViewFrame, false);
pDlg->Execute();
}
@@ -493,6 +506,22 @@ SfxViewVersionDialog_Impl::SfxViewVersionDialog_Impl(vcl::Window *pParent, SfxVe
}
}
+SfxViewVersionDialog_Impl::~SfxViewVersionDialog_Impl()
+{
+ disposeOnce();
+}
+
+void SfxViewVersionDialog_Impl::dispose()
+{
+ m_pDateTimeText.clear();
+ m_pSavedByText.clear();
+ m_pEdit.clear();
+ m_pOKButton.clear();
+ m_pCancelButton.clear();
+ m_pCloseButton.clear();
+ SfxModalDialog::dispose();
+}
+
IMPL_LINK(SfxViewVersionDialog_Impl, ButtonHdl, Button*, pButton)
{
assert(pButton == m_pOKButton);
@@ -519,7 +548,7 @@ SfxCmisVersionsDialog::SfxCmisVersionsDialog ( SfxViewFrame* pVwFrame, bool bIsS
pContainer->set_width_request(aControlSize.Width());
pContainer->set_height_request(aControlSize.Height());
- m_pVersionBox = new SfxVersionsTabListBox_Impl(*pContainer, WB_TABSTOP);
+ m_pVersionBox = VclPtr<SfxVersionsTabListBox_Impl>::Create(*pContainer, WB_TABSTOP);
m_pVersionBox->GrabFocus();
m_pVersionBox->SetStyle( m_pVersionBox->GetStyle() | WB_HSCROLL | WB_CLIPCHILDREN );
@@ -557,8 +586,18 @@ SfxCmisVersionsDialog::SfxCmisVersionsDialog ( SfxViewFrame* pVwFrame, bool bIsS
SfxCmisVersionsDialog::~SfxCmisVersionsDialog()
{
+ disposeOnce();
+}
+
+void SfxCmisVersionsDialog::dispose()
+{
delete m_pTable;
- delete m_pVersionBox;
+ m_pVersionBox.disposeAndClear();
+ m_pOpenButton.clear();
+ m_pViewButton.clear();
+ m_pDeleteButton.clear();
+ m_pCompareButton.clear();
+ SfxModalDialog::dispose();
}
void SfxCmisVersionsDialog::LoadVersions()
diff --git a/sfx2/source/doc/QuerySaveDocument.cxx b/sfx2/source/doc/QuerySaveDocument.cxx
index 63d458f1c955..a6f5ec97b73f 100644
--- a/sfx2/source/doc/QuerySaveDocument.cxx
+++ b/sfx2/source/doc/QuerySaveDocument.cxx
@@ -29,9 +29,9 @@ short ExecuteQuerySaveDocument(vcl::Window* _pParent, const OUString& _rTitle)
return RET_NO;
}
- MessageDialog aQBox(_pParent, "QuerySaveDialog", "sfx/ui/querysavedialog.ui");
- aQBox.set_primary_text(aQBox.get_primary_text().replaceFirst("$(DOC)", _rTitle));
- return aQBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aQBox(_pParent, "QuerySaveDialog", "sfx/ui/querysavedialog.ui");
+ aQBox->set_primary_text(aQBox->get_primary_text().replaceFirst("$(DOC)", _rTitle));
+ return aQBox->Execute();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/doc/docinsert.cxx b/sfx2/source/doc/docinsert.cxx
index d114453f1ce3..bd3ba50f01e3 100644
--- a/sfx2/source/doc/docinsert.cxx
+++ b/sfx2/source/doc/docinsert.cxx
@@ -190,12 +190,12 @@ IMPL_LINK_NOARG(DocumentInserter, DialogClosedHdl)
if ( ( aValue >>= bPassWord ) && bPassWord )
{
// ask for the password
- SfxPasswordDialog aPasswordDlg( NULL );
- aPasswordDlg.ShowExtras( SfxShowExtras::CONFIRM );
- short nRet = aPasswordDlg.Execute();
+ ScopedVclPtrInstance< SfxPasswordDialog > aPasswordDlg(nullptr);
+ aPasswordDlg->ShowExtras( SfxShowExtras::CONFIRM );
+ short nRet = aPasswordDlg->Execute();
if ( RET_OK == nRet )
{
- OUString aPasswd = aPasswordDlg.GetPassword();
+ OUString aPasswd = aPasswordDlg->GetPassword();
m_pItemSet->Put( SfxStringItem( SID_PASSWORD, aPasswd ) );
}
else
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index b33e4f865f4d..a4d4ef71da69 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -138,7 +138,8 @@ class WaitWindow_Impl : public WorkWindow
public:
WaitWindow_Impl();
- virtual ~WaitWindow_Impl();
+ virtual ~WaitWindow_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
};
@@ -470,8 +471,7 @@ void SfxDocTplService_Impl::init_Impl()
aGuard.clear();
SolarMutexClearableGuard aSolarGuard;
- WaitWindow_Impl* pWin = new WaitWindow_Impl();
-
+ VclPtrInstance< WaitWindow_Impl > pWin;
aSolarGuard.clear();
::osl::ClearableMutexGuard anotherGuard( maMutex );
@@ -480,7 +480,7 @@ void SfxDocTplService_Impl::init_Impl()
anotherGuard.clear();
SolarMutexGuard aSecondSolarGuard;
- delete pWin;
+ pWin.disposeAndClear();
}
else if ( needsUpdate() )
// the UI should be shown only on the first update
@@ -2449,7 +2449,13 @@ WaitWindow_Impl::WaitWindow_Impl()
WaitWindow_Impl::~WaitWindow_Impl()
{
+ disposeOnce();
+}
+
+void WaitWindow_Impl::dispose()
+{
Hide();
+ WorkWindow::dispose();
}
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 9610a8bd222b..a3aef2d2a21a 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -667,9 +667,9 @@ sal_Int8 ModelData_Impl::CheckSaveAcceptable( sal_Int8 nCurStatus )
{
// notify the user that SaveAs is going to be done
vcl::Window* pWin = SfxStoringHelper::GetModelWindow( m_xModel );
- MessageDialog aMessageBox(pWin, SfxResId(STR_NEW_FILENAME_SAVE),
+ ScopedVclPtrInstance<MessageDialog> aMessageBox(pWin, SfxResId(STR_NEW_FILENAME_SAVE),
VCL_MESSAGE_QUESTION, VCL_BUTTONS_OK_CANCEL);
- if ( aMessageBox.Execute() == RET_OK )
+ if ( aMessageBox->Execute() == RET_OK )
nResult = STATUS_SAVEAS;
else
nResult = STATUS_NO_ACTION;
@@ -1882,9 +1882,9 @@ bool SfxStoringHelper::WarnUnacceptableFormat( const uno::Reference< frame::XMod
return true;
vcl::Window* pWin = SfxStoringHelper::GetModelWindow( xModel );
- SfxAlienWarningDialog aDlg( pWin, aOldUIName, aDefExtension, bDefIsAlien );
+ ScopedVclPtrInstance< SfxAlienWarningDialog > aDlg( pWin, aOldUIName, aDefExtension, bDefIsAlien );
- return aDlg.Execute() == RET_OK;
+ return aDlg->Execute() == RET_OK;
}
vcl::Window* SfxStoringHelper::GetModelWindow( const uno::Reference< frame::XModel >& xModel )
diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx
index a3dc009a9e38..0564141cb174 100644
--- a/sfx2/source/doc/iframe.cxx
+++ b/sfx2/source/doc/iframe.cxx
@@ -174,7 +174,7 @@ throw( uno::RuntimeException, std::exception )
{
DBG_ASSERT( !mxFrame.is(), "Frame already existing!" );
vcl::Window* pParent = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
- IFrameWindow_Impl* pWin = new IFrameWindow_Impl( pParent, maFrmDescr.IsFrameBorderOn() );
+ VclPtr<IFrameWindow_Impl> pWin = VclPtr<IFrameWindow_Impl>::Create( pParent, maFrmDescr.IsFrameBorderOn() );
pWin->SetSizePixel( pParent->GetOutputSizePixel() );
pWin->SetBackground();
pWin->Show();
diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx
index e62676bca661..1d4f8e6fa858 100644
--- a/sfx2/source/doc/new.cxx
+++ b/sfx2/source/doc/new.cxx
@@ -123,19 +123,19 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSfxPreviewWin(vcl::Win
class SfxNewFileDialog_Impl
{
- ListBox* m_pRegionLb;
- ListBox* m_pTemplateLb;
+ VclPtr<ListBox> m_pRegionLb;
+ VclPtr<ListBox> m_pTemplateLb;
- SfxPreviewWin_Impl* m_pPreviewWin;
+ VclPtr<SfxPreviewWin_Impl> m_pPreviewWin;
- CheckBox* m_pTextStyleCB;
- CheckBox* m_pFrameStyleCB;
- CheckBox* m_pPageStyleCB;
- CheckBox* m_pNumStyleCB;
- CheckBox* m_pMergeStyleCB;
- PushButton* m_pLoadFilePB;
+ VclPtr<CheckBox> m_pTextStyleCB;
+ VclPtr<CheckBox> m_pFrameStyleCB;
+ VclPtr<CheckBox> m_pPageStyleCB;
+ VclPtr<CheckBox> m_pNumStyleCB;
+ VclPtr<CheckBox> m_pMergeStyleCB;
+ VclPtr<PushButton> m_pLoadFilePB;
- VclExpander* m_pMoreBt;
+ VclPtr<VclExpander> m_pMoreBt;
Idle aPrevIdle;
OUString aNone;
OUString sLoadTemplate;
@@ -143,7 +143,7 @@ class SfxNewFileDialog_Impl
sal_uInt16 nFlags;
SfxDocumentTemplates aTemplates;
SfxObjectShellLock xDocShell;
- SfxNewFileDialog* pAntiImpl;
+ VclPtr<SfxNewFileDialog> pAntiImpl;
DECL_LINK( Update, void * );
@@ -454,7 +454,13 @@ SfxNewFileDialog::SfxNewFileDialog(vcl::Window *pParent, sal_uInt16 nFlags)
SfxNewFileDialog::~SfxNewFileDialog()
{
+ disposeOnce();
+}
+
+void SfxNewFileDialog::dispose()
+{
delete pImpl;
+ SfxModalDialog::dispose();
}
bool SfxNewFileDialog::IsTemplate() const
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index d2b4d3c8aacd..faf46aa367bd 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -131,11 +131,11 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( bool bFullContent ) const
std::shared_ptr<GDIMetaFile> xFile(new GDIMetaFile);
- VirtualDevice aDevice;
- aDevice.EnableOutput( false );
+ ScopedVclPtrInstance< VirtualDevice > pDevice;
+ pDevice->EnableOutput( false );
MapMode aMode( this->GetMapUnit() );
- aDevice.SetMapMode( aMode );
+ pDevice->SetMapMode( aMode );
xFile->SetPrefMapMode( aMode );
Size aTmpSize;
@@ -155,7 +155,7 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( bool bFullContent ) const
DBG_ASSERT( aTmpSize.Height()*aTmpSize.Width(),
"size of first page is 0, override GetFirstPageSize or set vis-area!" );
- xFile->Record( &aDevice );
+ xFile->Record( pDevice );
LanguageType eLang;
SvtCTLOptions aCTLOptions;
@@ -166,9 +166,9 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( bool bFullContent ) const
else
eLang = (LanguageType) Application::GetSettings().GetLanguageTag().getLanguageType();
- aDevice.SetDigitLanguage( eLang );
+ pDevice->SetDigitLanguage( eLang );
- const_cast<SfxObjectShell*>(this)->DoDraw( &aDevice, Point(0,0), aTmpSize, JobSetup(), nAspect );
+ const_cast<SfxObjectShell*>(this)->DoDraw( pDevice, Point(0,0), aTmpSize, JobSetup(), nAspect );
xFile->Stop();
@@ -286,13 +286,13 @@ void SfxObjectShell::UpdateTime_Impl(
-SfxDocumentInfoDialog* SfxObjectShell::CreateDocumentInfoDialog
+VclPtr<SfxDocumentInfoDialog> SfxObjectShell::CreateDocumentInfoDialog
(
vcl::Window* pParent,
const SfxItemSet& rSet
)
{
- return new SfxDocumentInfoDialog(pParent, rSet);
+ return VclPtr<SfxDocumentInfoDialog>::Create(pParent, rSet);
}
@@ -471,8 +471,8 @@ void SfxObjectShell::UpdateFromTemplate_Impl( )
{
OUString sMessage( SfxResId(STR_QRYTEMPL_MESSAGE).toString() );
sMessage = sMessage.replaceAll( "$(ARG1)", aTemplName );
- sfx2::QueryTemplateBox aBox( GetDialogParent(), sMessage );
- if ( RET_YES == aBox.Execute() )
+ ScopedVclPtrInstance< sfx2::QueryTemplateBox > aBox(GetDialogParent(), sMessage);
+ if ( RET_YES == aBox->Execute() )
bLoad = true;
}
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 8f10da507570..3711c68b7130 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -335,7 +335,7 @@ void SfxObjectShell::CheckOut( )
}
catch ( const uno::RuntimeException& e )
{
- boost::scoped_ptr<MessageDialog> pErrorBox(new MessageDialog( &GetFrame()->GetWindow(), e.Message ));
+ ScopedVclPtrInstance< MessageDialog > pErrorBox( &GetFrame()->GetWindow(), e.Message );
pErrorBox->Execute( );
}
}
@@ -353,7 +353,7 @@ void SfxObjectShell::CancelCheckOut( )
}
catch ( const uno::RuntimeException& e )
{
- boost::scoped_ptr<MessageDialog> pErrorBox(new MessageDialog(&GetFrame()->GetWindow(), e.Message));
+ ScopedVclPtrInstance< MessageDialog > pErrorBox(&GetFrame()->GetWindow(), e.Message);
pErrorBox->Execute( );
}
}
@@ -364,11 +364,11 @@ void SfxObjectShell::CheckIn( )
{
uno::Reference< document::XCmisDocument > xCmisDoc( GetModel(), uno::UNO_QUERY_THROW );
// Pop up dialog to ask for comment and major
- SfxCheckinDialog checkinDlg( &GetFrame( )->GetWindow( ) );
- if ( checkinDlg.Execute( ) == RET_OK )
+ ScopedVclPtrInstance< SfxCheckinDialog > checkinDlg(&GetFrame( )->GetWindow( ));
+ if ( checkinDlg->Execute( ) == RET_OK )
{
- OUString sComment = checkinDlg.GetComment( );
- bool bMajor = checkinDlg.IsMajor( );
+ OUString sComment = checkinDlg->GetComment( );
+ bool bMajor = checkinDlg->IsMajor( );
xCmisDoc->checkIn( bMajor, sComment );
uno::Reference< util::XModifiable > xModifiable( GetModel( ), uno::UNO_QUERY );
if ( xModifiable.is( ) )
@@ -377,7 +377,7 @@ void SfxObjectShell::CheckIn( )
}
catch ( const uno::RuntimeException& e )
{
- boost::scoped_ptr<MessageDialog> pErrorBox(new MessageDialog(&GetFrame()->GetWindow(), e.Message));
+ ScopedVclPtrInstance< MessageDialog > pErrorBox(&GetFrame()->GetWindow(), e.Message);
pErrorBox->Execute( );
}
}
@@ -391,7 +391,7 @@ uno::Sequence< document::CmisVersion > SfxObjectShell::GetCmisVersions( )
}
catch ( const uno::RuntimeException& e )
{
- boost::scoped_ptr<MessageDialog> pErrorBox(new MessageDialog(&GetFrame()->GetWindow(), e.Message));
+ ScopedVclPtrInstance< MessageDialog > pErrorBox(&GetFrame()->GetWindow(), e.Message);
pErrorBox->Execute( );
}
return uno::Sequence< document::CmisVersion > ( );
@@ -439,7 +439,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
if ( !IsOwnStorageFormat_Impl( *GetMedium() ) )
return;
- boost::scoped_ptr<SfxVersionDialog> pDlg(new SfxVersionDialog( pFrame, IsSaveVersionOnClose() ));
+ ScopedVclPtrInstance< SfxVersionDialog > pDlg( pFrame, IsSaveVersionOnClose() );
pDlg->Execute();
SetSaveVersionOnClose( pDlg->IsSaveVersionOnClose() );
rReq.Done();
@@ -499,7 +499,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
// creating dialog is done via virtual method; application will
// add its own statistics page
- boost::scoped_ptr<SfxDocumentInfoDialog> pDlg(CreateDocumentInfoDialog(0, aSet));
+ ScopedVclPtr<SfxDocumentInfoDialog> pDlg(CreateDocumentInfoDialog(0, aSet));
if ( RET_OK == pDlg->Execute() )
{
SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pDocInfoItem, SfxDocumentInfoItem, SID_DOCINFO, false);
@@ -857,10 +857,10 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
case SID_DOCTEMPLATE:
{
// save as document templates
- SfxTemplateManagerDlg aDlg;
- aDlg.setDocumentModel(GetModel());
- aDlg.setSaveMode();
- aDlg.Execute();
+ ScopedVclPtrInstance< SfxTemplateManagerDlg > aDlg;
+ aDlg->setDocumentModel(GetModel());
+ aDlg->setSaveMode();
+ aDlg->Execute();
break;
}
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index c609495d1462..d181c628cf5d 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -3019,8 +3019,8 @@ sal_Int16 SfxObjectShell::QueryHiddenInformation( HiddenWarningFact eFact, vcl::
{
sMessage += "\n";
sMessage += SfxResId(nResId).toString();
- WarningBox aWBox( pParent, WB_YES_NO | WB_DEF_NO, sMessage );
- nRet = aWBox.Execute();
+ ScopedVclPtrInstance< WarningBox > aWBox(pParent, WB_YES_NO | WB_DEF_NO, sMessage);
+ nRet = aWBox->Execute();
}
}
diff --git a/sfx2/source/doc/plugin.cxx b/sfx2/source/doc/plugin.cxx
index ca30f4563093..7c5d7157607a 100644
--- a/sfx2/source/doc/plugin.cxx
+++ b/sfx2/source/doc/plugin.cxx
@@ -152,7 +152,7 @@ throw( uno::RuntimeException, std::exception )
if ( SvtMiscOptions().IsPluginsEnabled() )
{
vcl::Window* pParent = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
- PluginWindow_Impl* pWin = new PluginWindow_Impl( pParent );
+ VclPtr<PluginWindow_Impl> pWin = VclPtr<PluginWindow_Impl>::Create( pParent );
pWin->SetSizePixel( pParent->GetOutputSizePixel() );
pWin->SetBackground();
pWin->Show();
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index 1d056eb69900..452f41435a54 100644
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -346,7 +346,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >
if ( aPrinterName != pPrinter->GetName() )
{
- pPrinter = new SfxPrinter( pPrinter->GetOptions().Clone(), aPrinterName );
+ pPrinter = VclPtr<SfxPrinter>::Create( pPrinter->GetOptions().Clone(), aPrinterName );
nChangeFlags = SfxPrinterChangeFlags::PRINTER;
}
break;
@@ -477,7 +477,7 @@ class ImplUCBPrintWatcher : public ::osl::Thread
{
private:
/// of course we must know the printer which execute the job
- SfxPrinter* m_pPrinter;
+ VclPtr<SfxPrinter> m_pPrinter;
/// this describes the target location for the printed temp file
OUString m_sTargetURL;
/// it holds the temp file alive, till the print job will finish and remove it from disk automatically if the object die
@@ -504,7 +504,7 @@ class ImplUCBPrintWatcher : public ::osl::Thread
SolarMutexGuard aGuard;
while( m_pPrinter->IsPrinting() )
Application::Yield();
- m_pPrinter = NULL; // don't delete it! It's borrowed only :-)
+ m_pPrinter.clear(); // don't delete it! It's borrowed only :-)
}
/* } SAFE */
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index fee3db0670df..3997e4f5f0e9 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -296,7 +296,12 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(vcl::Window *parent)
mpLocalView->Show();
}
-SfxTemplateManagerDlg::~SfxTemplateManagerDlg ()
+SfxTemplateManagerDlg::~SfxTemplateManagerDlg()
+{
+ disposeOnce();
+}
+
+void SfxTemplateManagerDlg::dispose()
{
writeSettings();
@@ -316,6 +321,17 @@ SfxTemplateManagerDlg::~SfxTemplateManagerDlg ()
mpSearchView->setItemStateHdl(Link());
mpSearchView->setOpenTemplateHdl(Link());
+
+ mpTabControl.clear();
+ mpSearchEdit.clear();
+ mpViewBar.clear();
+ mpActionBar.clear();
+ mpTemplateBar.clear();
+ mpSearchView.clear();
+ mpCurView.clear();
+ mpLocalView.clear();
+ mpRemoteView.clear();
+ ModalDialog::dispose();
}
void SfxTemplateManagerDlg::setSaveMode()
@@ -608,11 +624,11 @@ IMPL_LINK(SfxTemplateManagerDlg, RepositoryMenuSelectHdl, Menu*, pMenu)
}
else if (nMenuId == MNI_REPOSITORY_NEW)
{
- PlaceEditDialog dlg(this);
+ ScopedVclPtrInstance< PlaceEditDialog > dlg(this);
- if (dlg.Execute())
+ if (dlg->Execute())
{
- std::shared_ptr<Place> xPlace = dlg.GetPlace();
+ std::shared_ptr<Place> xPlace = dlg->GetPlace();
if (insertRepository(xPlace->GetName(), xPlace->GetUrl()))
{
@@ -623,7 +639,7 @@ IMPL_LINK(SfxTemplateManagerDlg, RepositoryMenuSelectHdl, Menu*, pMenu)
{
OUString aMsg(SfxResId(STR_MSG_ERROR_REPOSITORY_NAME).toString());
aMsg = aMsg.replaceFirst("$1", xPlace->GetName());
- MessageDialog(this, aMsg).Execute();
+ ScopedVclPtrInstance<MessageDialog>(this, aMsg)->Execute();
}
}
}
@@ -1152,16 +1168,16 @@ void SfxTemplateManagerDlg::OnTemplateProperties ()
{
const TemplateViewItem *pItem = static_cast<const TemplateViewItem*>(*maSelTemplates.begin());
- SfxTemplateInfoDlg aDlg;
- aDlg.loadDocument(pItem->getPath());
- aDlg.Execute();
+ ScopedVclPtrInstance< SfxTemplateInfoDlg > aDlg;
+ aDlg->loadDocument(pItem->getPath());
+ aDlg->Execute();
}
void SfxTemplateManagerDlg::OnTemplateDelete ()
{
- MessageDialog aQueryDlg(this, SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if ( aQueryDlg.Execute() != RET_YES )
+ if ( aQueryDlg->Execute() != RET_YES )
return;
OUString aTemplateList;
@@ -1230,13 +1246,13 @@ void SfxTemplateManagerDlg::OnTemplateAsDefault ()
void SfxTemplateManagerDlg::OnFolderNew()
{
- InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this);
+ ScopedVclPtrInstance< InputDialog > dlg(SfxResId(STR_INPUT_NEW).toString(),this);
- int ret = dlg.Execute();
+ int ret = dlg->Execute();
if (ret)
{
- OUString aName = dlg.getEntryText();
+ OUString aName = dlg->getEntryText();
mpCurView->createRegion(aName);
}
@@ -1244,9 +1260,9 @@ void SfxTemplateManagerDlg::OnFolderNew()
void SfxTemplateManagerDlg::OnFolderDelete()
{
- MessageDialog aQueryDlg(this, SfxResId(STR_QMSG_SEL_FOLDER_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, SfxResId(STR_QMSG_SEL_FOLDER_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if ( aQueryDlg.Execute() != RET_YES )
+ if ( aQueryDlg->Execute() != RET_YES )
return;
OUString aFolderList;
@@ -1297,17 +1313,17 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs()
return;
}
- InputDialog aDlg(SfxResId(STR_INPUT_TEMPLATE_NEW).toString(),this);
+ ScopedVclPtrInstance< InputDialog > aDlg(SfxResId(STR_INPUT_TEMPLATE_NEW).toString(),this);
- if (aDlg.Execute())
+ if (aDlg->Execute())
{
- OUString aName = aDlg.getEntryText();
+ OUString aName = aDlg->getEntryText();
if (!aName.isEmpty())
{
OUString aFolderList;
OUString aQMsg(SfxResId(STR_QMSG_TEMPLATE_OVERWRITE).toString());
- MessageDialog aQueryDlg(this, OUString(), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
+ ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, OUString(), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
if (mpLocalView->isNonRootRegionVisible())
{
@@ -1316,9 +1332,9 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs()
if (!mpLocalView->isTemplateNameUnique(nRegionItemId,aName))
{
aQMsg = aQMsg.replaceFirst("$1",aName);
- aQueryDlg.set_primary_text(aQMsg.replaceFirst("$2",mpLocalView->getCurRegionName()));
+ aQueryDlg->set_primary_text(aQMsg.replaceFirst("$2",mpLocalView->getCurRegionName()));
- if (aQueryDlg.Execute() == RET_NO)
+ if (aQueryDlg->Execute() == RET_NO)
return;
}
@@ -1335,9 +1351,9 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs()
if (!mpLocalView->isTemplateNameUnique(pItem->mnId,aName))
{
OUString aDQMsg = aQMsg.replaceFirst("$1",aName);
- aQueryDlg.set_primary_text(aDQMsg.replaceFirst("$2",pItem->maTitle));
+ aQueryDlg->set_primary_text(aDQMsg.replaceFirst("$2",pItem->maTitle));
- if (aQueryDlg.Execute() == RET_NO)
+ if (aQueryDlg->Execute() == RET_NO)
continue;
}
@@ -1403,7 +1419,7 @@ void SfxTemplateManagerDlg::switchMainView(bool bDisplayLocal)
{
if (bDisplayLocal)
{
- mpCurView = mpLocalView;
+ mpCurView = mpLocalView.get();
mpViewBar->HideItem(VIEWBAR_DELETE);
@@ -1416,7 +1432,7 @@ void SfxTemplateManagerDlg::switchMainView(bool bDisplayLocal)
}
else
{
- mpCurView = mpRemoteView;
+ mpCurView = mpRemoteView.get();
mpViewBar->ShowItem(VIEWBAR_DELETE);
@@ -1435,13 +1451,13 @@ void SfxTemplateManagerDlg::localMoveTo(sal_uInt16 nMenuId)
if (nMenuId == MNI_MOVE_NEW)
{
- InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this);
+ ScopedVclPtrInstance< InputDialog > dlg(SfxResId(STR_INPUT_NEW).toString(),this);
- int ret = dlg.Execute();
+ int ret = dlg->Execute();
if (ret)
{
- OUString aName = dlg.getEntryText();
+ OUString aName = dlg->getEntryText();
if (!aName.isEmpty())
nItemId = mpLocalView->createRegion(aName);
@@ -1483,13 +1499,13 @@ void SfxTemplateManagerDlg::remoteMoveTo(const sal_uInt16 nMenuId)
if (nMenuId == MNI_MOVE_NEW)
{
- InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this);
+ ScopedVclPtrInstance< InputDialog > dlg(SfxResId(STR_INPUT_NEW).toString(),this);
- int ret = dlg.Execute();
+ int ret = dlg->Execute();
if (ret)
{
- OUString aName = dlg.getEntryText();
+ OUString aName = dlg->getEntryText();
if (!aName.isEmpty())
nItemId = mpLocalView->createRegion(aName);
@@ -1537,13 +1553,13 @@ void SfxTemplateManagerDlg::localSearchMoveTo(sal_uInt16 nMenuId)
if (nMenuId == MNI_MOVE_NEW)
{
- InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this);
+ ScopedVclPtrInstance< InputDialog > dlg(SfxResId(STR_INPUT_NEW).toString(),this);
- int ret = dlg.Execute();
+ int ret = dlg->Execute();
if (ret)
{
- OUString aName = dlg.getEntryText();
+ OUString aName = dlg->getEntryText();
if (!aName.isEmpty())
nItemId = mpLocalView->createRegion(aName);
diff --git a/sfx2/source/inc/alienwarn.hxx b/sfx2/source/inc/alienwarn.hxx
index 7e812d263a1b..82884a76ccdf 100644
--- a/sfx2/source/inc/alienwarn.hxx
+++ b/sfx2/source/inc/alienwarn.hxx
@@ -25,14 +25,15 @@
class SfxAlienWarningDialog : public MessageDialog
{
private:
- PushButton* m_pKeepCurrentBtn;
- PushButton* m_pUseDefaultFormatBtn;
- CheckBox* m_pWarningOnBox;
+ VclPtr<PushButton> m_pKeepCurrentBtn;
+ VclPtr<PushButton> m_pUseDefaultFormatBtn;
+ VclPtr<CheckBox> m_pWarningOnBox;
public:
SfxAlienWarningDialog(vcl::Window* pParent, const OUString& _rFormatName,
const OUString& _rDefaultExtension, bool rDefaultIsAlien);
virtual ~SfxAlienWarningDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif // INCLUDED_SFX2_SOURCE_INC_ALIENWARN_HXX
diff --git a/sfx2/source/inc/documentfontsdialog.hxx b/sfx2/source/inc/documentfontsdialog.hxx
index 360f88713010..1ac6c6ebcbe5 100644
--- a/sfx2/source/inc/documentfontsdialog.hxx
+++ b/sfx2/source/inc/documentfontsdialog.hxx
@@ -31,12 +31,14 @@ class SfxDocumentFontsPage: public SfxTabPage
{
public:
SfxDocumentFontsPage( vcl::Window* parent, const SfxItemSet& set );
- static SfxTabPage* Create( vcl::Window* parent, const SfxItemSet* set );
+ virtual ~SfxDocumentFontsPage();
+ virtual void dispose() SAL_OVERRIDE;
+ static VclPtr<SfxTabPage> Create( vcl::Window* parent, const SfxItemSet* set );
protected:
virtual bool FillItemSet( SfxItemSet* set ) SAL_OVERRIDE;
virtual void Reset( const SfxItemSet* set ) SAL_OVERRIDE;
private:
- CheckBox* embedFontsCheckbox;
+ VclPtr<CheckBox> embedFontsCheckbox;
};
#endif
diff --git a/sfx2/source/inc/inputdlg.hxx b/sfx2/source/inc/inputdlg.hxx
index 29b5c45b9453..41888d44d3c9 100644
--- a/sfx2/source/inc/inputdlg.hxx
+++ b/sfx2/source/inc/inputdlg.hxx
@@ -21,6 +21,8 @@ class InputDialog : public ModalDialog
public:
InputDialog (const OUString &labelText, vcl::Window *pParent = NULL);
OUString getEntryText () const;
+ virtual ~InputDialog();
+ virtual void dispose() SAL_OVERRIDE;
private:
@@ -28,10 +30,10 @@ private:
private:
- Edit *m_pEntry;
- FixedText *m_pLabel;
- PushButton *m_pOK;
- PushButton *m_pCancel;
+ VclPtr<Edit> m_pEntry;
+ VclPtr<FixedText> m_pLabel;
+ VclPtr<PushButton> m_pOK;
+ VclPtr<PushButton> m_pCancel;
};
#endif // INCLUDED_SFX2_SOURCE_INC_INPUTDLG_HXX
diff --git a/sfx2/source/inc/partwnd.hxx b/sfx2/source/inc/partwnd.hxx
index a065593d168d..b81a88fd084c 100644
--- a/sfx2/source/inc/partwnd.hxx
+++ b/sfx2/source/inc/partwnd.hxx
@@ -69,7 +69,6 @@ public:
vcl::Window* pParent,
WinBits nBits );
- virtual ~SfxPartDockWnd_Impl();
bool QueryClose();
virtual void FillInfo(SfxChildWinInfo&) const SAL_OVERRIDE;
::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > ForgetFrame();
diff --git a/sfx2/source/inc/recfloat.hxx b/sfx2/source/inc/recfloat.hxx
index 06fc314a2795..50dd7f6dc9fd 100644
--- a/sfx2/source/inc/recfloat.hxx
+++ b/sfx2/source/inc/recfloat.hxx
@@ -39,13 +39,14 @@ public:
class SfxRecordingFloat_Impl : public SfxFloatingWindow
{
- ToolBox* m_pTbx;
+ VclPtr<ToolBox> m_pTbx;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XToolbarController > xStopRecTbxCtrl;
public:
SfxRecordingFloat_Impl( SfxBindings* pBindings ,
SfxChildWindow* pChildWin ,
vcl::Window* pParent );
virtual ~SfxRecordingFloat_Impl();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool Close() SAL_OVERRIDE;
virtual void FillInfo( SfxChildWinInfo& rInfo ) const SAL_OVERRIDE;
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
diff --git a/sfx2/source/inc/splitwin.hxx b/sfx2/source/inc/splitwin.hxx
index 1a332e8e5e58..177bd769c70c 100644
--- a/sfx2/source/inc/splitwin.hxx
+++ b/sfx2/source/inc/splitwin.hxx
@@ -31,9 +31,9 @@ class SfxEmptySplitWin_Impl;
struct SfxDock_Impl
{
sal_uInt16 nType;
- SfxDockingWindow* pWin; // SplitWindow has this window
- bool bNewLine;
- bool bHide; // SplitWindow had this window
+ VclPtr<SfxDockingWindow> pWin; // SplitWindow has this window
+ bool bNewLine;
+ bool bHide; // SplitWindow had this window
long nSize;
};
@@ -49,8 +49,8 @@ private:
SfxDockArr_Impl* pDockArr;
bool bLocked;
bool bPinned;
- SfxEmptySplitWin_Impl* pEmptyWin;
- SfxDockingWindow* pActive;
+ VclPtr<SfxEmptySplitWin_Impl> pEmptyWin;
+ VclPtr<SfxDockingWindow> pActive;
void InsertWindow_Impl( SfxDock_Impl* pDockWin,
const Size& rSize,
@@ -79,6 +79,7 @@ public:
WinBits nBits = WB_BORDER | WB_SIZEABLE | WB_3DLOOK );
virtual ~SfxSplitWindow();
+ virtual void dispose() SAL_OVERRIDE;
void ReleaseWindow_Impl(SfxDockingWindow *pWin, bool bSaveConfig=true);
diff --git a/sfx2/source/inc/templatesearchview.hxx b/sfx2/source/inc/templatesearchview.hxx
index 2845c409fcb6..e49ef3f81813 100644
--- a/sfx2/source/inc/templatesearchview.hxx
+++ b/sfx2/source/inc/templatesearchview.hxx
@@ -18,8 +18,6 @@ public:
TemplateSearchView ( vcl::Window* pParent, WinBits nWinStyle = WB_TABSTOP | WB_VSCROLL);
- virtual ~TemplateSearchView();
-
void setOpenTemplateHdl (const Link &rLink);
void AppendItem(sal_uInt16 nAssocItemId, sal_uInt16 nRegionId, sal_uInt16 nIdx,
diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx
index 0cf88b1e7077..249a1f32d827 100644
--- a/sfx2/source/inc/templdgi.hxx
+++ b/sfx2/source/inc/templdgi.hxx
@@ -176,7 +176,7 @@ protected:
SfxBindings* pBindings;
SfxTemplateControllerItem* pBoundItems[COUNT_BOUND_FUNC];
- vcl::Window* pWindow;
+ VclPtr<vcl::Window> pWindow;
SfxModule* pModule;
Idle* pIdle;
@@ -184,13 +184,13 @@ protected:
SfxStyleFamilies* pStyleFamilies;
SfxTemplateItem* pFamilyState[MAX_FAMILIES];
SfxStyleSheetBasePool* pStyleSheetPool;
- StyleTreeListBox_Impl* pTreeBox;
+ VclPtr<StyleTreeListBox_Impl> pTreeBox;
SfxObjectShell* pCurObjShell;
css::uno::Reference<css::frame::XModuleManager2> xModuleManager;
DeletionWatcher* m_pDeletionWatcher;
- SfxActionListBox aFmtLb;
- ListBox aFilterLb;
+ VclPtr<SfxActionListBox> aFmtLb;
+ VclPtr<ListBox> aFilterLb;
Size aSize;
sal_uInt16 nActFamily; // Id in the ToolBox = Position - 1
@@ -367,7 +367,6 @@ protected:
virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
public:
DropToolBox_Impl(vcl::Window* pParent, SfxTemplateDialog_Impl* pTemplateDialog);
- virtual ~DropToolBox_Impl();
};
class SfxTemplateDialog_Impl : public SfxCommonTemplateDialog_Impl
@@ -377,10 +376,10 @@ private:
friend class DropToolBox_Impl;
friend class SfxTemplatePanelControl;
- vcl::Window* m_pFloat;
- bool m_bZoomIn;
- DropToolBox_Impl m_aActionTbL;
- ToolBox m_aActionTbR;
+ VclPtr<vcl::Window> m_pFloat;
+ bool m_bZoomIn;
+ VclPtr<DropToolBox_Impl> m_aActionTbL;
+ VclPtr<ToolBox> m_aActionTbR;
DECL_LINK( ToolBoxLSelect, ToolBox* );
DECL_LINK( ToolBoxRSelect, ToolBox* );
diff --git a/sfx2/source/inc/versdlg.hxx b/sfx2/source/inc/versdlg.hxx
index 3204e2d479bf..67453efa3a51 100644
--- a/sfx2/source/inc/versdlg.hxx
+++ b/sfx2/source/inc/versdlg.hxx
@@ -45,14 +45,14 @@ public:
class SfxVersionTableDtor;
class SfxVersionDialog : public SfxModalDialog
{
- PushButton* m_pSaveButton;
- CheckBox* m_pSaveCheckBox;
- SfxVersionsTabListBox_Impl* m_pVersionBox;
- PushButton* m_pOpenButton;
- PushButton* m_pViewButton;
- PushButton* m_pDeleteButton;
- PushButton* m_pCompareButton;
- PushButton* m_pCmisButton;
+ VclPtr<PushButton> m_pSaveButton;
+ VclPtr<CheckBox> m_pSaveCheckBox;
+ VclPtr<SfxVersionsTabListBox_Impl> m_pVersionBox;
+ VclPtr<PushButton> m_pOpenButton;
+ VclPtr<PushButton> m_pViewButton;
+ VclPtr<PushButton> m_pDeleteButton;
+ VclPtr<PushButton> m_pCompareButton;
+ VclPtr<PushButton> m_pCmisButton;
SfxViewFrame* pViewFrame;
SfxVersionTableDtor* m_pTable;
bool m_bIsSaveVersionOnClose;
@@ -66,32 +66,35 @@ class SfxVersionDialog : public SfxModalDialog
public:
SfxVersionDialog ( SfxViewFrame* pFrame, bool );
virtual ~SfxVersionDialog ();
+ virtual void dispose() SAL_OVERRIDE;
bool IsSaveVersionOnClose() const { return m_bIsSaveVersionOnClose; }
};
class SfxViewVersionDialog_Impl : public SfxModalDialog
{
- FixedText* m_pDateTimeText;
- FixedText* m_pSavedByText;
- VclMultiLineEdit* m_pEdit;
- OKButton* m_pOKButton;
- CancelButton* m_pCancelButton;
- CloseButton* m_pCloseButton;
+ VclPtr<FixedText> m_pDateTimeText;
+ VclPtr<FixedText> m_pSavedByText;
+ VclPtr<VclMultiLineEdit> m_pEdit;
+ VclPtr<OKButton> m_pOKButton;
+ VclPtr<CancelButton> m_pCancelButton;
+ VclPtr<CloseButton> m_pCloseButton;
SfxVersionInfo& m_rInfo;
DECL_LINK(ButtonHdl, Button*);
public:
SfxViewVersionDialog_Impl(vcl::Window *pParent, SfxVersionInfo& rInfo, bool bEdit);
+ virtual ~SfxViewVersionDialog_Impl();
+ virtual void dispose() SAL_OVERRIDE;
};
class SfxCmisVersionsDialog : public SfxModalDialog
{
- SfxVersionsTabListBox_Impl* m_pVersionBox;
- PushButton* m_pOpenButton;
- PushButton* m_pViewButton;
- PushButton* m_pDeleteButton;
- PushButton* m_pCompareButton;
+ VclPtr<SfxVersionsTabListBox_Impl> m_pVersionBox;
+ VclPtr<PushButton> m_pOpenButton;
+ VclPtr<PushButton> m_pViewButton;
+ VclPtr<PushButton> m_pDeleteButton;
+ VclPtr<PushButton> m_pCompareButton;
SfxViewFrame* pViewFrame;
SfxVersionTableDtor* m_pTable;
bool m_bIsSaveVersionOnClose;
@@ -104,6 +107,7 @@ class SfxCmisVersionsDialog : public SfxModalDialog
public:
SfxCmisVersionsDialog ( SfxViewFrame* pFrame, bool );
virtual ~SfxCmisVersionsDialog ();
+ virtual void dispose() SAL_OVERRIDE;
};
#endif
diff --git a/sfx2/source/inc/workwin.hxx b/sfx2/source/inc/workwin.hxx
index 7abf4d37cfb7..7233fe676838 100644
--- a/sfx2/source/inc/workwin.hxx
+++ b/sfx2/source/inc/workwin.hxx
@@ -96,7 +96,7 @@ namespace o3tl
struct SfxChild_Impl
{
- vcl::Window* pWin;
+ VclPtr<vcl::Window> pWin;
Size aSize;
SfxChildAlignment eAlign;
SfxChildVisibility nVisible;
@@ -222,16 +222,16 @@ protected:
Rectangle aClientArea;
Rectangle aUpperClientArea;
SfxWorkWindow* pParent;
- SfxSplitWindow* pSplit[SFX_SPLITWINDOWS_MAX];
+ VclPtr<SfxSplitWindow> pSplit[SFX_SPLITWINDOWS_MAX];
SfxChildList_Impl aChildren;
SfxChildWindows_Impl aChildWins;
SfxBindings* pBindings;
- vcl::Window* pWorkWin;
+ VclPtr<vcl::Window> pWorkWin;
SfxShell* pConfigShell;
- vcl::Window* pActiveChild;
- sal_uInt16 nUpdateMode;
- sal_uInt16 nChildren;
- sal_uInt16 nOrigMode;
+ VclPtr<vcl::Window> pActiveChild;
+ sal_uInt16 nUpdateMode;
+ sal_uInt16 nChildren;
+ sal_uInt16 nOrigMode;
bool bSorted : 1;
bool bDockingAllowed : 1;
bool bInternalDockingAllowed : 1;
diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx
index 29a5168987f0..81f89fbf3aa3 100644
--- a/sfx2/source/inet/inettbc.cxx
+++ b/sfx2/source/inet/inettbc.cxx
@@ -152,13 +152,12 @@ IMPL_STATIC_LINK_NOINSTANCE( SfxURLToolBoxControl_Impl, ExecuteHdl_Impl, Execute
}
-vcl::Window* SfxURLToolBoxControl_Impl::CreateItemWindow( vcl::Window* pParent )
+VclPtr<vcl::Window> SfxURLToolBoxControl_Impl::CreateItemWindow( vcl::Window* pParent )
{
- SvtURLBox* pURLBox = new SvtURLBox( pParent );
+ VclPtrInstance<SvtURLBox> pURLBox( pParent );
pURLBox->SetOpenHdl( LINK( this, SfxURLToolBoxControl_Impl, OpenHdl ) );
pURLBox->SetSelectHdl( LINK( this, SfxURLToolBoxControl_Impl, SelectHdl ) );
-
- return pURLBox;
+ return pURLBox.get();
}
IMPL_LINK_NOARG(SfxURLToolBoxControl_Impl, SelectHdl)
diff --git a/sfx2/source/sidebar/ControlFactory.cxx b/sfx2/source/sidebar/ControlFactory.cxx
index 23e17a671deb..d8a49b3dd148 100644
--- a/sfx2/source/sidebar/ControlFactory.cxx
+++ b/sfx2/source/sidebar/ControlFactory.cxx
@@ -25,14 +25,14 @@
namespace sfx2 { namespace sidebar {
-CheckBox* ControlFactory::CreateMenuButton (vcl::Window* pParentWindow)
+VclPtr<CheckBox> ControlFactory::CreateMenuButton (vcl::Window* pParentWindow)
{
- return new MenuButton(pParentWindow);
+ return VclPtr<CheckBox>(new MenuButton(pParentWindow), SAL_NO_ACQUIRE);
}
-ImageRadioButton* ControlFactory::CreateTabItem (vcl::Window* pParentWindow)
+VclPtr<ImageRadioButton> ControlFactory::CreateTabItem (vcl::Window* pParentWindow)
{
- return new TabItem(pParentWindow);
+ return VclPtr<ImageRadioButton>(new TabItem(pParentWindow), SAL_NO_ACQUIRE);
}
} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx
index 729e2b210164..22dd244e52e0 100644
--- a/sfx2/source/sidebar/ControllerItem.cxx
+++ b/sfx2/source/sidebar/ControllerItem.cxx
@@ -117,8 +117,16 @@ ControllerItem::ControllerItem (
ControllerItem::~ControllerItem()
{
+ dispose();
+}
+
+void ControllerItem::dispose()
+{
if (mxFrameActionListener.is())
mxFrameActionListener->dispose();
+ mxFrameActionListener.clear();
+
+ SfxControllerItem::dispose();
}
void ControllerItem::StateChanged (
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 831c05325d8c..de2066defd74 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -48,11 +48,11 @@ Deck::Deck (
maIcon(),
mnMinimalWidth(0),
maPanels(),
- mpTitleBar(new DeckTitleBar(rDeckDescriptor.msTitle, this, rCloserAction)),
- mpScrollClipWindow(new vcl::Window(this)),
- mpScrollContainer(new ScrollContainerWindow(mpScrollClipWindow.get())),
- mpFiller(new vcl::Window(this)),
- mpVerticalScrollBar(new ScrollBar(this))
+ mpTitleBar(VclPtr<DeckTitleBar>::Create(rDeckDescriptor.msTitle, this, rCloserAction)),
+ mpScrollClipWindow(VclPtr<vcl::Window>::Create(this)),
+ mpScrollContainer(VclPtr<ScrollContainerWindow>::Create(mpScrollClipWindow.get())),
+ mpFiller(VclPtr<vcl::Window>::Create(this)),
+ mpVerticalScrollBar(VclPtr<ScrollBar>::Create(this))
{
SetBackground(Wallpaper());
@@ -75,35 +75,27 @@ Deck::Deck (
Deck::~Deck()
{
- Dispose();
-
- // We have to explicitly trigger the destruction of panels.
- // Otherwise that is done by one of our base class destructors
- // without updating maPanels.
- maPanels.clear();
+ disposeOnce();
}
-void Deck::Dispose()
+void Deck::dispose()
{
SharedPanelContainer aPanels;
aPanels.swap(maPanels);
- for (SharedPanelContainer::iterator
- iPanel(aPanels.begin()),
- iEnd(aPanels.end());
- iPanel!=iEnd;
- ++iPanel)
- {
- if (*iPanel)
- {
- (*iPanel)->Dispose();
- OSL_ASSERT(iPanel->unique());
- iPanel->reset();
- }
- }
- mpTitleBar.reset();
- mpFiller.reset();
- mpVerticalScrollBar.reset();
+ // We have to explicitly trigger the destruction of panels.
+ // Otherwise that is done by one of our base class destructors
+ // without updating maPanels.
+ for (size_t i = 0; i < aPanels.size(); i++)
+ aPanels[i].disposeAndClear();
+
+ mpTitleBar.disposeAndClear();
+ mpFiller.disposeAndClear();
+ mpVerticalScrollBar.disposeAndClear();
+ mpScrollContainer.disposeAndClear();
+ mpScrollClipWindow.disposeAndClear();
+
+ vcl::Window::dispose();
}
DeckTitleBar* Deck::GetTitleBar() const
@@ -210,8 +202,21 @@ bool Deck::ProcessWheelEvent(CommandEvent* pCommandEvent)
return true;
}
-void Deck::SetPanels (const SharedPanelContainer& rPanels)
+/**
+ * This container may contain existing panels that are
+ * being re-used, and new ones too.
+ */
+void Deck::ResetPanels (const SharedPanelContainer& rPanels)
{
+ // First dispose old panels we no longer need.
+ for (size_t i = 0; i < maPanels.size(); i++)
+ {
+ bool bFound = false;
+ for (size_t j = 0; j < rPanels.size(); j++)
+ bFound = bFound || (maPanels[i].get() == rPanels[j].get());
+ if (!bFound) // this one didn't survive.
+ maPanels[i].disposeAndClear();
+ }
maPanels = rPanels;
RequestLayout();
@@ -323,10 +328,6 @@ Deck::ScrollContainerWindow::ScrollContainerWindow (vcl::Window* pParentWindow)
#endif
}
-Deck::ScrollContainerWindow::~ScrollContainerWindow()
-{
-}
-
void Deck::ScrollContainerWindow::Paint (const Rectangle& rUpdateArea)
{
(void)rUpdateArea;
diff --git a/sfx2/source/sidebar/Deck.hxx b/sfx2/source/sidebar/Deck.hxx
index ddb5354b21e1..b231b5c9b628 100644
--- a/sfx2/source/sidebar/Deck.hxx
+++ b/sfx2/source/sidebar/Deck.hxx
@@ -47,13 +47,12 @@ public:
vcl::Window* pParentWindow,
const ::boost::function<void()>& rCloserAction);
virtual ~Deck();
-
- void Dispose();
+ virtual void dispose() SAL_OVERRIDE;
const ::rtl::OUString& GetId() const { return msId;}
DeckTitleBar* GetTitleBar() const;
Rectangle GetContentArea() const;
- void SetPanels (const SharedPanelContainer& rPanels);
+ void ResetPanels (const SharedPanelContainer& rPanels);
const SharedPanelContainer& GetPanels() const { return maPanels;}
void RequestLayout();
vcl::Window* GetPanelParentWindow();
@@ -77,7 +76,6 @@ public:
{
public:
ScrollContainerWindow (vcl::Window* pParentWindow);
- virtual ~ScrollContainerWindow();
virtual void Paint (const Rectangle& rUpdateArea) SAL_OVERRIDE;
void SetSeparators (const ::std::vector<sal_Int32>& rSeparators);
private:
@@ -89,11 +87,11 @@ private:
Image maIcon;
sal_Int32 mnMinimalWidth;
SharedPanelContainer maPanels;
- ::boost::scoped_ptr<DeckTitleBar> mpTitleBar;
- ::boost::scoped_ptr<vcl::Window> mpScrollClipWindow;
- ::boost::scoped_ptr<ScrollContainerWindow> mpScrollContainer;
- ::boost::scoped_ptr<vcl::Window> mpFiller;
- ::boost::scoped_ptr<ScrollBar> mpVerticalScrollBar;
+ VclPtr<DeckTitleBar> mpTitleBar;
+ VclPtr<vcl::Window> mpScrollClipWindow;
+ VclPtr<ScrollContainerWindow> mpScrollContainer;
+ VclPtr<vcl::Window> mpFiller;
+ VclPtr<ScrollBar> mpVerticalScrollBar;
DECL_LINK(HandleVerticalScrollBarChange,void*);
bool ProcessWheelEvent(CommandEvent* pCommandEvent);
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx
index aae65c611950..110a77fc4cbb 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -43,7 +43,7 @@ namespace {
class LayoutItem
{
public:
- SharedPanel mpPanel;
+ VclPtr<Panel> mpPanel;
css::ui::LayoutSize maLayoutSize;
sal_Int32 mnDistributedHeight;
sal_Int32 mnWeight;
@@ -348,7 +348,7 @@ void GetRequestedSizes (
IterateLayoutItems(iItem,rLayoutItems)
{
ui::LayoutSize aLayoutSize (ui::LayoutSize(0,0,0));
- if (iItem->mpPanel != 0)
+ if (iItem->mpPanel != nullptr)
{
if (rLayoutItems.size() == 1
&& iItem->mpPanel->IsTitleBarOptional())
diff --git a/sfx2/source/sidebar/DeckTitleBar.cxx b/sfx2/source/sidebar/DeckTitleBar.cxx
index 9c296b1f3f3d..4e52d1aa57ab 100644
--- a/sfx2/source/sidebar/DeckTitleBar.cxx
+++ b/sfx2/source/sidebar/DeckTitleBar.cxx
@@ -52,10 +52,6 @@ DeckTitleBar::DeckTitleBar (
#endif
}
-DeckTitleBar::~DeckTitleBar()
-{
-}
-
void DeckTitleBar::SetCloserVisible (const bool bIsCloserVisible)
{
if (mbIsCloserVisible != bIsCloserVisible)
@@ -64,16 +60,16 @@ void DeckTitleBar::SetCloserVisible (const bool bIsCloserVisible)
if (mbIsCloserVisible)
{
- maToolBox.InsertItem(
+ maToolBox->InsertItem(
mnCloserItemIndex,
Theme::GetImage(Theme::Image_Closer));
- maToolBox.SetQuickHelpText(
+ maToolBox->SetQuickHelpText(
mnCloserItemIndex,
SFX2_RESSTR(SFX_STR_SIDEBAR_CLOSE_DECK));
}
else
- maToolBox.RemoveItem(
- maToolBox.GetItemPos(mnCloserItemIndex));
+ maToolBox->RemoveItem(
+ maToolBox->GetItemPos(mnCloserItemIndex));
}
}
@@ -119,7 +115,7 @@ css::uno::Reference<css::accessibility::XAccessible> DeckTitleBar::CreateAccessi
void DeckTitleBar::DataChanged (const DataChangedEvent& rEvent)
{
- maToolBox.SetItemImage(
+ maToolBox->SetItemImage(
mnCloserItemIndex,
Theme::GetImage(Theme::Image_Closer));
TitleBar::DataChanged(rEvent);
diff --git a/sfx2/source/sidebar/DeckTitleBar.hxx b/sfx2/source/sidebar/DeckTitleBar.hxx
index d481b2d842d3..871635b42632 100644
--- a/sfx2/source/sidebar/DeckTitleBar.hxx
+++ b/sfx2/source/sidebar/DeckTitleBar.hxx
@@ -33,7 +33,6 @@ public:
const ::rtl::OUString& rsTitle,
vcl::Window* pParentWindow,
const ::boost::function<void()>& rCloserAction);
- virtual ~DeckTitleBar();
void SetCloserVisible (const bool bIsCloserVisible);
diff --git a/sfx2/source/sidebar/FocusManager.cxx b/sfx2/source/sidebar/FocusManager.cxx
index 1dae58556cbd..37fa9940c1ea 100644
--- a/sfx2/source/sidebar/FocusManager.cxx
+++ b/sfx2/source/sidebar/FocusManager.cxx
@@ -65,9 +65,9 @@ void FocusManager::Clear()
void FocusManager::ClearPanels()
{
- ::std::vector<Panel*> aPanels;
+ ::std::vector<VclPtr<Panel> > aPanels;
aPanels.swap(maPanels);
- for (::std::vector<Panel*>::iterator iPanel(aPanels.begin()),iEnd(aPanels.end());
+ for (auto iPanel(aPanels.begin()),iEnd(aPanels.end());
iPanel!=iEnd;
++iPanel)
{
@@ -84,9 +84,9 @@ void FocusManager::ClearPanels()
void FocusManager::ClearButtons()
{
- ::std::vector<Button*> aButtons;
+ ::std::vector<VclPtr<Button> > aButtons;
aButtons.swap(maButtons);
- for (::std::vector<Button*>::iterator iButton(aButtons.begin()),iEnd(aButtons.end());
+ for (auto iButton(aButtons.begin()),iEnd(aButtons.end());
iButton!=iEnd;
++iButton)
{
@@ -96,14 +96,14 @@ void FocusManager::ClearButtons()
void FocusManager::SetDeckTitle (DeckTitleBar* pDeckTitleBar)
{
- if (mpDeckTitleBar != NULL)
+ if (mpDeckTitleBar != nullptr)
{
UnregisterWindow(*mpDeckTitleBar);
UnregisterWindow(mpDeckTitleBar->GetToolBox());
}
mpDeckTitleBar = pDeckTitleBar;
- if (mpDeckTitleBar != NULL)
+ if (mpDeckTitleBar != nullptr)
{
RegisterWindow(*mpDeckTitleBar);
RegisterWindow(mpDeckTitleBar->GetToolBox());
@@ -156,7 +156,7 @@ void FocusManager::UnregisterWindow (vcl::Window& rWindow)
FocusManager::FocusLocation FocusManager::GetFocusLocation (const vcl::Window& rWindow) const
{
// Check the deck title.
- if (mpDeckTitleBar != NULL)
+ if (mpDeckTitleBar != nullptr)
{
if (mpDeckTitleBar == &rWindow)
return FocusLocation(PC_DeckTitle, -1);
@@ -186,7 +186,7 @@ FocusManager::FocusLocation FocusManager::GetFocusLocation (const vcl::Window& r
void FocusManager::FocusDeckTitle()
{
- if (mpDeckTitleBar != NULL)
+ if (mpDeckTitleBar != nullptr)
{
if (IsDeckTitleVisible())
{
@@ -207,7 +207,7 @@ void FocusManager::FocusDeckTitle()
bool FocusManager::IsDeckTitleVisible() const
{
- return mpDeckTitleBar != NULL && mpDeckTitleBar->IsVisible();
+ return mpDeckTitleBar != nullptr && mpDeckTitleBar->IsVisible();
}
bool FocusManager::IsPanelTitleVisible (const sal_Int32 nPanelIndex) const
@@ -286,7 +286,7 @@ void FocusManager::ClickButton (const sal_Int32 nButtonIndex)
void FocusManager::RemoveWindow (vcl::Window& rWindow)
{
- ::std::vector<Panel*>::iterator iPanel (::std::find(maPanels.begin(), maPanels.end(), &rWindow));
+ auto iPanel (::std::find(maPanels.begin(), maPanels.end(), &rWindow));
if (iPanel != maPanels.end())
{
UnregisterWindow(rWindow);
@@ -299,7 +299,7 @@ void FocusManager::RemoveWindow (vcl::Window& rWindow)
return;
}
- ::std::vector<Button*>::iterator iButton (::std::find(maButtons.begin(), maButtons.end(), &rWindow));
+ auto iButton (::std::find(maButtons.begin(), maButtons.end(), &rWindow));
if (iButton != maButtons.end())
{
UnregisterWindow(rWindow);
@@ -596,7 +596,7 @@ IMPL_LINK(FocusManager, ChildEventListener, VclSimpleEvent*, pEvent)
break;
case KEY_TAB:
- if (mpFirstFocusedContentControl!=NULL
+ if (mpFirstFocusedContentControl!=nullptr
&& mpLastFocusedWindow == mpFirstFocusedContentControl)
{
// Move focus back to panel (or deck)
diff --git a/sfx2/source/sidebar/FocusManager.hxx b/sfx2/source/sidebar/FocusManager.hxx
index 4db5fe1ead64..93367bd4ce44 100644
--- a/sfx2/source/sidebar/FocusManager.hxx
+++ b/sfx2/source/sidebar/FocusManager.hxx
@@ -68,13 +68,13 @@ public:
void SetButtons (const ::std::vector<Button*>& rButtons);
private:
- DeckTitleBar* mpDeckTitleBar;
- ::std::vector<Panel*> maPanels;
- ::std::vector<Button*> maButtons;
+ VclPtr<DeckTitleBar> mpDeckTitleBar;
+ ::std::vector<VclPtr<Panel> > maPanels;
+ ::std::vector<VclPtr<Button> > maButtons;
const ::boost::function<void(const Panel&)> maShowPanelFunctor;
bool mbObservingContentControlFocus;
- vcl::Window* mpFirstFocusedContentControl;
- vcl::Window* mpLastFocusedWindow;
+ VclPtr<vcl::Window> mpFirstFocusedContentControl;
+ VclPtr<vcl::Window> mpLastFocusedWindow;
enum PanelComponent
{
diff --git a/sfx2/source/sidebar/MenuButton.cxx b/sfx2/source/sidebar/MenuButton.cxx
index 8620b30f9b93..c0e131109dc5 100644
--- a/sfx2/source/sidebar/MenuButton.cxx
+++ b/sfx2/source/sidebar/MenuButton.cxx
@@ -39,10 +39,6 @@ MenuButton::MenuButton (vcl::Window* pParentWindow)
#endif
}
-MenuButton::~MenuButton()
-{
-}
-
void MenuButton::Paint (const Rectangle& rUpdateArea)
{
switch(mePaintType)
diff --git a/sfx2/source/sidebar/MenuButton.hxx b/sfx2/source/sidebar/MenuButton.hxx
index 121dd991d4c6..1d09e14d4e9d 100644
--- a/sfx2/source/sidebar/MenuButton.hxx
+++ b/sfx2/source/sidebar/MenuButton.hxx
@@ -28,7 +28,6 @@ class MenuButton
{
public:
MenuButton (vcl::Window* pParentWindow);
- virtual ~MenuButton();
virtual void Paint (const Rectangle& rUpdateArea) SAL_OVERRIDE;
virtual void MouseMove (const MouseEvent& rEvent) SAL_OVERRIDE;
diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx
index d72f15e57c22..52c9abc831f7 100644
--- a/sfx2/source/sidebar/Panel.cxx
+++ b/sfx2/source/sidebar/Panel.cxx
@@ -51,7 +51,7 @@ Panel::Panel (
const ::boost::function<Context()>& rContextAccess)
: Window(pParentWindow),
msPanelId(rPanelDescriptor.msId),
- mpTitleBar(new PanelTitleBar(
+ mpTitleBar(VclPtr<PanelTitleBar>::Create(
rPanelDescriptor.msTitle,
pParentWindow,
this)),
@@ -71,10 +71,10 @@ Panel::Panel (
Panel::~Panel()
{
- Dispose();
+ disposeOnce();
}
-void Panel::Dispose()
+void Panel::dispose()
{
mxPanelComponent = NULL;
@@ -91,7 +91,9 @@ void Panel::Dispose()
xComponent->dispose();
}
- mpTitleBar.reset();
+ mpTitleBar.disposeAndClear();
+
+ vcl::Window::dispose();
}
PanelTitleBar* Panel::GetTitleBar() const
diff --git a/sfx2/source/sidebar/Panel.hxx b/sfx2/source/sidebar/Panel.hxx
index ad2c78d6e95d..03cd81ca5ec8 100644
--- a/sfx2/source/sidebar/Panel.hxx
+++ b/sfx2/source/sidebar/Panel.hxx
@@ -47,8 +47,7 @@ public:
const ::boost::function<void()>& rDeckLayoutTrigger,
const ::boost::function<Context()>& rContextAccess);
virtual ~Panel();
-
- void Dispose();
+ virtual void dispose() SAL_OVERRIDE;
PanelTitleBar* GetTitleBar() const;
bool IsTitleBarOptional() const { return mbIsTitleBarOptional;}
@@ -67,7 +66,7 @@ public:
private:
const ::rtl::OUString msPanelId;
- ::boost::scoped_ptr<PanelTitleBar> mpTitleBar;
+ VclPtr<PanelTitleBar> mpTitleBar;
const bool mbIsTitleBarOptional;
css::uno::Reference<css::ui::XUIElement> mxElement;
css::uno::Reference<css::ui::XSidebarPanel> mxPanelComponent;
@@ -75,8 +74,7 @@ private:
const ::boost::function<void()> maDeckLayoutTrigger;
const ::boost::function<Context()> maContextAccess;
};
-typedef ::boost::shared_ptr<Panel> SharedPanel;
-typedef ::std::vector<SharedPanel> SharedPanelContainer;
+typedef ::std::vector< VclPtr< Panel > > SharedPanelContainer;
} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/PanelTitleBar.cxx b/sfx2/source/sidebar/PanelTitleBar.cxx
index b8cf19fbc507..f526c0250055 100644
--- a/sfx2/source/sidebar/PanelTitleBar.cxx
+++ b/sfx2/source/sidebar/PanelTitleBar.cxx
@@ -51,7 +51,7 @@ PanelTitleBar::PanelTitleBar (
msMoreOptionsCommand(),
msAccessibleNamePrefix(SFX2_RESSTR(SFX_STR_SIDEBAR_ACCESSIBILITY_PANEL_PREFIX))
{
- OSL_ASSERT(mpPanel != NULL);
+ OSL_ASSERT(mpPanel != nullptr);
#ifdef DEBUG
SetText(OUString("PanelTitleBar"));
@@ -60,6 +60,13 @@ PanelTitleBar::PanelTitleBar (
PanelTitleBar::~PanelTitleBar()
{
+ disposeOnce();
+}
+
+void PanelTitleBar::dispose()
+{
+ mpPanel.clear();
+ TitleBar::dispose();
}
void PanelTitleBar::SetMoreOptionsCommand (
@@ -69,27 +76,27 @@ void PanelTitleBar::SetMoreOptionsCommand (
if ( ! rsCommandName.equals(msMoreOptionsCommand))
{
if (msMoreOptionsCommand.getLength() > 0)
- maToolBox.RemoveItem(maToolBox.GetItemPos(mnMenuItemIndex));
+ maToolBox->RemoveItem(maToolBox->GetItemPos(mnMenuItemIndex));
msMoreOptionsCommand = rsCommandName;
mxFrame = rxFrame;
if (msMoreOptionsCommand.getLength() > 0)
{
- maToolBox.InsertItem(
+ maToolBox->InsertItem(
mnMenuItemIndex,
Theme::GetImage(Theme::Image_PanelMenu));
Reference<frame::XToolbarController> xController (
ControllerFactory::CreateToolBoxController(
- &maToolBox,
+ maToolBox.get(),
mnMenuItemIndex,
msMoreOptionsCommand,
rxFrame,
- VCLUnoHelper::GetInterface(&maToolBox),
+ VCLUnoHelper::GetInterface(maToolBox.get()),
0));
- maToolBox.SetController(mnMenuItemIndex, xController, msMoreOptionsCommand);
- maToolBox.SetOutStyle(TOOLBOX_STYLE_FLAT);
- maToolBox.SetQuickHelpText(
+ maToolBox->SetController(mnMenuItemIndex, xController, msMoreOptionsCommand);
+ maToolBox->SetOutStyle(TOOLBOX_STYLE_FLAT);
+ maToolBox->SetQuickHelpText(
mnMenuItemIndex,
SFX2_RESSTR(SFX_STR_SIDEBAR_MORE_OPTIONS));
}
@@ -98,7 +105,7 @@ void PanelTitleBar::SetMoreOptionsCommand (
Rectangle PanelTitleBar::GetTitleArea (const Rectangle& rTitleBarBox)
{
- if (mpPanel != NULL)
+ if (mpPanel != nullptr)
{
Image aImage (mpPanel->IsExpanded()
? Theme::GetImage(Theme::Image_Expand)
@@ -117,7 +124,7 @@ void PanelTitleBar::PaintDecoration (const Rectangle& rTitleBarBox)
{
(void)rTitleBarBox;
- if (mpPanel != NULL)
+ if (mpPanel != nullptr)
{
Image aImage (mpPanel->IsExpanded()
? Theme::GetImage(Theme::Image_Collapse)
@@ -185,7 +192,7 @@ void PanelTitleBar::MouseButtonUp (const MouseEvent& rMouseEvent)
{
if (mbIsLeftButtonDown)
{
- if (mpPanel != NULL)
+ if (mpPanel != nullptr)
{
mpPanel->SetExpanded( ! mpPanel->IsExpanded());
Invalidate();
@@ -198,7 +205,7 @@ void PanelTitleBar::MouseButtonUp (const MouseEvent& rMouseEvent)
void PanelTitleBar::DataChanged (const DataChangedEvent& rEvent)
{
- maToolBox.SetItemImage(
+ maToolBox->SetItemImage(
mnMenuItemIndex,
Theme::GetImage(Theme::Image_PanelMenu));
TitleBar::DataChanged(rEvent);
diff --git a/sfx2/source/sidebar/PanelTitleBar.hxx b/sfx2/source/sidebar/PanelTitleBar.hxx
index 37effd70726f..ede039f863dd 100644
--- a/sfx2/source/sidebar/PanelTitleBar.hxx
+++ b/sfx2/source/sidebar/PanelTitleBar.hxx
@@ -37,6 +37,7 @@ public:
vcl::Window* pParentWindow,
Panel* pPanel );
virtual ~PanelTitleBar();
+ virtual void dispose() SAL_OVERRIDE;
void SetMoreOptionsCommand (
const ::rtl::OUString& rsCommandName,
@@ -56,7 +57,7 @@ protected:
private:
bool mbIsLeftButtonDown;
- Panel* mpPanel;
+ VclPtr<Panel> mpPanel;
const sal_uInt16 mnMenuItemIndex;
css::uno::Reference<css::frame::XFrame> mxFrame;
::rtl::OUString msMoreOptionsCommand;
diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx b/sfx2/source/sidebar/SidebarChildWindow.cxx
index 4d4730d06df4..8587c290e335 100644
--- a/sfx2/source/sidebar/SidebarChildWindow.cxx
+++ b/sfx2/source/sidebar/SidebarChildWindow.cxx
@@ -37,17 +37,17 @@ SidebarChildWindow::SidebarChildWindow (
SfxChildWinInfo* pInfo)
: SfxChildWindow(pParentWindow, nId)
{
- pWindow = new SidebarDockingWindow(
+ pWindow.reset(VclPtr<SidebarDockingWindow>::Create(
pBindings,
*this,
pParentWindow,
- WB_STDDOCKWIN | WB_OWNERDRAWDECORATION | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE);
+ WB_STDDOCKWIN | WB_OWNERDRAWDECORATION | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE));
eChildAlignment = SfxChildAlignment::RIGHT;
pWindow->SetHelpId(HID_SIDEBAR_WINDOW);
pWindow->SetOutputSizePixel(Size(GetDefaultWidth(pWindow), 450));
- SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(pWindow);
+ SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(pWindow.get());
if (pDockingParent != NULL)
{
if (pInfo && pInfo->aExtraString.isEmpty() && pInfo->aModule != "sdraw" && pInfo->aModule != "simpress")
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 6268a1e2abd0..4392c1b1c979 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -95,7 +95,7 @@ SidebarController::SidebarController (
: SidebarControllerInterfaceBase(m_aMutex),
mpCurrentDeck(),
mpParentWindow(pParentWindow),
- mpTabBar(new TabBar(
+ mpTabBar(VclPtr<TabBar>::Create(
mpParentWindow,
rxFrame,
::boost::bind(&SidebarController::OpenThenSwitchToDeck, this, _1),
@@ -117,8 +117,7 @@ SidebarController::SidebarController (
mxReadOnlyModeDispatch(),
mbIsDocumentReadOnly(false),
mpSplitWindow(NULL),
- mnWidthOnSplitterButtonDown(0),
- mpCloseIndicator()
+ mnWidthOnSplitterButtonDown(0)
{
// Listen for context change events.
css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (
@@ -173,6 +172,8 @@ SidebarController* SidebarController::GetSidebarControllerForFrame (
void SAL_CALL SidebarController::disposing()
{
+ mpCloseIndicator.disposeAndClear();
+
SidebarControllerContainer::iterator iEntry (maSidebarControllerContainer.find(mxFrame));
if (iEntry != maSidebarControllerContainer.end())
maSidebarControllerContainer.erase(iEntry);
@@ -188,13 +189,13 @@ void SAL_CALL SidebarController::disposing()
if (mxReadOnlyModeDispatch.is())
mxReadOnlyModeDispatch->removeStatusListener(this, Tools::GetURL(gsReadOnlyCommandName));
- if (mpSplitWindow != NULL)
+ if (mpSplitWindow != nullptr)
{
mpSplitWindow->RemoveEventListener(LINK(this, SidebarController, WindowEventHandler));
mpSplitWindow = NULL;
}
- if (mpParentWindow != NULL)
+ if (mpParentWindow != nullptr)
{
mpParentWindow->RemoveEventListener(LINK(this, SidebarController, WindowEventHandler));
mpParentWindow = NULL;
@@ -202,12 +203,11 @@ void SAL_CALL SidebarController::disposing()
if (mpCurrentDeck)
{
- mpCurrentDeck->Dispose();
- mpCurrentDeck->PrintWindowTree();
- mpCurrentDeck.reset();
+ mpCurrentDeck.disposeAndClear();
+// mpCurrentDeck->PrintWindowTree();
}
- mpTabBar.reset();
+ mpTabBar.disposeAndClear();
Theme::GetPropertySet()->removePropertyChangeListener(
OUString(""),
@@ -292,7 +292,7 @@ void SidebarController::NotifyResize()
{
if (mpTabBar == 0)
{
- OSL_ASSERT(mpTabBar!=0);
+ OSL_ASSERT(mpTabBar!=nullptr);
return;
}
@@ -527,18 +527,13 @@ void SidebarController::SwitchToDeck (
const bool bForceNewDeck ((mnRequestedForceFlags&SwitchFlag_ForceNewDeck)!=0);
const bool bForceNewPanels ((mnRequestedForceFlags&SwitchFlag_ForceNewPanels)!=0);
- mnRequestedForceFlags = SwitchFlag_NoForce;
if ( ! msCurrentDeckId.equals(rDeckDescriptor.msId)
|| bForceNewDeck)
{
// When the deck changes then destroy the deck and all panels
// and create everything new.
- if (mpCurrentDeck)
- {
- mpCurrentDeck->Dispose();
- mpCurrentDeck.reset();
- }
+ mpCurrentDeck.disposeAndClear();
msCurrentDeckId = rDeckDescriptor.msId;
}
@@ -576,7 +571,7 @@ void SidebarController::SwitchToDeck (
if ( ! mpCurrentDeck)
{
mpCurrentDeck.reset(
- new Deck(
+ VclPtr<Deck>::Create(
rDeckDescriptor,
mpParentWindow,
::boost::bind(&SidebarController::RequestCloseDeck, this)));
@@ -597,6 +592,7 @@ void SidebarController::SwitchToDeck (
const sal_Int32 nNewPanelCount (aPanelContextDescriptors.size());
SharedPanelContainer aNewPanels;
const SharedPanelContainer& rCurrentPanels (mpCurrentDeck->GetPanels());
+
aNewPanels.resize(nNewPanelCount);
sal_Int32 nWriteIndex (0);
bool bHasPanelSetChanged (false);
@@ -612,19 +608,19 @@ void SidebarController::SwitchToDeck (
// Find the corresponding panel among the currently active
// panels.
- SharedPanelContainer::const_iterator iPanel;
- if (bForceNewPanels)
+ SharedPanelContainer::const_iterator iPanel = rCurrentPanels.end();
+
+ if (!bForceNewPanels)
{
- // All panels have to be created in any case. There is no
- // point in searching already existing panels.
iPanel = rCurrentPanels.end();
- }
- else
- {
- iPanel = ::std::find_if(
- rCurrentPanels.begin(),
- rCurrentPanels.end(),
- ::boost::bind(&Panel::HasIdPredicate, _1, ::boost::cref(rPanelContexDescriptor.msId)));
+ for (auto a = rCurrentPanels.begin(); a != rCurrentPanels.end(); ++a)
+ {
+ if ((*a)->HasIdPredicate(rPanelContexDescriptor.msId))
+ {
+ iPanel = a;
+ break;
+ }
+ }
}
if (iPanel != rCurrentPanels.end())
{
@@ -643,7 +639,7 @@ void SidebarController::SwitchToDeck (
rContext);
bHasPanelSetChanged = true;
}
- if (aNewPanels[nWriteIndex] != 0)
+ if (aNewPanels[nWriteIndex] != nullptr)
{
// Depending on the context we have to change the command
// for the "more options" dialog.
@@ -659,6 +655,7 @@ void SidebarController::SwitchToDeck (
}
}
+ // mpCurrentPanels - may miss stuff (?)
aNewPanels.resize(nWriteIndex);
// Activate the deck and the new set of panels.
@@ -668,7 +665,7 @@ void SidebarController::SwitchToDeck (
mpParentWindow->GetSizePixel().Width()-TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor(),
mpParentWindow->GetSizePixel().Height());
- mpCurrentDeck->SetPanels(aNewPanels);
+ mpCurrentDeck->ResetPanels(aNewPanels);
mpCurrentDeck->Show();
mpParentWindow->SetText(rDeckDescriptor.msTitle);
@@ -684,7 +681,7 @@ void SidebarController::SwitchToDeck (
UpdateTitleBarIcons();
}
-SharedPanel SidebarController::CreatePanel (
+VclPtr<Panel> SidebarController::CreatePanel (
const OUString& rsPanelId,
vcl::Window* pParentWindow,
const bool bIsInitiallyExpanded,
@@ -692,15 +689,15 @@ SharedPanel SidebarController::CreatePanel (
{
const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
if (pPanelDescriptor == NULL)
- return SharedPanel();
+ return NULL;
// Create the panel which is the parent window of the UIElement.
- SharedPanel pPanel (new Panel(
+ VclPtr<Panel> pPanel = VclPtr<Panel>::Create(
*pPanelDescriptor,
pParentWindow,
bIsInitiallyExpanded,
::boost::bind(&Deck::RequestLayout, mpCurrentDeck.get()),
- ::boost::bind(&SidebarController::GetCurrentContext, this)));
+ ::boost::bind(&SidebarController::GetCurrentContext, this));
// Create the XUIElement.
Reference<ui::XUIElement> xUIElement (CreateUIElement(
@@ -715,7 +712,7 @@ SharedPanel SidebarController::CreatePanel (
}
else
{
- pPanel.reset();
+ pPanel.disposeAndClear();
}
return pPanel;
@@ -737,7 +734,7 @@ Reference<ui::XUIElement> SidebarController::CreateUIElement (
::comphelper::NamedValueCollection aCreationArguments;
aCreationArguments.put("Frame", makeAny(mxFrame));
aCreationArguments.put("ParentWindow", makeAny(rxWindow));
- SfxDockingWindow* pSfxDockingWindow = dynamic_cast<SfxDockingWindow*>(mpParentWindow);
+ SfxDockingWindow* pSfxDockingWindow = dynamic_cast<SfxDockingWindow*>(mpParentWindow.get());
if (pSfxDockingWindow != NULL)
aCreationArguments.put("SfxBindings", makeAny(sal_uInt64(&pSfxDockingWindow->GetBindings())));
aCreationArguments.put("Theme", Theme::GetPropertySet());
@@ -802,7 +799,7 @@ IMPL_LINK(SidebarController, WindowEventHandler, VclWindowEvent*, pEvent)
break;
}
}
- else if (pEvent->GetWindow()==mpSplitWindow && mpSplitWindow!=NULL)
+ else if (pEvent->GetWindow()==mpSplitWindow && mpSplitWindow!=nullptr)
{
switch (pEvent->GetId())
{
@@ -1060,7 +1057,7 @@ void SidebarController::RestrictWidth (sal_Int32 nWidth)
SfxSplitWindow* pSplitWindow = GetSplitWindow();
if (pSplitWindow != NULL)
{
- const sal_uInt16 nId (pSplitWindow->GetItemId(mpParentWindow));
+ const sal_uInt16 nId (pSplitWindow->GetItemId(mpParentWindow.get()));
const sal_uInt16 nSetId (pSplitWindow->GetSet(nId));
pSplitWindow->SetItemSizeRange(
nSetId,
@@ -1071,17 +1068,17 @@ void SidebarController::RestrictWidth (sal_Int32 nWidth)
SfxSplitWindow* SidebarController::GetSplitWindow()
{
- if (mpParentWindow != NULL)
+ if (mpParentWindow != nullptr)
{
SfxSplitWindow* pSplitWindow = dynamic_cast<SfxSplitWindow*>(mpParentWindow->GetParent());
if (pSplitWindow != mpSplitWindow)
{
- if (mpSplitWindow != NULL)
+ if (mpSplitWindow != nullptr)
mpSplitWindow->RemoveEventListener(LINK(this, SidebarController, WindowEventHandler));
mpSplitWindow = pSplitWindow;
- if (mpSplitWindow != NULL)
+ if (mpSplitWindow != nullptr)
mpSplitWindow->AddEventListener(LINK(this, SidebarController, WindowEventHandler));
}
return mpSplitWindow;
@@ -1092,7 +1089,7 @@ SfxSplitWindow* SidebarController::GetSplitWindow()
void SidebarController::UpdateCloseIndicator (const bool bCloseAfterDrag)
{
- if (mpParentWindow == NULL)
+ if (mpParentWindow == nullptr)
return;
if (bCloseAfterDrag)
@@ -1100,7 +1097,7 @@ void SidebarController::UpdateCloseIndicator (const bool bCloseAfterDrag)
// Make sure that the indicator exists.
if ( ! mpCloseIndicator)
{
- mpCloseIndicator.reset(new FixedImage(mpParentWindow));
+ mpCloseIndicator.reset(VclPtr<FixedImage>::Create(mpParentWindow));
FixedImage* pFixedImage = static_cast<FixedImage*>(mpCloseIndicator.get());
const Image aImage (Theme::GetImage(Theme::Image_CloseIndicator));
pFixedImage->SetImage(aImage);
diff --git a/sfx2/source/sidebar/SidebarController.hxx b/sfx2/source/sidebar/SidebarController.hxx
index 14705d91ca02..5fb8466b1fbc 100644
--- a/sfx2/source/sidebar/SidebarController.hxx
+++ b/sfx2/source/sidebar/SidebarController.hxx
@@ -144,9 +144,9 @@ private:
> SidebarControllerContainer;
static SidebarControllerContainer maSidebarControllerContainer;
- ::boost::scoped_ptr<Deck> mpCurrentDeck;
- SidebarDockingWindow* mpParentWindow;
- ::boost::scoped_ptr<TabBar> mpTabBar;
+ VclPtr<Deck> mpCurrentDeck;
+ VclPtr<SidebarDockingWindow> mpParentWindow;
+ VclPtr<TabBar> mpTabBar;
css::uno::Reference<css::frame::XFrame> mxFrame;
Context maCurrentContext;
Context maRequestedContext;
@@ -177,7 +177,7 @@ private:
FocusManager maFocusManager;
css::uno::Reference<css::frame::XDispatch> mxReadOnlyModeDispatch;
bool mbIsDocumentReadOnly;
- SfxSplitWindow* mpSplitWindow;
+ VclPtr<SfxSplitWindow> mpSplitWindow;
/** When the user moves the splitter then we remember the
width at that time.
*/
@@ -186,7 +186,7 @@ private:
to indicate that when the current mouse drag operation ends, the
sidebar will only show the tab bar.
*/
- ::boost::scoped_ptr<vcl::Window> mpCloseIndicator;
+ VclPtr<vcl::Window> mpCloseIndicator;
DECL_LINK(WindowEventHandler, VclWindowEvent*);
/** Make maRequestedContext the current context.
@@ -198,7 +198,7 @@ private:
const ::rtl::OUString& rsImplementationURL,
const bool bWantsCanvas,
const Context& rContext);
- SharedPanel CreatePanel (
+ VclPtr<Panel> CreatePanel (
const ::rtl::OUString& rsPanelId,
vcl::Window* pParentWindow,
const bool bIsInitiallyExpanded,
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index f67240c1a06c..7c9a150aeb79 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -53,7 +53,13 @@ SidebarDockingWindow::SidebarDockingWindow(
SidebarDockingWindow::~SidebarDockingWindow()
{
+ disposeOnce();
+}
+
+void SidebarDockingWindow::dispose()
+{
DoDispose();
+ SfxDockingWindow::dispose();
}
void SidebarDockingWindow::DoDispose()
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.hxx b/sfx2/source/sidebar/SidebarDockingWindow.hxx
index 47724b4d3520..fd45c691842d 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.hxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.hxx
@@ -39,6 +39,7 @@ public:
vcl::Window* pParent,
WinBits nBits);
virtual ~SidebarDockingWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool Close() SAL_OVERRIDE;
diff --git a/sfx2/source/sidebar/SidebarPanelBase.cxx b/sfx2/source/sidebar/SidebarPanelBase.cxx
index fbe51379f322..a7ec830687dd 100644
--- a/sfx2/source/sidebar/SidebarPanelBase.cxx
+++ b/sfx2/source/sidebar/SidebarPanelBase.cxx
@@ -67,7 +67,7 @@ SidebarPanelBase::SidebarPanelBase (
if (xMultiplexer.is())
xMultiplexer->addContextChangeEventListener(this, mxFrame->getController());
}
- if (mpControl != NULL)
+ if (mpControl != nullptr)
{
mpControl->SetBackground(Theme::GetWallpaper(Theme::Paint_PanelBackground));
mpControl->Show();
@@ -81,11 +81,7 @@ SidebarPanelBase::~SidebarPanelBase()
void SAL_CALL SidebarPanelBase::disposing()
throw (css::uno::RuntimeException)
{
- if (mpControl != NULL)
- {
- delete mpControl;
- mpControl = NULL;
- }
+ mpControl.disposeAndClear();
if (mxFrame.is())
{
@@ -104,7 +100,7 @@ void SAL_CALL SidebarPanelBase::notifyContextChangeEvent (
throw (css::uno::RuntimeException, std::exception)
{
IContextChangeReceiver* pContextChangeReceiver
- = dynamic_cast<IContextChangeReceiver*>(mpControl);
+ = dynamic_cast<IContextChangeReceiver*>(mpControl.get());
if (pContextChangeReceiver != NULL)
{
const EnumContext aContext(
@@ -161,7 +157,7 @@ Reference<accessibility::XAccessible> SAL_CALL SidebarPanelBase::createAccessibl
Reference<awt::XWindow> SAL_CALL SidebarPanelBase::getWindow()
throw(css::uno::RuntimeException, std::exception)
{
- if (mpControl != NULL)
+ if (mpControl != nullptr)
return Reference<awt::XWindow>(
mpControl->GetComponentInterface(),
UNO_QUERY);
@@ -176,7 +172,7 @@ ui::LayoutSize SAL_CALL SidebarPanelBase::getHeightForWidth (const sal_Int32 nWi
return maLayoutSize;
else
{
- ILayoutableWindow* pLayoutableWindow = dynamic_cast<ILayoutableWindow*>(mpControl);
+ ILayoutableWindow* pLayoutableWindow = dynamic_cast<ILayoutableWindow*>(mpControl.get());
if (isLayoutEnabled(mpControl))
{
@@ -186,7 +182,7 @@ ui::LayoutSize SAL_CALL SidebarPanelBase::getHeightForWidth (const sal_Int32 nWi
}
else if (pLayoutableWindow != NULL)
return pLayoutableWindow->GetHeightForWidth(nWidth);
- else if (mpControl != NULL)
+ else if (mpControl != nullptr)
{
const sal_Int32 nHeight (mpControl->GetSizePixel().Height());
return ui::LayoutSize(nHeight,nHeight,nHeight);
diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx
index e1987fd8c9cc..af27f4757f07 100644
--- a/sfx2/source/sidebar/SidebarToolBox.cxx
+++ b/sfx2/source/sidebar/SidebarToolBox.cxx
@@ -57,6 +57,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSidebarToolBox(vcl::Wi
SidebarToolBox::~SidebarToolBox()
{
+ disposeOnce();
+}
+
+void SidebarToolBox::dispose()
+{
ControllerContainer aControllers;
aControllers.swap(maControllers);
for (ControllerContainer::iterator iController(aControllers.begin()), iEnd(aControllers.end());
@@ -76,7 +81,10 @@ SidebarToolBox::~SidebarToolBox()
SetSelectHdl(Link());
SetActivateHdl(Link());
SetDeactivateHdl(Link());
+ mbAreHandlersRegistered = false;
}
+
+ ToolBox::dispose();
}
void SidebarToolBox::InsertItem(const OUString& rCommand,
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index 7f63755b5b82..08cbe7f602a6 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -64,6 +64,19 @@ TabBar::TabBar (
TabBar::~TabBar()
{
+ disposeOnce();
+}
+
+void TabBar::dispose()
+{
+ for(ItemContainer::iterator
+ iItem(maItems.begin()), iEnd(maItems.end());
+ iItem!=iEnd;
+ ++iItem)
+ iItem->mpButton.disposeAndClear();
+ maItems.clear();
+ mpMenuButton.disposeAndClear();
+ vcl::Window::dispose();
}
void TabBar::Paint (const Rectangle& rUpdateArea)
@@ -94,7 +107,7 @@ void TabBar::SetDecks (
iItem!=iEnd;
++iItem)
{
- iItem->mpButton.reset();
+ iItem->mpButton.disposeAndClear();
}
maItems.clear();
}
@@ -115,7 +128,8 @@ void TabBar::SetDecks (
Item& rItem (maItems[nIndex++]);
rItem.msDeckId = pDescriptor->msId;
- rItem.mpButton.reset(CreateTabItem(*pDescriptor));
+ rItem.mpButton.disposeAndClear();
+ rItem.mpButton = CreateTabItem(*pDescriptor);
rItem.mpButton->SetClickHdl(LINK(&rItem, TabBar::Item, HandleClick));
rItem.maDeckActivationFunctor = maDeckActivationFunctor;
rItem.mbIsHiddenByDefault = false;
@@ -176,7 +190,7 @@ void TabBar::Layout()
Theme::GetInteger(Theme::Int_TabItemHeight) * GetDPIScaleFactor());
// Place the menu button and the separator.
- if (mpMenuButton != 0)
+ if (mpMenuButton != nullptr)
{
mpMenuButton->SetPosSizePixel(
Point(nX,nY),
@@ -245,12 +259,11 @@ bool TabBar::Notify (NotifyEvent&)
return false;
}
-RadioButton* TabBar::CreateTabItem (const DeckDescriptor& rDeckDescriptor)
+VclPtr<RadioButton> TabBar::CreateTabItem (const DeckDescriptor& rDeckDescriptor)
{
- RadioButton* pItem = ControlFactory::CreateTabItem(this);
+ VclPtr<RadioButton> pItem = ControlFactory::CreateTabItem(this);
pItem->SetHelpText(rDeckDescriptor.msHelpText);
pItem->SetQuickHelpText(rDeckDescriptor.msHelpText);
-
return pItem;
}
diff --git a/sfx2/source/sidebar/TabBar.hxx b/sfx2/source/sidebar/TabBar.hxx
index a0c14ab0d4ff..523abb7ba726 100644
--- a/sfx2/source/sidebar/TabBar.hxx
+++ b/sfx2/source/sidebar/TabBar.hxx
@@ -68,6 +68,7 @@ public:
const ::boost::function<void(const ::rtl::OUString&rsDeckId)>& rDeckActivationFunctor,
const PopupMenuProvider& rPopupMenuProvider);
virtual ~TabBar();
+ virtual void dispose() SAL_OVERRIDE;
virtual void Paint (const Rectangle& rUpdateArea) SAL_OVERRIDE;
virtual void DataChanged (const DataChangedEvent& rDataChangedEvent) SAL_OVERRIDE;
@@ -93,12 +94,12 @@ public:
private:
css::uno::Reference<css::frame::XFrame> mxFrame;
- ::boost::scoped_ptr<CheckBox> mpMenuButton;
+ VclPtr<CheckBox> mpMenuButton;
class Item
{
public:
DECL_LINK(HandleClick, Button*);
- ::boost::shared_ptr<RadioButton> mpButton;
+ VclPtr<RadioButton> mpButton;
::rtl::OUString msDeckId;
::boost::function<void(const ::rtl::OUString&rsDeckId)> maDeckActivationFunctor;
bool mbIsHidden;
@@ -110,7 +111,7 @@ private:
sal_Int32 mnMenuSeparatorY;
PopupMenuProvider maPopupMenuProvider;
- RadioButton* CreateTabItem (const DeckDescriptor& rDeckDescriptor);
+ VclPtr<RadioButton> CreateTabItem (const DeckDescriptor& rDeckDescriptor);
Image GetItemImage (const DeckDescriptor& rDeskDescriptor) const;
void Layout();
void UpdateButtonIcons();
diff --git a/sfx2/source/sidebar/TabItem.cxx b/sfx2/source/sidebar/TabItem.cxx
index 476803bae488..678e1f0e80a8 100644
--- a/sfx2/source/sidebar/TabItem.cxx
+++ b/sfx2/source/sidebar/TabItem.cxx
@@ -42,10 +42,6 @@ TabItem::TabItem (vcl::Window* pParentWindow)
#endif
}
-TabItem::~TabItem()
-{
-}
-
void TabItem::Paint (const Rectangle& rUpdateArea)
{
switch(mePaintType)
diff --git a/sfx2/source/sidebar/TabItem.hxx b/sfx2/source/sidebar/TabItem.hxx
index 33fa016aceb3..818a38bbc402 100644
--- a/sfx2/source/sidebar/TabItem.hxx
+++ b/sfx2/source/sidebar/TabItem.hxx
@@ -34,7 +34,6 @@ class TabItem
{
public:
TabItem (vcl::Window* pParentWindow);
- virtual ~TabItem();
virtual void Paint (const Rectangle& rUpdateArea) SAL_OVERRIDE;
virtual void MouseMove (const MouseEvent& rEvent) SAL_OVERRIDE;
diff --git a/sfx2/source/sidebar/TitleBar.cxx b/sfx2/source/sidebar/TitleBar.cxx
index ff5687336811..f2647b386d6b 100644
--- a/sfx2/source/sidebar/TitleBar.cxx
+++ b/sfx2/source/sidebar/TitleBar.cxx
@@ -41,17 +41,24 @@ TitleBar::TitleBar (
vcl::Window* pParentWindow,
const sidebar::Paint& rInitialBackgroundPaint)
: Window(pParentWindow),
- maToolBox(this),
+ maToolBox(VclPtr<SidebarToolBox>::Create(this)),
msTitle(rsTitle),
maIcon()
{
SetBackground(rInitialBackgroundPaint.GetWallpaper());
- maToolBox.SetSelectHdl(LINK(this, TitleBar, SelectionHandler));
+ maToolBox->SetSelectHdl(LINK(this, TitleBar, SelectionHandler));
}
TitleBar::~TitleBar()
{
+ disposeOnce();
+}
+
+void TitleBar::dispose()
+{
+ maToolBox.disposeAndClear();
+ vcl::Window::dispose();
}
void TitleBar::SetTitle (const ::rtl::OUString& rsTitle)
@@ -102,9 +109,9 @@ void TitleBar::setPosSizePixel (
Window::setPosSizePixel(nX,nY,nWidth,nHeight,nFlags);
// Place the toolbox.
- const sal_Int32 nToolBoxWidth (maToolBox.GetItemPosRect(0).GetWidth());
- maToolBox.setPosSizePixel(nWidth-nToolBoxWidth,0, nToolBoxWidth,nHeight, WINDOW_POSSIZE_POSSIZE);
- maToolBox.Show();
+ const sal_Int32 nToolBoxWidth (maToolBox->GetItemPosRect(0).GetWidth());
+ maToolBox->setPosSizePixel(nWidth-nToolBoxWidth,0, nToolBoxWidth,nHeight, WINDOW_POSSIZE_POSSIZE);
+ maToolBox->Show();
}
void TitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
@@ -181,8 +188,8 @@ void TitleBar::PaintFocus (const Rectangle& rFocusBox)
IMPL_LINK(TitleBar, SelectionHandler, ToolBox*, pToolBox)
{
(void)pToolBox;
- OSL_ASSERT(&maToolBox==pToolBox);
- const sal_uInt16 nItemId (maToolBox.GetHighlightItemId());
+ OSL_ASSERT(maToolBox.get()==pToolBox);
+ const sal_uInt16 nItemId (maToolBox->GetHighlightItemId());
HandleToolBoxItemClick(nItemId);
diff --git a/sfx2/source/sidebar/TitleBar.hxx b/sfx2/source/sidebar/TitleBar.hxx
index 735eca4e25a3..2bb36264202e 100644
--- a/sfx2/source/sidebar/TitleBar.hxx
+++ b/sfx2/source/sidebar/TitleBar.hxx
@@ -35,6 +35,7 @@ public:
vcl::Window* pParentWindow,
const sidebar::Paint& rInitialBackgroundPaint);
virtual ~TitleBar();
+ virtual void dispose() SAL_OVERRIDE;
void SetTitle (const ::rtl::OUString& rsTitle);
void SetIcon (const Image& rIcon);
@@ -48,11 +49,11 @@ public:
long nHeight,
sal_uInt16 nFlags = WINDOW_POSSIZE_ALL) SAL_OVERRIDE;
- ToolBox& GetToolBox() { return maToolBox;}
- const ToolBox& GetToolBox() const { return maToolBox;}
+ ToolBox& GetToolBox() { return *maToolBox.get();}
+ const ToolBox& GetToolBox() const { return *maToolBox.get();}
protected:
- SidebarToolBox maToolBox;
+ VclPtr<SidebarToolBox> maToolBox;
::rtl::OUString msTitle;
virtual Rectangle GetTitleArea (const Rectangle& rTitleBarBox) = 0;
diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx
index da1f7e269818..3ebd81948203 100644
--- a/sfx2/source/statbar/stbitem.cxx
+++ b/sfx2/source/statbar/stbitem.cxx
@@ -442,7 +442,7 @@ void SfxStatusBarControl::StateChanged
*/
{
- DBG_ASSERT( pBar != 0, "setting state to dangling StatusBar" );
+ DBG_ASSERT( pBar != nullptr, "setting state to dangling StatusBar" );
const SfxStringItem* pStr = PTR_CAST( SfxStringItem, pState );
if ( eState == SfxItemState::DEFAULT && pStr )
diff --git a/sfx2/source/toolbox/imgmgr.cxx b/sfx2/source/toolbox/imgmgr.cxx
index 46708f60a27a..c1842198d206 100644
--- a/sfx2/source/toolbox/imgmgr.cxx
+++ b/sfx2/source/toolbox/imgmgr.cxx
@@ -45,7 +45,7 @@ const sal_uInt32 IMAGELIST_COUNT = 4; // small, small-hi, large, large-hi
struct ToolBoxInf_Impl
{
- ToolBox* pToolBox;
+ VclPtr<ToolBox> pToolBox;
SfxToolboxFlags nFlags;
};
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx
index 0643e78aae18..956651c553d5 100644
--- a/sfx2/source/toolbox/tbxitem.cxx
+++ b/sfx2/source/toolbox/tbxitem.cxx
@@ -186,13 +186,13 @@ svt::ToolboxController* SAL_CALL SfxToolBoxControllerFactory( const Reference< X
struct SfxToolBoxControl_Impl
{
- ToolBox* pBox;
+ VclPtr<ToolBox> pBox;
bool bShowString;
SfxTbxCtrlFactory* pFact;
sal_uInt16 nTbxId;
sal_uInt16 nSlotId;
- SfxPopupWindow* mpFloatingWindow;
- SfxPopupWindow* mpPopupWindow;
+ VclPtr<SfxPopupWindow> mpFloatingWindow;
+ VclPtr<SfxPopupWindow> mpPopupWindow;
Reference< XUIElement > mxUIElement;
DECL_LINK( WindowEventListener, VclSimpleEvent* );
@@ -207,10 +207,9 @@ IMPL_LINK( SfxToolBoxControl_Impl, WindowEventListener, VclSimpleEvent*, pEvent
{
vcl::Window* pWindow( static_cast<VclWindowEvent*>(pEvent)->GetWindow() );
if (( pWindow == mpFloatingWindow ) &&
- ( mpPopupWindow != 0 ))
+ ( mpPopupWindow != nullptr ))
{
- delete mpPopupWindow;
- mpPopupWindow = 0;
+ mpPopupWindow.disposeAndClear();
}
}
@@ -275,9 +274,9 @@ void SAL_CALL SfxToolBoxControl::dispose() throw (::com::sun::star::uno::Runtime
// Remove and destroy our item window at our toolbox
SolarMutexGuard aGuard;
- vcl::Window* pWindow = pImpl->pBox->GetItemWindow( pImpl->nTbxId );
+ VclPtr< vcl::Window > pWindow = pImpl->pBox->GetItemWindow( pImpl->nTbxId );
pImpl->pBox->SetItemWindow( pImpl->nTbxId, 0 );
- delete pWindow;
+ pWindow.disposeAndClear();
// Dispose an open sub toolbar. It's possible that we have an open
// sub toolbar while we get disposed. Therefore we have to dispose
@@ -292,11 +291,8 @@ void SAL_CALL SfxToolBoxControl::dispose() throw (::com::sun::star::uno::Runtime
pImpl->mxUIElement = 0;
// Delete my popup windows
- delete pImpl->mpFloatingWindow;
- delete pImpl->mpPopupWindow;
-
- pImpl->mpFloatingWindow = 0;
- pImpl->mpPopupWindow = 0;
+ pImpl->mpFloatingWindow.disposeAndClear();
+ pImpl->mpPopupWindow.disposeAndClear();
}
@@ -866,9 +862,9 @@ IMPL_LINK_NOARG(SfxToolBoxControl, PopupModeEndHdl)
{
// Replace floating window with popup window and destroy
// floating window instance.
- delete pImpl->mpFloatingWindow;
+ pImpl->mpFloatingWindow.disposeAndClear();
pImpl->mpFloatingWindow = pImpl->mpPopupWindow;
- pImpl->mpPopupWindow = 0;
+ pImpl->mpPopupWindow.clear();
// We also need to know when the user tries to use the
// floating window.
pImpl->mpFloatingWindow->AddEventListener( LINK( pImpl, SfxToolBoxControl_Impl, WindowEventListener ));
@@ -877,7 +873,7 @@ IMPL_LINK_NOARG(SfxToolBoxControl, PopupModeEndHdl)
{
// Popup window has been closed by the user. No replacement, instance
// will destroy itself.
- pImpl->mpPopupWindow = 0;
+ pImpl->mpPopupWindow.clear();
}
return 1;
@@ -903,7 +899,7 @@ void SfxToolBoxControl::StateChanged
const SfxPoolItem* pState
)
{
- DBG_ASSERT( pImpl->pBox != 0, "setting state to dangling ToolBox" );
+ DBG_ASSERT( pImpl->pBox != nullptr, "setting state to dangling ToolBox" );
if ( GetId() >= SID_OBJECTMENU0 && GetId() <= SID_OBJECTMENU_LAST )
return;
@@ -981,7 +977,7 @@ SfxPopupWindowType SfxToolBoxControl::GetPopupWindowType() const
-SfxPopupWindow* SfxToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SfxToolBoxControl::CreatePopupWindow()
{
return 0;
}
@@ -993,9 +989,9 @@ SfxPopupWindow* SfxToolBoxControl::CreatePopupWindowCascading()
-vcl::Window* SfxToolBoxControl::CreateItemWindow( vcl::Window * )
+VclPtr<vcl::Window> SfxToolBoxControl::CreateItemWindow( vcl::Window * )
{
- return 0;
+ return VclPtr<vcl::Window>();
}
@@ -1204,6 +1200,11 @@ SfxPopupWindow::SfxPopupWindow(
SfxPopupWindow::~SfxPopupWindow()
{
+ disposeOnce();
+}
+
+void SfxPopupWindow::dispose()
+{
if ( m_xStatusListener.is() )
{
m_xStatusListener->dispose();
@@ -1213,6 +1214,7 @@ SfxPopupWindow::~SfxPopupWindow()
vcl::Window* pWindow = GetTopMostParentSystemWindow( this );
if ( pWindow )
static_cast<SystemWindow *>(pWindow)->GetTaskPaneList()->RemoveWindow( this );
+ FloatingWindow::dispose();
}
@@ -1333,7 +1335,7 @@ void SfxPopupWindow::StartCascading()
-SfxPopupWindow* SfxPopupWindow::Clone() const
+VclPtr<SfxPopupWindow> SfxPopupWindow::Clone() const
/* [Description]
@@ -1382,7 +1384,7 @@ void SfxPopupWindow::Delete()
{
if ( m_aDeleteLink.IsSet() )
m_aDeleteLink.Call( this );
- delete this;
+ disposeOnce();
}
@@ -1397,7 +1399,7 @@ SfxRecentFilesToolBoxControl::~SfxRecentFilesToolBoxControl()
{
}
-SfxPopupWindow* SfxRecentFilesToolBoxControl::CreatePopupWindow()
+VclPtr<SfxPopupWindow> SfxRecentFilesToolBoxControl::CreatePopupWindow()
{
ToolBox& rBox = GetToolBox();
sal_uInt16 nItemId = GetId();
diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx
index 82c03818579b..c830ff577a17 100644
--- a/sfx2/source/view/frame.cxx
+++ b/sfx2/source/view/frame.cxx
@@ -93,7 +93,7 @@ void SfxFrame::Construct_Impl()
SfxFrame::~SfxFrame()
{
RemoveTopFrame_Impl( this );
- DELETEZ( pWindow );
+ pWindow.disposeAndClear();
SfxFrameArr_Impl::iterator it = std::find( pFramesArr_Impl->begin(), pFramesArr_Impl->end(), this );
if ( it != pFramesArr_Impl->end() )
diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx
index 037d7ea525ae..390a9c52d241 100644
--- a/sfx2/source/view/frame2.cxx
+++ b/sfx2/source/view/frame2.cxx
@@ -69,7 +69,6 @@ public:
SfxFrame* pFrame;
SfxFrameWindow_Impl( SfxFrame* pF, vcl::Window& i_rContainerWindow );
- virtual ~SfxFrameWindow_Impl( );
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
@@ -86,10 +85,6 @@ SfxFrameWindow_Impl::SfxFrameWindow_Impl( SfxFrame* pF, vcl::Window& i_rContaine
{
}
-SfxFrameWindow_Impl::~SfxFrameWindow_Impl( )
-{
-}
-
void SfxFrameWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
{
Window::DataChanged( rDCEvt );
@@ -309,7 +304,7 @@ SfxFrame::SfxFrame( vcl::Window& i_rContainerWindow, bool i_bHidden )
InsertTopFrame_Impl( this );
pImp->pExternalContainerWindow = &i_rContainerWindow;
- pWindow = new SfxFrameWindow_Impl( this, i_rContainerWindow );
+ pWindow = VclPtr<SfxFrameWindow_Impl>::Create( this, i_rContainerWindow );
// always show pWindow, which is the ComponentWindow of the XFrame we live in
// nowadays, since SfxFrames can be created with an XFrame only, hiding or showing the complete XFrame
@@ -350,7 +345,7 @@ SystemWindow* SfxFrame::GetSystemWindow() const
SystemWindow* SfxFrame::GetTopWindow_Impl() const
{
if ( pImp->pExternalContainerWindow->IsSystemWindow() )
- return static_cast<SystemWindow*>( pImp->pExternalContainerWindow );
+ return static_cast<SystemWindow*>( pImp->pExternalContainerWindow.get() );
else
return NULL;
}
diff --git a/sfx2/source/view/impframe.hxx b/sfx2/source/view/impframe.hxx
index 5f1aaae8e4fc..271ef70c1d45 100644
--- a/sfx2/source/view/impframe.hxx
+++ b/sfx2/source/view/impframe.hxx
@@ -41,17 +41,17 @@ public:
SfxViewFrame* pCurrentViewFrame;
SfxFrameDescriptor* pDescr;
sal_uInt16 nLocks;
- bool bClosing : 1;
- bool bPrepClosing : 1;
- bool bInCancelTransfers : 1;
- bool bOwnsBindings : 1;
- bool bReleasingComponent : 1;
- bool bInPlace : 1;
+ bool bClosing : 1;
+ bool bPrepClosing : 1;
+ bool bInCancelTransfers : 1;
+ bool bOwnsBindings : 1;
+ bool bReleasingComponent : 1;
+ bool bInPlace : 1;
SfxFrame* pFrame;
SfxWorkWindow* pWorkWin;
SvBorder aBorder;
// formerly SfxTopFrame
- vcl::Window* pExternalContainerWindow;
+ VclPtr<vcl::Window> pExternalContainerWindow;
bool bHidden;
bool bLockResize;
bool bMenuBarOn;
diff --git a/sfx2/source/view/impviewframe.hxx b/sfx2/source/view/impviewframe.hxx
index 129d03c5e8ce..0f8bfdc47f85 100644
--- a/sfx2/source/view/impviewframe.hxx
+++ b/sfx2/source/view/impviewframe.hxx
@@ -35,9 +35,9 @@ struct SfxViewFrame_Impl
OUString aActualURL;
SfxFrame& rFrame;
svtools::AsynchronLink* pReloader;
- vcl::Window* pWindow;
+ VclPtr<vcl::Window> pWindow;
SfxViewFrame* pActiveChild;
- vcl::Window* pFocusWin;
+ VclPtr<vcl::Window> pFocusWin;
sal_uInt16 nDocViewNo;
sal_uInt16 nCurViewId;
bool bResizeInToOut:1;
diff --git a/sfx2/source/view/printer.cxx b/sfx2/source/view/printer.cxx
index e5de62ccd922..ee07c7850f21 100644
--- a/sfx2/source/view/printer.cxx
+++ b/sfx2/source/view/printer.cxx
@@ -60,7 +60,7 @@ struct SfxPrintOptDlg_Impl
// class SfxPrinter ------------------------------------------------------
-SfxPrinter* SfxPrinter::Create( SvStream& rStream, SfxItemSet* pOptions )
+VclPtr<SfxPrinter> SfxPrinter::Create( SvStream& rStream, SfxItemSet* pOptions )
/* [Description]
@@ -79,7 +79,7 @@ SfxPrinter* SfxPrinter::Create( SvStream& rStream, SfxItemSet* pOptions )
ReadJobSetup( rStream, aFileJobSetup );
// Get printers
- SfxPrinter *pPrinter = new SfxPrinter( pOptions, aFileJobSetup );
+ VclPtr<SfxPrinter> pPrinter = VclPtr<SfxPrinter>::Create( pOptions, aFileJobSetup );
return pPrinter;
}
@@ -166,12 +166,11 @@ SfxPrinter::SfxPrinter( const SfxPrinter& rPrinter ) :
-SfxPrinter* SfxPrinter::Clone() const
+VclPtr<SfxPrinter> SfxPrinter::Clone() const
{
if ( IsDefPrinter() )
{
- SfxPrinter *pNewPrinter;
- pNewPrinter = new SfxPrinter( GetOptions().Clone() );
+ VclPtr<SfxPrinter> pNewPrinter = VclPtr<SfxPrinter>::Create( GetOptions().Clone() );
pNewPrinter->SetJobSetup( GetJobSetup() );
pNewPrinter->SetPrinterProps( this );
pNewPrinter->SetMapMode( GetMapMode() );
@@ -182,15 +181,21 @@ SfxPrinter* SfxPrinter::Clone() const
return pNewPrinter;
}
else
- return new SfxPrinter( *this );
+ return VclPtr<SfxPrinter>::Create( *this );
}
SfxPrinter::~SfxPrinter()
{
+ disposeOnce();
+}
+
+void SfxPrinter::dispose()
+{
delete pOptions;
delete pImpl;
+ Printer::dispose();
}
@@ -215,7 +220,7 @@ SfxPrintOptionsDialog::SfxPrintOptionsDialog(vcl::Window *pParent,
VclContainer *pVBox = get_content_area();
// Insert TabPage
- pPage = pViewSh->CreatePrintOptionsPage(pVBox, *pOptions);
+ pPage.reset(pViewSh->CreatePrintOptionsPage(pVBox, *pOptions));
DBG_ASSERT( pPage, "CreatePrintOptions != SFX_VIEW_HAS_PRINTOPTIONS" );
if( pPage )
{
@@ -229,9 +234,15 @@ SfxPrintOptionsDialog::SfxPrintOptionsDialog(vcl::Window *pParent,
SfxPrintOptionsDialog::~SfxPrintOptionsDialog()
{
+ disposeOnce();
+}
+
+void SfxPrintOptionsDialog::dispose()
+{
delete pDlgImpl;
- delete pPage;
+ pPage.disposeAndClear();
delete pOptions;
+ ModalDialog::dispose();
}
diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx
index e56ac06d7abd..22d283b9553c 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -1451,7 +1451,7 @@ void SfxBaseController::ShowInfoBars( )
SfxInfoBarWindow* pInfoBar = pViewFrame->AppendInfoBar( "checkout", SfxResId( STR_NONCHECKEDOUT_DOCUMENT ) );
if (pInfoBar)
{
- PushButton* pBtn = new PushButton( &pViewFrame->GetWindow(), SfxResId( BT_CHECKOUT ) );
+ VclPtrInstance<PushButton> pBtn( &pViewFrame->GetWindow(), SfxResId( BT_CHECKOUT ) );
pBtn->SetClickHdl( LINK( this, SfxBaseController, CheckOutHandler ) );
pInfoBar->addButton(pBtn);
}
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 8bccea79f647..cfae5c1232e2 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -495,9 +495,9 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
if ( nOpenMode == SFX_STREAM_READWRITE && !rReq.IsAPI() )
{
// ::com::sun::star::sdbcx::User offering to open it as a template
- MessageDialog aBox(&GetWindow(), SfxResId(STR_QUERY_OPENASTEMPLATE),
+ ScopedVclPtrInstance<MessageDialog> aBox(&GetWindow(), SfxResId(STR_QUERY_OPENASTEMPLATE),
VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if ( RET_YES == aBox.Execute() )
+ if ( RET_YES == aBox->Execute() )
{
SfxApplication* pApp = SfxGetpApp();
SfxAllItemSet aSet( pApp->GetPool() );
@@ -579,9 +579,9 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
if ( bDo && GetFrame().DocIsModified_Impl() &&
!rReq.IsAPI() && ( !pSilentItem || !pSilentItem->GetValue() ) )
{
- MessageDialog aBox(&GetWindow(), SfxResId(STR_QUERY_LASTVERSION),
+ ScopedVclPtrInstance<MessageDialog> aBox(&GetWindow(), SfxResId(STR_QUERY_LASTVERSION),
VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- bDo = ( RET_YES == aBox.Execute() );
+ bDo = ( RET_YES == aBox->Execute() );
}
if ( bDo )
@@ -756,9 +756,9 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
if ( bForEdit && SID_EDITDOC == rReq.GetSlot() )
{
// ask user for opening as template
- MessageDialog aBox(&GetWindow(), SfxResId(STR_QUERY_OPENASTEMPLATE),
+ ScopedVclPtrInstance<MessageDialog> aBox(&GetWindow(), SfxResId(STR_QUERY_OPENASTEMPLATE),
VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO);
- if ( RET_YES == aBox.Execute() )
+ if ( RET_YES == aBox->Execute() )
{
SfxAllItemSet aSet( pApp->GetPool() );
aSet.Put( SfxStringItem( SID_FILE_NAME, pMedium->GetName() ) );
@@ -1369,7 +1369,7 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
SfxInfoBarWindow* pInfoBar = AppendInfoBar("readonly", SfxResId(STR_READONLY_DOCUMENT));
if (pInfoBar)
{
- PushButton* pBtn = new PushButton( &GetWindow(), SfxResId(BT_READONLY_EDIT));
+ VclPtrInstance<PushButton> pBtn( &GetWindow(), SfxResId(BT_READONLY_EDIT));
pBtn->SetClickHdl(LINK(this, SfxViewFrame, SwitchReadOnlyHandler));
pInfoBar->addButton(pBtn);
}
@@ -1468,7 +1468,7 @@ SfxViewFrame::SfxViewFrame
rFrame.SetFrameType_Impl( GetFrameType() | SFXFRAME_HASTITLE );
Construct_Impl( pObjShell );
- pImp->pWindow = new SfxFrameViewWindow_Impl( this, rFrame.GetWindow() );
+ pImp->pWindow = VclPtr<SfxFrameViewWindow_Impl>::Create( this, rFrame.GetWindow() );
pImp->pWindow->SetSizePixel( rFrame.GetWindow().GetOutputSizePixel() );
rFrame.SetOwnsBindings_Impl( true );
rFrame.CreateWorkWindow_Impl();
@@ -1477,7 +1477,6 @@ SfxViewFrame::SfxViewFrame
SfxViewFrame::~SfxViewFrame()
{
-
SetDowning_Impl();
if ( SfxViewFrame::Current() == this )
@@ -1489,7 +1488,8 @@ SfxViewFrame::~SfxViewFrame()
// The Bindings delete the Frame!
KillDispatcher_Impl();
- delete pImp->pWindow;
+ pImp->pWindow.disposeAndClear();
+ pImp->pFocusWin.clear();
if ( GetFrame().GetCurrentViewFrame() == this )
GetFrame().SetCurrentViewFrame_Impl( NULL );
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 5d46afde66f3..d478a4a847d2 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -59,7 +59,7 @@ class SfxPrinterController : public vcl::PrinterController, public SfxListener
Any maCompleteSelection;
Any maSelection;
Reference< view::XRenderable > mxRenderable;
- mutable Printer* mpLastPrinter;
+ mutable VclPtr<Printer> mpLastPrinter;
mutable Reference<awt::XDevice> mxDevice;
SfxViewShell* mpViewShell;
SfxObjectShell* mpObjectShell;
@@ -74,7 +74,7 @@ class SfxPrinterController : public vcl::PrinterController, public SfxListener
const Any& getSelectionObject() const;
public:
- SfxPrinterController( const std::shared_ptr<Printer>& i_rPrinter,
+ SfxPrinterController( const VclPtr<Printer>& i_rPrinter,
const Any& i_rComplete,
const Any& i_rSelection,
const Any& i_rViewProp,
@@ -94,7 +94,7 @@ public:
virtual void jobFinished( com::sun::star::view::PrintableState ) SAL_OVERRIDE;
};
-SfxPrinterController::SfxPrinterController( const std::shared_ptr<Printer>& i_rPrinter,
+SfxPrinterController::SfxPrinterController( const VclPtr<Printer>& i_rPrinter,
const Any& i_rComplete,
const Any& i_rSelection,
const Any& i_rViewProp,
@@ -204,8 +204,8 @@ const Any& SfxPrinterController::getSelectionObject() const
Sequence< beans::PropertyValue > SfxPrinterController::getMergedOptions() const
{
- std::shared_ptr<Printer> xPrinter(getPrinter());
- if (xPrinter.get() != mpLastPrinter)
+ VclPtr<Printer> xPrinter( getPrinter() );
+ if( xPrinter.get() != mpLastPrinter )
{
mpLastPrinter = xPrinter.get();
VCLXDevice* pXDevice = new VCLXDevice();
@@ -224,8 +224,8 @@ Sequence< beans::PropertyValue > SfxPrinterController::getMergedOptions() const
int SfxPrinterController::getPageCount() const
{
int nPages = 0;
- std::shared_ptr<Printer> xPrinter(getPrinter());
- if (mxRenderable.is() && xPrinter)
+ VclPtr<Printer> xPrinter( getPrinter() );
+ if( mxRenderable.is() && xPrinter )
{
Sequence< beans::PropertyValue > aJobOptions( getMergedOptions() );
try
@@ -244,7 +244,7 @@ int SfxPrinterController::getPageCount() const
Sequence< beans::PropertyValue > SfxPrinterController::getPageParameters( int i_nPage ) const
{
- std::shared_ptr<Printer> xPrinter(getPrinter());
+ VclPtr<Printer> xPrinter( getPrinter() );
Sequence< beans::PropertyValue > aResult;
if (mxRenderable.is() && xPrinter)
@@ -269,8 +269,8 @@ Sequence< beans::PropertyValue > SfxPrinterController::getPageParameters( int i_
void SfxPrinterController::printPage( int i_nPage ) const
{
- std::shared_ptr<Printer> xPrinter(getPrinter());
- if (mxRenderable.is() && xPrinter)
+ VclPtr<Printer> xPrinter( getPrinter() );
+ if( mxRenderable.is() && xPrinter )
{
Sequence< beans::PropertyValue > aJobOptions( getMergedOptions() );
try
@@ -384,7 +384,7 @@ void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nSt
pDocPrt->SetJobSetup( getPrinter()->GetJobSetup() );
else
{
- SfxPrinter* pNewPrt = new SfxPrinter( pDocPrt->GetOptions().Clone(), getPrinter()->GetName() );
+ VclPtr<SfxPrinter> pNewPrt = VclPtr<SfxPrinter>::Create( pDocPrt->GetOptions().Clone(), getPrinter()->GetName() );
pNewPrt->SetJobSetup( getPrinter()->GetJobSetup() );
mpViewShell->SetPrinter( pNewPrt, SfxPrinterChangeFlags::PRINTER | SfxPrinterChangeFlags::JOBSETUP );
}
@@ -411,9 +411,9 @@ class SfxDialogExecutor_Impl
{
private:
SfxViewShell* _pViewSh;
- PrinterSetupDialog* _pSetupParent;
+ VclPtr<PrinterSetupDialog> _pSetupParent;
SfxItemSet* _pOptions;
- bool _bHelpDisabled;
+ bool _bHelpDisabled;
DECL_LINK( Execute, void * );
@@ -451,8 +451,8 @@ IMPL_LINK_NOARG(SfxDialogExecutor_Impl, Execute)
return 0;
// Create Dialog
- boost::scoped_ptr<SfxPrintOptionsDialog> pDlg(new SfxPrintOptionsDialog( static_cast<vcl::Window*>(_pSetupParent),
- _pViewSh, _pOptions ));
+ VclPtrInstance<SfxPrintOptionsDialog> pDlg( static_cast<vcl::Window*>(_pSetupParent),
+ _pViewSh, _pOptions );
if ( _bHelpDisabled )
pDlg->DisableHelp();
if ( pDlg->Execute() == RET_OK )
@@ -469,7 +469,7 @@ IMPL_LINK_NOARG(SfxDialogExecutor_Impl, Execute)
Internal method for setting the differences between 'pNewPrinter' to the
current printer. pNewPrinter is either taken over or deleted.
*/
-SfxPrinter* SfxViewShell::SetPrinter_Impl( SfxPrinter *pNewPrinter )
+SfxPrinter* SfxViewShell::SetPrinter_Impl( VclPtr<SfxPrinter>& pNewPrinter )
{
// get current Printer
SfxPrinter *pDocPrinter = GetPrinter();
@@ -558,7 +558,7 @@ SfxPrinter* SfxViewShell::SetPrinter_Impl( SfxPrinter *pNewPrinter )
// Keep old changed Printer.
pDocPrinter->SetPrinterProps( pNewPrinter );
- delete pNewPrinter;
+ pNewPrinter.disposeAndClear();
}
if ( SfxPrinterChangeFlags::NONE != nChangedFlags )
@@ -582,7 +582,7 @@ void SfxViewShell::StartPrint( const uno::Sequence < beans::PropertyValue >& rPr
aSelection <<= GetObjectShell()->GetModel();
Any aComplete( makeAny( GetObjectShell()->GetModel() ) );
Any aViewProp( makeAny( xController ) );
- std::shared_ptr<Printer> aPrt;
+ VclPtr<Printer> aPrt;
const beans::PropertyValue* pVal = rProps.getConstArray();
for( sal_Int32 i = 0; i < rProps.getLength(); i++ )
@@ -591,7 +591,7 @@ void SfxViewShell::StartPrint( const uno::Sequence < beans::PropertyValue >& rPr
{
OUString aPrinterName;
pVal[i].Value >>= aPrinterName;
- aPrt.reset( new Printer( aPrinterName ) );
+ aPrt.reset( VclPtr<Printer>::Create( aPrinterName ) );
break;
}
}
@@ -637,7 +637,7 @@ Printer* SfxViewShell::GetActivePrinter() const
void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
{
sal_uInt16 nDialogRet = RET_CANCEL;
- SfxPrinter* pPrinter = 0;
+ VclPtr<SfxPrinter> pPrinter;
bool bSilent = false;
// does the function have been called by the user interface or by an API call
@@ -770,11 +770,11 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
if ( pPrinterItem )
{
// use PrinterName parameter to create a printer
- pPrinter = new SfxPrinter( pDocPrinter->GetOptions().Clone(), ((const SfxStringItem*) pPrinterItem)->GetValue() );
+ pPrinter = VclPtr<SfxPrinter>::Create( pDocPrinter->GetOptions().Clone(), ((const SfxStringItem*) pPrinterItem)->GetValue() );
// if printer is unknown, it can't be used - now printer from document will be used
if ( !pPrinter->IsKnown() )
- DELETEZ(pPrinter);
+ pPrinter.disposeAndClear();
}
if ( SID_PRINTER_NAME == nId )
@@ -816,11 +816,11 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
if ( !bIsAPI )
{
// PrinterDialog needs a temporary printer
- SfxPrinter* pDlgPrinter = pPrinter->Clone();
+ VclPtr<SfxPrinter> pDlgPrinter = pPrinter->Clone();
nDialogRet = 0;
// execute PrinterSetupDialog
- PrinterSetupDialog* pPrintSetupDlg = new PrinterSetupDialog( GetWindow() );
+ VclPtrInstance<PrinterSetupDialog> pPrintSetupDlg( GetWindow() );
SfxDialogExecutor_Impl* pExecutor = 0;
if (pImp->m_bHasPrintOptions && HasPrintOptionsPage())
@@ -847,7 +847,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
}
}
- DELETEZ( pPrintSetupDlg );
+ pPrintSetupDlg.disposeAndClear();
delete pExecutor;
// no recording of PrinterSetup except printer name (is printer dependent)
@@ -868,13 +868,12 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
// forget new printer, it was taken over (as pPrinter) or deleted
pDlgPrinter = NULL;
-
}
else
{
// PrinterDialog is used to transfer information on printing,
// so it will only be deleted here if dialog was cancelled
- DELETEZ( pDlgPrinter );
+ pDlgPrinter.disposeAndClear();
rReq.Ignore();
}
}
@@ -892,13 +891,13 @@ sal_uInt16 SfxViewShell::SetPrinter( SfxPrinter* /*pNewPrinter*/, SfxPrinterChan
return 0;
}
-SfxTabPage* SfxViewShell::CreatePrintOptionsPage
+VclPtr<SfxTabPage> SfxViewShell::CreatePrintOptionsPage
(
vcl::Window* /*pParent*/,
const SfxItemSet& /*rOptions*/
)
{
- return 0;
+ return VclPtr<SfxTabPage>();
}
bool SfxViewShell::HasPrintOptionsPage() const
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 111b09c60619..5cda42ef38dc 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -594,8 +594,8 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
if ( eResult == SfxMailModel::SEND_MAIL_ERROR )
{
- MessageDialog aBox( SfxGetpApp()->GetTopWindow(), SfxResId( STR_ERROR_SEND_MAIL ), VCL_MESSAGE_INFO);
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(SfxGetpApp()->GetTopWindow(), SfxResId( STR_ERROR_SEND_MAIL ), VCL_MESSAGE_INFO);
+ aBox->Execute();
rReq.Ignore();
}
else
@@ -614,8 +614,8 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
SfxMailModel::SendMailResult eResult = aModel.SaveAndSend( xFrame, OUString() );
if( eResult == SfxMailModel::SEND_MAIL_ERROR )
{
- MessageDialog aBox( SfxGetpApp()->GetTopWindow(), SfxResId( STR_ERROR_SEND_MAIL ), VCL_MESSAGE_INFO);
- aBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aBox(SfxGetpApp()->GetTopWindow(), SfxResId( STR_ERROR_SEND_MAIL ), VCL_MESSAGE_INFO);
+ aBox->Execute();
rReq.Ignore();
}
else
@@ -1310,8 +1310,8 @@ bool SfxViewShell::PrepareClose
{
if ( bUI )
{
- MessageDialog aInfoBox( &GetViewFrame()->GetWindow(), SfxResId( STR_CANT_CLOSE ), VCL_MESSAGE_INFO );
- aInfoBox.Execute();
+ ScopedVclPtrInstance< MessageDialog > aInfoBox(&GetViewFrame()->GetWindow(), SfxResId( STR_CANT_CLOSE ), VCL_MESSAGE_INFO );
+ aInfoBox->Execute();
}
return false;