sw/inc/SwStyleNameMapper.hxx | 8 ++++++++ sw/source/core/doc/DocumentStylePoolManager.cxx | 3 +-- 2 files changed, 9 insertions(+), 2 deletions(-)
New commits: commit 5e93ce4e1ac6d3084247e889781441588b4ba41b Author: Noel Grandin <[email protected]> AuthorDate: Sun Dec 8 15:59:10 2024 +0200 Commit: Xisco Fauli <[email protected]> CommitDate: Mon Dec 16 14:02:32 2024 +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 <[email protected]> Tested-by: Jenkins (cherry picked from commit a33b6d57d04bc011cd0a8d44023efe1639915b09) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178557 Reviewed-by: Xisco Fauli <[email protected]> diff --git a/sw/inc/SwStyleNameMapper.hxx b/sw/inc/SwStyleNameMapper.hxx index 0fdfb381711a..80a18f28c5d4 100644 --- a/sw/inc/SwStyleNameMapper.hxx +++ b/sw/inc/SwStyleNameMapper.hxx @@ -87,11 +87,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, @@ -99,19 +101,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); @@ -120,8 +126,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 557c278968fc..0830799e3c1e 100644 --- a/sw/source/core/doc/DocumentStylePoolManager.cxx +++ b/sw/source/core/doc/DocumentStylePoolManager.cxx @@ -604,8 +604,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); }
