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 d32dd7675b36952dd38e6c9b7d280ff2c4008404 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Mon May 12 09:42:03 2025 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon May 12 16:27:17 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/+/185208 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index afab119c23d1..4de5cfadd07a 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -3382,13 +3382,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"> @@ -3404,6 +3406,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 4210180c006f..a62082d4a36b 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -533,7 +533,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 ea4f7e6fb776..d5b6cd439641 100644 --- a/sw/qa/uibase/wrtsh/wrtsh.cxx +++ b/sw/qa/uibase/wrtsh/wrtsh.cxx @@ -508,6 +508,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 6b9d55d01783..3797ed4bcabe 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