[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - 2 commits - editeng/source editeng/uiconfig include/vcl vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jun 18 09:31:39 UTC 2021
editeng/source/editeng/editview.cxx | 4 +---
editeng/uiconfig/ui/spellmenu.ui | 2 +-
include/vcl/menu.hxx | 20 ++++++++++++--------
vcl/source/window/builder.cxx | 2 ++
vcl/source/window/menu.cxx | 12 +++++++-----
5 files changed, 23 insertions(+), 17 deletions(-)
New commits:
commit 12f5b4b3830ecfcaa8d3f01ed5e73da15e1caaf2
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Dec 15 09:32:26 2020 +0000
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Jun 18 11:31:19 2021 +0200
use GetParentWithLOKNotifier to get the frame LOKNotifier to reuse for menus
so it doesn't have to be explicitly set by the editview menu creator
If I force enable LibreOfficeKit::isActive and right click on a
mispelled word in impress, or in the writer comments-in-margin before or
after this change I see the same ILibreOfficeKitNotifier set on the
MenuFloatingWindow. Seeing as this is used in only the editview spell
checking menu give that a unique id 'editviewspellmenu' and only do
this for that id
SetLOKNotifier in vcl/source/window/menu.cxx added with:
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>
SetLOKNotifier in editeng/source/editeng/editview.cxx added with:
commit 7c6fbd0ac3b5927b337aa69b132aba14e9b3103f
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date: Mon Apr 16 14:38:36 2018 +0200
sd lok: Impress: Right-click menu on misspelled word locks up session
Change-Id: Ib554eea7049c1ea244bc4789ee3d7d2adf87e283
Reviewed-on: https://gerrit.libreoffice.org/52977
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
Change-Id: I6c23ba4252eab3850b7cc4c8cad2d2f8adee2792
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107747
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117254
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 18ed2f506405..636d2280dd60 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -971,7 +971,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
return;
VclBuilder aBuilder(nullptr, AllSettings::GetUIRootDir(), "editeng/ui/spellmenu.ui", "");
- VclPtr<PopupMenu> aPopupMenu(aBuilder.get_menu("menu"));
+ VclPtr<PopupMenu> aPopupMenu(aBuilder.get_menu("editviewspellmenu"));
const sal_uInt16 nAutoCorrId = aPopupMenu->GetItemId("autocorrect");
PopupMenu *pAutoMenu = aPopupMenu->GetPopupMenu(nAutoCorrId);
const sal_uInt16 nInsertId = aPopupMenu->GetItemId("insert");
@@ -1156,8 +1156,6 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
LOKSendSpellPopupMenu(aPopupMenu, nGuessLangWord, nGuessLangPara, nWords);
return;
}
- else // For desktop and tablets, we use the tunneled dialog
- aPopupMenu->SetLOKNotifier(pViewShell);
}
sal_uInt16 nId = aPopupMenu->Execute(pImpEditView->GetWindow(), aTempRect, PopupMenuFlags::NoMouseUpClose);
diff --git a/editeng/uiconfig/ui/spellmenu.ui b/editeng/uiconfig/ui/spellmenu.ui
index d13d54ff04fb..9dd0d595701f 100644
--- a/editeng/uiconfig/ui/spellmenu.ui
+++ b/editeng/uiconfig/ui/spellmenu.ui
@@ -2,7 +2,7 @@
<!-- Generated with glade 3.20.0 -->
<interface domain="editeng">
<requires lib="gtk+" version="3.20"/>
- <object class="GtkMenu" id="menu">
+ <object class="GtkMenu" id="editviewspellmenu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index 8821e74256a5..47bfa8848c1b 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -500,8 +500,6 @@ 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:
@@ -536,12 +534,6 @@ 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/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 792f3aed5ff5..770e2ff88e3c 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2725,14 +2725,12 @@ MenuFloatingWindow * PopupMenu::ImplGetFloatingWindow() const {
}
PopupMenu::PopupMenu()
- : mpLOKNotifier(nullptr)
{
mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(false, this);
}
PopupMenu::PopupMenu( const PopupMenu& rMenu )
- : Menu(),
- mpLOKNotifier(nullptr)
+ : Menu()
{
mpSalMenu = ImplGetSVData()->mpDefInst->CreateMenu(false, this);
*this = rMenu;
@@ -2935,8 +2933,12 @@ 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 (comphelper::LibreOfficeKit::isActive() && get_id() == "editviewspellmenu")
+ {
+ VclPtr<vcl::Window> xNotifierParent = pW->GetParentWithLOKNotifier();
+ assert(xNotifierParent && xNotifierParent->GetLOKNotifier() && "editview menu without LOKNotifier");
+ pWin->SetLOKNotifier(xNotifierParent->GetLOKNotifier());
+ }
if( pSVData->maNWFData.mbFlatMenu )
pWin->SetBorderStyle( WindowBorderStyle::NOBORDER );
commit 5bd6b067b1c7f1a1d11627b005c7c1cba8ffabab
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Dec 15 13:16:15 2020 +0000
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Jun 18 11:31:05 2021 +0200
add set_id/get_id to Menus like Windows
Change-Id: Idcbb4e8fc67bf04d0959ba9ab59342240434727c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107768
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117253
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index 7613f14f157c..8821e74256a5 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -137,6 +137,8 @@ private:
std::list<Link<VclMenuEvent&,void> > maEventListeners;
+ OUString maID;
+
OUString aTitleText; // PopupMenu text
sal_uInt16 nTitleHeight;
@@ -388,6 +390,16 @@ public:
bool HandleMenuCommandEvent(Menu *pMenu, sal_uInt16 nEventId) const;
bool HandleMenuActivateEvent(Menu *pMenu) const;
bool HandleMenuDeActivateEvent(Menu *pMenu) const;
+
+ /**
+ * Sets an ID.
+ */
+ void set_id(const OUString& rID) { maID = rID; }
+
+ /**
+ * Get the ID of the window.
+ */
+ const OUString& get_id() const { return maID; }
};
class VCL_DLLPUBLIC MenuBar : public Menu
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 38671daf226b..25db6aacc40d 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -3229,6 +3229,8 @@ VclPtr<Menu> VclBuilder::handleMenu(xmlreader::XmlReader &reader, const OString
else
pCurrentMenu = VclPtr<PopupMenu>::Create();
+ pCurrentMenu->set_id(OStringToOUString(rID, RTL_TEXTENCODING_UTF8));
+
int nLevel = 1;
stringmap aProperties;
More information about the Libreoffice-commits
mailing list