tdf#156560 Fix assertion failure editing RTL header
Clicking on an RTL header previously lead to assertion failure, but now
it is checked if the SwFrame pointer is null. If so, an empty vector is
returned.
It should be noted that the rendering of the rtl header in the
attachment 188689 is still wrong as the text and image are misplaced.
A test is added to the patch, and can be run using:
make CppunitTest_sw_uiwriter8 CPPUNIT_TEST_NAME=testTdf156560
Change-Id: I9e8f66895b4ef9369300c9d7c03d22a2085a1d71
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155159
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
diff --git a/sw/qa/extras/uiwriter/data/tdf156560.docx b/sw/qa/extras/uiwriter/data/tdf156560.docx
new file mode 100755
index 0000000..8cfd550
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf156560.docx
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx b/sw/qa/extras/uiwriter/uiwriter8.cxx
index 48b17ef..621fecc 100644
--- a/sw/qa/extras/uiwriter/uiwriter8.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter8.cxx
@@ -2674,6 +2674,22 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf62032ApplyStyle)
getProperty<OUString>(getParagraph(2), "ListLabelString").trim());
}
CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf156560)
{
createSwDoc("tdf156560.docx");
uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"),
uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xPageStyle, "HeaderIsOn"));
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_MOD1 | KEY_PAGEUP);
// Insert header
// Without the fix in place, this test would have got SIGABRT here
dispatchCommand(mxComponent, ".uno:InsertHeader", {});
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 7c757e4..8b44b33 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -7070,6 +7070,10 @@ std::vector<basegfx::B2DPolygon> SwPageFrame::GetSubsidiaryLinesPolygons(const S
const SwFrame* pLay = Lower();
const SwFrame* pFootnoteCont = nullptr;
const SwFrame* pPageBody = nullptr;
if (!pLay)
return aPolygons;
while ( pLay && !( pFootnoteCont && pPageBody ) )
{
if ( pLay->IsFootnoteContFrame( ) )