Здравствуйте можно ли в библиотеки реализовать такой метод bool loadFromDom(const QDomDocument & document); в классе ReportEngine, для предобработки отчёта
lrreportengine.h
#include <QDomComment>
class LIMEREPORT_EXPORT ReportEngine : public QObject{
...
public:
bool loadFromDom(const QDomDocument & document);
...
}
lrreportengine_p.h
class ReportEnginePrivate : public QObject,
public ICollectionContainer,
public ITranslationContainer,
public IExternalPainter,
public ReportEnginePrivateInterface
{
...
public:
bool loadFromDom(const QDomDocument & document, const QString & name = "");
...
}
lrreportengine.cpp
bool ReportEnginePrivate::loadFromDom(const QDomDocument &document, const QString &name){
clearReport();
ItemsReaderIntf::Ptr reader = DomXMLReader::create(document);
reader->setPassPhrase(m_passPhrase);
if (reader->first()){
if (reader->readItem(this)){
m_fileName = "";
m_reportName = name;
emit loadFinished();
return true;
};
}
return false;
}
bool ReportEngine::loadFromDom(const QDomDocument & document)
{
Q_D(ReportEngine);
return d->loadFromDom(document);
}
lrxmlreader.h
class DomXMLReader : public XMLReader{
public:
static ItemsReaderIntf::Ptr create(const QDomDocument & content){ return ItemsReaderIntf::Ptr(new DomXMLReader(content));}
protected:
virtual bool prepareReader(QDomDocument *doc);
private:
DomXMLReader(const QDomDocument & content): m_content(content){}
const QDomDocument & m_content;
};
lrxmlreader.cpp
bool DomXMLReader::prepareReader(QDomDocument * doc)
{
if (!m_content.isNull()){
* doc = m_content;
} else {m_error = QString(QObject::tr("Document is empty")); return false;}
return true;
}