diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-12-15 11:01:43 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-12-15 13:54:03 +0000 |
commit | abdad61f123820ed72893a9c2a0d5305ea8386d5 (patch) | |
tree | 84353cf6e0e680687ca5434e248489cc8c046eeb | |
parent | c0b59ad6e35b0cb0dea0821e95f95569739078c1 (diff) |
Resolves: tdf#95138 add tooltips to calc tabbar
Change-Id: I870c5dc1b81c642c4c7b70de10ecb927758ae29a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144216
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/svtools/strings.hrc | 6 | ||||
-rw-r--r-- | include/svtools/tabbar.hxx | 5 | ||||
-rw-r--r-- | sc/source/ui/view/tabcont.cxx | 2 | ||||
-rw-r--r-- | svtools/source/control/tabbar.cxx | 20 |
4 files changed, 25 insertions, 8 deletions
diff --git a/include/svtools/strings.hrc b/include/svtools/strings.hrc index 3216a2e24c2d..96c3ef64e24a 100644 --- a/include/svtools/strings.hrc +++ b/include/svtools/strings.hrc @@ -181,6 +181,12 @@ #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_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") +#define STR_TABBAR_HINT_MOVETOEND_SHEETS NC_("STR_TABBAR_HINT_MOVETOEND_SHEETS", "Scroll to last sheet") +#define STR_TABBAR_HINT_ADDTAB_SHEETS NC_("STR_TABBAR_HINT_ADDTAB_SHEETS", "Add sheet") + #define STR_SVT_ACC_RULER_HORZ_NAME NC_("STR_SVT_ACC_RULER_HORZ_NAME", "Horizontal Ruler") #define STR_SVT_ACC_RULER_VERT_NAME NC_("STR_SVT_ACC_RULER_VERT_NAME", "Vertical Ruler") diff --git a/include/svtools/tabbar.hxx b/include/svtools/tabbar.hxx index 948e60b3596b..335779bdaef3 100644 --- a/include/svtools/tabbar.hxx +++ b/include/svtools/tabbar.hxx @@ -340,6 +340,7 @@ private: bool mbInSelect : 1; bool mbMirrored : 1; bool mbScrollAlwaysEnabled : 1; + bool mbSheets; Link<TabBar*,void> maSelectHdl; Link<TabBar*,void> maSplitHdl; @@ -347,7 +348,7 @@ private: size_t maCurrentItemList; using Window::ImplInit; - SVT_DLLPRIVATE void ImplInit( WinBits nWinStyle ); + SVT_DLLPRIVATE void ImplInit( WinBits nWinStyle, bool bSheets ); SVT_DLLPRIVATE void ImplInitSettings( bool bFont, bool bBackground ); SVT_DLLPRIVATE void ImplGetColors(const StyleSettings& rStyleSettings, Color& rFaceColor, Color& rFaceTextColor, @@ -382,7 +383,7 @@ public: static const sal_uInt16 APPEND; static const sal_uInt16 PAGE_NOT_FOUND; - TabBar( vcl::Window* pParent, WinBits nWinStyle ); + TabBar(vcl::Window* pParent, WinBits nWinStyle, bool bSheets = false); virtual ~TabBar() override; virtual void dispose() override; diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx index 94533e526f46..67c9b74d7357 100644 --- a/sc/source/ui/view/tabcont.cxx +++ b/sc/source/ui/view/tabcont.cxx @@ -40,7 +40,7 @@ #include <comphelper/lok.hxx> ScTabControl::ScTabControl( vcl::Window* pParent, ScViewData* pData ) - : TabBar(pParent, WB_3DLOOK | WB_MINSCROLL | WB_SCROLL | WB_RANGESELECT | WB_MULTISELECT | WB_DRAG) + : TabBar(pParent, WB_3DLOOK | WB_MINSCROLL | WB_SCROLL | WB_RANGESELECT | WB_MULTISELECT | WB_DRAG, true) , DropTargetHelper(this) , DragSourceHelper(this) , pViewData(pData) diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index 1e9a9172967f..7daba1791d3e 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -439,7 +439,7 @@ public: std::shared_ptr<weld::ButtonPressRepeater> m_xPrevRepeater; std::shared_ptr<weld::ButtonPressRepeater> m_xNextRepeater; - TabButtons(TabBar* pParent) + TabButtons(TabBar* pParent, bool bSheets) : InterimItemWindow(pParent, pParent->IsMirrored() ? OUString("svt/ui/tabbuttonsmirrored.ui") : OUString("svt/ui/tabbuttons.ui"), @@ -459,6 +459,15 @@ public: m_xNextButton->set_accessible_name(SvtResId(STR_TABBAR_PUSHBUTTON_MOVERIGHT)); m_xLastButton->set_accessible_name(SvtResId(STR_TABBAR_PUSHBUTTON_MOVETOEND)); m_xAddButton->set_accessible_name(SvtResId(STR_TABBAR_PUSHBUTTON_ADDTAB)); + + if (bSheets) + { + 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)); + m_xLastButton->set_tooltip_text(SvtResId(STR_TABBAR_HINT_MOVETOEND_SHEETS)); + m_xAddButton->set_tooltip_text(SvtResId(STR_TABBAR_HINT_ADDTAB_SHEETS)); + } } void AdaptToHeight(int nHeight) @@ -504,10 +513,10 @@ struct TabBar_Impl } }; -TabBar::TabBar( vcl::Window* pParent, WinBits nWinStyle ) : +TabBar::TabBar( vcl::Window* pParent, WinBits nWinStyle, bool bSheets ) : Window( pParent, (nWinStyle & WB_3DLOOK) | WB_CLIPCHILDREN ) { - ImplInit( nWinStyle ); + ImplInit( nWinStyle, bSheets ); maCurrentItemList = 0; } @@ -526,7 +535,7 @@ void TabBar::dispose() const sal_uInt16 TabBar::APPEND = ::std::numeric_limits<sal_uInt16>::max(); const sal_uInt16 TabBar::PAGE_NOT_FOUND = ::std::numeric_limits<sal_uInt16>::max(); -void TabBar::ImplInit( WinBits nWinStyle ) +void TabBar::ImplInit( WinBits nWinStyle, bool bSheets ) { mpImpl.reset(new TabBar_Impl); @@ -552,6 +561,7 @@ void TabBar::ImplInit( WinBits nWinStyle ) mbInSelect = false; mbMirrored = false; mbScrollAlwaysEnabled = false; + mbSheets = bSheets; ImplInitControls(); @@ -782,7 +792,7 @@ void TabBar::ImplInitControls() mpImpl->mpSizer.disposeAndClear(); } - mpImpl->mxButtonBox.disposeAndReset(VclPtr<TabButtons>::Create(this)); + mpImpl->mxButtonBox.disposeAndReset(VclPtr<TabButtons>::Create(this, mbSheets)); Link<const CommandEvent&, void> aContextLink = LINK( this, TabBar, ContextMenuHdl ); |