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

View File

@ -20,9 +20,6 @@ unit fpspreadsheetgrid;
- Arial bold is not shown as such if loaded from ods
- Background color of first cell is ignored. }
{ Activate next define for Laz >= 1.4 }
{.$DEFINE DO_NOT_STORE_COLWIDTHS_ROWHEIGHTS_IN_LFM}
interface
uses
@ -144,6 +141,7 @@ type
out ACol1, ACol2: Integer; var ARect: TRect): Boolean;
procedure CreateNewWorkbook;
procedure DblClick; override;
procedure DefineProperties(Filer: TFiler); override;
procedure DoOnResize; override;
procedure DoPrepareCanvas(ACol, ARow: Integer; AState: TGridDrawState); override;
procedure DrawAllRows; override;
@ -169,10 +167,6 @@ type
procedure MouseDown(Button: TMouseButton; Shift:TShiftState; X,Y:Integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); 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;
// function SelectCell(AGridCol, AGridRow: Integer): Boolean; override;
procedure SelectEditor; override;
@ -1139,6 +1133,12 @@ begin
inherited DblClick;
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;
begin
if (csDesigning in ComponentState) and (Worksheet = nil) then
@ -3164,20 +3164,6 @@ begin
Refresh;
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.
@ -4240,6 +4226,9 @@ end;
initialization
fpsutils.ScreenPixelsPerInch := Screen.PixelsPerInch;
RegisterPropertyToSkip(TsCustomWorksheetGrid, 'ColWidths', 'taken from worksheet', '');
RegisterPropertyToSkip(TsCustomWorksheetGrid, 'RowHeights', 'taken from worksheet', '');
finalization
FreeAndNil(FillPattern_BIFF2);

View File

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