sw/inc/SwStyleNameMapper.hxx                    |    8 ++++++++
 sw/source/core/doc/DocumentStylePoolManager.cxx |    3 +--
 2 files changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 819d639c7601fe69097c6ca2e3a98da140930b61
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sun Dec 8 15:59:10 2024 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Jan 8 11:54:53 2025 +0100

    fix bug in use of SwStyleNameMapper::GetUIName
    
    introduced in
    ca435be45f316120b9df6c9d547b781ed975817d
    "writer: handle styles in multiple languages for online"
    
    and sprinkle some [[nodiscard]] around to prevent future such
    issues
    
    Change-Id: Ie12a7966a4de93c9ad05fef01fd2ff606f9dde6e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178087
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins
    (cherry picked from commit a33b6d57d04bc011cd0a8d44023efe1639915b09)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178557
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit 5e93ce4e1ac6d3084247e889781441588b4ba41b)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178582
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/inc/SwStyleNameMapper.hxx b/sw/inc/SwStyleNameMapper.hxx
index 139f09c974db..71f88e0d0f48 100644
--- a/sw/inc/SwStyleNameMapper.hxx
+++ b/sw/inc/SwStyleNameMapper.hxx
@@ -88,11 +88,13 @@ class SwStyleNameMapper final
 
 public:
     // This gets the UI Name from the programmatic name
+    SAL_WARN_UNUSED_RESULT
     static const OUString& GetUIName(const OUString& rName, 
SwGetPoolIdFromName);
     static         void FillUIName(const OUString& rName, OUString& rFillName,
                             SwGetPoolIdFromName);
 
     // Get the programmatic Name from the UI name
+    SAL_WARN_UNUSED_RESULT
     static const OUString& GetProgName(const OUString& rName,
                                        SwGetPoolIdFromName);
     static         void FillProgName(const OUString& rName, OUString& 
rFillName,
@@ -100,19 +102,23 @@ public:
 
     // This gets the UI Name from the Pool ID
     SW_DLLPUBLIC static void FillUIName(sal_uInt16 nId, OUString& rFillName);
+    SAL_WARN_UNUSED_RESULT
     SW_DLLPUBLIC static const OUString& GetUIName(sal_uInt16 nId,
                                                   const OUString& rName);
 
     // This gets the programmatic Name from the Pool ID
     static         void FillProgName(sal_uInt16 nId, OUString& rFillName);
+    SAL_WARN_UNUSED_RESULT
     SW_DLLPUBLIC static const OUString& GetProgName(sal_uInt16 nId,
                                                     const OUString& rName);
 
     // This gets the PoolId from the UI Name
+    SAL_WARN_UNUSED_RESULT
     SW_DLLPUBLIC static sal_uInt16 GetPoolIdFromUIName(const OUString& rName,
                                                        SwGetPoolIdFromName);
 
     // Get the Pool ID from the programmatic name
+    SAL_WARN_UNUSED_RESULT
     static sal_uInt16 GetPoolIdFromProgName(const OUString& rName,
                                             SwGetPoolIdFromName);
 
@@ -121,8 +127,10 @@ public:
     // RES_POOLCOLL_LABEL_TABLE, RES_POOLCOLL_LABEL_FRAME
     // forth and back.
     // Non-matching names remain unchanged.
+    SAL_WARN_UNUSED_RESULT
     SW_DLLPUBLIC static const OUString & GetSpecialExtraProgName(
                     const OUString& rExtraUIName);
+    SAL_WARN_UNUSED_RESULT
     static const OUString & GetSpecialExtraUIName(const OUString& 
rExtraProgName);
 
     static const std::vector<OUString>& GetTextUINameArray();
diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx 
b/sw/source/core/doc/DocumentStylePoolManager.cxx
index 96392c94b1c9..1f43ee5a8763 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -601,8 +601,7 @@ SwTextFormatColl* 
DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId,
             // in online we can have multiple languages, use translated name
             if (comphelper::LibreOfficeKit::isActive())
             {
-                OUString aName;
-                SwStyleNameMapper::GetUIName(nId, aName);
+                OUString aName = SwStyleNameMapper::GetUIName(nId, OUString());
                 if (!aName.isEmpty())
                     pNewColl->SetFormatName(aName);
             }

Reply via email to