Changeset View
Changeset View
Standalone View
Standalone View
src/renderer/KReportPreRenderer.cpp
Show All 13 Lines | |||||
14 | * | 14 | * | ||
15 | * You should have received a copy of the GNU Lesser General Public | 15 | * You should have received a copy of the GNU Lesser General Public | ||
16 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | 16 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | #include "KReportPreRenderer.h" | 19 | #include "KReportPreRenderer.h" | ||
20 | #include "KReportPreRenderer_p.h" | 20 | #include "KReportPreRenderer_p.h" | ||
21 | #include "KReportAsyncItemManager_p.h" | 21 | #include "KReportAsyncItemManager_p.h" | ||
22 | #include "KReportOneRecordData_p.h" | 22 | #include "KReportOneRecordDataSource_p.h" | ||
23 | 23 | | |||
24 | #include "KReportRenderObjects.h" | 24 | #include "KReportRenderObjects.h" | ||
25 | #include "KReportData.h" | 25 | #include "KReportDataSource.h" | ||
26 | #include "KReportItemBase.h" | 26 | #include "KReportItemBase.h" | ||
27 | #include "KReportDocument.h" | 27 | #include "KReportDocument.h" | ||
28 | #include "KReportDetailSectionData.h" | 28 | #include "KReportDetailSectionData.h" | ||
29 | #include "KReportLabelSizeInfo.h" | 29 | #include "KReportLabelSizeInfo.h" | ||
30 | #include "KReportPageSize.h" | 30 | #include "KReportPageSize.h" | ||
31 | #include "KReportUtils_p.h" | 31 | #include "KReportUtils_p.h" | ||
32 | 32 | | |||
33 | #ifdef KREPORT_SCRIPTING | 33 | #ifdef KREPORT_SCRIPTING | ||
Show All 12 Lines | 44 | { | |||
46 | m_document = 0; | 46 | m_document = 0; | ||
47 | m_reportDocument = 0; | 47 | m_reportDocument = 0; | ||
48 | m_page = 0; | 48 | m_page = 0; | ||
49 | m_yOffset = 0.0; | 49 | m_yOffset = 0.0; | ||
50 | m_topMargin = m_bottomMargin = 0.0; | 50 | m_topMargin = m_bottomMargin = 0.0; | ||
51 | m_leftMargin = m_rightMargin = 0.0; | 51 | m_leftMargin = m_rightMargin = 0.0; | ||
52 | m_pageCounter = 0; | 52 | m_pageCounter = 0; | ||
53 | m_maxHeight = m_maxWidth = 0.0; | 53 | m_maxHeight = m_maxWidth = 0.0; | ||
54 | m_oneRecord = new KReportPrivate::OneRecordData(); | 54 | m_oneRecord = new KReportPrivate::OneRecordDataSource(); | ||
55 | m_kodata = 0; | 55 | m_dataSource = 0; | ||
56 | #ifdef KREPORT_SCRIPTING | 56 | #ifdef KREPORT_SCRIPTING | ||
57 | m_scriptHandler = 0; | 57 | m_scriptHandler = 0; | ||
58 | #endif | 58 | #endif | ||
59 | asyncManager = new KReportPrivate::AsyncItemManager(this); | 59 | asyncManager = new KReportPrivate::AsyncItemManager(this); | ||
60 | 60 | | |||
61 | connect(asyncManager, SIGNAL(finished()), this, SLOT(asyncItemsFinished())); | 61 | connect(asyncManager, SIGNAL(finished()), this, SLOT(asyncItemsFinished())); | ||
62 | } | 62 | } | ||
63 | 63 | | |||
▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Line(s) | 126 | { | |||
152 | } | 152 | } | ||
153 | 153 | | |||
154 | return retval; | 154 | return retval; | ||
155 | } | 155 | } | ||
156 | 156 | | |||
157 | void KReportPreRendererPrivate::renderDetailSection(KReportDetailSectionData *detailData) | 157 | void KReportPreRendererPrivate::renderDetailSection(KReportDetailSectionData *detailData) | ||
158 | { | 158 | { | ||
159 | if (detailData->m_detailSection) { | 159 | if (detailData->m_detailSection) { | ||
160 | if (m_kodata/* && !curs->eof()*/) { | 160 | if (m_dataSource/* && !curs->eof()*/) { | ||
161 | QStringList keys; | 161 | QStringList keys; | ||
162 | QStringList keyValues; | 162 | QStringList keyValues; | ||
163 | QList<int> shownGroups; | 163 | QList<int> shownGroups; | ||
164 | KReportDetailGroupSectionData * grp = 0; | 164 | KReportDetailGroupSectionData * grp = 0; | ||
165 | 165 | | |||
166 | bool status = m_kodata->moveFirst(); | 166 | bool status = m_dataSource->moveFirst(); | ||
167 | int recordCount = m_kodata->recordCount(); | 167 | int recordCount = m_dataSource->recordCount(); | ||
168 | 168 | | |||
169 | //kreportDebug() << "Record Count:" << recordCount; | 169 | //kreportDebug() << "Record Count:" << recordCount; | ||
170 | 170 | | |||
171 | for (int i = 0; i < (int) detailData->m_groupList.count(); ++i) { | 171 | for (int i = 0; i < (int) detailData->m_groupList.count(); ++i) { | ||
172 | grp = detailData->m_groupList[i]; | 172 | grp = detailData->m_groupList[i]; | ||
173 | //If the group has a header or footer, then emit a change of group value | 173 | //If the group has a header or footer, then emit a change of group value | ||
174 | if(grp->m_groupFooter || grp->m_groupHeader) { | 174 | if(grp->m_groupFooter || grp->m_groupHeader) { | ||
175 | // we get here only if group is *shown* | 175 | // we get here only if group is *shown* | ||
176 | shownGroups << i; | 176 | shownGroups << i; | ||
177 | keys.append(grp->m_column); | 177 | keys.append(grp->m_column); | ||
178 | if (!keys.last().isEmpty()) | 178 | if (!keys.last().isEmpty()) | ||
179 | keyValues.append(m_kodata->value(m_kodata->fieldNumber(keys.last())).toString()); | 179 | keyValues.append(m_dataSource->value(m_dataSource->fieldNumber(keys.last())).toString()); | ||
180 | else | 180 | else | ||
181 | keyValues.append(QString()); | 181 | keyValues.append(QString()); | ||
182 | 182 | | |||
183 | //Tell interested parties we're about to render a header | 183 | //Tell interested parties we're about to render a header | ||
184 | emit(enteredGroup(keys.last(), keyValues.last())); | 184 | emit(enteredGroup(keys.last(), keyValues.last())); | ||
185 | } | 185 | } | ||
186 | if (grp->m_groupHeader) | 186 | if (grp->m_groupHeader) | ||
187 | renderSection(*(grp->m_groupHeader)); | 187 | renderSection(*(grp->m_groupHeader)); | ||
188 | } | 188 | } | ||
189 | 189 | | |||
190 | while (status) { | 190 | while (status) { | ||
191 | const qint64 pos = m_kodata->at(); | 191 | const qint64 pos = m_dataSource->at(); | ||
192 | //kreportDebug() << "At:" << l << "Y:" << m_yOffset << "Max Height:" << m_maxHeight; | 192 | //kreportDebug() << "At:" << l << "Y:" << m_yOffset << "Max Height:" << m_maxHeight; | ||
193 | if ((renderSectionSize(*detailData->m_detailSection) | 193 | if ((renderSectionSize(*detailData->m_detailSection) | ||
194 | + finishCurPageSize((pos + 1 == recordCount)) | 194 | + finishCurPageSize((pos + 1 == recordCount)) | ||
195 | + m_bottomMargin + m_yOffset) >= m_maxHeight) | 195 | + m_bottomMargin + m_yOffset) >= m_maxHeight) | ||
196 | { | 196 | { | ||
197 | //kreportDebug() << "Next section is too big for this page"; | 197 | //kreportDebug() << "Next section is too big for this page"; | ||
198 | if (pos > 0) { | 198 | if (pos > 0) { | ||
199 | m_kodata->movePrevious(); | 199 | m_dataSource->movePrevious(); | ||
200 | createNewPage(); | 200 | createNewPage(); | ||
201 | m_kodata->moveNext(); | 201 | m_dataSource->moveNext(); | ||
202 | } | 202 | } | ||
203 | } | 203 | } | ||
204 | 204 | | |||
205 | renderSection(*(detailData->m_detailSection)); | 205 | renderSection(*(detailData->m_detailSection)); | ||
206 | if (m_kodata) | 206 | if (m_dataSource) | ||
207 | status = m_kodata->moveNext(); | 207 | status = m_dataSource->moveNext(); | ||
208 | 208 | | |||
209 | if (status == true && keys.count() > 0) { | 209 | if (status == true && keys.count() > 0) { | ||
210 | // check to see where it is we need to start | 210 | // check to see where it is we need to start | ||
211 | int pos = -1; // if it's still -1 by the time we are done then no keyValues changed | 211 | int pos = -1; // if it's still -1 by the time we are done then no keyValues changed | ||
212 | for (int i = 0; i < keys.count(); ++i) { | 212 | for (int i = 0; i < keys.count(); ++i) { | ||
213 | if (keyValues[i] != m_kodata->value(m_kodata->fieldNumber(keys[i])).toString()) { | 213 | if (keyValues[i] != m_dataSource->value(m_dataSource->fieldNumber(keys[i])).toString()) { | ||
214 | pos = i; | 214 | pos = i; | ||
215 | break; | 215 | break; | ||
216 | } | 216 | } | ||
217 | } | 217 | } | ||
218 | // don't bother if nothing has changed | 218 | // don't bother if nothing has changed | ||
219 | if (pos != -1) { | 219 | if (pos != -1) { | ||
220 | // roll back the query and go ahead if all is good | 220 | // roll back the query and go ahead if all is good | ||
221 | status = m_kodata->movePrevious(); | 221 | status = m_dataSource->movePrevious(); | ||
222 | if (status == true) { | 222 | if (status == true) { | ||
223 | // print the footers as needed | 223 | // print the footers as needed | ||
224 | // any changes made in this for loop need to be duplicated | 224 | // any changes made in this for loop need to be duplicated | ||
225 | // below where the footers are finished. | 225 | // below where the footers are finished. | ||
226 | bool do_break = false; | 226 | bool do_break = false; | ||
227 | for (int i = shownGroups.count() - 1; i >= 0; i--) { | 227 | for (int i = shownGroups.count() - 1; i >= 0; i--) { | ||
228 | if (do_break) | 228 | if (do_break) | ||
229 | createNewPage(); | 229 | createNewPage(); | ||
230 | do_break = false; | 230 | do_break = false; | ||
231 | grp = detailData->m_groupList[shownGroups.at(i)]; | 231 | grp = detailData->m_groupList[shownGroups.at(i)]; | ||
232 | 232 | | |||
233 | if (grp->m_groupFooter) { | 233 | if (grp->m_groupFooter) { | ||
234 | if (renderSectionSize(*(grp->m_groupFooter)) + finishCurPageSize() + m_bottomMargin + m_yOffset >= m_maxHeight) | 234 | if (renderSectionSize(*(grp->m_groupFooter)) + finishCurPageSize() + m_bottomMargin + m_yOffset >= m_maxHeight) | ||
235 | createNewPage(); | 235 | createNewPage(); | ||
236 | renderSection(*(grp->m_groupFooter)); | 236 | renderSection(*(grp->m_groupFooter)); | ||
237 | } | 237 | } | ||
238 | 238 | | |||
239 | if (KReportDetailGroupSectionData::BreakAfterGroupFooter == grp->m_pagebreak) | 239 | if (KReportDetailGroupSectionData::BreakAfterGroupFooter == grp->m_pagebreak) | ||
240 | do_break = true; | 240 | do_break = true; | ||
241 | } | 241 | } | ||
242 | // step ahead to where we should be and print the needed headers | 242 | // step ahead to where we should be and print the needed headers | ||
243 | // if all is good | 243 | // if all is good | ||
244 | status = m_kodata->moveNext(); | 244 | status = m_dataSource->moveNext(); | ||
245 | if (do_break) | 245 | if (do_break) | ||
246 | createNewPage(); | 246 | createNewPage(); | ||
247 | if (status == true) { | 247 | if (status == true) { | ||
248 | for (int i = 0; i < shownGroups.count(); ++i) { | 248 | for (int i = 0; i < shownGroups.count(); ++i) { | ||
249 | grp = detailData->m_groupList[shownGroups.at(i)]; | 249 | grp = detailData->m_groupList[shownGroups.at(i)]; | ||
250 | 250 | | |||
251 | if (grp->m_groupHeader) { | 251 | if (grp->m_groupHeader) { | ||
252 | if (renderSectionSize(*(grp->m_groupHeader)) + finishCurPageSize() + m_bottomMargin + m_yOffset >= m_maxHeight) { | 252 | if (renderSectionSize(*(grp->m_groupHeader)) + finishCurPageSize() + m_bottomMargin + m_yOffset >= m_maxHeight) { | ||
253 | m_kodata->movePrevious(); | 253 | m_dataSource->movePrevious(); | ||
254 | createNewPage(); | 254 | createNewPage(); | ||
255 | m_kodata->moveNext(); | 255 | m_dataSource->moveNext(); | ||
256 | } | 256 | } | ||
257 | 257 | | |||
258 | if (!keys[i].isEmpty()) | 258 | if (!keys[i].isEmpty()) | ||
259 | keyValues[i] = m_kodata->value(m_kodata->fieldNumber(keys[i])).toString(); | 259 | keyValues[i] = m_dataSource->value(m_dataSource->fieldNumber(keys[i])).toString(); | ||
260 | 260 | | |||
261 | //Tell interested parties thak key values changed | 261 | //Tell interested parties thak key values changed | ||
262 | renderSection(*(grp->m_groupHeader)); | 262 | renderSection(*(grp->m_groupHeader)); | ||
263 | } | 263 | } | ||
264 | 264 | | |||
265 | 265 | | |||
266 | } | 266 | } | ||
267 | } | 267 | } | ||
268 | } | 268 | } | ||
269 | } | 269 | } | ||
270 | } | 270 | } | ||
271 | } | 271 | } | ||
272 | 272 | | |||
273 | if (keys.size() > 0 && m_kodata->movePrevious()) { | 273 | if (keys.size() > 0 && m_dataSource->movePrevious()) { | ||
274 | // finish footers | 274 | // finish footers | ||
275 | // duplicated changes from above here | 275 | // duplicated changes from above here | ||
276 | for (int i = shownGroups.count() - 1; i >= 0; i--) { | 276 | for (int i = shownGroups.count() - 1; i >= 0; i--) { | ||
277 | grp = detailData->m_groupList[shownGroups.at(i)]; | 277 | grp = detailData->m_groupList[shownGroups.at(i)]; | ||
278 | 278 | | |||
279 | if (grp->m_groupFooter) { | 279 | if (grp->m_groupFooter) { | ||
280 | if (renderSectionSize(*(grp->m_groupFooter)) + finishCurPageSize() + m_bottomMargin + m_yOffset >= m_maxHeight) | 280 | if (renderSectionSize(*(grp->m_groupFooter)) + finishCurPageSize() + m_bottomMargin + m_yOffset >= m_maxHeight) | ||
281 | createNewPage(); | 281 | createNewPage(); | ||
Show All 15 Lines | 294 | { | |||
297 | int itemHeight = 0; | 297 | int itemHeight = 0; | ||
298 | 298 | | |||
299 | if (sectionData.objects().count() == 0) | 299 | if (sectionData.objects().count() == 0) | ||
300 | return intHeight; | 300 | return intHeight; | ||
301 | 301 | | |||
302 | QList<KReportItemBase*> objects = sectionData.objects(); | 302 | QList<KReportItemBase*> objects = sectionData.objects(); | ||
303 | foreach(KReportItemBase *ob, objects) { | 303 | foreach(KReportItemBase *ob, objects) { | ||
304 | QPointF offset(m_leftMargin, m_yOffset); | 304 | QPointF offset(m_leftMargin, m_yOffset); | ||
305 | QVariant itemData = m_kodata->value(ob->itemDataSource()); | 305 | QVariant itemData = m_dataSource->value(ob->itemDataSource()); | ||
306 | 306 | | |||
307 | //ASync objects cannot alter the section height | 307 | //ASync objects cannot alter the section height | ||
308 | KReportAsyncItemBase *async_ob = qobject_cast<KReportAsyncItemBase*>(ob); | 308 | KReportAsyncItemBase *async_ob = qobject_cast<KReportAsyncItemBase*>(ob); | ||
309 | 309 | | |||
310 | if (!async_ob) { | 310 | if (!async_ob) { | ||
311 | itemHeight = ob->renderSimpleData(0, 0, offset, itemData, m_scriptHandler); | 311 | itemHeight = ob->renderSimpleData(0, 0, offset, itemData, m_scriptHandler); | ||
312 | 312 | | |||
313 | if (itemHeight > intHeight) { | 313 | if (itemHeight > intHeight) { | ||
Show All 28 Lines | 323 | { | |||
342 | qreal w = m_page->document()->pageLayout().fullRectPixels(KReportPrivate::dpiX()).width() - m_page->document()->pageLayout().marginsPixels(KReportPrivate::dpiX()).right() - m_leftMargin; | 342 | qreal w = m_page->document()->pageLayout().fullRectPixels(KReportPrivate::dpiX()).width() - m_page->document()->pageLayout().marginsPixels(KReportPrivate::dpiX()).right() - m_leftMargin; | ||
343 | 343 | | |||
344 | bg->setRect(QRectF(m_leftMargin, m_yOffset, w, sectionHeight)); | 344 | bg->setRect(QRectF(m_leftMargin, m_yOffset, w, sectionHeight)); | ||
345 | m_page->insertPrimitive(bg, true); | 345 | m_page->insertPrimitive(bg, true); | ||
346 | 346 | | |||
347 | QList<KReportItemBase*> objects = sectionData.objects(); | 347 | QList<KReportItemBase*> objects = sectionData.objects(); | ||
348 | foreach(KReportItemBase *ob, objects) { | 348 | foreach(KReportItemBase *ob, objects) { | ||
349 | QPointF offset(m_leftMargin, m_yOffset); | 349 | QPointF offset(m_leftMargin, m_yOffset); | ||
350 | QVariant itemData = m_kodata->value(ob->itemDataSource()); | 350 | QVariant itemData = m_dataSource->value(ob->itemDataSource()); | ||
351 | 351 | | |||
352 | if (ob->supportsSubQuery()) { | 352 | if (ob->supportsSubQuery()) { | ||
353 | itemHeight = ob->renderReportData(m_page, sec, offset, m_kodata, m_scriptHandler); | 353 | itemHeight = ob->renderReportData(m_page, sec, offset, m_dataSource, m_scriptHandler); | ||
354 | } else { | 354 | } else { | ||
355 | KReportAsyncItemBase *async_ob = qobject_cast<KReportAsyncItemBase*>(ob); | 355 | KReportAsyncItemBase *async_ob = qobject_cast<KReportAsyncItemBase*>(ob); | ||
356 | if (async_ob){ | 356 | if (async_ob){ | ||
357 | //kreportDebug() << "async object"; | 357 | //kreportDebug() << "async object"; | ||
358 | asyncManager->addItem(async_ob, m_page, sec, offset, itemData, m_scriptHandler); | 358 | asyncManager->addItem(async_ob, m_page, sec, offset, itemData, m_scriptHandler); | ||
359 | } else { | 359 | } else { | ||
360 | //kreportDebug() << "sync object"; | 360 | //kreportDebug() << "sync object"; | ||
361 | itemHeight = ob->renderSimpleData(m_page, sec, offset, itemData, m_scriptHandler); | 361 | itemHeight = ob->renderSimpleData(m_page, sec, offset, itemData, m_scriptHandler); | ||
Show All 16 Lines | |||||
378 | 378 | | |||
379 | return sectionHeight; | 379 | return sectionHeight; | ||
380 | } | 380 | } | ||
381 | 381 | | |||
382 | #ifdef KREPORT_SCRIPTING | 382 | #ifdef KREPORT_SCRIPTING | ||
383 | void KReportPreRendererPrivate::initEngine() | 383 | void KReportPreRendererPrivate::initEngine() | ||
384 | { | 384 | { | ||
385 | delete m_scriptHandler; | 385 | delete m_scriptHandler; | ||
386 | m_scriptHandler = new KReportScriptHandler(m_kodata, m_reportDocument); | 386 | m_scriptHandler = new KReportScriptHandler(m_dataSource, m_reportDocument); | ||
387 | 387 | | |||
388 | connect(this, SIGNAL(enteredGroup(QString,QVariant)), m_scriptHandler, SLOT(slotEnteredGroup(QString,QVariant))); | 388 | connect(this, SIGNAL(enteredGroup(QString,QVariant)), m_scriptHandler, SLOT(slotEnteredGroup(QString,QVariant))); | ||
389 | 389 | | |||
390 | connect(this, SIGNAL(exitedGroup(QString,QVariant)), m_scriptHandler, SLOT(slotExitedGroup(QString,QVariant))); | 390 | connect(this, SIGNAL(exitedGroup(QString,QVariant)), m_scriptHandler, SLOT(slotExitedGroup(QString,QVariant))); | ||
391 | 391 | | |||
392 | connect(this, SIGNAL(renderingSection(KReportSectionData*,OROPage*,QPointF)), m_scriptHandler, SLOT(slotEnteredSection(KReportSectionData*,OROPage*,QPointF))); | 392 | connect(this, SIGNAL(renderingSection(KReportSectionData*,OROPage*,QPointF)), m_scriptHandler, SLOT(slotEnteredSection(KReportSectionData*,OROPage*,QPointF))); | ||
393 | } | 393 | } | ||
394 | #endif | 394 | #endif | ||
395 | 395 | | |||
396 | void KReportPreRendererPrivate::asyncItemsFinished() | 396 | void KReportPreRendererPrivate::asyncItemsFinished() | ||
397 | { | 397 | { | ||
398 | //kreportDebug() << "Finished rendering async items"; | 398 | //kreportDebug() << "Finished rendering async items"; | ||
399 | asyncManager->deleteLater(); | 399 | asyncManager->deleteLater(); | ||
400 | emit finishedAllASyncItems(); | 400 | emit finishedAllASyncItems(); | ||
401 | } | 401 | } | ||
402 | 402 | | |||
403 | bool KReportPreRendererPrivate::generateDocument() | 403 | bool KReportPreRendererPrivate::generateDocument() | ||
404 | { | 404 | { | ||
405 | if (!m_kodata) { | 405 | if (!m_dataSource) { | ||
406 | m_kodata = m_oneRecord; | 406 | m_dataSource = m_oneRecord; | ||
407 | } | 407 | } | ||
408 | 408 | | |||
409 | if (!m_valid || !m_reportDocument) { | 409 | if (!m_valid || !m_reportDocument) { | ||
410 | return false; | 410 | return false; | ||
411 | } | 411 | } | ||
412 | 412 | | |||
413 | // Do this check now so we don't have to undo a lot of work later if it fails | 413 | // Do this check now so we don't have to undo a lot of work later if it fails | ||
414 | KReportLabelSizeInfo label; | 414 | KReportLabelSizeInfo label; | ||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 469 | if (m_reportDocument->pageLayout().orientation() == QPageLayout::Landscape) { | |||
470 | qreal tmp = m_maxWidth; | 470 | qreal tmp = m_maxWidth; | ||
471 | m_maxWidth = m_maxHeight; | 471 | m_maxWidth = m_maxHeight; | ||
472 | m_maxHeight = tmp; | 472 | m_maxHeight = tmp; | ||
473 | } | 473 | } | ||
474 | 474 | | |||
475 | //kreportDebug() << "Page Size:" << m_maxWidth << m_maxHeight; | 475 | //kreportDebug() << "Page Size:" << m_maxWidth << m_maxHeight; | ||
476 | 476 | | |||
477 | m_document->setPageLayout(m_reportDocument->pageLayout()); | 477 | m_document->setPageLayout(m_reportDocument->pageLayout()); | ||
478 | m_kodata->setSorting(m_reportDocument->m_detailSection->m_sortedFields); | 478 | m_dataSource->setSorting(m_reportDocument->m_detailSection->m_sortedFields); | ||
479 | if (!m_kodata->open()) { | 479 | if (!m_dataSource->open()) { | ||
480 | return false; | 480 | return false; | ||
481 | } | 481 | } | ||
482 | 482 | | |||
483 | #ifdef KREPORT_SCRIPTING | 483 | #ifdef KREPORT_SCRIPTING | ||
484 | initEngine(); | 484 | initEngine(); | ||
485 | connect(m_scriptHandler, SIGNAL(groupChanged(QMap<QString, QVariant>)), | 485 | connect(m_scriptHandler, SIGNAL(groupChanged(QMap<QString, QVariant>)), | ||
486 | m_preRenderer, SIGNAL(groupChanged(QMap<QString, QVariant>))); | 486 | m_preRenderer, SIGNAL(groupChanged(QMap<QString, QVariant>))); | ||
487 | 487 | | |||
Show All 36 Lines | 521 | if (!m_reportDocument->pageLayout().orientation() == QPageLayout::Portrait) { | |||
524 | h = (label.width() / 100.0); | 524 | h = (label.width() / 100.0); | ||
525 | hg = (label.xGap() / 100.0); | 525 | hg = (label.xGap() / 100.0); | ||
526 | numCols = label.rows(); | 526 | numCols = label.rows(); | ||
527 | numRows = label.columns(); | 527 | numRows = label.columns(); | ||
528 | } | 528 | } | ||
529 | 529 | | |||
530 | KReportDetailSectionData * detailData = m_reportDocument->m_detailSection; | 530 | KReportDetailSectionData * detailData = m_reportDocument->m_detailSection; | ||
531 | if (detailData->m_detailSection) { | 531 | if (detailData->m_detailSection) { | ||
532 | KReportData *mydata = m_kodata; | 532 | KReportDataSource *mydata = m_dataSource; | ||
533 | 533 | | |||
534 | if (mydata && mydata->recordCount() > 0) { /* && !((query = orqThis->getQuery())->eof()))*/ | 534 | if (mydata && mydata->recordCount() > 0) { /* && !((query = orqThis->getQuery())->eof()))*/ | ||
535 | if (!mydata->moveFirst()) { | 535 | if (!mydata->moveFirst()) { | ||
536 | return false; | 536 | return false; | ||
537 | } | 537 | } | ||
538 | int row = 0; | 538 | int row = 0; | ||
539 | int col = 0; | 539 | int col = 0; | ||
540 | do { | 540 | do { | ||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | |||||
593 | #endif | 593 | #endif | ||
594 | 594 | | |||
595 | asyncManager->startRendering(); | 595 | asyncManager->startRendering(); | ||
596 | 596 | | |||
597 | #ifdef KREPORT_SCRIPTING | 597 | #ifdef KREPORT_SCRIPTING | ||
598 | m_scriptHandler->displayErrors(); | 598 | m_scriptHandler->displayErrors(); | ||
599 | #endif | 599 | #endif | ||
600 | 600 | | |||
601 | if (!m_kodata->close()) { | 601 | if (!m_dataSource->close()) { | ||
602 | return false; | 602 | return false; | ||
603 | } | 603 | } | ||
604 | #ifdef KREPORT_SCRIPTING | 604 | #ifdef KREPORT_SCRIPTING | ||
605 | delete m_scriptHandler; | 605 | delete m_scriptHandler; | ||
606 | m_scriptHandler = 0; | 606 | m_scriptHandler = 0; | ||
607 | #endif | 607 | #endif | ||
608 | 608 | | |||
609 | if (m_kodata != m_oneRecord) { | 609 | if (m_dataSource != m_oneRecord) { | ||
610 | delete m_kodata; | 610 | delete m_dataSource; | ||
611 | m_kodata = 0; | 611 | m_dataSource = 0; | ||
612 | } | 612 | } | ||
613 | m_postProcText.clear(); | 613 | m_postProcText.clear(); | ||
614 | 614 | | |||
615 | return true; | 615 | return true; | ||
616 | } | 616 | } | ||
617 | 617 | | |||
618 | //===========================KReportPreRenderer=============================== | 618 | //===========================KReportPreRenderer=============================== | ||
619 | 619 | | |||
Show All 30 Lines | |||||
650 | // delete d->m_document; | 650 | // delete d->m_document; | ||
651 | if (!d->generateDocument()) { | 651 | if (!d->generateDocument()) { | ||
652 | delete d->m_document; | 652 | delete d->m_document; | ||
653 | d->m_document = 0; | 653 | d->m_document = 0; | ||
654 | } | 654 | } | ||
655 | return d->m_document; | 655 | return d->m_document; | ||
656 | } | 656 | } | ||
657 | 657 | | |||
658 | void KReportPreRenderer::setSourceData(KReportData *data) | 658 | void KReportPreRenderer::setSourceData(KReportDataSource *dataSource) | ||
staniek: data -> dataSource | |||||
659 | { | 659 | { | ||
660 | if (d && data != d->m_kodata) { | 660 | if (d && dataSource != d->m_dataSource) { | ||
661 | delete d->m_kodata; | 661 | delete d->m_dataSource; | ||
662 | d->m_kodata = data; | 662 | d->m_dataSource = dataSource; | ||
663 | } | 663 | } | ||
664 | } | 664 | } | ||
665 | 665 | | |||
666 | bool KReportPreRenderer::setDocument(const QDomElement &document) | 666 | bool KReportPreRenderer::setDocument(const QDomElement &document) | ||
667 | { | 667 | { | ||
668 | delete d->m_document; | 668 | delete d->m_document; | ||
669 | d->m_valid = false; | 669 | d->m_valid = false; | ||
670 | 670 | | |||
Show All 27 Lines |
data -> dataSource