fpspreadsheet: Better way to avoid storing of TsWorksheetgrid's ColWidths/RowHeights in lfm, thanks to Engkin. Fix compilation error in fpsvisualutils.pas

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3883 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2015-01-12 11:42:23 +00:00
parent 1eec58e7ae
commit 2ef2765646
3 changed files with 19 additions and 22 deletions

View File

@ -10,7 +10,7 @@ object MainFrm: TMainFrm
OnActivate = FormActivate OnActivate = FormActivate
OnCreate = FormCreate OnCreate = FormCreate
ShowHint = True ShowHint = True
LCLVersion = '1.3' LCLVersion = '1.5'
object ToolBar1: TToolBar object ToolBar1: TToolBar
Left = 0 Left = 0
Height = 28 Height = 28
@ -39,6 +39,7 @@ object MainFrm: TMainFrm
end end
object ToolButton5: TToolButton object ToolButton5: TToolButton
Left = 73 Left = 73
Height = 24
Top = 0 Top = 0
Width = 5 Width = 5
Caption = 'ToolButton5' Caption = 'ToolButton5'
@ -131,6 +132,7 @@ object MainFrm: TMainFrm
end end
object ToolButton14: TToolButton object ToolButton14: TToolButton
Left = 331 Left = 331
Height = 24
Top = 0 Top = 0
Width = 5 Width = 5
Caption = 'ToolButton14' Caption = 'ToolButton14'
@ -139,6 +141,7 @@ object MainFrm: TMainFrm
end end
object ToolButton15: TToolButton object ToolButton15: TToolButton
Left = 411 Left = 411
Height = 24
Top = 0 Top = 0
Width = 5 Width = 5
Caption = 'ToolButton15' Caption = 'ToolButton15'
@ -163,6 +166,7 @@ object MainFrm: TMainFrm
end end
object ToolButton19: TToolButton object ToolButton19: TToolButton
Left = 491 Left = 491
Height = 24
Top = 0 Top = 0
Width = 5 Width = 5
Caption = 'ToolButton19' Caption = 'ToolButton19'
@ -196,6 +200,7 @@ object MainFrm: TMainFrm
end end
object ToolButton26: TToolButton object ToolButton26: TToolButton
Left = 26 Left = 26
Height = 24
Top = 0 Top = 0
Width = 5 Width = 5
Caption = 'ToolButton26' Caption = 'ToolButton26'
@ -234,6 +239,7 @@ object MainFrm: TMainFrm
end end
object ToolButton33: TToolButton object ToolButton33: TToolButton
Left = 757 Left = 757
Height = 24
Top = 0 Top = 0
Width = 5 Width = 5
Caption = 'ToolButton33' Caption = 'ToolButton33'

View File

@ -20,9 +20,6 @@ unit fpspreadsheetgrid;
- Arial bold is not shown as such if loaded from ods - Arial bold is not shown as such if loaded from ods
- Background color of first cell is ignored. } - Background color of first cell is ignored. }
{ Activate next define for Laz >= 1.4 }
{.$DEFINE DO_NOT_STORE_COLWIDTHS_ROWHEIGHTS_IN_LFM}
interface interface
uses uses
@ -144,6 +141,7 @@ type
out ACol1, ACol2: Integer; var ARect: TRect): Boolean; out ACol1, ACol2: Integer; var ARect: TRect): Boolean;
procedure CreateNewWorkbook; procedure CreateNewWorkbook;
procedure DblClick; override; procedure DblClick; override;
procedure DefineProperties(Filer: TFiler); override;
procedure DoOnResize; override; procedure DoOnResize; override;
procedure DoPrepareCanvas(ACol, ARow: Integer; AState: TGridDrawState); override; procedure DoPrepareCanvas(ACol, ARow: Integer; AState: TGridDrawState); override;
procedure DrawAllRows; override; procedure DrawAllRows; override;
@ -169,10 +167,6 @@ type
procedure MouseDown(Button: TMouseButton; Shift:TShiftState; X,Y:Integer); override; procedure MouseDown(Button: TMouseButton; Shift:TShiftState; X,Y:Integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure MoveSelection; override; procedure MoveSelection; override;
{$IFDEF DO_NOT_STORE_COLWIDTHS_ROWHEIGHTS_IN_LFM}
procedure NeedRowHeightsOrColWidths(Filer: TFiler;
out NeedHeights, NeedWidths: Boolean); override;
{$ENDIF}
procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure Notification(AComponent: TComponent; Operation: TOperation); override;
// function SelectCell(AGridCol, AGridRow: Integer): Boolean; override; // function SelectCell(AGridCol, AGridRow: Integer): Boolean; override;
procedure SelectEditor; override; procedure SelectEditor; override;
@ -1139,6 +1133,12 @@ begin
inherited DblClick; inherited DblClick;
end; end;
procedure TsCustomWorksheetGrid.DefineProperties(Filer: TFiler);
begin
// Don't call inherited, this is where to ColWidths/RwoHeights are stored in
// the lfm file - we don't need them, we get them from the workbook!
end;
procedure TsCustomWorksheetGrid.DoOnResize; procedure TsCustomWorksheetGrid.DoOnResize;
begin begin
if (csDesigning in ComponentState) and (Worksheet = nil) then if (csDesigning in ComponentState) and (Worksheet = nil) then
@ -3164,20 +3164,6 @@ begin
Refresh; Refresh;
end; end;
{$IFDEF DO_NOT_STORE_COLWIDTHS_ROWHEIGHTS_IN_LFM}
{@@ ----------------------------------------------------------------------------
Inherited method of TCustomGrid called during the streaming of the lfm file.
Since RowHeights and ColWidths are taken from the WorkSheet there is no need
to store them in the lfm file again.
-------------------------------------------------------------------------------}
procedure TsCustomWorksheetGrid.NeedRowHeightsOrColWidths(Filer: TFiler;
out NeedHeights, NeedWidths: Boolean);
begin
NeedHeights := false;
NeedWidths := false;
end;
{$ENDIF}
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Creates a new empty workbook with the specified number of columns and rows. Creates a new empty workbook with the specified number of columns and rows.
@ -4240,6 +4226,9 @@ end;
initialization initialization
fpsutils.ScreenPixelsPerInch := Screen.PixelsPerInch; fpsutils.ScreenPixelsPerInch := Screen.PixelsPerInch;
RegisterPropertyToSkip(TsCustomWorksheetGrid, 'ColWidths', 'taken from worksheet', '');
RegisterPropertyToSkip(TsCustomWorksheetGrid, 'RowHeights', 'taken from worksheet', '');
finalization finalization
FreeAndNil(FillPattern_BIFF2); FreeAndNil(FillPattern_BIFF2);

View File

@ -1,5 +1,7 @@
unit fpsvisualutils; unit fpsvisualutils;
{$mode objfpc}{$H+}
interface interface
uses uses