fpspreadsheet: Adds initial implementation of a visual component and reads cell iteration methods to TsWorksheet

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@972 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2009-10-06 19:25:18 +00:00
parent 312447448c
commit 2d2920da93
13 changed files with 861 additions and 107 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

View File

@@ -0,0 +1,265 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<PathDelim Value="\"/>
<Version Value="7"/>
<General>
<MainUnit Value="0"/>
<TargetFileExt Value=".exe"/>
<Icon Value="0"/>
<UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="3"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
<Language Value=""/>
<CharSet Value=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="laz_fpspreadsheet_visual"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="8">
<Unit0>
<Filename Value="fpsvisual.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="fpsvisual"/>
<UsageCount Value="21"/>
</Unit0>
<Unit1>
<Filename Value="mainform.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="mainform"/>
<CursorPos X="20" Y="38"/>
<TopLine Value="12"/>
<EditorIndex Value="0"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
</Unit1>
<Unit2>
<Filename Value="..\..\fpspreadsheet.pas"/>
<UnitName Value="fpspreadsheet"/>
<CursorPos X="15" Y="92"/>
<TopLine Value="73"/>
<EditorIndex Value="1"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit2>
<Unit3>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<UnitName Value="fpspreadsheetgrid"/>
<CursorPos X="14" Y="142"/>
<TopLine Value="129"/>
<EditorIndex Value="3"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
<Filename Value="..\..\fpolestorage.pas"/>
<UnitName Value="fpolestorage"/>
<CursorPos X="4" Y="44"/>
<TopLine Value="25"/>
<EditorIndex Value="5"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit4>
<Unit5>
<Filename Value="..\..\..\..\..\lazarus27\fpc\2.2.4\source\packages\winunits-base\src\activex.pp"/>
<UnitName Value="ActiveX"/>
<CursorPos X="10" Y="24"/>
<TopLine Value="49"/>
<EditorIndex Value="6"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit5>
<Unit6>
<Filename Value="..\..\..\..\..\lazarus27\fpc\2.2.4\source\packages\fcl-base\src\avl_tree.pp"/>
<UnitName Value="AVL_Tree"/>
<CursorPos X="14" Y="83"/>
<TopLine Value="37"/>
<EditorIndex Value="2"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit6>
<Unit7>
<Filename Value="..\..\..\..\..\lazarus\lcl\grids.pas"/>
<UnitName Value="Grids"/>
<CursorPos X="28" Y="1534"/>
<TopLine Value="1517"/>
<EditorIndex Value="4"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit7>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="486" Column="15" TopLine="461"/>
</Position1>
<Position2>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="490" Column="17" TopLine="461"/>
</Position2>
<Position3>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="492" Column="9" TopLine="461"/>
</Position3>
<Position4>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="859" Column="42" TopLine="840"/>
</Position4>
<Position5>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="880" Column="21" TopLine="861"/>
</Position5>
<Position6>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="883" Column="32" TopLine="861"/>
</Position6>
<Position7>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="885" Column="75" TopLine="861"/>
</Position7>
<Position8>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="889" Column="20" TopLine="861"/>
</Position8>
<Position9>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="352" Column="14" TopLine="338"/>
</Position9>
<Position10>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="101" Column="15" TopLine="82"/>
</Position10>
<Position11>
<Filename Value="..\..\..\..\..\lazarus27\fpc\2.2.4\source\packages\fcl-base\src\avl_tree.pp"/>
<Caret Line="83" Column="16" TopLine="59"/>
</Position11>
<Position12>
<Filename Value="mainform.pas"/>
<Caret Line="34" Column="21" TopLine="12"/>
</Position12>
<Position13>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="99" Column="3" TopLine="83"/>
</Position13>
<Position14>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="352" Column="23" TopLine="333"/>
</Position14>
<Position15>
<Filename Value="mainform.pas"/>
<Caret Line="37" Column="27" TopLine="12"/>
</Position15>
<Position16>
<Filename Value="mainform.pas"/>
<Caret Line="36" Column="1" TopLine="12"/>
</Position16>
<Position17>
<Filename Value="mainform.pas"/>
<Caret Line="37" Column="1" TopLine="12"/>
</Position17>
<Position18>
<Filename Value="mainform.pas"/>
<Caret Line="38" Column="1" TopLine="12"/>
</Position18>
<Position19>
<Filename Value="mainform.pas"/>
<Caret Line="39" Column="1" TopLine="12"/>
</Position19>
<Position20>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="46" Column="1" TopLine="27"/>
</Position20>
<Position21>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="48" Column="1" TopLine="29"/>
</Position21>
<Position22>
<Filename Value="mainform.pas"/>
<Caret Line="38" Column="3" TopLine="12"/>
</Position22>
<Position23>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="48" Column="19" TopLine="35"/>
</Position23>
<Position24>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="15" Column="41" TopLine="4"/>
</Position24>
<Position25>
<Filename Value="..\..\..\..\..\lazarus\lcl\grids.pas"/>
<Caret Line="1444" Column="33" TopLine="1425"/>
</Position25>
<Position26>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="25" Column="19" TopLine="4"/>
</Position26>
<Position27>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="17" Column="41" TopLine="7"/>
</Position27>
<Position28>
<Filename Value="mainform.pas"/>
<Caret Line="38" Column="20" TopLine="12"/>
</Position28>
<Position29>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="29" Column="17" TopLine="7"/>
</Position29>
<Position30>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="199" Column="18" TopLine="173"/>
</Position30>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="8"/>
<PathDelim Value="\"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)\"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,21 @@
program fpsvisual;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, mainform, LResources, laz_fpspreadsheet_visual
{ you can add units after this };
{$IFDEF WINDOWS}{$R fpsvisual.rc}{$ENDIF}
begin
{$I fpsvisual.lrs}
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="CompanyName.ProductName.YourApp" type="win32"/>
<description>Your application description here.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

View File

@@ -0,0 +1,7 @@
#define RT_MANIFEST 24
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2
#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "fpsvisual.manifest"
MAINICON ICON "fpsvisual.ico"

View File

@@ -0,0 +1,26 @@
object Form1: TForm1
Left = 288
Height = 300
Top = 204
Width = 400
Caption = 'FPSVisual'
ClientHeight = 300
ClientWidth = 400
LCLVersion = '0.9.29'
object sWorksheetGrid1: TsWorksheetGrid
Left = 8
Height = 232
Top = 8
Width = 384
TabOrder = 0
end
object buttonPopulateGrid: TButton
Left = 144
Height = 25
Top = 256
Width = 112
Caption = 'Populate Grid'
OnClick = buttonPopulateGridClick
TabOrder = 1
end
end

View File

@@ -0,0 +1,11 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3' '#1#6'Height'#3','#1#3'Top'#3#204#0#5'Wi'
+'dth'#3#144#1#7'Caption'#6#9'FPSVisual'#12'ClientHeight'#3','#1#11'ClientWid'
+'th'#3#144#1#10'LCLVersion'#6#6'0.9.29'#0#15'TsWorksheetGrid'#15'sWorksheetG'
+'rid1'#4'Left'#2#8#6'Height'#3#232#0#3'Top'#2#8#5'Width'#3#128#1#8'TabOrder'
+#2#0#0#0#7'TButton'#18'buttonPopulateGrid'#4'Left'#3#144#0#6'Height'#2#25#3
+'Top'#3#0#1#5'Width'#2'p'#7'Caption'#6#13'Populate Grid'#7'OnClick'#7#23'but'
+'tonPopulateGridClick'#8'TabOrder'#2#1#0#0#0
]);

View File

@@ -0,0 +1,49 @@
unit mainform;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, fpspreadsheetgrid, fpspreadsheet;
type
{ TForm1 }
TForm1 = class(TForm)
buttonPopulateGrid: TButton;
sWorksheetGrid1: TsWorksheetGrid;
procedure buttonPopulateGridClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{ TForm1 }
procedure TForm1.buttonPopulateGridClick(Sender: TObject);
var
lWorksheet: TsWorksheet;
begin
lWorksheet := TsWorksheet.Create;
try
lWorksheet.GetCell(2, 2)^.UTF8StringValue := 'Algo';
sWorksheetGrid1.LoadFromWorksheet(lWorksheet);
finally
lWorksheet.Free;
end;
end;
initialization
{$I mainform.lrs}
end.

View File

@@ -11,7 +11,7 @@
<TargetFileExt Value=".exe"/> <TargetFileExt Value=".exe"/>
<Title Value="opendocwrite"/> <Title Value="opendocwrite"/>
<UseAppBundle Value="False"/> <UseAppBundle Value="False"/>
<ActiveEditorIndexAtStart Value="0"/> <ActiveEditorIndexAtStart Value="1"/>
</General> </General>
<VersionInfo> <VersionInfo>
<ProjectVersion Value=""/> <ProjectVersion Value=""/>
@@ -33,13 +33,13 @@
<PackageName Value="laz_fpspreadsheet"/> <PackageName Value="laz_fpspreadsheet"/>
</Item1> </Item1>
</RequiredPackages> </RequiredPackages>
<Units Count="20"> <Units Count="24">
<Unit0> <Unit0>
<Filename Value="opendocwrite.lpr"/> <Filename Value="opendocwrite.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="opendocwrite"/> <UnitName Value="opendocwrite"/>
<CursorPos X="33" Y="35"/> <CursorPos X="33" Y="35"/>
<TopLine Value="20"/> <TopLine Value="6"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<UsageCount Value="309"/> <UsageCount Value="309"/>
<Loaded Value="True"/> <Loaded Value="True"/>
@@ -70,7 +70,7 @@
<UnitName Value="xlsbiff5"/> <UnitName Value="xlsbiff5"/>
<CursorPos X="38" Y="1059"/> <CursorPos X="38" Y="1059"/>
<TopLine Value="1045"/> <TopLine Value="1045"/>
<EditorIndex Value="7"/> <EditorIndex Value="10"/>
<UsageCount Value="140"/> <UsageCount Value="140"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit4> </Unit4>
@@ -79,7 +79,7 @@
<UnitName Value="fpsutils"/> <UnitName Value="fpsutils"/>
<CursorPos X="1" Y="49"/> <CursorPos X="1" Y="49"/>
<TopLine Value="30"/> <TopLine Value="30"/>
<EditorIndex Value="6"/> <EditorIndex Value="9"/>
<UsageCount Value="140"/> <UsageCount Value="140"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit5> </Unit5>
@@ -88,7 +88,7 @@
<UnitName Value="xlsbiff2"/> <UnitName Value="xlsbiff2"/>
<CursorPos X="25" Y="216"/> <CursorPos X="25" Y="216"/>
<TopLine Value="203"/> <TopLine Value="203"/>
<EditorIndex Value="8"/> <EditorIndex Value="11"/>
<UsageCount Value="139"/> <UsageCount Value="139"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit6> </Unit6>
@@ -97,7 +97,7 @@
<UnitName Value="fpolestorage"/> <UnitName Value="fpolestorage"/>
<CursorPos X="30" Y="654"/> <CursorPos X="30" Y="654"/>
<TopLine Value="642"/> <TopLine Value="642"/>
<EditorIndex Value="9"/> <EditorIndex Value="12"/>
<UsageCount Value="139"/> <UsageCount Value="139"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit7> </Unit7>
@@ -116,9 +116,9 @@
<Unit10> <Unit10>
<Filename Value="..\..\fpspreadsheet.pas"/> <Filename Value="..\..\fpspreadsheet.pas"/>
<UnitName Value="fpspreadsheet"/> <UnitName Value="fpspreadsheet"/>
<CursorPos X="1" Y="102"/> <CursorPos X="20" Y="112"/>
<TopLine Value="85"/> <TopLine Value="118"/>
<EditorIndex Value="4"/> <EditorIndex Value="6"/>
<UsageCount Value="100"/> <UsageCount Value="100"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit10> </Unit10>
@@ -133,7 +133,7 @@
<UnitName Value="fpsopendocument"/> <UnitName Value="fpsopendocument"/>
<CursorPos X="1" Y="384"/> <CursorPos X="1" Y="384"/>
<TopLine Value="373"/> <TopLine Value="373"/>
<EditorIndex Value="2"/> <EditorIndex Value="4"/>
<UsageCount Value="22"/> <UsageCount Value="22"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit12> </Unit12>
@@ -142,12 +142,12 @@
<UnitName Value="xlsxooxml"/> <UnitName Value="xlsxooxml"/>
<CursorPos X="1" Y="35"/> <CursorPos X="1" Y="35"/>
<TopLine Value="16"/> <TopLine Value="16"/>
<EditorIndex Value="3"/> <EditorIndex Value="5"/>
<UsageCount Value="22"/> <UsageCount Value="22"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit13> </Unit13>
<Unit14> <Unit14>
<Filename Value="..\..\..\..\..\..\..\..\usr\local\share\fpcsrc\rtl\objpas\sysutils\sysstrh.inc"/> <Filename Value="..\..\..\..\..\..\usr\local\share\fpcsrc\rtl\objpas\sysutils\sysstrh.inc"/>
<CursorPos X="38" Y="145"/> <CursorPos X="38" Y="145"/>
<TopLine Value="141"/> <TopLine Value="141"/>
<UsageCount Value="15"/> <UsageCount Value="15"/>
@@ -157,25 +157,25 @@
<UnitName Value="fpsallformats"/> <UnitName Value="fpsallformats"/>
<CursorPos X="44" Y="13"/> <CursorPos X="44" Y="13"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="1"/> <EditorIndex Value="3"/>
<UsageCount Value="17"/> <UsageCount Value="17"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit15> </Unit15>
<Unit16> <Unit16>
<Filename Value="..\..\..\..\..\..\..\..\usr\local\share\fpcsrc\packages\paszlib\src\zipper.pp"/> <Filename Value="..\..\..\..\..\..\usr\local\share\fpcsrc\packages\paszlib\src\zipper.pp"/>
<UnitName Value="zipper"/> <UnitName Value="zipper"/>
<CursorPos X="24" Y="7"/> <CursorPos X="24" Y="7"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="12"/> <UsageCount Value="12"/>
</Unit16> </Unit16>
<Unit17> <Unit17>
<Filename Value="..\..\..\..\..\..\..\..\usr\local\share\fpcsrc\rtl\objpas\sysutils\finah.inc"/> <Filename Value="..\..\..\..\..\..\usr\local\share\fpcsrc\rtl\objpas\sysutils\finah.inc"/>
<CursorPos X="27" Y="25"/> <CursorPos X="27" Y="25"/>
<TopLine Value="17"/> <TopLine Value="17"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit17> </Unit17>
<Unit18> <Unit18>
<Filename Value="..\..\..\..\..\..\..\..\usr\local\share\fpcsrc\rtl\objpas\sysutils\fina.inc"/> <Filename Value="..\..\..\..\..\..\usr\local\share\fpcsrc\rtl\objpas\sysutils\fina.inc"/>
<CursorPos X="28" Y="258"/> <CursorPos X="28" Y="258"/>
<TopLine Value="249"/> <TopLine Value="249"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
@@ -185,131 +185,165 @@
<UnitName Value="fpszipper"/> <UnitName Value="fpszipper"/>
<CursorPos X="36" Y="9"/> <CursorPos X="36" Y="9"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="5"/> <EditorIndex Value="8"/>
<UsageCount Value="14"/> <UsageCount Value="14"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit19> </Unit19>
<Unit20>
<Filename Value="unit1.pas"/>
<UnitName Value="Unit1"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit20>
<Unit21>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<UnitName Value="fpspreadsheetgrid"/>
<CursorPos X="31" Y="66"/>
<TopLine Value="36"/>
<EditorIndex Value="1"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit21>
<Unit22>
<Filename Value="..\..\..\..\..\lazarus\lcl\grids.pas"/>
<UnitName Value="Grids"/>
<CursorPos X="17" Y="1415"/>
<TopLine Value="1396"/>
<EditorIndex Value="2"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit22>
<Unit23>
<Filename Value="..\..\..\..\..\lazarus27\fpc\2.2.4\source\packages\fcl-base\src\avl_tree.pp"/>
<UnitName Value="AVL_Tree"/>
<CursorPos X="1" Y="58"/>
<TopLine Value="39"/>
<EditorIndex Value="7"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit23>
</Units> </Units>
<JumpHistory Count="30" HistoryIndex="29"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="..\..\xlsbiff2.pas"/>
<Caret Line="153" Column="72" TopLine="137"/>
</Position1>
<Position2>
<Filename Value="..\..\xlsbiff2.pas"/>
<Caret Line="159" Column="13" TopLine="137"/>
</Position2>
<Position3>
<Filename Value="..\..\xlsbiff2.pas"/>
<Caret Line="187" Column="32" TopLine="174"/>
</Position3>
<Position4>
<Filename Value="..\..\xlsbiff2.pas"/>
<Caret Line="190" Column="13" TopLine="174"/>
</Position4>
<Position5>
<Filename Value="..\..\xlsbiff2.pas"/>
<Caret Line="193" Column="34" TopLine="174"/>
</Position5>
<Position6>
<Filename Value="..\..\xlsbiff2.pas"/>
<Caret Line="226" Column="33" TopLine="213"/>
</Position6>
<Position7>
<Filename Value="..\..\xlsbiff2.pas"/>
<Caret Line="97" Column="16" TopLine="85"/>
</Position7>
<Position8>
<Filename Value="..\..\xlsbiff5.pas"/>
<Caret Line="601" Column="25" TopLine="588"/>
</Position8>
<Position9>
<Filename Value="..\..\xlsbiff5.pas"/>
<Caret Line="673" Column="34" TopLine="659"/>
</Position9>
<Position10>
<Filename Value="..\..\xlsbiff5.pas"/>
<Caret Line="700" Column="34" TopLine="686"/>
</Position10>
<Position11>
<Filename Value="opendocwrite.lpr"/>
<Caret Line="13" Column="45" TopLine="5"/>
</Position11>
<Position12>
<Filename Value="..\..\fpsopendocument.pas"/>
<Caret Line="40" Column="17" TopLine="28"/>
</Position12>
<Position13>
<Filename Value="..\..\fpsopendocument.pas"/>
<Caret Line="350" Column="29" TopLine="339"/>
</Position13>
<Position14>
<Filename Value="..\..\xlsxooxml.pas"/>
<Caret Line="51" Column="25" TopLine="39"/>
</Position14>
<Position15>
<Filename Value="..\..\xlsxooxml.pas"/> <Filename Value="..\..\xlsxooxml.pas"/>
<Caret Line="103" Column="31" TopLine="103"/> <Caret Line="103" Column="31" TopLine="103"/>
</Position15> </Position1>
<Position16> <Position2>
<Filename Value="..\..\xlsxooxml.pas"/> <Filename Value="..\..\xlsxooxml.pas"/>
<Caret Line="51" Column="15" TopLine="50"/> <Caret Line="51" Column="15" TopLine="50"/>
</Position16> </Position2>
<Position17> <Position3>
<Filename Value="..\..\xlsxooxml.pas"/> <Filename Value="..\..\xlsxooxml.pas"/>
<Caret Line="249" Column="5" TopLine="224"/> <Caret Line="249" Column="5" TopLine="224"/>
</Position17> </Position3>
<Position18> <Position4>
<Filename Value="..\..\xlsxooxml.pas"/> <Filename Value="..\..\xlsxooxml.pas"/>
<Caret Line="242" Column="1" TopLine="238"/> <Caret Line="242" Column="1" TopLine="238"/>
</Position18> </Position4>
<Position19> <Position5>
<Filename Value="opendocwrite.lpr"/> <Filename Value="opendocwrite.lpr"/>
<Caret Line="30" Column="5" TopLine="10"/> <Caret Line="30" Column="5" TopLine="10"/>
</Position19> </Position5>
<Position20> <Position6>
<Filename Value="..\..\fpsopendocument.pas"/> <Filename Value="..\..\fpsopendocument.pas"/>
<Caret Line="51" Column="22" TopLine="39"/> <Caret Line="51" Column="22" TopLine="39"/>
</Position20> </Position6>
<Position21> <Position7>
<Filename Value="..\..\fpsopendocument.pas"/> <Filename Value="..\..\fpsopendocument.pas"/>
<Caret Line="68" Column="10" TopLine="55"/> <Caret Line="68" Column="10" TopLine="55"/>
</Position21> </Position7>
<Position22> <Position8>
<Filename Value="..\..\xlsxooxml.pas"/> <Filename Value="..\..\xlsxooxml.pas"/>
<Caret Line="268" Column="5" TopLine="244"/> <Caret Line="268" Column="5" TopLine="244"/>
</Position22> </Position8>
<Position23> <Position9>
<Filename Value="..\..\fpsopendocument.pas"/> <Filename Value="..\..\fpsopendocument.pas"/>
<Caret Line="38" Column="36" TopLine="32"/> <Caret Line="38" Column="36" TopLine="32"/>
</Position9>
<Position10>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="62" Column="4" TopLine="52"/>
</Position10>
<Position11>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="66" Column="21" TopLine="53"/>
</Position11>
<Position12>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="102" Column="20" TopLine="89"/>
</Position12>
<Position13>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="105" Column="20" TopLine="94"/>
</Position13>
<Position14>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="764" Column="1" TopLine="739"/>
</Position14>
<Position15>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="777" Column="36" TopLine="767"/>
</Position15>
<Position16>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="785" Column="10" TopLine="762"/>
</Position16>
<Position17>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="11" Column="33" TopLine="1"/>
</Position17>
<Position18>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="9" Column="8" TopLine="1"/>
</Position18>
<Position19>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="15" Column="3" TopLine="1"/>
</Position19>
<Position20>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="46" Column="1" TopLine="9"/>
</Position20>
<Position21>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="14" Column="6" TopLine="9"/>
</Position21>
<Position22>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="43" Column="36" TopLine="9"/>
</Position22>
<Position23>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="60" Column="8" TopLine="26"/>
</Position23> </Position23>
<Position24> <Position24>
<Filename Value="..\..\fpspreadsheet.pas"/> <Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="62" Column="4" TopLine="52"/> <Caret Line="344" Column="11" TopLine="335"/>
</Position24> </Position24>
<Position25> <Position25>
<Filename Value="..\..\fpspreadsheet.pas"/> <Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="66" Column="21" TopLine="53"/> <Caret Line="1" Column="1" TopLine="1"/>
</Position25> </Position25>
<Position26> <Position26>
<Filename Value="..\..\fpspreadsheet.pas"/> <Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="102" Column="20" TopLine="89"/> <Caret Line="338" Column="52" TopLine="319"/>
</Position26> </Position26>
<Position27> <Position27>
<Filename Value="..\..\fpspreadsheet.pas"/> <Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="105" Column="20" TopLine="94"/> <Caret Line="355" Column="5" TopLine="318"/>
</Position27> </Position27>
<Position28> <Position28>
<Filename Value="..\..\fpspreadsheet.pas"/> <Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="764" Column="1" TopLine="739"/> <Caret Line="101" Column="16" TopLine="93"/>
</Position28> </Position28>
<Position29> <Position29>
<Filename Value="..\..\fpspreadsheet.pas"/> <Filename Value="..\..\..\..\..\lazarus27\fpc\2.2.4\source\packages\fcl-base\src\avl_tree.pp"/>
<Caret Line="777" Column="36" TopLine="767"/> <Caret Line="58" Column="18" TopLine="38"/>
</Position29> </Position29>
<Position30> <Position30>
<Filename Value="..\..\fpspreadsheet.pas"/> <Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="785" Column="10" TopLine="762"/> <Caret Line="362" Column="5" TopLine="325"/>
</Position30> </Position30>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>

View File

@@ -99,6 +99,7 @@ type
TsWorksheet = class TsWorksheet = class
private private
FCells: TAvlTree; FCells: TAvlTree;
FCurrentNode: TAVLTreeNode; // For GetFirstCell and GetNextCell
procedure RemoveCallback(data, arg: pointer); procedure RemoveCallback(data, arg: pointer);
public public
Name: string; Name: string;
@@ -109,6 +110,8 @@ type
function FindCell(ARow, ACol: Cardinal): PCell; function FindCell(ARow, ACol: Cardinal): PCell;
function GetCell(ARow, ACol: Cardinal): PCell; function GetCell(ARow, ACol: Cardinal): PCell;
function GetCellCount: Cardinal; function GetCellCount: Cardinal;
function GetFirstCell(): PCell;
function GetNextCell(): PCell;
function GetLastColNumber: Cardinal; function GetLastColNumber: Cardinal;
function GetLastRowNumber: Cardinal; function GetLastRowNumber: Cardinal;
function ReadAsUTF8Text(ARow, ACol: Cardinal): ansistring; function ReadAsUTF8Text(ARow, ACol: Cardinal): ansistring;
@@ -294,7 +297,7 @@ begin
LCell.Row := ARow; LCell.Row := ARow;
LCell.Col := ACol; LCell.Col := ACol;
AVLNode := Cells.Find(@LCell); AVLNode := FCells.Find(@LCell);
if Assigned(AVLNode) then if Assigned(AVLNode) then
result := PCell(AVLNode.Data); result := PCell(AVLNode.Data);
end; end;
@@ -335,21 +338,65 @@ end;
{@@ {@@
Returns the number of cells in the worksheet with contents. Returns the number of cells in the worksheet with contents.
This routine is used together with GetCellByIndex to This routine is used together with GetFirstCell and GetNextCell
iterate througth all cells in a worksheet efficiently. to iterate througth all cells in a worksheet efficiently.
@return The number of cells with contents in the worksheet @return The number of cells with contents in the worksheet
@see TCell @see TCell
@see GetCellByIndex @see GetFirstCell
@see GetNextCell
} }
function TsWorksheet.GetCellCount: Cardinal; function TsWorksheet.GetCellCount: Cardinal;
begin begin
Result := Cells.Count; Result := FCells.Count;
end; end;
{@@ {@@
Returns the number of the last column with a cell with contents. Returns the first Cell.
Use together with GetCellCount and GetNextCell
to iterate througth all cells in a worksheet efficiently.
@return The first cell if any exists, nil otherwise
@see TCell
@see GetCellCount
@see GetNextCell
}
function TsWorksheet.GetFirstCell(): PCell;
begin
FCurrentNode := FCells.FindLowest();
if FCurrentNode <> nil then
Result := PCell(FCurrentNode.Data)
else Result := nil;
end;
{@@
Returns the next Cell.
Should always be used either after GetFirstCell or
after GetNextCell.
Use together with GetCellCount and GetFirstCell
to iterate througth all cells in a worksheet efficiently.
@return The first cell if any exists, nil otherwise
@see TCell
@see GetCellCount
@see GetFirstCell
}
function TsWorksheet.GetNextCell(): PCell;
begin
FCurrentNode := FCells.FindSuccessor(FCurrentNode);
if FCurrentNode <> nil then
Result := PCell(FCurrentNode.Data)
else Result := nil;
end;
{@@
Returns the 0-based number of the last column with a cell with contents.
If no cells have contents, zero will be returned, which is also a valid value. If no cells have contents, zero will be returned, which is also a valid value.
@@ -367,16 +414,16 @@ begin
// Traverse the tree from lowest to highest. // Traverse the tree from lowest to highest.
// Since tree primary sort order is on Row // Since tree primary sort order is on Row
// highest Col could exist anywhere. // highest Col could exist anywhere.
AVLNode := Cells.FindLowest; AVLNode := FCells.FindLowest;
While Assigned(AVLNode) do While Assigned(AVLNode) do
begin begin
Result := Math.Max(Result, PCell(AVLNode.Data)^.Col); Result := Math.Max(Result, PCell(AVLNode.Data)^.Col);
AVLNode := Cells.FindSuccessor(AVLNode); AVLNode := FCells.FindSuccessor(AVLNode);
end; end;
end; end;
{@@ {@@
Returns the number of the last row with a cell with contents. Returns the 0-based number of the last row with a cell with contents.
If no cells have contents, zero will be returned, which is also a valid value. If no cells have contents, zero will be returned, which is also a valid value.

View File

@@ -0,0 +1,212 @@
unit fpspreadsheetgrid;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Grids,
fpspreadsheet;
type
{ TsWorksheetGrid }
{ TsCustomWorksheetGrid }
TsCustomWorksheetGrid = class(TCustomStringGrid)
private
FDisplayFixedColRow: Boolean;
FWorksheet: TsWorksheet;
procedure SetDisplayFixedColRow(const AValue: Boolean);
{ Private declarations }
protected
{ Protected declarations }
public
{ methods }
constructor Create(AOwner: TComponent); override;
procedure LoadFromWorksheet(AWorksheet: TsWorksheet);
property DisplayFixedColRow: Boolean read FDisplayFixedColRow write SetDisplayFixedColRow;
end;
TsWorksheetGrid = class(TsCustomWorksheetGrid)
published
property Align;
property AlternateColor;
property Anchors;
property AutoAdvance;
property AutoEdit;
property AutoFillColumns;
//property BiDiMode;
property BorderSpacing;
property BorderStyle;
property Color;
property ColCount;
property Columns;
property Constraints;
property DefaultColWidth;
property DefaultDrawing;
property DefaultRowHeight;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property ExtendedSelect;
property FixedColor;
property Flat;
property Font;
property GridLineWidth;
property HeaderHotZones;
property HeaderPushZones;
property MouseWheelOption;
property Options;
//property ParentBiDiMode;
property ParentColor default false;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property RowCount;
property ScrollBars;
property ShowHint;
property TabOrder;
property TabStop;
property TitleFont;
property TitleImageList;
property TitleStyle;
property UseXORFeatures;
property Visible;
property VisibleColCount;
property VisibleRowCount;
property OnBeforeSelection;
property OnChangeBounds;
property OnClick;
property OnColRowDeleted;
property OnColRowExchanged;
property OnColRowInserted;
property OnColRowMoved;
property OnCompareCells;
property OnDragDrop;
property OnDragOver;
property OnDblClick;
property OnDrawCell;
property OnEditButtonClick;
property OnEditingDone;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetEditMask;
property OnGetEditText;
property OnHeaderClick;
property OnHeaderSized;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnPickListSelect;
property OnPrepareCanvas;
property OnResize;
property OnSelectEditor;
property OnSelection;
property OnSelectCell;
property OnSetEditText;
property OnShowHint;
property OnStartDock;
property OnStartDrag;
property OnTopLeftChanged;
property OnUTF8KeyPress;
property OnValidateEntry;
property OnContextPopup;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Additional',[TsWorksheetGrid]);
end;
{ TsCustomWorksheetGrid }
procedure TsCustomWorksheetGrid.SetDisplayFixedColRow(const AValue: Boolean);
var
x: Integer;
begin
if AValue = FDisplayFixedColRow then Exit;
FDisplayFixedColRow := AValue;
if AValue then
begin
for x := 1 to ColCount - 1 do
SetCells(x, 0, 'A');
for x := 1 to RowCount - 1 do
SetCells(0, x, IntToStr(x));
end;
end;
constructor TsCustomWorksheetGrid.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FDisplayFixedColRow := False;
FixedCols := 0;
FixedRows := 0;
end;
procedure TsCustomWorksheetGrid.LoadFromWorksheet(AWorksheet: TsWorksheet);
var
x, lRow, lCol: Integer;
lStr: string;
lCell: PCell;
begin
FWorksheet := AWorksheet;
{ First get the size of the table }
if FWorksheet.GetCellCount = 0 then
begin
ColCount := 0;
RowCount := 0;
end
else
begin
if DisplayFixedColRow then
begin
ColCount := FWorksheet.GetLastColNumber() + 2;
RowCount := FWorksheet.GetLastRowNumber() + 2;
end
else
begin
ColCount := FWorksheet.GetLastColNumber() + 1;
RowCount := FWorksheet.GetLastRowNumber() + 1;
end;
end;
{ Now copy the contents }
lCell := FWorksheet.GetFirstCell();
for x := 0 to FWorksheet.GetCellCount() - 1 do
begin
lCol := lCell^.Col;
lRow := lCell^.Row;
lStr := lCell^.UTF8StringValue;
if DisplayFixedColRow then
SetCells(lCol + 1, lRow + 1, lStr)
else
SetCells(lCol, lRow, lStr);
lCell := FWorksheet.GetNextCell();
end;
end;
end.

View File

@@ -0,0 +1,44 @@
<?xml version="1.0"?>
<CONFIG>
<Package Version="3">
<PathDelim Value="\"/>
<Name Value="laz_fpspreadsheet_visual"/>
<CompilerOptions>
<Version Value="8"/>
<PathDelim Value="\"/>
<SearchPaths>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)\"/>
</SearchPaths>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Files Count="1">
<Item1>
<Filename Value="fpspreadsheetgrid.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="FPSpreadsheetGrid"/>
</Item1>
</Files>
<Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="3">
<Item1>
<PackageName Value="laz_fpspreadsheet"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
<Item3>
<PackageName Value="FCL"/>
<MinVersion Major="1" Valid="True"/>
</Item3>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)"/>
</UsageOptions>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
</PublishOptions>
</Package>
</CONFIG>

View File

@@ -0,0 +1,21 @@
{ This file was automatically created by Lazarus. do not edit!
This source is only used to compile and install the package.
}
unit laz_fpspreadsheet_visual;
interface
uses
fpspreadsheetgrid, LazarusPackageIntf;
implementation
procedure Register;
begin
RegisterUnit('fpspreadsheetgrid', @fpspreadsheetgrid.Register);
end;
initialization
RegisterPackage('laz_fpspreadsheet_visual', @Register);
end.