Exemplo n.º 1
0
/*
 * Create an end of paragraph
 */
void
vEndOfParagraph(diagram_type *pDiag,
                drawfile_fontref tFontRef, USHORT usFontSize, long lAfterIndentation)
{
    fail(pDiag == NULL);
    fail(pDiag->pOutFile == NULL);
    fail(usFontSize < MIN_FONT_SIZE || usFontSize > MAX_FONT_SIZE);
    fail(lAfterIndentation < 0);

    switch (eConversionType) {
    case conversion_text:
    case conversion_fmt_text:
        vEndOfParagraphTXT(pDiag, lAfterIndentation);
        break;
    case conversion_ps:
        vEndOfParagraphPS(pDiag, usFontSize, lAfterIndentation);
        break;
    case conversion_xml:
        vEndOfParagraphXML(pDiag, 1);
        break;
    case conversion_pdf:
        vEndOfParagraphPDF(pDiag, usFontSize, lAfterIndentation);
        break;
    default:
        DBG_DEC(eConversionType);
        break;
    }
} /* end of vEndOfParagraph */
Exemplo n.º 2
0
/*
 * vAddHdrFtr - add a header or footer
 */
static void
vAddHdrFtr(diagram_type *pDiag, const hdrftr_block_type *pHdrFtrInfo)
{
	output_type	*pStart, *pPrev, *pNext;

	fail(pDiag == NULL);
	fail(pHdrFtrInfo == NULL);

	vStartOfParagraphPDF(pDiag, 0);
	pStart = pHdrFtrInfo->pText;
	while (pStart != NULL) {
		pNext = pStart;
		while (pNext != NULL &&
		       (pNext->tNextFree != 1 ||
		        (pNext->szStorage[0] != PAR_END &&
		         pNext->szStorage[0] != HARD_RETURN))) {
			pNext = pNext->pNext;
		}
		if (pNext == NULL) {
			if (bOutputContainsText(pStart)) {
				vAlign2Window(pDiag, pStart,
					lChar2MilliPoints(DEFAULT_SCREEN_WIDTH),
					ALIGNMENT_LEFT);
			} else {
				vMove2NextLinePDF(pDiag, pStart->usFontSize);
			}
			break;
		}
		fail(pNext->tNextFree != 1);
		fail(pNext->szStorage[0] != PAR_END &&
			pNext->szStorage[0] != HARD_RETURN);

		if (pStart != pNext) {
			/* There is something to print */
			pPrev = pNext->pPrev;
			fail(pPrev->pNext != pNext);
			/* Cut the chain */
			pPrev->pNext = NULL;
			if (bOutputContainsText(pStart)) {
				/* Print it */
				vAlign2Window(pDiag, pStart,
					lChar2MilliPoints(DEFAULT_SCREEN_WIDTH),
					ALIGNMENT_LEFT);
			} else {
				/* Just an empty line */
				vMove2NextLinePDF(pDiag, pStart->usFontSize);
			}
			/* Repair the chain */
			pPrev->pNext = pNext;
		}
		if (pNext->szStorage[0] == PAR_END) {
			vEndOfParagraphPDF(pDiag, pNext->usFontSize,
					(long)pNext->usFontSize * 200);
		}
		pStart = pNext->pNext;
	}
} /* end of vAddHdrFtr */