officecfg/registry/schema/org/openoffice/Office/Common.xcs | 18 +++--- sw/inc/editsh.hxx | 2 sw/qa/uibase/wrtsh/wrtsh.cxx | 37 +++++++++++++ sw/source/uibase/wrtsh/wrtsh1.cxx | 6 +- 4 files changed, 53 insertions(+), 10 deletions(-)
New commits: commit 2a9661ca1e2c21eac1e2f49b44e2941a64814002 Author: Miklos Vajna <[email protected]> AuthorDate: Mon May 12 09:42:03 2025 +0200 Commit: Caolán McNamara <[email protected]> CommitDate: Mon May 12 13:16:12 2025 +0200 tdf#166229 sw: make bullet style change again with list indentation level Create a new document, turn on bullets, create a next paragraph, increase the indent level, the same bullet character is used for the inner level, while this used to be different. This went wrong in commit 626357f53c934e7f57dc80c3c83ad080767961f3 (Use configured bullet symbol when clicking bullets button, 2024-07-11), which changes Writer to take the bullet characters from the common DefaultBullets settings, because it wanted Writer bullets to respect that setting. That's OK, but it always took the bullet character configured for the first level, also the size of the characters were inconsistent (first is significantly smaller than 2nd, 3rd, 4th). Fix the problem by taking the current level index into account in SwWrtShell::NumOrBulletOn(), unless the configured bullet character list is shorter than the amount of available Writer indentation levels. Also change the DefaultBullets item values to match what was the default in Writer. Likely this is not controversial, since it seems Impress has its own defaults: Writer has 3 characters cycled through 10 levels, Impress seems to be switching between "•" and "-" for the first 4 levels, then just "•" for the remaining levels. And this is just for new bullets, existing numberings do what's stored in the document. Change-Id: I4a2a458d3fafe96f702d8c1b2f1cf6cd78b8014d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185196 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index e834ea07f9e2..85dcf9955c17 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -3362,13 +3362,15 @@ </info> <value> <it>•</it> - <it>●</it> - <it>○</it> - <it>□</it> - <it>►</it> - <it>→</it> - <it>-</it> - <it>–</it> + <it>◦</it> + <it>▪</it> + <it>•</it> + <it>◦</it> + <it>▪</it> + <it>•</it> + <it>◦</it> + <it>▪</it> + <it>•</it> </value> </prop> <prop oor:name="DefaultBulletsFonts" oor:type="oor:string-list" oor:nillable="false"> @@ -3384,6 +3386,8 @@ <it>OpenSymbol</it> <it>OpenSymbol</it> <it>OpenSymbol</it> + <it>OpenSymbol</it> + <it>OpenSymbol</it> </value> </prop> </group> diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index ea21fe4025ee..421f4c181564 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -532,7 +532,7 @@ public: /// Delete, split enumeration list. void DelNumRules(); - void NumUpDown( bool bDown = true ); + SW_DLLPUBLIC void NumUpDown( bool bDown = true ); SW_DLLPUBLIC bool MoveParagraph( SwNodeOffset nOffset = SwNodeOffset(1)); bool MoveNumParas( bool bUpperLower, bool bUpperLeft ); diff --git a/sw/qa/uibase/wrtsh/wrtsh.cxx b/sw/qa/uibase/wrtsh/wrtsh.cxx index 76449a0dd37d..df6c452a5308 100644 --- a/sw/qa/uibase/wrtsh/wrtsh.cxx +++ b/sw/qa/uibase/wrtsh/wrtsh.cxx @@ -506,6 +506,43 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlysAnchorJoin) pWrtShell->SttEndDoc(/*bStt=*/false); CPPUNIT_ASSERT_EQUAL(u"second para"_ustr, pCursor->GetPointNode().GetTextNode()->GetText()); } + +CPPUNIT_TEST_FIXTURE(Test, testBulletCharChangeOnIndent) +{ + // Given an empty document: + createSwDoc(); + + // When adding 2 bullets, A is level 1, B is level 2: + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + pWrtShell->BulletOn(); + pWrtShell->Insert(u"A"_ustr); + pWrtShell->SplitNode(); + // Increase indent: downgrade to level 2. + pWrtShell->NumUpDown(/*bDown=*/true); + pWrtShell->Insert(u"B"_ustr); + + // Then make sure the bullet characters are different: + pWrtShell->Up(/*bSelect=*/false); + SwCursor* pCursor = pWrtShell->GetCursor(); + sal_UCS4 nBullet1 = 0; + { + SwTextNode* pTextNode = pCursor->GetPointNode().GetTextNode(); + SwNumRule* pNumRule = pTextNode->GetNumRule(); + const SwNumFormat& rNumFormat = pNumRule->Get(pTextNode->GetActualListLevel()); + nBullet1 = rNumFormat.GetBulletChar(); + } + pWrtShell->Down(/*bSelect=*/false); + sal_UCS4 nBullet2 = 0; + { + SwTextNode* pTextNode = pCursor->GetPointNode().GetTextNode(); + SwNumRule* pNumRule = pTextNode->GetNumRule(); + const SwNumFormat& rNumFormat = pNumRule->Get(pTextNode->GetActualListLevel()); + nBullet2 = rNumFormat.GetBulletChar(); + } + // Without the accompanying fix in place, this test would have failed, while nBullet1 should be + // • and nBullet2 should be ◦. + CPPUNIT_ASSERT(nBullet1 != nBullet2); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index f1d22146c084..f3c568ae1e3b 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -1638,9 +1638,11 @@ void SwWrtShell::NumOrBulletOn(bool bNum) officecfg::Office::Common::BulletsNumbering::DefaultBullets::get()); uno::Sequence<OUString> aBulletSymbolsFonts( officecfg::Office::Common::BulletsNumbering::DefaultBulletsFonts::get()); - aFormat.SetBulletChar(aBulletSymbols[0].toChar()); + sal_Int32 nBulletSymbolIndex = nLvl < aBulletSymbols.getLength() ? nLvl : 0; + aFormat.SetBulletChar(aBulletSymbols[nBulletSymbolIndex].toChar()); vcl::Font aFont; - aFont.SetFamilyName(aBulletSymbolsFonts[0]); + sal_Int32 nBulletSymbolsFontIndex = nLvl < aBulletSymbolsFonts.getLength() ? nLvl : 0; + aFont.SetFamilyName(aBulletSymbolsFonts[nBulletSymbolsFontIndex]); aFormat.SetBulletFont(&aFont); aFormat.SetNumberingType(SVX_NUM_CHAR_SPECIAL); // #i93908# clear suffix for bullet lists
