Class Refactoring
This commit is contained in:
+2
-2
@@ -43,7 +43,7 @@ HEADERS += $$PWD/xlsxdocpropscore_p.h \
|
||||
$$PWD/xlsxabstractooxmlfile_p.h \
|
||||
$$PWD/xlsxchart.h \
|
||||
$$PWD/xlsxchart_p.h \
|
||||
$$PWD/xlsxexternallink_p.h
|
||||
$$PWD/xlsxsimpleooxmlfile_p.h
|
||||
|
||||
SOURCES += $$PWD/xlsxdocpropscore.cpp \
|
||||
$$PWD/xlsxdocpropsapp.cpp \
|
||||
@@ -72,5 +72,5 @@ SOURCES += $$PWD/xlsxdocpropscore.cpp \
|
||||
$$PWD/xlsxmediafile.cpp \
|
||||
$$PWD/xlsxabstractooxmlfile.cpp \
|
||||
$$PWD/xlsxchart.cpp \
|
||||
$$PWD/xlsxexternallink.cpp
|
||||
$$PWD/xlsxsimpleooxmlfile.cpp
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ bool DocumentPrivate::loadPackage(QIODevice *device)
|
||||
|
||||
//load external links
|
||||
for (int i=0; i<workbook->d_func()->externalLinks.count(); ++i) {
|
||||
ExternalLinK *link = workbook->d_func()->externalLinks[i].data();
|
||||
SimpleOOXmlFile *link = workbook->d_func()->externalLinks[i].data();
|
||||
QString rel_path = getRelFilePath(link->filePath());
|
||||
//If the .rel file exists, load it.
|
||||
if (zipReader.filePaths().contains(rel_path))
|
||||
@@ -255,7 +255,7 @@ bool DocumentPrivate::savePackage(QIODevice *device) const
|
||||
|
||||
// save external links xml files
|
||||
for (int i=0; i<workbook->d_func()->externalLinks.count(); ++i) {
|
||||
ExternalLinK *link = workbook->d_func()->externalLinks[i].data();
|
||||
SimpleOOXmlFile *link = workbook->d_func()->externalLinks[i].data();
|
||||
contentTypes.addExternalLinkName(QStringLiteral("externalLink%1").arg(i+1));
|
||||
|
||||
zipWriter.addFile(QStringLiteral("xl/externalLinks/externalLink%1.xml").arg(i+1), link->saveToXmlData());
|
||||
|
||||
@@ -22,31 +22,31 @@
|
||||
** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "xlsxexternallink_p.h"
|
||||
#include "xlsxsimpleooxmlfile_p.h"
|
||||
#include <QIODevice>
|
||||
|
||||
namespace QXlsx {
|
||||
ExternalLinK::ExternalLinK()
|
||||
SimpleOOXmlFile::SimpleOOXmlFile()
|
||||
{
|
||||
}
|
||||
|
||||
void ExternalLinK::saveToXmlFile(QIODevice *device) const
|
||||
void SimpleOOXmlFile::saveToXmlFile(QIODevice *device) const
|
||||
{
|
||||
device->write(xmlData);
|
||||
}
|
||||
|
||||
QByteArray ExternalLinK::saveToXmlData() const
|
||||
QByteArray SimpleOOXmlFile::saveToXmlData() const
|
||||
{
|
||||
return xmlData;
|
||||
}
|
||||
|
||||
bool ExternalLinK::loadFromXmlData(const QByteArray &data)
|
||||
bool SimpleOOXmlFile::loadFromXmlData(const QByteArray &data)
|
||||
{
|
||||
xmlData = data;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ExternalLinK::loadFromXmlFile(QIODevice *device)
|
||||
bool SimpleOOXmlFile::loadFromXmlFile(QIODevice *device)
|
||||
{
|
||||
xmlData = device->readAll();
|
||||
return true;
|
||||
@@ -22,8 +22,8 @@
|
||||
** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef XLSXEXTERNALLINK_H
|
||||
#define XLSXEXTERNALLINK_H
|
||||
#ifndef XLSXSIMPLEOOXMLFILE_H
|
||||
#define XLSXSIMPLEOOXMLFILE_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
@@ -42,10 +42,10 @@ class QIODevice;
|
||||
|
||||
namespace QXlsx {
|
||||
|
||||
class ExternalLinK : public AbstractOOXmlFile
|
||||
class SimpleOOXmlFile : public AbstractOOXmlFile
|
||||
{
|
||||
public:
|
||||
ExternalLinK();
|
||||
SimpleOOXmlFile();
|
||||
|
||||
void saveToXmlFile(QIODevice *device) const;
|
||||
QByteArray saveToXmlData() const;
|
||||
@@ -56,4 +56,4 @@ public:
|
||||
};
|
||||
|
||||
}
|
||||
#endif // XLSXEXTERNALLINK_H
|
||||
#endif // XLSXSIMPLEOOXMLFILE_H
|
||||
@@ -545,7 +545,7 @@ bool Workbook::loadFromXmlFile(QIODevice *device)
|
||||
const QString rId = attributes.value(QLatin1String("r:id")).toString();
|
||||
XlsxRelationship relationship = d->relationships->getRelationshipById(rId);
|
||||
|
||||
QSharedPointer<ExternalLinK> link(new ExternalLinK);
|
||||
QSharedPointer<SimpleOOXmlFile> link(new SimpleOOXmlFile);
|
||||
const QString fullPath = QDir::cleanPath(splitPath(filePath())[0] +QLatin1String("/")+ relationship.target);
|
||||
link->setFilePath(fullPath);
|
||||
d->externalLinks.append(link);
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "xlsxworkbook.h"
|
||||
#include "xlsxabstractooxmlfile_p.h"
|
||||
#include "xlsxtheme_p.h"
|
||||
#include "xlsxexternallink_p.h"
|
||||
#include "xlsxsimpleooxmlfile_p.h"
|
||||
#include "xlsxrelationships_p.h"
|
||||
|
||||
#include <QSharedPointer>
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
|
||||
QSharedPointer<SharedStrings> sharedStrings;
|
||||
QList<QSharedPointer<AbstractSheet> > sheets;
|
||||
QList<QSharedPointer<ExternalLinK> > externalLinks;
|
||||
QList<QSharedPointer<SimpleOOXmlFile> > externalLinks;
|
||||
QStringList sheetNames;
|
||||
QSharedPointer<Styles> styles;
|
||||
QSharedPointer<Theme> theme;
|
||||
|
||||
Reference in New Issue
Block a user