fpspreadsheet: Fix conversion of biff palette colors for fonts in reader.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5860 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2017-05-17 21:43:30 +00:00
parent e1f03daa5c
commit 5c409068c2
6 changed files with 18 additions and 6 deletions

View File

@ -980,9 +980,10 @@ begin
{ Color index }
// The problem is that the palette is loaded after the font list; therefore
// we do not know the rgb color of the font here. We store the palette index
// ("SetAsPaletteIndex") and replace it by the rgb color at the end of the
// workbook globals records. As an indicator that the font does not yet
// contain an rgb color a control bit is set in the high-byte of the TsColor.
// ("SetAsPaletteIndex") and replace it by the rgb color after reading of the
// palette and after reading the workbook globals records. As an indicator
// that the font does not yet contain an rgb color a control bit is set in
// the high-byte of the TsColor.
lColor := WordLEToN(AStream.ReadWord);
if lColor < 8 then
// Use built-in colors directly otherwise the Workbook's FindFont would not find the font in ReadXF

View File

@ -1812,9 +1812,10 @@ begin
{ Color index }
// The problem is that the palette is loaded after the font list; therefore
// we do not know the rgb color of the font here. We store the palette index
// ("SetAsPaletteIndex") and replace it by the rgb color at the end of the
// workbook globals records. As an indicator that the font does not yet
// contain an rgb color a control bit is set in the high-byte of the TsColor.
// ("SetAsPaletteIndex") and replace it by the rgb color after reading of the
// palette and after reading the workbook globals records. As an indicator
// that the font does not yet contain an rgb color a control bit is set in
// the high-byte of the TsColor.
lColor := WordLEToN(AStream.ReadWord);
if lColor < 8 then
// Use built-in colors directly otherwise the Workbook's FindFont would not find the font in ReadXF

View File

@ -1944,6 +1944,11 @@ begin
// Read palette colors and add them to the palette
while FPalette.Count < n do
FPalette.AddColor(DWordLEToN(AStream.ReadDWord));
// The problem is that the palette is loaded after the font list. During
// loading of the fonts the font color had stored the palette index. Here
// we replace the palette index by the rgb color.
FixColors;
end;
{@@ ----------------------------------------------------------------------------

View File

@ -7,7 +7,11 @@
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="spreadtestgui"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
</General>
<i18n>
<EnableI18N LFM="False"/>

View File

@ -16,6 +16,7 @@ uses
hyperlinktests, pagelayouttests, protectiontests;
begin
Application.Scaled := True;
{$IFDEF HEAPTRC}
// Assuming your build mode sets -dDEBUG in Project Options/Other when defining -gh
// This avoids interference when running a production/default build without -gh