fpspreadsheet: Add support of workbook, worksheet, and cell protection for xlsx (modified patch by shobits1, see http://forum.lazarus.freepascal.org/index.php/topic,36075.0.html). Add protection unit tests.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5783 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2017-03-04 21:29:12 +00:00
parent 351694ec67
commit b3110a90cc
7 changed files with 612 additions and 48 deletions

View File

@@ -170,6 +170,7 @@ procedure FixHyperlinkPathDelims(var ATarget: String);
procedure InitCell(out ACell: TCell); overload;
procedure InitCell(ARow, ACol: Cardinal; out ACell: TCell); overload;
procedure InitCryptoInfo(out AValue: TsCryptoInfo);
procedure InitFormatRecord(out AValue: TsCellFormat);
procedure InitImageRecord(out AValue: TsImage; ARow, ACol: Cardinal;
AOffsetX, AOffsetY, AScaleX, AScaleY: Double);
@@ -2079,6 +2080,18 @@ begin
ACell.Col := ACol;
end;
{@@ ----------------------------------------------------------------------------
Initializes the fields of the encryption information block (TsCryptoInfo)
-------------------------------------------------------------------------------}
procedure InitCryptoInfo(out AValue: TsCryptoInfo);
begin
AValue.Password := '';
AValue.AlgorithmName := '';
AValue.HashValue := '';
AValue.SaltValue := '';
AValue.SpinCount := 0;
end;
{@@ ----------------------------------------------------------------------------
Initializes the fields of a TsCellFormaRecord
-------------------------------------------------------------------------------}
@@ -2089,7 +2102,10 @@ begin
FillChar(AValue, SizeOf(AValue), 0);
AValue.BorderStyles := DEFAULT_BORDERSTYLES;
AValue.Background := EMPTY_FILL;
AValue.NumberFormatIndex := -1; // GENERAL format not contained in NumFormatList
AValue.NumberFormatIndex := -1;
// GENERAL format not contained in NumFormatList
AValue.Protection := DEFAULT_CELL_PROTECTION;
// NOTE: Cell protection is effective only after protecting a worksheet
end;
{@@ ----------------------------------------------------------------------------