tdf#157574 Revert "tdf#153613 tdf#146984 split para after anchors"

This reverts 7.6 commit 828fde3763.

and also reverts the dependent parts of the follow-up test from
commit 828fde3763
(although the patch itself is fine to remain in place)

and also reverts followup "cid#1522030 Uninitialized scalar field"
commit 9a123a6e63.

The commit in general is fine. However, it fails in case
of an empty paragraph (with only anchors).
Unfortunately, there is no way of knowing ahead of time,
so either everything needs to be processed after a delay,
or else the paragraph needs to be split and then re-joined
in case it is not an empty paragraph.
Both options are extremely non-trivial - I don't know how
to do either of them.

Change-Id: I9e98d825ad0008e822172b6797116ad16e90b871
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157593
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
This commit is contained in:
Justin Luth
2023-10-05 16:26:13 +02:00
committed by Justin Luth
parent d7e70203e0
commit 32102e559e
5 changed files with 1 additions and 35 deletions
@@ -193,11 +193,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf146984_anchorInShape, "tdf146984_anchorInShape.d
{
// This was only one page b/c the page break was missing.
CPPUNIT_ASSERT_EQUAL(2, getPages());
const auto& pLayout = parseLayoutDump();
// There are shapes on both pages - these should be non-zero numbers
assertXPath(pLayout, "//page[1]//anchored", 3);
assertXPath(pLayout, "//page[2]//anchored", 2);
}
DECLARE_OOXMLEXPORT_TEST(testTdf127622_framePr, "tdf127622_framePr.docx")
@@ -379,16 +374,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153613_textboxAfterPgBreak2, "tdf153613_textboxA
assertXPathContent(pLayout, "//page[2]/body/txt", "There should be no prior carriage return.");
}
DECLARE_OOXMLEXPORT_TEST(testTdf153613_textboxAfterPgBreak3, "tdf153613_textboxAfterPgBreak3.docx")
{
// All anchored TO-character shapes stay on the first page, before the page break.
CPPUNIT_ASSERT_EQUAL(2, getPages());
CPPUNIT_ASSERT_EQUAL(3, getParagraphs());
const auto& pLayout = parseLayoutDump();
assertXPath(pLayout, "//page[2]//anchored", 0);
}
DECLARE_OOXMLEXPORT_TEST(testTdf153613_sdtAfterPgBreak, "tdf153613_sdtAfterPgBreak.docx")
{
CPPUNIT_ASSERT_EQUAL(2, getPages());
+1 -4
View File
@@ -3741,7 +3741,7 @@ void DomainMapper::lcl_startShape(uno::Reference<drawing::XShape> const& xShape)
{
// If there is a deferred page break, handle it now, so that the
// started shape will be on the correct page.
if (m_pImpl->isBreakDeferred(PAGE_BREAK) && !m_pImpl->IsBreakDeferredByAnchor())
if (m_pImpl->isBreakDeferred(PAGE_BREAK))
{
// RTF doesn't properly report IsFirstRun, so in order to prevent regressions
// always split the paragraph for RTF since that is the way it has been done lately.
@@ -3751,9 +3751,6 @@ void DomainMapper::lcl_startShape(uno::Reference<drawing::XShape> const& xShape)
finishParagraph();
lcl_startParagraphGroup();
}
else
m_pImpl->SetIsBreakDeferredByAnchor();
}
m_pImpl->PushShapeContext( xShape );
lcl_startParagraphGroup();
@@ -334,7 +334,6 @@ DomainMapper_Impl::DomainMapper_Impl(
m_bIsColumnBreakDeferred( false ),
m_bIsPageBreakDeferred( false ),
m_nLineBreaksDeferred( 0 ),
m_bIsBreakDeferredByAnchor(false),
m_bSdtEndDeferred(false),
m_bParaSdtEndDeferred(false),
m_bStartTOC(false),
@@ -1592,7 +1591,6 @@ void DomainMapper_Impl::clearDeferredBreak(BreakType deferredBreakType)
break;
case PAGE_BREAK:
m_bIsPageBreakDeferred = false;
m_bIsBreakDeferredByAnchor = false;
break;
default:
break;
@@ -1604,17 +1602,6 @@ void DomainMapper_Impl::clearDeferredBreaks()
m_nLineBreaksDeferred = 0;
m_bIsColumnBreakDeferred = false;
m_bIsPageBreakDeferred = false;
m_bIsBreakDeferredByAnchor = false;
}
bool DomainMapper_Impl::IsBreakDeferredByAnchor()
{
return m_bIsBreakDeferredByAnchor;
}
void DomainMapper_Impl::SetIsBreakDeferredByAnchor()
{
m_bIsBreakDeferredByAnchor = true;
}
void DomainMapper_Impl::setSdtEndDeferred(bool bSdtEndDeferred)
@@ -472,7 +472,6 @@ private:
bool m_bIsColumnBreakDeferred;
bool m_bIsPageBreakDeferred;
sal_Int32 m_nLineBreaksDeferred;
bool m_bIsBreakDeferredByAnchor;
/// If we want to set "sdt end" on the next character context.
bool m_bSdtEndDeferred;
/// If we want to set "paragraph sdt end" on the next paragraph context.
@@ -743,8 +742,6 @@ public:
bool isBreakDeferred( BreakType deferredBreakType );
void clearDeferredBreaks();
void clearDeferredBreak(BreakType deferredBreakType);
bool IsBreakDeferredByAnchor();
void SetIsBreakDeferredByAnchor();
void setSdtEndDeferred(bool bSdtEndDeferred);
bool isSdtEndDeferred() const;