fpspreadsheet: Fix compilation of spready

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4481 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-01-27 22:29:45 +00:00
parent 7679ef468c
commit 9e637a3e93
2 changed files with 42 additions and 21 deletions

View File

@ -11,7 +11,7 @@ object MainFrm: TMainFrm
OnCreate = FormCreate OnCreate = FormCreate
OnDestroy = FormDestroy OnDestroy = FormDestroy
ShowHint = True ShowHint = True
LCLVersion = '1.5' LCLVersion = '1.7'
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 82 Height = 82
@ -509,11 +509,15 @@ object MainFrm: TMainFrm
FrozenCols = 0 FrozenCols = 0
FrozenRows = 0 FrozenRows = 0
ReadFormulas = False ReadFormulas = False
SelectionPen.JoinStyle = pjsMiter
SelectionPen.Width = 3
WorkbookSource = WorksheetGrid.internal WorkbookSource = WorksheetGrid.internal
Align = alClient Align = alClient
AutoAdvance = aaDown AutoAdvance = aaDown
BorderStyle = bsNone BorderStyle = bsNone
ColCount = 27 ColCount = 27
DefaultColWidth = 64
DefaultRowHeight = 22
MouseWheelOption = mwGrid MouseWheelOption = mwGrid
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goRowSizing, goColSizing, goThumbTracking, goDblClickAutoSize, goHeaderHotTracking, goHeaderPushedLook, goFixedColSizing, goCellHints] Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goRowSizing, goColSizing, goThumbTracking, goDblClickAutoSize, goHeaderHotTracking, goHeaderPushedLook, goFixedColSizing, goCellHints]
RowCount = 101 RowCount = 101

View File

@ -423,7 +423,7 @@ begin
BeginUpdate; BeginUpdate;
try try
if TAction(Sender).Tag = 0 then begin if TAction(Sender).Tag = 0 then begin
CellBorders[Selection] := []; CellBorders[Selection.Left, Selection.Top, Selection.Right, Selection.Bottom] := [];
exit; exit;
end; end;
// Top and bottom edges // Top and bottom edges
@ -608,9 +608,9 @@ begin
with WorksheetGrid do begin with WorksheetGrid do begin
if Workbook = nil then if Workbook = nil then
exit; exit;
FontDialog.Font := CellFonts[Selection]; FontDialog.Font := CellFonts[Selection.Left, Selection.Top, Selection.Right, Selection.Bottom];
if FontDialog.Execute then if FontDialog.Execute then
CellFonts[Selection] := FontDialog.Font; CellFonts[Selection.Left, Selection.Top, Selection.Right, Selection.Bottom] := FontDialog.Font;
end; end;
end; end;
@ -626,7 +626,7 @@ begin
if AcFontItalic.Checked then Include(style, fssItalic); if AcFontItalic.Checked then Include(style, fssItalic);
if AcFontStrikeout.Checked then Include(style, fssStrikeout); if AcFontStrikeout.Checked then Include(style, fssStrikeout);
if AcFontUnderline.Checked then Include(style, fssUnderline); if AcFontUnderline.Checked then Include(style, fssUnderline);
CellFontStyles[Selection] := style; CellFontStyles[Selection.Left, Selection.Top, Selection.Right, Selection.Bottom] := style;
end; end;
end; end;
@ -658,7 +658,8 @@ begin
hor_align := TsHorAlignment(TAction(Sender).Tag - HORALIGN_TAG) hor_align := TsHorAlignment(TAction(Sender).Tag - HORALIGN_TAG)
else else
hor_align := haDefault; hor_align := haDefault;
with WorksheetGrid do HorAlignments[Selection] := hor_align; with WorksheetGrid do
HorAlignments[Selection.Left, Selection.Top, Selection.Right, Selection.Bottom] := hor_align;
UpdateHorAlignmentActions; UpdateHorAlignmentActions;
end; end;
@ -882,7 +883,8 @@ begin
text_rot := TsTextRotation(TAction(Sender).Tag - TEXTROT_TAG) text_rot := TsTextRotation(TAction(Sender).Tag - TEXTROT_TAG)
else else
text_rot := trHorizontal; text_rot := trHorizontal;
with WorksheetGrid do TextRotations[Selection] := text_rot; with WorksheetGrid do
TextRotations[Selection.Left, Selection.Top, Selection.Right, Selection.Bottom] := text_rot;
UpdateTextRotationActions; UpdateTextRotationActions;
end; end;
@ -894,7 +896,8 @@ begin
vert_align := TsVertAlignment(TAction(Sender).Tag - VERTALIGN_TAG) vert_align := TsVertAlignment(TAction(Sender).Tag - VERTALIGN_TAG)
else else
vert_align := vaDefault; vert_align := vaDefault;
with WorksheetGrid do VertAlignments[Selection] := vert_align; with WorksheetGrid do
VertAlignments[Selection.Left, Selection.Top, Selection.Right, Selection.Bottom] := vert_align;
UpdateVertAlignmentActions; UpdateVertAlignmentActions;
end; end;
@ -907,7 +910,8 @@ end;
procedure TMainFrm.AcWordwrapExecute(Sender: TObject); procedure TMainFrm.AcWordwrapExecute(Sender: TObject);
begin begin
with WorksheetGrid do Wordwraps[Selection] := TAction(Sender).Checked; with WorksheetGrid do
Wordwraps[Selection.Left, Selection.Top, Selection.Right, Selection.Bottom] := TAction(Sender).Checked;
end; end;
procedure TMainFrm.BeforeRun; procedure TMainFrm.BeforeRun;
@ -947,9 +951,13 @@ end;
procedure TMainFrm.CbBackgroundColorSelect(Sender: TObject); procedure TMainFrm.CbBackgroundColorSelect(Sender: TObject);
begin begin
if CbBackgroundColor.ItemIndex <= 0 then if CbBackgroundColor.ItemIndex <= 0 then
with WorksheetGrid do BackgroundColors[Selection] := scNotDefined with WorksheetGrid do
BackgroundColors[Selection.Left, Selection.Top, Selection.Right, Selection.Bottom] :=
scNotDefined
else else
with WorksheetGrid do BackgroundColors[Selection] := PtrInt(CbBackgroundColor.Items.Objects[CbBackgroundColor.ItemIndex]); with WorksheetGrid do
BackgroundColors[Selection.Left, Selection.Top, Selection.Right, Selection.Bottom] :=
PtrInt(CbBackgroundColor.Items.Objects[CbBackgroundColor.ItemIndex]);
end; end;
procedure TMainFrm.CbHeaderStyleChange(Sender: TObject); procedure TMainFrm.CbHeaderStyleChange(Sender: TObject);
@ -1035,7 +1043,8 @@ var
begin begin
fname := FontCombobox.Items[FontCombobox.ItemIndex]; fname := FontCombobox.Items[FontCombobox.ItemIndex];
if fname <> '' then if fname <> '' then
with WorksheetGrid do CellFontNames[Selection] := fName; with WorksheetGrid do
CellFontNames[Selection.Left, Selection.Top, Selection.Right, Selection.Bottom] := fName;
end; end;
procedure TMainFrm.FontSizeComboBoxSelect(Sender: TObject); procedure TMainFrm.FontSizeComboBoxSelect(Sender: TObject);
@ -1044,7 +1053,8 @@ var
begin begin
sz := StrToInt(FontSizeCombobox.Items[FontSizeCombobox.ItemIndex]); sz := StrToInt(FontSizeCombobox.Items[FontSizeCombobox.ItemIndex]);
if sz > 0 then if sz > 0 then
with WorksheetGrid do CellFontSizes[Selection] := sz; with WorksheetGrid do
CellFontSizes[Selection.Left, Selection.Top, Selection.Right, Selection.Bottom] := sz;
end; end;
procedure TMainFrm.FormActivate(Sender: TObject); procedure TMainFrm.FormActivate(Sender: TObject);
@ -1197,7 +1207,7 @@ var
clr: TsColor; clr: TsColor;
begin begin
with WorksheetGrid do with WorksheetGrid do
clr := BackgroundColors[Selection]; clr := BackgroundColors[Selection.Left, Selection.Top, Selection.Right, Selection.Bottom];
if (clr = scNotDefined) or (clr = scTransparent) then if (clr = scNotDefined) or (clr = scTransparent) then
CbBackgroundColor.ItemIndex := 0 // no fill CbBackgroundColor.ItemIndex := 0 // no fill
else else
@ -1210,7 +1220,8 @@ var
ac: TAction; ac: TAction;
hor_align: TsHorAlignment; hor_align: TsHorAlignment;
begin begin
with WorksheetGrid do hor_align := HorAlignments[Selection]; with WorksheetGrid do
hor_align := HorAlignments[Selection.Left, Selection.Top, Selection.Right, Selection.Bottom];
for i:=0 to ActionList.ActionCount-1 do for i:=0 to ActionList.ActionCount-1 do
begin begin
ac := TAction(ActionList.Actions[i]); ac := TAction(ActionList.Actions[i]);
@ -1380,7 +1391,8 @@ procedure TMainFrm.UpdateFontNameIndex;
var var
fname: String; fname: String;
begin begin
with WorksheetGrid do fname := CellFontNames[Selection]; with WorksheetGrid do
fname := CellFontNames[Selection.Left, Selection.Top, Selection.Right, Selection.Bottom];
if fname = '' then if fname = '' then
FontCombobox.ItemIndex := -1 FontCombobox.ItemIndex := -1
else else
@ -1391,7 +1403,8 @@ procedure TMainFrm.UpdateFontSizeIndex;
var var
sz: Single; sz: Single;
begin begin
with WorksheetGrid do sz := CellFontSizes[Selection]; with WorksheetGrid do
sz := CellFontSizes[Selection.Left, Selection.Top, Selection.Right, Selection.Bottom];
if sz < 0 then if sz < 0 then
FontSizeCombobox.ItemIndex := -1 FontSizeCombobox.ItemIndex := -1
else else
@ -1402,7 +1415,8 @@ procedure TMainFrm.UpdateFontStyleActions;
var var
style: TsFontStyles; style: TsFontStyles;
begin begin
with WorksheetGrid do style := CellFontStyles[Selection]; with WorksheetGrid do
style := CellFontStyles[Selection.Left, Selection.Top, Selection.Right, Selection.Bottom];
AcFontBold.Checked := fssBold in style; AcFontBold.Checked := fssBold in style;
AcFontItalic.Checked := fssItalic in style; AcFontItalic.Checked := fssItalic in style;
AcFontUnderline.Checked := fssUnderline in style; AcFontUnderline.Checked := fssUnderline in style;
@ -1460,7 +1474,8 @@ var
ac: TAction; ac: TAction;
text_rot: TsTextRotation; text_rot: TsTextRotation;
begin begin
with WorksheetGrid do text_rot := TextRotations[Selection]; with WorksheetGrid do
text_rot := TextRotations[Selection.Left, Selection.Top, Selection.Right, Selection.Bottom];
for i:=0 to ActionList.ActionCount-1 do begin for i:=0 to ActionList.ActionCount-1 do begin
ac := TAction(ActionList.Actions[i]); ac := TAction(ActionList.Actions[i]);
if (ac.Tag >= TEXTROT_TAG) and (ac.Tag < TEXTROT_TAG+10) then if (ac.Tag >= TEXTROT_TAG) and (ac.Tag < TEXTROT_TAG+10) then
@ -1474,7 +1489,8 @@ var
ac: TAction; ac: TAction;
vert_align: TsVertAlignment; vert_align: TsVertAlignment;
begin begin
with WorksheetGrid do vert_align := VertAlignments[Selection]; with WorksheetGrid do
vert_align := VertAlignments[Selection.Left, Selection.Top, Selection.Right, Selection.Bottom];
for i:=0 to ActionList.ActionCount-1 do begin for i:=0 to ActionList.ActionCount-1 do begin
ac := TAction(ActionList.Actions[i]); ac := TAction(ActionList.Actions[i]);
if (ac.Tag >= VERTALIGN_TAG) and (ac.Tag < VERTALIGN_TAG+10) then if (ac.Tag >= VERTALIGN_TAG) and (ac.Tag < VERTALIGN_TAG+10) then
@ -1486,7 +1502,8 @@ procedure TMainFrm.UpdateWordwraps;
var var
wrapped: Boolean; wrapped: Boolean;
begin begin
with WorksheetGrid do wrapped := Wordwraps[Selection]; with WorksheetGrid do
wrapped := Wordwraps[Selection.Left, Selection.Top, Selection.Right, Selection.Bottom];
AcWordwrap.Checked := wrapped; AcWordwrap.Checked := wrapped;
end; end;