vcl: some VclPtr fixes found by the new plugin code

Change-Id: Ib4f591aaa88d8710fdb9b672533cfa8bb024160f
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index 95afb6a..e5a895f 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -62,7 +62,6 @@ private:
protected:
    using Window::ImplInit;
    SAL_DLLPRIVATE void    ImplInit( vcl::Window* pParent, WinBits nStyle );
    virtual        void    dispose() SAL_OVERRIDE;

public:
    SAL_DLLPRIVATE bool    IsInClose() const { return mbInClose; }
@@ -83,6 +82,7 @@ public:
    explicit        Dialog( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG );
    explicit        Dialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription );
    virtual         ~Dialog();
    virtual void    dispose() SAL_OVERRIDE;

    virtual bool    Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
    virtual void    StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index fde7609..1f85556 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -572,7 +572,7 @@ protected:
    DECL_LINK(ScrollBarHdl, void *);
    void InitScrollBars(const Size &rRequest);
    virtual bool Notify(NotifyEvent& rNEvt) SAL_OVERRIDE;
    void dispose() SAL_OVERRIDE { m_pVScroll.disposeAndClear(); m_pHScroll.disposeAndClear(); VclBin::dispose(); }
    void dispose() SAL_OVERRIDE { m_pVScroll.disposeAndClear(); m_pHScroll.disposeAndClear(); m_aScrollBarBox.disposeAndClear(); VclBin::dispose(); }
private:
    bool m_bUserManagedScrolling;
    VclPtr<ScrollBar> m_pVScroll;
diff --git a/svtools/source/toolpanel/toolpaneldrawer.cxx b/svtools/source/toolpanel/toolpaneldrawer.cxx
index 02ae7b2..475117d 100644
--- a/svtools/source/toolpanel/toolpaneldrawer.cxx
+++ b/svtools/source/toolpanel/toolpaneldrawer.cxx
@@ -87,7 +87,16 @@ namespace svt
        m_aVisualization->SetAccessibleDescription( i_rTitle );
    }

    ToolPanelDrawer::~ToolPanelDrawer()
    {
        dispose();
    }

    void ToolPanelDrawer::dispose()
    {
        m_aVisualization.disposeAndClear();
        vcl::Window::dispose();
    }

    long ToolPanelDrawer::GetPreferredHeightPixel() const
    {
diff --git a/svtools/source/toolpanel/toolpaneldrawer.hxx b/svtools/source/toolpanel/toolpaneldrawer.hxx
index a1d1a94..1f66263 100644
--- a/svtools/source/toolpanel/toolpaneldrawer.hxx
+++ b/svtools/source/toolpanel/toolpaneldrawer.hxx
@@ -63,6 +63,8 @@ namespace svt
    {
    public:
        ToolPanelDrawer( vcl::Window& i_rParent, const OUString& i_rTitle );
        virtual ~ToolPanelDrawer();
        virtual void dispose() SAL_OVERRIDE;

        long    GetPreferredHeightPixel() const;
        void    SetExpanded( const bool i_bExpanded );
diff --git a/svx/source/sidebar/EmptyPanel.cxx b/svx/source/sidebar/EmptyPanel.cxx
index 3a25381..e1639bf 100644
--- a/svx/source/sidebar/EmptyPanel.cxx
+++ b/svx/source/sidebar/EmptyPanel.cxx
@@ -53,6 +53,7 @@ EmptyPanel::~EmptyPanel()

void EmptyPanel::dispose()
{
    maMessageControl.disposeAndClear();
    Control::dispose();
}

diff --git a/svx/source/sidebar/text/TextUnderlineControl.cxx b/svx/source/sidebar/text/TextUnderlineControl.cxx
index 054fac0..bb1caed 100644
--- a/svx/source/sidebar/text/TextUnderlineControl.cxx
+++ b/svx/source/sidebar/text/TextUnderlineControl.cxx
@@ -65,6 +65,18 @@ TextUnderlineControl::TextUnderlineControl (
    FreeResource();
}

TextUnderlineControl::~TextUnderlineControl()
{
    dispose();
}

void TextUnderlineControl::dispose()
{
    maVSUnderline.disposeAndClear();
    maPBOptions.disposeAndClear();
    svx::sidebar::PopupControl::dispose();
}

void TextUnderlineControl::initial()
{
    maVSUnderline->SetColor(GetSettings().GetStyleSettings().GetHighContrastMode() ?
diff --git a/svx/source/sidebar/text/TextUnderlineControl.hxx b/svx/source/sidebar/text/TextUnderlineControl.hxx
index 8f4192e..441e157 100644
--- a/svx/source/sidebar/text/TextUnderlineControl.hxx
+++ b/svx/source/sidebar/text/TextUnderlineControl.hxx
@@ -36,6 +36,8 @@ public:
        vcl::Window* pParent,
        svx::sidebar::TextPropertyPanel& rPanel,
        SfxBindings* pBindings);
    virtual ~TextUnderlineControl();
    virtual void dispose() SAL_OVERRIDE;
    void Rearrange(FontUnderline eLine);

private:
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index 99093aa..9eb9e5b 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -301,6 +301,8 @@ ImplGrafControl::~ImplGrafControl()

void ImplGrafControl::dispose()
{
    maImage.disposeAndClear();
    maField.disposeAndClear();
    Control::dispose();
}

diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 5bab0de..f041d80b 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -280,6 +280,7 @@ void Edit::dispose()

    SetType(WINDOW_WINDOW);

    mpSubEdit.disposeAndClear();
    Control::dispose();
}