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

#include <TableTypes.h>

Public Types

typedef base_type data_type
 

Public Member Functions

 GridArea ()
 
 GridArea (GridCoord topRow, GridCoord leftCol, GridCoord bottomRow, GridCoord right)
 
 GridArea (const GridAddress &topLeftElement, const GridAddress &bottomRightElement)
 
 GridArea (const GridAddress &anchor, const GridSpan &span)
 
 GridArea (const RowRange &rows, const ColRange &cols)
 
void Set (GridCoord topRow, GridCoord leftCol, GridCoord bottomRow, GridCoord right)
 
GridAddress GetTopLeft () const
 
GridAddress GetBottomRight () const
 
GridAddress GetTopLeftElem () const
 
GridAddress GetTopRightElem () const
 
GridAddress GetBottomLeftElem () const
 
GridAddress GetBottomRightElem () const
 
void SetTopLeft (const GridAddress &tl)
 
void SetBottomRight (const GridAddress &br)
 
RowRange GetRows () const
 
ColRange GetCols () const
 
GridSpan GetSpan () const
 
int32 Width () const
 
int32 Height () const
 
bool16 IsEmpty () const
 
GridArea operator& (const GridArea &rhs) const
 
GridArea operator| (const GridArea &rhs) const
 
GridAreaoperator&= (const GridArea &rhs)
 
GridAreaoperator|= (const GridArea &rhs)
 
bool16 operator== (const GridArea &rhs) const
 
bool16 operator!= (const GridArea &rhs) const
 
bool16 Normalize ()
 
bool16 IsNormalized () const
 
bool16 Contains (const GridAddress &element) const
 
bool16 Contains (const GridArea &area) const
 
bool16 Intersects (const GridArea &area) const
 
void ReadWrite (IPMStream *stream)
 

Public Attributes

GridCoord topRow
 
GridCoord leftCol
 
GridCoord bottomRow
 
GridCoord rightCol
 

Detailed Description

Represents a rectangle of grid elements in the table model. The bottom and right elements are not included to allow for an empty GridArea.

The best way to think of this is that the GridCoord's refer to the vertices instead of cells. The cells are the area inside the vertices. For example, the first cell's topLeft is (0, 0) and the bottom right is (1, 1).

Author
Joe Shankar
See Also
ITableModel

Member Typedef Documentation

For K2Vector, specifying that this is a data class that does not have specialised copy semantics. A shallow field-wise copy is sufficient to clone an instance of this class.

Constructor & Destructor Documentation

GridArea::GridArea ()
inline

No-args constructor

GridArea::GridArea (GridCoord topRow,
GridCoord leftCol,
GridCoord bottomRow,
GridCoord right 
)
inline
Parameters
topRow
leftCol
bottomRow
right
GridArea::GridArea (const GridAddresstopLeftElement,
const GridAddressbottomRightElement 
)
inline

Constructor.

Parameters
topLeftElementspecifies a top left element in the underlying grid for this area
bottomRightElementspecifies the bottom right element in the underlying grid that is in the row just below and just right of the area to cover in the underlying grid.
GridArea::GridArea (const GridAddressanchor,
const GridSpanspan 
)
inline

Constructor.

Parameters
anchorspecifies location of the top-left of the new area
spanspecifies the height and width of the new area
GridArea::GridArea (const RowRangerows,
const ColRangecols 
)
inline

Constructor.

Parameters
rowsspecifies the RowRange that this area should cover
colsspecifies the ColRange that the area should cover

Member Function Documentation

bool16 GridArea::Contains (const GridAddresselement) const
inline

Query to see if a particular location is within the area covered by this element.

Parameters
elementlocation of another element
Returns
kTrue if element is within 'this', kFalse otherwise.
bool16 GridArea::Contains (const GridAreaarea) const
inline

Query whether this area is able to wholly contain the specified area

Parameters
areaspecifies area for the query
Returns
kTrue if the given area can lie within this area without protruding beyond its bounds, kFalse otherwise
GridAddress GridArea::GetBottomLeftElem () const
inline

Location of the bottom left element in the underlying grid that is contained within this area.

Returns
a GridAddress representing the location of the element on the underlying grid that is in the lower left corner of this area.
GridAddress GridArea::GetBottomRight () const
inline

This query can be thought of as either; returning the location of the element in the underlying grid that is just below and right of the area covered in the grid, or as the location of the lower right vertex of this area.

Returns
the co-ordinates of the bottom right vertex of the area as a GridAddress
GridAddress GridArea::GetBottomRightElem () const
inline

Location of the bottom right element contained in this area this area in the underlying grid.

Returns
a GridAddress representing the location of the element on the underlying grid that is just below and to the right of this area.
ColRange GridArea::GetCols () const
inline

Query for the columns covered by this area.

Returns
columns covered as a ColRange
RowRange GridArea::GetRows () const
inline

Query for the rows covered by this area.

Returns
rows covered by this area as a RowRange
GridSpan GridArea::GetSpan () const
inline
Returns
the dimension of this area as a GridSpan
GridAddress GridArea::GetTopLeft () const
inline
Returns
co-ordinates of the top left vertex of the area as a GridAddress
GridAddress GridArea::GetTopLeftElem () const
inline

Location of the top-left element of this area in the underlying grid.

Returns
a GridAddress representing the location of the top-left element in the underlying grid covered by this area.
GridAddress GridArea::GetTopRightElem () const
inline

Location of the top-right element of this area in the underlying grid.

Returns
a GridAddress representing the location of the top-right element in the underlying grid covered by this area.
int32 GridArea::Height () const
inline
Returns
the height of this area, as a count of the rows spanned
bool16 GridArea::Intersects (const GridAreaarea) const
inline

Query whether this area has an intersection with the specified area

Returns
kTrue if the 'this' intersects area, i.e. if there is a non-zero overlap between this area and the given area, kFalse otherwise
bool16 GridArea::IsEmpty (void ) const
inline
Returns
kTrue if this covers no area within the underlying grid, kFalse if there is a finite area covered
bool16 GridArea::IsNormalized () const
inline

Query whether this object conforms to rule that the top row is indeed above the bottom row, and the left column is indeed to the left of the rightmost column.

Returns
kTrue if the area has vertices that have the correct relative disposition to one another, kFalse otherwise
bool16 GridArea::Normalize ()

Ensures that topRow <= bottomRow and leftCol <= right. Returns true if 'this' was changed. $$$ does this really make sense?

Returns
kTrue if the object was changed by this call
bool16 GridArea::operator!= (const GridArearhs) const
inline

Overload of equality relational operator. Semantics: two GridAreas are 'not-equal' if any vertex locations differ.

Parameters
rhsspecifies another area to be compared with this
Returns
kTrue if any of the vertex locations between this and the rhs area differ, kFalse otherwise
GridArea GridArea::operator& (const GridArearhs) const

Overload of operator bitwise-and, to mean 'intersect'.

Parameters
rhsarea to take intersection with
Returns
an area that represents the intersection of the given area and this area
GridArea& GridArea::operator&= (const GridArearhs)
inline

Overload of operator bitwise-and assignment. Semantics; perform an intersection of this area with rhs, followed by assignment to the result.

Returns
reference to self
bool16 GridArea::operator== (const GridArearhs) const
inline

Overload of equality relational operator. Semantics: two GridAreas are equal if and only if they have identical vertex locations.

Parameters
rhsspecifies another area to be compared with this
Returns
kTrue if the areas have identically located vertices, kFalse otherwise
GridArea GridArea::operator| (const GridArearhs) const

Overload of operator bitwise-or, to mean 'union'.

Parameters
rhsarea to take union with
Returns
union of this area and the given area
GridArea& GridArea::operator|= (const GridArearhs)
inline

Overload of operator bitwise-or assignment. Semantics; perform union of this area with rhs, followed by assignment to result.

Returns
reference to self
void GridArea::ReadWrite (IPMStreamstream)
inline

Persistence-related method for instance to save or read instance data from given stream.

Parameters
streamstream to read from or write to depending on stream's state
void GridArea::SetBottomRight (const GridAddressbr)
inline

Mutator for the bottom right vertex of this region.

Parameters
brspecifies the location of the new bottom right vertex for this region.
void GridArea::SetTopLeft (const GridAddresstl)
inline

Mutator for the top vertex of this region.

Parameters
tlspecifies location for new top left vertex for this area
int32 GridArea::Width () const
inline
Returns
the width of this area in columns spanned

Member Data Documentation

GridCoord GridArea::bottomRow

Represents the row co-ordinate for the bottom two vertices of this area

GridCoord GridArea::leftCol

Represents the column co-ordinate for the two lefthand vertices of this area.

GridCoord GridArea::rightCol

Represents the column co-ordinate for the righmost two vertices of this area

GridCoord GridArea::topRow

Represents the row co-ordinate for the top two vertices of this area.