Logo Search packages:      
Sourcecode: facturalux version File versions  Download package

MPageCollection * MReportEngine::renderReport (  ) 

Renders the report as a page collection - the caller is responsible for de-allocating the returned collection

Definition at line 255 of file mreportengine.cpp.

References bottomMargin, cancelRender, currDate, currHeight, currPage, drawDetail(), endPage(), MReportSection::getCalcFieldCount(), MReportSection::getHeight(), grandTotal, p, pageHeight, pageOrientation, pageSize, pageWidth, pFooter, rFooter, MPageCollection::setPageDimensions(), MPageCollection::setPageOrientation(), MPageCollection::setPageSize(), startPage(), and topMargin.

Referenced by MReportViewer::renderReport().

{
  // Set cancel flag
  cancelRender = false;

  // Create the page collection
  MPageCollection *pages = new MPageCollection;

  // Initialize the basic page data
  currHeight = pageHeight - (topMargin + bottomMargin + pFooter.getHeight ());
  currPage = 0;
  currDate = QDate::currentDate ();

  // Initialize the grand total array
  grandTotal.clear ();
  for (int i = 0; i < rFooter.getCalcFieldCount (); i++)
      grandTotal.append (new QMemArray < double >);

  // Create the first page
  startPage (pages);

  unsigned int rowCount = records.length ();
  if (rowCount<=1)
      rowCount=2; 
  uint nRecord = 0;

  // Draw the details
  drawDetail(pages,0,nRecord);

  // Finish the last page of the report
  endPage (pages);

  // Destroy the page painter
  p.end ();

  // Set the page collection attributes
  pages->setPageDimensions (QSize (pageWidth, pageHeight));
  pages->setPageSize (pageSize);
  pages->setPageOrientation (pageOrientation);

  // Send final status
  emit signalRenderStatus (rowCount / 2);

  return pages;
}


Generated by  Doxygen 1.6.0   Back to index