[Libreoffice-commits] core.git: filter/source
Moritz Kuett
moritz.kuett at web.de
Sat Mar 23 10:29:19 PDT 2013
filter/source/svg/svgwriter.cxx | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
New commits:
commit 5dd259cbd01dfb71288bcea7837a2d30d9d7d4e7
Author: Moritz Kuett <moritz.kuett at web.de>
Date: Sat Mar 23 17:32:46 2013 +0100
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
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index f9039b2..55a1985 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 );
}
More information about the Libreoffice-commits
mailing list