20#include "KoSimpleOdsDocument.h"
23#include <KoOdfWriteStore.h>
24#include <KoXmlWriter.h>
25#include "KoSimpleOdsSheet.h"
27KoSimpleOdsDocument::KoSimpleOdsDocument()
32KoSimpleOdsDocument::~KoSimpleOdsDocument()
35 qDeleteAll(m_worksheets);
38void KoSimpleOdsDocument::addSheet(KoSimpleOdsSheet* sheet)
41 m_worksheets.
append(sheet);
49 m_store = KoStore::createStore(path, KoStore::Write,
50 "application/vnd.oasis.opendocument.spreadsheet", KoStore::Zip);
52 kreportWarning() <<
"Couldn't open the requested file.";
56 KoOdfWriteStore oasisStore(m_store);
59 if (!createContent(&oasisStore)) {
72bool KoSimpleOdsDocument::createContent(KoOdfWriteStore* store)
74 KoXmlWriter* bodyWriter = store->bodyWriter();
75 KoXmlWriter* contentWriter = store->contentWriter();
76 KoXmlWriter* manifestWriter = store->manifestWriter(
"application/vnd.oasis.opendocument.spreadsheet");
78 bool ok = bodyWriter && contentWriter && manifestWriter;
80 kreportWarning() <<
"Bad things happened";
84 manifestWriter->addManifestEntry(
"content.xml",
"text/xml");
87 contentWriter->startElement(
"office:font-face-decls");
88 contentWriter->startElement(
"style:font-face");
89 contentWriter->addAttribute(
"style:name",
"Arial");
90 contentWriter->addAttribute(
"svg:font-family",
"Arial");
91 contentWriter->endElement();
92 contentWriter->startElement(
"style:font-face");
93 contentWriter->addAttribute(
"style:name",
"Times New Roman");
94 contentWriter->addAttribute(
"svg:font-family",
"'Times New Roman'");
95 contentWriter->endElement();
96 contentWriter->endElement();
99 bodyWriter->startElement(
"office:body");
100 foreach(KoSimpleOdsSheet *sheet, m_worksheets) {
101 bodyWriter->startElement(
"office:spreadsheet");
102 sheet->saveSheet(bodyWriter);
103 bodyWriter->endElement();
105 bodyWriter->endElement();
107 if (!store->closeContentWriter()) {
110 if (!store->closeManifestWriter()) {
void append(QList< T > &&value)
bool contains(const AT &value) const const