diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2023-08-16 09:34:49 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-08-16 10:43:46 +0200 |
commit | 1cf29168840f84c2e946e2678b99988e83503c96 (patch) | |
tree | 089b8696995ac8dd7276cba6fdd1df67b3939ef2 /sw/qa | |
parent | fa728837ecab38b59c2c562ed48505f204a89bea (diff) |
tdf#156682 sw floattable: fix missing del of master anchor para por on split
Pressing "enter" at the end of B1 in the bugdoc resulted in a split
floating table, which had the anchor text duplicated (both on page 1 and
page2).
What happened is that the master anchor frame didn't have its paragraph
portion cleared, the follow anchor frame had a correct frame offset (of
0).
Fix the problem in SwTextFrame::FormatEmpty(), similar to what commit
00b9b33334791079c2dc26b1ed4c123450cabf7d (sw: call FormatEmpty() in
SwTextFrame::Format() for split fly masters, 2023-02-09), did; here what
we want to avoid is setting some properties on the paragraph preventing
the deletion of non-last anchor paragraph portions.
As a side effect, this also fixes the hang from the bugreport, after
pressing "enter" 5 times at the end of B1.
Change-Id: I16e6d786f02ad503a0fdff465ecf7716c1c5f8b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155732
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/core/text/data/floattable-leftover-para-portion.docx | bin | 0 -> 15305 bytes | |||
-rw-r--r-- | sw/qa/core/text/porrst.cxx | 57 |
2 files changed, 57 insertions, 0 deletions
diff --git a/sw/qa/core/text/data/floattable-leftover-para-portion.docx b/sw/qa/core/text/data/floattable-leftover-para-portion.docx Binary files differnew file mode 100644 index 000000000000..51eee56cf003 --- /dev/null +++ b/sw/qa/core/text/data/floattable-leftover-para-portion.docx diff --git a/sw/qa/core/text/porrst.cxx b/sw/qa/core/text/porrst.cxx new file mode 100644 index 000000000000..1c343dc0d9f2 --- /dev/null +++ b/sw/qa/core/text/porrst.cxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <swmodeltestbase.hxx> + +#include <memory> + +#include <IDocumentLayoutAccess.hxx> +#include <doc.hxx> +#include <frame.hxx> +#include <layfrm.hxx> +#include <pagefrm.hxx> +#include <rootfrm.hxx> +#include <txtfrm.hxx> + +namespace +{ +/// Covers sw/source/core/text/porrst.cxx fixes. +class Test : public SwModelTestBase +{ +public: + Test() + : SwModelTestBase("/sw/qa/core/text/data/") + { + } +}; + +CPPUNIT_TEST_FIXTURE(Test, testFloattableLeftoverParaPortion) +{ + // Given a document with a multi-page floating table, the anchor of the table has some text: + createSwDoc("floattable-leftover-para-portion.docx"); + + // When laying out that document: + calcLayout(); + + // Then make sure all anchor text goes to the second page: + SwDoc* pDoc = getSwDoc(); + SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); + auto pPage = dynamic_cast<SwPageFrame*>(pLayout->Lower()); + CPPUNIT_ASSERT(pPage); + SwFrame* pBody = pPage->FindBodyCont(); + SwFrame* pPara1 = pBody->GetLower(); + auto pPara2 = pPara1->GetNext()->DynCastTextFrame(); + CPPUNIT_ASSERT(pPara2); + // Without the accompanying fix in place, this test would have failed, the first page's anchor + // also had some (duplicated) anchor text. + CPPUNIT_ASSERT(!pPara2->GetPara()); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |