Scribus
Open source desktop publishing at your fingertips
TableUtils Namespace Reference

Functions

void resolveBordersHorizontal (const TableCell &topLeftCell, const TableCell &topCell, const TableCell &topRightCell, const TableCell &bottomLeftCell, const TableCell &bottomCell, const TableCell &bottomRightCell, TableBorder *topLeft, TableBorder *left, TableBorder *bottomLeft, TableBorder *center, TableBorder *topRight, TableBorder *right, TableBorder *bottomRight, PageItem_Table *table)
 
void resolveBordersVertical (const TableCell &topLeftCell, const TableCell &topRightCell, const TableCell &leftCell, const TableCell &rightCell, const TableCell &bottomLeftCell, const TableCell &bottomRightCell, TableBorder *topLeft, TableBorder *top, TableBorder *topRight, TableBorder *center, TableBorder *bottomLeft, TableBorder *bottom, TableBorder *bottomRight, PageItem_Table *table)
 
TableBorder collapseBorders (const TableBorder &firstBorder, const TableBorder &secondBorder)
 
void joinVertical (const TableBorder &border, const TableBorder &topLeft, const TableBorder &top, const TableBorder &topRight, const TableBorder &bottomLeft, const TableBorder &bottom, const TableBorder &bottomRight, QPointF *start, QPointF *end, QPointF *startOffsetFactors, QPointF *endOffsetFactors)
 
void joinHorizontal (const TableBorder &border, const TableBorder &topLeft, const TableBorder &left, const TableBorder &bottomLeft, const TableBorder &topRight, const TableBorder &right, const TableBorder &bottomRight, QPointF *start, QPointF *end, QPointF *startOffsetFactors, QPointF *endOffsetFactors)
 

Detailed Description

Table utility functions.

Function Documentation

TableBorder SCRIBUS_API TableUtils::collapseBorders ( const TableBorder firstBorder,
const TableBorder secondBorder 
)

Collapses firstBorder with secondBorder and returns the collapsed border.

Rules in order of priority:

1) If both borders are null borders, a null border is returned. 2) If one of the two borders is null, the non-null border is returned. 3) If one of the two borders is wider than the other, the wider border is returned. 4) If firstBorder has more border lines than secondBorder, firstBorder is returned, else, secondBorder is returned.

void SCRIBUS_API TableUtils::joinHorizontal ( const TableBorder border,
const TableBorder topLeft,
const TableBorder left,
const TableBorder bottomLeft,
const TableBorder topRight,
const TableBorder right,
const TableBorder bottomRight,
QPointF *  start,
QPointF *  end,
QPointF *  startOffsetFactors,
QPointF *  endOffsetFactors 
)

Joins the horizontal border border with neighboring borders.

Adjustments are made to the passed start and end points and offset factors for the individual border lines are returned in startOffsetFactors and endOffsetFactors.

If any of topLeft, left, bottomLeft, topRight, right or bottomRight is null (isNull() returning true), then it is assumed that there is no border coming in from that direction.

Which neighboring borders the arguments refer to is illustrated by:

         topLeft              topRight
            |                     |
  left--(m_start)---m_border---(m_end)--right
            |                     |
        bottomLeft           bottomRight
Parameters
topLeftvertical border meeting the start point of the border from the top.
lefthorizontal border meeting the start point of border from the left.
bottomLeftvertical border meeting the start point of the border from the bottom.
topRightvertical border meeting the end point of the border from the top.
righthorizontal border meeting the end point of the border from the right.
bottomRightvertical border meeting the end point of the border from the bottom.
startstart point of border, assumed to be above end.
endend point of border, assumed to be below start.
startOffsetFactorsstart offset factors for the individual border lines. The start point of each border line of the border should be adjusted by its own width multiplied by these factors.
endOffsetFactorsend offset factors for the individual border lines. The end point of each border line of the border should be adjusted by its own width multiplied by these factors.
void SCRIBUS_API TableUtils::joinVertical ( const TableBorder border,
const TableBorder topLeft,
const TableBorder top,
const TableBorder topRight,
const TableBorder bottomLeft,
const TableBorder bottom,
const TableBorder bottomRight,
QPointF *  start,
QPointF *  end,
QPointF *  startOffsetFactors,
QPointF *  endOffsetFactors 
)

Joins the vertical border border with neighboring borders.

Adjustments are made to the passed start and end points and offset factors for the individual border lines are returned in startOffsetFactors and endOffsetFactors.

If any of topLeft, top, topRight, bottomLeft, bottom or bottomRight is null (isNull() returning true), then it is assumed that there is no border coming in from that direction.

Which neighboring borders the arguments refer to is illustrated by:

                top
                 |
      topLeft--(start)--topRight
                 |
               border
                 |
   bottomLeft--(end)--bottomRight
                 |
               bottom
Parameters
borderthe border that should be joined.
topLefthorizontal border meeting the start point of the border from the left.
topvertical border meeting the start point of the border from above.
topRighthorizontal border meeting the start point of the border from the right.
bottomLefthorizontal border meeting the end point of the border from the left.
bottomvertical border meeting the end point of the border from above.
bottomRighthorizontal border meeting the end point of the border from the right.
startstart point of border, assumed to be above end.
endend point of border, assumed to be below start.
startOffsetFactorsstart offset factors for the individual border lines. The start point of each border line of the border should be adjusted by its own width multiplied by these factors.
endOffsetFactorsend offset factors for the individual border lines. The end point of each border line of the border should be adjusted by its own width multiplied by these factors.
void SCRIBUS_API TableUtils::resolveBordersHorizontal ( const TableCell topLeftCell,
const TableCell topCell,
const TableCell topRightCell,
const TableCell bottomLeftCell,
const TableCell bottomCell,
const TableCell bottomRightCell,
TableBorder topLeft,
TableBorder left,
TableBorder bottomLeft,
TableBorder center,
TableBorder topRight,
TableBorder right,
TableBorder bottomRight,
PageItem_Table table 
)

Resolves the collapsed borders between six cells in a 3x2 area.

Given the six cells topLeftCell, topCell, topRightCell, bottomLeftCell, bottomCell and bottomRightCell in the following picture

 +--------------------------+--------------------------+--------------------------+
 |                          |                          |                          |
 |                          |                          |                          |
 |        topLeftCell   topLeft        topCell      topRight   topRightCell       |
 |                          |                          |                          |
 |                          |                          |                          |
 +----------left------------+--------- center ---------+----------right-----------+
 |                          |                          |                          |
 |                          |                          |                          |
 |     bottomLeftCell   bottomLeft   bottomCell   bottomRight  bottomRightCell    |
 |                          |                          |                          |
 |                          |                          |                          |
 +--------------------------+--------------------------+--------------------------+

the function will return the collapsed borders topLeft, left, bottomLeft, center, topRight, right and bottomRight. If two adjacent cells are invalid, the returned collapsed border between them is null. If only one of two adjacent cells is valid, the returned collapsed border will be the border of the valid cell collapsed with the appropriate table border instead. If two "adjacent" cells are actually the same cell, the returned collapsed border between them is null.

If both topCell and bottomCell are invalid, the function will print a warning message and return immediately, leaving topLeft, top, bottomLeft, center, topRight, right and bottomRight unchanged.

topLeft, left , bottomLeft, center, topRight, right and bottomRight must point to existing borders.

void SCRIBUS_API TableUtils::resolveBordersVertical ( const TableCell topLeftCell,
const TableCell topRightCell,
const TableCell leftCell,
const TableCell rightCell,
const TableCell bottomLeftCell,
const TableCell bottomRightCell,
TableBorder topLeft,
TableBorder top,
TableBorder topRight,
TableBorder center,
TableBorder bottomLeft,
TableBorder bottom,
TableBorder bottomRight,
PageItem_Table table 
)

Resolves the collapsed borders between six cells in a 2x3 area.

Given the six cells topLeftCell, topRightCell, leftCell, rightCell, bottomLeftCell and bottomRightCell in the following picture

 +----------------------+----------------------+
 |                      |                      |
 |                      |                      |
 |    topLeftCell      top     topRightCell    |
 |                      |                      |
 |                      |                      |
 +--------topLeft-------+-------topRight-------+
 |                      |                      |
 |                      |                      |
 |      leftCell     center     rightCell      |
 |                      |                      |
 |                      |                      |
 +-------bottomLeft-----+------bottomRight-----+
 |                      |                      |
 |                      |                      |
 |  bottomLeftCell   bottom   bottomRightCell  |
 |                      |                      |
 |                      |                      |
 +----------------------+----------------------+

the function will return the collapsed borders topLeft, top, topRight, center, bottomLeft, bottom and bottomRight. If two adjacent cells are invalid, the returned collapsed border between them is null. If only one of two adjacent cells is valid, the returned collapsed border will be the border of the valid cell collapsed with the appropriate table border instead. If two "adjacent" cells are actually the same cell, the returned collapsed border between them is null.

If both leftCell and rightCell are invalid, the function will print a warning message and return immediately, leaving topLeft, top, topRight, center, bottomLeft, bottom and bottomRight unchanged.

topLeft, top, topRight, center, bottomLeft, bottom and bottomRight must point to existing borders.