KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jxl > read > biff > HorizontalPageBreaksRecord


1 /*********************************************************************
2 *
3 * Copyright (C) 2002 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.read.biff;
21
22 import common.Logger;
23
24 import jxl.biff.IntegerHelper;
25 import jxl.biff.RecordData;
26
27 /**
28  * Contains the cell dimensions of this worksheet
29  */

30 class HorizontalPageBreaksRecord extends RecordData
31 {
32   /**
33    * The logger
34    */

35   private final Logger logger = Logger.getLogger
36     (HorizontalPageBreaksRecord.class);
37
38   /**
39    * The row page breaks
40    */

41   private int[] rowBreaks;
42
43   /**
44    * Dummy indicators for overloading the constructor
45    */

46   private static class Biff7 {};
47   public static Biff7 biff7 = new Biff7();
48
49   /**
50    * Constructs the dimensions from the raw data
51    *
52    * @param t the raw data
53    */

54   public HorizontalPageBreaksRecord(Record t)
55   {
56     super(t);
57
58     byte[] data = t.getData();
59
60     int numbreaks = IntegerHelper.getInt(data[0], data[1]);
61     int pos = 2;
62     rowBreaks = new int[numbreaks];
63
64     for (int i = 0; i < numbreaks; i++)
65     {
66       rowBreaks[i] = IntegerHelper.getInt(data[pos], data[pos + 1]);
67       pos += 2;
68     }
69   }
70
71   /**
72    * Constructs the dimensions from the raw data
73    *
74    * @param t the raw data
75    * @param biff7 an indicator to initialise this record for biff 7 format
76    */

77   public HorizontalPageBreaksRecord(Record t, Biff7 biff7)
78   {
79     super(t);
80
81     byte[] data = t.getData();
82     int numbreaks = IntegerHelper.getInt(data[0], data[1]);
83     int pos = 2;
84     rowBreaks = new int[numbreaks];
85     for (int i = 0; i < numbreaks; i++)
86     {
87       rowBreaks[i] = IntegerHelper.getInt(data[pos], data[pos + 1]);
88       pos += 2;
89     }
90   }
91
92   /**
93    * Gets the row breaks
94    *
95    * @return the row breaks on the current sheet
96    */

97   public int[] getRowBreaks()
98   {
99     return rowBreaks;
100   }
101 }
102
103
104
105
106
107
108
109
Popular Tags