diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2023-04-25 08:05:55 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-04-25 09:29:22 +0200 |
commit | 3c2e4d454aaabcd61593e670a90638a185046539 (patch) | |
tree | 5a49e16a0d4243edc9a110eba645b5932f9d3607 /sw/source | |
parent | c9b6bf655e6de50c55629b4805399932c90a3b30 (diff) |
sw floattable, crashtesting: fix PDF export of fdo72790-1.docx, part 1
Converting the bugdoc to PDF crashed Writer layout since commit
ce3308a926f036b87515b8cd97d2b197063dc77a (tdf#61594 sw floattable:
import floating tables as split flys by default, 2023-04-12).
What happens is that the DOCX file has a continuous section break, that
is mapped to a Writer section, but then the fly splitting code didn't
expect that the anchor might be inside a section frame.
Fix this by explicitly checking for an in-section anchor in
SwFrame::GetNextFlyLeaf(), which will give us a suitable insertion point
on the next page.
This does not fully fix the handling of the bugdoc, but at least now a
reduced sample doesn't crash and is handled correctly.
Change-Id: I52b5c901d899533bbb78131f443789d55db41000
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150956
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/layout/flycnt.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index f5d4c76c936f..ca7ae9d28626 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -1558,7 +1558,14 @@ SwLayoutFrame *SwFrame::GetNextFlyLeaf( MakePageType eMakePage ) bool bBody = pFlyAnchor && pFlyAnchor->IsInDocBody(); SwLayoutFrame *pLayLeaf = nullptr; // Look up the first candidate. - if (IsTabFrame()) + SwSectionFrame* pFlyAnchorSection = pFlyAnchor ? pFlyAnchor->FindSctFrame() : nullptr; + if (pFlyAnchorSection) + { + // We can't just move the split anchor to the next page, that would be outside the section. + // Rather split that section as well. + pLayLeaf = pFlyAnchorSection->GetNextSctLeaf(eMakePage); + } + else if (IsTabFrame()) { // If we're in a table, try to find the next frame of the table's last content. SwFrame* pContent = static_cast<SwTabFrame*>(this)->FindLastContentOrTable(); |