KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > hdf > model > hdftypes > TableCellDescriptor


1
2 /* ====================================================================
3    Copyright 2002-2004 Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16 ==================================================================== */

17         
18
19
20 package org.apache.poi.hdf.model.hdftypes;
21
22 import org.apache.poi.hdf.model.hdftypes.definitions.TCAbstractType;
23 import org.apache.poi.util.LittleEndian;
24 /**
25  * Comment me
26  *
27  * @author Ryan Ackley
28  */

29
30 public class TableCellDescriptor extends TCAbstractType implements HDFType
31 {
32
33   /*boolean _fFirstMerged;
34   boolean _fMerged;
35   boolean _fVertical;
36   boolean _fBackward;
37   boolean _fRotateFont;
38   boolean _fVertMerge;
39   boolean _fVertRestart;
40   short _vertAlign;
41   short[] _brcTop = new short[2];
42   short[] _brcLeft = new short[2];
43   short[] _brcBottom = new short[2];
44   short[] _brcRight = new short [2];*/

45
46   public TableCellDescriptor()
47   {
48   }
49   static TableCellDescriptor convertBytesToTC(byte[] array, int offset)
50   {
51     TableCellDescriptor tc = new TableCellDescriptor();
52     int rgf = LittleEndian.getShort(array, offset);
53     tc.setFFirstMerged((rgf & 0x0001) > 0);
54     tc.setFMerged((rgf & 0x0002) > 0);
55     tc.setFVertical((rgf & 0x0004) > 0);
56     tc.setFBackward((rgf & 0x0008) > 0);
57     tc.setFRotateFont((rgf & 0x0010) > 0);
58     tc.setFVertMerge((rgf & 0x0020) > 0);
59     tc.setFVertRestart((rgf & 0x0040) > 0);
60     tc.setVertAlign((byte)((rgf & 0x0180) >> 7));
61
62     short[] brcTop = new short[2];
63     short[] brcLeft = new short[2];
64     short[] brcBottom = new short[2];
65     short[] brcRight = new short[2];
66
67     brcTop[0] = LittleEndian.getShort(array, offset + 4);
68     brcTop[1] = LittleEndian.getShort(array, offset + 6);
69
70     brcLeft[0] = LittleEndian.getShort(array, offset + 8);
71     brcLeft[1] = LittleEndian.getShort(array, offset + 10);
72
73     brcBottom[0] = LittleEndian.getShort(array, offset + 12);
74     brcBottom[1] = LittleEndian.getShort(array, offset + 14);
75
76     brcRight[0] = LittleEndian.getShort(array, offset + 16);
77     brcRight[1] = LittleEndian.getShort(array, offset + 18);
78
79     return tc;
80   }
81
82 }
83
Popular Tags