[Libreoffice-commits] core.git: Branch 'feature/vclref' - 2 commits - basctl/source chart2/source

Noel Grandin noel at peralex.com
Wed Jan 14 06:18:32 PST 2015


 basctl/source/basicide/basicbox.cxx                          |   28 -
 basctl/source/basicide/basicbox.hxx                          |    7 
 basctl/source/basicide/baside2.cxx                           |   68 +-
 basctl/source/basicide/baside2.hxx                           |   58 +-
 basctl/source/basicide/baside2b.cxx                          |  287 ++++++-----
 basctl/source/basicide/baside3.cxx                           |    9 
 basctl/source/basicide/basides1.cxx                          |   18 
 basctl/source/basicide/basides2.cxx                          |    4 
 basctl/source/basicide/basides3.cxx                          |    4 
 basctl/source/basicide/basidesh.cxx                          |   40 -
 basctl/source/basicide/bastype2.cxx                          |    6 
 basctl/source/basicide/bastype2.hxx                          |    1 
 basctl/source/basicide/bastypes.cxx                          |    6 
 basctl/source/basicide/layout.cxx                            |   22 
 basctl/source/basicide/layout.hxx                            |    4 
 basctl/source/basicide/linenumberwindow.cxx                  |    3 
 basctl/source/basicide/linenumberwindow.hxx                  |    1 
 basctl/source/basicide/macrodlg.cxx                          |    6 
 basctl/source/basicide/macrodlg.hxx                          |    1 
 basctl/source/basicide/moduldl2.cxx                          |   12 
 basctl/source/basicide/moduldlg.cxx                          |    9 
 basctl/source/basicide/moduldlg.hxx                          |    4 
 basctl/source/basicide/objdlg.cxx                            |   46 +
 basctl/source/basicide/objdlg.hxx                            |    7 
 basctl/source/dlged/managelang.cxx                           |    6 
 basctl/source/dlged/propbrw.cxx                              |    6 
 basctl/source/inc/baside3.hxx                                |    4 
 basctl/source/inc/basidesh.hxx                               |   16 
 basctl/source/inc/bastypes.hxx                               |    1 
 basctl/source/inc/managelang.hxx                             |    1 
 basctl/source/inc/propbrw.hxx                                |    1 
 chart2/source/controller/dialogs/DataBrowser.cxx             |   54 +-
 chart2/source/controller/dialogs/DataBrowser.hxx             |    5 
 chart2/source/controller/dialogs/TextDirectionListBox.cxx    |    4 
 chart2/source/controller/dialogs/dlg_ChartType.cxx           |    6 
 chart2/source/controller/dialogs/dlg_CreationWizard.cxx      |    4 
 chart2/source/controller/dialogs/dlg_DataEditor.cxx          |    6 
 chart2/source/controller/dialogs/dlg_DataSource.cxx          |    6 
 chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx     |    8 
 chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx     |    4 
 chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx     |    4 
 chart2/source/controller/dialogs/dlg_NumberFormat.cxx        |    4 
 chart2/source/controller/dialogs/dlg_NumberFormat.hxx        |    3 
 chart2/source/controller/dialogs/dlg_ObjectProperties.cxx    |    6 
 chart2/source/controller/dialogs/dlg_View3D.cxx              |    6 
 chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx   |    3 
 chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx   |    1 
 chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx     |    4 
 chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx     |    1 
 chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx |   10 
 chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx |    2 
 chart2/source/controller/dialogs/tp_AxisLabel.cxx            |   10 
 chart2/source/controller/dialogs/tp_AxisLabel.hxx            |    1 
 chart2/source/controller/dialogs/tp_ChartType.cxx            |   17 
 chart2/source/controller/dialogs/tp_ChartType.hxx            |    1 
 chart2/source/controller/dialogs/tp_DataLabel.cxx            |    4 
 chart2/source/controller/dialogs/tp_DataLabel.hxx            |    1 
 chart2/source/controller/dialogs/tp_DataSource.cxx           |    3 
 chart2/source/controller/dialogs/tp_DataSource.hxx           |    1 
 chart2/source/controller/dialogs/tp_PointGeometry.cxx        |    6 
 chart2/source/controller/dialogs/tp_PointGeometry.hxx        |    1 
 chart2/source/controller/dialogs/tp_PolarOptions.cxx         |    4 
 chart2/source/controller/dialogs/tp_PolarOptions.hxx         |    1 
 chart2/source/controller/dialogs/tp_RangeChooser.cxx         |    4 
 chart2/source/controller/dialogs/tp_RangeChooser.hxx         |    1 
 chart2/source/controller/dialogs/tp_SeriesToAxis.cxx         |    4 
 chart2/source/controller/dialogs/tp_SeriesToAxis.hxx         |    1 
 chart2/source/controller/dialogs/tp_TitleRotation.cxx        |    6 
 chart2/source/controller/dialogs/tp_TitleRotation.hxx        |    1 
 chart2/source/controller/dialogs/tp_Trendline.cxx            |    4 
 chart2/source/controller/dialogs/tp_Trendline.hxx            |    1 
 chart2/source/controller/inc/TextDirectionListBox.hxx        |    1 
 chart2/source/controller/inc/dlg_ChartType.hxx               |    1 
 chart2/source/controller/inc/dlg_CreationWizard.hxx          |    3 
 chart2/source/controller/inc/dlg_DataEditor.hxx              |    1 
 chart2/source/controller/inc/dlg_DataSource.hxx              |    1 
 chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx         |    2 
 chart2/source/controller/inc/dlg_InsertDataLabel.hxx         |    3 
 chart2/source/controller/inc/dlg_InsertErrorBars.hxx         |    1 
 chart2/source/controller/inc/dlg_ObjectProperties.hxx        |    1 
 chart2/source/controller/inc/dlg_View3D.hxx                  |    1 
 chart2/source/controller/main/ChartWindow.cxx                |    6 
 chart2/source/controller/main/ChartWindow.hxx                |    1 
 chart2/source/controller/main/ElementSelector.cxx            |    4 
 chart2/source/controller/main/ElementSelector.hxx            |    1 
 85 files changed, 528 insertions(+), 398 deletions(-)

New commits:
commit 69afa40aed956eab5cdaa9ee037f8f4ca44a498f
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Jan 14 16:16:32 2015 +0200

    vcl: VclPtr conversion in chart2
    
    Change-Id: Iae82331e812836ff4c97617227d316bfe15b23df

diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
index 5276546..41061f4 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -102,7 +102,6 @@ class SeriesHeaderEdit : public Edit
 {
 public:
     SeriesHeaderEdit( vcl::Window * pParent );
-    virtual ~SeriesHeaderEdit();
     virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
 
     void setStartColumn( sal_Int32 nStartColumn );
@@ -122,9 +121,6 @@ SeriesHeaderEdit::SeriesHeaderEdit( vcl::Window * pParent ) :
     SetHelpId(HID_SCH_DATA_SERIES_LABEL);
 }
 
-SeriesHeaderEdit::~SeriesHeaderEdit()
-{}
-
 void SeriesHeaderEdit::setStartColumn( sal_Int32 nStartColumn )
 {
     m_nStartColumn = nStartColumn;
@@ -462,21 +458,29 @@ DataBrowser::DataBrowser( vcl::Window* pParent, WinBits nStyle, bool bLiveUpdate
     m_bIsDirty( false ),
     m_bLiveUpdate( bLiveUpdate ),
     m_bDataValid( true ),
-    m_aNumberEditField( & EditBrowseBox::GetDataWindow(), WB_NOBORDER ),
-    m_aTextEditField( & EditBrowseBox::GetDataWindow(), WB_NOBORDER ),
-    m_rNumberEditController( new ::svt::FormattedFieldCellController( & m_aNumberEditField )),
-    m_rTextEditController( new ::svt::EditCellController( & m_aTextEditField ))
+    m_aNumberEditField( new FormattedField( & EditBrowseBox::GetDataWindow(), WB_NOBORDER ) ),
+    m_aTextEditField( new Edit( & EditBrowseBox::GetDataWindow(), WB_NOBORDER ) ),
+    m_rNumberEditController( new ::svt::FormattedFieldCellController( m_aNumberEditField.get() )),
+    m_rTextEditController( new ::svt::EditCellController( m_aTextEditField.get() ))
 {
     double fNan;
     ::rtl::math::setNan( & fNan );
-    m_aNumberEditField.SetDefaultValue( fNan );
-    m_aNumberEditField.TreatAsNumber( true );
+    m_aNumberEditField->SetDefaultValue( fNan );
+    m_aNumberEditField->TreatAsNumber( true );
     RenewTable();
     SetClean();
 }
 
 DataBrowser::~DataBrowser()
 {
+    dispose();
+}
+
+void DataBrowser::dispose()
+{
+    m_aNumberEditField.disposeAndClear();
+    m_aTextEditField.disposeAndClear();
+    ::svt::EditBrowseBox::dispose();
 }
 
 bool DataBrowser::MayInsertRow() const
@@ -779,7 +783,7 @@ bool DataBrowser::IsDataValid()
     {
         sal_uInt32 nDummy = 0;
         double fDummy = 0.0;
-        OUString aText( m_aNumberEditField.GetText());
+        OUString aText( m_aNumberEditField->GetText());
 
         if( !aText.isEmpty() &&
             m_spNumberFormatterWrapper.get() &&
@@ -823,7 +827,7 @@ void DataBrowser::SetDataFromModel(
             Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY )));
 
     if( m_spNumberFormatterWrapper.get() )
-        m_aNumberEditField.SetFormatter( m_spNumberFormatterWrapper->getSvNumberFormatter() );
+        m_aNumberEditField->SetFormatter( m_spNumberFormatterWrapper->getSvNumberFormatter() );
 
     RenewTable();
 
@@ -1043,8 +1047,8 @@ bool DataBrowser::IsTabAllowed( bool bForward ) const
 
     if( CellContainsNumbers( nRow, nCol ))
     {
-        m_aNumberEditField.UseInputStringForFormatting();
-        m_aNumberEditField.SetFormatKey( GetNumberFormatKey( nRow, nCol ));
+        m_aNumberEditField->UseInputStringForFormatting();
+        m_aNumberEditField->SetFormatKey( GetNumberFormatKey( nRow, nCol ));
         return m_rNumberEditController;
     }
 
@@ -1057,19 +1061,19 @@ void DataBrowser::InitController(
     if( rController == m_rTextEditController )
     {
         OUString aText( GetCellText( nRow, nCol ) );
-        m_aTextEditField.SetText( aText );
-        m_aTextEditField.SetSelection( Selection( 0, aText.getLength() ));
+        m_aTextEditField->SetText( aText );
+        m_aTextEditField->SetSelection( Selection( 0, aText.getLength() ));
     }
     else if( rController == m_rNumberEditController )
     {
         // treat invalid and empty text as Nan
-        m_aNumberEditField.EnableNotANumber( true );
+        m_aNumberEditField->EnableNotANumber( true );
         if( ::rtl::math::isNan( GetCellNumber( nRow, nCol )))
-            m_aNumberEditField.SetTextValue( OUString());
+            m_aNumberEditField->SetTextValue( OUString());
         else
-            m_aNumberEditField.SetValue( GetCellNumber( nRow, nCol ) );
-        OUString aText( m_aNumberEditField.GetText());
-        m_aNumberEditField.SetSelection( Selection( 0, aText.getLength()));
+            m_aNumberEditField->SetValue( GetCellNumber( nRow, nCol ) );
+        OUString aText( m_aNumberEditField->GetText());
+        m_aNumberEditField->SetSelection( Selection( 0, aText.getLength()));
     }
     else
     {
@@ -1127,7 +1131,7 @@ bool DataBrowser::SaveModified()
         {
             sal_uInt32 nDummy = 0;
             double fDummy = 0.0;
-            OUString aText( m_aNumberEditField.GetText());
+            OUString aText( m_aNumberEditField->GetText());
             // an empty string is valid, if no numberformatter exists, all
             // values are treated as valid
             if( !aText.isEmpty() && pSvNumberFormatter &&
@@ -1137,14 +1141,14 @@ bool DataBrowser::SaveModified()
             }
             else
             {
-                double fData = m_aNumberEditField.GetValue();
+                double fData = m_aNumberEditField->GetValue();
                 bChangeValid = m_apDataBrowserModel->setCellNumber( nCol, nRow, fData );
             }
         }
         break;
         case DataBrowserModel::TEXTORDATE:
         {
-            OUString aText( m_aTextEditField.GetText() );
+            OUString aText( m_aTextEditField->GetText() );
             double fDateValue = 0.0;
             bChangeValid = false;
             if( isDateString( aText, fDateValue ) )
@@ -1155,7 +1159,7 @@ bool DataBrowser::SaveModified()
         break;
         case DataBrowserModel::TEXT:
         {
-            OUString aText( m_aTextEditField.GetText());
+            OUString aText( m_aTextEditField->GetText());
             bChangeValid = m_apDataBrowserModel->setCellText( nCol, nRow, aText );
         }
         break;
diff --git a/chart2/source/controller/dialogs/DataBrowser.hxx b/chart2/source/controller/dialogs/DataBrowser.hxx
index f4c82b3..7f99daf 100644
--- a/chart2/source/controller/dialogs/DataBrowser.hxx
+++ b/chart2/source/controller/dialogs/DataBrowser.hxx
@@ -69,6 +69,7 @@ protected:
 public:
     DataBrowser( vcl::Window* pParent, WinBits nStyle, bool bLiveUpdate );
     virtual ~DataBrowser();
+    virtual void dispose() SAL_OVERRIDE;
 
     /** GetCellText returns the text at the given position
         @param  nRow
@@ -164,8 +165,8 @@ private:
     bool                m_bLiveUpdate;
     bool                m_bDataValid;
 
-    FormattedField      m_aNumberEditField;
-    Edit                m_aTextEditField;
+    VclPtr<FormattedField>      m_aNumberEditField;
+    VclPtr<Edit>                m_aTextEditField;
 
     /// note: m_aNumberEditField must precede this member!
     ::svt::CellControllerRef m_rNumberEditController;
diff --git a/chart2/source/controller/dialogs/TextDirectionListBox.cxx b/chart2/source/controller/dialogs/TextDirectionListBox.cxx
index 85c1def..c3f5e30 100644
--- a/chart2/source/controller/dialogs/TextDirectionListBox.cxx
+++ b/chart2/source/controller/dialogs/TextDirectionListBox.cxx
@@ -47,10 +47,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeTextDirectionListBox(v
          return new TextDirectionListBox(pParent);
      }
 
-TextDirectionListBox::~TextDirectionListBox()
-{
-}
-
 } //namespace chart
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/dlg_ChartType.cxx b/chart2/source/controller/dialogs/dlg_ChartType.cxx
index 30d03d1..9ef9432d 100644
--- a/chart2/source/controller/dialogs/dlg_ChartType.cxx
+++ b/chart2/source/controller/dialogs/dlg_ChartType.cxx
@@ -55,7 +55,13 @@ ChartTypeDialog::ChartTypeDialog( vcl::Window* pParent
 
 ChartTypeDialog::~ChartTypeDialog()
 {
+    dispose();
+}
+
+void ChartTypeDialog::dispose()
+{
     delete m_pChartTypeTabPage;
+    ModalDialog::dispose();
 }
 
 } //namespace chart
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
index d7faca0..40e092c 100644
--- a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
@@ -106,10 +106,6 @@ CreationWizard::CreationWizard( vcl::Window* pParent, const uno::Reference< fram
     ActivatePage();
 }
 
-CreationWizard::~CreationWizard()
-{
-}
-
 svt::OWizardPage* CreationWizard::createPage(WizardState nState)
 {
     svt::OWizardPage* pRet = 0;
diff --git a/chart2/source/controller/dialogs/dlg_DataEditor.cxx b/chart2/source/controller/dialogs/dlg_DataEditor.cxx
index 4183aaf..852a5cb 100644
--- a/chart2/source/controller/dialogs/dlg_DataEditor.cxx
+++ b/chart2/source/controller/dialogs/dlg_DataEditor.cxx
@@ -95,12 +95,18 @@ DataEditor::DataEditor(vcl::Window* pParent,
 
 DataEditor::~DataEditor()
 {
+    dispose();
+}
+
+void DataEditor::dispose()
+{
     notifySystemWindow( this, m_pTbxData, ::comphelper::mem_fun( & TaskPaneList::RemoveWindow ));
 
     SvtMiscOptions aMiscOptions;
     aMiscOptions.RemoveListenerLink( LINK( this, DataEditor, MiscHdl ) );
 
     OSL_TRACE( "DataEditor: DTOR" );
+    ModalDialog::dispose();
 }
 
 // react on click (or keypress) on toolbar icon
diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx b/chart2/source/controller/dialogs/dlg_DataSource.cxx
index bfa90c7..e59c95e 100644
--- a/chart2/source/controller/dialogs/dlg_DataSource.cxx
+++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx
@@ -159,11 +159,17 @@ DataSourceDialog::DataSourceDialog(vcl::Window * pParent,
 
 DataSourceDialog::~DataSourceDialog()
 {
+    dispose();
+}
+
+void DataSourceDialog::dispose()
+{
     delete m_pRangeChooserTabePage;
     delete m_pDataSourceTabPage;
 
     m_nLastPageId = m_pTabControl->GetCurPageId();
     delete m_pTabControl;
+    TabDialog::dispose();
 }
 
 short DataSourceDialog::Execute()
diff --git a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx
index 2af1b5f..345a6d7 100644
--- a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx
+++ b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx
@@ -81,10 +81,6 @@ SchAxisDlg::SchAxisDlg(vcl::Window* pWindow,
     m_pCbSecondaryZ->Enable( rInput.aPossibilityList[5] );
 }
 
-SchAxisDlg::~SchAxisDlg()
-{
-}
-
 void SchAxisDlg::getResult( InsertAxisOrGridDialogData& rOutput )
 {
     rOutput.aExistenceList[0]=m_pCbPrimaryX->IsChecked();
@@ -100,10 +96,6 @@ SchGridDlg::SchGridDlg( vcl::Window* pParent, const InsertAxisOrGridDialogData&
 {
 }
 
-SchGridDlg::~SchGridDlg()
-{
-}
-
 } //namespace chart
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx b/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx
index 83c1309..17c15bc 100644
--- a/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx
+++ b/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx
@@ -34,10 +34,6 @@ DataLabelsDialog::DataLabelsDialog(vcl::Window* pWindow, const SfxItemSet& rInAt
     Reset();
 }
 
-DataLabelsDialog::~DataLabelsDialog()
-{
-}
-
 void DataLabelsDialog::Reset()
 {
     m_apDataLabelResources->Reset(m_rInAttrs);
diff --git a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx
index fd7f0a0..75b0f32 100644
--- a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx
+++ b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx
@@ -57,10 +57,6 @@ InsertErrorBarsDialog::InsertErrorBarsDialog(
     m_apErrorBarResources->SetChartDocumentForRangeChoosing( xChartDocument );
 }
 
-InsertErrorBarsDialog::~InsertErrorBarsDialog()
-{
-}
-
 void InsertErrorBarsDialog::FillItemSet(SfxItemSet& rOutAttrs)
 {
     m_apErrorBarResources->FillItemSet(rOutAttrs);
diff --git a/chart2/source/controller/dialogs/dlg_NumberFormat.cxx b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
index a2ba7f3..9d0e54c 100644
--- a/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
+++ b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
@@ -44,10 +44,6 @@ NumberFormatDialog::NumberFormatDialog(vcl::Window* pParent, SfxItemSet& rSet)
     }
 }
 
-NumberFormatDialog::~NumberFormatDialog()
-{
-}
-
 SfxItemSet NumberFormatDialog::CreateEmptyItemSetForNumberFormatDialog( SfxItemPool& rItemPool )
 {
     static const sal_uInt16 nWhichPairs[] =
diff --git a/chart2/source/controller/dialogs/dlg_NumberFormat.hxx b/chart2/source/controller/dialogs/dlg_NumberFormat.hxx
index a27ff0c..1aff535 100644
--- a/chart2/source/controller/dialogs/dlg_NumberFormat.hxx
+++ b/chart2/source/controller/dialogs/dlg_NumberFormat.hxx
@@ -30,8 +30,7 @@ namespace chart
 class NumberFormatDialog : public SfxSingleTabDialog
 {
 public:
-     NumberFormatDialog(vcl::Window* pParent, SfxItemSet& rSet);
-    virtual ~NumberFormatDialog();
+    NumberFormatDialog(vcl::Window* pParent, SfxItemSet& rSet);
 
     static SfxItemSet CreateEmptyItemSetForNumberFormatDialog( SfxItemPool& rItemPool );
 };
diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
index 165b179..25b87fc 100644
--- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
+++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
@@ -481,8 +481,14 @@ SchAttribTabDlg::SchAttribTabDlg(vcl::Window* pParent,
 
 SchAttribTabDlg::~SchAttribTabDlg()
 {
+    dispose();
+}
+
+void SchAttribTabDlg::dispose()
+{
     delete m_pSymbolShapeProperties;
     delete m_pAutoSymbolGraphic;
+    SfxTabDialog::dispose();
 }
 
 void SchAttribTabDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage)
diff --git a/chart2/source/controller/dialogs/dlg_View3D.cxx b/chart2/source/controller/dialogs/dlg_View3D.cxx
index c346fdd..aba6812 100644
--- a/chart2/source/controller/dialogs/dlg_View3D.cxx
+++ b/chart2/source/controller/dialogs/dlg_View3D.cxx
@@ -66,11 +66,17 @@ View3DDialog::View3DDialog(vcl::Window* pParent, const uno::Reference< frame::XM
 
 View3DDialog::~View3DDialog()
 {
+    dispose();
+}
+
+void View3DDialog::dispose()
+{
     delete m_pGeometry;
     delete m_pAppearance;
     delete m_pIllumination;
 
     m_nLastPageId = m_pTabControl->GetCurPageId();
+    TabDialog::dispose();
 }
 
 short View3DDialog::Execute()
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
index 6a15742..32c3396 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
@@ -120,9 +120,6 @@ ThreeD_SceneAppearance_TabPage::ThreeD_SceneAppearance_TabPage(
     initControlsFromModel();
 }
 
-ThreeD_SceneAppearance_TabPage::~ThreeD_SceneAppearance_TabPage()
-{}
-
 void ThreeD_SceneAppearance_TabPage::ActivatePage()
 {
     updateScheme();
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx
index b00718c..1363ae2 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx
@@ -38,7 +38,6 @@ public:
         vcl::Window* pWindow,
         const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xChartModel,
         ControllerLockHelper & rControllerLockHelper );
-    virtual ~ThreeD_SceneAppearance_TabPage();
 
     // has to be called in case the dialog was closed with OK
     void commitPendingChanges();
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx
index d9f3cca..0428b2d 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx
@@ -147,10 +147,6 @@ ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage( vcl::Window* pWindow
     m_pMFPerspective->SetAccessibleRelationLabeledBy(m_pCbxPerspective);
 }
 
-ThreeD_SceneGeometry_TabPage::~ThreeD_SceneGeometry_TabPage()
-{
-}
-
 void ThreeD_SceneGeometry_TabPage::commitPendingChanges()
 {
     ControllerLockHelperGuard aGuard( m_rControllerLockHelper );
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx
index 21bc08a..bc19444 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx
@@ -39,7 +39,6 @@ public:
                                   const ::com::sun::star::uno::Reference<
                                       ::com::sun::star::beans::XPropertySet > & xSceneProperties,
                                   ControllerLockHelper & rControllerLockHelper );
-    virtual ~ThreeD_SceneGeometry_TabPage();
 
     // has to be called in case the dialog was closed with OK
     void commitPendingChanges();
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
index 629f554..2b1591d 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
@@ -48,10 +48,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeLightButton(vcl::Windo
     return new LightButton(pParent);
 }
 
-LightButton::~LightButton()
-{
-}
-
 void LightButton::switchLightOn(bool bOn)
 {
     if( m_bLightOn==bOn )
@@ -298,7 +294,13 @@ ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage( vcl::Window*
 
 ThreeD_SceneIllumination_TabPage::~ThreeD_SceneIllumination_TabPage()
 {
+    dispose();
+}
+
+void ThreeD_SceneIllumination_TabPage::dispose()
+{
     delete[] m_pLightSourceInfoList;
+    TabPage::dispose();
 }
 
 void ThreeD_SceneIllumination_TabPage::commitPendingChanges()
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
index 3f7af79..d199c81 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
@@ -37,7 +37,6 @@ class LightButton : public ImageButton
 {
 public:
     LightButton( vcl::Window* pParent);
-    virtual ~LightButton();
 
     void switchLightOn(bool bOn);
     bool isLightOn() const { return m_bLightOn;}
@@ -58,6 +57,7 @@ public:
         const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel,
         const XColorListRef &pColorTable );
     virtual ~ThreeD_SceneIllumination_TabPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     // has to be called in case the dialog was closed with OK
     void commitPendingChanges();
diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.cxx b/chart2/source/controller/dialogs/tp_AxisLabel.cxx
index 82e3728..8aa58fa 100644
--- a/chart2/source/controller/dialogs/tp_AxisLabel.cxx
+++ b/chart2/source/controller/dialogs/tp_AxisLabel.cxx
@@ -73,7 +73,15 @@ SchAxisLabelTabPage::SchAxisLabelTabPage( vcl::Window* pParent, const SfxItemSet
 }
 
 SchAxisLabelTabPage::~SchAxisLabelTabPage()
-{delete m_pOrientHlp;}
+{
+    dispose();
+}
+
+void SchAxisLabelTabPage::dispose()
+{
+    delete m_pOrientHlp;
+    SfxTabPage::dispose();
+}
 
 void SchAxisLabelTabPage::Construct()
 {
diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.hxx b/chart2/source/controller/dialogs/tp_AxisLabel.hxx
index 8da5eaf..951b6c8 100644
--- a/chart2/source/controller/dialogs/tp_AxisLabel.hxx
+++ b/chart2/source/controller/dialogs/tp_AxisLabel.hxx
@@ -70,6 +70,7 @@ private:
 public:
     SchAxisLabelTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
     virtual ~SchAxisLabelTabPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     void    Construct();
 
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index 1ae7a69..2b41ab2 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -313,7 +313,6 @@ class SplinePropertiesDialog : public ModalDialog
 {
 public:
     SplinePropertiesDialog( vcl::Window* pParent );
-    virtual ~SplinePropertiesDialog();
 
     void fillControls( const ChartTypeParameter& rParameter );
     void fillParameter( ChartTypeParameter& rParameter, bool bSmoothLines );
@@ -347,10 +346,6 @@ SplinePropertiesDialog::SplinePropertiesDialog( vcl::Window* pParent )
     m_pLB_Spline_Type->SetSelectHdl( LINK (this, SplinePropertiesDialog, SplineTypeListBoxHdl ) );
 }
 
-SplinePropertiesDialog::~SplinePropertiesDialog()
-{
-}
-
 void SplinePropertiesDialog::StateChanged( StateChangedType nType )
 {
     Dialog::StateChanged( nType );
@@ -400,7 +395,6 @@ class SteppedPropertiesDialog : public ModalDialog
 {
 public:
     SteppedPropertiesDialog( vcl::Window* pParent );
-    virtual ~SteppedPropertiesDialog();
 
     void fillControls( const ChartTypeParameter& rParameter );
     void fillParameter( ChartTypeParameter& rParameter, bool bSteppedLines );
@@ -427,10 +421,6 @@ SteppedPropertiesDialog::SteppedPropertiesDialog( vcl::Window* pParent )
     SetText(SCH_RESSTR(STR_DLG_STEPPED_LINE_PROPERTIES));
 }
 
-SteppedPropertiesDialog::~SteppedPropertiesDialog()
-{
-}
-
 void SteppedPropertiesDialog::StateChanged( StateChangedType nType )
 {
     Dialog::StateChanged( nType );
@@ -774,6 +764,11 @@ ChartTypeTabPage::ChartTypeTabPage(vcl::Window* pParent
 
 ChartTypeTabPage::~ChartTypeTabPage()
 {
+    dispose();
+}
+
+void ChartTypeTabPage::dispose()
+{
     //delete all dialog controller
     ::std::vector< ChartTypeDialogController* >::const_iterator       aIter = m_aChartTypeDialogControllerList.begin();
     const ::std::vector< ChartTypeDialogController* >::const_iterator aEnd  = m_aChartTypeDialogControllerList.end();
@@ -790,7 +785,9 @@ ChartTypeTabPage::~ChartTypeTabPage()
     delete m_pGeometryResourceGroup;
     delete m_pSortByXValuesResourceGroup;
     delete m_pGL3DResourceGroup;
+    svt::OWizardPage::dispose();
 }
+
 ChartTypeParameter ChartTypeTabPage::getCurrentParamter() const
 {
     ChartTypeParameter aParameter;
diff --git a/chart2/source/controller/dialogs/tp_ChartType.hxx b/chart2/source/controller/dialogs/tp_ChartType.hxx
index 486ae15..a8cb43c 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.hxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.hxx
@@ -55,6 +55,7 @@ public:
                 ::com::sun::star::uno::XComponentContext >& xContext
                 , bool bDoLiveUpdate, bool bShowDescription = true );
     virtual ~ChartTypeTabPage();
+    virtual void        dispose() SAL_OVERRIDE;
 
     virtual void        initializePage() SAL_OVERRIDE;
     virtual bool        commitPage( ::svt::WizardTypes::CommitPageReason eReason ) SAL_OVERRIDE;
diff --git a/chart2/source/controller/dialogs/tp_DataLabel.cxx b/chart2/source/controller/dialogs/tp_DataLabel.cxx
index ef795fa..da3add7 100644
--- a/chart2/source/controller/dialogs/tp_DataLabel.cxx
+++ b/chart2/source/controller/dialogs/tp_DataLabel.cxx
@@ -34,10 +34,6 @@ DataLabelsTabPage::DataLabelsTabPage(vcl::Window* pWindow, const SfxItemSet& rIn
 {
 }
 
-DataLabelsTabPage::~DataLabelsTabPage()
-{
-}
-
 SfxTabPage* DataLabelsTabPage::Create(vcl::Window* pWindow, const SfxItemSet* rOutAttrs)
 {
     return new DataLabelsTabPage(pWindow, *rOutAttrs);
diff --git a/chart2/source/controller/dialogs/tp_DataLabel.hxx b/chart2/source/controller/dialogs/tp_DataLabel.hxx
index 1bad928..a976306 100644
--- a/chart2/source/controller/dialogs/tp_DataLabel.hxx
+++ b/chart2/source/controller/dialogs/tp_DataLabel.hxx
@@ -34,7 +34,6 @@ class DataLabelsTabPage : public SfxTabPage
 {
 public:
     DataLabelsTabPage(vcl::Window* pWindow, const SfxItemSet& rInAttrs);
-    virtual ~DataLabelsTabPage();
 
     static SfxTabPage* Create(vcl::Window* pWindow, const SfxItemSet* rInAttrs);
 
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
index 14da20c..cce6d6c 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -273,9 +273,6 @@ DataSourceTabPage::DataSourceTabPage(
     m_pBTN_DOWN->SetAccessibleName(SCH_RESSTR(STR_BUTTON_DOWN));
 }
 
-DataSourceTabPage::~DataSourceTabPage()
-{}
-
 void DataSourceTabPage::ActivatePage()
 {
     OWizardPage::ActivatePage();
diff --git a/chart2/source/controller/dialogs/tp_DataSource.hxx b/chart2/source/controller/dialogs/tp_DataSource.hxx
index 1cc0439..b1ad813 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.hxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.hxx
@@ -58,7 +58,6 @@ public:
         ChartTypeTemplateProvider* pTemplateProvider,
         Dialog * pParentDialog,
         bool bHideDescription = false );
-    virtual ~DataSourceTabPage();
 
     void commitPage();
 
diff --git a/chart2/source/controller/dialogs/tp_PointGeometry.cxx b/chart2/source/controller/dialogs/tp_PointGeometry.cxx
index 3abb60b..c65ef3a 100644
--- a/chart2/source/controller/dialogs/tp_PointGeometry.cxx
+++ b/chart2/source/controller/dialogs/tp_PointGeometry.cxx
@@ -39,7 +39,13 @@ SchLayoutTabPage::SchLayoutTabPage(vcl::Window* pWindow,const SfxItemSet& rInAtt
 
 SchLayoutTabPage::~SchLayoutTabPage()
 {
+    dispose();
+}
+
+void SchLayoutTabPage::dispose()
+{
     delete m_pGeometryResources;
+    SfxTabPage::dispose();
 }
 
 SfxTabPage* SchLayoutTabPage::Create(vcl::Window* pWindow,
diff --git a/chart2/source/controller/dialogs/tp_PointGeometry.hxx b/chart2/source/controller/dialogs/tp_PointGeometry.hxx
index 635768f..5c142c0 100644
--- a/chart2/source/controller/dialogs/tp_PointGeometry.hxx
+++ b/chart2/source/controller/dialogs/tp_PointGeometry.hxx
@@ -30,6 +30,7 @@ class SchLayoutTabPage : public SfxTabPage
 public:
     SchLayoutTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs);
     virtual ~SchLayoutTabPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rInAttrs);
     virtual bool FillItemSet(SfxItemSet* rOutAttrs) SAL_OVERRIDE;
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.cxx b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
index dbd0c46..ff9db60 100644
--- a/chart2/source/controller/dialogs/tp_PolarOptions.cxx
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
@@ -44,10 +44,6 @@ PolarOptionsTabPage::PolarOptionsTabPage( vcl::Window* pWindow,const SfxItemSet&
     m_pAngleDial->SetLinkedField( m_pNF_StartingAngle );
 }
 
-PolarOptionsTabPage::~PolarOptionsTabPage()
-{
-}
-
 SfxTabPage* PolarOptionsTabPage::Create( vcl::Window* pWindow,const SfxItemSet* rOutAttrs )
 {
     return new PolarOptionsTabPage( pWindow, *rOutAttrs );
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.hxx b/chart2/source/controller/dialogs/tp_PolarOptions.hxx
index 7d0ea50..4ade721 100644
--- a/chart2/source/controller/dialogs/tp_PolarOptions.hxx
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.hxx
@@ -33,7 +33,6 @@ class PolarOptionsTabPage : public SfxTabPage
 
 public:
     PolarOptionsTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs );
-    virtual ~PolarOptionsTabPage();
 
     static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rInAttrs);
     virtual bool FillItemSet(SfxItemSet* rOutAttrs) SAL_OVERRIDE;
diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.cxx b/chart2/source/controller/dialogs/tp_RangeChooser.cxx
index 00f16fd..108aac0 100644
--- a/chart2/source/controller/dialogs/tp_RangeChooser.cxx
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.cxx
@@ -122,10 +122,6 @@ RangeChooserTabPage::RangeChooserTabPage( vcl::Window* pParent
     m_pEd_TimeEnd->SetModifyHdl( LINK( this, RangeChooserTabPage, ControlChangedHdl ) );
 }
 
-RangeChooserTabPage::~RangeChooserTabPage()
-{
-}
-
 void RangeChooserTabPage::ActivatePage()
 {
     OWizardPage::ActivatePage();
diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.hxx b/chart2/source/controller/dialogs/tp_RangeChooser.hxx
index 3b88a46..f7a0791 100644
--- a/chart2/source/controller/dialogs/tp_RangeChooser.hxx
+++ b/chart2/source/controller/dialogs/tp_RangeChooser.hxx
@@ -48,7 +48,6 @@ public:
                 , ChartTypeTemplateProvider* pTemplateProvider
                 , Dialog * pParentDialog
                 , bool bHideDescription = false );
-virtual ~RangeChooserTabPage();
 
     //RangeSelectionListenerParent
     virtual void listeningFinished( const OUString & rNewRange ) SAL_OVERRIDE;
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
index aebb527..53fb19e 100644
--- a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx
@@ -62,10 +62,6 @@ SchOptionTabPage::SchOptionTabPage(vcl::Window* pWindow,const SfxItemSet& rInAtt
     m_pRbtAxis2->SetClickHdl( LINK( this, SchOptionTabPage, EnableHdl ));
 }
 
-SchOptionTabPage::~SchOptionTabPage()
-{
-}
-
 IMPL_LINK_NOARG(SchOptionTabPage, EnableHdl)
 {
     if( m_nAllSeriesAxisIndex == 0 )
diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
index db4afb6..309579b 100644
--- a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
+++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx
@@ -31,7 +31,6 @@ class SchOptionTabPage : public SfxTabPage
 {
 public:
     SchOptionTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs);
-    virtual ~SchOptionTabPage();
 
     static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rInAttrs);
     virtual bool FillItemSet(SfxItemSet* rOutAttrs) SAL_OVERRIDE;
diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.cxx b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
index 3200455..45ee087 100644
--- a/chart2/source/controller/dialogs/tp_TitleRotation.cxx
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
@@ -57,7 +57,13 @@ SchAlignmentTabPage::SchAlignmentTabPage(vcl::Window* pWindow,
 
 SchAlignmentTabPage::~SchAlignmentTabPage()
 {
+    dispose();
+}
+
+void SchAlignmentTabPage::dispose()
+{
     delete m_pOrientHlp;
+    SfxTabPage::dispose();
 }
 
 SfxTabPage* SchAlignmentTabPage::Create(vcl::Window* pParent,
diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.hxx b/chart2/source/controller/dialogs/tp_TitleRotation.hxx
index 0bd5c97..e5d2e24 100644
--- a/chart2/source/controller/dialogs/tp_TitleRotation.hxx
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.hxx
@@ -43,6 +43,7 @@ private:
 public:
     SchAlignmentTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs, bool bWithRotation = true);
     virtual ~SchAlignmentTabPage();
+    virtual void dispose() SAL_OVERRIDE;
 
     static SfxTabPage* Create(vcl::Window* pParent, const SfxItemSet* rInAttrs);
     static SfxTabPage* CreateWithoutRotation(vcl::Window* pParent, const SfxItemSet* rInAttrs);
diff --git a/chart2/source/controller/dialogs/tp_Trendline.cxx b/chart2/source/controller/dialogs/tp_Trendline.cxx
index d95a213..480323b 100644
--- a/chart2/source/controller/dialogs/tp_Trendline.cxx
+++ b/chart2/source/controller/dialogs/tp_Trendline.cxx
@@ -31,10 +31,6 @@ TrendlineTabPage::TrendlineTabPage( vcl::Window* pParent, const SfxItemSet& rInA
 {
 }
 
-TrendlineTabPage::~TrendlineTabPage()
-{
-}
-
 SfxTabPage* TrendlineTabPage::Create(
     vcl::Window* pParent, const SfxItemSet* rOutAttrs )
 {
diff --git a/chart2/source/controller/dialogs/tp_Trendline.hxx b/chart2/source/controller/dialogs/tp_Trendline.hxx
index a88c858..077cc7c 100644
--- a/chart2/source/controller/dialogs/tp_Trendline.hxx
+++ b/chart2/source/controller/dialogs/tp_Trendline.hxx
@@ -30,7 +30,6 @@ class TrendlineTabPage : public SfxTabPage
 {
 public:
     TrendlineTabPage ( vcl::Window* pParent, const SfxItemSet& rInAttrs );
-    virtual ~TrendlineTabPage ();
 
     static SfxTabPage* Create( vcl::Window* pParent, const SfxItemSet* rInAttrs );
     virtual bool FillItemSet( SfxItemSet* rOutAttrs ) SAL_OVERRIDE;
diff --git a/chart2/source/controller/inc/TextDirectionListBox.hxx b/chart2/source/controller/inc/TextDirectionListBox.hxx
index bee03f2..7060430 100644
--- a/chart2/source/controller/inc/TextDirectionListBox.hxx
+++ b/chart2/source/controller/inc/TextDirectionListBox.hxx
@@ -32,7 +32,6 @@ class TextDirectionListBox : public svx::FrameDirectionListBox
 public:
     explicit            TextDirectionListBox( vcl::Window* pParent,
                             vcl::Window* pWindow1 = 0, vcl::Window* pWindow2 = 0 );
-    virtual             ~TextDirectionListBox();
 };
 
 } //namespace chart
diff --git a/chart2/source/controller/inc/dlg_ChartType.hxx b/chart2/source/controller/inc/dlg_ChartType.hxx
index b67a06f..008ba07 100644
--- a/chart2/source/controller/inc/dlg_ChartType.hxx
+++ b/chart2/source/controller/inc/dlg_ChartType.hxx
@@ -38,6 +38,7 @@ public:
         , const ::com::sun::star::uno::Reference<
         ::com::sun::star::uno::XComponentContext >& xContext );
     virtual ~ChartTypeDialog();
+    virtual void dispose() SAL_OVERRIDE;
 
 private:
     ChartTypeTabPage*   m_pChartTypeTabPage;
diff --git a/chart2/source/controller/inc/dlg_CreationWizard.hxx b/chart2/source/controller/inc/dlg_CreationWizard.hxx
index 95d47fd..33ba961 100644
--- a/chart2/source/controller/inc/dlg_CreationWizard.hxx
+++ b/chart2/source/controller/inc/dlg_CreationWizard.hxx
@@ -22,6 +22,7 @@
 
 #include "TimerTriggeredControllerLock.hxx"
 #include "TabPageNotifiable.hxx"
+#include "../dialogs/DialogModel.hxx"
 
 #include <com/sun/star/chart2/XChartDocument.hpp>
 #include <svtools/roadmapwizard.hxx>
@@ -36,7 +37,6 @@ namespace chart
 class RangeChooserTabPage;
 class DataSourceTabPage;
 class ChartTypeTemplateProvider;
-class DialogModel;
 
 class CreationWizard : public svt::RoadmapWizard, public TabPageNotifiable
 {
@@ -47,7 +47,6 @@ public:
         , const ::com::sun::star::uno::Reference<
         ::com::sun::star::uno::XComponentContext >& xContext
         , sal_Int32 nOnePageOnlyIndex=-1 );//if nOnePageOnlyIndex is an index of an exsisting  page starting with 0, then only this page is displayed without next/previous and roadmap
-    virtual ~CreationWizard();
 
     bool isClosable() { /*@todo*/ return m_bIsClosable;}
 
diff --git a/chart2/source/controller/inc/dlg_DataEditor.hxx b/chart2/source/controller/inc/dlg_DataEditor.hxx
index 997cdad..4187661 100644
--- a/chart2/source/controller/inc/dlg_DataEditor.hxx
+++ b/chart2/source/controller/inc/dlg_DataEditor.hxx
@@ -48,6 +48,7 @@ public:
                 const ::com::sun::star::uno::Reference<
                     ::com::sun::star::uno::XComponentContext > & xContext );
     virtual ~DataEditor();
+    virtual void dispose() SAL_OVERRIDE;
 
     // Dialog
     virtual bool Close() SAL_OVERRIDE;
diff --git a/chart2/source/controller/inc/dlg_DataSource.hxx b/chart2/source/controller/inc/dlg_DataSource.hxx
index 8b3529b..5c6a60d 100644
--- a/chart2/source/controller/inc/dlg_DataSource.hxx
+++ b/chart2/source/controller/inc/dlg_DataSource.hxx
@@ -50,6 +50,7 @@ public:
         const ::com::sun::star::uno::Reference<
             ::com::sun::star::uno::XComponentContext > & xContext );
     virtual ~DataSourceDialog();
+    virtual void dispose() SAL_OVERRIDE;
 
     // from Dialog (base of TabDialog)
     virtual short Execute() SAL_OVERRIDE;
diff --git a/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx b/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx
index bf3bf85..960edff 100644
--- a/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx
+++ b/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx
@@ -52,7 +52,6 @@ protected:
 
 public:
     SchAxisDlg(vcl::Window* pParent, const InsertAxisOrGridDialogData& rInput, bool bAxisDlg=true);
-    virtual ~SchAxisDlg();
 
     void getResult( InsertAxisOrGridDialogData& rOutput );
 };
@@ -66,7 +65,6 @@ class SchGridDlg : public SchAxisDlg
 {
 public:
     SchGridDlg( vcl::Window* pParent, const InsertAxisOrGridDialogData& rInput );
-    virtual ~SchGridDlg();
 };
 
 } //namespace chart
diff --git a/chart2/source/controller/inc/dlg_InsertDataLabel.hxx b/chart2/source/controller/inc/dlg_InsertDataLabel.hxx
index 1cbed9f..fd269c5 100644
--- a/chart2/source/controller/inc/dlg_InsertDataLabel.hxx
+++ b/chart2/source/controller/inc/dlg_InsertDataLabel.hxx
@@ -23,13 +23,13 @@
 #include <vcl/button.hxx>
 #include <svl/itemset.hxx>
 #include <boost/scoped_ptr.hpp>
+#include "../dialogs/res_DataLabel.hxx"
 
 class SvNumberFormatter;
 
 namespace chart
 {
 
-class DataLabelResources;
 class DataLabelsDialog : public ModalDialog
 {
 private:
@@ -44,7 +44,6 @@ private:
 
 public:
     DataLabelsDialog(vcl::Window* pParent, const SfxItemSet& rInAttrs, SvNumberFormatter* pFormatter);
-    virtual ~DataLabelsDialog();
 
     void FillItemSet(SfxItemSet& rOutAttrs);
 };
diff --git a/chart2/source/controller/inc/dlg_InsertErrorBars.hxx b/chart2/source/controller/inc/dlg_InsertErrorBars.hxx
index e981b71..ae45a16 100644
--- a/chart2/source/controller/inc/dlg_InsertErrorBars.hxx
+++ b/chart2/source/controller/inc/dlg_InsertErrorBars.hxx
@@ -36,7 +36,6 @@ public:
                            const ::com::sun::star::uno::Reference<
                                ::com::sun::star::chart2::XChartDocument > & xChartDocument,
                            ErrorBarResources::tErrorBarType eType );
-    virtual ~InsertErrorBarsDialog();
 
     void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth );
 
diff --git a/chart2/source/controller/inc/dlg_ObjectProperties.hxx b/chart2/source/controller/inc/dlg_ObjectProperties.hxx
index 19b1bf2..8ad9fc9 100644
--- a/chart2/source/controller/inc/dlg_ObjectProperties.hxx
+++ b/chart2/source/controller/inc/dlg_ObjectProperties.hxx
@@ -132,6 +132,7 @@ public:
                     const ::com::sun::star::uno::Reference<
                             ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
     virtual ~SchAttribTabDlg();
+    virtual void dispose() SAL_OVERRIDE;
 
     //pSymbolShapeProperties: Properties to be set on the symbollist shapes
     //pAutoSymbolGraphic: Graphic to be shown if AutoSymbol gets selected
diff --git a/chart2/source/controller/inc/dlg_View3D.hxx b/chart2/source/controller/inc/dlg_View3D.hxx
index fdfb354..64228fe 100644
--- a/chart2/source/controller/inc/dlg_View3D.hxx
+++ b/chart2/source/controller/inc/dlg_View3D.hxx
@@ -41,6 +41,7 @@ public:
                   const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xChartModel,
                   const XColorListRef &pColorTable );
     virtual ~View3DDialog();
+    virtual void dispose() SAL_OVERRIDE;
 
     // from Dialog (base of TabDialog)
     virtual short Execute() SAL_OVERRIDE;
diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index a0c9784..972cbaf 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -72,6 +72,11 @@ ChartWindow::ChartWindow( ChartController* pController, vcl::Window* pParent, Wi
 
 ChartWindow::~ChartWindow()
 {
+    dispose();
+}
+
+void ChartWindow::dispose()
+{
     if (m_pWindowController && m_pWindowController->getModel().is())
     {
         uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider(m_pWindowController->getModel(), uno::UNO_QUERY_THROW);
@@ -79,6 +84,7 @@ ChartWindow::~ChartWindow()
         x3DWindowProvider->update();
     }
     delete m_pOpenGLWindow;
+    vcl::Window::dispose();
 }
 
 void ChartWindow::clear()
diff --git a/chart2/source/controller/main/ChartWindow.hxx b/chart2/source/controller/main/ChartWindow.hxx
index 2afa38a..73be579 100644
--- a/chart2/source/controller/main/ChartWindow.hxx
+++ b/chart2/source/controller/main/ChartWindow.hxx
@@ -37,6 +37,7 @@ class ChartWindow : public vcl::Window
 public:
     ChartWindow( ChartController* pController, vcl::Window* pParent, WinBits nStyle );
     virtual ~ChartWindow();
+    virtual void dispose() SAL_OVERRIDE;
 
     void clear();
 
diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx
index ba5d165..b8f0c8e 100644
--- a/chart2/source/controller/main/ElementSelector.cxx
+++ b/chart2/source/controller/main/ElementSelector.cxx
@@ -57,10 +57,6 @@ SelectorListBox::SelectorListBox( vcl::Window* pParent, WinBits nStyle )
 {
 }
 
-SelectorListBox::~SelectorListBox()
-{
-}
-
 void lcl_addObjectsToList( const ObjectHierarchy& rHierarchy, const ObjectHierarchy::tOID & rParent, std::vector< ListBoxEntryData >& rEntries
                           , const sal_Int32 nHierarchyDepth, const Reference< chart2::XChartDocument >& xChartDoc )
 {
diff --git a/chart2/source/controller/main/ElementSelector.hxx b/chart2/source/controller/main/ElementSelector.hxx
index 5c3a19d..cc70f8a 100644
--- a/chart2/source/controller/main/ElementSelector.hxx
+++ b/chart2/source/controller/main/ElementSelector.hxx
@@ -47,7 +47,6 @@ class SelectorListBox : public ListBox
 {
     public:
         SelectorListBox( vcl::Window* pParent, WinBits nStyle );
-        virtual ~SelectorListBox();
 
         virtual void Select() SAL_OVERRIDE;
         virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
commit c7727fcd7171ff1ecc5ddcc32aff0aa7707baff4
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Jan 14 16:16:15 2015 +0200

    vcl: VclPtr conversion in basctl
    
    Change-Id: Ieea1ab9426ed025d7d0f8baba8a6d10cb454e93e

diff --git a/basctl/source/basicide/basicbox.cxx b/basctl/source/basicide/basicbox.cxx
index 198e003..9bd5c9e 100644
--- a/basctl/source/basicide/basicbox.cxx
+++ b/basctl/source/basicide/basicbox.cxx
@@ -46,12 +46,6 @@ LibBoxControl::LibBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx
 
 
 
-LibBoxControl::~LibBoxControl()
-{
-}
-
-
-
 void LibBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* pState )
 {
     LibBox* pBox = static_cast<LibBox*>(GetToolBox().GetItemWindow(GetId()));
@@ -88,7 +82,13 @@ DocListenerBox::DocListenerBox( vcl::Window* pParent )
 
 DocListenerBox::~DocListenerBox()
 {
+    dispose();
+}
+
+void DocListenerBox::dispose()
+{
     m_aNotifier.dispose();
+    ListBox::dispose();
 }
 
 void DocListenerBox::onDocumentCreated( const ScriptDocument& /*_rDocument*/ )
@@ -156,7 +156,13 @@ LibBox::LibBox( vcl::Window* pParent, const uno::Reference< frame::XFrame >& rFr
 
 LibBox::~LibBox()
 {
+    dispose();
+}
+
+void LibBox::dispose()
+{
     ClearBox();
+    DocListenerBox::dispose();
 }
 
 void LibBox::Update( const SfxStringItem* pItem )
@@ -341,10 +347,6 @@ LanguageBoxControl::LanguageBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, Tool
 {
 }
 
-LanguageBoxControl::~LanguageBoxControl()
-{
-}
-
 void LanguageBoxControl::StateChanged( sal_uInt16 nID, SfxItemState eState, const SfxPoolItem* pItem )
 {
     (void)nID;
@@ -384,7 +386,13 @@ LanguageBox::LanguageBox( vcl::Window* pParent ) :
 
 LanguageBox::~LanguageBox()
 {
+    dispose();
+}
+
+void LanguageBox::dispose()
+{
     ClearBox();
+    DocListenerBox::dispose();
 }
 
 void LanguageBox::FillBox()
diff --git a/basctl/source/basicide/basicbox.hxx b/basctl/source/basicide/basicbox.hxx
index e06a51a..f13e0ea 100644
--- a/basctl/source/basicide/basicbox.hxx
+++ b/basctl/source/basicide/basicbox.hxx
@@ -33,7 +33,6 @@ public:
                         SFX_DECL_TOOLBOX_CONTROL();
 
                         LibBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
-                        virtual ~LibBoxControl();
 
     virtual void        StateChanged( sal_uInt16 nSID, SfxItemState eState,
                                       const SfxPoolItem* pState ) SAL_OVERRIDE;
@@ -49,6 +48,7 @@ class DocListenerBox    :public ListBox
 protected:
     DocListenerBox( vcl::Window* pParent );
     virtual ~DocListenerBox();
+    virtual void dispose() SAL_OVERRIDE;
 
 protected:
     virtual void    FillBox() = 0;
@@ -95,7 +95,8 @@ protected:
 public:
                     LibBox( vcl::Window* pParent,
                                  const com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
-                    virtual ~LibBox();
+    virtual         ~LibBox();
+    virtual void    dispose() SAL_OVERRIDE;
 
     using           Window::Update;
     void            Update( const SfxStringItem* pItem );
@@ -107,7 +108,6 @@ public:
                         SFX_DECL_TOOLBOX_CONTROL();
 
                         LanguageBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
-                        virtual ~LanguageBoxControl();
 
     virtual void        StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) SAL_OVERRIDE;
     virtual vcl::Window*     CreateItemWindow( vcl::Window *pParent ) SAL_OVERRIDE;
@@ -135,6 +135,7 @@ protected:
 public:
     LanguageBox( vcl::Window* pParent );
     virtual ~LanguageBox();
+    virtual void    dispose() SAL_OVERRIDE;
 
     using           Window::Update;
     void            Update( const SfxStringItem* pItem );
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index d8bf5b4..7cb3a39 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -192,10 +192,10 @@ ModulWindow::ModulWindow (
     BaseWindow(pParent, rDocument, aLibName, aName),
     rLayout(*pParent),
     nValid(ValidWindow),
-    aXEditorWindow(this),
+    aXEditorWindow(new ComplexEditorWindow(this)),
     m_aModule(aModule)
 {
-    aXEditorWindow.Show();
+    aXEditorWindow->Show();
     SetBackground();
 }
 
@@ -227,9 +227,15 @@ SbModuleRef ModulWindow::XModule()
 
 ModulWindow::~ModulWindow()
 {
-    nValid = 0;
+    dispose();
+}
 
+void ModulWindow::dispose()
+{
+    nValid = 0;
     StarBASIC::Stop();
+    aXEditorWindow.disposeAndClear();
+    BaseWindow::dispose();
 }
 
 
@@ -237,7 +243,7 @@ void ModulWindow::GetFocus()
 {
     if (nValid != ValidWindow)
         return;
-    aXEditorWindow.GetEdtWindow().GrabFocus();
+    aXEditorWindow->GetEdtWindow().GrabFocus();
     // don't call basic calls because focus is somewhere else...
 }
 
@@ -256,7 +262,7 @@ void ModulWindow::Paint( const Rectangle& )
 
 void ModulWindow::Resize()
 {
-    aXEditorWindow.SetPosSizePixel( Point( 0, 0 ),
+    aXEditorWindow->SetPosSizePixel( Point( 0, 0 ),
                                     Size( GetOutputSizePixel() ) );
 }
 
@@ -580,7 +586,7 @@ bool ModulWindow::BasicToggleBreakPoint()
             bNewBreakPoint = true;
     }
 
-    aXEditorWindow.GetBrkWindow().Invalidate();
+    aXEditorWindow->GetBrkWindow().Invalidate();
     return bNewBreakPoint;
 }
 
@@ -638,7 +644,7 @@ bool ModulWindow::BasicErrorHdl( StarBASIC * pBasic )
     // if other basic, the IDE should try to display the correct module
     bool const bMarkError = pBasic == GetBasic();
     if ( bMarkError )
-        aXEditorWindow.GetBrkWindow().SetMarkerPos(nErrorLine, true);
+        aXEditorWindow->GetBrkWindow().SetMarkerPos(nErrorLine, true);
 
     // #i47002#
     Reference< awt::XWindow > xWindow = VCLUnoHelper::GetInterface( this );
@@ -651,7 +657,7 @@ bool ModulWindow::BasicErrorHdl( StarBASIC * pBasic )
         return false;
 
     if ( bMarkError )
-        aXEditorWindow.GetBrkWindow().SetNoMarker();
+        aXEditorWindow->GetBrkWindow().SetNoMarker();
     return false;
 }
 
@@ -676,7 +682,7 @@ long ModulWindow::BasicBreakHdl( StarBASIC* pBasic )
 
     AssertValidEditEngine();
     GetEditView()->SetSelection( TextSelection( TextPaM( nErrorLine, 0 ), TextPaM( nErrorLine, 0 ) ) );
-    aXEditorWindow.GetBrkWindow().SetMarkerPos( nErrorLine );
+    aXEditorWindow->GetBrkWindow().SetMarkerPos( nErrorLine );
 
     rLayout.UpdateDebug(false);
 
@@ -691,7 +697,7 @@ long ModulWindow::BasicBreakHdl( StarBASIC* pBasic )
         Application::Yield();
 
     aStatus.bIsInReschedule = false;
-    aXEditorWindow.GetBrkWindow().SetNoMarker();
+    aXEditorWindow->GetBrkWindow().SetNoMarker();
 
     ClearStatus( BASWIN_INRESCHEDULE );
 
@@ -1022,7 +1028,7 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq)
         {
             SFX_REQUEST_ARG(rReq, pItem, SfxBoolItem, rReq.GetSlot(), false);
             bSourceLinesEnabled = pItem && pItem->GetValue();
-            aXEditorWindow.SetLineNumberDisplay(bSourceLinesEnabled);
+            aXEditorWindow->SetLineNumberDisplay(bSourceLinesEnabled);
         }
         break;
         case SID_BASICIDE_DELETECURRENT:
@@ -1213,7 +1219,7 @@ void ModulWindow::AssertValidEditEngine()
 
 void ModulWindow::Activating ()
 {
-    aXEditorWindow.SetLineNumberDisplay(bSourceLinesEnabled);
+    aXEditorWindow->SetLineNumberDisplay(bSourceLinesEnabled);
     Show();
 }
 
@@ -1394,7 +1400,7 @@ bool ModulWindow::IsPasteAllowed()
 
 void ModulWindow::OnNewDocument ()
 {
-    aXEditorWindow.SetLineNumberDisplay(bSourceLinesEnabled);
+    aXEditorWindow->SetLineNumberDisplay(bSourceLinesEnabled);
 }
 
 char const* ModulWindow::GetHid () const
@@ -1438,15 +1444,27 @@ void ModulWindow::UpdateModule ()
 ModulWindowLayout::ModulWindowLayout (vcl::Window* pParent, ObjectCatalog& rObjectCatalog_) :
     Layout(pParent),
     pChild(0),
-    aWatchWindow(this),
-    aStackWindow(this),
+    aWatchWindow(new WatchWindow(this)),
+    aStackWindow(new StackWindow(this)),
     rObjectCatalog(rObjectCatalog_)
 { }
 
+ModulWindowLayout::~ModulWindowLayout()
+{
+    dispose();
+}
+
+void ModulWindowLayout::dispose()
+{
+    aWatchWindow.disposeAndClear();
+    aStackWindow.disposeAndClear();
+    Layout::dispose();
+}
+
 void ModulWindowLayout::UpdateDebug (bool bBasicStopped)
 {
-    aWatchWindow.UpdateWatches(bBasicStopped);
-    aStackWindow.UpdateCalls();
+    aWatchWindow->UpdateWatches(bBasicStopped);
+    aStackWindow->UpdateCalls();
 }
 
 void ModulWindowLayout::Paint (Rectangle const&)
@@ -1467,8 +1485,8 @@ void ModulWindowLayout::Activating (BaseWindow& rChild)
 {
     assert(dynamic_cast<ModulWindow*>(&rChild));
     pChild = &static_cast<ModulWindow&>(rChild);
-    aWatchWindow.Show();
-    aStackWindow.Show();
+    aWatchWindow->Show();
+    aStackWindow->Show();
     rObjectCatalog.Show();
     rObjectCatalog.SetLayoutWindow(this);
     rObjectCatalog.UpdateEntries();
@@ -1480,8 +1498,8 @@ void ModulWindowLayout::Deactivating ()
 {
     aSyntaxColors.SetActiveEditor(0);
     Layout::Deactivating();
-    aWatchWindow.Hide();
-    aStackWindow.Hide();
+    aWatchWindow->Hide();
+    aStackWindow->Hide();
     rObjectCatalog.Hide();
     pChild = 0;
 }
@@ -1502,19 +1520,19 @@ void ModulWindowLayout::GetState (SfxItemSet &rSet, unsigned nWhich)
 
 void ModulWindowLayout::BasicAddWatch (OUString const& rWatchStr)
 {
-    aWatchWindow.AddWatch(rWatchStr);
+    aWatchWindow->AddWatch(rWatchStr);
 }
 
 void ModulWindowLayout::BasicRemoveWatch ()
 {
-    aWatchWindow.RemoveSelectedWatch();
+    aWatchWindow->RemoveSelectedWatch();
 }
 
 void ModulWindowLayout::OnFirstSize (long const nWidth, long const nHeight)
 {
     AddToLeft(&rObjectCatalog, Size(nWidth * 0.20, nHeight * 0.75));
-    AddToBottom(&aWatchWindow, Size(nWidth * 0.67, nHeight * 0.25));
-    AddToBottom(&aStackWindow, Size(nWidth * 0.33, nHeight * 0.25));
+    AddToBottom(aWatchWindow.get(), Size(nWidth * 0.67, nHeight * 0.25));
+    AddToBottom(aStackWindow.get(), Size(nWidth * 0.33, nHeight * 0.25));
 }
 
 
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 1008643..6a53da0 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -136,6 +136,7 @@ protected:
 public:
                     EditorWindow (vcl::Window* pParent, ModulWindow*);
                     virtual ~EditorWindow();
+    virtual void    dispose() SAL_OVERRIDE;
 
     ExtTextEngine*  GetEditEngine() const   { return pEditEngine.get(); }
     ExtTextView*    GetEditView() const     { return pEditView.get(); }
@@ -183,7 +184,6 @@ protected:
 
 public:
                     BreakPointWindow (vcl::Window* pParent, ModulWindow*);
-                    virtual ~BreakPointWindow();
 
     void            SetMarkerPos( sal_uInt16 nLine, bool bErrorMarker = false );
     void            SetNoMarker ();
@@ -208,6 +208,7 @@ protected:
 public:
     WatchTreeListBox( vcl::Window* pParent, WinBits nWinBits );
     virtual ~WatchTreeListBox();
+    virtual void    dispose() SAL_OVERRIDE;
 
     void            RequestingChildren( SvTreeListEntry * pParent ) SAL_OVERRIDE;
     void            UpdateWatches( bool bBasicStopped = false );
@@ -222,10 +223,10 @@ class WatchWindow : public DockingWindow
 {
 private:
     OUString            aWatchStr;
-    ExtendedEdit        aXEdit;
-    ImageButton         aRemoveWatchButton;
-    WatchTreeListBox    aTreeListBox;
-    HeaderBar           aHeaderBar;
+    VclPtr<ExtendedEdit>        aXEdit;
+    VclPtr<ImageButton>         aRemoveWatchButton;
+    VclPtr<WatchTreeListBox>    aTreeListBox;
+    VclPtr<HeaderBar>           aHeaderBar;
 
 protected:
     virtual void    Resize() SAL_OVERRIDE;
@@ -240,20 +241,21 @@ protected:
 public:
                     WatchWindow (Layout* pParent);
                     virtual ~WatchWindow();
+    virtual void    dispose() SAL_OVERRIDE;
 
     void            AddWatch( const OUString& rVName );
     bool            RemoveSelectedWatch();
     void            UpdateWatches( bool bBasicStopped = false );
 
-    WatchTreeListBox&   GetWatchTreeListBox() { return aTreeListBox; }
+    WatchTreeListBox&   GetWatchTreeListBox() { return *aTreeListBox.get(); }
 };
 
 
 class StackWindow : public DockingWindow
 {
 private:
-    SvTreeListBox   aTreeListBox;
-    OUString        aStackStr;
+    VclPtr<SvTreeListBox>  aTreeListBox;
+    OUString               aStackStr;
 
 protected:
     virtual void    Resize() SAL_OVERRIDE;
@@ -262,6 +264,7 @@ protected:
 public:
                     StackWindow (Layout* pParent);
                     virtual ~StackWindow();
+    virtual void    dispose() SAL_OVERRIDE;
 
     void            UpdateCalls();
 };
@@ -270,10 +273,10 @@ public:
 class ComplexEditorWindow : public vcl::Window
 {
 private:
-    BreakPointWindow    aBrkWindow;
-    LineNumberWindow    aLineNumberWindow;
-    EditorWindow        aEdtWindow;
-    ScrollBar           aEWVScrollBar;
+    VclPtr<BreakPointWindow> aBrkWindow;
+    VclPtr<LineNumberWindow> aLineNumberWindow;
+    VclPtr<EditorWindow>     aEdtWindow;
+    VclPtr<ScrollBar>        aEWVScrollBar;
 
     virtual void DataChanged(DataChangedEvent const & rDCEvt) SAL_OVERRIDE;
 
@@ -283,11 +286,12 @@ protected:
 
 public:
                         ComplexEditorWindow( ModulWindow* pParent );
-
-    BreakPointWindow&   GetBrkWindow()      { return aBrkWindow; }
-    LineNumberWindow&   GetLineNumberWindow() { return aLineNumberWindow; }
-    EditorWindow&       GetEdtWindow()      { return aEdtWindow; }
-    ScrollBar&          GetEWVScrollBar()   { return aEWVScrollBar; }
+    virtual             ~ComplexEditorWindow();
+    virtual void        dispose() SAL_OVERRIDE;
+    BreakPointWindow&   GetBrkWindow()      { return *aBrkWindow.get(); }
+    LineNumberWindow&   GetLineNumberWindow() { return *aLineNumberWindow.get(); }
+    EditorWindow&       GetEdtWindow()      { return *aEdtWindow.get(); }
+    ScrollBar&          GetEWVScrollBar()   { return *aEWVScrollBar.get(); }
 
     void SetLineNumberDisplay(bool b);
 };
@@ -299,7 +303,7 @@ private:
     ModulWindowLayout&  rLayout;
     StarBASICRef        xBasic;
     short               nValid;
-    ComplexEditorWindow aXEditorWindow;
+    VclPtr<ComplexEditorWindow> aXEditorWindow;
     BasicStatus         aStatus;
     SbModuleRef         xModule;
     OUString            aCurPath;
@@ -325,6 +329,7 @@ public:
     ModulWindow( ModulWindowLayout* pParent, const ScriptDocument& rDocument, const OUString& aLibName, const OUString& aName, OUString& aModule );
 
                     virtual ~ModulWindow();
+    virtual void    dispose() SAL_OVERRIDE;
 
     virtual void    ExecuteCommand (SfxRequest& rReq) SAL_OVERRIDE;
     virtual void    ExecuteGlobal (SfxRequest& rReq) SAL_OVERRIDE;
@@ -384,10 +389,10 @@ public:
     virtual sal_uInt16  GetSearchOptions() SAL_OVERRIDE;
     virtual sal_uInt16  StartSearchAndReplace (SvxSearchItem const&, bool bFromStart = false) SAL_OVERRIDE;
 
-    EditorWindow&       GetEditorWindow()       { return aXEditorWindow.GetEdtWindow(); }
-    BreakPointWindow&   GetBreakPointWindow()   { return aXEditorWindow.GetBrkWindow(); }
-    LineNumberWindow&   GetLineNumberWindow()   { return aXEditorWindow.GetLineNumberWindow(); }
-    ScrollBar&          GetEditVScrollBar()     { return aXEditorWindow.GetEWVScrollBar(); }
+    EditorWindow&       GetEditorWindow()       { return aXEditorWindow->GetEdtWindow(); }
+    BreakPointWindow&   GetBreakPointWindow()   { return aXEditorWindow->GetBrkWindow(); }
+    LineNumberWindow&   GetLineNumberWindow()   { return aXEditorWindow->GetLineNumberWindow(); }
+    ScrollBar&          GetEditVScrollBar()     { return aXEditorWindow->GetEWVScrollBar(); }
     ExtTextEngine*      GetEditEngine()         { return GetEditorWindow().GetEditEngine(); }
     ExtTextView*        GetEditView()           { return GetEditorWindow().GetEditView(); }
     BreakPointList&     GetBreakPoints()        { return GetBreakPointWindow().GetBreakPoints(); }
@@ -417,6 +422,8 @@ class ModulWindowLayout: public Layout
 {
 public:
     ModulWindowLayout (vcl::Window* pParent, ObjectCatalog&);
+    virtual ~ModulWindowLayout();
+    virtual void dispose() SAL_OVERRIDE;
 public:
     // Layout:
     virtual void Activating (BaseWindow&) SAL_OVERRIDE;
@@ -438,8 +445,8 @@ private:
     // main child window
     ModulWindow* pChild;
     // dockable windows
-    WatchWindow aWatchWindow;
-    StackWindow aStackWindow;
+    VclPtr<WatchWindow> aWatchWindow;
+    VclPtr<StackWindow> aStackWindow;
     ObjectCatalog& rObjectCatalog;
 private:
     virtual void DataChanged (DataChangedEvent const& rDCEvt) SAL_OVERRIDE;
@@ -509,7 +516,8 @@ private:
 
 public:
     CodeCompleteWindow( EditorWindow* pPar );
-    virtual ~CodeCompleteWindow(){ delete pListBox; }
+    virtual ~CodeCompleteWindow();
+    virtual void dispose() SAL_OVERRIDE;
 
     void InsertEntry( const OUString& aStr );
     void ClearListBox();
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 452bf87..8c1805d 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -250,6 +250,11 @@ EditorWindow::EditorWindow (vcl::Window* pParent, ModulWindow* pModulWindow) :
 
 EditorWindow::~EditorWindow()
 {
+    dispose();
+}
+
+void EditorWindow::dispose()
+{
     Reference< beans::XMultiPropertySet > n;
     {
         osl::MutexGuard g(mutex_);
@@ -1354,12 +1359,6 @@ BreakPointWindow::BreakPointWindow (vcl::Window* pParent, ModulWindow* pModulWin
     SetHelpId(HID_BASICIDE_BREAKPOINTWINDOW);
 }
 
-BreakPointWindow::~BreakPointWindow()
-{
-}
-
-
-
 void BreakPointWindow::Paint( const Rectangle& )
 {
     if ( SyncYOffset() )
@@ -1576,69 +1575,69 @@ namespace
 WatchWindow::WatchWindow (Layout* pParent) :
     DockingWindow(pParent),
     aWatchStr( IDEResId( RID_STR_REMOVEWATCH ) ),
-    aXEdit( this, IDEResId( RID_EDT_WATCHEDIT ) ),
-    aRemoveWatchButton( this, IDEResId( RID_IMGBTN_REMOVEWATCH ) ),
-    aTreeListBox( this, WB_BORDER | WB_3DLOOK | WB_HASBUTTONS | WB_HASLINES | WB_HSCROLL | WB_TABSTOP
-                                  | WB_HASLINESATROOT | WB_HASBUTTONSATROOT ),
-    aHeaderBar( this, WB_BUTTONSTYLE | WB_BORDER )
+    aXEdit( new ExtendedEdit(this, IDEResId( RID_EDT_WATCHEDIT )) ),
+    aRemoveWatchButton( new ImageButton(this, IDEResId( RID_IMGBTN_REMOVEWATCH )) ),
+    aTreeListBox( new WatchTreeListBox(this, WB_BORDER | WB_3DLOOK | WB_HASBUTTONS | WB_HASLINES | WB_HSCROLL | WB_TABSTOP
+                                  | WB_HASLINESATROOT | WB_HASBUTTONSATROOT) ),
+    aHeaderBar( new HeaderBar( this, WB_BUTTONSTYLE | WB_BORDER ) )
 {
-    aXEdit.SetAccessibleName(IDEResId(RID_STR_WATCHNAME).toString());
-    aTreeListBox.SetAccessibleName(IDEResId(RID_STR_WATCHNAME).toString());
+    aXEdit->SetAccessibleName(IDEResId(RID_STR_WATCHNAME).toString());
+    aTreeListBox->SetAccessibleName(IDEResId(RID_STR_WATCHNAME).toString());
 
     long nTextLen = GetTextWidth( aWatchStr ) + DWBORDER + 3;
-    aXEdit.SetPosPixel( Point( nTextLen, 3 ) );
-    aXEdit.SetAccHdl( LINK( this, WatchWindow, EditAccHdl ) );
-    aXEdit.GetAccelerator().InsertItem( 1, vcl::KeyCode( KEY_RETURN ) );
-    aXEdit.GetAccelerator().InsertItem( 2, vcl::KeyCode( KEY_ESCAPE ) );
-    aXEdit.Show();
-
-    aRemoveWatchButton.Disable();
-    aRemoveWatchButton.SetClickHdl( LINK( this, WatchWindow, ButtonHdl ) );
-    aRemoveWatchButton.SetPosPixel( Point( nTextLen + aXEdit.GetSizePixel().Width() + 4, 2 ) );
-    Size aSz( aRemoveWatchButton.GetModeImage().GetSizePixel() );
+    aXEdit->SetPosPixel( Point( nTextLen, 3 ) );
+    aXEdit->SetAccHdl( LINK( this, WatchWindow, EditAccHdl ) );
+    aXEdit->GetAccelerator().InsertItem( 1, vcl::KeyCode( KEY_RETURN ) );
+    aXEdit->GetAccelerator().InsertItem( 2, vcl::KeyCode( KEY_ESCAPE ) );
+    aXEdit->Show();
+
+    aRemoveWatchButton->Disable();
+    aRemoveWatchButton->SetClickHdl( LINK( this, WatchWindow, ButtonHdl ) );
+    aRemoveWatchButton->SetPosPixel( Point( nTextLen + aXEdit->GetSizePixel().Width() + 4, 2 ) );
+    Size aSz( aRemoveWatchButton->GetModeImage().GetSizePixel() );
     aSz.Width() += 6;
     aSz.Height() += 6;
-    aRemoveWatchButton.SetSizePixel( aSz );
-    aRemoveWatchButton.Show();
+    aRemoveWatchButton->SetSizePixel( aSz );
+    aRemoveWatchButton->Show();
 
-    long nRWBtnSize = aRemoveWatchButton.GetModeImage().GetSizePixel().Height() + 10;
-    nVirtToolBoxHeight = aXEdit.GetSizePixel().Height() + 7;
+    long nRWBtnSize = aRemoveWatchButton->GetModeImage().GetSizePixel().Height() + 10;
+    nVirtToolBoxHeight = aXEdit->GetSizePixel().Height() + 7;
 
     if ( nRWBtnSize > nVirtToolBoxHeight )
         nVirtToolBoxHeight = nRWBtnSize;
 
     nHeaderBarHeight = 16;
 
-    aTreeListBox.SetHelpId(HID_BASICIDE_WATCHWINDOW_LIST);
-    aTreeListBox.EnableInplaceEditing(true);
-    aTreeListBox.SetSelectHdl( LINK( this, WatchWindow, TreeListHdl ) );
-    aTreeListBox.SetPosPixel( Point( DWBORDER, nVirtToolBoxHeight + nHeaderBarHeight ) );
-    aTreeListBox.SetHighlightRange( 1, 5 );
+    aTreeListBox->SetHelpId(HID_BASICIDE_WATCHWINDOW_LIST);
+    aTreeListBox->EnableInplaceEditing(true);
+    aTreeListBox->SetSelectHdl( LINK( this, WatchWindow, TreeListHdl ) );
+    aTreeListBox->SetPosPixel( Point( DWBORDER, nVirtToolBoxHeight + nHeaderBarHeight ) );
+    aTreeListBox->SetHighlightRange( 1, 5 );
 
     Point aPnt( DWBORDER, nVirtToolBoxHeight + 1 );
-    aHeaderBar.SetPosPixel( aPnt );
-    aHeaderBar.SetEndDragHdl( LINK( this, WatchWindow, implEndDragHdl ) );
+    aHeaderBar->SetPosPixel( aPnt );
+    aHeaderBar->SetEndDragHdl( LINK( this, WatchWindow, implEndDragHdl ) );
 
     long nVarTabWidth = 220;
     long nValueTabWidth = 100;
     long nTypeTabWidth = 1250;
-    aHeaderBar.InsertItem( ITEM_ID_VARIABLE, IDEResId(RID_STR_WATCHVARIABLE).toString(), nVarTabWidth );
-    aHeaderBar.InsertItem( ITEM_ID_VALUE, IDEResId(RID_STR_WATCHVALUE).toString(), nValueTabWidth );
-    aHeaderBar.InsertItem( ITEM_ID_TYPE, IDEResId(RID_STR_WATCHTYPE).toString(), nTypeTabWidth );
+    aHeaderBar->InsertItem( ITEM_ID_VARIABLE, IDEResId(RID_STR_WATCHVARIABLE).toString(), nVarTabWidth );
+    aHeaderBar->InsertItem( ITEM_ID_VALUE, IDEResId(RID_STR_WATCHVALUE).toString(), nValueTabWidth );
+    aHeaderBar->InsertItem( ITEM_ID_TYPE, IDEResId(RID_STR_WATCHTYPE).toString(), nTypeTabWidth );
 
     long tabs[ 4 ];
     tabs[ 0 ] = 3; // two tabs
     tabs[ 1 ] = 0;
     tabs[ 2 ] = nVarTabWidth;
     tabs[ 3 ] = nVarTabWidth + nValueTabWidth;
-    aTreeListBox.SvHeaderTabListBox::SetTabs( tabs, MAP_PIXEL );
-    aTreeListBox.InitHeaderBar( &aHeaderBar );
+    aTreeListBox->SvHeaderTabListBox::SetTabs( tabs, MAP_PIXEL );
+    aTreeListBox->InitHeaderBar( aHeaderBar.get() );
 
-    aTreeListBox.SetNodeDefaultImages( );
+    aTreeListBox->SetNodeDefaultImages( );
 
-    aHeaderBar.Show();
+    aHeaderBar->Show();
 
-    aTreeListBox.Show();
+    aTreeListBox->Show();
 
     SetText(IDEResId(RID_STR_WATCHNAME).toString());
 
@@ -1652,6 +1651,15 @@ WatchWindow::WatchWindow (Layout* pParent) :
 
 WatchWindow::~WatchWindow()
 {
+    dispose();
+}
+
+void WatchWindow::dispose()
+{
+    aXEdit.disposeAndClear();
+    aRemoveWatchButton.disposeAndClear();
+    aHeaderBar.disposeAndClear();
+    aTreeListBox.disposeAndClear();
     GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this );
 }
 
@@ -1676,11 +1684,11 @@ void WatchWindow::Resize()
         aBoxSz.Height() = 0;
 
     aBoxSz.Height() -= nHeaderBarHeight;
-    aTreeListBox.SetSizePixel( aBoxSz );
-    aTreeListBox.GetHScroll()->SetPageSize( aTreeListBox.GetHScroll()->GetVisibleSize() );
+    aTreeListBox->SetSizePixel( aBoxSz );
+    aTreeListBox->GetHScroll()->SetPageSize( aTreeListBox->GetHScroll()->GetVisibleSize() );
 
     aBoxSz.Height() = nHeaderBarHeight;
-    aHeaderBar.SetSizePixel( aBoxSz );
+    aHeaderBar->SetSizePixel( aBoxSz );
 
     Invalidate();
 }
@@ -1744,29 +1752,29 @@ void WatchWindow::AddWatch( const OUString& rVName )
 
     OUString aWatchStr_( aVar );
     aWatchStr_ += "\t\t";
-    SvTreeListEntry* pNewEntry = aTreeListBox.InsertEntry( aWatchStr_, 0, true, TREELIST_APPEND );
+    SvTreeListEntry* pNewEntry = aTreeListBox->InsertEntry( aWatchStr_, 0, true, TREELIST_APPEND );
     pNewEntry->SetUserData( pWatchItem );
 
-    aTreeListBox.Select(pNewEntry, true);
-    aTreeListBox.MakeVisible(pNewEntry);
-    aRemoveWatchButton.Enable();
+    aTreeListBox->Select(pNewEntry, true);
+    aTreeListBox->MakeVisible(pNewEntry);
+    aRemoveWatchButton->Enable();
 
     UpdateWatches();
 }
 
 bool WatchWindow::RemoveSelectedWatch()
 {
-    SvTreeListEntry* pEntry = aTreeListBox.GetCurEntry();
+    SvTreeListEntry* pEntry = aTreeListBox->GetCurEntry();
     if ( pEntry )
     {
-        aTreeListBox.GetModel()->Remove( pEntry );
-        pEntry = aTreeListBox.GetCurEntry();
+        aTreeListBox->GetModel()->Remove( pEntry );
+        pEntry = aTreeListBox->GetCurEntry();
         if ( pEntry )
-            aXEdit.SetText( ((WatchItem*)pEntry->GetUserData())->maName );
+            aXEdit->SetText( ((WatchItem*)pEntry->GetUserData())->maName );
         else
-            aXEdit.SetText( OUString() );
-        if ( !aTreeListBox.GetEntryCount() )
-            aRemoveWatchButton.Disable();
+            aXEdit->SetText( OUString() );
+        if ( !aTreeListBox->GetEntryCount() )
+            aRemoveWatchButton->Disable();
         return true;
     }
     else
@@ -1776,7 +1784,7 @@ bool WatchWindow::RemoveSelectedWatch()
 
 IMPL_LINK_INLINE_START( WatchWindow, ButtonHdl, ImageButton *, pButton )
 {
-    if (pButton == &aRemoveWatchButton)
+    if (pButton == aRemoveWatchButton.get())
         if (SfxDispatcher* pDispatcher = GetDispatcher())
             pDispatcher->Execute(SID_BASICIDE_REMOVEWATCH);
     return 0;
@@ -1787,9 +1795,9 @@ IMPL_LINK_INLINE_END( WatchWindow, ButtonHdl, ImageButton *, pButton )
 
 IMPL_LINK_NOARG_INLINE_START(WatchWindow, TreeListHdl)
 {
-    SvTreeListEntry* pCurEntry = aTreeListBox.GetCurEntry();
+    SvTreeListEntry* pCurEntry = aTreeListBox->GetCurEntry();
     if ( pCurEntry && pCurEntry->GetUserData() )
-        aXEdit.SetText( ((WatchItem*)pCurEntry->GetUserData())->maName );
+        aXEdit->SetText( ((WatchItem*)pCurEntry->GetUserData())->maName );
 
     return 0;
 }
@@ -1802,29 +1810,29 @@ IMPL_LINK_INLINE_START( WatchWindow, implEndDragHdl, HeaderBar *, pBar )
 
     const sal_Int32 TAB_WIDTH_MIN = 10;
     sal_Int32 nMaxWidth =
-        aHeaderBar.GetSizePixel().getWidth() - 2 * TAB_WIDTH_MIN;
+        aHeaderBar->GetSizePixel().getWidth() - 2 * TAB_WIDTH_MIN;
 
-    sal_Int32 nVariableWith = aHeaderBar.GetItemSize( ITEM_ID_VARIABLE );
+    sal_Int32 nVariableWith = aHeaderBar->GetItemSize( ITEM_ID_VARIABLE );
     if( nVariableWith < TAB_WIDTH_MIN )
-        aHeaderBar.SetItemSize( ITEM_ID_VARIABLE, TAB_WIDTH_MIN );
+        aHeaderBar->SetItemSize( ITEM_ID_VARIABLE, TAB_WIDTH_MIN );
     else if( nVariableWith > nMaxWidth )
-        aHeaderBar.SetItemSize( ITEM_ID_VARIABLE, nMaxWidth );
+        aHeaderBar->SetItemSize( ITEM_ID_VARIABLE, nMaxWidth );
 
-    sal_Int32 nValueWith = aHeaderBar.GetItemSize( ITEM_ID_VALUE );
+    sal_Int32 nValueWith = aHeaderBar->GetItemSize( ITEM_ID_VALUE );
     if( nValueWith < TAB_WIDTH_MIN )
-        aHeaderBar.SetItemSize( ITEM_ID_VALUE, TAB_WIDTH_MIN );
+        aHeaderBar->SetItemSize( ITEM_ID_VALUE, TAB_WIDTH_MIN );
     else if( nValueWith > nMaxWidth )
-        aHeaderBar.SetItemSize( ITEM_ID_VALUE, nMaxWidth );
+        aHeaderBar->SetItemSize( ITEM_ID_VALUE, nMaxWidth );
 
-    if (aHeaderBar.GetItemSize( ITEM_ID_TYPE ) < TAB_WIDTH_MIN)
-        aHeaderBar.SetItemSize( ITEM_ID_TYPE, TAB_WIDTH_MIN );
+    if (aHeaderBar->GetItemSize( ITEM_ID_TYPE ) < TAB_WIDTH_MIN)
+        aHeaderBar->SetItemSize( ITEM_ID_TYPE, TAB_WIDTH_MIN );
 
     sal_Int32 nPos = 0;
-    sal_uInt16 nTabs = aHeaderBar.GetItemCount();
+    sal_uInt16 nTabs = aHeaderBar->GetItemCount();
     for( sal_uInt16 i = 1 ; i < nTabs ; ++i )
     {
-        nPos += aHeaderBar.GetItemSize( i );
-        aTreeListBox.SetTab( i, nPos, MAP_PIXEL );
+        nPos += aHeaderBar->GetItemSize( i );
+        aTreeListBox->SetTab( i, nPos, MAP_PIXEL );
     }
     return 0;
 }
@@ -1837,17 +1845,17 @@ IMPL_LINK( WatchWindow, EditAccHdl, Accelerator *, pAcc )
     {
         case KEY_RETURN:
         {
-            OUString aCurText( aXEdit.GetText() );
+            OUString aCurText( aXEdit->GetText() );
             if ( !aCurText.isEmpty() )
             {
                 AddWatch( aCurText );
-                aXEdit.SetSelection( Selection( 0, 0xFFFF ) );
+                aXEdit->SetSelection( Selection( 0, 0xFFFF ) );
             }
         }
         break;
         case KEY_ESCAPE:
         {
-            aXEdit.SetText( OUString() );
+            aXEdit->SetText( OUString() );
         }
         break;
     }
@@ -1857,7 +1865,7 @@ IMPL_LINK( WatchWindow, EditAccHdl, Accelerator *, pAcc )
 
 void WatchWindow::UpdateWatches( bool bBasicStopped )
 {
-    aTreeListBox.UpdateWatches( bBasicStopped );
+    aTreeListBox->UpdateWatches( bBasicStopped );
 }
 
 
@@ -1868,16 +1876,16 @@ void WatchWindow::UpdateWatches( bool bBasicStopped )
 
 StackWindow::StackWindow (Layout* pParent) :
     DockingWindow(pParent),
-    aTreeListBox( this, WB_BORDER | WB_3DLOOK | WB_HSCROLL | WB_TABSTOP ),
+    aTreeListBox( new SvTreeListBox(this, WB_BORDER | WB_3DLOOK | WB_HSCROLL | WB_TABSTOP) ),
     aStackStr( IDEResId( RID_STR_STACK ) )
 {
-    aTreeListBox.SetHelpId(HID_BASICIDE_STACKWINDOW_LIST);
-    aTreeListBox.SetAccessibleName(IDEResId(RID_STR_STACKNAME).toString());
-    aTreeListBox.SetPosPixel( Point( DWBORDER, nVirtToolBoxHeight ) );
-    aTreeListBox.SetHighlightRange();
-    aTreeListBox.SetSelectionMode( NO_SELECTION );
-    aTreeListBox.InsertEntry( OUString(), 0, false, TREELIST_APPEND );
-    aTreeListBox.Show();
+    aTreeListBox->SetHelpId(HID_BASICIDE_STACKWINDOW_LIST);
+    aTreeListBox->SetAccessibleName(IDEResId(RID_STR_STACKNAME).toString());
+    aTreeListBox->SetPosPixel( Point( DWBORDER, nVirtToolBoxHeight ) );
+    aTreeListBox->SetHighlightRange();
+    aTreeListBox->SetSelectionMode( NO_SELECTION );
+    aTreeListBox->InsertEntry( OUString(), 0, false, TREELIST_APPEND );
+    aTreeListBox->Show();
 
     SetText(IDEResId(RID_STR_STACKNAME).toString());
 
@@ -1891,7 +1899,14 @@ StackWindow::StackWindow (Layout* pParent) :
 
 StackWindow::~StackWindow()
 {
+    dispose();
+}
+
+void StackWindow::dispose()
+{
     GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this );
+    aTreeListBox.disposeAndClear();
+    DockingWindow::dispose();
 }
 
 
@@ -1914,20 +1929,20 @@ void StackWindow::Resize()
     if ( aBoxSz.Height() < 4 )
         aBoxSz.Height() = 0;
 
-    aTreeListBox.SetSizePixel( aBoxSz );
+    aTreeListBox->SetSizePixel( aBoxSz );
 
     Invalidate();
 }
 
 void StackWindow::UpdateCalls()
 {
-    aTreeListBox.SetUpdateMode(false);
-    aTreeListBox.Clear();
+    aTreeListBox->SetUpdateMode(false);
+    aTreeListBox->Clear();
 
     if ( StarBASIC::IsRunning() )
     {
         SbxError eOld = SbxBase::GetError();
-        aTreeListBox.SetSelectionMode( SINGLE_SELECTION );
+        aTreeListBox->SetSelectionMode( SINGLE_SELECTION );
 
         sal_Int32 nScope = 0;
         SbMethod* pMethod = StarBASIC::GetActiveMethod( nScope );
@@ -1976,7 +1991,7 @@ void StackWindow::UpdateCalls()
                 }
                 aEntry += ")";
             }
-            aTreeListBox.InsertEntry( aEntry, 0, false, TREELIST_APPEND );
+            aTreeListBox->InsertEntry( aEntry, 0, false, TREELIST_APPEND );
             nScope++;
             pMethod = StarBASIC::GetActiveMethod( nScope );
         }
@@ -1987,11 +2002,11 @@ void StackWindow::UpdateCalls()
     }
     else
     {
-        aTreeListBox.SetSelectionMode( NO_SELECTION );
-        aTreeListBox.InsertEntry( OUString(), 0, false, TREELIST_APPEND );
+        aTreeListBox->SetSelectionMode( NO_SELECTION );
+        aTreeListBox->InsertEntry( OUString(), 0, false, TREELIST_APPEND );
     }
 
-    aTreeListBox.SetUpdateMode(true);
+    aTreeListBox->SetUpdateMode(true);
 }
 
 
@@ -2002,18 +2017,33 @@ void StackWindow::UpdateCalls()
 
 ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) :
     Window( pParent, WB_3DLOOK | WB_CLIPCHILDREN ),
-    aBrkWindow(this, pParent),
-    aLineNumberWindow(this, pParent),
-    aEdtWindow(this, pParent),
-    aEWVScrollBar( this, WB_VSCROLL | WB_DRAG )
+    aBrkWindow(new BreakPointWindow(this, pParent)),
+    aLineNumberWindow(new LineNumberWindow(this, pParent)),
+    aEdtWindow(new EditorWindow(this, pParent)),
+    aEWVScrollBar( new ScrollBar(this, WB_VSCROLL | WB_DRAG) )
+{
+    aEdtWindow->Show();
+    aBrkWindow->Show();
+
+    aEWVScrollBar->SetLineSize(nScrollLine);
+    aEWVScrollBar->SetPageSize(nScrollPage);
+    aEWVScrollBar->SetScrollHdl( LINK( this, ComplexEditorWindow, ScrollHdl ) );
+    aEWVScrollBar->Show();
+}
+
+
+ComplexEditorWindow::~ComplexEditorWindow()
 {
-    aEdtWindow.Show();
-    aBrkWindow.Show();
+    dispose();
+}
 
-    aEWVScrollBar.SetLineSize(nScrollLine);
-    aEWVScrollBar.SetPageSize(nScrollPage);
-    aEWVScrollBar.SetScrollHdl( LINK( this, ComplexEditorWindow, ScrollHdl ) );
-    aEWVScrollBar.Show();
+void ComplexEditorWindow::dispose()
+{
+    aBrkWindow.disposeAndClear();
+    aLineNumberWindow.disposeAndClear();
+    aEdtWindow.disposeAndClear();
+    aEWVScrollBar.disposeAndClear();
+    vcl::Window::dispose();
 }
 
 void ComplexEditorWindow::Resize()
@@ -2023,40 +2053,40 @@ void ComplexEditorWindow::Resize()
     aSz.Width() -= 2*DWBORDER;
     aSz.Height() -= 2*DWBORDER;
     long nBrkWidth = 20;
-    long nSBWidth = aEWVScrollBar.GetSizePixel().Width();
+    long nSBWidth = aEWVScrollBar->GetSizePixel().Width();
 
     Size aBrkSz(nBrkWidth, aSz.Height());
 
-    Size aLnSz(aLineNumberWindow.GetWidth(), aSz.Height());
+    Size aLnSz(aLineNumberWindow->GetWidth(), aSz.Height());
 
-    if (aLineNumberWindow.IsVisible())
+    if (aLineNumberWindow->IsVisible())
     {
-        aBrkWindow.SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz );
-        aLineNumberWindow.SetPosSizePixel(Point(DWBORDER + aBrkSz.Width() - 1, DWBORDER), aLnSz);
-        Size aEWSz(aSz.Width() - nBrkWidth - aLineNumberWindow.GetWidth() - nSBWidth + 2, aSz.Height());
-        aEdtWindow.SetPosSizePixel( Point( DWBORDER + aBrkSz.Width() + aLnSz.Width() - 1, DWBORDER ), aEWSz );
+        aBrkWindow->SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz );
+        aLineNumberWindow->SetPosSizePixel(Point(DWBORDER + aBrkSz.Width() - 1, DWBORDER), aLnSz);
+        Size aEWSz(aSz.Width() - nBrkWidth - aLineNumberWindow->GetWidth() - nSBWidth + 2, aSz.Height());
+        aEdtWindow->SetPosSizePixel( Point( DWBORDER + aBrkSz.Width() + aLnSz.Width() - 1, DWBORDER ), aEWSz );
     }
     else
     {
-        aBrkWindow.SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz );
+        aBrkWindow->SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz );
         Size aEWSz(aSz.Width() - nBrkWidth - nSBWidth + 2, aSz.Height());
-        aEdtWindow.SetPosSizePixel(Point(DWBORDER + aBrkSz.Width() - 1, DWBORDER), aEWSz);
+        aEdtWindow->SetPosSizePixel(Point(DWBORDER + aBrkSz.Width() - 1, DWBORDER), aEWSz);
     }
 
-    aEWVScrollBar.SetPosSizePixel( Point( aOutSz.Width() - DWBORDER - nSBWidth, DWBORDER ), Size( nSBWidth, aSz.Height() ) );
+    aEWVScrollBar->SetPosSizePixel( Point( aOutSz.Width() - DWBORDER - nSBWidth, DWBORDER ), Size( nSBWidth, aSz.Height() ) );
 }
 
 IMPL_LINK( ComplexEditorWindow, ScrollHdl, ScrollBar *, pCurScrollBar )
 {
-    if ( aEdtWindow.GetEditView() )
+    if ( aEdtWindow->GetEditView() )
     {
-        DBG_ASSERT( pCurScrollBar == &aEWVScrollBar, "Wer scrollt hier ?" );
-        long nDiff = aEdtWindow.GetEditView()->GetStartDocPos().Y() - pCurScrollBar->GetThumbPos();
-        aEdtWindow.GetEditView()->Scroll( 0, nDiff );
-        aBrkWindow.DoScroll( 0, nDiff );
-        aLineNumberWindow.DoScroll(0, nDiff);
-        aEdtWindow.GetEditView()->ShowCursor(false, true);
-        pCurScrollBar->SetThumbPos( aEdtWindow.GetEditView()->GetStartDocPos().Y() );
+        DBG_ASSERT( pCurScrollBar == aEWVScrollBar.get(), "Wer scrollt hier ?" );
+        long nDiff = aEdtWindow->GetEditView()->GetStartDocPos().Y() - pCurScrollBar->GetThumbPos();
+        aEdtWindow->GetEditView()->Scroll( 0, nDiff );
+        aBrkWindow->DoScroll( 0, nDiff );
+        aLineNumberWindow->DoScroll(0, nDiff);
+        aEdtWindow->GetEditView()->ShowCursor(false, true);
+        pCurScrollBar->SetThumbPos( aEdtWindow->GetEditView()->GetStartDocPos().Y() );
     }
 
     return 0;
@@ -2080,7 +2110,7 @@ void ComplexEditorWindow::DataChanged(DataChangedEvent const & rDCEvt)
 
 void ComplexEditorWindow::SetLineNumberDisplay(bool b)
 {
-    aLineNumberWindow.Show(b);
+    aLineNumberWindow->Show(b);
     Resize();
 }
 
@@ -2113,6 +2143,11 @@ WatchTreeListBox::WatchTreeListBox( vcl::Window* pParent, WinBits nWinBits )
 
 WatchTreeListBox::~WatchTreeListBox()
 {
+    dispose();
+}
+
+void WatchTreeListBox::dispose()
+{
     // Destroy user data
     SvTreeListEntry* pEntry = First();
     while ( pEntry )
@@ -2120,6 +2155,7 @@ WatchTreeListBox::~WatchTreeListBox()
         delete (WatchItem*)pEntry->GetUserData();
         pEntry = Next( pEntry );
     }
+    SvHeaderTabListBox::dispose();
 }
 
 void WatchTreeListBox::SetTabs()
@@ -2787,6 +2823,17 @@ pListBox( new CodeCompleteListBox(this) )
     InitListBox();
 }
 
+CodeCompleteWindow::~CodeCompleteWindow()
+{
+    dispose();
+}
+
+void CodeCompleteWindow::dispose()
+{
+    delete pListBox;
+    vcl::Window::dispose();
+}
+
 void CodeCompleteWindow::InitListBox()
 {
     pListBox->SetSizePixel( Size(150,150) ); //default, this will adopt the line length
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index 84e2ee5..973e58d 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -100,9 +100,6 @@ DialogWindow::DialogWindow (
         SetReadOnly(true);
 }
 
-DialogWindow::~DialogWindow()
-{ }
-
 void DialogWindow::LoseFocus()
 {
     if ( IsModified() )
@@ -1411,11 +1408,17 @@ DialogWindowLayout::DialogWindowLayout (vcl::Window* pParent, ObjectCatalog& rOb
 
 DialogWindowLayout::~DialogWindowLayout()
 {
+    dispose();
+}
+
+void DialogWindowLayout::dispose()
+{
     if (pPropertyBrowser != 0)
     {
         Remove(pPropertyBrowser);
         delete pPropertyBrowser;
     }
+    Layout::dispose();
 }
 
 // shows the property browser (and creates if necessary)
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 1ec577b..ff1fa98 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -330,7 +330,7 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
 
         case SID_BASICIDE_OBJCAT:
             // toggling object catalog
-            aObjectCatalog.Show(!aObjectCatalog.IsVisible());
+            aObjectCatalog->Show(!aObjectCatalog->IsVisible());
             if (pLayout)
                 pLayout->ArrangeWindows();
             // refresh the button state
@@ -750,7 +750,7 @@ void Shell::GetState(SfxItemSet &rSet)
             break;
             case SID_BASICIDE_OBJCAT:
                 if (pLayout)
-                    rSet.Put(SfxBoolItem(nWh, aObjectCatalog.IsVisible()));
+                    rSet.Put(SfxBoolItem(nWh, aObjectCatalog->IsVisible()));
                 else
                     rSet.Put(SfxVisibilityItem(nWh, false));
                 break;
@@ -1032,7 +1032,7 @@ void Shell::SetCurWindow( BaseWindow* pNewWin, bool bUpdateTabBar, bool bRemembe
             GetViewFrame()->GetWindow().SetHelpId( HID_BASICIDE_MODULWINDOW );
             SfxObjectShell::SetCurrentComponent(0);
         }
-        aObjectCatalog.SetCurrentEntry(pCurWin);
+        aObjectCatalog->SetCurrentEntry(pCurWin);
         SetUndoManager( pCurWin ? pCurWin->GetUndoManager() : 0 );
         InvalidateBasicIDESlots();
         EnableScrollbars(pCurWin != 0);
@@ -1188,13 +1188,13 @@ void Shell::AdjustPosSizePixel( const Point &rPos, const Size &rSize )
         return;
 
     Size aSz( rSize );
-    Size aScrollBarBoxSz( aScrollBarBox.GetSizePixel() );
+    Size aScrollBarBoxSz( aScrollBarBox->GetSizePixel() );
     aSz.Height() -= aScrollBarBoxSz.Height();
 
     Size aOutSz( aSz );
     aSz.Width() -= aScrollBarBoxSz.Width();
-    aScrollBarBox.SetPosPixel( Point( rSize.Width() - aScrollBarBoxSz.Width(), rSize.Height() - aScrollBarBoxSz.Height() ) );
-    aVScrollBar.SetPosSizePixel( Point( rPos.X()+aSz.Width(), rPos.Y() ), Size( aScrollBarBoxSz.Width(), aSz.Height() ) );
+    aScrollBarBox->SetPosPixel( Point( rSize.Width() - aScrollBarBoxSz.Width(), rSize.Height() - aScrollBarBoxSz.Height() ) );
+    aVScrollBar->SetPosSizePixel( Point( rPos.X()+aSz.Width(), rPos.Y() ), Size( aScrollBarBoxSz.Width(), aSz.Height() ) );
     if ( bTabBarSplitted )
     {
         // SplitSize is 0 at a resize!
@@ -1203,12 +1203,12 @@ void Shell::AdjustPosSizePixel( const Point &rPos, const Size &rSize )
             nSplitPos = aSz.Width();
         pTabBar->SetPosSizePixel( Point( rPos.X(), rPos.Y()+aSz.Height() ), Size( nSplitPos, aScrollBarBoxSz.Height() ) );
         long nScrlStart = rPos.X() + nSplitPos;
-        aHScrollBar.SetPosSizePixel( Point( nScrlStart, rPos.Y()+aSz.Height() ), Size( aSz.Width() - nScrlStart + 1, aScrollBarBoxSz.Height() ) );
-        aHScrollBar.Update();
+        aHScrollBar->SetPosSizePixel( Point( nScrlStart, rPos.Y()+aSz.Height() ), Size( aSz.Width() - nScrlStart + 1, aScrollBarBoxSz.Height() ) );
+        aHScrollBar->Update();
     }
     else
     {
-        aHScrollBar.SetPosSizePixel( Point( rPos.X()+ aSz.Width()/2 - 1, rPos.Y()+aSz.Height() ), Size( aSz.Width()/2 + 2, aScrollBarBoxSz.Height() ) );
+        aHScrollBar->SetPosSizePixel( Point( rPos.X()+ aSz.Width()/2 - 1, rPos.Y()+aSz.Height() ), Size( aSz.Width()/2 + 2, aScrollBarBoxSz.Height() ) );
         pTabBar->SetPosSizePixel( Point( rPos.X(), rPos.Y()+aSz.Height() ), Size( aSz.Width()/2, aScrollBarBoxSz.Height() ) );
     }
 
diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx
index a05794c..e5f92ec 100644
--- a/basctl/source/basicide/basides2.cxx
+++ b/basctl/source/basicide/basides2.cxx
@@ -167,7 +167,7 @@ ModulWindow* Shell::CreateBasWin( const ScriptDocument& rDocument, const OUStrin
             {
                 // new module window
                 if (!pModulLayout)
-                    pModulLayout.reset(new ModulWindowLayout(&GetViewFrame()->GetWindow(), aObjectCatalog));
+                    pModulLayout.reset(new ModulWindowLayout(&GetViewFrame()->GetWindow(), *aObjectCatalog.get()));
                 pWin = new ModulWindow(pModulLayout.get(), rDocument, aLibName, aModName, aModule);
                 nKey = InsertWindowInTable( pWin );
             }
@@ -196,7 +196,7 @@ ModulWindow* Shell::CreateBasWin( const ScriptDocument& rDocument, const OUStrin
     pTabBar->Sort();
     if(pWin)
     {
-        pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar );
+        pWin->GrabScrollBars( aHScrollBar.get(), aVScrollBar.get() );
         if ( !pCurWin )
             SetCurWindow( pWin, false, false );
     }
diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx
index ff53a77..8112a17 100644
--- a/basctl/source/basicide/basides3.cxx
+++ b/basctl/source/basicide/basides3.cxx
@@ -77,7 +77,7 @@ DialogWindow* Shell::CreateDlgWin( const ScriptDocument& rDocument, const OUStri
 
                 // new dialog window
                 if (!pDialogLayout)
-                    pDialogLayout.reset(new DialogWindowLayout(&GetViewFrame()->GetWindow(), aObjectCatalog));
+                    pDialogLayout.reset(new DialogWindowLayout(&GetViewFrame()->GetWindow(), *aObjectCatalog.get()));
                 pWin = new DialogWindow(pDialogLayout.get(), rDocument, aLibName, aDlgName, xDialogModel);
                 nKey = InsertWindowInTable( pWin );
             }
@@ -96,7 +96,7 @@ DialogWindow* Shell::CreateDlgWin( const ScriptDocument& rDocument, const OUStri
 
     if( pWin )
     {
-        pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar );
+        pWin->GrabScrollBars( aHScrollBar.get(), aVScrollBar.get() );
         pTabBar->InsertPage( (sal_uInt16)nKey, aDlgName );
         pTabBar->Sort();
         if ( !pCurWin )
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index 665b78f..bf9af42 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -155,11 +155,11 @@ unsigned Shell::nShellCount = 0;
 Shell::Shell( SfxViewFrame* pFrame_, SfxViewShell* /* pOldShell */ ) :
     SfxViewShell( pFrame_, ShellFlags ),
     m_aCurDocument( ScriptDocument::getApplicationScriptDocument() ),
-    aHScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_HSCROLL | WB_DRAG ) ),
-    aVScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_VSCROLL | WB_DRAG ) ),
-    aScrollBarBox( &GetViewFrame()->GetWindow(), WinBits( WB_SIZEABLE ) ),
+    aHScrollBar( new ScrollBar(&GetViewFrame()->GetWindow(), WinBits( WB_HSCROLL | WB_DRAG )) ),
+    aVScrollBar( new ScrollBar(&GetViewFrame()->GetWindow(), WinBits( WB_VSCROLL | WB_DRAG )) ),
+    aScrollBarBox( new ScrollBarBox(&GetViewFrame()->GetWindow(), WinBits( WB_SIZEABLE )) ),
     pLayout(0),
-    aObjectCatalog(&GetViewFrame()->GetWindow()),
+    aObjectCatalog(new ObjectCatalog(&GetViewFrame()->GetWindow())),
     m_bAppBasicModified( false ),
     m_aNotifier( *this )
 {
@@ -416,15 +416,15 @@ bool Shell::PrepareClose( bool bUI )
 
 void Shell::InitScrollBars()
 {
-    aVScrollBar.SetLineSize( 300 );
-    aVScrollBar.SetPageSize( 2000 );
-    aHScrollBar.SetLineSize( 300 );
-    aHScrollBar.SetPageSize( 2000 );
-    aHScrollBar.Enable();
-    aVScrollBar.Enable();
-    aVScrollBar.Show();
-    aHScrollBar.Show();
-    aScrollBarBox.Show();
+    aVScrollBar->SetLineSize( 300 );
+    aVScrollBar->SetPageSize( 2000 );
+    aHScrollBar->SetLineSize( 300 );
+    aHScrollBar->SetPageSize( 2000 );
+    aHScrollBar->Enable();
+    aVScrollBar->Enable();
+    aVScrollBar->Show();
+    aHScrollBar->Show();
+    aScrollBarBox->Show();
 }
 
 
@@ -492,16 +492,16 @@ bool Shell::NextPage( bool bPrev )
 
 void Shell::ArrangeTabBar()
 {
-    long nBoxPos = aScrollBarBox.GetPosPixel().X() - 1;
+    long nBoxPos = aScrollBarBox->GetPosPixel().X() - 1;
     long nPos = pTabBar->GetSplitSize();
     if ( nPos <= nBoxPos )
     {
         Point aPnt( pTabBar->GetPosPixel() );
-        long nH = aHScrollBar.GetSizePixel().Height();
+        long nH = aHScrollBar->GetSizePixel().Height();
         pTabBar->SetPosSizePixel( aPnt, Size( nPos, nH ) );
         long nScrlStart = aPnt.X() + nPos;
-        aHScrollBar.SetPosSizePixel( Point( nScrlStart, aPnt.Y() ), Size( nBoxPos - nScrlStart + 2, nH ) );
-        aHScrollBar.Update();
+        aHScrollBar->SetPosSizePixel( Point( nScrlStart, aPnt.Y() ), Size( nBoxPos - nScrlStart + 2, nH ) );
+        aHScrollBar->Update();
     }
 }
 
@@ -530,7 +530,7 @@ void Shell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&,
                 case SFX_HINT_DYING:
                 {
                     EndListening( rBC, true /* log off all */ );
-                    aObjectCatalog.UpdateEntries();
+                    aObjectCatalog->UpdateEntries();
                 }
                 break;
             }
@@ -908,8 +908,8 @@ void Shell::InvalidateBasicIDESlots()
 
 void Shell::EnableScrollbars( bool bEnable )
 {
-    aHScrollBar.Enable(bEnable);
-    aVScrollBar.Enable(bEnable);
+    aHScrollBar->Enable(bEnable);
+    aVScrollBar->Enable(bEnable);
 }
 
 void Shell::SetCurLib( const ScriptDocument& rDocument, const OUString& aLibName, bool bUpdateWindows, bool bCheck )
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index 5d105db..8abf230 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -206,6 +206,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeTreeListBox(vcl::Windo
 
 TreeListBox::~TreeListBox ()
 {
+    dispose();
+}
+
+void TreeListBox::dispose()
+{
     m_aNotifier.dispose();
 
     // destroy user data
@@ -215,6 +220,7 @@ TreeListBox::~TreeListBox ()
         delete static_cast<Entry*>(pEntry->GetUserData());
         pEntry = Next( pEntry );
     }
+    SvTreeListBox::dispose();
 }
 
 void TreeListBox::ScanEntry( const ScriptDocument& rDocument, LibraryLocation eLocation )
diff --git a/basctl/source/basicide/bastype2.hxx b/basctl/source/basicide/bastype2.hxx
index 2b51b17..f18e472 100644
--- a/basctl/source/basicide/bastype2.hxx
+++ b/basctl/source/basicide/bastype2.hxx
@@ -208,6 +208,7 @@ public:
     TreeListBox(vcl::Window* pParent, const ResId& rRes);
     TreeListBox(vcl::Window* pParent, WinBits nStyle);
     virtual ~TreeListBox();
+    virtual void    dispose() SAL_OVERRIDE;
 
     void            ScanEntry( const ScriptDocument& rDocument, LibraryLocation eLocation );
     void            ScanAllEntries();
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
index e6039e3..2bdb192 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -55,10 +55,16 @@ BaseWindow::BaseWindow( vcl::Window* pParent, const ScriptDocument& rDocument, c
 
 BaseWindow::~BaseWindow()
 {
+    dispose();
+}
+
+void BaseWindow::dispose()
+{
     if ( pShellVScrollBar )
         pShellVScrollBar->SetScrollHdl( Link() );
     if ( pShellHScrollBar )
         pShellHScrollBar->SetScrollHdl( Link() );
+    vcl::Window::dispose();
 }
 
 
diff --git a/basctl/source/basicide/layout.cxx b/basctl/source/basicide/layout.cxx
index 50c9d5e..43a544f 100644
--- a/basctl/source/basicide/layout.cxx
+++ b/basctl/source/basicide/layout.cxx
@@ -53,10 +53,6 @@ Layout::Layout (vcl::Window* pParent) :
     SetFont(aFont);
 }
 
-// virtual dtor
-Layout::~Layout()
-{ }
-
 // removes a docking window
 void Layout::Remove (DockingWindow* pWin)
 {
@@ -166,9 +162,9 @@ Layout::SplittedSide::SplittedSide (Layout* pParent, Side eSide) :
     bVertical(eSide == Left || eSide == Right),
     bLower(eSide == Left || eSide == Top),
     nSize(0),
-    aSplitter(pParent, bVertical ? WB_HSCROLL : WB_VSCROLL)
+    aSplitter(new Splitter(pParent, bVertical ? WB_HSCROLL : WB_VSCROLL))
 {
-    InitSplitter(aSplitter);
+    InitSplitter(*aSplitter.get());
 }
 
 
@@ -267,19 +263,19 @@ void Layout::SplittedSide::ArrangeIn (Rectangle const& rRect)
     // shown if any of the windows is docked
     if (!bEmpty)
     {
-        aSplitter.Show();
+        aSplitter->Show();
         // split position
-        aSplitter.SetSplitPosPixel((bLower ? nSize : nPos1) - nSplitThickness);
+        aSplitter->SetSplitPosPixel((bLower ? nSize : nPos1) - nSplitThickness);
         // the actual position and size
-        aSplitter.SetPosSizePixel(
-            MakePoint(nPos2, aSplitter.GetSplitPosPixel()),
+        aSplitter->SetPosSizePixel(
+            MakePoint(nPos2, aSplitter->GetSplitPosPixel()),
             MakeSize(nLength, nSplitThickness)
         );
         // dragging rectangle
-        aSplitter.SetDragRectPixel(aRect);
+        aSplitter->SetDragRectPixel(aRect);
     }
     else
-        aSplitter.Hide();
+        aSplitter->Hide();
 
     // positioning separator lines and windows
     bool bPrevDocking = false; // is the previous window docked?
@@ -350,7 +346,7 @@ IMPL_LINK(Layout::SplittedSide, SplitHdl, Splitter*, pSplitter)
     // checking margins
     CheckMarginsFor(pSplitter);
     // changing stored sizes
-    if (pSplitter == &aSplitter)
+    if (pSplitter == aSplitter.get())
     {
         // nSize
         if (bLower)
diff --git a/basctl/source/basicide/layout.hxx b/basctl/source/basicide/layout.hxx
index fac9bdc..56e69a2 100644
--- a/basctl/source/basicide/layout.hxx
+++ b/basctl/source/basicide/layout.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_BASCTL_SOURCE_BASICIDE_LAYOUT_HXX
 
 #include <vcl/split.hxx>
+#include <vcl/vclptr.hxx>
 
 
 class DockingWindow;
@@ -51,7 +52,6 @@ public:
 
 protected:
     Layout (vcl::Window* pParent);
-    virtual ~Layout ();
 
     void AddToLeft   (DockingWindow* pWin, Size const& rSize) { aLeftSide.Add(pWin, rSize); }
     void AddToBottom (DockingWindow* pWin, Size const& rSize) { aBottomSide.Add(pWin, rSize); }
@@ -96,7 +96,7 @@ private:
         // size (width or height)
         long nSize;
         // the main splitting line
-        Splitter aSplitter;
+        VclPtr<Splitter> aSplitter;
         // the dockable windows (and some data)
         struct Item
         {
diff --git a/basctl/source/basicide/linenumberwindow.cxx b/basctl/source/basicide/linenumberwindow.cxx
index ff3b3d5..d63afe1 100644
--- a/basctl/source/basicide/linenumberwindow.cxx
+++ b/basctl/source/basicide/linenumberwindow.cxx
@@ -25,9 +25,6 @@ LineNumberWindow::LineNumberWindow (vcl::Window* pParent, ModulWindow* pModulWin
     m_nWidth = m_nBaseWidth * 3 + m_nBaseWidth / 2;
 }
 
-LineNumberWindow::~LineNumberWindow()
-{ }
-
 void LineNumberWindow::Paint( const Rectangle& )
 {
     if(SyncYOffset())
diff --git a/basctl/source/basicide/linenumberwindow.hxx b/basctl/source/basicide/linenumberwindow.hxx
index caa7f15..6a6bcd2 100644
--- a/basctl/source/basicide/linenumberwindow.hxx
+++ b/basctl/source/basicide/linenumberwindow.hxx
@@ -30,7 +30,6 @@ protected:
 
 public:
     LineNumberWindow (vcl::Window* pParent, ModulWindow* pModulWin);
-    virtual ~LineNumberWindow();
 
     void DoScroll( long nHorzScroll, long nVertScroll );
 
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
index 0f70973..53355ef 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -112,8 +112,14 @@ MacroChooser::MacroChooser( vcl::Window* pParnt, bool bCreateEntries )
 
 MacroChooser::~MacroChooser()
 {
+    dispose();
+}
+
+void MacroChooser::dispose()
+{
     if ( bForceStoreBasic )
         SfxGetpApp()->SaveBasicAndDialogContainer();
+    SfxModalDialog::dispose();
 }
 
 void MacroChooser::StoreMacroDescription()
diff --git a/basctl/source/basicide/macrodlg.hxx b/basctl/source/basicide/macrodlg.hxx
index 212dc7f..71892b3e 100644
--- a/basctl/source/basicide/macrodlg.hxx
+++ b/basctl/source/basicide/macrodlg.hxx
@@ -87,6 +87,7 @@ private:
 public:
                         MacroChooser( vcl::Window* pParent, bool bCreateEntries = true );
                         virtual ~MacroChooser();
+    virtual void        dispose() SAL_OVERRIDE;
 
     SbMethod*           GetMacro();
     void                DeleteMacro();
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 812c9ec..0b70ec3 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -160,6 +160,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeCheckBox(vcl::Window *
 
 CheckBox::~CheckBox()
 {
+    dispose();
+}
+
+void CheckBox::dispose()
+{
     delete pCheckButton;
 
     // delete user data
@@ -169,6 +174,7 @@ CheckBox::~CheckBox()
         delete static_cast<LibUserData*>(pEntry->GetUserData());
         pEntry = Next( pEntry );
     }
+    SvTabListBox::dispose();
 }
 
 void CheckBox::Init()
@@ -475,12 +481,18 @@ LibPage::LibPage(vcl::Window * pParent)
 
 LibPage::~LibPage()
 {
+    dispose();
+}
+
+void LibPage::dispose()
+{
     sal_uInt16 nCount = m_pBasicsBox->GetEntryCount();
     for ( sal_uInt16 i = 0; i < nCount; ++i )
     {
         DocumentEntry* pEntry = (DocumentEntry*)m_pBasicsBox->GetEntryData( i );
         delete pEntry;
     }
+    TabPage::dispose();
 }
 
 void LibPage::CheckButtons()
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index b34dbeb..1126d3a 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -62,9 +62,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeExtTreeListBox(vcl::Wi
     return new ExtTreeListBox(pParent, nWinBits);
 }
 
-ExtTreeListBox::~ExtTreeListBox ()
-{ }
-
 bool ExtTreeListBox::EditingEntry( SvTreeListEntry* pEntry, Selection& )
 {
     bool bRet = false;
@@ -489,8 +486,14 @@ OrganizeDialog::OrganizeDialog(vcl::Window* pParent, sal_Int16 tabId,
 
 OrganizeDialog::~OrganizeDialog()
 {
+    dispose();
+}
+
+void OrganizeDialog::dispose()
+{
     for ( sal_uInt16 i = 0; i < m_pTabCtrl->GetPageCount(); i++ )
         delete m_pTabCtrl->GetTabPage( m_pTabCtrl->GetPageId( i ) );
+    TabDialog::dispose();
 };
 
 short OrganizeDialog::Execute()
diff --git a/basctl/source/basicide/moduldlg.hxx b/basctl/source/basicide/moduldlg.hxx
index a1c3f79..00abbe1 100644
--- a/basctl/source/basicide/moduldlg.hxx
+++ b/basctl/source/basicide/moduldlg.hxx
@@ -107,7 +107,6 @@ protected:
 
 public:
     ExtTreeListBox(vcl::Window* pParent, WinBits nStyle);
-    virtual ~ExtTreeListBox();
 };
 
 class CheckBox : public SvTabListBox
@@ -121,6 +120,7 @@ private:
 public:
     CheckBox(vcl::Window* pParent, WinBits nStyle);
     virtual ~CheckBox();
+    virtual void    dispose() SAL_OVERRIDE;
 
     SvTreeListEntry*    DoInsertEntry( const OUString& rStr, sal_uLong nPos = LISTBOX_APPEND );
     SvTreeListEntry*    FindEntry( const OUString& rName );
@@ -168,6 +168,7 @@ private:
 public:
     OrganizeDialog( vcl::Window* pParent, sal_Int16 tabId, EntryDescriptor& rDesc );
     virtual ~OrganizeDialog();
+    virtual void    dispose() SAL_OVERRIDE;
 
     virtual short   Execute() SAL_OVERRIDE;
 
@@ -246,6 +247,7 @@ protected:
 public:
                         LibPage( vcl::Window* pParent );

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list