string LatexGenerator::getAttributes(const string & elemName, const ElementStyle &elem) { ostringstream s; s << "\\newcommand{\\hl" << elemName << "}[1]{\\textcolor[rgb]{" << elem.getColour().getRed(LATEX) << "," << elem.getColour().getGreen(LATEX) << "," << elem.getColour().getBlue(LATEX) << "}{"; if (elem.isBold()) s << "\\bf{"; if (elem.isItalic()) s << "\\it{"; s <<"#1"; if (elem.isBold()) s << "}"; if (elem.isItalic()) s << "}"; s <<"}}\n"; return s.str(); }
string RtfGenerator::getCloseTag ( const ElementStyle &elem ) { ostringstream s; if ( elem.isBold() ) s << "\\b0 "; if ( elem.isItalic() ) s << "\\i0 "; if ( elem.isUnderline() ) s << "\\ul0 "; s << "}}"; return s.str(); }
string RtfGenerator::getOpenTag(int styleNumber,const ElementStyle & elem) { ostringstream s; s << "{\\cf"<<(styleNumber+2)<<"{"; if (elem.isBold()) s << "\\b "; if (elem.isItalic()) s << "\\i "; if (elem.isUnderline()) s << "\\ul "; return s.str(); }
string PangoGenerator::getAttributes ( const ElementStyle & elem ) { ostringstream s; s << "foreground=\"#" << ( elem.getColour().getRed ( HTML ) ) << ( elem.getColour().getGreen ( HTML ) ) << ( elem.getColour().getBlue ( HTML ) ) << "\"" << ( elem.isBold() ? " weight=\"bold\"" :"" ) << ( elem.isItalic() ? " style=\"italic\"" :"" ) << ( elem.isUnderline() ? " underline=\"single\"" :"" ); return s.str(); }
string RtfGenerator::getCharStyle ( int styleNumber,const ElementStyle &elem, const string&styleName ) { ostringstream s; s << "{\\*\\cs"<< ( styleNumber+2 ) <<"\\additive\\cf"<< ( styleNumber+2 ) << "\\f1\\fs"; int fontSize=0; StringTools::str2num<int> ( fontSize, this->getBaseFontSize(), std::dec ); s << ( ( fontSize ) ? fontSize*2: 20 ); // RTF needs double amount if ( elem.isBold() ) s << "\\b"; if ( elem.isItalic() ) s << "\\i"; if ( elem.isUnderline() ) s << "\\ul"; s << "\\sbasedon222\\snext0 "<< styleName << ";}\n"; return s.str(); }
string ODTGenerator::getAttributes ( const string & elemName, const ElementStyle & elem ) { ostringstream s; s << "<style:style style:name=\""<<elemName<<"\" style:family=\"text\">\n" << "<style:text-properties fo:color=\"#" << ( elem.getColour().getRed ( HTML ) ) << ( elem.getColour().getGreen ( HTML ) ) << ( elem.getColour().getBlue ( HTML ) ) << "\"" << ( elem.isBold() ? " fo:font-weight=\"bold\"" :"" ) << ( elem.isItalic() ? " fo:font-style=\"italic\"" :"" ) << ( elem.isUnderline() ? " style:text-underline-style=\"solid\" style:text-underline-width=\"auto\" style:text-underline-color=\"font-color\"" :"" ) <<"/>\n</style:style>\n" ; return s.str(); }
string HtmlGenerator::getAttributes(const string & elemName, const ElementStyle & elem) { ostringstream s; if (!elemName.empty()) { s << "."<<cssClassName<<"."<<elemName<<" { "; } s << "color:#" << (elem.getColour().getRed(HTML)) << (elem.getColour().getGreen(HTML)) << (elem.getColour().getBlue(HTML)) << ( elem.isBold() ? "; font-weight:bold" :"" ) << ( elem.isItalic() ? "; font-style:italic" :"" ) << ( elem.isUnderline()? "; text-decoration:underline" :"" ); if (!elemName.empty()) { s << "; }\n" ; } return s.str(); }
string XmlGenerator::getAttributes ( const string & elemName, const ElementStyle & elem ) { ostringstream s; s << "\t<class name=\"" << elemName <<"\" color=\"" << ( elem.getColour().getRed ( XML ) ) << ( elem.getColour().getGreen ( XML ) ) << ( elem.getColour().getBlue ( XML ) ) << "\" bold=\"" << ( elem.isBold() ? "true" :"false" ) << "\" italic=\"" << ( elem.isItalic() ? "true" :"false" ) << "\" underline=\"" << ( elem.isUnderline() ? "true" :"false" ) << "\" />\n" ; return s.str(); }