From d08d5c1857482cb3789ed2896921abeb83f4d217 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Wed, 4 Mar 2020 17:40:50 +0100 Subject: tdf#125520 enhance internal OLE cloning For D&D/Copy&Paste te temp SdrModel had no IEmbeddedHelper/Persist, so use the one from the source SDrModel in the temporary one for transfer/cloning. Should be okay, the persist is part of the DocumentModels, handed to the SDrModel for usage and *not* destroyed when SdrModel gets destroyed Change-Id: I46e9e371ef8802d6c1c5bfe761b26651ae6e1f73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89986 Tested-by: Jenkins Reviewed-by: Armin Le Grand --- svx/source/svdraw/svdxcgv.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'svx/source/svdraw/svdxcgv.cxx') diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 1c5664a2602e..4ba25a6c1265 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -734,7 +734,20 @@ std::unique_ptr SdrExchangeView::CreateMarkedObjModel() const if(nullptr == pNewObj) { - // not cloned yet, use default way + // not cloned yet + if (pObj->GetObjIdentifier() == OBJ_OLE2) + { + // tdf#125520 - temp SdrModel will need a comphelper::IEmbeddedHelper + // to succesfully clone the OLE content, use the one from source model + // in the temporary SdrModel - it gets not deleted in SdrModel destructor. + // As long as the temporary SdrModel is used temprary (and does NOT get + // extended to a full document) this *should* work. There stay some + // concerns about what may happen in BG and if saved/loaded from clipboard, + // so this *might* need to be enhanced in the future. + pNewModel->SetPersist(mpModel->GetPersist()); + } + + // use default way pNewObj = pObj->CloneSdrObject(*pNewModel); } -- cgit