sw/qa/extras/uiwriter/uiwriter5.cxx | 9 +++++++++ sw/source/core/edit/ednumber.cxx | 14 +++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-)
New commits: commit 6b6bedecf61e084e8db6b20a362a231dbac0e70a Author: Justin Luth <jl...@mail.com> AuthorDate: Tue May 24 16:00:48 2022 +0200 Commit: Justin Luth <jl...@mail.com> CommitDate: Wed Jun 15 19:56:12 2022 +0200 tdf#145151 sw IsTableMode GetNumRuleAtCurrCursorPos: unselected cells ...shouldn't be treated as if the cursor was there. Change-Id: Ida435635aab4442b93f969d6f473aacf3f229e02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134887 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx b/sw/qa/extras/uiwriter/uiwriter5.cxx index c88dd905f584..f8bbc0d52624 100644 --- a/sw/qa/extras/uiwriter/uiwriter5.cxx +++ b/sw/qa/extras/uiwriter/uiwriter5.cxx @@ -2920,6 +2920,15 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf145151) getProperty<OUString>(getParagraphOfText(1, xCellA1->getText()), "NumberingStyleName") .isEmpty()); + // Toggle it back off + dispatchCommand(mxComponent, ".uno:DefaultNumbering", {}); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_MESSAGE( + "Cell B1 must be able to toggle numbering on and off.", + getProperty<OUString>(getParagraphOfText(1, xCellB1->getText()), "NumberingStyleName") + .isEmpty()); + // Now test removing numbering/bullets // Add A1 to the current B1 selection pWrtSh->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, /*bBasicCall=*/false); diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index 93e0de0a4c2c..dd21abd149f6 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -705,7 +705,19 @@ sal_uInt8 SwEditShell::GetNumLevel() const const SwNumRule* SwEditShell::GetNumRuleAtCurrCursorPos() const { - SwPosition pos(*GetCursor()->GetPoint()); + SwPaM* pCursor = GetCursor(); + if (IsTableMode() && pCursor->IsMultiSelection() ) + { + // Find the first valid position + for (SwPaM& rPaM : pCursor->GetRingContainer()) + { + if (!rPaM.HasMark()) + continue; + pCursor = &rPaM; + break; + } + } + SwPosition pos(*pCursor->GetPoint()); return SwDoc::GetNumRuleAtPos( pos, GetLayout() ); }