diff --git a/components/fpspreadsheet/examples/fpsctrls/main.lfm b/components/fpspreadsheet/examples/fpsctrls/main.lfm index 163eb10b2..b7aee4abb 100644 --- a/components/fpspreadsheet/examples/fpsctrls/main.lfm +++ b/components/fpspreadsheet/examples/fpsctrls/main.lfm @@ -1,19 +1,19 @@ object MainForm: TMainForm Left = 495 - Height = 600 + Height = 621 Top = 132 - Width = 929 + Width = 940 Caption = 'demo_ctrls' - ClientHeight = 580 - ClientWidth = 929 + ClientHeight = 601 + ClientWidth = 940 Menu = MainMenu ShowHint = True LCLVersion = '1.5' object WorkbookTabControl: TsWorkbookTabControl Left = 0 - Height = 497 + Height = 518 Top = 83 - Width = 671 + Width = 682 TabIndex = 0 Tabs.Strings = ( 'Sheet1' @@ -23,9 +23,9 @@ object MainForm: TMainForm WorkbookSource = WorkbookSource object WorksheetGrid: TsWorksheetGrid Left = 2 - Height = 472 + Height = 493 Top = 23 - Width = 667 + Width = 678 FrozenCols = 0 FrozenRows = 0 ReadFormulas = False @@ -37,7 +37,7 @@ object MainForm: TMainForm Font.Color = clBlack Font.Height = -13 Font.Name = 'Arial' - Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goRowSizing, goColSizing, goEditing, goThumbTracking, goDblClickAutoSize, goSmoothScroll, goHeaderHotTracking] + Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goRowSizing, goColSizing, goEditing, goThumbTracking, goDblClickAutoSize, goSmoothScroll, goHeaderHotTracking, goCellHints] ParentFont = False RowCount = 101 TabOrder = 1 @@ -48,8 +48,8 @@ object MainForm: TMainForm end end object InspectorTabControl: TTabControl - Left = 676 - Height = 497 + Left = 687 + Height = 518 Top = 83 Width = 253 OnChange = InspectorTabControlChange @@ -65,7 +65,7 @@ object MainForm: TMainForm Visible = False object Inspector: TsSpreadsheetInspector Left = 2 - Height = 472 + Height = 493 Top = 23 Width = 249 Align = alClient @@ -111,8 +111,8 @@ object MainForm: TMainForm end end object Splitter1: TSplitter - Left = 671 - Height = 497 + Left = 682 + Height = 518 Top = 83 Width = 5 Align = alRight @@ -122,7 +122,7 @@ object MainForm: TMainForm Left = 0 Height = 26 Top = 24 - Width = 929 + Width = 940 AutoSize = True ButtonHeight = 26 ButtonWidth = 24 @@ -332,7 +332,7 @@ object MainForm: TMainForm CellFormatItem = cfiFontName WorkbookSource = WorkbookSource DropDownCount = 24 - ItemIndex = 76 + ItemIndex = 89 TabOrder = 0 Text = 'Arial' end @@ -390,7 +390,7 @@ object MainForm: TMainForm Left = 0 Height = 24 Top = 0 - Width = 929 + Width = 940 AutoSize = True ButtonHeight = 24 ButtonWidth = 24 @@ -422,7 +422,7 @@ object MainForm: TMainForm Style = tbsDivider end object ToolButton2: TToolButton - Left = 326 + Left = 403 Top = 0 Action = AcFileExit end @@ -505,12 +505,35 @@ object MainForm: TMainForm Caption = 'ToolButton49' Style = tbsDivider end + object TbCommentAdd: TToolButton + Left = 326 + Top = 0 + Action = AcCommentNew + end + object TbCommentDelete: TToolButton + Left = 350 + Top = 0 + Action = AcCommentEdit + end + object TbCommentEdit: TToolButton + Left = 374 + Top = 0 + Action = AcCommentDelete + end + object ToolButton52: TToolButton + Left = 398 + Height = 24 + Top = 0 + Width = 5 + Caption = 'ToolButton52' + Style = tbsDivider + end end object ToolBar3: TToolBar Left = 0 Height = 28 Top = 50 - Width = 929 + Width = 940 AutoSize = True Caption = 'ToolBar3' Constraints.MinHeight = 28 @@ -541,7 +564,7 @@ object MainForm: TMainForm Left = 144 Height = 24 Top = 0 - Width = 785 + Width = 796 Align = alClient BorderSpacing.Bottom = 2 TabOrder = 1 @@ -560,7 +583,7 @@ object MainForm: TMainForm Left = 0 Height = 5 Top = 78 - Width = 929 + Width = 940 Align = alTop ResizeAnchor = akTop end @@ -1372,12 +1395,36 @@ object MainForm: TMainForm CopyItem = ciFormula CopyMode = cmPaste end + object AcCommentNew: TsCellCommentAction + Category = 'FPSpreadsheet' + WorkbookSource = WorkbookSource + Mode = ccmNew + Caption = 'New comment' + Hint = 'New comment' + ImageIndex = 54 + end + object AcCommentEdit: TsCellCommentAction + Category = 'FPSpreadsheet' + WorkbookSource = WorkbookSource + Mode = ccmEdit + Caption = 'Edit comment...' + Hint = 'Edit comment' + ImageIndex = 56 + end + object AcCommentDelete: TsCellCommentAction + Category = 'FPSpreadsheet' + WorkbookSource = WorkbookSource + Mode = ccmDelete + Caption = 'Delete comment' + Hint = 'Delete comment' + ImageIndex = 55 + end end object ImageList: TImageList left = 176 top = 312 Bitmap = { - 4C69400000001000000010000000003F9300003F9300003F9300003F9424003F + 4C69430000001000000010000000003F9300003F9300003F9300003F9424003F 948A003E93CC004095CC004095CC004095CC004095CC004095CC004095CC0040 95CC004095CC00409599003F9400003F9300003F9324003F938A0E4B9CD33F76 C0EC5D90D4FF3365A9FFA0A0A0FFA9A9A9FFA9A9A9FFAAAAAAFFACACACFFAEAE @@ -2785,39 +2832,39 @@ object MainForm: TMainForm FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF - FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF - FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF - FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF - FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF - FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF - FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF - FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF0034B4D9D05EC2E1FA60C3E2FA60C3 - E2FA60C3E2FA5FC3E2FA3CB6DBDD2CB2D8162CB2D80F2CB2D80F2CB2D80F2CB2 - D80F2CB3D80F2CB3D804FFFFFF00FFFFFF0036B3DAF8FDFEFEFFFEFFFFFFFEFE - FFFFFDFEFFFFFEFFFFFFEAF7FBFF6BC7E4F96BC7E3F86BC7E3F86BC7E3F879CD - E6F774CAE5E132B1D956FFFFFF00FFFFFF0035AFDAF0F7FCFEFF8EE4F8FF91DE - F5FF9FE0F5FFACE1F6FFEFFBFEFFF4FDFEFFF3FCFEFFF1FCFEFFEFFBFEFFEEFB - FEFFFAFDFFF936AFDAD4FFFFFF00FFFFFF0036AADAF2F1FAFDFF94DEF5FF93DC - F4FF81D5F2FF6ACAEDFF6CCBEAFF85D3EFFF80D2EFFF7AD0EFFF76CFEEFF72CF - EEFFE9F7FBFF34AEDAF3FFFFFF00FFFFFF0035ABDAFAE8F6FBFF94D4EFFF88CE - EEFF73C1E9FFC9E9F6FFF2FCFEFFF3FCFEFFF2FCFEFFF0FCFEFFEFFBFEFFEEFB - FEFFFEFFFFFF36ABDAF7FFFFFF00FFFFFF0037A6DAFAFEFFFFFFF8FDFFFFF6FD - FFFFF5FCFFFFF3FCFEFFD8F6FCFF94E6F8FF85E3F7FF76DFF6FF68DBF5FF5CD8 - F4FFD7F4FCFF35A4DAF7FFFFFF00FFFFFF0036A1DAF9F6FCFEFFC8F2FCFFB9EF - FBFFACECFAFF9CE8F9FF8BE3F7FF7CE0F6FF6CDCF6FF5DD9F5FF4FD6F4FF44D3 - F3FFD0F3FCFF359FDAF7FFFFFF00FFFFFF00369ADAF8F2FAFDFFB3EDFAFFA4E9 - F9FF95E6F8FF85E2F7FF76DEF6FF65DBF5FF57D7F4FF49D4F3FF3BD1F2FF30CE - F1FFCCF2FBFF3598DAF7FFFFFF00FFFFFF003594DAF7EFFAFEFFA1E9F9FF91E5 - F8FF81E1F7FF72DEF6FF63DAF5FF54D7F4FF47D3F3FF39D0F2FF2ECDF1FF26CB - F0FFCAF2FBFF3594DAF7FFFFFF00FFFFFF00338ED9E6DCF0FAF0A7DDF4FD9EDB - F4FF96DAF3FF8ED8F3FF86D7F3FF7FD4F2FF79D3F2FF72D2F1FF6CD0F1FF69CF - F1FFC2EAF8FE338ED9F0FFFFFF00FFFFFF002C86D8702D88D8A62D87D8EA2D88 - D8F72D88D8F72D88D8F72D88D8F72D88D8F72D88D8F72D88D8F72D88D8F72D87 - D8F72D88D8F12C86D893FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF - FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF - FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF - FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF - FF00FFFFFF00FFFFFF00FFFFFF00BC6B3671BC6B3690BC6B36CCBC6B36EEBC6B + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF000088CC610088CC810088 + CC810088CC810088CC810088CC810088CC810088CC810088CC810088CC810088 + CC810088CC610087CB00FFFFFF00FFFFFF00FFFFFF000087CA8388DCF4FF60C0 + E9FF5FBFEAFF80D3F4FF9CE3FDFFA2E6FFFFA2E6FFFFA2E6FFFFA2E6FFFFA6EA + FFFF0087CA830087CA00FFFFFF00FFFFFF00FFFFFF000085C885ACF1FFFFABEF + FEFF95E2F8FF6EC9EDFF48A8D9FF98DCFEFF98DCFEFF98DCFEFF98DCFEFFA1E5 + FFFF0085C8850085C800FFFFFF00FFFFFF00FFFFFF000084C587A9EEFDFFA4E9 + FCFFA4E9FCFFAAEEFDFF42A1D1FF97DBFDFF97DBFDFF97DBFDFF97DBFDFF9FE3 + FEFF0084C5870084C500FFFFFF00FFFFFF00FFFFFF000082C28AA6EBFCFFA1E6 + FBFFA1E6FBFFA6EBFCFF3C9DCFFF96DAFCFF96DAFCFF96DAFCFF96DAFCFF9EE2 + FDFF0082C28A0082C200FFFFFF00FFFFFF00FFFFFF00007FBF8DA3E8FBFF9DE3 + F9FF9DE3F9FFA3E8FBFF3594C5FF94D8FAFF94D8FAFF94D8FAFF94D8FAFF9BDF + FCFF007FBF8D007FBE00FFFFFF00FFFFFF00FFFFFF00007DBB909EE5F9FF98DF + F6FF98DFF6FF9EE5F9FF3290C0FF92D6F8FF92D6F8FF92D6F8FF92D6F8FF99DD + FAFF007DBB90007DBB33FFFFFF00FFFFFF00FFFFFF00007BB8949BE1F7FF94DB + F4FF94DBF4FF9BE1F7FF308DBCFF90D4F6FF90D4F6FF90D4F6FF90D4F6FF97DB + F9FFFEFEFDFF007BB894FFFFFF00FFFFFF00FFFFFF000078B49797DEF6FF90D8 + F2FF90D8F2FF97DEF6FF2D89B7FF8FD3F5FF8FD3F5FF8FD3F5FF8FD3F5FF95D9 + F8FFF5F5EEFF0078B497FFFFFF00FFFFFF00FFFFFF000076B09B92DAF4FF8BD4 + F0FF8BD4F0FF92DAF4FF2B85B3FF8DD1F3FF8DD1F3FF8DD1F3FF8DD1F3FF93D7 + F6FFEBEBDDFF0076B09BFFFFFF00FFFFFF00FFFFFF000073AC9E8ED6F2FF87D0 + EDFF87D0EDFF8ED6F2FF2882AFFF8BCFF1FF8BCFF1FF8BCFF1FF8BCFF1FF91D5 + F5FFFEC941FF0073AC9EFFFFFF00FFFFFF00FFFFFF00006FA7A48AD3F0FF82CD + EBFF82CDEBFF8AD3F0FF267EABFF8ACEF0FF8ACEF0FF8ACEF0FF8ACEF0FF8FD3 + F4FFF4B62EFF006FA7A4FFFFFF00FFFFFF00FFFFFF00006699B287D1EFFF7FCA + E9FF7FCAE9FF87D0EFFF267DA9FF8DD1F3FF8DD1F3FF8DD1F3FF8DD1F3FF90D4 + F5FF006699B200679B3EFFFFFF00FFFFFF00FFFFFF00005E8D8E3591BDF169B8 + DDFA81CBECFF84CEEEFF005C8BEF005D8CBE005D8CBE005D8CBE005D8CBE005D + 8CBE005E8D8E00669900FFFFFF00FFFFFF00FFFFFF00005D8C00006599500064 + 97991C7AA9C052A5CDE0005B89C1005B8900005B8900005B8900005B8900005B + 8900005D8C0000669900FFFFFF00FFFFFF00FFFFFF00005D8C00006497000062 + 9300005E8E30005C8C7C0059879200598700005B8900005B8900005B8900005B + 8900005D8C0000669900FFFFFF00BC6B3671BC6B3690BC6B36CCBC6B36EEBC6B 36FABB6B36FEBB6B36FFBB6A36FFBB6A36FFBC6C39FFBD6E3BFFBB6D3AFFBB6B 38EFBB703ECBB6693554FFFFFF00BC6B369BF6E0D1FFF7E0D1FFFEFBF8FFFEFB F7FFFDF9F6FFFCF5F0FFFAF0EAFFFBF2EDFFFDF9F6FFFDFAF7FFFBF1EBFFF8E9 @@ -3105,7 +3152,103 @@ object MainForm: TMainForm 98FF206398FFC98F67FFFCF3ECFFFAF1E8FFFAF0E7FFFBF1E9FFFBF2EAFFFBF2 EAFFFBF2EBFFFDF4EEFFCA8054F9FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF FF00FFFFFF00C57342C1C67545E6C87545FEC77545F3C87545F3C77545F3C775 - 45F3C87546F4C57444E8CA7F53F1FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + 45F3C87546F4C57444E8CA7F53F1000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000026EB628026EB669026EB679026E + B679026EB679026EB679026EB679026EB679026EB679026EB679026EB679026E + B679026EB669026EB6280000000000000000026DB46BC1E3F1D9E6FBFFFFE5FA + FFFFE5FAFFFFE5FAFFFFE5FAFFFFE5FAFFFFE5FAFFFFE4FAFFFFE4FAFFFFE5FA + FFFFBDE2F1D9026DB46B0000000000000000026BB17EE5FAFFFFD9F4FFFFD9F4 + FFFFD9F4FFFFD9F4FFFFD9F4FFFFD9F4FFFFD9F4FFFFD9F4FFFFD9F4FFFFD9F4 + FFFFE0F8FFFF026BB17E0000000000000000026AAE81E0F9FFFFD4F2FFFFD4F2 + FFFFD4F2FFFFD4F2FFFFD4F2FFFFD4F2FFFFD4F2FFFFD4F2FFFFD4F2FFFFD4F2 + FFFFD9F5FFFF026AAE8100000000000000000268AB84DCF7FFFFCFF0FFFFCFF0 + FFFFCFF0FFFFC2EDFCFFA8E8F4FF91E3EDFF84E0E9FF7CDEE7FF7CDEE7FF84E0 + E9FF9CE6EFFF0268AB8400000000000000000266A788D8F4FFFFCCEEFFFFC2EC + FCFF9DE5F1FF85E0EAFF82E0E9FF82E0E9FF82E0E9FF82E0E9FF82E0E9FF82E0 + E9FF8AE2EBFF0266A78800000000000000000264A48CD6F3FFFFB6EBF9FF94E4 + F0FF8FE3EEFF8FE3EEFF8FE3EEFF8FE3EEFF8FE3EEFF45C05FFF2DB42FFF45C0 + 5FFF91E4EFFF0264A48C00000000000000000261A090C1EFFBFF9EE7F4FF9DE6 + F4FF9DE6F4FF9DE6F4FF9DE6F4FF9DE6F4FF9DE6F4FF2FB130FF75EE64FF2FB1 + 30FF9DE6F4FF0261A0900000000000000000025F9C8191D0E6E1B0ECF9FFAEEB + F9FFADEBF9FFACEBF9FFABEAF9FF4EBB63FF30AC31FF30AC31FF66EB55FF30AC + 31FF26A529F90D8C27CD0000000000000000025C9832025C9785025C9799025C + 9799B7EDFDFF025C9799025C97990E8D13EB52E741FF52E741FF52E741FF52E7 + 41FF52E741FF0F9207D600000000000000000000000000000000000000000355 + 8BA603558BA603568D39035993020E8D00990E8C00CC0E8C00CC3DE22CFF0E8C + 00CC0E8C00CC0E8D00990000000000000000000000000000000000000000034D + 7DB5034E7F3D000000000000000000000000000000000C8300CC2BDF1AFF0C83 + 00CC000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000066D0099056900CC066D + 0099000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000026EB628026EB669026EB679026E + B679026EB679026EB679026EB679026EB679026EB679026EB679026EB679026E + B679026EB669026EB6280000000000000000026DB46BC1E3F1D9E6FBFFFFE5FA + FFFFE5FAFFFFE5FAFFFFE5FAFFFFE5FAFFFFE5FAFFFFE4FAFFFFE4FAFFFFE5FA + FFFFBDE2F1D9026DB46B0000000000000000026BB17EE5FAFFFFD9F4FFFFD9F4 + FFFFD9F4FFFFD9F4FFFFD9F4FFFFD9F4FFFFD9F4FFFFD9F4FFFFD9F4FFFFD9F4 + FFFFE0F8FFFF026BB17E0000000000000000026AAE81E0F9FFFFD4F2FFFFD4F2 + FFFFD4F2FFFFD4F2FFFFD4F2FFFFD4F2FFFFD4F2FFFFD4F2FFFFD4F2FFFFD4F2 + FFFFD9F5FFFF026AAE8100000000000000000268AB84DCF7FFFFCFF0FFFFCFF0 + FFFFCFF0FFFFC2EDFCFFA8E8F4FF91E3EDFF84E0E9FF7CDEE7FF7CDEE7FF84E0 + E9FF9CE6EFFF0268AB8400000000000000000266A788D8F4FFFFCCEEFFFFC2EC + FCFF9DE5F1FF85E0EAFF82E0E9FF82E0E9FF82E0E9FF82E0E9FF82E0E9FF82E0 + E9FF8AE2EBFF0266A78800000000000000000264A48CD6F3FFFFB6EBF9FF94E4 + F0FF8FE3EEFF8FE3EEFF8FE3EEFF8FE3EEFF8FE3EEFF8FE3EEFF8FE3EEFF8FE3 + EEFF91E4EFFF0264A48C00000000000000000261A090C1EFFBFF9EE7F4FF9DE6 + F4FF9DE6F4FF9DE6F4FF9DE6F4FF9DE6F4FF9DE6F4FF9DE6F4FF9DE6F4FF9DE6 + F4FF9DE6F4FF0261A0900000000000000000025F9C8191D0E6E1B0ECF9FFAEEB + F9FFADEBF9FFACEBF9FFABEAF9FF445DC7FF222EB7FF222EB7FF222EB7FF222E + B7FF1824B2F90018A3CD0000000000000000025C9832025C9785025C9799025C + 9799B7EDFDFF025C9799025C9799000C97EB5E5EF7FF5E5EF7FF5E5EF7FF5E5E + F7FF5E5EF7FF000498D600000000000000000000000000000000000000000355 + 8BA603558BA603568D390359930200008499000080CC000080CC000080CC0000 + 80CC000080CC000084990000000000000000000000000000000000000000034D + 7DB5034E7F3D0000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000026EB628026EB669026EB679026E + B679026EB679026EB679026EB679026EB679026EB679026EB679026EB679026E + B679026EB669026EB6280000000000000000026DB46BC1E3F1D9E6FBFFFFE5FA + FFFFE5FAFFFFE5FAFFFFE5FAFFFFE5FAFFFFE5FAFFFFE4FAFFFFE4FAFFFFE5FA + FFFFBDE2F1D9026DB46B0000000000000000026BB17EE5FAFFFFD9F4FFFFD9F4 + FFFFD9F4FFFFD9F4FFFFD9F4FFFFD9F4FFFFD9F4FFFFD9F4FFFFD9F4FFFFD9F4 + FFFFE0F8FFFF026BB17E0000000000000000026AAE81E0F9FFFFD4F2FFFFD4F2 + FFFFD4F2FFFFD4F2FFFFD4F2FFFFD4F2FFFFD4F2FFFFD4F2FFFFD4F2FFFFD4F2 + FFFFD9F5FFFF026AAE8100000000000000000268AB84DCF7FFFFCFF0FFFFCFF0 + FFFFCFF0FFFFC2EDFCFFA8E8F4FF91E3EDFF84E0E9FF7CDEE7FF7CDEE7FF70B7 + D8FF3148E3FF013FB5A300000000000000000266A788D8F4FFFFCCEEFFFFC2EC + FCFF9DE5F1FF85E0EAFF82E0E9FF82E0E9FF82E0E9FF82E0E9FF7BCCD3FF5E8E + ADFF8080FFFF010FAFE200000000000000000264A48CD6F3FFFFB6EBF9FF94E4 + F0FF8FE3EEFF8FE3EEFF8FE3EEFF8FE3EEFF8FE3EEFF6BD2E1FF71A2A8FFF7F7 + F7FF4E7390FF013BA1AC00000000000000000261A090C1EFFBFF9EE7F4FF9DE6 + F4FF9DE6F4FF9DE6F4FF9DE6F4FF9DE6F4FF76D5E5FF2EADC3FF79E6F7FF6085 + 8DFF83BFCBFF0261A0900000000000000000025F9C8191D0E6E1B0ECF9FFAEEB + F9FFADEBF9FFACEBF9FFABEAF9FF80D8E9FF32AFC5FF79E6F7FF2C99AEFF80BF + CDFF86CCE5E1025F9C810000000000000000025C9832025C9785025C9799025C + 9799B7EDFDFF025C97990174A3B2018BABE179E6F7FF017895E5016491B4025C + 9799025C9785025C983200000000000000000000000000000000000000000355 + 8BA603558BA6016798570196AFB679E6F7FF017E95BE00728944000000000000 + 000000000000000000000000000000000000000000000000000000000000034D + 7DB5034E7F3D016D917FD9F4FFFF017E95BE0072894400000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000FF014F68AB015F773D0000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF003B7F320015A9000015A9000015A9 000015A9000015AA009915AA00CC15AA00CC15AA009915A9000015A9000015A9 diff --git a/components/fpspreadsheet/examples/fpsctrls/main.pas b/components/fpspreadsheet/examples/fpsctrls/main.pas index a027b8b3b..3c0c5ffb0 100644 --- a/components/fpspreadsheet/examples/fpsctrls/main.pas +++ b/components/fpspreadsheet/examples/fpsctrls/main.pas @@ -6,7 +6,7 @@ interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, - ComCtrls, ActnList, Menus, StdActns, + ComCtrls, ActnList, Menus, StdActns, Buttons, fpstypes, fpspreadsheet, fpspreadsheetctrls, fpspreadsheetgrid, fpsActions; type @@ -211,6 +211,9 @@ type AcPasteValueFromClipboard: TsCopyAction; AcPasteFormatFromClipboard: TsCopyAction; AcPasteFormulaFromClipboard: TsCopyAction; + AcCommentNew: TsCellCommentAction; + AcCommentEdit: TsCellCommentAction; + AcCommentDelete: TsCellCommentAction; Splitter2: TSplitter; Splitter3: TSplitter; ToolBar2: TToolBar; @@ -258,6 +261,7 @@ type ToolButton37: TToolButton; ToolButton38: TToolButton; ToolButton39: TToolButton; + TbCommentAdd: TToolButton; ToolButton40: TToolButton; ToolButton41: TToolButton; ToolButton42: TToolButton; @@ -269,6 +273,9 @@ type ToolButton48: TToolButton; ToolButton49: TToolButton; ToolButton5: TToolButton; + TbCommentDelete: TToolButton; + TbCommentEdit: TToolButton; + ToolButton52: TToolButton; ToolButton6: TToolButton; ToolButton7: TToolButton; ToolButton8: TToolButton; diff --git a/components/fpspreadsheet/fpsactions.pas b/components/fpspreadsheet/fpsactions.pas index 44568d143..60774c062 100644 --- a/components/fpspreadsheet/fpsactions.pas +++ b/components/fpspreadsheet/fpsactions.pas @@ -353,6 +353,33 @@ type property Visible; end; + TsCellCommentMode = (ccmNew, ccmEdit, ccmDelete); + + TsCellCommentAction = class(TsCellAction) + private + FMode: TsCellCommentMode; + protected + function EditComment(ACaption: String; var AText: String): Boolean; virtual; + public + procedure ExecuteTarget(Target: TObject); override; + procedure UpdateTarget(Target: TObject); override; + published + property Mode: TsCellCommentMode read FMode write FMode; + property Caption; + property Enabled; + property HelpContext; + property HelpKeyword; + property HelpType; + property Hint; + property ImageIndex; + property OnExecute; + property OnHint; + property OnUpdate; + property SecondaryShortCuts; + property ShortCut; + property Visible; + end; + { TsMergeAction } TsMergeAction = class(TsAutoFormatAction) private @@ -451,6 +478,7 @@ procedure Register; implementation uses + StdCtrls, ExtCtrls, Buttons, Forms, fpsutils, fpsnumformatparser, fpsVisualUtils; procedure Register; @@ -465,6 +493,7 @@ begin TsTextRotationAction, TsWordWrapAction, TsNumberFormatAction, TsDecimalsAction, TsCellBorderAction, TsNoCellBordersAction, + TsCellCommentAction, TsMergeAction ], nil); end; @@ -1166,6 +1195,93 @@ begin end; +{ TsCellCommentAction } +function TsCellCommentAction.EditComment(ACaption: String; + var AText: String): Boolean; +var + F: TForm; + memo: TMemo; + panel: TPanel; + btn: TBitBtn; +begin + F := TForm.Create(nil); + try + F.Caption := ACaption; + F.Width := 400; + F.Height := 300; + F.Position := poMainFormCenter; + memo := TMemo.Create(F); + memo.Parent := F; + memo.Align := alClient; + memo.BorderSpacing.Around := 4; + memo.Lines.Text := AText; + panel := TPanel.Create(F); + panel.Parent := F; + panel.Align := alBottom; + panel.Height := 44; + panel.BevelOuter := bvNone; + panel.Caption := ''; + btn := TBitBtn.Create(F); + btn.Parent := panel; + btn.Kind := bkOK; + btn.Left := panel.ClientWidth - 2*btn.Width - 2*8; + btn.Top := 6; + btn.Anchors := [akTop, akRight]; + btn := TBitBtn.Create(F); + btn.Parent := panel; + btn.Kind := bkCancel; + btn.Left := panel.ClientWidth - btn.Width - 8; + btn.Top := 6; + btn.Anchors := [akTop, akRight]; + if F.ShowModal = mrOK then + begin + Result := true; + AText := memo.Lines.Text; + end else + Result := false; + finally + F.Free; + end; +end; + +procedure TsCellCommentAction.ExecuteTarget(Target: TObject); +var + txt: String; + cellStr: String; + x, y: Integer; + R: TRect; +begin + if Worksheet = nil then + exit; + + cellstr := GetCellString(Worksheet.ActiveCellRow, Worksheet.ActiveCellCol); + case FMode of + ccmNew: + begin + txt := ''; + if EditComment(Format('New comment for cell %s',[cellStr]), txt) then + Worksheet.WriteComment(Worksheet.ActiveCellRow, Worksheet.ActiveCellCol, txt); + end; + ccmEdit: + begin + txt := Worksheet.ReadComment(ActiveCell); + if EditComment(Format('Edit comment for cell %s', [cellStr]), txt) then + Worksheet.WriteComment(Worksheet.ActiveCellRow, Worksheet.ActiveCellCol, txt); + end; + ccmDelete: + Worksheet.WriteComment(ActiveCell, ''); + end; +end; + +procedure TsCellCommentAction.UpdateTarget(Target: TObject); +begin + case FMode of + ccmNew : Enabled := (Worksheet <> nil) and (Length(GetSelection) > 0); + ccmEdit, + ccmDelete: Enabled := (Worksheet <> nil) and (Worksheet.ReadComment(ActiveCell) <> ''); + end; +end; + { TsMergeAction } constructor TsMergeAction.Create(AOwner: TComponent); diff --git a/components/fpspreadsheet/fpspreadsheet.chm b/components/fpspreadsheet/fpspreadsheet.chm index 7b5202ae9..f34987a77 100755 Binary files a/components/fpspreadsheet/fpspreadsheet.chm and b/components/fpspreadsheet/fpspreadsheet.chm differ diff --git a/components/fpspreadsheet/fpspreadsheet.pas b/components/fpspreadsheet/fpspreadsheet.pas index c03a82ed8..d34e8423c 100755 --- a/components/fpspreadsheet/fpspreadsheet.pas +++ b/components/fpspreadsheet/fpspreadsheet.pas @@ -57,6 +57,7 @@ type { Special information } SharedFormulaBase: PCell; // Cell containing the shared formula MergeBase: PCell; // Upper left cell of a merged range + Comment: String; // Comment attached to the cell { Cell content } UTF8StringValue: String; // strings cannot be part of a variant record FormulaValue: String; @@ -195,6 +196,7 @@ type function ReadAsDateTime(ACell: PCell; out AResult: TDateTime): Boolean; overload; function ReadFormulaAsString(ACell: PCell; ALocalized: Boolean = false): String; function ReadNumericValue(ACell: PCell; out AValue: Double): Boolean; + function ReadComment(ACell: PCell): String; { Reading of cell attributes } function GetDisplayedDecimals(ACell: PCell): Byte; @@ -236,6 +238,9 @@ type function WriteCellValueAsString(ARow, ACol: Cardinal; AValue: String): PCell; overload; procedure WriteCellValueAsString(ACell: PCell; AValue: String); overload; + function WriteComment(ARow, ACol: Cardinal; const AComment: String): PCell; overload; + procedure WriteComment(ACell: PCell; const AComment: String); overload; + function WriteCurrency(ARow, ACol: Cardinal; AValue: Double; ANumFormat: TsNumberFormat = nfCurrency; ADecimals: Integer = 2; ACurrencySymbol: String = '?'; APosCurrFormat: Integer = -1; @@ -2736,6 +2741,20 @@ begin Result := False; end; +{@@ ---------------------------------------------------------------------------- + Returns the comment assigned to a cell + + @param ACell Pointer to the cell considered + @return String attached to the cell as a comment +-------------------------------------------------------------------------------} +function TsWorksheet.ReadComment(ACell: PCell): String; +begin + if ACell <> nil then + Result := ACell^.Comment + else + Result := ''; +end; + {@@ ---------------------------------------------------------------------------- Converts an RPN formula (as read from an xls biff file, for example) to a string formula. @@ -4112,6 +4131,35 @@ begin WriteUTF8Text(ACell, AValue); end; +{@@ ---------------------------------------------------------------------------- + Assigns a comment to a cell + + @param ARow Cell row index + @param ACol Cell column index + @param AComment Text to be used as comment. Can contain line-breaks. + @return Pointer to the cell +-------------------------------------------------------------------------------} +function TsWorksheet.WriteComment(ARow, ACol: Cardinal; + const AComment: String): PCell; +begin + Result := GetCell(ARow, ACol); + WriteComment(Result, AComment); +end; + +{@@ ---------------------------------------------------------------------------- + Assigns a comment to a cell + + @param ACell Pointer to the cell + @param AComment Text to be used as comment. Can contain line-breaks. +-------------------------------------------------------------------------------} +procedure TsWorksheet.WriteComment(ACell: PCell; const AComment: String); +begin + if ACell <> nil then begin + ACell^.Comment := AComment; + ChangedCell(ACell^.Row, ACell^.Col); + end; +end; + {@@ ---------------------------------------------------------------------------- Writes a currency value to a given cell. Its number format can be provided optionally by specifying various parameters. diff --git a/components/fpspreadsheet/fpspreadsheetgrid.pas b/components/fpspreadsheet/fpspreadsheetgrid.pas index a7805a644..ccc4c3abc 100644 --- a/components/fpspreadsheet/fpspreadsheetgrid.pas +++ b/components/fpspreadsheet/fpspreadsheetgrid.pas @@ -148,12 +148,14 @@ type procedure DrawCellBorders; overload; procedure DrawCellBorders(ACol, ARow: Integer; ARect: TRect); overload; procedure DrawCellGrid(ACol,ARow: Integer; ARect: TRect; AState: TGridDrawState); override; + procedure DrawCommentMarker(ARect: TRect); procedure DrawFocusRect(aCol,aRow:Integer; ARect:TRect); override; procedure DrawFrozenPaneBorders(ARect: TRect); procedure DrawRow(aRow: Integer); override; procedure DrawSelection; procedure DrawTextInCell(ACol, ARow: Integer; ARect: TRect; AState: TGridDrawState); override; function GetCellHeight(ACol, ARow: Integer): Integer; + function GetCellHintText(ACol, ARow: Integer): String; override; function GetCellText(ACol, ARow: Integer): String; function GetEditText(ACol, ARow: Integer): String; override; function HasBorder(ACell: PCell; ABorder: TsCellBorder): Boolean; @@ -399,6 +401,8 @@ type {@@ inherited from ancestors} property BorderStyle; {@@ inherited from ancestors} + property CellHintPriority; + {@@ inherited from ancestors} property Color; {@@ inherited from ancestors} property ColCount; @@ -1501,6 +1505,26 @@ begin inherited; end; +{@@ ---------------------------------------------------------------------------- + Draws the red rectangle in the upper right corner of a cell to indicate that + this cell contains a popup comment +-------------------------------------------------------------------------------} +procedure TscustomWorksheetGrid.DrawCommentMarker(ARect: TRect); +const + COMMENT_SIZE = 6; +var + P: Array[0..3] of TPoint; +begin + Canvas.Brush.Color := clRed; + Canvas.Brush.Style := bsSolid; + Canvas.Pen.Style := psClear; + P[0] := Point(ARect.Right, ARect.Top); + P[1] := Point(ARect.Right - COMMENT_SIZE, ARect.Top); + P[2] := Point(ARect.Right, ARect.Top + COMMENT_SIZE); + P[3] := P[0]; + Canvas.Polygon(P); +end; + {@@ ---------------------------------------------------------------------------- This procedure is responsible for painting the focus rectangle. We don't want the red dashed rectangle here, but prefer the thick Excel-like black border @@ -1745,6 +1769,9 @@ begin begin gds := GetGridDrawState(gc, gr); DoDrawCell(gc, gr, rct, rct); + // Draw comment marker + if (FDrawingCell <> nil) and (FDrawingCell^.Comment <> '') then + DrawCommentMarker(rct); end; gc := gcNext; @@ -1818,6 +1845,7 @@ var lCell: PCell; justif: Byte; fmt: PsCellFormat; + savedBrushColor: TColor; begin if (Worksheet = nil) then exit; @@ -2371,6 +2399,22 @@ begin end; end; +{@@ ---------------------------------------------------------------------------- + This function defines the text to be displayed as a cell hint. By default, it + is the comment attached to a cell; it can further be modified by using the + OnGetCellHint event. + Option goCellHints must be active for the cell hint feature to work. +-------------------------------------------------------------------------------} +function TsCustomWorksheetGrid.GetCellHintText(ACol, ARow: Integer): String; +var + cell: PCell; +begin + cell := Worksheet.FindCell(GetWorksheetRow(ARow), GetWorksheetCol(ACol)); + Result := Worksheet.ReadComment(cell); + if Assigned(OnGetCellHint) then + OnGetCellHint(self, ACol, ARow, Result); +end; + {@@ ---------------------------------------------------------------------------- This function returns the text to be shown in a grid cell. The text is looked up in the corresponding cell of the worksheet by calling its ReadAsUTF8Text diff --git a/components/fpspreadsheet/images/demos/comment-add.png b/components/fpspreadsheet/images/demos/comment-add.png new file mode 100644 index 000000000..19257165b Binary files /dev/null and b/components/fpspreadsheet/images/demos/comment-add.png differ diff --git a/components/fpspreadsheet/images/demos/comment-delete.png b/components/fpspreadsheet/images/demos/comment-delete.png new file mode 100644 index 000000000..0205d601e Binary files /dev/null and b/components/fpspreadsheet/images/demos/comment-delete.png differ diff --git a/components/fpspreadsheet/images/demos/comment-edit.png b/components/fpspreadsheet/images/demos/comment-edit.png new file mode 100644 index 000000000..12ffe5466 Binary files /dev/null and b/components/fpspreadsheet/images/demos/comment-edit.png differ diff --git a/components/fpspreadsheet/images/demos/comment.xcf b/components/fpspreadsheet/images/demos/comment.xcf new file mode 100644 index 000000000..cebb16c62 Binary files /dev/null and b/components/fpspreadsheet/images/demos/comment.xcf differ