summaryrefslogtreecommitdiffstats
path: root/sw/qa/core/layout
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
commit267c6f2ac71f92999e969232431ba04678e7437e (patch)
tree358c9467650e1d0a1d7227a21dac2e3d08b622b2 /sw/qa/core/layout
parentInitial commit. (diff)
downloadlibreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz
libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/qa/core/layout')
-rw-r--r--sw/qa/core/layout/data/birt_min.odtbin0 -> 20194 bytes
-rw-r--r--sw/qa/core/layout/data/border-collapse-compat.docxbin0 -> 12669 bytes
-rw-r--r--sw/qa/core/layout/data/btlr-nested-cell.odtbin0 -> 9936 bytes
-rw-r--r--sw/qa/core/layout/data/btlr-table-row-span.odtbin0 -> 11958 bytes
-rw-r--r--sw/qa/core/layout/data/bullet.pngbin0 -> 351 bytes
-rw-r--r--sw/qa/core/layout/data/continuous-endnotes-move-backwards.docbin0 -> 24576 bytes
-rw-r--r--sw/qa/core/layout/data/double-border-horizontal.docxbin0 -> 12250 bytes
-rw-r--r--sw/qa/core/layout/data/double-border-vertical.docxbin0 -> 12253 bytes
-rw-r--r--sw/qa/core/layout/data/double-page-border.docxbin0 -> 12053 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-2cols.docxbin0 -> 31941 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-3pages.docxbin0 -> 13014 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-anchor-keep-with-next.docxbin0 -> 12225 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-compat14-body.docxbin0 -> 27894 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-compat14-nosplit.docxbin0 -> 26165 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-compat14.docxbin0 -> 28497 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-del-empty.docxbin0 -> 36317 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-deleted-anchor.docxbin0 -> 41531 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-footer-2rows.docxbin0 -> 31993 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-footer.docxbin0 -> 31661 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-from-bottom.docxbin0 -> 59718 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-hori-pos.docxbin0 -> 12432 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-in-inlinetable.docxbin0 -> 18597 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-in-inltbl-in-sect.docxbin0 -> 18625 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-in-section.docxbin0 -> 14024 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-in-text-section.docxbin0 -> 12452 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-model-position-for-view-point-correction.docxbin0 -> 12696 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-move-master.docxbin0 -> 13635 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-multi-col.docxbin0 -> 12525 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-negative-height.docxbin0 -> 39432 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-nested-overlap.odtbin0 -> 11681 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-nested-rowspan.docxbin0 -> 25940 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-nested.odtbin0 -> 11635 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-next-leaf-in-section.docxbin0 -> 24632 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-next-row-invalidate-pos.docxbin0 -> 9281 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-no-footer-overlap.docbin0 -> 48640 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-nomargins.docxbin0 -> 12737 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-object-formatter.docxbin0 -> 21480 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-rowsplit.docxbin0 -> 13220 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-tab-join-legacy.docxbin0 -> 21410 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-tab-join.docxbin0 -> 21571 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-table-join.docxbin0 -> 16869 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-table-row-keep.docxbin0 -> 41801 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-then-table.docbin0 -> 50688 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-then-table.docxbin0 -> 28857 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-vertoffset.docxbin0 -> 12960 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-widow.docxbin0 -> 31279 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-wrap-on-all-pages.docxbin0 -> 13099 bytes
-rw-r--r--sw/qa/core/layout/data/floattable-wrapped-by-table.docxbin0 -> 12728 bytes
-rw-r--r--sw/qa/core/layout/data/floattable.docxbin0 -> 12966 bytes
-rw-r--r--sw/qa/core/layout/data/header-textbox.docxbin0 -> 5778 bytes
-rw-r--r--sw/qa/core/layout/data/inner-border.docxbin0 -> 12391 bytes
-rw-r--r--sw/qa/core/layout/data/keepwithnext-fullheight.fodt42
-rw-r--r--sw/qa/core/layout/data/linked-bullet.odtbin0 -> 8779 bytes
-rw-r--r--sw/qa/core/layout/data/page-remove-fly-no-table.fodt460
-rw-r--r--sw/qa/core/layout/data/page-remove-fly-table.odtbin0 -> 13943 bytes
-rw-r--r--sw/qa/core/layout/data/para-border-in-cell-clip.docxbin0 -> 12524 bytes
-rw-r--r--sw/qa/core/layout/data/rtl-table.docxbin0 -> 5487 bytes
-rw-r--r--sw/qa/core/layout/data/shape-textbox.odtbin0 -> 15441 bytes
-rw-r--r--sw/qa/core/layout/data/sorted-objs-insert.docxbin0 -> 27084 bytes
-rw-r--r--sw/qa/core/layout/data/split-table-border.odtbin0 -> 13057 bytes
-rw-r--r--sw/qa/core/layout/data/split-table-merged-border.odtbin0 -> 12318 bytes
-rw-r--r--sw/qa/core/layout/data/table-fly-overlap-spacing.docxbin0 -> 24594 bytes
-rw-r--r--sw/qa/core/layout/data/table-fly-overlap.docxbin0 -> 17718 bytes
-rw-r--r--sw/qa/core/layout/data/table-in-footnote.docxbin0 -> 15684 bytes
-rw-r--r--sw/qa/core/layout/data/table-missing-join.docxbin0 -> 18441 bytes
-rw-r--r--sw/qa/core/layout/data/table-print-area-left.docxbin0 -> 11807 bytes
-rw-r--r--sw/qa/core/layout/data/tables-move-backwards.odtbin0 -> 9578 bytes
-rw-r--r--sw/qa/core/layout/data/tdf122894-4.docbin0 -> 214528 bytes
-rw-r--r--sw/qa/core/layout/data/tdf128195.docxbin0 -> 14883 bytes
-rw-r--r--sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt284
-rw-r--r--sw/qa/core/layout/data/tdf157096.docxbin0 -> 18904 bytes
-rw-r--r--sw/qa/core/layout/data/tdf45908_invoice.odtbin0 -> 4780 bytes
-rw-r--r--sw/qa/core/layout/data/textbox-autogrow-vertical.docxbin0 -> 13722 bytes
-rw-r--r--sw/qa/core/layout/data/textbox-modification.docxbin0 -> 12284 bytes
-rw-r--r--sw/qa/core/layout/data/textbox-phantom-change.docxbin0 -> 5092 bytes
-rw-r--r--sw/qa/core/layout/data/vmerge-cell-border.docxbin0 -> 13610 bytes
-rw-r--r--sw/qa/core/layout/fly.cxx91
-rw-r--r--sw/qa/core/layout/flycnt.cxx1275
-rw-r--r--sw/qa/core/layout/frmtool.cxx40
-rw-r--r--sw/qa/core/layout/ftnfrm.cxx66
-rw-r--r--sw/qa/core/layout/layact.cxx91
-rw-r--r--sw/qa/core/layout/layout.cxx1052
-rw-r--r--sw/qa/core/layout/paintfrm.cxx163
-rw-r--r--sw/qa/core/layout/sortedobjs.cxx35
-rw-r--r--sw/qa/core/layout/tabfrm.cxx204
-rw-r--r--sw/qa/core/layout/trvlfrm.cxx56
86 files changed, 3859 insertions, 0 deletions
diff --git a/sw/qa/core/layout/data/birt_min.odt b/sw/qa/core/layout/data/birt_min.odt
new file mode 100644
index 0000000000..91193644c2
--- /dev/null
+++ b/sw/qa/core/layout/data/birt_min.odt
Binary files differ
diff --git a/sw/qa/core/layout/data/border-collapse-compat.docx b/sw/qa/core/layout/data/border-collapse-compat.docx
new file mode 100644
index 0000000000..a3f29cbe8d
--- /dev/null
+++ b/sw/qa/core/layout/data/border-collapse-compat.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/btlr-nested-cell.odt b/sw/qa/core/layout/data/btlr-nested-cell.odt
new file mode 100644
index 0000000000..ca7a4798db
--- /dev/null
+++ b/sw/qa/core/layout/data/btlr-nested-cell.odt
Binary files differ
diff --git a/sw/qa/core/layout/data/btlr-table-row-span.odt b/sw/qa/core/layout/data/btlr-table-row-span.odt
new file mode 100644
index 0000000000..ca4b6872fb
--- /dev/null
+++ b/sw/qa/core/layout/data/btlr-table-row-span.odt
Binary files differ
diff --git a/sw/qa/core/layout/data/bullet.png b/sw/qa/core/layout/data/bullet.png
new file mode 100644
index 0000000000..4e2dcf4149
--- /dev/null
+++ b/sw/qa/core/layout/data/bullet.png
Binary files differ
diff --git a/sw/qa/core/layout/data/continuous-endnotes-move-backwards.doc b/sw/qa/core/layout/data/continuous-endnotes-move-backwards.doc
new file mode 100644
index 0000000000..3ee6c56aa3
--- /dev/null
+++ b/sw/qa/core/layout/data/continuous-endnotes-move-backwards.doc
Binary files differ
diff --git a/sw/qa/core/layout/data/double-border-horizontal.docx b/sw/qa/core/layout/data/double-border-horizontal.docx
new file mode 100644
index 0000000000..624c7aa1aa
--- /dev/null
+++ b/sw/qa/core/layout/data/double-border-horizontal.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/double-border-vertical.docx b/sw/qa/core/layout/data/double-border-vertical.docx
new file mode 100644
index 0000000000..a4731ebec6
--- /dev/null
+++ b/sw/qa/core/layout/data/double-border-vertical.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/double-page-border.docx b/sw/qa/core/layout/data/double-page-border.docx
new file mode 100644
index 0000000000..a706b327cd
--- /dev/null
+++ b/sw/qa/core/layout/data/double-page-border.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-2cols.docx b/sw/qa/core/layout/data/floattable-2cols.docx
new file mode 100644
index 0000000000..b55bc8dd49
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-2cols.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-3pages.docx b/sw/qa/core/layout/data/floattable-3pages.docx
new file mode 100644
index 0000000000..d6cbdafc19
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-3pages.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-anchor-keep-with-next.docx b/sw/qa/core/layout/data/floattable-anchor-keep-with-next.docx
new file mode 100644
index 0000000000..a0930900d8
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-anchor-keep-with-next.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-compat14-body.docx b/sw/qa/core/layout/data/floattable-compat14-body.docx
new file mode 100644
index 0000000000..fc25b867af
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-compat14-body.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-compat14-nosplit.docx b/sw/qa/core/layout/data/floattable-compat14-nosplit.docx
new file mode 100644
index 0000000000..bd3f09c69e
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-compat14-nosplit.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-compat14.docx b/sw/qa/core/layout/data/floattable-compat14.docx
new file mode 100644
index 0000000000..19221609dd
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-compat14.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-del-empty.docx b/sw/qa/core/layout/data/floattable-del-empty.docx
new file mode 100644
index 0000000000..340d06b622
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-del-empty.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-deleted-anchor.docx b/sw/qa/core/layout/data/floattable-deleted-anchor.docx
new file mode 100644
index 0000000000..cab5b68ff9
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-deleted-anchor.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-footer-2rows.docx b/sw/qa/core/layout/data/floattable-footer-2rows.docx
new file mode 100644
index 0000000000..0d3db047c1
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-footer-2rows.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-footer.docx b/sw/qa/core/layout/data/floattable-footer.docx
new file mode 100644
index 0000000000..731e4fdb23
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-footer.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-from-bottom.docx b/sw/qa/core/layout/data/floattable-from-bottom.docx
new file mode 100644
index 0000000000..86374a68ba
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-from-bottom.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-hori-pos.docx b/sw/qa/core/layout/data/floattable-hori-pos.docx
new file mode 100644
index 0000000000..7a5e033a49
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-hori-pos.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-in-inlinetable.docx b/sw/qa/core/layout/data/floattable-in-inlinetable.docx
new file mode 100644
index 0000000000..56505316cd
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-in-inlinetable.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-in-inltbl-in-sect.docx b/sw/qa/core/layout/data/floattable-in-inltbl-in-sect.docx
new file mode 100644
index 0000000000..ff329ecb5a
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-in-inltbl-in-sect.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-in-section.docx b/sw/qa/core/layout/data/floattable-in-section.docx
new file mode 100644
index 0000000000..a0e9090bcc
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-in-section.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-in-text-section.docx b/sw/qa/core/layout/data/floattable-in-text-section.docx
new file mode 100644
index 0000000000..5b377dd037
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-in-text-section.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-model-position-for-view-point-correction.docx b/sw/qa/core/layout/data/floattable-model-position-for-view-point-correction.docx
new file mode 100644
index 0000000000..1de36c6e0c
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-model-position-for-view-point-correction.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-move-master.docx b/sw/qa/core/layout/data/floattable-move-master.docx
new file mode 100644
index 0000000000..03087eb358
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-move-master.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-multi-col.docx b/sw/qa/core/layout/data/floattable-multi-col.docx
new file mode 100644
index 0000000000..10e63bad39
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-multi-col.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-negative-height.docx b/sw/qa/core/layout/data/floattable-negative-height.docx
new file mode 100644
index 0000000000..e5b6cd5103
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-negative-height.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-nested-overlap.odt b/sw/qa/core/layout/data/floattable-nested-overlap.odt
new file mode 100644
index 0000000000..b90ae9a7b0
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-nested-overlap.odt
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-nested-rowspan.docx b/sw/qa/core/layout/data/floattable-nested-rowspan.docx
new file mode 100644
index 0000000000..48cbdbfe59
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-nested-rowspan.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-nested.odt b/sw/qa/core/layout/data/floattable-nested.odt
new file mode 100644
index 0000000000..3d21314f58
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-nested.odt
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-next-leaf-in-section.docx b/sw/qa/core/layout/data/floattable-next-leaf-in-section.docx
new file mode 100644
index 0000000000..3a315d51c9
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-next-leaf-in-section.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-next-row-invalidate-pos.docx b/sw/qa/core/layout/data/floattable-next-row-invalidate-pos.docx
new file mode 100644
index 0000000000..bbc7114b8e
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-next-row-invalidate-pos.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-no-footer-overlap.doc b/sw/qa/core/layout/data/floattable-no-footer-overlap.doc
new file mode 100644
index 0000000000..87e301189d
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-no-footer-overlap.doc
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-nomargins.docx b/sw/qa/core/layout/data/floattable-nomargins.docx
new file mode 100644
index 0000000000..642010e0f3
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-nomargins.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-object-formatter.docx b/sw/qa/core/layout/data/floattable-object-formatter.docx
new file mode 100644
index 0000000000..2582af0eb8
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-object-formatter.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-rowsplit.docx b/sw/qa/core/layout/data/floattable-rowsplit.docx
new file mode 100644
index 0000000000..8e1e9fb301
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-rowsplit.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-tab-join-legacy.docx b/sw/qa/core/layout/data/floattable-tab-join-legacy.docx
new file mode 100644
index 0000000000..f4056bf21f
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-tab-join-legacy.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-tab-join.docx b/sw/qa/core/layout/data/floattable-tab-join.docx
new file mode 100644
index 0000000000..cb1990c2a8
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-tab-join.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-table-join.docx b/sw/qa/core/layout/data/floattable-table-join.docx
new file mode 100644
index 0000000000..807b4cfa8c
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-table-join.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-table-row-keep.docx b/sw/qa/core/layout/data/floattable-table-row-keep.docx
new file mode 100644
index 0000000000..c7edcc0334
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-table-row-keep.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-then-table.doc b/sw/qa/core/layout/data/floattable-then-table.doc
new file mode 100644
index 0000000000..8c9684e595
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-then-table.doc
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-then-table.docx b/sw/qa/core/layout/data/floattable-then-table.docx
new file mode 100644
index 0000000000..eb06507bd8
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-then-table.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-vertoffset.docx b/sw/qa/core/layout/data/floattable-vertoffset.docx
new file mode 100644
index 0000000000..d71a587f9c
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-vertoffset.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-widow.docx b/sw/qa/core/layout/data/floattable-widow.docx
new file mode 100644
index 0000000000..c3f17e6cd9
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-widow.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-wrap-on-all-pages.docx b/sw/qa/core/layout/data/floattable-wrap-on-all-pages.docx
new file mode 100644
index 0000000000..39642002bb
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-wrap-on-all-pages.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable-wrapped-by-table.docx b/sw/qa/core/layout/data/floattable-wrapped-by-table.docx
new file mode 100644
index 0000000000..a53f652183
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable-wrapped-by-table.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/floattable.docx b/sw/qa/core/layout/data/floattable.docx
new file mode 100644
index 0000000000..ee1b029882
--- /dev/null
+++ b/sw/qa/core/layout/data/floattable.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/header-textbox.docx b/sw/qa/core/layout/data/header-textbox.docx
new file mode 100644
index 0000000000..4df72cccd3
--- /dev/null
+++ b/sw/qa/core/layout/data/header-textbox.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/inner-border.docx b/sw/qa/core/layout/data/inner-border.docx
new file mode 100644
index 0000000000..1d8adc9fe8
--- /dev/null
+++ b/sw/qa/core/layout/data/inner-border.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/keepwithnext-fullheight.fodt b/sw/qa/core/layout/data/keepwithnext-fullheight.fodt
new file mode 100644
index 0000000000..b33dd80e71
--- /dev/null
+++ b/sw/qa/core/layout/data/keepwithnext-fullheight.fodt
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" office:mimetype="application/vnd.oasis.opendocument.text" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0">
+ <office:styles>
+ <style:style style:name="OLE" style:family="graphic">
+ <style:graphic-properties text:anchor-type="paragraph" svg:x="0cm" svg:y="0cm" style:wrap="none" style:horizontal-pos="center" style:horizontal-rel="paragraph" style:flow-with-text="false"/>
+ </style:style>
+ </office:styles>
+ <office:automatic-styles>
+ <style:style style:name="P1" style:family="paragraph" style:master-page-name="Landscape"/>
+ <style:style style:name="fr1" style:family="graphic" style:parent-style-name="OLE">
+ <style:graphic-properties style:vertical-pos="top" style:vertical-rel="paragraph" draw:ole-draw-aspect="1"/>
+ </style:style>
+ <style:page-layout style:name="pm1">
+ <style:page-layout-properties fo:page-width="82.652cm" fo:page-height="57.683cm" style:num-format="1" style:print-orientation="landscape" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm"/>
+ </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Landscape" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+ <office:text>
+ <text:p text:style-name="P1">Landscape page</text:p>
+ <text:h>Heading</text:h>
+ <text:p><draw:frame draw:style-name="fr1" draw:name="Image1" text:anchor-type="paragraph" svg:width="58.644cm" style:rel-width="100%" svg:height="57.683cm" style:rel-height="scale" draw:z-index="0"><draw:image draw:mime-type="image/png"><office:binary-data>iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAABGdBTUEAALGPC/xhBQAAAAFz
+ UkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
+ AAJiS0dEAACqjSMyAAAACW9GRnMAAAAGAAAAAAAMc1XTAAAACXBIWXMAAA3XAAAN1wFCKJt4
+ AAAACXZwQWcAAABMAAAAQACdMTgbAAABzUlEQVRo3u3ZPU/CQBjA8X+Jxs3ESUDj4iK+LA5+
+ BBfjqBE1cXB2MlFAEqMgxvhNNL4sLsK3UPQL6ObkoAETz+FKW2mxCPRYnucWUu76/OC59C49
+ cGOCKqrD9kHRc6ddPv7oW2WCwMh0nF63Myz7Tm8hPTNu0pgHMER3scepTbgK6enJNND83RLn
+ /878yRaPmgBZFDuMsNLeWB9gmFQHP77MIg9gsYciR50NFKvtjIy10yk84pSZA7DYpwR8scmF
+ QQCMuoQMpzbh0iAARrlnVn90CWHTsZcAiHPPdINQAuqsc2MQAAnKDUKWEhZ10twaBEDSJWQo
+ YlFj7S9CzwEegkXWIbQsRAQASFJhpplwbRAACS+hANRJBxMiAkDcJeQ4sQkBhYgMoJ+Ozlwo
+ 2YQ7AJ6CRxyiUGnVy3hVKb0Af9v7hUG2Wy9TEQCUelFTDULB2S+YKYGOMcpM6UIccOQnRA6A
+ cSp6ibfI+wkGADBGpTEd8xz1AaAfTQ7huA8AvUw5hVjuA0D/C5OaMN8XACRZ8F0zCggKAQhA
+ AAIQgAAEIAABCEAAAhCAAAQgAAH4zg3feY4w3Xs44M5+oW0qvCWoGcvaIlM3x/f/ab+O738A
+ hOCNQr34oD4AAAAldEVYdGNyZWF0ZS1kYXRlADIwMTAtMTItMjBUMTc6MDg6MzYrMDE6MDB6
+ 5RscAAAAJXRFWHRtb2RpZnktZGF0ZQAyMDEwLTEyLTIwVDE3OjA4OjM3KzAxOjAwgyNmnAAA
+ AABJRU5ErkJggg==
+ </office:binary-data></draw:image></draw:frame></text:p>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/core/layout/data/linked-bullet.odt b/sw/qa/core/layout/data/linked-bullet.odt
new file mode 100644
index 0000000000..ae165531ab
--- /dev/null
+++ b/sw/qa/core/layout/data/linked-bullet.odt
Binary files differ
diff --git a/sw/qa/core/layout/data/page-remove-fly-no-table.fodt b/sw/qa/core/layout/data/page-remove-fly-no-table.fodt
new file mode 100644
index 0000000000..035688b85b
--- /dev/null
+++ b/sw/qa/core/layout/data/page-remove-fly-no-table.fodt
@@ -0,0 +1,460 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:styles>
+ <style:default-style style:family="graphic">
+ <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:writing-mode="lr-tb" style:flow-with-text="false"/>
+ <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:font-independent-line-spacing="false">
+ <style:tab-stops/>
+ </style:paragraph-properties>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" loext:color-lum-mod="100%" loext:color-lum-off="0%" style:font-name="Liberation Sans" fo:font-size="12pt" fo:language="en" fo:country="US" style:letter-kerning="true" style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/>
+ </style:default-style>
+ <style:default-style style:family="paragraph">
+ <style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="lr-tb"/>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Sans" fo:font-size="12pt" fo:language="en" fo:country="US" style:letter-kerning="true" style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" loext:hyphenation-word-char-count="no-limit" loext:hyphenation-zone="no-limit"/>
+ </style:default-style>
+ <style:default-style style:family="table">
+ <style:table-properties table:border-model="collapsing"/>
+ </style:default-style>
+ <style:default-style style:family="table-row">
+ <style:table-row-properties fo:keep-together="auto"/>
+ </style:default-style>
+ <style:style style:name="Standard" style:family="paragraph" style:default-outline-level="" style:class="text" style:master-page-name="">
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.25cm" style:contextual-spacing="false" fo:line-height="120%" fo:text-align="start" style:justify-single-word="false" fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" fo:text-indent="0cm" style:auto-text-indent="false" style:page-number="auto" style:punctuation-wrap="simple" style:writing-mode="lr-tb"/>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Sans" fo:font-family="'Liberation Sans'" style:font-family-generic="swiss" fo:font-size="10.5pt" fo:letter-spacing="0.014cm" style:letter-kerning="true" style:font-name-asian="Noto Sans CJK SC Regular" style:font-family-asian="'Noto Sans CJK SC Regular'" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="FreeSans" style:font-family-complex="FreeSans" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="true" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" loext:hyphenation-word-char-count="no-limit" loext:hyphenation-zone="no-limit"/>
+ </style:style>
+ <style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:default-outline-level="" style:class="text">
+ <style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" style:contextual-spacing="false" fo:keep-with-next="always"/>
+ <style:text-properties style:font-name="Liberation Sans" fo:font-family="'Liberation Sans'" style:font-family-generic="swiss" fo:font-size="14pt" style:font-name-asian="Noto Sans CJK SC Regular" style:font-family-asian="'Noto Sans CJK SC Regular'" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="14pt" style:font-name-complex="FreeSans" style:font-family-complex="FreeSans" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="14pt"/>
+ </style:style>
+ <style:style style:name="Heading_20_2" style:display-name="Heading 2" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="2" style:class="text" style:master-page-name="">
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.353cm" fo:margin-bottom="0.212cm" style:contextual-spacing="false" fo:keep-together="always" fo:orphans="0" fo:widows="0" fo:text-indent="0cm" style:auto-text-indent="false" style:page-number="auto"/>
+ <style:text-properties fo:font-size="16pt" fo:font-weight="bold" style:font-size-asian="16pt" style:font-weight-asian="bold" style:font-size-complex="16pt" style:font-weight-complex="normal"/>
+ </style:style>
+ <style:style style:name="Table_20_Contents" style:display-name="Table Contents" style:family="paragraph" style:parent-style-name="Standard" style:default-outline-level="" style:class="extra">
+ <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.101cm" style:contextual-spacing="false" text:number-lines="false" text:line-number="0"/>
+ </style:style>
+ <style:style style:name="Heading_20_3" style:display-name="Heading 3" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="3" style:class="text">
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.247cm" fo:margin-bottom="0.212cm" style:contextual-spacing="false" fo:text-indent="0cm" style:auto-text-indent="false"/>
+ <style:text-properties fo:font-size="14pt" fo:font-weight="bold" style:font-size-asian="14pt" style:font-weight-asian="bold" style:font-size-complex="14pt" style:font-weight-complex="600"/>
+ </style:style>
+ <style:style style:name="Heading_20_4" style:display-name="Heading 4" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="4" style:class="text">
+ <style:paragraph-properties fo:margin-top="0.212cm" fo:margin-bottom="0.212cm" style:contextual-spacing="false"/>
+ <style:text-properties fo:font-size="13pt" fo:font-style="normal" fo:font-weight="bold" style:font-size-asian="13.5pt" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="13.5pt" style:font-style-complex="italic" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="Contents_20_Heading" style:display-name="Contents Heading" style:family="paragraph" style:parent-style-name="Heading" style:class="index">
+ <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0.101cm" style:contextual-spacing="false" fo:text-align="center" style:justify-single-word="false" fo:text-indent="0cm" style:auto-text-indent="false" text:number-lines="false" text:line-number="0"/>
+ <style:text-properties fo:font-size="13pt" fo:font-weight="bold" style:font-size-asian="16pt" style:font-weight-asian="bold" style:font-size-complex="16pt" style:font-weight-complex="600"/>
+ </style:style>
+ </office:styles>
+ <office:automatic-styles>
+ <style:style style:name="Table1" style:family="table">
+ <style:table-properties style:width="17cm" table:align="margins" style:may-break-between-rows="true" style:writing-mode="lr-tb" table:border-model="collapsing"/>
+ </style:style>
+ <style:style style:name="Table1.A" style:family="table-column">
+ <style:table-column-properties style:column-width="17cm" style:rel-column-width="65535*"/>
+ </style:style>
+ <style:style style:name="Table1.1" style:family="table-row">
+ <style:table-row-properties fo:keep-together="always"/>
+ </style:style>
+ <style:style style:name="Table1.A1" style:family="table-cell">
+ <style:table-cell-properties fo:background-color="transparent" fo:padding="0.097cm" fo:border="none" style:writing-mode="lr-tb">
+ <style:background-image/>
+ </style:table-cell-properties>
+ </style:style>
+ <style:style style:name="Table2" style:family="table">
+ <style:table-properties style:width="17cm" fo:margin-top="0cm" fo:margin-bottom="0.3cm" table:align="margins" style:may-break-between-rows="true" style:writing-mode="lr-tb" table:border-model="collapsing"/>
+ </style:style>
+ <style:style style:name="Table2.A" style:family="table-column">
+ <style:table-column-properties style:column-width="17cm" style:rel-column-width="65535*"/>
+ </style:style>
+ <style:style style:name="Table2.1" style:family="table-row">
+ <style:table-row-properties fo:keep-together="always"/>
+ </style:style>
+ <style:style style:name="Table2.A1" style:family="table-cell">
+ <style:table-cell-properties fo:background-color="transparent" fo:padding="0.097cm" fo:border="none" style:writing-mode="lr-tb">
+ <style:background-image/>
+ </style:table-cell-properties>
+ </style:style>
+ <style:style style:name="Table3" style:family="table">
+ <style:table-properties style:width="8.251cm" fo:margin-top="0cm" fo:margin-bottom="0.3cm" table:align="margins" style:writing-mode="lr-tb"/>
+ </style:style>
+ <style:style style:name="Table3.A" style:family="table-column">
+ <style:table-column-properties style:column-width="8.251cm" style:rel-column-width="65535*"/>
+ </style:style>
+ <style:style style:name="Table3.A1" style:family="table-cell">
+ <style:table-cell-properties fo:padding="0.097cm" fo:border="none"/>
+ </style:style>
+ <style:style style:name="fr1" style:family="graphic" style:parent-style-name="Graphics">
+ <style:graphic-properties style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="center" style:horizontal-rel="paragraph" style:mirror="none" fo:clip="rect(0cm, 0cm, 0cm, 0cm)" draw:luminance="0%" draw:contrast="0%" draw:red="0%" draw:green="0%" draw:blue="0%" draw:gamma="100%" draw:color-inversion="false" draw:image-opacity="100%" draw:color-mode="standard"/>
+ </style:style>
+ <style:style style:name="fr2" style:family="graphic" style:parent-style-name="Graphics">
+ <style:graphic-properties style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="center" style:horizontal-rel="paragraph" style:mirror="none" fo:clip="rect(0cm, 0cm, 0cm, 0cm)" draw:luminance="0%" draw:contrast="0%" draw:red="0%" draw:green="0%" draw:blue="0%" draw:gamma="100%" draw:color-inversion="false" draw:image-opacity="100%" draw:color-mode="standard"/>
+ </style:style>
+ <style:style style:name="Sect1" style:family="section">
+ <style:section-properties style:editable="false">
+ <style:columns fo:column-count="1" fo:column-gap="0cm"/>
+ </style:section-properties>
+ </style:style>
+ <style:style style:name="Sect2" style:family="section">
+ <style:section-properties fo:margin-left="0cm" fo:margin-right="0cm" style:editable="false">
+ <style:columns fo:column-count="1" fo:column-gap="0cm"/>
+ </style:section-properties>
+ </style:style>
+ <style:style style:name="Sect3" style:family="section">
+ <style:section-properties text:dont-balance-text-columns="false" style:editable="false">
+ <style:columns fo:column-count="2" fo:column-gap="0.497cm">
+ <style:column style:rel-width="32767*" fo:start-indent="0cm" fo:end-indent="0.248cm"/>
+ <style:column style:rel-width="32768*" fo:start-indent="0.248cm" fo:end-indent="0cm"/>
+ </style:columns>
+ </style:section-properties>
+ </style:style>
+ <style:page-layout style:name="pm1">
+ <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="23" style:layout-grid-base-height="1.058cm" style:layout-grid-ruby-height="0cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:layout-grid-base-width="0.704cm" style:layout-grid-snap-to="true" style:footnote-max-height="0cm" loext:margin-gutter="0cm">
+ <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+ </style:page-layout-properties>
+ <style:header-style/>
+ <style:footer-style>
+ <style:header-footer-properties fo:min-height="0.998cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.9cm" style:dynamic-spacing="true"/>
+ </style:footer-style>
+ </style:page-layout>
+ <style:page-layout style:name="pm2">
+ <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="44" style:layout-grid-base-height="0.55cm" style:layout-grid-ruby-height="0cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:layout-grid-base-width="0.37cm" style:layout-grid-snap-to="true" style:footnote-max-height="0cm" loext:margin-gutter="0cm">
+ <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+ </style:page-layout-properties>
+ <style:header-style/>
+ <style:footer-style>
+ <style:header-footer-properties fo:min-height="0.998cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.9cm" style:dynamic-spacing="true"/>
+ </style:footer-style>
+ </style:page-layout>
+ <style:page-layout style:name="pm3">
+ <style:page-layout-properties fo:page-width="21.59cm" fo:page-height="27.94cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2.54cm" fo:margin-bottom="1.27cm" fo:margin-left="3.175cm" fo:margin-right="3.175cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="22860" style:layout-grid-base-height="0.176cm" style:layout-grid-ruby-height="0cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:layout-grid-base-width="0.37cm" style:layout-grid-snap-to="true" style:footnote-max-height="0cm" loext:margin-gutter="0cm">
+ <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+ </style:page-layout-properties>
+ <style:header-style/>
+ <style:footer-style>
+ <style:header-footer-properties fo:min-height="1.27cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="1.169cm" style:dynamic-spacing="true"/>
+ </style:footer-style>
+ </style:page-layout>
+ <style:page-layout style:name="pm4">
+ <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="1cm" fo:margin-bottom="1cm" fo:margin-left="2cm" fo:margin-right="1cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:layout-grid-base-width="0.706cm" style:layout-grid-snap-to="true" style:footnote-max-height="0cm" loext:margin-gutter="0cm">
+ <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+ </style:page-layout-properties>
+ <style:header-style/>
+ <style:footer-style/>
+ </style:page-layout>
+ <style:style style:name="dp1" style:family="drawing-page">
+ <style:drawing-page-properties draw:background-size="full"/>
+ </style:style>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-layout-name="pm1" draw:style-name="dp1">
+ <style:footer>
+ <text:p/>
+ </style:footer>
+ </style:master-page>
+ </office:master-styles>
+ <office:body>
+ <office:text text:use-soft-page-breaks="true">
+ <text:p text:style-name="P6">2022-04-24_Quirk<text:span text:style-name="T2">s</text:span> in the focusing property of the Navigator</text:p>
+ <text:p text:style-name="P10">This example file shows several bugs. It was written as an example to #148755. But I also recorded all other surprising things in order to report them on separate bug reports. Don’t mind if they appear here, it is just just to catch some of them in order to report them.</text:p>
+ <text:p text:style-name="P10">This report was written with </text:p>
+ <text:p text:style-name="P11">Version: 7.4.0.0.alpha0+ / LibreOffice Community<text:line-break/>Build ID: f775b625b497b4fa6731bddd433916dde52fbb2e<text:line-break/>CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3<text:line-break/>Locale: de-DE (de_DE.UTF-8); UI: en-US<text:line-break/>Calc: threaded</text:p>
+ <text:p text:style-name="P12">but I have seen some of these glitches also in other versions of LO Writer!</text:p>
+ <text:table-of-content text:style-name="Sect1" text:protected="true" text:name="Table of Contents1">
+ <text:table-of-content-source text:outline-level="10">
+ <text:index-title-template text:style-name="Contents_20_Heading">Table of Contents</text:index-title-template>
+ <text:table-of-content-entry-template text:outline-level="1" text:style-name="Contents_20_1">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ </text:table-of-content-source>
+ <text:index-body>
+ <text:index-title text:style-name="Sect1" text:name="Table of Contents1_Head">
+ <text:p text:style-name="Contents_20_Heading">Table of Contents</text:p>
+ </text:index-title>
+ <text:p/>
+ <text:p/>
+ <text:p/>
+ <text:p/>
+ <text:p/>
+ <text:p/>
+ <text:p/>
+ <text:p/>
+ <text:p/>
+ <text:p/>
+ <text:p/>
+ <text:p/>
+ <text:p/>
+ <text:p/>
+ <text:p/>
+ <text:p/>
+ <text:p/>
+ </text:index-body>
+ </text:table-of-content>
+ <text:p/>
+ <text:h text:style-name="P19" text:outline-level="2"><text:bookmark-start text:name="__RefHeading___Toc71113_2824860697"/>Original Post <text:span text:style-name="T5">#148755</text:span><text:bookmark-end text:name="__RefHeading___Toc71113_2824860697"/></text:h>
+ <text:h text:style-name="P22" text:outline-level="3"><text:bookmark-start text:name="__RefHeading___Toc71115_2824860697"/><text:span text:style-name="T5">P</text:span>receding events<text:bookmark-end text:name="__RefHeading___Toc71115_2824860697"/></text:h>
+ <text:p/>
+ <text:section text:style-name="Sect2" text:name="c0">
+ <text:h text:style-name="P22" text:outline-level="3"><text:bookmark-start text:name="__RefHeading___Toc71117_2824860697"/>New findings<text:bookmark-end text:name="__RefHeading___Toc71117_2824860697"/></text:h>
+ <text:p/>
+ <text:p/>
+ <text:p/>
+ <text:p text:style-name="P4">Sometimes I use tables because they make the location of inserted images more predictable than if I insert them into the text (e.g. anchored to paragraphs). If - as e.g. often in user manuals - many short text passages and corresponding illustrations follow one after another, it may even make sense to place headings in tables as well. If you do this, however, you lose the nice feature of the navigator that you can continuously see how a text is positioned in the hierarchy of associated headings: The navigator suddenly shows the position in the hierarchy of tables (or sections, if the text passage is in a section).</text:p>
+ <text:h text:style-name="P22" text:outline-level="3"><text:bookmark-start text:name="__RefHeading___Toc71119_2824860697"/>Expected behavior:<text:bookmark-end text:name="__RefHeading___Toc71119_2824860697"/></text:h>
+ <text:p text:style-name="P18">I expect the navigator to always show the location of the bookmark in the editing window with respect to the category selected in the navigator's drop-down list of categories at the top left (really useful there are headings, tables, maybe sections. For hyperlinks, I can only imagine that it might make sense to highlight the next hyperlink before the position of the bookmark in the editing window).</text:p>
+ </text:section>
+ <text:h text:style-name="P20" text:outline-level="2"><text:bookmark-start text:name="__RefHeading___Toc71121_2824860697"/>An example<text:bookmark-end text:name="__RefHeading___Toc71121_2824860697"/></text:h>
+ <text:p text:style-name="P3">In order to demonstrate the to be shown behavior, I add some headlines such that navigator really has some structure to show. Then I also add the original post, but this time arranged in a table:</text:p>
+ <text:h text:style-name="P21" text:outline-level="2"><text:bookmark-start text:name="__RefHeading___Toc71123_2824860697"/>Original Post <text:span text:style-name="T5">#148755 in a table</text:span><text:bookmark-end text:name="__RefHeading___Toc71123_2824860697"/></text:h>
+ <table:table table:name="Table1" table:style-name="Table1" table:template-name="Standardtabelle">
+ <table:table-column table:style-name="Table1.A"/>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">
+ <text:h text:style-name="Heading_20_3" text:outline-level="3"><text:bookmark-start text:name="__RefHeading___Toc71125_2824860697"/><text:span text:style-name="T5">P</text:span>receding events<text:span text:style-name="T5"> in a table</text:span><text:bookmark-end text:name="__RefHeading___Toc71125_2824860697"/></text:h>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">
+ <text:p text:style-name="Text_20_body">End of June 2021 I first observed that the Navigator adjusts itself to the proper headline associated to the current editing position. The item belonging to the edit position in the Edit window gets highlighted. That's something which has long been missing and which is very useful.</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">
+ <text:h text:style-name="Heading_20_3" text:outline-level="3"><text:bookmark-start text:name="__RefHeading___Toc71127_2824860697"/>New findings<text:span text:style-name="T5"> in a table</text:span><text:bookmark-end text:name="__RefHeading___Toc71127_2824860697"/></text:h>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">
+ <text:p text:style-name="Text_20_body">Now I found something inconsistent with that: If the edit position in the edit window is in a table, the highlight moves to the relevant entry in the Tables category, if it is in a section, the highlight jumps to the proper entry in the Sections category.</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <text:soft-page-break/>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">
+ <text:p text:style-name="Text_20_body">When writing a larger document, the main hierarchy of things is by headline order. Being able to associate some place in the document to the surrounding headlines hierarchy is the main concern. Only in very special cases one might want to locate an image in the list of all images or a table in the list of all tables and so on.</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">
+ <text:p text:style-name="Text_20_body">Locating something in another category than the one highlighted (Headings/Images/Sections/Table, ..., topmost drop-down setting of Navigator) is not meaningful, especially jumping to sections instead of headlines is bizarre.</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">
+ <text:p text:style-name="Text_20_body">Sometimes I use tables because they make the location of inserted images more predictable than if I insert them into the text (e.g. anchored to paragraphs). If - as e.g. often in user manuals - many short text passages and corresponding illustrations follow one after another, it may even make sense to place headings in tables as well. If you do this, however, you lose the nice feature of the navigator that you can continuously see how a text is positioned in the hierarchy of associated headings: The navigator suddenly shows the position in the hierarchy of tables (or sections, if the text passage is in a section).</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">
+ <text:h text:style-name="Heading_20_3" text:outline-level="3"><text:bookmark-start text:name="__RefHeading___Toc71129_2824860697"/>Expected behavior<text:span text:style-name="T5"> in a table</text:span>:<text:bookmark-end text:name="__RefHeading___Toc71129_2824860697"/></text:h>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table1.1">
+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">
+ <text:p text:style-name="Text_20_body">I expect the navigator to always show the location of the bookmark in the editing window with respect to the category selected in the navigator's drop-down list of categories at the top left (really useful there are headings, tables, maybe sections. For hyperlinks, I can only imagine that it might make sense to highlight the next hyperlink before the position of the bookmark in the editing window).</text:p>
+ </table:table-cell>
+ </table:table-row>
+ </table:table>
+ <text:h text:style-name="P20" text:outline-level="2"><text:bookmark-start text:name="__RefHeading___Toc71131_2824860697"/>Some screenshots demonstrating what goes wrong<text:bookmark-end text:name="__RefHeading___Toc71131_2824860697"/></text:h>
+ <table:table table:name="Table2" table:style-name="Table2" table:template-name="Standardtabelle">
+ <table:table-column table:style-name="Table2.A"/>
+ <table:table-row table:style-name="Table2.1">
+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">
+ <text:h text:style-name="Heading_20_3" text:outline-level="3"><text:bookmark-start text:name="__RefHeading___Toc72157_2824860697"/>What goes right<text:bookmark-end text:name="__RefHeading___Toc72157_2824860697"/></text:h>
+ <text:p text:style-name="Text_20_body">Before I’ll show what goes wrong, I’ll precede my examples with one showing that Navigator’s reflection of edit places goes right, as long as one navigates in text which is not part of a table <text:span text:style-name="T7">(or a section, which we will encounter soon)</text:span>: I go some lines up, add the word HERE to some place and make a screenshot:</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <text:soft-page-break/>
+ <table:table-row table:style-name="Table2.1">
+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">
+ <text:p text:style-name="Text_20_body"><draw:frame draw:style-name="fr2" draw:name="Image3" text:anchor-type="char" svg:width="16.806cm" svg:height="10.834cm" draw:z-index="2"><draw:image draw:mime-type="image/png"><office:binary-data>iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAABGdBTUEAALGPC/xhBQAAAAFz
+UkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
+AAJiS0dEAACqjSMyAAAACW9GRnMAAAAGAAAAAAAMc1XTAAAACXBIWXMAAA3XAAAN1wFCKJt4
+AAAACXZwQWcAAABMAAAAQACdMTgbAAABzUlEQVRo3u3ZPU/CQBjA8X+Jxs3ESUDj4iK+LA5+
+BBfjqBE1cXB2MlFAEqMgxvhNNL4sLsK3UPQL6ObkoAETz+FKW2mxCPRYnucWUu76/OC59C49
+cGOCKqrD9kHRc6ddPv7oW2WCwMh0nF63Myz7Tm8hPTNu0pgHMER3scepTbgK6enJNND83RLn
+/878yRaPmgBZFDuMsNLeWB9gmFQHP77MIg9gsYciR50NFKvtjIy10yk84pSZA7DYpwR8scmF
+QQCMuoQMpzbh0iAARrlnVn90CWHTsZcAiHPPdINQAuqsc2MQAAnKDUKWEhZ10twaBEDSJWQo
+YlFj7S9CzwEegkXWIbQsRAQASFJhpplwbRAACS+hANRJBxMiAkDcJeQ4sQkBhYgMoJ+Ozlwo
+2YQ7AJ6CRxyiUGnVy3hVKb0Af9v7hUG2Wy9TEQCUelFTDULB2S+YKYGOMcpM6UIccOQnRA6A
+cSp6ibfI+wkGADBGpTEd8xz1AaAfTQ7huA8AvUw5hVjuA0D/C5OaMN8XACRZ8F0zCggKAQhA
+AAIQgAAEIAABCEAAAhCAAAQgAAH4zg3feY4w3Xs44M5+oW0qvCWoGcvaIlM3x/f/ab+O738A
+hOCNQr34oD4AAAAldEVYdGNyZWF0ZS1kYXRlADIwMTAtMTItMjBUMTc6MDg6MzYrMDE6MDB6
+5RscAAAAJXRFWHRtb2RpZnktZGF0ZQAyMDEwLTEyLTIwVDE3OjA4OjM3KzAxOjAwgyNmnAAA
+AABJRU5ErkJggg==</office:binary-data></draw:image></draw:frame>The highlighted word HERE is in the paragraph with headline “An example“: the right paragraph is highlighted in the <text:span text:style-name="T7">N</text:span>avigator. That’s <text:span text:style-name="T7">re</text:span>ally helpful. In order to show that this is not just an accidental r<text:span text:style-name="T7">e</text:span>sult, I’ll remove the highlighted word and transplant it to some other paragraph:</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <text:soft-page-break/>
+ <table:table-row table:style-name="Table2.1">
+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">
+ <text:p text:style-name="Text_20_body"><draw:frame draw:style-name="fr1" draw:name="Image4" text:anchor-type="paragraph" svg:width="16.806cm" svg:height="10.834cm" draw:z-index="3"><draw:image draw:mime-type="image/png"><office:binary-data>iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAABGdBTUEAALGPC/xhBQAAAAFz
+UkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
+AAJiS0dEAACqjSMyAAAACW9GRnMAAAAGAAAAAAAMc1XTAAAACXBIWXMAAA3XAAAN1wFCKJt4
+AAAACXZwQWcAAABMAAAAQACdMTgbAAABzUlEQVRo3u3ZPU/CQBjA8X+Jxs3ESUDj4iK+LA5+
+BBfjqBE1cXB2MlFAEqMgxvhNNL4sLsK3UPQL6ObkoAETz+FKW2mxCPRYnucWUu76/OC59C49
+cGOCKqrD9kHRc6ddPv7oW2WCwMh0nF63Myz7Tm8hPTNu0pgHMER3scepTbgK6enJNND83RLn
+/878yRaPmgBZFDuMsNLeWB9gmFQHP77MIg9gsYciR50NFKvtjIy10yk84pSZA7DYpwR8scmF
+QQCMuoQMpzbh0iAARrlnVn90CWHTsZcAiHPPdINQAuqsc2MQAAnKDUKWEhZ10twaBEDSJWQo
+YlFj7S9CzwEegkXWIbQsRAQASFJhpplwbRAACS+hANRJBxMiAkDcJeQ4sQkBhYgMoJ+Ozlwo
+2YQ7AJ6CRxyiUGnVy3hVKb0Af9v7hUG2Wy9TEQCUelFTDULB2S+YKYGOMcpM6UIccOQnRA6A
+cSp6ibfI+wkGADBGpTEd8xz1AaAfTQ7huA8AvUw5hVjuA0D/C5OaMN8XACRZ8F0zCggKAQhA
+AAIQgAAEIAABCEAAAhCAAAQgAAH4zg3feY4w3Xs44M5+oW0qvCWoGcvaIlM3x/f/ab+O738A
+hOCNQr34oD4AAAAldEVYdGNyZWF0ZS1kYXRlADIwMTAtMTItMjBUMTc6MDg6MzYrMDE6MDB6
+5RscAAAAJXRFWHRtb2RpZnktZGF0ZQAyMDEwLTEyLTIwVDE3OjA4OjM3KzAxOjAwgyNmnAAA
+AABJRU5ErkJggg==</office:binary-data></draw:image></draw:frame>Again the highlighted portion in the Navigator shows the position in the edit window. Now I’ll test it with yet another place.</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table2.1">
+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">
+ <text:h text:style-name="Heading_20_3" text:outline-level="3"><text:bookmark-start text:name="__RefHeading___Toc72159_2824860697"/>But this one will go wrong:<text:bookmark-end text:name="__RefHeading___Toc72159_2824860697"/></text:h>
+ </table:table-cell>
+ </table:table-row>
+ <text:soft-page-break/>
+ <table:table-row table:style-name="Table2.1">
+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">
+ <text:h text:style-name="Heading_20_4" text:outline-level="4"><draw:frame draw:style-name="fr1" draw:name="Image5" text:anchor-type="paragraph" svg:width="16.806cm" svg:height="10.834cm" draw:z-index="4"><draw:image draw:mime-type="image/png"><office:binary-data>iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAABGdBTUEAALGPC/xhBQAAAAFz
+UkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
+AAJiS0dEAACqjSMyAAAACW9GRnMAAAAGAAAAAAAMc1XTAAAACXBIWXMAAA3XAAAN1wFCKJt4
+AAAACXZwQWcAAABMAAAAQACdMTgbAAABzUlEQVRo3u3ZPU/CQBjA8X+Jxs3ESUDj4iK+LA5+
+BBfjqBE1cXB2MlFAEqMgxvhNNL4sLsK3UPQL6ObkoAETz+FKW2mxCPRYnucWUu76/OC59C49
+cGOCKqrD9kHRc6ddPv7oW2WCwMh0nF63Myz7Tm8hPTNu0pgHMER3scepTbgK6enJNND83RLn
+/878yRaPmgBZFDuMsNLeWB9gmFQHP77MIg9gsYciR50NFKvtjIy10yk84pSZA7DYpwR8scmF
+QQCMuoQMpzbh0iAARrlnVn90CWHTsZcAiHPPdINQAuqsc2MQAAnKDUKWEhZ10twaBEDSJWQo
+YlFj7S9CzwEegkXWIbQsRAQASFJhpplwbRAACS+hANRJBxMiAkDcJeQ4sQkBhYgMoJ+Ozlwo
+2YQ7AJ6CRxyiUGnVy3hVKb0Af9v7hUG2Wy9TEQCUelFTDULB2S+YKYGOMcpM6UIccOQnRA6A
+cSp6ibfI+wkGADBGpTEd8xz1AaAfTQ7huA8AvUw5hVjuA0D/C5OaMN8XACRZ8F0zCggKAQhA
+AAIQgAAEIAABCEAAAhCAAAQgAAH4zg3feY4w3Xs44M5+oW0qvCWoGcvaIlM3x/f/ab+O738A
+hOCNQr34oD4AAAAldEVYdGNyZWF0ZS1kYXRlADIwMTAtMTItMjBUMTc6MDg6MzYrMDE6MDB6
+5RscAAAAJXRFWHRtb2RpZnktZGF0ZQAyMDEwLTEyLTIwVDE3OjA4OjM3KzAxOjAwgyNmnAAA
+AABJRU5ErkJggg==</office:binary-data></draw:image></draw:frame><text:bookmark-start text:name="__RefHeading___Toc72161_2824860697"/>1. Expec<text:span text:style-name="T7">t</text:span>ed result<text:bookmark-end text:name="__RefHeading___Toc72161_2824860697"/></text:h>
+ <text:p text:style-name="Text_20_body">This time, the highlight is in section c0! This is really surprising! I have not created any section c0 active at all. Even when LO Writer created one for internal organizational reasons: my text is under the heading “New findings”!</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table2.1">
+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">
+ <text:h text:style-name="Heading_20_3" text:outline-level="3"><text:bookmark-start text:name="__RefHeading___Toc72673_2824860697"/>Continued examples<text:bookmark-end text:name="__RefHeading___Toc72673_2824860697"/></text:h>
+ <text:p text:style-name="Text_20_body">In order to avoid any difficulty of pasted screenshots appearing on arbitrary places (another bug, but not the issue of this error report, I place all my text and screenshots to just another table: In the next picture, you see the navigator when the focus in the text field is HERE</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <text:soft-page-break/>
+ <table:table-row table:style-name="Table2.1">
+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">
+ <text:p text:style-name="Text_20_body"><draw:frame draw:style-name="fr1" draw:name="Image1" text:anchor-type="paragraph" svg:width="16.806cm" svg:height="10.834cm" draw:z-index="0"><draw:image draw:mime-type="image/png"><office:binary-data>iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAABGdBTUEAALGPC/xhBQAAAAFz
+UkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
+AAJiS0dEAACqjSMyAAAACW9GRnMAAAAGAAAAAAAMc1XTAAAACXBIWXMAAA3XAAAN1wFCKJt4
+AAAACXZwQWcAAABMAAAAQACdMTgbAAABzUlEQVRo3u3ZPU/CQBjA8X+Jxs3ESUDj4iK+LA5+
+BBfjqBE1cXB2MlFAEqMgxvhNNL4sLsK3UPQL6ObkoAETz+FKW2mxCPRYnucWUu76/OC59C49
+cGOCKqrD9kHRc6ddPv7oW2WCwMh0nF63Myz7Tm8hPTNu0pgHMER3scepTbgK6enJNND83RLn
+/878yRaPmgBZFDuMsNLeWB9gmFQHP77MIg9gsYciR50NFKvtjIy10yk84pSZA7DYpwR8scmF
+QQCMuoQMpzbh0iAARrlnVn90CWHTsZcAiHPPdINQAuqsc2MQAAnKDUKWEhZ10twaBEDSJWQo
+YlFj7S9CzwEegkXWIbQsRAQASFJhpplwbRAACS+hANRJBxMiAkDcJeQ4sQkBhYgMoJ+Ozlwo
+2YQ7AJ6CRxyiUGnVy3hVKb0Af9v7hUG2Wy9TEQCUelFTDULB2S+YKYGOMcpM6UIccOQnRA6A
+cSp6ibfI+wkGADBGpTEd8xz1AaAfTQ7huA8AvUw5hVjuA0D/C5OaMN8XACRZ8F0zCggKAQhA
+AAIQgAAEIAABCEAAAhCAAAQgAAH4zg3feY4w3Xs44M5+oW0qvCWoGcvaIlM3x/f/ab+O738A
+hOCNQr34oD4AAAAldEVYdGNyZWF0ZS1kYXRlADIwMTAtMTItMjBUMTc6MDg6MzYrMDE6MDB6
+5RscAAAAJXRFWHRtb2RpZnktZGF0ZQAyMDEwLTEyLTIwVDE3OjA4OjM3KzAxOjAwgyNmnAAA
+AABJRU5ErkJggg==</office:binary-data></draw:image></draw:frame>As you see, Table2 under Tables is highlighted. You might argue, ok, the focus is really in Table2, just go to Headings in Navigator. I’ll do that now:</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <text:soft-page-break/>
+ <table:table-row table:style-name="Table2.1">
+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">
+ <text:p text:style-name="Text_20_body"><draw:frame draw:style-name="fr2" draw:name="Image2" text:anchor-type="char" svg:width="16.806cm" svg:height="10.834cm" draw:z-index="1"><draw:image draw:mime-type="image/png"><office:binary-data>iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAABGdBTUEAALGPC/xhBQAAAAFz
+UkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
+AAJiS0dEAACqjSMyAAAACW9GRnMAAAAGAAAAAAAMc1XTAAAACXBIWXMAAA3XAAAN1wFCKJt4
+AAAACXZwQWcAAABMAAAAQACdMTgbAAABzUlEQVRo3u3ZPU/CQBjA8X+Jxs3ESUDj4iK+LA5+
+BBfjqBE1cXB2MlFAEqMgxvhNNL4sLsK3UPQL6ObkoAETz+FKW2mxCPRYnucWUu76/OC59C49
+cGOCKqrD9kHRc6ddPv7oW2WCwMh0nF63Myz7Tm8hPTNu0pgHMER3scepTbgK6enJNND83RLn
+/878yRaPmgBZFDuMsNLeWB9gmFQHP77MIg9gsYciR50NFKvtjIy10yk84pSZA7DYpwR8scmF
+QQCMuoQMpzbh0iAARrlnVn90CWHTsZcAiHPPdINQAuqsc2MQAAnKDUKWEhZ10twaBEDSJWQo
+YlFj7S9CzwEegkXWIbQsRAQASFJhpplwbRAACS+hANRJBxMiAkDcJeQ4sQkBhYgMoJ+Ozlwo
+2YQ7AJ6CRxyiUGnVy3hVKb0Af9v7hUG2Wy9TEQCUelFTDULB2S+YKYGOMcpM6UIccOQnRA6A
+cSp6ibfI+wkGADBGpTEd8xz1AaAfTQ7huA8AvUw5hVjuA0D/C5OaMN8XACRZ8F0zCggKAQhA
+AAIQgAAEIAABCEAAAhCAAAQgAAH4zg3feY4w3Xs44M5+oW0qvCWoGcvaIlM3x/f/ab+O738A
+hOCNQr34oD4AAAAldEVYdGNyZWF0ZS1kYXRlADIwMTAtMTItMjBUMTc6MDg6MzYrMDE6MDB6
+5RscAAAAJXRFWHRtb2RpZnktZGF0ZQAyMDEwLTEyLTIwVDE3OjA4OjM3KzAxOjAwgyNmnAAA
+AABJRU5ErkJggg==</office:binary-data></draw:image></draw:frame>but as soon as I continue writing in the text area, Table2 is highlighted again!</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row table:style-name="Table2.1">
+ <table:table-cell table:style-name="Table2.A1" office:value-type="string">
+ <text:h text:style-name="Heading_20_4" text:outline-level="4"><text:bookmark-start text:name="__RefHeading___Toc71133_2824860697"/><text:span text:style-name="T6">2</text:span>. Expected behavior<text:bookmark-end text:name="__RefHeading___Toc71133_2824860697"/></text:h>
+ <text:p text:style-name="Text_20_body"><text:span text:style-name="T9">If the focus in Navigator is on Headings, it should not jump to tables when I continue to edit text which is in a table</text:span>.</text:p>
+ </table:table-cell>
+ </table:table-row>
+ </table:table>
+ <text:section text:style-name="Sect3" text:name="section 2">
+ <text:h text:style-name="Heading_20_3" text:outline-level="3"><text:bookmark-start text:name="__RefHeading___Toc74207_2824860697"/>Now I create a section<text:bookmark-end text:name="__RefHeading___Toc74207_2824860697"/></text:h>
+ <table:table table:name="Table3" table:style-name="Table3">
+ <table:table-column table:style-name="Table3.A"/>
+ <table:table-row>
+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">
+ <text:p text:style-name="P14">To make it appear differently, I make it a two column one. Right now, the focus in the editing window is HERE, <text:span text:style-name="T8">but although “H Headings” is selected in the upper left corner of Navigator, the highlight jumps down to section 2! (Btw: when I tried to paste the screenshot below this text, it went to a completely different page, which is yet another bug in LO Writer, which is not subject of this bug report, but I keep note of it to report it in another bug report soon). In order to paste my picture where I want it to appear, I rearranged my text into a table and pasted the picture to a cell below. </text:span><text:span text:style-name="T10">Strangely, this picture goes to the next page in this section!</text:span><text:span text:style-name="T8">)</text:span></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <text:soft-page-break/>
+ <table:table-row>
+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">
+ <text:p text:style-name="Table_20_Contents"><draw:frame draw:style-name="fr1" draw:name="Image7" text:anchor-type="paragraph" svg:width="4.78cm" svg:height="9.999cm" draw:z-index="6"><draw:image draw:mime-type="image/png"></draw:image><office:binary-data>iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAABGdBTUEAALGPC/xhBQAAAAFz
+UkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
+AAJiS0dEAACqjSMyAAAACW9GRnMAAAAGAAAAAAAMc1XTAAAACXBIWXMAAA3XAAAN1wFCKJt4
+AAAACXZwQWcAAABMAAAAQACdMTgbAAABzUlEQVRo3u3ZPU/CQBjA8X+Jxs3ESUDj4iK+LA5+
+BBfjqBE1cXB2MlFAEqMgxvhNNL4sLsK3UPQL6ObkoAETz+FKW2mxCPRYnucWUu76/OC59C49
+cGOCKqrD9kHRc6ddPv7oW2WCwMh0nF63Myz7Tm8hPTNu0pgHMER3scepTbgK6enJNND83RLn
+/878yRaPmgBZFDuMsNLeWB9gmFQHP77MIg9gsYciR50NFKvtjIy10yk84pSZA7DYpwR8scmF
+QQCMuoQMpzbh0iAARrlnVn90CWHTsZcAiHPPdINQAuqsc2MQAAnKDUKWEhZ10twaBEDSJWQo
+YlFj7S9CzwEegkXWIbQsRAQASFJhpplwbRAACS+hANRJBxMiAkDcJeQ4sQkBhYgMoJ+Ozlwo
+2YQ7AJ6CRxyiUGnVy3hVKb0Af9v7hUG2Wy9TEQCUelFTDULB2S+YKYGOMcpM6UIccOQnRA6A
+cSp6ibfI+wkGADBGpTEd8xz1AaAfTQ7huA8AvUw5hVjuA0D/C5OaMN8XACRZ8F0zCggKAQhA
+AAIQgAAEIAABCEAAAhCAAAQgAAH4zg3feY4w3Xs44M5+oW0qvCWoGcvaIlM3x/f/ab+O738A
+hOCNQr34oD4AAAAldEVYdGNyZWF0ZS1kYXRlADIwMTAtMTItMjBUMTc6MDg6MzYrMDE6MDB6
+5RscAAAAJXRFWHRtb2RpZnktZGF0ZQAyMDEwLTEyLTIwVDE3OjA4OjM3KzAxOjAwgyNmnAAA
+AABJRU5ErkJggg==</office:binary-data></draw:frame></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row>
+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">
+ <text:h text:style-name="Heading_20_4" text:outline-level="4"><text:bookmark-start text:name="__RefHeading___Toc74209_2824860697"/><text:span text:style-name="T11">3. </text:span>Expected Behavior<text:bookmark-end text:name="__RefHeading___Toc74209_2824860697"/></text:h>
+ <text:p text:style-name="P15"><text:span text:style-name="T12">1.</text:span> Since “H Headings” is highlighted, I would expect this one highlighted:</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row>
+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">
+ <text:p text:style-name="P16"><draw:frame draw:style-name="fr1" draw:name="Image8" text:anchor-type="paragraph" svg:width="5.02cm" svg:height="9.999cm" draw:z-index="5"><draw:image draw:mime-type="image/png"><office:binary-data>iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAABGdBTUEAALGPC/xhBQAAAAFz
+UkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
+AAJiS0dEAACqjSMyAAAACW9GRnMAAAAGAAAAAAAMc1XTAAAACXBIWXMAAA3XAAAN1wFCKJt4
+AAAACXZwQWcAAABMAAAAQACdMTgbAAABzUlEQVRo3u3ZPU/CQBjA8X+Jxs3ESUDj4iK+LA5+
+BBfjqBE1cXB2MlFAEqMgxvhNNL4sLsK3UPQL6ObkoAETz+FKW2mxCPRYnucWUu76/OC59C49
+cGOCKqrD9kHRc6ddPv7oW2WCwMh0nF63Myz7Tm8hPTNu0pgHMER3scepTbgK6enJNND83RLn
+/878yRaPmgBZFDuMsNLeWB9gmFQHP77MIg9gsYciR50NFKvtjIy10yk84pSZA7DYpwR8scmF
+QQCMuoQMpzbh0iAARrlnVn90CWHTsZcAiHPPdINQAuqsc2MQAAnKDUKWEhZ10twaBEDSJWQo
+YlFj7S9CzwEegkXWIbQsRAQASFJhpplwbRAACS+hANRJBxMiAkDcJeQ4sQkBhYgMoJ+Ozlwo
+2YQ7AJ6CRxyiUGnVy3hVKb0Af9v7hUG2Wy9TEQCUelFTDULB2S+YKYGOMcpM6UIccOQnRA6A
+cSp6ibfI+wkGADBGpTEd8xz1AaAfTQ7huA8AvUw5hVjuA0D/C5OaMN8XACRZ8F0zCggKAQhA
+AAIQgAAEIAABCEAAAhCAAAQgAAH4zg3feY4w3Xs44M5+oW0qvCWoGcvaIlM3x/f/ab+O738A
+hOCNQr34oD4AAAAldEVYdGNyZWF0ZS1kYXRlADIwMTAtMTItMjBUMTc6MDg6MzYrMDE6MDB6
+5RscAAAAJXRFWHRtb2RpZnktZGF0ZQAyMDEwLTEyLTIwVDE3OjA4OjM3KzAxOjAwgyNmnAAA
+AABJRU5ErkJggg==</office:binary-data></draw:image></draw:frame>However, whatever I do, as soon as I continue editing, Table3 is highlighted again in the editor window.</text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row>
+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">
+ <text:p text:style-name="P17"><text:span text:style-name="T12">2.</text:span> I would have expected the <text:span text:style-name="T11">column to continue on the last page (which again is another quirk which I’ll report in another bug report).</text:span></text:p>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row>
+ <table:table-cell table:style-name="Table3.A1" office:value-type="string">
+ <text:p text:style-name="P15"><text:span text:style-name="T12">3.</text:span> <text:span text:style-name="T9">When editing this part, LibreOffice Writer started flickering</text:span> (a phenomemon which I also observed earlier but for which I was missing reproducible examples – and of course, this bug is not subject of this report, but I note it in order to use this file for a demonstration.</text:p>
+ </table:table-cell>
+ </table:table-row>
+ </table:table>
+ <text:p text:style-name="P13"/>
+ </text:section>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/core/layout/data/page-remove-fly-table.odt b/sw/qa/core/layout/data/page-remove-fly-table.odt
new file mode 100644
index 0000000000..6aaf230966
--- /dev/null
+++ b/sw/qa/core/layout/data/page-remove-fly-table.odt
Binary files differ
diff --git a/sw/qa/core/layout/data/para-border-in-cell-clip.docx b/sw/qa/core/layout/data/para-border-in-cell-clip.docx
new file mode 100644
index 0000000000..7c51685364
--- /dev/null
+++ b/sw/qa/core/layout/data/para-border-in-cell-clip.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/rtl-table.docx b/sw/qa/core/layout/data/rtl-table.docx
new file mode 100644
index 0000000000..a329229699
--- /dev/null
+++ b/sw/qa/core/layout/data/rtl-table.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/shape-textbox.odt b/sw/qa/core/layout/data/shape-textbox.odt
new file mode 100644
index 0000000000..15b0aa48df
--- /dev/null
+++ b/sw/qa/core/layout/data/shape-textbox.odt
Binary files differ
diff --git a/sw/qa/core/layout/data/sorted-objs-insert.docx b/sw/qa/core/layout/data/sorted-objs-insert.docx
new file mode 100644
index 0000000000..4041ab9868
--- /dev/null
+++ b/sw/qa/core/layout/data/sorted-objs-insert.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/split-table-border.odt b/sw/qa/core/layout/data/split-table-border.odt
new file mode 100644
index 0000000000..743d54bd38
--- /dev/null
+++ b/sw/qa/core/layout/data/split-table-border.odt
Binary files differ
diff --git a/sw/qa/core/layout/data/split-table-merged-border.odt b/sw/qa/core/layout/data/split-table-merged-border.odt
new file mode 100644
index 0000000000..122bfd473c
--- /dev/null
+++ b/sw/qa/core/layout/data/split-table-merged-border.odt
Binary files differ
diff --git a/sw/qa/core/layout/data/table-fly-overlap-spacing.docx b/sw/qa/core/layout/data/table-fly-overlap-spacing.docx
new file mode 100644
index 0000000000..1791bbee6d
--- /dev/null
+++ b/sw/qa/core/layout/data/table-fly-overlap-spacing.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/table-fly-overlap.docx b/sw/qa/core/layout/data/table-fly-overlap.docx
new file mode 100644
index 0000000000..a819e855b2
--- /dev/null
+++ b/sw/qa/core/layout/data/table-fly-overlap.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/table-in-footnote.docx b/sw/qa/core/layout/data/table-in-footnote.docx
new file mode 100644
index 0000000000..10e20ffbf4
--- /dev/null
+++ b/sw/qa/core/layout/data/table-in-footnote.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/table-missing-join.docx b/sw/qa/core/layout/data/table-missing-join.docx
new file mode 100644
index 0000000000..1fabb9e5b2
--- /dev/null
+++ b/sw/qa/core/layout/data/table-missing-join.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/table-print-area-left.docx b/sw/qa/core/layout/data/table-print-area-left.docx
new file mode 100644
index 0000000000..e326bed82f
--- /dev/null
+++ b/sw/qa/core/layout/data/table-print-area-left.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/tables-move-backwards.odt b/sw/qa/core/layout/data/tables-move-backwards.odt
new file mode 100644
index 0000000000..861dc4f4ad
--- /dev/null
+++ b/sw/qa/core/layout/data/tables-move-backwards.odt
Binary files differ
diff --git a/sw/qa/core/layout/data/tdf122894-4.doc b/sw/qa/core/layout/data/tdf122894-4.doc
new file mode 100644
index 0000000000..2fe41c9ad1
--- /dev/null
+++ b/sw/qa/core/layout/data/tdf122894-4.doc
Binary files differ
diff --git a/sw/qa/core/layout/data/tdf128195.docx b/sw/qa/core/layout/data/tdf128195.docx
new file mode 100644
index 0000000000..16180654ce
--- /dev/null
+++ b/sw/qa/core/layout/data/tdf128195.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt b/sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt
new file mode 100644
index 0000000000..aa5cc77126
--- /dev/null
+++ b/sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt
@@ -0,0 +1,284 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:officeooo="http://openoffice.org/2009/office" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:meta><dc:date>2020-07-14T15:50:45.951000000</dc:date><meta:editing-duration>PT1M19S</meta:editing-duration><meta:editing-cycles>1</meta:editing-cycles><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="4" meta:word-count="4" meta:character-count="8" meta:non-whitespace-character-count="8"/><meta:generator>LibreOfficeDev/7.1.0.0.alpha0$Windows_X86_64 LibreOffice_project/e8ffd954ee590d1f382685ceae12a51387919fb8</meta:generator></office:meta>
+ <office:settings>
+ <config:config-item-set config:name="ooo:view-settings">
+ <config:config-item config:name="ViewAreaTop" config:type="long">0</config:config-item>
+ <config:config-item config:name="ViewAreaLeft" config:type="long">0</config:config-item>
+ <config:config-item config:name="ViewAreaWidth" config:type="long">37837</config:config-item>
+ <config:config-item config:name="ViewAreaHeight" config:type="long">23232</config:config-item>
+ <config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item>
+ <config:config-item-map-indexed config:name="Views">
+ <config:config-item-map-entry>
+ <config:config-item config:name="ViewId" config:type="string">view2</config:config-item>
+ <config:config-item config:name="ViewLeft" config:type="long">10911</config:config-item>
+ <config:config-item config:name="ViewTop" config:type="long">6713</config:config-item>
+ <config:config-item config:name="VisibleLeft" config:type="long">0</config:config-item>
+ <config:config-item config:name="VisibleTop" config:type="long">0</config:config-item>
+ <config:config-item config:name="VisibleRight" config:type="long">37835</config:config-item>
+ <config:config-item config:name="VisibleBottom" config:type="long">23230</config:config-item>
+ <config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
+ <config:config-item config:name="ViewLayoutColumns" config:type="short">1</config:config-item>
+ <config:config-item config:name="ViewLayoutBookMode" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ZoomFactor" config:type="short">100</config:config-item>
+ <config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item>
+ </config:config-item-map-entry>
+ </config:config-item-map-indexed>
+ </config:config-item-set>
+ <config:config-item-set config:name="ooo:configuration-settings">
+ <config:config-item config:name="ProtectForm" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrinterName" config:type="string"/>
+ <config:config-item config:name="EmbeddedDatabaseName" config:type="string"/>
+ <config:config-item config:name="CurrentDatabaseDataSource" config:type="string"/>
+ <config:config-item config:name="LinkUpdateMode" config:type="short">1</config:config-item>
+ <config:config-item config:name="AddParaTableSpacingAtStart" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="FloattableNomargins" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="UnbreakableNumberings" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="FieldAutoUpdate" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="AddVerticalFrameOffsets" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="BackgroundParaOverDrawings" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="AddParaTableSpacing" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="ChartAutoUpdate" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="CurrentDatabaseCommand" config:type="string"/>
+ <config:config-item config:name="PrinterSetup" config:type="base64Binary"/>
+ <config:config-item config:name="AlignTabStopPosition" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrinterPaperFromSetup" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item>
+ <config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="DoNotJustifyLinesWithManualBreak" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="SaveThumbnail" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="SmallCapsPercentage66" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="CurrentDatabaseCommandType" config:type="int">0</config:config-item>
+ <config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="UpdateFromTemplate" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="DoNotCaptureDrawObjsOnPage" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="UseFormerObjectPositioning" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintSingleJobs" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="EmbedSystemFonts" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrinterIndependentLayout" config:type="string">high-resolution</config:config-item>
+ <config:config-item config:name="IsLabelDocument" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="AddFrameOffsets" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="AddExternalLeading" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="MsWordCompMinLineHeightByFly" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="UseOldNumbering" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="OutlineLevelYieldsNumbering" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="DoNotResetParaAttrsForNumFont" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IgnoreFirstLineIndentInNumbering" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="UseFormerLineSpacing" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="AddParaSpacingToTableCells" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="UseFormerTextWrapping" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="RedlineProtectionKey" config:type="base64Binary"/>
+ <config:config-item config:name="ConsiderTextWrapOnObjPos" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="EmbedFonts" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="TableRowKeep" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="TabsRelativeToIndent" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="IgnoreTabsAndBlanksForLineCalculation" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="RsidRoot" config:type="int">2065661</config:config-item>
+ <config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ClipAsCharacterAnchoredWriterFlyFrames" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="UnxForceZeroExtLeading" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="UseOldPrinterMetrics" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="TabAtLeftIndentForParagraphsInList" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="Rsid" config:type="int">2065661</config:config-item>
+ <config:config-item config:name="MsWordCompTrailingBlanks" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="MathBaselineAlignment" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="InvertBorderSpacing" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="CollapseEmptyCellPara" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="TabOverflow" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="StylesNoDefault" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ClippedPictures" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="EmbedOnlyUsedFonts" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="EmbedLatinScriptFonts" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="EmbedAsianScriptFonts" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="EmptyDbFieldHidesPara" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="EmbedComplexScriptFonts" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="TabOverMargin" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="TreatSingleColumnBreakAsPageBreak" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="SurroundTextWrapSmall" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ApplyParagraphMarkFormatToNumbering" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PropLineSpacingShrinksFirstLine" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="SubtractFlysAnchoredAtFlys" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="DisableOffPagePositioning" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ContinuousEndnotes" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ProtectBookmarks" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ProtectFields" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="HeaderSpacingBelowLastPara" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintAnnotationMode" config:type="short">0</config:config-item>
+ <config:config-item config:name="PrintGraphics" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintBlackFonts" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintLeftPages" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintControls" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintPageBackground" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintTextPlaceholder" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintDrawings" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintHiddenText" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintProspect" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintTables" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintProspectRTL" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintReversed" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintRightPages" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrintFaxName" config:type="string"/>
+ <config:config-item config:name="PrintPaperFromSetup" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrintEmptyPages" config:type="boolean">true</config:config-item>
+ </config:config-item-set>
+ </office:settings>
+ <office:scripts>
+ <office:script script:language="ooo:Basic">
+ <ooo:libraries xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink"/>
+ </office:script>
+ </office:scripts>
+ <office:font-face-decls>
+ <style:font-face style:name="Lucida Sans1" svg:font-family="&apos;Lucida Sans&apos;" style:font-family-generic="swiss"/>
+ <style:font-face style:name="Liberation Serif" svg:font-family="&apos;Liberation Serif&apos;" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Liberation Sans" svg:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/>
+ <style:font-face style:name="Lucida Sans" svg:font-family="&apos;Lucida Sans&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
+ <style:font-face style:name="Microsoft YaHei" svg:font-family="&apos;Microsoft YaHei&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
+ <style:font-face style:name="NSimSun" svg:font-family="NSimSun" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+ <style:default-style style:family="graphic">
+ <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
+ <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
+ <style:tab-stops/>
+ </style:paragraph-properties>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="hu" fo:country="HU" style:letter-kerning="true" style:font-name-asian="NSimSun" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lucida Sans" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/>
+ </style:default-style>
+ <style:default-style style:family="paragraph">
+ <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="hu" fo:country="HU" style:letter-kerning="true" style:font-name-asian="NSimSun" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lucida Sans" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false"/>
+ </style:default-style>
+ <style:default-style style:family="table">
+ <style:table-properties table:border-model="collapsing"/>
+ </style:default-style>
+ <style:default-style style:family="table-row">
+ <style:table-row-properties fo:keep-together="auto"/>
+ </style:default-style>
+ <style:style style:name="Standard" style:family="paragraph" style:class="text">
+ <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="2.752cm" style:contextual-spacing="true"/>
+ </style:style>
+ <style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text">
+ <style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" style:contextual-spacing="false" fo:keep-with-next="always"/>
+ <style:text-properties style:font-name="Liberation Sans" fo:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable" fo:font-size="14pt" style:font-name-asian="Microsoft YaHei" style:font-family-asian="&apos;Microsoft YaHei&apos;" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="14pt" style:font-name-complex="Lucida Sans" style:font-family-complex="&apos;Lucida Sans&apos;" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="14pt"/>
+ </style:style>
+ <style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">
+ <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.247cm" style:contextual-spacing="false" fo:line-height="115%"/>
+ </style:style>
+ <style:style style:name="List" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="list">
+ <style:text-properties style:font-size-asian="12pt" style:font-name-complex="Lucida Sans1" style:font-family-complex="&apos;Lucida Sans&apos;" style:font-family-generic-complex="swiss"/>
+ </style:style>
+ <style:style style:name="Caption" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
+ <style:paragraph-properties fo:margin-top="0.212cm" fo:margin-bottom="0.212cm" style:contextual-spacing="false" text:number-lines="false" text:line-number="0"/>
+ <style:text-properties fo:font-size="12pt" fo:font-style="italic" style:font-size-asian="12pt" style:font-style-asian="italic" style:font-name-complex="Lucida Sans1" style:font-family-complex="&apos;Lucida Sans&apos;" style:font-family-generic-complex="swiss" style:font-size-complex="12pt" style:font-style-complex="italic"/>
+ </style:style>
+ <style:style style:name="Index" style:family="paragraph" style:parent-style-name="Standard" style:class="index">
+ <style:paragraph-properties text:number-lines="false" text:line-number="0"/>
+ <style:text-properties style:font-size-asian="12pt" style:font-name-complex="Lucida Sans1" style:font-family-complex="&apos;Lucida Sans&apos;" style:font-family-generic-complex="swiss"/>
+ </style:style>
+ <text:outline-style style:name="Outline">
+ <text:outline-level-style text:level="1" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="2" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="3" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="4" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="5" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="6" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="7" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="8" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="9" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="10" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ </text:outline-style>
+ <text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/>
+ <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/>
+ <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/>
+ </office:styles>
+ <office:automatic-styles>
+ <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard">
+ <style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
+ </style:style>
+ <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Text_20_body">
+ <style:text-properties officeooo:rsid="001f84fd" officeooo:paragraph-rsid="001f84fd"/>
+ </style:style>
+ <style:style style:name="P3" style:family="paragraph">
+ <style:paragraph-properties fo:text-align="center"/>
+ </style:style>
+ <style:style style:name="gr1" style:family="graphic">
+ <style:graphic-properties svg:stroke-width="0.081cm" draw:marker-start-width="0.474cm" draw:marker-end-width="0.474cm" draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle" fo:padding-top="0.041cm" fo:padding-bottom="0.041cm" fo:padding-left="0.041cm" fo:padding-right="0.041cm" style:run-through="foreground" style:wrap="run-through" style:number-wrapped-paragraphs="no-limit" style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" loext:allow-overlap="true" style:flow-with-text="false"/>
+ </style:style>
+ <style:page-layout style:name="pm1">
+ <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm">
+ <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+ </style:page-layout-properties>
+ <style:header-style/>
+ <style:footer-style/>
+ </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+ <office:text>
+ <text:sequence-decls>
+ <text:sequence-decl text:display-outline-level="0" text:name="Illustration"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Text"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
+ </text:sequence-decls>
+ <text:p text:style-name="Standard">A1</text:p>
+ <text:p text:style-name="Standard"><draw:line text:anchor-type="paragraph" draw:z-index="0" draw:name="Alakzat1" draw:style-name="gr1" draw:text-style-name="P3" svg:x1="0cm" svg:y1="0cm" svg:x2="3.44cm" svg:y2="0.026cm">
+ <text:p/>
+ </draw:line>A2</text:p>
+ <text:p text:style-name="Standard"><draw:line text:anchor-type="paragraph" draw:z-index="1" draw:name="Alakzat1_0" draw:style-name="gr1" draw:text-style-name="P3" svg:x1="0cm" svg:y1="0cm" svg:x2="3.44cm" svg:y2="0.026cm">
+ <text:p/>
+ </draw:line>A3</text:p>
+ <text:p text:style-name="P2"><draw:line text:anchor-type="paragraph" draw:z-index="2" draw:name="Alakzat1_1" draw:style-name="gr1" draw:text-style-name="P3" svg:x1="0cm" svg:y1="0cm" svg:x2="3.44cm" svg:y2="0.026cm">
+ <text:p/>
+ </draw:line>B1</text:p>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/core/layout/data/tdf157096.docx b/sw/qa/core/layout/data/tdf157096.docx
new file mode 100644
index 0000000000..bca591e8ad
--- /dev/null
+++ b/sw/qa/core/layout/data/tdf157096.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/tdf45908_invoice.odt b/sw/qa/core/layout/data/tdf45908_invoice.odt
new file mode 100644
index 0000000000..41ff78d34d
--- /dev/null
+++ b/sw/qa/core/layout/data/tdf45908_invoice.odt
Binary files differ
diff --git a/sw/qa/core/layout/data/textbox-autogrow-vertical.docx b/sw/qa/core/layout/data/textbox-autogrow-vertical.docx
new file mode 100644
index 0000000000..0cc45a781c
--- /dev/null
+++ b/sw/qa/core/layout/data/textbox-autogrow-vertical.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/textbox-modification.docx b/sw/qa/core/layout/data/textbox-modification.docx
new file mode 100644
index 0000000000..6adf1a950e
--- /dev/null
+++ b/sw/qa/core/layout/data/textbox-modification.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/textbox-phantom-change.docx b/sw/qa/core/layout/data/textbox-phantom-change.docx
new file mode 100644
index 0000000000..75ac039561
--- /dev/null
+++ b/sw/qa/core/layout/data/textbox-phantom-change.docx
Binary files differ
diff --git a/sw/qa/core/layout/data/vmerge-cell-border.docx b/sw/qa/core/layout/data/vmerge-cell-border.docx
new file mode 100644
index 0000000000..11d7a76d22
--- /dev/null
+++ b/sw/qa/core/layout/data/vmerge-cell-border.docx
Binary files differ
diff --git a/sw/qa/core/layout/fly.cxx b/sw/qa/core/layout/fly.cxx
new file mode 100644
index 0000000000..47cfb40fa6
--- /dev/null
+++ b/sw/qa/core/layout/fly.cxx
@@ -0,0 +1,91 @@
+/* -*- 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 <IDocumentLayoutAccess.hxx>
+#include <anchoredobject.hxx>
+#include <flyfrms.hxx>
+#include <pagefrm.hxx>
+#include <rootfrm.hxx>
+#include <sortedobjs.hxx>
+#include <docsh.hxx>
+#include <wrtsh.hxx>
+
+namespace
+{
+/// Covers sw/source/core/layout/fly.cxx fixes, i.e. mostly SwFlyFrame.
+class Test : public SwModelTestBase
+{
+public:
+ Test()
+ : SwModelTestBase("/sw/qa/core/layout/data/")
+ {
+ }
+};
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyNegativeHeight)
+{
+ // Given a document with complex enough content that a split fly frame temporarily moves below
+ // the bottom of the body frame on a page:
+ // When laying out the document, SwEditShell::CalcLayout() never returned:
+ createSwDoc("floattable-negative-height.docx");
+
+ SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+ pWrtShell->Reformat();
+
+ // Make sure that all the pages have the expected content:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ for (SwFrame* pFrame = pLayout->Lower(); pFrame; pFrame = pFrame->GetNext())
+ {
+ auto pPage = pFrame->DynCastPageFrame();
+ if (!pPage->GetPrev())
+ {
+ // First page: start of the split fly chain:
+ CPPUNIT_ASSERT(pPage->GetSortedObjs());
+ SwSortedObjs& rPageObjs = *pPage->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPageObjs.size());
+ auto pFly = rPageObjs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+ CPPUNIT_ASSERT(pFly);
+ CPPUNIT_ASSERT(!pFly->GetPrecede());
+ CPPUNIT_ASSERT(pFly->GetFollow());
+ }
+ else if (pPage->GetPrev() && pPage->GetNext() && pPage->GetNext()->GetNext())
+ {
+ // Middle pages: have a previous and a next fly:
+ CPPUNIT_ASSERT(pPage->GetSortedObjs());
+ SwSortedObjs& rPageObjs = *pPage->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPageObjs.size());
+ auto pFly = rPageObjs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+ CPPUNIT_ASSERT(pFly);
+ CPPUNIT_ASSERT(pFly->GetPrecede());
+ CPPUNIT_ASSERT(pFly->GetFollow());
+ }
+ else if (pPage->GetPrev() && pPage->GetNext() && !pPage->GetNext()->GetNext())
+ {
+ // Page last but one: end of the fly chain:
+ CPPUNIT_ASSERT(pPage->GetSortedObjs());
+ SwSortedObjs& rPageObjs = *pPage->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPageObjs.size());
+ auto pFly = rPageObjs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+ CPPUNIT_ASSERT(pFly);
+ CPPUNIT_ASSERT(pFly->GetPrecede());
+ CPPUNIT_ASSERT(!pFly->GetFollow());
+ }
+ else if (pPage->GetPrev() && !pPage->GetNext())
+ {
+ // Last page: no flys.
+ CPPUNIT_ASSERT(!pPage->GetSortedObjs());
+ }
+ }
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/layout/flycnt.cxx b/sw/qa/core/layout/flycnt.cxx
new file mode 100644
index 0000000000..455012ea49
--- /dev/null
+++ b/sw/qa/core/layout/flycnt.cxx
@@ -0,0 +1,1275 @@
+/* -*- 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 <svx/svdview.hxx>
+#include <comphelper/propertyvalue.hxx>
+
+#include <IDocumentLayoutAccess.hxx>
+#include <anchoredobject.hxx>
+#include <flyfrms.hxx>
+#include <formatflysplit.hxx>
+#include <pagefrm.hxx>
+#include <rootfrm.hxx>
+#include <sortedobjs.hxx>
+#include <tabfrm.hxx>
+#include <txtfrm.hxx>
+#include <fmtfsize.hxx>
+#include <docsh.hxx>
+#include <wrtsh.hxx>
+#include <itabenum.hxx>
+#include <frmmgr.hxx>
+#include <frameformats.hxx>
+#include <cellfrm.hxx>
+#include <ndtxt.hxx>
+#include <dflyobj.hxx>
+#include <IDocumentSettingAccess.hxx>
+#include <formatwraptextatflystart.hxx>
+
+namespace
+{
+/// Covers sw/source/core/layout/flycnt.cxx fixes, i.e. mostly SwFlyAtContentFrame.
+class Test : public SwModelTestBase
+{
+public:
+ Test()
+ : SwModelTestBase("/sw/qa/core/layout/data/")
+ {
+ }
+
+ /// Creates a document with a multi-page floating table: 1 columns and 2 rows.
+ void Create1x2SplitFly();
+};
+
+void Test::Create1x2SplitFly()
+{
+ createSwDoc();
+ SwDoc* pDoc = getSwDoc();
+ SwPageDesc aStandard(pDoc->GetPageDesc(0));
+ SwFormatFrameSize aPageSize(aStandard.GetMaster().GetFrameSize());
+ // 10 cm for the page height, 2cm are the top and bottom margins, so 6cm remains for the body
+ // frame:
+ aPageSize.SetHeight(5669);
+ aStandard.GetMaster().SetFormatAttr(aPageSize);
+ pDoc->ChgPageDesc(0, aStandard);
+ // Insert a table:
+ SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+ SwInsertTableOptions aTableOptions(SwInsertTableFlags::DefaultBorder, 0);
+ pWrtShell->InsertTable(aTableOptions, /*nRows=*/2, /*nCols=*/1);
+ pWrtShell->MoveTable(GotoPrevTable, fnTableStart);
+ pWrtShell->GoPrevCell();
+ pWrtShell->Insert("A1");
+ SwFormatFrameSize aRowSize(SwFrameSize::Minimum);
+ // 4 cm, so 2 rows don't fit 1 page.
+ aRowSize.SetHeight(2267);
+ pWrtShell->SetRowHeight(aRowSize);
+ pWrtShell->GoNextCell();
+ pWrtShell->Insert("A2");
+ pWrtShell->SetRowHeight(aRowSize);
+ // Select cell:
+ pWrtShell->SelAll();
+ // Select table:
+ pWrtShell->SelAll();
+ // Wrap the table in a text frame:
+ SwFlyFrameAttrMgr aMgr(true, pWrtShell, Frmmgr_Type::TEXT, nullptr);
+ pWrtShell->StartAllAction();
+ aMgr.InsertFlyFrame(RndStdIds::FLY_AT_PARA, aMgr.GetPos(), aMgr.GetSize());
+ pWrtShell->EndAllAction();
+ // Allow the text frame to split:
+ pWrtShell->StartAllAction();
+ auto& rFlys = *pDoc->GetSpzFrameFormats();
+ auto pFly = rFlys[0];
+ SwAttrSet aSet(pFly->GetAttrSet());
+ aSet.Put(SwFormatFlySplit(true));
+ pDoc->SetAttr(aSet, *pFly);
+ pWrtShell->EndAllAction();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ // We have 2 pages:
+ CPPUNIT_ASSERT(pPage1->GetNext());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyWithTable)
+{
+ // Given a document with a multi-page floating table:
+ createSwDoc("floattable.docx");
+
+ // When laying out that document:
+ calcLayout();
+
+ // Then make sure that the first row goes to page 1 and the second row goes to page 2, while the
+ // table is floating:
+ SwDoc* pDoc = getSwDoc();
+ // Without the accompanying fix in place, this test would have failed with a stack overflow
+ // because the follow frame of the anchor was moved into the follow frame of the fly, so the fly
+ // was anchored in itself.
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ // Page 1 has a master fly, which contains a master table:
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage1Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage1Objs[0]);
+ CPPUNIT_ASSERT(pPage1Fly);
+ CPPUNIT_ASSERT(!pPage1Fly->GetPrecede());
+ CPPUNIT_ASSERT(pPage1Fly->GetFollow());
+ auto pPage1Table = dynamic_cast<SwTabFrame*>(pPage1Fly->GetLower());
+ CPPUNIT_ASSERT(pPage1Table);
+ CPPUNIT_ASSERT(!pPage1Table->GetPrecede());
+ CPPUNIT_ASSERT(pPage1Table->GetFollow());
+ // Page 2 has a follow fly, which contains a follow table:
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ CPPUNIT_ASSERT(pPage2);
+ const SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage2Objs.size());
+ auto pPage2Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage2Objs[0]);
+ CPPUNIT_ASSERT(pPage2Fly);
+ CPPUNIT_ASSERT(pPage2Fly->GetPrecede());
+ CPPUNIT_ASSERT(!pPage2Fly->GetFollow());
+ auto pPage2Table = dynamic_cast<SwTabFrame*>(pPage2Fly->GetLower());
+ CPPUNIT_ASSERT(pPage2Table);
+ CPPUNIT_ASSERT(pPage2Table->GetPrecede());
+ CPPUNIT_ASSERT(!pPage2Table->GetFollow());
+ // Page 1 anchor has no text:
+ auto pPage1Anchor = dynamic_cast<SwTextFrame*>(pPage1->FindLastBodyContent());
+ CPPUNIT_ASSERT(pPage1Anchor);
+ // This failed, page 1 anchor had unexpected, leftover text.
+ CPPUNIT_ASSERT(!pPage1Anchor->HasPara());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyVertOffset)
+{
+ // Given a document with a floattable, split on 2 pages and a positive vertical offset:
+ createSwDoc("floattable-vertoffset.docx");
+
+ // When laying out that document:
+ calcLayout();
+
+ // Then make sure that the vert offset has an effect on the master fly, but not on follow flys:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage1Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage1Objs[0]);
+ CPPUNIT_ASSERT(pPage1Fly);
+ auto pPage1Anchor = dynamic_cast<SwTextFrame*>(pPage1->FindLastBodyContent());
+ CPPUNIT_ASSERT(pPage1Anchor);
+ SwTwips nPage1AnchorTop = pPage1Anchor->getFrameArea().Top();
+ SwTwips nPage1FlyTop = pPage1Fly->getFrameArea().Top();
+ // First page, the vert offset should be there. This comes from word/document.xml:
+ // <w:tblpPr ... w:tblpY="1135"/>
+ CPPUNIT_ASSERT_EQUAL(static_cast<SwTwips>(1135), nPage1FlyTop - nPage1AnchorTop);
+
+ // Also verify that the 2nd page has no such offset:
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ CPPUNIT_ASSERT(pPage2);
+ const SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage2Objs.size());
+ auto pPage2Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage2Objs[0]);
+ CPPUNIT_ASSERT(pPage2Fly);
+ auto pPage2Anchor = dynamic_cast<SwTextFrame*>(pPage2->FindLastBodyContent());
+ CPPUNIT_ASSERT(pPage2Anchor);
+ SwTwips nPage2AnchorTop = pPage2Anchor->getFrameArea().Top();
+ SwTwips nPage2FlyTop = pPage2Fly->getFrameArea().Top();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 0
+ // - Actual : 1135
+ // i.e. the fly frame on the 2nd page was also shifted down in Writer, but not in Word.
+ CPPUNIT_ASSERT_EQUAL(static_cast<SwTwips>(0), nPage2FlyTop - nPage2AnchorTop);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFly3Pages)
+{
+ // Given a document with a floattable, split on 3 pages:
+ createSwDoc("floattable-3pages.docx");
+
+ // When laying out that document:
+ calcLayout();
+
+ // Then make sure that row 1, 2 & 3 go to page 1, 2 & 3, while the table is floating:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage1Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage1Objs[0]);
+ CPPUNIT_ASSERT(pPage1Fly);
+ auto pPage1Anchor = dynamic_cast<SwTextFrame*>(pPage1->FindLastBodyContent());
+ CPPUNIT_ASSERT(pPage1Anchor);
+ SwTwips nPage1AnchorTop = pPage1Anchor->getFrameArea().Top();
+ SwTwips nPage1FlyTop = pPage1Fly->getFrameArea().Top();
+ // The vert offset should be there on the first page:
+ CPPUNIT_ASSERT_EQUAL(static_cast<SwTwips>(1135), nPage1FlyTop - nPage1AnchorTop);
+ // Second page:
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ CPPUNIT_ASSERT(pPage2);
+ const SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1
+ // - Actual : 2
+ // i.e. both the 2nd and 3rd fly was anchored on page 2.
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage2Objs.size());
+ auto pPage2Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage2Objs[0]);
+ CPPUNIT_ASSERT(pPage2Fly);
+ auto pPage2Anchor = dynamic_cast<SwTextFrame*>(pPage2->FindLastBodyContent());
+ CPPUNIT_ASSERT(pPage2Anchor);
+ SwTwips nPage2AnchorTop = pPage2Anchor->getFrameArea().Top();
+ SwTwips nPage2FlyTop = pPage2Fly->getFrameArea().Top();
+ // No vert offset on the second page:
+ CPPUNIT_ASSERT_EQUAL(static_cast<SwTwips>(0), nPage2FlyTop - nPage2AnchorTop);
+ // 3rd page:
+ auto pPage3 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ CPPUNIT_ASSERT(pPage3);
+ const SwSortedObjs& rPage3Objs = *pPage3->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage3Objs.size());
+ auto pPage3Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage3Objs[0]);
+ CPPUNIT_ASSERT(pPage3Fly);
+ auto pPage3Anchor = dynamic_cast<SwTextFrame*>(pPage3->FindLastBodyContent());
+ CPPUNIT_ASSERT(pPage3Anchor);
+ SwTwips nPage3AnchorTop = pPage3Anchor->getFrameArea().Top();
+ SwTwips nPage3FlyTop = pPage3Fly->getFrameArea().Top();
+ // No vert offset on the 3rd page:
+ CPPUNIT_ASSERT_EQUAL(static_cast<SwTwips>(0), nPage3FlyTop - nPage3AnchorTop);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyRow)
+{
+ // Given a document with a floattable, single row split on 2 pages:
+ createSwDoc("floattable-rowsplit.docx");
+
+ // When laying out that document:
+ calcLayout();
+
+ // Then make sure that the single row is split to 2 pages, and the fly frames have the correct
+ // coordinates:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage1Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage1Objs[0]);
+ CPPUNIT_ASSERT(pPage1Fly);
+ auto pPage1Anchor = dynamic_cast<SwTextFrame*>(pPage1->FindLastBodyContent());
+ CPPUNIT_ASSERT(pPage1Anchor);
+ // ~No offset between the fly and its anchor:
+ SwTwips nPage1AnchorTop = pPage1Anchor->getFrameArea().Top();
+ SwTwips nPage1FlyTop = pPage1Fly->getFrameArea().Top();
+ CPPUNIT_ASSERT_EQUAL(static_cast<SwTwips>(1), nPage1FlyTop - nPage1AnchorTop);
+ // Second page:
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ CPPUNIT_ASSERT(pPage2);
+ const SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage2Objs.size());
+ auto pPage2Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage2Objs[0]);
+ CPPUNIT_ASSERT(pPage2Fly);
+ auto pPage2Anchor = dynamic_cast<SwTextFrame*>(pPage2->FindLastBodyContent());
+ CPPUNIT_ASSERT(pPage2Anchor);
+ // No offset between the fly and its anchor:
+ SwTwips nPage2AnchorTop = pPage2Anchor->getFrameArea().Top();
+ SwTwips nPage2FlyTop = pPage2Fly->getFrameArea().Top();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 0
+ // - Actual : -1440
+ // i.e. the 2nd page's fly had a wrong position.
+ CPPUNIT_ASSERT_EQUAL(static_cast<SwTwips>(0), nPage2FlyTop - nPage2AnchorTop);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyEnable)
+{
+ // Given a document with a table in a textframe:
+ Create1x2SplitFly();
+
+ // Then make sure that the layout is updated and we have 2 pages:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ // Without the accompanying fix in place, this test would have failed, there was no 2nd page.
+ CPPUNIT_ASSERT(pPage2);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyDisable)
+{
+ // Given a document with a floating table, table split on 2 pages:
+ Create1x2SplitFly();
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ CPPUNIT_ASSERT(pPage1->GetNext());
+ const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage1Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage1Objs[0]);
+ CPPUNIT_ASSERT(pPage1Fly);
+ CPPUNIT_ASSERT(pPage1Fly->GetFollow());
+
+ // When turning the "split fly" checkbox off:
+ SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+ pWrtShell->StartAllAction();
+ auto& rFlys = *pDoc->GetSpzFrameFormats();
+ auto pFly = rFlys[0];
+ SwAttrSet aSet(pFly->GetAttrSet());
+ // Note how the UI puts a SwFormatFrameSize into this item set with a slightly different size
+ // (e.g. 3823 twips width -> 3821). This means that by accident the UI works even without the
+ // explicit RES_FLY_SPLIT handling in SwFlyFrame::UpdateAttr_(), but this test will fail when
+ // that is missing.
+ aSet.Put(SwFormatFlySplit(false));
+ pDoc->SetAttr(aSet, *pFly);
+ pWrtShell->EndAllAction();
+
+ // Then make sure the extra page and follow fly frame is joined:
+ CPPUNIT_ASSERT(!pPage1->GetNext());
+ // Without the accompanying fix in place, this test would have failed, the follow fly frame was
+ // moved to page 1, but it wasn't deleted.
+ CPPUNIT_ASSERT(!pPage1Fly->GetFollow());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyFooter)
+{
+ // Given a document with a floattable, table split on 2 pages with headers/footers:
+ createSwDoc("floattable-footer.docx");
+
+ // When laying out that document:
+ calcLayout();
+
+ // Then make sure that the table is split to 2 pages:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ SwTwips nPage1Top = pPage1->getFrameArea().Top();
+ const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage1Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage1Objs[0]);
+ CPPUNIT_ASSERT(pPage1Fly);
+ SwTwips nPage1FlyTop = pPage1Fly->getFrameArea().Top();
+ // <w:tblpPr w:tblpY="3286"> from the bugdoc.
+ CPPUNIT_ASSERT_EQUAL(static_cast<SwTwips>(3286), nPage1FlyTop - nPage1Top);
+ // Second page:
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ // Without the accompanying fix in place, this test would have failed, there was no 2nd page.
+ CPPUNIT_ASSERT(pPage2);
+ SwTwips nPage2Top = pPage2->getFrameArea().Top();
+ const SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage2Objs.size());
+ auto pPage2Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage2Objs[0]);
+ CPPUNIT_ASSERT(pPage2Fly);
+ SwTwips nPage2FlyTop = pPage2Fly->getFrameArea().Top();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1440
+ // - Actual : 0
+ // i.e. <w:pgMar w:top="1440"> from the bugdoc was lost, the follow fly had no vertical offset.
+ CPPUNIT_ASSERT_EQUAL(static_cast<SwTwips>(1440), nPage2FlyTop - nPage2Top);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyFooter2Rows)
+{
+ // Given a document with a 2nd page that contains the second half of a split row + a last row:
+ createSwDoc("floattable-footer-2rows.docx");
+
+ // When laying out that document:
+ calcLayout();
+
+ // Then make sure that the table is split to 2 pages:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ CPPUNIT_ASSERT(pPage2);
+ // Without the accompanying fix in place, this test would have failed. The 2nd page only had the
+ // 2nd half of the split row and the last row went to a 3rd page.
+ CPPUNIT_ASSERT(!pPage2->GetNext());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFly2Cols)
+{
+ // Given a document with a 2nd page that contains the second half of a split row and 2 columns:
+ createSwDoc("floattable-2cols.docx");
+
+ // When laying out that document:
+ calcLayout();
+
+ // Then make sure that the table is split to 2 pages:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ CPPUNIT_ASSERT(pPage2);
+ // Without the accompanying fix in place, this test would have failed. The 2nd page only had the
+ // 2nd half of the split row and the very last row went to a 3rd page.
+ CPPUNIT_ASSERT(!pPage2->GetNext());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyWidow)
+{
+ // Given a document with a 2nd page that contains 2 lines, due to widow control:
+ createSwDoc("floattable-widow.docx");
+
+ // When laying out that document:
+ calcLayout();
+
+ // Then make sure that widow control works:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage1Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage1Objs[0]);
+ CPPUNIT_ASSERT(pPage1Fly);
+ SwFrame* pTab1 = pPage1Fly->GetLower();
+ SwFrame* pRow1 = pTab1->GetLower();
+ SwFrame* pCell1 = pRow1->GetLower();
+ auto pText1 = dynamic_cast<SwTextFrame*>(pCell1->GetLower());
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 6
+ // - Actual : 7
+ // i.e. widow control was disabled, layout didn't match Word.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(6), pText1->GetThisLines());
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ CPPUNIT_ASSERT(pPage2);
+ const SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage2Objs.size());
+ auto pPage2Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage2Objs[0]);
+ CPPUNIT_ASSERT(pPage2Fly);
+ SwFrame* pTab2 = pPage2Fly->GetLower();
+ SwFrame* pRow2 = pTab2->GetLower();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1014
+ // - Actual : 553
+ // i.e. <w:trHeight w:val="1014"> from the file was ignored.
+ CPPUNIT_ASSERT_EQUAL(static_cast<tools::Long>(1014), pRow2->getFrameArea().Height());
+ SwFrame* pCell2 = pRow2->GetLower();
+ auto pText2 = dynamic_cast<SwTextFrame*>(pCell2->GetLower());
+ // And then similarly this was 1, not 2.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), pText2->GetThisLines());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyCompat14)
+{
+ // Given a Word 2010 document with 2 pages, one table row each:
+ createSwDoc("floattable-compat14.docx");
+
+ // When laying out that document:
+ calcLayout();
+
+ // Then make sure that the first row is entirely on page 1:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage1Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage1Objs[0]);
+ CPPUNIT_ASSERT(pPage1Fly);
+ SwFrame* pTab1 = pPage1Fly->GetLower();
+ SwFrame* pRow1 = pTab1->GetLower();
+ auto pCell1 = dynamic_cast<SwCellFrame*>(pRow1->GetLower());
+ // Without the accompanying fix in place, this test would have failed, the first row was split,
+ // but not in Word.
+ CPPUNIT_ASSERT(!pCell1->GetFollowCell());
+ // Also make sure that the second row is entirely on page 2:
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ CPPUNIT_ASSERT(pPage2);
+ const SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage2Objs.size());
+ auto pPage2Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage2Objs[0]);
+ CPPUNIT_ASSERT(pPage2Fly);
+ SwFrame* pTab2 = pPage2Fly->GetLower();
+ SwFrame* pRow2 = pTab2->GetLower();
+ auto pCell2 = dynamic_cast<SwCellFrame*>(pRow2->GetLower());
+ // Without the accompanying fix in place, this test would have failed, the second row was split,
+ // but not in Word.
+ CPPUNIT_ASSERT(!pCell2->GetPreviousCell());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyCompat14Nosplit)
+{
+ // Given a Word 2010 document with 2 pages, 2 rows on page 1, 1 row on page 2:
+ createSwDoc("floattable-compat14-nosplit.docx");
+
+ // When laying out that document:
+ calcLayout();
+
+ // Then make sure that the last row is on a separate page:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage1Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage1Objs[0]);
+ CPPUNIT_ASSERT(pPage1Fly);
+ SwFrame* pTab1 = pPage1Fly->GetLower();
+ SwFrame* pRow1 = pTab1->GetLower();
+ CPPUNIT_ASSERT(pRow1->GetNext());
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ // Without the accompanying fix in place, this test would have failed, all rows were on page 1.
+ CPPUNIT_ASSERT(pPage2);
+ const SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage2Objs.size());
+ auto pPage2Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage2Objs[0]);
+ CPPUNIT_ASSERT(pPage2Fly);
+ SwFrame* pTab2 = pPage2Fly->GetLower();
+ SwFrame* pRow2 = pTab2->GetLower();
+ CPPUNIT_ASSERT(!pRow2->GetNext());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyCompat14Body)
+{
+ // Given a Word 2010 document with 2 pages, 1 row on page 1, 1 row on page 2:
+ createSwDoc("floattable-compat14-body.docx");
+
+ // When laying out that document:
+ // (This is legacy mode, but still Word doesn't split row 2 because 1) row 2 has a minimal
+ // height, so even the first part of row 2 would not fit the body frame and 2) Word allows using
+ // the bottom margin area in legacy mode, but only in case the fly height <= body height.)
+ calcLayout();
+
+ // Then make sure that the second row is on a page 2:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage1Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage1Objs[0]);
+ CPPUNIT_ASSERT(pPage1Fly);
+ SwFrame* pTab1 = pPage1Fly->GetLower();
+ SwFrame* pRow1 = pTab1->GetLower();
+ // Without the accompanying fix in place, this test would have failed, part of row 2 was on page
+ // 1.
+ CPPUNIT_ASSERT(!pRow1->GetNext());
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ CPPUNIT_ASSERT(pPage2);
+ const SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage2Objs.size());
+ auto pPage2Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage2Objs[0]);
+ CPPUNIT_ASSERT(pPage2Fly);
+ SwFrame* pTab2 = pPage2Fly->GetLower();
+ SwFrame* pRow2 = pTab2->GetLower();
+ CPPUNIT_ASSERT(!pRow2->GetNext());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyFollowHorizontalPosition)
+{
+ // Given a document with 2 pages, master fly on page 1, follow fly on page 2:
+ createSwDoc("floattable-hori-pos.docx");
+
+ // When laying out that document:
+ calcLayout();
+
+ // Then make sure that the follow fly doesn't have a different horizontal position:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage1Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage1Objs[0]);
+ CPPUNIT_ASSERT(pPage1Fly);
+ tools::Long nPage1FlyLeft = pPage1Fly->getFrameArea().Left();
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ CPPUNIT_ASSERT(pPage2);
+ const SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage2Objs.size());
+ auto pPage2Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage2Objs[0]);
+ CPPUNIT_ASSERT(pPage2Fly);
+ tools::Long nPage2FlyLeft = pPage2Fly->getFrameArea().Left();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 5528
+ // - Actual : 284
+ // i.e. the follow fly was pushed towards the left, instead of having the same position as the
+ // master fly.
+ CPPUNIT_ASSERT_EQUAL(nPage1FlyLeft, nPage2FlyLeft);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testCursorTraversal)
+{
+ // Given a document with a multi-page floating table:
+ Create1x2SplitFly();
+
+ // When going from A1 to A2:
+ SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+ pWrtShell->GotoTable("Table1");
+ SwTextNode* pTextNode = pWrtShell->GetCursor()->GetPointNode().GetTextNode();
+ CPPUNIT_ASSERT_EQUAL(OUString("A1"), pTextNode->GetText());
+ pWrtShell->Down(/*bSelect=*/false);
+
+ // Then make sure we get to A2 and don't stay in A1:
+ pTextNode = pWrtShell->GetCursor()->GetPointNode().GetTextNode();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: A2
+ // - Actual : A1
+ // i.e. the cursor didn't get from A1 to A2.
+ CPPUNIT_ASSERT_EQUAL(OUString("A2"), pTextNode->GetText());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyRowDelete)
+{
+ // Given a document with a multi-page floating table:
+ Create1x2SplitFly();
+
+ // When deleting the row of A2:
+ SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+ pWrtShell->GotoTable("Table1");
+ pWrtShell->Down(/*bSelect=*/false);
+ SwTextNode* pTextNode = pWrtShell->GetCursor()->GetPointNode().GetTextNode();
+ // We delete the right row:
+ CPPUNIT_ASSERT_EQUAL(OUString("A2"), pTextNode->GetText());
+ pWrtShell->DeleteRow();
+
+ // Then make sure we only have 1 page:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ CPPUNIT_ASSERT(!pPage1->GetNext());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFly1stRowDelete)
+{
+ // Given a document with a multi-page floating table:
+ Create1x2SplitFly();
+
+ // When deleting the row of A1:
+ SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+ pWrtShell->GotoTable("Table1");
+ SwTextNode* pTextNode = pWrtShell->GetCursor()->GetPointNode().GetTextNode();
+ // We delete the right row:
+ CPPUNIT_ASSERT_EQUAL(OUString("A1"), pTextNode->GetText());
+ pWrtShell->DeleteRow();
+
+ // Then make sure we only have 1 page:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ // Without the accompanying fix in place, this test would have failed, the follow fly was still
+ // on page 2.
+ CPPUNIT_ASSERT(!pPage1->GetNext());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFly3rdRowDelete)
+{
+ // Given a document with a floattable, split on 3 pages:
+ createSwDoc("floattable-3pages.docx");
+
+ // When deleting the row of A3:
+ SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+ pWrtShell->GotoTable("Table1");
+ pWrtShell->Down(/*bSelect=*/false);
+ pWrtShell->Down(/*bSelect=*/false);
+ SwTextNode* pTextNode = pWrtShell->GetCursor()->GetPointNode().GetTextNode();
+ // We delete the right row:
+ CPPUNIT_ASSERT_EQUAL(OUString("A3"), pTextNode->GetText());
+ pWrtShell->DeleteRow();
+
+ // Then make sure we only have 2 pages:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ // Without the accompanying fix in place, this test would have failed, page 3 was not deleted.
+ CPPUNIT_ASSERT(!pPage2->GetNext());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFly2ndRowSelect)
+{
+ // Given a document with a multi-page floating table:
+ createSwDoc("floattable.docx");
+
+ // When selecting the second row:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ auto pPage2Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage2Objs[0]);
+ const SwRect& aFollowArea = pPage2Fly->getFrameArea();
+ Point aTopCenter((aFollowArea.Left() + aFollowArea.Right()) / 2, aFollowArea.Top());
+ SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+ pWrtShell->SelectObj(aTopCenter);
+
+ // Then make sure the first row is selected:
+ const SdrMarkList& rMarkList = pWrtShell->GetDrawView()->GetMarkedObjectList();
+ SdrObject* pSelectedObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ auto pSelectedVirtObj = dynamic_cast<SwVirtFlyDrawObj*>(pSelectedObj);
+ auto pSelected = static_cast<SwFlyAtContentFrame*>(pSelectedVirtObj->GetFlyFrame());
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 5
+ // - Actual : 17
+ // i.e. a follow fly was possible to select (instead of its master)
+ CPPUNIT_ASSERT_EQUAL(pPage2Fly->GetPrecede()->GetFrameId(), pSelected->GetFrameId());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyInSection)
+{
+ // This crashed, the layout assumed that the floating table is directly under the body frame.
+ createSwDoc("floattable-in-section.docx");
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyThenTable)
+{
+ // Given a document with a 2 page floating table, followed by an other table:
+ // Intentionally load the document as hidden to avoid layout during load (see TestTdf150616):
+ uno::Sequence<beans::PropertyValue> aFilterOptions = {
+ comphelper::makePropertyValue("Hidden", true),
+ };
+ mxComponent = loadFromDesktop(m_directories.getURLFromSrc(u"/sw/qa/core/layout/data/")
+ + "floattable-then-table.docx",
+ "com.sun.star.text.TextDocument", aFilterOptions);
+
+ // When layout is calculated during PDF export:
+ // Then make sure that finishes without errors:
+ // This crashed, due to a stack overflow in layout code.
+ save("writer_pdf_Export");
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyInTextSection)
+{
+ // The document contains a DOCX cont sect break, which is mapped to a TextSection.
+ // This crashed, the anchor was split directly, so the follow anchor was moved outside the
+ // section frame, which is broken.
+ createSwDoc("floattable-in-text-section.docx");
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyTableRowKeep)
+{
+ // Given a document with a floating table, 2.5 rows on the first page:
+ createSwDoc("floattable-table-row-keep.docx");
+
+ // When laying out that document:
+ calcLayout();
+
+ // Then make sure that the expected amount of rows is on the first page:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage1Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage1Objs[0]);
+ CPPUNIT_ASSERT(pPage1Fly);
+ SwFrame* pTab1 = pPage1Fly->GetLower();
+ SwFrame* pRow1 = pTab1->GetLower();
+ CPPUNIT_ASSERT(pRow1);
+ SwFrame* pRow2 = pRow1->GetNext();
+ // Without the accompanying fix in place, this test would have failed, the table on the first
+ // page only had 1 row, due to TableRowKeep kicking in for floating tables, which is incorrect.
+ CPPUNIT_ASSERT(pRow2);
+ SwFrame* pRow3 = pRow2->GetNext();
+ CPPUNIT_ASSERT(pRow3);
+ auto pCell3 = dynamic_cast<SwCellFrame*>(pRow3->GetLower());
+ CPPUNIT_ASSERT(pCell3->GetFollowCell());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyDeletedAnchor)
+{
+ // Given a document with a floating table that spans over 3 pages:
+ createSwDoc("floattable-deleted-anchor.docx");
+
+ // When laying out that document:
+ calcLayout();
+
+ // Then make sure that there are 3 anchors for the 3 pages:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ SwFrame* pBody1 = pPage1->GetLower();
+ CPPUNIT_ASSERT(pBody1);
+ auto pAnchor1 = dynamic_cast<SwTextFrame*>(pBody1->GetLower()->GetNext());
+ CPPUNIT_ASSERT(pAnchor1);
+ SwTextFrame* pAnchor2 = pAnchor1->GetFollow();
+ CPPUNIT_ASSERT(pAnchor2);
+ SwTextFrame* pAnchor3 = pAnchor2->GetFollow();
+ // Without the accompanying fix in place, this test would have failed, the fly frame on the 3rd
+ // page was anchored to a text frame on the 2nd page, leading to a negative frame height.
+ CPPUNIT_ASSERT(pAnchor3);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyMultiCol)
+{
+ // Given a document with a floating table that is in a multi-col section:
+ createSwDoc("floattable-multi-col.docx");
+
+ // When laying out that document:
+ calcLayout();
+
+ // Then make sure that the fly frame is not split, matching Word:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage1Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage1Objs[0]);
+ CPPUNIT_ASSERT(pPage1Fly);
+ // Without the accompanying fix in place, this test would have failed, we tried to split and
+ // then hit an assertion failure.
+ CPPUNIT_ASSERT(!pPage1Fly->GetFollow());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyTabJoin)
+{
+ // Given a document with 3 pages and 2 tables: table on first and second page, 3rd page has no
+ // table:
+ createSwDoc("floattable-tab-join.docx");
+
+ // When laying out that document:
+ calcLayout();
+
+ // Then make sure that all pages have the expected amount of fly frames:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ CPPUNIT_ASSERT(pPage2);
+ const SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1
+ // - Actual : 2
+ // i.e. the 2nd page had 2 fly frames, hosting a split table, instead of joining that table and
+ // having 1 fly frame.
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage2Objs.size());
+ auto pPage3 = dynamic_cast<SwPageFrame*>(pPage2->GetNext());
+ CPPUNIT_ASSERT(pPage3);
+ CPPUNIT_ASSERT(!pPage3->GetSortedObjs());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyTabJoinLegacy)
+{
+ // Given a document with 3 pages and 2 tables: table on first and second page, 3rd page has no
+ // table (Word 2010 mode):
+ createSwDoc("floattable-tab-join-legacy.docx");
+
+ // When laying out that document:
+ calcLayout();
+
+ // Then make sure that all pages have the expected amount of fly frames:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ CPPUNIT_ASSERT(pPage2);
+ const SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1
+ // - Actual : 2
+ // i.e. the 2nd page had 2 fly frames, hosting a split table, instead of joining that table and
+ // having 1 fly frame (even after the non-legacy case was fixed already).
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage2Objs.size());
+ auto pPage3 = dynamic_cast<SwPageFrame*>(pPage2->GetNext());
+ CPPUNIT_ASSERT(pPage3);
+ CPPUNIT_ASSERT(!pPage3->GetSortedObjs());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyObjectFormatter)
+{
+ // Given a document with 3 pages and 2 tables: table on first and second page, 3rd page has no
+ // table:
+ createSwDoc("floattable-object-formatter.docx");
+
+ // When calculating the layout:
+ calcLayout();
+
+ // Then make sure we don't crash and also that all pages have the expected amount of fly frames:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ CPPUNIT_ASSERT(pPage2);
+ const SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage2Objs.size());
+ auto pPage3 = dynamic_cast<SwPageFrame*>(pPage2->GetNext());
+ CPPUNIT_ASSERT(pPage3);
+ CPPUNIT_ASSERT(!pPage3->GetSortedObjs());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyNextLeafInSection)
+{
+ // Given a document with 4 pages: page 1 had a floating table, page 2 & 3 had a second floating
+ // table and finally page 4 is empty:
+ createSwDoc("floattable-next-leaf-in-section.docx");
+
+ // When calculating the layout:
+ // Then this never returned, the loop in SwFrame::GetNextFlyLeaf() never finished.
+ calcLayout();
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyAnchorKeepWithNext)
+{
+ // Given a document with 2 pages, a split floating table on both pages:
+ createSwDoc("floattable-anchor-keep-with-next.docx");
+
+ // When calculating the layout:
+ calcLayout();
+
+ // Then make sure the pages have the expected amount of anchored objects:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ // Without the accompanying fix in place, this test would have failed, page 1 had no floating
+ // table, it was entirely on page 2.
+ CPPUNIT_ASSERT(pPage1->GetSortedObjs());
+ const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ CPPUNIT_ASSERT(pPage2);
+ CPPUNIT_ASSERT(pPage2->GetSortedObjs());
+ const SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage2Objs.size());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyNoFooterOverlap)
+{
+ // Given a document with 2 pages, a floating table on both pages:
+ createSwDoc("floattable-no-footer-overlap.doc");
+
+ // When calculating the layout:
+ calcLayout();
+
+ // Then make sure the second page has a floating table:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ CPPUNIT_ASSERT(pPage1->GetSortedObjs());
+ const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1
+ // - Actual : 2
+ // i.e. part of the second table was on page 1.
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage2 = dynamic_cast<SwPageFrame*>(pPage1->GetNext());
+ // Without the accompanying fix in place, this test would have failed, there was no page 2, both
+ // floating tables were on page 1.
+ CPPUNIT_ASSERT(pPage2);
+ CPPUNIT_ASSERT(pPage2->GetSortedObjs());
+ const SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage2Objs.size());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyGrowFromBottom)
+{
+ // Given a document with a floating table that grows from the bottom:
+ createSwDoc("floattable-from-bottom.docx");
+
+ // When calculating the layout:
+ calcLayout();
+
+ // Then make sure that such a floating table is not split, matching Word:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage1);
+ CPPUNIT_ASSERT(pPage1->GetSortedObjs());
+ const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ const auto pFly = dynamic_cast<SwFlyAtContentFrame*>(rPage1Objs[0]);
+ // Without the accompanying fix in place, this test would have failed, we tried to split the fly
+ // frame on page 1 even when it would fit, and this lead to a crash on export later.
+ CPPUNIT_ASSERT(!pFly->GetFollow());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyIntoTable)
+{
+ // Given a document with a floating table, then an inline table on the next page:
+ createSwDoc("floattable-then-table.doc");
+
+ // When inserting a page break:
+ // Then make sure the layout doesn't crash:
+ SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+ pWrtShell->InsertPageBreak();
+ // Without the accompanying fix in place, this test would have crashed, we tried to insert the
+ // second part of a floating table into a table on the next page, not before that table.
+ calcLayout();
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyFromAsCharAnchor)
+{
+ // Given a document with a footnote that has a table (imported in an as-char anchored frame in
+ // Writer):
+ createSwDoc("table-in-footnote.docx");
+
+ // When changing the anchor type of that frame to to-para:
+ // Then make sure we don't crash:
+ selectShape(1);
+ // Without the accompanying fix in place, this test would have crashed, we tried to split a
+ // frame+table inside a footnote.
+ dispatchCommand(mxComponent, ".uno:SetAnchorToPara", {});
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyNested)
+{
+ // Given a document with a nested, multi-page floating table:
+ // When calculating the layout:
+ createSwDoc("floattable-nested.odt");
+ calcLayout();
+
+ // Then make sure we don't crash:
+ // Without the accompanying fix in place, this test would have crashed.
+ // Check that we have exactly 4 fly frames, all of them on the expected pages: master outer,
+ // follow outer, master inner and follow inner.
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = pLayout->Lower()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage1);
+ CPPUNIT_ASSERT(pPage1->GetSortedObjs());
+ SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rPage1Objs.size());
+ auto pPage1Fly1 = rPage1Objs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+ CPPUNIT_ASSERT(pPage1Fly1);
+ CPPUNIT_ASSERT(pPage1Fly1->GetAnchorFrameContainingAnchPos()->IsInFly());
+ CPPUNIT_ASSERT(pPage1Fly1->GetFollow());
+ auto pPage1Fly2 = rPage1Objs[1]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+ CPPUNIT_ASSERT(pPage1Fly2);
+ CPPUNIT_ASSERT(!pPage1Fly2->GetAnchorFrameContainingAnchPos()->IsInFly());
+ CPPUNIT_ASSERT(pPage1Fly2->GetFollow());
+ auto pPage2 = pPage1->GetNext()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage2);
+ CPPUNIT_ASSERT(pPage2->GetSortedObjs());
+ SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rPage2Objs.size());
+ auto pPage2Fly1 = rPage2Objs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+ CPPUNIT_ASSERT(pPage2Fly1);
+ CPPUNIT_ASSERT(pPage2Fly1->GetAnchorFrameContainingAnchPos()->IsInFly());
+ CPPUNIT_ASSERT(pPage2Fly1->GetPrecede());
+
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected greater than: 6204
+ // - Actual : 1725
+ // i.e. the inner follow fly had a bad position, it was outside the page rectangle, it was not
+ // rendered and this way the inner anchor had no fly portion, either.
+ CPPUNIT_ASSERT_GREATER(pPage2->getFrameArea().Top(), pPage2Fly1->getFrameArea().Top());
+
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected less than: 12523
+ // - Actual : 15312
+ // i.e. the inner follow fly was not "moved back" to its place to have the wanted 4400 position,
+ // which makes the "Inner A2" text visible.
+ CPPUNIT_ASSERT_LESS(pPage2->getFrameArea().Right(), pPage2Fly1->getFrameArea().Right());
+
+ auto pPage2Fly2 = rPage2Objs[1]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+ CPPUNIT_ASSERT(pPage2Fly2);
+ CPPUNIT_ASSERT(!pPage2Fly2->GetAnchorFrameContainingAnchPos()->IsInFly());
+ CPPUNIT_ASSERT(pPage2Fly2->GetPrecede());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyNestedOverlap)
+{
+ // Given a document with a nested, multi-page floating table, enabling the "don't overlap" logic:
+ // When calculating the layout:
+ createSwDoc("floattable-nested-overlap.odt");
+ calcLayout();
+
+ // Then make sure we get 2 pages (2 flys on each page):
+ // Without the accompanying fix in place, this test would have failed with a layout loop.
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = pLayout->Lower()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage1);
+ CPPUNIT_ASSERT(pPage1->GetSortedObjs());
+ SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rPage1Objs.size());
+ auto pPage2 = pPage1->GetNext()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage2);
+ CPPUNIT_ASSERT(pPage2->GetSortedObjs());
+ SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rPage2Objs.size());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyMoveMaster)
+{
+ // Given a document with a multi-page floating table on pages 1 -> 2 -> 3:
+ createSwDoc("floattable-move-master.docx");
+
+ // When adding an empty para at the start of the anchor text of the table:
+ SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+ pWrtShell->SttEndDoc(/*bStt=*/true);
+ pWrtShell->Down(/*bSelect=*/false, /*nCount=*/4);
+ pWrtShell->SplitNode();
+
+ // Then make sure page the fly chain is pages 1 -> 2 -> 3, still:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = pLayout->Lower()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage1);
+ // Without the accompanying fix in place, this test would have failed, the fly chain was pages 1
+ // -> 4 -> 2.
+ CPPUNIT_ASSERT(pPage1->GetSortedObjs());
+ CPPUNIT_ASSERT(pPage1->GetSortedObjs());
+ SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+ auto pPage1Fly = rPage1Objs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+ CPPUNIT_ASSERT(pPage1Fly);
+ CPPUNIT_ASSERT(!pPage1Fly->GetPrecede());
+ CPPUNIT_ASSERT(pPage1Fly->HasFollow());
+ auto pPage2 = pPage1->GetNext()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage2);
+ CPPUNIT_ASSERT(pPage2->GetSortedObjs());
+ SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage2Objs.size());
+ auto pPage2Fly = rPage2Objs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+ CPPUNIT_ASSERT(pPage2Fly);
+ CPPUNIT_ASSERT(pPage2Fly->GetPrecede());
+ CPPUNIT_ASSERT(pPage2Fly->HasFollow());
+ auto pPage3 = pPage2->GetNext()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage3);
+ CPPUNIT_ASSERT(pPage3->GetSortedObjs());
+ SwSortedObjs& rPage3Objs = *pPage3->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage3Objs.size());
+ auto pPage3Fly = rPage3Objs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+ CPPUNIT_ASSERT(pPage3Fly);
+ CPPUNIT_ASSERT(pPage3Fly->GetPrecede());
+ CPPUNIT_ASSERT(!pPage3Fly->GetFollow());
+ auto pPage4 = pPage3->GetNext()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage4);
+ CPPUNIT_ASSERT(!pPage4->GetSortedObjs());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyDelEmpty)
+{
+ // Given a document with multiple floating tables and 7 pages:
+ // When loading that document:
+ // Without the accompanying fix in place, this test would have crashed due to a
+ // heap-use-after-free problem (visible with e.g. MALLOC_PERTURB_=153).
+ createSwDoc("floattable-del-empty.docx");
+
+ // Then make sure that the page count matches Word:
+ CPPUNIT_ASSERT_EQUAL(7, getPages());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyInTableInSection)
+{
+ // Given a document where page 2 and page 3 has a floating table inside an inline table, inside
+ // a section:
+ // Without the accompanying fix in place, this test would have crashed, we created a follow
+ // anchor which was marked as "in table", but had no table parent.
+ createSwDoc("floattable-in-inltbl-in-sect.docx");
+
+ // Then make sure that the floating table is on page 2 and page 3:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = pLayout->Lower()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage1);
+ CPPUNIT_ASSERT(!pPage1->GetSortedObjs());
+ auto pPage2 = pPage1->GetNext()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage2);
+ CPPUNIT_ASSERT(pPage2->GetSortedObjs());
+ SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage2Objs.size());
+ auto pPage3 = pPage2->GetNext()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage3);
+ CPPUNIT_ASSERT(pPage3->GetSortedObjs());
+ SwSortedObjs& rPage3Objs = *pPage3->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage3Objs.size());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyWrapOnAllPages)
+{
+ // Given a document where we want to wrap on all pages, around a split floating table:
+ createSwDoc("floattable-wrap-on-all-pages.docx");
+ SwDoc* pDoc = getSwDoc();
+ pDoc->getIDocumentSettingAccess().set(DocumentSettingId::ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK,
+ true);
+
+ // When formatting that document:
+ SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+ pWrtShell->Reformat();
+
+ // Then make sure that the anchor text is also split between page 1 and page 2:
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = pLayout->Lower()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage1);
+ auto pPage1Anchor = pPage1->FindLastBodyContent()->DynCastTextFrame();
+ CPPUNIT_ASSERT(pPage1Anchor);
+ OUString aAnchor1Text(pPage1Anchor->GetText().subView(
+ static_cast<sal_Int32>(pPage1Anchor->GetOffset()),
+ static_cast<sal_Int32>(pPage1Anchor->GetFollow()->GetOffset()
+ - pPage1Anchor->GetOffset())));
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: He heard quiet steps behind him. That
+ // - Actual :
+ // i.e. the first page had no anchor text, only the second.
+ CPPUNIT_ASSERT_EQUAL(OUString("He heard quiet steps behind him. That "), aAnchor1Text);
+ auto pPage2 = pPage1->GetNext()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage2);
+ auto pPage2Anchor = pPage2->FindLastBodyContent()->DynCastTextFrame();
+ CPPUNIT_ASSERT(pPage2Anchor);
+ OUString aAnchor2Text(
+ pPage2Anchor->GetText().subView(static_cast<sal_Int32>(pPage2Anchor->GetOffset())));
+ CPPUNIT_ASSERT(!pPage2Anchor->GetFollow());
+ CPPUNIT_ASSERT_EQUAL(OUString("didn't bode well."), aAnchor2Text);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyPerFrameWrapOnAllPages)
+{
+ // Given a document where we want to wrap on all pages, around a split floating table:
+ createSwDoc("floattable-wrap-on-all-pages.docx");
+ SwDoc* pDoc = getSwDoc();
+ sw::SpzFrameFormats& rFlys = *pDoc->GetSpzFrameFormats();
+ sw::SpzFrameFormat* pFly = rFlys[0];
+ SfxItemSet aSet(pFly->GetAttrSet());
+ SwFormatWrapTextAtFlyStart aItem(true);
+ aSet.Put(aItem);
+ pDoc->SetFlyFrameAttr(*pFly, aSet);
+
+ // When formatting that document:
+ SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+ pWrtShell->Reformat();
+
+ // Then make sure that the anchor text is also split between page 1 and page 2:
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = pLayout->Lower()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage1);
+ auto pPage1Anchor = pPage1->FindLastBodyContent()->DynCastTextFrame();
+ CPPUNIT_ASSERT(pPage1Anchor);
+ OUString aAnchor1Text(pPage1Anchor->GetText().subView(
+ static_cast<sal_Int32>(pPage1Anchor->GetOffset()),
+ static_cast<sal_Int32>(pPage1Anchor->GetFollow()->GetOffset()
+ - pPage1Anchor->GetOffset())));
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: He heard quiet steps behind him. That
+ // - Actual :
+ // i.e. the first page had no anchor text, only the second.
+ CPPUNIT_ASSERT_EQUAL(OUString("He heard quiet steps behind him. That "), aAnchor1Text);
+ auto pPage2 = pPage1->GetNext()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage2);
+ auto pPage2Anchor = pPage2->FindLastBodyContent()->DynCastTextFrame();
+ CPPUNIT_ASSERT(pPage2Anchor);
+ OUString aAnchor2Text(
+ pPage2Anchor->GetText().subView(static_cast<sal_Int32>(pPage2Anchor->GetOffset())));
+ CPPUNIT_ASSERT(!pPage2Anchor->GetFollow());
+ CPPUNIT_ASSERT_EQUAL(OUString("didn't bode well."), aAnchor2Text);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/layout/frmtool.cxx b/sw/qa/core/layout/frmtool.cxx
new file mode 100644
index 0000000000..2ee4c3a07d
--- /dev/null
+++ b/sw/qa/core/layout/frmtool.cxx
@@ -0,0 +1,40 @@
+/* -*- 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 <IDocumentLayoutAccess.hxx>
+#include <pagefrm.hxx>
+#include <rootfrm.hxx>
+
+namespace
+{
+/// Covers sw/source/core/layout/frmtool.cxx fixes.
+class Test : public SwModelTestBase
+{
+public:
+ Test()
+ : SwModelTestBase("/sw/qa/core/layout/data/")
+ {
+ }
+};
+
+CPPUNIT_TEST_FIXTURE(Test, testFloattableNoMargins)
+{
+ createSwDoc("floattable-nomargins.docx");
+
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = pLayout->Lower()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage1);
+ CPPUNIT_ASSERT(!pPage1->GetNext());
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/layout/ftnfrm.cxx b/sw/qa/core/layout/ftnfrm.cxx
new file mode 100644
index 0000000000..4c874202da
--- /dev/null
+++ b/sw/qa/core/layout/ftnfrm.cxx
@@ -0,0 +1,66 @@
+/* -*- 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 <IDocumentLayoutAccess.hxx>
+#include <docsh.hxx>
+#include <formatflysplit.hxx>
+#include <frmmgr.hxx>
+#include <pagefrm.hxx>
+#include <rootfrm.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+
+/// Covers sw/source/core/layout/ftnfrm.cxx fixes.
+class Test : public SwModelTestBase
+{
+public:
+ Test()
+ : SwModelTestBase("/sw/qa/core/layout/data/")
+ {
+ }
+};
+
+CPPUNIT_TEST_FIXTURE(Test, testFlySplitFootnoteLayout)
+{
+ // Given a document with a split fly (to host a table):
+ createSwDoc();
+ SwDoc* pDoc = getSwDoc();
+ SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+ SwFlyFrameAttrMgr aMgr(true, pWrtShell, Frmmgr_Type::TEXT, nullptr);
+ RndStdIds eAnchor = RndStdIds::FLY_AT_PARA;
+ pWrtShell->StartAllAction();
+ aMgr.InsertFlyFrame(eAnchor, aMgr.GetPos(), aMgr.GetSize());
+ pWrtShell->EndAllAction();
+ pWrtShell->StartAllAction();
+ sw::FrameFormats<sw::SpzFrameFormat*>& rFlys = *pDoc->GetSpzFrameFormats();
+ sw::SpzFrameFormat* pFly = rFlys[0];
+ SwAttrSet aSet(pFly->GetAttrSet());
+ aSet.Put(SwFormatFlySplit(true));
+ pDoc->SetAttr(aSet, *pFly);
+ pWrtShell->EndAllAction();
+ pWrtShell->UnSelectFrame();
+ pWrtShell->LeaveSelFrameMode();
+ pWrtShell->GetView().AttrChangedNotify(nullptr);
+ pWrtShell->MoveSection(GoCurrSection, fnSectionEnd);
+
+ // When inserting a footnote:
+ pWrtShell->InsertFootnote(OUString());
+
+ // Then make sure the footnote frame and its container is created:
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+ CPPUNIT_ASSERT(pPage);
+ // Without the accompanying fix in place, this test would have failed, the footnote frame was
+ // not created, the footnote reference was empty.
+ CPPUNIT_ASSERT(pPage->FindFootnoteCont());
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/layout/layact.cxx b/sw/qa/core/layout/layact.cxx
new file mode 100644
index 0000000000..d432ae52b7
--- /dev/null
+++ b/sw/qa/core/layout/layact.cxx
@@ -0,0 +1,91 @@
+/* -*- 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 <vcl/scheduler.hxx>
+
+#include <IDocumentLayoutAccess.hxx>
+#include <anchoredobject.hxx>
+#include <docsh.hxx>
+#include <flyfrm.hxx>
+#include <pagefrm.hxx>
+#include <rootfrm.hxx>
+#include <rowfrm.hxx>
+#include <sortedobjs.hxx>
+#include <tabfrm.hxx>
+#include <wrtsh.hxx>
+
+namespace
+{
+/// Covers sw/source/core/layout/layact.cxx fixes.
+class Test : public SwModelTestBase
+{
+public:
+ Test()
+ : SwModelTestBase("/sw/qa/core/layout/data/")
+ {
+ }
+};
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyNextRowInvalidatePos)
+{
+ // Given a multi-page floating table, row1 is split, i.e. is both on page 1 and page 2:
+ createSwDoc("floattable-next-row-invalidate-pos.docx");
+ // Make sure the follow anchor's IsCompletePaint() reaches its false state, as it happens in the
+ // interactive case.
+ Scheduler::ProcessEventsToIdle();
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = pLayout->Lower()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage1);
+ auto pPage2 = pPage1->GetNext()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage2);
+ CPPUNIT_ASSERT(pPage2->GetSortedObjs());
+ SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+ auto pFly2 = rPage2Objs[0]->DynCastFlyFrame();
+ auto pTable2 = pFly2->GetLower()->DynCastTabFrame();
+ auto pRow2 = pTable2->GetLastLower()->DynCastRowFrame();
+ SwTwips nOldRow2Top = pRow2->getFrameArea().Top();
+
+ // When adding a new paragraph at the end of B1:
+ // Go to the table: A1 cell.
+ SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+ pWrtShell->GotoTable("Table1");
+ // Go to the column: B1 cell.
+ pWrtShell->GoNextCell();
+ // Go to the end of the B1 cell, on page 2.
+ pWrtShell->EndOfSection();
+ // Add a new paragraph at the cell end.
+ pWrtShell->SplitNode();
+
+ // Then make sure row 2 is shifted down:
+ SwTwips nNewRow2Top = pRow2->getFrameArea().Top();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected greater than: 7121
+ // - Actual : 7121
+ // i.e. row 2 has to be shifted down to 7390, but this didn't happen.
+ CPPUNIT_ASSERT_GREATER(nOldRow2Top, nNewRow2Top);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf157096)
+{
+ createSwDoc("tdf157096.docx");
+
+ CPPUNIT_ASSERT_EQUAL(2, getPages());
+ dispatchCommand(mxComponent, ".uno:SelectAll", {});
+
+ // Without the fix in place, it would have crashed here
+ dispatchCommand(mxComponent, ".uno:Delete", {});
+
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
new file mode 100644
index 0000000000..5971e87030
--- /dev/null
+++ b/sw/qa/core/layout/layout.cxx
@@ -0,0 +1,1052 @@
+/* -*- 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 <com/sun/star/style/PageStyleLayout.hpp>
+
+#include <vcl/gdimtf.hxx>
+#include <svx/svdpage.hxx>
+#include <o3tl/string_view.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <editeng/frmdiritem.hxx>
+
+#include <wrtsh.hxx>
+#include <docsh.hxx>
+#include <unotxdoc.hxx>
+#include <drawdoc.hxx>
+#include <IDocumentDrawModelAccess.hxx>
+#include <IDocumentState.hxx>
+#include <IDocumentLayoutAccess.hxx>
+#include <rootfrm.hxx>
+#include <itabenum.hxx>
+#include <fmtanchr.hxx>
+#include <fmtsrnd.hxx>
+#include <IDocumentSettingAccess.hxx>
+#include <fmtfsize.hxx>
+#include <fmtfollowtextflow.hxx>
+#include <view.hxx>
+#include <cmdid.h>
+#include <node.hxx>
+#include <ndtxt.hxx>
+#include <tabfrm.hxx>
+#include <cntfrm.hxx>
+
+/// Covers sw/source/core/layout/ fixes.
+class SwCoreLayoutTest : public SwModelTestBase
+{
+public:
+ SwCoreLayoutTest()
+ : SwModelTestBase("/sw/qa/core/layout/data/")
+ {
+ }
+};
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTableFlyOverlap)
+{
+ // Load a document that has an image anchored in the header.
+ // It also has a table which has the wrap around the image.
+ createSwDoc("table-fly-overlap.docx");
+ SwTwips nFlyTop
+ = parseDump("//header/txt/anchored/fly/infos/bounds"_ostr, "top"_ostr).toInt32();
+ SwTwips nFlyHeight
+ = parseDump("//header/txt/anchored/fly/infos/bounds"_ostr, "height"_ostr).toInt32();
+ SwTwips nFlyBottom = nFlyTop + nFlyHeight;
+ SwTwips nTableFrameTop = parseDump("//tab/infos/bounds"_ostr, "top"_ostr).toInt32();
+ SwTwips nTablePrintTop = parseDump("//tab/infos/prtBounds"_ostr, "top"_ostr).toInt32();
+ SwTwips nTableTop = nTableFrameTop + nTablePrintTop;
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected greater or equal than: 3579
+ // - Actual : 2210
+ // i.e. the table's top border overlapped with the image, even if the image's wrap mode was set
+ // to parallel.
+ CPPUNIT_ASSERT_GREATEREQUAL(nFlyBottom, nTableTop);
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTdf128195)
+{
+ // Load a document that has two paragraphs in the header.
+ // The second paragraph should have its bottom spacing applied.
+ createSwDoc("tdf128195.docx");
+ sal_Int32 nTxtHeight = parseDump("//header/txt[2]/infos/bounds"_ostr, "height"_ostr).toInt32();
+ sal_Int32 nTxtBottom = parseDump("//header/txt[2]/infos/bounds"_ostr, "bottom"_ostr).toInt32();
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2269), nTxtHeight);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3529), nTxtBottom);
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBIRT)
+{
+ // this looped
+ createSwDoc("birt_min.odt");
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBorderCollapseCompat)
+{
+ // Load a document with a border conflict: top cell has a dotted bottom border, bottom cell has
+ // a solid upper border.
+ createSwDoc("border-collapse-compat.docx");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ SwDocShell* pShell = pTextDoc->GetDocShell();
+ std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+ MetafileXmlDump aDumper;
+ xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
+
+ // Make sure the solid border has priority.
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1
+ // - Actual : 48
+ // i.e. there was no single cell border with width=20, rather there were 48 border parts
+ // (forming a dotted border), all with width=40.
+ assertXPath(pXmlDoc, "//polyline[@style='solid']"_ostr, "width"_ostr, "20");
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrTableRowSpan)
+{
+ // Load a document which has a table. The A1 cell has btlr text direction, and the A1..A3 cells
+ // are merged.
+ createSwDoc("btlr-table-row-span.odt");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ SwDocShell* pShell = pTextDoc->GetDocShell();
+ std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+ MetafileXmlDump aDumper;
+ xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
+
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: USA
+ // - Actual : West
+ // i.e. the "USA" text completely disappeared.
+ assertXPathContent(pXmlDoc, "//textarray[1]/text"_ostr, "USA");
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTableFlyOverlapSpacing)
+{
+ // Load a document that has an image on the right of a table. The table wraps around the image.
+ createSwDoc("table-fly-overlap-spacing.docx");
+ SwTwips nFlyTop = parseDump("//body/txt/anchored/fly/infos/bounds"_ostr, "top"_ostr).toInt32();
+ SwTwips nFlyHeight
+ = parseDump("//body/txt/anchored/fly/infos/bounds"_ostr, "height"_ostr).toInt32();
+ SwTwips nFlyBottom = nFlyTop + nFlyHeight;
+ SwTwips nTableFrameTop = parseDump("//tab/infos/bounds"_ostr, "top"_ostr).toInt32();
+ SwTwips nTablePrintTop = parseDump("//tab/infos/prtBounds"_ostr, "top"_ostr).toInt32();
+ SwTwips nTableTop = nTableFrameTop + nTablePrintTop;
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected greater or equal than: 3993
+ // - Actual : 3993
+ // i.e. the table was below the image, not on the left of the image.
+ CPPUNIT_ASSERT_LESS(nFlyBottom, nTableTop);
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTablesMoveBackwards)
+{
+ // Load a document with 1 pages: empty content on first page, then 21 tables on the second page.
+ createSwDoc("tables-move-backwards.odt");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ SwDocShell* pDocShell = pTextDoc->GetDocShell();
+ SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
+
+ // Delete the content on the first page.
+ pWrtShell->SttEndDoc(/*bStart=*/true);
+ pWrtShell->EndPg(/*bSelect=*/true);
+ pWrtShell->DelLeft();
+
+ // Calc the layout and check the number of pages.
+ pWrtShell->CalcLayout();
+ xmlDocUniquePtr pLayout = parseLayoutDump();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1
+ // - Actual : 2
+ // i.e. there was an unexpected 2nd page, as only 20 out of 21 tables were moved to the first
+ // page.
+ assertXPath(pLayout, "//page"_ostr, 1);
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testContinuousEndnotesMoveBackwards)
+{
+ // Load a document with the ContinuousEndnotes flag turned on.
+ createSwDoc("continuous-endnotes-move-backwards.doc");
+ xmlDocUniquePtr pLayout = parseLayoutDump();
+ // We have 2 pages.
+ assertXPath(pLayout, "/root/page"_ostr, 2);
+ // No endnote container on page 1.
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 0
+ // - Actual : 1
+ // i.e. there were unexpected endnotes on page 1.
+ assertXPath(pLayout, "/root/page[1]/ftncont"_ostr, 0);
+ // All endnotes are in a container on page 2.
+ assertXPath(pLayout, "/root/page[2]/ftncont"_ostr, 1);
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testAnchorPositionBasedOnParagraph)
+{
+ // tdf#134783 check whether position of shape is good if it is anchored to paragraph and
+ // the "Don't add space between paragraphs of the same style" option is set
+ createSwDoc("tdf134783_testAnchorPositionBasedOnParagraph.fodt");
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+ CPPUNIT_ASSERT(pXmlDoc);
+ assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[1]/bounds"_ostr, "top"_ostr, "1671");
+ assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[1]/bounds"_ostr, "bottom"_ostr, "1732");
+ assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[2]/bounds"_ostr, "top"_ostr, "1947");
+ assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[2]/bounds"_ostr, "bottom"_ostr, "2008");
+ assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[3]/bounds"_ostr, "top"_ostr, "3783");
+ assertXPath(pXmlDoc, "(//anchored/SwAnchoredDrawObject)[3]/bounds"_ostr, "bottom"_ostr, "3844");
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxStaysInsideShape)
+{
+ // tdf#135198: check whether text box stays inside shape after moving it upwards
+ createSwDoc("shape-textbox.odt");
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: 1932
+ // - Actual : 7476
+ assertXPath(pXmlDoc, "//anchored/fly/infos/bounds"_ostr, "top"_ostr, "1932");
+ assertXPath(pXmlDoc, "//anchored/fly/infos/bounds"_ostr, "bottom"_ostr, "7184");
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxNotModifiedOnOpen)
+{
+ // tdf#138050: a freshly opened document containing a shape with a text box
+ // should not appear to be modified
+ createSwDoc("textbox-phantom-change.docx");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+
+ // Without the fix in place this test would have shown that the document
+ // was modified due to a fix to tdf#135198
+ CPPUNIT_ASSERT(!pDoc->getIDocumentState().IsModified());
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxAutoGrowVertical)
+{
+ createSwDoc("textbox-autogrow-vertical.docx");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+ SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+ SdrObject* pShape = pPage->GetObj(0);
+ tools::Rectangle aShapeRect = pShape->GetCurrentBoundRect();
+
+ discardDumpedLayout();
+ xmlDocUniquePtr pLayout = parseLayoutDump();
+ CPPUNIT_ASSERT(pLayout);
+ sal_Int32 nFlyLeft
+ = getXPath(pLayout, "//anchored/fly/infos/bounds"_ostr, "left"_ostr).toInt32();
+ sal_Int32 nFlyTop = getXPath(pLayout, "//anchored/fly/infos/bounds"_ostr, "top"_ostr).toInt32();
+ sal_Int32 nFlyRight
+ = getXPath(pLayout, "//anchored/fly/infos/bounds"_ostr, "right"_ostr).toInt32();
+ sal_Int32 nFlyBottom
+ = getXPath(pLayout, "//anchored/fly/infos/bounds"_ostr, "bottom"_ostr).toInt32();
+ tools::Rectangle aFlyRect(nFlyLeft, nFlyTop, nFlyRight, nFlyBottom);
+ // Without the accompanying fix in place, this test would have failed, as aFlyRect was too wide,
+ // so it was not inside aShapeRect anymore.
+ CPPUNIT_ASSERT(aShapeRect.Contains(aFlyRect));
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextboxModification)
+{
+ // Load a document with a textbox in it: the layout will have to position the shape part.
+ createSwDoc("textbox-modification.docx");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ SwDocShell* pDocShell = pTextDoc->GetDocShell();
+
+ // Without the accompanying fix in place, this test would have failed, as the document was
+ // marked as modified right after the import.
+ CPPUNIT_ASSERT(!pDocShell->IsModified());
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxInHeaderIsPositioned)
+{
+ // Load a document with a floating text box in the header
+ createSwDoc("header-textbox.docx");
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: 8051
+ // - Actual : 1418
+ // Comparison with 7000 chosen due to variability between devices
+ CPPUNIT_ASSERT_GREATEREQUAL(
+ double(7000),
+ getXPath(pXmlDoc, "//anchored/fly/infos/bounds"_ostr, "left"_ostr).toDouble());
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrNestedCell)
+{
+ // Load a document with a nested table, the inner A1 cell has a btlr text direction.
+ createSwDoc("btlr-nested-cell.odt");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ SwFrame* pPage = pLayout->GetLower();
+ SwFrame* pBody = pPage->GetLower();
+ SwFrame* pOuterTable = pBody->GetLower()->GetNext();
+ SwFrame* pInnerTable = pOuterTable->GetLower()->GetLower()->GetLower();
+
+ // Check the paint area of the only text frame in the cell.
+ SwFrame* pTextFrame = pInnerTable->GetLower()->GetLower()->GetLower();
+ tools::Long nFrameBottom = pTextFrame->getFrameArea().Bottom();
+ SwRect aPaintArea = pTextFrame->GetPaintArea();
+
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected greater or equal than: 2829
+ // - Actual : 2080
+ // i.e. part of the text frame area was not painted, hiding the actual text.
+ CPPUNIT_ASSERT_GREATEREQUAL(nFrameBottom, aPaintArea.Bottom());
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testKeepwithnextFullheight)
+{
+ // The document has a heading (keep with next) and a full-page image in the next paragraph, i.e.
+ // conflicting requirements.
+ // Without the accompanying fix in place, this test would have failed with a layout loop in
+ // SwEditShell::CalcLayout().
+ createSwDoc("keepwithnext-fullheight.fodt");
+
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+ CPPUNIT_ASSERT(pXmlDoc);
+ // Make sure the document has 2 pages.
+ assertXPath(pXmlDoc, "//page"_ostr, 2);
+ // Heading stays on page 1 to avoid a layout loop.
+ assertXPathContent(pXmlDoc, "//page[1]/body/txt[2]"_ostr, "Heading");
+ // Image stays on page 2.
+ assertXPath(pXmlDoc, "//page[2]/body/txt/anchored/fly"_ostr, 1);
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterMargin)
+{
+ // Create a document, remember the old left edge of the page print area (the rectangle that is
+ // inside margins).
+ createSwDoc();
+ SwDoc* pDoc = getSwDoc();
+ uno::Reference<beans::XPropertySet> xStandard(getStyles("PageStyles")->getByName("Standard"),
+ uno::UNO_QUERY);
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ SwFrame* pPage = pLayout->GetLower();
+ tools::Long nOldLeft = pPage->getFramePrintArea().Left();
+
+ // Set the gutter margin to 2cm.
+ sal_Int32 nGutterMm100 = 2000;
+ xStandard->setPropertyValue("GutterMargin", uno::Any(nGutterMm100));
+
+ // Verify that the new left edge is larger.
+ tools::Long nNewLeft = pPage->getFramePrintArea().Left();
+ tools::Long nGutterTwips = o3tl::toTwips(nGutterMm100, o3tl::Length::mm100);
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1134
+ // - Actual : 0
+ // i.e. the gutter was not added to the left margin.
+ CPPUNIT_ASSERT_EQUAL(nGutterTwips, nNewLeft - nOldLeft);
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterTopMargin)
+{
+ // Create a document, remember the old top edge of the page print area (the rectangle that is
+ // inside margins).
+ createSwDoc();
+ SwDoc* pDoc = getSwDoc();
+ uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xSettings(
+ xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY);
+ xSettings->setPropertyValue("GutterAtTop", uno::Any(true));
+ uno::Reference<beans::XPropertySet> xStandard(getStyles("PageStyles")->getByName("Standard"),
+ uno::UNO_QUERY);
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ SwFrame* pPage = pLayout->GetLower();
+ tools::Long nOldTop = pPage->getFramePrintArea().Top();
+
+ // Set the gutter margin to 2cm.
+ sal_Int32 nGutterMm100 = 2000;
+ xStandard->setPropertyValue("GutterMargin", uno::Any(nGutterMm100));
+
+ // Verify that the new top edge is larger.
+ tools::Long nNewTop = pPage->getFramePrintArea().Top();
+ tools::Long nGutterTwips = o3tl::toTwips(nGutterMm100, o3tl::Length::mm100);
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1134
+ // - Actual : 0
+ // i.e. the gutter was not added to the left margin.
+ CPPUNIT_ASSERT_EQUAL(nGutterTwips, nNewTop - nOldTop);
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterMirrorMargin)
+{
+ createSwDoc();
+ SwDoc* pDoc = getSwDoc();
+ SwDocShell* pDocShell = pDoc->GetDocShell();
+ SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
+ pWrtShell->InsertPageBreak();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ SwFrame* pPage = pLayout->GetLower();
+ tools::Long nOldLeft = pPage->getFramePrintArea().Left();
+ SwFrame* pPage2 = pPage->GetNext();
+ tools::Long nOldRight = pPage2->getFramePrintArea().Right();
+
+ uno::Reference<beans::XPropertySet> xStandard(getStyles("PageStyles")->getByName("Standard"),
+ uno::UNO_QUERY);
+ xStandard->setPropertyValue("PageStyleLayout", uno::Any(style::PageStyleLayout_MIRRORED));
+ sal_Int32 nGutterMm100 = 2000;
+ xStandard->setPropertyValue("GutterMargin", uno::Any(nGutterMm100));
+
+ tools::Long nNewLeft = pPage->getFramePrintArea().Left();
+ tools::Long nGutterTwips = o3tl::toTwips(nGutterMm100, o3tl::Length::mm100);
+ CPPUNIT_ASSERT_EQUAL(nGutterTwips, nNewLeft - nOldLeft);
+ tools::Long nNewRight = pPage2->getFramePrintArea().Right();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1134
+ // - Actual : 0
+ // i.e. the gutter was missing on the second, mirrored page.
+ CPPUNIT_ASSERT_EQUAL(nGutterTwips, nOldRight - nNewRight);
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testRtlGutterMargin)
+{
+ // Given a document with a right margin:
+ createSwDoc();
+ SwDoc* pDoc = getSwDoc();
+ uno::Reference<beans::XPropertySet> xStandard(getStyles("PageStyles")->getByName("Standard"),
+ uno::UNO_QUERY);
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ SwFrame* pPage = pLayout->GetLower();
+ tools::Long nOldRight = pPage->getFramePrintArea().Right();
+
+ // When setting enable RTL gutter mode and setting a gutter margin:
+ xStandard->setPropertyValue("RtlGutter", uno::Any(true));
+ sal_Int32 nGutterMm100 = 2000;
+ xStandard->setPropertyValue("GutterMargin", uno::Any(nGutterMm100));
+
+ // Then make sure the new right edge of the print area is decreased:
+ tools::Long nNewRight = pPage->getFramePrintArea().Right();
+ tools::Long nGutterTwips = o3tl::toTwips(nGutterMm100, o3tl::Length::mm100);
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1134
+ // - Actual : 0
+ // i.e. the gutter was missing on the right side.
+ CPPUNIT_ASSERT_EQUAL(nGutterTwips, nOldRight - nNewRight);
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testGutterMarginPageBorder)
+{
+// FIXME this is 3369 on macOS -- calculate this number dynamically?
+// FIXME this is random on Windows at the moment (in two subsequent tests without any scaling,
+// the actual values were 6346, 10066) - something broke metafile generation on Windows?
+#if !defined(MACOSX) && !defined(_WIN32)
+ // Given a document with a non-0 gutter margin.
+ createSwDoc();
+ SwDoc* pDoc = getSwDoc();
+ uno::Reference<beans::XPropertySet> xStandard(getStyles("PageStyles")->getByName("Standard"),
+ uno::UNO_QUERY);
+ sal_Int32 nGutterMm100 = 2000;
+ xStandard->setPropertyValue("GutterMargin", uno::Any(nGutterMm100));
+
+ // When setting a left border.
+ table::BorderLine2 aBorder;
+ aBorder.LineWidth = 2;
+ aBorder.OuterLineWidth = 2;
+ xStandard->setPropertyValue("LeftBorder", uno::Any(aBorder));
+
+ // Then make sure border is at the left edge of the text area.
+ SwDocShell* pShell = pDoc->GetDocShell();
+ std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+ MetafileXmlDump dumper;
+ xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 2565
+ // - Actual : 1425
+ // Where 2565 is close to the left edge of the text area (2553).
+ assertXPath(pXmlDoc, "//polyline[@style='solid']/point[1]"_ostr, "x"_ostr, "2565");
+#endif
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTdf45908_invoice)
+{
+ // without the fix, this was hanging (and slowly consuming memory) on fileopen.
+ createSwDoc("tdf45908_invoice.odt");
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testVerticallyMergedCellBorder)
+{
+ // Given a document with a table: 2 columns, 5 rows. B2 -> B5 is merged:
+ createSwDoc("vmerge-cell-border.docx");
+ SwDoc* pDoc = getSwDoc();
+ SwDocShell* pShell = pDoc->GetDocShell();
+
+ // When rendering the table:
+ std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+
+ // Make sure that B4->B5 has no borders.
+ MetafileXmlDump dumper;
+ xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+ // Collect vertical positions of all border points.
+ xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"_ostr);
+ xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+ std::vector<sal_Int32> aBorderPositions;
+ for (int i = 0; i < xmlXPathNodeSetGetLength(pXmlNodes); ++i)
+ {
+ xmlNodePtr pXmlNode = pXmlNodes->nodeTab[i];
+ xmlChar* pValue = xmlGetProp(pXmlNode, BAD_CAST("y"));
+ sal_Int32 nValue = o3tl::toInt32(reinterpret_cast<char const*>(pValue));
+ aBorderPositions.push_back(nValue);
+ }
+ xmlXPathFreeObject(pXmlObj);
+ // Collect top and bottom of the B1->B3 rows.
+ xmlDocUniquePtr pLayout = parseLayoutDump();
+ pXmlObj = getXPathNode(pLayout, "//tab/row/infos/bounds"_ostr);
+ pXmlNodes = pXmlObj->nodesetval;
+ std::vector<sal_Int32> aLayoutPositions;
+ for (int i = 0; i < 3; ++i)
+ {
+ xmlNodePtr pXmlNode = pXmlNodes->nodeTab[i];
+ if (i == 0)
+ {
+ xmlChar* pValue = xmlGetProp(pXmlNode, BAD_CAST("top"));
+ sal_Int32 nValue = o3tl::toInt32(reinterpret_cast<char const*>(pValue));
+ aLayoutPositions.push_back(nValue);
+ }
+ xmlChar* pValue = xmlGetProp(pXmlNode, BAD_CAST("bottom"));
+ sal_Int32 nValue = o3tl::toInt32(reinterpret_cast<char const*>(pValue));
+ aLayoutPositions.push_back(nValue);
+ }
+ xmlXPathFreeObject(pXmlObj);
+ // Check if any border is outside the B1->B3 range.
+ for (const auto nBorderPosition : aBorderPositions)
+ {
+ bool bFound = false;
+ for (const auto nLayoutPosition : aLayoutPositions)
+ {
+ if (std::abs(nBorderPosition - nLayoutPosition) <= 30)
+ {
+ bFound = true;
+ break;
+ }
+ }
+ std::stringstream ss;
+ ss << "Bad vertical position for border point: " << nBorderPosition;
+ ss << " Expected positions: ";
+ for (size_t i = 0; i < aLayoutPositions.size(); ++i)
+ {
+ if (i > 0)
+ {
+ ss << ", ";
+ }
+ ss << aLayoutPositions[i];
+ }
+
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Bad vertical position for border point: 5624 Expected positions: 3022, 3540, 4059, 4578
+ // i.e. the middle vertical border end was the bottom of B5, not bottom of B3.
+ CPPUNIT_ASSERT_MESSAGE(ss.str(), bFound);
+ }
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testCrashRemoveFromLayout)
+{
+ createSwDoc("tdf122894-4.doc");
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testLinkedBullet)
+{
+ // Given a document with a graphic bullet, where the image is a linked one:
+ createSwDoc("linked-bullet.odt");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ SwDocShell* pShell = pTextDoc->GetDocShell();
+
+ // When rendering that document:
+ std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+
+ // Then make sure the render result contains exactly one bitmap:
+ MetafileXmlDump aDumper;
+ xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1
+ // - Actual : 0
+ // i.e. the bullet's bitmap was lost.
+ assertXPath(pXmlDoc, "//bmpexscale"_ostr, 1);
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testInnerCellBorderIntersect)
+{
+ // Given a table with both outer and inner borders:
+ createSwDoc("inner-border.docx");
+ SwDoc* pDoc = getSwDoc();
+ SwDocShell* pShell = pDoc->GetDocShell();
+
+ // When rendering table borders:
+ std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+
+ // Then make sure that inner and outer borders don't overlap in Word compatibility mode,
+ // and inner borders are reduced to prevent an overlap:
+ MetafileXmlDump dumper;
+ xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+ // Collect start/end (vertical) positions of horizontal borders.
+ xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"_ostr);
+ xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+ std::vector<std::pair<sal_Int32, sal_Int32>> aBorderStartEnds;
+ for (int i = 0; i < xmlXPathNodeSetGetLength(pXmlNodes); i += 2)
+ {
+ xmlNodePtr pStart = pXmlNodes->nodeTab[i];
+ xmlNodePtr pEnd = pXmlNodes->nodeTab[i + 1];
+ xmlChar* pStartY = xmlGetProp(pStart, BAD_CAST("y"));
+ xmlChar* pEndY = xmlGetProp(pEnd, BAD_CAST("y"));
+ sal_Int32 nStartY = o3tl::toInt32(reinterpret_cast<char const*>(pStartY));
+ sal_Int32 nEndY = o3tl::toInt32(reinterpret_cast<char const*>(pEndY));
+ if (nStartY != nEndY)
+ {
+ // Vertical border.
+ continue;
+ }
+ xmlChar* pStartX = xmlGetProp(pStart, BAD_CAST("x"));
+ xmlChar* pEndX = xmlGetProp(pEnd, BAD_CAST("x"));
+ sal_Int32 nStartX = o3tl::toInt32(reinterpret_cast<char const*>(pStartX));
+ sal_Int32 nEndX = o3tl::toInt32(reinterpret_cast<char const*>(pEndX));
+ aBorderStartEnds.emplace_back(nStartX, nEndX);
+ }
+ xmlXPathFreeObject(pXmlObj);
+ // We have 3 lines: top, middle and bottom. The top and the bottom one is a full line, since
+ // it's an outer border. The middle one has increased start and decreased end to avoid an
+ // overlap.
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aBorderStartEnds.size());
+ CPPUNIT_ASSERT_EQUAL(aBorderStartEnds[0].first, aBorderStartEnds[2].first);
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected greater than: 1724
+ // - Actual : 1724
+ // i.e. the middle line's start was the same as the top line start, while what we want is a
+ // larger X position, so the start of the middle line doesn't overlap with the thick vertical
+ // outer border on the left of the table.
+ CPPUNIT_ASSERT_GREATER(aBorderStartEnds[0].first, aBorderStartEnds[1].first);
+ CPPUNIT_ASSERT_EQUAL(aBorderStartEnds[0].second, aBorderStartEnds[2].second);
+ CPPUNIT_ASSERT_LESS(aBorderStartEnds[0].second, aBorderStartEnds[1].second);
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testInnerCellBorderNocompatIntersect)
+{
+ // Given a table with both outer and inner borders:
+ createSwDoc();
+ SwDocShell* pShell = getSwDocShell();
+ SwDoc* pDoc = pShell->GetDoc();
+ // Set the default page style's writing direction to vertical:
+ SwPageDesc aStandard(pDoc->GetPageDesc(0));
+ SvxFrameDirectionItem aDirection(SvxFrameDirection::Vertical_RL_TB, RES_FRAMEDIR);
+ aStandard.GetMaster().SetFormatAttr(aDirection);
+ pDoc->ChgPageDesc(0, aStandard);
+ // Insert a 4x4 table:
+ SwWrtShell* pWrtShell = pShell->GetWrtShell();
+ SwInsertTableOptions aTableOptions(SwInsertTableFlags::DefaultBorder, 0);
+ pWrtShell->InsertTable(aTableOptions, 4, 4);
+
+ // When rendering table borders:
+ std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+
+ // Then make sure that all horizontal lines have the same length:
+ MetafileXmlDump dumper;
+ xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+ // Collect start/end (vertical) positions of horizontal borders.
+ xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"_ostr);
+ xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+ std::vector<std::pair<sal_Int32, sal_Int32>> aBorderStartEnds;
+ for (int i = 0; i < xmlXPathNodeSetGetLength(pXmlNodes); i += 2)
+ {
+ xmlNodePtr pStart = pXmlNodes->nodeTab[i];
+ xmlNodePtr pEnd = pXmlNodes->nodeTab[i + 1];
+ xmlChar* pStartY = xmlGetProp(pStart, BAD_CAST("y"));
+ xmlChar* pEndY = xmlGetProp(pEnd, BAD_CAST("y"));
+ sal_Int32 nStartY = o3tl::toInt32(reinterpret_cast<char const*>(pStartY));
+ sal_Int32 nEndY = o3tl::toInt32(reinterpret_cast<char const*>(pEndY));
+ if (nStartY != nEndY)
+ {
+ // Vertical border.
+ continue;
+ }
+ xmlChar* pStartX = xmlGetProp(pStart, BAD_CAST("x"));
+ xmlChar* pEndX = xmlGetProp(pEnd, BAD_CAST("x"));
+ sal_Int32 nStartX = o3tl::toInt32(reinterpret_cast<char const*>(pStartX));
+ sal_Int32 nEndX = o3tl::toInt32(reinterpret_cast<char const*>(pEndX));
+ aBorderStartEnds.emplace_back(nStartX, nEndX);
+ }
+ xmlXPathFreeObject(pXmlObj);
+ // We have 5 lines: top of 4 cells + bottom.
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(5), aBorderStartEnds.size());
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 9719
+ // - Actual : 10064
+ // i.e. the 2nd line started later than the first one, which is incorrect.
+ CPPUNIT_ASSERT_EQUAL(aBorderStartEnds[0].first, aBorderStartEnds[1].first);
+ CPPUNIT_ASSERT_EQUAL(aBorderStartEnds[0].first, aBorderStartEnds[2].first);
+ CPPUNIT_ASSERT_EQUAL(aBorderStartEnds[0].first, aBorderStartEnds[3].first);
+ CPPUNIT_ASSERT_EQUAL(aBorderStartEnds[0].first, aBorderStartEnds[4].first);
+ CPPUNIT_ASSERT_EQUAL(aBorderStartEnds[0].second, aBorderStartEnds[1].second);
+ CPPUNIT_ASSERT_EQUAL(aBorderStartEnds[0].second, aBorderStartEnds[2].second);
+ CPPUNIT_ASSERT_EQUAL(aBorderStartEnds[0].second, aBorderStartEnds[3].second);
+ CPPUNIT_ASSERT_EQUAL(aBorderStartEnds[0].second, aBorderStartEnds[4].second);
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testDoubleBorderVertical)
+{
+ // Given a table with a left and right double border, outer is thick, inner is thin:
+ createSwDoc("double-border-vertical.docx");
+ SwDoc* pDoc = getSwDoc();
+ SwDocShell* pShell = pDoc->GetDocShell();
+
+ // When rendering that document:
+ std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+
+ // Then make sure the left border is thick+thin and the right border is thin+thick (from left to
+ // right):
+ MetafileXmlDump dumper;
+ xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+ // Collect widths of vertical lines.
+ xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"_ostr);
+ xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+ // Horizontal position -> width.
+ std::map<sal_Int32, sal_Int32> aBorderWidths;
+ for (int i = 0; i < xmlXPathNodeSetGetLength(pXmlNodes); i += 2)
+ {
+ xmlNodePtr pStart = pXmlNodes->nodeTab[i];
+ xmlNodePtr pEnd = pXmlNodes->nodeTab[i + 1];
+ xmlChar* pStartX = xmlGetProp(pStart, BAD_CAST("x"));
+ xmlChar* pEndX = xmlGetProp(pEnd, BAD_CAST("x"));
+ sal_Int32 nStartX = o3tl::toInt32(reinterpret_cast<char const*>(pStartX));
+ sal_Int32 nEndX = o3tl::toInt32(reinterpret_cast<char const*>(pEndX));
+ if (nStartX != nEndX)
+ {
+ // Horizontal border.
+ continue;
+ }
+ xmlChar* pWidth = xmlGetProp(pStart->parent, BAD_CAST("width"));
+ sal_Int32 nWidth = o3tl::toInt32(reinterpret_cast<char const*>(pWidth));
+ aBorderWidths[nStartX] = nWidth;
+ }
+ xmlXPathFreeObject(pXmlObj);
+ std::vector<sal_Int32> aBorderWidthVec;
+ std::transform(aBorderWidths.begin(), aBorderWidths.end(), std::back_inserter(aBorderWidthVec),
+ [](const std::pair<sal_Int32, sal_Int32>& rPair) { return rPair.second; });
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), aBorderWidthVec.size());
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected greater than: 120
+ // - Actual : 60
+ // i.e. the left border was thin+thick, not thick+thin.
+ CPPUNIT_ASSERT_GREATER(aBorderWidthVec[1], aBorderWidthVec[0]);
+ CPPUNIT_ASSERT_GREATER(aBorderWidthVec[2], aBorderWidthVec[3]);
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testDoubleBorderHorizontal)
+{
+ // Given a table with a top and bottom double border, outer is thin, inner is thick:
+ createSwDoc("double-border-horizontal.docx");
+ SwDoc* pDoc = getSwDoc();
+ SwDocShell* pShell = pDoc->GetDocShell();
+
+ // When rendering table borders:
+ std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+
+ // Then make sure the top border is thin+thick and the bottom border is thick+thin (from top to
+ // bottom):
+ MetafileXmlDump dumper;
+ xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+ // Collect widths of horizontal lines.
+ xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"_ostr);
+ xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+ // Vertical position -> width.
+ std::map<sal_Int32, sal_Int32> aBorderWidths;
+ for (int i = 0; i < xmlXPathNodeSetGetLength(pXmlNodes); i += 2)
+ {
+ xmlNodePtr pStart = pXmlNodes->nodeTab[i];
+ xmlNodePtr pEnd = pXmlNodes->nodeTab[i + 1];
+ xmlChar* pStartY = xmlGetProp(pStart, BAD_CAST("y"));
+ xmlChar* pEndY = xmlGetProp(pEnd, BAD_CAST("y"));
+ sal_Int32 nStartY = o3tl::toInt32(reinterpret_cast<char const*>(pStartY));
+ sal_Int32 nEndY = o3tl::toInt32(reinterpret_cast<char const*>(pEndY));
+ if (nStartY != nEndY)
+ {
+ // Vertical border.
+ continue;
+ }
+ xmlChar* pWidth = xmlGetProp(pStart->parent, BAD_CAST("width"));
+ sal_Int32 nWidth = o3tl::toInt32(reinterpret_cast<char const*>(pWidth));
+ aBorderWidths[nStartY] = nWidth;
+ }
+ xmlXPathFreeObject(pXmlObj);
+ std::vector<sal_Int32> aBorderWidthVec;
+ std::transform(aBorderWidths.begin(), aBorderWidths.end(), std::back_inserter(aBorderWidthVec),
+ [](const std::pair<sal_Int32, sal_Int32>& rPair) { return rPair.second; });
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), aBorderWidthVec.size());
+ CPPUNIT_ASSERT_GREATER(aBorderWidthVec[0], aBorderWidthVec[1]);
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected greater than: 120
+ // - Actual : 60
+ // i.e. the bottom border was thin+thick, not thick+thin.
+ CPPUNIT_ASSERT_GREATER(aBorderWidthVec[3], aBorderWidthVec[2]);
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testParaBorderInCellClip)
+{
+ // Given a document which has outside-cell borders defined, which should not be visible:
+ createSwDoc("para-border-in-cell-clip.docx");
+ SwDoc* pDoc = getSwDoc();
+ SwDocShell* pShell = pDoc->GetDocShell();
+
+ // When rendering those borders:
+ std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+
+ // Then make sure that we have clipping setup for both paragraphs inside the table cell:
+ MetafileXmlDump dumper;
+ xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 2
+ // - Actual : 0
+ // - XPath '//clipregion/polygon' number of nodes is incorrect
+ // i.e. there was no clipping applied, leading to unexpected left/right borders.
+ assertXPath(pXmlDoc, "//clipregion/polygon"_ostr, 2);
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testDoublePageBorder)
+{
+ // Given a page with a top and bottom double border, outer is thick, inner is thin:
+ createSwDoc("double-page-border.docx");
+ SwDoc* pDoc = getSwDoc();
+ SwDocShell* pShell = pDoc->GetDocShell();
+
+ // When rendering that document:
+ std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+
+ // Then make sure the top border is thick+thing and the bottom border is thin+thick (from top to
+ // bottom):
+ MetafileXmlDump dumper;
+ xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+ // Collect widths of horizontal lines.
+ xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"_ostr);
+ xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+ // Vertical position -> width.
+ std::map<sal_Int32, sal_Int32> aBorderWidths;
+ for (int i = 0; i < xmlXPathNodeSetGetLength(pXmlNodes); i += 2)
+ {
+ xmlNodePtr pStart = pXmlNodes->nodeTab[i];
+ xmlNodePtr pEnd = pXmlNodes->nodeTab[i + 1];
+ xmlChar* pStartY = xmlGetProp(pStart, BAD_CAST("y"));
+ xmlChar* pEndY = xmlGetProp(pEnd, BAD_CAST("y"));
+ sal_Int32 nStartY = o3tl::toInt32(reinterpret_cast<char const*>(pStartY));
+ sal_Int32 nEndY = o3tl::toInt32(reinterpret_cast<char const*>(pEndY));
+ if (nStartY != nEndY)
+ {
+ // Vertical border.
+ continue;
+ }
+ xmlChar* pWidth = xmlGetProp(pStart->parent, BAD_CAST("width"));
+ sal_Int32 nWidth = o3tl::toInt32(reinterpret_cast<char const*>(pWidth));
+ aBorderWidths[nStartY] = nWidth;
+ }
+ xmlXPathFreeObject(pXmlObj);
+ std::vector<sal_Int32> aBorderWidthVec;
+ std::transform(aBorderWidths.begin(), aBorderWidths.end(), std::back_inserter(aBorderWidthVec),
+ [](const std::pair<sal_Int32, sal_Int32>& rPair) { return rPair.second; });
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), aBorderWidthVec.size());
+ CPPUNIT_ASSERT_GREATER(aBorderWidthVec[1], aBorderWidthVec[0]);
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected greater than: 60
+ // - Actual : 15
+ // i.e. the bottom border was thick+thin, not thin+thick.
+ CPPUNIT_ASSERT_GREATER(aBorderWidthVec[2], aBorderWidthVec[3]);
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testNegativePageBorder)
+{
+ // FIXME: the DPI check should be removed when either (1) the test is fixed to work with
+ // non-default DPI; or (2) unit tests on Windows are made to use svp VCL plugin.
+ if (!IsDefaultDPI())
+ return;
+
+ // Given a document with a top margin and a negative border distance:
+ createSwDoc();
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ SwDocShell* pDocShell = pTextDoc->GetDocShell();
+ SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
+ pWrtShell->Insert("test");
+ uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"),
+ uno::UNO_QUERY);
+ xPageStyle->setPropertyValue("TopMargin", uno::Any(static_cast<sal_Int32>(501))); // 284 twips
+ table::BorderLine2 aBorder;
+ aBorder.LineWidth = 159; // 90 twips
+ aBorder.OuterLineWidth = 159;
+ xPageStyle->setPropertyValue("TopBorder", uno::Any(aBorder));
+ sal_Int32 nTopBorderDistance = -646; // -366 twips
+ xPageStyle->setPropertyValue("TopBorderDistance", uno::Any(nTopBorderDistance));
+ nTopBorderDistance = 0;
+ xPageStyle->getPropertyValue("TopBorderDistance") >>= nTopBorderDistance;
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-646), nTopBorderDistance);
+
+ // When rendering that border:
+ std::shared_ptr<GDIMetaFile> xMetaFile = pDocShell->GetPreviewMetaFile();
+
+ // Then make sure that the negative distance pushes the horizontal borderline down:
+ MetafileXmlDump aDumper;
+ xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 899
+ // - Actual : 524
+ // i.e. the negative border distance was rounded up to 0 in lcl_CalcBorderRect().
+ // Ideally this would be 284 (top of first page) + 284 (top margin) + 366 (border distance) =
+ // 934.
+ assertXPath(pXmlDoc, "//polyline[@style='solid']/point[1]"_ostr, "y"_ostr, "899");
+ assertXPath(pXmlDoc, "//polyline[@style='solid']/point[2]"_ostr, "y"_ostr, "899");
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testNegativePageBorderNoMargin)
+{
+ // FIXME: the DPI check should be removed when either (1) the test is fixed to work with
+ // non-default DPI; or (2) unit tests on Windows are made to use svp VCL plugin.
+ if (!IsDefaultDPI())
+ return;
+
+ // Given a document with no top margin and a negative border distance:
+ createSwDoc();
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ SwDocShell* pDocShell = pTextDoc->GetDocShell();
+ SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
+ pWrtShell->Insert("test");
+ uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"),
+ uno::UNO_QUERY);
+ xPageStyle->setPropertyValue("TopMargin", uno::Any(static_cast<sal_Int32>(0))); // 0 twips
+ table::BorderLine2 aBorder;
+ aBorder.LineWidth = 159; // 90 twips
+ aBorder.OuterLineWidth = 159;
+ xPageStyle->setPropertyValue("TopBorder", uno::Any(aBorder));
+ sal_Int32 nTopBorderDistance = -1147; // -650 twips
+ xPageStyle->setPropertyValue("TopBorderDistance", uno::Any(nTopBorderDistance));
+
+ // When rendering that border:
+ std::shared_ptr<GDIMetaFile> xMetaFile = pDocShell->GetPreviewMetaFile();
+
+ // Then make sure that the negative distance pushes the horizontal borderline down:
+ MetafileXmlDump aDumper;
+ xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 899
+ // - Actual : 329
+ // i.e. this failed differently: the lack of top margin caused a second problem.
+ // Ideally this would be 284 (top of first page) + 650 (border distance) =
+ // 934.
+ assertXPath(pXmlDoc, "//polyline[@style='solid']/point[1]"_ostr, "y"_ostr, "899");
+ assertXPath(pXmlDoc, "//polyline[@style='solid']/point[2]"_ostr, "y"_ostr, "899");
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testFollowTextFlowWrapInBackground)
+{
+ // Given a document with a table, and a graphic inside that table -- anchored, wrap set to
+ // through and follow-text-flow set to true:
+ createSwDoc();
+ SwDoc* pDoc = getSwDoc();
+ pDoc->getIDocumentSettingAccess().set(DocumentSettingId::USE_FORMER_TEXT_WRAPPING, true);
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ SwInsertTableOptions aTableOptions(SwInsertTableFlags::DefaultBorder, 0);
+ pWrtShell->InsertTable(aTableOptions, 1, 1);
+ pWrtShell->MoveTable(GotoPrevTable, fnTableStart);
+ SfxItemSet aFrameSet(pDoc->GetAttrPool(), svl::Items<RES_FRMATR_BEGIN, RES_FRMATR_END - 1>);
+ SwFormatAnchor aAnchor(RndStdIds::FLY_AT_CHAR);
+ aFrameSet.Put(aAnchor);
+ SwFormatSurround aSurround(text::WrapTextMode_THROUGH);
+ aFrameSet.Put(aSurround);
+ SwFormatFrameSize aSize(SwFrameSize::Fixed, 1000, 1000);
+ aFrameSet.Put(aSize);
+ SwFormatFollowTextFlow aFlow(true);
+ aFrameSet.Put(aFlow);
+ Graphic aGrf;
+
+ // When inserting that image:
+ pWrtShell->SwFEShell::Insert(OUString(), OUString(), &aGrf, &aFrameSet);
+
+ // Then make sure that the cell height grows to have space for the graphic, given that
+ // background=true is not specified.
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+ sal_Int32 nCellHeight
+ = getXPath(pXmlDoc, "//cell[1]/infos/bounds"_ostr, "height"_ostr).toInt32();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected greater than: 1000
+ // - Actual : 396
+ // i.e. the image was larger than the containing cell.
+ CPPUNIT_ASSERT_GREATER(static_cast<sal_Int32>(1000), nCellHeight);
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testPageRemoveFlyTable)
+{
+ // Given a document with a ToC and several tables, one table marked with a bookmark:
+ createSwDoc("page-remove-fly-table.odt");
+ SwDoc* pDoc = getSwDoc();
+
+ // When updating the ToC and incrementally formatting the document:
+ SwView* pView = pDoc->GetDocShell()->GetView();
+ SfxDispatcher& rDispatcher = *pView->GetViewFrame().GetDispatcher();
+ rDispatcher.Execute(FN_UPDATE_TOX);
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ pWrtShell->Reformat();
+
+ // Then make sure that the 2nd table below the bookmark has no unwanted top margin:
+ pWrtShell->GotoMark("test");
+ pWrtShell->Down(/*bSelect=*/false, /*nCount=*/1, /*bBasicCall=*/false);
+ pWrtShell->Down(/*bSelect=*/false, /*nCount=*/1, /*bBasicCall=*/false);
+ SwCursor* pCursor = pWrtShell->GetCursor();
+ SwTextNode* pTextNode = pCursor->GetPoint()->GetNode().GetTextNode();
+ SwFrame* pTextFrame = pTextNode->getLayoutFrame(nullptr);
+ SwTabFrame* pInnerTable = pTextFrame->FindTabFrame();
+ SwTabFrame* pOuterTable = pInnerTable->GetUpper()->FindTabFrame();
+ tools::Long nActual = pOuterTable->getFramePrintArea().Top();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 0
+ // - Actual : 5879
+ // i.e. the problematic table had a large, unwanted/leftover top margin.
+ CPPUNIT_ASSERT_EQUAL(static_cast<tools::Long>(0), nActual);
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testPageRemoveFlyNoTable)
+{
+ createSwDoc("page-remove-fly-no-table.fodt");
+ // This never returned.
+ calcLayout();
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testNewFollowTextFlowWrapInBackground)
+{
+ // Given a document with a table, and a graphic inside that table -- anchored, wrap set to
+ // through and follow-text-flow set to true, legacy USE_FORMER_TEXT_WRAPPING is not set:
+ createSwDoc();
+ SwDoc* pDoc = getSwDoc();
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ SwInsertTableOptions aTableOptions(SwInsertTableFlags::DefaultBorder, 0);
+ pWrtShell->InsertTable(aTableOptions, 1, 1);
+ pWrtShell->MoveTable(GotoPrevTable, fnTableStart);
+ SfxItemSet aFrameSet(pDoc->GetAttrPool(), svl::Items<RES_FRMATR_BEGIN, RES_FRMATR_END - 1>);
+ SwFormatAnchor aAnchor(RndStdIds::FLY_AT_CHAR);
+ aFrameSet.Put(aAnchor);
+ SwFormatSurround aSurround(text::WrapTextMode_THROUGH);
+ aFrameSet.Put(aSurround);
+ SwFormatFrameSize aSize(SwFrameSize::Fixed, 1000, 1000);
+ aFrameSet.Put(aSize);
+ SwFormatFollowTextFlow aFlow(true);
+ aFrameSet.Put(aFlow);
+ Graphic aGrf;
+
+ // When inserting that image:
+ pWrtShell->SwFEShell::Insert(OUString(), OUString(), &aGrf, &aFrameSet);
+
+ // Then make sure that the cell height grows to have space for the graphic, given that
+ // background=true is not specified.
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+ sal_Int32 nCellHeight
+ = getXPath(pXmlDoc, "//cell[1]/infos/bounds"_ostr, "height"_ostr).toInt32();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected less than: 1000
+ // - Actual : 1120
+ // i.e. the cell height was too large, the image influenced it, which is not expected.
+ CPPUNIT_ASSERT_LESS(static_cast<sal_Int32>(1000), nCellHeight);
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/layout/paintfrm.cxx b/sw/qa/core/layout/paintfrm.cxx
new file mode 100644
index 0000000000..b5990648b2
--- /dev/null
+++ b/sw/qa/core/layout/paintfrm.cxx
@@ -0,0 +1,163 @@
+/* -*- 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 <o3tl/string_view.hxx>
+
+#include <docsh.hxx>
+#include <unotxdoc.hxx>
+
+namespace
+{
+/// Covers sw/source/core/layout/paintfrm.cxx fixes.
+class Test : public SwModelTestBase
+{
+public:
+ Test()
+ : SwModelTestBase("/sw/qa/core/layout/data/")
+ {
+ }
+};
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitTableBorder)
+{
+ // Given a document with a split table, table borders are defined, but cell borders are not:
+ createSwDoc("split-table-border.odt");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ SwDocShell* pShell = pTextDoc->GetDocShell();
+
+ // When rendering that document:
+ std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+
+ // Then make sure that the master table has a bottom border and the follow table has a top
+ // border:
+ MetafileXmlDump aDumper;
+ xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
+ xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"_ostr);
+ xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+ int nHorizontalBorders = 0;
+ // Count the horizontal borders:
+ for (int i = 0; i < xmlXPathNodeSetGetLength(pXmlNodes); i += 2)
+ {
+ xmlNodePtr pStart = pXmlNodes->nodeTab[i];
+ xmlNodePtr pEnd = pXmlNodes->nodeTab[i + 1];
+ xmlChar* pStartY = xmlGetProp(pStart, BAD_CAST("y"));
+ xmlChar* pEndY = xmlGetProp(pEnd, BAD_CAST("y"));
+ sal_Int32 nStartY = o3tl::toInt32(reinterpret_cast<char const*>(pStartY));
+ sal_Int32 nEndY = o3tl::toInt32(reinterpret_cast<char const*>(pEndY));
+ if (nStartY != nEndY)
+ {
+ // Vertical border.
+ continue;
+ }
+
+ ++nHorizontalBorders;
+ }
+ xmlXPathFreeObject(pXmlObj);
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 4
+ // - Actual : 2
+ // i.e. the bottom border in the master table and the top border in the follow table were
+ // missing.
+ CPPUNIT_ASSERT_EQUAL(4, nHorizontalBorders);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testRTLBorderMerge)
+{
+ // Given a document with an RTL table:
+ createSwDoc("rtl-table.docx");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ SwDocShell* pShell = pTextDoc->GetDocShell();
+
+ // When rendering that document:
+ std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+
+ // Then make sure the 5 columns all have left and right vertical borders:
+ MetafileXmlDump aDumper;
+ xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
+ xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"_ostr);
+ xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+ int nVerticalBorders = 0;
+ // Count the vertical borders:
+ for (int i = 0; i < xmlXPathNodeSetGetLength(pXmlNodes); i += 2)
+ {
+ xmlNodePtr pStart = pXmlNodes->nodeTab[i];
+ xmlNodePtr pEnd = pXmlNodes->nodeTab[i + 1];
+ xmlChar* pStartY = xmlGetProp(pStart, BAD_CAST("y"));
+ xmlChar* pEndY = xmlGetProp(pEnd, BAD_CAST("y"));
+ sal_Int32 nStartY = o3tl::toInt32(reinterpret_cast<char const*>(pStartY));
+ sal_Int32 nEndY = o3tl::toInt32(reinterpret_cast<char const*>(pEndY));
+ if (nStartY == nEndY)
+ {
+ // Horizontal border.
+ continue;
+ }
+
+ ++nVerticalBorders;
+ }
+ xmlXPathFreeObject(pXmlObj);
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 6
+ // - Actual : 4
+ // i.e. the 2nd and 5th vertical border was missing.
+ CPPUNIT_ASSERT_EQUAL(6, nVerticalBorders);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitTableMergedBorder)
+{
+ // Given a document with a split table, first row in frame 1 has merged cells:
+ createSwDoc("split-table-merged-border.odt");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ SwDocShell* pShell = pTextDoc->GetDocShell();
+
+ // When rendering that document:
+ std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+
+ // Then make sure that the master table has a bottom border with the correct widths:
+ MetafileXmlDump aDumper;
+ xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
+ xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polyline[@style='solid']/point"_ostr);
+ xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+ std::set<int> aHorizontalBorderStarts;
+ std::set<int> aHorizontalBorderEnds;
+ // Collect the horizontal borders:
+ for (int i = 0; i < xmlXPathNodeSetGetLength(pXmlNodes); i += 2)
+ {
+ xmlNodePtr pStart = pXmlNodes->nodeTab[i];
+ xmlNodePtr pEnd = pXmlNodes->nodeTab[i + 1];
+ xmlChar* pStartY = xmlGetProp(pStart, BAD_CAST("y"));
+ xmlChar* pEndY = xmlGetProp(pEnd, BAD_CAST("y"));
+ sal_Int32 nStartY = o3tl::toInt32(reinterpret_cast<char const*>(pStartY));
+ sal_Int32 nEndY = o3tl::toInt32(reinterpret_cast<char const*>(pEndY));
+ if (nStartY != nEndY)
+ {
+ // Vertical border.
+ continue;
+ }
+
+ xmlChar* pStartX = xmlGetProp(pStart, BAD_CAST("x"));
+ xmlChar* pEndX = xmlGetProp(pEnd, BAD_CAST("x"));
+ sal_Int32 nStartX = o3tl::toInt32(reinterpret_cast<char const*>(pStartX));
+ sal_Int32 nEndX = o3tl::toInt32(reinterpret_cast<char const*>(pEndX));
+ aHorizontalBorderStarts.insert(nStartX);
+ aHorizontalBorderEnds.insert(nEndX);
+ }
+ xmlXPathFreeObject(pXmlObj);
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), aHorizontalBorderStarts.size());
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 2
+ // - Actual : 3
+ // i.e. the frame 1 bottom border ended sooner than expected, resulting in a buggy, partial
+ // bottom border.
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), aHorizontalBorderEnds.size());
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/layout/sortedobjs.cxx b/sw/qa/core/layout/sortedobjs.cxx
new file mode 100644
index 0000000000..471dd48a8b
--- /dev/null
+++ b/sw/qa/core/layout/sortedobjs.cxx
@@ -0,0 +1,35 @@
+/* -*- 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>
+
+namespace
+{
+/// Covers sw/source/core/layout/sortedobjs.cxx fixes.
+class Test : public SwModelTestBase
+{
+public:
+ Test()
+ : SwModelTestBase("/sw/qa/core/layout/data/")
+ {
+ }
+};
+
+CPPUNIT_TEST_FIXTURE(Test, testSortedObjsInsert)
+{
+ // Given a document with two anchored objects, one is a fly frame in the header and the other is
+ // a group shape where one inner shape has an associated fly frame:
+ // When importing that document:
+ // Then make sure that we don't try to do binary search on an unsorted container that leads to a
+ // crash in debug builds:
+ createSwDoc("sorted-objs-insert.docx");
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/layout/tabfrm.cxx b/sw/qa/core/layout/tabfrm.cxx
new file mode 100644
index 0000000000..9357fc2df1
--- /dev/null
+++ b/sw/qa/core/layout/tabfrm.cxx
@@ -0,0 +1,204 @@
+/* -*- 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 <IDocumentLayoutAccess.hxx>
+#include <rootfrm.hxx>
+#include <pagefrm.hxx>
+#include <tabfrm.hxx>
+#include <sortedobjs.hxx>
+#include <anchoredobject.hxx>
+#include <flyfrm.hxx>
+#include <flyfrms.hxx>
+
+namespace
+{
+/// Covers sw/source/core/layout/tabfrm.cxx fixes.
+class Test : public SwModelTestBase
+{
+public:
+ Test()
+ : SwModelTestBase("/sw/qa/core/layout/data/")
+ {
+ }
+};
+
+CPPUNIT_TEST_FIXTURE(Test, testTablePrintAreaLeft)
+{
+ // Given a document with a header containing an image, and also with an overlapping table:
+ createSwDoc("table-print-area-left.docx");
+
+ // When laying out that document & parsing the left margin of the table:
+ SwTwips nTablePrintLeft = parseDump("//tab/infos/prtBounds"_ostr, "left"_ostr).toInt32();
+
+ // Then make sure it has ~no left margin:
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 5
+ // - Actual : 10646
+ // i.e. the table was shifted outside the page, was invisible.
+ CPPUNIT_ASSERT_EQUAL(static_cast<SwTwips>(5), nTablePrintLeft);
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testTableMissingJoin)
+{
+ // Given a document with a table on page 2:
+ // When laying out that document:
+ createSwDoc("table-missing-join.docx");
+
+ // Then make sure that the table fits page 2:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = pLayout->Lower()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage1);
+ auto pPage2 = pPage1->GetNext()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage2);
+ SwFrame* pBody = pPage2->FindBodyCont();
+ auto pTab = pBody->GetLower()->DynCastTabFrame();
+ // Without the accompanying fix in place, this test would have failed, the table continued on
+ // page 3.
+ CPPUNIT_ASSERT(!pTab->HasFollow());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyInInlineTable)
+{
+ // Outer inline table on pages 1 -> 2 -> 3, inner floating table on pages 2 -> 3:
+ // When laying out that document:
+ createSwDoc("floattable-in-inlinetable.docx");
+
+ // Then make sure that the outer table is not missing on page 3:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = pLayout->Lower()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage1);
+ {
+ SwFrame* pBody = pPage1->FindBodyCont();
+ auto pTab = pBody->GetLower()->DynCastTabFrame();
+ CPPUNIT_ASSERT(!pTab->GetPrecede());
+ CPPUNIT_ASSERT(pTab->GetFollow());
+ }
+ auto pPage2 = pPage1->GetNext()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage2);
+ {
+ SwFrame* pBody = pPage2->FindBodyCont();
+ auto pTab = pBody->GetLower()->DynCastTabFrame();
+ CPPUNIT_ASSERT(pTab->GetPrecede());
+ // Without the accompanying fix in place, this test would have failed, the outer table was
+ // missing on page 3.
+ CPPUNIT_ASSERT(pTab->GetFollow());
+ }
+ auto pPage3 = pPage2->GetNext()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage3);
+ {
+ SwFrame* pBody = pPage3->FindBodyCont();
+ auto pTab = pBody->GetLower()->DynCastTabFrame();
+ CPPUNIT_ASSERT(pTab->GetPrecede());
+ CPPUNIT_ASSERT(!pTab->GetFollow());
+ }
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyNestedRowSpan)
+{
+ // Given a document with nested floating tables and a row with rowspan cells at page boundary:
+ // When loading that document:
+ // Without the accompanying fix in place, this test would have resulted in a layout loop.
+ createSwDoc("floattable-nested-rowspan.docx");
+
+ // Then make sure the resulting page count matches Word:
+ CPPUNIT_ASSERT_EQUAL(6, getPages());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyTableJoin)
+{
+ // Given a document with a multi-page floating table:
+ // When loading this document:
+ createSwDoc("floattable-table-join.docx");
+
+ // Then make sure this document doesn't crash the layout and has a floating table split on 4
+ // pages:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage1 = pLayout->Lower()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage1);
+ CPPUNIT_ASSERT(pPage1->GetSortedObjs());
+ {
+ SwSortedObjs& rPageObjs = *pPage1->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPageObjs.size());
+ auto pFly = rPageObjs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+ CPPUNIT_ASSERT(pFly);
+ // Start of the chain.
+ CPPUNIT_ASSERT(!pFly->GetPrecede());
+ CPPUNIT_ASSERT(pFly->HasFollow());
+ }
+ auto pPage2 = pPage1->GetNext()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage2);
+ CPPUNIT_ASSERT(pPage2->GetSortedObjs());
+ {
+ SwSortedObjs& rPageObjs = *pPage2->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPageObjs.size());
+ auto pFly = rPageObjs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+ CPPUNIT_ASSERT(pFly);
+ CPPUNIT_ASSERT(pFly->GetPrecede());
+ CPPUNIT_ASSERT(pFly->HasFollow());
+ }
+ auto pPage3 = pPage2->GetNext()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage3);
+ CPPUNIT_ASSERT(pPage3->GetSortedObjs());
+ {
+ SwSortedObjs& rPageObjs = *pPage3->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPageObjs.size());
+ auto pFly = rPageObjs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+ CPPUNIT_ASSERT(pFly);
+ CPPUNIT_ASSERT(pFly->GetPrecede());
+ CPPUNIT_ASSERT(pFly->HasFollow());
+ }
+ auto pPage4 = pPage3->GetNext()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage4);
+ CPPUNIT_ASSERT(pPage4->GetSortedObjs());
+ SwSortedObjs& rPageObjs = *pPage4->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPageObjs.size());
+ auto pFly = rPageObjs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+ CPPUNIT_ASSERT(pFly);
+ // End of the chain.
+ CPPUNIT_ASSERT(pFly->GetPrecede());
+ CPPUNIT_ASSERT(!pFly->HasFollow());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyWrappedByTable)
+{
+ // Given a document with a floating table, wrapped by an inline table:
+ // When laying out the document:
+ createSwDoc("floattable-wrapped-by-table.docx");
+
+ // Then make sure the inline table wraps around the floating table:
+ SwDoc* pDoc = getSwDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ auto pPage = pLayout->Lower()->DynCastPageFrame();
+ CPPUNIT_ASSERT(pPage);
+ // Get the top of the inline table, ignoring margins:
+ CPPUNIT_ASSERT(pPage->GetSortedObjs());
+ SwSortedObjs& rPageObjs = *pPage->GetSortedObjs();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPageObjs.size());
+ auto pFly = rPageObjs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+ CPPUNIT_ASSERT(pFly);
+ // Get the bottom of the floating table, ignoring margins:
+ SwTwips nFloatingBottom = pFly->getFrameArea().Top() + pFly->getFramePrintArea().Height();
+ SwFrame* pBody = pPage->FindBodyCont();
+ auto pTab = pBody->GetLower()->GetNext()->DynCastTabFrame();
+ SwTwips nInlineTop = pTab->getFrameArea().Top() + pTab->getFramePrintArea().Top();
+ // Make sure the inline table is on the right of the floating one, not below it:
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected less than: 7287
+ // - Actual : 7287
+ // i.e. the inline table was under the floating one, not on the right of it.
+ CPPUNIT_ASSERT_LESS(nFloatingBottom, nInlineTop);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/layout/trvlfrm.cxx b/sw/qa/core/layout/trvlfrm.cxx
new file mode 100644
index 0000000000..dc8ba54f4f
--- /dev/null
+++ b/sw/qa/core/layout/trvlfrm.cxx
@@ -0,0 +1,56 @@
+/* -*- 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 <wrtsh.hxx>
+#include <docsh.hxx>
+#include <IDocumentLayoutAccess.hxx>
+#include <rootfrm.hxx>
+#include <node.hxx>
+
+namespace
+{
+/// Covers sw/source/core/layout/trvlfrm.cxx fixes.
+class Test : public SwModelTestBase
+{
+public:
+ Test()
+ : SwModelTestBase("/sw/qa/core/layout/data/")
+ {
+ }
+};
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyModelPositionForViewPointCorrection)
+{
+ // Given a 2 page floating table, 40% width, positioned on the left of the page:
+ createSwDoc("floattable-model-position-for-view-point-correction.docx");
+
+ // When clicking on the right side of the table:
+ SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+ SwDoc* pDoc = getSwDocShell()->GetDoc();
+ SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+ SwFrame* pPage = pLayout->GetLower();
+ SwFrame* pBody = pPage->GetLower();
+ const SwRect& rBodyRect = pBody->getFrameArea();
+ // 1 line below the top center of the body frame.
+ Point aDocPos(rBodyRect.Left() + rBodyRect.Width() / 2, rBodyRect.Top() + 220);
+ bool bOnlyText = false;
+ pWrtShell->CallSetCursor(&aDocPos, bOnlyText);
+
+ // Then make sure the cursor gets inside the table, and doesn't go to the anchor on page 2:
+ SwCursor& rCursor = pWrtShell->GetCurrentShellCursor();
+ SwTableNode* pTableNode = rCursor.GetPointNode().FindTableNode();
+ // Without the accompanying fix in place, this test would have failed, the cursor was in the
+ // anchor text node, not inside the split fly.
+ CPPUNIT_ASSERT(pTableNode);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */