tdf#171207 Add a button to list sheets

The list of sheets is already available via right clic on any activated button
in the navigation bar. However, it is somehow hidden for the user.
This change added (for LTR and RTL UI) a hamburger button which show the list
with a simple left click.

Change-Id: Ic21b1e4d345a10bf86f2e97d1f7749bbcacc7a6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210677
Tested-by: Jenkins
Reviewed-by: Laurent Balland <laurent.balland@mailo.fr>
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
This commit is contained in:
Laurent Balland
2026-09-19 09:23:16 +02:00
parent c8679f314a
commit a79c0c4c39
6 changed files with 78 additions and 7 deletions
+2
View File
@@ -181,12 +181,14 @@
#define STR_SVT_FONTMAP_STYLENOTAVAILABLE NC_("STR_SVT_FONTMAP_STYLENOTAVAILABLE", "This font style will be simulated or the closest matching style will be used.")
#define STR_SVT_FONTMAP_NOTAVAILABLE NC_("STR_SVT_FONTMAP_NOTAVAILABLE", "This font has not been installed. The closest available font will be used.")
#define STR_TABBAR_PUSHBUTTON_SHEETSLIST NC_("STR_TABBAR_PUSHBUTTON_SHEETSLIST", "List of Sheets")
#define STR_TABBAR_PUSHBUTTON_MOVET0HOME NC_("STR_TABBAR_PUSHBUTTON_MOVET0HOME", "Move To Home")
#define STR_TABBAR_PUSHBUTTON_MOVELEFT NC_("STR_TABBAR_PUSHBUTTON_MOVELEFT", "Move Left")
#define STR_TABBAR_PUSHBUTTON_MOVERIGHT NC_("STR_TABBAR_PUSHBUTTON_MOVERIGHT", "Move Right")
#define STR_TABBAR_PUSHBUTTON_MOVETOEND NC_("STR_TABBAR_PUSHBUTTON_MOVETOEND", "Move To End")
#define STR_TABBAR_PUSHBUTTON_ADDTAB NC_("STR_TABBAR_PUSHBUTTON_ADDTAB", "Add")
#define STR_TABBAR_HINT_SHEETSLIST_SHEETS NC_("STR_TABBAR_HINT_SHEETSLIST_SHEETS", "Show the list of all non-hidden sheets")
#define STR_TABBAR_HINT_MOVETOHOME_SHEETS NC_("STR_TABBAR_HINT_MOVETOHOME_SHEETS", "Scroll to first sheet")
#define STR_TABBAR_HINT_MOVELEFT_SHEETS NC_("STR_TABBAR_HINT_MOVELEFT_SHEETS", "Scroll to previous sheet")
#define STR_TABBAR_HINT_MOVERIGHT_SHEETS NC_("STR_TABBAR_HINT_MOVERIGHT_SHEETS", "Scroll to next sheet")
+1
View File
@@ -366,6 +366,7 @@ private:
DECL_DLLPRIVATE_LINK(ImplClickHdl, weld::Button&, void);
DECL_DLLPRIVATE_LINK(ImplAddClickHandler, weld::Button&, void);
DECL_DLLPRIVATE_LINK(ImplListClickHandler, weld::Button&, void);
DECL_DLLPRIVATE_LINK(MousePressHdl, const MouseEvent&, bool);
DECL_DLLPRIVATE_LINK(ContextMenuHdl, const CommandEvent&, void);
+2
View File
@@ -25,11 +25,13 @@ svtools/uiconfig/ui/restartdialog.ui://GtkLabel[@id='reason_skia'] orphan-label
svtools/uiconfig/ui/restartdialog.ui://GtkLabel[@id='label'] orphan-label
svtools/uiconfig/ui/spinfieldcontrol.ui://GtkSpinButton[@id='spinbutton'] no-labelled-by
svtools/uiconfig/ui/tabbaredit.ui://GtkEntry[@id='entry'] no-labelled-by
svtools/uiconfig/ui/tabbuttons.ui://GtkButton[@id='list'] button-no-label
svtools/uiconfig/ui/tabbuttons.ui://GtkButton[@id='first'] button-no-label
svtools/uiconfig/ui/tabbuttons.ui://GtkButton[@id='next'] button-no-label
svtools/uiconfig/ui/tabbuttons.ui://GtkButton[@id='prev'] button-no-label
svtools/uiconfig/ui/tabbuttons.ui://GtkButton[@id='last'] button-no-label
svtools/uiconfig/ui/tabbuttons.ui://GtkButton[@id='add'] button-no-label
svtools/uiconfig/ui/tabbuttonsmirrored.ui://GtkButton[@id='list'] button-no-label
svtools/uiconfig/ui/tabbuttonsmirrored.ui://GtkButton[@id='first'] button-no-label
svtools/uiconfig/ui/tabbuttonsmirrored.ui://GtkButton[@id='next'] button-no-label
svtools/uiconfig/ui/tabbuttonsmirrored.ui://GtkButton[@id='prev'] button-no-label
+18 -2
View File
@@ -440,6 +440,7 @@ namespace {
class TabButtons final : public InterimItemWindow
{
public:
std::unique_ptr<weld::Button> m_xListButton;
std::unique_ptr<weld::Button> m_xFirstButton;
std::unique_ptr<weld::Button> m_xPrevButton;
std::unique_ptr<weld::Button> m_xNextButton;
@@ -454,6 +455,7 @@ public:
pParent->IsMirrored() ? u"svt/ui/tabbuttonsmirrored.ui"_ustr
: u"svt/ui/tabbuttons.ui"_ustr,
u"TabButtons"_ustr)
, m_xListButton(m_xBuilder->weld_button(u"list"_ustr))
, m_xFirstButton(m_xBuilder->weld_button(u"first"_ustr))
, m_xPrevButton(m_xBuilder->weld_button(u"prev"_ustr))
, m_xNextButton(m_xBuilder->weld_button(u"next"_ustr))
@@ -464,6 +466,7 @@ public:
SetPaintTransparent(false);
SetBackground(rStyleSettings.GetFaceColor());
m_xListButton->set_accessible_name(SvtResId(STR_TABBAR_PUSHBUTTON_SHEETSLIST));
m_xFirstButton->set_accessible_name(SvtResId(STR_TABBAR_PUSHBUTTON_MOVET0HOME));
m_xPrevButton->set_accessible_name(SvtResId(STR_TABBAR_PUSHBUTTON_MOVELEFT));
m_xNextButton->set_accessible_name(SvtResId(STR_TABBAR_PUSHBUTTON_MOVERIGHT));
@@ -472,6 +475,7 @@ public:
if (bSheets)
{
m_xListButton->set_tooltip_text(SvtResId(STR_TABBAR_HINT_SHEETSLIST_SHEETS));
m_xFirstButton->set_tooltip_text(SvtResId(STR_TABBAR_HINT_MOVETOHOME_SHEETS));
m_xPrevButton->set_tooltip_text(SvtResId(STR_TABBAR_HINT_MOVELEFT_SHEETS));
m_xNextButton->set_tooltip_text(SvtResId(STR_TABBAR_HINT_MOVERIGHT_SHEETS));
@@ -484,6 +488,7 @@ public:
{
if (m_xFirstButton->get_preferred_size() == Size(nHeight, nHeight))
return;
m_xListButton->set_size_request(nHeight, nHeight);
m_xFirstButton->set_size_request(nHeight, nHeight);
m_xPrevButton->set_size_request(nHeight, nHeight);
m_xNextButton->set_size_request(nHeight, nHeight);
@@ -502,6 +507,7 @@ public:
m_xNextButton.reset();
m_xPrevButton.reset();
m_xFirstButton.reset();
m_xListButton.reset();
InterimItemWindow::dispose();
}
};
@@ -785,6 +791,11 @@ IMPL_LINK(TabBar, MousePressHdl, const MouseEvent&, rMouseEvent, bool)
return false;
}
IMPL_LINK_NOARG( TabBar, ImplListClickHandler, weld::Button&, void )
{
maScrollAreaContextHdl.Call( CommandEvent( Point( 0, 0 ), CommandEventId::ContextMenu, true ) );
}
void TabBar::ImplInitControls()
{
if (mnWinStyle & WB_SIZEABLE)
@@ -803,6 +814,7 @@ void TabBar::ImplInitControls()
mpImpl->mxButtonBox.disposeAndReset(VclPtr<TabButtons>::Create(this, mbSheets));
Link<const CommandEvent&, void> aContextLink = LINK( this, TabBar, ContextMenuHdl );
Link<const MouseEvent&, bool> aBtnContextLink = LINK(this, TabBar, MousePressHdl);
if (mnWinStyle & WB_INSERTTAB)
{
@@ -810,6 +822,11 @@ void TabBar::ImplInitControls()
mpImpl->mxButtonBox->m_xAddRepeater = std::make_shared<weld::ButtonPressRepeater>(
*mpImpl->mxButtonBox->m_xAddButton, aLink, aContextLink);
mpImpl->mxButtonBox->m_xAddButton->show();
aLink = LINK( this, TabBar, ImplListClickHandler );
mpImpl->mxButtonBox->m_xListButton->connect_clicked( aLink );
mpImpl->mxButtonBox->m_xListButton->connect_mouse_press( aBtnContextLink );
mpImpl->mxButtonBox->m_xListButton->show();
}
Link<weld::Button&,void> aLink = LINK( this, TabBar, ImplClickHdl );
@@ -826,8 +843,6 @@ void TabBar::ImplInitControls()
if (mnWinStyle & WB_SCROLL)
{
Link<const MouseEvent&, bool> aBtnContextLink = LINK(this, TabBar, MousePressHdl);
mpImpl->mxButtonBox->m_xFirstButton->connect_clicked(aLink);
mpImpl->mxButtonBox->m_xFirstButton->connect_mouse_press(aBtnContextLink);
mpImpl->mxButtonBox->m_xFirstButton->show();
@@ -1447,6 +1462,7 @@ void TabBar::StateChanged(StateChangedType nType)
mpImpl->mpSizer->EnableRTL(bIsRTLEnabled);
if (mpImpl->mxButtonBox)
{
mpImpl->mxButtonBox->m_xListButton->set_direction(bIsRTLEnabled);
mpImpl->mxButtonBox->m_xFirstButton->set_direction(bIsRTLEnabled);
mpImpl->mxButtonBox->m_xPrevButton->set_direction(bIsRTLEnabled);
mpImpl->mxButtonBox->m_xNextButton->set_direction(bIsRTLEnabled);
+30 -5
View File
@@ -32,6 +32,12 @@
<property name="icon-name">go-last</property>
<property name="icon_size">1</property>
</object>
<object class="GtkImage" id="image6">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">open-menu-symbolic</property>
<property name="icon_size">1</property>
</object>
<object class="GtkBox" id="TabButtons">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -39,6 +45,25 @@
<property name="margin-end">6</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<object class="GtkButton" id="list">
<property name="can-focus">True</property>
<property name="focus-on-click">False</property>
<property name="receives-default">True</property>
<property name="no-show-all">True</property>
<property name="image">image6</property>
<property name="relief">none</property>
<property name="always-show-image">True</property>
<style>
<class name="small-button"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="first">
<property name="can-focus">True</property>
@@ -55,7 +80,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="position">1</property>
</packing>
</child>
<child>
@@ -74,7 +99,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
<child>
@@ -93,7 +118,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
<child>
@@ -112,7 +137,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="position">4</property>
</packing>
</child>
<child>
@@ -132,7 +157,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
<property name="position">5</property>
</packing>
</child>
</object>
+25
View File
@@ -32,6 +32,12 @@
<property name="icon-name">go-last</property>
<property name="icon_size">1</property>
</object>
<object class="GtkImage" id="image6">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">open-menu-symbolic</property>
<property name="icon_size">1</property>
</object>
<object class="GtkBox" id="TabButtons">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -135,5 +141,24 @@
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="list">
<property name="can-focus">True</property>
<property name="focus-on-click">False</property>
<property name="receives-default">True</property>
<property name="no-show-all">True</property>
<property name="image">image6</property>
<property name="relief">none</property>
<property name="always-show-image">True</property>
<style>
<class name="small-button"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
</object>
</interface>