/** * Sets the character properties of the list numbers. * * @param level the level number that the properties should apply to. * @param chp The character properties. */ public void SetLevelNumberProperties(int level, CharacterProperties chp) { ListLevel listLevel = _listData.GetLevel(level); int styleIndex = _listData.GetLevelStyle(level); CharacterProperties base1 = _styleSheet.GetCharacterStyle(styleIndex); byte[] grpprl = CharacterSprmCompressor.CompressCharacterProperty(chp, base1); listLevel.SetNumberProperties(grpprl); }
/** * Sets the character properties of the list numbers. * * @param level the level number that the properties should apply to. * @param chp The character properties. */ public void SetLevelNumberProperties(int level, CharacterProperties chp) { ListLevel listLevel = _listData.GetLevel(level); int styleIndex = _listData.GetLevelStyle(level); CharacterProperties base1 = _styleSheet.GetCharacterStyle(styleIndex); byte[] grpprl = CharacterSprmCompressor.CompressCharacterProperty(chp, base1); listLevel.SetNumberProperties(grpprl); }
public CharacterProperties GetCharacterProperties(StyleSheet ss, short istd) { if (ss == null) { // TODO Fix up for Word 6/95 return new CharacterProperties(); } CharacterProperties baseStyle = ss.GetCharacterStyle(istd); if (baseStyle == null) baseStyle = new CharacterProperties(); CharacterProperties props = CharacterSprmUncompressor.UncompressCHP(baseStyle, GetGrpprl(), 0); return props; }
public static CharacterProperties UncompressCHP(CharacterProperties parent, byte[] grpprl, int Offset) { CharacterProperties newProperties = null; newProperties = (CharacterProperties)parent.Clone(); SprmIterator sprmIt = new SprmIterator(grpprl, Offset); while (sprmIt.HasNext()) { SprmOperation sprm = sprmIt.Next(); UncompressCHPOperation(parent, newProperties, sprm); } return newProperties; }
public CharacterRun InsertAfter(String text, CharacterProperties props) // { InitAll(); PAPX papx = _paragraphs[_parEnd - 1]; short istd = papx.GetIstd(); StyleSheet ss = _doc.GetStyleSheet(); CharacterProperties baseStyle = ss.GetCharacterStyle(istd); byte[] grpprl = CharacterSprmCompressor.CompressCharacterProperty(props, baseStyle); SprmBuffer buf = new SprmBuffer(grpprl); _doc.CharacterTable.Insert(_charEnd, _end, buf); _charEnd++; return(InsertAfter(text)); }
protected Paragraph InsertBefore(ParagraphProperties props, int styleIndex, String text) // { InitAll(); StyleSheet ss = _doc.GetStyleSheet(); ParagraphProperties baseStyle = ss.GetParagraphStyle(styleIndex); CharacterProperties baseChp = ss.GetCharacterStyle(styleIndex); byte[] grpprl = ParagraphSprmCompressor.CompressParagraphProperty(props, baseStyle); byte[] withIndex = new byte[grpprl.Length + LittleEndianConsts.SHORT_SIZE]; LittleEndian.PutShort(withIndex, (short)styleIndex); Array.Copy(grpprl, 0, withIndex, LittleEndianConsts.SHORT_SIZE, grpprl.Length); SprmBuffer buf = new SprmBuffer(withIndex); _doc.ParagraphTable.Insert(_parStart, _start, buf); InsertBefore(text, baseChp); return(GetParagraph(0)); }
/** * Used in decompression of a chpx. This performs an operation defined by * a single sprm. * * @param oldCHP The base CharacterProperties. * @param newCHP The current CharacterProperties. * @param operand The operand defined by the sprm (See Word file format spec) * @param param The parameter defined by the sprm (See Word file format spec) * @param varParam The variable length parameter defined by the sprm. (See * Word file format spec) * @param grpprl The entire chpx that this operation is a part of. * @param offset The offset in the grpprl of the next sprm * @param styleSheet The StyleSheet for this document. */ static void UncompressCHPOperation(CharacterProperties oldCHP, CharacterProperties newCHP, SprmOperation sprm) { switch (sprm.Operation) { case 0: newCHP.SetFRMarkDel(GetFlag(sprm.Operand)); break; case 0x1: newCHP.SetFRMark(GetFlag(sprm.Operand)); break; case 0x2: newCHP.SetFFldVanish(GetFlag(sprm.Operand)); break; case 0x3: newCHP.SetFcPic(sprm.Operand); newCHP.SetFSpec(true); break; case 0x4: newCHP.SetIbstRMark((short)sprm.Operand); break; case 0x5: newCHP.SetDttmRMark(new DateAndTime(sprm.Grpprl, sprm.GrpprlOffset)); break; case 0x6: newCHP.SetFData(GetFlag(sprm.Operand)); break; case 0x7: //don't care about this break; case 0x8: //short chsDiff = (short)((param & 0xff0000) >>> 16); int operand = sprm.Operand; short chsDiff = (short)(operand & 0x0000ff); newCHP.SetFChsDiff(GetFlag(chsDiff)); newCHP.SetChse((short)(operand & 0xffff00)); break; case 0x9: newCHP.SetFSpec(true); newCHP.SetFtcSym(LittleEndian.GetShort(sprm.Grpprl, sprm.GrpprlOffset)); newCHP.SetXchSym(LittleEndian.GetShort(sprm.Grpprl, sprm.GrpprlOffset + 2)); break; case 0xa: newCHP.SetFOle2(GetFlag(sprm.Operand)); break; case 0xb: // Obsolete break; case 0xc: newCHP.SetIcoHighlight((byte)sprm.Operand); newCHP.SetFHighlight(GetFlag(sprm.Operand)); break; case 0xd: // undocumented break; case 0xe: newCHP.SetFcObj(sprm.Operand); break; case 0xf: // undocumented break; case 0x10: // undocumented break; // undocumented till 0x30 case 0x11: // sprmCFWebHidden break; case 0x12: break; case 0x13: break; case 0x14: break; case 0x15: // sprmCRsidProp break; case 0x16: // sprmCRsidText break; case 0x17: // sprmCRsidRMDel break; case 0x18: // sprmCFSpecVanish break; case 0x19: break; case 0x1a: // sprmCFMathPr break; case 0x1b: break; case 0x1c: break; case 0x1d: break; case 0x1e: break; case 0x1f: break; case 0x20: break; case 0x21: break; case 0x22: break; case 0x23: break; case 0x24: break; case 0x25: break; case 0x26: break; case 0x27: break; case 0x28: break; case 0x29: break; case 0x2a: break; case 0x2b: break; case 0x2c: break; case 0x2d: break; case 0x2e: break; case 0x2f: break; case 0x30: newCHP.SetIstd(sprm.Operand); break; case 0x31: //permutation vector for fast saves, who cares! break; case 0x32: newCHP.SetFBold(false); newCHP.SetFItalic(false); newCHP.SetFOutline(false); newCHP.SetFStrike(false); newCHP.SetFShadow(false); newCHP.SetFSmallCaps(false); newCHP.SetFCaps(false); newCHP.SetFVanish(false); newCHP.SetKul((byte)0); newCHP.SetIco((byte)0); break; case 0x33: // preserve the fSpec Setting from the original CHP bool fSpec = newCHP.IsFSpec(); newCHP = (CharacterProperties)oldCHP.Clone(); newCHP.SetFSpec(fSpec); return; case 0x34: // sprmCKcd break; case 0x35: newCHP.SetFBold(GetCHPFlag((byte)sprm.Operand, oldCHP.IsFBold())); break; case 0x36: newCHP.SetFItalic(GetCHPFlag((byte)sprm.Operand, oldCHP.IsFItalic())); break; case 0x37: newCHP.SetFStrike(GetCHPFlag((byte)sprm.Operand, oldCHP.IsFStrike())); break; case 0x38: newCHP.SetFOutline(GetCHPFlag((byte)sprm.Operand, oldCHP.IsFOutline())); break; case 0x39: newCHP.SetFShadow(GetCHPFlag((byte)sprm.Operand, oldCHP.IsFShadow())); break; case 0x3a: newCHP.SetFSmallCaps(GetCHPFlag((byte)sprm.Operand, oldCHP.IsFSmallCaps())); break; case 0x3b: newCHP.SetFCaps(GetCHPFlag((byte)sprm.Operand, oldCHP.IsFCaps())); break; case 0x3c: newCHP.SetFVanish(GetCHPFlag((byte)sprm.Operand, oldCHP.IsFVanish())); break; case 0x3d: newCHP.SetFtcAscii((short)sprm.Operand); break; case 0x3e: newCHP.SetKul((byte)sprm.Operand); break; case 0x3f: operand = sprm.Operand; int hps = operand & 0xff; if (hps != 0) { newCHP.SetHps(hps); } //byte cInc = (byte)(((byte)(param & 0xfe00) >>> 4) >> 1); byte cInc = (byte)((operand & 0xff00) >> 8); cInc = (byte)(cInc >> 1); if (cInc != 0) { newCHP.SetHps(Math.Max(newCHP.GetHps() + (cInc * 2), 2)); } //byte hpsPos = (byte)((param & 0xff0000) >>> 8); byte hpsPos = (byte)((operand & 0xff0000) >> 16); if (hpsPos != 0x80) { newCHP.SetHpsPos(hpsPos); } bool fAdjust = (operand & 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(sprm.Operand); break; case 0x41: newCHP.SetLidDefault((short)sprm.Operand); break; case 0x42: newCHP.SetIco((byte)sprm.Operand); break; case 0x43: newCHP.SetHps(sprm.Operand); break; case 0x44: byte hpsLvl = (byte)sprm.Operand; newCHP.SetHps(Math.Max(newCHP.GetHps() + (hpsLvl * 2), 2)); break; case 0x45: newCHP.SetHpsPos((short)sprm.Operand); break; case 0x46: if (sprm.Operand != 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)sprm.Operand); break; case 0x49: newCHP.SetHps(LittleEndian.GetShort(sprm.Grpprl, sprm.GrpprlOffset)); break; case 0x4a: int increment = LittleEndian.GetShort(sprm.Grpprl, sprm.GrpprlOffset); newCHP.SetHps(Math.Max(newCHP.GetHps() + increment, 8)); break; case 0x4b: newCHP.SetHpsKern(sprm.Operand); break; case 0x4c: // unCompressCHPOperation (oldCHP, newCHP, 0x47, param, varParam, // styleSheet, opSize); break; case 0x4d: float percentage = sprm.Operand / 100.0f; int add = (int)(percentage * newCHP.GetHps()); newCHP.SetHps(newCHP.GetHps() + add); break; case 0x4e: newCHP.SetYsr((byte)sprm.Operand); break; case 0x4f: newCHP.SetFtcAscii((short)sprm.Operand); break; case 0x50: newCHP.SetFtcFE((short)sprm.Operand); break; case 0x51: newCHP.SetFtcOther((short)sprm.Operand); break; case 0x52: // sprmCCharScale break; case 0x53: newCHP.SetFDStrike(GetFlag(sprm.Operand)); break; case 0x54: newCHP.SetFImprint(GetFlag(sprm.Operand)); break; case 0x55: newCHP.SetFSpec(GetFlag(sprm.Operand)); break; case 0x56: newCHP.SetFObj(GetFlag(sprm.Operand)); break; case 0x57: byte[] buf = sprm.Grpprl; int offset = sprm.GrpprlOffset; newCHP.SetFPropMark(buf[offset]); newCHP.SetIbstPropRMark(LittleEndian.GetShort(buf, offset + 1)); newCHP.SetDttmPropRMark(new DateAndTime(buf, offset + 3)); break; case 0x58: newCHP.SetFEmboss(GetFlag(sprm.Operand)); break; case 0x59: newCHP.SetSfxtText((byte)sprm.Operand); break; case 0x5a: // sprmCFBiDi break; case 0x5b: break; case 0x5c: // sprmCFBoldBi break; case 0x5d: // sprmCFItalicBi break; case 0x5e: // sprmCFtcBi break; case 0x5f: // sprmCLidBi break; case 0x60: // sprmCIcoBi break; case 0x61: // sprmCHpsBi break; case 0x62: byte[] xstDispFldRMark = new byte[32]; buf = sprm.Grpprl; offset = sprm.GrpprlOffset; newCHP.SetFDispFldRMark(buf[offset]); newCHP.SetIbstDispFldRMark(LittleEndian.GetShort(buf, offset + 1)); newCHP.SetDttmDispFldRMark(new DateAndTime(buf, offset + 3)); Array.Copy(buf, offset + 7, xstDispFldRMark, 0, 32); newCHP.SetXstDispFldRMark(xstDispFldRMark); break; case 0x63: newCHP.SetIbstRMarkDel((short)sprm.Operand); break; case 0x64: newCHP.SetDttmRMarkDel(new DateAndTime(sprm.Grpprl, sprm.GrpprlOffset)); break; case 0x65: newCHP.SetBrc(new BorderCode(sprm.Grpprl, sprm.GrpprlOffset)); break; case 0x66: newCHP.SetShd(new ShadingDescriptor(sprm.Grpprl, sprm.GrpprlOffset)); break; case 0x67: // Obsolete break; case 0x68: // sprmCFUsePgsuSettings break; case 0x69: break; case 0x6a: break; case 0x6b: break; case 0x6c: break; case 0x6d: newCHP.SetLidDefault((short)sprm.Operand); break; case 0x6e: newCHP.SetLidFE((short)sprm.Operand); break; case 0x6f: newCHP.SetIdctHint((byte)sprm.Operand); break; case 0x70: newCHP.SetIco24(sprm.Operand); break; case 0x71: // sprmCShd break; case 0x72: // sprmCBrc break; case 0x73: // sprmCRgLid0 break; case 0x74: // sprmCRgLid1 break; } }
public static byte[] CompressCharacterProperty(CharacterProperties newCHP, CharacterProperties oldCHP) { ArrayList sprmList = new ArrayList(); int size = 0; if (newCHP.IsFRMarkDel() != oldCHP.IsFRMarkDel()) { int value = 0; if (newCHP.IsFRMarkDel()) { value = 0x01; } size += SprmUtils.AddSprm((short)0x0800, value, null, sprmList); } if (newCHP.IsFRMark() != oldCHP.IsFRMark()) { int value = 0; if (newCHP.IsFRMark()) { value = 0x01; } size += SprmUtils.AddSprm((short)0x0801, value, null, sprmList); } if (newCHP.IsFFldVanish() != oldCHP.IsFFldVanish()) { int value = 0; if (newCHP.IsFFldVanish()) { value = 0x01; } size += SprmUtils.AddSprm((short)0x0802, value, null, sprmList); } if (newCHP.IsFSpec() != oldCHP.IsFSpec() || newCHP.GetFcPic() != oldCHP.GetFcPic()) { size += SprmUtils.AddSprm((short)0x6a03, newCHP.GetFcPic(), null, sprmList); } if (newCHP.GetIbstRMark() != oldCHP.GetIbstRMark()) { size += SprmUtils.AddSprm((short)0x4804, newCHP.GetIbstRMark(), null, sprmList); } if (!newCHP.GetDttmRMark().Equals(oldCHP.GetDttmRMark())) { byte[] buf = new byte[4]; newCHP.GetDttmRMark().Serialize(buf, 0); size += SprmUtils.AddSprm((short)0x6805, LittleEndian.GetInt(buf), null, sprmList); } if (newCHP.IsFData() != oldCHP.IsFData()) { int value = 0; if (newCHP.IsFData()) { value = 0x01; } size += SprmUtils.AddSprm((short)0x0806, value, null, sprmList); } if (newCHP.IsFSpec() && newCHP.GetFtcSym() != 0) { byte[] varParam = new byte[4]; LittleEndian.PutShort(varParam, 0, (short)newCHP.GetFtcSym()); LittleEndian.PutShort(varParam, 2, (short)newCHP.GetXchSym()); size += SprmUtils.AddSprm((short)0x6a09, 0, varParam, sprmList); } if (newCHP.IsFOle2() != newCHP.IsFOle2()) { int value = 0; if (newCHP.IsFOle2()) { value = 0x01; } size += SprmUtils.AddSprm((short)0x080a, value, null, sprmList); } if (newCHP.GetIcoHighlight() != oldCHP.GetIcoHighlight()) { size += SprmUtils.AddSprm((short)0x2a0c, newCHP.GetIcoHighlight(), null, sprmList); } if (newCHP.GetFcObj() != oldCHP.GetFcObj()) { size += SprmUtils.AddSprm((short)0x680e, newCHP.GetFcObj(), null, sprmList); } if (newCHP.GetIstd() != oldCHP.GetIstd()) { size += SprmUtils.AddSprm((short)0x4a30, newCHP.GetIstd(), null, sprmList); } if (newCHP.IsFBold() != oldCHP.IsFBold()) { int value = 0; if (newCHP.IsFBold()) { value = 0x01; } size += SprmUtils.AddSprm((short)0x0835, value, null, sprmList); } if (newCHP.IsFItalic() != oldCHP.IsFItalic()) { int value = 0; if (newCHP.IsFItalic()) { value = 0x01; } size += SprmUtils.AddSprm((short)0x0836, value, null, sprmList); } if (newCHP.IsFStrike() != oldCHP.IsFStrike()) { int value = 0; if (newCHP.IsFStrike()) { value = 0x01; } size += SprmUtils.AddSprm((short)0x0837, value, null, sprmList); } if (newCHP.IsFOutline() != oldCHP.IsFOutline()) { int value = 0; if (newCHP.IsFOutline()) { value = 0x01; } size += SprmUtils.AddSprm((short)0x0838, value, null, sprmList); } if (newCHP.IsFShadow() != oldCHP.IsFShadow()) { int value = 0; if (newCHP.IsFShadow()) { value = 0x01; } size += SprmUtils.AddSprm((short)0x0839, value, null, sprmList); } if (newCHP.IsFSmallCaps() != oldCHP.IsFSmallCaps()) { int value = 0; if (newCHP.IsFSmallCaps()) { value = 0x01; } size += SprmUtils.AddSprm((short)0x083a, value, null, sprmList); } if (newCHP.IsFCaps() != oldCHP.IsFCaps()) { int value = 0; if (newCHP.IsFCaps()) { value = 0x01; } size += SprmUtils.AddSprm((short)0x083b, value, null, sprmList); } if (newCHP.IsFVanish() != oldCHP.IsFVanish()) { int value = 0; if (newCHP.IsFVanish()) { value = 0x01; } size += SprmUtils.AddSprm((short)0x083c, value, null, sprmList); } if (newCHP.GetKul() != oldCHP.GetKul()) { size += SprmUtils.AddSprm((short)0x2a3e, newCHP.GetKul(), null, sprmList); } if (newCHP.GetDxaSpace() != oldCHP.GetDxaSpace()) { size += SprmUtils.AddSprm(unchecked((short)0x8840), newCHP.GetDxaSpace(), null, sprmList); } if (newCHP.GetIco() != oldCHP.GetIco()) { size += SprmUtils.AddSprm((short)0x2a42, newCHP.GetIco(), null, sprmList); } if (newCHP.GetHps() != oldCHP.GetHps()) { size += SprmUtils.AddSprm((short)0x4a43, newCHP.GetHps(), null, sprmList); } if (newCHP.GetHpsPos() != oldCHP.GetHpsPos()) { size += SprmUtils.AddSprm((short)0x4845, newCHP.GetHpsPos(), null, sprmList); } if (newCHP.GetHpsKern() != oldCHP.GetHpsKern()) { size += SprmUtils.AddSprm((short)0x484b, newCHP.GetHpsKern(), null, sprmList); } if (newCHP.GetYsr() != oldCHP.GetYsr()) { size += SprmUtils.AddSprm((short)0x484e, newCHP.GetYsr(), null, sprmList); } if (newCHP.GetFtcAscii() != oldCHP.GetFtcAscii()) { size += SprmUtils.AddSprm((short)0x4a4f, newCHP.GetFtcAscii(), null, sprmList); } if (newCHP.GetFtcFE() != oldCHP.GetFtcFE()) { size += SprmUtils.AddSprm((short)0x4a50, newCHP.GetFtcFE(), null, sprmList); } if (newCHP.GetFtcOther() != oldCHP.GetFtcOther()) { size += SprmUtils.AddSprm((short)0x4a51, newCHP.GetFtcOther(), null, sprmList); } if (newCHP.IsFDStrike() != oldCHP.IsFDStrike()) { int value = 0; if (newCHP.IsFDStrike()) { value = 0x01; } size += SprmUtils.AddSprm((short)0x2a53, value, null, sprmList); } if (newCHP.IsFImprint() != oldCHP.IsFImprint()) { int value = 0; if (newCHP.IsFImprint()) { value = 0x01; } size += SprmUtils.AddSprm((short)0x0854, value, null, sprmList); } if (newCHP.IsFSpec() != oldCHP.IsFSpec()) { int value = 0; if (newCHP.IsFSpec()) { value = 0x01; } size += SprmUtils.AddSprm((short)0x0855, value, null, sprmList); } if (newCHP.IsFObj() != oldCHP.IsFObj()) { int value = 0; if (newCHP.IsFObj()) { value = 0x01; } size += SprmUtils.AddSprm((short)0x0856, value, null, sprmList); } if (newCHP.IsFEmboss() != oldCHP.IsFEmboss()) { int value = 0; if (newCHP.IsFEmboss()) { value = 0x01; } size += SprmUtils.AddSprm((short)0x0858, value, null, sprmList); } if (newCHP.GetSfxtText() != oldCHP.GetSfxtText()) { size += SprmUtils.AddSprm((short)0x2859, newCHP.GetSfxtText(), null, sprmList); } if (newCHP.GetIco24() != oldCHP.GetIco24()) { if (newCHP.GetIco24() != -1) // don't Add a sprm if we're looking at an ico = Auto size += SprmUtils.AddSprm((short)0x6870, newCHP.GetIco24(), null, sprmList); } return SprmUtils.GetGrpprl(sprmList, size); }
internal void SetCHP(CharacterProperties chp) { _chp = chp; }
/** * * @param chpx The chpx this object is based on. * @param ss The stylesheet for the document this run belongs to. * @param istd The style index if this Run's base style. * @param parent The parent range of this character run (usually a paragraph). */ internal CharacterRun(CHPX chpx, StyleSheet ss, short istd, Range parent) : base(Math.Max(parent._start, chpx.Start), Math.Min(parent._end, chpx.End), parent) { _props = chpx.GetCharacterProperties(ss, istd); _chpx = chpx.GetSprmBuf(); }
/** * Creates a CharacterProperties object from a chpx stored in the * StyleDescription at the index istd in the StyleDescription array. The * CharacterProperties object is placed in the StyleDescription at istd after * its been Created. Not every StyleDescription will contain a chpx. In these * cases this function does nothing. * * @param istd The index of the StyleDescription to create the * CharacterProperties object from. */ private void CreateChp(int istd) { StyleDescription sd = _styleDescriptions[istd]; CharacterProperties chp = sd.GetCHP(); byte[] chpx = sd.GetCHPX(); int baseIndex = sd.GetBaseStyle(); if (baseIndex == istd) { // Oh dear, this isn't allowed... // The word file seems to be corrupted // Switch to using the nil style so that // there's a chance we can read it baseIndex = NIL_STYLE; } // Build and decompress the Chp if required if (chp == null && chpx != null) { CharacterProperties parentCHP = new CharacterProperties(); if (baseIndex != NIL_STYLE) { parentCHP = _styleDescriptions[baseIndex].GetCHP(); if (parentCHP == null) { CreateChp(baseIndex); parentCHP = _styleDescriptions[baseIndex].GetCHP(); } } chp = CharacterSprmUncompressor.UncompressCHP(parentCHP, chpx, 0); sd.SetCHP(chp); } }
/** * * @param chpx The chpx this object is based on. * @param ss The stylesheet for the document this run belongs to. * @param istd The style index if this Run's base style. * @param parent The parent range of this character run (usually a paragraph). */ internal CharacterRun(CHPX chpx, StyleSheet ss, short istd, Range parent) : base(Math.Max(parent._start, chpx.Start), Math.Min(parent._end, chpx.End), parent) { _props = chpx.GetCharacterProperties(ss, istd); _chpx = chpx.GetSprmBuf(); }