sd/qa/unit/data/odp/num-to-bullet.odp |binary
 sd/qa/unit/uiimpress.cxx              |   48 ++++++++++++++++++++++++++++++++++
 sd/source/ui/view/drtxtob1.cxx        |    8 ++++-
 3 files changed, 55 insertions(+), 1 deletion(-)

New commits:
commit f5020b1c4a64bfe7d263233baf0a2485bfda5a47
Author:     Miklos Vajna <[email protected]>
AuthorDate: Tue Nov 4 12:16:58 2025 +0100
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Tue Nov 11 07:47:07 2025 +0100

    tdf#89365 sd UI: fix transitioning from a numbered list to a bulleted list
    
    The bugdoc has a level 2 numbering, pressing the toolbar button to
    switch to bullets turns off numbering instead of switching to bullets.
    
    Interestingly the same works in the other direction: you can switch to a
    numbering (while keeping the list level) from bullets using the next
    toolbar button just fine. The working code is in
    DrawViewShell::FuTemporary(), the FN_NUM_NUMBERING_ON dispatches an
    inner FN_SVX_SET_NUMBER, added in commit
    d02f75a8c36705924ddd6a5921fe3012fafce812 (Resolves: #i121420# merge
    sidebar feature, 2013-05-20).
    
    Fix the problem by adapting TextObjectBar::ExecuteImpl(), the
    FN_NUM_BULLET_ON case to also dispatch an inner FN_SVX_SET_BULLET,
    improving the naive "if it has a numbering or bullet, then just toggle
    it off" behavior from the older commit
    d580e86ddc6c810d2cc636ce5c9e6c4ca3f01fd0 (INTEGRATION: CWS impressodf12
    (1.30.98); FILE MERGED, 2008-06-06).
    
    Change-Id: Iac7ac33a9217e8bd29b2b6909b0d735795bd2224
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193396
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Tested-by: Caolán McNamara <[email protected]>
    (cherry picked from commit f60ee00edcc5b0fdee5227bb695448119cddb013)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193741
    Tested-by: Tomaž Vajngerl <[email protected]>
    Reviewed-by: Tomaž Vajngerl <[email protected]>

diff --git a/sd/qa/unit/data/odp/num-to-bullet.odp 
b/sd/qa/unit/data/odp/num-to-bullet.odp
new file mode 100644
index 000000000000..407065486705
Binary files /dev/null and b/sd/qa/unit/data/odp/num-to-bullet.odp differ
diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index 70598596c520..7a76fab3766e 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -1967,6 +1967,54 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf168835)
                          
xShape->getPropertyValue(u"CharFontName"_ustr).get<OUString>());
 }
 
+CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testNumToBullet)
+{
+    // Given a document with a shape, 2nd paragraph is a numbering:
+    createSdImpressDoc("odp/num-to-bullet.odp");
+    sd::ViewShell* pViewShell = getSdDocShell()->GetViewShell();
+    SdPage* pPage = pViewShell->GetActualPage();
+    SdrObject* pShape = pPage->GetObj(0);
+    CPPUNIT_ASSERT(pShape);
+    SdrView* pView = pViewShell->GetView();
+    pView->MarkObj(pShape, pView->GetSdrPageView());
+    Scheduler::ProcessEventsToIdle();
+    CPPUNIT_ASSERT(!pView->IsTextEdit());
+
+    // When turning the numbering to a bullet:
+    // Start text edit:
+    auto pImpressDocument = 
dynamic_cast<SdXImpressDocument*>(mxComponent.get());
+    typeString(pImpressDocument, u"x");
+    CPPUNIT_ASSERT(pView->IsTextEdit());
+    // Do the switch:
+    dispatchCommand(mxComponent, u".uno:DefaultBullet"_ustr, {});
+    // End text edit:
+    typeKey(pImpressDocument, KEY_ESCAPE);
+
+    // Then make sure we switch to a bullet and not toggle off the numbering:
+    CPPUNIT_ASSERT(!pView->IsTextEdit());
+    uno::Reference<drawing::XDrawPagesSupplier> 
xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<drawing::XDrawPage> 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+                                                 uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xParagraph(getParagraphFromShape(1, 
xShape),
+                                                   uno::UNO_QUERY);
+    // Check that list level is 1 & level 1 numbering type is a bullet:
+    sal_Int16 nNumberingLevel{};
+    xParagraph->getPropertyValue(u"NumberingLevel"_ustr) >>= nNumberingLevel;
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 1
+    // - Actual  : 0
+    // i.e. list level was -1 (toggle off) instead of switch to bullet.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(1), nNumberingLevel);
+    uno::Reference<container::XIndexAccess> xNumberingRules;
+    xParagraph->getPropertyValue(u"NumberingRules"_ustr) >>= xNumberingRules;
+    comphelper::SequenceAsHashMap 
aNumberingRule(xNumberingRules->getByIndex(1));
+    sal_Int16 nNumberingType = 0;
+    aNumberingRule[u"NumberingType"_ustr] >>= nNumberingType;
+    // Bullet and not numbering (ARABIC):
+    CPPUNIT_ASSERT_EQUAL(style::NumberingType::CHAR_SPECIAL, nNumberingType);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx
index f6a0762835bf..fbc3c4b60e1d 100644
--- a/sd/source/ui/view/drtxtob1.cxx
+++ b/sd/source/ui/view/drtxtob1.cxx
@@ -424,7 +424,13 @@ void TextObjectBar::ExecuteImpl(ViewShell* mpViewShell, 
::sd::View* mpView, SfxR
                 }
 
                 if (!bMasterPage)
-                    pOLV->ToggleBullets();
+                {
+                    // Set all levels of the list, so later increase/decrease 
of the list level
+                    // works, too.
+                    SfxUInt16Item aItem(FN_SVX_SET_BULLET, sal_uInt16(0xFFFF));
+                    mpViewShell->GetViewFrame()->GetDispatcher()->ExecuteList(
+                        FN_SVX_SET_BULLET, SfxCallMode::RECORD, { &aItem });
+                }
                 else
                 {
                     //Resolves: fdo#78151 in master pages if we toggle bullets 
on

Reply via email to