<html>
<head>
<base href="https://bugs.documentfoundation.org/">
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - FILEOPEN: DOCX: URL in comment imported as plain text"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=114854#c3">Comment # 3</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - FILEOPEN: DOCX: URL in comment imported as plain text"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=114854">bug 114854</a>
from <span class="vcard"><a class="email" href="mailto:jluth@mail.com" title="Justin L <jluth@mail.com>"> <span class="fn">Justin L</span></a>
</span></b>
<pre>(In reply to Justin L from <a href="show_bug.cgi?id=114854#c0">comment #0</a>)
<span class="quote">> The same code is used for setting the URL property in regular
> text and works fine there.</span >
Normal text uses SwTextCursor, while the draw-based cursor uses
SvxUnoTextRangeBase.
Since .doc format worked, I found that it uses Draw to ImportAsOutliner
m_pDrawEditEngine->QuickInsertField(SvxFieldItem(aURL, EE_FEATURE_FIELD),
aSel);
That suggests doing something like this
#include <editeng/flditem.hxx>
#include <editeng/unotext.hxx>
SvxUnoTextRangeBase* pDrawText =
dynamic_cast<SvxUnoTextRangeBase*>(xCrsr.get());
if ( pDrawText )
pDrawText->attachField(
std::make_unique<SvxURLField>(pContext->GetHyperlinkURL(), "the displayed
text", SvxURLFormat::AppDefault) );</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>