public float getAnchorHeightInPoints(HSSFSheet sheet) {
int y1 = getDy1();
int y2 = getDy2();
int row1 = Math.min( getRow1(), getRow2() );
int row2 = Math.max( getRow1(), getRow2() );
float points = 0;
if (row1 == row2)
{
points = ((y2 - y1) / 256.0f) * getRowHeightInPoints(sheet, row2);
}
else
{
points += ((256.0f - y1) / 256.0f) * getRowHeightInPoints(sheet, row1);
for (int i = row1 + 1; i < row2; i++)
{
points += getRowHeightInPoints(sheet, i);
}
points += (y2 / 256.0f) * getRowHeightInPoints(sheet, row2);
}
return points;
}
Calculates the height of a client anchor in points. |
public void setAnchor(short col1,
int row1,
int x1,
int y1,
short col2,
int row2,
int x2,
int y2) {
checkRange(dx1, 0, 1023, "dx1");
checkRange(dx2, 0, 1023, "dx2");
checkRange(dy1, 0, 255, "dy1");
checkRange(dy2, 0, 255, "dy2");
checkRange(col1, 0, 255, "col1");
checkRange(col2, 0, 255, "col2");
checkRange(row1, 0, 255 * 256, "row1");
checkRange(row2, 0, 255 * 256, "row2");
this.col1 = col1;
this.row1 = row1;
this.dx1 = x1;
this.dy1 = y1;
this.col2 = col2;
this.row2 = row2;
this.dx2 = x2;
this.dy2 = y2;
}
Dets the top-left and bottom-right
coordinates of the anchor. |