diff options
author | drazil <abcdefghi236@gmail.com> | 2016-08-28 14:22:57 +0800 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2016-10-10 18:23:52 +0200 |
commit | 97d1564c7441bc5f143333338298af080464248e (patch) | |
tree | c438678215a4a517908f19358b7797aaf1e17d9f /sw/qa/extras | |
parent | 976bc91c089c4c39afe1119f7e988505995ded41 (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.docx | bin | 0 -> 13467 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 6 |
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 Binary files differnew file mode 100644 index 000000000000..ab0b53bb2033 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/image-hyperlink.docx 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) |