[Libreoffice-commits] core.git: cui/source include/sfx2 officecfg/registry sc/sdi sc/uiconfig sc/UIConfig_scalc.mk sd/uiconfig sd/UIConfig_simpress.mk sfx2/Library_sfx.mk sfx2/source sw/sdi sw/uiconfig sw/UIConfig_swriter.mk

Maxim Monastirsky momonasmon at gmail.com
Mon Jan 16 13:08:21 UTC 2017


 cui/source/customize/cfg.cxx                                            |    8 
 include/sfx2/dispatch.hxx                                               |    4 
 officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu    |    5 
 officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu |    5 
 officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu  |    5 
 sc/UIConfig_scalc.mk                                                    |    1 
 sc/sdi/scalc.sdi                                                        |    1 
 sc/uiconfig/scalc/popupmenu/notebookbar.xml                             |   19 +
 sd/UIConfig_simpress.mk                                                 |    1 
 sd/uiconfig/simpress/popupmenu/notebookbar.xml                          |   19 +
 sfx2/Library_sfx.mk                                                     |    1 
 sfx2/source/control/dispatch.cxx                                        |    4 
 sfx2/source/dialog/dialog.src                                           |   55 -----
 sfx2/source/inc/sfxlocal.hrc                                            |    2 
 sfx2/source/notebookbar/NotebookBarPopupMenu.cxx                        |   96 ----------
 sfx2/source/notebookbar/NotebookBarPopupMenu.hxx                        |   23 --
 sfx2/source/notebookbar/SfxNotebookBar.cxx                              |   17 -
 sw/UIConfig_swriter.mk                                                  |    1 
 sw/sdi/swriter.sdi                                                      |    1 
 sw/uiconfig/swriter/popupmenu/notebookbar.xml                           |   19 +
 20 files changed, 97 insertions(+), 190 deletions(-)

New commits:
commit 535f2b2b0a21407c4412d14149d271a199c3e6b8
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Sun Jan 15 21:02:49 2017 +0200

    Convert RID_MENU_NOTEBOOKBAR to xml
    
    Brings a lot of features (icons, keyboard shortcuts,
    customization, context menu interception etc.)
    
    Other changes:
    
    - Make SfxDispatcher::ExecutePopup take PopupMenuFlags
      arg, to be able to pass NoMouseUpClose, so that the
      menu won't close on mouse-up under anything != gtk3.
    - Make .uno:OpenFromWriter and .uno:OpenFromCalc async
      slots, to avoid crash under gtk3 when recycling the
      current frame.
    - Don't show the menu in customization dialog, if
      experimental mode disabled.
    
    Change-Id: Ieea2f73f6b48fbaf4bdfc4acf1a33d25422357cb
    Reviewed-on: https://gerrit.libreoffice.org/33101
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Maxim Monastirsky <momonasmon at gmail.com>

diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 695a51c..a3406f2 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -1358,6 +1358,8 @@ SvxEntries* ContextMenuSaveInData::GetEntries()
 {
     if ( !m_pRootEntry )
     {
+        bool bExperimental = SvtMiscOptions().IsExperimentalMode();
+
         typedef std::unordered_map< OUString, bool, OUStringHash > MenuInfo;
         MenuInfo aMenuInfo;
 
@@ -1382,6 +1384,9 @@ SvxEntries* ContextMenuSaveInData::GetEntries()
                 }
             }
 
+            if ( !bExperimental && aUrl.endsWith("notebookbar") )
+                continue;
+
             css::uno::Reference< css::container::XIndexAccess > xPopupMenu;
             try
             {
@@ -1430,6 +1435,9 @@ SvxEntries* ContextMenuSaveInData::GetEntries()
                 }
             }
 
+            if ( !bExperimental && aUrl.endsWith("notebookbar") )
+                continue;
+
             css::uno::Reference< css::container::XIndexAccess > xPopupMenu;
             try
             {
diff --git a/include/sfx2/dispatch.hxx b/include/sfx2/dispatch.hxx
index ac675cc..92d0b42 100644
--- a/include/sfx2/dispatch.hxx
+++ b/include/sfx2/dispatch.hxx
@@ -25,6 +25,7 @@
 
 #include <sfx2/bindings.hxx>
 #include <sfx2/viewfrm.hxx>
+#include <vcl/menu.hxx>
 #include <o3tl/typed_flags_set.hxx>
 
 #include <initializer_list>
@@ -147,7 +148,8 @@ public:
     SfxViewFrame*       GetFrame() const;
     SfxModule*          GetModule() const;
 
-    void                ExecutePopup( const OUString &rResName, vcl::Window *pWin = nullptr, const Point *pPos = nullptr );
+    void                ExecutePopup( const OUString &rResName, vcl::Window *pWin = nullptr, const Point *pPos = nullptr,
+                                      PopupMenuFlags nFlags = PopupMenuFlags::ExecuteDown );
     static void         ExecutePopup( vcl::Window *pWin = nullptr, const Point *pPosPixel = nullptr );
 
     bool                IsAppDispatcher() const;
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu
index 0a797cd..0bbaab8 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu
@@ -75,6 +75,11 @@
           <value xml:lang="en-US">Media</value>
         </prop>
       </node>
+      <node oor:name="private:resource/popupmenu/notebookbar" oor:op="replace">
+        <prop oor:name="UIName" oor:type="xs:string">
+          <value xml:lang="en-US">Notebookbar</value>
+        </prop>
+      </node>
       <node oor:name="private:resource/popupmenu/oleobject" oor:op="replace">
         <prop oor:name="UIName" oor:type="xs:string">
           <value xml:lang="en-US">OLE Object</value>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu
index 9669f88..2f81b11 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu
@@ -100,6 +100,11 @@
           <value xml:lang="en-US">Multiple Selection</value>
         </prop>
       </node>
+      <node oor:name="private:resource/popupmenu/notebookbar" oor:op="replace">
+        <prop oor:name="UIName" oor:type="xs:string">
+          <value xml:lang="en-US">Notebookbar</value>
+        </prop>
+      </node>
       <node oor:name="private:resource/popupmenu/oleobject" oor:op="replace">
         <prop oor:name="UIName" oor:type="xs:string">
           <value xml:lang="en-US">OLE Object</value>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu
index f1eb33d..740462a 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu
@@ -60,6 +60,11 @@
           <value xml:lang="en-US">Media</value>
         </prop>
       </node>
+      <node oor:name="private:resource/popupmenu/notebookbar" oor:op="replace">
+        <prop oor:name="UIName" oor:type="xs:string">
+          <value xml:lang="en-US">Notebookbar</value>
+        </prop>
+      </node>
       <node oor:name="private:resource/popupmenu/oleobject" oor:op="replace">
         <prop oor:name="UIName" oor:type="xs:string">
           <value xml:lang="en-US">OLE Object</value>
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 056dbda..89527f36 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -35,6 +35,7 @@ $(eval $(call gb_UIConfig_add_popupmenufiles,modules/scalc,\
 	sc/uiconfig/scalc/popupmenu/freezepanes \
 	sc/uiconfig/scalc/popupmenu/graphic \
 	sc/uiconfig/scalc/popupmenu/media \
+	sc/uiconfig/scalc/popupmenu/notebookbar \
 	sc/uiconfig/scalc/popupmenu/oleobject \
 	sc/uiconfig/scalc/popupmenu/pagebreak \
 	sc/uiconfig/scalc/popupmenu/pivot \
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index aff8050..2ca2a7b 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -6468,6 +6468,7 @@ SfxVoidItem OpenFromCalc SID_OPEN_CALC
     Container = FALSE,
     RecordAbsolute = FALSE,
     RecordPerSet;
+    Asynchron;
 
     SlotType = SfxStringItem
 
diff --git a/sc/uiconfig/scalc/popupmenu/notebookbar.xml b/sc/uiconfig/scalc/popupmenu/notebookbar.xml
new file mode 100644
index 0000000..29356d5
--- /dev/null
+++ b/sc/uiconfig/scalc/popupmenu/notebookbar.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+-->
+<menu:menupopup xmlns:menu="http://openoffice.org/2001/menu">
+  <menu:menuitem menu:id=".uno:OpenFromCalc"/>
+  <menu:menuitem menu:id=".uno:Save"/>
+  <menu:menuitem menu:id=".uno:Undo"/>
+  <menu:menuitem menu:id=".uno:Redo"/>
+  <menu:menuitem menu:id=".uno:Print"/>
+  <menu:menuitem menu:id=".uno:Menubar"/>
+  <menu:menuitem menu:id=".uno:OptionsTreeDialog"/>
+  <menu:menuitem menu:id=".uno:CloseDoc"/>
+</menu:menupopup>
diff --git a/sd/UIConfig_simpress.mk b/sd/UIConfig_simpress.mk
index a2930ac..f268c00 100644
--- a/sd/UIConfig_simpress.mk
+++ b/sd/UIConfig_simpress.mk
@@ -31,6 +31,7 @@ $(eval $(call gb_UIConfig_add_popupmenufiles,modules/simpress,\
 	sd/uiconfig/simpress/popupmenu/measure \
 	sd/uiconfig/simpress/popupmenu/media \
 	sd/uiconfig/simpress/popupmenu/multiselect \
+	sd/uiconfig/simpress/popupmenu/notebookbar \
 	sd/uiconfig/simpress/popupmenu/oleobject \
 	sd/uiconfig/simpress/popupmenu/outlinetext \
 	sd/uiconfig/simpress/popupmenu/outline \
diff --git a/sd/uiconfig/simpress/popupmenu/notebookbar.xml b/sd/uiconfig/simpress/popupmenu/notebookbar.xml
new file mode 100644
index 0000000..7814a63
--- /dev/null
+++ b/sd/uiconfig/simpress/popupmenu/notebookbar.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+-->
+<menu:menupopup xmlns:menu="http://openoffice.org/2001/menu">
+  <menu:menuitem menu:id=".uno:Open"/>
+  <menu:menuitem menu:id=".uno:Save"/>
+  <menu:menuitem menu:id=".uno:Undo"/>
+  <menu:menuitem menu:id=".uno:Redo"/>
+  <menu:menuitem menu:id=".uno:Print"/>
+  <menu:menuitem menu:id=".uno:Menubar"/>
+  <menu:menuitem menu:id=".uno:OptionsTreeDialog"/>
+  <menu:menuitem menu:id=".uno:CloseDoc"/>
+</menu:menupopup>
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 642e960..65e5286 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -242,7 +242,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
     sfx2/source/notebookbar/BigToolBox \
     sfx2/source/notebookbar/ContextVBox \
     sfx2/source/notebookbar/DropdownBox \
-    sfx2/source/notebookbar/NotebookBarPopupMenu \
     sfx2/source/notebookbar/NotebookbarToolBox \
     sfx2/source/notebookbar/PriorityHBox \
     sfx2/source/notebookbar/SfxNotebookBar \
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index dbb4a7b..93e5c77 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -1941,7 +1941,7 @@ void SfxDispatcher::ExecutePopup( vcl::Window *pWin, const Point *pPos )
     }
 }
 
-void SfxDispatcher::ExecutePopup( const OUString& rResName, vcl::Window *pWin, const Point* pPos )
+void SfxDispatcher::ExecutePopup( const OUString& rResName, vcl::Window* pWin, const Point* pPos, PopupMenuFlags nFlags )
 {
     css::uno::Sequence< css::uno::Any > aArgs( 3 );
     aArgs[0] <<= comphelper::makePropertyValue( "Value", rResName );
@@ -1986,7 +1986,7 @@ void SfxDispatcher::ExecutePopup( const OUString& rResName, vcl::Window *pWin, c
         OUString aMenuURL = "private:resource/popupmenu/" + rResName;
         if (pVCLMenu && GetFrame()->GetViewShell()->TryContextMenuInterception(*pVCLMenu, aMenuURL, aEvent))
         {
-            pVCLMenu->Execute(pWindow, aPos);
+            pVCLMenu->Execute(pWindow, Rectangle(aPos, aPos), nFlags);
         }
     }
 
diff --git a/sfx2/source/dialog/dialog.src b/sfx2/source/dialog/dialog.src
index 1c77c86..60128b6 100644
--- a/sfx2/source/dialog/dialog.src
+++ b/sfx2/source/dialog/dialog.src
@@ -126,59 +126,4 @@ String STR_PREVIEW_CHECKBOX
     Text [ en-US ] = "Show Previews";
 };
 
-Menu RID_MENU_NOTEBOOKBAR
-{
-    ItemList =
-    {
-        MenuItem
-        {
-            Identifier = SID_OPENDOC;
-            Command = ".uno:Open";
-            Text [ en-US ] = "Open..." ;
-        };
-        MenuItem
-        {
-            Identifier = SID_SAVEDOC;
-            Command = ".uno:Save";
-            Text [ en-US ] = "Save" ;
-        };
-        MenuItem
-        {
-            Identifier = SID_UNDO;
-            Command = ".uno:Undo";
-            Text [ en-US ] = "Undo" ;
-        };
-        MenuItem
-        {
-            Identifier = SID_REDO;
-            Command = ".uno:Redo";
-            Text [ en-US ] = "Redo" ;
-        };
-        MenuItem
-        {
-            Identifier = SID_PRINTDOC;
-            Command = ".uno:Print";
-            Text [ en-US ] = "Print" ;
-        };
-        MenuItem
-        {
-            Identifier = SID_MENUBAR;
-            Command = ".uno:Menubar";
-            Text [ en-US ] = "Menubar" ;
-        };
-        MenuItem
-        {
-            Identifier = SID_OPTIONS;
-            Command = ".uno:OptionsTreeDialog";
-            Text [ en-US ] = "Options" ;
-        };
-        MenuItem
-        {
-            Identifier = SID_CLOSEDOC;
-            Command = ".uno:CloseDoc";
-            Text [ en-US ] = "Close" ;
-        };
-    };
-};
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/inc/sfxlocal.hrc b/sfx2/source/inc/sfxlocal.hrc
index ea9f835..f1fa474 100644
--- a/sfx2/source/inc/sfxlocal.hrc
+++ b/sfx2/source/inc/sfxlocal.hrc
@@ -43,8 +43,6 @@
 #define SFX_IMG_PROPERTY_REMOVE             (RID_SFX_SFXLOCAL_START +  0)
 #define SFX_IMG_CLOSE_DOC                   (RID_SFX_SFXLOCAL_START +  2)
 
-#define RID_MENU_NOTEBOOKBAR                (RID_SFX_SFXLOCAL_START + 10)
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/notebookbar/NotebookBarPopupMenu.cxx b/sfx2/source/notebookbar/NotebookBarPopupMenu.cxx
deleted file mode 100644
index 9d36d01..0000000
--- a/sfx2/source/notebookbar/NotebookBarPopupMenu.cxx
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <sfx2/dispatch.hxx>
-#include <vcl/notebookbar.hxx>
-#include <vcl/menu.hxx>
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/util/URLTransformer.hpp>
-#include <sfxlocal.hrc>
-#include <sfx2/sfxresid.hxx>
-#include "NotebookBarPopupMenu.hxx"
-#include <vcl/tabctrl.hxx>
-#include <sfx2/notebookbar/SfxNotebookBar.hxx>
-
-using namespace sfx2;
-using namespace css::uno;
-using namespace css::ui;
-
-NotebookBarPopupMenu::NotebookBarPopupMenu()
-    : PopupMenu(SfxResId(RID_MENU_NOTEBOOKBAR))
-{
-    if (SfxViewFrame::Current())
-    {
-        SfxDispatcher* pDispatcher = SfxViewFrame::Current()->GetBindings().GetDispatcher();
-        if (pDispatcher)
-        {
-            for (int i = 0; i < GetItemCount(); ++i)
-            {
-                const SfxPoolItem* pItem;
-                SfxItemState eState = pDispatcher->QueryState(GetItemId(i), pItem);
-                if (eState == SfxItemState::DISABLED)
-                    this->EnableItem(GetItemId(i), false);
-                else
-                    this->EnableItem(GetItemId(i));
-            }
-        }
-    }
-    else
-    {
-        HideItem(SID_UNDO);
-        HideItem(SID_REDO);
-        HideItem(SID_PRINTDOC);
-        HideItem(SID_SAVEDOC);
-    }
-    EnableItem(SID_OPTIONS);
-}
-
-void NotebookBarPopupMenu::Execute(NotebookBar* pNotebookbar,
-                            const Reference<css::frame::XFrame>& xFrame)
-{
-    if (pNotebookbar)
-    {
-        sal_uInt16 nTop = NotebookbarTabControl::GetHeaderHeight();
-        sal_uInt16 nSelected = PopupMenu::Execute(pNotebookbar,
-                                    Rectangle(0, nTop, 0, nTop),
-                                    PopupMenuFlags::ExecuteDown|PopupMenuFlags::NoMouseUpClose);
-
-        if (nSelected)
-        {
-            OUString aCommandURL = GetItemCommand(nSelected);
-            css::util::URL aUrl;
-            aUrl.Complete = aCommandURL;
-
-            Reference<css::util::XURLTransformer> xURLTransformer(
-                css::util::URLTransformer::create(comphelper::getProcessComponentContext()));
-            if (xURLTransformer.is())
-                xURLTransformer->parseStrict(aUrl);
-
-            if (xFrame.is())
-            {
-                css::uno::Reference<css::frame::XDispatch> xDispatch;
-                css::uno::Reference<css::frame::XDispatchProvider> xDispatchProvider(xFrame, UNO_QUERY);
-
-                if (xDispatchProvider.is())
-                {
-                    xDispatch = xDispatchProvider->queryDispatch(aUrl, OUString(), 0);
-                }
-                if (xDispatch.is())
-                {
-                    Sequence<com::sun::star::beans::PropertyValue> aArgs;
-                    xDispatch->dispatch(aUrl, aArgs);
-                }
-            }
-            else
-                SAL_WARN("sfx", "Can't create XDispatchProvider");
-        }
-    }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/notebookbar/NotebookBarPopupMenu.hxx b/sfx2/source/notebookbar/NotebookBarPopupMenu.hxx
deleted file mode 100644
index 0d06a6e..0000000
--- a/sfx2/source/notebookbar/NotebookBarPopupMenu.hxx
+++ /dev/null
@@ -1,23 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <vcl/notebookbar.hxx>
-#include <vcl/menu.hxx>
-#include <sfxlocal.hrc>
-#include <sfx2/sfxresid.hxx>
-
-class NotebookBarPopupMenu : public PopupMenu
-{
-public:
-    explicit NotebookBarPopupMenu();
-    void Execute(NotebookBar* pNotebookbar,
-                const css::uno::Reference<css::frame::XFrame>& xFrame);
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index 8adf1c0..203c0f9 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -13,14 +13,13 @@
 #include <unotools/viewoptions.hxx>
 #include <vcl/notebookbar.hxx>
 #include <vcl/syswin.hxx>
-#include <vcl/menu.hxx>
+#include <vcl/tabctrl.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <comphelper/processfactory.hxx>
 #include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp>
 #include <com/sun/star/ui/XContextChangeEventMultiplexer.hpp>
 #include <com/sun/star/util/URLTransformer.hpp>
 #include <com/sun/star/frame/XLayoutManager.hpp>
-#include "NotebookBarPopupMenu.hxx"
 #include <officecfg/Office/UI/Notebookbar.hxx>
 #include <com/sun/star/frame/XModuleManager.hpp>
 #include <com/sun/star/frame/ModuleManager.hpp>
@@ -336,15 +335,13 @@ void SfxNotebookBar::RemoveListeners(SystemWindow* pSysWindow)
 
 IMPL_STATIC_LINK(SfxNotebookBar, OpenNotebookbarPopupMenu, NotebookBar*, pNotebookbar, void)
 {
-    if (pNotebookbar)
+    SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+    SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : nullptr;
+    if (pNotebookbar && pDispatcher)
     {
-        ScopedVclPtrInstance<NotebookBarPopupMenu> pMenu;
-        if (SfxViewFrame::Current())
-        {
-            const Reference<frame::XFrame>& xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface();
-            if (xFrame.is())
-                pMenu->Execute(pNotebookbar, xFrame);
-        }
+        Point aPos(0, NotebookbarTabControl::GetHeaderHeight());
+        pDispatcher->ExecutePopup("notebookbar", pNotebookbar, &aPos,
+                                  PopupMenuFlags::ExecuteDown|PopupMenuFlags::NoMouseUpClose);
     }
 }
 
diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index 2ff017f..532f0ba 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -24,6 +24,7 @@ $(eval $(call gb_UIConfig_add_popupmenufiles,modules/swriter,\
 	sw/uiconfig/swriter/popupmenu/graphic \
 	sw/uiconfig/swriter/popupmenu/insertfield \
 	sw/uiconfig/swriter/popupmenu/media \
+	sw/uiconfig/swriter/popupmenu/notebookbar \
 	sw/uiconfig/swriter/popupmenu/oleobject \
 	sw/uiconfig/swriter/popupmenu/preview \
 	sw/uiconfig/swriter/popupmenu/table \
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 494068a..4de6cbb 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -7408,6 +7408,7 @@ SfxVoidItem OpenFromWriter FN_OPEN_FILE
     Container = FALSE,
     RecordAbsolute = FALSE,
     RecordPerSet;
+    Asynchron;
 
     SlotType = SfxStringItem
 
diff --git a/sw/uiconfig/swriter/popupmenu/notebookbar.xml b/sw/uiconfig/swriter/popupmenu/notebookbar.xml
new file mode 100644
index 0000000..d37082e
--- /dev/null
+++ b/sw/uiconfig/swriter/popupmenu/notebookbar.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+-->
+<menu:menupopup xmlns:menu="http://openoffice.org/2001/menu">
+  <menu:menuitem menu:id=".uno:OpenFromWriter"/>
+  <menu:menuitem menu:id=".uno:Save"/>
+  <menu:menuitem menu:id=".uno:Undo"/>
+  <menu:menuitem menu:id=".uno:Redo"/>
+  <menu:menuitem menu:id=".uno:Print"/>
+  <menu:menuitem menu:id=".uno:Menubar"/>
+  <menu:menuitem menu:id=".uno:OptionsTreeDialog"/>
+  <menu:menuitem menu:id=".uno:CloseDoc"/>
+</menu:menupopup>


More information about the Libreoffice-commits mailing list