Commit 467dadc5 authored by ElenaSubbotina's avatar ElenaSubbotina

DocFormat - fix tables world95

parent 1b3a36f3
......@@ -786,7 +786,16 @@ namespace DocFileFormat
{
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.embeddedData && oPicture.embeddedDataSize > 0)
{
m_pXmlWriter->WriteNodeBegin (_T("w:pict"));
VMLPictureMapping oVmlMapper(m_context, m_pXmlWriter, false, _caller);
oPicture.Convert (&oVmlMapper);
m_pXmlWriter->WriteNodeEnd (_T("w:pict"));
}
else if ((oPicture.mfp.mm > 98) && (NULL != oPicture.shapeContainer))
{
m_pXmlWriter->WriteNodeBegin (_T("w:pict"));
......@@ -1112,7 +1121,7 @@ namespace DocFileFormat
for ( std::list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != papx->grpprl->end(); iter++ )
{
//find the tDef SPRM
if ( iter->OpCode == sprmTDefTable )
if ( iter->OpCode == sprmTDefTable || iter->OpCode == sprmOldTDefTable)
{
unsigned char itcMac = iter->Arguments[0];
......
......@@ -32,14 +32,22 @@
#include "PictureDescriptor.h"
#ifndef MM_ISOTROPIC
#define MM_ISOTROPIC 7
#endif
#ifndef MM_ANISOTROPIC
#define MM_ANISOTROPIC 8
#endif
namespace DocFileFormat
{
/// Parses the CHPX for a fcPic an loads the PictureDescriptor at this offset
PictureDescriptor::PictureDescriptor(CharacterPropertyExceptions* chpx, POLE::Stream* stream, int size, bool oldVersion)
:
dxaGoal(0), dyaGoal(0), mx(0), my(0), Type(jpg), Name( _T( "" ) ), 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),
cProps(0), shapeContainer(NULL), blipStoreEntry(NULL)
cProps(0), shapeContainer(NULL), blipStoreEntry(NULL), embeddedData(NULL), embeddedDataSize(0)
{
//Get start and length of the PICT
int fc = GetFcPic( chpx );
......@@ -64,6 +72,8 @@ namespace DocFileFormat
RELEASEOBJECT(shapeContainer);
RELEASEOBJECT(blipStoreEntry);
RELEASEARRAYOBJECTS(embeddedData);
}
void PictureDescriptor::parse(POLE::Stream* stream, int fc, int sz, bool oldVersion)
{
......@@ -97,7 +107,18 @@ namespace DocFileFormat
mfp.yExt = reader.ReadInt16();
mfp.hMf = reader.ReadInt16();
if (mfp.mm >= 98 || oldVersion)
if (mfp.mm == MM_ISOTROPIC || mfp.mm == MM_ANISOTROPIC)
{
Type = wmf;
mx = my = 200;
dxaGoal = mfp.xExt;
dyaGoal = mfp.yExt;
embeddedDataSize = reader.GetSize() - reader.GetPosition(); //lcb ?
embeddedData = reader.ReadBytes( embeddedDataSize, true );
}
else if (mfp.mm >= 98)
{
unsigned char* bytes = reader.ReadBytes(14, true);
rcWinMf = std::vector<unsigned char>(bytes, (bytes + 14));
......@@ -118,7 +139,6 @@ namespace DocFileFormat
short brcl = reader.ReadInt16();
// borders
int bytesCount = 4;
bytes = reader.ReadBytes( bytesCount, true );
......@@ -154,31 +174,6 @@ 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
shapeContainer = dynamic_cast<ShapeContainer*>(RecordFactory::ReadRecord(&reader, 0));
long pos = reader.GetPosition();
......@@ -199,7 +194,6 @@ namespace DocFileFormat
}
}
}
}
/// Returns the fcPic into the "data" stream, where the PIC begins.
/// Returns -1 if the CHPX has no fcPic.
......
......@@ -49,26 +49,26 @@ namespace DocFileFormat
struct MetafilePicture
{
/// Specifies the mapping mode in which the picture is drawn.
// Specifies the mapping mode in which the picture is drawn.
short mm;
/// Specifies the size of the metafile picture for all modes except the MM_ISOTROPIC and MM_ANISOTROPIC modes.
/// (For more information about these modes, see the yExt member.)
/// The x-extent specifies the width of the rectangle within which the picture is drawn.
/// The coordinates are in units that correspond to the mapping mode.
// Specifies the size of the metafile picture for all modes except the MM_ISOTROPIC and MM_ANISOTROPIC modes.
// (For more information about these modes, see the yExt member.)
// The x-extent specifies the width of the rectangle within which the picture is drawn.
// The coordinates are in units that correspond to the mapping mode.
short xExt;
/// Specifies the size of the metafile picture for all modes except the MM_ISOTROPIC and MM_ANISOTROPIC modes.
/// The y-extent specifies the height of the rectangle within which the picture is drawn.
/// The coordinates are in units that correspond to the mapping mode.
/// For MM_ISOTROPIC and MM_ANISOTROPIC modes, which can be scaled, the xExt and yExt members
/// contain an optional suggested size in MM_HIMETRIC units.
/// For MM_ANISOTROPIC pictures, xExt and yExt can be zero when no suggested size is supplied.
/// For MM_ISOTROPIC pictures, an aspect ratio must be supplied even when no suggested size is given.
/// (If a suggested size is given, the aspect ratio is implied by the size.)
/// To give an aspect ratio without implying a suggested size, set xExt and yExt to negative values
/// whose ratio is the appropriate aspect ratio.
/// The magnitude of the negative xExt and yExt values is ignored; only the ratio is used.
// Specifies the size of the metafile picture for all modes except the MM_ISOTROPIC and MM_ANISOTROPIC modes.
// The y-extent specifies the height of the rectangle within which the picture is drawn.
// The coordinates are in units that correspond to the mapping mode.
// For MM_ISOTROPIC and MM_ANISOTROPIC modes, which can be scaled, the xExt and yExt members
// contain an optional suggested size in MM_HIMETRIC units.
// For MM_ANISOTROPIC pictures, xExt and yExt can be zero when no suggested size is supplied.
// For MM_ISOTROPIC pictures, an aspect ratio must be supplied even when no suggested size is given.
// (If a suggested size is given, the aspect ratio is implied by the size.)
// To give an aspect ratio without implying a suggested size, set xExt and yExt to negative values
// whose ratio is the appropriate aspect ratio.
// The magnitude of the negative xExt and yExt values is ignored; only the ratio is used.
short yExt;
/// Handle to a memory metafile.
// Handle to a memory metafile.
short hMf;
};
......@@ -80,14 +80,15 @@ namespace DocFileFormat
friend class NumberingMapping;
public:
/// Parses the CHPX for a fcPic an loads the PictureDescriptor at this offset
// Parses the CHPX for a fcPic an loads the PictureDescriptor at this offset
PictureDescriptor( CharacterPropertyExceptions* chpx, POLE::Stream* stream, int size, bool oldVersion);
virtual ~PictureDescriptor();
private:
void parse( POLE::Stream* stream, int fc, int sz, bool oldVersion);
/// Returns the fcPic into the "data" stream, where the PIC begins.
/// Returns -1 if the CHPX has no fcPic.
// Returns the fcPic into the "data" stream, where the PIC begins.
// Returns -1 if the CHPX has no fcPic.
static int GetFcPic( const CharacterPropertyExceptions* chpx );
void Clear();
......@@ -95,45 +96,37 @@ namespace DocFileFormat
static const short MM_SHAPE = 0x0064; // Shape object
static const short MM_SHAPEFILE = 0x0066; // Shape file
/// Rectangle for window origin and extents when metafile is stored (ignored if 0).
std::vector<unsigned char> rcWinMf;
/// Horizontal measurement in twips of the rectangle the picture should be imaged within.
short dxaGoal;
/// Vertical measurement in twips of the rectangle the picture should be imaged within.
short dyaGoal;
/// Horizontal scaling factor supplied by user expressed in .001% units
unsigned short mx;
/// Vertical scaling factor supplied by user expressed in .001% units
unsigned short my;
/// The type of the picture
PictureType Type;
/// The name of the picture
std::wstring Name;
/// The data of the windows metafile picture (WMF)
std::vector<unsigned char> rcWinMf; // Rectangle for window origin and extents when metafile is stored (ignored if 0).
short dxaGoal; // Horizontal measurement in twips of the rectangle the picture should be imaged within.
short dyaGoal; // Vertical measurement in twips of the rectangle the picture should be imaged within.
unsigned short mx; // Horizontal scaling factor supplied by user expressed in .001% units
unsigned short my; // Vertical scaling factor supplied by user expressed in .001% units
PictureType Type; // The type of the picture
MetafilePicture mfp;
/// The amount the picture has been cropped on the left in twips
short dxaCropLeft;
/// The amount the picture has been cropped on the top in twips
short dyaCropTop;
/// The amount the picture has been cropped on the right in twips
short dxaCropRight;
/// The amount the picture has been cropped on the bottom in twips
short dyaCropBottom;
/// Border above picture
BorderCode *brcTop;
/// Border to the left of the picture
BorderCode *brcLeft;
/// Border below picture
BorderCode *brcBottom;
/// Border to the right of the picture
BorderCode *brcRight;
/// Horizontal offset of hand annotation origin
short dxaOrigin;
/// vertical offset of hand annotation origin
short dyaOrigin;
/// unused
short dxaCropLeft; // The amount the picture has been cropped on the left in twips
short dyaCropTop; // The amount the picture has been cropped on the top in twips
short dxaCropRight; // The amount the picture has been cropped on the right in twips
short dyaCropBottom; // The amount the picture has been cropped on the bottom in twips
BorderCode *brcTop; // Border above picture
BorderCode *brcLeft; // Border to the left of the picture
BorderCode *brcBottom; // Border below picture
BorderCode *brcRight; // Border to the right of the picture
short dxaOrigin; // horizontal offset of hand annotation origin
short dyaOrigin; // vertical offset of hand annotation origin
short cProps;
ShapeContainer* shapeContainer;
BlipStoreEntry* blipStoreEntry;
//------------------
ShapeContainer * shapeContainer;
BlipStoreEntry * blipStoreEntry;
unsigned char *embeddedData;
short embeddedDataSize;
};
}
......@@ -91,28 +91,32 @@ namespace DocFileFormat
//some opCode need special treatment
switch ( opCode )
{
case sprmOldTDefTable:
case sprmOldTDefTable10:
case sprmTDefTable:
case sprmTDefTable10:
{
//The opSize of the table definition is stored in 2 bytes instead of 1
lenByte = 2;
opSize = FormatUtils::BytesToInt16( bytes, ( sprmStart + 2 ), size );
opSize = FormatUtils::BytesToInt16( bytes, ( sprmStart + opCodeSize ), size );
//Word adds an additional unsigned char to the opSize to compensate the additional
//unsigned char needed for the length
opSize--;
}break;
case sprmOldPChgTabs:
case sprmPChgTabs:
{
//The tab operand can be bigger than 255 bytes (length unsigned char is set to 255).
//In this case a special calculation of the opSize is needed
lenByte = 1;
opSize = bytes[sprmStart + 2];
opSize = bytes[sprmStart + opCodeSize];
if ( opSize == 255 )
{
unsigned char itbdDelMax = bytes[sprmStart + 3];
unsigned char itbdAddMax = bytes[sprmStart + 3 + 2 * itbdDelMax];
unsigned char itbdDelMax = bytes[sprmStart + opCodeSize + 1];
unsigned char itbdAddMax = bytes[sprmStart + opCodeSize + 1 + 2 * itbdDelMax];
opSize = (short)( ( itbdDelMax * 4 + itbdAddMax * 3 ) - 1 );
}
}break;
......
......@@ -86,6 +86,8 @@ namespace DocFileFormat
{
switch ( OpCode )
{
case sprmOldTDefTable:
case sprmOldTDefTable10:
case sprmTDefTable:
case sprmTDefTable10:
{
......@@ -99,6 +101,7 @@ namespace DocFileFormat
}
break;
case sprmOldPChgTabs:
case sprmPChgTabs:
{
argumentsSize = bytes[2];
......@@ -205,7 +208,7 @@ namespace DocFileFormat
}
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
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
};
unsigned char SinglePropertyModifier::GetOldOperandSize(unsigned char code)
......
......@@ -51,44 +51,53 @@ namespace DocFileFormat
{
for ( std::list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != papx->grpprl->end(); iter++ )
{
if ( iter->OpCode == sprmPFInTable )
switch(iter->OpCode)
{
this->fInTable = ( iter->Arguments[0] == 1 ) ? (true) : (false);
}
case sprmOldPFInTable:
case sprmPFInTable:
{
fInTable = ( iter->Arguments[0] == 1 ) ? (true) : (false);
}break;
if ( iter->OpCode == sprmPFTtp )
//case sprmOldPFTtp:
case sprmOldPTtp:
case sprmPFTtp:
{
this->fTtp = ( iter->Arguments[0] == 1 ) ? (true) : (false);
}
fTtp = ( iter->Arguments[0] == 1 ) ? (true) : (false);
}break;
if ( iter->OpCode == sprmPFInnerTableCell )
//case sprmOldPFInnerTableCell:
case sprmPFInnerTableCell:
{
this->fInnerTableCell = ( iter->Arguments[0] == 1 ) ? (true) : (false);
}
fInnerTableCell = ( iter->Arguments[0] == 1 ) ? (true) : (false);
}break;
if ( iter->OpCode == sprmPFInnerTtp )
//case sprmOldPFInnerTtp:
case sprmPFInnerTtp:
{
this->fInnerTtp = ( iter->Arguments[0] == 1 ) ? (true) : (false);
}
fInnerTtp = ( iter->Arguments[0] == 1 ) ? (true) : (false);
}break;
if ( iter->OpCode == sprmPItap )
//case sprmOldPItap:
case sprmPItap:
{
this->iTap = FormatUtils::BytesToUInt32( iter->Arguments, 0, iter->argumentsSize );
iTap = FormatUtils::BytesToUInt32( iter->Arguments, 0, iter->argumentsSize );
if ( this->iTap > 0 )
if ( iTap > 0 )
{
this->fInTable = true;
fInTable = true;
}
}break;
}
if ( (int)( iter->OpCode ) == 0x66A )
if ( (int)( iter->OpCode ) == sprmTCnf )//66a
{
//add value!
this->iTap = FormatUtils::BytesToUInt32( iter->Arguments, 0, iter->argumentsSize );
iTap = FormatUtils::BytesToUInt32( iter->Arguments, 0, iter->argumentsSize );
if ( this->iTap > 0 )
if ( iTap > 0 )
{
this->fInTable = true;
fInTable = true;
}
}
}
......
......@@ -371,8 +371,8 @@ namespace DocFileFormat
TableInfo tai( papx );
TableRow tableRow( documentMapping, _cp );
TableCell tableCell( documentMapping, _cp );
TableRow tableRow ( documentMapping, _cp );
TableCell tableCell ( documentMapping, _cp );
do
{
......
......@@ -72,7 +72,7 @@ namespace DocFileFormat
{
grpprl->push_back(*oSpmIter);
}
else if ((int)(oSpmIter->OpCode) == sprmPTableProps)
else if (oSpmIter->OpCode == sprmPTableProps)
{
//there is a native TAP in the data stream
unsigned int fc = FormatUtils::BytesToUInt32(oSpmIter->Arguments, 0, oSpmIter->argumentsSize);
......
......@@ -132,36 +132,41 @@ namespace DocFileFormat
void VMLPictureMapping::Apply( IVisitable* visited )
{
PictureDescriptor* pict = static_cast<PictureDescriptor*>(visited);
if (!pict) return;
double xScaling = pict->mx / 1000.0;
double yScaling = pict->my / 1000.0;
TwipsValue width( ( pict->dxaGoal - ( pict->dxaCropLeft + pict->dxaCropRight ) ) * xScaling );
TwipsValue height( ( pict->dyaGoal - ( pict->dyaCropTop + pict->dyaCropBottom ) ) * yScaling );
std::wstring widthString = FormatUtils::DoubleToWideString( width.ToPoints() );
std::wstring heightString = FormatUtils::DoubleToWideString( height.ToPoints() );
std::list<OptionEntry> options;
PictureFrameType type;
if ((pict->shapeContainer || pict->blipStoreEntry) && pict->shapeContainer->Children.size() > 0)
{
Shape* shape = static_cast<Shape*>(*(pict->shapeContainer->Children.begin()));
std::list<OptionEntry> options = pict->shapeContainer->ExtractOptions();
options = pict->shapeContainer->ExtractOptions();
//v:shapetype
PictureFrameType type;
type.SetType(shape->Instance);
VMLShapeTypeMapping* vmlShapeTypeMapping = new VMLShapeTypeMapping( m_pXmlWriter, m_isBulletPicture );
type.Convert( vmlShapeTypeMapping );
RELEASEOBJECT( vmlShapeTypeMapping );
//v:shape
}
else if (pict->embeddedData)
{
type.SetType(msosptPictureFrame);
}
m_pXmlWriter->WriteNodeBegin( _T( "v:shape" ), true );
m_pXmlWriter->WriteAttribute( _T( "type" ), ( std::wstring( _T( "#" ) ) + VMLShapeTypeMapping::GenerateTypeId( &type ) ).c_str() );
std::wstring style;
m_pXmlWriter->WriteAttribute( _T( "type" ), std::wstring( _T( "#" ) + VMLShapeTypeMapping::GenerateTypeId(&type)).c_str());
double xScaling = pict->mx / 1000.0;
double yScaling = pict->my / 1000.0;
TwipsValue width( ( pict->dxaGoal - ( pict->dxaCropLeft + pict->dxaCropRight ) ) * xScaling );
TwipsValue height( ( pict->dyaGoal - ( pict->dyaCropTop + pict->dyaCropBottom ) ) * yScaling );
std::wstring widthString = FormatUtils::DoubleToWideString( width.ToPoints() );
std::wstring heightString = FormatUtils::DoubleToWideString( height.ToPoints() );
style = std::wstring( _T( "width:" ) ) + widthString + std::wstring( _T( "pt;" ) ) + std::wstring( _T( "height:" ) ) + heightString + std::wstring( _T( "pt;" ) );
std::wstring style = std::wstring( _T( "width:" ) ) + widthString + std::wstring( _T( "pt;" ) ) + std::wstring( _T( "height:" ) ) + heightString + std::wstring( _T( "pt;" ) );
m_pXmlWriter->WriteAttribute( _T( "style" ), style.c_str() );
......@@ -258,7 +263,7 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
if (CopyPicture(pict->blipStoreEntry))
if (CopyPicture(pict))
{
//v:imageData
appendValueAttribute(m_imageData, _T( "r:id" ), ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString(m_nImageId) ).c_str());
......@@ -275,7 +280,6 @@ namespace DocFileFormat
//close v:shape
m_pXmlWriter->WriteNodeEnd( _T( "v:shape" ) );
}
}
std::wstring VMLPictureMapping::GetShapeId () const
{
......@@ -283,9 +287,11 @@ namespace DocFileFormat
}
/// Writes a border element
void VMLPictureMapping::writePictureBorder( const wchar_t* name, const BorderCode* brc )
void VMLPictureMapping::writePictureBorder( const std::wstring & name, const BorderCode* brc )
{
m_pXmlWriter->WriteNodeBegin( ( std::wstring( _T( "w10:" ) ) + std::wstring( name ) ).c_str(), true );
if (!brc || name.empty()) return;
m_pXmlWriter->WriteNodeBegin( ( std::wstring( _T( "w10:" ) ) + name).c_str(), true );
m_pXmlWriter->WriteAttribute( _T( "type" ), getBorderType( brc->brcType ).c_str() );
m_pXmlWriter->WriteAttribute( _T( "width" ), FormatUtils::IntToWideString( brc->dptLineWidth ).c_str() );
m_pXmlWriter->WriteNodeEnd ( _T( "" ), true );
......@@ -293,12 +299,20 @@ namespace DocFileFormat
/// Copies the picture from the binary stream to the zip archive
/// and creates the relationships for the image.
bool VMLPictureMapping::CopyPicture (BlipStoreEntry* oBlipEntry)
bool VMLPictureMapping::CopyPicture (PictureDescriptor* pict)
{
if (!pict) return false;
bool result = false;
// write the blip
if ((oBlipEntry != NULL) && (oBlipEntry->Blip != NULL))
BlipStoreEntry* oBlipEntry = pict->blipStoreEntry;
if (pict->embeddedData && pict->embeddedDataSize > 0)
{
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))
{
switch (oBlipEntry->btWin32)
{
......@@ -336,9 +350,7 @@ namespace DocFileFormat
default:
{
result = false;
return result;
return false;
}
break;
}
......
......@@ -56,13 +56,13 @@ namespace DocFileFormat
private:
/// Writes a border element
void writePictureBorder (const wchar_t* name, const BorderCode* brc);
void writePictureBorder (const std::wstring & name, const BorderCode* brc);
void appendStyleProperty( std::wstring* b, const std::wstring& propName, const std::wstring& propValue ) const;
protected:
/// Copies the picture from the binary stream to the zip archive
/// and creates the relationships for the image.
bool CopyPicture (BlipStoreEntry* oBlipEntry);
bool CopyPicture (PictureDescriptor* pict);
public:
......
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