From 5325f81dafdaf534a225cb071a0571df12a972c3 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Fri, 2 May 2014 14:55:23 +0000 Subject: [PATCH] fpspreadsheet: Add some more record descriptions to BIFFExplorer git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2987 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../reference/BIFFExplorer/BIFFExplorer.lpi | 2 +- .../reference/BIFFExplorer/bebiffgrid.pas | 255 +++++++++- .../reference/BIFFExplorer/bebiffutils.pas | 36 +- .../reference/BIFFExplorer/bemain.lfm | 455 +++++++++--------- .../reference/BIFFExplorer/bemain.pas | 52 +- 5 files changed, 547 insertions(+), 253 deletions(-) diff --git a/components/fpspreadsheet/reference/BIFFExplorer/BIFFExplorer.lpi b/components/fpspreadsheet/reference/BIFFExplorer/BIFFExplorer.lpi index 14c78c911..cdf19d04a 100644 --- a/components/fpspreadsheet/reference/BIFFExplorer/BIFFExplorer.lpi +++ b/components/fpspreadsheet/reference/BIFFExplorer/BIFFExplorer.lpi @@ -154,7 +154,7 @@ - + diff --git a/components/fpspreadsheet/reference/BIFFExplorer/bebiffgrid.pas b/components/fpspreadsheet/reference/BIFFExplorer/bebiffgrid.pas index 9aed3570d..be046aa96 100644 --- a/components/fpspreadsheet/reference/BIFFExplorer/bebiffgrid.pas +++ b/components/fpspreadsheet/reference/BIFFExplorer/bebiffgrid.pas @@ -24,6 +24,7 @@ type function GetStringType: String; procedure ShowBackup; + procedure ShowBlankCell; procedure ShowBOF; procedure ShowBookBool; procedure ShowBottomMargin; @@ -221,6 +222,8 @@ begin case FRecType of $0000, $0200: ShowDimensions; + $0001, $0201: + ShowBlankCell; $0002: ShowInteger; $0003, $0203: @@ -397,6 +400,86 @@ begin end; +procedure TBIFFGrid.ShowBlankCell; +var + numBytes: Integer; + b: Byte = 0; + w: Word = 0; + dbl: Double; +begin + RowCount := IfThen(FFormat = sfExcel2, FixedRows + 5, FixedRows + 3); + // Offset 0: Row & Offset 2: Column + ShowRowColData(FBufferIndex); + + // Offset 4: Cell attributes (BIFF2) or XF record index (> BIFF2) + if FFormat = sfExcel2 then begin + numBytes := 1; + Move(FBuffer[FBufferIndex], b, numBytes); + if Row = FCurrRow then begin + FDetails.Add('Cell protection and XF index:'#13); + FDetails.Add(Format('Bits 5-0 = %d: XF Index', [b and $3F])); + case b and $40 of + 0: FDetails.Add('Bit 6 = 0: Cell is NOT locked.'); + 1: FDetails.Add('Bit 6 = 1: Cell is locked.'); + end; + case b and $80 of + 0: FDetails.Add('Bit 7 = 0: Formula is NOT hidden.'); + 1: FDetails.Add('Bit 7 = 1: Formula is hidden.'); + end; + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b, b]), + 'Cell protection and XF index'); + + numBytes := 1; + Move(FBuffer[FBufferIndex], b, numBytes); + if Row = FCurrRow then begin + FDetails.Add('Indexes to format and font records:'#13); + FDetails.Add(Format('Bits 5-0 = %d: Index to FORMAT record', [b and $3f])); + FDetails.Add(Format('Bits 7-6 = %d: Index to FONT record', [(b and $C0) shr 6])); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b, b]), + 'Indexes of format and font records'); + + numBytes := 1; + Move(FBuffer[FBufferIndex], b, numBytes); + if Row = FCurrRow then begin + FDetails.Add('Cell style:'#13); + case b and $07 of + 0: FDetails.Add('Bits 2-0 = 0: Horizontal alignment is GENERAL'); + 1: FDetails.Add('Bits 2-0 = 1: Horizontal alignment is LEFT'); + 2: FDetails.Add('Bits 2-0 = 2: Horizontal alignment is CENTERED'); + 3: FDetails.Add('Bits 2-0 = 3: Horizontal alignment is RIGHT'); + 4: FDetails.Add('Bits 2-0 = 4: Horizontal alignment is FILLED'); + end; + if b and $08 = 0 + then FDetails.Add('Bit 3 = 0: Cell has NO left border') + else FDetails.Add('Bit 3 = 1: Cell has left black border'); + if b and $10 = 0 + then FDetails.Add('Bit 4 = 0: Cell has NO right border') + else FDetails.Add('Bit 4 = 1: Cell has right black border'); + if b and $20 = 0 + then FDetails.Add('Bit 5 = 0: Cell has NO top border') + else FDetails.Add('Bit 5 = 1: Cell has top black border'); + if b and $40 = 0 + then FDetails.Add('Bit 6 = 0: Cell has NO bottom border') + else FDetails.Add('Bit 6 = 1: Cell has bottom black border'); + if b and $80 = 0 + then FDetails.Add('Bit 7 = 0: Cell has NO shaded background') + else FDetails.Add('Bit 7 = 1: Cell has shaded background'); + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.2x)', [b,b]), + 'Cell style'); + end else + begin + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + ShowInRow(FCurrROw, FBufferIndex, numBytes, Format('%d ($%.4x)', [w, w]), + 'Index of XF record'); + end; +end; + + procedure TBIFFGrid.ShowBOF; var numBytes: Integer; @@ -1162,16 +1245,58 @@ begin if FFormat = sfExcel2 then begin numBytes := 1; Move(FBuffer[FBufferIndex], b, numBytes); + if Row = FCurrRow then begin + FDetails.Add('Cell protection and XF index:'#13); + FDetails.Add(Format('Bits 5-0 = %d: XF Index', [b and $3F])); + case b and $40 of + 0: FDetails.Add('Bit 6 = 0: Cell is NOT locked.'); + 1: FDetails.Add('Bit 6 = 1: Cell is locked.'); + end; + case b and $80 of + 0: FDetails.Add('Bit 7 = 0: Formula is NOT hidden.'); + 1: FDetails.Add('Bit 7 = 1: Formula is hidden.'); + end; + end; ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), 'Cell protection and XF index'); numBytes := 1; Move(FBuffer[FBufferIndex], b, numBytes); + if Row = FCurrRow then begin + FDetails.Add('Indexes to format and font records:'#13); + FDetails.Add(Format('Bits 5-0 = %d: Index to FORMAT record', [b and $3f])); + FDetails.Add(Format('Bits 7-6 = %d: Index to FONT record', [(b and $C0) shr 6])); + end; ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), 'Indexes of format and font records'); numBytes := 1; Move(FBuffer[FBufferIndex], b, numBytes); + if Row = FCurrRow then begin + FDetails.Add('Cell style:'#13); + case b and $07 of + 0: FDetails.Add('Bits 2-0 = 0: Horizontal alignment is GENERAL'); + 1: FDetails.Add('Bits 2-0 = 1: Horizontal alignment is LEFT'); + 2: FDetails.Add('Bits 2-0 = 2: Horizontal alignment is CENTERED'); + 3: FDetails.Add('Bits 2-0 = 3: Horizontal alignment is RIGHT'); + 4: FDetails.Add('Bits 2-0 = 4: Horizontal alignment is FILLED'); + end; + if b and $08 = 0 + then FDetails.Add('Bit 3 = 0: Cell has NO left border') + else FDetails.Add('Bit 3 = 1: Cell has left black border'); + if b and $10 = 0 + then FDetails.Add('Bit 4 = 0: Cell has NO right border') + else FDetails.Add('Bit 4 = 1: Cell has right black border'); + if b and $20 = 0 + then FDetails.Add('Bit 5 = 0: Cell has NO top border') + else FDetails.Add('Bit 5 = 1: Cell has top black border'); + if b and $40 = 0 + then FDetails.Add('Bit 6 = 0: Cell has NO bottom border') + else FDetails.Add('Bit 6 = 1: Cell has bottom black border'); + if b and $80 = 0 + then FDetails.Add('Bit 7 = 0: Cell has NO shaded background') + else FDetails.Add('Bit 7 = 1: Cell has shaded background'); + end; ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.2x)', [b,b]), 'Cell style'); end else begin @@ -1692,12 +1817,56 @@ begin numBytes := 1; b := FBuffer[FBufferIndex]; + if Row = FCurrRow then begin + FDetails.Add('Cell protection and XF index:'#13); + FDetails.Add(Format('Bits 5-0 = %d: XF Index', [b and $3F])); + case b and $40 of + 0: FDetails.Add('Bit 6 = 0: Cell is NOT locked.'); + 1: FDetails.Add('Bit 6 = 1: Cell is locked.'); + end; + case b and $80 of + 0: FDetails.Add('Bit 7 = 0: Formula is NOT hidden.'); + 1: FDetails.Add('Bit 7 = 1: Formula is hidden.'); + end; + end; ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), 'Cell protection and XF index'); + b := FBuffer[FBufferIndex]; + if Row = FCurrRow then begin + FDetails.Add('Indexes to format and font records:'#13); + FDetails.Add(Format('Bits 5-0 = %d: Index to FORMAT record', [b and $3f])); + FDetails.Add(Format('Bits 7-6 = %d: Index to FONT record', [(b and $C0) shr 6])); + end; ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), 'Indexes of format and font records'); + b := FBuffer[FBufferIndex]; + if Row = FCurrRow then begin + FDetails.Add('Cell style:'#13); + case b and $07 of + 0: FDetails.Add('Bits 2-0 = 0: Horizontal alignment is GENERAL'); + 1: FDetails.Add('Bits 2-0 = 1: Horizontal alignment is LEFT'); + 2: FDetails.Add('Bits 2-0 = 2: Horizontal alignment is CENTERED'); + 3: FDetails.Add('Bits 2-0 = 3: Horizontal alignment is RIGHT'); + 4: FDetails.Add('Bits 2-0 = 4: Horizontal alignment is FILLED'); + end; + if b and $08 = 0 + then FDetails.Add('Bit 3 = 0: Cell has NO left border') + else FDetails.Add('Bit 3 = 1: Cell has left black border'); + if b and $10 = 0 + then FDetails.Add('Bit 4 = 0: Cell has NO right border') + else FDetails.Add('Bit 4 = 1: Cell has right black border'); + if b and $20 = 0 + then FDetails.Add('Bit 5 = 0: Cell has NO top border') + else FDetails.Add('Bit 5 = 1: Cell has top black border'); + if b and $40 = 0 + then FDetails.Add('Bit 6 = 0: Cell has NO bottom border') + else FDetails.Add('Bit 6 = 1: Cell has bottom black border'); + if b and $80 = 0 + then FDetails.Add('Bit 7 = 0: Cell has NO shaded background') + else FDetails.Add('Bit 7 = 1: Cell has shaded background'); + end; ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.2x)', [b,b]), 'Cell style'); @@ -1765,16 +1934,58 @@ begin if (FFormat = sfExcel2) then begin numBytes := 1; Move(FBuffer[FBufferIndex], b, numBytes); + if Row = FCurrRow then begin + FDetails.Add('Cell protection and XF index:'#13); + FDetails.Add(Format('Bits 5-0 = %d: XF Index', [b and $3F])); + case b and $40 of + 0: FDetails.Add('Bit 6 = 0: Cell is NOT locked.'); + 1: FDetails.Add('Bit 6 = 1: Cell is locked.'); + end; + case b and $80 of + 0: FDetails.Add('Bit 7 = 0: Formula is NOT hidden.'); + 1: FDetails.Add('Bit 7 = 1: Formula is hidden.'); + end; + end; ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), 'Cell protection and XF index'); numBytes := 1; Move(FBuffer[FBufferIndex], b, numBytes); + if Row = FCurrRow then begin + FDetails.Add('Indexes to format and font records:'#13); + FDetails.Add(Format('Bits 5-0 = %d: Index to FORMAT record', [b and $3f])); + FDetails.Add(Format('Bits 7-6 = %d: Index to FONT record', [(b and $C0) shr 6])); + end; ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), 'Indexes of format and font records'); numBytes := 1; Move(FBuffer[FBufferIndex], b, numBytes); + if Row = FCurrRow then begin + FDetails.Add('Cell style:'#13); + case b and $07 of + 0: FDetails.Add('Bits 2-0 = 0: Horizontal alignment is GENERAL'); + 1: FDetails.Add('Bits 2-0 = 1: Horizontal alignment is LEFT'); + 2: FDetails.Add('Bits 2-0 = 2: Horizontal alignment is CENTERED'); + 3: FDetails.Add('Bits 2-0 = 3: Horizontal alignment is RIGHT'); + 4: FDetails.Add('Bits 2-0 = 4: Horizontal alignment is FILLED'); + end; + if b and $08 = 0 + then FDetails.Add('Bit 3 = 0: Cell has NO left border') + else FDetails.Add('Bit 3 = 1: Cell has left black border'); + if b and $10 = 0 + then FDetails.Add('Bit 4 = 0: Cell has NO right border') + else FDetails.Add('Bit 4 = 1: Cell has right black border'); + if b and $20 = 0 + then FDetails.Add('Bit 5 = 0: Cell has NO top border') + else FDetails.Add('Bit 5 = 1: Cell has top black border'); + if b and $40 = 0 + then FDetails.Add('Bit 6 = 0: Cell has NO bottom border') + else FDetails.Add('Bit 6 = 1: Cell has bottom black border'); + if b and $80 = 0 + then FDetails.Add('Bit 7 = 0: Cell has NO shaded background') + else FDetails.Add('Bit 7 = 1: Cell has shaded background'); + end; ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.2x)', [b,b]), 'Cell style'); end else begin @@ -1908,16 +2119,58 @@ begin if FFormat = sfExcel2 then begin numBytes := 1; Move(FBuffer[FBufferIndex], b, numBytes); + if Row = FCurrRow then begin + FDetails.Add('Cell protection and XF index:'#13); + FDetails.Add(Format('Bits 5-0 = %d: XF Index', [b and $3F])); + case b and $40 of + 0: FDetails.Add('Bit 6 = 0: Cell is NOT locked.'); + 1: FDetails.Add('Bit 6 = 1: Cell is locked.'); + end; + case b and $80 of + 0: FDetails.Add('Bit 7 = 0: Formula is NOT hidden.'); + 1: FDetails.Add('Bit 7 = 1: Formula is hidden.'); + end; + end; ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), 'Cell protection and XF index'); numBytes := 1; Move(FBuffer[FBufferIndex], b, numBytes); + if Row = FCurrRow then begin + FDetails.Add('Indexes to format and font records:'#13); + FDetails.Add(Format('Bits 5-0 = %d: Index to FORMAT record', [b and $3f])); + FDetails.Add(Format('Bits 7-6 = %d: Index to FONT record', [(b and $C0) shr 6])); + end; ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), 'Indexes of format and font records'); numBytes := 1; Move(FBuffer[FBufferIndex], b, numBytes); + if Row = FCurrRow then begin + FDetails.Add('Cell style:'#13); + case b and $07 of + 0: FDetails.Add('Bits 2-0 = 0: Horizontal alignment is GENERAL'); + 1: FDetails.Add('Bits 2-0 = 1: Horizontal alignment is LEFT'); + 2: FDetails.Add('Bits 2-0 = 2: Horizontal alignment is CENTERED'); + 3: FDetails.Add('Bits 2-0 = 3: Horizontal alignment is RIGHT'); + 4: FDetails.Add('Bits 2-0 = 4: Horizontal alignment is FILLED'); + end; + if b and $08 = 0 + then FDetails.Add('Bit 3 = 0: Cell has NO left border') + else FDetails.Add('Bit 3 = 1: Cell has left black border'); + if b and $10 = 0 + then FDetails.Add('Bit 4 = 0: Cell has NO right border') + else FDetails.Add('Bit 4 = 1: Cell has right black border'); + if b and $20 = 0 + then FDetails.Add('Bit 5 = 0: Cell has NO top border') + else FDetails.Add('Bit 5 = 1: Cell has top black border'); + if b and $40 = 0 + then FDetails.Add('Bit 6 = 0: Cell has NO bottom border') + else FDetails.Add('Bit 6 = 1: Cell has bottom black border'); + if b and $80 = 0 + then FDetails.Add('Bit 7 = 0: Cell has NO shaded background') + else FDetails.Add('Bit 7 = 1: Cell has shaded background'); + end; ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.2x)', [b,b]), 'Cell style'); end else begin @@ -3052,7 +3305,7 @@ begin then FDetails.Add('Bit 7 = 0: Formula is not hidden') else FDetails.Add('Bit 7 = 1: Formula is hidden'); end; - ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [b]), + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b, b]), 'Number format and cell flags'); b := FBuffer[FBufferIndex]; diff --git a/components/fpspreadsheet/reference/BIFFExplorer/bebiffutils.pas b/components/fpspreadsheet/reference/BIFFExplorer/bebiffutils.pas index 666150973..969bdd69b 100644 --- a/components/fpspreadsheet/reference/BIFFExplorer/bebiffutils.pas +++ b/components/fpspreadsheet/reference/BIFFExplorer/bebiffutils.pas @@ -90,18 +90,18 @@ end; function RecTypeName(ARecType: Word): String; begin case ARecType of - $0000: Result := 'Dimension'; - $0001: Result := 'Blank'; - $0002: Result := 'Integer'; - $0003: Result := 'Number'; - $0004: Result := 'Label'; + $0000: Result := 'DIMENSION'; + $0001: Result := 'BLANK'; + $0002: Result := 'INTEGER'; + $0003: Result := 'NUMBER'; + $0004: Result := 'LABEL'; $0005: Result := 'BoolErr'; - $0006: Result := 'Formula'; - $0007: Result := 'String'; - $0008: Result := 'Row'; + $0006: Result := 'FORMULA'; + $0007: Result := 'STRING'; + $0008: Result := 'ROW'; $0009: Result := 'BOF'; $000A: Result := 'EOF: End of file'; - $000B: Result := 'Index'; + $000B: Result := 'INDEX'; $000C: Result := 'CALCCOUNT: Iteration count'; $000D: Result := 'CALCMODE: Calculation mode'; $000E: Result := 'PRECISION: Precision'; @@ -119,14 +119,14 @@ begin $001A: Result := 'VERTICALPAGEBREAKS: Explicit column page breaks'; $001B: Result := 'HORIZONALPAGEBREAKS: Explicit row page breaks'; $001C: Result := 'NOTE: Comment associated with a cell'; - $001D: Result := 'SELECTION: current selection'; - $001E: Result := 'Format'; - $001F: Result := 'BuiltInFmtCount'; + $001D: Result := 'SELECTION: Current selection'; + $001E: Result := 'FORMAT: Number format record'; + $001F: Result := 'FORMATCOUNT: Count of number formats'; $0020: Result := 'ColumnDefault'; $0021: Result := 'Array'; $0022: Result := '1904: 1904 date system'; $0023: Result := 'ExternalName'; - $0024: Result := 'ColWidth'; + $0024: Result := 'COLWIDTH'; $0025: Result := 'DefaultRowHeight'; $0026: Result := 'LEFTMARGIN: Left margin measurement'; $0027: Result := 'RIGHTMARGIN: Right margin measurement'; @@ -136,19 +136,19 @@ begin $002B: Result := 'PRINTGRIDLINES: Print gridlines flag'; $002F: Result := 'FILEPASS: File is password-protected'; $0031: Result := 'FONT: Font and font formatting information'; - $0032: Result := 'Font2'; + $0032: Result := 'FONT2'; $0033: Result := 'PRINTSIZE: Printed size of chart'; $0036: Result := 'DataTable'; $0037: Result := 'DateTable2'; $003C: Result := 'CONTINUE: Continues long records'; $003D: Result := 'WINDOW1: Window information'; - $003E: Result := 'Window2'; + $003E: Result := 'WINDOW2'; $0040: Result := 'BACKUP: Save backup version of the file'; $0041: Result := 'PANE: Number of panes and their position'; $0042: Result := 'CODEPAGE: Default code page'; // also: CODENAME: VBE object name ??? - $0043: Result := 'XF: Extended f'; + $0043: Result := 'XF: Extended format'; $0044: Result := 'IXFE'; - $0045: Result := 'FontColor'; + $0045: Result := 'FONTCOLOR'; $004D: Result := 'PLS: Environment-specific print record'; $0050: Result := 'DCON: Data consolidation information'; $0051: Result := 'DCONREF: Data consolidation references'; @@ -287,7 +287,7 @@ begin $0231: Result := 'FONT: Font description'; $0236: Result := 'TABLE: Data table'; $023E: Result := 'WINDOW2: Sheet window information'; - $0243: Result := 'XF'; + $0243: Result := 'XF: Extended format'; $027E: Result := 'RK'; $0293: Result := 'STYLE: Style information'; $0406: Result := 'FORMULA: Cell formula'; diff --git a/components/fpspreadsheet/reference/BIFFExplorer/bemain.lfm b/components/fpspreadsheet/reference/BIFFExplorer/bemain.lfm index 9b5d23589..5b090b326 100644 --- a/components/fpspreadsheet/reference/BIFFExplorer/bemain.lfm +++ b/components/fpspreadsheet/reference/BIFFExplorer/bemain.lfm @@ -62,227 +62,26 @@ object MainForm: TMainForm ClientHeight = 507 ClientWidth = 665 TabOrder = 2 - object HexSplitter: TSplitter - Cursor = crVSplit - Left = 0 - Height = 5 - Top = 244 - Width = 665 - Align = alBottom - ResizeAnchor = akBottom - end - object HexPanel: TPanel - Left = 0 - Height = 244 - Top = 0 - Width = 665 - Align = alClient - Caption = 'HexPanel' - ClientHeight = 244 - ClientWidth = 665 - TabOrder = 1 - object HexGrid: TStringGrid - Left = 1 - Height = 242 - Top = 1 - Width = 398 - Align = alClient - AutoFillColumns = True - ColCount = 17 - DefaultColWidth = 28 - ExtendedSelect = False - Options = [goFixedVertLine, goFixedHorzLine, goHorzLine, goRangeSelect, goDrawFocusSelected, goThumbTracking, goSmoothScroll] - ParentFont = False - TabOrder = 0 - TitleStyle = tsNative - OnClick = GridClick - OnPrepareCanvas = HexGridPrepareCanvas - OnSelection = HexGridSelection - ColWidths = ( - 28 - 22 - 22 - 22 - 22 - 22 - 22 - 22 - 22 - 22 - 22 - 22 - 22 - 22 - 22 - 22 - 36 - ) - Cells = ( - 16 - 1 - 0 - '0' - 2 - 0 - '1' - 3 - 0 - '2' - 4 - 0 - '3' - 5 - 0 - '4' - 6 - 0 - '5' - 7 - 0 - '6' - 8 - 0 - '7' - 9 - 0 - '8' - 10 - 0 - '9' - 11 - 0 - '10' - 12 - 0 - '11' - 13 - 0 - '12' - 14 - 0 - '13' - 15 - 0 - '14' - 16 - 0 - '15' - ) - end - object AlphaGrid: TStringGrid - Left = 404 - Height = 242 - Top = 1 - Width = 260 - Align = alRight - AutoFillColumns = True - ColCount = 16 - FixedCols = 0 - Options = [goFixedVertLine, goFixedHorzLine, goHorzLine, goRangeSelect, goDrawFocusSelected, goThumbTracking, goSmoothScroll] - ParentFont = False - TabOrder = 1 - TitleStyle = tsNative - OnClick = GridClick - OnSelection = AlphaGridSelection - ColWidths = ( - 16 - 16 - 16 - 16 - 16 - 16 - 16 - 16 - 16 - 16 - 16 - 16 - 16 - 16 - 16 - 16 - ) - Cells = ( - 16 - 0 - 0 - '0' - 1 - 0 - '1' - 2 - 0 - '2' - 3 - 0 - '3' - 4 - 0 - '4' - 5 - 0 - '5' - 6 - 0 - '6' - 7 - 0 - '7' - 8 - 0 - '8' - 9 - 0 - '9' - 10 - 0 - 'A' - 11 - 0 - 'B' - 12 - 0 - 'C' - 13 - 0 - 'D' - 14 - 0 - 'E' - 15 - 0 - 'F' - ) - end - object HexDumpSplitter: TSplitter - Left = 399 - Height = 242 - Top = 1 - Width = 5 - Align = alRight - ResizeAnchor = akRight - end - end object PageControl: TPageControl Left = 0 - Height = 258 - Top = 249 + Height = 507 + Top = 0 Width = 665 ActivePage = PgValues - Align = alBottom + Align = alClient TabIndex = 1 - TabOrder = 2 + TabOrder = 0 OnChange = PageControlChange object PgAnalysis: TTabSheet Caption = 'Analysis' - ClientHeight = 225 + ClientHeight = 479 ClientWidth = 657 object AnalysisDetails: TMemo - Left = 428 - Height = 225 - Top = 0 - Width = 229 - Align = alRight + Left = 0 + Height = 191 + Top = 288 + Width = 657 + Align = alBottom Font.CharSet = ANSI_CHARSET Font.Height = -12 Font.Name = 'Courier New' @@ -294,24 +93,25 @@ object MainForm: TMainForm WordWrap = False end object DetailsSplitter: TSplitter - Left = 423 - Height = 225 - Top = 0 - Width = 5 - Align = alRight - ResizeAnchor = akRight + Cursor = crVSplit + Left = 0 + Height = 5 + Top = 283 + Width = 657 + Align = alBottom + ResizeAnchor = akBottom end end object PgValues: TTabSheet Caption = 'Values' - ClientHeight = 230 + ClientHeight = 479 ClientWidth = 657 object ValueGrid: TStringGrid Left = 0 - Height = 230 - Top = 0 + Height = 158 + Top = 321 Width = 657 - Align = alClient + Align = alBottom ColCount = 3 DefaultColWidth = 100 FixedCols = 0 @@ -338,6 +138,207 @@ object MainForm: TMainForm 'Offset range' ) end + object HexPanel: TPanel + Left = 0 + Height = 316 + Top = 0 + Width = 657 + Align = alClient + Caption = 'HexPanel' + ClientHeight = 316 + ClientWidth = 657 + TabOrder = 1 + object HexGrid: TStringGrid + Left = 1 + Height = 314 + Top = 1 + Width = 390 + Align = alClient + AutoFillColumns = True + ColCount = 17 + DefaultColWidth = 28 + ExtendedSelect = False + Options = [goFixedVertLine, goFixedHorzLine, goHorzLine, goRangeSelect, goDrawFocusSelected, goThumbTracking, goSmoothScroll] + ParentFont = False + TabOrder = 0 + TitleStyle = tsNative + OnClick = GridClick + OnPrepareCanvas = HexGridPrepareCanvas + OnSelection = HexGridSelection + ColWidths = ( + 28 + 22 + 22 + 22 + 22 + 22 + 22 + 22 + 22 + 22 + 22 + 22 + 22 + 22 + 22 + 22 + 28 + ) + Cells = ( + 16 + 1 + 0 + '0' + 2 + 0 + '1' + 3 + 0 + '2' + 4 + 0 + '3' + 5 + 0 + '4' + 6 + 0 + '5' + 7 + 0 + '6' + 8 + 0 + '7' + 9 + 0 + '8' + 10 + 0 + '9' + 11 + 0 + '10' + 12 + 0 + '11' + 13 + 0 + '12' + 14 + 0 + '13' + 15 + 0 + '14' + 16 + 0 + '15' + ) + end + object AlphaGrid: TStringGrid + Left = 396 + Height = 314 + Top = 1 + Width = 260 + Align = alRight + AutoFillColumns = True + ColCount = 16 + FixedCols = 0 + Options = [goFixedVertLine, goFixedHorzLine, goHorzLine, goRangeSelect, goDrawFocusSelected, goThumbTracking, goSmoothScroll] + ParentFont = False + TabOrder = 1 + TitleStyle = tsNative + OnClick = GridClick + OnSelection = AlphaGridSelection + ColWidths = ( + 16 + 16 + 16 + 16 + 16 + 16 + 16 + 16 + 16 + 16 + 16 + 16 + 16 + 16 + 16 + 16 + ) + Cells = ( + 16 + 0 + 0 + '0' + 1 + 0 + '1' + 2 + 0 + '2' + 3 + 0 + '3' + 4 + 0 + '4' + 5 + 0 + '5' + 6 + 0 + '6' + 7 + 0 + '7' + 8 + 0 + '8' + 9 + 0 + '9' + 10 + 0 + 'A' + 11 + 0 + 'B' + 12 + 0 + 'C' + 13 + 0 + 'D' + 14 + 0 + 'E' + 15 + 0 + 'F' + ) + end + object HexDumpSplitter: TSplitter + Left = 391 + Height = 314 + Top = 1 + Width = 5 + Align = alRight + ResizeAnchor = akRight + end + end + object HexSplitter: TSplitter + Cursor = crVSplit + Left = 0 + Height = 5 + Top = 316 + Width = 657 + Align = alBottom + ResizeAnchor = akBottom + end end end end @@ -514,7 +515,7 @@ object MainForm: TMainForm Align = alClient ButtonStyle = bsTriangle DefaultText = 'Node' - Header.AutoSizeIndex = 3 + Header.AutoSizeIndex = 4 Header.Columns = < item Alignment = taRightJustify @@ -539,10 +540,16 @@ object MainForm: TMainForm Width = 130 end item - MinWidth = 80 + Alignment = taCenter + MinWidth = 50 Position = 3 + Text = 'Index' + end + item + MinWidth = 80 + Position = 4 Text = 'Record description' - Width = 125 + Width = 80 end> Header.DefaultHeight = 24 Header.Font.Style = [fsBold] diff --git a/components/fpspreadsheet/reference/BIFFExplorer/bemain.pas b/components/fpspreadsheet/reference/BIFFExplorer/bemain.pas index 108ef3848..4387b5a9c 100644 --- a/components/fpspreadsheet/reference/BIFFExplorer/bemain.pas +++ b/components/fpspreadsheet/reference/BIFFExplorer/bemain.pas @@ -22,6 +22,7 @@ type RecordID: Integer; RecordName: String; RecordDescription: String; + Index: Integer; destructor Destroy; override; end; @@ -131,6 +132,10 @@ type FFormat: TsSpreadsheetFormat; FBuffer: TBIFFBuffer; FCurrOffset: Integer; + FXFIndex: Integer; + FFontIndex: Integer; + FFormatIndex: Integer; + FRowIndex: Integer; FLockHexDumpGrids: Integer; FAnalysisGrid: TBIFFGrid; FMRUMenuManager : TMRUMenuManager; @@ -441,12 +446,13 @@ begin data := TBiffNodeData(ptr^.Data); case Sender.GetNodeLevel(Node) of 0: if Column = 0 then - CellText := data.RecordName; + CellText := data.RecordName; 1: case Column of 0: CellText := IntToStr(data.Offset); 1: CellText := Format('$%.4x', [data.RecordID]); 2: CellText := data.RecordName; - 3: CellText := data.RecordDescription; + 3: if data.Index > -1 then CellText := IntToStr(data.Index); + 4: CellText := data.RecordDescription; end; end; end; @@ -589,6 +595,11 @@ begin OnRecentFile := @MRUMenuManagerRecentFile; end; + FXFIndex := -1; + FFontIndex := -1; + FFormatIndex := -1; + FRowIndex := -1; + HexGrid.ColWidths[HexGrid.ColCount-1] := 5; HexGrid.DefaultRowHeight := HexGrid.Canvas.TextHeight('Tg') + 4; AlphaGrid.DefaultRowHeight := HexGrid.DefaultRowHeight; @@ -1000,7 +1011,7 @@ begin try ReadFormFromIni(ini, 'MainForm', self); - BiffTree.Width := ini.ReadInteger('MainForm', 'RecordList_Width', BiffTree.Width); + TreePanel.Width := ini.ReadInteger('MainForm', 'RecordList_Width', TreePanel.Width); for i:=0 to BiffTree.Header.Columns.Count-1 do BiffTree.Header.Columns[i].Width := ini.ReadInteger('MainForm', Format('RecordList_ColWidth_%d', [i+1]), BiffTree.Header.Columns[i].Width); @@ -1010,7 +1021,7 @@ begin ValueGrid.ColWidths[i] := ini.ReadInteger('MainForm', Format('ValueGrid_ColWidth_%d', [i+1]), ValueGrid.ColWidths[i]); - AlphaGrid.Width := ini.ReadInteger('MainForm', 'AlphaGrid_Width', AlphaGrid.Width); + AlphaGrid.Height := ini.ReadInteger('MainForm', 'AlphaGrid_Height', AlphaGrid.Height); for i:=0 to AlphaGrid.ColCount-1 do AlphaGrid.ColWidths[i] := ini.ReadInteger('MainForm', Format('AlphaGrid_ColWidth_%d', [i+1]), AlphaGrid.ColWidths[i]); @@ -1019,9 +1030,8 @@ begin FAnalysisGrid.ColWidths[i] := ini.ReadInteger('MainForm', Format('AnalysisGrid_ColWidth_%d', [i+1]), FAnalysisGrid.ColWidths[i]); - AnalysisDetails.Width := ini.ReadInteger('MainForm', 'AnalysisDetails_Width', AnalysisDetails.Width); + AnalysisDetails.Height := ini.ReadInteger('MainForm', 'AnalysisDetails_Height', AnalysisDetails.Height); - PageControl.Height := ini.ReadInteger('MainForm', 'PageControl_Height', PageControl.Height); PageControl.ActivePageIndex := ini.ReadInteger('MainForm', 'PageIndex', PageControl.ActivePageIndex); finally ini.Free; @@ -1071,6 +1081,7 @@ begin parentnode := BIFFTree.AddChild(nil); ptr := BIFFTree.GetNodeData(parentnode); ptr^.Data := parentdata; + FRowIndex := -1; end; // add node to parent node data := TBiffNodeData.Create; @@ -1083,6 +1094,30 @@ begin data.RecordName := s; data.RecordDescription := ''; end; + case recType of + $0008, $0208: // Row + begin + inc(FRowIndex); + data.Index := FRowIndex; + end; + $0031, $0231: // Font record + begin + inc(FFontIndex); + data.Index := FFontIndex; + end; + $0043, $00E0: // XF record + begin + inc(FXFIndex); + data.Index := FXFIndex; + end; + $001E, $041E: // Format record + begin + inc(FFormatIndex); + data.Index := FFormatIndex; + end; + else + data.Index := -1; + end; node := BIFFTree.AddChild(parentnode); ptr := BIFFTree.GetNodeData(node); ptr^.Data := data; @@ -1143,7 +1178,7 @@ begin try WriteFormToIni(ini, 'MainForm', self); - ini.WriteInteger('MainForm', 'RecordList_Width', BiffTree.Width); + ini.WriteInteger('MainForm', 'RecordList_Width', TreePanel.Width); for i:=0 to BiffTree.Header.Columns.Count-1 do ini.WriteInteger('MainForm', Format('RecordList_ColWidth_%d', [i+1]), BiffTree.Header.Columns[i].Width); @@ -1158,10 +1193,9 @@ begin for i:=0 to FAnalysisGrid.ColCount-1 do ini.WriteInteger('MainForm', Format('AnalysisGrid_ColWidth_%d', [i+1]), FAnalysisGrid.ColWidths[i]); - ini.WriteInteger('MainForm', 'AnalysisDetails_Width', AnalysisDetails.Width); + ini.WriteInteger('MainForm', 'AnalysisDetails_Height', AnalysisDetails.Height); ini.WriteInteger('MainForm', 'PageIndex', PageControl.ActivePageIndex); - ini.WriteInteger('MainForm', 'PageControl_Height', PageControl.Height); finally ini.Free; end;