1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.millscript.office.excel.records;
22
23 import org.millscript.office.excel.Record;
24 import org.millscript.office.excel.RecordParser;
25 import org.millscript.office.excel.records.substructures.CellAttributes;
26
27 /**
28 *
29 */
30 public class Row extends Record {
31
32 private CellAttributes defaultRowAttributes;
33
34 private int indexOfFirstCell;
35
36 private int indexOfLastCell;
37
38 private int indexOfThisRow;
39
40 private int indexToXFRecord;
41
42 private int rowOptions;
43
44 private int relativeOffsetToFirstCell;
45
46 private int rowHeight;
47
48 public Row( final int row, final int firstCell, final int lastCell ) {
49 this.indexOfThisRow = row;
50 this.indexOfFirstCell = firstCell;
51 this.indexOfLastCell = lastCell;
52 }
53
54 public boolean additionalSpaceAboveTheRow() {
55 return 0 != ( this.rowOptions & 0x10000000 );
56 }
57
58 public boolean additionalSpaceBelowTheRow() {
59 return 0 != ( this.rowOptions & 0x20000000 );
60 }
61
62 public int getIndexToXFRecord() {
63 if ( this.rowHasExplicitDefaultFormat() ) {
64 return ( this.rowOptions & 0x0FFF0000 ) >> 16;
65 } else {
66 return -1;
67 }
68 }
69
70 public byte getOutlineLevel() {
71 return (byte) ( this.rowOptions & 0x00000007 );
72 }
73
74 /**
75 * @see org.millscript.office.excel.Record#handle(org.millscript.office.excel.RecordParser)
76 */
77 @Override
78 public void handle( final RecordParser recordParser ) {
79
80 recordParser.getCurrentWorksheet().initialiseRow( this.indexOfThisRow + 1, this.indexOfLastCell + 1 );
81 }
82
83 public boolean outlineGroupEdgeHereAndIsCollapsed() {
84 return 0 != ( this.rowOptions & 0x00000010 );
85 }
86
87 public boolean rowIsHidden() {
88 return 0 != ( this.rowOptions & 0x00000020 );
89 }
90
91 public boolean rowHasExplicitDefaultFormat() {
92 return 0 != ( this.rowOptions & 0x00000080 );
93 }
94
95 public boolean rowHeightAndDefaultFontHeightDoNotMatch() {
96 return 0 != ( this.rowOptions & 0x00000040 );
97 }
98
99 /**
100 * @param defaults The defaultRowAttributes to set.
101 */
102 public void setDefaultRowAttributes( final CellAttributes defaults ) {
103 this.defaultRowAttributes = defaults;
104 }
105
106 /**
107 * @param index The indexToXFRecord to set.
108 */
109 public void setIndexToXFRecord( final int index ) {
110 this.indexToXFRecord = index;
111 }
112
113 /**
114 * @param options The options to set.
115 */
116 public void setOptions( final int options ) {
117 this.rowOptions = options;
118 }
119
120 /**
121 * @param offset The relativeOffsetToFirstCell to set.
122 */
123 public void setRelativeOffsetToFirstCell( final int offset ) {
124 this.relativeOffsetToFirstCell = offset;
125 }
126
127 /**
128 * @param height The rowHeight to set.
129 */
130 public void setRowHeight( final int height ) {
131 this.rowHeight = height;
132 }
133
134 }