Changeset View
Changeset View
Standalone View
Standalone View
src/renderer/KReportHTMLTableRenderer_p.cpp
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Line(s) | 84 | { | |||
---|---|---|---|---|---|
88 | 88 | | |||
89 | bool renderedPageHeader = false; | 89 | bool renderedPageHeader = false; | ||
90 | bool renderedPageFooter = false; | 90 | bool renderedPageFooter = false; | ||
91 | 91 | | |||
92 | QDir d(m_tempDirName); | 92 | QDir d(m_tempDirName); | ||
93 | 93 | | |||
94 | // Render Each Section | 94 | // Render Each Section | ||
95 | body = QLatin1String("<table>\n"); | 95 | body = QLatin1String("<table>\n"); | ||
96 | for (long s = 0; s < document->sections(); s++) { | 96 | for (int s = 0; s < document->sectionCount(); s++) { | ||
staniek: long -> int | |||||
97 | OROSection *section = document->section(s); | 97 | OROSection *section = document->section(s); | ||
98 | section->sortPrimatives(OROSection::SortX); | 98 | section->sortPrimitives(Qt::Horizontal); | ||
99 | 99 | | |||
100 | if (section->type() == KReportSectionData::GroupHeader || | 100 | if (section->type() == KReportSectionData::GroupHeader || | ||
101 | section->type() == KReportSectionData::GroupFooter || | 101 | section->type() == KReportSectionData::GroupFooter || | ||
102 | section->type() == KReportSectionData::Detail || | 102 | section->type() == KReportSectionData::Detail || | ||
103 | section->type() == KReportSectionData::ReportHeader || | 103 | section->type() == KReportSectionData::ReportHeader || | ||
104 | section->type() == KReportSectionData::ReportFooter || | 104 | section->type() == KReportSectionData::ReportFooter || | ||
105 | (section->type() == KReportSectionData::PageHeaderAny && !renderedPageHeader) || | 105 | (section->type() == KReportSectionData::PageHeaderAny && !renderedPageHeader) || | ||
106 | (section->type() == KReportSectionData::PageFooterAny && !renderedPageFooter && s > document->sections() - 2)) { //render the page foot right at the end, it will either be the last or second last section if there is a report footer | 106 | (section->type() == KReportSectionData::PageFooterAny && !renderedPageFooter && s > document->sectionCount() - 2)) { //render the page foot right at the end, it will either be the last or second last section if there is a report footer | ||
107 | if (section->type() == KReportSectionData::PageHeaderAny) | 107 | if (section->type() == KReportSectionData::PageHeaderAny) | ||
108 | renderedPageHeader = true; | 108 | renderedPageHeader = true; | ||
109 | 109 | | |||
110 | if (section->type() == KReportSectionData::PageFooterAny) | 110 | if (section->type() == KReportSectionData::PageFooterAny) | ||
111 | renderedPageFooter = true; | 111 | renderedPageFooter = true; | ||
112 | 112 | | |||
113 | tr = QLatin1String("<tr style=\"background-color: ") + section->backgroundColor().name() + QLatin1String("\">\n"); | 113 | tr = QLatin1String("<tr style=\"background-color: ") + section->backgroundColor().name() + QLatin1String("\">\n"); | ||
114 | //Render the objects in each section | 114 | //Render the objects in each section | ||
115 | for (int i = 0; i < section->primitives(); i++) { | 115 | for (int i = 0; i < section->primitiveCount(); i++) { | ||
116 | OROPrimitive * prim = section->primitive(i); | 116 | OROPrimitive * prim = section->primitive(i); | ||
117 | 117 | | |||
118 | if (prim->type() == OROTextBox::TextBox) { | 118 | if (dynamic_cast<OROTextBox*>(prim)) { | ||
119 | OROTextBox * tb = (OROTextBox*) prim; | 119 | OROTextBox * tb = dynamic_cast<OROTextBox*>(prim); | ||
120 | 120 | | |||
121 | tr += QLatin1String("<td>") + | 121 | tr += QLatin1String("<td>") + | ||
122 | tb->text() + | 122 | tb->text() + | ||
123 | QLatin1String("</td>\n"); | 123 | QLatin1String("</td>\n"); | ||
124 | } else if (prim->type() == OROImage::Image) { | 124 | } else if (dynamic_cast<OROImage*>(prim)) { | ||
125 | //kreportDebug() << "Saving an image"; | 125 | //kreportDebug() << "Saving an image"; | ||
126 | OROImage * im = (OROImage*) prim; | 126 | OROImage * im = dynamic_cast<OROImage*>(prim); | ||
127 | tr += QLatin1String("<td>" | 127 | tr += QLatin1String("<td>" | ||
128 | "<img src=\"./") + m_actualDirName + QLatin1String("/object") + QString::number(s) + QString::number(i) + QLatin1String(".png\"></img>" | 128 | "<img src=\"./") + m_actualDirName + QLatin1String("/object") + QString::number(s) + QString::number(i) + QLatin1String(".png\"></img>" | ||
129 | "</td>\n"); | 129 | "</td>\n"); | ||
130 | im->image().save(m_tempDirName + QLatin1String("/object") + QString::number(s) + QString::number(i) + QLatin1String(".png")); | 130 | im->image().save(m_tempDirName + QLatin1String("/object") + QString::number(s) + QString::number(i) + QLatin1String(".png")); | ||
131 | } else if (prim->type() == OROPicture::Picture) { | 131 | } else if (dynamic_cast<OROPicture*>(prim)) { | ||
132 | //kreportDebug() << "Saving a picture"; | 132 | //kreportDebug() << "Saving a picture"; | ||
133 | OROPicture * im = (OROPicture*) prim; | 133 | OROPicture * im = dynamic_cast<OROPicture*>(prim); | ||
134 | 134 | | |||
135 | tr += QLatin1String("<td>" | 135 | tr += QLatin1String("<td>" | ||
136 | "<img src=\"./") + m_actualDirName + QLatin1String("/object") + QString::number(s) + QString::number(i) + QLatin1String(".png\"></img>" | 136 | "<img src=\"./") + m_actualDirName + QLatin1String("/object") + QString::number(s) + QString::number(i) + QLatin1String(".png\"></img>" | ||
137 | "</td>\n"); | 137 | "</td>\n"); | ||
138 | QImage image(im->size().toSize(), QImage::Format_RGB32); | 138 | QImage image(im->size().toSize(), QImage::Format_RGB32); | ||
139 | QPainter painter(&image); | 139 | QPainter painter(&image); | ||
140 | im->picture()->play(&painter); | 140 | im->picture()->play(&painter); | ||
141 | image.save(m_tempDirName + QLatin1String("/object") + QString::number(s) + QString::number(i) + QLatin1String(".png")); | 141 | image.save(m_tempDirName + QLatin1String("/object") + QString::number(s) + QString::number(i) + QLatin1String(".png")); | ||
Show All 31 Lines |
long -> int