KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jxl > CellReferenceHelper


1 /*********************************************************************
2 *
3 * Copyright (C) 2003 Andrew Khan
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 ***************************************************************************/

19
20 package jxl;
21
22 import jxl.write.WritableWorkbook;
23 /**
24  * Exposes some cell reference helper methods to the public interface.
25  * This class merely delegates to the internally used reference helper
26  */

27 public final class CellReferenceHelper
28 {
29   /**
30    * Hide the default constructor
31    */

32   private CellReferenceHelper()
33   {
34   }
35
36   /**
37    * Appends the cell reference for the column and row passed in to the string
38    * buffer
39    *
40    * @param column the column
41    * @param row the row
42    * @param buf the string buffer to append
43    */

44   public static void getCellReference(int column, int row, StringBuffer JavaDoc buf)
45   {
46     jxl.biff.CellReferenceHelper.getCellReference(column, row, buf);
47   }
48
49   /**
50    * Overloaded method which prepends $ for absolute reference
51    *
52    * @param column
53    * @param colabs TRUE if the column reference is absolute
54    * @param row
55    * @param rowabs TRUE if the row reference is absolute
56    * @param buf
57    */

58   public static void getCellReference(int column, boolean colabs,
59                                       int row, boolean rowabs,
60                                       StringBuffer JavaDoc buf)
61   {
62     jxl.biff.CellReferenceHelper.getCellReference(column, colabs,
63                                                   row, rowabs,
64                                                   buf);
65   }
66
67
68   /**
69    * Gets the cell reference for the specified column and row
70    *
71    * @param column the column
72    * @param row the row
73    * @return the cell reference
74    */

75   public static String JavaDoc getCellReference(int column, int row)
76   {
77     return jxl.biff.CellReferenceHelper.getCellReference(column, row);
78   }
79
80   /**
81    * Gets the columnn number of the string cell reference
82    *
83    * @param s the string to parse
84    * @return the column portion of the cell reference
85    */

86   public static int getColumn(String JavaDoc s)
87   {
88     return jxl.biff.CellReferenceHelper.getColumn(s);
89   }
90
91   /**
92    * Gets the column letter corresponding to the 0-based column number
93    *
94    * @param c the column number
95    * @return the letter for that column number
96    */

97   public static String JavaDoc getColumnReference(int c)
98   {
99     return jxl.biff.CellReferenceHelper.getColumnReference(c);
100   }
101
102   /**
103    * Gets the row number of the cell reference
104    * @param s the cell reference
105    * @return the row number
106    */

107   public static int getRow(String JavaDoc s)
108   {
109     return jxl.biff.CellReferenceHelper.getRow(s);
110   }
111
112   /**
113    * Sees if the column component is relative or not
114    *
115    * @param s the cell
116    * @return TRUE if the column is relative, FALSE otherwise
117    */

118   public static boolean isColumnRelative(String JavaDoc s)
119   {
120     return jxl.biff.CellReferenceHelper.isColumnRelative(s);
121   }
122
123   /**
124    * Sees if the row component is relative or not
125    *
126    * @param s the cell
127    * @return TRUE if the row is relative, FALSE otherwise
128    */

129   public static boolean isRowRelative(String JavaDoc s)
130   {
131     return jxl.biff.CellReferenceHelper.isRowRelative(s);
132   }
133
134   /**
135    * Gets the fully qualified cell reference given the column, row
136    * external sheet reference etc
137    *
138    * @param sheet the sheet index
139    * @param column the column index
140    * @param row the row index
141    * @param workbook the workbook
142    * @param buf a string buffer
143    */

144   public static void getCellReference
145     (int sheet, int column, int row,
146      Workbook workbook, StringBuffer JavaDoc buf)
147   {
148     jxl.biff.CellReferenceHelper.getCellReference
149       (sheet, column, row, (jxl.biff.formula.ExternalSheet) workbook, buf);
150   }
151
152   /**
153    * Gets the fully qualified cell reference given the column, row
154    * external sheet reference etc
155    *
156    * @param sheet
157    * @param column
158    * @param row
159    * @param workbook
160    * @param buf
161    */

162   public static void getCellReference
163     (int sheet, int column, int row,
164      WritableWorkbook workbook, StringBuffer JavaDoc buf)
165   {
166     jxl.biff.CellReferenceHelper.getCellReference
167       (sheet, column, row, (jxl.biff.formula.ExternalSheet)workbook, buf);
168   }
169
170   /**
171    * Gets the fully qualified cell reference given the column, row
172    * external sheet reference etc
173    *
174    * @param sheet
175    * @param column
176    * @param colabs TRUE if the column is an absolute reference
177    * @param row
178    * @param rowabs TRUE if the row is an absolute reference
179    * @param workbook
180    * @param buf
181    */

182   public static void getCellReference
183     (int sheet, int column, boolean colabs,
184      int row, boolean rowabs,
185      Workbook workbook, StringBuffer JavaDoc buf)
186   {
187     jxl.biff.CellReferenceHelper.getCellReference
188       (sheet, column, colabs, row, rowabs,
189        (jxl.biff.formula.ExternalSheet)workbook, buf);
190   }
191
192   /**
193    * Gets the fully qualified cell reference given the column, row
194    * external sheet reference etc
195    *
196    * @param sheet
197    * @param column
198    * @param row
199    * @param workbook
200    * @return the cell reference in the form 'Sheet 1'!A1
201    */

202   public static String JavaDoc getCellReference
203     (int sheet, int column, int row,
204      Workbook workbook)
205   {
206     return jxl.biff.CellReferenceHelper.getCellReference
207       (sheet, column, row, (jxl.biff.formula.ExternalSheet)workbook);
208   }
209
210   /**
211    * Gets the fully qualified cell reference given the column, row
212    * external sheet reference etc
213    *
214    * @param sheet
215    * @param column
216    * @param row
217    * @param workbook
218    * @return the cell reference in the form 'Sheet 1'!A1
219    */

220   public static String JavaDoc getCellReference
221     (int sheet, int column, int row,
222      WritableWorkbook workbook)
223   {
224     return jxl.biff.CellReferenceHelper.getCellReference
225       (sheet, column, row, (jxl.biff.formula.ExternalSheet)workbook);
226   }
227
228
229
230 }
231
Popular Tags