From 4654e9b113a66c800161d0ee82d587055fff4f8b Mon Sep 17 00:00:00 2001 From: YogeshBharate Date: Fri, 31 Jan 2014 16:31:01 +0530 Subject: 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 Tested-by: Miklos Vajna --- .../ooxmlexport/data/footer-contain-hyperlink.docx | Bin 0 -> 12150 bytes sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 12 ++++++++++++ sw/source/filter/ww8/wrtw8nds.cxx | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 sw/qa/extras/ooxmlexport/data/footer-contain-hyperlink.docx (limited to 'sw') diff --git a/sw/qa/extras/ooxmlexport/data/footer-contain-hyperlink.docx b/sw/qa/extras/ooxmlexport/data/footer-contain-hyperlink.docx new file mode 100644 index 000000000000..27b00ed37ecb Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/footer-contain-hyperlink.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 324838e25b43..194b7c6d582b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -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(); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 645b82fef1ed..29da65dcb30f 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -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 ); } -- cgit