summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.co.uk>2017-09-06 20:35:11 +0530
committerDennis Francis <dennis.francis@collabora.co.uk>2017-09-11 13:22:24 +0200
commit157d1a774086d7344d443005442682f2ca3c01a9 (patch)
tree3513fa0c0945f5b682f105e8e72653bd1abddd43 /sc
parent3fa79c0fa5619911e7a251e2b3a837fdaa426f48 (diff)
tdf#108299: Limit the size of bitmap created for clipboard...
to screen size. This is to avoid hang in ScTransferObj::GetData() for BMP/PNG flavors due to unhandled structured exception when opengl is used and user copies full rows in the spreadsheet. Change-Id: Ie2c2205e3f33ef402d31287a6874df87d218bcb3 Reviewed-on: https://gerrit.libreoffice.org/42013 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/app/transobj.cxx11
-rw-r--r--sc/source/ui/inc/transobj.hxx1
2 files changed, 11 insertions, 1 deletions
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index d24e83b7382b..9f80b62a19f1 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -33,6 +33,7 @@
#include <vcl/virdev.hxx>
#include <sfx2/app.hxx>
#include <sfx2/docfile.hxx>
+#include <sfx2/viewfrm.hxx>
#include "transobj.hxx"
#include "patattr.hxx"
@@ -64,6 +65,7 @@
#include "cellsuno.hxx"
#include "stringutil.hxx"
#include "formulaiter.hxx"
+#include "tabvwsh.hxx"
#include <gridwin.hxx>
using namespace com::sun::star;
@@ -174,6 +176,8 @@ ScTransferObj::ScTransferObj( ScDocument* pClipDoc, const TransferableObjectDesc
aBlock = ScRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
nVisibleTab = nTab1; // valid table as default
+ aMaxBitMapSize = ScTabViewShell::GetActiveViewShell()->GetViewFrame()->GetWindow().GetSizePixel();
+
tools::Rectangle aMMRect = pDoc->GetMMRect( nCol1,nRow1, nCol2,nRow2, nTab1 );
aObjDesc.maSize = aMMRect.GetSize();
PrepareOLE( aObjDesc );
@@ -354,8 +358,13 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt
tools::Rectangle aMMRect = pDoc->GetMMRect( aBlock.aStart.Col(), aBlock.aStart.Row(),
aBlock.aEnd.Col(), aBlock.aEnd.Row(),
aBlock.aStart.Tab() );
+
ScopedVclPtrInstance< VirtualDevice > pVirtDev;
- pVirtDev->SetOutputSizePixel( pVirtDev->LogicToPixel( aMMRect.GetSize(), MapUnit::Map100thMM ) );
+ Size aSize = pVirtDev->LogicToPixel( aMMRect.GetSize(), MapUnit::Map100thMM );
+ // Limit the width and height to screen area in pixel scale
+ aSize.Width() = std::min( aMaxBitMapSize.Width(), aSize.Width() );
+ aSize.Height() = std::min( aMaxBitMapSize.Height(), aSize.Height() );
+ pVirtDev->SetOutputSizePixel( aSize );
PaintToDev( pVirtDev, pDoc, 1.0, aBlock );
diff --git a/sc/source/ui/inc/transobj.hxx b/sc/source/ui/inc/transobj.hxx
index b897a727937e..f40de060d413 100644
--- a/sc/source/ui/inc/transobj.hxx
+++ b/sc/source/ui/inc/transobj.hxx
@@ -42,6 +42,7 @@ class ScTransferObj : public TransferableHelper
private:
ScDocument* pDoc;
ScRange aBlock;
+ Size aMaxBitMapSize;
SCROW nNonFiltered; // non-filtered rows
TransferableObjectDescriptor aObjDesc;
SfxObjectShellRef aDocShellRef;