summaryrefslogtreecommitdiffstats
path: root/sw/source/filter/ww8/rtfattributeoutput.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-04-21 17:00:57 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-04-21 18:28:17 +0200
commit7d42346ba77c9c4df241ea40eaf550993ca18783 (patch)
treef67f358a37c298271dd7c8a488244c331b0346c5 /sw/source/filter/ww8/rtfattributeoutput.cxx
parentSwTxtAttr::dumpAsXml: show hyperlink URLs (diff)
downloadcore-7d42346ba77c9c4df241ea40eaf550993ca18783.tar.gz
core-7d42346ba77c9c4df241ea40eaf550993ca18783.zip
tdf#90421 RTF export: ignore hyperlinks without an URL
Commit fe444d1f74abe417962be0bcd3340f40f2446b58 (fdo#62536: sw: fix AutoCorrect bold/underline on existing AUTOFMT, 2013-06-20) adds an empty inet format hint on the text node during autocorrection, on export we can safely ignore that to provide well-formed output. Change-Id: Iafae941a13e29dcc7d8b4bade5ce94a486b59638
Diffstat (limited to 'sw/source/filter/ww8/rtfattributeoutput.cxx')
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx74
1 files changed, 40 insertions, 34 deletions
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 54ab98449ca0..6290ae0bd061 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -423,52 +423,58 @@ void RtfAttributeOutput::EndRuby()
bool RtfAttributeOutput::StartURL(const OUString& rUrl, const OUString& rTarget)
{
- m_aStyles.append('{');
- m_aStyles.append(OOO_STRING_SVTOOLS_RTF_FIELD);
- m_aStyles.append('{');
- m_aStyles.append(OOO_STRING_SVTOOLS_RTF_IGNORE);
- m_aStyles.append(OOO_STRING_SVTOOLS_RTF_FLDINST);
- m_aStyles.append(" HYPERLINK ");
-
- OUString sURL(rUrl);
- if (!sURL.isEmpty())
+ m_sURL = rUrl;
+ // Ignore hyperlink without an URL.
+ if (!rUrl.isEmpty())
{
+ m_aStyles.append('{');
+ m_aStyles.append(OOO_STRING_SVTOOLS_RTF_FIELD);
+ m_aStyles.append('{');
+ m_aStyles.append(OOO_STRING_SVTOOLS_RTF_IGNORE);
+ m_aStyles.append(OOO_STRING_SVTOOLS_RTF_FLDINST);
+ m_aStyles.append(" HYPERLINK ");
+
+ OUString sURL(rUrl);
m_aStyles.append("\"");
m_aStyles.append(msfilter::rtfutil::OutString(sURL, m_rExport.eCurrentEncoding));
m_aStyles.append("\" ");
- }
- if (!rTarget.isEmpty())
- {
- m_aStyles.append("\\\\t \"");
- m_aStyles.append(msfilter::rtfutil::OutString(rTarget, m_rExport.eCurrentEncoding));
- m_aStyles.append("\" ");
- }
+ if (!rTarget.isEmpty())
+ {
+ m_aStyles.append("\\\\t \"");
+ m_aStyles.append(msfilter::rtfutil::OutString(rTarget, m_rExport.eCurrentEncoding));
+ m_aStyles.append("\" ");
+ }
- m_aStyles.append("}");
- m_aStyles.append("{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " {");
+ m_aStyles.append("}");
+ m_aStyles.append("{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " {");
+ }
return true;
}
bool RtfAttributeOutput::EndURL(bool const isAtEndOfParagraph)
{
- // UGLY: usually EndRun is called earlier, but there is an extra
- // call to OutAttrWithRange() when at the end of the paragraph,
- // so in that special case the output needs to be appended to the
- // new run's text instead of the previous run
- if (isAtEndOfParagraph)
+ if (!m_sURL.isEmpty())
{
- // close the fldrslt group
- m_aRunText->append("}}");
- // close the field group
- m_aRunText->append('}');
- }
- else
- {
- // close the fldrslt group
- m_aRun->append("}}");
- // close the field group
- m_aRun->append('}');
+ // UGLY: usually EndRun is called earlier, but there is an extra
+ // call to OutAttrWithRange() when at the end of the paragraph,
+ // so in that special case the output needs to be appended to the
+ // new run's text instead of the previous run
+ if (isAtEndOfParagraph)
+ {
+ // close the fldrslt group
+ m_aRunText->append("}}");
+ // close the field group
+ m_aRunText->append('}');
+ }
+ else
+ {
+ // close the fldrslt group
+ m_aRun->append("}}");
+ // close the field group
+ m_aRun->append('}');
+ }
+ m_sURL.clear();
}
return true;
}