1 19 20 package jxl.biff; 21 22 import common.Logger; 23 24 import jxl.Range; 25 import jxl.Cell; 26 import jxl.Sheet; 27 import jxl.biff.formula.ExternalSheet; 28 29 36 public class RangeImpl implements Range 37 { 38 41 private static Logger logger = Logger.getLogger(RangeImpl.class); 42 43 46 private WorkbookMethods workbook; 47 48 51 private int sheet1; 52 53 56 private int column1; 57 58 61 private int row1; 62 63 66 private int sheet2; 67 68 71 private int column2; 72 73 76 private int row2; 77 78 89 public RangeImpl(WorkbookMethods w, 90 int s1, int c1, int r1, 91 int s2, int c2, int r2) 92 { 93 workbook = w; 94 sheet1 = s1; 95 sheet2 = s2; 96 row1 = r1; 97 row2 = r2; 98 column1 = c1; 99 column2 = c2; 100 } 101 102 107 public Cell getTopLeft() 108 { 109 Sheet s = workbook.getReadSheet(sheet1); 110 111 if (column1 < s.getColumns() && 112 row1 < s.getRows()) 113 { 114 return s.getCell(column1, row1); 115 } 116 else 117 { 118 return new EmptyCell(column1, row1); 119 } 120 } 121 122 127 public Cell getBottomRight() 128 { 129 Sheet s = workbook.getReadSheet(sheet2); 130 131 if (column2 < s.getColumns() && 132 row2 < s.getRows()) 133 { 134 return s.getCell(column2, row2); 135 } 136 else 137 { 138 return new EmptyCell(column2, row2); 139 } 140 } 141 142 147 public int getFirstSheetIndex() 148 { 149 return sheet1; 150 } 151 152 157 public int getLastSheetIndex() 158 { 159 return sheet2; 160 } 161 } 162 163 164 165 166 167 168 169 170 171 | Popular Tags |