summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-08-28 17:07:56 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-08-28 17:07:56 +0200
commit9cfc64c66ff9e0f0251a006f039bf4e26a63147a (patch)
treeeeafbb04ed9439b8ee300000a99e9255e428f898 /framework
parent7f7e0a668204678b06d711487137a9f8b13c91e1 (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
Diffstat (limited to 'framework')
-rw-r--r--framework/source/uielement/menubarmanager.cxx37
1 files changed, 37 insertions, 0 deletions
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 26b1233fb7b8..0361632b54af 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -49,6 +49,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>
@@ -67,6 +68,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>
@@ -800,11 +803,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();