diff --git a/.gitignore b/.gitignore
index 3be43cf..7ca0e1c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,3 +40,6 @@ lib/*
*.idb
*.ncb
*.suo
+
+*.cppcheck
+/*-cppcheck-build-dir
diff --git a/README.md b/README.md
index 8fe0778..660f870 100644
--- a/README.md
+++ b/README.md
@@ -24,13 +24,15 @@ Microsoft Office and can be used in any platform that **Qt 5.2** or newer suppor
* Put the source code in any directory you like
-* Run following command at the toplevel directory of the project
+* Run following command at the toplevel directory of the project:
+
+| | Windows Qt MINGW | Windows Qt MSVC |
+|--------------------|----------------------------|---------------------|
+| ```qmake``` | ```qmake``` | ```qmake``` |
+| ```make``` | ```mingw32-make``` | ```nmake``` |
+| | ```mingw32-make check``` | ```nmake check``` |
+| ```make install``` | ```mingw32-make install``` | ```nmake install``` |
-```
- qmake
- make
- make install
-```
The library, the header files, and others will be installed to your system.
diff --git a/examples/officeopenxml/opc_package_viewer/binedit.cpp b/examples/officeopenxml/opc_package_viewer/binedit.cpp
index d02312f..4ec4b2e 100644
--- a/examples/officeopenxml/opc_package_viewer/binedit.cpp
+++ b/examples/officeopenxml/opc_package_viewer/binedit.cpp
@@ -89,7 +89,7 @@ BinEdit::BinEdit(QWidget *parent)
m_addressBytes = 4;
init();
m_unmodifiedState = 0;
- m_readOnly = false;
+ m_readOnly = 0;
m_hexCursor = true;
m_cursorPosition = 0;
m_anchorPosition = 0;
@@ -130,19 +130,41 @@ void BinEdit::init()
m_descent = fm.descent();
m_ascent = fm.ascent();
m_lineHeight = fm.lineSpacing();
+
+#if (QT_VERSION >= QT_VERSION_CHECK(5,15,14))
+ m_charWidth = fm.horizontalAdvance(QChar(QLatin1Char('M')));
+ m_margin = m_charWidth;
+ m_columnWidth = 2 * m_charWidth + fm.horizontalAdvance(QChar(QLatin1Char(' ')));
+#else
m_charWidth = fm.width(QChar(QLatin1Char('M')));
m_margin = m_charWidth;
m_columnWidth = 2 * m_charWidth + fm.width(QChar(QLatin1Char(' ')));
+#endif
+
m_numLines = m_size / m_bytesPerLine + 1;
m_numVisibleLines = viewport()->height() / m_lineHeight;
m_textWidth = m_bytesPerLine * m_charWidth + m_charWidth;
+#if (QT_VERSION >= QT_VERSION_CHECK(5,15,14))
+ int m_numberWidth = fm.horizontalAdvance(QChar(QLatin1Char('9')));
+#else
int m_numberWidth = fm.width(QChar(QLatin1Char('9')));
+#endif
m_labelWidth =
2*m_addressBytes * m_numberWidth + (m_addressBytes - 1)/2 * m_charWidth;
int expectedCharWidth = m_columnWidth / 3;
const char *hex = "0123456789abcdef";
m_isMonospacedFont = true;
+
+#if (QT_VERSION >= QT_VERSION_CHECK(5,15,14))
+ while (*hex) {
+ if (fm.horizontalAdvance(QLatin1Char(*hex)) != expectedCharWidth) {
+ m_isMonospacedFont = false;
+ break;
+ }
+ ++hex;
+ }
+#else
while (*hex) {
if (fm.width(QLatin1Char(*hex)) != expectedCharWidth) {
m_isMonospacedFont = false;
@@ -150,7 +172,21 @@ void BinEdit::init()
}
++hex;
}
+#endif
+
+
+#if (QT_VERSION >= QT_VERSION_CHECK(5,15,14))
+ if (m_isMonospacedFont && fm.horizontalAdvance(QLatin1String("M M ")) != m_charWidth * 4) {
+ // On Qt/Mac, monospace font widths may have a fractional component
+ // This breaks the assumption that width("MMM") == width('M') * 3
+ m_isMonospacedFont = false;
+ m_columnWidth = fm.horizontalAdvance(QLatin1String("MMM"));
+ m_labelWidth = m_addressBytes == 4
+ ? fm.horizontalAdvance(QLatin1String("MMMM:MMMM"))
+ : fm.horizontalAdvance(QLatin1String("MMMM:MMMM:MMMM:MMMM"));
+ }
+#else
if (m_isMonospacedFont && fm.width(QLatin1String("M M ")) != m_charWidth * 4) {
// On Qt/Mac, monospace font widths may have a fractional component
// This breaks the assumption that width("MMM") == width('M') * 3
@@ -161,6 +197,7 @@ void BinEdit::init()
? fm.width(QLatin1String("MMMM:MMMM"))
: fm.width(QLatin1String("MMMM:MMMM:MMMM:MMMM"));
}
+#endif
horizontalScrollBar()->setRange(0, 2 * m_margin + m_bytesPerLine * m_columnWidth
+ m_labelWidth + m_textWidth - viewport()->width());
@@ -461,7 +498,11 @@ void BinEdit::changeEvent(QEvent *e)
void BinEdit::wheelEvent(QWheelEvent *e)
{
if (e->modifiers() & Qt::ControlModifier) {
+#if (QT_VERSION >= QT_VERSION_CHECK(5,15,14))
+ const int delta = e->pixelDelta().y();
+#else
const int delta = e->delta();
+#endif
if (delta < 0)
zoomOut();
else if (delta > 0)
@@ -505,8 +546,12 @@ int BinEdit::posAt(const QPoint &pos) const
break;
QChar qc(QLatin1Char(dataAt(dataPos)));
if (!qc.isPrint())
- qc = 0xB7;
+ qc = QChar(0xB7);
+#if (QT_VERSION >= QT_VERSION_CHECK(5,15,14))
+ x -= fontMetrics().horizontalAdvance(qc);
+#else
x -= fontMetrics().width(qc);
+#endif
if (x <= 0)
break;
}
@@ -787,7 +832,7 @@ void BinEdit::paintEvent(QPaintEvent *e)
break;
QChar qc(QLatin1Char(dataAt(pos, isOld)));
if (qc.unicode() >= 127 || !qc.isPrint())
- qc = 0xB7;
+ qc = QChar(0xB7);
printable += qc;
}
} else {
@@ -830,20 +875,36 @@ void BinEdit::paintEvent(QPaintEvent *e)
if (color.isValid()) {
painter.fillRect(item_x - m_charWidth/2, y-m_ascent, m_columnWidth, m_lineHeight, color);
+#if (QT_VERSION >= QT_VERSION_CHECK(5,15,14))
+ int printable_item_x = -xoffset + m_margin + m_labelWidth + m_bytesPerLine * m_columnWidth + m_charWidth
+ + fm.horizontalAdvance(printable.left(c));
+ painter.fillRect(printable_item_x, y-m_ascent,
+ fm.horizontalAdvance(printable.at(c)),
+ m_lineHeight, color);
+#else
int printable_item_x = -xoffset + m_margin + m_labelWidth + m_bytesPerLine * m_columnWidth + m_charWidth
+ fm.width(printable.left(c));
painter.fillRect(printable_item_x, y-m_ascent,
fm.width(printable.at(c)),
m_lineHeight, color);
+#endif
}
if (!isFullySelected && pos >= selStart && pos <= selEnd) {
selectionRect |= QRect(item_x - m_charWidth/2, y-m_ascent, m_columnWidth, m_lineHeight);
+#if (QT_VERSION >= QT_VERSION_CHECK(5,15,14))
+ int printable_item_x = -xoffset + m_margin + m_labelWidth + m_bytesPerLine * m_columnWidth + m_charWidth
+ + fm.horizontalAdvance(printable.left(c));
+ printableSelectionRect |= QRect(printable_item_x, y-m_ascent,
+ fm.horizontalAdvance(printable.at(c)),
+ m_lineHeight);
+#else
int printable_item_x = -xoffset + m_margin + m_labelWidth + m_bytesPerLine * m_columnWidth + m_charWidth
+ fm.width(printable.left(c));
printableSelectionRect |= QRect(printable_item_x, y-m_ascent,
fm.width(printable.at(c)),
m_lineHeight);
+#endif
}
}
}
@@ -878,8 +939,13 @@ void BinEdit::paintEvent(QPaintEvent *e)
painter.drawRect(cursorRect.adjusted(0, 0, 0, -1));
painter.restore();
if (m_hexCursor && m_cursorVisible) {
+#if (QT_VERSION >= QT_VERSION_CHECK(5,15,14))
+ if (m_lowNibble)
+ cursorRect.adjust(fm.horizontalAdvance(itemString.left(1)), 0, 0, 0);
+#else
if (m_lowNibble)
cursorRect.adjust(fm.width(itemString.left(1)), 0, 0, 0);
+#endif
painter.fillRect(cursorRect, Qt::red);
painter.save();
painter.setClipRect(cursorRect);
@@ -893,8 +959,13 @@ void BinEdit::paintEvent(QPaintEvent *e)
if (isFullySelected) {
painter.save();
+#if (QT_VERSION >= QT_VERSION_CHECK(5,15,14))
+ painter.fillRect(text_x, y-m_ascent, fm.horizontalAdvance(printable), m_lineHeight,
+ palette().highlight());
+#else
painter.fillRect(text_x, y-m_ascent, fm.width(printable), m_lineHeight,
palette().highlight());
+#endif
painter.setPen(palette().highlightedText().color());
painter.drawText(text_x, y, printable);
painter.restore();
@@ -911,10 +982,17 @@ void BinEdit::paintEvent(QPaintEvent *e)
}
if (cursor >= 0 && !printable.isEmpty()) {
+#if (QT_VERSION >= QT_VERSION_CHECK(5,15,14))
+ QRect cursorRect(text_x + fm.horizontalAdvance(printable.left(cursor)),
+ y-m_ascent,
+ fm.horizontalAdvance(printable.at(cursor)),
+ m_lineHeight);
+#else
QRect cursorRect(text_x + fm.width(printable.left(cursor)),
y-m_ascent,
fm.width(printable.at(cursor)),
m_lineHeight);
+#endif
painter.save();
if (m_hexCursor || !m_cursorVisible) {
painter.setPen(Qt::red);
@@ -1216,7 +1294,7 @@ QString BinEdit::toolTip(const QHelpEvent *helpEvent) const
asDouble(selStart, doubleValueOld, true);
str << tableRowStartC << tr("double value:") << numericTableRowSepC
<< doubleValue << tableRowEndC;
- if (doubleValue != doubleValueOld)
+ if (!qFuzzyCompare(doubleValue, doubleValueOld))
str << tableRowStartC << tr("Previous double value:") << numericTableRowSepC
<< doubleValueOld << tableRowEndC;
str << "";
@@ -1230,7 +1308,7 @@ QString BinEdit::toolTip(const QHelpEvent *helpEvent) const
asFloat(selStart, floatValueOld, true);
str << tableRowStartC << tr("float value:") << numericTableRowSepC
<< floatValue << tableRowEndC;
- if (floatValue != floatValueOld)
+ if (!qFuzzyCompare(floatValue, floatValueOld))
str << tableRowStartC << tr("Previous float value:") << numericTableRowSepC
<< floatValueOld << tableRowEndC;
@@ -1330,7 +1408,7 @@ void BinEdit::keyPressEvent(QKeyEvent *e)
} else {
if (c.unicode() >= 128 || !c.isPrint())
continue;
- changeData(m_cursorPosition, c.unicode(), m_cursorPosition + 1);
+ changeData(m_cursorPosition, c.unicode(), true);
setCursorPosition(m_cursorPosition + 1);
}
setBlinkingCursorEnabled(true);
diff --git a/examples/officeopenxml/opc_package_viewer/binedit.h b/examples/officeopenxml/opc_package_viewer/binedit.h
index 1e8698f..92271e4 100644
--- a/examples/officeopenxml/opc_package_viewer/binedit.h
+++ b/examples/officeopenxml/opc_package_viewer/binedit.h
@@ -88,7 +88,7 @@ class BinEdit : public QAbstractScrollArea
bool isReadOnly() const;
int find(const QByteArray &pattern, int from = 0,
- QTextDocument::FindFlags findFlags = 0);
+ QTextDocument::FindFlags findFlags = QTextDocument::FindFlags());
void selectAll();
void clear();
@@ -110,7 +110,7 @@ class BinEdit : public QAbstractScrollArea
public Q_SLOTS:
void highlightSearchResults(const QByteArray &pattern,
- QTextDocument::FindFlags findFlags = 0);
+ QTextDocument::FindFlags findFlags = QTextDocument::FindFlags());
void copy(bool raw = false);
void setNewWindowRequestAllowed(bool c);
diff --git a/examples/officeopenxml/opc_package_viewer/imagewidget.cpp b/examples/officeopenxml/opc_package_viewer/imagewidget.cpp
index b34e87b..c9e0b8f 100644
--- a/examples/officeopenxml/opc_package_viewer/imagewidget.cpp
+++ b/examples/officeopenxml/opc_package_viewer/imagewidget.cpp
@@ -64,6 +64,7 @@ ImageWidgetPrivate::ImageWidgetPrivate(ImageWidget *q) :
m_scaleMax = 64;
m_wheelScaleEnabled = true;
m_autoAdjustEnabled = false;
+ m_pixmapItem = nullptr;
}
/*!
@@ -195,7 +196,7 @@ bool ImageWidget::isMouseWheelEnabled() const
*/
void ImageWidget::setCurrentScale(double factor)
{
- if (factor == 0) {
+ if (qFuzzyCompare(factor, 0)) {
if (!d->m_autoAdjustEnabled) {
d->m_autoAdjustEnabled = true;
d->doAutoFit();
@@ -245,8 +246,11 @@ void ImageWidget::wheelEvent(QWheelEvent *event)
if (d->m_wheelScaleEnabled) {
//Disable auto fit!!
d->m_autoAdjustEnabled = false;
-
+#if (QT_VERSION >= QT_VERSION_CHECK(5,15,14))
+ double numDegrees = -event->angleDelta().y() / 8.0;
+#else
double numDegrees = -event->delta() / 8.0;
+#endif
double numSteps = numDegrees / 15.0;
double factor = pow(1.125, numSteps);
diff --git a/examples/officeopenxml/opc_packages_diff/mainwindow.cpp b/examples/officeopenxml/opc_packages_diff/mainwindow.cpp
index d4fcfbf..82b092c 100644
--- a/examples/officeopenxml/opc_packages_diff/mainwindow.cpp
+++ b/examples/officeopenxml/opc_packages_diff/mainwindow.cpp
@@ -142,7 +142,7 @@ void MainWindow::onRunButtonClicked()
return;
}
- QStringList args = ui->diffArgumentsEdit->text().split(QRegularExpression("\\s+"), QString::SkipEmptyParts);
+ QStringList args = ui->diffArgumentsEdit->text().split(QRegularExpression("\\s+"), Qt::SkipEmptyParts);
for (int i=0; ipath();
diff --git a/src/3rdParty/karchive/src/karchive.cpp b/src/3rdParty/karchive/src/karchive.cpp
index 1b3371b..16541a1 100644
--- a/src/3rdParty/karchive/src/karchive.cpp
+++ b/src/3rdParty/karchive/src/karchive.cpp
@@ -172,7 +172,7 @@ bool KArchive::close()
closeSucceeded = d->saveFile->commit();
delete d->saveFile;
d->saveFile = 0;
- } if (d->deviceOwned) {
+ } else if (d->deviceOwned) {
delete d->dev; // we created it ourselves in open()
}
@@ -234,9 +234,15 @@ bool KArchive::addLocalFile(const QString &fileName, const QString &destName)
if (symLinkTarget.isEmpty()) { // Mac or Windows
symLinkTarget = fileInfo.symLinkTarget();
}
+ QDateTime fileWasCreated;
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+ fileWasCreated = fileInfo.birthTime();
+#else
+ fileWasCreated = fileInfo.created();
+#endif
return writeSymLink(destName, symLinkTarget, fileInfo.owner(),
fileInfo.group(), fi.st_mode, fileInfo.lastRead(), fileInfo.lastModified(),
- fileInfo.created());
+ fileWasCreated);
}/*end if*/
qint64 size = fileInfo.size();
@@ -249,9 +255,14 @@ bool KArchive::addLocalFile(const QString &fileName, const QString &destName)
//qWarning() << "couldn't open file " << fileName;
return false;
}
-
+ QDateTime fileWasCreated;
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+ fileWasCreated = fileInfo.birthTime();
+#else
+ fileWasCreated = fileInfo.created();
+#endif
if (!prepareWriting(destName, fileInfo.owner(), fileInfo.group(), size,
- fi.st_mode, fileInfo.lastRead(), fileInfo.lastModified(), fileInfo.created())) {
+ fi.st_mode, fileInfo.lastRead(), fileInfo.lastModified(), fileWasCreated)) {
//qWarning() << " prepareWriting" << destName << "failed";
return false;
}
@@ -316,9 +327,11 @@ bool KArchive::writeFile(const QString &name, const QByteArray &data,
// Write data
// Note: if data is null, don't call write, it would terminate the KCompressionDevice
- if (data.constData() && size && !writeData(data.constData(), size)) {
- //qWarning() << "writeData failed";
- return false;
+ if (!data.isNull() && !data.isEmpty()) {
+ if (!writeData(data.constData(), size)) {
+ //qWarning() << "writeData failed";
+ return false;
+ }
}
if (!finishWriting(size)) {
@@ -515,7 +528,13 @@ QDateTime KArchivePrivate::time_tToDateTime(uint time_t)
if (time_t == uint(-1)) {
return QDateTime();
}
- return QDateTime::fromTime_t(time_t);
+ QDateTime retVal;
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+ retVal = QDateTime::fromSecsSinceEpoch(time_t);
+#else
+ retVal = QDateTime::fromTime_t(time_t);
+#endif
+ return retVal;
}
////////////////////////////////////////////////////////////////////////
@@ -874,9 +893,11 @@ bool KArchiveDirectory::copyTo(const QString &dest, bool recursiveCopy) const
}
}
} while (!dirStack.isEmpty());
-
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+ std::sort(fileList.begin(), fileList.end(), sortByPosition); // sort on d->pos, so we have a linear access
+#else
qSort(fileList.begin(), fileList.end(), sortByPosition); // sort on d->pos, so we have a linear access
-
+#endif
for (QList::const_iterator it = fileList.constBegin(), end = fileList.constEnd();
it != end; ++it) {
const KArchiveFile *f = *it;
diff --git a/src/3rdParty/karchive/src/karchiveentry.h b/src/3rdParty/karchive/src/karchiveentry.h
index aad6840..a827d61 100644
--- a/src/3rdParty/karchive/src/karchiveentry.h
+++ b/src/3rdParty/karchive/src/karchiveentry.h
@@ -25,6 +25,7 @@
#include
#include
+#include
#ifdef Q_OS_WIN
#include // mode_t
diff --git a/src/3rdParty/karchive/src/kcompressiondevice.cpp b/src/3rdParty/karchive/src/kcompressiondevice.cpp
index 4f7bba0..fa9e938 100644
--- a/src/3rdParty/karchive/src/kcompressiondevice.cpp
+++ b/src/3rdParty/karchive/src/kcompressiondevice.cpp
@@ -45,7 +45,7 @@ class KCompressionDevice::Private
Private() : bNeedHeader(true), bSkipHeaders(false),
bOpenedUnderlyingDevice(false),
bIgnoreData(false),
- type(KCompressionDevice::None) {}
+ result(KFilterBase::Result()), filter(nullptr), type(KCompressionDevice::None) {}
bool bNeedHeader;
bool bSkipHeaders;
bool bOpenedUnderlyingDevice;
diff --git a/src/3rdParty/karchive/src/kzip.cpp b/src/3rdParty/karchive/src/kzip.cpp
index c2d0d31..6685a1f 100644
--- a/src/3rdParty/karchive/src/kzip.cpp
+++ b/src/3rdParty/karchive/src/kzip.cpp
@@ -76,7 +76,13 @@ static uint transformFromMsDos(const char *buffer)
QDate qd(y, o, d);
QDateTime dt(qd, qt);
- return dt.toTime_t();
+ uint retVal;
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+ retVal = dt.toSecsSinceEpoch();
+#else
+ retVal = dt.toTime_t()
+#endif
+ return retVal;
}
// == parsing routines for zip headers
@@ -930,7 +936,11 @@ bool KZip::closeArchive()
extfield[4] = 1 | 2 | 4; // specify flags from local field
// (unless I misread the spec)
// provide only modification time
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+ unsigned long time = static_cast(it.value()->date().toSecsSinceEpoch()); // Convert 64 to 32 bits!
+#else
unsigned long time = (unsigned long)it.value()->date().toTime_t();
+#endif
extfield[5] = char(time);
extfield[6] = char(time >> 8);
extfield[7] = char(time >> 16);
@@ -1032,9 +1042,15 @@ bool KZip::doPrepareWriting(const QString &name, const QString &user,
return false;
}
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+ uint atime = accessTime.toSecsSinceEpoch();
+ uint mtime = modificationTime.toSecsSinceEpoch();
+ uint ctime = creationTime.toSecsSinceEpoch();
+#else
uint atime = accessTime.toTime_t();
uint mtime = modificationTime.toTime_t();
uint ctime = creationTime.toTime_t();
+#endif
// Find or create parent dir
KArchiveDirectory *parentDir = rootDir();
@@ -1186,6 +1202,7 @@ bool KZip::doPrepareWriting(const QString &name, const QString &user,
bool KZip::doFinishWriting(qint64 size)
{
+ Q_ASSERT(d->m_currentFile);
if (d->m_currentFile->encoding() == 8) {
// Finish
(void)d->m_currentDev->write(0, 0);
@@ -1194,7 +1211,6 @@ bool KZip::doFinishWriting(qint64 size)
// If 0, d->m_currentDev was device() - don't delete ;)
d->m_currentDev = 0;
- Q_ASSERT(d->m_currentFile);
//qDebug() << "fileName: " << d->m_currentFile->path();
//qDebug() << "getpos (at): " << device()->pos();
d->m_currentFile->setSize(size);
diff --git a/src/officeopenxml/mce/mcexmlstreamreader.cpp b/src/officeopenxml/mce/mcexmlstreamreader.cpp
index 2a84344..bd9c19a 100644
--- a/src/officeopenxml/mce/mcexmlstreamreader.cpp
+++ b/src/officeopenxml/mce/mcexmlstreamreader.cpp
@@ -25,6 +25,7 @@
#include
#include
#include
+#include
namespace QtOfficeOpenXml {
namespace Mce {
@@ -181,7 +182,7 @@ void MceXmlElementState::addNamespacePrefix(const QString &prefix, const QString
}
XmlStreamReaderPrivate::XmlStreamReaderPrivate(QXmlStreamReader *reader, XmlStreamReader *q):
- mceParseFlags(0), hasFoundRootElement(false), reader(reader), q_ptr(q)
+ mceParseFlags(0), extensionElementDepth(0), hasFoundRootElement(false), reader(reader), q_ptr(q)
{
}
@@ -455,7 +456,11 @@ QXmlStreamReader::TokenType XmlStreamReader::readNext()
//Figure out whether this element's requires is satisfied.
bool ok = true;
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+ QStringView nsPrefixString = d->reader->attributes().value(QLatin1String("Requires"));
+#else
QStringRef nsPrefixString = d->reader->attributes().value(QLatin1String("Requires"));
+#endif
if (!nsPrefixString.isEmpty()) {
QStringList nsPrefixList = nsPrefixString.toString().split(QRegularExpression(QStringLiteral("[ \\t\\r\\n]+")));
foreach (QString nsPrefix, nsPrefixList) {
@@ -593,7 +598,11 @@ QXmlStreamReader::TokenType XmlStreamReaderPrivate::doReadNext_1()
if (!nonUnderstoodNamespaces.isEmpty()) {
//Find out non-understood and ignorable namespaces.
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+ QStringView nsPrefixString = reader->attributes().value(QLatin1String(mcNamespace), QLatin1String("Ignorable"));
+#else
QStringRef nsPrefixString = reader->attributes().value(QLatin1String(mcNamespace), QLatin1String("Ignorable"));
+#endif
if (!nsPrefixString.isEmpty()) {
QStringList nsPrefixList = nsPrefixString.toString().split(QRegularExpression(QStringLiteral("[ \\t\\r\\n]+")));
foreach (QString nsPrefix, nsPrefixList) {
@@ -621,7 +630,11 @@ QXmlStreamReader::TokenType XmlStreamReaderPrivate::doReadNext_1()
break;
//Deal with ProcessContent attribute.
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+ QStringView pcAttribValue = reader->attributes().value(QLatin1String(mcNamespace), QLatin1String("ProcessContent"));
+#else
QStringRef pcAttribValue = reader->attributes().value(QLatin1String(mcNamespace), QLatin1String("ProcessContent"));
+#endif
if (!pcAttribValue.isEmpty()) {
QStringList pcNameList = pcAttribValue.toString().split(QRegularExpression(QStringLiteral("[ \\t\\r\\n]+")));
foreach (const QString pcName, pcNameList) {
@@ -802,7 +815,11 @@ bool XmlStreamReader::isStandaloneDocument() const
version string as specified in the XML declaration.
Otherwise an empty string is returned.
*/
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+QStringView XmlStreamReader::documentVersion() const
+#else
QStringRef XmlStreamReader::documentVersion() const
+#endif
{
Q_D(const XmlStreamReader);
return d->reader->documentVersion();
@@ -812,7 +829,11 @@ QStringRef XmlStreamReader::documentVersion() const
encoding string as specified in the XML declaration.
Otherwise an empty string is returned.
*/
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+QStringView XmlStreamReader::documentEncoding() const
+#else
QStringRef XmlStreamReader::documentEncoding() const
+#endif
{
Q_D(const XmlStreamReader);
return d->reader->documentEncoding();
@@ -919,7 +940,11 @@ QString XmlStreamReader::readElementText(QXmlStreamReader::ReadElementTextBehavi
\sa namespaceUri(), qualifiedName()
*/
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+QStringView XmlStreamReader::name() const
+#else
QStringRef XmlStreamReader::name() const
+#endif
{
Q_D(const XmlStreamReader);
return d->reader->name();
@@ -930,7 +955,11 @@ QStringRef XmlStreamReader::name() const
\sa name(), qualifiedName()
*/
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+QStringView XmlStreamReader::namespaceUri() const
+#else
QStringRef XmlStreamReader::namespaceUri() const
+#endif
{
Q_D(const XmlStreamReader);
return d->reader->namespaceUri();
@@ -939,7 +968,11 @@ QStringRef XmlStreamReader::namespaceUri() const
/*!
Returns the qualified name of a StartElement or EndElement;
*/
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+QStringView XmlStreamReader::qualifiedName() const
+#else
QStringRef XmlStreamReader::qualifiedName() const
+#endif
{
Q_D(const XmlStreamReader);
return d->reader->qualifiedName();
@@ -949,7 +982,11 @@ QStringRef XmlStreamReader::qualifiedName() const
\sa name(), qualifiedName()
*/
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+QStringView XmlStreamReader::prefix() const
+#else
QStringRef XmlStreamReader::prefix() const
+#endif
{
Q_D(const XmlStreamReader);
return d->reader->prefix();
@@ -958,7 +995,11 @@ QStringRef XmlStreamReader::prefix() const
/*!
Returns the data of a ProcessingInstruction.
*/
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+QStringView XmlStreamReader::processingInstructionData() const
+#else
QStringRef XmlStreamReader::processingInstructionData() const
+#endif
{
Q_D(const XmlStreamReader);
return d->reader->processingInstructionData();
@@ -967,7 +1008,11 @@ QStringRef XmlStreamReader::processingInstructionData() const
/*!
Returns the target of a ProcessingInstruction.
*/
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+QStringView XmlStreamReader::processingInstructionTarget() const
+#else
QStringRef XmlStreamReader::processingInstructionTarget() const
+#endif
{
Q_D(const XmlStreamReader);
return d->reader->processingInstructionTarget();
@@ -976,7 +1021,11 @@ QStringRef XmlStreamReader::processingInstructionTarget() const
/*! Returns the text of Characters, Comment, DTD, or
EntityReference.
*/
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+QStringView XmlStreamReader::text() const
+#else
QStringRef XmlStreamReader::text() const
+#endif
{
Q_D(const XmlStreamReader);
return d->reader->text();
diff --git a/src/officeopenxml/mce/mcexmlstreamreader.h b/src/officeopenxml/mce/mcexmlstreamreader.h
index 184a24f..94cba91 100644
--- a/src/officeopenxml/mce/mcexmlstreamreader.h
+++ b/src/officeopenxml/mce/mcexmlstreamreader.h
@@ -77,9 +77,13 @@ class Q_OFFICEOPENXML_EXPORT XmlStreamReader
inline bool isProcessingInstruction() const { return tokenType() == QXmlStreamReader::ProcessingInstruction; }
bool isStandaloneDocument() const;
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+ QStringView documentVersion() const;
+ QStringView documentEncoding() const;
+#else
QStringRef documentVersion() const;
QStringRef documentEncoding() const;
-
+#endif
qint64 lineNumber() const;
qint64 columnNumber() const;
qint64 characterOffset() const;
@@ -87,7 +91,15 @@ class Q_OFFICEOPENXML_EXPORT XmlStreamReader
QXmlStreamAttributes attributes() const;
QString readElementText(QXmlStreamReader::ReadElementTextBehaviour behaviour = QXmlStreamReader::ErrorOnUnexpectedElement);
-
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+ QStringView name() const;
+ QStringView namespaceUri() const;
+ QStringView qualifiedName() const;
+ QStringView prefix() const;
+ QStringView processingInstructionTarget() const;
+ QStringView processingInstructionData() const;
+ QStringView text() const;
+#else
QStringRef name() const;
QStringRef namespaceUri() const;
QStringRef qualifiedName() const;
@@ -95,7 +107,7 @@ class Q_OFFICEOPENXML_EXPORT XmlStreamReader
QStringRef processingInstructionTarget() const;
QStringRef processingInstructionData() const;
QStringRef text() const;
-
+#endif
QXmlStreamNamespaceDeclarations namespaceDeclarations() const;
void raiseError(const QString& message = QString());
diff --git a/src/officeopenxml/mce/mcexmlstreamreader_p.h b/src/officeopenxml/mce/mcexmlstreamreader_p.h
index d1be8e9..11e2b0d 100644
--- a/src/officeopenxml/mce/mcexmlstreamreader_p.h
+++ b/src/officeopenxml/mce/mcexmlstreamreader_p.h
@@ -89,6 +89,8 @@ class MceXmlElementStateData : public QSharedData
MceXmlElementStateData(const MceXmlElementStateData &other)
:QSharedData(other), ignorableNamespaces(other.ignorableNamespaces)
, processContentNeededElements(other.processContentNeededElements)
+ , extensionElements(other.extensionElements)
+ , namespacePrefixes(other.namespacePrefixes)
{}
~MceXmlElementStateData(){}
diff --git a/src/officeopenxml/ooxml/ooxmlschames_p.h b/src/officeopenxml/ooxml/ooxmlschames_p.h
index 3eaa410..bea9ce1 100644
--- a/src/officeopenxml/ooxml/ooxmlschames_p.h
+++ b/src/officeopenxml/ooxml/ooxmlschames_p.h
@@ -44,7 +44,7 @@ namespace Ooxml {
struct OoxmlSchamesData
{
- OoxmlSchamesData(int id, const QString transitional, const QString &strict=QString(), const QString &prefix=QString()) :
+ OoxmlSchamesData(int id, const QString &transitional, const QString &strict=QString(), const QString &prefix=QString()) :
id(id), prefix(prefix), strict(strict), transitional(transitional)
{}
diff --git a/src/officeopenxml/opc/opcpackagepart.cpp b/src/officeopenxml/opc/opcpackagepart.cpp
index 12981d9..2cda877 100644
--- a/src/officeopenxml/opc/opcpackagepart.cpp
+++ b/src/officeopenxml/opc/opcpackagepart.cpp
@@ -36,7 +36,7 @@ namespace Opc {
* \internal
*/
-PackagePartPrivate::PackagePartPrivate(const QString &partName, const QString type, PackagePart *q, Package *package)
+PackagePartPrivate::PackagePartPrivate(const QString &partName, const QString &type, PackagePart *q, Package *package)
:q_ptr(q), package(package), partName(partName), contentType(type), relationshipHelper(0)
{
diff --git a/src/officeopenxml/opc/opcpackagepart_p.h b/src/officeopenxml/opc/opcpackagepart_p.h
index 69109ad..c11ed6c 100644
--- a/src/officeopenxml/opc/opcpackagepart_p.h
+++ b/src/officeopenxml/opc/opcpackagepart_p.h
@@ -46,7 +46,7 @@ class OFFICEOPENXML_AUTOTEST_EXPORT PackagePartPrivate
Q_DECLARE_PUBLIC(PackagePart)
public:
- PackagePartPrivate(const QString &partName, const QString type, PackagePart *q, Package *package);
+ PackagePartPrivate(const QString &partName, const QString &type, PackagePart *q, Package *package);
virtual ~PackagePartPrivate();
void ensureRelationship() const;
bool isRelationshipPart() const;
diff --git a/src/officeopenxml/opc/opcpartbasedpackageproperties.cpp b/src/officeopenxml/opc/opcpartbasedpackageproperties.cpp
index 9642f46..607f08f 100644
--- a/src/officeopenxml/opc/opcpartbasedpackageproperties.cpp
+++ b/src/officeopenxml/opc/opcpartbasedpackageproperties.cpp
@@ -114,7 +114,11 @@ void PartBasedPackageProperties::doLoadFromXml(QIODevice *device)
while (!reader.atEnd()) {
if (reader.readNextStartElement()) {
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+ const QStringView name = reader.name();
+#else
const QStringRef name = reader.name();
+#endif
//Todo, "keywords" support lang attribute.
for (int idx=0; idx<16; ++idx) {
if (name == QLatin1String(propertiesNameTable[idx])) {
@@ -151,6 +155,7 @@ void PartBasedPackageProperties::doSaveToXml(QIODevice *device)
switch (pe) {
case PE_Category:
case PE_ContentStatus:
+ case PE_ContentType:
case PE_Keywords:
case PE_LastModifiedBy:
case PE_LastPrinted:
@@ -199,10 +204,18 @@ QDateTime PartBasedPackageProperties::dateTimeProperty(PropertyEnum pe) const
dt = QDateTime::fromString(dt_string, Qt::TextDate);
if (dt.isNull())
dt = QDateTime::fromString(dt_string, Qt::RFC2822Date);
+#if (QT_VERSION >= QT_VERSION_CHECK(5,13,0))
+ QLocale ql;
+ if (dt.isNull())
+ dt = ql.toDateTime(dt_string, QLocale::LongFormat);
+ if (dt.isNull())
+ dt = ql.toDateTime(dt_string, QLocale::ShortFormat);
+#else
if (dt.isNull())
dt = QDateTime::fromString(dt_string, Qt::SystemLocaleLongDate);
if (dt.isNull())
dt = QDateTime::fromString(dt_string, Qt::SystemLocaleShortDate);
+#endif
return dt;
}
diff --git a/src/officeopenxml/opc/opcutils_p.h b/src/officeopenxml/opc/opcutils_p.h
index 0e79633..ca6563f 100644
--- a/src/officeopenxml/opc/opcutils_p.h
+++ b/src/officeopenxml/opc/opcutils_p.h
@@ -37,8 +37,9 @@
#include
-class QString;
-class QStringList;
+#include
+#include
+
namespace QtOfficeOpenXml {
namespace Opc {
diff --git a/src/officeopenxml/opc/opczippackagepart.cpp b/src/officeopenxml/opc/opczippackagepart.cpp
index 4f91832..96e17c2 100644
--- a/src/officeopenxml/opc/opczippackagepart.cpp
+++ b/src/officeopenxml/opc/opczippackagepart.cpp
@@ -38,8 +38,8 @@ namespace Opc {
* \class QtOfficeOpenXml::Opc::ZipPackagePartPrivate
* \internal
*/
-ZipPackagePartPrivate::ZipPackagePartPrivate(const QString &partName, const QString type, PackagePart *q, Package *package)
- :PackagePartPrivate(partName, type, q, package), zipFileEntry(0), device(0)
+ZipPackagePartPrivate::ZipPackagePartPrivate(const QString &partName, const QString &type, PackagePart *q, Package *package)
+ :PackagePartPrivate(partName, type, q, package), zipArchive(0), zipFileEntry(0), device(0)
{
}
diff --git a/src/officeopenxml/opc/opczippackagepart_p.h b/src/officeopenxml/opc/opczippackagepart_p.h
index 98ab85a..414a476 100644
--- a/src/officeopenxml/opc/opczippackagepart_p.h
+++ b/src/officeopenxml/opc/opczippackagepart_p.h
@@ -48,7 +48,7 @@ namespace Opc {
class ZipPackagePartPrivate : public PackagePartPrivate
{
public:
- ZipPackagePartPrivate(const QString &partName, const QString type, PackagePart *q, Package *package);
+ ZipPackagePartPrivate(const QString &partName, const QString &type, PackagePart *q, Package *package);
KZip *zipArchive;
const KZipFileEntry *zipFileEntry;
diff --git a/src/officeopenxml/sml/smlcell.cpp b/src/officeopenxml/sml/smlcell.cpp
index 6eb6728..a676b35 100644
--- a/src/officeopenxml/sml/smlcell.cpp
+++ b/src/officeopenxml/sml/smlcell.cpp
@@ -59,7 +59,7 @@ Cell::CellType Cell::cellType() const
Q_D(const Cell);
if (d->attrs_raw.contains(QStringLiteral("t"))) {
QString t = d->attrs_raw[QStringLiteral("t")];
- for (int i=0; i