[Libreoffice-commits] core.git: sw/inc sw/source

Jim Raykowski (via logerrit) logerrit at kemper.freedesktop.org
Wed May 19 06:35:22 UTC 2021


 sw/inc/strings.hrc                   |    4 ++--
 sw/source/uibase/ribbar/workctrl.cxx |   21 +++++++++++++++++----
 2 files changed, 19 insertions(+), 6 deletions(-)

New commits:
commit d8813b799343ae846a320d829e20e3f5f4ecb3a4
Author:     Jim Raykowski <raykowj at gmail.com>
AuthorDate: Tue May 11 20:53:39 2021 -0800
Commit:     Jim Raykowski <raykowj at gmail.com>
CommitDate: Wed May 19 08:34:40 2021 +0200

    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 at gmail.com>

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 {


More information about the Libreoffice-commits mailing list