📄 stylesheet.java
字号:
return; case 0x34: break; case 0x35: newCHP.setFBold(getCHPFlag((byte)param, oldCHP.isFBold())); break; case 0x36: newCHP.setFItalic(getCHPFlag((byte)param, oldCHP.isFItalic())); break; case 0x37: newCHP.setFStrike(getCHPFlag((byte)param, oldCHP.isFStrike())); break; case 0x38: newCHP.setFOutline(getCHPFlag((byte)param, oldCHP.isFOutline())); break; case 0x39: newCHP.setFShadow(getCHPFlag((byte)param, oldCHP.isFShadow())); break; case 0x3a: newCHP.setFSmallCaps(getCHPFlag((byte)param, oldCHP.isFSmallCaps())); break; case 0x3b: newCHP.setFCaps(getCHPFlag((byte)param, oldCHP.isFCaps())); break; case 0x3c: newCHP.setFVanish(getCHPFlag((byte)param, oldCHP.isFVanish())); break; case 0x3d: newCHP.setFtcAscii((short)param); break; case 0x3e: newCHP.setKul((byte)param); break; case 0x3f: int hps = param & 0xff; if(hps != 0) { newCHP.setHps(hps); } byte cInc = (byte)(((byte)(param & 0xfe00) >>> 4) >> 1); if(cInc != 0) { newCHP.setHps(Math.max(newCHP.getHps() + (cInc * 2), 2)); } byte hpsPos = (byte)((param & 0xff0000) >>> 8); if(hpsPos != 0x80) { newCHP.setHpsPos(hpsPos); } boolean fAdjust = (param & 0x0100) > 0; if(fAdjust && hpsPos != 128 && hpsPos != 0 && oldCHP.getHpsPos() == 0) { newCHP.setHps(Math.max(newCHP.getHps() + (-2), 2)); } if(fAdjust && hpsPos == 0 && oldCHP.getHpsPos() != 0) { newCHP.setHps(Math.max(newCHP.getHps() + 2, 2)); } break; case 0x40: newCHP.setDxaSpace(param); break; case 0x41: newCHP.setLidDefault((short)param); break; case 0x42: newCHP.setIco((byte)param); break; case 0x43: newCHP.setHps(param); break; case 0x44: byte hpsLvl = (byte)param; newCHP.setHps(Math.max(newCHP.getHps() + (hpsLvl * 2), 2)); break; case 0x45: newCHP.setHpsPos((short)param); break; case 0x46: if(param != 0) { if(oldCHP.getHpsPos() == 0) { newCHP.setHps(Math.max(newCHP.getHps() + (-2), 2)); } } else { if(oldCHP.getHpsPos() != 0) { newCHP.setHps(Math.max(newCHP.getHps() + 2, 2)); } } break; case 0x47: CharacterProperties genCHP = new CharacterProperties(); genCHP.setFtcAscii(4); genCHP = (CharacterProperties)uncompressProperty(varParam, genCHP, styleSheet); CharacterProperties styleCHP = styleSheet.getStyleDescription(oldCHP.getBaseIstd()).getCHP(); if(genCHP.isFBold() == newCHP.isFBold()) { newCHP.setFBold(styleCHP.isFBold()); } if(genCHP.isFItalic() == newCHP.isFItalic()) { newCHP.setFItalic(styleCHP.isFItalic()); } if(genCHP.isFSmallCaps() == newCHP.isFSmallCaps()) { newCHP.setFSmallCaps(styleCHP.isFSmallCaps()); } if(genCHP.isFVanish() == newCHP.isFVanish()) { newCHP.setFVanish(styleCHP.isFVanish()); } if(genCHP.isFStrike() == newCHP.isFStrike()) { newCHP.setFStrike(styleCHP.isFStrike()); } if(genCHP.isFCaps() == newCHP.isFCaps()) { newCHP.setFCaps(styleCHP.isFCaps()); } if(genCHP.getFtcAscii() == newCHP.getFtcAscii()) { newCHP.setFtcAscii(styleCHP.getFtcAscii()); } if(genCHP.getFtcFE() == newCHP.getFtcFE()) { newCHP.setFtcFE(styleCHP.getFtcFE()); } if(genCHP.getFtcOther() == newCHP.getFtcOther()) { newCHP.setFtcOther(styleCHP.getFtcOther()); } if(genCHP.getHps() == newCHP.getHps()) { newCHP.setHps(styleCHP.getHps()); } if(genCHP.getHpsPos() == newCHP.getHpsPos()) { newCHP.setHpsPos(styleCHP.getHpsPos()); } if(genCHP.getKul() == newCHP.getKul()) { newCHP.setKul(styleCHP.getKul()); } if(genCHP.getDxaSpace() == newCHP.getDxaSpace()) { newCHP.setDxaSpace(styleCHP.getDxaSpace()); } if(genCHP.getIco() == newCHP.getIco()) { newCHP.setIco(styleCHP.getIco()); } if(genCHP.getLidDefault() == newCHP.getLidDefault()) { newCHP.setLidDefault(styleCHP.getLidDefault()); } if(genCHP.getLidFE() == newCHP.getLidFE()) { newCHP.setLidFE(styleCHP.getLidFE()); } break; case 0x48: newCHP.setIss((byte)param); break; case 0x49: newCHP.setHps(LittleEndian.getShort(varParam, 0)); break; case 0x4a: int increment = LittleEndian.getShort(varParam, 0); newCHP.setHps(Math.max(newCHP.getHps() + increment, 8)); break; case 0x4b: newCHP.setHpsKern(param); break; case 0x4c: doCHPOperation(oldCHP, newCHP, 0x47, param, varParam, grpprl, offset, styleSheet); break; case 0x4d: float percentage = (float)param/100.0f; int add = (int)((float)percentage * (float)newCHP.getHps()); newCHP.setHps(newCHP.getHps() + add); break; case 0x4e: newCHP.setYsr((byte)param); break; case 0x4f: newCHP.setFtcAscii((short)param); break; case 0x50: newCHP.setFtcFE((short)param); break; case 0x51: newCHP.setFtcOther((short)param); break; case 0x52: break; case 0x53: newCHP.setFDStrike(getFlag(param)); break; case 0x54: newCHP.setFImprint(getFlag(param)); break; case 0x55: newCHP.setFSpec(getFlag(param)); break; case 0x56: newCHP.setFObj(getFlag(param)); break; case 0x57: newCHP.setFPropMark(varParam[0]); newCHP.setIbstPropRMark((short)LittleEndian.getShort(varParam, 1)); newCHP.setDttmPropRMark(LittleEndian.getInt(varParam, 3)); break; case 0x58: newCHP.setFEmboss(getFlag(param)); break; case 0x59: newCHP.setSfxtText((byte)param); break; case 0x5a: break; case 0x5b: break; case 0x5c: break; case 0x5d: break; case 0x5e: break; case 0x5f: break; case 0x60: break; case 0x61: break; case 0x62: byte[] xstDispFldRMark = new byte[32]; newCHP.setFDispFldRMark(varParam[0]); newCHP.setIbstDispFldRMark((short)LittleEndian.getShort(varParam, 1)); newCHP.setDttmDispFldRMark(LittleEndian.getInt(varParam, 3)); System.arraycopy(varParam, 7, xstDispFldRMark, 0, 32); newCHP.setXstDispFldRMark(xstDispFldRMark); break; case 0x63: newCHP.setIbstRMarkDel((short)param); break; case 0x64: short[] dttmRMarkDel = new short[2]; dttmRMarkDel[0] = LittleEndian.getShort(grpprl, offset - 4); dttmRMarkDel[1] = LittleEndian.getShort(grpprl, offset - 2); newCHP.setDttmRMarkDel(dttmRMarkDel); break; case 0x65: short[] brc = new short[2]; brc[0] = (short)LittleEndian.getShort(grpprl, offset - 4); brc[1] = (short)LittleEndian.getShort(grpprl, offset - 2); newCHP.setBrc(brc); break; case 0x66: newCHP.setShd((short)param); break; case 0x67: break; case 0x68: break; case 0x69: break; case 0x6a: break; case 0x6b: break; case 0x6c: break; case 0x6d: newCHP.setLidDefault((short)param); break; case 0x6e: newCHP.setLidFE((short)param); break; case 0x6f: newCHP.setIdctHint((byte)param); break; } } /** * Used to uncompress a property stored in a grpprl. These include * CharacterProperties, ParagraphProperties, TableProperties, and * SectionProperties. * * @param grpprl The compressed form of the property. * @param parent The base property of the property. * @param styleSheet The document's stylesheet. * * @return An object that should be casted to the appropriate property. */ public static Object uncompressProperty(byte[] grpprl, Object parent, StyleSheet styleSheet) { return uncompressProperty(grpprl, parent, styleSheet, true); } /** * Used to uncompress a property stored in a grpprl. These include * CharacterProperties, ParagraphProperties, TableProperties, and * SectionProperties. * * @param grpprl The compressed form of the property. * @param parent The base property of the property. * @param styleSheet The document's stylesheet. * * @return An object that should be casted to the appropriate property. */ public static Object uncompressProperty(byte[] grpprl, Object parent, StyleSheet styleSheet, boolean doIstd) { Object newProperty = null; int offset = 0; int propertyType = PAP_TYPE; if(parent instanceof ParagraphProperties) { try { newProperty = ((ParagraphProperties)parent).clone(); } catch(Exception e){} if(doIstd) { ((ParagraphProperties)newProperty).setIstd(LittleEndian.getShort(grpprl, 0)); offset = 2; } } else if(parent instanceof CharacterProperties) { try { newProperty = ((CharacterProperties)parent).clone(); ((CharacterProperties)newProperty).setBaseIstd(((CharacterProperties)parent).getIstd()); } catch(Exception e){} propertyType = CHP_TYPE; } else if(parent instanceof SectionProperties) { newProperty = parent; propertyType = SEP_TYPE; } else if(parent instanceof TableProperties) { newProperty = parent; propertyType = TAP_TYPE; offset = 2;//because this is really just a papx } else { return null; } while(offset < grpprl.length) { short sprm = LittleEndian.getShort(grpprl, offset); offset += 2; byte spra = (byte)((sprm & 0xe000) >> 13); int opSize = 0; int param = 0; byte[] varParam = null; switch(spra) { case 0: case 1: opSize = 1; param = grpprl[offset]; break; case 2: opSize = 2;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -