summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-11-20 14:54:16 +0000
committerMichael Stahl <Michael.Stahl@cib.de>2019-11-22 16:26:18 +0100
commit7e9c5db6e01c0a8629f474cd0550cb470fdb4cb8 (patch)
tree0afd94aa7f4d9bbf3321d7657760f96e8a7078fb /svx
parentdafa0d92a5989c9daa4e6bb33a0c217e65d83c75 (diff)
If a SdrOle2Obj object is missing/broken show the preview set for it
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, otherwise the failing mxObjRef.is test in SdrOle2Obj::GetGraphic means it doesn't get used Reviewed-on: https://gerrit.libreoffice.org/83329 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de> (cherry picked from commit 35300000346902db38f063b4427a07fdaf6240cd) Change-Id: I8f1aea6b25dc216e01a0f888a44d10876bb1bebd
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdoole2.cxx8
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