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@web.de>
Context
- [PATCH] fdo#47576: Support for textual links added (SVG Export) · via Code Review
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.