Пример #1
0
string HtmlGenerator::getHeader()
{
  ostringstream os;
  os << getHeaderStart(docTitle);
  if (!useInlineCSS){
	if (includeStyleDef) {
	os << "<style type=\"text/css\">\n<!--\n";
	os << getStyleDefinition();
	os << CodeGenerator::readUserStyleDef();
	os << "//-->\n</style>\n";
	} else  {
	os << "<link rel=\"stylesheet\" type=\"text/css\" href=\""
		<< getStyleOutputPath()
		<< "\">\n";
	}
	os << "</head>\n<body class=\"" << cssClassName
           << "\">\n";
  } else {
	os << "</head>\n<body style=\""
	<< "background-color:#"
	<< (docStyle.getBgColour().getRed(HTML))
	<< (docStyle.getBgColour().getGreen(HTML))
	<< (docStyle.getBgColour().getBlue(HTML))
        << "\">\n";
  }

  return os.str();
}
Пример #2
0
string LatexGenerator::getHeader()
{
  ostringstream os;

  os << "\\documentclass{article}\n"
     << "\\usepackage{color}\n"
     << "\\usepackage{alltt}\n";

  if (StringTools::lowerCase(encoding)=="utf-8"){
     os << "\\usepackage{ucs}\n\\usepackage[utf8x]{inputenc}\n";
  } else if (encodingDefined()){
     os << "\\usepackage[latin1]{inputenc}\n";
  }

  if (langInfo.getSyntaxHighlight()) {
    if (includeStyleDef) {
      os << "\n"<<getStyleDefinition();
      os << CodeGenerator::readUserStyleDef();
    }  else  {
      os << "\n\\input {"
         << getStyleOutputPath()
         << "}\n";
    }
  }

  os << "\n\\title{" << docTitle << "}\n"
     << "\\begin{document}\n"
     << "\\pagecolor{bgcolor}\n";
  return os.str();
}
Пример #3
0
	string SVGGenerator::getHeader()
	{
		ostringstream header;
		header << "<?xml version=\"1.0\"";
		if ( encodingDefined() )
		{
			header << " encoding=\"" << encoding << "\"";
		}
		header << "?>\n";
		if ( !includeStyleDef )
		{
			header  << "<?xml-stylesheet type=\"text/css\" href=\""
			<< getStyleOutputPath()
			<< "\"?>\n";
		}
		header << "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.2//EN\" "
		<< "\"http://www.w3.org/Graphics/SVG/1.2/DTD/svg12.dtd\">\n";
		header << "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.2\" "
		<< "baseProfile=\"full\" xml:space=\"preserve\"";
		if ( width.size() ) header << " width=\""<<width<<"\"";
		if ( height.size() ) header << " height=\""<<height<<"\"";
		//viewBox=\"0 0 800 600\"
		header << ">\n<desc>" << docTitle << "</desc>\n";
		if ( includeStyleDef )
		{
			header << "<defs>\n";
			header << getStyleDefinition();
			header << "\n</defs>\n";
		}
		return header.str();
	}