fix for invalid dynamic_cast

after my loplugin-cstylecast commits.
this is a follow on to the bug reported in fdo#84608

Change-Id: Icc4f4baf3690e939c07a71a949200270bf1f4614
This commit is contained in:
Noel Grandin
2014-10-04 20:11:40 +02:00
parent 552adfbbc6
commit ad5e8b30ac
2 changed files with 6 additions and 5 deletions

View File

@@ -147,15 +147,16 @@ void VCLXTopWindow_Base::setMenuBar( const ::com::sun::star::uno::Reference< ::c
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
SystemWindow* pWindow = dynamic_cast<SystemWindow*>( GetWindowImpl() ); vcl::Window* pWindow = GetWindowImpl();
if ( pWindow ) if ( pWindow )
{ {
pWindow->SetMenuBar( NULL ); SystemWindow* pSystemWindow = static_cast<SystemWindow*>( pWindow );
pSystemWindow->SetMenuBar( NULL );
if ( rxMenu.is() ) if ( rxMenu.is() )
{ {
VCLXMenu* pMenu = VCLXMenu::GetImplementation( rxMenu ); VCLXMenu* pMenu = VCLXMenu::GetImplementation( rxMenu );
if ( pMenu && !pMenu->IsPopupMenu() ) if ( pMenu && !pMenu->IsPopupMenu() )
pWindow->SetMenuBar( static_cast<MenuBar*>( pMenu->GetMenu() )); pSystemWindow->SetMenuBar( static_cast<MenuBar*>( pMenu->GetMenu() ));
} }
} }
mxMenuBar = rxMenu; mxMenuBar = rxMenu;

View File

@@ -80,7 +80,7 @@ void MenuFloatingWindow::doShutdown()
} }
if( i < nCount ) if( i < nCount )
{ {
MenuFloatingWindow* pPWin = dynamic_cast<MenuFloatingWindow*>(pMenu->pStartedFrom->ImplGetWindow()); MenuFloatingWindow* pPWin = static_cast<MenuFloatingWindow*>(pMenu->pStartedFrom->ImplGetWindow());
if( pPWin ) if( pPWin )
pPWin->HighlightItem( i, false ); pPWin->HighlightItem( i, false );
} }
@@ -682,7 +682,7 @@ void MenuFloatingWindow::ChangeHighlightItem( sal_uInt16 n, bool bStartPopupTime
} }
if( i < nCount ) if( i < nCount )
{ {
MenuFloatingWindow* pPWin = dynamic_cast<MenuFloatingWindow*>(pMenu->pStartedFrom->ImplGetWindow()); MenuFloatingWindow* pPWin = static_cast<MenuFloatingWindow*>(pMenu->pStartedFrom->ImplGetWindow());
if( pPWin && pPWin->nHighlightedItem != i ) if( pPWin && pPWin->nHighlightedItem != i )
{ {
pPWin->HighlightItem( i, true ); pPWin->HighlightItem( i, true );