fpspreadsheet: Re-do rich-text format (easier, less code). Fix rich-text issues with utf8 characters.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4257 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2015-08-08 16:23:49 +00:00
parent 3e2a6b4bc6
commit 62355e2d51
14 changed files with 553 additions and 609 deletions

View File

@@ -12,6 +12,11 @@ type
TBIFFDetailsEvent = procedure(Sender: TObject; ADetails: TStrings) of object;
TRichTextFormattingRun = packed record
FirstIndex, fontIndex: Word;
end;
TRichTextFormattingRuns = array of TRichTextFormattingRun;
TBIFFGrid = class(TStringGrid)
private
FRecType: Word;
@@ -133,7 +138,7 @@ type
ACharCount: Integer; out AString: String; out ANumbytes: Integer); overload;
procedure ExtractString(ABufIndex: Integer; ALenBytes: Byte; AUnicode: Boolean;
out AString: String; out ANumBytes: Integer;
out ARichTextRuns: TsRichTextFormattingRuns;
out ARichTextRuns: TRichTextFormattingRuns;
out ABufIndexOfFirstRichTextRun: LongWord;
IgnoreCompressedFlag: Boolean = false); overload;
procedure ExtractString(ABufIndex: Integer; ALenbytes: Byte; AUnicode: Boolean;
@@ -274,7 +279,7 @@ procedure TBIFFGrid.ExtractString(ABufIndex: Integer; ALenBytes: Byte; AUnicode:
out AString: String; out ANumBytes: Integer;
IgnoreCompressedFlag: Boolean = false);
var
rtfRuns: TsRichTextFormattingRuns;
rtfRuns: TRichTextFormattingRuns;
rtfIndex: LongWord;
begin
ExtractString(ABufIndex, ALenbytes, AUnicode, AString, ANumBytes,
@@ -283,7 +288,7 @@ end;
procedure TBIFFGrid.ExtractString(ABufIndex: Integer; ALenBytes: Byte; AUnicode: Boolean;
out AString: String; out ANumBytes: Integer;
out ARichTextRuns: TsRichTextFormattingRuns;
out ARichTextRuns: TRichTextFormattingRuns;
out ABufIndexOfFirstRichTextRun: LongWord;
IgnoreCompressedFlag: Boolean = false);
var
@@ -1286,7 +1291,7 @@ var
run: Integer;
total2: Integer;
optn: Byte;
rtfRuns: TsRichTextFormattingRuns;
rtfRuns: TRichTextFormattingRuns;
rtfBufferIndex: LongWord;
begin
case FInfo of
@@ -1896,7 +1901,7 @@ var
ansiStr: AnsiString;
s: String;
i, n: Integer;
rtfRuns: TsRichTextFormattingRuns;
rtfRuns: TRichTextFormattingRuns;
begin
BeginUpdate;
RowCount := FixedRows + 1000;
@@ -5322,7 +5327,7 @@ var
s: String;
total1, total2: DWord;
i, j, n: Integer;
rtfRuns: TsRichTextFormattingRuns;
rtfRuns: TRichTextFormattingRuns;
rtfIndex: LongWord;
w: Word;
begin

View File

@@ -175,22 +175,22 @@ object MainForm: TMainForm
OnSelection = HexGridSelection
ColWidths = (
28
21
21
21
21
21
21
21
21
21
21
21
21
21
21
21
26
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
24
)
Cells = (
16
@@ -261,22 +261,22 @@ object MainForm: TMainForm
OnClick = GridClick
OnSelection = AlphaGridSelection
ColWidths = (
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
18
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
)
Cells = (
16
@@ -415,7 +415,6 @@ object MainForm: TMainForm
Width = 419
Align = alClient
ButtonStyle = bsTriangle
Colors.UnfocusedColor = clMedGray
DefaultText = 'Node'
Header.AutoSizeIndex = 4
Header.Columns = <