# IpePage Class Reference
[Ipe Document]

An Ipe document page. More...

List of all members.

## Public Member Functions

- IpePage ()
- void SaveAsXml (IpePainter &painter, IpeStream &stream) const
- int CountLayers () const
- const IpeLayer & Layer (int index) const
- int FindLayer (IpeString name) const
- void SetLayer (int index, const IpeLayer &layer)
- int AddLayer (const IpeLayer &layer)
- int NewLayer ()
- void DeleteLayer (int index)
- const IpePresentationSeq & Presentation () const
- void SetPresentation (const IpePresentationSeq &pres)
- void AddPresentation (const IpePresentation &pres)
- void SetMediaBox (const IpeRect &rect)
- IpeRect MediaBox () const
- void SetEdited (bool edited)
- bool IsEdited () const
- void DeselectAll ()
- void DeselectLayer (int layer)
- bool HasSelection () const
- iterator PrimarySelection ()
- void EnsurePrimarySelection ()
- void ExtractSelection (IpePgObjectSeq &seq)
- bool UpdateCloseSelection (const IpeVector &pos, double d, bool primaryOnly)
- void Copy (IpeStream &stream, const IpeStyleSheet *sheet) const
- bool Paste (int layer, IpeXmlDataSource &source, IpeRepository *rep)
- void CopyPage (IpeStream &stream, const IpeStyleSheet *sheet) const
- void MoveToLayer (int layer)
- void Delete ()
- void SelectAll ()
- void SelectAllInLayer (int layer)
- void Group (int layer)
- bool Ungroup (int layer)
- void Front ()
- void Back ()
- void Duplicate (int layer)
- void SetStroke (IpeAttribute color)
- void SetFill (IpeAttribute color)
- void SetLineWidth (IpeAttribute attr)
- void SetDashStyle (IpeAttribute attr)
- void SetArrows (bool forward, bool backward, IpeAttribute size)
- void SetArrowSize (IpeAttribute size)
- void SetMarkShape (int shape)
- void SetMarkSize (IpeAttribute size)
- void SetTextSize (IpeAttribute size)
- bool ComposePaths (int layer)
- bool DecomposePath (int layer)
- bool JoinPaths (int layer)

## Detailed Description

An Ipe document page.

Its main ingredients are a sequence of IpePgObjects, a list of IpeLayers, and a list of IpePresentations.

If you need to keep track of whether a document has been modified, you have to call SetEdited(true) whenever you modify an IpePgObject.

The functions to modify media box, layer sequence, and presentation sequence take set the edited flag themselves.

## Constructor & Destructor Documentation

IpePage::IpePage | ( |  | ) | `[explicit]`

| The default constructor creates a new empty page.

## Member Function Documentation

void IpePage::SaveAsXml | ( | IpePainter & | painter,
|  | IpeStream & | stream
| ) | const

| Save page in XML format.

int IpePage::CountLayers | ( |  | ) | const`[inline]`

| Return number of layers.

const IpeLayer& IpePage::Layer | ( | int | index | ) | const`[inline]`

| Return a layer.

int IpePage::FindLayer | ( | IpeString | name | ) | const

| Find layer with given name. Returns -1 if not found.

void IpePage::SetLayer | ( | int | index,
|  | const IpeLayer & | layer
| ) |

| Modify a layer. Sets the edited flag.

int IpePage::AddLayer | ( | const IpeLayer & | layer | ) |

| Add a new layer. Returns index of new layer, and sets edited flag.

int IpePage::NewLayer | ( |  | ) |

| Create a new layer with unique name. Returns index of new layer.

void IpePage::DeleteLayer | ( | int | index | ) |

| Deletes an empty layer from the page. All objects are adjusted. Panics if there are objects in the deleted layer, of if it is the only layer.

const IpePresentationSeq& IpePage::Presentation | ( |  | ) | const`[inline]`

| Return presentation sequence of this page.

void IpePage::SetPresentation | ( | const IpePresentationSeq & | pres | ) |

| Set presentation sequence for the page. This sets the edited flag.

void IpePage::AddPresentation | ( | const IpePresentation & | pres | ) |

| Add a presentation at the end of the sequence.

void IpePage::SetMediaBox | ( | const IpeRect & | rect | ) |

| Set MediaBox of the page.

IpeRect IpePage::MediaBox | ( |  | ) | const`[inline]`

| Return MediaBox for this page.

void IpePage::SetEdited | ( | bool | edited | ) |

| Set whether page has been edited.

bool IpePage::IsEdited | ( |  | ) | const`[inline]`

| Return true if page has been modified since last save.

void IpePage::DeselectAll | ( |  | ) |

| Deselect all objects.

void IpePage::DeselectLayer | ( | int | layer | ) |

| Deselect all objects in this layer.

bool IpePage::HasSelection | ( |  | ) | const

| Returns true iff any object on the page is selected.

IpePage::iterator IpePage::PrimarySelection | ( |  | ) |

| Returns the primary selection, or end().

void IpePage::EnsurePrimarySelection | ( |  | ) |

| If no object is the primary selection, make the topmost secondary selection the primary one.

void IpePage::ExtractSelection | ( | IpePgObjectSeq & | seq | ) |

| Removes all selected objects from the page. They are added, in the same order, to seq.

bool IpePage::UpdateCloseSelection | ( | const IpeVector & | pos,
|  | double | d,
|  | bool | primaryOnly
| ) |

If no selected object is close, select closest object.

If there is a selected object at distance at most d from pos, return true. Otherwise, check whether the closest object to pos has distance at most d. If so, unselect everything, make this object the primary selection, and return true. If not, return whether the page has a selection at all.

If primaryOnly is `true`, the primary selection has to be at distance at most d, otherwise it'll be replaced as above.

void IpePage::Copy | ( | IpeStream & | stream,
|  | const IpeStyleSheet * | sheet
| ) | const

| Copy selected objects into the stream.

bool IpePage::Paste | ( | int | layer,
|  | IpeXmlDataSource & | source,
|  | IpeRepository * | rep
| ) |

| Paste objects from XML source into layer. Returns false if XML source cannot be parsed.

void IpePage::CopyPage | ( | IpeStream & | stream,
|  | const IpeStyleSheet * | sheet
| ) | const

| Copy whole page into the stream.

void IpePage::MoveToLayer | ( | int | layer | ) |

| Move selected objects to indicated layer.

void IpePage::Delete | ( |  | ) |

| Delete currently selected objects.

void IpePage::SelectAll | ( |  | ) |

| Select all objects on the page.

void IpePage::SelectAllInLayer | ( | int | layer | ) |

| Select all objects in the given layer.

void IpePage::Group | ( | int | layer | ) |

| Group the selected objects together as a new group object. The new object is placed in layer.

bool IpePage::Ungroup | ( | int | layer | ) |

| Ungroup the primary selection, place objects in layer. Panics if no primary selection, returns false if primary selection is not a group.

void IpePage::Front | ( |  | ) |

| Move selected objects to front.

void IpePage::Back | ( |  | ) |

| Move selected objects to back.

void IpePage::Duplicate | ( | int | layer | ) |

| Duplicate the selected objects into layer.

void IpePage::SetStroke | ( | IpeAttribute | color | ) |

| Set stroke color of selected objects.

void IpePage::SetFill | ( | IpeAttribute | color | ) |

| Set fill color of selected objects.

void IpePage::SetLineWidth | ( | IpeAttribute | attr | ) |

| Set line width of selected objects.

void IpePage::SetDashStyle | ( | IpeAttribute | attr | ) |

| Set line style of selected objects.

void IpePage::SetArrows | ( | bool | forward,
|  | bool | backward,
|  | IpeAttribute | size
| ) |

| Set arrows of selected objects.

void IpePage::SetArrowSize | ( | IpeAttribute | size | ) |

| Set arrow size of selected objects.

void IpePage::SetMarkShape | ( | int | shape | ) |

| Set mark shape of selected objects.

void IpePage::SetMarkSize | ( | IpeAttribute | size | ) |

| Set mark size of selected objects.

void IpePage::SetTextSize | ( | IpeAttribute | size | ) |

| Set text size of selected objects.

bool IpePage::ComposePaths | ( | int | layer | ) |

| Create one path object with all the subpaths from the selection. The new object takes the attributes from the primary selection, and is placed in layer. The function returns false if non-path objects are selected.

bool IpePage::DecomposePath | ( | int | layer | ) |

| Decompose one path object into separate objects for the subpaths. The new objects are placed in layer. The function returns false if the primary selection is not a path object.

bool IpePage::JoinPaths | ( | int | layer | ) |

| Join paths into one long path. Create one path object with the open subpaths from the selection joined into one long subpath. The new object takes the attributes from the primary selection, and is placed in layer. The function returns `false` if objects are selected that do not consist of open subpaths only.

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

- ipepage.h
- ipepage.cpp