# 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
- IpeLayer & Layer (int index)
- int FindLayer (IpeString name) const
- int AddLayer (const IpeLayer &layer, int index=-1)
- int NewLayer (int index)
- void DeleteLayer (int index)
- bool IsLayerActiveInView (int index) const
- const IpeViewSeq & Views () const
- int CountViews () const
- const IpeView & View (int index) const
- IpeView & View (int index)
- void SetViews (const IpeViewSeq &view)
- void AddView (const IpeView &view, int index=-1)
- void DeleteView (int index)
- IpeRect TextBox (const IpeRect &media, const IpeStyleSheet *sheet) const
- void SetEdited (bool edited)
- bool IsEdited () const
- IpeString Section (int level) const
- void SetSection (int level, IpeString name)
- void DeselectAll ()
- void DeselectLayer (int layer)
- void DeselectNotInView (int view)
- bool HasSelection () const
- iterator PrimarySelection ()
- void EnsurePrimarySelection ()
- void ExtractSelection (IpePgObjectSeq &seq)
- bool UpdateCloseSelection (const IpeVector &pos, double d, bool primaryOnly, int view)
- void Copy (IpeStream &stream, const IpeStyleSheet *sheet) const
- bool Paste (int layer, IpeDataSource &source, IpeRepository *rep)
- void CopyPage (IpeStream &stream, const IpeStyleSheet *sheet) const
- void MakeLayerTable (std::vector< bool > &layers, int view, bool excludeLocked) const
- void MoveToLayer (int layer)
- void Delete ()
- void SelectAll (int view)
- 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)
- int GridSize () const
- void SetGridSize (int gs)

## Detailed Description

An Ipe document page.

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

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 the layer sequence and the views set the edited flag themselves.

## Constructor & Destructor Documentation

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

| The default constructor creates a new empty page. This page still needs a layer and a view to be usable!

## 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.

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

| Return a layer.

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

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

int IpePage::AddLayer | ( | const IpeLayer & | layer,
|  | int | index = -1
| ) |

| Add a new layer at index (at the end if index is negative). Returns index of new layer, and sets edited flag. Layer numbers of all objects on page are adjusted if necessary.

int IpePage::NewLayer | ( | int | index | ) |

| Create a new layer with unique name. The layer is inserted at index index, or appended if index is negative. 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. The layer is also removed from all views.

bool IpePage::IsLayerActiveInView | ( | int | index | ) | const

| Does a view exist where this layer is active?

const IpeViewSeq& IpePage::Views | ( |  | ) | const`[inline]`

| Return presentation sequence of this page.

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

| Return number of views.

const IpeView& IpePage::View | ( | int | index | ) | const`[inline]`

| Return a view.

IpeView& IpePage::View | ( | int | index | ) | `[inline]`

| Return a view.

void IpePage::SetViews | ( | const IpeViewSeq & | views | ) |

| Set the views for the page. This sets the edited flag.

void IpePage::AddView | ( | const IpeView & | view,
|  | int | index = -1
| ) |

| Add a view at position index. The view is appended at the end if index is negative.

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

| Delete view at index.

IpeRect IpePage::TextBox | ( | const IpeRect & | media,
|  | const IpeStyleSheet * | sheet
| ) | const

| Computes text box. Takes into account media size, margins, and text objects already on the 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::SetSection | ( | int | level,
|  | IpeString | name
| ) |

| Set the section title at level. Level 0 is the section, level 1 the subsection. This marks the page as edited.

void IpePage::DeselectAll | ( |  | ) |

| Deselect all objects.

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

| Deselect all objects in this layer.

void IpePage::DeselectNotInView | ( | int | view | ) |

| Deselect all objects not in a layer of this view, or in a locked 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,
|  | int | view
| ) |

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,
|  | IpeDataSource & | 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::MakeLayerTable | ( | std::vector< bool > & | layers,
|  | int | view,
|  | bool | excludeLocked
| ) | const

| Make a table of layers, indicating whether visible (and unlocked). Must be called with an empty layers vector.

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

| Move selected objects to indicated layer.

void IpePage::Delete | ( |  | ) |

| Delete currently selected objects.

void IpePage::SelectAll | ( | int | view | ) |

| Select all objects visible and not locked in the view.

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.

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

| Return grid size for this page (0 if not set).

void IpePage::SetGridSize | ( | int | gs | ) | `[inline]`

| Set grid size.

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

- ipepage.h
- ipepage.cpp