diff options
author | Jan Holesovsky <kendy@collabora.com> | 2018-03-08 21:07:40 +0100 |
---|---|---|
committer | pranavk <pranavk@collabora.co.uk> | 2018-03-12 17:11:00 +0100 |
commit | 84e2b8ee6c68a14d26ff1a813fc218f881706915 (patch) | |
tree | 339465dc817369f3dc15ab3ac4abdbced0c50cf7 | |
parent | 08dd970395a72723ceec8dcaeb703542ba7bafd7 (diff) |
lokdialog: Tunnel the spell-checking context menu with recommendations.
Change-Id: I1a7952e88a3f89346c97d2516628b4a7a0423de6
Reviewed-on: https://gerrit.libreoffice.org/51062
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
-rw-r--r-- | editeng/source/editeng/editview.cxx | 2 | ||||
-rw-r--r-- | include/vcl/menu.hxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewling.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/menu.cxx | 11 |
4 files changed, 20 insertions, 7 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index f6f75235fd14..bbf8bb97575c 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -983,7 +983,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo EPaM aP = pImpEditView->pEditEngine->pImpEditEngine->CreateEPaM(aPaM); EPaM aP2 = pImpEditView->pEditEngine->pImpEditEngine->CreateEPaM(aPaM2); - sal_uInt16 nId = aPopupMenu->Execute( pImpEditView->GetWindow(), aTempRect, PopupMenuFlags::NoMouseUpClose ); + sal_uInt16 nId = aPopupMenu->Execute(pImpEditView->GetWindow(), aTempRect, PopupMenuFlags::NoMouseUpClose); aPaM2 = pImpEditView->pEditEngine->pImpEditEngine->CreateEditPaM(aP2); aPaM = pImpEditView->pEditEngine->pImpEditEngine->CreateEditPaM(aP); diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index a16e5cccffad..023c46b781f9 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -497,6 +497,8 @@ class VCL_DLLPUBLIC PopupMenu : public Menu private: VclPtr<Menu>* pRefAutoSubMenu; // keeps track if a pointer to this Menu is stored in the MenuItemData + const vcl::ILibreOfficeKitNotifier* mpLOKNotifier; ///< To emit the LOK callbacks eg. for dialog tunneling. + SAL_DLLPRIVATE MenuFloatingWindow * ImplGetFloatingWindow() const; protected: @@ -533,6 +535,12 @@ public: static bool IsInExecute(); static PopupMenu* GetActivePopupMenu(); + /// Interface to register for dialog / window tunneling. + void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier) + { + mpLOKNotifier = pNotifier; + } + PopupMenu& operator=( const PopupMenu& rMenu ); }; diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index 9479424d67ce..8672139bc3b3 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -728,11 +728,10 @@ bool SwView::ExecSpellPopup(const Point& rPt) aEvent.ExecutePosition.Y = aPixPos.Y(); ScopedVclPtr<Menu> pMenu; - OUString sMenuName = bUseGrammarContext ? + OUString sMenuName = bUseGrammarContext ? OUString("private:resource/GrammarContextMenu") : OUString("private:resource/SpellContextMenu"); - if(TryContextMenuInterception( *pPopup, sMenuName, pMenu, aEvent )) + if (TryContextMenuInterception(*pPopup, sMenuName, pMenu, aEvent)) { - //! happy hacking for context menu modifying extensions of this //! 'custom made' menu... *sigh* (code copied from sfx2 and framework) if ( pMenu ) @@ -780,6 +779,7 @@ bool SwView::ExecSpellPopup(const Point& rPt) } else { + pPopup->SetLOKNotifier(SfxViewShell::Current()); pPopup->Execute( aToFill.SVRect(), m_pEditWin ); } } diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 5979104f230c..956e773a0606 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2715,13 +2715,15 @@ MenuFloatingWindow * PopupMenu::ImplGetFloatingWindow() const { } PopupMenu::PopupMenu() - : pRefAutoSubMenu(nullptr) + : pRefAutoSubMenu(nullptr), + mpLOKNotifier(nullptr) { mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(false, this); } PopupMenu::PopupMenu( const ResId& rResId ) - : pRefAutoSubMenu(nullptr) + : pRefAutoSubMenu(nullptr), + mpLOKNotifier(nullptr) { mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(false, this); @@ -2755,7 +2757,8 @@ PopupMenu::PopupMenu( const ResId& rResId ) PopupMenu::PopupMenu( const PopupMenu& rMenu ) : Menu(), - pRefAutoSubMenu(nullptr) + pRefAutoSubMenu(nullptr), + mpLOKNotifier(nullptr) { mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(false, this); *this = rMenu; @@ -2969,6 +2972,8 @@ sal_uInt16 PopupMenu::ImplExecute( const VclPtr<vcl::Window>& pW, const Rectangl } VclPtrInstance<MenuFloatingWindow> pWin( this, pW, nStyle | WB_SYSTEMWINDOW ); + pWin->SetLOKNotifier(mpLOKNotifier); + if( pSVData->maNWFData.mbFlatMenu ) pWin->SetBorderStyle( WindowBorderStyle::NOBORDER ); else |