diff --git a/filters/sheets/excel/import/ExcelImport.cpp b/filters/sheets/excel/import/ExcelImport.cpp --- a/filters/sheets/excel/import/ExcelImport.cpp +++ b/filters/sheets/excel/import/ExcelImport.cpp @@ -30,7 +30,6 @@ #include #include -#include #include #include #include @@ -209,7 +208,7 @@ d->outputDoc = qobject_cast(document); if (!d->outputDoc) { - kWarning() << "document isn't a Calligra::Sheets::Doc but a " << document->metaObject()->className(); + qCWarning(lcExcelImport) << "document isn't a Calligra::Sheets::Doc but a " << document->metaObject()->className(); return KoFilter::WrongFormat; } #else @@ -286,7 +285,7 @@ } Calligra::Sheets::Region region(Calligra::Sheets::Odf::loadRegion(range), d->outputDoc->map()); if (!region.isValid() || !region.lastSheet()) { - kDebug() << "invalid area" << range; + qCDebug(lcExcelImport) << "invalid area" << range; continue; } d->outputDoc->map()->namedAreaManager()->insert(region, it->first.second); @@ -324,9 +323,9 @@ d->shapesXml->device()->seek(0); QTextStream input(d->shapesXml->device()); - qDebug() << "-- START SHAPES_XML -- size : " << d->shapesXml->device()->size(); - qDebug() << input.readAll(); - qDebug() << "-- SHAPES_XML --"; + qCDebug(lcExcelImport) << "-- START SHAPES_XML -- size : " << d->shapesXml->device()->size(); + qCDebug(lcExcelImport) << input.readAll(); + qCDebug(lcExcelImport) << "-- SHAPES_XML --"; #endif KoXmlDocument xmlDoc = d->endMemoryXmlWriter(d->shapesXml); @@ -337,7 +336,7 @@ for (unsigned i = 0; i < d->workbook->sheetCount(); ++i) { Sheet* sheet = d->workbook->sheet(i); Calligra::Sheets::Sheet* ksheet = map->sheet(i); - kDebug() << i << sheet->backgroundImage(); + qCDebug(lcExcelImport) << i << sheet->backgroundImage(); if (sheet->backgroundImage().isEmpty()) continue; QByteArray data; @@ -361,7 +360,7 @@ } // active sheet - kDebug() << "ACTIVE " << d->workbook->activeTab(); + qCDebug(lcExcelImport) << "ACTIVE " << d->workbook->activeTab(); d->outputDoc->map()->loadingInfo()->setInitialActiveSheet(d->outputDoc->map()->sheet(d->workbook->activeTab())); d->outputDoc->setModified(false); @@ -724,7 +723,7 @@ kc.cond = Calligra::Sheets::Conditional::InferiorEqual; break; } - qDebug() << "FRM:" << c.cond << kc.cond; + qCDebug(lcExcelImport) << "FRM:" << c.cond << kc.cond; kc.value1 = convertValue(c.value1); kc.value2 = convertValue(c.value2); kc.baseCellAddress = Swinder::encodeAddress(is->name(), cf->region().boundingRect().left(), cf->region().boundingRect().top()); @@ -1000,7 +999,7 @@ foreach(ChartObject *chart, ic->charts()) { Sheet* const sheet = ic->sheet(); if(chart->m_chart->m_impl==0) { - kDebug() << "Invalid chart to be created, no implementation."; + qCDebug(lcExcelImport) << "Invalid chart to be created, no implementation."; continue; } @@ -1386,7 +1385,7 @@ KoXmlDocument doc; QString errorMsg; int errorLine, errorColumn; if (!doc.setContent(b, true, &errorMsg, &errorLine, &errorColumn)) { - kDebug() << errorMsg << errorLine << errorColumn; + qCDebug(lcExcelImport) << errorMsg << errorLine << errorColumn; } delete b; delete writer; diff --git a/filters/sheets/excel/import/ImportUtils.h b/filters/sheets/excel/import/ImportUtils.h --- a/filters/sheets/excel/import/ImportUtils.h +++ b/filters/sheets/excel/import/ImportUtils.h @@ -25,6 +25,8 @@ #include #include +#include +#include #include "../sidewinder/format.h" #include "../sidewinder/value.h" @@ -54,6 +56,8 @@ return ::qHash(key.format) ^ ::qHash(key.decimalCount); } +Q_DECLARE_LOGGING_CATEGORY(lcExcelImport); + } #endif // IMPORTUTILS_H diff --git a/filters/sheets/excel/import/ImportUtils.cpp b/filters/sheets/excel/import/ImportUtils.cpp --- a/filters/sheets/excel/import/ImportUtils.cpp +++ b/filters/sheets/excel/import/ImportUtils.cpp @@ -26,6 +26,8 @@ namespace XlsUtils { +Q_LOGGING_CATEGORY(lcExcelImport, "calligra.filter.xls2ods") + QString removeEscaped(const QString &text, bool removeOnlyEscapeChar) { QString s(text); diff --git a/filters/sheets/excel/import/excelimporttoods.cc b/filters/sheets/excel/import/excelimporttoods.cc --- a/filters/sheets/excel/import/excelimporttoods.cc +++ b/filters/sheets/excel/import/excelimporttoods.cc @@ -28,7 +28,6 @@ #include #include #include -#include #include #include @@ -215,7 +214,7 @@ d->storeout = KoStore::createStore(d->outputFile, KoStore::Write, "application/vnd.oasis.opendocument.spreadsheet", KoStore::Zip); if (!d->storeout || d->storeout->bad()) { - kWarning() << "Couldn't open the requested file."; + qCWarning(lcExcelImport) << "Couldn't open the requested file."; delete d->workbook; delete d->storeout; return KoFilter::FileNotFound; @@ -251,31 +250,31 @@ // So creating content before styles // store document content if (!d->createContent(&oasisStore)) { - kWarning() << "Couldn't open the file 'content.xml'."; + qCWarning(lcExcelImport) << "Couldn't open the file 'content.xml'."; delete d->workbook; delete d->storeout; return KoFilter::CreationError; } // store document styles if (!d->createStyles(d->storeout, manifestWriter, d->mainStyles)) { - kWarning() << "Couldn't open the file 'styles.xml'."; + qCWarning(lcExcelImport) << "Couldn't open the file 'styles.xml'."; delete d->workbook; delete d->storeout; return KoFilter::CreationError; } // store meta content if (!d->createMeta(&oasisStore)) { - kWarning() << "Couldn't open the file 'meta.xml'."; + qCWarning(lcExcelImport) << "Couldn't open the file 'meta.xml'."; delete d->workbook; delete d->storeout; return KoFilter::CreationError; } // store settings if (!d->createSettings(&oasisStore)) { - kWarning() << "Couldn't open the file 'settings.xml'."; + qCWarning(lcExcelImport) << "Couldn't open the file 'settings.xml'."; delete d->workbook; delete d->storeout; return KoFilter::CreationError; @@ -787,7 +786,7 @@ xml.endElement(); // draw:g } sheetShapes[sheet] = b.data(); - //qDebug() << b.data(); + //qCDebug(lcExcelImport) << b.data(); } } @@ -1039,7 +1038,7 @@ if (text[1] == '(') end = ')'; else if (text[1] == '_') end = '_'; else if (text[1] == ' ') end = ' '; - else kDebug() << "Probably unhandled condition=" << text[1] << "in text=" << text; + else qCDebug(lcExcelImport) << "Probably unhandled condition=" << text[1] << "in text=" << text; if (! end.isNull()) { { QString regex = QString("^_%1(.*\"\\$\".*)%2;.*").arg(QString("\\%1").arg(text[1])).arg(QString("\\%1").arg(end)); @@ -1141,7 +1140,7 @@ // reference is midnight 30 Dec 1899 QTime tt; tt = tt.addMSecs(qRound((serialNo - (int)serialNo) * 86400 * 1000)); - qDebug() << tt; + qCDebug(lcExcelImport) << tt; return tt; } @@ -1330,7 +1329,7 @@ foreach(ChartObject *chart, cell->charts()) { Sheet* const sheet = cell->sheet(); if(chart->m_chart->m_impl==0) { - kDebug() << "Invalid chart to be created, no implementation."; + qCDebug(lcExcelImport) << "Invalid chart to be created, no implementation."; continue; } @@ -1418,7 +1417,7 @@ odraw.processDrawingObject(o->object(), writer); } cellShapes[cell] = b.data(); - //qDebug() << cell->columnLabel() << cell->row() << b.data(); + //qCDebug(lcExcelImport) << cell->columnLabel() << cell->row() << b.data(); } } diff --git a/filters/sheets/xlsx/XlsxImport.cpp b/filters/sheets/xlsx/XlsxImport.cpp --- a/filters/sheets/xlsx/XlsxImport.cpp +++ b/filters/sheets/xlsx/XlsxImport.cpp @@ -23,6 +23,7 @@ * */ +#include "XlsxUtils.h" #include "XlsxImport.h" #include "XlsxXmlDocumentReader.h" #include "XlsxXmlSharedStringsReader.h" @@ -44,7 +45,6 @@ #include #include -#include #include #include @@ -56,6 +56,8 @@ K_PLUGIN_FACTORY_WITH_JSON(XlsxImportFactory, "calligra_filter_xlsx2ods.json", registerPlugin();) +Q_LOGGING_CATEGORY(lcXlsxImport, "calligra.filter.xlsx2ods") + enum XlsxDocumentType { XlsxDocument, XlsxTemplate, @@ -93,7 +95,7 @@ bool XlsxImport::acceptsSourceMimeType(const QByteArray& mime) const { - kDebug() << "Entering XLSX Import filter: from " << mime; + qCDebug(lcXlsxImport) << "Entering XLSX Import filter: from " << mime; if (mime == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") { d->type = XlsxDocument; d->macrosEnabled = false; @@ -122,7 +124,7 @@ bool XlsxImport::acceptsDestinationMimeType(const QByteArray& mime) const { - kDebug() << "Entering XLSX Import filter: to " << mime; + qCDebug(lcXlsxImport) << "Entering XLSX Import filter: to " << mime; return mime == "application/vnd.oasis.opendocument.spreadsheet"; } @@ -575,7 +577,7 @@ const QString spreadThemePathAndFile(relationships->targetForType( spreadPath, spreadFile, QLatin1String(MSOOXML::Schemas::officeDocument::relationships) + "/theme")); - kDebug() << QLatin1String(MSOOXML::Schemas::officeDocument::relationships) + "/theme"; + qCDebug(lcXlsxImport) << QLatin1String(MSOOXML::Schemas::officeDocument::relationships) + "/theme"; QString spreadThemePath, spreadThemeFile; MSOOXML::Utils::splitPathAndFile(spreadThemePathAndFile, &spreadThemePath, &spreadThemeFile); diff --git a/filters/sheets/xlsx/XlsxUtils.h b/filters/sheets/xlsx/XlsxUtils.h new file mode 100644 --- /dev/null +++ b/filters/sheets/xlsx/XlsxUtils.h @@ -0,0 +1,28 @@ +/* + Copyright (C) 2018 Damien Caliste + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef XLSXUTILS_H +#define XLSXUTILS_H + +#include +#include + +Q_DECLARE_LOGGING_CATEGORY(lcXlsxImport) + +#endif diff --git a/filters/sheets/xlsx/XlsxXmlCommentsReader.h b/filters/sheets/xlsx/XlsxXmlCommentsReader.h --- a/filters/sheets/xlsx/XlsxXmlCommentsReader.h +++ b/filters/sheets/xlsx/XlsxXmlCommentsReader.h @@ -24,11 +24,10 @@ #ifndef XLSXXMLCOMMENTSREADER_H #define XLSXXMLCOMMENTSREADER_H +#include "XlsxUtils.h" #include "XlsxXmlCommonReader.h" #include -#include - class XlsxComments; class XlsxComment { @@ -54,7 +53,7 @@ QString author(uint id) const { const QString result(id < (uint)m_authors.count() ? m_authors.at(id) : QString()); if (result.isEmpty()) { - kWarning() << "No author for ID" << id; + qCWarning(lcXlsxImport) << "No author for ID" << id; } return result; } diff --git a/filters/sheets/xlsx/XlsxXmlCommentsReader.cpp b/filters/sheets/xlsx/XlsxXmlCommentsReader.cpp --- a/filters/sheets/xlsx/XlsxXmlCommentsReader.cpp +++ b/filters/sheets/xlsx/XlsxXmlCommentsReader.cpp @@ -76,7 +76,7 @@ const KoFilter::ConversionStatus result = readInternal(); m_context = 0; if (result != KoFilter::OK) { - kWarning() << "Failure reading the comments"; + qCWarning(lcXlsxImport) << "Failure reading the comments"; } // We're not going to fail reading the whole file because the comments cannot be read return KoFilter::OK; @@ -91,7 +91,7 @@ // comments readNext(); - kDebug() << *this << namespaceUri(); + qCDebug(lcXlsxImport) << *this << namespaceUri(); if (!expectEl("comments")) { return KoFilter::WrongFormat; @@ -102,7 +102,7 @@ QXmlStreamNamespaceDeclarations namespaces(namespaceDeclarations()); for (int i = 0; i < namespaces.count(); i++) { - kDebug() << "NS prefix:" << namespaces[i].prefix() << "uri:" << namespaces[i].namespaceUri(); + qCDebug(lcXlsxImport) << "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() @@ -114,7 +114,7 @@ TRY_READ(comments) - kDebug() << "===========finished============"; + qCDebug(lcXlsxImport) << "===========finished============"; return KoFilter::OK; } @@ -185,7 +185,7 @@ READ_PROLOGUE readNext(); const QString author(text().toString().trimmed()); - kDebug() << "Added author #" << (m_context->comments->count() + 1) << author; + qCDebug(lcXlsxImport) << "Added author #" << (m_context->comments->count() + 1) << author; m_context->comments->m_authors.append(author); readNext(); @@ -272,7 +272,7 @@ if (comment.get()) { comment.get()->texts = m_currentCommentText; m_context->comments->insert(ref, comment.release()); - kDebug() << "Added comment for" << ref; + qCDebug(lcXlsxImport) << "Added comment for" << ref; } READ_EPILOGUE } diff --git a/filters/sheets/xlsx/XlsxXmlCommonReader.cpp b/filters/sheets/xlsx/XlsxXmlCommonReader.cpp --- a/filters/sheets/xlsx/XlsxXmlCommonReader.cpp +++ b/filters/sheets/xlsx/XlsxXmlCommonReader.cpp @@ -21,6 +21,7 @@ * */ +#include "XlsxUtils.h" #include "XlsxXmlCommonReader.h" #include @@ -36,8 +37,6 @@ #include -#include - class XlsxXmlCommonReader::Private { public: @@ -105,7 +104,7 @@ READ_PROLOGUE while (!atEnd()) { readNext(); - kDebug() << *this; + qCDebug(lcXlsxImport) << *this; if (isCharacters()) { body->addTextSpan(text().toString()); } diff --git a/filters/sheets/xlsx/XlsxXmlDocumentReader.cpp b/filters/sheets/xlsx/XlsxXmlDocumentReader.cpp --- a/filters/sheets/xlsx/XlsxXmlDocumentReader.cpp +++ b/filters/sheets/xlsx/XlsxXmlDocumentReader.cpp @@ -22,6 +22,7 @@ */ // Own +#include "XlsxUtils.h" #include "XlsxXmlDocumentReader.h" #include // needed by DrawingMLMethodso @@ -106,15 +107,15 @@ KoFilter::ConversionStatus XlsxXmlDocumentReader::readInternal() { - kDebug() << "============================="; + qCDebug(lcXlsxImport) << "============================="; readNext(); if (!isStartDocument()) { return KoFilter::WrongFormat; } // workbook readNext(); - kDebug() << *this << namespaceUri(); + qCDebug(lcXlsxImport) << *this << namespaceUri(); if (!expectEl("workbook")) { return KoFilter::WrongFormat; @@ -125,12 +126,12 @@ /* const QXmlStreamAttributes attrs( attributes() ); for (int i=0; iinsertFontFace(KoFontFace("Arial")); mainStyles->insertFontFace(KoFontFace("Tahoma")); - kDebug() << "===========finished============"; + qCDebug(lcXlsxImport) << "===========finished============"; return KoFilter::OK; } @@ -186,12 +187,12 @@ QXmlStreamNamespaceDeclarations namespaces = namespaceDeclarations(); for (int i = 0; i < namespaces.count(); i++) { - kDebug() << "NS prefix:" << namespaces[i].prefix() << "uri:" << namespaces[i].namespaceUri(); + qCDebug(lcXlsxImport) << "NS prefix:" << namespaces[i].prefix() << "uri:" << namespaces[i].namespaceUri(); } while (!atEnd()) { readNext(); - kDebug() << *this; + qCDebug(lcXlsxImport) << *this; BREAK_IF_END_OF(CURRENT_EL) if (isStartElement()) { TRY_READ_IF(sheets) @@ -226,7 +227,7 @@ while (!atEnd()) { readNext(); - kDebug() << *this; + qCDebug(lcXlsxImport) << *this; BREAK_IF_END_OF(CURRENT_EL) if (isStartElement()) { if (name() == "sheet") { @@ -300,16 +301,16 @@ READ_ATTR_WITHOUT_NS(sheetId) READ_ATTR_WITHOUT_NS(name) TRY_READ_ATTR_WITHOUT_NS(state) - kDebug() << "r:id:" << r_id << "sheetId:" << sheetId << "name:" << name << "state:" << state; + qCDebug(lcXlsxImport) << "r:id:" << r_id << "sheetId:" << sheetId << "name:" << name << "state:" << state; unsigned numberOfWorkSheets = m_context->relationships->targetCountWithWord("worksheets") + m_context->relationships->targetCountWithWord("dialogsheets") + m_context->relationships->targetCountWithWord("chartsheets"); d->worksheetNumber++; // counted from 1 QString path, file; QString filepath = m_context->relationships->target(m_context->path, m_context->file, r_id); MSOOXML::Utils::splitPathAndFile(filepath, &path, &file); - kDebug() << "path:" << path << "file:" << file; + qCDebug(lcXlsxImport) << "path:" << path << "file:" << file; // Loading potential ole replacements VmlDrawingReader vmlreader(this); diff --git a/filters/sheets/xlsx/XlsxXmlSharedStringsReader.cpp b/filters/sheets/xlsx/XlsxXmlSharedStringsReader.cpp --- a/filters/sheets/xlsx/XlsxXmlSharedStringsReader.cpp +++ b/filters/sheets/xlsx/XlsxXmlSharedStringsReader.cpp @@ -21,6 +21,7 @@ * */ +#include "XlsxUtils.h" #include "XlsxXmlSharedStringsReader.h" #include @@ -33,8 +34,6 @@ #include -#include - // ------------------------------------------------------------- XlsxXmlSharedStringsReaderContext::XlsxXmlSharedStringsReaderContext(QVector& _strings, MSOOXML::DrawingMLTheme* _themes, @@ -87,15 +86,15 @@ KoFilter::ConversionStatus XlsxXmlSharedStringsReader::readInternal() { - kDebug() << "============================="; + qCDebug(lcXlsxImport) << "============================="; readNext(); if (!isStartDocument()) { return KoFilter::WrongFormat; } // sst readNext(); - kDebug() << *this << namespaceUri(); + qCDebug(lcXlsxImport) << *this << namespaceUri(); if (!expectEl("sst")) { return KoFilter::WrongFormat; @@ -106,7 +105,7 @@ QXmlStreamNamespaceDeclarations namespaces(namespaceDeclarations()); for (int i = 0; i < namespaces.count(); i++) { - kDebug() << "NS prefix:" << namespaces[i].prefix() << "uri:" << namespaces[i].namespaceUri(); + qCDebug(lcXlsxImport) << "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() @@ -117,7 +116,7 @@ //! @todo expect other namespaces too... TRY_READ(sst) - kDebug() << "===========finished============"; + qCDebug(lcXlsxImport) << "===========finished============"; return KoFilter::OK; } @@ -177,7 +176,7 @@ { READ_PROLOGUE - kDebug() << "#" << m_index << text().toString(); + qCDebug(lcXlsxImport) << "#" << m_index << text().toString(); if (m_index >= (uint)m_context->strings->size()) { raiseError(i18n("Declared number of shared strings too small (%1)", m_context->strings->size())); return KoFilter::WrongFormat; @@ -192,7 +191,7 @@ while (!atEnd()) { readNext(); - kDebug() << *this; + qCDebug(lcXlsxImport) << *this; BREAK_IF_END_OF(CURRENT_EL) if (isStartElement()) { TRY_READ_IF(t) diff --git a/filters/sheets/xlsx/XlsxXmlStylesReader.cpp b/filters/sheets/xlsx/XlsxXmlStylesReader.cpp --- a/filters/sheets/xlsx/XlsxXmlStylesReader.cpp +++ b/filters/sheets/xlsx/XlsxXmlStylesReader.cpp @@ -21,6 +21,7 @@ * */ +#include "XlsxUtils.h" #include "XlsxXmlStylesReader.h" #include "XlsxImport.h" @@ -38,8 +39,6 @@ #include -#include - #include #include @@ -67,7 +66,7 @@ else if (!s.isEmpty()) { borderStyle = QLatin1String("solid"); // fallback } - kDebug() << "style:" << s << "set to:" << borderStyle; + qCDebug(lcXlsxImport) << "style:" << s << "set to:" << borderStyle; return KoFilter::OK; } @@ -284,22 +283,22 @@ const XlsxStyles *styles, KoGenStyle* cellStyle) const { - kDebug() << "fontId:" << fontId << "fillId:" << fillId << "borderId:" << borderId; + qCDebug(lcXlsxImport) << "fontId:" << fontId << "fillId:" << fillId << "borderId:" << borderId; if (applyAlignment) { setupCellStyleAlignment(cellStyle); } if (applyFont && fontId >= 0) { KoGenStyle* fontStyle = styles->fontStyle(fontId); if (!fontStyle) { - kWarning() << "No font with ID:" << fontId; + qCWarning(lcXlsxImport) << "No font with ID:" << fontId; return false; } KoGenStyle::copyPropertiesFromStyle(*fontStyle, *cellStyle, KoGenStyle::TextType); } if (applyFill && fillId >= 0) { KoGenStyle *fillStyle = styles->fillStyle(fillId); if (!fillStyle) { - kWarning() << "No fill with ID:" << fillId; + qCWarning(lcXlsxImport) << "No fill with ID:" << fillId; return false; } KoGenStyle::copyPropertiesFromStyle(*fillStyle, *cellStyle, KoGenStyle::TableCellType); @@ -433,15 +432,15 @@ KoFilter::ConversionStatus XlsxXmlStylesReader::readInternal() { - kDebug() << "============================="; + qCDebug(lcXlsxImport) << "============================="; readNext(); if (!isStartDocument()) { return KoFilter::WrongFormat; } // sst readNext(); - kDebug() << *this << namespaceUri(); + qCDebug(lcXlsxImport) << *this << namespaceUri(); if (!expectEl("styleSheet")) { return KoFilter::WrongFormat; @@ -452,7 +451,7 @@ QXmlStreamNamespaceDeclarations namespaces(namespaceDeclarations()); for (int i = 0; i < namespaces.count(); i++) { - kDebug() << "NS prefix:" << namespaces[i].prefix() << "uri:" << namespaces[i].namespaceUri(); + qCDebug(lcXlsxImport) << "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() @@ -478,7 +477,7 @@ } } - kDebug() << "===========finished============"; + qCDebug(lcXlsxImport) << "===========finished============"; return KoFilter::OK; } @@ -508,7 +507,7 @@ int counter = 0; while (!atEnd()) { readNext(); - kDebug() << *this; + qCDebug(lcXlsxImport) << *this; BREAK_IF_END_OF(CURRENT_EL) if (isStartElement()) { // In the first round we read potential color overrides @@ -565,7 +564,7 @@ while (!atEnd()) { readNext(); - kDebug() << *this; + qCDebug(lcXlsxImport) << *this; BREAK_IF_END_OF(CURRENT_EL) if (isStartElement()) { if (QUALIFIED_NAME_IS(font)) { @@ -877,7 +876,7 @@ while (!atEnd()) { readNext(); - kDebug() << *this; + qCDebug(lcXlsxImport) << *this; BREAK_IF_END_OF(CURRENT_EL) if (isStartElement()) { TRY_READ_IF(xf) @@ -928,7 +927,7 @@ return KoFilter::WrongFormat; } - kDebug() << "cell format #" << m_cellFormatIndex; + qCDebug(lcXlsxImport) << "cell format #" << m_cellFormatIndex; m_currentCellFormat = new XlsxCellFormat; MSOOXML::Utils::AutoPtrSetter currentCellFormatSetter(m_currentCellFormat); @@ -961,7 +960,7 @@ while (!atEnd()) { readNext(); - kDebug() << *this; + qCDebug(lcXlsxImport) << *this; BREAK_IF_END_OF(CURRENT_EL) if (isStartElement()) { TRY_READ_IF(alignment) @@ -998,9 +997,9 @@ READ_PROLOGUE const QXmlStreamAttributes attrs(attributes()); m_currentCellFormat->setHorizontalAlignment(attrs.value("horizontal").toString()); - kDebug() << "horizontalAlignment:" << m_currentCellFormat->horizontalAlignment; + qCDebug(lcXlsxImport) << "horizontalAlignment:" << m_currentCellFormat->horizontalAlignment; m_currentCellFormat->setVerticalAlignment(attrs.value("vertical").toString()); - kDebug() << "verticalAlignment:" << m_currentCellFormat->verticalAlignment; + qCDebug(lcXlsxImport) << "verticalAlignment:" << m_currentCellFormat->verticalAlignment; const bool wrap = readBooleanAttr("wrapText", false); m_currentCellFormat->wrapText = wrap; const bool shrinkToFit = readBooleanAttr("shrinkToFit", false); @@ -1041,7 +1040,7 @@ while (!atEnd()) { readNext(); - kDebug() << *this; + qCDebug(lcXlsxImport) << *this; BREAK_IF_END_OF(CURRENT_EL) if (isStartElement()) { if (QUALIFIED_NAME_IS(fill)) { @@ -1194,7 +1193,7 @@ percent = 0.875; } else { - kWarning() << "unknown value" << p << "of patterFill@patternType; defaulting to \"none\""; + qCWarning(lcXlsxImport) << "unknown value" << p << "of patterFill@patternType; defaulting to \"none\""; percent = 0; } diff --git a/filters/sheets/xlsx/XlsxXmlTableReader.cpp b/filters/sheets/xlsx/XlsxXmlTableReader.cpp --- a/filters/sheets/xlsx/XlsxXmlTableReader.cpp +++ b/filters/sheets/xlsx/XlsxXmlTableReader.cpp @@ -21,6 +21,7 @@ * */ +#include "XlsxUtils.h" #include "XlsxXmlTableReader.h" #define MSOOXML_CURRENT_CLASS XlsxXmlTableReader @@ -30,8 +31,6 @@ #include #include -#include - XlsxXmlTableReaderContext::XlsxXmlTableReaderContext() : headerStyleIndex(-1), dataStyleIndex(-1), @@ -61,7 +60,7 @@ } readNext(); - kDebug() << *this << namespaceUri(); + qCDebug(lcXlsxImport) << *this << namespaceUri(); if (!expectEl("table")) { return KoFilter::WrongFormat; @@ -72,7 +71,7 @@ QXmlStreamNamespaceDeclarations namespaces(namespaceDeclarations()); for (int i = 0; i < namespaces.count(); i++) { - kDebug() << "NS prefix:" << namespaces[i].prefix() << "uri:" << namespaces[i].namespaceUri(); + qCDebug(lcXlsxImport) << "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() @@ -84,7 +83,7 @@ TRY_READ(table) - kDebug() << "===========finished============"; + qCDebug(lcXlsxImport) << "===========finished============"; return KoFilter::OK; } diff --git a/filters/sheets/xlsx/XlsxXmlWorksheetReader.cpp b/filters/sheets/xlsx/XlsxXmlWorksheetReader.cpp --- a/filters/sheets/xlsx/XlsxXmlWorksheetReader.cpp +++ b/filters/sheets/xlsx/XlsxXmlWorksheetReader.cpp @@ -23,6 +23,7 @@ */ // Own +#include "XlsxUtils.h" #include "XlsxXmlWorksheetReader.h" #include "XlsxXmlCommentsReader.h" @@ -278,7 +279,7 @@ KoFilter::ConversionStatus XlsxXmlWorksheetReader::readInternal() { - kDebug() << "============================="; + qCDebug(lcXlsxImport) << "============================="; Q_ASSERT(m_context); readNext(); @@ -288,7 +289,7 @@ // worksheet readNext(); - //kDebug() << *this << namespaceUri(); + //qCDebug(lcXlsxImport) << *this << namespaceUri(); if (name() != "worksheet" && name() != "dialogsheet" && name() != "chartsheet") { return KoFilter::WrongFormat; @@ -301,7 +302,7 @@ QXmlStreamNamespaceDeclarations namespaces(namespaceDeclarations()); for (int i = 0; i < namespaces.count(); i++) { - kDebug() << "NS prefix:" << namespaces[i].prefix() << "uri:" << namespaces[i].namespaceUri(); + qCDebug(lcXlsxImport) << "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() @@ -318,7 +319,7 @@ TRY_READ(dialogsheet) } - kDebug() << "===========finished============"; + qCDebug(lcXlsxImport) << "===========finished============"; return KoFilter::OK; } @@ -332,11 +333,11 @@ //! For explanation of width, see p. 1778 //simplified: //! @todo hardcoded, not 100% accurate - kDebug() << "PT_TO_PX(11.0):" << PT_TO_PX(11.0); + qCDebug(lcXlsxImport) << "PT_TO_PX(11.0):" << PT_TO_PX(11.0); const double realSize = round(PT_TO_PX(11.0)) * 0.75; - kDebug() << "realSize:" << realSize; + qCDebug(lcXlsxImport) << "realSize:" << realSize; const double averageDigitWidth = realSize * 2.0 / 3.0; - kDebug() << "averageDigitWidth:" << averageDigitWidth; + qCDebug(lcXlsxImport) << "averageDigitWidth:" << averageDigitWidth; QString result; if (averageDigitWidth * widthNumber == 0) { @@ -355,7 +356,7 @@ if (d->warningAboutWorksheetSizeDisplayed) return; d->warningAboutWorksheetSizeDisplayed = true; - kWarning() << i18n("The data could not be loaded completely because the maximum size of " + qCWarning(lcXlsxImport) << i18n("The data could not be loaded completely because the maximum size of " "sheet was exceeded."); } @@ -367,11 +368,11 @@ void XlsxXmlWorksheetReader::saveAnnotation(int col, int row) { QString ref(encodeLabelText(col + 1, row + 1)); - kDebug() << ref; + qCDebug(lcXlsxImport) << ref; XlsxComment *comment = m_context->comments->value(ref); if (!comment) return; - //kDebug() << "Saving annotation for cell" << ref; + //qCDebug(lcXlsxImport) << "Saving annotation for cell" << ref; body->startElement("office:annotation"); body->startElement("dc:creator"); body->addTextNode(comment->author(m_context->comments)); @@ -494,7 +495,7 @@ while (!atEnd()) { readNext(); - kDebug() << *this; + qCDebug(lcXlsxImport) << *this; if (isEndElement() && name() == type) { break; } @@ -1057,7 +1058,7 @@ READ_PROLOGUE while (!atEnd()) { readNext(); - kDebug() << *this; + qCDebug(lcXlsxImport) << *this; BREAK_IF_END_OF(CURRENT_EL) if (isStartElement()) { TRY_READ_IF(col) @@ -1093,7 +1094,7 @@ void XlsxXmlWorksheetReader::appendTableColumns(int columns, const QString& width) { - kDebug() << "columns:" << columns; + qCDebug(lcXlsxImport) << "columns:" << columns; if (columns <= 0) return; body->startElement("table:table-column"); @@ -1152,7 +1153,7 @@ return KoFilter::WrongFormat; realWidthString = computeColumnWidth(widthNumber); - kDebug() << "realWidthString:" << realWidthString; + qCDebug(lcXlsxImport) << "realWidthString:" << realWidthString; //moved saveColumnStyle(realWidthString); //! @todo hardcoded table:default-cell-style-name //moved body->addAttribute("table:default-cell-style-name", "Excel_20_Built-in_20_Normal"); @@ -1199,7 +1200,7 @@ m_currentRow = 0; while (!atEnd()) { readNext(); - kDebug() << *this; + qCDebug(lcXlsxImport) << *this; BREAK_IF_END_OF(CURRENT_EL) if (isStartElement()) { TRY_READ_IF(row) @@ -1290,7 +1291,7 @@ int counter = 0; while (!atEnd()) { readNext(); - kDebug() << *this; + qCDebug(lcXlsxImport) << *this; BREAK_IF_END_OF(CURRENT_EL) if (isStartElement()) { if (counter == 40) { @@ -1362,7 +1363,7 @@ while (!atEnd()) { readNext(); - kDebug() << *this; + qCDebug(lcXlsxImport) << *this; BREAK_IF_END_OF(CURRENT_EL) if (isStartElement()) { TRY_READ_IF(f) @@ -1379,7 +1380,7 @@ if (cellFormat->applyNumberFormat) formattedStyle = m_context->styles->numberFormatStyleName( cellFormat->numFmtId ); - //kDebug() << "type=" << t << "styleId=" << styleId << "applyNumberFormat=" << cellFormat->applyNumberFormat << "numberFormat=" << numberFormat << "value=" << m_value; + //qCDebug(lcXlsxImport) << "type=" << t << "styleId=" << styleId << "applyNumberFormat=" << cellFormat->applyNumberFormat << "numberFormat=" << numberFormat << "value=" << m_value; QString charStyleName; @@ -1487,7 +1488,7 @@ if (charStyleName.isEmpty()) { KoGenStyle* fontStyle = m_context->styles->fontStyle(cellFormat->fontId); if (!fontStyle) { - kWarning() << "No font with ID:" << cellFormat->fontId; + qCWarning(lcXlsxImport) << "No font with ID:" << cellFormat->fontId; } else { KoGenStyle::copyPropertiesFromStyle(*fontStyle, cellStyle, KoGenStyle::TextType); } @@ -1702,16 +1703,16 @@ if (origCellStyle) { cellStyle = *origCellStyle; } - kDebug() << cell->rowsMerged << cell->columnsMerged << cell->styleName; + qCDebug(lcXlsxImport) << cell->rowsMerged << cell->columnsMerged << cell->styleName; if (cell->rowsMerged > 1) { Cell* lastCell = m_context->sheet->cell(fromCol, fromRow + cell->rowsMerged - 1, false); - kDebug() << lastCell; + qCDebug(lcXlsxImport) << lastCell; if (lastCell) { const KoGenStyle* style = mainStyles->style(lastCell->styleName, "table-cell"); - kDebug() << lastCell->styleName; + qCDebug(lcXlsxImport) << lastCell->styleName; if (style) { QString val = style->property("fo:border-bottom"); - kDebug() << val; + qCDebug(lcXlsxImport) << val; if (!val.isEmpty()) cellStyle.addProperty("fo:border-bottom", val); val = style->property("fo:border-line-width-bottom"); if (!val.isEmpty()) cellStyle.addProperty("fo:border-line-width-bottom", val);