sw/qa/extras/rtfexport/data/tdf116358.rtf      |  116 +++++++++++++++++++++++++
 sw/qa/extras/rtfexport/rtfexport4.cxx          |   30 ++++++
 sw/rtfexport_setup.mk                          |    1 
 writerfilter/source/dmapper/SettingsTable.cxx  |    6 -
 writerfilter/source/filter/WriterFilter.cxx    |    1 
 writerfilter/source/rtftok/rtfdispatchflag.cxx |    3 
 6 files changed, 152 insertions(+), 5 deletions(-)

New commits:
commit 4ef50c9ac03960c694c50e5a7488693422503357
Author:     Vasily Melenchuk <vasily.melenc...@cib.de>
AuthorDate: Wed Mar 30 13:09:19 2022 +0300
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Apr 1 08:38:32 2022 +0200

    tdf#116358: rtf import: "keep with next" also affects table rows
    
    Like in DOCX for RTF there is exactly same behavior for paragraphs
    inside cells. They do affect table breaking over the pages.
    
    So:
    1) Enable "TableRowKeep" doc setting for RTF documents.
    2) Do not ignore \keepn token for paragraphs in tables.
    
    Change-Id: I11e45ca9114c792b8cdbeb77dd51359717129651
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132305
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132355

diff --git a/sw/qa/extras/rtfexport/data/tdf116358.rtf 
b/sw/qa/extras/rtfexport/data/tdf116358.rtf
new file mode 100644
index 000000000000..09a9b3f8ead8
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf116358.rtf
@@ -0,0 +1,116 @@
+{\rtf1\ansi\deff3\adeflang1025
+{\fonttbl{\f0\froman\fprq2\fcharset0 Times New 
Roman;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fprq2\fcharset0 
Arial;}{\f3\froman\fprq2\fcharset204 Liberation Serif{\*\falt Times New 
Roman};}{\f4\froman\fprq2\fcharset204 Times New 
Roman;}{\f5\froman\fprq2\fcharset204 Liberation Sans{\*\falt 
Arial};}{\f6\fnil\fprq2\fcharset204 Microsoft 
YaHei;}{\f7\fnil\fprq2\fcharset204 0;}{\f8\fnil\fprq2\fcharset204 Times New 
Roman;}{\f9\fnil\fprq2\fcharset204 Lucida Sans;}}
+{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
+{\stylesheet{\s0\snext0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052
 Normal;}
+{\s15\sbasedon0\snext16\rtlch\af9\afs28\alang1081 
\ltrch\lang2057\langfe2052\hich\af5\loch\ql\widctlpar\hyphpar0\sb240\sa120\keepn\ltrpar\cf0\f5\fs28\lang2057\kerning1\dbch\af6\langfe2052
 Heading;}
+{\s16\sbasedon0\snext16\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\sl276\slmult1\ql\widctlpar\hyphpar0\sb0\sa140\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052
 Text Body;}
+{\s17\sbasedon16\snext17\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\sl276\slmult1\ql\widctlpar\hyphpar0\sb0\sa140\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052
 List;}
+{\s18\sbasedon0\snext18\rtlch\af9\afs24\alang1081\ai 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\sb120\sa120\ltrpar\cf0\f3\fs24\lang2057\i\kerning1\dbch\af7\langfe2052
 Caption;}
+{\s19\sbasedon0\snext19\rtlch\af9\afs24\alang255 
\ltrch\lang255\langfe255\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang255\kerning1\dbch\af7\langfe255
 Index;}
+{\s20\sbasedon0\snext20\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\nowidctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052
 Table Contents;}
+}{\*\generator LibreOfficeDev/7.4.0.0.alpha0$Windows_X86_64 
LibreOffice_project/1e1cab9d5a0728c13209aeed95b6802175799a0a}{\info{\creatim\yr2022\mo3\dy30\hr9\min3}{\revtim\yr2022\mo3\dy30\hr9\min11}{\printim\yr0\mo0\dy0\hr0\min0}}{\*\userprops}\deftab709
+\hyphauto1\viewscale100
+{\*\pgdsctbl
+{\pgdsc0\pgdscuse451\pgwsxn11906\pghsxn16838\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\pgdscnxt0
 Default Page Style;}}
+\formshade\paperh16838\paperw11906\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\pgndec\sftnnar\saftnnrlc\sectunlocked1\pgwsxn11906\pghsxn16838\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
+{\*\ftnsep\chftnsep}\pgndec\pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052{\loch
+A}
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par \pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch
+
+\par 
\trowd\trql\trleft-15\ltrrow\trpaddft3\trpaddt0\trpaddfl3\trpaddl0\trpaddfb3\trpaddb0\trpaddfr3\trpaddr0\clbrdrt\brdrs\brdrw10\brdrcf1\clpadfl3\clpadl55\clbrdrl\brdrs\brdrw10\brdrcf1\clpadft3\clpadt55\clbrdrb\brdrs\brdrw10\brdrcf1\clpadfb3\clpadb55\clbrdrr\brdrs\brdrw10\brdrcf1\clpadfr3\clpadr55\cellx9623\pard\plain
 \s20\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\nowidctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch\keepn\intbl\nowidctlpar\rtlch\af8\afs24
 \ltrch\hich\af4\loch\cf1\fs24\f4\dbch\af8\loch
+\cell\row\pard\trowd\trql\trleft-15\ltrrow\trpaddft3\trpaddt0\trpaddfl3\trpaddl0\trpaddfb3\trpaddb0\trpaddfr3\trpaddr0\clpadfl3\clpadl55\clbrdrl\brdrs\brdrw10\brdrcf1\clpadft3\clpadt55\clbrdrb\brdrs\brdrw10\brdrcf1\clpadfb3\clpadb55\clbrdrr\brdrs\brdrw10\brdrcf1\clpadfr3\clpadr55\cellx9623\pard\plain
 \s20\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\nowidctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch\keepn\intbl\nowidctlpar\rtlch\af8\afs24
 \ltrch\hich\af4\loch\cf1\fs24\f4\dbch\af8\loch
+\cell\row\pard\pard\plain \s0\rtlch\af9\afs24\alang1081 
\ltrch\lang2057\langfe2052\hich\af3\loch\ql\widctlpar\hyphpar0\ltrpar\cf0\f3\fs24\lang2057\kerning1\dbch\af7\langfe2052\loch\nowidctlpar{\loch
+b}
+\par }
\ No newline at end of file
diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx 
b/sw/qa/extras/rtfexport/rtfexport4.cxx
index 55ae121a695b..32f1a5f88cad 100644
--- a/sw/qa/extras/rtfexport/rtfexport4.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport4.cxx
@@ -25,6 +25,7 @@
 #include <pam.hxx>
 #include <fmtanchr.hxx>
 #include <frameformats.hxx>
+#include <wrtsh.hxx>
 
 using namespace css;
 
@@ -402,6 +403,35 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf126309)
         
static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraph(1), 
"ParaAdjust")));
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf116358, "tdf116358.rtf")
+{
+    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    CPPUNIT_ASSERT(pWrtShell);
+
+    // Insert a paragraph break
+    pWrtShell->SplitNode(false);
+
+    // Entire table should go to page 2, no remains on first page
+    xmlDocUniquePtr pDump = parseLayoutDump();
+    {
+        xmlXPathObjectPtr pXmlObj = getXPathNode(pDump, 
"/root/page[1]/body/tab");
+        xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+        sal_Int32 tablesOnPage = xmlXPathNodeSetGetLength(pXmlNodes);
+        xmlXPathFreeObject(pXmlObj);
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(0), tablesOnPage);
+    }
+
+    {
+        xmlXPathObjectPtr pXmlObj = getXPathNode(pDump, 
"/root/page[2]/body/tab");
+        xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+        sal_Int32 tablesOnPage = xmlXPathNodeSetGetLength(pXmlNodes);
+        xmlXPathFreeObject(pXmlObj);
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(1), tablesOnPage);
+    }
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testGutterLeft)
 {
     load(mpTestDocumentPath, "gutter-left.rtf");
diff --git a/sw/rtfexport_setup.mk b/sw/rtfexport_setup.mk
index 40bbfb62321a..3ea61755d467 100644
--- a/sw/rtfexport_setup.mk
+++ b/sw/rtfexport_setup.mk
@@ -45,6 +45,7 @@ $(eval $(call gb_CppunitTest_use_externals,sw_rtfexport$(1),\
 $(eval $(call gb_CppunitTest_set_include,sw_rtfexport$(1),\
     -I$(SRCDIR)/sw/inc \
     -I$(SRCDIR)/sw/source/core/inc \
+    -I$(SRCDIR)/sw/source/uibase/inc \
     -I$(SRCDIR)/sw/qa/inc \
     $$(INCLUDE) \
 ))
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx 
b/writerfilter/source/dmapper/SettingsTable.cxx
index 732b96ff96db..3e6afe7b5fa1 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -539,11 +539,13 @@ static bool lcl_isDefault(const 
uno::Reference<beans::XPropertyState>& xProperty
 void SettingsTable::ApplyProperties(uno::Reference<text::XTextDocument> const& 
xDoc)
 {
     uno::Reference< beans::XPropertySet> xDocProps( xDoc, uno::UNO_QUERY );
+    uno::Reference<lang::XMultiServiceFactory> xTextFactory(xDoc, 
uno::UNO_QUERY_THROW);
+    uno::Reference<beans::XPropertySet> 
xDocumentSettings(xTextFactory->createInstance("com.sun.star.document.Settings"),
 uno::UNO_QUERY_THROW);
+
+    xDocumentSettings->setPropertyValue("TableRowKeep", uno::makeAny(true));
 
     if (GetWordCompatibilityMode() <= 14)
     {
-        uno::Reference<lang::XMultiServiceFactory> xTextFactory(xDoc, 
uno::UNO_QUERY_THROW);
-        uno::Reference<beans::XPropertySet> 
xDocumentSettings(xTextFactory->createInstance("com.sun.star.document.Settings"),
 uno::UNO_QUERY_THROW);
         xDocumentSettings->setPropertyValue("MsWordCompMinLineHeightByFly", 
uno::makeAny(true));
         xDocumentSettings->setPropertyValue("TabOverMargin", 
uno::makeAny(true));
     }
diff --git a/writerfilter/source/filter/WriterFilter.cxx 
b/writerfilter/source/filter/WriterFilter.cxx
index f62dff1fe19a..945a00f95258 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -314,7 +314,6 @@ void WriterFilter::setTargetDocument(const 
uno::Reference<lang::XComponent>& xDo
     xSettings->setPropertyValue("UseFormerObjectPositioning", 
uno::makeAny(false));
     xSettings->setPropertyValue("ConsiderTextWrapOnObjPos", 
uno::makeAny(true));
     xSettings->setPropertyValue("UseFormerTextWrapping", uno::makeAny(false));
-    xSettings->setPropertyValue("TableRowKeep", uno::makeAny(true));
     xSettings->setPropertyValue("IgnoreTabsAndBlanksForLineCalculation", 
uno::makeAny(true));
     xSettings->setPropertyValue("InvertBorderSpacing", uno::makeAny(true));
     xSettings->setPropertyValue("CollapseEmptyCellPara", uno::makeAny(true));
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx 
b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index 83c5a0966259..3aee1e1dda75 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -421,8 +421,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
                 nParam = NS_ooxml::LN_CT_PPrBase_keepLines;
             break;
         case RTFKeyword::KEEPN:
-            if (m_aStates.top().getCurrentBuffer() != 
&m_aTableBufferStack.back())
-                nParam = NS_ooxml::LN_CT_PPrBase_keepNext;
+            nParam = NS_ooxml::LN_CT_PPrBase_keepNext;
             break;
         case RTFKeyword::INTBL:
         {

Reply via email to