[Libreoffice-commits] core.git: Branch 'feature/vclptr' - 4 commits - fpicker/source reportdesign/source sc/source sd/source

Noel Grandin noel at peralex.com
Thu Apr 9 13:50:07 PDT 2015


 fpicker/source/office/PlacesListBox.cxx                 |   12 
 fpicker/source/office/PlacesListBox.hxx                 |    2 
 fpicker/source/office/iodlg.cxx                         |    6 
 fpicker/source/office/iodlg.hxx                         |    1 
 fpicker/source/office/iodlgimp.cxx                      |    6 
 fpicker/source/office/iodlgimp.hxx                      |    1 
 reportdesign/source/ui/dlg/AddField.cxx                 |   77 -
 reportdesign/source/ui/dlg/Condition.cxx                |   59 -
 reportdesign/source/ui/dlg/Condition.hxx                |    1 
 reportdesign/source/ui/dlg/Formula.cxx                  |    6 
 reportdesign/source/ui/dlg/GroupsSorting.cxx            |   14 
 reportdesign/source/ui/dlg/Navigator.cxx                |    7 
 reportdesign/source/ui/inc/AddField.hxx                 |   15 
 reportdesign/source/ui/inc/DesignView.hxx               |   11 
 reportdesign/source/ui/inc/Formula.hxx                  |    1 
 reportdesign/source/ui/inc/GroupsSorting.hxx            |    1 
 reportdesign/source/ui/inc/ReportSection.hxx            |    1 
 reportdesign/source/ui/inc/ReportWindow.hxx             |    7 
 reportdesign/source/ui/inc/ScrollHelper.hxx             |   23 
 reportdesign/source/ui/inc/SectionWindow.hxx            |   17 
 reportdesign/source/ui/inc/StartMarker.hxx              |    7 
 reportdesign/source/ui/inc/ViewsWindow.hxx              |    1 
 reportdesign/source/ui/inc/propbrw.hxx                  |    1 
 reportdesign/source/ui/report/DesignView.cxx            |  117 +-
 reportdesign/source/ui/report/ReportSection.cxx         |    6 
 reportdesign/source/ui/report/ReportWindow.cxx          |  141 +-
 reportdesign/source/ui/report/ScrollHelper.cxx          |  129 +-
 reportdesign/source/ui/report/SectionWindow.cxx         |  132 +-
 reportdesign/source/ui/report/StartMarker.cxx           |   93 +
 reportdesign/source/ui/report/ViewsWindow.cxx           |    6 
 reportdesign/source/ui/report/propbrw.cxx               |    6 
 sc/source/ui/app/inputwin.cxx                           |  162 +--
 sc/source/ui/cctrl/checklistmenu.cxx                    |  218 ++--
 sc/source/ui/cctrl/tbzoomsliderctrl.cxx                 |    6 
 sc/source/ui/condformat/condformatdlgentry.cxx          |  787 +++++++++-------
 sc/source/ui/condformat/condformatmgr.cxx               |    6 
 sc/source/ui/dbgui/consdlg.cxx                          |    6 
 sc/source/ui/dbgui/csvcontrol.cxx                       |    6 
 sc/source/ui/dbgui/csvgrid.cxx                          |    6 
 sc/source/ui/dbgui/csvruler.cxx                         |    6 
 sc/source/ui/dbgui/csvtablebox.cxx                      |  155 +--
 sc/source/ui/dbgui/dbnamdlg.cxx                         |    6 
 sc/source/ui/dbgui/filtdlg.cxx                          |    6 
 sc/source/ui/dbgui/pfiltdlg.cxx                         |    6 
 sc/source/ui/dbgui/scuiasciiopt.cxx                     |    6 
 sc/source/ui/dbgui/scuiimoptdlg.cxx                     |    6 
 sc/source/ui/dbgui/sfiltdlg.cxx                         |    6 
 sc/source/ui/dbgui/tpsort.cxx                           |    6 
 sc/source/ui/dbgui/tpsubt.cxx                           |    6 
 sc/source/ui/dialogs/searchresults.cxx                  |    6 
 sc/source/ui/formdlg/dwfunctr.cxx                       |  256 ++---
 sc/source/ui/formdlg/formula.cxx                        |    6 
 sc/source/ui/inc/acredlin.hxx                           |    1 
 sc/source/ui/inc/areasdlg.hxx                           |    2 
 sc/source/ui/inc/autofmt.hxx                            |    1 
 sc/source/ui/inc/checklistmenu.hxx                      |   19 
 sc/source/ui/inc/condformatdlgentry.hxx                 |  101 +-
 sc/source/ui/inc/condformatmgr.hxx                      |    1 
 sc/source/ui/inc/consdlg.hxx                            |    1 
 sc/source/ui/inc/csvcontrol.hxx                         |    1 
 sc/source/ui/inc/csvgrid.hxx                            |    1 
 sc/source/ui/inc/csvruler.hxx                           |    1 
 sc/source/ui/inc/csvtablebox.hxx                        |   15 
 sc/source/ui/inc/dbnamdlg.hxx                           |    1 
 sc/source/ui/inc/dwfunctr.hxx                           |   13 
 sc/source/ui/inc/filtdlg.hxx                            |    2 
 sc/source/ui/inc/formula.hxx                            |    1 
 sc/source/ui/inc/gridwin.hxx                            |    1 
 sc/source/ui/inc/highred.hxx                            |    1 
 sc/source/ui/inc/inputwin.hxx                           |   20 
 sc/source/ui/inc/inscodlg.hxx                           |    1 
 sc/source/ui/inc/instbdlg.hxx                           |    1 
 sc/source/ui/inc/namedlg.hxx                            |    1 
 sc/source/ui/inc/namepast.hxx                           |    1 
 sc/source/ui/inc/navipi.hxx                             |   24 
 sc/source/ui/inc/olinewin.hxx                           |    1 
 sc/source/ui/inc/pfiltdlg.hxx                           |    1 
 sc/source/ui/inc/preview.hxx                            |    1 
 sc/source/ui/inc/scuiasciiopt.hxx                       |    1 
 sc/source/ui/inc/scuiimoptdlg.hxx                       |    1 
 sc/source/ui/inc/searchresults.hxx                      |    1 
 sc/source/ui/inc/sharedocdlg.hxx                        |    1 
 sc/source/ui/inc/solveroptions.hxx                      |    1 
 sc/source/ui/inc/tabview.hxx                            |   14 
 sc/source/ui/inc/tbzoomsliderctrl.hxx                   |    1 
 sc/source/ui/inc/tpcalc.hxx                             |    1 
 sc/source/ui/inc/tphfedit.hxx                           |    1 
 sc/source/ui/inc/tpsort.hxx                             |    1 
 sc/source/ui/inc/tpsubt.hxx                             |    1 
 sc/source/ui/inc/tpusrlst.hxx                           |    1 
 sc/source/ui/inc/tpview.hxx                             |    1 
 sc/source/ui/inc/validate.hxx                           |    4 
 sc/source/ui/miscdlgs/acredlin.cxx                      |    6 
 sc/source/ui/miscdlgs/autofmt.cxx                       |    6 
 sc/source/ui/miscdlgs/highred.cxx                       |    6 
 sc/source/ui/miscdlgs/inscodlg.cxx                      |    6 
 sc/source/ui/miscdlgs/instbdlg.cxx                      |    6 
 sc/source/ui/miscdlgs/sharedocdlg.cxx                   |    6 
 sc/source/ui/miscdlgs/solveroptions.cxx                 |    6 
 sc/source/ui/namedlg/namedlg.cxx                        |    6 
 sc/source/ui/namedlg/namepast.cxx                       |    6 
 sc/source/ui/navipi/navcitem.cxx                        |    2 
 sc/source/ui/navipi/navipi.cxx                          |  205 ++--
 sc/source/ui/navipi/scenwnd.cxx                         |   50 -
 sc/source/ui/optdlg/tpcalc.cxx                          |    6 
 sc/source/ui/optdlg/tpusrlst.cxx                        |    6 
 sc/source/ui/optdlg/tpview.cxx                          |    6 
 sc/source/ui/pagedlg/areasdlg.cxx                       |    6 
 sc/source/ui/pagedlg/tphfedit.cxx                       |    6 
 sc/source/ui/sidebar/CellBorderStyleControl.cxx         |  119 +-
 sc/source/ui/sidebar/CellBorderStyleControl.hxx         |   13 
 sc/source/ui/sidebar/CellLineStyleControl.cxx           |   78 -
 sc/source/ui/sidebar/CellLineStyleControl.hxx           |   10 
 sc/source/ui/sidebar/CellLineStyleValueSet.cxx          |    6 
 sc/source/ui/sidebar/CellLineStyleValueSet.hxx          |    1 
 sc/source/ui/view/gridwin.cxx                           |   19 
 sc/source/ui/view/olinewin.cxx                          |    6 
 sc/source/ui/view/preview.cxx                           |    6 
 sc/source/ui/view/tabview.cxx                           |  128 +-
 sc/source/ui/view/tabview4.cxx                          |   16 
 sc/source/ui/view/tabview5.cxx                          |    8 
 sd/source/ui/animations/CustomAnimationCreateDialog.cxx |    6 
 sd/source/ui/animations/CustomAnimationCreateDialog.hxx |    1 
 sd/source/ui/animations/CustomAnimationDialog.cxx       |   25 
 sd/source/ui/animations/CustomAnimationDialog.hxx       |    2 
 sd/source/ui/animations/CustomAnimationList.cxx         |    6 
 sd/source/ui/animations/CustomAnimationList.hxx         |    1 
 sd/source/ui/animations/CustomAnimationPane.cxx         |    6 
 sd/source/ui/animations/CustomAnimationPane.hxx         |    1 
 sd/source/ui/animations/SlideTransitionPane.cxx         |    6 
 sd/source/ui/animations/SlideTransitionPane.hxx         |    1 
 sd/source/ui/annotations/annotationwindow.cxx           |    6 
 sd/source/ui/annotations/annotationwindow.hxx           |    1 
 sd/source/ui/dlg/RemoteDialogClientBox.cxx              |   88 -
 sd/source/ui/dlg/RemoteDialogClientBox.hxx              |   11 
 sd/source/ui/dlg/animobjs.cxx                           |    7 
 sd/source/ui/dlg/brkdlg.cxx                             |    6 
 sd/source/ui/dlg/copydlg.cxx                            |    7 
 sd/source/ui/dlg/dlgass.cxx                             |    6 
 sd/source/ui/dlg/dlgassim.cxx                           |    6 
 sd/source/ui/dlg/dlgassim.hxx                           |    1 
 sd/source/ui/dlg/dlgctrls.cxx                           |    6 
 sd/source/ui/dlg/dlgolbul.cxx                           |    6 
 sd/source/ui/dlg/docprev.cxx                            |    6 
 sd/source/ui/dlg/headerfooterdlg.cxx                    |    6 
 sd/source/ui/dlg/navigatr.cxx                           |  253 ++---
 sd/source/ui/dlg/prltempl.cxx                           |    6 
 sd/source/ui/dlg/sdtreelb.cxx                           |    6 
 sd/source/ui/inc/BreakDlg.hxx                           |    1 
 sd/source/ui/inc/DrawViewShell.hxx                      |    6 
 sd/source/ui/inc/OutlineBulletDlg.hxx                   |    1 
 sd/source/ui/inc/Ruler.hxx                              |    1 
 sd/source/ui/inc/Window.hxx                             |    1 
 sd/source/ui/inc/animobjs.hxx                           |    1 
 sd/source/ui/inc/copydlg.hxx                            |    1 
 sd/source/ui/inc/dlgass.hxx                             |    1 
 sd/source/ui/inc/dlgctrls.hxx                           |    3 
 sd/source/ui/inc/docprev.hxx                            |    1 
 sd/source/ui/inc/headerfooterdlg.hxx                    |    1 
 sd/source/ui/inc/navigatr.hxx                           |    7 
 sd/source/ui/inc/prltempl.hxx                           |    1 
 sd/source/ui/inc/sdtreelb.hxx                           |    1 
 sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx     |    7 
 sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx     |    1 
 sd/source/ui/sidebar/LayoutMenu.cxx                     |    6 
 sd/source/ui/sidebar/LayoutMenu.hxx                     |    1 
 sd/source/ui/sidebar/MasterPagesSelector.cxx            |    6 
 sd/source/ui/sidebar/MasterPagesSelector.hxx            |    1 
 sd/source/ui/sidebar/NavigatorWrapper.cxx               |   23 
 sd/source/ui/sidebar/NavigatorWrapper.hxx               |    3 
 sd/source/ui/sidebar/PanelBase.cxx                      |    6 
 sd/source/ui/sidebar/PanelBase.hxx                      |    1 
 sd/source/ui/slideshow/showwin.cxx                      |    6 
 sd/source/ui/slideshow/showwindow.hxx                   |    1 
 sd/source/ui/view/ViewShellBase.cxx                     |    7 
 sd/source/ui/view/drviews1.cxx                          |   62 -
 sd/source/ui/view/drviews2.cxx                          |    6 
 sd/source/ui/view/drviews3.cxx                          |    2 
 sd/source/ui/view/drviews4.cxx                          |    2 
 sd/source/ui/view/drviews5.cxx                          |    4 
 sd/source/ui/view/drviews7.cxx                          |    2 
 sd/source/ui/view/drviewsa.cxx                          |    6 
 sd/source/ui/view/drviewsb.cxx                          |    4 
 sd/source/ui/view/drviewse.cxx                          |    2 
 sd/source/ui/view/sdruler.cxx                           |    6 
 sd/source/ui/view/sdwindow.cxx                          |    6 
 186 files changed, 2585 insertions(+), 1672 deletions(-)

New commits:
commit 0cef43d2e425895746392c6f503c660a7ca1241c
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Jan 26 13:20:10 2015 +0200

    vcl: VclPtr conversion in sd
    
    Change-Id: I3cde57acfeec194968a639f8557b17177a94d37f

diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
index b258ba2..5e7c988 100644
--- a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
@@ -532,6 +532,11 @@ CustomAnimationCreateDialog::CustomAnimationCreateDialog( vcl::Window* pParent,
 
 CustomAnimationCreateDialog::~CustomAnimationCreateDialog()
 {
+    dispose();
+}
+
+void CustomAnimationCreateDialog::dispose()
+{
     storePosition();
 
     SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
@@ -543,6 +548,7 @@ CustomAnimationCreateDialog::~CustomAnimationCreateDialog()
     delete mpTabPages[MOTIONPATH];
     delete mpTabPages[MISCEFFECTS];
 
+    TabDialog::dispose();
 }
 
 CustomAnimationCreateTabPage* CustomAnimationCreateDialog::getCurrentPage() const
diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.hxx b/sd/source/ui/animations/CustomAnimationCreateDialog.hxx
index b17be88..7ae2ec7 100644
--- a/sd/source/ui/animations/CustomAnimationCreateDialog.hxx
+++ b/sd/source/ui/animations/CustomAnimationCreateDialog.hxx
@@ -41,6 +41,7 @@ class CustomAnimationCreateDialog : public TabDialog
 public:
     CustomAnimationCreateDialog( vcl::Window* pParent, CustomAnimationPane* pPane, const std::vector< ::com::sun::star::uno::Any >& rTargets, bool bHasText, const OUString& rsPresetId, double fDuration );
     virtual ~CustomAnimationCreateDialog();
+    virtual void dispose() SAL_OVERRIDE;
 
     PathKind getCreatePathKind() const;
     CustomAnimationPresetPtr getSelectedPreset() const;
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
index 891bef9..fd21601 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -320,8 +320,9 @@ Control* FontPropertyBox::getControl()
 class DropdownMenuBox : public Edit
 {
 public:
-    DropdownMenuBox( vcl::Window* pParent, const VclPtr<Edit> &pSubControl, PopupMenu* pMenu );
+    DropdownMenuBox( vcl::Window* pParent, Edit* pSubControl, PopupMenu* pMenu );
     virtual ~DropdownMenuBox();
+    virtual void dispose() SAL_OVERRIDE;
 
     void Resize() SAL_OVERRIDE;
     bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
@@ -334,7 +335,7 @@ private:
     PopupMenu*   mpMenu;
 };
 
-DropdownMenuBox::DropdownMenuBox( vcl::Window* pParent, const VclPtr<Edit> &pSubControl, PopupMenu* pMenu )
+DropdownMenuBox::DropdownMenuBox( vcl::Window* pParent, Edit* pSubControl, PopupMenu* pMenu )
 :   Edit( pParent, WB_BORDER|WB_TABSTOP| WB_DIALOGCONTROL ),
     mpSubControl(pSubControl),mpDropdownButton(0),mpMenu(pMenu)
 {
@@ -350,9 +351,16 @@ DropdownMenuBox::DropdownMenuBox( vcl::Window* pParent, const VclPtr<Edit> &pSub
 
 DropdownMenuBox::~DropdownMenuBox()
 {
+    dispose();
+}
+
+void DropdownMenuBox::dispose()
+{
     SetSubEdit(VclPtr<Edit>());
     delete mpDropdownButton;
     delete mpMenu;
+    mpSubControl.disposeAndClear();
+    Edit::dispose();
 }
 
 void DropdownMenuBox::Resize()
@@ -2138,12 +2146,19 @@ CustomAnimationDialog::CustomAnimationDialog(vcl::Window* pParent, STLPropertySe
 
 CustomAnimationDialog::~CustomAnimationDialog()
 {
+    dispose();
+}
+
+void CustomAnimationDialog::dispose()
+{
     delete mpEffectTabPage;
     delete mpDurationTabPage;
     delete mpTextAnimTabPage;
 
     delete mpSet;
     delete mpResultSet;
+
+    TabDialog::dispose();
 }
 
 STLPropertySet* CustomAnimationDialog::getResultSet()
@@ -2221,8 +2236,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makePropertyControl( vcl::
 
 PropertyControl::~PropertyControl()
 {
+    dispose();
+}
+
+void PropertyControl::dispose()
+{
     if( mpSubControl )
         delete mpSubControl;
+    ListBox::dispose();
 }
 
 void PropertyControl::setSubControl( PropertySubControl* pSubControl )
diff --git a/sd/source/ui/animations/CustomAnimationDialog.hxx b/sd/source/ui/animations/CustomAnimationDialog.hxx
index 2fcdc74..897a229 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.hxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.hxx
@@ -123,6 +123,7 @@ class PropertyControl : public ListBox
 public:
     PropertyControl( vcl::Window* pParent );
     virtual ~PropertyControl();
+    virtual void dispose() SAL_OVERRIDE;
 
     void setSubControl( PropertySubControl* pSubControl );
     PropertySubControl* getSubControl() const { return mpSubControl; }
@@ -143,6 +144,7 @@ class CustomAnimationDialog : public TabDialog
 public:
     CustomAnimationDialog(vcl::Window* pParent, STLPropertySet* pSet, const OString& Page = OString());
     virtual ~CustomAnimationDialog();
+    virtual void dispose() SAL_OVERRIDE;
 
     STLPropertySet* getDefaultSet() { return mpSet; }
     STLPropertySet* getResultSet();
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx
index c7f62da..43f3c34 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -444,10 +444,16 @@ const Image&  CustomAnimationList::getImage( sal_uInt16 nId )
 
 CustomAnimationList::~CustomAnimationList()
 {
+    dispose();
+}
+
+void CustomAnimationList::dispose()
+{
     if( mpMainSequence.get() )
         mpMainSequence->removeListener( this );
 
     clear();
+    SvTreeListBox::dispose();
 }
 
 void CustomAnimationList::KeyInput( const KeyEvent& rKEvt )
diff --git a/sd/source/ui/animations/CustomAnimationList.hxx b/sd/source/ui/animations/CustomAnimationList.hxx
index b28f4cf..891016b 100644
--- a/sd/source/ui/animations/CustomAnimationList.hxx
+++ b/sd/source/ui/animations/CustomAnimationList.hxx
@@ -48,6 +48,7 @@ class CustomAnimationList : public SvTreeListBox, public ISequenceListener
 public:
     CustomAnimationList( vcl::Window* pParent );
     virtual ~CustomAnimationList();
+    virtual void dispose() SAL_OVERRIDE;
 
     // methods
 
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index f327dc9..c64a1f2 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -225,6 +225,11 @@ CustomAnimationPane::CustomAnimationPane( Window* pParent, ViewShellBase& rBase,
 
 CustomAnimationPane::~CustomAnimationPane()
 {
+    dispose();
+}
+
+void CustomAnimationPane::dispose()
+{
     maLateInitTimer.Stop();
 
     removeListener();
@@ -235,6 +240,7 @@ CustomAnimationPane::~CustomAnimationPane()
     for( aIter = aTags.begin(); aIter != aTags.end(); ++aIter )
         (*aIter)->Dispose();
 
+    PanelLayout::dispose();
 }
 
 void CustomAnimationPane::addUndo()
diff --git a/sd/source/ui/animations/CustomAnimationPane.hxx b/sd/source/ui/animations/CustomAnimationPane.hxx
index 0cbd137..bdf29dd 100644
--- a/sd/source/ui/animations/CustomAnimationPane.hxx
+++ b/sd/source/ui/animations/CustomAnimationPane.hxx
@@ -64,6 +64,7 @@ class CustomAnimationPane : public PanelLayout, public ICustomAnimationListContr
 public:
     CustomAnimationPane( vcl::Window* pParent, ViewShellBase& rBase, const css::uno::Reference<css::frame::XFrame>& rxFrame, const Size& rMinSize );
     virtual ~CustomAnimationPane();
+    virtual void dispose() SAL_OVERRIDE;
 
     // callbacks
     void onSelectionChanged();
diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx
index 7548ad9..a58a444 100644
--- a/sd/source/ui/animations/SlideTransitionPane.cxx
+++ b/sd/source/ui/animations/SlideTransitionPane.cxx
@@ -483,8 +483,14 @@ SlideTransitionPane::SlideTransitionPane(
 
 SlideTransitionPane::~SlideTransitionPane()
 {
+    dispose();
+}
+
+void SlideTransitionPane::dispose()
+{
     maLateInitTimer.Stop();
     removeListener();
+    PanelLayout::dispose();
 }
 
 void SlideTransitionPane::DataChanged (const DataChangedEvent& rEvent)
diff --git a/sd/source/ui/animations/SlideTransitionPane.hxx b/sd/source/ui/animations/SlideTransitionPane.hxx
index a75ca21..1cf2254 100644
--- a/sd/source/ui/animations/SlideTransitionPane.hxx
+++ b/sd/source/ui/animations/SlideTransitionPane.hxx
@@ -58,6 +58,7 @@ public:
         SdDrawDocument* pDoc,
         const css::uno::Reference<css::frame::XFrame>& rxFrame );
     virtual ~SlideTransitionPane();
+    virtual void dispose() SAL_OVERRIDE;
 
     // Window
     virtual void DataChanged (const DataChangedEvent& rEvent) SAL_OVERRIDE;
diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx
index 24ce6a4..491142f 100644
--- a/sd/source/ui/annotations/annotationwindow.cxx
+++ b/sd/source/ui/annotations/annotationwindow.cxx
@@ -284,11 +284,17 @@ AnnotationWindow::AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShel
 
 AnnotationWindow::~AnnotationWindow()
 {
+    dispose();
+}
+
+void AnnotationWindow::dispose()
+{
     delete mpMeta;
     delete mpOutlinerView;
     delete mpOutliner;
     delete mpVScrollbar;
     delete mpTextWindow;
+    FloatingWindow::dispose();
 }
 
 void AnnotationWindow::InitControls()
diff --git a/sd/source/ui/annotations/annotationwindow.hxx b/sd/source/ui/annotations/annotationwindow.hxx
index ed2c13e..a29ca42 100644
--- a/sd/source/ui/annotations/annotationwindow.hxx
+++ b/sd/source/ui/annotations/annotationwindow.hxx
@@ -102,6 +102,7 @@ class AnnotationWindow : public FloatingWindow
     public:
         AnnotationWindow( AnnotationManagerImpl& rManager, DrawDocShell* pDocShell, vcl::Window* pParent );
         virtual ~AnnotationWindow();
+        virtual void dispose() SAL_OVERRIDE;
 
         void StartEdit();
 
diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.cxx b/sd/source/ui/dlg/RemoteDialogClientBox.cxx
index c3f4eba..3853a98 100644
--- a/sd/source/ui/dlg/RemoteDialogClientBox.cxx
+++ b/sd/source/ui/dlg/RemoteDialogClientBox.cxx
@@ -73,16 +73,16 @@ ClientBox::ClientBox( vcl::Window* pParent, WinBits nStyle ) :
     m_nTopIndex( 0 ),
     m_nActiveHeight( 0 ),
     m_nExtraHeight( 2 ),
-    m_aPinBox( this, 0 ),
-    m_aDeauthoriseButton( this ),
-    m_aScrollBar( this, WB_VERT )
+    m_aPinBox( new NumericBox( this, 0 ) ),
+    m_aDeauthoriseButton( new PushButton( this ) ),
+    m_aScrollBar( new ScrollBar( this, WB_VERT ) )
 {
-    m_aScrollBar.SetScrollHdl( LINK( this, ClientBox, ScrollHdl ) );
-    m_aScrollBar.EnableDrag();
+    m_aScrollBar->SetScrollHdl( LINK( this, ClientBox, ScrollHdl ) );
+    m_aScrollBar->EnableDrag();
 
-    m_aPinBox.SetUseThousandSep(false);
-    m_aDeauthoriseButton.SetText( SD_RESSTR(STR_DEAUTHORISE_CLIENT) );
-    m_aDeauthoriseButton.SetClickHdl( LINK( this, ClientBox, DeauthoriseHdl ) );
+    m_aPinBox->SetUseThousandSep(false);
+    m_aDeauthoriseButton->SetText( SD_RESSTR(STR_DEAUTHORISE_CLIENT) );
+    m_aDeauthoriseButton->SetClickHdl( LINK( this, ClientBox, DeauthoriseHdl ) );
 
     SetPosPixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ) );
     long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE;
@@ -124,6 +124,11 @@ Size ClientBox::GetOptimalSize() const
 
 ClientBox::~ClientBox()
 {
+    dispose();
+}
+
+void ClientBox::dispose()
+{
     if ( ! m_bInDelete )
         DeleteRemoved();
 
@@ -132,6 +137,11 @@ ClientBox::~ClientBox()
     m_vEntries.clear();
 
     m_xRemoveListener.clear();
+
+    m_aPinBox.disposeAndClear();
+    m_aDeauthoriseButton.disposeAndClear();
+    m_aScrollBar.disposeAndClear();
+    Control::dispose();
 }
 
 // Title + description
@@ -152,7 +162,7 @@ void ClientBox::CalcActiveHeight( const long nPos )
     // Text entry height
     Size aSize = GetOutputSizePixel();
     if ( m_bHasScrollBar )
-        aSize.Width() -= m_aScrollBar.GetSizePixel().Width();
+        aSize.Width() -= m_aScrollBar->GetSizePixel().Width();
 
     aSize.Width() -= ICON_OFFSET;
 
@@ -173,7 +183,7 @@ Rectangle ClientBox::GetEntryRect( const long nPos ) const
     Size aSize( GetOutputSizePixel() );
 
     if ( m_bHasScrollBar )
-        aSize.Width() -= m_aScrollBar.GetSizePixel().Width();
+        aSize.Width() -= m_aScrollBar->GetSizePixel().Width();
 
     if ( m_vEntries[ nPos ]->m_bActive )
         aSize.Height() = m_nActiveHeight;
@@ -246,7 +256,7 @@ void ClientBox::selectEntry( const long nPos )
 
     // We empty the pin box now too, just in case the user previously
     // entered a pin, but then changed their selected device.
-    m_aPinBox.SetText( "" );
+    m_aPinBox->SetText( "" );
     if ( m_bHasActive )
     {
         bool bAlreadyAuthorised =
@@ -254,11 +264,11 @@ void ClientBox::selectEntry( const long nPos )
 
         if ( bAlreadyAuthorised )
         {
-            m_aDeauthoriseButton.GetFocus();
+            m_aDeauthoriseButton->GetFocus();
         }
         else
         {
-            m_aPinBox.GetFocus();
+            m_aPinBox->GetFocus();
         }
     }
 
@@ -350,19 +360,19 @@ void ClientBox::RecalcAll()
     Size aPBSize = LogicToPixel(
                       Size( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ),
                       MapMode( MAP_APPFONT ) );
-    m_aPinBox.SetSizePixel( aPBSize );
-    m_aDeauthoriseButton.SetSizePixel( m_aDeauthoriseButton.GetOptimalSize() );
+    m_aPinBox->SetSizePixel( aPBSize );
+    m_aDeauthoriseButton->SetSizePixel( m_aDeauthoriseButton->GetOptimalSize() );
 
     if ( !m_bHasActive )
     {
-        m_aPinBox.Show( false );
-        m_aDeauthoriseButton.Show( false );
+        m_aPinBox->Show( false );
+        m_aDeauthoriseButton->Show( false );
     }
     else
     {
         Rectangle aEntryRect = GetEntryRect( m_nActive );
 
-        Size  aPinBoxSize( m_aPinBox.GetSizePixel() );
+        Size  aPinBoxSize( m_aPinBox->GetSizePixel() );
         Point aPos( aEntryRect.Left(),
                     aEntryRect.Bottom() - TOP_OFFSET - aPinBoxSize.Height() );
 
@@ -378,7 +388,7 @@ void ClientBox::RecalcAll()
 
             aPos = Point( aEntryRect.Left() + GetTextWidth( sPinText ),
                           aEntryRect.Bottom() - TOP_OFFSET - aPinBoxSize.Height() );
-            m_aPinBox.SetPosPixel( aPos );
+            m_aPinBox->SetPosPixel( aPos );
             // The text would have it's TOP aligned with the top of
             // the pin box -- hence we push it down to align baselines.
             m_sPinTextRect += Point( 0, 4 );
@@ -386,11 +396,11 @@ void ClientBox::RecalcAll()
         else
         {
             aPos += Point( 20, 0 );
-            m_aDeauthoriseButton.SetPosPixel( aPos );
+            m_aDeauthoriseButton->SetPosPixel( aPos );
         }
 
-        m_aPinBox.Show( !bAlreadyAuthorised );
-        m_aDeauthoriseButton.Show( bAlreadyAuthorised );
+        m_aPinBox->Show( !bAlreadyAuthorised );
+        m_aDeauthoriseButton->Show( bAlreadyAuthorised );
 
         if ( m_bAdjustActive )
         {
@@ -424,7 +434,7 @@ void ClientBox::RecalcAll()
             }
 
             if ( m_bHasScrollBar )
-                m_aScrollBar.SetThumbPos( m_nTopIndex );
+                m_aScrollBar->SetThumbPos( m_nTopIndex );
         }
     }
 
@@ -487,7 +497,7 @@ void ClientBox::Paint( const Rectangle &/*rPaintRect*/ )
     Size aSize( GetOutputSizePixel() );
 
     if ( m_bHasScrollBar )
-        aSize.Width() -= m_aScrollBar.GetSizePixel().Width();
+        aSize.Width() -= m_aScrollBar->GetSizePixel().Width();
 
     const ::osl::MutexGuard aGuard( m_entriesMutex );
 
@@ -525,20 +535,20 @@ void ClientBox::SetupScrollBar()
         if ( m_nTopIndex + aSize.Height() > nTotalHeight )
             m_nTopIndex = nTotalHeight - aSize.Height();
 
-        m_aScrollBar.SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ),
+        m_aScrollBar->SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ),
                                        Size( nScrBarSize, aSize.Height() ) );
-        m_aScrollBar.SetRangeMax( nTotalHeight );
-        m_aScrollBar.SetVisibleSize( aSize.Height() );
-        m_aScrollBar.SetPageSize( ( aSize.Height() * 4 ) / 5 );
-        m_aScrollBar.SetLineSize( m_nStdHeight );
-        m_aScrollBar.SetThumbPos( m_nTopIndex );
+        m_aScrollBar->SetRangeMax( nTotalHeight );
+        m_aScrollBar->SetVisibleSize( aSize.Height() );
+        m_aScrollBar->SetPageSize( ( aSize.Height() * 4 ) / 5 );
+        m_aScrollBar->SetLineSize( m_nStdHeight );
+        m_aScrollBar->SetThumbPos( m_nTopIndex );
 
         if ( !m_bHasScrollBar )
-            m_aScrollBar.Show();
+            m_aScrollBar->Show();
     }
     else if ( m_bHasScrollBar )
     {
-        m_aScrollBar.Hide();
+        m_aScrollBar->Hide();
         m_nTopIndex = 0;
     }
 
@@ -567,7 +577,7 @@ long ClientBox::PointToPos( const Point& rPos )
 
 OUString ClientBox::getPin()
 {
-    return OUString::number( m_aPinBox.GetValue() );
+    return OUString::number( m_aPinBox->GetValue() );
 }
 
 void ClientBox::MouseButtonDown( const MouseEvent& rMEvt )
@@ -608,11 +618,11 @@ bool ClientBox::Notify( NotifyEvent& rNEvt )
             const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData();
             if ( pData->GetMode() == CommandWheelMode::SCROLL )
             {
-                long nThumbPos = m_aScrollBar.GetThumbPos();
+                long nThumbPos = m_aScrollBar->GetThumbPos();
                 if ( pData->GetDelta() < 0 )
-                    m_aScrollBar.DoScroll( nThumbPos + m_nStdHeight );
+                    m_aScrollBar->DoScroll( nThumbPos + m_nStdHeight );
                 else
-                    m_aScrollBar.DoScroll( nThumbPos - m_nStdHeight );
+                    m_aScrollBar->DoScroll( nThumbPos - m_nStdHeight );
                 bHandled = true;
             }
         }
@@ -702,13 +712,13 @@ void ClientBox::populateEntries()
 void ClientBox::DoScroll( long nDelta )
 {
     m_nTopIndex += nDelta;
-    Point aNewSBPt( m_aScrollBar.GetPosPixel() );
+    Point aNewSBPt( m_aScrollBar->GetPosPixel() );
 
     Rectangle aScrRect( Point(), GetOutputSizePixel() );
-    aScrRect.Right() -= m_aScrollBar.GetSizePixel().Width();
+    aScrRect.Right() -= m_aScrollBar->GetSizePixel().Width();
     Scroll( 0, -nDelta, aScrRect );
 
-    m_aScrollBar.SetPosPixel( aNewSBPt );
+    m_aScrollBar->SetPosPixel( aNewSBPt );
 }
 
 IMPL_LINK( ClientBox, ScrollHdl, ScrollBar*, pScrBar )
diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.hxx b/sd/source/ui/dlg/RemoteDialogClientBox.hxx
index 1dc481e..c40ac96 100644
--- a/sd/source/ui/dlg/RemoteDialogClientBox.hxx
+++ b/sd/source/ui/dlg/RemoteDialogClientBox.hxx
@@ -101,11 +101,11 @@ class ClientBox:
     Link            m_aClickHdl;
     Link            m_aDeauthoriseHdl;
 
-    NumericBox      m_aPinBox;
-    PushButton      m_aDeauthoriseButton;
-    Rectangle       m_sPinTextRect;
+    VclPtr<NumericBox>      m_aPinBox;
+    VclPtr<PushButton>      m_aDeauthoriseButton;
+    Rectangle               m_sPinTextRect;
 
-    ScrollBar       m_aScrollBar;
+    VclPtr<ScrollBar>       m_aScrollBar;
 
     com::sun::star::uno::Reference< ClientRemovedListener > m_xRemoveListener;
 
@@ -136,7 +136,8 @@ class ClientBox:
 
 public:
                     ClientBox( vcl::Window* pParent, WinBits nStyle );
-                   virtual ~ClientBox();
+    virtual         ~ClientBox();
+    virtual void    dispose() SAL_OVERRIDE;
 
     void    MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     void    Paint( const Rectangle &rPaintRect ) SAL_OVERRIDE;
diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx
index 2881e39..2be1601 100644
--- a/sd/source/ui/dlg/animobjs.cxx
+++ b/sd/source/ui/dlg/animobjs.cxx
@@ -206,6 +206,11 @@ AnimationWindow::AnimationWindow(SfxBindings* pInBindings, SfxChildWindow *pCW,
 
 AnimationWindow::~AnimationWindow()
 {
+    dispose();
+}
+
+void AnimationWindow::dispose()
+{
     delete pControllerItem;
 
     for (size_t i = 0; i < m_FrameList.size(); ++i)
@@ -220,6 +225,8 @@ AnimationWindow::~AnimationWindow()
     delete pMyDoc;
 
     delete m_pCtlDisplay;
+
+    SfxDockingWindow::dispose();
 }
 
 IMPL_LINK_NOARG(AnimationWindow, ClickFirstHdl)
diff --git a/sd/source/ui/dlg/brkdlg.cxx b/sd/source/ui/dlg/brkdlg.cxx
index 6f1ebc6..e36c564 100644
--- a/sd/source/ui/dlg/brkdlg.cxx
+++ b/sd/source/ui/dlg/brkdlg.cxx
@@ -67,8 +67,14 @@ BreakDlg::BreakDlg(
 
 BreakDlg::~BreakDlg()
 {
+    dispose();
+}
+
+void BreakDlg::dispose()
+{
     delete mpProgress;
     delete pProgrInfo;
+    SfxModalDialog::dispose();
 }
 
 // Control-Handler for cancel button
diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx
index c0b9b05..a66d6a0 100644
--- a/sd/source/ui/dlg/copydlg.cxx
+++ b/sd/source/ui/dlg/copydlg.cxx
@@ -84,6 +84,11 @@ CopyDlg::CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs,
 
 CopyDlg::~CopyDlg()
 {
+    dispose();
+}
+
+void CopyDlg::dispose()
+{
     OUString& rStr = GetExtraData();
 
     rStr = OUString::number(m_pNumFldCopies->GetValue());
@@ -108,6 +113,8 @@ CopyDlg::~CopyDlg()
     rStr += OUString( TOKEN );
 
     rStr += OUString::number( m_pLbEndColor->GetSelectEntryColor().GetColor() );
+
+    SfxModalDialog::dispose();
 }
 
 /**
diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx
index 8ed9166..757028a 100644
--- a/sd/source/ui/dlg/dlgass.cxx
+++ b/sd/source/ui/dlg/dlgass.cxx
@@ -1769,7 +1769,13 @@ IMPL_LINK_NOARG(AssistentDlg, FinishHdl)
 
 AssistentDlg::~AssistentDlg()
 {
+    dispose();
+}
+
+void AssistentDlg::dispose()
+{
     delete mpImpl;
+    ModalDialog::dispose();
 }
 
 SfxObjectShellLock AssistentDlg::GetDocument()
diff --git a/sd/source/ui/dlg/dlgassim.cxx b/sd/source/ui/dlg/dlgassim.cxx
index 5eaab01..331c1af 100644
--- a/sd/source/ui/dlg/dlgassim.cxx
+++ b/sd/source/ui/dlg/dlgassim.cxx
@@ -78,7 +78,13 @@ IMPL_LINK_NOARG(SdPageListControl, CheckButtonClickHdl)
 
 SdPageListControl::~SdPageListControl()
 {
+    dispose();
+}
+
+void SdPageListControl::dispose()
+{
     delete m_pCheckButton;
+    SvTreeListBox::dispose();
 }
 
 void SdPageListControl::Clear()
diff --git a/sd/source/ui/dlg/dlgassim.hxx b/sd/source/ui/dlg/dlgassim.hxx
index 8e966f8..ee39788 100644
--- a/sd/source/ui/dlg/dlgassim.hxx
+++ b/sd/source/ui/dlg/dlgassim.hxx
@@ -37,6 +37,7 @@ private:
 public:
     SdPageListControl( vcl::Window* pParent, const WinBits nStyle );
     virtual ~SdPageListControl();
+    virtual void dispose() SAL_OVERRIDE;
 
     void Fill( SdDrawDocument* pDoc );
     void Clear();
diff --git a/sd/source/ui/dlg/dlgctrls.cxx b/sd/source/ui/dlg/dlgctrls.cxx
index 1092328..0fc35a6 100644
--- a/sd/source/ui/dlg/dlgctrls.cxx
+++ b/sd/source/ui/dlg/dlgctrls.cxx
@@ -40,7 +40,13 @@ FadeEffectLB::FadeEffectLB(vcl::Window* pParent, WinBits nStyle)
 
 FadeEffectLB::~FadeEffectLB()
 {
+    dispose();
+}
+
+void FadeEffectLB::dispose()
+{
     delete mpImpl;
+    ListBox::dispose();
 }
 
 void FadeEffectLB::Fill()
diff --git a/sd/source/ui/dlg/dlgolbul.cxx b/sd/source/ui/dlg/dlgolbul.cxx
index c3a7710..b8fb42d 100644
--- a/sd/source/ui/dlg/dlgolbul.cxx
+++ b/sd/source/ui/dlg/dlgolbul.cxx
@@ -138,7 +138,13 @@ OutlineBulletDlg::OutlineBulletDlg(
 
 OutlineBulletDlg::~OutlineBulletDlg()
 {
+    dispose();
+}
+
+void OutlineBulletDlg::dispose()
+{
     delete pOutputSet;
+    SfxTabDialog::dispose();
 }
 
 void OutlineBulletDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
diff --git a/sd/source/ui/dlg/docprev.cxx b/sd/source/ui/dlg/docprev.cxx
index e3f9a2a..2929f46 100644
--- a/sd/source/ui/dlg/docprev.cxx
+++ b/sd/source/ui/dlg/docprev.cxx
@@ -83,7 +83,13 @@ SdDocPreviewWin::SdDocPreviewWin( vcl::Window* pParent, const WinBits nStyle )
 
 SdDocPreviewWin::~SdDocPreviewWin()
 {
+    dispose();
+}
+
+void SdDocPreviewWin::dispose()
+{
     delete pMetaFile;
+    Control::dispose();
 }
 
 Size SdDocPreviewWin::GetOptimalSize() const
diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx
index e759035..b7c9548 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -240,8 +240,14 @@ HeaderFooterDialog::HeaderFooterDialog( ViewShell* pViewShell, vcl::Window* pPar
 
 HeaderFooterDialog::~HeaderFooterDialog()
 {
+    dispose();
+}
+
+void HeaderFooterDialog::dispose()
+{
     delete mpSlideTabPage;
     delete mpNotesHandoutsTabPage;
+    TabDialog::dispose();
 }
 
 IMPL_LINK( HeaderFooterDialog, ActivatePageHdl, TabControl *, pTabCtrl )
diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx
index f7b4791..60e1074 100644
--- a/sd/source/ui/dlg/navigatr.cxx
+++ b/sd/source/ui/dlg/navigatr.cxx
@@ -68,9 +68,9 @@ SdNavigatorWin::SdNavigatorWin(
     SfxBindings* pInBindings,
     const UpdateRequestFunctor& rUpdateRequest)
     : vcl::Window( pParent, rSdResId )
-    , maToolbox ( this, SdResId( 1 ) )
-    , maTlbObjects( this, SdResId( TLB_OBJECTS ) )
-    , maLbDocs ( this, SdResId( LB_DOCS ) )
+    , maToolbox ( new ToolBox( this, SdResId( 1 ) ) )
+    , maTlbObjects( new SdPageObjsTLB( this, SdResId( TLB_OBJECTS ) ) )
+    , maLbDocs ( new ListBox( this, SdResId( LB_DOCS ) ) )
     , mpChildWinContext( pChWinCtxt )
     , mbDocImported ( false )
       // On changes of the DragType: adjust SelectionMode of TLB!
@@ -78,58 +78,58 @@ SdNavigatorWin::SdNavigatorWin(
     , mpBindings ( pInBindings )
     , maImageList ( SdResId( IL_NAVIGATR ) )
 {
-    maTlbObjects.SetViewFrame( mpBindings->GetDispatcher()->GetFrame() );
+    maTlbObjects->SetViewFrame( mpBindings->GetDispatcher()->GetFrame() );
 
     FreeResource();
 
-    maTlbObjects.SetAccessibleName(SD_RESSTR(STR_OBJECTS_TREE));
+    maTlbObjects->SetAccessibleName(SD_RESSTR(STR_OBJECTS_TREE));
 
     mpNavigatorCtrlItem = new SdNavigatorControllerItem( SID_NAVIGATOR_STATE, this, mpBindings, rUpdateRequest);
     mpPageNameCtrlItem = new SdPageNameControllerItem( SID_NAVIGATOR_PAGENAME, this, mpBindings, rUpdateRequest);
 
     ApplyImageList(); // load images *before* calculating sizes to get something useful !!!
 
-    Size aTbxSize( maToolbox.CalcWindowSizePixel() );
-    maToolbox.SetOutputSizePixel( aTbxSize );
-    maToolbox.SetSelectHdl( LINK( this, SdNavigatorWin, SelectToolboxHdl ) );
-    maToolbox.SetClickHdl( LINK( this, SdNavigatorWin, ClickToolboxHdl ) );
-    maToolbox.SetDropdownClickHdl( LINK(this, SdNavigatorWin, DropdownClickToolBoxHdl) );
-    maToolbox.SetItemBits( TBI_DRAGTYPE, maToolbox.GetItemBits( TBI_DRAGTYPE ) | ToolBoxItemBits::DROPDOWNONLY );
+    Size aTbxSize( maToolbox->CalcWindowSizePixel() );
+    maToolbox->SetOutputSizePixel( aTbxSize );
+    maToolbox->SetSelectHdl( LINK( this, SdNavigatorWin, SelectToolboxHdl ) );
+    maToolbox->SetClickHdl( LINK( this, SdNavigatorWin, ClickToolboxHdl ) );
+    maToolbox->SetDropdownClickHdl( LINK(this, SdNavigatorWin, DropdownClickToolBoxHdl) );
+    maToolbox->SetItemBits( TBI_DRAGTYPE, maToolbox->GetItemBits( TBI_DRAGTYPE ) | ToolBoxItemBits::DROPDOWNONLY );
 
     // Shape filter drop down menu.
-    maToolbox.SetItemBits(
+    maToolbox->SetItemBits(
         TBI_SHAPE_FILTER,
-        maToolbox.GetItemBits(TBI_SHAPE_FILTER) | ToolBoxItemBits::DROPDOWNONLY);
+        maToolbox->GetItemBits(TBI_SHAPE_FILTER) | ToolBoxItemBits::DROPDOWNONLY);
 
     // TreeListBox
     // set position below toolbox
-    long nListboxYPos = maToolbox.GetPosPixel().Y() + maToolbox.GetSizePixel().Height() + 4;
-    maTlbObjects.setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
-    maTlbObjects.SetDoubleClickHdl( LINK( this, SdNavigatorWin, ClickObjectHdl ) );
-    maTlbObjects.SetSelectionMode( SINGLE_SELECTION );
+    long nListboxYPos = maToolbox->GetPosPixel().Y() + maToolbox->GetSizePixel().Height() + 4;
+    maTlbObjects->setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
+    maTlbObjects->SetDoubleClickHdl( LINK( this, SdNavigatorWin, ClickObjectHdl ) );
+    maTlbObjects->SetSelectionMode( SINGLE_SELECTION );
     // set focus to listbox, otherwise it is in the toolbox which is only useful
     // for keyboard navigation
-    maTlbObjects.GrabFocus();
-    maTlbObjects.SetSdNavigatorWinFlag(true);
+    maTlbObjects->GrabFocus();
+    maTlbObjects->SetSdNavigatorWinFlag(true);
 
     // DragTypeListBox
-    maLbDocs.SetSelectHdl( LINK( this, SdNavigatorWin, SelectDocumentHdl ) );
+    maLbDocs->SetSelectHdl( LINK( this, SdNavigatorWin, SelectDocumentHdl ) );
     // set position below treelistbox
-    nListboxYPos = maTlbObjects.GetPosPixel().Y() + maTlbObjects.GetSizePixel().Height() + 4;
-    maLbDocs.setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
+    nListboxYPos = maTlbObjects->GetPosPixel().Y() + maTlbObjects->GetSizePixel().Height() + 4;
+    maLbDocs->setPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
 
     // assure that tool box is at least as wide as the tree list box
     {
-        const Size aTlbSize( maTlbObjects.GetOutputSizePixel() );
+        const Size aTlbSize( maTlbObjects->GetOutputSizePixel() );
         if ( aTlbSize.Width() > aTbxSize.Width() )
         {
-            maToolbox.setPosSizePixel( 0, 0, aTlbSize.Width(), 0, WINDOW_POSSIZE_WIDTH );
-            aTbxSize = maToolbox.GetOutputSizePixel();
+            maToolbox->setPosSizePixel( 0, 0, aTlbSize.Width(), 0, WINDOW_POSSIZE_WIDTH );
+            aTbxSize = maToolbox->GetOutputSizePixel();
         }
     }
 
     // set min outputsize after all sizes are known
-    const long nFullHeight = nListboxYPos + maLbDocs.GetSizePixel().Height() + 4;
+    const long nFullHeight = nListboxYPos + maLbDocs->GetSizePixel().Height() + 4;
     maSize = GetOutputSizePixel();
     if( maSize.Height() < nFullHeight )
     {
@@ -137,7 +137,7 @@ SdNavigatorWin::SdNavigatorWin(
         SetOutputSizePixel( maSize );
     }
     maMinSize = maSize;
-    const long nMinWidth = 2*maToolbox.GetPosPixel().X() + aTbxSize.Width(); // never clip the toolbox
+    const long nMinWidth = 2*maToolbox->GetPosPixel().X() + aTbxSize.Width(); // never clip the toolbox
     if( nMinWidth > maMinSize.Width() )
         maMinSize.Width() = nMinWidth;
     maMinSize.Height() -= 40;
@@ -152,8 +152,17 @@ SdNavigatorWin::SdNavigatorWin(
 
 SdNavigatorWin::~SdNavigatorWin()
 {
+    dispose();
+}
+
+void SdNavigatorWin::dispose()
+{
     delete mpNavigatorCtrlItem;
     delete mpPageNameCtrlItem;
+    maToolbox.disposeAndClear();
+    maTlbObjects.disposeAndClear();
+    maLbDocs.disposeAndClear();
+    vcl::Window::dispose();
 }
 
 //when object is marked , fresh the corresponding entry tree .
@@ -163,17 +172,17 @@ void SdNavigatorWin::FreshTree( const SdDrawDocument* pDoc )
     sd::DrawDocShell* pDocShell = pNonConstDoc->GetDocSh();
     OUString aDocShName( pDocShell->GetName() );
     OUString aDocName = pDocShell->GetMedium()->GetName();
-    maTlbObjects.SetSaveTreeItemStateFlag(true); //Added by yanjun for sym2_6385
-    maTlbObjects.Clear();
-    maTlbObjects.Fill( pDoc, false, aDocName ); // Nur normale Seiten
-    maTlbObjects.SetSaveTreeItemStateFlag(false); //Added by yanjun for sym2_6385
+    maTlbObjects->SetSaveTreeItemStateFlag(true); //Added by yanjun for sym2_6385
+    maTlbObjects->Clear();
+    maTlbObjects->Fill( pDoc, false, aDocName ); // Nur normale Seiten
+    maTlbObjects->SetSaveTreeItemStateFlag(false); //Added by yanjun for sym2_6385
     RefreshDocumentLB();
-    maLbDocs.SelectEntry( aDocShName );
+    maLbDocs->SelectEntry( aDocShName );
 }
 
 void SdNavigatorWin::FreshEntry( )
 {
-    maTlbObjects.FreshCurEntry();
+    maTlbObjects->FreshCurEntry();
 }
 
 void SdNavigatorWin::InitTreeLB( const SdDrawDocument* pDoc )
@@ -189,35 +198,35 @@ void SdNavigatorWin::InitTreeLB( const SdDrawDocument* pDoc )
     {
         ::sd::FrameView* pFrameView = pViewShell->GetFrameView();
         if (pFrameView != NULL)
-            maTlbObjects.SetShowAllShapes(pFrameView->IsNavigatorShowingAllShapes(), false);
+            maTlbObjects->SetShowAllShapes(pFrameView->IsNavigatorShowingAllShapes(), false);
     }
 
     // Disable the shape filter drop down menu when there is a running slide
     // show.
     if (pViewShell!=NULL && sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() ))
-        maToolbox.EnableItem(TBI_SHAPE_FILTER, false);
+        maToolbox->EnableItem(TBI_SHAPE_FILTER, false);
     else
-        maToolbox.EnableItem(TBI_SHAPE_FILTER);
+        maToolbox->EnableItem(TBI_SHAPE_FILTER);
 
-    if( !maTlbObjects.IsEqualToDoc( pDoc ) )
+    if( !maTlbObjects->IsEqualToDoc( pDoc ) )
     {
         OUString aDocName = pDocShell->GetMedium()->GetName();
-        maTlbObjects.Clear();
-        maTlbObjects.Fill( pDoc, false, aDocName ); // only normal pages
+        maTlbObjects->Clear();
+        maTlbObjects->Fill( pDoc, false, aDocName ); // only normal pages
 
         RefreshDocumentLB();
-        maLbDocs.SelectEntry( aDocShName );
+        maLbDocs->SelectEntry( aDocShName );
     }
     else
     {
-        maLbDocs.SetNoSelection();
-        maLbDocs.SelectEntry( aDocShName );
+        maLbDocs->SetNoSelection();
+        maLbDocs->SelectEntry( aDocShName );
 
 // commented in order to fix 30246
-//        if( maLbDocs.GetSelectEntryCount() == 0 )
+//        if( maLbDocs->GetSelectEntryCount() == 0 )
         {
             RefreshDocumentLB();
-            maLbDocs.SelectEntry( aDocShName );
+            maLbDocs->SelectEntry( aDocShName );
         }
     }
 
@@ -235,7 +244,7 @@ NavigatorDragType SdNavigatorWin::GetNavigatorDragType()
     NavigatorDragType   eDT = meDragType;
     NavDocInfo*         pInfo = GetDocInfo();
 
-    if( ( eDT == NAVIGATOR_DRAGTYPE_LINK ) && ( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() ) )
+    if( ( eDT == NAVIGATOR_DRAGTYPE_LINK ) && ( ( pInfo && !pInfo->HasName() ) || !maTlbObjects->IsLinkableSelected() ) )
         eDT = NAVIGATOR_DRAGTYPE_NONE;
 
     return eDT;
@@ -252,7 +261,7 @@ sd::DrawDocShell* SdNavigatorWin::GetDrawDocShell( const SdDrawDocument* pDoc )
 
 IMPL_LINK_NOARG(SdNavigatorWin, SelectToolboxHdl)
 {
-    sal_uInt16 nId = maToolbox.GetCurItemId();
+    sal_uInt16 nId = maToolbox->GetCurItemId();
     sal_uInt16 nSId = 0;
     PageJump ePage = PAGE_NONE;
 
@@ -307,7 +316,7 @@ IMPL_LINK_NOARG(SdNavigatorWin, ClickToolboxHdl)
 
 IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox )
 {
-    sal_uInt16 nId = maToolbox.GetCurItemId();
+    sal_uInt16 nId = maToolbox->GetCurItemId();
 
     switch( nId )
     {
@@ -339,7 +348,7 @@ IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox )
             }
             NavDocInfo* pInfo = GetDocInfo();
 
-            if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() )
+            if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects->IsLinkableSelected() )
             {
                 pMenu->EnableItem( NAVIGATOR_DRAGTYPE_LINK, false );
                 pMenu->EnableItem( NAVIGATOR_DRAGTYPE_URL, false );
@@ -349,7 +358,7 @@ IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox )
             pMenu->CheckItem( (sal_uInt16)meDragType );
             pMenu->SetSelectHdl( LINK( this, SdNavigatorWin, MenuSelectHdl ) );
 
-            pMenu->Execute( this, maToolbox.GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN );
+            pMenu->Execute( this, maToolbox->GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN );
             pBox->EndSelection();
             delete pMenu;
         }
@@ -366,13 +375,13 @@ IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox )
                 nShowAllShapesFilter,
                 SD_RESSTR(STR_NAVIGATOR_SHOW_ALL_SHAPES));
 
-            if (maTlbObjects.GetShowAllShapes())
+            if (maTlbObjects->GetShowAllShapes())
                 pMenu->CheckItem(nShowAllShapesFilter);
             else
                 pMenu->CheckItem(nShowNamedShapesFilter);
             pMenu->SetSelectHdl( LINK( this, SdNavigatorWin, ShapeFilterCallback ) );
 
-            pMenu->Execute( this, maToolbox.GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN );
+            pMenu->Execute( this, maToolbox->GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN );
             pBox->EndSelection();
             delete pMenu;
         }
@@ -383,14 +392,14 @@ IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox )
 
 IMPL_LINK_NOARG(SdNavigatorWin, ClickObjectHdl)
 {
-    if( !mbDocImported || maLbDocs.GetSelectEntryPos() != 0 )
+    if( !mbDocImported || maLbDocs->GetSelectEntryPos() != 0 )
     {
         NavDocInfo* pInfo = GetDocInfo();
 
         // if it is the active window, we jump to the page
         if( pInfo && pInfo->IsActive() )
         {
-            OUString aStr( maTlbObjects.GetSelectEntry() );
+            OUString aStr( maTlbObjects->GetSelectEntry() );
 
             if( !aStr.isEmpty() )
             {
@@ -398,7 +407,7 @@ IMPL_LINK_NOARG(SdNavigatorWin, ClickObjectHdl)
                 mpBindings->GetDispatcher()->Execute(
                     SID_NAVIGATOR_OBJECT, SfxCallMode::SLOT | SfxCallMode::RECORD, &aItem, 0L );
                 //set sign variable
-                maTlbObjects.MarkCurEntry(aStr);
+                maTlbObjects->MarkCurEntry(aStr);
 
                 // moved here from SetGetFocusHdl. Reset the
                 // focus only if something has been selected in the
@@ -419,8 +428,8 @@ IMPL_LINK_NOARG(SdNavigatorWin, ClickObjectHdl)
 
 IMPL_LINK_NOARG(SdNavigatorWin, SelectDocumentHdl)
 {
-    OUString aStrLb = maLbDocs.GetSelectEntry();
-    long   nPos = maLbDocs.GetSelectEntryPos();
+    OUString aStrLb = maLbDocs->GetSelectEntry();
+    long   nPos = maLbDocs->GetSelectEntryPos();
     bool   bFound = false;
     ::sd::DrawDocShell* pDocShell = NULL;
     NavDocInfo* pInfo = GetDocInfo();
@@ -441,18 +450,18 @@ IMPL_LINK_NOARG(SdNavigatorWin, SelectDocumentHdl)
     if( bFound )
     {
         SdDrawDocument* pDoc = pDocShell->GetDoc();
-        if( !maTlbObjects.IsEqualToDoc( pDoc ) )
+        if( !maTlbObjects->IsEqualToDoc( pDoc ) )
         {
             SdDrawDocument* pNonConstDoc = (SdDrawDocument*) pDoc; // const as const can...
             ::sd::DrawDocShell* pNCDocShell = pNonConstDoc->GetDocSh();
             OUString aDocName = pNCDocShell->GetMedium()->GetName();
-            maTlbObjects.Clear();
-            maTlbObjects.Fill( pDoc, false, aDocName ); // only normal pages
+            maTlbObjects->Clear();
+            maTlbObjects->Fill( pDoc, false, aDocName ); // only normal pages
         }
     }
 
     // check if link or url is possible
-    if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() || ( meDragType != NAVIGATOR_DRAGTYPE_EMBEDDED ) )
+    if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects->IsLinkableSelected() || ( meDragType != NAVIGATOR_DRAGTYPE_EMBEDDED ) )
     {
         meDragType = NAVIGATOR_DRAGTYPE_EMBEDDED;
         SetDragImage();
@@ -484,13 +493,13 @@ IMPL_LINK( SdNavigatorWin, MenuSelectHdl, Menu *, pMenu )
             if( meDragType == NAVIGATOR_DRAGTYPE_URL )
             {
                 // patch, prevents endless loop
-                if( maTlbObjects.GetSelectionCount() > 1 )
-                    maTlbObjects.SelectAll( false );
+                if( maTlbObjects->GetSelectionCount() > 1 )
+                    maTlbObjects->SelectAll( false );
 
-                maTlbObjects.SetSelectionMode( SINGLE_SELECTION );
+                maTlbObjects->SetSelectionMode( SINGLE_SELECTION );
             }
             else
-                maTlbObjects.SetSelectionMode( MULTIPLE_SELECTION );
+                maTlbObjects->SetSelectionMode( MULTIPLE_SELECTION );
         }
     }
     return 0;
@@ -500,7 +509,7 @@ IMPL_LINK( SdNavigatorWin, ShapeFilterCallback, Menu *, pMenu )
 {
     if (pMenu != NULL)
     {
-        bool bShowAllShapes (maTlbObjects.GetShowAllShapes());
+        bool bShowAllShapes (maTlbObjects->GetShowAllShapes());
         sal_uInt16 nMenuId (pMenu->GetCurItemId());
         switch (nMenuId)
         {
@@ -518,7 +527,7 @@ IMPL_LINK( SdNavigatorWin, ShapeFilterCallback, Menu *, pMenu )
                 break;
         }
 
-        maTlbObjects.SetShowAllShapes(bShowAllShapes, true);
+        maTlbObjects->SetShowAllShapes(bShowAllShapes, true);
 
         // Remember the selection in the FrameView.
         NavDocInfo* pInfo = GetDocInfo();
@@ -554,26 +563,26 @@ void SdNavigatorWin::Resize()
         aDiffSize.Height() = aWinSize.Height() - maSize.Height();
 
         // change size of Toolbox
-        Size aObjSize( maToolbox.GetOutputSizePixel() );
+        Size aObjSize( maToolbox->GetOutputSizePixel() );
         aObjSize.Width() += aDiffSize.Width();
-        maToolbox.SetOutputSizePixel( aObjSize );
+        maToolbox->SetOutputSizePixel( aObjSize );
 
         // change size of TreeLB
-        aObjSize = maTlbObjects.GetSizePixel();
+        aObjSize = maTlbObjects->GetSizePixel();
         aObjSize.Width() += aDiffSize.Width();
-        aObjSize.Height() = maLbDocs.GetPosPixel().Y() + aDiffSize.Height() -
-            maTlbObjects.GetPosPixel().Y() - 4;
-        maTlbObjects.SetSizePixel( aObjSize );
+        aObjSize.Height() = maLbDocs->GetPosPixel().Y() + aDiffSize.Height() -
+            maTlbObjects->GetPosPixel().Y() - 4;
+        maTlbObjects->SetSizePixel( aObjSize );
 
         Point aPt( 0, aDiffSize.Height() );
 
         // move other controls (DocumentLB)
-        maLbDocs.Hide();
-        aObjSize = maLbDocs.GetOutputSizePixel();
+        maLbDocs->Hide();
+        aObjSize = maLbDocs->GetOutputSizePixel();
         aObjSize.Width() += aDiffSize.Width();
-        maLbDocs.SetPosPixel( maLbDocs.GetPosPixel() + aPt );
-        maLbDocs.SetOutputSizePixel( aObjSize );
-        maLbDocs.Show();
+        maLbDocs->SetPosPixel( maLbDocs->GetPosPixel() + aPt );
+        maLbDocs->SetOutputSizePixel( aObjSize );
+        maLbDocs->Show();
 
         maSize = aWinSize;
     }
@@ -623,19 +632,19 @@ bool SdNavigatorWin::InsertFile(const OUString& rFileName)
             if (pMedium->IsStorage())
             {
                 // Now depending on mode:
-                // maTlbObjects.SetSelectionMode(MULTIPLE_SELECTION);
+                // maTlbObjects->SetSelectionMode(MULTIPLE_SELECTION);
                 // handover of ownership of pMedium;
-                SdDrawDocument* pDropDoc = maTlbObjects.GetBookmarkDoc(pMedium);
+                SdDrawDocument* pDropDoc = maTlbObjects->GetBookmarkDoc(pMedium);
 
                 if (pDropDoc)
                 {
-                    maTlbObjects.Clear();
+                    maTlbObjects->Clear();
                     maDropFileName = aFileName;
 
-                    if( !maTlbObjects.IsEqualToDoc( pDropDoc ) )
+                    if( !maTlbObjects->IsEqualToDoc( pDropDoc ) )
                     {
                         // only normal pages
-                        maTlbObjects.Fill(pDropDoc, false, maDropFileName);
+                        maTlbObjects->Fill(pDropDoc, false, maDropFileName);
                         RefreshDocumentLB( &maDropFileName );
                     }
                 }
@@ -662,28 +671,28 @@ void SdNavigatorWin::RefreshDocumentLB( const OUString* pDocName )
     if( pDocName )
     {
         if( mbDocImported )
-            maLbDocs.RemoveEntry( 0 );
+            maLbDocs->RemoveEntry( 0 );
 
-        maLbDocs.InsertEntry( *pDocName, 0 );
+        maLbDocs->InsertEntry( *pDocName, 0 );
         mbDocImported = true;
     }
     else
     {
-        nPos = maLbDocs.GetSelectEntryPos();
+        nPos = maLbDocs->GetSelectEntryPos();
         if( nPos == LISTBOX_ENTRY_NOTFOUND )
             nPos = 0;
 
         OUString aStr;
         if( mbDocImported )
-            aStr = maLbDocs.GetEntry( 0 );
+            aStr = maLbDocs->GetEntry( 0 );
 
-        maLbDocs.Clear();
+        maLbDocs->Clear();
 
         // delete list of DocInfos
          maDocList.clear();
 
         if( mbDocImported )
-            maLbDocs.InsertEntry( aStr, 0 );
+            maLbDocs->InsertEntry( aStr, 0 );
 
         ::sd::DrawDocShell* pCurrentDocShell =
               PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() );
@@ -707,7 +716,7 @@ void SdNavigatorWin::RefreshDocumentLB( const OUString* pDocName )
                 // is shown in url notation!
                 aStr = pDocShell->GetName();
 
-                maLbDocs.InsertEntry( aStr, LISTBOX_APPEND );
+                maLbDocs->InsertEntry( aStr, LISTBOX_APPEND );
 
                 if( pDocShell == pCurrentDocShell )
                     aInfo.SetActive();
@@ -719,7 +728,7 @@ void SdNavigatorWin::RefreshDocumentLB( const OUString* pDocName )
             pSfxDocShell = SfxObjectShell::GetNext( *pSfxDocShell, 0, false );
         }
     }
-    maLbDocs.SelectEntryPos( nPos );
+    maLbDocs->SelectEntryPos( nPos );
 }
 
 sal_uInt16 SdNavigatorWin::GetDragTypeSdResId( NavigatorDragType eDT, bool bImage )
@@ -741,7 +750,7 @@ sal_uInt16 SdNavigatorWin::GetDragTypeSdResId( NavigatorDragType eDT, bool bImag
 
 NavDocInfo* SdNavigatorWin::GetDocInfo()
 {
-    sal_uInt32 nPos = maLbDocs.GetSelectEntryPos();
+    sal_uInt32 nPos = maLbDocs->GetSelectEntryPos();
 
     if( mbDocImported )
     {
@@ -834,14 +843,14 @@ void SdNavigatorWin::DataChanged( const DataChangedEvent& rDCEvt )
 
 void SdNavigatorWin::SetDragImage()
 {
-    maToolbox.SetItemImage( TBI_DRAGTYPE, maToolbox.GetImageList().GetImage( GetDragTypeSdResId( meDragType, true ) ) );
+    maToolbox->SetItemImage( TBI_DRAGTYPE, maToolbox->GetImageList().GetImage( GetDragTypeSdResId( meDragType, true ) ) );
 }
 
 void SdNavigatorWin::ApplyImageList()
 {
 
-    maToolbox.SetImageList( maImageList );
-    maToolbox.SetItemImage(TBI_SHAPE_FILTER, Image(BitmapEx(SdResId(BMP_GRAPHIC))));
+    maToolbox->SetImageList( maImageList );
+    maToolbox->SetItemImage(TBI_SHAPE_FILTER, Image(BitmapEx(SdResId(BMP_GRAPHIC))));
 
     SetDragImage();
 }
@@ -871,17 +880,17 @@ void SdNavigatorControllerItem::StateChanged( sal_uInt16 nSId,
 
         // pen
         if( nState & NAVBTN_PEN_ENABLED &&
-            !pNavigatorWin->maToolbox.IsItemEnabled( TBI_PEN ) )
-            pNavigatorWin->maToolbox.EnableItem( TBI_PEN );
+            !pNavigatorWin->maToolbox->IsItemEnabled( TBI_PEN ) )
+            pNavigatorWin->maToolbox->EnableItem( TBI_PEN );
         if( nState & NAVBTN_PEN_DISABLED &&
-            pNavigatorWin->maToolbox.IsItemEnabled( TBI_PEN ) )
-            pNavigatorWin->maToolbox.EnableItem( TBI_PEN, false );
+            pNavigatorWin->maToolbox->IsItemEnabled( TBI_PEN ) )
+            pNavigatorWin->maToolbox->EnableItem( TBI_PEN, false );
         if( nState & NAVBTN_PEN_CHECKED &&
-            !pNavigatorWin->maToolbox.IsItemChecked( TBI_PEN ) )
-            pNavigatorWin->maToolbox.CheckItem( TBI_PEN );
+            !pNavigatorWin->maToolbox->IsItemChecked( TBI_PEN ) )
+            pNavigatorWin->maToolbox->CheckItem( TBI_PEN );
         if( nState & NAVBTN_PEN_UNCHECKED &&
-            pNavigatorWin->maToolbox.IsItemChecked( TBI_PEN ) )
-            pNavigatorWin->maToolbox.CheckItem( TBI_PEN, false );
+            pNavigatorWin->maToolbox->IsItemChecked( TBI_PEN ) )
+            pNavigatorWin->maToolbox->CheckItem( TBI_PEN, false );
 
         // only if doc in LB is the active
         NavDocInfo* pInfo = pNavigatorWin->GetDocInfo();
@@ -889,35 +898,35 @@ void SdNavigatorControllerItem::StateChanged( sal_uInt16 nSId,
         {
             // First
             if( nState & NAVBTN_FIRST_ENABLED &&
-                !pNavigatorWin->maToolbox.IsItemEnabled( TBI_FIRST ) )
-                pNavigatorWin->maToolbox.EnableItem( TBI_FIRST );
+                !pNavigatorWin->maToolbox->IsItemEnabled( TBI_FIRST ) )
+                pNavigatorWin->maToolbox->EnableItem( TBI_FIRST );
             if( nState & NAVBTN_FIRST_DISABLED &&
-                pNavigatorWin->maToolbox.IsItemEnabled( TBI_FIRST ) )
-                pNavigatorWin->maToolbox.EnableItem( TBI_FIRST, false );
+                pNavigatorWin->maToolbox->IsItemEnabled( TBI_FIRST ) )
+                pNavigatorWin->maToolbox->EnableItem( TBI_FIRST, false );
 
             // Prev
             if( nState & NAVBTN_PREV_ENABLED &&
-                !pNavigatorWin->maToolbox.IsItemEnabled( TBI_PREVIOUS ) )
-                pNavigatorWin->maToolbox.EnableItem( TBI_PREVIOUS );
+                !pNavigatorWin->maToolbox->IsItemEnabled( TBI_PREVIOUS ) )
+                pNavigatorWin->maToolbox->EnableItem( TBI_PREVIOUS );
             if( nState & NAVBTN_PREV_DISABLED &&
-                pNavigatorWin->maToolbox.IsItemEnabled( TBI_PREVIOUS ) )
-                pNavigatorWin->maToolbox.EnableItem( TBI_PREVIOUS, false );
+                pNavigatorWin->maToolbox->IsItemEnabled( TBI_PREVIOUS ) )
+                pNavigatorWin->maToolbox->EnableItem( TBI_PREVIOUS, false );
 
             // Last
             if( nState & NAVBTN_LAST_ENABLED &&
-                !pNavigatorWin->maToolbox.IsItemEnabled( TBI_LAST ) )
-                pNavigatorWin->maToolbox.EnableItem( TBI_LAST );
+                !pNavigatorWin->maToolbox->IsItemEnabled( TBI_LAST ) )
+                pNavigatorWin->maToolbox->EnableItem( TBI_LAST );
             if( nState & NAVBTN_LAST_DISABLED &&
-                pNavigatorWin->maToolbox.IsItemEnabled( TBI_LAST ) )
-                pNavigatorWin->maToolbox.EnableItem( TBI_LAST, false );
+                pNavigatorWin->maToolbox->IsItemEnabled( TBI_LAST ) )
+                pNavigatorWin->maToolbox->EnableItem( TBI_LAST, false );
 
             // Next
             if( nState & NAVBTN_NEXT_ENABLED &&
-                !pNavigatorWin->maToolbox.IsItemEnabled( TBI_NEXT ) )
-                pNavigatorWin->maToolbox.EnableItem( TBI_NEXT );
+                !pNavigatorWin->maToolbox->IsItemEnabled( TBI_NEXT ) )
+                pNavigatorWin->maToolbox->EnableItem( TBI_NEXT );
             if( nState & NAVBTN_NEXT_DISABLED &&
-                pNavigatorWin->maToolbox.IsItemEnabled( TBI_NEXT ) )
-                pNavigatorWin->maToolbox.EnableItem( TBI_NEXT, false );
+                pNavigatorWin->maToolbox->IsItemEnabled( TBI_NEXT ) )
+                pNavigatorWin->maToolbox->EnableItem( TBI_NEXT, false );
 
             if( nState & NAVTLB_UPDATE )
             {
@@ -956,14 +965,14 @@ void SdPageNameControllerItem::StateChanged( sal_uInt16 nSId,
             DBG_ASSERT( pStateItem, "SfxStringItem expected");
             OUString aPageName = pStateItem->GetValue();
 
-            if( !pNavigatorWin->maTlbObjects.HasSelectedChildren( aPageName ) )
+            if( !pNavigatorWin->maTlbObjects->HasSelectedChildren( aPageName ) )
             {
-                if( pNavigatorWin->maTlbObjects.GetSelectionMode() == MULTIPLE_SELECTION )
+                if( pNavigatorWin->maTlbObjects->GetSelectionMode() == MULTIPLE_SELECTION )
                 {
                     // because otherwise it is always additional select
-                    pNavigatorWin->maTlbObjects.SelectAll( false );
+                    pNavigatorWin->maTlbObjects->SelectAll( false );
                 }
-                pNavigatorWin->maTlbObjects.SelectEntry( aPageName );
+                pNavigatorWin->maTlbObjects->SelectEntry( aPageName );
             }
         }
     }
diff --git a/sd/source/ui/dlg/prltempl.cxx b/sd/source/ui/dlg/prltempl.cxx
index e2330f9..0d8520b 100644
--- a/sd/source/ui/dlg/prltempl.cxx
+++ b/sd/source/ui/dlg/prltempl.cxx
@@ -223,7 +223,13 @@ SdPresLayoutTemplateDlg::SdPresLayoutTemplateDlg( SfxObjectShell* pDocSh,
 
 SdPresLayoutTemplateDlg::~SdPresLayoutTemplateDlg()
 {
+    dispose();
+}
+
+void SdPresLayoutTemplateDlg::dispose()
+{
     delete pOutSet;
+    SfxTabDialog::dispose();
 }
 
 void SdPresLayoutTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 12c2bcb..4b8d11f 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -255,11 +255,17 @@ SdPageObjsTLB::SdPageObjsTLB( vcl::Window* pParentWin, WinBits nStyle )
 
 SdPageObjsTLB::~SdPageObjsTLB()
 {
+    dispose();
+}
+
+void SdPageObjsTLB::dispose()
+{
     if ( mpBookmarkDoc )
         CloseBookmarkDoc();
     else
         // no document was created from mpMedium, so this object is still the owner of it
         delete mpMedium;
+    SvTreeListBox::dispose();
 }
 
 // helper function for  GetEntryAltText and GetEntryLongDescription
diff --git a/sd/source/ui/inc/BreakDlg.hxx b/sd/source/ui/inc/BreakDlg.hxx
index bddf639..13aab79 100644
--- a/sd/source/ui/inc/BreakDlg.hxx
+++ b/sd/source/ui/inc/BreakDlg.hxx
@@ -53,6 +53,7 @@ public:
         sal_uLong nSumActionCount,
         sal_uLong nObjCount);
     virtual ~BreakDlg();
+    virtual void dispose() SAL_OVERRIDE;
 
     short Execute() SAL_OVERRIDE;
 
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index 1eb4498..75be3ef 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -279,7 +279,7 @@ public:
     void            UnlockInput();
     bool            IsInputLocked() const { return mnLockCount > 0UL; }
 
-    sal_uInt16          GetCurPageId() { return( maTabControl.GetCurPageId() ); }
+    sal_uInt16          GetCurPageId() { return maTabControl->GetCurPageId(); }
 
     /** Show controls of the UI or hide them, depending on the given flag.
         Do not call this method directly.  Call the method at ViewShellBase
@@ -345,7 +345,7 @@ public:
 
     /** Return a pointer to the tab control for pages.
     */
-    TabControl& GetPageTabControl (void) { return maTabControl;}
+    TabControl& GetPageTabControl() { return *maTabControl.get(); }
 
     /** Return a pointer to the tab control for layers.
     */
@@ -384,7 +384,7 @@ protected:
     Rectangle       maMarkRect;
     Point           maMousePos;
     bool            mbMousePosFreezed;
-    TabControl      maTabControl;
+    VclPtr<TabControl>  maTabControl;
     EditMode        meEditMode;
     PageKind        mePageKind;
     bool            mbZoomOnPage;
diff --git a/sd/source/ui/inc/OutlineBulletDlg.hxx b/sd/source/ui/inc/OutlineBulletDlg.hxx
index 19ae1f8..5a88788 100644
--- a/sd/source/ui/inc/OutlineBulletDlg.hxx
+++ b/sd/source/ui/inc/OutlineBulletDlg.hxx
@@ -38,6 +38,7 @@ public:
         const SfxItemSet* pAttr,
         ::sd::View* pView );
     virtual ~OutlineBulletDlg ();
+    virtual void dispose() SAL_OVERRIDE;
 
     const SfxItemSet* GetOutputItemSet() const;
 
diff --git a/sd/source/ui/inc/Ruler.hxx b/sd/source/ui/inc/Ruler.hxx
index 956585e..5ca7057 100644
--- a/sd/source/ui/inc/Ruler.hxx
+++ b/sd/source/ui/inc/Ruler.hxx
@@ -41,6 +41,7 @@ public:
         SfxBindings& rBindings,
         WinBits nWinStyle);
     virtual ~Ruler (void);
+    virtual void dispose() SAL_OVERRIDE;
 
     void SetNullOffset(const Point& rOffset);
 
diff --git a/sd/source/ui/inc/Window.hxx b/sd/source/ui/inc/Window.hxx
index dca72fb..9e81c76 100644
--- a/sd/source/ui/inc/Window.hxx
+++ b/sd/source/ui/inc/Window.hxx
@@ -46,6 +46,7 @@ class Window
 public:
     Window (vcl::Window* pParent);
     virtual ~Window (void);
+    virtual void dispose() SAL_OVERRIDE;
 
     void    SetViewShell (ViewShell* pViewSh);
 
diff --git a/sd/source/ui/inc/animobjs.hxx b/sd/source/ui/inc/animobjs.hxx
index 45a9a3e..24ec9e8 100644
--- a/sd/source/ui/inc/animobjs.hxx
+++ b/sd/source/ui/inc/animobjs.hxx
@@ -85,6 +85,7 @@ class AnimationWindow : public SfxDockingWindow
 public:
     AnimationWindow(SfxBindings* pBindings, SfxChildWindow *pCW, vcl::Window* pParent);
     virtual ~AnimationWindow();
+    virtual void dispose() SAL_OVERRIDE;
 
     void    AddObj( ::sd::View& rView );
     void    CreateAnimObj( ::sd::View& rView );
diff --git a/sd/source/ui/inc/copydlg.hxx b/sd/source/ui/inc/copydlg.hxx
index 7a9d696..e0d1237 100644
--- a/sd/source/ui/inc/copydlg.hxx
+++ b/sd/source/ui/inc/copydlg.hxx
@@ -42,6 +42,7 @@ public:
     CopyDlg( vcl::Window* pWindow, const SfxItemSet& rInAttrs,
         const XColorListRef &pColList, ::sd::View* pView );
     virtual ~CopyDlg();
+    virtual void dispose() SAL_OVERRIDE;
 
     void    GetAttr( SfxItemSet& rOutAttrs );
     void Reset();
diff --git a/sd/source/ui/inc/dlgass.hxx b/sd/source/ui/inc/dlgass.hxx
index 4ee19ec..b9f9136 100644
--- a/sd/source/ui/inc/dlgass.hxx
+++ b/sd/source/ui/inc/dlgass.hxx
@@ -43,6 +43,7 @@ private:
 public:
     AssistentDlg(vcl::Window* pParent, bool bAutoPilot);
     virtual ~AssistentDlg();
+    virtual void dispose() SAL_OVERRIDE;
 
     DECL_LINK( FinishHdl, void * );
 
diff --git a/sd/source/ui/inc/dlgctrls.hxx b/sd/source/ui/inc/dlgctrls.hxx
index daa1ad2..5cb9058 100644
--- a/sd/source/ui/inc/dlgctrls.hxx
+++ b/sd/source/ui/inc/dlgctrls.hxx
@@ -37,7 +37,8 @@ class SD_DLLPUBLIC FadeEffectLB : public ListBox
 public:
     FadeEffectLB(vcl::Window* pParent, WinBits nStyle);
     virtual ~FadeEffectLB();
-    void                        Fill();
+    virtual void dispose() SAL_OVERRIDE;
+    void         Fill();
 
 /*  void                        selectEffectFromPage( SdPage* pPage ); */
     void                        applySelected( SdPage* pSlide ) const;
diff --git a/sd/source/ui/inc/docprev.hxx b/sd/source/ui/inc/docprev.hxx
index b4d3b28..ea1e587 100644
--- a/sd/source/ui/inc/docprev.hxx
+++ b/sd/source/ui/inc/docprev.hxx
@@ -65,6 +65,7 @@ protected:
 public:
                     SdDocPreviewWin( vcl::Window* pParent, const WinBits nStyle );
                     virtual ~SdDocPreviewWin();
+    virtual void    dispose() SAL_OVERRIDE;
     void            SetObjectShell( SfxObjectShell* pObj, sal_uInt16 nShowPage = 0 );
     virtual void    Resize() SAL_OVERRIDE;
     void            startPreview();
diff --git a/sd/source/ui/inc/headerfooterdlg.hxx b/sd/source/ui/inc/headerfooterdlg.hxx
index 6f19a55..558e648 100644
--- a/sd/source/ui/inc/headerfooterdlg.hxx
+++ b/sd/source/ui/inc/headerfooterdlg.hxx
@@ -69,6 +69,7 @@ private:
 public:
     HeaderFooterDialog( ViewShell* pViewShell, vcl::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage );
     virtual ~HeaderFooterDialog();
+    virtual void dispose() SAL_OVERRIDE;
 
     void ApplyToAll();
     void Apply();
diff --git a/sd/source/ui/inc/navigatr.hxx b/sd/source/ui/inc/navigatr.hxx
index fa388da..9665414 100644
--- a/sd/source/ui/inc/navigatr.hxx
+++ b/sd/source/ui/inc/navigatr.hxx
@@ -98,6 +98,7 @@ public:
         SfxBindings* pBindings,
         const UpdateRequestFunctor& rUpdateRequest);
     virtual ~SdNavigatorWin();
+    virtual void                dispose() SAL_OVERRIDE;
 
     virtual void                KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
 
@@ -118,9 +119,9 @@ private:
     friend class SdNavigatorControllerItem;
     friend class SdPageNameControllerItem;
 
-    ToolBox                     maToolbox;
-    SdPageObjsTLB               maTlbObjects;
-    ListBox                     maLbDocs;
+    VclPtr<ToolBox>             maToolbox;
+    VclPtr<SdPageObjsTLB>       maTlbObjects;
+    VclPtr<ListBox>             maLbDocs;
 
     ::sd::NavigatorChildWindow*     mpChildWinContext;
     Size                        maSize;
diff --git a/sd/source/ui/inc/prltempl.hxx b/sd/source/ui/inc/prltempl.hxx
index 71c6c3f..a4e5cca 100644
--- a/sd/source/ui/inc/prltempl.hxx
+++ b/sd/source/ui/inc/prltempl.hxx
@@ -86,6 +86,7 @@ private:
 public:
     SdPresLayoutTemplateDlg( SfxObjectShell* pDocSh, vcl::Window* pParent, SdResId DlgId, SfxStyleSheetBase& rStyleBase, PresentationObjects ePO, SfxStyleSheetBasePool* pSSPool );
     virtual ~SdPresLayoutTemplateDlg();
+    virtual void dispose() SAL_OVERRIDE;
 
     const SfxItemSet* GetOutputItemSet() const;
 };
diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx
index 1d2a5bb..6e68385 100644
--- a/sd/source/ui/inc/sdtreelb.hxx
+++ b/sd/source/ui/inc/sdtreelb.hxx
@@ -187,6 +187,7 @@ public:
     SdPageObjsTLB( vcl::Window* pParent, const SdResId& rSdResId );
     SdPageObjsTLB( vcl::Window* pParent, WinBits nStyle );
                             virtual ~SdPageObjsTLB();
+    virtual void      dispose() SAL_OVERRIDE;
 
    // helper function for   GetEntryAltText and GetEntryLongDescription
     OUString          getAltLongDescText( SvTreeListEntry* pEntry , bool isAltText) const;
diff --git a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx
index 5e01b5f..cb77dd3 100644
--- a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx
+++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx
@@ -91,6 +91,11 @@ CurrentMasterPagesSelector::CurrentMasterPagesSelector (
 
 CurrentMasterPagesSelector::~CurrentMasterPagesSelector (void)
 {
+    dispose();
+}
+
+void CurrentMasterPagesSelector::dispose()
+{
     if (mrDocument.GetDocSh() != NULL)
     {
         EndListening(*mrDocument.GetDocSh());
@@ -102,6 +107,8 @@ CurrentMasterPagesSelector::~CurrentMasterPagesSelector (void)
 
     Link aLink (LINK(this,CurrentMasterPagesSelector,EventMultiplexerListener));
     mrBase.GetEventMultiplexer()->RemoveEventListener(aLink);
+
+    MasterPagesSelector::dispose();
 }
 
 void CurrentMasterPagesSelector::LateInit (void)
diff --git a/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx
index e5c2932..e1d2bb2 100644
--- a/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx
+++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx
@@ -68,6 +68,7 @@ private:
         const ::boost::shared_ptr<MasterPageContainer>& rpContainer,
         const css::uno::Reference<css::ui::XSidebar>& rxSidebar);
     virtual ~CurrentMasterPagesSelector (void);
+    virtual void dispose() SAL_OVERRIDE;
 
     virtual void LateInit (void) SAL_OVERRIDE;
 
diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx
index b421ac0..800943c 100644
--- a/sd/source/ui/sidebar/LayoutMenu.cxx
+++ b/sd/source/ui/sidebar/LayoutMenu.cxx
@@ -194,8 +194,14 @@ void LayoutMenu::implConstruct( DrawDocShell& rDocumentShell )
 
 LayoutMenu::~LayoutMenu (void)
 {
+    dispose();
+}
+
+void LayoutMenu::dispose()
+{
     SAL_INFO("sd.ui", "destroying LayoutMenu at " << this);
     Dispose();
+    ValueSet::dispose();
 }
 
 void LayoutMenu::Dispose (void)
diff --git a/sd/source/ui/sidebar/LayoutMenu.hxx b/sd/source/ui/sidebar/LayoutMenu.hxx
index 7eb77fc..c0fd975 100644
--- a/sd/source/ui/sidebar/LayoutMenu.hxx
+++ b/sd/source/ui/sidebar/LayoutMenu.hxx
@@ -73,6 +73,7 @@ public:
         ViewShellBase& rViewShellBase,
         const css::uno::Reference<css::ui::XSidebar>& rxSidebar);
     virtual ~LayoutMenu (void);
+    virtual void dispose() SAL_OVERRIDE;
 
     void Dispose (void);
 
diff --git a/sd/source/ui/sidebar/MasterPagesSelector.cxx b/sd/source/ui/sidebar/MasterPagesSelector.cxx
index 6a0e7b3..154f742 100644
--- a/sd/source/ui/sidebar/MasterPagesSelector.cxx
+++ b/sd/source/ui/sidebar/MasterPagesSelector.cxx
@@ -104,11 +104,17 @@ MasterPagesSelector::MasterPagesSelector (
 
 MasterPagesSelector::~MasterPagesSelector (void)
 {
+    dispose();
+}
+
+void MasterPagesSelector::dispose()
+{
     Clear();
     UpdateLocks(ItemList());
 
     Link aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener));
     mpContainer->RemoveChangeListener(aChangeListener);
+    PreviewValueSet::dispose();
 }
 
 void MasterPagesSelector::LateInit (void)
diff --git a/sd/source/ui/sidebar/MasterPagesSelector.hxx b/sd/source/ui/sidebar/MasterPagesSelector.hxx
index 46e6f72..7c642d8 100644
--- a/sd/source/ui/sidebar/MasterPagesSelector.hxx
+++ b/sd/source/ui/sidebar/MasterPagesSelector.hxx
@@ -63,6 +63,7 @@ public:
         const ::boost::shared_ptr<MasterPageContainer>& rpContainer,
         const css::uno::Reference<css::ui::XSidebar>& rxSidebar);
     virtual ~MasterPagesSelector (void);
+    virtual void dispose() SAL_OVERRIDE;
 
     virtual void LateInit (void);
 
diff --git a/sd/source/ui/sidebar/NavigatorWrapper.cxx b/sd/source/ui/sidebar/NavigatorWrapper.cxx
index 3197ffc..276d8d8 100644
--- a/sd/source/ui/sidebar/NavigatorWrapper.cxx
+++ b/sd/source/ui/sidebar/NavigatorWrapper.cxx
@@ -33,27 +33,34 @@ NavigatorWrapper::NavigatorWrapper (
     SfxBindings* pBindings)
     : Control(pParent, 0),
       mrViewShellBase(rViewShellBase),
-      maNavigator(
+      maNavigator(new SdNavigatorWin(
         this,
         NULL,
         SdResId(FLT_NAVIGATOR),
         pBindings,
-        ::boost::bind(&NavigatorWrapper::UpdateNavigator, this))
+        ::boost::bind(&NavigatorWrapper::UpdateNavigator, this)))
 {
-    maNavigator.SetPosSizePixel(
+    maNavigator->SetPosSizePixel(
         Point(0,0),
         GetSizePixel());
-    maNavigator.SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground));
-    maNavigator.Show();
+    maNavigator->SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground));
+    maNavigator->Show();
 }
 
 NavigatorWrapper::~NavigatorWrapper (void)
 {
+    dispose();
+}
+
+void NavigatorWrapper::dispose()
+{
+    maNavigator.disposeAndClear();
+    Control::dispose();
 }
 
 void NavigatorWrapper::Resize (void)
 {
-    maNavigator.SetSizePixel(GetSizePixel());
+    maNavigator->SetSizePixel(GetSizePixel());
 }
 
 css::ui::LayoutSize NavigatorWrapper::GetHeightForWidth (const sal_Int32 nWidth)
@@ -65,12 +72,12 @@ css::ui::LayoutSize NavigatorWrapper::GetHeightForWidth (const sal_Int32 nWidth)
 
 void NavigatorWrapper::UpdateNavigator (void)
 {
-    maNavigator.InitTreeLB(mrViewShellBase.GetDocument());
+    maNavigator->InitTreeLB(mrViewShellBase.GetDocument());
 }
 
 void NavigatorWrapper::GetFocus (void)
 {
-    maNavigator.GrabFocus();
+    maNavigator->GrabFocus();
 }
 
 } } // end of namespace sd::sidebar
diff --git a/sd/source/ui/sidebar/NavigatorWrapper.hxx b/sd/source/ui/sidebar/NavigatorWrapper.hxx
index edc258f..b56ef22 100644
--- a/sd/source/ui/sidebar/NavigatorWrapper.hxx
+++ b/sd/source/ui/sidebar/NavigatorWrapper.hxx
@@ -46,6 +46,7 @@ public:
         SfxBindings* pBindings);
 
     virtual ~NavigatorWrapper (void);
+    virtual void dispose() SAL_OVERRIDE;
 
     // Control
     virtual void Resize (void) SAL_OVERRIDE;
@@ -56,7 +57,7 @@ public:
 
 private:
     ViewShellBase& mrViewShellBase;
-    SdNavigatorWin maNavigator;
+    VclPtr<SdNavigatorWin> maNavigator;
 
     void UpdateNavigator (void);
 };
diff --git a/sd/source/ui/sidebar/PanelBase.cxx b/sd/source/ui/sidebar/PanelBase.cxx
index 90c4a49..3fa7451 100644
--- a/sd/source/ui/sidebar/PanelBase.cxx
+++ b/sd/source/ui/sidebar/PanelBase.cxx
@@ -38,9 +38,15 @@ PanelBase::PanelBase (
 
 PanelBase::~PanelBase (void)
 {
+    dispose();
+}
+
+void PanelBase::dispose()
+{
     OSL_TRACE("deleting wrapped control at %p", mpWrappedControl.get());
     mpWrappedControl.reset();
     OSL_TRACE("deleting PanelBase at %p from parent %p", this, GetParent());
+    Control::dispose();
 }
 
 void PanelBase::Dispose (void)
diff --git a/sd/source/ui/sidebar/PanelBase.hxx b/sd/source/ui/sidebar/PanelBase.hxx
index 672112f..d14940f 100644
--- a/sd/source/ui/sidebar/PanelBase.hxx
+++ b/sd/source/ui/sidebar/PanelBase.hxx
@@ -45,6 +45,7 @@ public:
         vcl::Window* pParentWindow,
         ViewShellBase& rViewShellBase);
     virtual ~PanelBase (void);
+    virtual void dispose() SAL_OVERRIDE;
 
     virtual void Resize (void) SAL_OVERRIDE;
 
diff --git a/sd/source/ui/slideshow/showwin.cxx b/sd/source/ui/slideshow/showwin.cxx
index db00687..7575734 100644
--- a/sd/source/ui/slideshow/showwin.cxx
+++ b/sd/source/ui/slideshow/showwin.cxx
@@ -79,8 +79,14 @@ ShowWindow::ShowWindow( const ::rtl::Reference< SlideshowImpl >& xController, vc
 
 ShowWindow::~ShowWindow(void)
 {
+    dispose();
+}
+
+void ShowWindow::dispose()
+{
     maPauseTimer.Stop();
     maMouseTimer.Stop();
+    ::sd::Window::dispose();
 }
 
 void ShowWindow::KeyInput(const KeyEvent& rKEvt)
diff --git a/sd/source/ui/slideshow/showwindow.hxx b/sd/source/ui/slideshow/showwindow.hxx
index b55876a..6814c20 100644
--- a/sd/source/ui/slideshow/showwindow.hxx
+++ b/sd/source/ui/slideshow/showwindow.hxx
@@ -51,6 +51,7 @@ class ShowWindow
 public:
     ShowWindow ( const ::rtl::Reference< ::sd::SlideshowImpl >& xController, vcl::Window* pParent );
     virtual ~ShowWindow (void);
+    virtual void dispose() SAL_OVERRIDE;
 
     bool         SetEndMode();
     bool            SetPauseMode( sal_Int32 nPageIndexToRestart, sal_Int32 nTimeoutSec = SLIDE_NO_TIMEOUT, Graphic* pLogo = NULL );
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index 1f17591..c0ab66f 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -204,6 +204,7 @@ class FocusForwardingWindow : public vcl::Window
 public:
     FocusForwardingWindow (vcl::Window& rParentWindow, ViewShellBase& rBase);
     virtual ~FocusForwardingWindow (void);
+    virtual void dispose() SAL_OVERRIDE;
     virtual void KeyInput (const KeyEvent& rEvent) SAL_OVERRIDE;
     virtual void Command (const CommandEvent& rEvent) SAL_OVERRIDE;
 
@@ -1385,7 +1386,13 @@ FocusForwardingWindow::FocusForwardingWindow (
 
 FocusForwardingWindow::~FocusForwardingWindow (void)
 {
+    dispose();
+}
+
+void FocusForwardingWindow::dispose()
+{
     SAL_INFO("sd.view", "destroyed FocusForwardingWindow at " << this);
+    vcl::Window::dispose();
 }
 
 void FocusForwardingWindow::KeyInput (const KeyEvent& rKEvt)
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index 606fae6..74c2a96 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -105,7 +105,7 @@ void DrawViewShell::UIActivating( SfxInPlaceClient* pCli )
     ViewShell::UIActivating(pCli);
 
     // Disable own controls
-    maTabControl.Disable();
+    maTabControl->Disable();
     if (GetLayerTabControl() != NULL)
         GetLayerTabControl()->Disable();
 }
@@ -113,7 +113,7 @@ void DrawViewShell::UIActivating( SfxInPlaceClient* pCli )
 void DrawViewShell::UIDeactivated( SfxInPlaceClient* pCli )
 {
     // Enable own controls
-    maTabControl.Enable();
+    maTabControl->Enable();
     if (GetLayerTabControl() != NULL)
         GetLayerTabControl()->Enable();
 
@@ -339,7 +339,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
         LayerTabBar* pLayerBar = GetLayerTabControl();
         if (pLayerBar != NULL)
             pLayerBar->EndEditMode();
-        maTabControl.EndEditMode();
+        maTabControl->EndEditMode();
 
         if (mePageKind == PK_HANDOUT)
         {
@@ -379,7 +379,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
             * PAGEMODE
             ******************************************************************/
 
-            maTabControl.Clear();
+            maTabControl->Clear();
 
             SdPage* pPage;
             sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
@@ -388,7 +388,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
             {
                 pPage = GetDoc()->GetSdPage(i, mePageKind);
                 OUString aPageName = pPage->GetName();
-                maTabControl.InsertPage(i + 1, aPageName);
+                maTabControl->InsertPage(i + 1, aPageName);
 
                 if ( pPage->IsSelected() && nActualPageNum == 0 )
                 {
@@ -396,7 +396,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
                 }
             }
 
-            maTabControl.SetCurPageId(nActualPageNum + 1);
+            maTabControl->SetCurPageId(nActualPageNum + 1);
 
             SwitchPage(nActualPageNum);
         }
@@ -414,7 +414,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
                 mpActualPage = GetDoc()->GetSdPage(0, mePageKind);
             }
 
-            maTabControl.Clear();
+            maTabControl->Clear();
             sal_uInt16 nActualMasterPageNum = 0;
             sal_uInt16 nMasterPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
 
@@ -426,7 +426,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
                 if (nPos != -1)
                     aLayoutName = aLayoutName.copy(0, nPos);
 
-                maTabControl.InsertPage(i + 1, aLayoutName);
+                maTabControl->InsertPage(i + 1, aLayoutName);
 
                 if (&(mpActualPage->TRG_GetMasterPage()) == pMaster)
                 {
@@ -434,7 +434,7 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
                 }
             }
 
-            maTabControl.SetCurPageId(nActualMasterPageNum + 1);
+            maTabControl->SetCurPageId(nActualMasterPageNum + 1);
             SwitchPage(nActualMasterPageNum);
         }
 
@@ -451,11 +451,11 @@ void DrawViewShell::ChangeEditMode(EditMode eEMode, bool bIsLayerModeActive)
 
         if ( ! mbIsLayerModeActive)
         {
-            maTabControl.Show();
+            maTabControl->Show();
             // Set the tab control only for draw pages.  For master page
             // this has been done already above.
             if (meEditMode == EM_PAGE)
-                maTabControl.SetCurPageId (nActualPageNum + 1);
+                maTabControl->SetCurPageId (nActualPageNum + 1);
         }
 
         ResetActualLayer();
@@ -590,19 +590,19 @@ void DrawViewShell::SetUIUnit(FieldUnit eUnit)
 IMPL_LINK( DrawViewShell, TabSplitHdl, TabBar *, pTab )
 {
     const long int nMax = maViewSize.Width() - maScrBarWH.Width()
-        - maTabControl.GetPosPixel().X() ;
+        - maTabControl->GetPosPixel().X() ;
 
-    Size aTabSize = maTabControl.GetSizePixel();
+    Size aTabSize = maTabControl->GetSizePixel();
     aTabSize.Width() = std::min(pTab->GetSplitSize(), (long)(nMax-1));
 
-    maTabControl.SetSizePixel(aTabSize);
+    maTabControl->SetSizePixel(aTabSize);
 
     if(GetLayerTabControl()) // #i87182#
     {
         GetLayerTabControl()->SetSizePixel(aTabSize);
     }
 
-    Point aPos = maTabControl.GetPosPixel();
+    Point aPos = maTabControl->GetPosPixel();
     aPos.X() += aTabSize.Width();
 
     Size aScrSize(nMax - aTabSize.Width(), maScrBarWH.Height());
@@ -618,7 +618,7 @@ SdPage* DrawViewShell::getCurrentPage() const
                                     GetDoc()->GetSdPageCount(mePageKind):
                                     GetDoc()->GetMasterSdPageCount(mePageKind);
 
-    sal_Int32 nCurrentPage = maTabControl.GetCurPageId() - 1;
+    sal_Int32 nCurrentPage = maTabControl->GetCurPageId() - 1;
     DBG_ASSERT( (nPageCount>0) && (nCurrentPage<nPageCount), "sd::DrawViewShell::getCurrentPage(), illegal page index!" );
     if( (nPageCount < 0) || (nCurrentPage>=nPageCount) )
         nCurrentPage = 0; // play safe here
@@ -642,7 +642,7 @@ void DrawViewShell::ResetActualPage()
     if (!GetDoc())
         return;
 
-    sal_uInt16 nCurrentPage = maTabControl.GetCurPageId() - 1;
+    sal_uInt16 nCurrentPage = maTabControl->GetCurPageId() - 1;
     sal_uInt16 nPageCount   = (meEditMode == EM_PAGE)?GetDoc()->GetSdPageCount(mePageKind):GetDoc()->GetMasterSdPageCount(mePageKind);
     if (nPageCount > 0)
         nCurrentPage = std::min((sal_uInt16)(nPageCount - 1), nCurrentPage);
@@ -653,7 +653,7 @@ void DrawViewShell::ResetActualPage()
     {
 
         // Update for TabControl
-        maTabControl.Clear();
+        maTabControl->Clear();
 
         SdPage* pPage = NULL;
 
@@ -661,18 +661,18 @@ void DrawViewShell::ResetActualPage()
         {
             pPage = GetDoc()->GetSdPage(i, mePageKind);
             OUString aPageName = pPage->GetName();
-            maTabControl.InsertPage(i + 1, aPageName);
+            maTabControl->InsertPage(i + 1, aPageName);
 
             // correct selection recognition of the pages
             GetDoc()->SetSelected(pPage, i == nCurrentPage);
         }
 
-        maTabControl.SetCurPageId(nCurrentPage + 1);
+        maTabControl->SetCurPageId(nCurrentPage + 1);
     }
     else // EM_MASTERPAGE
     {
         SdPage* pActualPage = GetDoc()->GetMasterSdPage(nCurrentPage, mePageKind);
-        maTabControl.Clear();
+        maTabControl->Clear();
         sal_uInt16 nActualMasterPageNum = 0;
 
         sal_uInt16 nMasterPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
@@ -683,13 +683,13 @@ void DrawViewShell::ResetActualPage()
             sal_Int32 nPos = aLayoutName.indexOf(SD_LT_SEPARATOR);
             if (nPos != -1)
                 aLayoutName = aLayoutName.copy(0, nPos);
-            maTabControl.InsertPage(i + 1, aLayoutName);
+            maTabControl->InsertPage(i + 1, aLayoutName);
 
             if (pActualPage == pMaster)
                 nActualMasterPageNum = i;
         }
 
-        maTabControl.SetCurPageId(nActualMasterPageNum + 1);
+        maTabControl->SetCurPageId(nActualMasterPageNum + 1);
         SwitchPage(nActualMasterPageNum);
     }
 
@@ -828,7 +828,7 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage)
                         sPageText = sPageText.copy(0, nPos);
                     if (pPV
                         && pNewPage == dynamic_cast< SdPage* >( pPV->GetPage() )
-                        && sPageText == maTabControl.GetPageText(nSelectedPage+1))
+                        && sPageText == maTabControl->GetPageText(nSelectedPage+1))
                     {
                         // this slide is already visible
                         return true;
@@ -850,7 +850,7 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage)
                     SdPage* pCurrentPage = pPV ? dynamic_cast<SdPage*>(pPV->GetPage()) : NULL;
                     if (pCurrentPage
                         && pNewPage == pCurrentPage
-                        && maTabControl.GetPageText(nSelectedPage+1).equals(pNewPage->GetName()))
+                        && maTabControl->GetPageText(nSelectedPage+1).equals(pNewPage->GetName()))
                     {
                         // this slide is already visible
                         return true;
@@ -979,12 +979,12 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage)
                 }
             }
 
-            maTabControl.SetCurPageId(nSelectedPage+1);
+            maTabControl->SetCurPageId(nSelectedPage+1);
             OUString aPageName = mpActualPage->GetName();
 
-            if (maTabControl.GetPageText(nSelectedPage+1) != aPageName)
+            if (maTabControl->GetPageText(nSelectedPage+1) != aPageName)
             {
-                maTabControl.SetPageText(nSelectedPage+1, aPageName);
+                maTabControl->SetPageText(nSelectedPage+1, aPageName);
             }
         }
         else
@@ -1053,11 +1053,11 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage)
             if (nPos != -1)
                 aLayoutName = aLayoutName.copy(0, nPos);
 
-            maTabControl.SetCurPageId(nSelectedPage+1);
+            maTabControl->SetCurPageId(nSelectedPage+1);
 
-            if (maTabControl.GetPageText(nSelectedPage+1) != aLayoutName)
+            if (maTabControl->GetPageText(nSelectedPage+1) != aLayoutName)
             {
-                maTabControl.SetPageText(nSelectedPage+1, aLayoutName);
+                maTabControl->SetPageText(nSelectedPage+1, aLayoutName);
             }
 
             if( mePageKind == PK_HANDOUT )
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index c1b2096..c210857 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -373,7 +373,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
                 {
                     mpDrawView->SdrEndTextEdit();
                 }
-                sal_uInt16 nPage = maTabControl.GetCurPageId() - 1;
+                sal_uInt16 nPage = maTabControl->GetCurPageId() - 1;
                 mpActualPage = GetDoc()->GetSdPage(nPage, mePageKind);
                 ::sd::ViewShell::mpImpl->ProcessModifyPageSlot (
                     rReq,
@@ -410,7 +410,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
                     mpDrawView->SdrEndTextEdit();
                 }
 
-                sal_uInt16 nPageId = maTabControl.GetCurPageId();
+                sal_uInt16 nPageId = maTabControl->GetCurPageId();
                 SdPage* pCurrentPage = ( GetEditMode() == EM_PAGE )
                     ? GetDoc()->GetSdPage( nPageId - 1, GetPageKind() )
                     : GetDoc()->GetMasterSdPage( nPageId - 1, GetPageKind() );
@@ -456,7 +456,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
                     mpDrawView->SdrEndTextEdit();
                 }
 
-                maTabControl.StartEditMode( maTabControl.GetCurPageId() );
+                maTabControl->StartEditMode( maTabControl->GetCurPageId() );
             }
 
             Cancel();
diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx
index 56b6cad..31b4e4d 100644
--- a/sd/source/ui/view/drviews3.cxx
+++ b/sd/source/ui/view/drviews3.cxx
@@ -142,7 +142,7 @@ void  DrawViewShell::ExecCtrl(SfxRequest& rReq)
 
                 if (! pArgs)
                 {
-                    nSelectedPage = maTabControl.GetCurPageId() - 1;
+                    nSelectedPage = maTabControl->GetCurPageId() - 1;
                 }
                 else if (pArgs->Count () == 2)
                 {
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index a4bf08b..9a6b585 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -74,7 +74,7 @@ using namespace ::com::sun::star::drawing;
 
 void DrawViewShell::DeleteActualPage()
 {
-    sal_uInt16          nPage = maTabControl.GetCurPageId() - 1;
+    sal_uInt16          nPage = maTabControl->GetCurPageId() - 1;
 
     mpDrawView->SdrEndTextEdit();
 
diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx
index 8d9b045..092bff9 100644
--- a/sd/source/ui/view/drviews5.cxx
+++ b/sd/source/ui/view/drviews5.cxx
@@ -114,7 +114,7 @@ void DrawViewShell::ArrangeGUIElements (void)
 
     ViewShell::ArrangeGUIElements ();
 
-    maTabControl.Hide();
+    maTabControl->Hide();
 
     OSL_ASSERT (GetViewShell()!=NULL);
     Client* pIPClient = static_cast<Client*>(GetViewShell()->GetIPClient());
@@ -352,7 +352,7 @@ void DrawViewShell::WriteFrameViewData()
         mpFrameView->SetSelectedPage(0);
     else
     {
-        mpFrameView->SetSelectedPage( maTabControl.GetCurPageId() - 1 );
+        mpFrameView->SetSelectedPage( maTabControl->GetCurPageId() - 1 );
     }
 
     mpFrameView->SetViewShEditMode(meEditMode, mePageKind);
diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index 055dcd8..17adf69 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -912,7 +912,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet )
     if( SfxItemState::DEFAULT == rSet.GetItemState( SID_DELETE_PAGE )
         || SfxItemState::DEFAULT == rSet.GetItemState( SID_DELETE_MASTER_PAGE ) )
     {
-        if (maTabControl.GetPageCount() == 1 ||
+        if (maTabControl->GetPageCount() == 1 ||
             meEditMode == EM_MASTERPAGE     ||
             mePageKind == PK_NOTES          ||
             mePageKind == PK_HANDOUT        ||
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index d3421cb..2f08b03 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -109,7 +109,7 @@ void SAL_CALL ScannerEventListener::disposing( const lang::EventObject& rEventOb
 
 DrawViewShell::DrawViewShell( SfxViewFrame* pFrame, ViewShellBase& rViewShellBase, vcl::Window* pParentWindow, PageKind ePageKind, FrameView* pFrameViewArgument )
     : ViewShell (pFrame, pParentWindow, rViewShellBase)
-    , maTabControl(this, pParentWindow)
+    , maTabControl(new sd::TabControl(this, pParentWindow))
     , mbIsLayerModeActive(false)
     , mbIsInSwitchPage(false)
     , mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler(
@@ -288,7 +288,7 @@ void DrawViewShell::Construct(DrawDocShell* pDocSh, PageKind eInitialPageKind)
     GetDoc()->SetMaxObjSize(aSize);
 
     // Split-Handler for TabControls
-    maTabControl.SetSplitHdl( LINK( this, DrawViewShell, TabSplitHdl ) );
+    maTabControl->SetSplitHdl( LINK( this, DrawViewShell, TabSplitHdl ) );
 
     /* In order to set the correct EditMode of the FrameView, we select another
        one (small trick).  */
@@ -702,7 +702,7 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet)
         // Always show the slide/page number.
         OUString aOUString = SD_RESSTR(STR_SD_PAGE);
         aOUString += " ";
-        aOUString += OUString::number( maTabControl.GetCurPageId() );
+        aOUString += OUString::number( maTabControl->GetCurPageId() );
         aOUString += " / " ;
         aOUString += OUString::number( nPageCount );
         if (nPageCount != nActivePageCount)
diff --git a/sd/source/ui/view/drviewsb.cxx b/sd/source/ui/view/drviewsb.cxx
index c3485e7..03c5a49 100644
--- a/sd/source/ui/view/drviewsb.cxx
+++ b/sd/source/ui/view/drviewsb.cxx
@@ -114,7 +114,7 @@ bool DrawViewShell::RenameSlide( sal_uInt16 nPageId, const OUString & rName  )
     if( bSuccess )
     {
         // user edited page names may be changed by the page so update control
-        maTabControl.SetPageText( nPageId, rName );
+        maTabControl->SetPageText( nPageId, rName );
 
         // set document to modified state
         GetDoc()->SetChanged( true );
@@ -146,7 +146,7 @@ IMPL_LINK( DrawViewShell, RenameSlideHdl, AbstractSvxNameDialog*, pDialog )
     OUString aNewName;
     pDialog->GetName( aNewName );
 
-    SdPage* pCurrentPage = GetDoc()->GetSdPage( maTabControl.GetCurPageId() - 1, GetPageKind() );
+    SdPage* pCurrentPage = GetDoc()->GetSdPage( maTabControl->GetCurPageId() - 1, GetPageKind() );
 
     return long(pCurrentPage && ( aNewName == pCurrentPage->GetName() || GetDocSh()->IsNewPageNameValid( aNewName ) ));
 }
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index 96b7c65..402dbda 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -1721,7 +1721,7 @@ void DrawViewShell::InsertURLButton(const OUString& rURL, const OUString& rText,
 void DrawViewShell::ShowUIControls (bool bVisible)
 {
     ViewShell::ShowUIControls (bVisible);
-    maTabControl.Show (bVisible);
+    maTabControl->Show (bVisible);
 }
 
 namespace slideshowhelp
diff --git a/sd/source/ui/view/sdruler.cxx b/sd/source/ui/view/sdruler.cxx
index 2df8628..e459264 100644
--- a/sd/source/ui/view/sdruler.cxx
+++ b/sd/source/ui/view/sdruler.cxx
@@ -92,10 +92,16 @@ Ruler::Ruler( DrawViewShell& rViewSh, vcl::Window* pParent, ::sd::Window* pWin,
 
 Ruler::~Ruler()
 {
+    dispose();
+}
+
+void Ruler::dispose()
+{
     SfxBindings& rBindings = pCtrlItem->GetBindings();
     rBindings.EnterRegistrations();
     delete pCtrlItem;
     rBindings.LeaveRegistrations();
+    SvxRuler::dispose();
 }
 
 void Ruler::MouseButtonDown(const MouseEvent& rMEvt)
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index 8506ec0..a8e0fa3 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -94,12 +94,18 @@ Window::Window(vcl::Window* pParent)
 
 Window::~Window (void)
 {
+    dispose();
+}
+
+void Window::dispose()
+{
     if (mpViewShell != NULL)
     {
         WindowUpdater* pWindowUpdater = mpViewShell->GetWindowUpdater();
         if (pWindowUpdater != NULL)
             pWindowUpdater->UnregisterWindow (this);
     }
+    vcl::Window::dispose();
 }
 
 void Window::SetViewShell (ViewShell* pViewSh)
commit e10b12842eb15b3b9bf577b4da036313fa830786
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Jan 26 13:16:18 2015 +0200

    vcl: VclPtr conversion in sc
    
    Change-Id: I9cbc8beff7172c1ec69ae1124b16de0c0d722334
    
    Conflicts:
    	sc/source/ui/view/gridwin.cxx
    	sc/source/ui/view/tabview.cxx

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index a70b069..a5b8c88e 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -173,9 +173,9 @@ static ScTextWndBase* lcl_chooseRuntimeImpl( vcl::Window* pParent, SfxBindings*
 ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) :
         // With WB_CLIPCHILDREN otherwise we get flickering
         ToolBox         ( pParent, WinBits(WB_CLIPCHILDREN) ),
-        aWndPos         ( this ),
-        pRuntimeWindow ( lcl_chooseRuntimeImpl( this, pBind ) ),
-        aTextWindow    ( *pRuntimeWindow ),
+        aWndPos         ( new ScPosWnd(this) ),
+        pRuntimeWindow  ( lcl_chooseRuntimeImpl( this, pBind ) ),
+        aTextWindow     ( *pRuntimeWindow ),
         pInputHdl       ( NULL ),
         aTextOk         ( ScResId( SCSTR_QHELP_BTNOK ) ),       // Not always new as a Resource
         aTextCancel     ( ScResId( SCSTR_QHELP_BTNCANCEL ) ),
@@ -202,7 +202,7 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) :
     OSL_ENSURE( pViewSh, "no view shell for input window" );
 
     // Position window, 3 buttons, input window
-    InsertWindow    ( 1, &aWndPos, ToolBoxItemBits::NONE,                                     0 );
+    InsertWindow    ( 1, aWndPos.get(), ToolBoxItemBits::NONE,                                0 );
     InsertSeparator (                                                     1 );
     InsertItem      ( SID_INPUT_FUNCTION, IMAGE( SID_INPUT_FUNCTION ), ToolBoxItemBits::NONE, 2 );
     InsertItem      ( SID_INPUT_SUM,      IMAGE( SID_INPUT_SUM ), ToolBoxItemBits::NONE,      3 );
@@ -210,8 +210,8 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) :
     InsertSeparator (                                                     5 );
     InsertWindow    ( 7, &aTextWindow, ToolBoxItemBits::NONE,                                 6 );
 
-    aWndPos    .SetQuickHelpText( ScResId( SCSTR_QHELP_POSWND ) );
-    aWndPos    .SetHelpId       ( HID_INSWIN_POS );
+    aWndPos   ->SetQuickHelpText( ScResId( SCSTR_QHELP_POSWND ) );
+    aWndPos   ->SetHelpId       ( HID_INSWIN_POS );
     aTextWindow.SetQuickHelpText( ScResId( SCSTR_QHELP_INPUTWND ) );
     aTextWindow.SetHelpId       ( HID_INSWIN_INPUT );
 
@@ -227,7 +227,7 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) :
 
     SetHelpId( HID_SC_INPUTWIN ); // For the whole input row
 
-    aWndPos     .Show();
+    aWndPos   ->Show();
     aTextWindow.Show();
 
     pInputHdl = SC_MOD()->GetInputHdl( pViewSh, false ); // use own handler even if ref-handler is set
@@ -259,6 +259,11 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) :
 
 ScInputWindow::~ScInputWindow()
 {
+    dispose();
+}
+
+void ScInputWindow::dispose()
+{
     bool bDown = ( ScGlobal::pSysLocale == NULL ); // after Clear?
 
     //  if any view's input handler has a pointer to this input window, reset it
@@ -282,6 +287,9 @@ ScInputWindow::~ScInputWindow()
     }
 
     SfxImageManager::GetImageManager( *SC_MOD() )->ReleaseToolBox( this );
+
+    aWndPos.disposeAndClear();
+    ToolBox::dispose();
 }
 
 void ScInputWindow::SetInputHandler( ScInputHandler* pNew )
@@ -630,7 +638,7 @@ void ScInputWindow::SetFuncString( const OUString& rString, bool bDoEdit )
 
 void ScInputWindow::SetPosString( const OUString& rStr )
 {
-    aWndPos.SetPos( rStr );
+    aWndPos->SetPos( rStr );
 }
 
 void ScInputWindow::SetTextString( const OUString& rString )
@@ -690,7 +698,7 @@ void ScInputWindow::SetSumAssignMode()
 
 void ScInputWindow::SetFormulaMode( bool bSet )
 {
-    aWndPos.SetFormulaMode(bSet);
+    aWndPos->SetFormulaMode(bSet);
     aTextWindow.SetFormulaMode(bSet);
 }
 
@@ -755,7 +763,7 @@ void ScInputWindow::SwitchToTextWin()
 
 void ScInputWindow::PosGrabFocus()
 {
-    aWndPos.GrabFocus();
+    aWndPos->GrabFocus();
 }
 
 void ScInputWindow::EnableButtons( bool bEnable )
@@ -897,54 +905,62 @@ void ScInputWindow::MouseButtonUp( const MouseEvent& rMEvt )
 
 ScInputBarGroup::ScInputBarGroup(vcl::Window* pParent, ScTabViewShell* pViewSh)
     :   ScTextWndBase        ( pParent, WinBits(WB_HIDE |  WB_TABSTOP ) ),
-        aMultiTextWnd        ( this, pViewSh ),
-        aButton              ( this, WB_TABSTOP | WB_RECTSTYLE | WB_SMALLSTYLE ),
-        aScrollBar           ( this, WB_TABSTOP | WB_VERT | WB_DRAG ),
+        aMultiTextWnd        ( new ScMultiTextWnd(this, pViewSh) ),
+        aButton              ( new ImageButton(this, WB_TABSTOP | WB_RECTSTYLE | WB_SMALLSTYLE) ),
+        aScrollBar           ( new ScrollBar(this, WB_TABSTOP | WB_VERT | WB_DRAG) ),
         nVertOffset          ( 0 )
 {
-      aMultiTextWnd.Show();
-      aMultiTextWnd.SetQuickHelpText( ScResId( SCSTR_QHELP_INPUTWND ) );
-      aMultiTextWnd.SetHelpId( HID_INSWIN_INPUT );
+      aMultiTextWnd->Show();
+      aMultiTextWnd->SetQuickHelpText( ScResId( SCSTR_QHELP_INPUTWND ) );
+      aMultiTextWnd->SetHelpId( HID_INSWIN_INPUT );
 
-      Size aSize( GetSettings().GetStyleSettings().GetScrollBarSize(), aMultiTextWnd.GetPixelHeightForLines(1) );
+      Size aSize( GetSettings().GetStyleSettings().GetScrollBarSize(), aMultiTextWnd->GetPixelHeightForLines(1) );
 
-      aButton.SetClickHdl( LINK( this, ScInputBarGroup, ClickHdl ) );
-      aButton.SetSizePixel( aSize );
-      aButton.Enable();
-      aButton.SetSymbol( SymbolType::SPIN_DOWN  );
-      aButton.SetQuickHelpText( ScResId( SCSTR_QHELP_EXPAND_FORMULA ) );
-      aButton.Show();
+      aButton->SetClickHdl( LINK( this, ScInputBarGroup, ClickHdl ) );
+      aButton->SetSizePixel( aSize );
+      aButton->Enable();
+      aButton->SetSymbol( SymbolType::SPIN_DOWN  );
+      aButton->SetQuickHelpText( ScResId( SCSTR_QHELP_EXPAND_FORMULA ) );
+      aButton->Show();
 
-      aScrollBar.SetSizePixel( aSize );
-      aScrollBar.SetScrollHdl( LINK( this, ScInputBarGroup, Impl_ScrollHdl ) );
+      aScrollBar->SetSizePixel( aSize );
+      aScrollBar->SetScrollHdl( LINK( this, ScInputBarGroup, Impl_ScrollHdl ) );
 }
 
 ScInputBarGroup::~ScInputBarGroup()
 {
+    dispose();
+}
 
+void ScInputBarGroup::dispose()
+{
+    aMultiTextWnd.disposeAndClear();
+    aButton.disposeAndClear();
+    aScrollBar.disposeAndClear();
+    ScTextWndBase::dispose();
 }
 
 void
 ScInputBarGroup::InsertAccessibleTextData( ScAccessibleEditLineTextData& rTextData )
 {
-    aMultiTextWnd.InsertAccessibleTextData( rTextData );
+    aMultiTextWnd->InsertAccessibleTextData( rTextData );
 }
 
 void
 ScInputBarGroup::RemoveAccessibleTextData( ScAccessibleEditLineTextData& rTextData )
 {
-    aMultiTextWnd.RemoveAccessibleTextData( rTextData );
+    aMultiTextWnd->RemoveAccessibleTextData( rTextData );
 }
 
 const OUString&
 ScInputBarGroup::GetTextString() const
 {
-    return aMultiTextWnd.GetTextString();
+    return aMultiTextWnd->GetTextString();
 }
 
 void ScInputBarGroup::SetTextString( const OUString& rString )
 {
-    aMultiTextWnd.SetTextString(rString);
+    aMultiTextWnd->SetTextString(rString);
 }
 
 void ScInputBarGroup::Resize()
@@ -965,89 +981,89 @@ void ScInputBarGroup::Resize()
     Size aSize  = GetSizePixel();
     aSize.Width() = std::max( ((long)(nWidth - nLeft - LEFT_OFFSET)), (long)0 );
 
-    aScrollBar.SetPosPixel(Point( aSize.Width() - aButton.GetSizePixel().Width(), aButton.GetSizePixel().Height() ) );
+    aScrollBar->SetPosPixel(Point( aSize.Width() - aButton->GetSizePixel().Width(), aButton->GetSizePixel().Height() ) );
 
     Size aTmpSize( aSize );
-    aTmpSize.Width() = aTmpSize.Width() - aButton.GetSizePixel().Width() - BUTTON_OFFSET;
-    aMultiTextWnd.SetSizePixel(aTmpSize);
+    aTmpSize.Width() = aTmpSize.Width() - aButton->GetSizePixel().Width() - BUTTON_OFFSET;
+    aMultiTextWnd->SetSizePixel(aTmpSize);
 
-    aMultiTextWnd.Resize();
+    aMultiTextWnd->Resize();
 
-    aSize.Height() = aMultiTextWnd.GetSizePixel().Height();
+    aSize.Height() = aMultiTextWnd->GetSizePixel().Height();
 
     SetSizePixel(aSize);
 
-    if( aMultiTextWnd.GetNumLines() > 1 )
+    if( aMultiTextWnd->GetNumLines() > 1 )
     {
-        aButton.SetSymbol( SymbolType::SPIN_UP  );
-        aButton.SetQuickHelpText( ScResId( SCSTR_QHELP_COLLAPSE_FORMULA ) );
-        Size scrollSize = aButton.GetSizePixel();
-        scrollSize.Height() = aMultiTextWnd.GetSizePixel().Height() - aButton.GetSizePixel().Height();
-        aScrollBar.SetSizePixel( scrollSize );
+        aButton->SetSymbol( SymbolType::SPIN_UP  );
+        aButton->SetQuickHelpText( ScResId( SCSTR_QHELP_COLLAPSE_FORMULA ) );
+        Size scrollSize = aButton->GetSizePixel();
+        scrollSize.Height() = aMultiTextWnd->GetSizePixel().Height() - aButton->GetSizePixel().Height();
+        aScrollBar->SetSizePixel( scrollSize );
 
-        Size aOutSz = aMultiTextWnd.GetOutputSize();
+        Size aOutSz = aMultiTextWnd->GetOutputSize();
 
-        aScrollBar.SetVisibleSize( aOutSz.Height() );
-        aScrollBar.SetPageSize( aOutSz.Height() );
-        aScrollBar.SetLineSize( aMultiTextWnd.GetTextHeight() );
-        aScrollBar.SetRange( Range( 0, aMultiTextWnd.GetEditEngTxtHeight() ) );
+        aScrollBar->SetVisibleSize( aOutSz.Height() );
+        aScrollBar->SetPageSize( aOutSz.Height() );
+        aScrollBar->SetLineSize( aMultiTextWnd->GetTextHeight() );
+        aScrollBar->SetRange( Range( 0, aMultiTextWnd->GetEditEngTxtHeight() ) );
 
-        aScrollBar.Resize();
-        aScrollBar.Show();
+        aScrollBar->Resize();
+        aScrollBar->Show();
     }
     else
     {
-        aButton.SetSymbol( SymbolType::SPIN_DOWN  );
-        aButton.SetQuickHelpText( ScResId( SCSTR_QHELP_EXPAND_FORMULA ) );
-        aScrollBar.Hide();
+        aButton->SetSymbol( SymbolType::SPIN_DOWN  );
+        aButton->SetQuickHelpText( ScResId( SCSTR_QHELP_EXPAND_FORMULA ) );
+        aScrollBar->Hide();
     }
 
-    aButton.SetPosPixel(Point(aSize.Width() - aButton.GetSizePixel().Width(), 0));
+    aButton->SetPosPixel(Point(aSize.Width() - aButton->GetSizePixel().Width(), 0));
 
     Invalidate();
 }
 
 void ScInputBarGroup::StopEditEngine( bool bAll )
 {
-    aMultiTextWnd.StopEditEngine( bAll );
+    aMultiTextWnd->StopEditEngine( bAll );
 }
 
 void ScInputBarGroup::StartEditEngine()
 {
-    aMultiTextWnd.StartEditEngine();
+    aMultiTextWnd->StartEditEngine();
 }
 
 void ScInputBarGroup::MakeDialogEditView()
 {
-    aMultiTextWnd.MakeDialogEditView();
+    aMultiTextWnd->MakeDialogEditView();
 }
 
 EditView* ScInputBarGroup::GetEditView()
 {
-    return aMultiTextWnd.GetEditView();
+    return aMultiTextWnd->GetEditView();
 }
 
 bool ScInputBarGroup::IsInputActive()
 {
-    return aMultiTextWnd.IsInputActive();
+    return aMultiTextWnd->IsInputActive();
 }
 
 void ScInputBarGroup::SetFormulaMode(bool bSet)
 {
-    aMultiTextWnd.SetFormulaMode(bSet);
+    aMultiTextWnd->SetFormulaMode(bSet);
 }
 
 void ScInputBarGroup::IncrementVerticalSize()
 {
-    aMultiTextWnd.SetNumLines( aMultiTextWnd.GetNumLines() + 1 );
+    aMultiTextWnd->SetNumLines( aMultiTextWnd->GetNumLines() + 1 );
     TriggerToolboxLayout();
 }
 
 void ScInputBarGroup::DecrementVerticalSize()
 {
-    if ( aMultiTextWnd.GetNumLines() > 1 )
+    if ( aMultiTextWnd->GetNumLines() > 1 )
     {
-        aMultiTextWnd.SetNumLines( aMultiTextWnd.GetNumLines() - 1 );
+        aMultiTextWnd->SetNumLines( aMultiTextWnd->GetNumLines() - 1 );
         TriggerToolboxLayout();
     }
 }
@@ -1063,19 +1079,19 @@ IMPL_LINK_NOARG(ScInputBarGroup, ClickHdl)
         OSL_FAIL("The parent window pointer pParent is null");
         return 1;
     }
-    if( aMultiTextWnd.GetNumLines() > 1 )
+    if( aMultiTextWnd->GetNumLines() > 1 )
     {

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list