diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-10-01 17:31:21 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-10-05 19:37:50 +0200 |
commit | e366c928819c44b5c253c45dca6dae40b71c9808 (patch) | |
tree | 57ad0dd8bdb3e819fe4d3155a839504c57345ca3 /sw/source/filter/xml/xmlimp.cxx | |
parent | 2ad4e77a0f266ae6e6fccaebb1d080d2880bdac3 (diff) |
sw: ODF import: convert the simplest sub-tables to rowspan tables
Before OOo 2.3, CWS swnewtable, Writer represented complex table
structures as sub-tables, i.e. <table:table table:is-sub-table="true">.
Try to convert these to the modern rowspan tables, which export to
non-ODF formats much easier.
There are some cases where the result is going to look different, or
where further work is required to adapt other things in the document;
leave these alone for now.
Change-Id: I6a6c497089ef886826484d2d723bf57c72f95b14
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103773
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw/source/filter/xml/xmlimp.cxx')
-rw-r--r-- | sw/source/filter/xml/xmlimp.cxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 2d591f122e57..2123f35fad9e 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -950,6 +950,22 @@ void SwXMLImport::endDocument() } } +#if 1 + if (!pDoc) { pDoc = SwImport::GetDocFromXMLImport(*this); } + for (sal_uLong i = 0; i < pDoc->GetNodes().Count(); ++i) + { + if (SwTableNode *const pTableNode = pDoc->GetNodes()[i]->GetTableNode()) + { + if (!pTableNode->GetTable().IsNewModel() + && pTableNode->GetTable().CanConvertSubtables()) + { + pTableNode->GetTable().ConvertSubtables(); + } + } + // don't skip to the end; nested tables could have subtables too... + } +#endif + // delegate to parent: takes care of error handling SvXMLImport::endDocument(); ClearTextImport(); |