partial revert tdf#153178 writerfilter: do not create text frame spuriously2
If HoriAlign/VertAlign are defined, that is enough to create a frame.
This fixes mstahl's 7.6.4 regression originating with
commit 4e2f2489c4c7436f8b3a21a530bc625cbef4e365
make CppunitTest_sw_rtfexport8 CPPUNIT_TEST_NAME=testTdf158586_lostFrame
Change-Id: Ibb639673cebcd8d5ec79f5551a5703caf948e0d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160744
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
diff --git a/sw/qa/extras/rtfexport/data/tdf158586_lostFrame.rtf b/sw/qa/extras/rtfexport/data/tdf158586_lostFrame.rtf
new file mode 100644
index 0000000..cedfd81
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf158586_lostFrame.rtf
@@ -0,0 +1,17 @@
{\rtf1
\paperw8419\paperh5953
\spltpgpar
\ltrpar \sectd
\pard\plain \posxc\posyc First page textbox \par
\pard 1st page
\page \sect \sectd \sbknone
\pard\plain 2nd page
\par
}
diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx b/sw/qa/extras/rtfexport/rtfexport8.cxx
index bcba0a9..f8d8003 100644
--- a/sw/qa/extras/rtfexport/rtfexport8.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport8.cxx
@@ -73,6 +73,17 @@ DECLARE_RTFEXPORT_TEST(testTdf158586_1, "tdf158586_pageBreak1.rtf")
// assertXPathContent(pLayout, "//page[2]/body/txt"_ostr, "Second page");
}
DECLARE_RTFEXPORT_TEST(testTdf158586_lostFrame, "tdf158586_lostFrame.rtf")
{
// The anchor and align properties are sufficient to define a frame
const auto& pLayout = parseLayoutDump();
assertXPath(pLayout, "//anchored"_ostr, 1);
assertXPathContent(pLayout, "//page[1]/body//txt"_ostr, "1st page");
// assertXPathContent(pLayout, "//page[2]/body//txt"_ostr, "2nd page");
// CPPUNIT_ASSERT_EQUAL(2, getPages());
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 0abbcca..f760afd 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -4010,7 +4010,9 @@ bool RTFFrame::hasProperties() const
{
// tdf#153178 \dxfrtext \dfrmtxtx \dfrmtxty \wrapdefault do *not* create frame
return m_nX != 0 || m_nY != 0 || m_nW != 0 || m_nH != 0
|| (m_nHoriAlign && m_nHoriAlign != NS_ooxml::LN_Value_doc_ST_XAlign_left)
|| (m_nHoriAnchor && m_nHoriAnchor != NS_ooxml::LN_Value_doc_ST_HAnchor_text)
|| (m_nVertAlign && m_nVertAlign != NS_ooxml::LN_Value_doc_ST_YAlign_inline)
|| (m_nVertAnchor && m_nVertAnchor != NS_ooxml::LN_Value_doc_ST_VAnchor_margin)
|| (m_oWrap && *m_oWrap != NS_ooxml::LN_Value_doc_ST_Wrap_auto);
}