예제 #1
0
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
0
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
0
bool KoDocumentInfo::saveOasisAboutInfo(KoXmlWriter &xmlWriter)
{
    saveParameters();

    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") {
                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();
            }
        }
예제 #4
0
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);
    }
}
예제 #5
0
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;
}
예제 #6
0
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;
}
예제 #7
0
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
}
예제 #8
0
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
}
예제 #9
0
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
0
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();
}
예제 #11
0
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();
}
예제 #12
0
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;
}
예제 #13
0
void WordsTableHandler::tableRowEnd()
{
    kDebug(30513);
    m_currentY += rowHeight();
    KoXmlWriter*  writer = currentWriter();
    //end table row in content
    writer->endElement();//table:table-row
}
예제 #14
0
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;
    }
}
예제 #15
0
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
}
예제 #16
0
bool KoDocumentInfoAbout::saveOasis( KoXmlWriter &xmlWriter )
{
    saveParameters();
    if ( !m_title.isEmpty() )
    {
     xmlWriter.startElement( "dc:title" );
     xmlWriter.addTextNode( m_title );
     xmlWriter.endElement();
    }
    if ( !m_abstract.isEmpty() )
    {
     xmlWriter.startElement( "dc:description" );
     xmlWriter.addTextNode( m_abstract );
     xmlWriter.endElement();
    }
    if ( !m_keywords.isEmpty() )
    {
     xmlWriter.startElement( "meta:keyword" );
     xmlWriter.addTextNode( m_keywords );
     xmlWriter.endElement();
    }
    if ( !m_subject.isEmpty() )
    {
     xmlWriter.startElement( "dc:subject" );
     xmlWriter.addTextNode( m_subject );
     xmlWriter.endElement();
    }
    if ( !m_initialCreator.isEmpty() )
    {
     xmlWriter.startElement( "meta:initial-creator" );
     xmlWriter.addTextNode( m_initialCreator );
     xmlWriter.endElement();
    }

    xmlWriter.startElement( "meta:editing-cycles" );
    xmlWriter.addTextNode( QString::number( m_editingCycles ) );
    xmlWriter.endElement();

    if ( m_creationDate.isValid() )
    {
        xmlWriter.startElement( "meta:creation-date" );
        xmlWriter.addTextNode( m_creationDate.toString( Qt::ISODate ) );
        xmlWriter.endElement();
    }

    if ( m_modificationDate.isValid() )
    {
        xmlWriter.startElement( "dc:date" );
        xmlWriter.addTextNode( m_modificationDate.toString( Qt::ISODate ) );
        xmlWriter.endElement();
    }
    return true;
}
예제 #17
0
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
}
예제 #18
0
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
}
예제 #19
0
bool KoDocumentInfoUserMetadata::saveOasis( KoXmlWriter &xmlWriter )
{
  QMap<QString, QString>::iterator it;
  for ( it = m_metaList.begin(); it != m_metaList.end(); ++it )
  {
    xmlWriter.startElement( "meta:user-defined");
    xmlWriter.addAttribute( "meta:name", it.key() );
    xmlWriter.addTextNode( it.data() );
    xmlWriter.endElement();
  }
  return true;
}
예제 #20
0
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();
}
예제 #21
0
void KoInlineNote::saveOdf(KoShapeSavingContext & context)
{
    KoXmlWriter *writer = &context.xmlWriter();
    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);
    writer->startElement("text:p");
    writer->addTextNode(d->text);
    writer->endElement();
    writer->endElement();
    writer->endElement();
}
예제 #22
0
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
}
예제 #23
0
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();
}
예제 #24
0
bool KoDocumentInfo::saveOasis( KoStore* store )
{
    KoStoreDevice dev( store );
    KoXmlWriter* xmlWriter = KoDocument::createOasisXmlWriter( &dev, "office:document-meta" );
    xmlWriter->startElement( "office:meta" );

    xmlWriter->startElement( "meta:generator");
    xmlWriter->addTextNode( QString( "KOffice/%1" ).arg( KOFFICE_VERSION_STRING ) );
    xmlWriter->endElement();
    QStringList lst = pages();
    QStringList::ConstIterator it = lst.begin();
    for( ; it != lst.end(); ++it )
    {
        KoDocumentInfoPage* p = page( *it );
        Q_ASSERT( p );
        if ( !p->saveOasis( *xmlWriter ) )
            return false;
    }
    xmlWriter->endElement();
    xmlWriter->endElement(); // root element
    xmlWriter->endDocument();
    delete xmlWriter;
    return true;
}
예제 #25
0
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();
}
예제 #26
0
void InfoVariable::saveOdf(KoShapeSavingContext & context)
{
    KoXmlWriter *writer = &context.xmlWriter();

    if (!s_saveInfo.exists() ) {
        for (unsigned int i = 0; i < numPropertyData; ++i) {
            s_saveInfo->insert(propertyData[i].property, propertyData[i].saveTag);
        }
    }
    const char *nodeName = s_saveInfo->value(m_type, 0);
    if (nodeName) {
        writer->startElement(nodeName, false);
        writer->addTextNode(value());
        writer->endElement();
    }
}
예제 #27
0
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();
}
예제 #28
0
void MorphologyEffect::save(KoXmlWriter &writer)
{
    writer.startElement(MorphologyEffectId);

    saveCommonAttributes(writer);

    if (m_operator != Erode )
        writer.addAttribute("operator", "dilate");
    if (!m_radius.isNull()) {
        if (m_radius.x() == m_radius.y()) {
            writer.addAttribute("radius", QString("%1").arg(m_radius.x()));
        } else {
            writer.addAttribute("radius", QString("%1 %2").arg(m_radius.x()).arg(m_radius.y()));
        }
    }

    writer.endElement();
}
예제 #29
0
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;
}
예제 #30
0
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();
}