tdf#140668 Crashfix: disregard w:textDirection tag outside frame
DomainMapper_Impl::SetFrameDirection had a false assumption that
a w:textDirection tag will only be encountered when the OOXML
parser is already inside a frame. This is not always the case.
Regression from commit af4e5ee0f93c1ff442d08caed5c875f2b2c1fd43
(tdf#97128 DOCX import: fix frame direction).
Change-Id: I39845599b0c7f502870e2de497df8cbdd4475594
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111594
Tested-by: Jenkins
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf140668.docx b/sw/qa/extras/ooxmlexport/data/tdf140668.docx
new file mode 100644
index 0000000..d707218
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf140668.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index 29798dc..f53078d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -78,6 +78,12 @@
assertXPath(pXmlSettings, "/w:settings/w:gutterAtTop", 1);
}
DECLARE_OOXMLEXPORT_TEST(testTdf140668, "tdf140668.docx")
{
// Don't crash when document is opened
CPPUNIT_ASSERT_EQUAL(1, getPages());
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf134619_numberingProps, "tdf134619_numberingProps.doc")
{
// Get the third paragraph's numbering style's 1st level's bullet size
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 581d2db..4a65482 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -986,8 +986,7 @@
m_bFrameDirectionSet = false;
}
void SetFrameDirection(sal_Int16 nDirection) {
if (!m_bFrameDirectionSet) {
assert(!m_aFrameDirectionQueue.empty());
if (!m_bFrameDirectionSet && !m_aFrameDirectionQueue.empty()) {
m_aFrameDirectionQueue.back() = nDirection;
m_bFrameDirectionSet = true;
}