fpspreadsheet: Refactor rich-text drawing for TWorksheetGrid (now blocks with same font, instead of char-by-char).

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4456 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-01-22 21:22:05 +00:00
parent 453823d8bf
commit 74d6314155
2 changed files with 978 additions and 270 deletions

View File

@ -1001,21 +1001,11 @@ begin
txt := GetCellText(ACol, gRow); txt := GetCellText(ACol, gRow);
if txt = '' then if txt = '' then
Continue; Continue;
w := RichTextWidth(Canvas, Workbook, Rect(0, 0, MaxInt, MaxInt), txt, w := RichTextWidth(Canvas, Workbook, Rect(0, 0, MaxInt, MaxInt),
Worksheet.ReadCellFontIndex(cell), cell^.RichTextParams, txt, cell^.RichTextParams, Worksheet.ReadCellFontIndex(cell),
Worksheet.ReadTextRotation(cell), false); Worksheet.ReadTextRotation(cell), false, IsRightToLeft);
if w > maxw then maxw := w; if w > maxw then maxw := w;
end; end;
{
for r := 0 to lastRow do
begin
gRow := GetGridRow(r);
txt := GetCellText(ACol, gRow);
PrepareCanvas(ACol, gRow, []);
w := Canvas.TextWidth(txt);
if (txt <> '') and (w > maxw) then maxw := w;
end;
}
if maxw > -1 then if maxw > -1 then
maxw := maxw + 2*constCellPadding maxw := maxw + 2*constCellPadding
else else
@ -2966,8 +2956,8 @@ begin
cellR := Rect(0, 0, MaxInt, MaxInt); cellR := Rect(0, 0, MaxInt, MaxInt);
end; end;
Result := RichTextHeight(Canvas, Workbook, cellR, s, fntIndex, Result := RichTextHeight(Canvas, Workbook, cellR, s, lCell^.RichTextParams,
lCell^.RichTextParams, txtRot, wrapped) fntIndex, txtRot, wrapped, IsRightToLeft)
+ 2 * constCellPadding; + 2 * constCellPadding;
(* (*
@ -3499,8 +3489,10 @@ begin
Canvas.Brush.Style := bsClear; Canvas.Brush.Style := bsClear;
// Work horse for text drawing, both standard text and rich-text // Work horse for text drawing, both standard text and rich-text
DrawRichText(Canvas, Workbook, ARect, AText, AFontIndex, ARichTextParams, DrawRichText(Canvas, Workbook, ARect, AText, ARichTextParams, AFontIndex,
ATextWrap, ACellHorAlign, ACellVertAlign, ATextRot, AOverrideTextColor); ATextWrap, ACellHorAlign, ACellVertAlign, ATextRot, AOverrideTextColor,
IsRightToLeft
);
end; end;
(* (*
procedure TsCustomWorksheetGrid.InternalDrawTextInCell(AText, AMeasureText: String; procedure TsCustomWorksheetGrid.InternalDrawTextInCell(AText, AMeasureText: String;

File diff suppressed because it is too large Load Diff