diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-05-07 15:42:35 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-05-07 17:24:18 +0100 |
commit | 0e99a36c695d6349c8096654ddad70f962f312d0 (patch) | |
tree | e8a74e81bd5d0b42570846c83f7f21352c9a5156 /svx | |
parent | 274e3ec0c06e667868eca1b75193500ba92d7c14 (diff) |
split clear and set graphic
Change-Id: I3e98e872574e9edbe97099e93d787cbbcced60dd
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdoole2.cxx | 26 | ||||
-rw-r--r-- | svx/source/unodraw/unoshap4.cxx | 2 |
2 files changed, 17 insertions, 11 deletions
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index b331d5d848d7..1ab690845bb2 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -758,8 +758,9 @@ bool SdrOle2Obj::isUiActive() const return mpImpl->mxObjRef.is() && embed::EmbedStates::UI_ACTIVE == mpImpl->mxObjRef->getCurrentState(); } -void SdrOle2Obj::SetGraphic_Impl(const Graphic* pGrf) +void SdrOle2Obj::SetGraphic(const Graphic& rGrf) { + // only for setting a preview graphic if (mpImpl->mpGraphic) { delete mpImpl->mpGraphic; @@ -768,20 +769,25 @@ void SdrOle2Obj::SetGraphic_Impl(const Graphic* pGrf) mpImpl->mpGraphicObject = nullptr; } - if (pGrf) - { - mpImpl->mpGraphic = new Graphic(*pGrf); - mpImpl->mpGraphicObject = new GraphicObject(*mpImpl->mpGraphic); - } + mpImpl->mpGraphic = new Graphic(rGrf); + mpImpl->mpGraphicObject = new GraphicObject(*mpImpl->mpGraphic); SetChanged(); BroadcastObjectChange(); } -void SdrOle2Obj::SetGraphic(const Graphic* pGrf) +void SdrOle2Obj::ClearGraphic() { - // only for setting a preview graphic - SetGraphic_Impl( pGrf ); + if (mpImpl->mpGraphic) + { + delete mpImpl->mpGraphic; + mpImpl->mpGraphic = nullptr; + delete mpImpl->mpGraphicObject; + mpImpl->mpGraphicObject = nullptr; + } + + SetChanged(); + BroadcastObjectChange(); } void SdrOle2Obj::SetProgName( const OUString& rName ) @@ -1896,7 +1902,7 @@ void SdrOle2Obj::GetObjRef_Impl() // perhaps preview not valid anymore // This line changes the modified state of the model - SetGraphic_Impl( nullptr ); + ClearGraphic(); // if status was not set before, force it back // to not set, so that SetGraphic(0L) above does not diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx index 46e76c35f9a8..59f39cbbb702 100644 --- a/svx/source/unodraw/unoshap4.cxx +++ b/svx/source/unodraw/unoshap4.cxx @@ -143,7 +143,7 @@ bool SvxOle2Shape::setPropertyValueImpl( const OUString& rName, const SfxItemPro if( rValue >>= aURL ) { GraphicObject aGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) ); - static_cast<SdrOle2Obj*>(mpObj.get())->SetGraphic( &aGrafObj.GetGraphic() ); + static_cast<SdrOle2Obj*>(mpObj.get())->SetGraphic(aGrafObj.GetGraphic()); return true; } break; |