summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@me.com>2020-03-10 16:15:45 +0100
committerArmin Le Grand <Armin.Le.Grand@me.com>2020-03-10 20:06:59 +0100
commitf9e2cfc0d2e244c1550a0e2cc8de960f82eaf9cf (patch)
tree181a26cfffb85ada958ab6e8bfeba8890befeaed /sc
parent2af67c35d283abefe6030a5b90b831b0b797dd62 (diff)
tdf#125520 create a persist correctly for OLE
If the D&D-Start described as in the task is an OLE object we need to create a Persist-object to copy the included EmbeddedObjectContainer Change-Id: Ib8b9677bbc3e6c5b3895abc55e6da5b0a96e33d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90263 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/navipi/content.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 49558c8c19b1..48b95d965767 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -1137,7 +1137,21 @@ static bool lcl_DoDragObject( ScDocShell* pSrcShell, const OUString& rName, ScCo
SdrPageView* pPV = aEditView.GetSdrPageView();
aEditView.MarkObj(pObject, pPV);
+ // tdf125520 this is a D&D-start potentially with an OLE object. If
+ // so, we need to do similar as e.g. in ScDrawView::BeginDrag so that
+ // the temporary SdrModel for transfer does have a GetPersist() so
+ // that the EmbeddedObjectContainer gets copied. We noeed no CheckOle
+ // here, test is simpler.
+ ScDocShellRef aDragShellRef;
+ if(OBJ_OLE2 == pObject->GetObjIdentifier())
+ {
+ aDragShellRef = new ScDocShell; // DocShell needs a Ref immediately
+ aDragShellRef->DoInitNew();
+ }
+
+ ScDrawLayer::SetGlobalDrawPersist(aDragShellRef.get());
std::unique_ptr<SdrModel> pDragModel(aEditView.CreateMarkedObjModel());
+ ScDrawLayer::SetGlobalDrawPersist(nullptr);
TransferableObjectDescriptor aObjDesc;
pSrcShell->FillTransferableObjectDescriptor( aObjDesc );