string ODTGenerator::getHeader()
{
      string enc = "UTF-8";
     if ( encodingDefined() ) {
        enc = encoding;
    }
    ostringstream header;
    header << "<?xml version=\"1.0\" encoding=\""<<enc<<"\"?>\n"\
           "<office:document xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\" xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\""\
           " xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\" xmlns:table=\"urn:oasis:names:tc:opendocument:xmlns:table:1.0\""\
           " xmlns:draw=\"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\" xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\""\
           " xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\""\
           " xmlns:number=\"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0\" xmlns:svg=\"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0\""\
           " xmlns:chart=\"urn:oasis:names:tc:opendocument:xmlns:chart:1.0\" xmlns:dr3d=\"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0\""\
           " xmlns:math=\"http://www.w3.org/1998/Math/MathML\" xmlns:form=\"urn:oasis:names:tc:opendocument:xmlns:form:1.0\" xmlns:script=\"urn:oasis:names:tc:opendocument:xmlns:script:1.0\""\
           " xmlns:config=\"urn:oasis:names:tc:opendocument:xmlns:config:1.0\" xmlns:ooo=\"http://openoffice.org/2004/office\" xmlns:ooow=\"http://openoffice.org/2004/writer\""\
           " xmlns:oooc=\"http://openoffice.org/2004/calc\" xmlns:dom=\"http://www.w3.org/2001/xml-events\" xmlns:xforms=\"http://www.w3.org/2002/xforms\""\
           " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:rpt=\"http://openoffice.org/2005/report\""\
           " xmlns:of=\"urn:oasis:names:tc:opendocument:xmlns:of:1.2\" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\" xmlns:grddl=\"http://www.w3.org/2003/g/data-view#\""\
           " xmlns:tableooo=\"http://openoffice.org/2009/table\" xmlns:field=\"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0\""\
           " xmlns:formx=\"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0\" xmlns:css3t=\"http://www.w3.org/TR/css3-text/\" office:version=\"1.2\""\
           " office:mimetype=\"application/vnd.oasis.opendocument.text\">\n"\
           " <office:font-face-decls>\n"\
           "  <style:font-face style:name=\""<< getBaseFont()<<"\" svg:font-family=\""<< getBaseFont()<<"\" style:font-family-generic=\"modern\" style:font-pitch=\"fixed\"/>\n"\
           " </office:font-face-decls>\n";

    header << getStyleDefinition();

    header  << " <office:body>\n"
            << "  <office:text>\n"
            << "<text:p text:style-name=\"Standard\">";

    return header.str();
}
Exemple #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;
	}
Exemple #3
0
void GraphEditor::_btnBaseFont_clicked()
{
    bool valid;
    QFont fnt = QFontDialog::getFont(&valid, getBaseFont(), this);
    if(valid) {
        setBaseFont(fnt);
    }
}
void PangoGenerator::printBody()
{
    int fontSize=0;
    StringTools::str2num<int> ( fontSize, this->getBaseFontSize(), std::dec );

    *out << "<span size=\""<<( ( fontSize ) ? fontSize*1024: 10*1024 ) << "\" "
         << "font_family=\"" << getBaseFont() << "\""
         <<">";
    processRootState();
    *out << "</span>";
}
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;
}
Exemple #6
0
void StylesPlugin::setFonts()
{
    if (getSystemFonts()){
        if (m_saveBaseFont)
            QApplication::setFont(*m_saveBaseFont, true);
        if (m_saveMenuFont)
            QApplication::setFont(*m_saveMenuFont, true, "QPopupMenu");
    }else{
        setupDefaultFonts();
        QPopupMenu m;
        QApplication::setFont(FontEdit::str2font(getBaseFont(), *m_saveBaseFont), true);
        QApplication::setFont(FontEdit::str2font(getMenuFont(), *m_saveMenuFont), true, "QPopupMenu");
    }
}
	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;
	}