diff options
Diffstat (limited to 'framework/source/uielement/menubarwrapper.cxx')
-rw-r--r-- | framework/source/uielement/menubarwrapper.cxx | 88 |
1 files changed, 11 insertions, 77 deletions
diff --git a/framework/source/uielement/menubarwrapper.cxx b/framework/source/uielement/menubarwrapper.cxx index 6f67deef0392..24f4d738bf7f 100644 --- a/framework/source/uielement/menubarwrapper.cxx +++ b/framework/source/uielement/menubarwrapper.cxx @@ -29,6 +29,7 @@ #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/queryinterface.hxx> #include <toolkit/awt/vclxmenu.hxx> +#include <utility> #include <vcl/svapp.hxx> using namespace com::sun::star; @@ -44,74 +45,12 @@ using namespace ::com::sun::star::ui; namespace framework { -void SAL_CALL MenuBarWrapper::acquire() noexcept \ -{ \ - /* Don't use mutex in methods of XInterface! */ \ - UIConfigElementWrapperBase::acquire(); \ -} \ - \ -void SAL_CALL MenuBarWrapper::release() noexcept \ -{ \ - /* Don't use mutex in methods of XInterface! */ \ - UIConfigElementWrapperBase::release(); \ -} - -css::uno::Any SAL_CALL MenuBarWrapper::queryInterface( const css::uno::Type& aType ) -{ - /* Attention: Don't use mutex or guard in this method!!! Is a method of XInterface. */ - /* Ask for my own supported interfaces ... */ - css::uno::Any aReturn = ::cppu::queryInterface( aType, - static_cast< css::lang::XTypeProvider* >( this ), - static_cast< css::ui::XUIElement* >( this ), - static_cast< css::ui::XUIElementSettings* >( this ), - static_cast< css::beans::XMultiPropertySet* >( this ), - static_cast< css::beans::XFastPropertySet* >( this ), - static_cast< css::beans::XPropertySet* >( this ), - static_cast< css::lang::XInitialization* >( this ), - static_cast< css::lang::XComponent* >( this ), - static_cast< css::util::XUpdatable* >( this ), - static_cast< css::ui::XUIConfigurationListener* >( this ), - static_cast< css::container::XNameAccess* >( static_cast< css::container::XElementAccess* >( this ) ) - ); - /* If searched interface not supported by this class ... */ - if ( !aReturn.hasValue() ) - { - /* ... ask baseclass for interfaces! */ - aReturn = UIConfigElementWrapperBase::queryInterface( aType ); - } - /* Return result of this search. */ - return aReturn; -} - -css::uno::Sequence< sal_Int8 > SAL_CALL MenuBarWrapper::getImplementationId() -{ - return css::uno::Sequence<sal_Int8>(); -} - -css::uno::Sequence< css::uno::Type > SAL_CALL MenuBarWrapper::getTypes() -{ - /* Attention: "TYPES" will expand to "(...)"! */ - static cppu::OTypeCollection ourTypeCollection { - cppu::UnoType<css::lang::XTypeProvider>::get() , - cppu::UnoType<css::ui::XUIElement>::get() , - cppu::UnoType<css::ui::XUIElementSettings>::get() , - cppu::UnoType<css::beans::XMultiPropertySet>::get() , - cppu::UnoType<css::beans::XFastPropertySet>::get() , - cppu::UnoType<css::beans::XPropertySet>::get() , - cppu::UnoType<css::lang::XInitialization>::get() , - cppu::UnoType<css::lang::XComponent>::get() , - cppu::UnoType<css::util::XUpdatable>::get() , - cppu::UnoType<css::ui::XUIConfigurationListener>::get() , - cppu::UnoType<css::container::XNameAccess>::get() }; - return ourTypeCollection.getTypes(); -} - MenuBarWrapper::MenuBarWrapper( - const css::uno::Reference< css::uno::XComponentContext >& rxContext + css::uno::Reference< css::uno::XComponentContext > xContext ) -: UIConfigElementWrapperBase( UIElementType::MENUBAR ), +: MenuBarWrapper_Base( UIElementType::MENUBAR ), m_bRefreshPopupControllerCache( true ), - m_xContext( rxContext ) + m_xContext(std::move( xContext )) { } @@ -236,11 +175,9 @@ void SAL_CALL MenuBarWrapper::updateSettings() { try { - MenuBarManager* pMenuBarManager = static_cast< MenuBarManager *>( m_xMenuBarManager.get() ); - m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL, false ); if ( m_xConfigData.is() ) - pMenuBarManager->SetItemContainer( m_xConfigData ); + m_xMenuBarManager->SetItemContainer( m_xConfigData ); } catch ( const NoSuchElementException& ) { @@ -254,19 +191,16 @@ void SAL_CALL MenuBarWrapper::updateSettings() void MenuBarWrapper::impl_fillNewData() { // Transient menubar => Fill menubar with new data - MenuBarManager* pMenuBarManager = static_cast< MenuBarManager *>( m_xMenuBarManager.get() ); - - if ( pMenuBarManager ) - pMenuBarManager->SetItemContainer( m_xConfigData ); + if ( m_xMenuBarManager ) + m_xMenuBarManager->SetItemContainer( m_xConfigData ); } void MenuBarWrapper::fillPopupControllerCache() { if ( m_bRefreshPopupControllerCache ) { - MenuBarManager* pMenuBarManager = static_cast< MenuBarManager *>( m_xMenuBarManager.get() ); - if ( pMenuBarManager ) - pMenuBarManager->GetPopupController( m_aPopupControllerCache ); + if ( m_xMenuBarManager ) + m_xMenuBarManager->GetPopupController( m_aPopupControllerCache ); if ( !m_aPopupControllerCache.empty() ) m_bRefreshPopupControllerCache = false; } @@ -305,7 +239,7 @@ Any SAL_CALL MenuBarWrapper::getByName( throw container::NoSuchElementException(); uno::Reference< frame::XDispatchProvider > xDispatchProvider = pIter->second.m_xDispatchProvider; - return uno::makeAny( xDispatchProvider ); + return uno::Any( xDispatchProvider ); } Sequence< OUString > SAL_CALL MenuBarWrapper::getElementNames() @@ -343,7 +277,7 @@ Reference< XInterface > SAL_CALL MenuBarWrapper::getRealInterface() if ( m_bDisposed ) throw DisposedException(); - return Reference< XInterface >( m_xMenuBarManager, UNO_QUERY ); + return Reference< XInterface >( static_cast<cppu::OWeakObject*>(m_xMenuBarManager.get()), UNO_QUERY ); } } // namespace framework |