cui/source/tabpages/numpages.cxx |   30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

New commits:
commit 601cf07cfc614c11769ccd6a619013b0f652741a
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Mon Sep 15 15:17:53 2025 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Tue Sep 16 02:13:54 2025 +0200

    tdf#160042 bullets and numbering dlg: preselect if match found
    
    The Bullets and Numbering dialog
    has three tabs with locale-defined choices
    for bullets, numbering, and outline list choices.
    
    However, these would always be "unselected"
    if there was already numbering defined at the cursor.
    
    This patch pre-selects the choice
    that matches the current numbering level,
    just like what the toolbar already does.
    
    Change-Id: Ib4316791ca17233fe3dea7ced7f695cd5815bc93
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190991
    Reviewed-by: Justin Luth <jl...@mail.com>
    Tested-by: Jenkins

diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 8249773eb115..2018311f7cbe 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -28,6 +28,8 @@
 #include <vcl/svapp.hxx>
 #include <svx/colorbox.hxx>
 #include <svx/dlgutil.hxx>
+#include <svx/nbdtmgfact.hxx>
+#include <svx/nbdtmg.hxx>
 #include <svx/strarray.hxx>
 #include <svx/gallery.hxx>
 #include <editeng/brushitem.hxx>
@@ -234,6 +236,14 @@ void  SvxSingleNumPickTabPage::ActivatePage(const 
SfxItemSet& rSet)
         NumSelectHdl_Impl(m_xExamplesVS.get());
         bPreset = true;
     }
+    else if (pActNum)
+    {
+        svx::sidebar::NBOTypeMgrBase* pChoices
+            = 
svx::sidebar::NBOutlineTypeMgrFact::CreateInstance(svx::sidebar::NBOType::Numbering);
+        if (pChoices)
+            
m_xExamplesVS->SelectItem(pChoices->GetNBOIndexForNumRule(*pActNum, 
nActNumLvl));
+    }
+
     bPreset |= bIsPreset;
 
     bModified = false;
@@ -383,6 +393,19 @@ void  SvxBulletPickTabPage::ActivatePage(const SfxItemSet& 
rSet)
         NumSelectHdl_Impl(m_xExamplesVS.get());
         bPreset = true;
     }
+    else if (pActNum)
+    {
+        svx::sidebar::NBOTypeMgrBase* pChoices
+            = 
svx::sidebar::NBOutlineTypeMgrFact::CreateInstance(svx::sidebar::NBOType::Bullets);
+        if (pChoices)
+        {
+            const sal_uInt16 nLevel = 
svx::sidebar::NBOTypeMgrBase::IsSingleLevel(nActNumLvl);
+            SvxNumberFormat aFmt(pActNum->GetLevel(nLevel));
+            if (aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL)
+                
m_xExamplesVS->SelectItem(pChoices->GetNBOIndexForNumRule(*pActNum, 
nActNumLvl));
+        }
+    }
+
     bPreset |= bIsPreset;
     bModified = false;
 }
@@ -658,6 +681,13 @@ void  SvxNumPickTabPage::ActivatePage(const SfxItemSet& 
rSet)
         NumSelectHdl_Impl(m_xExamplesVS.get());
         bPreset = true;
     }
+    else if (pActNum)
+    {
+        svx::sidebar::NBOTypeMgrBase* pChoices
+            = 
svx::sidebar::NBOutlineTypeMgrFact::CreateInstance(svx::sidebar::NBOType::Outline);
+        if (pChoices)
+            
m_xExamplesVS->SelectItem(pChoices->GetNBOIndexForNumRule(*pActNum, 
nActNumLvl));
+    }
     bPreset |= bIsPreset;
     bModified = false;
 }

Reply via email to