Bug 47576 - SVG: SVG export does not include hyperlinks
Summary: SVG: SVG export does not include hyperlinks
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
3.5.1 release
Hardware: Other All
: medium normal
Assignee: Moritz K
URL:
Whiteboard: BSA target:4.1.0
Keywords: difficultyBeginner, easyHack, skillCpp
Depends on:
Blocks:
 
Reported: 2012-03-20 05:43 UTC by Reuben Thomas
Modified: 2015-12-15 12:07 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
svg picture for using as reference (557 bytes, image/svg+xml)
2012-06-14 04:38 UTC, sasha.libreoffice
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Reuben Thomas 2012-03-20 05:43:02 UTC
Problem description: 

When I export a Draw file as SVG, hyperlinks are not exported.

Current behavior:

Hyperlinks are not exported.

Expected behavior:

Hyperlinks should be exported.

Platform (if different from the browser): 
              
Browser: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Ubuntu/12.04 Chromium/17.0.963.79 Chrome/17.0.963.79 Safari/535.11
Comment 1 sasha.libreoffice 2012-06-13 23:48:31 UTC
Thanks for bugreport
Please, describe step-by-step how to insert hyperlink into picture using InkScape
Comment 2 Reuben Thomas 2012-06-14 01:35:30 UTC
I'm sorry, I don't understand remotely what your question has to do with this bug. I use LibreOffice. I reported a bug in LibreOffice. Now you want me (a LibreOffice user) to tell you (a LibreOffice developer) how to do something with Inkscape (a program that has nothing to do with LibreOffice). What makes you think I'd know anything about Inkscape? Why is Inkscape relevant?

I'm sure if you really need to know you can look up whatever documentation Inkscape has!
Comment 3 sasha.libreoffice 2012-06-14 03:55:06 UTC
SVG is Inkscape's file format. Developers need some svg pictures with working hyperlink for look how they should be there, and for testing.
Please, attach such svg picture.
Comment 4 Reuben Thomas 2012-06-14 04:24:14 UTC
SVG is not Inkscape's file format, it is a W3C standard. It is described here: http://www.w3.org/TR/SVG11/ and the chapter on links is here: http://www.w3.org/TR/SVG11/linking.html
Comment 5 Michael Meeks 2012-06-14 04:32:10 UTC
Confirming; not all bug commenter are hackers :-) please be patient with us.

Presumably this would be a reasonably easy easy-hack with a bit more detail; let me try to find someone to help out with that.
Comment 6 sasha.libreoffice 2012-06-14 04:38:04 UTC
Created attachment 63018 [details]
svg picture for using as reference
Comment 7 sasha.libreoffice 2012-06-14 04:44:01 UTC
Thanks for links. I attached one SVG from there for may used as reference

> When I export a Draw file as SVG, hyperlinks are not exported
Not only to svg. ODG too. See this bug: Bug 39066

And import from SVG results in no hyperlink
Comment 8 Thorsten Behrens (allotropia) 2012-06-14 05:23:10 UTC
(In reply to comment #5)
> Presumably this would be a reasonably easy easy-hack with a bit more detail;
> let me try to find someone to help out with that.
>
So the place to hack is filter/source/svg/svgexport.cxx, and the CalcFieldHdl function there - a few text field values are already handled there, but
 
 text::textfield::Type::URL

is missing - stick that in, handle the SvxURLField item, and somehow convey that to svgwriter.cxx.

Alternatively, (conceptually) copy a nasty hack that slideshow is using (see slideshow/source/engine/shapes/drawshape.cxx:~1060):

In SVGActionWriter::ImplWriteActions:

                if (pCurrAct->GetType() == META_COMMENT_ACTION) {
                    MetaCommentAction * pAct =
                        static_cast<MetaCommentAction *>(pCurrAct);
                    // skip comment if not a special XTEXT comment
                    if (pAct->GetComment().equalsIgnoreAsciiCaseL(
                            RTL_CONSTASCII_STRINGPARAM("FIELD_SEQ_BEGIN") ) &&
                        // e.g. date field doesn't have data!
                        // currently assuming that only url field, this is
                        // somehow fragile! xxx todo if possible
                        pAct->GetData() != 0 &&
                        pAct->GetDataSize() > 0)
                    {
...
                                rtl::OUString aURL(
                                    reinterpret_cast<sal_Unicode const*>(
                                        pAct->GetData()),
                                    pAct->GetDataSize() / sizeof(sal_Unicode) )
Comment 9 Thorsten Behrens (allotropia) 2012-06-14 05:24:27 UTC
(In reply to comment #8)
> Alternatively, (conceptually) copy a nasty hack that slideshow is using (see
> slideshow/source/engine/shapes/drawshape.cxx:~1060):
> 
That is, the data is already available in the metafile that gets exported - just extract it & use it. For an easy hack, I think that's the easiest route. ;)
Comment 10 Commit Notification 2013-03-23 17:32:04 UTC
Moritz Kuett committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=5dd259cbd01dfb71288bcea7837a2d30d9d7d4e7

fdo#47576: Support for textual links added (SVG Export)



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2013-03-25 00:07:54 UTC
Moritz Kuett committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=c724ad3de3c053cd482cd107a4ade4065980acb9

fdo#47576: Hyperlinks work for SVG Exports



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 12 sasha.libreoffice 2013-03-25 06:04:29 UTC
Thanks for fixing this bug
Comment 13 Michael Meeks 2013-03-25 09:40:21 UTC
it'd be great to release note here:

https://wiki.documentfoundation.org/ReleaseNotes/4.1

if possible :-) and thanks ...
Comment 14 Robinson Tryon (qubit) 2015-12-15 12:07:28 UTC
Migrating Whiteboard tags to Keywords: (EasyHack,DifficultyBeginner,SkillCpp )
[NinjaEdit]