Пример #1
0
void stylesheet_new_style(const ustring & stylesheet, const ustring & marker)
// Adds a new style. Searches template for data.
{
  // Pointer to the styles object.
  extern Styles * styles;
  
  // The stylesheet to which to add data.
  Stylesheet * sheet = styles->stylesheet (stylesheet);
  
  // If the style is in the standard template, copy it over into the stylesheet.
  Stylesheet * standard = styles->stylesheet ("");
  for (unsigned int i = 0; i < standard->styles.size(); i++) {
    Style * style = standard->styles[i];
    if (style->marker == marker) {
      // Make deep copy and store it into the stylesheet.
      Style * newstyle = new Style (*style);
      sheet->insert (newstyle);
      sheet->save();
      return;
    }
  }

  // Create a default new style for the marker.
  Style *style = new Style(marker);
  sheet->insert (style);
  sheet->save();  
}
Пример #2
0
void stylesheet_save_style(const ustring & stylesheet, const Style & style_in)
{
  extern Styles * styles;
  Stylesheet * sheet = styles->stylesheet (stylesheet);
  Style * style_out = sheet->style (style_in.marker);
  if (style_out) { (*style_out) = style_in; } // deep copy
  sheet->save();
}
Пример #3
0
void stylesheet_delete_style(const ustring & stylesheet, const ustring & marker)
// Deletes a style.
{
  extern Styles * styles;
  Stylesheet * sheet = styles->stylesheet (stylesheet);
  sheet->erase (marker);
  sheet->save();
}
Пример #4
0
void stylesheet_save_style(const ustring & stylesheet, const ustring & marker, const ustring & name, const ustring & info, StyleType type, int subtype, double fontsize, const ustring & italic, const ustring & bold, const ustring & underline, const ustring & smallcaps, bool superscript, const ustring & justification, double spacebefore, double spaceafter, double leftmargin, double rightmargin, double firstlineindent, bool spancolumns, unsigned int color, bool print, bool userbool1, bool userbool2, bool userbool3, int userint1, int userint2, int userint3, ustring userstring1, ustring userstring2, ustring userstring3)
// Saves style information.
{
  extern Styles * styles;
  Stylesheet * sheet = styles->stylesheet (stylesheet);
  Style * style = sheet->style(marker);
  style->name = name;
  style->info = info;
  style->type = type;
  style->subtype = subtype;
  style->fontsize = fontsize;
  style->italic = italic;
  style->bold = bold;
  style->underline = underline;
  style->smallcaps = smallcaps;
  style->superscript = superscript;
  style->justification = justification;
  style->spacebefore = spacebefore;
  style->spaceafter = spaceafter;
  style->leftmargin = leftmargin;
  style->rightmargin = rightmargin;
  style->firstlineindent = firstlineindent;
  style->spancolumns = spancolumns;
  style->color = color;
  style->print = print;
  style->userbool1 = userbool1;
  style->userbool2 = userbool2;
  style->userbool3 = userbool3;
  style->userint1 = userint1;
  style->userint2 = userint2;
  style->userint3 = userint3;
  style->userstring1 = userstring1;
  style->userstring2 = userstring2;
  style->userstring3 = userstring3;
  sheet->save();  
}