diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2022-11-02 22:34:16 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2023-03-22 18:54:41 +0000 |
commit | f7d0487805a3ee64b9a9b13bf657cc9c372efc7c (patch) | |
tree | 775537f386973e7f7758646268623cc6695ea642 /sw | |
parent | 888c55f357a5a60067e35e4a420c849cabaf949c (diff) |
tdf#150966 oox export avoid bottom above top for text area
If bottom and top insets set so that the bottom edge of the resulting
text area is above the top edge, then LO and MS Office behave different
in how this is rendered. With commit e2169886 insets are converted on
import to make rendering in LO similar to MS Office, but the
implemented export has some problems, see analysis in bug report.
LibreOffice normalizes the resulting text area in case bottom edge is
above top edge. So this patch exports the insets so, that MS Office
gets a normalized resulting text area and will not apply its special
rules.
A roundtrip starting with pptx will not regenerate the old values but
will produce inset values, which give same rendering in MS Office than
in LO. Because the method is different now, the inset values have
changed and test testTextDistancesOOXML_Export is adapted. When you
compare the result with the screenshot on slide 2, you see that the
new method works as well.
The old method did not work for exporting an odp file. That is covered
by the new unit test. The docx unit test file covers the case, that
the export tweak was erroneously triggered.
Change-Id: I0091f284d9bdd635dd87ddb9e9b0e415cc0cc51e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142185
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
(cherry picked from commit 933768ffcd8617942f45481de77e656ded9dcfe2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142265
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit 59b44e72f46021c070095a75a0d7e0ae12c43399)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149187
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf150966_regularInset.docx | bin | 0 -> 17569 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 18 |
2 files changed, 18 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf150966_regularInset.docx b/sw/qa/extras/ooxmlexport/data/tdf150966_regularInset.docx Binary files differnew file mode 100644 index 000000000000..0d07a5453e35 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf150966_regularInset.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index 8497e0f58dc8..ad18b6afc246 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -250,6 +250,24 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf152425) CPPUNIT_ASSERT_EQUAL(OUString("List 5"), Para5Style); } +CPPUNIT_TEST_FIXTURE(Test, testTdf150966_regularInset) +{ + // Given a docx document with a rectangular shape with height cy="900000" (EMU), tIns="180000" + // and bIns="360000", resulting in 360000EMU text area height. + load(DATA_DIRECTORY, "tdf150966_regularInset.docx"); + + // The shape is imported as custom shape with attached frame. + // The insets are currently imported as margin top="4.99mm" and bottom="10mm". + // That should result in tIns="179640" and bIns="360000" on export. + + // Without fix the insets were tIns="359280" and bIns="539640". The text area had 1080Emu height + // and Word displayes no text at all. + save("Office Open XML Text", maTempFile); + mbExported = true; + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + assertXPathAttrs(pXmlDoc, "//wps:bodyPr", { { "tIns", "179640" }, { "bIns", "360000" } }); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |