sw/source/uibase/dochdl/swdtflvr.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
New commits: commit 515afc9d17003255910b403ac26705867332d9e1 Author: Daniel Arato (NISZ) <arato.dan...@nisz.hu> AuthorDate: Tue Sep 8 16:56:58 2020 +0200 Commit: Gabor Kelemen <kelemen.gab...@nisz.hu> CommitDate: Tue Apr 20 13:35:26 2021 +0200 tdf#135669 sw: drag and drop other files as OLE from file managers. Native text, PDF and image file formats were supported, but now spreadsheet and DOCX documents, too. The same feature was already implemented in e.g. Impress. Note: DOCX files inserted as OLE objects yet, and not linked files in sections, as ODTs (but it's possible saving and printing them via Save As option of the local menu of the OLE object). Change-Id: Ia2fafe4a0b79dc0c66eaec5ad073c994f98e1345 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102263 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit a354b7f7476513e5b1b4bbf1986b483cf122d47b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114283 Tested-by: Gabor Kelemen <kelemen.gab...@nisz.hu> Reviewed-by: Gabor Kelemen <kelemen.gab...@nisz.hu> diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index cb1e8f51a262..5be9cc5533ee 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -2256,6 +2256,19 @@ bool SwTransferable::PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh, } } } + else if (rData.HasFormat(SotClipboardFormatId::SIMPLE_FILE)) + { + OUString sFile; + if (rData.GetString(nFormat, sFile) && !sFile.isEmpty()) + { + // Copied from sd::View::DropInsertFileHdl + uno::Sequence< beans::PropertyValue > aMedium(1); + aMedium[0].Name = "URL"; + aMedium[0].Value <<= sFile; + SwDocShell* pDocSh = rSh.GetDoc()->GetDocShell(); + xObj = pDocSh->GetEmbeddedObjectContainer().InsertEmbeddedObject(aMedium, aName); + } + } } if ( xStrm.is() && !xObj.is() ) @@ -3033,6 +3046,11 @@ bool SwTransferable::PasteFileName( TransferableDataHelper& rData, rSh.StartInsertRegionDialog( aSect ); // starts dialog asynchronously bRet = true; } + else if (SwPasteSdr::Insert == nAction && rData.HasFormat(SotClipboardFormatId::SIMPLE_FILE)) + { + // insert file as OLE + PasteOLE(rData, rSh, nFormat, nActionFlags, nullptr == pPt); + } else if( SwPasteSdr::SetAttr == nAction || ( bIsURLFile && SwPasteSdr::Insert == nAction )) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits