Commit 3e44b5d8 authored by alexey.musinov's avatar alexey.musinov

Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop

parents a2016d3f 511a9d02
...@@ -98,6 +98,7 @@ namespace DocFileFormat ...@@ -98,6 +98,7 @@ namespace DocFileFormat
sprmOldCChse = 73, sprmOldCChse = 73,
sprmOldCSymbol = 74, sprmOldCSymbol = 74,
sprmOldCFOle2 = 75, sprmOldCFOle2 = 75,
sprmCOldHighlight = 77,
sprmOldCIstd = 80, sprmOldCIstd = 80,
sprmOldCIstdPermute = 81, sprmOldCIstdPermute = 81,
sprmOldCDefault = 82, sprmOldCDefault = 82,
......
...@@ -301,6 +301,10 @@ namespace DocFileFormat ...@@ -301,6 +301,10 @@ namespace DocFileFormat
colorVal->SetValue( rgbColor.GetString() ); colorVal->SetValue( rgbColor.GetString() );
}break; }break;
case sprmCOldHighlight:
{
appendValueElement( parent, _T( "highlight" ), FormatUtils::MapValueToWideString( iter->Arguments[1], &Global::ColorIdentifier[0][0], 17, 12 ).c_str(), true );
}break;
case sprmCHighlight: 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 );
......
...@@ -70,6 +70,7 @@ namespace OpenXmlContentTypes ...@@ -70,6 +70,7 @@ namespace OpenXmlContentTypes
static const TCHAR* Png = _T("image/png"); static const TCHAR* Png = _T("image/png");
static const TCHAR* Tiff = _T("image/tiff"); static const TCHAR* Tiff = _T("image/tiff");
static const TCHAR* Wmf = _T("image/x-wmf"); static const TCHAR* Wmf = _T("image/x-wmf");
static const TCHAR* Bmp = _T("image/bmp");
} }
namespace WordprocessingMLContentTypes namespace WordprocessingMLContentTypes
......
...@@ -268,7 +268,7 @@ namespace DocFileFormat ...@@ -268,7 +268,7 @@ namespace DocFileFormat
std::vector<int> bookmarks = searchBookmarks(chpxChars, cp); std::vector<int> bookmarks = searchBookmarks(chpxChars, cp);
//if there are bookmarks in this run, split the run into several runs //if there are bookmarks in this run, split the run into several runs
if (bookmarks.size()) if (!bookmarks.empty())
{ {
std::list<std::vector<wchar_t>>* runs = splitCharList(chpxChars, &bookmarks); std::list<std::vector<wchar_t>>* runs = splitCharList(chpxChars, &bookmarks);
if (runs) if (runs)
......
...@@ -103,8 +103,8 @@ namespace DocFileFormat ...@@ -103,8 +103,8 @@ namespace DocFileFormat
void DrawingPrimitive::read_fill(VirtualStreamReader* reader) void DrawingPrimitive::read_fill(VirtualStreamReader* reader)
{ {
fillFore = read_color(reader);
fillBack = read_color(reader); fillBack = read_color(reader);
fillFore = read_color(reader);
fillPattern = reader->ReadInt16(); fillPattern = reader->ReadInt16();
} }
void DrawingPrimitive::read_shadow(VirtualStreamReader* reader) void DrawingPrimitive::read_shadow(VirtualStreamReader* reader)
...@@ -225,13 +225,34 @@ namespace DocFileFormat ...@@ -225,13 +225,34 @@ namespace DocFileFormat
} }
DrawingPrimitiveTextBox::DrawingPrimitiveTextBox(VirtualStreamReader *reader, int length) : DrawingPrimitiveRect(reader, length) DrawingPrimitiveTextBox::DrawingPrimitiveTextBox(VirtualStreamReader *reader, int length) : DrawingPrimitiveRect(reader, length)
{ {
strVmlType = L"v:rect";
//strVmlType = L"v:shape";
} }
DrawingPrimitiveCTextBox::DrawingPrimitiveCTextBox(VirtualStreamReader *reader, int length) : DrawingPrimitive(reader, length) DrawingPrimitiveCTextBox::DrawingPrimitiveCTextBox(VirtualStreamReader *reader, int length) : DrawingPrimitive(reader, length)
{ {
strVmlType = L"v:shape"; strVmlType = L"v:rect";
txbx = NULL;
polyline = NULL;
unsigned short f = reader->ReadUInt16();
dzaOffset = reader->ReadUInt16();
dzaDescent = reader->ReadUInt16();
dzaLength = reader->ReadUInt16();
unsigned short dpk_txbx = reader->ReadUInt16();
unsigned short cb_txbx = reader->ReadUInt16();
txbx = new DrawingPrimitiveTextBox(reader, cb_txbx);
unsigned short dpk_polyline = reader->ReadUInt16();
unsigned short cb_polyline = reader->ReadUInt16();
polyline = new DrawingPrimitivePolyline(reader, cb_polyline);
}
DrawingPrimitiveCTextBox::~DrawingPrimitiveCTextBox()
{
} }
DrawingPrimitivePolyline::DrawingPrimitivePolyline(VirtualStreamReader *reader, int length) : DrawingPrimitiveLine(reader, length, false) DrawingPrimitivePolyline::DrawingPrimitivePolyline(VirtualStreamReader *reader, int length) : DrawingPrimitiveLine(reader, length, false)
......
...@@ -121,21 +121,6 @@ namespace DocFileFormat ...@@ -121,21 +121,6 @@ namespace DocFileFormat
}; };
class DrawingPrimitiveCTextBox: public DrawingPrimitive
{
public:
DrawingPrimitiveCTextBox(VirtualStreamReader* reader, int length);
};
class DrawingPrimitiveArc: public DrawingPrimitive
{
public:
DrawingPrimitiveArc(VirtualStreamReader* reader, int length);
bool fLeft;
bool fUp;
};
class DrawingPrimitiveElipse: public DrawingPrimitive class DrawingPrimitiveElipse: public DrawingPrimitive
{ {
public: public:
...@@ -153,6 +138,30 @@ namespace DocFileFormat ...@@ -153,6 +138,30 @@ namespace DocFileFormat
std::vector<std::pair<short, short>> arPoints; std::vector<std::pair<short, short>> arPoints;
}; };
class DrawingPrimitiveCTextBox: public DrawingPrimitive
{
public:
DrawingPrimitiveCTextBox(VirtualStreamReader* reader, int length);
virtual ~DrawingPrimitiveCTextBox();
unsigned short dzaOffset;
unsigned short dzaDescent;
unsigned short dzaLength;
DrawingPrimitiveTextBox *txbx;
DrawingPrimitivePolyline *polyline;
};
class DrawingPrimitiveArc: public DrawingPrimitive
{
public:
DrawingPrimitiveArc(VirtualStreamReader* reader, int length);
bool fLeft;
bool fUp;
};
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
class DrawingPrimitives : public IVisitable, public std::vector<DrawingPrimitive*> class DrawingPrimitives : public IVisitable, public std::vector<DrawingPrimitive*>
{ {
......
...@@ -70,6 +70,12 @@ public: ...@@ -70,6 +70,12 @@ public:
public: public:
CMetaHeader() CMetaHeader()
{ {
cbSize = cbSave = 0;
filter = compression = 0;
ptSize.x = ptSize.y = 0;
rcBounds.bottom = rcBounds.left = rcBounds.right = rcBounds.top = 0;
} }
......
...@@ -48,7 +48,7 @@ namespace DocFileFormat ...@@ -48,7 +48,7 @@ namespace DocFileFormat
: :
dxaGoal(0), dyaGoal(0), mx(0), my(0), Type(jpg), mfp(), dxaCropLeft(0), dyaCropTop(0), dxaGoal(0), dyaGoal(0), mx(0), my(0), Type(jpg), mfp(), dxaCropLeft(0), dyaCropTop(0),
dxaCropRight(0), dyaCropBottom(0), brcTop(NULL), brcLeft(NULL), brcBottom(NULL), brcRight(NULL), dxaOrigin(0), dyaOrigin(0), dxaCropRight(0), dyaCropBottom(0), brcTop(NULL), brcLeft(NULL), brcBottom(NULL), brcRight(NULL), dxaOrigin(0), dyaOrigin(0),
cProps(0), shapeContainer(NULL), blipStoreEntry(NULL), embeddedData(NULL), embeddedDataSize(0) cProps(0), shapeContainer(NULL), blipStoreEntry(NULL), embeddedData(NULL), embeddedDataSize(0), embeddedDataHeader(NULL)
{ {
//Get start and length of the PICT //Get start and length of the PICT
int fc = GetFcPic( chpx ); int fc = GetFcPic( chpx );
...@@ -62,7 +62,7 @@ namespace DocFileFormat ...@@ -62,7 +62,7 @@ namespace DocFileFormat
: :
dxaGoal(0), dyaGoal(0), mx(0), my(0), Type(jpg), mfp(), dxaCropLeft(0), dyaCropTop(0), dxaGoal(0), dyaGoal(0), mx(0), my(0), Type(jpg), mfp(), dxaCropLeft(0), dyaCropTop(0),
dxaCropRight(0), dyaCropBottom(0), brcTop(NULL), brcLeft(NULL), brcBottom(NULL), brcRight(NULL), dxaOrigin(0), dyaOrigin(0), dxaCropRight(0), dyaCropBottom(0), brcTop(NULL), brcLeft(NULL), brcBottom(NULL), brcRight(NULL), dxaOrigin(0), dyaOrigin(0),
cProps(0), shapeContainer(NULL), blipStoreEntry(NULL), embeddedData(NULL), embeddedDataSize(0) cProps(0), shapeContainer(NULL), blipStoreEntry(NULL), embeddedData(NULL), embeddedDataSize(0), embeddedDataHeader(NULL)
{ {
} }
PictureDescriptor::~PictureDescriptor() PictureDescriptor::~PictureDescriptor()
...@@ -80,6 +80,7 @@ namespace DocFileFormat ...@@ -80,6 +80,7 @@ namespace DocFileFormat
RELEASEOBJECT(blipStoreEntry); RELEASEOBJECT(blipStoreEntry);
RELEASEARRAYOBJECTS(embeddedData); RELEASEARRAYOBJECTS(embeddedData);
RELEASEARRAYOBJECTS(embeddedDataHeader);
} }
void PictureDescriptor::parse(POLE::Stream* stream, int fc, int sz, bool oldVersion) void PictureDescriptor::parse(POLE::Stream* stream, int fc, int sz, bool oldVersion)
{ {
...@@ -91,6 +92,8 @@ namespace DocFileFormat ...@@ -91,6 +92,8 @@ namespace DocFileFormat
int lcb = reader.ReadInt32(); int lcb = reader.ReadInt32();
int pos_start = reader.GetPosition();
if (lcb > 10000000) if (lcb > 10000000)
return; return;
...@@ -104,104 +107,111 @@ namespace DocFileFormat ...@@ -104,104 +107,111 @@ namespace DocFileFormat
return; return;
} }
if (lcb >= 10) if (lcb < 10)
{ return;
int 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 == MM_ISOTROPIC || mfp.mm == MM_ANISOTROPIC) unsigned char* bytes = reader.ReadBytes(14, true);
{ rcWinMf = std::vector<unsigned char>(bytes, (bytes + 14));
Type = wmf; RELEASEARRAYOBJECTS(bytes);
mx = my = 200; //dimensions
dxaGoal = mfp.xExt; dxaGoal = reader.ReadInt16();
dyaGoal = mfp.yExt; dyaGoal = reader.ReadInt16();
mx = reader.ReadUInt16();
my = reader.ReadUInt16();
embeddedDataSize = lcb - 20;//reader.GetSize() - reader.GetPosition(); //lcb ? //cropping
embeddedData = reader.ReadBytes( embeddedDataSize, true ); dxaCropLeft = reader.ReadInt16();
dyaCropTop = reader.ReadInt16();
dxaCropRight = reader.ReadInt16();
dyaCropBottom = reader.ReadInt16();
WmfPlaceableFileHeader *header = (WmfPlaceableFileHeader *)embeddedData; int brcl = reader.ReadInt16();
if (header) // borders
{ int bytesCount = oldVersion ? 2 : 4;
}
} bytes = reader.ReadBytes( bytesCount, true );
else if (mfp.mm >= 98) brcTop = new BorderCode( bytes, bytesCount );
{ RELEASEARRAYOBJECTS( bytes );
unsigned char* bytes = reader.ReadBytes(14, true);
rcWinMf = std::vector<unsigned char>(bytes, (bytes + 14));
RELEASEARRAYOBJECTS(bytes);
//dimensions
dxaGoal = reader.ReadInt16();
dyaGoal = reader.ReadInt16();
mx = reader.ReadUInt16();
my = reader.ReadUInt16();
//cropping
dxaCropLeft = reader.ReadInt16();
dyaCropTop = reader.ReadInt16();
dxaCropRight = reader.ReadInt16();
dyaCropBottom = reader.ReadInt16();
short brcl = reader.ReadInt16();
// borders
int bytesCount = 4;
bytes = reader.ReadBytes( bytesCount, true );
brcTop = new BorderCode( bytes, bytesCount );
RELEASEARRAYOBJECTS( bytes );
bytes = reader.ReadBytes( bytesCount, true ); bytes = reader.ReadBytes( bytesCount, true );
brcLeft = new BorderCode( bytes, 4 ); brcLeft = new BorderCode( bytes, bytesCount );
RELEASEARRAYOBJECTS( bytes ); RELEASEARRAYOBJECTS( bytes );
bytes = reader.ReadBytes( bytesCount, true ); bytes = reader.ReadBytes( bytesCount, true );
brcBottom = new BorderCode( bytes, 4 ); brcBottom = new BorderCode( bytes, bytesCount );
RELEASEARRAYOBJECTS( bytes ); RELEASEARRAYOBJECTS( bytes );
bytes = reader.ReadBytes( bytesCount, true ); bytes = reader.ReadBytes( bytesCount, true );
brcRight = new BorderCode( bytes, 4 ); brcRight = new BorderCode( bytes, bytesCount );
RELEASEARRAYOBJECTS( bytes ); RELEASEARRAYOBJECTS( bytes );
dxaOrigin = reader.ReadInt16(); dxaOrigin = reader.ReadInt16();
dyaOrigin = reader.ReadInt16(); dyaOrigin = reader.ReadInt16();
cProps = reader.ReadInt16();
if (mfp.mm == MM_SHAPEFILE) int pos_end = reader.GetPosition();
if (oldVersion)
{
int flag = brcl;
brcl = FormatUtils::BitmaskToBool(flag, 0x000F);
//( 0 single 1 thick 2 double 3 shadow )
bool fFrameEmpty = FormatUtils::BitmaskToBool(flag, 0x0010);// picture consists of a single frame
bool fBitmap = FormatUtils::BitmaskToBool(flag, 0x0020);// ==1, when picture is just a bitmap
bool fDrawHatch = FormatUtils::BitmaskToBool(flag, 0x0040);// ==1, when picture is an active OLE object
bool fError = FormatUtils::BitmaskToBool(flag, 0x0080);// ==1, when picture is just an error message
short bpp = FormatUtils::BitmaskToBool(flag, 0x8000);// bits per pixel
//(0 unknown 1 monochrome 4 VGA)
int sz_hdr = pos_end - pos_start;
int header_size = 114;
embeddedDataSize = lcb - sz_hdr - header_size;
embeddedDataHeader = reader.ReadBytes( header_size, true);
embeddedData = reader.ReadBytes( embeddedDataSize, true );
}
else
{
cProps = reader.ReadInt16();
if (mfp.mm == MM_SHAPEFILE)
{
unsigned char cchPicName = reader.ReadByte();
unsigned char* stPicName = reader.ReadBytes(cchPicName, true);
if ( stPicName != NULL )
{ {
unsigned char cchPicName = reader.ReadByte(); std::wstring picName;
unsigned char* stPicName = reader.ReadBytes(cchPicName, true); FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &picName, stPicName, cchPicName, ENCODING_WINDOWS_1250 );
RELEASEARRAYOBJECTS(stPicName);
if ( stPicName != NULL )
{
std::wstring picName;
FormatUtils::GetSTLCollectionFromBytes<std::wstring>( &picName, stPicName, cchPicName, ENCODING_WINDOWS_1250 );
RELEASEARRAYOBJECTS(stPicName);
}
} }
}
shapeContainer = dynamic_cast<ShapeContainer*>(RecordFactory::ReadRecord(&reader, 0));
shapeContainer = dynamic_cast<ShapeContainer*>(RecordFactory::ReadRecord(&reader, 0)); long pos = reader.GetPosition();
long pos = reader.GetPosition(); if( pos < ( fc + lcb ))
{
Record* rec = RecordFactory::ReadRecord( &reader, 0 );
if( pos < ( fc + lcb )) if ((rec) && ( typeid(*rec) == typeid(BlipStoreEntry) ))
{
blipStoreEntry = dynamic_cast<BlipStoreEntry*>( rec );
}
else
{ {
Record* rec = RecordFactory::ReadRecord( &reader, 0 ); RELEASEOBJECT(rec);
if ((rec) && ( typeid(*rec) == typeid(BlipStoreEntry) ))
{
blipStoreEntry = dynamic_cast<BlipStoreEntry*>( rec );
}
else
{
RELEASEOBJECT(rec);
}
} }
} }
} }
......
...@@ -129,6 +129,7 @@ namespace DocFileFormat ...@@ -129,6 +129,7 @@ namespace DocFileFormat
ShapeContainer * shapeContainer; ShapeContainer * shapeContainer;
BlipStoreEntry * blipStoreEntry; BlipStoreEntry * blipStoreEntry;
unsigned char *embeddedDataHeader;
unsigned char *embeddedData; unsigned char *embeddedData;
int embeddedDataSize; int embeddedDataSize;
}; };
......
...@@ -71,6 +71,11 @@ namespace DocFileFormat ...@@ -71,6 +71,11 @@ namespace DocFileFormat
unsigned short code = oldVersion ? FormatUtils::BytesToUChar ( bytes, sprmStart, size ) : unsigned short code = oldVersion ? FormatUtils::BytesToUChar ( bytes, sprmStart, size ) :
FormatUtils::BytesToUInt16 ( bytes, sprmStart, size ) ; FormatUtils::BytesToUInt16 ( bytes, sprmStart, size ) ;
if (oldVersion && code == 0)
{
sprmStart++;
continue;
}
OperationCode opCode = (OperationCode)code; OperationCode opCode = (OperationCode)code;
short opSize = -1; short opSize = -1;
...@@ -137,7 +142,6 @@ namespace DocFileFormat ...@@ -137,7 +142,6 @@ namespace DocFileFormat
} }
} }
//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 = opCodeSize + lenByte + opSize; int sprmBytesSize = opCodeSize + lenByte + opSize;
unsigned char* sprmBytes = NULL; unsigned char* sprmBytes = NULL;
...@@ -148,7 +152,6 @@ namespace DocFileFormat ...@@ -148,7 +152,6 @@ namespace DocFileFormat
{ {
memcpy( sprmBytes, ( bytes + sprmStart ), sprmBytesSize ); memcpy( sprmBytes, ( bytes + sprmStart ), sprmBytesSize );
//parse
SinglePropertyModifier sprm( sprmBytes, sprmBytesSize, oldVersion ); SinglePropertyModifier sprm( sprmBytes, sprmBytesSize, oldVersion );
grpprl->push_back( sprm ); grpprl->push_back( sprm );
......
...@@ -51,7 +51,14 @@ namespace DocFileFormat ...@@ -51,7 +51,14 @@ namespace DocFileFormat
opCodeSize = 1; opCodeSize = 1;
//first 1 byte are the operation code ... //first 1 byte are the operation code ...
OpCode = (OperationCode)FormatUtils::BytesToUChar( bytes, 0, size ); OpCode = (OperationCode)FormatUtils::BytesToUChar( bytes, 0, size );
opSize = GetOldOperandSize( (unsigned char)OpCode ); if (OpCode == 0 && size == 4)
{
//так записывается rgb цвет (
OpCode = sprmCCv;
opSize = 3;
}
else
opSize = GetOldOperandSize( (unsigned char)OpCode );
} }
else else
{ {
...@@ -208,7 +215,9 @@ namespace DocFileFormat ...@@ -208,7 +215,9 @@ namespace DocFileFormat
} }
static const unsigned char OldOperandSizeTable[] = 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, 255, 255, 4, 5, 4, 2, 4, 2, 2, 5, 4, 0, 0, 0, 0, 0, 0, 0, 0 // 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,255,255,4,5,4,2,4,2,2,5,4,0,0,0,0,0,0,0,0
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,2,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,255,255,4,5,4,2,4,2,2,5,4,0,0,0,0,0,0,0,0
}; };
unsigned char SinglePropertyModifier::GetOldOperandSize(unsigned char code) unsigned char SinglePropertyModifier::GetOldOperandSize(unsigned char code)
......
...@@ -130,7 +130,8 @@ namespace DocFileFormat ...@@ -130,7 +130,8 @@ namespace DocFileFormat
} }
else if (m_nTBIndex + 1 < m_document->TextboxIndividualPlex->CharacterPositions.size()) else if (m_nTBIndex + 1 < m_document->TextboxIndividualPlex->CharacterPositions.size())
{ {
cp = m_document->TextboxIndividualPlex->CharacterPositions[m_nTBIndex]; //todooo сделать чище
cp = m_document->TextboxIndividualPlex->CharacterPositions[m_nTBIndex] + 2;
cpEnd = m_document->TextboxIndividualPlex->CharacterPositions[m_nTBIndex + 1]; cpEnd = m_document->TextboxIndividualPlex->CharacterPositions[m_nTBIndex + 1];
} }
} }
......
...@@ -34,10 +34,13 @@ ...@@ -34,10 +34,13 @@
#include "OfficeDrawing/GeometryBooleanProperties.h" #include "OfficeDrawing/GeometryBooleanProperties.h"
#include "OfficeDrawing/GeometryTextBooleanProperties.h" #include "OfficeDrawing/GeometryTextBooleanProperties.h"
#include "OfficeDrawing/MetafilePictBlip.h"
#include "../../DesktopEditor/common/String.h" #include "../../DesktopEditor/common/String.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Document.h" #include "../../Common/DocxFormat/Source/DocxFormat/Document.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Document.h"
#include "../../DesktopEditor/common/File.h"
#include "../../DesktopEditor/raster/BgraFrame.h"
typedef struct typedef struct
{ {
...@@ -64,6 +67,73 @@ typedef struct ...@@ -64,6 +67,73 @@ typedef struct
namespace DocFileFormat namespace DocFileFormat
{ {
struct __BITMAPINFOHEADER
{
DWORD biSize;
LONG biWidth;
LONG biHeight;
WORD biPlanes;
WORD biBitCount;
DWORD biCompression;
DWORD biSizeImage;
LONG biXPelsPerMeter;
LONG biYPelsPerMeter;
DWORD biClrUsed;
DWORD biClrImportant;
};
struct __BITMAPCOREHEADER
{
DWORD bcSize; /* used to get to color table */
WORD bcWidth;
WORD bcHeight;
WORD bcPlanes;
WORD bcBitCount;
};
Global::BlipType GetFormatPict(unsigned char* data, int size)
{
Global::BlipType btWin32 = Global::msoblipDIB;
int offset = 0, biSizeImage = 0;
__BITMAPINFOHEADER * header = (__BITMAPINFOHEADER*)data;
if (!header) return btWin32;
if (header->biWidth > 100000 || header->biHeight > 100000 || header->biSize != 40)
{
__BITMAPCOREHEADER * header_core = (__BITMAPCOREHEADER *)data;
if (header_core->bcSize != 12)
{
btWin32 = Global::msoblipWMF;
}
else
{
offset = 12; //sizeof(BITMAPCOREHEADER)
int stride = (size - offset) / header_core->bcHeight;
biSizeImage = size - offset;
if (stride >= header_core->bcWidth && header_core->bcBitCount >=24 )
{
btWin32 = Global::msoblipPNG;
}
}
}
else
{
offset = 40; //sizeof(BITMAPINFOHEADER)
int sz_bitmap = header->biHeight * header->biWidth * header->biBitCount/ 8;
int stride = (size - offset) / header->biHeight;
if (stride >= header->biWidth && header->biBitCount >= 24)
{
btWin32 = Global::msoblipPNG;
}
}
return btWin32;
}
bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString) bool ParseEmbeddedEquation( const std::string & xmlString, std::wstring & newXmlString)
{ {
newXmlString.clear(); newXmlString.clear();
...@@ -307,7 +377,6 @@ namespace DocFileFormat ...@@ -307,7 +377,6 @@ namespace DocFileFormat
return m_ShapeId; return m_ShapeId;
} }
/// Writes a border element
void VMLPictureMapping::writePictureBorder( const std::wstring & name, const BorderCode* brc ) void VMLPictureMapping::writePictureBorder( const std::wstring & name, const BorderCode* brc )
{ {
if (!brc || name.empty()) return; if (!brc || name.empty()) return;
...@@ -318,8 +387,6 @@ namespace DocFileFormat ...@@ -318,8 +387,6 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeEnd ( _T( "" ), true ); m_pXmlWriter->WriteNodeEnd ( _T( "" ), true );
} }
/// Copies the picture from the binary stream to the zip archive
/// and creates the relationships for the image.
bool VMLPictureMapping::CopyPicture (PictureDescriptor* pict) bool VMLPictureMapping::CopyPicture (PictureDescriptor* pict)
{ {
if (!pict) return false; if (!pict) return false;
...@@ -329,57 +396,45 @@ namespace DocFileFormat ...@@ -329,57 +396,45 @@ namespace DocFileFormat
if (pict->embeddedData && pict->embeddedDataSize > 0) if (pict->embeddedData && pict->embeddedDataSize > 0)
{ {
ENHMETAHEADER3 oHeader; Global::BlipType btWin32 = GetFormatPict(pict->embeddedData, pict->embeddedDataSize);
int w = 0, h = 0;
oHeader.iType = 0x00000001;
oHeader.nSize = sizeof(oHeader);
oHeader.rclBounds.left = 0; if (btWin32 == Global::msoblipWMF)
oHeader.rclBounds.top = 0; {
oHeader.rclBounds.right = w; CMetaHeader oMetaHeader;
oHeader.rclBounds.bottom = h;
oMetaHeader.rcBounds.right = pict->mfp.xExt ;
oHeader.rclFrame.left = 0; oMetaHeader.rcBounds.bottom = pict->mfp.yExt ;
oHeader.rclFrame.top = 0;
oHeader.rclFrame.right = w;
oHeader.rclFrame.bottom = h;
oHeader.dSignature = 0x464D4520;
oHeader.nVersion = 0x00010000;
oHeader.nBytes = pict->embeddedDataSize - 176;
oHeader.nRecords = 1;
oHeader.nHandles = 0;
oHeader.sReserved = 0;
oHeader.nDescription = 0; WmfPlaceableFileHeader oWmfHeader = {};
oHeader.offDescription = 0; oMetaHeader.ToWMFHeader(&oWmfHeader);
int lLenHeader = 114 + 22;
oHeader.nPalEntries = 0; unsigned char *newData = new unsigned char[pict->embeddedDataSize + lLenHeader];
memcpy(newData, (unsigned char *)(&oWmfHeader), 22);
memcpy(newData + 22, pict->embeddedDataHeader, 114 );
memcpy(newData + lLenHeader, pict->embeddedData, pict->embeddedDataSize);
oHeader.szlDevice.cx = 200; pict->embeddedDataSize += lLenHeader;
oHeader.szlDevice.cy = 200; delete []pict->embeddedData;
pict->embeddedData = newData;
oHeader.szlMillimeters.cx = 100; }
oHeader.szlMillimeters.cy = 100; m_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(Global::msoblipDIB),
std::vector<unsigned char>(pict->embeddedData, (pict->embeddedData + pict->embeddedDataSize)), Global::msoblipDIB));
memcpy(pict->embeddedData, &oHeader, sizeof(oHeader)); m_nImageId = m_ctx->_docx->RegisterImage(m_caller, btWin32);
result = true;
m_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(Global::msoblipWMF), std::vector<unsigned char>(pict->embeddedData, pict->embeddedData + pict->embeddedDataSize)));
m_nImageId = m_ctx->_docx->RegisterImage(m_caller, Global::msoblipWMF);
result = true;
} }
else if ((oBlipEntry != NULL) && (oBlipEntry->Blip != NULL)) else if ((oBlipEntry != NULL) && (oBlipEntry->Blip != NULL))
{ {
switch (oBlipEntry->btWin32) switch (oBlipEntry->btWin32)
{ {
case Global::msoblipEMF: case Global::msoblipEMF:
case Global::msoblipWMF: case Global::msoblipWMF:
{ {
//it's a meta image
MetafilePictBlip* metaBlip = static_cast<MetafilePictBlip*>(oBlipEntry->Blip); MetafilePictBlip* metaBlip = static_cast<MetafilePictBlip*>(oBlipEntry->Blip);
if (metaBlip) if (metaBlip)
{//decompress inside MetafilePictBlip {//decompress inside MetafilePictBlip
...@@ -393,11 +448,11 @@ namespace DocFileFormat ...@@ -393,11 +448,11 @@ namespace DocFileFormat
} }
break; break;
case Global::msoblipJPEG: case Global::msoblipJPEG:
case Global::msoblipCMYKJPEG: case Global::msoblipCMYKJPEG:
case Global::msoblipPNG: case Global::msoblipPNG:
case Global::msoblipTIFF: case Global::msoblipTIFF:
case Global::msoblipDIB: case Global::msoblipDIB:
{ {
BitmapBlip* bitBlip = static_cast<BitmapBlip*>(oBlipEntry->Blip); BitmapBlip* bitBlip = static_cast<BitmapBlip*>(oBlipEntry->Blip);
if (bitBlip) if (bitBlip)
...@@ -405,19 +460,16 @@ namespace DocFileFormat ...@@ -405,19 +460,16 @@ namespace DocFileFormat
m_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32), m_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32),
std::vector<unsigned char>(bitBlip->m_pvBits, (bitBlip->m_pvBits + bitBlip->pvBitsSize)), oBlipEntry->btWin32)); std::vector<unsigned char>(bitBlip->m_pvBits, (bitBlip->m_pvBits + bitBlip->pvBitsSize)), oBlipEntry->btWin32));
} }
} }break;
break;
default: default:
{ {
return false; return false;
} }break;
break;
} }
m_nImageId = m_ctx->_docx->RegisterImage(m_caller, oBlipEntry->btWin32); m_nImageId = m_ctx->_docx->RegisterImage(m_caller, oBlipEntry->btWin32);
result = true;
result = true;
} }
return result; return result;
...@@ -430,28 +482,16 @@ namespace DocFileFormat ...@@ -430,28 +482,16 @@ namespace DocFileFormat
{ {
switch (nType) switch (nType)
{ {
//case Global::msoblipDIB: case Global::msoblipDIB:
// return std::wstring( _T( ".bmp" ) ); return std::wstring(_T(".bmp"));
//case msoblipBMP:
// return wstring( _T( ".bmp" ) );
case Global::msoblipEMF: case Global::msoblipEMF:
return std::wstring(_T(".emf")); return std::wstring(_T(".emf"));
//case msoblipGIF:
// return wstring( _T( ".gif" ) );
//case msoblipICON:
// return wstring( _T( ".ico" ) );
case Global::msoblipJPEG: case Global::msoblipJPEG:
case Global::msoblipCMYKJPEG: case Global::msoblipCMYKJPEG:
return std::wstring(_T(".jpg")); return std::wstring(_T(".jpg"));
//case msoblipPCX:
// return wstring( _T( ".pcx" ) );
case Global::msoblipPNG: case Global::msoblipPNG:
return std::wstring(_T(".png")); return std::wstring(_T(".png"));
...@@ -470,9 +510,6 @@ namespace DocFileFormat ...@@ -470,9 +510,6 @@ namespace DocFileFormat
{ {
switch (nType) switch (nType)
{ {
//case msoblipBMP:
// return wstring( _T( "image/bmp" ) );
case Global::msoblipEMF: case Global::msoblipEMF:
return std::wstring(OpenXmlContentTypes::Emf); return std::wstring(OpenXmlContentTypes::Emf);
...@@ -498,6 +535,9 @@ namespace DocFileFormat ...@@ -498,6 +535,9 @@ namespace DocFileFormat
case Global::msoblipWMF: case Global::msoblipWMF:
return std::wstring(OpenXmlContentTypes::Wmf); return std::wstring(OpenXmlContentTypes::Wmf);
case Global::msoblipDIB:
return std::wstring(OpenXmlContentTypes::Bmp);
default: default:
return std::wstring(OpenXmlContentTypes::Png); return std::wstring(OpenXmlContentTypes::Png);
} }
......
...@@ -65,8 +65,10 @@ namespace DocFileFormat ...@@ -65,8 +65,10 @@ namespace DocFileFormat
private: private:
void ApplyPrimitives(DrawingPrimitives * primitives ); void ApplyPrimitives (DrawingPrimitives * primitives );
int ApplyPrimitive (DrawingPrimitives * primitives, int index); int ApplyPrimitive (DrawingPrimitives * primitives, int index);
void WritePrimitiveProps(DrawingPrimitive * primitive, bool root);
// Converts a group of shapes // Converts a group of shapes
void WriteGroup(const GroupContainer* pContainer); void WriteGroup(const GroupContainer* pContainer);
...@@ -135,12 +137,5 @@ namespace DocFileFormat ...@@ -135,12 +137,5 @@ namespace DocFileFormat
XMLTools::XMLElement<wchar_t> m_imagedata; XMLTools::XMLElement<wchar_t> m_imagedata;
XMLTools::XMLElement<wchar_t> m_3dstyle; XMLTools::XMLElement<wchar_t> m_3dstyle;
XMLTools::XMLElement<wchar_t> m_textpath; XMLTools::XMLElement<wchar_t> m_textpath;
//----------------------------------------------------------------
std::vector<double> m_offset_x;
std::vector<double> m_offset_y;
std::vector<double> m_scale_x;
std::vector<double> m_scale_y;
}; };
} }
...@@ -49,6 +49,7 @@ namespace DocFileFormat ...@@ -49,6 +49,7 @@ namespace DocFileFormat
EndnoteReferenceCharactersPlex(NULL), FieldsPlex(NULL), FootnoteDocumentFieldsPlex(NULL), EndnoteReferenceCharactersPlex(NULL), FieldsPlex(NULL), FootnoteDocumentFieldsPlex(NULL),
EndnoteDocumentFieldsPlex(NULL), HeadersAndFootersDocumentFieldsPlex(NULL), HeaderStoriesPlex(NULL), EndnoteDocumentFieldsPlex(NULL), HeadersAndFootersDocumentFieldsPlex(NULL), HeaderStoriesPlex(NULL),
AnnotationsReferencePlex(NULL), IndividualCommentsPlex(NULL), TextboxBreakPlex(NULL), TextboxBreakPlexHeader(NULL), AnnotationsReferencePlex(NULL), IndividualCommentsPlex(NULL), TextboxBreakPlex(NULL), TextboxBreakPlexHeader(NULL),
TextboxIndividualPlex(NULL),
OfficeDrawingPlex(NULL), OfficeDrawingPlexHeader(NULL), SectionPlex(NULL), BookmarkStartPlex(NULL), BookmarkEndPlex(NULL), OfficeDrawingPlex(NULL), OfficeDrawingPlexHeader(NULL), SectionPlex(NULL), BookmarkStartPlex(NULL), BookmarkEndPlex(NULL),
AutoTextPlex(NULL), AllPapxFkps(NULL), AllChpxFkps(NULL), AllPapx(NULL), AllPapxVector(NULL), AllSepx(NULL), Styles(NULL), listTable(NULL), AutoTextPlex(NULL), AllPapxFkps(NULL), AllChpxFkps(NULL), AllPapx(NULL), AllPapxVector(NULL), AllSepx(NULL), Styles(NULL), listTable(NULL),
AnnotationOwners(NULL), DocProperties(NULL), listFormatOverrideTable(NULL), headerAndFooterTable(NULL), encryptionHeader(NULL) AnnotationOwners(NULL), DocProperties(NULL), listFormatOverrideTable(NULL), headerAndFooterTable(NULL), encryptionHeader(NULL)
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
namespace ImageHelper namespace ImageHelper
{ {
typedef struct ___tagBITMAPINFOHEADER struct __BITMAPINFOHEADER
{ {
DWORD biSize; DWORD biSize;
LONG biWidth; LONG biWidth;
...@@ -52,44 +52,117 @@ namespace ImageHelper ...@@ -52,44 +52,117 @@ namespace ImageHelper
LONG biYPelsPerMeter; LONG biYPelsPerMeter;
DWORD biClrUsed; DWORD biClrUsed;
DWORD biClrImportant; DWORD biClrImportant;
} ___BITMAPINFOHEADER; };
inline static int CompareStrings (const wchar_t* str1, const wchar_t* str2) struct __BITMAPCOREHEADER
{ {
CString cstr1; cstr1 = str1; DWORD bcSize; /* used to get to color table */
CString cstr2; cstr2 = str2; WORD bcWidth;
WORD bcHeight;
WORD bcPlanes;
WORD bcBitCount;
};
if (cstr1 == cstr2) inline Global::_BlipType SaveImageToFileFromDIB(unsigned char* data, int size, const std::wstring& file_name)//without ext
return 0;
return 1;
}
inline bool SaveImageToFileFromDIB(unsigned char* buffer, int size, const std::wstring& file)
{ {
bool result = false; Global::_BlipType result = Global::msoblipERROR;
const ___BITMAPINFOHEADER* info = (___BITMAPINFOHEADER*)buffer;
CBgraFrame oFrame;
int offset = 0, biSizeImage = 0;
__BITMAPINFOHEADER * header = (__BITMAPINFOHEADER*)data;
if (!header) return result;
result == Global::msoblipDIB;
if (NULL != info && info->biSize == 40) if (header->biWidth > 100000 || header->biHeight > 100000 || header->biSize != 40)
{ {
unsigned char* pBgraData = buffer + sizeof(___BITMAPINFOHEADER); __BITMAPCOREHEADER * header_core = (__BITMAPCOREHEADER *)data;
if (header_core->bcSize != 12)
{
result = Global::msoblipWMF;
}
else
{
offset = 12; //sizeof(BITMAPCOREHEADER)
int nWidth = info->biWidth; oFrame.put_Height (header_core->bcHeight );
int nHeight = info->biHeight; oFrame.put_Width (header_core->bcWidth );
int sz_bitmap = header_core->bcHeight * header_core->bcWidth * header_core->bcBitCount/ 8;
//if (header_core->bcWidth % 2 != 0 && sz_bitmap < size - offset)
// header_core->bcWidth++;
///???? todooo непонятно .. в biff5 нужно флипать картинку, в biff8 не ясно ( -
int stride = -(size - offset) / header_core->bcHeight;
oFrame.put_Stride (stride/*header_core->bcBitCount * header_core->bcWidth /8 */);
CBgraFrame oFrame; biSizeImage = size - offset;
oFrame.put_Data (pBgraData);
oFrame.put_Width (nWidth); if (-stride >= header_core->bcWidth && header_core->bcBitCount >=24 )
oFrame.put_Height (nHeight); {
result = Global::msoblipPNG;
}
}
}
else
{
offset = 40; //sizeof(BITMAPINFOHEADER)
int nStride = info->biSizeImage / nHeight; oFrame.put_Height (header->biHeight );
oFrame.put_Stride( -nStride ); oFrame.put_Width (header->biWidth );
int sz_bitmap = header->biHeight * header->biWidth * header->biBitCount/ 8;
//if (header->biWidth % 2 != 0 && sz_bitmap < size -offset)
// header->biWidth++;
int stride = -(size - offset) / header->biHeight;
result = oFrame.SaveFile(file, 4); if (-stride >= header->biWidth && header->biBitCount >= 24)
{
result = Global::msoblipPNG;
}
oFrame.put_Stride (stride/*header->biBitCount * header->biWidth /8*/);
biSizeImage = header->biSizeImage > 0 ? header->biSizeImage : (size - offset);
}
//------------------------------------------------------------------------------------------
oFrame.put_Data(NULL); if (result == Global::msoblipPNG)
{
oFrame.put_Data((unsigned char*)data + offset);
if (!oFrame.SaveFile(file_name + _T(".png"), 4/*CXIMAGE_FORMAT_PNG*/))
result = Global::msoblipERROR;
oFrame.put_Data(NULL);
}
else if (result == Global::msoblipWMF)
{
NSFile::CFileBinary file;
if (file.CreateFileW(file_name + _T(".wmf")))
{
file.WriteFile((BYTE*)data, size);
file.CloseFile();
}
}
else if (biSizeImage > 0)
{
NSFile::CFileBinary file;
if (file.CreateFileW(file_name + _T(".bmp")))
{
WORD vtType = 0x4D42; file.WriteFile((BYTE*)&vtType, 2);
DWORD dwLen = biSizeImage; file.WriteFile((BYTE*)&dwLen, 4);
DWORD dwRes = 0; file.WriteFile((BYTE*)&dwRes, 4);
DWORD dwOffset = 2; file.WriteFile((BYTE*)&dwOffset, 4);
file.WriteFile((BYTE*)data, size);
file.CloseFile();
}
} }
return result; return result;
} }
} }
...@@ -120,11 +193,11 @@ namespace DocFileFormat ...@@ -120,11 +193,11 @@ namespace DocFileFormat
//Write main content. (word directory) //Write main content. (word directory)
SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T("document.xml" ) ), DocumentXML ); SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T("document.xml" ) ), DocumentXML );
SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "fontTable.xml" ) ), FontTableXML ); SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "fontTable.xml" ) ), FontTableXML );
SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "styles.xml" ) ), StyleSheetXML ); SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "styles.xml" ) ), StyleSheetXML );
SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "footnotes.xml" ) ), FootnotesXML ); SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "footnotes.xml" ) ), FootnotesXML );
SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "endnotes.xml" ) ), EndnotesXML ); SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "endnotes.xml" ) ), EndnotesXML );
SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "numbering.xml" ) ), NumberingXML ); SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "numbering.xml" ) ), NumberingXML );
SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "comments.xml" ) ), CommentsXML ); SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "comments.xml" ) ), CommentsXML );
SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "settings.xml" ) ), SettingsXML ); SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "settings.xml" ) ), SettingsXML );
SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "customizations.xml" ) ),CommandTableXML ); SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "customizations.xml" ) ),CommandTableXML );
...@@ -147,8 +220,8 @@ namespace DocFileFormat ...@@ -147,8 +220,8 @@ namespace DocFileFormat
if (Global::msoblipDIB == iter->blipType) if (Global::msoblipDIB == iter->blipType)
{//user_manual_v52.doc {//user_manual_v52.doc
std::wstring file_name = string2std_string(pathMedia.GetPath()) + FILE_SEPARATOR_STR + _T("image") + FormatUtils::IntToWideString(i++) + iter->ext; std::wstring file_name = string2std_string(pathMedia.GetPath()) + FILE_SEPARATOR_STR + _T("image") + FormatUtils::IntToWideString(i++);
ImageHelper::SaveImageToFileFromDIB(bytes, iter->data.size(), file_name); iter->blipType = ImageHelper::SaveImageToFileFromDIB(bytes, iter->data.size(), file_name);
} }
else else
{ {
......
...@@ -657,7 +657,7 @@ std::wstring XlsConverter::WriteMediaFile(char *data, int size, std::wstring typ ...@@ -657,7 +657,7 @@ std::wstring XlsConverter::WriteMediaFile(char *data, int size, std::wstring typ
if (file.CreateFileW(xlsx_context->get_mediaitems().media_path() + file_name)) if (file.CreateFileW(xlsx_context->get_mediaitems().media_path() + file_name))
{ {
WORD vtType = 0x4D42; file.WriteFile((BYTE*)&vtType, 2); WORD vtType = 0x4D42; file.WriteFile((BYTE*)&vtType, 2);
DWORD dwLen = biSizeImage; file.WriteFile((BYTE*)&dwLen, 4); DWORD dwLen = biSizeImage; file.WriteFile((BYTE*)&dwLen, 4);
DWORD dwRes = 0; file.WriteFile((BYTE*)&dwRes, 4); DWORD dwRes = 0; file.WriteFile((BYTE*)&dwRes, 4);
DWORD dwOffset = 2; file.WriteFile((BYTE*)&dwOffset, 4); DWORD dwOffset = 2; file.WriteFile((BYTE*)&dwOffset, 4);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
QT -= core QT -= core
QT -= gui QT -= gui
VERSION = 2.0.2.378 VERSION = 2.0.2.380
DEFINES += INTVER=$$VERSION DEFINES += INTVER=$$VERSION
mac { mac {
......
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