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>
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index f3b47ca..b4cd30c 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 fb2f4f2..9e7491d 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 {