1 19 20 package jxl.write.biff; 21 22 import jxl.SheetSettings; 23 24 import jxl.biff.Type; 25 import jxl.biff.IntegerHelper; 26 import jxl.biff.WritableRecordData; 27 28 31 class PaneRecord extends WritableRecordData 32 { 33 36 private int rowsVisible; 37 40 private int columnsVisible; 41 42 45 private final static int topLeftPane = 0x3; 46 private final static int bottomLeftPane = 0x2; 47 private final static int topRightPane = 0x1; 48 private final static int bottomRightPane = 0x0; 49 50 56 public PaneRecord(int cols, int rows) 57 { 58 super(Type.PANE); 59 60 rowsVisible = rows; 61 columnsVisible = cols; 62 } 63 64 69 public byte[] getData() 70 { 71 byte[] data = new byte[10]; 72 73 IntegerHelper.getTwoBytes(columnsVisible, data, 0); 75 76 IntegerHelper.getTwoBytes(rowsVisible, data, 2); 78 79 if (rowsVisible > 0) 81 { 82 IntegerHelper.getTwoBytes(rowsVisible, data, 4); 83 } 84 85 if (columnsVisible > 0) 87 { 88 IntegerHelper.getTwoBytes(columnsVisible, data, 6); 89 } 90 91 int activePane = topLeftPane; 93 94 if (rowsVisible > 0 && columnsVisible == 0) 95 { 96 activePane = bottomLeftPane; 97 } 98 else if (rowsVisible == 0 && columnsVisible > 0) 99 { 100 activePane = topRightPane; 101 } 102 else if (rowsVisible > 0 && columnsVisible > 0) 103 { 104 activePane = bottomRightPane; 105 } 106 IntegerHelper.getTwoBytes(activePane, data, 8); 108 109 return data; 110 } 111 } 112 | Popular Tags |