sw/source/writerfilter/dmapper/StyleSheetTable.cxx |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

New commits:
commit f81cdc295be469fa13ca3c8a15fe40dc56f91b07
Author:     Noel Grandin <[email protected]>
AuthorDate: Tue Feb 3 15:56:29 2026 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Feb 5 09:27:45 2026 +0100

    tdf#170595 no need to call HasListCharStyle
    
    if we are just going to create a new style anyway
    
    Change-Id: Ib7c70b1fe64bd12ed2e500c0fee686f45b94985f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198599
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sw/source/writerfilter/dmapper/StyleSheetTable.cxx 
b/sw/source/writerfilter/dmapper/StyleSheetTable.cxx
index 5ba0c1a04802..10892b7b3f47 100644
--- a/sw/source/writerfilter/dmapper/StyleSheetTable.cxx
+++ b/sw/source/writerfilter/dmapper/StyleSheetTable.cxx
@@ -2183,15 +2183,18 @@ void StyleSheetTable::applyDefaults(bool 
bParaProperties)
 
 OUString StyleSheetTable::getOrCreateCharStyle( const PropertyValueVector_t& 
rCharProperties, bool bAlwaysCreate )
 {
-    //find out if any of the styles already has the required properties then 
return its name
-    OUString sListLabel = HasListCharStyle(rCharProperties);
-    // Don't try to reuse an existing character style if requested.
-    if( !sListLabel.isEmpty() && !bAlwaysCreate)
-        return sListLabel;
+    if (!bAlwaysCreate)
+    {
+        //find out if any of the styles already has the required properties 
then return its name
+        OUString sListLabel = HasListCharStyle(rCharProperties);
+        // Don't try to reuse an existing character style if requested.
+        if( !sListLabel.isEmpty())
+            return sListLabel;
+    }
 
     //create a new one otherwise
     const rtl::Reference< SwXStyleFamily >& xCharStyles = 
m_rDMapper.GetCharacterStyles();
-    sListLabel = m_rDMapper.GetUnusedCharacterStyleName();
+    OUString sListLabel = m_rDMapper.GetUnusedCharacterStyleName();
     if (!m_xTextDocument)
         throw uno::RuntimeException();
     try

Reply via email to