# IpeReference Class Reference
[Ipe Objects]

The reference object. More...

Inherits IpeObject.

List of all members.

## Public Member Functions

- IpeReference (IpeRepository *rep, const IpeXmlAttributes &attr, IpeString data)
- IpeReference (const IpeStyleSheet *sheet, IpeAttribute name)
- IpeReference (const IpeReference &rhs)
- virtual IpeObject * Clone () const
- virtual IpeReference * AsReference ()
- virtual void Accept (IpeVisitor &visitor) const
- virtual void SaveAsXml (IpePainter &painter, IpeStream &stream, IpeString layer) const
- virtual void Draw (IpePainter &painter) const
- virtual void AddToBBox (IpeRect &box, const IpeMatrix &m) const
- virtual double Distance (const IpeVector &v, const IpeMatrix &m, double bound) const
- virtual void SnapVtx (const IpeVector &mouse, const IpeMatrix &m, IpeVector &pos, double &bound) const
- virtual void SnapBnd (const IpeVector &mouse, const IpeMatrix &m, IpeVector &pos, double &bound) const
- virtual void CheckStyle (const IpeStyleSheet *sheet, IpeAttributeSeq &seq) const
- IpeAttribute Name () const
- const IpeObject * Object () const

## Detailed Description

The reference object.

A reference reuses an object defined in an Ipe style sheet. The object is defined as a named template in the style sheet, and can be reused arbitrarily often in the document. This can, for instance, be used for backgrounds on multi-page documents.

It is admissible to refer to an undefined object (that is, the current style sheet cascade does not define a template with the given name).

## Constructor & Destructor Documentation

IpeReference::IpeReference | ( | IpeRepository * | rep,
|  | const IpeXmlAttributes & | attr,
|  | IpeString | data |
| ) |  |  | `[explicit]`

Create from XML stream.

IpeReference::IpeReference | ( | const IpeStyleSheet * | sheet,
|  | IpeAttribute | name |
| ) |  |  | `[explicit]`

Create a reference to the named object in stylesheet.

IpeReference::IpeReference | ( | const IpeReference & | rhs | ) |

Copy constructor.

## Member Function Documentation

IpeObject * IpeReference::Clone | ( |  | ) | const`[virtual]`

Clone object.

Implements IpeObject.

IpeReference * IpeReference::AsReference | ( |  | ) | `[virtual]`

Return pointer to this object.

Reimplemented from IpeObject.

void IpeReference::Accept | ( | IpeVisitor & | visitor | ) | const`[virtual]`

Calls VisitXXX method of the visitor.

Implements IpeObject.

void IpeReference::SaveAsXml | ( | IpePainter & | painter,
|  | IpeStream & | stream,
|  | IpeString | layer |
| ) |  |  | const`[virtual]`

Save in XML format.

Implements IpeObject.

void IpeReference::Draw | ( | IpePainter & | painter | ) | const`[virtual]`

Draw reference.

If the symbolic attribute is not defined in the current style sheet, nothing is drawn at all.

Implements IpeObject.

void IpeReference::AddToBBox | ( | IpeRect & | box,
|  | const IpeMatrix & | m |
| ) |  |  | const`[virtual]`

Extend box to include the object transformed by m.

For Ipe objects in a page, don't call this directly. The IpePgObject caches the bounding box, so it is far more efficient to call IpePgObject::BBox.

If called with an empty box, the result of this function is a tight bounding box for the object, with a little leeway in case the boundary is determined by a spline (it has to be approximated to perform this operation).

Implements IpeObject.

double IpeReference::Distance | ( | const IpeVector & | v,
|  | const IpeMatrix & | m,
|  | double | bound |
| ) |  |  | const`[virtual]`

Return distance of transformed object to point v. If larger than bound, can just return bound.

Implements IpeObject.

void IpeReference::SnapVtx | ( | const IpeVector & | mouse,
|  | const IpeMatrix & | m,
|  | IpeVector & | pos,
|  | double & | bound |
| ) |  |  | const`[virtual]`

Compute possible vertex snapping position for transformed object.

Looks only for positions closer than bound. If successful, modify pos and bound.

Implements IpeObject.

void IpeReference::SnapBnd | ( | const IpeVector & | mouse,
|  | const IpeMatrix & | m,
|  | IpeVector & | pos,
|  | double & | bound |
| ) |  |  | const`[virtual]`

Compute boundary snapping position for transformed object.

Looks only for positions closer than bound. If successful, modify pos and bound. The default implementation does nothing.

Reimplemented from IpeObject.

void IpeReference::CheckStyle | ( | const IpeStyleSheet * | sheet,
|  | IpeAttributeSeq & | seq |
| ) |  |  | const`[virtual]`

Check symbolic attributes of object.

Reimplemented from IpeObject.

IpeAttribute IpeReference::Name | ( |  | ) | const`[inline]`

Return symbolic name.

const IpeObject* IpeReference::Object | ( |  | ) | const`[inline]`

Return pointer to cached object.

The documentation for this class was generated from the following files:

- iperef.h
- iperef.cpp