summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorVojtěch Doležal <dolezvo1@cvut.cz>2023-12-09 11:03:05 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2023-12-14 09:44:14 +0100
commit347e8161ba38822de96851dd7ed92b7e85ac1943 (patch)
tree2f8a2275dbbcc3623023ab1eeba6144cf429d872 /sw
parent309558858d2b37cbad04b3000391ad9ba570708d (diff)
tdf#158505 - Fix PDF export when bibliography is last paragraph
Change-Id: Iadafff97ba19d5c24be768238bddb4d684edde1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160509 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit 94d18ea557a03c1f2d450454908787f7d3af8a6e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160646 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/core/text/data/tdf158505.odtbin0 -> 21879 bytes
-rw-r--r--sw/qa/core/text/text.cxx12
-rw-r--r--sw/source/core/text/EnhancedPDFExportHelper.cxx5
-rw-r--r--sw/source/uibase/shells/textidx.cxx6
4 files changed, 22 insertions, 1 deletions
diff --git a/sw/qa/core/text/data/tdf158505.odt b/sw/qa/core/text/data/tdf158505.odt
new file mode 100644
index 000000000000..c9a71033a2de
--- /dev/null
+++ b/sw/qa/core/text/data/tdf158505.odt
Binary files differ
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 7340a151d1f4..666e6d29f250 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -103,6 +103,18 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testSemiTransparentText)
assertXPath(pXmlDoc, "//floattransparent"_ostr);
}
+CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testLastBibliographyPdfExport)
+{
+ // Given a document with a bibliography as the last paragraph:
+ createSwDoc("tdf158505.odt");
+
+ // It should be possible to export to PDF:
+ save("writer_pdf_Export");
+
+ // Without the accompanying fix, the export to PDF would get stuck in an infinite loop
+ CPPUNIT_ASSERT(true);
+}
+
CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testBibliographyUrlPdfExport)
{
// Given a document with a bibliography entry field:
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 2bf5ca3f883d..499dcc24178a 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -2825,7 +2825,10 @@ void SwEnhancedPDFExportHelper::ExportAuthorityEntryLinks()
}
}
}
- mrSh.MovePara(GoNextPara, fnParaStart);
+ if (!mrSh.MovePara(GoNextPara, fnParaStart))
+ { // Cursor is stuck in the TOX due to document ending immediately afterwards
+ break;
+ }
}
}
}
diff --git a/sw/source/uibase/shells/textidx.cxx b/sw/source/uibase/shells/textidx.cxx
index 45d9df2c70b6..35642a73f198 100644
--- a/sw/source/uibase/shells/textidx.cxx
+++ b/sw/source/uibase/shells/textidx.cxx
@@ -127,6 +127,12 @@ void SwTextShell::ExecIdx(SfxRequest const &rReq)
rShell.GetCursor_()->GetPoint()->Assign(*pTableRowNode);
rShell.UpdateTableOf(*pCurrentTOX);
}
+ else
+ {
+ // I think this ideally should be a pop-up warning, right?
+ SAL_WARN("sw", "No matching bibliography mark found. "
+ "This feature is only guaranteed to work if the bibliography table is up to date.");
+ }
}
}