diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-08-28 17:07:56 +0200 |
---|---|---|
committer | Björn Michaelsen <bjoern.michaelsen@canonical.com> | 2012-08-29 08:34:00 +0000 |
commit | ba08ba5b30f906b795360ce4579721b25e316ae7 (patch) | |
tree | 83ddec0b58a594af2fb80aebca29657b36fd4336 /framework | |
parent | 7da3738ab903a180b5038ee92ad40869fdbff950 (diff) |
fdo#36149: Do not display error dialogs while showing a menu
...it apparently leads to crashes, but is probably not good from a usability
perspective anyway (as the menu closes again when the dialog appears/is operated
on by the user).
For now, just disable the Java specific interaction handler here; might make
sense to address this more generally though (there's framework::QuietInteraction
btw).
Change-Id: I6ae303c0084549b5339d219e158cdb89e5a6b331
(cherry picked from commit 9cfc64c66ff9e0f0251a006f039bf4e26a63147a)
Reviewed-on: https://gerrit.libreoffice.org/504
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Tested-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/source/uielement/menubarmanager.cxx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 0aedb9c1320f..685d98898d51 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -57,6 +57,7 @@ #include <com/sun/star/container/XEnumeration.hpp> #include <com/sun/star/util/XStringWidth.hpp> #include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/uno/XCurrentContext.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/frame/XPopupMenuController.hpp> #include <com/sun/star/frame/XUIControllerRegistration.hpp> @@ -76,6 +77,8 @@ #include <comphelper/processfactory.hxx> #include <comphelper/extract.hxx> #include <svtools/menuoptions.hxx> +#include <svtools/javainteractionhandler.hxx> +#include <uno/current_context.hxx> #include <unotools/historyoptions.hxx> #include <unotools/pathoptions.hxx> #include <unotools/cmdoptions.hxx> @@ -815,11 +818,45 @@ static void lcl_CheckForChildren(Menu* pMenu, sal_uInt16 nItemId) // vcl handler //_________________________________________________________________________________________________________________ +namespace { + +class QuietInteractionContext: + public cppu::WeakImplHelper1< com::sun::star::uno::XCurrentContext >, + private boost::noncopyable +{ +public: + QuietInteractionContext( + com::sun::star::uno::Reference< com::sun::star::uno::XCurrentContext > + const & context): + context_(context) {} + +private: + virtual ~QuietInteractionContext() {} + + virtual com::sun::star::uno::Any SAL_CALL getValueByName( + rtl::OUString const & Name) + throw (com::sun::star::uno::RuntimeException) + { + return Name != JAVA_INTERACTION_HANDLER_NAME && context_.is() + ? context_->getValueByName(Name) + : com::sun::star::uno::Any(); + } + + com::sun::star::uno::Reference< com::sun::star::uno::XCurrentContext > + context_; +}; + +} + IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::Activate" ); if ( pMenu == m_pVCLMenu ) { + com::sun::star::uno::ContextLayer layer( + new QuietInteractionContext( + com::sun::star::uno::getCurrentContext())); + // set/unset hiding disabled menu entries sal_Bool bDontHide = SvtMenuOptions().IsEntryHidingEnabled(); const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); |