You've already forked lazarus-ccr
fpspreadsheet: Fix infinite loop in Worksheeet sorting when the sorted range contains an empty cell. Make Worksheetgrid.Sort public.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6928 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -4339,6 +4339,11 @@ begin
|
||||
if (ACell1 = nil) and (ACell2 = nil) then
|
||||
Result := 0
|
||||
else
|
||||
if (ACell1 <> nil) and (ACell1^.ContentType = cctEmpty) and
|
||||
(ACell2 <> nil) and (ACell2^.ContentType = cctEmpty)
|
||||
then
|
||||
Result := 0
|
||||
else
|
||||
if (ACell1 = nil) or (ACell1^.ContentType = cctEmpty) then
|
||||
begin
|
||||
Result := +1; // Empty cells go to the end
|
||||
@ -4349,9 +4354,11 @@ begin
|
||||
Result := -1; // Empty cells go to the end
|
||||
exit; // Avoid SortOrder to bring the empty cell to the top!
|
||||
end else
|
||||
{
|
||||
if (ACell1^.ContentType = cctEmpty) and (ACell2^.ContentType = cctEmpty) then
|
||||
Result := 0
|
||||
else
|
||||
}
|
||||
if (ACell1^.ContentType = cctUTF8String) and (ACell2^.ContentType = cctUTF8String) then
|
||||
begin
|
||||
if ssoCaseInsensitive in ASortOptions then
|
||||
|
@ -324,7 +324,6 @@ type
|
||||
function SelectCell(ACol, ARow: Integer): Boolean; override;
|
||||
procedure SetEditText(ACol, ARow: Longint; const AValue: string); override;
|
||||
procedure Setup;
|
||||
procedure Sort(AColSorting: Boolean; AIndex, AIndxFrom, AIndxTo:Integer); override;
|
||||
function ToPixels(AValue: Double): Integer;
|
||||
procedure TopLeftChanged; override;
|
||||
function TrimToCell(ACell: PCell): String;
|
||||
@ -435,6 +434,8 @@ type
|
||||
const ALeftOuterStyle, ATopOuterStyle, ARightOuterStyle, ABottomOuterStyle,
|
||||
AHorInnerStyle, AVertInnerStyle: TsCellBorderStyle);
|
||||
|
||||
procedure Sort(AColSorting: Boolean; AIndex, AIndxFrom, AIndxTo:Integer); override;
|
||||
|
||||
{ Row height / col width calculation }
|
||||
procedure UpdateColWidth(ACol: Integer);
|
||||
procedure UpdateColWidths(AStartIndex: Integer = 0);
|
||||
@ -5569,6 +5570,7 @@ begin
|
||||
);
|
||||
end;
|
||||
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Converts a coordinate given in workbook units to pixels using the current
|
||||
screen resolution
|
||||
|
Reference in New Issue
Block a user