From 8da106529e85981ce37fbbd18160023c26cc7129 Mon Sep 17 00:00:00 2001 From: Maxim Monastirsky Date: Sun, 7 May 2017 03:32:25 +0300 Subject: tdf#106479 Make edit context menu dispatcher based This allows us to add there any .uno command and also get the icon and keyboard shortcut for it. Use this to add clipboard commands. Change-Id: Ic42c28add7771f322491e8e7d6df052e3c2c8d75 Reviewed-on: https://gerrit.libreoffice.org/37353 Reviewed-by: Maxim Monastirsky Tested-by: Maxim Monastirsky --- .../data/org/openoffice/Office/UI/MathCommands.xcu | 63 +- .../org/openoffice/Office/UI/MathWindowState.xcu | 7 +- starmath/UIConfig_smath.mk | 2 +- starmath/inc/edit.hxx | 1 - starmath/sdi/smath.sdi | 2 +- starmath/source/edit.cxx | 36 +- starmath/uiconfig/smath/popupmenu/edit.xml | 265 ++++ starmath/uiconfig/smath/ui/commandmenu.ui | 1586 -------------------- 8 files changed, 338 insertions(+), 1624 deletions(-) create mode 100644 starmath/uiconfig/smath/popupmenu/edit.xml delete mode 100644 starmath/uiconfig/smath/ui/commandmenu.ui diff --git a/officecfg/registry/data/org/openoffice/Office/UI/MathCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/MathCommands.xcu index 1fe747ff5d64..8adebca5535a 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/MathCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/MathCommands.xcu @@ -141,7 +141,68 @@ 9 + + + New Line + + + + + Small Gap + + + + + Gap + + + + + + + ~Unary/Binary Operators + + + + + ~Relations + + + + + ~Set Operations + + + + + ~Functions + + + + + O~perators + + + + + ~Attributes + + + + + ~Brackets + + + + + For~mats + + + + + ~Others + + - diff --git a/officecfg/registry/data/org/openoffice/Office/UI/MathWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/MathWindowState.xcu index bd679f723693..386dc8d39ac1 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/MathWindowState.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/MathWindowState.xcu @@ -20,9 +20,14 @@ + + + Edit Panel + + - Work Area + View Panel diff --git a/starmath/UIConfig_smath.mk b/starmath/UIConfig_smath.mk index 52babf47879c..5aa6e4cfbb06 100644 --- a/starmath/UIConfig_smath.mk +++ b/starmath/UIConfig_smath.mk @@ -14,6 +14,7 @@ $(eval $(call gb_UIConfig_add_menubarfiles,modules/smath,\ )) $(eval $(call gb_UIConfig_add_popupmenufiles,modules/smath,\ + starmath/uiconfig/smath/popupmenu/edit \ starmath/uiconfig/smath/popupmenu/view \ )) @@ -30,7 +31,6 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/smath,\ $(eval $(call gb_UIConfig_add_uifiles,modules/smath,\ starmath/uiconfig/smath/ui/alignmentdialog \ starmath/uiconfig/smath/ui/catalogdialog \ - starmath/uiconfig/smath/ui/commandmenu \ starmath/uiconfig/smath/ui/dockingelements \ starmath/uiconfig/smath/ui/fontdialog \ starmath/uiconfig/smath/ui/fontsizedialog \ diff --git a/starmath/inc/edit.hxx b/starmath/inc/edit.hxx index 173ccba43a1d..54bfdbce5cb9 100644 --- a/starmath/inc/edit.hxx +++ b/starmath/inc/edit.hxx @@ -58,7 +58,6 @@ class SmEditWindow : public vcl::Window, public DropTargetHelper virtual void KeyInput(const KeyEvent& rKEvt) override; virtual void Command(const CommandEvent& rCEvt) override; - DECL_LINK(MenuSelectHdl, Menu *, bool); DECL_LINK(ModifyTimerHdl, Timer *, void); DECL_LINK(CursorMoveTimerHdl, Timer *, void); diff --git a/starmath/sdi/smath.sdi b/starmath/sdi/smath.sdi index 3c2a7ebacced..4f479193ee4e 100644 --- a/starmath/sdi/smath.sdi +++ b/starmath/sdi/smath.sdi @@ -217,7 +217,7 @@ SfxInt16Item Graphic SID_GAPHIC_SM SfxVoidItem InsertCommandText SID_INSERTCOMMANDTEXT -() +(SfxStringItem Text SID_INSERTCOMMANDTEXT) [ AutoUpdate = FALSE, FastCall = FALSE, diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index df8816aff0f8..b2e41cd36d3d 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -341,29 +341,9 @@ void SmEditWindow::Command(const CommandEvent& rCEvt) GetParent()->ToTop(); Point aPoint = rCEvt.GetMousePosPixel(); - - VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/smath/ui/commandmenu.ui", ""); - VclPtr xPopupMenu(aBuilder.get_menu("menu")); - - // added for replaceability of context menus - VclPtr pMenu; - css::ui::ContextMenuExecuteEvent aEvent; - aEvent.SourceWindow = VCLUnoHelper::GetInterface( this ); - aEvent.ExecutePosition.X = aPoint.X(); - aEvent.ExecutePosition.Y = aPoint.Y(); - OUString sDummy; - if ( GetView()->TryContextMenuInterception( *xPopupMenu, sDummy, pMenu, aEvent ) ) - { - if ( pMenu ) - { - xPopupMenu.disposeAndClear(); - xPopupMenu = static_cast(pMenu.get()); - } - } - - xPopupMenu->SetSelectHdl(LINK(this, SmEditWindow, MenuSelectHdl)); - - xPopupMenu->Execute( this, aPoint ); + SmViewShell* pViewSh = rCmdBox.GetView(); + if (pViewSh) + pViewSh->GetViewFrame()->GetDispatcher()->ExecutePopup("edit", this, &aPoint); bForwardEvt = false; } else if (rCEvt.GetCommand() == CommandEventId::Wheel) @@ -397,16 +377,6 @@ bool SmEditWindow::HandleWheelCommands( const CommandEvent &rCEvt ) return bCommandHandled; } -IMPL_LINK( SmEditWindow, MenuSelectHdl, Menu *, pMenu, bool ) -{ - SmViewShell *pViewSh = rCmdBox.GetView(); - if (pViewSh) - pViewSh->GetViewFrame()->GetDispatcher()->ExecuteList( - SID_INSERTCOMMANDTEXT, SfxCallMode::RECORD, - { new SfxStringItem(SID_INSERTCOMMANDTEXT, OUString::fromUtf8(pMenu->GetCurItemIdent())) }); - return false; -} - void SmEditWindow::KeyInput(const KeyEvent& rKEvt) { if (rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE) diff --git a/starmath/uiconfig/smath/popupmenu/edit.xml b/starmath/uiconfig/smath/popupmenu/edit.xml new file mode 100644 index 000000000000..211776eea9a8 --- /dev/null +++ b/starmath/uiconfig/smath/popupmenu/edit.xml @@ -0,0 +1,265 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/starmath/uiconfig/smath/ui/commandmenu.ui b/starmath/uiconfig/smath/ui/commandmenu.ui deleted file mode 100644 index 194b06f24226..000000000000 --- a/starmath/uiconfig/smath/ui/commandmenu.ui +++ /dev/null @@ -1,1586 +0,0 @@ - - - - - - True - False - - - True - False - _Unary/Binary Operators - True - - - True - False - - - True - False - +a - - - - - True - False - -a - - - - - True - False - +-a - - - - - True - False - -+a - True - - - - - True - False - - - - - True - False - a + b - - - - - True - False - a - b - - - - - True - False - a cdot b - - - - - True - False - a times b - - - - - True - False - a * b - - - - - True - False - a over b - - - - - True - False - a div b - - - - - True - False - a / b - - - - - True - False - a circ b - - - - - True - False - - - - - True - False - a wideslash b - - - - - True - False - a widebslash b - - - - - True - False - - - - - True - False - neg a - - - - - True - False - a and b - - - - - True - False - a or b - - - - - - - - - True - False - _Relations - True - - - True - False - - - True - False - a = b - - - - - True - False - a <> b - - - - - True - False - a < b - - - - - True - False - a <= b - - - - - True - False - a leslant b - - - - - True - False - a > b - - - - - True - False - a >= b - - - - - True - False - a geslant b - - - - - True - False - - - - - True - False - a approx b - - - - - True - False - a sim b - - - - - True - False - a simeq b - - - - - True - False - a equiv b - - - - - True - False - a prop b - - - - - True - False - a parallel b - - - - - True - False - a ortho b - - - - - True - False - a divides b - - - - - True - False - a ndivides b - - - - - True - False - a toward b - - - - - True - False - - - - - True - False - a dlarrow b - - - - - True - False - a dlrarrow b - - - - - True - False - a drarrow b - - - - - True - False - - - - - True - False - a prec b - - - - - True - False - a succ b - - - - - True - False - a preccurlyeq b - - - - - True - False - a succcurlyeq b - - - - - True - False - a precsim b - - - - - True - False - a succsim b - - - - - True - False - a nprec b - - - - - True - False - a nsucc b - - - - - - - - - True - False - _Set Operations - True - - - True - False - - - True - False - a in A - - - - - True - False - a notin A - - - - - True - False - A owns a - - - - - True - False - - - - - True - False - A intersection B - - - - - True - False - A union B - - - - - True - False - A \ B - - - - - True - False - A / B - - - - - True - False - A subset B - - - - - True - False - A subseteq B - - - - - True - False - A supset B - - - - - True - False - A supseteq B - - - - - True - False - A nsubset B - - - - - True - False - A nsubseteq B - - - - - True - False - A nsupset B - - - - - True - False - A nsupseteq B - - - - - True - False - - - - - True - False - emptyset - - - - - True - False - aleph - - - - - True - False - setN - - - - - True - False - setZ - - - - - True - False - setQ - - - - - True - False - setR - - - - - True - False - setC - - - - - - - - - True - False - _Functions - True - - - True - False - - - True - False - |x| - - - - - True - False - x! - - - - - True - False - sqrt x - - - - - True - False - nroot x y - - - - - True - False - x^y - - - - - True - False - e^x - - - - - True - False - ln(x) - - - - - True - False - exp(x) - - - - - True - False - log(x) - - - - - True - False - - - - - True - False - sin(x) - - - - - True - False - cos(x) - - - - - True - False - tan(x) - - - - - True - False - cot(x) - - - - - True - False - sinh(x) - - - - - True - False - cosh(x) - - - - - True - False - tanh(x) - - - - - True - False - coth(x) - - - - - True - False - - - - - True - False - arcsin(x) - - - - - True - False - arccos(x) - - - - - True - False - arctan(x) - - - - - True - False - arccot(x) - - - - - True - False - arsinh(x) - - - - - True - False - arcosh(x) - - - - - True - False - artanh(x) - - - - - True - False - arcoth(x) - - - - - - - - - True - False - O_perators - True - - - True - False - - - True - False - lim x - - - - - True - False - sum x - - - - - True - False - prod x - - - - - True - False - coprod x - - - - - True - False - int x - - - - - True - False - iint x - - - - - True - False - iiint x - - - - - True - False - lint x - - - - - True - False - llint x - - - - - True - False - lllint x - - - - - True - False - - - - - True - False - ... from a to b - - - - - True - False - ... from a - - - - - True - False - ... to b - - - - - - - - - True - False - _Attributes - True - - - True - False - - - True - False - acute a - - - - - True - False - grave a - - - - - True - False - check a - - - - - True - False - breve a - - - - - True - False - circle a - - - - - True - False - dot a - - - - - True - False - ddot a - - - - - True - False - dddot a - - - - - True - False - bar a - - - - - True - False - vec a - - - - - True - False - tilde a - - - - - True - False - hat a - - - - - True - False - - - - - True - False - widevec abc - - - - - True - False - widetilde abc - - - - - True - False - widehat abc - - - - - True - False - overline abc - - - - - True - False - underline abc - - - - - True - False - overstrike abc - - - - - True - False - - - - - True - False - phantom b - - - - - True - False - bold b - - - - - True - False - ital b - - - - - True - False - size s b - - - - - True - False - font f b - - - - - - - - - True - False - _Brackets - True - - - True - False - - - True - False - {...} - - - - - True - False - - - - - True - False - (x) - - - - - True - False - [x] - - - - - True - False - ldbracket x rdbracket - - - - - True - False - {x} - - - - - True - False - langle x rangle - - - - - True - False - langle x mline y rangle - - - - - True - False - lceil x rceil - - - - - True - False - lfloor x rfloor - - - - - True - False - lline x rline - - - - - True - False - ldline x rdline - - - - - True - False - - - - - True - False - left ( x right ) - - - - - True - False - left [ x right ] - - - - - True - False - left ldbracket x right rdbracket - - - - - True - False - left { x right } - - - - - True - False - left langle x right rangle - - - - - True - False - left langle x mline y right rangle - - - - - True - False - left lceil x right rceil - - - - - True - False - left lfloor x right rfloor - - - - - True - False - left lline x right rline - - - - - True - False - left ldline x right rdline - - - - - True - False - left none x right rline_y - - - - - True - False - - - - - True - False - x overbrace y - - - - - True - False - x underbrace y - - - - - - - - - True - False - For_mats - True - - - True - False - - - True - False - ^x - - - - - True - False - __x - - - - - True - False - lsup x - - - - - True - False - lsub x - - - - - True - False - csup x - - - - - True - False - csub x - - - - - True - False - - - - - True - False - New Line - - - - - True - False - Small Gap - - - - - True - False - Gap - - - - - True - False - nospace {...} - - - - - True - False - binom x y - - - - - True - False - stack {...} - - - - - True - False - matrix {...} - - - - - True - False - - - - - True - False - alignl x - - - - - True - False - alignc x - - - - - True - False - alignr x - - - - - - - - - True - False - _Others - True - - - True - False - - - True - False - infinity - - - - - True - False - partial - - - - - True - False - nabla - - - - - True - False - exists - - - - - True - False - not exists - - - - - True - False - forall - - - - - True - False - hbar - - - - - True - False - lambdabar - - - - - True - False - Re - - - - - True - False - Im - - - - - True - False - wp - - - - - True - False - - - - - True - False - leftarrow - - - - - True - False - rightarrow - - - - - True - False - uparrow - - - - - True - False - downarrow - - - - - True - False - - - - - True - False - dotslow - - - - - True - False - dotsaxis - - - - - True - False - dotsvert - - - - - True - False - dotsup - - - - - True - False - dotsdown - - - - - - - - -- cgit v1.2.3