20#include "KoOdtFrameReportPicture.h"
21#include "KReportRenderObjects.h"
23#include <KoXmlWriter.h>
24#include <KoOdfGraphicStyles.h>
25#include <KoGenStyle.h>
26#include <KoGenStyles.h>
27#include <KReportUnit.h>
29#include <KoStoreDevice.h>
32#include "kreport_debug.h"
33#include <QMimeDatabase>
36KoOdtFrameReportPicture::KoOdtFrameReportPicture(
OROPrimitive *primitive)
37 : KoOdtFrameReportPrimitive(primitive)
41KoOdtFrameReportPicture::~KoOdtFrameReportPicture()
45OROPicture *KoOdtFrameReportPicture::picture()
const
47 return dynamic_cast<OROPicture*
>(m_primitive);
50void KoOdtFrameReportPicture::createBody(KoXmlWriter *bodyWriter)
const
52 bodyWriter->startElement(
"draw:frame");
53 bodyWriter->addAttribute(
"draw:id", itemName());
54 bodyWriter->addAttribute(
"xml:id", itemName());
55 bodyWriter->addAttribute(
"draw:name", itemName());
56 bodyWriter->addAttribute(
"text:anchor-type",
"page");
57 bodyWriter->addAttribute(
"text:anchor-page-number", pageNumber());
58 bodyWriter->addAttribute(
"draw:style-name", m_frameStyleName);
60 commonAttributes(bodyWriter);
62 bodyWriter->startElement(
"draw:image");
63 bodyWriter->addAttribute(
"xlink:href",
"Pictures/" + pictureName());
64 bodyWriter->addAttribute(
"xlink:type",
"simple");
65 bodyWriter->addAttribute(
"xlink:show",
"embed");
66 bodyWriter->addAttribute(
"xlink:actuate",
"onLoad");
67 bodyWriter->endElement();
69 bodyWriter->endElement();
72bool KoOdtFrameReportPicture::saveData(KoStore* store, KoXmlWriter* manifestWriter)
const
74 QString
name =
"Pictures/" + pictureName();
75 if (!store->open(name)) {
78 KoStoreDevice device(store);
82 painter.
begin(&image);
87 bool ok = image.save(&device,
"PNG");
91 manifestWriter->addManifestEntry(name, mimetype);
93 ok = store->close() &&
ok;
Defines a picture. A picture is different to an image, in that it is drawn using commands.
Represents the basic primitive with a position and type. Other primitives are subclasses with a defin...
KIOCORE_EXPORT MimetypeJob * mimetype(const QUrl &url, JobFlags flags=DefaultFlags)
QString name(StandardAction id)
QMimeType mimeTypeForFile(const QFileInfo &fileInfo, MatchMode mode) const const
bool begin(QPaintDevice *device)
void drawPicture(const QPoint &point, const QPicture &picture)
void setRenderHint(RenderHint hint, bool on)