You've already forked lazarus-ccr
fpspreadsheet / BiffExplorer: Add info on records COLINFO, COLWIDTH, NOTE, OBJ; some cosmetics in MainForm.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2940 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -31,6 +31,8 @@ type
|
||||
procedure ShowCalcMode;
|
||||
procedure ShowClrtClient;
|
||||
procedure ShowCodePage;
|
||||
procedure ShowColInfo;
|
||||
procedure ShowColWidth;
|
||||
procedure ShowCountry;
|
||||
procedure ShowDateMode;
|
||||
procedure ShowDefColWidth;
|
||||
@ -56,7 +58,9 @@ type
|
||||
procedure ShowLabelSSTCell;
|
||||
procedure ShowLeftMargin;
|
||||
procedure ShowMMS;
|
||||
procedure ShowNote;
|
||||
procedure ShowNumberCell;
|
||||
procedure ShowObj;
|
||||
procedure ShowPalette;
|
||||
procedure ShowPassword;
|
||||
procedure ShowPrecision;
|
||||
@ -255,12 +259,16 @@ begin
|
||||
ShowFooter;
|
||||
$0019:
|
||||
ShowWindowProtect;
|
||||
$001C:
|
||||
ShowNote;
|
||||
$001D:
|
||||
ShowSelection;
|
||||
$001E, $041E:
|
||||
ShowFormat;
|
||||
$0022:
|
||||
ShowDateMode;
|
||||
$0024:
|
||||
ShowColWidth;
|
||||
$0025, $0225:
|
||||
ShowDefRowHeight;
|
||||
$0026:
|
||||
@ -293,8 +301,12 @@ begin
|
||||
ShowFileSharing;
|
||||
$005C:
|
||||
ShowWriteAccess;
|
||||
$005D:
|
||||
ShowObj;
|
||||
$005F:
|
||||
ShowRecalc;
|
||||
$007D:
|
||||
ShowColInfo;
|
||||
$0085:
|
||||
ShowSheet;
|
||||
$0086:
|
||||
@ -580,7 +592,7 @@ begin
|
||||
w := WordLEToN(w);
|
||||
s := CodePageName(w);
|
||||
if Row = FCurrRow then begin
|
||||
FDetails.Add('Code page:');
|
||||
FDetails.Add('Code page:'#13);
|
||||
FDetails.Add(Format('$%.04x = %s', [w, s]));
|
||||
end;
|
||||
if s <> '' then s := 'Code page identifier (' + s + ')' else s := 'Code page identifier';
|
||||
@ -588,6 +600,80 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TBIFFGrid.ShowColInfo;
|
||||
var
|
||||
numBytes: Integer;
|
||||
w: Word;
|
||||
begin
|
||||
if FFormat = sfExcel2 then
|
||||
exit;
|
||||
|
||||
RowCount := FixedRows + 5;
|
||||
|
||||
numBytes := 2;
|
||||
Move(FBuffer[FBufferIndex], w, numbytes);
|
||||
ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)),
|
||||
'Index of first column in range');
|
||||
|
||||
numBytes := 2;
|
||||
Move(FBuffer[FBufferIndex], w, numbytes);
|
||||
ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)),
|
||||
'Index of last column in range');
|
||||
|
||||
numBytes := 2;
|
||||
Move(FBuffer[FBufferIndex], w, numbytes);
|
||||
ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)),
|
||||
'Width of the columns in 1/256 of the width of the zero character, using default font (first FONT record in the file)');
|
||||
|
||||
numBytes := 2;
|
||||
Move(FBuffer[FBufferIndex], w, numbytes);
|
||||
ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(WordLEToN(w)),
|
||||
'Index to XF record for default column formattingg');
|
||||
|
||||
numBytes := 2;
|
||||
Move(FBuffer[FBufferIndex], w, numbytes);
|
||||
w := WordLEToN(w);
|
||||
if Row = FCurrRow then begin
|
||||
FDetails.Add('Column options:'#13);
|
||||
if w and $0001 = 0
|
||||
then FDetails.Add('Bit $0001 = 0: Columns are NOT hidden')
|
||||
else FDetails.Add('Bit $0001 = 1: Columns are hidden');
|
||||
FDetails.Add(Format('Bits $0700 = %d: Outline level of the columns (0 = no outline)', [(w and $0700) shr 8]));
|
||||
if w and $1000 = 0
|
||||
then FDetails.Add('Bit $1000 = 0: Columns are NOT collapsed')
|
||||
else FDetails.Add('Bit $1000 = 1: Columns are collapsed');
|
||||
end;
|
||||
ShowInRow(FCurrRow, FBufferIndex, numbytes, IntToStr(w), 'Option flags');
|
||||
end;
|
||||
|
||||
|
||||
procedure TBIFFGrid.ShowColWidth;
|
||||
var
|
||||
numBytes: Integer;
|
||||
w: Word;
|
||||
begin
|
||||
if FFormat <> sfExcel2 then
|
||||
exit;
|
||||
|
||||
RowCount := FixedRows + 3;
|
||||
|
||||
numBytes := 2;
|
||||
Move(FBuffer[FBufferIndex], w, numbytes);
|
||||
ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)),
|
||||
'Index of first column');
|
||||
|
||||
numBytes := 2;
|
||||
Move(FBuffer[FBufferIndex], w, numbytes);
|
||||
ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)),
|
||||
'Index of last column');
|
||||
|
||||
numBytes := 2;
|
||||
Move(FBuffer[FBufferIndex], w, numbytes);
|
||||
ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(WordLEToN(w)),
|
||||
'Width of the columns in 1/256 of the width of the zero character, using default font (first FONT record in the file)');
|
||||
end;
|
||||
|
||||
|
||||
procedure TBIFFGrid.ShowCountry;
|
||||
var
|
||||
numBytes: Integer;
|
||||
@ -1754,6 +1840,60 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TBIFFGrid.ShowNote;
|
||||
var
|
||||
numBytes: Integer;
|
||||
w: Word = 0;
|
||||
s: String;
|
||||
begin
|
||||
RowCount := IfThen(FFormat = sfExcel8, 6, 4);
|
||||
|
||||
// Offset 0: Row and Col index
|
||||
ShowRowColData(FBufferIndex);
|
||||
|
||||
if FFormat = sfExcel8 then begin
|
||||
numBytes := 2;
|
||||
Move(FBuffer[FBufferIndex], w, numBytes);
|
||||
w := WordLEToN(w);
|
||||
if Row = FCurrRow then begin
|
||||
FDetails.Add('Comment flags:'#13);
|
||||
if (w and $0002 <> 0)
|
||||
then FDetails.Add('Bit 1=1: Comment is shown at all times')
|
||||
else FDetails.Add('Bit 1=0: Comment is not shown at all tiems');
|
||||
if (w and $0080 <> 0)
|
||||
then FDetails.Add('Bit 7=1: Row with comment is hidden')
|
||||
else FDetails.Add('Bit 7=0: Row with comment is visible');
|
||||
if (w and $0100 <> 0)
|
||||
then FDetails.Add('Bit 8=1: Column with comment is hidden')
|
||||
else FDetails.Add('Bit 8=0: Column with comment is visible');
|
||||
FDetails.Add('All other bits are reserved and must be ignored.');
|
||||
end;
|
||||
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('%d ($%.4x)', [w, w]),
|
||||
'Flags');
|
||||
|
||||
Move(FBuffer[FBufferIndex], w, numBytes);
|
||||
w := WordLEToN(w);
|
||||
ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), 'Object ID');
|
||||
|
||||
ExtractString(FBufferIndex, IfThen(FFormat=sfExcel8, 2, 1), FFormat=sfExcel8,
|
||||
s, numbytes);
|
||||
ShowInRow(FCurrRow, FBufferIndex, numBytes, s, 'Author');
|
||||
end else begin
|
||||
numBytes := 2;
|
||||
Move(FBuffer[FBufferIndex], w, numBytes);
|
||||
w := WordLEToN(w);
|
||||
ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w),
|
||||
'Total length of comment');
|
||||
|
||||
numBytes := Min(Length(FBuffer) - FBufferIndex, 2048);
|
||||
SetLength(s, numBytes);
|
||||
Move(FBuffer[FBufferIndex], s[1], numBytes);
|
||||
SetLength(s, Length(s));
|
||||
ShowInRow(FCurrRow, FBufferIndex, numBytes, s, 'Comment text');
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TBIFFGrid.ShowNumberCell;
|
||||
var
|
||||
numBytes: Integer;
|
||||
@ -1795,6 +1935,104 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TBIFFGrid.ShowObj;
|
||||
var
|
||||
numBytes: Integer;
|
||||
w: Word;
|
||||
begin
|
||||
RowCount := FixedRows + 5;
|
||||
|
||||
numBytes := 2;
|
||||
Move(FBuffer[FBufferIndex], w, numBytes);
|
||||
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.04x', [WordLEToN(w)]),
|
||||
'ft (must be $15)');
|
||||
|
||||
numBytes := 2;
|
||||
Move(FBuffer[FBufferIndex], w, numBytes);
|
||||
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.04x', [WordLEToN(w)]),
|
||||
'cb (must be $12)');
|
||||
|
||||
numBytes := 2;
|
||||
w := WordLEToN(w);
|
||||
Move(FBuffer[FBufferIndex], w, numBytes);
|
||||
if Row = FCurrRow then begin
|
||||
FDetails.Add('Object type:'#13);
|
||||
case w of
|
||||
$00: FDetails.Add('$00 = Group');
|
||||
$01: FDetails.Add('$01 = Line');
|
||||
$02: FDetails.Add('$02 = Rectangle');
|
||||
$03: FDetails.Add('$03 = Oval');
|
||||
$04: FDetails.Add('$04 = Arc');
|
||||
$05: FDetails.Add('$05 = Chart');
|
||||
$06: FDetails.Add('$06 = Text');
|
||||
$07: FDetails.Add('$07 = Button');
|
||||
$08: FDetails.Add('$08 = Picture');
|
||||
$09: FDetails.Add('$09 = Polygon');
|
||||
$0B: FDetails.Add('$0B = Checkbox');
|
||||
$0C: FDetails.Add('$0C = Radio button');
|
||||
$0D: FDetails.Add('$0D = Edit box');
|
||||
$0E: FDetails.Add('$0E = Label');
|
||||
$0F: FDetails.Add('$0F = Dialog box');
|
||||
$10: FDetails.Add('$10 = Spin control');
|
||||
$11: FDetails.Add('$11 = Scrollbar');
|
||||
$12: FDetails.Add('$12 = List');
|
||||
$13: FDetails.Add('$13 = Group box');
|
||||
$14: FDetails.ADd('$14 = Dropdown list');
|
||||
$19: FDetails.Add('$19 = Note');
|
||||
$1E: FDetails.Add('$1E = OfficeArt object');
|
||||
else FDetails.Add(IntToStr(w) + ' = (unknown object)');
|
||||
end;
|
||||
end;
|
||||
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.04x', [w]),
|
||||
'Object type (ot)');
|
||||
|
||||
numBytes := 2;
|
||||
Move(FBuffer[FBufferIndex], w, numBytes);
|
||||
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.04x', [WordLEToN(w)]),
|
||||
'Object ID');
|
||||
|
||||
numBytes := 2;
|
||||
Move(FBuffer[FBufferIndex], w, numBytes);
|
||||
w := WordLEToN(w);
|
||||
if Row = FCurrRow then begin
|
||||
FDetails.Add('Object flags:'#13);
|
||||
if w and $0001 <> 0
|
||||
then FDetails.Add('Bit $0001 = 1: Object is locked')
|
||||
else FDetails.Add('Bit $0001 = 0: Object is NOT locked');
|
||||
if w and $0002 <> 0
|
||||
then FDetails.Add('Bit $0002 = 1: Reserved - must be zero!!!d')
|
||||
else FDetails.Add('Bit $0002 = 0: Reserved - must be zero');
|
||||
if w and $0004 <> 0
|
||||
then FDetails.Add('Bit $0004 = 1: Application is expected to choose object size')
|
||||
else FDetails.Add('Bit $0004 = 0: Application is NOT expected to choose object size');
|
||||
if w and $0008 <> 0
|
||||
then FDetails.Add('Bit $0008 = 1: Is a chart that is expected to be published when sheet is published')
|
||||
else FDetails.Add('Bit $0008 = 0: Is NOT a chart that is expected to be published when sheet is published');
|
||||
if w and $0010 <> 0
|
||||
then FDetails.Add('Bit $0010 = 1: Image of this object is intended to be included when printing')
|
||||
else FDetails.Add('Bit $0010 = 0: Image of this object is NOT intended to be included when printing');
|
||||
FDetails.Add('Bit $0020 : unused');
|
||||
FDetails.Add('Bit $0040 : unused');
|
||||
if w and $0080 <> 0
|
||||
then FDetails.Add('Bit $0080 = 1: Object is disabled')
|
||||
else FDetails.ADd('Bit $0080 = 0: Object is NOT disabled');
|
||||
if w and $0100 <> 0
|
||||
then FDetails.Add('Bit $0100 = 1: is an auxiliary object that can only be automatically inserted by the application')
|
||||
else FDetails.Add('Bit $0100 = 0: is NOT an auxiliary object that can only be automatically inserted by the application');
|
||||
if w and $0200 <> 0
|
||||
then FDetails.Add('Bit $0200 = 1: is expected to be updated on load to reflect the values in the range associated with the object')
|
||||
else FDetails.Add('Bit $0200 = 0: is NOT expected to be updated on load to reflect the values in the range associated with the object');
|
||||
FDetails.Add('Bit $0400 : unused');
|
||||
FDetails.Add('Bit $0800 : unused');
|
||||
if w and $1000 <> 0
|
||||
then FDetails.Add('Bit $1000 = 1: is expected to be updated whenever the value of a cell in the range associated with the object changes')
|
||||
else FDetails.Add('Bit $1000 = 0: is NOT expected to be updated whenever the value of a cell in the range associated with the object changes');
|
||||
end;
|
||||
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.04x', [w]),
|
||||
'Flags');
|
||||
end;
|
||||
|
||||
|
||||
procedure TBIFFGrid.ShowPalette;
|
||||
var
|
||||
numBytes: Integer;
|
||||
|
@ -158,6 +158,7 @@ begin
|
||||
$005A: Result := 'CRN: Non-resident operands';
|
||||
$005B: Result := 'FILESHARING: File-sharing information';
|
||||
$005C: Result := 'WRITEACCESS: Write access user name';
|
||||
$005D: Result := 'OBJ';
|
||||
$005E: Result := 'UNCALCED: Recalculation status';
|
||||
$005F: Result := 'SAVERECALC: Recalculate before saving';
|
||||
$0060: Result := 'TEMPLATE: Workbook is a template';
|
||||
|
@ -275,11 +275,11 @@ object MainForm: TMainForm
|
||||
OnChange = PageControlChange
|
||||
object PgAnalysis: TTabSheet
|
||||
Caption = 'Analysis'
|
||||
ClientHeight = 230
|
||||
ClientHeight = 225
|
||||
ClientWidth = 657
|
||||
object AnalysisDetails: TMemo
|
||||
Left = 428
|
||||
Height = 230
|
||||
Height = 225
|
||||
Top = 0
|
||||
Width = 229
|
||||
Align = alRight
|
||||
@ -295,7 +295,7 @@ object MainForm: TMainForm
|
||||
end
|
||||
object DetailsSplitter: TSplitter
|
||||
Left = 423
|
||||
Height = 230
|
||||
Height = 225
|
||||
Top = 0
|
||||
Width = 5
|
||||
Align = alRight
|
||||
@ -319,6 +319,7 @@ object MainForm: TMainForm
|
||||
RowCount = 9
|
||||
TabOrder = 0
|
||||
TitleStyle = tsNative
|
||||
OnPrepareCanvas = ValueGridPrepareCanvas
|
||||
ColWidths = (
|
||||
112
|
||||
142
|
||||
@ -452,10 +453,10 @@ object MainForm: TMainForm
|
||||
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
|
||||
}
|
||||
end
|
||||
object SpeedButton3: TSpeedButton
|
||||
object BtnCloseFind: TSpeedButton
|
||||
Left = 3
|
||||
Height = 22
|
||||
Hint = 'Close "find" panel'
|
||||
Hint = 'Close "Find" panel'
|
||||
Top = 6
|
||||
Width = 23
|
||||
Action = AcFindClose
|
||||
@ -547,6 +548,7 @@ object MainForm: TMainForm
|
||||
Width = 125
|
||||
end>
|
||||
Header.DefaultHeight = 24
|
||||
Header.Font.Style = [fsBold]
|
||||
Header.Height = 24
|
||||
Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoShowSortGlyphs, hoVisible]
|
||||
HintMode = hmTooltip
|
||||
|
@ -68,7 +68,7 @@ type
|
||||
BtnFindNext: TSpeedButton;
|
||||
BtnFindPrev: TSpeedButton;
|
||||
RecentFilesPopupMenu: TPopupMenu;
|
||||
SpeedButton3: TSpeedButton;
|
||||
BtnCloseFind: TSpeedButton;
|
||||
Splitter1: TSplitter;
|
||||
HexSplitter: TSplitter;
|
||||
AlphaGrid: TStringGrid;
|
||||
@ -121,6 +121,8 @@ type
|
||||
procedure ListViewSelectItem(Sender: TObject; Item: TListItem;
|
||||
Selected: Boolean);
|
||||
procedure PageControlChange(Sender: TObject);
|
||||
procedure ValueGridPrepareCanvas(sender: TObject; aCol, aRow: Integer;
|
||||
aState: TGridDrawState);
|
||||
|
||||
private
|
||||
MemStream: TMemoryStream;
|
||||
@ -134,6 +136,8 @@ type
|
||||
FMRUMenuManager : TMRUMenuManager;
|
||||
procedure AddToHistory(const AText: String);
|
||||
procedure AnalysisGridDetails(Sender: TObject; ADetails: TStrings);
|
||||
procedure AnalysisGridPrepareCanvas(sender: TObject; aCol, aRow: Integer;
|
||||
aState: TGridDrawState);
|
||||
procedure ExecFind(ANext, AKeep: Boolean);
|
||||
function GetNodeData(ANode: PVirtualNode): TBiffNodeData;
|
||||
function GetRecType: Word;
|
||||
@ -338,6 +342,13 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.AnalysisGridPrepareCanvas(sender: TObject; aCol,
|
||||
aRow: Integer; aState: TGridDrawState);
|
||||
begin
|
||||
if ARow = 0 then FAnalysisGrid.Canvas.Font.Style := [fsBold];
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.BeforeRun;
|
||||
begin
|
||||
ReadFromIni;
|
||||
@ -593,6 +604,7 @@ begin
|
||||
Options := Options + [goDrawFocusSelected];
|
||||
TitleStyle := tsNative;
|
||||
OnDetails := @AnalysisGridDetails;
|
||||
OnPrepareCanvas := @AnalysisGridPrepareCanvas;
|
||||
end;
|
||||
|
||||
with ValueGrid do begin
|
||||
@ -1107,6 +1119,13 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.ValueGridPrepareCanvas(sender: TObject; aCol,
|
||||
aRow: Integer; aState: TGridDrawState);
|
||||
begin
|
||||
if ARow = 0 then ValueGrid.Canvas.Font.Style := [fsBold];
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.WriteToIni;
|
||||
var
|
||||
ini: TCustomIniFile;
|
||||
|
Reference in New Issue
Block a user