Ipelib

Classes | Public Member Functions | Static Public Member Functions | List of all members
ipe::StyleSheet Class Reference
Ipe Document

`#include <ipestyle.h>`

## Classes
struct | PageNumberStyle
struct | TitleStyle

## Public Member Functions
| StyleSheet ()
void | addSymbol (Attribute name, const Symbol &symbol)
const Symbol * | findSymbol (Attribute sym) const
void | addGradient (Attribute name, const Gradient &s)
const Gradient * | findGradient (Attribute sym) const
void | addTiling (Attribute name, const Tiling &s)
const Tiling * | findTiling (Attribute sym) const
void | addEffect (Attribute name, const Effect &e)
const Effect * | findEffect (Attribute sym) const
void | add (Kind kind, Attribute name, Attribute value)
bool | has (Kind kind, Attribute sym) const
Attribute | find (Kind, Attribute sym) const
void | remove (Kind kind, Attribute sym)
void | saveAsXml (Stream &stream, bool saveBitmaps=false) const
void | allNames (Kind kind, AttributeSeq &seq) const
bool | isStandard () const
String | preamble () const
void | setPreamble (const String &str)
const Layout * | layout () const
void | setLayout (const Layout &margins)
const TextPadding * | textPadding () const
void | setTextPadding (const TextPadding &pad)
const TitleStyle * | titleStyle () const
void | setTitleStyle (const TitleStyle &ts)
const PageNumberStyle * | pageNumberStyle () const
void | setPageNumberStyle (const PageNumberStyle &pns)
void | setLineCap (TLineCap s)
void | setLineJoin (TLineJoin s)
void | setFillRule (TFillRule s)
TLineCap | lineCap () const
TLineJoin | lineJoin () const
TFillRule | fillRule () const
String | name () const
void | setName (const String &name)

## Static Public Member Functions
static StyleSheet * | standard ()

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

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

The built-in standard style sheet is minimal, and only needed to provide sane fallbacks for all the "normal" settings.

## Constructor & Destructor Documentation

## ◆ StyleSheet()

StyleSheet::StyleSheet | ( |  | ) |

The default constructor creates an empty style sheet.

References ipe::EDefaultCap, ipe::EDefaultJoin, and ipe::EDefaultRule.

## Member Function Documentation

## ◆ standard()

StyleSheet * StyleSheet::standard | ( |  | ) |
| static

Create standard built-in style sheet.

References ipe::ImlParser::parseStyleSheet().

Referenced by ipe::Document::Document(), and ipe::PdfThumbnail::PdfThumbnail().

## ◆ addSymbol()

void StyleSheet::addSymbol | ( | Attribute | name,
|  | const Symbol & | symbol
| ) |  |

Add a symbol object.

References ipe::Attribute::index(), and ipe::Attribute::isSymbolic().

Referenced by ipe::ImlParser::parseStyle().

## ◆ findSymbol()

const Symbol * StyleSheet::findSymbol | ( | Attribute | attr | ) | const

Find a symbol object with given name.

If attr is not symbolic or if the symbol doesn't exist, returns 0.

References ipe::Attribute::index(), and ipe::Attribute::isSymbolic().

## ◆ addGradient()

void StyleSheet::addGradient | ( | Attribute | name,
|  | const Gradient & | s
| ) |  |

Add gradient to this style sheet.

References ipe::Attribute::index(), and ipe::Attribute::isSymbolic().

Referenced by ipe::ImlParser::parseStyle().

## ◆ findGradient()

const Gradient * StyleSheet::findGradient | ( | Attribute | sym | ) | const

Find gradient in style sheet cascade.

References ipe::Attribute::index(), and ipe::Attribute::isSymbolic().

## ◆ addTiling()

void StyleSheet::addTiling | ( | Attribute | name,
|  | const Tiling & | s
| ) |  |

Add tiling to this style sheet.

References ipe::Attribute::index(), and ipe::Attribute::isSymbolic().

Referenced by ipe::ImlParser::parseStyle().

## ◆ findTiling()

const Tiling * StyleSheet::findTiling | ( | Attribute | sym | ) | const

Find tiling in style sheet cascade.

References ipe::Attribute::index(), and ipe::Attribute::isSymbolic().

## ◆ addEffect()

void StyleSheet::addEffect | ( | Attribute | name,
|  | const Effect & | e
| ) |  |

References ipe::Attribute::index(), and ipe::Attribute::isSymbolic().

Referenced by ipe::ImlParser::parseStyle().

## ◆ findEffect()

const Effect * StyleSheet::findEffect | ( | Attribute | sym | ) | const

References ipe::Attribute::index(), and ipe::Attribute::isSymbolic().

## ◆ add()

void StyleSheet::add | ( | Kind | kind,
|  | Attribute | name,
|  | Attribute | value
| ) |  |

Add an attribute.

Does nothing if name is not symbolic.

References ipe::Attribute::index(), and ipe::Attribute::isSymbolic().

Referenced by ipe::ImlParser::parseStyle().

## ◆ has()

bool StyleSheet::has | ( | Kind | kind,
|  | Attribute | sym
| ) |  | const

Check whether symbolic attribute is defined.

This method also works for ESymbol, EGradient, ETiling, and EEffect.

Returns true if sym is not symbolic.

References ipe::EEffect, ipe::EGradient, ipe::ESymbol, ipe::ETiling, ipe::Attribute::index(), and ipe::Attribute::isSymbolic().

## ◆ find()

Attribute StyleSheet::find | ( | Kind | kind,
|  | Attribute | sym
| ) |  | const

Find a symbolic attribute.

If sym is not symbolic, returns sym itself. If sym cannot be found, returns the "undefined" attribute. In all other cases, the returned attribute is guaranteed to be absolute.

References ipe::Attribute::index(), ipe::Attribute::isSymbolic(), and ipe::Attribute::UNDEFINED().

## ◆ remove()

void StyleSheet::remove | ( | Kind | kind,
|  | Attribute | sym
| ) |  |

Removes definition for a symbolic attribute from this stylesheet.

This method also works for ESymbol, EGradient, ETiling, and EEffect. It is okay if the symbolic attribute is not defined in the stylesheet, nothing happens in this case.

References ipe::EEffect, ipe::EGradient, ipe::ESymbol, ipe::ETiling, and ipe::Attribute::index().

## ◆ saveAsXml()

void StyleSheet::saveAsXml | ( | Stream & | stream,
|  | bool | saveBitmaps = `false`
| ) |  | const

Save style sheet in XML format.

References ipe::Angle::degrees(), ipe::Gradient::EAxial, ipe::EDefaultCap, ipe::EDefaultJoin, ipe::EDefaultRule, ipe::EEvenOddRule, ipe::ELabelStyle, ipe::ETextStyle, ipe::ETransformationsRigidMotions, ipe::ETransformationsTranslations, ipe::EWindRule, ipe::String::find(), ipe::Repository::get(), ipe::Tiling::iAngle, ipe::BitmapFinder::iBitmaps, ipe::Effect::iDuration, ipe::Effect::iEffect, ipe::Gradient::iExtend, ipe::Gradient::iMatrix, ipe::Gradient::iRadius, ipe::Matrix::isIdentity(), ipe::Tiling::iStep, ipe::Gradient::iStops, ipe::Effect::iTransitionTime, ipe::Gradient::iType, ipe::Gradient::iV, ipe::Tiling::iWidth, ipe::kind_names, ipe::Bitmap::objNum(), ipe::Stream::putXmlString(), ipe::Text::saveAlignment(), ipe::Bitmap::saveAsXml(), ipe::size(), ipe::String::substr(), and ipe::Repository::toString().

## ◆ allNames()

void StyleSheet::allNames | ( | Kind | kind,
|  | AttributeSeq & | 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.

References ipe::EEffect, ipe::EGradient, ipe::ESymbol, and ipe::ETiling.

## ◆ isStandard()

bool ipe::StyleSheet::isStandard | ( |  | ) | const
| inline

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

## ◆ preamble()

String ipe::StyleSheet::preamble | ( |  | ) | const
| inline

Return Latex preamble.

## ◆ setPreamble()

void ipe::StyleSheet::setPreamble | ( | const String & | str | ) |
| inline

Set LaTeX preamble.

Referenced by ipe::ImlParser::parseStyle().

## ◆ layout()

const Layout * StyleSheet::layout | ( |  | ) | const

Return page layout (or 0 if none defined).

## ◆ setLayout()

void StyleSheet::setLayout | ( | const Layout & | margins | ) |

Set page layout.

Referenced by ipe::ImlParser::parseStyle().

## ◆ textPadding()

const TextPadding * StyleSheet::textPadding | ( |  | ) | const

Return text object padding (for bbox computation).

## ◆ setTextPadding()

void StyleSheet::setTextPadding | ( | const TextPadding & | pad | ) |

Set padding for text object bbox computation.

Referenced by ipe::ImlParser::parseStyle().

## ◆ titleStyle()

const StyleSheet::TitleStyle * StyleSheet::titleStyle | ( |  | ) | const

Return title style (or 0 if none defined).

## ◆ setTitleStyle()

void StyleSheet::setTitleStyle | ( | const TitleStyle & | ts | ) |

Set style of page titles.

Referenced by ipe::ImlParser::parseStyle().

## ◆ pageNumberStyle()

const StyleSheet::PageNumberStyle * StyleSheet::pageNumberStyle | ( |  | ) | const

Return page number style.

## ◆ setPageNumberStyle()

void StyleSheet::setPageNumberStyle | ( | const PageNumberStyle & | pns | ) |

Set style of page numbering.

Referenced by ipe::ImlParser::parseStyle().

## ◆ setLineCap()

void StyleSheet::setLineCap | ( | TLineCap | s | ) |

Set line cap.

Referenced by ipe::ImlParser::parseStyle().

## ◆ setLineJoin()

void StyleSheet::setLineJoin | ( | TLineJoin | s | ) |

Set line join.

Referenced by ipe::ImlParser::parseStyle().

## ◆ setFillRule()

void StyleSheet::setFillRule | ( | TFillRule | s | ) |

Set fill rule.

Referenced by ipe::ImlParser::parseStyle().

## ◆ lineCap()

TLineCap ipe::StyleSheet::lineCap | ( |  | ) | const
| inline

Return line cap.

## ◆ lineJoin()

TLineJoin ipe::StyleSheet::lineJoin | ( |  | ) | const
| inline

Return line join.

## ◆ fillRule()

TFillRule ipe::StyleSheet::fillRule | ( |  | ) | const
| inline

Return path fill rule.

## ◆ name()

String ipe::StyleSheet::name | ( |  | ) | const
| inline

Return name of style sheet.

## ◆ setName()

void ipe::StyleSheet::setName | ( | const String & | name | ) |
| inline

Set name of style sheet.

Referenced by ipe::ImlParser::parseStyle().

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

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