You've already forked lazarus-ccr
fpspreadsheet: Fix location of cell comments after insert/delete of rows/cols
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3952 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1987,15 +1987,24 @@ var
|
|||||||
col: Cardinal;
|
col: Cardinal;
|
||||||
formula: TsRPNFormula;
|
formula: TsRPNFormula;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
comment: PsComment;
|
||||||
begin
|
begin
|
||||||
col := LongInt({%H-}PtrInt(arg));
|
col := LongInt({%H-}PtrInt(arg));
|
||||||
cell := PCell(data);
|
cell := PCell(data);
|
||||||
if cell = nil then // This should not happen. Just to make sure...
|
if cell = nil then // This should not happen. Just to make sure...
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
// Update column index of moved cell
|
|
||||||
if (cell^.Col > col) then
|
if (cell^.Col > col) then
|
||||||
|
begin
|
||||||
|
// Update column index of comment assigned to moved cell
|
||||||
|
if HasComment(cell) then
|
||||||
|
begin
|
||||||
|
comment := FindComment(cell);
|
||||||
|
dec(comment^.Col);
|
||||||
|
end;
|
||||||
|
// Update column index of moved cell
|
||||||
dec(cell^.Col);
|
dec(cell^.Col);
|
||||||
|
end;
|
||||||
|
|
||||||
// Update formulas
|
// Update formulas
|
||||||
if HasFormula(cell) then
|
if HasFormula(cell) then
|
||||||
@ -2042,15 +2051,24 @@ var
|
|||||||
row: Cardinal;
|
row: Cardinal;
|
||||||
formula: TsRPNFormula;
|
formula: TsRPNFormula;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
comment: PsComment;
|
||||||
begin
|
begin
|
||||||
row := LongInt({%H-}PtrInt(arg));
|
row := LongInt({%H-}PtrInt(arg));
|
||||||
cell := PCell(data);
|
cell := PCell(data);
|
||||||
if cell = nil then // This should not happen. Just to make sure...
|
if cell = nil then // This should not happen. Just to make sure...
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
// Update row index of moved cell
|
|
||||||
if (cell^.Row > row) then
|
if (cell^.Row > row) then
|
||||||
|
begin
|
||||||
|
// Update row index of comment assigned to moved cell
|
||||||
|
if HasComment(cell) then
|
||||||
|
begin
|
||||||
|
comment := FindComment(cell);
|
||||||
|
dec(comment^.Row);
|
||||||
|
end;
|
||||||
|
// Update row index of moved cell
|
||||||
dec(cell^.Row);
|
dec(cell^.Row);
|
||||||
|
end;
|
||||||
|
|
||||||
// Update formulas
|
// Update formulas
|
||||||
if HasFormula(cell) then
|
if HasFormula(cell) then
|
||||||
@ -6435,6 +6453,7 @@ var
|
|||||||
col: Cardinal;
|
col: Cardinal;
|
||||||
formula: TsRPNFormula;
|
formula: TsRPNFormula;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
comment: PsComment;
|
||||||
begin
|
begin
|
||||||
col := LongInt({%H-}PtrInt(arg));
|
col := LongInt({%H-}PtrInt(arg));
|
||||||
cell := PCell(data);
|
cell := PCell(data);
|
||||||
@ -6442,8 +6461,16 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
|
|
||||||
if (cell^.Col >= col) then
|
if (cell^.Col >= col) then
|
||||||
|
begin
|
||||||
|
// Update of column index of comment assigned to moved cell
|
||||||
|
if HasComment(cell) then begin
|
||||||
|
comment := FindComment(cell);
|
||||||
|
inc(comment^.Col);
|
||||||
|
end;
|
||||||
|
|
||||||
// Update column index of moved cell
|
// Update column index of moved cell
|
||||||
inc(cell^.Col);
|
inc(cell^.Col);
|
||||||
|
end;
|
||||||
|
|
||||||
// Update formulas
|
// Update formulas
|
||||||
if HasFormula(cell) and (cell^.FormulaValue <> '' ) then
|
if HasFormula(cell) and (cell^.FormulaValue <> '' ) then
|
||||||
@ -6544,13 +6571,22 @@ var
|
|||||||
row: Cardinal;
|
row: Cardinal;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
formula: TsRPNFormula;
|
formula: TsRPNFormula;
|
||||||
|
comment: PsComment;
|
||||||
begin
|
begin
|
||||||
row := LongInt({%H-}PtrInt(arg));
|
row := LongInt({%H-}PtrInt(arg));
|
||||||
cell := PCell(data);
|
cell := PCell(data);
|
||||||
|
|
||||||
// Update row index of moved cells
|
|
||||||
if cell^.Row >= row then
|
if cell^.Row >= row then
|
||||||
|
begin
|
||||||
|
// Update row index of comment attached to moved cells
|
||||||
|
if HasComment(cell) then
|
||||||
|
begin
|
||||||
|
comment := FindComment(cell);
|
||||||
|
inc(comment^.Row);
|
||||||
|
end;
|
||||||
|
// Update row index of moved cells
|
||||||
inc(cell^.Row);
|
inc(cell^.Row);
|
||||||
|
end;
|
||||||
|
|
||||||
// Update formulas
|
// Update formulas
|
||||||
if HasFormula(cell) then
|
if HasFormula(cell) then
|
||||||
|
@ -1604,8 +1604,6 @@ end;
|
|||||||
-------------------------------------------------------------------------------}
|
-------------------------------------------------------------------------------}
|
||||||
procedure TsSpreadBIFF8Writer.WriteComments(AStream: TStream;
|
procedure TsSpreadBIFF8Writer.WriteComments(AStream: TStream;
|
||||||
AWorksheet: TsWorksheet);
|
AWorksheet: TsWorksheet);
|
||||||
var
|
|
||||||
i: Integer;
|
|
||||||
begin
|
begin
|
||||||
exit; // Remove after comments can be written correctly
|
exit; // Remove after comments can be written correctly
|
||||||
{$warning TODO: Fix writing of cell comments in BIFF8 (file is readable by OpenOffice, but not by Excel)}
|
{$warning TODO: Fix writing of cell comments in BIFF8 (file is readable by OpenOffice, but not by Excel)}
|
||||||
|
Reference in New Issue
Block a user