diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2017-05-07 03:32:25 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2017-05-08 00:32:14 +0200 |
commit | 8da106529e85981ce37fbbd18160023c26cc7129 (patch) | |
tree | 30ead8880bda055addfccb8cb8e0a669405f6962 /starmath/source/edit.cxx | |
parent | 7d9e441eb98b4e964c08e41e53714a8607e22f8e (diff) |
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 <momonasmon@gmail.com>
Tested-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'starmath/source/edit.cxx')
-rw-r--r-- | starmath/source/edit.cxx | 36 |
1 files changed, 3 insertions, 33 deletions
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<PopupMenu> xPopupMenu(aBuilder.get_menu("menu")); - - // added for replaceability of context menus - VclPtr<Menu> 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<PopupMenu*>(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) |