- Main Page
- Modules
- Classes

- Class List
- Class Hierarchy
- Class Members

# IpeDocument Class Reference
[Ipe Document]

The model for an Ipe document. More...

List of all members.

## Public Types

- enum TFormat {
  EXml, EPdf, EEps, EIpe5,
  EUnknown
  }
- enum {
  ESaveNormal = 0, EExport = 1, ENoShading = 2, ELastView = 4,
  ENoColor = 8
  }

## Public Member Functions

- IpeDocument ()
- ~IpeDocument ()
- bool Save (IpeTellStream &stream, IpeString creator, TFormat format, uint flags, int fromPage, int toPage, int compressLevel=9) const
- bool Save (const char *fname, IpeString creator, TFormat format, uint flags, int fromPage=-1, int toPage=-1, int compressLevel=9) const
- void SaveAsXml (IpeStream &stream, IpeString creator, bool usePdfBitmaps=false) const
- bool AddStyleSheet (IpeDataSource &source)
- int pages () const
- int totalViews () const
- const IpePage * page (int no) const
- IpePage * page (int no)
- IpePage * setPage (int no, IpePage *page)
- IpePage * newPage (int gridSize)
- void addPage (int no, IpePage *page)
- IpePage * removePage (int no)
- SProperties Properties () const
- void SetProperties (const SProperties &info)
- IpeLayout layout () const
- void SetStyleSheet (IpeStyleSheet *sheet)
- const IpeStyleSheet * StyleSheet () const
- IpeStyleSheet * GetStyleSheet ()
- bool IsEdited () const
- void SetEdited (bool edited)
- void SetFontPool (IpeFontPool *fontPool)
- const IpeFontPool * FontPool () const
- bool HasTrueTypeFonts () const
- void FindBitmaps (IpeBitmapFinder &bm) const
- bool CheckStyle (IpeAttributeSeq &seq) const
- IpeRepository * Repository ()
- const IpeRepository * Repository () const

## Static Public Member Functions

- static TFormat FileFormat (IpeDataSource &source)
- static IpeDocument * New (IpeDataSource &source, TFormat format, int &reason)
- static IpeDocument * New (const char *fname, int &reason)

## Protected Attributes

- std::vector< IpePage * > iPages
- IpeStyleSheet * iStyleSheet
- SProperties iProperties
- bool iEdited
- IpeRepository iRepository
- IpeFontPool * iFontPool

## Classes

- struct SProperties
    Properties of a document. More...

## Detailed Description

The model for an Ipe document.

The IpeDocument class is the engine behind the Ipe program. It represents the contents of an Ipe document, and all the methods necessary to load, save, and edit it. It is independent of a specific user interface.

IpeDocument's cannot be copied or assigned.

Note that the IpeDocument owns the IpeRepository that defines the meaning of all object's attributes. Therefore, the document is the largest extent where IpeObject's make sense. You can have several documents at once, but you cannot move IpeObject's (or IpeStyleSheet's) from one to the other. If you need to do so, you'll have to externalize them to XML and internalize them into the other document.

## Member Enumeration Documentation

enum IpeDocument::TFormat

There are several Ipe document save formats.

Enumerator:

  EXml | Save as XML.
  EPdf | Save as PDF.
  EEps | Save as Encapsulated Postscript.
  EIpe5 | Old Ipe format.
  EUnknown | Unknown file format.

anonymous enum

Options for saving Ipe documents (to PDF and Postscript).

Enumerator:

  ESaveNormal | Nothing special.
  EExport | Don't include Ipe markup.
  ENoShading | Don't shade background in PDF documents.
  ELastView | Create last view of each page only.
  ENoColor | No color commands in EPS output.

## Constructor & Destructor Documentation

IpeDocument::IpeDocument | ( |  | ) |

Construct an empty document for filling by a client.

As constructed, it has no pages, A4 media, and only the standard style sheet.

IpeDocument::~IpeDocument | ( |  | ) |

Destructor.

## Member Function Documentation

IpeDocument::TFormat IpeDocument::FileFormat | ( | IpeDataSource & | source | ) | `[static]`

Determine format of file in source.

IpeDocument * IpeDocument::New | ( | IpeDataSource & | source,
|  | TFormat | format,
|  | int & | reason |
| ) |  |  | `[static]`

Construct a document from an input stream.

Returns 0 if the stream couldn't be parsed, and a reason explaining that in reason. If reason is positive, it is a file (stream) offset where parsing failed. If reason is negative, it is an error code. If it is smaller than -60000, then it is the negative value of the Ipe version that created that file (and which exceeds the version of this Ipe).

bool IpeDocument::Save | ( | IpeTellStream & | stream,
|  | IpeString | creator,
|  | TFormat | format,
|  | uint | flags,
|  | int | fromPage,
|  | int | toPage,
|  | int | compressLevel = `9` |
| ) |  |  | const

Save in a stream.

Returns true if sucessful.

Does not reset IsEdited().

void IpeDocument::SaveAsXml | ( | IpeStream & | stream,
|  | IpeString | creator,
|  | bool | usePdfBitmaps = `false` |
| ) |  |  | const

Save in XML format into an IpeStream.

You can set creator to set the `creator` attribute in the `` <ipe> tag.

bool IpeDocument::AddStyleSheet | ( | IpeDataSource & | source | ) |

Load a style sheet and add at top of cascade.

int IpeDocument::totalViews | ( |  | ) | const

Return total number of views in all pages.

const IpePage* IpeDocument::page | ( | int | no | ) | const`[inline]`

Return page (const version).

The first page is no 0.

IpePage* IpeDocument::page | ( | int | no | ) | `[inline]`

Return page.

The first page is no 0.

IpePage * IpeDocument::setPage | ( | int | no,
|  | IpePage * | page |
| ) |  |  |

Replace page.

Returns the old page.

IpePage * IpeDocument::newPage | ( | int | gridSize | ) |

Create a new empty page with standard settings.

The page is not added to the document, use addPage to do that.

void IpeDocument::addPage | ( | int | no,
|  | IpePage * | page |
| ) |  |  |

Insert a new page.

IpePage * IpeDocument::removePage | ( | int | no | ) |

Remove a page.

Returns the page that has been removed.

SProperties IpeDocument::Properties | ( |  | ) | const`[inline]`

Return document properties.

void IpeDocument::SetProperties | ( | const SProperties & | info | ) |

Set document properties.

IpeLayout IpeDocument::layout | ( |  | ) | const

Return document page layout.

void IpeDocument::SetStyleSheet | ( | IpeStyleSheet * | sheet | ) |

Replace the style sheet cascade.

The previous contents is not deleted (because this function is often used to insert style sheets into the cascade).

Sets the edited flag.

const IpeStyleSheet* IpeDocument::StyleSheet | ( |  | ) | const`[inline]`

Return const pointer to topmost stylesheet.

IpeStyleSheet* IpeDocument::GetStyleSheet | ( |  | ) | `[inline]`

Return modifiable stylesheet.

bool IpeDocument::IsEdited | ( |  | ) | const

Return true if document has been edited since last save.

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

Set whether document has been edited.

Methods that can modify the document already set the flag, so you only need to call this when inserting or deleting pages, etc. When modifying an IpePage, rather call IpePage::SetEdited(true).

Clients need to manually reset the edited flag when they save the document, or after constructing it during loading.

Calling this with `edited` == `false` will call IpePage::SetEdited(false) for all pages.

void IpeDocument::SetFontPool | ( | IpeFontPool * | fontPool | ) |

Update the font pool (after running Pdflatex).

Takes ownership of the font pool.

const IpeFontPool* IpeDocument::FontPool | ( |  | ) | const`[inline]`

Return the current IpeFontPool.

void IpeDocument::FindBitmaps | ( | IpeBitmapFinder & | bm | ) | const

Create a list of all bitmaps in the document.

bool IpeDocument::CheckStyle | ( | IpeAttributeSeq & | seq | ) | const

Check all symbolic attributes in the document.

This function verifies that all symbolic attributes in the document are defined in the style sheet. It appends to seq all symbolic attributes (in no particular order, but without duplicates) that are NOT defined.

Returns `true` if there are no undefined symbolic attributes in the document.

IpeRepository* IpeDocument::Repository | ( |  | ) | `[inline]`

Return attribute repository.

const IpeRepository* IpeDocument::Repository | ( |  | ) | const`[inline]`

Return attribute repository (const version).

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

- ipedoc.h
- ipedoc.cpp