tdf#154481 sw DOCX import: fix page loss and freezing at ODT export
Disable TOC creation in case when field context stack is empty but TOC creation is in progress in textboxes. Before if TOC creation failed because it is already existed, the TOC creation member (mbStartTOC) kept true resulting in broken textbox handling. Textbox and TOC import use the same text append stack but the TOC was not removed from the stack so content have been written into the TOC instead of the textbox, resulting page loss, and because of the broken structure, freezing at further ODT export. Change-Id: If27aa477c49f276d4e538b6e125798d89f0ac423 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150099 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
This commit is contained in:
committed by
László Németh
parent
52aa464685
commit
94de79e7d3
Binary file not shown.
@@ -1083,6 +1083,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf148132, "tdf148132.docx")
|
||||
}
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(Test, testTdf154481)
|
||||
{
|
||||
createSwDoc("tdf154481.docx");
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE("Missing pages!", 7, getPages());
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(Test, testTdf149200)
|
||||
{
|
||||
loadAndSave("tdf149200.docx");
|
||||
|
||||
@@ -5189,6 +5189,15 @@ void DomainMapper_Impl::PushTextBoxContent()
|
||||
if (m_bIsInTextBox)
|
||||
return;
|
||||
|
||||
// tdf#154481: check for TOC creation with empty field stack,
|
||||
// and close TOC, unless pages will lost. FIXME.
|
||||
if (IsInTOC() && m_aFieldStack.size() == 0)
|
||||
{
|
||||
m_bStartTOC = false;
|
||||
SAL_WARN("writerfilter.dmapper",
|
||||
"broken TOC creation in textbox, but field stack is empty, so closing TOC!");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
uno::Reference<text::XTextFrame> xTBoxFrame(
|
||||
|
||||
Reference in New Issue
Block a user