/* * 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 */
/* * vMove2NextLine - move to the next line */ void vMove2NextLine(diagram_type *pDiag, drawfile_fontref tFontRef, USHORT usFontSize) { fail(pDiag == NULL); fail(pDiag->pOutFile == NULL); fail(usFontSize < MIN_FONT_SIZE || usFontSize > MAX_FONT_SIZE); switch (eConversionType) { case conversion_text: case conversion_fmt_text: vMove2NextLineTXT(pDiag); break; case conversion_ps: vMove2NextLinePS(pDiag, usFontSize); break; case conversion_xml: vMove2NextLineXML(pDiag); break; case conversion_pdf: vMove2NextLinePDF(pDiag, usFontSize); break; default: DBG_DEC(eConversionType); break; } } /* end of vMove2NextLine */
/* * Create an end of paragraph by moving the y-top mark */ void vEndOfParagraphPDF(diagram_type *pDiag, USHORT usFontSize, long lAfterIndentation) { fail(pDiag == NULL); fail(pDiag->pOutFile == NULL); fail(usFontSize < MIN_FONT_SIZE || usFontSize > MAX_FONT_SIZE); fail(lAfterIndentation < 0); if (pDiag->lXleft > 0) { /* To the start of the line */ vMove2NextLinePDF(pDiag, usFontSize); } pDiag->lXleft = 0; pDiag->lYtop -= lMilliPoints2DrawUnits(lAfterIndentation); } /* end of vEndOfParagraphPDF */