Commit ab2461a5 authored by ElenaSubbotina's avatar ElenaSubbotina

DocFormatReader - format before 1996 - fix formating text

parent 6f9ce15f
...@@ -35,434 +35,596 @@ namespace DocFileFormat ...@@ -35,434 +35,596 @@ namespace DocFileFormat
{ {
typedef enum OperationCode typedef enum OperationCode
{ {
//Paragraph SPRMs //verison 1995 and earler
sprmPIstd=0x4600, sprmOldPIstd = 2,
sprmPIstdPermute=0xC601, sprmOldPIstdPermute = 3,
sprmPIncLvl=0x2602, sprmOldPIncLv1 = 4,
sprmPJc=0x2461, sprmOldPJc = 5,
sprmPJc80=0x2403, sprmOldPFSideBySide = 6,
sprmPFSideBySide=0x2404, sprmOldPFKeep = 7,
sprmPFKeep=0x2405, sprmOldPFKeepFollow = 8,
sprmPFKeepFollow=0x2406, sprmOldPPageBreakBefore = 9,
sprmPFPageBreakBefore=0x2407, sprmOldPBrcl = 10,
sprmPBrcl=0x2408, sprmOldPBrcp = 11,
sprmPBrcp=0x2409, sprmOldPAnld = 12,
sprmPIlvl=0x260A, sprmOldPNLvlAnm = 13,
sprmPIlfo=0x460B, sprmOldPFNoLineNumb = 14,
sprmPFNoLineNumb=0x240C, sprmOldPChgTabsPapx = 15,
sprmPChgTabsPapx=0xC60D, sprmOldPDxaRight = 16,
sprmPDxaLeft=0x845e, sprmOldPDxaLeft = 17,
sprmPDxaLeft80=0x840f, sprmOldPNest = 18,
sprmPDxaLeft1=0x8460, sprmOldPDxaLeft1 = 19,
sprmPDxaLeft180=0x8411, sprmOldPDyaLine = 20,
sprmPDxaRight=0x845d, sprmOldPDyaBefore = 21,
sprmPDxaRight80=0x840e, sprmOldPDyaAfter = 22,
sprmPDxcLeft=0x4456, sprmOldPChgTabs = 23,
sprmPDxcLeft1=0x4457, sprmOldPFInTable = 24,
sprmPDxcRight=0x4455, sprmOldPTtp = 25,
sprmPNest=0x465f, sprmOldPDxaAbs = 26,
sprmPNest80=0x4610, sprmOldPDyaAbs = 27,
sprmPDyaLine=0x6412, sprmOldPDxaWidth = 28,
sprmPDyaBefore=0xA413, sprmOldPPc = 29,
sprmPDyaAfter=0xA414, sprmOldPBrcTop10 = 30,
sprmPFDyaAfterAuto=0x245c, sprmOldPBrcLeft10 = 31,
sprmPFDyaBeforeAuto=0x245b, sprmOldPBrcBottom10 = 32,
sprmPDylAfter=0x4459, sprmOldPBrcRight10 = 33,
sprmPDylBefore=0x4458, sprmOldPBrcBetween10 = 34,
sprmPChgTabs=0xC615, sprmOldPBrcBar10 = 35,
sprmPFInTable=0x2416, sprmOldPFromText10 = 36,
sprmPFTtp=0x2417, sprmOldPWr = 37,
sprmPDxaAbs=0x8418, sprmOldPBrcTop = 38,
sprmPDyaAbs=0x8419, sprmOldPBrcLeft = 39,
sprmPDxaWidth=0x841A, sprmOldPBrcBottom = 40,
sprmPPc=0x261B, sprmOldPBrcRight = 41,
sprmPBrcTop10=0x461C, sprmOldPBrcBetween = 42,
sprmPBrcLeft10=0x461D, sprmOldPBrcBar = 43,
sprmPBrcBottom10=0x461E, sprmOldPFNoAutoHyph = 44,
sprmPBrcRight10=0x461F, sprmOldPWHeightAbs = 45,
sprmPBrcBetween10=0x4620, sprmOldPDcs = 46,
sprmPBrcBar10=0x4621, sprmOldPShd = 47,
sprmPDxaFromText10=0x4622, sprmOldPDyaFromText = 48,
sprmPWr=0x2423, sprmOldPDxaFromText = 49,
sprmPBrcBar=0xc653, sprmOldPFLocked = 50,
sprmPBrcBar70=0x4629, sprmOldPFWidowControl = 51,
sprmPBrcBar80=0x6629, sprmOldPRuler = 52,
sprmPBrcBetween=0xc652, sprmOldCFStrikeRM = 65,
sprmPBrcBetween70=0x4428, sprmOldCFRMark = 66,
sprmPBrcBetween80=0x6428, sprmOldCFFldVanish = 67,
sprmPBrcBottom=0xc650, sprmOldCPicLocation = 68,
sprmPBrcBottom70=0x4426, sprmOldCIbstRMark = 69,
sprmPBrcBottom80=0x6426, sprmOldCDttmRMark = 70,
sprmPBrcLeft=0xc64f, sprmOldCFData = 71,
sprmPBrcLeft70=0x4425, sprmOldCRMReason = 72,
sprmPBrcLeft80=0x6425, sprmOldCChse = 73,
sprmPBrcRight=0xc651, sprmOldCSymbol = 74,
sprmPBrcRight70=0x4427, sprmOldCFOle2 = 75,
sprmPBrcRight80=0x6427, sprmOldCIstd = 80,
sprmPBrcTop=0xc64e, sprmOldCIstdPermute = 81,
sprmPBrcTop70=0x4424, sprmOldCDefault = 82,
sprmPBrcTop80=0x6424, sprmOldCPlain = 83,
sprmPFNoAutoHyph=0x242A, sprmOldCFBold = 85,
sprmPWHeightAbs=0x442B, sprmOldCFItalic = 86,
sprmPDcs=0x442C, sprmOldCFStrike = 87,
sprmPShd80=0x442D, sprmOldCFOutline = 88,
sprmPShd=0xc64d, sprmOldCFShadow = 89,
sprmPDyaFromText=0x842E, sprmOldCFSmallCaps = 90,
sprmPDxaFromText=0x842F, sprmOldCFCaps = 91,
sprmPFLocked=0x2430, sprmOldCFVanish = 92,
sprmPFWidowControl=0x2431, sprmOldCFtc = 93,
sprmPRuler=0xC632, sprmOldCKul = 94,
sprmPFKinsoku=0x2433, sprmOldCSizePos = 95,
sprmPFWordWrap=0x2434, sprmOldCDxaSpace = 96,
sprmPFOverflowPunct=0x2435, sprmOldCLid = 97,
sprmPFTopLinePunct=0x2436, sprmOldCIco = 98,
sprmPFAutoSpaceDE=0x2437, sprmOldCHps = 99,
sprmPFAutoSpaceDN=0x2438, sprmOldCHpsInc = 100,
sprmPWAlignFont=0x4439, sprmOldCHpsPos = 101,
sprmPFrameTextFlow=0x443A, sprmOldCHpsPosAdj = 102,
sprmPISnapBaseLine=0x243B, sprmOldCMajority = 103,
sprmPAnld80=0xC63E, sprmOldCIss = 104,
sprmPAnldCv=0x6654, sprmOldCHpsNew50 = 105,
sprmPPropRMark=0xC63F, sprmOldCHpsInc1 = 106,
sprmPOutLvl=0x2640, sprmOldCHpsKern = 107,
sprmPFBiDi=0x2441, sprmOldCMajority50 = 108,
sprmPFNumRMIns=0x2443, sprmOldCHpsMul = 109,
sprmPNumRM=0xC645, sprmOldCCondHyhen = 110,
sprmPHugePapx=0x6645, sprmOldCFSpec = 117,
sprmPFUsePgsuSettings=0x2447, sprmOldCFObj = 118,
sprmPFAdjustRight=0x2448, sprmOldPicBrcl = 119,
sprmPDtap=0x664a, sprmOldPicScale = 120,
sprmPFInnerTableCell=0x244b, sprmOldPicBrcTop = 121,
sprmPFInnerTtp=0x244c, sprmOldPicBrcLeft = 122,
sprmPFNoAllowOverlap=0x2462, sprmOldPicBrcBottom = 123,
sprmPItap=0x6649, sprmOldPicBrcRight = 124,
sprmPWall=0x2664, sprmOldSScnsPgn = 131,
sprmPIpgp=0x6465, sprmOldSiHeadingPgn = 132,
sprmPCnf=0xc666, sprmOldSOlstAnm = 133,
sprmPRsid=0x6467, sprmOldSDxaColWidth = 136,
sprmPIstdList=0x4468, sprmOldSDxaColSpacing = 137,
sprmPIstdListPermute=0xc669, sprmOldSFEvenlySpaced = 138,
sprmPDyaBeforeNotCp0=0xa46a, sprmOldSFProtected = 139,
sprmPTableProps=0x646b, sprmOldSDmBinFirst = 140,
sprmPTIstdInfo=0xc66c, sprmOldSDmBinOther = 141,
sprmPFContextualSpacing=0x246d, sprmOldSBkc = 142,
sprmPRpf=0x246e, sprmOldSFTitlePage = 143,
sprmPPropRMark90=0xc66f, sprmOldSCcolumns = 144,
sprmOldSDxaColumns = 145,
sprmOldSFAutoPgn = 146,
sprmOldSNfcPgn = 147,
sprmOldSDyaPgn = 148,
sprmOldSDxaPgn = 149,
sprmOldSFPgnRestart = 150,
sprmOldSFEndnote = 151,
sprmOldSLnc = 152,
sprmOldSGprfIhdt = 153,
sprmOldSNLnnMod = 154,
sprmOldSDxaLnn = 155,
sprmOldSDyaHdrTop = 156,
sprmOldSDyaHdrBottom = 157,
sprmOldSLBetween = 158,
sprmOldSVjc = 159,
sprmOldSLnnMin = 160,
sprmOldSPgnStart = 161,
sprmOldSBOrientation = 162,
sprmOldSBCustomize = 163,
sprmOldSXaPage = 164,
sprmOldSYaPage = 165,
sprmOldSDxaLeft = 166,
sprmOldSDxaRight = 167,
sprmOldSDyaTop = 168,
sprmOldSDyaBottom = 169,
sprmOldSDzaGutter = 170,
sprmOldSDMPaperReq = 171,
sprmOldTJc = 182,
sprmOldTDxaLeft = 183,
sprmOldTDxaGapHalf = 184,
sprmOldTFCantSplit = 185,
sprmOldTTableHeader = 186,
sprmOldTTableBorders = 187,
sprmOldTDefTable10 = 188,
sprmOldTDyaRowHeight = 189,
sprmOldTDefTable = 190,
sprmOldTDefTableShd = 191,
sprmOldTTlp = 192,
sprmOldTSetBrc = 193,
sprmOldTInsert = 194,
sprmOldTDelete = 195,
sprmOldTDxaCol = 196,
sprmOldTMerge = 197,
sprmOldTSplit = 198,
sprmOldTSetBrc10 = 199,
sprmOldTSetShd = 200,
sprmOldMax = 208,
//Character SPRMs //version 1996 and later
sprmCFRMarkDel=0x0800, //Paragraph sprmOlds
sprmCFRMark=0x0801, sprmPIstd = 0x4600,
sprmCFFldVanish=0x0802, sprmPIstdPermute = 0xC601,
sprmCFSdtVanish=0x2A90, sprmPIncLvl = 0x2602,
sprmCPicLocation=0x6A03, sprmPJc = 0x2461,
sprmCIbstRMark=0x4804, sprmPJc80 = 0x2403,
sprmCDttmRMark=0x6805, sprmPFSideBySide = 0x2404,
sprmCFData=0x0806, sprmPFKeep = 0x2405,
sprmCIdslRMark=0x4807, sprmPFKeepFollow = 0x2406,
sprmCChs=0xEA08, sprmPFPageBreakBefore = 0x2407,
sprmCSymbol=0x6A09, sprmPBrcl = 0x2408,
sprmCFOle2=0x080A, sprmPBrcp = 0x2409,
sprmCIdCharType=0x480B, sprmPIlvl = 0x260A,
sprmCHighlight=0x2A0C, sprmPIlfo = 0x460B,
sprmCObjLocation=0x680E, sprmPFNoLineNumb = 0x240C,
sprmCObjpLocation=0x680e, sprmPChgTabsPapx = 0xC60D,
sprmCFFtcAsciSymb=0x2A10, sprmPDxaLeft = 0x845e,
sprmCIstd=0x4A30, sprmPDxaLeft80 = 0x840f,
sprmCIstdPermute=0xCA31, sprmPDxaLeft1 = 0x8460,
sprmCDefault=0x2A32, sprmPDxaLeft180 = 0x8411,
sprmCPlain=0x2A33, sprmPDxaRight = 0x845d,
sprmCKcd=0x2A34, sprmPDxaRight80 = 0x840e,
sprmCFBold=0x0835, sprmPDxcLeft = 0x4456,
sprmCFItalic=0x0836, sprmPDxcLeft1 = 0x4457,
sprmCFStrike=0x0837, sprmPDxcRight = 0x4455,
sprmCFOutline=0x0838, sprmPNest = 0x465f,
sprmCFShadow=0x0839, sprmPNest80 = 0x4610,
sprmCFSmallCaps=0x083A, sprmPDyaLine = 0x6412,
sprmCFCaps=0x083B, sprmPDyaBefore = 0xA413,
sprmCFVanish=0x083C, sprmPDyaAfter = 0xA414,
sprmCFtcDefault=0x4A3D, sprmPFDyaAfterAuto = 0x245c,
sprmCKul=0x2A3E, sprmPFDyaBeforeAuto = 0x245b,
sprmCSizePos=0xEA3F, sprmPDylAfter = 0x4459,
sprmCDxaSpace=0x8840, sprmPDylBefore = 0x4458,
sprmCLid=0x4A41, sprmPChgTabs = 0xC615,
sprmCIco=0x2A42, sprmPFInTable = 0x2416,
sprmCHps=0x4A43, sprmPFTtp = 0x2417,
sprmCHpsInc=0x2A44, sprmPDxaAbs = 0x8418,
sprmCHpsPos=0x4845, sprmPDyaAbs = 0x8419,
sprmCHpsPosAdj=0x2A46, sprmPDxaWidth = 0x841A,
sprmCMajority=0xCA47, sprmPPc = 0x261B,
sprmCIss=0x2A48, sprmPBrcTop10 = 0x461C,
sprmCHpsNew50=0xCA49, sprmPBrcLeft10 = 0x461D,
sprmCHpsInc1=0xCA4A, sprmPBrcBottom10 = 0x461E,
sprmCHpsKern=0x484B, sprmPBrcRight10 = 0x461F,
sprmCMajority50=0xCA4C, sprmPBrcBetween10 = 0x4620,
sprmCHpsMul=0x4A4D, sprmPBrcBar10 = 0x4621,
sprmCHresi=0x484e, sprmPDxaFromText10 = 0x4622,
sprmCRgFtc0=0x4A4F, sprmPWr = 0x2423,
sprmCRgFtc1=0x4A50, sprmPBrcBar = 0xc653,
sprmCRgFtc2=0x4A51, sprmPBrcBar70 = 0x4629,
sprmCCharScale=0x4852, sprmPBrcBar80 = 0x6629,
sprmCFDStrike=0x2A53, sprmPBrcBetween = 0xc652,
sprmCFImprint=0x0854, sprmPBrcBetween70 = 0x4428,
sprmCFSpec=0x0855, sprmPBrcBetween80 = 0x6428,
sprmCFObj=0x0856, sprmPBrcBottom = 0xc650,
sprmCPropRMark1=0xCA57, sprmPBrcBottom70 = 0x4426,
sprmCFEmboss=0x0858, sprmPBrcBottom80 = 0x6426,
sprmCSfxText=0x2859, sprmPBrcLeft = 0xc64f,
sprmCFBiDi=0x085A, sprmPBrcLeft70 = 0x4425,
sprmCFDiacColor=0x085B, sprmPBrcLeft80 = 0x6425,
sprmCFBoldBi=0x085C, sprmPBrcRight = 0xc651,
sprmCFItalicBi=0x085D, sprmPBrcRight70 = 0x4427,
sprmCFtcBi=0x4A5E, sprmPBrcRight80 = 0x6427,
sprmCLidBi=0x485F, sprmPBrcTop = 0xc64e,
sprmCIcoBi=0x4A60, sprmPBrcTop70 = 0x4424,
sprmCHpsBi=0x4A61, sprmPBrcTop80 = 0x6424,
sprmCDispFldRMark=0xCA62, sprmPFNoAutoHyph = 0x242A,
sprmCIbstRMarkDel=0x4863, sprmPWHeightAbs = 0x442B,
sprmCDttmRMarkDel=0x6864, sprmPDcs = 0x442C,
sprmCBrc80=0x6865, sprmPShd80 = 0x442D,
sprmCBrc=0xca72, sprmPShd = 0xc64d,
sprmCShd80=0x4866, sprmPDyaFromText = 0x842E,
sprmCShd=0xca71, sprmPDxaFromText = 0x842F,
sprmCIdslRMarkDel=0x4867, sprmPFLocked = 0x2430,
sprmCFUsePgsuSettings=0x0868, sprmPFWidowControl = 0x2431,
sprmCCpg=0x486B, sprmPRuler = 0xC632,
sprmCRgLid0_80=0x486D, sprmPFKinsoku = 0x2433,
sprmCRgLid0=0x4873, sprmPFWordWrap = 0x2434,
sprmCRgLid1_80=0x486E, sprmPFOverflowPunct = 0x2435,
sprmCRgLid1=0x4874, sprmPFTopLinePunct = 0x2436,
sprmCIdctHint=0x286F, sprmPFAutoSpaceDE = 0x2437,
sprmCCv=0x6870, sprmPFAutoSpaceDN = 0x2438,
sprmCCvPermute=0xca7c, sprmPWAlignFont = 0x4439,
sprmCCvUl=0x6877, sprmPFrameTextFlow = 0x443A,
sprmCFBoldPresent=0x287d, sprmPISnapBaseLine = 0x243B,
sprmCFELayout=0xca78, sprmPAnld80 = 0xC63E,
sprmCFItalicPresent=0x287e, sprmPAnldCv = 0x6654,
sprmCFitText=0xca76, sprmPPropRMark = 0xC63F,
sprmCFLangApplied=0x2a7a, sprmPOutLvl = 0x2640,
sprmCFNoProof=0x875, sprmPFBiDi = 0x2441,
sprmCFWebHidden=0x811, sprmPFNumRMIns = 0x2443,
sprmCHsp=0x6a12, sprmPNumRM = 0xC645,
sprmCLbcCRJ=0x2879, sprmPHugePapx = 0x6645,
sprmCNewIbstRM=0xca13, sprmPFUsePgsuSettings = 0x2447,
sprmCTransNoProof0=0x287f, sprmPFAdjustRight = 0x2448,
sprmCTransNoProof1=0x2880, sprmPDtap = 0x664a,
sprmCFRMMove=0x2814, sprmPFInnerTableCell = 0x244b,
sprmCRsidProp=0x6815, sprmPFInnerTtp = 0x244c,
sprmCRsidText=0x6816, sprmPFNoAllowOverlap = 0x2462,
sprmCRsidRMDel=0x6817, sprmPItap = 0x6649,
sprmCFSpecVanish=0x0818, sprmPWall = 0x2664,
sprmCFComplexScripts=0x0882, sprmPIpgp = 0x6465,
sprmCWall=0x2a83, sprmPCnf = 0xc666,
sprmCPbi=0xca84, sprmPRsid = 0x6467,
sprmCCnf=0xca85, sprmPIstdList = 0x4468,
sprmCNeedFontFixup=0x2a86, sprmPIstdListPermute = 0xc669,
sprmCPbiIBullet=0x6887, sprmPDyaBeforeNotCp0 = 0xa46a,
sprmCPbiGrf=0x4888, sprmPTableProps = 0x646b,
sprmCPropRMark2=0xca89, sprmPTIstdInfo = 0xc66c,
sprmPFContextualSpacing = 0x246d,
sprmPRpf = 0x246e,
sprmPPropRMark90 = 0xc66f,
//Picture SPRMs //Character sprms
sprmPicBrcl=0x2E00, sprmCFRMarkDel = 0x0800,
sprmPicScale=0xCE01, sprmCFRMark = 0x0801,
sprmPicBrcTop80=0x6C02, sprmCFFldVanish = 0x0802,
sprmPicBrcBottom=0xce0a, sprmCFSdtVanish = 0x2A90,
sprmPicBrcBottom70=0x4c04, sprmCPicLocation = 0x6A03,
sprmPicBrcLeft80=0x6C03, sprmCIbstRMark = 0x4804,
sprmPicBrcLeft=0xce09, sprmCDttmRMark = 0x6805,
sprmPicBrcLeft70=0x4c03, sprmCFData = 0x0806,
sprmPicBrcBottom80=0x6C04, sprmCIdslRMark = 0x4807,
sprmPicBrcRight=0xce0b, sprmCChs = 0xEA08,
sprmPicBrcRight70=0x4c05, sprmCSymbol = 0x6A09,
sprmPicBrcRight80=0x6C05, sprmCFOle2 = 0x080A,
sprmPicBrcTop=0xce08, sprmCIdCharType = 0x480B,
sprmPicBrcTop70=0x4c02, sprmCHighlight = 0x2A0C,
sprmPicSpare4=0xce06, sprmCObjLocation = 0x680E,
sprmCFOle2WasHere=0xce07, sprmCObjpLocation = 0x680e,
sprmCFFtcAsciSymb = 0x2A10,
sprmCIstd = 0x4A30,
sprmCIstdPermute = 0xCA31,
sprmCDefault = 0x2A32,
sprmCPlain = 0x2A33,
sprmCKcd = 0x2A34,
sprmCFBold = 0x0835,
sprmCFItalic = 0x0836,
sprmCFStrike = 0x0837,
sprmCFOutline = 0x0838,
sprmCFShadow = 0x0839,
sprmCFSmallCaps = 0x083A,
sprmCFCaps = 0x083B,
sprmCFVanish = 0x083C,
sprmCFtcDefault = 0x4A3D,
sprmCKul = 0x2A3E,
sprmCSizePos = 0xEA3F,
sprmCDxaSpace = 0x8840,
sprmCLid = 0x4A41,
sprmCIco = 0x2A42,
sprmCHps = 0x4A43,
sprmCHpsInc = 0x2A44,
sprmCHpsPos = 0x4845,
sprmCHpsPosAdj = 0x2A46,
sprmCMajority = 0xCA47,
sprmCIss = 0x2A48,
sprmCHpsNew50 = 0xCA49,
sprmCHpsInc1 = 0xCA4A,
sprmCHpsKern = 0x484B,
sprmCMajority50 = 0xCA4C,
sprmCHpsMul = 0x4A4D,
sprmCHresi = 0x484e,
sprmCRgFtc0 = 0x4A4F,
sprmCRgFtc1 = 0x4A50,
sprmCRgFtc2 = 0x4A51,
sprmCCharScale = 0x4852,
sprmCFDStrike = 0x2A53,
sprmCFImprint = 0x0854,
sprmCFSpec = 0x0855,
sprmCFObj = 0x0856,
sprmCPropRMark1 = 0xCA57,
sprmCFEmboss = 0x0858,
sprmCSfxText = 0x2859,
sprmCFBiDi = 0x085A,
sprmCFDiacColor = 0x085B,
sprmCFBoldBi = 0x085C,
sprmCFItalicBi = 0x085D,
sprmCFtcBi = 0x4A5E,
sprmCLidBi = 0x485F,
sprmCIcoBi = 0x4A60,
sprmCHpsBi = 0x4A61,
sprmCDispFldRMark = 0xCA62,
sprmCIbstRMarkDel = 0x4863,
sprmCDttmRMarkDel = 0x6864,
sprmCBrc80 = 0x6865,
sprmCBrc = 0xca72,
sprmCShd80 = 0x4866,
sprmCShd = 0xca71,
sprmCIdslRMarkDel = 0x4867,
sprmCFUsePgsuSettings = 0x0868,
sprmCCpg = 0x486B,
sprmCRgLid0_80 = 0x486D,
sprmCRgLid0 = 0x4873,
sprmCRgLid1_80 = 0x486E,
sprmCRgLid1 = 0x4874,
sprmCIdctHint = 0x286F,
sprmCCv = 0x6870,
sprmCCvPermute = 0xca7c,
sprmCCvUl = 0x6877,
sprmCFBoldPresent = 0x287d,
sprmCFELayout = 0xca78,
sprmCFItalicPresent = 0x287e,
sprmCFitText = 0xca76,
sprmCFLangApplied = 0x2a7a,
sprmCFNoProof = 0x875,
sprmCFWebHidde = 0x811,
sprmCHsp = 0x6a12,
sprmCLbcCRJ = 0x2879,
sprmCNewIbstRM = 0xca13,
sprmCTransNoProof0 = 0x287f,
sprmCTransNoProof1 = 0x2880,
sprmCFRMMove = 0x2814,
sprmCRsidProp = 0x6815,
sprmCRsidText = 0x6816,
sprmCRsidRMDel = 0x6817,
sprmCFSpecVanish = 0x0818,
sprmCFComplexScripts = 0x0882,
sprmCWall = 0x2a83,
sprmCPbi = 0xca84,
sprmCCnf = 0xca85,
sprmCNeedFontFixup = 0x2a86,
sprmCPbiIBullet = 0x6887,
sprmCPbiGrf = 0x4888,
sprmCPropRMark2 = 0xca89,
//Section SPRMs //Picture sprms
sprmScnsPgn=0x3000, sprmPicBrcl = 0x2E00,
sprmSiHeadingPgn=0x3001, sprmPicScale = 0xCE01,
sprmSOlstAnm=0xD202, sprmPicBrcTop80 = 0x6C02,
sprmSOlstAnm80=0xd202, sprmPicBrcBottom = 0xce0a,
sprmSOlstCv=0xd238, sprmPicBrcBottom70 = 0x4c04,
sprmSDxaColWidth=0xF203, sprmPicBrcLeft80 = 0x6C03,
sprmSDxaColSpacing=0xF204, sprmPicBrcLeft = 0xce09,
sprmSFEvenlySpaced=0x3005, sprmPicBrcLeft70 = 0x4c03,
sprmSFProtected=0x3006, sprmPicBrcBottom80 = 0x6C04,
sprmSDmBinFirst=0x5007, sprmPicBrcRight = 0xce0b,
sprmSDmBinOther=0x5008, sprmPicBrcRight70 = 0x4c05,
sprmSBkc=0x3009, sprmPicBrcRight80 = 0x6C05,
sprmSFTitlePage=0x300A, sprmPicBrcTop = 0xce08,
sprmSCcolumns=0x500B, sprmPicBrcTop70 = 0x4c02,
sprmSDxaColumns=0x900C, sprmPicSpare4 = 0xce06,
sprmSFAutoPgn=0x300D, sprmCFOle2WasHere = 0xce07,
sprmSNfcPgn=0x300E,
sprmSDyaPgn=0xB00F,
sprmSDxaPgn=0xB010,
sprmSFPgnRestart=0x3011,
sprmSFEndnote=0x3012,
sprmSLnc=0x3013,
sprmSGprfIhdt=0x3014,
sprmSNLnnMod=0x5015,
sprmSDxaLnn=0x9016,
sprmSDyaHdrTop=0xB017,
sprmSDyaHdrBottom=0xB018,
sprmSLBetween=0x3019,
sprmSVjc=0x301A,
sprmSLnnMin=0x501B,
sprmSPgnStart=0x501C,
sprmSBOrientation=0x301D,
sprmSXaPage=0xB01F,
sprmSYaPage=0xB020,
sprmSDxaLeft=0xB021,
sprmSDxaRight=0xB022,
sprmSDyaTop=0x9023,
sprmSDyaBottom=0x9024,
sprmSDzaGutter=0xB025,
sprmSDmPaperReq=0x5026,
sprmSPropRMark1=0xD227,
sprmSFBiDi=0x3228,
sprmSFFacingCol=0x3229,
sprmSFRTLGutter=0x322A,
sprmSBrcTop80=0x702B,
sprmSBrcTop=0xd234,
sprmSBrcLeft80=0x702C,
sprmSBrcLeft=0xd235,
sprmSBrcBottom80=0x702d,
sprmSBrcBottom=0xd236,
sprmSBrcRight80=0x702e,
sprmSBrcRight=0xd237,
sprmSPgbProp=0x522F,
sprmSDxtCharSpace=0x7030,
sprmSDyaLinePitch=0x9031,
sprmSClm=0x5032,
sprmSTextFlow=0x5033,
sprmSWall=0x3239,
sprmSRsid=0x703a,
sprmSFpc=0x303b,
sprmSRncFtn=0x303c,
sprmSEpc=0x303d,
sprmSRncEdn=0x303e,
sprmSNFtn=0x503f,
sprmSNfcFtnRef=0x5040,
sprmSNEdn=0x5041,
sprmSNfcEdnRef=0x5042,
sprmSPropRMark2=0xd243,
//Table SPRMs //Section sprms
sprmTDefTable=0xD608, sprmScnsPgn = 0x3000,
sprmTDefTable10=0xD606, sprmSiHeadingPgn = 0x3001,
sprmTDefTableShd80=0xD609, sprmSOlstAnm = 0xD202,
sprmTDefTableShd=0xd612, sprmSOlstAnm80 = 0xd202,
sprmTDefTableShd2nd=0xd616, sprmSOlstCv = 0xd238,
sprmTDefTableShd3rd=0xd60c, sprmSDxaColWidth = 0xF203,
sprmTDelete=0x5622, sprmSDxaColSpacing = 0xF204,
sprmTDiagLine=0xd630, sprmSFEvenlySpaced = 0x3005,
sprmTDiagLine80=0xd62a, sprmSFProtected = 0x3006,
sprmTDxaCol=0x7623, sprmSDmBinFirst = 0x5007,
sprmTDxaGapHalf=0x9602, sprmSDmBinOther = 0x5008,
sprmTDxaLeft=0x9601, sprmSBkc = 0x3009,
sprmTDyaRowHeight=0x9407, sprmSFTitlePage = 0x300A,
sprmTFBiDi80=0x560b, sprmSCcolumns = 0x500B,
sprmTFCantSplit=0x3403, sprmSDxaColumns = 0x900C,
sprmTHTMLProps=0x740C, sprmSFAutoPgn = 0x300D,
sprmTInsert=0x7621, sprmSNfcPgn = 0x300E,
sprmTJc=0x5400, sprmSDyaPgn = 0xB00F,
sprmTMerge=0x5624, sprmSDxaPgn = 0xB010,
sprmTSetBrc80=0xD620, sprmSFPgnRestart = 0x3011,
sprmTSetBrc10=0xD626, sprmSFEndnote = 0x3012,
sprmTSetBrc=0xd62f, sprmSLnc = 0x3013,
sprmTSetShd80=0x7627, sprmSGprfIhdt = 0x3014,
sprmTSetShdOdd80=0x7628, sprmSNLnnMod = 0x5015,
sprmTSetShd=0xd62d, sprmSDxaLnn = 0x9016,
sprmTSetShdOdd=0xd62e, sprmSDyaHdrTop = 0xB017,
sprmTSetShdTable=0xd660, sprmSDyaHdrBottom = 0xB018,
sprmTSplit=0x5625, sprmSLBetween = 0x3019,
sprmTTableBorders=0xd613, sprmSVjc = 0x301A,
sprmTTableBorders80=0xd605, sprmSLnnMin = 0x501B,
sprmTTableHeader=0x3404, sprmSPgnStart = 0x501C,
sprmTTextFlow=0x7629, sprmSBOrientation = 0x301D,
sprmTTlp=0x740A, sprmSXaPage = 0xB01F,
sprmTVertAlign=0xD62C, sprmSYaPage = 0xB020,
sprmTVertMerge=0xD62B, sprmSDxaLeft = 0xB021,
sprmTFCellNoWrap=0xd639, sprmSDxaRight = 0xB022,
sprmTFitText=0xf636, sprmSDyaTop = 0x9023,
sprmTFKeepFollow=0x3619, sprmSDyaBottom = 0x9024,
sprmTFNeverBeenAutofit=0x3663, sprmSDzaGutter = 0xB025,
sprmTFNoAllowOverlap=0x3465, sprmSDmPaperReq = 0x5026,
sprmTPc=0x360d, sprmSPropRMark1 = 0xD227,
sprmTBrcBottomCv=0xd61c, sprmSFBiDi = 0x3228,
sprmTBrcLeftCv=0xd61b, sprmSFFacingCol = 0x3229,
sprmTBrcRightCv=0xd61d, sprmSFRTLGutter = 0x322A,
sprmTBrcTopCv=0xd61a, sprmSBrcTop80 = 0x702B,
sprmTCellBrcType=0xd662, sprmSBrcTop = 0xd234,
sprmTCellPadding=0xd632, sprmSBrcLeft80 = 0x702C,
sprmTCellPaddingDefault=0xd634, sprmSBrcLeft = 0xd235,
sprmTCellPaddingOuter=0xd638, sprmSBrcBottom80 = 0x702d,
sprmTCellSpacing=0xd631, sprmSBrcBottom = 0xd236,
sprmTCellSpacingDefault=0xd633, sprmSBrcRight80 = 0x702e,
sprmTCellSpacingOuter=0xd637, sprmSBrcRight = 0xd237,
sprmTCellWidth=0xd635, sprmSPgbProp = 0x522F,
sprmTDxaAbs=0x940e, sprmSDxtCharSpace = 0x7030,
sprmTDxaFromText=0x9410, sprmSDyaLinePitch = 0x9031,
sprmTDxaFromTextRight=0x941e, sprmSClm = 0x5032,
sprmTDyaAbs=0x940f, sprmSTextFlow = 0x5033,
sprmTDyaFromText=0x9411, sprmSWall = 0x3239,
sprmTDyaFromTextBottom=0x941f, sprmSRsid = 0x703a,
sprmTFAutofit=0x3615, sprmSFpc = 0x303b,
sprmTTableWidth=0xf614, sprmSRncFtn = 0x303c,
sprmTWidthAfter=0xf618, sprmSEpc = 0x303d,
sprmTWidthBefore=0xf617, sprmSRncEdn = 0x303e,
sprmTWidthIndent=0xf661, sprmSNFtn = 0x503f,
sprmTIstd=0x563a, sprmSNfcFtnRef = 0x5040,
sprmTSetShdRaw=0xd63b, sprmSNEdn = 0x5041,
sprmTSetShdOddRaw=0xd63c, sprmSNfcEdnRef = 0x5042,
sprmTIstdPermute=0xd63d, sprmSPropRMark2 = 0xd243,
sprmTCellPaddingStyle=0xd63e,
sprmTFCantSplit90=0x3466, //Table sprms
sprmTPropRMark=0xd667, sprmTDefTable = 0xD608,
sprmTWall=0x3668, sprmTDefTable10 = 0xD606,
sprmTIpgp=0x7469, sprmTDefTableShd80 = 0xD609,
sprmTCnf=0xd66a, sprmTDefTableShd = 0xd612,
sprmTSetShdTableDef=0xd66b, sprmTDefTableShd2nd = 0xd616,
sprmTDiagLine2nd=0xd66c, sprmTDefTableShd3rd = 0xd60c,
sprmTDiagLine3rd=0xd66d, sprmTDelete = 0x5622,
sprmTDiagLine4th=0xd66e, sprmTDiagLine = 0xd630,
sprmTDiagLine5th=0xd66f, sprmTDiagLine80 = 0xd62a,
sprmTDefTableShdRaw=0xd670, sprmTDxaCol = 0x7623,
sprmTDefTableShdRaw2nd=0xd671, sprmTDxaGapHalf = 0x9602,
sprmTDefTableShdRaw3rd=0xd672, sprmTDxaLeft = 0x9601,
sprmTSetShdRowFirst=0xd673, sprmTDyaRowHeight = 0x9407,
sprmTSetShdRowLast=0xd674, sprmTFBiDi80 = 0x560b,
sprmTSetShdColFirst=0xd675, sprmTFCantSplit = 0x3403,
sprmTSetShdColLast=0xd676, sprmTHTMLProps = 0x740C,
sprmTSetShdBand1=0xd677, sprmTInsert = 0x7621,
sprmTSetShdBand2=0xd678, sprmTJc = 0x5400,
sprmTRsid=0x7479, sprmTMerge = 0x5624,
sprmTCellWidthStyle=0xf47a, sprmTSetBrc80 = 0xD620,
sprmTCellPaddingStyleBad=0xd67b, sprmTSetBrc10 = 0xD626,
sprmTCellVertAlignStyle=0x347c, sprmTSetBrc = 0xd62f,
sprmTCellNoWrapStyle=0x347d, sprmTSetShd80 = 0x7627,
sprmTCellFitTextStyle=0x347e, sprmTSetShdOdd80 = 0x7628,
sprmTCellBrcTopStyle=0xd47f, sprmTSetShd = 0xd62d,
sprmTCellBrcBottomStyle=0xd680, sprmTSetShdOdd = 0xd62e,
sprmTCellBrcLeftStyle=0xd681, sprmTSetShdTable = 0xd660,
sprmTCellBrcRightStyle=0xd682, sprmTSplit = 0x5625,
sprmTCellBrcInsideHStyle=0xd683, sprmTTableBorders = 0xd613,
sprmTCellBrcInsideVStyle=0xd684, sprmTTableBorders80 = 0xd605,
sprmTCellBrcTL2BRStyle=0xd685, sprmTTableHeader = 0x3404,
sprmTCellBrcTR2BLStyle=0xd686, sprmTTextFlow = 0x7629,
sprmTCellShdStyle=0xd687, sprmTTlp = 0x740A,
sprmTCHorzBands=0x3488, sprmTVertAlign = 0xD62C,
sprmTCVertBands=0x3489, sprmTVertMerge = 0xD62B,
sprmTJcRow=0x548a, sprmTFCellNoWrap = 0xd639,
sprmTTableBrcTop=0xd68b, sprmTFitText = 0xf636,
sprmTTableBrcLeft=0xd68c, sprmTFKeepFollow = 0x3619,
sprmTTableBrcBottom=0xd68d, sprmTFNeverBeenAutofit = 0x3663,
sprmTTableBrcRight=0xd68e, sprmTFNoAllowOverlap = 0x3465,
sprmTTableBrcInsideH=0xd68f, sprmTPc = 0x360d,
sprmTTableBrcInsideV=0xd690, sprmTBrcBottomCv = 0xd61c,
sprmTFBiDi=0x560b, sprmTBrcLeftCv = 0xd61b,
sprmTFBiDi90=0x5664 sprmTBrcRightCv = 0xd61d,
sprmTBrcTopCv = 0xd61a,
sprmTCellBrcType = 0xd662,
sprmTCellPadding = 0xd632,
sprmTCellPaddingDefault = 0xd634,
sprmTCellPaddingOuter = 0xd638,
sprmTCellSpacing = 0xd631,
sprmTCellSpacingDefault = 0xd633,
sprmTCellSpacingOuter = 0xd637,
sprmTCellWidth = 0xd635,
sprmTDxaAbs = 0x940e,
sprmTDxaFromText = 0x9410,
sprmTDxaFromTextRight = 0x941e,
sprmTDyaAbs = 0x940f,
sprmTDyaFromText = 0x9411,
sprmTDyaFromTextBottom = 0x941f,
sprmTFAutofit = 0x3615,
sprmTTableWidth = 0xf614,
sprmTWidthAfter = 0xf618,
sprmTWidthBefore = 0xf617,
sprmTWidthIndent = 0xf661,
sprmTIstd = 0x563a,
sprmTSetShdRaw = 0xd63b,
sprmTSetShdOddRaw = 0xd63c,
sprmTIstdPermute = 0xd63d,
sprmTCellPaddingStyle = 0xd63e,
sprmTFCantSplit90 = 0x3466,
sprmTPropRMark = 0xd667,
sprmTWall = 0x3668,
sprmTIpgp = 0x7469,
sprmTCnf = 0xd66a,
sprmTSetShdTableDef = 0xd66b,
sprmTDiagLine2nd = 0xd66c,
sprmTDiagLine3rd = 0xd66d,
sprmTDiagLine4th = 0xd66e,
sprmTDiagLine5th = 0xd66f,
sprmTDefTableShdRaw = 0xd670,
sprmTDefTableShdRaw2nd = 0xd671,
sprmTDefTableShdRaw3rd = 0xd672,
sprmTSetShdRowFirst = 0xd673,
sprmTSetShdRowLast = 0xd674,
sprmTSetShdColFirst = 0xd675,
sprmTSetShdColLast = 0xd676,
sprmTSetShdBand1 = 0xd677,
sprmTSetShdBand2 = 0xd678,
sprmTRsid = 0x7479,
sprmTCellWidthStyle = 0xf47a,
sprmTCellPaddingStyleBad= 0xd67b,
sprmTCellVertAlignStyle = 0x347c,
sprmTCellNoWrapStyle = 0x347d,
sprmTCellFitTextStyle = 0x347e,
sprmTCellBrcTopStyle = 0xd47f,
sprmTCellBrcBottomStyle = 0xd680,
sprmTCellBrcLeftStyle = 0xd681,
sprmTCellBrcRightStyle = 0xd682,
sprmTCellBrcInsideHStyle= 0xd683,
sprmTCellBrcInsideVStyle= 0xd684,
sprmTCellBrcTL2BRStyle = 0xd685,
sprmTCellBrcTR2BLStyle = 0xd686,
sprmTCellShdStyle = 0xd687,
sprmTCHorzBands = 0x3488,
sprmTCVertBands = 0x3489,
sprmTJcRow = 0x548a,
sprmTTableBrcTop = 0xd68b,
sprmTTableBrcLeft = 0xd68c,
sprmTTableBrcBottom = 0xd68d,
sprmTTableBrcRight = 0xd68e,
sprmTTableBrcInsideH = 0xd68f,
sprmTTableBrcInsideV = 0xd690,
sprmTFBiDi = 0x560b,
sprmTFBiDi90 = 0x5664
} OperationCode; } OperationCode;
} }
\ No newline at end of file
...@@ -72,26 +72,24 @@ namespace DocFileFormat ...@@ -72,26 +72,24 @@ namespace DocFileFormat
void CharacterPropertiesMapping::Apply( IVisitable* chpx ) void CharacterPropertiesMapping::Apply( IVisitable* chpx )
{ {
//convert the normal SPRMS //convert the normal SPRMS
convertSprms( dynamic_cast<CharacterPropertyExceptions*>( chpx )->grpprl, this->_rPr ); convertSprms( dynamic_cast<CharacterPropertyExceptions*>( chpx )->grpprl, _rPr );
// apend revision changes // apend revision changes
if (_revisionData->Type == Changed) if (_revisionData->Type == Changed)
{ {
XMLTools::XMLElement<wchar_t> rPrChange( _T( "w:rPrChange" ) ); XMLTools::XMLElement<wchar_t> rPrChange( _T( "w:rPrChange" ) );
//!!!TODO!!! //todooo date - _revisionData->Dttm.Convert( new DateMapping( rPrChange ) );
//date
//_revisionData->Dttm.Convert( new DateMapping( rPrChange ) );
WideString* author_str = static_cast<WideString*>( this->_doc->RevisionAuthorTable->operator []( _revisionData->Isbt )); WideString* author_str = static_cast<WideString*>( _doc->RevisionAuthorTable->operator []( _revisionData->Isbt ));
XMLTools::XMLAttribute<wchar_t> author( _T( "w:author" ), FormatUtils::XmlEncode(*author_str).c_str()); XMLTools::XMLAttribute<wchar_t> author( _T( "w:author" ), FormatUtils::XmlEncode(*author_str).c_str());
rPrChange.AppendAttribute( author ); rPrChange.AppendAttribute( author );
//convert revision stack //convert revision stack
convertSprms( this->_revisionData->Changes, &rPrChange ); convertSprms( _revisionData->Changes, &rPrChange );
this->_rPr->AppendChild( rPrChange ); _rPr->AppendChild( rPrChange );
} }
//write properties //write properties
...@@ -107,7 +105,7 @@ namespace DocFileFormat ...@@ -107,7 +105,7 @@ namespace DocFileFormat
{ {
//Todo сделать определение симольного шрифта через fontManager //Todo сделать определение симольного шрифта через fontManager
//Заглушка под Google Docs, они пишут bullet в Arial //Заглушка под Google Docs, они пишут bullet в Arial
if (-1 != this->m_sAsciiFont.find (_T("Arial")) && -1 != this->m_sEastAsiaFont.find (_T("Arial")) && -1 != this->m_shAnsiFont.find (_T("Arial"))) if (-1 != m_sAsciiFont.find (_T("Arial")) && -1 != m_sEastAsiaFont.find (_T("Arial")) && -1 != m_shAnsiFont.find (_T("Arial")))
return false; return false;
return true; return true;
...@@ -119,7 +117,7 @@ namespace DocFileFormat ...@@ -119,7 +117,7 @@ namespace DocFileFormat
{ {
XMLTools::XMLElement<wchar_t> * rFonts = new XMLTools::XMLElement<wchar_t> ( _T( "w:rFonts" ) ); XMLTools::XMLElement<wchar_t> * rFonts = new XMLTools::XMLElement<wchar_t> ( _T( "w:rFonts" ) );
XMLTools::XMLElement<wchar_t> * color = new XMLTools::XMLElement<wchar_t> ( _T( "w:color" ) ); XMLTools::XMLElement<wchar_t> * color = new XMLTools::XMLElement<wchar_t> ( _T( "w:color" ) );
XMLTools::XMLAttribute<wchar_t> * colorVal = new XMLTools::XMLAttribute<wchar_t>( _T( "w:val" ) ); XMLTools::XMLAttribute<wchar_t> * colorVal = new XMLTools::XMLAttribute<wchar_t> ( _T( "w:val" ) );
XMLTools::XMLElement<wchar_t> * lang = new XMLTools::XMLElement<wchar_t> ( _T( "w:lang" ) ); XMLTools::XMLElement<wchar_t> * lang = new XMLTools::XMLElement<wchar_t> ( _T( "w:lang" ) );
if (_webHidden) if (_webHidden)
...@@ -131,57 +129,64 @@ namespace DocFileFormat ...@@ -131,57 +129,64 @@ namespace DocFileFormat
std::list<SinglePropertyModifier>::iterator end = sprms->end(); std::list<SinglePropertyModifier>::iterator end = sprms->end();
for (std::list<SinglePropertyModifier>::iterator iter = sprms->begin(); iter != end; ++iter) for (std::list<SinglePropertyModifier>::iterator iter = sprms->begin(); iter != end; ++iter)
{ {
int nProperty = 0; //for unknown test
switch ( (int)( iter->OpCode ) ) switch ( (int)( iter->OpCode ) )
{ {
case 0x4A30 : // style id case sprmOldCIstd :
case sprmCIstd : // style id
{ {
if (_isRunStyleNeeded && !_webHidden) if (_isRunStyleNeeded && !_webHidden)
{ {
_currentIstd = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize ); _currentIstd = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
if (_currentIstd < this->_doc->Styles->Styles->size()) if (_currentIstd < _doc->Styles->Styles->size())
{ {
appendValueElement( parent, _T( "rStyle" ), StyleSheetMapping::MakeStyleId( this->_doc->Styles->Styles->at( _currentIstd ) ).c_str(), true ); appendValueElement( parent, _T( "rStyle" ), StyleSheetMapping::MakeStyleId( _doc->Styles->Styles->at( _currentIstd ) ).c_str(), true );
} }
} }
}break; }break;
case 0x085A : // right to left
case sprmCFBiDi :
appendFlagElement( parent, *iter, _T( "rtl" ), true ); appendFlagElement( parent, *iter, _T( "rtl" ), true );
this->_isRTL = true; _isRTL = true;
break; break;
case 0x0835 : case sprmOldCFBold :
case sprmCFBold :
appendFlagElement( parent, *iter, _T( "b" ), true ); appendFlagElement( parent, *iter, _T( "b" ), true );
break; break;
case 0x085C : case sprmCFBoldBi :
appendFlagElement( parent, *iter, _T( "bCs" ), true ); appendFlagElement( parent, *iter, _T( "bCs" ), true );
break; break;
case 0x083B : case sprmOldCFCaps :
case sprmCFCaps :
appendFlagElement( parent, *iter, _T( "caps" ), true ); appendFlagElement( parent, *iter, _T( "caps" ), true );
break; break;
case 0x0882 : case sprmCFComplexScripts :
appendFlagElement( parent, *iter, _T( "cs" ), true ); appendFlagElement( parent, *iter, _T( "cs" ), true );
break; break;
case 0x2A53 : case sprmCFDStrike :
appendFlagElement( parent, *iter, _T( "dstrike" ), true ); appendFlagElement( parent, *iter, _T( "dstrike" ), true );
break; break;
case 0x0858 : case sprmCFEmboss :
appendFlagElement( parent, *iter, _T( "emboss" ), true ); appendFlagElement( parent, *iter, _T( "emboss" ), true );
break; break;
case 0x0854 : case sprmCFImprint :
appendFlagElement( parent, *iter, _T( "imprint" ), true ); appendFlagElement( parent, *iter, _T( "imprint" ), true );
break; break;
case 0x0836 : case sprmOldCFItalic :
case sprmCFItalic :
appendFlagElement( parent, *iter, _T( "i" ), true ); appendFlagElement( parent, *iter, _T( "i" ), true );
break; break;
case 0x085D: case sprmCFItalicBi:
appendFlagElement( parent, *iter, _T( "iCs" ), true ); appendFlagElement( parent, *iter, _T( "iCs" ), true );
break; break;
...@@ -189,27 +194,32 @@ namespace DocFileFormat ...@@ -189,27 +194,32 @@ namespace DocFileFormat
appendFlagElement( parent, *iter, _T( "noProof" ), true ); appendFlagElement( parent, *iter, _T( "noProof" ), true );
break; break;
case 0x0838: case sprmOldCFOutline:
case sprmCFOutline:
appendFlagElement( parent, *iter, _T( "outline" ), true ); appendFlagElement( parent, *iter, _T( "outline" ), true );
break; break;
case 0x0839: case sprmOldCFShadow:
case sprmCFShadow:
appendFlagElement( parent, *iter, _T( "shadow" ), true ); appendFlagElement( parent, *iter, _T( "shadow" ), true );
break; break;
case 0x083A: case sprmOldCFSmallCaps:
case sprmCFSmallCaps:
appendFlagElement( parent, *iter, _T( "smallCaps" ), true ); appendFlagElement( parent, *iter, _T( "smallCaps" ), true );
break; break;
case 0x0818: case sprmCFSpecVanish:
appendFlagElement( parent, *iter, _T( "specVanish" ), true ); appendFlagElement( parent, *iter, _T( "specVanish" ), true );
break; break;
case 0x0837: case sprmOldCFStrike:
case sprmCFStrike:
appendFlagElement( parent, *iter, _T( "strike" ), true ); appendFlagElement( parent, *iter, _T( "strike" ), true );
break; break;
case 0x083C: case sprmOldCFVanish:
case sprmCFVanish:
appendFlagElement( parent, *iter, _T( "vanish" ), true ); appendFlagElement( parent, *iter, _T( "vanish" ), true );
break; break;
...@@ -217,13 +227,14 @@ namespace DocFileFormat ...@@ -217,13 +227,14 @@ namespace DocFileFormat
appendFlagElement( parent, *iter, _T( "webHidden" ), true ); appendFlagElement( parent, *iter, _T( "webHidden" ), true );
break; break;
case 0x2A48: case sprmOldCIss:
case sprmCIss:
appendValueElement( parent, _T( "vertAlign" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &SuperscriptIndex[0][0], 3, 12 ).c_str(), true ); appendValueElement( parent, _T( "vertAlign" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &SuperscriptIndex[0][0], 3, 12 ).c_str(), true );
break; break;
case 0x486D://language
case 0x4873: case sprmCRgLid0_80:
{ case sprmCRgLid0:
//latin { //latin
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ); LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, Default ); LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, Default );
...@@ -232,9 +243,11 @@ namespace DocFileFormat ...@@ -232,9 +243,11 @@ namespace DocFileFormat
RELEASEOBJECT( langIDMapping ); RELEASEOBJECT( langIDMapping );
}break; }break;
case 0x486E:
case 0x4874://east asia case sprmOldCLid:
{ case sprmCRgLid1_80:
case sprmCRgLid1:
{ //east asia
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ); LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, EastAsian ); LanguageIdMapping* langIDMapping = new LanguageIdMapping( lang, EastAsian );
...@@ -243,7 +256,8 @@ namespace DocFileFormat ...@@ -243,7 +256,8 @@ namespace DocFileFormat
RELEASEOBJECT( langIDMapping ); RELEASEOBJECT( langIDMapping );
}break; }break;
case 0x485F://bidi
case sprmCLidBi:
{ {
LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ); LanguageId langid( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
...@@ -253,27 +267,32 @@ namespace DocFileFormat ...@@ -253,27 +267,32 @@ namespace DocFileFormat
RELEASEOBJECT( langIDMapping ); RELEASEOBJECT( langIDMapping );
}break; }break;
case 0x6865://borders
case 0xCA72: case sprmCBrc80:
{ case sprmCBrc:
{ //borders
XMLTools::XMLElement<wchar_t> bdr( _T( "w:bdr" ) ); XMLTools::XMLElement<wchar_t> bdr( _T( "w:bdr" ) );
BorderCode bc( iter->Arguments, iter->argumentsSize ); BorderCode bc( iter->Arguments, iter->argumentsSize );
appendBorderAttributes( &bc, &bdr ); appendBorderAttributes( &bc, &bdr );
parent->AppendChild( bdr ); parent->AppendChild( bdr );
}break; }break;
case 0x4866://shading
case 0xCA71: case sprmCShd80:
{ case sprmCShd:
{ //shading
ShadingDescriptor desc( iter->Arguments, iter->argumentsSize ); ShadingDescriptor desc( iter->Arguments, iter->argumentsSize );
appendShading( parent, desc ); appendShading( parent, desc );
}break; }break;
case 0x2A42://color
case 0x4A60: case sprmOldCIco:
{ case sprmCIco:
case sprmCIcoBi:
{//color
colorVal->SetValue( FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorIdentifier[0][0], 17, 12 ).c_str() ); colorVal->SetValue( FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorIdentifier[0][0], 17, 12 ).c_str() );
}break; }break;
case 0x6870:
case sprmCCv:
{ {
CString rgbColor; CString rgbColor;
...@@ -281,14 +300,18 @@ namespace DocFileFormat ...@@ -281,14 +300,18 @@ namespace DocFileFormat
colorVal->SetValue( rgbColor.GetString() ); colorVal->SetValue( rgbColor.GetString() );
}break; }break;
case 0x2A0C://highlightning
case sprmCHighlight:
{ {
appendValueElement( parent, _T( "highlight" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorIdentifier[0][0], 17, 12 ).c_str(), true ); appendValueElement( parent, _T( "highlight" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorIdentifier[0][0], 17, 12 ).c_str(), true );
}break; }break;
case 0x8840://spacing
case sprmOldCDxaSpace:
case sprmCDxaSpace:
{ {
appendValueElement( parent, _T( "spacing" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true ); appendValueElement( parent, _T( "spacing" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true );
}break; }break;
case sprmCFtcBi : case sprmCFtcBi :
{//default from FontTable {//default from FontTable
SHORT nIndex = FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize); SHORT nIndex = FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize);
...@@ -296,86 +319,112 @@ namespace DocFileFormat ...@@ -296,86 +319,112 @@ namespace DocFileFormat
{ {
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) ); FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
if (ffn) if (ffn)
this->m_sDefaultFont = ffn->xszFtn; m_sDefaultFont = ffn->xszFtn;
} }
}break; }break;
case sprmCHpsBi : case sprmCHpsBi :
{ {
appendValueElement( parent, _T( "szCs" ), appendValueElement( parent, _T( "szCs" ),
FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true );
true );
} }
break; break;
case sprmCHps : // Font Size in points (2~3276) default 20-half-points // Font Size in points (2~3276) default 20-half-points
case sprmOldCHps :
{ {
appendValueElement (parent, _T( "sz" ), appendValueElement (parent, _T( "sz" ),
FormatUtils::IntToWideString (FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize) ).c_str(), FormatUtils::IntToWideString (FormatUtils::BytesToUChar (iter->Arguments, 0, iter->argumentsSize) ).c_str(),
true ); true );
}break; }break;
case sprmCHpsPos: // The vertical position, in half-points, of text relative to the normal position. (MUST be between -3168 and 3168) case sprmCHps :
{ {
appendValueElement (parent, _T( "sz" ),
FormatUtils::IntToWideString (FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize) ).c_str(), true );
}break;
case sprmCMajority :
{ //for complex props
}break;
case sprmOldCHpsPos:
{ // The vertical position, in half-points, of text relative to the normal position. (MUST be between -3168 and 3168)
short nVertPos = FormatUtils::BytesToUChar(iter->Arguments, 0, iter->argumentsSize);
appendValueElement (parent, _T("position"), nVertPos, true);
}break;
case sprmCHpsPos:
{ // The vertical position, in half-points, of text relative to the normal position. (MUST be between -3168 and 3168)
short nVertPos = FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize); short nVertPos = FormatUtils::BytesToInt16(iter->Arguments, 0, iter->argumentsSize);
appendValueElement (parent, _T("position"), nVertPos, true); appendValueElement (parent, _T("position"), nVertPos, true);
}break; }break;
case sprmOldCHpsKern:
case sprmCHpsKern: case sprmCHpsKern:
{ {
appendValueElement( parent, _T( "kern" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true ); appendValueElement( parent, _T( "kern" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true );
}break; }break;
case sprmCRgFtc0: // font family
{ case sprmOldCFtc:
case sprmCRgFtc0:
{ // font family
int nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize ); int nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
if( nIndex < _doc->FontTable->Data.size() ) if( nIndex < _doc->FontTable->Data.size() )
{ {
XMLTools::XMLAttribute<wchar_t>* ascii = new XMLTools::XMLAttribute<wchar_t>( _T( "w:ascii" ) ); XMLTools::XMLAttribute<wchar_t>* ascii = new XMLTools::XMLAttribute<wchar_t>( _T( "w:ascii" ) );
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) ); FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
this->m_sAsciiFont = ffn->xszFtn; m_sAsciiFont = ffn->xszFtn;
ascii->SetValue( FormatUtils::XmlEncode(m_sAsciiFont).c_str() ); ascii->SetValue( FormatUtils::XmlEncode(m_sAsciiFont).c_str() );
rFonts->AppendAttribute( *ascii ); rFonts->AppendAttribute( *ascii );
RELEASEOBJECT( ascii ); RELEASEOBJECT( ascii );
} }
}break; }break;
case sprmCRgFtc1: case sprmCRgFtc1:
{ {
int nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize ); int nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
if( nIndex>=0 && nIndex < _doc->FontTable->Data.size() ) if( nIndex >= 0 && nIndex < _doc->FontTable->Data.size() )
{ {
XMLTools::XMLAttribute<wchar_t>* eastAsia = new XMLTools::XMLAttribute<wchar_t>( _T( "w:eastAsia" ) ); XMLTools::XMLAttribute<wchar_t>* eastAsia = new XMLTools::XMLAttribute<wchar_t>( _T( "w:eastAsia" ) );
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) ); FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
this->m_sEastAsiaFont = ffn->xszFtn; m_sEastAsiaFont = ffn->xszFtn;
eastAsia->SetValue( FormatUtils::XmlEncode(this->m_sEastAsiaFont).c_str() ); eastAsia->SetValue( FormatUtils::XmlEncode(m_sEastAsiaFont).c_str() );
rFonts->AppendAttribute( *eastAsia ); rFonts->AppendAttribute( *eastAsia );
RELEASEOBJECT( eastAsia ); RELEASEOBJECT( eastAsia );
} }
} }
break; break;
case 0x4A51: case sprmCRgFtc2:
{ {
int nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize ); int nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
if( nIndex>=0 && nIndex < _doc->FontTable->Data.size() ) if( nIndex>=0 && nIndex < _doc->FontTable->Data.size() )
{ {
XMLTools::XMLAttribute<wchar_t>* ansi = new XMLTools::XMLAttribute<wchar_t>( _T( "w:hAnsi" ) ); XMLTools::XMLAttribute<wchar_t>* ansi = new XMLTools::XMLAttribute<wchar_t>( _T( "w:hAnsi" ) );
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) ); FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
this->m_shAnsiFont = ffn->xszFtn; m_shAnsiFont = ffn->xszFtn;
ansi->SetValue( FormatUtils::XmlEncode(this->m_shAnsiFont).c_str() ); ansi->SetValue( FormatUtils::XmlEncode(m_shAnsiFont).c_str() );
rFonts->AppendAttribute( *ansi ); rFonts->AppendAttribute( *ansi );
RELEASEOBJECT( ansi ); RELEASEOBJECT( ansi );
} }
}break; }break;
case 0x2A3E://Underlining
{ case sprmOldCKul:
case sprmCKul:
{ //Underlining
appendValueElement( parent, _T( "u" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::UnderlineCode[0][0], 56, 16 ).c_str(), true ); appendValueElement( parent, _T( "u" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::UnderlineCode[0][0], 56, 16 ).c_str(), true );
} }
break; break;
case 0x4852://char width
{ case sprmCCharScale:
{ //char width
appendValueElement( parent, _T( "w" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true ); appendValueElement( parent, _T( "w" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true );
}break; }break;
case 0x2859://animation case sprmCSfxText:
{ { //animation
appendValueElement( parent, _T( "effect" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::TextAnimation[0][0], 7, 16 ).c_str(), true ); appendValueElement( parent, _T( "effect" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::TextAnimation[0][0], 7, 16 ).c_str(), true );
}break; }break;
case sprmCIdctHint: case sprmCIdctHint:
{ {
switch(iter->Arguments[0]) switch(iter->Arguments[0])
...@@ -387,6 +436,7 @@ namespace DocFileFormat ...@@ -387,6 +436,7 @@ namespace DocFileFormat
} }
}break; }break;
case sprmCPbiIBullet: case sprmCPbiIBullet:
{ {
int nIndex = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize ); int nIndex = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
...@@ -399,19 +449,26 @@ namespace DocFileFormat ...@@ -399,19 +449,26 @@ namespace DocFileFormat
} }
} }
}break; }break;
case sprmCPbiGrf: case sprmCPbiGrf:
{ {
//used picture bullet //used picture bullet
int val = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize ); int val = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
}break; }break;
case sprmCRsidProp: case sprmCRsidProp:
case sprmCRsidText: case sprmCRsidText:
break; break;
default: default:
if (iter->argumentsSize == 2) if (iter->argumentsSize == 2)
{ {
int nIndex = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize ); nProperty = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
}else
if (iter->argumentsSize == 1)
{
nProperty = FormatUtils::BytesToUChar( iter->Arguments, 0, iter->argumentsSize );
} }
break; break;
} }
...@@ -500,12 +557,12 @@ namespace DocFileFormat ...@@ -500,12 +557,12 @@ namespace DocFileFormat
//don't use the id of the chpx or the papx, use the baseOn style //don't use the id of the chpx or the papx, use the baseOn style
if ( _styleChpx ) if ( _styleChpx )
{ {
StyleSheetDescription* thisStyle = this->_doc->Styles->Styles->at( styleId ); StyleSheetDescription* thisStyle = _doc->Styles->Styles->at( styleId );
styleId = (unsigned short)thisStyle->istdBase; styleId = (unsigned short)thisStyle->istdBase;
} }
//build the style hierarchy //build the style hierarchy
this->_hierarchy = buildHierarchy( this->_doc->Styles, styleId ); _hierarchy = buildHierarchy( _doc->Styles, styleId );
//apply the toggle values to get the real value of the style //apply the toggle values to get the real value of the style
bool stylesVal = applyToggleHierachy( sprm ); bool stylesVal = applyToggleHierachy( sprm );
...@@ -575,7 +632,7 @@ namespace DocFileFormat ...@@ -575,7 +632,7 @@ namespace DocFileFormat
bool ret = false; bool ret = false;
std::list<CharacterPropertyExceptions*>::const_iterator end = _hierarchy.end(); std::list<CharacterPropertyExceptions*>::const_iterator end = _hierarchy.end();
for (std::list<CharacterPropertyExceptions*>::const_iterator iter = this->_hierarchy.begin(); iter != end; ++iter) for (std::list<CharacterPropertyExceptions*>::const_iterator iter = _hierarchy.begin(); iter != end; ++iter)
{ {
std::list<SinglePropertyModifier>::const_iterator end_grpprl = (*iter)->grpprl->end(); std::list<SinglePropertyModifier>::const_iterator end_grpprl = (*iter)->grpprl->end();
for (std::list<SinglePropertyModifier>::const_iterator grpprlIter = (*iter)->grpprl->begin(); grpprlIter != end_grpprl; ++grpprlIter) for (std::list<SinglePropertyModifier>::const_iterator grpprlIter = (*iter)->grpprl->begin(); grpprlIter != end_grpprl; ++grpprlIter)
......
...@@ -644,7 +644,7 @@ namespace DocFileFormat ...@@ -644,7 +644,7 @@ namespace DocFileFormat
CharacterPropertyExceptions* chpxPic = chpxs->front(); CharacterPropertyExceptions* chpxPic = chpxs->front();
PictureDescriptor pic(chpxPic, m_document->DataStream, 0x7fffffff, m_document->FIB->m_bOlderVersion); PictureDescriptor pic(chpxPic, m_document->DataStream, 0x7fffffff, m_document->bOlderVersion);
RevisionData oData = RevisionData(chpxPic); RevisionData oData = RevisionData(chpxPic);
...@@ -782,9 +782,9 @@ namespace DocFileFormat ...@@ -782,9 +782,9 @@ namespace DocFileFormat
} }
} }
} }
else if ((TextMark::Picture == c) && fSpec) else if ((TextMark::Picture == c) && fSpec )
{ {
PictureDescriptor oPicture (chpx, m_document->DataStream, 0x7fffffff, m_document->FIB->m_bOlderVersion); PictureDescriptor oPicture (chpx, m_document->bOlderVersion ? m_document->WordDocumentStream : m_document->DataStream, 0x7fffffff, m_document->bOlderVersion);
if ((oPicture.mfp.mm > 98) && (NULL != oPicture.shapeContainer)) if ((oPicture.mfp.mm > 98) && (NULL != oPicture.shapeContainer))
{ {
...@@ -1041,7 +1041,7 @@ namespace DocFileFormat ...@@ -1041,7 +1041,7 @@ namespace DocFileFormat
//find first row end //find first row end
int fcRowEnd = findRowEndFc( cp, nestingLevel ); int fcRowEnd = findRowEndFc( cp, nestingLevel );
TablePropertyExceptions row1Tapx( findValidPapx( fcRowEnd ), m_document->DataStream, m_document->FIB->m_bOlderVersion); TablePropertyExceptions row1Tapx( findValidPapx( fcRowEnd ), m_document->DataStream, m_document->bOlderVersion);
//start table //start table
m_pXmlWriter->WriteNodeBegin( _T( "w:tbl" ) ); m_pXmlWriter->WriteNodeBegin( _T( "w:tbl" ) );
...@@ -1291,7 +1291,7 @@ namespace DocFileFormat ...@@ -1291,7 +1291,7 @@ namespace DocFileFormat
//convert the properties //convert the properties
int fcRowEnd = findRowEndFc( cp, nestingLevel ); int fcRowEnd = findRowEndFc( cp, nestingLevel );
TablePropertyExceptions tapx( findValidPapx( fcRowEnd ), m_document->DataStream, m_document->FIB->m_bOlderVersion); TablePropertyExceptions tapx( findValidPapx( fcRowEnd ), m_document->DataStream, m_document->bOlderVersion);
std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions( fcRowEnd, fcRowEnd + 1 ); std::list<CharacterPropertyExceptions*>* chpxs = m_document->GetCharacterPropertyExceptions( fcRowEnd, fcRowEnd + 1 );
TableRowPropertiesMapping* trpMapping = new TableRowPropertiesMapping( m_pXmlWriter, *(chpxs->begin()) ); TableRowPropertiesMapping* trpMapping = new TableRowPropertiesMapping( m_pXmlWriter, *(chpxs->begin()) );
...@@ -1523,11 +1523,13 @@ namespace DocFileFormat ...@@ -1523,11 +1523,13 @@ namespace DocFileFormat
{ {
return true; return true;
} }
else if (sprmCSymbol == iter->OpCode) // SYMBOL else if ( sprmCSymbol == iter->OpCode ||
sprmOldCSymbol == iter->OpCode) // SYMBOL
{ {
return true; return true;
} }
else if (sprmCFSpec == iter->OpCode) // SPECIAL OBJECT else if ( sprmOldCFSpec == iter->OpCode ||
sprmCFSpec == iter->OpCode) // SPECIAL OBJECT
{ {
return ((0 != iter->Arguments[0]) ? true : false); return ((0 != iter->Arguments[0]) ? true : false);
} }
......
...@@ -52,7 +52,7 @@ namespace DocFileFormat ...@@ -52,7 +52,7 @@ namespace DocFileFormat
/*========================================================================================================*/ /*========================================================================================================*/
FormattedDiskPagePAPX::FormattedDiskPagePAPX( POLE::Stream* wordStream, int offset, POLE::Stream* dataStream, bool oldVersion): FormattedDiskPagePAPX::FormattedDiskPagePAPX( POLE::Stream* wordStream, int offset, POLE::Stream* dataStream, bool oldVersion, bool fComplex):
FormattedDiskPage(), rgbx(NULL), grppapxSize(0), grppapx(NULL) FormattedDiskPage(), rgbx(NULL), grppapxSize(0), grppapx(NULL)
{ {
Type = Paragraph; Type = Paragraph;
...@@ -100,15 +100,29 @@ namespace DocFileFormat ...@@ -100,15 +100,29 @@ namespace DocFileFormat
for ( int i = 0; i < crun; i++ ) for ( int i = 0; i < crun; i++ )
{ {
memcpy( phe, ( bytes + j + 1 ), 12 );
//fill the rgbx array
BX bx; BX bx;
bx.wordOffset = bytes[j]; bx.wordOffset = bytes[j];
j++;
if (fComplex || !oldVersion)
{
memcpy( phe, ( bytes + j), 12 );
//fill the rgbx array
bx.phe = ParagraphHeight( phe, 12, false ); bx.phe = ParagraphHeight( phe, 12, false );
j += 12;
}
else
{
memcpy( phe, ( bytes + j), 6);
//fill the rgbx array
bx.phe = ParagraphHeight( phe, 6, false );
j += 6;
}
rgbx[i] = bx; rgbx[i] = bx;
j += 13;
if ( bx.wordOffset != 0 ) if ( bx.wordOffset != 0 )
{ {
...@@ -188,7 +202,7 @@ namespace DocFileFormat ...@@ -188,7 +202,7 @@ namespace DocFileFormat
int offset = fkpnr * 512; int offset = fkpnr * 512;
//parse the FKP and add it to the list //parse the FKP and add it to the list
PAPXlist->push_back( new FormattedDiskPagePAPX( wordStream, offset, dataStream, fib->m_bOlderVersion) ); PAPXlist->push_back( new FormattedDiskPagePAPX( wordStream, offset, dataStream, fib->m_bOlderVersion, fib->m_FibBase.fComplex) );
} }
//if (PAPXlist->back()->rgfc[PAPXlist->back()->rgfcSize-1] < last) //if (PAPXlist->back()->rgfc[PAPXlist->back()->rgfcSize-1] < last)
...@@ -212,7 +226,7 @@ namespace DocFileFormat ...@@ -212,7 +226,7 @@ namespace DocFileFormat
int offset = fkpnr * 512; int offset = fkpnr * 512;
//parse the FKP and add it to the list //parse the FKP and add it to the list
PAPXlist->push_back( new FormattedDiskPagePAPX( wordStream, offset, dataStream, fib->m_bOlderVersion) ); PAPXlist->push_back( new FormattedDiskPagePAPX( wordStream, offset, dataStream, fib->m_bOlderVersion, fib->m_FibBase.fComplex) );
} }
} }
......
...@@ -63,7 +63,7 @@ namespace DocFileFormat ...@@ -63,7 +63,7 @@ namespace DocFileFormat
public: public:
virtual ~FormattedDiskPagePAPX(); virtual ~FormattedDiskPagePAPX();
FormattedDiskPagePAPX( POLE::Stream* wordStream, int offset, POLE::Stream* dataStream, bool oldVersion); FormattedDiskPagePAPX( POLE::Stream* wordStream, int offset, POLE::Stream* dataStream, bool oldVersion, bool fComplex);
/// Parses the 0Table (or 1Table) for FKP _entries containing PAPX /// Parses the 0Table (or 1Table) for FKP _entries containing PAPX
static std::list<FormattedDiskPagePAPX*>* GetAllPAPXFKPs( FileInformationBlock* fib, POLE::Stream* wordStream, POLE::Stream* tableStream, POLE::Stream* dataStream); static std::list<FormattedDiskPagePAPX*>* GetAllPAPXFKPs( FileInformationBlock* fib, POLE::Stream* wordStream, POLE::Stream* tableStream, POLE::Stream* dataStream);
/// Returns a list of all PAPX FCs between they given boundaries. /// Returns a list of all PAPX FCs between they given boundaries.
......
/* /*
* (c) Copyright Ascensio System SIA 2010-2016 * (c) Copyright Ascensio System SIA 2010-2016
* *
* This program is a free software product. You can redistribute it and/or * This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL) * modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with * version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement * that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights. * of any third-party rights.
* *
* This program is distributed WITHOUT ANY WARRANTY; without even the implied * This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
* *
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, * You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021. * EU, LV-1021.
* *
* The interactive user interfaces in modified source and object code versions * The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under * of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3. * Section 5 of the GNU AGPL version 3.
* *
* Pursuant to Section 7(b) of the License you must retain the original Product * Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to * logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks. * grant you any rights under trademark law for use of our trademarks.
* *
* All the Product's GUI elements, including illustrations and icon sets, as * All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the * well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License * Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
* *
*/ */
#pragma once #pragma once
namespace DocFileFormat namespace DocFileFormat
...@@ -43,27 +43,24 @@ namespace DocFileFormat ...@@ -43,27 +43,24 @@ namespace DocFileFormat
public: public:
/// Creates a new LineSpacingDescriptor with empty values /// Creates a new LineSpacingDescriptor with empty values
LineSpacingDescriptor(): LineSpacingDescriptor(): dyaLine(0), fMultLinespace(false)
dyaLine(0), fMultLinespace(false)
{ {
} }
/// Parses the bytes to retrieve a LineSpacingDescriptor /// Parses the bytes to retrieve a LineSpacingDescriptor
LineSpacingDescriptor( unsigned char* bytes, int size ): LineSpacingDescriptor( unsigned char* bytes, int size ) : dyaLine(0), fMultLinespace(false)
dyaLine(0), fMultLinespace(false)
{ {
if ( size == 4 ) if ( size == 4 )
{ {
this->dyaLine = FormatUtils::BytesToInt16( bytes, 0, size ); dyaLine = FormatUtils::BytesToInt16( bytes, 0, size );
if ( FormatUtils::BytesToInt16( bytes, 2, size ) == 1 ) if ( FormatUtils::BytesToInt16( bytes, 2, size ) == 1 )
{ {
this->fMultLinespace = true; fMultLinespace = true;
} }
} }
else else
{ {
//throw new ByteParseException("Cannot parse the struct LSPD, the length of the struct doesn't match");
} }
} }
}; };
......
...@@ -66,7 +66,7 @@ namespace DocFileFormat ...@@ -66,7 +66,7 @@ namespace DocFileFormat
//m_pXmlWriter->WriteAttribute(_T("xmlns:wpc"), _T("http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas")); //m_pXmlWriter->WriteAttribute(_T("xmlns:wpc"), _T("http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas"));
//m_pXmlWriter->WriteAttribute(_T("xmlns:mc"), _T("http://schemas.openxmlformats.org/markup-compatibility/2006")); //m_pXmlWriter->WriteAttribute(_T("xmlns:mc"), _T("http://schemas.openxmlformats.org/markup-compatibility/2006"));
//m_pXmlWriter->WriteAttribute(_T("xmlns:wp14"), _T("http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing")); //m_pXmlWriter->WriteAttribute(_T("xmlns:wp14"),_T("http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing"));
//m_pXmlWriter->WriteAttribute(_T("xmlns:wp"), _T("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing")); //m_pXmlWriter->WriteAttribute(_T("xmlns:wp"), _T("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"));
//m_pXmlWriter->WriteAttribute(_T("xmlns:w14"), _T("http://schemas.microsoft.com/office/word/2010/wordml")); //m_pXmlWriter->WriteAttribute(_T("xmlns:w14"), _T("http://schemas.microsoft.com/office/word/2010/wordml"));
//m_pXmlWriter->WriteAttribute(_T("xmlns:wpg"), _T("http://schemas.microsoft.com/office/word/2010/wordprocessingGroup")); //m_pXmlWriter->WriteAttribute(_T("xmlns:wpg"), _T("http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"));
......
...@@ -518,14 +518,17 @@ namespace DocFileFormat ...@@ -518,14 +518,17 @@ namespace DocFileFormat
for (std::list<SinglePropertyModifier>::const_iterator iter = grpprlChpx->grpprl->begin(); iter != grpprlChpx->grpprl->end(); ++iter) for (std::list<SinglePropertyModifier>::const_iterator iter = grpprlChpx->grpprl->begin(); iter != grpprlChpx->grpprl->end(); ++iter)
{ {
if ((int)(iter->OpCode) == sprmCPbiIBullet) switch(iter->OpCode)
{
case sprmCPbiIBullet:
{ {
cp = FormatUtils::BytesToUInt32(iter->Arguments, 0, iter->argumentsSize); cp = FormatUtils::BytesToUInt32(iter->Arguments, 0, iter->argumentsSize);
} }break;
if ((int)(iter->OpCode) == sprmCPbiGrf) case sprmCPbiGrf:
{ {
isPictureBullet = FormatUtils::BitmaskToBool(FormatUtils::BytesToUInt16(iter->Arguments, 0, iter->argumentsSize), 0x1); isPictureBullet = FormatUtils::BitmaskToBool(FormatUtils::BytesToUInt16(iter->Arguments, 0, iter->argumentsSize), 0x1);
}break;
} }
} }
......
...@@ -48,49 +48,57 @@ namespace DocFileFormat ...@@ -48,49 +48,57 @@ namespace DocFileFormat
//set default values //set default values
setDefaultValues(); setDefaultValues();
if ( size == 12 )
{
// The ParagraphHeight is placed in a ParagraphProperties whose fTtp field is set, // The ParagraphHeight is placed in a ParagraphProperties whose fTtp field is set,
//so used another bit setting //so used another bit setting
if ( size == 12 )
{
if ( fTtpMode ) if ( fTtpMode )
{ {
this->fSpare = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0001 ); fSpare = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0001 );
this->fUnk = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0002 ); fUnk = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0002 );
this->dcpTtpNext = FormatUtils::BytesToInt16( bytes, 0, size ); dcpTtpNext = FormatUtils::BytesToInt16( bytes, 0, size );
this->dxaCol = FormatUtils::BytesToInt32( bytes, 4, size ); dxaCol = FormatUtils::BytesToInt32( bytes, 4, size );
this->dymTableHeight = FormatUtils::BytesToInt32( bytes, 8, size ); dymTableHeight = FormatUtils::BytesToInt32( bytes, 8, size );
} }
else else
{ {
this->fVolatile = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0001 ); fVolatile = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0001 );
this->fUnk = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0002 ); fUnk = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0002 );
this->fDiffLines = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0004 ); fDiffLines = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0004 );
this->clMac = FormatUtils::BytesToUInt16( bytes, 0, size ) & 0x00FF; clMac = FormatUtils::BytesToUInt16( bytes, 0, size ) & 0x00FF;
this->dxaCol = FormatUtils::BytesToInt32( bytes, 4, size ); dxaCol = FormatUtils::BytesToInt32( bytes, 4, size );
this->dymLine = FormatUtils::BytesToInt32( bytes, 8, size ); dymLine = FormatUtils::BytesToInt32( bytes, 8, size );
this->dymHeight = FormatUtils::BytesToInt32( bytes, 8, size ); dymHeight = FormatUtils::BytesToInt32( bytes, 8, size );
} }
} }
else else if (size == 6)
{ {
//throw new ByteParseException("Cannot parse the struct ParagraphHeight, the length of the struct doesn't match"); fVolatile = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0001 );
fUnk = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0002 );
fDiffLines = FormatUtils::BitmaskToBool( FormatUtils::BytesToInt16( bytes, 0, size ), 0x0004 );
clMac = FormatUtils::BytesToUChar( bytes, 0, size ) & 0x000F;
dxaCol = FormatUtils::BytesToInt16( bytes, 2, size );
dymLine = FormatUtils::BytesToInt16( bytes, 4, size );
dymHeight = FormatUtils::BytesToInt16( bytes, 4, size );
} }
} }
/*========================================================================================================*/ /*========================================================================================================*/
void ParagraphHeight::setDefaultValues() void ParagraphHeight::setDefaultValues()
{ {
this->clMac = 0; clMac = 0;
this->dcpTtpNext = 0; dcpTtpNext = 0;
this->dxaCol = 0; dxaCol = 0;
this->dymHeight = 0; dymHeight = 0;
this->dymLine = 0; dymLine = 0;
this->dymTableHeight = 0; dymTableHeight = 0;
this->fDiffLines = false; fDiffLines = false;
this->fSpare = false; fSpare = false;
this->fUnk = false; fUnk = false;
this->fVolatile = false; fVolatile = false;
} }
} }
\ No newline at end of file
...@@ -136,6 +136,8 @@ namespace DocFileFormat ...@@ -136,6 +136,8 @@ namespace DocFileFormat
std::list<SinglePropertyModifier>::iterator end = papx->grpprl->end(); std::list<SinglePropertyModifier>::iterator end = papx->grpprl->end();
for (std::list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != end; ++iter) for (std::list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != end; ++iter)
{ {
int nProperty = 0; //for unknown test
switch ( iter->OpCode ) switch ( iter->OpCode )
{ {
case sprmPIpgp: case sprmPIpgp:
...@@ -170,10 +172,12 @@ namespace DocFileFormat ...@@ -170,10 +172,12 @@ namespace DocFileFormat
} }
break; break;
case sprmOldPFKeep:
case sprmPFKeep: case sprmPFKeep:
appendFlagElement( _pPr, *iter, _T( "keepLines" ), true ); appendFlagElement( _pPr, *iter, _T( "keepLines" ), true );
break; break;
case sprmOldPFKeepFollow:
case sprmPFKeepFollow: case sprmPFKeepFollow:
appendFlagElement( _pPr, *iter, _T( "keepNext" ), true ); appendFlagElement( _pPr, *iter, _T( "keepNext" ), true );
break; break;
...@@ -215,6 +219,8 @@ namespace DocFileFormat ...@@ -215,6 +219,8 @@ namespace DocFileFormat
break; break;
//indentation //indentation
case sprmOldPDxaLeft:
case sprmOldPNest:
case sprmPDxaLeft: case sprmPDxaLeft:
case sprmPDxaLeft80: case sprmPDxaLeft80:
case sprmPNest: case sprmPNest:
...@@ -226,6 +232,7 @@ namespace DocFileFormat ...@@ -226,6 +232,7 @@ namespace DocFileFormat
appendValueAttribute( &ind, _T( "w:leftChars" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ); appendValueAttribute( &ind, _T( "w:leftChars" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
break; break;
case sprmOldPDxaLeft1:
case sprmPDxaLeft1: case sprmPDxaLeft1:
case sprmPDxaLeft180: case sprmPDxaLeft180:
{ {
...@@ -250,6 +257,7 @@ namespace DocFileFormat ...@@ -250,6 +257,7 @@ namespace DocFileFormat
appendValueAttribute( &ind, _T( "w:firstLineChars" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ); appendValueAttribute( &ind, _T( "w:firstLineChars" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
break; break;
case sprmOldPDxaRight:
case sprmPDxaRight: case sprmPDxaRight:
case sprmPDxaRight80: case sprmPDxaRight80:
appendValueAttribute( &ind, _T( "w:right" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ); appendValueAttribute( &ind, _T( "w:right" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
...@@ -260,10 +268,12 @@ namespace DocFileFormat ...@@ -260,10 +268,12 @@ namespace DocFileFormat
break; break;
//spacing //spacing
case sprmOldPDyaBefore:
case sprmPDyaBefore: case sprmPDyaBefore:
appendValueAttribute( &spacing, _T( "w:before" ), FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize ) ); appendValueAttribute( &spacing, _T( "w:before" ), FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize ) );
break; break;
case sprmOldPDyaAfter:
case sprmPDyaAfter: case sprmPDyaAfter:
appendValueAttribute( &spacing, _T( "w:after" ), FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize ) ); appendValueAttribute( &spacing, _T( "w:after" ), FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize ) );
break; break;
...@@ -276,6 +286,7 @@ namespace DocFileFormat ...@@ -276,6 +286,7 @@ namespace DocFileFormat
appendValueAttribute( &spacing, _T( "w:beforeAutospacing" ), iter->Arguments[0] ); appendValueAttribute( &spacing, _T( "w:beforeAutospacing" ), iter->Arguments[0] );
break; break;
case sprmOldPDyaLine:
case sprmPDyaLine: case sprmPDyaLine:
{ {
LineSpacingDescriptor lspd( iter->Arguments, iter->argumentsSize ); LineSpacingDescriptor lspd( iter->Arguments, iter->argumentsSize );
...@@ -300,6 +311,7 @@ namespace DocFileFormat ...@@ -300,6 +311,7 @@ namespace DocFileFormat
break; break;
//justification code //justification code
case sprmOldPJc:
case sprmPJc: case sprmPJc:
case sprmPJc80: case sprmPJc80:
{ {
...@@ -316,6 +328,7 @@ namespace DocFileFormat ...@@ -316,6 +328,7 @@ namespace DocFileFormat
//borders //borders
//case 0x461C: //case 0x461C:
case sprmOldPBrcTop:
case sprmPBrcTop: case sprmPBrcTop:
//case 0x4424: //case 0x4424:
case sprmPBrcTop80: case sprmPBrcTop80:
...@@ -331,6 +344,7 @@ namespace DocFileFormat ...@@ -331,6 +344,7 @@ namespace DocFileFormat
break; break;
//case 0x461D: //case 0x461D:
case sprmOldPBrcLeft:
case sprmPBrcLeft: case sprmPBrcLeft:
//case 0x4425: //case 0x4425:
case sprmPBrcLeft80: case sprmPBrcLeft80:
...@@ -346,6 +360,7 @@ namespace DocFileFormat ...@@ -346,6 +360,7 @@ namespace DocFileFormat
break; break;
//case 0x461E: //case 0x461E:
case sprmOldPBrcBottom:
case sprmPBrcBottom: case sprmPBrcBottom:
//case 0x4426: //case 0x4426:
case sprmPBrcBottom80: case sprmPBrcBottom80:
...@@ -361,6 +376,7 @@ namespace DocFileFormat ...@@ -361,6 +376,7 @@ namespace DocFileFormat
break; break;
//case 0x461F: //case 0x461F:
case sprmOldPBrcRight:
case sprmPBrcRight: case sprmPBrcRight:
//case 0x4427: //case 0x4427:
case sprmPBrcRight80: case sprmPBrcRight80:
...@@ -376,6 +392,7 @@ namespace DocFileFormat ...@@ -376,6 +392,7 @@ namespace DocFileFormat
break; break;
//case 0x4620: //case 0x4620:
case sprmOldPBrcBetween:
case sprmPBrcBetween: case sprmPBrcBetween:
//case 0x4428: //case 0x4428:
case sprmPBrcBetween80: case sprmPBrcBetween80:
...@@ -391,6 +408,7 @@ namespace DocFileFormat ...@@ -391,6 +408,7 @@ namespace DocFileFormat
break; break;
//case 0x4621: //case 0x4621:
case sprmOldPBrcBar:
case sprmPBrcBar: case sprmPBrcBar:
//case 0x4629: //case 0x4629:
case sprmPBrcBar80: case sprmPBrcBar80:
...@@ -445,6 +463,7 @@ namespace DocFileFormat ...@@ -445,6 +463,7 @@ namespace DocFileFormat
break; break;
//tabs //tabs
case sprmOldPChgTabs:
case sprmPChgTabsPapx: case sprmPChgTabsPapx:
case sprmPChgTabs: case sprmPChgTabs:
{ {
...@@ -513,6 +532,7 @@ namespace DocFileFormat ...@@ -513,6 +532,7 @@ namespace DocFileFormat
break; break;
//frame properties //frame properties
case sprmOldPPc:
case sprmPPc: case sprmPPc:
{ {
//position code //position code
...@@ -523,14 +543,17 @@ namespace DocFileFormat ...@@ -523,14 +543,17 @@ namespace DocFileFormat
} }
break; break;
case sprmOldPWr:
case sprmPWr: case sprmPWr:
appendValueAttribute( this->_framePr, _T( "w:wrap" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::TextFrameWrapping[0][0], 6, 10 ).c_str() ); appendValueAttribute( this->_framePr, _T( "w:wrap" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::TextFrameWrapping[0][0], 6, 10 ).c_str() );
break; break;
case sprmOldPDxaAbs:
case sprmPDxaAbs: case sprmPDxaAbs:
appendValueAttribute( this->_framePr, _T( "w:x" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ); appendValueAttribute( this->_framePr, _T( "w:x" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
break; break;
case sprmOldPDyaAbs:
case sprmPDyaAbs: case sprmPDyaAbs:
appendValueAttribute( this->_framePr, _T( "w:y" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ); appendValueAttribute( this->_framePr, _T( "w:y" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
break; break;
...@@ -539,18 +562,22 @@ namespace DocFileFormat ...@@ -539,18 +562,22 @@ namespace DocFileFormat
appendValueAttribute( this->_framePr, _T( "w:h" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ); appendValueAttribute( this->_framePr, _T( "w:h" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
break; break;
case sprmOldPDxaWidth:
case sprmPDxaWidth: case sprmPDxaWidth:
appendValueAttribute( this->_framePr, _T( "w:w" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ); appendValueAttribute( this->_framePr, _T( "w:w" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
break; break;
case sprmOldPDxaFromText:
case sprmPDxaFromText: case sprmPDxaFromText:
appendValueAttribute( this->_framePr, _T( "w:hSpace" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ); appendValueAttribute( this->_framePr, _T( "w:hSpace" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
break; break;
case sprmOldPDyaFromText:
case sprmPDyaFromText: case sprmPDyaFromText:
appendValueAttribute( this->_framePr, _T( "w:vSpace" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ); appendValueAttribute( this->_framePr, _T( "w:vSpace" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
break; break;
case sprmOldPDcs:
case sprmPDcs: case sprmPDcs:
{ {
short pDcs = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ); short pDcs = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
...@@ -567,10 +594,13 @@ namespace DocFileFormat ...@@ -567,10 +594,13 @@ namespace DocFileFormat
break; break;
default: default:
if (iter->argumentsSize == 2)
{
nProperty = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
}else
if (iter->argumentsSize == 1)
{ {
#ifdef _DEBUG nProperty = FormatUtils::BytesToUChar( iter->Arguments, 0, iter->argumentsSize );
// //ATLTRACE (_T("ParagraphPropertiesMapping - UNKNOWN SPRM : 0x%x\n"), iter->OpCode);
#endif
} }
break; break;
} }
......
...@@ -39,14 +39,14 @@ namespace DocFileFormat ...@@ -39,14 +39,14 @@ namespace DocFileFormat
{ {
if ( size != 0 ) if ( size != 0 )
{ {
this->istd = FormatUtils::BytesToUInt16( bytes, 0, size ); istd = FormatUtils::BytesToUInt16( bytes, 0, size );
} }
VirtualStreamReader *reader = NULL; VirtualStreamReader *reader = NULL;
//There is a SPRM that points to an offset in the data stream, //There is a SPRM that points to an offset in the data stream,
//where a list of SPRM is saved. //where a list of SPRM is saved.
for ( std::list<SinglePropertyModifier>::iterator iter = this->grpprl->begin(); iter != this->grpprl->end(); iter++ ) for ( std::list<SinglePropertyModifier>::iterator iter = grpprl->begin(); iter != grpprl->end(); iter++ )
{ {
SinglePropertyModifier sprm( *iter ); SinglePropertyModifier sprm( *iter );
...@@ -68,11 +68,11 @@ namespace DocFileFormat ...@@ -68,11 +68,11 @@ namespace DocFileFormat
PropertyExceptions externalPx( grpprlBytes, grpprlsize, oldVersion ); PropertyExceptions externalPx( grpprlBytes, grpprlsize, oldVersion );
//assign the external grpprl //assign the external grpprl
RELEASEOBJECT( this->grpprl ); RELEASEOBJECT( grpprl );
this->grpprl = new std::list<SinglePropertyModifier>( *(externalPx.grpprl) ); grpprl = new std::list<SinglePropertyModifier>( *(externalPx.grpprl) );
//remove the sprmPHugePapx //remove the sprmPHugePapx
this->grpprl->remove( sprm ); grpprl->remove( sprm );
RELEASEARRAYOBJECTS( grpprlBytes ); RELEASEARRAYOBJECTS( grpprlBytes );
RELEASEOBJECT( reader ) RELEASEOBJECT( reader )
......
...@@ -90,14 +90,14 @@ namespace DocFileFormat ...@@ -90,14 +90,14 @@ namespace DocFileFormat
if (lcb >= 10) if (lcb >= 10)
{ {
unsigned short cbHeader = reader.ReadUInt16(); int cbHeader = reader.ReadUInt16();
mfp.mm = reader.ReadInt16(); mfp.mm = reader.ReadInt16();
mfp.xExt = reader.ReadInt16(); mfp.xExt = reader.ReadInt16();
mfp.yExt = reader.ReadInt16(); mfp.yExt = reader.ReadInt16();
mfp.hMf = reader.ReadInt16(); mfp.hMf = reader.ReadInt16();
if (mfp.mm > 98) if (mfp.mm >= 98 || oldVersion)
{ {
unsigned char* bytes = reader.ReadBytes(14, true); unsigned char* bytes = reader.ReadBytes(14, true);
rcWinMf = std::vector<unsigned char>(bytes, (bytes + 14)); rcWinMf = std::vector<unsigned char>(bytes, (bytes + 14));
...@@ -154,6 +154,30 @@ namespace DocFileFormat ...@@ -154,6 +154,30 @@ namespace DocFileFormat
} }
} }
if (oldVersion)
{
////blipStoreEntry = new BlipStoreEntry();
//blipStoreEntry = new BlipStoreEntry(&reader,lcb, Global::msoblipDIB,0,0);
//long pos = reader.GetPosition();
//unsigned char* pPicData = reader.ReadBytes(lcb - pos, true);
//int pos1 = 0;
//BITMAPINFOHEADER *bm = (BITMAPINFOHEADER *)(pPicData + pos1);
//NSFile::CFileBinary f;
//
//f.CreateFile(L"d:\\test.jpg");
//f.WriteFile(pPicData + pos1, lcb - pos - pos1);
//f.CloseFile();
//RELEASEARRAYOBJECTS(pPicData);
}
else
{
//Parse the OfficeDrawing Stuff //Parse the OfficeDrawing Stuff
shapeContainer = dynamic_cast<ShapeContainer*>(RecordFactory::ReadRecord(&reader, 0)); shapeContainer = dynamic_cast<ShapeContainer*>(RecordFactory::ReadRecord(&reader, 0));
...@@ -175,6 +199,7 @@ namespace DocFileFormat ...@@ -175,6 +199,7 @@ namespace DocFileFormat
} }
} }
} }
}
/// Returns the fcPic into the "data" stream, where the PIC begins. /// Returns the fcPic into the "data" stream, where the PIC begins.
/// Returns -1 if the CHPX has no fcPic. /// Returns -1 if the CHPX has no fcPic.
...@@ -186,6 +211,7 @@ namespace DocFileFormat ...@@ -186,6 +211,7 @@ namespace DocFileFormat
{ {
switch ( iter->OpCode ) switch ( iter->OpCode )
{ {
case sprmOldCPicLocation:
case sprmCPicLocation: case sprmCPicLocation:
ret = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize ); ret = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
break; break;
...@@ -194,6 +220,7 @@ namespace DocFileFormat ...@@ -194,6 +220,7 @@ namespace DocFileFormat
ret = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize ); ret = FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize );
break; break;
case sprmOldCFData:
case sprmCFData: case sprmCFData:
break; break;
} }
......
...@@ -41,24 +41,18 @@ namespace DocFileFormat ...@@ -41,24 +41,18 @@ namespace DocFileFormat
RELEASEOBJECT( this->grpprl ); RELEASEOBJECT( this->grpprl );
} }
/*========================================================================================================*/
PropertyExceptions::PropertyExceptions(): grpprl(NULL) PropertyExceptions::PropertyExceptions(): grpprl(NULL)
{ {
this->grpprl = new std::list<SinglePropertyModifier>(); this->grpprl = new std::list<SinglePropertyModifier>();
} }
/*========================================================================================================*/
PropertyExceptions::PropertyExceptions( const std::list<SinglePropertyModifier>& grpprl ) PropertyExceptions::PropertyExceptions( const std::list<SinglePropertyModifier>& grpprl )
{ {
this->grpprl = new std::list<SinglePropertyModifier>( grpprl ); this->grpprl = new std::list<SinglePropertyModifier>( grpprl );
} }
/*========================================================================================================*/ PropertyExceptions::PropertyExceptions( unsigned char* bytes, int size, bool oldVersion ) : grpprl(NULL)
{
PropertyExceptions::PropertyExceptions( unsigned char* bytes, int size, bool oldVersion ): grpprl(NULL)
{
this->grpprl = new std::list<SinglePropertyModifier>(); this->grpprl = new std::list<SinglePropertyModifier>();
if ( ( bytes == NULL ) || ( size == 0 ) ) return; if ( ( bytes == NULL ) || ( size == 0 ) ) return;
...@@ -68,17 +62,27 @@ PropertyExceptions::PropertyExceptions( unsigned char* bytes, int size, bool old ...@@ -68,17 +62,27 @@ PropertyExceptions::PropertyExceptions( unsigned char* bytes, int size, bool old
int sprmStart = 0; int sprmStart = 0;
bool goOn = true; bool goOn = true;
int opCodeSize = (oldVersion ? 1 : 2);
while ( goOn ) while ( goOn )
{ {
//enough bytes to read? //enough bytes to read?
if ( ( sprmStart + 2 ) < size ) if ( ( sprmStart + opCodeSize ) < size )
{ {
//make spra OperationCode opCode = oldVersion ? (OperationCode)FormatUtils::BytesToUChar ( bytes, sprmStart, size ) :
OperationCode opCode = (OperationCode)FormatUtils::BytesToUInt16( bytes, sprmStart, size ); (OperationCode)FormatUtils::BytesToUInt16 ( bytes, sprmStart, size ) ;
unsigned char spra = (unsigned char)( (int)opCode >> 13 );
short opSize = -1;
// get size of operand if (oldVersion)
short opSize = (short)SinglePropertyModifier::GetOperandSize( spra ); {
opSize = (short)SinglePropertyModifier::GetOldOperandSize( (unsigned char)opCode );
}
else
{
unsigned char spra = (unsigned char)( (int)opCode >> 13 );
opSize = (short)SinglePropertyModifier::GetOperandSize( spra );
}
unsigned char lenByte = 0; unsigned char lenByte = 0;
//operand has variable size //operand has variable size
...@@ -96,8 +100,7 @@ PropertyExceptions::PropertyExceptions( unsigned char* bytes, int size, bool old ...@@ -96,8 +100,7 @@ PropertyExceptions::PropertyExceptions( unsigned char* bytes, int size, bool old
//Word adds an additional unsigned char to the opSize to compensate the additional //Word adds an additional unsigned char to the opSize to compensate the additional
//unsigned char needed for the length //unsigned char needed for the length
opSize--; opSize--;
} }break;
break;
case sprmPChgTabs: case sprmPChgTabs:
{ {
...@@ -112,13 +115,19 @@ PropertyExceptions::PropertyExceptions( unsigned char* bytes, int size, bool old ...@@ -112,13 +115,19 @@ PropertyExceptions::PropertyExceptions( unsigned char* bytes, int size, bool old
unsigned char itbdAddMax = bytes[sprmStart + 3 + 2 * itbdDelMax]; unsigned char itbdAddMax = bytes[sprmStart + 3 + 2 * itbdDelMax];
opSize = (short)( ( itbdDelMax * 4 + itbdAddMax * 3 ) - 1 ); opSize = (short)( ( itbdDelMax * 4 + itbdAddMax * 3 ) - 1 );
} }
} }break;
break;
case sprmOldPAnld:
{
lenByte = 1;
opSize = bytes[sprmStart + opCodeSize];
}break;
default: default:
{ //The variable length stand in the unsigned char after the opcode {
//The variable length stand in the unsigned char after the opcode
lenByte = 1; lenByte = 1;
opSize = bytes[sprmStart + 2]; opSize = bytes[sprmStart + opCodeSize];
} }
break; break;
} }
...@@ -126,7 +135,7 @@ PropertyExceptions::PropertyExceptions( unsigned char* bytes, int size, bool old ...@@ -126,7 +135,7 @@ PropertyExceptions::PropertyExceptions( unsigned char* bytes, int size, bool old
//copy sprm to array //copy sprm to array
//length is 2byte for the opCode, lenByte for the length, opSize for the length of the operand //length is 2byte for the opCode, lenByte for the length, opSize for the length of the operand
int sprmBytesSize = 2 + lenByte + opSize; int sprmBytesSize = opCodeSize + lenByte + opSize;
unsigned char* sprmBytes = NULL; unsigned char* sprmBytes = NULL;
sprmBytes = new unsigned char[sprmBytesSize]; sprmBytes = new unsigned char[sprmBytesSize];
...@@ -136,7 +145,7 @@ PropertyExceptions::PropertyExceptions( unsigned char* bytes, int size, bool old ...@@ -136,7 +145,7 @@ PropertyExceptions::PropertyExceptions( unsigned char* bytes, int size, bool old
memcpy( sprmBytes, ( bytes + sprmStart ), sprmBytesSize ); memcpy( sprmBytes, ( bytes + sprmStart ), sprmBytesSize );
//parse //parse
SinglePropertyModifier sprm( sprmBytes, sprmBytesSize ); SinglePropertyModifier sprm( sprmBytes, sprmBytesSize, oldVersion );
grpprl->push_back( sprm ); grpprl->push_back( sprm );
sprmStart += sprmBytesSize; sprmStart += sprmBytesSize;
...@@ -154,4 +163,5 @@ PropertyExceptions::PropertyExceptions( unsigned char* bytes, int size, bool old ...@@ -154,4 +163,5 @@ PropertyExceptions::PropertyExceptions( unsigned char* bytes, int size, bool old
} }
} }
} }
} }
\ No newline at end of file
...@@ -127,6 +127,7 @@ namespace DocFileFormat ...@@ -127,6 +127,7 @@ namespace DocFileFormat
switch (iter->OpCode) switch (iter->OpCode)
{ {
//page margins //page margins
case sprmOldSDxaLeft:
case sprmSDxaLeft: case sprmSDxaLeft:
{ {
//left margin //left margin
...@@ -135,6 +136,7 @@ namespace DocFileFormat ...@@ -135,6 +136,7 @@ namespace DocFileFormat
} }
break; break;
case sprmOldSDxaRight:
case sprmSDxaRight: case sprmSDxaRight:
{ {
//right margin //right margin
...@@ -143,32 +145,38 @@ namespace DocFileFormat ...@@ -143,32 +145,38 @@ namespace DocFileFormat
} }
break; break;
case sprmOldSDyaTop:
case sprmSDyaTop: case sprmSDyaTop:
//top margin //top margin
appendValueAttribute( &pgMar, _T( "w:top" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() ); appendValueAttribute( &pgMar, _T( "w:top" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() );
break; break;
case sprmOldSDyaBottom:
case sprmSDyaBottom: case sprmSDyaBottom:
//bottom margin //bottom margin
appendValueAttribute( &pgMar, _T( "w:bottom" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() ); appendValueAttribute( &pgMar, _T( "w:bottom" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() );
break; break;
case sprmOldSDzaGutter:
case sprmSDzaGutter: case sprmSDzaGutter:
//gutter margin //gutter margin
appendValueAttribute( &pgMar, _T( "w:gutter" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() ); appendValueAttribute( &pgMar, _T( "w:gutter" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() );
break; break;
case sprmOldSDyaHdrTop:
case sprmSDyaHdrTop: case sprmSDyaHdrTop:
//header margin //header margin
appendValueAttribute( &pgMar, _T( "w:header"), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() ); appendValueAttribute( &pgMar, _T( "w:header"), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() );
break; break;
case sprmOldSDyaHdrBottom:
case sprmSDyaHdrBottom: case sprmSDyaHdrBottom:
//footer margin //footer margin
appendValueAttribute( &pgMar, _T( "w:footer" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() ); appendValueAttribute( &pgMar, _T( "w:footer" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() );
break; break;
//page size and orientation //page size and orientation
case sprmOldSXaPage:
case sprmSXaPage: case sprmSXaPage:
{ {
//width //width
...@@ -177,21 +185,25 @@ namespace DocFileFormat ...@@ -177,21 +185,25 @@ namespace DocFileFormat
} }
break; break;
case sprmOldSYaPage:
case sprmSYaPage: case sprmSYaPage:
//height //height
appendValueAttribute( &pgSz, _T( "w:h" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() ); appendValueAttribute( &pgSz, _T( "w:h" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() );
break; break;
case sprmOldSBOrientation:
case sprmSBOrientation: case sprmSBOrientation:
//orientation //orientation
appendValueAttribute( &pgSz, _T( "w:orient" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &PageOrientationMap[0][0], 3, 10 ).c_str() ); appendValueAttribute( &pgSz, _T( "w:orient" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &PageOrientationMap[0][0], 3, 10 ).c_str() );
break; break;
//paper source //paper source
case sprmOldSDmBinFirst:
case sprmSDmBinFirst: case sprmSDmBinFirst:
appendValueAttribute( &paperSrc, _T( "w:first" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() ); appendValueAttribute( &paperSrc, _T( "w:first" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() );
break; break;
case sprmOldSDmBinOther:
case sprmSDmBinOther: case sprmSDmBinOther:
appendValueAttribute( &paperSrc, _T( "w:other" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() ); appendValueAttribute( &paperSrc, _T( "w:other" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() );
break; break;
...@@ -306,6 +318,7 @@ namespace DocFileFormat ...@@ -306,6 +318,7 @@ namespace DocFileFormat
break; break;
// Columns // Columns
case sprmOldSCcolumns:
case sprmSCcolumns: case sprmSCcolumns:
{ {
m_nColumns = static_cast<int> (FormatUtils::BytesToInt16 (iter->Arguments, 0, iter->argumentsSize) + 1); m_nColumns = static_cast<int> (FormatUtils::BytesToInt16 (iter->Arguments, 0, iter->argumentsSize) + 1);
...@@ -317,11 +330,13 @@ namespace DocFileFormat ...@@ -317,11 +330,13 @@ namespace DocFileFormat
} }
break; break;
case sprmOldSDxaColumns:
case sprmSDxaColumns: case sprmSDxaColumns:
//evenly spaced columns //evenly spaced columns
appendValueAttribute (&cols, _T( "w:space" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() ); appendValueAttribute (&cols, _T( "w:space" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() );
break; break;
case sprmOldSDxaColWidth:
case sprmSDxaColWidth: case sprmSDxaColWidth:
{ {
// there is at least one width set, so create the array // there is at least one width set, so create the array
...@@ -336,6 +351,7 @@ namespace DocFileFormat ...@@ -336,6 +351,7 @@ namespace DocFileFormat
} }
break; break;
case sprmOldSDxaColSpacing:
case sprmSDxaColSpacing: case sprmSDxaColSpacing:
{ {
// there is at least one space set, so create the array // there is at least one space set, so create the array
...@@ -356,6 +372,7 @@ namespace DocFileFormat ...@@ -356,6 +372,7 @@ namespace DocFileFormat
break; break;
//title page //title page
case sprmOldSFTitlePage:
case sprmSFTitlePage: case sprmSFTitlePage:
appendFlagElement (m_pXmlNode, *iter, _T( "titlePg" ), true ); appendFlagElement (m_pXmlNode, *iter, _T( "titlePg" ), true );
break; break;
...@@ -366,6 +383,7 @@ namespace DocFileFormat ...@@ -366,6 +383,7 @@ namespace DocFileFormat
break; break;
//type //type
case sprmOldSBkc:
case sprmSBkc: case sprmSBkc:
{ {
this->_type = FormatUtils::MapValueToWideString( iter->Arguments[0], &SectionTypeMap[0][0], 5, 11 ); this->_type = FormatUtils::MapValueToWideString( iter->Arguments[0], &SectionTypeMap[0][0], 5, 11 );
...@@ -373,25 +391,30 @@ namespace DocFileFormat ...@@ -373,25 +391,30 @@ namespace DocFileFormat
break; break;
//align //align
case sprmOldSVjc:
case sprmSVjc: case sprmSVjc:
appendValueElement (m_pXmlNode, _T( "vAlign" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &TextVerticalAlignment[0][0], 4, 7 ).c_str(), true ); appendValueElement (m_pXmlNode, _T( "vAlign" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &TextVerticalAlignment[0][0], 4, 7 ).c_str(), true );
break; break;
//pgNumType //pgNumType
case sprmOldSNfcPgn:
case sprmSNfcPgn: case sprmSNfcPgn:
appendValueAttribute( &pgNumType, _T( "w:fmt" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &PageNumberFormatCodeMap[0][0], 42, 29 ).c_str() ); appendValueAttribute( &pgNumType, _T( "w:fmt" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &PageNumberFormatCodeMap[0][0], 42, 29 ).c_str() );
break; break;
case sprmOldSPgnStart:
case sprmSPgnStart: case sprmSPgnStart:
wsSprmSPgnStart = FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ); wsSprmSPgnStart = FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) );
break; break;
case sprmOldSFPgnRestart:
case sprmSFPgnRestart: case sprmSFPgnRestart:
bWasSprmSFPgnRestart = true; bWasSprmSFPgnRestart = true;
break; break;
// <w:lnNumType> - Line Numbering Settings // <w:lnNumType> - Line Numbering Settings
case sprmOldSLnnMin :
case sprmSLnnMin : case sprmSLnnMin :
{ {
unsigned short start = FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize); unsigned short start = FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize);
...@@ -401,6 +424,7 @@ namespace DocFileFormat ...@@ -401,6 +424,7 @@ namespace DocFileFormat
} }
break; break;
case sprmOldSLnc :
case sprmSLnc : case sprmSLnc :
{ {
SLncOperand mode = (SLncOperand)FormatUtils::BytesToUChar (iter->Arguments, 0, iter->argumentsSize); SLncOperand mode = (SLncOperand)FormatUtils::BytesToUChar (iter->Arguments, 0, iter->argumentsSize);
...@@ -410,6 +434,7 @@ namespace DocFileFormat ...@@ -410,6 +434,7 @@ namespace DocFileFormat
} }
break; break;
case sprmOldSNLnnMod :
case sprmSNLnnMod : case sprmSNLnnMod :
{ {
short countBy = FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize); short countBy = FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize);
......
...@@ -36,38 +36,51 @@ ...@@ -36,38 +36,51 @@
namespace DocFileFormat namespace DocFileFormat
{ {
SinglePropertyModifier::SinglePropertyModifier() : Arguments(NULL), OpCode(sprmPIstd), fSpec(false), Type(PAP), argumentsSize(0) SinglePropertyModifier::SinglePropertyModifier( bool oldVersion_) :
Arguments(NULL), OpCode(sprmPIstd), fSpec(false), Type(PAP), argumentsSize(0), oldVersion (oldVersion_)
{ {
} }
/// parses the unsigned char to retrieve a SPRM SinglePropertyModifier::SinglePropertyModifier(unsigned char* bytes, int size, bool oldVersion_) :
SinglePropertyModifier::SinglePropertyModifier(unsigned char* bytes, int size) : Arguments(NULL), OpCode(sprmPIstd), fSpec(false), Type(PAP), argumentsSize(0) Arguments(NULL), OpCode(sprmPIstd), fSpec(false), Type(PAP), argumentsSize(0), oldVersion (oldVersion_)
{ {
unsigned char opSize = 0;
unsigned char opCodeSize = 0;
if (oldVersion)
{
opCodeSize = 1;
//first 1 byte are the operation code ...
OpCode = (OperationCode)FormatUtils::BytesToUChar( bytes, 0, size );
opSize = GetOldOperandSize( (unsigned char)OpCode );
}
else
{
opCodeSize = 2;
//first 2 bytes are the operation code ... //first 2 bytes are the operation code ...
this->OpCode = (OperationCode)FormatUtils::BytesToUInt16( bytes, 0, size ); OpCode = (OperationCode)FormatUtils::BytesToUInt16( bytes, 0, size );
//... whereof bit 9 is fSpec ... //... whereof bit 9 is fSpec ...
unsigned int j = (unsigned int)this->OpCode << 22; unsigned int j = (unsigned int)this->OpCode << 22;
j = j >> 31; j = j >> 31;
if ( j == 1 ) if ( j == 1 )
{ {
this->fSpec = true; fSpec = true;
} }
else else
{ {
this->fSpec = false; fSpec = false;
} }
//... and bits 10,11,12 are the type ... //... and bits 10,11,12 are the type ...
unsigned int i = (unsigned int)this->OpCode << 19; unsigned int i = (unsigned int)OpCode << 19;
i = i >> 29; i = i >> 29;
this->Type = (SprmType)i; Type = (SprmType)i;
//... and last 3 bits are the spra //... and last 3 bits are the spra
unsigned char spra = (unsigned char)( (int)this->OpCode >> 13 ); unsigned char spra = (unsigned char)( (int)OpCode >> 13 );
unsigned char opSize = GetOperandSize( spra ); opSize = GetOperandSize( spra );
}
if ( opSize == 255 ) if ( opSize == 255 )
{ {
...@@ -77,31 +90,31 @@ namespace DocFileFormat ...@@ -77,31 +90,31 @@ namespace DocFileFormat
case sprmTDefTable10: case sprmTDefTable10:
{ {
//the variable length stand in the bytes 2 and 3 //the variable length stand in the bytes 2 and 3
short opSizeTable = FormatUtils::BytesToInt16( bytes, 2, size ); short opSizeTable = FormatUtils::BytesToInt16( bytes, opCodeSize, size );
this->argumentsSize = opSizeTable-1; argumentsSize = opSizeTable-1;
//and the arguments start at the unsigned char after that (byte3) //and the arguments start at the unsigned char after that (byte3)
this->Arguments = new unsigned char[this->argumentsSize]; Arguments = new unsigned char[argumentsSize];
//Arguments start at unsigned char 4 //Arguments start at unsigned char 4
memcpy( this->Arguments, ( bytes + 4 ), this->argumentsSize ); memcpy( Arguments, ( bytes + opCodeSize + 2 ), argumentsSize );
} }
break; break;
case sprmPChgTabs: case sprmPChgTabs:
{ {
this->argumentsSize = bytes[2]; argumentsSize = bytes[2];
this->Arguments = new unsigned char[this->argumentsSize]; Arguments = new unsigned char[argumentsSize];
memcpy( this->Arguments, ( bytes + 3 ), this->argumentsSize ); memcpy( Arguments, ( bytes + opCodeSize + 1 ), argumentsSize );
} }
break; break;
default: default:
{ {
//the variable length stand in the unsigned char after the opcode (byte2) //the variable length stand in the unsigned char after the opcode (byte2)
opSize = bytes[2]; opSize = bytes[opCodeSize];
this->argumentsSize = opSize; argumentsSize = opSize;
//and the arguments start at the unsigned char after that (byte3) //and the arguments start at the unsigned char after that (byte3)
this->Arguments = new unsigned char[this->argumentsSize]; Arguments = new unsigned char[argumentsSize];
memcpy( this->Arguments, ( bytes + 3 ), this->argumentsSize ); memcpy( Arguments, ( bytes + opCodeSize + 1 ), argumentsSize );
} }
break; break;
...@@ -109,9 +122,9 @@ namespace DocFileFormat ...@@ -109,9 +122,9 @@ namespace DocFileFormat
} }
else else
{ {
this->argumentsSize = opSize; argumentsSize = opSize;
this->Arguments = new unsigned char[this->argumentsSize]; Arguments = new unsigned char[argumentsSize];
memcpy( this->Arguments, ( bytes + 2 ), this->argumentsSize ); memcpy( Arguments, ( bytes + opCodeSize ), argumentsSize );
} }
} }
...@@ -119,19 +132,20 @@ namespace DocFileFormat ...@@ -119,19 +132,20 @@ namespace DocFileFormat
{ {
if ( spm.Arguments != NULL ) if ( spm.Arguments != NULL )
{ {
this->argumentsSize = spm.argumentsSize; argumentsSize = spm.argumentsSize;
this->Arguments = new unsigned char[this->argumentsSize]; Arguments = new unsigned char[argumentsSize];
memcpy( this->Arguments, spm.Arguments, this->argumentsSize ); memcpy( Arguments, spm.Arguments, argumentsSize );
this->fSpec = spm.fSpec; fSpec = spm.fSpec;
this->OpCode = spm.OpCode; OpCode = spm.OpCode;
this->Type = spm.Type; Type = spm.Type;
oldVersion = spm.oldVersion;
} }
} }
bool SinglePropertyModifier::operator == (const SinglePropertyModifier& spm) const bool SinglePropertyModifier::operator == (const SinglePropertyModifier& spm) const
{ {
if ( ( this->argumentsSize == spm.argumentsSize ) && ( memcmp( this->Arguments, spm.Arguments, this->argumentsSize ) == 0 ) && if ( ( argumentsSize == spm.argumentsSize ) && ( memcmp( Arguments, spm.Arguments, argumentsSize ) == 0 ) &&
( this->fSpec == spm.fSpec ) && ( this->OpCode == spm.OpCode ) && ( this->Type == spm.Type ) ) ( fSpec == spm.fSpec ) && ( OpCode == spm.OpCode ) && ( Type == spm.Type ) )
{ {
return true; return true;
} }
...@@ -156,8 +170,10 @@ namespace DocFileFormat ...@@ -156,8 +170,10 @@ namespace DocFileFormat
fSpec = spm.fSpec; fSpec = spm.fSpec;
Type = spm.Type; Type = spm.Type;
argumentsSize = spm.argumentsSize; argumentsSize = spm.argumentsSize;
oldVersion = spm.oldVersion;
Arguments = new unsigned char[argumentsSize]; Arguments = new unsigned char[argumentsSize];
memcpy(Arguments, spm.Arguments, spm.argumentsSize); memcpy(Arguments, spm.Arguments, spm.argumentsSize);
} }
...@@ -187,4 +203,15 @@ namespace DocFileFormat ...@@ -187,4 +203,15 @@ namespace DocFileFormat
default: return 0; default: return 0;
} }
} }
static const unsigned char OldOperandSizeTable[] =
{
0, 0, 2, 255, 1, 1, 1, 1, 1, 1, 1, 1, 255, 1, 1, 255, 2, 2, 2, 2, 4, 2, 2, 255, 1, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 255, 2, 4, 1, 2, 3, 255, 1, 0, 0, 0, 0, 2, 255, 255, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 3, 2, 2, 1, 1, 1, 1, 1, 255, 1, 255, 255, 2, 255, 2, 2, 0, 0, 0, 0, 0, 0, 1, 1, 1, 255, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 1, 1, 255, 0, 0, 3, 3, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, 1, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 1, 1, 12, 255, 2, 0, 0, 4, 5, 4, 2, 4, 2, 2, 5, 4, 0, 0, 0, 0, 0, 0, 0, 0
};
unsigned char SinglePropertyModifier::GetOldOperandSize(unsigned char code)
{
if (code < 2 || code > 207) return -1;
return OldOperandSizeTable [code];
}
} }
...@@ -48,6 +48,7 @@ namespace DocFileFormat ...@@ -48,6 +48,7 @@ namespace DocFileFormat
class SinglePropertyModifier class SinglePropertyModifier
{ {
public: public:
bool oldVersion;
/// The operation code identifies the property of the /// The operation code identifies the property of the
/// PAP/CHP/PIC/SEP/TAP which sould be modified /// PAP/CHP/PIC/SEP/TAP which sould be modified
OperationCode OpCode; OperationCode OpCode;
...@@ -60,10 +61,11 @@ namespace DocFileFormat ...@@ -60,10 +61,11 @@ namespace DocFileFormat
/// The Arguments size /// The Arguments size
unsigned int argumentsSize; unsigned int argumentsSize;
SinglePropertyModifier(); SinglePropertyModifier(bool oldVersion);
/// parses the unsigned char to retrieve a SPRM /// parses the unsigned char to retrieve a SPRM
SinglePropertyModifier( unsigned char* bytes, int size ); SinglePropertyModifier( unsigned char* bytes, int size, bool oldVersion );
SinglePropertyModifier( const SinglePropertyModifier& spm ); SinglePropertyModifier( const SinglePropertyModifier& spm);
bool operator == ( const SinglePropertyModifier& spm ) const; bool operator == ( const SinglePropertyModifier& spm ) const;
bool operator != ( const SinglePropertyModifier& spm ) const; bool operator != ( const SinglePropertyModifier& spm ) const;
SinglePropertyModifier& operator = ( const SinglePropertyModifier& spm ); SinglePropertyModifier& operator = ( const SinglePropertyModifier& spm );
...@@ -71,5 +73,6 @@ namespace DocFileFormat ...@@ -71,5 +73,6 @@ namespace DocFileFormat
/// Get be used to get the size of the sprm's operand. /// Get be used to get the size of the sprm's operand.
/// Returns 0 if the Operation failed and 255 if the size is variable /// Returns 0 if the Operation failed and 255 if the size is variable
static unsigned char GetOperandSize( unsigned char spra ); static unsigned char GetOperandSize( unsigned char spra );
static unsigned char GetOldOperandSize( unsigned char code);
}; };
} }
...@@ -78,38 +78,36 @@ namespace DocFileFormat ...@@ -78,38 +78,36 @@ namespace DocFileFormat
std::list<SinglePropertyModifier>::const_reverse_iterator rend = tapx->grpprl->rend(); std::list<SinglePropertyModifier>::const_reverse_iterator rend = tapx->grpprl->rend();
for (std::list<SinglePropertyModifier>::const_reverse_iterator iter = tapx->grpprl->rbegin(); iter != rend; ++iter) for (std::list<SinglePropertyModifier>::const_reverse_iterator iter = tapx->grpprl->rbegin(); iter != rend; ++iter)
{ {
#ifdef _DEBUG
SinglePropertyModifier spm = (*iter);
#endif
switch (iter->OpCode) switch (iter->OpCode)
{ {
case sprmTDefTable: // Table definition SPRM case sprmOldTDefTable:
case sprmTDefTable:
{ {
SprmTDefTable tdef(iter->Arguments, iter->argumentsSize); SprmTDefTable tdef(iter->Arguments, iter->argumentsSize);
int cc = tdef.numberOfColumns; int cc = tdef.numberOfColumns;
this->_tGrid = tdef.rgdxaCenter; _tGrid = tdef.rgdxaCenter;
this->_tcDef = tdef.rgTc80[(std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1)]; // NOTE: fix for crash _tcDef = tdef.rgTc80[(std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1)]; // NOTE: fix for crash
appendValueElement( this->_tcPr, _T( "textDirection" ), FormatUtils::MapValueToWideString( this->_tcDef.textFlow, &Global::TextFlowMap[0][0], 6, 6 ).c_str(), false ); appendValueElement( _tcPr, _T( "textDirection" ), FormatUtils::MapValueToWideString( _tcDef.textFlow, &Global::TextFlowMap[0][0], 6, 6 ).c_str(), false );
if ( this->_tcDef.vertMerge == Global::fvmMerge ) if ( _tcDef.vertMerge == Global::fvmMerge )
{ {
appendValueElement( this->_tcPr, _T( "vMerge" ), _T( "continue" ), false ); appendValueElement( _tcPr, _T( "vMerge" ), _T( "continue" ), false );
} }
else if ( this->_tcDef.vertMerge == Global::fvmRestart ) else if ( _tcDef.vertMerge == Global::fvmRestart )
{ {
appendValueElement( this->_tcPr, _T( "vMerge" ), _T( "restart" ), false ); appendValueElement( _tcPr, _T( "vMerge" ), _T( "restart" ), false );
} }
appendValueElement( this->_tcPr, _T( "vAlign" ), FormatUtils::MapValueToWideString( this->_tcDef.vertAlign, &Global::VerticalAlignMap[0][0], 3, 7 ).c_str(), false ); appendValueElement( _tcPr, _T( "vAlign" ), FormatUtils::MapValueToWideString( _tcDef.vertAlign, &Global::VerticalAlignMap[0][0], 3, 7 ).c_str(), false );
if ( this->_tcDef.fFitText ) if ( _tcDef.fFitText )
{ {
appendValueElement( _tcPr, _T( "tcFitText" ), _T( "" ), false ); appendValueElement( _tcPr, _T( "tcFitText" ), _T( "" ), false );
} }
if ( this->_tcDef.fNoWrap ) if ( _tcDef.fNoWrap )
{ {
appendValueElement( _tcPr, _T( "noWrap" ), _T( "" ), true ); appendValueElement( _tcPr, _T( "noWrap" ), _T( "" ), true );
} }
...@@ -117,9 +115,9 @@ namespace DocFileFormat ...@@ -117,9 +115,9 @@ namespace DocFileFormat
nComputedCellWidth = (short)( tdef.rgdxaCenter[(size_t)(std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1) + 1] - nComputedCellWidth = (short)( tdef.rgdxaCenter[(size_t)(std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1) + 1] -
tdef.rgdxaCenter[(std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1)] ); // NOTE: fix for crash tdef.rgdxaCenter[(std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1)] ); // NOTE: fix for crash
//borders
if (!IsTableBordersDefined(tapx->grpprl)) if (!IsTableBordersDefined(tapx->grpprl))
{ { //borders
RELEASEOBJECT(_brcTop); RELEASEOBJECT(_brcTop);
_brcTop = new BorderCode(*_tcDef.brcTop); _brcTop = new BorderCode(*_tcDef.brcTop);
...@@ -135,66 +133,65 @@ namespace DocFileFormat ...@@ -135,66 +133,65 @@ namespace DocFileFormat
} }
break; break;
//margins
case sprmTCellPadding: case sprmTCellPadding:
{ { //margins
unsigned char first = iter->Arguments[0]; unsigned char first = iter->Arguments[0];
unsigned char lim = iter->Arguments[1]; unsigned char lim = iter->Arguments[1];
unsigned char ftsMargin = iter->Arguments[3]; unsigned char ftsMargin = iter->Arguments[3];
short wMargin = FormatUtils::BytesToInt16( iter->Arguments, 4, iter->argumentsSize ); short wMargin = FormatUtils::BytesToInt16( iter->Arguments, 4, iter->argumentsSize );
if ( ( this->_cellIndex >= first ) && ( this->_cellIndex < lim ) ) if ( ( _cellIndex >= first ) && ( _cellIndex < lim ) )
{ {
if ( FormatUtils::GetBitFromInt( iter->Arguments[2], 0 ) == true ) if ( FormatUtils::GetBitFromInt( iter->Arguments[2], 0 ) == true )
{ {
appendDxaElement( this->_tcMar, _T( "top" ), FormatUtils::IntToWideString( wMargin ).c_str(), true ); appendDxaElement( _tcMar, _T( "top" ), FormatUtils::IntToWideString( wMargin ).c_str(), true );
} }
if ( FormatUtils::GetBitFromInt( iter->Arguments[2], 1 ) == true ) if ( FormatUtils::GetBitFromInt( iter->Arguments[2], 1 ) == true )
{ {
appendDxaElement( this->_tcMar, _T( "left" ), FormatUtils::IntToWideString( wMargin ).c_str(), true ); appendDxaElement( _tcMar, _T( "left" ), FormatUtils::IntToWideString( wMargin ).c_str(), true );
} }
if ( FormatUtils::GetBitFromInt( iter->Arguments[2], 2 ) == true ) if ( FormatUtils::GetBitFromInt( iter->Arguments[2], 2 ) == true )
{ {
appendDxaElement( this->_tcMar, _T( "bottom" ), FormatUtils::IntToWideString( wMargin ).c_str(), true ); appendDxaElement( _tcMar, _T( "bottom" ), FormatUtils::IntToWideString( wMargin ).c_str(), true );
} }
if ( FormatUtils::GetBitFromInt( iter->Arguments[2], 3 ) == true ) if ( FormatUtils::GetBitFromInt( iter->Arguments[2], 3 ) == true )
{ {
appendDxaElement( this->_tcMar, _T( "right" ), FormatUtils::IntToWideString( wMargin ).c_str(), true ); appendDxaElement( _tcMar, _T( "right" ), FormatUtils::IntToWideString( wMargin ).c_str(), true );
} }
} }
} }
break; break;
case sprmTDefTableShd80: case sprmTDefTableShd80:
{
if (!tapx->IsSkipShading97()) // если такой операнд единственный то учитываем его, иначе скипаем его if (!tapx->IsSkipShading97()) // если такой операнд единственный то учитываем его, иначе скипаем его
{ {
apppendCellShading(iter->Arguments, iter->argumentsSize, _cellIndex); apppendCellShading(iter->Arguments, iter->argumentsSize, _cellIndex);
} }
break; }break;
// shading
case sprmOldTDefTableShd:
case sprmTDefTableShd: case sprmTDefTableShd:
// cell shading for cells 0-20 { // cell shading for cells 0-20
apppendCellShading(iter->Arguments, iter->argumentsSize, _cellIndex); apppendCellShading(iter->Arguments, iter->argumentsSize, _cellIndex);
break; }break;
case sprmTDefTableShd2nd: case sprmTDefTableShd2nd:
// cell shading for cells 21-42 { // cell shading for cells 21-42
apppendCellShading(iter->Arguments, iter->argumentsSize, (_cellIndex - 21)); apppendCellShading(iter->Arguments, iter->argumentsSize, (_cellIndex - 21));
break; }break;
case sprmTDefTableShd3rd: case sprmTDefTableShd3rd:
// cell shading for cells 43-62 { // cell shading for cells 43-62
apppendCellShading(iter->Arguments, iter->argumentsSize, (_cellIndex - 43)); apppendCellShading(iter->Arguments, iter->argumentsSize, (_cellIndex - 43));
break; }break;
//width
case sprmTCellWidth: case sprmTCellWidth:
{ { //width
unsigned char first = iter->Arguments[0]; unsigned char first = iter->Arguments[0];
unsigned char lim = iter->Arguments[1]; unsigned char lim = iter->Arguments[1];
...@@ -206,9 +203,8 @@ namespace DocFileFormat ...@@ -206,9 +203,8 @@ namespace DocFileFormat
} }
break; break;
//vertical alignment
case sprmTVertAlign: case sprmTVertAlign:
{ { //vertical alignment
unsigned char first = iter->Arguments[0]; unsigned char first = iter->Arguments[0];
unsigned char lim = iter->Arguments[1]; unsigned char lim = iter->Arguments[1];
...@@ -219,28 +215,27 @@ namespace DocFileFormat ...@@ -219,28 +215,27 @@ namespace DocFileFormat
} }
break; break;
//Autofit
case sprmTFitText: case sprmTFitText:
{ { //Autofit
unsigned char first = iter->Arguments[0]; unsigned char first = iter->Arguments[0];
unsigned char lim = iter->Arguments[1]; unsigned char lim = iter->Arguments[1];
if ( ( this->_cellIndex >= first ) && ( this->_cellIndex < lim ) ) if ( ( _cellIndex >= first ) && ( _cellIndex < lim ) )
{ {
appendValueElement( this->_tcPr, _T( "tcFitText" ), FormatUtils::IntToWideString( iter->Arguments[2] ).c_str(), true ); appendValueElement( _tcPr, _T( "tcFitText" ), FormatUtils::IntToWideString( iter->Arguments[2] ).c_str(), true );
} }
} }
break; break;
//borders (cell definition) case sprmOldTSetBrc:
case sprmTSetBrc: case sprmTSetBrc:
{ { //borders (cell definition)
unsigned char min = iter->Arguments[0]; unsigned char min = iter->Arguments[0];
unsigned char max = iter->Arguments[1]; unsigned char max = iter->Arguments[1];
int bordersToApply = (int)( iter->Arguments[2] ); int bordersToApply = (int)( iter->Arguments[2] );
if ( ( this->_cellIndex >= min ) && ( this->_cellIndex < max ) ) if ( ( _cellIndex >= min ) && ( _cellIndex < max ) )
{ {
const int brcSize = 8; const int brcSize = 8;
unsigned char brcBytes[brcSize]; unsigned char brcBytes[brcSize];
...@@ -248,25 +243,25 @@ namespace DocFileFormat ...@@ -248,25 +243,25 @@ namespace DocFileFormat
if( FormatUtils::BitmaskToBool( bordersToApply, 0x01 ) ) if( FormatUtils::BitmaskToBool( bordersToApply, 0x01 ) )
{ {
RELEASEOBJECT( this->_brcTop ); RELEASEOBJECT( _brcTop );
this->_brcTop = new BorderCode( brcBytes, brcSize ); _brcTop = new BorderCode( brcBytes, brcSize );
} }
if( FormatUtils::BitmaskToBool( bordersToApply, 0x02 ) ) if( FormatUtils::BitmaskToBool( bordersToApply, 0x02 ) )
{ {
RELEASEOBJECT( this->_brcLeft ); RELEASEOBJECT( _brcLeft );
this->_brcLeft = new BorderCode( brcBytes, brcSize ); _brcLeft = new BorderCode( brcBytes, brcSize );
} }
if ( FormatUtils::BitmaskToBool( bordersToApply, 0x04 ) ) if ( FormatUtils::BitmaskToBool( bordersToApply, 0x04 ) )
{ {
RELEASEOBJECT( this->_brcBottom ); RELEASEOBJECT( _brcBottom );
this->_brcBottom = new BorderCode( brcBytes, brcSize ); _brcBottom = new BorderCode( brcBytes, brcSize );
} }
if ( FormatUtils::BitmaskToBool( bordersToApply, 0x08 ) ) if ( FormatUtils::BitmaskToBool( bordersToApply, 0x08 ) )
{ {
RELEASEOBJECT( this->_brcRight ); RELEASEOBJECT( _brcRight );
_brcRight = new BorderCode( brcBytes, brcSize ); _brcRight = new BorderCode( brcBytes, brcSize );
} }
} }
...@@ -284,18 +279,18 @@ namespace DocFileFormat ...@@ -284,18 +279,18 @@ namespace DocFileFormat
_tcPr->AppendChild( tcW ); _tcPr->AppendChild( tcW );
//grid span //grid span
this->_gridSpan = 1; _gridSpan = 1;
if ( ( this->_gridIndex < (int)this->_grid->size() ) && ( nComputedCellWidth > this->_grid->at( this->_gridIndex ) ) ) if ( ( _gridIndex < (int)_grid->size() ) && ( nComputedCellWidth > _grid->at( _gridIndex ) ) )
{ {
//check the number of merged cells //check the number of merged cells
int w = this->_grid->at( this->_gridIndex ); int w = _grid->at( _gridIndex );
for ( unsigned int i = this->_gridIndex + 1; i < this->_grid->size(); i++ ) for ( unsigned int i = _gridIndex + 1; i < _grid->size(); i++ )
{ {
this->_gridSpan++; _gridSpan++;
w += this->_grid->at( i ); w += _grid->at( i );
if ( w >= nComputedCellWidth ) if ( w >= nComputedCellWidth )
{ {
...@@ -303,7 +298,7 @@ namespace DocFileFormat ...@@ -303,7 +298,7 @@ namespace DocFileFormat
} }
} }
appendValueElement( this->_tcPr, _T( "gridSpan" ), FormatUtils::IntToWideString( this->_gridSpan ).c_str(), true ); appendValueElement( _tcPr, _T( "gridSpan" ), FormatUtils::IntToWideString( _gridSpan ).c_str(), true );
} }
//append margins //append margins
...@@ -337,13 +332,13 @@ namespace DocFileFormat ...@@ -337,13 +332,13 @@ namespace DocFileFormat
if (_brcRight) if (_brcRight)
{ {
XMLTools::XMLElement<wchar_t> rightBorder( _T( "w:right" ) ); XMLTools::XMLElement<wchar_t> rightBorder( _T( "w:right" ) );
appendBorderAttributes( this->_brcRight, &rightBorder ); appendBorderAttributes( _brcRight, &rightBorder );
addOrSetBorder( this->_tcBorders, &rightBorder ); addOrSetBorder( _tcBorders, &rightBorder );
} }
if ( this->_tcBorders->GetChildCount() > 0 ) if ( _tcBorders->GetChildCount() > 0 )
{ {
this->_tcPr->AppendChild( *(this->_tcBorders) ); _tcPr->AppendChild( *(_tcBorders) );
} }
//write Properties //write Properties
......
...@@ -43,7 +43,7 @@ namespace DocFileFormat ...@@ -43,7 +43,7 @@ namespace DocFileFormat
{ {
for ( std::list<ITableCellElementPtr>::const_iterator iter = _tableCell.cellElements.begin(); iter != _tableCell.cellElements.end(); iter++ ) for ( std::list<ITableCellElementPtr>::const_iterator iter = _tableCell.cellElements.begin(); iter != _tableCell.cellElements.end(); iter++ )
{ {
this->AddItem( **iter ); AddItem( **iter );
} }
} }
...@@ -55,16 +55,16 @@ namespace DocFileFormat ...@@ -55,16 +55,16 @@ namespace DocFileFormat
{ {
if ( this != &_tableCell ) if ( this != &_tableCell )
{ {
this->cp = _tableCell.cp; cp = _tableCell.cp;
this->depth = _tableCell.depth; depth = _tableCell.depth;
this->cellElements.clear(); cellElements.clear();
for ( std::list<ITableCellElementPtr>::const_iterator iter = _tableCell.cellElements.begin(); iter != _tableCell.cellElements.end(); iter++ ) for ( std::list<ITableCellElementPtr>::const_iterator iter = _tableCell.cellElements.begin(); iter != _tableCell.cellElements.end(); iter++ )
{ {
this->AddItem( **iter ); AddItem( **iter );
} }
this->documentMapping = _tableCell.documentMapping; documentMapping = _tableCell.documentMapping;
} }
return *this; return *this;
...@@ -72,38 +72,38 @@ namespace DocFileFormat ...@@ -72,38 +72,38 @@ namespace DocFileFormat
void TableCell::SetCP( int _cp ) void TableCell::SetCP( int _cp )
{ {
this->cp = _cp; cp = _cp;
} }
int TableCell::GetCP() const int TableCell::GetCP() const
{ {
return this->cp; return cp;
} }
void TableCell::SetDepth( unsigned int _depth ) void TableCell::SetDepth( unsigned int _depth )
{ {
this->depth = _depth; depth = _depth;
} }
unsigned int TableCell::GetDepth() const unsigned int TableCell::GetDepth() const
{ {
return this->depth; return depth;
} }
void TableCell::AddItem( const ITableCellElement& _tableCellElement ) void TableCell::AddItem( const ITableCellElement& _tableCellElement )
{ {
this->cellElements.push_back( ITableCellElementPtr( static_cast<ITableCellElement*>( _tableCellElement.Clone() ) ) ); cellElements.push_back( ITableCellElementPtr( static_cast<ITableCellElement*>( _tableCellElement.Clone() ) ) );
} }
bool TableCell::IsEmpty() const bool TableCell::IsEmpty() const
{ {
return this->cellElements.empty(); return cellElements.empty();
} }
void TableCell::Clear() void TableCell::Clear()
{ {
this->cp = 0; cp = 0;
this->cellElements.clear(); cellElements.clear();
} }
void TableCell::Convert(IMapping* mapping, TablePropertyExceptions* tapx, const std::vector<short>* grid, int& gridIndex, int nCellIndex) void TableCell::Convert(IMapping* mapping, TablePropertyExceptions* tapx, const std::vector<short>* grid, int& gridIndex, int nCellIndex)
...@@ -158,39 +158,39 @@ namespace DocFileFormat ...@@ -158,39 +158,39 @@ namespace DocFileFormat
void TableRow::SetCP( int _cp ) void TableRow::SetCP( int _cp )
{ {
this->cp = _cp; cp = _cp;
} }
int TableRow::GetCP() const int TableRow::GetCP() const
{ {
return this->cp; return cp;
} }
void TableRow::SetDepth( unsigned int _depth ) void TableRow::SetDepth( unsigned int _depth )
{ {
this->depth = _depth; depth = _depth;
} }
unsigned int TableRow::GetDepth() const unsigned int TableRow::GetDepth() const
{ {
return this->depth; return depth;
} }
void TableRow::AddCell( const TableCell& _tableCell ) void TableRow::AddCell( const TableCell& _tableCell )
{ {
this->cells.push_back( _tableCell ); cells.push_back( _tableCell );
} }
bool TableRow::IsEmpty() const bool TableRow::IsEmpty() const
{ {
return this->cells.empty(); return cells.empty();
} }
void TableRow::Clear() void TableRow::Clear()
{ {
this->cp = 0; cp = 0;
this->depth = 1; depth = 1;
this->cells.clear(); cells.clear();
} }
void TableRow::Convert(IMapping* mapping, const std::vector<short>* grid) void TableRow::Convert(IMapping* mapping, const std::vector<short>* grid)
...@@ -205,11 +205,11 @@ namespace DocFileFormat ...@@ -205,11 +205,11 @@ namespace DocFileFormat
int gridIndex = 0; int gridIndex = 0;
int nCellIndex = 0; int nCellIndex = 0;
ParagraphPropertyExceptions* papxBackup = this->documentMapping->_lastValidPapx; ParagraphPropertyExceptions* papxBackup = documentMapping->_lastValidPapx;
SectionPropertyExceptions* sepxBackup = this->documentMapping->_lastValidSepx; SectionPropertyExceptions* sepxBackup = documentMapping->_lastValidSepx;
//start w:tr //start w:tr
this->documentMapping->GetXMLWriter()->WriteNodeBegin( _T( "w:tr" ) ); documentMapping->GetXMLWriter()->WriteNodeBegin( _T( "w:tr" ) );
//convert the properties //convert the properties
int fcRowEnd = documentMapping->findRowEndFc(cp, depth); int fcRowEnd = documentMapping->findRowEndFc(cp, depth);
...@@ -217,20 +217,20 @@ namespace DocFileFormat ...@@ -217,20 +217,20 @@ namespace DocFileFormat
documentMapping->m_document->DataStream, documentMapping->m_document->DataStream,
documentMapping->m_document->FIB->m_bOlderVersion); documentMapping->m_document->FIB->m_bOlderVersion);
std::list<CharacterPropertyExceptions*>* chpxs = this->documentMapping->m_document->GetCharacterPropertyExceptions( fcRowEnd, fcRowEnd + 1 ); std::list<CharacterPropertyExceptions*>* chpxs = documentMapping->m_document->GetCharacterPropertyExceptions( fcRowEnd, fcRowEnd + 1 );
TableRowPropertiesMapping trpMapping( this->documentMapping->GetXMLWriter(), *(chpxs->begin()) ); TableRowPropertiesMapping trpMapping( documentMapping->GetXMLWriter(), *(chpxs->begin()) );
tapx.Convert( &trpMapping ); tapx.Convert( &trpMapping );
this->documentMapping->_lastValidPapx = papxBackup; documentMapping->_lastValidPapx = papxBackup;
this->documentMapping->_lastValidSepx = sepxBackup; documentMapping->_lastValidSepx = sepxBackup;
for ( std::list<TableCell>::iterator iter = this->cells.begin(); iter != this->cells.end(); iter++ ) for ( std::list<TableCell>::iterator iter = cells.begin(); iter != cells.end(); iter++ )
{ {
iter->Convert( mapping, &tapx, grid, gridIndex, nCellIndex++ ); iter->Convert( mapping, &tapx, grid, gridIndex, nCellIndex++ );
} }
//end w:tr //end w:tr
this->documentMapping->GetXMLWriter()->WriteNodeEnd( _T( "w:tr" ) ); documentMapping->GetXMLWriter()->WriteNodeEnd( _T( "w:tr" ) );
RELEASEOBJECT( chpxs ); RELEASEOBJECT( chpxs );
} }
...@@ -249,27 +249,27 @@ namespace DocFileFormat ...@@ -249,27 +249,27 @@ namespace DocFileFormat
int DocParagraph::GetCPStart() const int DocParagraph::GetCPStart() const
{ {
return this->cpStart; return cpStart;
} }
void DocParagraph::SetCPStart( int _cpStart ) void DocParagraph::SetCPStart( int _cpStart )
{ {
this->cpStart = _cpStart; cpStart = _cpStart;
} }
int DocParagraph::GetCPEnd() const int DocParagraph::GetCPEnd() const
{ {
return this->cpEnd; return cpEnd;
} }
void DocParagraph::SetCPEnd( int _cpEnd ) void DocParagraph::SetCPEnd( int _cpEnd )
{ {
this->cpEnd = _cpEnd; cpEnd = _cpEnd;
} }
IVirtualConstructor* DocParagraph::New() const IVirtualConstructor* DocParagraph::New() const
{ {
return new DocParagraph( this->documentMapping ); return new DocParagraph( documentMapping );
} }
IVirtualConstructor* DocParagraph::Clone() const IVirtualConstructor* DocParagraph::Clone() const
...@@ -281,10 +281,10 @@ namespace DocFileFormat ...@@ -281,10 +281,10 @@ namespace DocFileFormat
{ {
if ( mapping != NULL ) if ( mapping != NULL )
{ {
this->documentMapping = static_cast<DocumentMapping*>(mapping); documentMapping = static_cast<DocumentMapping*>(mapping);
} }
this->documentMapping->writeParagraph( this->cpStart ); documentMapping->writeParagraph( cpStart );
} }
} }
...@@ -324,13 +324,13 @@ namespace DocFileFormat ...@@ -324,13 +324,13 @@ namespace DocFileFormat
ParagraphPropertyExceptions* papx = NULL; ParagraphPropertyExceptions* papx = NULL;
papx = this->documentMapping->findValidPapx( fc ); papx = documentMapping->findValidPapx( fc );
TableInfo tai( papx ); TableInfo tai( papx );
return ( ( tai.fInTable ) && ( ( ( this->documentMapping->m_document->Text->at( _cp ) == 0x0007 ) && ( tai.iTap <= 1 ) && return ( ( tai.fInTable ) && ( ( ( documentMapping->m_document->Text->at( _cp ) == 0x0007 ) && ( tai.iTap <= 1 ) &&
( tai.fTtp ) ) || ( tai.fTtp ) ) ||
( ( this->documentMapping->m_document->Text->at( _cp ) == 0x000D ) && ( tai.iTap > 1 ) && ( ( documentMapping->m_document->Text->at( _cp ) == 0x000D ) && ( tai.iTap > 1 ) &&
( tai.fInnerTtp ) ) ) ); ( tai.fInnerTtp ) ) ) );
} }
...@@ -344,48 +344,48 @@ namespace DocFileFormat ...@@ -344,48 +344,48 @@ namespace DocFileFormat
ParagraphPropertyExceptions* papx = NULL; ParagraphPropertyExceptions* papx = NULL;
papx = this->documentMapping->findValidPapx( fc ); papx = documentMapping->findValidPapx( fc );
TableInfo tai( papx ); TableInfo tai( papx );
return ( ( tai.fInTable ) && ( this->documentMapping->m_document->Text->at( _cp ) == 0x000D ) && return ( ( tai.fInTable ) && ( documentMapping->m_document->Text->at( _cp ) == 0x000D ) &&
( !this->IsCellMarker( _cp ) ) && ( !this->IsRowMarker( _cp ) ) ); ( !IsCellMarker( _cp ) ) && ( !IsRowMarker( _cp ) ) );
} }
Table::Table( DocumentMapping* _documentMapping, int _cp, unsigned int _depth ): Table::Table( DocumentMapping* _documentMapping, int _cp, unsigned int _depth ):
cpStart(_cp), cpEnd(_cp), depth(_depth), documentMapping(_documentMapping) cpStart(_cp), cpEnd(_cp), depth(_depth), documentMapping(_documentMapping)
{ {
if ( this->documentMapping != NULL ) if ( documentMapping != NULL )
{ {
int paragraphBeginCP = _cp; int paragraphBeginCP = _cp;
ParagraphPropertyExceptions* papxBackup = this->documentMapping->_lastValidPapx; ParagraphPropertyExceptions* papxBackup = documentMapping->_lastValidPapx;
SectionPropertyExceptions* sepxBackup = this->documentMapping->_lastValidSepx; SectionPropertyExceptions* sepxBackup = documentMapping->_lastValidSepx;
int fc = documentMapping->m_document->FindFileCharPos(_cp); int fc = documentMapping->m_document->FindFileCharPos(_cp);
if (fc < 0) return; if (fc < 0) return;
ParagraphPropertyExceptions* papx = NULL; ParagraphPropertyExceptions* papx = NULL;
papx = this->documentMapping->findValidPapx( fc ); papx = documentMapping->findValidPapx( fc );
TableInfo tai( papx ); TableInfo tai( papx );
TableRow tableRow( this->documentMapping, _cp ); TableRow tableRow( documentMapping, _cp );
TableCell tableCell( this->documentMapping, _cp ); TableCell tableCell( documentMapping, _cp );
do do
{ {
fc = documentMapping->m_document->FindFileCharPos(_cp); fc = documentMapping->m_document->FindFileCharPos(_cp);
if (fc < 0) break; if (fc < 0) break;
papx = this->documentMapping->findValidPapx( fc ); papx = documentMapping->findValidPapx( fc );
tai = TableInfo( papx ); tai = TableInfo( papx );
if ( tai.iTap > _depth ) if ( tai.iTap > _depth )
{ {
Table innerTable( this->documentMapping, _cp, ( _depth + 1 ) ); Table innerTable( documentMapping, _cp, ( _depth + 1 ) );
tableCell.AddItem( innerTable ); tableCell.AddItem( innerTable );
...@@ -394,7 +394,7 @@ namespace DocFileFormat ...@@ -394,7 +394,7 @@ namespace DocFileFormat
fc = documentMapping->m_document->FindFileCharPos(_cp); fc = documentMapping->m_document->FindFileCharPos(_cp);
if (fc < 0) break; if (fc < 0) break;
papx = this->documentMapping->findValidPapx( fc ); papx = documentMapping->findValidPapx( fc );
tai = TableInfo( papx ); tai = TableInfo( papx );
...@@ -402,28 +402,28 @@ namespace DocFileFormat ...@@ -402,28 +402,28 @@ namespace DocFileFormat
} }
else else
{ {
if ( this->IsCellMarker( _cp ) ) if ( IsCellMarker( _cp ) )
{ {
tableCell.SetCP( _cp ); tableCell.SetCP( _cp );
tableCell.SetDepth( _depth ); tableCell.SetDepth( _depth );
tableCell.AddItem( DocParagraph( this->documentMapping, paragraphBeginCP, _cp ) ); tableCell.AddItem( DocParagraph( documentMapping, paragraphBeginCP, _cp ) );
tableRow.AddCell( tableCell ); tableRow.AddCell( tableCell );
tableCell.Clear(); tableCell.Clear();
paragraphBeginCP = ( _cp + 1 ); paragraphBeginCP = ( _cp + 1 );
} }
else if ( this->IsRowMarker( _cp ) ) else if ( IsRowMarker( _cp ) )
{ {
tableRow.SetCP( _cp ); tableRow.SetCP( _cp );
tableRow.SetDepth( _depth ); tableRow.SetDepth( _depth );
this->AddRow( tableRow ); AddRow( tableRow );
tableRow.Clear(); tableRow.Clear();
paragraphBeginCP++; paragraphBeginCP++;
} }
else if ( this->IsParagraphMarker( _cp ) ) else if ( IsParagraphMarker( _cp ) )
{ {
tableCell.AddItem( DocParagraph( this->documentMapping, paragraphBeginCP, _cp ) ); tableCell.AddItem( DocParagraph( documentMapping, paragraphBeginCP, _cp ) );
paragraphBeginCP = ( _cp + 1 ); paragraphBeginCP = ( _cp + 1 );
} }
...@@ -432,65 +432,65 @@ namespace DocFileFormat ...@@ -432,65 +432,65 @@ namespace DocFileFormat
} }
while ( ( tai.fInTable ) && ( tai.iTap == _depth ) ); while ( ( tai.fInTable ) && ( tai.iTap == _depth ) );
this->cpEnd = ( _cp - 1 ); cpEnd = ( _cp - 1 );
this->documentMapping->_lastValidPapx = papxBackup; documentMapping->_lastValidPapx = papxBackup;
this->documentMapping->_lastValidSepx = sepxBackup; documentMapping->_lastValidSepx = sepxBackup;
} }
} }
int Table::GetCPStart() const int Table::GetCPStart() const
{ {
return this->cpStart; return cpStart;
} }
void Table::SetCPStart( int _cpStart ) void Table::SetCPStart( int _cpStart )
{ {
this->cpStart = _cpStart; cpStart = _cpStart;
} }
int Table::GetCPEnd() const int Table::GetCPEnd() const
{ {
return this->cpEnd; return cpEnd;
} }
void Table::SetCPEnd( int _cpEnd ) void Table::SetCPEnd( int _cpEnd )
{ {
this->cpEnd = _cpEnd; cpEnd = _cpEnd;
} }
bool Table::IsEmpty() const bool Table::IsEmpty() const
{ {
return this->rows.empty(); return rows.empty();
} }
void Table::Clear() void Table::Clear()
{ {
this->cpStart = 0; cpStart = 0;
this->cpEnd = 0; cpEnd = 0;
this->rows.clear(); rows.clear();
} }
void Table::SetDepth( unsigned int _depth ) void Table::SetDepth( unsigned int _depth )
{ {
this->depth = _depth; depth = _depth;
} }
unsigned int Table::GetDepth() const unsigned int Table::GetDepth() const
{ {
return this->depth; return depth;
} }
int Table::AddRow( const TableRow& _tableRow ) int Table::AddRow( const TableRow& _tableRow )
{ {
this->rows.push_back( _tableRow ); rows.push_back( _tableRow );
return this->cpEnd; return cpEnd;
} }
IVirtualConstructor* Table::New() const IVirtualConstructor* Table::New() const
{ {
return new Table( this->documentMapping ); return new Table( documentMapping );
} }
IVirtualConstructor* Table::Clone() const IVirtualConstructor* Table::Clone() const
...@@ -507,33 +507,33 @@ namespace DocFileFormat ...@@ -507,33 +507,33 @@ namespace DocFileFormat
SectionPropertyExceptions* sepxBackup = documentMapping->_lastValidSepx; SectionPropertyExceptions* sepxBackup = documentMapping->_lastValidSepx;
//build the table grid //build the table grid
std::vector<short>* grid = this->documentMapping->buildTableGrid( this->cpStart, this->depth ); std::vector<short>* grid = documentMapping->buildTableGrid( cpStart, depth );
//find first row end //find first row end
int fcRowEnd = this->documentMapping->findRowEndFc( this->cpStart, this->depth ); int fcRowEnd = documentMapping->findRowEndFc( cpStart, depth );
TablePropertyExceptions row1Tapx( documentMapping->findValidPapx( fcRowEnd ), TablePropertyExceptions row1Tapx( documentMapping->findValidPapx( fcRowEnd ),
documentMapping->m_document->DataStream , documentMapping->m_document->DataStream ,
documentMapping->m_document->FIB->m_bOlderVersion); documentMapping->m_document->FIB->m_bOlderVersion);
//start table //start table
this->documentMapping->GetXMLWriter()->WriteNodeBegin( _T( "w:tbl" ) ); documentMapping->GetXMLWriter()->WriteNodeBegin( _T( "w:tbl" ) );
//Convert it //Convert it
TablePropertiesMapping tpMapping( this->documentMapping->GetXMLWriter(), this->documentMapping->m_document->Styles, grid ); TablePropertiesMapping tpMapping( documentMapping->GetXMLWriter(), documentMapping->m_document->Styles, grid );
row1Tapx.Convert( &tpMapping ); row1Tapx.Convert( &tpMapping );
this->documentMapping->_lastValidPapx = papxBackup; documentMapping->_lastValidPapx = papxBackup;
this->documentMapping->_lastValidSepx = sepxBackup; documentMapping->_lastValidSepx = sepxBackup;
for ( std::list<TableRow>::iterator iter = this->rows.begin(); iter != this->rows.end(); iter++ ) for ( std::list<TableRow>::iterator iter = rows.begin(); iter != rows.end(); iter++ )
{ {
iter->Convert( mapping, grid ); iter->Convert( mapping, grid );
} }
//close w:tbl //close w:tbl
this->documentMapping->GetXMLWriter()->WriteNodeEnd( _T( "w:tbl" ) ); documentMapping->GetXMLWriter()->WriteNodeEnd( _T( "w:tbl" ) );
RELEASEOBJECT( grid ); RELEASEOBJECT( grid );
} }
......
...@@ -35,14 +35,14 @@ ...@@ -35,14 +35,14 @@
namespace DocFileFormat namespace DocFileFormat
{ {
TablePropertiesMapping::TablePropertiesMapping (XmlUtils::CXmlWriter* pWriter, StyleSheet* styles, std::vector<short>* grid, bool isTableStyleNeeded ): TablePropertiesMapping::TablePropertiesMapping (XmlUtils::CXmlWriter* pWriter, StyleSheet* styles, std::vector<short>* grid, bool isTableStyleNeeded ):
PropertiesMapping(pWriter), _tblPr(NULL), _tblGrid(NULL), _tblBorders(NULL), _grid(NULL), PropertiesMapping(pWriter), _tblPr(NULL), _tblGrid(NULL), _tblBorders(NULL), _grid(NULL),
brcLeft(NULL), brcTop(NULL), brcBottom(NULL), brcRight(NULL), brcHorz(NULL), brcVert(NULL), _styles(NULL), brcLeft(NULL), brcTop(NULL), brcBottom(NULL), brcRight(NULL), brcHorz(NULL), brcVert(NULL), _styles(NULL),
_isTableStyleNeeded(isTableStyleNeeded) _isTableStyleNeeded(isTableStyleNeeded)
{ {
_styles = styles; _styles = styles;
this->_tblPr = new XMLTools::XMLElement<wchar_t>( _T( "w:tblPr" ) ); _tblPr = new XMLTools::XMLElement<wchar_t>( _T( "w:tblPr" ) );
this->_tblBorders = new XMLTools::XMLElement<wchar_t>( _T( "w:tblBorders" ) ); _tblBorders = new XMLTools::XMLElement<wchar_t>( _T( "w:tblBorders" ) );
this->_grid = grid; _grid = grid;
} }
TablePropertiesMapping::~TablePropertiesMapping() TablePropertiesMapping::~TablePropertiesMapping()
{ {
...@@ -63,10 +63,10 @@ namespace DocFileFormat ...@@ -63,10 +63,10 @@ namespace DocFileFormat
{ {
TablePropertyExceptions* tapx = static_cast<TablePropertyExceptions*>( visited ); TablePropertyExceptions* tapx = static_cast<TablePropertyExceptions*>( visited );
XMLTools::XMLElement<wchar_t> tblCellMar( _T( "w:tblCellMar" ) ); XMLTools::XMLElement<wchar_t> tblCellMar ( _T( "w:tblCellMar" ) );
XMLTools::XMLElement<wchar_t> tblLayout( _T( "w:tblLayout" ) ); XMLTools::XMLElement<wchar_t> tblLayout ( _T( "w:tblLayout" ) );
XMLTools::XMLElement<wchar_t> tblpPr( _T( "w:tblpPr" ) ); XMLTools::XMLElement<wchar_t> tblpPr ( _T( "w:tblpPr" ) );
XMLTools::XMLAttribute<wchar_t> layoutType( _T( "w:type" ), _T( "fixed" ) ); XMLTools::XMLAttribute<wchar_t> layoutType ( _T( "w:type" ), _T( "fixed" ) );
bool bLayoutFixed = true; bool bLayoutFixed = true;
short tblIndent = 0; short tblIndent = 0;
...@@ -78,15 +78,17 @@ namespace DocFileFormat ...@@ -78,15 +78,17 @@ namespace DocFileFormat
{ {
switch( iter->OpCode ) switch( iter->OpCode )
{ {
case sprmOldTDxaGapHalf:
case sprmTDxaGapHalf: case sprmTDxaGapHalf:
{ {
gabHalf = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ); gabHalf = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
} }
break; break;
//table definition case sprmOldTDefTable:
case sprmTDefTable: case sprmTDefTable:
{ { //table definition
SprmTDefTable tDef( iter->Arguments, iter->argumentsSize ); SprmTDefTable tDef( iter->Arguments, iter->argumentsSize );
//Workaround for retrieving the indent of the table: //Workaround for retrieving the indent of the table:
//In some files there is a indent but no sprmTWidthIndent is set. //In some files there is a indent but no sprmTWidthIndent is set.
...@@ -97,14 +99,13 @@ namespace DocFileFormat ...@@ -97,14 +99,13 @@ namespace DocFileFormat
tblIndent += gabHalf; tblIndent += gabHalf;
//If there follows a real sprmTWidthIndent, this value will be overwritten //If there follows a real sprmTWidthIndent, this value will be overwritten
///<<<<FIXED
tblIndent = (std::max)((int)tblIndent,0); tblIndent = (std::max)((int)tblIndent,0);
} }
break; break;
//preferred table width
case sprmTTableWidth: case sprmTTableWidth:
{ { //preferred table width
unsigned char fts = iter->Arguments[0]; unsigned char fts = iter->Arguments[0];
short width = FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize ); short width = FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
...@@ -120,27 +121,28 @@ namespace DocFileFormat ...@@ -120,27 +121,28 @@ namespace DocFileFormat
} }
break; break;
//justification case sprmOldTJc:
case sprmTJc: case sprmTJc:
case sprmTJcRow: case sprmTJcRow:
{ { //justification
appendValueElement( _tblPr, _T( "jc" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::JustificationCode[0][0], 10, 15 ).c_str(), true ); appendValueElement( _tblPr, _T( "jc" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::JustificationCode[0][0], 10, 15 ).c_str(), true );
} }
break; break;
//indent
case sprmTWidthIndent: case sprmTWidthIndent:
{ { //indent
tblIndent = FtsWWidth_Indent(iter->Arguments).wWidth; tblIndent = FtsWWidth_Indent(iter->Arguments).wWidth;
// tblIndent = FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize ); // tblIndent = FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
} }
break; break;
//style
case sprmTIstd: case sprmTIstd:
case sprmTIstdPermute: case sprmTIstdPermute:
{ { //style
if ( this->_isTableStyleNeeded )
if ( _isTableStyleNeeded )
{ {
int ind = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ); int ind = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
...@@ -154,24 +156,25 @@ namespace DocFileFormat ...@@ -154,24 +156,25 @@ namespace DocFileFormat
} }
break; break;
//bidi
case sprmTFBiDi: case sprmTFBiDi:
case sprmTFBiDi90: case sprmTFBiDi90:
{ { //bidi
appendValueElement( _tblPr, _T( "bidiVisual" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ), true ); appendValueElement( _tblPr, _T( "bidiVisual" ), FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ), true );
} }
break; break;
//table look case sprmOldTTlp:
case sprmTTlp: case sprmTTlp:
{ { //table look
appendValueElement( _tblPr, _T( "tblLook" ), FormatUtils::IntToFormattedWideString( FormatUtils::BytesToInt16( iter->Arguments, 2, iter->argumentsSize ), _T( "%04x" ) ).c_str(), true ); appendValueElement( _tblPr, _T( "tblLook" ), FormatUtils::IntToFormattedWideString( FormatUtils::BytesToInt16( iter->Arguments, 2, iter->argumentsSize ), _T( "%04x" ) ).c_str(), true );
} }
break; break;
//autofit
case sprmTFAutofit: case sprmTFAutofit:
{ { //autofit
if ( iter->Arguments[0] == 1 ) if ( iter->Arguments[0] == 1 )
{ {
layoutType.SetValue( _T( "auto" ) ); layoutType.SetValue( _T( "auto" ) );
...@@ -180,11 +183,11 @@ namespace DocFileFormat ...@@ -180,11 +183,11 @@ namespace DocFileFormat
} }
break; break;
//default cell padding (margin)
case sprmTCellPadding: case sprmTCellPadding:
case sprmTCellPaddingDefault: case sprmTCellPaddingDefault:
case sprmTCellPaddingOuter: case sprmTCellPaddingOuter:
{ { //default cell padding (margin)
unsigned char grfbrc = iter->Arguments[2]; unsigned char grfbrc = iter->Arguments[2];
short wMar = FormatUtils::BytesToInt16( iter->Arguments, 4, iter->argumentsSize ); short wMar = FormatUtils::BytesToInt16( iter->Arguments, 4, iter->argumentsSize );
std::wstring strValue = FormatUtils::IntToWideString( wMar ); std::wstring strValue = FormatUtils::IntToWideString( wMar );
...@@ -211,23 +214,23 @@ namespace DocFileFormat ...@@ -211,23 +214,23 @@ namespace DocFileFormat
} }
break; break;
//row count
case sprmTCHorzBands: case sprmTCHorzBands:
{ { //row count
appendValueElement( _tblPr, _T( "tblStyleRowBandSize" ), iter->Arguments[0], true ); appendValueElement( _tblPr, _T( "tblStyleRowBandSize" ), iter->Arguments[0], true );
} }
break; break;
//col count
case sprmTCVertBands: case sprmTCVertBands:
{ { //col count
appendValueElement( _tblPr, _T( "tblStyleColBandSize" ), iter->Arguments[0], true ); appendValueElement( _tblPr, _T( "tblStyleColBandSize" ), iter->Arguments[0], true );
} }
break; break;
//overlap
case sprmTFNoAllowOverlap: case sprmTFNoAllowOverlap:
{ { //overlap
std::wstring tblOverlapVal = std::wstring( _T( "overlap" ) ); std::wstring tblOverlapVal = std::wstring( _T( "overlap" ) );
if ( iter->Arguments[0] ) if ( iter->Arguments[0] )
...@@ -239,16 +242,17 @@ namespace DocFileFormat ...@@ -239,16 +242,17 @@ namespace DocFileFormat
} }
break; break;
//shading case sprmOldTSetShd :
case sprmTSetShdTable: case sprmTSetShdTable :
{ { //shading
appendShading( _tblPr, ShadingDescriptor( iter->Arguments, iter->argumentsSize ) ); appendShading( _tblPr, ShadingDescriptor( iter->Arguments, iter->argumentsSize ) );
} }
break; break;
//borders 80 exceptions
case sprmTTableBorders80: case sprmTTableBorders80:
{ { //borders 80 exceptions
const int size = 4; const int size = 4;
unsigned char brc80[size]; unsigned char brc80[size];
...@@ -285,6 +289,7 @@ namespace DocFileFormat ...@@ -285,6 +289,7 @@ namespace DocFileFormat
break; break;
//border exceptions //border exceptions
case sprmOldTTableBorders:
case sprmTTableBorders: case sprmTTableBorders:
{ {
const int size = 8; const int size = 8;
......
...@@ -54,53 +54,53 @@ namespace DocFileFormat ...@@ -54,53 +54,53 @@ namespace DocFileFormat
TablePropertyExceptions* tapx = static_cast<TablePropertyExceptions*>( visited ); TablePropertyExceptions* tapx = static_cast<TablePropertyExceptions*>( visited );
//delete infos //delete infos
RevisionData rev( this->_rowEndChpx ); RevisionData rev( _rowEndChpx );
if ( ( this->_rowEndChpx != NULL ) && ( rev.Type == Deleted ) ) if ( ( _rowEndChpx != NULL ) && ( rev.Type == Deleted ) )
{ {
XMLTools::XMLElement<wchar_t> del( _T( "w:del" ) ); XMLTools::XMLElement<wchar_t> del( _T( "w:del" ) );
this->_trPr->AppendChild( del ); _trPr->AppendChild( del );
} }
for ( std::list<SinglePropertyModifier>::iterator iter = tapx->grpprl->begin(); iter != tapx->grpprl->end(); iter++ ) for ( std::list<SinglePropertyModifier>::iterator iter = tapx->grpprl->begin(); iter != tapx->grpprl->end(); iter++ )
{ {
switch ( iter->OpCode ) switch ( iter->OpCode )
{ {
case sprmOldTDefTable:
case sprmTDefTable: case sprmTDefTable:
{ {
//SprmTDefTable tdef = new SprmTDefTable(sprm.Arguments); //SprmTDefTable tdef = new SprmTDefTable(sprm.Arguments);
} }
break; break;
//header row case sprmOldTTableHeader:
case sprmTTableHeader: case sprmTTableHeader:
{ { //header row
bool fHeader = ( iter->Arguments[0] != 0 ) ? (true) : (false); bool fHeader = ( iter->Arguments[0] != 0 ) ? (true) : (false);
if ( fHeader ) if ( fHeader )
{ {
XMLTools::XMLElement<wchar_t> header( _T( "w:tblHeader" ) ); XMLTools::XMLElement<wchar_t> header( _T( "w:tblHeader" ) );
this->_trPr->AppendChild( header ); _trPr->AppendChild( header );
} }
} }
break; break;
//width after
case sprmTWidthAfter: case sprmTWidthAfter:
{ { //width after
XMLTools::XMLElement<wchar_t> wAfter( _T( "w:wAfter" ) ); XMLTools::XMLElement<wchar_t> wAfter( _T( "w:wAfter" ) );
XMLTools::XMLAttribute<wchar_t> wAfterValue( _T( "w:w" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize ) ).c_str() ); XMLTools::XMLAttribute<wchar_t> wAfterValue( _T( "w:w" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize ) ).c_str() );
wAfter.AppendAttribute( wAfterValue ); wAfter.AppendAttribute( wAfterValue );
XMLTools::XMLAttribute<wchar_t> wAfterType( _T( "w:type" ), _T( "dxa" ) ); XMLTools::XMLAttribute<wchar_t> wAfterType( _T( "w:type" ), _T( "dxa" ) );
wAfter.AppendAttribute( wAfterType ); wAfter.AppendAttribute( wAfterType );
this->_trPr->AppendChild( wAfter ); _trPr->AppendChild( wAfter );
} }
break; break;
//width before
case sprmTWidthBefore: case sprmTWidthBefore:
{ { //width before
short before = FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize ); short before = FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize );
if ( before != 0 ) if ( before != 0 )
...@@ -111,14 +111,14 @@ namespace DocFileFormat ...@@ -111,14 +111,14 @@ namespace DocFileFormat
XMLTools::XMLAttribute<wchar_t> wBeforeType( _T( "w:type" ), _T( "dxa" ) ); XMLTools::XMLAttribute<wchar_t> wBeforeType( _T( "w:type" ), _T( "dxa" ) );
wBefore.AppendAttribute( wBeforeType ); wBefore.AppendAttribute( wBeforeType );
this->_trPr->AppendChild( wBefore ); _trPr->AppendChild( wBefore );
} }
} }
break; break;
//row height case sprmOldTDyaRowHeight:
case sprmTDyaRowHeight: case sprmTDyaRowHeight:
{ { //row height
XMLTools::XMLElement<wchar_t> rowHeight( _T( "w:trHeight" ) ); XMLTools::XMLElement<wchar_t> rowHeight( _T( "w:trHeight" ) );
XMLTools::XMLAttribute<wchar_t> rowHeightVal( _T( "w:val" ) ); XMLTools::XMLAttribute<wchar_t> rowHeightVal( _T( "w:val" ) );
XMLTools::XMLAttribute<wchar_t> rowHeightRule( _T( "w:hRule" ) ); XMLTools::XMLAttribute<wchar_t> rowHeightRule( _T( "w:hRule" ) );
...@@ -144,20 +144,22 @@ namespace DocFileFormat ...@@ -144,20 +144,22 @@ namespace DocFileFormat
} }
rowHeight.AppendAttribute( rowHeightRule ); rowHeight.AppendAttribute( rowHeightRule );
this->_trPr->AppendChild( rowHeight ); _trPr->AppendChild( rowHeight );
} }
break; break;
//can't split case sprmOldTFCantSplit:
case sprmTFCantSplit: case sprmTFCantSplit:
case sprmTFCantSplit90: case sprmTFCantSplit90:
appendFlagElement( this->_trPr, *iter, _T( "cantSplit" ), true ); { //can't split
break; appendFlagElement( _trPr, *iter, _T( "cantSplit" ), true );
}break;
//div id //div id
case sprmTIpgp: case sprmTIpgp:
appendValueElement( this->_trPr, _T( "divId" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true ); {
break; appendValueElement( _trPr, _T( "divId" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true );
}break;
//borders 80 exceptions //borders 80 exceptions
//case SinglePropertyModifier.OperationCode.sprmTTableBorders80: //case SinglePropertyModifier.OperationCode.sprmTTableBorders80:
...@@ -250,15 +252,15 @@ namespace DocFileFormat ...@@ -250,15 +252,15 @@ namespace DocFileFormat
//} //}
//set exceptions //set exceptions
if ( this->_tblPrEx->GetChildCount() > 0 ) if ( _tblPrEx->GetChildCount() > 0 )
{ {
this->_trPr->AppendChild( *(this->_tblPrEx) ); _trPr->AppendChild( *(_tblPrEx) );
} }
//write Properties //write Properties
if ( ( this->_trPr->GetChildCount() > 0 ) || ( this->_trPr->GetAttributeCount() > 0 ) ) if ( ( _trPr->GetChildCount() > 0 ) || ( _trPr->GetAttributeCount() > 0 ) )
{ {
m_pXmlWriter->WriteString( this->_trPr->GetXMLString().c_str() ); m_pXmlWriter->WriteString( _trPr->GetXMLString().c_str() );
} }
} }
} }
\ No newline at end of file
...@@ -31,14 +31,15 @@ ...@@ -31,14 +31,15 @@
*/ */
#include "WordDocument.h" #include "WordDocument.h"
#include "../../Common/OfficeFileErrorDescription.h" #include "../../Common/OfficeFileErrorDescription.h"
#include "../../ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/SummaryInformation.h" #include "../../ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/SummaryInformation.h"
#include "../../ASCOfficeXlsFile2/source/XlsFormat/Binary/CFStream.h" #include "../../ASCOfficeXlsFile2/source/XlsFormat/Binary/CFStream.h"
#include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h" #include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
#include "../../DesktopEditor/common/File.h" #include "../../DesktopEditor/common/File.h"
namespace DocFileFormat namespace DocFileFormat
{ {
WordDocument::WordDocument (const ProgressCallback* pCallFunc, const std::wstring & sTempFolder ) : WordDocument::WordDocument (const ProgressCallback* pCallFunc, const std::wstring & sTempFolder ) :
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment