Commit bb6e95ce authored by ElenaSubbotina's avatar ElenaSubbotina

DocFormatReader - refactoring + fix errors

parent 69d98238
...@@ -125,7 +125,7 @@ namespace DocFormatUtils ...@@ -125,7 +125,7 @@ namespace DocFormatUtils
if(bDeleteNoUnicode) if(bDeleteNoUnicode)
{ {
for(size_t pos = 0; pos != data.size(); ++pos) for(size_t pos = 0; pos < data.size(); ++pos)
{ {
switch(data[pos]) switch(data[pos])
{ {
...@@ -157,7 +157,7 @@ namespace DocFormatUtils ...@@ -157,7 +157,7 @@ namespace DocFormatUtils
} }
else else
{ {
for(size_t pos = 0; pos != data.size(); ++pos) for(size_t pos = 0; pos < data.size(); ++pos)
{ {
switch(data[pos]) switch(data[pos])
{ {
...@@ -166,6 +166,8 @@ namespace DocFormatUtils ...@@ -166,6 +166,8 @@ namespace DocFormatUtils
case '\'': buffer.append(L"&apos;"); break; case '\'': buffer.append(L"&apos;"); break;
case '<': buffer.append(L"&lt;"); break; case '<': buffer.append(L"&lt;"); break;
case '>': buffer.append(L"&gt;"); break; case '>': buffer.append(L"&gt;"); break;
case '\0':
return buffer;
default: buffer.append(&data[pos], 1); break; default: buffer.append(&data[pos], 1); break;
} }
} }
......
...@@ -85,7 +85,7 @@ namespace DocFileFormat ...@@ -85,7 +85,7 @@ namespace DocFileFormat
if (author_str) if (author_str)
{ {
XMLTools::XMLAttribute author( _T( "w:author" ), FormatUtils::XmlEncode(*author_str).c_str()); XMLTools::XMLAttribute author( _T( "w:author" ), FormatUtils::XmlEncode(*author_str));
rPrChange.AppendAttribute( author ); rPrChange.AppendAttribute( author );
} }
...@@ -98,7 +98,7 @@ namespace DocFileFormat ...@@ -98,7 +98,7 @@ namespace DocFileFormat
//write properties //write properties
if ( ( m_pXmlWriter != NULL ) && ( ( _rPr->GetChildCount() > 0 ) || ( _rPr->GetAttributeCount() > 0 ) ) ) if ( ( m_pXmlWriter != NULL ) && ( ( _rPr->GetChildCount() > 0 ) || ( _rPr->GetAttributeCount() > 0 ) ) )
{ {
m_pXmlWriter->WriteString( _rPr->GetXMLString().c_str() ); m_pXmlWriter->WriteString( _rPr->GetXMLString());
} }
} }
...@@ -144,7 +144,7 @@ namespace DocFileFormat ...@@ -144,7 +144,7 @@ namespace DocFileFormat
_currentIstd = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize ); _currentIstd = FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize );
if (_currentIstd < _doc->Styles->Styles->size()) if (_currentIstd < _doc->Styles->Styles->size())
{ {
appendValueElement( parent, _T( "rStyle" ), StyleSheetMapping::MakeStyleId( _doc->Styles->Styles->at( _currentIstd ) ).c_str(), true ); appendValueElement( parent, _T( "rStyle" ), StyleSheetMapping::MakeStyleId( _doc->Styles->Styles->at( _currentIstd ) ), true );
} }
} }
}break; }break;
...@@ -232,7 +232,7 @@ namespace DocFileFormat ...@@ -232,7 +232,7 @@ namespace DocFileFormat
case sprmOldCIss: case sprmOldCIss:
case sprmCIss: case sprmCIss:
appendValueElement( parent, _T( "vertAlign" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &SuperscriptIndex[0][0], 3, 12 ).c_str(), true ); appendValueElement( parent, _T( "vertAlign" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &SuperscriptIndex[0][0], 3, 12 ), true );
break; break;
case sprmCRgLid0_80: case sprmCRgLid0_80:
...@@ -292,7 +292,7 @@ namespace DocFileFormat ...@@ -292,7 +292,7 @@ namespace DocFileFormat
case sprmCIco: case sprmCIco:
case sprmCIcoBi: case sprmCIcoBi:
{//color {//color
colorVal->SetValue( FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorIdentifier[0][0], 17, 12 ).c_str() ); colorVal->SetValue( FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorIdentifier[0][0], 17, 12 ));
}break; }break;
case sprmCCv: case sprmCCv:
...@@ -305,17 +305,17 @@ namespace DocFileFormat ...@@ -305,17 +305,17 @@ namespace DocFileFormat
case sprmCOldHighlight: case sprmCOldHighlight:
{ {
appendValueElement( parent, _T( "highlight" ), FormatUtils::MapValueToWideString( iter->Arguments[1], &Global::ColorIdentifier[0][0], 17, 12 ).c_str(), true ); appendValueElement( parent, _T( "highlight" ), FormatUtils::MapValueToWideString( iter->Arguments[1], &Global::ColorIdentifier[0][0], 17, 12 ), true );
}break; }break;
case sprmCHighlight: case sprmCHighlight:
{ {
appendValueElement( parent, _T( "highlight" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorIdentifier[0][0], 17, 12 ).c_str(), true ); appendValueElement( parent, _T( "highlight" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::ColorIdentifier[0][0], 17, 12 ), true );
}break; }break;
case sprmOldCDxaSpace: case sprmOldCDxaSpace:
case sprmCDxaSpace: case sprmCDxaSpace:
{ {
appendValueElement( parent, _T( "spacing" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true ); appendValueElement( parent, _T( "spacing" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
}break; }break;
case sprmCFtcBi : case sprmCFtcBi :
...@@ -332,20 +332,20 @@ namespace DocFileFormat ...@@ -332,20 +332,20 @@ namespace DocFileFormat
case sprmCHpsBi : case sprmCHpsBi :
{ {
appendValueElement( parent, _T( "szCs" ), appendValueElement( parent, _T( "szCs" ),
FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true ); FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
} }
break; break;
// Font Size in points (2~3276) default 20-half-points // Font Size in points (2~3276) default 20-half-points
case sprmOldCHps : case sprmOldCHps :
{ {
appendValueElement (parent, _T( "sz" ), appendValueElement (parent, _T( "sz" ),
FormatUtils::IntToWideString (FormatUtils::BytesToUChar (iter->Arguments, 0, iter->argumentsSize) ).c_str(), FormatUtils::IntToWideString (FormatUtils::BytesToUChar (iter->Arguments, 0, iter->argumentsSize) ),
true ); true );
}break; }break;
case sprmCHps : case sprmCHps :
{ {
appendValueElement (parent, _T( "sz" ), appendValueElement (parent, _T( "sz" ),
FormatUtils::IntToWideString (FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize) ).c_str(), true ); FormatUtils::IntToWideString (FormatUtils::BytesToUInt16 (iter->Arguments, 0, iter->argumentsSize) ), true );
}break; }break;
case sprmCMajority : case sprmCMajority :
...@@ -366,7 +366,7 @@ namespace DocFileFormat ...@@ -366,7 +366,7 @@ namespace DocFileFormat
case sprmOldCHpsKern: case sprmOldCHpsKern:
case sprmCHpsKern: case sprmCHpsKern:
{ {
appendValueElement( parent, _T( "kern" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true ); appendValueElement( parent, _T( "kern" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
}break; }break;
case sprmOldCFtc: case sprmOldCFtc:
...@@ -379,7 +379,7 @@ namespace DocFileFormat ...@@ -379,7 +379,7 @@ namespace DocFileFormat
XMLTools::XMLAttribute* ascii = new XMLTools::XMLAttribute( _T( "w:ascii" ) ); XMLTools::XMLAttribute* ascii = new XMLTools::XMLAttribute( _T( "w:ascii" ) );
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) ); FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
m_sAsciiFont = ffn->xszFtn; m_sAsciiFont = ffn->xszFtn;
ascii->SetValue( FormatUtils::XmlEncode(m_sAsciiFont).c_str() ); ascii->SetValue( FormatUtils::XmlEncode(m_sAsciiFont, true));
rFonts->AppendAttribute( *ascii ); rFonts->AppendAttribute( *ascii );
RELEASEOBJECT( ascii ); RELEASEOBJECT( ascii );
} }
...@@ -393,7 +393,7 @@ namespace DocFileFormat ...@@ -393,7 +393,7 @@ namespace DocFileFormat
XMLTools::XMLAttribute* eastAsia = new XMLTools::XMLAttribute( _T( "w:eastAsia" ) ); XMLTools::XMLAttribute* eastAsia = new XMLTools::XMLAttribute( _T( "w:eastAsia" ) );
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) ); FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
m_sEastAsiaFont = ffn->xszFtn; m_sEastAsiaFont = ffn->xszFtn;
eastAsia->SetValue( FormatUtils::XmlEncode(m_sEastAsiaFont).c_str() ); eastAsia->SetValue( FormatUtils::XmlEncode(m_sEastAsiaFont));
rFonts->AppendAttribute( *eastAsia ); rFonts->AppendAttribute( *eastAsia );
RELEASEOBJECT( eastAsia ); RELEASEOBJECT( eastAsia );
} }
...@@ -408,7 +408,7 @@ namespace DocFileFormat ...@@ -408,7 +408,7 @@ namespace DocFileFormat
XMLTools::XMLAttribute* ansi = new XMLTools::XMLAttribute( _T( "w:hAnsi" ) ); XMLTools::XMLAttribute* ansi = new XMLTools::XMLAttribute( _T( "w:hAnsi" ) );
FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) ); FontFamilyName* ffn = static_cast<FontFamilyName*>( _doc->FontTable->operator [] ( nIndex ) );
m_shAnsiFont = ffn->xszFtn; m_shAnsiFont = ffn->xszFtn;
ansi->SetValue( FormatUtils::XmlEncode(m_shAnsiFont).c_str() ); ansi->SetValue( FormatUtils::XmlEncode(m_shAnsiFont));
rFonts->AppendAttribute( *ansi ); rFonts->AppendAttribute( *ansi );
RELEASEOBJECT( ansi ); RELEASEOBJECT( ansi );
} }
...@@ -417,18 +417,18 @@ namespace DocFileFormat ...@@ -417,18 +417,18 @@ namespace DocFileFormat
case sprmOldCKul: case sprmOldCKul:
case sprmCKul: case sprmCKul:
{ //Underlining { //Underlining
appendValueElement( parent, _T( "u" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::UnderlineCode[0][0], 56, 16 ).c_str(), true ); appendValueElement( parent, _T( "u" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::UnderlineCode[0][0], 56, 16 ), true );
} }
break; break;
case sprmCCharScale: case sprmCCharScale:
{ //char width { //char width
appendValueElement( parent, _T( "w" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true ); appendValueElement( parent, _T( "w" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
}break; }break;
case sprmCSfxText: case sprmCSfxText:
{ //animation { //animation
appendValueElement( parent, _T( "effect" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::TextAnimation[0][0], 7, 16 ).c_str(), true ); appendValueElement( parent, _T( "effect" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::TextAnimation[0][0], 7, 16 ), true );
}break; }break;
case sprmCIdctHint: case sprmCIdctHint:
...@@ -483,7 +483,7 @@ namespace DocFileFormat ...@@ -483,7 +483,7 @@ namespace DocFileFormat
if (!m_sDefaultFont.empty() && m_sAsciiFont.empty() && m_sEastAsiaFont.empty() && m_shAnsiFont.empty()) if (!m_sDefaultFont.empty() && m_sAsciiFont.empty() && m_sEastAsiaFont.empty() && m_shAnsiFont.empty())
{//???? {//????
XMLTools::XMLAttribute* ascii = new XMLTools::XMLAttribute( _T( "w:ascii" ) ); XMLTools::XMLAttribute* ascii = new XMLTools::XMLAttribute( _T( "w:ascii" ) );
ascii->SetValue( FormatUtils::XmlEncode(m_sDefaultFont).c_str() ); ascii->SetValue( FormatUtils::XmlEncode(m_sDefaultFont));
//rFonts->AppendAttribute( *ascii ); //rFonts->AppendAttribute( *ascii );
RELEASEOBJECT( ascii ); RELEASEOBJECT( ascii );
} }
......
...@@ -73,10 +73,10 @@ namespace DocFileFormat ...@@ -73,10 +73,10 @@ namespace DocFileFormat
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->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 ));
m_pXmlWriter->WriteAttribute( _T( "w:author" ), m_pXmlWriter->WriteAttribute( _T( "w:author" ),
FormatUtils::XmlEncode(m_document->AnnotationOwners->at( atrdPre10->GetAuthorIndex() ) ).c_str()); FormatUtils::XmlEncode(m_document->AnnotationOwners->at( atrdPre10->GetAuthorIndex() ) ));
m_pXmlWriter->WriteAttribute( _T( "w:initials" ), atrdPre10->GetUserInitials().c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:initials" ), atrdPre10->GetUserInitials());
//!!!TODO!!! //!!!TODO!!!
/*//ATRDpost10 is optional and not saved in all files /*//ATRDpost10 is optional and not saved in all files
......
...@@ -346,7 +346,7 @@ namespace DocFileFormat ...@@ -346,7 +346,7 @@ namespace DocFileFormat
{ {
std::wstring id = FormatUtils::IntToFormattedWideString(FormatUtils::BytesToInt32(iter->Arguments, 0, iter->argumentsSize), _T("%08x")); std::wstring id = FormatUtils::IntToFormattedWideString(FormatUtils::BytesToInt32(iter->Arguments, 0, iter->argumentsSize), _T("%08x"));
m_context->AddRsid(id); m_context->AddRsid(id);
m_pXmlWriter->WriteAttribute(_T("w:rsidP"), id.c_str()); m_pXmlWriter->WriteAttribute(_T("w:rsidP"), id);
break; break;
} }
...@@ -380,7 +380,7 @@ namespace DocFileFormat ...@@ -380,7 +380,7 @@ namespace DocFileFormat
WideString* author = dynamic_cast<WideString*>(m_document->RevisionAuthorTable->operator[](rev.Isbt)); WideString* author = dynamic_cast<WideString*>(m_document->RevisionAuthorTable->operator[](rev.Isbt));
//if it's a inserted run //if it's a inserted run
m_pXmlWriter->WriteNodeBegin(_T("w:ins"), true); m_pXmlWriter->WriteNodeBegin(_T("w:ins"), true);
m_pXmlWriter->WriteAttribute(_T("w:author"), FormatUtils::XmlEncode(*author).c_str()); m_pXmlWriter->WriteAttribute(_T("w:author"), FormatUtils::XmlEncode(*author));
m_pXmlWriter->WriteNodeEnd(_T(""), true, false); m_pXmlWriter->WriteNodeEnd(_T(""), true, false);
//rev.Dttm.Convert(new DateMapping(m_pXmlWriter)); //rev.Dttm.Convert(new DateMapping(m_pXmlWriter));
} }
...@@ -392,21 +392,21 @@ namespace DocFileFormat ...@@ -392,21 +392,21 @@ namespace DocFileFormat
if (0 != rev.Rsid) if (0 != rev.Rsid)
{ {
std::wstring rsid = FormatUtils::IntToFormattedWideString(rev.Rsid, _T("%08x")); std::wstring rsid = FormatUtils::IntToFormattedWideString(rev.Rsid, _T("%08x"));
m_pXmlWriter->WriteAttribute(_T("w:rsidR"), rsid.c_str()); m_pXmlWriter->WriteAttribute(_T("w:rsidR"), rsid);
m_context->AddRsid(rsid); m_context->AddRsid(rsid);
} }
if (0 != rev.RsidDel) if (0 != rev.RsidDel)
{ {
std::wstring rsidDel = FormatUtils::IntToFormattedWideString(rev.RsidDel, _T("%08x")); std::wstring rsidDel = FormatUtils::IntToFormattedWideString(rev.RsidDel, _T("%08x"));
m_pXmlWriter->WriteAttribute(_T("w:rsidDel"), rsidDel.c_str()); m_pXmlWriter->WriteAttribute(_T("w:rsidDel"), rsidDel);
m_context->AddRsid(rsidDel); m_context->AddRsid(rsidDel);
} }
if (0 != rev.RsidProp) if (0 != rev.RsidProp)
{ {
std::wstring rsidProp = FormatUtils::IntToFormattedWideString(rev.RsidProp, _T("%08x")); std::wstring rsidProp = FormatUtils::IntToFormattedWideString(rev.RsidProp, _T("%08x"));
m_pXmlWriter->WriteAttribute(_T("w:rsidRPr"), rsidProp.c_str()); m_pXmlWriter->WriteAttribute(_T("w:rsidRPr"), rsidProp);
m_context->AddRsid(rsidProp); m_context->AddRsid(rsidProp);
} }
...@@ -447,7 +447,7 @@ namespace DocFileFormat ...@@ -447,7 +447,7 @@ namespace DocFileFormat
if (!_writeAfterRun.empty()) if (!_writeAfterRun.empty())
{ {
m_pXmlWriter->WriteString(_writeAfterRun.c_str()); m_pXmlWriter->WriteString(_writeAfterRun);
_writeAfterRun.clear(); _writeAfterRun.clear();
} }
} }
...@@ -493,7 +493,7 @@ namespace DocFileFormat ...@@ -493,7 +493,7 @@ namespace DocFileFormat
XMLTools::XMLElement elem(_T("w:tab")); XMLTools::XMLElement elem(_T("w:tab"));
m_pXmlWriter->WriteString(elem.GetXMLString().c_str()); m_pXmlWriter->WriteString(elem.GetXMLString());
} }
else if (TextMark::HardLineBreak == code) else if (TextMark::HardLineBreak == code)
{ {
...@@ -505,7 +505,7 @@ namespace DocFileFormat ...@@ -505,7 +505,7 @@ namespace DocFileFormat
elem.AppendAttribute(_T("w:type"), _T("textWrapping")); elem.AppendAttribute(_T("w:type"), _T("textWrapping"));
elem.AppendAttribute(_T("w:clear"), _T("all")); elem.AppendAttribute(_T("w:clear"), _T("all"));
m_pXmlWriter->WriteString(elem.GetXMLString().c_str()); m_pXmlWriter->WriteString(elem.GetXMLString());
} }
else if (TextMark::ParagraphEnd == code) else if (TextMark::ParagraphEnd == code)
{ {
...@@ -523,7 +523,7 @@ namespace DocFileFormat ...@@ -523,7 +523,7 @@ namespace DocFileFormat
XMLTools::XMLElement elem(_T("w:br")); XMLTools::XMLElement elem(_T("w:br"));
elem.AppendAttribute(_T("w:type"), _T("page")); elem.AppendAttribute(_T("w:type"), _T("page"));
m_pXmlWriter->WriteString(elem.GetXMLString().c_str()); m_pXmlWriter->WriteString(elem.GetXMLString());
} }
} }
else if (TextMark::ColumnBreak == code) else if (TextMark::ColumnBreak == code)
...@@ -535,7 +535,7 @@ namespace DocFileFormat ...@@ -535,7 +535,7 @@ namespace DocFileFormat
XMLTools::XMLElement elem(_T("w:br")); XMLTools::XMLElement elem(_T("w:br"));
elem.AppendAttribute(_T("w:type"), _T("column")); elem.AppendAttribute(_T("w:type"), _T("column"));
m_pXmlWriter->WriteString(elem.GetXMLString().c_str()); m_pXmlWriter->WriteString(elem.GetXMLString());
} }
else if (TextMark::FieldBeginMark == code) else if (TextMark::FieldBeginMark == code)
{ {
...@@ -698,8 +698,8 @@ namespace DocFileFormat ...@@ -698,8 +698,8 @@ namespace DocFileFormat
OleObject ole ( chpxObj, m_document->GetStorage(), m_document->bOlderVersion); OleObject ole ( chpxObj, m_document->GetStorage(), m_document->bOlderVersion);
oleWriter.WriteNodeBegin (_T( "w:object" ), true); oleWriter.WriteNodeBegin (_T( "w:object" ), true);
oleWriter.WriteAttribute( _T( "w:dxaOrig" ), FormatUtils::IntToWideString( ( ole.pictureDesciptor.dxaGoal + ole.pictureDesciptor.dxaOrigin ) ).c_str() ); oleWriter.WriteAttribute( _T( "w:dxaOrig" ), FormatUtils::IntToWideString( ( ole.pictureDesciptor.dxaGoal + ole.pictureDesciptor.dxaOrigin ) ));
oleWriter.WriteAttribute( _T( "w:dyaOrig" ), FormatUtils::IntToWideString( ( ole.pictureDesciptor.dyaGoal + ole.pictureDesciptor.dyaOrigin ) ).c_str() ); oleWriter.WriteAttribute( _T( "w:dyaOrig" ), FormatUtils::IntToWideString( ( ole.pictureDesciptor.dyaGoal + ole.pictureDesciptor.dyaOrigin ) ));
oleWriter.WriteNodeEnd( _T( "" ), true, false ); oleWriter.WriteNodeEnd( _T( "" ), true, false );
ole.pictureDesciptor.Convert(&oVmlMapper); ole.pictureDesciptor.Convert(&oVmlMapper);
...@@ -714,8 +714,8 @@ namespace DocFileFormat ...@@ -714,8 +714,8 @@ namespace DocFileFormat
PictureDescriptor pic(chpxObj, m_document->DataStream, 0x7fffffff, m_document->bOlderVersion); PictureDescriptor pic(chpxObj, m_document->DataStream, 0x7fffffff, m_document->bOlderVersion);
oleWriter.WriteNodeBegin (_T( "w:object" ), true); oleWriter.WriteNodeBegin (_T( "w:object" ), true);
oleWriter.WriteAttribute( _T( "w:dxaOrig" ), FormatUtils::IntToWideString( ( pic.dxaGoal + pic.dxaOrigin ) ).c_str() ); oleWriter.WriteAttribute( _T( "w:dxaOrig" ), FormatUtils::IntToWideString( ( pic.dxaGoal + pic.dxaOrigin ) ) );
oleWriter.WriteAttribute( _T( "w:dyaOrig" ), FormatUtils::IntToWideString( ( pic.dyaGoal + pic.dyaOrigin ) ).c_str() ); oleWriter.WriteAttribute( _T( "w:dyaOrig" ), FormatUtils::IntToWideString( ( pic.dyaGoal + pic.dyaOrigin ) ) );
oleWriter.WriteNodeEnd( _T( "" ), true, false ); oleWriter.WriteNodeEnd( _T( "" ), true, false );
pic.Convert(&oVmlMapper); pic.Convert(&oVmlMapper);
...@@ -751,7 +751,7 @@ namespace DocFileFormat ...@@ -751,7 +751,7 @@ namespace DocFileFormat
if (!oVmlMapper.m_isEmbedded && oVmlMapper.m_isEquation) if (!oVmlMapper.m_isEmbedded && oVmlMapper.m_isEquation)
{ {
//нельзя в Run писать oMath //нельзя в Run писать oMath
//m_pXmlWriter->WriteString(oVmlMapper.m_equationXml.c_str()); //m_pXmlWriter->WriteString(oVmlMapper.m_equationXml);
_writeAfterRun = oVmlMapper.m_equationXml; _writeAfterRun = oVmlMapper.m_equationXml;
} }
else else
...@@ -780,7 +780,7 @@ namespace DocFileFormat ...@@ -780,7 +780,7 @@ namespace DocFileFormat
XMLTools::XMLElement elem( _T( "w:fldChar" ) ); XMLTools::XMLElement elem( _T( "w:fldChar" ) );
elem.AppendAttribute( _T( "w:fldCharType" ), _T( "separate" ) ); elem.AppendAttribute( _T( "w:fldCharType" ), _T( "separate" ) );
m_pXmlWriter->WriteString( elem.GetXMLString().c_str() ); m_pXmlWriter->WriteString( elem.GetXMLString() );
} }
if (_embeddedObject) _skipRuns += 2; if (_embeddedObject) _skipRuns += 2;
} }
...@@ -791,7 +791,7 @@ namespace DocFileFormat ...@@ -791,7 +791,7 @@ namespace DocFileFormat
XMLTools::XMLElement elem( _T( "w:fldChar" ) ); XMLTools::XMLElement elem( _T( "w:fldChar" ) );
elem.AppendAttribute( _T( "w:fldCharType" ), _T( "end" ) ); elem.AppendAttribute( _T( "w:fldCharType" ), _T( "end" ) );
m_pXmlWriter->WriteString( elem.GetXMLString().c_str() ); m_pXmlWriter->WriteString( elem.GetXMLString());
_fldCharCounter--; _fldCharCounter--;
} }
...@@ -812,8 +812,8 @@ namespace DocFileFormat ...@@ -812,8 +812,8 @@ namespace DocFileFormat
Symbol s = getSymbol( chpx ); Symbol s = getSymbol( chpx );
m_pXmlWriter->WriteNodeBegin(_T("w:sym"), true); m_pXmlWriter->WriteNodeBegin(_T("w:sym"), true);
m_pXmlWriter->WriteAttribute(_T("w:font"), FormatUtils::XmlEncode(s.FontName).c_str()); m_pXmlWriter->WriteAttribute(_T("w:font"), FormatUtils::XmlEncode(s.FontName));
m_pXmlWriter->WriteAttribute(_T("w:char"), FormatUtils::XmlEncode(s.HexValue).c_str()); m_pXmlWriter->WriteAttribute(_T("w:char"), FormatUtils::XmlEncode(s.HexValue));
m_pXmlWriter->WriteNodeEnd(_T(""), true); m_pXmlWriter->WriteNodeEnd(_T(""), true);
} }
else if ((TextMark::DrawnObject == code) && fSpec) else if ((TextMark::DrawnObject == code) && fSpec)
...@@ -903,7 +903,7 @@ namespace DocFileFormat ...@@ -903,7 +903,7 @@ namespace DocFileFormat
else if (oVmlMapper.m_isEquation) else if (oVmlMapper.m_isEquation)
{ {
//нельзя в Run писать oMath //нельзя в Run писать oMath
//m_pXmlWriter->WriteString(oVmlMapper.m_equationXml.c_str()); //m_pXmlWriter->WriteString(oVmlMapper.m_equationXml);
_writeAfterRun = oVmlMapper.m_equationXml; _writeAfterRun = oVmlMapper.m_equationXml;
bFormula = true; bFormula = true;
} }
...@@ -925,7 +925,7 @@ namespace DocFileFormat ...@@ -925,7 +925,7 @@ namespace DocFileFormat
if ((m_document->FootnoteReferenceCharactersPlex != NULL) && (m_document->FootnoteReferenceCharactersPlex->IsCpExists(cp))) if ((m_document->FootnoteReferenceCharactersPlex != NULL) && (m_document->FootnoteReferenceCharactersPlex->IsCpExists(cp)))
{ {
m_pXmlWriter->WriteNodeBegin( _T( "w:footnoteReference" ), true ); m_pXmlWriter->WriteNodeBegin( _T( "w:footnoteReference" ), true );
m_pXmlWriter->WriteAttribute( _T( "w:id" ), FormatUtils::IntToWideString(_footnoteNr++ ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:id" ), FormatUtils::IntToWideString(_footnoteNr++ ) );
m_pXmlWriter->WriteNodeEnd( _T( "" ), true ); m_pXmlWriter->WriteNodeEnd( _T( "" ), true );
} }
else if ((m_document->IndividualFootnotesPlex != NULL) && (m_document->IndividualFootnotesPlex->IsCpExists(cp - m_document->FIB->m_RgLw97.ccpText))) else if ((m_document->IndividualFootnotesPlex != NULL) && (m_document->IndividualFootnotesPlex->IsCpExists(cp - m_document->FIB->m_RgLw97.ccpText)))
...@@ -936,7 +936,7 @@ namespace DocFileFormat ...@@ -936,7 +936,7 @@ namespace DocFileFormat
else if ((m_document->EndnoteReferenceCharactersPlex != NULL) && (m_document->EndnoteReferenceCharactersPlex->IsCpExists(cp))) else if ((m_document->EndnoteReferenceCharactersPlex != NULL) && (m_document->EndnoteReferenceCharactersPlex->IsCpExists(cp)))
{ {
m_pXmlWriter->WriteNodeBegin( _T( "w:endnoteReference" ), true ); m_pXmlWriter->WriteNodeBegin( _T( "w:endnoteReference" ), true );
m_pXmlWriter->WriteAttribute( _T( "w:id" ), FormatUtils::IntToWideString(_endnoteNr++ ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:id" ), FormatUtils::IntToWideString(_endnoteNr++ ));
m_pXmlWriter->WriteNodeEnd( _T( "" ), true ); m_pXmlWriter->WriteNodeEnd( _T( "" ), true );
} }
else if ((m_document->IndividualEndnotesPlex != NULL) && else if ((m_document->IndividualEndnotesPlex != NULL) &&
...@@ -951,7 +951,7 @@ namespace DocFileFormat ...@@ -951,7 +951,7 @@ namespace DocFileFormat
if (typeid(*this) != typeid(CommentsMapping)) if (typeid(*this) != typeid(CommentsMapping))
{ {
m_pXmlWriter->WriteNodeBegin( _T( "w:commentReference" ), true ); m_pXmlWriter->WriteNodeBegin( _T( "w:commentReference" ), true );
m_pXmlWriter->WriteAttribute( _T( "w:id" ), FormatUtils::IntToWideString( _commentNr ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:id" ), FormatUtils::IntToWideString( _commentNr ));
m_pXmlWriter->WriteNodeEnd( _T( "" ), true ); m_pXmlWriter->WriteNodeEnd( _T( "" ), true );
} }
else else
...@@ -976,7 +976,7 @@ namespace DocFileFormat ...@@ -976,7 +976,7 @@ namespace DocFileFormat
writeTextStart(textType, true/*preserve_space*/); writeTextStart(textType, true/*preserve_space*/);
m_pXmlWriter->WriteString(text.c_str()); m_pXmlWriter->WriteString(text);
writeTextEnd(textType); writeTextEnd(textType);
} }
...@@ -993,7 +993,7 @@ namespace DocFileFormat ...@@ -993,7 +993,7 @@ namespace DocFileFormat
writeTextStart( textType, preserve_space ); writeTextStart( textType, preserve_space );
m_pXmlWriter->WriteString( text.c_str() ); m_pXmlWriter->WriteString( text);
writeTextEnd( textType ); writeTextEnd( textType );
} }
...@@ -1003,7 +1003,7 @@ namespace DocFileFormat ...@@ -1003,7 +1003,7 @@ namespace DocFileFormat
{ {
std::wstring str = ( std::wstring( _T( "w:" ) ) + textType ); std::wstring str = ( std::wstring( _T( "w:" ) ) + textType );
m_pXmlWriter->WriteNodeBegin( str.c_str(), true ); m_pXmlWriter->WriteNodeBegin( str, true );
if (preserve_space) if (preserve_space)
{ {
m_pXmlWriter->WriteAttribute( _T( "xml:space" ), _T( "preserve" ) ); m_pXmlWriter->WriteAttribute( _T( "xml:space" ), _T( "preserve" ) );
...@@ -1015,7 +1015,7 @@ namespace DocFileFormat ...@@ -1015,7 +1015,7 @@ namespace DocFileFormat
{ {
std::wstring str = ( std::wstring( _T( "w:" ) ) + textType ); std::wstring str = ( std::wstring( _T( "w:" ) ) + textType );
m_pXmlWriter->WriteNodeEnd( str.c_str() ); m_pXmlWriter->WriteNodeEnd( str );
} }
// Searches for bookmarks in the list of characters. // Searches for bookmarks in the list of characters.
...@@ -1572,10 +1572,10 @@ namespace DocFileFormat ...@@ -1572,10 +1572,10 @@ namespace DocFileFormat
{ {
XMLTools::XMLElement bookmarkElem(_T("w:bookmarkStart")); XMLTools::XMLElement bookmarkElem(_T("w:bookmarkStart"));
bookmarkElem.AppendAttribute(_T("w:id"), FormatUtils::IntToWideString(id).c_str()); bookmarkElem.AppendAttribute(_T("w:id"), FormatUtils::IntToWideString(id));
bookmarkElem.AppendAttribute(_T("w:name"), bookmarkName->c_str()); bookmarkElem.AppendAttribute(_T("w:name"), *bookmarkName);
m_pXmlWriter->WriteString(bookmarkElem.GetXMLString().c_str()); m_pXmlWriter->WriteString(bookmarkElem.GetXMLString());
return true; return true;
} }
...@@ -1593,9 +1593,9 @@ namespace DocFileFormat ...@@ -1593,9 +1593,9 @@ namespace DocFileFormat
{ {
XMLTools::XMLElement bookmarkElem( _T( "w:bookmarkEnd" ) ); XMLTools::XMLElement bookmarkElem( _T( "w:bookmarkEnd" ) );
bookmarkElem.AppendAttribute( _T( "w:id" ), FormatUtils::IntToWideString( id ).c_str() ); bookmarkElem.AppendAttribute( _T( "w:id" ), FormatUtils::IntToWideString( id ));
m_pXmlWriter->WriteString( bookmarkElem.GetXMLString().c_str() ); m_pXmlWriter->WriteString( bookmarkElem.GetXMLString());
return true; return true;
} }
......
...@@ -70,7 +70,7 @@ namespace DocFileFormat ...@@ -70,7 +70,7 @@ namespace DocFileFormat
while ( cp <= ( m_document->FIB->m_RgLw97.ccpText + m_document->FIB->m_RgLw97.ccpFtn + m_document->FIB->m_RgLw97.ccpHdr + m_document->FIB->m_RgLw97.ccpAtn + m_document->FIB->m_RgLw97.ccpEdn - 2 ) ) while ( cp <= ( m_document->FIB->m_RgLw97.ccpText + m_document->FIB->m_RgLw97.ccpFtn + m_document->FIB->m_RgLw97.ccpHdr + m_document->FIB->m_RgLw97.ccpAtn + m_document->FIB->m_RgLw97.ccpEdn - 2 ) )
{ {
m_pXmlWriter->WriteNodeBegin( _T( "w:endnote" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:endnote" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:id" ), FormatUtils::IntToWideString( id ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:id" ), FormatUtils::IntToWideString( id ));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
while ( ( cp - m_document->FIB->m_RgLw97.ccpText - m_document->FIB->m_RgLw97.ccpFtn - m_document->FIB->m_RgLw97.ccpHdr - m_document->FIB->m_RgLw97.ccpAtn ) < (*m_document->IndividualEndnotesPlex)[id + 1] ) while ( ( cp - m_document->FIB->m_RgLw97.ccpText - m_document->FIB->m_RgLw97.ccpFtn - m_document->FIB->m_RgLw97.ccpHdr - m_document->FIB->m_RgLw97.ccpAtn ) < (*m_document->IndividualEndnotesPlex)[id + 1] )
......
...@@ -59,34 +59,39 @@ namespace DocFileFormat ...@@ -59,34 +59,39 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute( _T( "xmlns:w" ), OpenXmlNamespaces::WordprocessingML ); m_pXmlWriter->WriteAttribute( _T( "xmlns:w" ), OpenXmlNamespaces::WordprocessingML );
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
int sz_fonts = table->Data.size(); int sz_fonts = table->Data.size();
int users_fonts = 0;
for ( std::vector<ByteStructure*>::iterator iter = table->Data.begin(); iter != table->Data.end(); iter++ ) for ( std::vector<ByteStructure*>::iterator iter = table->Data.begin(); iter != table->Data.end(); iter++ )
{ {
FontFamilyName* font = dynamic_cast<FontFamilyName*>( *iter ); FontFamilyName* font = dynamic_cast<FontFamilyName*>( *iter );
m_pXmlWriter->WriteNodeBegin( _T( "w:font" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:font" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:name" ), FormatUtils::XmlEncode(font->xszFtn, true).c_str());
std::wstring name_ = FormatUtils::XmlEncode(font->xszFtn, true);
if (name_.empty())
name_ = L"UserFont_" + std::to_wstring(++users_fonts);
m_pXmlWriter->WriteAttribute( _T( "w:name" ), name_);
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
//alternative name //alternative name
if ( ( font->xszAlt != std::wstring( _T( "" ) ) ) && ( font->xszAlt.length() > 0 ) ) if ( ( font->xszAlt != std::wstring( _T( "" ) ) ) && ( font->xszAlt.length() > 0 ) )
{ {
m_pXmlWriter->WriteNodeBegin( _T( "w:altName" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:altName" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::XmlEncode(font->xszAlt, true).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::XmlEncode(font->xszAlt, true));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_pXmlWriter->WriteNodeEnd( _T( "w:altName" ) ); m_pXmlWriter->WriteNodeEnd( _T( "w:altName" ) );
} }
//charset //charset
m_pXmlWriter->WriteNodeBegin( _T("w:charset" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T("w:charset" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::IntToFormattedWideString( font->chs, _T( "%02x" ) ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::IntToFormattedWideString( font->chs, _T( "%02x" ) ));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_pXmlWriter->WriteNodeEnd( _T( "w:charset" ) ); m_pXmlWriter->WriteNodeEnd( _T( "w:charset" ) );
//font family //font family
m_pXmlWriter->WriteNodeBegin( _T("w:family"), TRUE ); m_pXmlWriter->WriteNodeBegin( _T("w:family"), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::MapValueToWideString( font->ff, &FontFamily[0][0], 6, 11 ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::MapValueToWideString( font->ff, &FontFamily[0][0], 6, 11 ));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_pXmlWriter->WriteNodeEnd( _T( "w:family" ) ); m_pXmlWriter->WriteNodeEnd( _T( "w:family" ) );
...@@ -100,13 +105,13 @@ namespace DocFileFormat ...@@ -100,13 +105,13 @@ namespace DocFileFormat
wstr += FormatUtils::IntToFormattedWideString( font->panose[i], _T( "%02x" ) ); wstr += FormatUtils::IntToFormattedWideString( font->panose[i], _T( "%02x" ) );
} }
m_pXmlWriter->WriteAttribute( _T( "w:val" ), wstr.c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:val" ), wstr);
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_pXmlWriter->WriteNodeEnd( _T( "w:panose1" ) ); m_pXmlWriter->WriteNodeEnd( _T( "w:panose1" ) );
//pitch //pitch
m_pXmlWriter->WriteNodeBegin( _T("w:pitch"), TRUE ); m_pXmlWriter->WriteNodeBegin( _T("w:pitch"), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::MapValueToWideString( font->prq, &FontPitch[0][0], 3, 9 ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::MapValueToWideString( font->prq, &FontPitch[0][0], 3, 9 ));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_pXmlWriter->WriteNodeEnd( _T( "w:pitch" ) ); m_pXmlWriter->WriteNodeEnd( _T( "w:pitch" ) );
...@@ -121,12 +126,12 @@ namespace DocFileFormat ...@@ -121,12 +126,12 @@ namespace DocFileFormat
//font signature //font signature
m_pXmlWriter->WriteNodeBegin( _T("w:sig"), TRUE ); m_pXmlWriter->WriteNodeBegin( _T("w:sig"), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:usb0" ), FormatUtils::IntToFormattedWideString( font->fs.UnicodeSubsetBitfield0, _T( "%08x" ) ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:usb0" ), FormatUtils::IntToFormattedWideString( font->fs.UnicodeSubsetBitfield0, _T( "%08x" ) ));
m_pXmlWriter->WriteAttribute( _T( "w:usb1" ), FormatUtils::IntToFormattedWideString( font->fs.UnicodeSubsetBitfield1, _T( "%08x" ) ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:usb1" ), FormatUtils::IntToFormattedWideString( font->fs.UnicodeSubsetBitfield1, _T( "%08x" ) ));
m_pXmlWriter->WriteAttribute( _T( "w:usb2" ), FormatUtils::IntToFormattedWideString( font->fs.UnicodeSubsetBitfield2, _T( "%08x" ) ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:usb2" ), FormatUtils::IntToFormattedWideString( font->fs.UnicodeSubsetBitfield2, _T( "%08x" ) ));
m_pXmlWriter->WriteAttribute( _T( "w:usb3" ), FormatUtils::IntToFormattedWideString( font->fs.UnicodeSubsetBitfield3, _T( "%08x" ) ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:usb3" ), FormatUtils::IntToFormattedWideString( font->fs.UnicodeSubsetBitfield3, _T( "%08x" ) ));
m_pXmlWriter->WriteAttribute( _T( "w:csb0" ), FormatUtils::IntToFormattedWideString( font->fs.CodePageBitfield0, _T( "%08x" ) ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:csb0" ), FormatUtils::IntToFormattedWideString( font->fs.CodePageBitfield0, _T( "%08x" ) ));
m_pXmlWriter->WriteAttribute( _T( "w:csb1" ), FormatUtils::IntToFormattedWideString( font->fs.CodePageBitfield1, _T( "%08x" ) ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:csb1" ), FormatUtils::IntToFormattedWideString( font->fs.CodePageBitfield1, _T( "%08x" ) ));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_pXmlWriter->WriteNodeEnd( _T( "w:sig" ) ); m_pXmlWriter->WriteNodeEnd( _T( "w:sig" ) );
......
...@@ -70,7 +70,7 @@ namespace DocFileFormat ...@@ -70,7 +70,7 @@ namespace DocFileFormat
while ( cp <= ( m_document->FIB->m_RgLw97.ccpText + m_document->FIB->m_RgLw97.ccpFtn - 2 ) ) while ( cp <= ( m_document->FIB->m_RgLw97.ccpText + m_document->FIB->m_RgLw97.ccpFtn - 2 ) )
{ {
m_pXmlWriter->WriteNodeBegin( _T( "w:footnote" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:footnote" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:id" ), FormatUtils::IntToWideString( id ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:id" ), FormatUtils::IntToWideString( id ));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
while ( ( cp - m_document->FIB->m_RgLw97.ccpText ) < (*m_document->IndividualFootnotesPlex)[id + 1] ) while ( ( cp - m_document->FIB->m_RgLw97.ccpText ) < (*m_document->IndividualFootnotesPlex)[id + 1] )
......
...@@ -65,25 +65,25 @@ namespace DocFileFormat ...@@ -65,25 +65,25 @@ namespace DocFileFormat
{ {
case Default: case Default:
{ {
att = new XMLTools::XMLAttribute( L"w:val", langcode.c_str() ); att = new XMLTools::XMLAttribute( L"w:val", langcode);
} }
break; break;
case EastAsian: case EastAsian:
{ {
att = new XMLTools::XMLAttribute( L"w:eastAsia", langcode.c_str() ); att = new XMLTools::XMLAttribute( L"w:eastAsia", langcode);
} }
break; break;
case Complex: case Complex:
{ {
att = new XMLTools::XMLAttribute( L"w:bidi", langcode.c_str() ); att = new XMLTools::XMLAttribute( L"w:bidi", langcode);
} }
break; break;
default: default:
{ {
att = new XMLTools::XMLAttribute( L"w:val", langcode.c_str() ); att = new XMLTools::XMLAttribute( L"w:val", langcode);
} }
break; break;
} }
...@@ -91,7 +91,7 @@ namespace DocFileFormat ...@@ -91,7 +91,7 @@ namespace DocFileFormat
if (m_pXmlWriter) if (m_pXmlWriter)
{ {
// !!!TODO!!! // !!!TODO!!!
m_pXmlWriter->WriteString( att->GetXMLString().c_str() ); m_pXmlWriter->WriteString( att->GetXMLString());
} }
else if ( _parent != NULL ) else if ( _parent != NULL )
{ {
......
...@@ -83,12 +83,12 @@ namespace DocFileFormat ...@@ -83,12 +83,12 @@ namespace DocFileFormat
{ {
//start abstractNum //start abstractNum
m_pXmlWriter->WriteNodeBegin( _T( "w:abstractNum" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:abstractNum" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:abstractNumId" ), FormatUtils::IntToWideString( i ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:abstractNumId" ), FormatUtils::IntToWideString( i ));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
//nsid //nsid
m_pXmlWriter->WriteNodeBegin( _T( "w:nsid" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:nsid" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::IntToFormattedWideString( (*iter)->lsid, _T( "%08x" ) ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::IntToFormattedWideString( (*iter)->lsid, _T( "%08x" ) ));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
//multiLevelType //multiLevelType
...@@ -111,7 +111,7 @@ namespace DocFileFormat ...@@ -111,7 +111,7 @@ namespace DocFileFormat
//template //template
m_pXmlWriter->WriteNodeBegin( _T( "w:tmpl" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:tmpl" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::IntToFormattedWideString( (*iter)->tplc, _T( "%08x" ) ).c_str()); m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::IntToFormattedWideString( (*iter)->tplc, _T( "%08x" ) ));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
// writes the levels // writes the levels
...@@ -131,12 +131,12 @@ namespace DocFileFormat ...@@ -131,12 +131,12 @@ namespace DocFileFormat
{ {
//start abstractNum //start abstractNum
m_pXmlWriter->WriteNodeBegin( _T( "w:abstractNum" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:abstractNum" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:abstractNumId" ), FormatUtils::IntToWideString( i ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:abstractNumId" ), FormatUtils::IntToWideString( i ));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
////nsid ////nsid
//m_pXmlWriter->WriteNodeBegin( _T( "w:nsid" ), TRUE ); //m_pXmlWriter->WriteNodeBegin( _T( "w:nsid" ), TRUE );
//m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::IntToFormattedWideString( (*iter)->lsid, _T( "%08x" ) ).c_str() ); //m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::IntToFormattedWideString( (*iter)->lsid, _T( "%08x" ) ));
//m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); //m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
//multiLevelType //multiLevelType
...@@ -160,26 +160,26 @@ namespace DocFileFormat ...@@ -160,26 +160,26 @@ namespace DocFileFormat
//start num //start num
m_pXmlWriter->WriteNodeBegin( _T( "w:num" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:num" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:numId" ), FormatUtils::IntToWideString(i + 1).c_str()); m_pXmlWriter->WriteAttribute( _T( "w:numId" ), FormatUtils::IntToWideString(i + 1));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
int index = FindIndexbyId( rglst->listData, lfo->lsid ); int index = FindIndexbyId( rglst->listData, lfo->lsid );
m_pXmlWriter->WriteNodeBegin( _T( "w:abstractNumId" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:abstractNumId" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::IntToWideString( index ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::IntToWideString( index ) );
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
for (std::vector<ListFormatOverrideLevel*>::const_iterator iter = lfo->rgLfoLvl.begin(); iter != lfo->rgLfoLvl.end(); ++iter) for (std::vector<ListFormatOverrideLevel*>::const_iterator iter = lfo->rgLfoLvl.begin(); iter != lfo->rgLfoLvl.end(); ++iter)
{ {
m_pXmlWriter->WriteNodeBegin( _T( "w:lvlOverride" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:lvlOverride" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:ilvl" ), FormatUtils::IntToWideString( (*iter)->ilvl ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:ilvl" ), FormatUtils::IntToWideString( (*iter)->ilvl ));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
if ( ( (*iter)->fStartAt ) && ( !(*iter)->fFormatting ) ) if ( ( (*iter)->fStartAt ) && ( !(*iter)->fFormatting ) )
{ {
m_pXmlWriter->WriteNodeBegin( _T( "w:startOverride" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:startOverride" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::IntToWideString( (*iter)->iStartAt ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::IntToWideString( (*iter)->iStartAt ));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
} }
...@@ -197,12 +197,12 @@ namespace DocFileFormat ...@@ -197,12 +197,12 @@ namespace DocFileFormat
for (std::list<NumberingDescriptor>::iterator iter = rglst->listNumbering.begin(); iter != rglst->listNumbering.end(); ++iter, ++i) for (std::list<NumberingDescriptor>::iterator iter = rglst->listNumbering.begin(); iter != rglst->listNumbering.end(); ++iter, ++i)
{ {
m_pXmlWriter->WriteNodeBegin( _T( "w:num" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:num" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:numId" ), FormatUtils::IntToWideString(i+1).c_str()); m_pXmlWriter->WriteAttribute( _T( "w:numId" ), FormatUtils::IntToWideString(i+1));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_pXmlWriter->WriteNodeBegin( _T( "w:abstractNumId" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:abstractNumId" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::IntToWideString( i ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::IntToWideString( i ));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
m_pXmlWriter->WriteNodeEnd(_T( "w:num")); m_pXmlWriter->WriteNodeEnd(_T( "w:num"));
...@@ -255,8 +255,10 @@ namespace DocFileFormat ...@@ -255,8 +255,10 @@ namespace DocFileFormat
if (!FormatUtils::IsControlSymbol(xchBullet)) if (!FormatUtils::IsControlSymbol(xchBullet))
{ {
ret.push_back(lvl->xst[0]); ret.push_back(lvl->xst[0]);//??? xchBullet
ret.push_back(L'\0'); }
else
{
} }
} }
} }
...@@ -487,20 +489,20 @@ namespace DocFileFormat ...@@ -487,20 +489,20 @@ namespace DocFileFormat
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
m_pXmlWriter->WriteNodeBegin( _T( "w:lvl" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:lvl" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:ilvl" ), FormatUtils::IntToWideString(level).c_str()); m_pXmlWriter->WriteAttribute( _T( "w:ilvl" ), FormatUtils::IntToWideString(level));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_pXmlWriter->WriteNodeBegin( _T( "w:start" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:start" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::IntToWideString(lvl.iStartAt).c_str()); m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::IntToWideString(lvl.iStartAt));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
m_pXmlWriter->WriteNodeBegin( _T( "w:numFmt" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:numFmt" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), GetNumberFormatWideString(lvl.nfc, true).c_str()); m_pXmlWriter->WriteAttribute( _T( "w:val" ), GetNumberFormatWideString(lvl.nfc, true));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
//// suffix //// suffix
// m_pXmlWriter->WriteNodeBegin( _T( "w:suff" ), TRUE ); // m_pXmlWriter->WriteNodeBegin( _T( "w:suff" ), TRUE );
// m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::MapValueToWideString(lvl.ixchFollow, &FollowingCharMap[0][0], 3, 8).c_str()); // m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::MapValueToWideString(lvl.ixchFollow, &FollowingCharMap[0][0], 3, 8));
// m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); // m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
// Number level text // Number level text
...@@ -516,13 +518,13 @@ namespace DocFileFormat ...@@ -516,13 +518,13 @@ namespace DocFileFormat
if (!lvlText.empty()) if (!lvlText.empty())
{ {
m_pXmlWriter->WriteNodeBegin(_T("w:lvlText"), TRUE); m_pXmlWriter->WriteNodeBegin(_T("w:lvlText"), TRUE);
m_pXmlWriter->WriteAttribute(_T("w:val"), lvlText.c_str()); m_pXmlWriter->WriteAttribute(_T("w:val"), lvlText);
m_pXmlWriter->WriteNodeEnd(_T( ""), TRUE); m_pXmlWriter->WriteNodeEnd(_T( ""), TRUE);
} }
// jc // jc
m_pXmlWriter->WriteNodeBegin( _T( "w:lvlJc" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:lvlJc" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::MapValueToWideString(lvl.jc, &LevelJustificationMap[0][0], 3, 7).c_str()); m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::MapValueToWideString(lvl.jc, &LevelJustificationMap[0][0], 3, 7));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
// pPr // pPr
m_pXmlWriter->WriteNodeBegin( _T( "w:pPr" ), FALSE ); m_pXmlWriter->WriteNodeBegin( _T( "w:pPr" ), FALSE );
...@@ -535,8 +537,8 @@ namespace DocFileFormat ...@@ -535,8 +537,8 @@ namespace DocFileFormat
{ {
m_pXmlWriter->WriteNodeBegin( _T( "w:rFonts" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:rFonts" ), TRUE );
// w:hint="default" // w:hint="default"
m_pXmlWriter->WriteAttribute(_T("w:hAnsi"), fontFamily.c_str()); m_pXmlWriter->WriteAttribute(_T("w:hAnsi"), fontFamily);
m_pXmlWriter->WriteAttribute(_T("w:ascii"), fontFamily.c_str()); m_pXmlWriter->WriteAttribute(_T("w:ascii"), fontFamily);
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
} }
m_pXmlWriter->WriteNodeEnd(_T("w:rPr")); m_pXmlWriter->WriteNodeEnd(_T("w:rPr"));
...@@ -557,25 +559,25 @@ namespace DocFileFormat ...@@ -557,25 +559,25 @@ namespace DocFileFormat
// Проверяем шрифт // Проверяем шрифт
m_pXmlWriter->WriteNodeBegin( _T( "w:lvl" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:lvl" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:ilvl" ), FormatUtils::IntToWideString(level).c_str()); m_pXmlWriter->WriteAttribute( _T( "w:ilvl" ), FormatUtils::IntToWideString(level));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
// starts at // starts at
m_pXmlWriter->WriteNodeBegin( _T( "w:start" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:start" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::IntToWideString(lvl->iStartAt).c_str()); m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::IntToWideString(lvl->iStartAt));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
// number format // number format
m_pXmlWriter->WriteNodeBegin( _T( "w:numFmt" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:numFmt" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), GetNumberFormatWideString(lvl->nfc).c_str()); m_pXmlWriter->WriteAttribute( _T( "w:val" ), GetNumberFormatWideString(lvl->nfc));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
// suffix // suffix
m_pXmlWriter->WriteNodeBegin( _T( "w:suff" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:suff" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::MapValueToWideString(lvl->ixchFollow, &FollowingCharMap[0][0], 3, 8).c_str()); m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::MapValueToWideString(lvl->ixchFollow, &FollowingCharMap[0][0], 3, 8));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
// style // style
...@@ -585,14 +587,14 @@ namespace DocFileFormat ...@@ -585,14 +587,14 @@ namespace DocFileFormat
if (styleIndex != ListData::ISTD_NIL) if (styleIndex != ListData::ISTD_NIL)
{ {
m_pXmlWriter->WriteNodeBegin( _T( "w:pStyle" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:pStyle" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::XmlEncode(StyleSheetMapping::MakeStyleId(m_document->Styles->Styles->at(styleIndex))).c_str()); m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::XmlEncode(StyleSheetMapping::MakeStyleId(m_document->Styles->Styles->at(styleIndex))));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
} }
// Number level text // Number level text
m_pXmlWriter->WriteNodeBegin(_T("w:lvlText"), TRUE); m_pXmlWriter->WriteNodeBegin(_T("w:lvlText"), TRUE);
m_pXmlWriter->WriteAttribute(_T("w:val"), GetLvlText(lvl, cpMapping.CheckIsSymbolFont()).c_str()); m_pXmlWriter->WriteAttribute(_T("w:val"), GetLvlText(lvl, cpMapping.CheckIsSymbolFont()));
m_pXmlWriter->WriteNodeEnd(_T( ""), TRUE); m_pXmlWriter->WriteNodeEnd(_T( ""), TRUE);
WriteLevelPictureBullet(lvl->grpprlChpx); WriteLevelPictureBullet(lvl->grpprlChpx);
...@@ -606,7 +608,7 @@ namespace DocFileFormat ...@@ -606,7 +608,7 @@ namespace DocFileFormat
} }
// jc // jc
m_pXmlWriter->WriteNodeBegin( _T( "w:lvlJc" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:lvlJc" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::MapValueToWideString(lvl->jc, &LevelJustificationMap[0][0], 3, 7).c_str()); m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::MapValueToWideString(lvl->jc, &LevelJustificationMap[0][0], 3, 7));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
// pPr // pPr
bool isBidi = false; bool isBidi = false;
...@@ -638,7 +640,7 @@ namespace DocFileFormat ...@@ -638,7 +640,7 @@ namespace DocFileFormat
if ((pict.mfp.mm > 98) && (pict.shapeContainer != NULL)) if ((pict.mfp.mm > 98) && (pict.shapeContainer != NULL))
{ {
m_pXmlWriter->WriteNodeBegin( _T( "w:numPicBullet" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:numPicBullet" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:numPicBulletId" ), FormatUtils::IntToWideString( iter->first ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:numPicBulletId" ), FormatUtils::IntToWideString( iter->first ));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_pXmlWriter->WriteNodeBegin( _T( "w:pict" ) ); m_pXmlWriter->WriteNodeBegin( _T( "w:pict" ) );
...@@ -692,7 +694,7 @@ namespace DocFileFormat ...@@ -692,7 +694,7 @@ namespace DocFileFormat
if (isPictureBullet) if (isPictureBullet)
{ {
m_pXmlWriter->WriteNodeBegin(_T("w:lvlPicBulletId"), TRUE); m_pXmlWriter->WriteNodeBegin(_T("w:lvlPicBulletId"), TRUE);
m_pXmlWriter->WriteAttribute(_T("w:val"), FormatUtils::IntToWideString(cp).c_str()); m_pXmlWriter->WriteAttribute(_T("w:val"), FormatUtils::IntToWideString(cp));
m_pXmlWriter->WriteNodeEnd(_T(""), TRUE); m_pXmlWriter->WriteNodeEnd(_T(""), TRUE);
} }
} }
......
...@@ -71,9 +71,9 @@ namespace DocFileFormat ...@@ -71,9 +71,9 @@ namespace DocFileFormat
{ {
int relID = m_context->_docx->RegisterExternalOLEObject(_caller, ole->ClipboardFormat, ole->Link); int relID = m_context->_docx->RegisterExternalOLEObject(_caller, ole->ClipboardFormat, ole->Link);
m_pXmlWriter->WriteAttribute( _T( "r:id" ), ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( relID ) ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "r:id" ), ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( relID ) ));
m_pXmlWriter->WriteAttribute( _T( "Type" ), _T( "Link" ) ); m_pXmlWriter->WriteAttribute( _T( "Type" ), _T( "Link" ) );
m_pXmlWriter->WriteAttribute( _T( "UpdateMode" ), ole->UpdateMode.c_str() ); m_pXmlWriter->WriteAttribute( _T( "UpdateMode" ), ole->UpdateMode);
} }
else else
{ {
...@@ -84,16 +84,16 @@ namespace DocFileFormat ...@@ -84,16 +84,16 @@ namespace DocFileFormat
else else
relID = m_context->_docx->RegisterOLEObject(_caller, ole->ClipboardFormat); relID = m_context->_docx->RegisterOLEObject(_caller, ole->ClipboardFormat);
m_pXmlWriter->WriteAttribute( _T( "r:id" ), ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( relID ) ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "r:id" ), ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( relID ) ));
m_pXmlWriter->WriteAttribute( _T( "Type" ), _T( "Embed" ) ); m_pXmlWriter->WriteAttribute( _T( "Type" ), _T( "Embed" ) );
copyEmbeddedObject( ole ); copyEmbeddedObject( ole );
} }
m_pXmlWriter->WriteAttribute( _T( "ProgID" ), ole->Program.c_str() ); m_pXmlWriter->WriteAttribute( _T( "ProgID" ), ole->Program);
m_pXmlWriter->WriteAttribute( _T( "ShapeID" ), _shapeId.c_str() ); m_pXmlWriter->WriteAttribute( _T( "ShapeID" ), _shapeId);
m_pXmlWriter->WriteAttribute( _T( "DrawAspect" ), _T( "Content" ) ); m_pXmlWriter->WriteAttribute( _T( "DrawAspect" ), _T( "Content" ) );
m_pXmlWriter->WriteAttribute( _T( "ObjectID" ), ole->ObjectId.c_str() ); m_pXmlWriter->WriteAttribute( _T( "ObjectID" ), ole->ObjectId);
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_pXmlWriter->WriteNodeEnd( _T( "o:OLEObject" ) ); m_pXmlWriter->WriteNodeEnd( _T( "o:OLEObject" ) );
......
...@@ -224,7 +224,7 @@ namespace DocFileFormat ...@@ -224,7 +224,7 @@ namespace DocFileFormat
{ {
HeaderRelationshipsFiles.push_back( RelationshipsFile( ( std::wstring( _T( "word/_rels/header" ) ) + FormatUtils::IntToWideString( ++_headerCounter ) + std::wstring( _T( ".xml.rels" ) ) ) ) ); HeaderRelationshipsFiles.push_back( RelationshipsFile( ( std::wstring( _T( "word/_rels/header" ) ) + FormatUtils::IntToWideString( ++_headerCounter ) + std::wstring( _T( ".xml.rels" ) ) ) ) );
return AddPart( _T( "word" ), ( std::wstring( _T( "header" ) ) + FormatUtils::IntToWideString( _headerCounter ) + std::wstring( _T( ".xml" ) ) ).c_str(), WordprocessingMLContentTypes::Header, OpenXmlRelationshipTypes::Header ); return AddPart( _T( "word" ), ( std::wstring( _T( "header" ) ) + FormatUtils::IntToWideString( _headerCounter ) + std::wstring( _T( ".xml" ) ) ), WordprocessingMLContentTypes::Header, OpenXmlRelationshipTypes::Header );
} }
int OpenXmlPackage::AddHeaderPart( const std::wstring& fileName, const std::wstring& relationshipType, const std::wstring& targetMode ) int OpenXmlPackage::AddHeaderPart( const std::wstring& fileName, const std::wstring& relationshipType, const std::wstring& targetMode )
...@@ -245,7 +245,7 @@ namespace DocFileFormat ...@@ -245,7 +245,7 @@ namespace DocFileFormat
{ {
FooterRelationshipsFiles.push_back( RelationshipsFile( ( std::wstring( _T( "word/_rels/footer" ) ) + FormatUtils::IntToWideString( ++_footerCounter ) + std::wstring( _T( ".xml.rels" ) ) ) ) ); FooterRelationshipsFiles.push_back( RelationshipsFile( ( std::wstring( _T( "word/_rels/footer" ) ) + FormatUtils::IntToWideString( ++_footerCounter ) + std::wstring( _T( ".xml.rels" ) ) ) ) );
return AddPart( _T( "word" ), ( std::wstring( _T( "footer" ) ) + FormatUtils::IntToWideString( _footerCounter ) + std::wstring( _T( ".xml" ) ) ).c_str(), WordprocessingMLContentTypes::Footer, OpenXmlRelationshipTypes::Footer ); return AddPart( _T( "word" ), ( std::wstring( _T( "footer" ) ) + FormatUtils::IntToWideString( _footerCounter ) + std::wstring( _T( ".xml" ) ) ), WordprocessingMLContentTypes::Footer, OpenXmlRelationshipTypes::Footer );
} }
int OpenXmlPackage::AddFooterPart( const std::wstring& fileName, const std::wstring& relationshipType, const std::wstring& targetMode ) int OpenXmlPackage::AddFooterPart( const std::wstring& fileName, const std::wstring& relationshipType, const std::wstring& targetMode )
...@@ -322,13 +322,13 @@ namespace DocFileFormat ...@@ -322,13 +322,13 @@ namespace DocFileFormat
for ( std::list<Relationship>::const_iterator iter = relationshipsFile.Relationships.begin(); iter != relationshipsFile.Relationships.end(); iter++ ) for ( std::list<Relationship>::const_iterator iter = relationshipsFile.Relationships.begin(); iter != relationshipsFile.Relationships.end(); iter++ )
{ {
writer.WriteNodeBegin( _T( "Relationship" ), TRUE ); writer.WriteNodeBegin( _T( "Relationship" ), TRUE );
writer.WriteAttribute( _T( "Id" ), iter->Id.c_str() ); writer.WriteAttribute( _T( "Id" ), iter->Id );
writer.WriteAttribute( _T( "Type" ), iter->Type.c_str() ); writer.WriteAttribute( _T( "Type" ), iter->Type );
writer.WriteAttribute( _T( "Target" ), iter->Target.c_str() ); writer.WriteAttribute( _T( "Target" ), iter->Target );
if ( !iter->TargetMode.empty() ) if ( !iter->TargetMode.empty() )
{ {
writer.WriteAttribute( _T( "TargetMode" ), iter->TargetMode.c_str() ); writer.WriteAttribute( _T( "TargetMode" ), iter->TargetMode );
} }
writer.WriteNodeEnd( _T( "" ), TRUE ); writer.WriteNodeEnd( _T( "" ), TRUE );
...@@ -358,16 +358,16 @@ namespace DocFileFormat ...@@ -358,16 +358,16 @@ namespace DocFileFormat
for ( std::map<std::wstring, std::wstring>::iterator iter = DocumentContentTypesFile._defaultTypes.begin(); iter != DocumentContentTypesFile._defaultTypes.end(); iter++ ) for ( std::map<std::wstring, std::wstring>::iterator iter = DocumentContentTypesFile._defaultTypes.begin(); iter != DocumentContentTypesFile._defaultTypes.end(); iter++ )
{ {
writer.WriteNodeBegin( _T( "Default" ), TRUE ); writer.WriteNodeBegin( _T( "Default" ), TRUE );
writer.WriteAttribute( _T( "Extension" ), iter->first.c_str() ); writer.WriteAttribute( _T( "Extension" ), iter->first );
writer.WriteAttribute( _T( "ContentType" ), DocumentContentTypesFile._defaultTypes[iter->first].c_str() ); writer.WriteAttribute( _T( "ContentType" ), DocumentContentTypesFile._defaultTypes[iter->first] );
writer.WriteNodeEnd( _T( "" ), TRUE ); writer.WriteNodeEnd( _T( "" ), TRUE );
} }
for ( std::map<std::wstring, std::wstring>::iterator iter = DocumentContentTypesFile._partOverrides.begin(); iter != DocumentContentTypesFile._partOverrides.end(); iter++ ) for ( std::map<std::wstring, std::wstring>::iterator iter = DocumentContentTypesFile._partOverrides.begin(); iter != DocumentContentTypesFile._partOverrides.end(); iter++ )
{ {
writer.WriteNodeBegin( _T( "Override" ), TRUE ); writer.WriteNodeBegin( _T( "Override" ), TRUE );
writer.WriteAttribute( _T( "PartName" ), iter->first.c_str() ); writer.WriteAttribute( _T( "PartName" ), iter->first );
writer.WriteAttribute( _T( "ContentType" ), DocumentContentTypesFile._partOverrides[iter->first].c_str() ); writer.WriteAttribute( _T( "ContentType" ), DocumentContentTypesFile._partOverrides[iter->first] );
writer.WriteNodeEnd( _T( "" ), TRUE ); writer.WriteNodeEnd( _T( "" ), TRUE );
} }
......
...@@ -96,7 +96,7 @@ namespace DocFileFormat ...@@ -96,7 +96,7 @@ namespace DocFileFormat
if ( papx->istd < m_document->Styles->Styles->size() ) if ( papx->istd < m_document->Styles->Styles->size() )
{ {
styleId.SetValue( FormatUtils::XmlEncode(StyleSheetMapping::MakeStyleId( m_document->Styles->Styles->at( papx->istd ) )).c_str() ); styleId.SetValue( FormatUtils::XmlEncode(StyleSheetMapping::MakeStyleId( m_document->Styles->Styles->at( papx->istd ) )) );
} }
pStyle.AppendAttribute( styleId ); pStyle.AppendAttribute( styleId );
...@@ -139,7 +139,7 @@ namespace DocFileFormat ...@@ -139,7 +139,7 @@ namespace DocFileFormat
{ {
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)), true);
}break; }break;
case sprmPFAutoSpaceDE: case sprmPFAutoSpaceDE:
...@@ -242,7 +242,7 @@ namespace DocFileFormat ...@@ -242,7 +242,7 @@ namespace DocFileFormat
flValue *= -1; flValue *= -1;
} }
appendValueAttribute( &ind, flName.c_str(), flValue ); appendValueAttribute( &ind, flName, flValue );
}break; }break;
case sprmPDxcLeft1: case sprmPDxcLeft1:
...@@ -283,7 +283,7 @@ namespace DocFileFormat ...@@ -283,7 +283,7 @@ namespace DocFileFormat
{ {
LineSpacingDescriptor lspd( iter->Arguments, iter->argumentsSize ); LineSpacingDescriptor lspd( iter->Arguments, iter->argumentsSize );
XMLTools::XMLAttribute line( _T( "w:line" ), FormatUtils::IntToWideString( abs( lspd.dyaLine ) ).c_str() ); XMLTools::XMLAttribute line( _T( "w:line" ), FormatUtils::IntToWideString( abs( lspd.dyaLine ) ));
spacing.AppendAttribute( line ); spacing.AppendAttribute( line );
XMLTools::XMLAttribute lineRule( _T( "w:lineRule" ), _T( "auto" ) ); XMLTools::XMLAttribute lineRule( _T( "w:lineRule" ), _T( "auto" ) );
...@@ -314,7 +314,7 @@ namespace DocFileFormat ...@@ -314,7 +314,7 @@ namespace DocFileFormat
jc = new XMLTools::XMLElement( L"w:jc" ); jc = new XMLTools::XMLElement( L"w:jc" );
if ( jc ) if ( jc )
{ {
XMLTools::XMLAttribute jcVal( L"w:val", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::JustificationCode[0][0], 10, 15 ).c_str() ); XMLTools::XMLAttribute jcVal( L"w:val", FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::JustificationCode[0][0], 10, 15 ));
jc->AppendAttribute( jcVal ); jc->AppendAttribute( jcVal );
} }
}break; }break;
...@@ -438,10 +438,13 @@ namespace DocFileFormat ...@@ -438,10 +438,13 @@ namespace DocFileFormat
}break; }break;
case sprmOldPNLvlAnm: case sprmOldPNLvlAnm:
{ short level = FormatUtils::BytesToUChar( iter->Arguments, 0, iter->argumentsSize) - 1; {
short level = FormatUtils::BytesToUChar( iter->Arguments, 0, iter->argumentsSize) - 1;
if (level > 0 && level < 10) if (level > 0 && level < 10)
appendValueElement( _pPr, _T( "outlineLvl" ), level, false ); appendValueElement( _pPr, _T( "outlineLvl" ), level, false );
}break; case sprmOldPFNoLineNumb: }break;
case sprmOldPFNoLineNumb:
{ {
}break; }break;
...@@ -498,7 +501,7 @@ namespace DocFileFormat ...@@ -498,7 +501,7 @@ namespace DocFileFormat
tab.AppendAttribute( tabsVal ); tab.AppendAttribute( tabsVal );
//position //position
XMLTools::XMLAttribute tabsPos( _T( "w:pos" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, pos, iter->argumentsSize ) ).c_str() ); XMLTools::XMLAttribute tabsPos( _T( "w:pos" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, pos, iter->argumentsSize ) ) );
tab.AppendAttribute( tabsPos ); tab.AppendAttribute( tabsPos );
tabs.AppendChild( tab ); tabs.AppendChild( tab );
...@@ -515,9 +518,9 @@ namespace DocFileFormat ...@@ -515,9 +518,9 @@ namespace DocFileFormat
} }
//read the added tabs //read the added tabs
unsigned char itbdAddMax = iter->Arguments[pos]; unsigned char itbdAddMax = pos < iter->argumentsSize ? iter->Arguments[pos] : 0;
pos++; if (itbdAddMax > 0) pos++;
for ( int i = 0; i < itbdAddMax; i++ ) for ( int i = 0; i < itbdAddMax; i++ )
{ {
...@@ -526,15 +529,15 @@ namespace DocFileFormat ...@@ -526,15 +529,15 @@ namespace DocFileFormat
XMLTools::XMLElement tab( _T( "w:tab" ) ); XMLTools::XMLElement tab( _T( "w:tab" ) );
//justification //justification
XMLTools::XMLAttribute tabsVal( _T( "w:val" ), FormatUtils::MapValueToWideString( tbd.jc, &Global::TabStop[0][0], 7, 8 ).c_str() ); XMLTools::XMLAttribute tabsVal( _T( "w:val" ), FormatUtils::MapValueToWideString( tbd.jc, &Global::TabStop[0][0], 7, 8 ) );
tab.AppendAttribute( tabsVal ); tab.AppendAttribute( tabsVal );
//tab leader type //tab leader type
XMLTools::XMLAttribute leader( _T( "w:leader" ), FormatUtils::MapValueToWideString( tbd.tlc, &Global::TabLeader[0][0], 8, 11 ).c_str() ); XMLTools::XMLAttribute leader( _T( "w:leader" ), FormatUtils::MapValueToWideString( tbd.tlc, &Global::TabLeader[0][0], 8, 11 ) );
tab.AppendAttribute( leader ); tab.AppendAttribute( leader );
//position //position
XMLTools::XMLAttribute tabsPos( _T( "w:pos" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, ( pos + (i * 2) ), iter->argumentsSize ) ).c_str() ); XMLTools::XMLAttribute tabsPos( _T( "w:pos" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, ( pos + (i * 2) ), iter->argumentsSize ) ) );
tab.AppendAttribute( tabsPos ); tab.AppendAttribute( tabsPos );
tabs.AppendChild( tab ); tabs.AppendChild( tab );
...@@ -551,14 +554,14 @@ namespace DocFileFormat ...@@ -551,14 +554,14 @@ namespace DocFileFormat
//position code //position code
unsigned char flag = iter->Arguments[0]; unsigned char flag = iter->Arguments[0];
appendValueAttribute (_framePr, _T( "w:hAnchor" ), FormatUtils::MapValueToWideString( ( ( flag & 0xC0 ) >> 6 ), &Global::HorizontalPositionCode[0][0], 4, 7 ).c_str() ); appendValueAttribute (_framePr, _T( "w:hAnchor" ), FormatUtils::MapValueToWideString( ( ( flag & 0xC0 ) >> 6 ), &Global::HorizontalPositionCode[0][0], 4, 7 ) );
appendValueAttribute (_framePr, _T( "w:vAnchor" ), FormatUtils::MapValueToWideString( ( ( flag & 0x30 ) >> 4 ), &Global::VerticalPositionCode[0][0], 4, 7 ).c_str() ); appendValueAttribute (_framePr, _T( "w:vAnchor" ), FormatUtils::MapValueToWideString( ( ( flag & 0x30 ) >> 4 ), &Global::VerticalPositionCode[0][0], 4, 7 ) );
} }
break; break;
case sprmOldPWr: case sprmOldPWr:
case sprmPWr: case sprmPWr:
appendValueAttribute( _framePr, _T( "w:wrap" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::TextFrameWrapping[0][0], 6, 10 ).c_str() ); appendValueAttribute( _framePr, _T( "w:wrap" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::TextFrameWrapping[0][0], 6, 10 ) );
break; break;
case sprmOldPDxaAbs: case sprmOldPDxaAbs:
...@@ -595,7 +598,7 @@ namespace DocFileFormat ...@@ -595,7 +598,7 @@ namespace DocFileFormat
{ {
short pDcs = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ); short pDcs = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
appendValueAttribute( _framePr, _T( "w:dropCap" ), FormatUtils::MapValueToWideString( ( pDcs & 0x07 ), &Global::TextFrameDropCapLocation[0][0], 3, 7 ).c_str() ); appendValueAttribute( _framePr, _T( "w:dropCap" ), FormatUtils::MapValueToWideString( ( pDcs & 0x07 ), &Global::TextFrameDropCapLocation[0][0], 3, 7 ) );
appendValueAttribute( _framePr, _T( "w:lines" ), (unsigned char)( ( pDcs & 0xF8 ) >> 3 ) ); appendValueAttribute( _framePr, _T( "w:lines" ), (unsigned char)( ( pDcs & 0xF8 ) >> 3 ) );
} }
...@@ -678,7 +681,7 @@ namespace DocFileFormat ...@@ -678,7 +681,7 @@ namespace DocFileFormat
//write Properties //write Properties
if ( ( _pPr->GetChildCount() > 0 ) || ( _pPr->GetAttributeCount() > 0 ) ) if ( ( _pPr->GetChildCount() > 0 ) || ( _pPr->GetAttributeCount() > 0 ) )
{ {
m_pXmlWriter->WriteString( _pPr->GetXMLString().c_str() ); m_pXmlWriter->WriteString( _pPr->GetXMLString() );
} }
} }
} }
...@@ -244,16 +244,16 @@ namespace DocFileFormat ...@@ -244,16 +244,16 @@ namespace DocFileFormat
/*========================================================================================================*/ /*========================================================================================================*/
void PropertiesMapping::appendFlagAttribute( XMLTools::XMLElement* node, const SinglePropertyModifier& sprm, const wchar_t* attributeName ) void PropertiesMapping::appendFlagAttribute( XMLTools::XMLElement* node, const SinglePropertyModifier& sprm, const std::wstring & attributeName )
{ {
XMLTools::XMLAttribute att( attributeName, FormatUtils::IntToWideString( sprm.Arguments[0] ).c_str()); XMLTools::XMLAttribute att( attributeName, FormatUtils::IntToWideString( sprm.Arguments[0] ));
node->AppendAttribute( att ); node->AppendAttribute( att );
} }
/*========================================================================================================*/ /*========================================================================================================*/
void PropertiesMapping::appendFlagElement( XMLTools::XMLElement* node, const SinglePropertyModifier& sprm, const wchar_t* elementName, bool unique ) void PropertiesMapping::appendFlagElement( XMLTools::XMLElement* node, const SinglePropertyModifier& sprm, const std::wstring & elementName, bool unique )
{ {
XMLTools::XMLElement ele( L"w", elementName ); XMLTools::XMLElement ele( L"w", elementName );
...@@ -274,7 +274,7 @@ namespace DocFileFormat ...@@ -274,7 +274,7 @@ namespace DocFileFormat
/*========================================================================================================*/ /*========================================================================================================*/
void PropertiesMapping::appendValueAttribute( XMLTools::XMLElement* node, const wchar_t* attributeName, const wchar_t* attributeValue ) void PropertiesMapping::appendValueAttribute( XMLTools::XMLElement* node, const std::wstring & attributeName, const std::wstring & attributeValue )
{ {
XMLTools::XMLAttribute att( attributeName, attributeValue ); XMLTools::XMLAttribute att( attributeName, attributeValue );
...@@ -283,47 +283,47 @@ namespace DocFileFormat ...@@ -283,47 +283,47 @@ namespace DocFileFormat
/*========================================================================================================*/ /*========================================================================================================*/
void PropertiesMapping::appendValueAttribute( XMLTools::XMLElement* node, const wchar_t* attributeName, int attributeValue ) void PropertiesMapping::appendValueAttribute( XMLTools::XMLElement* node, const std::wstring & attributeName, int attributeValue )
{ {
XMLTools::XMLAttribute att( attributeName, FormatUtils::IntToWideString( attributeValue ).c_str()); XMLTools::XMLAttribute att( attributeName, FormatUtils::IntToWideString( attributeValue ));
node->AppendAttribute( att ); node->AppendAttribute( att );
} }
/*========================================================================================================*/ /*========================================================================================================*/
void PropertiesMapping::appendValueAttribute( XMLTools::XMLElement* node, const wchar_t* attributeName, short attributeValue ) void PropertiesMapping::appendValueAttribute( XMLTools::XMLElement* node, const std::wstring & attributeName, short attributeValue )
{ {
XMLTools::XMLAttribute att( attributeName, FormatUtils::IntToWideString( attributeValue ).c_str()); XMLTools::XMLAttribute att( attributeName, FormatUtils::IntToWideString( attributeValue ));
node->AppendAttribute( att ); node->AppendAttribute( att );
} }
/*========================================================================================================*/ /*========================================================================================================*/
void PropertiesMapping::appendValueAttribute( XMLTools::XMLElement* node, const wchar_t* attributeName, unsigned short attributeValue ) void PropertiesMapping::appendValueAttribute( XMLTools::XMLElement* node, const std::wstring & attributeName, unsigned short attributeValue )
{ {
XMLTools::XMLAttribute att( attributeName, FormatUtils::IntToWideString( attributeValue ).c_str()); XMLTools::XMLAttribute att( attributeName, FormatUtils::IntToWideString( attributeValue ));
node->AppendAttribute( att ); node->AppendAttribute( att );
} }
/*========================================================================================================*/ /*========================================================================================================*/
void PropertiesMapping::appendValueAttribute( XMLTools::XMLElement* node, const wchar_t* attributeName, unsigned char attributeValue ) void PropertiesMapping::appendValueAttribute( XMLTools::XMLElement* node, const std::wstring & attributeName, unsigned char attributeValue )
{ {
XMLTools::XMLAttribute att( attributeName, FormatUtils::IntToWideString( attributeValue ).c_str()); XMLTools::XMLAttribute att( attributeName, FormatUtils::IntToWideString( attributeValue ));
node->AppendAttribute( att ); node->AppendAttribute( att );
} }
/*========================================================================================================*/ /*========================================================================================================*/
void PropertiesMapping::appendValueElement( XMLTools::XMLElement* node, const wchar_t* elementName, const wchar_t* elementValue, bool unique ) void PropertiesMapping::appendValueElement( XMLTools::XMLElement* node, const std::wstring & elementName, const std::wstring & elementValue, bool unique )
{ {
XMLTools::XMLElement* ele = new XMLTools::XMLElement( L"w" , elementName ); XMLTools::XMLElement* ele = new XMLTools::XMLElement( L"w" , elementName );
if( ( elementValue != NULL ) && ( wcscmp( elementValue, L"" ) != 0 )) if(!elementValue.empty())
{ {
XMLTools::XMLAttribute* val = new XMLTools::XMLAttribute( L"w:val" ); XMLTools::XMLAttribute* val = new XMLTools::XMLAttribute( L"w:val" );
...@@ -347,7 +347,7 @@ namespace DocFileFormat ...@@ -347,7 +347,7 @@ namespace DocFileFormat
/*========================================================================================================*/ /*========================================================================================================*/
void PropertiesMapping::appendValueElement( XMLTools::XMLElement* node, const wchar_t* elementName, short elementValue, bool unique ) void PropertiesMapping::appendValueElement( XMLTools::XMLElement* node, const std::wstring & elementName, short elementValue, bool unique )
{ {
XMLTools::XMLElement* ele = new XMLTools::XMLElement( L"w" , elementName ); XMLTools::XMLElement* ele = new XMLTools::XMLElement( L"w" , elementName );
...@@ -355,7 +355,7 @@ namespace DocFileFormat ...@@ -355,7 +355,7 @@ namespace DocFileFormat
if ( strValue != std::wstring( L"")) if ( strValue != std::wstring( L""))
{ {
XMLTools::XMLAttribute* val = new XMLTools::XMLAttribute( L"w:val", strValue.c_str()); XMLTools::XMLAttribute* val = new XMLTools::XMLAttribute( L"w:val", strValue);
ele->AppendAttribute( *val ); ele->AppendAttribute( *val );
RELEASEOBJECT( val ); RELEASEOBJECT( val );
} }
...@@ -373,7 +373,7 @@ namespace DocFileFormat ...@@ -373,7 +373,7 @@ namespace DocFileFormat
/*========================================================================================================*/ /*========================================================================================================*/
void PropertiesMapping::appendValueElement( XMLTools::XMLElement* node, const wchar_t* elementName, unsigned short elementValue, bool unique ) void PropertiesMapping::appendValueElement( XMLTools::XMLElement* node, const std::wstring & elementName, unsigned short elementValue, bool unique )
{ {
XMLTools::XMLElement* ele = new XMLTools::XMLElement( L"w" , elementName ); XMLTools::XMLElement* ele = new XMLTools::XMLElement( L"w" , elementName );
...@@ -381,7 +381,7 @@ namespace DocFileFormat ...@@ -381,7 +381,7 @@ namespace DocFileFormat
if ( strValue != std::wstring( L"" )) if ( strValue != std::wstring( L"" ))
{ {
XMLTools::XMLAttribute* val = new XMLTools::XMLAttribute( L"w:val", strValue.c_str()); XMLTools::XMLAttribute* val = new XMLTools::XMLAttribute( L"w:val", strValue);
ele->AppendAttribute( *val ); ele->AppendAttribute( *val );
RELEASEOBJECT( val ); RELEASEOBJECT( val );
} }
...@@ -399,7 +399,7 @@ namespace DocFileFormat ...@@ -399,7 +399,7 @@ namespace DocFileFormat
/*========================================================================================================*/ /*========================================================================================================*/
void PropertiesMapping::appendValueElement( XMLTools::XMLElement* node, const wchar_t* elementName, unsigned char elementValue, bool unique ) void PropertiesMapping::appendValueElement( XMLTools::XMLElement* node, const std::wstring & elementName, unsigned char elementValue, bool unique )
{ {
XMLTools::XMLElement* ele = new XMLTools::XMLElement( L"w", elementName ); XMLTools::XMLElement* ele = new XMLTools::XMLElement( L"w", elementName );
...@@ -407,7 +407,7 @@ namespace DocFileFormat ...@@ -407,7 +407,7 @@ namespace DocFileFormat
if ( strValue != std::wstring( L"" )) if ( strValue != std::wstring( L"" ))
{ {
XMLTools::XMLAttribute* val = new XMLTools::XMLAttribute( L"w:val", strValue.c_str()); XMLTools::XMLAttribute* val = new XMLTools::XMLAttribute( L"w:val", strValue);
ele->AppendAttribute( *val ); ele->AppendAttribute( *val );
RELEASEOBJECT( val ); RELEASEOBJECT( val );
} }
...@@ -436,17 +436,17 @@ namespace DocFileFormat ...@@ -436,17 +436,17 @@ namespace DocFileFormat
} }
else else
{ {
val.SetValue( getBorderType( brc->brcType ).c_str()); val.SetValue( getBorderType( brc->brcType ));
border->AppendAttribute( val ); border->AppendAttribute( val );
XMLTools::XMLAttribute color( L"w:color" ); XMLTools::XMLAttribute color( L"w:color" );
color.SetValue( RGBColor( brc->cv, RedFirst ).SixDigitHexCode.c_str()); color.SetValue( RGBColor( brc->cv, RedFirst ).SixDigitHexCode);
border->AppendAttribute( color ); border->AppendAttribute( color );
XMLTools::XMLAttribute space( L"w:space" , FormatUtils::IntToWideString( brc->dptSpace ).c_str()); XMLTools::XMLAttribute space( L"w:space" , FormatUtils::IntToWideString( brc->dptSpace ));
border->AppendAttribute( space ); border->AppendAttribute( space );
XMLTools::XMLAttribute sz( L"w:sz", FormatUtils::IntToWideString( brc->dptLineWidth ).c_str()); XMLTools::XMLAttribute sz( L"w:sz", FormatUtils::IntToWideString( brc->dptLineWidth ));
border->AppendAttribute( sz ); border->AppendAttribute( sz );
if ( brc->fShadow ) if ( brc->fShadow )
...@@ -477,12 +477,12 @@ namespace DocFileFormat ...@@ -477,12 +477,12 @@ namespace DocFileFormat
} }
else else
{ {
fill.SetValue( RGBColor( (int)desc.cvBack, RedLast ).SixDigitHexCode.c_str()); fill.SetValue( RGBColor( (int)desc.cvBack, RedLast ).SixDigitHexCode);
} }
} }
else else
{ {
fill.SetValue( FormatUtils::MapValueToWideString( desc.icoBack, &Global::ColorIdentifier[0][0], 17, 12 ).c_str()); fill.SetValue( FormatUtils::MapValueToWideString( desc.icoBack, &Global::ColorIdentifier[0][0], 17, 12 ));
} }
shd.AppendAttribute( fill ); shd.AppendAttribute( fill );
...@@ -498,19 +498,19 @@ namespace DocFileFormat ...@@ -498,19 +498,19 @@ namespace DocFileFormat
} }
else else
{ {
color.SetValue( RGBColor( (int)desc.cvFore, RedLast ).SixDigitHexCode.c_str()); color.SetValue( RGBColor( (int)desc.cvFore, RedLast ).SixDigitHexCode);
} }
} }
else else
{ {
color.SetValue( FormatUtils::MapValueToWideString( desc.icoFore, &Global::ColorIdentifier[0][0], 17, 12 ).c_str()); color.SetValue( FormatUtils::MapValueToWideString( desc.icoFore, &Global::ColorIdentifier[0][0], 17, 12 ));
} }
shd.AppendAttribute( color ); shd.AppendAttribute( color );
//pattern //pattern
XMLTools::XMLAttribute val( L"w:val" ); XMLTools::XMLAttribute val( L"w:val" );
val.SetValue( getShadingPattern( desc ).c_str()); val.SetValue( getShadingPattern( desc ));
shd.AppendAttribute( val ); shd.AppendAttribute( val );
parent->RemoveChildByName( L"w:shd" ); parent->RemoveChildByName( L"w:shd" );
...@@ -759,7 +759,7 @@ namespace DocFileFormat ...@@ -759,7 +759,7 @@ namespace DocFileFormat
/*========================================================================================================*/ /*========================================================================================================*/
void PropertiesMapping::appendDxaElement( XMLTools::XMLElement* node, const wchar_t* elementName, const wchar_t* elementValue, bool unique ) void PropertiesMapping::appendDxaElement( XMLTools::XMLElement* node, const std::wstring & elementName, const std::wstring & elementValue, bool unique )
{ {
XMLTools::XMLElement ele( L"w", elementName ); XMLTools::XMLElement ele( L"w", elementName );
XMLTools::XMLAttribute val( L"w:w", elementValue ); XMLTools::XMLAttribute val( L"w:w", elementValue );
......
...@@ -51,24 +51,26 @@ namespace DocFileFormat ...@@ -51,24 +51,26 @@ namespace DocFileFormat
protected: protected:
static void init(); static void init();
void appendFlagAttribute( XMLTools::XMLElement* node, const SinglePropertyModifier& sprm, const wchar_t* attributeName ); virtual void appendFlagElement( XMLTools::XMLElement* node, const SinglePropertyModifier& sprm, const std::wstring & elementName, bool unique );
virtual void appendFlagElement( XMLTools::XMLElement* node, const SinglePropertyModifier& sprm, const wchar_t* elementName, bool unique ); void appendFlagAttribute ( XMLTools::XMLElement* node, const SinglePropertyModifier& sprm, const std::wstring & attributeName );
void appendValueAttribute( XMLTools::XMLElement* node, const wchar_t* attributeName, const wchar_t* attributeValue );
void appendValueAttribute( XMLTools::XMLElement* node, const wchar_t* attributeName, int attributeValue );
void appendValueAttribute( XMLTools::XMLElement* node, const wchar_t* attributeName, short attributeValue );
void appendValueAttribute( XMLTools::XMLElement* node, const wchar_t* attributeName, unsigned short attributeValue );
void appendValueAttribute( XMLTools::XMLElement* node, const wchar_t* attributeName, unsigned char attributeValue );
void appendValueElement( XMLTools::XMLElement* node, const wchar_t* elementName, const wchar_t* elementValue, bool unique );
void appendValueElement( XMLTools::XMLElement* node, const wchar_t* elementName, short elementValue, bool unique );
void appendValueElement( XMLTools::XMLElement* node, const wchar_t* elementName, unsigned short elementValue, bool unique );
void appendValueElement( XMLTools::XMLElement* node, const wchar_t* elementName, unsigned char elementValue, bool unique );
void appendBorderAttributes( BorderCode* brc, XMLTools::XMLElement* border );
void appendShading( XMLTools::XMLElement* parent, const ShadingDescriptor& desc );
std::wstring getBorderType( unsigned char type );
std::wstring getShadingPattern( const ShadingDescriptor& shd );
void appendDxaElement( XMLTools::XMLElement* node, const wchar_t* elementName, const wchar_t* elementValue, bool unique );
void addOrSetBorder( XMLTools::XMLElement* pBdr, const XMLTools::XMLElement* border );
void appendValueAttribute ( XMLTools::XMLElement* node, const std::wstring & attributeName, const std::wstring & attributeValue );
void appendValueAttribute ( XMLTools::XMLElement* node, const std::wstring & attributeName, int attributeValue );
void appendValueAttribute ( XMLTools::XMLElement* node, const std::wstring & ttributeName, short attributeValue );
void appendValueAttribute ( XMLTools::XMLElement* node, const std::wstring & attributeName, unsigned short attributeValue );
void appendValueAttribute ( XMLTools::XMLElement* node, const std::wstring & attributeName, unsigned char attributeValue );
void appendValueElement ( XMLTools::XMLElement* node, const std::wstring & elementName, const std::wstring & elementValue, bool unique );
void appendValueElement ( XMLTools::XMLElement* node, const std::wstring & elementName, short elementValue, bool unique );
void appendValueElement ( XMLTools::XMLElement* node, const std::wstring & elementName, unsigned short elementValue, bool unique );
void appendValueElement ( XMLTools::XMLElement* node, const std::wstring & elementName, unsigned char elementValue, bool unique );
void appendShading ( XMLTools::XMLElement* parent, const ShadingDescriptor& desc );
void appendDxaElement ( XMLTools::XMLElement* node, const std::wstring & elementName, const std::wstring & elementValue, bool unique );
void addOrSetBorder ( XMLTools::XMLElement* pBdr, const XMLTools::XMLElement* border );
void appendBorderAttributes ( BorderCode* brc, XMLTools::XMLElement* border );
std::wstring getBorderType ( unsigned char type );
std::wstring getShadingPattern ( const ShadingDescriptor& shd );
protected: protected:
XMLTools::CStringXmlWriter* m_pXmlWriter; XMLTools::CStringXmlWriter* m_pXmlWriter;
......
...@@ -157,7 +157,7 @@ namespace DocFileFormat ...@@ -157,7 +157,7 @@ namespace DocFileFormat
case sprmSDxaLeft: case sprmSDxaLeft:
{ {
_marLeft = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ); _marLeft = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
appendValueAttribute( &pgMar, _T( "w:left" ), FormatUtils::IntToWideString( _marLeft ).c_str() ); appendValueAttribute( &pgMar, _T( "w:left" ), FormatUtils::IntToWideString( _marLeft ) );
} }
break; break;
...@@ -165,38 +165,38 @@ namespace DocFileFormat ...@@ -165,38 +165,38 @@ namespace DocFileFormat
case sprmSDxaRight: case sprmSDxaRight:
{ {
_marRight = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ); _marRight = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
appendValueAttribute( &pgMar, _T( "w:right" ), FormatUtils::IntToWideString( _marRight ).c_str() ); appendValueAttribute( &pgMar, _T( "w:right" ), FormatUtils::IntToWideString( _marRight ) );
} }
break; break;
case sprmOldSDyaTop: case sprmOldSDyaTop:
case sprmSDyaTop: case sprmSDyaTop:
//top margin //top margin
appendValueAttribute( &pgMar, _T( "w:top" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() ); appendValueAttribute( &pgMar, _T( "w:top" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ) );
break; break;
case sprmOldSDyaBottom: case sprmOldSDyaBottom:
case sprmSDyaBottom: case sprmSDyaBottom:
//bottom margin //bottom margin
appendValueAttribute( &pgMar, _T( "w:bottom" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() ); appendValueAttribute( &pgMar, _T( "w:bottom" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ) );
break; break;
case sprmOldSDzaGutter: case sprmOldSDzaGutter:
case sprmSDzaGutter: case sprmSDzaGutter:
//gutter margin //gutter margin
appendValueAttribute( &pgMar, _T( "w:gutter" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() ); appendValueAttribute( &pgMar, _T( "w:gutter" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ) );
break; break;
case sprmOldSDyaHdrTop: case sprmOldSDyaHdrTop:
case sprmSDyaHdrTop: case sprmSDyaHdrTop:
//header margin //header margin
appendValueAttribute( &pgMar, _T( "w:header"), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() ); appendValueAttribute( &pgMar, _T( "w:header"), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ) );
break; break;
case sprmOldSDyaHdrBottom: case sprmOldSDyaHdrBottom:
case sprmSDyaHdrBottom: case sprmSDyaHdrBottom:
//footer margin //footer margin
appendValueAttribute( &pgMar, _T( "w:footer" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() ); appendValueAttribute( &pgMar, _T( "w:footer" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ) );
break; break;
//page size and orientation //page size and orientation
...@@ -204,30 +204,30 @@ namespace DocFileFormat ...@@ -204,30 +204,30 @@ namespace DocFileFormat
case sprmSXaPage: case sprmSXaPage:
{ {
_pgWidth = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ); _pgWidth = FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize );
appendValueAttribute( &pgSz, _T( "w:w" ), FormatUtils::IntToWideString( _pgWidth ).c_str() ); appendValueAttribute( &pgSz, _T( "w:w" ), FormatUtils::IntToWideString( _pgWidth ) );
} }
break; break;
case sprmOldSYaPage: case sprmOldSYaPage:
case sprmSYaPage: case sprmSYaPage:
appendValueAttribute( &pgSz, _T( "w:h" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() ); appendValueAttribute( &pgSz, _T( "w:h" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ) );
break; break;
case sprmOldSBOrientation: case sprmOldSBOrientation:
case sprmSBOrientation: case sprmSBOrientation:
//orientation //orientation
appendValueAttribute( &pgSz, _T( "w:orient" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &PageOrientationMap[0][0], 3, 10 ).c_str() ); appendValueAttribute( &pgSz, _T( "w:orient" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &PageOrientationMap[0][0], 3, 10 ) );
break; break;
//paper source //paper source
case sprmOldSDmBinFirst: case sprmOldSDmBinFirst:
case sprmSDmBinFirst: case sprmSDmBinFirst:
appendValueAttribute( &paperSrc, _T( "w:first" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() ); appendValueAttribute( &paperSrc, _T( "w:first" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ) );
break; break;
case sprmOldSDmBinOther: case sprmOldSDmBinOther:
case sprmSDmBinOther: case sprmSDmBinOther:
appendValueAttribute( &paperSrc, _T( "w:other" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() ); appendValueAttribute( &paperSrc, _T( "w:other" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ) );
break; break;
//page borders //page borders
...@@ -276,12 +276,12 @@ namespace DocFileFormat ...@@ -276,12 +276,12 @@ namespace DocFileFormat
case sprmSRncFtn: case sprmSRncFtn:
//restart code //restart code
appendValueElement( &footnotePr, _T( "numRestart" ), FormatUtils::MapValueToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ), &FootnoteRestartCodeMap[0][0], 3, 11 ).c_str(), true ); appendValueElement( &footnotePr, _T( "numRestart" ), FormatUtils::MapValueToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ), &FootnoteRestartCodeMap[0][0], 3, 11 ), true );
break; break;
case sprmSRncEdn: case sprmSRncEdn:
//restart code //restart code
appendValueElement( &endnotePr, _T( "numRestart" ), FormatUtils::MapValueToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ), &EndnoteRestartCodeMap[0][0], 3, 11 ).c_str(), true ); appendValueElement( &endnotePr, _T( "numRestart" ), FormatUtils::MapValueToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ), &EndnoteRestartCodeMap[0][0], 3, 11 ), true );
break; break;
case sprmSFpc: case sprmSFpc:
...@@ -305,31 +305,31 @@ namespace DocFileFormat ...@@ -305,31 +305,31 @@ namespace DocFileFormat
}break; }break;
case sprmSNfcFtnRef: case sprmSNfcFtnRef:
appendValueElement( &footnotePr, _T( "numFmt" ), NumberingMapping::GetNumberFormatWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true ); appendValueElement( &footnotePr, _T( "numFmt" ), NumberingMapping::GetNumberFormatWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
break; break;
case sprmSNfcEdnRef: case sprmSNfcEdnRef:
appendValueElement( &endnotePr, _T( "numFmt" ), NumberingMapping::GetNumberFormatWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true ); appendValueElement( &endnotePr, _T( "numFmt" ), NumberingMapping::GetNumberFormatWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
break; break;
case sprmSNFtn: case sprmSNFtn:
appendValueElement( &footnotePr, _T( "numStart" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true ); appendValueElement( &footnotePr, _T( "numStart" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
break; break;
case sprmSNEdn: case sprmSNEdn:
appendValueElement( &endnotePr, _T( "numStart" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true ); appendValueElement( &endnotePr, _T( "numStart" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ), true );
break; break;
case sprmSDyaLinePitch: case sprmSDyaLinePitch:
appendValueAttribute( &docGrid, _T( "w:linePitch" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() ); appendValueAttribute( &docGrid, _T( "w:linePitch" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ) );
break; break;
case sprmSDxtCharSpace: case sprmSDxtCharSpace:
appendValueAttribute( &docGrid, _T( "w:charSpace" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize ) ).c_str() ); appendValueAttribute( &docGrid, _T( "w:charSpace" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize ) ) );
break; break;
case sprmSClm: case sprmSClm:
appendValueAttribute( &docGrid, _T( "w:type" ), FormatUtils::MapValueToWideString( FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize ), &DocGridTypeMap[0][0], 4, 14 ).c_str() ); appendValueAttribute( &docGrid, _T( "w:type" ), FormatUtils::MapValueToWideString( FormatUtils::BytesToUInt16( iter->Arguments, 0, iter->argumentsSize ), &DocGridTypeMap[0][0], 4, 14 ) );
break; break;
case sprmOldSCcolumns: case sprmOldSCcolumns:
...@@ -340,14 +340,14 @@ namespace DocFileFormat ...@@ -340,14 +340,14 @@ namespace DocFileFormat
RELEASEARRAYOBJECTS (m_arrSpace); RELEASEARRAYOBJECTS (m_arrSpace);
m_arrSpace = new short [m_nColumns]; m_arrSpace = new short [m_nColumns];
appendValueAttribute (&cols, _T( "w:num" ), FormatUtils::IntToWideString (m_nColumns).c_str()); appendValueAttribute (&cols, _T( "w:num" ), FormatUtils::IntToWideString (m_nColumns));
} }
break; break;
case sprmOldSDxaColumns: case sprmOldSDxaColumns:
case sprmSDxaColumns: case sprmSDxaColumns:
//evenly spaced columns //evenly spaced columns
appendValueAttribute (&cols, _T( "w:space" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ).c_str() ); appendValueAttribute (&cols, _T( "w:space" ), FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 0, iter->argumentsSize ) ) );
break; break;
case sprmOldSDxaColWidth: case sprmOldSDxaColWidth:
...@@ -403,12 +403,12 @@ namespace DocFileFormat ...@@ -403,12 +403,12 @@ namespace DocFileFormat
case sprmOldSVjc: case sprmOldSVjc:
case sprmSVjc: case sprmSVjc:
appendValueElement (m_pXmlNode, _T( "vAlign" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &TextVerticalAlignment[0][0], 4, 7 ).c_str(), true ); appendValueElement (m_pXmlNode, _T( "vAlign" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &TextVerticalAlignment[0][0], 4, 7 ), true );
break; break;
case sprmOldSNfcPgn: case sprmOldSNfcPgn:
case sprmSNfcPgn: case sprmSNfcPgn:
appendValueAttribute( &pgNumType, _T( "w:fmt" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &PageNumberFormatCodeMap[0][0], 42, 29 ).c_str() ); appendValueAttribute( &pgNumType, _T( "w:fmt" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &PageNumberFormatCodeMap[0][0], 42, 29 ) );
break; break;
case sprmOldSPgnStart: case sprmOldSPgnStart:
...@@ -439,7 +439,7 @@ namespace DocFileFormat ...@@ -439,7 +439,7 @@ namespace DocFileFormat
SLncOperand mode = (SLncOperand)FormatUtils::BytesToUChar (iter->Arguments, 0, iter->argumentsSize); SLncOperand mode = (SLncOperand)FormatUtils::BytesToUChar (iter->Arguments, 0, iter->argumentsSize);
mode = (SLncOperand)(std::min)((std::max)(mode,lncPerPage),lncContinue); mode = (SLncOperand)(std::min)((std::max)(mode,lncPerPage),lncContinue);
appendValueAttribute (&lnNumType, _T("w:restart"), LineNumberRestart[mode].c_str() ); appendValueAttribute (&lnNumType, _T("w:restart"), LineNumberRestart[mode] );
} }
break; break;
...@@ -461,7 +461,7 @@ namespace DocFileFormat ...@@ -461,7 +461,7 @@ namespace DocFileFormat
} }
if (bWasSprmSFPgnRestart && false == wsSprmSPgnStart.empty() ) if (bWasSprmSFPgnRestart && false == wsSprmSPgnStart.empty() )
appendValueAttribute( &pgNumType, _T( "w:start" ), wsSprmSPgnStart.c_str() ); appendValueAttribute( &pgNumType, _T( "w:start" ), wsSprmSPgnStart );
// build the columns // build the columns
if (m_arrWidth) if (m_arrWidth)
...@@ -487,8 +487,8 @@ namespace DocFileFormat ...@@ -487,8 +487,8 @@ namespace DocFileFormat
for (int i = 0; i < m_nColumns; ++i) for (int i = 0; i < m_nColumns; ++i)
{ {
XMLTools::XMLElement col (_T( "w:col" )); XMLTools::XMLElement col (_T( "w:col" ));
XMLTools::XMLAttribute w (_T( "w:w" ), FormatUtils::IntToWideString (m_arrWidth[i]).c_str()); XMLTools::XMLAttribute w (_T( "w:w" ), FormatUtils::IntToWideString (m_arrWidth[i]));
XMLTools::XMLAttribute space (_T( "w:space" ), FormatUtils::IntToWideString (m_arrSpace[i]).c_str()); XMLTools::XMLAttribute space (_T( "w:space" ), FormatUtils::IntToWideString (m_arrSpace[i]));
col.AppendAttribute (w); col.AppendAttribute (w);
col.AppendAttribute (space); col.AppendAttribute (space);
...@@ -496,7 +496,7 @@ namespace DocFileFormat ...@@ -496,7 +496,7 @@ namespace DocFileFormat
} }
} }
appendValueElement (m_pXmlNode, _T( "type" ), _type.c_str(), true ); appendValueElement (m_pXmlNode, _T( "type" ), _type, true );
if (footnotePr.GetChildCount()) if (footnotePr.GetChildCount())
m_pXmlNode->AppendChild (footnotePr); m_pXmlNode->AppendChild (footnotePr);
...@@ -529,10 +529,10 @@ namespace DocFileFormat ...@@ -529,10 +529,10 @@ namespace DocFileFormat
m_pXmlNode->AppendChild (pgNumType); m_pXmlNode->AppendChild (pgNumType);
if (m_pXmlWriter) if (m_pXmlWriter)
m_pXmlWriter->WriteString (m_pXmlNode->GetXMLString().c_str() ); m_pXmlWriter->WriteString (m_pXmlNode->GetXMLString() );
} }
void SectionPropertiesMapping::AppendRef (XMLTools::XMLElement *parent, const wchar_t* element, const wchar_t* refType, const wchar_t* refId) void SectionPropertiesMapping::AppendRef (XMLTools::XMLElement *parent, const std::wstring& element, const std::wstring& refType, const std::wstring& refId)
{ {
XMLTools::XMLElement headerRef (_T("w"), element); XMLTools::XMLElement headerRef (_T("w"), element);
...@@ -576,7 +576,7 @@ namespace DocFileFormat ...@@ -576,7 +576,7 @@ namespace DocFileFormat
} }
} }
AppendRef (m_pXmlNode, StoryType.c_str(), Story.c_str(), ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString(nRelID) ).c_str() ); AppendRef (m_pXmlNode, StoryType, Story, ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString(nRelID) ) );
return TRUE; return TRUE;
} }
......
...@@ -167,7 +167,7 @@ namespace DocFileFormat ...@@ -167,7 +167,7 @@ namespace DocFileFormat
const std::wstring & get_section_type(); const std::wstring & get_section_type();
private: private:
void AppendRef (XMLTools::XMLElement* pBaseNode, const wchar_t* element, const wchar_t* refType, const wchar_t* refId); void AppendRef (XMLTools::XMLElement* pBaseNode, const std::wstring& element, const std::wstring& refType, const std::wstring& refId);
bool WriteSectionStory (CharacterRange* pRange, const std::wstring& StoryType, const std::wstring& Story); bool WriteSectionStory (CharacterRange* pRange, const std::wstring& StoryType, const std::wstring& Story);
......
...@@ -56,11 +56,11 @@ namespace DocFileFormat ...@@ -56,11 +56,11 @@ namespace DocFileFormat
//zoom //zoom
m_oXmlWriter.WriteNodeBegin ( L"w:zoom", TRUE ); m_oXmlWriter.WriteNodeBegin ( L"w:zoom", TRUE );
m_oXmlWriter.WriteAttribute ( L"w:percent", FormatUtils::IntToWideString( dop->wScaleSaved ).c_str() ); m_oXmlWriter.WriteAttribute ( L"w:percent", FormatUtils::IntToWideString( dop->wScaleSaved ) );
if ( dop->zkSaved != 0 ) if ( dop->zkSaved != 0 )
{ {
m_oXmlWriter.WriteAttribute( L"w:val", FormatUtils::MapValueToWideString( dop->zkSaved, &ZoomTypeMap[0][0], 3, 9 ).c_str() ); m_oXmlWriter.WriteAttribute( L"w:val", FormatUtils::MapValueToWideString( dop->zkSaved, &ZoomTypeMap[0][0], 3, 9 ) );
} }
m_oXmlWriter.WriteNodeEnd( L"", TRUE ); m_oXmlWriter.WriteNodeEnd( L"", TRUE );
...@@ -104,31 +104,31 @@ namespace DocFileFormat ...@@ -104,31 +104,31 @@ namespace DocFileFormat
if ( proofState.GetAttributeCount() > 0 ) if ( proofState.GetAttributeCount() > 0 )
{ {
m_oXmlWriter.WriteString( proofState.GetXMLString().c_str() ); m_oXmlWriter.WriteString( proofState.GetXMLString() );
} }
//stylePaneFormatFilter //stylePaneFormatFilter
if ( dop->grfFmtFilter != 0 ) if ( dop->grfFmtFilter != 0 )
{ {
m_oXmlWriter.WriteNodeBegin( L"w:stylePaneFormatFilter", TRUE ); m_oXmlWriter.WriteNodeBegin( L"w:stylePaneFormatFilter", TRUE );
m_oXmlWriter.WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( dop->grfFmtFilter, L"%04x" ).c_str() ); m_oXmlWriter.WriteAttribute( L"w:val", FormatUtils::IntToFormattedWideString( dop->grfFmtFilter, L"%04x" ) );
m_oXmlWriter.WriteNodeEnd( L"", TRUE ); m_oXmlWriter.WriteNodeEnd( L"", TRUE );
} }
//default tab stop //default tab stop
m_oXmlWriter.WriteNodeBegin( L"w:defaultTabStop", TRUE ); m_oXmlWriter.WriteNodeBegin( L"w:defaultTabStop", TRUE );
m_oXmlWriter.WriteAttribute( L"w:val", FormatUtils::IntToWideString( dop->dxaTab ).c_str() ); m_oXmlWriter.WriteAttribute( L"w:val", FormatUtils::IntToWideString( dop->dxaTab ) );
m_oXmlWriter.WriteNodeEnd( L"", TRUE ); m_oXmlWriter.WriteNodeEnd( L"", TRUE );
//drawing grid //drawing grid
if( dop->dogrid != NULL ) if( dop->dogrid != NULL )
{ {
m_oXmlWriter.WriteNodeBegin( L"w:displayHorizontalDrawingGridEvery", TRUE ); m_oXmlWriter.WriteNodeBegin( L"w:displayHorizontalDrawingGridEvery", TRUE );
m_oXmlWriter.WriteAttribute( L"w:val", FormatUtils::IntToWideString( dop->dogrid->dxGridDisplay ).c_str() ); m_oXmlWriter.WriteAttribute( L"w:val", FormatUtils::IntToWideString( dop->dogrid->dxGridDisplay ) );
m_oXmlWriter.WriteNodeEnd( L"", TRUE ); m_oXmlWriter.WriteNodeEnd( L"", TRUE );
m_oXmlWriter.WriteNodeBegin( L"w:displayVerticalDrawingGridEvery", TRUE ); m_oXmlWriter.WriteNodeBegin( L"w:displayVerticalDrawingGridEvery", TRUE );
m_oXmlWriter.WriteAttribute( L"w:val", FormatUtils::IntToWideString( dop->dogrid->dyGridDisplay ).c_str() ); m_oXmlWriter.WriteAttribute( L"w:val", FormatUtils::IntToWideString( dop->dogrid->dyGridDisplay ) );
m_oXmlWriter.WriteNodeEnd( L"", TRUE ); m_oXmlWriter.WriteNodeEnd( L"", TRUE );
if ( dop->dogrid->fFollowMargins == false ) if ( dop->dogrid->fFollowMargins == false )
...@@ -153,22 +153,22 @@ namespace DocFileFormat ...@@ -153,22 +153,22 @@ namespace DocFileFormat
if ( dop->nFtn != 0 ) if ( dop->nFtn != 0 )
{ {
appendValueAttribute( &footnotePr, L"w:numStart", FormatUtils::IntToWideString( dop->nFtn ).c_str() ); appendValueAttribute( &footnotePr, L"w:numStart", FormatUtils::IntToWideString( dop->nFtn ) );
} }
if ( dop->rncFtn != 0 ) if ( dop->rncFtn != 0 )
{ {
appendValueAttribute( &footnotePr, L"w:numRestart", FormatUtils::IntToWideString( dop->rncFtn ).c_str() ); appendValueAttribute( &footnotePr, L"w:numRestart", FormatUtils::IntToWideString( dop->rncFtn ) );
} }
if ( dop->Fpc != 0 ) if ( dop->Fpc != 0 )
{ {
appendValueAttribute( &footnotePr, L"w:pos", FormatUtils::MapValueToWideString( dop->Fpc, &FootnotePositionMap[0][0], 4, 12 ).c_str() ); appendValueAttribute( &footnotePr, L"w:pos", FormatUtils::MapValueToWideString( dop->Fpc, &FootnotePositionMap[0][0], 4, 12 ) );
} }
if ( footnotePr.GetAttributeCount() > 0 ) if ( footnotePr.GetAttributeCount() > 0 )
{ {
m_oXmlWriter.WriteString( footnotePr.GetXMLString().c_str() ); m_oXmlWriter.WriteString( footnotePr.GetXMLString() );
} }
......
...@@ -86,7 +86,7 @@ namespace DocFileFormat ...@@ -86,7 +86,7 @@ namespace DocFileFormat
{ {
m_pXmlWriter->WriteNodeBegin( _T( "w:style" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:style" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:type" ), FormatUtils::MapValueToWideString( (*iter)->stk, &StyleKindMap[0][0], 5, 10 ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:type" ), FormatUtils::MapValueToWideString( (*iter)->stk, &StyleKindMap[0][0], 5, 10 ));
//!!!TODO: There is NO default styles in DOC file. So, we can't choose one of them!!! //!!!TODO: There is NO default styles in DOC file. So, we can't choose one of them!!!
/*if ( ( (*iter)->sti != Null ) && ( (*iter)->sti != User ) ) /*if ( ( (*iter)->sti != Null ) && ( (*iter)->sti != User ) )
...@@ -95,19 +95,19 @@ namespace DocFileFormat ...@@ -95,19 +95,19 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute( _T( "w:default" ), _T( "1" ) ); m_pXmlWriter->WriteAttribute( _T( "w:default" ), _T( "1" ) );
}*/ }*/
m_pXmlWriter->WriteAttribute( _T( "w:styleId" ), FormatUtils::XmlEncode(MakeStyleId( *iter )).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:styleId" ), FormatUtils::XmlEncode(MakeStyleId( *iter )));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
// <w:name val="" /> // <w:name val="" />
m_pXmlWriter->WriteNodeBegin( _T( "w:name" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:name" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::XmlEncode(getStyleName( *iter ), true ).c_str()); m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::XmlEncode(getStyleName( *iter ), true ));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
// <w:basedOn val="" /> // <w:basedOn val="" />
if ( ( (*iter)->istdBase != 4095 ) && ( (*iter)->istdBase < sheet->Styles->size() ) ) if ( ( (*iter)->istdBase != 4095 ) && ( (*iter)->istdBase < sheet->Styles->size() ) )
{ {
m_pXmlWriter->WriteNodeBegin( _T( "w:basedOn" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:basedOn" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::XmlEncode(MakeStyleId( sheet->Styles->at( (*iter)->istdBase ) )).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::XmlEncode(MakeStyleId( sheet->Styles->at( (*iter)->istdBase ) )));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
} }
...@@ -115,7 +115,7 @@ namespace DocFileFormat ...@@ -115,7 +115,7 @@ namespace DocFileFormat
if ( (*iter)->istdNext < sheet->Styles->size() ) if ( (*iter)->istdNext < sheet->Styles->size() )
{ {
m_pXmlWriter->WriteNodeBegin( _T( "w:next" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:next" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::XmlEncode(MakeStyleId( sheet->Styles->at( (*iter)->istdNext ) )).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::XmlEncode(MakeStyleId( sheet->Styles->at( (*iter)->istdNext ) )));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
} }
...@@ -123,7 +123,7 @@ namespace DocFileFormat ...@@ -123,7 +123,7 @@ namespace DocFileFormat
if ( (*iter)->istdLink < sheet->Styles->size() ) if ( (*iter)->istdLink < sheet->Styles->size() )
{ {
m_pXmlWriter->WriteNodeBegin( _T( "w:link" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:link" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::XmlEncode(MakeStyleId( sheet->Styles->at( (*iter)->istdLink ) )).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:val" ), FormatUtils::XmlEncode(MakeStyleId( sheet->Styles->at( (*iter)->istdLink ) )));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE );
} }
...@@ -242,19 +242,19 @@ namespace DocFileFormat ...@@ -242,19 +242,19 @@ namespace DocFileFormat
FontFamilyName* ffnAscii = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[0] ) ); FontFamilyName* ffnAscii = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[0] ) );
if (ffnAscii) if (ffnAscii)
m_pXmlWriter->WriteAttribute( _T( "w:ascii" ), FormatUtils::XmlEncode(ffnAscii->xszFtn).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:ascii" ), FormatUtils::XmlEncode(ffnAscii->xszFtn, true));
FontFamilyName* ffnAsia = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[1] ) ); FontFamilyName* ffnAsia = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[1] ) );
if (ffnAsia) if (ffnAsia)
m_pXmlWriter->WriteAttribute( _T( "w:eastAsia" ), FormatUtils::XmlEncode(ffnAsia->xszFtn).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:eastAsia" ), FormatUtils::XmlEncode(ffnAsia->xszFtn, true));
FontFamilyName* ffnAnsi = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[2] ) ); FontFamilyName* ffnAnsi = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[2] ) );
if (ffnAnsi) if (ffnAnsi)
m_pXmlWriter->WriteAttribute( _T( "w:hAnsi" ), FormatUtils::XmlEncode(ffnAnsi->xszFtn).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:hAnsi" ), FormatUtils::XmlEncode(ffnAnsi->xszFtn, true));
FontFamilyName* ffnComplex = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[3] ) ); FontFamilyName* ffnComplex = static_cast<FontFamilyName*>( m_document->FontTable->operator [] ( sheet->stshi->rgftcStandardChpStsh[3] ) );
if (ffnComplex) if (ffnComplex)
m_pXmlWriter->WriteAttribute( _T( "w:cs" ), FormatUtils::XmlEncode(ffnComplex->xszFtn).c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:cs" ), FormatUtils::XmlEncode(ffnComplex->xszFtn, true));
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_pXmlWriter->WriteNodeEnd( _T( "w:rFonts" ) ); m_pXmlWriter->WriteNodeEnd( _T( "w:rFonts" ) );
...@@ -263,7 +263,7 @@ namespace DocFileFormat ...@@ -263,7 +263,7 @@ namespace DocFileFormat
std::wstring langcode = LanguageIdMapping::getLanguageCode( &langid ); std::wstring langcode = LanguageIdMapping::getLanguageCode( &langid );
m_pXmlWriter->WriteNodeBegin( _T( "w:lang" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "w:lang" ), TRUE );
m_pXmlWriter->WriteAttribute( _T( "w:val" ), langcode.c_str() ); m_pXmlWriter->WriteAttribute( _T( "w:val" ), langcode);
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_pXmlWriter->WriteNodeEnd( _T( "w:lang" ) ); m_pXmlWriter->WriteNodeEnd( _T( "w:lang" ) );
......
...@@ -89,7 +89,7 @@ namespace DocFileFormat ...@@ -89,7 +89,7 @@ namespace DocFileFormat
_tGrid = tdef.rgdxaCenter; _tGrid = tdef.rgdxaCenter;
_tcDef = tdef.rgTc80[(std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1)]; // NOTE: fix for crash _tcDef = tdef.rgTc80[(std::min)(_cellIndex, (int)tdef.rgTc80.size() - 1)]; // NOTE: fix for crash
appendValueElement( _tcPr, L"textDirection", FormatUtils::MapValueToWideString( _tcDef.textFlow, &Global::TextFlowMap[0][0], 6, 6 ).c_str(), false ); appendValueElement( _tcPr, L"textDirection", FormatUtils::MapValueToWideString( _tcDef.textFlow, &Global::TextFlowMap[0][0], 6, 6 ), false );
if ( _tcDef.vertMerge == Global::fvmMerge ) if ( _tcDef.vertMerge == Global::fvmMerge )
{ {
...@@ -100,7 +100,7 @@ namespace DocFileFormat ...@@ -100,7 +100,7 @@ namespace DocFileFormat
appendValueElement( _tcPr, L"vMerge", L"restart", false ); appendValueElement( _tcPr, L"vMerge", L"restart", false );
} }
appendValueElement( _tcPr, L"vAlign", FormatUtils::MapValueToWideString( _tcDef.vertAlign, &Global::VerticalAlignMap[0][0], 3, 7 ).c_str(), false ); appendValueElement( _tcPr, L"vAlign", FormatUtils::MapValueToWideString( _tcDef.vertAlign, &Global::VerticalAlignMap[0][0], 3, 7 ), false );
if ( _tcDef.fFitText ) if ( _tcDef.fFitText )
{ {
...@@ -145,22 +145,22 @@ namespace DocFileFormat ...@@ -145,22 +145,22 @@ namespace DocFileFormat
{ {
if ( FormatUtils::GetBitFromInt( iter->Arguments[2], 0 ) == true ) if ( FormatUtils::GetBitFromInt( iter->Arguments[2], 0 ) == true )
{ {
appendDxaElement( _tcMar, L"top", FormatUtils::IntToWideString( wMargin ).c_str(), true ); appendDxaElement( _tcMar, L"top", FormatUtils::IntToWideString( wMargin ), true );
} }
if ( FormatUtils::GetBitFromInt( iter->Arguments[2], 1 ) == true ) if ( FormatUtils::GetBitFromInt( iter->Arguments[2], 1 ) == true )
{ {
appendDxaElement( _tcMar, L"left", FormatUtils::IntToWideString( wMargin ).c_str(), true ); appendDxaElement( _tcMar, L"left", FormatUtils::IntToWideString( wMargin ), true );
} }
if ( FormatUtils::GetBitFromInt( iter->Arguments[2], 2 ) == true ) if ( FormatUtils::GetBitFromInt( iter->Arguments[2], 2 ) == true )
{ {
appendDxaElement( _tcMar, L"bottom", FormatUtils::IntToWideString( wMargin ).c_str(), true ); appendDxaElement( _tcMar, L"bottom", FormatUtils::IntToWideString( wMargin ), true );
} }
if ( FormatUtils::GetBitFromInt( iter->Arguments[2], 3 ) == true ) if ( FormatUtils::GetBitFromInt( iter->Arguments[2], 3 ) == true )
{ {
appendDxaElement( _tcMar, L"right", FormatUtils::IntToWideString( wMargin ).c_str(), true ); appendDxaElement( _tcMar, L"right", FormatUtils::IntToWideString( wMargin ), true );
} }
} }
} }
...@@ -210,7 +210,7 @@ namespace DocFileFormat ...@@ -210,7 +210,7 @@ namespace DocFileFormat
if ((_cellIndex >= first) && (_cellIndex < lim)) if ((_cellIndex >= first) && (_cellIndex < lim))
{ {
appendValueElement(_tcPr, L"vAlign", FormatUtils::MapValueToWideString( (VerticalCellAlignment)iter->Arguments[2], &VerticalCellAlignmentMap[0][0], 3, 7 ).c_str(), true ); appendValueElement(_tcPr, L"vAlign", FormatUtils::MapValueToWideString( (VerticalCellAlignment)iter->Arguments[2], &VerticalCellAlignmentMap[0][0], 3, 7 ), true );
} }
} }
break; break;
...@@ -222,7 +222,7 @@ namespace DocFileFormat ...@@ -222,7 +222,7 @@ namespace DocFileFormat
if ( ( _cellIndex >= first ) && ( _cellIndex < lim ) ) if ( ( _cellIndex >= first ) && ( _cellIndex < lim ) )
{ {
appendValueElement( _tcPr, L"tcFitText", FormatUtils::IntToWideString( iter->Arguments[2] ).c_str(), true ); appendValueElement( _tcPr, L"tcFitText", FormatUtils::IntToWideString( iter->Arguments[2] ), true );
} }
} }
break; break;
...@@ -299,7 +299,7 @@ namespace DocFileFormat ...@@ -299,7 +299,7 @@ namespace DocFileFormat
} }
} }
appendValueElement( _tcPr, L"gridSpan", FormatUtils::IntToWideString( _gridSpan ).c_str(), true ); appendValueElement( _tcPr, L"gridSpan", FormatUtils::IntToWideString( _gridSpan ), true );
} }
//append margins //append margins
...@@ -344,7 +344,7 @@ namespace DocFileFormat ...@@ -344,7 +344,7 @@ namespace DocFileFormat
//write Properties //write Properties
if ((_tcPr->GetChildCount() > 0) || (_tcPr->GetAttributeCount() > 0)) if ((_tcPr->GetChildCount() > 0) || (_tcPr->GetAttributeCount() > 0))
m_pXmlWriter->WriteString(_tcPr->GetXMLString().c_str()); m_pXmlWriter->WriteString(_tcPr->GetXMLString());
} }
void TableCellPropertiesMapping::apppendCellShading (unsigned char* sprmArg, int size, int cellIndex) void TableCellPropertiesMapping::apppendCellShading (unsigned char* sprmArg, int size, int cellIndex)
......
...@@ -111,8 +111,8 @@ namespace DocFileFormat ...@@ -111,8 +111,8 @@ namespace DocFileFormat
XMLTools::XMLElement tblW( _T( "w:tblW" ) ); XMLTools::XMLElement tblW( _T( "w:tblW" ) );
XMLTools::XMLAttribute w( _T( "w:w" ), FormatUtils::IntToWideString( width ).c_str() ); XMLTools::XMLAttribute w( _T( "w:w" ), FormatUtils::IntToWideString( width ) );
XMLTools::XMLAttribute type( _T( "w:type" ), FormatUtils::MapValueToWideString( fts, &WidthType[0][0], 4, 5 ).c_str() ); XMLTools::XMLAttribute type( _T( "w:type" ), FormatUtils::MapValueToWideString( fts, &WidthType[0][0], 4, 5 ) );
tblW.AppendAttribute( type ); tblW.AppendAttribute( type );
tblW.AppendAttribute( w ); tblW.AppendAttribute( w );
...@@ -126,7 +126,7 @@ namespace DocFileFormat ...@@ -126,7 +126,7 @@ namespace DocFileFormat
case sprmTJcRow: case sprmTJcRow:
{ //justification { //justification
appendValueElement( _tblPr, _T( "jc" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::JustificationCode[0][0], 10, 15 ).c_str(), true ); appendValueElement( _tblPr, _T( "jc" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::JustificationCode[0][0], 10, 15 ), true );
} }
break; break;
...@@ -150,7 +150,7 @@ namespace DocFileFormat ...@@ -150,7 +150,7 @@ namespace DocFileFormat
if( id != std::wstring( _T( "TableNormal" )) && !id.empty() ) if( id != std::wstring( _T( "TableNormal" )) && !id.empty() )
{ {
appendValueElement( _tblPr, _T( "tblStyle" ), id.c_str(), true ); appendValueElement( _tblPr, _T( "tblStyle" ), id, true );
} }
} }
} }
...@@ -168,7 +168,7 @@ namespace DocFileFormat ...@@ -168,7 +168,7 @@ namespace DocFileFormat
case sprmTTlp: case sprmTTlp:
{ //table look { //table look
appendValueElement( _tblPr, _T( "tblLook" ), FormatUtils::IntToFormattedWideString( FormatUtils::BytesToInt16( iter->Arguments, 2, iter->argumentsSize ), _T( "%04x" ) ).c_str(), true ); appendValueElement( _tblPr, _T( "tblLook" ), FormatUtils::IntToFormattedWideString( FormatUtils::BytesToInt16( iter->Arguments, 2, iter->argumentsSize ), _T( "%04x" ) ), true );
} }
break; break;
...@@ -194,7 +194,7 @@ namespace DocFileFormat ...@@ -194,7 +194,7 @@ namespace DocFileFormat
if ( FormatUtils::BitmaskToBool( (int)grfbrc, 0x01 ) ) if ( FormatUtils::BitmaskToBool( (int)grfbrc, 0x01 ) )
{ {
appendDxaElement( &tblCellMar, _T( "top" ), strValue.c_str(), true ); appendDxaElement( &tblCellMar, _T( "top" ), strValue, true );
} }
if ( FormatUtils::BitmaskToBool( (int)grfbrc, 0x02 ) ) if ( FormatUtils::BitmaskToBool( (int)grfbrc, 0x02 ) )
...@@ -204,7 +204,7 @@ namespace DocFileFormat ...@@ -204,7 +204,7 @@ namespace DocFileFormat
if ( FormatUtils::BitmaskToBool( (int)grfbrc, 0x04 ) ) if ( FormatUtils::BitmaskToBool( (int)grfbrc, 0x04 ) )
{ {
appendDxaElement( &tblCellMar, _T( "bottom" ), strValue.c_str(), true ); appendDxaElement( &tblCellMar, _T( "bottom" ), strValue, true );
} }
if ( FormatUtils::BitmaskToBool( (int)grfbrc, 0x08 ) ) if ( FormatUtils::BitmaskToBool( (int)grfbrc, 0x08 ) )
...@@ -238,7 +238,7 @@ namespace DocFileFormat ...@@ -238,7 +238,7 @@ namespace DocFileFormat
tblOverlapVal = std::wstring( _T( "never" ) ); tblOverlapVal = std::wstring( _T( "never" ) );
} }
appendValueElement( _tblPr, _T( "tblOverlap" ), tblOverlapVal.c_str(), true ); appendValueElement( _tblPr, _T( "tblOverlap" ), tblOverlapVal, true );
} }
break; break;
...@@ -332,11 +332,11 @@ namespace DocFileFormat ...@@ -332,11 +332,11 @@ namespace DocFileFormat
{ {
unsigned char flag = ( iter->Arguments[0] & 0x30 ) >> 4; unsigned char flag = ( iter->Arguments[0] & 0x30 ) >> 4;
appendValueAttribute( &tblpPr, _T( "w:vertAnchor" ), FormatUtils::MapValueToWideString( flag, &Global::VerticalPositionCode[0][0], 4, 7 ).c_str() ); appendValueAttribute( &tblpPr, _T( "w:vertAnchor" ), FormatUtils::MapValueToWideString( flag, &Global::VerticalPositionCode[0][0], 4, 7 ) );
flag = ( iter->Arguments[0] & 0xC0 ) >> 6; flag = ( iter->Arguments[0] & 0xC0 ) >> 6;
appendValueAttribute( &tblpPr, _T( "w:horzAnchor" ), FormatUtils::MapValueToWideString( flag, &Global::HorizontalPositionCode[0][0], 4, 7 ).c_str() ); appendValueAttribute( &tblpPr, _T( "w:horzAnchor" ), FormatUtils::MapValueToWideString( flag, &Global::HorizontalPositionCode[0][0], 4, 7 ) );
} }
break; break;
...@@ -383,7 +383,7 @@ namespace DocFileFormat ...@@ -383,7 +383,7 @@ namespace DocFileFormat
{ {
XMLTools::XMLElement tblInd( _T( "w:tblInd" ) ); XMLTools::XMLElement tblInd( _T( "w:tblInd" ) );
XMLTools::XMLAttribute tblIndW( _T( "w:w" ),FormatUtils::IntToWideString( tblIndent ).c_str() ); XMLTools::XMLAttribute tblIndW( _T( "w:w" ),FormatUtils::IntToWideString( tblIndent ) );
tblInd.AppendAttribute( tblIndW ); tblInd.AppendAttribute( tblIndW );
XMLTools::XMLAttribute tblIndType( _T( "w:type" ), _T( "dxa" ) ); XMLTools::XMLAttribute tblIndType( _T( "w:type" ), _T( "dxa" ) );
...@@ -453,20 +453,20 @@ namespace DocFileFormat ...@@ -453,20 +453,20 @@ namespace DocFileFormat
//append margins //append margins
if ( ( marginLeft == 0 ) && ( gabHalf != 0 ) ) if ( ( marginLeft == 0 ) && ( gabHalf != 0 ) )
{ {
appendDxaElement( &tblCellMar, _T( "left" ), FormatUtils::IntToWideString( gabHalf ).c_str(), true ); appendDxaElement( &tblCellMar, _T( "left" ), FormatUtils::IntToWideString( gabHalf ), true );
} }
else else
{ {
appendDxaElement( &tblCellMar, _T( "left" ), FormatUtils::IntToWideString( marginLeft ).c_str(), true ); appendDxaElement( &tblCellMar, _T( "left" ), FormatUtils::IntToWideString( marginLeft ), true );
} }
if ( ( marginRight == 0 ) && ( gabHalf != 0 ) ) if ( ( marginRight == 0 ) && ( gabHalf != 0 ) )
{ {
appendDxaElement( &tblCellMar, _T( "right" ), FormatUtils::IntToWideString( gabHalf ).c_str(), true ); appendDxaElement( &tblCellMar, _T( "right" ), FormatUtils::IntToWideString( gabHalf ), true );
} }
else else
{ {
appendDxaElement( &tblCellMar, _T( "right" ), FormatUtils::IntToWideString( marginRight ).c_str(), true ); appendDxaElement( &tblCellMar, _T( "right" ), FormatUtils::IntToWideString( marginRight ), true );
} }
_tblPr->AppendChild( tblCellMar ); _tblPr->AppendChild( tblCellMar );
...@@ -474,7 +474,7 @@ namespace DocFileFormat ...@@ -474,7 +474,7 @@ namespace DocFileFormat
//write Properties //write Properties
if ( ( _tblPr->GetChildCount() > 0 ) || ( _tblPr->GetAttributeCount() > 0 ) ) if ( ( _tblPr->GetChildCount() > 0 ) || ( _tblPr->GetAttributeCount() > 0 ) )
{ {
m_pXmlWriter->WriteString( _tblPr->GetXMLString().c_str() ); m_pXmlWriter->WriteString( _tblPr->GetXMLString() );
} }
//append the grid //append the grid
...@@ -500,12 +500,12 @@ namespace DocFileFormat ...@@ -500,12 +500,12 @@ namespace DocFileFormat
for ( unsigned int i = 0; i < _grid->size(); i++ ) for ( unsigned int i = 0; i < _grid->size(); i++ )
{ {
XMLTools::XMLElement gridCol( _T( "w:gridCol" ) ); XMLTools::XMLElement gridCol( _T( "w:gridCol" ) );
XMLTools::XMLAttribute gridColW( _T( "w:w" ), FormatUtils::IntToWideString( _grid->at( i ) ).c_str() ); XMLTools::XMLAttribute gridColW( _T( "w:w" ), FormatUtils::IntToWideString( _grid->at( i ) ) );
gridCol.AppendAttribute( gridColW ); gridCol.AppendAttribute( gridColW );
_tblGrid->AppendChild( gridCol ); _tblGrid->AppendChild( gridCol );
} }
} }
m_pXmlWriter->WriteString( _tblGrid->GetXMLString().c_str() ); m_pXmlWriter->WriteString( _tblGrid->GetXMLString() );
} }
} }
...@@ -90,7 +90,7 @@ namespace DocFileFormat ...@@ -90,7 +90,7 @@ namespace DocFileFormat
case sprmTWidthAfter: case sprmTWidthAfter:
{ //width after { //width after
XMLTools::XMLElement wAfter( L"w:wAfter" ); XMLTools::XMLElement wAfter( L"w:wAfter" );
XMLTools::XMLAttribute wAfterValue( L"w:w", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize ) ).c_str() ); XMLTools::XMLAttribute wAfterValue( L"w:w", FormatUtils::IntToWideString( FormatUtils::BytesToInt16( iter->Arguments, 1, iter->argumentsSize ) ) );
wAfter.AppendAttribute( wAfterValue ); wAfter.AppendAttribute( wAfterValue );
XMLTools::XMLAttribute wAfterType( L"w:type", L"dxa" ); XMLTools::XMLAttribute wAfterType( L"w:type", L"dxa" );
...@@ -106,7 +106,7 @@ namespace DocFileFormat ...@@ -106,7 +106,7 @@ namespace DocFileFormat
if ( before != 0 ) if ( before != 0 )
{ {
XMLTools::XMLElement wBefore( L"w:wBefore" ); XMLTools::XMLElement wBefore( L"w:wBefore" );
XMLTools::XMLAttribute wBeforeValue( L"w:w", FormatUtils::IntToWideString( before ).c_str() ); XMLTools::XMLAttribute wBeforeValue( L"w:w", FormatUtils::IntToWideString( before ) );
wBefore.AppendAttribute( wBeforeValue ); wBefore.AppendAttribute( wBeforeValue );
XMLTools::XMLAttribute wBeforeType( L"w:type", L"dxa" ); XMLTools::XMLAttribute wBeforeType( L"w:type", L"dxa" );
...@@ -128,7 +128,7 @@ namespace DocFileFormat ...@@ -128,7 +128,7 @@ namespace DocFileFormat
if ( rH > 0 ) if ( rH > 0 )
{ {
rowHeightRule.SetValue( L"atLeast" ); rowHeightRule.SetValue( L"atLeast" );
rowHeightVal.SetValue( FormatUtils::IntToWideString( rH ).c_str() ); rowHeightVal.SetValue( FormatUtils::IntToWideString( rH ) );
rowHeight.AppendAttribute( rowHeightVal ); rowHeight.AppendAttribute( rowHeightVal );
} }
else if( rH == 0 ) else if( rH == 0 )
...@@ -139,7 +139,7 @@ namespace DocFileFormat ...@@ -139,7 +139,7 @@ namespace DocFileFormat
{ {
rowHeightRule.SetValue( L"exact" ); rowHeightRule.SetValue( L"exact" );
rH *= -1; rH *= -1;
rowHeightVal.SetValue( FormatUtils::IntToWideString( rH ).c_str() ); rowHeightVal.SetValue( FormatUtils::IntToWideString( rH ) );
rowHeight.AppendAttribute( rowHeightVal ); rowHeight.AppendAttribute( rowHeightVal );
} }
...@@ -158,7 +158,7 @@ namespace DocFileFormat ...@@ -158,7 +158,7 @@ namespace DocFileFormat
//div id //div id
case sprmTIpgp: case sprmTIpgp:
{ {
appendValueElement( _trPr, L"divId", FormatUtils::IntToWideString( FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize ) ).c_str(), true ); appendValueElement( _trPr, L"divId", FormatUtils::IntToWideString( FormatUtils::BytesToInt32( iter->Arguments, 0, iter->argumentsSize ) ), true );
}break; }break;
//borders 80 exceptions //borders 80 exceptions
...@@ -260,7 +260,7 @@ namespace DocFileFormat ...@@ -260,7 +260,7 @@ namespace DocFileFormat
//write Properties //write Properties
if ( ( _trPr->GetChildCount() > 0 ) || ( _trPr->GetAttributeCount() > 0 ) ) if ( ( _trPr->GetChildCount() > 0 ) || ( _trPr->GetAttributeCount() > 0 ) )
{ {
m_pXmlWriter->WriteString( _trPr->GetXMLString().c_str() ); m_pXmlWriter->WriteString( _trPr->GetXMLString() );
} }
} }
} }
...@@ -149,7 +149,7 @@ namespace DocFileFormat ...@@ -149,7 +149,7 @@ namespace DocFileFormat
file.WriteFile((BYTE*)xmlString.c_str(), xmlString.size()); file.WriteFile((BYTE*)xmlString.c_str(), xmlString.size());
file.CloseFile(); file.CloseFile();
OOX::CPath path(sTempXmlFile.c_str()); OOX::CPath path(sTempXmlFile);
OOX::CDocument docEmbedded(path, path); OOX::CDocument docEmbedded(path, path);
bool res = false; bool res = false;
...@@ -194,9 +194,9 @@ namespace DocFileFormat ...@@ -194,9 +194,9 @@ namespace DocFileFormat
if ( b != NULL ) if ( b != NULL )
{ {
b->operator += ( propName ); b->operator += ( propName );
b->operator += ( _T( ":" ) ); b->operator += ( L":" );
b->operator += ( propValue ); b->operator += ( propValue );
b->operator +=( _T( ";" ) ); b->operator +=( L";" );
} }
} }
...@@ -213,7 +213,7 @@ namespace DocFileFormat ...@@ -213,7 +213,7 @@ namespace DocFileFormat
m_isEquation = false; m_isEquation = false;
m_isEmbedded = false; m_isEmbedded = false;
m_imageData = new XMLTools::XMLElement( _T( "v:imagedata" ) ); m_imageData = new XMLTools::XMLElement( L"v:imagedata" );
} }
VMLPictureMapping::~VMLPictureMapping() VMLPictureMapping::~VMLPictureMapping()
...@@ -256,24 +256,24 @@ namespace DocFileFormat ...@@ -256,24 +256,24 @@ namespace DocFileFormat
{ {
type.SetType(msosptPictureFrame); type.SetType(msosptPictureFrame);
} }
m_pXmlWriter->WriteNodeBegin( _T( "v:shape" ), true ); m_pXmlWriter->WriteNodeBegin( L"v:shape", true );
m_pXmlWriter->WriteAttribute( _T( "type" ), std::wstring( _T( "#" ) + VMLShapeTypeMapping::GenerateTypeId(&type)).c_str()); m_pXmlWriter->WriteAttribute( L"type", std::wstring( L"#" + VMLShapeTypeMapping::GenerateTypeId(&type)));
count_vml_objects++; count_vml_objects++;
if (m_shapeId.empty()) if (m_shapeId.empty())
m_shapeId = std::wstring(L"_x0000_s") + FormatUtils::IntToWideString(1024 + count_vml_objects); m_shapeId = L"_x0000_s" + FormatUtils::IntToWideString(1024 + count_vml_objects);
m_pXmlWriter->WriteAttribute( _T( "id" ), m_shapeId.c_str() ); m_pXmlWriter->WriteAttribute( L"id", m_shapeId);
if (m_isOlePreview) if (m_isOlePreview)
{ {
m_pXmlWriter->WriteAttribute( _T( "o:ole" ), _T( "" ) ); m_pXmlWriter->WriteAttribute( L"o:ole", L"" );
} }
else if (m_isBullete) else if (m_isBullete)
{ {
m_pXmlWriter->WriteAttribute( _T( "o:bullet" ), _T( "1" ) ); m_pXmlWriter->WriteAttribute( L"o:bullet", L"1" );
} }
//todooo oбъединить с shape_mapping //todooo oбъединить с shape_mapping
...@@ -304,25 +304,25 @@ namespace DocFileFormat ...@@ -304,25 +304,25 @@ namespace DocFileFormat
case borderBottomColor: case borderBottomColor:
{ {
RGBColor bottomColor( (int)iter->op, RedFirst ); RGBColor bottomColor( (int)iter->op, RedFirst );
m_pXmlWriter->WriteAttribute( _T( "o:borderbottomcolor" ), ( std::wstring( _T( "#" ) ) + bottomColor.SixDigitHexCode ).c_str() ); m_pXmlWriter->WriteAttribute( L"o:borderbottomcolor", L"#" + bottomColor.SixDigitHexCode);
} }
break; break;
case borderLeftColor: case borderLeftColor:
{ {
RGBColor leftColor( (int)iter->op, RedFirst ); RGBColor leftColor( (int)iter->op, RedFirst );
m_pXmlWriter->WriteAttribute( _T( "o:borderleftcolor" ), ( std::wstring( _T( "#" ) ) + leftColor.SixDigitHexCode ).c_str() ); m_pXmlWriter->WriteAttribute( L"o:borderleftcolor", L"#" + leftColor.SixDigitHexCode);
} }
break; break;
case borderRightColor: case borderRightColor:
{ {
RGBColor rightColor( (int)iter->op, RedFirst ); RGBColor rightColor( (int)iter->op, RedFirst );
m_pXmlWriter->WriteAttribute( _T( "o:borderrightcolor" ), ( std::wstring( _T( "#" ) ) + rightColor.SixDigitHexCode ).c_str() ); m_pXmlWriter->WriteAttribute( L"o:borderrightcolor", L"#" + rightColor.SixDigitHexCode);
} }
break; break;
case borderTopColor: case borderTopColor:
{ {
RGBColor topColor( (int)iter->op, RedFirst ); RGBColor topColor( (int)iter->op, RedFirst );
m_pXmlWriter->WriteAttribute( _T( "o:bordertopcolor" ), ( std::wstring( _T( "#" ) ) + topColor.SixDigitHexCode ).c_str() ); m_pXmlWriter->WriteAttribute( L"o:bordertopcolor", L"#" + topColor.SixDigitHexCode);
} }
break; break;
//CROPPING //CROPPING
...@@ -330,28 +330,28 @@ namespace DocFileFormat ...@@ -330,28 +330,28 @@ namespace DocFileFormat
{ {
//cast to signed integer //cast to signed integer
int cropBottom = (int)iter->op; int cropBottom = (int)iter->op;
appendValueAttribute(m_imageData, _T( "cropbottom" ), ( FormatUtils::IntToWideString( cropBottom ) + std::wstring( _T( "f" ) ) ).c_str() ); appendValueAttribute(m_imageData, L"cropbottom", FormatUtils::IntToWideString( cropBottom ) + L"f" );
} }
break; break;
case cropFromLeft: case cropFromLeft:
{ {
//cast to signed integer //cast to signed integer
int cropLeft = (int)iter->op; int cropLeft = (int)iter->op;
appendValueAttribute(m_imageData, _T( "cropleft" ), ( FormatUtils::IntToWideString( cropLeft ) + std::wstring( _T( "f" ) ) ).c_str()); appendValueAttribute(m_imageData, L"cropleft", FormatUtils::IntToWideString( cropLeft ) + L"f" );
} }
break; break;
case cropFromRight: case cropFromRight:
{ {
//cast to signed integer //cast to signed integer
int cropRight = (int)iter->op; int cropRight = (int)iter->op;
appendValueAttribute(m_imageData, _T( "cropright" ), ( FormatUtils::IntToWideString( cropRight ) + std::wstring( _T( "f" ) ) ).c_str()); appendValueAttribute(m_imageData, L"cropright", FormatUtils::IntToWideString( cropRight ) + L"f" );
} }
break; break;
case cropFromTop: case cropFromTop:
{ {
//cast to signed integer //cast to signed integer
int cropTop = (int)iter->op; int cropTop = (int)iter->op;
appendValueAttribute(m_imageData, _T( "croptop" ), ( FormatUtils::IntToWideString( cropTop ) + std::wstring( _T( "f" ) ) ).c_str()); appendValueAttribute(m_imageData, L"croptop", FormatUtils::IntToWideString( cropTop ) + L"f" );
} }
break; break;
//------------------------------------------------------------ //------------------------------------------------------------
...@@ -365,23 +365,23 @@ namespace DocFileFormat ...@@ -365,23 +365,23 @@ namespace DocFileFormat
std::wstring v = strHeight; std::wstring v = strHeight;
strHeight = strWidth; strWidth = v; strHeight = strWidth; strWidth = v;
appendStyleProperty(&strStyle, _T( "rotation" ), FormatUtils::DoubleToWideString(dAngle)); appendStyleProperty(&strStyle, L"rotation", FormatUtils::DoubleToWideString(dAngle));
}break; }break;
case posh: case posh:
{ {
appendStyleProperty(&strStyle, _T("mso-position-horizontal"), VMLShapeMapping::mapHorizontalPosition((PositionHorizontal)iter->op)); appendStyleProperty(&strStyle, L"mso-position-horizontal", VMLShapeMapping::mapHorizontalPosition((PositionHorizontal)iter->op));
}break; }break;
case posrelh: case posrelh:
{ {
appendStyleProperty(&strStyle, _T("mso-position-horizontal-relative"), VMLShapeMapping::mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op)); appendStyleProperty(&strStyle, L"mso-position-horizontal-relative", VMLShapeMapping::mapHorizontalPositionRelative((PositionHorizontalRelative)iter->op));
}break; }break;
case posv: case posv:
{ {
appendStyleProperty(&strStyle, _T("mso-position-vertical"), VMLShapeMapping::mapVerticalPosition((PositionVertical)iter->op)); appendStyleProperty(&strStyle, L"mso-position-vertical", VMLShapeMapping::mapVerticalPosition((PositionVertical)iter->op));
}break; }break;
case posrelv: case posrelv:
{ {
appendStyleProperty(&strStyle, _T("mso-position-vertical-relative"), VMLShapeMapping::mapVerticalPositionRelative((PositionVerticalRelative)iter->op)); appendStyleProperty(&strStyle, L"mso-position-vertical-relative", VMLShapeMapping::mapVerticalPositionRelative((PositionVerticalRelative)iter->op));
}break; }break;
case groupShapeBooleans: case groupShapeBooleans:
{ {
...@@ -390,52 +390,55 @@ namespace DocFileFormat ...@@ -390,52 +390,55 @@ namespace DocFileFormat
if (groupShapeBooleans.fUsefBehindDocument && groupShapeBooleans.fBehindDocument) if (groupShapeBooleans.fUsefBehindDocument && groupShapeBooleans.fBehindDocument)
{ {
//The shape is behind the text, so the z-index must be negative. //The shape is behind the text, so the z-index must be negative.
appendStyleProperty(&strStyle, _T( "z-index" ), _T( "-1" ) ); appendStyleProperty(&strStyle, L"z-index", L"-1" );
} }
//else if (!m_isInlinePicture) //else if (!m_isInlinePicture)
//{ //{
// appendStyleProperty( &strStyle, _T( "z-index" ), FormatUtils::IntToWideString(zIndex + 0x7ffff)); // appendStyleProperty( &strStyle, L"z-index", FormatUtils::IntToWideString(zIndex + 0x7ffff));
//} //}
if (groupShapeBooleans.fHidden && groupShapeBooleans.fUsefHidden) if (groupShapeBooleans.fHidden && groupShapeBooleans.fUsefHidden)
{ {
appendStyleProperty(&strStyle, _T( "visibility" ), _T( "hidden" )); appendStyleProperty(&strStyle, L"visibility", L"hidden");
} }
} }
break; break;
} }
} }
strStyle += _T( "width:" ) + strWidth + _T( "pt;" ) + _T( "height:" ) + strHeight + _T( "pt;" ); strStyle += L"width:" + strWidth + L"pt;" + L"height:" + strHeight + L"pt;";
m_pXmlWriter->WriteAttribute( _T( "style" ), strStyle.c_str() ); m_pXmlWriter->WriteAttribute( L"style", strStyle);
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
if (CopyPicture(pict)) if (CopyPicture(pict))
{ {
//v:imageData //v:imageData
appendValueAttribute(m_imageData, _T( "r:id" ), ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString(m_nImageId) ).c_str()); appendValueAttribute(m_imageData, L"r:id", L"rId" + FormatUtils::IntToWideString(m_nImageId));
appendValueAttribute(m_imageData, _T( "o:title" ) , _T( "" )); appendValueAttribute(m_imageData, L"o:title", L"" );
m_pXmlWriter->WriteString(m_imageData->GetXMLString().c_str()); m_pXmlWriter->WriteString(m_imageData->GetXMLString());
} }
//borders if (!m_isInlinePicture)
writePictureBorder( _T( "bordertop" ), pict->brcTop ); {
writePictureBorder( _T( "borderleft" ), pict->brcLeft ); //borders
writePictureBorder( _T( "borderbottom" ), pict->brcBottom ); writePictureBorder( L"bordertop", pict->brcTop );
writePictureBorder( _T( "borderright" ), pict->brcRight ); writePictureBorder( L"borderleft", pict->brcLeft );
writePictureBorder( L"borderbottom", pict->brcBottom );
writePictureBorder( L"borderright", pict->brcRight );
}
m_pXmlWriter->WriteNodeEnd( _T( "v:shape" ) ); m_pXmlWriter->WriteNodeEnd( L"v:shape" );
} }
void VMLPictureMapping::writePictureBorder( const std::wstring & name, const BorderCode* brc ) void VMLPictureMapping::writePictureBorder( const std::wstring & name, const BorderCode* brc )
{ {
if (!brc || name.empty()) return; if (!brc || name.empty()) return;
m_pXmlWriter->WriteNodeBegin( ( std::wstring( _T( "w10:" ) ) + name).c_str(), true ); m_pXmlWriter->WriteNodeBegin( L"w10:" + name, true );
m_pXmlWriter->WriteAttribute( _T( "type" ), getBorderType( brc->brcType ).c_str() ); m_pXmlWriter->WriteAttribute( L"type", getBorderType( brc->brcType ));
m_pXmlWriter->WriteAttribute( _T( "width" ), FormatUtils::IntToWideString( brc->dptLineWidth ).c_str() ); m_pXmlWriter->WriteAttribute( L"width", FormatUtils::IntToWideString( brc->dptLineWidth ));
m_pXmlWriter->WriteNodeEnd ( _T( "" ), true ); m_pXmlWriter->WriteNodeEnd ( L"", true );
} }
bool VMLPictureMapping::CopyPicture (PictureDescriptor* pict) bool VMLPictureMapping::CopyPicture (PictureDescriptor* pict)
...@@ -534,26 +537,26 @@ namespace DocFileFormat ...@@ -534,26 +537,26 @@ namespace DocFileFormat
switch (nType) switch (nType)
{ {
case Global::msoblipDIB: case Global::msoblipDIB:
return std::wstring(_T(".bmp")); return std::wstring(L".bmp");
case Global::msoblipEMF: case Global::msoblipEMF:
return std::wstring(_T(".emf")); return std::wstring(L".emf");
case Global::msoblipJPEG: case Global::msoblipJPEG:
case Global::msoblipCMYKJPEG: case Global::msoblipCMYKJPEG:
return std::wstring(_T(".jpg")); return std::wstring(L".jpg");
case Global::msoblipPNG: case Global::msoblipPNG:
return std::wstring(_T(".png")); return std::wstring(L".png");
case Global::msoblipTIFF: case Global::msoblipTIFF:
return std::wstring(_T(".tif")); return std::wstring(L".tif");
case Global::msoblipWMF: case Global::msoblipWMF:
return std::wstring(_T(".wmf")); return std::wstring(L".wmf");
default: default:
return std::wstring(_T(".png")); return std::wstring(L".png");
} }
} }
...@@ -565,17 +568,17 @@ namespace DocFileFormat ...@@ -565,17 +568,17 @@ namespace DocFileFormat
return std::wstring(OpenXmlContentTypes::Emf); return std::wstring(OpenXmlContentTypes::Emf);
//case msoblipGIF: //case msoblipGIF:
// return wstring( _T( "image/gif" ) ); // return wstring( L"image/gif" );
//case msoblipICON: //case msoblipICON:
// return wstring( _T( "image/x-icon" ) ); // return wstring( L"image/x-icon" );
case Global::msoblipJPEG: case Global::msoblipJPEG:
case Global::msoblipCMYKJPEG: case Global::msoblipCMYKJPEG:
return std::wstring(OpenXmlContentTypes::Jpeg); return std::wstring(OpenXmlContentTypes::Jpeg);
//case msoblipPCX: //case msoblipPCX:
// return wstring( _T( "image/pcx" ) ); // return wstring( L"image/pcx" );
case Global::msoblipPNG: case Global::msoblipPNG:
return std::wstring(OpenXmlContentTypes::Png); return std::wstring(OpenXmlContentTypes::Png);
......
...@@ -149,10 +149,10 @@ namespace DocFileFormat ...@@ -149,10 +149,10 @@ namespace DocFileFormat
m_shapeId = GetShapeID(shape); m_shapeId = GetShapeID(shape);
m_pXmlWriter->WriteNodeBegin( L"v:group", true ); m_pXmlWriter->WriteNodeBegin( L"v:group", true );
m_pXmlWriter->WriteAttribute( L"id", m_shapeId .c_str()); m_pXmlWriter->WriteAttribute( L"id", m_shapeId);
m_pXmlWriter->WriteAttribute( L"style", FormatUtils::XmlEncode(buildStyle(shape, anchor, options, container->Index)).c_str() ); m_pXmlWriter->WriteAttribute( L"style", FormatUtils::XmlEncode(buildStyle(shape, anchor, options, container->Index)));
m_pXmlWriter->WriteAttribute( L"coordorigin", ( FormatUtils::IntToWideString(gsr->rcgBounds.topLeftAngle.x) + L"," + FormatUtils::IntToWideString( gsr->rcgBounds.topLeftAngle.y)).c_str() ); m_pXmlWriter->WriteAttribute( L"coordorigin", ( FormatUtils::IntToWideString(gsr->rcgBounds.topLeftAngle.x) + L"," + FormatUtils::IntToWideString( gsr->rcgBounds.topLeftAngle.y)));
m_pXmlWriter->WriteAttribute( L"coordsize", ( FormatUtils::IntToWideString(gsr->rcgBounds.size.cx) + L"," + FormatUtils::IntToWideString(gsr->rcgBounds.size.cy)).c_str() ); m_pXmlWriter->WriteAttribute( L"coordsize", ( FormatUtils::IntToWideString(gsr->rcgBounds.size.cx) + L"," + FormatUtils::IntToWideString(gsr->rcgBounds.size.cy)));
// Write wrap coords // Write wrap coords
std::list<OptionEntry>::const_iterator end = options.end(); std::list<OptionEntry>::const_iterator end = options.end();
...@@ -164,7 +164,7 @@ namespace DocFileFormat ...@@ -164,7 +164,7 @@ namespace DocFileFormat
{ {
std::wstring wrapCoords = getWrapCoords(*iter); std::wstring wrapCoords = getWrapCoords(*iter);
if (wrapCoords.length()) if (wrapCoords.length())
m_pXmlWriter->WriteAttribute(L"wrapcoords", wrapCoords.c_str()); m_pXmlWriter->WriteAttribute(L"wrapcoords", wrapCoords);
} }
break; break;
} }
...@@ -205,7 +205,7 @@ namespace DocFileFormat ...@@ -205,7 +205,7 @@ namespace DocFileFormat
if (wrap != L"through") if (wrap != L"through")
{ {
m_pXmlWriter->WriteNodeBegin( L"w10:wrap", true ); m_pXmlWriter->WriteNodeBegin( L"w10:wrap", true );
m_pXmlWriter->WriteAttribute( L"type", wrap.c_str() ); m_pXmlWriter->WriteAttribute( L"type", wrap);
m_pXmlWriter->WriteNodeEnd ( L"w10:wrap", true ); m_pXmlWriter->WriteNodeEnd ( L"w10:wrap", true );
} }
} }
...@@ -246,16 +246,16 @@ namespace DocFileFormat ...@@ -246,16 +246,16 @@ namespace DocFileFormat
if (pShape->GetShapeType()) if (pShape->GetShapeType())
{ {
freeform = false; freeform = false;
m_pXmlWriter->WriteAttribute( L"type", (std::wstring(L"#") + VMLShapeTypeMapping::GenerateTypeId(pShape->GetShapeType())).c_str()); m_pXmlWriter->WriteAttribute( L"type", (std::wstring(L"#") + VMLShapeTypeMapping::GenerateTypeId(pShape->GetShapeType())));
m_pXmlWriter->WriteAttribute( L"style", FormatUtils::XmlEncode(buildStyle(pShape, pAnchor, options, pContainer->Index)).c_str()); m_pXmlWriter->WriteAttribute( L"style", FormatUtils::XmlEncode(buildStyle(pShape, pAnchor, options, pContainer->Index)));
} }
if (pShape->is<LineType>()) if (pShape->is<LineType>())
{ {
//append "from" and "to" attributes //append "from" and "to" attributes
m_pXmlWriter->WriteAttribute(L"from", GetLineFrom(pAnchor).c_str()); m_pXmlWriter->WriteAttribute(L"from", GetLineFrom(pAnchor));
m_pXmlWriter->WriteAttribute(L"to", GetLineTo(pAnchor).c_str()); m_pXmlWriter->WriteAttribute(L"to", GetLineTo(pAnchor));
} }
if (m_isBullete) if (m_isBullete)
...@@ -410,7 +410,7 @@ namespace DocFileFormat ...@@ -410,7 +410,7 @@ namespace DocFileFormat
if (!wrapCoords.empty()) if (!wrapCoords.empty())
{ {
m_pXmlWriter->WriteAttribute( L"wrapcoords", wrapCoords.c_str() ); m_pXmlWriter->WriteAttribute( L"wrapcoords", wrapCoords);
} }
}break; }break;
case geoRight: case geoRight:
...@@ -433,7 +433,7 @@ namespace DocFileFormat ...@@ -433,7 +433,7 @@ namespace DocFileFormat
{ {
RGBColor lineColor((int)iter->op, RedFirst); RGBColor lineColor((int)iter->op, RedFirst);
if ( !pShape->fBackground ) if ( !pShape->fBackground )
m_pXmlWriter->WriteAttribute( L"strokecolor", (std::wstring(L"#") + lineColor.SixDigitHexCode).c_str()); m_pXmlWriter->WriteAttribute( L"strokecolor", (std::wstring(L"#") + lineColor.SixDigitHexCode));
}break; }break;
case lineWidth: case lineWidth:
{ {
...@@ -445,67 +445,67 @@ namespace DocFileFormat ...@@ -445,67 +445,67 @@ namespace DocFileFormat
}break; }break;
case lineDashing: case lineDashing:
{ {
appendValueAttribute(&m_stroke, L"dashstyle", FormatUtils::MapValueToWideString( iter->op, &Global::DashStyleMap[0][0], 11, 16 ).c_str() ); appendValueAttribute(&m_stroke, L"dashstyle", FormatUtils::MapValueToWideString( iter->op, &Global::DashStyleMap[0][0], 11, 16 ) );
}break; }break;
case lineStyle: case lineStyle:
{ {
appendValueAttribute(&m_stroke, L"linestyle", getLineStyle( iter->op ).c_str()); appendValueAttribute(&m_stroke, L"linestyle", getLineStyle( iter->op ));
}break; }break;
case lineEndArrowhead: case lineEndArrowhead:
{ {
appendValueAttribute(&m_stroke, L"endarrow", getArrowStyle( iter->op ).c_str()); appendValueAttribute(&m_stroke, L"endarrow", getArrowStyle( iter->op ));
}break; }break;
case lineEndArrowLength: case lineEndArrowLength:
{ {
appendValueAttribute(&m_stroke, L"endarrowlength", getArrowLength( iter->op ).c_str()); appendValueAttribute(&m_stroke, L"endarrowlength", getArrowLength( iter->op ));
}break; }break;
case lineEndArrowWidth: case lineEndArrowWidth:
{ {
appendValueAttribute(&m_stroke, L"endarrowwidth", getArrowWidth( iter->op ).c_str()); appendValueAttribute(&m_stroke, L"endarrowwidth", getArrowWidth( iter->op ));
}break; }break;
case lineStartArrowhead: case lineStartArrowhead:
{ {
appendValueAttribute(&m_stroke, L"startarrow", getArrowStyle( iter->op ).c_str()); appendValueAttribute(&m_stroke, L"startarrow", getArrowStyle( iter->op ));
}break; }break;
case lineStartArrowLength: case lineStartArrowLength:
{ {
appendValueAttribute(&m_stroke, L"startarrowlength", getArrowLength( iter->op ).c_str()); appendValueAttribute(&m_stroke, L"startarrowlength", getArrowLength( iter->op ));
}break; }break;
case lineStartArrowWidth: case lineStartArrowWidth:
{ {
appendValueAttribute(&m_stroke, L"startarrowwidth", getArrowWidth( iter->op ).c_str()); appendValueAttribute(&m_stroke, L"startarrowwidth", getArrowWidth( iter->op ));
}break; }break;
// FILL // FILL
case fillColor: case fillColor:
{ {
RGBColor fillColor((int)iter->op, RedFirst); RGBColor fillColor((int)iter->op, RedFirst);
m_pXmlWriter->WriteAttribute(L"fillcolor", ( std::wstring( L"#" ) + fillColor.SixDigitHexCode ).c_str()); m_pXmlWriter->WriteAttribute(L"fillcolor", ( std::wstring( L"#" ) + fillColor.SixDigitHexCode ));
}break; }break;
case fillBackColor: case fillBackColor:
{ {
RGBColor fillBackColor( (int)iter->op, RedFirst ); RGBColor fillBackColor( (int)iter->op, RedFirst );
appendValueAttribute(&m_fill, L"color2", ( std::wstring( L"#" ) + fillBackColor.SixDigitHexCode ).c_str()); appendValueAttribute(&m_fill, L"color2", ( std::wstring( L"#" ) + fillBackColor.SixDigitHexCode ));
}break; }break;
case fillAngle: case fillAngle:
{ {
FixedPointNumber fllAngl( iter->op ); FixedPointNumber fllAngl( iter->op );
appendValueAttribute(&m_fill, L"angle", FormatUtils::DoubleToWideString( fllAngl.ToAngle() ).c_str()); appendValueAttribute(&m_fill, L"angle", FormatUtils::DoubleToWideString( fllAngl.ToAngle() ));
}break; }break;
case fillShadeType: case fillShadeType:
{ {
appendValueAttribute(&m_fill, L"method", getFillMethod( iter->op ).c_str()); appendValueAttribute(&m_fill, L"method", getFillMethod( iter->op ));
}break; }break;
case fillShadeColors: case fillShadeColors:
{ {
appendValueAttribute(&m_fill, L"colors", getFillColorString( iter->opComplex, iter->op ).c_str()); appendValueAttribute(&m_fill, L"colors", getFillColorString( iter->opComplex, iter->op ));
}break; }break;
case fillFocus: case fillFocus:
{ {
appendValueAttribute(&m_fill, L"focus", ( FormatUtils::IntToWideString( iter->op ) + L"%" ).c_str()); appendValueAttribute(&m_fill, L"focus", ( FormatUtils::IntToWideString( iter->op ) + L"%" ));
}break; }break;
case fillType: case fillType:
{ {
appendValueAttribute(&m_fill, L"type", getFillType( iter->op ).c_str()); appendValueAttribute(&m_fill, L"type", getFillType( iter->op ));
}break; }break;
case fillBlip: case fillBlip:
{ {
...@@ -523,28 +523,28 @@ namespace DocFileFormat ...@@ -523,28 +523,28 @@ namespace DocFileFormat
if ( (pFillBlip != NULL) && copyPicture(pFillBlip) ) if ( (pFillBlip != NULL) && copyPicture(pFillBlip) )
{ {
appendValueAttribute(&m_fill, L"r:id", std::wstring(( L"rId" ) + FormatUtils::IntToWideString(m_nImageId) ).c_str()); appendValueAttribute(&m_fill, L"r:id", std::wstring(( L"rId" ) + FormatUtils::IntToWideString(m_nImageId) ));
} }
}break; }break;
case fillOpacity: case fillOpacity:
{ {
appendValueAttribute(&m_fill, L"opacity", ( FormatUtils::IntToWideString( iter->op ) + L"f" ).c_str()); appendValueAttribute(&m_fill, L"opacity", ( FormatUtils::IntToWideString( iter->op ) + L"f" ));
} }
break; break;
case fillBackOpacity: case fillBackOpacity:
{ {
appendValueAttribute(&m_fill, L"opacity2", (FormatUtils::IntToWideString(iter->op) + L"f").c_str()); appendValueAttribute(&m_fill, L"opacity2", (FormatUtils::IntToWideString(iter->op) + L"f"));
}break; }break;
// SHADOW // SHADOW
case shadowType: case shadowType:
{ {
appendValueAttribute(&m_shadow, L"type", getShadowType(iter->op).c_str()); appendValueAttribute(&m_shadow, L"type", getShadowType(iter->op));
}break; }break;
case shadowColor: case shadowColor:
{ {
RGBColor shadowColor((int)iter->op, RedFirst); RGBColor shadowColor((int)iter->op, RedFirst);
appendValueAttribute(&m_shadow, L"color", ( std::wstring( L"#" ) + shadowColor.SixDigitHexCode ).c_str()); appendValueAttribute(&m_shadow, L"color", ( std::wstring( L"#" ) + shadowColor.SixDigitHexCode ));
}break; }break;
case shadowOffsetX: case shadowOffsetX:
{ {
...@@ -574,7 +574,7 @@ namespace DocFileFormat ...@@ -574,7 +574,7 @@ namespace DocFileFormat
{ {
double shadowOpa = (iter->op / pow( (double)2, (double)16)); double shadowOpa = (iter->op / pow( (double)2, (double)16));
appendValueAttribute(&m_shadow, L"opacity", FormatUtils::DoubleToFormattedWideString( shadowOpa, L"%.2f" ).c_str()); appendValueAttribute(&m_shadow, L"opacity", FormatUtils::DoubleToFormattedWideString( shadowOpa, L"%.2f" ));
}break; }break;
case shadowStyleBooleanProperties: case shadowStyleBooleanProperties:
{ {
...@@ -595,7 +595,7 @@ namespace DocFileFormat ...@@ -595,7 +595,7 @@ namespace DocFileFormat
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(&m_imagedata, L"r:id", ( std::wstring( L"rId" ) + FormatUtils::IntToWideString(m_nImageId) ).c_str()); appendValueAttribute(&m_imagedata, L"r:id", ( std::wstring( L"rId" ) + FormatUtils::IntToWideString(m_nImageId) ));
} }
} }
}break; }break;
...@@ -604,7 +604,7 @@ namespace DocFileFormat ...@@ -604,7 +604,7 @@ namespace DocFileFormat
std::wstring name; std::wstring name;
FormatUtils::GetSTLCollectionFromBytes<std::wstring>(&name, iter->opComplex, iter->op, ENCODING_UTF16); FormatUtils::GetSTLCollectionFromBytes<std::wstring>(&name, iter->opComplex, iter->op, ENCODING_UTF16);
if (!name.empty()) if (!name.empty())
appendValueAttribute(&m_imagedata, L"o:title", FormatUtils::XmlEncode(name).c_str()); appendValueAttribute(&m_imagedata, L"o:title", FormatUtils::XmlEncode(name));
}break; }break;
// 3D STYLE // 3D STYLE
case f3D: case f3D:
...@@ -616,37 +616,37 @@ namespace DocFileFormat ...@@ -616,37 +616,37 @@ namespace DocFileFormat
{ {
EmuValue backwardValue( (int)iter->op ); EmuValue backwardValue( (int)iter->op );
std::wstring depth = FormatUtils::DoubleToWideString( backwardValue.ToPoints() ) + L"pt"; std::wstring depth = FormatUtils::DoubleToWideString( backwardValue.ToPoints() ) + L"pt";
appendValueAttribute(&m_3dstyle, L"backdepth", depth.c_str()); appendValueAttribute(&m_3dstyle, L"backdepth", depth);
}break; }break;
case c3DAmbientIntensity: case c3DAmbientIntensity:
{ {
std::wstring intens = FormatUtils::IntToWideString((int)iter->op) + L"f"; std::wstring intens = FormatUtils::IntToWideString((int)iter->op) + L"f";
appendValueAttribute(&m_3dstyle, L"brightness", intens.c_str()); appendValueAttribute(&m_3dstyle, L"brightness", intens);
}break; }break;
case c3DSpecularAmt: case c3DSpecularAmt:
{ {
std::wstring amt = FormatUtils::IntToWideString((int)iter->op) + L"f"; std::wstring amt = FormatUtils::IntToWideString((int)iter->op) + L"f";
appendValueAttribute(&m_3dstyle, L"specularity", amt.c_str()); appendValueAttribute(&m_3dstyle, L"specularity", amt);
}break; }break;
case c3DDiffuseAmt: case c3DDiffuseAmt:
{ {
std::wstring amt = FormatUtils::IntToWideString((int)iter->op) + L"f"; std::wstring amt = FormatUtils::IntToWideString((int)iter->op) + L"f";
appendValueAttribute(&m_3dstyle, L"diffusity", amt.c_str()); appendValueAttribute(&m_3dstyle, L"diffusity", amt);
}break; }break;
case c3DKeyIntensity: case c3DKeyIntensity:
{ {
std::wstring amt = FormatUtils::IntToWideString((int)iter->op); std::wstring amt = FormatUtils::IntToWideString((int)iter->op);
appendValueAttribute(&m_3dstyle, L"lightlevel", amt.c_str()); appendValueAttribute(&m_3dstyle, L"lightlevel", amt);
}break; }break;
case c3DExtrusionColor: case c3DExtrusionColor:
{ {
std::wstring color = FormatUtils::IntToFormattedWideString(iter->op, L"#%06x"); std::wstring color = FormatUtils::IntToFormattedWideString(iter->op, L"#%06x");
appendValueAttribute(&m_3dstyle, L"color", color.c_str()); appendValueAttribute(&m_3dstyle, L"color", color);
}break; }break;
case c3DSkewAngle: case c3DSkewAngle:
{ {
FixedPointNumber skewAngle( iter->op ); FixedPointNumber skewAngle( iter->op );
appendValueAttribute(&m_3dstyle, L"skewangle", FormatUtils::DoubleToWideString( skewAngle.ToAngle() ).c_str()); appendValueAttribute(&m_3dstyle, L"skewangle", FormatUtils::DoubleToWideString( skewAngle.ToAngle() ));
}break; }break;
case c3DXViewpoint: case c3DXViewpoint:
{ {
...@@ -706,10 +706,10 @@ namespace DocFileFormat ...@@ -706,10 +706,10 @@ namespace DocFileFormat
if (0 <= text.find(L"\n")) if (0 <= text.find(L"\n"))
{ {
m_textpath.AppendText(text.c_str()); m_textpath.AppendText(text);
} }
text = ReplaceString(text, L"\n", L"&#xA;"); text = ReplaceString(text, L"\n", L"&#xA;");
appendValueAttribute(&m_textpath, L"string", text.c_str()); appendValueAttribute(&m_textpath, L"string", text);
}break; }break;
case gtextFont: case gtextFont:
{ {
...@@ -772,7 +772,7 @@ namespace DocFileFormat ...@@ -772,7 +772,7 @@ namespace DocFileFormat
std::wstring path = ParsePath(options); std::wstring path = ParsePath(options);
if (false == path.empty()) if (false == path.empty())
m_pXmlWriter->WriteAttribute (L"path", path.c_str()); m_pXmlWriter->WriteAttribute (L"path", path);
}break; }break;
default: default:
{ {
...@@ -786,7 +786,7 @@ namespace DocFileFormat ...@@ -786,7 +786,7 @@ namespace DocFileFormat
std::wstring path = ParsePath(options); std::wstring path = ParsePath(options);
if (false == path.empty()) if (false == path.empty())
m_pXmlWriter->WriteAttribute (L"path", path.c_str()); m_pXmlWriter->WriteAttribute (L"path", path);
} }
if ( !filled ) if ( !filled )
...@@ -806,7 +806,7 @@ namespace DocFileFormat ...@@ -806,7 +806,7 @@ namespace DocFileFormat
if ( ( xCoord > 0 ) && ( yCoord > 0 ) ) if ( ( xCoord > 0 ) && ( yCoord > 0 ) )
{ {
m_pXmlWriter->WriteAttribute( L"coordsize", ( FormatUtils::IntToWideString( xCoord ) + L"," + FormatUtils::IntToWideString( yCoord ) ).c_str() ); m_pXmlWriter->WriteAttribute( L"coordsize", ( FormatUtils::IntToWideString( xCoord ) + L"," + FormatUtils::IntToWideString( yCoord ) ));
} }
int nCode = 0; int nCode = 0;
...@@ -819,7 +819,7 @@ namespace DocFileFormat ...@@ -819,7 +819,7 @@ namespace DocFileFormat
{ {
if (nAdjValues) if (nAdjValues)
{ {
m_pXmlWriter->WriteAttribute(L"arcsize", adjValues[0].c_str()); m_pXmlWriter->WriteAttribute(L"arcsize", adjValues[0]);
} }
} }
else else
...@@ -831,7 +831,7 @@ namespace DocFileFormat ...@@ -831,7 +831,7 @@ namespace DocFileFormat
for (int i = 1; i < nAdjValues; ++i) for (int i = 1; i < nAdjValues; ++i)
adjTag += std::wstring(L",") + adjValues[i]; adjTag += std::wstring(L",") + adjValues[i];
m_pXmlWriter->WriteAttribute(L"adj", adjTag.c_str()); m_pXmlWriter->WriteAttribute(L"adj", adjTag);
} }
} }
...@@ -853,7 +853,7 @@ namespace DocFileFormat ...@@ -853,7 +853,7 @@ namespace DocFileFormat
} }
if ( !offset.empty() ) if ( !offset.empty() )
{ {
appendValueAttribute(&m_shadow, L"offset", offset.c_str()); appendValueAttribute(&m_shadow, L"offset", offset);
} }
std::wstring offset2; std::wstring offset2;
...@@ -873,13 +873,13 @@ namespace DocFileFormat ...@@ -873,13 +873,13 @@ namespace DocFileFormat
if (!offset2.empty()) if (!offset2.empty())
{ {
appendValueAttribute(&m_shadow, L"offset2", offset2.c_str()); appendValueAttribute(&m_shadow, L"offset2", offset2);
} }
//build shadow origin //build shadow origin
if ( ( ShadowOriginX != 0 ) && ( ShadowOriginY != 0 ) ) if ( ( ShadowOriginX != 0 ) && ( ShadowOriginY != 0 ) )
{ {
appendValueAttribute(&m_shadow, L"origin", (FormatUtils::DoubleToWideString(shadowOriginX) + std::wstring(L"," ) + FormatUtils::DoubleToWideString(shadowOriginY)).c_str()); appendValueAttribute(&m_shadow, L"origin", (FormatUtils::DoubleToWideString(shadowOriginX) + std::wstring(L"," ) + FormatUtils::DoubleToWideString(shadowOriginY)));
} }
// write shadow // write shadow
...@@ -890,7 +890,7 @@ namespace DocFileFormat ...@@ -890,7 +890,7 @@ namespace DocFileFormat
appendValueAttribute(&m_shadow, L"on", L"t" ); appendValueAttribute(&m_shadow, L"on", L"t" );
} }
m_pXmlWriter->WriteString(m_shadow.GetXMLString().c_str()); m_pXmlWriter->WriteString(m_shadow.GetXMLString());
} }
//write 3d style //write 3d style
if (m_3dstyle.GetAttributeCount() > 0) if (m_3dstyle.GetAttributeCount() > 0)
...@@ -918,7 +918,7 @@ namespace DocFileFormat ...@@ -918,7 +918,7 @@ namespace DocFileFormat
viewPoint += FormatUtils::IntToWideString( ViewPointZ ) + L"pt"; viewPoint += FormatUtils::IntToWideString( ViewPointZ ) + L"pt";
} }
appendValueAttribute(&m_3dstyle, L"viewpoint", viewPoint.c_str()); appendValueAttribute(&m_3dstyle, L"viewpoint", viewPoint);
} }
// write the viewpointorigin // write the viewpointorigin
if ( ( viewPointOriginX != 0 ) || ( viewPointOriginY != 0 ) ) if ( ( viewPointOriginX != 0 ) || ( viewPointOriginY != 0 ) )
...@@ -936,10 +936,10 @@ namespace DocFileFormat ...@@ -936,10 +936,10 @@ namespace DocFileFormat
viewPointOrigin += FormatUtils::DoubleToFormattedWideString( viewPointOriginY, L"%.2f" ); viewPointOrigin += FormatUtils::DoubleToFormattedWideString( viewPointOriginY, L"%.2f" );
} }
appendValueAttribute(&m_3dstyle, L"viewpointorigin", viewPointOrigin.c_str()); appendValueAttribute(&m_3dstyle, L"viewpointorigin", viewPointOrigin);
} }
m_pXmlWriter->WriteString(m_3dstyle.GetXMLString().c_str()); m_pXmlWriter->WriteString(m_3dstyle.GetXMLString());
} }
// write wrap // write wrap
if (m_pSpa) if (m_pSpa)
...@@ -949,19 +949,19 @@ namespace DocFileFormat ...@@ -949,19 +949,19 @@ namespace DocFileFormat
if (wrap != L"through") if (wrap != L"through")
{ {
m_pXmlWriter->WriteNodeBegin( L"w10:wrap", true ); m_pXmlWriter->WriteNodeBegin( L"w10:wrap", true );
m_pXmlWriter->WriteAttribute( L"type", wrap.c_str() ); m_pXmlWriter->WriteAttribute( L"type", wrap );
m_pXmlWriter->WriteNodeEnd ( L"w10:wrap", true ); m_pXmlWriter->WriteNodeEnd ( L"w10:wrap", true );
} }
} }
// write fill // write fill
if (m_fill.GetAttributeCount()) if (m_fill.GetAttributeCount())
{ {
m_pXmlWriter->WriteString(m_fill.GetXMLString().c_str()); m_pXmlWriter->WriteString(m_fill.GetXMLString());
} }
// write imagedata // write imagedata
if (m_imagedata.GetAttributeCount()) if (m_imagedata.GetAttributeCount())
{ {
m_pXmlWriter->WriteString(m_imagedata.GetXMLString().c_str()); m_pXmlWriter->WriteString(m_imagedata.GetXMLString());
} }
if ( pShape->fBackground ) if ( pShape->fBackground )
...@@ -972,13 +972,13 @@ namespace DocFileFormat ...@@ -972,13 +972,13 @@ namespace DocFileFormat
// write stroke // write stroke
if (m_stroke.GetAttributeCount()) if (m_stroke.GetAttributeCount())
{ {
m_pXmlWriter->WriteString(m_stroke.GetXMLString().c_str()); m_pXmlWriter->WriteString(m_stroke.GetXMLString());
} }
// text path // text path
if (m_textpath.GetAttributeCount()) if (m_textpath.GetAttributeCount())
{ {
appendValueAttribute(&m_textpath, L"style", FormatUtils::XmlEncode(m_textPathStyle).c_str()); appendValueAttribute(&m_textpath, L"style", FormatUtils::XmlEncode(m_textPathStyle));
m_pXmlWriter->WriteString(m_textpath.GetXMLString().c_str()); m_pXmlWriter->WriteString(m_textpath.GetXMLString());
} }
if (freeform) if (freeform)
{ {
...@@ -1942,7 +1942,7 @@ namespace DocFileFormat ...@@ -1942,7 +1942,7 @@ namespace DocFileFormat
DrawingPrimitive *primitive = dynamic_cast<DrawingPrimitive *>(primitives->at(index)); DrawingPrimitive *primitive = dynamic_cast<DrawingPrimitive *>(primitives->at(index));
m_pXmlWriter->WriteNodeBegin(primitive->strVmlType.c_str(), true ); m_pXmlWriter->WriteNodeBegin(primitive->strVmlType, true );
if (primitive->type == 0x0007) if (primitive->type == 0x0007)
{ {
...@@ -1993,7 +1993,7 @@ namespace DocFileFormat ...@@ -1993,7 +1993,7 @@ namespace DocFileFormat
} }
} }
m_pXmlWriter->WriteNodeEnd( primitive->strVmlType.c_str() ); m_pXmlWriter->WriteNodeEnd( primitive->strVmlType );
index++; index++;
return index; return index;
...@@ -2009,8 +2009,8 @@ namespace DocFileFormat ...@@ -2009,8 +2009,8 @@ namespace DocFileFormat
std::wstring strId = std::wstring(L"_x0000_s") + FormatUtils::IntToWideString(1024 + count_vml_objects); std::wstring strId = std::wstring(L"_x0000_s") + FormatUtils::IntToWideString(1024 + count_vml_objects);
count_vml_objects++; count_vml_objects++;
//m_pXmlWriter->WriteAttribute ( L"id") , strId.c_str()); //m_pXmlWriter->WriteAttribute ( L"id") , strId);
m_pXmlWriter->WriteAttribute ( L"o:spid", strId.c_str()); m_pXmlWriter->WriteAttribute ( L"o:spid", strId);
std::wstring strStyle = L"position:absolute;visibility:visible;mso-wrap-style:square;"; std::wstring strStyle = L"position:absolute;visibility:visible;mso-wrap-style:square;";
...@@ -2025,8 +2025,8 @@ namespace DocFileFormat ...@@ -2025,8 +2025,8 @@ namespace DocFileFormat
std::wstring strStart = FormatUtils::IntToWideString(line->xaStart + primitive->xa) + L"," + FormatUtils::IntToWideString(line->yaStart + primitive->ya); std::wstring strStart = FormatUtils::IntToWideString(line->xaStart + primitive->xa) + L"," + FormatUtils::IntToWideString(line->yaStart + primitive->ya);
std::wstring strEnd = FormatUtils::IntToWideString(line->xaEnd + primitive->xa) + L"," + FormatUtils::IntToWideString(line->yaEnd + primitive->ya); std::wstring strEnd = FormatUtils::IntToWideString(line->xaEnd + primitive->xa) + L"," + FormatUtils::IntToWideString(line->yaEnd + primitive->ya);
m_pXmlWriter->WriteAttribute(L"from", strStart.c_str() ); m_pXmlWriter->WriteAttribute(L"from", strStart);
m_pXmlWriter->WriteAttribute(L"to", strEnd.c_str()); m_pXmlWriter->WriteAttribute(L"to", strEnd);
} }
else else
{ {
...@@ -2054,8 +2054,8 @@ namespace DocFileFormat ...@@ -2054,8 +2054,8 @@ namespace DocFileFormat
std::wstring strSize = FormatUtils::IntToWideString(primitive->dxa) + L"," + FormatUtils::IntToWideString(primitive->dya); std::wstring strSize = FormatUtils::IntToWideString(primitive->dxa) + L"," + FormatUtils::IntToWideString(primitive->dya);
std::wstring strOrigin = FormatUtils::IntToWideString(primitive->xa) + L"," + FormatUtils::IntToWideString(primitive->ya); std::wstring strOrigin = FormatUtils::IntToWideString(primitive->xa) + L"," + FormatUtils::IntToWideString(primitive->ya);
m_pXmlWriter->WriteAttribute( L"coordsize", strSize.c_str()); m_pXmlWriter->WriteAttribute( L"coordsize", strSize);
//m_pXmlWriter->WriteAttribute( L"coordorigin"), strOrigin.c_str()); //m_pXmlWriter->WriteAttribute( L"coordorigin"), strOrigin);
} }
else else
{ {
...@@ -2070,23 +2070,23 @@ namespace DocFileFormat ...@@ -2070,23 +2070,23 @@ namespace DocFileFormat
if (primitive->type > 1) if (primitive->type > 1)
{ {
m_pXmlWriter->WriteAttribute( L"fillColor", FormatUtils::IntToFormattedWideString(primitive->fillFore, L"#%06x").c_str()); m_pXmlWriter->WriteAttribute( L"fillColor", FormatUtils::IntToFormattedWideString(primitive->fillFore, L"#%06x"));
} }
m_pXmlWriter->WriteAttribute( L"style", strStyle.c_str()); m_pXmlWriter->WriteAttribute( L"style", strStyle);
std::wstring strStrokeWeight = FormatUtils::IntToWideString(primitive->lineWeight / 20) + L"pt"; std::wstring strStrokeWeight = FormatUtils::IntToWideString(primitive->lineWeight / 20) + L"pt";
if (primitive->lineWeight > 20) if (primitive->lineWeight > 20)
m_pXmlWriter->WriteAttribute( L"strokeweight", strStrokeWeight.c_str()); m_pXmlWriter->WriteAttribute( L"strokeweight", strStrokeWeight);
if (primitive->type > 0) if (primitive->type > 0)
m_pXmlWriter->WriteAttribute( L"strokecolor", FormatUtils::IntToFormattedWideString(primitive->lineColor, L"#%06x").c_str()); m_pXmlWriter->WriteAttribute( L"strokecolor", FormatUtils::IntToFormattedWideString(primitive->lineColor, L"#%06x"));
m_pXmlWriter->WriteNodeEnd( L"", true, false ); m_pXmlWriter->WriteNodeEnd( L"", true, false );
if (primitive->type > 1 && primitive->fillPattern > 1) if (primitive->type > 1 && primitive->fillPattern > 1)
{ {
m_pXmlWriter->WriteNodeBegin(L"v:fill", true ); m_pXmlWriter->WriteNodeBegin(L"v:fill", true );
m_pXmlWriter->WriteAttribute( L"color2", FormatUtils::IntToFormattedWideString(primitive->fillBack, L"#%06x").c_str()); m_pXmlWriter->WriteAttribute( L"color2", FormatUtils::IntToFormattedWideString(primitive->fillBack, L"#%06x"));
m_pXmlWriter->WriteAttribute( L"type", L"pattern"); m_pXmlWriter->WriteAttribute( L"type", L"pattern");
m_pXmlWriter->WriteNodeEnd( L"", true, false ); m_pXmlWriter->WriteNodeEnd( L"", true, false );
m_pXmlWriter->WriteNodeEnd( L"v:fill" ); m_pXmlWriter->WriteNodeEnd( L"v:fill" );
...@@ -2096,7 +2096,7 @@ namespace DocFileFormat ...@@ -2096,7 +2096,7 @@ namespace DocFileFormat
{ {
m_pXmlWriter->WriteNodeBegin(L"v:stroke", true ); m_pXmlWriter->WriteNodeBegin(L"v:stroke", true );
std::wstring strDashStyle = FormatUtils::IntToWideString(primitive->lineStyle) + L" 1"; std::wstring strDashStyle = FormatUtils::IntToWideString(primitive->lineStyle) + L" 1";
m_pXmlWriter->WriteAttribute( L"dashstyle", strDashStyle.c_str()); m_pXmlWriter->WriteAttribute( L"dashstyle", strDashStyle);
m_pXmlWriter->WriteNodeEnd( L"", true, false ); m_pXmlWriter->WriteNodeEnd( L"", true, false );
m_pXmlWriter->WriteNodeEnd( L"v:stroke" ); m_pXmlWriter->WriteNodeEnd( L"v:stroke" );
} }
......
...@@ -58,21 +58,21 @@ namespace DocFileFormat ...@@ -58,21 +58,21 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeBegin( L"v:shapetype", true ); m_pXmlWriter->WriteNodeBegin( L"v:shapetype", true );
// ID // ID
m_pXmlWriter->WriteAttribute( L"id", GenerateTypeId( pShape ).c_str() ); m_pXmlWriter->WriteAttribute( L"id", GenerateTypeId( pShape ));
// Coordinate System // Coordinate System
m_pXmlWriter->WriteAttribute( L"coordsize", L"21600,21600"); m_pXmlWriter->WriteAttribute( L"coordsize", L"21600,21600");
// Shape Code // Shape Code
m_pXmlWriter->WriteAttribute( L"o:spt", FormatUtils::IntToWideString( pShape->GetTypeCode() ).c_str() ); m_pXmlWriter->WriteAttribute( L"o:spt", FormatUtils::IntToWideString( pShape->GetTypeCode() ));
// Adj // Adj
if (pShape->AdjustmentValues.length()) if (pShape->AdjustmentValues.length())
m_pXmlWriter->WriteAttribute( L"adj", pShape->AdjustmentValues.c_str() ); m_pXmlWriter->WriteAttribute( L"adj", pShape->AdjustmentValues);
// Path // Path
if (!pShape->Path.empty()) if (!pShape->Path.empty())
m_pXmlWriter->WriteAttribute( L"path", pShape->Path.c_str() ); m_pXmlWriter->WriteAttribute( L"path", pShape->Path);
else if (_isInlineShape) else if (_isInlineShape)
m_pXmlWriter->WriteAttribute( L"path", L"m@4@5l@4@11@9@11@9@5xe"); m_pXmlWriter->WriteAttribute( L"path", L"m@4@5l@4@11@9@11@9@5xe");
...@@ -99,12 +99,12 @@ namespace DocFileFormat ...@@ -99,12 +99,12 @@ namespace DocFileFormat
if (!pShape->Textpath.empty()) if (!pShape->Textpath.empty())
{ {
m_pXmlWriter->WriteNodeBegin( L"v:textpath", true ); m_pXmlWriter->WriteNodeBegin( L"v:textpath", true );
m_pXmlWriter->WriteString( pShape->Textpath.c_str() ); m_pXmlWriter->WriteString( pShape->Textpath );
m_pXmlWriter->WriteNodeEnd( L"", true ); m_pXmlWriter->WriteNodeEnd( L"", true );
} }
// Stroke // Stroke
m_pXmlWriter->WriteNodeBegin( L"v:stroke", true ); m_pXmlWriter->WriteNodeBegin( L"v:stroke", true );
m_pXmlWriter->WriteAttribute( L"joinstyle", FormatUtils::MapValueToWideString( pShape->Joins, &JoinStyleMap[0][0], 3, 6 ).c_str() ); m_pXmlWriter->WriteAttribute( L"joinstyle", FormatUtils::MapValueToWideString( pShape->Joins, &JoinStyleMap[0][0], 3, 6 ));
m_pXmlWriter->WriteNodeEnd( L"", true ); m_pXmlWriter->WriteNodeEnd( L"", true );
// Formulas // Formulas
...@@ -115,7 +115,7 @@ namespace DocFileFormat ...@@ -115,7 +115,7 @@ namespace DocFileFormat
for ( std::list<std::wstring>::iterator iter = pShape->Formulas.begin(); iter != pShape->Formulas.end(); iter++ ) for ( std::list<std::wstring>::iterator iter = pShape->Formulas.begin(); iter != pShape->Formulas.end(); iter++ )
{ {
m_pXmlWriter->WriteNodeBegin( L"v:f", true ); m_pXmlWriter->WriteNodeBegin( L"v:f", true );
m_pXmlWriter->WriteAttribute( L"eqn", iter->c_str() ); m_pXmlWriter->WriteAttribute( L"eqn", *iter );
m_pXmlWriter->WriteNodeEnd( L"", true ); m_pXmlWriter->WriteNodeEnd( L"", true );
} }
...@@ -147,19 +147,19 @@ namespace DocFileFormat ...@@ -147,19 +147,19 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute( L"gradientshapeok", L"t" ); m_pXmlWriter->WriteAttribute( L"gradientshapeok", L"t" );
if (pShape->Limo.length()) if (pShape->Limo.length())
m_pXmlWriter->WriteAttribute( L"limo", pShape->Limo.c_str() ); m_pXmlWriter->WriteAttribute( L"limo", pShape->Limo );
if (pShape->ConnectorLocations.length()) if (pShape->ConnectorLocations.length())
{ {
m_pXmlWriter->WriteAttribute( L"o:connecttype", L"custom"); m_pXmlWriter->WriteAttribute( L"o:connecttype", L"custom");
m_pXmlWriter->WriteAttribute( L"o:connectlocs", pShape->ConnectorLocations.c_str() ); m_pXmlWriter->WriteAttribute( L"o:connectlocs", pShape->ConnectorLocations);
} }
if (pShape->TextBoxRectangle.length()) if (pShape->TextBoxRectangle.length())
m_pXmlWriter->WriteAttribute( L"textboxrect", pShape->TextBoxRectangle.c_str() ); m_pXmlWriter->WriteAttribute( L"textboxrect", pShape->TextBoxRectangle);
if (pShape->ConnectorAngles.length()) if (pShape->ConnectorAngles.length())
m_pXmlWriter->WriteAttribute( L"o:connectangles", pShape->ConnectorAngles.c_str() ); m_pXmlWriter->WriteAttribute( L"o:connectangles", pShape->ConnectorAngles);
} }
WordArtTextType* wordArt = dynamic_cast<WordArtTextType*>(pShape); WordArtTextType* wordArt = dynamic_cast<WordArtTextType*>(pShape);
if (wordArt) if (wordArt)
...@@ -177,7 +177,7 @@ namespace DocFileFormat ...@@ -177,7 +177,7 @@ namespace DocFileFormat
if ( _lock->GetAttributeCount() > 1 ) if ( _lock->GetAttributeCount() > 1 )
{ {
m_pXmlWriter->WriteString( _lock->GetXMLString().c_str() ); m_pXmlWriter->WriteString( _lock->GetXMLString() );
} }
// Handles // Handles
...@@ -190,22 +190,22 @@ namespace DocFileFormat ...@@ -190,22 +190,22 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeBegin( L"v:h", true ); m_pXmlWriter->WriteNodeBegin( L"v:h", true );
if (iter->position.length()) if (iter->position.length())
m_pXmlWriter->WriteAttribute( L"position", iter->position.c_str() ); m_pXmlWriter->WriteAttribute( L"position", iter->position);
if (iter->switchHandle.length()) if (iter->switchHandle.length())
m_pXmlWriter->WriteAttribute( L"switch", iter->switchHandle.c_str() ); m_pXmlWriter->WriteAttribute( L"switch", iter->switchHandle);
if (iter->xrange.length()) if (iter->xrange.length())
m_pXmlWriter->WriteAttribute( L"xrange", iter->xrange.c_str() ); m_pXmlWriter->WriteAttribute( L"xrange", iter->xrange);
if (iter->yrange.length()) if (iter->yrange.length())
m_pXmlWriter->WriteAttribute( L"yrange", iter->yrange.c_str() ); m_pXmlWriter->WriteAttribute( L"yrange", iter->yrange);
if (iter->polar.length()) if (iter->polar.length())
m_pXmlWriter->WriteAttribute( L"polar", iter->polar.c_str() ); m_pXmlWriter->WriteAttribute( L"polar", iter->polar);
if (iter->radiusrange.length()) if (iter->radiusrange.length())
m_pXmlWriter->WriteAttribute( L"radiusrange", iter->radiusrange.c_str() ); m_pXmlWriter->WriteAttribute( L"radiusrange", iter->radiusrange );
m_pXmlWriter->WriteNodeEnd( L"", true ); m_pXmlWriter->WriteNodeEnd( L"", true );
} }
......
...@@ -183,7 +183,7 @@ namespace DocFileFormat ...@@ -183,7 +183,7 @@ namespace DocFileFormat
void WordprocessingDocument::SaveDocument() void WordprocessingDocument::SaveDocument()
{ {
std::wstring pathWord = m_strOutputPath + FILE_SEPARATOR_STR + _T( "word" ) ; std::wstring pathWord = m_strOutputPath + FILE_SEPARATOR_STR + _T( "word" ) ;
//OOX::CPath pathWord = CString(m_strOutputPath.c_str()) + FILE_SEPARATOR_STR + _T( "word" ); //OOX::CPath pathWord = CString(m_strOutputPath) + FILE_SEPARATOR_STR + _T( "word" );
//FileSystem::Directory::CreateDirectory( pathWord.GetPath() ); //FileSystem::Directory::CreateDirectory( pathWord.GetPath() );
NSDirectory::CreateDirectory( pathWord ); NSDirectory::CreateDirectory( pathWord );
......
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