Commit 84470c55 authored by Alexey.Musinov's avatar Alexey.Musinov Committed by Alexander Trofimov
parent 23711e37
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
//1 //1
//0 //0
//0 //0
//126 //127
#define INTVER 1,0,0,126 #define INTVER 1,0,0,127
#define STRVER "1,0,0,126\0" #define STRVER "1,0,0,127\0"
...@@ -8,19 +8,13 @@ namespace DocFileFormat ...@@ -8,19 +8,13 @@ namespace DocFileFormat
class AnnotationOwnerList: public vector<wstring> class AnnotationOwnerList: public vector<wstring>
{ {
public: public:
AnnotationOwnerList( FileInformationBlock* fib, IStream* tableStream): AnnotationOwnerList(FileInformationBlock* fib, IStream* tableStream) : std::vector<wstring>()
vector<wstring>()
{ {
VirtualStreamReader tStream( tableStream, fib->m_FibWord97.fcGrpXstAtnOwners ); VirtualStreamReader reader(tableStream, fib->m_FibWord97.fcGrpXstAtnOwners);
while (reader.GetPosition() < (fib->m_FibWord97.fcGrpXstAtnOwners + fib->m_FibWord97.lcbGrpXstAtnOwners))
while ( tStream.GetPosition() < ( fib->m_FibWord97.fcGrpXstAtnOwners + fib->m_FibWord97.lcbGrpXstAtnOwners ) )
{ {
this->push_back( tStream.ReadXstz() ); push_back(reader.ReadXst());
}
} }
virtual ~AnnotationOwnerList()
{
} }
}; };
} }
\ No newline at end of file
...@@ -3,26 +3,26 @@ ...@@ -3,26 +3,26 @@
namespace DocFileFormat namespace DocFileFormat
{ {
ByteStructure* AnnotationReferenceDescriptor::ConstructObject( VirtualStreamReader* reader, int length ) ByteStructure* AnnotationReferenceDescriptor::ConstructObject(VirtualStreamReader* reader, int length)
{ {
AnnotationReferenceDescriptor *newObject = new AnnotationReferenceDescriptor(); AnnotationReferenceDescriptor *newObject = new AnnotationReferenceDescriptor();
//read the user initials (LPXCharBuffer9) //read the user initials (LPXCharBuffer9)
short cch = reader->ReadInt16(); short cch = reader->ReadInt16();
byte *chars = reader->ReadBytes( 18, true ); byte *chars = reader->ReadBytes(18, true);
FormatUtils::GetSTLCollectionFromBytes<wstring>( &(newObject->UserInitials), chars, ( cch * 2 ), ENCODING_UNICODE ); FormatUtils::GetSTLCollectionFromBytes<wstring>( &(newObject->m_UserInitials), chars, ( cch * 2 ), ENCODING_UNICODE);
newObject->AuthorIndex = reader->ReadUInt16(); newObject->m_AuthorIndex = reader->ReadUInt16();
//skip 4 bytes //skip 4 bytes
reader->ReadBytes( 4, false ); reader->ReadBytes(4, false);
newObject->BookmarkId = reader->ReadInt32(); newObject->m_BookmarkId = reader->ReadInt32();
RELEASEARRAYOBJECTS( chars ); RELEASEARRAYOBJECTS(chars);
return static_cast<ByteStructure*>( newObject ); return static_cast<ByteStructure*>(newObject);
} }
} }
\ No newline at end of file
...@@ -6,34 +6,25 @@ namespace DocFileFormat ...@@ -6,34 +6,25 @@ namespace DocFileFormat
{ {
class AnnotationReferenceDescriptor: public ByteStructure 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: public:
static const int STRUCTURE_SIZE = 30; static const int STRUCTURE_SIZE = 30;
wstring GetUserInitials() const inline std::wstring GetUserInitials() const
{ {
return UserInitials; return m_UserInitials;
} }
unsigned short GetAuthorIndex() const inline unsigned short GetAuthorIndex() const
{ {
return AuthorIndex; return m_AuthorIndex;
} }
int GetBookmarkId() const inline int GetBookmarkId() const
{ {
return BookmarkId; return m_BookmarkId;
} }
AnnotationReferenceDescriptor(): AnnotationReferenceDescriptor() : m_UserInitials( _T( "" ) ), m_AuthorIndex(0), m_BookmarkId(0)
UserInitials( _T( "" ) ), AuthorIndex(0), BookmarkId(0)
{ {
} }
...@@ -42,5 +33,14 @@ namespace DocFileFormat ...@@ -42,5 +33,14 @@ namespace DocFileFormat
} }
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length ); 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 ...@@ -73,6 +73,7 @@ namespace DocFileFormat
// 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 != this->m_sAsciiFont.find (_T("Arial")) && -1 != this->m_sEastAsiaFont.find (_T("Arial")) && -1 != this->m_shAnsiFont.find (_T("Arial")))
return false; return false;
return true; return true;
} }
...@@ -88,7 +89,8 @@ namespace DocFileFormat ...@@ -88,7 +89,8 @@ namespace DocFileFormat
// - http://bugzserver/show_bug.cgi?id=13353 TODO : // - http://bugzserver/show_bug.cgi?id=13353 TODO :
BOOL haveStyle = FALSE; 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 ) ) switch ( (int)( iter->OpCode ) )
{ {
...@@ -490,8 +492,8 @@ namespace DocFileFormat ...@@ -490,8 +492,8 @@ namespace DocFileFormat
node->AppendChild( *ele ); node->AppendChild( *ele );
} }
RELEASEOBJECT( ele ); RELEASEOBJECT(ele);
RELEASEOBJECT( val ); RELEASEOBJECT(val);
} }
} }
...@@ -544,15 +546,16 @@ namespace DocFileFormat ...@@ -544,15 +546,16 @@ namespace DocFileFormat
{ {
bool ret = false; 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]; byte ancient = grpprlIter->Arguments[0];
ret = toogleValue( ret, ancient ); ret = toogleValue(ret, ancient);
break; break;
} }
} }
...@@ -563,7 +566,7 @@ namespace DocFileFormat ...@@ -563,7 +566,7 @@ namespace DocFileFormat
/*========================================================================================================*/ /*========================================================================================================*/
bool CharacterPropertiesMapping::toogleValue( bool currentValue, byte toggle ) bool CharacterPropertiesMapping::toogleValue(bool currentValue, byte toggle)
{ {
if ( toggle == 1 ) if ( toggle == 1 )
{ {
......
...@@ -35,12 +35,12 @@ namespace DocFileFormat ...@@ -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; 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: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:author" ), m_document->AnnotationOwners->at( atrdPre10->GetAuthorIndex() ).c_str() );
m_pXmlWriter->WriteAttribute( _T( "w:initials" ), atrdPre10->GetUserInitials().c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:initials" ), atrdPre10->GetUserInitials().c_str() );
...@@ -60,31 +60,30 @@ namespace DocFileFormat ...@@ -60,31 +60,30 @@ namespace DocFileFormat
{ {
int fc = m_document->FindFileCharPos(cp); int fc = m_document->FindFileCharPos(cp);
ParagraphPropertyExceptions* papx = findValidPapx( fc ); ParagraphPropertyExceptions* papx = findValidPapx(fc);
TableInfo tai( papx ); TableInfo tai(papx);
if ( tai.fInTable ) if ( tai.fInTable )
{ {
//this PAPX is for a table //this PAPX is for a table
Table table( this, cp, ( ( tai.iTap > 0 ) ? ( 1 ) : ( 0 ) ) ); Table table(this, cp, ( ( tai.iTap > 0 ) ? ( 1 ) : ( 0 ) ));
table.Convert( this ); table.Convert(this);
cp = table.GetCPEnd(); cp = table.GetCPEnd();
} }
else else
{ {
//this PAPX is for a normal paragraph //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_pXmlWriter->WriteNodeEnd( _T( "w:comments" ) );
m_context->_docx->CommentsXML = std::wstring(m_pXmlWriter->GetXmlString());
m_context->_docx->CommentsXML = wstring( m_pXmlWriter->GetXmlString() );
} }
} }
}; };
......
...@@ -18,13 +18,15 @@ namespace DocFileFormat ...@@ -18,13 +18,15 @@ namespace DocFileFormat
unsigned short nElemsAlloc = FormatUtils::BytesToUInt16(pSegmentInfo, 2, pSegmentInfoSize); unsigned short nElemsAlloc = FormatUtils::BytesToUInt16(pSegmentInfo, 2, pSegmentInfoSize);
unsigned short cb = FormatUtils::BytesToUInt16(pSegmentInfo, 4, 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; cb = 2;
offset = 0; offset = 0;
nElems = pSegmentInfoSize / 2; 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)); PathSegment oSegment = PathSegment(FormatUtils::BytesToUInt16(pSegmentInfo + offset, (i * cb), pSegmentInfoSize));
m_arSegments.push_back (oSegment); m_arSegments.push_back (oSegment);
...@@ -43,7 +45,7 @@ namespace DocFileFormat ...@@ -43,7 +45,7 @@ namespace DocFileFormat
{ {
cb = 4; 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)); PathSegment oSegment = PathSegment(FormatUtils::BytesToUInt16(pSegmentInfo + offset, (i * cb), pSegmentInfoSize));
m_arSegments.push_back (oSegment); m_arSegments.push_back (oSegment);
...@@ -54,7 +56,7 @@ namespace DocFileFormat ...@@ -54,7 +56,7 @@ namespace DocFileFormat
if ((2 != cb) && (1 != cb)) if ((2 != cb) && (1 != cb))
cb = 8; 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)); PathSegment oSegment = PathSegment(FormatUtils::BytesToInt32(pSegmentInfo + offset, (i * cb), pSegmentInfoSize));
m_arSegments.push_back (oSegment); m_arSegments.push_back (oSegment);
...@@ -76,7 +78,7 @@ namespace DocFileFormat ...@@ -76,7 +78,7 @@ namespace DocFileFormat
{ {
cb = 4; cb = 4;
for (unsigned int i = 0; i < nElems; ++i) for (unsigned short i = 0; i < nElems; ++i)
{ {
POINT point; POINT point;
...@@ -88,7 +90,7 @@ namespace DocFileFormat ...@@ -88,7 +90,7 @@ namespace DocFileFormat
} }
else else
{ {
for (unsigned int i = 0; i < nElems; ++i) for (unsigned short i = 0; i < nElems; ++i)
{ {
POINT point; POINT point;
...@@ -126,7 +128,9 @@ namespace DocFileFormat ...@@ -126,7 +128,9 @@ namespace DocFileFormat
return strVmlPath; 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 try
{ {
...@@ -134,7 +138,7 @@ namespace DocFileFormat ...@@ -134,7 +138,7 @@ namespace DocFileFormat
{ {
case PathSegment::msopathLineTo: 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()) if (valuePointer >= (int)m_arPoints.size())
{ {
...@@ -164,7 +168,7 @@ namespace DocFileFormat ...@@ -164,7 +168,7 @@ namespace DocFileFormat
case PathSegment::msopathCurveTo: case PathSegment::msopathCurveTo:
{ {
for ( int i = 0; i < iter->Count; ++i) for (int i = 0; i < iter->Count; ++i)
{ {
strVmlPath += _T( "c" ); strVmlPath += _T( "c" );
strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x ); strVmlPath += FormatUtils::IntToWideString(m_arPoints[valuePointer].x );
......
...@@ -87,20 +87,21 @@ namespace DocFileFormat ...@@ -87,20 +87,21 @@ namespace DocFileFormat
RELEASEOBJECT( rPr ); 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 ) switch ( iter->OpCode )
{ {
case sprmPIpgp: 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; break;
//element flags //element flags
case sprmPFAutoSpaceDE: case sprmPFAutoSpaceDE:
{ {
appendFlagElement( _pPr, *iter, _T( "autoSpaceDE" ), true ); appendFlagElement(_pPr, *iter, _T( "autoSpaceDE" ), true);
} }
break; break;
......
...@@ -43,17 +43,21 @@ namespace DocFileFormat ...@@ -43,17 +43,21 @@ namespace DocFileFormat
TablePropertyExceptions* tapx = static_cast<TablePropertyExceptions*>(visited); TablePropertyExceptions* tapx = static_cast<TablePropertyExceptions*>(visited);
int nComputedCellWidth = 0; 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) 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->_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 ); 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 ...@@ -78,7 +82,8 @@ namespace DocFileFormat
appendValueElement( _tcPr, _T( "noWrap" ), _T( "" ), true ); 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 //borders
if (!IsTableBordersDefined(tapx->grpprl)) if (!IsTableBordersDefined(tapx->grpprl))
...@@ -336,7 +341,7 @@ namespace DocFileFormat ...@@ -336,7 +341,7 @@ namespace DocFileFormat
appendShading (_tcPr, shd); appendShading (_tcPr, shd);
} }
RELEASEARRAYOBJECTS( shdBytes ); RELEASEARRAYOBJECTS(shdBytes);
} }
} }
} }
...@@ -345,7 +350,8 @@ namespace DocFileFormat ...@@ -345,7 +350,8 @@ namespace DocFileFormat
{ {
if (grpprl) 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)) if ((iter->OpCode == sprmTTableBorders) || (iter->OpCode == sprmTTableBorders80) || (iter->OpCode == sprmTSetBrc))
return true; return true;
...@@ -359,7 +365,8 @@ namespace DocFileFormat ...@@ -359,7 +365,8 @@ namespace DocFileFormat
{ {
if (grpprl) 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 ) if ( iter->OpCode == sprmTCellWidth )
{ {
......
...@@ -7,14 +7,14 @@ namespace DocFileFormat ...@@ -7,14 +7,14 @@ namespace DocFileFormat
{ {
VMLPictureMapping::VMLPictureMapping(ConversionContext* ctx, XmlUtils::CXmlWriter* writer, bool olePreview, IMapping* caller, bool isBulletPicture) : PropertiesMapping(writer) VMLPictureMapping::VMLPictureMapping(ConversionContext* ctx, XmlUtils::CXmlWriter* writer, bool olePreview, IMapping* caller, bool isBulletPicture) : PropertiesMapping(writer)
{ {
_ctx = ctx; m_ctx = ctx;
_olePreview = olePreview; m_olePreview = olePreview;
_imageData = NULL; m_imageData = NULL;
m_nImageId = 0; m_nImageId = 0;
_caller = caller; m_caller = caller;
_isBulletPicture = isBulletPicture; m_isBulletPicture = isBulletPicture;
_imageData = new XMLTools::XMLElement<WCHAR>( _T( "v:imagedata" ) ); m_imageData = new XMLTools::XMLElement<WCHAR>( _T( "v:imagedata" ) );
GUID guid = GUID_NULL; GUID guid = GUID_NULL;
LPOLESTR guidString = NULL; LPOLESTR guidString = NULL;
...@@ -27,7 +27,7 @@ namespace DocFileFormat ...@@ -27,7 +27,7 @@ namespace DocFileFormat
VMLPictureMapping::~VMLPictureMapping() VMLPictureMapping::~VMLPictureMapping()
{ {
RELEASEOBJECT (_imageData); RELEASEOBJECT(m_imageData);
} }
} }
...@@ -44,7 +44,7 @@ namespace DocFileFormat ...@@ -44,7 +44,7 @@ namespace DocFileFormat
//v:shapetype //v:shapetype
PictureFrameType type; PictureFrameType type;
VMLShapeTypeMapping* vmlShapeTypeMapping = new VMLShapeTypeMapping( m_pXmlWriter, this->_isBulletPicture ); VMLShapeTypeMapping* vmlShapeTypeMapping = new VMLShapeTypeMapping( m_pXmlWriter, m_isBulletPicture );
type.Convert( vmlShapeTypeMapping ); type.Convert( vmlShapeTypeMapping );
RELEASEOBJECT( vmlShapeTypeMapping ); RELEASEOBJECT( vmlShapeTypeMapping );
...@@ -69,12 +69,13 @@ namespace DocFileFormat ...@@ -69,12 +69,13 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute( _T( "id" ), m_ShapeId.c_str() ); m_pXmlWriter->WriteAttribute( _T( "id" ), m_ShapeId.c_str() );
if ( this->_olePreview ) if (m_olePreview)
{ {
m_pXmlWriter->WriteAttribute( _T( "o:ole" ), _T( "" ) ); 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 ) switch ( iter->pid )
{ {
...@@ -114,7 +115,7 @@ namespace DocFileFormat ...@@ -114,7 +115,7 @@ namespace DocFileFormat
{ {
//cast to signed integer //cast to signed integer
int cropBottom = (int)iter->op; 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; break;
...@@ -122,7 +123,7 @@ namespace DocFileFormat ...@@ -122,7 +123,7 @@ namespace DocFileFormat
{ {
//cast to signed integer //cast to signed integer
int cropLeft = (int)iter->op; 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; break;
...@@ -130,7 +131,7 @@ namespace DocFileFormat ...@@ -130,7 +131,7 @@ namespace DocFileFormat
{ {
//cast to signed integer //cast to signed integer
int cropRight = (int)iter->op; 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; break;
...@@ -138,7 +139,7 @@ namespace DocFileFormat ...@@ -138,7 +139,7 @@ namespace DocFileFormat
{ {
//cast to signed integer //cast to signed integer
int cropTop = (int)iter->op; 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; break;
} }
...@@ -147,9 +148,9 @@ namespace DocFileFormat ...@@ -147,9 +148,9 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
//v:imageData //v:imageData
appendValueAttribute( this->_imageData, _T( "r:id" ), ( wstring( _T( "rId" ) ) + FormatUtils::IntToWideString(m_nImageId) ).c_str() ); appendValueAttribute(m_imageData, _T( "r:id" ), ( wstring( _T( "rId" ) ) + FormatUtils::IntToWideString(m_nImageId) ).c_str());
appendValueAttribute( this->_imageData, _T( "o:title" ) , _T( "" ) ); appendValueAttribute(m_imageData, _T( "o:title" ) , _T( "" ));
m_pXmlWriter->WriteString( this->_imageData->GetXMLString().c_str() ); m_pXmlWriter->WriteString(m_imageData->GetXMLString().c_str());
//borders //borders
writePictureBorder( _T( "bordertop" ), pict->brcTop ); writePictureBorder( _T( "bordertop" ), pict->brcTop );
...@@ -201,7 +202,7 @@ namespace DocFileFormat ...@@ -201,7 +202,7 @@ namespace DocFileFormat
decompressedSize = metaBlip->Decompress(&decompressed); decompressedSize = metaBlip->Decompress(&decompressed);
if (0 != decompressedSize && NULL != 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); RELEASEARRAYOBJECTS(decompressed);
} }
} }
...@@ -217,7 +218,7 @@ namespace DocFileFormat ...@@ -217,7 +218,7 @@ namespace DocFileFormat
BitmapBlip* bitBlip = static_cast<BitmapBlip*>(oBlipEntry->Blip); BitmapBlip* bitBlip = static_cast<BitmapBlip*>(oBlipEntry->Blip);
if (bitBlip) 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)); vector<byte>(bitBlip->m_pvBits, (bitBlip->m_pvBits + bitBlip->pvBitsSize)), oBlipEntry->btWin32));
} }
} }
...@@ -232,7 +233,7 @@ namespace DocFileFormat ...@@ -232,7 +233,7 @@ namespace DocFileFormat
break; break;
} }
m_nImageId = _ctx->_docx->RegisterImage(_caller, oBlipEntry->btWin32); m_nImageId = m_ctx->_docx->RegisterImage(m_caller, oBlipEntry->btWin32);
result = true; result = true;
} }
......
...@@ -37,14 +37,12 @@ namespace DocFileFormat ...@@ -37,14 +37,12 @@ namespace DocFileFormat
private: private:
ConversionContext* m_ctx;
IMapping* m_caller;
int m_nImageId; int m_nImageId;
std::wstring m_ShapeId; std::wstring m_ShapeId;
bool m_olePreview;
bool _olePreview; bool m_isBulletPicture;
bool _isBulletPicture; XMLTools::XMLElement<WCHAR>* m_imageData;
XMLTools::XMLElement<WCHAR> *_imageData;
ConversionContext* _ctx;
IMapping* _caller;
}; };
} }
\ No newline at end of file
...@@ -84,13 +84,16 @@ namespace DocFileFormat ...@@ -84,13 +84,16 @@ namespace DocFileFormat
Spa* m_pSpa; Spa* m_pSpa;
IMapping* m_pCaller; IMapping* m_pCaller;
BlipStoreContainer* m_pBlipStore; BlipStoreContainer* m_pBlipStore;
int m_nImageId; int m_nImageId;
std::wstring m_textPathStyle;
ConversionContext* _ctx; ConversionContext* m_ctx;
PictureDescriptor* _pict; PictureDescriptor* m_pict;
XMLTools::XMLElement<WCHAR> _fill, _stroke, _shadow, _imagedata, _3dstyle, _textpath; XMLTools::XMLElement<WCHAR> m_fill;
wstring _textPathStyle; 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: ...@@ -162,47 +162,31 @@ public:
} }
} }
wstring ReadXst() std::wstring ReadXst()
{ {
wstring wstrResult( _T( "" ) ); std::wstring wstrResult( _T( "" ) );
if (stream)
if ( this->stream != NULL )
{ {
int cchSize = 2; int cchSize = 2;
byte* cch = this->ReadBytes( cchSize, true ); byte* cch = this->ReadBytes( cchSize, true );
int xstzSize = FormatUtils::BytesToInt16( cch, 0, cchSize ) * 2; 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 ); FormatUtils::GetSTLCollectionFromBytes<wstring>( &wstrResult, xstz, xstzSize, ENCODING_UNICODE );
RELEASEARRAYOBJECTS( xstz ); RELEASEARRAYOBJECTS(xstz);
RELEASEARRAYOBJECTS( cch ); RELEASEARRAYOBJECTS(cch);
} }
return wstrResult; 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. /// Read a length prefixed Unicode string from the given stream.
/// The string must have the following structure: /// The string must have the following structure:
/// byte 1 - 4: Character count (cch) /// byte 1 - 4: Character count (cch)
/// byte 5 - (cch*2)+4: Unicode characters terminated by \0 /// byte 5 - (cch*2)+4: Unicode characters terminated by \0
wstring ReadLengthPrefixedUnicodeString() std::wstring ReadLengthPrefixedUnicodeString()
{ {
wstring result; wstring result;
...@@ -225,7 +209,7 @@ public: ...@@ -225,7 +209,7 @@ public:
/// The string must have the following structure: /// The string must have the following structure:
/// byte 1-4: Character count (cch) /// byte 1-4: Character count (cch)
/// byte 5-cch+4: ANSI characters terminated by \0 /// byte 5-cch+4: ANSI characters terminated by \0
wstring ReadLengthPrefixedAnsiString() std::wstring ReadLengthPrefixedAnsiString()
{ {
wstring result; wstring result;
......
...@@ -92,7 +92,7 @@ namespace OfficeArt ...@@ -92,7 +92,7 @@ namespace OfficeArt
// , // ,
xfile.seekg( 0, ios_base::end ); xfile.seekg( 0, ios_base::end );
xstr.resize( xfile.tellg() ); xstr.resize( (size_t)xfile.tellg() );
xfile.seekg( 0, ios_base::beg ); xfile.seekg( 0, ios_base::beg );
// //
...@@ -197,7 +197,7 @@ namespace OfficeArt ...@@ -197,7 +197,7 @@ namespace OfficeArt
// , // ,
xfile.seekg( 0, ios_base::end ); xfile.seekg( 0, ios_base::end );
xstr.resize( xfile.tellg() ); xstr.resize( (size_t)xfile.tellg() );
xfile.seekg( 0, ios_base::beg ); xfile.seekg( 0, ios_base::beg );
// //
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
#include <math.h> #include <math.h>
#include <vector>
#include <atlcoll.h>
#include "OfficeArt\Common.h" #include "OfficeArt\Common.h"
#include "OfficeArt\MSOArray.h" #include "OfficeArt\MSOArray.h"
......
...@@ -142,14 +142,14 @@ namespace NSCommon ...@@ -142,14 +142,14 @@ namespace NSCommon
this->m_pPointer = new Type( value ); this->m_pPointer = new Type( value );
return *this; return *this;
} }
#endif #else
nullable<Type>& operator=(const std::wstring& cwsValue) nullable<Type>& operator=(const std::wstring& cwsValue)
{ {
RELEASEOBJECT(this->m_pPointer); RELEASEOBJECT(this->m_pPointer);
this->m_pPointer = new Type( cwsValue.c_str() ); this->m_pPointer = new Type( cwsValue.c_str() );
return *this; return *this;
} }
#endif
nullable<Type>& operator=(const nullable<Type> &oOther) nullable<Type>& operator=(const nullable<Type> &oOther)
{ {
RELEASEOBJECT(this->m_pPointer); 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