# IpeStyleSheet Class Reference
[Ipe Document]

A style sheet maps symbolic names to absolute values. More...

List of all members.

## Public Member Functions

- IpeStyleSheet (IpeRepository *rep)
- ~IpeStyleSheet ()
- void AddTemplate (IpeAttribute name, const IpeObject *obj)
- const IpeObject * FindTemplate (IpeAttribute sym) const
- void Add (IpeAttribute name, IpeAttribute value)
- IpeAttribute Find (IpeAttribute sym) const
- void SaveAsXml (IpeStream &stream) const
- void SaveCascadeAsXml (IpeStream &stream) const
- void AllNames (IpeKind kind, IpeAttributeSeq &seq) const
- void AllNames (IpeAttributeSeq *attr) const
- bool IsStandard () const
- IpeString Preamble () const
- IpeString TotalPreamble () const
- void SetPreamble (const IpeString &str)
- void SetMargins (const IpeVector &tl, const IpeVector &br)
- void FindMargins (IpeVector &tl, IpeVector &br) const
- void SetShading (const IpeShading &s)
- IpeShading FindShading () const
- void AddCMap (IpeString s)
- void AllCMaps (std::vector< IpeString > &seq) const
- const IpeStyleSheet * Cascade () const
- IpeStyleSheet * Cascade ()
- void SetCascade (IpeStyleSheet *sheet)
- IpeString Name () const
- void SetName (const IpeString &name)
- IpeRepository * Repository ()
- const IpeRepository * Repository () const

## Static Public Member Functions

- IpeStyleSheet * Standard (IpeRepository *rep)

## Detailed Description

A style sheet maps symbolic names to absolute values.

Ipe documents can use symbolic attributes, such as 'normal', 'fat', or 'thin' for line thickness, or 'red', 'navy', 'turquoise' for color. The mapping to an absolute pen thickness or RGB value is performed by an IpeStyleSheet.

IpeStyleSheet's cascade in the sense that a document can refer to several style sheets, which are arranged on a stack. The document owns the 'top-level stylesheet', which in turn owns the stack below it. A lookup is done from top to bottom, and returns as soon as a match is found. Ipe always appends the built-in "standard" style sheet at the bottom of the cascade.

Style sheets are always included when the document is saved, so that an Ipe document is self-contained.

The built-in style sheet is guaranteed not to change in ways that would change the meaning of existing Ipe files. In other words, new symbolic names may be defined, but no existing ones will be removed or mapped differently.

Note that the style sheet depends (and includes a pointer to) the IpeRepository of the document. You cannot attach a style sheet to another document---the IpeRepository wouldn't make sense. To transfer a style sheet, it has to be externalized and internalized again with the new repository. For this reason, copying and assigning IpeStyleSheet is illegal.

## Constructor & Destructor Documentation

IpeStyleSheet::IpeStyleSheet | ( | IpeRepository * | rep | ) |

| The default constructor creates an empty style sheet.

IpeStyleSheet::~IpeStyleSheet | ( |  | ) |

| Destructor.

## Member Function Documentation

IpeStyleSheet * IpeStyleSheet::Standard | ( | IpeRepository * | rep | ) | `[static]`

| Create standard built-in style sheet.

void IpeStyleSheet::AddTemplate | ( | IpeAttribute | name,
|  | const IpeObject * | obj
| ) |

| Add a template object.

const IpeObject * IpeStyleSheet::FindTemplate | ( | IpeAttribute | sym | ) | const

| Find a template object with given name.

void IpeStyleSheet::Add | ( | IpeAttribute | name,
|  | IpeAttribute | value
| ) |

| Add an attribute.

IpeAttribute IpeStyleSheet::Find | ( | IpeAttribute | sym | ) | const

| Find a symbolic attribute. Returns `null` attribute if sym is `null` or cannot be found in the style sheet. In all other cases, returns an absolute attribute (one for which IsAbsolute() returns `true`).

void IpeStyleSheet::SaveAsXml | ( | IpeStream & | stream | ) | const

| Save style sheet in XML format.

void IpeStyleSheet::SaveCascadeAsXml | ( | IpeStream & | stream | ) | const

| Save whole style sheet cascade in XML format.

void IpeStyleSheet::AllNames | ( | IpeKind | kind,
|  | IpeAttributeSeq & | seq
| ) | const

| Return all symbolic names in the style sheet cascade. Names are simply appended from top to bottom of the cascade. Names are inserted only once.

bool IpeStyleSheet::IsStandard | ( |  | ) | const`[inline]`

| Return whether this is the standard style sheet built into Ipe.

IpeString IpeStyleSheet::Preamble | ( |  | ) | const`[inline]`

| Return preamble of this style sheet (not including the cascade).

IpeString IpeStyleSheet::TotalPreamble | ( |  | ) | const

| Return total LaTeX preamble (of the whole cascade).

void IpeStyleSheet::SetPreamble | ( | const IpeString & | str | ) | `[inline]`

| Set LaTeX preamble.

void IpeStyleSheet::SetMargins | ( | const IpeVector & | tl,
|  | const IpeVector & | br
| ) |

| Set text margins.

void IpeStyleSheet::FindMargins | ( | IpeVector & | tl,
|  | IpeVector & | br
| ) | const

| Find text margins in style sheet cascade.

void IpeStyleSheet::SetShading | ( | const IpeShading & | s | ) |

| Set the shading in this style sheet.

IpeShading IpeStyleSheet::FindShading | ( |  | ) | const

| Find shading in style sheet cascade.

void IpeStyleSheet::AddCMap | ( | IpeString | s | ) |

| Add font s to list of fonts with cmap generation.

const IpeStyleSheet * IpeStyleSheet::Cascade | ( |  | ) | const`[inline]`

| Return next sheet in cascade (const version).

IpeStyleSheet * IpeStyleSheet::Cascade | ( |  | ) | `[inline]`

| Return the next level style sheet.

void IpeStyleSheet::SetCascade | ( | IpeStyleSheet * | sheet | ) |

| Set the next level of the style sheet cascade. Takes ownership. The previous contents is not destroyed. You have to take care of that.

IpeString IpeStyleSheet::Name | ( |  | ) | const`[inline]`

| Return name of style sheet.

void IpeStyleSheet::SetName | ( | const IpeString & | name | ) | `[inline]`

| Set name of style sheet.

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

| Return attribute repository.

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

| Return attribute repository (const version).

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

- ipestyle.h
- ipestdstyles.cpp
- ipestyle.cpp