summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-04-26 20:17:00 +0900
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-04-30 21:29:24 +0900
commit8ed628cf8b7c6f1bc6dae9eb94c9b702aa93c21b (patch)
tree2df03ed2ec8e6960de84fd29f01fc9f90eedf7ee /svtools
parent49093f1110b9a4752c0897886ff336003575764d (diff)
tdf#118977 support PDF documents as a clipboard format
On macOS it is possible to copy from a PDF a subset of a document, which will be transported as a new PDF document containing the subset. LibreOffice didn't support PDF as a valid clipboard format and previously it also didn't support showing PDFs inside the document, so in such cases it copy-pasted a low resolution bitmap. The result wasn't good. As we are now able to display PDF documents as Graphic in LO, we can also support this use-case. This adds support for the PDF documents as a clipboard format in general and to the macOS backend. This commit only adds support for Writer. Reviewed-on: https://gerrit.libreoffice.org/71364 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit 615202cab983f1f13407f6515aeb047e4e09f6ed) Change-Id: Ib982b55391b390ae06974b4ad836e376dd722a4c
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/misc/transfer.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index 7db9601c8aa7..03b306daed8b 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -1727,6 +1727,20 @@ bool TransferableDataHelper::GetGraphic( const css::datatransfer::DataFlavor& rF
if( bRet )
rGraphic = aBmpEx;
}
+ else if(SotExchange::GetFormatDataFlavor(SotClipboardFormatId::PDF, aFlavor) &&
+ TransferableDataHelper::IsEqual(aFlavor, rFlavor))
+ {
+ Graphic aGraphic;
+ tools::SvRef<SotStorageStream> xStm;
+ if (GetSotStorageStream(rFlavor, xStm))
+ {
+ if (GraphicConverter::Import(*xStm, aGraphic) == ERRCODE_NONE)
+ {
+ rGraphic = aGraphic;
+ bRet = true;
+ }
+ }
+ }
else if (SotExchange::GetFormatDataFlavor(SotClipboardFormatId::JPEG, aFlavor) && TransferableDataHelper::IsEqual(aFlavor, rFlavor))
{
BitmapEx aBitmapEx;