📄 stylesheet.java
字号:
short[] rgdxaCenter = newTAP.getRgdxaCenter(); if(rgdxaCenter != null) { int adjust = newTAP.getDxaGapHalf() - param; rgdxaCenter[0] += adjust; } newTAP.setDxaGapHalf(param); break; } case 0x03: newTAP.setFCantSplit(getFlag(param)); break; case 0x04: newTAP.setFTableHeader(getFlag(param)); break; case 0x05: { short[] brcTop = newTAP.getBrcTop(); short[] brcLeft = newTAP.getBrcLeft(); short[] brcBottom = newTAP.getBrcBottom(); short[] brcRight = newTAP.getBrcRight(); short[] brcVertical = newTAP.getBrcVertical(); short[] brcHorizontal = newTAP.getBrcHorizontal(); brcTop[0] = LittleEndian.getShort(varParam, 0); brcTop[1] = LittleEndian.getShort(varParam, 2); brcLeft[0] = LittleEndian.getShort(varParam, 4); brcLeft[1] = LittleEndian.getShort(varParam, 6); brcBottom[0] = LittleEndian.getShort(varParam, 8); brcBottom[1] = LittleEndian.getShort(varParam, 10); brcRight[0] = LittleEndian.getShort(varParam, 12); brcRight[1] = LittleEndian.getShort(varParam, 14); brcHorizontal[0] = LittleEndian.getShort(varParam, 16); brcHorizontal[1] = LittleEndian.getShort(varParam, 18); brcVertical[0] = LittleEndian.getShort(varParam, 20); brcVertical[1] = LittleEndian.getShort(varParam, 22); break; } case 0x06: //obsolete, used in word 1.x break; case 0x07: newTAP.setDyaRowHeight(param); break; case 0x08: { short[] rgdxaCenter = new short[varParam[0] + 1]; TableCellDescriptor[] rgtc = new TableCellDescriptor[varParam[0]]; short itcMac = varParam[0]; //I use varParam[0] and newTAP._itcMac interchangably newTAP.setItcMac(itcMac); newTAP.setRgdxaCenter(rgdxaCenter) ; newTAP.setRgtc(rgtc); for(int x = 0; x < itcMac; x++) { rgdxaCenter[x] = LittleEndian.getShort(varParam , 1 + (x * 2)); rgtc[x] = TableCellDescriptor.convertBytesToTC(varParam, 1 + ((itcMac + 1) * 2) + (x * 20)); } rgdxaCenter[itcMac] = LittleEndian.getShort(varParam , 1 + (itcMac * 2)); break; } case 0x09: /** @todo handle cell shading*/ break; case 0x0a: /** @todo handle word defined table styles*/ break; case 0x20: { TCAbstractType[] rgtc = newTAP.getRgtc(); for(int x = varParam[0]; x < varParam[1]; x++) { if((varParam[2] & 0x08) > 0) { short[] brcRight = rgtc[x].getBrcRight(); brcRight[0] = LittleEndian.getShort(varParam, 6); brcRight[1] = LittleEndian.getShort(varParam, 8); } else if((varParam[2] & 0x04) > 0) { short[] brcBottom = rgtc[x].getBrcBottom(); brcBottom[0] = LittleEndian.getShort(varParam, 6); brcBottom[1] = LittleEndian.getShort(varParam, 8); } else if((varParam[2] & 0x02) > 0) { short[] brcLeft = rgtc[x].getBrcLeft(); brcLeft[0] = LittleEndian.getShort(varParam, 6); brcLeft[1] = LittleEndian.getShort(varParam, 8); } else if((varParam[2] & 0x01) > 0) { short[] brcTop = rgtc[x].getBrcTop(); brcTop[0] = LittleEndian.getShort(varParam, 6); brcTop[1] = LittleEndian.getShort(varParam, 8); } } break; } case 0x21: int index = (param & 0xff000000) >> 24; int count = (param & 0x00ff0000) >> 16; int width = (param & 0x0000ffff); int itcMac = newTAP.getItcMac(); short[] rgdxaCenter = new short[itcMac + count + 1]; TableCellDescriptor[] rgtc = new TableCellDescriptor[itcMac + count]; if(index >= itcMac) { index = itcMac; System.arraycopy(newTAP.getRgdxaCenter(), 0, rgdxaCenter, 0, itcMac + 1); System.arraycopy(newTAP.getRgtc(), 0, rgtc, 0, itcMac); } else { //copy rgdxaCenter System.arraycopy(newTAP.getRgdxaCenter(), 0, rgdxaCenter, 0, index + 1); System.arraycopy(newTAP.getRgdxaCenter(), index + 1, rgdxaCenter, index + count, itcMac - (index)); //copy rgtc System.arraycopy(newTAP.getRgtc(), 0, rgtc, 0, index); System.arraycopy(newTAP.getRgtc(), index, rgtc, index + count, itcMac - index); } for(int x = index; x < index + count; x++) { rgtc[x] = new TableCellDescriptor(); rgdxaCenter[x] = (short)(rgdxaCenter[x-1] + width); } rgdxaCenter[index + count] = (short)(rgdxaCenter[(index + count)-1] + width); break; /**@todo handle table sprms from complex files*/ case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: break; default: break; } } /** * Used in decompression of a sepx. This performs an operation defined by * a single sprm. * * @param newSEP The SectionProperty to perfrom the operation on. * @param operand The operation to perform. * @param param The operation's parameter. * @param varParam The operation variable length parameter. */ static void doSEPOperation(SectionProperties newSEP, int operand, int param, byte[] varParam) { switch(operand) { case 0: newSEP.setCnsPgn((byte)param); break; case 0x1: newSEP.setIHeadingPgn((byte)param); break; case 0x2: newSEP.setOlstAnm(varParam); break; case 0x3: //not quite sure break; case 0x4: //not quite sure break; case 0x5: newSEP.setFEvenlySpaced(getFlag(param)); break; case 0x6: newSEP.setFUnlocked(getFlag(param)); break; case 0x7: newSEP.setDmBinFirst((short)param); break; case 0x8: newSEP.setDmBinOther((short)param); break; case 0x9: newSEP.setBkc((byte)param); break; case 0xa: newSEP.setFTitlePage(getFlag(param)); break; case 0xb: newSEP.setCcolM1((short)param); break; case 0xc: newSEP.setDxaColumns(param); break; case 0xd: newSEP.setFAutoPgn(getFlag(param)); break; case 0xe: newSEP.setNfcPgn((byte)param); break; case 0xf: newSEP.setDyaPgn((short)param); break; case 0x10: newSEP.setDxaPgn((short)param); break; case 0x11: newSEP.setFPgnRestart(getFlag(param)); break; case 0x12: newSEP.setFEndNote(getFlag(param)); break; case 0x13: newSEP.setLnc((byte)param); break; case 0x14: newSEP.setGrpfIhdt((byte)param); break; case 0x15: newSEP.setNLnnMod((short)param); break; case 0x16: newSEP.setDxaLnn(param); break; case 0x17: newSEP.setDyaHdrTop(param); break; case 0x18: newSEP.setDyaHdrBottom(param); break; case 0x19: newSEP.setFLBetween(getFlag(param)); break; case 0x1a: newSEP.setVjc((byte)param); break; case 0x1b: newSEP.setLnnMin((short)param); break; case 0x1c: newSEP.setPgnStart((short)param); break; case 0x1d: newSEP.setDmOrientPage((byte)param); break; case 0x1e: //nothing break; case 0x1f: newSEP.setXaPage(param); break; case 0x20: newSEP.setYaPage(param); break; case 0x21: newSEP.setDxaLeft(param); break; case 0x22: newSEP.setDxaRight(param); break; case 0x23: newSEP.setDyaTop(param); break; case 0x24: newSEP.setDyaBottom(param); break; case 0x25: newSEP.setDzaGutter(param); break; case 0x26: newSEP.setDmPaperReq((short)param); break; case 0x27: newSEP.setFPropMark(getFlag(varParam[0])); break; case 0x28: break; case 0x29: break; case 0x2a: break; case 0x2b: short[] brcTop = newSEP.getBrcTop(); brcTop[0] = (short)(param & 0xffff); brcTop[1] = (short)((param & 0xffff0000) >> 16); break; case 0x2c: short[] brcLeft = newSEP.getBrcLeft(); brcLeft[0] = (short)(param & 0xffff); brcLeft[1] = (short)((param & 0xffff0000) >> 16); break; case 0x2d: short[] brcBottom = newSEP.getBrcBottom(); brcBottom[0] = (short)(param & 0xffff); brcBottom[1] = (short)((param & 0xffff0000) >> 16); break; case 0x2e: short[] brcRight = newSEP.getBrcRight(); brcRight[0] = (short)(param & 0xffff); brcRight[1] = (short)((param & 0xffff0000) >> 16); break; case 0x2f: newSEP.setPgbProp(param); break; case 0x30: newSEP.setDxtCharSpace(param); break; case 0x31: newSEP.setDyaLinePitch(param); break; case 0x33: newSEP.setWTextFlow((short)param); break; default: break; } } /** * Converts an byte value into a boolean. The byte parameter can be 1,0, 128, * or 129. if it is 128, this function returns the same value as oldVal. If * it is 129, this function returns !oldVal. This is used for certain sprms * * @param x The byte value to convert. * @param oldVal The old boolean value. * * @return A boolean whose value depends on x and oldVal. */ private static boolean getCHPFlag(byte x, boolean oldVal) { switch(x) { case 0: return false; case 1: return true; case (byte)0x80: return oldVal; case (byte)0x81: return !oldVal; default: return false; } } /** * Converts an int into a boolean. If the int is non-zero, it returns true. * Otherwise it returns false. * * @param x The int to convert. * * @return A boolean whose value depends on x. */ public static boolean getFlag(int x) { if(x != 0) { return true; } else { return false; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -