[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sw/qa writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Wed Jul 12 01:31:21 UTC 2017
sw/qa/extras/ooxmlexport/data/tdf109063.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 8 ++++++++
writerfilter/source/dmapper/PropertyMap.cxx | 6 +++++-
3 files changed, 13 insertions(+), 1 deletion(-)
New commits:
commit 40c420adf77fc6dd41306dcd1fdf2ce06b456a80
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Jul 11 12:44:56 2017 +0200
tdf#109063 DOCX import: consider wrap space for multi-page floattables
Follow-up to commit 78d1f1c2835b9fae0f91ed771fc1d594c7817502 (fdo#68607
bnc#816593 DomainMapperTableHandler: don't always start a frame,
2013-09-03), turns out in case there is little space between the table
and the edge of the body area, then there is no wrapping performed in
Word, so we should not convert to floating table, either.
The limit seems to be 266 twips (mm100 unit is used in the code), and
this seems to be constant: it does not change if both the table and the
page width is changed, nor does it change when the empty paragraph to be
wrapped has a different paragraph mark size.
For the majority of the documents this means no change as usually there
is either no space available for wrapping or there is a lot more
available.
(cherry picked from commit 25445d24cfa87522ee4c47e4aa7e6e816cdc9a36)
Conflicts:
writerfilter/source/dmapper/PropertyMap.cxx
Change-Id: Ibbf7409065ba958854514f23b360be56677c8fe3
Reviewed-on: https://gerrit.libreoffice.org/39828
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf109063.docx b/sw/qa/extras/ooxmlexport/data/tdf109063.docx
new file mode 100644
index 000000000000..70f4fe4e2f31
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf109063.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 40601461c308..fd5b1716afe3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -90,6 +90,14 @@ DECLARE_SW_ROUNDTRIP_TEST(testBadDocm, "bad.docm", nullptr, DocmTest)
CPPUNIT_ASSERT_EQUAL(OUString("MS Word 2007 XML VBA"), pTextDoc->GetDocShell()->GetMedium()->GetFilter()->GetName());
}
+DECLARE_OOXMLEXPORT_TEST(testTdf109063, "tdf109063.docx")
+{
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
+ // This was 1, near-page-width table was imported as a TextFrame.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), xDrawPage->getCount());
+}
+
DECLARE_SW_ROUNDTRIP_TEST(testTdf108269, "tdf108269.docm", nullptr, DocmTest)
{
if (!mbExported)
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index c8cf96bb1f7f..89492db7f002 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1102,7 +1102,11 @@ bool SectionPropertyMap::FloatingTableConversion(DomainMapper_Impl& rDM_Impl, Fl
// If the table is wider than the text area, then don't create a fly
// for the table: no wrapping will be performed anyway, but multi-page
// tables will be broken.
- if (nTableWidth < nTextAreaWidth)
+ // It seems Word has a limit here, so that in case the table width is quite
+ // close to the text area width, then it won't perform a wrapping, even in
+ // case the content (e.g. an empty paragraph) would fit. The magic constant
+ // here represents this limit.
+ if ((nTableWidth + 469) < nTextAreaWidth)
return true;
// If the position is relative to the edge of the page, then we always
More information about the Libreoffice-commits
mailing list