Commit b58026ea authored by Alexey.Musinov's avatar Alexey.Musinov

Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop

* 'develop' of https://github.com/ONLYOFFICE/core:
  OdfFormatReader - fix after testing
  .
  PptFormat - support vba macros
  DocFormat - vba macros
parents 09a8a679 66db5b09
...@@ -157,6 +157,7 @@ namespace OpenXmlRelationshipTypes ...@@ -157,6 +157,7 @@ namespace OpenXmlRelationshipTypes
static const wchar_t* OleObject = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"; static const wchar_t* OleObject = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";
static const wchar_t* GlossaryDocument = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument"; static const wchar_t* GlossaryDocument = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument";
static const wchar_t* Package = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"; static const wchar_t* Package = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package";
static const wchar_t* VbaProject = L"http://schemas.microsoft.com/office/2006/relationships/vbaProject";
} }
namespace MicrosoftWordRelationshipTypes namespace MicrosoftWordRelationshipTypes
......
...@@ -65,7 +65,7 @@ namespace DocFileFormat ...@@ -65,7 +65,7 @@ namespace DocFileFormat
{ {
ConversionContext context( doc, docx ); ConversionContext context( doc, docx );
//Write styles.xml //Write styles.xml
if (doc->Styles) if (doc->Styles)
{ {
StyleSheetMapping styleSheetMapping( &context ); StyleSheetMapping styleSheetMapping( &context );
...@@ -88,9 +88,7 @@ namespace DocFileFormat ...@@ -88,9 +88,7 @@ namespace DocFileFormat
return S_FALSE; return S_FALSE;
} }
} }
//Write numbering.xml
//Write numbering.xml
if (doc->listTable) if (doc->listTable)
{ {
NumberingMapping numberingMapping( &context ); NumberingMapping numberingMapping( &context );
...@@ -110,7 +108,7 @@ namespace DocFileFormat ...@@ -110,7 +108,7 @@ namespace DocFileFormat
} }
} }
//Write fontTable.xml //Write fontTable.xml
if (doc->FontTable) if (doc->FontTable)
{ {
FontTableMapping fontTableMapping( &context ); FontTableMapping fontTableMapping( &context );
...@@ -130,7 +128,7 @@ namespace DocFileFormat ...@@ -130,7 +128,7 @@ namespace DocFileFormat
} }
} }
//write the footnotes //write the footnotes
FootnotesMapping footnotesMapping( &context ); FootnotesMapping footnotesMapping( &context );
doc->Convert( &footnotesMapping ); doc->Convert( &footnotesMapping );
...@@ -147,7 +145,7 @@ namespace DocFileFormat ...@@ -147,7 +145,7 @@ namespace DocFileFormat
} }
} }
//write the endnotes //write the endnotes
EndnotesMapping endnotesMapping( &context ); EndnotesMapping endnotesMapping( &context );
doc->Convert( &endnotesMapping ); doc->Convert( &endnotesMapping );
...@@ -164,7 +162,7 @@ namespace DocFileFormat ...@@ -164,7 +162,7 @@ namespace DocFileFormat
} }
} }
//write the comments //write the comments
CommentsMapping commentsMapping( &context ); CommentsMapping commentsMapping( &context );
doc->Convert( &commentsMapping ); doc->Convert( &commentsMapping );
...@@ -181,13 +179,13 @@ namespace DocFileFormat ...@@ -181,13 +179,13 @@ namespace DocFileFormat
} }
} }
//write settings.xml at last because of the rsid list //write settings.xml at last because of the rsid list
if (doc->DocProperties) if (doc->DocProperties)
{ {
SettingsMapping settingsMapping( &context ); SettingsMapping settingsMapping( &context );
doc->DocProperties->Convert( &settingsMapping ); doc->DocProperties->Convert( &settingsMapping );
} }
if ( progress != NULL ) if ( progress != NULL )
{ {
progress->OnProgress( progress->caller, DOC_ONPROGRESSEVENT_ID, 975000 ); progress->OnProgress( progress->caller, DOC_ONPROGRESSEVENT_ID, 975000 );
...@@ -204,7 +202,7 @@ namespace DocFileFormat ...@@ -204,7 +202,7 @@ namespace DocFileFormat
return S_OK; return S_OK;
} }
long Converter::LoadAndConvert(const std::wstring& strSrcFile, const std::wstring& strDstDirectory, const std::wstring& password, const ProgressCallback* progress) long Converter::LoadAndConvert(const std::wstring& strSrcFile, const std::wstring& strDstDirectory, const std::wstring& password, const ProgressCallback* progress, bool &bMacros)
{ {
long result = S_FALSE; long result = S_FALSE;
...@@ -219,7 +217,7 @@ namespace DocFileFormat ...@@ -219,7 +217,7 @@ namespace DocFileFormat
if (result == S_OK) if (result == S_OK)
{ {
docx.SaveDocument(); docx.SaveDocument(bMacros);
if (progress)progress->OnProgress(progress->caller, DOC_ONPROGRESSEVENT_ID, 1000000); if (progress)progress->OnProgress(progress->caller, DOC_ONPROGRESSEVENT_ID, 1000000);
......
...@@ -48,7 +48,7 @@ namespace DocFileFormat ...@@ -48,7 +48,7 @@ namespace DocFileFormat
std::wstring m_sTempFolder; std::wstring m_sTempFolder;
long LoadAndConvert(const std::wstring & strSrcFile, const std::wstring & strDstDirectory, const std::wstring & password, const ProgressCallback* progress); long LoadAndConvert(const std::wstring & strSrcFile, const std::wstring & strDstDirectory, const std::wstring & password, const ProgressCallback* progress, bool &bMacros);
private: private:
long Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress); long Convert(WordDocument* doc, WordprocessingDocument* docx, const ProgressCallback* progress);
......
...@@ -50,8 +50,7 @@ namespace DocFileFormat ...@@ -50,8 +50,7 @@ namespace DocFileFormat
void MainDocumentMapping::Apply(IVisitable* visited) void MainDocumentMapping::Apply(IVisitable* visited)
{ {
m_document = static_cast<WordDocument*>(visited); m_document = static_cast<WordDocument*>(visited);
m_context->_docx->RegisterDocument();
// Header // Header
m_pXmlWriter->WriteNodeBegin(L"?xml version=\"1.0\" encoding=\"UTF-8\"?"); m_pXmlWriter->WriteNodeBegin(L"?xml version=\"1.0\" encoding=\"UTF-8\"?");
m_pXmlWriter->WriteNodeBegin(L"w:document", TRUE ); m_pXmlWriter->WriteNodeBegin(L"w:document", TRUE );
......
...@@ -73,7 +73,6 @@ namespace DocFileFormat ...@@ -73,7 +73,6 @@ namespace DocFileFormat
NSDirectory::CreateDirectory( m_strOutputPath + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + L"_rels" ); NSDirectory::CreateDirectory( m_strOutputPath + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + L"_rels" );
WriteRelsFile( DocumentRelationshipsFile ); WriteRelsFile( DocumentRelationshipsFile );
WriteRelsFile( FootnotesRelationshipsFile ); WriteRelsFile( FootnotesRelationshipsFile );
...@@ -199,7 +198,14 @@ namespace DocFileFormat ...@@ -199,7 +198,14 @@ namespace DocFileFormat
{ {
return AddPart( L"word", L"document.xml", WordprocessingMLContentTypes::MainDocument, L""); return AddPart( L"word", L"document.xml", WordprocessingMLContentTypes::MainDocument, L"");
} }
int OpenXmlPackage::RegisterDocumentMacros()
{
return AddPart( L"word", L"document.xml", WordprocessingMLContentTypes::MainDocumentMacro, L"");
}
int OpenXmlPackage::RegisterVbaProject()
{
return AddPart( L"word", L"vbaProject.bin", MicrosoftWordContentTypes::VbaProject, OpenXmlRelationshipTypes::VbaProject );
}
int OpenXmlPackage::RegisterFontTable() int OpenXmlPackage::RegisterFontTable()
{ {
return AddPart( L"word", L"fontTable.xml", WordprocessingMLContentTypes::FontTable, OpenXmlRelationshipTypes::FontTable ); return AddPart( L"word", L"fontTable.xml", WordprocessingMLContentTypes::FontTable, OpenXmlRelationshipTypes::FontTable );
......
...@@ -118,6 +118,8 @@ namespace DocFileFormat ...@@ -118,6 +118,8 @@ namespace DocFileFormat
class OpenXmlPackage class OpenXmlPackage
{ {
public:
const WordDocument* docFile;
private: private:
ContentTypesFile DocumentContentTypesFile; ContentTypesFile DocumentContentTypesFile;
RelationshipsFile MainRelationshipsFile; RelationshipsFile MainRelationshipsFile;
...@@ -137,8 +139,6 @@ namespace DocFileFormat ...@@ -137,8 +139,6 @@ namespace DocFileFormat
int _footerCounter; int _footerCounter;
int _oleCounter; int _oleCounter;
const WordDocument* docFile;
int AddHeaderPart( const std::wstring& fileName, const std::wstring& relationshipType = L"", const std::wstring& targetMode = L"" ); int AddHeaderPart( const std::wstring& fileName, const std::wstring& relationshipType = L"", const std::wstring& targetMode = L"" );
int AddFooterPart( const std::wstring& fileName, const std::wstring& relationshipType = L"", const std::wstring& targetMode = L"" ); int AddFooterPart( const std::wstring& fileName, const std::wstring& relationshipType = L"", const std::wstring& targetMode = L"" );
int AddFootnotesPart( const std::wstring& fileName, const std::wstring& relationshipType = L"", const std::wstring& targetMode = L"" ); int AddFootnotesPart( const std::wstring& fileName, const std::wstring& relationshipType = L"", const std::wstring& targetMode = L"" );
...@@ -166,6 +166,7 @@ namespace DocFileFormat ...@@ -166,6 +166,7 @@ namespace DocFileFormat
HRESULT SaveEmbeddedObject ( const std::wstring& fileName, const std::string& data ); HRESULT SaveEmbeddedObject ( const std::wstring& fileName, const std::string& data );
int RegisterDocument(); int RegisterDocument();
int RegisterDocumentMacros();
int RegisterFontTable(); int RegisterFontTable();
int RegisterNumbering(); int RegisterNumbering();
int RegisterSettings(); int RegisterSettings();
...@@ -179,5 +180,6 @@ namespace DocFileFormat ...@@ -179,5 +180,6 @@ namespace DocFileFormat
int RegisterOLEObject ( const IMapping* mapping, const std::wstring& objectType ); int RegisterOLEObject ( const IMapping* mapping, const std::wstring& objectType );
int RegisterPackage ( const IMapping* mapping, const std::wstring& objectType); int RegisterPackage ( const IMapping* mapping, const std::wstring& objectType);
int RegisterExternalOLEObject( const IMapping* mapping, const std::wstring& objectType, const std::wstring& uri ); int RegisterExternalOLEObject( const IMapping* mapping, const std::wstring& objectType, const std::wstring& uri );
int RegisterVbaProject();
}; };
} }
...@@ -42,7 +42,6 @@ namespace DocFileFormat ...@@ -42,7 +42,6 @@ namespace DocFileFormat
{ {
} }
~StructuredStorageReader() ~StructuredStorageReader()
{ {
if(m_pStorage) if(m_pStorage)
...@@ -62,6 +61,12 @@ namespace DocFileFormat ...@@ -62,6 +61,12 @@ namespace DocFileFormat
} }
return false; return false;
} }
bool isDirectory( const std::string& name )
{
if (!m_pStorage) return false;
return m_pStorage->isDirectory(name);
}
bool GetStream (const char *path, POLE::Stream** ppStream) bool GetStream (const char *path, POLE::Stream** ppStream)
{ {
...@@ -79,8 +84,78 @@ namespace DocFileFormat ...@@ -79,8 +84,78 @@ namespace DocFileFormat
{ {
return m_pStorage; return m_pStorage;
} }
void copy( int indent, std::string path, POLE::Storage * storageOut, bool withRoot = true)
{
std::list<std::string> entries, entries_sort;
entries = m_pStorage->entries( path );
for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
{
std::string name = *it;
std::string fullname = path + name;
if( m_pStorage->isDirectory( fullname ) )
{
entries_sort.push_back(name);
}
else
{
entries_sort.push_front(name);
}
}
//for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
for( std::list<std::string>::iterator it = entries_sort.begin(); it != entries_sort.end(); it++ )
{
std::string name = *it;
std::string fullname = path + name;
if( m_pStorage->isDirectory( fullname ) )
{
copy( indent + 1, fullname + "/", storageOut, withRoot );
}
else
{
copy_stream(fullname, storageOut, withRoot);
}
}
}
private: private:
void copy_stream(std::string streamName, POLE::Storage * storageOut, bool withRoot = true)
{
POLE::Stream *stream = new POLE::Stream(m_pStorage, streamName);
if (!stream) return;
stream->seek(0);
int size_stream = stream->size();
if (withRoot == false)
{
int pos = streamName.find("/");
if (pos >= 0)
streamName = streamName.substr(pos + 1);
}
POLE::Stream *streamNew = new POLE::Stream(storageOut, streamName, true, size_stream);
if (!streamNew) return;
unsigned char* data_stream = new unsigned char[size_stream];
if (data_stream)
{
stream->read(data_stream, size_stream);
streamNew->write(data_stream, size_stream);
delete []data_stream;
data_stream = NULL;
}
streamNew->flush();
delete streamNew;
delete stream;
}
POLE::Storage* m_pStorage; POLE::Storage* m_pStorage;
}; };
......
...@@ -528,11 +528,24 @@ namespace DocFileFormat ...@@ -528,11 +528,24 @@ namespace DocFileFormat
} }
void WordDocument::DecryptStream( int level, std::string path, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor) void WordDocument::DecryptStream( int level, std::string path, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor)
{ {
std::list<std::string> entries; std::list<std::string> entries, entries_sort;
entries = storageIn->entries( path ); entries = storageIn->entries( path );
std::list<std::string>::iterator it; for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
for( it = entries.begin(); it != entries.end(); ++it ) {
std::string name = *it;
std::string fullname = path + name;
if( storageIn->isDirectory( fullname ) )
{
entries_sort.push_back(name);
}
else
{
entries_sort.push_front(name);
}
}
for( std::list<std::string>::iterator it = entries_sort.begin(); it != entries_sort.end(); ++it )
{ {
std::string name = *it; std::string name = *it;
std::string fullname = path + name; std::string fullname = path + name;
......
...@@ -99,18 +99,17 @@ namespace DocFileFormat ...@@ -99,18 +99,17 @@ namespace DocFileFormat
bool bOlderVersion; bool bOlderVersion;
int document_code_page; int document_code_page;
inline StructuredStorageReader* GetStorage() const
{
return m_pStorage;
}
private: private:
bool DecryptOfficeFile (CRYPT::Decryptor* Decryptor); bool DecryptOfficeFile (CRYPT::Decryptor* Decryptor);
bool DecryptStream (std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor); bool DecryptStream (std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor);
void DecryptStream (int level, std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor); void DecryptStream (int level, std::string streamName, POLE::Storage * storageIn, POLE::Storage * storageOut, CRYPT::Decryptor* Decryptor);
inline StructuredStorageReader* GetStorage() const
{
return m_pStorage;
}
inline OfficeArtContent* GetOfficeArt () inline OfficeArtContent* GetOfficeArt ()
{ {
return officeArtContent; return officeArtContent;
......
...@@ -180,10 +180,37 @@ namespace DocFileFormat ...@@ -180,10 +180,37 @@ namespace DocFileFormat
{ {
} }
void WordprocessingDocument::SaveDocument() void WordprocessingDocument::SaveDocument(bool &bMacros)
{ {
std::wstring pathWord = m_strOutputPath + FILE_SEPARATOR_STR + L"word" ; std::wstring pathWord = m_strOutputPath + FILE_SEPARATOR_STR + L"word" ;
NSDirectory::CreateDirectory( pathWord ); NSDirectory::CreateDirectory( pathWord );
if (bMacros && docFile->GetStorage()->isDirectory("Macros"))
{
std::wstring sVbaProjectFile = pathWord + FILE_SEPARATOR_STR + L"vbaProject.bin";
POLE::Storage *storageVbaProject = new POLE::Storage(sVbaProjectFile.c_str());
if ((storageVbaProject) && (storageVbaProject->open(true, true)))
{
docFile->GetStorage()->copy(0, "Macros/", storageVbaProject, false);
storageVbaProject->close();
delete storageVbaProject;
RegisterDocumentMacros();
RegisterVbaProject();
//output_document->get_xl_files().add_vba_project();
}
else bMacros = false;
}
else
bMacros = false;
if (!bMacros)
{
RegisterDocument();
}
WritePackage(); WritePackage();
......
...@@ -76,6 +76,7 @@ namespace DocFileFormat ...@@ -76,6 +76,7 @@ namespace DocFileFormat
public: public:
WordprocessingDocument(const std::wstring & _docxDirectory, const WordDocument* _docFile); WordprocessingDocument(const std::wstring & _docxDirectory, const WordDocument* _docFile);
virtual ~WordprocessingDocument(); virtual ~WordprocessingDocument();
void SaveDocument();
void SaveDocument(bool &bMacros);
}; };
} }
\ No newline at end of file
...@@ -34,14 +34,14 @@ ...@@ -34,14 +34,14 @@
#include "../DocDocxConverter/Converter.h" #include "../DocDocxConverter/Converter.h"
#include "../../OfficeUtils/src/OfficeUtils.h" #include "../../OfficeUtils/src/OfficeUtils.h"
HRESULT COfficeDocFile::LoadFromFile(const std::wstring & docFile, const std::wstring & docxDirectory, const std::wstring & password, ProgressCallback *ffCallBack ) HRESULT COfficeDocFile::LoadFromFile(const std::wstring & docFile, const std::wstring & docxDirectory, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack)
{ {
HRESULT hr = S_FALSE; HRESULT hr = S_FALSE;
DocFileFormat::Converter docToDocx; DocFileFormat::Converter docToDocx;
docToDocx.m_sTempFolder = m_sTempFolder; docToDocx.m_sTempFolder = m_sTempFolder;
hr= docToDocx.LoadAndConvert(docFile, docxDirectory, password, ffCallBack); hr= docToDocx.LoadAndConvert(docFile, docxDirectory, password, ffCallBack, bMacros);
return hr; return hr;
} }
......
...@@ -53,7 +53,7 @@ public: ...@@ -53,7 +53,7 @@ public:
std::wstring m_sTempFolder; std::wstring m_sTempFolder;
HRESULT LoadFromFile(const std::wstring & sSrcFileName, const std::wstring & sDstFileName, const std::wstring & password, ProgressCallback *ffCallBack = NULL); HRESULT LoadFromFile(const std::wstring & sSrcFileName, const std::wstring & sDstFileName, const std::wstring & password, bool &bMacros, ProgressCallback *ffCallBack = NULL);
HRESULT SaveToFile(const std::wstring & sDstFileName, const std::wstring & sSrcFileName, ProgressCallback *ffCallBack = NULL); HRESULT SaveToFile(const std::wstring & sDstFileName, const std::wstring & sSrcFileName, ProgressCallback *ffCallBack = NULL);
}; };
......
...@@ -54,17 +54,27 @@ int _tmain(int argc, _TCHAR* argv[]) ...@@ -54,17 +54,27 @@ int _tmain(int argc, _TCHAR* argv[])
if (argc < 2) return 1; if (argc < 2) return 1;
std::wstring sSrcDoc = argv[1]; std::wstring sSrcDoc = argv[1];
std::wstring sDstDocx = argc > 2 ? argv[2] : sSrcDoc + L"-my.docx"; std::wstring sDstDocx;
std::wstring outputDir = NSDirectory::GetFolderPath(sDstDocx); std::wstring outputDir = NSDirectory::GetFolderPath(sSrcDoc);
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir); std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
COfficeDocFile docFile; COfficeDocFile docFile;
docFile.m_sTempFolder = outputDir; docFile.m_sTempFolder = outputDir;
HRESULT hRes = docFile.LoadFromFile( sSrcDoc, dstTempPath, L"password", NULL); bool bMacros = true;
HRESULT hRes = docFile.LoadFromFile( sSrcDoc, dstTempPath, L"password", bMacros, NULL);
if (bMacros)
{
sDstDocx = sSrcDoc + L"-my.docm";
}
else
{
sDstDocx = sSrcDoc + L"-my.docx";
}
if (hRes == S_OK) if (hRes == S_OK)
{ {
COfficeUtils oCOfficeUtils(NULL); COfficeUtils oCOfficeUtils(NULL);
......
...@@ -378,7 +378,8 @@ void docx_conversion_context::start_document() ...@@ -378,7 +378,8 @@ void docx_conversion_context::start_document()
output_stream() << L"xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" "; output_stream() << L"xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" ";
output_stream() << L"xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" "; output_stream() << L"xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" ";
output_stream() << L"xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" "; output_stream() << L"xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" ";
output_stream() << L"xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" "; output_stream() << L"xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" ";
output_stream() << L"xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" ";
output_stream() << L"mc:Ignorable=\"w14 wp14\">"; output_stream() << L"mc:Ignorable=\"w14 wp14\">";
...@@ -406,14 +407,12 @@ void docx_conversion_context::end_document() ...@@ -406,14 +407,12 @@ void docx_conversion_context::end_document()
output_document_->get_word_files().set_notes(notes_context_); output_document_->get_word_files().set_notes(notes_context_);
//////////////////////// ////////////////////////
int count = 0; for (size_t i = 0; i < charts_.size(); i++)
BOOST_FOREACH(const oox_chart_context_ptr& chart, charts_)
{ {
count++;
package::chart_content_ptr content = package::chart_content::create(); package::chart_content_ptr content = package::chart_content::create();
chart->serialize(content->content()); charts_[i]->serialize(content->content());
chart->dump_rels(content->get_rel_file()->get_rels()); charts_[i]->dump_rels(content->get_rel_file()->get_rels());
output_document_->get_word_files().add_charts(content); output_document_->get_word_files().add_charts(content);
...@@ -580,10 +579,10 @@ mc:Ignorable=\"w14 wp14\">"; ...@@ -580,10 +579,10 @@ mc:Ignorable=\"w14 wp14\">";
strm << L"</w:abstractNum>"; strm << L"</w:abstractNum>";
} }
BOOST_FOREACH(int numId, numIds) for (size_t i = 0; i < numIds.size(); i++)
{ {
strm << L"<w:num w:numId=\"" << numId << L"\" >"; strm << L"<w:num w:numId=\"" << numIds[i] << L"\" >";
strm << L"<w:abstractNumId w:val=\"" << numId << "\" />"; strm << L"<w:abstractNumId w:val=\"" << numIds[i] << "\" />";
strm << L"</w:num>"; strm << L"</w:num>";
} }
......
...@@ -319,6 +319,7 @@ namespace ...@@ -319,6 +319,7 @@ namespace
xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \ xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \ xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \ xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" >"; xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" >";
//mc:Ignorable=\"w14 wp14\" //mc:Ignorable=\"w14 wp14\"
......
...@@ -57,6 +57,7 @@ oox_chart_series::oox_chart_series() ...@@ -57,6 +57,7 @@ oox_chart_series::oox_chart_series()
iSymbolMarkerType_ = 0; iSymbolMarkerType_ = 0;
bLocalTable_ = false; bLocalTable_ = false;
labelPosEnabled_ = true;
} }
void oox_chart_series::setName(std::wstring &value) void oox_chart_series::setName(std::wstring &value)
{ {
...@@ -135,7 +136,7 @@ void oox_chart_series::parse_properties() ...@@ -135,7 +136,7 @@ void oox_chart_series::parse_properties()
if (*intVal == 2) data_labels_->set_showPercent(true); if (*intVal == 2) data_labels_->set_showPercent(true);
} }
odf_reader::GetProperty(content_.properties_, L"label-position", intVal); odf_reader::GetProperty(content_.properties_, L"label-position", intVal);
if (intVal) if (intVal && labelPosEnabled_)
{ {
if (!data_labels_) data_labels_ = oox_data_labels(); if (!data_labels_) data_labels_ = oox_data_labels();
......
...@@ -55,6 +55,7 @@ public: ...@@ -55,6 +55,7 @@ public:
virtual void oox_serialize(std::wostream & _Wostream) = 0; virtual void oox_serialize(std::wostream & _Wostream) = 0;
bool labelPosEnabled_;
_oox_chart_values values_[5]; //cat(labels), common, x, y, bubble, _oox_chart_values values_[5]; //cat(labels), common, x, y, bubble,
int id_; int id_;
std::wstring name_; //tx (Series Text) §21.2.2.215 std::wstring name_; //tx (Series Text) §21.2.2.215
......
...@@ -117,15 +117,15 @@ void oox_data_labels::oox_serialize(std::wostream & _Wostream) ...@@ -117,15 +117,15 @@ void oox_data_labels::oox_serialize(std::wostream & _Wostream)
case 1: CP_XML_ATTR(L"val", L"b"); break; case 1: CP_XML_ATTR(L"val", L"b"); break;
case 2: CP_XML_ATTR(L"val", L"b"); break; case 2: CP_XML_ATTR(L"val", L"b"); break;
case 3: CP_XML_ATTR(L"val", L"b"); break; case 3: CP_XML_ATTR(L"val", L"b"); break;
case 4: CP_XML_ATTR(L"val", L"ctr"); break;
case 5: CP_XML_ATTR(L"val", L"inEnd"); break;
case 6: CP_XML_ATTR(L"val", L"l"); break; case 6: CP_XML_ATTR(L"val", L"l"); break;
case 7: CP_XML_ATTR(L"val", L"inBase"); break; case 7: CP_XML_ATTR(L"val", L"inBase"); break;
case 8: CP_XML_ATTR(L"val", L"outEnd"); break;
case 9: CP_XML_ATTR(L"val", L"r"); break; case 9: CP_XML_ATTR(L"val", L"r"); break;
case 10: CP_XML_ATTR(L"val", L"t"); break; case 10: CP_XML_ATTR(L"val", L"t"); break;
case 11: CP_XML_ATTR(L"val", L"t"); break; case 11: CP_XML_ATTR(L"val", L"t"); break;
case 12: CP_XML_ATTR(L"val", L"t"); break; case 12: CP_XML_ATTR(L"val", L"t"); break;
case 5: //CP_XML_ATTR(L"val", L"inEnd"); break;
case 8: //CP_XML_ATTR(L"val", L"outEnd"); break;
case 4: CP_XML_ATTR(L"val", L"ctr"); break;
} }
} }
......
...@@ -171,7 +171,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope ...@@ -171,7 +171,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
if ( color.empty() ) if ( color.empty() )
{ {
if (always_draw) color = L"000000"; if (always_draw) color = L"000000";
else color = L"FFFFFFFF"; else color = L"FFFFFF";
} }
CP_XML_NODE(L"a:srgbClr") CP_XML_NODE(L"a:srgbClr")
...@@ -210,16 +210,15 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope ...@@ -210,16 +210,15 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
} }
} }
} }
void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop) void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop, const std::wstring & shapeGeomPreset)
{ {
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
{ {
CP_XML_NODE(L"a:avLst") CP_XML_NODE(L"a:avLst")
{ {
_CP_OPT(bool) bModifiers;
_CP_OPT(std::wstring) strModifiers; _CP_OPT(std::wstring) strModifiers;
odf_reader::GetProperty(prop, L"bModifiers", bModifiers);
odf_reader::GetProperty(prop, L"oox-draw-modifiers", strModifiers); odf_reader::GetProperty(prop, L"oox-draw-modifiers", strModifiers);
if (strModifiers) if (strModifiers)
{ {
std::vector< std::wstring > values; std::vector< std::wstring > values;
...@@ -227,17 +226,61 @@ void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_pro ...@@ -227,17 +226,61 @@ void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_pro
if (!values.empty() && values.back().empty()) values.pop_back(); if (!values.empty() && values.back().empty()) values.pop_back();
std::vector<std::wstring> names;
if (std::wstring::npos != shapeGeomPreset.find(L"math") ||
std::wstring::npos != shapeGeomPreset.find(L"bentConnector") ||
std::wstring::npos != shapeGeomPreset.find(L"curvedConnector")||
std::wstring::npos != shapeGeomPreset.find(L"frame"))
{
names.push_back(L"adj1");
}
else if (std::wstring::npos != shapeGeomPreset.find(L"decagon"))
{
names.push_back(L"vf");
}
else if (std::wstring::npos != shapeGeomPreset.find(L"heptagon") ||
std::wstring::npos != shapeGeomPreset.find(L"pentagon"))
{
names.push_back(L"hf");
names.push_back(L"vf");
}
else if (std::wstring::npos != shapeGeomPreset.find(L"hexagon"))
{
names.push_back(L"adj");
names.push_back(L"vf");
}
else if (std::wstring::npos != shapeGeomPreset.find(L"star5")||
std::wstring::npos != shapeGeomPreset.find(L"star7"))
{
names.push_back(L"adj");
names.push_back(L"hf");
names.push_back(L"vf");
}
else if (std::wstring::npos != shapeGeomPreset.find(L"star6") ||
std::wstring::npos != shapeGeomPreset.find(L"star10"))
{
names.push_back(L"adj");
names.push_back(L"hf");
}
for (size_t i = 0; i < values.size(); i++) for (size_t i = 0; i < values.size(); i++)
{ {
if (values[i].empty()) continue; if (values[i].empty()) continue;
CP_XML_NODE(L"a:gd") CP_XML_NODE(L"a:gd")
{ {
//if (values.size() > 1 || bModifiers) if (names.size() > i)
//весьма странное .. для некоторых модификаторов (напр math...) нужно указывать множественность их {
CP_XML_ATTR(L"name", L"adj" + std::to_wstring(i+1)); CP_XML_ATTR(L"name", names[i]);
//else }
// CP_XML_ATTR(L"name", L"adj"); else
{
if (values.size() > 1)
CP_XML_ATTR(L"name", L"adj" + std::to_wstring(i + 1));
else
CP_XML_ATTR(L"name", L"adj");
}
CP_XML_ATTR(L"fmla", L"val " + values[i]); CP_XML_ATTR(L"fmla", L"val " + values[i]);
} }
} }
...@@ -321,7 +364,8 @@ void _oox_drawing::serialize_bodyPr(std::wostream & strm, const std::wstring & n ...@@ -321,7 +364,8 @@ void _oox_drawing::serialize_bodyPr(std::wostream & strm, const std::wstring & n
CP_XML_NODE(L"a:prstTxWarp") CP_XML_NODE(L"a:prstTxWarp")
{ {
CP_XML_ATTR(L"prst", shapeType); CP_XML_ATTR(L"prst", shapeType);
oox_serialize_aLst(CP_XML_STREAM(), prop);
oox_serialize_aLst(CP_XML_STREAM(), prop, shapeType);
} }
} }
} }
...@@ -370,7 +414,8 @@ void _oox_drawing::serialize_shape(std::wostream & strm) ...@@ -370,7 +414,8 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
{ {
CP_XML_NODE(L"a:custGeom") CP_XML_NODE(L"a:custGeom")
{ {
oox_serialize_aLst(CP_XML_STREAM(), additional); std::vector<std::wstring> names;
oox_serialize_aLst(CP_XML_STREAM(), additional, L"");
CP_XML_NODE(L"a:ahLst"); CP_XML_NODE(L"a:ahLst");
CP_XML_NODE(L"a:gdLst"); CP_XML_NODE(L"a:gdLst");
...@@ -414,11 +459,7 @@ void _oox_drawing::serialize_shape(std::wostream & strm) ...@@ -414,11 +459,7 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
CP_XML_ATTR(L"prst", shapeGeomPreset); CP_XML_ATTR(L"prst", shapeGeomPreset);
if (!bWordArt) if (!bWordArt)
{ {
if (std::wstring::npos != shapeGeomPreset.find(L"mathPlus")) oox_serialize_aLst(CP_XML_STREAM(), additional, shapeGeomPreset);
{
additional.push_back(odf_reader::_property(L"bModifiers", true));
}
oox_serialize_aLst(CP_XML_STREAM(), additional);
} }
} }
} }
...@@ -525,9 +566,6 @@ void oox_serialize_action(std::wostream & strm, _action_desc const & val) ...@@ -525,9 +566,6 @@ void oox_serialize_action(std::wostream & strm, _action_desc const & val)
{ {
CP_XML_NODE(L"a:hlinkClick") CP_XML_NODE(L"a:hlinkClick")
{ {
//CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
//CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
if (!val.action.empty()) if (!val.action.empty())
CP_XML_ATTR(L"action", val.action); CP_XML_ATTR(L"action", val.action);
...@@ -544,6 +582,8 @@ void oox_serialize_action(std::wostream & strm, _action_desc const & val) ...@@ -544,6 +582,8 @@ void oox_serialize_action(std::wostream & strm, _action_desc const & val)
CP_XML_ATTR(L"name", L"sound"); CP_XML_ATTR(L"name", L"sound");
} }
} }
//CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
//CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
} }
} }
} }
......
...@@ -118,7 +118,7 @@ namespace oox { ...@@ -118,7 +118,7 @@ namespace oox {
typedef _CP_PTR(_oox_drawing) oox_drawing_ptr; typedef _CP_PTR(_oox_drawing) oox_drawing_ptr;
void oox_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val, bool always_draw = false); void oox_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val, bool always_draw = false);
void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val); void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val, const std::wstring & shapeGeomPreset);
void oox_serialize_action (std::wostream & strm, const _action_desc & val); void oox_serialize_action (std::wostream & strm, const _action_desc & val);
} }
......
...@@ -168,7 +168,7 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val) ...@@ -168,7 +168,7 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
{ {
if (val.bitmap->isInternal) if (val.bitmap->isInternal)
{ {
//CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"); CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"r:embed", val.bitmap->rId ); CP_XML_ATTR(L"r:embed", val.bitmap->rId );
} }
else else
......
...@@ -102,6 +102,10 @@ void oox_chart::oox_serialize_common(std::wostream & _Wostream) ...@@ -102,6 +102,10 @@ void oox_chart::oox_serialize_common(std::wostream & _Wostream)
} }
for (size_t i = 0; i < series_.size(); i++) for (size_t i = 0; i < series_.size(); i++)
{ {
if (is3D_ || type_ == CHART_TYPE_AREA || type_ == CHART_TYPE_STOCK)
{
series_[i]->labelPosEnabled_ = false;
}
series_[i]->oox_serialize(_Wostream); series_[i]->oox_serialize(_Wostream);
} }
for (size_t i = 0; i < axisId_.size(); i++) for (size_t i = 0; i < axisId_.size(); i++)
......
...@@ -472,6 +472,13 @@ void pptx_slide_context::set_media_param(std::wstring name, std::wstring value) ...@@ -472,6 +472,13 @@ void pptx_slide_context::set_media_param(std::wstring name, std::wstring value)
void pptx_slide_context::set_image(const std::wstring & path) void pptx_slide_context::set_image(const std::wstring & path)
{ {
int pos_replaicement = path.find(L"ObjectReplacements");
if (pos_replaicement >= 0)
{
if (path.length() - (pos_replaicement + 18) < 2)
return; //object without image
}
if (impl_->object_description_.type_ == typeUnknown) if (impl_->object_description_.type_ == typeUnknown)
{ {
impl_->object_description_.type_ = typeImage; impl_->object_description_.type_ = typeImage;
......
...@@ -299,6 +299,13 @@ void xlsx_drawing_context::set_ms_object(const std::wstring & path, const std::w ...@@ -299,6 +299,13 @@ void xlsx_drawing_context::set_ms_object(const std::wstring & path, const std::w
} }
void xlsx_drawing_context::set_image(const std::wstring & path) void xlsx_drawing_context::set_image(const std::wstring & path)
{ {
int pos_replaicement = path.find(L"ObjectReplacements");
if (pos_replaicement >= 0)
{
if (path.length() - (pos_replaicement + 18) < 2)
return; //object without image
}
if (impl_->object_description_.type_ == typeUnknown) if (impl_->object_description_.type_ == typeUnknown)
{ {
impl_->object_description_.type_ = typeImage; impl_->object_description_.type_ = typeImage;
......
...@@ -108,7 +108,6 @@ font_weight font_weight::parse(const std::wstring & Str) ...@@ -108,7 +108,6 @@ font_weight font_weight::parse(const std::wstring & Str)
return font_weight( W900 ); return font_weight( W900 );
else else
{ {
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return WNormal; return WNormal;
} }
} }
......
...@@ -84,7 +84,6 @@ vertical_align vertical_align::parse(const std::wstring & Str) ...@@ -84,7 +84,6 @@ vertical_align vertical_align::parse(const std::wstring & Str)
return vertical_align( Justify ); return vertical_align( Justify );
else else
{ {
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return vertical_align( Baseline ); return vertical_align( Baseline );
} }
} }
......
...@@ -1067,7 +1067,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context) ...@@ -1067,7 +1067,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
return; return;
std::wstring href = common_xlink_attlist_.href_.get_value_or(L""); std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
int pos_replaicement= href.find(L"ObjectReplacements"); int pos_replaicement = href.find(L"ObjectReplacements");
const draw_frame * frame = Context.get_drawing_context().get_current_frame();//owner const draw_frame * frame = Context.get_drawing_context().get_current_frame();//owner
if (!frame) if (!frame)
...@@ -1076,9 +1076,12 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context) ...@@ -1076,9 +1076,12 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
oox::_docx_drawing * drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get()); oox::_docx_drawing * drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get());
if (!drawing) return; if (!drawing) return;
if (pos_replaicement >= 0 && !Context.get_drawing_context().get_use_image_replace()) if (pos_replaicement >= 0)
{ {
return; //skip replacement image (math, chart, ...) - возможно записать как альтернативный контент - todooo ??? if (!Context.get_drawing_context().get_use_image_replace())
return; //skip replacement image (math, chart, ...) - возможно записать как альтернативный контент - todooo ???
if (href.length() - (pos_replaicement + 18) < 2)
return; //href="./ObjectReplacements/"
} }
if (drawing->type == oox::typeUnknown) if (drawing->type == oox::typeUnknown)
...@@ -1122,7 +1125,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context) ...@@ -1122,7 +1125,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
drawing->fill.bitmap = oox::oox_bitmap_fill::create(); drawing->fill.bitmap = oox::oox_bitmap_fill::create();
drawing->fill.type = 2; drawing->fill.type = 2;
drawing->fill.bitmap->isInternal = false; drawing->fill.bitmap->isInternal = false;
drawing->fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, drawing->fill.bitmap->isInternal,href); drawing->fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
drawing->fill.bitmap->bStretch = true; drawing->fill.bitmap->bStretch = true;
const std::wstring styleName = frame->common_draw_attlists_.shape_with_text_and_styles_. const std::wstring styleName = frame->common_draw_attlists_.shape_with_text_and_styles_.
...@@ -1388,12 +1391,24 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context) ...@@ -1388,12 +1391,24 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context)
Context.set_paragraph_state (false); Context.set_paragraph_state (false);
if (!Context.get_drawing_context().in_group() && !runState) if (!Context.get_drawing_context().in_group() && !runState)
Context.add_new_run(_T("")); {
if (!pState)//0115GS3-KeyboardShortcuts.odt
{
Context.start_paragraph();
}
Context.add_new_run(L"");
}
drawing->serialize(Context.output_stream()/*, Context.get_drawing_state_content()*/); drawing->serialize(Context.output_stream()/*, Context.get_drawing_state_content()*/);
if (!Context.get_drawing_context().in_group() && !runState) if (!Context.get_drawing_context().in_group() && !runState)
{
Context.finish_run(); Context.finish_run();
if (!pState)//0115GS3-KeyboardShortcuts.odt
{
Context.finish_paragraph();
}
}
Context.set_run_state (runState); Context.set_run_state (runState);
Context.set_paragraph_state (pState); Context.set_paragraph_state (pState);
...@@ -1406,9 +1421,9 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context) ...@@ -1406,9 +1421,9 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
{ {
try try
{ {
std::wstring href = common_xlink_attlist_.href_.get_value_or(L""); std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
if (!odf_document_) if (!odf_document_ && !href.empty())
{ {
std::wstring folderPath = Context.root()->get_folder(); std::wstring folderPath = Context.root()->get_folder();
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href; std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
......
...@@ -257,9 +257,9 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -257,9 +257,9 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
{ {
try try
{ {
std::wstring href = common_xlink_attlist_.href_.get_value_or(L""); std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
if (!odf_document_) if (!odf_document_ && !href.empty())
{ {
std::wstring folderPath = Context.root()->get_folder(); std::wstring folderPath = Context.root()->get_folder();
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href; std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
......
...@@ -265,7 +265,8 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -265,7 +265,8 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
try try
{ {
std::wstring href = common_xlink_attlist_.href_.get_value_or(L""); std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
if (!odf_document_)
if (!odf_document_ && !href.empty())
{ {
std::wstring folderPath = Context.root()->get_folder(); std::wstring folderPath = Context.root()->get_folder();
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href; std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
......
...@@ -86,10 +86,15 @@ void text::add_text(const std::wstring & Text) ...@@ -86,10 +86,15 @@ void text::add_text(const std::wstring & Text)
void text::docx_convert(oox::docx_conversion_context & Context) void text::docx_convert(oox::docx_conversion_context & Context)
{ {
if (Context.get_process_note() != oox::docx_conversion_context::noNote &&
Context.get_delete_text_state())
return; //в ms нет рецензирования notes
Context.add_element_to_run(); Context.add_element_to_run();
std::wostream & strm = Context.output_stream(); std::wostream & strm = Context.output_stream();
std::wstring textNode = L"w:t"; std::wstring textNode = L"w:t";
if (Context.get_delete_text_state()) textNode = L"w:delText"; if (Context.get_delete_text_state()) textNode = L"w:delText";
strm << L"<" << textNode; strm << L"<" << textNode;
......
...@@ -52,7 +52,7 @@ COfficePPTFile::~COfficePPTFile() ...@@ -52,7 +52,7 @@ COfficePPTFile::~COfficePPTFile()
CloseFile(); CloseFile();
} }
long COfficePPTFile::OpenFile(const std::wstring & sFileName, const std::wstring & password) long COfficePPTFile::OpenFile(const std::wstring & sFileName, const std::wstring & password, bool &bMacros)
{ {
CloseFile(); CloseFile();
...@@ -66,6 +66,7 @@ long COfficePPTFile::OpenFile(const std::wstring & sFileName, const std::wstring ...@@ -66,6 +66,7 @@ long COfficePPTFile::OpenFile(const std::wstring & sFileName, const std::wstring
pptReader->m_oDocumentInfo.m_strTmpDirectory = m_strTempDirectory; pptReader->m_oDocumentInfo.m_strTmpDirectory = m_strTempDirectory;
pptReader->m_oDocumentInfo.m_strPassword = password; pptReader->m_oDocumentInfo.m_strPassword = password;
pptReader->m_oDocumentInfo.m_bMacros = bMacros;
if (pptReader->IsPowerPoint() == false) if (pptReader->IsPowerPoint() == false)
{ {
...@@ -88,6 +89,7 @@ long COfficePPTFile::OpenFile(const std::wstring & sFileName, const std::wstring ...@@ -88,6 +89,7 @@ long COfficePPTFile::OpenFile(const std::wstring & sFileName, const std::wstring
//pptReader->ReadDocumentSummary(); //pptReader->ReadDocumentSummary();
pptReader->ReadDocument(); pptReader->ReadDocument();
bMacros = pptReader->m_oDocumentInfo.m_bMacros;
m_Status = READMODE; m_Status = READMODE;
return S_OK; return S_OK;
...@@ -101,14 +103,14 @@ bool COfficePPTFile::CloseFile() ...@@ -101,14 +103,14 @@ bool COfficePPTFile::CloseFile()
return S_OK; return S_OK;
} }
HRESULT COfficePPTFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath, std::wstring password) HRESULT COfficePPTFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath, std::wstring password, bool &bMacros)
{ {
if (m_strTempDirectory.empty()) if (m_strTempDirectory.empty())
{ {
m_strTempDirectory = NSDirectory::GetTempPath(); m_strTempDirectory = NSDirectory::GetTempPath();
} }
long nResult = OpenFile(sSrcFileName, password); long nResult = OpenFile(sSrcFileName, password, bMacros);
if (nResult != S_OK) if (nResult != S_OK)
{ {
CloseFile(); CloseFile();
......
...@@ -66,7 +66,7 @@ public: ...@@ -66,7 +66,7 @@ public:
return m_strTempDirectory; return m_strTempDirectory;
} }
HRESULT LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath, std::wstring password); HRESULT LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath, std::wstring password, bool &bMacros);
private: private:
...@@ -76,7 +76,7 @@ private: ...@@ -76,7 +76,7 @@ private:
std::wstring m_strTempDirectory; std::wstring m_strTempDirectory;
std::wstring m_sTempDecryptFileName; std::wstring m_sTempDecryptFileName;
long OpenFile(const std::wstring & fileName, const std::wstring & password); long OpenFile(const std::wstring & fileName, const std::wstring & password, bool &bMacros);
bool CloseFile(); bool CloseFile();
std::wstring GetDirectory(std::wstring strFileName); std::wstring GetDirectory(std::wstring strFileName);
......
...@@ -186,7 +186,7 @@ void NSPresentationEditor::CPPTXWriter::CloseFile() ...@@ -186,7 +186,7 @@ void NSPresentationEditor::CPPTXWriter::CloseFile()
void NSPresentationEditor::CPPTXWriter::WriteContentTypes() void NSPresentationEditor::CPPTXWriter::WriteContentTypes()
{ {
std::wstring strContentTypes = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\ std::wstring strContentTypes = L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\
<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">\ <Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">\
<Default Extension=\"bmp\" ContentType=\"image/bmp\" />\ <Default Extension=\"bmp\" ContentType=\"image/bmp\" />\
<Default Extension=\"png\" ContentType=\"image/png\" />\ <Default Extension=\"png\" ContentType=\"image/png\" />\
...@@ -208,14 +208,22 @@ void NSPresentationEditor::CPPTXWriter::WriteContentTypes() ...@@ -208,14 +208,22 @@ void NSPresentationEditor::CPPTXWriter::WriteContentTypes()
<Default Extension=\"xls\" ContentType=\"application/vnd.ms-excel\"/>\ <Default Extension=\"xls\" ContentType=\"application/vnd.ms-excel\"/>\
<Default Extension=\"xlsx\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"/>\ <Default Extension=\"xlsx\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"/>\
<Default Extension=\"bin\" ContentType=\"application/vnd.openxmlformats-officedocument.oleObject\" />\ <Default Extension=\"bin\" ContentType=\"application/vnd.openxmlformats-officedocument.oleObject\" />\
<Default Extension=\"jpg\" ContentType=\"application/octet-stream\"/>"); <Default Extension=\"jpg\" ContentType=\"application/octet-stream\"/>";
strContentTypes += _T("<Override PartName=\"/ppt/presentation.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml\" />\ if (m_pDocument->m_bMacros)
<Override PartName=\"/ppt/presProps.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.presentationml.presProps+xml\" />\ {
strContentTypes += L"<Override PartName=\"/ppt/presentation.xml\" ContentType=\"application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml\" />\
<Override PartName=\"/ppt/vbaProject.bin\" ContentType=\"application/vnd.ms-office.vbaProject\" />";
}
else
{
strContentTypes += L"<Override PartName=\"/ppt/presentation.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml\" />";
}
strContentTypes += L"<Override PartName=\"/ppt/presProps.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.presentationml.presProps+xml\" />\
<Override PartName=\"/ppt/viewProps.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml\" />\ <Override PartName=\"/ppt/viewProps.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml\" />\
<Override PartName=\"/ppt/tableStyles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml\"/>\ <Override PartName=\"/ppt/tableStyles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml\"/>\
<Override PartName=\"/docProps/core.xml\" ContentType=\"application/vnd.openxmlformats-package.core-properties+xml\" />\ <Override PartName=\"/docProps/core.xml\" ContentType=\"application/vnd.openxmlformats-package.core-properties+xml\" />\
<Override PartName=\"/docProps/app.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.extended-properties+xml\" />"); <Override PartName=\"/docProps/app.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.extended-properties+xml\" />";
int nIndexLayout = 1, nIndexTheme = 1; int nIndexLayout = 1, nIndexTheme = 1;
...@@ -411,6 +419,15 @@ void NSPresentationEditor::CPPTXWriter::WritePresInfo() ...@@ -411,6 +419,15 @@ void NSPresentationEditor::CPPTXWriter::WritePresInfo()
strPresRels += L"<Relationship Id=\"rId" + std::to_wstring(nCurrentRels++) + L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles\" Target=\"tableStyles.xml\"/>"; strPresRels += L"<Relationship Id=\"rId" + std::to_wstring(nCurrentRels++) + L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles\" Target=\"tableStyles.xml\"/>";
strPresRels += L"<Relationship Id=\"rId" + std::to_wstring(nCurrentRels++) + L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps\" Target=\"viewProps.xml\"/>"; strPresRels += L"<Relationship Id=\"rId" + std::to_wstring(nCurrentRels++) + L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps\" Target=\"viewProps.xml\"/>";
if (m_pDocument->m_bMacros)
{
std::wstring strVbaProject = m_strTempDirectory + FILE_SEPARATOR_STR + _T("ppt") + FILE_SEPARATOR_STR + _T("vbaProject.bin");
if (CDirectory::CopyFile(m_pDocument->m_sVbaProjectFile, strVbaProject))
{
strPresRels += L"<Relationship Id=\"rId" + std::to_wstring(nCurrentRels++) + L"\" Type=\"http://schemas.microsoft.com/office/2006/relationships/vbaProject\" Target=\"vbaProject.bin\"/>";
}
}
strPresRels = L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?><Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">" strPresRels = L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?><Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">"
+ strPresRels + L"</Relationships>"; + strPresRels + L"</Relationships>";
......
...@@ -41,8 +41,9 @@ public: ...@@ -41,8 +41,9 @@ public:
std::wstring m_strTmpDirectory; std::wstring m_strTmpDirectory;
std::map<int, std::wstring> m_mapStoreImageFile; std::map<int, std::wstring> m_mapStoreImageFile;
std::wstring m_strPassword; std::wstring m_strPassword;
bool m_bMacros;
CPPTDocumentInfo() : m_oCurrentUser(), m_arUsers() CPPTDocumentInfo() : m_oCurrentUser(), m_bMacros(true)
{ {
} }
...@@ -88,6 +89,7 @@ public: ...@@ -88,6 +89,7 @@ public:
pInfo->m_strTmpDirectory = m_strTmpDirectory; pInfo->m_strTmpDirectory = m_strTmpDirectory;
pInfo->m_bEncrypt = m_oCurrentUser.m_bIsEncrypt; pInfo->m_bEncrypt = m_oCurrentUser.m_bIsEncrypt;
pInfo->m_strPassword = m_strPassword; pInfo->m_strPassword = m_strPassword;
pInfo->m_bMacros = m_bMacros;
bool bResult = pInfo->ReadFromStream(&oUserAtom, pStream); bool bResult = pInfo->ReadFromStream(&oUserAtom, pStream);
......
...@@ -52,6 +52,7 @@ CPPTUserInfo::CPPTUserInfo() : CDocument(), ...@@ -52,6 +52,7 @@ CPPTUserInfo::CPPTUserInfo() : CDocument(),
m_pDecryptor(NULL), m_pDecryptor(NULL),
m_arOffsetPictures() m_arOffsetPictures()
{ {
m_VbaProjectStg = NULL;
m_pDocumentInfo = NULL; m_pDocumentInfo = NULL;
m_lIndexThisUser = -1; m_lIndexThisUser = -1;
...@@ -83,6 +84,7 @@ void CPPTUserInfo::Clear() ...@@ -83,6 +84,7 @@ void CPPTUserInfo::Clear()
RELEASEOBJECT(m_pDecryptor); RELEASEOBJECT(m_pDecryptor);
RELEASEOBJECT(m_pStorageDecrypt); RELEASEOBJECT(m_pStorageDecrypt);
RELEASEOBJECT(m_VbaProjectStg);
for (std::map<DWORD, CRecordSlide*>::iterator pPair = m_mapSlides.begin(); pPair != m_mapSlides.end(); ++pPair) for (std::map<DWORD, CRecordSlide*>::iterator pPair = m_mapSlides.begin(); pPair != m_mapSlides.end(); ++pPair)
{ {
...@@ -390,6 +392,47 @@ bool CPPTUserInfo::ReadDocumentPersists(POLE::Stream* pStream) ...@@ -390,6 +392,47 @@ bool CPPTUserInfo::ReadDocumentPersists(POLE::Stream* pStream)
m_mapHandoutMasters.insert( std::pair<DWORD, CRecordSlide*>(0, pSlide )); m_mapHandoutMasters.insert( std::pair<DWORD, CRecordSlide*>(0, pSlide ));
} }
} }
if (m_bMacros)
{
m_bMacros = false;
std::vector<CRecordVBAInfoAtom*> oArrayVba;
m_oDocument.GetRecordsByType(&oArrayVba, true, true);
if (!oArrayVba.empty())
{
if (oArrayVba[0]->m_nHasMacros)
{
nIndexPsrRef = m_mapOffsetInPIDs.find(oArrayVba[0]->m_nObjStgDataRef);
if (m_mapOffsetInPIDs.end() != nIndexPsrRef)
{
offset_stream = nIndexPsrRef->second;
StreamUtils::StreamSeek(offset_stream, pStream);
POLE::Stream *pStreamTmp = pStream;
if (m_pDecryptor)
{
DecryptStream(pStream, oArrayVba[0]->m_nObjStgDataRef);
pStreamTmp = m_arStreamDecrypt.back()->stream_;
}
oHeader.ReadFromStream(pStreamTmp);
m_VbaProjectStg = new CRecordVbaProjectStg(m_strTmpDirectory);
m_VbaProjectStg->ReadFromStream(oHeader, pStreamTmp);
if (m_VbaProjectStg->m_sFileName.empty())
{
RELEASEOBJECT(m_VbaProjectStg);
}
else
{
m_sVbaProjectFile = m_VbaProjectStg->m_sFileName;
m_bMacros = true;
}
}
}
}
}
return true; return true;
} }
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------
......
...@@ -95,6 +95,7 @@ public: ...@@ -95,6 +95,7 @@ public:
// чтобы загружать неизмененные элементы от других юзеров (предыдущих) // чтобы загружать неизмененные элементы от других юзеров (предыдущих)
CPPTDocumentInfo* m_pDocumentInfo; CPPTDocumentInfo* m_pDocumentInfo;
CRecordVbaProjectStg* m_VbaProjectStg;
int m_lIndexThisUser; int m_lIndexThisUser;
// Animations structures // Animations structures
......
...@@ -181,7 +181,7 @@ IRecord* CreateByType(SRecordHeader oHeader) ...@@ -181,7 +181,7 @@ IRecord* CreateByType(SRecordHeader oHeader)
//CREATE_BY_TYPE(RECORD_TYPE_VIEWINFO_ATOM , CRecordNoZoomViewInfoAtom) //CREATE_BY_TYPE(RECORD_TYPE_VIEWINFO_ATOM , CRecordNoZoomViewInfoAtom)
CREATE_BY_TYPE(RECORD_TYPE_VIEWINFO_ATOM , CRecordViewInfoAtom) CREATE_BY_TYPE(RECORD_TYPE_VIEWINFO_ATOM , CRecordViewInfoAtom)
CREATE_BY_TYPE(RECORD_TYPE_SLIDE_VIEWINFO_ATOM , CRecordSlideViewInfoAtom) CREATE_BY_TYPE(RECORD_TYPE_SLIDE_VIEWINFO_ATOM , CRecordSlideViewInfoAtom)
//CREATE_BY_TYPE(RECORD_TYPE_VBAINFO_ATOM , CRecordVBAInfoAtom) CREATE_BY_TYPE(RECORD_TYPE_VBAINFO_ATOM , CRecordVBAInfoAtom)
//CREATE_BY_TYPE(RECORD_TYPE_SSDOCINFO_ATOM , CRecordSSDocInfoAtom) //CREATE_BY_TYPE(RECORD_TYPE_SSDOCINFO_ATOM , CRecordSSDocInfoAtom)
//CREATE_BY_TYPE(RECORD_TYPE_DOC_ROUTING_SLIP , CRecordDocRoutingSlipAtom) //CREATE_BY_TYPE(RECORD_TYPE_DOC_ROUTING_SLIP , CRecordDocRoutingSlipAtom)
CREATE_BY_TYPE(RECORD_TYPE_EXOBJLIST_ATOM , CRecordExObjListAtom) CREATE_BY_TYPE(RECORD_TYPE_EXOBJLIST_ATOM , CRecordExObjListAtom)
...@@ -263,11 +263,10 @@ IRecord* CreateByType(SRecordHeader oHeader) ...@@ -263,11 +263,10 @@ IRecord* CreateByType(SRecordHeader oHeader)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordRecolorInfoAtom) //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordRecolorInfoAtom)
//CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordAnimationInfoAtom) //CREATE_BY_TYPE(RECORD_TYPE_UNKNOWN , CRecordAnimationInfoAtom)
CREATE_BY_TYPE(RECORD_TYPE_EX_VIDEOCONTAINER , CRecordExVideoContainer) CREATE_BY_TYPE(RECORD_TYPE_EX_VIDEOCONTAINER , CRecordExVideoContainer)
CREATE_BY_TYPE(RECORD_TYPE_EX_OBJREF_ATOM , CRecordExObjRefAtom) CREATE_BY_TYPE(RECORD_TYPE_EX_OBJREF_ATOM , CRecordExObjRefAtom)
CREATE_BY_TYPE(RECORD_TYPE_EX_MEDIA_ATOM , CRecordExMediaAtom) CREATE_BY_TYPE(RECORD_TYPE_EX_MEDIA_ATOM , CRecordExMediaAtom)
//CREATE_BY_TYPE(RECORD_TYPE_EXCONTROL_ATOM , CRecordExControlAtom) CREATE_BY_TYPE(RECORD_TYPE_EXCONTROL_ATOM , CRecordExControlAtom)
CREATE_BY_TYPE(RECORD_TYPE_ESCHER_BSTORE_CONTAINER , CRecordBlipStoreContainer) CREATE_BY_TYPE(RECORD_TYPE_ESCHER_BSTORE_CONTAINER , CRecordBlipStoreContainer)
CREATE_BY_TYPE(RECORD_TYPE_ESCHER_BSE , CRecordBlipStoreEntry) CREATE_BY_TYPE(RECORD_TYPE_ESCHER_BSE , CRecordBlipStoreEntry)
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
class CRecordExControlAtom : public CUnknownRecord class CRecordExControlAtom : public CUnknownRecord
{ {
UINT m_nSlideID; UINT m_nSlideIdRef;
public: public:
...@@ -49,6 +49,7 @@ public: ...@@ -49,6 +49,7 @@ public:
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{ {
m_oHeader = oHeader; m_oHeader = oHeader;
m_nSlideID = StreamUtils::ReadDWORD(pStream);
m_nSlideIdRef = StreamUtils::ReadDWORD(pStream);
} }
}; };
\ No newline at end of file
...@@ -52,6 +52,78 @@ public: ...@@ -52,6 +52,78 @@ public:
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{ {
return CUnknownRecord::ReadFromStream(oHeader, pStream); m_oHeader = oHeader;
m_nDrawAspect = StreamUtils::ReadDWORD(pStream);
m_nType = StreamUtils::ReadDWORD(pStream);
m_nExObjID = StreamUtils::ReadDWORD(pStream);
m_nSubType = StreamUtils::ReadDWORD(pStream);
m_nPersistID = StreamUtils::ReadDWORD(pStream);
StreamUtils::StreamSkip ( 4, pStream ); //unused
}
};
class CRecordExOleObjStg : public CUnknownRecord
{
public:
std::wstring m_sFileName;
std::wstring m_strTmpDirectory;
CRecordExOleObjStg(std::wstring strTemp) : m_strTmpDirectory(strTemp)
{
}
~CRecordExOleObjStg()
{
} }
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
m_oHeader = oHeader;
ULONG decompressedSize = m_oHeader.RecLen, compressedSize = m_oHeader.RecLen;
BYTE* pData = new BYTE[m_oHeader.RecLen];
if (!pData) return;
if (m_oHeader.RecInstance == 0x01)
{
decompressedSize = StreamUtils::ReadDWORD(pStream);
compressedSize = m_oHeader.RecLen - 4;
}
pStream->read(pData, compressedSize);
if (m_oHeader.RecInstance == 0x01)
{
BYTE* pDataUncompress = new BYTE[decompressedSize + 64];
if (NSZLib::Decompress(pData, compressedSize, pDataUncompress, decompressedSize))
{
RELEASEOBJECT(pData);
pData = pDataUncompress;
}
else
{
RELEASEOBJECT(pData);
}
}
//if (pDecryptor)
//{
// pDecryptor->Decrypt((char*)pData, oHeader.RecLen - lOffset, 0);
//}
if (pData)
{
m_sFileName = m_strTmpDirectory + FILE_SEPARATOR_STR + L"oleObject_xxx.bin";
NSFile::CFileBinary file;
if (file.CreateFile(m_sFileName))
{
file.WriteFile(pData, decompressedSize);
file.CloseFile();
}
delete[] pData;
pData = NULL;
}
}
}; };
\ No newline at end of file
...@@ -34,11 +34,11 @@ ...@@ -34,11 +34,11 @@
class CRecordVBAInfoAtom : public CUnknownRecord class CRecordVBAInfoAtom : public CUnknownRecord
{ {
public:
UINT m_nObjStgDataRef; UINT m_nObjStgDataRef;
UINT m_nHasMacros; UINT m_nHasMacros;
UINT m_nVersion; UINT m_nVersion;
public:
CRecordVBAInfoAtom() CRecordVBAInfoAtom()
{ {
...@@ -50,7 +50,69 @@ public: ...@@ -50,7 +50,69 @@ public:
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream) virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{ {
return CUnknownRecord::ReadFromStream(oHeader, pStream); m_oHeader = oHeader;
m_nObjStgDataRef = StreamUtils::ReadDWORD(pStream);
m_nHasMacros = StreamUtils::ReadDWORD(pStream);
m_nVersion = StreamUtils::ReadDWORD(pStream);
}
};
class CRecordVbaProjectStg : public CUnknownRecord
{
public:
std::wstring m_sFileName;
std::wstring m_strTmpDirectory;
CRecordVbaProjectStg(std::wstring strTemp) : m_strTmpDirectory(strTemp)
{
}
~CRecordVbaProjectStg()
{
}
virtual void ReadFromStream(SRecordHeader & oHeader, POLE::Stream* pStream)
{
m_oHeader = oHeader;
ULONG decompressedSize = m_oHeader.RecLen, compressedSize = m_oHeader.RecLen;
BYTE* pData = new BYTE[compressedSize];
if (!pData) return;
if (m_oHeader.RecInstance == 0x01)
{
decompressedSize = StreamUtils::ReadDWORD(pStream) + 64;
compressedSize -= 4;
}
pStream->read(pData, compressedSize);
//if (pDecryptor)
//{
// pDecryptor->Decrypt((char*)pData, compressedSize, 0);
//}
if (m_oHeader.RecInstance == 0x01)
{
BYTE* pDataUncompress = new BYTE[decompressedSize];
NSZLib::Decompress(pData, compressedSize, pDataUncompress, decompressedSize);
RELEASEOBJECT(pData);
pData = pDataUncompress;
}
m_sFileName = m_strTmpDirectory + FILE_SEPARATOR_STR + L"vbaProject.bin";
NSFile::CFileBinary file;
if (file.CreateFile(m_sFileName))
{
file.WriteFile(pData, decompressedSize);
file.CloseFile();
}
delete[] pData;
pData = NULL;
} }
}; };
\ No newline at end of file
...@@ -49,9 +49,9 @@ int _tmain(int argc, _TCHAR* argv[]) ...@@ -49,9 +49,9 @@ int _tmain(int argc, _TCHAR* argv[])
if (argc < 2) return 1; if (argc < 2) return 1;
std::wstring sSrcPpt = argv[1]; std::wstring sSrcPpt = argv[1];
std::wstring sDstPptx = argc > 2 ? argv[2] : sSrcPpt + L"-my.pptx"; std::wstring sDstPptx;
std::wstring outputDir = NSDirectory::GetFolderPath(sDstPptx); std::wstring outputDir = NSDirectory::GetFolderPath(sSrcPpt);
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir); std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
std::wstring tempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir); std::wstring tempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
...@@ -60,8 +60,19 @@ int _tmain(int argc, _TCHAR* argv[]) ...@@ -60,8 +60,19 @@ int _tmain(int argc, _TCHAR* argv[])
pptFile.put_TempDirectory(tempPath); pptFile.put_TempDirectory(tempPath);
HRESULT hRes = pptFile.LoadFromFile(sSrcPpt, dstTempPath, L"password"); bool bMacros = true;
HRESULT hRes = pptFile.LoadFromFile(sSrcPpt, dstTempPath, L"password", bMacros);
if (bMacros)
{
sDstPptx = sSrcPpt + L"-my.pptm";
}
else
{
sDstPptx = sSrcPpt + L"-my.pptx";
}
if (hRes == S_OK) if (hRes == S_OK)
{ {
COfficeUtils oCOfficeUtils(NULL); COfficeUtils oCOfficeUtils(NULL);
......
...@@ -48,7 +48,10 @@ namespace NSPresentationEditor ...@@ -48,7 +48,10 @@ namespace NSPresentationEditor
CMetricInfo m_oInfo; CMetricInfo m_oInfo;
CDocument() : m_arThemes(), m_arSlides() bool m_bMacros;
std::wstring m_sVbaProjectFile;
CDocument() : m_bMacros (false)
{ {
m_pHandoutMaster = NULL; m_pHandoutMaster = NULL;
m_pNotesMaster = NULL; m_pNotesMaster = NULL;
......
...@@ -134,12 +134,26 @@ void CompoundFile::copy_stream(std::string streamName, POLE::Storage * storageOu ...@@ -134,12 +134,26 @@ void CompoundFile::copy_stream(std::string streamName, POLE::Storage * storageOu
void CompoundFile::copy( int indent, std::string path, POLE::Storage * storageOut, bool withRoot) void CompoundFile::copy( int indent, std::string path, POLE::Storage * storageOut, bool withRoot)
{ {
std::list<std::string> entries; std::list<std::string> entries, entries_sort;
entries = storage_->entries( path ); entries = storage_->entries( path );
std::list<std::string>::iterator it; for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
for( it = entries.begin(); it != entries.end(); ++it ) {
{ std::string name = *it;
std::string fullname = path + name;
if( storage_->isDirectory( fullname ) )
{
entries_sort.push_back(name);
}
else
{
entries_sort.push_front(name);
}
}
//for( std::list<std::string>::iterator it = entries.begin(); it != entries.end(); it++ )
for( std::list<std::string>::iterator it = entries_sort.begin(); it != entries_sort.end(); it++ )
{
std::string name = *it; std::string name = *it;
std::string fullname = path + name; std::string fullname = path + name;
...@@ -151,7 +165,7 @@ void CompoundFile::copy( int indent, std::string path, POLE::Storage * storageOu ...@@ -151,7 +165,7 @@ void CompoundFile::copy( int indent, std::string path, POLE::Storage * storageOu
{ {
copy_stream(fullname, storageOut, withRoot); copy_stream(fullname, storageOut, withRoot);
} }
} }
} }
CFStreamPtr CompoundFile::getWorkbookStream() CFStreamPtr CompoundFile::getWorkbookStream()
{ {
......
...@@ -206,6 +206,8 @@ void OfficeArtContainer::loadFields(XLS::CFRecord& record) ...@@ -206,6 +206,8 @@ void OfficeArtContainer::loadFields(XLS::CFRecord& record)
} }
else // If the found record is not implemented or unknown else // If the found record is not implemented or unknown
{ {
if (rh_child.recType == 0xf150)
break;
if (rh_child.size() > record.getDataSize() - container_beginning_ptr) if (rh_child.size() > record.getDataSize() - container_beginning_ptr)
break; break;
try try
......
...@@ -1675,7 +1675,7 @@ namespace NExtractTools ...@@ -1675,7 +1675,7 @@ namespace NExtractTools
} }
// ppt -> pptx // ppt -> pptx
int ppt2pptx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params) int ppt2pptx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{ {
std::wstring sResultPptxDir = sTemp + FILE_SEPARATOR_STR + _T("pptx_unpacked"); std::wstring sResultPptxDir = sTemp + FILE_SEPARATOR_STR + _T("pptx_unpacked");
NSDirectory::CreateDirectory(sResultPptxDir); NSDirectory::CreateDirectory(sResultPptxDir);
...@@ -1701,14 +1701,15 @@ namespace NExtractTools ...@@ -1701,14 +1701,15 @@ namespace NExtractTools
return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD; return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
} }
return AVS_FILEUTILS_ERROR_CONVERT; return AVS_FILEUTILS_ERROR_CONVERT;
} }
int ppt2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params) int ppt2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{ {
COfficePPTFile pptFile; COfficePPTFile pptFile;
pptFile.put_TempDirectory(sTemp); pptFile.put_TempDirectory(sTemp);
long hRes = pptFile.LoadFromFile(sFrom, sTo, params.getPassword()); bool bMacros = false;
long hRes = pptFile.LoadFromFile(sFrom, sTo, params.getPassword(), bMacros);
if (AVS_ERROR_DRM == hRes) if (AVS_ERROR_DRM == hRes)
{ {
...@@ -1723,10 +1724,62 @@ namespace NExtractTools ...@@ -1723,10 +1724,62 @@ namespace NExtractTools
return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD; return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
} }
return 0 == hRes ? 0 : AVS_FILEUTILS_ERROR_CONVERT; return 0 == hRes ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
} }
// ppt -> pptm
int ppt2pptm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{
std::wstring sResultPptxDir = sTemp + FILE_SEPARATOR_STR + _T("pptx_unpacked");
NSDirectory::CreateDirectory(sResultPptxDir);
int hRes = ppt2pptm_dir(sFrom, sResultPptxDir, sTemp, params);
if(SUCCEEDED_X2T(hRes))
{
COfficeUtils oCOfficeUtils(NULL);
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(sResultPptxDir, sTo, true))
return 0;
}
else if (AVS_ERROR_DRM == hRes)
{
if(!params.getDontSaveAdditional())
{
copyOrigin(sFrom, *params.m_sFileTo);
}
return AVS_FILEUTILS_ERROR_CONVERT_DRM;
}
else if (AVS_ERROR_PASSWORD == hRes)
{
return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
int ppt2pptm_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{
COfficePPTFile pptFile;
pptFile.put_TempDirectory(sTemp);
bool bMacros = true;
long hRes = pptFile.LoadFromFile(sFrom, sTo, params.getPassword(), bMacros);
if (AVS_ERROR_DRM == hRes)
{
if(!params.getDontSaveAdditional())
{
copyOrigin(sFrom, *params.m_sFileTo);
}
return AVS_FILEUTILS_ERROR_CONVERT_DRM;
}
else if (AVS_ERROR_PASSWORD == hRes)
{
return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
}
return 0 == hRes ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
}
// ppt -> pptt // ppt -> pptt
int ppt2pptt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params) int ppt2pptt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{ {
std::wstring sResultPpttDir = sTemp + FILE_SEPARATOR_STR + _T("pptt_unpacked"); std::wstring sResultPpttDir = sTemp + FILE_SEPARATOR_STR + _T("pptt_unpacked");
std::wstring sTempPpttFileEditor = sResultPpttDir + FILE_SEPARATOR_STR + _T("Editor.bin"); std::wstring sTempPpttFileEditor = sResultPpttDir + FILE_SEPARATOR_STR + _T("Editor.bin");
...@@ -1743,7 +1796,7 @@ namespace NExtractTools ...@@ -1743,7 +1796,7 @@ namespace NExtractTools
} }
// ppt -> pptt_bin // ppt -> pptt_bin
int ppt2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params) int ppt2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{ {
// unzip pptx to temp folder // unzip pptx to temp folder
std::wstring sTempUnpackedPPTX = sTemp + FILE_SEPARATOR_STR + _T("pptx_unpacked")+ FILE_SEPARATOR_STR; // leading slash is very important! std::wstring sTempUnpackedPPTX = sTemp + FILE_SEPARATOR_STR + _T("pptx_unpacked")+ FILE_SEPARATOR_STR; // leading slash is very important!
...@@ -1753,7 +1806,8 @@ namespace NExtractTools ...@@ -1753,7 +1806,8 @@ namespace NExtractTools
pptFile.put_TempDirectory(sTemp); pptFile.put_TempDirectory(sTemp);
long nRes = pptFile.LoadFromFile(sFrom, sTempUnpackedPPTX, params.getPassword()); bool bMacros = true;
long nRes = pptFile.LoadFromFile(sFrom, sTempUnpackedPPTX, params.getPassword(), bMacros);
if (SUCCEEDED_X2T(nRes)) if (SUCCEEDED_X2T(nRes))
{ {
...@@ -1914,7 +1968,7 @@ namespace NExtractTools ...@@ -1914,7 +1968,7 @@ namespace NExtractTools
// doc -> docx // doc -> docx
int doc2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params) int doc2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{ {
std::wstring sResultDocxDir = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked"); std::wstring sResultDocxDir = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked");
NSDirectory::CreateDirectory(sResultDocxDir); NSDirectory::CreateDirectory(sResultDocxDir);
...@@ -1939,12 +1993,66 @@ namespace NExtractTools ...@@ -1939,12 +1993,66 @@ namespace NExtractTools
return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD; return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
} }
return AVS_FILEUTILS_ERROR_CONVERT; return AVS_FILEUTILS_ERROR_CONVERT;
} }
int doc2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params) int doc2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{
COfficeDocFile docFile;
docFile.m_sTempFolder = sTemp;
bool bMacros = false;
long hRes = docFile.LoadFromFile( sFrom, sTo, params.getPassword(), bMacros, NULL);
if (AVS_ERROR_DRM == hRes)
{
if(!params.getDontSaveAdditional())
{
copyOrigin(sFrom, *params.m_sFileTo);
}
return AVS_FILEUTILS_ERROR_CONVERT_DRM;
}
else if (AVS_ERROR_PASSWORD == hRes)
{
return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
}
return 0 == hRes ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
}
// doc -> docm
int doc2docm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{ {
std::wstring sResultDocxDir = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked");
NSDirectory::CreateDirectory(sResultDocxDir);
long hRes = doc2docm_dir(sFrom, sResultDocxDir, sTemp, params);
if(SUCCEEDED_X2T(hRes))
{
COfficeUtils oCOfficeUtils(NULL);
if(S_OK == oCOfficeUtils.CompressFileOrDirectory(sResultDocxDir, sTo, true))
return 0;
}
else if (AVS_ERROR_DRM == hRes)
{
if(!params.getDontSaveAdditional())
{
copyOrigin(sFrom, *params.m_sFileTo);
}
return AVS_FILEUTILS_ERROR_CONVERT_DRM;
}
else if (AVS_ERROR_PASSWORD == hRes)
{
return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
}
return AVS_FILEUTILS_ERROR_CONVERT;
}
int doc2docm_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{
COfficeDocFile docFile; COfficeDocFile docFile;
docFile.m_sTempFolder = sTemp; docFile.m_sTempFolder = sTemp;
long hRes = docFile.LoadFromFile( sFrom, sTo, params.getPassword(), NULL);
bool bMacros = true;
long hRes = docFile.LoadFromFile( sFrom, sTo, params.getPassword(), bMacros, NULL);
if (AVS_ERROR_DRM == hRes) if (AVS_ERROR_DRM == hRes)
{ {
if(!params.getDontSaveAdditional()) if(!params.getDontSaveAdditional())
...@@ -1962,7 +2070,7 @@ namespace NExtractTools ...@@ -1962,7 +2070,7 @@ namespace NExtractTools
// doc -> doct // doc -> doct
int doc2doct (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params) int doc2doct (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{ {
// Extract docx to temp directory // Extract docx to temp directory
std::wstring sResultDoctDir = sTemp + FILE_SEPARATOR_STR + _T("doct_unpacked"); std::wstring sResultDoctDir = sTemp + FILE_SEPARATOR_STR + _T("doct_unpacked");
std::wstring sResultDoctFileEditor = sResultDoctDir + FILE_SEPARATOR_STR + _T("Editor.bin"); std::wstring sResultDoctFileEditor = sResultDoctDir + FILE_SEPARATOR_STR + _T("Editor.bin");
...@@ -1978,11 +2086,11 @@ namespace NExtractTools ...@@ -1978,11 +2086,11 @@ namespace NExtractTools
} }
return nRes; return nRes;
} }
// doc -> doct_bin // doc -> doct_bin
int doc2doct_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params) int doc2doct_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{ {
std::wstring sResultDocxDir = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked"); std::wstring sResultDocxDir = sTemp + FILE_SEPARATOR_STR + _T("docx_unpacked");
NSDirectory::CreateDirectory(sResultDocxDir); NSDirectory::CreateDirectory(sResultDocxDir);
...@@ -1990,7 +2098,9 @@ namespace NExtractTools ...@@ -1990,7 +2098,9 @@ namespace NExtractTools
COfficeDocFile docFile; COfficeDocFile docFile;
docFile.m_sTempFolder = sTemp; docFile.m_sTempFolder = sTemp;
long nRes = docFile.LoadFromFile( sFrom, sResultDocxDir, params.getPassword(), NULL); bool bMacros = true;
long nRes = docFile.LoadFromFile( sFrom, sResultDocxDir, params.getPassword(), bMacros, NULL);
if (SUCCEEDED_X2T(nRes)) if (SUCCEEDED_X2T(nRes))
{ {
...@@ -2017,17 +2127,17 @@ namespace NExtractTools ...@@ -2017,17 +2127,17 @@ namespace NExtractTools
return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD; return AVS_FILEUTILS_ERROR_CONVERT_PASSWORD;
} }
return AVS_FILEUTILS_ERROR_CONVERT; return AVS_FILEUTILS_ERROR_CONVERT;
} }
int docx_dir2doc (const std::wstring &sDocxDir, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params) int docx_dir2doc (const std::wstring &sDocxDir, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
{ {
return AVS_FILEUTILS_ERROR_CONVERT; return AVS_FILEUTILS_ERROR_CONVERT;
COfficeDocFile docFile; COfficeDocFile docFile;
return /*S_OK == docFile.SaveToFile(sTo, sDocxDir, NULL) ? 0 : */AVS_FILEUTILS_ERROR_CONVERT; return /*S_OK == docFile.SaveToFile(sTo, sDocxDir, NULL) ? 0 : */AVS_FILEUTILS_ERROR_CONVERT;
} }
// doct -> rtf // doct -> rtf
int doct2rtf (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bFromChanges, const std::wstring &sThemeDir, InputParams& params) int doct2rtf (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, bool bFromChanges, const std::wstring &sThemeDir, InputParams& params)
{ {
// Extract docx to temp directory // Extract docx to temp directory
std::wstring sTempUnpackedDOCT = sTemp + FILE_SEPARATOR_STR + _T("doct_unpacked"); std::wstring sTempUnpackedDOCT = sTemp + FILE_SEPARATOR_STR + _T("doct_unpacked");
std::wstring sTempDoctFileEditor = sTempUnpackedDOCT + FILE_SEPARATOR_STR + _T("Editor.bin"); std::wstring sTempDoctFileEditor = sTempUnpackedDOCT + FILE_SEPARATOR_STR + _T("Editor.bin");
...@@ -3914,6 +4024,10 @@ namespace NExtractTools ...@@ -3914,6 +4024,10 @@ namespace NExtractTools
case TCD_PPT2PPTX: case TCD_PPT2PPTX:
{ {
result = ppt2pptx (sFileFrom, sFileTo, sTempDir, oInputParams); result = ppt2pptx (sFileFrom, sFileTo, sTempDir, oInputParams);
}break;
case TCD_PPT2PPTM:
{
result = ppt2pptm (sFileFrom, sFileTo, sTempDir, oInputParams);
}break; }break;
case TCD_PPT2PPTT: case TCD_PPT2PPTT:
{ {
...@@ -3943,6 +4057,10 @@ namespace NExtractTools ...@@ -3943,6 +4057,10 @@ namespace NExtractTools
{ {
result = doc2docx (sFileFrom, sFileTo, sTempDir, oInputParams); result = doc2docx (sFileFrom, sFileTo, sTempDir, oInputParams);
}break; }break;
case TCD_DOC2DOCM:
{
result = doc2docm (sFileFrom, sFileTo, sTempDir, oInputParams);
}break;
case TCD_DOCT2RTF: case TCD_DOCT2RTF:
{ {
result = doct2rtf (sFileFrom, sFileTo, sTempDir, bFromChanges, sThemeDir, oInputParams); result = doct2rtf (sFileFrom, sFileTo, sTempDir, bFromChanges, sThemeDir, oInputParams);
......
...@@ -115,6 +115,8 @@ namespace NExtractTools ...@@ -115,6 +115,8 @@ namespace NExtractTools
int ppt2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int ppt2pptx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int ppt2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int ppt2pptt_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int ppt2pptt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int ppt2pptt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int ppt2pptm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int ppt2pptm_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int rtf2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int rtf2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int rtf2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int rtf2docx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
...@@ -130,6 +132,8 @@ namespace NExtractTools ...@@ -130,6 +132,8 @@ namespace NExtractTools
int doc2doct (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int doc2doct (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int doc2doct_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int doc2doct_bin (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int docx_dir2doc (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int docx_dir2doc (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int doc2docm (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int doc2docm_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xls2xlsx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int xls2xlsx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
int xls2xlsx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params); int xls2xlsx_dir (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params);
......
...@@ -240,7 +240,7 @@ namespace NExtractTools ...@@ -240,7 +240,7 @@ namespace NExtractTools
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC: case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC:
{ {
if (0 == sExt2.compare(_T(".docx"))) res = TCD_DOC2DOCX; if (0 == sExt2.compare(_T(".docx"))) res = TCD_DOC2DOCX;
else if (0 == sExt2.compare(_T(".docm"))) res = TCD_DOC2DOCX; else if (0 == sExt2.compare(_T(".docm"))) res = TCD_DOC2DOCM;
else if (0 == sExt2.compare(_T(".doct"))) res = TCD_DOC2DOCT; else if (0 == sExt2.compare(_T(".doct"))) res = TCD_DOC2DOCT;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_DOC2DOCT_BIN; else if (0 == sExt2.compare(_T(".bin"))) res = TCD_DOC2DOCT_BIN;
}break; }break;
...@@ -261,7 +261,7 @@ namespace NExtractTools ...@@ -261,7 +261,7 @@ namespace NExtractTools
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT: case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT:
{ {
if (0 == sExt2.compare(_T(".pptx"))) res = TCD_PPT2PPTX; if (0 == sExt2.compare(_T(".pptx"))) res = TCD_PPT2PPTX;
else if (0 == sExt2.compare(_T(".pptm"))) res = TCD_PPT2PPTX; else if (0 == sExt2.compare(_T(".pptm"))) res = TCD_PPT2PPTM;
else if (0 == sExt2.compare(_T(".bin"))) res = TCD_PPT2PPTT_BIN; else if (0 == sExt2.compare(_T(".bin"))) res = TCD_PPT2PPTT_BIN;
else if (0 == sExt2.compare(_T(".pptt"))) res = TCD_PPT2PPTT; else if (0 == sExt2.compare(_T(".pptt"))) res = TCD_PPT2PPTT;
}break; }break;
......
...@@ -108,11 +108,13 @@ namespace NExtractTools ...@@ -108,11 +108,13 @@ namespace NExtractTools
TCD_PPT2PPTX, TCD_PPT2PPTX,
TCD_PPT2PPTT, TCD_PPT2PPTT,
TCD_PPT2PPTT_BIN, TCD_PPT2PPTT_BIN,
TCD_PPT2PPTM,
//doc 2 //doc 2
TCD_DOC2DOCT, TCD_DOC2DOCT,
TCD_DOC2DOCT_BIN, TCD_DOC2DOCT_BIN,
TCD_DOC2DOCX, TCD_DOC2DOCX,
//doc 2 TCD_DOC2DOCM,
//xls 2
TCD_XLS2XLST, TCD_XLS2XLST,
TCD_XLS2XLST_BIN, TCD_XLS2XLST_BIN,
TCD_XLS2XLSX, TCD_XLS2XLSX,
...@@ -953,10 +955,16 @@ namespace NExtractTools ...@@ -953,10 +955,16 @@ namespace NExtractTools
else if (0 == sArg3.compare(_T("ppt2pptx"))) { else if (0 == sArg3.compare(_T("ppt2pptx"))) {
res = TCD_PPT2PPTX; res = TCD_PPT2PPTX;
} }
else if (0 == sArg3.compare(_T("doc2docx"))) { else if (0 == sArg3.compare(_T("ppt2pptm"))) {
res = TCD_PPT2PPTM;
}
else if (0 == sArg3.compare(_T("doc2docx"))) {
res = TCD_DOC2DOCX; res = TCD_DOC2DOCX;
} }
else if (0 == sArg3.compare(_T("rtf2docx"))) { else if (0 == sArg3.compare(_T("doc2docm"))) {
res = TCD_DOC2DOCM;
}
else if (0 == sArg3.compare(_T("rtf2docx"))) {
res = TCD_RTF2DOCX; res = TCD_RTF2DOCX;
} }
else if (0 == sArg3.compare(_T("docx2rtf"))) { else if (0 == sArg3.compare(_T("docx2rtf"))) {
......
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