InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
GridAddress Class Reference

#include <TableTypes.h>

Public Types

typedef base_type data_type
 

Public Member Functions

 GridAddress ()
 
 GridAddress (GridCoord inRow, GridCoord inCol)
 
void Set (GridCoord inRow, GridCoord inCol)
 
GridAddress operator+ (const GridAddress &rhs) const
 
GridAddress operator- (const GridAddress &rhs) const
 
GridAddressoperator+= (const GridAddress &rhs)
 
GridAddressoperator-= (const GridAddress &rhs)
 
bool16 operator== (const GridAddress &rhs) const
 
bool16 operator!= (const GridAddress &rhs) const
 
bool16 operator< (const GridAddress &rhs) const
 
bool16 operator<= (const GridAddress &rhs) const
 
bool16 operator> (const GridAddress &rhs) const
 
bool16 operator>= (const GridAddress &rhs) const
 
void ReadWrite (IPMStream *stream)
 

Public Attributes

GridCoord row
 
GridCoord col
 

Detailed Description

Row and column of an element in the underlying grid of the table model. The underlying grid provides the co-ordinate system for tables.

A grid address is specified on the grid underlying a table. The units of the underlying grid are grid-elements; table-cells are composites of grid-elements, consisting of 1 (if they have a 'trivial' or unit GridSpan) or more grid-elements. The grid-address for a cell is specified in terms of the grid-address of its anchor or top-left.

If a single cell is split vertically, then this increases the resolution of the underlying grid in the horizontal direction. The grid-lines are not uniformly distributed, although it is a rectilinear grid for tables within InDesign 2.0.

To determine what row a particular cell in can become quite complex in a table with many split and merged cells; that is, tables with many non-trivial GridSpans. The notional algorithm to determine the GridAddress for a particular cell is straightforward;

  1. Determine the resolution of the underlying grid. For the horizontal direction, this can be calculated by projecting all the vertical edges to the x-axis (top of the table). Similarly for the vertical direction, project all the horizontal edges to the y-axis (left of the table).
  2. Calculate the co-ordinates on this grid.
Author
Joe Shankar
See Also
ITableModel

Member Typedef Documentation

Specifies that this is a plain data type for K2Vector and no specialised copy semantics are required.

Constructor & Destructor Documentation

GridAddress::GridAddress ()
inline

No-args constructor.

GridAddress::GridAddress (GridCoord inRow,
GridCoord inCol 
)
inline

Constructor.

Parameters
inRowspecifies row in which top-left of the cell is located
inColspecifies the column in which top-left of the cell is located

Member Function Documentation

bool16 GridAddress::operator!= (const GridAddressrhs) const
inline

Overload of not-equal operator.

Parameters
rhsright hand operand.
GridAddress GridAddress::operator+ (const GridAddressrhs) const
inline

Overload of addition operator.. Semantics: results is a new location with 'this' location offset by the location of the second.

Parameters
rhsright hand operand.
GridAddress& GridAddress::operator+= (const GridAddressrhs)
inline

Overload of operator addition assignment. Would have effect of offsetting the current GridAddress by specified argument.

Parameters
rhsright hand operand.
GridAddress GridAddress::operator- (const GridAddressrhs) const
inline

Overload of sutraction operator. Semantics: would give a new location for 'this' object expressed relative to the rhs operand. Clearly, if the '<' operator returns false, then the resulting GridAddress from this '-' operation will be outside the real table.

Parameters
rhsright hand operand.
GridAddress& GridAddress::operator-= (const GridAddressrhs)
inline

Overload of operator subtraction assignment. Would have effect of re-expressing the current location in frame of reference determined by the rhs operand.

Parameters
rhsright hand operand.
bool16 GridAddress::operator< (const GridAddressrhs) const
inline

Overload of less than operator. Semantics: allows two GridAddresses to be compared to see which is nearer the top of the table, and then if they are in the same row, to see which is nearer to the left of the table.

Parameters
rhsright hand operand.
bool16 GridAddress::operator<= (const GridAddressrhs) const
inline

Overload of less than or equal to operator.

Parameters
rhsright hand operand.
Returns
kTrue if the comparand (rhs) is below this location, or kTrue if it is in the same row, to the right of this cell, kFalse otherwise.
bool16 GridAddress::operator== (const GridAddressrhs) const
inline

Overload of equality relational operator. Semantics; this address identical with another iff the row and columns represented by each are identical.

Parameters
rhsright hand operand.
Returns
kTrue if this and the comparand GridAddress refer to the same row and column, kFalse otherwise
bool16 GridAddress::operator> (const GridAddressrhs) const
inline

Overload of operator greater than. Semantics; this grid-address is 'greater' than the rhs if it is in a row that is lower in the table than this address, or if in the same row, if it is to the right.

Parameters
rhsright hand operand.
bool16 GridAddress::operator>= (const GridAddressrhs) const
inline

Overload of operator greater than or equal to operator. Semantics; this grid-address is gte rhs iff it is in a row below this or if in the same row, in a column that is the same or rightmost of the column represented in this address.

Parameters
rhsright hand operand.
Returns
kTrue if the rhs location is in a row below this object, or kTrue if it is in a column to the right of the current location, kFalse otherwise.
void GridAddress::ReadWrite (IPMStreamstream)
inline

Used to persist the state of an object of this type.

Parameters
streamrefers to the stream to/from which the state is serialised or deserialised.
void GridAddress::Set (GridCoord inRow,
GridCoord inCol 
)
inline

Mutator.

Parameters
inRowspecifies the new row.
inColspecifies the new column.

Member Data Documentation

GridCoord GridAddress::col

Represents the column co-ordinate. Columns are zero-based and the column co-ordinate increases from the left hand edge rightwards.

GridCoord GridAddress::row

Represents the row co-ordinate. The rows are zero-based and the row co-ordinate increases from the top of the table downwards.