summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2015-11-27 06:50:18 +0300
committerJustin Luth <justin_luth@sil.org>2015-12-14 04:41:32 +0000
commit4ec0cc0781312d908a46dca382fae8e416753756 (patch)
tree8c3270ba9d01b2aeb59b08fba185c96fd3c42bcf
parent63feac2a3264ead8f52148644b14078a4be5a2b9 (diff)
tdf#91083 - .doc: emulate table kept-with-next not splitting
An .odt table can “keep with next paragraph”. This means that the entire table may shift to the next page and all the rows will keep together as the table attempts to stay on the same page as the following paragraph. There is no “keep with next” property for .doc tables, but each row CAN be kept with the following one. When exporting an .odt file to .doc, setting each row like this will keep the text flow similar to the original .odt's layout. This commit only hinders the table from splitting - it does not actually affect keeping with the following paragraph. This functionality already exists in the code, but was broken by a variable that “changed meaning” almost as soon as the functionality was introduced. A followup commit will deal with "full page" situations when the kept sections are too large to fit on a single page and so the table should split instead of start a new page. The only situation that can't be handled nicely is a single table kept-with-next that spans more than one page. Such tables ought not be marked as keep-with-next anyway. Change-Id: I401772b3fa2e329b7b0890e67639cbca8c845206 Reviewed-on: https://gerrit.libreoffice.org/20217 Reviewed-by: Justin Luth <justin_luth@sil.org> Tested-by: Justin Luth <justin_luth@sil.org>
-rw-r--r--sw/qa/extras/ww8export/data/tdf91083.odtbin0 -> 19865 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export.cxx6
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx2
3 files changed, 7 insertions, 1 deletions
diff --git a/sw/qa/extras/ww8export/data/tdf91083.odt b/sw/qa/extras/ww8export/data/tdf91083.odt
new file mode 100644
index 000000000000..e4f55e58acf0
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf91083.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index 53a151302f49..1bb1236b02c8 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -591,6 +591,12 @@ DECLARE_WW8EXPORT_TEST(testCommentExport, "comment-export.odt")
}
}
+DECLARE_WW8EXPORT_TEST(testTableKeep, "tdf91083.odt")
+{
+ //emulate table "keep with next" -do not split table
+ CPPUNIT_ASSERT_EQUAL( OUString("Row 1"), parseDump("/root/page[5]/body/tab[1]/row[2]/cell[1]/txt[1]") );
+}
+
DECLARE_WW8EXPORT_TEST(testMoveRange, "fdo66304-1.odt")
{
//the save must survive without asserting
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 05c44e390b09..e0958e332da2 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2683,7 +2683,7 @@ void MSWordExportBase::OutputTextNode( const SwTextNode& rNode )
}
// #i76520# Emulate non-splitting tables
- if ( m_bOutTable )
+ if ( IsInTable() )
{
const SwTableNode* pTableNode = rNode.FindTableNode();