diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-02-14 09:32:25 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-02-14 10:34:51 +0100 |
commit | 31de0ac30d6c521ad663db78feb936688be5bccb (patch) | |
tree | 93ab8832cecd7fd417ff5a208a8e9d0fb3929f57 /writerfilter/source | |
parent | 3713c17ee474af6bcb22c219ab81108411083fa0 (diff) |
RTF import: handle target of hyperlink
lcov pointed out that there is no testcase for the export of this, and
turns out the import part wasn't implemented. As a side effect this
implements the same for DOCX import as well.
Change-Id: I016ebc100ec3856bf3a43aea8ea55af72c2ead1e
Diffstat (limited to 'writerfilter/source')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 9 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.hxx | 4 |
2 files changed, 13 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 09da1b3bb345..334814bc398b 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -3868,6 +3868,7 @@ void DomainMapper_Impl::CloseFieldCommand() ::std::vector<OUString>::const_iterator aPartIt = aParts.begin(); OUString sURL; + OUString sTarget; while (aPartIt != aItEnd) { @@ -3889,6 +3890,8 @@ void DomainMapper_Impl::CloseFieldCommand() if (aPartIt == aItEnd) break; + + sTarget = *aPartIt; } else { @@ -3916,6 +3919,9 @@ void DomainMapper_Impl::CloseFieldCommand() } pContext->SetHyperlinkURL(sURL); } + + if (!sTarget.isEmpty()) + pContext->SetHyperlinkTarget(sTarget); } break; case FIELD_IF : break; @@ -4579,6 +4585,9 @@ void DomainMapper_Impl::PopFieldContext() 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)); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index cce9d590b463..bfa2a5bd7e60 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -150,6 +150,8 @@ class FieldContext css::uno::Reference<css::beans::XPropertySet> m_xTC; // TOX entry css::uno::Reference<css::beans::XPropertySet> m_xCustomField; OUString m_sHyperlinkURL; + /// A frame for the the hyperlink when one exists. + OUString m_sHyperlinkTarget; FFDataHandler::Pointer_t m_pFFDataHandler; FormControlHelper::Pointer_t m_pFormControlHelper; /// (Character) properties of the field itself. @@ -188,6 +190,8 @@ public: void SetHyperlinkURL( const OUString& rURL ) { m_sHyperlinkURL = rURL; } const OUString& GetHyperlinkURL() { return m_sHyperlinkURL; } + void SetHyperlinkTarget(const OUString& rTarget) { m_sHyperlinkTarget = rTarget; } + const OUString& GetHyperlinkTarget() { return m_sHyperlinkTarget; } void setFFDataHandler(FFDataHandler::Pointer_t pFFDataHandler) { m_pFFDataHandler = pFFDataHandler; } const FFDataHandler::Pointer_t& getFFDataHandler() const { return m_pFFDataHandler; } |