[Libreoffice-commits] core.git: sc/source
Dennis Francis
dennis.francis at collabora.co.uk
Mon Sep 11 11:22:45 UTC 2017
sc/source/ui/app/transobj.cxx | 11 ++++++++++-
sc/source/ui/inc/transobj.hxx | 1 +
2 files changed, 11 insertions(+), 1 deletion(-)
New commits:
commit 157d1a774086d7344d443005442682f2ca3c01a9
Author: Dennis Francis <dennis.francis at collabora.co.uk>
Date: Wed Sep 6 20:35:11 2017 +0530
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 at collabora.com>
Tested-by: Jenkins <ci at libreoffice.org>
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;
More information about the Libreoffice-commits
mailing list