[Libreoffice-commits] core.git: editeng/source include/vcl sw/source vcl/source

Jan Holesovsky kendy at collabora.com
Tue Mar 13 10:39:15 UTC 2018


 editeng/source/editeng/editview.cxx  |    2 +-
 include/vcl/menu.hxx                 |    9 +++++++++
 sw/source/uibase/inc/olmenu.hxx      |    2 +-
 sw/source/uibase/uiview/viewling.cxx |    7 +++++--
 vcl/source/window/menu.cxx           |    9 ++++++++-
 5 files changed, 24 insertions(+), 5 deletions(-)

New commits:
commit 8938e8b153f32f3f5926baddb87cb76c8e72755a
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Mar 8 21:07:40 2018 +0100

    lokdialog: Tunnel the spell-checking context menu with recommendations.
    
    Change-Id: I1a7952e88a3f89346c97d2516628b4a7a0423de6
    Reviewed-on: https://gerrit.libreoffice.org/51062
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>
    Reviewed-on: https://gerrit.libreoffice.org/51166
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 22b66cbce8c2..6e1d4ec481a1 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -1025,7 +1025,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 3ada2762fb6a..06a2e38680c6 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -60,6 +60,7 @@ namespace vcl
 class Window;
 struct MenuLayoutData;
 typedef OutputDevice RenderContext; // same as in include/vcl/outdev.hxx
+class ILibreOfficeKitNotifier;
 }
 
 #define MENU_APPEND        (sal_uInt16(0xFFFF))
@@ -483,6 +484,8 @@ class VCL_DLLPUBLIC PopupMenu : public Menu
     friend struct MenuItemData;
 
 private:
+    const vcl::ILibreOfficeKitNotifier* mpLOKNotifier; ///< To emit the LOK callbacks eg. for dialog tunneling.
+
     SAL_DLLPRIVATE MenuFloatingWindow * ImplGetFloatingWindow() const;
 
 protected:
@@ -517,6 +520,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/inc/olmenu.hxx b/sw/source/uibase/inc/olmenu.hxx
index a407f618810f..d37eb2edbfb5 100644
--- a/sw/source/uibase/inc/olmenu.hxx
+++ b/sw/source/uibase/inc/olmenu.hxx
@@ -128,7 +128,7 @@ public:
 
     ~SwSpellPopup();
 
-    Menu&   GetMenu()
+    PopupMenu& GetMenu()
     {
         return *m_xPopupMenu.get();
     }
diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx
index b59abdc05042..8ac2ccd217de 100644
--- a/sw/source/uibase/uiview/viewling.cxx
+++ b/sw/source/uibase/uiview/viewling.cxx
@@ -24,6 +24,7 @@
 #include <com/sun/star/linguistic2/ProofreadingResult.hpp>
 #include <com/sun/star/i18n/TextConversionOption.hpp>
 #include <linguistic/lngprops.hxx>
+#include <comphelper/lok.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/propertyvalue.hxx>
 #include <comphelper/propertysequence.hxx>
@@ -710,11 +711,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(xPopup->GetMenu(), sMenuName, pMenu, aEvent))
                 {
-
                     //! happy hacking for context menu modifying extensions of this
                     //! 'custom made' menu... *sigh* (code copied from sfx2 and framework)
                     if ( pMenu )
@@ -762,6 +762,9 @@ bool SwView::ExecSpellPopup(const Point& rPt)
                     }
                     else
                     {
+                        if (comphelper::LibreOfficeKit::isActive())
+                            xPopup->GetMenu().SetLOKNotifier(SfxViewShell::Current());
+
                         xPopup->Execute(aToFill.SVRect(), m_pEditWin);
                     }
                 }
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index b4ab69cccfee..6c6c4715047e 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -20,6 +20,7 @@
 #include <tools/diagnose_ex.h>
 #include <tools/stream.hxx>
 
+#include <comphelper/lok.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/mnemonic.hxx>
 #include <vcl/image.hxx>
@@ -40,6 +41,7 @@
 #include <vcl/dockingarea.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/commandinfoprovider.hxx>
+#include <vcl/IDialogRenderable.hxx>
 
 #include <salinst.hxx>
 #include <svdata.hxx>
@@ -2672,12 +2674,14 @@ MenuFloatingWindow * PopupMenu::ImplGetFloatingWindow() const {
 }
 
 PopupMenu::PopupMenu()
+    : mpLOKNotifier(nullptr)
 {
     mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(false, this);
 }
 
 PopupMenu::PopupMenu( const PopupMenu& rMenu )
-    : Menu()
+    : Menu(),
+      mpLOKNotifier(nullptr)
 {
     mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(false, this);
     *this = rMenu;
@@ -2878,6 +2882,9 @@ sal_uInt16 PopupMenu::ImplExecute( const VclPtr<vcl::Window>& pW, const tools::R
     }
 
     VclPtrInstance<MenuFloatingWindow> pWin( this, pW, WB_BORDER | WB_SYSTEMWINDOW );
+    if (comphelper::LibreOfficeKit::isActive() && mpLOKNotifier)
+        pWin->SetLOKNotifier(mpLOKNotifier);
+
     if( pSVData->maNWFData.mbFlatMenu )
         pWin->SetBorderStyle( WindowBorderStyle::NOBORDER );
     else


More information about the Libreoffice-commits mailing list