KSpread::StyleCluster Class Reference
The StyleCluster class is an owner of a Quad tree made up of StyleClusterQuad's. More...
#include <stylecluster.h>
Inheritance diagram for KSpread::StyleCluster:


Public Member Functions | |
StyleCluster (KSpreadSheet *sheet) | |
void | setStyle (int x, int y, KSpreadStyle *style) |
void | setStyle (const KSpreadRange &range, KSpreadStyle *style) |
const KSpreadStyle & | lookup (int x, int y) |
Protected Member Functions | |
void | simplify (QValueStack< StyleClusterQuad ** > &path) |
StyleClusterQuad * | lookupNode (int x, int y) |
void | stepDownOne (StyleClusterQuad **¤t_node, int x, int &x_offset, int y, int &y_offset, int &quad_size) |
Protected Attributes | |
StyleClusterQuad * | m_topQuad |
KSpreadSheet * | m_sheet |
Friends | |
class | StyleClusterTester |
Detailed Description
The StyleCluster class is an owner of a Quad tree made up of StyleClusterQuad's.It contains various functions to search the quad tree and insert a new style for a cell at a given x,y.
Internally it always maintains the quad tree at a minimum size possible. Note that inserting ( setStyle ) can be fairly expensive, creating and deleting up to 8 objects in total. So use the (yet to be written) insert range functions to change large amounts of styles at a time.
Note that the style returned here is not necessarily the final style for the cell, because the whole column and whole row may have a style that need to be applied first. Any settings in those styles override the settings here.
See the StyleClusterQuad class for more implementation details.
Testing ======= If you make any changes to the code, make sure to run the test suite. To do this, run kspread and make a new empty document. Then press ctrl+shift+T and chose "cell style test". Run that, and check that all the tests pass.
If you add functionality, make sure to add new tests to the StyleclusterTest class
Manager ======= To be done - write a manager for this class for easier mass insertion.
- See also:
- StyleClusterQuad
StyleClusterTester
- Author:
- John Tapsell
Raphael Langerhorst
Definition at line 75 of file stylecluster.h.
Member Function Documentation
|
An internally used function. Takes a list of quads, each one being a child of the one underneath it, with the last one being a pointer to m_topQuad. Then it goes up this list and checks whether it can be simplified, and does so if it's possible.
Definition at line 300 of file stylecluster.cc. Referenced by setStyle(). |
|
Return the quad being used at x,y.
Definition at line 392 of file stylecluster.cc. References stepDownOne(). Referenced by lookup(). |
|
Steps down one quad. The returned current_node will be a child of taken current_node. Modifies current_node, x_offset and y_offset variables. Definition at line 368 of file stylecluster.cc. Referenced by lookupNode(), and setStyle(). |
|
Example usage: A cell should be changed to bold. First, the current style is looked up with lookup(), then a new KSpreadStyle is created based on the returned style and set to bold. Then the style should be checked against existing styles (use existing one and delete your created one). Now use your style to insert it into x,y.
Definition at line 231 of file stylecluster.cc. References simplify(), and stepDownOne(). |
|
Practically same usage as above, but use a range to apply the style.
Definition at line 188 of file stylecluster.cc. References stepDownOne(). |
|
If you intend to modify this returned style, create a new one based on the returned style.
Definition at line 364 of file stylecluster.cc. References lookupNode(). |
The documentation for this class was generated from the following files: