summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2014-03-04 20:41:02 +0100
committerJan Holesovsky <kendy@collabora.com>2014-03-04 23:05:11 +0100
commitbe4f7ea3f6c8bddba3ca1ae3d9d9e67449bbc3cb (patch)
tree6ef1cb20dff6cb70cd2adc635c66d45024043d8c /svtools
parent0b2637dda47690da69f748119081151f41fe4133 (diff)
OLE preview: Limit the GDI metafile size to 100000 actions.
Excel can copy huge metafiles to the clipboard, with over 3 million of actions, which are 1) unusable, and 2) crash LibreOffice because of their size. So let's just limit the size of metafiles to be under 100000 actions, otherwise use the 'OLE' bitmap. Change-Id: I6a50471e6fe6ab9417592c011bf78cad6247236b
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/misc/transfer.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index a7b63547c57f..def8b3d54ae0 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -1777,10 +1777,12 @@ sal_Bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapE
-sal_Bool TransferableDataHelper::GetGDIMetaFile( SotFormatStringId nFormat, GDIMetaFile& rMtf )
+sal_Bool TransferableDataHelper::GetGDIMetaFile(SotFormatStringId nFormat, GDIMetaFile& rMtf, size_t nMaxActions)
{
DataFlavor aFlavor;
- return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetGDIMetaFile( aFlavor, rMtf ) );
+ return SotExchange::GetFormatDataFlavor(nFormat, aFlavor) &&
+ GetGDIMetaFile(aFlavor, rMtf) &&
+ (nMaxActions == 0 || rMtf.GetActionSize() < nMaxActions);
}