fpspreadsheet: Some cleanup

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4402 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2015-12-12 10:17:03 +00:00
parent df4dfb0ba4
commit b3ee66fb2f
12 changed files with 27 additions and 24 deletions

View File

@ -1738,8 +1738,8 @@ end;
procedure TsHTMLWriter.WriteWorksheet(AStream: TStream; ASheet: TsWorksheet);
var
r, rFirst, rLast: Cardinal;
c, cFirst, cLast: Cardinal;
r, rFirst, rLast: LongInt;
c, cFirst, cLast: LongInt;
cell: PCell;
style, s: String;
fixedLayout: Boolean;

View File

@ -50,7 +50,7 @@ procedure RichTextToHTML(AWorkbook: TsWorkbook; AFont: TsFont;
implementation
uses
math, lazUtf8, fasthtmlparser, StrUtils, //Strings,
math, lazUtf8, fasthtmlparser, //StrUtils, //Strings,
fpsUtils, fpsClasses;
const

View File

@ -124,7 +124,7 @@ type
implementation
uses
TypInfo, Math, LazUTF8, fpsutils, fpsCurrency;
TypInfo, Math, LazUTF8, fpsCurrency;
function CreateNumFormatParams(ANumFormatStr: String;

View File

@ -879,6 +879,7 @@ var
readerClass: TsSpreadReaderClass;
begin
Result := nil;
Unused(AParams);
readerClass := GetSpreadReaderClass(AFormatID);
if readerClass <> nil
@ -908,6 +909,7 @@ var
writerClass: TsSpreadWriterClass;
begin
Result := nil;
Unused(AParams);
writerClass := GetSpreadWriterClass(AFormatID);
if writerClass <> nil then
@ -6949,8 +6951,6 @@ procedure TsWorkbook.WriteToFile(const AFileName: String;
const AOverwriteExisting: Boolean; AParams: TsStreamParams = []);
var
fileformats: TsSpreadFormatIDArray;
// formatID: TsSpreadFormatID;
valid: Boolean;
ext: String;
begin
ext := ExtractFileExt(AFileName);
@ -7942,10 +7942,10 @@ begin
for i := 0 to n-1 do
begin
sel := clipsheet.GetSelection[i];
selArray[i].Row1 := sel.Row1 + dr;
selArray[i].Col1 := sel.Col1 + dc;
selArray[i].Row2 := sel.Row2 + dr;
selArray[i].Col2 := sel.Col2 + dc;
selArray[i].Row1 := LongInt(sel.Row1) + dr;
selArray[i].Col1 := LongInt(sel.Col1) + dc;
selArray[i].Row2 := LongInt(sel.Row2) + dr;
selArray[i].Col2 := LongInt(sel.Col2) + dc;
end;
ActiveWorksheet.SetSelection(selArray);
// Select active cell. If not found in the file, let's use the last cell of the selections

View File

@ -1366,8 +1366,6 @@ end;
and deletes them afterwards.
-------------------------------------------------------------------------------}
procedure TsWorkbookSource.CutCellsToClipboard;
var
i: Integer;
begin
CopyCellsToClipboard;
FWorksheet.DeleteSelection;

View File

@ -2702,8 +2702,8 @@ begin
// determination since only the height of the first row of the block
// (containing the merge base cell) would change which is very confusing.
exit;
cellR := CellRect(c1+FHeaderCount, ARow);
cellR.Right := CellRect(c2+FHeaderCount, ARow).Right;
cellR := CellRect(LongInt(c1)+FHeaderCount, ARow);
cellR.Right := CellRect(LongInt(c2)+FHeaderCount, ARow).Right;
end;
InflateRect(cellR, -constCellPadding, -constCellPadding);

View File

@ -664,7 +664,6 @@ function ParseCellString_R1C1(const AStr: String; ABaseRow, ABaseCol: Cardinal;
var
P: PChar;
s: String;
n: LongInt;
inRowCol: Integer; // 1 = in row, 2 = in col
r, c: LongInt;
inBracket: Boolean;
@ -927,7 +926,7 @@ begin
Result := 'R' else
Result := 'R[' + IntToStr(delta) + ']';
end else
Result := 'R' + IntToStr(ARow+1);
Result := 'R' + IntToStr(LongInt(ARow)+1);
if rfRelCol in AFlags then
begin
@ -936,7 +935,7 @@ begin
Result := Result + 'C' else
Result := Result + 'C[' + IntToStr(delta) + ']';
end else
Result := Result + 'C' + IntToStr(ACol+1);
Result := Result + 'C' + IntToStr(LongInt(ACol)+1);
end;
@ -1092,7 +1091,6 @@ end;
function GetFormatFromFileName(const AFileName: TFileName;
out AFormatID: TsSpreadFormatID): Boolean;
var
suffix: String;
fileformats: TsSpreadFormatIDArray;
begin
fileFormats := GetSpreadFormatsFromFileName(faRead, AFileName, ord(sfExcel8));
@ -1114,7 +1112,10 @@ var
fmtID: TsSpreadFormatID;
begin
Result := GetFormatFromFileName(AFileName, fmtID);
if Result and (fmtID < 0) then Result := false;
if fmtID > 0 then
SheetType := TsSpreadsheetFormat(fmtID)
else if Result then
Result := false;
end;
{

View File

@ -9,7 +9,6 @@
<Version Value="11"/>
<PathDelim Value="\"/>
<SearchPaths>
<OtherUnitFiles Value="."/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>

View File

@ -161,7 +161,7 @@ implementation
uses
Math,
fpsStrings, fpsRegFileFormats, fpsReaderWriter, fpsPalette, fpsNumFormat;
fpsStrings, fpsRegFileFormats, fpsPalette, fpsNumFormat;
const
{ Excel record IDs }

View File

@ -214,7 +214,7 @@ implementation
uses
Math,
fpsStrings, fpsRegFileFormats, fpsStreams, fpsReaderWriter, fpsPalette, fpsNumFormat;
fpsStrings, fpsRegFileFormats, fpsStreams, fpsPalette, fpsNumFormat;
const
{ Excel record IDs }

View File

@ -264,7 +264,7 @@ implementation
uses
Math, lconvencoding, LazFileUtils, URIParser,
fpsStrings, fpsStreams, fpsRegFileFormats, fpsReaderWriter, fpsPalette,
fpsStrings, fpsStreams, fpsRegFileFormats, fpsPalette,
fpsNumFormat, fpsExprParser, xlsEscher;
const

View File

@ -90,7 +90,7 @@ implementation
uses
StrUtils, Math,
fpsStrings, fpsRegFileFormats, fpsUtils, fpsStreams, fpsNumFormat, fpsHTMLUtils;
fpsStrings, fpsRegFileFormats, fpsUtils, fpsNumFormat, fpsHTMLUtils;
const
FMT_OFFSET = 61;
@ -318,6 +318,7 @@ end;
procedure TsSpreadExcelXMLWriter.WriteBlank(AStream: TStream;
const ARow, ACol: Cardinal; ACell: PCell);
begin
Unused(ARow, ACol);
AppendToStream(AStream, Format(CELL_INDENT +
'<Cell%s%s%s%s>' + // colIndex, style, hyperlink, merge
'%s' + // Comment <Comment>...</Comment>
@ -330,6 +331,7 @@ end;
procedure TsSpreadExcelXMLWriter.WriteBool(AStream: TStream;
const ARow, ACol: Cardinal; const AValue: boolean; ACell: PCell);
begin
Unused(ARow, ACol);
AppendToStream(AStream, Format(CELL_INDENT +
'<Cell%s%s%s%s%s>' + // colIndex, style, formula, hyperlink, merge
'<Data ss:Type="%s">' + // data type
@ -373,6 +375,7 @@ var
nfp: TsNumFormatParams;
fmt: PsCellFormat;
begin
Unused(ARow, ACol);
ExcelDate := AValue;
fmt := FWorkbook.GetPointerToCellFormat(ACell^.FormatIndex);
// Times have an offset of 1 day!
@ -404,6 +407,7 @@ end;
procedure TsSpreadExcelXMLWriter.WriteError(AStream: TStream;
const ARow, ACol: Cardinal; const AValue: TsErrorValue; ACell: PCell);
begin
Unused(ARow, ACol);
AppendToStream(AStream, Format(CELL_INDENT +
'<Cell%s%s%s%s%s>' + LF + VALUE_INDENT + // colIndex, style, formula, hyperlink, merge
'<Data ss:Type="%s">' + // data type
@ -489,6 +493,7 @@ end;
procedure TsSpreadExcelXMLWriter.WriteNumber(AStream: TStream; const ARow, ACol: Cardinal;
const AValue: double; ACell: PCell);
begin
Unused(ARow, ACol);
AppendToStream(AStream, Format(CELL_INDENT +
'<Cell%s%s%s%s%s>' + LF + VALUE_INDENT + // colIndex, style, formula, hyperlink, merge
'<Data ss:Type="%s">' + // data type