Exemplo n.º 1
0
void IppReportDlg::slotUser1()
{
	KPrinter	printer;
	printer.setFullPage(true);
	printer.setDocName(caption());
	if (printer.setup(this))
	{
		TQPainter	painter(&printer);
		TQPaintDeviceMetrics	metrics(&printer);

		// report is printed using TQSimpleRichText
		TQSimpleRichText	rich(m_edit->text(), font());
		rich.setWidth(&painter, metrics.width());
		int	margin = (int)(1.5 / 2.54 * metrics.logicalDpiY());	// 1.5 cm
		TQRect	r(margin, margin, metrics.width()-2*margin, metrics.height()-2*margin);
		int	hh = rich.height(), page(1);
		while (1)
		{
			rich.draw(&painter, margin, margin, r, colorGroup());
			TQString	s = caption() + ": " + TQString::number(page);
			TQRect	br = painter.fontMetrics().boundingRect(s);
			painter.drawText(r.right()-br.width()-5, r.top()-br.height()-4, br.width()+5, br.height()+4, Qt::AlignRight|Qt::AlignTop, s);
			r.moveBy(0, r.height()-10);
			painter.translate(0, -(r.height()-10));
			if (r.top() < hh)
			{
				printer.newPage();
				page++;
			}
			else
				break;
		}
	}
}
Exemplo n.º 2
0
  const HeaderStrategy * HeaderStrategy::create( Type type ) {
    switch ( type ) {
    case All:  return all();
    case Rich:   return rich();
    case Standard: return standard();
    case Brief:  return brief();
    case Custom:  return custom();
    }
    kdFatal( 5006 ) << "HeaderStrategy::create(): Unknown header strategy ( type == "
		    << (int)type << " ) requested!" << endl;
    return 0; // make compiler happy
  }
Exemplo n.º 3
0
int main() {
    printf("%d\n", rich(10));

    return 0;
}
Exemplo n.º 4
0
 const HeaderStrategy * next() const { return rich(); }
Exemplo n.º 5
0
 const HeaderStrategy * prev() const { return rich(); }