Commit e02c72b5 authored by ElenaSubbotina's avatar ElenaSubbotina

x2t version up. read/write xlsm.

parent c2964f92
...@@ -292,7 +292,7 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName, ...@@ -292,7 +292,7 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
if (pApp) if (pApp)
{ {
pApp->SetApplication(_T("OnlyOffice")); pApp->SetApplication(_T("OnlyOffice"));
pApp->SetAppVersion(_T("4.3000")); pApp->SetAppVersion(_T("5.0"));
pApp->SetDocSecurity(0); pApp->SetDocSecurity(0);
pApp->SetScaleCrop(false); pApp->SetScaleCrop(false);
pApp->SetLinksUpToDate(false); pApp->SetLinksUpToDate(false);
......
...@@ -368,7 +368,7 @@ namespace PPTX ...@@ -368,7 +368,7 @@ namespace PPTX
if (pApp) if (pApp)
{ {
pApp->SetApplication(_T("OnlyOffice")); pApp->SetApplication(_T("OnlyOffice"));
pApp->SetAppVersion(_T("4.3000")); pApp->SetAppVersion(_T("5.0"));
pApp->SetDocSecurity(0); pApp->SetDocSecurity(0);
pApp->SetScaleCrop(false); pApp->SetScaleCrop(false);
pApp->SetLinksUpToDate(false); pApp->SetLinksUpToDate(false);
......
...@@ -146,7 +146,7 @@ bool OOXWriter::SaveByItemEnd() ...@@ -146,7 +146,7 @@ bool OOXWriter::SaveByItemEnd()
if (m_poDocPropsApp) if (m_poDocPropsApp)
{ {
((OOX::CApp*)m_poDocPropsApp)->SetApplication ( L"OnlyOffice" ); ((OOX::CApp*)m_poDocPropsApp)->SetApplication ( L"OnlyOffice" );
((OOX::CApp*)m_poDocPropsApp)->SetAppVersion ( L"4.3" ); ((OOX::CApp*)m_poDocPropsApp)->SetAppVersion ( L"5.0" );
((OOX::CApp*)m_poDocPropsApp)->write(pathDocProps + FILE_SEPARATOR_STR + L"app.xml", pathDocProps.GetDirectory(), oContentTypes); ((OOX::CApp*)m_poDocPropsApp)->write(pathDocProps + FILE_SEPARATOR_STR + L"app.xml", pathDocProps.GetDirectory(), oContentTypes);
......
...@@ -216,7 +216,7 @@ void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::F ...@@ -216,7 +216,7 @@ void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::F
if (pApp) if (pApp)
{ {
pApp->SetApplication(_T("OnlyOffice")); pApp->SetApplication(_T("OnlyOffice"));
pApp->SetAppVersion(_T("4.3000")); pApp->SetAppVersion(_T("5.0"));
pApp->SetDocSecurity(0); pApp->SetDocSecurity(0);
pApp->SetScaleCrop(false); pApp->SetScaleCrop(false);
pApp->SetLinksUpToDate(false); pApp->SetLinksUpToDate(false);
......
...@@ -65,7 +65,8 @@ namespace OOX ...@@ -65,7 +65,8 @@ namespace OOX
else else
oFileName = oPath / oRelationFilename; oFileName = oPath / oRelationFilename;
if ( oRelation.Type() == FileTypes::Workbook ) if ( oRelation.Type() == FileTypes::Workbook ||
oRelation.Type() == FileTypes::WorkbookMacro)
return smart_ptr<OOX::File>(new CWorkbook( oRootPath, oFileName )); return smart_ptr<OOX::File>(new CWorkbook( oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::SharedStrings ) else if ( oRelation.Type() == FileTypes::SharedStrings )
return smart_ptr<OOX::File>(new CSharedStrings( oRootPath, oFileName )); return smart_ptr<OOX::File>(new CSharedStrings( oRootPath, oFileName ));
...@@ -120,7 +121,8 @@ namespace OOX ...@@ -120,7 +121,8 @@ namespace OOX
else else
oFileName = oPath / oRelationFilename; oFileName = oPath / oRelationFilename;
if ( pRelation->Type() == FileTypes::Workbook ) if ( pRelation->Type() == FileTypes::Workbook ||
pRelation->Type() == FileTypes::WorkbookMacro)
return smart_ptr<OOX::File>(new CWorkbook( oRootPath, oFileName )); return smart_ptr<OOX::File>(new CWorkbook( oRootPath, oFileName ));
else if ( pRelation->Type() == FileTypes::SharedStrings ) else if ( pRelation->Type() == FileTypes::SharedStrings )
return smart_ptr<OOX::File>(new CSharedStrings( oRootPath, oFileName )); return smart_ptr<OOX::File>(new CSharedStrings( oRootPath, oFileName ));
......
...@@ -46,6 +46,10 @@ namespace OOX ...@@ -46,6 +46,10 @@ namespace OOX
_T("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"), _T("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument")); _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"));
const FileType WorkbookMacro (L"xl", L"workbook.xml",
_T("application/vnd.ms-excel.sheet.macroEnabled.main+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"));
const FileType SharedStrings (L"", L"sharedStrings.xml", const FileType SharedStrings (L"", L"sharedStrings.xml",
_T("application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"), _T("application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings")); _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings"));
......
...@@ -66,11 +66,14 @@ namespace OOX ...@@ -66,11 +66,14 @@ namespace OOX
public: public:
CWorkbook() CWorkbook()
{ {
m_bMacroEnabled = false;
m_bSpreadsheets = true; m_bSpreadsheets = true;
} }
CWorkbook(const CPath& oRootPath, const CPath& oPath) CWorkbook(const CPath& oRootPath, const CPath& oPath)
{ {
m_bMacroEnabled = false;
m_bSpreadsheets = true; m_bSpreadsheets = true;
read(oRootPath, oPath); read(oRootPath, oPath);
} }
virtual ~CWorkbook() virtual ~CWorkbook()
...@@ -88,6 +91,11 @@ namespace OOX ...@@ -88,6 +91,11 @@ namespace OOX
m_oReadPath = oPath; m_oReadPath = oPath;
IFileContainer::Read( oRootPath, oPath ); IFileContainer::Read( oRootPath, oPath );
if (IFileContainer::IsExist(OOX::FileTypes::VbaProject))
{
m_bMacroEnabled = true;
}
XmlUtils::CXmlLiteReader oReader; XmlUtils::CXmlLiteReader oReader;
if ( !oReader.FromFile( oPath.GetPath() ) ) if ( !oReader.FromFile( oPath.GetPath() ) )
...@@ -149,7 +157,8 @@ namespace OOX ...@@ -149,7 +157,8 @@ namespace OOX
} }
virtual const OOX::FileType type() const virtual const OOX::FileType type() const
{ {
return OOX::Spreadsheet::FileTypes::Workbook; if (m_bMacroEnabled) return OOX::Spreadsheet::FileTypes::WorkbookMacro;
else return OOX::Spreadsheet::FileTypes::Workbook;
} }
virtual const CPath DefaultDirectory() const virtual const CPath DefaultDirectory() const
{ {
...@@ -211,6 +220,7 @@ namespace OOX ...@@ -211,6 +220,7 @@ namespace OOX
nullable<OOX::Spreadsheet::CWorkbookPr> m_oWorkbookPr; nullable<OOX::Spreadsheet::CWorkbookPr> m_oWorkbookPr;
nullable<OOX::Spreadsheet::CExternalReferences> m_oExternalReferences; nullable<OOX::Spreadsheet::CExternalReferences> m_oExternalReferences;
nullable<std::wstring> m_oPivotCachesXml; nullable<std::wstring> m_oPivotCachesXml;
bool m_bMacroEnabled;
}; };
} //Spreadsheet } //Spreadsheet
} // namespace OOX } // namespace OOX
......
...@@ -97,10 +97,14 @@ namespace OOX ...@@ -97,10 +97,14 @@ namespace OOX
// Ищем основной документ // Ищем основной документ
smart_ptr<OOX::File> pFile = Find(OOX::Spreadsheet::FileTypes::Workbook); smart_ptr<OOX::File> pFile = Find(OOX::Spreadsheet::FileTypes::Workbook);
if (pFile.IsInit() && OOX::Spreadsheet::FileTypes::Workbook == pFile->type()) if (pFile.IsInit() == false)
m_pWorkbook = (OOX::Spreadsheet::CWorkbook*)pFile.operator->(); {
else pFile = Find(OOX::Spreadsheet::FileTypes::WorkbookMacro);
m_pWorkbook = NULL; }
if (pFile.IsInit())
{
m_pWorkbook = dynamic_cast<OOX::Spreadsheet::CWorkbook*>(pFile.operator->());
}
if ( m_pWorkbook ) if ( m_pWorkbook )
{ {
...@@ -185,7 +189,7 @@ namespace OOX ...@@ -185,7 +189,7 @@ namespace OOX
//CApp //CApp
OOX::CApp* pApp = new OOX::CApp(); OOX::CApp* pApp = new OOX::CApp();
pApp->SetApplication(_T("OnlyOffice")); pApp->SetApplication(_T("OnlyOffice"));
pApp->SetAppVersion(_T("4.3000")); pApp->SetAppVersion(_T("5.0"));
pApp->SetDocSecurity(0); pApp->SetDocSecurity(0);
pApp->SetScaleCrop(false); pApp->SetScaleCrop(false);
pApp->SetLinksUpToDate(false); pApp->SetLinksUpToDate(false);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
QT -= core QT -= core
QT -= gui QT -= gui
VERSION = 2.4.472.0 VERSION = 2.4.475.0
DEFINES += INTVER=$$VERSION DEFINES += INTVER=$$VERSION
TARGET = x2t TARGET = x2t
......
...@@ -2117,6 +2117,7 @@ namespace BinXlsxRW { ...@@ -2117,6 +2117,7 @@ namespace BinXlsxRW {
smart_ptr<OOX::File> oFile = oFileVbaProject.smart_dynamic_cast<OOX::File>(); smart_ptr<OOX::File> oFile = oFileVbaProject.smart_dynamic_cast<OOX::File>();
const OOX::RId oRId = m_oWorkbook.Add(oFile); const OOX::RId oRId = m_oWorkbook.Add(oFile);
m_oWorkbook.m_bMacroEnabled = true;
return res; return res;
} }
......
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