1 16 17 package org.apache.poi.hssf.usermodel; 18 19 24 public abstract class HSSFShape 25 { 26 public static final int LINEWIDTH_ONE_PT = 12700; 27 public static final int LINEWIDTH_DEFAULT = 9525; 28 29 public static final int LINESTYLE_SOLID = 0; public static final int LINESTYLE_DASHSYS = 1; public static final int LINESTYLE_DOTSYS = 2; public static final int LINESTYLE_DASHDOTSYS = 3; public static final int LINESTYLE_DASHDOTDOTSYS = 4; public static final int LINESTYLE_DOTGEL = 5; public static final int LINESTYLE_DASHGEL = 6; public static final int LINESTYLE_LONGDASHGEL = 7; public static final int LINESTYLE_DASHDOTGEL = 8; public static final int LINESTYLE_LONGDASHDOTGEL = 9; public static final int LINESTYLE_LONGDASHDOTDOTGEL = 10; public static final int LINESTYLE_NONE = -1; 41 42 HSSFShape parent; 43 HSSFAnchor anchor; 44 int lineStyleColor = 0x08000040; 45 int fillColor = 0x08000009; 46 int lineWidth = LINEWIDTH_DEFAULT; int lineStyle = LINESTYLE_SOLID; 48 boolean noFill = false; 49 50 53 HSSFShape( HSSFShape parent, HSSFAnchor anchor ) 54 { 55 this.parent = parent; 56 this.anchor = anchor; 57 } 58 59 62 public HSSFShape getParent() 63 { 64 return parent; 65 } 66 67 70 public HSSFAnchor getAnchor() 71 { 72 return anchor; 73 } 74 75 86 public void setAnchor( HSSFAnchor anchor ) 87 { 88 if ( parent == null ) 89 { 90 if ( anchor instanceof HSSFChildAnchor ) 91 throw new IllegalArgumentException ( "Must use client anchors for shapes directly attached to sheet." ); 92 } 93 else 94 { 95 if ( anchor instanceof HSSFClientAnchor ) 96 throw new IllegalArgumentException ( "Must use child anchors for shapes attached to groups." ); 97 } 98 99 this.anchor = anchor; 100 } 101 102 105 public int getLineStyleColor() 106 { 107 return lineStyleColor; 108 } 109 110 113 public void setLineStyleColor( int lineStyleColor ) 114 { 115 this.lineStyleColor = lineStyleColor; 116 } 117 118 121 public void setLineStyleColor( int red, int green, int blue ) 122 { 123 this.lineStyleColor = ((blue) << 16) | ((green) << 8) | red; 124 } 125 126 129 public int getFillColor() 130 { 131 return fillColor; 132 } 133 134 137 public void setFillColor( int fillColor ) 138 { 139 this.fillColor = fillColor; 140 } 141 142 145 public void setFillColor( int red, int green, int blue ) 146 { 147 this.fillColor = ((blue) << 16) | ((green) << 8) | red; 148 } 149 150 153 public int getLineWidth() 154 { 155 return lineWidth; 156 } 157 158 165 public void setLineWidth( int lineWidth ) 166 { 167 this.lineWidth = lineWidth; 168 } 169 170 173 public int getLineStyle() 174 { 175 return lineStyle; 176 } 177 178 183 public void setLineStyle( int lineStyle ) 184 { 185 this.lineStyle = lineStyle; 186 } 187 188 191 public boolean isNoFill() 192 { 193 return noFill; 194 } 195 196 199 public void setNoFill( boolean noFill ) 200 { 201 this.noFill = noFill; 202 } 203 204 207 public int countOfAllChildren() 208 { 209 return 1; 210 } 211 } 212 | Popular Tags |