# IpeDocument Class Reference
[Ipe Document]

The model for an Ipe document. More...

List of all members.

## Public Member Functions

- IpeDocument ()
- ~IpeDocument ()
- bool Save (const char *fname, IpeString creator)
- void SaveAsXml (IpeStream &stream, IpeString creator, bool usePdfBitmaps=false)
- SProperties Properties () const
- void SetProperties (const SProperties &info)
- void SetStyleSheet (IpeStyleSheet *sheet)
- const IpeStyleSheet * StyleSheet () const
- IpeStyleSheet * GetStyleSheet ()
- bool IsEdited () const
- void SetEdited (bool edited)
- bool NotifyStyle (IpeAttributeSeq &seq) const
- IpeRepository * Repository ()
- const IpeRepository * Repository () const

## Static Public Member Functions

- IpeDocument * New (const char *fname)

## Protected Attributes

- IpeStyleSheet * iStyleSheet
- SProperties iProperties
- bool iEdited
- IpeRepository iRepository

## 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 externalize them to XML and internalize them into the other document.

## Constructor & Destructor Documentation

IpeDocument::IpeDocument | ( |  | ) |

| Construct an empty document for filling by a client. As constructed, it has no pages, and only the standard style sheet.

IpeDocument::~IpeDocument | ( |  | ) |

| Destructor.

## Member Function Documentation

IpeDocument * IpeDocument::New | ( | const char * | fname | ) | `[static]`

| Construct a document from a file. Returns 0 if file couldn't be read or parsed. Note that the file name fname is an 8-bit string, and passed through unchanged to `fopen`. What encoding you have to use for fname depends on the operating system. Under Windows, you probably cannot load arbitrary Unicode filenames---you need to roll your own function if you need to do that.

bool IpeDocument::Save | ( | const char * | fname,
|  | IpeString | creator
| ) |

| Save in a file. Returns true if sucessful. Does not reset IsEdited(). Note that the file name fname is an 8-bit string, and passed through unchanged to `fopen`. What encoding you have to use for fname depends on the operating system. Under Windows, you probably cannot load arbitrary Unicode filenames---you need to roll your own function if you need to do that.

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

| Save in XML format into an IpeStream. You can set creator to set the `creator` attribute in the `` tag.

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

| Return document properties.

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

| Set document properties.

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.

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

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

Notify objects of change in style sheet.

Some objects need to know the absolute value of some attribute, and therefore have to notified of any change in the style sheet.

This function will also verify 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 with not 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