You've already forked lazarus-ccr
fpspreadsheet: Extend TsSpreadsheetInspector to show row records
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5236 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -27,7 +27,7 @@ object MainForm: TMainForm
|
|||||||
Height = 493
|
Height = 493
|
||||||
Top = 23
|
Top = 23
|
||||||
Width = 690
|
Width = 690
|
||||||
AutoCalcRowHeights = False
|
AutoCalc = True
|
||||||
FrozenCols = 0
|
FrozenCols = 0
|
||||||
FrozenRows = 0
|
FrozenRows = 0
|
||||||
ReadFormulas = True
|
ReadFormulas = True
|
||||||
@@ -58,6 +58,7 @@ object MainForm: TMainForm
|
|||||||
Height = 518
|
Height = 518
|
||||||
Top = 83
|
Top = 83
|
||||||
Width = 298
|
Width = 298
|
||||||
|
MultiLine = True
|
||||||
OnChange = InspectorTabControlChange
|
OnChange = InspectorTabControlChange
|
||||||
TabIndex = 0
|
TabIndex = 0
|
||||||
Tabs.Strings = (
|
Tabs.Strings = (
|
||||||
@@ -65,14 +66,15 @@ object MainForm: TMainForm
|
|||||||
'Worksheet'
|
'Worksheet'
|
||||||
'Cell values'
|
'Cell values'
|
||||||
'Cell properties'
|
'Cell properties'
|
||||||
|
'Row'
|
||||||
)
|
)
|
||||||
Align = alRight
|
Align = alRight
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
Visible = False
|
Visible = False
|
||||||
object Inspector: TsSpreadsheetInspector
|
object Inspector: TsSpreadsheetInspector
|
||||||
Left = 2
|
Left = 2
|
||||||
Height = 493
|
Height = 473
|
||||||
Top = 23
|
Top = 43
|
||||||
Width = 294
|
Width = 294
|
||||||
Align = alClient
|
Align = alClient
|
||||||
DefaultColWidth = 125
|
DefaultColWidth = 125
|
||||||
|
@@ -436,7 +436,7 @@ type
|
|||||||
|
|
||||||
{@@ Classification of data displayed by the SpreadsheetInspector. Each item
|
{@@ Classification of data displayed by the SpreadsheetInspector. Each item
|
||||||
can be assigned to a tab of a TabControl. }
|
can be assigned to a tab of a TabControl. }
|
||||||
TsInspectorMode = (imWorkbook, imWorksheet, imCellValue, imCellProperties);
|
TsInspectorMode = (imWorkbook, imWorksheet, imCellValue, imCellProperties, imRow);
|
||||||
|
|
||||||
{@@ Inspector expanded nodes }
|
{@@ Inspector expanded nodes }
|
||||||
TsInspectorExpandedNode = (ienFormatSettings, ienPageLayout, ienFonts, ienFormats,
|
TsInspectorExpandedNode = (ienFormatSettings, ienPageLayout, ienFonts, ienFormats,
|
||||||
@@ -451,6 +451,7 @@ type
|
|||||||
FWorkbookSource: TsWorkbookSource;
|
FWorkbookSource: TsWorkbookSource;
|
||||||
FMode: TsInspectorMode;
|
FMode: TsInspectorMode;
|
||||||
FExpanded: TsInspectorExpandedNodes;
|
FExpanded: TsInspectorExpandedNodes;
|
||||||
|
FCurrRow, FCurrCol: Integer;
|
||||||
function GetWorkbook: TsWorkbook;
|
function GetWorkbook: TsWorkbook;
|
||||||
function GetWorksheet: TsWorksheet;
|
function GetWorksheet: TsWorksheet;
|
||||||
procedure SetExpanded(AValue: TsInspectorExpandedNodes);
|
procedure SetExpanded(AValue: TsInspectorExpandedNodes);
|
||||||
@@ -462,6 +463,7 @@ type
|
|||||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||||
procedure UpdateCellValue(ACell: PCell; AStrings: TStrings); virtual;
|
procedure UpdateCellValue(ACell: PCell; AStrings: TStrings); virtual;
|
||||||
procedure UpdateCellProperties(ACell: PCell; AStrings: TStrings); virtual;
|
procedure UpdateCellProperties(ACell: PCell; AStrings: TStrings); virtual;
|
||||||
|
procedure UpdateRow(ARow: Integer; AStrings: TStrings); virtual;
|
||||||
procedure UpdateWorkbook(AWorkbook: TsWorkbook; AStrings: TStrings); virtual;
|
procedure UpdateWorkbook(AWorkbook: TsWorkbook; AStrings: TStrings); virtual;
|
||||||
procedure UpdateWorksheet(ASheet: TsWorksheet; AStrings: TStrings); virtual;
|
procedure UpdateWorksheet(ASheet: TsWorksheet; AStrings: TStrings); virtual;
|
||||||
public
|
public
|
||||||
@@ -752,9 +754,13 @@ end;
|
|||||||
-------------------------------------------------------------------------------}
|
-------------------------------------------------------------------------------}
|
||||||
procedure TsWorkbookSource.CellSelectedHandler(Sender: TObject;
|
procedure TsWorkbookSource.CellSelectedHandler(Sender: TObject;
|
||||||
ARow, ACol: Cardinal);
|
ARow, ACol: Cardinal);
|
||||||
|
var
|
||||||
|
dummycell: TCell;
|
||||||
begin
|
begin
|
||||||
Unused(ARow, ACol);
|
dummycell.Row := ARow;
|
||||||
NotifyListeners([lniSelection]);
|
dummycell.Col := ACol;
|
||||||
|
// Unused(ARow, ACol);
|
||||||
|
NotifyListeners([lniSelection], @dummycell);
|
||||||
|
|
||||||
if FPendingOperation <> coNone then
|
if FPendingOperation <> coNone then
|
||||||
begin
|
begin
|
||||||
@@ -2852,8 +2858,11 @@ begin
|
|||||||
begin
|
begin
|
||||||
book := FWorkbookSource.Workbook;
|
book := FWorkbookSource.Workbook;
|
||||||
sheet := FWorkbookSource.Worksheet;
|
sheet := FWorkbookSource.Worksheet;
|
||||||
if sheet <> nil then
|
if sheet <> nil then begin
|
||||||
cell := sheet.FindCell(sheet.ActiveCellRow, sheet.ActiveCellCol);
|
cell := sheet.FindCell(sheet.ActiveCellRow, sheet.ActiveCellCol);
|
||||||
|
if cell <> nil then
|
||||||
|
FCurrRow := cell^.Row;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
list := TStringList.Create;
|
list := TStringList.Create;
|
||||||
@@ -2863,6 +2872,7 @@ begin
|
|||||||
imCellProperties : UpdateCellProperties(cell, list);
|
imCellProperties : UpdateCellProperties(cell, list);
|
||||||
imWorksheet : UpdateWorksheet(sheet, list);
|
imWorksheet : UpdateWorksheet(sheet, list);
|
||||||
imWorkbook : UpdateWorkbook(book, list);
|
imWorkbook : UpdateWorkbook(book, list);
|
||||||
|
imRow : UpdateRow(FCurrRow, list);
|
||||||
end;
|
end;
|
||||||
Strings.Assign(list);
|
Strings.Assign(list);
|
||||||
finally
|
finally
|
||||||
@@ -2906,14 +2916,22 @@ end;
|
|||||||
procedure TsSpreadsheetInspector.ListenerNotification(
|
procedure TsSpreadsheetInspector.ListenerNotification(
|
||||||
AChangedItems: TsNotificationItems; AData: Pointer = nil);
|
AChangedItems: TsNotificationItems; AData: Pointer = nil);
|
||||||
begin
|
begin
|
||||||
Unused(AData);
|
// Unused(AData);
|
||||||
case FMode of
|
case FMode of
|
||||||
imWorkbook:
|
imWorkbook:
|
||||||
if ([lniWorkbook, lniWorksheet]*AChangedItems <> []) then DoUpdate;
|
if ([lniWorkbook, lniWorksheet]*AChangedItems <> []) then
|
||||||
|
DoUpdate;
|
||||||
imWorksheet:
|
imWorksheet:
|
||||||
if ([lniWorksheet, lniSelection]*AChangedItems <> []) then DoUpdate;
|
if ([lniWorksheet, lniSelection]*AChangedItems <> []) then
|
||||||
|
DoUpdate;
|
||||||
imCellValue, imCellProperties:
|
imCellValue, imCellProperties:
|
||||||
if ([lniCell, lniSelection]*AChangedItems <> []) then DoUpdate;
|
if ([lniCell, lniSelection]*AChangedItems <> []) then
|
||||||
|
DoUpdate;
|
||||||
|
imRow:
|
||||||
|
if AData <> nil then begin
|
||||||
|
FCurrRow := PCell(AData)^.Row;
|
||||||
|
if ([lniSelection] * AChangedItems <> []) then DoUpdate;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -3187,6 +3205,42 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{@@ ----------------------------------------------------------------------------
|
||||||
|
Creates a string list containing the properties of a row.
|
||||||
|
The string list items are name-value pairs in the format "name=value".
|
||||||
|
The string list is displayed in the inspector's grid.
|
||||||
|
|
||||||
|
@param ARow index of the investigated row
|
||||||
|
@param AStrings Stringlist receiving the name-value pairs.
|
||||||
|
-------------------------------------------------------------------------------}
|
||||||
|
procedure TsSpreadsheetInspector.UpdateRow(ARow: Integer; AStrings: TStrings);
|
||||||
|
var
|
||||||
|
lRow: PRow;
|
||||||
|
unitStr: String;
|
||||||
|
begin
|
||||||
|
if ARow < 0 then
|
||||||
|
exit;
|
||||||
|
|
||||||
|
unitStr := SizeUnitNames[Workbook.Units];
|
||||||
|
lRow := Worksheet.FindRow(ARow);
|
||||||
|
AStrings.Add(Format('Row=%d', [ARow]));
|
||||||
|
if lRow <> nil then
|
||||||
|
begin
|
||||||
|
AStrings.Add(Format('Height=%.1f %s', [
|
||||||
|
lRow^.Height, unitStr
|
||||||
|
]));
|
||||||
|
AStrings.Add(Format('RowHeightType=%s', [
|
||||||
|
RowHeightTypeNames[lRow^.RowHeightType]
|
||||||
|
]));
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
AStrings.Add('No row record=');
|
||||||
|
AStrings.Add(Format('DefaultRowHeight=%.1f %s', [
|
||||||
|
Worksheet.ReadDefaultRowHeight(Workbook.Units), unitStr
|
||||||
|
]));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
{@@ ----------------------------------------------------------------------------
|
||||||
Creates a string list containing the properties of the workbook.
|
Creates a string list containing the properties of the workbook.
|
||||||
The string list items are name-value pairs in the format "name=value".
|
The string list items are name-value pairs in the format "name=value".
|
||||||
@@ -3363,7 +3417,7 @@ begin
|
|||||||
AStrings.Add(Format(' Start page number=%d', [ASheet.pageLayout.StartPageNumber]))
|
AStrings.Add(Format(' Start page number=%d', [ASheet.pageLayout.StartPageNumber]))
|
||||||
else
|
else
|
||||||
AStrings.Add(' Start page number=automatic');
|
AStrings.Add(' Start page number=automatic');
|
||||||
AStrings.Add(Format(' Scaling factor=%d%%',
|
AStrings.Add(Format(' Scaling factor (Zoom)=%d%%',
|
||||||
[ASheet.PageLayout.ScalingFactor]));
|
[ASheet.PageLayout.ScalingFactor]));
|
||||||
AStrings.Add(Format(' Copies=%d', [ASheet.PageLayout.Copies]));
|
AStrings.Add(Format(' Copies=%d', [ASheet.PageLayout.Copies]));
|
||||||
if (ASheet.PageLayout.Options * [poDifferentOddEven, poDifferentFirst] <> []) then
|
if (ASheet.PageLayout.Options * [poDifferentOddEven, poDifferentFirst] <> []) then
|
||||||
|
@@ -778,6 +778,10 @@ type
|
|||||||
the grid }
|
the grid }
|
||||||
TsRowHeightType = (rhtDefault, rhtAuto, rhtCustom);
|
TsRowHeightType = (rhtDefault, rhtAuto, rhtCustom);
|
||||||
|
|
||||||
|
const
|
||||||
|
RowHeightTypeNames: array[TsRowHeightType] of string = (
|
||||||
|
'Default', 'Auto', 'Custom');
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user