20#include "KoOdtFrameReportPrimitive.h"
21#include "KReportRenderObjects.h"
23#include <KoXmlWriter.h>
24#include <KReportDpi.h>
25#include <KoGenStyle.h>
26#include <KoGenStyles.h>
28KoOdtFrameReportPrimitive::KoOdtFrameReportPrimitive(
OROPrimitive *primitive)
29 : m_primitive(primitive)
34KoOdtFrameReportPrimitive::~KoOdtFrameReportPrimitive()
38bool KoOdtFrameReportPrimitive::isValid()
const
40 return (
bool)m_primitive;
43void KoOdtFrameReportPrimitive::setPrimitive(
OROPrimitive *primitive)
45 m_primitive = primitive;
48int KoOdtFrameReportPrimitive::pageNumber()
const
50 return isValid() && m_primitive->page() ? m_primitive->page()->pageNumber() + 1 : 0;
53void KoOdtFrameReportPrimitive::setUID(
int uid)
58int KoOdtFrameReportPrimitive::uid()
const
63QString KoOdtFrameReportPrimitive::itemName()
const
65 return QString(
"Item_%1").
arg(m_uid);
68void KoOdtFrameReportPrimitive::createStyle(KoGenStyles *coll)
70 KoGenStyle gs(KoGenStyle::GraphicStyle,
"graphic");
71 gs.addProperty(
"draw:fill",
"none");
72 gs.addPropertyPt(
"fo:margin", 0);
73 gs.addProperty(
"style:horizontal-pos",
"from-left");
74 gs.addProperty(
"style:horizontal-rel",
"page");
75 gs.addProperty(
"style:vertical-pos",
"from-top");
76 gs.addProperty(
"style:vertical-rel",
"page");
77 gs.addProperty(
"style:wrap",
"dynamic");
78 gs.addPropertyPt(
"style:wrap-dynamic-threshold", 0);
80 m_frameStyleName = coll->insert(gs,
"F");
83void KoOdtFrameReportPrimitive::createBody(KoXmlWriter *bodyWriter)
const
88void KoOdtFrameReportPrimitive::commonAttributes(KoXmlWriter *bodyWriter)
const
91 qreal x = m_primitive->position().x() / KReportPrivate::dpiX();
92 qreal y = m_primitive->position().y() / KReportPrivate::dpiX();
93 qreal w = m_primitive->size().width() / KReportPrivate::dpiX();
94 qreal h = m_primitive->size().height() / KReportPrivate::dpiY();
96 bodyWriter->addAttribute(
"svg:x", QString(
"%1in").arg(x));
97 bodyWriter->addAttribute(
"svg:y", QString(
"%1in").arg(y));
98 bodyWriter->addAttribute(
"svg:width", QString(
"%1in").arg(w));
99 bodyWriter->addAttribute(
"svg:height", QString(
"%1in").arg(h));
100 bodyWriter->addAttribute(
"draw:z-index",
"3");
103bool KoOdtFrameReportPrimitive::saveData(KoStore *, KoXmlWriter*)
const
Represents the basic primitive with a position and type. Other primitives are subclasses with a defin...
QString arg(Args &&... args) const const