[Libreoffice-commits] core.git: 3 commits - include/sfx2 officecfg/registry sc/AllLangResTarget_sc.mk sc/inc sc/source sc/uiconfig sc/UIConfig_scalc.mk sfx2/source

Maxim Monastirsky momonasmon at gmail.com
Fri Dec 18 03:31:52 PST 2015


 include/sfx2/dispatch.hxx                                            |    4 
 officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu    |    8 
 officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu |    9 
 sc/AllLangResTarget_sc.mk                                            |    1 
 sc/UIConfig_scalc.mk                                                 |    1 
 sc/inc/sc.hrc                                                        |   23 -
 sc/inc/sccommands.h                                                  |   12 
 sc/source/ui/src/popup.src                                           |  123 ----------
 sc/source/ui/view/tabcont.cxx                                        |    2 
 sc/uiconfig/scalc/popupmenu/audit.xml                                |    4 
 sc/uiconfig/scalc/popupmenu/pivot.xml                                |    4 
 sc/uiconfig/scalc/popupmenu/sheettab.xml                             |   31 ++
 sfx2/source/control/dispatch.cxx                                     |   64 ++---
 13 files changed, 103 insertions(+), 183 deletions(-)

New commits:
commit 8a664fd83f70282d000aaedc626f1fa09a99161e
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Fri Dec 18 13:19:28 2015 +0200

    tdf#93837 Convert RID_POPUP_TAB to xml
    
    Change-Id: Ia05fb0a568c29d7990a8a837e1df953358acfa1f

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index 4da1213..ff1091f 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -1602,6 +1602,9 @@
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">Sheet ~Tab Color...</value>
         </prop>
+        <prop oor:name="PopupLabel" oor:type="xs:string">
+          <value xml:lang="en-US">~Tab Color...</value>
+        </prop>
       </node>
       <node oor:name=".uno:TabBgColor" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
@@ -1826,6 +1829,9 @@
         <prop oor:name="ContextLabel" oor:type="xs:string">
           <value xml:lang="en-US">R~ight-To-Left</value>
         </prop>
+        <prop oor:name="PopupLabel" oor:type="xs:string">
+          <value xml:lang="en-US">Sheet R~ight-To-Left</value>
+        </prop>
       </node>
       <node oor:name=".uno:SetAnchorToPage" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu
index 64caade..9adc27e 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu
@@ -85,6 +85,11 @@
           <value xml:lang="en-US">Print Preview</value>
         </prop>
       </node>
+      <node oor:name="private:resource/popupmenu/sheettab" oor:op="replace">
+        <prop oor:name="UIName" oor:type="xs:string">
+          <value xml:lang="en-US">Sheet Tabs Bar</value>
+        </prop>
+      </node>
       <node oor:name="private:resource/toolbar/graffilterbar" oor:op="replace">
         <prop oor:name="Docked" oor:type="xs:boolean">
           <value>false</value>
diff --git a/sc/AllLangResTarget_sc.mk b/sc/AllLangResTarget_sc.mk
index 11dffec..57035f0 100644
--- a/sc/AllLangResTarget_sc.mk
+++ b/sc/AllLangResTarget_sc.mk
@@ -33,7 +33,6 @@ $(eval $(call gb_SrsTarget_set_include,sc/res,\
 ))
 
 $(eval $(call gb_SrsTarget_add_files,sc/res,\
-    sc/source/ui/src/popup.src \
     sc/source/ui/src/globstr.src \
     sc/source/ui/src/toolbox.src \
     sc/source/ui/src/scfuncs.src \
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index c124665..f5ec631 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -33,6 +33,7 @@ $(eval $(call gb_UIConfig_add_popupmenufiles,modules/scalc,\
 	sc/uiconfig/scalc/popupmenu/pagebreak \
 	sc/uiconfig/scalc/popupmenu/pivot \
 	sc/uiconfig/scalc/popupmenu/preview \
+	sc/uiconfig/scalc/popupmenu/sheettab \
 ))
 
 $(eval $(call gb_UIConfig_add_statusbarfiles,modules/scalc,\
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 4241157..e9a5f61 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -411,18 +411,17 @@
 #define DATA_MENU_END           (DATA_MENU_START + 29)
 
 #define TAB_POPUP_START         (DATA_MENU_END)
-#define RID_POPUP_TAB           (TAB_POPUP_START)
-#define FID_TAB_MENU_RENAME     (TAB_POPUP_START+1)
-#define FID_TAB_RENAME          (TAB_POPUP_START+2)
-#define FID_TAB_MOVE            (TAB_POPUP_START+3)
-#define FID_TAB_SELECTALL       (TAB_POPUP_START+4)
-#define FID_TAB_APPEND          (TAB_POPUP_START+5)
-#define FID_TAB_INDEX           (TAB_POPUP_START+6)
-#define FID_TAB_RTL             (TAB_POPUP_START+7)
-#define FID_TAB_DESELECTALL     (TAB_POPUP_START+8)
-#define FID_TAB_MENU_SET_TAB_BG_COLOR (TAB_POPUP_START + 9)
-#define FID_TAB_SET_TAB_BG_COLOR      (TAB_POPUP_START + 10)
-#define FID_TAB_EVENTS          (TAB_POPUP_START+11)
+#define FID_TAB_MENU_RENAME     (TAB_POPUP_START)
+#define FID_TAB_RENAME          (TAB_POPUP_START+1)
+#define FID_TAB_MOVE            (TAB_POPUP_START+2)
+#define FID_TAB_SELECTALL       (TAB_POPUP_START+3)
+#define FID_TAB_APPEND          (TAB_POPUP_START+4)
+#define FID_TAB_INDEX           (TAB_POPUP_START+5)
+#define FID_TAB_RTL             (TAB_POPUP_START+6)
+#define FID_TAB_DESELECTALL     (TAB_POPUP_START+7)
+#define FID_TAB_MENU_SET_TAB_BG_COLOR (TAB_POPUP_START + 8)
+#define FID_TAB_SET_TAB_BG_COLOR      (TAB_POPUP_START + 9)
+#define FID_TAB_EVENTS          (TAB_POPUP_START+10)
 
 #define TAB_POPUP_END           (TAB_POPUP_START + 20)
 
diff --git a/sc/inc/sccommands.h b/sc/inc/sccommands.h
index 009621f..706555d 100644
--- a/sc/inc/sccommands.h
+++ b/sc/inc/sccommands.h
@@ -24,10 +24,8 @@
 #define CMD_SID_DEL_COLS                            ".uno:DeleteColumns"
 #define CMD_SID_DEL_ROWS                            ".uno:DeleteRows"
 #define CMD_FID_CELL_FORMAT                         ".uno:FormatCellDialog"
-#define CMD_FID_TABLE_HIDE                          ".uno:Hide"
 #define CMD_FID_COL_HIDE                            ".uno:HideColumn"
 #define CMD_FID_ROW_HIDE                            ".uno:HideRow"
-#define CMD_FID_INS_TABLE                           ".uno:Insert"
 #define CMD_FID_INS_COLUMNS_AFTER                   ".uno:InsertColumnsAfter"
 #define CMD_FID_INS_COLUMN                          ".uno:InsertColumns"
 #define CMD_FID_INS_COLUMNS_BEFORE                  ".uno:InsertColumnsBefore"
@@ -35,22 +33,12 @@
 #define CMD_FID_INS_ROW                             ".uno:InsertRows"
 #define CMD_FID_INS_ROWS_BEFORE                     ".uno:InsertRowsBefore"
 #define CMD_SID_OBJECT_MIRROR                       ".uno:Mirror"
-#define CMD_FID_TAB_MOVE                            ".uno:Move"
-#define CMD_FID_PROTECT_TABLE                       ".uno:Protect"
-#define CMD_FID_DELETE_TABLE                        ".uno:Remove"
 #define CMD_FID_ROW_HEIGHT                          ".uno:RowHeight"
 #define CMD_FID_COL_OPT_WIDTH                       ".uno:SetOptimalColumnWidth"
 #define CMD_FID_ROW_OPT_HEIGHT                      ".uno:SetOptimalRowHeight"
-#define CMD_FID_TABLE_SHOW                          ".uno:Show"
 #define CMD_FID_COL_SHOW                            ".uno:ShowColumn"
 #define CMD_FID_ROW_SHOW                            ".uno:ShowRow"
-#define CMD_FID_TAB_MENU_RENAME                     ".uno:RenameTable"
-#define CMD_FID_TAB_SELECTALL                       ".uno:TableSelectAll"
-#define CMD_FID_TAB_DESELECTALL                     ".uno:TableDeselectAll"
 #define CMD_SID_ULINE_VAL_DOUBLE                    ".uno:UnderlineDouble"
-#define CMD_FID_TAB_RTL                             ".uno:SheetRightToLeft"
-#define CMD_FID_TAB_EVENTS                          ".uno:TableEvents"
-#define CMD_FID_TAB_MENU_SET_TAB_BG_COLOR           ".uno:SetTabBgColor"
 #define CMD_FID_TAB_SET_TAB_BG_COLOR                ".uno:TabBgColor"
 
 #endif
diff --git a/sc/source/ui/src/popup.src b/sc/source/ui/src/popup.src
deleted file mode 100644
index b506e02..0000000
--- a/sc/source/ui/src/popup.src
+++ /dev/null
@@ -1,123 +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/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "sc.hrc"
-#include <svx/globlmn.hrc>
-
- // Popup-Menues ----------------------------------------------------------------
-
-String RID_POPUP_TAB
-{
-    Text [ en-US ] = "Sheet bar pop-up menu" ;
-};
-
-Menu RID_POPUP_TAB
-{
-    ItemList =
-    {
-        MenuItem
-        {
-            Identifier = FID_INS_TABLE ;
-            HelpId = CMD_FID_INS_TABLE ;
-            Text [ en-US ] = "~Insert Sheet..." ;
-        };
-        MenuItem
-        {
-            Identifier = FID_DELETE_TABLE ;
-            HelpId = CMD_FID_DELETE_TABLE ;
-            Text [ en-US ] = "~Delete Sheet..." ;
-        };
-        MenuItem
-        {
-            Identifier = FID_TAB_MENU_RENAME ;
-            HelpId = CMD_FID_TAB_MENU_RENAME ;
-            Text [ en-US ] = "~Rename Sheet..." ;
-        };
-        MenuItem
-        {
-            Identifier = FID_TAB_MOVE ;
-            HelpId = CMD_FID_TAB_MOVE ;
-            Text [ en-US ] = "~Move/Copy Sheet..." ;
-        };
-
-        MenuItem { Separator = TRUE ; };
-
-        MenuItem
-        {
-            Identifier = FID_TAB_MENU_SET_TAB_BG_COLOR ;
-            HelpId = CMD_FID_TAB_MENU_SET_TAB_BG_COLOR ;
-            Text [ en-US ] = "~Tab Color..." ;
-        };
-        MenuItem
-        {
-            Identifier = FID_PROTECT_TABLE ;
-            HelpId = CMD_FID_PROTECT_TABLE ;
-            Text [ en-US ] = "~Protect Sheet..." ;
-        };
-        MenuItem
-        {
-            Identifier = FID_TAB_TOGGLE_GRID ;
-            Text [ en-US ] = "Sheet ~Gridlines" ;
-        };
-        MenuItem
-        {
-            Identifier = FID_TAB_RTL ;
-            HelpId = CMD_FID_TAB_RTL ;
-            Text [ en-US ] = "S~heet Right-To-Left" ;
-        };
-        MenuItem
-        {
-            Identifier = FID_TAB_EVENTS ;
-            HelpId = CMD_FID_TAB_EVENTS ;
-            Text [ en-US ] = "Sheet E~vents..." ;
-        };
-
-        MenuItem { Separator = TRUE ; };
-
-        MenuItem
-        {
-            Identifier = FID_TABLE_HIDE ;
-            HelpId = CMD_FID_TABLE_HIDE ;
-            Text [ en-US ] = "~Hide" ;
-        };
-        MenuItem
-        {
-            Identifier = FID_TABLE_SHOW ;
-            HelpId = CMD_FID_TABLE_SHOW ;
-            Text [ en-US ] = "~Show..." ;
-        };
-
-        MenuItem { Separator = TRUE ; };
-
-        MenuItem
-        {
-            Identifier = FID_TAB_SELECTALL ;
-            HelpId = CMD_FID_TAB_SELECTALL ;
-            Text [ en-US ] = "Select All S~heets" ;
-        };
-        MenuItem
-        {
-            Identifier = FID_TAB_DESELECTALL ;
-            HelpId = CMD_FID_TAB_DESELECTALL ;
-            Text [ en-US ] = "D~eselect All Sheets" ;
-        };
-    };
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index 70fecfa..7926f72 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -430,7 +430,7 @@ void ScTabControl::Command( const CommandEvent& rCEvt )
 
         //  Popup-Menu:
         //  get Dispatcher from ViewData (ViewFrame) instead of Shell (Frame), so it can't be null
-        pViewData->GetDispatcher().ExecutePopup( ScResId(RID_POPUP_TAB) );
+        pViewData->GetDispatcher().ExecutePopup( "sheettab" );
     }
 }
 
diff --git a/sc/uiconfig/scalc/popupmenu/sheettab.xml b/sc/uiconfig/scalc/popupmenu/sheettab.xml
new file mode 100644
index 0000000..fea1a32
--- /dev/null
+++ b/sc/uiconfig/scalc/popupmenu/sheettab.xml
@@ -0,0 +1,31 @@
+<?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:Cut"/>
+  <menu:menuitem menu:id=".uno:Copy"/>
+  <menu:menuitem menu:id=".uno:Paste"/>
+  <menu:menuseparator/>
+  <menu:menuitem menu:id=".uno:Insert"/>
+  <menu:menuitem menu:id=".uno:Remove"/>
+  <menu:menuitem menu:id=".uno:RenameTable"/>
+  <menu:menuitem menu:id=".uno:Move"/>
+  <menu:menuseparator/>
+  <menu:menuitem menu:id=".uno:SetTabBgColor"/>
+  <menu:menuitem menu:id=".uno:Protect"/>
+  <menu:menuitem menu:id=".uno:ToggleSheetGrid"/>
+  <menu:menuitem menu:id=".uno:SheetRightToLeft"/>
+  <menu:menuitem menu:id=".uno:TableEvents"/>
+  <menu:menuseparator/>
+  <menu:menuitem menu:id=".uno:Hide"/>
+  <menu:menuitem menu:id=".uno:Show"/>
+  <menu:menuseparator/>
+  <menu:menuitem menu:id=".uno:TableSelectAll"/>
+  <menu:menuitem menu:id=".uno:TableDeselectAll"/>
+</menu:menupopup>
commit 3b685bffc9af809109ee777f2d5a29cd907c7faa
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Fri Dec 18 02:36:48 2015 +0200

    Small corrections to Calc context menus
    
    - Re-add clipboard functions to Auditing and Pivot table menus.
      (In the old implementation, clipboard functions were added to
      all context menu unconditionally at runtime. This led to odd
      things like the clipboard functions visible in print preview.
      Luckily now we can decide which menu should have them.)
    
    - Rename Auditing menu to "Detective", to match the menubar.
    
    - Rename "Edit Cell" menu name to "Cell Edit".
    
    - Rename the page style dialog command back to "Format Page"
      to match the menubar (Format->Page).
    
    Change-Id: I41b7aba8adacbf1ac995be846cd2af3edd52b1c0

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index 80f887c..4da1213 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -1374,7 +1374,7 @@
           <value xml:lang="en-US">~Page...</value>
         </prop>
         <prop oor:name="PopupLabel" oor:type="xs:string">
-          <value xml:lang="en-US">Pa~ge Layout...</value>
+          <value xml:lang="en-US">Format Pa~ge...</value>
         </prop>
       </node>
       <node oor:name=".uno:StandardTextAttributes" oor:op="replace">
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu
index 61ab0b6..64caade 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu
@@ -22,7 +22,7 @@
     <node oor:name="States">
       <node oor:name="private:resource/popupmenu/audit" oor:op="replace">
         <prop oor:name="UIName" oor:type="xs:string">
-          <value xml:lang="en-US">Auditing</value>
+          <value xml:lang="en-US">Detective</value>
         </prop>
       </node>
       <node oor:name="private:resource/popupmenu/cell" oor:op="replace">
@@ -32,7 +32,7 @@
       </node>
       <node oor:name="private:resource/popupmenu/celledit" oor:op="replace">
         <prop oor:name="UIName" oor:type="xs:string">
-          <value xml:lang="en-US">Edit Cell</value>
+          <value xml:lang="en-US">Cell Edit</value>
         </prop>
       </node>
       <node oor:name="private:resource/popupmenu/chart" oor:op="replace">
diff --git a/sc/uiconfig/scalc/popupmenu/audit.xml b/sc/uiconfig/scalc/popupmenu/audit.xml
index 8ef73ae..216d626 100644
--- a/sc/uiconfig/scalc/popupmenu/audit.xml
+++ b/sc/uiconfig/scalc/popupmenu/audit.xml
@@ -8,6 +8,10 @@
  *
 -->
 <menu:menupopup xmlns:menu="http://openoffice.org/2001/menu">
+  <menu:menuitem menu:id=".uno:Cut"/>
+  <menu:menuitem menu:id=".uno:Copy"/>
+  <menu:menuitem menu:id=".uno:Paste"/>
+  <menu:menuseparator/>
   <menu:menuitem menu:id=".uno:FillModeTracePredescessor"/>
   <menu:menuitem menu:id=".uno:FillModeRemovePredescessor"/>
   <menu:menuitem menu:id=".uno:FillModeTraceSuccessor"/>
diff --git a/sc/uiconfig/scalc/popupmenu/pivot.xml b/sc/uiconfig/scalc/popupmenu/pivot.xml
index 290b62b..59433c5 100644
--- a/sc/uiconfig/scalc/popupmenu/pivot.xml
+++ b/sc/uiconfig/scalc/popupmenu/pivot.xml
@@ -8,6 +8,10 @@
  *
 -->
 <menu:menupopup xmlns:menu="http://openoffice.org/2001/menu">
+  <menu:menuitem menu:id=".uno:Cut"/>
+  <menu:menuitem menu:id=".uno:Copy"/>
+  <menu:menuitem menu:id=".uno:Paste"/>
+  <menu:menuseparator/>
   <menu:menuitem menu:id=".uno:DataDataPilotRun"/>
   <menu:menuitem menu:id=".uno:RecalcPivotTable"/>
   <menu:menuitem menu:id=".uno:DataPilotFilter"/>
commit 399fd4153993c3677eaaf0ad01700d64a1cb5b2c
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Thu Dec 17 01:29:29 2015 +0200

    tdf#93837 sfx2: Allow loading xml menus by resource name
    
    Change-Id: Ibaeeb0f891017862578440ad874f2ceb91d11874

diff --git a/include/sfx2/dispatch.hxx b/include/sfx2/dispatch.hxx
index f09fe3a..c6bc458 100644
--- a/include/sfx2/dispatch.hxx
+++ b/include/sfx2/dispatch.hxx
@@ -157,8 +157,8 @@ public:
     // caller has to clean up the Manager on his own
     static SfxPopupMenuManager* Popup( sal_uInt16 nConfigId, vcl::Window *pWin, const Point *pPos );
 
-    void                ExecutePopup( const ResId &rId,
-                              vcl::Window *pWin = nullptr, const Point *pPosPixel = nullptr );
+    void                ExecutePopup( const ResId &rId, vcl::Window *pWin = nullptr, const Point *pPos = nullptr );
+    void                ExecutePopup( const OUString &rResName, vcl::Window *pWin = nullptr, const Point *pPos = nullptr );
     static void         ExecutePopup( vcl::Window *pWin = nullptr, const Point *pPosPixel = nullptr );
 
     bool                IsAppDispatcher() const;
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 2dc5ac8..12444ef 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -1882,45 +1882,18 @@ void SfxDispatcher::ExecutePopup( vcl::Window *pWin, const Point *pPos )
     if ( rDisp.xImp->bQuiet )
         nShLevel = rDisp.xImp->aStack.size();
 
-    vcl::Window *pWindow = pWin ? pWin : rDisp.xImp->pFrame->GetFrame().GetWorkWindow_Impl()->GetWindow();
-    Point aPos = pPos ? *pPos : pWindow->GetPointerPosPixel();
     for ( pSh = rDisp.GetShell(nShLevel); pSh; ++nShLevel, pSh = rDisp.GetShell(nShLevel) )
     {
         const ResId& rResId = pSh->GetInterface()->GetPopupMenuResId();
         const OUString& rResName = pSh->GetInterface()->GetPopupMenuName();
         if ( rResId.GetId() )
         {
-            SfxPopupMenuManager::ExecutePopup( rResId, rDisp.GetFrame(), aPos, pWindow );
+            rDisp.ExecutePopup( rResId, pWin, pPos );
             return;
         }
         else if ( !rResName.isEmpty() )
         {
-            css::uno::Sequence< css::uno::Any > aArgs( 3 );
-            aArgs[0] <<= comphelper::makePropertyValue( "Value", rResName );
-            aArgs[1] <<= comphelper::makePropertyValue( "Frame", rDisp.GetFrame()->GetFrame().GetFrameInterface() );
-            aArgs[2] <<= comphelper::makePropertyValue( "IsContextMenu", true );
-
-            css::uno::Reference< css::uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
-            css::uno::Reference< css::frame::XPopupMenuController > xPopupController(
-                xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
-                "com.sun.star.comp.framework.ResourceMenuController", aArgs, xContext ), css::uno::UNO_QUERY );
-
-            css::uno::Reference< css::awt::XPopupMenu > xPopupMenu( xContext->getServiceManager()->createInstanceWithContext(
-                "com.sun.star.awt.PopupMenu", xContext ), css::uno::UNO_QUERY );
-
-            if ( !xPopupController.is() || !xPopupMenu.is() )
-                continue;
-
-            css::ui::ContextMenuExecuteEvent aEvent;
-            aEvent.SourceWindow = VCLUnoHelper::GetInterface( pWindow );
-            aEvent.ExecutePosition.X = aPos.X();
-            aEvent.ExecutePosition.Y = aPos.Y();
-
-            xPopupController->setPopupMenu( xPopupMenu );
-            VCLXMenu* pAwtMenu = VCLXMenu::GetImplementation( xPopupMenu );
-            PopupMenu* pVCLMenu = static_cast< PopupMenu* >( pAwtMenu->GetMenu() );
-            if ( pVCLMenu && rDisp.GetFrame()->GetViewShell()->TryContextMenuInterception( *pVCLMenu, rResName, aEvent ) )
-                pVCLMenu->Execute( pWindow, aPos );
+            rDisp.ExecutePopup( rResName, pWin, pPos );
             return;
         }
     }
@@ -1932,6 +1905,39 @@ void SfxDispatcher::ExecutePopup( const ResId &rId, vcl::Window *pWin, const Poi
     SfxPopupMenuManager::ExecutePopup( rId, GetFrame(), pPos ? *pPos : pWindow->GetPointerPosPixel(), pWindow );
 }
 
+void SfxDispatcher::ExecutePopup( const OUString& rResName, vcl::Window *pWin, const Point* pPos )
+{
+    css::uno::Sequence< css::uno::Any > aArgs( 3 );
+    aArgs[0] <<= comphelper::makePropertyValue( "Value", rResName );
+    aArgs[1] <<= comphelper::makePropertyValue( "Frame", GetFrame()->GetFrame().GetFrameInterface() );
+    aArgs[2] <<= comphelper::makePropertyValue( "IsContextMenu", true );
+
+    css::uno::Reference< css::uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
+    css::uno::Reference< css::frame::XPopupMenuController > xPopupController(
+        xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+        "com.sun.star.comp.framework.ResourceMenuController", aArgs, xContext ), css::uno::UNO_QUERY );
+
+    css::uno::Reference< css::awt::XPopupMenu > xPopupMenu( xContext->getServiceManager()->createInstanceWithContext(
+        "com.sun.star.awt.PopupMenu", xContext ), css::uno::UNO_QUERY );
+
+    if ( !xPopupController.is() || !xPopupMenu.is() )
+        return;
+
+    vcl::Window* pWindow = pWin ? pWin : xImp->pFrame->GetFrame().GetWorkWindow_Impl()->GetWindow();
+    Point aPos = pPos ? *pPos : pWindow->GetPointerPosPixel();
+
+    css::ui::ContextMenuExecuteEvent aEvent;
+    aEvent.SourceWindow = VCLUnoHelper::GetInterface( pWindow );
+    aEvent.ExecutePosition.X = aPos.X();
+    aEvent.ExecutePosition.Y = aPos.Y();
+
+    xPopupController->setPopupMenu( xPopupMenu );
+    VCLXMenu* pAwtMenu = VCLXMenu::GetImplementation( xPopupMenu );
+    PopupMenu* pVCLMenu = static_cast< PopupMenu* >( pAwtMenu->GetMenu() );
+    if ( pVCLMenu && GetFrame()->GetViewShell()->TryContextMenuInterception( *pVCLMenu, rResName, aEvent ) )
+        pVCLMenu->Execute( pWindow, aPos );
+}
+
 /** With this method the SfxDispatcher can be locked and released. A locked
     SfxDispatcher does not perform <SfxRequest>s and does no longer provide
     status information. It behaves as if all the slots were disabled.


More information about the Libreoffice-commits mailing list