You've already forked lazarus-ccr
fpspreadsheet: Initial implementation of fpsActions (a set of standard actions to simplify the main spreadsheet manipulation tasks)
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3714 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,11 +1,12 @@
|
|||||||
object Form1: TForm1
|
object Form1: TForm1
|
||||||
Left = 349
|
Left = 342
|
||||||
Height = 600
|
Height = 600
|
||||||
Top = 117
|
Top = 242
|
||||||
Width = 925
|
Width = 925
|
||||||
Caption = 'Form1'
|
Caption = 'Form1'
|
||||||
ClientHeight = 600
|
ClientHeight = 575
|
||||||
ClientWidth = 925
|
ClientWidth = 925
|
||||||
|
Menu = MainMenu
|
||||||
LCLVersion = '1.3'
|
LCLVersion = '1.3'
|
||||||
object Panel1: TPanel
|
object Panel1: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
@ -28,7 +29,7 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object CellIndicator: TsCellIndicator
|
object CellIndicator: TsCellIndicator
|
||||||
Left = 95
|
Left = 95
|
||||||
Height = 23
|
Height = 28
|
||||||
Top = 9
|
Top = 9
|
||||||
Width = 80
|
Width = 80
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
@ -37,7 +38,7 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object CellEdit: TsCellEdit
|
object CellEdit: TsCellEdit
|
||||||
Left = 184
|
Left = 184
|
||||||
Height = 23
|
Height = 28
|
||||||
Top = 9
|
Top = 9
|
||||||
Width = 731
|
Width = 731
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
@ -48,7 +49,7 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object WorkbookTabControl: TsWorkbookTabControl
|
object WorkbookTabControl: TsWorkbookTabControl
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 558
|
Height = 533
|
||||||
Top = 42
|
Top = 42
|
||||||
Width = 672
|
Width = 672
|
||||||
TabIndex = 0
|
TabIndex = 0
|
||||||
@ -60,8 +61,8 @@ object Form1: TForm1
|
|||||||
WorkbookSource = WorkbookSource
|
WorkbookSource = WorkbookSource
|
||||||
object WorksheetGrid: TsWorksheetGrid
|
object WorksheetGrid: TsWorksheetGrid
|
||||||
Left = 2
|
Left = 2
|
||||||
Height = 533
|
Height = 503
|
||||||
Top = 23
|
Top = 28
|
||||||
Width = 668
|
Width = 668
|
||||||
FrozenCols = 0
|
FrozenCols = 0
|
||||||
FrozenRows = 0
|
FrozenRows = 0
|
||||||
@ -113,7 +114,7 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object InspectorTabControl: TTabControl
|
object InspectorTabControl: TTabControl
|
||||||
Left = 677
|
Left = 677
|
||||||
Height = 558
|
Height = 533
|
||||||
Top = 42
|
Top = 42
|
||||||
Width = 248
|
Width = 248
|
||||||
OnChange = InspectorTabControlChange
|
OnChange = InspectorTabControlChange
|
||||||
@ -128,19 +129,20 @@ object Form1: TForm1
|
|||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
object Inspector: TsSpreadsheetInspector
|
object Inspector: TsSpreadsheetInspector
|
||||||
Left = 2
|
Left = 2
|
||||||
Height = 533
|
Height = 503
|
||||||
Top = 23
|
Top = 28
|
||||||
Width = 244
|
Width = 244
|
||||||
Align = alClient
|
Align = alClient
|
||||||
RowCount = 24
|
RowCount = 25
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
Strings.Strings = (
|
Strings.Strings = (
|
||||||
'FileName='
|
'FileName='
|
||||||
'FileFormat=sfExcel8'
|
'FileFormat=sfExcel8'
|
||||||
|
'ActiveWorksheet=Sheet1'
|
||||||
'Options=boAutoCalc, boCalcBeforeSaving, boReadFormulas'
|
'Options=boAutoCalc, boCalcBeforeSaving, boReadFormulas'
|
||||||
'FormatSettings='
|
'FormatSettings='
|
||||||
' ThousandSeparator=.'
|
' ThousandSeparator=.'
|
||||||
' DecimalSeparator=.'
|
' DecimalSeparator=,'
|
||||||
' ListSeparator=;'
|
' ListSeparator=;'
|
||||||
' DateSeparator=.'
|
' DateSeparator=.'
|
||||||
' TimeSeparator=:'
|
' TimeSeparator=:'
|
||||||
@ -166,14 +168,14 @@ object Form1: TForm1
|
|||||||
WorkbookSource = WorkbookSource
|
WorkbookSource = WorkbookSource
|
||||||
Mode = imWorkbook
|
Mode = imWorkbook
|
||||||
ColWidths = (
|
ColWidths = (
|
||||||
120
|
109
|
||||||
120
|
110
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object Splitter1: TSplitter
|
object Splitter1: TSplitter
|
||||||
Left = 672
|
Left = 672
|
||||||
Height = 558
|
Height = 533
|
||||||
Top = 42
|
Top = 42
|
||||||
Width = 5
|
Width = 5
|
||||||
Align = alRight
|
Align = alRight
|
||||||
@ -195,5 +197,155 @@ object Form1: TForm1
|
|||||||
object ActionList1: TActionList
|
object ActionList1: TActionList
|
||||||
left = 434
|
left = 434
|
||||||
top = 180
|
top = 180
|
||||||
|
object AddWorksheetAction: TsWorksheetAddAction
|
||||||
|
Category = 'FPSpreadsheet'
|
||||||
|
Caption = 'Add'
|
||||||
|
Hint = 'Add empty worksheet'
|
||||||
|
WorkbookSource = WorkbookSource
|
||||||
|
NameMask = 'Sheet%d'
|
||||||
|
end
|
||||||
|
object DeleteWorksheetAction: TsWorksheetDeleteAction
|
||||||
|
Category = 'FPSpreadsheet'
|
||||||
|
Caption = 'Delete'
|
||||||
|
Hint = 'Delete worksheet'
|
||||||
|
WorkbookSource = WorkbookSource
|
||||||
|
end
|
||||||
|
object RenameWorksheetAction: TsWorksheetRenameAction
|
||||||
|
Category = 'FPSpreadsheet'
|
||||||
|
Caption = 'Rename...'
|
||||||
|
Hint = 'Rename worksheet'
|
||||||
|
WorkbookSource = WorkbookSource
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object ImageList1: TImageList
|
||||||
|
left = 434
|
||||||
|
top = 249
|
||||||
|
Bitmap = {
|
||||||
|
4C690300000010000000100000007E7E7E007E7E7E007F7F7F00808080008080
|
||||||
|
800080808000808080008080800080808000129D000014A8000015A9009915A9
|
||||||
|
00CC15A9009914A80000129D00007E7E7E007E7E7E007F7F7F00808080008080
|
||||||
|
800080808000808080008080800080808000129D000013A1000014A400CC75EE
|
||||||
|
64FF14A400CC13A10000129D00007E7E7E007E7E7E007F7F7F00808080008080
|
||||||
|
800080808000808080008080800080808000129C0099129D00CC129D00CC66EB
|
||||||
|
55FF129D00CC129D00CC129C00997E7E7E007E7E7E007F7F7F227F7F7F597F7F
|
||||||
|
7F667F7F7F667F7F7F667F7F7F667F7F7F661A930CE052E741FF52E741FF52E7
|
||||||
|
41FF52E741FF52E741FF109500CC7A7A7A007A7A7A007A7A7A5AE9E9E9D3FFFF
|
||||||
|
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6EBB66FF3EA333FF3EA333FF3DE2
|
||||||
|
2CFF178B0BDF0E8C00CC0E8D0099727272007272720072727268FCFCFCFFFBFB
|
||||||
|
FBFFFBFBFBFFFBFBFBFFFBFBFBFFFBFBFBFFFBFBFBFFFBFBFBFF3C9B32FF2BDF
|
||||||
|
1AFF16810BE10F8703000E8C00006A6A6A006A6A6A006A6A6A6AF8F8F8FFF6F6
|
||||||
|
F6FFF6F6F6FFF6F6F6FFF6F6F6FFF6F6F6FFF6F6F6FFF6F6F6FF66A362FF3686
|
||||||
|
32FF266B22C43C6C39003B7A340058585800616161006161616BF4F4F4FFF0F0
|
||||||
|
F0FFF0F0F0FFF0F0F0FFF0F0F0FFF0F0F0FFF0F0F0FFF0F0F0FFF0F0F0FFF4F4
|
||||||
|
F4FF6161616B61616100585858004C4C4C00515151005656566CEFEFEFFFEAEA
|
||||||
|
EAFFEAEAEAFFEAEAEAFFEAEAEAFFEAEAEAFFEAEAEAFFEAEAEAFFEAEAEAFFEFEF
|
||||||
|
EFFF5656566C515151004C4C4C004B4B4B534C4C4C6E4C4C4C6EEBEBEBFFE4E4
|
||||||
|
E4FFE4E4E4FFE4E4E4FFE4E4E4FFE4E4E4FFE4E4E4FFE4E4E4FFE4E4E4FFEBEB
|
||||||
|
EBFF4C4C4C6E4C4C4C6E4B4B4B533C3C3C70F0F0F0FFF0F0F0FFECECECFFE8E8
|
||||||
|
E8FFE8E8E8FFE8E8E8FFE8E8E8FFE8E8E8FFE8E8E8FFE8E8E8FFE8E8E8FFECEC
|
||||||
|
ECFFF0F0F0FFF0F0F0FF3C3C3C701B1B1B581717177517171775171717751717
|
||||||
|
1775171717751717177517171775171717751717177517171775171717751717
|
||||||
|
177517171775171717751B1B1B58FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF007E7E7E007E7E7E007F7F7F00808080008080
|
||||||
|
8000808080008080800080808000808080000000A6990000A7CC0000A7CC0000
|
||||||
|
A7CC0000A7CC0000A7CC0000A6997E7E7E007E7E7E007F7F7F227F7F7F597F7F
|
||||||
|
7F667F7F7F667F7F7F667F7F7F667F7F7F660C0C95E05E5EF7FF5E5EF7FF5E5E
|
||||||
|
F7FF5E5EF7FF5E5EF7FF000098CC7A7A7A007A7A7A007A7A7A5AE9E9E9D3FFFF
|
||||||
|
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6666B4FF333399FF333399FF2828
|
||||||
|
92F60B0B7FDF000080CC00008499727272007272720072727268FCFCFCFFFBFB
|
||||||
|
FBFFFBFBFBFFFBFBFBFFFBFBFBFFFBFBFBFFFBFBFBFFFBFBFBFFFBFBFBFFFCFC
|
||||||
|
FCFF727272681C1C7600000080006A6A6A006A6A6A006A6A6A6AF8F8F8FFF6F6
|
||||||
|
F6FFF6F6F6FFF6F6F6FFF6F6F6FFF6F6F6FFF6F6F6FFF6F6F6FFF6F6F6FFF8F8
|
||||||
|
F8FF6A6A6A6A6A6A6A003434740058585800616161006161616BF4F4F4FFF0F0
|
||||||
|
F0FFF0F0F0FFF0F0F0FFF0F0F0FFF0F0F0FFF0F0F0FFF0F0F0FFF0F0F0FFF4F4
|
||||||
|
F4FF6161616B61616100585858004C4C4C00515151005656566CEFEFEFFFEAEA
|
||||||
|
EAFFEAEAEAFFEAEAEAFFEAEAEAFFEAEAEAFFEAEAEAFFEAEAEAFFEAEAEAFFEFEF
|
||||||
|
EFFF5656566C515151004C4C4C004B4B4B534C4C4C6E4C4C4C6EEBEBEBFFE4E4
|
||||||
|
E4FFE4E4E4FFE4E4E4FFE4E4E4FFE4E4E4FFE4E4E4FFE4E4E4FFE4E4E4FFEBEB
|
||||||
|
EBFF4C4C4C6E4C4C4C6E4B4B4B533C3C3C70F0F0F0FFF0F0F0FFECECECFFE8E8
|
||||||
|
E8FFE8E8E8FFE8E8E8FFE8E8E8FFE8E8E8FFE8E8E8FFE8E8E8FFE8E8E8FFECEC
|
||||||
|
ECFFF0F0F0FFF0F0F0FF3C3C3C701B1B1B581717177517171775171717751717
|
||||||
|
1775171717751717177517171775171717751717177517171775171717751717
|
||||||
|
177517171775171717751B1B1B58FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF007E7E7E007E7E7E007F7F7F00808080008080
|
||||||
|
800080808000808080008080800080808000808080006E85890001A3BB005555
|
||||||
|
55002B2B9D390101DEAF0101C6407E7E7E007E7E7E007F7F7F00808080008080
|
||||||
|
800080808000808080008080800080808000808080006E85890001A3BB005454
|
||||||
|
542438386F7C8080FFFF0101B1C17E7E7E007E7E7E007F7F7F00808080008080
|
||||||
|
800080808000808080008080800080808000808080006E85890001A2BA3F4A4A
|
||||||
|
4A6CF7F7F7FF1A1A468E00009F467E7E7E007E7E7E007F7F7F227F7F7F597F7F
|
||||||
|
7F667F7F7F667F7F7F667F7F7F667F7F7F667F7F7F66538B948C1494A9D379E6
|
||||||
|
F7FF2D2D2D8F1212122E00009C007A7A7A007A7A7A007A7A7A5AE9E9E9D3FFFF
|
||||||
|
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC1E8EEFF4BB6C7FF79E6F7FF3496
|
||||||
|
A8F44D6F7681444444003C3C8A00727272007272720072727268FCFCFCFFFBFB
|
||||||
|
FBFFFBFBFBFFFBFBFBFFFBFBFBFFBFE5EBFF4AB4C5FF79E6F7FF419EAFFFB9D8
|
||||||
|
DEFF7272726872727200727272006A6A6A006A6A6A006A6A6A6AF8F8F8FFF6F6
|
||||||
|
F6FFF6F6F6FFF6F6F6FFD2E4EAFF49B3C4FF79E6F7FF3F9DADFFB5D4DAFFF8F8
|
||||||
|
F8FF6A6A6A6A6A6A6A006A6A6A0058585800616161006161616BF4F4F4FFF0F0
|
||||||
|
F0FFF0F0F0FFF0F0F0FF79AFC1FFD9F4FFFF3E9BACFFB0CFD5FFF0F0F0FFF4F4
|
||||||
|
F4FF6161616B61616100585858004C4C4C00515151005656566CEFEFEFFFEAEA
|
||||||
|
EAFFEAEAEAFFEAEAEAFF000000FF4F8393FFB2C6CCFFEAEAEAFFEAEAEAFFEFEF
|
||||||
|
EFFF5656566C515151004C4C4C004B4B4B534C4C4C6E4C4C4C6EEBEBEBFFE4E4
|
||||||
|
E4FFE4E4E4FFE4E4E4FFE4E4E4FFE4E4E4FFE4E4E4FFE4E4E4FFE4E4E4FFEBEB
|
||||||
|
EBFF4C4C4C6E4C4C4C6E4B4B4B533C3C3C70F0F0F0FFF0F0F0FFECECECFFE8E8
|
||||||
|
E8FFE8E8E8FFE8E8E8FFE8E8E8FFE8E8E8FFE8E8E8FFE8E8E8FFE8E8E8FFECEC
|
||||||
|
ECFFF0F0F0FFF0F0F0FF3C3C3C701B1B1B581717177517171775171717751717
|
||||||
|
1775171717751717177517171775171717751717177517171775171717751717
|
||||||
|
177517171775171717751B1B1B58FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00
|
||||||
|
}
|
||||||
|
end
|
||||||
|
object MainMenu: TMainMenu
|
||||||
|
left = 434
|
||||||
|
top = 320
|
||||||
|
object MnuFile: TMenuItem
|
||||||
|
Caption = 'File'
|
||||||
|
object MenuItem1: TMenuItem
|
||||||
|
Caption = 'New Item5'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object MnuEdit: TMenuItem
|
||||||
|
Caption = 'Edit'
|
||||||
|
object MnuWorksheet: TMenuItem
|
||||||
|
Caption = 'Worksheet'
|
||||||
|
object MnuAddSheet: TMenuItem
|
||||||
|
Action = AddWorksheetAction
|
||||||
|
end
|
||||||
|
object MenuItem2: TMenuItem
|
||||||
|
Action = DeleteWorksheetAction
|
||||||
|
end
|
||||||
|
object MenuItem3: TMenuItem
|
||||||
|
Caption = '-'
|
||||||
|
end
|
||||||
|
object MenuItem4: TMenuItem
|
||||||
|
Action = RenameWorksheetAction
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -6,8 +6,8 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
||||||
StdCtrls, ComCtrls, ActnList,
|
StdCtrls, ComCtrls, ActnList, Menus,
|
||||||
fpspreadsheet, fpspreadsheetctrls, fpspreadsheetgrid;
|
fpspreadsheet, fpspreadsheetctrls, fpspreadsheetgrid, fpsActions;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -16,6 +16,16 @@ type
|
|||||||
TForm1 = class(TForm)
|
TForm1 = class(TForm)
|
||||||
ActionList1: TActionList;
|
ActionList1: TActionList;
|
||||||
Button1: TButton;
|
Button1: TButton;
|
||||||
|
ImageList1: TImageList;
|
||||||
|
MainMenu: TMainMenu;
|
||||||
|
MenuItem1: TMenuItem;
|
||||||
|
MenuItem2: TMenuItem;
|
||||||
|
MenuItem3: TMenuItem;
|
||||||
|
MenuItem4: TMenuItem;
|
||||||
|
MnuFile: TMenuItem;
|
||||||
|
MnuWorksheet: TMenuItem;
|
||||||
|
MnuAddSheet: TMenuItem;
|
||||||
|
MnuEdit: TMenuItem;
|
||||||
OpenDialog: TOpenDialog;
|
OpenDialog: TOpenDialog;
|
||||||
OpenDialog1: TOpenDialog;
|
OpenDialog1: TOpenDialog;
|
||||||
Panel1: TPanel;
|
Panel1: TPanel;
|
||||||
@ -24,6 +34,9 @@ type
|
|||||||
Splitter1: TSplitter;
|
Splitter1: TSplitter;
|
||||||
Inspector: TsSpreadsheetInspector;
|
Inspector: TsSpreadsheetInspector;
|
||||||
InspectorTabControl: TTabControl;
|
InspectorTabControl: TTabControl;
|
||||||
|
AddWorksheetAction: TsWorksheetAddAction;
|
||||||
|
DeleteWorksheetAction: TsWorksheetDeleteAction;
|
||||||
|
RenameWorksheetAction: TsWorksheetRenameAction;
|
||||||
WorkbookSource: TsWorkbookSource;
|
WorkbookSource: TsWorkbookSource;
|
||||||
WorkbookTabControl: TsWorkbookTabControl;
|
WorkbookTabControl: TsWorkbookTabControl;
|
||||||
WorksheetGrid: TsWorksheetGrid;
|
WorksheetGrid: TsWorksheetGrid;
|
||||||
|
@ -4,8 +4,9 @@ object Form1: TForm1
|
|||||||
Top = 177
|
Top = 177
|
||||||
Width = 874
|
Width = 874
|
||||||
Caption = 'Form1'
|
Caption = 'Form1'
|
||||||
ClientHeight = 528
|
ClientHeight = 503
|
||||||
ClientWidth = 874
|
ClientWidth = 874
|
||||||
|
Menu = MainMenu
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
LCLVersion = '1.3'
|
LCLVersion = '1.3'
|
||||||
object Panel1: TPanel
|
object Panel1: TPanel
|
||||||
@ -125,10 +126,10 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object CbLoader: TComboBox
|
object CbLoader: TComboBox
|
||||||
Left = 104
|
Left = 104
|
||||||
Height = 23
|
Height = 28
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 148
|
Width = 148
|
||||||
ItemHeight = 15
|
ItemHeight = 20
|
||||||
ItemIndex = 1
|
ItemIndex = 1
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
'Workbook'
|
'Workbook'
|
||||||
@ -141,16 +142,16 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object Label1: TLabel
|
object Label1: TLabel
|
||||||
Left = 13
|
Left = 13
|
||||||
Height = 15
|
Height = 20
|
||||||
Top = 11
|
Top = 11
|
||||||
Width = 58
|
Width = 73
|
||||||
Caption = 'Loaded by:'
|
Caption = 'Loaded by:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object InspectorTabControl: TTabControl
|
object InspectorTabControl: TTabControl
|
||||||
Left = 577
|
Left = 577
|
||||||
Height = 454
|
Height = 429
|
||||||
Top = 74
|
Top = 74
|
||||||
Width = 297
|
Width = 297
|
||||||
OnChange = InspectorTabControlChange
|
OnChange = InspectorTabControlChange
|
||||||
@ -166,7 +167,7 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object Splitter1: TSplitter
|
object Splitter1: TSplitter
|
||||||
Left = 572
|
Left = 572
|
||||||
Height = 454
|
Height = 429
|
||||||
Top = 74
|
Top = 74
|
||||||
Width = 5
|
Width = 5
|
||||||
Align = alRight
|
Align = alRight
|
||||||
@ -179,4 +180,27 @@ object Form1: TForm1
|
|||||||
left = 48
|
left = 48
|
||||||
top = 80
|
top = 80
|
||||||
end
|
end
|
||||||
|
object MainMenu: TMainMenu
|
||||||
|
left = 203
|
||||||
|
top = 80
|
||||||
|
object MnuFile: TMenuItem
|
||||||
|
Caption = 'File'
|
||||||
|
end
|
||||||
|
object MnuEdit: TMenuItem
|
||||||
|
Caption = 'Edit'
|
||||||
|
object MnuWorksheets: TMenuItem
|
||||||
|
Caption = 'Worksheet'
|
||||||
|
object MnuAddWorksheet: TMenuItem
|
||||||
|
Caption = 'New Item4'
|
||||||
|
end
|
||||||
|
object MnuDeleteWorksheet: TMenuItem
|
||||||
|
Caption = 'New Item5'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object ActionList: TActionList
|
||||||
|
left = 203
|
||||||
|
top = 144
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -6,17 +6,24 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
|
||||||
StdCtrls, ComCtrls, ExtCtrls, Grids, Buttons,
|
StdCtrls, ComCtrls, ExtCtrls, Grids, Buttons, Menus, ActnList,
|
||||||
fpspreadsheet, fpspreadsheetctrls, fpSpreadsheetGrid;
|
fpspreadsheet, fpspreadsheetctrls, fpSpreadsheetGrid, fpsActions;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TForm1 }
|
{ TForm1 }
|
||||||
|
|
||||||
TForm1 = class(TForm)
|
TForm1 = class(TForm)
|
||||||
|
ActionList: TActionList;
|
||||||
BtnLoad: TButton;
|
BtnLoad: TButton;
|
||||||
CbLoader: TComboBox;
|
CbLoader: TComboBox;
|
||||||
Label1: TLabel;
|
Label1: TLabel;
|
||||||
|
MainMenu: TMainMenu;
|
||||||
|
MnuDeleteWorksheet: TMenuItem;
|
||||||
|
MnuAddWorksheet: TMenuItem;
|
||||||
|
MnuWorksheets: TMenuItem;
|
||||||
|
MnuEdit: TMenuItem;
|
||||||
|
MnuFile: TMenuItem;
|
||||||
OpenDialog: TOpenDialog;
|
OpenDialog: TOpenDialog;
|
||||||
Panel1: TPanel;
|
Panel1: TPanel;
|
||||||
SpeedButton1: TSpeedButton;
|
SpeedButton1: TSpeedButton;
|
||||||
@ -83,6 +90,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.FormCreate(Sender: TObject);
|
procedure TForm1.FormCreate(Sender: TObject);
|
||||||
|
var
|
||||||
|
actn: TAction;
|
||||||
begin
|
begin
|
||||||
WorkbookSource := TsWorkbookSource.Create(self);
|
WorkbookSource := TsWorkbookSource.Create(self);
|
||||||
with WorkbookSource do begin
|
with WorkbookSource do begin
|
||||||
@ -129,6 +138,21 @@ begin
|
|||||||
Align := alClient;
|
Align := alClient;
|
||||||
WorkbookSource := Self.WorkbookSource;
|
WorkbookSource := Self.WorkbookSource;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
actn := TsWorksheetAddAction.Create(self);
|
||||||
|
with TsWorksheetAddAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WorkbookSource := Self.WorkbookSource;
|
||||||
|
end;
|
||||||
|
MnuAddWorksheet.Action := actn;
|
||||||
|
|
||||||
|
actn := TsWorksheetDeleteAction.Create(self);
|
||||||
|
with TsWorksheetDeleteAction(actn) do begin
|
||||||
|
ActionList := self.ActionList;
|
||||||
|
WOrkbookSource := Self.WorkbookSource;
|
||||||
|
end;
|
||||||
|
MnuDeleteWorksheet.Action := actn;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.InspectorTabControlChange(Sender: TObject);
|
procedure TForm1.InspectorTabControlChange(Sender: TObject);
|
||||||
|
273
components/fpspreadsheet/fpsactions.pas
Normal file
273
components/fpspreadsheet/fpsactions.pas
Normal file
@ -0,0 +1,273 @@
|
|||||||
|
unit fpsActions;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
SysUtils, Classes, Controls, ActnList,
|
||||||
|
fpspreadsheet, fpspreadsheetctrls;
|
||||||
|
|
||||||
|
type
|
||||||
|
TsSpreadsheetAction = class(TAction)
|
||||||
|
private
|
||||||
|
FWorkbookSource: TsWorkbookSource;
|
||||||
|
function GetWorkbook: TsWorkbook;
|
||||||
|
function GetWorksheet: TsWorksheet;
|
||||||
|
protected
|
||||||
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||||
|
property Worksheet: TsWorksheet read GetWorksheet;
|
||||||
|
public
|
||||||
|
function HandlesTarget(Target: TObject): Boolean; override;
|
||||||
|
procedure UpdateTarget(Target: TObject); override;
|
||||||
|
property Workbook: TsWorkbook read GetWorkbook;
|
||||||
|
published
|
||||||
|
property WorkbookSource: TsWorkbookSource read FWorkbookSource write FWorkbookSource;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ --- Actions related to worksheets --- }
|
||||||
|
|
||||||
|
TsWorksheetAction = class(TsSpreadsheetAction)
|
||||||
|
private
|
||||||
|
public
|
||||||
|
function HandlesTarget(Target: TObject): Boolean; override;
|
||||||
|
procedure UpdateTarget(Target: TObject); override;
|
||||||
|
property Worksheet;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ Action for adding a worksheet }
|
||||||
|
TsWorksheetAddAction = class(TsWorksheetAction)
|
||||||
|
private
|
||||||
|
FNameMask: String;
|
||||||
|
procedure SetNameMask(const AValue: String);
|
||||||
|
protected
|
||||||
|
function GetUniqueSheetName: String;
|
||||||
|
public
|
||||||
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
procedure ExecuteTarget(Target: TObject); override;
|
||||||
|
published
|
||||||
|
property NameMask: String read FNameMask write SetNameMask;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ Action for deleting selected worksheet }
|
||||||
|
TsWorksheetDeleteAction = class(TsWorksheetAction)
|
||||||
|
public
|
||||||
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
procedure ExecuteTarget(Target: TObject); override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ Action for renaming selected worksheet }
|
||||||
|
TsWorksheetRenameAction = class(TsWorksheetAction)
|
||||||
|
public
|
||||||
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
procedure ExecuteTarget(Target: TObject); override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure Register;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
Dialogs;
|
||||||
|
|
||||||
|
procedure Register;
|
||||||
|
begin
|
||||||
|
RegisterActions('FPSpreadsheet', [
|
||||||
|
TsWorksheetAddAction, TsWorksheetDeleteAction, TsWorksheetRenameAction
|
||||||
|
], nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TsSpreadsheetAction }
|
||||||
|
|
||||||
|
function TsSpreadsheetAction.GetWorkbook: TsWorkbook;
|
||||||
|
begin
|
||||||
|
if FWorkbookSource <> nil then
|
||||||
|
Result := FWorkbookSource.Workbook
|
||||||
|
else
|
||||||
|
Result := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TsSpreadsheetAction.GetWorksheet: TsWorksheet;
|
||||||
|
begin
|
||||||
|
if FWorkbookSource <> nil then
|
||||||
|
Result := FWorkbookSource.Worksheet
|
||||||
|
else
|
||||||
|
Result := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TsSpreadsheetAction.HandlesTarget(Target: TObject): Boolean;
|
||||||
|
begin
|
||||||
|
Result := (Target <> nil) and (Target = FWorkbookSource);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsSpreadsheetAction.Notification(AComponent: TComponent;
|
||||||
|
Operation: TOperation);
|
||||||
|
begin
|
||||||
|
inherited Notification(AComponent, Operation);
|
||||||
|
if (Operation = opRemove) and (AComponent = FWorkbookSource) then
|
||||||
|
FWorkbookSource := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsSpreadsheetAction.UpdateTarget(Target: TObject);
|
||||||
|
begin
|
||||||
|
Enabled := HandlesTarget(Target);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TsWorksheetAction }
|
||||||
|
|
||||||
|
function TsWorksheetAction.HandlesTarget(Target: TObject): Boolean;
|
||||||
|
begin
|
||||||
|
Result := inherited HandlesTarget(Target) and (Worksheet <> nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsWorksheetAction.UpdateTarget(Target: TObject);
|
||||||
|
begin
|
||||||
|
Enabled := inherited Enabled and (Worksheet <> nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TsWorksheetAddAction }
|
||||||
|
|
||||||
|
constructor TsWOrksheetAddAction.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(AOwner);
|
||||||
|
Caption := 'Add';
|
||||||
|
Hint := 'Add empty worksheet';
|
||||||
|
FNameMask := 'Sheet%d';
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TsWorksheetAddAction.GetUniqueSheetName: String;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
Result := '';
|
||||||
|
if Workbook = nil then
|
||||||
|
exit;
|
||||||
|
|
||||||
|
i := 0;
|
||||||
|
repeat
|
||||||
|
inc(i);
|
||||||
|
Result := Format(FNameMask, [i]);
|
||||||
|
until Workbook.GetWorksheetByName(Result) = nil
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsWorksheetAddAction.ExecuteTarget(Target: TObject);
|
||||||
|
var
|
||||||
|
sheetName: String;
|
||||||
|
begin
|
||||||
|
if HandlesTarget(Target) then
|
||||||
|
begin
|
||||||
|
sheetName := GetUniqueSheetName;
|
||||||
|
Workbook.AddWorksheet(sheetName);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsWorksheetAddAction.SetNameMask(const AValue: String);
|
||||||
|
begin
|
||||||
|
if AValue = FNameMask then
|
||||||
|
exit;
|
||||||
|
|
||||||
|
if pos('%d', AValue) = 0 then
|
||||||
|
raise Exception.Create('Worksheet name mask must contain a %d place-holder.');
|
||||||
|
|
||||||
|
FNameMask := AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TsWorksheetDeleteAction }
|
||||||
|
|
||||||
|
constructor TsWorksheetDeleteAction.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(AOwner);
|
||||||
|
Caption := 'Delete';
|
||||||
|
Hint := 'Delete worksheet';
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsWorksheetDeleteAction.ExecuteTarget(Target: TObject);
|
||||||
|
begin
|
||||||
|
if HandlesTarget(Target) then
|
||||||
|
begin
|
||||||
|
if Workbook.GetWorksheetCount = 1 then
|
||||||
|
begin
|
||||||
|
MessageDlg('The workbook must contain at least 1 worksheet', mtError, [mbOK], 0);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if MessageDlg(
|
||||||
|
Format('Do you really want to delete worksheet "%s"?', [Worksheet.Name]),
|
||||||
|
mtConfirmation, [mbYes, mbNo], 0) <> mrYes
|
||||||
|
then
|
||||||
|
exit;
|
||||||
|
|
||||||
|
Workbook.RemoveWorksheet(Worksheet);
|
||||||
|
// The workbooksource takes care of selecting the next worksheet
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TsWorksheetRenameAction }
|
||||||
|
|
||||||
|
constructor TsWorksheetRenameAction.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(AOwner);
|
||||||
|
Caption := 'Rename...';
|
||||||
|
Hint := 'Rename worksheet';
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsWorksheetRenameAction.ExecuteTarget(Target: TObject);
|
||||||
|
var
|
||||||
|
s: String;
|
||||||
|
begin
|
||||||
|
if HandlesTarget(Target) then
|
||||||
|
begin
|
||||||
|
s := Worksheet.Name;
|
||||||
|
if InputQuery('Rename worksheet', 'New worksheet name', s) then
|
||||||
|
Worksheet.Name := s;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
(*
|
||||||
|
{ TsSpreadsheetAction }
|
||||||
|
|
||||||
|
TsSpreadsheetAction = class(TAction)
|
||||||
|
private
|
||||||
|
FWorkbookSource: TsWorkbookSource;
|
||||||
|
function GetWorkbook: TsWorkbook;
|
||||||
|
function GetWorksheet: TsWorksheet;
|
||||||
|
procedure SetWorkbookLink(AValue: TsWorkbookSource);
|
||||||
|
protected
|
||||||
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||||
|
procedure UpdateCell; virtual;
|
||||||
|
procedure UpdateWorkbook; virtual;
|
||||||
|
procedure UpdateWorksheet; virtual;
|
||||||
|
public
|
||||||
|
destructor Destroy; override;
|
||||||
|
procedure ListenerNotification(AChangedItems: TsNotificationItems;
|
||||||
|
AData: Pointer = nil);
|
||||||
|
property Workbook: TsWorkbook read GetWorkbook;
|
||||||
|
property Worksheet: TsWorksheet read GetWorksheet;
|
||||||
|
published
|
||||||
|
property WorkbookLink: TsWorkbookSource read FWorkbookSource write SetWorkbookLink;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{TsWorksheetNavigateAction}
|
||||||
|
TsWorksheetNavigateAction = class(TsSpreadsheetAction)
|
||||||
|
public
|
||||||
|
function Update: Boolean; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{TsNextWorksheetAction}
|
||||||
|
TsNextWorksheetAction = class(TAction)
|
||||||
|
public
|
||||||
|
function Execute: Boolean; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{TsPreviosWorksheetAction}
|
||||||
|
TsPreviousWorksheetAction = class(TAction)
|
||||||
|
public
|
||||||
|
function Execute: Boolean; override;
|
||||||
|
end; *)
|
||||||
|
|
||||||
|
|
||||||
|
end.
|
@ -20,7 +20,7 @@
|
|||||||
It provides graphical components like a grid and chart."/>
|
It provides graphical components like a grid and chart."/>
|
||||||
<License Value="LGPL with static linking exception. This is the same license as is used in the LCL (Lazarus Component Library)."/>
|
<License Value="LGPL with static linking exception. This is the same license as is used in the LCL (Lazarus Component Library)."/>
|
||||||
<Version Major="1" Minor="2"/>
|
<Version Major="1" Minor="2"/>
|
||||||
<Files Count="3">
|
<Files Count="4">
|
||||||
<Item1>
|
<Item1>
|
||||||
<Filename Value="fpspreadsheetctrls.pas"/>
|
<Filename Value="fpspreadsheetctrls.pas"/>
|
||||||
<HasRegisterProc Value="True"/>
|
<HasRegisterProc Value="True"/>
|
||||||
@ -36,6 +36,11 @@ It provides graphical components like a grid and chart."/>
|
|||||||
<HasRegisterProc Value="True"/>
|
<HasRegisterProc Value="True"/>
|
||||||
<UnitName Value="fpspreadsheetchart"/>
|
<UnitName Value="fpspreadsheetchart"/>
|
||||||
</Item3>
|
</Item3>
|
||||||
|
<Item4>
|
||||||
|
<Filename Value="fpsactions.pas"/>
|
||||||
|
<HasRegisterProc Value="True"/>
|
||||||
|
<UnitName Value="fpsActions"/>
|
||||||
|
</Item4>
|
||||||
</Files>
|
</Files>
|
||||||
<Type Value="RunAndDesignTime"/>
|
<Type Value="RunAndDesignTime"/>
|
||||||
<RequiredPkgs Count="4">
|
<RequiredPkgs Count="4">
|
||||||
|
@ -7,7 +7,8 @@ unit laz_fpspreadsheet_visual;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
fpspreadsheetctrls, fpspreadsheetgrid, fpspreadsheetchart, LazarusPackageIntf;
|
fpspreadsheetctrls, fpspreadsheetgrid, fpspreadsheetchart, fpsActions,
|
||||||
|
LazarusPackageIntf;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -16,6 +17,7 @@ begin
|
|||||||
RegisterUnit('fpspreadsheetctrls', @fpspreadsheetctrls.Register);
|
RegisterUnit('fpspreadsheetctrls', @fpspreadsheetctrls.Register);
|
||||||
RegisterUnit('fpspreadsheetgrid', @fpspreadsheetgrid.Register);
|
RegisterUnit('fpspreadsheetgrid', @fpspreadsheetgrid.Register);
|
||||||
RegisterUnit('fpspreadsheetchart', @fpspreadsheetchart.Register);
|
RegisterUnit('fpspreadsheetchart', @fpspreadsheetchart.Register);
|
||||||
|
RegisterUnit('fpsactions', @fpsactions.Register);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
Reference in New Issue
Block a user