i#23357 RTF export: fix crash on groupshapes

Change-Id: I3329663060aeb06ac552bd5d1615d19efe160091
This commit is contained in:
Miklos Vajna
2013-12-10 10:38:20 +01:00
parent 445299be76
commit adc68965d5
3 changed files with 15 additions and 1 deletions

Binary file not shown.

View File

@@ -584,6 +584,11 @@ DECLARE_RTFEXPORT_TEST(testAbi10201, "abi10201.rtf")
// crashtest
}
DECLARE_RTFEXPORT_TEST(testI23357, "i23357.odt")
{
// crashtest
}
#endif
CPPUNIT_PLUGIN_IMPLEMENT();

View File

@@ -440,7 +440,16 @@ void RtfSdrExport::impl_writeGraphic()
uno::Reference<drawing::XShape> xShape = GetXShapeForSdrObject(const_cast<SdrObject*>(m_pSdrObject));
uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
OUString sGraphicURL;
xPropertySet->getPropertyValue("GraphicURL") >>= sGraphicURL;
try
{
xPropertySet->getPropertyValue("GraphicURL") >>= sGraphicURL;
}
catch (beans::UnknownPropertyException& rException)
{
// ATM groupshapes are not supported, just make sure we don't crash on them.
SAL_WARN("sw.rtf", "failed. Message: " << rException.Message);
return;
}
OString aURLBS(OUStringToOString(sGraphicURL, RTL_TEXTENCODING_UTF8));
const char aURLBegin[] = "vnd.sun.star.GraphicObject:";
Graphic aGraphic = GraphicObject(aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin))).GetTransformedGraphic();