01: /* ====================================================================
02: Licensed to the Apache Software Foundation (ASF) under one or more
03: contributor license agreements. See the NOTICE file distributed with
04: this work for additional information regarding copyright ownership.
05: The ASF licenses this file to You under the Apache License, Version 2.0
06: (the "License"); you may not use this file except in compliance with
07: the License. You may obtain a copy of the License at
08:
09: 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: package org.apache.poi.hdf.extractor;
19:
20: /**
21: * Comment me
22: *
23: * @author Ryan Ackley
24: */
25:
26: public class TC {
27:
28: boolean _fFirstMerged;
29: boolean _fMerged;
30: boolean _fVertical;
31: boolean _fBackward;
32: boolean _fRotateFont;
33: boolean _fVertMerge;
34: boolean _fVertRestart;
35: short _vertAlign;
36: short[] _brcTop = new short[2];
37: short[] _brcLeft = new short[2];
38: short[] _brcBottom = new short[2];
39: short[] _brcRight = new short[2];
40:
41: public TC() {
42: }
43:
44: static TC convertBytesToTC(byte[] array, int offset) {
45: TC tc = new TC();
46: int rgf = Utils.convertBytesToShort(array, offset);
47: tc._fFirstMerged = (rgf & 0x0001) > 0;
48: tc._fMerged = (rgf & 0x0002) > 0;
49: tc._fVertical = (rgf & 0x0004) > 0;
50: tc._fBackward = (rgf & 0x0008) > 0;
51: tc._fRotateFont = (rgf & 0x0010) > 0;
52: tc._fVertMerge = (rgf & 0x0020) > 0;
53: tc._fVertRestart = (rgf & 0x0040) > 0;
54: tc._vertAlign = (short) ((rgf & 0x0180) >> 7);
55:
56: tc._brcTop[0] = Utils.convertBytesToShort(array, offset + 4);
57: tc._brcTop[1] = Utils.convertBytesToShort(array, offset + 6);
58:
59: tc._brcLeft[0] = Utils.convertBytesToShort(array, offset + 8);
60: tc._brcLeft[1] = Utils.convertBytesToShort(array, offset + 10);
61:
62: tc._brcBottom[0] = Utils
63: .convertBytesToShort(array, offset + 12);
64: tc._brcBottom[1] = Utils
65: .convertBytesToShort(array, offset + 14);
66:
67: tc._brcRight[0] = Utils.convertBytesToShort(array, offset + 16);
68: tc._brcRight[1] = Utils.convertBytesToShort(array, offset + 18);
69:
70: return tc;
71: }
72:
73: }
|