KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jxl > HeaderFooter


1 /*********************************************************************
2  *
3  * Copyright (C) 2002 Andrew Khan, Eric Jung
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 common.Assert;
23 import common.Logger;
24
25 /**
26  * Class which represents an Excel header or footer.
27  */

28 public final class HeaderFooter extends jxl.biff.HeaderFooter
29 {
30   /**
31    * The contents - a simple wrapper around a string buffer
32    */

33   public static class Contents extends jxl.biff.HeaderFooter.Contents
34   {
35     /**
36      * The constructor
37      */

38     Contents()
39     {
40       super();
41     }
42
43     /**
44      * Constructor used when reading worksheets. The string contains all
45      * the formatting (but not alignment characters
46      *
47      * @param s the format string
48      */

49     Contents(String JavaDoc s)
50     {
51       super(s);
52     }
53     
54     /**
55      * Copy constructor
56      *
57      * @param copy the contents to copy
58      */

59     Contents(Contents copy)
60     {
61       super(copy);
62     }
63     
64     /**
65      * Appends the text to the string buffer
66      *
67      * @param txt
68      */

69     public void append(String JavaDoc txt)
70     {
71       super.append(txt);
72     }
73     
74     /**
75      * Turns bold printing on or off. Bold printing
76      * is initially off. Text subsequently appended to
77      * this object will be bolded until this method is
78      * called again.
79      */

80     public void toggleBold()
81     {
82       super.toggleBold();
83     }
84
85     /**
86      * Turns underline printing on or off. Underline printing
87      * is initially off. Text subsequently appended to
88      * this object will be underlined until this method is
89      * called again.
90      */

91     public void toggleUnderline()
92     {
93       super.toggleUnderline();
94     }
95
96     /**
97      * Turns italics printing on or off. Italics printing
98      * is initially off. Text subsequently appended to
99      * this object will be italicized until this method is
100      * called again.
101      */

102     public void toggleItalics()
103     {
104       super.toggleItalics();
105     }
106
107     /**
108      * Turns strikethrough printing on or off. Strikethrough printing
109      * is initially off. Text subsequently appended to
110      * this object will be striked out until this method is
111      * called again.
112      */

113     public void toggleStrikethrough()
114     {
115       super.toggleStrikethrough();
116     }
117
118     /**
119      * Turns double-underline printing on or off. Double-underline printing
120      * is initially off. Text subsequently appended to
121      * this object will be double-underlined until this method is
122      * called again.
123      */

124     public void toggleDoubleUnderline()
125     {
126       super.toggleDoubleUnderline();
127     }
128
129     /**
130      * Turns superscript printing on or off. Superscript printing
131      * is initially off. Text subsequently appended to
132      * this object will be superscripted until this method is
133      * called again.
134      */

135     public void toggleSuperScript()
136     {
137       super.toggleSuperScript();
138     }
139
140     /**
141      * Turns subscript printing on or off. Subscript printing
142      * is initially off. Text subsequently appended to
143      * this object will be subscripted until this method is
144      * called again.
145      */

146     public void toggleSubScript()
147     {
148       super.toggleSubScript();
149     }
150     
151     /**
152      * Turns outline printing on or off (Macintosh only).
153      * Outline printing is initially off. Text subsequently appended
154      * to this object will be outlined until this method is
155      * called again.
156      */

157     public void toggleOutline()
158     {
159       super.toggleOutline();
160     }
161     
162     /**
163      * Turns shadow printing on or off (Macintosh only).
164      * Shadow printing is initially off. Text subsequently appended
165      * to this object will be shadowed until this method is
166      * called again.
167      */

168     public void toggleShadow()
169     {
170       super.toggleShadow();
171     }
172     
173     /**
174      * Sets the font of text subsequently appended to this
175      * object.. Previously appended text is not affected.
176      * <p/>
177      * <strong>Note:</strong> no checking is performed to
178      * determine if fontName is a valid font.
179      *
180      * @param fontName name of the font to use
181      */

182     public void setFontName(String JavaDoc fontName)
183     {
184       super.setFontName(fontName);
185     }
186
187     /**
188      * Sets the font size of text subsequently appended to this
189      * object. Previously appended text is not affected.
190      * <p/>
191      * Valid point sizes are between 1 and 99 (inclusive). If
192      * size is outside this range, this method returns false
193      * and does not change font size. If size is within this
194      * range, the font size is changed and true is returned.
195      *
196      * @param size The size in points. Valid point sizes are
197      * between 1 and 99 (inclusive).
198      * @return true if the font size was changed, false if font
199      * size was not changed because 1 > size > 99.
200      */

201     public boolean setFontSize(int size)
202     {
203       return super.setFontSize(size);
204     }
205   
206     /**
207      * Appends the page number
208      */

209     public void appendPageNumber()
210     {
211       super.appendPageNumber();
212     }
213   
214     /**
215      * Appends the total number of pages
216      */

217     public void appendTotalPages()
218     {
219       super.appendTotalPages();
220     }
221   
222     /**
223      * Appends the current date
224      */

225     public void appendDate()
226     {
227       super.appendDate();
228     }
229   
230     /**
231      * Appends the current time
232      */

233     public void appendTime()
234     {
235       super.appendTime();
236     }
237   
238     /**
239      * Appends the workbook name
240      */

241     public void appendWorkbookName()
242     {
243       super.appendWorkbookName();
244     }
245     
246     /**
247      * Appends the worksheet name
248      */

249     public void appendWorkSheetName()
250     {
251       super.appendWorkSheetName();
252     }
253
254     /**
255      * Clears the contents of this portion
256      */

257     public void clear()
258     {
259       super.clear();
260     }
261
262     /**
263      * Queries if the contents are empty
264      *
265      * @return TRUE if the contents are empty, FALSE otherwise
266      */

267     public boolean empty()
268     {
269       return super.empty();
270     }
271   }
272
273   /**
274    * Default constructor.
275    */

276   public HeaderFooter()
277   {
278     super();
279   }
280
281   /**
282    * Copy constructor
283    *
284    * @param c the item to copy
285    */

286   public HeaderFooter(HeaderFooter hf)
287   {
288     super(hf);
289   }
290
291   /**
292    * Constructor used when reading workbooks to separate the left, right
293    * a central part of the strings into their constituent parts
294    */

295   public HeaderFooter(String JavaDoc s)
296   {
297     super(s);
298   }
299
300   /**
301    * Retrieves a <code>String</code>ified
302    * version of this object
303    *
304    * @return the header string
305    */

306   public String JavaDoc toString()
307   {
308     return super.toString();
309   }
310
311   /**
312    * Accessor for the contents which appear on the right hand side of the page
313    *
314    * @return the right aligned contents
315    */

316   public Contents getRight()
317   {
318     return (Contents) super.getRightText();
319   }
320
321   /**
322    * Accessor for the contents which in the centre of the page
323    *
324    * @return the centrally aligned contents
325    */

326   public Contents getCentre()
327   {
328     return (Contents) super.getCentreText();
329   }
330
331   /**
332    * Accessor for the contents which appear on the left hand side of the page
333    *
334    * @return the left aligned contents
335    */

336   public Contents getLeft()
337   {
338     return (Contents) super.getLeftText();
339   }
340
341   /**
342    * Clears the contents of the header/footer
343    */

344   public void clear()
345   {
346     super.clear();
347   }
348
349   /**
350    * Creates internal class of the appropriate type
351    */

352   protected jxl.biff.HeaderFooter.Contents createContents()
353   {
354     return new Contents();
355   }
356
357   /**
358    * Creates internal class of the appropriate type
359    */

360   protected jxl.biff.HeaderFooter.Contents createContents(String JavaDoc s)
361   {
362     return new Contents(s);
363   }
364
365   /**
366    * Creates internal class of the appropriate type
367    */

368   protected jxl.biff.HeaderFooter.Contents
369     createContents(jxl.biff.HeaderFooter.Contents c)
370   {
371     return new Contents((Contents) c);
372   }
373 }
374
Popular Tags