Commit 84470c55 authored by Alexey.Musinov's avatar Alexey.Musinov Committed by Alexander Trofimov
parent 23711e37
......@@ -2,6 +2,6 @@
//1
//0
//0
//126
#define INTVER 1,0,0,126
#define STRVER "1,0,0,126\0"
//127
#define INTVER 1,0,0,127
#define STRVER "1,0,0,127\0"
......@@ -5,22 +5,16 @@
namespace DocFileFormat
{
class AnnotationOwnerList: public vector<wstring>
{
public:
AnnotationOwnerList( FileInformationBlock* fib, IStream* tableStream):
vector<wstring>()
{
VirtualStreamReader tStream( tableStream, fib->m_FibWord97.fcGrpXstAtnOwners );
while ( tStream.GetPosition() < ( fib->m_FibWord97.fcGrpXstAtnOwners + fib->m_FibWord97.lcbGrpXstAtnOwners ) )
{
this->push_back( tStream.ReadXstz() );
}
}
virtual ~AnnotationOwnerList()
{
}
};
class AnnotationOwnerList: public vector<wstring>
{
public:
AnnotationOwnerList(FileInformationBlock* fib, IStream* tableStream) : std::vector<wstring>()
{
VirtualStreamReader reader(tableStream, fib->m_FibWord97.fcGrpXstAtnOwners);
while (reader.GetPosition() < (fib->m_FibWord97.fcGrpXstAtnOwners + fib->m_FibWord97.lcbGrpXstAtnOwners))
{
push_back(reader.ReadXst());
}
}
};
}
\ No newline at end of file
......@@ -3,26 +3,26 @@
namespace DocFileFormat
{
ByteStructure* AnnotationReferenceDescriptor::ConstructObject( VirtualStreamReader* reader, int length )
{
AnnotationReferenceDescriptor *newObject = new AnnotationReferenceDescriptor();
ByteStructure* AnnotationReferenceDescriptor::ConstructObject(VirtualStreamReader* reader, int length)
{
AnnotationReferenceDescriptor *newObject = new AnnotationReferenceDescriptor();
//read the user initials (LPXCharBuffer9)
short cch = reader->ReadInt16();
byte *chars = reader->ReadBytes( 18, true );
FormatUtils::GetSTLCollectionFromBytes<wstring>( &(newObject->UserInitials), chars, ( cch * 2 ), ENCODING_UNICODE );
//read the user initials (LPXCharBuffer9)
short cch = reader->ReadInt16();
newObject->AuthorIndex = reader->ReadUInt16();
byte *chars = reader->ReadBytes(18, true);
//skip 4 bytes
reader->ReadBytes( 4, false );
FormatUtils::GetSTLCollectionFromBytes<wstring>( &(newObject->m_UserInitials), chars, ( cch * 2 ), ENCODING_UNICODE);
newObject->BookmarkId = reader->ReadInt32();
newObject->m_AuthorIndex = reader->ReadUInt16();
RELEASEARRAYOBJECTS( chars );
//skip 4 bytes
reader->ReadBytes(4, false);
return static_cast<ByteStructure*>( newObject );
}
newObject->m_BookmarkId = reader->ReadInt32();
RELEASEARRAYOBJECTS(chars);
return static_cast<ByteStructure*>(newObject);
}
}
\ No newline at end of file
......@@ -4,43 +4,43 @@
namespace DocFileFormat
{
class AnnotationReferenceDescriptor: public ByteStructure
{
private:
/// The initials of the user who left the annotation.
wstring UserInitials;
/// An index into the string table of comment author names.
unsigned short AuthorIndex;
/// Identifies a bookmark.
int BookmarkId;
public:
static const int STRUCTURE_SIZE = 30;
wstring GetUserInitials() const
{
return UserInitials;
}
unsigned short GetAuthorIndex() const
{
return AuthorIndex;
}
int GetBookmarkId() const
{
return BookmarkId;
}
AnnotationReferenceDescriptor():
UserInitials( _T( "" ) ), AuthorIndex(0), BookmarkId(0)
{
}
virtual ~AnnotationReferenceDescriptor()
{
}
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
};
class AnnotationReferenceDescriptor: public ByteStructure
{
public:
static const int STRUCTURE_SIZE = 30;
inline std::wstring GetUserInitials() const
{
return m_UserInitials;
}
inline unsigned short GetAuthorIndex() const
{
return m_AuthorIndex;
}
inline int GetBookmarkId() const
{
return m_BookmarkId;
}
AnnotationReferenceDescriptor() : m_UserInitials( _T( "" ) ), m_AuthorIndex(0), m_BookmarkId(0)
{
}
virtual ~AnnotationReferenceDescriptor()
{
}
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
private:
/// The initials of the user who left the annotation.
std::wstring m_UserInitials;
/// An index into the string table of comment author names.
unsigned short m_AuthorIndex;
/// Identifies a bookmark.
int m_BookmarkId;
};
}
......@@ -73,6 +73,7 @@ namespace DocFileFormat
// 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")))
return false;
return true;
}
......@@ -87,8 +88,9 @@ namespace DocFileFormat
// - http://bugzserver/show_bug.cgi?id=13353 TODO :
BOOL haveStyle = FALSE;
for (list<SinglePropertyModifier>::iterator iter = sprms->begin(); iter != sprms->end(); ++iter)
std::list<SinglePropertyModifier>::iterator end = sprms->end();
for (std::list<SinglePropertyModifier>::iterator iter = sprms->begin(); iter != end; ++iter)
{
switch ( (int)( iter->OpCode ) )
{
......@@ -490,8 +492,8 @@ namespace DocFileFormat
node->AppendChild( *ele );
}
RELEASEOBJECT( ele );
RELEASEOBJECT( val );
RELEASEOBJECT(ele);
RELEASEOBJECT(val);
}
}
......@@ -544,15 +546,16 @@ namespace DocFileFormat
{
bool ret = false;
for ( list<CharacterPropertyExceptions*>::const_iterator iter = this->_hierarchy.begin(); iter != this->_hierarchy.end(); iter++ )
std::list<CharacterPropertyExceptions*>::const_iterator end = _hierarchy.end();
for (std::list<CharacterPropertyExceptions*>::const_iterator iter = this->_hierarchy.begin(); iter != end; ++iter)
{
for ( list<SinglePropertyModifier>::const_iterator grpprlIter = (*iter)->grpprl->begin(); grpprlIter != (*iter)->grpprl->end(); grpprlIter++ )
std::list<SinglePropertyModifier>::const_iterator end_grpprl = (*iter)->grpprl->end();
for (std::list<SinglePropertyModifier>::const_iterator grpprlIter = (*iter)->grpprl->begin(); grpprlIter != end_grpprl; ++grpprlIter)
{
if ( grpprlIter->OpCode == sprm.OpCode )
if (grpprlIter->OpCode == sprm.OpCode)
{
byte ancient = grpprlIter->Arguments[0];
ret = toogleValue( ret, ancient );
ret = toogleValue(ret, ancient);
break;
}
}
......@@ -563,7 +566,7 @@ namespace DocFileFormat
/*========================================================================================================*/
bool CharacterPropertiesMapping::toogleValue( bool currentValue, byte toggle )
bool CharacterPropertiesMapping::toogleValue(bool currentValue, byte toggle)
{
if ( toggle == 1 )
{
......
......@@ -35,12 +35,12 @@ namespace DocFileFormat
int cp = m_document->FIB->m_RgLw97.ccpText + m_document->FIB->m_RgLw97.ccpFtn + m_document->FIB->m_RgLw97.ccpHdr;
for ( unsigned int i = 0; i < m_document->AnnotationsReferencePlex->Elements.size(); i++ )
size_t count = m_document->AnnotationsReferencePlex->Elements.size();
for (unsigned int i = 0; i < count; ++i)
{
m_pXmlWriter->WriteNodeBegin( _T( "w:comment" ), TRUE );
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>( m_document->AnnotationsReferencePlex->Elements[index] );
AnnotationReferenceDescriptor* atrdPre10 = static_cast<AnnotationReferenceDescriptor*>(m_document->AnnotationsReferencePlex->Elements[index]);
m_pXmlWriter->WriteNodeBegin( _T( "w:comment" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:id" ), FormatUtils::IntToWideString( index ).c_str() );
m_pXmlWriter->WriteAttribute( _T( "w:author" ), m_document->AnnotationOwners->at( atrdPre10->GetAuthorIndex() ).c_str() );
m_pXmlWriter->WriteAttribute( _T( "w:initials" ), atrdPre10->GetUserInitials().c_str() );
......@@ -60,31 +60,30 @@ namespace DocFileFormat
{
int fc = m_document->FindFileCharPos(cp);
ParagraphPropertyExceptions* papx = findValidPapx( fc );
TableInfo tai( papx );
ParagraphPropertyExceptions* papx = findValidPapx(fc);
TableInfo tai(papx);
if ( tai.fInTable )
{
//this PAPX is for a table
Table table( this, cp, ( ( tai.iTap > 0 ) ? ( 1 ) : ( 0 ) ) );
table.Convert( this );
Table table(this, cp, ( ( tai.iTap > 0 ) ? ( 1 ) : ( 0 ) ));
table.Convert(this);
cp = table.GetCPEnd();
}
else
{
//this PAPX is for a normal paragraph
cp = writeParagraph( cp );
cp = writeParagraph(cp);
}
}
m_pXmlWriter->WriteNodeEnd( _T( "w:comment" ) );
m_pXmlWriter->WriteNodeEnd(_T( "w:comment" ));
index++;
++index;
}
m_pXmlWriter->WriteNodeEnd( _T( "w:comments" ) );
m_context->_docx->CommentsXML = wstring( m_pXmlWriter->GetXmlString() );
m_context->_docx->CommentsXML = std::wstring(m_pXmlWriter->GetXmlString());
}
}
};
......
......@@ -17,14 +17,16 @@ namespace DocFileFormat
unsigned short nElems = FormatUtils::BytesToUInt16(pSegmentInfo, 0, pSegmentInfoSize);
unsigned short nElemsAlloc = FormatUtils::BytesToUInt16(pSegmentInfo, 2, pSegmentInfoSize);
unsigned short cb = FormatUtils::BytesToUInt16(pSegmentInfo, 4, pSegmentInfoSize);
if ((0xfff0 != cb) && (cb > 8)) //
//
bool headerIs = ((0xfff0 != cb) && (cb > 8) || nElems > nElemsAlloc);
if (headerIs)
{
cb = 2;
offset = 0;
nElems = pSegmentInfoSize / 2;
for (unsigned int i = 0; i < nElems; ++i)
for (unsigned short i = 0; i < nElems; ++i)
{
PathSegment oSegment = PathSegment(FormatUtils::BytesToUInt16(pSegmentInfo + offset, (i * cb), pSegmentInfoSize));
m_arSegments.push_back (oSegment);
......@@ -43,7 +45,7 @@ namespace DocFileFormat
{
cb = 4;
for (unsigned int i = 0; i < nElems; ++i)
for (unsigned short i = 0; i < nElems; ++i)
{
PathSegment oSegment = PathSegment(FormatUtils::BytesToUInt16(pSegmentInfo + offset, (i * cb), pSegmentInfoSize));
m_arSegments.push_back (oSegment);
......@@ -54,7 +56,7 @@ namespace DocFileFormat
if ((2 != cb) && (1 != cb))
cb = 8;
for (unsigned int i = 0; i < nElems; ++i)
for (unsigned short i = 0; i < nElems; ++i)
{
PathSegment oSegment = PathSegment(FormatUtils::BytesToInt32(pSegmentInfo + offset, (i * cb), pSegmentInfoSize));
m_arSegments.push_back (oSegment);
......@@ -76,7 +78,7 @@ namespace DocFileFormat
{
cb = 4;
for (unsigned int i = 0; i < nElems; ++i)
for (unsigned short i = 0; i < nElems; ++i)
{
POINT point;
......@@ -88,7 +90,7 @@ namespace DocFileFormat
}
else
{
for (unsigned int i = 0; i < nElems; ++i)
for (unsigned short i = 0; i < nElems; ++i)
{
POINT point;
......@@ -125,8 +127,10 @@ namespace DocFileFormat
return strVmlPath;
}
for (vector<PathSegment>::const_iterator iter = m_arSegments.begin(); iter != m_arSegments.end(); ++iter)
int cc = 0;
std::vector<PathSegment>::const_iterator end = m_arSegments.end();
for (vector<PathSegment>::const_iterator iter = m_arSegments.begin(); iter != end; ++iter, cc++)
{
try
{
......@@ -134,7 +138,7 @@ namespace DocFileFormat
{
case PathSegment::msopathLineTo:
{
for ( int i = 0; i < iter->Count; ++i)
for (int i = 0; i < iter->Count; ++i)
{
if (valuePointer >= (int)m_arPoints.size())
{
......@@ -164,7 +168,7 @@ namespace DocFileFormat
case PathSegment::msopathCurveTo:
{
for ( int i = 0; i < iter->Count; ++i)
for (int i = 0; i < iter->Count; ++i)
{
strVmlPath += _T( "c" );
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
......
......@@ -86,21 +86,22 @@ namespace DocFileFormat
RELEASEOBJECT( rev );
RELEASEOBJECT( rPr );
}
for ( list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != papx->grpprl->end(); iter++ )
std::list<SinglePropertyModifier>::iterator end = papx->grpprl->end();
for (std::list<SinglePropertyModifier>::iterator iter = papx->grpprl->begin(); iter != end; ++iter)
{
switch ( iter->OpCode )
{
case sprmPIpgp:
{
appendValueElement( _pPr, _T( "divId" ), FormatUtils::IntToWideString( FormatUtils::BytesToUInt32( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true );
appendValueElement(_pPr, _T( "divId" ), FormatUtils::IntToWideString( FormatUtils::BytesToUInt32(iter->Arguments, 0, iter->argumentsSize)).c_str(), true);
}
break;
//element flags
case sprmPFAutoSpaceDE:
{
appendFlagElement( _pPr, *iter, _T( "autoSpaceDE" ), true );
appendFlagElement(_pPr, *iter, _T( "autoSpaceDE" ), true);
}
break;
......
......@@ -43,17 +43,21 @@ namespace DocFileFormat
TablePropertyExceptions* tapx = static_cast<TablePropertyExceptions*>(visited);
int nComputedCellWidth = 0;
for (list<SinglePropertyModifier>::const_reverse_iterator iter = tapx->grpprl->rbegin(); iter != tapx->grpprl->rend(); ++iter)
std::list<SinglePropertyModifier>::const_reverse_iterator rend = tapx->grpprl->rend();
for (std::list<SinglePropertyModifier>::const_reverse_iterator iter = tapx->grpprl->rbegin(); iter != rend; ++iter)
{
// SinglePropertyModifier oSpm = (*iter);
#ifdef _DEBUG
SinglePropertyModifier spm = (*iter);
#endif
switch (iter->OpCode)
{
case sprmTDefTable : // Table definition SPRM
case sprmTDefTable: // Table definition SPRM
{
SprmTDefTable tdef( iter->Arguments, iter->argumentsSize );
SprmTDefTable tdef(iter->Arguments, iter->argumentsSize);
int cc = tdef.numberOfColumns;
this->_tGrid = tdef.rgdxaCenter;
this->_tcDef = tdef.rgTc80[_cellIndex];
this->_tcDef = tdef.rgTc80[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], 5, 6 ).c_str(), false );
......@@ -78,7 +82,8 @@ namespace DocFileFormat
appendValueElement( _tcPr, _T( "noWrap" ), _T( "" ), true );
}
nComputedCellWidth = (short)( tdef.rgdxaCenter[_cellIndex + 1] - tdef.rgdxaCenter[_cellIndex] );
nComputedCellWidth = (short)( tdef.rgdxaCenter[(size_t)min(_cellIndex, (int)tdef.rgTc80.size() - 1) + 1] -
tdef.rgdxaCenter[min(_cellIndex, (int)tdef.rgTc80.size() - 1)] ); // NOTE: fix for crash
//borders
if (!IsTableBordersDefined(tapx->grpprl))
......@@ -101,10 +106,10 @@ namespace DocFileFormat
//margins
case sprmTCellPadding:
{
byte first = iter->Arguments[0];
byte lim = iter->Arguments[1];
byte ftsMargin = iter->Arguments[3];
short wMargin = FormatUtils::BytesToInt16( iter->Arguments, 4, iter->argumentsSize );
byte first = iter->Arguments[0];
byte lim = iter->Arguments[1];
byte ftsMargin = iter->Arguments[3];
short wMargin = FormatUtils::BytesToInt16( iter->Arguments, 4, iter->argumentsSize );
if ( ( this->_cellIndex >= first ) && ( this->_cellIndex < lim ) )
{
......@@ -189,9 +194,9 @@ namespace DocFileFormat
byte lim = iter->Arguments[1];
if ( ( this->_cellIndex >= first ) && ( this->_cellIndex < lim ) )
{
appendValueElement( this->_tcPr, _T( "tcFitText" ), FormatUtils::IntToWideString( iter->Arguments[2] ).c_str(), true );
}
{
appendValueElement( this->_tcPr, _T( "tcFitText" ), FormatUtils::IntToWideString( iter->Arguments[2] ).c_str(), true );
}
}
break;
......@@ -336,7 +341,7 @@ namespace DocFileFormat
appendShading (_tcPr, shd);
}
RELEASEARRAYOBJECTS( shdBytes );
RELEASEARRAYOBJECTS(shdBytes);
}
}
}
......@@ -345,7 +350,8 @@ namespace DocFileFormat
{
if (grpprl)
{
for (list<SinglePropertyModifier>::const_iterator iter = grpprl->begin(); iter != grpprl->end(); ++iter)
std::list<SinglePropertyModifier>::const_iterator end = grpprl->end();
for (std::list<SinglePropertyModifier>::const_iterator iter = grpprl->begin(); iter != end; ++iter)
{
if ((iter->OpCode == sprmTTableBorders) || (iter->OpCode == sprmTTableBorders80) || (iter->OpCode == sprmTSetBrc))
return true;
......@@ -359,7 +365,8 @@ namespace DocFileFormat
{
if (grpprl)
{
for (list<SinglePropertyModifier>::const_iterator iter = grpprl->begin(); iter != grpprl->end(); ++iter)
std::list<SinglePropertyModifier>::const_iterator end = grpprl->end();
for (std::list<SinglePropertyModifier>::const_iterator iter = grpprl->begin(); iter != end; ++iter)
{
if ( iter->OpCode == sprmTCellWidth )
{
......
......@@ -7,14 +7,14 @@ namespace DocFileFormat
{
VMLPictureMapping::VMLPictureMapping(ConversionContext* ctx, XmlUtils::CXmlWriter* writer, bool olePreview, IMapping* caller, bool isBulletPicture) : PropertiesMapping(writer)
{
_ctx = ctx;
_olePreview = olePreview;
_imageData = NULL;
m_ctx = ctx;
m_olePreview = olePreview;
m_imageData = NULL;
m_nImageId = 0;
_caller = caller;
_isBulletPicture = isBulletPicture;
m_caller = caller;
m_isBulletPicture = isBulletPicture;
_imageData = new XMLTools::XMLElement<WCHAR>( _T( "v:imagedata" ) );
m_imageData = new XMLTools::XMLElement<WCHAR>( _T( "v:imagedata" ) );
GUID guid = GUID_NULL;
LPOLESTR guidString = NULL;
......@@ -27,7 +27,7 @@ namespace DocFileFormat
VMLPictureMapping::~VMLPictureMapping()
{
RELEASEOBJECT (_imageData);
RELEASEOBJECT(m_imageData);
}
}
......@@ -44,7 +44,7 @@ namespace DocFileFormat
//v:shapetype
PictureFrameType type;
VMLShapeTypeMapping* vmlShapeTypeMapping = new VMLShapeTypeMapping( m_pXmlWriter, this->_isBulletPicture );
VMLShapeTypeMapping* vmlShapeTypeMapping = new VMLShapeTypeMapping( m_pXmlWriter, m_isBulletPicture );
type.Convert( vmlShapeTypeMapping );
RELEASEOBJECT( vmlShapeTypeMapping );
......@@ -69,12 +69,13 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute( _T( "id" ), m_ShapeId.c_str() );
if ( this->_olePreview )
if (m_olePreview)
{
m_pXmlWriter->WriteAttribute( _T( "o:ole" ), _T( "" ) );
}
for ( list<OptionEntry>::iterator iter = options.begin(); iter != options.end(); iter++ )
std::list<OptionEntry>::iterator end = options.end();
for (std::list<OptionEntry>::iterator iter = options.begin(); iter != end; ++iter)
{
switch ( iter->pid )
{
......@@ -114,7 +115,7 @@ namespace DocFileFormat
{
//cast to signed integer
int cropBottom = (int)iter->op;
appendValueAttribute( this->_imageData, _T( "cropbottom" ), ( FormatUtils::IntToWideString( cropBottom ) + wstring( _T( "f" ) ) ).c_str() );
appendValueAttribute(m_imageData, _T( "cropbottom" ), ( FormatUtils::IntToWideString( cropBottom ) + wstring( _T( "f" ) ) ).c_str() );
}
break;
......@@ -122,7 +123,7 @@ namespace DocFileFormat
{
//cast to signed integer
int cropLeft = (int)iter->op;
appendValueAttribute( this->_imageData, _T( "cropleft" ), ( FormatUtils::IntToWideString( cropLeft ) + wstring( _T( "f" ) ) ).c_str() );
appendValueAttribute(m_imageData, _T( "cropleft" ), ( FormatUtils::IntToWideString( cropLeft ) + wstring( _T( "f" ) ) ).c_str());
}
break;
......@@ -130,7 +131,7 @@ namespace DocFileFormat
{
//cast to signed integer
int cropRight = (int)iter->op;
appendValueAttribute( this->_imageData, _T( "cropright" ), ( FormatUtils::IntToWideString( cropRight ) + wstring( _T( "f" ) ) ).c_str() );
appendValueAttribute(m_imageData, _T( "cropright" ), ( FormatUtils::IntToWideString( cropRight ) + wstring( _T( "f" ) ) ).c_str());
}
break;
......@@ -138,7 +139,7 @@ namespace DocFileFormat
{
//cast to signed integer
int cropTop = (int)iter->op;
appendValueAttribute( this->_imageData, _T( "croptop" ), ( FormatUtils::IntToWideString( cropTop ) + wstring( _T( "f" ) ) ).c_str() );
appendValueAttribute(m_imageData, _T( "croptop" ), ( FormatUtils::IntToWideString( cropTop ) + wstring( _T( "f" ) ) ).c_str());
}
break;
}
......@@ -147,9 +148,9 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
//v:imageData
appendValueAttribute( this->_imageData, _T( "r:id" ), ( wstring( _T( "rId" ) ) + FormatUtils::IntToWideString(m_nImageId) ).c_str() );
appendValueAttribute( this->_imageData, _T( "o:title" ) , _T( "" ) );
m_pXmlWriter->WriteString( this->_imageData->GetXMLString().c_str() );
appendValueAttribute(m_imageData, _T( "r:id" ), ( wstring( _T( "rId" ) ) + FormatUtils::IntToWideString(m_nImageId) ).c_str());
appendValueAttribute(m_imageData, _T( "o:title" ) , _T( "" ));
m_pXmlWriter->WriteString(m_imageData->GetXMLString().c_str());
//borders
writePictureBorder( _T( "bordertop" ), pict->brcTop );
......@@ -201,7 +202,7 @@ namespace DocFileFormat
decompressedSize = metaBlip->Decompress(&decompressed);
if (0 != decompressedSize && NULL != decompressed)
{
_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32), std::vector<byte>(decompressed, (decompressed + decompressedSize))));
m_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32), std::vector<byte>(decompressed, (decompressed + decompressedSize))));
RELEASEARRAYOBJECTS(decompressed);
}
}
......@@ -217,7 +218,7 @@ namespace DocFileFormat
BitmapBlip* bitBlip = static_cast<BitmapBlip*>(oBlipEntry->Blip);
if (bitBlip)
{
_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32),
m_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlipEntry->btWin32),
vector<byte>(bitBlip->m_pvBits, (bitBlip->m_pvBits + bitBlip->pvBitsSize)), oBlipEntry->btWin32));
}
}
......@@ -232,7 +233,7 @@ namespace DocFileFormat
break;
}
m_nImageId = _ctx->_docx->RegisterImage(_caller, oBlipEntry->btWin32);
m_nImageId = m_ctx->_docx->RegisterImage(m_caller, oBlipEntry->btWin32);
result = true;
}
......
......@@ -36,15 +36,13 @@ namespace DocFileFormat
static std::wstring GetContentType (Global::BlipType nType);
private:
int m_nImageId;
std::wstring m_ShapeId;
bool _olePreview;
bool _isBulletPicture;
XMLTools::XMLElement<WCHAR> *_imageData;
ConversionContext* _ctx;
IMapping* _caller;
ConversionContext* m_ctx;
IMapping* m_caller;
int m_nImageId;
std::wstring m_ShapeId;
bool m_olePreview;
bool m_isBulletPicture;
XMLTools::XMLElement<WCHAR>* m_imageData;
};
}
\ No newline at end of file
......@@ -72,25 +72,28 @@ namespace DocFileFormat
std::wstring ParsePath (const list<OptionEntry>& options) const;
void WriteBeginShapeNode (const Shape* pShape);
void WriteEndShapeNode (const Shape* pShape);
std::wstring GetShapeID (const Shape* pShape) const;
void WriteEndShapeNode (const Shape* pShape);
std::wstring GetShapeID (const Shape* pShape) const;
std::wstring GetLineFrom (const ChildAnchor* pAnchor) const;
std::wstring GetLineTo (const ChildAnchor* pAnchor) const;
std::wstring GetLineTo (const ChildAnchor* pAnchor) const;
std::vector<CString> GetTextRectangles(const OptionEntry& inscribe) const;
std::vector<CString> GetTextRectangles(const OptionEntry& inscribe) const;
private:
Spa* m_pSpa;
IMapping* m_pCaller;
BlipStoreContainer* m_pBlipStore;
int m_nImageId;
ConversionContext* _ctx;
PictureDescriptor* _pict;
XMLTools::XMLElement<WCHAR> _fill, _stroke, _shadow, _imagedata, _3dstyle, _textpath;
wstring _textPathStyle;
Spa* m_pSpa;
IMapping* m_pCaller;
BlipStoreContainer* m_pBlipStore;
int m_nImageId;
std::wstring m_textPathStyle;
ConversionContext* m_ctx;
PictureDescriptor* m_pict;
XMLTools::XMLElement<WCHAR> m_fill;
XMLTools::XMLElement<WCHAR> m_stroke;
XMLTools::XMLElement<WCHAR> m_shadow;
XMLTools::XMLElement<WCHAR> m_imagedata;
XMLTools::XMLElement<WCHAR> m_3dstyle;
XMLTools::XMLElement<WCHAR> m_textpath;
};
}
\ No newline at end of file
......@@ -162,47 +162,31 @@ public:
}
}
wstring ReadXst()
std::wstring ReadXst()
{
wstring wstrResult( _T( "" ) );
if ( this->stream != NULL )
std::wstring wstrResult( _T( "" ) );
if (stream)
{
int cchSize = 2;
byte* cch = this->ReadBytes( cchSize, true );
int xstzSize = FormatUtils::BytesToInt16( cch, 0, cchSize ) * 2;
byte* xstz = this->ReadBytes( xstzSize, true );
byte* xstz = ReadBytes(xstzSize, true);
FormatUtils::GetSTLCollectionFromBytes<wstring>( &wstrResult, xstz, xstzSize, ENCODING_UNICODE );
RELEASEARRAYOBJECTS( xstz );
RELEASEARRAYOBJECTS( cch );
RELEASEARRAYOBJECTS(xstz);
RELEASEARRAYOBJECTS(cch);
}
return wstrResult;
}
wstring ReadXstz()
{
wstring xst( _T( "" ) );
if ( this->stream != NULL )
{
xst = this->ReadXst();
//skip the termination
byte* termiantion = this->ReadBytes( 2, false );
}
return xst;
}
/// Read a length prefixed Unicode string from the given stream.
/// The string must have the following structure:
/// byte 1 - 4: Character count (cch)
/// byte 5 - (cch*2)+4: Unicode characters terminated by \0
wstring ReadLengthPrefixedUnicodeString()
std::wstring ReadLengthPrefixedUnicodeString()
{
wstring result;
......@@ -225,7 +209,7 @@ public:
/// The string must have the following structure:
/// byte 1-4: Character count (cch)
/// byte 5-cch+4: ANSI characters terminated by \0
wstring ReadLengthPrefixedAnsiString()
std::wstring ReadLengthPrefixedAnsiString()
{
wstring result;
......
......@@ -92,7 +92,7 @@ namespace OfficeArt
// ,
xfile.seekg( 0, ios_base::end );
xstr.resize( xfile.tellg() );
xstr.resize( (size_t)xfile.tellg() );
xfile.seekg( 0, ios_base::beg );
//
......@@ -197,7 +197,7 @@ namespace OfficeArt
// ,
xfile.seekg( 0, ios_base::end );
xstr.resize( xfile.tellg() );
xstr.resize( (size_t)xfile.tellg() );
xfile.seekg( 0, ios_base::beg );
//
......
......@@ -2,6 +2,8 @@
#include <math.h>
#include <vector>
#include <atlcoll.h>
#include "OfficeArt\Common.h"
#include "OfficeArt\MSOArray.h"
......
......@@ -142,14 +142,14 @@ namespace NSCommon
this->m_pPointer = new Type( value );
return *this;
}
#endif
#else
nullable<Type>& operator=(const std::wstring& cwsValue)
{
RELEASEOBJECT(this->m_pPointer);
this->m_pPointer = new Type( cwsValue.c_str() );
return *this;
}
#endif
nullable<Type>& operator=(const nullable<Type> &oOther)
{
RELEASEOBJECT(this->m_pPointer);
......
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