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.
IpeStyleSheet::IpeStyleSheet | ( | IpeRepository * | rep | ) |
The default constructor creates an empty style sheet.
IpeStyleSheet::~IpeStyleSheet | ( | ) |
Destructor.
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 | attr | ) | const |
Find a template object with given name.
If attr is null, returns 0.
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, | |
bool | saveBitmaps = false | |||
) | 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::setLayout | ( | const IpeLayout & | margins | ) |
Set page layout.
IpeLayout IpeStyleSheet::findLayout | ( | ) | const |
Find text margins in style sheet cascade.
void IpeStyleSheet::setTitleStyle | ( | const STitleStyle & | ts | ) |
Set style of page titles.
IpeStyleSheet::STitleStyle IpeStyleSheet::findTitleStyle | ( | ) | const |
Get style of page titles.
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.
void IpeStyleSheet::SetStrokeStyle | ( | IpeStrokeStyle | s | ) |
Set line cap, line join, and wind rule.
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).