diff options
Diffstat (limited to 'svx/source/svdraw/svdoole2.cxx')
-rw-r--r-- | svx/source/svdraw/svdoole2.cxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index cddbd3285444..ca65521bed0b 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -1864,11 +1864,19 @@ bool SdrOle2Obj::IsReal3DChart() const void SdrOle2Obj::SetGraphicToObj( const Graphic& aGraphic, const OUString& aMediaType ) { mpImpl->mxObjRef.SetGraphic( aGraphic, aMediaType ); + // if the object isn't valid, e.g. link to something that doesn't exist, set the fallback + // graphic as mxGraphic so SdrOle2Obj::GetGraphic will show the fallback + if (const Graphic* pObjGraphic = mpImpl->mxObjRef.is() ? nullptr : mpImpl->mxObjRef.GetGraphic()) + mpImpl->mxGraphic.reset(new Graphic(*pObjGraphic)); } void SdrOle2Obj::SetGraphicToObj( const uno::Reference< io::XInputStream >& xGrStream, const OUString& aMediaType ) { mpImpl->mxObjRef.SetGraphicStream( xGrStream, aMediaType ); + // if the object isn't valid, e.g. link to something that doesn't exist, set the fallback + // graphic as mxGraphic so SdrOle2Obj::GetGraphic will show the fallback + if (const Graphic* pObjGraphic = mpImpl->mxObjRef.is() ? nullptr : mpImpl->mxObjRef.GetGraphic()) + mpImpl->mxGraphic.reset(new Graphic(*pObjGraphic)); } bool SdrOle2Obj::IsCalc() const |