[Libreoffice-commits] core.git: Branch 'libreoffice-7-3-3' - sw/qa sw/source

2022-04-27 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/uiwriter.cxx |   51 +
 sw/source/core/txtnode/ndtxt.cxx   |5 +++
 2 files changed, 56 insertions(+)

New commits:
commit 5706653d0eb1dff015712181a1e27a0785376200
Author: Michael Stahl 
AuthorDate: Fri Apr 22 19:26:47 2022 +0200
Commit: Christian Lohmaier 
CommitDate: Wed Apr 27 12:41:20 2022 +0200

tdf#135978 sw_redlinehide: recreate fly frames anchored to subsequent nodes

... in SwTextNode::JoinNext().

The 2nd node is deleted, so its frame is deleted, and if it is the start
of a merged frame, fly frames on the node itself will be recreated
already, but those on subseqent nodes need an extra call.

Change-Id: I1846334f5560b720d3d275610bc8b07973f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/15
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 98ae340307786c8fe18addc3714c9b859fdf12dd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133371
Reviewed-by: Caolán McNamara 
(cherry picked from commit f4740811b65076d9a84c098f466a02143fcfec06)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133397
Reviewed-by: Xisco Fauli 
Reviewed-by: Thorsten Behrens 
Reviewed-by: Christian Lohmaier 
Tested-by: Christian Lohmaier 

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 1e6f8be07b06..d38c33364803 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -693,6 +693,57 @@ void SwUiWriterTest::testTdf67238()
 
CPPUNIT_ASSERT(!((rTable.GetTableBox("C3"))->GetFrameFormat()->GetProtect()).IsContentProtected());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf135978)
+{
+SwDoc* pDoc = createSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+pWrtShell->Insert("foobar");
+pWrtShell->SplitNode();
+pWrtShell->Insert("bazquux");
+
+CPPUNIT_ASSERT(pWrtShell->IsEndOfDoc());
+
+SwFormatAnchor anchor(RndStdIds::FLY_AT_CHAR);
+anchor.SetAnchor(pWrtShell->GetCursor()->GetPoint());
+SfxItemSet flySet(pDoc->GetAttrPool(), svl::Items);
+flySet.Put(anchor);
+SwFlyFrameFormat const* pFly = dynamic_cast(
+pWrtShell->NewFlyFrame(flySet, /*bAnchValid=*/true));
+CPPUNIT_ASSERT(pFly != nullptr);
+CPPUNIT_ASSERT(pFly->GetFrame() != nullptr);
+// move cursor back to body
+pWrtShell->SttEndDoc(/*bStt=*/false);
+
+// hide and enable
+dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+
+CPPUNIT_ASSERT(pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+CPPUNIT_ASSERT(
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines());
+
+pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 4, 
/*bBasicCall=*/false);
+pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 6, 
/*bBasicCall=*/false);
+pWrtShell->Delete();
+
+// now split
+pWrtShell->SttEndDoc(/*bStt=*/true);
+pWrtShell->SplitNode();
+CPPUNIT_ASSERT(pFly->GetFrame() != nullptr);
+
+// the problem was that undo removed the fly frame from the layout
+pWrtShell->Undo();
+CPPUNIT_ASSERT(pFly->GetFrame() != nullptr);
+
+pWrtShell->Redo();
+CPPUNIT_ASSERT(pFly->GetFrame() != nullptr);
+
+pWrtShell->Undo();
+CPPUNIT_ASSERT(pFly->GetFrame() != nullptr);
+}
+
 void SwUiWriterTest::testFdo75110()
 {
 SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "fdo75110.odt");
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 4d109a8add1c..5c8a501386fa 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -884,6 +884,11 @@ void CheckResetRedlineMergeFlag(SwTextNode & rNode, 
Recreate const eRecreateMerg
 {
 
assert(pFrame->GetMergedPara()->listener.IsListeningTo(&rNode));
 assert(rNode.GetIndex() <= 
pFrame->GetMergedPara()->pLastNode->GetIndex());
+// tdf#135978 Join: recreate fly frames anchored to subsequent 
nodes
+if (eRecreateMerged == sw::Recreate::ThisNode)
+{
+AddRemoveFlysAnchoredToFrameStartingAtNode(*pFrame, rNode, 
nullptr);
+}
 }
 eMode = sw::FrameMode::New; // Existing is not idempotent!
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3-3' - sw/qa sw/source

2022-04-20 Thread Vasily Melenchuk (via logerrit)
 sw/qa/uitest/writer_tests7/tdf144439.py |3 +--
 sw/source/core/doc/number.cxx   |2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 9d933f2846030fb192a866307a19218d11be9461
Author: Vasily Melenchuk 
AuthorDate: Mon Apr 18 14:36:37 2022 +0300
Commit: Michael Stahl 
CommitDate: Wed Apr 20 12:13:31 2022 +0200

tdf#147472: sw: bug in numbering with previous level NONE

Previous fix for tdf#146257 was not complete and was not able to
take care of disabled numebering started just at beginning of the
numbering string.

UI test test_tdf144439_outline with modifications is covering this
situation. No need in extra testcases.

Change-Id: Id17838cec7fb4fb039f9b457b7ee9ad3ab345678
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133124
Tested-by: Jenkins
Reviewed-by: Vasily Melenchuk 
(cherry picked from commit a31a7b53c42eef3a8007766c60ec5a2539054a7c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133135
Reviewed-by: Xisco Fauli 
(cherry picked from commit 90715026e5a19956ef449694937893c0c76bea21)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133137
Reviewed-by: Adolfo Jayme Barrientos 
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/sw/qa/uitest/writer_tests7/tdf144439.py 
b/sw/qa/uitest/writer_tests7/tdf144439.py
index 6797260f7240..4862375834e8 100644
--- a/sw/qa/uitest/writer_tests7/tdf144439.py
+++ b/sw/qa/uitest/writer_tests7/tdf144439.py
@@ -69,8 +69,7 @@ class tdf144439(UITestCase):
 Paragraphs = document.Text.createEnumeration()
 Para1 = Paragraphs.nextElement()
 self.assertEqual(Para1.String, "Outline2")
-# Well, this looks strange, but we asked to show 1 & 2 levels and 
1st is without numbering
-self.assertEqual(Para1.getPropertyValue("ListLabelString"), ".1")
+self.assertEqual(Para1.getPropertyValue("ListLabelString"), "1")
 
 with 
self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as 
xDialog:
 # Select level "1"
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 8a5b9c5d7c60..4e446cbf215c 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -705,7 +705,7 @@ OUString SwNumRule::MakeNumString( const 
SwNumberTree::tNumberVector & rNumVecto
 OUString sFind("%" + OUString::number(i + 1) + "%");
 sal_Int32 nPositionToken = sLevelFormat.indexOf(sFind);
 sal_Int32 nPositionNextToken = sLevelFormat.indexOf('%', 
nPositionToken + sFind.getLength());
-if (nPositionToken > 0 && nPositionNextToken >= nPositionToken)
+if (nPositionToken >= 0 && nPositionNextToken >= 
nPositionToken)
 {
 sLevelFormat = sLevelFormat.replaceAt(nPositionToken, 
nPositionNextToken - nPositionToken, u"");
 }