fpspreadsheet: Fix TsWorksheetGrid.ReadFormula not working in connection with TsWorkbookSource. Improving some comments.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3834 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2014-12-11 12:09:43 +00:00
parent dae1369a15
commit a5a0030f72

View File

@ -116,6 +116,7 @@ type
procedure SetFrozenRows(AValue: Integer); procedure SetFrozenRows(AValue: Integer);
procedure SetHorAlignment(ACol, ARow: Integer; AValue: TsHorAlignment); procedure SetHorAlignment(ACol, ARow: Integer; AValue: TsHorAlignment);
procedure SetHorAlignments(ARect: TGridRect; AValue: TsHorAlignment); procedure SetHorAlignments(ARect: TGridRect; AValue: TsHorAlignment);
procedure SetReadFormulas(AValue: Boolean);
procedure SetShowGridLines(AValue: Boolean); procedure SetShowGridLines(AValue: Boolean);
procedure SetShowHeaders(AValue: Boolean); procedure SetShowHeaders(AValue: Boolean);
procedure SetTextRotation(ACol, ARow: Integer; AValue: TsTextRotation); procedure SetTextRotation(ACol, ARow: Integer; AValue: TsTextRotation);
@ -166,7 +167,7 @@ type
procedure Sort(AColSorting: Boolean; AIndex, AIndxFrom, AIndxTo:Integer); override; procedure Sort(AColSorting: Boolean; AIndex, AIndxFrom, AIndxTo:Integer); override;
procedure UpdateColWidths(AStartIndex: Integer = 0); procedure UpdateColWidths(AStartIndex: Integer = 0);
procedure UpdateRowHeights(AStartIndex: Integer = 0); procedure UpdateRowHeights(AStartIndex: Integer = 0);
{@@ Automatically recalculate formulas whenever a cell value changes, } {@@ Automatically recalculate formulas whenever a cell value changes. }
property AutoCalc: Boolean read FAutoCalc write SetAutoCalc default false; property AutoCalc: Boolean read FAutoCalc write SetAutoCalc default false;
{@@ Displays column and row headers in the fixed col/row style of the grid. {@@ Displays column and row headers in the fixed col/row style of the grid.
Deprecated. Use ShowHeaders instead. } Deprecated. Use ShowHeaders instead. }
@ -177,9 +178,9 @@ type
{@@ This number of rows at the top is "frozen", i.e. it is not possible to {@@ This number of rows at the top is "frozen", i.e. it is not possible to
scroll these rows. } scroll these rows. }
property FrozenRows: Integer read FFrozenRows write SetFrozenRows; property FrozenRows: Integer read FFrozenRows write SetFrozenRows;
{@@ Activates reading of RPN formulas. Should be turned off when reading {@@ Activates reading of RPN formulas. Should be turned off when
not implemented formulas crashes reading of the spreadsheet file. } non-implemented formulas crashe reading of the spreadsheet file. }
property ReadFormulas: Boolean read FReadFormulas write FReadFormulas; property ReadFormulas: Boolean read FReadFormulas write SetReadFormulas;
{@@ Shows/hides vertical and horizontal grid lines } {@@ Shows/hides vertical and horizontal grid lines }
property ShowGridLines: Boolean read GetShowGridLines write SetShowGridLines default true; property ShowGridLines: Boolean read GetShowGridLines write SetShowGridLines default true;
{@@ Shows/hides column and row headers in the fixed col/row style of the grid. } {@@ Shows/hides column and row headers in the fixed col/row style of the grid. }
@ -349,7 +350,7 @@ type
TsWorksheetGrid = class(TsCustomWorksheetGrid) TsWorksheetGrid = class(TsCustomWorksheetGrid)
published published
// inherited from TsCustomWorksheetGrid // inherited from TsCustomWorksheetGrid
{@@ Automatically recalculates the worksheet of a cell value changes. } {@@ Automatically recalculates the worksheet if a cell value changes. }
property AutoCalc; property AutoCalc;
{@@ Displays column and row headers in the fixed col/row style of the grid. {@@ Displays column and row headers in the fixed col/row style of the grid.
Deprecated. Use ShowHeaders instead. } Deprecated. Use ShowHeaders instead. }
@ -360,8 +361,8 @@ type
{@@ This number of rows at the top is "frozen", i.e. it is not possible to {@@ This number of rows at the top is "frozen", i.e. it is not possible to
scroll these rows. } scroll these rows. }
property FrozenRows; property FrozenRows;
{@@ Activates reading of RPN formulas. Should be turned off when reading of {@@ Activates reading of RPN formulas. Should be turned off when
not implemented formulas crashes reading of the spreadsheet file. } non-implemented formulas crashe reading of the spreadsheet file. }
property ReadFormulas; property ReadFormulas;
{@@ Shows/hides vertical and horizontal grid lines. } {@@ Shows/hides vertical and horizontal grid lines. }
property ShowGridLines; property ShowGridLines;
@ -370,7 +371,7 @@ type
{@@ Activates text overflow (cells reaching into neighbors) } {@@ Activates text overflow (cells reaching into neighbors) }
property TextOverflow; property TextOverflow;
{@@ Link to the workbook } {@@ Link to the workbook }
property WorkbookSource; //: TsWorkbookSource read FWorkbookSource write SetWorkbookSource; property WorkbookSource;
{@@ inherited from ancestors} {@@ inherited from ancestors}
property Align; property Align;
@ -3722,7 +3723,7 @@ begin
if FAutoCalc then if FAutoCalc then
FWorkbookSource.Options := FWorkbookSource.Options + [boAutoCalc] FWorkbookSource.Options := FWorkbookSource.Options + [boAutoCalc]
else else
FWorkbookSource.Options := FWorkbookSource.Options - [boAUtoCalc]; FWorkbookSource.Options := FWorkbookSource.Options - [boAutoCalc];
end; end;
if Assigned(Workbook) then if Assigned(Workbook) then
@ -3992,6 +3993,27 @@ begin
end; end;
end; end;
procedure TsCustomWorksheetGrid.SetReadFormulas(AValue: Boolean);
begin
FReadFormulas := AValue;
if Assigned(FWorkbookSource) then
begin
if FReadFormulas then
FWorkbookSource.Options := FWorkbookSource.Options + [boReadFormulas]
else
FWorkbookSource.Options := FWorkbookSource.Options - [boReadFormulas];
end;
if Assigned(Workbook) then
begin
if FReadFormulas then
Workbook.Options := Workbook.Options + [boReadFormulas]
else
Workbook.Options := Workbook.Options - [boReadFormulas];
end;
end;
{ Shows / hides the worksheet's grid lines } { Shows / hides the worksheet's grid lines }
procedure TsCustomWorksheetGrid.SetShowGridLines(AValue: Boolean); procedure TsCustomWorksheetGrid.SetShowGridLines(AValue: Boolean);
begin begin