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 <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2026-02-05 09:27:45 +01:00
parent a015bd6ed7
commit f81cdc295b
@@ -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