accessibility: cleanup for updated toolkit API.

Change-Id: I828f0e3841c396008cb5e51dec322d9d89f3a7c1
diff --git a/accessibility/inc/accessibility/extended/accessibleiconchoicectrl.hxx b/accessibility/inc/accessibility/extended/accessibleiconchoicectrl.hxx
index 99757a9..38d583b 100644
--- a/accessibility/inc/accessibility/extended/accessibleiconchoicectrl.hxx
+++ b/accessibility/inc/accessibility/extended/accessibleiconchoicectrl.hxx
@@ -30,11 +30,8 @@

class SvtIconChoiceCtrl;


namespace accessibility
{


    typedef ::cppu::ImplHelper2<  ::com::sun::star::accessibility::XAccessible
                                , ::com::sun::star::accessibility::XAccessibleSelection> AccessibleIconChoiceCtrl_BASE;

@@ -55,7 +52,8 @@ namespace accessibility
        virtual void    ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) SAL_OVERRIDE;
        virtual void    FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) SAL_OVERRIDE;

        SvtIconChoiceCtrl* getCtrl();
        VclPtr< SvtIconChoiceCtrl > getCtrl();

    public:
        /** OAccessibleBase needs a valid view
            @param  _rIconCtrl
diff --git a/accessibility/inc/accessibility/extended/accessiblelistbox.hxx b/accessibility/inc/accessibility/extended/accessiblelistbox.hxx
index 739153c..b056f38 100644
--- a/accessibility/inc/accessibility/extended/accessiblelistbox.hxx
+++ b/accessibility/inc/accessibility/extended/accessiblelistbox.hxx
@@ -62,7 +62,7 @@ namespace accessibility
        virtual void    ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ) SAL_OVERRIDE;
        virtual void    FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) SAL_OVERRIDE;

        SvTreeListBox*  getListBox() const;
        VclPtr< SvTreeListBox > getListBox() const;

        void            RemoveChildEntries(SvTreeListEntry*);

diff --git a/accessibility/source/extended/accessibleiconchoicectrl.cxx b/accessibility/source/extended/accessibleiconchoicectrl.cxx
index 2048021..1f658c2 100644
--- a/accessibility/source/extended/accessibleiconchoicectrl.cxx
+++ b/accessibility/source/extended/accessibleiconchoicectrl.cxx
@@ -367,12 +367,11 @@ namespace accessibility
        }
    }

    SvtIconChoiceCtrl* AccessibleIconChoiceCtrl::getCtrl()
    VclPtr< SvtIconChoiceCtrl > AccessibleIconChoiceCtrl::getCtrl()
    {
        return static_cast<SvtIconChoiceCtrl*>(GetWindow());
        return GetAs<SvtIconChoiceCtrl >();
    }


}// namespace accessibility


diff --git a/accessibility/source/extended/accessiblelistbox.cxx b/accessibility/source/extended/accessiblelistbox.cxx
index 3b1800e..745394b 100644
--- a/accessibility/source/extended/accessiblelistbox.cxx
+++ b/accessibility/source/extended/accessiblelistbox.cxx
@@ -67,11 +67,6 @@ namespace accessibility
    IMPLEMENT_FORWARD_XINTERFACE2(AccessibleListBox, VCLXAccessibleComponent, AccessibleListBox_BASE)
    IMPLEMENT_FORWARD_XTYPEPROVIDER2(AccessibleListBox, VCLXAccessibleComponent, AccessibleListBox_BASE)

    SvTreeListBox* AccessibleListBox::getListBox() const
    {
        return  static_cast< SvTreeListBox* >( const_cast<AccessibleListBox*>(this)->GetWindow() );
    }

    void AccessibleListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
    {
        if ( isAlive() )
@@ -592,7 +587,10 @@ namespace accessibility
        }
    }


    VclPtr< SvTreeListBox > AccessibleListBox::getListBox() const
    {
        return GetAs< SvTreeListBox >();
    }

}// namespace accessibility

diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx
index 34e29e5..ef67482 100644
--- a/accessibility/source/helper/acc_factory.cxx
+++ b/accessibility/source/helper/acc_factory.cxx
@@ -257,7 +257,7 @@ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLX
Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXListBox* _pXWindow )
{
    bool bIsDropDownBox = false;
    ListBox* pBox = static_cast< ListBox* >( _pXWindow->GetWindow() );
    VclPtr< ListBox > pBox = _pXWindow->GetAs< ListBox >();
    if ( pBox )
        bIsDropDownBox = ( ( pBox->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN );

@@ -290,7 +290,7 @@ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLX
Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXComboBox* _pXWindow )
{
    bool bIsDropDownBox = false;
    ComboBox* pBox = static_cast< ComboBox* >( _pXWindow->GetWindow() );
    VclPtr< ComboBox > pBox = _pXWindow->GetAs< ComboBox >();
    if ( pBox )
        bIsDropDownBox = ( ( pBox->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN );

diff --git a/accessibility/source/standard/vclxaccessiblebox.cxx b/accessibility/source/standard/vclxaccessiblebox.cxx
index 15e3829..c5b8626 100644
--- a/accessibility/source/standard/vclxaccessiblebox.cxx
+++ b/accessibility/source/standard/vclxaccessiblebox.cxx
@@ -75,7 +75,7 @@ void VCLXAccessibleBox::ProcessWindowChildEvent( const VclWindowEvent& rVclWindo
            // be removed in a short time.
            if (m_aBoxType==COMBOBOX)
            {
                ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
                VclPtr< ComboBox > pComboBox = GetAs< ComboBox >();
                if ( ( pComboBox != NULL ) && ( pChildWindow != NULL ) )
                    if (pChildWindow == pComboBox->GetSubEdit())
                    {
@@ -327,7 +327,7 @@ Reference<XAccessible> SAL_CALL VCLXAccessibleBox::getAccessibleChild (sal_Int32
            {
                if (m_aBoxType==COMBOBOX)
                {
                    ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
                    VclPtr< ComboBox > pComboBox = GetAs< ComboBox >();
                    if (pComboBox!=NULL && pComboBox->GetSubEdit()!=NULL)
                    //Set the edit's acc name the same as parent
                    {
@@ -398,7 +398,7 @@ sal_Bool SAL_CALL VCLXAccessibleBox::doAccessibleAction (sal_Int32 nIndex)

        if (m_aBoxType == COMBOBOX)
        {
            ComboBox* pComboBox = static_cast< ComboBox* >( GetWindow() );
            VclPtr< ComboBox > pComboBox = GetAs< ComboBox >();
            if (pComboBox != NULL)
            {
                pComboBox->ToggleDropDown();
@@ -407,7 +407,7 @@ sal_Bool SAL_CALL VCLXAccessibleBox::doAccessibleAction (sal_Int32 nIndex)
        }
        else if (m_aBoxType == LISTBOX)
        {
            ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
            VclPtr< ListBox > pListBox = GetAs< ListBox >();
            if (pListBox != NULL)
            {
                pListBox->ToggleDropDown();
@@ -532,7 +532,7 @@ void VCLXAccessibleBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& r
    {
        OUString sText;
        sal_Int32 nEntryCount = 0;
        ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
        VclPtr< ComboBox > pComboBox = GetAs< ComboBox >();
        if (pComboBox != NULL)
        {
            Edit* pSubEdit = pComboBox->GetSubEdit();
@@ -546,7 +546,7 @@ void VCLXAccessibleBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& r
    else if (m_aBoxType == LISTBOX && m_bIsDropDownBox == true)
    {
        sal_Int32 nSelectedEntryCount = 0;
        ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
        VclPtr< ListBox > pListBox = GetAs< ListBox >();
        if (pListBox != NULL && pListBox->GetEntryCount() > 0)
        {
            nSelectedEntryCount = pListBox->GetSelectEntryCount();
diff --git a/accessibility/source/standard/vclxaccessiblebutton.cxx b/accessibility/source/standard/vclxaccessiblebutton.cxx
index 622565a..ae3698d 100644
--- a/accessibility/source/standard/vclxaccessiblebutton.cxx
+++ b/accessibility/source/standard/vclxaccessiblebutton.cxx
@@ -65,7 +65,7 @@ void VCLXAccessibleButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowE
            Any aOldValue;
            Any aNewValue;

            PushButton* pButton = static_cast<PushButton*>( GetWindow() );
            VclPtr< PushButton > pButton = GetAs< PushButton >();
            if ( pButton && pButton->GetState() == TRISTATE_TRUE )
                aNewValue <<= AccessibleStateType::CHECKED;
            else
@@ -85,7 +85,7 @@ void VCLXAccessibleButton::FillAccessibleStateSet( utl::AccessibleStateSetHelper
{
    VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet );

    PushButton* pButton = static_cast<PushButton*>( GetWindow() );
    VclPtr< PushButton > pButton = GetAs< PushButton >();
    if ( pButton )
    {
        rStateSet.AddState( AccessibleStateType::FOCUSABLE );
@@ -196,7 +196,7 @@ sal_Bool VCLXAccessibleButton::doAccessibleAction ( sal_Int32 nIndex ) throw (In
    if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
        throw IndexOutOfBoundsException();

    PushButton* pButton = static_cast<PushButton*>( GetWindow() );
    VclPtr< PushButton > pButton = GetAs< PushButton >();
    if ( pButton )
        pButton->Click();

@@ -264,7 +264,7 @@ Any VCLXAccessibleButton::getCurrentValue(  ) throw (RuntimeException, std::exce

    Any aValue;

    PushButton* pButton = static_cast<PushButton*>( GetWindow() );
    VclPtr< PushButton > pButton = GetAs< PushButton >();
    if ( pButton )
        aValue <<= (sal_Int32) pButton->IsPressed();

@@ -279,7 +279,7 @@ sal_Bool VCLXAccessibleButton::setCurrentValue( const Any& aNumber ) throw (Runt

    bool bReturn = false;

    PushButton* pButton = static_cast<PushButton*>( GetWindow() );
    VclPtr< PushButton > pButton = GetAs< PushButton >();
    if ( pButton )
    {
        sal_Int32 nValue = 0;
diff --git a/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
index 327510e..377fe9a 100644
--- a/accessibility/source/standard/vclxaccessiblecheckbox.cxx
+++ b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
@@ -198,7 +198,7 @@ sal_Bool VCLXAccessibleCheckBox::doAccessibleAction ( sal_Int32 nIndex ) throw (
    if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
        throw IndexOutOfBoundsException();

    CheckBox* pCheckBox = static_cast<CheckBox*>(GetWindow());
    VclPtr< CheckBox > pCheckBox = GetAs< CheckBox >();
    VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() );
    if ( pCheckBox && pVCLXCheckBox )
    {
@@ -328,7 +328,7 @@ Any VCLXAccessibleCheckBox::getMaximumValue(  ) throw (RuntimeException, std::ex

    Any aValue;

    CheckBox* pCheckBox = static_cast<CheckBox*>(GetWindow());
    VclPtr< CheckBox > pCheckBox = GetAs< CheckBox >();
    if ( pCheckBox && pCheckBox->IsTriStateEnabled() )
        aValue <<= (sal_Int32) 2;
    else
diff --git a/accessibility/source/standard/vclxaccessiblecombobox.cxx b/accessibility/source/standard/vclxaccessiblecombobox.cxx
index db8d059..f24ef8a 100644
--- a/accessibility/source/standard/vclxaccessiblecombobox.cxx
+++ b/accessibility/source/standard/vclxaccessiblecombobox.cxx
@@ -43,18 +43,11 @@ VCLXAccessibleComboBox::~VCLXAccessibleComboBox (void)
{
}




bool VCLXAccessibleComboBox::IsValid (void) const
{
    return static_cast<ComboBox*>(GetWindow()) != NULL;

    return GetWindow().get() != NULL;
}




void VCLXAccessibleComboBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
{
    VCLXAccessibleBox::ProcessWindowEvent( rVclWindowEvent );
diff --git a/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx b/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx
index f9557ef..64a3625 100644
--- a/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx
+++ b/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx
@@ -57,17 +57,11 @@ VCLXAccessibleDropDownComboBox::~VCLXAccessibleDropDownComboBox (void)
{
}



bool VCLXAccessibleDropDownComboBox::IsValid (void) const
{
    return static_cast<ComboBox*>(GetWindow()) != NULL;

    return GetWindow().get() != NULL;
}




void VCLXAccessibleDropDownComboBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
{
    switch ( rVclWindowEvent.GetId() )
diff --git a/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx b/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx
index bfff68e..41b57877 100644
--- a/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx
+++ b/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx
@@ -56,18 +56,11 @@ VCLXAccessibleDropDownListBox::~VCLXAccessibleDropDownListBox()
{
}




bool VCLXAccessibleDropDownListBox::IsValid (void) const
{
    return static_cast<ListBox*>(GetWindow()) != NULL;

    return GetWindow().get() != NULL;
}




void VCLXAccessibleDropDownListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
{
    VCLXAccessibleBox::ProcessWindowEvent (rVclWindowEvent);
diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx b/accessibility/source/standard/vclxaccessibleedit.cxx
index 1b9027d..7cc89bb 100644
--- a/accessibility/source/standard/vclxaccessibleedit.cxx
+++ b/accessibility/source/standard/vclxaccessibleedit.cxx
@@ -133,7 +133,7 @@ OUString VCLXAccessibleEdit::implGetText()
{
    OUString aText;

    Edit* pEdit = static_cast< Edit* >( GetWindow() );
    VclPtr< Edit > pEdit = GetAs< Edit >();
    if ( pEdit )
    {
        aText = OutputDevice::GetNonMnemonicString( pEdit->GetText() );
@@ -225,7 +225,7 @@ sal_Int16 VCLXAccessibleEdit::getAccessibleRole(  ) throw (RuntimeException, std
    OExternalLockGuard aGuard( this );

    sal_Int16 nRole;
    Edit* pEdit = static_cast< Edit* >( GetWindow() );
    VclPtr< Edit > pEdit = GetAs< Edit >();
    if ( pEdit && ( ( pEdit->GetStyle() & WB_PASSWORD ) || pEdit->GetEchoChar() ) )
        nRole = AccessibleRole::PASSWORD_TEXT;
    else
@@ -336,7 +336,7 @@ awt::Rectangle VCLXAccessibleEdit::getCharacterBounds( sal_Int32 nIndex ) throw 
    if ( !implIsValidRange( nIndex, nIndex, nLength ) )
        throw IndexOutOfBoundsException();

    Control* pControl = static_cast< Control* >( GetWindow() );
    VclPtr< Control > pControl = GetAs< Control >();
    if ( pControl )
    {
        if ( nIndex == nLength )
@@ -425,7 +425,7 @@ sal_Bool VCLXAccessibleEdit::setSelection( sal_Int32 nStartIndex, sal_Int32 nEnd
        throw IndexOutOfBoundsException();

    VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() );
    Edit* pEdit = static_cast< Edit* >( GetWindow() );
    VclPtr< Edit > pEdit = GetAs< Edit >();
    if ( pVCLXEdit && pEdit && pEdit->IsEnabled() )
    {
        pVCLXEdit->setSelection( awt::Selection( nStartIndex, nEndIndex ) );
diff --git a/accessibility/source/standard/vclxaccessiblelist.cxx b/accessibility/source/standard/vclxaccessiblelist.cxx
index 7fc060b..4160756 100644
--- a/accessibility/source/standard/vclxaccessiblelist.cxx
+++ b/accessibility/source/standard/vclxaccessiblelist.cxx
@@ -72,16 +72,16 @@ VCLXAccessibleList::VCLXAccessibleList (VCLXWindow* pVCLWindow, BoxType aBoxType
    {
        case COMBOBOX:
        {
            ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
            if ( pBox != NULL )
            VclPtr< ComboBox > pBox = GetAs< ComboBox >();
            if ( pBox )
                m_pListBoxHelper = new VCLListBoxHelper<ComboBox> (*pBox);
            break;
        }

        case LISTBOX:
        {
            ListBox* pBox = static_cast<ListBox*>(GetWindow());
            if ( pBox != NULL )
            VclPtr< ListBox > pBox = GetAs< ListBox >();
            if ( pBox )
                m_pListBoxHelper = new VCLListBoxHelper<ListBox> (*pBox);
            break;
        }
@@ -189,8 +189,8 @@ void VCLXAccessibleList::UpdateSelection_Acc (const ::rtl::OUString& sTextOfSele
{
    if ( m_aBoxType == COMBOBOX )
    {
        ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
        if ( pBox != NULL )
        VclPtr< ComboBox > pBox = GetAs< ComboBox >();
        if ( pBox )
        {
            // Find the index of the selected item inside the VCL control...
            sal_Int32 nIndex = pBox->GetEntryPos(sTextOfSelectedItem);
@@ -458,7 +458,7 @@ void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEve

 void VCLXAccessibleList::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet )
{
    ListBox* pBox = static_cast<ListBox*>(GetWindow());
    VclPtr< ListBox > pBox = GetAs< ListBox >();
    if( m_aBoxType == LISTBOX  )
    {
        if (m_pListBoxHelper && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) != WB_DROPDOWN)
@@ -483,8 +483,8 @@ void VCLXAccessibleList::UpdateSelection (const OUString& sTextOfSelectedItem)
{
    if ( m_aBoxType == COMBOBOX )
    {
        ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
        if ( pBox != NULL )
        VclPtr< ComboBox > pBox = GetAs< ComboBox >();
        if ( pBox )
        {
            // Find the index of the selected item inside the VCL control...
            sal_Int32 nIndex = pBox->GetEntryPos(sTextOfSelectedItem);
@@ -930,7 +930,7 @@ awt::Rectangle VCLXAccessibleList::implGetBounds() throw (uno::RuntimeException)
        aBounds.Y = 0;
        if ( m_aBoxType == COMBOBOX )
        {
            ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
            VclPtr< ComboBox > pBox = GetAs< ComboBox >();
            if ( pBox )
            {
                Size aSize = pBox->GetSubEdit()->GetSizePixel();
@@ -960,7 +960,7 @@ awt::Point VCLXAccessibleList::getLocationOnScreen(  ) throw (uno::RuntimeExcept
        aPos = VCLXAccessibleComponent::getLocationOnScreen();
        if ( m_aBoxType == COMBOBOX )
        {
            ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
            VclPtr< ComboBox > pBox = GetAs< ComboBox >();
            if ( pBox )
            {
                aPos.Y += pBox->GetSubEdit()->GetSizePixel().Height();
diff --git a/accessibility/source/standard/vclxaccessiblelistbox.cxx b/accessibility/source/standard/vclxaccessiblelistbox.cxx
index 701e0ba..bd39b61 100644
--- a/accessibility/source/standard/vclxaccessiblelistbox.cxx
+++ b/accessibility/source/standard/vclxaccessiblelistbox.cxx
@@ -54,26 +54,16 @@ VCLXAccessibleListBox::~VCLXAccessibleListBox (void)
{
}




bool VCLXAccessibleListBox::IsValid (void) const
{
    return static_cast<ListBox*>(GetWindow()) != NULL;

    return GetWindow().get() != NULL;
}




void VCLXAccessibleListBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
{
    VCLXAccessibleBox::ProcessWindowEvent( rVclWindowEvent );
}




//=====  XServiceInfo  ========================================================

OUString VCLXAccessibleListBox::getImplementationName (void)
diff --git a/accessibility/source/standard/vclxaccessibleradiobutton.cxx b/accessibility/source/standard/vclxaccessibleradiobutton.cxx
index c76babf..23d8a92 100644
--- a/accessibility/source/standard/vclxaccessibleradiobutton.cxx
+++ b/accessibility/source/standard/vclxaccessibleradiobutton.cxx
@@ -90,7 +90,7 @@ void VCLXAccessibleRadioButton::FillAccessibleRelationSet( utl::AccessibleRelati
{
    VCLXAccessibleTextComponent::FillAccessibleRelationSet( rRelationSet );

    RadioButton* pRadioButton = dynamic_cast< RadioButton* >( GetWindow() );
    VclPtr< RadioButton > pRadioButton = GetAsDynamic< RadioButton >();
    if ( pRadioButton )
    {
        ::std::vector< VclPtr<RadioButton> > aGroup(pRadioButton->GetRadioButtonGroup(true));
diff --git a/accessibility/source/standard/vclxaccessiblescrollbar.cxx b/accessibility/source/standard/vclxaccessiblescrollbar.cxx
index 44faa7e..76e58a6 100644
--- a/accessibility/source/standard/vclxaccessiblescrollbar.cxx
+++ b/accessibility/source/standard/vclxaccessiblescrollbar.cxx
@@ -139,7 +139,7 @@ sal_Bool VCLXAccessibleScrollBar::doAccessibleAction ( sal_Int32 nIndex ) throw 
        throw IndexOutOfBoundsException();

    bool bReturn = false;
    ScrollBar* pScrollBar = static_cast< ScrollBar* >( GetWindow() );
    VclPtr< ScrollBar > pScrollBar = GetAs< ScrollBar >();
    if ( pScrollBar )
    {
        ScrollType eScrollType;
diff --git a/accessibility/source/standard/vclxaccessiblestatusbar.cxx b/accessibility/source/standard/vclxaccessiblestatusbar.cxx
index 921c707..42d1db5 100644
--- a/accessibility/source/standard/vclxaccessiblestatusbar.cxx
+++ b/accessibility/source/standard/vclxaccessiblestatusbar.cxx
@@ -38,7 +38,7 @@ using namespace ::comphelper;
VCLXAccessibleStatusBar::VCLXAccessibleStatusBar( VCLXWindow* pVCLXWindow )
    :VCLXAccessibleComponent( pVCLXWindow )
{
    m_pStatusBar = static_cast< StatusBar* >( GetWindow() );
    m_pStatusBar = static_cast< StatusBar *>( GetWindow().get() );

    if ( m_pStatusBar )
        m_aAccessibleChildren.assign( m_pStatusBar->GetItemCount(), Reference< XAccessible >() );
diff --git a/accessibility/source/standard/vclxaccessibletabcontrol.cxx b/accessibility/source/standard/vclxaccessibletabcontrol.cxx
index 268a6f3..26ffc8e 100644
--- a/accessibility/source/standard/vclxaccessibletabcontrol.cxx
+++ b/accessibility/source/standard/vclxaccessibletabcontrol.cxx
@@ -43,7 +43,7 @@ using namespace ::comphelper;
VCLXAccessibleTabControl::VCLXAccessibleTabControl( VCLXWindow* pVCLXWindow )
    :VCLXAccessibleComponent( pVCLXWindow )
{
    m_pTabControl = static_cast< TabControl* >( GetWindow() );
    m_pTabControl = static_cast< TabControl* >( GetWindow().get() );

    if ( m_pTabControl )
        m_aAccessibleChildren.assign( m_pTabControl->GetPageCount(), Reference< XAccessible >() );
diff --git a/accessibility/source/standard/vclxaccessibletabpagewindow.cxx b/accessibility/source/standard/vclxaccessibletabpagewindow.cxx
index d8d4732..3edb2b8 100644
--- a/accessibility/source/standard/vclxaccessibletabpagewindow.cxx
+++ b/accessibility/source/standard/vclxaccessibletabpagewindow.cxx
@@ -36,7 +36,7 @@ using namespace ::comphelper;
VCLXAccessibleTabPageWindow::VCLXAccessibleTabPageWindow( VCLXWindow* pVCLXWindow )
    :VCLXAccessibleComponent( pVCLXWindow )
{
    m_pTabPage = static_cast< TabPage* >( GetWindow() );
    m_pTabPage = static_cast< TabPage* >( GetWindow().get() );
    m_pTabControl = 0;
    m_nPageId = 0;
    if ( m_pTabPage )
diff --git a/accessibility/source/standard/vclxaccessibletextcomponent.cxx b/accessibility/source/standard/vclxaccessibletextcomponent.cxx
index 1bfa189..7fbe48a 100644
--- a/accessibility/source/standard/vclxaccessibletextcomponent.cxx
+++ b/accessibility/source/standard/vclxaccessibletextcomponent.cxx
@@ -254,7 +254,7 @@ awt::Rectangle VCLXAccessibleTextComponent::getCharacterBounds( sal_Int32 nIndex
        throw IndexOutOfBoundsException();

    awt::Rectangle aRect;
    Control* pControl = static_cast< Control* >( GetWindow() );
    VclPtr< Control > pControl = GetAs< Control >();
    if ( pControl )
        aRect = AWTRectangle( pControl->GetCharacterBounds( nIndex ) );

@@ -277,7 +277,7 @@ sal_Int32 VCLXAccessibleTextComponent::getIndexAtPoint( const awt::Point& aPoint
    OExternalLockGuard aGuard( this );

    sal_Int32 nIndex = -1;
    Control* pControl = static_cast< Control* >( GetWindow() );
    VclPtr< Control > pControl = GetAs< Control >();
    if ( pControl )
        nIndex = pControl->GetIndexForPoint( VCLPoint( aPoint ) );

diff --git a/accessibility/source/standard/vclxaccessibletextfield.cxx b/accessibility/source/standard/vclxaccessibletextfield.cxx
index 3219be8..17a7981 100644
--- a/accessibility/source/standard/vclxaccessibletextfield.cxx
+++ b/accessibility/source/standard/vclxaccessibletextfield.cxx
@@ -53,22 +53,16 @@ VCLXAccessibleTextField::~VCLXAccessibleTextField (void)
{
}




OUString VCLXAccessibleTextField::implGetText (void)
{
    OUString aText;
    ListBox* pListBox = static_cast<ListBox*>(GetWindow());
    if (pListBox!=NULL && !pListBox->IsInDropDown())
    VclPtr< ListBox > pListBox = GetAs< ListBox >();
    if (pListBox && !pListBox->IsInDropDown())
        aText = pListBox->GetSelectEntry();

    return aText;
}




IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleTextField, VCLXAccessibleTextComponent, VCLXAccessible_BASE)
IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleTextField, VCLXAccessibleTextComponent, VCLXAccessible_BASE)

diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx
index 3dc32a1..8e502bf 100644
--- a/accessibility/source/standard/vclxaccessibletoolbox.cxx
+++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx
@@ -184,7 +184,7 @@ VCLXAccessibleToolBox::~VCLXAccessibleToolBox()
VCLXAccessibleToolBoxItem* VCLXAccessibleToolBox::GetItem_Impl( sal_Int32 _nPos, bool _bMustHaveFocus )
{
    VCLXAccessibleToolBoxItem* pItem = NULL;
    ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
    VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
    if ( pToolBox && ( !_bMustHaveFocus || pToolBox->HasFocus() ) )
    {
        ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos );
@@ -198,7 +198,7 @@ VCLXAccessibleToolBoxItem* VCLXAccessibleToolBox::GetItem_Impl( sal_Int32 _nPos,

void VCLXAccessibleToolBox::UpdateFocus_Impl()
{
    ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
    VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
    if( !pToolBox )
        return;

@@ -250,7 +250,7 @@ void VCLXAccessibleToolBox::UpdateFocus_Impl()

void VCLXAccessibleToolBox::ReleaseFocus_Impl( sal_Int32 _nPos )
{
    ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
    VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
    if ( pToolBox ) // #107124#, do not check for focus because this message is also handled in losefocus
    {
        ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos );
@@ -266,7 +266,7 @@ void VCLXAccessibleToolBox::ReleaseFocus_Impl( sal_Int32 _nPos )

void VCLXAccessibleToolBox::UpdateChecked_Impl( sal_Int32 _nPos )
{
    ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
    VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
    if ( pToolBox )
    {
        sal_uInt16 nFocusId = pToolBox->GetItemId( (sal_uInt16)_nPos );
@@ -291,7 +291,7 @@ void VCLXAccessibleToolBox::UpdateChecked_Impl( sal_Int32 _nPos )

void VCLXAccessibleToolBox::UpdateIndeterminate_Impl( sal_Int32 _nPos )
{
    ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
    VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
    if ( pToolBox )
    {
        sal_uInt16 nItemId = pToolBox->GetItemId( (sal_uInt16)_nPos );
@@ -347,7 +347,7 @@ void VCLXAccessibleToolBox::UpdateItem_Impl( sal_Int32 _nPos, bool _bItemAdded )
        return;
    }

    ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
    VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
    if ( pToolBox )
    {
        if ( !_bItemAdded )
@@ -403,7 +403,7 @@ void VCLXAccessibleToolBox::UpdateItem_Impl( sal_Int32 _nPos, bool _bItemAdded )

void VCLXAccessibleToolBox::UpdateAllItems_Impl()
{
    ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
    VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
    if ( pToolBox )
    {
        // deregister the old items
@@ -427,7 +427,7 @@ void VCLXAccessibleToolBox::UpdateAllItems_Impl()

void VCLXAccessibleToolBox::UpdateCustomPopupItemp_Impl( vcl::Window* pWindow, bool bOpen )
{
    ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
    VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
    if( pWindow && pToolBox )
    {
        const sal_uInt16 nDownItem = pToolBox->GetDownItemId();
@@ -465,7 +465,7 @@ void VCLXAccessibleToolBox::UpdateItemEnabled_Impl( sal_Int32 _nPos )
void VCLXAccessibleToolBox::HandleSubToolBarEvent( const VclWindowEvent& rVclWindowEvent, bool _bShow )
{
    vcl::Window* pChildWindow = static_cast<vcl::Window *>(rVclWindowEvent.GetData());
    ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
    VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
    if ( pChildWindow
        && pToolBox
        && pToolBox == pChildWindow->GetParent()
@@ -486,7 +486,7 @@ void VCLXAccessibleToolBox::HandleSubToolBarEvent( const VclWindowEvent& rVclWin

void VCLXAccessibleToolBox::ReleaseSubToolBox( ToolBox* _pSubToolBox )
{
    ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
    VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
    if ( !pToolBox )
        return;

@@ -512,7 +512,7 @@ void VCLXAccessibleToolBox::FillAccessibleStateSet( utl::AccessibleStateSetHelpe
{
    VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet );

    ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
    VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
    if ( pToolBox )
    {
        rStateSet.AddState( AccessibleStateType::FOCUSABLE );
@@ -533,7 +533,7 @@ void VCLXAccessibleToolBox::ProcessWindowEvent( const VclWindowEvent& rVclWindow
        case VCLEVENT_TOOLBOX_CLICK:
        case VCLEVENT_TOOLBOX_SELECT:
        {
            ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
            VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
            if ( rVclWindowEvent.GetData() )
            {
                UpdateChecked_Impl( (sal_Int32)reinterpret_cast<sal_IntPtr>(rVclWindowEvent.GetData()) );
@@ -617,7 +617,7 @@ void VCLXAccessibleToolBox::ProcessWindowEvent( const VclWindowEvent& rVclWindow
        case VCLEVENT_OBJECT_DYING :
        {
            // if this toolbox is a subtoolbox, we have to relese it from its parent
            vcl::Window * pWin = GetWindow();
            VclPtr< vcl::Window > pWin = GetAs< vcl::Window >();
            if ( pWin && pWin->GetParent() &&
                 pWin->GetParent()->GetType() == WINDOW_TOOLBOX )
            {
@@ -704,7 +704,7 @@ sal_Int32 SAL_CALL VCLXAccessibleToolBox::getAccessibleChildCount(  ) throw (Run
    comphelper::OExternalLockGuard aGuard( this );

    sal_Int32 nCount = 0;
    ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
    VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
    if ( pToolBox )
        nCount = pToolBox->GetItemCount();

@@ -718,7 +718,7 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleChild( sal

    comphelper::OExternalLockGuard aGuard( this );

    ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
    VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
    if ( pToolBox )
    {
        Reference< XAccessible > xChild;
@@ -763,7 +763,7 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleAtPoint( c
    comphelper::OExternalLockGuard aGuard( this );

    Reference< XAccessible > xAccessible;
    ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
    VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
    if ( pToolBox )
    {
        sal_uInt16 nItemPos = pToolBox->GetItemPos( VCLPoint( _rPoint ) );
@@ -778,7 +778,7 @@ Reference< XAccessible > VCLXAccessibleToolBox::GetItemWindowAccessible( const V
{
    Reference< XAccessible > xReturn;
    vcl::Window* pChildWindow = static_cast<vcl::Window *>(rVclWindowEvent.GetData());
    ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
    VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
    if ( pChildWindow && pToolBox )
    {
        sal_uInt16 nCount = pToolBox->GetItemCount();
@@ -808,7 +808,7 @@ void VCLXAccessibleToolBox::selectAccessibleChild( sal_Int32 nChildIndex ) throw
    OExternalLockGuard aGuard( this );
    if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
        throw IndexOutOfBoundsException();
    ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() );
    VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
    sal_uInt16 nPos = static_cast < sal_uInt16 > (nChildIndex);
    pToolBox->ChangeHighlight( nPos );
}
@@ -818,9 +818,9 @@ sal_Bool VCLXAccessibleToolBox::isAccessibleChildSelected( sal_Int32 nChildIndex
    OExternalLockGuard aGuard( this );
    if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
        throw IndexOutOfBoundsException();
    ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() );
    VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
    sal_uInt16 nPos = static_cast < sal_uInt16 > (nChildIndex);
    if ( pToolBox != NULL && pToolBox->GetHighlightItemId() == pToolBox->GetItemId( nPos ) )
    if ( pToolBox && pToolBox->GetHighlightItemId() == pToolBox->GetItemId( nPos ) )
        return true;
    else
        return false;
@@ -829,7 +829,7 @@ sal_Bool VCLXAccessibleToolBox::isAccessibleChildSelected( sal_Int32 nChildIndex
void VCLXAccessibleToolBox::clearAccessibleSelection(  ) throw (RuntimeException, std::exception)
{
    OExternalLockGuard aGuard( this );
    ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() );
    VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
    pToolBox -> LoseFocus();
}

diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index ac82b98..71e9ed5 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -626,7 +626,7 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const
    if (!xHelp.is())
        pHelpWindow = impl_createHelp(xHelp, xHelpContent);
    else
        pHelpWindow = static_cast<SfxHelpWindow_Impl*>(VCLUnoHelper::GetWindow(xHelp->getComponentWindow()));
        pHelpWindow = static_cast<SfxHelpWindow_Impl*>(VCLUnoHelper::GetWindow(xHelp->getComponentWindow()).get());
    if (!xHelp.is() || !xHelpContent.is() || !pHelpWindow)
        return false;

diff --git a/sfx2/source/dialog/backingcomp.cxx b/sfx2/source/dialog/backingcomp.cxx
index e8f49fb..fdc4f1c3 100644
--- a/sfx2/source/dialog/backingcomp.cxx
+++ b/sfx2/source/dialog/backingcomp.cxx
@@ -403,8 +403,8 @@ void SAL_CALL BackingComp::attachFrame( /*IN*/ const css::uno::Reference< css::f

    // initialize the component and its parent window
    css::uno::Reference< css::awt::XWindow > xParentWindow = xFrame->getContainerWindow();
    WorkWindow* pParent = static_cast<WorkWindow*>(VCLUnoHelper::GetWindow(xParentWindow));
    vcl::Window*     pWindow = VCLUnoHelper::GetWindow(m_xWindow);
    VclPtr< WorkWindow > pParent = static_cast<WorkWindow*>(VCLUnoHelper::GetWindow(xParentWindow).get());
    VclPtr< vcl::Window > pWindow = VCLUnoHelper::GetWindow(m_xWindow);

    // disable full screen mode of the frame!
    if (pParent && pParent->IsFullScreenMode())
@@ -800,7 +800,7 @@ void SAL_CALL BackingComp::dispatch( const css::util::URL& aURL, const css::uno:

            // Recalculate minimum width
            css::uno::Reference< css::awt::XWindow > xParentWindow = m_xFrame->getContainerWindow();
            WorkWindow* pParent = static_cast<WorkWindow*>(VCLUnoHelper::GetWindow(xParentWindow));
            VclPtr< WorkWindow > pParent = static_cast<WorkWindow*>(VCLUnoHelper::GetWindow(xParentWindow).get());
            if( pParent )
            {
                pParent->SetMinOutputSizePixel( Size(