Commit e7bbbec0 authored by Alexey Golubev's avatar Alexey Golubev

v5.0.5

parents 07562a95 875717ac
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include "IMapping.h" #include "IMapping.h"
#define GETBITS(from, numL, numH) ((from & (((1 << (numH - numL + 1)) - 1) << numL)) >> numL)
namespace DocFileFormat namespace DocFileFormat
{ {
class IVisitable class IVisitable
......
...@@ -462,57 +462,60 @@ namespace DocFileFormat ...@@ -462,57 +462,60 @@ namespace DocFileFormat
void PropertiesMapping::appendShading( XMLTools::XMLElement* parent, const ShadingDescriptor& desc ) void PropertiesMapping::appendShading( XMLTools::XMLElement* parent, const ShadingDescriptor& desc )
{ {
std::wstring pattern = getShadingPattern( desc );
if ( ( parent != NULL ) && ( desc.shadingSpecialValue == shadingSpecialValueNormal )) if ( ( parent != NULL ) && ( desc.shadingSpecialValue == shadingSpecialValueNormal ))
{ {
XMLTools::XMLElement shd( L"w:shd" ); XMLTools::XMLElement shd( L"w:shd" );
//fill color //pattern
XMLTools::XMLAttribute fill( L"w:fill" ); XMLTools::XMLAttribute val( L"w:val" );
val.SetValue( pattern);
shd.AppendAttribute( val );
if ( desc.shadingType == shadingTypeShd ) if (pattern != L"nil")
{ {
if ( desc.cvBackAuto ) //fill color
XMLTools::XMLAttribute fill( L"w:fill" );
if ( desc.shadingType == shadingTypeShd )
{ {
fill.SetValue( L"auto" ); if ( desc.cvBackAuto )
{
fill.SetValue( L"auto" );
}
else
{
fill.SetValue( RGBColor( (int)desc.cvBack, RedLast ).SixDigitHexCode);
}
} }
else else
{ {
fill.SetValue( RGBColor( (int)desc.cvBack, RedLast ).SixDigitHexCode); fill.SetValue( FormatUtils::MapValueToWideString( desc.icoBack, &Global::ColorIdentifier[0][0], 17, 12 ));
} }
}
else
{
fill.SetValue( FormatUtils::MapValueToWideString( desc.icoBack, &Global::ColorIdentifier[0][0], 17, 12 ));
}
shd.AppendAttribute( fill ); shd.AppendAttribute( fill );
//foreground color //foreground color
XMLTools::XMLAttribute color( L"w:color" ); XMLTools::XMLAttribute color( L"w:color" );
if ( desc.shadingType == shadingTypeShd ) if ( desc.shadingType == shadingTypeShd )
{
if ( desc.cvForeAuto )
{ {
color.SetValue( L"auto" ); if ( desc.cvForeAuto )
{
color.SetValue( L"auto" );
}
else
{
color.SetValue( RGBColor( (int)desc.cvFore, RedLast ).SixDigitHexCode);
}
} }
else else
{ {
color.SetValue( RGBColor( (int)desc.cvFore, RedLast ).SixDigitHexCode); color.SetValue( FormatUtils::MapValueToWideString( desc.icoFore, &Global::ColorIdentifier[0][0], 17, 12 ));
} }
}
else
{
color.SetValue( FormatUtils::MapValueToWideString( desc.icoFore, &Global::ColorIdentifier[0][0], 17, 12 ));
}
shd.AppendAttribute( color );
//pattern
XMLTools::XMLAttribute val( L"w:val" );
val.SetValue( getShadingPattern( desc ));
shd.AppendAttribute( val );
shd.AppendAttribute( color );
}
parent->RemoveChildByName( L"w:shd" ); parent->RemoveChildByName( L"w:shd" );
parent->AppendChild( shd ); parent->AppendChild( shd );
} }
......
...@@ -174,9 +174,9 @@ namespace DocFileFormat ...@@ -174,9 +174,9 @@ namespace DocFileFormat
//it's a Word 97 SPRM //it's a Word 97 SPRM
short val = FormatUtils::BytesToInt16(bytes, 0, size); short val = FormatUtils::BytesToInt16(bytes, 0, size);
icoFore = (val & 0x1F); icoFore = GETBITS(val, 0, 4);
icoBack = ((val >> 5) & 0x1F); icoBack = GETBITS(val, 5, 9);
ipat = (ShadingPattern) ((val >> 10) & 0x3F); ipat = (ShadingPattern) GETBITS(val, 10, 15);
shadingType = shadingTypeShd80; shadingType = shadingTypeShd80;
...@@ -209,7 +209,7 @@ namespace DocFileFormat ...@@ -209,7 +209,7 @@ namespace DocFileFormat
else if (0x0F == icoFore) { cvFore = RGB2 (0x80, 0x80, 0x80); } else if (0x0F == icoFore) { cvFore = RGB2 (0x80, 0x80, 0x80); }
else if (0x10 == icoFore) { cvFore = RGB2 (0xC0, 0xC0, 0xC0); } else if (0x10 == icoFore) { cvFore = RGB2 (0xC0, 0xC0, 0xC0); }
if (0x00 == icoBack) { cvBack = RGB2 (0x00, 0x00, 0x00); cvBackAuto = true; } if (0x00 == icoBack) { cvBack = RGB2 (0xFF, 0xFF, 0xFF); cvBackAuto = true; }
else if (0x01 == icoBack) { cvBack = RGB2 (0x00, 0x00, 0x00); } else if (0x01 == icoBack) { cvBack = RGB2 (0x00, 0x00, 0x00); }
else if (0x02 == icoBack) { cvBack = RGB2 (0x00, 0x00, 0xFF); } else if (0x02 == icoBack) { cvBack = RGB2 (0x00, 0x00, 0xFF); }
else if (0x03 == icoBack) { cvBack = RGB2 (0x00, 0xFF, 0xFF); } else if (0x03 == icoBack) { cvBack = RGB2 (0x00, 0xFF, 0xFF); }
......
...@@ -349,7 +349,7 @@ namespace DocFileFormat ...@@ -349,7 +349,7 @@ namespace DocFileFormat
void TableCellPropertiesMapping::apppendCellShading (unsigned char* sprmArg, int size, int cellIndex) void TableCellPropertiesMapping::apppendCellShading (unsigned char* sprmArg, int size, int cellIndex)
{ {
if (sprmArg) if (sprmArg && cellIndex >= 0)
{ {
//shading descriptor can have 10 bytes (Word 2000) or 2 bytes (Word 97) //shading descriptor can have 10 bytes (Word 2000) or 2 bytes (Word 97)
int shdLength = 2; int shdLength = 2;
......
...@@ -66,10 +66,10 @@ namespace Writers ...@@ -66,10 +66,10 @@ namespace Writers
static std::wstring g_string_ftr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:ftr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">"); static std::wstring g_string_ftr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:ftr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_ftr_End = _T("</w:ftr>"); static std::wstring g_string_ftr_End = _T("</w:ftr>");
static std::wstring g_string_footnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:footnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">"); static std::wstring g_string_footnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:footnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_footnotes_End = _T("</w:footnotes>"); static std::wstring g_string_footnotes_End = _T("</w:footnotes>");
static std::wstring g_string_endnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:endnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">"); static std::wstring g_string_endnotes_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:endnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_endnotes_End = _T("</w:endnotes>"); static std::wstring g_string_endnotes_End = _T("</w:endnotes>");
class HeaderFooterWriter class HeaderFooterWriter
......
...@@ -112,6 +112,10 @@ namespace PPTX ...@@ -112,6 +112,10 @@ namespace PPTX
virtual std::wstring toXML() const virtual std::wstring toXML() const
{ {
std::wstring namespaceLocks = L"a";
std::wstring namespaceLocksLink = PPTX::g_Namespaces.a.m_strLink;
//if (m_namespace == L"wp") namespaceLocks = L"wp";
XmlUtils::CAttribute oAttr; XmlUtils::CAttribute oAttr;
oAttr.Write(_T("noChangeAspect"), noChangeAspect); oAttr.Write(_T("noChangeAspect"), noChangeAspect);
oAttr.Write(_T("noDrilldown"), noDrilldown); oAttr.Write(_T("noDrilldown"), noDrilldown);
...@@ -120,21 +124,23 @@ namespace PPTX ...@@ -120,21 +124,23 @@ namespace PPTX
oAttr.Write(_T("noResize"), noResize); oAttr.Write(_T("noResize"), noResize);
oAttr.Write(_T("noSelect"), noSelect); oAttr.Write(_T("noSelect"), noSelect);
std::wstring namespaceLocks = L"a"; bool isAttrEmpty = oAttr.m_strValue.empty();
//if (m_namespace == L"wp") namespaceLocks = L"wp"; oAttr.Write(_T("xmlns:") + namespaceLocks, namespaceLocksLink);
return XmlUtils::CreateNode(m_namespace + L":cNvGraphicFramePr", oAttr.m_strValue.empty() ? L"" : XmlUtils::CreateNode(namespaceLocks + L":graphicFrameLocks", oAttr)); return XmlUtils::CreateNode(m_namespace + L":cNvGraphicFramePr", isAttrEmpty ? L"" : XmlUtils::CreateNode(namespaceLocks + L":graphicFrameLocks", oAttr));
} }
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
std::wstring namespace_ = m_namespace; std::wstring namespace_ = m_namespace;
std::wstring namespaceLock_ = L"a"; std::wstring namespaceLock_ = L"a";
std::wstring namespaceLockLink_ = PPTX::g_Namespaces.a.m_strLink;
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr"; if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_XLSX) namespace_ = L"xdr";
if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX) if (pWriter->m_lDocType == XMLWRITER_DOC_TYPE_DOCX)
{ {
namespaceLock_ = L"a"; namespaceLock_ = L"a";
namespaceLockLink_ = PPTX::g_Namespaces.a.m_strLink;
namespace_ = L"wp"; namespace_ = L"wp";
} }
...@@ -145,7 +151,7 @@ namespace PPTX ...@@ -145,7 +151,7 @@ namespace PPTX
pWriter->StartNode(namespaceLock_ + L":graphicFrameLocks"); pWriter->StartNode(namespaceLock_ + L":graphicFrameLocks");
pWriter->StartAttributes(); pWriter->StartAttributes();
pWriter->WriteAttribute(_T("xmlns:") + namespaceLock_, namespaceLockLink_);
pWriter->WriteAttribute(_T("noChangeAspect"), noChangeAspect); pWriter->WriteAttribute(_T("noChangeAspect"), noChangeAspect);
pWriter->WriteAttribute(_T("noDrilldown"), noDrilldown); pWriter->WriteAttribute(_T("noDrilldown"), noDrilldown);
pWriter->WriteAttribute(_T("noGrp"), noGrp); pWriter->WriteAttribute(_T("noGrp"), noGrp);
......
...@@ -743,7 +743,7 @@ namespace PPTX ...@@ -743,7 +743,7 @@ namespace PPTX
if(oleObject.IsInit() && oleObject->isValid()) if(oleObject.IsInit() && oleObject->isValid())
{ {
bOle = true; bOle = true;
pWriter->WriteString(L"<p:graphicFrame><p:nvGraphicFramePr><p:cNvPr id=\"0\" name=\"\"/><p:cNvGraphicFramePr><a:graphicFrameLocks noChangeAspect=\"1\"/></p:cNvGraphicFramePr><p:nvPr><p:extLst><p:ext uri=\"{D42A27DB-BD31-4B8C-83A1-F6EECF244321}\"><p14:modId xmlns:p14=\"http://schemas.microsoft.com/office/powerpoint/2010/main\" val=\"2157879785\"/></p:ext></p:extLst></p:nvPr></p:nvGraphicFramePr>"); pWriter->WriteString(L"<p:graphicFrame><p:nvGraphicFramePr><p:cNvPr id=\"0\" name=\"\"/><p:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" noChangeAspect=\"1\"/></p:cNvGraphicFramePr><p:nvPr><p:extLst><p:ext uri=\"{D42A27DB-BD31-4B8C-83A1-F6EECF244321}\"><p14:modId xmlns:p14=\"http://schemas.microsoft.com/office/powerpoint/2010/main\" val=\"2157879785\"/></p:ext></p:extLst></p:nvPr></p:nvGraphicFramePr>");
if(spPr.xfrm.IsInit()) if(spPr.xfrm.IsInit())
{ {
std::wstring oldNamespace = spPr.xfrm->m_ns; std::wstring oldNamespace = spPr.xfrm->m_ns;
......
...@@ -106,7 +106,7 @@ namespace OOX ...@@ -106,7 +106,7 @@ namespace OOX
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{ {
std::wstring sXml; std::wstring sXml;
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:endnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">"); sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:endnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 wp14\">");
for ( unsigned int nIndex = 0; nIndex < m_arrEndnote.size(); nIndex++ ) for ( unsigned int nIndex = 0; nIndex < m_arrEndnote.size(); nIndex++ )
{ {
if ( m_arrEndnote[nIndex] ) if ( m_arrEndnote[nIndex] )
......
...@@ -104,7 +104,7 @@ namespace OOX ...@@ -104,7 +104,7 @@ namespace OOX
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{ {
std::wstring sXml; std::wstring sXml;
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:footnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">"); sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:footnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" mc:Ignorable=\"w14 wp14\">");
for (unsigned int nIndex = 0; nIndex < m_arrFootnote.size(); nIndex++ ) for (unsigned int nIndex = 0; nIndex < m_arrFootnote.size(); nIndex++ )
{ {
if ( m_arrFootnote[nIndex] ) if ( m_arrFootnote[nIndex] )
......
...@@ -2553,7 +2553,7 @@ namespace NExtractTools ...@@ -2553,7 +2553,7 @@ namespace NExtractTools
} }
int oox2mscrypt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params) int oox2mscrypt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
{ {
std::wstring password = params.getPassword(); std::wstring password = params.getSavePassword();
ECMACryptFile cryptReader; ECMACryptFile cryptReader;
...@@ -2987,7 +2987,7 @@ namespace NExtractTools ...@@ -2987,7 +2987,7 @@ namespace NExtractTools
{ {
if(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX == nFormatTo) if(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX == nFormatTo)
{ {
if(params.hasPassword()) if(params.hasSavePassword())
{ {
std::wstring sToMscrypt = sTemp + FILE_SEPARATOR_STR + _T("tomscrypt.docx"); std::wstring sToMscrypt = sTemp + FILE_SEPARATOR_STR + _T("tomscrypt.docx");
nRes = dir2zip(sFrom, sToMscrypt); nRes = dir2zip(sFrom, sToMscrypt);
...@@ -3199,7 +3199,7 @@ namespace NExtractTools ...@@ -3199,7 +3199,7 @@ namespace NExtractTools
{ {
if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX == nFormatTo) if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX == nFormatTo)
{ {
if(params.hasPassword()) if(params.hasSavePassword())
{ {
std::wstring sToMscrypt = sTemp + FILE_SEPARATOR_STR + _T("tomscrypt.xlsx"); std::wstring sToMscrypt = sTemp + FILE_SEPARATOR_STR + _T("tomscrypt.xlsx");
nRes = dir2zip(sFrom, sToMscrypt); nRes = dir2zip(sFrom, sToMscrypt);
...@@ -3386,7 +3386,7 @@ namespace NExtractTools ...@@ -3386,7 +3386,7 @@ namespace NExtractTools
{ {
if(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX == nFormatTo) if(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX == nFormatTo)
{ {
if(params.hasPassword()) if(params.hasSavePassword())
{ {
std::wstring sToMscrypt = sTemp + FILE_SEPARATOR_STR + _T("tomscrypt.pptx"); std::wstring sToMscrypt = sTemp + FILE_SEPARATOR_STR + _T("tomscrypt.pptx");
nRes = dir2zip(sFrom, sToMscrypt); nRes = dir2zip(sFrom, sToMscrypt);
...@@ -4177,6 +4177,14 @@ namespace NExtractTools ...@@ -4177,6 +4177,14 @@ namespace NExtractTools
{ {
result = fromMscrypt (sFileFrom, sFileTo, sTempDir, oInputParams); result = fromMscrypt (sFileFrom, sFileTo, sTempDir, oInputParams);
}break; }break;
case TCD_MSCRYPT2_RAW:
{
result = mscrypt2oox(sFileFrom, sFileTo, sTempDir, oInputParams);
}break;
case TCD_2MSCRYPT_RAW:
{
result = oox2mscrypt(sFileFrom, sFileTo, sTempDir, oInputParams);
}break;
case TCD_MSCRYPT2DOCT: case TCD_MSCRYPT2DOCT:
case TCD_MSCRYPT2XLST: case TCD_MSCRYPT2XLST:
case TCD_MSCRYPT2PPTT: case TCD_MSCRYPT2PPTT:
......
...@@ -165,6 +165,10 @@ namespace NExtractTools ...@@ -165,6 +165,10 @@ namespace NExtractTools
TCD_MSCRYPT2XLST, TCD_MSCRYPT2XLST,
TCD_MSCRYPT2PPTT, TCD_MSCRYPT2PPTT,
TCD_MSCRYPT2BIN, TCD_MSCRYPT2BIN,
TCD_MSCRYPT2_RAW,
TCD_2MSCRYPT_RAW,
// //
TCD_HTML2DOCX, TCD_HTML2DOCX,
TCD_HTML2DOCT, TCD_HTML2DOCT,
...@@ -378,6 +382,7 @@ namespace NExtractTools ...@@ -378,6 +382,7 @@ namespace NExtractTools
int* m_nDoctParams; int* m_nDoctParams;
std::wstring* m_sHtmlFileInternalPath; std::wstring* m_sHtmlFileInternalPath;
std::wstring* m_sPassword; std::wstring* m_sPassword;
std::wstring* m_sSavePassword;
std::wstring* m_sTempDir; std::wstring* m_sTempDir;
bool* m_bIsNoBase64; bool* m_bIsNoBase64;
//output params //output params
...@@ -404,6 +409,7 @@ namespace NExtractTools ...@@ -404,6 +409,7 @@ namespace NExtractTools
m_nDoctParams = NULL; m_nDoctParams = NULL;
m_sHtmlFileInternalPath = NULL; m_sHtmlFileInternalPath = NULL;
m_sPassword = NULL; m_sPassword = NULL;
m_sSavePassword = NULL;
m_sTempDir = NULL; m_sTempDir = NULL;
m_bIsNoBase64 = NULL; m_bIsNoBase64 = NULL;
...@@ -430,6 +436,7 @@ namespace NExtractTools ...@@ -430,6 +436,7 @@ namespace NExtractTools
RELEASEOBJECT(m_nDoctParams); RELEASEOBJECT(m_nDoctParams);
RELEASEOBJECT(m_sHtmlFileInternalPath); RELEASEOBJECT(m_sHtmlFileInternalPath);
RELEASEOBJECT(m_sPassword); RELEASEOBJECT(m_sPassword);
RELEASEOBJECT(m_sSavePassword);
RELEASEOBJECT(m_sTempDir); RELEASEOBJECT(m_sTempDir);
RELEASEOBJECT(m_bIsNoBase64); RELEASEOBJECT(m_bIsNoBase64);
} }
...@@ -518,6 +525,8 @@ namespace NExtractTools ...@@ -518,6 +525,8 @@ namespace NExtractTools
m_sHtmlFileInternalPath = new std::wstring(sValue); m_sHtmlFileInternalPath = new std::wstring(sValue);
else if(_T("m_sPassword") == sName) else if(_T("m_sPassword") == sName)
m_sPassword = new std::wstring(sValue); m_sPassword = new std::wstring(sValue);
else if(_T("m_sSavePassword") == sName)
m_sSavePassword = new std::wstring(sValue);
else if(_T("m_sTempDir") == sName) else if(_T("m_sTempDir") == sName)
m_sTempDir = new std::wstring(sValue); m_sTempDir = new std::wstring(sValue);
else if(_T("m_bIsNoBase64") == sName) else if(_T("m_bIsNoBase64") == sName)
...@@ -545,6 +554,14 @@ namespace NExtractTools ...@@ -545,6 +554,14 @@ namespace NExtractTools
{ {
return (NULL != m_sPassword) ? (*m_sPassword) : L""; return (NULL != m_sPassword) ? (*m_sPassword) : L"";
} }
bool hasSavePassword() const
{
return NULL != m_sSavePassword;
}
std::wstring getSavePassword() const
{
return (NULL != m_sSavePassword) ? (*m_sSavePassword) : L"";
}
std::wstring getFontPath() const std::wstring getFontPath() const
{ {
return (NULL != m_sFontDir) ? (*m_sFontDir) : L""; return (NULL != m_sFontDir) ? (*m_sFontDir) : L"";
......
...@@ -146,6 +146,7 @@ static std::wstring utf8_to_unicode(const char *src) ...@@ -146,6 +146,7 @@ static std::wstring utf8_to_unicode(const char *src)
if (argc > 4) if (argc > 4)
{ {
oInputParams.m_sPassword = new std::wstring(sArg4); oInputParams.m_sPassword = new std::wstring(sArg4);
oInputParams.m_sSavePassword = new std::wstring(sArg4);
} }
result = NExtractTools::fromInputParams(oInputParams); result = NExtractTools::fromInputParams(oInputParams);
} }
......
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