From ea37eab86eed90e7bf96ca697dc23da896b46997 Mon Sep 17 00:00:00 2001 From: ElenaSubbotina Date: Wed, 7 Feb 2018 13:15:58 +0300 Subject: [PATCH] . --- .../DocDocxConverter/OfficeDrawing/PathParser.h | 17 ++++++++++------- .../OfficeDrawing/ShapeOptions.h | 14 +++++++++++++- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/PathParser.h b/ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/PathParser.h index baec8951a4..81d3a942b3 100644 --- a/ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/PathParser.h +++ b/ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/PathParser.h @@ -53,7 +53,6 @@ namespace DocFileFormat PathParser (const unsigned char* pSegmentInfo, unsigned int pSegmentInfoSize, const unsigned char* pVertices, unsigned int pVerticesSize, std::vector<_guides> & guides) { - int offset = 6; if ((pSegmentInfo != NULL) && (pSegmentInfoSize > 0)) { @@ -63,6 +62,7 @@ namespace DocFileFormat unsigned short cbElement = 4; + int offset = 6; if (cb == 0xfff0) cbElement = 2; @@ -86,24 +86,27 @@ namespace DocFileFormat unsigned short nElemsAlloc = FormatUtils::BytesToUInt16(pVertices, 2, pVerticesSize); unsigned short cb = FormatUtils::BytesToUInt16(pVertices, 4, pVerticesSize); - unsigned short cbElement = cb; + unsigned short cbElement = 4; if (cb == 0xfff0) - cbElement = 4; + cbElement = 2; + + int offset = 6; for (unsigned short i = 0; i < nElems; ++i) { POINT point; if (cbElement == 4) { - point.x = FormatUtils::BytesToInt16(pVertices + offset, (i * cbElement), pVerticesSize - offset); - point.y = FormatUtils::BytesToInt16(pVertices + offset, (i * cbElement) + (cbElement / 2), pVerticesSize - offset); + point.x = FormatUtils::BytesToInt32(pVertices + offset, 0, pVerticesSize - offset); + point.y = FormatUtils::BytesToInt32(pVertices + offset + cbElement, 0 , pVerticesSize - offset); } else { - point.x = FormatUtils::BytesToInt32(pVertices + offset, (i * cbElement), pVerticesSize - offset); - point.y = FormatUtils::BytesToInt32(pVertices + offset, (i * cbElement) + (cbElement / 2), pVerticesSize - offset); + point.x = FormatUtils::BytesToInt16(pVertices + offset, 0, pVerticesSize - offset); + point.y = FormatUtils::BytesToInt16(pVertices + offset + cbElement, 0 , pVerticesSize - offset); } + offset += cbElement * 2; LONG lMinF = (LONG)0x80000000; if (lMinF <= point.x) diff --git a/ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/ShapeOptions.h b/ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/ShapeOptions.h index 4dcbdbeed5..1811828033 100644 --- a/ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/ShapeOptions.h +++ b/ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/ShapeOptions.h @@ -582,7 +582,19 @@ namespace DocFileFormat { if (Options[i]->fComplex && Options[i]->op > 0) { - Options[i]->opComplex = std::shared_ptr(Reader->ReadBytes( Options[i]->op, true )); + unsigned int size = Options[i]->op; + + if (Options[i]->pid == 0x0145 || + Options[i]->pid == 0x0146 || + Options[i]->pid == 0x0197 || + Options[i]->pid == 0x0156 || + Options[i]->pid == 0x0155 || + Options[i]->pid == 0x0151 || + Options[i]->pid == 0x0152 || + Options[i]->pid == 0x0157 || + Options[i]->pid == 0x0158)//mso arrays + size += 6; + Options[i]->opComplex = std::shared_ptr(Reader->ReadBytes( size, true )); } OptionsByID.insert(std::make_pair(Options[i]->pid, Options[i]));