[Libreoffice-commits] core.git: sc/source sc/uiconfig sc/UIConfig_scalc.mk
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Dec 21 21:04:09 UTC 2020
sc/UIConfig_scalc.mk | 1 +
sc/source/ui/view/tabcont.cxx | 33 ++++++++++++++++++---------------
sc/uiconfig/scalc/ui/pagelistmenu.ui | 9 +++++++++
3 files changed, 28 insertions(+), 15 deletions(-)
New commits:
commit b01310567d93d2cea068c55ff8e2ce0582d0fd3a
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Dec 21 13:31:33 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Dec 21 22:03:20 2020 +0100
weld pagelistmenu
Change-Id: I2d3e5a448f03e424e7dad661c550f7e1ff31d808
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108112
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index f1a6f4fe902f..5d1121242788 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -183,6 +183,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/optimalcolwidthdialog \
sc/uiconfig/scalc/ui/optimalrowheightdialog \
sc/uiconfig/scalc/ui/optsortlists \
+ sc/uiconfig/scalc/ui/pagelistmenu \
sc/uiconfig/scalc/ui/pagetemplatedialog \
sc/uiconfig/scalc/ui/pastespecial \
sc/uiconfig/scalc/ui/paradialog \
diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index a85a2ae5295a..2bb97d065cf8 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -22,8 +22,8 @@
#include <sfx2/docfile.hxx>
#include <tools/urlobj.hxx>
#include <vcl/commandevent.hxx>
-#include <vcl/menu.hxx>
#include <vcl/svapp.hxx>
+#include <vcl/weldutils.hxx>
#include <tabcont.hxx>
#include <tabvwsh.hxx>
#include <docsh.hxx>
@@ -91,7 +91,10 @@ ScTabControl::ScTabControl( vcl::Window* pParent, ScViewData* pData )
IMPL_LINK(ScTabControl, ShowPageList, const CommandEvent &, rEvent, void)
{
- ScopedVclPtrInstance<PopupMenu> aPopup;
+ tools::Rectangle aRect(rEvent.GetMousePosPixel(), Size(1, 1));
+ weld::Window* pPopupParent = weld::GetPopupParent(*this, aRect);
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pPopupParent, "modules/scalc/ui/pagelistmenu.ui"));
+ std::unique_ptr<weld::Menu> xPopup(xBuilder->weld_menu("menu"));
sal_uInt16 nCurPageId = GetCurPageId();
@@ -99,21 +102,21 @@ IMPL_LINK(ScTabControl, ShowPageList, const CommandEvent &, rEvent, void)
SCTAB nCount = rDoc.GetTableCount();
for (SCTAB i=0; i<nCount; ++i)
{
- if (rDoc.IsVisible(i))
- {
- OUString aString;
- if (rDoc.GetName(i, aString))
- {
- sal_uInt16 nId = static_cast<sal_uInt16>(i)+1;
- aPopup->InsertItem(nId, aString, MenuItemBits::CHECKABLE);
- if (nId == nCurPageId)
- aPopup->CheckItem(nId);
- }
- }
+ if (!rDoc.IsVisible(i))
+ continue;
+ OUString aString;
+ if (!rDoc.GetName(i, aString))
+ continue;
+ sal_uInt16 nId = static_cast<sal_uInt16>(i)+1;
+ OUString sId = OUString::number(nId);
+ xPopup->append_radio(sId, aString);
+ if (nId == nCurPageId)
+ xPopup->set_active(sId.toUtf8(), true);
}
- sal_uInt16 nItemId = aPopup->Execute( this, rEvent.GetMousePosPixel() );
- SwitchToPageId(nItemId);
+ OString sIdent(xPopup->popup_at_rect(pPopupParent, aRect));
+ if (!sIdent.isEmpty())
+ SwitchToPageId(sIdent.toUInt32());
}
ScTabControl::~ScTabControl()
diff --git a/sc/uiconfig/scalc/ui/pagelistmenu.ui b/sc/uiconfig/scalc/ui/pagelistmenu.ui
new file mode 100644
index 000000000000..93bc5ea590d6
--- /dev/null
+++ b/sc/uiconfig/scalc/ui/pagelistmenu.ui
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.38.1 -->
+<interface domain="sc">
+ <requires lib="gtk+" version="3.20"/>
+ <object class="GtkMenu" id="menu">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ </object>
+</interface>
More information about the Libreoffice-commits
mailing list