Update of /cvsroot/openrpt/openrpt/OpenRPT/renderer
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28045
Modified Files:
orprerender.cpp
Log Message:
Some updates to code to reformat and get sections ready for use.
Index: orprerender.cpp
===================================================================
RCS file: /cvsroot/openrpt/openrpt/OpenRPT/renderer/orprerender.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** orprerender.cpp 14 Feb 2007 19:54:45 -0000 1.5
--- orprerender.cpp 17 Feb 2007 19:59:51 -0000 1.6
***************
*** 507,594 ****
{
/*
! orData dataThis;
! ORTextData * t = elemThis->toText();
! bool boolShrinkable = false;
! bool boolToShrink = false;
!
! populateData(t->data, dataThis);
!
! QString qstrValue;
! int intStretch = t->rect.top();
! int intLineCounter = 0;
! int intBaseTop = t->rect.top() + _yOffset;
! int intRectHeight = t->rect.height();
! int intRectWidth = t->rect.width() - 10;
! QFont f = t->font;
! #ifdef Q_WS_MAC
! if(!_pdfPrint)
! f.setPointSizeFloat((100.0/dpi)*f.pointSize());
! #endif
! if (pPainter != 0 && _printPage) {
! pPainter->setFont(f);
! }
! qstrValue = dataThis.getValue();
! if (qstrValue.length()) {
! QRect rect = t->rect;
! rect.moveBy(_leftMargin,0);
! int pos = 0;
! int idx;
! QChar separator;
! QRegExp re("\\s");
! QFontMetrics fm(f);
! while(qstrValue.length()) {
! idx = re.search(qstrValue, pos);
! if(idx == -1) {
! idx = qstrValue.length();
! separator = QChar('\n');
! } else {
! separator = qstrValue.at(idx);
! }
! if(fm.boundingRect(qstrValue.left(idx)).width() < intRectWidth || pos == 0) {
! pos = idx + 1;
! if(separator == '\n') {
! QString line = qstrValue.left(idx);
! qstrValue = qstrValue.mid(idx+1,qstrValue.length());
! pos = 0;
! rect.setTop(intBaseTop + (intLineCounter * intRectHeight));
! rect.setBottom(rect.top() + intRectHeight);
! if (pPainter != 0 && _printPage) {
! pPainter->drawText(rect, t->align | Qt::TextDontClip, line);
! //pPainter->drawRect(rect);
! }
! intStretch += intRectHeight;
! intLineCounter++;
! }
! } else {
! QString line = qstrValue.left(pos - 1);
! qstrValue = qstrValue.mid(pos,qstrValue.length());
! pos = 0;
! rect.setTop(intBaseTop + (intLineCounter * intRectHeight));
! rect.setBottom(rect.top() + intRectHeight);
! if (pPainter != 0 && _printPage) {
! pPainter->drawText(rect, t->align | Qt::TextDontClip, line);
! //pPainter->drawRect(rect);
! }
! intStretch += intRectHeight;
! intLineCounter++;
! }
}
! intStretch += t->bottompad;
! if (intStretch > intHeight)
! intHeight = intStretch;
! } else {
! if (boolShrinkable)
! boolToShrink = true;
}
*/
}
--- 507,585 ----
{
/*
! orData dataThis;
! ORTextData * t = elemThis->toText();
! populateData(t->data, dataThis);
! QString qstrValue;
! int intStretch = t->rect.top();
! int intLineCounter = 0;
! int intBaseTop = t->rect.top() + _yOffset;
! int intRectHeight = t->rect.height();
! int intRectWidth = t->rect.width() - 10;
! QFont f = t->font;
! qstrValue = dataThis.getValue();
! if (qstrValue.length())
! {
! QRect rect = t->rect;
! rect.moveBy(_leftMargin,0);
! int pos = 0;
! int idx;
! QChar separator;
! QRegExp re("\\s");
! QFontMetrics fm(f);
! while(qstrValue.length())
! {
! idx = re.search(qstrValue, pos);
! if(idx == -1)
! {
! idx = qstrValue.length();
! separator = QChar('\n');
! }
! else
! separator = qstrValue.at(idx);
! if(fm.boundingRect(qstrValue.left(idx)).width() < intRectWidth || pos == 0)
! {
! pos = idx + 1;
! if(separator == '\n')
! {
! QString line = qstrValue.left(idx);
! qstrValue = qstrValue.mid(idx+1,qstrValue.length());
! pos = 0;
! rect.setTop(intBaseTop + (intLineCounter * intRectHeight));
! rect.setBottom(rect.top() + intRectHeight);
! // TODO: Create TextBox object here
! // pPainter->drawText(rect, t->align | Qt::TextDontClip, line);
! intStretch += intRectHeight;
! intLineCounter++;
}
+ }
+ else
+ {
+ QString line = qstrValue.left(pos - 1);
+ qstrValue = qstrValue.mid(pos,qstrValue.length());
+ pos = 0;
! rect.setTop(intBaseTop + (intLineCounter * intRectHeight));
! rect.setBottom(rect.top() + intRectHeight);
! // TODO: Create TextBox object here
! // pPainter->drawText(rect, t->align | Qt::TextDontClip, line);
! intStretch += intRectHeight;
! intLineCounter++;
! }
}
+
+ intStretch += t->bottompad;
+
+ if (intStretch > intHeight)
+ intHeight = intStretch;
+ }
*/
}
***************
*** 605,636 ****
{
/*
! ORBarcodeData * bc = elemThis->toBarcode();
! orData dataThis;
! QRect rect = bc->rect;
! rect.moveBy(_leftMargin, _yOffset);
! populateData(bc->data, dataThis);
! if(pPainter != 0 && _printPage)
! {
! if(bc->format == "3of9") {
! render3of9(rect,dataThis.getValue(), bc->align, pPainter);
! } else if(bc->format == "3of9+") {
! renderExtended3of9(rect,dataThis.getValue(), bc->align, pPainter);
! } else if(bc->format == "128") {
! renderCode128(rect, dataThis.getValue(), bc->align, pPainter);
! } else if(bc->format == "ean13") {
! renderCodeEAN13(rect, dataThis.getValue(), bc->align, pPainter);
! } else if(bc->format == "ean8") {
! renderCodeEAN8(rect, dataThis.getValue(), bc->align, pPainter);
! } else if(bc->format == "upc-a") {
! renderCodeUPCA(rect, dataThis.getValue(), bc->align, pPainter);
! } else if(bc->format == "upc-e") {
! renderCodeUPCE(rect, dataThis.getValue(), bc->align, pPainter);
! } else {
! logMessage("Encountered unknown barcode format: %s",(const char*)bc->format);
! }
}
*/
}
--- 596,627 ----
{
/*
! ORBarcodeData * bc = elemThis->toBarcode();
! orData dataThis;
! QRect rect = bc->rect;
! rect.moveBy(_leftMargin, _yOffset);
! populateData(bc->data, dataThis);
! if(pPainter != 0 && _printPage)
! {
! if(bc->format == "3of9") {
! render3of9(rect,dataThis.getValue(), bc->align, pPainter);
! } else if(bc->format == "3of9+") {
! renderExtended3of9(rect,dataThis.getValue(), bc->align, pPainter);
! } else if(bc->format == "128") {
! renderCode128(rect, dataThis.getValue(), bc->align, pPainter);
! } else if(bc->format == "ean13") {
! renderCodeEAN13(rect, dataThis.getValue(), bc->align, pPainter);
! } else if(bc->format == "ean8") {
! renderCodeEAN8(rect, dataThis.getValue(), bc->align, pPainter);
! } else if(bc->format == "upc-a") {
! renderCodeUPCA(rect, dataThis.getValue(), bc->align, pPainter);
! } else if(bc->format == "upc-e") {
! renderCodeUPCE(rect, dataThis.getValue(), bc->align, pPainter);
! } else {
! //logMessage("Encountered unknown barcode format: %s",(const char*)bc->format);
}
+ }
*/
}
***************
*** 669,683 ****
{
/*
! ORGraphData * gData = elemThis->toGraph();
! QRect rect = gData->rect;
! rect.moveBy(_leftMargin, _yOffset);
! if(pPainter && _printPage) {
! renderGraph(*pPainter, rect, *gData, getQuerySource(gData->data.query)->getQuery(), _colorMap);
! }
*/
! } else {
! //logMessage("Encountered and unknown element while rendering a section.");
}
}
--- 660,677 ----
{
/*
! ORGraphData * gData = elemThis->toGraph();
! QRect rect = gData->rect;
! rect.moveBy(_leftMargin, _yOffset);
! if(pPainter && _printPage)
! {
! renderGraph(*pPainter, rect, *gData, getQuerySource(gData->data.query)->getQuery(), _colorMap);
! }
*/
! }
! else
! {
! //logMessage("Encountered and unknown element while rendering a section.");
}
}
|