summaryrefslogtreecommitdiff
path: root/sw/source/uibase/ribbar
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2021-05-11 20:53:39 -0800
committerJim Raykowski <raykowj@gmail.com>2021-05-19 08:34:40 +0200
commitd8813b799343ae846a320d829e20e3f5f4ecb3a4 (patch)
treedd0c2326f10b74d945aae8224b8cd664dc7f7fe1 /sw/source/uibase/ribbar
parent128f67e0efa02294205a1abe1be874557ecdcecd (diff)
tdf#137741 Tooltip enhancement for Navigate By next prev 'Field by type'
This patch includes the current field type name in the tooltip for Navigate By next and previous buttons for 'Field by type' navigation or '[NONE]' if the current cursor position is not at a field. Change-Id: I0894aeed0f20e2844b413ee399d65978f31fb758 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115451 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw/source/uibase/ribbar')
-rw-r--r--sw/source/uibase/ribbar/workctrl.cxx21
1 files changed, 17 insertions, 4 deletions
diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx
index fb2f4f25790c..9e7491db8de1 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -284,10 +284,23 @@ static const char* STR_IMGBTN_ARY[] =
static OUString lcl_GetScrollToolTip(bool bNext)
{
sal_uInt16 nResId = SwView::GetMoveType();
- if (!bNext)
- nResId += NID_COUNT;
- const char* id = STR_IMGBTN_ARY[nResId - NID_START];
- return id ? SwResId(id): OUString();
+ OUString sToolTip = SwResId(STR_IMGBTN_ARY[(!bNext ? NID_COUNT : 0) + nResId - NID_START]);
+ if (nResId == NID_FIELD_BYTYPE)
+ {
+ OUString sFieldType;
+ SwWrtShell* pWrtSh = GetActiveWrtShell();
+ if (pWrtSh)
+ {
+ SwField* pCurField = pWrtSh->GetCurField(true);
+ if (pCurField)
+ sFieldType = SwFieldType::GetTypeStr(pCurField->GetTypeId());
+ }
+ if (!sFieldType.isEmpty())
+ sToolTip = sToolTip.replaceFirst(u"%FIELDTYPE", sFieldType);
+ else
+ sToolTip = SwResId(SW_STR_NONE);
+ }
+ return sToolTip;
}
namespace {