diff options
author | Justin Luth <justin.luth@collabora.com> | 2019-08-07 15:51:07 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2019-08-13 06:35:03 +0200 |
commit | 75b10a6c36267c30ae01c850b2a2f9ee99b74e43 (patch) | |
tree | 0e38739a1e2bfd8b03aa3acd94d39077540f06b3 /writerfilter | |
parent | c8e64ea4fd0122dad9d4f06bacffd1c179e753f8 (diff) |
tdf#114854 writerfilter: EditEng URLs import different from SW URLs
The only example I found was comments (aka annotations/postits).
No other unit tests had a URL in a draw component.
Change-Id: Iad5c285090d646c495cd2a7b19e076d9e50fb58d
Reviewed-on: https://gerrit.libreoffice.org/77108
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index e077d2bed52f..7e4728af2bac 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -71,6 +71,8 @@ #include <com/sun/star/text/XTextColumns.hpp> #include <com/sun/star/awt/CharSet.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <editeng/flditem.hxx> +#include <editeng/unotext.hxx> #include <o3tl/temporary.hxx> #include <oox/mathml/import.hxx> #include <rtl/uri.hxx> @@ -5247,24 +5249,31 @@ void DomainMapper_Impl::PopFieldContext() { xCrsr->gotoEnd( true ); - uno::Reference< beans::XPropertySet > xCrsrProperties( xCrsr, uno::UNO_QUERY_THROW ); - xCrsrProperties->setPropertyValue(getPropertyName(PROP_HYPER_LINK_U_R_L), uno:: - makeAny(pContext->GetHyperlinkURL())); - - if (!pContext->GetHyperlinkTarget().isEmpty()) - xCrsrProperties->setPropertyValue("HyperLinkTarget", uno::makeAny(pContext->GetHyperlinkTarget())); - - if (m_bStartTOC) { - OUString sDisplayName("Index Link"); - xCrsrProperties->setPropertyValue("VisitedCharStyleName",uno::makeAny(sDisplayName)); - xCrsrProperties->setPropertyValue("UnvisitedCharStyleName",uno::makeAny(sDisplayName)); - } + // Draw components (like comments) need hyperlinks set differently + SvxUnoTextRangeBase* pDrawText = dynamic_cast<SvxUnoTextRangeBase*>(xCrsr.get()); + if ( pDrawText ) + pDrawText->attachField( std::make_unique<SvxURLField>(pContext->GetHyperlinkURL(), xCrsr->getString(), SvxURLFormat::AppDefault) ); else { - if (!pContext->GetHyperlinkStyle().isEmpty()) + uno::Reference< beans::XPropertySet > xCrsrProperties( xCrsr, uno::UNO_QUERY_THROW ); + xCrsrProperties->setPropertyValue(getPropertyName(PROP_HYPER_LINK_U_R_L), uno:: + makeAny(pContext->GetHyperlinkURL())); + + if (!pContext->GetHyperlinkTarget().isEmpty()) + xCrsrProperties->setPropertyValue("HyperLinkTarget", uno::makeAny(pContext->GetHyperlinkTarget())); + + if (m_bStartTOC) { + OUString sDisplayName("Index Link"); + xCrsrProperties->setPropertyValue("VisitedCharStyleName",uno::makeAny(sDisplayName)); + xCrsrProperties->setPropertyValue("UnvisitedCharStyleName",uno::makeAny(sDisplayName)); + } + else { - xCrsrProperties->setPropertyValue("VisitedCharStyleName", uno::makeAny(pContext->GetHyperlinkStyle())); - xCrsrProperties->setPropertyValue("UnvisitedCharStyleName", uno::makeAny(pContext->GetHyperlinkStyle())); + if (!pContext->GetHyperlinkStyle().isEmpty()) + { + xCrsrProperties->setPropertyValue("VisitedCharStyleName", uno::makeAny(pContext->GetHyperlinkStyle())); + xCrsrProperties->setPropertyValue("UnvisitedCharStyleName", uno::makeAny(pContext->GetHyperlinkStyle())); + } } } } |