From 4654e9b113a66c800161d0ee82d587055fff4f8b Mon Sep 17 00:00:00 2001 From: YogeshBharate Date: Fri, 31 Jan 2014 16:31:01 +0530 Subject: [PATCH] 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 --- .../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 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 0000000000000000000000000000000000000000..27b00ed37ecb055288d21713cc714915d7ab3332 GIT binary patch literal 12150 zcmeIYWmHxB_CLJoPATbb=}zhH20^-{yQPtC6gD8;2uP=FknWU{?k?&0Z@uRn&*7f& zjOYFDt`|GkXO6jMerG7lK|x~yU;*#|0Dugzn$Wlw3;_TX!2$r!0Pv7{V)k|}W_B*G z)jb`|ob{PJY;8z$pdo3q0FdDO|9AZ#mOzb0pLHh-dMoY?n&dZQhMnvrO#U#Y9fZ9aJ)aXE)})L@o9mhs!hqqOdB<8aZFrb{xt2gZPP7C(0;p>Hnng>cP@YH2k}fXz zEL!EQv!5+3=4hwl>rp zIt)k*2cmFd_2rVYvmUzc-&t_;Cdl850&^d#`5+G?$%eQ6=jG5OQPdMCoZdr6SZ|gi zr6YQ}DrD1tgv3_UBJ!9Vt=sas@t4jZUXBTdZ5;6PRsz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TRc2Iv9%St`TNZ~qT%V)Y&X literal 0 HcmV?d00001 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 ); }