KoFilter::ConversionStatus XlsxXmlCommentsReader::readInternal() { readNext(); if (!isStartDocument()) { return KoFilter::WrongFormat; } // comments readNext(); kDebug() << *this << namespaceUri(); if (!expectEl("comments")) { return KoFilter::WrongFormat; } if (!expectNS(MSOOXML::Schemas::spreadsheetml)) { return KoFilter::WrongFormat; } QXmlStreamNamespaceDeclarations namespaces(namespaceDeclarations()); for (int i = 0; i < namespaces.count(); i++) { kDebug() << "NS prefix:" << namespaces[i].prefix() << "uri:" << namespaces[i].namespaceUri(); } //! @todo find out whether the namespace returned by namespaceUri() //! is exactly the same ref as the element of namespaceDeclarations() if (!namespaces.contains(QXmlStreamNamespaceDeclaration(QString(), MSOOXML::Schemas::spreadsheetml))) { raiseError(i18n("Namespace \"%1\" not found", MSOOXML::Schemas::spreadsheetml)); return KoFilter::WrongFormat; } //! @todo expect other namespaces too... TRY_READ(comments) kDebug() << "===========finished============"; return KoFilter::OK; }
KoFilter::ConversionStatus XlsxXmlDocumentReader::readInternal() { kDebug() << "============================="; readNext(); if (!isStartDocument()) { return KoFilter::WrongFormat; } // workbook readNext(); kDebug() << *this << namespaceUri(); if (!expectEl("workbook")) { return KoFilter::WrongFormat; } if (!expectNS(MSOOXML::Schemas::spreadsheetml)) { return KoFilter::WrongFormat; } /* const QXmlStreamAttributes attrs( attributes() ); for (int i=0; i<attrs.count(); i++) { kDebug() << "1 NS prefix:" << attrs[i].name() << "uri:" << attrs[i].namespaceUri(); }*/ QXmlStreamNamespaceDeclarations namespaces(namespaceDeclarations()); for (int i = 0; i < namespaces.count(); i++) { kDebug() << "NS prefix:" << namespaces[i].prefix() << "uri:" << namespaces[i].namespaceUri(); } //! @todo find out whether the namespace returned by namespaceUri() //! is exactly the same ref as the element of namespaceDeclarations() if (!namespaces.contains(QXmlStreamNamespaceDeclaration(QString(), MSOOXML::Schemas::spreadsheetml))) { raiseError(i18n("Namespace \"%1\" not found", MSOOXML::Schemas::spreadsheetml)); return KoFilter::WrongFormat; } //! @todo expect other namespaces too... TRY_READ(workbook) //! @todo hardcoded font face list; look at fonts used by theme mainStyles->insertFontFace(KOdfFontData("Calibri")); mainStyles->insertFontFace(KOdfFontData("Arial")); mainStyles->insertFontFace(KOdfFontData("Tahoma")); kDebug() << "===========finished============"; return KoFilter::OK; }
KoFilter::ConversionStatus DocxXmlFontTableReader::read(MSOOXML::MsooXmlReaderContext* context) { m_context = dynamic_cast<DocxXmlFontTableReaderContext*>(context); kDebug() << "============================="; readNext(); if (!isStartDocument()) { return KoFilter::WrongFormat; } //w:document readNext(); kDebug() << namespaceUri(); if (!expectEl("w:fonts")) { return KoFilter::WrongFormat; } if (!expectNS(MSOOXML::Schemas::wordprocessingml)) { return KoFilter::WrongFormat; } /* const QXmlStreamAttributes attrs( attributes() ); for (int i=0; i<attrs.count(); i++) { kDebug() << "1 NS prefix:" << attrs[i].name() << "uri:" << attrs[i].namespaceUri(); }*/ QXmlStreamNamespaceDeclarations namespaces(namespaceDeclarations()); for (int i = 0; i < namespaces.count(); i++) { kDebug() << "NS prefix:" << namespaces[i].prefix() << "uri:" << namespaces[i].namespaceUri(); } //! @todo find out whether the namespace returned by namespaceUri() //! is exactly the same ref as the element of namespaceDeclarations() if (!namespaces.contains(QXmlStreamNamespaceDeclaration("w", MSOOXML::Schemas::wordprocessingml))) { raiseError(i18n("Namespace \"%1\" not found", MSOOXML::Schemas::wordprocessingml)); return KoFilter::WrongFormat; } //! @todo expect other namespaces too... TRY_READ(fonts) if (!expectElEnd("w:fonts")) { return KoFilter::WrongFormat; } kDebug() << "===========finished============"; return KoFilter::OK; }
KoFilter::ConversionStatus DocxXmlHeaderReader::read(MSOOXML::MsooXmlReaderContext* context) { m_context = static_cast<DocxXmlDocumentReaderContext*>(context); kDebug() << "============================="; readNext(); if (!isStartDocument()) { return KoFilter::WrongFormat; } readNext(); kDebug() << *this << namespaceUri(); if (!expectEl(QList<QByteArray>() << "w:hdr")) { return KoFilter::WrongFormat; } if (!expectNS(MSOOXML::Schemas::wordprocessingml)) { return KoFilter::WrongFormat; } QXmlStreamNamespaceDeclarations namespaces(namespaceDeclarations()); //! @todo find out whether the namespace returned by namespaceUri() //! is exactly the same ref as the element of namespaceDeclarations() if (!namespaces.contains(QXmlStreamNamespaceDeclaration("w", MSOOXML::Schemas::wordprocessingml))) { raiseError(i18n("Namespace \"%1\" not found", MSOOXML::Schemas::wordprocessingml)); return KoFilter::WrongFormat; } const QString qn(qualifiedName().toString()); RETURN_IF_ERROR(read_hdr()) if (!expectElEnd(qn)) { return KoFilter::WrongFormat; } kDebug() << "===========finished============"; return KoFilter::OK; }