[Libreoffice-commits] .: Branch 'libreoffice-3-6' - framework/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Aug 29 01:34:26 PDT 2012


 framework/source/uielement/menubarmanager.cxx |   37 ++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

New commits:
commit ba08ba5b30f906b795360ce4579721b25e316ae7
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Aug 28 17:07:56 2012 +0200

    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 at canonical.com>
    Tested-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>

diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 0aedb9c..685d988 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 at 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();


More information about the Libreoffice-commits mailing list