20#include "KoOdtFrameReportImage.h"
21#include <KoXmlWriter.h>
23#include <KoStoreDevice.h>
25#include <QMimeDatabase>
28#include "KReportRenderObjects.h"
30KoOdtFrameReportImage::KoOdtFrameReportImage(
OROImage *primitive)
31 : KoOdtFrameReportPrimitive(primitive)
35KoOdtFrameReportImage::~KoOdtFrameReportImage()
39OROImage *KoOdtFrameReportImage::image()
const
41 return static_cast<OROImage*
>(m_primitive);
44void KoOdtFrameReportImage::setImageName(
const QString &name)
49void KoOdtFrameReportImage::createBody(KoXmlWriter *bodyWriter)
const
51 bodyWriter->startElement(
"draw:frame");
52 bodyWriter->addAttribute(
"draw:style-name",
"picture");
53 bodyWriter->addAttribute(
"draw:id", itemName());
54 bodyWriter->addAttribute(
"draw:name", itemName());
55 bodyWriter->addAttribute(
"text:anchor-type",
"page");
56 bodyWriter->addAttribute(
"text:anchor-page-number", pageNumber());
57 bodyWriter->addAttribute(
"draw:style-name", m_frameStyleName);
59 commonAttributes(bodyWriter);
61 bodyWriter->startElement(
"draw:image");
62 bodyWriter->addAttribute(
"xlink:href",
"Pictures/" + imageName());
63 bodyWriter->addAttribute(
"xlink:type",
"simple");
64 bodyWriter->addAttribute(
"xlink:show",
"embed");
65 bodyWriter->addAttribute(
"xlink:actuate",
"onLoad");
66 bodyWriter->endElement();
68 bodyWriter->endElement();
71bool KoOdtFrameReportImage::saveData(KoStore* store, KoXmlWriter* manifestWriter)
const
74 if (!store->open(name)) {
77 KoStoreDevice device(store);
78 bool ok = image()->image().
save(&device,
"PNG");
82 manifestWriter->addManifestEntry(name, mimetype);
84 ok = store->close() &&
ok;
Defines an image. An image is a bitmap.
KIOCORE_EXPORT MimetypeJob * mimetype(const QUrl &url, JobFlags flags=DefaultFlags)
QString name(StandardAction id)
bool save(QIODevice *device, const char *format, int quality) const const
QMimeType mimeTypeForFile(const QFileInfo &fileInfo, MatchMode mode) const const