kword

KWTableFrameSet Class Reference

#include <KWTableFrameSet.h>

Inheritance diagram for KWTableFrameSet:

KWFrameSet List of all members.

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

typedef TableIterator< VISIT_CELL > TableIter
typedef TableIterator< VISIT_GRID > GridIter
typedef TableIterator< CHECKED > CheckedIter
 VISIT_GRID = 1
 VISIT_CELL = 2
 CHECKED = 3
 TblAuto = 0
 TblManual
enum  VisitType { VISIT_GRID = 1, VISIT_CELL = 2, CHECKED = 3 }
enum  CellSize { TblAuto = 0, TblManual }

Public Member Functions

virtual FrameSetType type () const
virtual KWordFrameSetIfacedcopObject ()
virtual void addTextFrameSets (QPtrList< KWTextFrameSet > &lst, bool onlyReadWrite=false)
 KWTableFrameSet (KWDocument *_doc, const QString &name)
virtual ~KWTableFrameSet ()
virtual KWFrameSetEditcreateFrameSetEdit (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)
Cellcell (unsigned int row, unsigned int column) const
CellcellByPos (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
CellloadCell (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 KWAnchorcreateAnchor (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 KWTextFrameSetnextTextObject (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:
VISIT_GRID  This iterator visits each grid position once, ie every location in the m_rowArray rows.

When some cells are joined, this iterator will visit those cells more than once.

VISIT_CELL  This iterator visits each cell in the table once, whether or not some of the cells are joined.

If you want to visit all the cells fast and perform some read-only operation, this is the one to use.

CHECKED  Like VISIT_CELL it also visits each cell once, but has some other benefits.

Slower.

Definition at line 169 of file KWTableFrameSet.h.


Constructor & Destructor Documentation

KWTableFrameSet::KWTableFrameSet ( KWDocument _doc,
const QString &  name 
)

constructor

Definition at line 58 of file KWTableFrameSet.cpp.

KWTableFrameSet::~KWTableFrameSet (  )  [virtual]

destructor

Definition at line 71 of file KWTableFrameSet.cpp.


Member Function Documentation

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 166 of file KWTableFrameSet.cpp.

KCommand * KWTableFrameSet::anchoredObjectCreateCommand ( int  frameNum  )  [virtual]

Store command for creating an anchored object.

Reimplemented from KWFrameSet.

Definition at line 126 of file KWTableFrameSet.cpp.

KCommand * KWTableFrameSet::anchoredObjectDeleteCommand ( int  frameNum  )  [virtual]

Store command for deleting an anchored object.

Reimplemented from KWFrameSet.

Definition at line 131 of file KWTableFrameSet.cpp.

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 229 of file KWTableFrameSet.cpp.

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.

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 2200 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 694 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 136 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.
crect the clip rect, outside which nothing is important
viewMode the current view mode

Reimplemented from KWFrameSet.

Definition at line 1463 of file KWTableFrameSet.cpp.

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::deleteColumn ( uint  _idx,
RemovedColumn rc 
)

remove all the cells in a certain column

Definition at line 1087 of file KWTableFrameSet.cpp.

void KWTableFrameSet::deleteRow ( uint  _idx,
RemovedRow rr,
bool  _recalc = true 
)

Remove all the cells in a certain row.

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;
The way this "onlyChanged/resetChanged" works is: when something changes, all views are asked to redraw themselves with onlyChanged=true. But all views except the last one shouldn't reset the changed flag to false, otherwise the other views wouldn't repaint anything. So resetChanged is called with "false" for all views except the last one, and with "true" for the last one, so that it resets the flag.

Framesets shouldn't reimplement this one in theory [but KWTableFrameSet has to].

Reimplemented from KWFrameSet.

Definition at line 1748 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.

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 2166 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 121 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 2026 of file KWTableFrameSet.cpp.

unsigned int KWTableFrameSet::getColumns (  )  const [inline]

returns the number of columns

Definition at line 393 of file KWTableFrameSet.h.

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.

unsigned int KWTableFrameSet::getRows (  )  const [inline]

returns the number of rows

Definition at line 391 of file KWTableFrameSet.h.

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 1196 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 1011 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 1262 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 2180 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 260 of file KWTableFrameSet.cpp.

KWTableFrameSet::Cell * KWTableFrameSet::loadCell ( QDomElement &  frameElem,
bool  loadFrames = true,
bool  useNames = true 
)

load one cell

Definition at line 2039 of file KWTableFrameSet.cpp.

void KWTableFrameSet::moveBy ( double  dx,
double  dy 
)

move the whole of the table, this is mainly for anchored frames.

Definition at line 887 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.

int KWTableFrameSet::paragraphs (  )  [virtual]

Contribute to the document statistics.

Reimplemented from KWFrameSet.

Definition at line 2139 of file KWTableFrameSet.cpp.

void KWTableFrameSet::recalcCols ( uint  column,
uint  row 
)

resize and position all cells

void KWTableFrameSet::reInsertColumn ( RemovedColumn col  ) 

replace a column that was removed with deleteColumn()

Definition at line 1152 of file KWTableFrameSet.cpp.

void KWTableFrameSet::reInsertRow ( RemovedRow row  ) 

replace a row that was removed with deleteRow()

Definition at line 958 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 181 of file KWTableFrameSet.cpp.

void KWTableFrameSet::resizeColumn ( unsigned int  col,
double  x 
)

move a column edge (i.e.

col can be 0 to getCols()+1)

Definition at line 733 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 753 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 780 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 710 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 2006 of file KWTableFrameSet.cpp.

void KWTableFrameSet::saveOasis ( KoXmlWriter &  ,
KoSavingContext &  ,
bool  saveFrames 
) const [virtual]

Save to OASIS format.

Implements KWFrameSet.

Definition at line 1773 of file KWTableFrameSet.cpp.

void KWTableFrameSet::setBoundingRect ( KoRect  rect,
CellSize  widthMode,
CellSize  heightMode 
)

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 799 of file KWTableFrameSet.cpp.

void KWTableFrameSet::setVisible ( bool  v  )  [virtual]

set the visibility of the frameset.

Reimplemented from KWFrameSet.

Definition at line 2192 of file KWTableFrameSet.cpp.

void KWTableFrameSet::setZOrder (  )  [virtual]

Sets zOrder for all cells in this table.

Reimplemented from KWFrameSet.

Definition at line 2249 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 1295 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 248 of file KWTableFrameSet.cpp.

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 2015 of file KWTableFrameSet.cpp.

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.

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 1244 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::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 1437 of file KWTableFrameSet.cpp.

void KWTableFrameSet::viewFormatting ( QPainter &  painter,
int  zoom 
)

display formatting information

Definition at line 1433 of file KWTableFrameSet.cpp.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys