Check svg URLs before exporting
Change-Id: I3b86b6b82318b0d201c3d7db516664520eb47bed Reviewed-on: https://gerrit.libreoffice.org/68668 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
This commit is contained in:
@@ -47,6 +47,7 @@
|
|||||||
#include <comphelper/sequenceashashmap.hxx>
|
#include <comphelper/sequenceashashmap.hxx>
|
||||||
#include <i18nlangtag/lang.h>
|
#include <i18nlangtag/lang.h>
|
||||||
#include <svl/zforlist.hxx>
|
#include <svl/zforlist.hxx>
|
||||||
|
#include <tools/urlobj.hxx>
|
||||||
#include <unotools/ucbstreamhelper.hxx>
|
#include <unotools/ucbstreamhelper.hxx>
|
||||||
#include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
|
#include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
|
||||||
#include <xmloff/nmspmap.hxx>
|
#include <xmloff/nmspmap.hxx>
|
||||||
@@ -1951,13 +1952,18 @@ bool SVGFilter::implExportShape( const Reference< css::drawing::XShape >& rxShap
|
|||||||
|
|
||||||
if( !aBookmark.isEmpty() )
|
if( !aBookmark.isEmpty() )
|
||||||
{
|
{
|
||||||
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xlink:href", aBookmark);
|
INetURLObject aINetURLObject(aBookmark);
|
||||||
SvXMLElementExport alinkA( *mpSVGExport, XML_NAMESPACE_NONE, "a", true, true );
|
if (!aINetURLObject.HasError()
|
||||||
mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf,
|
&& aINetURLObject.GetProtocol() != INetProtocol::Javascript)
|
||||||
0xffffffff,
|
{
|
||||||
pElementId,
|
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xlink:href", aBookmark);
|
||||||
&rxShape,
|
SvXMLElementExport alinkA( *mpSVGExport, XML_NAMESPACE_NONE, "a", true, true );
|
||||||
pEmbeddedBitmapsMtf );
|
mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf,
|
||||||
|
0xffffffff,
|
||||||
|
pElementId,
|
||||||
|
&rxShape,
|
||||||
|
pEmbeddedBitmapsMtf );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -110,8 +110,23 @@ public:
|
|||||||
assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G/SVG_G[2]/SVG_G/SVG_TEXT/SVG_TSPAN ), "text-decoration", "line-through");
|
assertXPath(svgDoc, MAKE_PATH_STRING( /SVG_SVG/SVG_G[2]/SVG_G/SVG_G/SVG_G/SVG_G/SVG_G[2]/SVG_G/SVG_TEXT/SVG_TSPAN ), "text-decoration", "line-through");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void testSVGExportJavascriptURL()
|
||||||
|
{
|
||||||
|
executeExport("textbox-link-javascript.odp");
|
||||||
|
|
||||||
|
xmlDocPtr svgDoc = parseXml(maTempFile);
|
||||||
|
CPPUNIT_ASSERT(svgDoc);
|
||||||
|
|
||||||
|
// There should be only one child (no link to javascript url)
|
||||||
|
assertXPathChildren(svgDoc,
|
||||||
|
MAKE_PATH_STRING(/ SVG_SVG / SVG_G[2] / SVG_G / SVG_G / SVG_G / SVG_G
|
||||||
|
/ SVG_G[4] / SVG_G),
|
||||||
|
1);
|
||||||
|
}
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE(SdSVGFilterTest);
|
CPPUNIT_TEST_SUITE(SdSVGFilterTest);
|
||||||
CPPUNIT_TEST(testSVGExportTextDecorations);
|
CPPUNIT_TEST(testSVGExportTextDecorations);
|
||||||
|
CPPUNIT_TEST(testSVGExportJavascriptURL);
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user