Exemplo n.º 1
0
/*!

 Parent elements:
 - root element of Wordprocessing Header part

 Child elements:
 - altChunk (Anchor for Imported External Content)           §17.17.2.1
 - [done] bookmarkEnd (Bookmark End)                                §17.13.6.1
 - [done] bookmarkStart (Bookmark Start)                            §17.13.6.2
 - commentRangeEnd (Comment Anchor Range End)                §17.13.4.3
 - commentRangeStart (Comment Anchor Range Start)            §17.13.4.4
 - customXml (Block-Level Custom XML Element)                §17.5.1.6
 - customXmlDelRangeEnd (Custom XML Markup Deletion End)     §17.13.5.4
 - customXmlDelRangeStart (Custom XML Markup Deletion Start) §17.13.5.5
 - customXmlInsRangeEnd (Custom XML Markup Insertion End)        §17.13.5.6
 - customXmlInsRangeStart (Custom XML Markup Insertion Start)    §17.13.5.7
 - customXmlMoveFromRangeEnd (Custom XML Markup Move Source End) §17.13.5.8
 - customXmlMoveFromRangeStart (Custom XML Markup Move Source Start)             §17.13.5.9
 - customXmlMoveToRangeEnd (Custom XML Markup Move Destination Location End)     §17.13.5.10
 - customXmlMoveToRangeStart (Custom XML Markup Move Destination Location Start) §17.13.5.11
 - del (Deleted Run Content)                                                     §17.13.5.14
 - ins (Inserted Run Content)                                                    §17.13.5.18
 - moveFrom (Move Source Run Content)                                            §17.13.5.22
 - moveFromRangeEnd (Move Source Location Container - End)                       §17.13.5.23
 - moveFromRangeStart (Move Source Location Container - Start)                   §17.13.5.24
 - moveTo (Move Destination Run Content)                                         §17.13.5.25
 - moveToRangeEnd (Move Destination Location Container - End)                    §17.13.5.27
 - moveToRangeStart (Move Destination Location Container - Start)                §17.13.5.28
 - oMath (Office Math)                                                           §22.1.2.77
 - oMathPara (Office Math Paragraph)                                             §22.1.2.78
 - [done] p (Paragraph)                                                          §17.3.1.22
 - permEnd (Range Permission End)                                                §17.13.7.1
 - permStart (Range Permission Start)                                            §17.13.7.2
 - proofErr (Proofing Error Anchor)                                              §17.13.8.1
 - sdt (Block-Level Structured Document Tag)                                     §17.5.2.29
 - [done] tbl (Table)                                                                   §17.4.38
//! @todo: Handle all children
*/
KoFilter::ConversionStatus DocxXmlHeaderReader::read_hdr()
{
    READ_PROLOGUE

    QBuffer buffer;
    buffer.open(QIODevice::WriteOnly);
    KXmlWriter *oldBody = body;
    body = new KXmlWriter(&buffer);

    while (!atEnd()) {
        readNext();
        BREAK_IF_END_OF(CURRENT_EL)
        if (isStartElement()) {
            TRY_READ_IF(p)
            ELSE_TRY_READ_IF(tbl)
            ELSE_TRY_READ_IF(bookmarkStart)
            ELSE_TRY_READ_IF(bookmarkEnd);
        }
    }

    m_content = QString::fromUtf8(buffer.buffer(), buffer.buffer().size());

    delete body;
    body = oldBody;

    READ_EPILOGUE
}
 - root element

 Child elements:
 - [done] authors (Authors) §18.7.2
 - [done] commentList (List of Comments) §18.7.4
 - extLst (Future Feature Data Storage Area) §18.2.10

*/
KoFilter::ConversionStatus XlsxXmlCommentsReader::read_comments()
{
    READ_PROLOGUE
    while (!atEnd()) {
        readNext();
        BREAK_IF_END_OF(CURRENT_EL)
        if (isStartElement()) {
            TRY_READ_IF(authors)
            ELSE_TRY_READ_IF(commentList)
//            ELSE_TRY_READ_IF(extLst)
        }
    }
    READ_EPILOGUE
}

//! 18.7.2 authors (Authors)
/*
 Parent elements:
 - [done] comments (§18.7.6)

 Child elements:
 - [done] author (Author) §18.7.1
    return KoFilter::OK;
}

#undef CURRENT_EL
#define CURRENT_EL cmAuthorLst

KoFilter::ConversionStatus PptxXmlCommentAuthorsReader::read_cmAuthorLst()
{
    READ_PROLOGUE

    while (!atEnd()) {
        readNext();
        BREAK_IF_END_OF(CURRENT_EL)
        if (isStartElement()) {
            TRY_READ_IF(cmAuthor)
            ELSE_WRONG_FORMAT
        }
    }

    READ_EPILOGUE
}

#undef CURRENT_EL
#define CURRENT_EL cmAuthor

KoFilter::ConversionStatus PptxXmlCommentAuthorsReader::read_cmAuthor()
{
    READ_PROLOGUE

    QXmlStreamAttributes attrs( attributes() );