mirror of
https://github.com/webodf/WebODF.git
synced 2026-11-30 16:47:58 +01:00
34 lines
856 B
C++
34 lines
856 B
C++
#include "odf.h"
|
|
#include "odfcontainer.h"
|
|
#include <QtCore/QDebug>
|
|
#include <QtWebKit/QWebFrame>
|
|
|
|
OdfContainer* Odf::getContainer(const QString& url) {
|
|
return new OdfContainer(url, this);
|
|
}
|
|
|
|
OdfContainer* Odf::getOpenContainer(const QString& id) {
|
|
return openfiles.value(id);
|
|
}
|
|
|
|
void
|
|
Odf::addFile(const QString& containerid, const QString& path)
|
|
{
|
|
if (!openfiles.contains(containerid)) {
|
|
openfiles.insert(containerid, new OdfContainer(path, this));
|
|
}
|
|
}
|
|
|
|
QString
|
|
Odf::load(QString containerid, QString path, QString odfcontainerid)
|
|
{
|
|
OdfContainer* c = openfiles.value(containerid);
|
|
QString result;
|
|
if (c) {
|
|
result = c->loadAsString(path);
|
|
}
|
|
// TODO: call the callback with escaped result data
|
|
// frame->evaluateJavaScript("window.qtodf."+odfcontainerid+".callback("+result+");")
|
|
return result;
|
|
}
|