From cb4466eef7cb006acda641c8df65de046914d2b2 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Tue, 2 Aug 2016 13:58:08 +0000 Subject: [PATCH] fpspreadsheet: Fix pasting from LibreOffice clipboard. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5066 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/fpspreadsheet/fpspreadsheet.pas | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/components/fpspreadsheet/fpspreadsheet.pas b/components/fpspreadsheet/fpspreadsheet.pas index 92f069b70..911626479 100755 --- a/components/fpspreadsheet/fpspreadsheet.pas +++ b/components/fpspreadsheet/fpspreadsheet.pas @@ -8595,6 +8595,7 @@ begin end; end; // Select all copied cells + sel := Range(Cardinal(-1), Cardinal(-1), Cardinal(-1), Cardinal(-1)); SetLength(selArray, nselS); for i := 0 to nselS-1 do begin @@ -8615,14 +8616,15 @@ begin r := sel.Row2; c := sel.Col2; end; - ActiveWorksheet.SelectCell(r + dr, c + dc); + if (r <> -1) and (c <> -1) then + ActiveWorksheet.SelectCell(r + dr, c + dc); end else // ------------------------------------------------------------------------- // Case (2): Source is a single block (not necessarily a cell), Dest can be // any shape --> source is tiled into destination // ------------------------------------------------------------------------- - if nselS = 1 then +// if nselS = 1 then begin // size of source block with clipsheet do @@ -8672,13 +8674,15 @@ begin end; // while r... end; // for i // No need to select copied cells - they already are. - end + end ; + { else // ------------------------------------------------------------------------- // Other arrangements of source and destination are not supported // ------------------------------------------------------------------------- raise Exception.Create('This arrangement of source and destination '+ 'cells in not supported for copy & paste'); + } finally clipbook.Free; end;