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