poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1691075 - in /poi/trunk/src/java/org/apache/poi/hssf/usermodel: HSSFBorderFormatting.java HSSFConditionalFormattingRule.java
Date Tue, 14 Jul 2015 20:36:10 GMT
Author: nick
Date: Tue Jul 14 20:36:10 2015
New Revision: 1691075

URL: http://svn.apache.org/r1691075
Log:
Prepare HSSFBorderFormatting for #58138

Modified:
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFBorderFormatting.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFBorderFormatting.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFBorderFormatting.java?rev=1691075&r1=1691074&r2=1691075&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFBorderFormatting.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFBorderFormatting.java Tue Jul 14
20:36:10 2015
@@ -19,193 +19,164 @@ package org.apache.poi.hssf.usermodel;
 
 import org.apache.poi.hssf.record.CFRuleBase;
 import org.apache.poi.hssf.record.cf.BorderFormatting;
+import org.apache.poi.hssf.util.HSSFColor;
 
 /**
  * High level representation for Border Formatting component
  * of Conditional Formatting settings
  */
-public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.BorderFormatting
-{
+public final class HSSFBorderFormatting implements org.apache.poi.ss.usermodel.BorderFormatting
{
+    private final HSSFWorkbook workbook;
 	private final CFRuleBase cfRuleRecord;
 	private final BorderFormatting borderFormatting;
 	
-	protected HSSFBorderFormatting(CFRuleBase cfRuleRecord)
-	{
+	protected HSSFBorderFormatting(CFRuleBase cfRuleRecord, HSSFWorkbook workbook) {
+	    this.workbook = workbook;
 		this.cfRuleRecord = cfRuleRecord;
 		this.borderFormatting = cfRuleRecord.getBorderFormatting();
 	}
 
-	protected BorderFormatting getBorderFormattingBlock()
-	{
+	protected BorderFormatting getBorderFormattingBlock() {
 		return borderFormatting;
 	}
 
-	public short getBorderBottom()
-	{
+	public short getBorderBottom() {
 		return (short)borderFormatting.getBorderBottom();
 	}
 
-	public short getBorderDiagonal()
-	{
+	public short getBorderDiagonal() {
 		return (short)borderFormatting.getBorderDiagonal();
 	}
 
-	public short getBorderLeft()
-	{
+	public short getBorderLeft() {
 		return (short)borderFormatting.getBorderLeft();
 	}
 
-	public short getBorderRight()
-	{
+	public short getBorderRight() {
 		return (short)borderFormatting.getBorderRight();
 	}
 
-	public short getBorderTop()
-	{
+	public short getBorderTop() {
 		return (short)borderFormatting.getBorderTop();
 	}
 
-	public short getBottomBorderColor()
-	{
+	public short getBottomBorderColor() {
 		return (short)borderFormatting.getBottomBorderColor();
 	}
+    public HSSFColor getBottomBorderColorColor() {
+        return workbook.getCustomPalette().getColor(
+                borderFormatting.getBottomBorderColor()
+        );
+    }
 
-	public short getDiagonalBorderColor()
-	{
+	public short getDiagonalBorderColor() {
 		return (short)borderFormatting.getDiagonalBorderColor();
 	}
 
-	public short getLeftBorderColor()
-	{
+	public short getLeftBorderColor() {
 		return (short)borderFormatting.getLeftBorderColor();
 	}
 
-	public short getRightBorderColor()
-	{
+	public short getRightBorderColor() {
 		return (short)borderFormatting.getRightBorderColor();
 	}
 
-	public short getTopBorderColor()
-	{
+	public short getTopBorderColor() {
 		return (short)borderFormatting.getTopBorderColor();
 	}
 
-	public boolean isBackwardDiagonalOn()
-	{
+	public boolean isBackwardDiagonalOn() {
 		return borderFormatting.isBackwardDiagonalOn();
 	}
 
-	public boolean isForwardDiagonalOn()
-	{
+	public boolean isForwardDiagonalOn() {
 		return borderFormatting.isForwardDiagonalOn();
 	}
 
-	public void setBackwardDiagonalOn(boolean on)
-	{
+	public void setBackwardDiagonalOn(boolean on) {
 		borderFormatting.setBackwardDiagonalOn(on);
-		if( on )
-		{
+		if( on ) {
 			cfRuleRecord.setTopLeftBottomRightBorderModified(on);
 		}
 	}
 
-	public void setBorderBottom(short border)
-	{
+	public void setBorderBottom(short border) {
 		borderFormatting.setBorderBottom(border);
-		if( border != 0)
-		{
+		if( border != 0) {
 			cfRuleRecord.setBottomBorderModified(true);
-		}
+		} else {
+			cfRuleRecord.setBottomBorderModified(false);
+      }
 	}
 
-	public void setBorderDiagonal(short border)
-	{
+	public void setBorderDiagonal(short border) {
 		borderFormatting.setBorderDiagonal(border);
-		if( border != 0)
-		{
+		if( border != 0) {
 			cfRuleRecord.setBottomLeftTopRightBorderModified(true);
 			cfRuleRecord.setTopLeftBottomRightBorderModified(true);
 		}
 	}
 
-	public void setBorderLeft(short border)
-	{
+	public void setBorderLeft(short border) {
 		borderFormatting.setBorderLeft(border);
-		if( border != 0)
-		{
+		if( border != 0) {
 			cfRuleRecord.setLeftBorderModified(true);
 		}
 	}
 
-	public void setBorderRight(short border)
-	{
+	public void setBorderRight(short border) {
 		borderFormatting.setBorderRight(border);
-		if( border != 0)
-		{
+		if( border != 0) {
 			cfRuleRecord.setRightBorderModified(true);
 		}
 	}
 
-	public void setBorderTop(short border)
-	{
+	public void setBorderTop(short border) {
 		borderFormatting.setBorderTop(border);
-		if( border != 0)
-		{
+		if( border != 0) {
 			cfRuleRecord.setTopBorderModified(true);
 		}
 	}
 
-	public void setBottomBorderColor(short color)
-	{
+	public void setBottomBorderColor(short color) {
 		borderFormatting.setBottomBorderColor(color);
-		if( color != 0)
-		{
+		if( color != 0) {
 			cfRuleRecord.setBottomBorderModified(true);
 		}
 	}
 
-	public void setDiagonalBorderColor(short color)
-	{
+	public void setDiagonalBorderColor(short color) {
 		borderFormatting.setDiagonalBorderColor(color);
-		if( color != 0)
-		{
+		if( color != 0) {
 			cfRuleRecord.setBottomLeftTopRightBorderModified(true);
 			cfRuleRecord.setTopLeftBottomRightBorderModified(true);
 		}
 	}
 
-	public void setForwardDiagonalOn(boolean on)
-	{
+	public void setForwardDiagonalOn(boolean on) {
 		borderFormatting.setForwardDiagonalOn(on);
-		if( on )
-		{
+		if( on ) {
 			cfRuleRecord.setBottomLeftTopRightBorderModified(on);
 		}
 	}
 
-	public void setLeftBorderColor(short color)
-	{
+	public void setLeftBorderColor(short color) {
 		borderFormatting.setLeftBorderColor(color);
-		if( color != 0)
-		{
+		if( color != 0) {
 			cfRuleRecord.setLeftBorderModified(true);
 		}
 	}
 
-	public void setRightBorderColor(short color)
-	{
+	public void setRightBorderColor(short color) {
 		borderFormatting.setRightBorderColor(color);
-		if( color != 0)
-		{
+		if( color != 0) {
 			cfRuleRecord.setRightBorderModified(true);
 		}
 	}
 
-	public void setTopBorderColor(short color)
-	{
+	public void setTopBorderColor(short color) {
 		borderFormatting.setTopBorderColor(color);
-		if( color != 0)
-		{
+		if( color != 0) {
 			cfRuleRecord.setTopBorderModified(true);
 		}
 	}

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java?rev=1691075&r1=1691074&r2=1691075&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFConditionalFormattingRule.java Tue
Jul 14 20:36:10 2015
@@ -99,13 +99,13 @@ public final class HSSFConditionalFormat
         if ( borderFormatting != null)
         {
             cfRuleRecord.setBorderFormatting(borderFormatting);
-            return new HSSFBorderFormatting(cfRuleRecord);
+            return new HSSFBorderFormatting(cfRuleRecord, workbook);
         }
         else if( create )
         {
             borderFormatting = new BorderFormatting();
             cfRuleRecord.setBorderFormatting(borderFormatting);
-            return new HSSFBorderFormatting(cfRuleRecord);
+            return new HSSFBorderFormatting(cfRuleRecord, workbook);
         }
         else
         {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message