[PATCH] fdo#47576: Hyperlinks work for SVG Exports

Moritz Kütt (via_Code_Review) gerrit at gerrit.libreoffice.org
Sat Mar 23 15:39:47 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2957

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/57/2957/1

fdo#47576: Hyperlinks work for SVG Exports

For different objects (images, shapes...) hyperlinks are exported by Draw/Impress.
An <a> Tag is wrapped around the object, if the object has a Property "Bookmark" which is not empty.

Change-Id: I3e034effe6c4a5025c27bd6408fd162bf5cf4859
---
M filter/source/svg/svgexport.cxx
1 file changed, 25 insertions(+), 5 deletions(-)



diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index fdf12a7..4b952c4 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -1785,12 +1785,32 @@
                     }
 
                     {
+                        OUString aBookmark;
+                        Reference<XPropertySetInfo> xShapePropSetInfo = xShapePropSet->getPropertySetInfo();
+                        if(xShapePropSetInfo->hasPropertyByName("Bookmark"))
+                        {
+                            xShapePropSet->getPropertyValue( "Bookmark" ) >>= aBookmark;
+                        }
+
                         SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
-                        mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf,
-                                                    0xffffffff,
-                                                    pElementId,
-                                                    &rxShape,
-                                                    pEmbeddedBitmapsMtf );
+                        if( !aBookmark.isEmpty() )
+                        {
+                            mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xlink:href", aBookmark);
+                            SvXMLElementExport alinkA( *mpSVGExport, XML_NAMESPACE_NONE, "a", sal_True, sal_True );
+                            mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf,
+                                                        0xffffffff,
+                                                        pElementId,
+                                                        &rxShape,
+                                                        pEmbeddedBitmapsMtf );
+                        }
+                        else
+                        {
+                            mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf,
+                                                        0xffffffff,
+                                                        pElementId,
+                                                        &rxShape,
+                                                        pEmbeddedBitmapsMtf );
+                        }
                     }
                 }
 

-- 
To view, visit https://gerrit.libreoffice.org/2957
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e034effe6c4a5025c27bd6408fd162bf5cf4859
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