Index: toolkit/source/awt/vclxtopwindow.cxx =================================================================== --- toolkit/source/awt/vclxtopwindow.cxx (revision 267005) +++ toolkit/source/awt/vclxtopwindow.cxx (working copy) @@ -59,6 +59,11 @@ #include +VCLXTopWindow_Base::VCLXTopWindow_Base() + : m_bHasAWTMenuBar( sal_False ) +{ +} + VCLXTopWindow_Base::~VCLXTopWindow_Base() { } @@ -153,16 +158,41 @@ { VCLXMenu* pMenu = VCLXMenu::GetImplementation( rxMenu ); if ( pMenu && !pMenu->IsPopupMenu() ) + { pWindow->SetMenuBar( (MenuBar*) pMenu->GetMenu() ); + m_bHasAWTMenuBar = sal_True; } + } + } mxMenuBar = rxMenu; } +void VCLXTopWindow_Base::cleanUpMenuBar() +{ + ::vos::OGuard aGuard( GetMutexImpl() ); + + if ( m_bHasAWTMenuBar ) + { + SystemWindow* pWindow = (SystemWindow*) GetWindowImpl(); + if ( pWindow ) + { + pWindow->SetMenuBar( NULL ); + m_bHasAWTMenuBar = sal_False; + } + } +} + // ---------------------------------------------------- // class VCLXTopWindow // ---------------------------------------------------- +void VCLXTopWindow::dispose() throw(::com::sun::star::uno::RuntimeException) +{ + VCLXTopWindow_Base::cleanUpMenuBar(); + VCLXContainer::dispose(); +} + void VCLXTopWindow::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) { VCLXContainer::ImplGetPropertyIds( rIds ); Index: toolkit/inc/toolkit/awt/vclxtopwindow.hxx =================================================================== --- toolkit/inc/toolkit/awt/vclxtopwindow.hxx (revision 267005) +++ toolkit/inc/toolkit/awt/vclxtopwindow.hxx (working copy) @@ -45,16 +45,20 @@ ::com::sun::star::awt::XSystemDependentWindowPeer > VCLXTopWindow_XBase; -class TOOLKIT_DLLPUBLIC VCLXTopWindow_Base: public VCLXTopWindow_XBase +class SAL_DLLPRIVATE VCLXTopWindow_Base: public VCLXTopWindow_XBase { +private: + ::sal_Bool m_bHasAWTMenuBar; protected: ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar> mxMenuBar; virtual ::vos::IMutex& GetMutexImpl() = 0; virtual Window* GetWindowImpl() = 0; virtual ::cppu::OInterfaceContainerHelper& GetTopWindowListenersImpl() = 0; + void cleanUpMenuBar(); public: + VCLXTopWindow_Base(); virtual ~VCLXTopWindow_Base(); // ::com::sun::star::awt::XSystemDependentWindowPeer @@ -96,6 +100,9 @@ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::lang::XComponent + virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); + static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds ); virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); } };