fdo#74271: Added unit test & code changes for footer contains hyperlink.

Problem description:
- If the document contains a hyperlink in footer
  that starts with "www" (ex. www.google.com) then
  the footer1.xml.rels of the roundtrip file contains
  empty Target.
- Since the target is empty, the file get corrupted in MS Office 2007.

Implementation:
- If hyperlink starts with "www" then make bSmart as true.

Change-Id: Ifa2b587d3326152b2d9778bd818fbe68b1cf6410
Reviewed-on: https://gerrit.libreoffice.org/7766
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
This commit is contained in:
YogeshBharate
2014-01-31 16:31:01 +05:30
committed by Miklos Vajna
parent a980928ef8
commit 4654e9b113
3 changed files with 13 additions and 1 deletions

View File

@@ -3629,6 +3629,18 @@ DECLARE_OOXMLEXPORT_TEST(testW14TextEffects_TextOutline, "TextEffects_TextOutlin
assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/w:rPr/w14:textOutline/w14:bevel", 1);
}
DECLARE_OOXMLEXPORT_TEST(testFooterContainHyperlink,"footer-contain-hyperlink.docx")
{
// Problem is that footer1.xml.rels contains the empty
// Target due to which the file get corrupted
// in MS Office 2007.
// Check for footer1.xml.rels file.
xmlDocPtr pXmlRels = parseExport("word/_rels/footer1.xml.rels");
if (!pXmlRels)
return;
// Check the value of Target which is http://www.google.com/.
assertXPath(pXmlRels,"/rels:Relationships/rels:Relationship","Target","http://www.google.com/");
}
#endif
CPPUNIT_PLUGIN_IMPLEMENT();

View File

@@ -810,7 +810,7 @@ bool AttributeOutputBase::AnalyzeURL( const OUString& rUrl, const OUString& /*rT
}
else
{
INetURLObject aURL( rUrl );
INetURLObject aURL( rUrl, INET_PROT_NOT_VALID );
sURL = aURL.GetURLNoMark( INetURLObject::DECODE_UNAMBIGUOUS );
sMark = aURL.GetMark( INetURLObject::DECODE_UNAMBIGUOUS );
}