From f4cb9c14a73dfe536dcf740c1434c2f621ee4180 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Fri, 14 Aug 2015 12:44:22 +0000 Subject: [PATCH] fpspreadsheet: Use HTML conversion to enter rich-text in the visual TsCellEdit control git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4271 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/fpspreadsheet/fpshtmlutils.pas | 75 ++++++++++--------- components/fpspreadsheet/fpspreadsheet.pas | 5 +- .../fpspreadsheet/fpspreadsheetctrls.pas | 13 +++- 3 files changed, 57 insertions(+), 36 deletions(-) diff --git a/components/fpspreadsheet/fpshtmlutils.pas b/components/fpspreadsheet/fpshtmlutils.pas index 48de0e342..12a20f1b6 100644 --- a/components/fpspreadsheet/fpshtmlutils.pas +++ b/components/fpspreadsheet/fpshtmlutils.pas @@ -988,47 +988,54 @@ begin // NOTE: This is a simple version: every opened tag is closed afterwards! // In a more advanced version, shared properties should be kept. This is // what FChangedParams was introduced for! - if [cfFontName, cfFontSize, cfFontColor] * FChangedparams[i] <> [] then + if not SameFont(FBaseFont, FFonts[i]) then begin - Result := Result + ''; - if (cfItalic in FChangedParams[i]) then - Result := Result + ''; - if (cfUnderline in FChangedParams[i]) then - Result := Result + ''; - if (cfStrikeout in FChangedParams[i]) then - Result := Result + ''; - if (cfFontPosition in FChangedParams[i]) then - begin - if FFonts[i].Position = fpSuperscript then Result := Result + ''; - if FFonts[i].Position = fpSubscript then Result := Result + ''; + if [cfFontName, cfFontSize, cfFontColor] * FChangedparams[i] <> [] then + begin + Result := Result + ''; + end; + if (cfBold in FChangedParams[i]) then + Result := Result + ''; + if (cfItalic in FChangedParams[i]) then + Result := Result + ''; + if (cfUnderline in FChangedParams[i]) then + Result := Result + ''; + if (cfStrikeout in FChangedParams[i]) then + Result := Result + ''; + if (cfFontPosition in FChangedParams[i]) then + begin + if FFonts[i].Position = fpSuperscript then Result := Result + ''; + if FFonts[i].Position = fpSubscript then Result := Result + ''; + end; end; // Add the node text Result := Result + GetTextOfRichTextParam(i); // Add closing tags (reverse order as opening!) - if (cfFontPosition in FChangedParams[i]) then + if not SameFont(FBaseFont, FFonts[i]) then begin - if FFonts[i].Position = fpSubscript then Result := Result + ''; - if FFonts[i].Position = fpSuperscript then Result := Result + ''; + if (cfFontPosition in FChangedParams[i]) then + begin + if FFonts[i].Position = fpSubscript then Result := Result + ''; + if FFonts[i].Position = fpSuperscript then Result := Result + ''; + end; + if (cfStrikeout in FChangedParams[i]) then + Result := Result + ''; + if (cfUnderline in FChangedParams[i]) then + Result := Result + ''; + if (cfItalic in FChangedParams[i]) then + Result := Result + ''; + if (cfBold in FChangedParams[i]) then + Result := Result + ''; + if [cfFontName, cfFontSize, cfFontColor] * FChangedParams[i] <> [] then + Result := Result + ''; end; - if (cfStrikeout in FChangedParams[i]) then - Result := Result + ''; - if (cfUnderline in FChangedParams[i]) then - Result := Result + ''; - if (cfItalic in FChangedParams[i]) then - Result := Result + ''; - if (cfBold in FChangedParams[i]) then - Result := Result + ''; - if [cfFontName, cfFontSize, cfFontColor] * FChangedParams[i] <> [] then - Result := Result + '