You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2016/06/04 22:53:01 UTC

svn commit: r1746856 [2/2] - in /poi: site/src/documentation/content/xdocs/ trunk/src/java/org/apache/poi/sl/draw/ trunk/src/java/org/apache/poi/sl/usermodel/ trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/ trunk/src/ooxml/testcases/org/apache/poi/...

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTableCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTableCell.java?rev=1746856&r1=1746855&r2=1746856&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTableCell.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTableCell.java Sat Jun  4 22:53:00 2016
@@ -33,8 +33,6 @@ import org.apache.poi.sl.usermodel.Table
 
 /**
  * Represents a cell in a ppt table
- *
- * @author Yegor Kozlov
  */
 public final class HSLFTableCell extends HSLFTextBox implements TableCell<HSLFShape,HSLFTextParagraph> {
     protected static final int DEFAULT_WIDTH = 100;
@@ -46,6 +44,16 @@ public final class HSLFTableCell extends
     /* package */ HSLFLine borderBottom;
 
     /**
+     * The number of columns to be spanned/merged
+     */
+    private int gridSpan = 1;
+
+    /**
+     * The number of columns to be spanned/merged
+     */
+    private int rowSpan = 1;
+
+    /**
      * Create a TableCell object and initialize it from the supplied Record container.
      *
      * @param escherRecord       EscherSpContainer which holds information about this shape
@@ -129,7 +137,7 @@ public final class HSLFTableCell extends
 
     @Override
     public StrokeStyle getBorderStyle(final BorderEdge edge) {
-        final Double width = getBorderWidth(edge); 
+        final Double width = getBorderWidth(edge);
         return (width == null) ? null : new StrokeStyle() {
             public PaintStyle getPaint() {
                 return DrawPaint.createSolidPaint(getBorderColor(edge));
@@ -158,24 +166,24 @@ public final class HSLFTableCell extends
         if (style == null) {
             throw new IllegalArgumentException("StrokeStyle needs to be specified.");
         }
-        
+
         // setting the line cap is not implemented, as the border lines aren't connected
-        
+
         LineCompound compound = style.getLineCompound();
         if (compound != null) {
             setBorderCompound(edge, compound);
         }
-        
+
         LineDash dash = style.getLineDash();
         if (dash != null) {
             setBorderDash(edge, dash);
         }
-        
+
         double width = style.getLineWidth();
         setBorderWidth(edge, width);
     }
 
-    
+
     public Double getBorderWidth(BorderEdge edge) {
         HSLFLine l;
         switch (edge) {
@@ -187,7 +195,7 @@ public final class HSLFTableCell extends
         }
         return (l == null) ? null : l.getLineWidth();
     }
-    
+
     @Override
     public void setBorderWidth(BorderEdge edge, double width) {
         HSLFLine l = addLine(edge);
@@ -211,7 +219,7 @@ public final class HSLFTableCell extends
         if (edge == null || color == null) {
             throw new IllegalArgumentException("BorderEdge and/or Color need to be specified.");
         }
-        
+
         HSLFLine l = addLine(edge);
         l.setLineColor(color);
     }
@@ -225,15 +233,15 @@ public final class HSLFTableCell extends
             case left: l = borderLeft; break;
             default: throw new IllegalArgumentException();
         }
-        return (l == null) ? null : l.getLineDash();        
+        return (l == null) ? null : l.getLineDash();
     }
-    
+
     @Override
     public void setBorderDash(BorderEdge edge, LineDash dash) {
         if (edge == null || dash == null) {
             throw new IllegalArgumentException("BorderEdge and/or LineDash need to be specified.");
         }
-        
+
         HSLFLine l = addLine(edge);
         l.setLineDash(dash);
     }
@@ -247,15 +255,15 @@ public final class HSLFTableCell extends
             case left: l = borderLeft; break;
             default: throw new IllegalArgumentException();
         }
-        return (l == null) ? null : l.getLineCompound();        
+        return (l == null) ? null : l.getLineCompound();
     }
-    
+
     @Override
     public void setBorderCompound(BorderEdge edge, LineCompound compound) {
         if (edge == null || compound == null) {
             throw new IllegalArgumentException("BorderEdge and/or LineCompound need to be specified.");
         }
-        
+
         HSLFLine l = addLine(edge);
         l.setLineCompound(compound);
     }
@@ -381,7 +389,7 @@ public final class HSLFTableCell extends
         setEscherProperty(opt, EscherProperties.THREED__LIGHTFACE, 0x80000);
 
         anchorBorder(edge, line);
-        
+
         return line;
     }
 
@@ -397,4 +405,43 @@ public final class HSLFTableCell extends
     public HSLFTable getParent() {
         return (HSLFTable)super.getParent();
     }
+
+    /**
+     * Set the gridSpan (aka col-span)
+     *
+     * @param gridSpan the number of columns to be spanned/merged
+     *
+     * @since POI 3.15-beta2
+     */
+    protected void setGridSpan(int gridSpan) {
+        this.gridSpan = gridSpan;
+    }
+
+    /**
+     * Set the rowSpan
+     *
+     * @param rowSpan the number of rows to be spanned/merged
+     *
+     * @since POI 3.15-beta2
+     */
+    protected void setRowSpan(int rowSpan) {
+        this.rowSpan = rowSpan;
+    }
+
+    @Override
+    public int getGridSpan() {
+        return gridSpan;
+    }
+
+    @Override
+    public int getRowSpan() {
+        return rowSpan;
+    }
+
+    @Override
+    public boolean isMerged() {
+        // if a hslf cell is merged, it won't appear in the cell matrix, i.e. it doesn't exist
+        // therefore this is always false 
+        return false;
+    }
 }



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