kword
KWTableFrameSet Class Reference
#include <KWTableFrameSet.h>
Inheritance diagram for KWTableFrameSet:

Detailed Description
This class implements tables by acting as the manager for the frame(set)s which make up the table cells.We have a cell structure which contains one frameset, because of the nature of the table this frameset will always hold exactly one frame. Therefore the terms cell, frameSet and frame can be used to describe the same thing: one table-cell
Definition at line 58 of file KWTableFrameSet.h.
Public Types | |
enum | VisitType { VISIT_GRID = 1, VISIT_CELL = 2, CHECKED = 3 } |
enum | CellSize { TblAuto = 0, TblManual } |
typedef TableIterator< VISIT_CELL > | TableIter |
typedef TableIterator< VISIT_GRID > | GridIter |
typedef TableIterator< CHECKED > | CheckedIter |
Public Member Functions | |
virtual FrameSetType | type () const |
virtual KWordFrameSetIface * | dcopObject () |
virtual void | addTextFrameSets (QPtrList< KWTextFrameSet > &lst, bool onlyReadWrite=false) |
KWTableFrameSet (KWDocument *_doc, const QString &name) | |
virtual | ~KWTableFrameSet () |
virtual KWFrameSetEdit * | createFrameSetEdit (KWCanvas *canvas) |
virtual void | createEmptyRegion (const QRect &crect, QRegion &emptyRegion, KWViewMode *viewMode) |
void | drawBorders (QPainter &painter, const QRect &crect, KWViewMode *viewMode) |
virtual void | drawContents (QPainter *painter, const QRect &crect, const QColorGroup &cg, bool onlyChanged, bool resetChanged, KWFrameSetEdit *edit, KWViewMode *viewMode, KWFrameViewManager *frameViewManager) |
virtual void | drawFrame (KWFrame *, QPainter *, const QRect &, const QRect &, const QPoint &, KWFrame *, const QColorGroup &, bool, bool, KWFrameSetEdit *, KWViewMode *, bool) |
Cell * | cell (unsigned int row, unsigned int column) const |
Cell * | cellByPos (double x, double y) const |
KoRect | boundingRect () |
void | setBoundingRect (KoRect rect, CellSize widthMode, CellSize heightMode) |
double | topWithoutBorder () |
double | leftWithoutBorder () |
void | resizeWidth (double width) |
void | recalcCols (uint column, uint row) |
void | recalcRows (uint column, uint row) |
void | resizeColumn (unsigned int col, double x) |
void | resizeRow (unsigned int row, double y) |
double | columnSize (unsigned int col) |
double | rowSize (unsigned int col) |
int | columnEdgeAt (double x) const |
int | rowEdgeAt (double y) const |
unsigned int | getRows () const |
unsigned int | getColumns () const |
unsigned int | getNumCells () const |
void | moveBy (double dx, double dy) |
void | insertNewRow (uint _idx, bool _recalc=true, bool _removeable=false) |
void | insertNewColumn (uint _idx, double width=KWTableFrameSet::m_sDefaultColWidth) |
void | deleteRow (uint _idx, RemovedRow &rr, bool _recalc=true) |
void | deleteColumn (uint _idx, RemovedColumn &rc) |
void | reInsertRow (RemovedRow &row) |
void | reInsertColumn (RemovedColumn &col) |
void | ungroup () |
void | group () |
bool | isActive () const |
KCommand * | joinCells (unsigned int firstColumn, unsigned int firstRow, unsigned int endColumn, unsigned int endRow) |
KCommand * | splitCell (unsigned int intoRows, unsigned int intoColumns, unsigned int column, unsigned int row, QPtrList< KWFrameSet > listFrameSet=QPtrList< KWFrameSet >(), QPtrList< KWFrame >listFrame=QPtrList< KWFrame >()) |
void | viewFormatting (QPainter &painter, int zoom) |
void | validate () |
virtual QDomElement | save (QDomElement &parentElem, bool saveFrames=true) |
virtual void | saveOasis (KoXmlWriter &, KoSavingContext &, bool saveFrames) const |
void | loadOasis (const QDomElement &tag, KoOasisContext &context) |
virtual bool | canBeSavedAsInlineCharacter () const |
Cell * | loadCell (QDomElement &frameElem, bool loadFrames=true, bool useNames=true) |
virtual QDomElement | toXML (QDomElement &parentElem, bool saveFrames=true) |
virtual void | fromXML (QDomElement &framesetElem, bool loadFrames=true, bool useNames=true) |
virtual int | paragraphs () |
virtual int | paragraphsSelected () |
virtual bool | statistics (QProgressDialog *progress, ulong &charsWithSpace, ulong &charsWithoutSpace, ulong &words, ulong &sentences, ulong &syllables, ulong &lines, bool selected) |
virtual void | finalize () |
virtual void | invalidate () |
virtual void | layout () |
virtual void | updateFrames (int flags=0xff) |
virtual void | moveFloatingFrame (int frameNum, const KoPoint &position) |
virtual KoSize | floatingFrameSize (int frameNum=0) |
virtual KCommand * | anchoredObjectCreateCommand (int frameNum) |
virtual KCommand * | anchoredObjectDeleteCommand (int frameNum) |
virtual KWAnchor * | createAnchor (KoTextDocument *txt, int frameNum) |
virtual void | setVisible (bool v) |
virtual bool | canRemovePage (int num) |
void | addCell (Cell *cell) |
void | removeCell (Cell *cell) |
virtual void | setProtectContent (bool) |
virtual bool | protectContent () const |
virtual KWTextFrameSet * | nextTextObject (KWFrameSet *) |
void | setZOrder () |
QByteArray | convertTableToText () |
virtual void | printDebug (KWFrame *frame) |
virtual void | printDebug () |
void | printArrayDebug () |
Static Public Attributes | |
static const uint | m_sDefaultColWidth = 60 |
Protected Member Functions | |
virtual void | deleteAnchors () |
virtual void | createAnchors (KoTextParag *parag, int index, bool placeHolderExists=false, bool repaint=true) |
Friends | |
class | Cell |
Classes | |
class | Cell |
Table cell. More... | |
class | MarkedIterator |
This iterator does not look at the Cell instance variables during traversal, (except m_marker), so they can be safely changed during the traversal. More... | |
class | Row |
Represents a row, for direct access to cells with m_rowArray[row][column]. More... | |
class | TableIterator |
All the TableIterator templates are the same, except for the pre-increment operator (operator++). More... |
Member Enumeration Documentation
The three different types of TableIterators.
- Enumerator:
Definition at line 169 of file KWTableFrameSet.h.
Constructor & Destructor Documentation
KWTableFrameSet::KWTableFrameSet | ( | KWDocument * | _doc, | |
const QString & | name | |||
) |
KWTableFrameSet::~KWTableFrameSet | ( | ) | [virtual] |
Member Function Documentation
virtual FrameSetType KWTableFrameSet::type | ( | ) | const [inline, virtual] |
The type of frameset.
Use this to differentiate between different instantiations of the framesets. Each implementation will return a different frameType.
Reimplemented from KWFrameSet.
Definition at line 302 of file KWTableFrameSet.h.
KWFrameSetEdit * KWTableFrameSet::createFrameSetEdit | ( | KWCanvas * | canvas | ) | [virtual] |
Create a framesetedit object to edit this frameset in canvas
.
Reimplemented from KWFrameSet.
Definition at line 85 of file KWTableFrameSet.cpp.
void KWTableFrameSet::createEmptyRegion | ( | const QRect & | crect, | |
QRegion & | emptyRegion, | |||
KWViewMode * | viewMode | |||
) | [virtual] |
- Parameters:
-
emptyRegion The region is modified to subtract the areas painted, thus allowing the caller to determine which areas remain to be painted.
- Parameters:
-
crect the clip rect, outside which nothing is important viewMode the current view mode
Reimplemented from KWFrameSet.
Definition at line 1469 of file KWTableFrameSet.cpp.
void KWTableFrameSet::drawContents | ( | QPainter * | painter, | |
const QRect & | crect, | |||
const QColorGroup & | cg, | |||
bool | onlyChanged, | |||
bool | resetChanged, | |||
KWFrameSetEdit * | edit, | |||
KWViewMode * | viewMode, | |||
KWFrameViewManager * | frameViewManager | |||
) | [virtual] |
Paint this frameset.
- Parameters:
-
painter The painter in which to draw the contents of the frameset crect The rectangle (in scrollview "contents coordinates", i.e. "view coords") to be painted cg The colorgroup from which to get the colors onlyChanged If true, only redraw what has changed (see KWCanvas::repaintChanged) resetChanged If true, set the changed flag to false after drawing. edit If set, this frameset is being edited, so a cursor is needed. viewMode For coordinate conversion, always set. frameViewManager the frameViewManager;
Framesets shouldn't reimplement this one in theory [but KWTableFrameSet has to].
Reimplemented from KWFrameSet.
Definition at line 1754 of file KWTableFrameSet.cpp.
virtual void KWTableFrameSet::drawFrame | ( | KWFrame * | , | |
QPainter * | , | |||
const QRect & | , | |||
const QRect & | , | |||
const QPoint & | , | |||
KWFrame * | , | |||
const QColorGroup & | , | |||
bool | , | |||
bool | , | |||
KWFrameSetEdit * | , | |||
KWViewMode * | , | |||
bool | ||||
) | [inline, virtual] |
Dummy since we reimplement drawContents.
Reimplemented from KWFrameSet.
Definition at line 328 of file KWTableFrameSet.h.
KoRect KWTableFrameSet::boundingRect | ( | ) |
Calculate the absolute size of the complete table.
From the first cell to the last, including page breaks et.
- Returns:
- KoRect which outlines the whole of the table.
Definition at line 232 of file KWTableFrameSet.cpp.
Layout all cells to fit inside the rect, cells will however use a minimum size, so the table might end up bigger.
Definition at line 802 of file KWTableFrameSet.cpp.
double KWTableFrameSet::topWithoutBorder | ( | ) |
Calculate the top postion of the cell(s) in the leftmost column.
- Returns:
- double table leftmost position
Definition at line 251 of file KWTableFrameSet.cpp.
double KWTableFrameSet::leftWithoutBorder | ( | ) |
Calculate the top postion of the cell(s) in the top row.
- Returns:
- double table top position
Definition at line 263 of file KWTableFrameSet.cpp.
void KWTableFrameSet::resizeWidth | ( | double | width | ) |
change the width of the table, keeping the proportions of the cells (if one is wider than the others, it is still wider after resize)
Definition at line 783 of file KWTableFrameSet.cpp.
void KWTableFrameSet::recalcCols | ( | uint | column, | |
uint | row | |||
) |
resize and position all cells
void KWTableFrameSet::resizeColumn | ( | unsigned int | col, | |
double | x | |||
) |
move a column edge (i.e.
col can be 0 to getCols()+1)
Definition at line 736 of file KWTableFrameSet.cpp.
void KWTableFrameSet::resizeRow | ( | unsigned int | row, | |
double | y | |||
) |
move a row edge (i.e.
row can be 0 to getRows()+1)
Definition at line 756 of file KWTableFrameSet.cpp.
int KWTableFrameSet::columnEdgeAt | ( | double | x | ) | const |
return the number of the column edge closest to x (between 0 and getCols()+1)
Definition at line 697 of file KWTableFrameSet.cpp.
int KWTableFrameSet::rowEdgeAt | ( | double | y | ) | const |
return the number of the row edge closest to x (between 0 and getRows()+1)
Definition at line 713 of file KWTableFrameSet.cpp.
unsigned int KWTableFrameSet::getRows | ( | ) | const [inline] |
unsigned int KWTableFrameSet::getColumns | ( | ) | const [inline] |
unsigned int KWTableFrameSet::getNumCells | ( | ) | const [inline] |
returns the number of cells the table contains, this includes temporary headers.
Definition at line 397 of file KWTableFrameSet.h.
void KWTableFrameSet::moveBy | ( | double | dx, | |
double | dy | |||
) |
move the whole of the table, this is mainly for anchored frames.
Definition at line 890 of file KWTableFrameSet.cpp.
void KWTableFrameSet::insertNewRow | ( | uint | _idx, | |
bool | _recalc = true , |
|||
bool | _removeable = false | |||
) |
insert a row of new cells, use the getCols() call to decide how many cells are created
Definition at line 1014 of file KWTableFrameSet.cpp.
void KWTableFrameSet::insertNewColumn | ( | uint | _idx, | |
double | width = KWTableFrameSet::m_sDefaultColWidth | |||
) |
insert a column of new cells use the getRows() call to decide how many cells are created
Definition at line 1199 of file KWTableFrameSet.cpp.
void KWTableFrameSet::deleteRow | ( | uint | _idx, | |
RemovedRow & | rr, | |||
bool | _recalc = true | |||
) |
Remove all the cells in a certain row.
void KWTableFrameSet::deleteColumn | ( | uint | _idx, | |
RemovedColumn & | rc | |||
) |
void KWTableFrameSet::reInsertRow | ( | RemovedRow & | row | ) |
void KWTableFrameSet::reInsertColumn | ( | RemovedColumn & | col | ) |
replace a column that was removed with deleteColumn()
Definition at line 1155 of file KWTableFrameSet.cpp.
void KWTableFrameSet::ungroup | ( | ) |
release the constrains of the table and allow all frames to be edited apart from each other.
(ps. there is no way back..)
Definition at line 1247 of file KWTableFrameSet.cpp.
KCommand * KWTableFrameSet::joinCells | ( | unsigned int | firstColumn, | |
unsigned int | firstRow, | |||
unsigned int | endColumn, | |||
unsigned int | endRow | |||
) |
merge cells to one cell.
Will loose all text not in top-left cell
- Parameters:
-
firstColumn the first column of the square of columns that will be used to merge firstRow the first row endColumn the last column that will end up in the merged cell endRow last row
Definition at line 1265 of file KWTableFrameSet.cpp.
KCommand * KWTableFrameSet::splitCell | ( | unsigned int | intoRows, | |
unsigned int | intoColumns, | |||
unsigned int | column, | |||
unsigned int | row, | |||
QPtrList< KWFrameSet > | listFrameSet = QPtrList< KWFrameSet >() , |
|||
QPtrList< KWFrame > | listFrame = QPtrList< KWFrame >() | |||
) |
split one cell into a number of cells and return a command for undo purposes.
- Parameters:
-
intoRows the amount of rows the cell should be split into intoColumns the amount of columns the cell should be split into column the column of the cell to be split row the row of the cell to be split listFrameSet needed for undo reasons listFrame needed for undo reasons
Definition at line 1301 of file KWTableFrameSet.cpp.
void KWTableFrameSet::viewFormatting | ( | QPainter & | painter, | |
int | zoom | |||
) |
void KWTableFrameSet::validate | ( | ) |
do a number of complex tests to test the validity of the table.
Missing/duplicate cells and wrong values will be detected (and corrected)
Definition at line 1443 of file KWTableFrameSet.cpp.
QDomElement KWTableFrameSet::save | ( | QDomElement & | parentElem, | |
bool | saveFrames = true | |||
) | [virtual] |
override save so we save in table style.
Implements KWFrameSet.
Definition at line 2012 of file KWTableFrameSet.cpp.
void KWTableFrameSet::saveOasis | ( | KoXmlWriter & | , | |
KoSavingContext & | , | |||
bool | saveFrames | |||
) | const [virtual] |
virtual bool KWTableFrameSet::canBeSavedAsInlineCharacter | ( | ) | const [inline, virtual] |
If the frameset is inline, is it ok to save it inside an oasis <text:p>? If not, KWAnchor will create a textbox around it.
Reimplemented from KWFrameSet.
Definition at line 458 of file KWTableFrameSet.h.
KWTableFrameSet::Cell * KWTableFrameSet::loadCell | ( | QDomElement & | frameElem, | |
bool | loadFrames = true , |
|||
bool | useNames = true | |||
) |
QDomElement KWTableFrameSet::toXML | ( | QDomElement & | parentElem, | |
bool | saveFrames = true | |||
) | [virtual] |
from and to XML - used when copying and pasting a table
Reimplemented from KWFrameSet.
Definition at line 2021 of file KWTableFrameSet.cpp.
void KWTableFrameSet::fromXML | ( | QDomElement & | framesetElem, | |
bool | loadFrames = true , |
|||
bool | useNames = true | |||
) | [virtual] |
load from XML - when pasting from clipboard
Reimplemented from KWFrameSet.
Definition at line 2032 of file KWTableFrameSet.cpp.
int KWTableFrameSet::paragraphs | ( | ) | [virtual] |
Contribute to the document statistics.
Reimplemented from KWFrameSet.
Definition at line 2145 of file KWTableFrameSet.cpp.
void KWTableFrameSet::finalize | ( | ) | [virtual] |
Called once the frameset has been completely loaded or constructed.
The default implementation calls updateFrames() and zoom(). Call the parent :)
Reimplemented from KWFrameSet.
Definition at line 2172 of file KWTableFrameSet.cpp.
void KWTableFrameSet::layout | ( | ) | [virtual] |
relayout text in frames, so that it flows correctly around other frames
Reimplemented from KWFrameSet.
Definition at line 2186 of file KWTableFrameSet.cpp.
void KWTableFrameSet::updateFrames | ( | int | flags = 0xff |
) | [virtual] |
Called when our frames change, or when another frameset's frames change.
Framesets can reimplement it, but should always call the parent method.
Reimplemented from KWFrameSet.
Definition at line 90 of file KWTableFrameSet.cpp.
void KWTableFrameSet::moveFloatingFrame | ( | int | frameNum, | |
const KoPoint & | position | |||
) | [virtual] |
Move the frame frameNum to the given position - this is called when the frame is anchored and the anchor moves (see KWAnchor).
Reimplemented from KWFrameSet.
Definition at line 103 of file KWTableFrameSet.cpp.
KoSize KWTableFrameSet::floatingFrameSize | ( | int | frameNum = 0 |
) | [virtual] |
Get the size of the "floating frame" identified by frameNum.
By default a real frame but not for tables.
Reimplemented from KWFrameSet.
Definition at line 124 of file KWTableFrameSet.cpp.
KCommand * KWTableFrameSet::anchoredObjectCreateCommand | ( | int | frameNum | ) | [virtual] |
Store command for creating an anchored object.
Reimplemented from KWFrameSet.
Definition at line 129 of file KWTableFrameSet.cpp.
KCommand * KWTableFrameSet::anchoredObjectDeleteCommand | ( | int | frameNum | ) | [virtual] |
Store command for deleting an anchored object.
Reimplemented from KWFrameSet.
Definition at line 134 of file KWTableFrameSet.cpp.
KWAnchor * KWTableFrameSet::createAnchor | ( | KoTextDocument * | txt, | |
int | frameNum | |||
) | [virtual] |
Create an anchor for the floating frame identified by frameNum.
Reimplemented from KWFrameSet.
Definition at line 139 of file KWTableFrameSet.cpp.
void KWTableFrameSet::setVisible | ( | bool | v | ) | [virtual] |
set the visibility of the frameset.
Reimplemented from KWFrameSet.
Definition at line 2198 of file KWTableFrameSet.cpp.
bool KWTableFrameSet::canRemovePage | ( | int | num | ) | [virtual] |
Return true if page num
can be removed, as far as this frameset is concerned.
Reimplemented from KWFrameSet.
Definition at line 2206 of file KWTableFrameSet.cpp.
void KWTableFrameSet::addCell | ( | Cell * | cell | ) |
Add a cell to this table, the cell should already have info like row, col and should already have a frame.
Definition at line 169 of file KWTableFrameSet.cpp.
void KWTableFrameSet::removeCell | ( | Cell * | cell | ) |
Remove a cell from this table (either to delete it, or to move it).
Definition at line 184 of file KWTableFrameSet.cpp.
void KWTableFrameSet::setZOrder | ( | ) | [virtual] |
Sets zOrder for all cells in this table.
Reimplemented from KWFrameSet.
Definition at line 2255 of file KWTableFrameSet.cpp.
The documentation for this class was generated from the following files: