fpspreadsheet: Add description of PAGESETUP record to BIFFExplorer

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3232 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2014-06-24 15:12:31 +00:00
parent e79bc4bb09
commit 3e8926080b
2 changed files with 223 additions and 1 deletions

View File

@ -68,6 +68,7 @@ type
procedure ShowNote;
procedure ShowNumberCell;
procedure ShowObj;
procedure ShowPageSetup;
procedure ShowPalette;
procedure ShowPane;
procedure ShowPassword;
@ -335,6 +336,8 @@ begin
ShowHideObj;
$0092:
ShowPalette;
$00A1:
ShowPageSetup;
$00C1:
ShowMMS;
$009C:
@ -2549,6 +2552,133 @@ begin
end;
procedure TBIFFGrid.ShowPageSetup;
var
numBytes: Integer;
w: Word;
s: String;
dbl: Double;
begin
if FFormat in [sfExcel5, sfExcel8] then RowCount := FixedRows + 11
else RowCount := FixedRows + 6;
numbytes := 2;
Move(FBuffer[FBufferIndex], w, numBytes);
w := WordLEToN(w);
if Row = FCurrRow then begin
FDetails.Add('Paper size:'#13);
FDetails.Add(Format('%d - %s', [w, PaperSizeName(w)]));
end;
ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), 'Paper size');
Move(FBuffer[FBufferIndex], w, numBytes);
w := WordLEToN(w);
ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), 'Scaling factor in percent');
Move(FBuffer[FBufferIndex], w, numbytes);
w := WordLETON(w);
ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), 'Start page number');
Move(FBuffer[FBufferIndex], w, numbytes);
w := WordLETON(w);
ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w),
'Fit worksheet width to this number of pages (0 = use as many as needed)');
Move(FBuffer[FBufferIndex], w, numbytes);
w := WordLETON(w);
ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w),
'Fit worksheet height to this number of pages (0 = use as many as needed)');
if FFormat = sfExcel4 then begin
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: Print pages in columns')
else FDetails.Add('Bit $0001 = 1: Print pages in rows');
if w and $0002 = 0
then FDetails.add('Bit $0002 = 0: Landscape')
else FDetails.Add('Bit $0002 = 1: Portrait');
if w and $0004 = 0
then FDetails.Add('Bit $0004 = 0: Paper size, scaling factor, and paper orientation ' +
'(portrait/landscape) ARE initialised')
else FDetails.Add('Bit $0004 = 1: Paper size, scaling factor, and paper orientation ' +
'(portrait/landscape) are NOT initialised');
if w and $0008 = 0
then FDetails.Add('Bit $0008 = 0: Print colored')
else FDetails.add('Bit $0008 = 1: Print black and white');
end;
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.4x (%d)', [w, w]),
'Option flags');
end else
if (FFormat in [sfExcel5, sfExcel8]) then begin
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: Print pages in columns')
else FDetails.Add('Bit $0001 = 1: Print pages in rows');
if w and $0002 = 0
then FDetails.add('Bit $0002 = 0: Landscape')
else FDetails.Add('Bit $0002 = 1: Portrait');
if w and $0004 = 0
then FDetails.Add('Bit $0004 = 0: Paper size, scaling factor, and paper orientation ' +
'(portrait/landscape) ARE initialised')
else FDetails.Add('Bit $0004 = 1: Paper size, scaling factor, and paper orientation ' +
'(portrait/landscape) are NOT initialised');
if w and $0008 = 0
then FDetails.Add('Bit $0008 = 0: Print colored')
else FDetails.add('Bit $0008 = 1: Print black and white');
if w and $0010 = 0
then FDetails.Add('Bit $0010 = 0: Default print quality')
else FDetails.Add('Bit $0010 = 1: Draft quality');
if w and $0020 = 0
then FDetails.Add('Bit $0020 = 0: Do NOT print cell notes')
else FDetails.Add('Bit $0020 = 0: Print cell notes');
if w and $0040 = 0
then FDetails.Add('Bit $0040 = 0: Use paper orientation (portrait/landscape) flag abov')
else FDetails.Add('Bit $0040 = 1: Use default paper orientation (landscape for chart sheets, portrait otherwise)');
if w and $0080 = 0
then FDetails.Add('Bit $0080 = 0: Automatic page numbers')
else FDetails.Add('Bit $0080 = 1: Use start page number above');
if w and $0200 = 0
then FDetails.Add('Bit $0200 = 0: Print notes as displayed')
else FDetails.Add('Bit $0200 = 1: Print notes at end of sheet');
case (w and $0C00) shr 10 of
0: FDetails.Add('Bit $0C00 = 0: Print errors as displayed');
1: FDetails.add('Bit $0C00 = 1: Do not print errors');
2: FDetails.Add('Bit $0C00 = 2: Print errors as "--"');
3: FDetails.Add('Bit $0C00 = 4: Print errors as "#N/A"');
end;
end;
ShowInRow(FCurrRow, FBufferIndex, numBytes, Format('$%.4x (%d)', [w, w]),
'Option flags');
Move(FBuffer[FBufferIndex], w, numBytes);
w := WordLEToN(w);
ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), 'Print resolution in dpi');
Move(FBuffer[FBufferIndex], w, numBytes);
w := WordLEToN(w);
ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), 'Vertical print resolution in dpi');
numBytes := 8;
Move(FBuffer[FBufferIndex], dbl, numBytes);
ShowInRow(FCurrRow, FBufferIndex, numBytes, FloatToStr(dbl), 'Header margin');
Move(FBuffer[FBufferIndex], dbl, numBytes);
ShowInRow(FCurrRow, FBufferIndex, numBytes, FloatToStr(dbl), 'Footer margin');
numBytes := 2;
Move(FBuffer[FBufferIndex], w, numBytes);
w := WordLEToN(w);
ShowInRow(FCurrRow, FBufferIndex, numBytes, IntToStr(w), 'Number of copies to print');
end;
end;
procedure TBIFFGrid.ShowPalette;
var
numBytes: Integer;

View File

@ -9,6 +9,7 @@ uses
function BOFName(ACode: Word): String;
function CodePageName(AID: Word): String;
function PaperSizeName(ACode: Word): String;
function RecTypeName(ARecType: Word): String;
function SheetFuncName(AIndex: Word): String;
function ErrorCodeName(ACode: Byte): String;
@ -87,6 +88,97 @@ begin
end;
end;
function PaperSizeName(ACode: Word): String;
begin
case ACode of
0: Result := 'Undefined';
1: Result := 'Letter (8.5" x 11")';
2: Result := 'Letter small (8.5" x 11")';
3: Result := 'Tabloid (11" x 17")';
4: Result := 'Ledger (17" x 11")';
5: Result := 'Legal (8.5" x 14")';
6: Result := 'Statement (5.5" x 8.5")';
7: Result := 'Executive (7.25" x 10.5")';
8: Result := 'A3 (297mm x 420mm)';
9: Result := 'A4 (210mm x 297mm)';
10: Result := 'A4 small (210mm x 297mm)';
11: Result := 'A5 (148mm x 210mm)';
12: Result := 'B4 (JIS) (257mm x 364mm)';
13: Result := 'B5 (JIS) (182mm x 257mm)';
14: Result := 'Folio (8.5" x 13")';
15: Result := 'Quarto (215mm x 275mm)';
16: Result := '10x14 (10" x 14")';
17: Result := '11x17 (11" x 17")';
18: Result := 'Note (8.5" x 11")';
19: Result := 'Envelope #9 (3 7/8" x 8 7/8")';
20: Result := 'Envelope #10 (4 1/8" x 9 1/2")';
21: Result := 'Envelope #11 (4 1/2" x 10 3/8")';
22: Result := 'Envelope #12 (4 3/4" x 11")';
23: Result := 'Envelope #14 (5" x 11.5")';
24: Result := 'C (17" x 22")';
25: Result := 'D (22" x 34")';
26: Result := 'E (34" x 44")';
27: Result := 'Envelope DL (110mm x 220mm)';
28: Result := 'Envelope C5 (162mm x 229mm)';
29: Result := 'Envelope C3 (324mm x 458mm)';
30: Result := 'Envelope C4 (229mm x 324mm)';
31: Result := 'Envelope C6 (114mm x 162mm)';
32: Result := 'Envelope C6/C5 (114mm x 229mm)';
33: Result := 'B4 (ISO) (250mm x 353mm)';
34: Result := 'B5 (ISO) (176mm x 250mm)';
35: Result := 'B6 (ISO) (125mm x 176mm)';
36: Result := 'Envelope Italy (110mm x 230mm)';
37: Result := 'Envelope Monarch (3 7/8" x 7 1/2")';
38: Result := '6 3/4 Envelope (3 5/8" x 6 1/2")';
39: Result := 'US Standard Fanfold (14 7/8" x 11")';
40: Result := 'German Std. Fanfold (8.5" x 12")';
41: Result := 'German Legal Fanfold (8.5" x 13")';
42: Result := 'B4 (ISO) (250mm x 353mm)';
43: Result := 'Japanese Postcard (100mm x 148mm)';
44: Result := '9x11 (9" x 11")';
45: Result := '10x11 (10" x 11")';
46: Result := '15x11 (15" x 11")';
47: Result := 'Envelope Invite (220mm x 220mm)';
48: Result := 'Undefined';
49: Result := 'Undefined';
50: Result := 'Letter Extra (9.5" x 12")';
51: Result := 'Legal Extra (9.5" x 15")';
52: Result := 'Tabloid Extra (11 11/16" x 18")';
53: Result := 'A4 Extra (235mm x 322mm)';
54: Result := 'Letter Transverse (8.5" x 11")';
55: Result := 'A4 Transverse (210mm x 297mm)';
56: Result := 'Letter Extra Transv. (9.5" x 12")';
57: Result := 'Super A/A4 (227mm x 356mm)';
58: Result := 'Super B/A3 (305mm x 487mm)';
59: Result := 'Letter Plus (8.5" x 12 11/16")';
60: Result := 'A4 Plus (210mm x 330mm)';
61: Result := 'A5 Transverse (148mm x 210mm)';
62: Result := 'B5 (JIS) Transverse (182mm x 257mm)';
63: Result := 'A3 Extra (322mm x 445mm)';
64: Result := 'A5 Extra (174mm x 235mm)';
65: Result := 'B5 (ISO) Extra (201mm x 276mm)';
66: Result := 'A2 (420mm s 594mm)';
67: Result := 'A3 Transverse (297mm x 420mm)';
68: Result := 'A3 Extra Transverse (322mm x 445mm)';
69: Result := 'Dbl. Japanese Postcard (200mm x 148mm)';
70: Result := 'A6 (105mm x 148mm)';
75: Result := 'Letter Rotated (11" x 8.5")';
76: Result := 'A3 Rotated (420mm x 297mm)';
77: Result := 'A4 Rotated (297mm x 210mm)';
78: Result := 'A5 Rotated (210mm x 148mm)';
79: Result := 'B4 (JIS) Rotated (364mm x 257mm)';
80: Result := 'B5 (JIS) Rotated (257mm x 182mm)';
81: Result := 'Japanese Postcard Rot. (148mm x 100mm)';
82: Result := 'Dbl. Jap. Postcard Rot. (148mm x 200mm)';
83: Result := 'A6 Rotated (148mm x 105mm)';
88: Result := 'B6 (JIS) (128mm x 182mm)';
89: Result := 'B6 (JIS) Rotated (182mm x 128mm)';
90: Result := '2x11 (12" x 11")';
else Result := '(unknown)';
end;
end;
function RecTypeName(ARecType: Word): String;
begin
case ARecType of
@ -192,7 +284,7 @@ begin
$009D: Result := 'AUTOFILTERINFO: Drop-down arrow count';
$009E: Result := 'AUTOFILTER: AutoFilter data';
$00A0: Result := 'SCL: Window zoom magnification';
$00A1: Result := 'SETUP: PageSetup';
$00A1: Result := 'PAGESETUP: PageSetup';
$00A9: Result := 'COORDLIST: Polygon object vertex coordinates';
$00AB: Result := 'GCW: Global column width flags';
$00AE: Result := 'SCENMAN: Scenario output data';