[Libreoffice-commits] core.git: Branch 'feature/vclref' - 2 commits - compilerplugins/clang cui/source svtools/source vcl/inc vcl/source vcl/unx

Noel Grandin noel at peralex.com
Thu Jan 15 05:50:07 PST 2015


 compilerplugins/clang/vclwidgets.cxx     |   76 +++++++++++++++++++++++-
 cui/source/customize/acccfg.cxx          |    6 +
 cui/source/customize/cfg.cxx             |   33 +++++++---
 cui/source/customize/cfgutil.cxx         |   12 +++
 cui/source/customize/eventdlg.cxx        |    6 +
 cui/source/customize/eventdlg.hxx        |    1 
 cui/source/customize/macropg.cxx         |   74 +++++++++++++----------
 cui/source/customize/macropg_impl.hxx    |    1 
 cui/source/customize/selector.cxx        |   16 +++--
 cui/source/dialogs/SpellDialog.cxx       |    9 +-
 cui/source/dialogs/colorpicker.cxx       |   14 ++++
 cui/source/dialogs/cuicharmap.cxx        |   12 ---
 cui/source/dialogs/cuifmsearch.cxx       |    6 +
 cui/source/dialogs/cuigaldlg.cxx         |    6 +
 cui/source/dialogs/cuihyperdlg.cxx       |    6 +
 cui/source/dialogs/dlgname.cxx           |    6 +
 cui/source/dialogs/hangulhanjadlg.cxx    |   97 ++++++++++++++++++-------------
 cui/source/dialogs/hldocntp.cxx          |    6 +
 cui/source/dialogs/hldoctp.cxx           |    4 -
 cui/source/dialogs/hlinettp.cxx          |    4 -
 cui/source/dialogs/hlmailtp.cxx          |    4 -
 cui/source/dialogs/hlmarkwn.cxx          |    6 +
 cui/source/dialogs/hltpbase.cxx          |    8 ++
 cui/source/dialogs/hyphen.cxx            |    5 -
 cui/source/dialogs/iconcdlg.cxx          |   10 +--
 cui/source/dialogs/insdlg.cxx            |    6 +
 cui/source/dialogs/linkdlg.cxx           |    4 -
 cui/source/dialogs/multipat.cxx          |   12 +++
 cui/source/dialogs/passwdomdlg.cxx       |    6 +
 cui/source/dialogs/pastedlg.cxx          |    4 -
 cui/source/dialogs/postdlg.cxx           |    6 +
 cui/source/dialogs/scriptdlg.cxx         |   12 +++
 cui/source/dialogs/splitcelldlg.cxx      |    4 -
 cui/source/dialogs/srchxtra.cxx          |    6 +
 cui/source/dialogs/thesdlg.cxx           |   18 +----
 cui/source/dialogs/zoom.cxx              |    6 +
 cui/source/inc/SpellDialog.hxx           |    2 
 cui/source/inc/acccfg.hxx                |    1 
 cui/source/inc/align.hxx                 |    1 
 cui/source/inc/autocdlg.hxx              |   10 +--
 cui/source/inc/backgrnd.hxx              |    1 
 cui/source/inc/border.hxx                |    1 
 cui/source/inc/cfg.hxx                   |    7 +-
 cui/source/inc/cfgutil.hxx               |    2 
 cui/source/inc/chardlg.hxx               |    6 -
 cui/source/inc/connect.hxx               |    2 
 cui/source/inc/cuicharmap.hxx            |    2 
 cui/source/inc/cuifmsearch.hxx           |    1 
 cui/source/inc/cuigaldlg.hxx             |    4 -
 cui/source/inc/cuihyperdlg.hxx           |    1 
 cui/source/inc/cuioptgenrl.hxx           |    1 
 cui/source/inc/cuitabarea.hxx            |    3 
 cui/source/inc/cuitabline.hxx            |    3 
 cui/source/inc/dbregister.hxx            |    2 
 cui/source/inc/dlgname.hxx               |    1 
 cui/source/inc/grfpage.hxx               |    1 
 cui/source/inc/hangulhanjadlg.hxx        |   10 +--
 cui/source/inc/headertablistbox.hxx      |   10 +--
 cui/source/inc/hldocntp.hxx              |    1 
 cui/source/inc/hldoctp.hxx               |    1 
 cui/source/inc/hlinettp.hxx              |    1 
 cui/source/inc/hlmailtp.hxx              |    1 
 cui/source/inc/hlmarkwn.hxx              |    1 
 cui/source/inc/hltpbase.hxx              |    1 
 cui/source/inc/hyphen.hxx                |    1 
 cui/source/inc/iconcdlg.hxx              |    2 
 cui/source/inc/insdlg.hxx                |    1 
 cui/source/inc/linkdlg.hxx               |    1 
 cui/source/inc/macroass.hxx              |    1 
 cui/source/inc/macropg.hxx               |    1 
 cui/source/inc/measure.hxx               |    1 
 cui/source/inc/multipat.hxx              |    2 
 cui/source/inc/numfmt.hxx                |    1 
 cui/source/inc/numpages.hxx              |   32 ++++++----
 cui/source/inc/optasian.hxx              |    1 
 cui/source/inc/optdict.hxx               |    1 
 cui/source/inc/optlingu.hxx              |    2 
 cui/source/inc/optpath.hxx               |    1 
 cui/source/inc/page.hxx                  |    1 
 cui/source/inc/paragrph.hxx              |    8 --
 cui/source/inc/passwdomdlg.hxx           |    1 
 cui/source/inc/pastedlg.hxx              |    1 
 cui/source/inc/postdlg.hxx               |    1 
 cui/source/inc/radiobtnbox.hxx           |    1 
 cui/source/inc/scriptdlg.hxx             |    2 
 cui/source/inc/selector.hxx              |    4 -
 cui/source/inc/splitcelldlg.hxx          |    1 
 cui/source/inc/srchxtra.hxx              |    1 
 cui/source/inc/swpossizetabpage.hxx      |    1 
 cui/source/inc/tabstpge.hxx              |    2 
 cui/source/inc/textanim.hxx              |    2 
 cui/source/inc/textattr.hxx              |    1 
 cui/source/inc/thesdlg.hxx               |    5 -
 cui/source/inc/transfrm.hxx              |    1 
 cui/source/inc/treeopt.hxx               |    2 
 cui/source/inc/zoom.hxx                  |    1 
 cui/source/options/certpath.cxx          |    6 +
 cui/source/options/certpath.hxx          |    1 
 cui/source/options/dbregister.cxx        |   10 +--
 cui/source/options/fontsubs.cxx          |    6 +
 cui/source/options/fontsubs.hxx          |    1 
 cui/source/options/optaccessibility.cxx  |    6 +
 cui/source/options/optaccessibility.hxx  |    1 
 cui/source/options/optasian.cxx          |    6 +
 cui/source/options/optbasic.cxx          |    4 -
 cui/source/options/optbasic.hxx          |    1 
 cui/source/options/optchart.cxx          |    6 +
 cui/source/options/optchart.hxx          |    1 
 cui/source/options/optcolor.cxx          |   17 ++++-
 cui/source/options/optcolor.hxx          |    1 
 cui/source/options/optctl.cxx            |    4 -
 cui/source/options/optctl.hxx            |    3 
 cui/source/options/optdict.cxx           |    5 -
 cui/source/options/optfltr.cxx           |   10 +--
 cui/source/options/optfltr.hxx           |    2 
 cui/source/options/optgdlg.cxx           |   16 +++--
 cui/source/options/optgdlg.hxx           |    3 
 cui/source/options/optgenrl.cxx          |    5 -
 cui/source/options/opthtml.cxx           |    4 -
 cui/source/options/opthtml.hxx           |    1 
 cui/source/options/optinet2.cxx          |   16 +++--
 cui/source/options/optinet2.hxx          |    3 
 cui/source/options/optjava.cxx           |   18 +++--
 cui/source/options/optjava.hxx           |    3 
 cui/source/options/optjsearch.cxx        |    5 -
 cui/source/options/optjsearch.hxx        |    2 
 cui/source/options/optlingu.cxx          |   12 +++
 cui/source/options/optmemory.cxx         |    6 -
 cui/source/options/optmemory.hxx         |    1 
 cui/source/options/optopencl.cxx         |    4 -
 cui/source/options/optopencl.hxx         |    1 
 cui/source/options/optpath.cxx           |    6 +
 cui/source/options/optsave.cxx           |    6 +
 cui/source/options/optsave.hxx           |    1 
 cui/source/options/optupdt.cxx           |    5 -
 cui/source/options/optupdt.hxx           |    1 
 cui/source/options/personalization.cxx   |    4 -
 cui/source/options/personalization.hxx   |    1 
 cui/source/options/radiobtnbox.cxx       |    4 -
 cui/source/options/securityoptions.cxx   |    5 -
 cui/source/options/securityoptions.hxx   |    1 
 cui/source/options/treeopt.cxx           |   12 +++
 cui/source/options/webconninfo.cxx       |    6 +
 cui/source/options/webconninfo.hxx       |    1 
 cui/source/tabpages/align.cxx            |    6 +
 cui/source/tabpages/autocdlg.cxx         |   33 +++++++---
 cui/source/tabpages/backgrnd.cxx         |   13 ++++
 cui/source/tabpages/border.cxx           |    6 -
 cui/source/tabpages/chardlg.cxx          |   30 +--------
 cui/source/tabpages/connect.cxx          |   20 ------
 cui/source/tabpages/grfpage.cxx          |    6 +
 cui/source/tabpages/macroass.cxx         |    6 +
 cui/source/tabpages/measure.cxx          |   10 ---
 cui/source/tabpages/numfmt.cxx           |    7 ++
 cui/source/tabpages/numpages.cxx         |   36 +++++++++++
 cui/source/tabpages/page.cxx             |    6 +
 cui/source/tabpages/paragrph.cxx         |   16 -----
 cui/source/tabpages/swpossizetabpage.cxx |    4 -
 cui/source/tabpages/tabarea.cxx          |    4 -
 cui/source/tabpages/tabline.cxx          |    6 -
 cui/source/tabpages/tabstpge.cxx         |    6 -
 cui/source/tabpages/textanim.cxx         |   10 ---
 cui/source/tabpages/textattr.cxx         |    9 --
 cui/source/tabpages/tpbitmap.cxx         |    6 +
 cui/source/tabpages/tpcolor.cxx          |    6 +
 cui/source/tabpages/tpline.cxx           |    7 ++
 cui/source/tabpages/tplneend.cxx         |    6 -
 cui/source/tabpages/transfrm.cxx         |    6 -
 svtools/source/dialogs/wizardmachine.cxx |    1 
 vcl/inc/ilstbox.hxx                      |    2 
 vcl/source/control/ilstbox.cxx           |   13 ++--
 vcl/source/window/dialog.cxx             |    5 -
 vcl/source/window/printdlg.cxx           |    1 
 vcl/source/window/wrkwin.cxx             |   10 +--
 vcl/unx/generic/app/i18n_status.cxx      |   18 ++---
 175 files changed, 746 insertions(+), 487 deletions(-)

New commits:
commit 713b0f2778965dd460d26e3a1638908564376781
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Jan 15 15:48:23 2015 +0200

    loplugin: vclwidget: add check that dispose is calling superclass dispose
    
    and fix up the places it finds
    
    Change-Id: Ie1decd5cb14415ace423fc7a0609cc62044e19ff

diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index 040c5ba..402351e 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -38,6 +38,9 @@ public:
     bool VisitParmVarDecl(ParmVarDecl const * decl);
 
     bool VisitFunctionDecl( const FunctionDecl* var );
+
+private:
+    bool isDisposeCallingSuperclassDispose(const CXXMethodDecl* pMethodDecl);
 };
 
 bool BaseCheckNotWindowSubclass(const CXXRecordDecl *BaseDefinition, void *) {
@@ -115,12 +118,12 @@ bool VCLWidgets::VisitFieldDecl(const FieldDecl * fieldDecl) {
         return true;
     }
     if (isPointerToWindowSubclass(fieldDecl->getType())) {
-        report(
+/*        report(
             DiagnosticsEngine::Remark,
             "vcl::Window subclass declared as a pointer field, should be wrapped in VclPtr.",
             fieldDecl->getLocation())
           << fieldDecl->getSourceRange();
-        return true;
+        return true;*/
     }
 
     const RecordType *recordType = fieldDecl->getType()->getAs<RecordType>();
@@ -176,6 +179,10 @@ bool VCLWidgets::VisitFunctionDecl( const FunctionDecl* functionDecl )
         && pMethodDecl->getParent()->getQualifiedNameAsString().find("VclPtr") != std::string::npos) {
         return true;
     }
+    if (pMethodDecl
+        && pMethodDecl->getParent()->getQualifiedNameAsString().compare("vcl::Window") == 0) {
+        return true;
+    }
     QualType t1 { compat::getReturnType(*functionDecl) };
     if (t1.getAsString().find("VclPtr") != std::string::npos) {
         report(
@@ -184,9 +191,74 @@ bool VCLWidgets::VisitFunctionDecl( const FunctionDecl* functionDecl )
             functionDecl->getLocation())
           << functionDecl->getSourceRange();
     }
+    if (functionDecl->hasBody() && pMethodDecl && isDerivedFromWindow(pMethodDecl->getParent())) {
+        const CXXDestructorDecl *pDestructorDecl = dyn_cast<CXXDestructorDecl>(pMethodDecl);
+        // check that the destructor for a vcl::Window subclass does nothing except call into the dispose() method
+        if (pDestructorDecl) {
+            const CompoundStmt *pCompoundStatement = dyn_cast<CompoundStmt>(functionDecl->getBody());
+            bool ok = false;
+            if (pCompoundStatement && pCompoundStatement->size() == 1) {
+                const CXXMemberCallExpr *pCallExpr = dyn_cast<CXXMemberCallExpr>(*pCompoundStatement->body_begin());
+                if (pCallExpr) {
+                    ok = true;
+                }
+            }
+            if (!ok) {
+                report(
+                    DiagnosticsEngine::Warning,
+                    "vcl::Window subclass should have nothing in it's destructor but a call to dispose().",
+                    functionDecl->getBody()->getLocStart())
+                  << functionDecl->getBody()->getSourceRange();
+            }
+        // check the last thing that the dispose() method does, is to call into the superclass dispose method
+        } else if (pMethodDecl->getNameAsString() == "dispose") {
+            if (!isDisposeCallingSuperclassDispose(pMethodDecl)) {
+                report(
+                    DiagnosticsEngine::Warning,
+                    "vcl::Window subclass dispose() method MUST call it's superclass dispose() as the last thing it does.",
+                    functionDecl->getBody()->getLocStart())
+                  << functionDecl->getBody()->getSourceRange();
+           }
+        }
+    }
     return true;
 }
 
+/**
+The AST looks like:
+`-CXXMemberCallExpr 0xb06d8b0 'void'
+  `-MemberExpr 0xb06d868 '<bound member function type>' ->dispose 0x9d34880
+    `-ImplicitCastExpr 0xb06d8d8 'class SfxTabPage *' <UncheckedDerivedToBase (SfxTabPage)>
+      `-CXXThisExpr 0xb06d850 'class SfxAcceleratorConfigPage *' this
+
+*/
+bool VCLWidgets::isDisposeCallingSuperclassDispose(const CXXMethodDecl* pMethodDecl)
+{
+    const CompoundStmt *pCompoundStatement = dyn_cast<CompoundStmt>(pMethodDecl->getBody());
+    if (!pCompoundStatement) return false;
+    // find the last statement
+    const CXXMemberCallExpr *pCallExpr = dyn_cast<CXXMemberCallExpr>(*pCompoundStatement->body_rbegin());
+    if (!pCallExpr) return false;
+    const MemberExpr *pMemberExpr = dyn_cast<MemberExpr>(pCallExpr->getCallee());
+    if (!pMemberExpr) return false;
+    if (pMemberExpr->getMemberDecl()->getNameAsString() != "dispose") return false;
+    const CXXMethodDecl *pDirectCallee = dyn_cast<CXXMethodDecl>(pCallExpr->getDirectCallee());
+    if (!pDirectCallee) return false;
+/* Not working yet. Partially because sometimes the superclass does not a dispose() method, so it gets passed up the chain.
+   Need complex checking for that case.
+    if (pDirectCallee->getParent()->getTypeForDecl() != (*pMethodDecl->getParent()->bases_begin()).getType().getTypePtr()) {
+        report(
+            DiagnosticsEngine::Warning,
+            "dispose() method calling wrong baseclass, calling " + pDirectCallee->getParent()->getQualifiedNameAsString() +
+            " should be calling " + (*pMethodDecl->getParent()->bases_begin()).getType().getAsString(),
+            pCallExpr->getLocStart())
+          << pCallExpr->getSourceRange();
+        return false;
+    }*/
+    return true;
+}
+
+
 
 loplugin::Plugin::Registration< VCLWidgets > X("vclwidgets");
 
diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx
index dd3b37a..79ffe86 100644
--- a/svtools/source/dialogs/wizardmachine.cxx
+++ b/svtools/source/dialogs/wizardmachine.cxx
@@ -55,6 +55,7 @@ namespace svt
     void OWizardPage::dispose()
     {
         delete m_pImpl;
+        TabPage::dispose();
     }
 
     void OWizardPage::initializePage()
diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx
index 2d4ebc3..809c153 100644
--- a/vcl/inc/ilstbox.hxx
+++ b/vcl/inc/ilstbox.hxx
@@ -403,7 +403,6 @@ protected:
     virtual void        DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
 
     virtual bool        Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
-    virtual void        dispose() SAL_OVERRIDE;
 
     void                ImplResizeControls();
     void                ImplCheckScrollBars();
@@ -416,6 +415,7 @@ protected:
 public:
                     ImplListBox( vcl::Window* pParent, WinBits nWinStyle );
                     virtual ~ImplListBox();
+    virtual void    dispose() SAL_OVERRIDE;
 
     const ImplEntryList*    GetEntryList() const            { return maLBWindow->GetEntryList(); }
     ImplListBoxWindowPtr    GetMainWindow()                 { return maLBWindow; }
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index 1fe58fc..4c4500f 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -2164,9 +2164,16 @@ ImplListBox::ImplListBox( vcl::Window* pParent, WinBits nWinStyle ) :
 
 ImplListBox::~ImplListBox()
 {
+    dispose();
+}
+
+void ImplListBox::dispose()
+{
     delete mpHScrollBar;
     delete mpVScrollBar;
     delete mpScrollBarBox;
+    maLBWindow.clear();
+    Control::dispose();
 }
 
 void ImplListBox::Clear()
@@ -2516,12 +2523,6 @@ bool ImplListBox::Notify( NotifyEvent& rNEvt )
     return nDone || Window::Notify( rNEvt );
 }
 
-void ImplListBox::dispose()
-{
-    maLBWindow.clear();
-    Control::dispose();
-}
-
 const Wallpaper& ImplListBox::GetDisplayBackground() const
 {
     return maLBWindow->GetDisplayBackground();
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 032ca35..7d6b1f0 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -542,13 +542,12 @@ void Dialog::settingOptimalLayoutSize(VclBox *pBox)
 Dialog::~Dialog()
 {
     dispose();
-
-    delete mpDialogImpl;
-    mpDialogImpl = NULL;
 }
 
 void Dialog::dispose()
 {
+    delete mpDialogImpl;
+    mpDialogImpl = NULL;
     mpActionArea.disposeAndClear();
     mpContentArea.disposeAndClear();
     SystemWindow::dispose();
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 8552177..7f1bff4 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -725,6 +725,7 @@ PrintDialog::~PrintDialog()
 void PrintDialog::dispose()
 {
     delete mpCustomOptionsUIBuilder;
+    ModalDialog::dispose();
 }
 
 void PrintDialog::readFromSettings()
diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx
index 8eb0cf8..03285cf 100644
--- a/vcl/source/window/wrkwin.cxx
+++ b/vcl/source/window/wrkwin.cxx
@@ -113,17 +113,17 @@ WorkWindow::WorkWindow( SystemParentData* pParent ) :
 
 WorkWindow::~WorkWindow()
 {
+    dispose();
+}
+
+void WorkWindow::dispose()
+{
     ImplSVData* pSVData = ImplGetSVData();
     if ( pSVData->maWinData.mpAppWin == this )
     {
         pSVData->maWinData.mpAppWin = NULL;
         Application::Quit();
     }
-    dispose();
-}
-
-void WorkWindow::dispose()
-{
     SystemWindow::dispose();
 }
 
diff --git a/vcl/unx/generic/app/i18n_status.cxx b/vcl/unx/generic/app/i18n_status.cxx
index 9ed59af..0a96599 100644
--- a/vcl/unx/generic/app/i18n_status.cxx
+++ b/vcl/unx/generic/app/i18n_status.cxx
@@ -124,8 +124,15 @@ XIMStatusWindow::XIMStatusWindow( bool bOn ) :
 
 XIMStatusWindow::~XIMStatusWindow()
 {
+    dispose();
+}
+
+void XIMStatusWindow::dispose()
+{
     if( m_nDelayedEvent )
         Application::RemoveUserEvent( m_nDelayedEvent );
+    m_aStatusText.disposeAndClear();
+    StatusWindow::dispose();
 }
 
 void XIMStatusWindow::toggle( bool bOn )
@@ -134,12 +141,6 @@ void XIMStatusWindow::toggle( bool bOn )
     show( bOn, I18NStatus::contextmap );
 }
 
-void XIMStatusWindow::dispose()
-{
-    m_aStatusText.disposeAndClear();
-    StatusWindow::dispose();
-};
-
 void XIMStatusWindow::layout()
 {
     m_aWindowSize.Width() = m_aStatusText->GetTextWidth( m_aStatusText->GetText() )+8;
@@ -311,7 +312,6 @@ class IIIMPStatusWindow : public StatusWindow
 
 public:
     IIIMPStatusWindow( SalFrame* pParent, bool bOn ); // for initial position
-    virtual ~IIIMPStatusWindow();
 
     virtual void setText( const OUString & ) SAL_OVERRIDE;
     virtual void show( bool bShow, I18NStatus::ShowReason eReason ) SAL_OVERRIDE;
@@ -368,10 +368,6 @@ IIIMPStatusWindow::IIIMPStatusWindow( SalFrame* pParent, bool bOn ) :
     EnableAlwaysOnTop( true );
 }
 
-IIIMPStatusWindow::~IIIMPStatusWindow()
-{
-}
-
 void IIIMPStatusWindow::layout()
 {
     Font aFont( m_aStatusBtn->GetFont() );
commit 743a0eaac0631c06e2178c49d7012b2b2d51ec6b
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Jan 15 15:47:39 2015 +0200

    vcl: VclPtr conversion in cui
    
    Change-Id: I8597247296645fe72d5306e35b2ea3c0866d147a

diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index 94f7d79..a497a6b 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -814,6 +814,11 @@ SfxAcceleratorConfigPage::SfxAcceleratorConfigPage( vcl::Window* pParent, const
 
 SfxAcceleratorConfigPage::~SfxAcceleratorConfigPage()
 {
+    dispose();
+}
+
+void SfxAcceleratorConfigPage::dispose()
+{
     // free memory - remove all dynamic user data
     SvTreeListEntry* pEntry = m_pEntriesBox->First();
     while (pEntry)
@@ -837,6 +842,7 @@ SfxAcceleratorConfigPage::~SfxAcceleratorConfigPage()
     m_pKeyBox->Clear();
 
     delete m_pFileDlg;
+    SfxTabPage::dispose();
 }
 
 
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 328f8bf..97a0bb6 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -1395,11 +1395,6 @@ SvxMenuEntriesListBox::SvxMenuEntriesListBox(vcl::Window* pParent, SvxConfigPage
                      SV_DRAGDROP_APP_DROP);
 }
 
-SvxMenuEntriesListBox::~SvxMenuEntriesListBox()
-{
-    // do nothing
-}
-
 // drag and drop support
 DragDropMode SvxMenuEntriesListBox::NotifyStartDrag(
     TransferDataContainer& aTransferDataContainer, SvTreeListEntry* pEntry )
@@ -2226,6 +2221,11 @@ void SvxMenuConfigPage::Init()
 
 SvxMenuConfigPage::~SvxMenuConfigPage()
 {
+    dispose();
+}
+
+void SvxMenuConfigPage::dispose()
+{
     for ( sal_uInt16 i = 0 ; i < m_pSaveInListBox->GetEntryCount(); ++i )
     {
         MenuSaveInData* pData =
@@ -2236,6 +2236,7 @@ SvxMenuConfigPage::~SvxMenuConfigPage()
 
     delete m_pSelectorDlg;
     delete m_pContentsListBox;
+    SvxConfigPage::dispose();
 }
 
 IMPL_LINK( SvxMenuConfigPage, SelectMenuEntry, Control *, pBox )
@@ -2675,10 +2676,6 @@ IMPL_LINK(SvxMainMenuOrganizerDialog, ModifyHdl, Edit*, pEdit)
     return 0;
 }
 
-SvxMainMenuOrganizerDialog::~SvxMainMenuOrganizerDialog()
-{
-}
-
 IMPL_LINK( SvxMainMenuOrganizerDialog, SelectHdl, Control*, pCtrl )
 {
     (void)pCtrl;
@@ -2916,6 +2913,11 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(vcl::Window *pParent, const SfxItemSe
 
 SvxToolbarConfigPage::~SvxToolbarConfigPage()
 {
+    dispose();
+}
+
+void SvxToolbarConfigPage::dispose()
+{
     for ( sal_uInt16 i = 0 ; i < m_pSaveInListBox->GetEntryCount(); ++i )
     {
         ToolbarSaveInData* pData =
@@ -2931,6 +2933,7 @@ SvxToolbarConfigPage::~SvxToolbarConfigPage()
 
 
     delete m_pContentsListBox;
+    SvxConfigPage::dispose();
 }
 
 void SvxToolbarConfigPage::DeleteSelectedTopLevel()
@@ -4524,7 +4527,13 @@ SvxToolbarEntriesListBox::SvxToolbarEntriesListBox(vcl::Window* pParent, SvxTool
 
 SvxToolbarEntriesListBox::~SvxToolbarEntriesListBox()
 {
+    dispose();
+}
+
+void SvxToolbarEntriesListBox::dispose()
+{
     delete m_pButtonData;
+    SvxMenuEntriesListBox::dispose();
 }
 
 void SvxToolbarEntriesListBox::BuildCheckBoxButtonImages( SvLBoxButtonData* pData )
@@ -4910,6 +4919,11 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( vcl::Window *pWindow,
 
 SvxIconSelectorDialog::~SvxIconSelectorDialog()
 {
+    dispose();
+}
+
+void SvxIconSelectorDialog::dispose()
+{
     sal_uInt16 nCount = pTbSymbol->GetItemCount();
 
     for (sal_uInt16 n = 0; n < nCount; ++n )
@@ -4924,6 +4938,7 @@ SvxIconSelectorDialog::~SvxIconSelectorDialog()
             xi->release();
         }
     }
+    ModalDialog::dispose();
 }
 
 uno::Reference< graphic::XGraphic> SvxIconSelectorDialog::GetSelectedIcon()
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index 6cb2357..1ea0e7d 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -276,7 +276,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSfxConfigFunctionListB
 
 SfxConfigFunctionListBox::~SfxConfigFunctionListBox()
 {
+    dispose();
+}
+
+void SfxConfigFunctionListBox::dispose()
+{
     ClearAll();
+    SvTreeListBox::dispose();
 }
 
 void SfxConfigFunctionListBox::MouseMove( const MouseEvent& )
@@ -431,7 +437,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSfxConfigGroupListBox(
 
 SfxConfigGroupListBox::~SfxConfigGroupListBox()
 {
+    dispose();
+}
+
+void SfxConfigGroupListBox::dispose()
+{
     ClearAll();
+    SvTreeListBox::dispose();
 }
 
 void SfxConfigGroupListBox::ClearAll()
diff --git a/cui/source/customize/eventdlg.cxx b/cui/source/customize/eventdlg.cxx
index bee41cc..48c86e9 100644
--- a/cui/source/customize/eventdlg.cxx
+++ b/cui/source/customize/eventdlg.cxx
@@ -103,6 +103,11 @@ void SvxEventConfigPage::LateInit( const uno::Reference< frame::XFrame >& _rxFra
 
 SvxEventConfigPage::~SvxEventConfigPage()
 {
+    dispose();
+}
+
+void SvxEventConfigPage::dispose()
+{
     // need to delete the user data
     SvHeaderTabListBox& rListBox = mpImpl->pEventLB->GetListBox();
     SvTreeListEntry* pE = rListBox.GetEntry( 0 );
@@ -113,6 +118,7 @@ SvxEventConfigPage::~SvxEventConfigPage()
         pE->SetUserData((void*)0);
         pE = rListBox.NextSibling( pE );
     }
+    _SvxMacroTabPage::dispose();
 }
 
 void SvxEventConfigPage::ImplInitDocument()
diff --git a/cui/source/customize/eventdlg.hxx b/cui/source/customize/eventdlg.hxx
index b6b6c61..89e3ecd 100644
--- a/cui/source/customize/eventdlg.hxx
+++ b/cui/source/customize/eventdlg.hxx
@@ -49,6 +49,7 @@ public:
                     struct EarlyInit { };
                     SvxEventConfigPage( vcl::Window *pParent, const SfxItemSet& rSet, EarlyInit );
                     virtual ~SvxEventConfigPage();
+    virtual void    dispose() SAL_OVERRIDE;
 
     void            LateInit( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame );
 
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
index 00126b1..5f7a571 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -84,32 +84,32 @@ static long nTabs[] =
 
 IMPL_LINK( MacroEventListBox, HeaderEndDrag_Impl, HeaderBar*, pBar )
 {
-    DBG_ASSERT( pBar == &maHeaderBar, "*MacroEventListBox::HeaderEndDrag_Impl: something is wrong here..." );
+    DBG_ASSERT( pBar == maHeaderBar.get(), "*MacroEventListBox::HeaderEndDrag_Impl: something is wrong here..." );
     (void)pBar;
 
-    if( !maHeaderBar.GetCurItemId() )
+    if( !maHeaderBar->GetCurItemId() )
         return 0;
 
-    if( !maHeaderBar.IsItemMode() )
+    if( !maHeaderBar->IsItemMode() )
     {
         Size    aSz;
-        sal_uInt16    _nTabs = maHeaderBar.GetItemCount();
-        long    nWidth = maHeaderBar.GetItemSize( ITEMID_EVENT );
-        long    nBarWidth = maHeaderBar.GetSizePixel().Width();
+        sal_uInt16    _nTabs = maHeaderBar->GetItemCount();
+        long    nWidth = maHeaderBar->GetItemSize( ITEMID_EVENT );
+        long    nBarWidth = maHeaderBar->GetSizePixel().Width();
 
         if( nWidth < TAB_WIDTH_MIN )
-            maHeaderBar.SetItemSize( ITEMID_EVENT, TAB_WIDTH_MIN );
+            maHeaderBar->SetItemSize( ITEMID_EVENT, TAB_WIDTH_MIN );
         else if( ( nBarWidth - nWidth ) < TAB_WIDTH_MIN )
-            maHeaderBar.SetItemSize( ITEMID_EVENT, nBarWidth - TAB_WIDTH_MIN );
+            maHeaderBar->SetItemSize( ITEMID_EVENT, nBarWidth - TAB_WIDTH_MIN );
 
         {
             long nTmpSz = 0;
             for( sal_uInt16 i = 1 ; i < _nTabs ; ++i )
             {
-                long _nWidth = maHeaderBar.GetItemSize( i );
+                long _nWidth = maHeaderBar->GetItemSize( i );
                 aSz.Width() =  _nWidth + nTmpSz;
                 nTmpSz += _nWidth;
-                maListBox.SetTab( i, PixelToLogic( aSz, MapMode( MAP_APPFONT ) ).Width(), MAP_APPFONT );
+                maListBox->SetTab( i, PixelToLogic( aSz, MapMode( MAP_APPFONT ) ).Width(), MAP_APPFONT );
             }
         }
     }
@@ -122,8 +122,8 @@ bool MacroEventListBox::Notify( NotifyEvent& rNEvt )
 
     if( rNEvt.GetType() == MouseNotifyEvent::GETFOCUS )
     {
-        if ( rNEvt.GetWindow() != &maListBox )
-            maListBox.GrabFocus();
+        if ( rNEvt.GetWindow() != maListBox.get() )
+            maListBox->GrabFocus();
     }
 
     return nRet;
@@ -131,13 +131,25 @@ bool MacroEventListBox::Notify( NotifyEvent& rNEvt )
 
 MacroEventListBox::MacroEventListBox( vcl::Window* pParent, WinBits nStyle )
     : Control( pParent, nStyle )
-    , maHeaderBar( this, WB_BUTTONSTYLE | WB_BOTTOMBORDER )
-    , maListBox( this, WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP )
+    , maHeaderBar( new HeaderBar( this, WB_BUTTONSTYLE | WB_BOTTOMBORDER ) )
+    , maListBox( new SvHeaderTabListBox( this, WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ) )
 {
-    maListBox.SetHelpId( HID_MACRO_HEADERTABLISTBOX );
+    maListBox->SetHelpId( HID_MACRO_HEADERTABLISTBOX );
 
     // enable the cell focus to show visible focus
-    maListBox.EnableCellFocus();
+    maListBox->EnableCellFocus();
+}
+
+MacroEventListBox::~MacroEventListBox()
+{
+    dispose();
+}
+
+void MacroEventListBox::dispose()
+{
+    maHeaderBar.disposeAndClear();
+    maListBox.disposeAndClear();
+    Control::dispose();
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeMacroEventListBox(vcl::Window *pParent, VclBuilder::stringmap &rMap)
@@ -162,15 +174,15 @@ void MacroEventListBox::Resize()
 
     // calc pos and size of header bar
     Point    aPnt( 0, 0 );
-    Size    aSize( maHeaderBar.CalcWindowSizePixel() );
+    Size    aSize( maHeaderBar->CalcWindowSizePixel() );
     Size    aCtrlSize( GetOutputSizePixel() );
     aSize.Width() = aCtrlSize.Width();
-    maHeaderBar.SetPosSizePixel( aPnt, aSize );
+    maHeaderBar->SetPosSizePixel( aPnt, aSize );
 
     // calc pos and size of ListBox
     aPnt.Y() += aSize.Height();
     aSize.Height() = aCtrlSize.Height() - aSize.Height();
-    maListBox.SetPosSizePixel( aPnt, aSize );
+    maListBox->SetPosSizePixel( aPnt, aSize );
 }
 
 void MacroEventListBox::ConnectElements( void )
@@ -178,21 +190,21 @@ void MacroEventListBox::ConnectElements( void )
     Resize();
 
     // set handler
-    maHeaderBar.SetEndDragHdl( LINK( this, MacroEventListBox, HeaderEndDrag_Impl ) );
+    maHeaderBar->SetEndDragHdl( LINK( this, MacroEventListBox, HeaderEndDrag_Impl ) );
 
-    maListBox.InitHeaderBar( &maHeaderBar );
+    maListBox->InitHeaderBar( maHeaderBar.get() );
 }
 
 void MacroEventListBox::Show( bool bVisible, sal_uInt16 nFlags )
 {
-    maListBox.Show( bVisible, nFlags );
-    maHeaderBar.Show( bVisible, nFlags );
+    maListBox->Show( bVisible, nFlags );
+    maHeaderBar->Show( bVisible, nFlags );
 }
 
 void MacroEventListBox::Enable( bool bEnable, bool bChild )
 {
-    maListBox.Enable( bEnable, bChild );
-    maHeaderBar.Enable( bEnable, bChild );
+    maListBox->Enable( bEnable, bChild );
+    maHeaderBar->Enable( bEnable, bChild );
 }
 
 // assign button ("Add Command") is enabled only if it is not read only
@@ -227,7 +239,13 @@ _SvxMacroTabPage::_SvxMacroTabPage(vcl::Window* pParent, const OString& rID,
 
 _SvxMacroTabPage::~_SvxMacroTabPage()
 {
+   dispose();
+}
+
+void _SvxMacroTabPage::dispose()
+{
     DELETEZ( mpImpl );
+    SfxTabPage::dispose();
 }
 
 void _SvxMacroTabPage::InitResources()
@@ -871,12 +889,6 @@ AssignComponentDialog::AssignComponentDialog( vcl::Window * pParent, const OUStr
     mpMethodEdit->SetText( aMethodName, Selection( 0, SELECTION_MAX ) );
 }
 
-AssignComponentDialog::~AssignComponentDialog()
-{
-}
-
-
-
 IMPL_LINK( SvxMacroAssignSingleTabDialog, OKHdl_Impl, Button *, pButton )
 {
     (void)pButton; //unused
diff --git a/cui/source/customize/macropg_impl.hxx b/cui/source/customize/macropg_impl.hxx
index 7babc45..6ec8709a 100644
--- a/cui/source/customize/macropg_impl.hxx
+++ b/cui/source/customize/macropg_impl.hxx
@@ -49,7 +49,6 @@ private:
 
 public:
     AssignComponentDialog( vcl::Window * pParent, const OUString& rURL );
-    virtual ~AssignComponentDialog();
 
     OUString getURL( void ) const
         { return maURL; }
diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx
index 4bb467a..fc44737 100644
--- a/cui/source/customize/selector.cxx
+++ b/cui/source/customize/selector.cxx
@@ -99,7 +99,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxConfigFunctionListB
 
 SvxConfigFunctionListBox::~SvxConfigFunctionListBox()
 {
+    dispose();
+}
+
+void SvxConfigFunctionListBox::dispose()
+{
     ClearAll();
+    SvTreeListBox::dispose();
 }
 
 SvTreeListEntry* SvxConfigFunctionListBox::GetLastSelectedEntry()
@@ -227,7 +233,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxConfigGroupListBox(
 
 SvxConfigGroupListBox::~SvxConfigGroupListBox()
 {
+    dispose();
+}
+
+void SvxConfigGroupListBox::dispose()
+{
     ClearAll();
+    SvTreeListBox::dispose();
 }
 
 void SvxConfigGroupListBox::ClearAll()
@@ -906,10 +918,6 @@ SvxScriptSelectorDialog::SvxScriptSelectorDialog(
     UpdateUI();
 }
 
-SvxScriptSelectorDialog::~SvxScriptSelectorDialog()
-{
-}
-
 IMPL_LINK( SvxScriptSelectorDialog, SelectHdl, Control*, pCtrl )
 {
     if (pCtrl == m_pCategories)
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 2aba722..d3e4a72 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -245,6 +245,11 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* pChildWindow,
 
 SpellDialog::~SpellDialog()
 {
+    dispose();
+}
+
+void SpellDialog::dispose()
+{
     // save possibly modified user-dictionaries
     Reference< XSearchableDictionaryList >  xDicList( SvxGetDictionaryList() );
     if (xDicList.is())
@@ -253,6 +258,7 @@ SpellDialog::~SpellDialog()
     }
 
     delete pImpl;
+    SfxModelessDialog::dispose();
 }
 
 
@@ -1198,9 +1204,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSentenceEditWindow(vcl
 }
 
 
-SentenceEditWindow_Impl::~SentenceEditWindow_Impl()
-{
-}
 /*-------------------------------------------------------------------------
     The selection before inputting a key may have a range or not
     and it may be inside or outside of field or error attributes.
diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx
index 843347b..301e9f1 100644
--- a/cui/source/dialogs/colorpicker.cxx
+++ b/cui/source/dialogs/colorpicker.cxx
@@ -312,6 +312,7 @@ class ColorFieldControl : public Control
 public:
     ColorFieldControl( vcl::Window* pParent, const WinBits& nStyle );
     virtual ~ColorFieldControl();
+    virtual void        dispose() SAL_OVERRIDE;
 
     virtual void        MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     virtual void        MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
@@ -362,7 +363,13 @@ ColorFieldControl::ColorFieldControl( vcl::Window* pParent, const WinBits& nStyl
 
 ColorFieldControl::~ColorFieldControl()
 {
+    dispose();
+}
+
+void ColorFieldControl::dispose()
+{
     delete mpBitmap;
+    Control::dispose();
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeColorFieldControl(vcl::Window *pParent, VclBuilder::stringmap &rMap)
@@ -705,6 +712,7 @@ class ColorSliderControl : public Control
 public:
     ColorSliderControl( vcl::Window* pParent, const WinBits& nStyle );
     virtual ~ColorSliderControl();
+    virtual void dispose() SAL_OVERRIDE;
 
     virtual void        MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     virtual void        MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
@@ -747,7 +755,13 @@ ColorSliderControl::ColorSliderControl( vcl::Window* pParent, const WinBits& nSt
 
 ColorSliderControl::~ColorSliderControl()
 {
+    dispose();
+}
+
+void ColorSliderControl::dispose()
+{
     delete mpBitmap;
+    Control::dispose();
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeColorSliderControl(vcl::Window *pParent, VclBuilder::stringmap &rMap)
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx
index 9c7ab5b..609d749 100644
--- a/cui/source/dialogs/cuicharmap.cxx
+++ b/cui/source/dialogs/cuicharmap.cxx
@@ -102,15 +102,6 @@ SvxCharacterMap::SvxCharacterMap( vcl::Window* pParent, bool bOne_, const SfxIte
 
 
 
-SvxCharacterMap::~SvxCharacterMap()
-{
-}
-
-
-
-
-
-
 void SvxCharacterMap::SetChar( sal_UCS4 c )
 {
     m_pShowSet->SelectCharacter( c );
@@ -298,9 +289,6 @@ void SvxShowText::SetText( const OUString& rText )
 
 
 
-SvxShowText::~SvxShowText()
-{}
-
 // class SvxCharacterMap =================================================
 
 void SvxCharacterMap::init()
diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx
index d1856f4..5b63b06 100644
--- a/cui/source/dialogs/cuifmsearch.cxx
+++ b/cui/source/dialogs/cuifmsearch.cxx
@@ -160,6 +160,11 @@ FmSearchDialog::FmSearchDialog(vcl::Window* pParent, const OUString& sInitialTex
 
 FmSearchDialog::~FmSearchDialog()
 {
+    dispose();
+}
+
+void FmSearchDialog::dispose()
+{
     if (m_aDelayedPaint.IsActive())
         m_aDelayedPaint.Stop();
 
@@ -172,6 +177,7 @@ FmSearchDialog::~FmSearchDialog()
     }
 
     delete m_pSearchEngine;
+    ModalDialog::dispose();
 }
 
 void FmSearchDialog::Init(const OUString& strVisibleFields, const OUString& sInitialText)
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index 1cd56f2..edf2c35 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -760,12 +760,18 @@ void TPGalleryThemeProperties::StartSearchFiles( const OUString& _rFolderURL, sh
 
 TPGalleryThemeProperties::~TPGalleryThemeProperties()
 {
+    dispose();
+}
+
+void TPGalleryThemeProperties::dispose()
+{
     xMediaPlayer.clear();
     xDialogListener.clear();
 
     for ( size_t i = 0, n = aFilterEntryList.size(); i < n; ++i ) {
         delete aFilterEntryList[ i ];
     }
+    SfxTabPage::dispose();
 }
 
 
diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx
index f9888f3..fc4c2a4 100644
--- a/cui/source/dialogs/cuihyperdlg.cxx
+++ b/cui/source/dialogs/cuihyperdlg.cxx
@@ -157,11 +157,17 @@ SvxHpLinkDlg::SvxHpLinkDlg (vcl::Window* pParent, SfxBindings* pBindings)
 
 SvxHpLinkDlg::~SvxHpLinkDlg ()
 {
+    dispose();
+}
+
+void SvxHpLinkDlg::dispose()
+{
     // delete config item, so the base class (IconChoiceDialog) can not load it on the next start
     SvtViewOptions aViewOpt( E_TABDIALOG, OUString::number(SID_HYPERLINK_DIALOG) );
     aViewOpt.Delete();
 
     delete mpItemSet;
+    IconChoiceDialog::dispose();
 }
 
 /*************************************************************************
diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx
index 83ee94c..1f6c663 100644
--- a/cui/source/dialogs/dlgname.cxx
+++ b/cui/source/dialogs/dlgname.cxx
@@ -138,7 +138,13 @@ SvxMessDialog::SvxMessDialog( vcl::Window* pWindow, const OUString& rText, const
 
 SvxMessDialog::~SvxMessDialog()
 {
+    dispose();
+}
+
+void SvxMessDialog::dispose()
+{
     delete pImage;
+    ModalDialog::dispose();
 }
 
 /*************************************************************************/
diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
index 0133f61..a77bc2c 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -338,7 +338,13 @@ namespace svx
 
     SuggestionSet::~SuggestionSet()
     {
+        dispose();
+    }
+
+    void SuggestionSet::dispose()
+    {
         ClearSet();
+        ValueSet::dispose();
     }
 
     void SuggestionSet::UserDraw( const UserDrawEvent& rUDEvt )
@@ -366,29 +372,37 @@ namespace svx
     SuggestionDisplay::SuggestionDisplay( vcl::Window* pParent, WinBits nBits )
         : Control( pParent, nBits )
         , m_bDisplayListBox( true )
-        , m_aValueSet( this )
-        , m_aListBox( this,GetStyle() | WB_BORDER )
+        , m_aValueSet( new SuggestionSet(this) )
+        , m_aListBox( new ListBox(this,GetStyle() | WB_BORDER) )
         , m_bInSelectionUpdate( false )
     {
-        m_aValueSet.SetSelectHdl( LINK( this, SuggestionDisplay, SelectSuggestionHdl ) );
-        m_aListBox.SetSelectHdl( LINK( this, SuggestionDisplay, SelectSuggestionHdl ) );
+        m_aValueSet->SetSelectHdl( LINK( this, SuggestionDisplay, SelectSuggestionHdl ) );
+        m_aListBox->SetSelectHdl( LINK( this, SuggestionDisplay, SelectSuggestionHdl ) );
 
-        m_aValueSet.SetLineCount( LINE_CNT );
-        m_aValueSet.SetStyle( m_aValueSet.GetStyle() | WB_ITEMBORDER | WB_FLATVALUESET | WB_VSCROLL );
-        m_aValueSet.SetBorderStyle( WindowBorderStyle::MONO );
+        m_aValueSet->SetLineCount( LINE_CNT );
+        m_aValueSet->SetStyle( m_aValueSet->GetStyle() | WB_ITEMBORDER | WB_FLATVALUESET | WB_VSCROLL );
+        m_aValueSet->SetBorderStyle( WindowBorderStyle::MONO );
         OUString aOneCharacter("AU");
         long nItemWidth = 2*GetTextWidth( aOneCharacter );
-        m_aValueSet.SetItemWidth( nItemWidth );
+        m_aValueSet->SetItemWidth( nItemWidth );
 
         Size aSize( approximate_char_width() * 48, GetTextHeight() * 5 );
-        m_aValueSet.SetSizePixel( aSize );
-        m_aListBox.SetSizePixel( aSize );
+        m_aValueSet->SetSizePixel( aSize );
+        m_aListBox->SetSizePixel( aSize );
 
         implUpdateDisplay();
     }
 
     SuggestionDisplay::~SuggestionDisplay()
     {
+        dispose();
+    }
+
+    void SuggestionDisplay::dispose()
+    {
+        m_aValueSet.disposeAndClear();
+        m_aListBox.disposeAndClear();
+        Control::dispose();
     }
 
     void SuggestionDisplay::implUpdateDisplay()
@@ -396,8 +410,8 @@ namespace svx
         bool bShowBox = IsVisible() && m_bDisplayListBox;
         bool bShowSet = IsVisible() && !m_bDisplayListBox;
 
-        m_aListBox.Show( bShowBox );
-        m_aValueSet.Show( bShowSet );
+        m_aListBox->Show( bShowBox );
+        m_aValueSet->Show( bShowSet );
     }
 
     void SuggestionDisplay::StateChanged( StateChangedType nStateChange )
@@ -409,8 +423,8 @@ namespace svx
     Control& SuggestionDisplay::implGetCurrentControl()
     {
         if( m_bDisplayListBox )
-            return m_aListBox;
-        return m_aValueSet;
+            return *m_aListBox.get();
+        return *m_aValueSet.get();
     }
 
     void SuggestionDisplay::KeyInput( const KeyEvent& rKEvt )
@@ -467,15 +481,15 @@ namespace svx
             return 0L;
 
         m_bInSelectionUpdate = true;
-        if( pControl == &m_aListBox )
+        if( pControl == m_aListBox.get() )
         {
-            sal_uInt16 nPos = m_aListBox.GetSelectEntryPos();
-            m_aValueSet.SelectItem( nPos+1 ); //itemid == pos+1 (id 0 has special meaning)
+            sal_uInt16 nPos = m_aListBox->GetSelectEntryPos();
+            m_aValueSet->SelectItem( nPos+1 ); //itemid == pos+1 (id 0 has special meaning)
         }
         else
         {
-            sal_uInt16 nPos = m_aValueSet.GetSelectItemId()-1; //itemid == pos+1 (id 0 has special meaning)
-            m_aListBox.SelectEntryPos( nPos );
+            sal_uInt16 nPos = m_aValueSet->GetSelectItemId()-1; //itemid == pos+1 (id 0 has special meaning)
+            m_aListBox->SelectEntryPos( nPos );
         }
         m_bInSelectionUpdate = false;
         m_aSelectLink.Call( this );
@@ -488,38 +502,38 @@ namespace svx
     }
     void SuggestionDisplay::Clear()
     {
-        m_aListBox.Clear();
-        m_aValueSet.Clear();
+        m_aListBox->Clear();
+        m_aValueSet->Clear();
     }
     void SuggestionDisplay::InsertEntry( const OUString& rStr )
     {
-        sal_uInt16 nItemId = m_aListBox.InsertEntry( rStr ) + 1; //itemid == pos+1 (id 0 has special meaning)
-        m_aValueSet.InsertItem( nItemId );
+        sal_uInt16 nItemId = m_aListBox->InsertEntry( rStr ) + 1; //itemid == pos+1 (id 0 has special meaning)
+        m_aValueSet->InsertItem( nItemId );
         OUString* pItemData = new OUString( rStr );
-        m_aValueSet.SetItemData( nItemId, pItemData );
+        m_aValueSet->SetItemData( nItemId, pItemData );
     }
     void SuggestionDisplay::SelectEntryPos( sal_uInt16 nPos )
     {
-        m_aListBox.SelectEntryPos( nPos );
-        m_aValueSet.SelectItem( nPos+1 ); //itemid == pos+1 (id 0 has special meaning)
+        m_aListBox->SelectEntryPos( nPos );
+        m_aValueSet->SelectItem( nPos+1 ); //itemid == pos+1 (id 0 has special meaning)
     }
     sal_uInt16 SuggestionDisplay::GetEntryCount() const
     {
-        return m_aListBox.GetEntryCount();
+        return m_aListBox->GetEntryCount();
     }
     OUString SuggestionDisplay::GetEntry( sal_uInt16 nPos ) const
     {
-        return m_aListBox.GetEntry( nPos );
+        return m_aListBox->GetEntry( nPos );
     }
     OUString SuggestionDisplay::GetSelectEntry() const
     {
-        return m_aListBox.GetSelectEntry();
+        return m_aListBox->GetSelectEntry();
     }
     void SuggestionDisplay::SetHelpIds()
     {
         this->SetHelpId( HID_HANGULDLG_SUGGESTIONS );
-        m_aValueSet.SetHelpId( HID_HANGULDLG_SUGGESTIONS_GRID );
-        m_aListBox.SetHelpId( HID_HANGULDLG_SUGGESTIONS_LIST );
+        m_aValueSet->SetHelpId( HID_HANGULDLG_SUGGESTIONS_GRID );
+        m_aListBox->SetHelpId( HID_HANGULDLG_SUGGESTIONS_LIST );
     }
 
     extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSuggestionDisplay( vcl::Window *pParent, VclBuilder::stringmap & )
@@ -592,11 +606,6 @@ namespace svx
     }
 
 
-    HangulHanjaConversionDialog::~HangulHanjaConversionDialog( )
-    {
-    }
-
-
     void HangulHanjaConversionDialog::FillSuggestions( const ::com::sun::star::uno::Sequence< OUString >& _rSuggestions )
     {
         m_pSuggestions->Clear();
@@ -1125,6 +1134,11 @@ namespace svx
 
     HangulHanjaOptionsDialog::~HangulHanjaOptionsDialog()
     {
+        dispose();
+    }
+
+    void HangulHanjaOptionsDialog::dispose()
+    {
         SvTreeListEntry*    pEntry = m_pDictsLB->First();
         while( pEntry )
         {
@@ -1136,6 +1150,7 @@ namespace svx
 
         if( m_pCheckButtonData )
             delete m_pCheckButtonData;
+        ModalDialog::dispose();
     }
 
     void HangulHanjaOptionsDialog::AddDict( const OUString& _rName, bool _bChecked )
@@ -1357,10 +1372,6 @@ namespace svx
     {
     }
 
-    SuggestionEdit::~SuggestionEdit()
-    {
-    }
-
     bool SuggestionEdit::PreNotify( NotifyEvent& rNEvt )
     {
         bool nHandled = false;
@@ -1769,8 +1780,14 @@ namespace svx
 
     HangulHanjaEditDictDialog::~HangulHanjaEditDictDialog()
     {
+        dispose();
+    }
+
+    void HangulHanjaEditDictDialog::dispose()
+    {
         if( m_pSuggestions )
             delete m_pSuggestions;
+        ModalDialog::dispose();
     }
 
     void HangulHanjaEditDictDialog::UpdateScrollbar( void )
diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index 89d58e2..a18841e 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -129,12 +129,18 @@ SvxHyperlinkNewDocTp::SvxHyperlinkNewDocTp ( vcl::Window *pParent, IconChoiceDia
 
 SvxHyperlinkNewDocTp::~SvxHyperlinkNewDocTp ()
 {
+    dispose();
+}
+
+void SvxHyperlinkNewDocTp::dispose()
+{
     for ( sal_uInt16 n=0; n<m_pLbDocTypes->GetEntryCount(); n++ )
     {
         DocumentTypeData* pTypeData = (DocumentTypeData*)
                                       m_pLbDocTypes->GetEntryData ( n );
         delete pTypeData;
     }
+    SvxHyperlinkTabPageBase::dispose();
 }
 
 /*************************************************************************
diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx
index 086fd8d..b9cfb71 100644
--- a/cui/source/dialogs/hldoctp.cxx
+++ b/cui/source/dialogs/hldoctp.cxx
@@ -71,10 +71,6 @@ SvxHyperlinkDocTp::SvxHyperlinkDocTp ( vcl::Window *pParent, IconChoiceDialog* p
     maTimer.SetTimeoutHdl ( LINK ( this, SvxHyperlinkDocTp, TimeoutHdl_Impl ) );
 }
 
-SvxHyperlinkDocTp::~SvxHyperlinkDocTp ()
-{
-}
-
 /*************************************************************************
 |*
 |* Fill all dialog-controls except controls in groupbox "more..."
diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx
index 0230fc0..3db4fad 100644
--- a/cui/source/dialogs/hlinettp.cxx
+++ b/cui/source/dialogs/hlinettp.cxx
@@ -81,10 +81,6 @@ SvxHyperlinkInternetTp::SvxHyperlinkInternetTp ( vcl::Window *pParent,
     maTimer.SetTimeoutHdl           ( LINK ( this, SvxHyperlinkInternetTp, TimeoutHdl_Impl ) );
 }
 
-SvxHyperlinkInternetTp::~SvxHyperlinkInternetTp ()
-{
-}
-
 /*************************************************************************
 |*
 |* Fill the all dialog-controls except controls in groupbox "more..."
diff --git a/cui/source/dialogs/hlmailtp.cxx b/cui/source/dialogs/hlmailtp.cxx
index fef0bbf..eeedc91 100644
--- a/cui/source/dialogs/hlmailtp.cxx
+++ b/cui/source/dialogs/hlmailtp.cxx
@@ -73,10 +73,6 @@ SvxHyperlinkMailTp::SvxHyperlinkMailTp ( vcl::Window *pParent, IconChoiceDialog*
         m_pBtAdrBook->Hide();
 }
 
-SvxHyperlinkMailTp::~SvxHyperlinkMailTp ()
-{
-}
-
 /*************************************************************************
 |*
 |* Fill the all dialog-controls except controls in groupbox "more..."
diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx
index 073f498..707aa3c 100644
--- a/cui/source/dialogs/hlmarkwn.cxx
+++ b/cui/source/dialogs/hlmarkwn.cxx
@@ -150,7 +150,13 @@ SvxHlinkDlgMarkWnd::SvxHlinkDlgMarkWnd( SvxHyperlinkTabPageBase *pParent )
 
 SvxHlinkDlgMarkWnd::~SvxHlinkDlgMarkWnd()
 {
+    dispose();
+}
+
+void SvxHlinkDlgMarkWnd::dispose()
+{
     ClearTree();
+    ModalDialog::dispose();
 }
 
 /*************************************************************************
diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx
index de10149..e31ab01 100644
--- a/cui/source/dialogs/hltpbase.cxx
+++ b/cui/source/dialogs/hltpbase.cxx
@@ -105,11 +105,17 @@ SvxHyperlinkTabPageBase::SvxHyperlinkTabPageBase ( vcl::Window *pParent,
     mpMarkWnd = new SvxHlinkDlgMarkWnd ( this );
 }
 
-SvxHyperlinkTabPageBase::~SvxHyperlinkTabPageBase ()
+SvxHyperlinkTabPageBase::~SvxHyperlinkTabPageBase()
+{
+    dispose();
+}
+
+void SvxHyperlinkTabPageBase::dispose()
 {
     maTimer.Stop();
 
     delete mpMarkWnd;
+    IconChoicePage::dispose();
 }
 
 void SvxHyperlinkTabPageBase::ActivatePage()
diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx
index c6c7bb1..af6d298 100644
--- a/cui/source/dialogs/hyphen.cxx
+++ b/cui/source/dialogs/hyphen.cxx
@@ -513,11 +513,6 @@ SvxHyphenWordDialog::SvxHyphenWordDialog(
 }
 
 
-SvxHyphenWordDialog::~SvxHyphenWordDialog()
-{
-}
-
-
 void SvxHyphenWordDialog::SetWindowTitle( LanguageType nLang )
 {
     OUString aLangStr( SvtLanguageTable::GetLanguageString( nLang ) );
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx
index 5d558c0..ec7251d 100644
--- a/cui/source/dialogs/iconcdlg.cxx
+++ b/cui/source/dialogs/iconcdlg.cxx
@@ -53,10 +53,6 @@ IconChoicePage::IconChoicePage( vcl::Window *pParent, const OString& rID,
 
 
 
-IconChoicePage::~IconChoicePage()
-{
-}
-
 /**********************************************************************
 |
 | Activate / Deaktivate
@@ -228,6 +224,11 @@ IconChoiceDialog::IconChoiceDialog ( vcl::Window* pParent, const OUString& rID,
 
 IconChoiceDialog ::~IconChoiceDialog ()
 {
+    dispose();
+}
+
+void IconChoiceDialog::dispose()
+{
     // save configuration at INI-Manager
     // and remove pages
     //SvtViewOptions aTabDlgOpt( E_TABDIALOG, rId );
@@ -267,6 +268,7 @@ IconChoiceDialog ::~IconChoiceDialog ()
 
     delete pRanges;
     delete pOutSet;
+    ModalDialog::dispose();
 }
 
 /**********************************************************************
diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx
index 84c2fd7..8eed4f3 100644
--- a/cui/source/dialogs/insdlg.cxx
+++ b/cui/source/dialogs/insdlg.cxx
@@ -395,7 +395,13 @@ SvInsertPlugInDialog::SvInsertPlugInDialog(vcl::Window* pParent,
 
 SvInsertPlugInDialog::~SvInsertPlugInDialog()
 {
+    dispose();
+}
+
+void SvInsertPlugInDialog::dispose()
+{
     delete m_pURL;
+    InsertObjectDialog_Impl::dispose();
 }
 
 
diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx
index 5f515db..ec2e8b7 100644
--- a/cui/source/dialogs/linkdlg.cxx
+++ b/cui/source/dialogs/linkdlg.cxx
@@ -142,10 +142,6 @@ SvBaseLinksDlg::SvBaseLinksDlg( vcl::Window * pParent, LinkManager* pMgr, bool b
     SetManager( pMgr );
 }
 
-SvBaseLinksDlg::~SvBaseLinksDlg()
-{
-}
-
 /*************************************************************************
 |*    SvBaseLinksDlg::Handler()
 *************************************************************************/
diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx
index 1685afb..b5ea355 100644
--- a/cui/source/dialogs/multipat.cxx
+++ b/cui/source/dialogs/multipat.cxx
@@ -224,6 +224,11 @@ SvxPathSelectDialog::SvxPathSelectDialog(vcl::Window* pParent)
 
 SvxMultiPathDialog::~SvxMultiPathDialog()
 {
+    dispose();
+}
+
+void SvxMultiPathDialog::dispose()
+{
     sal_uInt16 nPos = (sal_uInt16)m_pRadioLB->GetEntryCount();
     while ( nPos-- )
     {
@@ -232,13 +237,20 @@ SvxMultiPathDialog::~SvxMultiPathDialog()
     }
 
     delete m_pRadioLB;
+    ModalDialog::dispose();
 }
 
 SvxPathSelectDialog::~SvxPathSelectDialog()
 {
+    dispose();
+}
+
+void SvxPathSelectDialog::dispose()
+{
     sal_uInt16 nPos = m_pPathLB->GetEntryCount();
     while ( nPos-- )
         delete (OUString*)m_pPathLB->GetEntryData(nPos);
+    ModalDialog::dispose();
 }
 
 OUString SvxMultiPathDialog::GetPath() const
diff --git a/cui/source/dialogs/passwdomdlg.cxx b/cui/source/dialogs/passwdomdlg.cxx
index bca8cd9..683d4e1 100644
--- a/cui/source/dialogs/passwdomdlg.cxx
+++ b/cui/source/dialogs/passwdomdlg.cxx
@@ -153,6 +153,12 @@ PasswordToOpenModifyDialog::PasswordToOpenModifyDialog(
 
 PasswordToOpenModifyDialog::~PasswordToOpenModifyDialog()
 {
+    dispose();
+}
+
+void PasswordToOpenModifyDialog::dispose()
+{
+    SfxModalDialog::dispose();
 }
 
 
diff --git a/cui/source/dialogs/pastedlg.cxx b/cui/source/dialogs/pastedlg.cxx
index 85e49f6..dff2bce 100644
--- a/cui/source/dialogs/pastedlg.cxx
+++ b/cui/source/dialogs/pastedlg.cxx
@@ -79,10 +79,6 @@ IMPL_LINK_INLINE_START( SvPasteObjectDialog, DoubleClickHdl, ListBox *, pListBox
 }
 IMPL_LINK_INLINE_END( SvPasteObjectDialog, DoubleClickHdl, ListBox *, pListBox )
 
-SvPasteObjectDialog::~SvPasteObjectDialog()
-{
-}
-
 /*************************************************************************
 |*    SvPasteObjectDialog::Insert()
 *************************************************************************/
diff --git a/cui/source/dialogs/postdlg.cxx b/cui/source/dialogs/postdlg.cxx
index b740fd9..86d0e58 100644
--- a/cui/source/dialogs/postdlg.cxx
+++ b/cui/source/dialogs/postdlg.cxx
@@ -124,8 +124,14 @@ SvxPostItDialog::SvxPostItDialog(vcl::Window* pParent, const SfxItemSet& rCoreSe
 
 SvxPostItDialog::~SvxPostItDialog()
 {
+    dispose();
+}
+
+void SvxPostItDialog::dispose()
+{
     delete pOutSet;
     pOutSet = 0;
+    SfxModalDialog::dispose();
 }
 
 
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index f740a89..d5c64a1 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -101,7 +101,13 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSFTreeListBox(vcl::Win
 
 SFTreeListBox::~SFTreeListBox()
 {
+    dispose();
+}
+
+void SFTreeListBox::dispose()
+{
     deleteAllTree();
+    SvTreeListBox::dispose();
 }
 
 void SFTreeListBox::delUserData( SvTreeListEntry* pEntry )
@@ -491,8 +497,14 @@ SvxScriptOrgDialog::SvxScriptOrgDialog( vcl::Window* pParent, const OUString& la
 
 SvxScriptOrgDialog::~SvxScriptOrgDialog()
 {
+    dispose();
+}
+
+void SvxScriptOrgDialog::dispose()
+{
     // clear the SelectHdl so that it isn't called during the dtor
     m_pScriptsBox->SetSelectHdl( Link() );
+    SfxModalDialog::dispose();
 };
 
 short SvxScriptOrgDialog::Execute()
diff --git a/cui/source/dialogs/splitcelldlg.cxx b/cui/source/dialogs/splitcelldlg.cxx
index e3b6d18..edce799 100644
--- a/cui/source/dialogs/splitcelldlg.cxx
+++ b/cui/source/dialogs/splitcelldlg.cxx
@@ -53,10 +53,6 @@ SvxSplitTableDlg::SvxSplitTableDlg( vcl::Window *pParent, bool bIsTableVertical,
     }
 }
 
-SvxSplitTableDlg::~SvxSplitTableDlg()
-{
-}
-
 IMPL_LINK( SvxSplitTableDlg, ClickHdl, Button *, pButton )
 {
     const bool bIsVert =  pButton == m_pVertBox ;
diff --git a/cui/source/dialogs/srchxtra.cxx b/cui/source/dialogs/srchxtra.cxx
index 39fbcd2..da6a1e6 100644
--- a/cui/source/dialogs/srchxtra.cxx
+++ b/cui/source/dialogs/srchxtra.cxx
@@ -64,7 +64,13 @@ SvxSearchFormatDialog::SvxSearchFormatDialog(vcl::Window* pParent, const SfxItem
 
 SvxSearchFormatDialog::~SvxSearchFormatDialog()
 {
+    dispose();
+}
+
+void SvxSearchFormatDialog::dispose()
+{
     delete m_pFontList;
+    SfxTabDialog::dispose();
 }
 
 void SvxSearchFormatDialog::PageCreated( sal_uInt16 nId, SfxTabPage& rPage )
diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx
index 79c4d9e..12cfd46 100644
--- a/cui/source/dialogs/thesdlg.cxx
+++ b/cui/source/dialogs/thesdlg.cxx
@@ -76,10 +76,6 @@ void LookUpComboBox::init(SvxThesaurusDialog *pDialog)
     m_pDialog = pDialog;
 }
 
-LookUpComboBox::~LookUpComboBox()
-{
-}
-
 void LookUpComboBox::Modify()
 {
     m_aModifyIdle.Start();
@@ -105,10 +101,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeReplaceEdit(vcl::Windo
     return new ReplaceEdit(pParent);
 }
 
-ReplaceEdit::~ReplaceEdit()
-{
-}
-
 void ReplaceEdit::Modify()
 {
     if (m_pBtn)
@@ -178,7 +170,13 @@ void ThesaurusAlternativesCtrl::init(SvxThesaurusDialog *pDialog)
 
 ThesaurusAlternativesCtrl::~ThesaurusAlternativesCtrl()
 {
+    dispose();
+}
+
+void ThesaurusAlternativesCtrl::dispose()
+{
     ClearExtraData();
+    SvxCheckListBox::dispose();
 }
 
 void ThesaurusAlternativesCtrl::ClearExtraData()
@@ -522,10 +520,6 @@ IMPL_LINK( SvxThesaurusDialog, ReplaceBtnHdl_Impl, Button *, EMPTYARG /*pBtn*/ )
     return 0;
 }
 
-SvxThesaurusDialog::~SvxThesaurusDialog()
-{
-}
-
 void SvxThesaurusDialog::SetWindowTitle( LanguageType nLanguage )
 {
     // adjust language
diff --git a/cui/source/dialogs/zoom.cxx b/cui/source/dialogs/zoom.cxx
index 1c57ad6..21035d4 100644
--- a/cui/source/dialogs/zoom.cxx
+++ b/cui/source/dialogs/zoom.cxx
@@ -288,8 +288,14 @@ SvxZoomDialog::SvxZoomDialog( vcl::Window* pParent, const SfxItemSet& rCoreSet )
 
 SvxZoomDialog::~SvxZoomDialog()
 {
+    dispose();
+}
+
+void SvxZoomDialog::dispose()
+{
     delete pOutSet;
     pOutSet = 0;
+    SfxModalDialog::dispose();
 }
 
 
diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx
index 5bbe67a..657da27 100644
--- a/cui/source/inc/SpellDialog.hxx
+++ b/cui/source/inc/SpellDialog.hxx
@@ -76,7 +76,6 @@ protected:
 
 public:
     SentenceEditWindow_Impl(vcl::Window* pParent, WinBits nBits);
-    virtual ~SentenceEditWindow_Impl();
 
     void            SetModifyHdl(const Link& rLink) SAL_OVERRIDE { m_aModifyLink = rLink;}
 
@@ -220,6 +219,7 @@ public:
         vcl::Window * pParent,
         SfxBindings* pBindings);
     virtual ~SpellDialog();
+    virtual void dispose() SAL_OVERRIDE;
 
     void            SetLanguage( sal_uInt16 nLang );
     virtual bool    Close() SAL_OVERRIDE;
diff --git a/cui/source/inc/acccfg.hxx b/cui/source/inc/acccfg.hxx
index 88d096f..dc156cc 100644
--- a/cui/source/inc/acccfg.hxx
+++ b/cui/source/inc/acccfg.hxx
@@ -172,6 +172,7 @@ private:
 public:
                                 SfxAcceleratorConfigPage( vcl::Window *pParent, const SfxItemSet& rItemSet );
     virtual                     ~SfxAcceleratorConfigPage();
+    virtual void                dispose() SAL_OVERRIDE;
 
     virtual bool                FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
     virtual void                Reset( const SfxItemSet* ) SAL_OVERRIDE;
diff --git a/cui/source/inc/align.hxx b/cui/source/inc/align.hxx
index fb5e07e..fd8c4cc 100644
--- a/cui/source/inc/align.hxx
+++ b/cui/source/inc/align.hxx
@@ -57,6 +57,7 @@ class AlignmentTabPage : public SfxTabPage
 
 public:
     virtual             ~AlignmentTabPage();
+    virtual void        dispose() SAL_OVERRIDE;
 
     static SfxTabPage*  Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
     static const sal_uInt16*  GetRanges();
diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx
index 5fcf733..4ace348 100644
--- a/cui/source/inc/autocdlg.hxx
+++ b/cui/source/inc/autocdlg.hxx
@@ -163,8 +163,9 @@ class OfaSwAutoFmtOptionsPage : public SfxTabPage
         OfaSwAutoFmtOptionsPage( vcl::Window* pParent,
                             const SfxItemSet& rSet );
         virtual ~OfaSwAutoFmtOptionsPage();
+        virtual void dispose() SAL_OVERRIDE;
 
-    public:
+public:
         static SfxTabPage*  Create( vcl::Window* pParent,
                                 const SfxItemSet* rAttrSet);
         virtual bool        FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
@@ -257,6 +258,7 @@ private:
 public:
                         OfaAutocorrReplacePage( vcl::Window* pParent, const SfxItemSet& rSet );
                         virtual ~OfaAutocorrReplacePage();
+    virtual void        dispose() SAL_OVERRIDE;
 
     static SfxTabPage*  Create( vcl::Window* pParent, const SfxItemSet* rAttrSet);
 
@@ -315,6 +317,7 @@ private:
 public:
                         OfaAutocorrExceptPage( vcl::Window* pParent, const SfxItemSet& rSet );
                         virtual ~OfaAutocorrExceptPage();
+    virtual void        dispose() SAL_OVERRIDE;
 
     static SfxTabPage*  Create( vcl::Window* pParent,
                                 const SfxItemSet* rAttrSet);
@@ -381,6 +384,7 @@ private:
                         OfaQuoteTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
 public:
                         virtual ~OfaQuoteTabPage();
+    virtual void        dispose() SAL_OVERRIDE;
 
     static SfxTabPage*  Create( vcl::Window* pParent,
                                 const SfxItemSet* rAttrSet);
@@ -430,8 +434,6 @@ private:
                         OfaAutoCompleteTabPage( vcl::Window* pParent,
                                                 const SfxItemSet& rSet );
 public:
-                        virtual ~OfaAutoCompleteTabPage();
-
     static SfxTabPage*  Create( vcl::Window* pParent,
                                 const SfxItemSet* rAttrSet);
 
@@ -497,8 +499,6 @@ private:
 
 public:
 
-    virtual ~OfaSmartTagOptionsTabPage();
-
     static SfxTabPage*  Create( vcl::Window* pParent, const SfxItemSet* rAttrSet);
 
     virtual bool        FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
diff --git a/cui/source/inc/backgrnd.hxx b/cui/source/inc/backgrnd.hxx
index ab4145f..6c77d14 100644
--- a/cui/source/inc/backgrnd.hxx
+++ b/cui/source/inc/backgrnd.hxx
@@ -69,6 +69,7 @@ protected:
 private:
     SvxBackgroundTabPage( vcl::Window* pParent, const SfxItemSet& rCoreSet );
     virtual ~SvxBackgroundTabPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     VclContainer*           m_pAsGrid;
     FixedText*              m_pSelectTxt;
diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx
index 0a5aea5..a1a22b1 100644
--- a/cui/source/inc/border.hxx
+++ b/cui/source/inc/border.hxx
@@ -59,7 +59,6 @@ protected:
 
 private:
     SvxBorderTabPage( vcl::Window* pParent, const SfxItemSet& rCoreAttrs );
-    virtual ~SvxBorderTabPage();
 
     // Controls
     ValueSet*           m_pWndPresets;
diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx
index 2079666..51908d5 100644
--- a/cui/source/inc/cfg.hxx
+++ b/cui/source/inc/cfg.hxx
@@ -322,7 +322,6 @@ protected:
 
 public:
     SvxMenuEntriesListBox(vcl::Window*, SvxConfigPage*);
-    virtual ~SvxMenuEntriesListBox();
 
     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
 
@@ -483,6 +482,7 @@ private:
 public:
     SvxMenuConfigPage( vcl::Window *pParent, const SfxItemSet& rItemSet );
     virtual ~SvxMenuConfigPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     SaveInData* CreateSaveInData(
         const ::com::sun::star::uno::Reference <
@@ -516,8 +516,6 @@ public:
         vcl::Window*, SvxEntries*,
         SvxConfigEntry*, bool bCreateMenu = false );
 
-    virtual ~SvxMainMenuOrganizerDialog ();
-
     SvxEntries*     GetEntries() { return mpEntries;}
     void            SetEntries( SvxEntries* );
     SvxConfigEntry* GetSelectedEntry();
@@ -544,6 +542,7 @@ public:
 
     SvxToolbarEntriesListBox(vcl::Window* pParent, SvxToolbarConfigPage* pPg);
     virtual ~SvxToolbarEntriesListBox();
+    virtual void dispose() SAL_OVERRIDE;
 
     void            SetChangedListener( const Link& aChangedListener )
         { m_aChangedListener = aChangedListener; }
@@ -584,6 +583,7 @@ private:
 public:
     SvxToolbarConfigPage( vcl::Window *pParent, const SfxItemSet& rItemSet );
     virtual ~SvxToolbarConfigPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     SvTreeListEntry*    AddFunction( SvTreeListEntry* pTarget = NULL,
                                              bool bFront = false,
@@ -741,6 +741,7 @@ public:
             );
 
     virtual ~SvxIconSelectorDialog();
+    virtual void dispose() SAL_OVERRIDE;
 
     ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
         GetSelectedIcon();
diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx
index c2c1242..8deb426 100644
--- a/cui/source/inc/cfgutil.hxx
+++ b/cui/source/inc/cfgutil.hxx
@@ -113,6 +113,7 @@ class SfxConfigFunctionListBox : public SvTreeListBox
 public:
     SfxConfigFunctionListBox(vcl::Window*, WinBits nStyle);
     virtual ~SfxConfigFunctionListBox();
+    virtual void  dispose() SAL_OVERRIDE;
 
     void          ClearAll();
     using Window::GetHelpText;
@@ -165,6 +166,7 @@ protected:
 public:
     SfxConfigGroupListBox(vcl::Window* pParent, WinBits nStyle);
     virtual ~SfxConfigGroupListBox();
+    virtual void        dispose() SAL_OVERRIDE;
     void                ClearAll();
 
     void                Init(const css::uno::Reference< css::uno::XComponentContext >& xContext,
diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx
index 424a976..f43460c 100644
--- a/cui/source/inc/chardlg.hxx
+++ b/cui/source/inc/chardlg.hxx
@@ -53,8 +53,6 @@ protected:
 
     SvxCharBasePage(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const SfxItemSet& rItemset);
 
-    virtual             ~SvxCharBasePage();
-
     void SetPrevFontWidthScale( const SfxItemSet& rSet );
     void SetPrevFontEscapement( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc );
 
@@ -151,6 +149,7 @@ public:
 
 public:
                         virtual ~SvxCharNamePage();
+    virtual void        dispose() SAL_OVERRIDE;
 
     static SfxTabPage*  Create( vcl::Window* pParent, const SfxItemSet* rSet );
     static const sal_uInt16*      GetRanges();
@@ -211,7 +210,6 @@ private:
     OUString            m_aTransparentColorName;
 
                         SvxCharEffectsPage( vcl::Window* pParent, const SfxItemSet& rSet );
-                        virtual ~SvxCharEffectsPage();
 
     void                Initialize();
     void                UpdatePreview_Impl();
@@ -285,7 +283,6 @@ private:
     sal_uInt8                m_nSubProp;
 
                         SvxCharPositionPage( vcl::Window* pParent, const SfxItemSet& rSet );
-                        virtual ~SvxCharPositionPage();
 
     void                Initialize();
     void                UpdatePreview_Impl( sal_uInt8 nProp, sal_uInt8 nEscProp, short nEsc );
@@ -335,7 +332,6 @@ private:
     sal_uInt16              m_nEndBracketPosition;
 
     SvxCharTwoLinesPage(vcl::Window* pParent, const SfxItemSet& rSet);
-    virtual ~SvxCharTwoLinesPage();
 
     void                UpdatePreview_Impl();
     void                Initialize();
diff --git a/cui/source/inc/connect.hxx b/cui/source/inc/connect.hxx
index e66fcd6..0972808d 100644
--- a/cui/source/inc/connect.hxx
+++ b/cui/source/inc/connect.hxx
@@ -61,7 +61,6 @@ private:
 public:
 
     SvxConnectionPage( vcl::Window* pWindow, const SfxItemSet& rInAttrs );
-    virtual ~SvxConnectionPage();
 
     static SfxTabPage*  Create( vcl::Window*, const SfxItemSet* );
     static  const sal_uInt16*     GetRanges();
@@ -81,7 +80,6 @@ class SvxConnectionDialog : public SfxSingleTabDialog
 public:
     SvxConnectionDialog( vcl::Window* pParent, const SfxItemSet& rAttr,
                        const SdrView* pView );
-    virtual ~SvxConnectionDialog();
 };
 
 #endif // INCLUDED_CUI_SOURCE_INC_CONNECT_HXX
diff --git a/cui/source/inc/cuicharmap.hxx b/cui/source/inc/cuicharmap.hxx
index a2e30e5..dfe0d98 100644
--- a/cui/source/inc/cuicharmap.hxx
+++ b/cui/source/inc/cuicharmap.hxx
@@ -41,7 +41,6 @@ class SvxShowText : public Control
 public:
                     SvxShowText( vcl::Window* pParent,
                                  bool bCenter = false );
-                    virtual ~SvxShowText();
 
     void            SetFont( const vcl::Font& rFont );
     void            SetText( const OUString& rText ) SAL_OVERRIDE;
@@ -94,7 +93,6 @@ private:
 
 public:
                     SvxCharacterMap( vcl::Window* pParent, bool bOne=true, const SfxItemSet* pSet=0 );
-                    virtual ~SvxCharacterMap();
 
     void            DisableFontSelection();
 
diff --git a/cui/source/inc/cuifmsearch.hxx b/cui/source/inc/cuifmsearch.hxx
index d163b3d..96dacaf 100644
--- a/cui/source/inc/cuifmsearch.hxx
+++ b/cui/source/inc/cuifmsearch.hxx
@@ -111,6 +111,7 @@ public:
         const Link& lnkContextSupplier);
 
     virtual ~FmSearchDialog();
+    virtual void dispose() SAL_OVERRIDE;
 
     /** The found-handler gets in the 'found'-case a pointer on a FmFoundRecordInformation-structure
         (which is only valid in the handler; so if one needs to memorize the data, don't copy the pointer but
diff --git a/cui/source/inc/cuigaldlg.hxx b/cui/source/inc/cuigaldlg.hxx
index ed98621..e59b096 100644
--- a/cui/source/inc/cuigaldlg.hxx
+++ b/cui/source/inc/cuigaldlg.hxx
@@ -92,7 +92,6 @@ private:
 
 public:
                         SearchProgress( vcl::Window* pParent, const INetURLObject& rStartURL );
-                        virtual ~SearchProgress() {};
 
                         DECL_LINK( CleanUpHdl, void* );
 
@@ -160,7 +159,6 @@ private:
 
 public:
                         ActualizeProgress( vcl::Window* pWindow, GalleryTheme* pThm );
-                        virtual ~ActualizeProgress() {};
 
     virtual short       Execute() SAL_OVERRIDE;
 };
@@ -220,7 +218,6 @@ private:
 public:
 
                         TPGalleryThemeGeneral( vcl::Window* pParent, const SfxItemSet& rSet );
-                        virtual ~TPGalleryThemeGeneral() {}
 
     void                SetXChgData( ExchangeData* pData );
     const ExchangeData* GetXChgData() const { return pData; }
@@ -286,6 +283,7 @@ class TPGalleryThemeProperties : public SfxTabPage
 public:
                         TPGalleryThemeProperties( vcl::Window* pWindow, const SfxItemSet& rSet );
                         virtual ~TPGalleryThemeProperties();
+    virtual void        dispose() SAL_OVERRIDE;
 
     void                SetXChgData( ExchangeData* pData );
     const ExchangeData* GetXChgData() const { return pData; }
diff --git a/cui/source/inc/cuihyperdlg.hxx b/cui/source/inc/cuihyperdlg.hxx
index 8ef2930..93de02f 100644
--- a/cui/source/inc/cuihyperdlg.hxx
+++ b/cui/source/inc/cuihyperdlg.hxx
@@ -80,6 +80,7 @@ protected:
 public:
     SvxHpLinkDlg (vcl::Window* pParent, SfxBindings* pBindings );
     virtual ~SvxHpLinkDlg ();
+    virtual void dispose() SAL_OVERRIDE;
 
     virtual void            PageCreated( sal_uInt16 nId, IconChoicePage& rPage ) SAL_OVERRIDE;
 
diff --git a/cui/source/inc/cuioptgenrl.hxx b/cui/source/inc/cuioptgenrl.hxx
index 86190a8..fef0ea3 100644
--- a/cui/source/inc/cuioptgenrl.hxx
+++ b/cui/source/inc/cuioptgenrl.hxx
@@ -65,7 +65,6 @@ protected:
 
 public:
     SvxGeneralTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
-    virtual ~SvxGeneralTabPage ();
 
     static SfxTabPage*  Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
 
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index 09ff336..b170c7e 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -76,7 +76,6 @@ protected:
 
 public:
     SvxAreaTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, bool bShadow );
-    virtual ~SvxAreaTabDialog();
 
     void                SetNewColorList( XColorListRef pColTab )
                             { mpNewColorList = pColTab; }
@@ -596,6 +595,7 @@ private:
 public:
     SvxBitmapTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs  );
     virtual ~SvxBitmapTabPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     void    Construct();
 
@@ -730,6 +730,7 @@ private:
 public:
     SvxColorTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
     virtual ~SvxColorTabPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     void    Construct();
 
diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx
index bc4fffc..46eb09c 100644
--- a/cui/source/inc/cuitabline.hxx
+++ b/cui/source/inc/cuitabline.hxx
@@ -64,7 +64,6 @@ public:
     SvxLineTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr,
                       SdrModel* pModel, const SdrObject* pObj = NULL,
                       bool bHasObj = true );
-    virtual ~SvxLineTabDialog();
 
     void                SetNewDashList( XDashListRef pInLst)
                         { pNewDashList = pInLst; }
@@ -204,6 +203,7 @@ public:
 
     SvxLineTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
     virtual ~SvxLineTabPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     void    Construct();
 
@@ -371,7 +371,6 @@ private:
 
 public:
     SvxLineEndDefTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
-    virtual ~SvxLineEndDefTabPage();
 
     void    Construct();
 
diff --git a/cui/source/inc/dbregister.hxx b/cui/source/inc/dbregister.hxx
index f35f2ad..a665aab 100644
--- a/cui/source/inc/dbregister.hxx
+++ b/cui/source/inc/dbregister.hxx
@@ -91,6 +91,7 @@ namespace svx
     public:
         DbRegistrationOptionsPage( vcl::Window* pParent, const SfxItemSet& rSet );
         virtual ~DbRegistrationOptionsPage();
+        virtual void dispose() SAL_OVERRIDE;
 
         static SfxTabPage*  Create( vcl::Window* pParent, const SfxItemSet* rSet );
         static const sal_uInt16*      GetRanges();
@@ -129,7 +130,6 @@ namespace svx
     {
     public:
         DatabaseRegistrationDialog( vcl::Window* pParent, const SfxItemSet& rAttr );
-        virtual ~DatabaseRegistrationDialog();
 
         virtual short   Execute() SAL_OVERRIDE;
     };
diff --git a/cui/source/inc/dlgname.hxx b/cui/source/inc/dlgname.hxx
index e6d9ea2..46c9714 100644
--- a/cui/source/inc/dlgname.hxx
+++ b/cui/source/inc/dlgname.hxx
@@ -140,6 +140,7 @@ private:
 public:
     SvxMessDialog( vcl::Window* pWindow, const OUString& rText, const OUString& rDesc, Image* pImg = NULL );
     virtual ~SvxMessDialog();
+    virtual void dispose() SAL_OVERRIDE;
 
     void    SetButtonText( sal_uInt16 nBtnId, const OUString& rNewTxt );
 };
diff --git a/cui/source/inc/grfpage.hxx b/cui/source/inc/grfpage.hxx
index 8d7392a..39cd21b 100644
--- a/cui/source/inc/grfpage.hxx
+++ b/cui/source/inc/grfpage.hxx
@@ -95,6 +95,7 @@ class SvxGrfCropPage : public SfxTabPage
 
     SvxGrfCropPage( vcl::Window *pParent, const SfxItemSet &rSet );
     virtual ~SvxGrfCropPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     DECL_LINK( ZoomHdl, MetricField * );
     DECL_LINK( SizeHdl, MetricField * );
diff --git a/cui/source/inc/hangulhanjadlg.hxx b/cui/source/inc/hangulhanjadlg.hxx
index 4cea2af..2cfd24d 100644
--- a/cui/source/inc/hangulhanjadlg.hxx
+++ b/cui/source/inc/hangulhanjadlg.hxx
@@ -43,6 +43,7 @@ namespace svx
     public:
         SuggestionSet( vcl::Window* pParent );
         virtual ~SuggestionSet();
+        virtual void dispose() SAL_OVERRIDE;
 
         virtual void    UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE;
         void            ClearSet();
@@ -53,6 +54,7 @@ namespace svx
     public:
         SuggestionDisplay( vcl::Window* pParent, WinBits nBits );
         virtual ~SuggestionDisplay();
+        virtual void dispose() SAL_OVERRIDE;
 
         void DisplayListBox( bool bDisplayListBox );
 
@@ -87,8 +89,8 @@ namespace svx
 
     private:
         bool          m_bDisplayListBox;//otherwise ValueSet
-        SuggestionSet m_aValueSet;
-        ListBox       m_aListBox;
+        VclPtr<SuggestionSet> m_aValueSet;
+        VclPtr<ListBox>  m_aListBox;
 
         Link          m_aSelectLink;
         bool          m_bInSelectionUpdate;
@@ -136,7 +138,6 @@ namespace svx
         HangulHanjaConversionDialog(
                 vcl::Window* _pParent,
                 editeng::HangulHanjaConversion::ConversionDirection _ePrimaryDirection );
-        virtual ~HangulHanjaConversionDialog( );
 
     public:
         void    SetOptionsChangedHdl( const Link& _rHdl );
@@ -222,6 +223,7 @@ namespace svx
     public:
                             HangulHanjaOptionsDialog( vcl::Window* _pParent );
         virtual             ~HangulHanjaOptionsDialog();
+        virtual void        dispose() SAL_OVERRIDE;
 
         void                AddDict( const OUString& _rName, bool _bChecked );
     };
@@ -257,7 +259,6 @@ namespace svx
         void                DoJump( bool _bUp );
     public:
                             SuggestionEdit( vcl::Window* pParent, WinBits nBits );
-        virtual             ~SuggestionEdit();
         virtual bool        PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
         void init( ScrollBar* pScrollBar, SuggestionEdit* pPrev, SuggestionEdit* pNext);
     };
@@ -312,6 +313,7 @@ namespace svx
     public:
                         HangulHanjaEditDictDialog( vcl::Window* _pParent, HHDictList& _rDictList, sal_uInt32 _nSelDict );
                         virtual ~HangulHanjaEditDictDialog();
+        virtual void    dispose() SAL_OVERRIDE;
 
         void            UpdateScrollbar( void );
     };
diff --git a/cui/source/inc/headertablistbox.hxx b/cui/source/inc/headertablistbox.hxx
index f536a1d..5a4bfed 100644
--- a/cui/source/inc/headertablistbox.hxx
+++ b/cui/source/inc/headertablistbox.hxx
@@ -27,25 +27,27 @@
 class MacroEventListBox : public Control
 {
 private:
-    HeaderBar                   maHeaderBar;
-    SvHeaderTabListBox          maListBox;
+    VclPtr<HeaderBar>               maHeaderBar;
+    VclPtr<SvHeaderTabListBox>      maListBox;
 protected:
     DECL_LINK( HeaderEndDrag_Impl, HeaderBar* );
     virtual bool                Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
 public:
     MacroEventListBox( vcl::Window* pParent, WinBits nStyle );
+    virtual ~MacroEventListBox();
+    virtual void dispose() SAL_OVERRIDE;
 
     virtual void Resize() SAL_OVERRIDE;
     virtual Size GetOptimalSize() const SAL_OVERRIDE;
 
     SvHeaderTabListBox& GetListBox()
     {
-        return maListBox;
+        return *maListBox.get();
     }
 
     HeaderBar& GetHeaderBar()
     {
-        return maHeaderBar;
+        return *maHeaderBar.get();
     }
 
     void                        ConnectElements( void );/**< should be called after all manipulations on elements are done
diff --git a/cui/source/inc/hldocntp.hxx b/cui/source/inc/hldocntp.hxx
index 98731d7..186ce6a 100644
--- a/cui/source/inc/hldocntp.hxx
+++ b/cui/source/inc/hldocntp.hxx
@@ -52,6 +52,7 @@ protected:
 public:
     SvxHyperlinkNewDocTp ( vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet);
     virtual ~SvxHyperlinkNewDocTp ();
+    virtual void dispose() SAL_OVERRIDE;
 
     static  IconChoicePage* Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet );
 
diff --git a/cui/source/inc/hldoctp.hxx b/cui/source/inc/hldoctp.hxx
index 1b7e352..108df07 100644
--- a/cui/source/inc/hldoctp.hxx
+++ b/cui/source/inc/hldoctp.hxx
@@ -67,7 +67,6 @@ protected:
 
 public:
     SvxHyperlinkDocTp ( vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet);
-    virtual ~SvxHyperlinkDocTp ();
 
     static  IconChoicePage* Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet );
 
diff --git a/cui/source/inc/hlinettp.hxx b/cui/source/inc/hlinettp.hxx
index e11b744..bc76625 100644
--- a/cui/source/inc/hlinettp.hxx
+++ b/cui/source/inc/hlinettp.hxx
@@ -78,7 +78,6 @@ protected:
 
 public:
     SvxHyperlinkInternetTp ( vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet);
-    virtual ~SvxHyperlinkInternetTp ();
 
     static  IconChoicePage* Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet );
 
diff --git a/cui/source/inc/hlmailtp.hxx b/cui/source/inc/hlmailtp.hxx
index 44aacc7..edec6a0 100644
--- a/cui/source/inc/hlmailtp.hxx
+++ b/cui/source/inc/hlmailtp.hxx
@@ -56,7 +56,6 @@ protected:
 
 public:
     SvxHyperlinkMailTp ( vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet);
-    virtual ~SvxHyperlinkMailTp ();
 
     static  IconChoicePage* Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet& rItemSet );
 
diff --git a/cui/source/inc/hlmarkwn.hxx b/cui/source/inc/hlmarkwn.hxx
index 2108beb..e9d8c32 100644
--- a/cui/source/inc/hlmarkwn.hxx
+++ b/cui/source/inc/hlmarkwn.hxx
@@ -90,6 +90,7 @@ protected:
 public:
     SvxHlinkDlgMarkWnd (SvxHyperlinkTabPageBase *pParent);
     virtual ~SvxHlinkDlgMarkWnd();
+    virtual void dispose() SAL_OVERRIDE;
 
     bool MoveTo ( Point aNewPos );
     void RefreshTree(const OUString& aStrURL);
diff --git a/cui/source/inc/hltpbase.hxx b/cui/source/inc/hltpbase.hxx
index d2c229d..583dd45 100644
--- a/cui/source/inc/hltpbase.hxx
+++ b/cui/source/inc/hltpbase.hxx
@@ -118,6 +118,7 @@ public:
         const SfxItemSet& rItemSet
     );
     virtual ~SvxHyperlinkTabPageBase ();
+    virtual void dispose() SAL_OVERRIDE;
 
     void    SetDocumentFrame(
         const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame )
diff --git a/cui/source/inc/hyphen.hxx b/cui/source/inc/hyphen.hxx
index 4d0b7ba..1682101 100644
--- a/cui/source/inc/hyphen.hxx
+++ b/cui/source/inc/hyphen.hxx
@@ -85,7 +85,6 @@ public:
                          vcl::Window* pParent,
                          css::uno::Reference< css::linguistic2::XHyphenator >  &xHyphen,
                          SvxSpellWrapper* pWrapper );
-    virtual ~SvxHyphenWordDialog();
 
     void            SetWindowTitle( LanguageType nLang );
     void            SelLeft();
diff --git a/cui/source/inc/iconcdlg.hxx b/cui/source/inc/iconcdlg.hxx
index 566d4e1..aab6eb2 100644
--- a/cui/source/inc/iconcdlg.hxx
+++ b/cui/source/inc/iconcdlg.hxx
@@ -90,7 +90,6 @@ protected :
     sal_uInt16              GetWhich( sal_uInt16 nSlot ) const  { return pSet->GetPool()->GetWhich( nSlot ); }
 
 public :
-    virtual             ~IconChoicePage();
 
     const SfxItemSet&   GetItemSet() const { return *pSet; }
 
@@ -185,6 +184,7 @@ public :
     IconChoiceDialog ( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription,
                        const SfxItemSet * pItemSet = 0 );
     virtual ~IconChoiceDialog ();
+    virtual void dispose() SAL_OVERRIDE;
 
     // interface
     SvxIconChoiceCtrlEntry* AddTabPage(
diff --git a/cui/source/inc/insdlg.hxx b/cui/source/inc/insdlg.hxx
index 5307a25..a2d90ad 100644
--- a/cui/source/inc/insdlg.hxx
+++ b/cui/source/inc/insdlg.hxx
@@ -109,6 +109,7 @@ public:
     SvInsertPlugInDialog(vcl::Window* pParent,
         const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage);
     virtual ~SvInsertPlugInDialog();
+    virtual void dispose() SAL_OVERRIDE;
     virtual short Execute() SAL_OVERRIDE;
 };
 
diff --git a/cui/source/inc/linkdlg.hxx b/cui/source/inc/linkdlg.hxx
index 64e9b87..c6c9cf2 100644
--- a/cui/source/inc/linkdlg.hxx
+++ b/cui/source/inc/linkdlg.hxx
@@ -92,7 +92,6 @@ class SvBaseLinksDlg : public ModalDialog
 
 public:
     SvBaseLinksDlg( vcl::Window * pParent, sfx2::LinkManager*, bool bHtml = false );
-    virtual ~SvBaseLinksDlg();
     void SetActLink( sfx2::SvBaseLink * pLink );
 };
 
diff --git a/cui/source/inc/macroass.hxx b/cui/source/inc/macroass.hxx
index bdcd93c..3d703f9 100644
--- a/cui/source/inc/macroass.hxx
+++ b/cui/source/inc/macroass.hxx
@@ -57,6 +57,7 @@ protected:
 public:
 
     virtual                     ~_SfxMacroTabPage();
+    virtual void                dispose() SAL_OVERRIDE;
 
     void                        AddEvent( const OUString & rEventName, sal_uInt16 nEventId );
 
diff --git a/cui/source/inc/macropg.hxx b/cui/source/inc/macropg.hxx
index f151c36..ff00dc5 100644
--- a/cui/source/inc/macropg.hxx
+++ b/cui/source/inc/macropg.hxx
@@ -81,6 +81,7 @@ protected:
 public:
 
     virtual                     ~_SvxMacroTabPage();
+    virtual void                dispose() SAL_OVERRIDE;
     void                        InitResources();
 
     void                        InitAndSetHandler( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > xAppEvents, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > xDocEvents, ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifiable > xModifiable );
diff --git a/cui/source/inc/measure.hxx b/cui/source/inc/measure.hxx
index a42ea5e..9f965cd 100644
--- a/cui/source/inc/measure.hxx
+++ b/cui/source/inc/measure.hxx
@@ -65,7 +65,6 @@ private:
 public:
 
     SvxMeasurePage( vcl::Window* pWindow, const SfxItemSet& rInAttrs );
-    virtual ~SvxMeasurePage();
 
     static SfxTabPage*  Create( vcl::Window*, const SfxItemSet* );
     static  const sal_uInt16*     GetRanges();
diff --git a/cui/source/inc/multipat.hxx b/cui/source/inc/multipat.hxx
index 0508ff4..685bbc3 100644
--- a/cui/source/inc/multipat.hxx
+++ b/cui/source/inc/multipat.hxx
@@ -51,6 +51,7 @@ private:
 public:
     SvxMultiPathDialog(vcl::Window* pParent);
     virtual ~SvxMultiPathDialog();
+    virtual void    dispose() SAL_OVERRIDE;
 
     OUString        GetPath() const;
     void            SetPath( const OUString& rPath );
@@ -70,6 +71,7 @@ private:
 public:
     SvxPathSelectDialog(vcl::Window* pParent);
     virtual ~SvxPathSelectDialog();
+    virtual void    dispose() SAL_OVERRIDE;
 
     OUString        GetPath() const;
     void            SetPath( const OUString& rPath );
diff --git a/cui/source/inc/numfmt.hxx b/cui/source/inc/numfmt.hxx
index 0bbec43..b12aaca 100644
--- a/cui/source/inc/numfmt.hxx
+++ b/cui/source/inc/numfmt.hxx
@@ -69,6 +69,7 @@ class SvxNumberFormatTabPage : public SfxTabPage
 
 public:
     virtual ~SvxNumberFormatTabPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     static SfxTabPage*      Create( vcl::Window* pParent,
                                     const SfxItemSet* rAttrSet );
diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx
index 8398776..9f9cca7 100644
--- a/cui/source/inc/numpages.hxx
+++ b/cui/source/inc/numpages.hxx
@@ -101,14 +101,15 @@ class SvxSingleNumPickTabPage : public SfxTabPage
     OUString              sNumCharFmtName;
     sal_uInt16              nNumItemId;
 
-    protected:
+protected:
         DECL_LINK(NumSelectHdl_Impl, void *);
         DECL_LINK(DoubleClickHdl_Impl, void *);
 
-    public:
+public:
         SvxSingleNumPickTabPage(vcl::Window* pParent,
                                const SfxItemSet& rSet);
-        virtual ~SvxSingleNumPickTabPage();
+    virtual ~SvxSingleNumPickTabPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     static SfxTabPage*  Create( vcl::Window* pParent,
                                 const SfxItemSet* rAttrSet);
@@ -138,13 +139,14 @@ class SvxBulletPickTabPage : public SfxTabPage
     sal_uInt16              nNumItemId;
 
     OUString            sBulletCharFmtName;
-    protected:
+protected:
         DECL_LINK(NumSelectHdl_Impl, void *);
         DECL_LINK(DoubleClickHdl_Impl, void *);
-    public:
+public:
         SvxBulletPickTabPage(vcl::Window* pParent,
                                const SfxItemSet& rSet);
-        virtual ~SvxBulletPickTabPage();
+    virtual ~SvxBulletPickTabPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     static SfxTabPage*  Create( vcl::Window* pParent,
                                 const SfxItemSet* rAttrSet);
@@ -180,14 +182,15 @@ class SvxNumPickTabPage : public SfxTabPage
     bool                bPreset     : 1;
 
 
-    protected:
+protected:
         DECL_LINK(NumSelectHdl_Impl, void *);
         DECL_LINK(DoubleClickHdl_Impl, void *);
 
-    public:
-        SvxNumPickTabPage(vcl::Window* pParent,
+public:
+    SvxNumPickTabPage(vcl::Window* pParent,
                                const SfxItemSet& rSet);
-        virtual ~SvxNumPickTabPage();
+    virtual ~SvxNumPickTabPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     static SfxTabPage*  Create( vcl::Window* pParent,
                                 const SfxItemSet* rAttrSet);
@@ -224,15 +227,16 @@ class SvxBitmapPickTabPage : public SfxTabPage
     bool                bModified   : 1;
     bool                bPreset     : 1;
 
-    protected:
+protected:
         DECL_LINK(NumSelectHdl_Impl, void *);
         DECL_LINK(DoubleClickHdl_Impl, void *);
         DECL_LINK(LinkBmpHdl_Impl, void *);
 
-    public:
+public:
         SvxBitmapPickTabPage(vcl::Window* pParent,
                                const SfxItemSet& rSet);
         virtual ~SvxBitmapPickTabPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     static SfxTabPage*  Create( vcl::Window* pParent,
                                 const SfxItemSet* rAttrSet);
@@ -341,10 +345,11 @@ class SvxNumOptionsTabPage : public SfxTabPage
 
         DECL_STATIC_LINK( SvxNumOptionsTabPage, GraphicArrivedHdl_Impl, SvxBrushItem* );
 
-    public:
+public:
         SvxNumOptionsTabPage(vcl::Window* pParent,
                                const SfxItemSet& rSet);
         virtual ~SvxNumOptionsTabPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     static SfxTabPage*  Create( vcl::Window* pParent,
                                 const SfxItemSet* rAttrSet);
@@ -448,6 +453,7 @@ public:
         SvxNumPositionTabPage(vcl::Window* pParent,
                                const SfxItemSet& rSet);
         virtual ~SvxNumPositionTabPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     virtual void        ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
     virtual int         DeactivatePage(SfxItemSet *pSet) SAL_OVERRIDE;
diff --git a/cui/source/inc/optasian.hxx b/cui/source/inc/optasian.hxx
index d2d1824..5dc1978 100644
--- a/cui/source/inc/optasian.hxx
+++ b/cui/source/inc/optasian.hxx
@@ -56,6 +56,7 @@ class SvxAsianLayoutPage : public SfxTabPage
 public:
 
     virtual ~SvxAsianLayoutPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     static SfxTabPage*  Create( vcl::Window* pParent, const SfxItemSet* rAttrSet );
     static const sal_uInt16*  GetRanges();
diff --git a/cui/source/inc/optdict.hxx b/cui/source/inc/optdict.hxx
index e26a4b3..9ed48ed 100644
--- a/cui/source/inc/optdict.hxx
+++ b/cui/source/inc/optdict.hxx
@@ -152,7 +152,6 @@ public:
             const OUString& rName,
             ::com::sun::star::uno::Reference<
                 ::com::sun::star::linguistic2::XSpellChecker1> &xSpl );
-    virtual ~SvxEditDictionaryDialog();
 
     sal_uInt16 GetSelectedDict() {return pAllDictsLB->GetSelectEntryPos();}
 };
diff --git a/cui/source/inc/optlingu.hxx b/cui/source/inc/optlingu.hxx
index 2856fec..4966377 100644
--- a/cui/source/inc/optlingu.hxx
+++ b/cui/source/inc/optlingu.hxx
@@ -86,6 +86,7 @@ class SvxEditModulesDlg : public ModalDialog
 public:
     SvxEditModulesDlg(vcl::Window* pParent, SvxLinguData_Impl& rData);
     virtual ~SvxEditModulesDlg();
+    virtual void dispose() SAL_OVERRIDE;
 };
 
 // class SvxLinguTabPage -------------------------------------------------
@@ -147,6 +148,7 @@ private:
 
 public:
     virtual             ~SvxLinguTabPage();
+    virtual void        dispose() SAL_OVERRIDE;
     static SfxTabPage*  Create( vcl::Window* pParent, const SfxItemSet* rSet );
     static const sal_uInt16*  GetRanges();
 
diff --git a/cui/source/inc/optpath.hxx b/cui/source/inc/optpath.hxx
index 8db6529..89cf485 100644
--- a/cui/source/inc/optpath.hxx
+++ b/cui/source/inc/optpath.hxx
@@ -71,6 +71,7 @@ private:
 public:
     SvxPathTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
     virtual ~SvxPathTabPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     static SfxTabPage*  Create( vcl::Window* pParent, const SfxItemSet* rSet );
     static const sal_uInt16*      GetRanges();
diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx
index 2009188..06a4764 100644
--- a/cui/source/inc/page.hxx
+++ b/cui/source/inc/page.hxx
@@ -195,6 +195,7 @@ public:
     virtual void        FillUserData() SAL_OVERRIDE;
 
     virtual ~SvxPageDescPage();
+    virtual void        dispose() SAL_OVERRIDE;
 
     void                SetMode( SvxModeType eMType ) { eMode = eMType; }
     void                SetPaperFormatRanges( Paper eStart, Paper eEnd )
diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx
index 4209e04..429fda7 100644
--- a/cui/source/inc/paragrph.hxx
+++ b/cui/source/inc/paragrph.hxx
@@ -114,8 +114,6 @@ public:
     void                    EnableAbsLineDist(long nMinTwip);
     void                    EnableNegativeMode();
     virtual void            PageCreated(const SfxAllItemSet& aSet) SAL_OVERRIDE;
-
-    virtual                ~SvxStdParagraphTabPage();
 };
 
 // class SvxParaAlignTabPage ------------------------------------------------
@@ -154,7 +152,6 @@ class SvxParaAlignTabPage : public SfxTabPage
     void                    UpdateExample_Impl( bool bAll = false );
 
                             SvxParaAlignTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
-    virtual                 ~SvxParaAlignTabPage();
 
 protected:
     virtual int             DeactivatePage( SfxItemSet* pSet = 0 ) SAL_OVERRIDE;
@@ -189,8 +186,6 @@ class SvxExtParagraphTabPage: public SfxTabPage
     using TabPage::DeactivatePage;
 
 public:
-    virtual             ~SvxExtParagraphTabPage();
-
     static SfxTabPage*  Create( vcl::Window* pParent,
                                 const SfxItemSet* rSet );
     static const sal_uInt16*      GetRanges();
@@ -268,9 +263,6 @@ class SvxAsianTabPage : public SfxTabPage
     DECL_LINK( ClickHdl_Impl, CheckBox* );
 
 public:
-    virtual ~SvxAsianTabPage();
-
-
     static SfxTabPage*  Create( vcl::Window* pParent,
                                 const SfxItemSet* rSet );
     static const sal_uInt16*      GetRanges();
diff --git a/cui/source/inc/passwdomdlg.hxx b/cui/source/inc/passwdomdlg.hxx
index 179d99b..72e7f77 100644
--- a/cui/source/inc/passwdomdlg.hxx
+++ b/cui/source/inc/passwdomdlg.hxx
@@ -41,6 +41,7 @@ public:
             sal_uInt16 nMaxPasswdLen /* 0 -> no max len enforced */,
             bool bIsPasswordToModify );
     virtual ~PasswordToOpenModifyDialog();
+    virtual void dispose() SAL_OVERRIDE;
 
     // AbstractPasswordToOpenModifyDialog
     virtual OUString  GetPasswordToOpen() const;
diff --git a/cui/source/inc/pastedlg.hxx b/cui/source/inc/pastedlg.hxx
index c7b815f..edbed1a 100644
--- a/cui/source/inc/pastedlg.hxx
+++ b/cui/source/inc/pastedlg.hxx
@@ -55,7 +55,6 @@ class SvPasteObjectDialog : public ModalDialog
 
 public:
                 SvPasteObjectDialog( vcl::Window* pParent );
-                virtual ~SvPasteObjectDialog();
 
     void        Insert( SotFormatStringId nFormat, const OUString & rFormatName );
     void        SetObjName( const SvGlobalName & rClass, const OUString & rObjName );
diff --git a/cui/source/inc/postdlg.hxx b/cui/source/inc/postdlg.hxx
index 6246496..fa31243 100644
--- a/cui/source/inc/postdlg.hxx
+++ b/cui/source/inc/postdlg.hxx
@@ -46,6 +46,7 @@ public:
     SvxPostItDialog(vcl::Window* pParent, const SfxItemSet& rCoreSet,
                      bool bPrevNext = false);
     virtual ~SvxPostItDialog();
+    virtual void dispose() SAL_OVERRIDE;
 
     static const sal_uInt16*      GetRanges();
     const SfxItemSet*   GetOutputItemSet() const { return pOutSet; }
diff --git a/cui/source/inc/radiobtnbox.hxx b/cui/source/inc/radiobtnbox.hxx
index 1688bcd..7c31f34 100644
--- a/cui/source/inc/radiobtnbox.hxx
+++ b/cui/source/inc/radiobtnbox.hxx
@@ -39,7 +39,6 @@ protected:
 
 public:
     SvxRadioButtonListBox(SvSimpleTableContainer& rParent, WinBits nBits);
-    virtual ~SvxRadioButtonListBox();
 
     void                HandleEntryChecked( SvTreeListEntry* _pEntry );
 
diff --git a/cui/source/inc/scriptdlg.hxx b/cui/source/inc/scriptdlg.hxx
index a3d3f0d..ca006ee 100644
--- a/cui/source/inc/scriptdlg.hxx
+++ b/cui/source/inc/scriptdlg.hxx
@@ -77,6 +77,7 @@ public:
                               ::com::sun::star::uno::Reference< com::sun::star::frame::XModel>& model  );
                     SFTreeListBox(vcl::Window* pParent);
                     virtual ~SFTreeListBox();
+    virtual void    dispose() SAL_OVERRIDE;
 
     void            ExpandAllTrees();
 
@@ -179,6 +180,7 @@ public:
                     // to specify the language or provider
                     SvxScriptOrgDialog( vcl::Window* pParent, const OUString& language );
                     virtual ~SvxScriptOrgDialog();
+    virtual void    dispose() SAL_OVERRIDE;
 
     virtual short   Execute() SAL_OVERRIDE;
 
diff --git a/cui/source/inc/selector.hxx b/cui/source/inc/selector.hxx
index b22b85e..de029f8 100644
--- a/cui/source/inc/selector.hxx
+++ b/cui/source/inc/selector.hxx
@@ -102,6 +102,7 @@ friend class SvxConfigGroupListBox;
 public:
     SvxConfigFunctionListBox(vcl::Window* pParent, WinBits nStyle);
     virtual ~SvxConfigFunctionListBox();
+    virtual void                    dispose() SAL_OVERRIDE;
     void                            ClearAll();
     OUString                        GetHelpText( SvTreeListEntry *pEntry );
     using Window::GetHelpText;
@@ -162,6 +163,7 @@ protected:
 public:
     SvxConfigGroupListBox(vcl::Window* pParent, WinBits nStyle);
     virtual ~SvxConfigGroupListBox();
+    virtual void dispose() SAL_OVERRIDE;
 
     void    Init(bool bShowSlots, const ::com::sun::star::uno::Reference
                     < ::com::sun::star::frame::XFrame >& xFrame);
@@ -204,8 +206,6 @@ public:
             < ::com::sun::star::frame::XFrame >& xFrame = 0
     );
 
-    virtual ~SvxScriptSelectorDialog ( );
-
     void        SetAddHdl( const Link& rLink ) { m_aAddHdl = rLink; }
     const Link& GetAddHdl() const { return m_aAddHdl; }
 
diff --git a/cui/source/inc/splitcelldlg.hxx b/cui/source/inc/splitcelldlg.hxx
index 212559f..bc5fc70 100644
--- a/cui/source/inc/splitcelldlg.hxx
+++ b/cui/source/inc/splitcelldlg.hxx
@@ -40,7 +40,6 @@ protected:
 
 public:
     SvxSplitTableDlg(vcl::Window *pParent, bool bIsTableVertical, long nMaxVertical, long nMaxHorizontal );
-    virtual ~SvxSplitTableDlg();
 
     DECL_LINK( ClickHdl, Button * );
 
diff --git a/cui/source/inc/srchxtra.hxx b/cui/source/inc/srchxtra.hxx
index 0965484..705c4d2 100644
--- a/cui/source/inc/srchxtra.hxx
+++ b/cui/source/inc/srchxtra.hxx
@@ -31,6 +31,7 @@ class SvxSearchFormatDialog : public SfxTabDialog
 public:
     SvxSearchFormatDialog( vcl::Window* pParent, const SfxItemSet& rSet );
     virtual ~SvxSearchFormatDialog();
+    virtual void dispose() SAL_OVERRIDE;
 
 protected:
     virtual void    PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) SAL_OVERRIDE;
diff --git a/cui/source/inc/swpossizetabpage.hxx b/cui/source/inc/swpossizetabpage.hxx
index 94f34aa..3c3d3e6 100644
--- a/cui/source/inc/swpossizetabpage.hxx
+++ b/cui/source/inc/swpossizetabpage.hxx
@@ -123,7 +123,6 @@ class SvxSwPosSizeTabPage : public SfxTabPage
 
 public:
     SvxSwPosSizeTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs  );
-    virtual ~SvxSwPosSizeTabPage();
 
     static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
     static const sal_uInt16*     GetRanges();
diff --git a/cui/source/inc/tabstpge.hxx b/cui/source/inc/tabstpge.hxx
index c5bf547..9da9284 100644
--- a/cui/source/inc/tabstpge.hxx
+++ b/cui/source/inc/tabstpge.hxx
@@ -48,8 +48,6 @@ class SvxTabulatorTabPage : public SfxTabPage
     using TabPage::DeactivatePage;
 
 public:
-    virtual ~SvxTabulatorTabPage();
-
     static SfxTabPage*  Create( vcl::Window* pParent, const SfxItemSet* rSet );
     static const sal_uInt16*      GetRanges();
 
diff --git a/cui/source/inc/textanim.hxx b/cui/source/inc/textanim.hxx
index 2981c4a..f2433ec 100644
--- a/cui/source/inc/textanim.hxx
+++ b/cui/source/inc/textanim.hxx
@@ -74,7 +74,6 @@ private:
 
 public:
     SvxTextAnimationPage( vcl::Window* pWindow, const SfxItemSet& rInAttrs );
-    virtual ~SvxTextAnimationPage();
 
     static SfxTabPage*  Create( vcl::Window*, const SfxItemSet* );
     static  const sal_uInt16*     GetRanges();
@@ -103,7 +102,6 @@ public:
 
             SvxTextTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr,
                                 const SdrView* pView );
-            virtual ~SvxTextTabDialog() {};
 };
 
 
diff --git a/cui/source/inc/textattr.hxx b/cui/source/inc/textattr.hxx
index 4f67dbf..e615324 100644
--- a/cui/source/inc/textattr.hxx
+++ b/cui/source/inc/textattr.hxx
@@ -75,7 +75,6 @@ private:
 public:
 
     SvxTextAttrPage( vcl::Window* pWindow, const SfxItemSet& rInAttrs );
-    virtual ~SvxTextAttrPage();
 
     static SfxTabPage*  Create( vcl::Window*, const SfxItemSet* );
     static  const sal_uInt16*     GetRanges();
diff --git a/cui/source/inc/thesdlg.hxx b/cui/source/inc/thesdlg.hxx
index 729fb8f..a2b852c 100644
--- a/cui/source/inc/thesdlg.hxx
+++ b/cui/source/inc/thesdlg.hxx
@@ -43,7 +43,6 @@ class LookUpComboBox : public ComboBox
 
 public:
     LookUpComboBox(vcl::Window *pParent);
-    virtual ~LookUpComboBox();
 
     DECL_LINK( ModifyTimer_Hdl, Timer * );
 
@@ -87,7 +86,7 @@ public:
 
     void init(SvxThesaurusDialog *pDialog);
     virtual ~ThesaurusAlternativesCtrl();
-
+    virtual void dispose() SAL_OVERRIDE;
 
     SvTreeListEntry *   AddEntry( sal_Int32 nVal, const OUString &rText, bool bIsHeader );
 
@@ -109,7 +108,6 @@ class ReplaceEdit : public Edit
 
 public:
     ReplaceEdit(vcl::Window *pParent);
-    virtual ~ReplaceEdit();
 
     void init(Button *pBtn)  { m_pBtn = pBtn; }
 
@@ -162,7 +160,6 @@ public:
     SvxThesaurusDialog( vcl::Window* pParent,
                         css::uno::Reference< css::linguistic2::XThesaurus >  xThesaurus,
                         const OUString &rWord, LanguageType nLanguage );
-    virtual ~SvxThesaurusDialog();
 
     void            SetWindowTitle( LanguageType nLanguage );
     OUString        GetWord();
diff --git a/cui/source/inc/transfrm.hxx b/cui/source/inc/transfrm.hxx
index f4f6925..98b2945 100644
--- a/cui/source/inc/transfrm.hxx
+++ b/cui/source/inc/transfrm.hxx
@@ -62,7 +62,6 @@ public:
             SvxTransformTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr,
                             const SdrView* pView,
                             sal_uInt16 nAnchorTypes = 0);
-            virtual ~SvxTransformTabDialog();
 
             //link for the Writer to validate positions
             void SetValidateFramePosLink( const Link& rLink );
diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx
index b6d70f4..e006029 100644
--- a/cui/source/inc/treeopt.hxx
+++ b/cui/source/inc/treeopt.hxx
@@ -200,6 +200,7 @@ public:
         bool bActivateLastSelection = true );
     OfaTreeOptionsDialog( vcl::Window* pParent, const OUString& rExtensionId );
     virtual ~OfaTreeOptionsDialog();
+    virtual void dispose() SAL_OVERRIDE;
 
     OptionsPageInfo*    AddTabPage( sal_uInt16 nId, const OUString& rPageName, sal_uInt16 nGroup );
     sal_uInt16              AddGroup(   const OUString& rGroupName,  SfxShell* pCreateShell,
@@ -277,6 +278,7 @@ public:
             com::sun::star::awt::XContainerWindowProvider >& rProvider );
 
     virtual ~ExtensionsTabPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     virtual void    ActivatePage() SAL_OVERRIDE;
     virtual void    DeactivatePage() SAL_OVERRIDE;
diff --git a/cui/source/inc/zoom.hxx b/cui/source/inc/zoom.hxx
index a8b3176..86cbb3a 100644
--- a/cui/source/inc/zoom.hxx
+++ b/cui/source/inc/zoom.hxx
@@ -57,6 +57,7 @@ private:
 public:
     SvxZoomDialog( vcl::Window* pParent, const SfxItemSet& rCoreSet );
     virtual ~SvxZoomDialog();
+    virtual void dispose() SAL_OVERRIDE;
 
     const SfxItemSet*   GetOutputItemSet() const { return pOutSet; }
 
diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx
index a31c252..ac73a78 100644
--- a/cui/source/options/certpath.cxx
+++ b/cui/source/options/certpath.cxx
@@ -144,6 +144,11 @@ OUString CertPathDialog::getDirectory() const
 
 CertPathDialog::~CertPathDialog()
 {
+    dispose();
+}
+
+void CertPathDialog::dispose()
+{
     SvTreeListEntry* pEntry = m_pCertPathList->First();
     while (pEntry)
     {
@@ -152,6 +157,7 @@ CertPathDialog::~CertPathDialog()
         pEntry = m_pCertPathList->Next( pEntry );
     }
     delete m_pCertPathList;
+    ModalDialog::dispose();
 }
 
 IMPL_LINK( CertPathDialog, CheckHdl_Impl, SvSimpleTable *, pList )
diff --git a/cui/source/options/certpath.hxx b/cui/source/options/certpath.hxx
index bdc083c..1add8ea 100644
--- a/cui/source/options/certpath.hxx
+++ b/cui/source/options/certpath.hxx
@@ -35,6 +35,7 @@ private:
 public:
     CertPathDialog(vcl::Window* pParent);
     virtual ~CertPathDialog();
+    virtual void dispose() SAL_OVERRIDE;
 
     OUString getDirectory() const;
 };
diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx
index 0258322..4b2d076 100644
--- a/cui/source/options/dbregister.cxx
+++ b/cui/source/options/dbregister.cxx
@@ -83,10 +83,6 @@ DatabaseRegistrationDialog::DatabaseRegistrationDialog( vcl::Window* pParent, co
     SetText(page->get<VclFrame>("frame1")->get_label());
 }
 
-DatabaseRegistrationDialog::~DatabaseRegistrationDialog()
-{
-}
-
 short DatabaseRegistrationDialog::Execute()
 {
     short result = SfxSingleTabDialog::Execute();
@@ -167,9 +163,15 @@ DbRegistrationOptionsPage::DbRegistrationOptionsPage( vcl::Window* pParent, cons
 
 DbRegistrationOptionsPage::~DbRegistrationOptionsPage()
 {
+    dispose();
+}
+
+void DbRegistrationOptionsPage::dispose()
+{
     for ( sal_uInt16 i = 0; i < pPathBox->GetEntryCount(); ++i )
         delete static_cast< DatabaseRegistration* >( pPathBox->GetEntry(i)->GetUserData() );
     delete pPathBox;
+    SfxTabPage::dispose();
 }
 
 
diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx
index a0e92f9..a86dcf9 100644
--- a/cui/source/options/fontsubs.cxx
+++ b/cui/source/options/fontsubs.cxx
@@ -138,9 +138,15 @@ SvTreeListEntry* SvxFontSubstTabPage::CreateEntry(OUString& rFont1, OUString& rF
 
 SvxFontSubstTabPage::~SvxFontSubstTabPage()
 {
+    dispose();
+}
+
+void SvxFontSubstTabPage::dispose()
+{
     delete pCheckButtonData;
     delete pConfig;
     delete m_pCheckLB;
+    SfxTabPage::dispose();
 }
 
 SfxTabPage*  SvxFontSubstTabPage::Create( vcl::Window* pParent,
diff --git a/cui/source/options/fontsubs.hxx b/cui/source/options/fontsubs.hxx
index d73e2b0..b051cdd 100644
--- a/cui/source/options/fontsubs.hxx
+++ b/cui/source/options/fontsubs.hxx
@@ -93,6 +93,7 @@ class SvxFontSubstTabPage : public SfxTabPage
 
     SvxFontSubstTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
     virtual ~SvxFontSubstTabPage();
+    virtual void dispose() SAL_OVERRIDE;
 
 public:
     static SfxTabPage*  Create( vcl::Window* pParent, const SfxItemSet* rAttrSet);
diff --git a/cui/source/options/optaccessibility.cxx b/cui/source/options/optaccessibility.cxx
index ea94d53..ed7e171 100644
--- a/cui/source/options/optaccessibility.cxx
+++ b/cui/source/options/optaccessibility.cxx
@@ -58,7 +58,13 @@ SvxAccessibilityOptionsTabPage::SvxAccessibilityOptionsTabPage(vcl::Window* pPar
 
 SvxAccessibilityOptionsTabPage::~SvxAccessibilityOptionsTabPage()
 {
+    dispose();
+}
+
+void SvxAccessibilityOptionsTabPage::dispose()
+{
     delete m_pImpl;
+    SfxTabPage::dispose();
 }
 
 SfxTabPage* SvxAccessibilityOptionsTabPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
diff --git a/cui/source/options/optaccessibility.hxx b/cui/source/options/optaccessibility.hxx
index c63c37d..ccf2ac0 100644
--- a/cui/source/options/optaccessibility.hxx
+++ b/cui/source/options/optaccessibility.hxx
@@ -44,6 +44,7 @@ class SvxAccessibilityOptionsTabPage : public SfxTabPage
 public:
 
     virtual ~SvxAccessibilityOptionsTabPage();
+    virtual void dispose() SAL_OVERRIDE;
 

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list