[Libreoffice-commits] core.git: Branch 'feature/vclref' - desktop/source include/svtools include/toolkit svtools/inc svtools/source toolkit/source

Noel Grandin noel at peralex.com
Mon Jan 12 05:17:37 PST 2015


 desktop/source/splash/splash.cxx                     |    7 
 include/svtools/DocumentInfoPreview.hxx              |    3 
 include/svtools/GraphicExportOptionsDialog.hxx       |    1 
 include/svtools/PlaceEditDialog.hxx                  |    7 
 include/svtools/addresstemplate.hxx                  |    1 
 include/svtools/brwbox.hxx                           |   10 
 include/svtools/calendar.hxx                         |    6 
 include/svtools/ctrlbox.hxx                          |    5 
 include/svtools/editbrowsebox.hxx                    |    2 
 include/svtools/editsyntaxhighlighter.hxx            |    1 
 include/svtools/filectrl.hxx                         |   21 +-
 include/svtools/fileview.hxx                         |    1 
 include/svtools/fmtfield.hxx                         |    2 
 include/svtools/headbar.hxx                          |    1 
 include/svtools/hyperlabel.hxx                       |    3 
 include/svtools/inettbc.hxx                          |    3 
 include/svtools/ivctrl.hxx                           |    1 
 include/svtools/prnsetup.hxx                         |    3 
 include/svtools/roadmapwizard.hxx                    |    3 
 include/svtools/ruler.hxx                            |    1 
 include/svtools/scrwin.hxx                           |   10 
 include/svtools/simptabl.hxx                         |    7 
 include/svtools/svmedit2.hxx                         |    3 
 include/svtools/svtabbx.hxx                          |    2 
 include/svtools/tabbar.hxx                           |    1 
 include/svtools/toolbarmenu.hxx                      |    1 
 include/svtools/toolpanel/paneltabbar.hxx            |    1 
 include/svtools/toolpanel/toolpaneldeck.hxx          |    1 
 include/svtools/treelistbox.hxx                      |    1 
 include/svtools/valueset.hxx                         |    3 
 include/svtools/wizardmachine.hxx                    |    2 
 include/svtools/wizdlg.hxx                           |    1 
 include/toolkit/awt/scrollabledialog.hxx             |    5 
 svtools/inc/roadmap.hxx                              |    1 
 svtools/inc/table/tablecontrol.hxx                   |    1 
 svtools/source/brwbox/brwbox1.cxx                    |   33 +--
 svtools/source/brwbox/brwbox2.cxx                    |   40 +--
 svtools/source/brwbox/datwin.cxx                     |    8 
 svtools/source/brwbox/datwin.hxx                     |    3 
 svtools/source/brwbox/ebbcontrols.cxx                |    6 
 svtools/source/brwbox/editbrowsebox.cxx              |    7 
 svtools/source/contnr/DocumentInfoPreview.cxx        |   42 ++--
 svtools/source/contnr/fileview.cxx                   |   15 +
 svtools/source/contnr/imivctl.hxx                    |    7 
 svtools/source/contnr/imivctl1.cxx                   |  149 +++++++-------
 svtools/source/contnr/ivctrl.cxx                     |    6 
 svtools/source/contnr/simptabl.cxx                   |   99 +++++----
 svtools/source/contnr/svimpbox.cxx                   |  191 +++++++++----------
 svtools/source/contnr/svtabbx.cxx                    |   12 +
 svtools/source/contnr/treelistbox.cxx                |   18 +
 svtools/source/control/calendar.cxx                  |   21 +-
 svtools/source/control/ctrlbox.cxx                   |   26 +-
 svtools/source/control/filectrl.cxx                  |   54 ++---
 svtools/source/control/fmtfield.cxx                  |   10 
 svtools/source/control/headbar.cxx                   |    6 
 svtools/source/control/hyperlabel.cxx                |    6 
 svtools/source/control/inettbc.cxx                   |    6 
 svtools/source/control/roadmap.cxx                   |   12 -
 svtools/source/control/ruler.cxx                     |    6 
 svtools/source/control/scrwin.cxx                    |   89 +++++---
 svtools/source/control/tabbar.cxx                    |    6 
 svtools/source/control/toolbarmenu.cxx               |    6 
 svtools/source/control/valueset.cxx                  |    6 
 svtools/source/dialogs/PlaceEditDialog.cxx           |    4 
 svtools/source/dialogs/addresstemplate.cxx           |    6 
 svtools/source/dialogs/prnsetup.cxx                  |    6 
 svtools/source/dialogs/roadmapwizard.cxx             |    6 
 svtools/source/dialogs/wizardmachine.cxx             |   11 +
 svtools/source/dialogs/wizdlg.cxx                    |    7 
 svtools/source/edit/editsyntaxhighlighter.cxx        |    4 
 svtools/source/edit/svmedit2.cxx                     |    6 
 svtools/source/filter/GraphicExportOptionsDialog.cxx |    3 
 svtools/source/filter/exportdialog.cxx               |    6 
 svtools/source/filter/exportdialog.hxx               |    7 
 svtools/source/inc/svimpbox.hxx                      |    8 
 svtools/source/table/tablecontrol.cxx                |    6 
 svtools/source/table/tabledatawindow.cxx             |    6 
 svtools/source/table/tabledatawindow.hxx             |    1 
 svtools/source/toolpanel/paneltabbar.cxx             |   58 +++--
 svtools/source/toolpanel/toolpaneldeck.cxx           |   27 +-
 svtools/source/toolpanel/toolpaneldrawer.cxx         |   19 -
 svtools/source/toolpanel/toolpaneldrawer.hxx         |    5 
 svtools/source/uno/treecontrolpeer.cxx               |    7 
 svtools/source/uno/wizard/wizardshell.cxx            |    5 
 svtools/source/uno/wizard/wizardshell.hxx            |    1 
 toolkit/source/awt/scrollabledialog.cxx              |   47 +++-
 86 files changed, 774 insertions(+), 494 deletions(-)

New commits:
commit 25793a4003664569eb57dad1baa9d8bf9f27e486
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Jan 12 15:16:05 2015 +0200

    svtools: apply vcl::window refcounting changes
    
    Change-Id: I308f045eaf5c50de26175a2f00f8b0791cdd8ab9

diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx
index 17e84de..33f2fca 100644
--- a/desktop/source/splash/splash.cxx
+++ b/desktop/source/splash/splash.cxx
@@ -55,6 +55,7 @@ private:
 
     DECL_LINK( AppEventListenerHdl, VclWindowEvent * );
     virtual ~SplashScreen();
+    virtual void dispose() SAL_OVERRIDE;
     void loadConfig();
     void updateStatus();
     void SetScreenBitmap(BitmapEx &rBitmap);
@@ -153,9 +154,15 @@ SplashScreen::SplashScreen()
 
 SplashScreen::~SplashScreen()
 {
+    dispose();
+}
+
+void SplashScreen::dispose()
+{
     Application::RemoveEventListener(
         LINK( this, SplashScreen, AppEventListenerHdl ) );
     Hide();
+    IntroWindow::dispose();
 }
 
 void SAL_CALL SplashScreen::start(const OUString&, sal_Int32 nRange)
diff --git a/include/svtools/DocumentInfoPreview.hxx b/include/svtools/DocumentInfoPreview.hxx
index ee671b7..1190463 100644
--- a/include/svtools/DocumentInfoPreview.hxx
+++ b/include/svtools/DocumentInfoPreview.hxx
@@ -44,6 +44,7 @@ public:
     ODocumentInfoPreview(vcl::Window * pParent, WinBits nBits);
 
     virtual ~ODocumentInfoPreview();
+    virtual void dispose() SAL_OVERRIDE;
 
     virtual void Resize() SAL_OVERRIDE;
 
@@ -55,7 +56,7 @@ public:
         OUString const & rURL);
 
 private:
-    ExtMultiLineEdit m_pEditWin;
+    VclPtr<ExtMultiLineEdit> m_pEditWin;
     boost::scoped_ptr< SvtDocInfoTable_Impl > m_pInfoTable;
     LanguageTag m_aLanguageTag;
 
diff --git a/include/svtools/GraphicExportOptionsDialog.hxx b/include/svtools/GraphicExportOptionsDialog.hxx
index 1982aa1..5c8e7ed 100644
--- a/include/svtools/GraphicExportOptionsDialog.hxx
+++ b/include/svtools/GraphicExportOptionsDialog.hxx
@@ -62,7 +62,6 @@ private:
 
 public:
     GraphicExportOptionsDialog( vcl::Window* pWindow, const css::uno::Reference<css::lang::XComponent>& rxSourceDocument );
-    virtual ~GraphicExportOptionsDialog();
 
     css::uno::Sequence<css::beans::PropertyValue> getFilterData();
 };
diff --git a/include/svtools/PlaceEditDialog.hxx b/include/svtools/PlaceEditDialog.hxx
index 7990542..1f5b18d 100644
--- a/include/svtools/PlaceEditDialog.hxx
+++ b/include/svtools/PlaceEditDialog.hxx
@@ -28,8 +28,8 @@ class SVT_DLLPUBLIC PlaceEditDialog : public ModalDialog
 {
 private :
 
-    Edit*      m_pEDServerName;
-    ListBox*   m_pLBServerType;
+    Edit*         m_pEDServerName;
+    ListBox*      m_pLBServerType;
     boost::shared_ptr< DetailsContainer > m_pCurrentDetails;
 
     Edit*         m_pEDUsername;
@@ -50,12 +50,11 @@ public :
 
      PlaceEditDialog( vcl::Window* pParent);
      PlaceEditDialog(vcl::Window* pParent, const boost::shared_ptr<Place> &pPlace );
-     virtual ~PlaceEditDialog();
 
      // Returns a place instance with given information
      boost::shared_ptr<Place> GetPlace();
 
-    OUString GetServerName() { return m_pEDServerName->GetText(); }
+     OUString GetServerName() { return m_pEDServerName->GetText(); }
      OUString GetServerUrl();
 
 private:
diff --git a/include/svtools/addresstemplate.hxx b/include/svtools/addresstemplate.hxx
index 020d38c..b33fbcd 100644
--- a/include/svtools/addresstemplate.hxx
+++ b/include/svtools/addresstemplate.hxx
@@ -100,6 +100,7 @@ namespace svt
         );
 
         virtual ~AddressBookSourceDialog();
+        virtual void dispose() SAL_OVERRIDE;
 
         // to be used if the object was constructed for editing a field mapping only
         void        getFieldMapping(
diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx
index 1384ff7..377c75e 100644
--- a/include/svtools/brwbox.hxx
+++ b/include/svtools/brwbox.hxx
@@ -22,6 +22,7 @@
 #include <svtools/svtdllapi.h>
 #include <vcl/scrbar.hxx>
 #include <vcl/ctrl.hxx>
+#include <vcl/vclptr.hxx>
 #include <tools/multisel.hxx>
 #include <svtools/headbar.hxx>
 #include <svtools/transfer.hxx>
@@ -218,9 +219,9 @@ public:
     static const sal_uInt16 HandleColumnId = 0;
 
 private:
-    vcl::Window*         pDataWin;       // window to display data rows
-    ScrollBar*      pVScroll;       // vertical scrollbar
-    ScrollBar       aHScroll;       // horizontal scrollbar
+    vcl::Window*       pDataWin;       // window to display data rows
+    ScrollBar*         pVScroll;       // vertical scrollbar
+    VclPtr<ScrollBar>  aHScroll;       // horizontal scrollbar
 
     long            nDataRowHeight; // height of a single data-row
     sal_uInt16      nTitleLines;    // number of lines in title row
@@ -426,7 +427,8 @@ public:
                                BrowserMode nMode = 0 );
                     BrowseBox( vcl::Window* pParent, const ResId& rId,
                                BrowserMode nMode = 0 );
-                    virtual ~BrowseBox();
+    virtual         ~BrowseBox();
+    virtual void    dispose() SAL_OVERRIDE;
 
     // inherited overloaded handler
     virtual void    StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
diff --git a/include/svtools/calendar.hxx b/include/svtools/calendar.hxx
index 3ad7b97..a150840 100644
--- a/include/svtools/calendar.hxx
+++ b/include/svtools/calendar.hxx
@@ -258,7 +258,8 @@ protected:
 
 public:
                     Calendar( vcl::Window* pParent, WinBits nWinStyle = 0 );
-                    virtual ~Calendar();
+    virtual         ~Calendar();
+    virtual void    dispose() SAL_OVERRIDE;
 
     virtual void    MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     virtual void    MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
@@ -416,7 +417,8 @@ private:
 
 public:
                         CalendarField( vcl::Window* pParent, WinBits nWinStyle );
-                        virtual ~CalendarField();
+    virtual             ~CalendarField();
+    virtual void        dispose() SAL_OVERRIDE;
 
     virtual void        Select();
 
diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx
index de433f6..6c62909 100644
--- a/include/svtools/ctrlbox.hxx
+++ b/include/svtools/ctrlbox.hxx
@@ -159,6 +159,7 @@ public:
                                   WinBits nWinStyle = WB_BORDER );
                     ColorListBox( vcl::Window* pParent, const ResId& rResId );
     virtual         ~ColorListBox();
+    virtual void    dispose() SAL_OVERRIDE;
 
     virtual void    UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE;
 
@@ -304,6 +305,7 @@ public:
 
                     LineListBox( vcl::Window* pParent, WinBits nWinStyle = WB_BORDER );
     virtual         ~LineListBox();
+    virtual void    dispose() SAL_OVERRIDE;
 
     /** Set the width in Twips */
     void            SetWidth( long nWidth );
@@ -407,6 +409,7 @@ public:
                     FontNameBox( vcl::Window* pParent,
                                  WinBits nWinStyle = WB_SORT );
     virtual         ~FontNameBox();
+    virtual void    dispose() SAL_OVERRIDE;
 
     virtual void    UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE;
 
@@ -433,7 +436,6 @@ private:
     using ComboBox::SetText;
 public:
     FontStyleBox( vcl::Window* pParent, WinBits nBits );
-    virtual         ~FontStyleBox();
 
     virtual void    Select() SAL_OVERRIDE;
     virtual void    LoseFocus() SAL_OVERRIDE;
@@ -478,7 +480,6 @@ protected:
 
 public:
                     FontSizeBox( vcl::Window* pParent, WinBits nWinStyle = 0 );
-    virtual         ~FontSizeBox();
 
     void            Reformat() SAL_OVERRIDE;
     void            Modify() SAL_OVERRIDE;
diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx
index 9a9722d..a520d7e 100644
--- a/include/svtools/editbrowsebox.hxx
+++ b/include/svtools/editbrowsebox.hxx
@@ -281,6 +281,7 @@ namespace svt
     public:
         CheckBoxControl(vcl::Window* pParent, WinBits nWinStyle = 0);
         virtual ~CheckBoxControl();
+        virtual void dispose() SAL_OVERRIDE;
 
         virtual void GetFocus() SAL_OVERRIDE;
         virtual bool PreNotify(NotifyEvent& rEvt) SAL_OVERRIDE;
@@ -594,6 +595,7 @@ namespace svt
         EditBrowseBox(vcl::Window* pParent, sal_Int32 nBrowserFlags = EBBF_NONE, WinBits nBits = WB_TABSTOP, BrowserMode nMode = 0 );
         EditBrowseBox(vcl::Window* pParent, const ResId& rId, sal_Int32 nBrowserFlags = EBBF_NONE, BrowserMode nMode = 0 );
         virtual ~EditBrowseBox();
+        virtual void dispose() SAL_OVERRIDE;
 
         bool IsEditing() const {return aController.Is();}
         void InvalidateStatusCell(long nRow) {RowModified(nRow, 0);}
diff --git a/include/svtools/editsyntaxhighlighter.hxx b/include/svtools/editsyntaxhighlighter.hxx
index 8ec02d3..636909f 100644
--- a/include/svtools/editsyntaxhighlighter.hxx
+++ b/include/svtools/editsyntaxhighlighter.hxx
@@ -40,7 +40,6 @@ class SVT_DLLPUBLIC MultiLineEditSyntaxHighlight : public MultiLineEdit
 
     public:
         MultiLineEditSyntaxHighlight( vcl::Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER , HighlighterLanguage aLanguage = HIGHLIGHT_SQL);
-        virtual ~MultiLineEditSyntaxHighlight();
 
         virtual void UpdateData() SAL_OVERRIDE;
         virtual void SetText(const OUString& rNewText) SAL_OVERRIDE;
diff --git a/include/svtools/filectrl.hxx b/include/svtools/filectrl.hxx
index 04e6e0a..09e5fe6 100644
--- a/include/svtools/filectrl.hxx
+++ b/include/svtools/filectrl.hxx
@@ -42,8 +42,8 @@ typedef sal_uInt16 FileControlMode_Internal;
 class SVT_DLLPUBLIC FileControl : public vcl::Window
 {
 private:
-    Edit            maEdit;
-    PushButton      maButton;
+    VclPtr<Edit>       maEdit;
+    VclPtr<PushButton> maButton;
 
     OUString        maButtonText;
     bool            mbOpenDlg;
@@ -65,10 +65,11 @@ protected:
 
 public:
                     FileControl( vcl::Window* pParent, WinBits nStyle, FileControlMode = 0 );
-                    virtual ~FileControl();
+    virtual         ~FileControl();
+    virtual void    dispose() SAL_OVERRIDE;
 
-    Edit&           GetEdit() { return maEdit; }
-    PushButton&     GetButton() { return maButton; }
+    Edit&           GetEdit() { return *maEdit.get(); }
+    PushButton&     GetButton() { return *maButton.get(); }
 
     void            Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
 
@@ -77,13 +78,13 @@ public:
 
     void            SetText( const OUString& rStr ) SAL_OVERRIDE;
     OUString        GetText() const SAL_OVERRIDE;
-    OUString   GetSelectedText() const         { return maEdit.GetSelected(); }
+    OUString        GetSelectedText() const         { return maEdit->GetSelected(); }
 
-    void            SetSelection( const Selection& rSelection ) { maEdit.SetSelection( rSelection ); }
-    Selection       GetSelection() const                        { return maEdit.GetSelection(); }
+    void            SetSelection( const Selection& rSelection ) { maEdit->SetSelection( rSelection ); }
+    Selection       GetSelection() const                        { return maEdit->GetSelection(); }
 
-    void            SetReadOnly( bool bReadOnly = true )    { maEdit.SetReadOnly( bReadOnly ); }
-    bool            IsReadOnly() const                      { return maEdit.IsReadOnly(); }
+    void            SetReadOnly( bool bReadOnly = true )    { maEdit->SetReadOnly( bReadOnly ); }
+    bool            IsReadOnly() const                      { return maEdit->IsReadOnly(); }
 
 
     //use this to manipulate the dialog bevore executing it:
diff --git a/include/svtools/fileview.hxx b/include/svtools/fileview.hxx
index 283f4aa..461c76e 100644
--- a/include/svtools/fileview.hxx
+++ b/include/svtools/fileview.hxx
@@ -82,6 +82,7 @@ protected:
 public:
     SvtFileView( vcl::Window* pParent, WinBits nBits, bool bOnlyFolder, bool bMultiSelection );
     virtual ~SvtFileView();
+    virtual void dispose() SAL_OVERRIDE;
 
     virtual Size GetOptimalSize() const SAL_OVERRIDE;
 
diff --git a/include/svtools/fmtfield.hxx b/include/svtools/fmtfield.hxx
index 8dcc0f7..9be3a9d 100644
--- a/include/svtools/fmtfield.hxx
+++ b/include/svtools/fmtfield.hxx
@@ -91,7 +91,6 @@ protected:
 
 public:
     FormattedField(vcl::Window* pParent, WinBits nStyle = 0, SvNumberFormatter* pInitialFormatter = NULL, sal_Int32 nFormatKey = 0);
-    virtual ~FormattedField();
 
     // Min-/Max-management
     bool    HasMinValue() const         { return m_bHasMin; }
@@ -266,6 +265,7 @@ public:
     }
 
     virtual ~DoubleNumericField();
+    virtual void dispose() SAL_OVERRIDE;
 
 protected:
     virtual bool CheckText(const OUString& sText) const SAL_OVERRIDE;
diff --git a/include/svtools/headbar.hxx b/include/svtools/headbar.hxx
index af7e0f6..69a422f 100644
--- a/include/svtools/headbar.hxx
+++ b/include/svtools/headbar.hxx
@@ -285,6 +285,7 @@ private:
 public:
     HeaderBar( vcl::Window* pParent, WinBits nWinBits = WB_STDHEADERBAR );
     virtual ~HeaderBar();
+    virtual void dispose() SAL_OVERRIDE;
 
     virtual void        MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     virtual void        MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
diff --git a/include/svtools/hyperlabel.hxx b/include/svtools/hyperlabel.hxx
index eacfe48..cdda740 100644
--- a/include/svtools/hyperlabel.hxx
+++ b/include/svtools/hyperlabel.hxx
@@ -32,7 +32,7 @@ namespace svt
 {
 
 
-       class HyperLabelImpl;
+    class HyperLabelImpl;
 
     class HyperLabel : public FixedText
     {
@@ -54,6 +54,7 @@ namespace svt
     public:
         HyperLabel( vcl::Window* _pParent, WinBits _nWinStyle = 0 );
         virtual ~HyperLabel( );
+        virtual void dispose() SAL_OVERRIDE;
 
         virtual void    DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
 
diff --git a/include/svtools/inettbc.hxx b/include/svtools/inettbc.hxx
index b9852ce..7f6502c 100644
--- a/include/svtools/inettbc.hxx
+++ b/include/svtools/inettbc.hxx
@@ -62,7 +62,8 @@ public:
                                     SvtURLBox( vcl::Window* pParent, INetProtocol eSmart = INET_PROT_NOT_VALID, bool bSetDefaultHelpID = true );
                                     SvtURLBox( vcl::Window* pParent, WinBits _nStyle, INetProtocol eSmart = INET_PROT_NOT_VALID, bool bSetDefaultHelpID = true );
                                     SvtURLBox( vcl::Window* pParent, const ResId& _rResId, INetProtocol eSmart = INET_PROT_NOT_VALID, bool bSetDefaultHelpID = true );
-                                    virtual ~SvtURLBox();
+    virtual                         ~SvtURLBox();
+    virtual void                    dispose() SAL_OVERRIDE;
 
     void                            SetBaseURL( const OUString& rURL );
     const OUString&                 GetBaseURL() const { return aBaseURL; }
diff --git a/include/svtools/ivctrl.hxx b/include/svtools/ivctrl.hxx
index 5edd15f..a6b35ea 100644
--- a/include/svtools/ivctrl.hxx
+++ b/include/svtools/ivctrl.hxx
@@ -263,6 +263,7 @@ public:
 
                         SvtIconChoiceCtrl( vcl::Window* pParent, WinBits nWinStyle = WB_ICON | WB_BORDER );
     virtual             ~SvtIconChoiceCtrl();
+    virtual void        dispose() SAL_OVERRIDE;
 
     void                SetStyle( WinBits nWinStyle );
     WinBits             GetStyle() const;
diff --git a/include/svtools/prnsetup.hxx b/include/svtools/prnsetup.hxx
index b7ed0fd..6b87e5d 100644
--- a/include/svtools/prnsetup.hxx
+++ b/include/svtools/prnsetup.hxx
@@ -60,7 +60,8 @@ private:
 
 public:
                     PrinterSetupDialog( vcl::Window* pWindow );
-                    virtual ~PrinterSetupDialog();
+    virtual         ~PrinterSetupDialog();
+    virtual void    dispose() SAL_OVERRIDE;
 
     void            SetPrinter( Printer* pNewPrinter ) { mpPrinter = pNewPrinter; }
     Printer*        GetPrinter() const { return mpPrinter; }
diff --git a/include/svtools/roadmapwizard.hxx b/include/svtools/roadmapwizard.hxx
index 578ba28..7ff79e0 100644
--- a/include/svtools/roadmapwizard.hxx
+++ b/include/svtools/roadmapwizard.hxx
@@ -77,6 +77,7 @@ namespace svt
             sal_uInt32 _nButtonFlags = WZB_NEXT | WZB_PREVIOUS | WZB_FINISH | WZB_CANCEL | WZB_HELP
         );
         virtual ~RoadmapWizard( );
+        virtual void dispose() SAL_OVERRIDE;
 
         void            SetRoadmapHelpId( const OString& _rId );
 
@@ -89,7 +90,7 @@ namespace svt
         virtual bool    canAdvance() const SAL_OVERRIDE;
         virtual void    updateTravelUI() SAL_OVERRIDE;
 
-protected:
+    protected:
         /** declares a valid path in the wizard
 
             The very first path which is declared is automatically activated.
diff --git a/include/svtools/ruler.hxx b/include/svtools/ruler.hxx
index 06463cf..ba75ac7 100644
--- a/include/svtools/ruler.hxx
+++ b/include/svtools/ruler.hxx
@@ -711,6 +711,7 @@ protected:
 public:
             Ruler( vcl::Window* pParent, WinBits nWinStyle = WB_STDRULER );
     virtual ~Ruler();
+    virtual void dispose() SAL_OVERRIDE;
 
     virtual void    MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     virtual void    MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
diff --git a/include/svtools/scrwin.hxx b/include/svtools/scrwin.hxx
index 41a6a00..ccb3a3d 100644
--- a/include/svtools/scrwin.hxx
+++ b/include/svtools/scrwin.hxx
@@ -21,8 +21,8 @@
 #define INCLUDED_SVTOOLS_SCRWIN_HXX
 
 #include <svtools/svtdllapi.h>
-
 #include <vcl/scrbar.hxx>
+#include <vcl/vclptr.hxx>
 
 class DataChangedEvent;
 
@@ -49,9 +49,9 @@ private:
     long            nLinePixH;          // size of a line/column (pixel)
     long            nColumnPixW;
 
-    ScrollBar       aVScroll;           // the scrollbars
-    ScrollBar       aHScroll;
-    ScrollBarBox    aCornerWin;         // window in the bottom right corner
+    VclPtr<ScrollBar>    aVScroll;           // the scrollbars
+    VclPtr<ScrollBar>    aHScroll;
+    VclPtr<ScrollBarBox> aCornerWin;         // window in the bottom right corner
     bool            bScrolling:1,       // user controlled scrolling
                     bHandleDragging:1,  // scroll window while dragging
                     bHCenter:1,
@@ -64,6 +64,8 @@ private:
 public:
                     ScrollableWindow( vcl::Window* pParent, WinBits nBits = 0,
                                       ScrollableWindowFlags = SCRWIN_DEFAULT );
+    virtual         ~ScrollableWindow();
+    virtual void    dispose() SAL_OVERRIDE;
 
     virtual void    Resize() SAL_OVERRIDE;
     virtual void    Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
diff --git a/include/svtools/simptabl.hxx b/include/svtools/simptabl.hxx
index 821a1d7..ffeb734 100644
--- a/include/svtools/simptabl.hxx
+++ b/include/svtools/simptabl.hxx
@@ -53,7 +53,7 @@ private:
     Link                aHeaderBarDblClickLink;
     Link                aCommandLink;
     CommandEvent        aCEvt;
-    HeaderBar           aHeaderBar;
+    VclPtr<HeaderBar>   aHeaderBar;
     long                nOldPos;
     sal_uInt16          nHeaderItemId;
     bool                bPaintFlag;
@@ -89,6 +89,7 @@ public:
 
     SvSimpleTable(SvSimpleTableContainer& rParent, WinBits nBits = WB_BORDER);
     virtual ~SvSimpleTable();
+    virtual void dispose() SAL_OVERRIDE;
 
     void UpdateViewSize();
 
@@ -126,9 +127,9 @@ public:
     void            SetHeaderBarDblClickHdl( const Link& rLink ) { aHeaderBarDblClickLink = rLink; }
     const Link&     GetHeaderBarDblClickHdl() const { return aHeaderBarDblClickLink; }
 
-    void            SetHeaderBarHelpId(const OString& rHelpId) {aHeaderBar.SetHelpId(rHelpId);}
+    void            SetHeaderBarHelpId(const OString& rHelpId) { aHeaderBar->SetHelpId(rHelpId); }
 
-    HeaderBar&      GetTheHeaderBar() {return aHeaderBar;}
+    HeaderBar&      GetTheHeaderBar() { return *aHeaderBar.get(); }
 };
 
 
diff --git a/include/svtools/svmedit2.hxx b/include/svtools/svmedit2.hxx
index 2e17023..d6c30d2 100644
--- a/include/svtools/svmedit2.hxx
+++ b/include/svtools/svmedit2.hxx
@@ -28,7 +28,6 @@ class SVT_DLLPUBLIC ExtMultiLineEdit : public MultiLineEdit
 {
 public:
                     ExtMultiLineEdit( vcl::Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER );
-                    virtual ~ExtMultiLineEdit();
 
                     // methods of TextView
     void            InsertText( const OUString& rNew, bool bSelect = false );
@@ -37,7 +36,7 @@ public:
                     // methods of TextEngine
     void            SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 nStart, sal_uInt16 nEnd );
     void            SetLeftMargin( sal_uInt16 nLeftMargin );
-    sal_uLong           GetParagraphCount() const;
+    sal_uLong       GetParagraphCount() const;
 };
 
 #endif
diff --git a/include/svtools/svtabbx.hxx b/include/svtools/svtabbx.hxx
index 24450a3..364aae3 100644
--- a/include/svtools/svtabbx.hxx
+++ b/include/svtools/svtabbx.hxx
@@ -65,6 +65,7 @@ protected:
 public:
     SvTabListBox( vcl::Window* pParent, WinBits = WB_BORDER );
     virtual ~SvTabListBox();
+    virtual void dispose() SAL_OVERRIDE;
     void            SetTabs( long* pTabs, MapUnit = MAP_APPFONT );
     sal_uInt16          TabCount() const { return (sal_uInt16)nTabCount; }
     using SvTreeListBox::GetTab;
@@ -139,6 +140,7 @@ private:
 public:
     SvHeaderTabListBox( vcl::Window* pParent, WinBits nBits );
     virtual ~SvHeaderTabListBox();
+    virtual void dispose() SAL_OVERRIDE;
 
     virtual void    Paint( const Rectangle& ) SAL_OVERRIDE;
 
diff --git a/include/svtools/tabbar.hxx b/include/svtools/tabbar.hxx
index 1ecb744..37047a2 100644
--- a/include/svtools/tabbar.hxx
+++ b/include/svtools/tabbar.hxx
@@ -391,6 +391,7 @@ public:
 
                     TabBar( vcl::Window* pParent, WinBits nWinStyle = WB_STDTABBAR );
     virtual         ~TabBar();
+    virtual void    dispose() SAL_OVERRIDE;
 
     virtual void    MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     virtual void    MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
diff --git a/include/svtools/toolbarmenu.hxx b/include/svtools/toolbarmenu.hxx
index 2b20a31..598dec3 100644
--- a/include/svtools/toolbarmenu.hxx
+++ b/include/svtools/toolbarmenu.hxx
@@ -51,6 +51,7 @@ public:
                  WinBits nBits );
 
     virtual ~ToolbarMenu();
+    virtual void dispose() SAL_OVERRIDE;
 
     virtual void    MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     virtual void    MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
diff --git a/include/svtools/toolpanel/paneltabbar.hxx b/include/svtools/toolpanel/paneltabbar.hxx
index 18e4d1e..3e20b2d 100644
--- a/include/svtools/toolpanel/paneltabbar.hxx
+++ b/include/svtools/toolpanel/paneltabbar.hxx
@@ -52,6 +52,7 @@ namespace svt
     public:
         PanelTabBar( vcl::Window& i_rParentWindow, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent );
         virtual ~PanelTabBar();
+        virtual void dispose() SAL_OVERRIDE;
 
         // attribute access
         TabItemContent  GetTabItemContent() const;
diff --git a/include/svtools/toolpanel/toolpaneldeck.hxx b/include/svtools/toolpanel/toolpaneldeck.hxx
index d9c06ce..211c099 100644
--- a/include/svtools/toolpanel/toolpaneldeck.hxx
+++ b/include/svtools/toolpanel/toolpaneldeck.hxx
@@ -138,6 +138,7 @@ namespace svt
     public:
         ToolPanelDeck( vcl::Window& i_rParent, const WinBits i_nStyle = WB_DIALOGCONTROL );
         virtual ~ToolPanelDeck();
+        virtual void dispose() SAL_OVERRIDE;
 
         // attributes
         PDeckLayouter       GetLayouter() const;
diff --git a/include/svtools/treelistbox.hxx b/include/svtools/treelistbox.hxx
index 94ad1d7..2ab7d61 100644
--- a/include/svtools/treelistbox.hxx
+++ b/include/svtools/treelistbox.hxx
@@ -348,6 +348,7 @@ public:
     SvTreeListBox( vcl::Window* pParent, WinBits nWinStyle=0 );
     SvTreeListBox( vcl::Window* pParent, const ResId& rResId );
     virtual ~SvTreeListBox();
+    virtual void dispose() SAL_OVERRIDE;
 
     SvTreeList* GetModel() const { return pModel; }
     using SvListView::SetModel;
diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx
index 10db4d5..f1aa6c2 100644
--- a/include/svtools/valueset.hxx
+++ b/include/svtools/valueset.hxx
@@ -285,7 +285,8 @@ protected:
 public:
                     ValueSet( vcl::Window* pParent, WinBits nWinStyle, bool bDisableTransientChildren = false );
                     ValueSet( vcl::Window* pParent, const ResId& rResId, bool bDisableTransientChildren = false );
-                    virtual ~ValueSet();
+    virtual         ~ValueSet();
+    virtual void    dispose() SAL_OVERRIDE;
 
     virtual void    MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     virtual void    MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
diff --git a/include/svtools/wizardmachine.hxx b/include/svtools/wizardmachine.hxx
index 56bd679..053acdc 100644
--- a/include/svtools/wizardmachine.hxx
+++ b/include/svtools/wizardmachine.hxx
@@ -100,6 +100,7 @@ namespace svt
          */
         OWizardPage(vcl::Window *pParent, const OString& rID, const OUString& rUIXMLDescription);
         virtual ~OWizardPage();
+        virtual void dispose() SAL_OVERRIDE;
 
         // IWizardPageController overridables
         virtual void        initializePage() SAL_OVERRIDE;
@@ -175,6 +176,7 @@ namespace svt
         OWizardMachine(vcl::Window* _pParent, const WinBits i_nStyle, sal_uInt32 _nButtonFlags );
         OWizardMachine(vcl::Window* _pParent, sal_uInt32 _nButtonFlags );
         virtual ~OWizardMachine();
+        virtual void dispose() SAL_OVERRIDE;
 
         /// enable (or disable) buttons
         void    enableButtons(sal_uInt32 _nWizardButtonFlags, bool _bEnable);
diff --git a/include/svtools/wizdlg.hxx b/include/svtools/wizdlg.hxx
index 382403a..59a6e68 100644
--- a/include/svtools/wizdlg.hxx
+++ b/include/svtools/wizdlg.hxx
@@ -241,6 +241,7 @@ public:
     WizardDialog( vcl::Window* pParent, WinBits nStyle = WB_STDTABDIALOG );
     WizardDialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription );
     virtual ~WizardDialog();
+    virtual void dispose() SAL_OVERRIDE;
 
     virtual void        Resize() SAL_OVERRIDE;
     virtual void        StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
diff --git a/include/toolkit/awt/scrollabledialog.hxx b/include/toolkit/awt/scrollabledialog.hxx
index e75fac7..70e2b32 100644
--- a/include/toolkit/awt/scrollabledialog.hxx
+++ b/include/toolkit/awt/scrollabledialog.hxx
@@ -43,8 +43,8 @@ namespace toolkit
   template < class T >
     class ScrollableWrapper : public T, public ScrollableInterface
     {
-        ScrollBar          maHScrollBar;
-        ScrollBar          maVScrollBar;
+        VclPtr<ScrollBar>  maHScrollBar;
+        VclPtr<ScrollBar>  maVScrollBar;
         Size               maScrollArea;
         bool               mbHasHoriBar;
         bool               mbHasVertBar;
@@ -59,6 +59,7 @@ namespace toolkit
     public:
         ScrollableWrapper( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG );
         virtual ~ScrollableWrapper();
+        virtual void dispose() SAL_OVERRIDE;
         virtual void    SetScrollWidth( long nWidth ) SAL_OVERRIDE;
         virtual long    GetScrollWidth() SAL_OVERRIDE { return maScrollArea.Width(); }
         virtual void    SetScrollHeight( long nHeight ) SAL_OVERRIDE;
diff --git a/svtools/inc/roadmap.hxx b/svtools/inc/roadmap.hxx
index 362f797..15ee585 100644
--- a/svtools/inc/roadmap.hxx
+++ b/svtools/inc/roadmap.hxx
@@ -58,6 +58,7 @@ namespace svt
     public:
         ORoadmap( vcl::Window* _pParent, WinBits _nWinStyle = 0 );
         virtual ~ORoadmap( );
+        virtual void dispose() SAL_OVERRIDE;
 
         void            SetRoadmapBitmap( const BitmapEx& maBitmap, bool _bInvalidate = true );
 
diff --git a/svtools/inc/table/tablecontrol.hxx b/svtools/inc/table/tablecontrol.hxx
index 7b0e01b..3398e1e 100644
--- a/svtools/inc/table/tablecontrol.hxx
+++ b/svtools/inc/table/tablecontrol.hxx
@@ -67,6 +67,7 @@ namespace svt { namespace table
     public:
         TableControl( vcl::Window* _pParent, WinBits _nStyle );
         virtual ~TableControl();
+        virtual void dispose() SAL_OVERRIDE;
 
         /// sets a new table model
         void        SetModel( PTableModel _pModel );
diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx
index 657d29c..fbdeb82 100644
--- a/svtools/source/brwbox/brwbox1.cxx
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -101,9 +101,9 @@ void BrowseBox::ConstructImpl( BrowserMode nMode )
     nControlAreaWidth = USHRT_MAX;
     uRow.nSel = BROWSER_ENDOFSELECTION;
 
-    aHScroll.SetLineSize(1);
-    aHScroll.SetScrollHdl( LINK( this, BrowseBox, ScrollHdl ) );
-    aHScroll.SetEndScrollHdl( LINK( this, BrowseBox, EndScrollHdl ) );
+    aHScroll->SetLineSize(1);
+    aHScroll->SetScrollHdl( LINK( this, BrowseBox, ScrollHdl ) );
+    aHScroll->SetEndScrollHdl( LINK( this, BrowseBox, EndScrollHdl ) );
     pDataWin->Show();
 
     SetMode( nMode );
@@ -119,7 +119,7 @@ BrowseBox::BrowseBox( vcl::Window* pParent, WinBits nBits, BrowserMode nMode )
     :Control( pParent, nBits | WB_3DLOOK )
     ,DragSourceHelper( this )
     ,DropTargetHelper( this )
-    ,aHScroll( this, WinBits( WB_HSCROLL ) )
+    ,aHScroll( new ScrollBar(this, WinBits( WB_HSCROLL )) )
 {
     ConstructImpl( nMode );
 }
@@ -130,7 +130,7 @@ BrowseBox::BrowseBox( vcl::Window* pParent, const ResId& rId, BrowserMode nMode
     :Control( pParent, rId )
     ,DragSourceHelper( this )
     ,DropTargetHelper( this )
-    ,aHScroll( this, WinBits(WB_HSCROLL) )
+    ,aHScroll( new ScrollBar(this, WinBits(WB_HSCROLL)) )
 {
     ConstructImpl(nMode);
 }
@@ -138,6 +138,11 @@ BrowseBox::BrowseBox( vcl::Window* pParent, const ResId& rId, BrowserMode nMode
 
 BrowseBox::~BrowseBox()
 {
+    dispose();
+}
+
+void BrowseBox::dispose()
+{
     OSL_TRACE( "BrowseBox: %p~", this );
 
     if ( m_pImpl->m_pAccessible )
@@ -152,6 +157,7 @@ BrowseBox::~BrowseBox()
     delete getDataWindow()->pCornerWin;
     delete pDataWin;
     delete pVScroll;
+    aHScroll.disposeAndClear();
 
     // free columns-space
     for ( size_t i = 0, n = pCols->size(); i < n; ++i )
@@ -161,6 +167,7 @@ BrowseBox::~BrowseBox()
     delete pColSel;
     if ( bMultiSelection )
         delete uRow.pSel;
+    Control::dispose();
 }
 
 
@@ -916,7 +923,7 @@ long BrowseBox::ScrollColumns( long nCols )
     {
         // update internal value and scrollbar
         ++nFirstCol;
-        aHScroll.SetThumbPos( nFirstCol - FrozenColCount() );
+        aHScroll->SetThumbPos( nFirstCol - FrozenColCount() );
 
         if ( !bScrollable )
         {
@@ -962,7 +969,7 @@ long BrowseBox::ScrollColumns( long nCols )
     else if ( nCols == -1 )
     {
         --nFirstCol;
-        aHScroll.SetThumbPos( nFirstCol - FrozenColCount() );
+        aHScroll->SetThumbPos( nFirstCol - FrozenColCount() );
 
         if ( !bScrollable )
         {
@@ -1002,7 +1009,7 @@ long BrowseBox::ScrollColumns( long nCols )
         }
 
         nFirstCol = nFirstCol + (sal_uInt16)nCols;
-        aHScroll.SetThumbPos( nFirstCol - FrozenColCount() );
+        aHScroll->SetThumbPos( nFirstCol - FrozenColCount() );
     }
 
     // adjust external headerbar, if necessary
@@ -1140,7 +1147,7 @@ void BrowseBox::Clear()
     // nFirstCol may not be reset, else the scrolling code will become confused.
     // nFirstCol may only be changed when adding or deleting columns
     // nFirstCol = 0; -> wrong!
-    aHScroll.SetThumbPos( 0 );
+    aHScroll->SetThumbPos( 0 );
     pVScroll->SetThumbPos( 0 );
 
     Invalidate();
@@ -2212,9 +2219,9 @@ Rectangle BrowseBox::GetControlArea() const
 {
 
     return Rectangle(
-        Point( 0, GetOutputSizePixel().Height() - aHScroll.GetSizePixel().Height() ),
-        Size( GetOutputSizePixel().Width() - aHScroll.GetSizePixel().Width(),
-             aHScroll.GetSizePixel().Height() ) );
+        Point( 0, GetOutputSizePixel().Height() - aHScroll->GetSizePixel().Height() ),
+        Size( GetOutputSizePixel().Width() - aHScroll->GetSizePixel().Width(),
+             aHScroll->GetSizePixel().Height() ) );
 }
 
 
@@ -2237,7 +2244,7 @@ void BrowseBox::SetMode( BrowserMode nMode )
         getDataWindow()->bNoVScroll = false;
 
     if ( getDataWindow()->bNoHScroll )
-        aHScroll.Hide();
+        aHScroll->Hide();
 
     nControlAreaWidth = USHRT_MAX;
 
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx
index b64b7c4..ea0f60f 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -139,7 +139,7 @@ void BrowseBox::StateChanged( StateChangedType nStateChange )
         HeaderBar* pHeaderBar = getDataWindow()->pHeaderBar;
         if ( pHeaderBar )
             pHeaderBar->EnableRTL( IsRTLEnabled() );
-        aHScroll.EnableRTL( IsRTLEnabled() );
+        aHScroll->EnableRTL( IsRTLEnabled() );
         if( pVScroll )
             pVScroll->EnableRTL( IsRTLEnabled() );
         Resize();
@@ -561,13 +561,13 @@ void BrowseBox::Resize()
     // did we need a horizontal scroll bar or is there a Control Area?
     if ( !getDataWindow()->bNoHScroll &&
          ( ( pCols->size() - FrozenColCount() ) > 1 ) )
-        aHScroll.Show();
+        aHScroll->Show();
     else
-        aHScroll.Hide();
+        aHScroll->Hide();
 
     // calculate the size of the data window
     long nDataHeight = GetOutputSizePixel().Height() - GetTitleHeight();
-    if ( aHScroll.IsVisible() || ( nControlAreaWidth != USHRT_MAX ) )
+    if ( aHScroll->IsVisible() || ( nControlAreaWidth != USHRT_MAX ) )
         nDataHeight -= nSBSize;
 
     long nDataWidth = GetOutputSizePixel().Width();
@@ -627,9 +627,9 @@ void BrowseBox::Paint( const Rectangle& rRect )
 
     // draw delimitational lines
     if ( !getDataWindow()->bNoHScroll )
-        DrawLine( Point( 0, aHScroll.GetPosPixel().Y() ),
+        DrawLine( Point( 0, aHScroll->GetPosPixel().Y() ),
                   Point( GetOutputSizePixel().Width(),
-                         aHScroll.GetPosPixel().Y() ) );
+                         aHScroll->GetPosPixel().Y() ) );
 
     if ( nTitleLines )
     {
@@ -1176,15 +1176,15 @@ void BrowseBox::UpdateScrollbars()
                         :   !getDataWindow()->bNoHScroll;
     if ( !bNeedsHScroll )
     {
-        if ( aHScroll.IsVisible() )
+        if ( aHScroll->IsVisible() )
         {
-            aHScroll.Hide();
+            aHScroll->Hide();
         }
         aDataWinSize.Height() = GetOutputSizePixel().Height() - GetTitleHeight();
         if ( nControlAreaWidth != USHRT_MAX )
             aDataWinSize.Height() -= nCornerSize;
     }
-    else if ( !aHScroll.IsVisible() )
+    else if ( !aHScroll->IsVisible() )
     {
         Size aNewSize( aDataWinSize );
         aNewSize.Height() = GetOutputSizePixel().Height() - GetTitleHeight() - nCornerSize;
@@ -1196,7 +1196,7 @@ void BrowseBox::UpdateScrollbars()
         ? 0
         : nControlAreaWidth;
 
-    aHScroll.SetPosSizePixel(
+    aHScroll->SetPosSizePixel(
         Point( nHScrX, GetOutputSizePixel().Height() - nCornerSize ),
         Size( aDataWinSize.Width() - nHScrX, nCornerSize ) );
 
@@ -1209,10 +1209,10 @@ void BrowseBox::UpdateScrollbars()
         : (short)( nLastCol - nFirstCol );
 
     short nRange = std::max( nScrollCols, (short)0 );
-    aHScroll.SetVisibleSize( nVisibleHSize );
-    aHScroll.SetRange( Range( 0, nRange ));
-    if ( bNeedsHScroll && !aHScroll.IsVisible() )
-        aHScroll.Show();
+    aHScroll->SetVisibleSize( nVisibleHSize );
+    aHScroll->SetRange( Range( 0, nRange ));
+    if ( bNeedsHScroll && !aHScroll->IsVisible() )
+        aHScroll->Show();
 
     // adjust position and height of vertical scrollbar
     pVScroll->SetPageSize( nMaxRows );
@@ -1244,12 +1244,12 @@ void BrowseBox::UpdateScrollbars()
     // needs corner-window?
     // (do that AFTER positioning BOTH scrollbars)
     sal_uLong nActualCorderWidth = 0;
-    if (aHScroll.IsVisible() && pVScroll && pVScroll->IsVisible() )
+    if (aHScroll->IsVisible() && pVScroll && pVScroll->IsVisible() )
     {
         // if we have both scrollbars, the corner window fills the point of intersection of these two
         nActualCorderWidth = nCornerSize;
     }
-    else if ( !aHScroll.IsVisible() && ( nControlAreaWidth != USHRT_MAX ) )
+    else if ( !aHScroll->IsVisible() && ( nControlAreaWidth != USHRT_MAX ) )
     {
         // if we have no horizontal scrollbar, but a control area, we need the corner window to
         // fill the space between the control are and the right border
@@ -1260,7 +1260,7 @@ void BrowseBox::UpdateScrollbars()
         if ( !getDataWindow()->pCornerWin )
             getDataWindow()->pCornerWin = new ScrollBarBox( this, 0 );
         getDataWindow()->pCornerWin->SetPosSizePixel(
-            Point( GetOutputSizePixel().Width() - nActualCorderWidth, aHScroll.GetPosPixel().Y() ),
+            Point( GetOutputSizePixel().Width() - nActualCorderWidth, aHScroll->GetPosPixel().Y() ),
             Size( nActualCorderWidth, nCornerSize ) );
         getDataWindow()->pCornerWin->Show();
     }
@@ -1378,8 +1378,8 @@ IMPL_LINK(BrowseBox,ScrollHdl,ScrollBar*,pBar)
         return 0;
     }
 
-    if ( pBar == &aHScroll )
-        ScrollColumns( aHScroll.GetDelta() );
+    if ( pBar == aHScroll.get() )
+        ScrollColumns( aHScroll->GetDelta() );
     if ( pBar == pVScroll )
         ScrollRows( pVScroll->GetDelta() );
 
@@ -2063,7 +2063,7 @@ Rectangle BrowseBox::calcTableRect(bool _bOnScreen)
     long nY = aRowBar.Top() - aRect.Top();
     Size aSize(aRect.GetSize());
 
-    return Rectangle(aRowBar.TopRight(), Size(aSize.A() - nX, aSize.B() - nY - aHScroll.GetSizePixel().Height()) );
+    return Rectangle(aRowBar.TopRight(), Size(aSize.A() - nX, aSize.B() - nY - aHScroll->GetSizePixel().Height()) );
 }
 
 Rectangle BrowseBox::GetFieldRectPixelAbs( sal_Int32 _nRowId, sal_uInt16 _nColId, bool /*_bIsHeader*/, bool _bOnScreen )
diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
index ebf6219..366c858 100644
--- a/svtools/source/brwbox/datwin.cxx
+++ b/svtools/source/brwbox/datwin.cxx
@@ -218,11 +218,17 @@ BrowserDataWin::BrowserDataWin( BrowseBox* pParent )
 
 BrowserDataWin::~BrowserDataWin()
 {
+    dispose();
+}
+
+void BrowserDataWin::dispose()
+{
     bInDtor = true;
 
     for ( size_t i = 0, n = aInvalidRegion.size(); i < n; ++i )
         delete aInvalidRegion[ i ];
     aInvalidRegion.clear();
+    Control::dispose();
 }
 
 
@@ -399,7 +405,7 @@ void BrowserDataWin::Command( const CommandEvent& rEvt )
     if ( ( (rEvt.GetCommand() == COMMAND_WHEEL) ||
            (rEvt.GetCommand() == COMMAND_STARTAUTOSCROLL) ||
            (rEvt.GetCommand() == COMMAND_AUTOSCROLL) ) &&
-         ( HandleScrollCommand( rEvt, &pBox->aHScroll, pBox->pVScroll ) ) )
+         ( HandleScrollCommand( rEvt, pBox->aHScroll.get(), pBox->pVScroll ) ) )
       return;
 
     Point aEventPos( rEvt.GetMousePosPixel() );
diff --git a/svtools/source/brwbox/datwin.hxx b/svtools/source/brwbox/datwin.hxx
index bff1766..13fbe9d 100644
--- a/svtools/source/brwbox/datwin.hxx
+++ b/svtools/source/brwbox/datwin.hxx
@@ -137,7 +137,8 @@ public:
 
 public:
                     BrowserDataWin( BrowseBox* pParent );
-                    virtual ~BrowserDataWin();
+    virtual         ~BrowserDataWin();
+    virtual void    dispose() SAL_OVERRIDE;
 
     virtual void    DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
     virtual void    Paint( const Rectangle& rRect ) SAL_OVERRIDE;
diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx
index 7b0e577..dacec36 100644
--- a/svtools/source/brwbox/ebbcontrols.cxx
+++ b/svtools/source/brwbox/ebbcontrols.cxx
@@ -249,7 +249,13 @@ namespace svt
 
     CheckBoxControl::~CheckBoxControl()
     {
+        dispose();
+    }
+
+    void CheckBoxControl::dispose()
+    {
         delete pBox;
+        Control::dispose();
     }
 
 
diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx
index d63be61..7f31967 100644
--- a/svtools/source/brwbox/editbrowsebox.cxx
+++ b/svtools/source/brwbox/editbrowsebox.cxx
@@ -183,6 +183,11 @@ namespace svt
 
     EditBrowseBox::~EditBrowseBox()
     {
+        dispose();
+    }
+
+    void EditBrowseBox::dispose()
+    {
         if (nStartEvent)
             Application::RemoveUserEvent(nStartEvent);
         if (nEndEvent)
@@ -191,7 +196,7 @@ namespace svt
             Application::RemoveUserEvent(nCellModifiedEvent);
 
         delete pCheckBoxPaint;
-
+        BrowseBox::dispose();
     }
 
 
diff --git a/svtools/source/contnr/DocumentInfoPreview.cxx b/svtools/source/contnr/DocumentInfoPreview.cxx
index acf89b5..70451cb 100644
--- a/svtools/source/contnr/DocumentInfoPreview.cxx
+++ b/svtools/source/contnr/DocumentInfoPreview.cxx
@@ -44,16 +44,26 @@
 namespace svtools {
 
 ODocumentInfoPreview::ODocumentInfoPreview(vcl::Window * pParent, WinBits nBits):
-    Window(pParent, WB_DIALOGCONTROL), m_pEditWin(this, nBits),
+    Window(pParent, WB_DIALOGCONTROL),
+    m_pEditWin( new ExtMultiLineEdit(this, nBits) ),
     m_pInfoTable(new SvtDocInfoTable_Impl),
     m_aLanguageTag(SvtPathOptions().GetLanguageTag()) // detect application language
 {
-    m_pEditWin.SetLeftMargin(10);
-    m_pEditWin.Show();
-    m_pEditWin.EnableCursor(false);
+    m_pEditWin->SetLeftMargin(10);
+    m_pEditWin->Show();
+    m_pEditWin->EnableCursor(false);
 }
 
-ODocumentInfoPreview::~ODocumentInfoPreview() {}
+ODocumentInfoPreview::~ODocumentInfoPreview()
+{
+   dispose();
+}
+
+void ODocumentInfoPreview::dispose()
+{
+    m_pEditWin.disposeAndClear();
+    Window::dispose();
+}
 
 extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeODocumentInfoPreview(vcl::Window *pParent, VclBuilder::stringmap&)
 {
@@ -61,11 +71,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeODocumentInfoPreview(v
 }
 
 void ODocumentInfoPreview::Resize() {
-    m_pEditWin.SetPosSizePixel(Point(0, 0), GetOutputSize());
+    m_pEditWin->SetPosSizePixel(Point(0, 0), GetOutputSize());
 }
 
 void ODocumentInfoPreview::clear() {
-    m_pEditWin.SetText(OUString());
+    m_pEditWin->SetText(OUString());
 }
 
 void ODocumentInfoPreview::fill(
@@ -74,7 +84,7 @@ void ODocumentInfoPreview::fill(
 {
     assert(xDocProps.is());
 
-    m_pEditWin.SetAutoScroll(false);
+    m_pEditWin->SetAutoScroll(false);
 
     insertNonempty(DI_TITLE, xDocProps->getTitle());
     insertNonempty(DI_FROM, xDocProps->getAuthor());
@@ -126,22 +136,22 @@ void ODocumentInfoPreview::fill(
         }
     }
 
-    m_pEditWin.SetSelection(Selection(0, 0));
-    m_pEditWin.SetAutoScroll(true);
+    m_pEditWin->SetSelection(Selection(0, 0));
+    m_pEditWin->SetAutoScroll(true);
 }
 
 void ODocumentInfoPreview::insertEntry(
     OUString const & title, OUString const & value)
 {
-    if (!m_pEditWin.GetText().isEmpty()) {
-        m_pEditWin.InsertText(OUString("\n\n"));
+    if (!m_pEditWin->GetText().isEmpty()) {
+        m_pEditWin->InsertText(OUString("\n\n"));
     }
     OUString caption(title + ":\n");
-    m_pEditWin.InsertText(caption);
-    m_pEditWin.SetAttrib(
-        TextAttribFontWeight(WEIGHT_BOLD), m_pEditWin.GetParagraphCount() - 2,
+    m_pEditWin->InsertText(caption);
+    m_pEditWin->SetAttrib(
+        TextAttribFontWeight(WEIGHT_BOLD), m_pEditWin->GetParagraphCount() - 2,
         0, caption.getLength() - 1);
-    m_pEditWin.InsertText(value);
+    m_pEditWin->InsertText(value);
 }
 
 void ODocumentInfoPreview::insertNonempty(long id, OUString const & value)
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index af2c3b9..2f7eda9 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -192,7 +192,8 @@ protected:
 
 public:
     ViewTabListBox_Impl( vcl::Window* pParentWin, SvtFileView_Impl* pParent, sal_Int16 nFlags );
-   virtual ~ViewTabListBox_Impl();
+    virtual ~ViewTabListBox_Impl();
+    virtual void dispose() SAL_OVERRIDE;
 
     virtual void    Resize() SAL_OVERRIDE;
     virtual void    KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
@@ -634,9 +635,15 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( vcl::Window* pParentWin,
 
 ViewTabListBox_Impl::~ViewTabListBox_Impl()
 {
+    dispose();
+}
+
+void ViewTabListBox_Impl::dispose()
+{
     maResetQuickSearch.Stop();
 
     delete mpHeaderBar;
+    SvHeaderTabListBox::dispose();
 }
 
 
@@ -1089,10 +1096,16 @@ SvtFileView::SvtFileView( vcl::Window* pParent, WinBits nBits,
 
 SvtFileView::~SvtFileView()
 {
+    dispose();
+}
+
+void SvtFileView::dispose()
+{
     // use temp pointer to prevent access of deleted member (GetFocus())
     SvtFileView_Impl* pTemp = mpImp;
     mpImp = NULL;
     delete pTemp;
+    Control::dispose();
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvtFileView(vcl::Window *pParent,
diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx
index c599a39..851a693 100644
--- a/svtools/source/contnr/imivctl.hxx
+++ b/svtools/source/contnr/imivctl.hxx
@@ -23,6 +23,7 @@
 #include <vcl/virdev.hxx>
 #include <vcl/scrbar.hxx>
 #include <vcl/timer.hxx>
+#include <vcl/vclptr.hxx>
 #include <vcl/seleng.hxx>
 #include <tools/debug.hxx>
 #include "svtaccessiblefactory.hxx"
@@ -159,9 +160,9 @@ class SvxIconChoiceCtrl_Impl
 
     bool                    bChooseWithCursor;
     EntryList_Impl          aEntries;
-    ScrollBar               aVerSBar;
-    ScrollBar               aHorSBar;
-    ScrollBarBox            aScrBarBox;
+    VclPtr<ScrollBar>       aVerSBar;
+    VclPtr<ScrollBar>       aHorSBar;
+    VclPtr<ScrollBarBox>    aScrBarBox;
     Rectangle               aCurSelectionRect;
     std::vector<Rectangle*> aSelectedRectList;
     Idle                    aEditIdle;                 // for editing in place
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index 713b4c9..27a442e 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -76,7 +76,8 @@ public:
                         const OUString& rData,
                         const Link& rNotifyEditEnd );
 
-                    virtual ~IcnViewEdit_Impl();
+    virtual         ~IcnViewEdit_Impl();
+    virtual void    dispose() SAL_OVERRIDE;
     virtual void    KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
     virtual bool    PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     bool            EditingCanceled() const { return bCanceled; }
@@ -89,9 +90,9 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl(
     WinBits nWinStyle
 ) :
     aEntries( this ),
-    aVerSBar( pCurView, WB_DRAG | WB_VSCROLL ),
-    aHorSBar( pCurView, WB_DRAG | WB_HSCROLL ),
-    aScrBarBox( pCurView ),
+    aVerSBar( new ScrollBar(pCurView, WB_DRAG | WB_VSCROLL) ),
+    aHorSBar( new ScrollBar(pCurView, WB_DRAG | WB_HSCROLL) ),
+    aScrBarBox( new ScrollBarBox(pCurView) ),
     aImageSize( 32, 32 ),
     pColumns( 0 )
 {
@@ -126,14 +127,14 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl(
     pImpCursor = new IcnCursor_Impl( this );
     pGridMap = new IcnGridMap_Impl( this );
 
-    aVerSBar.SetScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, ScrollUpDownHdl ) );
-    aHorSBar.SetScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, ScrollLeftRightHdl ) );
+    aVerSBar->SetScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, ScrollUpDownHdl ) );
+    aHorSBar->SetScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, ScrollLeftRightHdl ) );
     Link aEndScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, EndScrollHdl ) );
-    aVerSBar.SetEndScrollHdl( aEndScrollHdl );
-    aHorSBar.SetEndScrollHdl( aEndScrollHdl );
+    aVerSBar->SetEndScrollHdl( aEndScrollHdl );
+    aHorSBar->SetEndScrollHdl( aEndScrollHdl );
 
-    nHorSBarHeight = aHorSBar.GetSizePixel().Height();
-    nVerSBarWidth = aVerSBar.GetSizePixel().Width();
+    nHorSBarHeight = aHorSBar->GetSizePixel().Height();
+    nVerSBarWidth = aVerSBar->GetSizePixel().Width();
 
     aEditIdle.SetPriority( VCL_IDLE_PRIORITY_LOWEST );
     aEditIdle.SetIdleHdl(LINK(this,SvxIconChoiceCtrl_Impl,EditTimeoutHdl));
@@ -168,6 +169,10 @@ SvxIconChoiceCtrl_Impl::~SvxIconChoiceCtrl_Impl()
     delete pEntryPaintDev;
     ClearSelectedRectList();
     ClearColumnList();
+    aVerSBar.disposeAndClear();
+    aHorSBar.disposeAndClear();
+    aScrBarBox.disposeAndClear();
+
 }
 
 void SvxIconChoiceCtrl_Impl::Clear( bool bInCtor )
@@ -503,11 +508,11 @@ void SvxIconChoiceCtrl_Impl::AdjustVirtSize( const Rectangle& rRect )
         Range aRange;
         aVirtOutputSize.Width() += nWidthOffs;
         aRange.Max() = aVirtOutputSize.Width();
-        aHorSBar.SetRange( aRange );
+        aHorSBar->SetRange( aRange );
 
         aVirtOutputSize.Height() += nHeightOffs;
         aRange.Max() = aVirtOutputSize.Height();
-        aVerSBar.SetRange( aRange );
+        aVerSBar->SetRange( aRange );
 
         pImpCursor->Clear();
         pGridMap->OutputSizeChanged();
@@ -753,9 +758,9 @@ void SvxIconChoiceCtrl_Impl::RepaintEntries( sal_uInt16 nEntryFlagsMask )
 
 void SvxIconChoiceCtrl_Impl::InitScrollBarBox()
 {
-    aScrBarBox.SetSizePixel( Size(nVerSBarWidth-1, nHorSBarHeight-1) );
+    aScrBarBox->SetSizePixel( Size(nVerSBarWidth-1, nHorSBarHeight-1) );
     Size aSize( pView->GetOutputSizePixel() );
-    aScrBarBox.SetPosPixel( Point(aSize.Width()-nVerSBarWidth+1, aSize.Height()-nHorSBarHeight+1));
+    aScrBarBox->SetPosPixel( Point(aSize.Width()-nVerSBarWidth+1, aSize.Height()-nHorSBarHeight+1));
 }
 
 bool SvxIconChoiceCtrl_Impl::MouseButtonDown( const MouseEvent& rMEvt)
@@ -1256,8 +1261,8 @@ void SvxIconChoiceCtrl_Impl::PositionScrollBars( long nRealWidth, long nRealHeig
     Point aPos( 0, nRealHeight );
     aPos.Y() -= nHorSBarHeight;
 
-    if( aHorSBar.GetPosPixel() != aPos )
-        aHorSBar.SetPosPixel( aPos );
+    if( aHorSBar->GetPosPixel() != aPos )
+        aHorSBar->SetPosPixel( aPos );
 
     // vertical scrollbar
     aPos.X() = nRealWidth; aPos.Y() = 0;
@@ -1265,8 +1270,8 @@ void SvxIconChoiceCtrl_Impl::PositionScrollBars( long nRealWidth, long nRealHeig
     aPos.X()++;
     aPos.Y()--;
 
-    if( aVerSBar.GetPosPixel() != aPos )
-        aVerSBar.SetPosPixel( aPos );
+    if( aVerSBar->GetPosPixel() != aPos )
+        aVerSBar->SetPosPixel( aPos );
 }
 
 void SvxIconChoiceCtrl_Impl::AdjustScrollBars( bool )
@@ -1346,27 +1351,27 @@ void SvxIconChoiceCtrl_Impl::AdjustScrollBars( bool )
     }
 
     // size vertical scrollbar
-    long nThumb = aVerSBar.GetThumbPos();
+    long nThumb = aVerSBar->GetThumbPos();
     Size aSize( nVerSBarWidth, nRealHeight );
     aSize.Height() += 2;
-    if( aSize != aVerSBar.GetSizePixel() )
-        aVerSBar.SetSizePixel( aSize );
-    aVerSBar.SetVisibleSize( nVisibleHeight );
-    aVerSBar.SetPageSize( GetScrollBarPageSize( nVisibleHeight ));
+    if( aSize != aVerSBar->GetSizePixel() )
+        aVerSBar->SetSizePixel( aSize );
+    aVerSBar->SetVisibleSize( nVisibleHeight );
+    aVerSBar->SetPageSize( GetScrollBarPageSize( nVisibleHeight ));
 
     if( nResult & 0x0001 )
     {
-        aVerSBar.SetThumbPos( nThumb );
-        aVerSBar.Show();
+        aVerSBar->SetThumbPos( nThumb );
+        aVerSBar->Show();
     }
     else
     {
-        aVerSBar.SetThumbPos( 0 );
-        aVerSBar.Hide();
+        aVerSBar->SetThumbPos( 0 );
+        aVerSBar->Hide();
     }
 
     // size horizontal scrollbar
-    nThumb = aHorSBar.GetThumbPos();
+    nThumb = aHorSBar->GetThumbPos();
     aSize.Width() = nRealWidth;
     aSize.Height() = nHorSBarHeight;
     aSize.Width()++;
@@ -1375,19 +1380,19 @@ void SvxIconChoiceCtrl_Impl::AdjustScrollBars( bool )
         aSize.Width()++;
         nRealWidth++;
     }
-    if( aSize != aHorSBar.GetSizePixel() )
-        aHorSBar.SetSizePixel( aSize );
-    aHorSBar.SetVisibleSize( nVisibleWidth );
-    aHorSBar.SetPageSize( GetScrollBarPageSize(nVisibleWidth ));
+    if( aSize != aHorSBar->GetSizePixel() )
+        aHorSBar->SetSizePixel( aSize );
+    aHorSBar->SetVisibleSize( nVisibleWidth );
+    aHorSBar->SetPageSize( GetScrollBarPageSize(nVisibleWidth ));
     if( nResult & 0x0002 )
     {
-        aHorSBar.SetThumbPos( nThumb );
-        aHorSBar.Show();
+        aHorSBar->SetThumbPos( nThumb );
+        aHorSBar->Show();
     }
     else
     {
-        aHorSBar.SetThumbPos( 0 );
-        aHorSBar.Hide();
+        aHorSBar->SetThumbPos( 0 );
+        aHorSBar->Hide();
     }
 
     aOutputSize.Width() = nRealWidth;
@@ -1404,9 +1409,9 @@ void SvxIconChoiceCtrl_Impl::AdjustScrollBars( bool )
     }
 
     if( (nResult & (0x0001|0x0002)) == (0x0001|0x0002) )
-        aScrBarBox.Show();
+        aScrBarBox->Show();
     else
-        aScrBarBox.Hide();
+        aScrBarBox->Hide();
 }
 
 void SvxIconChoiceCtrl_Impl::Resize()
@@ -1441,7 +1446,7 @@ void SvxIconChoiceCtrl_Impl::Resize()
 
 bool SvxIconChoiceCtrl_Impl::CheckHorScrollBar()
 {
-    if( !pZOrderList || !aHorSBar.IsVisible() )
+    if( !pZOrderList || !aHorSBar->IsVisible() )
         return false;
     const MapMode& rMapMode = pView->GetMapMode();
     Point aOrigin( rMapMode.GetOrigin() );
@@ -1459,18 +1464,18 @@ bool SvxIconChoiceCtrl_Impl::CheckHorScrollBar()
             if( nRight > nMostRight )
                 nMostRight = nRight;
         }
-        aHorSBar.Hide();
+        aHorSBar->Hide();
         aOutputSize.Height() += nHorSBarHeight;
         aVirtOutputSize.Width() = nMostRight;
-        aHorSBar.SetThumbPos( 0 );
+        aHorSBar->SetThumbPos( 0 );
         Range aRange;
         aRange.Max() = nMostRight - 1;
-        aHorSBar.SetRange( aRange  );
-        if( aVerSBar.IsVisible() )
+        aHorSBar->SetRange( aRange  );
+        if( aVerSBar->IsVisible() )
         {
-            Size aSize( aVerSBar.GetSizePixel());
+            Size aSize( aVerSBar->GetSizePixel());
             aSize.Height() += nHorSBarHeight;
-            aVerSBar.SetSizePixel( aSize );
+            aVerSBar->SetSizePixel( aSize );
         }
         return true;
     }
@@ -1479,7 +1484,7 @@ bool SvxIconChoiceCtrl_Impl::CheckHorScrollBar()
 
 bool SvxIconChoiceCtrl_Impl::CheckVerScrollBar()
 {
-    if( !pZOrderList || !aVerSBar.IsVisible() )
+    if( !pZOrderList || !aVerSBar->IsVisible() )
         return false;
     const MapMode& rMapMode = pView->GetMapMode();
     Point aOrigin( rMapMode.GetOrigin() );
@@ -1497,18 +1502,18 @@ bool SvxIconChoiceCtrl_Impl::CheckVerScrollBar()
             if( nBottom > nDeepest )
                 nDeepest = nBottom;
         }
-        aVerSBar.Hide();
+        aVerSBar->Hide();
         aOutputSize.Width() += nVerSBarWidth;
         aVirtOutputSize.Height() = nDeepest;
-        aVerSBar.SetThumbPos( 0 );
+        aVerSBar->SetThumbPos( 0 );
         Range aRange;
         aRange.Max() = nDeepest - 1;
-        aVerSBar.SetRange( aRange  );
-        if( aHorSBar.IsVisible() )
+        aVerSBar->SetRange( aRange  );
+        if( aHorSBar->IsVisible() )
         {
-            Size aSize( aHorSBar.GetSizePixel());
+            Size aSize( aHorSBar->GetSizePixel());
             aSize.Width() += nVerSBarWidth;
-            aHorSBar.SetSizePixel( aSize );
+            aHorSBar->SetSizePixel( aSize );
         }
         return true;
     }
@@ -1522,10 +1527,10 @@ void SvxIconChoiceCtrl_Impl::CheckScrollBars()
     CheckVerScrollBar();
     if( CheckHorScrollBar() )
         CheckVerScrollBar();
-    if( aVerSBar.IsVisible() && aHorSBar.IsVisible() )
-        aScrBarBox.Show();
+    if( aVerSBar->IsVisible() && aHorSBar->IsVisible() )
+        aScrBarBox->Show();
     else
-        aScrBarBox.Hide();
+        aScrBarBox->Hide();
 }
 
 
@@ -1808,7 +1813,7 @@ void SvxIconChoiceCtrl_Impl::PaintEntry( SvxIconChoiceCtrlEntry* pEntry, const P
     }
 
     bool bResetClipRegion = false;
-    if( !pView->IsClipRegion() && (aVerSBar.IsVisible() || aHorSBar.IsVisible()) )
+    if( !pView->IsClipRegion() && (aVerSBar->IsVisible() || aHorSBar->IsVisible()) )
     {
         Rectangle aOutputArea( GetOutputRect() );
         if( aOutputArea.IsOver(aTextRect) || aOutputArea.IsOver(aBmpRect) )
@@ -2109,8 +2114,8 @@ long SvxIconChoiceCtrl_Impl::CalcBoundingHeight( SvxIconChoiceCtrlEntry* pEntry
     if( nHeight > nMaxBoundHeight )
     {
         ((SvxIconChoiceCtrl_Impl*)this)->nMaxBoundHeight = nHeight;
-        ((SvxIconChoiceCtrl_Impl*)this)->aHorSBar.SetLineSize( GetScrollBarLineSize() );
-        ((SvxIconChoiceCtrl_Impl*)this)->aVerSBar.SetLineSize( GetScrollBarLineSize() );
+        ((SvxIconChoiceCtrl_Impl*)this)->aHorSBar->SetLineSize( GetScrollBarLineSize() );
+        ((SvxIconChoiceCtrl_Impl*)this)->aVerSBar->SetLineSize( GetScrollBarLineSize() );
     }
     return nHeight;
 }
@@ -2457,16 +2462,16 @@ void SvxIconChoiceCtrl_Impl::MakeVisible( const Rectangle& rRect, bool bScrBar,
     else
         pView->Invalidate(INVALIDATE_NOCHILDREN);
 
-    if( aHorSBar.IsVisible() || aVerSBar.IsVisible() )
+    if( aHorSBar->IsVisible() || aVerSBar->IsVisible() )
     {
         if( !bScrBar )
         {
             aOrigin *= -1;
             // correct thumbs
-            if(aHorSBar.IsVisible() && aHorSBar.GetThumbPos() != aOrigin.X())
-                aHorSBar.SetThumbPos( aOrigin.X() );
-            if(aVerSBar.IsVisible() && aVerSBar.GetThumbPos() != aOrigin.Y())
-                aVerSBar.SetThumbPos( aOrigin.Y() );
+            if(aHorSBar->IsVisible() && aHorSBar->GetThumbPos() != aOrigin.X())
+                aHorSBar->SetThumbPos( aOrigin.X() );
+            if(aVerSBar->IsVisible() && aVerSBar->GetThumbPos() != aOrigin.Y())
+                aVerSBar->SetThumbPos( aOrigin.Y() );
         }
     }
 
@@ -3319,11 +3324,17 @@ IcnViewEdit_Impl::IcnViewEdit_Impl( SvtIconChoiceCtrl* pParent, const Point& rPo
 
 IcnViewEdit_Impl::~IcnViewEdit_Impl()
 {
+    dispose();
+}
+
+void IcnViewEdit_Impl::dispose()
+{
     if( !bAlreadyInCallback )
     {
         Application::RemoveAccel( &aAccReturn );
         Application::RemoveAccel( &aAccEscape );
     }
+    MultiLineEdit::dispose();
 }
 
 void IcnViewEdit_Impl::CallCallBackHdl_Impl()
@@ -3446,16 +3457,16 @@ void SvxIconChoiceCtrl_Impl::InitSettings()
     if( nScrBarSize != nHorSBarHeight || nScrBarSize != nVerSBarWidth )
     {
         nHorSBarHeight = nScrBarSize;
-        Size aSize( aHorSBar.GetSizePixel() );
+        Size aSize( aHorSBar->GetSizePixel() );
         aSize.Height() = nScrBarSize;
-        aHorSBar.Hide();
-        aHorSBar.SetSizePixel( aSize );
+        aHorSBar->Hide();
+        aHorSBar->SetSizePixel( aSize );
 
         nVerSBarWidth = nScrBarSize;
-        aSize = aVerSBar.GetSizePixel();
+        aSize = aVerSBar->GetSizePixel();
         aSize.Width() = nScrBarSize;
-        aVerSBar.Hide();
-        aVerSBar.SetSizePixel( aSize );
+        aVerSBar->Hide();
+        aVerSBar->SetSizePixel( aSize );
 
         Size aOSize( pView->Control::GetOutputSizePixel() );
         PositionScrollBars( aOSize.Width(), aOSize.Height() );
diff --git a/svtools/source/contnr/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx
index da44f6e..96a7529 100644
--- a/svtools/source/contnr/ivctrl.cxx
+++ b/svtools/source/contnr/ivctrl.cxx
@@ -88,8 +88,14 @@ SvtIconChoiceCtrl::SvtIconChoiceCtrl( vcl::Window* pParent, WinBits nWinStyle )
 
 SvtIconChoiceCtrl::~SvtIconChoiceCtrl()
 {
+    dispose();
+}
+
+void SvtIconChoiceCtrl::dispose()
+{
     _pImp->CallEventListeners( VCLEVENT_OBJECT_DYING );
     delete _pImp;
+    Control::dispose();
 }
 
 SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::InsertEntry( const OUString& rText, const Image& rImage, sal_uLong nPos, const Point* pPos, sal_uInt16 nFlags  )
diff --git a/svtools/source/contnr/simptabl.cxx b/svtools/source/contnr/simptabl.cxx
index c5d024c..9cbcc04 100644
--- a/svtools/source/contnr/simptabl.cxx
+++ b/svtools/source/contnr/simptabl.cxx
@@ -81,7 +81,7 @@ void SvSimpleTableContainer::GetFocus()
 SvSimpleTable::SvSimpleTable(SvSimpleTableContainer& rParent, WinBits nBits):
         SvHeaderTabListBox(&rParent, nBits | WB_CLIPCHILDREN | WB_HSCROLL | WB_TABSTOP),
         m_rParentTableContainer(rParent),
-        aHeaderBar(&rParent,WB_BUTTONSTYLE | WB_BORDER | WB_TABSTOP),
+        aHeaderBar(new HeaderBar(&rParent,WB_BUTTONSTYLE | WB_BORDER | WB_TABSTOP)),
         nHeaderItemId(1),
         bPaintFlag(true),
         aCollator(*(IntlWrapper( Application::GetSettings().GetLanguageTag() ).getCaseCollator()))
@@ -92,40 +92,47 @@ SvSimpleTable::SvSimpleTable(SvSimpleTableContainer& rParent, WinBits nBits):
     nSortCol = 0xFFFF;
     nOldPos = 0;
 
-    aHeaderBar.SetStartDragHdl(LINK( this, SvSimpleTable, StartDragHdl));
-    aHeaderBar.SetDragHdl(LINK( this, SvSimpleTable, DragHdl));
-    aHeaderBar.SetEndDragHdl(LINK( this, SvSimpleTable, EndDragHdl));
-    aHeaderBar.SetSelectHdl(LINK( this, SvSimpleTable, HeaderBarClick));
-    aHeaderBar.SetDoubleClickHdl(LINK( this, SvSimpleTable, HeaderBarDblClick));
+    aHeaderBar->SetStartDragHdl(LINK( this, SvSimpleTable, StartDragHdl));
+    aHeaderBar->SetDragHdl(LINK( this, SvSimpleTable, DragHdl));
+    aHeaderBar->SetEndDragHdl(LINK( this, SvSimpleTable, EndDragHdl));
+    aHeaderBar->SetSelectHdl(LINK( this, SvSimpleTable, HeaderBarClick));
+    aHeaderBar->SetDoubleClickHdl(LINK( this, SvSimpleTable, HeaderBarDblClick));
 
     GetModel()->SetCompareHdl( LINK( this, SvSimpleTable, CompareHdl));
 
     EnableCellFocus();
     DisableTransientChildren();
-    InitHeaderBar( &aHeaderBar );
+    InitHeaderBar( aHeaderBar );
 
     UpdateViewSize();
 
-    aHeaderBar.Show();
+    aHeaderBar->Show();
     SvHeaderTabListBox::Show();
 }
 
 SvSimpleTable::~SvSimpleTable()
 {
+    dispose();
+}
+
+void SvSimpleTable::dispose()
+{
     m_rParentTableContainer.SetTable(NULL);
+    aHeaderBar.disposeAndClear();
+    SvHeaderTabListBox::dispose();
 }
 
 void SvSimpleTable::UpdateViewSize()
 {
     Size theWinSize=m_rParentTableContainer.GetOutputSizePixel();
-    Size HbSize=aHeaderBar.GetSizePixel();
+    Size HbSize=aHeaderBar->GetSizePixel();
 
     HbSize.Width()=theWinSize.Width();
     theWinSize.Height()-=HbSize.Height();
     Point thePos(0,0);
 
-    aHeaderBar.SetPosPixel(thePos);
-    aHeaderBar.SetSizePixel(HbSize);
+    aHeaderBar->SetPosPixel(thePos);
+    aHeaderBar->SetSizePixel(HbSize);
 
     thePos.Y()+=HbSize.Height();
     SvHeaderTabListBox::SetPosPixel(thePos);
@@ -138,9 +145,9 @@ void SvSimpleTable::NotifyScrolled()
     long nOffset=-GetXOffset();
     if(nOldPos!=nOffset)
     {
-        aHeaderBar.SetOffset(nOffset);
-        aHeaderBar.Invalidate();
-        aHeaderBar.Update();
+        aHeaderBar->SetOffset(nOffset);
+        aHeaderBar->Invalidate();
+        aHeaderBar->Update();
         nOldPos=nOffset;
     }
     SvHeaderTabListBox::NotifyScrolled();
@@ -153,18 +160,18 @@ void SvSimpleTable::SetTabs()
     sal_uInt16 nPrivTabCount = TabCount();
     if ( nPrivTabCount )
     {
-        if ( nPrivTabCount > aHeaderBar.GetItemCount() )
-            nPrivTabCount = aHeaderBar.GetItemCount();
+        if ( nPrivTabCount > aHeaderBar->GetItemCount() )
+            nPrivTabCount = aHeaderBar->GetItemCount();
 
         sal_uInt16 i, nPos = 0;
         for ( i = 1; i < nPrivTabCount; ++i )
         {
             sal_uInt16 nNewSize = static_cast< sal_uInt16 >( GetTab(i) ) - nPos;
-            aHeaderBar.SetItemSize( i, nNewSize );
+            aHeaderBar->SetItemSize( i, nNewSize );
             nPos = (sal_uInt16)GetTab(i);
         }
 
-        aHeaderBar.SetItemSize( i, HEADERBAR_FULLSIZE ); // because no tab for last entry
+        aHeaderBar->SetItemSize( i, HEADERBAR_FULLSIZE ); // because no tab for last entry
     }
 }
 
@@ -182,19 +189,19 @@ void SvSimpleTable::Paint( const Rectangle& rRect )
     long nOffset=-GetXOffset();
     nOldPos=nOffset;
 
-    aHeaderBar.SetOffset(nOffset);
-    aHeaderBar.Invalidate();
+    aHeaderBar->SetOffset(nOffset);
+    aHeaderBar->Invalidate();
 
     if(nPrivTabCount && bPaintFlag)
     {
-        if(nPrivTabCount>aHeaderBar.GetItemCount())
-                nPrivTabCount=aHeaderBar.GetItemCount();
+        if(nPrivTabCount>aHeaderBar->GetItemCount())
+                nPrivTabCount=aHeaderBar->GetItemCount();
 
         sal_uInt16 nPos = 0;
         for(sal_uInt16 i=1;i<nPrivTabCount;i++)
         {
             sal_uInt16 nNewSize = static_cast< sal_uInt16 >( GetTab(i) ) - nPos;
-            aHeaderBar.SetItemSize( i, nNewSize );
+            aHeaderBar->SetItemSize( i, nNewSize );
             nPos= static_cast< sal_uInt16 >( GetTab(i) );
         }
     }
@@ -207,7 +214,7 @@ void SvSimpleTable::InsertHeaderEntry(const OUString& rText,
     sal_Int32 nEnd = rText.indexOf( '\t' );
     if( nEnd == -1 )
     {
-        aHeaderBar.InsertItem(nHeaderItemId++, rText, 0, nBits, nCol);
+        aHeaderBar->InsertItem(nHeaderItemId++, rText, 0, nBits, nCol);
     }
     else
     {
@@ -215,7 +222,7 @@ void SvSimpleTable::InsertHeaderEntry(const OUString& rText,
         do
         {
             OUString aString = rText.getToken(0, '\t', nIndex);
-            aHeaderBar.InsertItem(nHeaderItemId++, aString, 0, nBits, nCol);
+            aHeaderBar->InsertItem(nHeaderItemId++, aString, 0, nBits, nCol);
         }
         while ( nIndex >= 0 );
     }
@@ -224,7 +231,7 @@ void SvSimpleTable::InsertHeaderEntry(const OUString& rText,
 
 void SvSimpleTable::ClearHeader()
 {
-    aHeaderBar.Clear();
+    aHeaderBar->Clear();
 }
 
 void SvSimpleTable::ShowTable()
@@ -259,25 +266,25 @@ bool SvSimpleTable::IsEnabled() const
 
 sal_uInt16 SvSimpleTable::GetSelectedCol()
 {
-    return (aHeaderBar.GetCurItemId()-1);
+    return (aHeaderBar->GetCurItemId()-1);
 }
 
 void SvSimpleTable::SortByCol(sal_uInt16 nCol, bool bDir)
 {
     if(nSortCol!=0xFFFF)
-        aHeaderBar.SetItemBits(nSortCol+1,HIB_STDSTYLE);
+        aHeaderBar->SetItemBits(nSortCol+1,HIB_STDSTYLE);
 
     if (nCol != 0xFFFF)
     {
         if(bDir || nSortCol != nCol)
         {
-            aHeaderBar.SetItemBits( nCol+1, HIB_STDSTYLE | HIB_DOWNARROW);
+            aHeaderBar->SetItemBits( nCol+1, HIB_STDSTYLE | HIB_DOWNARROW);
             GetModel()->SetSortMode(SortAscending);
             bDir = true;
         }
         else
         {
-            aHeaderBar.SetItemBits( nCol+1, HIB_STDSTYLE | HIB_UPARROW);
+            aHeaderBar->SetItemBits( nCol+1, HIB_STDSTYLE | HIB_UPARROW);
             GetModel()->SetSortMode(SortDescending);
         }
         if(nSortCol == nCol)
@@ -300,9 +307,9 @@ void SvSimpleTable::SortByCol(sal_uInt16 nCol, bool bDir)
 
 void SvSimpleTable::HBarClick()
 {
-    sal_uInt16 nId=aHeaderBar.GetCurItemId();
+    sal_uInt16 nId=aHeaderBar->GetCurItemId();
 
-    if (aHeaderBar.GetItemBits(nId) & HIB_CLICKABLE)
+    if (aHeaderBar->GetItemBits(nId) & HIB_CLICKABLE)
     {
         if(nId==nSortCol+1)
         {
@@ -324,24 +331,24 @@ void SvSimpleTable::HBarDblClick()
 
 void SvSimpleTable::HBarStartDrag()
 {
-    if(!aHeaderBar.IsItemMode())
+    if(!aHeaderBar->IsItemMode())
     {
         Rectangle aSizeRect(Point(0,0),
             SvHeaderTabListBox::GetOutputSizePixel());
-        aSizeRect.Left()=-GetXOffset()+aHeaderBar.GetDragPos();
-        aSizeRect.Right()=-GetXOffset()+aHeaderBar.GetDragPos();
+        aSizeRect.Left()=-GetXOffset()+aHeaderBar->GetDragPos();
+        aSizeRect.Right()=-GetXOffset()+aHeaderBar->GetDragPos();
         ShowTracking( aSizeRect, SHOWTRACK_SPLIT );
     }
 }
 void SvSimpleTable::HBarDrag()
 {
     HideTracking();
-    if(!aHeaderBar.IsItemMode())
+    if(!aHeaderBar->IsItemMode())
     {
         Rectangle aSizeRect(Point(0,0),
             SvHeaderTabListBox::GetOutputSizePixel());
-        aSizeRect.Left()=-GetXOffset()+aHeaderBar.GetDragPos();
-        aSizeRect.Right()=-GetXOffset()+aHeaderBar.GetDragPos();
+        aSizeRect.Left()=-GetXOffset()+aHeaderBar->GetDragPos();
+        aSizeRect.Right()=-GetXOffset()+aHeaderBar->GetDragPos();
         ShowTracking( aSizeRect, SHOWTRACK_SPLIT );
     }
 }
@@ -352,14 +359,14 @@ void SvSimpleTable::HBarEndDrag()
 
     if(nPrivTabCount)
     {
-        if(nPrivTabCount>aHeaderBar.GetItemCount())
-                nPrivTabCount=aHeaderBar.GetItemCount();
+        if(nPrivTabCount>aHeaderBar->GetItemCount())
+                nPrivTabCount=aHeaderBar->GetItemCount();
 
         sal_uInt16 nPos=0;
         sal_uInt16 nNewSize=0;
         for(sal_uInt16 i=1;i<nPrivTabCount;i++)
         {
-            nNewSize = static_cast< sal_uInt16 >( aHeaderBar.GetItemSize(i) ) + nPos;
+            nNewSize = static_cast< sal_uInt16 >( aHeaderBar->GetItemSize(i) ) + nPos;
             SetTab( i, nNewSize, MAP_PIXEL );
             nPos = nNewSize;
         }
@@ -379,7 +386,7 @@ void SvSimpleTable::Command( const CommandEvent& rCEvt )
 
 IMPL_LINK( SvSimpleTable, StartDragHdl, HeaderBar*, pCtr)
 {
-    if(pCtr==&aHeaderBar)
+    if(pCtr==aHeaderBar.get())
     {
         HBarStartDrag();
     }
@@ -388,7 +395,7 @@ IMPL_LINK( SvSimpleTable, StartDragHdl, HeaderBar*, pCtr)
 
 IMPL_LINK( SvSimpleTable, DragHdl, HeaderBar*, pCtr)
 {
-    if(pCtr==&aHeaderBar)
+    if(pCtr==aHeaderBar.get())
     {
         HBarDrag();
     }
@@ -397,7 +404,7 @@ IMPL_LINK( SvSimpleTable, DragHdl, HeaderBar*, pCtr)
 
 IMPL_LINK( SvSimpleTable, EndDragHdl, HeaderBar*, pCtr)
 {
-    if(pCtr==&aHeaderBar)
+    if(pCtr==aHeaderBar.get())
     {
         HBarEndDrag();
     }
@@ -406,7 +413,7 @@ IMPL_LINK( SvSimpleTable, EndDragHdl, HeaderBar*, pCtr)
 
 IMPL_LINK( SvSimpleTable, HeaderBarClick, HeaderBar*, pCtr)
 {
-    if(pCtr==&aHeaderBar)
+    if(pCtr==aHeaderBar.get())
     {
         HBarClick();
     }
@@ -415,7 +422,7 @@ IMPL_LINK( SvSimpleTable, HeaderBarClick, HeaderBar*, pCtr)
 
 IMPL_LINK( SvSimpleTable, HeaderBarDblClick, HeaderBar*, pCtr)
 {
-    if(pCtr==&aHeaderBar)
+    if(pCtr==aHeaderBar.get())
     {
         HBarDblClick();
     }
diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx
index 0162b97..9a30b94 100644
--- a/svtools/source/contnr/svimpbox.cxx
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -47,9 +47,9 @@ Image*  SvImpLBox::s_pDefExpanded       = NULL;
 sal_Int32 SvImpLBox::s_nImageRefCount   = 0;
 
 SvImpLBox::SvImpLBox( SvTreeListBox* pLBView, SvTreeList* pLBTree, WinBits nWinStyle)
-    : aVerSBar(pLBView, WB_DRAG | WB_VSCROLL)
-    , aHorSBar(pLBView, WB_DRAG | WB_HSCROLL)
-    , aScrBarBox(pLBView)
+    : aVerSBar(new ScrollBar(pLBView, WB_DRAG | WB_VSCROLL))
+    , aHorSBar(new ScrollBar(pLBView, WB_DRAG | WB_HSCROLL))
+    , aScrBarBox(new ScrollBarBox(pLBView))
     , aOutputSize(0, 0)
     , aSelEng(pLBView, (FunctionSet*)0)
     , aFctSet(this, &aSelEng, pLBView)
@@ -67,18 +67,18 @@ SvImpLBox::SvImpLBox( SvTreeListBox* pLBView, SvTreeList* pLBTree, WinBits nWinS
     SetSelectionMode( SINGLE_SELECTION );
     SetDragDropMode( 0 );
 
-    aVerSBar.SetScrollHdl( LINK( this, SvImpLBox, ScrollUpDownHdl ) );
-    aHorSBar.SetScrollHdl( LINK( this, SvImpLBox, ScrollLeftRightHdl ) );
-    aHorSBar.SetEndScrollHdl( LINK( this, SvImpLBox, EndScrollHdl ) );
-    aVerSBar.SetEndScrollHdl( LINK( this, SvImpLBox, EndScrollHdl ) );
-    aVerSBar.SetRange( Range(0,0) );
-    aVerSBar.Hide();
-    aHorSBar.SetRange( Range(0,0) );
-    aHorSBar.SetPageSize( 24 ); // pixels
-    aHorSBar.SetLineSize( 8 ); // pixels
+    aVerSBar->SetScrollHdl( LINK( this, SvImpLBox, ScrollUpDownHdl ) );
+    aHorSBar->SetScrollHdl( LINK( this, SvImpLBox, ScrollLeftRightHdl ) );
+    aHorSBar->SetEndScrollHdl( LINK( this, SvImpLBox, EndScrollHdl ) );
+    aVerSBar->SetEndScrollHdl( LINK( this, SvImpLBox, EndScrollHdl ) );
+    aVerSBar->SetRange( Range(0,0) );
+    aVerSBar->Hide();
+    aHorSBar->SetRange( Range(0,0) );
+    aHorSBar->SetPageSize( 24 ); // pixels
+    aHorSBar->SetLineSize( 8 ); // pixels
 
-    nHorSBarHeight = (short)aHorSBar.GetSizePixel().Height();
-    nVerSBarWidth = (short)aVerSBar.GetSizePixel().Width();
+    nHorSBarHeight = (short)aHorSBar->GetSizePixel().Height();
+    nVerSBarWidth = (short)aVerSBar->GetSizePixel().Width();
 
     pStartEntry = 0;
     pCursor             = 0;
@@ -124,6 +124,9 @@ SvImpLBox::~SvImpLBox()
         DELETEZ(s_pDefCollapsed);
         DELETEZ(s_pDefExpanded);
     }
+    aVerSBar.disposeAndClear();
+    aHorSBar.disposeAndClear();
+    aScrBarBox.disposeAndClear();
 }
 
 void SvImpLBox::UpdateStringSorter()
@@ -268,25 +271,25 @@ void SvImpLBox::Clear()
             pView->HideFocus();
         pCursor = 0;
     }
-    aVerSBar.Hide();
-    aVerSBar.SetThumbPos( 0 );
+    aVerSBar->Hide();
+    aVerSBar->SetThumbPos( 0 );
     Range aRange( 0, 0 );
-    aVerSBar.SetRange( aRange );
+    aVerSBar->SetRange( aRange );
     aOutputSize = pView->Control::GetOutputSizePixel();
     nFlags &= ~(F_VER_SBARSIZE_WITH_HBAR | F_HOR_SBARSIZE_WITH_VBAR );
-    aHorSBar.Hide();
-    aHorSBar.SetThumbPos( 0 );
+    aHorSBar->Hide();
+    aHorSBar->SetThumbPos( 0 );
     MapMode aMapMode( pView->GetMapMode());
     aMapMode.SetOrigin( Point(0,0) );
     pView->Control::SetMapMode( aMapMode );
-    aHorSBar.SetRange( aRange );
-    aHorSBar.SetSizePixel(Size(aOutputSize.Width(),nHorSBarHeight));
+    aHorSBar->SetRange( aRange );
+    aHorSBar->SetSizePixel(Size(aOutputSize.Width(),nHorSBarHeight));
     pView->SetClipRegion();
     if( GetUpdateMode() )
         pView->Invalidate( GetVisibleArea() );
     nFlags |= F_FILLING;
-    if( !aHorSBar.IsVisible() && !aVerSBar.IsVisible() )
-        aScrBarBox.Hide();
+    if( !aHorSBar->IsVisible() && !aVerSBar->IsVisible() )
+        aScrBarBox->Hide();
 
     aContextBmpWidthVector.clear();
 
@@ -301,7 +304,7 @@ IMPL_LINK_NOARG_INLINE_START(SvImpLBox, EndScrollHdl)
 {
     if( nFlags & F_ENDSCROLL_SET_VIS_SIZE )
     {
-        aVerSBar.SetVisibleSize( nNextVerVisSize );
+        aVerSBar->SetVisibleSize( nNextVerVisSize );
         nFlags &= ~F_ENDSCROLL_SET_VIS_SIZE;
     }
     EndScroll();
@@ -474,16 +477,16 @@ void SvImpLBox::PageUp( sal_uInt16 nDelta )
 
 void SvImpLBox::KeyUp( bool bPageUp, bool bNotifyScroll )
 {
-    if( !aVerSBar.IsVisible() )
+    if( !aVerSBar->IsVisible() )
         return;
 
     long nDelta;
     if( bPageUp )
-        nDelta = aVerSBar.GetPageSize();
+        nDelta = aVerSBar->GetPageSize();
     else
         nDelta = 1;
 
-    long nThumbPos = aVerSBar.GetThumbPos();
+    long nThumbPos = aVerSBar->GetThumbPos();
 
     if( nThumbPos < nDelta )
         nDelta = nThumbPos;
@@ -495,7 +498,7 @@ void SvImpLBox::KeyUp( bool bPageUp, bool bNotifyScroll )
     if( bNotifyScroll )
         BeginScroll();
 
-    aVerSBar.SetThumbPos( nThumbPos - nDelta );
+    aVerSBar->SetThumbPos( nThumbPos - nDelta );
     if( bPageUp )
         PageUp( (short)nDelta );
     else
@@ -508,18 +511,18 @@ void SvImpLBox::KeyUp( bool bPageUp, bool bNotifyScroll )
 
 void SvImpLBox::KeyDown( bool bPageDown, bool bNotifyScroll )
 {
-    if( !aVerSBar.IsVisible() )
+    if( !aVerSBar->IsVisible() )
         return;
 
     long nDelta;
     if( bPageDown )
-        nDelta = aVerSBar.GetPageSize();
+        nDelta = aVerSBar->GetPageSize();
     else
         nDelta = 1;
 
-    long nThumbPos = aVerSBar.GetThumbPos();
-    long nVisibleSize = aVerSBar.GetVisibleSize();
-    long nRange = aVerSBar.GetRange().Len();
+    long nThumbPos = aVerSBar->GetThumbPos();
+    long nVisibleSize = aVerSBar->GetVisibleSize();
+    long nRange = aVerSBar->GetRange().Len();
 
     long nTmp = nThumbPos+nVisibleSize;
     while( (nDelta > 0) && (nTmp+nDelta) >= nRange )
@@ -532,7 +535,7 @@ void SvImpLBox::KeyDown( bool bPageDown, bool bNotifyScroll )
     if( bNotifyScroll )
         BeginScroll();
 
-    aVerSBar.SetThumbPos( nThumbPos+nDelta );
+    aVerSBar->SetThumbPos( nThumbPos+nDelta );
     if( bPageDown )
         PageDown( (short)nDelta );
     else
@@ -713,7 +716,7 @@ void SvImpLBox::UpdateAll(
 {
     if( bUpdateVerScrollBar )
         FindMostRight(0);
-    aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1 ) );
+    aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1 ) );
     SyncVerThumb();
     FillView();
     ShowVerSBar();
@@ -753,7 +756,7 @@ void SvImpLBox::KeyLeftRight( long nDelta )
     ShowCursor( false );
 
     // neuen Origin berechnen
-    long nPos = aHorSBar.GetThumbPos();
+    long nPos = aHorSBar->GetThumbPos();
     Point aOrigin( -nPos, 0 );
 
     MapMode aMapMode( pView->GetMapMode() );
@@ -904,7 +907,7 @@ void SvImpLBox::Paint( const Rectangle& rRect )
         {
             ShowCursor( false );
             pStartEntry = pView->First();
-            aVerSBar.SetThumbPos( 0 );
+            aVerSBar->SetThumbPos( 0 );
             StopUserEvent();
             ShowCursor( true );
             nCurUserEvent = Application::PostUserEvent(LINK(this,SvImpLBox,MyUserEvent), reinterpret_cast<void*>(1));
@@ -1009,7 +1012,7 @@ void SvImpLBox::MakeVisible( SvTreeListEntry* pEntry, bool bMoveToTop )
     pStartEntry = pEntry;
     ShowCursor( false );
     FillView();
-    aVerSBar.SetThumbPos( (long)(pView->GetVisiblePos( pStartEntry )) );
+    aVerSBar->SetThumbPos( (long)(pView->GetVisiblePos( pStartEntry )) );
     ShowCursor( true );
     pView->Invalidate();
 }
@@ -1036,7 +1039,7 @@ void SvImpLBox::ScrollToAbsPos( long nPos )
     {
         pStartEntry = pEntry;
         ShowCursor( false );
-        aVerSBar.SetThumbPos( nPos );
+        aVerSBar->SetThumbPos( nPos );
         ShowCursor( true );
         if (GetUpdateMode())
             pView->Invalidate();
@@ -1174,12 +1177,12 @@ void SvImpLBox::PositionScrollBars( Size& rSize, sal_uInt16 nMask )
 
     aVerSize.Height() += 2 * nOverlap;
     Point aVerPos( rSize.Width() - aVerSize.Width() + nOverlap, -nOverlap );
-    aVerSBar.SetPosSizePixel( aVerPos, aVerSize );
+    aVerSBar->SetPosSizePixel( aVerPos, aVerSize );
 
     aHorSize.Width() += 2 * nOverlap;
     Point aHorPos( -nOverlap, rSize.Height() - aHorSize.Height() + nOverlap );
 
-    aHorSBar.SetPosSizePixel( aHorPos, aHorSize );
+    aHorSBar->SetPosSizePixel( aHorPos, aHorSize );
 
     if( nMask & 0x0001 )
         rSize.Width() = aVerPos.X();
@@ -1187,9 +1190,9 @@ void SvImpLBox::PositionScrollBars( Size& rSize, sal_uInt16 nMask )
         rSize.Height() = aHorPos.Y();
 
     if( (nMask & (0x0001|0x0002)) == (0x0001|0x0002) )
-        aScrBarBox.Show();
+        aScrBarBox->Show();
     else
-        aScrBarBox.Hide();
+        aScrBarBox->Hide();
 }
 
 // nResult: Bit0 == VerSBar Bit1 == HorSBar
@@ -1265,12 +1268,12 @@ sal_uInt16 SvImpLBox::AdjustScrollBars( Size& rSize )
     // vertical scrollbar
     long nTemp = (long)nVisibleCount;
     nTemp--;
-    if( nTemp != aVerSBar.GetVisibleSize() )
+    if( nTemp != aVerSBar->GetVisibleSize() )
     {
         if( !bInVScrollHdl )
         {
-            aVerSBar.SetPageSize( nTemp - 1 );
-            aVerSBar.SetVisibleSize( nTemp );
+            aVerSBar->SetPageSize( nTemp - 1 );
+            aVerSBar->SetVisibleSize( nTemp );
         }
         else
         {
@@ -1280,14 +1283,14 @@ sal_uInt16 SvImpLBox::AdjustScrollBars( Size& rSize )
     }
 
     // horizontal scrollbar
-    nTemp = aHorSBar.GetThumbPos();
-    aHorSBar.SetVisibleSize( aOSize.Width() );
-    long nNewThumbPos = aHorSBar.GetThumbPos();
-    Range aRange( aHorSBar.GetRange() );
+    nTemp = aHorSBar->GetThumbPos();
+    aHorSBar->SetVisibleSize( aOSize.Width() );
+    long nNewThumbPos = aHorSBar->GetThumbPos();
+    Range aRange( aHorSBar->GetRange() );
     if( aRange.Max() < nMostRight+25 )
     {
         aRange.Max() = nMostRight+25;
-        aHorSBar.SetRange( aRange );
+        aHorSBar->SetRange( aRange );
     }
 
     if( nTemp != nNewThumbPos )
@@ -1303,15 +1306,15 @@ sal_uInt16 SvImpLBox::AdjustScrollBars( Size& rSize )
     }
 
     if( nResult & 0x0001 )
-        aVerSBar.Show();
+        aVerSBar->Show();
     else
-        aVerSBar.Hide();
+        aVerSBar->Hide();
 
     if( nResult & 0x0002 )
-        aHorSBar.Show();
+        aHorSBar->Show();
     else
     {
-        aHorSBar.Hide();
+        aHorSBar->Hide();
     }
     rSize = aOSize;
     return nResult;
@@ -1319,9 +1322,9 @@ sal_uInt16 SvImpLBox::AdjustScrollBars( Size& rSize )
 
 void SvImpLBox::InitScrollBarBox()
 {
-    aScrBarBox.SetSizePixel( Size(nVerSBarWidth, nHorSBarHeight) );
+    aScrBarBox->SetSizePixel( Size(nVerSBarWidth, nHorSBarHeight) );
     Size aSize( pView->Control::GetOutputSizePixel() );
-    aScrBarBox.SetPosPixel( Point(aSize.Width()-nVerSBarWidth, aSize.Height()-nHorSBarHeight));
+    aScrBarBox->SetPosPixel( Point(aSize.Width()-nVerSBarWidth, aSize.Height()-nHorSBarHeight));
 }
 
 void SvImpLBox::Resize()
@@ -1339,10 +1342,10 @@ void SvImpLBox::Resize()
     }
     // HACK, as in floating and docked windows the scrollbars might not be drawn
     // correctly/not be drawn at all after resizing!
-    if( aHorSBar.IsVisible())
-        aHorSBar.Invalidate();
-    if( aVerSBar.IsVisible())
-        aVerSBar.Invalidate();
+    if( aHorSBar->IsVisible())
+        aHorSBar->Invalidate();
+    if( aVerSBar->IsVisible())
+        aVerSBar->Invalidate();
     nFlags &= (~(F_IN_RESIZE | F_PAINTED));
 }
 
@@ -1351,7 +1354,7 @@ void SvImpLBox::FillView()
     if( !pStartEntry )
     {
         sal_uInt16 nVisibleViewCount = (sal_uInt16)(pView->GetVisibleCount());
-        sal_uInt16 nTempThumb = (sal_uInt16)aVerSBar.GetThumbPos();
+        sal_uInt16 nTempThumb = (sal_uInt16)aVerSBar->GetThumbPos();
         if( nTempThumb >= nVisibleViewCount )
             nTempThumb = nVisibleViewCount - 1;
         pStartEntry = pView->GetEntryAtVisPos(nTempThumb);
@@ -1380,7 +1383,7 @@ void SvImpLBox::FillView()
             }
             if( bFound )
             {
-                aVerSBar.SetThumbPos( nThumb );
+                aVerSBar->SetThumbPos( nThumb );
                 ShowCursor( true ); // recalculate focus rectangle
                 pView->Invalidate();
             }
@@ -1399,17 +1402,17 @@ void SvImpLBox::ShowVerSBar()
         nVis = pView->GetVisibleCount();
     if( bVerBar || (nVisibleCount && nVis > (sal_uLong)(nVisibleCount-1)) )
     {
-        if( !aVerSBar.IsVisible() )
+        if( !aVerSBar->IsVisible() )
         {
             pView->nFocusWidth = -1;
             AdjustScrollBars( aOutputSize );
             if( GetUpdateMode() )
-                aVerSBar.Update();
+                aVerSBar->Update();
         }
     }
     else
     {
-        if( aVerSBar.IsVisible() )
+        if( aVerSBar->IsVisible() )
         {
             pView->nFocusWidth = -1;
             AdjustScrollBars( aOutputSize );
@@ -1422,20 +1425,20 @@ void SvImpLBox::ShowVerSBar()
     nMaxRight = nMaxRight + aPos.X() - 1;
     if( nMaxRight < nMostRight  )
     {
-        if( !aHorSBar.IsVisible() )
+        if( !aHorSBar->IsVisible() )
         {
             pView->nFocusWidth = -1;
             AdjustScrollBars( aOutputSize );
             if( GetUpdateMode() )
-                aHorSBar.Update();
+                aHorSBar->Update();
         }
         else
         {
-            Range aRange( aHorSBar.GetRange() );
+            Range aRange( aHorSBar->GetRange() );
             if( aRange.Max() < nMostRight+25 )
             {
                 aRange.Max() = nMostRight+25;
-                aHorSBar.SetRange( aRange );
+                aHorSBar->SetRange( aRange );
             }
             else
             {
@@ -1446,7 +1449,7 @@ void SvImpLBox::ShowVerSBar()
     }
     else
     {
-        if( aHorSBar.IsVisible() )
+        if( aHorSBar->IsVisible() )
         {
             pView->nFocusWidth = -1;
             AdjustScrollBars( aOutputSize );
@@ -1460,10 +1463,10 @@ void SvImpLBox::SyncVerThumb()
     if( pStartEntry )
     {
         long nEntryPos = pView->GetVisiblePos( pStartEntry );
-        aVerSBar.SetThumbPos( nEntryPos );
+        aVerSBar->SetThumbPos( nEntryPos );
     }
     else
-        aVerSBar.SetThumbPos( 0 );
+        aVerSBar->SetThumbPos( 0 );
 }
 
 bool SvImpLBox::IsEntryInView( SvTreeListEntry* pEntry ) const
@@ -1528,7 +1531,7 @@ void SvImpLBox::EntryExpanded( SvTreeListEntry* pEntry )
             InvalidateEntriesFrom( nY );
             FindMostRight( pEntry, 0  );
         }
-        aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1 ) );
+        aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1 ) );
         // if we expanded before the thumb, the thumb's position has to be
         // corrected
         SyncVerThumb();
@@ -1551,10 +1554,10 @@ void SvImpLBox::EntryCollapsed( SvTreeListEntry* pEntry )
 
     if( pStartEntry )
     {
-        long nOldThumbPos   = aVerSBar.GetThumbPos();
+        long nOldThumbPos   = aVerSBar->GetThumbPos();
         sal_uLong nVisList      = pView->GetVisibleCount();
-        aVerSBar.SetRange( Range(0, nVisList-1) );
-        long nNewThumbPos   = aVerSBar.GetThumbPos();
+        aVerSBar->SetRange( Range(0, nVisList-1) );
+        long nNewThumbPos   = aVerSBar->GetThumbPos();
         if( nNewThumbPos != nOldThumbPos  )
         {
             pStartEntry = pView->First();
@@ -1714,7 +1717,7 @@ void SvImpLBox::RemovingEntry( SvTreeListEntry* pEntry )
         // drawn correctly (in this case they're deleted)
         if( pStartEntry && (pStartEntry != pOldStartEntry || pEntry == (SvTreeListEntry*)pView->GetModel()->Last()) )
         {
-            aVerSBar.SetThumbPos( pView->GetVisiblePos( pStartEntry ));
+            aVerSBar->SetThumbPos( pView->GetVisiblePos( pStartEntry ));
             pView->Invalidate( GetVisibleArea() );
         }
         else
@@ -1741,11 +1744,11 @@ void SvImpLBox::EntryRemoved()
     {
         if( nFlags & F_REMOVED_RECALC_MOST_RIGHT )
             FindMostRight(0);
-        aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1 ) );
+        aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1 ) );
         FillView();
         if( pStartEntry )
             // if something above the thumb was deleted
-            aVerSBar.SetThumbPos( pView->GetVisiblePos( pStartEntry) );
+            aVerSBar->SetThumbPos( pView->GetVisiblePos( pStartEntry) );
 
         ShowVerSBar();
         if( pCursor && pView->HasFocus() && !pView->IsSelected(pCursor) )
@@ -1810,7 +1813,7 @@ void SvImpLBox::EntryMoved( SvTreeListEntry* pEntry )
         // #i97346#
         pStartEntry = pView->First();
 
-    aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1));
+    aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1));
     sal_uInt16 nFirstPos = (sal_uInt16)pTree->GetAbsPos( pStartEntry );
     sal_uInt16 nNewPos = (sal_uInt16)pTree->GetAbsPos( pEntry );
     FindMostRight(0);
@@ -1882,7 +1885,7 @@ void SvImpLBox::EntryInserted( SvTreeListEntry* pEntry )
             pView->Invalidate();
 
         SetMostRight( pEntry );
-        aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1));
+        aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1));
         SyncVerThumb(); // if something was inserted before the thumb
         ShowVerSBar();
         ShowCursor( true );
@@ -2159,7 +2162,7 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt)
 
     bool bKeyUsed = true;
 
-    sal_uInt16  nDelta = (sal_uInt16)aVerSBar.GetPageSize();
+    sal_uInt16  nDelta = (sal_uInt16)aVerSBar->GetPageSize();
     sal_uInt16  aCode = rKeyCode.GetCode();
 
     bool    bShift = rKeyCode.IsShift();
@@ -2257,12 +2260,12 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt)
             }
             else if( nWindowStyle & WB_HSCROLL )
             {
-                long    nThumb = aHorSBar.GetThumbPos();
-                nThumb += aHorSBar.GetLineSize();
-                long    nOldThumb = aHorSBar.GetThumbPos();
-                aHorSBar.SetThumbPos( nThumb );
+                long    nThumb = aHorSBar->GetThumbPos();
+                nThumb += aHorSBar->GetLineSize();
+                long    nOldThumb = aHorSBar->GetThumbPos();
+                aHorSBar->SetThumbPos( nThumb );
                 nThumb = nOldThumb;
-                nThumb -= aHorSBar.GetThumbPos();
+                nThumb -= aHorSBar->GetThumbPos();
                 nThumb *= -1;
                 if( nThumb )
                 {
@@ -2288,12 +2291,12 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt)
             }
             else if ( nWindowStyle & WB_HSCROLL )
             {
-                long    nThumb = aHorSBar.GetThumbPos();
-                nThumb -= aHorSBar.GetLineSize();
-                long    nOldThumb = aHorSBar.GetThumbPos();
-                aHorSBar.SetThumbPos( nThumb );
+                long    nThumb = aHorSBar->GetThumbPos();
+                nThumb -= aHorSBar->GetLineSize();
+                long    nOldThumb = aHorSBar->GetThumbPos();
+                aHorSBar->SetThumbPos( nThumb );
                 nThumb = nOldThumb;
-                nThumb -= aHorSBar.GetThumbPos();
+                nThumb -= aHorSBar->GetThumbPos();
                 if( nThumb )
                 {
                     KeyLeftRight( -nThumb );
@@ -2985,7 +2988,7 @@ void SvImpLBox::Command( const CommandEvent& rCEvt )
 
     // scroll mouse event?
     if( ( ( nCommand == COMMAND_WHEEL ) || ( nCommand == COMMAND_STARTAUTOSCROLL ) || ( nCommand == COMMAND_AUTOSCROLL ) )
-        && pView->HandleScrollCommand( rCEvt, &aHorSBar, &aVerSBar ) )
+        && pView->HandleScrollCommand( rCEvt, aHorSBar.get(), aVerSBar.get() ) )
             return;
 
     if( bContextMenuHandling && nCommand == COMMAND_CONTEXTMENU )
diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx
index 88c7b10..c2d8e94 100644
--- a/svtools/source/contnr/svtabbx.cxx
+++ b/svtools/source/contnr/svtabbx.cxx
@@ -110,12 +110,18 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvTabListBox(vcl::Wind
 
 SvTabListBox::~SvTabListBox()
 {
+   dispose();
+}
+
+void SvTabListBox::dispose()
+{
     // delete array
     delete [] pTabList;
 #ifdef DBG_UTIL
     pTabList = 0;
     nTabCount = 0;
 #endif
+    SvTreeListBox::dispose();
 }
 
 void SvTabListBox::SetTabs( long* pTabs, MapUnit eMapUnit )
@@ -520,7 +526,13 @@ SvHeaderTabListBox::SvHeaderTabListBox( vcl::Window* pParent, WinBits nWinStyle
 
 SvHeaderTabListBox::~SvHeaderTabListBox()
 {
+    dispose();
+}
+
+void SvHeaderTabListBox::dispose()
+{
     delete m_pImpl;
+    SvTabListBox::dispose();
 }
 
 
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 5591635..3a9eda0 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -1559,6 +1559,11 @@ OUString SvTreeListBox::SearchEntryTextWithHeadTitle( SvTreeListEntry* pEntry )
 
 SvTreeListBox::~SvTreeListBox()
 {
+    dispose();
+}
+
+void SvTreeListBox::dispose()
+{
 
     pImp->CallEventListeners( VCLEVENT_OBJECT_DYING );
     delete pImp;
@@ -1582,6 +1587,7 @@ SvTreeListBox::~SvTreeListBox()
     if( this == pDDTarget )
         pDDTarget = 0;
     delete mpImpl;
+    Control::dispose();
 }
 
 void SvTreeListBox::SetExtendedWinBits( ExtendedWinBits _nBits )
@@ -2255,18 +2261,18 @@ void SvTreeListBox::ShowTargetEmphasis( SvTreeListEntry* pEntry, bool /*bShow*/
 
 void SvTreeListBox::ScrollOutputArea( short nDeltaEntries )
 {
-    if( !nDeltaEntries || !pImp->aVerSBar.IsVisible() )
+    if( !nDeltaEntries || !pImp->aVerSBar->IsVisible() )
         return;
 
-    long nThumb = pImp->aVerSBar.GetThumbPos();
-    long nMax = pImp->aVerSBar.GetRange().Max();
+    long nThumb = pImp->aVerSBar->GetThumbPos();
+    long nMax = pImp->aVerSBar->GetRange().Max();
 
     NotifyBeginScroll();
     if( nDeltaEntries < 0 )
     {
         // move window up
         nDeltaEntries *= -1;
-        long nVis = pImp->aVerSBar.GetVisibleSize();
+        long nVis = pImp->aVerSBar->GetVisibleSize();
         long nTemp = nThumb + nVis;
         if( nDeltaEntries > (nMax - nTemp) )
             nDeltaEntries = (short)(nMax - nTemp);
@@ -3712,12 +3718,12 @@ void SvTreeListBox::RepaintScrollBars() const
 
 ScrollBar *SvTreeListBox::GetVScroll()
 {
-    return &((SvTreeListBox*)this)->pImp->aVerSBar;
+    return pImp->aVerSBar.get();
 }
 
 ScrollBar *SvTreeListBox::GetHScroll()
 {
-    return &((SvTreeListBox*)this)->pImp->aHorSBar;
+    return pImp->aHorSBar.get();
 }
 
 void SvTreeListBox::EnableAsyncDrag( bool b )
diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx
index 45bd8aa..5378766 100644
--- a/svtools/source/control/calendar.cxx
+++ b/svtools/source/control/calendar.cxx
@@ -257,6 +257,11 @@ Calendar::Calendar( vcl::Window* pParent, WinBits nWinStyle ) :
 
 Calendar::~Calendar()
 {
+    dispose();
+}
+
+void Calendar::dispose()
+{
     delete mpStandardColor;
     delete mpSaturdayColor;
     delete mpSundayColor;
@@ -264,6 +269,7 @@ Calendar::~Calendar()
     delete mpSelectTable;
     delete mpOldSelectTable;
     delete mpRestoreSelectTable;
+    Control::dispose();
 }
 
 
@@ -2193,7 +2199,8 @@ private:
 
 public:
                     ImplCFieldFloatWin( vcl::Window* pParent );
-                    virtual ~ImplCFieldFloatWin();
+    virtual         ~ImplCFieldFloatWin();
+    virtual void    dispose() SAL_OVERRIDE;
 
     void            SetCalendar( Calendar* pCalendar )
                         { mpCalendar = pCalendar; }
@@ -2220,9 +2227,15 @@ ImplCFieldFloatWin::ImplCFieldFloatWin( vcl::Window* pParent ) :
 
 ImplCFieldFloatWin::~ImplCFieldFloatWin()
 {
+    dispose();
+}
+
+void ImplCFieldFloatWin::dispose()
+{
     delete mpTodayBtn;
     delete mpNoneBtn;
     delete mpFixedLine;
+    FloatingWindow::dispose();
 }
 
 
@@ -2384,11 +2397,17 @@ CalendarField::CalendarField(vcl::Window* pParent, WinBits nWinStyle)
 
 CalendarField::~CalendarField()
 {
+    dispose();
+}
+
+void CalendarField::dispose()
+{
     if ( mpFloatWin )
     {
         delete mpCalendar;
         delete mpFloatWin;
     }
+    DateField::dispose();
 }
 
 
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index c83db0b..6bf1089 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -118,8 +118,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeColorListBox(vcl::Wind
 
 ColorListBox::~ColorListBox()
 {
+    dispose();
+}
+
+void ColorListBox::dispose()
+{
     ImplDestroyColorEntries();
     delete pColorList;
+    ListBox::dispose();
 }
 
 sal_Int32 ColorListBox::InsertEntry( const OUString& rStr, sal_Int32 nPos )
@@ -739,6 +745,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeLineListBox(vcl::Windo
 
 LineListBox::~LineListBox()
 {
+    dispose();
+}
+
+void LineListBox::dispose()
+{
     for ( size_t i = 0, n = pLineList->size(); i < n; ++i ) {
         if ( (*pLineList)[ i ] ) {
             delete (*pLineList)[ i ];
@@ -746,6 +757,7 @@ LineListBox::~LineListBox()
     }
     pLineList->clear();
     delete pLineList;
+    ListBox::dispose();
 }
 
 sal_Int32 LineListBox::GetStylePos( sal_Int32 nListPos, long nWidth )
@@ -975,8 +987,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFontNameBox(vcl::Windo
 
 FontNameBox::~FontNameBox()
 {
+    dispose();
+}
+
+void FontNameBox::dispose()
+{
     SaveMRUEntries (maFontMRUEntriesFile);
     ImplDestroyFontList();
+    ComboBox::dispose();
 }
 
 void FontNameBox::SaveMRUEntries( const OUString& aFontMRUEntriesFile, sal_Unicode cSep ) const
@@ -1351,10 +1369,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFontStyleBox(vcl::Wind
     return pListBox;
 }
 
-FontStyleBox::~FontStyleBox()
-{
-}
-
 void FontStyleBox::Select()
 {
     // keep text over fill operation
@@ -1551,10 +1565,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFontSizeBox(vcl::Windo
     return pListBox;
 }
 
-FontSizeBox::~FontSizeBox()
-{
-}
-
 void FontSizeBox::ImplInit()
 {
     EnableAutocomplete( false );
diff --git a/svtools/source/control/filectrl.cxx b/svtools/source/control/filectrl.cxx
index cf72f0f..4bc70b2 100644
--- a/svtools/source/control/filectrl.cxx
+++ b/svtools/source/control/filectrl.cxx
@@ -36,17 +36,17 @@ using namespace ::com::sun::star::ui;
 
 FileControl::FileControl( vcl::Window* pParent, WinBits nStyle, FileControlMode nFlags ) :
     Window( pParent, nStyle|WB_DIALOGCONTROL ),
-    maEdit( this, (nStyle&(~WB_BORDER))|WB_NOTABSTOP ),
-    maButton( this, (nStyle&(~WB_BORDER))|WB_NOLIGHTBORDER|WB_NOPOINTERFOCUS|WB_NOTABSTOP ),
+    maEdit( new Edit(this, (nStyle&(~WB_BORDER))|WB_NOTABSTOP) ),
+    maButton( new PushButton( this, (nStyle&(~WB_BORDER))|WB_NOLIGHTBORDER|WB_NOPOINTERFOCUS|WB_NOTABSTOP ) ),
     maButtonText( SVT_RESSTR(STR_FILECTRL_BUTTONTEXT) ),
     mnFlags( nFlags ),
     mnInternalFlags( FILECTRL_ORIGINALBUTTONTEXT )
 {
-    maButton.SetClickHdl( LINK( this, FileControl, ButtonHdl ) );
+    maButton->SetClickHdl( LINK( this, FileControl, ButtonHdl ) );
     mbOpenDlg = true;
 
-    maButton.Show();
-    maEdit.Show();
+    maButton->Show();
+    maEdit->Show();
 
     SetCompoundControl( true );
 
@@ -59,17 +59,17 @@ WinBits FileControl::ImplInitStyle( WinBits nStyle )
 {
     if ( !( nStyle & WB_NOTABSTOP ) )
     {
-        maEdit.SetStyle( (maEdit.GetStyle()|WB_TABSTOP)&(~WB_NOTABSTOP) );
-        maButton.SetStyle( (maButton.GetStyle()|WB_TABSTOP)&(~WB_NOTABSTOP) );
+        maEdit->SetStyle( (maEdit->GetStyle()|WB_TABSTOP)&(~WB_NOTABSTOP) );
+        maButton->SetStyle( (maButton->GetStyle()|WB_TABSTOP)&(~WB_NOTABSTOP) );
     }
     else
     {
-        maEdit.SetStyle( (maEdit.GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) );
-        maButton.SetStyle( (maButton.GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) );
+        maEdit->SetStyle( (maEdit->GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) );
+        maButton->SetStyle( (maButton->GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) );
     }
 
     const WinBits nAlignmentStyle = ( WB_TOP | WB_VCENTER | WB_BOTTOM );
-    maEdit.SetStyle( ( maEdit.GetStyle() & ~nAlignmentStyle ) | ( nStyle & nAlignmentStyle ) );
+    maEdit->SetStyle( ( maEdit->GetStyle() & ~nAlignmentStyle ) | ( nStyle & nAlignmentStyle ) );
 
     if ( !(nStyle & WB_NOGROUP) )
         nStyle |= WB_GROUP;
@@ -86,13 +86,19 @@ WinBits FileControl::ImplInitStyle( WinBits nStyle )
 
 FileControl::~FileControl()
 {
+    dispose();
 }
 
-
+void FileControl::dispose()
+{
+    maEdit.disposeAndClear();
+    maButton.disposeAndClear();
+    Window::dispose();
+}
 
 void FileControl::SetText( const OUString& rStr )
 {
-    maEdit.SetText( rStr );
+    maEdit->SetText( rStr );
     if ( mnFlags & FILECTRL_RESIZEBUTTONBYPATHLEN )
         Resize();
 }
@@ -101,7 +107,7 @@ void FileControl::SetText( const OUString& rStr )
 
 OUString FileControl::GetText() const
 {
-    return maEdit.GetText();
+    return maEdit->GetText();
 }
 
 
@@ -110,8 +116,8 @@ void FileControl::StateChanged( StateChangedType nType )
 {
     if ( nType == StateChangedType::ENABLE )
     {
-        maEdit.Enable( IsEnabled() );
-        maButton.Enable( IsEnabled() );
+        maEdit->Enable( IsEnabled() );
+        maButton->Enable( IsEnabled() );
     }
     else if ( nType == StateChangedType::ZOOM )
     {
@@ -155,27 +161,27 @@ void FileControl::Resize()
     mnInternalFlags |= FILECTRL_INRESIZE;//InResize = sal_True
 
     Size aOutSz = GetOutputSizePixel();
-    long nButtonTextWidth = maButton.GetTextWidth( maButtonText );
+    long nButtonTextWidth = maButton->GetTextWidth( maButtonText );
     if ( ((mnInternalFlags & FILECTRL_ORIGINALBUTTONTEXT) == 0) ||
         ( nButtonTextWidth < aOutSz.Width()/3 &&
         ( mnFlags & FILECTRL_RESIZEBUTTONBYPATHLEN
-        ? ( maEdit.GetTextWidth( maEdit.GetText() )
+        ? ( maEdit->GetTextWidth( maEdit->GetText() )
             <= aOutSz.Width() - nButtonTextWidth - ButtonBorder )
         : sal_True ) )
        )
     {
-        maButton.SetText( maButtonText );

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list