fpspreadsheet: Call a font dialog in the fpsgrid demo to interactively change the font of a cell.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3022 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2014-05-08 12:12:06 +00:00
parent 27e00db9c0
commit 8656e66511
6 changed files with 916 additions and 679 deletions

View File

@ -33,7 +33,6 @@
<CodeGeneration> <CodeGeneration>
<Checks> <Checks>
<IOChecks Value="True"/> <IOChecks Value="True"/>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/> <OverflowChecks Value="True"/>
<StackChecks Value="True"/> <StackChecks Value="True"/>
</Checks> </Checks>
@ -108,7 +107,7 @@
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
</Item2> </Item2>
</RequiredPackages> </RequiredPackages>
<Units Count="36"> <Units Count="45">
<Unit0> <Unit0>
<Filename Value="fpsgrid.lpr"/> <Filename Value="fpsgrid.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
@ -117,7 +116,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<CursorPos X="10" Y="7"/> <CursorPos X="10" Y="7"/>
<UsageCount Value="148"/> <UsageCount Value="155"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
@ -129,11 +128,11 @@
<UnitName Value="mainform"/> <UnitName Value="mainform"/>
<EditorIndex Value="1"/> <EditorIndex Value="1"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="73"/> <TopLine Value="123"/>
<CursorPos X="15" Y="76"/> <CursorPos X="57" Y="129"/>
<UsageCount Value="148"/> <UsageCount Value="155"/>
<Bookmarks Count="1"> <Bookmarks Count="1">
<Item0 X="17" Y="325" ID="1"/> <Item0 X="17" Y="347" ID="1"/>
</Bookmarks> </Bookmarks>
<Loaded Value="True"/> <Loaded Value="True"/>
<LoadedDesigner Value="True"/> <LoadedDesigner Value="True"/>
@ -141,22 +140,22 @@
<Unit2> <Unit2>
<Filename Value="..\..\fpspreadsheet.pas"/> <Filename Value="..\..\fpspreadsheet.pas"/>
<UnitName Value="fpspreadsheet"/> <UnitName Value="fpspreadsheet"/>
<EditorIndex Value="4"/> <IsVisibleTab Value="True"/>
<EditorIndex Value="8"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="201"/> <TopLine Value="136"/>
<CursorPos X="3" Y="218"/> <CursorPos X="38" Y="161"/>
<UsageCount Value="70"/> <UsageCount Value="73"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit2> </Unit2>
<Unit3> <Unit3>
<Filename Value="..\..\fpspreadsheetgrid.pas"/> <Filename Value="..\..\fpspreadsheetgrid.pas"/>
<UnitName Value="fpspreadsheetgrid"/> <UnitName Value="fpspreadsheetgrid"/>
<IsVisibleTab Value="True"/> <EditorIndex Value="7"/>
<EditorIndex Value="3"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="413"/> <TopLine Value="753"/>
<CursorPos X="38" Y="422"/> <CursorPos X="29" Y="796"/>
<UsageCount Value="71"/> <UsageCount Value="74"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit3> </Unit3>
<Unit4> <Unit4>
@ -165,7 +164,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="25"/> <TopLine Value="25"/>
<CursorPos X="4" Y="44"/> <CursorPos X="4" Y="44"/>
<UsageCount Value="1"/> <UsageCount Value="10"/>
</Unit4> </Unit4>
<Unit5> <Unit5>
<Filename Value="c:\lazarus27\fpc\2.2.4\source\packages\winunits-base\src\activex.pp"/> <Filename Value="c:\lazarus27\fpc\2.2.4\source\packages\winunits-base\src\activex.pp"/>
@ -173,7 +172,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="49"/> <TopLine Value="49"/>
<CursorPos X="10" Y="24"/> <CursorPos X="10" Y="24"/>
<UsageCount Value="1"/> <UsageCount Value="10"/>
</Unit5> </Unit5>
<Unit6> <Unit6>
<Filename Value="c:\lazarus27\fpc\2.2.4\source\packages\fcl-base\src\avl_tree.pp"/> <Filename Value="c:\lazarus27\fpc\2.2.4\source\packages\fcl-base\src\avl_tree.pp"/>
@ -181,7 +180,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="37"/> <TopLine Value="37"/>
<CursorPos X="14" Y="83"/> <CursorPos X="14" Y="83"/>
<UsageCount Value="1"/> <UsageCount Value="10"/>
</Unit6> </Unit6>
<Unit7> <Unit7>
<Filename Value="c:\Lazarus\lcl\grids.pas"/> <Filename Value="c:\Lazarus\lcl\grids.pas"/>
@ -189,14 +188,14 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1516"/> <TopLine Value="1516"/>
<CursorPos X="28" Y="1534"/> <CursorPos X="28" Y="1534"/>
<UsageCount Value="1"/> <UsageCount Value="10"/>
</Unit7> </Unit7>
<Unit8> <Unit8>
<Filename Value="c:\Lazarus\lcl\include\customform.inc"/> <Filename Value="c:\Lazarus\lcl\include\customform.inc"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="2021"/> <TopLine Value="2021"/>
<CursorPos X="1" Y="2041"/> <CursorPos X="1" Y="2041"/>
<UsageCount Value="1"/> <UsageCount Value="10"/>
</Unit8> </Unit8>
<Unit9> <Unit9>
<Filename Value="..\..\fpsallformats.pas"/> <Filename Value="..\..\fpsallformats.pas"/>
@ -204,7 +203,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<CursorPos X="62" Y="13"/> <CursorPos X="62" Y="13"/>
<UsageCount Value="11"/> <UsageCount Value="10"/>
</Unit9> </Unit9>
<Unit10> <Unit10>
<Filename Value="..\..\wikitable.pas"/> <Filename Value="..\..\wikitable.pas"/>
@ -212,7 +211,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="48"/> <TopLine Value="48"/>
<CursorPos X="41" Y="60"/> <CursorPos X="41" Y="60"/>
<UsageCount Value="17"/> <UsageCount Value="16"/>
</Unit10> </Unit10>
<Unit11> <Unit11>
<Filename Value="..\..\fpsopendocument.pas"/> <Filename Value="..\..\fpsopendocument.pas"/>
@ -220,7 +219,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<UsageCount Value="13"/> <UsageCount Value="12"/>
</Unit11> </Unit11>
<Unit12> <Unit12>
<Filename Value="d:\lazarus-svn\lcl\grids.pas"/> <Filename Value="d:\lazarus-svn\lcl\grids.pas"/>
@ -228,16 +227,16 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="3429"/> <TopLine Value="3429"/>
<CursorPos X="1" Y="3434"/> <CursorPos X="1" Y="3434"/>
<UsageCount Value="33"/> <UsageCount Value="32"/>
</Unit12> </Unit12>
<Unit13> <Unit13>
<Filename Value="..\..\fpsutils.pas"/> <Filename Value="..\..\fpsutils.pas"/>
<UnitName Value="fpsutils"/> <UnitName Value="fpsutils"/>
<EditorIndex Value="2"/> <EditorIndex Value="6"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="35"/> <TopLine Value="35"/>
<CursorPos X="1" Y="62"/> <CursorPos X="1" Y="62"/>
<UsageCount Value="46"/> <UsageCount Value="49"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit13> </Unit13>
<Unit14> <Unit14>
@ -245,7 +244,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1212"/> <TopLine Value="1212"/>
<CursorPos X="3" Y="1218"/> <CursorPos X="3" Y="1218"/>
<UsageCount Value="9"/> <UsageCount Value="8"/>
</Unit14> </Unit14>
<Unit15> <Unit15>
<Filename Value="d:\lazarus-svn\lcl\graphics.pp"/> <Filename Value="d:\lazarus-svn\lcl\graphics.pp"/>
@ -253,23 +252,23 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="649"/> <TopLine Value="649"/>
<CursorPos X="28" Y="675"/> <CursorPos X="28" Y="675"/>
<UsageCount Value="32"/> <UsageCount Value="31"/>
</Unit15> </Unit15>
<Unit16> <Unit16>
<Filename Value="d:\lazarus-svn\fpc\2.6.2\source\rtl\objpas\classes\classesh.inc"/> <Filename Value="d:\lazarus-svn\fpc\2.6.2\source\rtl\objpas\classes\classesh.inc"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="248"/> <TopLine Value="248"/>
<CursorPos X="22" Y="263"/> <CursorPos X="22" Y="263"/>
<UsageCount Value="17"/> <UsageCount Value="16"/>
</Unit16> </Unit16>
<Unit17> <Unit17>
<Filename Value="..\..\xlsbiff8.pas"/> <Filename Value="..\..\xlsbiff8.pas"/>
<UnitName Value="xlsbiff8"/> <UnitName Value="xlsbiff8"/>
<EditorIndex Value="6"/> <EditorIndex Value="10"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1881"/> <TopLine Value="1881"/>
<CursorPos X="24" Y="1898"/> <CursorPos X="24" Y="1898"/>
<UsageCount Value="45"/> <UsageCount Value="48"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit17> </Unit17>
<Unit18> <Unit18>
@ -278,43 +277,43 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1091"/> <TopLine Value="1091"/>
<CursorPos X="12" Y="1122"/> <CursorPos X="12" Y="1122"/>
<UsageCount Value="13"/> <UsageCount Value="12"/>
</Unit18> </Unit18>
<Unit19> <Unit19>
<Filename Value="d:\lazarus-svn\lcl\include\wincontrol.inc"/> <Filename Value="d:\lazarus-svn\lcl\include\wincontrol.inc"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="7344"/> <TopLine Value="7344"/>
<CursorPos X="30" Y="7349"/> <CursorPos X="30" Y="7349"/>
<UsageCount Value="11"/> <UsageCount Value="10"/>
</Unit19> </Unit19>
<Unit20> <Unit20>
<Filename Value="..\..\xlscommon.pas"/> <Filename Value="..\..\xlscommon.pas"/>
<UnitName Value="xlscommon"/> <UnitName Value="xlscommon"/>
<EditorIndex Value="5"/> <EditorIndex Value="9"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1530"/> <TopLine Value="1530"/>
<CursorPos X="47" Y="1554"/> <CursorPos X="47" Y="1554"/>
<UsageCount Value="41"/> <UsageCount Value="44"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit20> </Unit20>
<Unit21> <Unit21>
<Filename Value="..\..\xlsbiff5.pas"/> <Filename Value="..\..\xlsbiff5.pas"/>
<UnitName Value="xlsbiff5"/> <UnitName Value="xlsbiff5"/>
<EditorIndex Value="7"/> <EditorIndex Value="11"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1319"/> <TopLine Value="1319"/>
<CursorPos X="3" Y="1325"/> <CursorPos X="3" Y="1325"/>
<UsageCount Value="28"/> <UsageCount Value="31"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit21> </Unit21>
<Unit22> <Unit22>
<Filename Value="..\..\xlsbiff2.pas"/> <Filename Value="..\..\xlsbiff2.pas"/>
<UnitName Value="xlsbiff2"/> <UnitName Value="xlsbiff2"/>
<EditorIndex Value="8"/> <EditorIndex Value="12"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="547"/> <TopLine Value="547"/>
<CursorPos X="1" Y="563"/> <CursorPos X="1" Y="563"/>
<UsageCount Value="29"/> <UsageCount Value="32"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit22> </Unit22>
<Unit23> <Unit23>
@ -323,7 +322,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="841"/> <TopLine Value="841"/>
<CursorPos X="19" Y="852"/> <CursorPos X="19" Y="852"/>
<UsageCount Value="6"/> <UsageCount Value="5"/>
</Unit23> </Unit23>
<Unit24> <Unit24>
<Filename Value="d:\lazarus-svn\fpc\2.6.2\source\packages\fcl-image\src\fpcanvas.pp"/> <Filename Value="d:\lazarus-svn\fpc\2.6.2\source\packages\fcl-image\src\fpcanvas.pp"/>
@ -331,7 +330,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="111"/> <TopLine Value="111"/>
<CursorPos X="3" Y="112"/> <CursorPos X="3" Y="112"/>
<UsageCount Value="19"/> <UsageCount Value="18"/>
</Unit24> </Unit24>
<Unit25> <Unit25>
<Filename Value="d:\lazarus-svn\fpc\2.6.2\source\packages\fcl-image\src\fpimage.pp"/> <Filename Value="d:\lazarus-svn\fpc\2.6.2\source\packages\fcl-image\src\fpimage.pp"/>
@ -339,14 +338,14 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="74"/> <TopLine Value="74"/>
<CursorPos X="3" Y="93"/> <CursorPos X="3" Y="93"/>
<UsageCount Value="7"/> <UsageCount Value="6"/>
</Unit25> </Unit25>
<Unit26> <Unit26>
<Filename Value="d:\lazarus-svn\fpc\2.6.2\source\rtl\objpas\classes\lists.inc"/> <Filename Value="d:\lazarus-svn\fpc\2.6.2\source\rtl\objpas\classes\lists.inc"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="141"/> <TopLine Value="141"/>
<CursorPos X="3" Y="143"/> <CursorPos X="3" Y="143"/>
<UsageCount Value="15"/> <UsageCount Value="14"/>
</Unit26> </Unit26>
<Unit27> <Unit27>
<Filename Value="d:\Prog_Delphi\common\units\XLS.pas"/> <Filename Value="d:\Prog_Delphi\common\units\XLS.pas"/>
@ -354,14 +353,14 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="114"/> <TopLine Value="114"/>
<CursorPos X="42" Y="152"/> <CursorPos X="42" Y="152"/>
<UsageCount Value="15"/> <UsageCount Value="14"/>
</Unit27> </Unit27>
<Unit28> <Unit28>
<Filename Value="d:\lazarus-svn\lcl\include\pen.inc"/> <Filename Value="d:\lazarus-svn\lcl\include\pen.inc"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="272"/> <TopLine Value="272"/>
<CursorPos X="3" Y="286"/> <CursorPos X="3" Y="286"/>
<UsageCount Value="15"/> <UsageCount Value="14"/>
</Unit28> </Unit28>
<Unit29> <Unit29>
<Filename Value="d:\lazarus-svn\lcl\controls.pp"/> <Filename Value="d:\lazarus-svn\lcl\controls.pp"/>
@ -369,14 +368,14 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1480"/> <TopLine Value="1480"/>
<CursorPos X="15" Y="1498"/> <CursorPos X="15" Y="1498"/>
<UsageCount Value="14"/> <UsageCount Value="13"/>
</Unit29> </Unit29>
<Unit30> <Unit30>
<Filename Value="d:\lazarus-svn\lcl\include\control.inc"/> <Filename Value="d:\lazarus-svn\lcl\include\control.inc"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="4129"/> <TopLine Value="4129"/>
<CursorPos X="1" Y="4161"/> <CursorPos X="1" Y="4161"/>
<UsageCount Value="14"/> <UsageCount Value="13"/>
</Unit30> </Unit30>
<Unit31> <Unit31>
<Filename Value="..\..\fpspreadsheetchart.pas"/> <Filename Value="..\..\fpspreadsheetchart.pas"/>
@ -384,7 +383,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="170"/> <TopLine Value="170"/>
<CursorPos X="37" Y="204"/> <CursorPos X="37" Y="204"/>
<UsageCount Value="10"/> <UsageCount Value="9"/>
</Unit31> </Unit31>
<Unit32> <Unit32>
<Filename Value="d:\lazarus-svn\components\lazutils\lazutf8.pas"/> <Filename Value="d:\lazarus-svn\components\lazutils\lazutf8.pas"/>
@ -392,7 +391,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="3180"/> <TopLine Value="3180"/>
<CursorPos X="1" Y="3212"/> <CursorPos X="1" Y="3212"/>
<UsageCount Value="11"/> <UsageCount Value="10"/>
</Unit32> </Unit32>
<Unit33> <Unit33>
<Filename Value="d:\lazarus-svn\lcl\colorbox.pas"/> <Filename Value="d:\lazarus-svn\lcl\colorbox.pas"/>
@ -400,7 +399,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="13"/> <TopLine Value="13"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<UsageCount Value="11"/> <UsageCount Value="10"/>
</Unit33> </Unit33>
<Unit34> <Unit34>
<Filename Value="d:\lazarus-svn\lcl\dialogs.pp"/> <Filename Value="d:\lazarus-svn\lcl\dialogs.pp"/>
@ -408,7 +407,7 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="222"/> <TopLine Value="222"/>
<CursorPos X="3" Y="253"/> <CursorPos X="3" Y="253"/>
<UsageCount Value="11"/> <UsageCount Value="10"/>
</Unit34> </Unit34>
<Unit35> <Unit35>
<Filename Value="d:\lazarus-svn\lcl\forms.pp"/> <Filename Value="d:\lazarus-svn\lcl\forms.pp"/>
@ -416,129 +415,207 @@
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="932"/> <TopLine Value="932"/>
<CursorPos X="3" Y="939"/> <CursorPos X="3" Y="939"/>
<UsageCount Value="11"/> <UsageCount Value="10"/>
</Unit35> </Unit35>
<Unit36>
<Filename Value="C:\development\lazarus\lcl\graphics.pp"/>
<UnitName Value="Graphics"/>
<EditorIndex Value="4"/>
<WindowIndex Value="0"/>
<TopLine Value="2053"/>
<CursorPos X="30" Y="1945"/>
<UsageCount Value="13"/>
<Loaded Value="True"/>
</Unit36>
<Unit37>
<Filename Value="C:\development\fpc\packages\fcl-image\src\fpcanvas.pp"/>
<UnitName Value="FPCanvas"/>
<WindowIndex Value="0"/>
<TopLine Value="89"/>
<CursorPos X="15" Y="97"/>
<UsageCount Value="12"/>
</Unit37>
<Unit38>
<Filename Value="C:\development\fpc\packages\fcl-image\src\fpfont.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="54"/>
<CursorPos X="3" Y="57"/>
<UsageCount Value="12"/>
</Unit38>
<Unit39>
<Filename Value="C:\development\lazarus\lcl\graphmath.pp"/>
<UnitName Value="GraphMath"/>
<WindowIndex Value="0"/>
<TopLine Value="584"/>
<CursorPos X="3" Y="439"/>
<UsageCount Value="12"/>
</Unit39>
<Unit40>
<Filename Value="C:\development\lazarus\lcl\graphtype.pp"/>
<UnitName Value="GraphType"/>
<WindowIndex Value="0"/>
<TopLine Value="234"/>
<CursorPos X="3" Y="33"/>
<UsageCount Value="12"/>
</Unit40>
<Unit41>
<Filename Value="C:\development\lazarus\lcl\lcltype.pp"/>
<UnitName Value="LCLType"/>
<EditorIndex Value="5"/>
<WindowIndex Value="0"/>
<TopLine Value="1628"/>
<CursorPos X="3" Y="1643"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit41>
<Unit42>
<Filename Value="C:\development\lazarus\lcl\graphutil.pp"/>
<UnitName Value="GraphUtil"/>
<WindowIndex Value="0"/>
<TopLine Value="128"/>
<CursorPos X="12" Y="143"/>
<UsageCount Value="12"/>
</Unit42>
<Unit43>
<Filename Value="C:\development\fpc\rtl\objpas\math.pp"/>
<UnitName Value="math"/>
<EditorIndex Value="3"/>
<WindowIndex Value="0"/>
<TopLine Value="120"/>
<CursorPos X="10" Y="135"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit43>
<Unit44>
<Filename Value="C:\development\fpc\rtl\i386\i386.inc"/>
<EditorIndex Value="2"/>
<WindowIndex Value="0"/>
<TopLine Value="1499"/>
<CursorPos X="1" Y="1513"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit44>
</Units> </Units>
<JumpHistory Count="30" HistoryIndex="29"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="mainform.pas"/> <Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="201" Column="1" TopLine="172"/> <Caret Line="376" Column="20" TopLine="362"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="mainform.pas"/> <Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="202" Column="1" TopLine="172"/> <Caret Line="204" Column="53" TopLine="189"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="mainform.pas"/> <Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="209" Column="5" TopLine="173"/> <Caret Line="822" Column="53" TopLine="808"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="mainform.pas"/> <Filename Value="mainform.pas"/>
<Caret Line="193" Column="1" TopLine="173"/> <Caret Line="142" Column="77" TopLine="126"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="mainform.pas"/> <Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="194" Column="1" TopLine="173"/> <Caret Line="805" Column="1" TopLine="800"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="mainform.pas"/> <Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="195" Column="1" TopLine="173"/> <Caret Line="853" Column="49" TopLine="829"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="mainform.pas"/> <Filename Value="mainform.pas"/>
<Caret Line="196" Column="1" TopLine="173"/> <Caret Line="142" Column="77" TopLine="117"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="mainform.pas"/> <Filename Value="mainform.pas"/>
<Caret Line="197" Column="1" TopLine="173"/> <Caret Line="135" Column="1" TopLine="117"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="mainform.pas"/> <Filename Value="mainform.pas"/>
<Caret Line="199" Column="1" TopLine="173"/> <Caret Line="136" Column="1" TopLine="117"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="mainform.pas"/> <Filename Value="mainform.pas"/>
<Caret Line="202" Column="1" TopLine="173"/> <Caret Line="137" Column="1" TopLine="117"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="mainform.pas"/> <Filename Value="mainform.pas"/>
<Caret Line="204" Column="1" TopLine="173"/> <Caret Line="138" Column="1" TopLine="117"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="mainform.pas"/> <Filename Value="mainform.pas"/>
<Caret Line="207" Column="1" TopLine="175"/> <Caret Line="139" Column="1" TopLine="117"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="..\..\fpspreadsheetgrid.pas"/> <Filename Value="mainform.pas"/>
<Caret Line="547" Column="3" TopLine="524"/> <Caret Line="135" Column="1" TopLine="117"/>
</Position13> </Position13>
<Position14> <Position14>
<Filename Value="mainform.pas"/> <Filename Value="mainform.pas"/>
<Caret Line="187" Column="40" TopLine="177"/> <Caret Line="136" Column="1" TopLine="117"/>
</Position14> </Position14>
<Position15> <Position15>
<Filename Value="mainform.pas"/> <Filename Value="mainform.pas"/>
<Caret Line="188" Column="40" TopLine="178"/> <Caret Line="137" Column="1" TopLine="117"/>
</Position15> </Position15>
<Position16> <Position16>
<Filename Value="mainform.pas"/> <Filename Value="mainform.pas"/>
<Caret Line="189" Column="40" TopLine="179"/> <Caret Line="138" Column="1" TopLine="117"/>
</Position16> </Position16>
<Position17> <Position17>
<Filename Value="mainform.pas"/> <Filename Value="mainform.pas"/>
<Caret Line="190" Column="40" TopLine="180"/> <Caret Line="139" Column="1" TopLine="117"/>
</Position17> </Position17>
<Position18> <Position18>
<Filename Value="mainform.pas"/> <Filename Value="mainform.pas"/>
<Caret Line="197" Column="40" TopLine="187"/> <Caret Line="140" Column="1" TopLine="117"/>
</Position18> </Position18>
<Position19> <Position19>
<Filename Value="mainform.pas"/> <Filename Value="mainform.pas"/>
<Caret Line="141" Column="103" TopLine="121"/> <Caret Line="141" Column="1" TopLine="117"/>
</Position19> </Position19>
<Position20> <Position20>
<Filename Value="mainform.pas"/> <Filename Value="mainform.pas"/>
<Caret Line="332" Column="58" TopLine="305"/> <Caret Line="142" Column="1" TopLine="117"/>
</Position20> </Position20>
<Position21> <Position21>
<Filename Value="mainform.pas"/> <Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="333" Column="58" TopLine="306"/> <Caret Line="1458" Column="1" TopLine="1442"/>
</Position21> </Position21>
<Position22> <Position22>
<Filename Value="mainform.pas"/> <Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="334" Column="58" TopLine="307"/> <Caret Line="1459" Column="1" TopLine="1442"/>
</Position22> </Position22>
<Position23> <Position23>
<Filename Value="mainform.pas"/> <Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="335" Column="58" TopLine="308"/> <Caret Line="1460" Column="1" TopLine="1442"/>
</Position23> </Position23>
<Position24> <Position24>
<Filename Value="mainform.pas"/> <Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="336" Column="58" TopLine="309"/> <Caret Line="2162" Column="1" TopLine="2147"/>
</Position24> </Position24>
<Position25> <Position25>
<Filename Value="mainform.pas"/> <Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="337" Column="58" TopLine="310"/> <Caret Line="2163" Column="1" TopLine="2147"/>
</Position25> </Position25>
<Position26> <Position26>
<Filename Value="mainform.pas"/> <Filename Value="mainform.pas"/>
<Caret Line="149" Column="57" TopLine="134"/> <Caret Line="138" Column="1" TopLine="117"/>
</Position26> </Position26>
<Position27> <Position27>
<Filename Value="mainform.pas"/> <Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="151" Column="57" TopLine="137"/> <Caret Line="84" Column="51" TopLine="71"/>
</Position27> </Position27>
<Position28> <Position28>
<Filename Value="..\..\fpspreadsheetgrid.pas"/> <Filename Value="mainform.pas"/>
<Caret Line="388" Column="3" TopLine="412"/> <Caret Line="129" Column="57" TopLine="123"/>
</Position28> </Position28>
<Position29> <Position29>
<Filename Value="..\..\fpspreadsheetgrid.pas"/> <Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="429" Column="1" TopLine="413"/> <Caret Line="352" Column="73" TopLine="353"/>
</Position29> </Position29>
<Position30> <Position30>
<Filename Value="..\..\fpspreadsheetgrid.pas"/> <Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="430" Column="1" TopLine="413"/> <Caret Line="218" Column="17" TopLine="146"/>
</Position30> </Position30>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>

View File

@ -429,6 +429,9 @@ object Form1: TForm1
end end
object mnuFormat: TMenuItem object mnuFormat: TMenuItem
Caption = 'Format' Caption = 'Format'
object MenuItem6: TMenuItem
Action = AcFont
end
object MnuHorAlignment: TMenuItem object MnuHorAlignment: TMenuItem
Caption = 'Horizontal alignment' Caption = 'Horizontal alignment'
object MnuHorDefault: TMenuItem object MnuHorDefault: TMenuItem
@ -1002,5 +1005,17 @@ object Form1: TForm1
ImageIndex = 10 ImageIndex = 10
OnExecute = AcFontStyleExecute OnExecute = AcFontStyleExecute
end end
object AcFont: TAction
Category = 'Format'
Caption = 'Font...'
Hint = 'Font'
OnExecute = AcFontExecute
end
end
object FontDialog1: TFontDialog
MinFontSize = 0
MaxFontSize = 0
left = 176
top = 234
end end
end end

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@ interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Menus, ExtCtrls, ComCtrls, ActnList, Spin, ColorBox, StdCtrls, Menus, ExtCtrls, ComCtrls, ActnList, Spin, ColorBox,graphutil,
fpspreadsheetgrid, fpspreadsheet, fpsallformats; fpspreadsheetgrid, fpspreadsheet, fpsallformats;
type type
@ -26,11 +26,13 @@ type
AcFontItalic: TAction; AcFontItalic: TAction;
AcFontStrikeout: TAction; AcFontStrikeout: TAction;
AcFontUnderline: TAction; AcFontUnderline: TAction;
AcFont: TAction;
ActionList1: TActionList; ActionList1: TActionList;
CbShowHeaders: TCheckBox; CbShowHeaders: TCheckBox;
CbShowGridLines: TCheckBox; CbShowGridLines: TCheckBox;
FontComboBox: TComboBox; FontComboBox: TComboBox;
EdFrozenRows: TSpinEdit; EdFrozenRows: TSpinEdit;
FontDialog1: TFontDialog;
FontSizeComboBox: TComboBox; FontSizeComboBox: TComboBox;
ImageList1: TImageList; ImageList1: TImageList;
Label1: TLabel; Label1: TLabel;
@ -41,6 +43,7 @@ type
MenuItem3: TMenuItem; MenuItem3: TMenuItem;
MenuItem4: TMenuItem; MenuItem4: TMenuItem;
MenuItem5: TMenuItem; MenuItem5: TMenuItem;
MenuItem6: TMenuItem;
MnuHorDefault: TMenuItem; MnuHorDefault: TMenuItem;
MnuHorAlignment: TMenuItem; MnuHorAlignment: TMenuItem;
mnuFormat: TMenuItem; mnuFormat: TMenuItem;
@ -73,9 +76,9 @@ type
ToolButton8: TToolButton; ToolButton8: TToolButton;
ToolButton9: TToolButton; ToolButton9: TToolButton;
procedure AcEditExecute(Sender: TObject); procedure AcEditExecute(Sender: TObject);
procedure AcFontExecute(Sender: TObject);
procedure AcFontStyleExecute(Sender: TObject); procedure AcFontStyleExecute(Sender: TObject);
procedure AcHorAlignmentExecute(Sender: TObject); procedure AcHorAlignmentExecute(Sender: TObject);
procedure btnPopulateGridClick(Sender: TObject);
procedure CbShowHeadersClick(Sender: TObject); procedure CbShowHeadersClick(Sender: TObject);
procedure CbShowGridLinesClick(Sender: TObject); procedure CbShowGridLinesClick(Sender: TObject);
procedure acOpenExecute(Sender: TObject); procedure acOpenExecute(Sender: TObject);
@ -112,17 +115,6 @@ const
{ TForm1 } { TForm1 }
procedure TForm1.btnPopulateGridClick(Sender: TObject);
// Populate grid with some demo data
var
lCell: PCell;
begin
// create a cell (2,2) if not yet available
lCell := sWorksheetGrid1.Worksheet.GetCell(2, 2);
sWorksheetGrid1.Worksheet.WriteUTF8Text(2, 2, 'Algo');
sWorksheetGrid1.Invalidate;
end;
procedure TForm1.AcEditExecute(Sender: TObject); procedure TForm1.AcEditExecute(Sender: TObject);
begin begin
if AcEdit.Checked then if AcEdit.Checked then
@ -131,6 +123,36 @@ begin
sWorksheetGrid1.Options := sWorksheetGrid1.Options - [goEditing]; sWorksheetGrid1.Options := sWorksheetGrid1.Options - [goEditing];
end; end;
{ Changes the font of the selected cell by calling a standard font dialog.
Note that the worksheet's and grid's fonts are implemented differently.
In particular, the worksheet's font color is an index into the workbook's
palette while the grid's font color is an rgb value. }
procedure TForm1.AcFontExecute(Sender: TObject);
var
r,c: Cardinal;
f: Integer;
style: TsFontStyles;
lFont: TsFont;
begin
with sWorksheetGrid1 do begin
if Worksheet <> nil then begin
c := GetWorksheetCol(Col);
r := GetWorksheetRow(Row);
f := Worksheet.GetCell(r, c)^.FontIndex;
Convert_sFont_to_Font(Workbook.GetFont(f), FontDialog1.Font);
if FontDialog1.Execute then begin
lFont := TsFont.Create;
try
Convert_Font_to_sFont(FontDialog1.Font, lFont);
WorkSheet.WriteFont(r, c, lFont.FontName, lFont.Size, lFont.Style, lFont.Color);
finally
lFont.Free;
end;
end;
end;
end;
end;
procedure TForm1.AcFontStyleExecute(Sender: TObject); procedure TForm1.AcFontStyleExecute(Sender: TObject);
var var
style: TsFontstyles; style: TsFontstyles;

View File

@ -143,8 +143,9 @@ type
nfShortTimeAM, nfLongTimeAM, nfTimeInterval); nfShortTimeAM, nfLongTimeAM, nfTimeInterval);
{@@ Text rotation formatting. The text is rotated relative to the standard {@@ Text rotation formatting. The text is rotated relative to the standard
orientation, which is from left to right horizontal: ---> orientation, which is from left to right horizontal:
ABC --->
ABC
So 90 degrees clockwise means that the text will be: So 90 degrees clockwise means that the text will be:
| A | A
@ -156,6 +157,10 @@ type
^ C ^ C
| B | B
| A | A
Due to limitations of the text mode the characters are not rotated here.
There is, however, also a "stacked" variant which looks exactly like
the former case.
} }
TsTextRotation = (trHorizontal, rt90DegreeClockwiseRotation, TsTextRotation = (trHorizontal, rt90DegreeClockwiseRotation,
rt90DegreeCounterClockwiseRotation, rtStacked); rt90DegreeCounterClockwiseRotation, rtStacked);

View File

@ -78,6 +78,12 @@ type
procedure SaveToSpreadsheetFile(AFileName: string; AFormat: TsSpreadsheetFormat; procedure SaveToSpreadsheetFile(AFileName: string; AFormat: TsSpreadsheetFormat;
AOverwriteExisting: Boolean = true); overload; AOverwriteExisting: Boolean = true); overload;
procedure SelectSheetByIndex(AIndex: Integer); procedure SelectSheetByIndex(AIndex: Integer);
{ Utilities related to Workbooks }
procedure Convert_sFont_to_Font(sFont: TsFont; AFont: TFont);
procedure Convert_Font_to_sFont(AFont: TFont; sFont: TsFont);
function FindNearestPaletteIndex(AColor: TColor): TsColor;
{ public properties } { public properties }
property Worksheet: TsWorksheet read FWorksheet; property Worksheet: TsWorksheet read FWorksheet;
property Workbook: TsWorkbook read FWorkbook; property Workbook: TsWorkbook read FWorkbook;
@ -195,7 +201,7 @@ procedure Register;
implementation implementation
uses uses
Types, LCLType, LCLIntf, Math, fpCanvas, fpsUtils; Types, LCLType, LCLIntf, Math, fpCanvas, GraphUtil, fpsUtils;
var var
FillPattern_BIFF2: TBitmap = nil; FillPattern_BIFF2: TBitmap = nil;
@ -343,6 +349,36 @@ begin
if FLockCount = 0 then Invalidate; if FLockCount = 0 then Invalidate;
end; end;
{ Converts a spreadsheet font to a font used for painting (TCanvas.Font). }
procedure TsCustomWorksheetGrid.Convert_sFont_to_Font(sFont: TsFont; AFont: TFont);
begin
if Assigned(AFont) then begin
AFont.Name := sFont.FontName;
AFont.Size := round(sFont.Size);
AFont.Style := [];
if fssBold in sFont.Style then AFont.Style := AFont.Style + [fsBold];
if fssItalic in sFont.Style then AFont.Style := AFont.Style + [fsItalic];
if fssUnderline in sFont.Style then AFont.Style := AFont.Style + [fsUnderline];
if fssStrikeout in sFont.Style then AFont.Style := AFont.Style + [fsStrikeout];
AFont.Color := Workbook.GetPaletteColor(sFont.Color);
end;
end;
{ Converts a font used for painting (TCanvas.Font) to a spreadsheet font }
procedure TsCustomWorksheetGrid.Convert_Font_to_sFont(AFont: TFont; sFont: TsFont);
begin
if Assigned(AFont) and Assigned(sFont) then begin
sFont.FontName := AFont.Name;
sFont.Size := AFont.Size;
sFont.Style := [];
if fsBold in AFont.Style then Include(sFont.Style, fssBold);
if fsItalic in AFont.Style then Include(sFont.Style, fssItalic);
if fsUnderline in AFont.Style then Include(sFont.Style, fssUnderline);
if fsStrikeout in AFont.Style then Include(sFont.Style, fssStrikeout);
sFont.Color := FindNearestPaletteIndex(AFont.Color);
end;
end;
procedure TsCustomWorksheetGrid.DefaultDrawCell(aCol, aRow: Integer; var aRect: TRect; procedure TsCustomWorksheetGrid.DefaultDrawCell(aCol, aRow: Integer; var aRect: TRect;
AState: TGridDrawState); AState: TGridDrawState);
var var
@ -764,6 +800,83 @@ begin
if FLockCount = 0 then Invalidate; if FLockCount = 0 then Invalidate;
end; end;
{ The "colors" used by the spreadsheet are indexes into the workbook's color
palette. If the user wants to set a color to a particular rgb value this is
not possible in general. The method FindNearestPaletteIndex finds the bast
matching color in the palette. }
function TsCustomWorksheetGrid.FindNearestPaletteIndex(AColor: TColor): TsColor;
procedure ColorToHSL(RGB: TColor; var H, S, L : double);
// Taken from https://code.google.com/p/thtmlviewer/source/browse/trunk/source/HSLUtils.pas?r=277
// The procedure in GraphUtils is crashing for clFuchsia.
var
R, G, B, D, Cmax, Cmin: double;
begin
R := GetRValue(RGB) / 255;
G := GetGValue(RGB) / 255;
B := GetBValue(RGB) / 255;
Cmax := Max(R, Max(G, B));
Cmin := Min(R, Min(G, B));
// calculate luminosity
L := (Cmax + Cmin) / 2;
if Cmax = Cmin then begin // it's grey
H := 0; // it's actually undefined
S := 0
end else begin
D := Cmax - Cmin;
// calculate Saturation
if L < 0.5 then
S := D / (Cmax + Cmin)
else
S := D / (2 - Cmax - Cmin);
// calculate Hue
if R = Cmax then
H := (G - B) / D
else
if G = Cmax then
H := 2 + (B - R) /D
else
H := 4 + (R - G) / D;
H := H / 6;
if H < 0 then
H := H + 1
end
end;
function ColorDistance(color1, color2: TColor): Double;
type
TRGBA = packed record R,G,B,A: Byte end;
var
H1,S1,L1, H2,S2,L2: Double;
begin
ColorToHSL(color1, H1, S1, L1);
ColorToHSL(color2, H2, S2, L2);
Result := sqr(H1-H2) + sqr(S1-S2) + sqr(L1-L2);
end;
var
i: Integer;
dist, mindist: Double;
begin
Result := 0;
if Workbook <> nil then begin
mindist := 1E308;
for i:=0 to Workbook.GetPaletteSize-1 do begin
dist := ColorDistance(AColor, TColor(Workbook.GetPaletteColor(i)));
if dist < mindist then begin
mindist := dist;
Result := i;
end;
end;
end;
end;
{ Returns the height (in pixels) of the cell at ACol/ARow. } { Returns the height (in pixels) of the cell at ACol/ARow. }
function TsCustomWorksheetGrid.GetCellHeight(ACol, ARow: Integer): Integer; function TsCustomWorksheetGrid.GetCellHeight(ACol, ARow: Integer): Integer;
var var
@ -1058,6 +1171,7 @@ begin
LoadFromWorksheet(FWorkbook.GetWorksheetByIndex(AIndex)); LoadFromWorksheet(FWorkbook.GetWorksheetByIndex(AIndex));
end; end;
initialization initialization
finalization finalization