diff options
author | Justin Luth <justin.luth@collabora.com> | 2019-11-13 21:34:27 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-11-15 09:09:52 +0100 |
commit | b58b78f5275aedbc8904b8dd5cf2f54919da7c8a (patch) | |
tree | 85a8068bcc4d5dd1f616da4ffc2c3d272efe829e /sw/qa | |
parent | bf2ebd5f140a0236ef8921060bb65c99ef56dd03 (diff) |
tdf#128700 ww8import: no relative width table if made into a fly
This is a partial revert for LO 6.0's bug 55528 commit
e69473539a33da5450d3878999eba7f9bfb9e631
Apparently Word tables can float without a frame, but in LO they
need to wrapped in a frame? The relative size is supposed to be
relative to the container they are in - so floated tables must
not be assigned a relative value - otherwise the tablesize becomes
relative to the custom frame that was created to float it.
The fix was easy to make, but then trying to figure out whether
to test using InLocalApo(), or just m_xSFlyPara took a lot of time.
The documentation is sparse and unclear. In the end I settled on
ignoring relative width if pFlyFormat exists, since certain
conditions can cancel (bNoFly) a FloatingTableConversion.
I tested what happens if a real frame is created and then a
relatively sized table is dropped inside. I confirmed that relative
SHOULD be relative to the frame. That case still works fine
since it isn't considered an x_sFlyPara - I think because it actually
is a textbox that the table is anchored onto. LO round-trips
frame/table as textbox/table.
Conclusion: tables inside of frames/textboxes MAY be relative,
but if the table itself is floating (a WORD-ONLY feature)
then it should not be relatively sized.
Change-Id: I2b0bd525051a33b5606b79d2b26665d3edeb5357
Reviewed-on: https://gerrit.libreoffice.org/82647
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/ww8export/data/tdf128700_relativeTableWidth.doc | bin | 0 -> 67072 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export2.cxx | 11 |
2 files changed, 11 insertions, 0 deletions
diff --git a/sw/qa/extras/ww8export/data/tdf128700_relativeTableWidth.doc b/sw/qa/extras/ww8export/data/tdf128700_relativeTableWidth.doc Binary files differnew file mode 100644 index 000000000000..9fa798ea32c7 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf128700_relativeTableWidth.doc diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index b2523b822370..677b8b0c225c 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -65,6 +65,17 @@ DECLARE_WW8EXPORT_TEST(testTdf55528_relativeTableWidth, "tdf55528_relativeTableW CPPUNIT_ASSERT_EQUAL_MESSAGE("Table relative width percent", sal_Int16(98), getProperty<sal_Int16>(xTable, "RelativeWidth")); } +DECLARE_WW8EXPORT_TEST(testTdf128700_relativeTableWidth, "tdf128700_relativeTableWidth.doc") +{ + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + + // Since the table has been converted into a floating frame, the relative width either needed to be transferred + // onto the frame, or else just thrown out. Otherwise it becomes relative to the size of the frame. + CPPUNIT_ASSERT_EQUAL_MESSAGE("Floated table can't use relative width", sal_Int16(0), getProperty<sal_Int16>(xTable, "RelativeWidth")); +} + DECLARE_WW8EXPORT_TEST(testTdf116436_tableBackground, "tdf116436_tableBackground.odt") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); |