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 <Armin.Le.Grand@me.com>
diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx
index 1c5664a..4ba25a6c 100644
--- a/svx/source/svdraw/svdxcgv.cxx
+++ b/svx/source/svdraw/svdxcgv.cxx
@@ -734,7 +734,20 @@ std::unique_ptr<SdrModel> 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);
        }