diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2019-04-26 20:17:00 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2019-04-26 17:11:16 +0200 |
commit | 615202cab983f1f13407f6515aeb047e4e09f6ed (patch) | |
tree | 010025df813e8f69541b5ee0223e7c63725dd50c /sot | |
parent | c973fb47ef5692069a72211405f3716fade1763e (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.
Change-Id: Ib982b55391b390ae06974b4ad836e376dd722a4c
Reviewed-on: https://gerrit.libreoffice.org/71364
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sot')
-rw-r--r-- | sot/source/base/exchange.cxx | 3 | ||||
-rw-r--r-- | sot/source/base/formats.cxx | 19 |
2 files changed, 21 insertions, 1 deletions
diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx index 146114b8b238..f6d5ee8ca633 100644 --- a/sot/source/base/exchange.cxx +++ b/sot/source/base/exchange.cxx @@ -204,7 +204,8 @@ namespace /*143 SotClipboardFormatId::MATHML*/ { "application/mathml+xml", "MathML", &::cppu::UnoType<const Sequence< sal_Int8 >>::get() }, /*144 SotClipboardFormatId::JPEG*/ { "image/jpeg", "JPEG Bitmap", &cppu::UnoType<Sequence<sal_Int8>>::get() }, /*145 SotClipboardFormatId::RICHTEXT*/ { "text/richtext", "Richtext Format", &cppu::UnoType<Sequence<sal_Int8>>::get() }, - /*146 SotClipboardFormatId::STRING_TSVC*/ { "application/x-libreoffice-tsvc", "Text TSV-Calc", &cppu::UnoType<OUString>::get() } + /*146 SotClipboardFormatId::STRING_TSVC*/ { "application/x-libreoffice-tsvc", "Text TSV-Calc", &cppu::UnoType<OUString>::get() }, + /*147 SotClipboardFormatId::PDF*/ { "application/pdf", "PDF Document", &cppu::UnoType<Sequence<sal_Int8>>::get() }, }; return &aInstance[0]; } diff --git a/sot/source/base/formats.cxx b/sot/source/base/formats.cxx index 16b7bd3a87ce..bb5ea3dcae16 100644 --- a/sot/source/base/formats.cxx +++ b/sot/source/base/formats.cxx @@ -18,6 +18,7 @@ */ #include <tools/solar.h> +#include <config_features.h> #include <sot/exchange.hxx> #include <sot/formats.hxx> @@ -335,6 +336,9 @@ SotAction_Impl const aEXCHG_DEST_DOC_GRAPHOBJ_Def[] = { { SotClipboardFormatId::GDIMETAFILE, EXCHG_IN_ACTION_COPY }, { SotClipboardFormatId::DRAWING, EXCHG_IN_ACTION_COPY }, +#if HAVE_FEATURE_PDFIUM + { SotClipboardFormatId::PDF, EXCHG_IN_ACTION_COPY }, +#endif { SotClipboardFormatId::PNG, EXCHG_IN_ACTION_COPY }, { SotClipboardFormatId::JPEG, EXCHG_IN_ACTION_COPY }, { SotClipboardFormatId::BITMAP, EXCHG_IN_ACTION_COPY }, @@ -355,6 +359,9 @@ SotAction_Impl const aEXCHG_DEST_DOC_GRAPHOBJ_Move[] = { SotClipboardFormatId::DRAWING, EXCHG_OUT_ACTION_REPLACE_DRAWOBJ, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, { SotClipboardFormatId::SVXB, EXCHG_OUT_ACTION_REPLACE_SVXB, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, { SotClipboardFormatId::GDIMETAFILE, EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, +#if HAVE_FEATURE_PDFIUM + { SotClipboardFormatId::PDF, EXCHG_OUT_ACTION_INSERT_GRAPH, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, +#endif { SotClipboardFormatId::PNG, EXCHG_OUT_ACTION_REPLACE_BITMAP, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, { SotClipboardFormatId::JPEG, EXCHG_OUT_ACTION_REPLACE_BITMAP, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, { SotClipboardFormatId::BITMAP, EXCHG_OUT_ACTION_REPLACE_BITMAP, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, @@ -370,6 +377,9 @@ SotAction_Impl const aEXCHG_DEST_DOC_GRAPHOBJ_Copy[] = { SotClipboardFormatId::DRAWING, EXCHG_OUT_ACTION_INSERT_DRAWOBJ, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, { SotClipboardFormatId::SVXB, EXCHG_OUT_ACTION_INSERT_SVXB, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, { SotClipboardFormatId::GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, +#if HAVE_FEATURE_PDFIUM + { SotClipboardFormatId::PDF, EXCHG_OUT_ACTION_INSERT_GRAPH, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, +#endif { SotClipboardFormatId::PNG, EXCHG_OUT_ACTION_INSERT_BITMAP, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, { SotClipboardFormatId::JPEG, EXCHG_OUT_ACTION_INSERT_BITMAP, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, { SotClipboardFormatId::BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, @@ -827,6 +837,9 @@ SotAction_Impl const aEXCHG_DEST_SWDOC_FREE_AREA_Def[] = { SotClipboardFormatId::DRAWING, EXCHG_IN_ACTION_COPY }, { SotClipboardFormatId::SVXB, EXCHG_IN_ACTION_COPY }, { SotClipboardFormatId::GDIMETAFILE, EXCHG_IN_ACTION_COPY }, +#if HAVE_FEATURE_PDFIUM + { SotClipboardFormatId::PDF, EXCHG_IN_ACTION_COPY }, +#endif { SotClipboardFormatId::PNG, EXCHG_IN_ACTION_COPY }, { SotClipboardFormatId::JPEG, EXCHG_IN_ACTION_COPY }, { SotClipboardFormatId::BITMAP, EXCHG_IN_ACTION_COPY }, @@ -857,6 +870,9 @@ SotAction_Impl const aEXCHG_DEST_SWDOC_FREE_AREA_Move[] = { SotClipboardFormatId::RICHTEXT, EXCHG_IN_ACTION_COPY, SotExchangeActionFlags::InsertTargetUrl, 0 }, { SotClipboardFormatId::STRING, EXCHG_OUT_ACTION_INSERT_STRING }, { SotClipboardFormatId::GDIMETAFILE, EXCHG_OUT_ACTION_INSERT_GDIMETAFILE, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, +#if HAVE_FEATURE_PDFIUM + { SotClipboardFormatId::PDF, EXCHG_OUT_ACTION_INSERT_GRAPH, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, +#endif { SotClipboardFormatId::PNG, EXCHG_OUT_ACTION_INSERT_BITMAP, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, { SotClipboardFormatId::JPEG, EXCHG_OUT_ACTION_INSERT_BITMAP, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, { SotClipboardFormatId::BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, @@ -884,6 +900,9 @@ SotAction_Impl const aEXCHG_DEST_SWDOC_FREE_AREA_Copy[] = #ifndef MACOSX { SotClipboardFormatId::RTF, EXCHG_IN_ACTION_COPY, SotExchangeActionFlags::InsertTargetUrl, 0 }, #endif +#if HAVE_FEATURE_PDFIUM + { SotClipboardFormatId::PDF, EXCHG_OUT_ACTION_INSERT_GRAPH, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, +#endif { SotClipboardFormatId::PNG, EXCHG_OUT_ACTION_INSERT_BITMAP, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, { SotClipboardFormatId::JPEG, EXCHG_OUT_ACTION_INSERT_BITMAP, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, { SotClipboardFormatId::BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP, SotExchangeActionFlags::InsertImageMap | SotExchangeActionFlags::InsertTargetUrl, 0 }, |