diff options
author | Moritz Kuett <moritz.kuett@web.de> | 2013-03-23 17:32:46 +0100 |
---|---|---|
committer | Thorsten Behrens <tbehrens@suse.com> | 2013-03-23 18:28:46 +0100 |
commit | 5dd259cbd01dfb71288bcea7837a2d30d9d7d4e7 (patch) | |
tree | 9679a3ade0c9177372e94e8567a7fedb273e1162 /filter | |
parent | fdo#39468 Translate German comments - vcl/win/source/app (diff) | |
download | core-5dd259cbd01dfb71288bcea7837a2d30d9d7d4e7.tar.gz core-5dd259cbd01dfb71288bcea7837a2d30d9d7d4e7.zip |
fdo#47576: Support for textual links added (SVG Export)
Added Support to export textual links in SVG files, images still do not work
Change-Id: Id230618d2cc068b94eb0f0051d5db249a88a42f2
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/svg/svgwriter.cxx | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index f9039b2bbce7..55a19857a93d 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -32,6 +32,7 @@ using ::rtl::OUString; static const char aXMLElemG[] = "g"; +static const char aXMLElemA[] = "a"; static const char aXMLElemDefs[] = "defs"; static const char aXMLElemLine[] = "line"; static const char aXMLElemRect[] = "rect"; @@ -1795,20 +1796,31 @@ void SVGTextWriter::implWriteTextPortion( const Point& rPos, mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", "PlaceholderText" ); mbIsPlacehlolderShape = sal_False; } - else if( mbIsURLField && !msUrl.isEmpty() ) - { - mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", "UrlField" ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrXLinkHRef, msUrl ); - mbIsURLField = sal_False; - } - addFontAttributes( /* isTexTContainer: */ false ); mpContext->AddPaintAttr( COL_TRANSPARENT, aTextColor ); - SvXMLElementExport aSVGTspanElem( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS ); OUString sTextContent = rText; - mrExport.GetDocHandler()->characters( sTextContent ); + + // <a> tag for link should be the innermost tag, inside <tspan> + if( !mbIsPlacehlolderShape && mbIsURLField && !msUrl.isEmpty() ) + { + mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", "UrlField" ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrXLinkHRef, msUrl ); + + SvXMLElementExport aSVGTspanElem( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrXLinkHRef, msUrl ); + { + SvXMLElementExport aSVGAElem( mrExport, XML_NAMESPACE_NONE, aXMLElemA, mbIWS, mbIWS ); + mrExport.GetDocHandler()->characters( sTextContent ); + } + } + else + { + SvXMLElementExport aSVGTspanElem( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS ); + mrExport.GetDocHandler()->characters( sTextContent ); + } + mnTextWidth += mpVDev->GetTextWidth( sTextContent ); } |