sd/source/ui/view/sdview3.cxx         |   25 +++++++++++++++++++++++++
 setup_native/scripts/install_linux.sh |    4 +---
 2 files changed, 26 insertions(+), 3 deletions(-)

New commits:
commit 2d603914d8162317b0ee7b77a73585c32bceb6da
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Jan 27 15:55:40 2022 +0000
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Fri Jan 28 09:33:59 2022 +0100

    use mktemp for UNPACKDIR
    
    Change-Id: If87fb28193f42e60419aa30b5ba7e4af6e05bbcf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129057
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/setup_native/scripts/install_linux.sh 
b/setup_native/scripts/install_linux.sh
index d2b10e88959a..9540a505e974 100644
--- a/setup_native/scripts/install_linux.sh
+++ b/setup_native/scripts/install_linux.sh
@@ -66,9 +66,7 @@ try_to_unpack_languagepack_file()
   echo "Unpacking shell script $FILENAME"
   TAILLINE=`head --lines=20 $FILENAME | sed --quiet 's/linenum=//p'`
 
-  UNPACKDIR=/var/tmp/install_$$
-  mkdir $UNPACKDIR
-  # UNPACKDIR=`mktemp -d`
+  UNPACKDIR=`mktemp -d -p /var/tmp`
   tail -n +$TAILLINE $FILENAME | gunzip | (cd $UNPACKDIR; tar xvf -)
 
   # Setting the new package path, in which the packages exist
commit 7517fc118a1a230ff59f6c629316a8e7e1282dff
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Thu Jan 27 13:07:53 2022 +0200
Commit:     Tor Lillqvist <t...@collabora.com>
CommitDate: Fri Jan 28 09:33:46 2022 +0100

    Enable pasting PDF into Impress
    
    Just like when doing Insert>Image... of a PDF file, you get a bitmap
    of the rendering of the first page of the PDF, not separately editable
    shapes or text. The pasted PDF document is included when exporting to
    .odp at least, just like for Insert>Image...
    
    I don't know how common or easy it is on Windows or various Linux
    desktops to have PDF format data on the clipboard, but at least on
    macOS, if you select a rectangle of a PDF document viewed in the
    Preview app, and do Edit>Copy, a PDF document is put on the
    pasteboard. (Preview also puts a TIFF rendering of the selection on
    the pasteboard, but for some reason that is of ridiculously low
    resolution. That is what used to get pasted into Impress previously.)
    
    Change-Id: Ic4b29deb12609dd839d8578779600156ff1ec48b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129049
    Tested-by: Jenkins
    Reviewed-by: Tor Lillqvist <t...@collabora.com>

diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index 5008c8d8ddd4..5b0fcc424313 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -40,7 +40,9 @@
 #include <svx/unomodel.hxx>
 #include <svx/ImageMapInfo.hxx>
 #include <unotools/streamwrap.hxx>
+#include <vcl/graph.hxx>
 #include <vcl/metaact.hxx>
+#include <vcl/pdfread.hxx>
 #include <vcl/TypeSerializer.hxx>
 #include <svx/svxids.hrc>
 #include <toolkit/helper/vclunohelper.hxx>
@@ -680,6 +682,29 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
        }
     }
 
+    if(!bReturn && CHECK_FORMAT_TRANS( SotClipboardFormatId::PDF ))
+    {
+        ::tools::SvRef<SotTempStream> xStm;
+        if( aDataHelper.GetSotStorageStream( SotClipboardFormatId::PDF, xStm ) 
)
+        {
+            Point aInsertPos(rPos);
+            Graphic aGraphic;
+            if (vcl::ImportPDF(*xStm, aGraphic))
+            {
+                std::unique_ptr<sal_uInt8[]> pGraphicContent;
+
+                const sal_Int32 nGraphicContentSize(xStm->Tell());
+                pGraphicContent.reset(new sal_uInt8[nGraphicContentSize]);
+                xStm->Seek(0);
+                xStm->ReadBytes(pGraphicContent.get(), nGraphicContentSize);
+                
aGraphic.SetGfxLink(std::make_shared<GfxLink>(std::move(pGraphicContent), 
nGraphicContentSize, GfxLinkType::NativePdf));
+
+                InsertGraphic(aGraphic, mnAction, aInsertPos, nullptr, 
nullptr);
+                bReturn = true;
+            }
+        }
+    }
+
     if(!bReturn && CHECK_FORMAT_TRANS( SotClipboardFormatId::DRAWING ))
     {
         ::tools::SvRef<SotTempStream> xStm;

Reply via email to