summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYogeshBharate <yogesh.bharate@synerzip.com>2014-01-31 16:31:01 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-02-26 03:24:57 -0600
commit4654e9b113a66c800161d0ee82d587055fff4f8b (patch)
tree6523fd85a409a85772c0720e8acf8b917154c16d
parenta980928ef834fae10b326e7bb64cb48d935e2214 (diff)
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>
-rw-r--r--sw/qa/extras/ooxmlexport/data/footer-contain-hyperlink.docxbin0 -> 12150 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx12
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx2
3 files changed, 13 insertions, 1 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/footer-contain-hyperlink.docx
Binary files 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 );
}