KoFilter::ConversionStatus VmlDrawingReader::read_xml() { unsigned index = 0; KoXmlWriter *oldBody = 0; while (!atEnd()) { readNext(); if (isEndElement() && qualifiedName() == "xml") { break; } if (isStartElement()) { if (name() == "shapetype") { TRY_READ(shapetype) } else if (name() == "shape") { oldBody = body; // Body protetion starts QBuffer frameBuf; KoXmlWriter frameWriter(&frameBuf); body = &frameWriter; TRY_READ(shape) //from vml m_content[m_currentVMLProperties.currentShapeId] = m_currentVMLProperties.imagedataPath; pushCurrentDrawStyle(new KoGenStyle(KoGenStyle::GraphicAutoStyle, "graphic")); createFrameStart(); popCurrentDrawStyle(); m_frames[m_currentVMLProperties.currentShapeId] = QString::fromUtf8(frameBuf.buffer(), frameBuf.buffer().size()).append(">"); body = oldBody; // Body protection ends ++index; } } } return KoFilter::OK; }
int vanilla::scanner::read_token(token& t) { TRY_READ(read_ident_or_keyword, t); TRY_READ(read_lit, t); TRY_READ(read_operator, t); TRY_READ(read_special, t); return SCANNER_NOMATCH; }
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; }
int vanilla::scanner::read_lit(token& t) { TRY_READ(read_number_lit, t); TRY_READ(read_string_lit, t); return SCANNER_NOMATCH; }