summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-08-28 17:07:56 +0200
committerBjörn Michaelsen <bjoern.michaelsen@canonical.com>2012-08-29 08:33:33 +0000
commit88c8616270c2157d1a54ba54ddc4bdfae1cd1825 (patch)
tree94c170471cfd99193c7babe278160c8fcf4b7008
parentfa5d53a4fb05f690cd59de274fb5d5fd1b42f677 (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). (cherry picked from commit 9cfc64c66ff9e0f0251a006f039bf4e26a63147a) Change-Id: I6ae303c0084549b5339d219e158cdb89e5a6b331 Reviewed-on: https://gerrit.libreoffice.org/505 Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com> Tested-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
-rw-r--r--framework/source/uielement/menubarmanager.cxx40
1 files changed, 40 insertions, 0 deletions
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 5b9cfb338720..2234b0597d62 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>
@@ -819,11 +822,48 @@ 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.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(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();