fpspreadsheet: Working solution for avoiding storing TsWorksheetGrid's colwidths and rowheights in lfm file, requires Laz trunk.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3880 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2015-01-11 15:52:30 +00:00
parent 988c2a3d7a
commit c65e2b60d5
5 changed files with 301 additions and 179 deletions

View File

@ -57,7 +57,7 @@ object Form1: TForm1
Left = 6
Height = 582
Top = 46
Width = 380
Width = 388
TabIndex = 0
Tabs.Strings = (
'Sheet1'
@ -70,7 +70,7 @@ object Form1: TForm1
Left = 2
Height = 557
Top = 23
Width = 376
Width = 384
FrozenCols = 0
FrozenRows = 0
ReadFormulas = False
@ -88,53 +88,24 @@ object Form1: TForm1
TitleFont.Color = clBlack
TitleFont.Height = -15
TitleFont.Name = 'Calibri'
ColWidths = (
48
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
)
end
end
object Panel2: TPanel
Left = 392
Left = 400
Height = 594
Top = 40
Width = 478
Width = 470
Align = alRight
BevelOuter = bvNone
Caption = 'Panel2'
ClientHeight = 594
ClientWidth = 478
ClientWidth = 470
TabOrder = 3
object Chart1: TChart
Left = 0
Height = 183
Top = 0
Width = 478
Width = 470
AxisList = <
item
Minors = <>
@ -166,7 +137,7 @@ object Form1: TForm1
Left = 0
Height = 218
Top = 183
Width = 478
Width = 470
AxisList = <
item
Minors = <>
@ -204,7 +175,7 @@ object Form1: TForm1
Left = 0
Height = 193
Top = 401
Width = 478
Width = 470
AxisList = <
item
Visible = False

View File

@ -13,7 +13,7 @@ object Form1: TForm1
Left = 0
Height = 497
Top = 83
Width = 688
Width = 683
TabIndex = 0
Tabs.Strings = (
'Sheet1'
@ -25,7 +25,7 @@ object Form1: TForm1
Left = 2
Height = 472
Top = 23
Width = 684
Width = 679
FrozenCols = 0
FrozenRows = 0
ReadFormulas = False
@ -45,42 +45,13 @@ object Form1: TForm1
TitleFont.Height = -13
TitleFont.Name = 'Arial'
TitleStyle = tsNative
ColWidths = (
50
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
)
end
end
object InspectorTabControl: TTabControl
Left = 693
Left = 688
Height = 497
Top = 83
Width = 248
Width = 253
OnChange = InspectorTabControlChange
TabIndex = 0
Tabs.Strings = (
@ -96,7 +67,7 @@ object Form1: TForm1
Left = 2
Height = 472
Top = 23
Width = 244
Width = 249
Align = alClient
RowCount = 25
TabOrder = 1
@ -133,14 +104,37 @@ object Form1: TForm1
)
WorkbookSource = WorkbookSource
Mode = imWorkbook
ColWidths = (
111
112
RowHeights = (
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
)
end
end
object Splitter1: TSplitter
Left = 688
Left = 683
Height = 497
Top = 83
Width = 5

View File

@ -2,21 +2,21 @@ object Form1: TForm1
Left = 409
Height = 649
Top = 248
Width = 884
Width = 895
Caption = 'fpsGrid'
ClientHeight = 649
ClientWidth = 884
ClientWidth = 895
ShowHint = True
LCLVersion = '1.3'
object Panel1: TPanel
Left = 0
Height = 41
Top = 608
Width = 884
Width = 895
Align = alBottom
BevelOuter = bvNone
ClientHeight = 41
ClientWidth = 884
ClientWidth = 895
TabOrder = 0
object BtnOpen: TButton
Left = 96
@ -50,7 +50,7 @@ object Form1: TForm1
Left = 0
Height = 572
Top = 36
Width = 884
Width = 895
FrozenCols = 0
FrozenRows = 0
ReadFormulas = False
@ -62,45 +62,119 @@ object Form1: TForm1
RowCount = 101
TabOrder = 1
TitleStyle = tsNative
ColWidths = (
42
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
RowHeights = (
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
)
end
object Panel2: TPanel
Left = 0
Height = 36
Top = 0
Width = 884
Width = 895
Align = alTop
BevelOuter = bvNone
ClientHeight = 36
ClientWidth = 884
ClientWidth = 895
TabOrder = 2
object Label1: TLabel
Left = 8
@ -114,7 +188,7 @@ object Form1: TForm1
Left = 72
Height = 23
Top = 4
Width = 808
Width = 819
Anchors = [akTop, akLeft, akRight]
ItemHeight = 15
ItemIndex = 0

View File

@ -412,7 +412,7 @@ object MainFrm: TMainFrm
end
end
object InspectorSplitter: TSplitter
Left = 648
Left = 638
Height = 453
Top = 84
Width = 5
@ -420,10 +420,10 @@ object MainFrm: TMainFrm
ResizeAnchor = akRight
end
object InspectorPageControl: TPageControl
Left = 653
Left = 643
Height = 453
Top = 84
Width = 231
Width = 241
ActivePage = PgCellValue
Align = alRight
TabIndex = 0
@ -432,12 +432,12 @@ object MainFrm: TMainFrm
object PgCellValue: TTabSheet
Caption = 'Cell value'
ClientHeight = 425
ClientWidth = 223
ClientWidth = 233
object CellInspector: TValueListEditor
Left = 0
Height = 425
Top = 0
Width = 223
Width = 233
Align = alClient
FixedCols = 0
RowCount = 15
@ -464,9 +464,22 @@ object MainFrm: TMainFrm
''
''
)
ColWidths = (
109
110
RowHeights = (
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
)
end
end
@ -481,7 +494,7 @@ object MainFrm: TMainFrm
Left = 0
Height = 453
Top = 84
Width = 648
Width = 638
OnChange = TabControlChange
Align = alClient
TabOrder = 3
@ -489,7 +502,7 @@ object MainFrm: TMainFrm
Left = 2
Height = 448
Top = 3
Width = 644
Width = 634
FrozenCols = 0
FrozenRows = 0
ReadFormulas = False
@ -504,34 +517,108 @@ object MainFrm: TMainFrm
TitleStyle = tsNative
OnHeaderClick = WorksheetGridHeaderClick
OnSelection = WorksheetGridSelection
ColWidths = (
42
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
RowHeights = (
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
22
)
end
end

View File

@ -30,6 +30,13 @@ uses
LCLVersion,
fpspreadsheet, fpspreadsheetctrls;
const
{$IF (lcl_fullversion >= 1030000)}
ENABLE_MULTI_SELECT = 1; // requires Laz trunk after r46767
{$ELSE}
ENABLE_MULTI_SELECT = 0;
{$ENDIF}
type
{ TsCustomWorksheetGrid }
@ -155,16 +162,16 @@ type
AJustification: Byte; ACellHorAlign: TsHorAlignment;
ACellVertAlign: TsVertAlignment; ATextRot: TsTextRotation;
ATextWrap, ReplaceTooLong: Boolean);
{$IFDEF DO_NOT_STORE_COLWIDTHS_ROWHEIGHTS_IN_LFM}
function IsColWidthsStored: Boolean; override;
function IsRowHeightsStored: Boolean; override;
{$ENDIF}
procedure KeyDown(var Key : Word; Shift : TShiftState); override;
procedure Loaded; override;
procedure LoadFromWorksheet(AWorksheet: TsWorksheet);
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;
@ -337,7 +344,7 @@ type
read GetWordwraps write SetWordwraps;
// inherited
{$IFDEF ENABLE_MULTI_SELECT}
{$IF (ENABLE_MULTI_SELECT = 1)}
{@@ Allow multiple selections}
property RangeSelectMode default rsmMulti;
{$ENDIF}
@ -582,11 +589,6 @@ const
tlBottom, tlTop, tlCenter, tlBottom
);
{$IF (lcl_fullversion >= 1030000)}
ENABLE_MULTI_SELECT = 1; // requires Laz trunk after r46767
{$ELSE}
ENABLE_MULTI_SELECT = 0;
{$ENDIF}
var
{@@ Auxiliary bitmap containing the fill pattern used by biff2 cell backgrounds. }
@ -2882,26 +2884,6 @@ begin
end;
end;
{$IFDEF DO_NOT_STORE_COLWIDTHS_ROWHEIGHTS_IN_LFM}
{@@ ----------------------------------------------------------------------------
Prevents storing of column widths in lfm file, they are retrieved from the
worksheet file
-------------------------------------------------------------------------------}
function TsCustomWorksheetGrid.IsColWidthsStored: Boolean;
begin
Result := false;
end;
{@@ ----------------------------------------------------------------------------
Prevents storing of row heights in lfm file, they are retrieved from the
worksheet file
-------------------------------------------------------------------------------}
function TsCustomWorksheetGrid.IsRowHeightsStored: Boolean;
begin
Result := false;
end;
{$ENDIF}
{@@ ----------------------------------------------------------------------------
Standard key handling method inherited from TCustomGrid. Is overridden to
catch the ESC key during editing in order to restore the old cell text
@ -3173,6 +3155,20 @@ 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.