1 | /* | |
2 | * $Id: PdfPRow.java 3999 2009-06-30 11:52:55Z blowagie $ | |
3 | * | |
4 | * Copyright 2001, 2002 Paulo Soares | |
5 | * | |
6 | * The contents of this file are subject to the Mozilla Public License Version 1.1 | |
7 | * (the "License"); you may not use this file except in compliance with the License. | |
8 | * You may obtain a copy of the License at http://www.mozilla.org/MPL/ | |
9 | * | |
10 | * Software distributed under the License is distributed on an "AS IS" basis, | |
11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |
12 | * for the specific language governing rights and limitations under the License. | |
13 | * | |
14 | * The Original Code is 'iText, a free JAVA-PDF library'. | |
15 | * | |
16 | * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by | |
17 | * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie. | |
18 | * All Rights Reserved. | |
19 | * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer | |
20 | * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved. | |
21 | * | |
22 | * Contributor(s): all the names of the contributors are added in the source code | |
23 | * where applicable. | |
24 | * | |
25 | * Alternatively, the contents of this file may be used under the terms of the | |
26 | * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the | |
27 | * provisions of LGPL are applicable instead of those above. If you wish to | |
28 | * allow use of your version of this file only under the terms of the LGPL | |
29 | * License and not to allow others to use your version of this file under | |
30 | * the MPL, indicate your decision by deleting the provisions above and | |
31 | * replace them with the notice and other provisions required by the LGPL. | |
32 | * If you do not delete the provisions above, a recipient may use your version | |
33 | * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE. | |
34 | * | |
35 | * This library is free software; you can redistribute it and/or modify it | |
36 | * under the terms of the MPL as stated above or under the terms of the GNU | |
37 | * Library General Public License as published by the Free Software Foundation; | |
38 | * either version 2 of the License, or any later version. | |
39 | * | |
40 | * This library is distributed in the hope that it will be useful, but WITHOUT | |
41 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
42 | * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more | |
43 | * details. | |
44 | * | |
45 | * If you didn't download this code from the following link, you should check if | |
46 | * you aren't using an obsolete version: | |
47 | * http://www.lowagie.com/iText/ | |
48 | */ | |
49 | ||
50 | package com.lowagie.text.pdf; | |
51 | ||
52 | import java.awt.Color; | |
53 | ||
54 | import com.lowagie.text.DocumentException; | |
55 | import com.lowagie.text.Element; | |
56 | ||
57 | import com.lowagie.text.Image; | |
58 | import com.lowagie.text.Rectangle; | |
59 | import com.lowagie.text.ExceptionConverter; | |
60 | ||
61 | /** | |
62 | * A row in a PdfPTable. | |
63 | * | |
64 | * @author Paulo Soares (psoares@consiste.pt) | |
65 | */ | |
66 | public class PdfPRow { | |
67 | ||
68 | /** the bottom limit (bottom right y) */ | |
69 | public static final float BOTTOM_LIMIT = -(1 << 30); | |
70 | /** | |
71 | * the right limit | |
72 | * @since 2.1.5 | |
73 | */ | |
74 | public static final float RIGHT_LIMIT = 20000; | |
75 | ||
76 | protected PdfPCell[] cells; | |
77 | ||
78 | protected float[] widths; | |
79 | ||
80 | /** | |
81 | * extra heights that needs to be added to a cell because of rowspans. | |
82 | * | |
83 | * @since 2.1.6 | |
84 | */ | |
85 | protected float[] extraHeights; | |
86 | ||
87 | protected float maxHeight = 0; | |
88 | | |
89 | protected boolean calculated = false; | |
90 | | |
91 | private int[] canvasesPos; | |
92 | | |
93 | /** | |
94 | * Constructs a new PdfPRow with the cells in the array that was passed | |
95 | * as a parameter. | |
96 | * | |
97 | * @param cells | |
98 | */ | |
99 | public PdfPRow(PdfPCell[] cells) { | |
100 | this.cells = cells; | |
101 | widths = new float[cells.length]; | |
102 |
1
1. |
initExtraHeights(); |
103 | } | |
104 | ||
105 | /** | |
106 | * Makes a copy of an existing row. | |
107 | * | |
108 | * @param row | |
109 | */ | |
110 | public PdfPRow(PdfPRow row) { | |
111 | maxHeight = row.maxHeight; | |
112 | calculated = row.calculated; | |
113 | cells = new PdfPCell[row.cells.length]; | |
114 |
2
1. 2. |
for (int k = 0; k < cells.length; ++k) { |
115 |
1
1. |
if (row.cells[k] != null) |
116 | cells[k] = new PdfPCell(row.cells[k]); | |
117 | } | |
118 | widths = new float[cells.length]; | |
119 |
1
1. |
System.arraycopy(row.widths, 0, widths, 0, cells.length); |
120 |
1
1. |
initExtraHeights(); |
121 | } | |
122 | ||
123 | /** | |
124 | * Sets the widths of the columns in the row. | |
125 | * | |
126 | * @param widths | |
127 | * @return true if everything went right | |
128 | */ | |
129 | public boolean setWidths(float[] widths) { | |
130 |
1
1. setWidths : negated conditional → NO_COVERAGE |
if (widths.length != cells.length) |
131 |
1
1. setWidths : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
132 |
1
1. setWidths : removed call to java/lang/System::arraycopy → NO_COVERAGE |
System.arraycopy(widths, 0, this.widths, 0, cells.length); |
133 | float total = 0; | |
134 | calculated = false; | |
135 |
3
1. setWidths : changed conditional boundary → NO_COVERAGE 2. setWidths : Changed increment from 1 to -1 → NO_COVERAGE 3. setWidths : negated conditional → NO_COVERAGE |
for (int k = 0; k < widths.length; ++k) { |
136 | PdfPCell cell = cells[k]; | |
137 | | |
138 |
1
1. setWidths : negated conditional → NO_COVERAGE |
if (cell == null) { |
139 |
1
1. setWidths : Replaced float addition with subtraction → NO_COVERAGE |
total += widths[k]; |
140 | continue; | |
141 | } | |
142 | | |
143 |
1
1. setWidths : removed call to com/lowagie/text/pdf/PdfPCell::setLeft → NO_COVERAGE |
cell.setLeft(total); |
144 |
1
1. setWidths : Replaced integer addition with subtraction → NO_COVERAGE |
int last = k + cell.getColspan(); |
145 |
3
1. setWidths : changed conditional boundary → NO_COVERAGE 2. setWidths : Changed increment from 1 to -1 → NO_COVERAGE 3. setWidths : negated conditional → NO_COVERAGE |
for (; k < last; ++k) |
146 |
1
1. setWidths : Replaced float addition with subtraction → NO_COVERAGE |
total += widths[k]; |
147 |
1
1. setWidths : Changed increment from -1 to 1 → NO_COVERAGE |
--k; |
148 |
1
1. setWidths : removed call to com/lowagie/text/pdf/PdfPCell::setRight → NO_COVERAGE |
cell.setRight(total); |
149 |
1
1. setWidths : removed call to com/lowagie/text/pdf/PdfPCell::setTop → NO_COVERAGE |
cell.setTop(0); |
150 | } | |
151 |
1
1. setWidths : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
152 | } | |
153 | ||
154 | /** | |
155 | * Initializes the extra heights array. | |
156 | * @since 2.1.6 | |
157 | */ | |
158 | public void initExtraHeights() { | |
159 | extraHeights = new float[cells.length]; | |
160 |
2
1. initExtraHeights : changed conditional boundary → NO_COVERAGE 2. initExtraHeights : negated conditional → NO_COVERAGE |
for (int i = 0; i < extraHeights.length; i++) { |
161 | extraHeights[i] = 0; | |
162 | } | |
163 | } | |
164 | | |
165 | /** | |
166 | * Sets an extra height for a cell. | |
167 | * @param cell the index of the cell that needs an extra height | |
168 | * @param height the extra height | |
169 | * @since 2.1.6 | |
170 | */ | |
171 | public void setExtraHeight(int cell, float height) { | |
172 |
4
1. setExtraHeight : changed conditional boundary → NO_COVERAGE 2. setExtraHeight : changed conditional boundary → NO_COVERAGE 3. setExtraHeight : negated conditional → NO_COVERAGE 4. setExtraHeight : negated conditional → NO_COVERAGE |
if (cell < 0 || cell >= cells.length) |
173 | return; | |
174 | extraHeights[cell] = height; | |
175 | } | |
176 | | |
177 | /** | |
178 | * Calculates the heights of each cell in the row. | |
179 | * | |
180 | * @return the maximum height of the row. | |
181 | */ | |
182 | public float calculateHeights() { | |
183 | maxHeight = 0; | |
184 | for (PdfPCell cell : cells) { | |
185 | float height = 0; | |
186 |
1
1. calculateHeights : negated conditional → NO_COVERAGE |
if (cell == null) { |
187 | continue; | |
188 | } else { | |
189 | height = cell.getMaxHeight(); | |
190 |
3
1. calculateHeights : changed conditional boundary → NO_COVERAGE 2. calculateHeights : negated conditional → NO_COVERAGE 3. calculateHeights : negated conditional → NO_COVERAGE |
if ((height > maxHeight) && (cell.getRowspan() == 1)) |
191 | maxHeight = height; | |
192 | } | |
193 | } | |
194 | calculated = true; | |
195 |
1
1. calculateHeights : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPRow::calculateHeights → NO_COVERAGE |
return maxHeight; |
196 | } | |
197 | ||
198 | /** | |
199 | * Writes the border and background of one cell in the row. | |
200 | * | |
201 | * @param xPos The x-coordinate where the table starts on the canvas | |
202 | * @param yPos The y-coordinate where the table starts on the canvas | |
203 | * @param currentMaxHeight The height of the cell to be drawn. | |
204 | * @param cell | |
205 | * @param canvases | |
206 | * @since 2.1.6 extra parameter currentMaxHeight | |
207 | */ | |
208 | public void writeBorderAndBackground(float xPos, float yPos, float currentMaxHeight, PdfPCell cell, PdfContentByte[] canvases) { | |
209 | Color background = cell.getBackgroundColor(); | |
210 |
2
1. writeBorderAndBackground : negated conditional → NO_COVERAGE 2. writeBorderAndBackground : negated conditional → NO_COVERAGE |
if (background != null || cell.hasBorders()) { |
211 | // Add xPos resp. yPos to the cell's coordinates for absolute coordinates | |
212 |
1
1. writeBorderAndBackground : Replaced float addition with subtraction → NO_COVERAGE |
float right = cell.getRight() + xPos; |
213 |
1
1. writeBorderAndBackground : Replaced float addition with subtraction → NO_COVERAGE |
float top = cell.getTop() + yPos; |
214 |
1
1. writeBorderAndBackground : Replaced float addition with subtraction → NO_COVERAGE |
float left = cell.getLeft() + xPos; |
215 |
1
1. writeBorderAndBackground : Replaced float subtraction with addition → NO_COVERAGE |
float bottom = top - currentMaxHeight; |
216 | | |
217 |
1
1. writeBorderAndBackground : negated conditional → NO_COVERAGE |
if (background != null) { |
218 | PdfContentByte backgr = canvases[PdfPTable.BACKGROUNDCANVAS]; | |
219 |
1
1. writeBorderAndBackground : removed call to com/lowagie/text/pdf/PdfContentByte::setColorFill → NO_COVERAGE |
backgr.setColorFill(background); |
220 |
3
1. writeBorderAndBackground : Replaced float subtraction with addition → NO_COVERAGE 2. writeBorderAndBackground : Replaced float subtraction with addition → NO_COVERAGE 3. writeBorderAndBackground : removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE |
backgr.rectangle(left, bottom, right - left, top - bottom); |
221 |
1
1. writeBorderAndBackground : removed call to com/lowagie/text/pdf/PdfContentByte::fill → NO_COVERAGE |
backgr.fill(); |
222 | } | |
223 |
1
1. writeBorderAndBackground : negated conditional → NO_COVERAGE |
if (cell.hasBorders()) { |
224 | Rectangle newRect = new Rectangle(left, bottom, right, top); | |
225 | // Clone non-position parameters except for the background color | |
226 |
1
1. writeBorderAndBackground : removed call to com/lowagie/text/Rectangle::cloneNonPositionParameters → NO_COVERAGE |
newRect.cloneNonPositionParameters(cell); |
227 |
1
1. writeBorderAndBackground : removed call to com/lowagie/text/Rectangle::setBackgroundColor → NO_COVERAGE |
newRect.setBackgroundColor(null); |
228 | // Write the borders on the line canvas | |
229 | PdfContentByte lineCanvas = canvases[PdfPTable.LINECANVAS]; | |
230 |
1
1. writeBorderAndBackground : removed call to com/lowagie/text/pdf/PdfContentByte::rectangle → NO_COVERAGE |
lineCanvas.rectangle(newRect); |
231 | } | |
232 | } | |
233 | } | |
234 | ||
235 | /** | |
236 | * @since 2.1.6 private is now protected | |
237 | */ | |
238 | protected void saveAndRotateCanvases(PdfContentByte[] canvases, float a, float b, float c, float d, float e, float f) { | |
239 | int last = PdfPTable.TEXTCANVAS + 1; | |
240 |
1
1. saveAndRotateCanvases : negated conditional → NO_COVERAGE |
if (canvasesPos == null) |
241 |
1
1. saveAndRotateCanvases : Replaced integer multiplication with division → NO_COVERAGE |
canvasesPos = new int[last * 2]; |
242 |
3
1. saveAndRotateCanvases : changed conditional boundary → NO_COVERAGE 2. saveAndRotateCanvases : Changed increment from 1 to -1 → NO_COVERAGE 3. saveAndRotateCanvases : negated conditional → NO_COVERAGE |
for (int k = 0; k < last; ++k) { |
243 | ByteBuffer bb = canvases[k].getInternalBuffer(); | |
244 |
1
1. saveAndRotateCanvases : Replaced integer multiplication with division → NO_COVERAGE |
canvasesPos[k * 2] = bb.size(); |
245 |
1
1. saveAndRotateCanvases : removed call to com/lowagie/text/pdf/PdfContentByte::saveState → NO_COVERAGE |
canvases[k].saveState(); |
246 |
1
1. saveAndRotateCanvases : removed call to com/lowagie/text/pdf/PdfContentByte::concatCTM → NO_COVERAGE |
canvases[k].concatCTM(a, b, c, d, e, f); |
247 |
2
1. saveAndRotateCanvases : Replaced integer multiplication with division → NO_COVERAGE 2. saveAndRotateCanvases : Replaced integer addition with subtraction → NO_COVERAGE |
canvasesPos[k * 2 + 1] = bb.size(); |
248 | } | |
249 | } | |
250 | ||
251 | /** | |
252 | * @since 2.1.6 private is now protected | |
253 | */ | |
254 | protected void restoreCanvases(PdfContentByte[] canvases) { | |
255 | int last = PdfPTable.TEXTCANVAS + 1; | |
256 |
3
1. restoreCanvases : changed conditional boundary → NO_COVERAGE 2. restoreCanvases : Changed increment from 1 to -1 → NO_COVERAGE 3. restoreCanvases : negated conditional → NO_COVERAGE |
for (int k = 0; k < last; ++k) { |
257 | ByteBuffer bb = canvases[k].getInternalBuffer(); | |
258 | int p1 = bb.size(); | |
259 |
1
1. restoreCanvases : removed call to com/lowagie/text/pdf/PdfContentByte::restoreState → NO_COVERAGE |
canvases[k].restoreState(); |
260 |
3
1. restoreCanvases : Replaced integer multiplication with division → NO_COVERAGE 2. restoreCanvases : Replaced integer addition with subtraction → NO_COVERAGE 3. restoreCanvases : negated conditional → NO_COVERAGE |
if (p1 == canvasesPos[k * 2 + 1]) |
261 |
2
1. restoreCanvases : Replaced integer multiplication with division → NO_COVERAGE 2. restoreCanvases : removed call to com/lowagie/text/pdf/ByteBuffer::setSize → NO_COVERAGE |
bb.setSize(canvasesPos[k * 2]); |
262 | } | |
263 | } | |
264 | ||
265 | /** | |
266 | * @since 3.0.0 protected is now public static | |
267 | */ | |
268 | public static float setColumn(ColumnText ct, float left, float bottom, float right, float top) { | |
269 |
2
1. setColumn : changed conditional boundary → NO_COVERAGE 2. setColumn : negated conditional → NO_COVERAGE |
if (left > right) |
270 | right = left; | |
271 |
2
1. setColumn : changed conditional boundary → NO_COVERAGE 2. setColumn : negated conditional → NO_COVERAGE |
if (bottom > top) |
272 | top = bottom; | |
273 |
1
1. setColumn : removed call to com/lowagie/text/pdf/ColumnText::setSimpleColumn → NO_COVERAGE |
ct.setSimpleColumn(left, bottom, right, top); |
274 |
1
1. setColumn : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPRow::setColumn → NO_COVERAGE |
return top; |
275 | } | |
276 | | |
277 | /** | |
278 | * Writes a number of cells (not necessarily all cells). | |
279 | * | |
280 | * @param colStart The first column to be written. | |
281 | * Remember that the column index starts with 0. | |
282 | * @param colEnd The last column to be written. | |
283 | * Remember that the column index starts with 0. | |
284 | * If -1, all the columns to the end are written. | |
285 | * @param xPos The x-coordinate where the table starts on the canvas | |
286 | * @param yPos The y-coordinate where the table starts on the canvas | |
287 | */ | |
288 | public void writeCells(int colStart, int colEnd, float xPos, float yPos, PdfContentByte[] canvases) { | |
289 |
1
1. writeCells : negated conditional → NO_COVERAGE |
if (!calculated) |
290 | calculateHeights(); | |
291 |
2
1. writeCells : changed conditional boundary → NO_COVERAGE 2. writeCells : negated conditional → NO_COVERAGE |
if (colEnd < 0) |
292 | colEnd = cells.length; | |
293 | else | |
294 | colEnd = Math.min(colEnd, cells.length); | |
295 |
2
1. writeCells : changed conditional boundary → NO_COVERAGE 2. writeCells : negated conditional → NO_COVERAGE |
if (colStart < 0) |
296 | colStart = 0; | |
297 |
2
1. writeCells : changed conditional boundary → NO_COVERAGE 2. writeCells : negated conditional → NO_COVERAGE |
if (colStart >= colEnd) |
298 | return; | |
299 | | |
300 | int newStart; | |
301 |
3
1. writeCells : changed conditional boundary → NO_COVERAGE 2. writeCells : Changed increment from -1 to 1 → NO_COVERAGE 3. writeCells : negated conditional → NO_COVERAGE |
for (newStart = colStart; newStart >= 0; --newStart) { |
302 |
1
1. writeCells : negated conditional → NO_COVERAGE |
if (cells[newStart] != null) |
303 | break; | |
304 |
2
1. writeCells : changed conditional boundary → NO_COVERAGE 2. writeCells : negated conditional → NO_COVERAGE |
if (newStart > 0) |
305 |
2
1. writeCells : Replaced integer subtraction with addition → NO_COVERAGE 2. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
xPos -= widths[newStart - 1]; |
306 | } | |
307 | | |
308 |
2
1. writeCells : changed conditional boundary → NO_COVERAGE 2. writeCells : negated conditional → NO_COVERAGE |
if (newStart < 0) |
309 | newStart = 0; | |
310 |
1
1. writeCells : negated conditional → NO_COVERAGE |
if (cells[newStart] != null) |
311 |
1
1. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
xPos -= cells[newStart].getLeft(); |
312 | | |
313 |
3
1. writeCells : changed conditional boundary → NO_COVERAGE 2. writeCells : Changed increment from 1 to -1 → NO_COVERAGE 3. writeCells : negated conditional → NO_COVERAGE |
for (int k = newStart; k < colEnd; ++k) { |
314 | PdfPCell cell = cells[k]; | |
315 |
1
1. writeCells : negated conditional → NO_COVERAGE |
if (cell == null) |
316 | continue; | |
317 |
1
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
float currentMaxHeight = maxHeight + extraHeights[k]; |
318 | | |
319 |
1
1. writeCells : removed call to com/lowagie/text/pdf/PdfPRow::writeBorderAndBackground → NO_COVERAGE |
writeBorderAndBackground(xPos, yPos, currentMaxHeight, cell, canvases); |
320 | ||
321 | Image img = cell.getImage(); | |
322 | | |
323 |
2
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE 2. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
float tly = cell.getTop() + yPos - cell.getEffectivePaddingTop(); |
324 |
2
1. writeCells : changed conditional boundary → NO_COVERAGE 2. writeCells : negated conditional → NO_COVERAGE |
if (cell.getHeight() <= currentMaxHeight) { |
325 | switch (cell.getVerticalAlignment()) { | |
326 | case Element.ALIGN_BOTTOM: | |
327 |
3
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE 2. writeCells : Replaced float subtraction with addition → NO_COVERAGE 3. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
tly = cell.getTop() + yPos - currentMaxHeight + cell.getHeight() |
328 |
1
1. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
- cell.getEffectivePaddingTop(); |
329 | break; | |
330 | case Element.ALIGN_MIDDLE: | |
331 |
4
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE 2. writeCells : Replaced float subtraction with addition → NO_COVERAGE 3. writeCells : Replaced float division with multiplication → NO_COVERAGE 4. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
tly = cell.getTop() + yPos + (cell.getHeight() - currentMaxHeight) / 2 |
332 |
1
1. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
- cell.getEffectivePaddingTop(); |
333 | break; | |
334 | default: | |
335 | break; | |
336 | } | |
337 | } | |
338 |
1
1. writeCells : negated conditional → NO_COVERAGE |
if (img != null) { |
339 |
1
1. writeCells : negated conditional → NO_COVERAGE |
if (cell.getRotation() != 0) { |
340 | img = Image.getInstance(img); | |
341 |
4
1. writeCells : Replaced double multiplication with division → NO_COVERAGE 2. writeCells : Replaced double division with multiplication → NO_COVERAGE 3. writeCells : Replaced float addition with subtraction → NO_COVERAGE 4. writeCells : removed call to com/lowagie/text/Image::setRotation → NO_COVERAGE |
img.setRotation(img.getImageRotation() + (float)(cell.getRotation() * Math.PI / 180.0)); |
342 | } | |
343 | boolean vf = false; | |
344 |
2
1. writeCells : changed conditional boundary → NO_COVERAGE 2. writeCells : negated conditional → NO_COVERAGE |
if (cell.getHeight() > currentMaxHeight) { |
345 |
1
1. writeCells : removed call to com/lowagie/text/Image::scalePercent → NO_COVERAGE |
img.scalePercent(100); |
346 |
1
1. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
float scale = (currentMaxHeight - cell.getEffectivePaddingTop() - cell |
347 |
1
1. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
.getEffectivePaddingBottom()) |
348 |
1
1. writeCells : Replaced float division with multiplication → NO_COVERAGE |
/ img.getScaledHeight(); |
349 |
2
1. writeCells : Replaced float multiplication with division → NO_COVERAGE 2. writeCells : removed call to com/lowagie/text/Image::scalePercent → NO_COVERAGE |
img.scalePercent(scale * 100); |
350 | vf = true; | |
351 | } | |
352 |
1
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
float left = cell.getLeft() + xPos |
353 |
1
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
+ cell.getEffectivePaddingLeft(); |
354 |
1
1. writeCells : negated conditional → NO_COVERAGE |
if (vf) { |
355 | switch (cell.getHorizontalAlignment()) { | |
356 | case Element.ALIGN_CENTER: | |
357 | left = xPos | |
358 |
1
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
+ (cell.getLeft() + cell.getEffectivePaddingLeft() |
359 |
1
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
+ cell.getRight() |
360 |
1
1. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
- cell.getEffectivePaddingRight() - img |
361 |
3
1. writeCells : Replaced float subtraction with addition → NO_COVERAGE 2. writeCells : Replaced float division with multiplication → NO_COVERAGE 3. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
.getScaledWidth()) / 2; |
362 | break; | |
363 | case Element.ALIGN_RIGHT: | |
364 |
1
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
left = xPos + cell.getRight() |
365 |
1
1. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
- cell.getEffectivePaddingRight() |
366 |
1
1. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
- img.getScaledWidth(); |
367 | break; | |
368 | default: | |
369 | break; | |
370 | } | |
371 |
2
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE 2. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
tly = cell.getTop() + yPos - cell.getEffectivePaddingTop(); |
372 | } | |
373 |
2
1. writeCells : Replaced float subtraction with addition → NO_COVERAGE 2. writeCells : removed call to com/lowagie/text/Image::setAbsolutePosition → NO_COVERAGE |
img.setAbsolutePosition(left, tly - img.getScaledHeight()); |
374 | try { | |
375 |
1
1. writeCells : removed call to com/lowagie/text/pdf/PdfContentByte::addImage → NO_COVERAGE |
canvases[PdfPTable.TEXTCANVAS].addImage(img); |
376 | } catch (DocumentException e) { | |
377 | throw new ExceptionConverter(e); | |
378 | } | |
379 | } else { | |
380 | // rotation sponsored by Connection GmbH | |
381 |
2
1. writeCells : negated conditional → NO_COVERAGE 2. writeCells : negated conditional → NO_COVERAGE |
if (cell.getRotation() == 90 || cell.getRotation() == 270) { |
382 |
2
1. writeCells : Replaced float subtraction with addition → NO_COVERAGE 2. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
float netWidth = currentMaxHeight - cell.getEffectivePaddingTop() - cell.getEffectivePaddingBottom(); |
383 |
2
1. writeCells : Replaced float subtraction with addition → NO_COVERAGE 2. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
float netHeight = cell.getWidth() - cell.getEffectivePaddingLeft() - cell.getEffectivePaddingRight(); |
384 | ColumnText ct = ColumnText.duplicate(cell.getColumn()); | |
385 |
1
1. writeCells : removed call to com/lowagie/text/pdf/ColumnText::setCanvases → NO_COVERAGE |
ct.setCanvases(canvases); |
386 |
3
1. writeCells : removed negation → NO_COVERAGE 2. writeCells : Replaced float addition with subtraction → NO_COVERAGE 3. writeCells : removed call to com/lowagie/text/pdf/ColumnText::setSimpleColumn → NO_COVERAGE |
ct.setSimpleColumn(0, 0, netWidth + 0.001f, -netHeight); |
387 | try { | |
388 | ct.go(true); | |
389 | } catch (DocumentException e) { | |
390 | throw new ExceptionConverter(e); | |
391 | } | |
392 |
1
1. writeCells : removed negation → NO_COVERAGE |
float calcHeight = -ct.getYLine(); |
393 |
4
1. writeCells : changed conditional boundary → NO_COVERAGE 2. writeCells : changed conditional boundary → NO_COVERAGE 3. writeCells : negated conditional → NO_COVERAGE 4. writeCells : negated conditional → NO_COVERAGE |
if (netWidth <= 0 || netHeight <= 0) |
394 | calcHeight = 0; | |
395 |
2
1. writeCells : changed conditional boundary → NO_COVERAGE 2. writeCells : negated conditional → NO_COVERAGE |
if (calcHeight > 0) { |
396 |
1
1. writeCells : negated conditional → NO_COVERAGE |
if (cell.isUseDescender()) |
397 |
1
1. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
calcHeight -= ct.getDescender(); |
398 | ct = ColumnText.duplicate(cell.getColumn()); | |
399 |
1
1. writeCells : removed call to com/lowagie/text/pdf/ColumnText::setCanvases → NO_COVERAGE |
ct.setCanvases(canvases); |
400 |
2
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE 2. writeCells : removed call to com/lowagie/text/pdf/ColumnText::setSimpleColumn → NO_COVERAGE |
ct.setSimpleColumn(-0.003f, -0.001f, netWidth + 0.003f, calcHeight); |
401 | float pivotX; | |
402 | float pivotY; | |
403 |
1
1. writeCells : negated conditional → NO_COVERAGE |
if (cell.getRotation() == 90) { |
404 |
3
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE 2. writeCells : Replaced float subtraction with addition → NO_COVERAGE 3. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
pivotY = cell.getTop() + yPos - currentMaxHeight + cell.getEffectivePaddingBottom(); |
405 | switch (cell.getVerticalAlignment()) { | |
406 | case Element.ALIGN_BOTTOM: | |
407 |
3
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE 2. writeCells : Replaced float addition with subtraction → NO_COVERAGE 3. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
pivotX = cell.getLeft() + xPos + cell.getWidth() - cell.getEffectivePaddingRight(); |
408 | break; | |
409 | case Element.ALIGN_MIDDLE: | |
410 |
6
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE 2. writeCells : Replaced float addition with subtraction → NO_COVERAGE 3. writeCells : Replaced float subtraction with addition → NO_COVERAGE 4. writeCells : Replaced float addition with subtraction → NO_COVERAGE 5. writeCells : Replaced float division with multiplication → NO_COVERAGE 6. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
pivotX = cell.getLeft() + xPos + (cell.getWidth() + cell.getEffectivePaddingLeft() - cell.getEffectivePaddingRight() + calcHeight) / 2; |
411 | break; | |
412 | default: //top | |
413 |
3
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE 2. writeCells : Replaced float addition with subtraction → NO_COVERAGE 3. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
pivotX = cell.getLeft() + xPos + cell.getEffectivePaddingLeft() + calcHeight; |
414 | break; | |
415 | } | |
416 |
1
1. writeCells : removed call to com/lowagie/text/pdf/PdfPRow::saveAndRotateCanvases → NO_COVERAGE |
saveAndRotateCanvases(canvases, 0,1,-1,0,pivotX,pivotY); |
417 | } | |
418 | else { | |
419 |
2
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE 2. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
pivotY = cell.getTop() + yPos - cell.getEffectivePaddingTop(); |
420 | switch (cell.getVerticalAlignment()) { | |
421 | case Element.ALIGN_BOTTOM: | |
422 |
2
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE 2. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
pivotX = cell.getLeft() + xPos + cell.getEffectivePaddingLeft(); |
423 | break; | |
424 | case Element.ALIGN_MIDDLE: | |
425 |
6
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE 2. writeCells : Replaced float addition with subtraction → NO_COVERAGE 3. writeCells : Replaced float subtraction with addition → NO_COVERAGE 4. writeCells : Replaced float subtraction with addition → NO_COVERAGE 5. writeCells : Replaced float division with multiplication → NO_COVERAGE 6. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
pivotX = cell.getLeft() + xPos + (cell.getWidth() + cell.getEffectivePaddingLeft() - cell.getEffectivePaddingRight() - calcHeight) / 2; |
426 | break; | |
427 | default: //top | |
428 |
4
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE 2. writeCells : Replaced float addition with subtraction → NO_COVERAGE 3. writeCells : Replaced float subtraction with addition → NO_COVERAGE 4. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
pivotX = cell.getLeft() + xPos + cell.getWidth() - cell.getEffectivePaddingRight() - calcHeight; |
429 | break; | |
430 | } | |
431 |
1
1. writeCells : removed call to com/lowagie/text/pdf/PdfPRow::saveAndRotateCanvases → NO_COVERAGE |
saveAndRotateCanvases(canvases, 0,-1,1,0,pivotX,pivotY); |
432 | } | |
433 | try { | |
434 | ct.go(); | |
435 | } catch (DocumentException e) { | |
436 | throw new ExceptionConverter(e); | |
437 | } finally { | |
438 |
1
1. writeCells : removed call to com/lowagie/text/pdf/PdfPRow::restoreCanvases → NO_COVERAGE |
restoreCanvases(canvases); |
439 | } | |
440 | } | |
441 | } | |
442 | else { | |
443 | float fixedHeight = cell.getFixedHeight(); | |
444 |
1
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
float rightLimit = cell.getRight() + xPos |
445 |
1
1. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
- cell.getEffectivePaddingRight(); |
446 |
1
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
float leftLimit = cell.getLeft() + xPos |
447 |
1
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
+ cell.getEffectivePaddingLeft(); |
448 |
1
1. writeCells : negated conditional → NO_COVERAGE |
if (cell.isNoWrap()) { |
449 | switch (cell.getHorizontalAlignment()) { | |
450 | case Element.ALIGN_CENTER: | |
451 |
1
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
rightLimit += 10000; |
452 |
1
1. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
leftLimit -= 10000; |
453 | break; | |
454 | case Element.ALIGN_RIGHT: | |
455 |
1
1. writeCells : negated conditional → NO_COVERAGE |
if (cell.getRotation() == 180) { |
456 |
1
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
rightLimit += RIGHT_LIMIT; |
457 | } | |
458 | else { | |
459 |
1
1. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
leftLimit -= RIGHT_LIMIT; |
460 | } | |
461 | break; | |
462 | default: | |
463 |
1
1. writeCells : negated conditional → NO_COVERAGE |
if (cell.getRotation() == 180) { |
464 |
1
1. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
leftLimit -= RIGHT_LIMIT; |
465 | } | |
466 | else { | |
467 |
1
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
rightLimit += RIGHT_LIMIT; |
468 | } | |
469 | break; | |
470 | } | |
471 | } | |
472 | ColumnText ct = ColumnText.duplicate(cell.getColumn()); | |
473 |
1
1. writeCells : removed call to com/lowagie/text/pdf/ColumnText::setCanvases → NO_COVERAGE |
ct.setCanvases(canvases); |
474 | float bry = tly | |
475 | - (currentMaxHeight | |
476 |
3
1. writeCells : Replaced float subtraction with addition → NO_COVERAGE 2. writeCells : Replaced float subtraction with addition → NO_COVERAGE 3. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
- cell.getEffectivePaddingTop() - cell.getEffectivePaddingBottom()); |
477 |
2
1. writeCells : changed conditional boundary → NO_COVERAGE 2. writeCells : negated conditional → NO_COVERAGE |
if (fixedHeight > 0) { |
478 |
2
1. writeCells : changed conditional boundary → NO_COVERAGE 2. writeCells : negated conditional → NO_COVERAGE |
if (cell.getHeight() > currentMaxHeight) { |
479 |
2
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE 2. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
tly = cell.getTop() + yPos - cell.getEffectivePaddingTop(); |
480 |
3
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE 2. writeCells : Replaced float subtraction with addition → NO_COVERAGE 3. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
bry = cell.getTop() + yPos - currentMaxHeight + cell.getEffectivePaddingBottom(); |
481 | } | |
482 | } | |
483 |
5
1. writeCells : changed conditional boundary → NO_COVERAGE 2. writeCells : changed conditional boundary → NO_COVERAGE 3. writeCells : negated conditional → NO_COVERAGE 4. writeCells : negated conditional → NO_COVERAGE 5. writeCells : negated conditional → NO_COVERAGE |
if ((tly > bry || ct.zeroHeightElement()) && leftLimit < rightLimit) { |
484 |
2
1. writeCells : Replaced float subtraction with addition → NO_COVERAGE 2. writeCells : removed call to com/lowagie/text/pdf/ColumnText::setSimpleColumn → NO_COVERAGE |
ct.setSimpleColumn(leftLimit, bry - 0.001f, rightLimit, tly); |
485 |
1
1. writeCells : negated conditional → NO_COVERAGE |
if (cell.getRotation() == 180) { |
486 |
1
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
float shx = leftLimit + rightLimit; |
487 |
4
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE 2. writeCells : Replaced float subtraction with addition → NO_COVERAGE 3. writeCells : Replaced float addition with subtraction → NO_COVERAGE 4. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
float shy = yPos + yPos - currentMaxHeight + cell.getEffectivePaddingBottom() - cell.getEffectivePaddingTop(); |
488 |
1
1. writeCells : removed call to com/lowagie/text/pdf/PdfPRow::saveAndRotateCanvases → NO_COVERAGE |
saveAndRotateCanvases(canvases, -1,0,0,-1,shx,shy); |
489 | } | |
490 | try { | |
491 | ct.go(); | |
492 | } catch (DocumentException e) { | |
493 | throw new ExceptionConverter(e); | |
494 | } finally { | |
495 |
1
1. writeCells : negated conditional → NO_COVERAGE |
if (cell.getRotation() == 180) { |
496 |
1
1. writeCells : removed call to com/lowagie/text/pdf/PdfPRow::restoreCanvases → NO_COVERAGE |
restoreCanvases(canvases); |
497 | } | |
498 | } | |
499 | } | |
500 | } | |
501 | } | |
502 | PdfPCellEvent evt = cell.getCellEvent(); | |
503 |
1
1. writeCells : negated conditional → NO_COVERAGE |
if (evt != null) { |
504 |
3
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE 2. writeCells : Replaced float addition with subtraction → NO_COVERAGE 3. writeCells : Replaced float subtraction with addition → NO_COVERAGE |
Rectangle rect = new Rectangle(cell.getLeft() + xPos, cell.getTop() |
505 |
2
1. writeCells : Replaced float addition with subtraction → NO_COVERAGE 2. writeCells : Replaced float addition with subtraction → NO_COVERAGE |
+ yPos - currentMaxHeight, cell.getRight() + xPos, cell.getTop() |
506 | + yPos); | |
507 |
1
1. writeCells : removed call to com/lowagie/text/pdf/PdfPCellEvent::cellLayout → NO_COVERAGE |
evt.cellLayout(cell, rect, canvases); |
508 | } | |
509 | } | |
510 | } | |
511 | | |
512 | /** | |
513 | * Checks if the dimensions of the columns were calculated. | |
514 | * | |
515 | * @return true if the dimensions of the columns were calculated | |
516 | */ | |
517 | public boolean isCalculated() { | |
518 | return calculated; | |
519 | } | |
520 | ||
521 | /** | |
522 | * Gets the maximum height of the row (i.e. of the 'highest' cell). | |
523 | * | |
524 | * @return the maximum height of the row | |
525 | */ | |
526 | public float getMaxHeights() { | |
527 |
1
1. getMaxHeights : negated conditional → NO_COVERAGE |
if (calculated) |
528 |
1
1. getMaxHeights : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPRow::getMaxHeights → NO_COVERAGE |
return maxHeight; |
529 |
1
1. getMaxHeights : replaced return of float value with -(x + 1) for com/lowagie/text/pdf/PdfPRow::getMaxHeights → NO_COVERAGE |
return calculateHeights(); |
530 | } | |
531 | ||
532 | /** | |
533 | * Changes the maximum height of the row (to make it higher). | |
534 | * (added by Jin-Hsia Yang) | |
535 | * | |
536 | * @param maxHeight the new maximum height | |
537 | */ | |
538 | public void setMaxHeights(float maxHeight) { | |
539 | this.maxHeight = maxHeight; | |
540 | } | |
541 | ||
542 | //end add | |
543 | ||
544 | float[] getEventWidth(float xPos) { | |
545 | int n = 0; | |
546 | for (PdfPCell cell1 : cells) { | |
547 |
1
1. getEventWidth : negated conditional → NO_COVERAGE |
if (cell1 != null) |
548 |
1
1. getEventWidth : Changed increment from 1 to -1 → NO_COVERAGE |
++n; |
549 | } | |
550 |
1
1. getEventWidth : Replaced integer addition with subtraction → NO_COVERAGE |
float[] width = new float[n + 1]; |
551 | n = 0; | |
552 |
1
1. getEventWidth : Changed increment from 1 to -1 → NO_COVERAGE |
width[n++] = xPos; |
553 | for (PdfPCell cell : cells) { | |
554 |
1
1. getEventWidth : negated conditional → NO_COVERAGE |
if (cell != null) { |
555 |
2
1. getEventWidth : Replaced integer subtraction with addition → NO_COVERAGE 2. getEventWidth : Replaced float addition with subtraction → NO_COVERAGE |
width[n] = width[n - 1] + cell.getWidth(); |
556 |
1
1. getEventWidth : Changed increment from 1 to -1 → NO_COVERAGE |
++n; |
557 | } | |
558 | } | |
559 |
1
1. getEventWidth : mutated return of Object value for com/lowagie/text/pdf/PdfPRow::getEventWidth to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return width; |
560 | } | |
561 | ||
562 | /** | |
563 | * Splits a row to newHeight. | |
564 | * The returned row is the remainder. It will return null if the newHeight | |
565 | * was so small that only an empty row would result. | |
566 | * | |
567 | * @param new_height the new height | |
568 | * @return the remainder row or null if the newHeight was so small that only | |
569 | * an empty row would result | |
570 | */ | |
571 | public PdfPRow splitRow(PdfPTable table, int rowIndex, float new_height) { | |
572 | PdfPCell[] newCells = new PdfPCell[cells.length]; | |
573 | float[] fixHs = new float[cells.length]; | |
574 | float[] minHs = new float[cells.length]; | |
575 | boolean allEmpty = true; | |
576 |
3
1. splitRow : changed conditional boundary → NO_COVERAGE 2. splitRow : Changed increment from 1 to -1 → NO_COVERAGE 3. splitRow : negated conditional → NO_COVERAGE |
for (int k = 0; k < cells.length; ++k) { |
577 | float newHeight = new_height; | |
578 | PdfPCell cell = cells[k]; | |
579 |
1
1. splitRow : negated conditional → NO_COVERAGE |
if (cell == null) { |
580 | int index = rowIndex; | |
581 |
1
1. splitRow : negated conditional → NO_COVERAGE |
if (table.rowSpanAbove(index, k)) { |
582 |
1
1. splitRow : Replaced float addition with subtraction → NO_COVERAGE |
newHeight += table.getRowHeight(index); |
583 |
2
1. splitRow : Changed increment from -1 to 1 → NO_COVERAGE 2. splitRow : negated conditional → NO_COVERAGE |
while (table.rowSpanAbove(--index, k)) { |
584 |
1
1. splitRow : Replaced float addition with subtraction → NO_COVERAGE |
newHeight += table.getRowHeight(index); |
585 | } | |
586 | PdfPRow row = table.getRow(index); | |
587 |
2
1. splitRow : negated conditional → NO_COVERAGE 2. splitRow : negated conditional → NO_COVERAGE |
if (row != null && row.getCells()[k] != null) { |
588 | newCells[k] = new PdfPCell(row.getCells()[k]); | |
589 |
1
1. splitRow : removed call to com/lowagie/text/pdf/PdfPCell::consumeHeight → NO_COVERAGE |
newCells[k].consumeHeight(newHeight); |
590 |
3
1. splitRow : Replaced integer subtraction with addition → NO_COVERAGE 2. splitRow : Replaced integer addition with subtraction → NO_COVERAGE 3. splitRow : removed call to com/lowagie/text/pdf/PdfPCell::setRowspan → NO_COVERAGE |
newCells[k].setRowspan(row.getCells()[k].getRowspan() - rowIndex + index); |
591 | allEmpty = false; | |
592 | } | |
593 | } | |
594 | continue; | |
595 | } | |
596 | fixHs[k] = cell.getFixedHeight(); | |
597 | minHs[k] = cell.getMinimumHeight(); | |
598 | Image img = cell.getImage(); | |
599 | PdfPCell newCell = new PdfPCell(cell); | |
600 |
1
1. splitRow : negated conditional → NO_COVERAGE |
if (img != null) { |
601 |
4
1. splitRow : changed conditional boundary → NO_COVERAGE 2. splitRow : Replaced float addition with subtraction → NO_COVERAGE 3. splitRow : Replaced float addition with subtraction → NO_COVERAGE 4. splitRow : negated conditional → NO_COVERAGE |
if (newHeight > cell.getEffectivePaddingBottom() + cell.getEffectivePaddingTop() + 2) { |
602 |
1
1. splitRow : removed call to com/lowagie/text/pdf/PdfPCell::setPhrase → NO_COVERAGE |
newCell.setPhrase(null); |
603 | allEmpty = false; | |
604 | } | |
605 | } | |
606 | else { | |
607 | float y; | |
608 | ColumnText ct = ColumnText.duplicate(cell.getColumn()); | |
609 |
1
1. splitRow : Replaced float addition with subtraction → NO_COVERAGE |
float left = cell.getLeft() + cell.getEffectivePaddingLeft(); |
610 |
2
1. splitRow : Replaced float addition with subtraction → NO_COVERAGE 2. splitRow : Replaced float subtraction with addition → NO_COVERAGE |
float bottom = cell.getTop() + cell.getEffectivePaddingBottom() - newHeight; |
611 |
1
1. splitRow : Replaced float subtraction with addition → NO_COVERAGE |
float right = cell.getRight() - cell.getEffectivePaddingRight(); |
612 |
1
1. splitRow : Replaced float subtraction with addition → NO_COVERAGE |
float top = cell.getTop() - cell.getEffectivePaddingTop(); |
613 | switch (cell.getRotation()) { | |
614 | case 90: | |
615 | case 270: | |
616 | y = setColumn(ct, bottom, left, top, right); | |
617 | break; | |
618 | default: | |
619 |
1
1. splitRow : negated conditional → NO_COVERAGE |
y = setColumn(ct, left, bottom, cell.isNoWrap() ? RIGHT_LIMIT : right, top); |
620 | break; | |
621 | } | |
622 | int status; | |
623 | try { | |
624 | status = ct.go(true); | |
625 | } | |
626 | catch (DocumentException e) { | |
627 | throw new ExceptionConverter(e); | |
628 | } | |
629 |
1
1. splitRow : negated conditional → NO_COVERAGE |
boolean thisEmpty = (ct.getYLine() == y); |
630 |
1
1. splitRow : negated conditional → NO_COVERAGE |
if (thisEmpty) { |
631 |
1
1. splitRow : removed call to com/lowagie/text/pdf/PdfPCell::setColumn → NO_COVERAGE |
newCell.setColumn(ColumnText.duplicate(cell.getColumn())); |
632 |
1
1. splitRow : removed call to com/lowagie/text/pdf/ColumnText::setFilledWidth → NO_COVERAGE |
ct.setFilledWidth(0); |
633 | } | |
634 |
2
1. splitRow : Replaced bitwise AND with OR → NO_COVERAGE 2. splitRow : negated conditional → NO_COVERAGE |
else if ((status & ColumnText.NO_MORE_TEXT) == 0) { |
635 |
1
1. splitRow : removed call to com/lowagie/text/pdf/PdfPCell::setColumn → NO_COVERAGE |
newCell.setColumn(ct); |
636 |
1
1. splitRow : removed call to com/lowagie/text/pdf/ColumnText::setFilledWidth → NO_COVERAGE |
ct.setFilledWidth(0); |
637 | } | |
638 | else | |
639 |
1
1. splitRow : removed call to com/lowagie/text/pdf/PdfPCell::setPhrase → NO_COVERAGE |
newCell.setPhrase(null); |
640 |
2
1. splitRow : negated conditional → NO_COVERAGE 2. splitRow : negated conditional → NO_COVERAGE |
allEmpty = (allEmpty && thisEmpty); |
641 | } | |
642 | newCells[k] = newCell; | |
643 |
1
1. splitRow : removed call to com/lowagie/text/pdf/PdfPCell::setFixedHeight → NO_COVERAGE |
cell.setFixedHeight(newHeight); |
644 | } | |
645 |
1
1. splitRow : negated conditional → NO_COVERAGE |
if (allEmpty) { |
646 |
2
1. splitRow : changed conditional boundary → NO_COVERAGE 2. splitRow : negated conditional → NO_COVERAGE |
for (int k = 0; k < cells.length; ++k) { |
647 | PdfPCell cell = cells[k]; | |
648 |
1
1. splitRow : negated conditional → NO_COVERAGE |
if (cell == null) |
649 | continue; | |
650 |
2
1. splitRow : changed conditional boundary → NO_COVERAGE 2. splitRow : negated conditional → NO_COVERAGE |
if (fixHs[k] > 0) |
651 |
1
1. splitRow : removed call to com/lowagie/text/pdf/PdfPCell::setFixedHeight → NO_COVERAGE |
cell.setFixedHeight(fixHs[k]); |
652 | else | |
653 |
1
1. splitRow : removed call to com/lowagie/text/pdf/PdfPCell::setMinimumHeight → NO_COVERAGE |
cell.setMinimumHeight(minHs[k]); |
654 | } | |
655 |
1
1. splitRow : mutated return of Object value for com/lowagie/text/pdf/PdfPRow::splitRow to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
656 | } | |
657 | calculateHeights(); | |
658 | PdfPRow split = new PdfPRow(newCells); | |
659 | split.widths = widths.clone(); | |
660 | split.calculateHeights(); | |
661 |
1
1. splitRow : mutated return of Object value for com/lowagie/text/pdf/PdfPRow::splitRow to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return split; |
662 | } | |
663 | | |
664 | /** | |
665 | * Returns the array of cells in the row. | |
666 | * Please be extremely careful with this method. | |
667 | * Use the cells as read only objects. | |
668 | * | |
669 | * @return an array of cells | |
670 | * @since 2.1.1 | |
671 | */ | |
672 | public PdfPCell[] getCells() { | |
673 | return cells; | |
674 | } | |
675 | } | |
Mutations | ||
102 |
1.1 |
|
114 |
1.1 2.2 |
|
115 |
1.1 |
|
119 |
1.1 |
|
120 |
1.1 |
|
130 |
1.1 |
|
131 |
1.1 |
|
132 |
1.1 |
|
135 |
1.1 2.2 3.3 |
|
138 |
1.1 |
|
139 |
1.1 |
|
143 |
1.1 |
|
144 |
1.1 |
|
145 |
1.1 2.2 3.3 |
|
146 |
1.1 |
|
147 |
1.1 |
|
148 |
1.1 |
|
149 |
1.1 |
|
151 |
1.1 |
|
160 |
1.1 2.2 |
|
172 |
1.1 2.2 3.3 4.4 |
|
186 |
1.1 |
|
190 |
1.1 2.2 3.3 |
|
195 |
1.1 |
|
210 |
1.1 2.2 |
|
212 |
1.1 |
|
213 |
1.1 |
|
214 |
1.1 |
|
215 |
1.1 |
|
217 |
1.1 |
|
219 |
1.1 |
|
220 |
1.1 2.2 3.3 |
|
221 |
1.1 |
|
223 |
1.1 |
|
226 |
1.1 |
|
227 |
1.1 |
|
230 |
1.1 |
|
240 |
1.1 |
|
241 |
1.1 |
|
242 |
1.1 2.2 3.3 |
|
244 |
1.1 |
|
245 |
1.1 |
|
246 |
1.1 |
|
247 |
1.1 2.2 |
|
256 |
1.1 2.2 3.3 |
|
259 |
1.1 |
|
260 |
1.1 2.2 3.3 |
|
261 |
1.1 2.2 |
|
269 |
1.1 2.2 |
|
271 |
1.1 2.2 |
|
273 |
1.1 |
|
274 |
1.1 |
|
289 |
1.1 |
|
291 |
1.1 2.2 |
|
295 |
1.1 2.2 |
|
297 |
1.1 2.2 |
|
301 |
1.1 2.2 3.3 |
|
302 |
1.1 |
|
304 |
1.1 2.2 |
|
305 |
1.1 2.2 |
|
308 |
1.1 2.2 |
|
310 |
1.1 |
|
311 |
1.1 |
|
313 |
1.1 2.2 3.3 |
|
315 |
1.1 |
|
317 |
1.1 |
|
319 |
1.1 |
|
323 |
1.1 2.2 |
|
324 |
1.1 2.2 |
|
327 |
1.1 2.2 3.3 |
|
328 |
1.1 |
|
331 |
1.1 2.2 3.3 4.4 |
|
332 |
1.1 |
|
338 |
1.1 |
|
339 |
1.1 |
|
341 |
1.1 2.2 3.3 4.4 |
|
344 |
1.1 2.2 |
|
345 |
1.1 |
|
346 |
1.1 |
|
347 |
1.1 |
|
348 |
1.1 |
|
349 |
1.1 2.2 |
|
352 |
1.1 |
|
353 |
1.1 |
|
354 |
1.1 |
|
358 |
1.1 |
|
359 |
1.1 |
|
360 |
1.1 |
|
361 |
1.1 2.2 3.3 |
|
364 |
1.1 |
|
365 |
1.1 |
|
366 |
1.1 |
|
371 |
1.1 2.2 |
|
373 |
1.1 2.2 |
|
375 |
1.1 |
|
381 |
1.1 2.2 |
|
382 |
1.1 2.2 |
|
383 |
1.1 2.2 |
|
385 |
1.1 |
|
386 |
1.1 2.2 3.3 |
|
392 |
1.1 |
|
393 |
1.1 2.2 3.3 4.4 |
|
395 |
1.1 2.2 |
|
396 |
1.1 |
|
397 |
1.1 |
|
399 |
1.1 |
|
400 |
1.1 2.2 |
|
403 |
1.1 |
|
404 |
1.1 2.2 3.3 |
|
407 |
1.1 2.2 3.3 |
|
410 |
1.1 2.2 3.3 4.4 5.5 6.6 |
|
413 |
1.1 2.2 3.3 |
|
416 |
1.1 |
|
419 |
1.1 2.2 |
|
422 |
1.1 2.2 |
|
425 |
1.1 2.2 3.3 4.4 5.5 6.6 |
|
428 |
1.1 2.2 3.3 4.4 |
|
431 |
1.1 |
|
438 |
1.1 |
|
444 |
1.1 |
|
445 |
1.1 |
|
446 |
1.1 |
|
447 |
1.1 |
|
448 |
1.1 |
|
451 |
1.1 |
|
452 |
1.1 |
|
455 |
1.1 |
|
456 |
1.1 |
|
459 |
1.1 |
|
463 |
1.1 |
|
464 |
1.1 |
|
467 |
1.1 |
|
473 |
1.1 |
|
476 |
1.1 2.2 3.3 |
|
477 |
1.1 2.2 |
|
478 |
1.1 2.2 |
|
479 |
1.1 2.2 |
|
480 |
1.1 2.2 3.3 |
|
483 |
1.1 2.2 3.3 4.4 5.5 |
|
484 |
1.1 2.2 |
|
485 |
1.1 |
|
486 |
1.1 |
|
487 |
1.1 2.2 3.3 4.4 |
|
488 |
1.1 |
|
495 |
1.1 |
|
496 |
1.1 |
|
503 |
1.1 |
|
504 |
1.1 2.2 3.3 |
|
505 |
1.1 2.2 |
|
507 |
1.1 |
|
527 |
1.1 |
|
528 |
1.1 |
|
529 |
1.1 |
|
547 |
1.1 |
|
548 |
1.1 |
|
550 |
1.1 |
|
552 |
1.1 |
|
554 |
1.1 |
|
555 |
1.1 2.2 |
|
556 |
1.1 |
|
559 |
1.1 |
|
576 |
1.1 2.2 3.3 |
|
579 |
1.1 |
|
581 |
1.1 |
|
582 |
1.1 |
|
583 |
1.1 2.2 |
|
584 |
1.1 |
|
587 |
1.1 2.2 |
|
589 |
1.1 |
|
590 |
1.1 2.2 3.3 |
|
600 |
1.1 |
|
601 |
1.1 2.2 3.3 4.4 |
|
602 |
1.1 |
|
609 |
1.1 |
|
610 |
1.1 2.2 |
|
611 |
1.1 |
|
612 |
1.1 |
|
619 |
1.1 |
|
629 |
1.1 |
|
630 |
1.1 |
|
631 |
1.1 |
|
632 |
1.1 |
|
634 |
1.1 2.2 |
|
635 |
1.1 |
|
636 |
1.1 |
|
639 |
1.1 |
|
640 |
1.1 2.2 |
|
643 |
1.1 |
|
645 |
1.1 |
|
646 |
1.1 2.2 |
|
648 |
1.1 |
|
650 |
1.1 2.2 |
|
651 |
1.1 |
|
653 |
1.1 |
|
655 |
1.1 |
|
661 |
1.1 |