File indexing completed on 2024-05-19 16:08:14
0001 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 0002 <html> 0003 <head> 0004 <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> 0005 <title>Calligra Sheets Development Notes</title> 0006 </head> 0007 0008 <body> 0009 0010 <h1>Calligra Sheets Development Notes</h1> 0011 0012 <p>Maintainer: Ariya Hidayat (<a href="mailto:ariya@kde.org">ariya@kde.org</a>)</p> 0013 <p>Some portions by Tomas Mecir (<a href="mailto: mecirt@gmail.com">mecirt@gmail.com</a>)</p> 0014 <p>Revision: September 2004.</p> 0015 0016 <h2>Introduction</h2> 0017 0018 <p>This document contains information about internal structure of Calligra Sheets 0019 as well as some notes of upcoming redesign. The sources for this document 0020 are mainly the discussions which take place in calligra-devel mailing-list 0021 and the source code itself.</p> 0022 0023 <h2>Manipulators</h2> 0024 <p>Status: OUTDATED.</p> 0025 0026 <p>Currently, every operation on a cell or on a range of cells is quite complex. 0027 You need to ensure correct repainting, recalculation, iterate on a range and so on.</p> 0028 0029 <p>To address this issue, manipulators shall be implemented. A manipulator will 0030 implement one operation (formatting change, sequence fill, ..., ...).</p> 0031 0032 <p>Basically, usage of a manipulator should look like this:</p> 0033 0034 <p><pre> 0035 Manipulator *manip = manipulatorManager::self()->getManip ("seqfill"); 0036 manip->setArgument ("type", 1); 0037 ... (more setArgument's) 0038 manip->exec (selection); 0039 </pre></p> 0040 0041 <p>That's all...</p> 0042 0043 <p>What concerns manipulator implementation, you'll derive from the base 0044 manipulator and reimplement constructor and methods initialize() 0045 (called just before the operation starts), processCell(), and maybe 0046 done(). The constructor or initialize() would set some properties for 0047 the cell-walking algorithm, and then it won't care about it anymore. 0048 The base class will walk the range and call processCell() for each 0049 cell, possibly creating it if it doesn't exist (if the manipulator 0050 wants so).There will also be some methods that can be used to process 0051 the whole range or row/column at once, if the manipulator wants to do so 0052 (useful for, say, formatting manipulators that will be able to set attributes 0053 of a whole range or row/col, in accordance with thoughts about format storage 0054 below.</p> 0055 0056 <p>In addition, the manipulator can implement the undo/redo functionality 0057 - the base manipulator will provide some common stuff needed to 0058 accomplish this.</p> 0059 0060 <h2>Selection handling</h2> 0061 <p>Status: OUTDATED.</p> 0062 0063 <p>The selection shall be an instance of some RangeList class, 0064 or however we want to call it - this will contain a list of 0065 cells/ranges/rows/whatever - like current selection, but will contain 0066 more entries. This will allow easy implementation of CTRL-selections and so, 0067 because thanks to manipulators, each operation will automatically support these.</p> 0068 0069 <h2>Repaint Triggering</h2> 0070 <p>Status: OUTDATED.</p> 0071 0072 <p>As mentioned above, the interface between the core and the GUI needs to be kept 0073 at minimum. Also, the number of repaints needs to be as low as possible, and repaints 0074 should be groupped whenever possible. To achieve all this, the following approach 0075 can be used:</p> 0076 0077 <p>When a cell is changed, it calls some method in KSpread::Sheet - valueChanged() 0078 or formattingChanged(). These methods then trigger everything necessary, like 0079 a call to the painting routine or dependency calculation.</p> 0080 0081 <p>This simple system would work on itself, but it would be slow. If you do 0082 a sequence fill on A1:A1000 and you have a SUM(A1:A1000) somewhere, why would 0083 you want to compute that SUM 1000 times, when you can simply compute it after 0084 the sequence fill has been finished? Hence, the sheet will offer some more 0085 methods - disableUpdates(), enableUpdates(), rangeListChanged() and 0086 rangeListFormattingChanged(). All these will be used (solely?) by manipulators, 0087 preferably by the base manipulator class, so that we don't have to call these 0088 functions in each operation. After a call to disableUpdates(), there will 0089 be no repainting and no dependency calculation. Note that a call to 0090 enableUpdates() won't cause any repaints either, as the sheet cannot remember 0091 all the calls (due to loss of range information). Hence, the base manipulator 0092 class needs to call the correct rangeList*Changed method to trigger an 0093 update in an effective way. The base manipulator needs to be configurable by 0094 the manipulators that derive from it, so that it knows whether it changed 0095 cell's content or formatting.</p> 0096 0097 <h2>Value</h2> 0098 0099 <p>Status: FINISHED.<br> 0100 </p> 0101 0102 <p>to be written.</p> 0103 0104 <h2>Commands Based on KCommand<br> 0105 </h2> 0106 0107 <p>Status: OUTDATED.</p> 0108 0109 <p>Until lately, to implement undo and redo, Calligra Sheets creates corresponding 0110 KSpreadUndo classes for each action and runs them when the user undoes 0111 those actions. KSpreadUndo also has redo function whose job is to redo 0112 again the action after being undone.</p> 0113 0114 <p>All this needs to be converted to manipulators - these will be KCommand, 0115 hence we should be able to undo/redo every operation (provided that the 0116 corresponding manipulator provides methods to store/recall the undo information).</p> 0117 0118 <h2>Cell Storage</h2> 0119 <p>Status: FINISHED.</p> 0120 0121 <p>to be written.</p> 0122 0123 </body></html>