summaryrefslogtreecommitdiff
path: root/sw/qa/extras
diff options
context:
space:
mode:
authordrazil <abcdefghi236@gmail.com>2016-08-28 14:22:57 +0800
committerAndras Timar <andras.timar@collabora.com>2016-10-10 18:23:52 +0200
commit97d1564c7441bc5f143333338298af080464248e (patch)
treec438678215a4a517908f19358b7797aaf1e17d9f /sw/qa/extras
parent976bc91c089c4c39afe1119f7e988505995ded41 (diff)
tdf#62847 import image hyperlink in docx
The image hyperlink is a resource id in the document and needs to be translated into real URL. First I define a new type CT_Hyperlink_URL in the model and associate it with an action handleHyperlinkURL. In OOXMLFastContextHandlerProperties::handleHyperlinkURL I dispatch it to OOXMLHyperlinkURLHandler to translate resource id to real URL then set the PropertySet with real URL. Then the correct URL will be captured while resolving GraphicImport, which will be stored in GraphicImport_Impl::sHyperlinkURL as an OUString. Finally the property will be set in the GraphicImport::applyName if the length of the sHyperlinkURL is not 0. Also adds a test file image-hyperlink.docx and a test in ooxmlimport.cxx. Reviewed-on: https://gerrit.libreoffice.org/28432 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit 8e375369206606c541cff5f46ea6a87db2c808b4) Change-Id: I6194b9cc6bcc1bfaa033ab05e94836fe96e33f14
Diffstat (limited to 'sw/qa/extras')
-rw-r--r--sw/qa/extras/ooxmlimport/data/image-hyperlink.docxbin0 -> 13467 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx6
2 files changed, 6 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/image-hyperlink.docx b/sw/qa/extras/ooxmlimport/data/image-hyperlink.docx
new file mode 100644
index 000000000000..ab0b53bb2033
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/image-hyperlink.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index a0dff4f55873..a9c346e217d0 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -159,6 +159,12 @@ public:
}
};
+DECLARE_OOXMLIMPORT_TEST(testImageHyperlink, "image-hyperlink.docx")
+{
+ OUString URL = getProperty<OUString>(getShape(1), "HyperLinkURL");
+ CPPUNIT_ASSERT_EQUAL(OUString("http://www.libreoffice.org/"), URL);
+}
+
#if !defined(WNT)
DECLARE_SW_IMPORT_TEST(testMathMalformedXml, "math-malformed_xml.docx", FailTest)