Changeset View
Changeset View
Standalone View
Standalone View
src/renderer/KReportHTMLCSSRenderer_p.cpp
Show First 20 Lines • Show All 115 Lines • ▼ Show 20 Line(s) | 99 | if (section->type() == KReportSectionData::GroupHeader || | |||
---|---|---|---|---|---|
116 | } | 116 | } | ||
117 | styleindex = styles.indexOf(style); | 117 | styleindex = styles.indexOf(style); | ||
118 | 118 | | |||
119 | body += QLatin1String("<div class=\"style") + QString::number(styleindex) + QLatin1String("\">\n"); | 119 | body += QLatin1String("<div class=\"style") + QString::number(styleindex) + QLatin1String("\">\n"); | ||
120 | //Render the objects in each section | 120 | //Render the objects in each section | ||
121 | for (int i = 0; i < section->primitiveCount(); i++) { | 121 | for (int i = 0; i < section->primitiveCount(); i++) { | ||
122 | OROPrimitive * prim = section->primitive(i); | 122 | OROPrimitive * prim = section->primitive(i); | ||
123 | //kreportDebug() << "Got object type" << prim->type(); | 123 | //kreportDebug() << "Got object type" << prim->type(); | ||
124 | if (dynamic_cast<OROTextBox*>(prim)) { | 124 | if (OROTextBox *tb = dynamic_cast<OROTextBox*>(prim)) { | ||
125 | OROTextBox * tb = dynamic_cast<OROTextBox*>(prim); | | |||
126 | | ||||
127 | QColor bg = tb->textStyle().backgroundColor; | 125 | QColor bg = tb->textStyle().backgroundColor; | ||
128 | style = QLatin1String("position: absolute; ") + | 126 | style = QLatin1String("position: absolute; ") + | ||
129 | QLatin1String("background-color: ") + QString::fromLatin1("rgba(%1,%2,%3,%4)") | 127 | QLatin1String("background-color: ") + QString::fromLatin1("rgba(%1,%2,%3,%4)") | ||
130 | .arg(bg.red()) | 128 | .arg(bg.red()) | ||
131 | .arg(bg.green()) | 129 | .arg(bg.green()) | ||
132 | .arg(bg.blue()) | 130 | .arg(bg.blue()) | ||
133 | .arg(0.01 * tb->textStyle().backgroundOpacity) +QLatin1String( "; ") + | 131 | .arg(0.01 * tb->textStyle().backgroundOpacity) +QLatin1String( "; ") + | ||
134 | QLatin1String("top: ") + QString::number(tb->position().y()) + QLatin1String("pt; ") + | 132 | QLatin1String("top: ") + QString::number(tb->position().y()) + QLatin1String("pt; ") + | ||
Show All 11 Lines | |||||
146 | if (!styles.contains(style)) { | 144 | if (!styles.contains(style)) { | ||
147 | styles << style; | 145 | styles << style; | ||
148 | } | 146 | } | ||
149 | styleindex = styles.indexOf(style); | 147 | styleindex = styles.indexOf(style); | ||
150 | 148 | | |||
151 | body += QLatin1String("<div class=\"style") + QString::number(styleindex) + QLatin1String("\">") + | 149 | body += QLatin1String("<div class=\"style") + QString::number(styleindex) + QLatin1String("\">") + | ||
152 | tb->text() + | 150 | tb->text() + | ||
153 | QLatin1String("</div>\n"); | 151 | QLatin1String("</div>\n"); | ||
154 | } else if (dynamic_cast<OROImage*>(prim)) { | 152 | } else if (OROImage *im = dynamic_cast<OROImage*>(prim)) { | ||
155 | //kreportDebug() << "Saving an image"; | | |||
156 | OROImage * im = dynamic_cast<OROImage*>(prim); | | |||
157 | style = QLatin1String("position: absolute; ") + | 153 | style = QLatin1String("position: absolute; ") + | ||
158 | QLatin1String("top: ") + QString::number(im->position().y()) + QLatin1String("pt; ") + | 154 | QLatin1String("top: ") + QString::number(im->position().y()) + QLatin1String("pt; ") + | ||
159 | QLatin1String("left: ") + QString::number(im->position().x()) + QLatin1String("pt; "); | 155 | QLatin1String("left: ") + QString::number(im->position().x()) + QLatin1String("pt; "); | ||
160 | if (!styles.contains(style)) { | 156 | if (!styles.contains(style)) { | ||
161 | styles << style; | 157 | styles << style; | ||
162 | } | 158 | } | ||
163 | styleindex = styles.indexOf(style); | 159 | styleindex = styles.indexOf(style); | ||
164 | 160 | | |||
165 | body += QLatin1String("<div class=\"style") + QString::number(styleindex) + QLatin1String("\">") + | 161 | body += QLatin1String("<div class=\"style") + QString::number(styleindex) + QLatin1String("\">") + | ||
166 | QLatin1String("<img width=\"") + QString::number(im->size().width()) + QLatin1String("px") + QLatin1String("\" height=\"") + QString::number(im->size().height()) + QLatin1String("px") + QLatin1String("\" src=\"./") + m_actualDirName + QLatin1String("/object") + QString::number(s) + QString::number(i) + QLatin1String(".png\"></img>") + | 162 | QLatin1String("<img width=\"") + QString::number(im->size().width()) + QLatin1String("px") + QLatin1String("\" height=\"") + QString::number(im->size().height()) + QLatin1String("px") + QLatin1String("\" src=\"./") + m_actualDirName + QLatin1String("/object") + QString::number(s) + QString::number(i) + QLatin1String(".png\"></img>") + | ||
167 | QLatin1String("</div>\n"); | 163 | QLatin1String("</div>\n"); | ||
168 | 164 | | |||
169 | 165 | | |||
170 | im->image().save(m_tempDirName + QLatin1String("/object") + QString::number(s) + QString::number(i) + QLatin1String(".png")); | 166 | im->image().save(m_tempDirName + QLatin1String("/object") + QString::number(s) + QString::number(i) + QLatin1String(".png")); | ||
171 | } else if (dynamic_cast<OROPicture*>(prim)) { | 167 | } else if (OROPicture *im = dynamic_cast<OROPicture*>(prim)) { | ||
172 | //kreportDebug() << "Saving a picture"; | | |||
173 | OROPicture * im = dynamic_cast<OROPicture*>(prim); | | |||
174 | style = QLatin1String("position: absolute; ") + | 168 | style = QLatin1String("position: absolute; ") + | ||
175 | QLatin1String("top: ") + QString::number(im->position().y()) + QLatin1String("pt; ") + | 169 | QLatin1String("top: ") + QString::number(im->position().y()) + QLatin1String("pt; ") + | ||
176 | QLatin1String("left: ") + QString::number(im->position().x()) + QLatin1String("pt; "); | 170 | QLatin1String("left: ") + QString::number(im->position().x()) + QLatin1String("pt; "); | ||
177 | if (!styles.contains(style)) { | 171 | if (!styles.contains(style)) { | ||
178 | styles << style; | 172 | styles << style; | ||
179 | } | 173 | } | ||
180 | styleindex = styles.indexOf(style); | 174 | styleindex = styles.indexOf(style); | ||
181 | 175 | | |||
Show All 40 Lines |