You've already forked lazarus-ccr
fpspreadsheet: Prepare ooxml chart reader/writer infrastructure.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9109 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -33,7 +33,7 @@
|
|||||||
This package is all you need if you don't want graphical components (such as grids and charts)."/>
|
This package is all you need if you don't want graphical components (such as grids and charts)."/>
|
||||||
<License Value="LGPL with static linking exception. This is the same license as is used in the LCL (Lazarus Component Library)."/>
|
<License Value="LGPL with static linking exception. This is the same license as is used in the LCL (Lazarus Component Library)."/>
|
||||||
<Version Major="1" Minor="17"/>
|
<Version Major="1" Minor="17"/>
|
||||||
<Files Count="59">
|
<Files Count="60">
|
||||||
<Item1>
|
<Item1>
|
||||||
<Filename Value="source\fps.inc"/>
|
<Filename Value="source\fps.inc"/>
|
||||||
<Type Value="Include"/>
|
<Type Value="Include"/>
|
||||||
@@ -309,6 +309,10 @@ This package is all you need if you don't want graphical components (such a
|
|||||||
<Filename Value="source\common\fpsopendocumentchart.pas"/>
|
<Filename Value="source\common\fpsopendocumentchart.pas"/>
|
||||||
<UnitName Value="fpsopendocumentchart"/>
|
<UnitName Value="fpsopendocumentchart"/>
|
||||||
</Item59>
|
</Item59>
|
||||||
|
<Item60>
|
||||||
|
<Filename Value="source\common\xlsxooxmlchart.pas"/>
|
||||||
|
<UnitName Value="xlsxooxmlchart"/>
|
||||||
|
</Item60>
|
||||||
</Files>
|
</Files>
|
||||||
<CompatibilityMode Value="True"/>
|
<CompatibilityMode Value="True"/>
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|||||||
@@ -41,16 +41,10 @@ uses
|
|||||||
Classes, SysUtils,
|
Classes, SysUtils,
|
||||||
laz2_xmlread, laz2_DOM,
|
laz2_xmlread, laz2_DOM,
|
||||||
avglvltree, math, dateutils, contnrs,
|
avglvltree, math, dateutils, contnrs,
|
||||||
{$IF FPC_FULLVERSION >= 20701}
|
{$IFDEF FPS_PATCHED_ZIPPER} fpszipper, {$ELSE} zipper, {$ENDIF}
|
||||||
zipper,
|
|
||||||
{$ELSE}
|
|
||||||
fpszipper,
|
|
||||||
{$ENDIF}
|
|
||||||
fpstypes, fpsReaderWriter, fpsUtils, fpsHeaderFooterParser,
|
fpstypes, fpsReaderWriter, fpsUtils, fpsHeaderFooterParser,
|
||||||
fpsNumFormat, fpsXMLCommon,
|
fpsNumFormat, fpsXMLCommon,
|
||||||
{$IFDEF FPS_CHARTS}
|
{$IFDEF FPS_CHARTS} fpsChart, {$ENDIF}
|
||||||
fpsChart,
|
|
||||||
{$ENDIF}
|
|
||||||
fpsPagelayout;
|
fpsPagelayout;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, StrUtils, Contnrs, FPImage,
|
Classes, SysUtils, StrUtils, Contnrs, FPImage,
|
||||||
{$IF FPC_FULLVERSION >= 20701}
|
{$IFDEF FPS_PATCHED_ZIPPER}
|
||||||
zipper,
|
|
||||||
{$ELSE}
|
|
||||||
fpszipper,
|
fpszipper,
|
||||||
|
{$ELSE}
|
||||||
|
zipper,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
laz2_xmlread, laz2_DOM,
|
laz2_xmlread, laz2_DOM,
|
||||||
fpsTypes, fpSpreadsheet, fpsChart, fpsUtils, fpsNumFormat,
|
fpsTypes, fpSpreadsheet, fpsChart, fpsUtils, fpsNumFormat,
|
||||||
|
|||||||
@@ -37,13 +37,16 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils,
|
Classes, SysUtils,
|
||||||
laz2_xmlread, laz2_DOM, avglvltree,
|
laz2_xmlread, laz2_DOM, avglvltree,
|
||||||
{$IFDEF FPS_PATCHED_ZIPPER}
|
{$ifdef FPS_PATCHED_ZIPPER}
|
||||||
fpszipper,
|
fpszipper,
|
||||||
{$ELSE}
|
{$else}
|
||||||
zipper,
|
zipper,
|
||||||
{$ENDIF}
|
{$endif}
|
||||||
fpsTypes, fpsUtils, fpsReaderWriter, fpsNumFormat, fpsPalette,
|
fpsTypes, fpsUtils, fpsReaderWriter, fpsNumFormat, fpsPalette,
|
||||||
fpsConditionalFormat,
|
fpsConditionalFormat,
|
||||||
|
{$ifdef FPS_CHARTS}
|
||||||
|
fpsChart,
|
||||||
|
{$ENDIF}
|
||||||
fpsxmlcommon, xlsCommon;
|
fpsxmlcommon, xlsCommon;
|
||||||
|
|
||||||
type
|
type
|
||||||
@@ -52,6 +55,9 @@ type
|
|||||||
|
|
||||||
TsSpreadOOXMLReader = class(TsSpreadXMLReader)
|
TsSpreadOOXMLReader = class(TsSpreadXMLReader)
|
||||||
private
|
private
|
||||||
|
{$ifdef FPS_CHARTS}
|
||||||
|
FChartReader: TsBasicSpreadChartReader;
|
||||||
|
{$endif}
|
||||||
FDateMode: TDateMode;
|
FDateMode: TDateMode;
|
||||||
FPointSeparatorSettings: TFormatSettings;
|
FPointSeparatorSettings: TFormatSettings;
|
||||||
FSharedStrings: TStringList;
|
FSharedStrings: TStringList;
|
||||||
@@ -155,6 +161,9 @@ type
|
|||||||
|
|
||||||
TsSpreadOOXMLWriter = class(TsCustomSpreadWriter)
|
TsSpreadOOXMLWriter = class(TsCustomSpreadWriter)
|
||||||
private
|
private
|
||||||
|
{$IFDEF FPS_CHARTS}
|
||||||
|
FChartWriter: TsBasicSpreadChartWriter;
|
||||||
|
{$ENDIF}
|
||||||
FFirstNumFormatIndexInFile: Integer;
|
FFirstNumFormatIndexInFile: Integer;
|
||||||
vmlDrawingCounter: Integer;
|
vmlDrawingCounter: Integer;
|
||||||
protected
|
protected
|
||||||
@@ -283,6 +292,7 @@ type
|
|||||||
|
|
||||||
public
|
public
|
||||||
constructor Create(AWorkbook: TsBasicWorkbook); override;
|
constructor Create(AWorkbook: TsBasicWorkbook); override;
|
||||||
|
destructor Destroy; override;
|
||||||
{ General writing methods }
|
{ General writing methods }
|
||||||
procedure WriteStringToFile(AFileName, AString: string);
|
procedure WriteStringToFile(AFileName, AString: string);
|
||||||
procedure WriteToStream(AStream: TStream; AParams: TsStreamParams = []); override;
|
procedure WriteToStream(AStream: TStream; AParams: TsStreamParams = []); override;
|
||||||
@@ -308,7 +318,9 @@ implementation
|
|||||||
uses
|
uses
|
||||||
variants, strutils, dateutils, math, lazutf8, LazFileUtils, uriparser, typinfo,
|
variants, strutils, dateutils, math, lazutf8, LazFileUtils, uriparser, typinfo,
|
||||||
{%H-}fpsPatches, fpSpreadsheet, fpsCrypto, fpsExprParser,
|
{%H-}fpsPatches, fpSpreadsheet, fpsCrypto, fpsExprParser,
|
||||||
fpsStrings, fpsStreams, fpsClasses, fpsImages, fpsChart;
|
fpsStrings, fpsStreams, fpsClasses,
|
||||||
|
{$ifdef FPS_CHARTS}xlsxooxmlChart,{$endif}
|
||||||
|
fpsImages;
|
||||||
|
|
||||||
const
|
const
|
||||||
{ OOXML general XML constants }
|
{ OOXML general XML constants }
|
||||||
@@ -830,6 +842,11 @@ end;
|
|||||||
constructor TsSpreadOOXMLReader.Create(AWorkbook: TsBasicWorkbook);
|
constructor TsSpreadOOXMLReader.Create(AWorkbook: TsBasicWorkbook);
|
||||||
begin
|
begin
|
||||||
inherited Create(AWorkbook);
|
inherited Create(AWorkbook);
|
||||||
|
|
||||||
|
{$ifdef FPS_CHARTS}
|
||||||
|
FChartReader := TsSpreadOOXMLChartReader.Create(self);
|
||||||
|
{$endif}
|
||||||
|
|
||||||
FDateMode := XlsxSettings.DateMode;
|
FDateMode := XlsxSettings.DateMode;
|
||||||
|
|
||||||
FSharedStrings := TStringList.Create;
|
FSharedStrings := TStringList.Create;
|
||||||
@@ -898,6 +915,10 @@ begin
|
|||||||
|
|
||||||
FPalette.Free;
|
FPalette.Free;
|
||||||
|
|
||||||
|
{$ifdef FPS_CHARTS}
|
||||||
|
FChartReader.Free;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -4629,6 +4650,10 @@ constructor TsSpreadOOXMLWriter.Create(AWorkbook: TsBasicWorkbook);
|
|||||||
begin
|
begin
|
||||||
inherited Create(AWorkbook);
|
inherited Create(AWorkbook);
|
||||||
|
|
||||||
|
{$ifdef FPS_CHARTS}
|
||||||
|
FChartWriter := TsSpreadOOXMLChartWriter.Create(self);
|
||||||
|
{$endif}
|
||||||
|
|
||||||
// Initial base date in case it won't be set otherwise.
|
// Initial base date in case it won't be set otherwise.
|
||||||
// Use 1900 to get a bit more range between 1900..1904.
|
// Use 1900 to get a bit more range between 1900..1904.
|
||||||
FDateMode := XlsxSettings.DateMode;
|
FDateMode := XlsxSettings.DateMode;
|
||||||
@@ -4641,6 +4666,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
destructor TsSpreadOOXMLWriter.Destroy;
|
||||||
|
begin
|
||||||
|
{$ifdef FPS_CHARTS}
|
||||||
|
FChartWriter.Free;
|
||||||
|
{$endif}
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
{@@ ----------------------------------------------------------------------------
|
||||||
Looks for the combination of border attributes of the given format record in
|
Looks for the combination of border attributes of the given format record in
|
||||||
the FBorderList and returns its index.
|
the FBorderList and returns its index.
|
||||||
|
|||||||
88
components/fpspreadsheet/source/common/xlsxooxmlchart.pas
Normal file
88
components/fpspreadsheet/source/common/xlsxooxmlchart.pas
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
unit xlsxooxmlChart;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
{$include ..\fps.inc}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
{$ifdef FPS_CHARTS}
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, StrUtils, Contnrs, FPImage,
|
||||||
|
{$ifdef FPS_PATCHED_ZIPPER}fpszipper,{$else}zipper,{$endif}
|
||||||
|
laz2_xmlread, laz2_DOM,
|
||||||
|
fpsTypes, fpSpreadsheet, fpsChart, fpsUtils, fpsNumFormat,
|
||||||
|
fpsReaderWriter, fpsXMLCommon;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TsSpreadOOXMLChartReader }
|
||||||
|
|
||||||
|
TsSpreadOOXMLChartReader = class(TsBasicSpreadChartReader)
|
||||||
|
private
|
||||||
|
FPointSeparatorSettings: TFormatSettings;
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
public
|
||||||
|
constructor Create(AReader: TsBasicSpreadReader); override;
|
||||||
|
destructor Destroy; override;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
TsSpreadOOXMLChartWriter = class(TsBasicSpreadChartWriter)
|
||||||
|
private
|
||||||
|
FPointSeparatorSettings: TFormatSettings;
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
public
|
||||||
|
constructor Create(AWriter: TsBasicSpreadWriter); override;
|
||||||
|
destructor Destroy; override;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{$IFDEF FPS_CHARTS}
|
||||||
|
|
||||||
|
uses
|
||||||
|
xlsxooxml;
|
||||||
|
|
||||||
|
{ TsSpreadOOXMLChartReader }
|
||||||
|
|
||||||
|
constructor TsSpreadOOXMLChartReader.Create(AReader: TsBasicSpreadReader);
|
||||||
|
begin
|
||||||
|
inherited Create(AReader);
|
||||||
|
|
||||||
|
FPointSeparatorSettings := SysUtils.DefaultFormatSettings;
|
||||||
|
FPointSeparatorSettings.DecimalSeparator:='.';
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TsSpreadOOXMLChartReader.Destroy;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TsSpreadOOXMLChartWriter }
|
||||||
|
|
||||||
|
constructor TsSpreadOOXMLChartWriter.Create(AWriter: TsBasicSpreadWriter);
|
||||||
|
begin
|
||||||
|
inherited Create(AWriter);
|
||||||
|
|
||||||
|
FPointSeparatorSettings := SysUtils.DefaultFormatSettings;
|
||||||
|
FPointSeparatorSettings.DecimalSeparator:='.';
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TsSpreadOOXMLChartWriter.Destroy;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
||||||
Reference in New Issue
Block a user