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
...@@ -29,18 +29,18 @@ namespace DocFileFormat ...@@ -29,18 +29,18 @@ namespace DocFileFormat
m_pCaller = pCaller; m_pCaller = pCaller;
m_pBlipStore = NULL; m_pBlipStore = NULL;
_ctx = pConv; m_ctx = pConv;
_pict = pPicture; m_pict = pPicture;
m_nImageId = 0; m_nImageId = 0;
_imagedata = XMLTools::XMLElement<WCHAR>(_T("v:imagedata")); m_imagedata = XMLTools::XMLElement<WCHAR>(_T("v:imagedata"));
_fill = XMLTools::XMLElement<WCHAR>(_T("v:fill")); m_fill = XMLTools::XMLElement<WCHAR>(_T("v:fill"));
_stroke = XMLTools::XMLElement<WCHAR>(_T("v:stroke")); m_stroke = XMLTools::XMLElement<WCHAR>(_T("v:stroke"));
_shadow = XMLTools::XMLElement<WCHAR>(_T("v:shadow")); m_shadow = XMLTools::XMLElement<WCHAR>(_T("v:shadow"));
_3dstyle = XMLTools::XMLElement<WCHAR>(_T("o:extrusion")); m_3dstyle = XMLTools::XMLElement<WCHAR>(_T("o:extrusion"));
_textpath = XMLTools::XMLElement<WCHAR>(_T("v:textpath")); m_textpath = XMLTools::XMLElement<WCHAR>(_T("v:textpath"));
Record* recBs = _ctx->_doc->GetOfficeArt()->GetDrawingGroup()->FirstChildWithType<BlipStoreContainer>(); Record* recBs = m_ctx->_doc->GetOfficeArt()->GetDrawingGroup()->FirstChildWithType<BlipStoreContainer>();
if (recBs) if (recBs)
{ {
...@@ -58,18 +58,17 @@ namespace DocFileFormat ...@@ -58,18 +58,17 @@ namespace DocFileFormat
void VMLShapeMapping::Apply(IVisitable* visited) void VMLShapeMapping::Apply(IVisitable* visited)
{ {
ShapeContainer* pContainer = static_cast<ShapeContainer*>(visited); ShapeContainer* pContainer = static_cast<ShapeContainer*>(visited);
if ((pContainer != NULL) && (!pContainer->Children.empty()))
if ((pContainer != NULL ) && (!pContainer->Children.empty()))
{ {
Record* firstRecord = pContainer->Children[0]; Record* firstRecord = pContainer->Children[0];
if (firstRecord != NULL) if (firstRecord != NULL)
{ {
if ( typeid(*firstRecord) == typeid(Shape) ) if (typeid(*firstRecord) == typeid(Shape))
{ {
// It's a single shape // It's a single shape
WriteShape(pContainer); WriteShape(pContainer);
} }
else if ( typeid(*firstRecord) == typeid(GroupShapeRecord) ) else if (typeid(*firstRecord) == typeid(GroupShapeRecord))
{ {
// Its a group of shapes // Its a group of shapes
WriteGroup(static_cast<GroupContainer*>(pContainer->_ParentRecord)); WriteGroup(static_cast<GroupContainer*>(pContainer->_ParentRecord));
...@@ -81,12 +80,12 @@ namespace DocFileFormat ...@@ -81,12 +80,12 @@ namespace DocFileFormat
/// Converts a group of shapes /// Converts a group of shapes
void VMLShapeMapping::WriteGroup (const GroupContainer* container) void VMLShapeMapping::WriteGroup (const GroupContainer* container)
{ {
if ( ( container != NULL ) && ( !container->Children.empty() ) ) if ((container != NULL) && (!container->Children.empty()))
{ {
ShapeContainer* groupShape = static_cast<ShapeContainer*>(container->Children[0]); ShapeContainer* groupShape = static_cast<ShapeContainer*>(container->Children[0]);
GroupShapeRecord* gsr = static_cast<GroupShapeRecord*>(groupShape->Children[0]); GroupShapeRecord* gsr = static_cast<GroupShapeRecord*>(groupShape->Children[0]);
Shape* shape = static_cast<Shape*>(groupShape->Children[1]); Shape* shape = static_cast<Shape*>(groupShape->Children[1]);
list<OptionEntry> options = groupShape->ExtractOptions(); std::list<OptionEntry> options = groupShape->ExtractOptions();
ChildAnchor* anchor = groupShape->FirstChildWithType<ChildAnchor>(); ChildAnchor* anchor = groupShape->FirstChildWithType<ChildAnchor>();
m_pXmlWriter->WriteNodeBegin( _T( "v:group" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "v:group" ), TRUE );
...@@ -96,8 +95,8 @@ namespace DocFileFormat ...@@ -96,8 +95,8 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute( _T( "coordsize" ), ( FormatUtils::IntToWideString(gsr->rcgBounds.size.cx) + _T( "," ) + FormatUtils::IntToWideString(gsr->rcgBounds.size.cy)).c_str() ); m_pXmlWriter->WriteAttribute( _T( "coordsize" ), ( FormatUtils::IntToWideString(gsr->rcgBounds.size.cx) + _T( "," ) + FormatUtils::IntToWideString(gsr->rcgBounds.size.cy)).c_str() );
// Write wrap coords // Write wrap coords
std::list<OptionEntry>::const_iterator end = options.end();
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != options.end(); ++iter) for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
{ {
switch (iter->pid) switch (iter->pid)
{ {
...@@ -105,30 +104,31 @@ namespace DocFileFormat ...@@ -105,30 +104,31 @@ namespace DocFileFormat
{ {
std::wstring wrapCoords = getWrapCoords(*iter); std::wstring wrapCoords = getWrapCoords(*iter);
if (wrapCoords.length()) if (wrapCoords.length())
m_pXmlWriter->WriteAttribute( _T( "wrapcoords" ), wrapCoords.c_str() ); m_pXmlWriter->WriteAttribute(_T( "wrapcoords" ), wrapCoords.c_str());
} }
break; break;
} }
} }
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd(_T( "" ), TRUE, FALSE);
// Convert the shapes/groups in the group // Convert the shapes/groups in the group
for (unsigned int i = 1; i < container->Children.size(); ++i) size_t count = container->Children.size();
for (size_t i = 1; i < count; ++i)
{ {
if (container->Children[i]) if (container->Children[i])
{ {
if ( typeid(*container->Children[i]) == typeid(ShapeContainer) ) if (typeid(*container->Children[i]) == typeid(ShapeContainer))
{ {
ShapeContainer* pChildShape = static_cast<ShapeContainer*>(container->Children[i]); ShapeContainer* pChildShape = static_cast<ShapeContainer*>(container->Children[i]);
if (pChildShape) if (pChildShape)
{ {
VMLShapeMapping vmlShapeMapping(m_pXmlWriter, m_pSpa, NULL, _ctx, m_pCaller); VMLShapeMapping vmlShapeMapping(m_pXmlWriter, m_pSpa, NULL, m_ctx, m_pCaller);
pChildShape->Convert(&vmlShapeMapping); pChildShape->Convert(&vmlShapeMapping);
} }
} }
else if ( typeid(*container->Children[i]) == typeid(GroupContainer) ) else if (typeid(*container->Children[i]) == typeid(GroupContainer))
{ {
GroupContainer* pChildGroup = static_cast<GroupContainer*>(container->Children[i]); GroupContainer* pChildGroup = static_cast<GroupContainer*>(container->Children[i]);
m_pSpa = NULL; m_pSpa = NULL;
...@@ -142,8 +142,7 @@ namespace DocFileFormat ...@@ -142,8 +142,7 @@ namespace DocFileFormat
if (m_pSpa) if (m_pSpa)
{ {
std::wstring wrap = getWrapType(m_pSpa); std::wstring wrap = getWrapType(m_pSpa);
if (wrap != _T( "through" ))
if( wrap != _T( "through" ) )
{ {
m_pXmlWriter->WriteNodeBegin( _T( "w10:wrap" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w10:wrap" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "type" ), wrap.c_str() ); m_pXmlWriter->WriteAttribute( _T( "type" ), wrap.c_str() );
...@@ -156,7 +155,7 @@ namespace DocFileFormat ...@@ -156,7 +155,7 @@ namespace DocFileFormat
} }
/// Converts a single shape /// Converts a single shape
void VMLShapeMapping::WriteShape (const ShapeContainer* pContainer) void VMLShapeMapping::WriteShape(const ShapeContainer* pContainer)
{ {
if ((NULL != pContainer) && (!pContainer->Children.empty())) if ((NULL != pContainer) && (!pContainer->Children.empty()))
{ {
...@@ -165,7 +164,7 @@ namespace DocFileFormat ...@@ -165,7 +164,7 @@ namespace DocFileFormat
{ {
bool freeform = true; bool freeform = true;
list<OptionEntry> arOptions = pContainer->ExtractOptions(); std::list<OptionEntry> options = pContainer->ExtractOptions();
ChildAnchor* pAnchor = pContainer->FirstChildWithType<ChildAnchor>(); ChildAnchor* pAnchor = pContainer->FirstChildWithType<ChildAnchor>();
ClientAnchor* clientAnchor = pContainer->FirstChildWithType<ClientAnchor>(); ClientAnchor* clientAnchor = pContainer->FirstChildWithType<ClientAnchor>();
...@@ -179,7 +178,7 @@ namespace DocFileFormat ...@@ -179,7 +178,7 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute( _T("type"), (std::wstring(_T("#")) + VMLShapeTypeMapping::GenerateTypeId(pShape->GetShapeType())).c_str()); m_pXmlWriter->WriteAttribute( _T("type"), (std::wstring(_T("#")) + VMLShapeTypeMapping::GenerateTypeId(pShape->GetShapeType())).c_str());
} }
m_pXmlWriter->WriteAttribute( _T("style"), FormatUtils::XmlEncode(buildStyle(pShape, pAnchor, arOptions, pContainer->Index)).c_str()); m_pXmlWriter->WriteAttribute( _T("style"), FormatUtils::XmlEncode(buildStyle(pShape, pAnchor, options, pContainer->Index)).c_str());
if (pShape->is<LineType>()) if (pShape->is<LineType>())
{ {
...@@ -188,37 +187,38 @@ namespace DocFileFormat ...@@ -188,37 +187,38 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute(_T("to"), GetLineTo(pAnchor).c_str()); m_pXmlWriter->WriteAttribute(_T("to"), GetLineTo(pAnchor).c_str());
} }
//temporary variables
EmuValue ShadowOffsetX; EmuValue ShadowOffsetX;
EmuValue ShadowOffsetY; EmuValue ShadowOffsetY;
EmuValue SecondShadowOffsetX; EmuValue SecondShadowOffsetX;
EmuValue SecondShadowOffsetY; EmuValue SecondShadowOffsetY;
double ShadowOriginX = 0;
double ShadowOriginY = 0;
EmuValue ViewPointX; EmuValue ViewPointX;
EmuValue ViewPointY; EmuValue ViewPointY;
EmuValue ViewPointZ; EmuValue ViewPointZ;
double viewPointOriginX = 0; double viewPointOriginX = 0;
double viewPointOriginY = 0; double viewPointOriginY = 0;
std::wstring adjValues[8]; double ShadowOriginX = 0;
double ShadowOriginY = 0;
unsigned int xCoord = 0; unsigned int xCoord = 0;
unsigned int yCoord = 0; unsigned int yCoord = 0;
bool stroked = true; bool stroked = true;
bool filled = true; bool filled = true;
bool hasTextbox = false; bool hasTextbox = false;
bool layoutInCell = false;
int ndxTextLeft = -1; int ndxTextLeft = -1;
int ndyTextTop = -1; int ndyTextTop = -1;
int ndxTextRight = -1; int ndxTextRight = -1;
int ndyTextBottom = -1; int ndyTextBottom = -1;
bool bHavePath = false; bool bHavePath = false;
int nAdjValues = 0; int nAdjValues = 0;
int nLTxID = -1; int nLTxID = -1;
std::wstring adjValues[8];
ShadowStyleBooleanProperties shadowBoolean(0); ShadowStyleBooleanProperties shadowBoolean(0);
std::vector<CString> arrInscribe; std::vector<CString> arrInscribe;
for (list<OptionEntry>::const_iterator iter = arOptions.begin(); iter != arOptions.end(); ++iter) std::list<OptionEntry>::const_iterator end = options.end();
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
{ {
switch (iter->pid) switch (iter->pid)
{ {
...@@ -226,14 +226,13 @@ namespace DocFileFormat ...@@ -226,14 +226,13 @@ namespace DocFileFormat
case geometryBooleans: case geometryBooleans:
{ {
GeometryBooleanProperties oBooleans(iter->op); GeometryBooleanProperties booleans(iter->op);
if (booleans.fUsefLineOK && !booleans.fLineOK)
if (oBooleans.fUsefLineOK && !oBooleans.fLineOK)
{ {
stroked = false; stroked = false;
} }
if (!(oBooleans.fUsefFillOK && oBooleans.fFillOK)) if (!(booleans.fUsefFillOK && booleans.fFillOK))
{ {
filled = false; filled = false;
} }
...@@ -242,9 +241,8 @@ namespace DocFileFormat ...@@ -242,9 +241,8 @@ namespace DocFileFormat
case fillStyleBooleanProperties: case fillStyleBooleanProperties:
{ {
FillStyleBooleanProperties fillBooleans( iter->op ); FillStyleBooleanProperties booleans(iter->op);
if (booleans.fUsefFilled && !booleans.fFilled)
if ( fillBooleans.fUsefFilled && !fillBooleans.fFilled )
{ {
filled = false; filled = false;
} }
...@@ -253,9 +251,8 @@ namespace DocFileFormat ...@@ -253,9 +251,8 @@ namespace DocFileFormat
case lineStyleBooleans: case lineStyleBooleans:
{ {
LineStyleBooleanProperties lineBooleans(iter->op); LineStyleBooleanProperties booleans(iter->op);
if (booleans.fUsefLine && !booleans.fLine)
if (lineBooleans.fUsefLine && !lineBooleans.fLine)
{ {
stroked = false; stroked = false;
} }
...@@ -264,13 +261,23 @@ namespace DocFileFormat ...@@ -264,13 +261,23 @@ namespace DocFileFormat
case protectionBooleans: case protectionBooleans:
{ {
ProtectionBooleanProperties protBools(iter->op); ProtectionBooleanProperties booleans(iter->op);
} }
break; break;
case diagramBooleans: case diagramBooleans:
{ {
DiagramBooleanProperties diaBools(iter->op); DiagramBooleanProperties booleans(iter->op);
}
break;
case groupShapeBooleans:
{
GroupShapeBooleanProperties booleans(iter->op);
if (booleans.fUsefLayoutInCell)
{
layoutInCell = booleans.fLayoutInCell;
}
} }
break; break;
...@@ -334,7 +341,7 @@ namespace DocFileFormat ...@@ -334,7 +341,7 @@ namespace DocFileFormat
case pWrapPolygonVertices: case pWrapPolygonVertices:
{ {
wstring wrapCoords = getWrapCoords(*iter); std::wstring wrapCoords = getWrapCoords(*iter);
if (!wrapCoords.empty()) if (!wrapCoords.empty())
{ {
...@@ -385,49 +392,49 @@ namespace DocFileFormat ...@@ -385,49 +392,49 @@ namespace DocFileFormat
case lineDashing: case lineDashing:
{ {
appendValueAttribute( &_stroke, _T( "dashstyle" ), FormatUtils::MapValueToWideString( iter->op, &Global::DashStyleMap[0][0], 11, 16 ).c_str() ); appendValueAttribute(&m_stroke, _T( "dashstyle" ), FormatUtils::MapValueToWideString( iter->op, &Global::DashStyleMap[0][0], 11, 16 ).c_str() );
} }
break; break;
case lineStyle: case lineStyle:
{ {
appendValueAttribute( &_stroke, _T( "linestyle" ), getLineStyle( iter->op ).c_str() ); appendValueAttribute(&m_stroke, _T( "linestyle" ), getLineStyle( iter->op ).c_str());
} }
break; break;
case lineEndArrowhead: case lineEndArrowhead:
{ {
appendValueAttribute( &_stroke, _T( "endarrow" ), getArrowStyle( iter->op ).c_str() ); appendValueAttribute(&m_stroke, _T( "endarrow" ), getArrowStyle( iter->op ).c_str());
} }
break; break;
case lineEndArrowLength: case lineEndArrowLength:
{ {
appendValueAttribute( &_stroke, _T( "endarrowlength" ), getArrowLength( iter->op ).c_str() ); appendValueAttribute(&m_stroke, _T( "endarrowlength" ), getArrowLength( iter->op ).c_str());
} }
break; break;
case lineEndArrowWidth: case lineEndArrowWidth:
{ {
appendValueAttribute( &_stroke, _T( "endarrowwidth" ), getArrowWidth( iter->op ).c_str() ); appendValueAttribute(&m_stroke, _T( "endarrowwidth" ), getArrowWidth( iter->op ).c_str());
} }
break; break;
case lineStartArrowhead: case lineStartArrowhead:
{ {
appendValueAttribute( &_stroke, _T( "startarrow" ), getArrowStyle( iter->op ).c_str() ); appendValueAttribute(&m_stroke, _T( "startarrow" ), getArrowStyle( iter->op ).c_str());
} }
break; break;
case lineStartArrowLength: case lineStartArrowLength:
{ {
appendValueAttribute( &_stroke, _T( "startarrowlength" ), getArrowLength( iter->op ).c_str() ); appendValueAttribute(&m_stroke, _T( "startarrowlength" ), getArrowLength( iter->op ).c_str());
} }
break; break;
case lineStartArrowWidth: case lineStartArrowWidth:
{ {
appendValueAttribute( &_stroke, _T( "startarrowwidth" ), getArrowWidth( iter->op ).c_str() ); appendValueAttribute(&m_stroke, _T( "startarrowwidth" ), getArrowWidth( iter->op ).c_str());
} }
break; break;
...@@ -435,46 +442,46 @@ namespace DocFileFormat ...@@ -435,46 +442,46 @@ namespace DocFileFormat
case fillColor: case fillColor:
{ {
RGBColor fillColor( (int)iter->op, RedFirst ); RGBColor fillColor((int)iter->op, RedFirst);
m_pXmlWriter->WriteAttribute( _T( "fillcolor" ), ( wstring( _T( "#" ) ) + fillColor.SixDigitHexCode ).c_str() ); m_pXmlWriter->WriteAttribute(_T( "fillcolor" ), ( std::wstring( _T( "#" ) ) + fillColor.SixDigitHexCode ).c_str());
} }
break; break;
case fillBackColor: case fillBackColor:
{ {
RGBColor fillBackColor( (int)iter->op, RedFirst ); RGBColor fillBackColor( (int)iter->op, RedFirst );
appendValueAttribute( &_fill, _T( "color2" ), ( wstring( _T( "#" ) ) + fillBackColor.SixDigitHexCode ).c_str() ); appendValueAttribute(&m_fill, _T( "color2" ), ( std::wstring( _T( "#" ) ) + fillBackColor.SixDigitHexCode ).c_str());
} }
break; break;
case fillAngle: case fillAngle:
{ {
FixedPointNumber fllAngl( iter->op ); FixedPointNumber fllAngl( iter->op );
appendValueAttribute( &_fill, _T( "angle" ), FormatUtils::DoubleToWideString( fllAngl.ToAngle() ).c_str() ); appendValueAttribute(&m_fill, _T( "angle" ), FormatUtils::DoubleToWideString( fllAngl.ToAngle() ).c_str());
} }
break; break;
case fillShadeType: case fillShadeType:
{ {
appendValueAttribute( &_fill, _T( "method" ), getFillMethod( iter->op ).c_str() ); appendValueAttribute(&m_fill, _T( "method" ), getFillMethod( iter->op ).c_str());
} }
break; break;
case fillShadeColors: case fillShadeColors:
{ {
appendValueAttribute( &_fill, _T( "colors" ), getFillColorString( iter->opComplex, iter->op ).c_str() ); appendValueAttribute(&m_fill, _T( "colors" ), getFillColorString( iter->opComplex, iter->op ).c_str());
} }
break; break;
case fillFocus: case fillFocus:
{ {
appendValueAttribute( &_fill, _T( "focus" ), ( FormatUtils::IntToWideString( iter->op ) + _T( "%" ) ).c_str() ); appendValueAttribute(&m_fill, _T( "focus" ), ( FormatUtils::IntToWideString( iter->op ) + _T( "%" ) ).c_str());
} }
break; break;
case fillType: case fillType:
{ {
appendValueAttribute( &_fill, _T( "type" ), getFillType( iter->op ).c_str() ); appendValueAttribute(&m_fill, _T( "type" ), getFillType( iter->op ).c_str());
} }
break; break;
...@@ -482,7 +489,7 @@ namespace DocFileFormat ...@@ -482,7 +489,7 @@ namespace DocFileFormat
{ {
BlipStoreEntry* pFillBlip = NULL; BlipStoreEntry* pFillBlip = NULL;
if ( (_pict != NULL ) && ( _pict->blipStoreEntry != NULL ) ) if ((m_pict != NULL ) && (m_pict->blipStoreEntry != NULL ))
{ {
// Word Art Texture // Word Art Texture
//fillBlip = this->_pict->BlipStoreEntry; //fillBlip = this->_pict->BlipStoreEntry;
...@@ -494,15 +501,15 @@ namespace DocFileFormat ...@@ -494,15 +501,15 @@ namespace DocFileFormat
if ( (pFillBlip != NULL) && copyPicture(pFillBlip) ) if ( (pFillBlip != NULL) && copyPicture(pFillBlip) )
{ {
appendValueAttribute( &_fill, _T( "r:id" ), ( wstring( _T( "rId" ) ) + FormatUtils::IntToWideString(m_nImageId) ).c_str() ); appendValueAttribute(&m_fill, _T( "r:id" ), ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString(m_nImageId) ).c_str());
appendValueAttribute( &_imagedata, _T( "o:title" ), _T( "" ) ); appendValueAttribute(&m_imagedata, _T( "o:title" ), _T( "" ));
} }
} }
break; break;
case fillOpacity: case fillOpacity:
{ {
appendValueAttribute( &_fill, _T( "opacity" ), ( FormatUtils::IntToWideString( iter->op ) + _T( "f" ) ).c_str() ); appendValueAttribute(&m_fill, _T( "opacity" ), ( FormatUtils::IntToWideString( iter->op ) + _T( "f" ) ).c_str());
} }
break; break;
...@@ -510,14 +517,14 @@ namespace DocFileFormat ...@@ -510,14 +517,14 @@ namespace DocFileFormat
case shadowType: case shadowType:
{ {
appendValueAttribute(&_shadow, _T("type"), getShadowType(iter->op).c_str()); appendValueAttribute(&m_shadow, _T("type"), getShadowType(iter->op).c_str());
} }
break; break;
case shadowColor: case shadowColor:
{ {
RGBColor shadowColor((int)iter->op, RedFirst); RGBColor shadowColor((int)iter->op, RedFirst);
appendValueAttribute(&_shadow, _T( "color" ), ( wstring( _T( "#" ) ) + shadowColor.SixDigitHexCode ).c_str()); appendValueAttribute(&m_shadow, _T( "color" ), ( std::wstring( _T( "#" ) ) + shadowColor.SixDigitHexCode ).c_str());
} }
break; break;
...@@ -553,15 +560,15 @@ namespace DocFileFormat ...@@ -553,15 +560,15 @@ namespace DocFileFormat
case shadowOriginY: case shadowOriginY:
{ {
ShadowOriginY = ( iter->op / pow( (double)2, (double)16 ) ); ShadowOriginY = (iter->op / pow( (double)2, (double)16));
} }
break; break;
case shadowOpacity: case shadowOpacity:
{ {
double shadowOpa = ( iter->op / pow( (double)2, (double)16 ) ); double shadowOpa = (iter->op / pow( (double)2, (double)16));
appendValueAttribute( &_shadow, _T( "opacity" ), FormatUtils::DoubleToFormattedWideString( shadowOpa, _T( "%.2f" ) ).c_str() ); appendValueAttribute(&m_shadow, _T( "opacity" ), FormatUtils::DoubleToFormattedWideString( shadowOpa, _T( "%.2f" ) ).c_str());
} }
break; break;
...@@ -580,10 +587,9 @@ namespace DocFileFormat ...@@ -580,10 +587,9 @@ namespace DocFileFormat
if ((m_pBlipStore != NULL) && (index < (int)m_pBlipStore->Children.size())) if ((m_pBlipStore != NULL) && (index < (int)m_pBlipStore->Children.size()))
{ {
BlipStoreEntry* oBlip = static_cast<BlipStoreEntry*>(m_pBlipStore->Children[index]); BlipStoreEntry* oBlip = static_cast<BlipStoreEntry*>(m_pBlipStore->Children[index]);
if (copyPicture(oBlip)) if (copyPicture(oBlip))
{ {
appendValueAttribute( &this->_imagedata, _T( "r:id" ), ( wstring( _T( "rId" ) ) + FormatUtils::IntToWideString(m_nImageId) ).c_str() ); appendValueAttribute(&m_imagedata, _T( "r:id" ), ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString(m_nImageId) ).c_str());
} }
} }
} }
...@@ -591,11 +597,9 @@ namespace DocFileFormat ...@@ -591,11 +597,9 @@ namespace DocFileFormat
case pibName: case pibName:
{ {
wstring name; std::wstring name;
FormatUtils::GetSTLCollectionFromBytes<std::wstring>(&name, iter->opComplex, iter->op, ENCODING_UNICODE);
FormatUtils::GetSTLCollectionFromBytes<wstring>( &name, iter->opComplex, iter->op, ENCODING_UNICODE ); appendValueAttribute(&m_imagedata, _T( "o:title" ), FormatUtils::XmlEncode(name).c_str());
appendValueAttribute( &this->_imagedata, _T( "o:title" ), FormatUtils::XmlEncode(name).c_str() );
} }
break; break;
...@@ -609,14 +613,14 @@ namespace DocFileFormat ...@@ -609,14 +613,14 @@ namespace DocFileFormat
case c3DExtrudeBackward: case c3DExtrudeBackward:
{ {
EmuValue backwardValue( (int)iter->op ); EmuValue backwardValue( (int)iter->op );
appendValueAttribute( &_3dstyle, _T( "backdepth" ), FormatUtils::DoubleToWideString( backwardValue.ToPoints() ).c_str() ); appendValueAttribute(&m_3dstyle, _T( "backdepth" ), FormatUtils::DoubleToWideString( backwardValue.ToPoints() ).c_str());
} }
break; break;
case c3DSkewAngle: case c3DSkewAngle:
{ {
FixedPointNumber skewAngle( iter->op ); FixedPointNumber skewAngle( iter->op );
appendValueAttribute( &_3dstyle, _T( "skewangle" ), FormatUtils::DoubleToWideString( skewAngle.ToAngle() ).c_str() ); appendValueAttribute(&m_3dstyle, _T( "skewangle" ), FormatUtils::DoubleToWideString( skewAngle.ToAngle() ).c_str());
} }
break; break;
...@@ -713,7 +717,7 @@ namespace DocFileFormat ...@@ -713,7 +717,7 @@ namespace DocFileFormat
{ {
bHavePath = true; bHavePath = true;
std::wstring path = ParsePath(arOptions); std::wstring path = ParsePath(options);
if (false == path.empty()) if (false == path.empty())
m_pXmlWriter->WriteAttribute (_T( "path" ), path.c_str()); m_pXmlWriter->WriteAttribute (_T( "path" ), path.c_str());
...@@ -724,7 +728,7 @@ namespace DocFileFormat ...@@ -724,7 +728,7 @@ namespace DocFileFormat
if (false == bHavePath) // if (false == bHavePath) //
{ {
std::wstring path = ParsePath(arOptions); std::wstring path = ParsePath(options);
if (false == path.empty()) if (false == path.empty())
m_pXmlWriter->WriteAttribute (_T( "path" ), path.c_str()); m_pXmlWriter->WriteAttribute (_T( "path" ), path.c_str());
...@@ -740,6 +744,11 @@ namespace DocFileFormat ...@@ -740,6 +744,11 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute( _T( "stroked" ), _T( "f" ) ); m_pXmlWriter->WriteAttribute( _T( "stroked" ), _T( "f" ) );
} }
if (!layoutInCell)
{
m_pXmlWriter->WriteAttribute(_T("o:allowincell"), _T("f"));
}
if ( ( xCoord > 0 ) && ( yCoord > 0 ) ) if ( ( xCoord > 0 ) && ( yCoord > 0 ) )
{ {
m_pXmlWriter->WriteAttribute( _T( "coordsize" ), ( FormatUtils::IntToWideString( xCoord ) + _T( "," ) + FormatUtils::IntToWideString( yCoord ) ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "coordsize" ), ( FormatUtils::IntToWideString( xCoord ) + _T( "," ) + FormatUtils::IntToWideString( yCoord ) ).c_str() );
...@@ -793,7 +802,7 @@ namespace DocFileFormat ...@@ -793,7 +802,7 @@ namespace DocFileFormat
if ( !offset.empty() ) if ( !offset.empty() )
{ {
appendValueAttribute( &_shadow, _T( "offset" ), offset.c_str() ); appendValueAttribute(&m_shadow, _T( "offset" ), offset.c_str());
} }
wstring offset2; wstring offset2;
...@@ -807,37 +816,37 @@ namespace DocFileFormat ...@@ -807,37 +816,37 @@ namespace DocFileFormat
if ( SecondShadowOffsetY != 0 ) if ( SecondShadowOffsetY != 0 )
{ {
offset2 += _T( "," ); offset2 += _T( "," );
offset2 += FormatUtils::DoubleToWideString( SecondShadowOffsetY.ToPoints() ); offset2 += FormatUtils::DoubleToWideString(SecondShadowOffsetY.ToPoints());
offset2 += _T( "pt" ); offset2 += _T( "pt" );
} }
if ( !offset2.empty() ) if (!offset2.empty())
{ {
appendValueAttribute( &_shadow, _T( "offset2" ), offset2.c_str() ); appendValueAttribute(&m_shadow, _T("offset2"), offset2.c_str());
} }
//build shadow origin //build shadow origin
if ( ( ShadowOriginX != 0 ) && ( ShadowOriginY != 0 ) ) if ( ( ShadowOriginX != 0 ) && ( ShadowOriginY != 0 ) )
{ {
appendValueAttribute( &_shadow, _T( "origin" ), ( FormatUtils::DoubleToWideString( shadowOriginX ) + wstring( _T( "," ) ) + FormatUtils::DoubleToWideString( shadowOriginY ) ).c_str() ); appendValueAttribute(&m_shadow, _T("origin"), (FormatUtils::DoubleToWideString(shadowOriginX) + std::wstring(_T( "," )) + FormatUtils::DoubleToWideString(shadowOriginY)).c_str());
} }
// write shadow // write shadow
if (_shadow.GetAttributeCount() > 0) if (m_shadow.GetAttributeCount() > 0)
{ {
if (shadowBoolean.fShadow) if (shadowBoolean.fShadow)
{ {
appendValueAttribute( &_shadow, _T( "on" ), _T( "t" ) ); appendValueAttribute(&m_shadow, _T( "on" ), _T( "t" ));
} }
m_pXmlWriter->WriteString( _shadow.GetXMLString().c_str() ); m_pXmlWriter->WriteString(m_shadow.GetXMLString().c_str());
} }
//write 3d style //write 3d style
if ( _3dstyle.GetAttributeCount() > 0 ) if (m_3dstyle.GetAttributeCount() > 0)
{ {
appendValueAttribute( &_3dstyle, _T( "v:ext" ), _T( "view" ) ); appendValueAttribute(&m_3dstyle, _T( "v:ext" ), _T( "view" ));
appendValueAttribute( &_3dstyle, _T( "on" ), _T( "t" ) ); appendValueAttribute(&m_3dstyle, _T( "on" ), _T( "t" ));
//write the viewpoint //write the viewpoint
if ( ( ViewPointX != 0 ) || ( ViewPointY != 0 ) || ( ViewPointZ != 0 ) ) if ( ( ViewPointX != 0 ) || ( ViewPointY != 0 ) || ( ViewPointZ != 0 ) )
...@@ -861,13 +870,13 @@ namespace DocFileFormat ...@@ -861,13 +870,13 @@ namespace DocFileFormat
viewPoint += FormatUtils::IntToWideString( ViewPointZ ); viewPoint += FormatUtils::IntToWideString( ViewPointZ );
} }
appendValueAttribute( &_3dstyle, _T( "viewpoint" ), viewPoint.c_str() ); appendValueAttribute(&m_3dstyle, _T( "viewpoint" ), viewPoint.c_str());
} }
// write the viewpointorigin // write the viewpointorigin
if ( ( viewPointOriginX != 0 ) || ( viewPointOriginY != 0 ) ) if ( ( viewPointOriginX != 0 ) || ( viewPointOriginY != 0 ) )
{ {
wstring viewPointOrigin; std::wstring viewPointOrigin;
if ( viewPointOriginX != 0 ) if ( viewPointOriginX != 0 )
{ {
...@@ -880,18 +889,18 @@ namespace DocFileFormat ...@@ -880,18 +889,18 @@ namespace DocFileFormat
viewPointOrigin += FormatUtils::DoubleToFormattedWideString( viewPointOriginY, _T( "%.2f" ) ); viewPointOrigin += FormatUtils::DoubleToFormattedWideString( viewPointOriginY, _T( "%.2f" ) );
} }
appendValueAttribute( &_3dstyle, _T( "viewpointorigin" ), viewPointOrigin.c_str() ); appendValueAttribute(&m_3dstyle, _T( "viewpointorigin" ), viewPointOrigin.c_str());
} }
m_pXmlWriter->WriteString( _3dstyle.GetXMLString().c_str() ); m_pXmlWriter->WriteString(m_3dstyle.GetXMLString().c_str());
} }
// write wrap // write wrap
if (m_pSpa) if (m_pSpa)
{ {
wstring wrap = getWrapType(m_pSpa); std::wstring wrap = getWrapType(m_pSpa);
if( wrap != _T( "through" ) ) if (wrap != _T("through"))
{ {
m_pXmlWriter->WriteNodeBegin( _T( "w10:wrap" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w10:wrap" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "type" ), wrap.c_str() ); m_pXmlWriter->WriteAttribute( _T( "type" ), wrap.c_str() );
...@@ -900,28 +909,28 @@ namespace DocFileFormat ...@@ -900,28 +909,28 @@ namespace DocFileFormat
} }
// write stroke // write stroke
if (_stroke.GetAttributeCount() > 0) if (m_stroke.GetAttributeCount())
{ {
m_pXmlWriter->WriteString(_stroke.GetXMLString().c_str()); m_pXmlWriter->WriteString(m_stroke.GetXMLString().c_str());
} }
// write fill // write fill
if (_fill.GetAttributeCount() > 0) if (m_fill.GetAttributeCount())
{ {
m_pXmlWriter->WriteString (_fill.GetXMLString().c_str()); m_pXmlWriter->WriteString(m_fill.GetXMLString().c_str());
} }
// text path // text path
if (_textpath.GetAttributeCount() > 0) if (m_textpath.GetAttributeCount())
{ {
appendValueAttribute( &_textpath, _T( "style" ), _textPathStyle.c_str() ); appendValueAttribute(&m_textpath, _T( "style" ), m_textPathStyle.c_str());
m_pXmlWriter->WriteString( _textpath.GetXMLString().c_str() ); m_pXmlWriter->WriteString(m_textpath.GetXMLString().c_str());
} }
// write imagedata // write imagedata
if (_imagedata.GetAttributeCount() > 0) if (m_imagedata.GetAttributeCount())
{ {
m_pXmlWriter->WriteString(_imagedata.GetXMLString().c_str()); m_pXmlWriter->WriteString(m_imagedata.GetXMLString().c_str());
} }
if (freeform) if (freeform)
...@@ -947,9 +956,9 @@ namespace DocFileFormat ...@@ -947,9 +956,9 @@ namespace DocFileFormat
int nIndex = pTextBox->GetIndex(); int nIndex = pTextBox->GetIndex();
if (nIndex) if (nIndex)
{ {
TextboxMapping textboxMapping(_ctx, nIndex - 1, m_pXmlWriter, m_pCaller); TextboxMapping textboxMapping(m_ctx, nIndex - 1, m_pXmlWriter, m_pCaller);
textboxMapping.SetInset(ndxTextLeft, ndyTextTop, ndxTextRight, ndyTextBottom); textboxMapping.SetInset(ndxTextLeft, ndyTextTop, ndxTextRight, ndyTextBottom);
_ctx->_doc->Convert(&textboxMapping); m_ctx->_doc->Convert(&textboxMapping);
} }
} }
else if( hasTextbox ) else if( hasTextbox )
...@@ -962,15 +971,15 @@ namespace DocFileFormat ...@@ -962,15 +971,15 @@ namespace DocFileFormat
if (-1 != nLTxID) if (-1 != nLTxID)
{ {
TextboxMapping textboxMapping(_ctx, nLTxID - 1, m_pXmlWriter, m_pCaller); TextboxMapping textboxMapping(m_ctx, nLTxID - 1, m_pXmlWriter, m_pCaller);
textboxMapping.SetInset(ndxTextLeft, ndyTextTop, ndxTextRight, ndyTextBottom); textboxMapping.SetInset(ndxTextLeft, ndyTextTop, ndxTextRight, ndyTextBottom);
_ctx->_doc->Convert(&textboxMapping); m_ctx->_doc->Convert(&textboxMapping);
} }
else else
{ {
TextboxMapping textboxMapping(_ctx, m_pXmlWriter, m_pCaller); TextboxMapping textboxMapping(m_ctx, m_pXmlWriter, m_pCaller);
textboxMapping.SetInset(ndxTextLeft, ndyTextTop, ndxTextRight, ndyTextBottom); textboxMapping.SetInset(ndxTextLeft, ndyTextTop, ndxTextRight, ndyTextBottom);
_ctx->_doc->Convert(&textboxMapping); m_ctx->_doc->Convert(&textboxMapping);
} }
} }
...@@ -1022,19 +1031,19 @@ namespace DocFileFormat ...@@ -1022,19 +1031,19 @@ namespace DocFileFormat
{ {
if (NULL != pShape) if (NULL != pShape)
{ {
if (pShape->is<OvalType>() ) if (pShape->is<OvalType>())
{ {
m_pXmlWriter->WriteNodeEnd( _T( "v:oval" ) ); m_pXmlWriter->WriteNodeEnd( _T( "v:oval" ) );
} }
else if (pShape->is<RoundedRectangleType>() ) else if (pShape->is<RoundedRectangleType>())
{ {
m_pXmlWriter->WriteNodeEnd( _T( "v:roundrect" ) ); m_pXmlWriter->WriteNodeEnd( _T( "v:roundrect" ) );
} }
else if (pShape->is<RectangleType>() ) else if (pShape->is<RectangleType>())
{ {
m_pXmlWriter->WriteNodeEnd( _T( "v:rect" ) ); m_pXmlWriter->WriteNodeEnd( _T( "v:rect" ) );
} }
else if (pShape->is<LineType>() ) else if (pShape->is<LineType>())
{ {
m_pXmlWriter->WriteNodeEnd( _T( "v:line" ) ); m_pXmlWriter->WriteNodeEnd( _T( "v:line" ) );
} }
...@@ -1112,7 +1121,6 @@ namespace DocFileFormat ...@@ -1112,7 +1121,6 @@ namespace DocFileFormat
return strXmlTo; return strXmlTo;
} }
/// Build the VML wrapcoords string for a given pWrapPolygonVertices /// Build the VML wrapcoords string for a given pWrapPolygonVertices
std::wstring VMLShapeMapping::getWrapCoords(const OptionEntry& pWrapPolygonVertices) const std::wstring VMLShapeMapping::getWrapCoords(const OptionEntry& pWrapPolygonVertices) const
{ {
...@@ -1133,9 +1141,10 @@ namespace DocFileFormat ...@@ -1133,9 +1141,10 @@ namespace DocFileFormat
arrVertices.push_back(oStream.ReadInt32()); arrVertices.push_back(oStream.ReadInt32());
} }
for (std::list<int>::const_iterator oIter = arrVertices.begin(); oIter != arrVertices.end(); ++oIter) std::list<int>::const_iterator end = arrVertices.end();
for (std::list<int>::const_iterator iter = arrVertices.begin(); iter != end; ++iter)
{ {
coords += FormatUtils::IntToWideString(*oIter); coords += FormatUtils::IntToWideString(*iter);
coords += _T( "," ); coords += _T( "," );
} }
...@@ -1154,7 +1163,7 @@ namespace DocFileFormat ...@@ -1154,7 +1163,7 @@ namespace DocFileFormat
//write the blip //write the blip
if (oBlip) if (oBlip)
{ {
VirtualStreamReader reader(_ctx->_doc->WordDocumentStream, oBlip->foDelay); VirtualStreamReader reader(m_ctx->_doc->WordDocumentStream, oBlip->foDelay);
switch (oBlip->btWin32) switch (oBlip->btWin32)
{ {
...@@ -1172,7 +1181,7 @@ namespace DocFileFormat ...@@ -1172,7 +1181,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(oBlip->btWin32), vector<byte>(decompressed, (decompressed + decompressedSize)))); m_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlip->btWin32), vector<byte>(decompressed, (decompressed + decompressedSize))));
RELEASEARRAYOBJECTS(decompressed); RELEASEARRAYOBJECTS(decompressed);
} }
...@@ -1191,7 +1200,7 @@ namespace DocFileFormat ...@@ -1191,7 +1200,7 @@ namespace DocFileFormat
BitmapBlip* bitBlip = static_cast<BitmapBlip*>(RecordFactory::ReadRecord(&reader, 0)); BitmapBlip* bitBlip = static_cast<BitmapBlip*>(RecordFactory::ReadRecord(&reader, 0));
if (bitBlip) if (bitBlip)
{ {
_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlip->btWin32), m_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlip->btWin32),
vector<byte>(bitBlip->m_pvBits, (bitBlip->m_pvBits + bitBlip->pvBitsSize)), oBlip->btWin32)); vector<byte>(bitBlip->m_pvBits, (bitBlip->m_pvBits + bitBlip->pvBitsSize)), oBlip->btWin32));
RELEASEOBJECT (bitBlip); RELEASEOBJECT (bitBlip);
} }
...@@ -1206,7 +1215,7 @@ namespace DocFileFormat ...@@ -1206,7 +1215,7 @@ namespace DocFileFormat
break; break;
} }
m_nImageId = _ctx->_docx->RegisterImage (m_pCaller, oBlip->btWin32); m_nImageId = m_ctx->_docx->RegisterImage (m_pCaller, oBlip->btWin32);
result = true; result = true;
} }
...@@ -1219,35 +1228,35 @@ namespace DocFileFormat ...@@ -1219,35 +1228,35 @@ namespace DocFileFormat
switch ( _type ) switch ( _type )
{ {
//case msoblipBMP: //case msoblipBMP:
// return wstring( _T( ".bmp" ) ); // return std::wstring( _T( ".bmp" ) );
case Global::msoblipEMF: case Global::msoblipEMF:
return wstring( _T( ".emf" ) ); return std::wstring( _T( ".emf" ) );
//case msoblipGIF: //case msoblipGIF:
// return wstring( _T( ".gif" ) ); // return std::wstring( _T( ".gif" ) );
//case msoblipICON: //case msoblipICON:
// return wstring( _T( ".ico" ) ); // return std::wstring( _T( ".ico" ) );
case Global::msoblipJPEG: case Global::msoblipJPEG:
case Global::msoblipCMYKJPEG: case Global::msoblipCMYKJPEG:
return wstring( _T( ".jpg" ) ); return std::wstring( _T( ".jpg" ) );
//case msoblipPCX: //case msoblipPCX:
// return wstring( _T( ".pcx" ) ); // return std::wstring( _T( ".pcx" ) );
case Global::msoblipPNG: case Global::msoblipPNG:
return wstring( _T( ".png" ) ); return std::wstring( _T( ".png" ) );
case Global::msoblipTIFF: case Global::msoblipTIFF:
return wstring( _T( ".tif" ) ); return std::wstring( _T( ".tif" ) );
case Global::msoblipWMF: case Global::msoblipWMF:
return wstring( _T( ".wmf" ) ); return std::wstring( _T( ".wmf" ) );
default: default:
return wstring( _T( ".png" ) ); return std::wstring( _T( ".png" ) );
} }
} }
...@@ -1270,8 +1279,8 @@ namespace DocFileFormat ...@@ -1270,8 +1279,8 @@ namespace DocFileFormat
wstring widthString = FormatUtils::DoubleToWideString( width.ToPoints() ); wstring widthString = FormatUtils::DoubleToWideString( width.ToPoints() );
wstring heightString = FormatUtils::DoubleToWideString( height.ToPoints() ); wstring heightString = FormatUtils::DoubleToWideString( height.ToPoints() );
style->operator += ( wstring( _T( "width:" ) ) + widthString + wstring( _T( "pt;" ) ) ); style->operator += ( std::wstring( _T( "width:" ) ) + widthString + std::wstring( _T( "pt;" ) ) );
style->operator += ( wstring( _T( "height:" ) ) + heightString + wstring( _T( "pt;" ) ) ); style->operator += ( std::wstring( _T( "height:" ) ) + heightString + std::wstring( _T( "pt;" ) ) );
} }
} }
...@@ -1341,7 +1350,7 @@ namespace DocFileFormat ...@@ -1341,7 +1350,7 @@ namespace DocFileFormat
} }
} }
void VMLShapeMapping::appendStyleProperty(std::wstring* b, const wstring& propName, const wstring& propValue) const void VMLShapeMapping::appendStyleProperty(std::wstring* b, const std::wstring& propName, const std::wstring& propValue) const
{ {
if ( b != NULL ) if ( b != NULL )
{ {
...@@ -1602,34 +1611,35 @@ namespace DocFileFormat ...@@ -1602,34 +1611,35 @@ namespace DocFileFormat
} }
} }
void VMLShapeMapping::AppendOptionsToStyle (std::wstring* oStyle, const list<OptionEntry>& options) const void VMLShapeMapping::AppendOptionsToStyle (std::wstring* oStyle, const std::list<OptionEntry>& options) const
{ {
for (std::list<OptionEntry>::const_iterator oIter = options.begin(); oIter != options.end(); ++oIter) std::list<OptionEntry>::const_iterator end = options.end();
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
{ {
switch (oIter->pid) switch (iter->pid)
{ {
// POSITIONING // POSITIONING
case posh: case posh:
{ {
appendStyleProperty(oStyle, _T("mso-position-horizontal"), mapHorizontalPosition((PositionHorizontal)oIter->op)); appendStyleProperty(oStyle, _T("mso-position-horizontal"), mapHorizontalPosition((PositionHorizontal)iter->op));
} }
break; break;
case posrelh: case posrelh:
{ {
appendStyleProperty(oStyle, _T("mso-position-horizontal-relative"), mapHorizontalPositionRelative((PositionHorizontalRelative)oIter->op)); appendStyleProperty(oStyle, _T("mso-position-horizontal-relative"), mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op));
} }
break; break;
case posv: case posv:
{ {
appendStyleProperty(oStyle, _T("mso-position-vertical"), mapVerticalPosition((PositionVertical)oIter->op)); appendStyleProperty(oStyle, _T("mso-position-vertical"), mapVerticalPosition((PositionVertical)iter->op));
} }
break; break;
case posrelv: case posrelv:
{ {
appendStyleProperty(oStyle, _T("mso-position-vertical-relative"), mapVerticalPositionRelative((PositionVerticalRelative)oIter->op)); appendStyleProperty(oStyle, _T("mso-position-vertical-relative"), mapVerticalPositionRelative((PositionVerticalRelative)iter->op));
} }
break; break;
...@@ -1637,7 +1647,7 @@ namespace DocFileFormat ...@@ -1637,7 +1647,7 @@ namespace DocFileFormat
case groupShapeBooleans: case groupShapeBooleans:
{ {
GroupShapeBooleanProperties groupShapeBooleans(oIter->op); GroupShapeBooleanProperties groupShapeBooleans(iter->op);
if (groupShapeBooleans.fUsefBehindDocument && groupShapeBooleans.fBehindDocument) if (groupShapeBooleans.fUsefBehindDocument && groupShapeBooleans.fBehindDocument)
{ {
...@@ -1656,7 +1666,7 @@ namespace DocFileFormat ...@@ -1656,7 +1666,7 @@ namespace DocFileFormat
case PropertyId_rotation: case PropertyId_rotation:
{ {
double dAngle = (double)((int)oIter->op) / 65535.0; double dAngle = (double)((int)iter->op) / 65535.0;
if (dAngle < -360.0) if (dAngle < -360.0)
dAngle += 360.0; dAngle += 360.0;
...@@ -1671,7 +1681,7 @@ namespace DocFileFormat ...@@ -1671,7 +1681,7 @@ namespace DocFileFormat
case anchorText: case anchorText:
{ {
appendStyleProperty(oStyle, _T("v-text-anchor"), getTextboxAnchor(oIter->op)); appendStyleProperty(oStyle, _T("v-text-anchor"), getTextboxAnchor(iter->op));
} }
break; break;
...@@ -1679,25 +1689,25 @@ namespace DocFileFormat ...@@ -1679,25 +1689,25 @@ namespace DocFileFormat
case dxWrapDistLeft: case dxWrapDistLeft:
{ {
appendStyleProperty(oStyle, _T("mso-wrap-distance-left"), (FormatUtils::DoubleToWideString(EmuValue((int)oIter->op).ToPoints()) + std::wstring(_T("pt")))); appendStyleProperty(oStyle, _T("mso-wrap-distance-left"), (FormatUtils::DoubleToWideString(EmuValue((int)iter->op).ToPoints()) + std::wstring(_T("pt"))));
} }
break; break;
case dxWrapDistRight: case dxWrapDistRight:
{ {
appendStyleProperty(oStyle, _T("mso-wrap-distance-right"), (FormatUtils::DoubleToWideString(EmuValue((int)oIter->op).ToPoints()) + std::wstring(_T("pt")))); appendStyleProperty(oStyle, _T("mso-wrap-distance-right"), (FormatUtils::DoubleToWideString(EmuValue((int)iter->op).ToPoints()) + std::wstring(_T("pt"))));
} }
break; break;
case dyWrapDistBottom: case dyWrapDistBottom:
{ {
appendStyleProperty(oStyle, _T("mso-wrap-distance-bottom"), (FormatUtils::DoubleToWideString(EmuValue((int)oIter->op).ToPoints()) + std::wstring(_T("pt")))); appendStyleProperty(oStyle, _T("mso-wrap-distance-bottom"), (FormatUtils::DoubleToWideString(EmuValue((int)iter->op).ToPoints()) + std::wstring(_T("pt"))));
} }
break; break;
case dyWrapDistTop: case dyWrapDistTop:
{ {
appendStyleProperty(oStyle, _T("mso-wrap-distance-top"), (FormatUtils::DoubleToWideString(EmuValue((int)oIter->op).ToPoints()) + std::wstring(_T("pt")))); appendStyleProperty(oStyle, _T("mso-wrap-distance-top"), (FormatUtils::DoubleToWideString(EmuValue((int)iter->op).ToPoints()) + std::wstring(_T("pt"))));
} }
break; break;
} }
...@@ -1711,14 +1721,14 @@ namespace DocFileFormat ...@@ -1711,14 +1721,14 @@ namespace DocFileFormat
// Check if some properties are set that cause the dimensions to be twisted // Check if some properties are set that cause the dimensions to be twisted
bool twistDimensions = false; bool twistDimensions = false;
std::list<OptionEntry>::const_iterator end = options.end();
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != options.end(); ++iter) for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
{ {
if (geometryTextBooleanProperties == iter->pid) if (geometryTextBooleanProperties == iter->pid)
{ {
GeometryTextBooleanProperties props(iter->op); GeometryTextBooleanProperties props(iter->op);
if(props.fUsegtextFVertical && props.gtextFVertical) if (props.fUsegtextFVertical && props.gtextFVertical)
{ {
twistDimensions = true; twistDimensions = true;
} }
...@@ -1748,16 +1758,16 @@ namespace DocFileFormat ...@@ -1748,16 +1758,16 @@ namespace DocFileFormat
//so use the FSPA to build the style //so use the FSPA to build the style
AppendDimensionToStyle(&style, m_pSpa, twistDimensions); AppendDimensionToStyle(&style, m_pSpa, twistDimensions);
} }
else if( anchor != NULL ) else if (anchor)
{ {
//the style is part of a group, //the style is part of a group,
//so use the anchor //so use the anchor
AppendDimensionToStyle(&style, anchor, twistDimensions); AppendDimensionToStyle(&style, anchor, twistDimensions);
} }
else if( _pict != NULL ) else if (m_pict)
{ {
// it is some kind of PICT shape (e.g. WordArt) // it is some kind of PICT shape (e.g. WordArt)
AppendDimensionToStyle(&style, _pict, twistDimensions); AppendDimensionToStyle(&style, m_pict, twistDimensions);
} }
} }
else else
...@@ -2175,14 +2185,15 @@ namespace DocFileFormat ...@@ -2175,14 +2185,15 @@ namespace DocFileFormat
return wrapType; return wrapType;
} }
std::wstring VMLShapeMapping::ParsePath (const list<OptionEntry>& options) const std::wstring VMLShapeMapping::ParsePath (const std::list<OptionEntry>& options) const
{ {
const byte* pVP = NULL; const byte* pVP = NULL;
unsigned int nVP = 0; unsigned int nVP = 0;
const byte* pSI = NULL; const byte* pSI = NULL;
unsigned int nSI = 0; unsigned int nSI = 0;
for (list<OptionEntry>::const_iterator iter = options.begin(); iter != options.end(); ++iter) std::list<OptionEntry>::const_iterator end = options.end();
for (std::list<OptionEntry>::const_iterator iter = options.begin(); iter != end; ++iter)
{ {
if (iter->pid == pVertices) if (iter->pid == pVertices)
{ {
......
...@@ -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