vcl: add dispose implementations & destructor calls.

Change-Id: Iefeaf81d4f7463440a6c5a8abb4d68aa85190698
diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx
index c0f348f..124b314 100644
--- a/include/vcl/button.hxx
+++ b/include/vcl/button.hxx
@@ -64,6 +64,7 @@ protected:

public:
    virtual            ~Button();
    virtual void        dispose() SAL_OVERRIDE;

    virtual void        Click();

@@ -153,7 +154,6 @@ protected:
public:
    explicit        PushButton( vcl::Window* pParent, WinBits nStyle = 0 );
    explicit        PushButton( vcl::Window* pParent, const ResId& );
    virtual         ~PushButton();

    virtual void    MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
    virtual void    Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
@@ -335,6 +335,7 @@ public:
    explicit        RadioButton( vcl::Window* pParent, WinBits nWinStyle = 0 );
    explicit        RadioButton( vcl::Window* pParent, const ResId& );
    virtual         ~RadioButton();
    virtual void    dispose() SAL_OVERRIDE;

    virtual void    MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
    virtual void    Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
@@ -517,9 +518,8 @@ private:
                            ImageButton & operator= ( const ImageButton & ) SAL_DELETED_FUNCTION;

public:
                    ImageButton( vcl::Window* pParent, WinBits nStyle = 0 );
                    ImageButton( vcl::Window* pParent, const ResId& rResId );
                    virtual ~ImageButton();
                 ImageButton( vcl::Window* pParent, WinBits nStyle = 0 );
                 ImageButton( vcl::Window* pParent, const ResId& rResId );
};

class VCL_DLLPUBLIC ImageRadioButton : public RadioButton
@@ -529,7 +529,6 @@ class VCL_DLLPUBLIC ImageRadioButton : public RadioButton

public:
    explicit        ImageRadioButton( vcl::Window* pParent, WinBits nStyle = 0 );
    virtual         ~ImageRadioButton();
};

class VCL_DLLPUBLIC TriStateBox : public CheckBox
@@ -539,7 +538,6 @@ class VCL_DLLPUBLIC TriStateBox : public CheckBox

public:
    explicit        TriStateBox( vcl::Window* pParent, WinBits nStyle = 0 );
    virtual         ~TriStateBox();
};

class VCL_DLLPUBLIC DisclosureButton : public CheckBox
diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx
index 86e6af4..d36db77 100644
--- a/include/vcl/combobox.hxx
+++ b/include/vcl/combobox.hxx
@@ -32,10 +32,6 @@ class ImplListBoxFloatingWindow;
class ImplListBox;
class ImplBtn;


// - ComboBox -


class VCL_DLLPUBLIC ComboBox : public Edit
{
private:
@@ -91,11 +87,12 @@ protected:
    bool            IsDropDownBox() const { return mpFloatWin ? true : false; }

    virtual void    FillLayoutData() const SAL_OVERRIDE;
    virtual void    dispose() SAL_OVERRIDE;

public:
    explicit        ComboBox( vcl::Window* pParent, WinBits nStyle = 0 );
    explicit        ComboBox( vcl::Window* pParent, const ResId& );
    virtual         ~ComboBox();
    virtual void    dispose() SAL_OVERRIDE;

    virtual void    Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
    virtual void    Resize() SAL_OVERRIDE;
diff --git a/include/vcl/spinfld.hxx b/include/vcl/spinfld.hxx
index 493dcf8..b0474b1 100644
--- a/include/vcl/spinfld.hxx
+++ b/include/vcl/spinfld.hxx
@@ -26,9 +26,6 @@
#include <vcl/timer.hxx>


// - SpinField -


class VCL_DLLPUBLIC SpinField : public Edit
{
protected:
@@ -69,12 +66,11 @@ protected:
    virtual void    FillLayoutData() const SAL_OVERRIDE;
    Rectangle *     ImplFindPartRect( const Point& rPt );

    virtual void    dispose() SAL_OVERRIDE;

public:
    explicit        SpinField( vcl::Window* pParent, WinBits nWinStyle = 0 );
    explicit        SpinField( vcl::Window* pParent, const ResId& );
    virtual         ~SpinField();
    virtual void    dispose() SAL_OVERRIDE;

    virtual bool    ShowDropDown( bool bShow );

diff --git a/include/vcl/vclmedit.hxx b/include/vcl/vclmedit.hxx
index 75f96ed..034c254 100644
--- a/include/vcl/vclmedit.hxx
+++ b/include/vcl/vclmedit.hxx
@@ -57,8 +57,10 @@ protected:
    ScrollBar*      GetVScrollBar() const;

public:
    VclMultiLineEdit( vcl::Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER );
    virtual ~VclMultiLineEdit();
                    VclMultiLineEdit( vcl::Window* pParent,
                                      WinBits nWinStyle = WB_LEFT | WB_BORDER );
    virtual         ~VclMultiLineEdit();
    virtual void    dispose() SAL_OVERRIDE;

    void            SelectionChanged();
    void            CaretChanged();
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 1e6c2e5..1fffd48 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -95,7 +95,15 @@ Button::Button( WindowType nType ) :

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

void Button::dispose()
{
    delete mpButtonData;
    mpButtonData = NULL;

    Control::dispose();
}

void Button::SetCommandHandler(const OUString& aCommand)
@@ -1174,10 +1182,6 @@ PushButton::PushButton( vcl::Window* pParent, const ResId& rResId ) :
        Show();
}

PushButton::~PushButton()
{
}

void PushButton::MouseButtonDown( const MouseEvent& rMEvt )
{
    if ( rMEvt.IsLeft() &&
@@ -2306,11 +2310,18 @@ void RadioButton::ImplLoadRes( const ResId& rResId )

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

void RadioButton::dispose()
{
    if (m_xGroup)
    {
        m_xGroup->erase(std::remove(m_xGroup->begin(), m_xGroup->end(), this),
            m_xGroup->end());
                        m_xGroup->end());
        m_xGroup.reset();
    }
    Button::dispose();
}

void RadioButton::MouseButtonDown( const MouseEvent& rMEvt )
@@ -3754,10 +3765,6 @@ ImageButton::ImageButton( vcl::Window* pParent, const ResId& rResId ) :
    ImplInitStyle();
}

ImageButton::~ImageButton()
{
}

void ImageButton::ImplInitStyle()
{
    WinBits nStyle = GetStyle();
@@ -3776,20 +3783,12 @@ ImageRadioButton::ImageRadioButton( vcl::Window* pParent, WinBits nStyle ) :
{
}

ImageRadioButton::~ImageRadioButton()
{
}

TriStateBox::TriStateBox( vcl::Window* pParent, WinBits nStyle ) :
    CheckBox( pParent, nStyle )
{
    EnableTriState( true );
}

TriStateBox::~TriStateBox()
{
}

DisclosureButton::DisclosureButton( vcl::Window* pParent, WinBits nStyle ) :
    CheckBox( pParent, nStyle )
{
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 21877ec..6396465 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -68,19 +68,22 @@ ComboBox::ComboBox( vcl::Window* pParent, const ResId& rResId ) :

ComboBox::~ComboBox()
{
    SetSubEdit(VclPtr<Edit>());
    dispose();
}

void ComboBox::dispose()
{
    mpSubEdit.disposeAndClear();

    ImplListBox *pImplLB = mpImplLB;
    mpImplLB = NULL;
    delete pImplLB;

    delete mpFloatWin;
    mpFloatWin = NULL;
    delete mpBtn;
}
    mpBtn = NULL;

void ComboBox::dispose()
{
    mpSubEdit.disposeAndClear();
    Edit::dispose();
}

diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index 048f2f4..4fcd128 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -365,6 +365,7 @@ SpinField::~SpinField()
void SpinField::dispose()
{
    mpEdit.disposeAndClear();

    Edit::dispose();
}

diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index dd46cda..0ceabaf 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -937,11 +937,19 @@ VclMultiLineEdit::VclMultiLineEdit( vcl::Window* pParent, WinBits nWinStyle )

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

void VclMultiLineEdit::dispose()
{
    {
        std::unique_ptr< ImpVclMEdit > xDelete(pImpVclMEdit);
        pImpVclMEdit = NULL;
    }
    delete pUpdateDataTimer;
    pUpdateDataTimer = NULL;

    Edit::dispose();
}

WinBits VclMultiLineEdit::ImplInitStyle( WinBits nStyle )
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index bc02ec1..b8abd0a 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1091,12 +1091,16 @@ WinBits Window::GetExtendedStyle() const

void Window::SetType( WindowType nType )
{
    mpWindowImpl->mnType = nType;
    if (mpWindowImpl)
        mpWindowImpl->mnType = nType;
}

WindowType Window::GetType() const
{
    return mpWindowImpl->mnType;
    if (mpWindowImpl)
        return mpWindowImpl->mnType;
    else
        return WINDOW_PARENT;
}

Dialog* Window::GetParentDialog() const