void OdfReader::readElementOfficeBody(KoXmlStreamReader &reader) { DEBUGSTART(); m_backend->elementOfficeBody(reader, m_context); // <office:body> has the following children in ODF 1.2: // <office:chart> 3.8, // <office:database> 12.1 // <office:drawing> 3.5 // <office:image> 3.9 // [done] <office:presentation> 3.6 // [done] <office:spreadsheet> 3.7 // [done] <office:text> 3.4 // // Of those only <office:text> is present in a text document (odf). while (reader.readNextStartElement()) { QString tagName = reader.qualifiedName().toString(); if (tagName == "office:text") { readElementOfficeText(reader); } else if (tagName == "office:spreadsheet") { readElementOfficeSpreadsheet(reader); } else if (tagName == "office:presentation") { readElementOfficePresentation(reader); } else { reader.skipCurrentElement(); } } m_backend->elementOfficeBody(reader, m_context); DEBUGEND(); }
void OdfChartReader::readElementChartAxis(KoXmlStreamReader &reader) { DEBUGSTART(); m_backend->elementChartAxis(reader, m_context); // <chart:axis> has the following children in ODF 1.2: // [done] <chart:categories> 11.9 // [done] <chart:grid> 11.10 // [done] <chart:title> 11.2.1 while (reader.readNextStartElement()) { QString tagName = reader.qualifiedName().toString(); if (tagName == "chart:categories") { readElementChartCategories(reader); } else if (tagName == "chart:grid") { readElementChartGrid(reader); } else if (tagName == "chart:title") { readElementChartTitle(reader); } else { reader.skipCurrentElement(); } } m_backend->elementChartAxis(reader, m_context); DEBUGEND(); }
// This is a template function for the reader library. // Copy this one and change the name and fill in the code. void OdfReader::readElementNamespaceTagname(KoXmlStreamReader &reader) { DEBUGSTART(); // <namespace:tagname> has the following children in ODF 1.2: // FILL IN THE CHILDREN LIKE THIS EXAMPLE (taken from office:document-content): // <office:automatic-styles> 3.15.3 // <office:body> 3.3 // <office:font-face-decls> 3.14 // <office:scripts> 3.12. while (reader.readNextStartElement()) { QString tagName = reader.qualifiedName().toString(); if (tagName == "office:automatic-styles") { // FIXME: NYI reader.skipCurrentElement(); } else if (tagName == "office:body") { readElementOfficeBody(reader); } ... MORE else if () HERE else { reader.skipCurrentElement(); } } m_backend->elementNamespaceTagname(reader, m_context); DEBUGEND(); }
bool KoOdfStyle::readOdf(KoXmlStreamReader &reader) { // Load style attributes. KoXmlStreamAttributes attrs = reader.attributes(); QString dummy; // Because the set*() methods take a QString &, dummy = attrs.value("style:family").toString(); setFamily(dummy); dummy = attrs.value("style:name").toString(); setName(dummy); dummy = attrs.value("style:parent-style-name").toString(); setParent(dummy); dummy = attrs.value("style:display-name").toString(); setDisplayName(dummy); kDebug() << "Style:" << name() << family() << parent() << displayName(); // Load child elements: property sets and other children. while (reader.readNextStartElement()) { // So far we only have support for text-, paragraph- and graphic-properties QString propertiesType = reader.qualifiedName().toString(); if (propertiesType == "style:text-properties" || propertiesType == "style:paragraph-properties" || propertiesType == "style:graphic-properties") { //kDebug() << "properties type: " << propertiesType; // Create a new propertyset variable depending on the type of properties. KoOdfStyleProperties *properties; if (propertiesType == "style:text-properties") { properties = new KoOdfTextProperties(); } else if (propertiesType == "style:paragraph-properties") { properties = new KoOdfParagraphProperties(); } else if (propertiesType == "style:graphic-properties") { properties = new KoOdfGraphicProperties(); } if (!properties->readOdf(reader)) { return false; } d->properties[propertiesType] = properties; } } return true; }
void OdfChartReader::readElementChartPlotArea(KoXmlStreamReader &reader) { DEBUGSTART(); m_backend->elementChartPlotArea(reader, m_context); // <chart:plot-area> has the following children in ODF 1.2: // [done] <chart:wall> 11.6 // [done] <chart:floor> 11.7 // [done] <chart:axis> 11.8 // [done] <chart:series> 11.11 // [done] <chart:stock-gain-marker> 11.19 // [done] <chart:stock-loss-marker> 11.20 // [done] <chart:stock-range-line> 11.21 // <dr3d:light> 10.5.3 while (reader.readNextStartElement()) { QString tagName = reader.qualifiedName().toString(); if (tagName == "chart:wall") { readElementChartWall(reader); } else if (tagName == "chart:floor") { readElementChartFloor(reader); } else if (tagName == "chart:axis") { readElementChartAxis(reader); } else if (tagName == "chart:series") { readElementChartSeries(reader); } else if (tagName == "chart:stock-gain-marker") { readElementChartStockGainMarker(reader); } else if (tagName == "chart:stock-loss-marker") { readElementChartStockLossMarker(reader); } else if (tagName == "chart:stock-range-line") { readElementChartStockRangeLine(reader); } else if (tagName == "dr3d:light") { // FIXME: NYI reader.skipCurrentElement(); } else { reader.skipCurrentElement(); } } m_backend->elementChartPlotArea(reader, m_context); DEBUGEND(); }
void OdfChartReader::readElementChartChart(KoXmlStreamReader &reader) { DEBUGSTART(); m_backend->elementChartChart(reader, m_context); // <chart:chart> has the following children in ODF 1.2: // [done] <chart:footer> 11.2.3 // [done] <chart:legend> 11.3 // [done] <chart:plot-area> 11.4 // [done] <chart:subtitle> 11.2.2 // [done] <chart:title> 11.2.1 // [done] <table:table> 9.1.2 while (reader.readNextStartElement()) { QString tagName = reader.qualifiedName().toString(); if (tagName == "chart:footer") { readElementChartFooter(reader); } else if (tagName == "chart:subtitle") { readElementChartSubtitle(reader); } else if (tagName == "chart:title") { readElementChartTitle(reader); } else if (tagName == "chart:legend") { readElementChartLegend(reader); } else if (tagName == "chart:plot-area") { readElementChartPlotArea(reader); } else if (tagName == "table:table") { OdfTextReader *textReader = m_parent->textReader(); if (textReader) { textReader->readElementTableTable(reader); } else { reader.skipCurrentElement(); } } else { reader.skipCurrentElement(); } } m_backend->elementChartChart(reader, m_context); DEBUGEND(); }
// ODF 1.2 11.11: <chart:series> void OdfChartReader::readElementChartSeries(KoXmlStreamReader &reader) { DEBUGSTART(); m_backend->elementChartSeries(reader, m_context); // <chart:series> has the following children in ODF 1.2: // [done] <chart:data-label> 11.14 // [done] <chart:data-point> 11.13 // [done] <chart:domain> 11.12 // [done] <chart:error-indicator> 11.16 // [done] <chart:mean-value> 11.15 // [done] <chart:regression-curve> 11.17 while (reader.readNextStartElement()) { QString tagName = reader.qualifiedName().toString(); if (tagName == "chart:data-label") { readElementChartDataLabel(reader); } else if (tagName == "chart:data-point") { readElementChartDataPoint(reader); } else if (tagName == "chart:domain") { readElementChartDomain(reader); } else if (tagName == "chart:error-indicator") { readElementChartErrorIndicator(reader); } else if (tagName == "chart:mean-value") { readElementChartMeanValue(reader); } else if (tagName == "chart:regression-curve") { readElementChartRegressionCurve(reader); } else { reader.skipCurrentElement(); } } m_backend->elementChartSeries(reader, m_context); DEBUGEND(); }
void OdfChartReader::readElementOfficeChart(KoXmlStreamReader &reader) { DEBUGSTART(); m_backend->elementOfficeChart(reader, m_context); // <office:chart> has the following children in ODF 1.2: // [done] <chart:chart> 11.1 // <table:calculation-settings> 9.4.1 // <table:consolidation> 9.7 // <table:content-validations> 9.4.4 // <table:database-ranges> 9.4.14 // <table:data-pilot-tables> 9.6.2 // <table:dde-links> 9.8 // <table:label-ranges> 9.4.10 // <table:named-expressions> 9.4.11 // <text:alphabetical-index-auto-mark-file> 8.8.3 // <text:dde-connection-decls> 14.6.2 // <text:sequence-decls> 7.4.11 // <text:user-field-decls> 7.4.7 // <text:variable-decls> 7.4.2 while (reader.readNextStartElement()) { QString tagName = reader.qualifiedName().toString(); if (tagName == "chart:chart") { readElementChartChart(reader); } else if (tagName == "table:calculation-settings") { // FIXME: NYI reader.skipCurrentElement(); } //... MORE else if () HERE else { reader.skipCurrentElement(); } } m_backend->elementOfficeChart(reader, m_context); DEBUGEND(); }
void OdfChartReader::readUnknownElement(KoXmlStreamReader &reader) { DEBUGSTART(); #if 0 // FIXME: Fix this if (m_context->isInsideParagraph()) { // readParagraphContents expect to have the reader point to the // contents of the paragraph so we have to read past the chart:p // start tag here. reader.readNext(); readParagraphContents(reader); } else { while (reader.readNextStartElement()) { readTextLevelElement(reader); } } #else reader.skipCurrentElement(); #endif DEBUGEND(); }
bool OdfReader::readContent(OdfReaderBackend *backend, OdfReaderContext *context) { debugOdfReader << "entering"; m_backend = backend; m_context = context; if (m_textReader) { m_textReader->setContext(context); } // ---------------------------------------------------------------- // Read the body from content.xml KoStore *odfStore = m_context->odfStore(); if (!odfStore->open("content.xml")) { errorOdfReader << "Unable to open input file content.xml" << endl; return false; } debugOdfReader << "open content.xml ok"; KoXmlStreamReader reader; prepareForOdfInternal(reader); reader.setDevice(odfStore->device()); bool foundContent = false; while (!reader.atEnd()) { reader.readNext(); if (reader.isStartElement() && reader.qualifiedName() == "office:document-content") { foundContent = true; break; } } if (!foundContent) { errorOdfReader << "Couldn't find the content in content.xml" << endl; } m_backend->elementOfficeDocumentcontent(reader, m_context); // <office:document-content> has the following children in ODF 1.2: // <office:automatic-styles> 3.15.3 // [done] <office:body> 3.3 // <office:font-face-decls> 3.14 // <office:scripts> 3.12. while (reader.readNextStartElement()) { QString tagName = reader.qualifiedName().toString(); if (tagName == "office:automatic-styles") { // We already have the styles in the context. No need to read them again. reader.skipCurrentElement(); } else if (tagName == "office:body") { // This is the big one. readElementOfficeBody(reader); } else if (tagName == "office:font-face-decls") { // FIXME: Not yet implemented reader.skipCurrentElement(); } else if (tagName == "office:scripts") { // FIXME: Not yet implemented reader.skipCurrentElement(); } else { reader.skipCurrentElement(); } } m_backend->elementOfficeDocumentcontent(reader, m_context); odfStore->close(); return true; }