Esempio n. 1
0
string LatexGenerator::getStyleDefinition()
{
    if (styleDefinitionCache.empty()){
        ostringstream os;
        os << getAttributes("std", docStyle.getDefaultStyle());
        os << getAttributes("num", docStyle.getNumberStyle());
        os << getAttributes("esc", docStyle.getEscapeCharStyle());
        os << getAttributes("str", docStyle.getStringStyle());
        os << getAttributes("dstr", docStyle.getDirectiveStringStyle());
        os << getAttributes("slc", docStyle.getSingleLineCommentStyle());
        os << getAttributes("com", docStyle.getCommentStyle());
        os << getAttributes("dir", docStyle.getDirectiveStyle());
        os << getAttributes("sym", docStyle.getSymbolStyle());
        os << getAttributes("line", docStyle.getLineStyle());

        KeywordStyles styles = docStyle.getKeywordStyles();
        for (KSIterator it=styles.begin(); it!=styles.end(); it++){
            os << getAttributes(it->first, it->second);
        }
        os << "\\definecolor{bgcolor}{rgb}{"
                << docStyle.getBgColour().getRed(LATEX) << ","
                << docStyle.getBgColour().getGreen(LATEX) << ","
                << docStyle.getBgColour().getBlue(LATEX)
                << "}\n";
/*
        os << "\\oddsidemargin -3mm\n\\textwidth 165,2truemm\n"
                << "\\topmargin 0truept\n\\headheight 0truept\n"
                << "\\headsep 0truept\n\\textheight 230truemm\n";
*/
        styleDefinitionCache=os.str();
    }
    return styleDefinitionCache;
}
Esempio n. 2
0
	string XmlGenerator::getStyleDefinition()
	{
		if ( styleDefinitionCache.empty() )
		{
			ostringstream os;
			os << "\n<style>\n"
			<< "\t<bgcolor value=\""
			<< ( docStyle.getBgColour().getRed ( XML ) )
			<< ( docStyle.getBgColour().getGreen ( XML ) )
			<< ( docStyle.getBgColour().getBlue ( XML ) )
			<< "\" />\n";
			os << "\t<font size=\"" << getBaseFontSize();
			os << "\" family=\"" << getBaseFont() << "\" />\n";
			os << getAttributes ( STY_NAME_STD, docStyle.getDefaultStyle() )
			<< getAttributes ( STY_NAME_NUM, docStyle.getNumberStyle() )
			<< getAttributes ( STY_NAME_ESC, docStyle.getEscapeCharStyle() )
			<< getAttributes ( STY_NAME_STR, docStyle.getStringStyle() )
			<< getAttributes ( STY_NAME_DST, docStyle.getDirectiveStringStyle() )
			<< getAttributes ( STY_NAME_SLC, docStyle.getSingleLineCommentStyle() )
			<< getAttributes ( STY_NAME_COM, docStyle.getCommentStyle() )
			<< getAttributes ( STY_NAME_DIR, docStyle.getDirectiveStyle() )
			<< getAttributes ( STY_NAME_SYM, docStyle.getSymbolStyle() )
			<< getAttributes ( STY_NAME_LIN, docStyle.getLineStyle() );

			KeywordStyles styles = docStyle.getKeywordStyles();
			for ( KSIterator it=styles.begin(); it!=styles.end(); it++ )
			{
				os << getAttributes ( it->first, it->second );
			}
			os << "</style>\n";
			styleDefinitionCache=os.str();
		}
		return styleDefinitionCache;
	}
Esempio n. 3
0
string ODTGenerator::getStyleDefinition()
{
    if ( styleDefinitionCache.empty() ) {
        ostringstream os;

        os  << "<office:styles>\n<style:style style:name=\"Standard\" style:family=\"paragraph\" style:class=\"text\">\n"
            << "  <style:text-properties style:font-name=\""<< getBaseFont()<<"\" fo:font-size=\""<<getBaseFontSize()<<"pt\"/>"
            << "</style:style>\n</office:styles>"
            << "<office:automatic-styles>\n";

        os << getAttributes ( STY_NAME_STD, docStyle.getDefaultStyle() )
           << getAttributes ( STY_NAME_NUM, docStyle.getNumberStyle() )
           << getAttributes ( STY_NAME_ESC, docStyle.getEscapeCharStyle() )
           << getAttributes ( STY_NAME_STR, docStyle.getStringStyle() )
           << getAttributes ( STY_NAME_DST, docStyle.getPreProcStringStyle() )
           << getAttributes ( STY_NAME_SLC, docStyle.getSingleLineCommentStyle() )
           << getAttributes ( STY_NAME_COM, docStyle.getCommentStyle() )
           << getAttributes ( STY_NAME_DIR, docStyle.getPreProcessorStyle() )
           << getAttributes ( STY_NAME_SYM, docStyle.getOperatorStyle() )
           << getAttributes ( STY_NAME_IPL, docStyle.getInterpolationStyle() )
           << getAttributes ( STY_NAME_LIN, docStyle.getLineStyle() );

        KeywordStyles styles = docStyle.getKeywordStyles();
        for ( KSIterator it=styles.begin(); it!=styles.end(); it++ ) {
            os << getAttributes (it->first, it->second );
        }

        os << "<style:page-layout style:name=\"pm1\">"
           << "<style:page-layout-properties fo:page-width=\"21.001cm\" fo:page-height=\"29.7cm\" style:num-format=\"1\""
           << " style:print-orientation=\"portrait\" fo:margin=\"2cm\" fo:margin-top=\"2cm\" fo:margin-bottom=\"2cm\" fo:margin-left=\"2cm\" fo:margin-right=\"2cm\" "
           << "fo:background-color=\"#"
           << ( docStyle.getBgColour().getRed ( HTML ) )
           << ( docStyle.getBgColour().getGreen ( HTML ) )
           << ( docStyle.getBgColour().getBlue ( HTML ) )
           << "\" style:writing-mode=\"lr-tb\" style:footnote-max-height=\"0cm\">\n"
           << " <style:background-image/>\n"
           << " <style:footnote-sep style:width=\"0.018cm\" style:distance-before-sep=\"0.101cm\" style:distance-after-sep=\"0.101cm\" style:line-style=\"solid\""
           << " style:adjustment=\"left\" style:rel-width=\"25%\" style:color=\"#000000\"/>"
           << "</style:page-layout-properties>\n"
           << "<style:header-style/>\n"
           << "<style:footer-style/>\n"
           << "</style:page-layout>\n"
           << "</office:automatic-styles>\n"
           << "<office:master-styles>\n"
           << " <style:master-page style:name=\"Standard\" style:page-layout-name=\"pm1\"/>\n"
           << "</office:master-styles>\n";

        styleDefinitionCache=os.str();
    }
    return styleDefinitionCache;
}
Esempio n. 4
0
string HtmlGenerator::getStyleDefinition()
{
  if (styleDefinitionCache.empty()){
    ostringstream os;
    os << "body."<<cssClassName<<"\t{ background-color:#"
       << (docStyle.getBgColour().getRed(HTML))
       << (docStyle.getBgColour().getGreen(HTML))
       << (docStyle.getBgColour().getBlue(HTML))
       << "; }\n";
    os << "pre."<<cssClassName<<"\t{ color:#"
       << (docStyle.getDefaultStyle().getColour().getRed(HTML))
       << (docStyle.getDefaultStyle().getColour().getGreen(HTML))
       << (docStyle.getDefaultStyle().getColour().getBlue(HTML)  )
       << "; background-color:#"
       << (docStyle.getBgColour().getRed(HTML))
       << (docStyle.getBgColour().getGreen(HTML))
       << (docStyle.getBgColour().getBlue(HTML))
       << "; font-size:" << this->getBaseFontSize();

    os << "pt; font-family:'" << this->getBaseFont() << "';}\n";

    if (orderedList) {
       os << "li."<<cssClassName<<"\t{ margin-bottom:-"<<this->getBaseFontSize()<<"pt; }\n";
    }

    os << getAttributes("num", docStyle.getNumberStyle())
       << getAttributes("esc", docStyle.getEscapeCharStyle())
       << getAttributes("str", docStyle.getStringStyle())
       << getAttributes("dstr", docStyle.getDirectiveStringStyle())
       << getAttributes("slc", docStyle.getSingleLineCommentStyle())
       << getAttributes("com", docStyle.getCommentStyle())
       << getAttributes("dir", docStyle.getDirectiveStyle())
       << getAttributes("sym", docStyle.getSymbolStyle())
       << getAttributes("line", docStyle.getLineStyle());

    os << "."<<cssClassName<<".mark\t{ background-color:#"
       << (docStyle.getMarkLineColour().getRed(HTML))
       << (docStyle.getMarkLineColour().getGreen(HTML))
       << (docStyle.getMarkLineColour().getBlue(HTML))
       << ";}\n";

    KeywordStyles styles = docStyle.getKeywordStyles();
    for (KSIterator it=styles.begin(); it!=styles.end(); it++){
      os << getAttributes(it->first, it->second);
    }
    styleDefinitionCache=os.str();
  }
  return styleDefinitionCache;
}
	string SVGGenerator::getStyleDefinition()
	{
		if ( styleDefinitionCache.empty() )
		{
			ostringstream os;
			if ( includeStyleDef )
			{
				os << "<style type=\"text/css\">\n"
				<< "<![CDATA[\n";
			}
			os << "rect { fill:#"
			<< ( docStyle.getBgColour().getRed ( SVG ) )
			<< ( docStyle.getBgColour().getGreen ( SVG ) )
			<< ( docStyle.getBgColour().getBlue ( SVG ) )
			<< "; } \n";
			os << "g { font-size: " << getBaseFontSize();
			os << "; font-family: \"" << getBaseFont() << "\"; }\n";
			os << getAttributes ( "text", docStyle.getDefaultStyle() )
			<< getAttributes ( "tspan."+STY_NAME_NUM, docStyle.getNumberStyle() )
			<< getAttributes ( "tspan."+STY_NAME_ESC, docStyle.getEscapeCharStyle() )
			<< getAttributes ( "tspan."+STY_NAME_STR, docStyle.getStringStyle() )
			<< getAttributes ( "tspan."+STY_NAME_DST, docStyle.getPreProcStringStyle() )
			<< getAttributes ( "tspan."+STY_NAME_SLC, docStyle.getSingleLineCommentStyle() )
			<< getAttributes ( "tspan."+STY_NAME_COM, docStyle.getCommentStyle() )
			<< getAttributes ( "tspan."+STY_NAME_DIR, docStyle.getPreProcessorStyle() )
			<< getAttributes ( "tspan."+STY_NAME_SYM, docStyle.getOperatorStyle() )
			<< getAttributes ( "tspan."+STY_NAME_IPL, docStyle.getInterpolationStyle() )
			<< getAttributes ( "tspan."+STY_NAME_LIN, docStyle.getLineStyle() );

			KeywordStyles styles = docStyle.getKeywordStyles();
			for ( KSIterator it=styles.begin(); it!=styles.end(); it++ )
			{
				os << getAttributes ( "tspan."+it->first, it->second );
			}
			if ( includeStyleDef )
			{
				os << "]]>\n"
				<< "</style>";
			}
			styleDefinitionCache=os.str();
		}
		return styleDefinitionCache;
	}