summaryrefslogtreecommitdiffstats
path: root/src/contrib
diff options
context:
space:
mode:
authorAndrew C. Oliver <acoliver@apache.org>2002-07-04 14:26:42 +0000
committerAndrew C. Oliver <acoliver@apache.org>2002-07-04 14:26:42 +0000
commit3d9d57048909995d1cc0b1203623a6fb7aa0a08e (patch)
tree046d53d3cc812a5aad0f123444e23174b7a207ad /src/contrib
parentdc108217817f035e618b45fb1d811b9ff88f5cc7 (diff)
downloadpoi-3d9d57048909995d1cc0b1203623a6fb7aa0a08e.tar.gz
poi-3d9d57048909995d1cc0b1203623a6fb7aa0a08e.zip
made hair border render correctly
PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352753 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/contrib')
-rw-r--r--src/contrib/src/org/apache/poi/hssf/contrib/view/SVBorder.java68
1 files changed, 46 insertions, 22 deletions
diff --git a/src/contrib/src/org/apache/poi/hssf/contrib/view/SVBorder.java b/src/contrib/src/org/apache/poi/hssf/contrib/view/SVBorder.java
index ec1df74eb1..edec319ef6 100644
--- a/src/contrib/src/org/apache/poi/hssf/contrib/view/SVBorder.java
+++ b/src/contrib/src/org/apache/poi/hssf/contrib/view/SVBorder.java
@@ -68,8 +68,8 @@ public class SVBorder extends AbstractBorder {
if (northBorder &&
((northBorderType == HSSFCellStyle.BORDER_THIN) ||
(northBorderType == HSSFCellStyle.BORDER_MEDIUM) ||
- (northBorderType == HSSFCellStyle.BORDER_THICK) ||
- (northBorderType == HSSFCellStyle.BORDER_HAIR))
+ (northBorderType == HSSFCellStyle.BORDER_THICK)
+ )
) {
int thickness = getThickness(northBorderType);
@@ -84,15 +84,12 @@ public class SVBorder extends AbstractBorder {
if (eastBorder &&
((eastBorderType == HSSFCellStyle.BORDER_THIN) ||
(eastBorderType == HSSFCellStyle.BORDER_MEDIUM) ||
- (eastBorderType == HSSFCellStyle.BORDER_THICK) ||
- (eastBorderType == HSSFCellStyle.BORDER_HAIR))
+ (eastBorderType == HSSFCellStyle.BORDER_THICK)
+ )
) {
int thickness = getThickness(eastBorderType);
- if (eastBorderType == HSSFCellStyle.BORDER_HAIR)
- thickness++;
-
g.setColor(eastColor);
for (int k=0; k < thickness; k++) {
@@ -103,15 +100,12 @@ public class SVBorder extends AbstractBorder {
if (southBorder &&
((southBorderType == HSSFCellStyle.BORDER_THIN) ||
(southBorderType == HSSFCellStyle.BORDER_MEDIUM) ||
- (southBorderType == HSSFCellStyle.BORDER_THICK) ||
- (southBorderType == HSSFCellStyle.BORDER_HAIR))
+ (southBorderType == HSSFCellStyle.BORDER_THICK)
+ )
) {
int thickness = getThickness(southBorderType);
- if (southBorderType == HSSFCellStyle.BORDER_HAIR)
- thickness++;
-
g.setColor(southColor);
for (int k=0; k < thickness; k++) {
g.drawLine(x,height - k,width,height - k);
@@ -121,8 +115,8 @@ public class SVBorder extends AbstractBorder {
if (westBorder &&
((westBorderType == HSSFCellStyle.BORDER_THIN) ||
(westBorderType == HSSFCellStyle.BORDER_MEDIUM) ||
- (westBorderType == HSSFCellStyle.BORDER_THICK) ||
- (westBorderType == HSSFCellStyle.BORDER_HAIR))
+ (westBorderType == HSSFCellStyle.BORDER_THICK)
+ )
) {
int thickness = getThickness(westBorderType);
@@ -201,60 +195,87 @@ public class SVBorder extends AbstractBorder {
private void paintDashedBorders(Graphics g, int x, int y, int width,
int height) {
if (northBorder &&
- northBorderType == HSSFCellStyle.BORDER_DASHED) {
+ ((northBorderType == HSSFCellStyle.BORDER_DASHED) ||
+ (northBorderType == HSSFCellStyle.BORDER_HAIR))
+ ) {
int thickness = getThickness(northBorderType);
+ int dashlength = 1;
+
+ if (northBorderType == HSSFCellStyle.BORDER_DASHED)
+ dashlength = 2;
+
g.setColor(northColor);
for (int k=0; k < thickness; k++) {
for (int xc = x; xc < width; xc=xc+5) {
- g.drawLine(xc,y+k,xc+2,y+k);
+ g.drawLine(xc,y+k,xc+dashlength,y+k);
}
}
}
if (eastBorder &&
- eastBorderType == HSSFCellStyle.BORDER_DASHED
+ ((eastBorderType == HSSFCellStyle.BORDER_DASHED) ||
+ (eastBorderType == HSSFCellStyle.BORDER_HAIR))
) {
int thickness = getThickness(eastBorderType);
thickness++; //need for dotted borders to show up east
+
+ int dashlength = 1;
+
+ if (eastBorderType == HSSFCellStyle.BORDER_DASHED)
+ dashlength = 2;
+
g.setColor(eastColor);
for (int k=0; k < thickness; k++) {
for (int yc=y;yc < height; yc=yc+5) {
- g.drawLine(width-k,yc,width-k,yc+2);
+ g.drawLine(width-k,yc,width-k,yc+dashlength);
}
}
}
if (southBorder &&
- southBorderType == HSSFCellStyle.BORDER_DASHED
+ ((southBorderType == HSSFCellStyle.BORDER_DASHED) ||
+ (southBorderType == HSSFCellStyle.BORDER_HAIR))
) {
int thickness = getThickness(southBorderType);
thickness++;
+
+ int dashlength = 1;
+
+ if (southBorderType == HSSFCellStyle.BORDER_DASHED)
+ dashlength = 2;
+
g.setColor(southColor);
for (int k=0; k < thickness; k++) {
for (int xc = x; xc < width; xc=xc+5) {
- g.drawLine(xc,height-k,xc+2,height-k);
+ g.drawLine(xc,height-k,xc+dashlength,height-k);
}
}
}
if (westBorder &&
- westBorderType == HSSFCellStyle.BORDER_DASHED
+ ((westBorderType == HSSFCellStyle.BORDER_DASHED) ||
+ (westBorderType == HSSFCellStyle.BORDER_HAIR))
) {
int thickness = getThickness(westBorderType);
// thickness++;
+ int dashlength = 1;
+
+ if (westBorderType == HSSFCellStyle.BORDER_DASHED)
+ dashlength = 2;
+
g.setColor(westColor);
for (int k=0; k < thickness; k++) {
for (int yc=y;yc < height; yc=yc+5) {
- g.drawLine(x+k,yc,x+k,yc+2);
+ g.drawLine(x+k,yc,x+k,yc+dashlength);
}
}
}
@@ -272,6 +293,9 @@ public class SVBorder extends AbstractBorder {
case HSSFCellStyle.BORDER_THICK:
retval=4;
break;
+ case HSSFCellStyle.BORDER_DASHED:
+ retval=1;
+ break;
case HSSFCellStyle.BORDER_HAIR:
retval=1;
break;