diff --git a/components/fpspreadsheet/reference/BIFFExplorer/BIFFExplorer.ico b/components/fpspreadsheet/reference/BIFFExplorer/BIFFExplorer.ico new file mode 100644 index 000000000..7ce4cfe07 Binary files /dev/null and b/components/fpspreadsheet/reference/BIFFExplorer/BIFFExplorer.ico differ diff --git a/components/fpspreadsheet/reference/BIFFExplorer/BIFFExplorer.lpi b/components/fpspreadsheet/reference/BIFFExplorer/BIFFExplorer.lpi new file mode 100644 index 000000000..42e34618f --- /dev/null +++ b/components/fpspreadsheet/reference/BIFFExplorer/BIFFExplorer.lpi @@ -0,0 +1,238 @@ + + + + + + + + + + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + <XPManifest> + <DpiAware Value="True"/> + </XPManifest> + <Icon Value="0"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="3"> + <Item1 Name="Release" Default="True"/> + <Item2 Name="Debug"> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <OtherUnitFiles Value="mrumenu"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <IncludeAssertionCode Value="True"/> + </SyntaxOptions> + </Parsing> + <CodeGeneration> + <Checks> + <IOChecks Value="True"/> + <RangeChecks Value="True"/> + <OverflowChecks Value="True"/> + <StackChecks Value="True"/> + </Checks> + </CodeGeneration> + <Linking> + <Debugging> + <DebugInfoType Value="dsDwarf2Set"/> + <UseExternalDbgSyms Value="True"/> + </Debugging> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CompilerMessages> + <MsgFileName Value=""/> + </CompilerMessages> + <CustomOptions Value="-duse_new_ole"/> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + </Item2> + <Item3 Name="Debug with heaptrace"> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <OtherUnitFiles Value="mrumenu"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <IncludeAssertionCode Value="True"/> + </SyntaxOptions> + </Parsing> + <CodeGeneration> + <Checks> + <IOChecks Value="True"/> + <RangeChecks Value="True"/> + <OverflowChecks Value="True"/> + <StackChecks Value="True"/> + </Checks> + </CodeGeneration> + <Linking> + <Debugging> + <DebugInfoType Value="dsStabs"/> + <UseHeaptrc Value="True"/> + </Debugging> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CompilerMessages> + <MsgFileName Value=""/> + </CompilerMessages> + <CustomOptions Value="-duse_new_ole"/> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + </Item3> + <SharedMatrixOptions Count="1"> + <Item1 ID="897672969650" Value="-vd"/> + </SharedMatrixOptions> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + </local> + </RunParams> + <RequiredPackages Count="4"> + <Item1> + <PackageName Value="laz_fpspreadsheet"/> + </Item1> + <Item2> + <PackageName Value="TurboPowerIPro"/> + </Item2> + <Item3> + <PackageName Value="virtualtreeview_package"/> + </Item3> + <Item4> + <PackageName Value="LCL"/> + </Item4> + </RequiredPackages> + <Units Count="10"> + <Unit0> + <Filename Value="BIFFExplorer.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="BIFFExplorer"/> + </Unit0> + <Unit1> + <Filename Value="beabout.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="AboutForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="beAbout"/> + </Unit1> + <Unit2> + <Filename Value="bebiffgrid.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="beBIFFGrid"/> + </Unit2> + <Unit3> + <Filename Value="bebiffutils.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="bebiffutils"/> + </Unit3> + <Unit4> + <Filename Value="behtml.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="behtml"/> + </Unit4> + <Unit5> + <Filename Value="bemain.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="MainForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="beMain"/> + </Unit5> + <Unit6> + <Filename Value="beutils.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="beUtils"/> + </Unit6> + <Unit7> + <Filename Value="mrumanager.pp"/> + <IsPartOfProject Value="True"/> + <UnitName Value="mrumanager"/> + </Unit7> + <Unit8> + <Filename Value="bemain.lfm"/> + <IsPartOfProject Value="True"/> + </Unit8> + <Unit9> + <Filename Value="beabout.lfm"/> + <IsPartOfProject Value="True"/> + </Unit9> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <OtherUnitFiles Value="mrumenu"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <CodeGeneration> + <SmartLinkUnit Value="True"/> + <Optimizations> + <OptimizationLevel Value="3"/> + </Optimizations> + </CodeGeneration> + <Linking> + <Debugging> + <GenerateDebugInfo Value="False"/> + </Debugging> + <LinkSmart Value="True"/> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CompilerMessages> + <MsgFileName Value=""/> + </CompilerMessages> + <CustomOptions Value="-duse_new_ole"/> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/components/fpspreadsheet/reference/BIFFExplorer/BIFFExplorer.lpr b/components/fpspreadsheet/reference/BIFFExplorer/BIFFExplorer.lpr new file mode 100644 index 000000000..0405991f8 --- /dev/null +++ b/components/fpspreadsheet/reference/BIFFExplorer/BIFFExplorer.lpr @@ -0,0 +1,22 @@ +program BIFFExplorer; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms, virtualtreeview_package, laz_fpspreadsheet, beabout, bebiffgrid, + bebiffutils, behtml, beutils, mrumanager, beMain; + +{$R *.res} + +begin + RequireDerivedFormResource := True; + Application.Initialize; + Application.CreateForm(TMainForm, MainForm); + MainForm.BeforeRun; + Application.Run; +end. + diff --git a/components/fpspreadsheet/reference/BIFFExplorer/BIFFExplorer.res b/components/fpspreadsheet/reference/BIFFExplorer/BIFFExplorer.res new file mode 100644 index 000000000..abecf2329 Binary files /dev/null and b/components/fpspreadsheet/reference/BIFFExplorer/BIFFExplorer.res differ diff --git a/components/fpspreadsheet/reference/BIFFExplorer/beabout.lfm b/components/fpspreadsheet/reference/BIFFExplorer/beabout.lfm new file mode 100644 index 000000000..f386fc606 --- /dev/null +++ b/components/fpspreadsheet/reference/BIFFExplorer/beabout.lfm @@ -0,0 +1,85 @@ +object AboutForm: TAboutForm + Left = 338 + Height = 512 + Top = 153 + Width = 642 + Caption = 'About BIFF Explorer' + ClientHeight = 512 + ClientWidth = 642 + Color = clWindow + OnCreate = FormCreate + Position = poMainFormCenter + LCLVersion = '1.3' + object Panel1: TPanel + Left = 0 + Height = 66 + Top = 0 + Width = 642 + Align = alTop + BevelOuter = bvNone + ClientHeight = 66 + ClientWidth = 642 + Color = clWindow + ParentColor = False + TabOrder = 0 + object IconImage: TImage + Left = 7 + Height = 48 + Top = 8 + Width = 48 + end + object LblTitle: TLabel + Left = 69 + Height = 29 + Top = 16 + Width = 158 + Caption = 'BIFF Explorer' + Font.CharSet = ANSI_CHARSET + Font.Color = clNavy + Font.Height = -24 + Font.Name = 'Arial' + Font.Pitch = fpVariable + Font.Quality = fqDraft + Font.Style = [fsBold] + ParentColor = False + ParentFont = False + end + object BtnClose: TButton + Left = 559 + Height = 29 + Top = 16 + Width = 75 + Anchors = [akTop, akRight] + Cancel = True + Caption = 'Close' + Default = True + ModalResult = 1 + TabOrder = 0 + end + end + object Bevel1: TBevel + Left = 0 + Height = 6 + Top = 66 + Width = 642 + Align = alTop + Shape = bsTopLine + end + object HTMLViewer: TIpHtmlPanel + Left = 0 + Height = 440 + Top = 72 + Width = 642 + Align = alClient + FixedTypeface = 'Courier New' + DefaultTypeFace = 'default' + DefaultFontSize = 9 + FlagErrors = False + PrintSettings.MarginLeft = 0.5 + PrintSettings.MarginTop = 0.5 + PrintSettings.MarginRight = 0.5 + PrintSettings.MarginBottom = 0.5 + TabOrder = 1 + OnHotClick = HTMLViewerHotClick + end +end diff --git a/components/fpspreadsheet/reference/BIFFExplorer/beabout.pas b/components/fpspreadsheet/reference/BIFFExplorer/beabout.pas new file mode 100644 index 000000000..d482482bf --- /dev/null +++ b/components/fpspreadsheet/reference/BIFFExplorer/beabout.pas @@ -0,0 +1,141 @@ +unit beAbout; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, IpHtml, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, + ExtCtrls, StdCtrls; + +type + + { TAboutForm } + + TAboutForm = class(TForm) + Bevel1: TBevel; + BtnClose: TButton; + IconImage: TImage; + HTMLViewer: TIpHtmlPanel; + LblTitle: TLabel; + Panel1: TPanel; + procedure FormCreate(Sender: TObject); + procedure HTMLViewerHotClick(Sender: TObject); + private + { private declarations } + function CreateCredits: String; + public + { public declarations } + end; + +var + AboutForm: TAboutForm; + +implementation + +{$R *.lfm} + +uses + LCLIntf, types, beHTML; + +{ TAboutForm } + +function TAboutForm.CreateCredits: String; +var + html: THTMLDocument; + clrs: THeaderColors = (clBlack, clBlack, clBlack, clBlack, clBlack); +begin + html := THTMLDocument.Create; + try + clrs[h3] := LblTitle.Font.Color; + clrs[h4] := LblTitle.Font.Color; + with html do begin + BeginDocument('Credits', clrs, false); + AddHeader(h3, 'Credits'); + AddHeader(h4, 'Libraries'); + BeginBulletList; + AddListItem(Hyperlink( + 'Free Pascal', + 'www.freepascal.org') + ); + AddListItem(Hyperlink( + 'Lazarus', + 'www.lazarus.freepascal.org') + ); + AddListItem(HyperLink( + 'fpspreadsheet', + 'http://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/fpspreadsheet/') + ); + EndBulletList; + + AddEmptyLine; + + AddHeader(h4, 'Icons'); + BeginBulletList; + AddListItem(HyperLink( + 'Fugue icons', + 'http://p.yusukekamiyamane.com/') + + ' (for toolbar icons)'); + AddListItem(HyperLink( + 'Nuvola icons', + 'www.icon-king.com/projects/nuvola/') + + ' (for application icon'); + EndBulletList; + + AddEmptyLine; + + AddHeader(h4, 'Used documentation'); + BeginBulletList; + AddListItem(Hyperlink( + 'OpenOffice.org''s Documentation of the Microsoft Excel File Format', + 'http://www.openoffice.org/sc/excelfileformat.pdf') + + ' (see folder "fpspreadsheet/reference")' + ); + AddListItem(Hyperlink( + '[MS-XLS]: Excel Binary File Format (.xls) Structure', + 'http://msdn.microsoft.com/en-us/library/cc313154%28v=office.12%29.aspx' + )); + AddListItem(HyperLink( + 'Excel97-2007BinaryFileFormat(xls)Specification', + 'http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/Excel97-2007BinaryFileFormat(xls)Specification.pdf' + )); + EndBulletList; + + EndDocument; + + Result := Lines.Text; + end; + finally + html.Free; + end; +end; + + +procedure TAboutForm.FormCreate(Sender: TObject); +var + ico: TIcon; + sz: TSize; +begin + ico := TIcon.Create; + try + ico.Assign(Application.Icon); + sz.cx := 48; + sz.cy := 48; + ico.Current := ico.GetBestIndexForSize(sz); + IconImage.Picture.Assign(ico); + finally + ico.Free; + end; + + HTMLViewer.SetHTMLFromStr(CreateCredits); +end; + + +procedure TAboutForm.HTMLViewerHotClick(Sender: TObject); +begin + OpenURL(HTMLViewer.HotURL); +end; + + +end. + diff --git a/components/fpspreadsheet/reference/BIFFExplorer/bebiffgrid.pas b/components/fpspreadsheet/reference/BIFFExplorer/bebiffgrid.pas new file mode 100644 index 000000000..d6affa9fe --- /dev/null +++ b/components/fpspreadsheet/reference/BIFFExplorer/bebiffgrid.pas @@ -0,0 +1,3469 @@ +unit beBIFFGrid; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, Controls, Grids, fpspreadsheet; + +type + TBIFFBuffer = array of byte; + + TBIFFDetailsEvent = procedure(Sender: TObject; ADetails: TStrings) of object; + + TBIFFGrid = class(TStringGrid) + private + FRecType: Word; + FBuffer: TBIFFBuffer; + FBufferIndex: LongWord; + FFormat: TsSpreadsheetFormat; + FCurrRow: Integer; + FDetails: TStrings; + FOnDetails: TBIFFDetailsEvent; + function GetStringType: String; + + procedure ShowBackup; + procedure ShowBOF; + procedure ShowBookBool; + procedure ShowBottomMargin; + procedure ShowCalcCount; + procedure ShowCalcMode; + procedure ShowClrtClient; + procedure ShowCodePage; + procedure ShowCountry; + procedure ShowDateMode; + procedure ShowDefColWidth; + procedure ShowDefRowHeight; + procedure ShowDelta; + procedure ShowDimensions; + procedure ShowDSF; + procedure ShowEOF; + procedure ShowExcel9File; + procedure ShowFileSharing; + procedure ShowFnGroupCount; + procedure ShowFont; + procedure ShowFooter; + procedure ShowFormat; + procedure ShowFormula; + procedure ShowHeader; + procedure ShowHideObj; + procedure ShowInteger; + procedure ShowInterfaceEnd; + procedure ShowInterfaceHdr; + procedure ShowIteration; + procedure ShowLabelCell; + procedure ShowLabelSSTCell; + procedure ShowLeftMargin; + procedure ShowMMS; + procedure ShowNumberCell; + procedure ShowPalette; + procedure ShowPassword; + procedure ShowPrecision; + procedure ShowPrintGridLines; + procedure ShowPrintHeaders; + procedure ShowProt4Rev; + procedure ShowProt4RevPass; + procedure ShowProtect; + procedure ShowRecalc; + procedure ShowRefMode; + procedure ShowRefreshAll; + procedure ShowRightMargin; + procedure ShowRK; + procedure ShowRow; + procedure ShowSelection; + procedure ShowSheet; + procedure ShowSST; + procedure ShowString; + procedure ShowStyle; + procedure ShowStyleExt; + procedure ShowTabID; + procedure ShowTopMargin; + procedure ShowWindow1; + procedure ShowWindow2; + procedure ShowWindowProtect; + procedure ShowWriteAccess; + procedure ShowWriteProt; + procedure ShowXF; + procedure ShowXFCRC; + procedure ShowXFEXT; + + protected + procedure Click; override; + procedure DoExtractDetails; + procedure ExtractString(ABufIndex: Integer; ALenBytes: Byte; AUnicode: Boolean; + out AString: String; out ANumBytes: Integer; IgnoreCompressedFlag: Boolean = false); + procedure PopulateGrid; + procedure ShowInRow(var ARow: Integer; var AOffs: LongWord; ASize: Word; AValue,ADescr: String); + procedure ShowRowColData(var ABufIndex: LongWord); + + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure SetRecordType(ARecType: Word; ABuffer: TBIFFBuffer; AFormat: TsSpreadsheetFormat); + + published + property OnDetails: TBIFFDetailsEvent read FOnDetails write FOnDetails; + end; + +implementation + +uses + StrUtils, Math, + fpsutils, + beBIFFUtils; + +constructor TBIFFGrid.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + ColCount := 4; + FixedCols := 0; + RowCount := 2; + Cells[0, 0] := 'Offset'; + Cells[1, 0] := 'Size'; + Cells[2, 0] := 'Value'; + Cells[3, 0] := 'Description'; + ColWidths[0] := 60; + ColWidths[1] := 60; + ColWidths[2] := 120; + ColWidths[3] := 350; + Options := Options + [goThumbTracking, goColSizing, goTruncCellHints, goCellHints] - [goVertLine]; + FDetails := TStringList.Create; +end; + + +destructor TBIFFGrid.Destroy; +begin + FDetails.Free; + inherited; +end; + + +procedure TBIFFGrid.Click; +begin + inherited; + if (FBuffer <> nil) then + DoExtractDetails; +end; + + +procedure TBIFFGrid.DoExtractDetails; +begin + if Assigned(FOnDetails) then begin + PopulateGrid; + FOnDetails(self, FDetails); + end; +end; + + +procedure TBIFFGrid.ExtractString(ABufIndex: Integer; ALenBytes: Byte; AUnicode: Boolean; + out AString: String; out ANumBytes: Integer; IgnoreCompressedFlag: Boolean = false); +var + ls: Integer; + sa: ansiString; + sw: WideString; + w: Word; + optn: Byte; +begin + if Length(FBuffer) = 0 then begin + AString := ''; + ANumBytes := 0; + exit; + end; + if ALenBytes = 1 then + ls := FBuffer[ABufIndex] + else begin + Move(FBuffer[ABufIndex], w, 2); + ls := WordLEToN(w); + end; + if AUnicode then begin + optn := FBuffer[ABufIndex + ALenBytes]; + if (optn and $01 = 0) and (not IgnoreCompressedFlag) + then begin // compressed --> 1 byte per character + SetLength(sa, ls); + ANumbytes := ls*SizeOf(AnsiChar) + ALenBytes + 1; + Move(FBuffer[ABufIndex + ALenBytes + 1], sa[1], ls*SizeOf(AnsiChar)); + AString := sa; + end else begin + SetLength(sw, ls); + ANumBytes := ls*SizeOf(WideChar) + ALenBytes + 1; + Move(FBuffer[ABufIndex + ALenBytes + 1], sw[1], ls*SizeOf(WideChar)); + AString := UTF8Encode(WideStringLEToN(sw)); + end; + end else begin + SetLength(sa, ls); + ANumBytes := ls*SizeOf(AnsiChar) + ALenBytes; + Move(FBuffer[ABufIndex + ALenBytes], sa[1], ls*SizeOf(AnsiChar)); + AString := sa; + end; +end; + + +function TBIFFGrid.GetStringType: String; +begin + case FFormat of + sfExcel2: Result := 'Byte'; + sfExcel5: Result := 'Byte'; + sfExcel8: Result := 'Unicode'; + end; +end; + + +procedure TBIFFGrid.PopulateGrid; +begin + FBufferIndex := 0; + FCurrRow := FixedRows; + FDetails.Clear; + case FRecType of + $0000, $0200: + ShowDimensions; + $0002: + ShowInteger; + $0003, $0203: + ShowNumberCell; + $0004, $0204: + ShowLabelCell; + $0006: + ShowFormula; + $0007, $0207: + ShowString; + $0008, $0208: + ShowRow; + $0009, $0209, $0409, $0809: + ShowBOF; + $000A: + ShowEOF; + $000C: + ShowCalcCount; + $000D: + ShowCalcMode; + $000E: + ShowPrecision; + $000F: + ShowRefMode; + $0010: + ShowDelta; + $0011: + ShowIteration; + $0012: + ShowProtect; + $0013: + ShowPassword; + $0014: + ShowHeader; + $0015: + ShowFooter; + $0019: + ShowWindowProtect; + $001D: + ShowSelection; + $001E, $041E: + ShowFormat; + $0022: + ShowDateMode; + $0025, $0225: + ShowDefRowHeight; + $0026: + ShowLeftMargin; + $0027: + ShowRightMargin; + $0028: + ShowTopMargin; + $0029: + ShowBottomMargin; + $002A: + ShowPrintHeaders; + $002B: + ShowPrintGridLines; + $0031: + ShowFont; + $003D: + ShowWindow1; + $003E, $023E: + ShowWindow2; + $0040: + ShowBackup; + $0042: + ShowCodePage; + $0043: + ShowXF; + $0055: + ShowDefColWidth; + $005B: + ShowFileSharing; + $005C: + ShowWriteAccess; + $005F: + ShowRecalc; + $0085: + ShowSheet; + $0086: + ShowWriteProt; + $008C: + ShowCountry; + $008D: + ShowHideObj; + $0092: + ShowPalette; + $00C1: + ShowMMS; + $009C: + ShowFnGroupCount; + $00DA: + ShowBookBool; + $00E0: + ShowXF; + $00E1: + ShowInterfaceHdr; + $00E2: + ShowInterfaceEnd; + $00FC: + ShowSST; + $00FD: + ShowLabelSSTCell; + $013D: + ShowTabID; + $0161: + ShowDSF; + $01AF: + ShowProt4Rev; + $01B7: + ShowRefreshAll; + $01BC: + ShowProt4RevPass; + $01C0: + ShowExcel9File; + $027E: + ShowRK; + $0293: + ShowStyle; + $087C: + ShowXFCRC; + $087D: + ShowXFEXT; + $0892: + ShowStyleExt; + $105C: + ShowClrtClient; + else + RowCount := 2; + Rows[1].Clear; + end; +end; + + +procedure TBIFFGrid.SetRecordType(ARecType: Word; ABuffer: TBIFFBuffer; + AFormat: TsSpreadsheetFormat); +begin + FFormat := AFormat; + FRecType := ARecType; + SetLength(FBuffer, Length(ABuffer)); + if Length(FBuffer) > 0 then + Move(ABuffer[0], FBuffer[0], Length(FBuffer)); + PopulateGrid; + if Assigned(FOnDetails) then FOnDetails(self, FDetails); +end; + + +procedure TBIFFGrid.ShowBackup; +var + numBytes: Integer; + w: Word; +begin + RowCount := FixedRows + 1; + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Save backup copy of workbook:'#13); + if w = 0 + then FDetails.Add('0 = no backup') + else FDetails.Add('1 = backup copy is saved when workbook is saved'); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.4x', [w]), + 'Save backup copy of workbook'); +end; + + +procedure TBIFFGrid.ShowBOF; +var + numBytes: Integer; + w: Word; + s: String; +begin + case FFormat of + sfExcel2: RowCount := FixedRows + 2; + sfExcel5: RowCount := FixedRows + 4; + sfExcel8: RowCount := FixedRows + 6; + end; + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('BIFF version:'#13); + case w of + $0000: FDetails.Add('$0000 = BIFF5'); + $0200: FDetails.Add('$0200 = BIFF2'); + $0300: FDetails.Add('$0300 = BIFF3'); + $0400: FDetails.Add('$0400 = BIFF4'); + $0500: FDetails.Add('$0500 = BIFF5'); + $0600: FDetails.Add('$0600 = BIFF8'); + end; + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.4x', [w]), + 'BIFF version ($0500=BIFF5, $0600=BIFF8)'); + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + s := '$0010=Sheet, $0020=Chart, $0040=Macro sheet'; + if FFormat > sfExcel2 then + s := '$0005=WB globals, $0006=VB module, ' + s + ', $0100=Workspace'; + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Type of data:'); + FDetails.Add(Format('$%.4x = %s', [w, BofName(w)])); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.4x', [w]), + Format('Type of data (%s)', [s])); + + if FFormat > sfExcel2 then begin + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Build identifier (must not be zero)'); + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Build year (must not be zero)'); + end; + + if FFormat = sfExcel8 then begin + numBytes := 4; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'File history flags'); + + numBytes :=4; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Lowest Excel version that can read all records of this file'); + end; +end; + + +procedure TBIFFGrid.ShowBookBool; +var + numbytes: Integer; + w: Word; +begin + RowCount := FixedRows + 1; + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Some properties assosciated with notebook:'#13); + if w and $0001 = 0 + then FDetails.Add('Bit 0 = 0: External link values are saved.') + else FDetails.Add('Bit 0 = 1: External link values are NOT saved.'); + FDetails.Add('Bit 1: to be ignored'); + if w and $0004 = 0 + then FDetails.Add('Bit 2 = 0: Workbook does not have a mail envelope') + else FDetails.Add('Bit 2 = 1: Workbook has a mail envelope'); + if w and $0008 = 0 + then FDetails.Add('Bit 3 = 0: Mail envelope is NOT visible.') + else FDetails.Add('Bit 3 = 1: Mail envelope is visible.'); + if w and $0010 = 0 + then FDetails.Add('Bit 4 = 0: Mail envelope has NOT been initialized.') + else FDetails.Add('Bit 4 = 1: Mail envelope has been initialized.'); + case (w and $0060) shr 5 of + 0: FDetails.Add('Bits 5-6 (Update external links) = 0: Prompt user to update'); + 1: FDetails.Add('Bits 5-6 (Update external linls) = 1: Do not update, and do not prompt user.'); + 2: FDetails.Add('Bits 5-6 (Update external links) = 2: Silently update external links.'); + end; + FDetails.Add('Bit 7: undefined, must be ignored'); + if w and $0100 = 0 + then FDetails.Add('Bit 8 = 0: Do not hide borders of tables that do not contain the active cell') + else FDetails.Add('Bit 8 = 1: Hide borders of tables that do not contain the active cell'); + FDetails.Add('Bits 9-15: MUST BE zero, MUST be ignored'); + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.4x', [w]), + 'Specifies some properties assosciated with a workbook'); +end; + +procedure TBIFFGrid.ShowBottomMargin; +var + numBytes: Integer; + dbl: Double; +begin + RowCount := FixedRows + 1; + numBytes := 8; + Move(FBuffer[FBufferIndex], dbl, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, FloatToStr(dbl), + 'Bottom page margin in inches (IEEE 754 floating-point value, 64-bit double precision)'); +end; + + +procedure TBIFFGrid.ShowCalcCount; +var + numBytes: Word; + w: Word; +begin + RowCount := FixedRows + 1; + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), + 'Maximum number of iterations allowed in circular references'); +end; + + +procedure TBIFFGrid.ShowCalcMode; +var + numBytes: Word; + w: word; + s: String; +begin + RowCount := FixedRows + 1; + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if w = $FFFF then + s := '–1 = automatically except for multiple table operations' + else if w = 0 then + s := '0 = manually' + else if w = 1 then + s := '1 = automatically (default)'; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.4x)', [w, w]), s); +end; + + +procedure TBIFFGrid.ShowClrtClient; +var + w: Word; + dw: DWord; + numbytes: Word; +begin + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + + RowCount := FixedRows + w + 1; + + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), 'Number of colors (must be 3)'); + + numBytes := 4; + Move(FBuffer[FBufferIndex], dw, numbytes); + dw := DWordLEToN(dw); + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.8x', [dw]), + 'Foreground color (system window text color)'); + Move(FBuffer[FBufferIndex], dw, numbytes); + dw := DWordLEToN(dw); + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.8x', [dw]), + 'Background color (system window color)'); + Move(FBuffer[FBufferIndex], dw, numbytes); + dw := DWordLEToN(dw); + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.8x', [dw]), '???'); +end; + + +procedure TBIFFGrid.ShowCodePage; +var + numBytes: Word; + w: Word; + s: String; +begin + RowCount := FixedRows + 1; + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + s := CodePageName(w); + if Row = FCurrRow then begin + FDetails.Add('Code page:'); + FDetails.Add(Format('$%.04x = %s', [w, s])); + end; + if s <> '' then s := 'Code page identifier (' + s + ')' else s := 'Code page identifier'; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.4x)', [w, w]), s); +end; + + +procedure TBIFFGrid.ShowCountry; +var + numBytes: Integer; + w: Word; +begin + RowCount := FixedRows + 2; + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Windows country identifier for UI language of Excel'); + + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Windows country identifier of system regional settings'); +end; + + +procedure TBIFFGrid.ShowDateMode; +var + numBytes: Integer; + w: Word; +begin + RowCount := FixedRows + 1; + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), + '0 = Base date is 1899-Dec-31, 1 = Base date is 1904-Jan-01'); +end; + +procedure TBIFFGrid.ShowDefColWidth; +var + numBytes: Integer; + w: Word; +begin + RowCount := FixedRows + 1; + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Column width in characters, using the width of the zero character from default '+ + 'font (first FONT record in the file) + some extra space.'); +end; + + +procedure TBIFFGrid.ShowDefRowHeight; +var + numBytes: Integer; + w: Word; +begin + RowCount := FixedRows + IfThen(FFormat = sfExcel2, 1, 2); + + if FFormat = sfExcel2 then begin + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Default height for unused rows'); + FDetails.Add(Format( + 'Bits $7FFF = %d: Default height for unused rows, in twips = 1/20 of a point', + [w and $7FFF])); + if w and $8000 = 0 then + FDetails.Add('Bit $8000 = 0: Row height changed manually') + else + FDetails.Add('Bit $8000 = 1: Row height not changed manually'); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.4x)', [w, w]), + 'Default height for unused rows, in twips = 1/20 of a point'); + end else begin + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Option flags'); + if w and $0001 = 0 + then FDetails.Add('Bit $0001 = 0: Row height and default font height do match') + else FDetails.Add('Bit $0001 = 1: Row height and default font height do not match'); + if w and $0002 = 0 + then FDetails.Add('Bit $0002 = 0: Row is visible') + else FDetails.Add('Bit $0002 = 1: Row is hidden'); + if w and $0004 = 0 + then FDetails.Add('Bit $0004 = 0: No additional space above the row') + else FDetails.Add('Bit $0004 = 1: Additional space above the row'); + if w and $0008 = 0 + then FDetails.Add('Bit $0008 = 0: No additional space below the row') + else FDetails.Add('Bit $0008 = 1: Additional space below the row'); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.4x', [WordLEToN(w)]), + 'Option flags'); + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Default height for unused rows, in twips = 1/20 of a point'); + end; +end; + + +procedure TBIFFGrid.ShowDelta; +var + numBytes: Integer; + dbl: Double; +begin + RowCount := FixedRows + 1; + numBytes := 8; + Move(FBuffer[FBufferIndex], dbl, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, FloatToStr(dbl), + 'Maximum change in iteration (IEEE 754 floating-point value, 64-bit double precision)'); +end; + + +procedure TBIFFGrid.ShowDimensions; +var + numBytes: Integer; + dw: DWord; + w: Word; +begin + RowCount := FixedRows + IfThen(FFormat = sfExcel2, 4, 5); + + if FFormat = sfExcel8 then begin + numBytes := 4; + Move(FBuffer[FBufferIndex], dw, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(DWordLEToN(dw)), + 'Index to first used row'); + + numBytes := 4; + Move(FBuffer[FBufferIndex], dw, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(DWordLEToN(dw)), + 'Index to last used row, increased by 1'); + end else begin + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Index to first used row'); + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Index to last used row, increased by 1'); + end; + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Index to first used column'); + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Index to last used column, increased by 1'); + + numBytes := 2; + ShowInRow(FCurrRow, FBufferIndex, numBytes, '', + '(not used)'); +end; + + +procedure TBIFFGrid.ShowDSF; +var + w: Word; + numbytes: Integer; +begin + RowCount := FixedRows + 1; + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(w), 'Reserved, MUST be ignored'); +end; + + +procedure TBIFFGrid.ShowEOF; +begin + RowCount := FixedRows + 1; + ShowInRow(FCurrRow, FBufferIndex, 0, '', '(no content)'); +end; + + +procedure TBIFFGrid.ShowExcel9File; +begin + RowCount := FixedRows + 1; + ShowInRow(FCurrRow, FBufferIndex, 0, '', 'Optional and unused'); +end; + + +procedure TBIFFGrid.ShowFileSharing; +var + numbytes: Integer; + w: Word; + s: String; +begin + RowCount := FixedRows + 3; + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Recommend read-only state when loading the file:'#13); + if w = 0 then FDetails.Add('0 = no') else FDetails.Add('1 = yes'); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), + 'Recommend read-only state when loading the file'); + + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.4x', [w]), + 'Hash value calculated from the read-only password'); + + ExtractString(FBufferIndex, IfThen(FFormat=sfExcel8, 2, 1), FFormat=sfExcel8, + s, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, s, + 'User name of the file creator' + IfThen(FFormat = sfExcel8, + ' (Unicode string, 16-bit string length)', + ' (byte string, 8-bit string length)' + )); +end; + + +procedure TBIFFGrid.ShowFnGroupCount; +var + numbytes: Integer; + w: Word; +begin + RowCount := FixedRows + 1; + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Number of built-in function categories:'#13); + case w of + $000E: + FDetails.Add( + 'There are 14 built-in function categories in the workbook.'#13+ + 'This implies that the file was last saved by a specific version of the application.'#13+ + 'The following 9 built-in function categories are visible to the end-user:'#13+ + ' Financial'#13+ + ' Date & Time'#13+ + ' Math & Trig'#13+ + ' Statistical'#13+ + ' Lookup & Reference'#13+ + ' Database'#13+ + ' Text'#13+ + ' Logical'#13+ + ' Information'#13+ + 'The following 5 built-in function categories are not visible to the end-user:'#13+ + ' UserDefined'#13+ + ' Commands'#13+ + ' Customize'#13+ + ' MacroControl'#13+ + ' DDEExternal' + ); + $0010: + FDetails.Add( + 'There are 16 built-in function categories in the workbook.'#13+ + 'This implies that the file was last saved by a specific version of the application'#13+ + 'The following 11 built-in function categories are visible to the end-user:'#13+ + ' Financial'#13+ + ' Date & time'#13+ + ' Math & Trig'#13+ + ' Statistical'#13+ + ' Lookup & Reference'+ + ' Database'#13+ + ' Text'#13+ + ' Logical'#13+ + ' Information'#13+ + ' Engineering'#13+ + ' Cube'#13+ + 'The following 5 built-in function categories are not visible to the end-user:'#13+ + ' UserDefined'#13+ + ' Commands'#13+ + ' Customize'#13+ + ' MacroControl'#13+ + ' DDEExternal' + ); + end; + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(w), + 'Number of built-in function categories'); +end; + + +procedure TBIFFGrid.ShowFont; +var + numbytes: Integer; + w: Word; + b: Byte; + s: String; +begin + RowCount := IfThen(FFormat = sfExcel2, 3, 10) + FixedRows; + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(w), + 'Font height in twips (=1/20 point)'); + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Option flags:'#13); + if w and $0001 = 0 + then FDetails.Add('Bit $0001 = 0: not bold') + else FDetails.Add('Bit $0001 = 1: bold (redundant in BIFF5-BIFF8)'); + if w and $0002 = 0 + then FDetails.Add('Bit $0002 = 0: not italic') + else FDetails.Add('Bit $0002 = 1: italic'); + if w and $0004 = 0 + then FDetails.Add('Bit $0004 = 0: not underlined') + else FDetails.Add('Bit $0004 = 1: underlined (redundant in BIFF5-BIFF8)'); + if w and $0008 = 0 + then FDetails.Add('Bit $0008 = 0: not struck out') + else FDetails.Add('Bit $0008 = 1: struck out'); + if w and $0010 = 0 + then FDetails.Add('Bit $0010 = 0: not outlined') + else FDetails.Add('Bit $0010 = 1: outlined'); + if w and $0020 = 0 + then FDetails.Add('Bit $0020 = 0: not shadowed') + else FDetails.Add('Bit $0020 = 1: shadowed'); + if w and $0040 = 0 + then FDetails.Add('Bit $0040 = 0: not condensed') + else FDetails.Add('Bit $0040 = 1: condensed'); + if w and $0080 = 0 + then FDetails.Add('Bit $0080 = 0: not extended') + else FDetails.Add('Bit $0080 = 1: extended'); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.4x)', [w, w]), + 'Option flags'); + + if FFormat <> sfExcel2 then begin + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(2), 'Color index'); + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.4x)', [w,w]), + 'Font weight (400=normal, 700=bold)'); + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Escapement:'#13); + case w of + 0: FDetails.Add('0 = none'); + 1: FDetails.Add('1 = superscript'); + 2: FDetails.Add('2 = subscript'); + end; + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.4x', [w]), + 'Escapement ($00=none, $01=superscript, $02=subscript)'); + + numBytes := 1; + Move(FBuffer[FBufferIndex], b, numBytes); + if Row = FCurrRow then begin + FDetails.Add('Underline type:'#13); + case b of + $00: FDetails.Add('$00 = no underline'); + $01: FDetails.Add('$01 = single underline'); + $02: FDetails.Add('$02 = double underline'); + $21: FDetails.Add('$21 = single accounting'); + $22: FDetails.Add('$22 = double accounting'); + end; + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [b]), + 'Underline type ($00=none, $01=single, $02=double, ...)'); + + numBytes := 1; + Move(FBuffer[FBufferIndex], b, numBytes); + if Row = FCurrRow then begin + FDetails.Add('Font family:'#13); + case b of + $00: FDetails.Add('$00 = None (unknown or don''t care)'); + $01: FDetails.Add('$01 = Roman (variable width, serifed)'); + $02: FDetails.Add('$02 = Swiss (variable width, sans-serifed)'); + $03: FDetails.Add('$03 = Modern (fixed width, serifed or sans-serifed)'); + $04: FDetails.Add('$04 = Script (cursive)'); + $05: FDetails.Add('$05 = Decorative (specialised, for example Old English, Fraktur)'); + end; + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%.2x', [b]), + 'Font family'); + + numBytes := 1; + Move(FBuffer[FBufferIndex], b, numBytes); + case b of + $00: s := 'ANSI Latin'; + $01: s := 'System default'; + $02: s := 'Symbol'; + $4D: s := 'Apple Roman'; + $80: s := 'ANSI Japanese Shift-JIS'; + $81: s := 'ANSI Korean (Hangul)'; + $82: s := 'ANSI Korean (Johab)'; + $86: s := 'ANSI Chinese Simplified GBK'; + $88: s := 'ANSI Chinese Traditional BIG5'; + $A1: s := 'ANSI Greek'; + $A2: s := 'ANSI Turkish'; + $A3: s := 'ANSI Vietnamese'; + $B1: s := 'ANSI Hebrew'; + $B2: s := 'ANSI Arabic'; + $BA: s := 'ANSI Baltic'; + $CC: s := 'ANSI Cyrillic'; + $DE: s := 'ANSI Thai'; + $EE: s := 'ANSI Latin II (Central European)'; // East Europe in MS docs! + $FF: s := 'OEM Latin I'; + else s := ''; + end; + if s <> '' then s := Format('$%.2x: %s', [b, s]) else s := Format('$%.2x', [b]); + ShowInRow(FCurrRow, FBufferIndex, numBytes, s, + 'Character set'); + + numBytes := 1; + Move(FBuffer[FBufferIndex], b, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, '', 'Not used'); + end; + + ExtractString(FBufferIndex, 1, FFormat=sfExcel8, s, numbytes); + if FFormat = sfExcel8 then + ShowInRow(FCurrRow, FBufferIndex, numbytes, s, 'Font name (unicode string, 8-bit string length)') + else + ShowInRow(FCurrRow, FBufferIndex, numbytes, s, 'Font name (byte string, 8-bit string length)'); +end; + + +procedure TBIFFGrid.ShowFooter; +var + numbytes: Integer; + s: String; +begin + RowCount := FixedRows + 1; + ExtractString(FBufferIndex, IfThen(FFormat=sfExcel8, 2, 1), FFormat=sfExcel8, + s, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, s, + 'Page footer string' + IfThen(FFormat = sfExcel8, + ' (Unicode string, 16-bit string length)', + ' (byte string, 8-bit string length)' + )); +end; + + +procedure TBIFFGrid.ShowFormat; +var + numBytes: Integer; + w: word; + b: Byte; + s: String; +begin + RowCount := IfThen(FFormat = sfExcel2, FixedRows + 1, FixedRows + 2); + if FFormat <> sfExcel2 then begin + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(w), + 'FormatIndex used in other records'); + end; + b := IfThen(FFormat=sfExcel8, 2, 1); + ExtractString(FBufferIndex, b, (FFormat=sfExcel8), s, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, s, + Format('Number format string (%s string, %d-bit string length)', [GetStringType, b*8])); +end; + + +procedure TBIFFGrid.ShowFormula; +const + ABS_REL: array[boolean] of string = ('abs', 'rel'); +var + numBytes: Integer; + b: Byte; + w: Word; + q: QWord; + dbl: double absolute q; + s: String; + tokenBytes: Integer; + firstTokenBufIdx: Integer; + token: Byte; + r,c, r2,c2: Integer; +begin + BeginUpdate; + RowCount := FixedRows + 1000; + // Brute force simplification because of unknown row count at this point + // Will be reduced at the end. + + // Offset 0 = Row, Offset 2 = Column + ShowRowColData(FBufferIndex); + // Offset 4 = Cell attributes (BIFF2) or XF ecord index (> BIFF2) + if FFormat = sfExcel2 then begin + numBytes := 1; + Move(FBuffer[FBufferIndex], b, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), + 'Cell protection and XF index'); + + numBytes := 1; + Move(FBuffer[FBufferIndex], b, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), + 'Indexes of format and font records'); + + numBytes := 1; + Move(FBuffer[FBufferIndex], b, numBytes); + 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; + // Offset 6: Result of formula + numBytes := 8; + Move(FBuffer[FBufferIndex], q, numBytes); + if (FFormat > sfExcel2) then + case FBuffer[FBufferIndex] of + 0: begin + if FCurrRow = Row then begin + FDetails.Add('Formula result:'#13); + FDetails.Add('Byte 0 = 0 --> Result is string, follows in STRING record'); + FDetails.Add('Bytes 1-5: Not used'); + FDetails.Add('Bytes 6&7: Must be $FFFF'); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.16x', [q]), + 'Result is STRING, follows in STRING record'); + end; + 1: if FBuffer[FBufferIndex + 2] = 0 then + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.16x', [q]), + 'Result is BOOL (FALSE)') + else + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.16x', [q]), + 'Result is BOOL (TRUE)'); + 2: begin + if FCurrRow = Row then begin + FDetails.Add('Formula result:'#13); + FDetails.Add('Byte 0 = 2 --> Token contains an ERROR code'); + FDetails.Add('Byte 1: not used'); + FDetails.Add(Format('Byte 2 = %d ($%.2x): "%s"', [ + FBuffer[FBufferIndex + 2], + FBuffer[FBufferIndex + 2], + ErrorCodeName(FBufferIndex + 2) + ])); + FDetails.Add('Bytes 2-5: not used'); + FDetails.Add('Bytes 6&7: Must be $FFFF'); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.16x', [q]), + Format('Result is ERROR code $%.2x', [FBuffer[FBufferIndex+2]])); + end; + 3: ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$.16x', [q]), + 'Result is EMPTY cell'); + else + ShowInRow(FCurrRow, FBufferIndex, numBytes, FloatToStr(dbl), + 'Result of formula (IEEE 764 floating-point value, 64-bit double precision)'); + end + else begin + ShowInRow(FCurrRow, FBufferIndex, numBytes, FloatToStr(dbl), + 'Result of formula (IEEE 764 floating-point value, 64-bit double precision)'); + end; + + // Option flags + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Option flags:'#13); + if w and $0001 = 0 + then FDetails.Add('Bit $0001 = 0: Don''t recalculate') + else FDetails.Add('Bit $0001 = 1: Recalculate always'); + FDetails.Add('Bit $0002: Reserved - MUST be zero, MUST be ignored'); + if w and $0004 = 0 + then FDetails.Add('Bit $0004 = 0: Cell does NOT have a fill alignment or a center-across-selection alignment.') + else FDetails.Add('Bit $0004 = 1: Cell has either a fill alignment or a center-across-selection alignment.'); + if w and $0008 = 0 + then FDetails.Add('Bit $0008 = 0: Formula is NOT part of a shared formula') + else FDetails.Add('Bit $0008 = 1: Formula is part of a shared formula'); + FDetails.Add('Bit $0010: Reserved - MUST be zero, MUST be ignored'); + if w and $0020 = 0 + then FDetails.Add('Bit $0020 = 0: Formula is NOT excluded from formula error checking') + else FDetails.Add('Bit $0020 = 1: Formula is excluded from formula error checking'); + FDetails.Add('Bits $FC00: Reserved - MUST be zero, MUST be ignored'); + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.4x', [w]), + 'Option flags'); + + // Not used + if (FFormat >= sfExcel5) then begin + numBytes := 4; + ShowInRow(FCurrRow, FBufferIndex, numBytes, '', '(not used'); + end; + + // Size of Token array (in Bytes) + if FFormat = sfExcel2 then begin + numBytes := 1; + Move(FBuffer[FBufferIndex], b, numBytes); + tokenBytes := b; + end else begin + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + tokenBytes := WordLEToN(w); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(tokenBytes), + 'Size of formula data (in Bytes)'); + + // Tokens and parameters + firstTokenBufIdx := FBufferIndex; + while FBufferIndex < firstTokenBufIdx + tokenBytes do begin + token := FBuffer[FBufferIndex]; + numBytes := 1; + case token of + $01: begin + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.2x', [token]), + 'Token for "Cell is part of shared formula"'); + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)), + 'Index to row of first FORMULA record in the formula range'); + if FFormat = sfExcel2 then begin + numbytes := 1; + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(b), + 'Index to column of first FORMULA record in the formula range'); + end else begin + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)), + 'Index to column of first FORMULA record in the formula range'); + end; + end; + $02: begin + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.2x', [token]), + 'Token for "Cell is part of a multiple operations table"'); + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)), + 'Index to first row of the table range'); + if FFormat = sfExcel2 then begin + numbytes := 1; + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(b), + 'Index to first column of the table range'); + end else begin + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)), + 'Index to first column of the table range'); + end; + end; + $03: ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token "+" (add)'); + $04: ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token "-" (subtract)'); + $05: ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token "*" (multiply)'); + $06: ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token "/" (divide)'); + $07: ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token "^" (power)'); + $08: ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token "&" (concat)'); + $09: ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token "<" (less than)'); + $15: ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.2x', [token]), + 'Token "()" (operator in parenthesis)'); + $0A: ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token "<=" (less equal)'); + $0B: ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token "=" (equal)'); + $0C: ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token ">=" (greater equal)'); + $0D: ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token ">" (greater than)'); + $0E: ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token "<>" (not equal)'); + $0F: ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token " " (intersect)'); + $10: ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token "list character"'); + $11: ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token ":" (range)'); + $12: ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token "+" (unary plus)'); + $13: ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token "-" (unary minus)'); + $14: ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token "%" (percent)'); + $16: ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token "missing argument"'); + $17: begin + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token tSTR (Label)'); + ExtractString(FBufferIndex, 1, (FFormat = sfExcel8), s, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, s, 'String value'); + end; + $1C: begin + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token tERR (Error)'); + numBytes := 1; + b := FBuffer[FBufferIndex]; + if FCurrRow = Row then begin + FDetails.Add('Error code:'#13); + FDetails.Add(Format('Code $%.2x --> "%s"', [b, b])); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [b]), 'Error code'); + end; + $1D: begin + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token tBOOL'); + numBytes := 1; + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(b), + '0=FALSE, 1=TRUE'); + end; + $1E: begin + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token tINT (Integer)'); + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Integer value'); + end; + $1F: begin + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token tNUM (Number)'); + numBytes := 8; + Move(FBuffer[FBufferIndex], dbl, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, FloatToStr(dbl), + 'IEEE 754 floating-point value'); + end; + $20, $40, $60: + begin + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token tARRAY'); + if FFormat = sfExcel2 then numBytes := 6 else numBytes := 7; + ShowInRow(FCurrRow, FBufferIndex, numbytes, '', '(not used)'); + end; + $21, $41, $61: + begin + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token tFUNC (Function with fixed argument count)'); + if FFormat = sfExcel2 then begin + numBytes := 1; + b := FBuffer[FBufferIndex]; + s := Format('Index of function (%s)', [SheetFuncName(b)]); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(b), s); + end else begin + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + s := Format('Index of function (%s)', [SheetFuncName(w)]); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), s); + end; + end; + $22, $42, $62: + begin + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token tFUNCVAR (Function with variable argument count)'); + numBytes := 1; + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(b), + 'Number of arguments'); + if FFormat = sfExcel2 then begin + numBytes := 1; + s := Format('Index of built-in function (%s)', [SheetFuncName(b)]); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(b), s); + end else begin + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + s := Format('Index of built-in function (%s)', [SheetFuncName(w)]); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), s); + end; + end; + $23, $43, $63: + begin + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + 'Token tNAME'); + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + case FFormat of + sfExcel2: s := 'DEFINEDNAME or EXTERNALNAME record'; + sfExcel5: s := 'DEFINEDNAME record in Global Link Table'; + sfExcel8: s := 'DEFINEDNAME record in Link Table'; + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + '1-based index to '+s); + case FFormat of + sfExcel2: numBytes := 5; + sfExcel5: numBytes := 12; + sfExcel8: numBytes := 2; + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, '', '(not used)'); + end; + $24, $44, $64: + begin + case token of + $24: s := 'reference'; + $44: s := 'value'; + $64: s := 'array'; + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + Format('Token tREF (Cell %s)', [s])); + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); // row --> w + r := WordLEToN(w); + if FFormat = sfExcel8 then begin + numBytes := 2; + Move(FBuffer[FBufferIndex+2], w, numBytes); // column --w1 + c := WordLEToN(w); + if FCurrRow = Row then begin + FDetails.Add('RowIndex information:'#13); + FDetails.Add(Format('RowIndex = %d (%s)', [r, ABS_REL[c and $4000 <> 0]])); + end; + //s := Format('$%.4x (%d, %s)', [r, r, ABS_REL[c and $4000 <> 0]]); + s := Format('%d ($%.4x)', [r, r]); + ShowInRow(FCurrRow, FBufferIndex, numbytes, s, 'Row index'); + if FCurrRow = Row then begin + FDetails.Add('ColIndex information:'#13); + FDetails.Add(Format('Bits 0-13: ColIndex = %d (%s)', [c and $3FFF, ABS_REL[c and $8000 <> 0]])); + if c and $4000 = 0 + then FDetails.Add('Bit 14=0: absolute row index') + else FDetails.Add('Bit 14=1: relative row index'); + if c and $8000 = 0 + then FDetails.Add('Bit 15=0: absolute column index') + else FDetails.Add('Bit 15=1: relative column index'); + end; +// s := Format('$%.4x (%d, %s)', [c, c AND $3FFF, ABS_REL[c and $8000 <> 0]]); + s := Format('%d ($%.4x)', [c, c]); + ShowInRow(FCurrRow, FBufferIndex, numBytes, s, 'Column index'); + end else begin + numbytes := 1; + Move(FBuffer[FBufferIndex+2], b, numBytes); + c := b; + if FCurrRow = Row then begin + FDetails.Add('RowIndex information:'#13); + FDetails.Add(Format('Bits 0-13: RowIndex = %d (%s)', [r and $3FFF, ABS_REL[r and $4000 <> 0]])); + if r and $4000 = 0 + then FDetails.Add('Bit 14=0: absolute row index') + else FDetails.Add('Bit 14=1: relative row index'); + if r and $8000 = 0 + then FDetails.Add('Bit 15=0: absolute column index') + else FDetails.Add('Bit 15=1: relative column index'); + end; + //s := Format('$%.4x (%d, %s)', [r, r and $3FFF, ABS_REL[r and $4000 <> 0]]); + s := Format('%d ($%.4x)', [r, r]); + ShowInRow(FCurrRow, FBufferIndex, 2, s, 'Row index'); + if FCurrRow = Row then begin + FDetails.Add('ColIndex information:'#13); + FDetails.Add(Format('ColIndex = %d (%s)', [c, ABS_REL[r and $8000 <> 0]])); + end; + //s := Format('$%.2x (%d, %s)', [c, c, ABS_REL[r and $8000 <> 0]]); + s := Format('%d ($%.4x)', [c, c]); + ShowInRow(FCurrRow, FBufferIndex, numBytes, s, 'Column index'); + end; + end; + $25, $45, $65: + begin + case token of + $25: s := 'reference'; + $45: s := 'value'; + $65: s := 'array'; + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + Format('Token tAREA (Cell range %s)', [s])); + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + r := WordLEToN(w); + Move(FBuffer[FBufferIndex+2], w, numBytes); + r2 := WordLEToN(w); + if FFormat = sfExcel8 then begin + numBytes := 2; + Move(FBuffer[FBufferIndex+2], w, numBytes); // column --w1 + c := WordLEToN(w); + if FCurrRow = Row then begin + FDetails.Add('RowIndex information:'#13); + FDetails.Add(Format('RowIndex = %d (%s)', [r, ABS_REL[c and $4000 <> 0]])); + end; + //s := Format('$%.4x (%d, %s)', [r, r, ABS_REL[c and $4000 <> 0]]); + s := Format('%d ($%.4x)', [r, r]); + ShowInRow(FCurrRow, FBufferIndex, numbytes, s, 'Row index'); + if FCurrRow = Row then begin + FDetails.Add('ColIndex information:'#13); + FDetails.Add(Format('Bits 0-13: ColIndex = %d (%s)', [c and $3FFF, ABS_REL[c and $8000 <> 0]])); + if c and $4000 = 0 + then FDetails.Add('Bit 14=0: absolute row index') + else FDetails.Add('Bit 14=1: relative row index'); + if c and $8000 = 0 + then FDetails.Add('Bit 15=0: absolute column index') + else FDetails.Add('Bit 15=1: relative column index'); + end; + // s := Format('$%.4x (%d, %s)', [c, c AND $3FFF, ABS_REL[c and $8000 <> 0]]); + s := Format('%d ($%.4x)', [c, c]); + ShowInRow(FCurrRow, FBufferIndex, numBytes, s, 'Column index'); + end else begin + numbytes := 1; + Move(FBuffer[FBufferIndex+2], b, numBytes); + c := b; + if FCurrRow = Row then begin + FDetails.Add('RowIndex information:'#13); + FDetails.Add(Format('Bits 0-13: RowIndex = %d (%s)', [r and $3FFF, ABS_REL[r and $4000 <> 0]])); + if r and $4000 = 0 + then FDetails.Add('Bit 14=0: absolute row index') + else FDetails.Add('Bit 14=1: relative row index'); + if r and $8000 = 0 + then FDetails.Add('Bit 15=0: absolute column index') + else FDetails.Add('Bit 15=1: relative column index'); + end; + //s := Format('$%.4x (%d, %s)', [r, r and $3FFF, ABS_REL[r and $4000 <> 0]]); + s := Format('%d ($%.4x)', [r, r]); + ShowInRow(FCurrRow, FBufferIndex, 2, s, 'Row index'); + if FCurrRow = Row then begin + FDetails.Add('ColIndex information:'#13); + FDetails.Add(Format('ColIndex = %d (%s)', [c, ABS_REL[r and $8000 <> 0]])); + end; + //s := Format('$%.2x (%d, %s)', [c, c, ABS_REL[r and $8000 <> 0]]); + s := Format('%d ($%.4x)', [c, c]); + ShowInRow(FCurrRow, FBufferIndex, numBytes, s, 'Column index'); + end; + { + if FFormat = sfExcel8 then begin + numBytes := 2; + Move(FBuffer[FBufferIndex+4], w, numBytes); + c := WordLEToN(w); + Move(FBuffer[FBufferIndex+6], w, numBytes); + c2 := WordLEToN(w); + s := Format('$%.4x (%d, %s)', [r, r, ABS_REL[c and $4000 <> 0]]); + ShowInRow(FCurrRow, FBufferIndex, 2, s, 'Index to first row'); + s := Format('$%.4x (%d, %s)', [r2, r2, ABS_REL[c2 and $4000 <> 0]]); + ShowInRow(FCurrRow, FBufferIndex, 2, s, 'Index to last row'); + s := Format('$%.4x (%d, %s)', [c, c and $3FFF, ABS_REL[c and $8000 <> 0]]); + ShowInRow(FCurrRow, FBufferIndex, 2, s, 'Index to first column'); + s := Format('$%.4x (%d, %s)', [c2, c2 and $3FFF, ABS_REL[c2 and $8000 <> 0]]); + ShowInRow(FCurrRow, FBufferIndex, 2, s, 'Index to last columns'); + end else begin + c := FBuffer[FBufferIndex+4]; + c2 := FBuffer[FBufferIndex+5]; + s := Format('$%.4x (%d, %s)', [r, r and $3FFF, ABS_REL[r and $4000 <> 0]]); + ShowInRow(FCurrRow, FBufferIndex, 2, s, 'Index to first row'); + s := Format('$%.4x (%d, %s)', [r2, r2 and $3FFF, ABS_REL[r2 and $4000 <> 0]]); + ShowInRow(FCurrRow, FBufferIndex, 2, s, 'Index to last row'); + s := Format('$%.2x (%d, %s)', [c, c, ABS_REL[r and $8000 <> 0]]); + ShowInRow(FCurrRow, FBufferIndex, 1, s, 'Index to first column'); + s := Format('$%.2x (%d, %s)', [c2, c2, ABS_REL[r2 and $8000 <> 0]]); + ShowInRow(FCurrRow, FBufferIndex, 1, s, 'Index to last column'); + end; + } + end; + else ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [token]), + '(unknown)'); + end; + end; + + RowCount := FCurrRow; + EndUpdate(true); + +end; + + +procedure TBIFFGrid.ShowHeader; +var + numbytes: Integer; + s: String; +begin + RowCount := FixedRows + 1; + ExtractString(FBufferIndex, IfThen(FFormat=sfExcel8, 2, 1), FFormat=sfExcel8, + s, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, s, + 'Page header string' + IfThen(FFormat = sfExcel8, + ' (Unicode string, 16-bit string length)', + ' (byte string, 8-bit string length)' + )); +end; + + +procedure TBIFFGrid.ShowHideObj; +var + numBytes: word; + w: Word; +begin + RowCount := FixedRows + 1; + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Viewing mode for objects:'#13); + case w of + 0: FDetails.Add('0 = Show all objects'); + 1: FDetails.Add('1 = Show placeholders'); + 2: FDetails.Add('2 = Do not show objects'); + end; + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), + 'Viewing mode for objects'); +end; + + +procedure TBIFFGrid.ShowInRow(var ARow: Integer; var AOffs: LongWord; + ASize: Word; AValue,ADescr: String); +begin + Cells[0, ARow] := IntToStr(AOffs); + Cells[1, ARow] := IntToStr(ASize); + Cells[2, ARow] := AValue; + Cells[3, ARow] := ADescr; + inc(ARow); + inc(AOffs, ASize); +end; + + +procedure TBIFFGrid.ShowInteger; +var + numBytes: Integer; + w: Word; + b: Byte; +begin + // BIFF2 only + if (FFormat <> sfExcel2) then + exit; + + RowCount := FixedRows + 5; + ShowRowColData(FBufferIndex); + + numBytes := 1; + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), + 'Cell protection and XF index'); + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), + 'Indexes of format and font records'); + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.2x)', [b,b]), + 'Cell style'); + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)), + 'Unsigned 16-bit integer cell value'); +end; + + +procedure TBIFFGrid.ShowInterfaceEnd; +begin + RowCount := FixedRows + 1; + ShowInRow(FCurrRow, FBufferIndex, 0, '', 'End of Globals Substream'); +end; + + +procedure TBIFFGrid.ShowInterfaceHdr; +var + numbytes: Integer; + w: Word; +begin + RowCount := FixedRows + 1; + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Code page of user interface:'#13); + FDetails.Add(Format('$%.4x = %s', [w, CodePageName(w)])); + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.4x)', [w, w]), + 'Begin of Globals Substream, code page of user interface'); +end; + + +procedure TBIFFGrid.ShowIteration; +var + numBytes: Integer; + w: word; +begin + RowCount := FixedRows + 1; + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Iterations:'#13); + case w of + 0: FDetails.Add('0 = Iterations off'); + 1: FDetails.Add('1 = Iterations on'); + end; + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), 'Iterations on/off'); +end; + + +procedure TBIFFGrid.ShowLabelCell; +var + numBytes: Integer; + b: Byte; + w: Word; + s: String; +begin + RowCount := IfThen(FFormat = sfExcel2, FixedRows + 6, FixedRows + 4); + ShowRowColData(FBufferIndex); + if (FFormat = sfExcel2) then begin + numBytes := 1; + Move(FBuffer[FBufferIndex], b, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), + 'Cell protection and XF index'); + + numBytes := 1; + Move(FBuffer[FBufferIndex], b, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), + 'Indexes of format and font records'); + + numBytes := 1; + Move(FBuffer[FBufferIndex], b, numBytes); + 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; + + b := IfThen(FFormat=sfExcel2, 1, 2); + ExtractString(FBufferIndex, b, (FFormat = sfExcel8), s, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, s, + Format('%s string, %d-bit string length', [GetStringType, b*8])); +end; + + +procedure TBIFFGrid.ShowLabelSSTCell; +var + numBytes: Integer; + w: Word; + dw: DWord; +begin + RowCount := FixedRows + 4; + ShowRowColData(FBufferIndex); + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.4x)', [w, w]), + 'Index of XF record'); + + numBytes := 4; + Move(FBuffer[FBufferIndex], dw, numBytes); + dw := DWordLEToN(dw); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(dw), + 'Index into SST record (shared string table)'); +end; + + +procedure TBIFFGrid.ShowLeftMargin; +var + numBytes: Integer; + dbl: Double; +begin + RowCount := FixedRows + 1; + numBytes := 8; + Move(FBuffer[FBufferIndex], dbl, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, FloatToStr(dbl), + 'Left page margin in inches (IEEE 754 floating-point value, 64-bit double precision)'); +end; + + +procedure TBIFFGrid.ShowMMS; +var + w: Word; + numbytes: Integer; +begin + RowCount := FixedRows + 1; + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(w), 'Reserved, MUST be ignored'); +end; + + +procedure TBIFFGrid.ShowNumberCell; +var + numBytes: Integer; + b: Byte = 0; + w: Word = 0; + dbl: Double; +begin + RowCount := IfThen(FFormat = sfExcel2, FixedRows + 6, FixedRows + 4); + // Offset 0: Row & Offsset 2: Column + ShowRowColData(FBufferIndex); + // Offset 4: Cell attributes (BIFF2) or XF ecord index (> BIFF2) + if FFormat = sfExcel2 then begin + numBytes := 1; + Move(FBuffer[FBufferIndex], b, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), + 'Cell protection and XF index'); + + numBytes := 1; + Move(FBuffer[FBufferIndex], b, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.2x)', [b,b]), + 'Indexes of format and font records'); + + numBytes := 1; + Move(FBuffer[FBufferIndex], b, numBytes); + 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; + // Offset 6: Double value + numBytes := 8; + Move(FBuffer[FBufferIndex], dbl, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, FloatToStr(dbl), + 'IEEE 764 floating-point value'); +end; + + +procedure TBIFFGrid.ShowPalette; +var + numBytes: Integer; + w: Word; + dw: DWord; + npal: Integer; + i: Integer; + s: String; +begin + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + npal := WordLEToN(w); + + RowCount := FixedRows + 1 + npal; + + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(npal), + 'Number of palette colors'); + + for i := 0 to npal-1 do begin + numbytes := 4; + Move(FBuffer[FBufferIndex], dw, numBytes); + dw := DWordLEToN(dw); + s := Format('Palette color, index #%d ($%.2x)',[i, i]); + case i of + $00..$07: ; + $08..$3F: s := s + ', user-defined palette'; + $40 : s := s + ', system window text color for border lines'; + $41 : s := s + ', system window background color for pattern background'; + $43 : s := s + ', system face color (dialogue background color)'; + $4D : s := s + ', system window text colour for chart border lines'; + $4E : s := s + ', system window background color for chart areas'; + $4F : s := s + ', automatic color for chart border lines (seems to be always Black)'; + $50 : s := s + ', system tool tip background color (used in note objects)'; + $51 : s := s + ', system tool tip text color (used in note objects)'; + $7FFF : s := s + ', system window text color for fonts'; + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.8x', [dw]), s); + end; +end; + + +procedure TBIFFGrid.ShowPassword; +var + numBytes: Integer; + w: Word; +begin + RowCount := FixedRows + 1; + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Password verifier for sheet or workbook:'#13); + if w = 0 + then FDetails.Add('0 = No password') + else FDetails.Add(Format('$%.4x = Password verifier', [w])); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), + 'Password verifier for sheet or workbook'); +end; + + +procedure TBIFFGrid.ShowPrecision; +var + numbytes: Integer; + w: Word; +begin + RowCount := FixedRows + 1; + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Precision-as-displayed mode:'#13); + if w = 0 + then FDetails.Add('0 = Precision-as-displayed mode selected') + else FDetails.Add('1 = Precision-as-displayed mode NOT selected'); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), + 'Precision-as-displayed mode'); +end; + + +procedure TBIFFGrid.ShowPrintGridLines; +var + numBytes: Integer; + w: Word; +begin + RowCount := FixedRows + 1; + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Print sheet grid lines:'#13); + if w = 0 + then FDetails.Add('0 = Do not print sheet grid lines') + else FDetails.Add('1 = Print sheet grid lines'); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), + 'Print sheet grid lines'); +end; + + +procedure TBIFFGrid.ShowPrintHeaders; +var + numBytes: Integer; + w: Word; +begin + RowCount := FixedRows + 1; + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Print row/column headers'); + FDetails.Add('(the area with row numbers and column letters):'#13); + if w = 0 + then FDetails.Add('0 = Do not print row/column headers') + else FDetails.Add('1 = Print row/column headers'); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), + 'Print row/column headers'); +end; + + +procedure TBIFFGrid.ShowProt4Rev; +var + numBytes: Integer; + w: Word; +begin + RowCount := FixedRows + 1; + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Removal of the shared workbook''s revision logs:'#13); + if w = 0 + then FDetails.Add('0 = Removal of the shared workbook''s revision logs is allowed.') + else FDetails.Add('1 = Removal of the shared workbook''s revision logs is NOT allowed.'); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), + 'Removal of the shared workbook''s revision logs'); +end; + + +procedure TBIFFGrid.ShowProt4RevPass; +var + numBytes: Integer; + w: Word; +begin + RowCount := FixedRows + 1; + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Password verifier needed to change the PROT4REV record:'#13); + if w = 0 + then FDetails.Add('0 = No password.') + else FDetails.Add(Format('$%.04x = Password verifier.', [w])); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.4x)', [w,w]), + 'Password verifier needed to change the PROT4REV record'); +end; + + +procedure TBIFFGrid.ShowProtect; +var + numBytes: Integer; + w: Word; +begin + RowCount := FixedRows + 1; + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Protection state of the workbook:'#13); + if w = 0 + then FDetails.Add('0 = Workbook is NOT protected.') + else FDetails.Add('1 = Workbook is protected.'); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.4x', [w]), + 'Protection state of the workbook'); +end; + + +procedure TBIFFGrid.ShowRecalc; +var + numBytes: Integer; + w: Word; +begin + RowCount := FixedRows + 1; + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('"Recalculate before save" option:'#13); + if w = 0 + then FDetails.Add('0 = Do not recalculate') + else FDetails.Add('1 = Recalculate before saving the document'); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), + 'Recalculate before saving'); +end; + + +procedure TBIFFGrid.ShowRefMode; +var + numBytes: Integer; + w: Word; +begin + RowCount := FixedRows + 1; + numBytes := 2; + Move(FBuffer[FbufferIndex], w, numbytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Cell reference mode:'#13); + if w = 0 + then FDetails.Add('0 = RC mode (i.e. cell address shown as "R(1)C(-1)"') + else FDetails.Add('1 = A1 mode (i.e. cell address shown as "B1")'); + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(w), + 'Cell reference mode'); +end; + + +procedure TBIFFGrid.ShowRefreshAll; +var + numbytes: Integer; + w: Word; +begin + RowCount := FixedRows + 1; + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('RefreshAll record:'#13); + if w = 0 + then FDetails.Add('0 = Do not force refresh of external data ranges, PivotTables and XML maps on workbook load.') + else FDetails.Add('1 = Force refresh of external data ranges, PivotTables and XML maps on workbook load.'); + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.4x)', [w, w]), + 'Force refresh of external data ranges, Pivot tables and XML maps on workbook load'); +end; + + +procedure TBIFFGrid.ShowRightMargin; +var + numBytes: Integer; + dbl: Double; +begin + RowCount := FixedRows + 1; + numBytes := 8; + Move(FBuffer[FBufferIndex], dbl, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, FloatToStr(dbl), + 'Right page margin in inches (IEEE 754 floating-point value, 64-bit double precision)'); +end; + + +procedure TBIFFGrid.ShowRK; +var + numBytes: Integer; + w: Word; + dw: DWord; + encint: Integer; + encdbl: QWord; + dbl: Double absolute encdbl; + s: String; +begin + RowCount := FixedRows + 4; + + ShowRowColData(FBufferIndex); + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Index to XF record'); + + numBytes := 4; + Move(FBuffer[FBufferIndex], dw, numBytes); + dw := DWordLEToN(dw); + + if dw and $00000002 = 0 then begin + encdbl := (QWord(dw) and QWord($FFFFFFFFFFFFFFFC)) shl 32; + if dw and $00000001 = 1 then + s := Format('%.2f', [dbl*0.01]) + else + s := Format('%.0f', [dbl]); + end + else begin + s := Format('$%.16x', [-59000000]); + encint := ((dw and $FFFFFFFC) shr 2) or (dw and $C0000000); + // "arithmetic shift" = replace left-most bits by original bits + if dw and $00000001 = 1 then + s := FloatToStr(encint*0.01) + else + s := IntToStr(encint); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, + Format('$%.8x', [dw]), + Format('RK value (Bit 0=Unchanged/Encoded value multiplied by 100, Bit 1=float/signed int, '+ + 'Bits 2-31=encoded value (here: %s)', [s]) + ); +end; + + +procedure TBIFFGrid.ShowRow; +var + numBytes: Integer; + dw: DWord; + w: Word; + b: Byte; +begin + RowCount := FixedRows + IfThen(FFormat = sfExcel2, 10, 7); + + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Index of this row'); + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Index to column of the first cell which is described by a cell record'); + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Index to column of the last cell which is described by a cell record, increased by 1'); + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.4x', [WordLEToN(w)]), + 'Bits 14-0: Height of row in twips (1/20 pt), Bit 15: Row has default height'); + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, '', '(not used)'); + + if FFormat = sfExcel2 then begin + numBytes := 1; + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(b), + '0=No defaults written, 1=Default row attribute field and XF index occur below'); + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Relative offset to calculate stream position of the first cell record for this row'); + + if b = 1 then begin + numBytes := 1; + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(b), + 'Cell protection and XF index'); + + numBytes := 1; + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(b), + 'Indexes to FORMAT and FONT records'); + + numBytes := 1; + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(b), + 'Cell style'); + end; + end + else begin + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, '', + 'In BIFF5-BIFF8 this field is not used anymore, but the DBCELL record instead.'); + + numBytes := 4; + Move(FBuffer[FBufferIndex], dw, numbytes); + dw := DWordLEToN(dw); + if Row = FCurrRow then begin + FDetails.Add('Option flags and default row formatting:'#13); + FDetails.Add(Format('Bits 0-2 = %d: Outline level of the row', [dw and $00000007])); + if dw and $00000010 = 0 + then FDetails.Add('Bit 4 = 0: Outline group does not start or end here and is not collapsed') + else FDetails.Add('Bit 4 = 1: Outline group starts or ends here and is collapsed'); + if dw and $00000020 = 0 + then FDetails.Add('Bit 5 = 0: Row is NOT hidden') + else FDetails.Add('Bit 5 = 1: Row is hidden'); + if dw and $00000040 = 0 + then FDetails.Add('Bit 6 = 0: Row height and default font height do match.') + else FDetails.Add('Bit 6 = 1: Row height and default font height do NOT match.'); + if dw and $00000080 = 0 + then FDetails.Add('Bit 7 = 0: Row does NOT have explicit default format.') + else FDetails.Add('Bit 7 = 1: Row has explicit default format.'); + FDetails.Add('Bit 8 = 1: Is always 1'); + FDetails.Add(Format('Bits 16-27 = %d: Index to default XF record', [(dw and $0FFF0000) shr 16])); + if dw and $10000000 = 0 + then FDetails.Add('Bit 28 = 0: No additional space above the row.') + else FDetails.Add('Bit 28 = 1: Additional space above the row.'); + if dw and $20000000 = 0 + then FDetails.Add('Bit 29 = 0: No additional space below the row.') + else FDetails.Add('Bit 29 = 1: Additional space below the row.'); + if dw and $40000000 = 0 + then FDetails.Add('Bit 30 = 0: D0 NOT show phonetic text for all cells in the row.') + else FDetails.Add('Bit 30 = 1: Show phonetic text for all cells in the row.'); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.8x', [dw]), + 'Option flags and default row formatting'); + end; +end; + +procedure TBIFFGrid.ShowRowColData(var ABufIndex: LongWord); +var + w: Word; + numBytes: Integer; +begin + // Row + numBytes := 2; + Move(FBuffer[ABufIndex], w, numBytes); + ShowInRow(FCurrRow, ABufIndex, numBytes, IntToStr(WordLEToN(w)), 'Index to row'); + // Column + numBytes := 2; + Move(FBuffer[ABufIndex], w, numBytes); + ShowInRow(FCurrRow, ABufIndex, numBytes, IntToStr(WordLEToN(w)), 'Index to column'); +end; + + +procedure TBIFFGrid.ShowSelection; +var + numBytes: Integer; + w: word; + b: Byte; + i, n: Integer; +begin + Move(FBuffer[FBufferIndex+7], w, 2); + n := WordLEToN(w); + + RowCount := FixedRows + 5 + n*4; + + numBytes := 1; + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(b), 'Pane identifier (see PANE record)'); + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Index to row of the active cell'); + + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Index to column of the active cell'); + + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Index into the following cell range list to the entry that contains the active cell'); + + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(n), + 'Number of following cell range addresses'); + + numbytes := 2; + for i:=1 to n do begin + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), 'Index to first row'); + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), 'Index to last row'); + numBytes := 1; + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(b), 'Index to first column'); + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(b), 'Index to last column'); + end; +end; + + +procedure TBIFFGrid.ShowSheet; +var + numBytes: Integer; + dw: DWord; + b: Byte; + s: String; +begin + RowCount := FixedRows + 4; + + numBytes := 4; + Move(FBuffer[FBufferIndex], dw, numBytes); + dw := DWordLEToN(dw); + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.8x)', [dw, dw]), + 'Absolute stream position of BOF record of sheet represented by this record.'); + + numBytes := 1; + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(b), + 'Sheet state (0=visible, 1=hidden, 2="very" hidden)'); + + numBytes := 1; + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [b]), + 'Sheet type ($00=worksheet, $02=Chart, $06=VB module)'); + + ExtractString(FBufferIndex, 1, (FFormat = sfExcel8), s, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, s, IfThen(FFormat=sfExcel8, + 'Sheet name (unicode string, 8-bit string length)', + 'Sheet name (byte string, 8-bit string length)') + ); +end; + + +procedure TBIFFGrid.ShowSST; +var + numBytes: Integer; + s: String; + total1, total2: DWord; + i: Integer; +begin + numBytes := 4; + Move(FBuffer[FBufferIndex], total1, numBytes); + Move(FBuffer[FBufferIndex+4], total2, numBytes); + total1 := DWordLEToN(total1); + total2 := DWordLEToN(total2); + + RowCount := FixedRows + 2 + total2; + + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(total1), + 'Total number of shared strings in the workbook'); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(total2), + 'Number of following strings'); + + for i:=1 to total2 do begin + ExtractString(FBufferIndex, 2, true, s, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, s, Format('Shared string #%d', [i])); + end; +end; + + +procedure TBIFFGrid.ShowString; +var + numBytes: Integer; + s: String; +begin + RowCount := FixedRows + 1; + case FFormat of + sfExcel2: + begin + ExtractString(FBufferIndex, 1, false, s, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, s, 'Byte string, 8-bit string length'); + end; + sfExcel5: + begin + ExtractString(FBufferIndex, 2, false, s, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, s, 'Byte string, 16-bit string length'); + end; + sfExcel8: + begin + ExtractString(FBufferIndex, 2, true, s, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, s, 'Unicode string, 16-bit string length'); + end; + end; +end; + + +procedure TBIFFGrid.ShowStyle; +var + numBytes: Integer; + b: Byte; + w: Word; + s: String; + isRowLevel: Boolean; + isColLevel: Boolean; +begin + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + if w and $8000 = 0 then + RowCount := FixedRows + 2 + else + RowCount := FixedRows + 3; + if Row = FCurrRow then begin + FDetails.Add('Style:'#13); + FDetails.Add(Format('Bits 0-11 = %d: Index to style XF record', [w and $0FFFF])); + if w and $8000 = 0 + then FDetails.Add('Bit 15 = 0: user-defined style') + else FDetails.Add('Bit 15 = 1: built-in style'); + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.4x', [w]), 'Style index and type'); + + if w and $8000 = 0 then begin + if FFormat = sfExcel8 then begin + ExtractString(FBufferIndex, 2, true, s, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, s, 'Style name (Unicode string, 16-bit string length)'); + end else begin + ExtractString(FBufferIndex, 1, false, s, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, s, 'Style name (Byte string, 8-bit string length)'); + end; + end else begin + numbytes := 1; + b := FBuffer[FBufferIndex]; + isRowLevel := (b = 1); + isColLevel := (b = 2); + if FCurrRow = Row then begin + FDetails.Add('Identifier for built-in cell style:'#13); + case b of + 0: FDetails.Add('0 = normal'); + 1: FDetails.Add('1 = RowLevel (see next field)'); + 2: FDetails.Add('2 = ColLevel (see next field)'); + 3: FDetails.Add('3 = Comma'); + 4: FDetails.Add('4 = Currency'); + 5: FDetails.Add('5 = Percent'); + 6: FDetails.Add('6 = Comma [0]'); + 7: FDetails.Add('7 = Currency [0]'); + 8: FDetails.Add('8 = Hyperlink'); + 9: FDetails.Add('9 = Followed hyperlink'); + end; + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(b), + 'Identifier for built-in cell style'); + + b := FBuffer[FBufferIndex]; + if FCurrRow = Row then begin + FDetails.Add('Level for RowLevel or ColLevel style (zero-based):'#13); + if b = $FF then + FDetails.Add('$FF = no RowLevel or ColLevel style') + else + if isRowLevel then + FDetails.Add('RowLevel = ' + IntToStr(b)) + else if isColLevel then + FDetails.Add('ColLevel = ' + IntToStr(b)); + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(b), + 'Level for RowLevel or ColLevel style (if available)'); + end; +end; + + +procedure TBIFFGrid.ShowStyleExt; +var + numBytes: Integer; + w: Word; + b: Byte; + bs: Byte; + s: String; +begin + RowCount := FixedRows + 11; + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.4x', [wordLEToN(w)]), + 'Future record type'); + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Attributes:'#13); + if w and $0001 = 0 + then FDetails.Add('Bit 0 = 0: The containing record does not specify a range of cells.') + else FDetails.Add('Bit 0 = 1: The containing record specifies a range of cells.'); + FDetails.Add('Bit 1: specifies wether to alert the user of possible problems '+ + 'when saving the file whithout having reckognized this record.'); + FDetails.Add('Bits 2-15: reserved (MUST be zero, MUST be ignored)'); + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.4x', [w]), + 'Attributes'); + numbytes := 8; + ShowInRow(FCurrRow, FBufferIndex, numbytes, '', 'Reserved'); + + numbytes := 1; + b := FBuffer[FBufferIndex]; + if Row = FCurrRow then begin + FDetails.Add('Flags:'#13); + if b and $01 = 0 + then FDetails.Add('Bit 0 = 0: no built-in style') + else FDetails.Add('Bit 0 = 1: built-in style'); + if b and $02 = 0 + then FDetails.Add('Bit 1 = 0: NOT hidden') + else FDetails.Add('Bit 1 = 1: hidden (i.e. is displayed in user interface)'); + FDetails.Add('Bit 2: specifies whether the built-in cell style was modified '+ + 'by the user and thus has a custom definition.'); + FDetails.Add('Bit 3-7: Reserved'); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [b]), 'Flags'); + + numbytes := 1; + b := FBuffer[FBufferIndex]; + if Row = FCurrRow then begin + FDetails.Add('Category:'#13); + case b of + 0: FDetails.Add('Bits 0-7 = 0: Custom style'); + 1: FDetails.Add('Bits 0-7 = 1: Good, bad, neutral style'); + 2: FDetails.Add('Bits 0-7 = 2: Data model style'); + 3: FDetails.Add('Bits 0-7 = 3: Title and heading style'); + 4: FDetails.Add('Bits 0-7 = 4: Themed cell style'); + 5: FDetails.Add('Bits 0-7 = 5: Number format style'); + end; + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [b]), 'Category'); + + numbytes := 1; + b := FBuffer[FBufferIndex]; + if Row = FCurrRow then begin + FDetails.Add('Built-in style:'#13); + FDetails.Add('An unsigned integer that specifies the type of the built-in cell style.'); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [b]), 'Built-in style'); + bs := b; + + numbytes := 1; + b := FBuffer[FBufferindex]; + if Row = FCurrRow then begin + FDetails.Add('Outline depth level:'#13); + FDetails.Add('An unsigned integer that specifies the depth level of row/column automatic outlining.'); + if (bs in [1, 2]) then + FDetails.Add(Format('Bits 0-7 = %d: Outline level is %d', [b, b+1])) + else + FDetails.Add(Format('Bits 0-7 = $%.2x: MUST be $FF, MUST be ignoried', [b])); + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.2x', [b]), 'Outline depth level'); + + ExtractString(FBufferIndex, 1, true, s, numBytes, true); + ShowInRow(FCurrRow, FBufferIndex, numBytes, s, 'Name of the style name to extend (Unicode string, 8-bit string length)'); + + numbytes := 2; + ShowInRow(FCurrRow, FBufferIndex, numbytes, '', 'XFProps (reserved)'); + + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), 'Count of XFProp structures to follow in array'); + + +end; + + +procedure TBiffGrid.ShowTabID; +var + numbytes: Integer; + w: word; + i, n: Integer; +begin + numbytes := 2; + n := Length(FBuffer) div numbytes; + RowCount := FixedRows + n; + for i := 1 to n do begin + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.4x)', [w, w]), + 'Unique sheet identifier'); + end; +end; + + +procedure TBIFFGrid.ShowTopMargin; +var + numBytes: Integer; + dbl: Double; +begin + RowCount := FixedRows + 1; + numBytes := 8; + Move(FBuffer[FBufferIndex], dbl, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, FloatToStr(dbl), + 'Top page margin in inches (IEEE 754 floating-point value, 64-bit double precision)'); +end; + + +procedure TBIFFGrid.ShowWindow1; +var + numBytes: Word; + b: Byte; + w: word; +begin + RowCount := FixedRows + IfThen(FFormat < sfExcel5, 5, 9); + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)), + 'Horizontal position of the document window (in twips = 1/20 pt)'); + + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)), + 'Vertical position of the document window (in twips = 1/20 pt)'); + + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)), + 'Width of the document window (in twips = 1/20 pt)'); + + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)), + 'Height of the document window (in twips = 1/20 pt)'); + + if FFormat < sfExcel5 then begin + numBytes := 1; + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(b)), + '0 = Window is visible; 1 = window is hidden'); + end else begin + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Option flags:'); + if w and $0001 = 0 + then FDetails.Add('Bit $0001 = 0: Window is visible') + else FDetails.Add('Bit $0001 = 1: Window is hidden'); + if w and $0002 = 0 + then FDetails.Add('Bit $0002 = 0: Window is open') + else FDetails.Add('Bit $0002 = 1: Window is minimized'); + if w and $0008 = 0 + then FDetails.Add('Bit $0008 = 0: Horizontal scrollbar hidden') + else FDetails.Add('Bit $0008 = 1: Horizontal scrollbar visible'); + if w and $0010 = 0 + then FDetails.Add('Bit $0010 = 0: Vertical scrollbar hidden') + else FDetails.Add('Bit $0010 = 1: Vertical scrollbar visible'); + if w and $0020 = 0 + then FDetails.Add('Bit $0020 = 0: Worksheet tab bar hidden') + else FDetails.Add('Bit $0020 = 1: Worksheet tab bar visible'); + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.4x)', [w, w]), + 'Option flags'); + + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)), + 'Index to active (displayed) worksheet'); + + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)), + 'Index of first visible tab in the worksheet tab bar'); + + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)), + 'Number of selected worksheets (highlighted in the worksheet tab bar)'); + + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)), + 'Width of worksheet tab bar (in 1/1000 of window width). '+ + 'The remaining space is used by the horizontal scrollbar.'); + end; +end; + + +procedure TBIFFGrid.ShowWindow2; +var + numBytes: Word; + b: Byte; + w: word; + dw : DWord; +begin + if FFormat = sfExcel2 then begin + numBytes := 1; + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(b), + '0 = Show formula results; 1 = Show formulas'); + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(b), + '0 = Do not show grid lines; 1 = Show grid lines'); + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(b), + '0 = Do not show grid lines; 1 = Show grid lines'); + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(b), + '0 = Do not show sheet headers; 1 = Show sheet headers'); + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(b), + '0 = Panes are not frozen; 1 = Panes are frozen'); + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(b), + '0 = Show zero values as empty cells; 1 = Show zero values'); + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)), + 'Index to first visible row'); + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)), + 'Index to first visible column'); + numBytes := 1; + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(b), + '0 = Use manual grid line colour (below); 1 = Use automatic grid line colour'); + numbytes := 4; + Move(FBuffer[FBufferIndex], dw, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.8x', [DWordLEToN(dw)]), + 'Grid line RGB color'); + end else begin + RowCount := FixedRows + IfThen(FFormat = sfExcel5, 4, 8); + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Option flags:'); + if w and $0001 = 0 + then FDetails.Add('Bit $0001 = 0: Show formula results') + else FDetails.Add('Bit $0001 = 1: Show formulas'); + if w and $0002 = 0 + then FDetails.Add('Bit $0002 = 0: Do not show grid lines') + else FDetails.Add('Bit $0002 = 1: Show grid lines'); + if w and $0004 = 0 + then FDetails.Add('Bit $0004 = 0: Do not show sheet headers') + else FDetails.Add('Bit $0004 = 1: Show sheet headers'); + if w and $0008 = 0 + then FDetails.Add('Bit $0008 = 0: Panes are not frozen') + else FDetails.Add('Bit $0008 = 1: Panes are frozen'); + if w and $0010 = 0 + then FDetails.Add('Bit $0010 = 0: Show zero values as empty cells') + else FDetails.Add('Bit $0010 = 1: Show zero values'); + if w and $0020 = 0 + then FDetails.Add('Bit $0020 = 0: Manual grid line color') + else FDetails.Add('Bit $0020 = 1: Automatic grid line color'); + if w and $0040 = 0 + then FDetails.Add('Bit $0040 = 0: Columns from left to right') + else FDetails.Add('Bit $0040 = 1: Columns from right to left'); + if w and $0080 = 0 + then FDetails.Add('Bit $0080 = 0: Do not show outline symbols') + else FDetails.Add('Bit $0080 = 1: Show outline symbols'); + if w and $0100 = 0 + then FDetails.Add('Bit $0100 = 0: Keep splits if pane freeze is removed') + else FDetails.Add('Bit $0100 = 1: Remove splits if pane freeze is removed'); + if w and $0200 = 0 + then FDetails.Add('Bit $0200 = 0: Sheet not selected') + else FDetails.Add('Bit $0200 = 1: Sheet selected'); + if w and $0400 = 0 + then FDetails.Add('Bit $0400 = 0: Sheet not active') + else FDetails.Add('Bit $0400 = 1: Sheet active'); + if w and $0800 = 0 + then FDetails.Add('Bit $0800 = 0: Show in normal view') + else FDetails.Add('Bit $0800 = 1: Show in page break preview'); + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.4x)', [w, w]), + 'Option flags'); + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)), + 'Index to first visible row'); + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)), + 'Index to first visible column'); + + if FFormat =sfExcel5 then begin + numbytes := 4; + Move(FBuffer[FBufferIndex], dw, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.8x', [DWordLEToN(dw)]), + 'Grid line RGB color'); + end else begin + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)), + 'Color index of grid line color'); + + ShowInRow(FCurrRow, FBufferIndex, numbytes, '', 'Not used'); + + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)), + 'Cached magnification factor in page break preview (in percent); 0 = Default (60%)'); + + Move(FBuffer[FBufferIndex], w, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)), + 'Cached magnification factor in normal view (in percent); 0 = Default (100%)'); + + numBytes := 4; + ShowInRow(FCurrRow, FBufferIndex, numbytes, '', 'Not used'); + end; + end; +end; + + +procedure TBIFFGrid.ShowWindowProtect; +var + numBytes: Integer; + w: Word; +begin + RowCount := FixedRows + 1; + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Protection state of workbook windows:'#13); + if w = 0 + then FDetails.Add('0 = The workbook windows can be resized or moved and the window state can be changed.') + else FDetails.Add('1 = The workbook windows cannot be resized or moved and the window state cannot be changed.'); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.4x', [w]), + 'Protection state of the workbook windows'); +end; + + +procedure TBIFFGrid.ShowWriteAccess; +var + numbytes: Integer; + s: String; +begin + RowCount := FixedRows + 1; + ExtractString(FBufferIndex, IfThen(FFormat=sfExcel8, 2, 1), FFormat=sfExcel8, s, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, s, 'User name (i.e., the name that you type when you install Microsoft Excel'); +end; + + +procedure TBIFFGrid.ShowWriteProt; +begin + RowCount := FixedRows + 2; + ShowInRow(FCurrRow, FBufferIndex, 0, '', 'Write protect: if present file is write-protected'); + ShowInRow(FCurrRow, FBufferIndex, 0, '', 'Write protection password is in FILESHARING record'); +end; + + +procedure TBIFFGrid.ShowXF; +var + numBytes: Word; + b: Byte; + w: word; + dw : DWord; +begin + if FFormat = sfExcel2 then begin + RowCount := FixedRows + 4; + numBytes := 1; + b := FBuffer[FBufferIndex]; + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(b), + 'Index to font record'); + ShowInRow(FCurrRow, FBufferIndex, numBytes, '', + '(not used)'); + + b := FBuffer[FBufferIndex]; + if Row = FCurrRow then begin + FDetails.Add('Number format and cell flags:'#13); + FDetails.Add(Format('Bits 0-5 = %d: Index to FORMAT record', [b and $3F])); + if b and $40 = 0 + then FDetails.Add('Bit 6 = 0: Cell is not locked') + else FDetails.Add('Bit 6 = 1: Cell is locked'); + if b and $80 = 0 + 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]), + 'Number format and cell flags'); + + b := FBuffer[FBufferIndex]; + if Row = FCurrRow then begin + FDetails.Add('Horizontal alignment, border style and background:'#13); + case b and $07 of + 0: FDetails.Add('Bits $07 = 0: Horizontal alignment "General"'); + 1: FDetails.Add('Bits $07 = 1: Horizontal alignment "Left"'); + 2: FDetails.Add('Bits $07 = 2: Horizontal alignemnt "Centered"'); + 3: FDetails.Add('Bits $07 = 3: Horizontal alignment "Right"'); + 4: FDetails.Add('Bits $07 = 4: Horizontal alignment "Filled"'); + 5: FDetails.Add('Bits $07 = 5: Horizontal alignment "Justified"'); + 6: FDetails.Add('Bits $07 = 6: Horizontal alignment "Centred across selection"'); + 7: FDetails.Add('Bits $07 = 7: Horizontal alignment "Distributed"'); + end; + if b and $08 = 0 + then FDetails.Add('Bit $08 = 0: Cell has no left border') + else FDetails.Add('Bit $08 = 1: Cell has left black border'); + if b and $10 = 0 + then FDetails.Add('Bit $10 = 0: Cell has no right border') + else FDetails.Add('Bit $10 = 1: Cell has right black border'); + if b and $20 = 0 + then FDetails.Add('Bit $20 = 0: Cell has no top border') + else FDetails.Add('Bit $20 = 1: Cell has top black border'); + if b and $40 = 0 + then FDetails.Add('Bit $40 = 0: Cell has no bottom border') + else FDetails.Add('Bit $40 = 1: Cell has bottom black border'); + if b and $80 = 0 + then FDetails.Add('Bit $80 = 0: Cell has no shaded background') + else FDetails.Add('Bit $80 = 1: Cell has shaded background'); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [b]), + 'Horizontal alignment, border style, and background'); + end + else + begin // XF (BIFF5 and BIFF8) + RowCount := FixedRows + IfThen(FFormat=sfExcel5, 7, 10); + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Index to font record'); + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)), + 'Index to format record'); + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('XFType, cell protection, parent style XF:'#13); + if w and $0001 = 0 + then FDetails.Add('Bit $0001 = 0: Cell is not locked') + else FDetails.Add('Bit $0001 = 1: Cell is locked'); + if w and $0002 = 0 + then FDetails.Add('Bit $0002 = 0: Formula is not hidden') + else FDetails.Add('Bit $0002 = 1: Formula is hidden'); + if w and $0004 = 0 + then FDetails.Add('Bit $0004 = 0: Cell XF') + else FDetails.Add('Bit $0004 = 1: Style XF'); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.4x', [w]), + 'XFType, cell protection, parent style XF'); + + numBytes := 1; + b := FBuffer[FBufferIndex]; + if Row = FCurrRow then begin + FDetails.Add('Alignment and text break:'#13); + case b and $03 of + 0: FDetails.Add('Bits 0-2 = 0: Horizontal alignment "General"'); + 1: FDetails.Add('Bits 0-2 = 1: Horizontal alignment "Left"'); + 2: FDetails.Add('Bits 0-2 = 2: Horizontal alignemnt "Centered"'); + 3: FDetails.Add('Bits 0-2 = 3: Horizontal alignment "Right"'); + 4: FDetails.Add('Bits 0-2 = 4: Horizontal alignment "Filled"'); + 5: FDetails.Add('Bits 0-2 = 5: Horizontal alignment "Justified"'); + 6: FDetails.Add('Bits 0-2 = 6: Horizontal alignment "Centred across selection"'); + 7: if FFormat = sfExcel8 then + FDetails.Add('Bits 0-2 = 7: Horizontal alignment "Distributed"'); + end; + if b and $08 = 0 + then FDetails.Add('Bit 3 = 0: Text is not wrapped.') + else FDetails.Add('Bit 3 = 1: Text is wrapped at right border.'); + case (b and $70) shr 4 of + 0: FDetails.Add('Bits 4-6 = 0: Vertical alignment "Top"'); + 1: FDetails.Add('Bits 4-6 = 1: Vertical alignment "Centered"'); + 2: FDetails.Add('Bits 4-6 = 2: Vertical alignment "Bottom"'); + 3: FDetails.Add('Bits 4-6 = 3: Vertical alignment "Justified"'); + 4: if FFormat = sfExcel8 then + FDetails.Add('Bits 4-6 = 4: Vertical alignment "Distributed"'); + end; + if FFormat = sfExcel8 then begin + if b and $80 = 0 + then FDetails.Add('Bit 3 = 0: Don''t justify last line in justified or distibuted text') + else FDetails.Add('Bit 3 = 1: Justify last line in justified or distibuted text'); + end; + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [b]), + 'Alignment and text break'); + + numBytes := 1; + b := FBuffer[FBufferIndex]; + if FFormat = sfExcel5 then begin + if Row = FCurrRow then begin + FDetails.Add('Text orientation and flags for used attribute groups:'#13); + case (b and $03) of + 0: FDetails.Add('Bits $03 = 0: not rotated'); + 1: FDetails.Add('Bits $03 = 1: not rotated, letters stacked top-to-bottom'); + 2: FDetails.Add('Bits $03 = 2: text rotated 90° counter-clockwise'); + 3: FDetails.Add('Bits $03 = 3: text rotated 90° clockwise'); + end; + if b and $04 = 0 + then FDetails.Add('Bit $04 = 0: No flag for number format') + else FDetails.Add('Bit $04 = 1: Flag for number format'); + if b and $08 = 0 + then FDetails.Add('Bit $08 = 0: No flag for font') + else FDetails.Add('Bit $08 = 2: Flag for font'); + if b and $10 = 0 + then FDetails.Add('Bit $10 = 0: No flag for hor/vert alignment, text wrap, indentation, orientation, rotation, and text direction') + else FDetails.Add('Bit $10 = 1: Flag for hor/vert alignment, text wrap, indentation, orientation, rotation, and text direction'); + if b and $20 = 0 + then FDetails.Add('Bit $20 = 0: No flag for border lines') + else FDetails.Add('Bit $20 = 1: Flag for border lines'); + if b and $40 = 0 + then FDetails.Add('Bit $40 = 0: No flag for background area style') + else FDetails.Add('Bit $40 = 1: Flag for background area style'); + if b and $80 = 0 + then FDetails.Add('Bit $80 = 0: No flag for cell protection (cell locked and formula hidden)') + else FDetails.Add('Bit $80 = 1: Flag for cell protection (cell locked and formula hidden)'); + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.2x', [b]), + 'Text orientation and flags for used attribute groups'); + end else + begin // sfExcel8 + if Row = FCurrRow then begin + FDetails.Add('Text rotation angle:'#13); + if b = 0 then + FDetails.Add('not rotated') + else if b <= 90 then + FDetails.Add(Format('%d degrees counter-clockwise', [b])) + else if b <= 180 then + FDetails.Add(Format('%d degrees clockwize', [b-90])) + else if b = 255 then + FDetails.Add('not rotated, letters stacked top-to-bottom'); + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(b), 'Text rotation angle'); + end; + + if FFormat = sfExcel8 then begin + numBytes := 1; + b := FBuffer[FBufferIndex]; + if Row = FCurrRow then begin + FDetails.Add('Indentation, shrink to cell size, and text direction:'#13); + FDetails.Add(Format('Bits 0-3: Indent level = %d', [b and $0F])); + if b and $10 = 0 + then FDetails.Add('Bit $10 = 0: Don''t shrink content to fit into cell') + else FDetails.Add('Bit $10 = 1: Shrink content to fit into cell'); + case (b and $C0) shr 6 of + 0: FDetails.Add('Bits 6-7 = 0: Text direction according to context'); + 1: FDetails.Add('Bits 6-7 = 1: Text direction left-to-right'); + 2: FDetails.Add('Bits 6-7 = 2: Text direction right-to-left'); + end; + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.2x', [b]), + 'Indentation, shrink to cell size, and text direction'); + + numBytes := 1; + b := FBuffer[FBufferIndex]; + if Row = FCurrRow then begin + FDetails.Add('Flags for used attribute groups:'#13); + if b and $04 = 0 + then FDetails.Add('Bit $04 = 0: No flag for number format') + else FDetails.Add('Bit $04 = 1: Flag for number format'); + if b and $08 = 0 + then FDetails.Add('Bit $08 = 0: No flag for font') + else FDetails.Add('Bit $08 = 2: Flag for font'); + if b and $10 = 0 + then FDetails.Add('Bit $10 = 0: No flag for hor/vert alignment, text wrap, indentation, orientation, rotation, and text direction') + else FDetails.Add('Bit $10 = 1: Flag for hor/vert alignment, text wrap, indentation, orientation, rotation, and text direction'); + if b and $20 = 0 + then FDetails.Add('Bit $20 = 0: No flag for border lines') + else FDetails.Add('Bit $20 = 1: Flag for border lines'); + if b and $40 = 0 + then FDetails.Add('Bit $40 = 0: No flag for background area style') + else FDetails.Add('Bit $40 = 1: Flag for background area style'); + if b and $80 = 0 + then FDetails.Add('Bit $80 = 0: No flag for cell protection (cell locked and formula hidden)') + else FDetails.Add('Bit $80 = 1: Flag for cell protection (cell locked and formula hidden)'); + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.2x', [b]), + 'Flags for used attribute groups'); + + numBytes := 4; + Move(FBuffer[FBufferIndex], dw, numbytes); + dw := DWordLEToN(dw); + if Row = FCurrRow then begin + FDetails.Add('Cell border lines and background area:'#13); + case dw and $0000000F of + $0000: FDetails.Add('Bits 0-3 = 0: Left border = No line'); + $0001: FDetails.Add('Bits 0-3 = 1: Left border = thin solid line'); + $0002: FDetails.Add('Bits 0-3 = 2: Left border = medium solid line'); + $0003: FDetails.Add('Bits 0-3 = 3: Left border = dashed line'); + $0004: FDetails.Add('Bits 0-3 = 4: Left border = dotted line'); + $0005: FDetails.Add('Bits 0-3 = 5: Left border = thick solid line'); + $0006: FDetails.Add('Bits 0-3 = 6: Left border = double solid line'); + $0007: FDetails.Add('Bits 0-3 = 7: Left border = hair line'); + $0008: FDetails.Add('Bits 0-3 = 8: Left border = medium dashed'); + $0009: FDetails.Add('Bits 0-3 = 9: Left border = thin dash-dotted'); + $000A: FDetails.Add('Bits 0-3 = 10: Left border = medium dash-dotted'); + $000B: FDetails.Add('Bits 0-3 = 11: Left border = thin dash-dot-dotted'); + $000C: FDetails.Add('Bits 0-3 = 12: Left border = medium dash-dot-dotted'); + $000D: FDetails.Add('Bits 0-3 = 13: Left border = slanted medium dash-dotted'); + end; + case dw and $000000F0 of + $0000: FDetails.Add('Bits 4-7 = 0: Right border = No line'); + $0010: FDetails.Add('Bits 4-7 = 1: Right border = thin solid line'); + $0020: FDetails.Add('Bits 4-7 = 2: Right border = medium solid line'); + $0030: FDetails.Add('Bits 4-7 = 3: Right border = dashed line'); + $0040: FDetails.Add('Bits 4-7 = 4: Right border = dotted line'); + $0050: FDetails.Add('Bits 4-7 = 5: Right border = thick solid line'); + $0060: FDetails.Add('Bits 4-7 = 6: Right border = double solid line'); + $0070: FDetails.Add('Bits 4-7 = 7: Right border = hair line'); + $0080: FDetails.Add('Bits 4-7 = 8: Right border = medium dashed'); + $0090: FDetails.Add('Bits 4-7 = 9: Right border = thin dash-dotted'); + $00A0: FDetails.Add('Bits 4-7 = 10: Right border = medium dash-dotted'); + $00B0: FDetails.Add('Bits 4-7 = 11: Right border = thin dash-dot-dotted'); + $00C0: FDetails.Add('Bits 4-7 = 12: Right border = medium dash-dot-dotted'); + $00D0: FDetails.Add('Bits 4-7 = 13: Right border = slanted medium dash-dotted'); + end; + case dw and $00000F00 of + $0000: FDetails.Add('Bits 8-11 = 0: Top border = No line'); + $0100: FDetails.Add('Bits 8-11 = 1: Top border = thin solid line'); + $0200: FDetails.Add('Bits 8-11 = 2: Top border = medium solid line'); + $0300: FDetails.Add('Bits 8-11 = 3: Top border = dashed line'); + $0400: FDetails.Add('Bits 8-11 = 4: Top border = dotted line'); + $0500: FDetails.Add('Bits 8-11 = 5: Top border = thick solid line'); + $0600: FDetails.Add('Bits 8-11 = 6: Top border = double solid line'); + $0700: FDetails.Add('Bits 8-11 = 7: Top border = hair line'); + $0800: FDetails.Add('Bits 8-11 = 8: Top border = medium dashed'); + $0900: FDetails.Add('Bits 8-11 = 9: Top border = thin dash-dotted'); + $0A00: FDetails.Add('Bits 8-11 = 10: Top border = medium dash-dotted'); + $0B00: FDetails.Add('Bits 8-11 = 11: Top border = thin dash-dot-dotted'); + $0C00: FDetails.Add('Bits 8-11 = 12: Top border = medium dash-dot-dotted'); + $0D00: FDetails.Add('Bits 8-11 = 13: Top border = slanted medium dash-dotted'); + end; + case dw and $0000F000 of + $0000: FDetails.Add('Bits 12-15 = 0: Bottom border = No line'); + $1000: FDetails.Add('Bits 12-15 = 1: Bottom border = thin solid line'); + $2000: FDetails.Add('Bits 12-15 = 2: Bottom border = medium solid line'); + $3000: FDetails.Add('Bits 12-15 = 3: Bottom border = dashed line'); + $4000: FDetails.Add('Bits 12-15 = 4: Bottom border = dotted line'); + $5000: FDetails.Add('Bits 12-15 = 5: Bottom border = thick solid line'); + $6000: FDetails.Add('Bits 12-15 = 6: Bottom border = double solid line'); + $7000: FDetails.Add('Bits 12-15 = 7: Bottom border = hair line'); + $8000: FDetails.Add('Bits 12-15 = 8: Bottom border = medium dashed'); + $9000: FDetails.Add('Bits 12-15 = 9: Bottom border = thin dash-dotted'); + $A000: FDetails.Add('Bits 12-15 = 10: Bottom border = medium dash-dotted'); + $B000: FDetails.Add('Bits 12-15 = 11: Bottom border = thin dash-dot-dotted'); + $C000: FDetails.Add('Bits 12-15 = 12: Bottom border = medium dash-dot-dotted'); + $D000: FDetails.Add('Bits 12-15 = 13: Bottom border = slanted medium dash-dotted'); + end; + FDetails.Add(Format('Bits 16-22 = %d: Color index for left line color', [(dw and $007F0000) shr 16])); + FDetails.Add(Format('Bits 23-29 = %d: Color index for right line color', [(dw and $3F800000) shr 23])); + if dw and $40000000 = 0 + then FDetails.Add('Bit 30 = 0: No diagonal line from top left to right bottom') + else FDetails.Add('Bit 30 = 1: Diagonal line from top left to right bottom'); + if dw and $80000000 = 0 + then FDetails.Add('Bit 31 = 0: No diagonal line from bottom left to right top') + else FDetails.Add('Bit 31 = 1: Diagonal line from bottom left to right top'); + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.8x', [dw]), + 'Cell border lines and background area'); + + numBytes := 4; + Move(FBuffer[FBufferIndex], dw, numbytes); + if Row = FCurrRow then begin + FDetails.Add('Cell border lines and background area (cont''d):'#13); + FDetails.Add(Format('Bits 0-6 = %d: Color index for top line color', [(dw and $0000007F)])); + FDetails.Add(Format('Bits 7-13 = %d: Color index for bottom line color', [(dw and $00003F80) shr 7])); + FDetails.Add(Format('Bits 14-20 = %d: Color index for diagonal line color', [(dw and $001FC000) shr 14])); + case dw and $01E00000 shr 17 of + $0: FDetails.Add('Bits 21-24 = 0: Diagonal line style = No line'); + $1: FDetails.Add('Bits 21-24 = 1: Diagonal line style = thin solid line'); + $2: FDetails.Add('Bits 21-24 = 2: Diagonal line style = medium solid line'); + $3: FDetails.Add('Bits 21-24 = 3: Diagonal line style = dashed line'); + $4: FDetails.Add('Bits 21-24 = 4: Diagonal line style = dotted line'); + $5: FDetails.Add('Bits 21-24 = 5: Diagonal line style = thick solid line'); + $6: FDetails.Add('Bits 21-24 = 6: Diagonal line style = double solid line'); + $7: FDetails.Add('Bits 21-24 = 7: Diagonal line style = hair line'); + $8: FDetails.Add('Bits 21-24 = 8: Diagonal line style = medium dashed'); + $9: FDetails.Add('Bits 21-24 = 9: Diagonal line style = thin dash-dotted'); + $A: FDetails.Add('Bits 21-24 = 10: Diagonal line style = medium dash-dotted'); + $B: FDetails.Add('Bits 21-24 = 11: Diagonal line style = thin dash-dot-dotted'); + $C: FDetails.Add('Bits 21-24 = 12: Diagonal line style = medium dash-dot-dotted'); + $D: FDetails.Add('Bits 21-24 = 13: Diagonal line style = slanted medium dash-dotted'); + end; + case (dw and $FC000000) shr 26 of + $00: FDetails.Add('Bits 26-31 = 0: Fill pattern = No fill'); + $01: FDetails.Add('Bits 26-31 = 1: Fill pattern = solid fill'); + $02: FDetails.Add('Bits 26-31 = 2: Fill pattern = medium fill'); + $03: FDetails.Add('Bits 26-31 = 3: Fill pattern = dense fill'); + $04: FDetails.Add('Bits 26-31 = 4: Fill pattern = sparse fill'); + $05: FDetails.Add('Bits 26-31 = 5: Fill pattern = horizontal fill'); + $06: FDetails.Add('Bits 26-31 = 6: Fill pattern = vertical fill'); + $07: FDetails.Add('Bits 26-31 = 7: Fill pattern = backslash fill'); + $08: FDetails.Add('Bits 26-31 = 8: Fill pattern = slash fill'); + $09: FDetails.Add('Bits 26-31 = 9: Fill pattern = coarse medium fill'); + $0A: FDetails.Add('Bits 26-31 = 10: Fill pattern = coarse medium horiz fill'); + $0B: FDetails.Add('Bits 26-31 = 11: Fill pattern = sparse horizontal fill'); + $0C: FDetails.Add('Bits 26-31 = 12: Fill pattern = sparse vertical fill'); + $0D: FDetails.Add('Bits 26-31 = 13: Fill pattern = sparse backslash fill'); + $0E: FDetails.Add('Bits 26-31 = 14: Fill pattern = sparse slash fill'); + $0F: FDetails.Add('Bits 26-31 = 15: Fill pattern = cross fill'); + $10: FDetails.Add('Bits 26-31 = 16: Fill pattern = dense backslash fill'); + $11: FDetails.Add('Bits 26-31 = 17: Fill pattern = very sparse fill'); + $12: FDetails.Add('Bits 26-31 = 18: Fill pattern = extremely sparse fill'); + end; + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.8x', [dw]), + 'Cell border lines and background area (cont''d)'); + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Cell border lines and background area (cont''d):'#13); + FDetails.Add(Format('Bits 0-6 = %d: Color index for pattern color', [(w and $007F)])); + FDetails.Add(Format('Bits 7-13 = %d: Color index for pattern background color', [(w and $3F80) shr 7])); + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.4x', [w]), + 'Cell border lines and background area (cont''d)'); + end; + + if FFormat = sfExcel5 then begin + numBytes := 4; + Move(FBuffer[FBufferIndex], dw, numBytes); + dw := DWordLEToN(dw); + if Row = FCurrRow then begin + FDetails.Add('Cell border lines and background area:'#13); + FDetails.Add(Format('Bits 0-6 = %d: Color index for pattern color', [(dw and $007F)])); + FDetails.Add(Format('Bits 7-13 = %d: Color index for pattern background color', [(dw and $3F80) shr 7])); + case (dw and $003F0000) shr 16 of + $00: FDetails.Add('Bits 16-21 = 0: Fill pattern = No fill'); + $01: FDetails.Add('Bits 16-21 = 1: Fill pattern = solid fill'); + $02: FDetails.Add('Bits 16-21 = 2: Fill pattern = medium fill'); + $03: FDetails.Add('Bits 16-21 = 3: Fill pattern = dense fill'); + $04: FDetails.Add('Bits 16-21 = 4: Fill pattern = sparse fill'); + $05: FDetails.Add('Bits 16-21 = 5: Fill pattern = horizontal fill'); + $06: FDetails.Add('Bits 16-21 = 6: Fill pattern = vertical fill'); + $07: FDetails.Add('Bits 16-21 = 7: Fill pattern = backslash fill'); + $08: FDetails.Add('Bits 16-21 = 8: Fill pattern = slash fill'); + $09: FDetails.Add('Bits 16-21 = 9: Fill pattern = coarse medium fill'); + $0A: FDetails.Add('Bits 16-21 = 10: Fill pattern = coarse medium horiz fill'); + $0B: FDetails.Add('Bits 16-21 = 11: Fill pattern = sparse horizontal fill'); + $0C: FDetails.Add('Bits 16-21 = 12: Fill pattern = sparse vertical fill'); + $0D: FDetails.Add('Bits 16-21 = 13: Fill pattern = sparse backslash fill'); + $0E: FDetails.Add('Bits 16-21 = 14: Fill pattern = sparse slash fill'); + $0F: FDetails.Add('Bits 16-21 = 15: Fill pattern = cross fill'); + $10: FDetails.Add('Bits 16-21 = 16: Fill pattern = dense backslash fill'); + $11: FDetails.Add('Bits 16-21 = 17: Fill pattern = very sparse fill'); + $12: FDetails.Add('Bits 16-21 = 18: Fill pattern = extremely sparse fill'); + end; + case dw and $01C00000 shr 22 of + $0: FDetails.Add('Bits 22-24 = 0: Bottom line style = No line'); + $1: FDetails.Add('Bits 22-24 = 1: Bottom line style = thin solid line'); + $2: FDetails.Add('Bits 22-24 = 2: Bottom line style = medium solid line'); + $3: FDetails.Add('Bits 22-24 = 3: Bottom line style = dashed line'); + $4: FDetails.Add('Bits 22-24 = 4: Bottom line style = dotted line'); + $5: FDetails.Add('Bits 22-24 = 5: Bottom line style = thick solid line'); + $6: FDetails.Add('Bits 22-24 = 6: Bottom line style = double solid line'); + $7: FDetails.Add('Bits 22-24 = 7: Bottom line style = hair line'); + end; + FDetails.Add(Format('Bits 25-31 = %d: Color index for bottom line color', [(dw and $FE000000) shr 25])); + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.8x', [dw]), + 'Cell border lines & background area'); + + numBytes := 4; + Move(FBuffer[FBufferIndex], dw, numBytes); + dw := DWOrdLEToN(dw); + if Row = FCurrRow then begin + FDetails.Add('Cell border lines (cont''d):'#13); + case dw and $00000007 of + $00: FDetails.Add('Bits 0-2 = 0: Top border = No line'); + $01: FDetails.Add('Bits 0-2 = 1: Top border = thin solid line'); + $02: FDetails.Add('Bits 0-2 = 2: Top border = medium solid line'); + $03: FDetails.Add('Bits 0-2 = 3: Top border = dashed line'); + $04: FDetails.Add('Bits 0-2 = 4: Top border = dotted line'); + $05: FDetails.Add('Bits 0-2 = 5: Top border = thick solid line'); + $06: FDetails.Add('Bits 0-2 = 6: Top border = double solid line'); + $07: FDetails.Add('Bits 0-2 = 7: Top border = hair line'); + end; + case (dw and $00000038) shr 3 of + $0000: FDetails.Add('Bits 3-5 = 0: Left border = No line'); + $0001: FDetails.Add('Bits 3-5 = 1: Left border = thin solid line'); + $0002: FDetails.Add('Bits 3-5 = 2: Left border = medium solid line'); + $0003: FDetails.Add('Bits 3-5 = 3: Left border = dashed line'); + $0004: FDetails.Add('Bits 3-5 = 4: Left border = dotted line'); + $0005: FDetails.Add('Bits 3-5 = 5: Left border = thick solid line'); + $0006: FDetails.Add('Bits 3-5 = 6: Left border = double solid line'); + $0007: FDetails.Add('Bits 3-5 = 7: Left border = hair line'); + end; + case (dw and $000001C0) shr 6 of + $0000: FDetails.Add('Bits 6-8 = 0: Right border = No line'); + $0010: FDetails.Add('Bits 6-8 = 1: Right border = thin solid line'); + $0020: FDetails.Add('Bits 6-8 = 2: Right border = medium solid line'); + $0030: FDetails.Add('Bits 6-8 = 3: Right border = dashed line'); + $0040: FDetails.Add('Bits 6-8 = 4: Right border = dotted line'); + $0050: FDetails.Add('Bits 6-8 = 5: Right border = thick solid line'); + $0060: FDetails.Add('Bits 6-8 = 6: Right border = double solid line'); + $0070: FDetails.Add('Bits 6-8 = 7: Right border = hair line'); + end; + FDetails.Add(Format('Bits 9-15 = %d: Color index for top line color', [(dw and $0000FE00) shr 7])); + FDetails.Add(Format('Bits 16-22 = %d: Color index for left line color', [(dw and $007F0000) shr 16])); + FDetails.Add(Format('Bits 23-29 = %d: Color index for right line color', [(dw and $3F800000) shr 23])); + end; + ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.8x', [dw]), + 'Cell border lines (cont''d)'); + end; + end; +end; + + +procedure TBIFFGrid.ShowXFCRC; +var + numBytes: Integer; + w: Word; + dw: DWord; +begin + RowCount := FixedRows + 7; + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.4x', [wordLEToN(w)]), + 'Future record type'); + + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Attributes:'#13); + if w and $0001 = 0 + then FDetails.Add('Bit 0 = 0: The containing record does not specify a range of cells.') + else FDetails.Add('Bit 0 = 1: The containing record specifies a range of cells.'); + FDetails.Add('Bit 1: specifies wether to alert the user of possible problems '+ + 'when saving the file whithout having reckognized this record.'); + FDetails.Add('Bits 2-15: reserved (MUST be zero, MUST be ignored)'); + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.4x', [w]), + 'Attributes'); + + numbytes := 4; + Move(FBuffer[FBufferIndex], dw, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(DWordLEToN(dw)), 'Reserved'); + Move(FBuffer[FBufferIndex], dw, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(DWordLEToN(dw)), 'Reserved'); + + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.4x', [w]), 'Reserved'); + + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(w), + 'Count of XF records'); + + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.4x)', [w,w]), + 'Checksum of XF records'); +end; + + +procedure TBIFFGrid.ShowXFEXT; +var + numBytes: Integer; + w: Word; + dw: DWord; + i, n: Integer; + et: Word; + es: Word; + ct: Word; + buffidx: Cardinal; + s: String; +begin + BeginUpdate; + + RowCount := FixedRows + 100; + + numBytes := 2; + Move(FBuffer[FBufferIndex], w, numBytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.4x', [wordLEToN(w)]), + 'Future record type'); + + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Attributes:'#13); + if w and $0001 = 0 + then FDetails.Add('Bit 0 = 0: The containing record does not specify a range of cells.') + else FDetails.Add('Bit 0 = 1: The containing record specifies a range of cells.'); + FDetails.Add('Bit 1: specifies wether to alert the user of possible problems '+ + 'when saving the file whithout having reckognized this record.'); + FDetails.Add('Bits 2-15: reserved (MUST be zero, MUST be ignored)'); + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.4x', [w]), + 'Attributes'); + + numbytes := 4; + Move(FBuffer[FBufferIndex], dw, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(DWordLEToN(dw)), 'Reserved'); + Move(FBuffer[FBufferIndex], dw, numbytes); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(DWordLEToN(dw)), 'Reserved'); + + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.4x', [w]), 'Reserved'); + + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.4x)', [w,w]), + 'XF index'); + + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('$%.4x', [w]), 'Reserved'); + + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(w), + 'Number of extension properties'); + n := w; + + for i:=1 to n do begin + buffidx := FBufferIndex; + numbytes := 2; + Move(FBuffer[FBufferIndex], et, numbytes); + et := WordLEToN(et); + if Row = FCurrRow then begin + FDetails.Add('Type:'#13); + case et of + $04: FDetails.Add('Full color extension that specifies the cell interior foreground color.'); + $05: FDetails.Add('Full color extension that specifies the cell interior background color.'); + $06: FDetails.Add('Gradient extension that specifies a cell interior gradient fill.'); + $07: FDetails.Add('Full color extension that specifies the top cell border color.'); + $08: FDetails.Add('Full color extension that specifies the bottom cell border color.'); + $09: FDetails.Add('Full color extension that specifies the left cell border color.'); + $0A: FDetails.Add('Full color extension that specifies the right cell border color.'); + $0B: FDetails.Add('Full color extension that specifies the diagonal cell border color.'); + $0D: FDetails.Add('Full color extension that specifies the cell text color.'); + $0E: FDetails.Add('2-byte unsigned integer that specifies a font scheme.'); + $0F: FDetails.Add('2-byte unsigned integer that specifies the text indentation level (MUST be <= 250).'); + end; + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.4x)', [et, et]), + Format('Extension property #%d: Type', [i])); + Move(FBuffer[FBufferIndex], es, numbytes); + es := WordLEToN(es); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(es), + Format('Extension property #%d: Data size', [i])); + + case et of + $04, $05, $07..$0D: // FullColorExt + begin + numbytes := 2; + Move(FBuffer[FBufferIndex], ct, numbytes); + ct := WordLEToN(ct); + if Row = FCurrRow then begin + FDetails.Add('Full color extension - Color type:'#13); + case ct of + 0: FDetails.Add('0 - Automatic color'); + 1: FDetails.Add('1 - Indexed color'); + 2: FDetails.Add('2 - RGB color'); + 3: FDetails.Add('3 - Theme color'); + 4: FDetails.Add('4 - Color not set'); + end; + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(ct), + Format('Extension property #%d (Full color extension): Color type', [i])); + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(integer(w)), + Format('Extension property #%d (Full color extension): Color tint', [i])); + numbytes := 4; + Move(FBuffer[FBufferIndex], dw, numbytes); + dw := DWordLEToN(dw); + case ct of + 0: s := '(dummy - MUST be 0)'; + 1: s := '(index)'; + 2: s := '(RGB value)'; + 3: s := '(theme)'; + else s := ''; + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.8x)', [dw, dw]), + Format('Extension property #%d (Full color extension): value %s', [i, s])); + numbytes := 4; + Move(FBuffer[FBufferIndex], dw, numbytes); + dw := DWordLEToN(dw); + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.8x)', [dw, dw]), + Format('Extension property #%d (Full color extension): Reserved', [i])); + Move(FBuffer[FBufferIndex], dw, numbytes); + dw := DWordLEToN(dw); + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.8x)', [dw, dw]), + Format('Extension property #%d (Full color extension): Reserved', [i])); + end; + + $06: // Gradient + begin + ShowInRow(FCurrRow, FBufferIndex, es, '(var)', + Format('Extension property #%d (Gradient): - not interpreted here -', [i])); + end; + + $0E: // Font scheme + begin + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + if Row = FCurrRow then begin + FDetails.Add('Font scheme:'#13); + case w of + 0: FDetails.Add('0 - No font scheme'); + 1: FDetails.Add('1 - Major scheme'); + 2: FDetails.Add('2 - Minor scheme'); + 3: FDetails.Add('3 - Ninched scheme'); + end; + end; + ShowInRow(FCurrRow, FBufferIndex, numbytes, Format('%d ($%.4x)', [w,w]), + Format('Extension property #%d Font scheme', [i])); + end; + + $0F: // Text indentation level + begin + numbytes := 2; + Move(FBuffer[FBufferIndex], w, numbytes); + w := WordLEToN(w); + ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(w), + Format('Extension property #%d Text indentation level', [i])); + end; + end; + FBufferIndex := buffidx + es; + end; + RowCount := FCurrRow; + + EndUpdate(true); +end; + + +end. + diff --git a/components/fpspreadsheet/reference/BIFFExplorer/bebiffutils.pas b/components/fpspreadsheet/reference/BIFFExplorer/bebiffutils.pas new file mode 100644 index 000000000..4dc81184a --- /dev/null +++ b/components/fpspreadsheet/reference/BIFFExplorer/bebiffutils.pas @@ -0,0 +1,708 @@ +unit beBIFFUtils; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils; + +function BOFName(ACode: Word): String; +function CodePageName(AID: Word): String; +function RecTypeName(ARecType: Word): String; +function SheetFuncName(AIndex: Word): String; +function ErrorCodeName(ACode: Byte): String; + + +implementation + +function BOFName(ACode: Word): String; +begin + case ACode of + $0005: Result := 'Workbook globals'; + $0006: Result := 'Visual Basic module'; + $0010: Result := 'Sheet or dialog'; + $0020: Result := 'Chart'; + $0040: Result := 'Macro sheet'; + $0100: Result := 'Workspace'; + else Result := ''; + end; +end; + +function CodePageName(AID: Word): String; +begin + case AID of + $0016: Result := 'ASCII'; + $01B5: Result := 'IBM PC CP-437 (US)'; + $02D0: Result := 'IBM PC CP-720 (OEM Arabic)'; + $02E1: Result := 'IBM PC CP-737 (Greek)'; + $0307: Result := 'IBM PC CP-775 (Baltic)'; + $0352: Result := 'IBM PC CP-850 (Latin I)'; + $0354: Result := 'IBM PC CP-852 (Latin II (Central European))'; + $0357: Result := 'IBM PC CP-855 (Cyrillic)'; + $0359: Result := 'IBM PC CP-857 (Turkish)'; + $035A: Result := 'IBM PC CP-858 (Multilingual Latin I with Euro)'; + $035C: Result := 'IBM PC CP-860 (Portuguese)'; + $035D: Result := 'IBM PC CP-861 (Icelandic)'; + $035E: Result := 'IBM PC CP-862 (Hebrew)'; + $035F: Result := 'IBM PC CP-863 (Canadian (French))'; + $0360: Result := 'IBM PC CP-864 (Arabic)'; + $0361: Result := 'IBM PC CP-865 (Nordic)'; + $0362: Result := 'IBM PC CP-866 (Cyrillic (Russian))'; + $0365: Result := 'IBM PC CP-869 (Greek (Modern))'; + $036A: Result := 'Windows CP-874 (Thai)'; + $03A4: Result := 'Windows CP-932 (Japanese Shift-JIS)'; + $03A8: Result := 'Windows CP-936 (Chinese Simplified GBK)'; + $03B5: Result := 'Windows CP-949 (Korean (Wansung))'; + $03B6: Result := 'Windows CP-950 (Chinese Traditional BIG5)'; + $04B0: Result := 'UTF-16 (BIFF8)'; + $04E2: Result := 'Windows CP-1250 (Latin II) (Central European)'; + $04E3: Result := 'Windows CP-1251 (Cyrillic)'; + $04E4: Result := 'Windows CP-1252 (Latin I) (BIFF4-BIFF5)'; + $04E5: Result := 'Windows CP-1253 (Greek)'; + $04E6: Result := 'Windows CP-1254 (Turkish)'; + $04E7: Result := 'Windows CP-1255 (Hebrew)'; + $04E8: Result := 'Windows CP-1256 (Arabic)'; + $04E9: Result := 'Windows CP-1257 (Baltic)'; + $04EA: Result := 'Windows CP-1258 (Vietnamese)'; + $0551: Result := 'Windows CP-1361 (Korean (Johab))'; + $2710: Result := 'Apple Roman'; + $8000: Result := 'Apple Roman'; + $8001: Result := 'Windows CP-1252 (Latin I) (BIFF2-BIFF3)'; + else Result := ''; + end; +end; + +function ErrorCodeName(ACode: Byte): String; +begin + case ACode of + $00: Result := '#NULL! - Intersection of two cell ranges is empty'; + $07: Result := '#DIV/0! - Division by zero'; + $0F: Result := '#VALUE! - Wrong type of operand'; + $17: Result := '#REF! - Illegal or deleted cell reference'; + $1D: Result := '#NAME? - Wrong function or range name'; + $24: Result := '#NUM! - Value range overflow'; + $2A: Result := '#N/A - Argument or function not available'; + else Result := '(unknown)'; + end; +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'; + $0005: Result := 'BoolErr'; + $0006: Result := 'Formula'; + $0007: Result := 'String'; + $0008: Result := 'Row'; + $0009: Result := 'BOF'; + $000A: Result := 'EOF: End of file'; + $000B: Result := 'Index'; + $000C: Result := 'CALCCOUNT: Iteration count'; + $000D: Result := 'CALCMODE: Calculation mode'; + $000E: Result := 'PRECISION: Precision'; + $000F: Result := 'REFMODE: Reference mode'; + $0010: Result := 'DELTA: Iteration increment'; + $0011: Result := 'ITERATION: Iteration mode'; + $0012: Result := 'PROTECT: Protection flag'; + $0013: Result := 'PASSWORD: Protection password'; + $0014: Result := 'HEADER: Print header on each page'; + $0015: Result := 'FOOTER: Print footer on each page'; + $0016: Result := 'EXTERNCOUNT: Number of external references'; + $0017: Result := 'EXTERNSHEET: External reference'; + $0018: Result := 'DefinedName'; + $0019: Result := 'WINDOWPROTECT: Windows are protected'; + $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'; + $0020: Result := 'ColumnDefault'; + $0021: Result := 'Array'; + $0022: Result := '1904: 1904 date system'; + $0023: Result := 'ExternalName'; + $0024: Result := 'ColWidth'; + $0025: Result := 'DefaultRowHeight'; + $0026: Result := 'LEFTMARGIN: Left margin measurement'; + $0027: Result := 'RIGHTMARGIN: Right margin measurement'; + $0028: Result := 'TOPMARGIN: Top margin measurement'; + $0029: Result := 'BOTTOMMARGIN: Bottom margin measurement'; + $002A: Result := 'PRINTHEADERS: Print row/column labels'; + $002B: Result := 'PRINTGRIDLINES: Print gridlines flag'; + $002F: Result := 'FILEPASS: File is password-protected'; + $0031: Result := 'FONT: Font and font formatting information'; + $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'; + $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'; + $0044: Result := 'IXFE'; + $0045: Result := 'FontColor'; + $004D: Result := 'PLS: Environment-specific print record'; + $0050: Result := 'DCON: Data consolidation information'; + $0051: Result := 'DCONREF: Data consolidation references'; + $0055: Result := 'DEFCOLWIDTH: Default width for columns'; + $0056: Result := 'BuiltInFmtCount'; + $0059: Result := 'XCT: CRN record count'; + $005A: Result := 'CRN: Non-resident operands'; + $005B: Result := 'FILESHARING: File-sharing information'; + $005C: Result := 'WRITEACCESS: Write access user name'; + $005E: Result := 'UNCALCED: Recalculation status'; + $005F: Result := 'SAVERECALC: Recalculate before saving'; + $0060: Result := 'TEMPLATE: Workbook is a template'; + $0063: Result := 'OBJPROTECT: Objects are protected'; + $007D: Result := 'COLINFO: Column formatting information'; + $007E: Result := 'RK: Cell value, RK number'; + $007F: Result := 'IMDATA: Image data'; + $0080: Result := 'GUTS: Size of row and column gutters'; + $0081: Result := 'SHEETPR: Additional workspace information'; + $0082: Result := 'GRIDSET: State change of Gridlines option'; + $0083: Result := 'HCENTER: Center between horizontal margins'; + $0084: Result := 'VCENTER: Center between vertical margins'; + $0085: Result := 'BOUNDSSHEET: Sheet information'; + $0086: Result := 'WRITEPROT: Workbook is write-protected'; + $0087: Result := 'ADDIN: Workbook is an add-in macro'; + $0088: Result := 'EDG: Edition globals'; + $0089: Result := 'PUB: Publisher'; + $008C: Result := 'COUNTRY: Default country and WIN.INI country'; + $008D: Result := 'HIDEOBJ: Object display options'; + $0090: Result := 'SORT: Sorting options'; + $0091: Result := 'SUB: Subscriber'; + $0092: Result := 'PALETTE: Color palette definition'; + $0094: Result := 'LHRECORD: .WK? file conversion information'; + $0095: Result := 'LHNGRAPH: Named graph information'; + $0096: Result := 'SOUND: Sound note'; + $0098: Result := 'LPR: Sheet was printed using LINE.PRINT()'; + $0099: Result := 'STANDARDWIDTH: Standard column width'; + $009A: Result := 'FNGROUPNAME: Function group name'; + $009B: Result := 'FILTERMODE: Sheet contains filtered list'; + $009C: Result := 'FNGROUPCOUNT: Built-in function group count'; + $009D: Result := 'AUTOFILTERINFO: Drop-down arrow count'; + $009E: Result := 'AUTOFILTER: AutoFilter data'; + $00A0: Result := 'SCL: Window zoom magnification'; + $00A1: Result := 'SETUP: PageSetup'; + $00A9: Result := 'COORDLIST: Polygon object vertex coordinates'; + $00AB: Result := 'GCW: Global column width flags'; + $00AE: Result := 'SCENMAN: Scenario output data'; + $00AF: Result := 'SCENARIO: Scenario data'; + $00B0: Result := 'SXVIEW: View definition'; + $00B1: Result := 'SXVD: View fields'; + $00B2: Result := 'SXVI: View item'; + $00B4: Result := 'SXIVD: Row/column field IDs'; + $00B5: Result := 'SXLI: Line item array'; + $00B6: Result := 'SXPI: Page item'; + $00B8: Result := 'DOCROUTE: Routing slip information'; + $00B9: Result := 'RECIPNAME: Recipient name'; + $00BC: Result := 'SHRFMLA: Shared formula'; + $00BD: Result := 'MULRK: Multiple RK cells'; + $00BE: Result := 'MULBLANK: Multiple blank cells'; + $00C1: Result := 'MMS: ADDMENU/DELMENU record group count'; + $00C2: Result := 'ADDMENU: Menu addition'; + $00C3: Result := 'DELMENU: Menu deletion'; + $00C5: Result := 'SXDI: Data item'; + $00C6: Result := 'SXDB: Pivot table cache data'; + $00CD: Result := 'SXSTRING: String'; + $00D0: Result := 'SXTBL: Multiple consolidation source info'; + $00D1: Result := 'SXBRGIITM: Page item name count'; + $00D2: Result := 'SXTBPG: Page item indexex'; + $00D3: Result := 'OBPROJ: Visual Basic project'; + $00D5: Result := 'SXIDSTM: Stream ID'; + $00D6: Result := 'RSTRING: Cell with character formatting'; + $00D7: Result := 'DBCELL: Stream offsets'; + $00DA: Result := 'BOOKBOOL: Workbook option flag'; + $00DC: Result := 'PARAMQRY: Query parameters'; // also: SXEXT: External source information + $00DD: Result := 'SCENPROTECT: Scenario Protection'; + $00DE: Result := 'OLESIZE: Size of OLE object'; + $00DF: Result := 'UDDESC: Description format for chart autoformat'; + $00E0: Result := 'XF: Extended format'; + $00E1: Result := 'INTERFACEHDR: Beginning of user interface records'; + $00E2: Result := 'INTERFACEEND: End of user interface records'; + $00E3: Result := 'SXVS: View source'; + $00E5: Result := 'MEGECELLS: Merged cells'; + $00E9: Result := 'Bitmap'; + $00EA: Result := 'TABIDCONF: Sheet Tab ID of conflict history'; + $00EB: Result := 'MSODRAWINGGROUP: Microsoft Office drawing group'; + $00EC: Result := 'MSODRAWING: Microsoft Office drawing'; + $00ED: Result := 'MSODRAWINGSELECTION: Microsoft Office drawing selection'; + $00EF: Result := 'PhoneticPR'; + $00F0: Result := 'SXRULE: PivotTable rule data'; + $00F1: Result := 'SXEX: PivotTable view extended information'; + $00F2: Result := 'SXFILT: PivotTable rule filter'; + $00F4: Result := 'SXDXF: PivotTable formatting'; + $00F5: Result := 'SXITM: PivotTable item indexes'; + $00F6: Result := 'SXNAME: PivotTable name'; + $00F7: Result := 'SXSELECT: PivotTable selection information'; + $00F8: Result := 'SXPAIR: PivotTable name pair'; + $00F9: Result := 'SXFMLA: PivotTable parsed expression'; + $00FB: Result := 'SXFORMAT: PivotTable format record'; + $00FC: Result := 'SST: Shared string table'; + $00FD: Result := 'LABELSST: Cell value, string constant/SST'; + $00FF: Result := 'EXTSST: extended shared string table'; + $013D: Result := 'TABID: Sheet tab index array'; + $015F: Result := 'LabelRanges'; + $0160: Result := 'USESELFS: Natural language formulas flag'; + $0161: Result := 'DSF: Double stream file'; + $0162: Result := 'XL5MODIFY: Flag for DSF'; + $01AE: Result := 'SUPBOOK: Supporting workbook'; + $01AF: Result := 'PROT4REV: Shared workbook protection flag'; + $01B0: Result := 'CONDFMT: Conditional formatting range information'; + $01B1: Result := 'CF: Conditional formatting conditions'; + $01B2: Result := 'DVAL: Data validation information'; + $01B5: Result := 'DCONBIN: Data consolidation information'; + $01B6: Result := 'TXO: Text object'; + $01B7: Result := 'REFRESHALL: Refresh flag'; + $01B8: Result := 'HLINK: Hyperlink'; + $01BA: Result := 'CODENAME: Name of the workbook object'; + $01BB: Result := 'SXFDBTYPE: SQL datatype identifier'; + $01BC: Result := 'PROT4REVPASS: Shared workbook protection password'; + $01BE: Result := 'DV: Data validation criteria'; + $01C0: Result := 'EXCEL9FILE: Excel 9 file'; + $01C1: Result := 'RECALCID: Recalc information'; + $0200: Result := 'DIMENSIONS: Cell table size'; + $0201: Result := 'BLANK: Cell Value, blank cell'; + $0203: Result := 'NUMBER: Cell value, floating-point cell'; + $0204: Result := 'LABEL: Cell value, string constant'; + $0205: Result := 'BOOLERR: Cell Value, boolean or error'; + $0206: Result := 'Formula'; + $0207: Result := 'STRING: String value of a formula'; + $0208: Result := 'ROW: Describes a row'; + $0209: Result := 'BOF'; + $020B: Result := 'INDEX: Index record'; + $0218: Result := 'NAME: Defined name'; + $0221: Result := 'ARRAY: Array-entered formula'; + $0223: Result := 'EXTERNNAME: Externally referenced name'; + $0225: Result := 'DEFAULTROWHEIGHT: Default row height'; + $0231: Result := 'FONT: Font description'; + $0236: Result := 'TABLE: Data table'; + $023E: Result := 'WINDOW2: Sheet window information'; + $0243: Result := 'XF'; + $027E: Result := 'RK'; + $0293: Result := 'STYLE: Style information'; + $0406: Result := 'FORMULA: Cell formula'; + $0409: Result := 'BOF'; + $041E: Result := 'FORMAT: Number format'; + $0443: Result := 'XF'; + $04BC: Result := 'SharedFormula'; + $0800: Result := 'HLINKTOOLTOP: Hyperlink tooltip'; + $0801: Result := 'WEBPUB: Web publish item'; + $0802: Result := 'QSISXTAG: PivotTable and query table extensions'; + $0803: Result := 'DBQUERYEXT: Database query extensions'; + $0804: Result := 'EXTSTRING: FRT string'; + $0805: Result := 'TXTQUERY: Text query information'; + $0806: Result := 'QSIR: Query table formatting'; + $0807: Result := 'QSIF: Query table field formatting'; + $0809: Result := 'BOF: Beginning of file'; + $080A: Result := 'OLEDBCONN: OLE database connection'; + $080B: Result := 'WOPT: Web options'; + $080C: Result := 'SXVIEWEX: Pivot table OLAP extensions'; + $080D: Result := 'SXTH: Pivot table OLAP hierarchy'; + $080E: Result := 'SXPIEX: OLAP page item extensions'; + $080F: Result := 'SXVDTEX: View dimension OLAP extensions'; + $0810: Result := 'SXVIEWX9: Pivot table extensions'; + $0812: Result := 'CONTINUEFRT: Continued FRT'; + $0813: Result := 'REALTIMEDATA: Real-time data (RTD)'; + $0850: Result := 'CHARTFRTINFO: Future record identifiers'; + $0852: Result := 'STARTBLOCK: Beginning of a collection of records'; + $0853: Result := 'ENDBLOCK: End of a collection of records'; + $0862: Result := 'SHEETEXT: Extra sheet info'; + $0863: Result := 'BOOKEXT: Extra book info'; + $0864: Result := 'SXADDL: Pivot table additional info'; + $0865: Result := 'CRASHRECERR: Crash recovery error'; + $0866: Result := 'HFPICTURE: Header/footer picture'; + $0867: Result := 'FEATHEADR: Shared feature header'; + $0868: Result := 'FEAT: Shared feature record'; + $086A: Result := 'DATALABEXT: Chart data label extension'; + $086B: Result := 'DATALABEXTCONTENTS: Chart data label extension contents'; + $086C: Result := 'CELLWATCH: Cell watch'; + $086D: Result := 'FEATINFO: Shared feature info record'; + $0871: Result := 'FEATHEADR11: Shared feature header 11'; + $0872: Result := 'FEAT11: Shared feature 11 record'; + $0873: Result := 'FEATINFO11: Shared feature info 11 record'; + $0874: Result := 'DROPDOWNOBJIDS: Drop down opbject'; + $0875: Result := 'CONTINUEFRT11: Continue FRT 11'; + $0876: Result := 'DCONN: Data connection'; + $0877: Result := 'LIST12: Extra table data introduced in Excel 2007'; + $0878: Result := 'FEAT12: Shared feature 12 record'; + $0879: Result := 'CONDFMT12: Conditional formatting range information 12'; + $087A: Result := 'CF12: Conditional formatting condition 12'; + $087B: Result := 'CFEX: Conditional formatting extension'; + $087C: Result := 'XFCRC: XF extension checksum'; + $087D: Result := 'XFEXT: XF extension'; + $087E: Result := 'EZFILTER12: Autofilter data introduced in Excel 2007'; + $087F: Result := 'CONTINUEFRT12: Continue FRT 12'; + $0881: Result := 'SXADDL12: Additional workbook connections information'; + $0884: Result := 'MDTINFO: Information about a metadata type'; + $0885: Result := 'MDXSTR: MDX metadata string'; + $0886: Result := 'MDXTUPLE: Tuple MDX metadata'; + $0887: Result := 'MDXSET: Set MDX metadata'; + $0888: Result := 'MDXPROP: Member property MDX metadata'; + $0889: Result := 'MDXKPI: Key performance indicator MDX metadata'; + $088A: Result := 'MDTB: Block of metadata records'; + $088B: Result := 'PLV: Page layout view settings in Excel 2007'; + $088C: Result := 'COMPAR12: Compatibility checker 12'; + $088D: Result := 'DXF: Differential XF'; + $088E: Result := 'TABLESTYLES: Table styles'; + $088F: Result := 'TABLESTYLE: Table style'; + $0890: Result := 'TABLESTYLEELEMENT: Table style element'; + $0892: Result := 'STYLEEXT: Named cell style extension'; + $0893: Result := 'NAMEPUBLISH: Publish to Excel server data for name'; + $0894: Result := 'NAMECMT: Name comment'; + $0895: Result := 'SORTDATA12: Sort data 12'; + $0896: Result := 'THEME: Theme'; + $0897: Result := 'GUIDTYPELIB: VB project typelib GUID'; + $0898: Result := 'FNGRP12: Function group'; + $0899: Result := 'NAMEFNGRP12: Extra function group'; + $089A: Result := 'MTRSETTINGS: Multi-threaded calculation settings'; + $089B: Result := 'COMPRESSPICTURES: Automatic picture compression mode'; + $089C: Result := 'HEADERFOOTER: Header footer'; + $089E: Result := 'CRTMLFRT: Additional properties for chart elements'; + $08A3: Result := 'FORCEFULLCALCULATION: Force full calculation settings'; + $08A4: Result := 'SHAPEPROPSSTREAM: Shape formatting properties for chart elements'; + $08A5: Result := 'TEXTPROPSSTREAM: Additional text properties for text in entire chart'; + $08A7: Result := 'CRTLAYOUT12A: Layout information for a plot area'; + $08C1: Result := 'LISTOBJ: List object'; + $08C2: Result := 'LISTFIELD: List field'; + $08C3: Result := 'LISTDV: List data validation'; + $08C4: Result := 'LISTCONDFMT: List conditional formatting'; + $08C5: Result := 'LIST CF: List cell formatting'; + $08C6: Result := 'FMQRY: Filemaker queries'; + $08C7: Result := 'FMSQRY: Filemaker queries'; + $08C8: Result := 'PLV: Page layout view in Mac Excel 11'; + $08C9: Result := 'LNEXT: Extenstion information for borders in Mac Office 11'; + $08CA: Result := 'MKREXT: Extension information for markers in Mac Office 11'; + $08CB: Result := 'CRTCOOPT: Color options for chart series in Mac Office 11'; + $1001: Result := 'UNITS: ignored'; + $1002: Result := 'CHART: Position and size of chart area'; + $1003: Result := 'SERIES: Properties of the data for a series, a trendline, or error bars'; + $1004: Result := 'CHSOURCELINK: Source of data series'; + $1006: Result := 'DATAFORMAT: Formatting properties for data point or series'; + $1007: Result := 'CHLINEFORMAT: Formatting attributes of line or border'; + $1009: Result := 'MARKERFORMAT: Color, size, and shape of data markers'; + $100A: Result := 'AREAFORMAT: Patterns and colors in filled chart region'; + $100B: Result := 'PIEFORMAT: Distance of a data point(s) from pie'; + $100C: Result := 'ATTACHEDLABEL: Properties of series data label'; + $100D: Result := 'CHSTRING: Category name of series, or text for text box in chart'; + $1014: Result := 'CHARTFORMAT: Properties of a chart group'; + $1015: Result := 'LEGEND: Properties of a legend'; + $1016: Result := 'SERIESLIST: Specifies the series for the chart'; + $1017: Result := 'BAR: identifies a bar/column chart group'; + $1018: Result := 'LINE: identifies a line chart group'; + $1019: Result := 'PIE: identifies a pie/doughnut chart group'; + $101A: Result := 'AREA: identifies an area chart group'; + $101B: Result := 'SCATTER: identifies scatter or bubble chart group'; + $101D: Result := 'AXIS: Properties of an axis'; + $101E: Result := 'TICK: Attributes of axis labels and ticks'; + $101F: Result := 'VALUERANGE: Properties of value axis'; + $1021: Result := 'CHAXISLINE: Part of the axis specified by the LINEFORMAT record'; + $1022: Result := 'CRTLINK: not used'; + $1024: Result := 'DEFAULTTEXT: Text elements formatted by TEXT record'; + $1025: Result := 'TEXT: Properties of an attached label'; + $1026: Result := 'FONTX: Font for a given text element'; + $1027: Result := 'OBJECTLINK: specifies object on chart, or entire chart, to which TEXT record is linked.'; + $1032: Result := 'CHFRAME: Border and area formatting of chart'; + $1033: Result := 'CHBEGIN: Indicates begin of a chart record block'; + $1034: Result := 'CHEND: Indicates end of a chart record block'; + $1035: Result := 'PLOTAREA: empty --> see FRAME record specifying plot area properties'; + $103A: Result := 'CHART3D: plot area of the chart group is rendered in a 3-D'; + $103C: Result := 'PICF: Layout of a picture attached to a picture-filled chart elemen'; + $103D: Result := 'DROPBAR: attributes of the up/down bars between multiple series of line chart group'; + $103E: Result := 'RADAR: identifies a radar chart group'; + $103F: Result := 'SURF: identifies a surface chart group'; + $1040: Result := 'RADARAREA: identifies a filled radar chart group'; + $1041: Result := 'AXISPARENT: Properties of an axis group'; + $1043: Result := 'LEGENDEXCEPTION: Information on legend item changed from default'; + $1044: Result := 'SHTPROPS: Chart properties defined by the Chart Sheet Substream ABNF'; + $1045: Result := 'SERTOCRT: Specifies chart group for the current series'; + $1046: Result := 'AXESUSED: Number of axis groups on the chart'; + $1048: Result := 'SBASEREF: Location of a PivotTable view referenced by a chart'; + $104A: Result := 'SERPARENT: Series to which the current trendline or error bar corresponds'; + $104B: Result := 'SERAUXTREND: Specifies a trendline'; + $104E: Result := 'IFMTRECORD: Number format to use for the text on an axis'; + $104F: Result := 'POS: Size/position for legend, attached label, or plot area'; + $1050: Result := 'ALRUNS: Rich Text Formatting within chart titles, trendline, and data labels'; + $1051: Result := 'BRAI: Reference to data used in chart'; + $105B: Result := 'SERAUXERRBAR: Error bar properties'; + $105C: Result := 'CLRTCLIENT: Custom color palette for chart'; + $105D: Result := 'SERFMT: Properties of series data points, markers, or lines'; + $105F: Result := 'CHART3DBARSHAPE: Shape of the data points in bar or column chart group'; + $1060: Result := 'FBI: Scalable font information (chart)'; + $1061: Result := 'BOPPOP: Chart group is a bar or a pie of pie chart'; + $1062: Result := 'AXCEXT: Additional extension properties of a date axis'; + $1063: Result := 'DAT: Chart Sheet Substream ABNF for data table within chart area'; + $1064: Result := 'PLOTGROWTH: Scale factors for font scaling'; + $1065: Result := 'SIINDEX: Specifies data of a chart'; + $1066: Result := 'GELFRAME: Properties of a fill pattern for parts of a chart'; + $1067: Result := 'BOPPOPCUSTOM: Series data points contained in the secondary bar/pie'; + $1068: Result := 'FBI2: Scalable font information (chart)'; + else + Result := '<unknown>'; + end; +end; + +function SheetFuncName(AIndex: Word): String; +begin + case AIndex of + 0 : result := 'COUNT'; + 1 : Result := 'IF'; + 2 : Result := 'ISNA'; + 3 : Result := 'ISERROR'; + 4 : Result := 'SUM'; + 5 : Result := 'AVERAGE'; + 6 : Result := 'MIN'; + 7 : Result := 'MAX'; + 8 : Result := 'ROW'; + 9 : Result := 'COLUMN'; + 10 : Result := 'NA'; + 11 : Result := 'NPV'; + 12 : Result := 'STDEV'; + 13 : Result := 'DOLLAR'; + 14 : Result := 'FIXED'; + 15 : Result := 'SIN'; + 16 : Result := 'COS'; + 17 : Result := 'TAN'; + 18 : Result := 'ATAN'; + 19 : Result := 'PI'; + 20 : Result := 'SQRT'; + 21 : Result := 'EXP'; + 22 : Result := 'LN'; + 23 : Result := 'LOG10'; + 24 : Result := 'ABS'; + 25 : Result := 'INT'; + 26 : Result := 'SIGN'; + 27 : Result := 'ROUND'; + 28 : Result := 'LOOKUP'; + 29 : Result := 'INDEX'; + 30 : Result := 'REPT'; + 31 : Result := 'MID'; + 32 : Result := 'LEN'; + 33 : Result := 'VALUE'; + 34 : Result := 'TRUE'; + 35 : Result := 'FALSE'; + 36 : Result := 'AND'; + 37 : Result := 'OR'; + 38 : Result := 'NOT'; + 39 : Result := 'MOD'; + 40 : Result := 'DCOUNT'; + 41 : Result := 'DSUM'; + 42 : Result := 'DAVERAGE'; + 43 : Result := 'DMIN'; + 44 : Result := 'DMAX'; + 45 : Result := 'DSTDEV'; + 46 : Result := 'VAR'; + 47 : Result := 'DVAR'; + 48 : Result := 'TEXT'; + 49 : Result := 'LINEST'; + 50 : Result := 'TREND'; + 51 : Result := 'LOGEST'; + 52 : Result := 'GROWTH'; + 56 : Result := 'PV'; + 57 : Result := 'FV'; + 58 : Result := 'NPER'; + 59 : Result := 'PMT'; + 60 : Result := 'RATE'; + 61 : Result := 'MIRR'; + 62 : Result := 'IRR'; + 63 : Result := 'RAND'; + 64 : Result := 'MATCH'; + 65 : Result := 'DATE'; + 66 : Result := 'TIME'; + 67 : Result := 'DAY'; + 68 : Result := 'MONTH'; + 69 : Result := 'YEAR'; + 70 : Result := 'WEEKDAY'; + 71 : Result := 'HOUR'; + 72 : Result := 'MINUTE'; + 73 : Result := 'SECOND'; + 74 : Result := 'NOW'; + 75 : Result := 'AREAS'; + 76 : Result := 'ROWS'; + 77 : Result := 'COLUMNS'; + 78 : Result := 'OFFSET'; + 82 : Result := 'SEARCH'; + 83 : Result := 'TRANSPOSE'; + 86 : Result := 'TYPE'; + 97 : Result := 'ATAN2'; + 98 : Result := 'ASIN'; + 99 : Result := 'ACOS'; + 100 : Result := 'CHOOSE'; + 101 : Result := 'HLOOKUP'; + 102 : Result := 'VLOOKUP'; + 105 : Result := 'ISREF'; + 109 : Result := 'LOG'; + 111 : Result := 'CHAR'; + 112 : Result := 'LOWER'; + 113 : Result := 'UPPER'; + 114 : Result := 'PROPER'; + 115 : Result := 'LEFT'; + 116 : Result := 'RIGHT'; + 117 : Result := 'EXACT'; + 118 : Result := 'TRIM'; + 119 : Result := 'REPLACE'; + 120 : Result := 'SUBSTITUTE'; + 121 : Result := 'CODE'; + 124 : Result := 'FIND'; + 125 : Result := 'CELL'; + 126 : Result := 'ISERR'; + 127 : Result := 'ISTEXT'; + 128 : Result := 'ISNUMBER'; + 129 : Result := 'ISBLANK'; + 130 : Result := 'T'; + 131 : Result := 'N'; + 140 : Result := 'DATEVALUE'; + 141 : Result := 'TIMEVALUE'; + 142 : Result := 'SLN'; + 143 : Result := 'SYD'; + 144 : Result := 'DDB'; + 148 : Result := 'INDIRECT'; + 162 : Result := 'CLEAN'; + 163 : Result := 'MDETERM'; + 164 : Result := 'MINVERSE'; + 165 : Result := 'MMULT'; + 167 : Result := 'IPMT'; + 168 : Result := 'PPMT'; + 169 : Result := 'COUNTA'; + 183 : Result := 'PRODUCT'; + 184 : Result := 'FACT'; + 189 : Result := 'DPRODUCT'; + 190 : Result := 'ISNONTEXT'; + 193 : Result := 'STDEVP'; + 194 : Result := 'VARP'; + 195 : Result := 'DSTDEVP'; + 196 : Result := 'DVARP'; + 197 : Result := 'TRUNC'; + 198 : Result := 'ISLOGICAL'; + 199 : Result := 'DCOUNTA'; + 204 : Result := 'YEN/USDOLLAR'; + 205 : Result := 'FINDB'; + 206 : Result := 'SEARCHB'; + 207 : Result := 'REPLACEB'; + 208 : Result := 'LEFTB'; + 209 : Result := 'RIGHTB'; + 210 : Result := 'MIDB'; + 211 : Result := 'LENB'; + 212 : Result := 'ROUNDUP'; + 213 : Result := 'ROUNDDOWN'; + 214 : Result := 'ASC'; + 215 : Result := 'JIS / DBCS'; + 216 : Result := 'RANK'; + 219 : Result := 'ADDRESS'; + 220 : Result := 'DAYS360'; + 221 : Result := 'TODAY'; + 222 : Result := 'VDB'; + 227 : Result := 'MEDIAN'; + 228 : Result := 'SUMPRODUCT'; + 229 : Result := 'SINH'; + 230 : Result := 'COSH'; + 231 : Result := 'TANH'; + 232 : Result := 'ASINH'; + 233 : Result := 'ACOSH'; + 234 : Result := 'ATANH'; + 235 : Result := 'DGET'; + 244 : Result := 'INFO'; + 247 : Result := 'DB'; + 252 : Result := 'FREQUENCY'; + 261 : Result := 'ERROR.TYPE'; + 269 : Result := 'AVEDEV'; + 270 : Result := 'BETADIST'; + 271 : Result := 'GAMMALN'; + 272 : Result := 'BETAINV'; + 273 : Result := 'BINOMDIST'; + 274 : Result := 'CHIDIST'; + 275 : Result := 'CHIINV'; + 276 : Result := 'COMBIN'; + 277 : Result := 'CONFIDENCE'; + 278 : Result := 'CRITBINOM'; + 279 : Result := 'EVEN'; + 280 : Result := 'EXPONDIST'; + 281 : Result := 'FDIST'; + 282 : Result := 'FINV'; + 283 : Result := 'FISHER'; + 284 : Result := 'FISHERINV'; + 285 : Result := 'FLOOR'; + 286 : Result := 'GAMMADIST'; + 287 : Result := 'GAMMAINV'; + 288 : Result := 'CEILING'; + 289 : Result := 'HYPGEOMDIST'; + 290 : Result := 'LOGNORMDIST'; + 291 : Result := 'LOGINV'; + 292 : Result := 'NEGBINOMDIST'; + 293 : Result := 'NORMDIST'; + 294 : Result := 'NORMSDIST'; + 295 : Result := 'NORMINV'; + 296 : Result := 'NORMSINV'; + 297 : Result := 'STANDARDIZE'; + 298 : Result := 'ODD'; + 299 : Result := 'PERMUT'; + 300 : Result := 'POISSON'; + 301 : Result := 'TDIST'; + 302 : Result := 'WEIBULL'; + 303 : Result := 'SUMXMY2'; + 304 : Result := 'SUMX2MY2'; + 305 : Result := 'SUMX2PY2'; + 306 : Result := 'CHITEST'; + 307 : Result := 'CORREL'; + 308 : Result := 'COVAR'; + 309 : Result := 'FORECAST'; + 310 : Result := 'FTEST'; + 311 : Result := 'INTERCEPT'; + 312 : Result := 'PEARSON'; + 313 : Result := 'RSQ'; + 314 : Result := 'STEYX'; + 315 : Result := 'SLOPE'; + 316 : Result := 'TTEST'; + 317 : Result := 'PROB'; + 318 : Result := 'DEVSQ'; + 319 : Result := 'GEOMEAN'; + 320 : Result := 'HARMEAN'; + 321 : Result := 'SUMSQ'; + 322 : Result := 'KURT'; + 323 : Result := 'SKEW'; + 324 : Result := 'ZTEST'; + 325 : Result := 'LARGE'; + 326 : Result := 'SMALL'; + 327 : Result := 'QUARTILE'; + 328 : Result := 'PERCENTILE'; + 329 : Result := 'PERCENTRANK'; + 330 : Result := 'MODE'; + 331 : Result := 'TRIMMEAN'; + 332 : Result := 'TINV'; + 336 : Result := 'CONCATENATE'; + 337 : Result := 'POWER'; + 342 : Result := 'RADIANS'; + 343 : Result := 'DEGREES'; + 344 : Result := 'SUBTOTAL'; + 345 : Result := 'SUMIF'; + 346 : Result := 'COUNTIF'; + 347 : Result := 'COUNTBLANK'; + 350 : Result := 'ISPMT'; + 351 : Result := 'DATEDIF'; + 352 : Result := 'DATESTRING'; + 353 : Result := 'NUMBERSTRING'; + 354 : Result := 'ROMAN'; + 358 : Result := 'GETPIVOTDATA'; + 359 : Result := 'HYPERLINK'; + 360 : Result := 'PHONETIC'; + 361 : Result := 'AVERAGEA'; + 362 : Result := 'MAXA'; + 363 : Result := 'MINA'; + 364 : Result := 'STDEVPA'; + 365 : Result := 'VARPA'; + 366 : Result := 'STDEVA'; + 367 : Result := 'VARA'; + else Result := 'unknown'; + end; +end; + +end. + diff --git a/components/fpspreadsheet/reference/BIFFExplorer/behtml.pas b/components/fpspreadsheet/reference/BIFFExplorer/behtml.pas new file mode 100644 index 000000000..71f255619 --- /dev/null +++ b/components/fpspreadsheet/reference/BIFFExplorer/behtml.pas @@ -0,0 +1,245 @@ +unit beHTML; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, Graphics; + +type + THTMLHeader = (h1, h2, h3, h4, h5); + THeaderColors = Array[THTMLHeader] of TColor; + + THTMLDocument = class + private + FLines: TStrings; + FRawMode: Boolean; + FIndent: Integer; + function Indent: String; + function Raw(const AText: String): String; + function ColorToHTML(AColor: TColor): String; + public + constructor Create; + destructor Destroy; override; + procedure AddEmptyLine; + procedure AddListItem(const AText: String); + procedure AddHeader(AHeader: THTMLHeader; const AText: String); + procedure AddParagraph(const AText: String); + procedure BeginDocument(const ATitle: String; const AHeaderColors: THeaderColors; + ARawMode: Boolean=false); + procedure BeginBulletList; + procedure BeginNumberedList; + function Bold(const AText: String): String; + procedure EndDocument; + procedure EndBulletList; + procedure EndNumberedList; + function Hyperlink(const AText, ALink: String): String; + function Italic(const AText: String): String; + property Lines: TStrings read FLines; + end; + +implementation + +uses + StrUtils, LCLIntf; + +constructor THTMLDocument.Create; +begin + inherited; + FLines := TStringList.Create; +end; + +destructor THTMLDocument.Destroy; +begin + FLines.Free; + inherited; +end; + +procedure THTMLDocument.AddHeader(AHeader: THTMLHeader; const AText: String); +begin + if FRawMode then + FLines.Add(Raw(AText)) + else + FLines.Add(Format('%s<h%d>%s</h%d>', [Indent, ord(AHeader)+1, AText, ord(AHeader)+1])); +end; + + (* + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<!-- HTML Codes by Quackit.com --> +<title> +Title appears in the browser's title bar... + + + + + +

Heading goes here...

+

Enter your paragraph text here...

+ + + *) + +procedure THTMLDocument.BeginDocument(const ATitle: String; + const AHeaderColors: THeaderColors; ARawMode: Boolean = false); +begin + FRawMode := ARawMode; + FLines.Clear; + if not FRawMode then begin + FLines.Add(''); + FLines.Add(''); + FLines.Add(' '); + FLines.Add(' '); + FLines.Add(' ' + ATitle + ''); + FLines.Add(' '); + FLines.Add(' '); + FLines.Add(' '); + FIndent := 4; + end; +end; + +procedure THTMLDocument.BeginBulletList; +begin + if not FRawMode then begin + FLines.Add(Indent + '
    '); + inc(FIndent, 2); + end; +end; + +procedure THTMLDocument.BeginNumberedList; +begin + if not FRawMode then begin + FLines.Add(Indent + '
      '); + inc(FIndent, 2); + end; +end; + +procedure THTMLDocument.AddEmptyLine; +begin + if FRawMode then + FLines.Add('') + else + FLines.Add('
      '); +end; + +procedure THTMLDocument.AddListItem(const AText: String); +begin + if FRawMode then + FLines.Add('- ' + Raw(AText)) + else + FLines.Add(Indent + '
    1. ' + AText + '
    2. '); +end; + +procedure THTMLDocument.AddParagraph(const AText: String); +begin + if FRawMode then + FLines.Add(Raw(AText)) + else + FLines.Add(Indent + '

      ' + AText + '

      '); +end; + +function THTMLDocument.Bold(const AText: String): String; +begin + if FRawMode then + Result := AText + else + Result := '' + AText + ''; +end; + +function THTMLDocument.ColorToHTML(AColor: TColor): String; +var + tmpRGB: LongInt; +begin + tmpRGB := ColorToRGB(AColor) ; + Result := Format('#%.2x%.2x%.2x', [ + GetRValue(tmpRGB), + GetGValue(tmpRGB), + GetBValue(tmpRGB) + ]) ; +end; + +procedure THTMLDocument.EndDocument; +begin + if not FRawMode then begin + FLines.Add(' '); + FLines.Add(''); + end; +end; + +procedure THTMLDocument.EndBulletList; +begin + if not FRawMode then begin + dec(FIndent, 2); + FLines.Add(Indent + '
'); + end; +end; + +procedure THTMLDocument.EndNumberedList; +begin + if not FRawMode then begin + dec(FIndent, 2); + FLines.Add(Indent + ''); + end; +end; + +function THTMLDocument.Hyperlink(const AText, ALink: String): String; +begin + if FRawMode then + Result := Format('%s (%s)', [AText, ALink]) + else + Result := Format('%s', [ALink, AText]); +end; + +function THTMLDocument.Indent: String; +begin + Result := DupeString(' ', FIndent); +end; + +function THTMLDocument.Italic(const AText: String): String; +begin + if FRawMode then + Result := AText + else + Result := '' + AText + ''; +end; + +function THTMLDocument.Raw(const AText: String): String; +var + i, n: Integer; +begin + Result := ''; + if AText = '' then + exit; + n := Length(AText); + i := 1; + while (i <= n) do begin + if AText[i] = '<' then + repeat + inc(i); + until (i = n) or (AText[i] = '>') + else + Result := Result + AText[i]; + inc(i); + end; +end; + +end. + diff --git a/components/fpspreadsheet/reference/BIFFExplorer/bemain.lfm b/components/fpspreadsheet/reference/BIFFExplorer/bemain.lfm new file mode 100644 index 000000000..3afa0069b --- /dev/null +++ b/components/fpspreadsheet/reference/BIFFExplorer/bemain.lfm @@ -0,0 +1,1255 @@ +object MainForm: TMainForm + Left = 352 + Height = 576 + Top = 177 + Width = 1089 + Caption = 'BIFF Explorer' + ClientHeight = 556 + ClientWidth = 1089 + Menu = MainMenu + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnDestroy = FormDestroy + OnShow = FormShow + ShowHint = True + LCLVersion = '1.3' + object Splitter1: TSplitter + Left = 419 + Height = 507 + Top = 26 + Width = 5 + end + object ToolBar: TToolBar + Left = 0 + Height = 26 + Top = 0 + Width = 1089 + Caption = 'ToolBar' + Images = ImageList + TabOrder = 1 + object ToolButton1: TToolButton + Left = 1 + Top = 2 + Action = AcFileOpen + DropdownMenu = RecentFilesPopupMenu + Style = tbsDropDown + end + object ToolButton2: TToolButton + Left = 64 + Top = 2 + Action = AcFileQuit + end + object ToolButton3: TToolButton + Left = 36 + Top = 2 + Action = AcFind + end + object ToolButton4: TToolButton + Left = 59 + Top = 2 + Width = 5 + Caption = 'ToolButton4' + Style = tbsDivider + end + end + object DetailPanel: TPanel + Left = 424 + Height = 507 + Top = 26 + Width = 665 + Align = alClient + BevelOuter = bvNone + 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 + Width = 665 + ActivePage = PgValues + Align = alBottom + TabIndex = 1 + TabOrder = 2 + OnChange = PageControlChange + object PgAnalysis: TTabSheet + Caption = 'Analysis' + ClientHeight = 230 + ClientWidth = 657 + object AnalysisDetails: TMemo + Left = 428 + Height = 230 + Top = 0 + Width = 229 + Align = alRight + Font.CharSet = ANSI_CHARSET + Font.Height = -12 + Font.Name = 'Courier New' + Font.Pitch = fpFixed + Font.Quality = fqDraft + ParentFont = False + ScrollBars = ssAutoBoth + TabOrder = 0 + WordWrap = False + end + object DetailsSplitter: TSplitter + Left = 423 + Height = 230 + Top = 0 + Width = 5 + Align = alRight + ResizeAnchor = akRight + end + end + object PgValues: TTabSheet + Caption = 'Values' + ClientHeight = 230 + ClientWidth = 657 + object ValueGrid: TStringGrid + Left = 0 + Height = 230 + Top = 0 + Width = 657 + Align = alClient + ColCount = 3 + DefaultColWidth = 100 + FixedCols = 0 + Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goDrawFocusSelected, goColSizing, goSmoothScroll] + RowCount = 9 + TabOrder = 0 + TitleStyle = tsNative + ColWidths = ( + 112 + 142 + 141 + ) + Cells = ( + 3 + 0 + 0 + 'Data type' + 1 + 0 + 'Value' + 2 + 0 + 'Offset range' + ) + end + end + end + end + object TreePanel: TPanel + Left = 0 + Height = 507 + Top = 26 + Width = 419 + Align = alLeft + BevelOuter = bvNone + ClientHeight = 507 + ClientWidth = 419 + Constraints.MinWidth = 275 + TabOrder = 3 + object FindPanel: TPanel + Left = 0 + Height = 36 + Top = 471 + Width = 419 + Align = alBottom + BevelOuter = bvNone + ClientHeight = 36 + ClientWidth = 419 + TabOrder = 0 + Visible = False + object BtnFindNext: TSpeedButton + Left = 240 + Height = 22 + Hint = 'Find next' + Top = 6 + Width = 23 + Action = AcFindNext + Flat = True + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00E297 + 3A00D98E3300CB802900BC711D00AE631200A05509159B5005AE9B5005AEA055 + 0915AE631200BC711D00CB802900D98E3300E2973A00FFFFFF00FFFFFF00E297 + 3A00D98E3300CB802900BC711D00AE631215A75C0DAED38D19E6D38C18E6A75C + 0DAEAE631215BC711D00CB802900D98E3300E2973A00FFFFFF00FFFFFF00E297 + 3A00D98E3300CB802900BC711D15B56A18AED69737E6F1B436FFF0B130FFD492 + 2DE6B56A18AEBC711D15CB802900D98E3300E2973A00FFFFFF00FFFFFF00E297 + 3A00D98E3300CB802915C37923AEDCA553E6E3B25DFFD3953BFFD3953BFFDFA9 + 52FFD69A45E6C37923AECB802915D98E3300E2973A00FFFFFF00FFFFFF00E297 + 3A00D98E3315D2872EAEE8B563E6F7CB7FFFEAAF63FFE0A559FFD69B4FFFD195 + 49FFDDAC60FFDFA553E6D2872EAED98E3315E2973A00FFFFFF00FFFFFF00E297 + 3A15DF9438AEF0BD69E6FEDE92FFFCD68AFFFCD68AFFFCD68AFFFCD68AFFFCD5 + 89FFFCD589FFFDDA8EFFEFBA66E6DF9438AEE2973A15FFFFFF00FFFFFF00E69B + 3D33E89D3FCCE89D3FCCE89D3FCCE89D3FCCE89D3FCCE89D3FCCE89D3FCCE89D + 3FCCE89D3FCCE89D3FCCE89D3FCCE89D3FCCE69B3D33FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 + } + end + object BtnFindPrev: TSpeedButton + Left = 216 + Height = 22 + Hint = 'Find previous' + Top = 6 + Width = 23 + Action = AcFindPrev + Flat = True + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF009C51 + 06999B5005CC9B5005CC9B5005CC9B5005CC9B5005CC9B5005CC9B5005CC9B50 + 05CC9B5005CC9B5005CC9B5005CC9C510699FFFFFF00FFFFFF00FFFFFF00A55A + 0C5CA75C0DCCF9C966FFFAB827FFFBB71CFFFBB518FFFBB414FFFBB311FFFBB2 + 0FFFFBB20EFFFBB516FFA75C0DCCA55A0C5CFFFFFF00FFFFFF00FFFFFF00A75C + 0D00B368175CB56A18CCF8CF80FFE6A53EFFDE9D2FFFDD9C2EFFDD9C2EFFDD9C + 2EFFE6AE47FFB56A18CCB368175CA75C0D00FFFFFF00FFFFFF00FFFFFF00A75C + 0D00B56A1800C177225CC37923CCFBD98DFFECB367FFE1A75BFFD79C50FFE7BC + 70FFC37923CCC177225CB56A1800A75C0D00FFFFFF00FFFFFF00FFFFFF00A75C + 0D00B56A1800C3792300D0852D5CD2872ECCFEE195FFF8C77BFFFDDE92FFD287 + 2ECCD0852D5CC3792300B56A1800A75C0D00FFFFFF00FFFFFF00FFFFFF00A75C + 0D00B56A1800C3792300D2872E00DE93375CDF9438CCFFE599FFDF9438CCDE93 + 375CD2872E00C3792300B56A1800A75C0D00FFFFFF00FFFFFF00FFFFFF00A75C + 0D00B56A1800C3792300D2872E00DF943800E79C3E5CE89D3FCCE79C3E5CDF94 + 3800D2872E00C3792300B56A1800A75C0D00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 + } + end + object SpeedButton3: TSpeedButton + Left = 3 + Height = 22 + Hint = 'Close "find" panel' + Top = 6 + Width = 23 + Action = AcFindClose + Flat = True + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00000072000000614800005FCC000061480000720000008200000082000000 + 72000000614800005FCC0000614800007200FFFFFF00FFFFFF00FFFFFF00FFFF + FF0000007548000072CC1111D8FF000072CC0000754800008200000082000000 + 7548000072CC1111D8FF000072CC00007548FFFFFF00FFFFFF00FFFFFF00FFFF + FF00000082CC1111D0FF1111D0FF1111D0FF000082CC00008348000083480000 + 82CC1111D0FF1111D0FF1111D0FF000082CCFFFFFF00FFFFFF00FFFFFF00FFFF + FF0000008748000087CC1111C4FF1111C4FF1111C4FF000087CC000087CC1111 + C4FF1111C4FF1111C4FF000087CC00008748FFFFFF00FFFFFF00FFFFFF00FFFF + FF000000870000008C4800008DCC1111B8FF1111B8FF1111B8FF1111B8FF1111 + B8FF1111B8FF00008DCC00008C4800008700FFFFFF00FFFFFF00FFFFFF00FFFF + FF000000870000008D0000009148000092CC1515AFFF1111ACFF1111ACFF1111 + ACFF000092CC0000914800008D0000008700FFFFFF00FFFFFF00FFFFFF00FFFF + FF000000A00000009B0000009848000097CC2525B4FF1111A2FF1111A2FF1414 + A5FF000097CC0000984800009B000000A000FFFFFF00FFFFFF00FFFFFF00FFFF + FF000000A00000009C4800009BCC5353DBFF2E2EB7FF3D3DC6FF3131BAFF1515 + 9FFF1E1EA8FF00009BCC00009C480000A000FFFFFF00FFFFFF00FFFFFF00FFFF + FF000000A1480000A0CC6767EFFF3636BEFF5E5EE6FF0000A0CC0000A0CC4F4F + D7FF3636BEFF4545CDFF0000A0CC0000A148FFFFFF00FFFFFF00FFFFFF00FFFF + FF000000A3CC7676FEFF4C4CD4FF7272FAFF0000A3CC0000A3480000A3480000 + A3CC6262EAFF4C4CD4FF5C5CE4FF0000A3CCFFFFFF00FFFFFF00FFFFFF00FFFF + FF000000A7480000A7CC7777FFFF0000A7CC0000A7480000A3000000A3000000 + A7480000A7CC7070F8FF0000A7CC0000A748FFFFFF00FFFFFF00FFFFFF00FFFF + FF000000A7000000AA480000AACC0000AA480000A7000000A3000000A3000000 + A7000000AA480000AACC0000AA480000A700FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 + } + end + object CbFind: TComboBox + Left = 28 + Height = 23 + Top = 5 + Width = 183 + ItemHeight = 15 + OnChange = CbFindChange + OnKeyPress = CbFindKeyPress + TabOrder = 0 + end + end + object BIFFTree: TVirtualStringTree + Left = 0 + Height = 471 + Top = 0 + Width = 419 + Align = alClient + ButtonStyle = bsTriangle + DefaultText = 'Node' + Header.AutoSizeIndex = 3 + Header.Columns = < + item + Alignment = taRightJustify + CaptionAlignment = taRightJustify + MinWidth = 80 + Options = [coAllowClick, coDraggable, coEnabled, coParentBidiMode, coParentColor, coResizable, coShowDropMark, coVisible, coAllowFocus, coUseCaptionAlignment] + Position = 0 + Text = 'Offset' + Width = 80 + end + item + Alignment = taCenter + MinWidth = 60 + Position = 1 + Text = 'Record ID' + Width = 80 + end + item + MinWidth = 80 + Position = 2 + Text = 'Record name' + Width = 130 + end + item + MinWidth = 80 + Position = 3 + Text = 'Record description' + Width = 125 + end> + Header.DefaultHeight = 24 + Header.Height = 24 + Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoShowSortGlyphs, hoVisible] + HintMode = hmTooltip + PopupMenu = TreePopupMenu + TabOrder = 1 + TreeOptions.AutoOptions = [toAutoDropExpand, toAutoScrollOnExpand, toAutoSpanColumns, toAutoTristateTracking, toAutoDeleteMovedNodes] + TreeOptions.PaintOptions = [toShowButtons, toShowDropmark, toShowRoot, toThemeAware, toUseBlendedImages] + TreeOptions.SelectionOptions = [toFullRowSelect] + OnBeforeCellPaint = BIFFTreeBeforeCellPaint + OnFocusChanged = BIFFTreeFocusChanged + OnFreeNode = BIFFTreeFreeNode + OnGetText = BIFFTreeGetText + OnPaintText = BIFFTreePaintText + OnGetNodeDataSize = BIFFTreeGetNodeDataSize + end + end + object StatusBar: TStatusBar + Left = 0 + Height = 23 + Top = 533 + Width = 1089 + Panels = < + item + Width = 120 + end + item + Width = 180 + end + item + Width = 150 + end + item + Width = 180 + end> + SimplePanel = False + end + object ImageList: TImageList + left = 80 + top = 64 + Bitmap = { + 4C69090000001000000010000000FFFFFF00FFFFFF000088CC610088CC810088 + 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 + 8900005D8C0000669900FFFFFF00003F9300003F9300003F9300003F9424003F + 948A003E93CC004095CC004095CC004095CC004095CC004095CC004095CC0040 + 95CC004095CC00409599FFFFFF00003F9300003F9324003F938A0E4B9CD33F76 + C0EC5D90D4FF3365A9FFA0A0A0FFA9A9A9FFA9A9A9FFAAAAAAFFACACACFFAEAE + AEFFB0B0B0FF003E93CCFFFFFF00003F938A0E4A9CD33E75BFEC5487CBFF3669 + ADFF23569AFF3363A6FFA9A9A9FFBCBCBCFFBDBDBDFFBFBFBFFFC1C1C1FFC4C4 + C4FFC7C7C7FF003C90CCFFFFFF00003D91CC5D90D4FF3568ACFF285B9FFF1A4D + 91FF4477BBFF3361A4FFA9A9A9FFBDBDBDFFBFBFBFFFC1C1C1FFC4C4C4FFC7C7 + C7FFC9C9C9FF003A8DCCFFFFFF00003B8ECC588BCFFF1A4D91FF4376BAFF3265 + A9FF4376BAFF335FA1FFAAAAAAFFBFBFBFFFC1C1C1FFC4C4C4FFC7C7C7FFC9C9 + C9FFCCCCCCFF003789CCFFFFFF0000398BCC5588CCFF275A9EFF4174B8FF3164 + A8FF4174B8FF335D9EFFACACACFFC1C1C1FFC4C4C4FFC7C7C7FFC9C9C9FFCCCC + CCFFD0D0D0FF003485CCFFFFFF00003688CC5386CAFF295CA0FF3F72B6FF3063 + A7FF3F72B6FF335A9AFFAEAEAEFFC4C4C4FFC7C7C7FFC9C9C9FFCCCCCCFFD0D0 + D0FFD3D3D3FF003181CCFFFFFF00003485CC5083C7FF1D5094FF3265A9FF2D60 + A4FF3D70B4FF335897FFB0B0B0FFC7C7C7FFC9C9C9FFCCCCCCFFD0D0D0FFD3D3 + D3FFD5D5D5FF002E7DCCFFFFFF00003181CC4C7FC3FFBBBBBBFF22518CFF2C5F + A3FF3B6EB2FF335593FFB3B3B3FFC9C9C9FFCCCCCCFFD0D0D0FFD3D3D3FFD5D5 + D5FFD8D8D8FF002B78CCFFFFFF00002E7DCC497CC0FF09336FFF215090FF2B5E + A2FF396CB0FF335290FFB5B5B5FFCCCCCCFFD0D0D0FFD3D3D3FFD5D5D5FFD8D8 + D8FFDBDBDBFF002774CCFFFFFF00002B79CC477ABEFF2C5FA3FF376AAEFF2B5E + A2FF376AAEFF33508CFFB8B8B8FFD0D0D0FFD3D3D3FFD5D5D5FFD8D8D8FFDBDB + DBFFDCDCDCFF00246FCCFFFFFF00002875CC4477BBFF2C5FA3FF3568ACFF2B5E + A2FF2E61A5FF334B87FFBBBBBBFFD3D3D3FFD5D5D5FFD8D8D8FFDBDBDBFFDCDC + DCFFDDDDDDFF001F68CCFFFFFF00002571CC4174B8FF2C5FA3FF2D60A4FF2356 + 9AFF3D70B4FF334179FFBEBEBEFFD5D5D5FFD8D8D8FFDBDBDBFFDCDCDCFFDDDD + DDFFDDDDDDFF001258CCFFFFFF0000226DCC3F72B6FF225599FF3B6EB2FF2C51 + 96EC0A1C60D3000749A4000648CC000648CC000648CC000648CC000648CC0006 + 48CC000648CC00074A99FFFFFF00001B64CC4174B8FF2A5094EC0A1A5ED30008 + 4A8A000648240006470000044500000445000004450000044500000445000004 + 45000004450000064800FFFFFF0000105500000B4FCC0007498A000546240005 + 4700000648000006470000044500000445000004450000044500000445000004 + 45000004450000064800FFFFFF004E4E4E005151510054545411555555405555 + 555A555555655555555A5555554054545411515151004E4E4E004E4E4E002957 + 27000569000007710000FFFFFF004E4E4E005151512163605E62B1A3948BE6D5 + C5AFF4EADFC7EDE3D9B5B6ACA28E63605E62515151214E4E4E004E4E4E004E4E + 4E004E4E4E004E4E4E00FFFFFF004D4D4D115F5D5A64D5C1AEA1EBD8C4C2F6EC + E2CDF6EDE4CEF6EDE4CEF6ECE2CDD9C8B8A4605D5B644D4D4D114C4C4C004C4C + 4C004C4C4C004C4C4C00FFFFFF0049494943AD9F918EE8D2BBC0F1E3D5C8F6ED + E4CEF6EDE4CEF6EDE4CEF6EDE4CEF2E4D6C8B0A4979149494943494949004949 + 49004949490049494900FFFFFF0043434360E0CBB6ACE8D2BBC0E8D2BBC0E8D2 + BBC0E8D2BBC0E8D2BBC0E8D2BBC0E8D2BBC0E4D3C1B243434360434343004343 + 43004343430043434300FFFFFF003E3E3E6FE9D4BEBEE8D2BBC0E8D2BBC0F6ED + E4CEF6EDE4CEF6EDE4CEF6EDE4CEF6EDE4CEEDDBC8C53E3E3E6F3E3E3E003E3E + 3E003E3E3E003E3E3E00FFFFFF0038383865E1CFBCB1E8D2BBC0F6EDE4CEF6ED + E4CEF6EDE4CEF6EDE4CEF6EDE4CEF6EDE4CEE7D8CAB838383865383838003838 + 38003838380038383800FFFFFF0031313149A89D9397EAD5BFC3F5E9DFCBF6ED + E4CEF6EDE4CEF6EDE4CEF6EDE4CEF6ECE2CEADA69E9D31313149313131003131 + 31003131310031313100FFFFFF00262626143B3A3874D7C9BCAFF3E6D9CBF6ED + E4CEF6EDE4CEF6EDE4CEF7EFE6D1E4DED9C84544437D34343424383838003939 + 39003A3A3A003C3C3C00FFFFFF001E1E1E001111112A2826257D9D9791A5EEE8 + E3C4F9F3EDD6EFEAE5C5A3A09EA92827278AACACACFF373737753737371F3939 + 39003A3A3A003C3C3C00FFFFFF001E1E1E000E0E0E0004040416040404560404 + 04790404048704040479040404560404042A0F0F0F86B8B5B5FF4241417E3838 + 382A3A3A3A003C3C3C00FFFFFF001E1E1E000E0E0E0004040400040404000404 + 040004040400040404000404040004040400040404251A1A1A8FC8C1C1FF4F4D + 4D88393939383C3C3C00FFFFFF001E1E1E000E0E0E0004040400040404000404 + 040004040400040404000404040004040400040404000404043328272799D9CE + CEFF605C5C913A3A3A4DFFFFFF001E1E1E000E0E0E0004040400040404000404 + 0400040404000404040004040400040404000404040004040400040404443B38 + 38A2E8D8D8FF32323276FFFFFF001E1E1E000E0E0E0004040400040404000404 + 0400040404000404040004040400040404000404040004040400040404000404 + 045C090909892525252CFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF000000A7000000AA480000 + AACC0000AA480000A7000000A3000000A3000000A7000000AA480000AACC0000 + AA480000A700FFFFFF00FFFFFF00FFFFFF00FFFFFF000000A7480000A7CC7777 + FFFF0000A7CC0000A7480000A3000000A3000000A7480000A7CC7070F8FF0000 + A7CC0000A748FFFFFF00FFFFFF00FFFFFF00FFFFFF000000A3CC7676FEFF4C4C + D4FF7272FAFF0000A3CC0000A3480000A3480000A3CC6262EAFF4C4CD4FF5C5C + E4FF0000A3CCFFFFFF00FFFFFF00FFFFFF00FFFFFF000000A1480000A0CC6767 + EFFF3636BEFF5E5EE6FF0000A0CC0000A0CC4F4FD7FF3636BEFF4545CDFF0000 + A0CC0000A148FFFFFF00FFFFFF00FFFFFF00FFFFFF000000A00000009C480000 + 9BCC5353DBFF2E2EB7FF3D3DC6FF3131BAFF15159FFF1E1EA8FF00009BCC0000 + 9C480000A000FFFFFF00FFFFFF00FFFFFF00FFFFFF000000A00000009B000000 + 9848000097CC2525B4FF1111A2FF1111A2FF1414A5FF000097CC000098480000 + 9B000000A000FFFFFF00FFFFFF00FFFFFF00FFFFFF000000870000008D000000 + 9148000092CC1515AFFF1111ACFF1111ACFF1111ACFF000092CC000091480000 + 8D0000008700FFFFFF00FFFFFF00FFFFFF00FFFFFF000000870000008C480000 + 8DCC1111B8FF1111B8FF1111B8FF1111B8FF1111B8FF1111B8FF00008DCC0000 + 8C4800008700FFFFFF00FFFFFF00FFFFFF00FFFFFF0000008748000087CC1111 + C4FF1111C4FF1111C4FF000087CC000087CC1111C4FF1111C4FF1111C4FF0000 + 87CC00008748FFFFFF00FFFFFF00FFFFFF00FFFFFF00000082CC1111D0FF1111 + D0FF1111D0FF000082CC0000834800008348000082CC1111D0FF1111D0FF1111 + D0FF000082CCFFFFFF00FFFFFF00FFFFFF00FFFFFF0000007548000072CC1111 + D8FF000072CC00007548000082000000820000007548000072CC1111D8FF0000 + 72CC00007548FFFFFF00FFFFFF00FFFFFF00FFFFFF0000007200000061480000 + 5FCC00006148000072000000820000008200000072000000614800005FCC0000 + 614800007200FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00E69B3D33E89D3FCCE89D3FCCE89D + 3FCCE89D3FCCE89D3FCCE89D3FCCE89D3FCCE89D3FCCE89D3FCCE89D3FCCE89D + 3FCCE89D3FCCE69B3D33FFFFFF00FFFFFF00E2973A15DF9438AEF0BD69E6FEDE + 92FFFCD68AFFFCD68AFFFCD68AFFFCD68AFFFCD589FFFCD589FFFDDA8EFFEFBA + 66E6DF9438AEE2973A15FFFFFF00FFFFFF00E2973A00D98E3315D2872EAEE8B5 + 63E6F7CB7FFFEAAF63FFE0A559FFD69B4FFFD19549FFDDAC60FFDFA553E6D287 + 2EAED98E3315E2973A00FFFFFF00FFFFFF00E2973A00D98E3300CB802915C379 + 23AEDCA553E6E3B25DFFD3953BFFD3953BFFDFA952FFD69A45E6C37923AECB80 + 2915D98E3300E2973A00FFFFFF00FFFFFF00E2973A00D98E3300CB802900BC71 + 1D15B56A18AED69737E6F1B436FFF0B130FFD4922DE6B56A18AEBC711D15CB80 + 2900D98E3300E2973A00FFFFFF00FFFFFF00E2973A00D98E3300CB802900BC71 + 1D00AE631215A75C0DAED38D19E6D38C18E6A75C0DAEAE631215BC711D00CB80 + 2900D98E3300E2973A00FFFFFF00FFFFFF00E2973A00D98E3300CB802900BC71 + 1D00AE631200A05509159B5005AE9B5005AEA0550915AE631200BC711D00CB80 + 2900D98E3300E2973A00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00A75C0D00B56A1800C3792300D287 + 2E00DF943800E79C3E5CE89D3FCCE79C3E5CDF943800D2872E00C3792300B56A + 1800A75C0D00FFFFFF00FFFFFF00FFFFFF00A75C0D00B56A1800C3792300D287 + 2E00DE93375CDF9438CCFFE599FFDF9438CCDE93375CD2872E00C3792300B56A + 1800A75C0D00FFFFFF00FFFFFF00FFFFFF00A75C0D00B56A1800C3792300D085 + 2D5CD2872ECCFEE195FFF8C77BFFFDDE92FFD2872ECCD0852D5CC3792300B56A + 1800A75C0D00FFFFFF00FFFFFF00FFFFFF00A75C0D00B56A1800C177225CC379 + 23CCFBD98DFFECB367FFE1A75BFFD79C50FFE7BC70FFC37923CCC177225CB56A + 1800A75C0D00FFFFFF00FFFFFF00FFFFFF00A75C0D00B368175CB56A18CCF8CF + 80FFE6A53EFFDE9D2FFFDD9C2EFFDD9C2EFFDD9C2EFFE6AE47FFB56A18CCB368 + 175CA75C0D00FFFFFF00FFFFFF00FFFFFF00A55A0C5CA75C0DCCF9C966FFFAB8 + 27FFFBB71CFFFBB518FFFBB414FFFBB311FFFBB20FFFFBB20EFFFBB516FFA75C + 0DCCA55A0C5CFFFFFF00FFFFFF00FFFFFF009C5106999B5005CC9B5005CC9B50 + 05CC9B5005CC9B5005CC9B5005CC9B5005CC9B5005CC9B5005CC9B5005CC9B50 + 05CC9C510699FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF004F4F4F005050500052525200535353005454 + 54155555553E555555555555556355555563555555555555553E545454155353 + 530052525200505050004F4F4F004F4F4F0050505000525252075353533D7373 + 7378C8C8C8D2EAEAEAFFE6E6E6FFE6E6E6FFEAEAEAFFC7C7C7D2727272785353 + 533D52525207505050004F4F4F004F4F4F00505050075151514D9F9F9FA1E6E6 + E6FFD7B0A3FFD08C75FFCD6C4BFFCD6C4BFFD08C75FFD6AFA2FFE3E4E4FF9D9D + 9DA15151514D505050074F4F4F004E4E4E004E4E4E3F9D9D9DA2DFDFDFFFCB79 + 5EFFDB7A58FFEE906EFFF49674FFF49573FFED8E6CFFDA7856FFCB795EFFDBDC + DCFF999999A24E4E4E3F4E4E4E004B4B4B176C6C6C7CDFE0E0FFC8755AFFE283 + 61FFDC7A58FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE2987FFFDF7E5CFFC875 + 5AFFD8D8D8FF6969697C4B4B4B1748484842BEBFBFD4C9A295FFD57452FFE281 + 5FFFD26C4AFFD5A291FFD5A291FFE6C2B6FFFFFFFFFFE0AD9CFFDF7C5AFFD16E + 4CFFC7A194FFB2B3B3D4484848424545455CDBDCDCFFC07C65FFDF805EFFCF69 + 47FFCF6947FFCA6442FFC05937FFC28775FFCCCCCCFFBC8877FFAD4624FFC360 + 3EFFC07C65FFCBCCCCFF4545455C4242426CCFCFCFFFBC5B3BFFDD7D5BFFC962 + 40FFBD5330FFB44A26FFBC7259FFD1CFCFFFC7AEA5FFB24824FFB34925FFBD55 + 32FFBC5B3BFFC3C3C3FF4242426C3E3E3E6ECCCCCCFFB95737FFD5714DFFBF50 + 2AFFBD4E27FFB94B26FFDBDBDBFFDBDBDBFFB94C26FFBD4E27FFBD4E27FFC154 + 2EFFB95737FFC0C0C0FF3E3E3E6E3A3A3A61D0CFCFFFB9745DFFCF643EFFC954 + 2AFFC9542AFFC9542AFFBB4D27FFBB4D27FFC9542AFFC9542AFFC9542AFFC554 + 2CFFB9745DFFC2C0C0FF3A3A3A6137373747ACAAAAD7C09789FFBF5631FFD85F + 33FFD55A2DFFCB542AFFEEEEEEFFEEEEEEFFCB542AFFD55A2DFFD55A2DFFBC4F + 29FFBF9588FFA29F9FD7373737473434341953515186D4CECEFFB35F44FFC957 + 2FFFE16132FFD3592DFFEEEEEEFFEEEEEEFFD3592DFFE15F30FFC8532AFFB35F + 44FFD0C9C9FF5150508634343419303030002F2F2F48827E7EACDBD1D1FFAC57 + 3CFFB6461FFFD6592AFFE56230FFE56230FFD6592AFFB6461FFFAC573CFFDACF + CFFF817C7CAC2F2F2F48303030002E2E2E002C2C2C092626265C807979AFE4D6 + D6FFC69689FFAD644EFF943312FF943312FFAD644EFFC69689FFE3D6D6FF7F79 + 79AF2626265C2C2C2C092E2E2E002E2E2E002C2C2C001E1E1E091717174F3D3A + 3A92B2A6A6DCEBDADAFFEBDADAFFEBDADAFFEBDADAFFB2A6A6DC3D3A3A921717 + 174F1E1E1E092C2C2C002E2E2E002E2E2E002C2C2C001E1E1E00131313000D0D + 0D1D0B0B0B540B0B0B740B0B0B870B0B0B870B0B0B740B0B0B540D0D0D1D1313 + 13001E1E1E002C2C2C002E2E2E00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF007A7A7A117C7C7C547C7C7C677C7C7C547A7A + 7A1177777700555555000000A2000000A200000099000000A6000000A7210000 + A8A60000A8CC0000A8A60000A72165656557CACACAB8FDFDFDFFCACACAB86565 + 65575B5B5B005555550016168E0000009FCC0000993300009E0000009FA73F3F + D5E87272FEFF3F3FD5E800009FA74545456FF2F2F2FFF2F2F2FFF2F2F2FF4545 + 456F55555566555555662B2B7400000092B3000092CC00009200000092CC5656 + F5FF5656F5FF5656F5FF000092CC2525255E9F9F9FBDE4E4E4FF9F9F9FBD2525 + 255E474747005555550016167700000084CC00008B3300008600000084A71F1F + BEE83434EBFF1F1FBEE8000084A70E0E0E140B0B0B610B0B0B770B0B0B610E0E + 0E141010100055555500000080000000800000008B0000006E0000006B210000 + 67A6000067CC000067A600006B21FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF007A7A7A117C7C7C547C7C7C677C7C7C547A7A + 7A1177777700555555005555550055555500EA846200EB856329EC8664D0EC86 + 64FFEC8664D0EB856329FFFFFF0065656557CACACAB8FDFDFDFFCACACAB86565 + 65575B5B5B0055555500555555005555550079605700E27C5AD0EEA891FFF7CE + C1FFEEA891FFE27C5AD0FFFFFF004545456FF2F2F2FFF2F2F2FFF2F2F2FF4545 + 456F5454546654545466545454665454546654545466D46F4DFFF0C7BAFFF0C7 + BAFFF0C7BAFFD46F4DFFFFFFFF002525255E9F9F9FBDE4E4E4FF9F9F9FBD2525 + 255E45454500505050004C4C4C66505050006E554D00C4613FD0D7927BFFE8BF + B2FFD7927BFFC4613FD0FFFFFF000E0E0E140B0B0B610B0B0B770B0B0B610E0E + 0E1410101000414141004141416641414100B9563400B8553329B65331D0B653 + 31FFB65331D0B8553329FFFFFF000B0B0B000606060006060600060606000B0B + 0B002323230035353500353535663535350077463500B6533100B3502E00B350 + 2E00B3502E00B6533100FFFFFF000B0B0B000606060006060600060606000B0B + 0B00282828002828280028282866282828006E372600B1452300AE442200AE44 + 2200AE442200B1452300FFFFFF000B0B0B000606060006060600060606001111 + 11001A1A1A001A1A1A001A1A1A661A1A1A00B3462400B2462429B14523D0B145 + 23FFB14523D0B2462429FFFFFF000B0B0B000606060006060600080808000F0F + 0F000F0F0F000F0F0F000F0F0F660A0A0A0034180F00BD4B29D0DB9078FFF7CE + C1FFDB9078FFBD4B29D0FFFFFF000B0B0B000606060006060600070707000707 + 070007070700070707000606064D0505056605050566CC5331FFF0C7BAFFF0C7 + BAFFF0C7BAFFCC5331FFFFFFFF000B0B0B000606060006060600070707000707 + 0700070707000707070005050500030303003A1A1100DB5B39D0E4917AFFE8BF + B2FFE4917AFFDB5B39D0FFFFFF000B0B0B000606060006060600070707000707 + 070007070700070707000505050003030300E5613F00E7624029E86341D0E863 + 41FFE86341D0E7624029FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00 + } + end + object MainMenu: TMainMenu + Images = ImageList + left = 168 + top = 136 + object MnuFile: TMenuItem + Caption = 'File' + object MnuFileOpen: TMenuItem + Action = AcFileOpen + Bitmap.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00005D8C000064970000629300005E8E30005C8C7C0059879200598700005B + 8900005B8900005B8900005B8900005D8C0000669900FFFFFF00FFFFFF00FFFF + FF00005D8C0000659950006497991C7AA9C052A5CDE0005B89C1005B8900005B + 8900005B8900005B8900005B8900005D8C0000669900FFFFFF00FFFFFF00FFFF + FF00005E8D8E3591BDF169B8DDFA81CBECFF84CEEEFF005C8BEF005D8CBE005D + 8CBE005D8CBE005D8CBE005D8CBE005E8D8E00669900FFFFFF00FFFFFF00FFFF + FF00006699B287D1EFFF7FCAE9FF7FCAE9FF87D0EFFF267DA9FF8DD1F3FF8DD1 + F3FF8DD1F3FF8DD1F3FF90D4F5FF006699B200679B3EFFFFFF00FFFFFF00FFFF + FF00006FA7A48AD3F0FF82CDEBFF82CDEBFF8AD3F0FF267EABFF8ACEF0FF8ACE + F0FF8ACEF0FF8ACEF0FF8FD3F4FFF4B62EFF006FA7A4FFFFFF00FFFFFF00FFFF + FF000073AC9E8ED6F2FF87D0EDFF87D0EDFF8ED6F2FF2882AFFF8BCFF1FF8BCF + F1FF8BCFF1FF8BCFF1FF91D5F5FFFEC941FF0073AC9EFFFFFF00FFFFFF00FFFF + FF000076B09B92DAF4FF8BD4F0FF8BD4F0FF92DAF4FF2B85B3FF8DD1F3FF8DD1 + F3FF8DD1F3FF8DD1F3FF93D7F6FFEBEBDDFF0076B09BFFFFFF00FFFFFF00FFFF + FF000078B49797DEF6FF90D8F2FF90D8F2FF97DEF6FF2D89B7FF8FD3F5FF8FD3 + F5FF8FD3F5FF8FD3F5FF95D9F8FFF5F5EEFF0078B497FFFFFF00FFFFFF00FFFF + FF00007BB8949BE1F7FF94DBF4FF94DBF4FF9BE1F7FF308DBCFF90D4F6FF90D4 + F6FF90D4F6FF90D4F6FF97DBF9FFFEFEFDFF007BB894FFFFFF00FFFFFF00FFFF + FF00007DBB909EE5F9FF98DFF6FF98DFF6FF9EE5F9FF3290C0FF92D6F8FF92D6 + F8FF92D6F8FF92D6F8FF99DDFAFF007DBB90007DBB33FFFFFF00FFFFFF00FFFF + FF00007FBF8DA3E8FBFF9DE3F9FF9DE3F9FFA3E8FBFF3594C5FF94D8FAFF94D8 + FAFF94D8FAFF94D8FAFF9BDFFCFF007FBF8D007FBE00FFFFFF00FFFFFF00FFFF + FF000082C28AA6EBFCFFA1E6FBFFA1E6FBFFA6EBFCFF3C9DCFFF96DAFCFF96DA + FCFF96DAFCFF96DAFCFF9EE2FDFF0082C28A0082C200FFFFFF00FFFFFF00FFFF + FF000084C587A9EEFDFFA4E9FCFFA4E9FCFFAAEEFDFF42A1D1FF97DBFDFF97DB + FDFF97DBFDFF97DBFDFF9FE3FEFF0084C5870084C500FFFFFF00FFFFFF00FFFF + FF000085C885ACF1FFFFABEFFEFF95E2F8FF6EC9EDFF48A8D9FF98DCFEFF98DC + FEFF98DCFEFF98DCFEFFA1E5FFFF0085C8850085C800FFFFFF00FFFFFF00FFFF + FF000087CA8388DCF4FF60C0E9FF5FBFEAFF80D3F4FF9CE3FDFFA2E6FFFFA2E6 + FFFFA2E6FFFFA2E6FFFFA6EAFFFF0087CA830087CA00FFFFFF00FFFFFF00FFFF + FF000088CC610088CC810088CC810088CC810088CC810088CC810088CC810088 + CC810088CC810088CC810088CC810088CC610087CB00FFFFFF00 + } + end + object MnuFileReopen: TMenuItem + Caption = 'Recently opened files' + end + object MenuItem4: TMenuItem + Caption = '-' + end + object MnuFileQuit: TMenuItem + Action = AcFileQuit + Bitmap.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 200000000000000400006400000064000000000000000000000000105500000B + 4FCC0007498A0005462400054700000648000006470000044500000445000004 + 45000004450000044500000445000004450000064800FFFFFF00001B64CC4174 + B8FF2A5094EC0A1A5ED300084A8A000648240006470000044500000445000004 + 45000004450000044500000445000004450000064800FFFFFF0000226DCC3F72 + B6FF225599FF3B6EB2FF2C5196EC0A1C60D3000749A4000648CC000648CC0006 + 48CC000648CC000648CC000648CC000648CC00074A99FFFFFF00002571CC4174 + B8FF2C5FA3FF2D60A4FF23569AFF3D70B4FF334179FFBEBEBEFFD5D5D5FFD8D8 + D8FFDBDBDBFFDCDCDCFFDDDDDDFFDDDDDDFF001258CCFFFFFF00002875CC4477 + BBFF2C5FA3FF3568ACFF2B5EA2FF2E61A5FF334B87FFBBBBBBFFD3D3D3FFD5D5 + D5FFD8D8D8FFDBDBDBFFDCDCDCFFDDDDDDFF001F68CCFFFFFF00002B79CC477A + BEFF2C5FA3FF376AAEFF2B5EA2FF376AAEFF33508CFFB8B8B8FFD0D0D0FFD3D3 + D3FFD5D5D5FFD8D8D8FFDBDBDBFFDCDCDCFF00246FCCFFFFFF00002E7DCC497C + C0FF09336FFF215090FF2B5EA2FF396CB0FF335290FFB5B5B5FFCCCCCCFFD0D0 + D0FFD3D3D3FFD5D5D5FFD8D8D8FFDBDBDBFF002774CCFFFFFF00003181CC4C7F + C3FFBBBBBBFF22518CFF2C5FA3FF3B6EB2FF335593FFB3B3B3FFC9C9C9FFCCCC + CCFFD0D0D0FFD3D3D3FFD5D5D5FFD8D8D8FF002B78CCFFFFFF00003485CC5083 + C7FF1D5094FF3265A9FF2D60A4FF3D70B4FF335897FFB0B0B0FFC7C7C7FFC9C9 + C9FFCCCCCCFFD0D0D0FFD3D3D3FFD5D5D5FF002E7DCCFFFFFF00003688CC5386 + CAFF295CA0FF3F72B6FF3063A7FF3F72B6FF335A9AFFAEAEAEFFC4C4C4FFC7C7 + C7FFC9C9C9FFCCCCCCFFD0D0D0FFD3D3D3FF003181CCFFFFFF0000398BCC5588 + CCFF275A9EFF4174B8FF3164A8FF4174B8FF335D9EFFACACACFFC1C1C1FFC4C4 + C4FFC7C7C7FFC9C9C9FFCCCCCCFFD0D0D0FF003485CCFFFFFF00003B8ECC588B + CFFF1A4D91FF4376BAFF3265A9FF4376BAFF335FA1FFAAAAAAFFBFBFBFFFC1C1 + C1FFC4C4C4FFC7C7C7FFC9C9C9FFCCCCCCFF003789CCFFFFFF00003D91CC5D90 + D4FF3568ACFF285B9FFF1A4D91FF4477BBFF3361A4FFA9A9A9FFBDBDBDFFBFBF + BFFFC1C1C1FFC4C4C4FFC7C7C7FFC9C9C9FF003A8DCCFFFFFF00003F938A0E4A + 9CD33E75BFEC5487CBFF3669ADFF23569AFF3363A6FFA9A9A9FFBCBCBCFFBDBD + BDFFBFBFBFFFC1C1C1FFC4C4C4FFC7C7C7FF003C90CCFFFFFF00003F9300003F + 9324003F938A0E4B9CD33F76C0EC5D90D4FF3365A9FFA0A0A0FFA9A9A9FFA9A9 + A9FFAAAAAAFFACACACFFAEAEAEFFB0B0B0FF003E93CCFFFFFF00003F9300003F + 9300003F9300003F9424003F948A003E93CC004095CC004095CC004095CC0040 + 95CC004095CC004095CC004095CC004095CC00409599FFFFFF00 + } + end + end + object MnuRecord: TMenuItem + Caption = 'Record' + object MnuFind: TMenuItem + Action = AcFind + AutoCheck = True + Bitmap.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF001E1E1E000E0E + 0E00040404000404040004040400040404000404040004040400040404000404 + 040004040400040404000404045C090909892525252CFFFFFF001E1E1E000E0E + 0E00040404000404040004040400040404000404040004040400040404000404 + 040004040400040404443B3838A2E8D8D8FF32323276FFFFFF001E1E1E000E0E + 0E00040404000404040004040400040404000404040004040400040404000404 + 04000404043328272799D9CECEFF605C5C913A3A3A4DFFFFFF001E1E1E000E0E + 0E00040404000404040004040400040404000404040004040400040404000404 + 04251A1A1A8FC8C1C1FF4F4D4D88393939383C3C3C00FFFFFF001E1E1E000E0E + 0E000404041604040456040404790404048704040479040404560404042A0F0F + 0F86B8B5B5FF4241417E3838382A3A3A3A003C3C3C00FFFFFF001E1E1E001111 + 112A2826257D9D9791A5EEE8E3C4F9F3EDD6EFEAE5C5A3A09EA92827278AACAC + ACFF373737753737371F393939003A3A3A003C3C3C00FFFFFF00262626143B3A + 3874D7C9BCAFF3E6D9CBF6EDE4CEF6EDE4CEF6EDE4CEF7EFE6D1E4DED9C84544 + 437D3434342438383800393939003A3A3A003C3C3C00FFFFFF0031313149A89D + 9397EAD5BFC3F5E9DFCBF6EDE4CEF6EDE4CEF6EDE4CEF6EDE4CEF6ECE2CEADA6 + 9E9D3131314931313100313131003131310031313100FFFFFF0038383865E1CF + BCB1E8D2BBC0F6EDE4CEF6EDE4CEF6EDE4CEF6EDE4CEF6EDE4CEF6EDE4CEE7D8 + CAB83838386538383800383838003838380038383800FFFFFF003E3E3E6FE9D4 + BEBEE8D2BBC0E8D2BBC0F6EDE4CEF6EDE4CEF6EDE4CEF6EDE4CEF6EDE4CEEDDB + C8C53E3E3E6F3E3E3E003E3E3E003E3E3E003E3E3E00FFFFFF0043434360E0CB + B6ACE8D2BBC0E8D2BBC0E8D2BBC0E8D2BBC0E8D2BBC0E8D2BBC0E8D2BBC0E4D3 + C1B24343436043434300434343004343430043434300FFFFFF0049494943AD9F + 918EE8D2BBC0F1E3D5C8F6EDE4CEF6EDE4CEF6EDE4CEF6EDE4CEF2E4D6C8B0A4 + 97914949494349494900494949004949490049494900FFFFFF004D4D4D115F5D + 5A64D5C1AEA1EBD8C4C2F6ECE2CDF6EDE4CEF6EDE4CEF6ECE2CDD9C8B8A4605D + 5B644D4D4D114C4C4C004C4C4C004C4C4C004C4C4C00FFFFFF004E4E4E005151 + 512163605E62B1A3948BE6D5C5AFF4EADFC7EDE3D9B5B6ACA28E63605E625151 + 51214E4E4E004E4E4E004E4E4E004E4E4E004E4E4E00FFFFFF004E4E4E005151 + 510054545411555555405555555A555555655555555A55555540545454115151 + 51004E4E4E004E4E4E00295727000569000007710000FFFFFF00 + } + end + end + object MnuHelp: TMenuItem + Caption = 'Help' + object MenuItem2: TMenuItem + Action = AcAbout + Bitmap.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 20000000000000040000640000006400000000000000000000002E2E2E002C2C + 2C001E1E1E00131313000D0D0D1D0B0B0B540B0B0B740B0B0B870B0B0B870B0B + 0B740B0B0B540D0D0D1D131313001E1E1E002C2C2C002E2E2E002E2E2E002C2C + 2C001E1E1E091717174F3D3A3A92B2A6A6DCEBDADAFFEBDADAFFEBDADAFFEBDA + DAFFB2A6A6DC3D3A3A921717174F1E1E1E092C2C2C002E2E2E002E2E2E002C2C + 2C092626265C807979AFE4D6D6FFC69689FFAD644EFF943312FF943312FFAD64 + 4EFFC69689FFE3D6D6FF7F7979AF2626265C2C2C2C092E2E2E00303030002F2F + 2F48827E7EACDBD1D1FFAC573CFFB6461FFFD6592AFFE56230FFE56230FFD659 + 2AFFB6461FFFAC573CFFDACFCFFF817C7CAC2F2F2F4830303000343434195351 + 5186D4CECEFFB35F44FFC9572FFFE16132FFD3592DFFEEEEEEFFEEEEEEFFD359 + 2DFFE15F30FFC8532AFFB35F44FFD0C9C9FF515050863434341937373747ACAA + AAD7C09789FFBF5631FFD85F33FFD55A2DFFCB542AFFEEEEEEFFEEEEEEFFCB54 + 2AFFD55A2DFFD55A2DFFBC4F29FFBF9588FFA29F9FD7373737473A3A3A61D0CF + CFFFB9745DFFCF643EFFC9542AFFC9542AFFC9542AFFBB4D27FFBB4D27FFC954 + 2AFFC9542AFFC9542AFFC5542CFFB9745DFFC2C0C0FF3A3A3A613E3E3E6ECCCC + CCFFB95737FFD5714DFFBF502AFFBD4E27FFB94B26FFDBDBDBFFDBDBDBFFB94C + 26FFBD4E27FFBD4E27FFC1542EFFB95737FFC0C0C0FF3E3E3E6E4242426CCFCF + CFFFBC5B3BFFDD7D5BFFC96240FFBD5330FFB44A26FFBC7259FFD1CFCFFFC7AE + A5FFB24824FFB34925FFBD5532FFBC5B3BFFC3C3C3FF4242426C4545455CDBDC + DCFFC07C65FFDF805EFFCF6947FFCF6947FFCA6442FFC05937FFC28775FFCCCC + CCFFBC8877FFAD4624FFC3603EFFC07C65FFCBCCCCFF4545455C48484842BEBF + BFD4C9A295FFD57452FFE2815FFFD26C4AFFD5A291FFD5A291FFE6C2B6FFFFFF + FFFFE0AD9CFFDF7C5AFFD16E4CFFC7A194FFB2B3B3D4484848424B4B4B176C6C + 6C7CDFE0E0FFC8755AFFE28361FFDC7A58FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFE2987FFFDF7E5CFFC8755AFFD8D8D8FF6969697C4B4B4B174E4E4E004E4E + 4E3F9D9D9DA2DFDFDFFFCB795EFFDB7A58FFEE906EFFF49674FFF49573FFED8E + 6CFFDA7856FFCB795EFFDBDCDCFF999999A24E4E4E3F4E4E4E004F4F4F005050 + 50075151514D9F9F9FA1E6E6E6FFD7B0A3FFD08C75FFCD6C4BFFCD6C4BFFD08C + 75FFD6AFA2FFE3E4E4FF9D9D9DA15151514D505050074F4F4F004F4F4F005050 + 5000525252075353533D73737378C8C8C8D2EAEAEAFFE6E6E6FFE6E6E6FFEAEA + EAFFC7C7C7D2727272785353533D52525207505050004F4F4F004F4F4F005050 + 50005252520053535300545454155555553E5555555555555563555555635555 + 55555555553E545454155353530052525200505050004F4F4F00 + } + end + end + end + object ActionList: TActionList + Images = ImageList + left = 168 + top = 64 + object AcFileOpen: TAction + Caption = 'Open' + Hint = 'Open xls file' + ImageIndex = 0 + OnExecute = AcFileOpenExecute + ShortCut = 16463 + end + object AcFileQuit: TAction + Caption = 'Quit' + Hint = 'Quit application' + ImageIndex = 1 + OnExecute = AcFileQuitExecute + ShortCut = 32856 + end + object AcFind: TAction + AutoCheck = True + Caption = 'Find' + Hint = 'Find record' + ImageIndex = 2 + OnExecute = AcFindExecute + ShortCut = 16454 + end + object AcFindClose: TAction + ImageIndex = 3 + OnExecute = AcFindCloseExecute + end + object AcFindNext: TAction + ImageIndex = 4 + OnExecute = AcFindNextExecute + end + object AcFindPrev: TAction + ImageIndex = 5 + OnExecute = AcFindPrevExecute + end + object AcAbout: TAction + Caption = 'About...' + ImageIndex = 6 + OnExecute = AcAboutExecute + end + object AcNodeExpand: TAction + Caption = 'Expand node' + Hint = 'Expand current node' + ImageIndex = 8 + OnExecute = AcNodeExpandExecute + OnUpdate = AcNodeExpandUpdate + end + object AcNodeCollapse: TAction + Caption = 'Collapse node' + Hint = 'Collapse current node' + ImageIndex = 7 + OnExecute = AcNodeCollapseExecute + OnUpdate = AcNodeCollapseUpdate + end + end + object OpenDialog: TOpenDialog + DefaultExt = '.xls' + Filter = 'Excel files (*.xls)|*.xls' + left = 160 + top = 296 + end + object RecentFilesPopupMenu: TPopupMenu + left = 160 + top = 208 + object MenuItem1: TMenuItem + Caption = 'New Item1' + end + end + object TreePopupMenu: TPopupMenu + Images = ImageList + left = 160 + top = 392 + object MenuItem3: TMenuItem + Action = AcNodeExpand + Bitmap.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF000B0B0B000606 + 060006060600070707000707070007070700070707000505050003030300E561 + 3F00E7624029E86341D0E86341FFE86341D0E7624029FFFFFF000B0B0B000606 + 0600060606000707070007070700070707000707070005050500030303003A1A + 1100DB5B39D0E4917AFFE8BFB2FFE4917AFFDB5B39D0FFFFFF000B0B0B000606 + 060006060600070707000707070007070700070707000606064D050505660505 + 0566CC5331FFF0C7BAFFF0C7BAFFF0C7BAFFCC5331FFFFFFFF000B0B0B000606 + 060006060600080808000F0F0F000F0F0F000F0F0F000F0F0F660A0A0A003418 + 0F00BD4B29D0DB9078FFF7CEC1FFDB9078FFBD4B29D0FFFFFF000B0B0B000606 + 06000606060006060600111111001A1A1A001A1A1A001A1A1A661A1A1A00B346 + 2400B2462429B14523D0B14523FFB14523D0B2462429FFFFFF000B0B0B000606 + 060006060600060606000B0B0B00282828002828280028282866282828006E37 + 2600B1452300AE442200AE442200AE442200B1452300FFFFFF000B0B0B000606 + 060006060600060606000B0B0B00232323003535350035353566353535007746 + 3500B6533100B3502E00B3502E00B3502E00B6533100FFFFFF000E0E0E140B0B + 0B610B0B0B770B0B0B610E0E0E1410101000414141004141416641414100B956 + 3400B8553329B65331D0B65331FFB65331D0B8553329FFFFFF002525255E9F9F + 9FBDE4E4E4FF9F9F9FBD2525255E45454500505050004C4C4C66505050006E55 + 4D00C4613FD0D7927BFFE8BFB2FFD7927BFFC4613FD0FFFFFF004545456FF2F2 + F2FFF2F2F2FFF2F2F2FF4545456F545454665454546654545466545454665454 + 5466D46F4DFFF0C7BAFFF0C7BAFFF0C7BAFFD46F4DFFFFFFFF0065656557CACA + CAB8FDFDFDFFCACACAB8656565575B5B5B005555550055555500555555007960 + 5700E27C5AD0EEA891FFF7CEC1FFEEA891FFE27C5AD0FFFFFF007A7A7A117C7C + 7C547C7C7C677C7C7C547A7A7A1177777700555555005555550055555500EA84 + 6200EB856329EC8664D0EC8664FFEC8664D0EB856329FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 + } + end + object MenuItem5: TMenuItem + Action = AcNodeCollapse + Bitmap.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF000E0E0E140B0B + 0B610B0B0B770B0B0B610E0E0E14101010005555550000008000000080000000 + 8B0000006E0000006B21000067A6000067CC000067A600006B212525255E9F9F + 9FBDE4E4E4FF9F9F9FBD2525255E474747005555550016167700000084CC0000 + 8B3300008600000084A71F1FBEE83434EBFF1F1FBEE8000084A74545456FF2F2 + F2FFF2F2F2FFF2F2F2FF4545456F55555566555555662B2B7400000092B30000 + 92CC00009200000092CC5656F5FF5656F5FF5656F5FF000092CC65656557CACA + CAB8FDFDFDFFCACACAB8656565575B5B5B005555550016168E0000009FCC0000 + 993300009E0000009FA73F3FD5E87272FEFF3F3FD5E800009FA77A7A7A117C7C + 7C547C7C7C677C7C7C547A7A7A1177777700555555000000A2000000A2000000 + 99000000A6000000A7210000A8A60000A8CC0000A8A60000A721FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00 + } + end + object MenuItem6: TMenuItem + Caption = '-' + end + object MenuItem7: TMenuItem + Action = AcFind + AutoCheck = True + Bitmap.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF + FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF001E1E1E000E0E + 0E00040404000404040004040400040404000404040004040400040404000404 + 040004040400040404000404045C090909892525252CFFFFFF001E1E1E000E0E + 0E00040404000404040004040400040404000404040004040400040404000404 + 040004040400040404443B3838A2E8D8D8FF32323276FFFFFF001E1E1E000E0E + 0E00040404000404040004040400040404000404040004040400040404000404 + 04000404043328272799D9CECEFF605C5C913A3A3A4DFFFFFF001E1E1E000E0E + 0E00040404000404040004040400040404000404040004040400040404000404 + 04251A1A1A8FC8C1C1FF4F4D4D88393939383C3C3C00FFFFFF001E1E1E000E0E + 0E000404041604040456040404790404048704040479040404560404042A0F0F + 0F86B8B5B5FF4241417E3838382A3A3A3A003C3C3C00FFFFFF001E1E1E001111 + 112A2826257D9D9791A5EEE8E3C4F9F3EDD6EFEAE5C5A3A09EA92827278AACAC + ACFF373737753737371F393939003A3A3A003C3C3C00FFFFFF00262626143B3A + 3874D7C9BCAFF3E6D9CBF6EDE4CEF6EDE4CEF6EDE4CEF7EFE6D1E4DED9C84544 + 437D3434342438383800393939003A3A3A003C3C3C00FFFFFF0031313149A89D + 9397EAD5BFC3F5E9DFCBF6EDE4CEF6EDE4CEF6EDE4CEF6EDE4CEF6ECE2CEADA6 + 9E9D3131314931313100313131003131310031313100FFFFFF0038383865E1CF + BCB1E8D2BBC0F6EDE4CEF6EDE4CEF6EDE4CEF6EDE4CEF6EDE4CEF6EDE4CEE7D8 + CAB83838386538383800383838003838380038383800FFFFFF003E3E3E6FE9D4 + BEBEE8D2BBC0E8D2BBC0F6EDE4CEF6EDE4CEF6EDE4CEF6EDE4CEF6EDE4CEEDDB + C8C53E3E3E6F3E3E3E003E3E3E003E3E3E003E3E3E00FFFFFF0043434360E0CB + B6ACE8D2BBC0E8D2BBC0E8D2BBC0E8D2BBC0E8D2BBC0E8D2BBC0E8D2BBC0E4D3 + C1B24343436043434300434343004343430043434300FFFFFF0049494943AD9F + 918EE8D2BBC0F1E3D5C8F6EDE4CEF6EDE4CEF6EDE4CEF6EDE4CEF2E4D6C8B0A4 + 97914949494349494900494949004949490049494900FFFFFF004D4D4D115F5D + 5A64D5C1AEA1EBD8C4C2F6ECE2CDF6EDE4CEF6EDE4CEF6ECE2CDD9C8B8A4605D + 5B644D4D4D114C4C4C004C4C4C004C4C4C004C4C4C00FFFFFF004E4E4E005151 + 512163605E62B1A3948BE6D5C5AFF4EADFC7EDE3D9B5B6ACA28E63605E625151 + 51214E4E4E004E4E4E004E4E4E004E4E4E004E4E4E00FFFFFF004E4E4E005151 + 510054545411555555405555555A555555655555555A55555540545454115151 + 51004E4E4E004E4E4E00295727000569000007710000FFFFFF00 + } + end + end +end diff --git a/components/fpspreadsheet/reference/BIFFExplorer/bemain.pas b/components/fpspreadsheet/reference/BIFFExplorer/bemain.pas new file mode 100644 index 000000000..2449bd3c5 --- /dev/null +++ b/components/fpspreadsheet/reference/BIFFExplorer/bemain.pas @@ -0,0 +1,1144 @@ +unit beMain; + +{$mode objfpc}{$H+} + +interface + +uses + ActnList, Classes, ComCtrls, ExtCtrls, Grids, Menus, StdCtrls, SysUtils, + FileUtil, Forms, Controls, Graphics, Dialogs, Buttons, VirtualTrees, + {$ifdef USE_NEW_OLE} + fpolebasic, + {$else} + fpolestorage, + {$endif} + fpSpreadsheet, + mrumanager, beBIFFGrid; + +type + { Virtual tree node data } + TBiffNodeData = class + Offset: Integer; + RecordID: Integer; + RecordName: String; + RecordDescription: String; + destructor Destroy; override; + end; + + + { TMainForm } + TMainForm = class(TForm) + AcFileOpen: TAction; + AcFileQuit: TAction; + AcFind: TAction; + AcFindNext: TAction; + AcFindPrev: TAction; + AcAbout: TAction; + AcFindClose: TAction; + AcNodeExpand: TAction; + AcNodeCollapse: TAction; + ActionList: TActionList; + BIFFTree: TVirtualStringTree; + CbFind: TComboBox; + HexGrid: TStringGrid; + ImageList: TImageList; + MainMenu: TMainMenu; + AnalysisDetails: TMemo; + MenuItem1: TMenuItem; + MenuItem3: TMenuItem; + MenuItem5: TMenuItem; + MenuItem6: TMenuItem; + MenuItem7: TMenuItem; + MnuFind: TMenuItem; + MnuRecord: TMenuItem; + MnuFileReopen: TMenuItem; + MenuItem4: TMenuItem; + MnuHelp: TMenuItem; + MenuItem2: TMenuItem; + MnuFileQuit: TMenuItem; + MnuFileOpen: TMenuItem; + MnuFile: TMenuItem; + OpenDialog: TOpenDialog; + PageControl: TPageControl; + DetailPanel: TPanel; + HexPanel: TPanel; + FindPanel: TPanel; + TreePopupMenu: TPopupMenu; + TreePanel: TPanel; + BtnFindNext: TSpeedButton; + BtnFindPrev: TSpeedButton; + RecentFilesPopupMenu: TPopupMenu; + SpeedButton3: TSpeedButton; + Splitter1: TSplitter; + HexSplitter: TSplitter; + AlphaGrid: TStringGrid; + HexDumpSplitter: TSplitter; + PgAnalysis: TTabSheet; + PgValues: TTabSheet; + DetailsSplitter: TSplitter; + StatusBar: TStatusBar; + ToolButton3: TToolButton; + ToolButton4: TToolButton; + ValueGrid: TStringGrid; + ToolBar: TToolBar; + ToolButton1: TToolButton; + ToolButton2: TToolButton; + procedure AcAboutExecute(Sender: TObject); + procedure AcFileOpenExecute(Sender: TObject); + procedure AcFileQuitExecute(Sender: TObject); + procedure AcFindCloseExecute(Sender: TObject); + procedure AcFindExecute(Sender: TObject); + procedure AcFindNextExecute(Sender: TObject); + procedure AcFindPrevExecute(Sender: TObject); + procedure AcNodeCollapseExecute(Sender: TObject); + procedure AcNodeCollapseUpdate(Sender: TObject); + procedure AcNodeExpandExecute(Sender: TObject); + procedure AcNodeExpandUpdate(Sender: TObject); + procedure AlphaGridSelection(Sender: TObject; aCol, aRow: Integer); + procedure BIFFTreeBeforeCellPaint(Sender: TBaseVirtualTree; + TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; + CellPaintMode: TVTCellPaintMode; CellRect: TRect; var ContentRect: TRect); + procedure BIFFTreeFocusChanged(Sender: TBaseVirtualTree; + Node: PVirtualNode; Column: TColumnIndex); + procedure BIFFTreeFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode); + procedure BIFFTreeGetNodeDataSize(Sender: TBaseVirtualTree; + var NodeDataSize: Integer); + procedure BIFFTreeGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; + Column: TColumnIndex; TextType: TVSTTextType; var CellText: String); + procedure BIFFTreePaintText(Sender: TBaseVirtualTree; + const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; + TextType: TVSTTextType); + procedure CbFindChange(Sender: TObject); + procedure CbFindKeyPress(Sender: TObject; var Key: char); + procedure FormCloseQuery(Sender: TObject; var CanClose: boolean); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure GridClick(Sender: TObject); + procedure HexGridPrepareCanvas(sender: TObject; aCol, aRow: Integer; + aState: TGridDrawState); + procedure HexGridSelection(Sender: TObject; aCol, aRow: Integer); + procedure ListViewSelectItem(Sender: TObject; Item: TListItem; + Selected: Boolean); + procedure PageControlChange(Sender: TObject); + + private + MemStream: TMemoryStream; + OLEStorage: TOLEStorage; + FFileName: String; + FFormat: TsSpreadsheetFormat; + FBuffer: TBIFFBuffer; + FCurrOffset: Integer; + FLockHexDumpGrids: Integer; + FAnalysisGrid: TBIFFGrid; + FMRUMenuManager : TMRUMenuManager; + procedure AddToHistory(const AText: String); + procedure AnalysisGridDetails(Sender: TObject; ADetails: TStrings); + procedure ExecFind(ANext, AKeep: Boolean); + function GetNodeData(ANode: PVirtualNode): TBiffNodeData; + function GetRecType: Word; + procedure LoadFile(const AFileName: String); overload; + procedure LoadFile(const AFileName: String; AFormat: TsSpreadsheetFormat); overload; + procedure MRUMenuManagerRecentFile(Sender:TObject; const AFileName:string); + procedure PopulateAnalysisGrid; + procedure PopulateHexDump; + procedure PopulateValueGrid; + procedure ReadCmdLine; + procedure ReadFromIni; + procedure ReadFromStream(AStream: TStream); + procedure UpdateCaption; + procedure WriteToIni; + + public + procedure BeforeRun; + end; + +var + MainForm: TMainForm; + +implementation + +{$R *.lfm} + +uses + IniFiles, StrUtils, Math, lazutf8, + fpsUtils, + beUtils, beBIFFUtils, beAbout; + +const + VALUE_ROW_INDEX = 1; + VALUE_ROW_BYTE = 2; + VALUE_ROW_WORD = 3; + VALUE_ROW_DWORD = 4; + VALUE_ROW_QWORD = 5; + VALUE_ROW_DOUBLE = 6; + VALUE_ROW_ANSISTRING = 7; + VALUE_ROW_WIDESTRING = 8; + + MAX_HISTORY = 16; + + +{ Virtual tree nodes } +type + TObjectNodeData = record + Data: TObject; + end; + PObjectNodeData = ^TObjectNodeData; + + +{ TBiffNodeData } + +destructor TBiffNodeData.Destroy; +begin + Finalize(RecordName); + Finalize(RecordDescription); + inherited; +end; + + +{ TMainForm } + +procedure TMainForm.AcAboutExecute(Sender: TObject); +var + F: TAboutForm; +begin + F := TAboutForm.Create(nil); + try + F.ShowModal; + finally + F.Free; + end; +end; + + +procedure TMainForm.AcFileOpenExecute(Sender: TObject); +begin + with OpenDialog do begin + if Execute then LoadFile(FileName); + end; +end; + + +procedure TMainForm.AcFileQuitExecute(Sender: TObject); +begin + Close; +end; + + +procedure TMainForm.AcFindCloseExecute(Sender: TObject); +begin + AcFind.Checked := false; + FindPanel.Hide; +end; + + +procedure TMainForm.AcFindExecute(Sender: TObject); +begin + if AcFind.Checked then begin + FindPanel.Show; + CbFind.SetFocus; + end else begin + FindPanel.Hide; + end; +end; + + +procedure TMainForm.AcFindNextExecute(Sender: TObject); +begin + ExecFind(true, false); +end; + + +procedure TMainForm.AcFindPrevExecute(Sender: TObject); +begin + ExecFind(false, false); +end; + + +procedure TMainForm.AcNodeCollapseExecute(Sender: TObject); +var + node: PVirtualNode; +begin + node := BiffTree.FocusedNode; + if node <> nil then begin + if BiffTree.GetNodeLevel(node) > 0 then + node := node^.Parent; + BiffTree.Expanded[node] := false; + end; +end; + +procedure TMainForm.AcNodeCollapseUpdate(Sender: TObject); +var + node: PVirtualNode; +begin + node := BiffTree.FocusedNode; + if node <> nil then begin + if BiffTree.GetNodeLevel(node) > 0 then + node := node^.Parent; + end; + AcNodeCollapse.Enabled := (node <> nil) and BiffTree.Expanded[node]; +end; + + +procedure TMainForm.AcNodeExpandExecute(Sender: TObject); +var + node: PVirtualNode; +begin + node := BiffTree.FocusedNode; + if node <> nil then begin + if BiffTree.GetNodeLevel(node) > 0 then + node := node^.Parent; + BiffTree.Expanded[node] := true; + end; +end; + + +procedure TMainForm.AcNodeExpandUpdate(Sender: TObject); +var + node: PVirtualNode; +begin + node := BiffTree.FocusedNode; + if node <> nil then begin + if BiffTree.GetNodeLevel(node) > 0 then + node := node^.Parent; + end; + AcNodeExpand.Enabled := (node <> nil) and not BiffTree.Expanded[node]; +end; + +procedure TMainForm.AddToHistory(const AText: String); +begin + if (AText <> '') and (CbFind.Items.IndexOf(AText) = -1) then begin + CbFind.Items.Insert(0, AText); + while CbFind.Items.Count > MAX_HISTORY do + CbFind.Items.Delete(CbFind.Items.Count-1); + end; +end; + + +procedure TMainForm.AlphaGridSelection(Sender: TObject; aCol, aRow: Integer); +begin + if FLockHexDumpGrids > 0 then + exit; + FCurrOffset := (ARow - AlphaGrid.FixedRows)*16 + (ACol - AlphaGrid.FixedCols); + if FCurrOffset < 0 then FCurrOffset := 0; + inc(FLockHexDumpGrids); + HexGrid.Col := aCol - AlphaGrid.FixedCols + HexGrid.FixedCols; + HexGrid.Row := aRow - AlphaGrid.FixedRows + HexGrid.FixedRows; + dec(FLockHexDumpGrids); + if FCurrOffset > -1 then + Statusbar.Panels[3].Text := Format('HexViewer offset: %d', [FCurrOffset]) + else + Statusbar.Panels[3].Text := ''; +end; + + +procedure TMainForm.AnalysisGridDetails(Sender: TObject; ADetails: TStrings); +begin + AnalysisDetails.Lines.Assign(ADetails); +end; + + +procedure TMainForm.BeforeRun; +begin + ReadFromIni; + ReadCmdLine; +end; + + +procedure TMainForm.BIFFTreeBeforeCellPaint(Sender: TBaseVirtualTree; + TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; + CellPaintMode: TVTCellPaintMode; CellRect: TRect; var ContentRect: TRect); +var + s: String; +begin + if (Sender.GetNodeLevel(Node) = 0) and (Column = 0) then begin + // Left-align parent nodes (column 0 is right-aligned) + BiffTreeGetText(Sender, Node, 0, ttNormal, s); + TargetCanvas.Font.Style := [fsBold]; + ContentRect.Right := CellRect.Left + TargetCanvas.TextWidth(s) + 30; + end; +end; + + +procedure TMainForm.BIFFTreeFocusChanged(Sender: TBaseVirtualTree; + Node: PVirtualNode; Column: TColumnIndex); +var + ptr: PObjectNodeData; + data: TBiffNodeData; + n: Word; +begin + ptr := Sender.GetNodeData(Node); + data := TBiffNodeData(ptr^.Data); + + // Move to start of record + 2 bytes to skip record type ID. + MemStream.Position := PtrInt(data.Offset) + 2; + + // Read size of record + n := WordLEToN(MemStream.ReadWord); + + // Read record data + SetLength(FBuffer, n); + if n > 0 then + MemStream.ReadBuffer(FBuffer[0], n); + + // Update user interface + if (BiffTree.FocusedNode <> nil) and (BiffTree.GetNodeLevel(BiffTree.FocusedNode) > 0) + then begin + Statusbar.Panels[0].Text := Format('Record ID: $%.4x', [data.RecordID]); + Statusbar.Panels[1].Text := data.RecordName; + Statusbar.Panels[2].Text := Format('Record size: %d bytes', [n]); + Statusbar.Panels[3].Text := ''; + end else begin + Statusbar.Panels[0].Text := ''; + Statusbar.Panels[1].Text := data.RecordName; + Statusbar.Panels[2].Text := ''; + Statusbar.Panels[3].Text := ''; + end; + PopulateHexDump; + PageControlChange(nil); +end; + + +procedure TMainForm.BIFFTreeFreeNode(Sender: TBaseVirtualTree; + Node: PVirtualNode); +var + ptr: PObjectNodeData; +begin + ptr := BiffTree.GetNodeData(Node); + if ptr <> nil then + FreeAndNil(ptr^.Data); +end; + + +procedure TMainForm.BIFFTreeGetNodeDataSize(Sender: TBaseVirtualTree; + var NodeDataSize: Integer); +begin + NodeDataSize := SizeOf(TObjectNodeData); +end; + + +procedure TMainForm.BIFFTreeGetText(Sender: TBaseVirtualTree; + Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType; + var CellText: String); +var + ptr: PObjectNodeData; + data: TBiffNodeData; +begin + CellText := ''; + ptr := Sender.GetNodeData(Node); + if ptr <> nil then begin + data := TBiffNodeData(ptr^.Data); + case Sender.GetNodeLevel(Node) of + 0: if Column = 0 then + 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; + end; + end; + end; +end; + + +procedure TMainForm.BIFFTreePaintText(Sender: TBaseVirtualTree; + const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; + TextType: TVSTTextType); +begin + // Paint parent node in bold font. + if (Sender.GetNodeLevel(Node) = 0) and (Column = 0) then + TargetCanvas.Font.Style := [fsBold]; +end; + + +procedure TMainForm.CbFindChange(Sender: TObject); +begin + ExecFind(true, true); +end; + + +procedure TMainForm.CbFindKeyPress(Sender: TObject; var Key: char); +begin + if Key = #13 then + ExecFind(true, false); +end; + + +procedure TMainForm.ExecFind(ANext, AKeep: Boolean); +var + s: String; + node, node0: PVirtualNode; + + function GetRecordname(ANode: PVirtualNode; UseLowercase: Boolean = true): String; + var + data: TBIffNodeData; + begin + data := GetNodeData(ANode); + if Assigned(data) then begin + if UseLowercase then + Result := lowercase(data.RecordName) + else + Result := data.RecordName; + end else + Result := ''; + end; + + function GetNextNode(ANode: PVirtualNode): PVirtualNode; + var + nextparent: PVirtualNode; + begin + Result := BiffTree.GetNextSibling(ANode); + if (Result = nil) and (ANode <> nil) then begin + nextparent := BiffTree.GetNextSibling(ANode^.Parent); + if nextparent = nil then + nextparent := BiffTree.GetFirst; + Result := BiffTree.GetFirstChild(nextparent); + end; + end; + + function GetPrevNode(ANode: PVirtualNode): PVirtualNode; + var + prevparent: PVirtualNode; + begin + Result := BiffTree.GetPreviousSibling(ANode); + if (Result = nil) and (ANode <> nil) then begin + prevparent := BiffTree.GetPreviousSibling(ANode^.Parent); + if prevparent = nil then + prevparent := BiffTree.GetLast; + Result := BiffTree.GetLastChild(prevparent); + end; + end; + +begin + if CbFind.Text = '' then + exit; + + s := Lowercase(CbFind.Text); + node0 := BiffTree.FocusedNode; + if node0 = nil then + node0 := BiffTree.GetFirst; + if BiffTree.GetNodeLevel(node0) = 0 then + node0 := BiffTree.GetFirstChild(node0); + + if ANext then begin + if AKeep + then node := node0 + else node := GetNextNode(node0); + repeat + if pos(s, GetRecordname(node)) > 0 then begin + BiffTree.FocusedNode := node; + BiffTree.Selected[node] := true; + BiffTree.ScrollIntoView(node, true); + AddToHistory(GetRecordname(node, false)); + exit; + end; + node := GetNextNode(node); + until (node = node0) or (node = nil); + end else begin + if AKeep + then node := node0 + else node := GetPrevNode(node0); + repeat + if pos(s, GetRecordName(node)) > 0 then begin + BiffTree.FocusedNode := node; + BiffTree.Selected[node] := true; + BiffTree.ScrollIntoView(node, true); + AddToHistory(GetRecordName(node, false)); + exit; + end; + node := GetPrevNode(node); + until (node = node0) or (node = nil); + end; +end; + + +procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: boolean); +begin + if CanClose then + try + WriteToIni; + except + MessageDlg('Could not write setting to configuration file.', mtError, [mbOK], 0); + end; +end; + + +procedure TMainForm.FormCreate(Sender: TObject); +begin + FMRUMenuManager := TMRUMenuManager.Create(self); + with FMRUMenuManager do begin + Name := 'MRUMenuManager'; + IniFileName := GetAppConfigFile(false); + IniSection := 'RecentFiles'; + MaxRecent := 16; + MenuCaptionMask := '&%x - %s'; // & --> create hotkey + MenuItem := MnuFileReopen; + PopupMenu := RecentFilesPopupMenu; + OnRecentFile := @MRUMenuManagerRecentFile; + end; + + HexGrid.ColWidths[HexGrid.ColCount-1] := 5; + HexGrid.DefaultRowHeight := HexGrid.Canvas.TextHeight('Tg') + 4; + AlphaGrid.DefaultRowHeight := HexGrid.DefaultRowHeight; + ValueGrid.DefaultRowHeight := HexGrid.DefaultRowHeight; + BiffTree.DefaultNodeHeight := HexGrid.DefaultRowHeight; + BiffTree.Header.DefaultHeight := HexGrid.DefaultRowHeight + 4; + + FAnalysisGrid := TBIFFGrid.Create(self); + with FAnalysisGrid do begin + Parent := PgAnalysis; + Align := alClient; + DefaultRowHeight := HexGrid.DefaultRowHeight; + Options := Options + [goDrawFocusSelected]; + TitleStyle := tsNative; + OnDetails := @AnalysisGridDetails; + end; + + with ValueGrid do begin + ColCount := 3; + RowCount := VALUE_ROW_WIDESTRING+1; + Cells[0, 0] := 'Data type'; + Cells[1, 0] := 'Value'; + Cells[2, 0] := 'Offset range'; + Cells[0, VALUE_ROW_INDEX] := 'Offset'; + Cells[0, VALUE_ROW_BYTE] := 'Byte'; + Cells[0, VALUE_ROW_WORD] := 'Word'; + Cells[0, VALUE_ROW_DWORD] := 'DWord'; + Cells[0, VALUE_ROW_QWORD] := 'QWord'; + Cells[0, VALUE_ROW_DOUBLE] := 'Double'; + Cells[0, VALUE_ROW_ANSISTRING] := 'AnsiString'; + Cells[0, VALUE_ROW_WIDESTRING] := 'WideString'; + end; +end; + + +procedure TMainForm.FormDestroy(Sender: TObject); +begin + if MemStream <> nil then + FreeAndNil(MemStream); + if OLEStorage <> nil then + FreeAndNil(OLEStorage); +end; + + +procedure TMainForm.FormShow(Sender: TObject); +begin + Width := Width + 1; // remove black rectangle next to ValueGrid + Width := Width - 1; +end; + + +function TMainForm.GetNodeData(ANode: PVirtualNode): TBiffNodeData; +var + ptr: PObjectNodeData; +begin + result := nil; + if ANode <> nil then begin + ptr := BiffTree.GetNodeData(ANode); + if ptr <> nil then Result := TBiffNodeData(ptr^.Data); + end; +end; + + +function TMainForm.GetRecType: Word; +var + data: TBiffNodeData; +begin + Result := Word(-1); + if BiffTree.FocusedNode <> nil then begin + data := GetNodeData(BiffTree.FocusedNode); + if data <> nil then begin + MemStream.Position := data.Offset; + Result := WordLEToN(MemStream.ReadWord); + end; + end; +end; + + +procedure TMainForm.GridClick(Sender: TObject); +begin + if PageControl.ActivePage = PgValues then + PopulateValueGrid; +end; + + +procedure TMainForm.HexGridPrepareCanvas(sender: TObject; aCol, aRow: Integer; + aState: TGridDrawState); +var + ts: TTextStyle; +begin + ts := HexGrid.Canvas.TextStyle; + if ACol = 0 then + ts.Alignment := taRightJustify + else + ts.Alignment := taCenter; + ts.Opaque := false; + ts.Layout := tlCenter; + HexGrid.Canvas.TextStyle := ts; + + ts.Alignment := taCenter; + AlphaGrid.Canvas.TextStyle := ts; +end; + + +procedure TMainForm.HexGridSelection(Sender: TObject; aCol, aRow: Integer); +begin + if (FLockHexDumpGrids > 0) then + exit; + FCurrOffset := (ARow - HexGrid.FixedRows)*16 + (ACol - HexGrid.FixedCols); + if FCurrOffset < 0 then + FCurrOffset := 0; + inc(FLockHexDumpGrids); + AlphaGrid.Row := aRow - HexGrid.FixedRows + AlphaGrid.FixedRows; + AlphaGrid.Col := aCol - HexGrid.FixedCols + AlphaGrid.FixedCols; + dec(FLockHexDumpGrids); + if FCurrOffset > -1 then + Statusbar.Panels[3].Text := Format('HexViewer offset: %d', [FCurrOffset]) + else + Statusbar.Panels[3].Text := ''; +end; + + +procedure TMainForm.LoadFile(const AFileName: String); +var + fmt: TsSpreadsheetFormat; + valid: Boolean; + excptn: Exception = nil; +begin + if not FileExists(AFileName) then begin + MessageDlg(Format('File "%s" not found.', [AFileName]), mtError, [mbOK], 0); + exit; + end; + + if not SameText(ExtractFileExt(AFileName), '.xls') then begin + MessageDlg('BIFFExplorer can only process binary Excel files (extension ".xls")', + mtError, [mbOK], 0); + exit; + end; + + fmt := sfExcel8; + while True do begin + try + LoadFile(AFileName, fmt); + valid := True; + except + on E: Exception do begin + if fmt = sfExcel8 then excptn := E; + valid := False + end; + end; + if valid or (fmt = sfExcel2) then Break; + fmt := Pred(fmt); + end; + + // A failed attempt to read a file should bring an exception, so re-raise + // the exception if necessary. We re-raise the exception brought by Excel 8, + // since this is the most common format + if (not valid) and (excptn <> nil) then + raise excptn; + + FFormat := fmt; +end; + + +procedure TMainForm.LoadFile(const AFileName: String; AFormat: TsSpreadsheetFormat); +var + OLEDocument: TOLEDocument; +begin + if MemStream <> nil then + FreeAndNil(MemStream); + + if OLEStorage <> nil then + FreeAndNil(OLEStorage); + + MemStream := TMemoryStream.Create; + + if AFormat = sfExcel2 then begin + MemStream.LoadFromFile(AFileName); + end else begin + OLEStorage := TOLEStorage.Create; + + // Only one stream is necessary for any number of worksheets + OLEDocument.Stream := MemStream; + OLEStorage.ReadOLEFile(AFileName, OLEDocument, 'Workbook'); + + // Check if the operation succeded + if MemStream.Size = 0 then + raise Exception.Create('BIFF Explorer: Reading the OLE document failed'); + end; + + // Rewind the stream and read from it + MemStream.Position := 0; + FFileName := ExpandFileName(AFileName); + ReadFromStream(MemStream); + + UpdateCaption; + FMRUMenuManager.AddToRecent(AFileName); +end; + + +procedure TMainForm.ListViewSelectItem(Sender: TObject; Item: TListItem; + Selected: Boolean); +var + n: Word; +begin + if Selected then begin + // Move to start of record + 2 bytes to skip record type ID. + MemStream.Position := PtrInt(Item.Data) + 2; + + // Read size of record + n := WordLEToN(MemStream.ReadWord); + + // Read record data + SetLength(FBuffer, n); + MemStream.ReadBuffer(FBuffer[0], n); + + // Update user interface + Statusbar.Panels[0].Text := Format('Record ID: %s', [Item.SubItems[0]]); + Statusbar.Panels[1].Text := Item.SubItems[1]; + Statusbar.Panels[2].Text := Format('Record size: %s bytes', [Item.SubItems[3]]); + PopulateHexDump; + PageControlChange(nil); + end; +end; + + +procedure TMainForm.MRUMenuManagerRecentFile(Sender: TObject; + const AFileName: string); +begin + LoadFile(AFileName); +end; + + +procedure TMainForm.PopulateAnalysisGrid; +begin + FAnalysisGrid.SetRecordType(GetRecType, FBuffer, FFormat); +end; + + +procedure TMainForm.PopulateHexDump; +var + n: Word; + i,r,c, w: Integer; +begin + n := Length(FBuffer); + + // Prepare hex viewer rows... + r := HexGrid.FixedRows + n div 16; + if n mod 16 <> 0 then inc(r); + HexGrid.RowCount := r; + AlphaGrid.RowCount := r; + for i:=HexGrid.FixedRows to r-1 do begin + HexGrid.Rows[i].Clear; + HexGrid.Cells[0, i] := IntToStr((i - HexGrid.FixedRows)*16); + AlphaGrid.Rows[i].Clear; + end; + + // ... width of first column, ... + w := HexGrid.Canvas.TextWidth(IntToStr(n)) + 4; + if w > HexGrid.DefaultColWidth then + HexGrid.ColWidths[0] := w; + + // ... and cells + for i:=0 to Length(FBuffer)-1 do begin + c := i mod 16; + r := i div 16; + with HexGrid do + Cells[c+FixedCols, r+FixedRows] := Format('%.2x', [FBuffer[i]]); + with AlphaGrid do + if FBuffer[i] < 32 then + Cells[c+FixedCols, r+FixedRows] := '.' + else + Cells[c+FixedCols, r+FixedRows] := AnsiToUTF8(AnsiChar(FBuffer[i])); + end; + + // Clear value grid + if PageControl.ActivePage = PgValues then + with ValueGrid do begin + Clean(1, 1, RowCount-1, ColCount-1, [gzNormal]); + end; + + // Update status bar + HexGridSelection(nil, HexGrid.Col, HexGrid.Row); +end; + + +procedure TMainForm.PopulateValueGrid; +var + buf: array[0..1023] of Byte; + w: word absolute buf; + dw: DWord absolute buf; + qw: QWord absolute buf; + dbl: double absolute buf; + idx: Integer; + i, j: Integer; + s: String; + sw: WideString; + ls: Integer; +begin + idx := FCurrOffset; + + i := ValueGrid.RowCount; + j := ValueGrid.ColCount; + + ValueGrid.Cells[1, VALUE_ROW_INDEX] := IntToStr(idx); + + if idx <= Length(FBuffer)-SizeOf(byte) then begin + ValueGrid.Cells[1, VALUE_ROW_BYTE] := IntToStr(FBuffer[idx]); + ValueGrid.Cells[2, VALUE_ROW_BYTE] := Format('%d ... %d', [idx, idx]); + end + else begin + ValueGrid.Cells[1, VALUE_ROW_BYTE] := ''; + ValueGrid.Cells[2, VALUE_ROW_BYTE] := ''; + end; + + if idx <= Length(FBuffer)-SizeOf(word) then begin + buf[0] := FBuffer[idx]; + buf[1] := FBuffer[idx+1]; + ValueGrid.Cells[1, VALUE_ROW_WORD] := IntToStr(WordLEToN(w)); + ValueGrid.Cells[2, VALUE_ROW_WORD] := Format('%d ... %d', [idx, idx+SizeOf(Word)-1]); + end else begin + ValueGrid.Cells[1, VALUE_Row_WORD] := ''; + ValueGrid.Cells[2, VALUE_ROW_WORD] := ''; + end; + + if idx <= Length(FBuffer) - SizeOf(DWord) then begin + for i:=0 to SizeOf(DWord)-1 do buf[i] := FBuffer[idx+i]; + ValueGrid.Cells[1, VALUE_ROW_DWORD] := IntToStr(DWordLEToN(dw)); + ValueGrid.Cells[2, VALUE_ROW_DWORD] := Format('%d ... %d', [idx, idx+SizeOf(DWord)-1]); + end else begin + ValueGrid.Cells[1, VALUE_ROW_DWORD] := ''; + ValueGrid.Cells[2, VALUE_ROW_DWORD] := ''; + end; + + if idx <= Length(FBuffer) - SizeOf(QWord) then begin + for i:=0 to SizeOf(QWord)-1 do buf[i] := FBuffer[idx+i]; + ValueGrid.Cells[1, VALUE_ROW_QWORD] := Format('%d', [qw]); + ValueGrid.Cells[2, VALUE_ROW_QWORD] := Format('%d ... %d', [idx, idx+SizeOf(QWord)-1]); + end else begin + ValueGrid.Cells[1, VALUE_ROW_QWORD] := ''; + ValueGrid.Cells[2, VALUE_ROW_QWORD] := ''; + end; + + if idx <= Length(FBuffer) - SizeOf(double) then begin + for i:=0 to SizeOf(double)-1 do buf[i] := FBuffer[idx+i]; + ValueGrid.Cells[1, VALUE_ROW_DOUBLE] := Format('%f', [dbl]); + ValueGrid.Cells[2, VALUE_ROW_DOUBLE] := Format('%d ... %d', [idx, idx+SizeOf(Double)-1]); + end else begin + ValueGrid.Cells[1, VALUE_ROW_DOUBLE] := ''; + ValueGrid.Cells[2, VALUE_ROW_DOUBLE] := ''; + end; + + if idx < Length(FBuffer) then begin + ls := FBuffer[idx]; + SetLength(s, ls); + i := idx + 1; + j := 0; + while (i < Length(FBuffer)) and (j < Length(s)) do begin + inc(j); + s[j] := char(FBuffer[i]); + inc(i); + end; + SetLength(s, j); + ValueGrid.Cells[1, VALUE_ROW_ANSISTRING] := s; + ValueGrid.Cells[2, VALUE_ROW_ANSISTRING] := Format('%d ... %d', [idx, ls * SizeOf(char) + 1]); + end else begin + ValueGrid.Cells[1, VALUE_ROW_ANSISTRING] := ''; + ValueGrid.Cells[2, VALUE_ROW_ANSISTRING] := ''; + end; + + if idx < Length(FBuffer) then begin + ls := FBuffer[idx]; + SetLength(sw, ls); + j := 0; + i := idx + 2; + while (i < Length(FBuffer)-1) and (j < Length(sw)) do begin + buf[0] := FBuffer[i]; + buf[1] := FBuffer[i+1]; + inc(i, SizeOf(WideChar)); + inc(j); + sw[j] := WideChar(w); + end; + SetLength(sw, j); + ValueGrid.Cells[1, VALUE_ROW_WIDESTRING] := UTF8Decode(sw); + ValueGrid.Cells[2, VALUE_ROW_WIDESTRING] := Format('%d ... %d', [idx, idx + ls*SizeOf(wideChar)+1]); + end else begin + ValueGrid.Cells[1, VALUE_ROW_WIDESTRING] := ''; + ValueGrid.Cells[2, VALUE_ROW_WIDESTRING] := ''; + end; +end; + + +procedure TMainForm.ReadCmdLine; +begin + if ParamCount > 0 then + LoadFile(ParamStr(1)); +end; + + +procedure TMainForm.ReadFromIni; +var + ini: TCustomIniFile; + i: Integer; +begin + ini := CreateIni; + try + ReadFormFromIni(ini, 'MainForm', self); + + BiffTree.Width := ini.ReadInteger('MainForm', 'RecordList_Width', BiffTree.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); + + ValueGrid.Height := ini.ReadInteger('MainForm', 'ValueGrid_Height', ValueGrid.Height); + for i:=0 to ValueGrid.ColCount-1 do + ValueGrid.ColWidths[i] := ini.ReadInteger('MainForm', + Format('ValueGrid_ColWidth_%d', [i+1]), ValueGrid.ColWidths[i]); + + AlphaGrid.Width := ini.ReadInteger('MainForm', 'AlphaGrid_Width', AlphaGrid.Width); + for i:=0 to AlphaGrid.ColCount-1 do + AlphaGrid.ColWidths[i] := ini.ReadInteger('MainForm', + Format('AlphaGrid_ColWidth_%d', [i+1]), AlphaGrid.ColWidths[i]); + + for i:=0 to FAnalysisGrid.ColCount-1 do + FAnalysisGrid.ColWidths[i] := ini.ReadInteger('MainForm', + Format('AnalysisGrid_ColWidth_%d', [i+1]), FAnalysisGrid.ColWidths[i]); + + AnalysisDetails.Width := ini.ReadInteger('MainForm', 'AnalysisDetails_Width', AnalysisDetails.Width); + + PageControl.Height := ini.ReadInteger('MainForm', 'PageControl_Height', PageControl.Height); + PageControl.ActivePageIndex := ini.ReadInteger('MainForm', 'PageIndex', PageControl.ActivePageIndex); + finally + ini.Free; + end; +end; + + +procedure TMainForm.ReadFromStream(AStream: TStream); +var + recType: Word; + recSize: Word; + p: Cardinal; + p0: Cardinal; + s: String; + i: Integer; + node: PVirtualNode; + parentnode: PVirtualNode; + ptr: PObjectNodeData; + parentdata, data: TBiffNodeData; + w: word; + crs: TCursor; +begin + crs := Screen.Cursor; + try + Screen.Cursor := crHourGlass; + BiffTree.Clear; + parentnode := nil; + AStream.Position := 0; + while AStream.Position < AStream.Size do begin + p := AStream.Position; + recType := WordLEToN(AStream.ReadWord); + recSize := WordLEToN(AStream.ReadWord); + s := RecTypeName(recType); + i := pos(':', s); + // in case of BOF record: create new parent node for this substream + if (recType = $0009) or (recType = $0209) or (recType = $0409) or (recType = $0809) + then begin + // Read info on substream beginning here + p0 := AStream.Position; + AStream.Position := AStream.Position + 2; + w := WordLEToN(AStream.ReadWord); + AStream.Position := p0; + parentdata := TBiffNodeData.Create; + parentdata.Offset := p; + parentdata.Recordname := BOFName(w); + // add parent node for this substream + parentnode := BIFFTree.AddChild(nil); + ptr := BIFFTree.GetNodeData(parentnode); + ptr^.Data := parentdata; + end; + // add node to parent node + data := TBiffNodeData.Create; + data.Offset := p; + data.RecordID := recType; + if i > 0 then begin + data.RecordName := copy(s, 1, i-1); + data.RecordDescription := copy(s, i+2, Length(s)); + end else begin + data.RecordName := s; + data.RecordDescription := ''; + end; + node := BIFFTree.AddChild(parentnode); + ptr := BIFFTree.GetNodeData(node); + ptr^.Data := data; + // advance stream pointer + AStream.Position := AStream.Position + recSize; + end; + // expand all parent nodes + node := BiffTree.GetFirst; + while node <> nil do begin + BiffTree.Expanded[node] := true; + node := BiffTree.GetNextSibling(node); + end; + // Select first node + BiffTree.FocusedNode := BiffTree.GetFirst; + BiffTree.Selected[BiffTree.FocusedNode] := true; + + finally + Screen.Cursor := crs; + end; +end; + + +procedure TMainForm.PageControlChange(Sender: TObject); +begin + if PageControl.ActivePage = PgAnalysis then + PopulateAnalysisGrid + else + if PageControl.ActivePage = PgValues then + PopulateValueGrid; +end; + + +procedure TMainForm.UpdateCaption; +begin + Caption := Format('BIFF Explorer - "%s', [IfThen(FFileName <> '', FFileName, 'no file loaded')]); +end; + + +procedure TMainForm.WriteToIni; +var + ini: TCustomIniFile; + i: Integer; +begin + ini := CreateIni; + try + WriteFormToIni(ini, 'MainForm', self); + + ini.WriteInteger('MainForm', 'RecordList_Width', BiffTree.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); + + ini.WriteInteger('MainForm', 'ValueGrid_Height', ValueGrid.Height); + for i:=0 to ValueGrid.ColCount-1 do + ini.WriteInteger('MainForm', Format('ValueGrid_ColWidth_%d', [i+1]), ValueGrid.ColWidths[i]); + + ini.WriteInteger('MainForm', 'AlphaGrid_Width', AlphaGrid.Width); + for i:=0 to AlphaGrid.ColCount-1 do + ini.WriteInteger('MainForm', Format('AlphaGrid_ColWidth_%d', [i+1]), AlphaGrid.ColWidths[i]); + + 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', 'PageIndex', PageControl.ActivePageIndex); + ini.WriteInteger('MainForm', 'PageControl_Height', PageControl.Height); + finally + ini.Free; + end; +end; + +end. + diff --git a/components/fpspreadsheet/reference/BIFFExplorer/beutils.pas b/components/fpspreadsheet/reference/BIFFExplorer/beutils.pas new file mode 100644 index 000000000..736ea8475 --- /dev/null +++ b/components/fpspreadsheet/reference/BIFFExplorer/beutils.pas @@ -0,0 +1,66 @@ +unit beUtils; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, IniFiles, Forms; + +function CreateIni : TCustomIniFile; +procedure ReadFormFromIni(ini: TCustomIniFile; ASection: String; AForm: TCustomForm); +procedure WriteFormToIni(ini: TCustomIniFile; ASection: String; AForm: TCustomForm); + + +implementation + +function CreateIni : TCustomIniFile; +var + cfg : string; +begin + cfg := GetAppConfigDir(false); + if not DirectoryExists(cfg) then + CreateDir(cfg); + result := TMemIniFile.Create(GetAppConfigFile(false)); +end; + +procedure ReadFormFromIni(ini: TCustomIniFile; ASection: String; AForm: TCustomForm); +var + L,T,W,H: Integer; + isMax: Boolean; +begin + L := ini.ReadInteger(ASection, 'Left', AForm.Left); + T := Ini.ReadInteger(ASection, 'Top', AForm.Top); + W := ini.ReadInteger(ASection, 'Width', AForm.Width); + H := ini.ReadInteger(ASection, 'Height', AForm.Height); + isMax := ini.ReadBool(ASection, 'Maximized', AForm.WindowState = wsMaximized); + if W > Screen.Width then W := Screen.Width; + if H > Screen.Height then H := Screen.Height; + if L < 0 then L := 0; + if T < 0 then T := 0; + if L + W > Screen.Width then L := Screen.Width - W; + if T + H > Screen.Height then T := Screen.Height - H; + AForm.Left := L; + AForm.Top := T; + AForm.Width := W; + AForm.Height := H; + if IsMax then + AForm.WindowState := wsMaximized + else + AForm.WindowState := wsNormal; +end; + + +procedure WriteFormToIni(ini: TCustomIniFile; ASection: String; AForm: TCustomForm); +begin + ini.WriteBool(ASection, 'Maximized', (AForm.WindowState = wsMaximized)); + if AForm.WindowState = wsNormal then begin + ini.WriteInteger(ASection, 'Left', AForm.Left); + ini.WriteInteger(ASection, 'Top', AForm.Top); + ini.WriteInteger(ASection, 'Width', AForm.Width); + ini.WriteInteger(ASection, 'Height', AForm.Height); + end; +end; + +end. + diff --git a/components/fpspreadsheet/reference/BIFFExplorer/mrumanager.pp b/components/fpspreadsheet/reference/BIFFExplorer/mrumanager.pp new file mode 100644 index 000000000..847f886e9 --- /dev/null +++ b/components/fpspreadsheet/reference/BIFFExplorer/mrumanager.pp @@ -0,0 +1,485 @@ +{ MRU (Most Recent Used) menu item manager + + Copyright (C) 2011 Michael Van Canneyt (michael@freepascal.org) + Modifications by Werner Pamler + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version with the following modification: + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent modules,and + to copy and distribute the resulting executable under terms of your choice, + provided that you also meet, for each linked independent module, the terms + and conditions of the license of that module. An independent module is a + module which is not derived from or based on this library. If you modify + this library, you may extend this exception to your version of the library, + but you are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License + for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + modified by wp +} +unit mrumanager; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, inifiles, menus; + +Type + { TRecentMenuItem } + + TRecentMenuItem = Class(TMenuItem) + Private + FFileName : string; + Public + Property FileName : String Read FFileName; + end; + TRecentMenuItemClass = Class of TRecentMenuItem; + + { TMRUMenuManager } + + TOnRecentFileEvent = Procedure(Sender : TObject; Const AFileName : String) of object; + + TMRUMenuManager = Class(TComponent) + Private + FIniFileName: String; + FIniSection: String; + FOnRecent: TOnRecentFileEvent; + FRecent : TStrings; + FMaxRecent : Integer; + FMenuCaptionMask : string; + FMIRecent : TMenuItem; + FPMRecent : TPopupMenu; + FMaxItemLength : integer; + procedure SetIniFileName(const AValue:string); + procedure SetIniSection(const AValue:string); + procedure SetMaxItemLength(const AValue:integer); + procedure SetMenuCaptionMask(const AValue:string); + procedure SetMIRecent(const AValue: TMenuItem); + procedure SetPMRecent(const AValue: TPopupMenu); + procedure SetRecent(const AValue: TStrings); + protected + // Overrides. + procedure Loaded; override; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + // Return default name and section if either is empty. + procedure GetFileNameAndSection(Var AFileName,ASection : String); virtual; + // Override if you want to load additional values. + procedure LoadFromIni(Ini: TCustomIniFile; ASection: String); virtual; + // Override if you want to write additional values. + procedure SaveToIni(Ini: TCustomIniFile; ASection: String); virtual; + // Called when menu item is clicked. + procedure DoOnRecentClick(Sender: TObject); virtual; + // Override this if you want to create a custom class of menu itel. + function CreateMenuItem(AOwner: TComponent): TRecentMenuItem; virtual; + // Create a menu caption. Default is index followed by filename. + // Override if you want to customize. + Function CreateMenuCaption(AIndex : Integer; Const AFileName : String) : String; virtual; + Public + Constructor Create(AOwner : TComponent);override; + Destructor Destroy; override; + // Load files from ini file AFileName in section ASection. Calls ShowRecentFiles + // Need for explicit call only when IniFileName='' and IniSection='' and class created at run-time + procedure LoadRecentFilesFromIni(const AFileName: string=''; const ASection: String=''); + // Saves files to ini file AFileName in section ASection. + procedure SaveRecentFilesToIni(const AFileName: string=''; const ASection: String=''); + // Add a filename to the list of files. + // If an existing file is added, it is moved first in the list. + // If MaxRecent is attained, the last one is removed. + // Calls ShowRecentFiles. + procedure AddToRecent(AFileName: String); + // Re-populate the menu. + procedure ShowRecentFiles; + Published + // Max. items to be kept in the list. + Property MaxRecent : Integer Read FMaxRecent write FMaxRecent; + // Menu item to create a submenu under. Existing items will be removed. + Property MenuItem : TMenuItem Read FMIRecent Write SetMIRecent; + // Popupmenu attached to a toolbar button. Existing items will be removed. + Property PopupMenu : TPopupMenu Read FPMRecent Write SetPMRecent; + // Default ini filename. + Property IniFileName : String Read FIniFileName Write SetIniFileName; + // Default ini section. + Property IniSection : String Read FIniSection Write SetIniSection; + // Maximum length of recent menu item + Property MaxItemLength : integer Read FMaxItemLength Write SetMaxItemLength default 80; + // Format mask for MenuCaption: first placeholder must be %d, second %s, e.g. '%d - %s' + Property MenuCaptionMask : string read FMenuCaptionMask Write SetMenuCaptionMask; + // Recent items. If adding manually to the list, ShowRecentFiles must be called manually. + Property Recent : TStrings Read FRecent Write SetRecent; + // Called when the user clicks an recent meu item. + Property OnRecentFile : TOnRecentFileEvent Read FOnRecent Write FOnRecent; + end; + EMRUManager = Class(Exception); + +Const + DefaultIniFile = 'recent.ini'; + DefaultSection = 'Global'; + KeyMaxRecent = 'MaxRecent'; + KeyCount = 'Count'; + KeyFile = 'File%d'; + +implementation + +Resourcestring + SErrFailedToCreateDir = 'Failed to create directory "%s"'; + +const + DEFAULT_MASK = '%d. %s'; + +function MinimizeFileName(const AFileName:string; AMaxLen:integer) : string; + + procedure SplitPath(const APath:String; Parts: TStrings); + { Splits the provided path into constituent folder names } + var + i, j : Integer; + begin + if APath = '' then exit; + if not Assigned(Parts) then exit; + + i := Length(APath); + j := i; + while (i >= 1) do begin + if APath[i] = DirectorySeparator then begin + Parts.Insert(0, copy(APath, i+1, j-i)); + j := i; + end; + dec(i); + end; + Parts.Insert(0, copy(APath, 1, j)); + end; + + function AddStringsFromTo(AList:TStrings; FromIndex,ToIndex:integer) : string; + var + i : integer; + begin + result := ''; + for i:=FromIndex to ToIndex do + result := result + AList[i]; + end; + +var + Parts : TStringList; + i : integer; + tmp : string; +begin + result := AFileName; + if Length(AFileName) > AMaxLen then begin + Parts := TStringList.Create; + try + SplitPath(AFileName, Parts); + i := Parts.Count div 2; + while (i < Parts.Count) do begin + tmp := Format('%s...%s%s', [ + AddStringsFromTo(Parts, 0, i-1), + DirectorySeparator, + AddStringsFromTo(Parts, i+1, Parts.Count-1) + ]); + if Length(tmp) < AMaxLen then begin + result := tmp; + exit; + end else + Parts.Delete(i); + i := Parts.Count div 2; + end; + result := ExtractFileName(AFileName); + finally + Parts.Free; + end; + end; +end; + +procedure TMRUMenuManager.AddToRecent(AFileName : String); + +Var + I,J : Integer; + B : Boolean; + +begin + AFileName:=ExpandFileName(AFileName); + With FRecent do + begin + J:=IndexOf(AFileName); + If (J<>-1) then + begin + if (J>0) then + Exchange(0,J) + end + else + begin + While (Count>=FMaxRecent) do + Delete(Count-1); + Insert(0,AFileName) + end; + end; + ShowRecentFiles; +end; + +function TMRUMenuManager.CreateMenuItem(AOwner :TComponent) : TRecentMenuItem; + +begin + Result:=TRecentMenuItem.Create(AOwner); +end; + +function TMRUMenuManager.CreateMenuCaption(AIndex: Integer; + const AFileName: String): String; +var + fn : string; + mask : string; +begin + if FMaxItemLength > 0 then + fn := MinimizeFileName(AFileName, FMaxItemLength) + else + fn := AFileName; + if FMenuCaptionMask = '' then + mask := DEFAULT_MASK + else + mask := FMenuCaptionMask; + Result:=Format(mask, [AIndex+1,fn]); +end; + +procedure TMRUMenuManager.ShowRecentFiles; + +Var + I : Integer; + M : TRecentMenuItem; + +begin + if Assigned(FMIRecent) then begin + FMIRecent.clear; + For I:=0 to FRecent.Count-1 do + begin + M:=CreateMenuItem(Self.Owner); + M.Caption:=CreateMenuCaption(I,FRecent[i]); + M.FFileName:=FRecent[i]; + M.OnClick:=@DoOnRecentClick; + FMIRecent.Add(M); + end; + end; + if Assigned(FPMRecent) then begin + FPMRecent.Items.Clear; + for i:=0 to FRecent.Count-1 do + begin + M := CreateMenuItem(Self.Owner); + M.Caption := CreateMenuCaption(I, Recent[i]); + M.FFileName := FRecent[i]; + M.OnClick := @DoOnRecentClick; + FPMRecent.Items.Add(M); + end; + end; +end; + +procedure TMRUMenuManager.LoadFromIni(Ini : TCustomIniFile; ASection : String); + +Var + I,Count : Integer; + FN : String; + +begin + FRecent.Clear; + FMaxRecent:=Ini.ReadInteger(ASection,KeyMaxRecent,10); + Count:=Ini.ReadInteger(ASection,KeyCount,0); + For I:=1 to Count do + begin + FN:=Ini.ReadString(ASection,Format(KeyFile,[i]),''); + If (FN<>'') then + FRecent.Add(FN); + end; +end; + +procedure TMRUMenuManager.GetFileNameAndSection(var AFileName, ASection: String); + +begin + if (AFileName='') then + begin + AFileName:=GetAppConfigDir(False); + AFileName:=IncludeTrailingPathDelimiter(AFileName)+DefaultIniFile; + end; + if (ASection='') then + ASection:=DefaultSection; +end; + +procedure TMRUMenuManager.LoadRecentFilesFromIni(Const AFileName : string = ''; Const ASection : String = ''); + +Var + DN,FN,Sec : String; + Ini : TIniFile; + +begin + FN:=AFileName; + Sec:=ASection; + GetFileNameAndSection(FN,Sec); + DN:=ExtractFilePath(FN); + If ForceDirectories(DN) then + begin + If FileExists(FN) then + begin + Ini:=TIniFile.Create(FN); + try + LoadFromIni(Ini,Sec); + finally + Ini.Free; + end; + end; + end; + ShowRecentFiles; +end; + +procedure TMRUMenuManager.SaveToIni(Ini : TCustomIniFile; ASection : String); + +Var + I : Integer; +begin + Ini.EraseSection(ASection); + Ini.WriteInteger(ASection,KeyMaxRecent,FMaxRecent); + Ini.WriteInteger(ASection,KeyCount,FRecent.Count); + For I:=0 to FRecent.Count-1 do + Ini.WriteString(ASection,Format(KeyFile,[i+1]),FRecent[i]); + Ini.UpdateFile; +end; + +procedure TMRUMenuManager.SaveRecentFilesToIni(Const AFileName : string = ''; Const ASection : String = ''); + +Var + DN,FN,Sec : String; + Ini : TMemIniFile; + +begin + FN:=AFileName; + Sec:=ASection; + GetFileNameAndSection(FN,Sec); + DN:=ExtractFilePath(FN); + If not ForceDirectories(DN) then + Raise EMRUManager.CreateFmt(SErrFailedToCreateDir,[DN]); + Ini:=TMemIniFile.Create(FN); + try + SaveToIni(Ini,Sec); + finally + Ini.Free; + end; +end; + +procedure TMRUMenuManager.SetIniFileName(const AValue:string); +begin + if AValue <> FIniFileName then begin + FIniFileName := AValue; + LoadRecentFilesFromIni(FIniFileName, FIniSection); + end; +end; + +procedure TMRUMenuManager.SetIniSection(const AValue:string); +begin + if AValue <> FIniSection then begin + FIniSection := AValue; + LoadRecentFilesFromini(FIniFileName, FIniSection); + end; +end; + +procedure TMRUMenuManager.SetMaxItemLength(const AValue:integer); +begin + if FMaxItemLength <> AValue then begin + FMaxItemLength := AValue; + ShowRecentFiles; + end; +end; + +procedure TMRUMenuManager.SetMenuCaptionMask(const AValue:string); +begin + if FMenuCaptionMask <> AValue then begin + FMenuCaptionMask := AValue; + ShowRecentFiles; + end; +end; + +procedure TMRUMenuManager.SetMIRecent(const AValue: TMenuItem); +begin + if FMIRecent=AValue then exit; + If Assigned(FMIRecent) then + FMIRecent.RemoveFreeNotification(Self); + FMIRecent:=AValue; + If Assigned(FMIRecent) then + FMIRecent.FreeNotification(Self); + ShowRecentFiles; +end; + +procedure TMRUMenuManager.SetPMRecent(const AValue: TPopupMenu); +begin + if FPMRecent=AValue then exit; + if Assigned(FPMRecent) then + FPMRecent.RemoveFreeNotification(self); + FPMRecent := AValue; + if Assigned(FPMRecent) then + FPMRecent.FreeNotification(self); + ShowRecentFiles; +end; + +procedure TMRUMenuManager.SetRecent(const AValue: TStrings); +begin + if FRecent=AValue then exit; + FRecent.Assign(AValue); + ShowRecentFiles; +end; + +procedure TMRUMenuManager.loaded; +begin + inherited loaded; + if (FRecent.Count>0) and (assigned(FMIRecent) or assigned(FPMRecent))then + LoadRecentFilesFromIni(FIniFileName, FIniSection); +end; + +constructor TMRUMenuManager.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FRecent:=TStringList.Create; + FMaxItemLength := 80; + FMenuCaptionMask := DEFAULT_MASK; +end; + +destructor TMRUMenuManager.Destroy; +begin + SaveRecentFilesToIni(FIniFileName, FIniSection); + FreeAndNil(FRecent); + inherited Destroy; +end; + +procedure TMRUMenuManager.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited Notification(AComponent, Operation); + if (Operation = opRemove) then begin + if AComponent = FMIRecent then FMIRecent := nil; + if AComponent = FPMRecent then FPMRecent := nil; + end; + { original code - I think this is not correct: + inherited Notification(AComponent, Operation); + if (Operation=opRemove) and ((AComponent=FMIRecent) or (AComponent=FPMRecent)) then + exit; + } +end; + +procedure TMRUMenuManager.DoOnRecentClick(Sender: TObject); +Var + FN : String; +begin + With (Sender as TRecentMenuItem) do + FN:=FileName; + if (FN<>'') and (OnRecentFile<>Nil) then + OnRecentFile(Self,FN); +end; + +end. + diff --git a/components/fpspreadsheet/reference/BIFFExplorer/readme.txt b/components/fpspreadsheet/reference/BIFFExplorer/readme.txt new file mode 100644 index 000000000..adeae1dc5 --- /dev/null +++ b/components/fpspreadsheet/reference/BIFFExplorer/readme.txt @@ -0,0 +1,18 @@ +BIFF Explorer +-------------------------------------------------------------------------------- + +"BIFF Explorer" is a tool to peek into the internal structure of a binary +Excel file in biff format. + +It displays a list of the BIFF records contained in the xls file along with +name and explanation as described in various documentation files (see "About"). +Selecting one of the records loads its bytes into a simple hex viewer; for the +most important records I tried to decipher the contents of the hex values and +display their meaning in a grid and a memo (page "Analysis"). For the other +records select a byte in the hex viewer, and the program will display the +contents of that byte and the following ones as integer, double, string +(page "Values"). + +For compiling, note that the program requires the package "VirtualTreeview-new" +from ccr (which in turn requires the package "lclextensions" from +http://code.google.com/p/luipack/downloads/list).