FPspreadsheet: Fix compilation with Laz 2.0.x/FPC 3.0.x

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9468 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2024-09-27 18:06:02 +00:00
parent 332e6d234b
commit e7161ea286
3 changed files with 30 additions and 13 deletions

View File

@ -316,6 +316,7 @@ begin
AColor2 := tmp; AColor2 := tmp;
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
{ internal number formats } { internal number formats }
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
@ -2049,9 +2050,9 @@ begin
--> We must transform to fps angular orientations (0° horizontal, CCW) --> We must transform to fps angular orientations (0° horizontal, CCW)
But axial gradient uses "normal" angle } But axial gradient uses "normal" angle }
if gradientstyle <> cgsAxial then if gradientstyle <> cgsAxial then
angle := (90.0 + angle) mod 360 angle := FMod(90.0 + angle, 360.0)
else else
angle := angle mod 360; angle := FMod(angle, 360.0);
end; end;
s := GetAttrValue(ANode, 'draw:cx'); s := GetAttrValue(ANode, 'draw:cx');
@ -3586,13 +3587,13 @@ begin
cgsLinear: cgsLinear:
style := style + Format( style := style + Format(
'draw:angle="%.0fdeg" ', 'draw:angle="%.0fdeg" ',
[ (90 + gradient.Angle) mod 360 ], // transform to fps angle orientations [ FMod(90 + gradient.Angle, 360.0) ], // transform to fps angle orientations
FPointSeparatorSettings FPointSeparatorSettings
); );
cgsAxial: cgsAxial:
style := style + Format( style := style + Format(
'draw:angle="%.0fdeg" ', 'draw:angle="%.0fdeg" ',
[ (gradient.Angle) mod 360 ], [ FMod(gradient.Angle, 360.0) ],
FPointSeparatorSettings FPointSeparatorSettings
); );
cgsElliptic, cgsSquare, cgsRectangular: cgsElliptic, cgsSquare, cgsRectangular:

View File

@ -254,6 +254,10 @@ function Range(ARow, ACol: Cardinal): TsCellRange; overload;
function Range(ARow1, ACol1, ARow2, ACol2: Cardinal): TsCellRange; overload; function Range(ARow1, ACol1, ARow2, ACol2: Cardinal): TsCellRange; overload;
function Range3D(ASheetIdx1, ASheetIdx2: Integer; ARow1, ACol1, ARow2, ACol2: Cardinal): TsCellRange3D; function Range3D(ASheetIdx1, ASheetIdx2: Integer; ARow1, ACol1, ARow2, ACol2: Cardinal): TsCellRange3D;
{$IF FPC_FullVersion < 30200}
function FMod(const a, b: Double): Double; inline; overload;
{$IFEND}
function CellBorderStyle(const AColor: TsColor = scBlack; function CellBorderStyle(const AColor: TsColor = scBlack;
const ALineStyle: TsLineStyle = lsThin): TsCellBorderStyle; const ALineStyle: TsLineStyle = lsThin): TsCellBorderStyle;
@ -3033,6 +3037,13 @@ begin
Result.Sheet2 := ASheetIdx2; Result.Sheet2 := ASheetIdx2;
end; end;
{$IF FPC_FullVersion < 30200}
function FMod(const a, b: Double): Double;
begin
Result := a-b * Int(a/b);
end;
{$IFEND}
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Combines the relevant font properties into a string Combines the relevant font properties into a string
@ -3043,7 +3054,8 @@ begin
Result := '' Result := ''
else begin else begin
Result := Format('%s; size %.1g; %s', [ Result := Format('%s; size %.1g; %s', [
AFont.FontName, AFont.Size, GetColorName(AFont.Color)]); AFont.FontName, AFont.Size, GetColorName(AFont.Color)
]);
if (fssBold in AFont.Style) then Result := Result + '; bold'; if (fssBold in AFont.Style) then Result := Result + '; bold';
if (fssItalic in AFont.Style) then Result := Result + '; italic'; if (fssItalic in AFont.Style) then Result := Result + '; italic';
if (fssUnderline in AFont.Style) then Result := Result + '; underline'; if (fssUnderline in AFont.Style) then Result := Result + '; underline';

View File

@ -1529,23 +1529,23 @@ begin
ABrush.Color := Convert_sColor_to_Color(hatch.PatternColor.Color); ABrush.Color := Convert_sColor_to_Color(hatch.PatternColor.Color);
case hatch.Style of case hatch.Style of
chsSingle: chsSingle:
if InRange(hatch.PatternAngle mod 180, -22.5, 22.5) then // horizontal "approximation" if InRange(FMod(hatch.PatternAngle, 180.0), -22.5, 22.5) then // horizontal "approximation"
ABrush.Style := bsHorizontal ABrush.Style := bsHorizontal
else else
if InRange((hatch.PatternAngle - 90) mod 180, -22.5, 22.5) then // vertical if InRange(FMod(hatch.PatternAngle - 90, 180.0), -22.5, 22.5) then // vertical
ABrush.Style := bsVertical ABrush.Style := bsVertical
else else
if Inrange((hatch.PatternAngle - 45) mod 180, -22.5, 22.5) then // diagonal up if Inrange(FMod(hatch.PatternAngle - 45, 180.0), -22.5, 22.5) then // diagonal up
ABrush.Style := bsBDiagonal ABrush.Style := bsBDiagonal
else else
if InRange((hatch.PatternAngle + 45) mod 180, -22.5, 22.5) then // diagonal down if InRange(FMod(hatch.PatternAngle + 45, 180.0), -22.5, 22.5) then // diagonal down
ABrush.Style := bsFDiagonal; ABrush.Style := bsFDiagonal;
chsDouble, chsDouble,
chsTriple: // no triple hatches in LCL - fall-back to double hatch chsTriple: // no triple hatches in LCL - fall-back to double hatch
if InRange(hatch.PatternAngle mod 180, -22.5, 22.5) then // +++ if InRange(FMod(hatch.PatternAngle, 180.0), -22.5, 22.5) then // +++
ABrush.Style := bsCross ABrush.Style := bsCross
else else
if InRange((hatch.PatternAngle - 45) mod 180, -22.5, 22.5) then // xxx if InRange(FMod(hatch.PatternAngle - 45, 180.0), -22.5, 22.5) then // xxx
ABrush.Style := bsDiagCross; ABrush.Style := bsDiagCross;
end; end;
end; end;
@ -1660,7 +1660,7 @@ begin
end; end;
chsDouble, chsTriple: chsDouble, chsTriple:
begin // +++ begin // +++
if InRange(hatch.PatternAngle mod 180, -22.5, 22.5) then if InRange(FMod(hatch.PatternAngle, 180.0), -22.5, 22.5) then
begin begin
PrepareCanvas(w, w, lw); PrepareCanvas(w, w, lw);
png.Canvas.Line(0, w div 2, w, w div 2); png.Canvas.Line(0, w div 2, w, w div 2);
@ -1669,7 +1669,7 @@ begin
png.Canvas.Line(0, 0, w, w); png.Canvas.Line(0, 0, w, w);
end else end else
// xxx // xxx
if InRange((hatch.PatternAngle-45) mod 180, -22.5, 22.5) then if InRange(FMod(hatch.PatternAngle-45, 180.0), -22.5, 22.5) then
begin begin
w := round(w * sqrt(2)); w := round(w * sqrt(2));
PrepareCanvas(w, w, lw); PrepareCanvas(w, w, lw);
@ -2359,7 +2359,9 @@ begin
axis := FChart.LeftAxis axis := FChart.LeftAxis
else else
axis := FChart.BottomAxis; axis := FChart.BottomAxis;
{$IF LCL_FullVersion >= 2020000}
axis.Marks.SourceExchangeXY := AWorkbookChart.RotatedAxes; axis.Marks.SourceExchangeXY := AWorkbookChart.RotatedAxes;
{$IFEND}
case AWorkbookChart.GetChartType of case AWorkbookChart.GetChartType of
ctScatter, ctBubble: ctScatter, ctBubble:
@ -2539,7 +2541,9 @@ begin
ALegend.UseSidebar := not AWorkbookLegend.CanOverlapPlotArea; ALegend.UseSidebar := not AWorkbookLegend.CanOverlapPlotArea;
ALegend.Visible := AWorkbookLegend.Visible; ALegend.Visible := AWorkbookLegend.Visible;
ALegend.TextFormat := tfHTML; ALegend.TextFormat := tfHTML;
{$IF LCL_FullVersion >= 3990000}
ALegend.ColumnCount := 0; ALegend.ColumnCount := 0;
{$IFEND}
end; end;
end; end;