sw/source/filter/ww8/rtfattributeoutput.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
New commits: commit e8228e0994610fed8af090ff30ffc08bfecb7261 Author: Justin Luth <jl...@mail.com> AuthorDate: Tue Oct 31 16:26:50 2023 -0400 Commit: Justin Luth <jl...@mail.com> CommitDate: Wed Nov 1 02:28:15 2023 +0100 tdf#108318 rtfexport: no hyperlink target for clipboard This fixes copying hyperlinks from Writer to the other apps like Calc or even to editeng components within Writer. External apps never seem to call for RTF clipboard. Certainly firefox doesn't - and everything I tested seems to just request plain text URL strings. I don't see anywhere in the RTF specification that a \fldinst can take formatting parameters along with the URL. That is likely only a DOCX thing. But since RTF shares import code with DOCX, it gets the parsing for free, so we explicitly use it to round-trip targets in RTF. See commit 31de0ac30d6c521ad663db78feb936688be5bccb Author: Miklos Vajna on Tue Feb 14 09:32:25 2017 +0100 RTF import: handle target of hyperlink Alternatively I could have had editeng parse the flags on clipboard RTF import, but handling it at export seemed cleaner to me. Change-Id: Ic34bcf99edf7bd3fb404ed312c07acae0ef814e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158744 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index c3ec71eaaa30..afcdbdf0e761 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -561,7 +561,9 @@ bool RtfAttributeOutput::StartURL(const OUString& rUrl, const OUString& rTarget) m_aRun->append(msfilter::rtfutil::OutString(rUrl, m_rExport.GetCurrentEncoding())); m_aRun->append("\" "); - if (!rTarget.isEmpty()) + // Adding the target is likely a LO embellishment. + // Don't export it to clipboard, since editeng and other RTF readers won't understand it. + if (!rTarget.isEmpty() && !m_rExport.m_rDoc.IsClipBoard()) { m_aRun->append("\\\\t \""); m_aRun->append(msfilter::rtfutil::OutString(rTarget, m_rExport.GetCurrentEncoding()));