本文整理汇总了C++中KoXmlWriter::endElement方法的典型用法代码示例。如果您正苦于以下问题:C++ KoXmlWriter::endElement方法的具体用法?C++ KoXmlWriter::endElement怎么用?C++ KoXmlWriter::endElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KoXmlWriter
的用法示例。
在下文中一共展示了KoXmlWriter::endElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveOasis
bool KoDocumentInfo::saveOasis(KoStore *store)
{
updateParametersAndBumpNumCycles();
KoStoreDevice dev(store);
KoXmlWriter* xmlWriter = KoOdfWriteStore::createOasisXmlWriter(&dev,
"office:document-meta");
xmlWriter->startElement("office:meta");
xmlWriter->startElement("meta:generator");
xmlWriter->addTextNode(QString("Calligra/%1")
.arg(CALLIGRA_VERSION_STRING));
xmlWriter->endElement();
if (!saveOasisAboutInfo(*xmlWriter))
return false;
if (!saveOasisAuthorInfo(*xmlWriter))
return false;
xmlWriter->endElement();
xmlWriter->endElement(); // root element
xmlWriter->endDocument();
delete xmlWriter;
return true;
}
示例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: tableCellEnd
void WordsTableHandler::tableCellEnd()
{
kDebug(30513);
if (!m_cellOpen) {
kDebug(30513) << "BUG: !m_cellOpen";
return;
}
// Text lists aren't closed explicitly so we have to close them
// when something happens like a new paragraph or, in this case,
// the table cell ends.
if (document()->textHandler()->listIsOpen()) {
document()->textHandler()->closeList();
}
KoXmlWriter* writer = currentWriter();
QList<const char*> openTags = writer->tagHierarchy();
for (int i = 0; i < openTags.size(); ++i) {
kDebug(30513) << openTags[i];
}
writer->endElement();//table:table-cell
m_cellOpen = false;
// If this cell covers other cells (i.e. is merged), then create as many
// table:covered-table-cell tags as there are covered columns.
for (int i = 1; i < m_colSpan; i++) {
writer->startElement("table:covered-table-cell");
writer->endElement();
}
m_colSpan = 1;
//Leaving out the table:style-name attribute and creation of the
//corresponding style for covered table cells in the tableCellStart f.
if (!m_tap || m_cellStyleName.isEmpty()) {
return;
}
//process shading information
const wvWare::Word97::SHD& shd = m_tap->rgshd[ m_column ];
QString color = Conversion::shdToColorStr(shd,
document()->textHandler()->paragraphBgColor(),
document()->textHandler()->paragraphBaseFontColorBkp());
if (!color.isNull()) {
KoGenStyle* cellStyle = m_mainStyles->styleForModification(m_cellStyleName, "table-cell");
Q_ASSERT(cellStyle);
if (cellStyle) {
cellStyle->addProperty("fo:background-color", color, KoGenStyle::TableCellType);
}
m_cellStyleName.clear();
//add the current background-color to stack
// document()->pushBgColor(color);
}
}
示例4: stylesBuffer
QByteArray HancomWordImport::Private::createStyles()
{
KoXmlWriter* stylesWriter;
QByteArray stylesData;
QBuffer stylesBuffer( &stylesData );
stylesBuffer.open( QIODevice::WriteOnly );
stylesWriter = new KoXmlWriter( &stylesBuffer );
stylesWriter->startDocument( "office:document-styles" );
stylesWriter->startElement( "office:document-styles" );
stylesWriter->addAttribute( "xmlns:office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0" );
stylesWriter->addAttribute( "xmlns:style", "urn:oasis:names:tc:opendocument:xmlns:style:1.0" );
stylesWriter->addAttribute( "xmlns:text", "urn:oasis:names:tc:opendocument:xmlns:text:1.0" );
stylesWriter->addAttribute( "xmlns:table", "urn:oasis:names:tc:opendocument:xmlns:table:1.0" );
stylesWriter->addAttribute( "xmlns:draw", "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" );
stylesWriter->addAttribute( "xmlns:fo", "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" );
stylesWriter->addAttribute( "xmlns:svg","urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" );
stylesWriter->addAttribute( "office:version","1.0" );
stylesWriter->startElement( "office:styles" );
// dummy default paragraph style
stylesWriter->startElement( "style:default-style" );
stylesWriter->addAttribute( "style:family", "paragraph" );
stylesWriter->startElement( "style:paragraph-properties" );
stylesWriter->addAttribute( "fo:hyphenation-ladder-count", "no-limit" );
stylesWriter->addAttribute( "style:text-autospace", "ideograph-alpha" );
stylesWriter->addAttribute( "style:punctuation-wrap", "hanging" );
stylesWriter->addAttribute( "style:line-break", "strict" );
stylesWriter->addAttribute( "tyle:tab-stop-distance", "0.5in" );
stylesWriter->addAttribute( "style:writing-mode", "page" );
stylesWriter->endElement(); // style:paragraph-properties
stylesWriter->startElement( "style:text-properties" );
stylesWriter->addAttribute( "style:use-window-font-color", "true" );
stylesWriter->addAttribute( "style:font-name", "Sans Serif" );
stylesWriter->addAttribute( "fo:font-size", "12pt" );
stylesWriter->addAttribute( "fo:hyphenate", "false" );
stylesWriter->endElement(); // style:text-properties
stylesWriter->endElement(); // style:default-style
stylesWriter->endElement(); // office:styles
// office:automatic-styles
stylesWriter->startElement( "office:automatic-styles" );
stylesWriter->endElement(); // office:automatic-styles
stylesWriter->endElement(); // office:document-styles
stylesWriter->endDocument();
delete stylesWriter;
return stylesData;
}
示例5: 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;
}
示例6: tableEnd
void WordsTableHandler::tableEnd()
{
kDebug(30513) ;
KoXmlWriter* writer = currentWriter();
writer->endElement(); //table:table
//check if the table is inside of an absolutely positioned frame
if (m_currentTable->floating) {
writer->endElement(); //draw:text-box
writer->endElement(); //draw:frame
}
m_currentTable = 0L; // we don't own it, Document does
}
示例7: 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
}
示例8: 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();
}
示例9: 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();
}
示例10: 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();
}
示例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: tableRowEnd
void WordsTableHandler::tableRowEnd()
{
kDebug(30513);
m_currentY += rowHeight();
KoXmlWriter* writer = currentWriter();
//end table row in content
writer->endElement();//table:table-row
}
示例13: saveOdf
void PageVariable::saveOdf(KoShapeSavingContext & context)
{
KoXmlWriter *writer = &context.xmlWriter();
switch (m_type) {
case PageCount:
// <text:page-count>3</text:page-count>
writer->startElement("text:page-count", false);
writer->addTextNode(value());
writer->endElement();
break;
case PageNumber:
// <text:page-number text:select-page="current" text:page-adjust="2" text:fixed="true">3</text:page-number>
writer->startElement("text:page-number", false);
if (m_pageselect == KoTextPage::CurrentPage)
writer->addAttribute("text:select-page", "current");
else if (m_pageselect == KoTextPage::PreviousPage)
writer->addAttribute("text:select-page", "previous");
else if (m_pageselect == KoTextPage::NextPage)
writer->addAttribute("text:select-page", "next");
if (m_pageadjust != 0)
writer->addAttribute("text:page-adjust", QString::number(m_pageadjust));
m_numberFormat.saveOdf(writer);
if (m_fixed)
writer->addAttribute("text:fixed", "true");
writer->addTextNode(value());
writer->endElement();
break;
case PageContinuation:
// <text:page-continuation-string text:select-page="previous">The Text</text:page-continuation-string>
writer->startElement("page-continuation-string", false);
if (m_pageselect == KoTextPage::PreviousPage)
writer->addAttribute("text:select-page", "previous");
else if (m_pageselect == KoTextPage::NextPage)
writer->addAttribute("text:select-page", "next");
writer->addTextNode(m_continuation);
writer->endElement();
break;
}
}
示例14: 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
}
示例15: 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
}