[PATCH] fdo#47576: Support for textual links added (SVG Export)
Moritz Kütt (via_Code_Review)
gerrit at gerrit.libreoffice.org
Sat Mar 23 09:35:00 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/2936
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/36/2936/1
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
---
M filter/source/svg/svgwriter.cxx
1 file changed, 24 insertions(+), 5 deletions(-)
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 2f269ba..21bb701 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -36,6 +36,7 @@
// -----------
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";
@@ -1913,20 +1914,38 @@
mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", B2UCONST( "PlaceholderText" ) );
mbIsPlacehlolderShape = sal_False;
}
- else if( mbIsURLField && !msUrl.isEmpty() )
+ /* else if( mbIsURLField && !msUrl.isEmpty() )
{
mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", B2UCONST( "UrlField" ) );
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrXLinkHRef, msUrl );
- mbIsURLField = sal_False;
- }
+ // 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", B2UCONST( "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 );
}
--
To view, visit https://gerrit.libreoffice.org/2936
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id230618d2cc068b94eb0f0051d5db249a88a42f2
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Moritz Kütt <moritz.kuett at web.de>
More information about the LibreOffice
mailing list