summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-11-20 14:54:16 +0000
committerAndras Timar <andras.timar@collabora.com>2019-12-09 18:21:10 +0100
commit15fbc2a7cf879a91c4b0d3853f043e7eba6b48fe (patch)
tree5417a8fede53eab5fe38a78e1369a3610b496afb /svx
parent2f7653ea487fbf21891ef733ee72d85e0673009b (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 Change-Id: I8f1aea6b25dc216e01a0f888a44d10876bb1bebd Reviewed-on: https://gerrit.libreoffice.org/83329 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de> Reviewed-on: https://gerrit.libreoffice.org/84750 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
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 e642cfdc610c..19ded46c6c54 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -1855,11 +1855,19 @@ bool SdrOle2Obj::IsChart() const
void SdrOle2Obj::SetGraphicToObj( const Graphic& aGraphic )
{
mpImpl->mxObjRef.SetGraphic( aGraphic, OUString() );
+ // 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