fpspreadsheet: Fix ods reader crashing when the file contains an embedded chart.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8066 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2021-08-08 15:24:43 +00:00
parent 6a58c84249
commit e9fc0f2a36

View File

@ -4731,24 +4731,25 @@ procedure TsSpreadOpenDocReader.ReadShape(ANode: TDOMNode;
if href <> '' then
begin
idx := TsWorkbook(FWorkbook).FindEmbeddedObj(ExtractFileName(href));
with FWorksheet as TsWorksheet do begin
// When called from a cell node, x and y are relative to the cell.
// When called from the Shapes node, x and y refer to the worksheet.
CalcImageCell(idx, x, y, w, h, r, c, dy, dx, sx, sy); // order of dx and dy is correct!
if ARow <> UNASSIGNED_ROW_COL_INDEX then begin
r := ARow;
dy := y;
if idx > -1 then
with FWorksheet as TsWorksheet do begin
// When called from a cell node, x and y are relative to the cell.
// When called from the Shapes node, x and y refer to the worksheet.
CalcImageCell(idx, x, y, w, h, r, c, dy, dx, sx, sy); // order of dx and dy is correct!
if ARow <> UNASSIGNED_ROW_COL_INDEX then begin
r := ARow;
dy := y;
end;
if ACol <> UNASSIGNED_ROW_COL_INDEX then begin
c := ACol;
dx := x;
end;
idx := WriteImage(r, c, idx, dx, dy, sx, sy);
if AHLink <> '' then begin
img := GetPointerToImage(idx);
img^.HyperlinkTarget := AHLink;
end;
end;
if ACol <> UNASSIGNED_ROW_COL_INDEX then begin
c := ACol;
dx := x;
end;
idx := WriteImage(r, c, idx, dx, dy, sx, sy);
if AHLink <> '' then begin
img := GetPointerToImage(idx);
img^.HyperlinkTarget := AHLink;
end;
end;
end;
childNode := childnode.NextSibling;
end;