9 #ifndef PAGEITEM_TABLE_H
10 #define PAGEITEM_TABLE_H
20 #include "scribusapi.h"
21 #include "styles/tablestyle.h"
22 #include "tablecell.h"
23 #include "tablehandle.h"
54 Q_PROPERTY(
int rows READ rows NOTIFY changed)
55 Q_PROPERTY(
int columns READ columns NOTIFY changed)
56 Q_PROPERTY(QString fillColor READ fillColor WRITE setFillColor RESET unsetFillColor NOTIFY changed)
57 Q_PROPERTY(
TableBorder leftBorder READ leftBorder WRITE setLeftBorder RESET unsetLeftBorder NOTIFY changed)
58 Q_PROPERTY(
TableBorder rightBorder READ rightBorder WRITE setRightBorder RESET unsetRightBorder NOTIFY changed)
59 Q_PROPERTY(
TableBorder topBorder READ topBorder WRITE setTopBorder RESET unsetTopBorder NOTIFY changed)
60 Q_PROPERTY(
TableBorder bottomBorder READ bottomBorder WRITE setBottomBorder RESET unsetBottomBorder NOTIFY changed)
61 Q_PROPERTY(QString style READ style WRITE setStyle RESET unsetStyle NOTIFY changed)
86 QString fill, QString outline,
int numRows = 1,
int numColumns = 1);
95 int rows()
const {
return m_rows; }
105 double tableWidth()
const {
return m_columnPositions.last() + m_columnWidths.last(); }
112 double tableHeight()
const {
return m_rowPositions.last() + m_rowHeights.last(); }
117 QPointF
gridOffset()
const {
return QPointF(maxLeftBorderWidth()/2, maxTopBorderWidth()/2); }
125 double effectiveWidth()
const {
return tableWidth() + (maxLeftBorderWidth() + maxRightBorderWidth()) / 2; }
133 double effectiveHeight()
const {
return tableHeight() + (maxTopBorderWidth() + maxBottomBorderWidth()) / 2; }
143 void resize(
double width,
double height);
153 void insertRows(
int index,
int numRows);
161 void removeRows(
int index,
int numRows);
166 double rowHeight(
int row)
const;
178 void resizeRow(
int row,
double height, ResizeStrategy strategy = MoveFollowing);
188 void distributeRows(
int startRow,
int endRow);
193 double rowPosition(
int row)
const;
208 void insertColumns(
int index,
int numColumns);
216 void removeColumns(
int index,
int numColumns);
221 double columnWidth(
int column)
const;
233 void resizeColumn(
int column,
double width, ResizeStrategy strategy = MoveFollowing);
243 void distributeColumns(
int startColumn,
int endColumn);
248 double columnPosition(
int column)
const;
266 void mergeCells(
int row,
int column,
int numRows,
int numCols);
272 void splitCell(
int row,
int column,
int numRows,
int numCols);
284 QSet<int> selectedRows()
const;
291 QSet<int> selectedColumns()
const;
298 void selectCell(
int row,
int column);
309 void selectCells(
int startRow,
int startColumn,
int endRow,
int endColumn);
314 void clearSelection();
323 TableCell cellAt(
int row,
int column)
const;
333 TableCell cellAt(
const QPointF& point)
const;
374 TableHandle hitTest(
const QPointF& point,
double threshold)
const;
377 void adjustTableToFrame();
380 void adjustFrameToTable();
386 void unsetFillColor();
395 void unsetFillShade();
404 void unsetLeftBorder();
413 void unsetRightBorder();
422 void unsetTopBorder();
431 void unsetBottomBorder();
437 void setStyle(
const QString& style);
443 void unsetDirectFormatting();
446 QString style()
const;
452 void updateCells(
int startRow,
int startColumn,
int endRow,
int endColumn);
455 bool isOverflowing()
const {
return effectiveWidth() > width() || effectiveHeight() > height(); }
467 virtual void applicableActions(QStringList& actionList);
473 QList<CellArea>
cellAreas()
const {
return m_cellAreas; }
476 QList<QList<TableCell> >
cellRows()
const {
return m_cellRows; }
482 void selectionChanged();
486 void handleStyleChanged();
490 virtual void DrawObj_Item(
ScPainter *p, QRectF clipRect);
507 void initialize(
int numRows,
int numColumns);
510 void activateCell(
const TableCell& cell);
513 bool validRow(
int row)
const {
return row >= 0 && row < m_rows; }
515 bool validColumn(
int column)
const {
return column >= 0 && column < m_columns; }
517 bool validCell(
int row,
int column)
const {
return validRow(row) && validColumn(column); }
520 double maxLeftBorderWidth()
const;
523 double maxRightBorderWidth()
const;
526 double maxTopBorderWidth()
const;
529 double maxBottomBorderWidth()
const;
533 double resizeRowMoveFollowing(
int row,
double height);
535 double resizeRowResizeFollowing(
int row,
double height);
537 double resizeColumnMoveFollowing(
int row,
double width);
539 double resizeColumnResizeFollowing(
int row,
double width);
550 void updateSpans(
int index,
int number, ChangeType changeType);
556 void assertValid()
const;
561 QList<QList<TableCell> > m_cellRows;
569 QList<double> m_rowPositions;
571 QList<double> m_rowHeights;
574 QList<double> m_columnPositions;
576 QList<double> m_columnWidths;
579 QList<CellArea> m_cellAreas;
587 QSet<TableCell> m_selection;
625 #endif // PAGEITEM_TABLE_H
double tableWidth() const
Definition: pageitem_table.h:105
QList< double > columnWidths() const
Definition: pageitem_table.h:226
Definition: tablestyle.h:30
virtual QString infoDescription()
Returns a textual description of this item.
Definition: pageitem_table.h:470
Definition: tablepainter.h:21
QList< double > rowHeights() const
Definition: pageitem_table.h:171
double tableHeight() const
Definition: pageitem_table.h:112
Definition: tablehandle.h:19
void setFillColor(const QString &newColor)
Set the fill color of the object.
Definition: pageitem.cpp:4011
QList< QList< TableCell > > cellRows() const
Returns the rows of the table for writing to SLA.
Definition: pageitem_table.h:476
double fillShade() const
Get the shade of the fill color.
Definition: pageitem.h:813
Definition: tableborder.h:86
QList< double > columnPositions() const
Definition: pageitem_table.h:253
TableCell activeCell() const
Definition: pageitem_table.h:341
void setFillShade(double newShade)
Set the fill color shade.
Definition: pageitem.cpp:4061
virtual bool isTable() const
Returns true.
Definition: pageitem_table.h:461
the Document Class
Definition: scribusdoc.h:90
Definition: scpainter.h:33
virtual ItemType realItemType() const
Returns PageItem::Table.
Definition: pageitem_table.h:464
QList< CellArea > cellAreas() const
Returns the Cell Areas from this table.
Definition: pageitem_table.h:473
double effectiveWidth() const
Definition: pageitem_table.h:125
bool isOverflowing() const
Returns true if the table is overflowing its frame.
Definition: pageitem_table.h:455
int rows() const
Returns the number of rows in the table.
Definition: pageitem_table.h:95
QList< double > rowPositions() const
Definition: pageitem_table.h:198
static const double MinimumRowHeight
The minimum row height.
Definition: pageitem_table.h:78
QString fillColor() const
Get the (name of the) fill color of the object.
Definition: pageitem.h:805
double effectiveHeight() const
Definition: pageitem_table.h:133
ItemType
Item Type.
Definition: pageitem.h:174
virtual PageItem_Table * asTable()
Returns this item as a PageItem_Table.
Definition: pageitem_table.h:458
ResizeStrategy
Definition: pageitem_table.h:71
Definition: tablecell.h:97
Definition: pageitem.h:92
void updateCells()
Updates the position and size of all cell text frames for this table.
Definition: pageitem_table.h:449
QSet< TableCell > selectedCells() const
Definition: pageitem_table.h:277
QPointF gridOffset() const
Definition: pageitem_table.h:117
static const double MinimumColumnWidth
The minimum column width.
Definition: pageitem_table.h:81
Definition: pageitem_table.h:49
int columns() const
Returns the number of columns in the table.
Definition: pageitem_table.h:98