diff --git a/components/fpspreadsheet/source/common/fpsopendocumentchart.pas b/components/fpspreadsheet/source/common/fpsopendocumentchart.pas index 49ad573ea..306fa0783 100644 --- a/components/fpspreadsheet/source/common/fpsopendocumentchart.pas +++ b/components/fpspreadsheet/source/common/fpsopendocumentchart.pas @@ -316,6 +316,7 @@ begin AColor2 := tmp; end; + {------------------------------------------------------------------------------} { internal number formats } {------------------------------------------------------------------------------} @@ -2049,9 +2050,9 @@ begin --> We must transform to fps angular orientations (0° horizontal, CCW) But axial gradient uses "normal" angle } if gradientstyle <> cgsAxial then - angle := (90.0 + angle) mod 360 + angle := FMod(90.0 + angle, 360.0) else - angle := angle mod 360; + angle := FMod(angle, 360.0); end; s := GetAttrValue(ANode, 'draw:cx'); @@ -3586,13 +3587,13 @@ begin cgsLinear: style := style + Format( '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 ); cgsAxial: style := style + Format( 'draw:angle="%.0fdeg" ', - [ (gradient.Angle) mod 360 ], + [ FMod(gradient.Angle, 360.0) ], FPointSeparatorSettings ); cgsElliptic, cgsSquare, cgsRectangular: diff --git a/components/fpspreadsheet/source/common/fpsutils.pas b/components/fpspreadsheet/source/common/fpsutils.pas index b580aba80..34ab6d10e 100644 --- a/components/fpspreadsheet/source/common/fpsutils.pas +++ b/components/fpspreadsheet/source/common/fpsutils.pas @@ -254,6 +254,10 @@ function Range(ARow, ACol: Cardinal): TsCellRange; overload; function Range(ARow1, ACol1, ARow2, ACol2: Cardinal): TsCellRange; overload; 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; const ALineStyle: TsLineStyle = lsThin): TsCellBorderStyle; @@ -3033,6 +3037,13 @@ begin Result.Sheet2 := ASheetIdx2; 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 @@ -3043,7 +3054,8 @@ begin Result := '' else begin 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 (fssItalic in AFont.Style) then Result := Result + '; italic'; if (fssUnderline in AFont.Style) then Result := Result + '; underline'; diff --git a/components/fpspreadsheet/source/visual/fpspreadsheetchart.pas b/components/fpspreadsheet/source/visual/fpspreadsheetchart.pas index e9f480865..fa4bcaff9 100644 --- a/components/fpspreadsheet/source/visual/fpspreadsheetchart.pas +++ b/components/fpspreadsheet/source/visual/fpspreadsheetchart.pas @@ -1529,23 +1529,23 @@ begin ABrush.Color := Convert_sColor_to_Color(hatch.PatternColor.Color); case hatch.Style of 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 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 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 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; chsDouble, 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 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; end; end; @@ -1660,7 +1660,7 @@ begin end; chsDouble, chsTriple: 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 PrepareCanvas(w, w, lw); png.Canvas.Line(0, w div 2, w, w div 2); @@ -1669,7 +1669,7 @@ begin png.Canvas.Line(0, 0, w, w); end else // 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 w := round(w * sqrt(2)); PrepareCanvas(w, w, lw); @@ -2359,7 +2359,9 @@ begin axis := FChart.LeftAxis else axis := FChart.BottomAxis; + {$IF LCL_FullVersion >= 2020000} axis.Marks.SourceExchangeXY := AWorkbookChart.RotatedAxes; + {$IFEND} case AWorkbookChart.GetChartType of ctScatter, ctBubble: @@ -2539,7 +2541,9 @@ begin ALegend.UseSidebar := not AWorkbookLegend.CanOverlapPlotArea; ALegend.Visible := AWorkbookLegend.Visible; ALegend.TextFormat := tfHTML; + {$IF LCL_FullVersion >= 3990000} ALegend.ColumnCount := 0; + {$IFEND} end; end;