001: /*
002: * $Id: PdfPRow.java 2752 2007-05-15 14:58:33Z blowagie $
003: * $Name$
004: *
005: * Copyright 2001, 2002 Paulo Soares
006: *
007: * The contents of this file are subject to the Mozilla Public License Version 1.1
008: * (the "License"); you may not use this file except in compliance with the License.
009: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
010: *
011: * Software distributed under the License is distributed on an "AS IS" basis,
012: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
013: * for the specific language governing rights and limitations under the License.
014: *
015: * The Original Code is 'iText, a free JAVA-PDF library'.
016: *
017: * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
018: * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
019: * All Rights Reserved.
020: * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
021: * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
022: *
023: * Contributor(s): all the names of the contributors are added in the source code
024: * where applicable.
025: *
026: * Alternatively, the contents of this file may be used under the terms of the
027: * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
028: * provisions of LGPL are applicable instead of those above. If you wish to
029: * allow use of your version of this file only under the terms of the LGPL
030: * License and not to allow others to use your version of this file under
031: * the MPL, indicate your decision by deleting the provisions above and
032: * replace them with the notice and other provisions required by the LGPL.
033: * If you do not delete the provisions above, a recipient may use your version
034: * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
035: *
036: * This library is free software; you can redistribute it and/or modify it
037: * under the terms of the MPL as stated above or under the terms of the GNU
038: * Library General Public License as published by the Free Software Foundation;
039: * either version 2 of the License, or any later version.
040: *
041: * This library is distributed in the hope that it will be useful, but WITHOUT
042: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
043: * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
044: * details.
045: *
046: * If you didn't download this code from the following link, you should check if
047: * you aren't using an obsolete version:
048: * http://www.lowagie.com/iText/
049: */
050:
051: package com.lowagie.text.pdf;
052:
053: import java.awt.Color;
054:
055: import com.lowagie.text.DocumentException;
056: import com.lowagie.text.Element;
057: import com.lowagie.text.ExceptionConverter;
058: import com.lowagie.text.Image;
059: import com.lowagie.text.Rectangle;
060:
061: /**
062: * A row in a PdfPTable.
063: *
064: * @author Paulo Soares (psoares@consiste.pt)
065: */
066:
067: public class PdfPRow {
068:
069: /** the bottom limit (bottom right y) */
070: public static final float BOTTOM_LIMIT = -(1 << 30);
071:
072: protected PdfPCell cells[];
073:
074: protected float widths[];
075:
076: protected float maxHeight = 0;
077:
078: protected boolean calculated = false;
079:
080: private int[] canvasesPos;
081:
082: /**
083: * Constructs a new PdfPRow with the cells in the array that was passed as a parameter.
084: * @param cells
085: */
086: public PdfPRow(PdfPCell cells[]) {
087: this .cells = cells;
088: widths = new float[cells.length];
089: }
090:
091: /**
092: * Makes a copy of an existing row.
093: * @param row
094: */
095: public PdfPRow(PdfPRow row) {
096: maxHeight = row.maxHeight;
097: calculated = row.calculated;
098: cells = new PdfPCell[row.cells.length];
099: for (int k = 0; k < cells.length; ++k) {
100: if (row.cells[k] != null)
101: cells[k] = new PdfPCell(row.cells[k]);
102: }
103: widths = new float[cells.length];
104: System.arraycopy(row.widths, 0, widths, 0, cells.length);
105: }
106:
107: /**
108: * Sets the widths of the columns in the row.
109: * @param widths
110: * @return true if everything went right
111: */
112: public boolean setWidths(float widths[]) {
113: if (widths.length != cells.length)
114: return false;
115: System.arraycopy(widths, 0, this .widths, 0, cells.length);
116: float total = 0;
117: calculated = false;
118: for (int k = 0; k < widths.length; ++k) {
119: PdfPCell cell = cells[k];
120: cell.setLeft(total);
121: int last = k + cell.getColspan();
122: for (; k < last; ++k)
123: total += widths[k];
124: --k;
125: cell.setRight(total);
126: cell.setTop(0);
127: }
128: return true;
129: }
130:
131: /**
132: * Calculates the heights of each cell in the row.
133: * @return the maximum height of the row.
134: */
135: public float calculateHeights() {
136: maxHeight = 0;
137: for (int k = 0; k < cells.length; ++k) {
138: PdfPCell cell = cells[k];
139: if (cell == null)
140: continue;
141: Image img = cell.getImage();
142: if (img != null) {
143: img.scalePercent(100);
144: float refWidth = img.getScaledWidth();
145: if (cell.getRotation() == 90
146: || cell.getRotation() == 270) {
147: refWidth = img.getScaledHeight();
148: }
149: float scale = (cell.getRight()
150: - cell.getEffectivePaddingRight()
151: - cell.getEffectivePaddingLeft() - cell
152: .getLeft())
153: / refWidth;
154: img.scalePercent(scale * 100);
155: float refHeight = img.getScaledHeight();
156: if (cell.getRotation() == 90
157: || cell.getRotation() == 270) {
158: refHeight = img.getScaledWidth();
159: }
160: cell.setBottom(cell.getTop()
161: - cell.getEffectivePaddingTop()
162: - cell.getEffectivePaddingBottom() - refHeight);
163: } else {
164: if (cell.getRotation() == 0
165: || cell.getRotation() == 180) {
166: float rightLimit = cell.isNoWrap() ? 20000 : cell
167: .getRight()
168: - cell.getEffectivePaddingRight();
169: float bry = (cell.getFixedHeight() > 0) ? cell
170: .getTop()
171: - cell.getEffectivePaddingTop()
172: + cell.getEffectivePaddingBottom()
173: - cell.getFixedHeight() : BOTTOM_LIMIT;
174: ColumnText ct = ColumnText.duplicate(cell
175: .getColumn());
176: setColumn(ct, cell.getLeft()
177: + cell.getEffectivePaddingLeft(), bry,
178: rightLimit, cell.getTop()
179: - cell.getEffectivePaddingTop());
180: try {
181: ct.go(true);
182: } catch (DocumentException e) {
183: throw new ExceptionConverter(e);
184: }
185: float yLine = ct.getYLine();
186: if (cell.isUseDescender())
187: yLine += ct.getDescender();
188: cell.setBottom(yLine
189: - cell.getEffectivePaddingBottom());
190: } else {
191: if (cell.getFixedHeight() > 0) {
192: cell.setBottom(cell.getTop()
193: - cell.getFixedHeight());
194: } else {
195: ColumnText ct = ColumnText.duplicate(cell
196: .getColumn());
197: setColumn(
198: ct,
199: 0,
200: cell.getLeft()
201: + cell
202: .getEffectivePaddingLeft(),
203: 20000,
204: cell.getRight()
205: - cell
206: .getEffectivePaddingRight());
207: try {
208: ct.go(true);
209: } catch (DocumentException e) {
210: throw new ExceptionConverter(e);
211: }
212: cell.setBottom(cell.getTop()
213: - cell.getEffectivePaddingTop()
214: - cell.getEffectivePaddingBottom()
215: - ct.getFilledWidth());
216: }
217: }
218: }
219: float height = cell.getFixedHeight();
220: if (height <= 0)
221: height = cell.getHeight();
222: if (height < cell.getFixedHeight())
223: height = cell.getFixedHeight();
224: else if (height < cell.getMinimumHeight())
225: height = cell.getMinimumHeight();
226: if (height > maxHeight)
227: maxHeight = height;
228: }
229: calculated = true;
230: return maxHeight;
231: }
232:
233: /**
234: * Writes the border and background of one cell in the row.
235: * @param xPos
236: * @param yPos
237: * @param cell
238: * @param canvases
239: */
240: public void writeBorderAndBackground(float xPos, float yPos,
241: PdfPCell cell, PdfContentByte[] canvases) {
242: PdfContentByte lines = canvases[PdfPTable.LINECANVAS];
243: PdfContentByte backgr = canvases[PdfPTable.BACKGROUNDCANVAS];
244: // the coordinates of the border are retrieved
245: float x1 = cell.getLeft() + xPos;
246: float y2 = cell.getTop() + yPos;
247: float x2 = cell.getRight() + xPos;
248: float y1 = y2 - maxHeight;
249:
250: // the backgroundcolor is set
251: Color background = cell.getBackgroundColor();
252: if (background != null) {
253: backgr.setColorFill(background);
254: backgr.rectangle(x1, y1, x2 - x1, y2 - y1);
255: backgr.fill();
256: }
257: // if the element hasn't got any borders, nothing is added
258: if (cell.hasBorders()) {
259: if (cell.isUseVariableBorders()) {
260: Rectangle borderRect = new Rectangle(cell.getLeft()
261: + xPos, cell.getTop() - maxHeight + yPos, cell
262: .getRight()
263: + xPos, cell.getTop() + yPos);
264: borderRect.cloneNonPositionParameters(cell);
265: borderRect.setBackgroundColor(null);
266: lines.rectangle(borderRect);
267: } else {
268: // the width is set to the width of the element
269: if (cell.getBorderWidth() != Rectangle.UNDEFINED) {
270: lines.setLineWidth(cell.getBorderWidth());
271: }
272: // the color is set to the color of the element
273: Color color = cell.getBorderColor();
274: if (color != null) {
275: lines.setColorStroke(color);
276: }
277:
278: // if the box is a rectangle, it is added as a rectangle
279: if (cell.hasBorder(Rectangle.BOX)) {
280: lines.rectangle(x1, y1, x2 - x1, y2 - y1);
281: }
282: // if the border isn't a rectangle, the different sides are
283: // added apart
284: else {
285: if (cell.hasBorder(Rectangle.RIGHT)) {
286: lines.moveTo(x2, y1);
287: lines.lineTo(x2, y2);
288: }
289: if (cell.hasBorder(Rectangle.LEFT)) {
290: lines.moveTo(x1, y1);
291: lines.lineTo(x1, y2);
292: }
293: if (cell.hasBorder(Rectangle.BOTTOM)) {
294: lines.moveTo(x1, y1);
295: lines.lineTo(x2, y1);
296: }
297: if (cell.hasBorder(Rectangle.TOP)) {
298: lines.moveTo(x1, y2);
299: lines.lineTo(x2, y2);
300: }
301: }
302: lines.stroke();
303: if (color != null) {
304: lines.resetRGBColorStroke();
305: }
306: }
307: }
308: }
309:
310: private void saveAndRotateCanvases(PdfContentByte[] canvases,
311: float a, float b, float c, float d, float e, float f) {
312: int last = PdfPTable.TEXTCANVAS + 1;
313: if (canvasesPos == null) {
314: canvasesPos = new int[last * 2];
315: }
316: for (int k = 0; k < last; ++k) {
317: ByteBuffer bb = canvases[k].getInternalBuffer();
318: canvasesPos[k * 2] = bb.size();
319: canvases[k].saveState();
320: canvases[k].concatCTM(a, b, c, d, e, f);
321: canvasesPos[k * 2 + 1] = bb.size();
322: }
323: }
324:
325: private void restoreCanvases(PdfContentByte[] canvases) {
326: int last = PdfPTable.TEXTCANVAS + 1;
327: for (int k = 0; k < last; ++k) {
328: ByteBuffer bb = canvases[k].getInternalBuffer();
329: int p1 = bb.size();
330: canvases[k].restoreState();
331: if (p1 == canvasesPos[k * 2 + 1])
332: bb.setSize(canvasesPos[k * 2]);
333: }
334: }
335:
336: private float setColumn(ColumnText ct, float llx, float lly,
337: float urx, float ury) {
338: if (llx > urx)
339: urx = llx;
340: if (lly > ury)
341: ury = lly;
342: ct.setSimpleColumn(llx, lly, urx, ury);
343: return ury;
344: }
345:
346: /**
347: * Writes a number of cells (not necessarily all cells).
348: * @param colStart
349: * @param colEnd
350: * @param xPos
351: * @param yPos
352: * @param canvases
353: */
354: public void writeCells(int colStart, int colEnd, float xPos,
355: float yPos, PdfContentByte[] canvases) {
356: if (!calculated)
357: calculateHeights();
358: if (colEnd < 0)
359: colEnd = cells.length;
360: colEnd = Math.min(colEnd, cells.length);
361: if (colStart < 0)
362: colStart = 0;
363: if (colStart >= colEnd)
364: return;
365: int newStart;
366: for (newStart = colStart; newStart >= 0; --newStart) {
367: if (cells[newStart] != null)
368: break;
369: xPos -= widths[newStart - 1];
370: }
371: xPos -= cells[newStart].getLeft();
372: for (int k = newStart; k < colEnd; ++k) {
373: PdfPCell cell = cells[k];
374: if (cell == null)
375: continue;
376: writeBorderAndBackground(xPos, yPos, cell, canvases);
377: Image img = cell.getImage();
378: float tly = 0;
379: switch (cell.getVerticalAlignment()) {
380: case Element.ALIGN_BOTTOM:
381: tly = cell.getTop() + yPos - maxHeight
382: + cell.getHeight()
383: - cell.getEffectivePaddingTop();
384: break;
385: case Element.ALIGN_MIDDLE:
386: tly = cell.getTop() + yPos
387: + (cell.getHeight() - maxHeight) / 2
388: - cell.getEffectivePaddingTop();
389: break;
390: default:
391: tly = cell.getTop() + yPos
392: - cell.getEffectivePaddingTop();
393: break;
394: }
395: if (img != null) {
396: if (cell.getRotation() != 0) {
397: img = Image.getInstance(img);
398: img
399: .setRotation(img.getImageRotation()
400: + (float) (cell.getRotation()
401: * Math.PI / 180.0));
402: }
403: boolean vf = false;
404: if (cell.getHeight() > maxHeight) {
405: img.scalePercent(100);
406: float scale = (maxHeight
407: - cell.getEffectivePaddingTop() - cell
408: .getEffectivePaddingBottom())
409: / img.getScaledHeight();
410: img.scalePercent(scale * 100);
411: vf = true;
412: }
413: float left = cell.getLeft() + xPos
414: + cell.getEffectivePaddingLeft();
415: if (vf) {
416: switch (cell.getHorizontalAlignment()) {
417: case Element.ALIGN_CENTER:
418: left = xPos
419: + (cell.getLeft()
420: + cell
421: .getEffectivePaddingLeft()
422: + cell.getRight()
423: - cell
424: .getEffectivePaddingRight() - img
425: .getScaledWidth()) / 2;
426: break;
427: case Element.ALIGN_RIGHT:
428: left = xPos + cell.getRight()
429: - cell.getEffectivePaddingRight()
430: - img.getScaledWidth();
431: break;
432: default:
433: break;
434: }
435: tly = cell.getTop() + yPos
436: - cell.getEffectivePaddingTop();
437: }
438: img.setAbsolutePosition(left, tly
439: - img.getScaledHeight());
440: try {
441: canvases[PdfPTable.TEXTCANVAS].addImage(img);
442: } catch (DocumentException e) {
443: throw new ExceptionConverter(e);
444: }
445: } else {
446: // rotation sponsored by Connection GmbH
447: if (cell.getRotation() == 90
448: || cell.getRotation() == 270) {
449: float netWidth = maxHeight
450: - cell.getEffectivePaddingTop()
451: - cell.getEffectivePaddingBottom();
452: float netHeight = cell.getWidth()
453: - cell.getEffectivePaddingLeft()
454: - cell.getEffectivePaddingRight();
455: ColumnText ct = ColumnText.duplicate(cell
456: .getColumn());
457: ct.setCanvases(canvases);
458: ct.setSimpleColumn(0, 0, netWidth + 0.001f,
459: -netHeight);
460: try {
461: ct.go(true);
462: } catch (DocumentException e) {
463: throw new ExceptionConverter(e);
464: }
465: float calcHeight = -ct.getYLine();
466: if (netWidth <= 0 || netHeight <= 0)
467: calcHeight = 0;
468: if (calcHeight > 0) {
469: if (cell.isUseDescender())
470: calcHeight -= ct.getDescender();
471: ct = ColumnText.duplicate(cell.getColumn());
472: ct.setCanvases(canvases);
473: ct.setSimpleColumn(0, -0.001f,
474: netWidth + 0.001f, calcHeight);
475: float pivotX;
476: float pivotY;
477: if (cell.getRotation() == 90) {
478: pivotY = cell.getTop() + yPos - maxHeight
479: + cell.getEffectivePaddingBottom();
480: switch (cell.getVerticalAlignment()) {
481: case Element.ALIGN_BOTTOM:
482: pivotX = cell.getLeft()
483: + xPos
484: + cell.getWidth()
485: - cell
486: .getEffectivePaddingRight();
487: break;
488: case Element.ALIGN_MIDDLE:
489: pivotX = cell.getLeft()
490: + xPos
491: + (cell.getWidth()
492: + cell
493: .getEffectivePaddingLeft()
494: - cell
495: .getEffectivePaddingRight() + calcHeight)
496: / 2;
497: break;
498: default: //top
499: pivotX = cell.getLeft()
500: + xPos
501: + cell
502: .getEffectivePaddingLeft()
503: + calcHeight;
504: break;
505: }
506: saveAndRotateCanvases(canvases, 0, 1, -1,
507: 0, pivotX, pivotY);
508: } else {
509: pivotY = cell.getTop() + yPos
510: - cell.getEffectivePaddingTop();
511: switch (cell.getVerticalAlignment()) {
512: case Element.ALIGN_BOTTOM:
513: pivotX = cell.getLeft()
514: + xPos
515: + cell
516: .getEffectivePaddingLeft();
517: break;
518: case Element.ALIGN_MIDDLE:
519: pivotX = cell.getLeft()
520: + xPos
521: + (cell.getWidth()
522: + cell
523: .getEffectivePaddingLeft()
524: - cell
525: .getEffectivePaddingRight() - calcHeight)
526: / 2;
527: break;
528: default: //top
529: pivotX = cell.getLeft()
530: + xPos
531: + cell.getWidth()
532: - cell
533: .getEffectivePaddingRight()
534: - calcHeight;
535: break;
536: }
537: saveAndRotateCanvases(canvases, 0, -1, 1,
538: 0, pivotX, pivotY);
539: }
540: try {
541: ct.go();
542: } catch (DocumentException e) {
543: throw new ExceptionConverter(e);
544: } finally {
545: restoreCanvases(canvases);
546: }
547: }
548: } else {
549: float fixedHeight = cell.getFixedHeight();
550: float rightLimit = cell.getRight() + xPos
551: - cell.getEffectivePaddingRight();
552: float leftLimit = cell.getLeft() + xPos
553: + cell.getEffectivePaddingLeft();
554: if (cell.isNoWrap()) {
555: switch (cell.getHorizontalAlignment()) {
556: case Element.ALIGN_CENTER:
557: rightLimit += 10000;
558: leftLimit -= 10000;
559: break;
560: case Element.ALIGN_RIGHT:
561: leftLimit -= 20000;
562: break;
563: default:
564: rightLimit += 20000;
565: break;
566: }
567: }
568: ColumnText ct = ColumnText.duplicate(cell
569: .getColumn());
570: ct.setCanvases(canvases);
571: float bry = tly
572: - (maxHeight /* cell.height() */
573: - cell.getEffectivePaddingTop() - cell
574: .getEffectivePaddingBottom());
575: if (fixedHeight > 0) {
576: if (cell.getHeight() > maxHeight) {
577: tly = cell.getTop() + yPos
578: - cell.getEffectivePaddingTop();
579: bry = cell.getTop() + yPos - maxHeight
580: + cell.getEffectivePaddingBottom();
581: }
582: }
583: if (tly > bry && leftLimit < rightLimit) {
584: ct.setSimpleColumn(leftLimit, bry - 0.001f,
585: rightLimit, tly);
586: if (cell.getRotation() == 180) {
587: float shx = leftLimit + rightLimit;
588: float shy = yPos + yPos - maxHeight
589: + cell.getEffectivePaddingBottom()
590: - cell.getEffectivePaddingTop();
591: saveAndRotateCanvases(canvases, -1, 0, 0,
592: -1, shx, shy);
593: }
594: try {
595: ct.go();
596: } catch (DocumentException e) {
597: throw new ExceptionConverter(e);
598: } finally {
599: if (cell.getRotation() == 180) {
600: restoreCanvases(canvases);
601: }
602: }
603: }
604: }
605: }
606: PdfPCellEvent evt = cell.getCellEvent();
607: if (evt != null) {
608: Rectangle rect = new Rectangle(cell.getLeft() + xPos,
609: cell.getTop() + yPos - maxHeight, cell
610: .getRight()
611: + xPos, cell.getTop() + yPos);
612: evt.cellLayout(cell, rect, canvases);
613: }
614: }
615: }
616:
617: /**
618: * Checks if the dimensions of the columns were calculated.
619: * @return true if the dimensions of the columns were calculated
620: */
621: public boolean isCalculated() {
622: return calculated;
623: }
624:
625: /**
626: * Gets the maximum height of the row (i.e. of the 'highest' cell).
627: * @return the maximum height of the row
628: */
629: public float getMaxHeights() {
630: if (calculated)
631: return maxHeight;
632: else
633: return calculateHeights();
634: }
635:
636: /**
637: * Changes the maximum height of the row (to make it higher).
638: * (added by Jin-Hsia Yang)
639: * @param maxHeight the new maximum height
640: */
641: public void setMaxHeights(float maxHeight) {
642: this .maxHeight = maxHeight;
643: }
644:
645: //end add
646:
647: float[] getEventWidth(float xPos) {
648: int n = 0;
649: for (int k = 0; k < cells.length; ++k) {
650: if (cells[k] != null)
651: ++n;
652: }
653: float width[] = new float[n + 1];
654: n = 0;
655: width[n++] = xPos;
656: for (int k = 0; k < cells.length; ++k) {
657: if (cells[k] != null) {
658: width[n] = width[n - 1] + cells[k].getWidth();
659: ++n;
660: }
661: }
662: return width;
663: }
664:
665: /**
666: * Splits a row to newHeight. The returned row is the remainder. It will
667: * return null if the newHeight was so small that only an empty row would
668: * result.
669: *
670: * @param newHeight
671: * the new height
672: * @return the remainder row or null if the newHeight was so small that only
673: * an empty row would result
674: */
675: public PdfPRow splitRow(float newHeight) {
676: PdfPCell newCells[] = new PdfPCell[cells.length];
677: float fh[] = new float[cells.length * 2];
678: boolean allEmpty = true;
679: for (int k = 0; k < cells.length; ++k) {
680: PdfPCell cell = cells[k];
681: if (cell == null)
682: continue;
683: fh[k * 2] = cell.getFixedHeight();
684: fh[k * 2 + 1] = cell.getMinimumHeight();
685: Image img = cell.getImage();
686: PdfPCell c2 = new PdfPCell(cell);
687: if (img != null) {
688: if (newHeight > cell.getEffectivePaddingBottom()
689: + cell.getEffectivePaddingTop() + 2) {
690: c2.setPhrase(null);
691: allEmpty = false;
692: }
693: } else {
694: int status;
695: float y;
696: ColumnText ct = ColumnText.duplicate(cell.getColumn());
697: if (cell.getRotation() == 90
698: || cell.getRotation() == 270) {
699: y = setColumn(ct, cell.getTop() - newHeight
700: + cell.getEffectivePaddingBottom(), cell
701: .getLeft()
702: + cell.getEffectivePaddingLeft(), cell
703: .getTop()
704: - cell.getEffectivePaddingTop(), cell
705: .getRight()
706: - cell.getEffectivePaddingRight());
707: } else {
708: float rightLimit = cell.isNoWrap() ? 20000 : cell
709: .getRight()
710: - cell.getEffectivePaddingRight();
711: float y1 = cell.getTop() - newHeight
712: + cell.getEffectivePaddingBottom();
713: float y2 = cell.getTop()
714: - cell.getEffectivePaddingTop();
715: y = setColumn(ct, cell.getLeft()
716: + cell.getEffectivePaddingLeft(), y1,
717: rightLimit, y2);
718: }
719: try {
720: status = ct.go(true);
721: } catch (DocumentException e) {
722: throw new ExceptionConverter(e);
723: }
724: boolean this Empty = (ct.getYLine() == y);
725: if (this Empty)
726: ct = ColumnText.duplicate(cell.getColumn());
727: allEmpty = (allEmpty && this Empty);
728: if ((status & ColumnText.NO_MORE_TEXT) == 0
729: || this Empty) {
730: c2.setColumn(ct);
731: ct.setFilledWidth(0);
732: } else {
733: c2.setPhrase(null);
734: }
735: }
736: newCells[k] = c2;
737: cell.setFixedHeight(newHeight);
738: }
739: if (allEmpty) {
740: for (int k = 0; k < cells.length; ++k) {
741: PdfPCell cell = cells[k];
742: if (cell == null)
743: continue;
744: float f = fh[k * 2];
745: float m = fh[k * 2 + 1];
746: if (f <= 0)
747: cell.setMinimumHeight(m);
748: else
749: cell.setFixedHeight(f);
750: }
751: return null;
752: }
753: calculateHeights();
754: PdfPRow split = new PdfPRow(newCells);
755: split.widths = (float[]) widths.clone();
756: split.calculateHeights();
757: return split;
758: }
759: }
|