diff options
author | Jim Raykowski <raykowj@gmail.com> | 2021-05-11 20:53:39 -0800 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2021-05-19 08:34:40 +0200 |
commit | d8813b799343ae846a320d829e20e3f5f4ecb3a4 (patch) | |
tree | dd0c2326f10b74d945aae8224b8cd664dc7f7fe1 | |
parent | 128f67e0efa02294205a1abe1be874557ecdcecd (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>
-rw-r--r-- | sw/inc/strings.hrc | 4 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/workctrl.cxx | 21 |
2 files changed, 19 insertions, 6 deletions
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc index f3b47ca33077..b4cd30c0fc47 100644 --- a/sw/inc/strings.hrc +++ b/sw/inc/strings.hrc @@ -1227,8 +1227,8 @@ #define STR_IMGBTN_RECENCY_DOWN NC_("STR_IMGBTN_RECENCY_DOWN", "Go forward") #define STR_IMGBTN_FIELD_UP NC_("STR_IMGBTN_FIELD_UP", "Previous field") #define STR_IMGBTN_FIELD_DOWN NC_("STR_IMGBTN_FIELD_DOWN", "Next field") -#define STR_IMGBTN_FIELD_BYTYPE_UP NC_("STR_IMGBTN_FIELD_BYTYPE_UP", "Previous field with current field type") -#define STR_IMGBTN_FIELD_BYTYPE_DOWN NC_("STR_IMGBTN_FIELD_BYTYPE_DOWN", "Next field with current field type") +#define STR_IMGBTN_FIELD_BYTYPE_UP NC_("STR_IMGBTN_FIELD_BYTYPE_UP", "Previous '%FIELDTYPE' field") +#define STR_IMGBTN_FIELD_BYTYPE_DOWN NC_("STR_IMGBTN_FIELD_BYTYPE_DOWN", "Next '%FIELDTYPE' field") #define STR_REDLINE_INSERT NC_("STR_REDLINE_INSERT", "Inserted") #define STR_REDLINE_DELETE NC_("STR_REDLINE_DELETE", "Deleted") 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 { |