2022-06-21 22:10:21 +02:00
|
|
|
#include <quazip.h>
|
|
|
|
#include <quazipfile.h>
|
2019-04-06 17:16:42 +02:00
|
|
|
#include "odtprocessor.h"
|
|
|
|
#include "tagstripperprocessor.h"
|
|
|
|
|
2023-05-14 14:14:51 +02:00
|
|
|
DocumentProcessResult OdtProcessor::process(const QByteArray & /*data*/) const
|
2019-04-06 17:16:42 +02:00
|
|
|
{
|
2021-06-12 14:59:58 +02:00
|
|
|
throw LooqsGeneralException("Not implemented yet");
|
2019-04-06 17:16:42 +02:00
|
|
|
}
|
|
|
|
|
2023-05-14 14:14:51 +02:00
|
|
|
DocumentProcessResult OdtProcessor::process(QString path) const
|
2019-04-06 17:16:42 +02:00
|
|
|
{
|
|
|
|
QuaZipFile zipFile(path);
|
|
|
|
zipFile.setFileName("content.xml");
|
|
|
|
if(!zipFile.open(QIODevice::ReadOnly))
|
|
|
|
{
|
2021-06-12 14:59:58 +02:00
|
|
|
throw LooqsGeneralException("Error while opening file " + path);
|
2019-04-06 17:16:42 +02:00
|
|
|
}
|
|
|
|
QByteArray entireContent = zipFile.readAll();
|
|
|
|
if(entireContent.isEmpty())
|
|
|
|
{
|
2021-06-12 14:59:58 +02:00
|
|
|
throw LooqsGeneralException("Error while reading content.xml of " + path);
|
2019-04-06 17:16:42 +02:00
|
|
|
}
|
|
|
|
TagStripperProcessor tsp;
|
|
|
|
return tsp.process(entireContent);
|
|
|
|
}
|