svx/source/tbxctrls/tbcontrl.cxx |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 2cf9f6e57529fdb1858d3219352174f8dd1b1fde
Author:     Jaume Pujantell <[email protected]>
AuthorDate: Tue Dec 9 16:09:36 2025 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Wed Dec 10 16:09:02 2025 +0100

    svx: force default style on stylebox clear format
    
    SvxStyleBox_Base::SetupEntry returns early on entries that do not
    correspond to actual styles, assuming that the default style will be
    used. This is not always the case, sometimes the text is rendered in
    other formats.
    
    This change forces the setup of the default style on those entries.
    
    Change-Id: I06f8a10c8d7da38f90ee84788430817e421965c6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195305
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 81dea624b8e4..ca2ee543328b 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1383,9 +1383,6 @@ void SvxStyleBox_Base::SetupEntry(vcl::RenderContext& 
rRenderContext, sal_Int32
         }
     }
 
-    if (nItem <= 0 || nItem >= m_xWidget->get_count() - 1)
-        return;
-
     SfxObjectShell *pShell = SfxObjectShell::Current();
     if (!pShell)
         return;
@@ -1395,9 +1392,18 @@ void SvxStyleBox_Base::SetupEntry(vcl::RenderContext& 
rRenderContext, sal_Int32
         return;
 
     SfxStyleSheetBase* pStyle = pPool->First(eStyleFamily);
-    while (pStyle && pStyle->GetName() != rStyleName)
+    SfxStyleSheetBase* pDefaultStyle = nullptr;
+    while (pStyle)
+    {
+        if (pStyle->GetName() == rStyleName)
+            break;
+        if (pStyle->GetName() == sDefaultStyle)
+            pDefaultStyle = pStyle;
         pStyle = pPool->Next();
+    }
 
+    if (!pStyle)
+        pStyle = pDefaultStyle;
     if (!pStyle )
         return;
 

Reply via email to