sd/qa/ui/func/func.cxx | 47 +++++++++++++++++++++++++++++++++++++++++ sd/source/ui/func/fuolbull.cxx | 2 - 2 files changed, 48 insertions(+), 1 deletion(-)
New commits: commit 32333f8e5367bc703083057caafae3351ec9a983 Author: Miklos Vajna <[email protected]> AuthorDate: Fri Jan 30 08:26:30 2026 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Fri Jan 30 14:52:24 2026 +0100 tdf#170466 sd UI, bullet library: avoid unwanted defaults Load an Impress document, add a textbox, use the bullet library toolbar button to have a popup with previews, select the "white bullet" option, "black cricle" gets used. This went wrong in commit fe9fab9702613b1a5d192821d8a620aa527234b7 (Related: tdf#89365 sd UI, from numbering to bullet: fix defaults, 2025-12-18), where the old use-case was to just toggle from no numbering to bullet, without specifying any item from the bullet library, where the expectation was to connect this paragraph to the outermost outline style. Fix the new use-case by not setting bullet properties if a specific item is selected from the bullet library. This way the new use-case again takes bullet properties from the bullet library and the old use-case keeps setting the defaults to have a correct bullet size. Change-Id: I77931a48e604f177deff4976336783bcff8a7e8a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198398 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins (cherry picked from commit 49a49acf65f5d77383551217abc39c06dbd62909) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198424 Reviewed-by: Xisco Fauli <[email protected]> diff --git a/sd/qa/ui/func/func.cxx b/sd/qa/ui/func/func.cxx index f6df8fcc8857..6ae13f1baa1f 100644 --- a/sd/qa/ui/func/func.cxx +++ b/sd/qa/ui/func/func.cxx @@ -13,6 +13,7 @@ #include <com/sun/star/drawing/XDrawPage.hpp> #include <comphelper/sequenceashashmap.hxx> +#include <comphelper/propertyvalue.hxx> #include <vcl/scheduler.hxx> #include <DrawDocShell.hxx> @@ -81,6 +82,52 @@ CPPUNIT_TEST_FIXTURE(Test, testNoneToBullet) aNumberingRule[u"FirstLineOffset"_ustr] >>= nFirstLineOffset; CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-900), nFirstLineOffset); } + +CPPUNIT_TEST_FIXTURE(Test, testNoneToLibraryBullet) +{ + // Given a document with a shape, the only paragraph has a numbering of type "none": + createSdImpressDoc("odp/none-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 "none" numbering to a bullet from the library: + // Start text edit: + auto pImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get()); + typeString(pImpressDocument, u"x"); + CPPUNIT_ASSERT(pView->IsTextEdit()); + // Do the switch, taking the second option from the list: + uno::Sequence<beans::PropertyValue> aArgs + = { comphelper::makePropertyValue("BulletIndex", static_cast<sal_uInt16>(2)) }; + dispatchCommand(mxComponent, u".uno:SetBullet"_ustr, aArgs); + // End text edit: + typeKey(pImpressDocument, KEY_ESCAPE); + + // Then make sure we switch to a bullet with the correct character: + 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(0, xShape), + uno::UNO_QUERY); + // Check the list level 1 properties: + uno::Reference<container::XIndexAccess> xNumberingRules; + xParagraph->getPropertyValue(u"NumberingRules"_ustr) >>= xNumberingRules; + comphelper::SequenceAsHashMap aNumberingRule(xNumberingRules->getByIndex(0)); + OUString aBulletChar; + aNumberingRule[u"BulletChar"_ustr] >>= aBulletChar; + // Without the accompanying fix in place, this test would have failed with: + // - Expected: ○ (white bullet) + // - Actual : ● (black circle) + // i.e. the bullet char was the default, not the selected one. + CPPUNIT_ASSERT_EQUAL(u"\u25CB"_ustr, aBulletChar); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx index ecb7c5377a1b..246176da700c 100644 --- a/sd/source/ui/func/fuolbull.cxx +++ b/sd/source/ui/func/fuolbull.cxx @@ -207,7 +207,7 @@ void FuBulletAndPosition::SetCurrentBulletsNumbering(SfxRequest& rReq) if(nActNumLvl & nMask) { SvxNumberFormat aFmt(aTmpRule.GetLevel(i)); - if (nSId == FN_SVX_SET_BULLET) + if (nSId == FN_SVX_SET_BULLET && bToggle) { // If changing to a bullet, then make its format and indent has a good // default, similar to what the master page offers:
