[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sw/qa sw/source
Vasily Melenchuk (via logerrit)
logerrit at kemper.freedesktop.org
Mon Oct 4 08:15:34 UTC 2021
sw/qa/extras/rtfexport/data/tdf144437.odt |binary
sw/qa/extras/rtfexport/rtfexport5.cxx | 20 ++++++++++++++++++++
sw/source/filter/ww8/rtfattributeoutput.cxx | 12 ++++++------
3 files changed, 26 insertions(+), 6 deletions(-)
New commits:
commit 4ec287e91e25dca9a097f4ad896e6456c9ead87d
Author: Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Mon Sep 27 19:00:49 2021 +0300
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Oct 4 10:14:58 2021 +0200
tdf#144437: rtf export: bookmark position is written to current run
Bookmark was written to not current position thus did appear not at
desired place inside paragraph.
Change-Id: I917f74c95666efd38c5befeb927b75783915b2e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122722
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
(cherry picked from commit 732b3fd5bdf17f09b5f9304b470b741e5483eab1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122932
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sw/qa/extras/rtfexport/data/tdf144437.odt b/sw/qa/extras/rtfexport/data/tdf144437.odt
new file mode 100644
index 000000000000..ef303aa7c521
Binary files /dev/null and b/sw/qa/extras/rtfexport/data/tdf144437.odt differ
diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx
index ad392be7fb75..efa2740020fc 100644
--- a/sw/qa/extras/rtfexport/rtfexport5.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport5.cxx
@@ -1283,6 +1283,26 @@ DECLARE_RTFEXPORT_TEST(testTdf138779, "tdf138779.docx")
CPPUNIT_ASSERT_EQUAL(11.f, getProperty<float>(getRun(getParagraph(2), 14), "CharHeight"));
}
+DECLARE_RTFEXPORT_TEST(testTdf144437, "tdf144437.odt")
+{
+ SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
+ CPPUNIT_ASSERT(pStream);
+ OString aRtfContent(read_uInt8s_ToOString(*pStream, pStream->TellEnd()));
+
+ sal_Int32 nTextEndPos = aRtfContent.indexOf("Bookmark here->", 0) + 14;
+ CPPUNIT_ASSERT_MESSAGE("Para content wasn't found in file", nTextEndPos > 0);
+
+ sal_Int32 nBmkStartPos = aRtfContent.indexOf("{\\*\\bkmkstart bookmark}", 0);
+ CPPUNIT_ASSERT_MESSAGE("Bookmark start wasn't found in file", nBmkStartPos > 0);
+
+ sal_Int32 nBmkEndPos = aRtfContent.indexOf("{\\*\\bkmkend bookmark}", 0);
+ CPPUNIT_ASSERT_MESSAGE("Bookmark end wasn't found in file", nBmkEndPos > 0);
+
+ CPPUNIT_ASSERT_MESSAGE("Bookmark started in wrong position", nBmkStartPos > nTextEndPos);
+ CPPUNIT_ASSERT_MESSAGE("Bookmark ended in wrong position", nBmkEndPos > nTextEndPos);
+ CPPUNIT_ASSERT_MESSAGE("Bookmark start & end are wrong", nBmkEndPos > nBmkStartPos);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 34e6cabd0591..1f607e559c04 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1719,17 +1719,17 @@ void RtfAttributeOutput::WriteBookmarks_Impl(std::vector<OUString>& rStarts,
{
for (const auto& rStart : rStarts)
{
- m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_BKMKSTART " ");
- m_aRun->append(msfilter::rtfutil::OutString(rStart, m_rExport.GetCurrentEncoding()));
- m_aRun->append('}');
+ m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_BKMKSTART " ");
+ m_aRunText->append(msfilter::rtfutil::OutString(rStart, m_rExport.GetCurrentEncoding()));
+ m_aRunText->append('}');
}
rStarts.clear();
for (const auto& rEnd : rEnds)
{
- m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_BKMKEND " ");
- m_aRun->append(msfilter::rtfutil::OutString(rEnd, m_rExport.GetCurrentEncoding()));
- m_aRun->append('}');
+ m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_BKMKEND " ");
+ m_aRunText->append(msfilter::rtfutil::OutString(rEnd, m_rExport.GetCurrentEncoding()));
+ m_aRunText->append('}');
}
rEnds.clear();
}
More information about the Libreoffice-commits
mailing list