sw/qa/extras/rtfimport/data/fdo86750.rtf | 4 ++++ sw/qa/extras/rtfimport/rtfimport.cxx | 6 ++++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 9 +++++++++ 3 files changed, 19 insertions(+)
New commits: commit 3a2a74a48405d6d3423c06f9752c2254684d7770 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Mon Dec 8 09:16:22 2014 +0100 fdo#86750 RTF import: fix table of contents links (cherry picked from commit 4517c94000153eab6c034ea548698953dd93f794) Change-Id: I0f3d35a0e64c9ce5646fa63eda317bee42de5540 Reviewed-on: https://gerrit.libreoffice.org/13372 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/qa/extras/rtfimport/data/fdo86750.rtf b/sw/qa/extras/rtfimport/data/fdo86750.rtf new file mode 100644 index 0000000..29f0b84 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo86750.rtf @@ -0,0 +1,4 @@ +{\rtf1 +{\field{\*\fldinst { HYPERLINK \\l "anchor" }}{\fldrslt click}}\par +{\*\bkmkstart anchor}target{\*\bkmkend anchor}\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index e3fddac..416b01a 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -2054,6 +2054,12 @@ DECLARE_RTFIMPORT_TEST(testFdo72031, "fdo72031.rtf") CPPUNIT_ASSERT_EQUAL(aExpected, getRun(getParagraph(1), 1)->getString()); } +DECLARE_RTFIMPORT_TEST(testFdo86750, "fdo86750.rtf") +{ + // This was 'HYPERLINK#anchor', the URL of the hyperlink had the field type as a prefix, leading to broken links. + CPPUNIT_ASSERT_EQUAL(OUString("#anchor"), getProperty<OUString>(getRun(getParagraph(1), 1), "HyperLinkURL")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index c3343f1..1654744 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -3577,6 +3577,15 @@ void DomainMapper_Impl::CloseFieldCommand() case FIELD_HYPERLINK: { ::std::vector<OUString> aParts = pContext->GetCommandParts(); + + // Syntax is either: + // HYPERLINK "" \l "link" + // or + // HYPERLINK \l "link" + // Make sure "HYPERLINK" doesn't end up as part of link in the second case. + if (!aParts.empty() && aParts[0] == "HYPERLINK") + aParts.erase(aParts.begin()); + ::std::vector<OUString>::const_iterator aItEnd = aParts.end(); ::std::vector<OUString>::const_iterator aPartIt = aParts.begin();
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits