本文整理汇总了C++中Stylesheet类的典型用法代码示例。如果您正苦于以下问题:C++ Stylesheet类的具体用法?C++ Stylesheet怎么用?C++ Stylesheet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Stylesheet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
void LessStylesheet::process(Stylesheet &s, ProcessingContext &context) {
std::list<Extension>* extensions;
std::list<Ruleset*>::iterator r_it;
std::list<Extension>::iterator e_it;
context.pushScope(variables);
this->context = &context;
Stylesheet::process(s);
context.popScope();
// post processing
extensions = &context.getExtensions();
for (r_it = s.getRulesets().begin();
r_it != s.getRulesets().end();
r_it++) {
for (e_it = extensions->begin();
e_it != extensions->end();
e_it++) {
(*e_it).updateSelector((*r_it)->getSelector());
}
}
}
示例2: setOutputStyle
/*!
* \author Anders Fernström
* \date 2006-04-21
*
* \brief Set the output style
*/
void InputCell::setOutputStyle()
{
// Set the correct style for the QTextEdit output_
output_->selectAll();
Stylesheet *sheet = Stylesheet::instance( "stylesheet.xml" );
CellStyle style = sheet->getStyle( "Output" );
if( style.name() != "null" )
{
output_->setAlignment( (Qt::AlignmentFlag)style.alignment() );
output_->mergeCurrentCharFormat( (*style.textCharFormat()) );
output_->document()->rootFrame()->setFrameFormat( (*style.textFrameFormat()) );
}
else
{
// 2006-01-30 AF, add message box
QString msg = "No Output style defened, please define a Output style in stylesheet.xml";
QMessageBox::warning( 0, "Warning", msg, "OK" );
}
QTextCursor cursor = output_->textCursor();
cursor.clearSelection();
output_->setTextCursor( cursor );
}
示例3: writeOutput
void writeOutput (ostream &out, LessStylesheet &stylesheet, bool format) {
Stylesheet css;
ProcessingContext context;
CssWriter *w1;
w1 = format ? new CssPrettyWriter(out) : new CssWriter(out);
try{
stylesheet.process(css, context);
} catch(ParseException* e) {
#ifdef WITH_LIBGLOG
LOG(ERROR) << e->getSource() << ": Line " << e->getLineNumber() << ", Column " <<
e->getColumn() << " Parse Error: " << e->what();
#else
cerr << e->getSource() << ": Line " << e->getLineNumber() << ", Column " <<
e->getColumn() << " Parse Error: " << e->what();
#endif
return;
} catch(exception* e) {
#ifdef WITH_LIBGLOG
LOG(ERROR) << "Error: " << e->what();
#else
cerr << "Error: " << e->what();
#endif
return;
}
css.write(*w1);
out << endl;
delete w1;
}
示例4: stylesheet_new_style
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();
}
示例5: stylesheet_delete_style
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();
}
示例6: stylesheet_save_style
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();
}
示例7: stylesheet_load_style
void stylesheet_load_style(const ustring & stylesheet, Style& style_to_load)
/*
Reads one Style.
stylesheet: which stylesheet to read from. If no stylesheet is given, it reads from the template.
style: the Style object to read. The marker is given in it.
*/
{
extern Styles * styles;
Stylesheet * sheet = styles->stylesheet (stylesheet);
Style * style = sheet->style (style_to_load.marker);
if (style) { style_to_load = (*style); } // deep copy
}
示例8: setStyle
/*!
* \author Anders Fernström
* \date 2005-10-28
*
* \brief Set cell style
*
* \param stylename The style name of the style that is to be applyed to the cell
*/
void Cell::setStyle(const QString &stylename)
{
Stylesheet *sheet = Stylesheet::instance( "stylesheet.xml" );
CellStyle style = sheet->getStyle( stylename );
if( style.name() != "null" )
setStyle( style );
else
{
cout << "Can't set style, style name: " << stylename.toStdString() << " is not valid" << endl;
}
}
示例9: TEST
// At rules
TEST(CssParserTest, AtRule) {
istringstream in("@import somefile;");
CssTokenizer t(&in);
CssParser p(&t);
Stylesheet s;
AtRule* at;
p.parseStylesheet(&s);
ASSERT_EQ(1, s.getAtRules()->size());
at = s.getAtRules()->at(0);
ASSERT_STREQ("@import", at->getKeyword()->c_str());
ASSERT_STREQ("somefile", at->getRule()->toString()->c_str());
}
示例10: getLessStylesheet
void LessAtRule::process(Stylesheet &s) {
AtRule* target = s.createAtRule(getKeyword());
target->setRule(getRule());
getLessStylesheet()->getContext()->processValue(target->getRule());
}
示例11: ElemTemplateElement
XALAN_CPP_NAMESPACE_BEGIN
ElemTextLiteral::ElemTextLiteral(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
XalanFileLoc lineNumber,
XalanFileLoc columnNumber,
const XMLCh* ch,
XalanDOMString::size_type start,
XalanDOMString::size_type length,
bool fPreserveSpace,
bool fDisableOutputEscaping) :
ElemTemplateElement(
constructionContext,
stylesheetTree,
StylesheetConstructionContext::ELEMNAME_TEXT_LITERAL_RESULT,
stylesheetTree.getBaseIdentifier(),
lineNumber,
columnNumber),
m_isWhitespace(isXMLWhitespace(ch, start, length)),
// Always null-terminate our buffer, since we may need it that way.
m_ch(constructionContext.allocateXalanDOMCharVector(ch + start, length, true)),
m_length(length)
{
disableOutputEscaping(fDisableOutputEscaping);
preserveSpace(fPreserveSpace);
}
示例12: if
void
ElemVariable::addToStylesheet(
StylesheetConstructionContext& constructionContext,
Stylesheet& theStylesheet)
{
// Processing a top-level element only...
if (&theStylesheet != &getStylesheet())
{
constructionContext.error(
XalanMessageLoader::getMessage(XalanMessages::ElemVariableInstanceAddedToWrongStylesheet),
0,
this);
}
else if (getParentNodeElem() != 0)
{
constructionContext.error(
XalanMessageLoader::getMessage(XalanMessages::ElemVariableInstanceIsAlreadyParented),
0,
this);
}
else
{
theStylesheet.setTopLevelVariable(this);
m_isTopLevel = true;
}
}
示例13:
void
ElemTemplate::addToStylesheet(
StylesheetConstructionContext& constructionContext,
Stylesheet& theStylesheet)
{
theStylesheet.addTemplate(this, constructionContext);
}
示例14:
void
ElemAttributeSet::addToStylesheet(
StylesheetConstructionContext& /* constructionContext */,
Stylesheet& theStylesheet)
{
theStylesheet.getStylesheetRoot().addAttributeSet(*this);
}
示例15: getContext
void LessMediaQuery::process(Stylesheet &s) {
MediaQuery* query = s.createMediaQuery();
query->setSelector(*getSelector());
getContext()->processValue(query->getSelector());
LessStylesheet::process(*query, *parent->getContext());
}