diff options
author | Attila Bakos (NISZ) <bakos.attilakaroly@nisz.hu> | 2023-04-06 13:34:42 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2023-04-13 17:18:58 +0200 |
commit | 94de79e7d3c980b576192d2f264bee658716163a (patch) | |
tree | 3f56f791878056be024f4578388ba49c29ca194d | |
parent | 52aa46468531918eabfa2031dedf50377ae72cf7 (diff) |
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>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf154481.docx | bin | 0 -> 46878 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 6 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 9 |
3 files changed, 15 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf154481.docx b/sw/qa/extras/ooxmlexport/data/tdf154481.docx Binary files differnew file mode 100644 index 000000000000..bfbfeda7687a --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf154481.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index 890f1104ee9b..fed8066f87f8 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -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"); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 6a7e9a405ee1..f76ca11b01a1 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -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( |