You've already forked lazarus-ccr
fpspreadsheet: CutToClipboard using system clipboard now
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4361 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -446,6 +446,7 @@ type
|
||||
// Selected cell and ranges
|
||||
procedure SelectCell(ARow, ACol: Cardinal);
|
||||
procedure ClearSelection;
|
||||
procedure DeleteSelection;
|
||||
function GetSelection: TsCellRangeArray;
|
||||
function GetSelectionAsString: String;
|
||||
function GetSelectionCount: Integer;
|
||||
@ -3579,6 +3580,25 @@ begin
|
||||
SetLength(FSelection, 0);
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Deletes all selected cells (delete = make them empty)
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsWorksheet.DeleteSelection;
|
||||
var
|
||||
i: Integer;
|
||||
r, c: Cardinal;
|
||||
cell: PCell;
|
||||
begin
|
||||
for i:=0 to High(FSelection) do
|
||||
for r := FSelection[i].Row1 to FSelection[i].Row2 do
|
||||
for c := FSelection[i].Col1 to FSelection[i].Col2 do
|
||||
begin
|
||||
cell := FindCell(r, c);
|
||||
DeleteCell(cell);
|
||||
end;
|
||||
ClearSelection;
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Returns the list of selected cell ranges
|
||||
-------------------------------------------------------------------------------}
|
||||
|
@ -62,7 +62,6 @@ type
|
||||
FFileFormat: TsSpreadsheetFormat;
|
||||
FPendingSelection: TsCellRangeArray;
|
||||
FPendingOperation: TsCopyOperation;
|
||||
FCutPending: Boolean;
|
||||
FControlLockCount: Integer;
|
||||
FOptions: TsWorkbookOptions;
|
||||
FOnError: TsWorkbookSourceErrorEvent;
|
||||
@ -122,8 +121,8 @@ type
|
||||
const ASelection: TsCellRangeArray);
|
||||
|
||||
{ Clipboard }
|
||||
function CellClipboardEmpty: Boolean;
|
||||
procedure ClearCellClipboard;
|
||||
// function CellClipboardEmpty: Boolean;
|
||||
// procedure ClearCellClipboard;
|
||||
procedure CopyCellsToClipboard;
|
||||
procedure CutCellsToClipboard;
|
||||
procedure PasteCellsFromClipboard(AItem: TsCopyOperation);
|
||||
@ -525,9 +524,6 @@ type
|
||||
property MultipleRanges: Boolean read FMultipleRanges write FMultipleRanges;
|
||||
end;
|
||||
|
||||
var
|
||||
CellClipboard: TsCellList = nil;
|
||||
|
||||
destructor TsCellList.Destroy;
|
||||
begin
|
||||
Clear;
|
||||
@ -1138,23 +1134,6 @@ begin
|
||||
FPendingOperation := AOperation;
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Checks whether the internal "Clipboard" is empty or not.
|
||||
-------------------------------------------------------------------------------}
|
||||
function TsWorkbookSource.CellClipboardEmpty: Boolean;
|
||||
begin
|
||||
Result := CellClipboard.Count = 0;
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Clears the interal "Clipboard". Note that this is not the system clipboard.
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsWorkbookSource.ClearCellClipboard;
|
||||
begin
|
||||
CellClipboard.Clear;
|
||||
CellClipboard.MultipleRanges := false;
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Copies the selected cells of the worksheet to an internal list ("Clipboard").
|
||||
Note that this is not the system clipboard in the current implementation.
|
||||
@ -1222,12 +1201,10 @@ begin
|
||||
finally
|
||||
Clipboard.Close;
|
||||
end;
|
||||
|
||||
(*
|
||||
exit;
|
||||
|
||||
|
||||
FCutPending := false;
|
||||
|
||||
ClearCellClipboard;
|
||||
|
||||
for i:=0 to High(sel) do
|
||||
@ -1242,19 +1219,19 @@ begin
|
||||
end;
|
||||
|
||||
CellClipboard.MultipleRanges := (Length(sel) > 1);
|
||||
*)
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Copies the selected cells of the worksheet to an internal list ("Clipboard")
|
||||
and sets the marker "CutPending". This means that the source cells will be
|
||||
cleared when PasteCellsFromClipboard is called.
|
||||
Note that the clipboard is not the system clipboard in the current
|
||||
implementation.
|
||||
and deletes them afterwards.
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsWorkbookSource.CutCellsToClipboard;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
CopyCellsToClipboard;
|
||||
FCutPending := true;
|
||||
FWorksheet.DeleteSelection;
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
@ -1307,11 +1284,11 @@ begin
|
||||
Clipboard.Close;
|
||||
end;
|
||||
|
||||
(*
|
||||
exit;
|
||||
|
||||
|
||||
|
||||
|
||||
if CellClipboard.Count = 0 then
|
||||
exit;
|
||||
|
||||
@ -1401,6 +1378,7 @@ begin
|
||||
finally
|
||||
EnableControls;
|
||||
end;
|
||||
*)
|
||||
end;
|
||||
(*
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
@ -3198,7 +3176,7 @@ end;
|
||||
initialization
|
||||
{$I fpspreadsheetctrls.lrs}
|
||||
|
||||
CellClipboard := TsCellList.Create;
|
||||
// CellClipboard := TsCellList.Create;
|
||||
|
||||
ComboColors := TsPalette.Create;
|
||||
ComboColors.AddExcelColors;
|
||||
@ -3214,7 +3192,7 @@ initialization
|
||||
|
||||
|
||||
finalization
|
||||
CellClipboard.Free;
|
||||
// CellClipboard.Free;
|
||||
if ComboColors <> nil then ComboColors.Free;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user