24
24
#include "XlsxXmlDocumentReader.h"
25
25
#include "XlsxXmlWorksheetReader.h"
26
#include "XlsxXmlCommentsReader.h"
26
27
#include "XlsxImport.h"
27
28
#include <MsooXmlSchemas.h>
28
29
#include <MsooXmlUtils.h>
29
30
#include <MsooXmlRelationships.h>
30
31
#include <KoXmlWriter.h>
31
32
#include <KoFontFace.h>
33
#include <VmlDrawingReader.h>
33
35
#undef MSOOXML_CURRENT_NS
34
36
#define MSOOXML_CURRENT_CLASS XlsxXmlDocumentReader
39
41
XlsxXmlDocumentReaderContext::XlsxXmlDocumentReaderContext(
40
42
XlsxImport& _import,
41
const QMap<QString, MSOOXML::DrawingMLTheme*>& _themes,
43
MSOOXML::DrawingMLTheme* _themes,
42
44
const XlsxSharedStringVector& _sharedStrings,
45
const XlsxComments& _comments,
43
46
const XlsxStyles& _styles,
44
47
MSOOXML::MsooXmlRelationships& _relationships
46
49
: MSOOXML::MsooXmlReaderContext(&_relationships)
49
52
, sharedStrings(&_sharedStrings)
53
, comments(&_comments)
239
242
READ_ATTR_WITH_NS(r, id)
240
243
READ_ATTR_WITHOUT_NS(sheetId)
241
244
READ_ATTR_WITHOUT_NS(name)
242
kDebug() << "r:id:" << r_id << "sheetId:" << sheetId << "name:" << name;
245
TRY_READ_ATTR_WITHOUT_NS(state)
246
kDebug() << "r:id:" << r_id << "sheetId:" << sheetId << "name:" << name << "state:" << state;
243
247
//! @todo TRY_READ_ATTR_WITHOUT_NS(state)
245
249
//! @todo implement MsooXmlRelationships with internal MsooXmlRelationshipsReader
250
254
QString filepath = path + "/" + file;
251
255
kDebug() << "path:" << path << "file:" << file;
257
// Loading potential ole replacements
258
VmlDrawingReader vmlreader(this);
259
QString vmlTarget = m_context->relationships->targetForType(path, file,
260
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing");
262
if (!vmlTarget.isEmpty()) {
263
QString errorMessage, vmlPath, vmlFile;
265
MSOOXML::Utils::splitPathAndFile(vmlTarget, &vmlPath, &vmlFile);
267
VmlDrawingReaderContext vmlContext(*m_context->import,
268
vmlPath, vmlFile, *m_context->relationships);
270
const KoFilter::ConversionStatus status =
271
m_context->import->loadAndParseDocument(&vmlreader, vmlTarget, errorMessage, &vmlContext);
272
if (status != KoFilter::OK) {
273
vmlreader.raiseError(errorMessage);
253
277
XlsxXmlWorksheetReader worksheetReader(this);
254
XlsxXmlWorksheetReaderContext context(d->worksheetNumber, name, path, file,
255
*m_context->themes, *m_context->sharedStrings, *m_context->styles,
256
*m_context->relationships, m_context->import );
278
XlsxXmlWorksheetReaderContext context(d->worksheetNumber, name, state, path, file,
279
m_context->themes, *m_context->sharedStrings,
280
*m_context->comments,
282
*m_context->relationships, m_context->import,
283
vmlreader.content());
257
284
const KoFilter::ConversionStatus result = m_context->import->loadAndParseDocument(
258
285
&worksheetReader, filepath, &context);
259
286
if (result != KoFilter::OK) {