本文整理汇总了C++中KoXmlWriter::addAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ KoXmlWriter::addAttribute方法的具体用法?C++ KoXmlWriter::addAttribute怎么用?C++ KoXmlWriter::addAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KoXmlWriter
的用法示例。
在下文中一共展示了KoXmlWriter::addAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveOdf
void DateVariable::saveOdf(KoShapeSavingContext & context)
{
// TODO support data-style-name
KoXmlWriter *writer = &context.xmlWriter();
if (m_displayType == Time) {
writer->startElement("text:time", false);
} else {
writer->startElement("text:date", false);
}
if (!m_definition.isEmpty()) {
QString styleName = KoOdfNumberStyles::saveOdfDateStyle(context.mainStyles(), m_definition, false);
writer->addAttribute("style:data-style-name", styleName);
}
if (m_type == Fixed) {
writer->addAttribute("text:fixed", "true");
// only write as much information as we read: just date/time or datetime
if (m_displayType == Time) {
const QString timeValue = (m_valueType == DateTime) ?
m_datetime.toString(Qt::ISODate) :
m_datetime.time().toString(Qt::ISODate);
writer->addAttribute("text:time-value", timeValue);
} else {
const QString dateValue = (m_valueType == DateTime) ?
m_datetime.toString(Qt::ISODate) :
m_datetime.date().toString(Qt::ISODate);
writer->addAttribute("text:date-value", dateValue);
}
} else {
writer->addAttribute("text:fixed", "false");
}
writer->addTextNode(value());
writer->endElement();
}
示例2: writePartGroup
static void writePartGroup(KoXmlWriter& w, int id, PartGroup* group)
{
w.startElement("music:part-group");
w.addAttribute("type", "start");
w.addAttribute("number", id);
if (!group->name().isNull()) {
w.startElement("music:group-name");
w.addTextNode(group->name());
w.endElement(); // music:group-name
}
if (!group->shortName(false).isNull()) {
w.startElement("music:group-abbreviation");
w.addTextNode(group->shortName());
w.endElement(); // music:group-abbreviation
}
if (group->symbol() != PartGroup::None) {
w.startElement("music:group-symbol");
switch (group->symbol()) {
case PartGroup::None: w.addTextNode("none"); break;
case PartGroup::Brace: w.addTextNode("brace"); break;
case PartGroup::Line: w.addTextNode("line"); break;
case PartGroup::Bracket: w.addTextNode("bracket"); break;
}
w.endElement(); // music:group-symbol
}
w.startElement("music:group-barline");
w.addTextNode(group->commonBarLines() ? "yes" : "no");
w.endElement(); // music:group-barline
w.endElement(); // music:part-group
}
示例3: save
void CompositeEffect::save(KoXmlWriter &writer)
{
writer.startElement(CompositeEffectId);
saveCommonAttributes(writer);
switch (m_operation) {
case CompositeOver:
writer.addAttribute("operator", "over");
break;
case CompositeIn:
writer.addAttribute("operator", "in");
break;
case CompositeOut:
writer.addAttribute("operator", "out");
break;
case CompositeAtop:
writer.addAttribute("operator", "atop");
break;
case CompositeXor:
writer.addAttribute("operator", "xor");
break;
case Arithmetic:
writer.addAttribute("operator", "arithmetic");
writer.addAttribute("k1", QString("%1").arg(m_k[0]));
writer.addAttribute("k2", QString("%1").arg(m_k[1]));
writer.addAttribute("k3", QString("%1").arg(m_k[2]));
writer.addAttribute("k4", QString("%1").arg(m_k[3]));
break;
}
writer.addAttribute("in2", inputs().at(1));
writer.endElement();
}
示例4: saveOdf
void KoRow::saveOdf(KoXmlWriter& writer, KoGenStyles& styles)
{
writer.startElement("table:table-row");
if(m_style) {
writer.addAttribute("table:style-name", m_style->saveOdf(styles));
}
if(m_defaultCellStyle) {
writer.addAttribute("table:default-cell-style-name", m_defaultCellStyle->saveOdf(styles));
}
writer.addAttribute("table:visibility", visibilityMap.value(m_visibility));
}
示例5: save
void FloodEffect::save(KoXmlWriter &writer)
{
writer.startElement(FloodEffectId);
saveCommonAttributes(writer);
writer.addAttribute("flood-color", m_color.name());
if (m_color.alpha() < 255)
writer.addAttribute("flood-opacity", QString("%1").arg(m_color.alphaF()));
writer.endElement();
}
示例6: saveOdf
void KoInlineNote::saveOdf(KoShapeSavingContext & context)
{
KoXmlWriter *writer = &context.xmlWriter();
QTextDocument *document = new QTextDocument();
KoTextDocument textDocument(document);
Q_ASSERT(!d->styleManager.isNull());
textDocument.setStyleManager(d->styleManager.data());
QTextCursor cursor(document);
cursor.insertFragment(d->text);
if (d->type == Footnote || d->type == Endnote) {
writer->startElement("text:note", false);
if (d->type == Footnote)
writer->addAttribute("text:note-class", "footnote");
else
writer->addAttribute("text:note-class", "endnote");
writer->addAttribute("text:id", d->id);
writer->startElement("text:note-citation", false);
if (!autoNumbering())
writer->addAttribute("text:label", d->label);
writer->addTextNode(d->label);
writer->endElement();
writer->startElement("text:note-body", false);
KoTextWriter textWriter(context);
textWriter.write(document, 0);
writer->endElement();
writer->endElement();
}
else if (d->type == Annotation) {
writer->startElement("office:annotation");
if (!d->author.isEmpty()) {
writer->startElement("dc:creator");
writer->addTextNode(d->author);
writer->endElement();
}
if (d->date.isValid()) {
writer->startElement("dc:date");
writer->addTextSpan(d->date.toString(Qt::ISODate));
writer->endElement();
}
KoTextWriter textWriter(context);
textWriter.write(document, 0);
writer->endElement();
}
delete document;
}
示例7: save
void BlurEffect::save(KoXmlWriter &writer)
{
writer.startElement(BlurEffectId);
saveCommonAttributes(writer);
if (m_deviation.x() != m_deviation.y()) {
writer.addAttribute("stdDeviation", QString("%1, %2").arg(m_deviation.x()).arg(m_deviation.y()));
} else {
writer.addAttribute("stdDeviation", m_deviation.x());
}
writer.endElement();
}
示例8:
void Ko3dScene::Lightsource::saveOdf(KoXmlWriter &writer) const
{
writer.startElement("dr3d:light");
writer.addAttribute("dr3d:diffuse-color", m_diffuseColor.name());
writer.addAttribute("dr3d:direction", (QString("(%1 %2 %3)")
.arg(m_direction.x(), 0, 'f', 11)
.arg(m_direction.y(), 0, 'f', 11)
.arg(m_direction.z(), 0, 'f', 11)));
writer.addAttribute("dr3d:enabled", m_enabled);
writer.addAttribute("dr3d:specular", m_specular);
writer.endElement(); // dr3d:light
}
示例9: save
void ColorMatrixEffect::save(KoXmlWriter &writer)
{
writer.startElement(ColorMatrixEffectId);
saveCommonAttributes(writer);
switch (m_type) {
case Matrix: {
writer.addAttribute("type", "matrix");
QString matrix;
for (int r = 0; r < MatrixRows; ++r) {
for (int c = 0; c < MatrixCols; ++c) {
matrix += QString("%1 ").arg(m_matrix[r*MatrixCols+c]);
}
}
writer.addAttribute("values", matrix);
}
break;
case Saturate:
writer.addAttribute("type", "saturate");
writer.addAttribute("values", QString("%1").arg(m_value));
break;
case HueRotate:
writer.addAttribute("type", "hueRotate");
writer.addAttribute("values", QString("%1").arg(m_value));
break;
case LuminanceAlpha:
writer.addAttribute("type", "luminanceToAlpha");
break;
}
writer.endElement();
}
示例10: contentBuffer
QByteArray HancomWordImport::Private::createContent()
{
KoXmlWriter* contentWriter;
QByteArray contentData;
QBuffer contentBuffer( &contentData );
contentBuffer.open( QIODevice::WriteOnly );
contentWriter = new KoXmlWriter( &contentBuffer );
contentWriter->startDocument( "office:document-content" );
contentWriter->startElement( "office:document-content" );
contentWriter->addAttribute( "xmlns:office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0" );
contentWriter->addAttribute( "xmlns:style", "urn:oasis:names:tc:opendocument:xmlns:style:1.0" );
contentWriter->addAttribute( "xmlns:text", "urn:oasis:names:tc:opendocument:xmlns:text:1.0" );
contentWriter->addAttribute( "xmlns:table", "urn:oasis:names:tc:opendocument:xmlns:table:1.0" );
contentWriter->addAttribute( "xmlns:draw", "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" );
contentWriter->addAttribute( "xmlns:fo", "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" );
contentWriter->addAttribute( "xmlns:svg","urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" );
contentWriter->addAttribute( "office:version","1.0" );
contentWriter->startElement( "office:automatic-styles" );
contentWriter->endElement(); // office:automatic-style
// office:body
contentWriter->startElement( "office:body" );
contentWriter->startElement( "office:text" );
contentWriter->startElement( "text:sequence-decls" );
contentWriter->endElement(); // text:sequence-decls
for( int i = 0; i < paragraphs.count(); i++ )
{
QString text = paragraphs[i];
text.replace( '\r', ' ' );
contentWriter->startElement( "text:p" );
contentWriter->addTextNode( text );
contentWriter->endElement(); // text:p
}
contentWriter->endElement(); //office:text
contentWriter->endElement(); // office:body
contentWriter->endElement(); // office:document-content
contentWriter->endDocument();
delete contentWriter;
return contentData;
}
示例11: tableRowStart
void WordsTableHandler::tableRowStart(wvWare::SharedPtr<const wvWare::Word97::TAP> tap)
{
kDebug(30513) ;
if (m_row == -2) {
kWarning(30513) << "tableRowStart: tableStart not called previously!";
return;
}
Q_ASSERT(m_currentTable);
Q_ASSERT(!m_currentTable->name.isEmpty());
m_row++;
m_column = -1;
m_tap = tap;
KoXmlWriter* writer = currentWriter();
//kDebug(30513) << "tableRowStart row=" << m_row
// << ", number of cells: " << tap->itcMac;
KoGenStyle rowStyle(KoGenStyle::TableRowAutoStyle, "table-row");
//in case a header or footer is processed, save the style into styles.xml
if (document()->writingHeader()) {
rowStyle.setAutoStyleInStylesDotXml(true);
}
// The 6 BRC objects are for top, left, bottom, right,
// insidehorizontal, insidevertical (default values).
for (int i = 0; i < 6; i++) {
const wvWare::Word97::BRC& brc = tap->rgbrcTable[i];
//kDebug(30513) << "default border" << brc.brcType << (brc.dptLineWidth / 8.0);
m_borderStyle[i] = Conversion::setBorderAttributes(brc);
m_margin[i] = QString::number(brc.dptSpace) + "pt";
}
// We ignore brc.dptSpace (spacing), brc.fShadow (shadow), and brc.fFrame (?)
QString rowHeightString = QString::number(twipsToPt(qAbs(tap->dyaRowHeight)), 'f').append("pt");
if (tap->dyaRowHeight > 0) {
rowStyle.addProperty("style:min-row-height", rowHeightString);
} else if (tap->dyaRowHeight < 0) {
rowStyle.addProperty("style:row-height", rowHeightString);
}
if (tap->fCantSplit) {
rowStyle.addProperty("fo:keep-together", "always");
}
QString rowStyleName = m_mainStyles->insert(rowStyle, QLatin1String("row"));
//start table row in content
writer->startElement("table:table-row");
writer->addAttribute("table:style-name", rowStyleName.toUtf8());
}
示例12: writeSheet
void MusicXmlWriter::writeSheet(KoXmlWriter& w, Sheet* sheet, bool writeNamespaceDef)
{
// w.startDocument("score-partwise", "-//Recordare//DTD MusicXML 1.1 Partwise//EN",
// "http://www.musicxml.org/dtds/partwise.dtd");
w.startElement("music:score-partwise");
if (writeNamespaceDef) {
w.addAttribute("xmlns:music", "http://www.calligra.org/music");
}
w.addAttribute("version", "1.1");
w.startElement("music:part-list");
for (int i = 0; i < sheet->partCount(); i++) {
for (int pg = 0; pg < sheet->partGroupCount(); pg++) {
if (sheet->partGroup(pg)->firstPart() == i) {
writePartGroup(w, pg+1, sheet->partGroup(pg));
}
}
writePartDesc(w, i, sheet->part(i));
for (int pg = 0; pg < sheet->partGroupCount(); pg++) {
if (sheet->partGroup(pg)->lastPart() == i) {
w.startElement("music:part-group");
w.addAttribute("type", "stop");
w.addAttribute("number", pg+1);
w.endElement(); // music:part-group
}
}
}
w.endElement(); // music:part-list
for (int i = 0; i < sheet->partCount(); i++) {
writePart(w, i, sheet->part(i));
}
w.endElement(); // music:score-partwise
// w.endDocument();
}
示例13: writeKeySignature
static void writeKeySignature(KoXmlWriter& w, KeySignature* ks, Part* part)
{
w.startElement("music:key");
if (part->staffCount() > 1) {
// only write staff info when more than one staff exists
Staff* s = ks->staff();
w.addAttribute("number", QString::number(part->indexOfStaff(s) + 1));
}
w.startElement("music:fifths");
w.addTextNode(QString::number(ks->accidentals()));
w.endElement(); // music:fifths
w.endElement(); // music:key
}
示例14: saveOasisAuthorInfo
bool KoDocumentInfo::saveOasisAuthorInfo(KoXmlWriter &xmlWriter)
{
foreach(const QString & tag, m_authorTags) {
if (!authorInfo(tag).isEmpty() && tag == "creator") {
xmlWriter.startElement("dc:creator");
xmlWriter.addTextNode(authorInfo("creator"));
xmlWriter.endElement();
} else if (!authorInfo(tag).isEmpty()) {
xmlWriter.startElement("meta:user-defined");
xmlWriter.addAttribute("meta:name", tag);
xmlWriter.addTextNode(authorInfo(tag));
xmlWriter.endElement();
}
}
return true;
}
示例15: save
void ImageEffect::save(KoXmlWriter &writer)
{
writer.startElement(ImageEffectId);
saveCommonAttributes(writer);
QByteArray ba;
QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly);
if (m_image.save(&buffer, "PNG")) {
QMimeDatabase db;
const QString mimeType(db.mimeTypeForData(ba).name());
writer.addAttribute("xlink:href", "data:" + mimeType + ";base64," + ba.toBase64());
}
writer.endElement();
}