diff options
author | drazil <abcdefghi236@gmail.com> | 2016-08-28 14:22:57 +0800 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-02 14:58:40 +0000 |
commit | 8e375369206606c541cff5f46ea6a87db2c808b4 (patch) | |
tree | a11dbe241612a9ce28d781da9332d7371e9ef327 /sw | |
parent | c6ff9323c11160502b3339cc4bca92630ddcb836 (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.
Change-Id: I6194b9cc6bcc1bfaa033ab05e94836fe96e33f14
Reviewed-on: https://gerrit.libreoffice.org/28432
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-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 19266ef2b306..11877702b4e1 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(_WIN32) DECLARE_SW_IMPORT_TEST(testMathMalformedXml, "math-malformed_xml.docx", FailTest) |