SVG export: fix failure on trying to read graphic of a 3D shape
Regression from commit 8fc1b60f62
(sw SVG
export: try to reuse original bitmap data for JPG and PNG bitmaps,
2020-02-27), which generalized the code that tries to get the original
bitmap of shapes for performance reasons. Originally this worked with
SdrGrafObj, but now we try every XShape which has a Graphic property.
Add the missing check, so shapes without a graphic property just miss
the fast path, but doesn't fail the entire SVG export.
Change-Id: I6b20083110f3269337b9df6a23bd193cc6f7d13b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102187
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
This commit is contained in:
BIN
filter/qa/unit/data/shape-nographic.odp
Normal file
BIN
filter/qa/unit/data/shape-nographic.odp
Normal file
Binary file not shown.
@@ -160,6 +160,25 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentText)
|
||||
assertXPath(pXmlDoc, "//svg:text[2]/svg:tspan/svg:tspan/svg:tspan[@fill-opacity]", 0);
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(SvgFilterTest, testShapeNographic)
|
||||
{
|
||||
// Load a document containing a 3D shape.
|
||||
load("shape-nographic.odp");
|
||||
|
||||
// Export to SVG.
|
||||
uno::Reference<frame::XStorable> xStorable(getComponent(), uno::UNO_QUERY_THROW);
|
||||
SvMemoryStream aStream;
|
||||
uno::Reference<io::XOutputStream> xOut = new utl::OOutputStreamWrapper(aStream);
|
||||
utl::MediaDescriptor aMediaDescriptor;
|
||||
aMediaDescriptor["FilterName"] <<= OUString("impress_svg_Export");
|
||||
aMediaDescriptor["OutputStream"] <<= xOut;
|
||||
|
||||
// Without the accompanying fix in place, this test would have failed with:
|
||||
// An uncaught exception of type com.sun.star.io.IOException
|
||||
// - SfxBaseModel::impl_store <private:stream> failed: 0xc10(Error Area:Io Class:Write Code:16)
|
||||
xStorable->storeToURL("private:stream", aMediaDescriptor.getAsConstPropertyValueList());
|
||||
}
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@@ -59,6 +59,7 @@
|
||||
#include <svx/svdograf.hxx>
|
||||
#include <svx/svdmodel.hxx>
|
||||
#include <svx/svdxcgv.hxx>
|
||||
#include <sal/log.hxx>
|
||||
|
||||
#include <memory>
|
||||
|
||||
@@ -608,7 +609,7 @@ bool SVGFilter::implExportImpressOrDraw( const Reference< XOutputStream >& rxOSt
|
||||
{
|
||||
delete mpSVGDoc;
|
||||
mpSVGDoc = nullptr;
|
||||
OSL_FAIL( "Exception caught" );
|
||||
SAL_WARN("filter.svg", "Exception caught");
|
||||
}
|
||||
|
||||
if( nullptr != pSdrModel )
|
||||
|
@@ -2758,7 +2758,10 @@ void GetGraphicFromXShape(const css::uno::Reference<css::drawing::XShape>* pShap
|
||||
}
|
||||
|
||||
uno::Reference<graphic::XGraphic> xGraphic;
|
||||
xPropertySet->getPropertyValue("Graphic") >>= xGraphic;
|
||||
if (xPropertySet->getPropertySetInfo()->hasPropertyByName("Graphic"))
|
||||
{
|
||||
xPropertySet->getPropertyValue("Graphic") >>= xGraphic;
|
||||
}
|
||||
rGraphic= Graphic(xGraphic);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user