本文整理汇总了C++中KoXmlWriter类的典型用法代码示例。如果您正苦于以下问题:C++ KoXmlWriter类的具体用法?C++ KoXmlWriter怎么用?C++ KoXmlWriter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KoXmlWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveOdf
void KoBookmark::saveOdf(KoShapeSavingContext &context)
{
KoXmlWriter *writer = &context.xmlWriter();
QString nodeName;
if (d->type == SinglePosition)
nodeName = "text:bookmark";
else if (d->type == StartBookmark)
nodeName = "text:bookmark-start";
else if (d->type == EndBookmark)
nodeName = "text:bookmark-end";
writer->startElement(nodeName.toLatin1(), false);
writer->addAttribute("text:name", d->name.toLatin1());
if (d->type == StartBookmark && inlineRdf()) {
inlineRdf()->saveOdf(context, writer);
}
writer->endElement();
}
示例2: saveOdf
void PresentationVariable::saveOdf(KoShapeSavingContext & context)
{
KoXmlWriter *writer = &context.xmlWriter();
const char * type = "";
switch (m_type) {
case KPrDeclarations::Footer:
type = "presentation:footer";
break;
case KPrDeclarations::Header:
type = "presentation:header";
break;
case KPrDeclarations::DateTime:
type = "presentation:date-time";
break;
}
writer->startElement(type);
writer->endElement();
}
示例3:
bool PictureBase::saveAsBase64(KoXmlWriter& writer) const
{
QBuffer buffer;
buffer.open(QIODevice::ReadWrite);
if (!save(&buffer))
return false;
QByteArray encoded = buffer.buffer().toBase64();
writer.addTextNode(encoded);
return true;
}
示例4: saveOdf
void DatabaseManager::saveOdf(KoXmlWriter& xmlWriter) const
{
QList< QPair<QRectF, Database> > databases;
const Region region(QRect(QPoint(1, 1), QPoint(KS_colMax, KS_rowMax)));
const QList<Sheet*>& sheets = d->map->sheetList();
for (int i = 0; i < sheets.count(); ++i)
databases << sheets[i]->cellStorage()->databases(region);
if (databases.isEmpty())
return;
xmlWriter.startElement("table:database-ranges");
for (int i = 0; i < databases.count(); ++i) {
Database database = databases[i].second;
database.setRange(Region(databases[i].first.toRect(), database.range().firstSheet()));
if (!database.range().isValid())
continue;
database.saveOdf(xmlWriter);
}
xmlWriter.endElement();
}
示例5: writePartDesc
static void writePartDesc(KoXmlWriter& w, int id, Part* part)
{
w.startElement("music:score-part");
w.addAttribute("id", QString("P%1").arg(id));
w.startElement("music:part-name");
w.addTextNode(part->name());
w.endElement(); // music:part-name
QString abbr = part->shortName(false);
if (!abbr.isNull()) {
w.startElement("music:part-abbreviation");
w.addTextNode(abbr);
w.endElement(); // music:part-abbreviation
}
w.endElement(); // music:score-part
}
示例6: saveOdfLabel
void saveOdfLabel(KoShape *label, KoXmlWriter &bodyWriter,
KoGenStyles &mainStyles, LabelType labelType)
{
// Don't save hidden labels, as that's the way of removing them
// from a chart.
if (!label->isVisible())
return;
TextLabelData *labelData = qobject_cast<TextLabelData*>(label->userData());
if (!labelData)
return;
if (labelType == FooterLabelType)
bodyWriter.startElement("chart:footer");
else if (labelType == SubTitleLabelType)
bodyWriter.startElement("chart:subtitle");
else // if (labelType == TitleLabelType)
bodyWriter.startElement("chart:title");
bodyWriter.addAttributePt("svg:x", label->position().x());
bodyWriter.addAttributePt("svg:y", label->position().y());
bodyWriter.addAttributePt("svg:width", label->size().width());
bodyWriter.addAttributePt("svg:height", label->size().height());
// TODO: Save text label color
QTextCursor cursor(labelData->document());
QFont labelFont = cursor.charFormat().font();
KoGenStyle autoStyle(KoGenStyle::ChartAutoStyle, "chart", 0);
autoStyle.addPropertyPt("style:rotation-angle", 360 - label->rotation());
saveOdfFont(autoStyle, labelFont, QColor());
bodyWriter.addAttribute("chart:style-name", mainStyles.insert(autoStyle, "ch"));
bodyWriter.startElement("text:p");
bodyWriter.addTextNode(labelData->document()->toPlainText());
bodyWriter.endElement(); // text:p
bodyWriter.endElement(); // chart:title/subtitle/footer
}
示例7: writeTimeSignature
static void writeTimeSignature(KoXmlWriter& w, TimeSignature* ts, Part* part)
{
w.startElement("music:time");
if (part->staffCount() > 1) {
// only write staff info when more than one staff exists
Staff* s = ts->staff();
w.addAttribute("number", QString::number(part->indexOfStaff(s) + 1));
}
w.startElement("music:beats");
w.addTextNode(QString::number(ts->beats()));
w.endElement(); // music:beats
w.startElement("music:beat-type");
w.addTextNode(QString::number(ts->beat()));
w.endElement(); // music:beat-type
w.endElement(); // music:time
}
示例8: stylesDev
bool KoGenStyles::saveOdfStylesDotXml(KoStore* store, KoXmlWriter* manifestWriter) const
{
if (!store->open("styles.xml"))
return false;
manifestWriter->addManifestEntry("styles.xml", "text/xml");
KoStoreDevice stylesDev(store);
KoXmlWriter* stylesWriter = KoOdfWriteStore::createOasisXmlWriter(&stylesDev, "office:document-styles");
d->saveOdfFontFaceDecls(stylesWriter);
d->saveOdfDocumentStyles(stylesWriter);
d->saveOdfAutomaticStyles(stylesWriter, true, d->rawOdfAutomaticStyles_stylesDotXml);
d->saveOdfMasterStyles(stylesWriter);
stylesWriter->endElement(); // root element (office:document-styles)
stylesWriter->endDocument();
delete stylesWriter;
if (!store->close()) // done with styles.xml
return false;
return true;
}
示例9: manifestBuffer
QByteArray HancomWordImport::Private::createManifest()
{
KoXmlWriter* manifestWriter;
QByteArray manifestData;
QBuffer manifestBuffer( &manifestData );
manifestBuffer.open( QIODevice::WriteOnly );
manifestWriter = new KoXmlWriter( &manifestBuffer );
manifestWriter->startDocument( "manifest:manifest" );
manifestWriter->startElement( "manifest:manifest" );
manifestWriter->addAttribute( "xmlns:manifest", "urn:oasis:names:tc:openoffice:xmlns:manifest:1.0" );
manifestWriter->addManifestEntry( "/", "application/vnd.oasis.opendocument.text" );
manifestWriter->addManifestEntry( "styles.xml", "text/xml" );
manifestWriter->addManifestEntry( "content.xml", "text/xml" );
manifestWriter->endElement();
manifestWriter->endDocument();
delete manifestWriter;
return manifestData;
}
示例10: saveOasisAboutInfo
bool KoDocumentInfo::saveOasisAboutInfo(KoXmlWriter &xmlWriter)
{
foreach(const QString &tag, m_aboutTags) {
if (!aboutInfo(tag).isEmpty() || tag == "title") {
if (tag == "keyword") {
foreach(const QString & tmp, aboutInfo("keyword").split(';')) {
xmlWriter.startElement("meta:keyword");
xmlWriter.addTextNode(tmp);
xmlWriter.endElement();
}
} else if (tag == "title" || tag == "description" || tag == "subject" ||
tag == "date" || tag == "language") {
QByteArray elementName(QString("dc:" + tag).toLatin1());
xmlWriter.startElement(elementName);
xmlWriter.addTextNode(aboutInfo(tag));
xmlWriter.endElement();
} else {
QByteArray elementName(QString("meta:" + tag).toLatin1());
xmlWriter.startElement(elementName);
xmlWriter.addTextNode(aboutInfo(tag));
xmlWriter.endElement();
}
}
示例11: 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;
}
示例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:
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
}
示例14: 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
}
示例15: writeClef
static void writeClef(KoXmlWriter& w, Clef* clef, Part* part)
{
w.startElement("music:clef");
if (part->staffCount() > 1) {
// only write staff info when more than one staff exists
Staff* s = clef->staff();
w.addAttribute("number", QString::number(part->indexOfStaff(s) + 1));
}
w.startElement("music:sign");
switch (clef->shape()) {
case Clef::GClef: w.addTextNode("G"); break;
case Clef::FClef: w.addTextNode("F"); break;
case Clef::CClef: w.addTextNode("C"); break;
}
w.endElement(); // music:sign
w.endElement(); // music:clef
}